@storybook/react-native 6.5.6-alpha.1 → 7.0.0-alpha.0

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/dist/index.d.ts CHANGED
@@ -1,19 +1,178 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Theme } from '@storybook/react-native-theming';
3
3
  export { Theme, darkTheme, theme } from '@storybook/react-native-theming';
4
- import * as _storybook_core_client from '@storybook/core-client';
5
- import { StoryApi } from '@storybook/addons';
6
- export { ArgTypes, Args, Parameters, StoryContext } from '@storybook/addons';
7
- import { ClientApi } from '@storybook/client-api';
4
+ import { C as C$1 } from './ClientApi-05c010e0.js';
8
5
  import { ReactElement, ComponentType, JSXElementConstructor, ComponentProps, ReactNode } from 'react';
9
- import { Args, ComponentAnnotations, AnnotatedStoryFn, StoryAnnotations } from '@storybook/csf';
6
+ import { Renderer as Renderer$1, Args as Args$1, ComponentAnnotations, AnnotatedStoryFn, StoryAnnotations } from '@storybook/csf';
7
+
8
+ declare global {
9
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
10
+ interface SymbolConstructor {
11
+ readonly observable: symbol;
12
+ }
13
+ }
14
+
15
+ interface SBBaseType {
16
+ required?: boolean;
17
+ raw?: string;
18
+ }
19
+ type SBScalarType = SBBaseType & {
20
+ name: 'boolean' | 'string' | 'number' | 'function' | 'symbol';
21
+ };
22
+ type SBArrayType = SBBaseType & {
23
+ name: 'array';
24
+ value: SBType;
25
+ };
26
+ type SBObjectType = SBBaseType & {
27
+ name: 'object';
28
+ value: Record<string, SBType>;
29
+ };
30
+ type SBEnumType = SBBaseType & {
31
+ name: 'enum';
32
+ value: (string | number)[];
33
+ };
34
+ type SBIntersectionType = SBBaseType & {
35
+ name: 'intersection';
36
+ value: SBType[];
37
+ };
38
+ type SBUnionType = SBBaseType & {
39
+ name: 'union';
40
+ value: SBType[];
41
+ };
42
+ type SBOtherType = SBBaseType & {
43
+ name: 'other';
44
+ value: string;
45
+ };
46
+ type SBType = SBScalarType | SBEnumType | SBArrayType | SBObjectType | SBIntersectionType | SBUnionType | SBOtherType;
47
+
48
+ type StoryId = string;
49
+ type ComponentId = string;
50
+ type ComponentTitle = string;
51
+ type StoryName$1 = string;
52
+ /** @deprecated */
53
+ type StoryKind$1 = ComponentTitle;
54
+ type Tag = string;
55
+ interface StoryIdentifier {
56
+ componentId: ComponentId;
57
+ title: ComponentTitle;
58
+ /** @deprecated */
59
+ kind: ComponentTitle;
60
+ id: StoryId;
61
+ name: StoryName$1;
62
+ /** @deprecated */
63
+ story: StoryName$1;
64
+ tags: Tag[];
65
+ }
66
+ interface Parameters {
67
+ [name: string]: any;
68
+ }
69
+ type ConditionalTest = {
70
+ truthy?: boolean;
71
+ } | {
72
+ exists: boolean;
73
+ } | {
74
+ eq: any;
75
+ } | {
76
+ neq: any;
77
+ };
78
+ type ConditionalValue = {
79
+ arg: string;
80
+ } | {
81
+ global: string;
82
+ };
83
+ type Conditional = ConditionalValue & ConditionalTest;
84
+ interface InputType {
85
+ name?: string;
86
+ description?: string;
87
+ defaultValue?: any;
88
+ type?: SBType | SBScalarType['name'];
89
+ if?: Conditional;
90
+ [key: string]: any;
91
+ }
92
+ interface StrictInputType extends InputType {
93
+ name: string;
94
+ type?: SBType;
95
+ }
96
+ interface Args {
97
+ [name: string]: any;
98
+ }
99
+ type ArgTypes<TArgs = Args> = {
100
+ [name in keyof TArgs]: InputType;
101
+ };
102
+ type StrictArgTypes<TArgs = Args> = {
103
+ [name in keyof TArgs]: StrictInputType;
104
+ };
105
+ type Globals = {
106
+ [name: string]: any;
107
+ };
108
+ type Renderer = {
109
+ /** What is the type of the `component` annotation in this renderer? */
110
+ component: unknown;
111
+ /** What does the story function return in this renderer? */
112
+ storyResult: unknown;
113
+ /** What type of element does this renderer render to? */
114
+ canvasElement: unknown;
115
+ T?: unknown;
116
+ };
117
+ type StoryContextForEnhancers<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryIdentifier & {
118
+ component?: (TRenderer & {
119
+ T: any;
120
+ })['component'];
121
+ subcomponents?: Record<string, (TRenderer & {
122
+ T: any;
123
+ })['component']>;
124
+ parameters: Parameters;
125
+ initialArgs: TArgs;
126
+ argTypes: StrictArgTypes<TArgs>;
127
+ };
128
+ type StoryContextUpdate<TArgs = Args> = {
129
+ args?: TArgs;
130
+ globals?: Globals;
131
+ [key: string]: any;
132
+ };
133
+ type ViewMode$1 = 'story' | 'docs';
134
+ type StoryContextForLoaders<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryContextForEnhancers<TRenderer, TArgs> & Required<StoryContextUpdate<TArgs>> & {
135
+ hooks: unknown;
136
+ viewMode: ViewMode$1;
137
+ originalStoryFn: StoryFn$1<TRenderer>;
138
+ };
139
+ type LoaderFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContextForLoaders<TRenderer, TArgs>) => Promise<Record<string, any>>;
140
+ type StoryContext<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryContextForLoaders<TRenderer, TArgs> & {
141
+ loaded: Record<string, any>;
142
+ abortSignal: AbortSignal;
143
+ canvasElement: TRenderer['canvasElement'];
144
+ };
145
+ type PartialStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (update?: StoryContextUpdate<Partial<TArgs>>) => TRenderer['storyResult'];
146
+ type LegacyStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContext<TRenderer, TArgs>) => TRenderer['storyResult'];
147
+ type ArgsStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (args: TArgs, context: StoryContext<TRenderer, TArgs>) => (TRenderer & {
148
+ T: TArgs;
149
+ })['storyResult'];
150
+ type StoryFn$1<TRenderer extends Renderer = Renderer, TArgs = Args> = LegacyStoryFn<TRenderer, TArgs> | ArgsStoryFn<TRenderer, TArgs>;
151
+ type DecoratorFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (fn: PartialStoryFn<TRenderer, TArgs>, c: StoryContext<TRenderer, TArgs>) => TRenderer['storyResult'];
152
+ type Addon_ReturnTypeFramework<ReturnType> = {
153
+ component: any;
154
+ storyResult: ReturnType;
155
+ canvasElement: any;
156
+ };
157
+ type Addon_StoryFn<ReturnType = unknown> = StoryFn$1<Addon_ReturnTypeFramework<ReturnType>>;
158
+ type Addon_DecoratorFunction<StoryFnReturnType = unknown> = DecoratorFunction<Addon_ReturnTypeFramework<StoryFnReturnType>>;
159
+ type Addon_LoaderFunction = LoaderFunction<Addon_ReturnTypeFramework<unknown>>;
160
+ type Addon_ClientApiReturnFn<StoryFnReturnType = unknown> = (...args: any[]) => Addon_StoryApi<StoryFnReturnType>;
161
+ interface Addon_StoryApi<StoryFnReturnType = unknown> {
162
+ kind: StoryKind$1;
163
+ add: (storyName: StoryName$1, storyFn: Addon_StoryFn<StoryFnReturnType>, parameters?: Parameters) => Addon_StoryApi<StoryFnReturnType>;
164
+ addDecorator: (decorator: Addon_DecoratorFunction<StoryFnReturnType>) => Addon_StoryApi<StoryFnReturnType>;
165
+ addLoader: (decorator: Addon_LoaderFunction) => Addon_StoryApi<StoryFnReturnType>;
166
+ addParameters: (parameters: Parameters) => Addon_StoryApi<StoryFnReturnType>;
167
+ [k: string]: string | Addon_ClientApiReturnFn<StoryFnReturnType>;
168
+ }
10
169
 
