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