1 |
|
2 | import { HooksContext } from './hooks';
|
3 | import { Addon } from './index';
|
4 | export declare enum types {
|
5 | TAB = "tab",
|
6 | PANEL = "panel",
|
7 | TOOL = "tool",
|
8 | PREVIEW = "preview",
|
9 | NOTES_ELEMENT = "notes-element"
|
10 | }
|
11 | export declare type Types = types | string;
|
12 | export declare function isSupportedType(type: Types): boolean;
|
13 | export interface Parameters {
|
14 | fileName?: string;
|
15 | options?: OptionsParameter;
|
16 | [key: string]: any;
|
17 | }
|
18 | export interface StoryContext {
|
19 | id: string;
|
20 | name: string;
|
21 | kind: string;
|
22 | [key: string]: any;
|
23 | parameters: Parameters;
|
24 | hooks?: HooksContext;
|
25 | }
|
26 | export interface WrapperSettings {
|
27 | options: OptionsParameter;
|
28 | parameters: {
|
29 | [key: string]: any;
|
30 | };
|
31 | }
|
32 | export interface OptionsParameter extends Object {
|
33 | storySort?: any;
|
34 | hierarchyRootSeparator?: string;
|
35 | hierarchySeparator?: RegExp;
|
36 | showRoots?: boolean;
|
37 | theme?: {
|
38 | base: string;
|
39 | brandTitle?: string;
|
40 | };
|
41 | [key: string]: any;
|
42 | }
|
43 | export declare type StoryGetter = (context: StoryContext) => any;
|
44 | export declare type StoryFn<ReturnType = unknown> = (p?: StoryContext) => ReturnType;
|
45 | export declare type StoryWrapper = (getStory: StoryGetter, context: StoryContext, settings: WrapperSettings) => any;
|
46 | export declare type MakeDecoratorResult = (...args: any) => any;
|
47 | export interface AddStoryArgs<StoryFnReturnType = unknown> {
|
48 | id: string;
|
49 | kind: string;
|
50 | name: string;
|
51 | storyFn: StoryFn<StoryFnReturnType>;
|
52 | parameters: Parameters;
|
53 | }
|
54 | export interface ClientApiAddon<StoryFnReturnType = unknown> extends Addon {
|
55 | apply: (a: StoryApi<StoryFnReturnType>, b: any[]) => any;
|
56 | }
|
57 | export interface ClientApiAddons<StoryFnReturnType> {
|
58 | [key: string]: ClientApiAddon<StoryFnReturnType>;
|
59 | }
|
60 | export declare type ClientApiReturnFn<StoryFnReturnType> = (...args: any[]) => StoryApi<StoryFnReturnType>;
|
61 | export interface StoryApi<StoryFnReturnType = unknown> {
|
62 | kind: string;
|
63 | add: (storyName: string, storyFn: StoryFn<StoryFnReturnType>, parameters?: Parameters) => StoryApi<StoryFnReturnType>;
|
64 | addDecorator: (decorator: DecoratorFunction<StoryFnReturnType>) => StoryApi<StoryFnReturnType>;
|
65 | addParameters: (parameters: Parameters) => StoryApi<StoryFnReturnType>;
|
66 | [k: string]: string | ClientApiReturnFn<StoryFnReturnType>;
|
67 | }
|
68 | export declare type DecoratorFunction<StoryFnReturnType = unknown> = (fn: StoryFn<StoryFnReturnType>, c: StoryContext) => ReturnType<StoryFn<StoryFnReturnType>>;
|
69 | export interface ClientStoryApi<StoryFnReturnType = unknown> {
|
70 | storiesOf(kind: string, module: NodeModule): StoryApi<StoryFnReturnType>;
|
71 | addDecorator(decorator: DecoratorFunction<StoryFnReturnType>): StoryApi<StoryFnReturnType>;
|
72 | addParameters(parameter: Parameters): StoryApi<StoryFnReturnType>;
|
73 | }
|
74 | declare type LoadFn = () => any;
|
75 | declare type RequireContext = any;
|
76 | export declare type Loadable = RequireContext | [RequireContext] | LoadFn;
|
77 | export {};
|