UNPKG

2.82 kBTypeScriptView Raw
1import { Addon, StoryId, StoryName, StoryKind, ViewMode, StoryFn, Parameters, Args, ArgTypes, StoryApi, DecoratorFunction, LoaderFunction, StoryContext } from '@storybook/addons';
2import { AnyFramework, StoryIdentifier, ProjectAnnotations } from '@storybook/csf';
3import { StoryStore, HooksContext, RenderContext } from '@storybook/store';
4export type { SBType, SBScalarType, SBArrayType, SBObjectType, SBEnumType, SBIntersectionType, SBUnionType, SBOtherType, } from '@storybook/csf';
5export interface ErrorLike {
6 message: string;
7 stack: string;
8}
9export interface StoryMetadata {
10 parameters?: Parameters;
11 decorators?: DecoratorFunction[];
12 loaders?: LoaderFunction[];
13}
14export declare type ArgTypesEnhancer = (context: StoryContext) => ArgTypes;
15export declare type ArgsEnhancer = (context: StoryContext) => Args;
16declare type StorySpecifier = StoryId | {
17 name: StoryName;
18 kind: StoryKind;
19} | '*';
20export interface StoreSelectionSpecifier {
21 storySpecifier: StorySpecifier;
22 viewMode: ViewMode;
23 singleStory?: boolean;
24 args?: Args;
25 globals?: Args;
26}
27export interface StoreSelection {
28 storyId: StoryId;
29 viewMode: ViewMode;
30}
31export declare type AddStoryArgs = StoryIdentifier & {
32 storyFn: StoryFn<any>;
33 parameters?: Parameters;
34 decorators?: DecoratorFunction[];
35 loaders?: LoaderFunction[];
36};
37export declare type StoreItem = StoryIdentifier & {
38 parameters: Parameters;
39 getDecorated: () => StoryFn<any>;
40 getOriginal: () => StoryFn<any>;
41 applyLoaders: () => Promise<StoryContext>;
42 playFunction: (context: StoryContext) => Promise<void> | void;
43 storyFn: StoryFn<any>;
44 unboundStoryFn: StoryFn<any>;
45 hooks: HooksContext<AnyFramework>;
46 args: Args;
47 initialArgs: Args;
48 argTypes: ArgTypes;
49};
50export declare type PublishedStoreItem = StoreItem & {
51 globals: Args;
52};
53export interface StoreData {
54 [key: string]: StoreItem;
55}
56export interface ClientApiParams {
57 storyStore: StoryStore<AnyFramework>;
58 decorateStory?: ProjectAnnotations<AnyFramework>['applyDecorators'];
59 noStoryModuleAddMethodHotDispose?: boolean;
60}
61export declare type ClientApiReturnFn<StoryFnReturnType> = (...args: any[]) => StoryApi<StoryFnReturnType>;
62export type { StoryApi, DecoratorFunction };
63export interface ClientApiAddon<StoryFnReturnType = unknown> extends Addon {
64 apply: (a: StoryApi<StoryFnReturnType>, b: any[]) => any;
65}
66export interface ClientApiAddons<StoryFnReturnType> {
67 [key: string]: ClientApiAddon<StoryFnReturnType>;
68}
69export interface GetStorybookStory {
70 name: string;
71 render: StoryFn;
72}
73export interface GetStorybookKind {
74 kind: string;
75 fileName: string;
76 stories: GetStorybookStory[];
77}
78export declare type RenderContextWithoutStoryContext = Omit<RenderContext, 'storyContext'>;