1 | import { Addon, StoryId, StoryName, StoryKind, ViewMode, StoryIdentifier, StoryFn, Parameters, Args, ArgTypes, StoryApi, DecoratorFunction, LoaderFunction, DecorateStoryFunction, StoryContext } from '@storybook/addons';
|
2 | import StoryStore from './story_store';
|
3 | import { HooksContext } from './hooks';
|
4 | export interface ErrorLike {
|
5 | message: string;
|
6 | stack: string;
|
7 | }
|
8 | export interface StoryMetadata {
|
9 | parameters?: Parameters;
|
10 | decorators?: DecoratorFunction[];
|
11 | loaders?: LoaderFunction[];
|
12 | }
|
13 | export declare type ArgTypesEnhancer = (context: StoryContext) => ArgTypes;
|
14 | export declare type ArgsEnhancer = (context: StoryContext) => Args;
|
15 | export declare type StorySpecifier = StoryId | {
|
16 | name: StoryName;
|
17 | kind: StoryKind;
|
18 | } | '*';
|
19 | export interface StoreSelectionSpecifier {
|
20 | storySpecifier: StorySpecifier;
|
21 | viewMode: ViewMode;
|
22 | singleStory?: boolean;
|
23 | args?: Args;
|
24 | globals?: Args;
|
25 | }
|
26 | export interface StoreSelection {
|
27 | storyId: StoryId;
|
28 | viewMode: ViewMode;
|
29 | }
|
30 | export declare type AddStoryArgs = StoryIdentifier & {
|
31 | storyFn: StoryFn<any>;
|
32 | parameters?: Parameters;
|
33 | decorators?: DecoratorFunction[];
|
34 | loaders?: LoaderFunction[];
|
35 | };
|
36 | export declare type StoreItem = StoryIdentifier & {
|
37 | parameters: Parameters;
|
38 | getDecorated: () => StoryFn<any>;
|
39 | getOriginal: () => StoryFn<any>;
|
40 | applyLoaders: () => Promise<StoryContext>;
|
41 | runPlayFunction: () => Promise<any>;
|
42 | storyFn: StoryFn<any>;
|
43 | unboundStoryFn: StoryFn<any>;
|
44 | hooks: HooksContext;
|
45 | args: Args;
|
46 | initialArgs: Args;
|
47 | argTypes: ArgTypes;
|
48 | };
|
49 | export declare type PublishedStoreItem = StoreItem & {
|
50 | globals: Args;
|
51 | };
|
52 | export interface StoreData {
|
53 | [key: string]: StoreItem;
|
54 | }
|
55 | export interface ClientApiParams {
|
56 | storyStore: StoryStore;
|
57 | decorateStory?: DecorateStoryFunction;
|
58 | noStoryModuleAddMethodHotDispose?: boolean;
|
59 | }
|
60 | export declare type ClientApiReturnFn<StoryFnReturnType> = (...args: any[]) => StoryApi<StoryFnReturnType>;
|
61 | export type { StoryApi, DecoratorFunction };
|
62 | export interface ClientApiAddon<StoryFnReturnType = unknown> extends Addon {
|
63 | apply: (a: StoryApi<StoryFnReturnType>, b: any[]) => any;
|
64 | }
|
65 | export interface ClientApiAddons<StoryFnReturnType> {
|
66 | [key: string]: ClientApiAddon<StoryFnReturnType>;
|
67 | }
|
68 | export interface GetStorybookStory {
|
69 | name: string;
|
70 | render: StoryFn;
|
71 | }
|
72 | export interface GetStorybookKind {
|
73 | kind: string;
|
74 | fileName: string;
|
75 | stories: GetStorybookStory[];
|
76 | }
|
77 | export declare type RenderContextWithoutStoryContext = StoreItem & {
|
78 | forceRender: boolean;
|
79 | showMain: () => void;
|
80 | showError: (error: {
|
81 | title: string;
|
82 | description: string;
|
83 | }) => void;
|
84 | showException: (err: Error) => void;
|
85 | };
|
86 | export declare type RenderContext = RenderContextWithoutStoryContext & {
|
87 | storyContext: StoryContext;
|
88 | };
|
89 | interface SBBaseType {
|
90 | required?: boolean;
|
91 | raw?: string;
|
92 | }
|
93 | export declare type SBScalarType = SBBaseType & {
|
94 | name: 'boolean' | 'string' | 'number' | 'function';
|
95 | };
|
96 | export declare type SBArrayType = SBBaseType & {
|
97 | name: 'array';
|
98 | value: SBType;
|
99 | };
|
100 | export declare type SBObjectType = SBBaseType & {
|
101 | name: 'object';
|
102 | value: Record<string, SBType>;
|
103 | };
|
104 | export declare type SBEnumType = SBBaseType & {
|
105 | name: 'enum';
|
106 | value: (string | number)[];
|
107 | };
|
108 | export declare type SBIntersectionType = SBBaseType & {
|
109 | name: 'intersection';
|
110 | value: SBType[];
|
111 | };
|
112 | export declare type SBUnionType = SBBaseType & {
|
113 | name: 'union';
|
114 | value: SBType[];
|
115 | };
|
116 | export declare type SBOtherType = SBBaseType & {
|
117 | name: 'other';
|
118 | value: string;
|
119 | };
|
120 | export declare type SBType = SBScalarType | SBEnumType | SBArrayType | SBObjectType | SBIntersectionType | SBUnionType | SBOtherType;
|