UNPKG

1.53 kBTypeScriptView Raw
1import { toId } from '@storybook/csf';
2import type { StoriesHash, Story, Group, StoryId, Root, StoriesRaw } from '../lib/stories';
3import { Args, ModuleFn } from '../index';
4declare type Direction = -1 | 1;
5declare type ParameterName = string;
6declare type ViewMode = 'story' | 'info' | 'settings' | string | undefined;
7export interface SubState {
8 storiesHash: StoriesHash;
9 storyId: StoryId;
10 viewMode: ViewMode;
11 storiesConfigured: boolean;
12 storiesFailed?: Error;
13}
14export interface SubAPI {
15 storyId: typeof toId;
16 resolveStory: (storyId: StoryId, refsId?: string) => Story | Group | Root;
17 selectFirstStory: () => void;
18 selectStory: (kindOrId: string, story?: string, obj?: {
19 ref?: string;
20 viewMode?: ViewMode;
21 }) => void;
22 getCurrentStoryData: () => Story | Group;
23 setStories: (stories: StoriesRaw, failed?: Error) => Promise<void>;
24 jumpToComponent: (direction: Direction) => void;
25 jumpToStory: (direction: Direction) => void;
26 getData: (storyId: StoryId, refId?: string) => Story | Group;
27 getParameters: (storyId: StoryId | {
28 storyId: StoryId;
29 refId: string;
30 }, parameterName?: ParameterName) => Story['parameters'] | any;
31 getCurrentParameter<S>(parameterName?: ParameterName): S;
32 updateStoryArgs(story: Story, newArgs: Args): void;
33 resetStoryArgs: (story: Story, argNames?: string[]) => void;
34 findLeafStoryId(StoriesHash: StoriesHash, storyId: StoryId): StoryId;
35}
36export declare const init: ModuleFn;
37export {};