1 | import React from 'react';
|
2 | import type { StoryId, ComponentTitle, StoryKind, StoryName, Args, ArgTypes, Parameters } from '@storybook/csf';
|
3 | import type { Provider } from '../modules/provider';
|
4 | import type { ViewMode } from '../modules/addons';
|
5 | export type { StoryId };
|
6 | export interface Root {
|
7 | type: 'root';
|
8 | id: StoryId;
|
9 | depth: 0;
|
10 | name: string;
|
11 | refId?: string;
|
12 | children: StoryId[];
|
13 | isComponent: false;
|
14 | isRoot: true;
|
15 | isLeaf: false;
|
16 | renderLabel?: (item: Root) => React.ReactNode;
|
17 | startCollapsed?: boolean;
|
18 | }
|
19 | export interface Group {
|
20 | type: 'group' | 'component';
|
21 | id: StoryId;
|
22 | depth: number;
|
23 | name: string;
|
24 | children: StoryId[];
|
25 | refId?: string;
|
26 | parent?: StoryId;
|
27 | isComponent: boolean;
|
28 | isRoot: false;
|
29 | isLeaf: false;
|
30 | renderLabel?: (item: Group) => React.ReactNode;
|
31 | parameters?: {
|
32 | docsOnly?: boolean;
|
33 | viewMode?: ViewMode;
|
34 | };
|
35 | }
|
36 | export interface Story {
|
37 | type: 'story' | 'docs';
|
38 | id: StoryId;
|
39 | depth: number;
|
40 | parent: StoryId;
|
41 | name: string;
|
42 | kind: StoryKind;
|
43 | refId?: string;
|
44 | children?: StoryId[];
|
45 | isComponent: boolean;
|
46 | isRoot: false;
|
47 | isLeaf: true;
|
48 | renderLabel?: (item: Story) => React.ReactNode;
|
49 | prepared: boolean;
|
50 | parameters?: {
|
51 | fileName: string;
|
52 | options: {
|
53 | [optionName: string]: any;
|
54 | };
|
55 | docsOnly?: boolean;
|
56 | viewMode?: ViewMode;
|
57 | [parameterName: string]: any;
|
58 | };
|
59 | args?: Args;
|
60 | argTypes?: ArgTypes;
|
61 | initialArgs?: Args;
|
62 | }
|
63 | export interface StoryInput {
|
64 | id: StoryId;
|
65 | name: string;
|
66 | refId?: string;
|
67 | kind: StoryKind;
|
68 | parameters: {
|
69 | fileName: string;
|
70 | options: {
|
71 | [optionName: string]: any;
|
72 | };
|
73 | docsOnly?: boolean;
|
74 | viewMode?: ViewMode;
|
75 | [parameterName: string]: any;
|
76 | };
|
77 | args?: Args;
|
78 | initialArgs?: Args;
|
79 | }
|
80 | export interface StoriesHash {
|
81 | [id: string]: Root | Group | Story;
|
82 | }
|
83 | export declare type StoriesList = (Group | Story)[];
|
84 | export declare type GroupsList = (Root | Group)[];
|
85 | export interface StoriesRaw {
|
86 | [id: string]: StoryInput;
|
87 | }
|
88 | declare type Path = string;
|
89 | export interface StoryIndexStory {
|
90 | id: StoryId;
|
91 | name: StoryName;
|
92 | title: ComponentTitle;
|
93 | importPath: Path;
|
94 | parameters?: Parameters;
|
95 | }
|
96 | export interface StoryIndex {
|
97 | v: number;
|
98 | stories: Record<StoryId, StoryIndexStory>;
|
99 | }
|
100 | export declare type SetStoriesPayload = {
|
101 | v: 2;
|
102 | error?: Error;
|
103 | globals: Args;
|
104 | globalParameters: Parameters;
|
105 | stories: StoriesRaw;
|
106 | kindParameters: {
|
107 | [kind: string]: Parameters;
|
108 | };
|
109 | } | ({
|
110 | v?: number;
|
111 | stories: StoriesRaw;
|
112 | } & Record<string, never>);
|
113 | export declare const denormalizeStoryParameters: ({ globalParameters, kindParameters, stories, }: SetStoriesPayload) => StoriesRaw;
|
114 | export declare const transformStoryIndexToStoriesHash: (index: StoryIndex, { provider }: {
|
115 | provider: Provider;
|
116 | }) => StoriesHash;
|
117 | export declare const transformStoriesRawToStoriesHash: (input: StoriesRaw, { provider, prepared }: {
|
118 | provider: Provider;
|
119 | prepared?: Story['prepared'];
|
120 | }) => StoriesHash;
|
121 | export declare type Item = StoriesHash[keyof StoriesHash];
|
122 | export declare function isRoot(item: Item): item is Root;
|
123 | export declare function isGroup(item: Item): item is Group;
|
124 | export declare function isStory(item: Item): item is Story;
|
125 | export declare const getComponentLookupList: (hash: StoriesHash) => string[][];
|
126 | export declare const getStoriesLookupList: (hash: StoriesHash) => string[];
|