-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
public-api.ts
29 lines (23 loc) · 1.09 KB
/
public-api.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* eslint-disable prefer-destructuring */
import { Addon_ClientStoryApi, Addon_Loadable } from '@storybook/types';
import { start } from '@storybook/core-client';
import { renderToCanvas, render } from './render';
import decorateStory from './decorateStory';
import { AngularRenderer } from './types';
export * from './public-types';
const RENDERER = 'angular';
interface ClientApi extends Addon_ClientStoryApi<AngularRenderer['storyResult']> {
configure(loader: Addon_Loadable, module: NodeModule): void;
forceReRender(): void;
raw: () => any; // todo add type
load: (...args: any[]) => void;
}
const api = start<AngularRenderer>(renderToCanvas, { decorateStory, render });
export const storiesOf: ClientApi['storiesOf'] = (kind, m) => {
return (api.clientApi.storiesOf(kind, m) as ReturnType<ClientApi['storiesOf']>).addParameters({
renderer: RENDERER,
});
};
export const configure: ClientApi['configure'] = (...args) => api.configure(RENDERER, ...args);
export const forceReRender: ClientApi['forceReRender'] = api.forceReRender;
export const raw: ClientApi['raw'] = api.clientApi.raw;