UNPKG

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