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