11
170
  type StoryFnReactReturnType = ReactElement<unknown>;
12
171
 
13
- type ReactNativeFramework = {
172
+ interface ReactNativeFramework extends Renderer$1 {
14
173
  component: ComponentType<any>;
15
174
  storyResult: StoryFnReactReturnType;
16
- };
175
+ }
17
176
  /**
18
177
  * For the common case where a component's stories are simple components that receives args as props:
19
178
  *
@@ -56,19 +215,19 @@ type ComponentStory<T extends keyof JSX.IntrinsicElements | JSXElementConstructo
56
215
  *
57
216
  * @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
58
217
  */
59
- type Meta<TArgs = Args> = ComponentAnnotations<ReactNativeFramework, TArgs>;
218
+ type Meta<TArgs = Args$1> = ComponentAnnotations<ReactNativeFramework, TArgs>;
60
219
  /**
61
220
  * Story function that represents a CSFv2 component example.
62
221
  *
63
222
  * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
64
223
  */
65
- type StoryFn<TArgs = Args> = AnnotatedStoryFn<ReactNativeFramework, TArgs>;
224
+ type StoryFn<TArgs = Args$1> = AnnotatedStoryFn<ReactNativeFramework, TArgs>;
66
225
  /**
67
226
  * Story function that represents a CSFv3 component example.
68
227
  *
69
228
  * @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
70
229
  */
