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