/
index.ts
34 lines (25 loc) · 1.14 KB
/
index.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
30
31
32
33
34
import { start } from '@storybook/core/client';
import './globals';
import { ClientStoryApi, Loadable } from '@storybook/addons';
import render from './render';
import { IStorybookSection, StoryFnMithrilReturnType } from './types';
const { configure: coreConfigure, clientApi, forceReRender } = start(render);
const framework = 'mithril';
interface ClientApi extends ClientStoryApi<StoryFnMithrilReturnType> {
setAddon(addon: any): void;
configure(loader: Loadable, module: NodeModule): void;
getStorybook(): IStorybookSection[];
clearDecorators(): void;
forceReRender(): void;
raw: () => any; // todo add type
}
export const storiesOf: ClientApi['storiesOf'] = (kind, m) =>
(clientApi.storiesOf(kind, m) as ReturnType<ClientApi['storiesOf']>).addParameters({ framework });
export const configure: ClientApi['configure'] = (...args) => coreConfigure(...args, framework);
export const { setAddon } = clientApi;
export const { addDecorator } = clientApi;
export const { addParameters } = clientApi;
export const { clearDecorators } = clientApi;
export const { getStorybook } = clientApi;
export const { raw } = clientApi;
export { forceReRender };