71
- type StoryObj<TArgs = Args> = StoryAnnotations<ReactNativeFramework, TArgs>;
230
+ type StoryObj<TArgs = Args$1> = StoryAnnotations<ReactNativeFramework, TArgs>;
72
231
  /**
73
232
  * Story function that represents a CSFv2 component example.
74
233
  *
@@ -77,7 +236,7 @@ type StoryObj<TArgs = Args> = StoryAnnotations<ReactNativeFramework, TArgs>;
77
236
  * NOTE that in Storybook 7.0, this type will be renamed to `StoryFn` and replaced by the current `StoryObj` type.
78
237
  *
79
238
  */
80
- type Story<TArgs = Args> = StoryFn<TArgs>;
239
+ type Story<TArgs = Args$1> = StoryFn<TArgs>;
81
240
 
82
241
  type StoryKind = string;
83
242
  type StoryName = string;
@@ -111,18 +270,25 @@ type Params = {
111
270
  theme: DeepPartial<Theme>;
112
271
  };
113
272
 
114
- declare const configure: (loadable: _storybook_core_client.Loadable, m: NodeModule) => void;
273
+ declare global {
274
+ interface SymbolConstructor {
275
+ readonly observable: symbol;
276
+ }
277
+ }
278
+
279
+ declare const configure: (loadable: any, m: {
280
+ hot?: {
281
+ accept?: () => void;
282
+ };
283
+ }) => void;
115
284
 
116
- type C = ClientApi<ReactNativeFramework>;
117
- declare const setAddon: C['setAddon'];
285
+ type C = C$1<ReactNativeFramework>;
118
286
  declare const addDecorator: C['addDecorator'];
119
287
  declare const addParameters: C['addParameters'];
120
288
  declare const addArgsEnhancer: C['addArgsEnhancer'];
121
289
  declare const addArgTypesEnhancer: C['addArgTypesEnhancer'];
122
- declare const clearDecorators: C['clearDecorators'];
123
- declare const getStorybook: C['getStorybook'];
124
290
  declare const raw: C['raw'];
125
- declare const storiesOf: (kind: string, _module: NodeModule) => StoryApi<ReactNode>;
291
+ declare const storiesOf: (kind: string, _module: NodeModule) => Addon_StoryApi<ReactNode>;
126
292
  declare const getStorybookUI: (params?: Partial<Params>) => () => react_jsx_runtime.JSX.Element;
127
293
 
128
- export { ComponentMeta, ComponentStory, ComponentStoryFn, ComponentStoryObj, Meta, ReactNativeFramework, Story, StoryFn, StoryFnReactReturnType, StoryObj, addArgTypesEnhancer, addArgsEnhancer, addDecorator, addParameters, clearDecorators, configure, getStorybook, getStorybookUI, raw, setAddon, storiesOf };
294
+ export { ArgTypes, Args, ComponentMeta, ComponentStory, ComponentStoryFn, ComponentStoryObj, Meta, Parameters, ReactNativeFramework, Story, StoryContext, StoryFn, StoryFnReactReturnType, StoryObj, addArgTypesEnhancer, addArgsEnhancer, addDecorator, addParameters, configure, getStorybookUI, raw, storiesOf };