@storybook/react-native 7.0.0-alpha.5 → 7.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/V6.js +1 -0
- package/dist/V6.d.ts +28 -0
- package/dist/V6.js +2247 -0
- package/dist/View-8eae84cb.d.ts +128 -0
- package/dist/index.d-680e82dc.d.ts +201 -0
- package/dist/index.d.ts +18 -286
- package/dist/index.js +375 -486
- package/dist/preview.d.ts +12 -0
- package/dist/preview.js +34 -0
- package/package.json +15 -13
- package/scripts/__snapshots__/generate.test.js.snap +121 -0
- package/scripts/__snapshots__/loader.test.js.snap +0 -27
- package/scripts/common.js +68 -0
- package/scripts/generate.js +104 -0
- package/scripts/generate.test.js +95 -0
- package/scripts/get-stories.js +7 -2
- package/scripts/handle-args.js +4 -2
- package/scripts/loader.js +10 -56
- package/scripts/loader.test.js +2 -6
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Renderer, Args, ComponentAnnotations, AnnotatedStoryFn, StoryAnnotations, StoryContext } from '@storybook/csf';
|
|
3
|
+
import { PreviewWithSelection } from '@storybook/preview-web';
|
|
4
|
+
import { Theme } from '@storybook/react-native-theming';
|
|
5
|
+
import { c as StoryIndex } from './index.d-680e82dc.js';
|
|
6
|
+
import { ReactElement, ComponentType, JSXElementConstructor, ComponentProps } from 'react';
|
|
7
|
+
import { Channel } from '@storybook/channels';
|
|
8
|
+
|
|
9
|
+
type StoryFnReactReturnType = ReactElement<unknown>;
|
|
10
|
+
|
|
11
|
+
interface ReactNativeFramework extends Renderer {
|
|
12
|
+
component: ComponentType<any>;
|
|
13
|
+
storyResult: StoryFnReactReturnType;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* For the common case where a component's stories are simple components that receives args as props:
|
|
17
|
+
*
|
|
18
|
+
* ```tsx
|
|
19
|
+
* export default { ... } as ComponentMeta<typeof Button>;
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
type ComponentMeta<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Meta<ComponentProps<T>>;
|
|
23
|
+
/**
|
|
24
|
+
* For the common case where a (CSFv2) story is a simple component that receives args as props:
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
type ComponentStoryFn<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryFn<ComponentProps<T>>;
|
|
31
|
+
/**
|
|
32
|
+
* For the common case where a (CSFv3) story is a simple component that receives args as props:
|
|
33
|
+
*
|
|
34
|
+
* ```tsx
|
|
35
|
+
* const MyStory: ComponentStory<typeof Button> = {
|
|
36
|
+
* args: { buttonArg1: 'val' },
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
type ComponentStoryObj<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryObj<ComponentProps<T>>;
|
|
41
|
+
/**
|
|
42
|
+
* For the common case where a (CSFv2) story is a simple component that receives args as props:
|
|
43
|
+
*
|
|
44
|
+
* ```tsx
|
|
45
|
+
* const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* NOTE: this is an alias for `ComponentStoryFn`.
|
|
49
|
+
* In Storybook v7, `ComponentStory` will alias `ComponentStoryObj`
|
|
50
|
+
*/
|
|
51
|
+
type ComponentStory<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Story<ComponentProps<T>>;
|
|
52
|
+
/**
|
|
53
|
+
* Metadata to configure the stories for a component.
|
|
54
|
+
*
|
|
55
|
+
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
56
|
+
*/
|
|
57
|
+
type Meta<TArgs = Args> = ComponentAnnotations<ReactNativeFramework, TArgs>;
|
|
58
|
+
/**
|
|
59
|
+
* Story function that represents a CSFv2 component example.
|
|
60
|
+
*
|
|
61
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
62
|
+
*/
|
|
63
|
+
type StoryFn<TArgs = Args> = AnnotatedStoryFn<ReactNativeFramework, TArgs>;
|
|
64
|
+
/**
|
|
65
|
+
* Story function that represents a CSFv3 component example.
|
|
66
|
+
*
|
|
67
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
68
|
+
*/
|
|
69
|
+
type StoryObj<TArgs = Args> = StoryAnnotations<ReactNativeFramework, TArgs>;
|
|
70
|
+
/**
|
|
71
|
+
* Story function that represents a CSFv2 component example.
|
|
72
|
+
*
|
|
73
|
+
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
74
|
+
*
|
|
75
|
+
* NOTE that in Storybook 7.0, this type will be renamed to `StoryFn` and replaced by the current `StoryObj` type.
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
type Story<TArgs = Args> = StoryFn<TArgs>;
|
|
79
|
+
|
|
80
|
+
type StoryKind = string;
|
|
81
|
+
type StoryName = string;
|
|
82
|
+
type InitialSelection = `${StoryKind}--${StoryName}` | {
|
|
83
|
+
/**
|
|
84
|
+
* Kind is the default export name or the storiesOf("name") name
|
|
85
|
+
*/
|
|
86
|
+
kind: StoryKind;
|
|
87
|
+
/**
|
|
88
|
+
* Name is the named export or the .add("name") name
|
|
89
|
+
*/
|
|
90
|
+
name: StoryName;
|
|
91
|
+
};
|
|
92
|
+
type DeepPartial<T> = T extends object ? {
|
|
93
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
94
|
+
} : T;
|
|
95
|
+
type Params = {
|
|
96
|
+
onDeviceUI?: boolean;
|
|
97
|
+
enableWebsockets?: boolean;
|
|
98
|
+
query?: string;
|
|
99
|
+
host?: string;
|
|
100
|
+
port?: number;
|
|
101
|
+
secured?: boolean;
|
|
102
|
+
initialSelection?: InitialSelection;
|
|
103
|
+
shouldPersistSelection?: boolean;
|
|
104
|
+
tabOpen?: number;
|
|
105
|
+
isUIHidden?: boolean;
|
|
106
|
+
isSplitPanelVisible?: boolean;
|
|
107
|
+
shouldDisableKeyboardAvoidingView?: boolean;
|
|
108
|
+
keyboardAvoidingViewVerticalOffset?: number;
|
|
109
|
+
theme: DeepPartial<Theme>;
|
|
110
|
+
};
|
|
111
|
+
declare class View {
|
|
112
|
+
_storyIndex: StoryIndex;
|
|
113
|
+
_setStory: (story: StoryContext<ReactNativeFramework>) => void;
|
|
114
|
+
_forceRerender: () => void;
|
|
115
|
+
_ready: boolean;
|
|
116
|
+
_preview: PreviewWithSelection<ReactNativeFramework>;
|
|
117
|
+
_asyncStorageStoryId: string;
|
|
118
|
+
_webUrl: string;
|
|
119
|
+
_channel: Channel;
|
|
120
|
+
constructor(preview: PreviewWithSelection<ReactNativeFramework>, channel: Channel);
|
|
121
|
+
_getInitialStory: ({ initialSelection, shouldPersistSelection, }?: Partial<Params>) => Promise<{
|
|
122
|
+
storySpecifier: string;
|
|
123
|
+
viewMode: string;
|
|
124
|
+
}>;
|
|
125
|
+
getStorybookUI: (params?: Partial<Params>) => () => react_jsx_runtime.JSX.Element;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { ComponentMeta as C, Meta as M, Params as P, ReactNativeFramework as R, StoryFnReactReturnType as S, View as V, ComponentStoryFn as a, ComponentStoryObj as b, ComponentStory as c, StoryFn as d, StoryObj as e, Story as f };
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface SymbolConstructor {
|
|
3
|
+
readonly observable: symbol;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface SBBaseType {
|
|
8
|
+
required?: boolean;
|
|
9
|
+
raw?: string;
|
|
10
|
+
}
|
|
11
|
+
type SBScalarType = SBBaseType & {
|
|
12
|
+
name: 'boolean' | 'string' | 'number' | 'function' | 'symbol';
|
|
13
|
+
};
|
|
14
|
+
type SBArrayType = SBBaseType & {
|
|
15
|
+
name: 'array';
|
|
16
|
+
value: SBType;
|
|
17
|
+
};
|
|
18
|
+
type SBObjectType = SBBaseType & {
|
|
19
|
+
name: 'object';
|
|
20
|
+
value: Record<string, SBType>;
|
|
21
|
+
};
|
|
22
|
+
type SBEnumType = SBBaseType & {
|
|
23
|
+
name: 'enum';
|
|
24
|
+
value: (string | number)[];
|
|
25
|
+
};
|
|
26
|
+
type SBIntersectionType = SBBaseType & {
|
|
27
|
+
name: 'intersection';
|
|
28
|
+
value: SBType[];
|
|
29
|
+
};
|
|
30
|
+
type SBUnionType = SBBaseType & {
|
|
31
|
+
name: 'union';
|
|
32
|
+
value: SBType[];
|
|
33
|
+
};
|
|
34
|
+
type SBOtherType = SBBaseType & {
|
|
35
|
+
name: 'other';
|
|
36
|
+
value: string;
|
|
37
|
+
};
|
|
38
|
+
type SBType = SBScalarType | SBEnumType | SBArrayType | SBObjectType | SBIntersectionType | SBUnionType | SBOtherType;
|
|
39
|
+
|
|
40
|
+
type StoryId = string;
|
|
41
|
+
type ComponentId = string;
|
|
42
|
+
type ComponentTitle = string;
|
|
43
|
+
type StoryName = string;
|
|
44
|
+
/** @deprecated */
|
|
45
|
+
type StoryKind = ComponentTitle;
|
|
46
|
+
type Tag = string;
|
|
47
|
+
interface StoryIdentifier {
|
|
48
|
+
componentId: ComponentId;
|
|
49
|
+
title: ComponentTitle;
|
|
50
|
+
/** @deprecated */
|
|
51
|
+
kind: ComponentTitle;
|
|
52
|
+
id: StoryId;
|
|
53
|
+
name: StoryName;
|
|
54
|
+
/** @deprecated */
|
|
55
|
+
story: StoryName;
|
|
56
|
+
tags: Tag[];
|
|
57
|
+
}
|
|
58
|
+
interface Parameters {
|
|
59
|
+
[name: string]: any;
|
|
60
|
+
}
|
|
61
|
+
type ConditionalTest = {
|
|
62
|
+
truthy?: boolean;
|
|
63
|
+
} | {
|
|
64
|
+
exists: boolean;
|
|
65
|
+
} | {
|
|
66
|
+
eq: any;
|
|
67
|
+
} | {
|
|
68
|
+
neq: any;
|
|
69
|
+
};
|
|
70
|
+
type ConditionalValue = {
|
|
71
|
+
arg: string;
|
|
72
|
+
} | {
|
|
73
|
+
global: string;
|
|
74
|
+
};
|
|
75
|
+
type Conditional = ConditionalValue & ConditionalTest;
|
|
76
|
+
interface InputType {
|
|
77
|
+
name?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
defaultValue?: any;
|
|
80
|
+
type?: SBType | SBScalarType['name'];
|
|
81
|
+
if?: Conditional;
|
|
82
|
+
[key: string]: any;
|
|
83
|
+
}
|
|
84
|
+
interface StrictInputType extends InputType {
|
|
85
|
+
name: string;
|
|
86
|
+
type?: SBType;
|
|
87
|
+
}
|
|
88
|
+
interface Args {
|
|
89
|
+
[name: string]: any;
|
|
90
|
+
}
|
|
91
|
+
type ArgTypes<TArgs = Args> = {
|
|
92
|
+
[name in keyof TArgs]: InputType;
|
|
93
|
+
};
|
|
94
|
+
type StrictArgTypes<TArgs = Args> = {
|
|
95
|
+
[name in keyof TArgs]: StrictInputType;
|
|
96
|
+
};
|
|
97
|
+
type Globals = {
|
|
98
|
+
[name: string]: any;
|
|
99
|
+
};
|
|
100
|
+
type Renderer = {
|
|
101
|
+
/** What is the type of the `component` annotation in this renderer? */
|
|
102
|
+
component: unknown;
|
|
103
|
+
/** What does the story function return in this renderer? */
|
|
104
|
+
storyResult: unknown;
|
|
105
|
+
/** What type of element does this renderer render to? */
|
|
106
|
+
canvasElement: unknown;
|
|
107
|
+
T?: unknown;
|
|
108
|
+
};
|
|
109
|
+
type StoryContextForEnhancers<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryIdentifier & {
|
|
110
|
+
component?: (TRenderer & {
|
|
111
|
+
T: any;
|
|
112
|
+
})['component'];
|
|
113
|
+
subcomponents?: Record<string, (TRenderer & {
|
|
114
|
+
T: any;
|
|
115
|
+
})['component']>;
|
|
116
|
+
parameters: Parameters;
|
|
117
|
+
initialArgs: TArgs;
|
|
118
|
+
argTypes: StrictArgTypes<TArgs>;
|
|
119
|
+
};
|
|
120
|
+
type StoryContextUpdate<TArgs = Args> = {
|
|
121
|
+
args?: TArgs;
|
|
122
|
+
globals?: Globals;
|
|
123
|
+
[key: string]: any;
|
|
124
|
+
};
|
|
125
|
+
type ViewMode$1 = 'story' | 'docs';
|
|
126
|
+
type StoryContextForLoaders<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryContextForEnhancers<TRenderer, TArgs> & Required<StoryContextUpdate<TArgs>> & {
|
|
127
|
+
hooks: unknown;
|
|
128
|
+
viewMode: ViewMode$1;
|
|
129
|
+
originalStoryFn: StoryFn<TRenderer>;
|
|
130
|
+
};
|
|
131
|
+
type LoaderFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContextForLoaders<TRenderer, TArgs>) => Promise<Record<string, any>>;
|
|
132
|
+
type StoryContext<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryContextForLoaders<TRenderer, TArgs> & {
|
|
133
|
+
loaded: Record<string, any>;
|
|
134
|
+
abortSignal: AbortSignal;
|
|
135
|
+
canvasElement: TRenderer['canvasElement'];
|
|
136
|
+
};
|
|
137
|
+
type PartialStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (update?: StoryContextUpdate<Partial<TArgs>>) => TRenderer['storyResult'];
|
|
138
|
+
type LegacyStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContext<TRenderer, TArgs>) => TRenderer['storyResult'];
|
|
139
|
+
type ArgsStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (args: TArgs, context: StoryContext<TRenderer, TArgs>) => (TRenderer & {
|
|
140
|
+
T: TArgs;
|
|
141
|
+
})['storyResult'];
|
|
142
|
+
type StoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = LegacyStoryFn<TRenderer, TArgs> | ArgsStoryFn<TRenderer, TArgs>;
|
|
143
|
+
type DecoratorFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (fn: PartialStoryFn<TRenderer, TArgs>, c: StoryContext<TRenderer, TArgs>) => TRenderer['storyResult'];
|
|
144
|
+
interface StoriesSpecifier {
|
|
145
|
+
/**
|
|
146
|
+
* When auto-titling, what to prefix all generated titles with (default: '')
|
|
147
|
+
*/
|
|
148
|
+
titlePrefix?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Where to start looking for story files
|
|
151
|
+
*/
|
|
152
|
+
directory: string;
|
|
153
|
+
/**
|
|
154
|
+
* What does the filename of a story file look like?
|
|
155
|
+
* (a glob, relative to directory, no leading `./`)
|
|
156
|
+
* If unset, we use `** / *.@(mdx|stories.@(mdx|js|jsx|mjs|ts|tsx))` (no spaces)
|
|
157
|
+
*/
|
|
158
|
+
files?: string;
|
|
159
|
+
}
|
|
160
|
+
type NormalizedStoriesSpecifier = Required<StoriesSpecifier> & {
|
|
161
|
+
importPathMatcher: RegExp;
|
|
162
|
+
};
|
|
163
|
+
interface BaseIndexEntry {
|
|
164
|
+
id: StoryId;
|
|
165
|
+
name: StoryName;
|
|
166
|
+
title: ComponentTitle;
|
|
167
|
+
tags?: Tag[];
|
|
168
|
+
importPath: Path;
|
|
169
|
+
}
|
|
170
|
+
type StoryIndexEntry = BaseIndexEntry & {
|
|
171
|
+
type: 'story';
|
|
172
|
+
};
|
|
173
|
+
type DocsIndexEntry = BaseIndexEntry & {
|
|
174
|
+
storiesImports: Path[];
|
|
175
|
+
type: 'docs';
|
|
176
|
+
};
|
|
177
|
+
type IndexEntry = StoryIndexEntry | DocsIndexEntry;
|
|
178
|
+
interface StoryIndex {
|
|
179
|
+
v: number;
|
|
180
|
+
entries: Record<StoryId, IndexEntry>;
|
|
181
|
+
}
|
|
182
|
+
type Addon_ReturnTypeFramework<ReturnType> = {
|
|
183
|
+
component: any;
|
|
184
|
+
storyResult: ReturnType;
|
|
185
|
+
canvasElement: any;
|
|
186
|
+
};
|
|
187
|
+
type Addon_StoryFn<ReturnType = unknown> = StoryFn<Addon_ReturnTypeFramework<ReturnType>>;
|
|
188
|
+
type Addon_DecoratorFunction<StoryFnReturnType = unknown> = DecoratorFunction<Addon_ReturnTypeFramework<StoryFnReturnType>>;
|
|
189
|
+
type Addon_LoaderFunction = LoaderFunction<Addon_ReturnTypeFramework<unknown>>;
|
|
190
|
+
type Addon_ClientApiReturnFn<StoryFnReturnType = unknown> = (...args: any[]) => Addon_StoryApi<StoryFnReturnType>;
|
|
191
|
+
interface Addon_StoryApi<StoryFnReturnType = unknown> {
|
|
192
|
+
kind: StoryKind;
|
|
193
|
+
add: (storyName: StoryName, storyFn: Addon_StoryFn<StoryFnReturnType>, parameters?: Parameters) => Addon_StoryApi<StoryFnReturnType>;
|
|
194
|
+
addDecorator: (decorator: Addon_DecoratorFunction<StoryFnReturnType>) => Addon_StoryApi<StoryFnReturnType>;
|
|
195
|
+
addLoader: (decorator: Addon_LoaderFunction) => Addon_StoryApi<StoryFnReturnType>;
|
|
196
|
+
addParameters: (parameters: Parameters) => Addon_StoryApi<StoryFnReturnType>;
|
|
197
|
+
[k: string]: string | Addon_ClientApiReturnFn<StoryFnReturnType>;
|
|
198
|
+
}
|
|
199
|
+
type Path = string;
|
|
200
|
+
|
|
201
|
+
export { Args as A, NormalizedStoriesSpecifier as N, Parameters as P, Renderer as R, StoryContext as S, ArgTypes as a, Addon_StoryApi as b, StoryIndex as c, StoryContextForEnhancers as d, StrictArgTypes as e };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,287 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { V as View } from './View-8eae84cb.js';
|
|
2
|
+
export { C as ComponentMeta, c as ComponentStory, a as ComponentStoryFn, b as ComponentStoryObj, M as Meta, R as ReactNativeFramework, f as Story, d as StoryFn, S as StoryFnReactReturnType, e as StoryObj } from './View-8eae84cb.js';
|
|
3
3
|
export { Theme, darkTheme, theme } from '@storybook/react-native-theming';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
type SBArrayType = SBBaseType & {
|
|
22
|
-
name: 'array';
|
|
23
|
-
value: SBType;
|
|
24
|
-
};
|
|
25
|
-
type SBObjectType = SBBaseType & {
|
|
26
|
-
name: 'object';
|
|
27
|
-
value: Record<string, SBType>;
|
|
28
|
-
};
|
|
29
|
-
type SBEnumType = SBBaseType & {
|
|
30
|
-
name: 'enum';
|
|
31
|
-
value: (string | number)[];
|
|
32
|
-
};
|
|
33
|
-
type SBIntersectionType = SBBaseType & {
|
|
34
|
-
name: 'intersection';
|
|
35
|
-
value: SBType[];
|
|
36
|
-
};
|
|
37
|
-
type SBUnionType = SBBaseType & {
|
|
38
|
-
name: 'union';
|
|
39
|
-
value: SBType[];
|
|
40
|
-
};
|
|
41
|
-
type SBOtherType = SBBaseType & {
|
|
42
|
-
name: 'other';
|
|
43
|
-
value: string;
|
|
44
|
-
};
|
|
45
|
-
type SBType = SBScalarType | SBEnumType | SBArrayType | SBObjectType | SBIntersectionType | SBUnionType | SBOtherType;
|
|
46
|
-
|
|
47
|
-
type StoryId = string;
|
|
48
|
-
type ComponentId = string;
|
|
49
|
-
type ComponentTitle = string;
|
|
50
|
-
type StoryName$1 = string;
|
|
51
|
-
/** @deprecated */
|
|
52
|
-
type StoryKind$1 = ComponentTitle;
|
|
53
|
-
type Tag = string;
|
|
54
|
-
interface StoryIdentifier {
|
|
55
|
-
componentId: ComponentId;
|
|
56
|
-
title: ComponentTitle;
|
|
57
|
-
/** @deprecated */
|
|
58
|
-
kind: ComponentTitle;
|
|
59
|
-
id: StoryId;
|
|
60
|
-
name: StoryName$1;
|
|
61
|
-
/** @deprecated */
|
|
62
|
-
story: StoryName$1;
|
|
63
|
-
tags: Tag[];
|
|
64
|
-
}
|
|
65
|
-
interface Parameters {
|
|
66
|
-
[name: string]: any;
|
|
67
|
-
}
|
|
68
|
-
type ConditionalTest = {
|
|
69
|
-
truthy?: boolean;
|
|
70
|
-
} | {
|
|
71
|
-
exists: boolean;
|
|
72
|
-
} | {
|
|
73
|
-
eq: any;
|
|
74
|
-
} | {
|
|
75
|
-
neq: any;
|
|
76
|
-
};
|
|
77
|
-
type ConditionalValue = {
|
|
78
|
-
arg: string;
|
|
79
|
-
} | {
|
|
80
|
-
global: string;
|
|
81
|
-
};
|
|
82
|
-
type Conditional = ConditionalValue & ConditionalTest;
|
|
83
|
-
interface InputType {
|
|
84
|
-
name?: string;
|
|
85
|
-
description?: string;
|
|
86
|
-
defaultValue?: any;
|
|
87
|
-
type?: SBType | SBScalarType['name'];
|
|
88
|
-
if?: Conditional;
|
|
89
|
-
[key: string]: any;
|
|
90
|
-
}
|
|
91
|
-
interface StrictInputType extends InputType {
|
|
92
|
-
name: string;
|
|
93
|
-
type?: SBType;
|
|
94
|
-
}
|
|
95
|
-
interface Args {
|
|
96
|
-
[name: string]: any;
|
|
97
|
-
}
|
|
98
|
-
type ArgTypes<TArgs = Args> = {
|
|
99
|
-
[name in keyof TArgs]: InputType;
|
|
100
|
-
};
|
|
101
|
-
type StrictArgTypes<TArgs = Args> = {
|
|
102
|
-
[name in keyof TArgs]: StrictInputType;
|
|
103
|
-
};
|
|
104
|
-
type Globals = {
|
|
105
|
-
[name: string]: any;
|
|
106
|
-
};
|
|
107
|
-
type Renderer = {
|
|
108
|
-
/** What is the type of the `component` annotation in this renderer? */
|
|
109
|
-
component: unknown;
|
|
110
|
-
/** What does the story function return in this renderer? */
|
|
111
|
-
storyResult: unknown;
|
|
112
|
-
/** What type of element does this renderer render to? */
|
|
113
|
-
canvasElement: unknown;
|
|
114
|
-
T?: unknown;
|
|
115
|
-
};
|
|
116
|
-
type StoryContextForEnhancers<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryIdentifier & {
|
|
117
|
-
component?: (TRenderer & {
|
|
118
|
-
T: any;
|
|
119
|
-
})['component'];
|
|
120
|
-
subcomponents?: Record<string, (TRenderer & {
|
|
121
|
-
T: any;
|
|
122
|
-
})['component']>;
|
|
123
|
-
parameters: Parameters;
|
|
124
|
-
initialArgs: TArgs;
|
|
125
|
-
argTypes: StrictArgTypes<TArgs>;
|
|
126
|
-
};
|
|
127
|
-
type StoryContextUpdate<TArgs = Args> = {
|
|
128
|
-
args?: TArgs;
|
|
129
|
-
globals?: Globals;
|
|
130
|
-
[key: string]: any;
|
|
131
|
-
};
|
|
132
|
-
type ViewMode$1 = 'story' | 'docs';
|
|
133
|
-
type StoryContextForLoaders<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryContextForEnhancers<TRenderer, TArgs> & Required<StoryContextUpdate<TArgs>> & {
|
|
134
|
-
hooks: unknown;
|
|
135
|
-
viewMode: ViewMode$1;
|
|
136
|
-
originalStoryFn: StoryFn$1<TRenderer>;
|
|
137
|
-
};
|
|
138
|
-
type LoaderFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContextForLoaders<TRenderer, TArgs>) => Promise<Record<string, any>>;
|
|
139
|
-
type StoryContext<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryContextForLoaders<TRenderer, TArgs> & {
|
|
140
|
-
loaded: Record<string, any>;
|
|
141
|
-
abortSignal: AbortSignal;
|
|
142
|
-
canvasElement: TRenderer['canvasElement'];
|
|
143
|
-
};
|
|
144
|
-
type PartialStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (update?: StoryContextUpdate<Partial<TArgs>>) => TRenderer['storyResult'];
|
|
145
|
-
type LegacyStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContext<TRenderer, TArgs>) => TRenderer['storyResult'];
|
|
146
|
-
type ArgsStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (args: TArgs, context: StoryContext<TRenderer, TArgs>) => (TRenderer & {
|
|
147
|
-
T: TArgs;
|
|
148
|
-
})['storyResult'];
|
|
149
|
-
type StoryFn$1<TRenderer extends Renderer = Renderer, TArgs = Args> = LegacyStoryFn<TRenderer, TArgs> | ArgsStoryFn<TRenderer, TArgs>;
|
|
150
|
-
type DecoratorFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (fn: PartialStoryFn<TRenderer, TArgs>, c: StoryContext<TRenderer, TArgs>) => TRenderer['storyResult'];
|
|
151
|
-
type Addon_ReturnTypeFramework<ReturnType> = {
|
|
152
|
-
component: any;
|
|
153
|
-
storyResult: ReturnType;
|
|
154
|
-
canvasElement: any;
|
|
155
|
-
};
|
|
156
|
-
type Addon_StoryFn<ReturnType = unknown> = StoryFn$1<Addon_ReturnTypeFramework<ReturnType>>;
|
|
157
|
-
type Addon_DecoratorFunction<StoryFnReturnType = unknown> = DecoratorFunction<Addon_ReturnTypeFramework<StoryFnReturnType>>;
|
|
158
|
-
type Addon_LoaderFunction = LoaderFunction<Addon_ReturnTypeFramework<unknown>>;
|
|
159
|
-
type Addon_ClientApiReturnFn<StoryFnReturnType = unknown> = (...args: any[]) => Addon_StoryApi<StoryFnReturnType>;
|
|
160
|
-
interface Addon_StoryApi<StoryFnReturnType = unknown> {
|
|
161
|
-
kind: StoryKind$1;
|
|
162
|
-
add: (storyName: StoryName$1, storyFn: Addon_StoryFn<StoryFnReturnType>, parameters?: Parameters) => Addon_StoryApi<StoryFnReturnType>;
|
|
163
|
-
addDecorator: (decorator: Addon_DecoratorFunction<StoryFnReturnType>) => Addon_StoryApi<StoryFnReturnType>;
|
|
164
|
-
addLoader: (decorator: Addon_LoaderFunction) => Addon_StoryApi<StoryFnReturnType>;
|
|
165
|
-
addParameters: (parameters: Parameters) => Addon_StoryApi<StoryFnReturnType>;
|
|
166
|
-
[k: string]: string | Addon_ClientApiReturnFn<StoryFnReturnType>;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
type StoryFnReactReturnType = ReactElement<unknown>;
|
|
170
|
-
|
|
171
|
-
interface ReactNativeFramework extends Renderer$1 {
|
|
172
|
-
component: ComponentType<any>;
|
|
173
|
-
storyResult: StoryFnReactReturnType;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* For the common case where a component's stories are simple components that receives args as props:
|
|
177
|
-
*
|
|
178
|
-
* ```tsx
|
|
179
|
-
* export default { ... } as ComponentMeta<typeof Button>;
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
type ComponentMeta<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Meta<ComponentProps<T>>;
|
|
183
|
-
/**
|
|
184
|
-
* For the common case where a (CSFv2) story is a simple component that receives args as props:
|
|
185
|
-
*
|
|
186
|
-
* ```tsx
|
|
187
|
-
* const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
|
|
188
|
-
* ```
|
|
189
|
-
*/
|
|
190
|
-
type ComponentStoryFn<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryFn<ComponentProps<T>>;
|
|
191
|
-
/**
|
|
192
|
-
* For the common case where a (CSFv3) story is a simple component that receives args as props:
|
|
193
|
-
*
|
|
194
|
-
* ```tsx
|
|
195
|
-
* const MyStory: ComponentStory<typeof Button> = {
|
|
196
|
-
* args: { buttonArg1: 'val' },
|
|
197
|
-
* }
|
|
198
|
-
* ```
|
|
199
|
-
*/
|
|
200
|
-
type ComponentStoryObj<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryObj<ComponentProps<T>>;
|
|
201
|
-
/**
|
|
202
|
-
* For the common case where a (CSFv2) story is a simple component that receives args as props:
|
|
203
|
-
*
|
|
204
|
-
* ```tsx
|
|
205
|
-
* const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
|
|
206
|
-
* ```
|
|
207
|
-
*
|
|
208
|
-
* NOTE: this is an alias for `ComponentStoryFn`.
|
|
209
|
-
* In Storybook v7, `ComponentStory` will alias `ComponentStoryObj`
|
|
210
|
-
*/
|
|
211
|
-
type ComponentStory<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Story<ComponentProps<T>>;
|
|
212
|
-
/**
|
|
213
|
-
* Metadata to configure the stories for a component.
|
|
214
|
-
*
|
|
215
|
-
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
216
|
-
*/
|
|
217
|
-
type Meta<TArgs = Args$1> = ComponentAnnotations<ReactNativeFramework, TArgs>;
|
|
218
|
-
/**
|
|
219
|
-
* Story function that represents a CSFv2 component example.
|
|
220
|
-
*
|
|
221
|
-
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
222
|
-
*/
|
|
223
|
-
type StoryFn<TArgs = Args$1> = AnnotatedStoryFn<ReactNativeFramework, TArgs>;
|
|
224
|
-
/**
|
|
225
|
-
* Story function that represents a CSFv3 component example.
|
|
226
|
-
*
|
|
227
|
-
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
228
|
-
*/
|
|
229
|
-
type StoryObj<TArgs = Args$1> = StoryAnnotations<ReactNativeFramework, TArgs>;
|
|
230
|
-
/**
|
|
231
|
-
* Story function that represents a CSFv2 component example.
|
|
232
|
-
*
|
|
233
|
-
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
234
|
-
*
|
|
235
|
-
* NOTE that in Storybook 7.0, this type will be renamed to `StoryFn` and replaced by the current `StoryObj` type.
|
|
236
|
-
*
|
|
237
|
-
*/
|
|
238
|
-
type Story<TArgs = Args$1> = StoryFn<TArgs>;
|
|
239
|
-
|
|
240
|
-
type StoryKind = string;
|
|
241
|
-
type StoryName = string;
|
|
242
|
-
type InitialSelection = `${StoryKind}--${StoryName}` | {
|
|
243
|
-
/**
|
|
244
|
-
* Kind is the default export name or the storiesOf("name") name
|
|
245
|
-
*/
|
|
246
|
-
kind: StoryKind;
|
|
247
|
-
/**
|
|
248
|
-
* Name is the named export or the .add("name") name
|
|
249
|
-
*/
|
|
250
|
-
name: StoryName;
|
|
251
|
-
};
|
|
252
|
-
type DeepPartial<T> = T extends object ? {
|
|
253
|
-
[P in keyof T]?: DeepPartial<T[P]>;
|
|
254
|
-
} : T;
|
|
255
|
-
type Params = {
|
|
256
|
-
onDeviceUI?: boolean;
|
|
257
|
-
enableWebsockets?: boolean;
|
|
258
|
-
query?: string;
|
|
259
|
-
host?: string;
|
|
260
|
-
port?: number;
|
|
261
|
-
secured?: boolean;
|
|
262
|
-
initialSelection?: InitialSelection;
|
|
263
|
-
shouldPersistSelection?: boolean;
|
|
264
|
-
tabOpen?: number;
|
|
265
|
-
isUIHidden?: boolean;
|
|
266
|
-
isSplitPanelVisible?: boolean;
|
|
267
|
-
shouldDisableKeyboardAvoidingView?: boolean;
|
|
268
|
-
keyboardAvoidingViewVerticalOffset?: number;
|
|
269
|
-
theme: DeepPartial<Theme>;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
declare const configure: (loadable: any, m: {
|
|
273
|
-
hot?: {
|
|
274
|
-
accept?: () => void;
|
|
275
|
-
};
|
|
276
|
-
}) => void;
|
|
277
|
-
|
|
278
|
-
type C = ClientApi<ReactNativeFramework>;
|
|
279
|
-
declare const addDecorator: C['addDecorator'];
|
|
280
|
-
declare const addParameters: C['addParameters'];
|
|
281
|
-
declare const addArgsEnhancer: C['addArgsEnhancer'];
|
|
282
|
-
declare const addArgTypesEnhancer: C['addArgTypesEnhancer'];
|
|
283
|
-
declare const raw: C['raw'];
|
|
284
|
-
declare const storiesOf: (kind: string, m: any) => Addon_StoryApi<ReactNode>;
|
|
285
|
-
declare const getStorybookUI: (params?: Partial<Params>) => () => react_jsx_runtime.JSX.Element;
|
|
286
|
-
|
|
287
|
-
export { ArgTypes, Args, ComponentMeta, ComponentStory, ComponentStoryFn, ComponentStoryObj, Meta, Parameters, ReactNativeFramework, Story, StoryContext, StoryFn, StoryFnReactReturnType, StoryObj, addArgTypesEnhancer, addArgsEnhancer, addDecorator, addParameters, configure, getStorybookUI, raw, storiesOf };
|
|
4
|
+
import { N as NormalizedStoriesSpecifier } from './index.d-680e82dc.js';
|
|
5
|
+
export { a as ArgTypes, A as Args, P as Parameters, S as StoryContext } from './index.d-680e82dc.js';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import '@storybook/csf';
|
|
8
|
+
import '@storybook/preview-web';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '@storybook/channels';
|
|
11
|
+
|
|
12
|
+
declare function start({ annotations, storyEntries, }: {
|
|
13
|
+
storyEntries: Array<NormalizedStoriesSpecifier & {
|
|
14
|
+
req: any;
|
|
15
|
+
}>;
|
|
16
|
+
annotations: any[];
|
|
17
|
+
}): View;
|
|
18
|
+
|
|
19
|
+
export { start };
|