1 | import React from 'react';
|
2 | import { StoryId, StoryKind, Args, Parameters } from '../index';
|
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 | parameters?: {
|
47 | fileName: string;
|
48 | options: {
|
49 | [optionName: string]: any;
|
50 | };
|
51 | docsOnly?: boolean;
|
52 | viewMode?: ViewMode;
|
53 | [parameterName: string]: any;
|
54 | };
|
55 | args: Args;
|
56 | initialArgs: Args;
|
57 | }
|
58 | export interface StoryInput {
|
59 | id: StoryId;
|
60 | name: string;
|
61 | refId?: string;
|
62 | kind: StoryKind;
|
63 | children: string[];
|
64 | parameters: {
|
65 | fileName: string;
|
66 | options: {
|
67 | [optionName: string]: any;
|
68 | };
|
69 | docsOnly?: boolean;
|
70 | viewMode?: ViewMode;
|
71 | [parameterName: string]: any;
|
72 | };
|
73 | isLeaf: boolean;
|
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 | export declare type SetStoriesPayload = {
|
86 | v: 2;
|
87 | error?: Error;
|
88 | globals: Args;
|
89 | globalParameters: Parameters;
|
90 | stories: StoriesRaw;
|
91 | kindParameters: {
|
92 | [kind: string]: Parameters;
|
93 | };
|
94 | } | ({
|
95 | v?: number;
|
96 | stories: StoriesRaw;
|
97 | } & Record<string, never>);
|
98 | export declare const denormalizeStoryParameters: ({ globalParameters, kindParameters, stories, }: SetStoriesPayload) => StoriesRaw;
|
99 | export declare const transformStoriesRawToStoriesHash: (input: StoriesRaw, { provider }: {
|
100 | provider: Provider;
|
101 | }) => StoriesHash;
|
102 | export declare type Item = StoriesHash[keyof StoriesHash];
|
103 | export declare function isRoot(item: Item): item is Root;
|
104 | export declare function isGroup(item: Item): item is Group;
|
105 | export declare function isStory(item: Item): item is Story;
|