@storybook/types 7.1.0-alpha.4 → 7.1.0-alpha.40

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
@@ -18,31 +18,44 @@ type Primitive =
18
18
  | symbol
19
19
  | bigint;
20
20
 
21
- declare global {
22
- interface SymbolConstructor {
23
- readonly observable: symbol;
24
- }
25
- }
21
+ /**
22
+ Matches a JSON object.
23
+
24
+ This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.
25
+
26
+ @category JSON
27
+ */
28
+ type JsonObject = {[Key in string]: JsonValue} & {[Key in string]?: JsonValue | undefined};
26
29
 
27
30
  /**
28
- @see Simplify
31
+ Matches a JSON array.
32
+
33
+ @category JSON
29
34
  */
30
- interface SimplifyOptions {
31
- /**
32
- Do the simplification recursively.
35
+ type JsonArray = JsonValue[] | readonly JsonValue[];
33
36
 
34
- @default false
35
- */
36
- deep?: boolean;
37
- }
37
+ /**
38
+ Matches any valid JSON primitive value.
38
39
 
39
- // Flatten a type without worrying about the result.
40
- type Flatten<
41
- AnyType,
42
- Options extends SimplifyOptions = {},
43
- > = Options['deep'] extends true
44
- ? {[KeyType in keyof AnyType]: Simplify<AnyType[KeyType], Options>}
45
- : {[KeyType in keyof AnyType]: AnyType[KeyType]};
40
+ @category JSON
41
+ */
42
+ type JsonPrimitive = string | number | boolean | null;
43
+
44
+ /**
45
+ Matches any valid JSON value.
46
+
47
+ @see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`.
48
+
49
+ @category JSON
50
+ */
51
+ type JsonValue = JsonPrimitive | JsonObject | JsonArray;
52
+
53
+ declare global {
54
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
55
+ interface SymbolConstructor {
56
+ readonly observable: symbol;
57
+ }
58
+ }
46
59
 
47
60
  /**
48
61
  Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
@@ -101,15 +114,12 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
101
114
 
102
115
  @category Object
103
116
  */
104
- type Simplify<
105
- AnyType,
106
- Options extends SimplifyOptions = {},
107
- > = Flatten<AnyType> extends AnyType
108
- ? Flatten<AnyType, Options>
109
- : AnyType;
117
+ type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};
110
118
 
111
119
  /**
112
- Remove any index signatures from the given object type, so that only explicitly defined properties remain.
120
+ Omit any index signatures from the given object type, leaving only explicitly defined properties.
121
+
122
+ This is the counterpart of `PickIndexSignature`.
113
123
 
114
124
  Use-cases:
115
125
  - Remove overly permissive signatures from third-party types.
@@ -144,20 +154,20 @@ type Keyed = {} extends Record<'foo' | 'bar', unknown>
144
154
  Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
145
155
 
146
156
  ```
147
- import type {RemoveIndexSignature} from 'type-fest';
157
+ import type {OmitIndexSignature} from 'type-fest';
148
158
 
149
- type RemoveIndexSignature<ObjectType> = {
159
+ type OmitIndexSignature<ObjectType> = {
150
160
  [KeyType in keyof ObjectType // Map each key of `ObjectType`...
151
- ]: ObjectType[KeyType]; // ...to its original value, i.e. `RemoveIndexSignature<Foo> == Foo`.
161
+ ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
152
162
  };
153
163
  ```
154
164
 
155
165
  ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
156
166
 
157
167
  ```
158
- import type {RemoveIndexSignature} from 'type-fest';
168
+ import type {OmitIndexSignature} from 'type-fest';
159
169
 
160
- type RemoveIndexSignature<ObjectType> = {
170
+ type OmitIndexSignature<ObjectType> = {
161
171
  [KeyType in keyof ObjectType
162
172
  // Is `{}` assignable to `Record<KeyType, unknown>`?
163
173
  as {} extends Record<KeyType, unknown>
@@ -170,9 +180,9 @@ type RemoveIndexSignature<ObjectType> = {
170
180
  If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
171
181
 
172
182
  ```
173
- import type {RemoveIndexSignature} from 'type-fest';
183
+ import type {OmitIndexSignature} from 'type-fest';
174
184
 
175
- type RemoveIndexSignature<ObjectType> = {
185
+ type OmitIndexSignature<ObjectType> = {
176
186
  [KeyType in keyof ObjectType
177
187
  as {} extends Record<KeyType, unknown>
178
188
  ? never // => Remove this `KeyType`.
@@ -183,7 +193,7 @@ type RemoveIndexSignature<ObjectType> = {
183
193
 
184
194
  @example
185
195
  ```
186
- import type {RemoveIndexSignature} from 'type-fest';
196
+ import type {OmitIndexSignature} from 'type-fest';
187
197
 
188
198
  interface Example {
189
199
  // These index signatures will be removed.
@@ -201,13 +211,14 @@ interface Example {
201
211
  qux?: 'baz';
202
212
  }
203
213
 
204
- type ExampleWithoutIndexSignatures = RemoveIndexSignature<Example>;
214
+ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
205
215
  // => { foo: 'bar'; qux?: 'baz' | undefined; }
206
216
  ```
207
217
 
218
+ @see PickIndexSignature
208
219
  @category Object
209
220
  */
210
- type RemoveIndexSignature<ObjectType> = {
221
+ type OmitIndexSignature<ObjectType> = {
211
222
  [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
212
223
  ? never
213
224
  : KeyType]: ObjectType[KeyType];
@@ -304,9 +315,9 @@ type UnionToIntersection<Union> = (
304
315
  : never
305
316
  // Infer the `Intersection` type since TypeScript represents the positional
306
317
  // arguments of unions of functions as an intersection of the union.
307
- ) extends ((mergedIntersection: infer Intersection) => void)
308
- ? Intersection
309
- : never;
318
+ ) extends ((mergedIntersection: infer Intersection) => void)
319
+ ? Intersection
320
+ : never;
310
321
 
311
322
  declare namespace PackageJson$1 {
312
323
  /**
@@ -334,8 +345,8 @@ declare namespace PackageJson$1 {
334
345
  email?: string;
335
346
  };
336
347
 
337
- export interface DirectoryLocations {
338
- [directoryType: string]: unknown;
348
+ export type DirectoryLocations = {
349
+ [directoryType: string]: JsonValue | undefined;
339
350
 
340
351
  /**
341
352
  Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder.
@@ -366,7 +377,7 @@ declare namespace PackageJson$1 {
366
377
  Location for test files.
367
378
  */
368
379
  test?: string;
369
- }
380
+ };
370
381
 
371
382
  export type Scripts = {
372
383
  /**
@@ -516,22 +527,11 @@ declare namespace PackageJson$1 {
516
527
  export type Dependency = Partial<Record<string, string>>;
517
528
 
518
529
  /**
519
- Conditions which provide a way to resolve a package entry point based on the environment.
530
+ A mapping of conditions and the paths to which they resolve.
520
531
  */
521
- export type ExportCondition = LiteralUnion<
522
- | 'import'
523
- | 'require'
524
- | 'node'
525
- | 'node-addons'
526
- | 'deno'
527
- | 'browser'
528
- | 'electron'
529
- | 'react-native'
530
- | 'default',
531
- string
532
- >;
533
-
534
- type ExportConditions = {[condition in ExportCondition]: Exports};
532
+ type ExportConditions = { // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
533
+ [condition: string]: Exports;
534
+ };
535
535
 
536
536
  /**
537
537
  Entry points of a module, optionally with conditions and subpath exports.
@@ -540,16 +540,16 @@ declare namespace PackageJson$1 {
540
540
  | null
541
541
  | string
542
542
  | Array<string | ExportConditions>
543
- | ExportConditions
544
- | {[path: string]: Exports}; // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
543
+ | ExportConditions;
545
544
 
546
545
  /**
547
- Import map entries of a module, optionally with conditions.
546
+ Import map entries of a module, optionally with conditions and subpath imports.
548
547
  */
549
548
  export type Imports = { // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
550
- [key: string]: string | {[key in ExportCondition]: Exports};
549
+ [key: `#${string}`]: Exports;
551
550
  };
552
551
 
552
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
553
553
  export interface NonStandardEntryPoints {
554
554
  /**
555
555
  An ECMAScript module ID that is the primary entry point to the program.
@@ -582,7 +582,7 @@ declare namespace PackageJson$1 {
582
582
  sideEffects?: boolean | string[];
583
583
  }
584
584
 
585
- export interface TypeScriptConfiguration {
585
+ export type TypeScriptConfiguration = {
586
586
  /**
587
587
  Location of the bundled TypeScript declaration file.
588
588
  */
@@ -597,12 +597,12 @@ declare namespace PackageJson$1 {
597
597
  Location of the bundled TypeScript declaration file. Alias of `types`.
598
598
  */
599
599
  typings?: string;
600
- }
600
+ };
601
601
 
602
602
  /**
603
- An alternative configuration for Yarn workspaces.
603
+ An alternative configuration for workspaces.
604
604
  */
605
- export interface WorkspaceConfig {
605
+ export type WorkspaceConfig = {
606
606
  /**
607
607
  An array of workspace pattern strings which contain the workspace packages.
608
608
  */
@@ -611,10 +611,11 @@ declare namespace PackageJson$1 {
611
611
  /**
612
612
  Designed to solve the problem of packages which break when their `node_modules` are moved to the root workspace directory - a process known as hoisting. For these packages, both within your workspace, and also some that have been installed via `node_modules`, it is important to have a mechanism for preventing the default Yarn workspace behavior. By adding workspace pattern strings here, Yarn will resume non-workspace behavior for any package which matches the defined patterns.
613
613
 
614
- [Read more](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/)
614
+ [Supported](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/) by Yarn.
615
+ [Not supported](https://github.com/npm/rfcs/issues/287) by npm.
615
616
  */
616
617
  nohoist?: WorkspacePattern[];
617
- }
618
+ };
618
619
 
619
620
  /**
620
621
  A workspace pattern points to a directory or group of directories which contain packages that should be included in the workspace installation process.
@@ -627,16 +628,7 @@ declare namespace PackageJson$1 {
627
628
  */
628
629
  type WorkspacePattern = string;
629
630
 
630
- export interface YarnConfiguration {
631
- /**
632
- Used to configure [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/).
633
-
634
- Workspaces allow you to manage multiple packages within the same repository in such a way that you only need to run `yarn install` once to install all of them in a single pass.
635
-
636
- Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces.
637
- */
638
- workspaces?: WorkspacePattern[] | WorkspaceConfig;
639
-
631
+ export type YarnConfiguration = {
640
632
  /**
641
633
  If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command-line, set this to `true`.
642
634
 
@@ -648,18 +640,19 @@ declare namespace PackageJson$1 {
648
640
  Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file.
649
641
  */
650
642
  resolutions?: Dependency;
651
- }
643
+ };
652
644
 
653
- export interface JSPMConfiguration {
645
+ export type JSPMConfiguration = {
654
646
  /**
655
647
  JSPM configuration.
656
648
  */
657
649
  jspm?: PackageJson$1;
658
- }
650
+ };
659
651
 
660
652
  /**
661
653
  Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Containing standard npm properties.
662
654
  */
655
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
663
656
  export interface PackageJsonStandard {
664
657
  /**
665
658
  The name of the package.
@@ -789,7 +782,7 @@ declare namespace PackageJson$1 {
789
782
  /**
790
783
  Is used to set configuration parameters used in package scripts that persist across upgrades.
791
784
  */
792
- config?: Record<string, unknown>;
785
+ config?: JsonObject;
793
786
 
794
787
  /**
795
788
  The dependencies of the package.
@@ -830,7 +823,7 @@ declare namespace PackageJson$1 {
830
823
  Engines that this package runs on.
831
824
  */
832
825
  engines?: {
833
- [EngineName in 'npm' | 'node' | string]?: string;
826
+ [EngineName in 'npm' | 'node' | string]?: string; // eslint-disable-line @typescript-eslint/no-redundant-type-constituents
834
827
  };
835
828
 
836
829
  /**
@@ -929,13 +922,41 @@ declare namespace PackageJson$1 {
929
922
  */
930
923
  url: string;
931
924
  };
925
+
926
+ /**
927
+ Used to configure [npm workspaces](https://docs.npmjs.com/cli/using-npm/workspaces) / [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/).
928
+
929
+ Workspaces allow you to manage multiple packages within the same repository in such a way that you only need to run your install command once in order to install all of them in a single pass.
930
+
931
+ Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces.
932
+ */
933
+ workspaces?: WorkspacePattern[] | WorkspaceConfig;
932
934
  }
933
935
 
934
- export interface PublishConfig {
936
+ /**
937
+ Type for [`package.json` file used by the Node.js runtime](https://nodejs.org/api/packages.html#nodejs-packagejson-field-definitions).
938
+ */
939
+ export type NodeJsStandard = {
940
+ /**
941
+ Defines which package manager is expected to be used when working on the current project. It can set to any of the [supported package managers](https://nodejs.org/api/corepack.html#supported-package-managers), and will ensure that your teams use the exact same package manager versions without having to install anything else than Node.js.
942
+
943
+ __This field is currently experimental and needs to be opted-in; check the [Corepack](https://nodejs.org/api/corepack.html) page for details about the procedure.__
944
+
945
+ @example
946
+ ```json
947
+ {
948
+ "packageManager": "<package manager name>@<version>"
949
+ }
950
+ ```
951
+ */
952
+ packageManager?: string;
953
+ };
954
+
955
+ export type PublishConfig = {
935
956
  /**
936
957
  Additional, less common properties from the [npm docs on `publishConfig`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#publishconfig).
937
958
  */
938
- [additionalProperties: string]: unknown;
959
+ [additionalProperties: string]: JsonValue | undefined;
939
960
 
940
961
  /**
941
962
  When publishing scoped packages, the access level defaults to restricted. If you want your scoped package to be publicly viewable (and installable) set `--access=public`. The only valid values for access are public and restricted. Unscoped packages always have an access level of public.
@@ -955,7 +976,7 @@ declare namespace PackageJson$1 {
955
976
  Default: `'latest'`
956
977
  */
957
978
  tag?: string;
958
- }
979
+ };
959
980
  }
960
981
 
961
982
  /**
@@ -964,6 +985,8 @@ Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-j
964
985
  @category File
965
986
  */
966
987
  type PackageJson$1 =
988
+ JsonObject &
989
+ PackageJson$1.NodeJsStandard &
967
990
  PackageJson$1.PackageJsonStandard &
968
991
  PackageJson$1.NonStandardEntryPoints &
969
992
  PackageJson$1.TypeScriptConfiguration &
@@ -1278,7 +1301,7 @@ type ArgsFromMeta<TRenderer extends Renderer, Meta> = Meta extends {
1278
1301
  render?: ArgsStoryFn<TRenderer, infer RArgs>;
1279
1302
  loaders?: (infer Loaders)[];
1280
1303
  decorators?: (infer Decorators)[];
1281
- } ? Simplify<RemoveIndexSignature<RArgs & DecoratorsArgs<TRenderer, Decorators> & LoaderArgs<TRenderer, Loaders>>> : unknown;
1304
+ } ? Simplify<OmitIndexSignature<RArgs & DecoratorsArgs<TRenderer, Decorators> & LoaderArgs<TRenderer, Loaders>>> : unknown;
1282
1305
  type DecoratorsArgs<TRenderer extends Renderer, Decorators> = UnionToIntersection<Decorators extends DecoratorFunction<TRenderer, infer TArgs> ? TArgs : unknown>;
1283
1306
  type LoaderArgs<TRenderer extends Renderer, Loaders> = UnionToIntersection<Loaders extends LoaderFunction<TRenderer, infer TArgs> ? TArgs : unknown>;
1284
1307
  type StoryDescriptor = string[] | RegExp;
@@ -1394,30 +1417,34 @@ type RouterData = {
1394
1417
  } & Other;
1395
1418
  type RenderData = Pick<RouterData, 'location'> & Other;
1396
1419
 
1397
- interface ThemeVars {
1420
+ interface ThemeVars extends ThemeVarsBase, ThemeVarsColors {
1421
+ }
1422
+ interface ThemeVarsBase {
1398
1423
  base: 'light' | 'dark';
1399
- colorPrimary?: string;
1400
- colorSecondary?: string;
1401
- appBg?: string;
1402
- appContentBg?: string;
1403
- appBorderColor?: string;
1404
- appBorderRadius?: number;
1405
- fontBase?: string;
1406
- fontCode?: string;
1407
- textColor?: string;
1408
- textInverseColor?: string;
1409
- textMutedColor?: string;
1410
- barTextColor?: string;
1411
- barSelectedColor?: string;
1412
- barBg?: string;
1413
- buttonBg?: string;
1414
- buttonBorder?: string;
1415
- booleanBg?: string;
1416
- booleanSelectedBg?: string;
1417
- inputBg?: string;
1418
- inputBorder?: string;
1419
- inputTextColor?: string;
1420
- inputBorderRadius?: number;
1424
+ }
1425
+ interface ThemeVarsColors {
1426
+ colorPrimary: string;
1427
+ colorSecondary: string;
1428
+ appBg: string;
1429
+ appContentBg: string;
1430
+ appBorderColor: string;
1431
+ appBorderRadius: number;
1432
+ fontBase: string;
1433
+ fontCode: string;
1434
+ textColor: string;
1435
+ textInverseColor: string;
1436
+ textMutedColor: string;
1437
+ barTextColor: string;
1438
+ barSelectedColor: string;
1439
+ barBg: string;
1440
+ buttonBg: string;
1441
+ buttonBorder: string;
1442
+ booleanBg: string;
1443
+ booleanSelectedBg: string;
1444
+ inputBg: string;
1445
+ inputBorder: string;
1446
+ inputTextColor: string;
1447
+ inputBorderRadius: number;
1421
1448
  brandTitle?: string;
1422
1449
  brandUrl?: string;
1423
1450
  brandImage?: string;
@@ -1437,7 +1464,7 @@ interface StoriesSpecifier {
1437
1464
  /**
1438
1465
  * What does the filename of a story file look like?
1439
1466
  * (a glob, relative to directory, no leading `./`)
1440
- * If unset, we use `** / *.@(mdx|stories.@(mdx|tsx|ts|jsx|js))` (no spaces)
1467
+ * If unset, we use `** / *.@(mdx|stories.@(mdx|js|jsx|mjs|ts|tsx))` (no spaces)
1441
1468
  */
1442
1469
  files?: string;
1443
1470
  }
@@ -1588,7 +1615,7 @@ type Addon_LoadFn = () => any;
1588
1615
  type Addon_RequireContext = any;
1589
1616
  type Addon_Loadable = Addon_RequireContext | [Addon_RequireContext] | Addon_LoadFn;
1590
1617
  type Addon_BaseDecorators<StoryFnReturnType> = Array<(story: () => StoryFnReturnType, context: Addon_StoryContext) => StoryFnReturnType>;
1591
- interface Addon_BaseAnnotations<TArgs, StoryFnReturnType> {
1618
+ interface Addon_BaseAnnotations<TArgs, StoryFnReturnType, TRenderer extends Renderer = Renderer> {
1592
1619
  /**
1593
1620
  * Dynamic data that are provided (and possibly updated by) Storybook and its addons.
1594
1621
  * @see [Arg story inputs](https://storybook.js.org/docs/react/api/csf#args-story-inputs)
@@ -1614,11 +1641,11 @@ interface Addon_BaseAnnotations<TArgs, StoryFnReturnType> {
1614
1641
  /**
1615
1642
  * Define a custom render function for the story(ies). If not passed, a default render function by the framework will be used.
1616
1643
  */
1617
- render?: (args: TArgs, context: Addon_StoryContext) => StoryFnReturnType;
1644
+ render?: (args: TArgs, context: Addon_StoryContext<TRenderer>) => StoryFnReturnType;
1618
1645
  /**
1619
1646
  * Function that is executed after the story is rendered.
1620
1647
  */
1621
- play?: (context: Addon_StoryContext) => Promise<void> | void;
1648
+ play?: (context: Addon_StoryContext<TRenderer>) => Promise<void> | void;
1622
1649
  }
1623
1650
  interface Addon_Annotations<TArgs, StoryFnReturnType> extends Addon_BaseAnnotations<TArgs, StoryFnReturnType> {
1624
1651
  /**
@@ -1805,7 +1832,6 @@ type PreparedStory<TRenderer extends Renderer = Renderer> = StoryContextForEnhan
1805
1832
  loaded: StoryContext<TRenderer>['loaded'];
1806
1833
  }>;
1807
1834
  playFunction?: (context: StoryContext<TRenderer>) => Promise<void> | void;
1808
- prepareContext: (context: StoryContext<TRenderer>) => StoryContext<TRenderer>;
1809
1835
  };
1810
1836
  type PreparedMeta<TRenderer extends Renderer = Renderer> = Omit<StoryContextForEnhancers<TRenderer>, 'name' | 'story'> & {
1811
1837
  moduleExport: ModuleExport;
@@ -1944,6 +1970,7 @@ interface CLIOptions {
1944
1970
  disableTelemetry?: boolean;
1945
1971
  enableCrashReports?: boolean;
1946
1972
  host?: string;
1973
+ initialPath?: string;
1947
1974
  /**
1948
1975
  * @deprecated Use 'staticDirs' Storybook Configuration option instead
1949
1976
  */
@@ -2158,13 +2185,19 @@ interface StorybookConfig {
2158
2185
  previewHead?: PresetValue<string>;
2159
2186
  previewBody?: PresetValue<string>;
2160
2187
  /**
2161
- * Programatically override the preview's main page template.
2188
+ * Programmatically override the preview's main page template.
2162
2189
  * This should return a reference to a file containing an `.ejs` template
2163
2190
  * that will be interpolated with environment variables.
2164
2191
  *
2165
2192
  * @example '.storybook/index.ejs'
2166
2193
  */
2167
2194
  previewMainTemplate?: string;
2195
+ /**
2196
+ * Programmatically modify the preview head/body HTML.
2197
+ * The managerHead function accept a string,
2198
+ * which is the existing head content, and return a modified string.
2199
+ */
2200
+ managerHead?: PresetValue<string>;
2168
2201
  }
2169
2202
  type PresetValue<T> = T | ((config: T, options: Options) => T | Promise<T>);
2170
2203
  type PresetProperty<K, TStorybookConfig = StorybookConfig> = TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | PresetPropertyFn<K, TStorybookConfig>;
@@ -2229,17 +2262,23 @@ interface ChannelEvent {
2229
2262
  interface Listener {
2230
2263
  (...args: any[]): void;
2231
2264
  }
2232
- interface ChannelArgs {
2265
+ interface ChannelArgsSingle {
2233
2266
  transport?: ChannelTransport;
2234
2267
  async?: boolean;
2235
2268
  }
2269
+ interface ChannelArgsMulti {
2270
+ transports: ChannelTransport[];
2271
+ async?: boolean;
2272
+ }
2273
+
2236
2274
  declare class Channel {
2237
2275
  readonly isAsync: boolean;
2238
2276
  private sender;
2239
2277
  private events;
2240
2278
  private data;
2241
- private readonly transport;
2242
- constructor({ transport, async }?: ChannelArgs);
2279
+ private readonly transports;
2280
+ constructor(input: ChannelArgsMulti);
2281
+ constructor(input: ChannelArgsSingle);
2243
2282
  get hasTransport(): boolean;
2244
2283
  addListener(eventName: string, listener: Listener): void;
2245
2284
  emit(eventName: string, ...args: any): void;
@@ -2309,6 +2348,11 @@ interface API_DocsEntry extends API_BaseEntry {
2309
2348
  /** @deprecated */
2310
2349
  kind: ComponentTitle;
2311
2350
  importPath: Path;
2351
+ tags: Tag[];
2352
+ prepared: boolean;
2353
+ parameters?: {
2354
+ [parameterName: string]: any;
2355
+ };
2312
2356
  /** @deprecated */
2313
2357
  isRoot: false;
2314
2358
  /** @deprecated */
@@ -2433,6 +2477,17 @@ interface SetGlobalsPayload {
2433
2477
  globals: Globals;
2434
2478
  globalTypes: GlobalTypes;
2435
2479
  }
2480
+ interface StoryPreparedPayload {
2481
+ id: StoryId;
2482
+ parameters: Parameters;
2483
+ argTypes: ArgTypes;
2484
+ initialArgs: Args;
2485
+ args: Args;
2486
+ }
2487
+ interface DocsPreparedPayload {
2488
+ id: StoryId;
2489
+ parameters: Parameters;
2490
+ }
2436
2491
 
2437
2492
  type API_ViewMode = 'story' | 'info' | 'settings' | 'page' | undefined | string;
2438
2493
  interface API_RenderOptions {
@@ -2463,6 +2518,9 @@ interface API_ProviderData<API> {
2463
2518
  }
2464
2519
  interface API_Provider<API> {
2465
2520
  channel?: Channel;
2521
+ /**
2522
+ * @deprecated will be removed in 8.0, please use channel instead
2523
+ */
2466
2524
  serverChannel?: Channel;
2467
2525
  renderPreview?: API_IframeRenderer;
2468
2526
  handleAPI(api: API): void;
@@ -2637,6 +2695,7 @@ type ComposedStoryPlayFn<TRenderer extends Renderer = Renderer, TArgs = Args> =
2637
2695
  type PreparedStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = AnnotatedStoryFn<TRenderer, TArgs> & {
2638
2696
  play: ComposedStoryPlayFn<TRenderer, TArgs>;
2639
2697
  args: TArgs;
2698
+ id: StoryId;
2640
2699
  };
2641
2700
  type ComposedStory<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryFn<TRenderer, TArgs> | StoryAnnotations<TRenderer, TArgs>;
2642
2701
  /**
@@ -2658,4 +2717,4 @@ interface ComposeStoryFn<TRenderer extends Renderer = Renderer, TArgs extends Ar
2658
2717
  };
2659
2718
  }
2660
2719
 
2661
- export { API_ActiveTabsType, API_Addon, API_BaseEntry, API_Collection, API_ComponentEntry, API_ComposedRef, API_ComposedRefUpdate, API_DocsEntry, API_Group, API_GroupEntry, API_HashEntry, API_IframeRenderer, API_IndexHash, API_Layout, API_LeafEntry, API_LoadedRefData, API_MatchOptions, API_Notification, API_OptionsData, API_PanelPositions, API_Panels, API_PreparedStoryIndex, API_Provider, API_ProviderData, API_RefId, API_RefUrl, API_Refs, API_ReleaseNotes, API_RenderOptions, API_Root, API_RootEntry, API_RouteOptions, API_SetRefData, API_Settings, API_SidebarOptions, API_StateMerger, API_Story, API_StoryEntry, API_StoryMapper, API_UI, API_UIOptions, API_UnknownEntries, API_Version, API_Versions$1 as API_Versions, API_ViewMode, Addon_AddStoryArgs, Addon_Annotations, Addon_ArgType, Addon_ArgsStoryFn, Addon_BaseAnnotations, Addon_BaseDecorators, Addon_BaseMeta, Addon_BaseStoryFn, Addon_BaseStoryObject, Addon_ClientApiAddon, Addon_ClientApiAddons, Addon_ClientApiReturnFn, Addon_ClientStoryApi, Addon_Collection, Addon_Comparator, Addon_Config, Addon_DecoratorFunction, Addon_Elements, Addon_LegacyStoryFn, Addon_LoadFn, Addon_Loadable, Addon_Loader, Addon_LoaderFunction, Addon_Loaders, Addon_MakeDecoratorResult, Addon_OptionsParameter, Addon_OptionsParameterV7, Addon_PartialStoryFn, Addon_RenderOptions, Addon_RequireContext, Addon_StoryApi, Addon_StoryContext, Addon_StoryContextUpdate, Addon_StoryFn, Addon_StorySortComparator, Addon_StorySortComparatorV7, Addon_StorySortMethod, Addon_StorySortObjectParameter, Addon_StorySortParameter, Addon_StorySortParameterV7, Addon_StoryWrapper, Addon_ToolbarConfig, Addon_Type, Addon_Types, Addon_TypesEnum, Addon_WrapperSettings, Addons_ArgTypes, AnnotatedStoryFn, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations, BaseIndexEntry, BaseStory, BoundStory, Builder, BuilderName, BuilderOptions, BuilderResult, BuilderStats, Builder_EnvsRaw, Builder_Unpromise, Builder_WithRequiredProperty, CLIOptions, CSFFile, ComponentAnnotations, ComponentId, ComponentTitle, ComposeStoryFn, ComposedStory, ComposedStoryPlayContext, ComposedStoryPlayFn, Conditional, CoreCommon_AddonEntry, CoreCommon_AddonInfo, CoreCommon_OptionsEntry, CoreCommon_ResolvedAddonPreset, CoreCommon_ResolvedAddonVirtual, CoreCommon_StorybookInfo, CoreConfig, DecoratorApplicator, DecoratorFunction, DocsContextProps, DocsIndexEntry, DocsOptions, DocsRenderFunction, Entry, GlobalTypes, Globals, IncludeExcludeOptions, IndexEntry, IndexEntryLegacy, IndexedCSFFile, IndexedStory, IndexerOptions, InputType, LegacyAnnotatedStoryFn, LegacyStoryAnnotationsOrFn, LegacyStoryFn, LoadOptions, LoadedPreset, LoaderFunction, ModuleExport, ModuleExports, ModuleImportFn, NormalizedComponentAnnotations, NormalizedProjectAnnotations, NormalizedStoriesSpecifier, NormalizedStoryAnnotations, Options, PackageJson, Parameters, PartialStoryFn, Path, PlayFunction, PlayFunctionContext, PreparedMeta, PreparedStory, PreparedStoryFn, Preset, PresetConfig, PresetProperty, PresetPropertyFn, PresetValue, Presets, PreviewAnnotation, ProjectAnnotations, ReactJSXElement, Ref, ReleaseNotesData, RenderContext, RenderContextCallbacks, RenderToCanvas, Renderer, RendererName, ResolvedModuleExport, ResolvedModuleExportFromType, ResolvedModuleExportType, SBArrayType, SBEnumType, SBIntersectionType, SBObjectType, SBOtherType, SBScalarType, SBType, SBUnionType, SeparatorOptions, SetGlobalsPayload, SetStoriesPayload, SetStoriesStory, SetStoriesStoryData, Stats, StepFunction, StepLabel, StepRunner, Store_CSFExports, StoriesEntry, StoriesWithPartialProps, StoryAnnotations, StoryAnnotationsOrFn, StoryContext, StoryContextForEnhancers, StoryContextForLoaders, StoryContextUpdate, StoryFn, StoryId, StoryIdentifier, StoryIndex, StoryIndexEntry, StoryIndexV2, StoryIndexV3, StoryIndexer, StoryKind, StoryName, StoryRenderOptions, StorybookConfig, StorybookConfigOptions, StorybookInternalParameters, StorybookParameters, StrictArgTypes, StrictArgs, StrictGlobalTypes, StrictInputType, Tag, TeardownRenderToCanvas, TypescriptOptions, V3CompatIndexEntry, VersionCheck, ViewMode, WebRenderer };
2720
+ export { API_ActiveTabsType, API_Addon, API_BaseEntry, API_Collection, API_ComponentEntry, API_ComposedRef, API_ComposedRefUpdate, API_DocsEntry, API_Group, API_GroupEntry, API_HashEntry, API_IframeRenderer, API_IndexHash, API_Layout, API_LeafEntry, API_LoadedRefData, API_MatchOptions, API_Notification, API_OptionsData, API_PanelPositions, API_Panels, API_PreparedStoryIndex, API_Provider, API_ProviderData, API_RefId, API_RefUrl, API_Refs, API_ReleaseNotes, API_RenderOptions, API_Root, API_RootEntry, API_RouteOptions, API_SetRefData, API_Settings, API_SidebarOptions, API_StateMerger, API_Story, API_StoryEntry, API_StoryMapper, API_UI, API_UIOptions, API_UnknownEntries, API_Version, API_Versions$1 as API_Versions, API_ViewMode, Addon_AddStoryArgs, Addon_Annotations, Addon_ArgType, Addon_ArgsStoryFn, Addon_BaseAnnotations, Addon_BaseDecorators, Addon_BaseMeta, Addon_BaseStoryFn, Addon_BaseStoryObject, Addon_ClientApiAddon, Addon_ClientApiAddons, Addon_ClientApiReturnFn, Addon_ClientStoryApi, Addon_Collection, Addon_Comparator, Addon_Config, Addon_DecoratorFunction, Addon_Elements, Addon_LegacyStoryFn, Addon_LoadFn, Addon_Loadable, Addon_Loader, Addon_LoaderFunction, Addon_Loaders, Addon_MakeDecoratorResult, Addon_OptionsParameter, Addon_OptionsParameterV7, Addon_PartialStoryFn, Addon_RenderOptions, Addon_RequireContext, Addon_StoryApi, Addon_StoryContext, Addon_StoryContextUpdate, Addon_StoryFn, Addon_StorySortComparator, Addon_StorySortComparatorV7, Addon_StorySortMethod, Addon_StorySortObjectParameter, Addon_StorySortParameter, Addon_StorySortParameterV7, Addon_StoryWrapper, Addon_ToolbarConfig, Addon_Type, Addon_Types, Addon_TypesEnum, Addon_WrapperSettings, Addons_ArgTypes, AnnotatedStoryFn, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations, BaseIndexEntry, BaseStory, BoundStory, Builder, BuilderName, BuilderOptions, BuilderResult, BuilderStats, Builder_EnvsRaw, Builder_Unpromise, Builder_WithRequiredProperty, CLIOptions, CSFFile, ComponentAnnotations, ComponentId, ComponentTitle, ComposeStoryFn, ComposedStory, ComposedStoryPlayContext, ComposedStoryPlayFn, Conditional, CoreCommon_AddonEntry, CoreCommon_AddonInfo, CoreCommon_OptionsEntry, CoreCommon_ResolvedAddonPreset, CoreCommon_ResolvedAddonVirtual, CoreCommon_StorybookInfo, CoreConfig, DecoratorApplicator, DecoratorFunction, DocsContextProps, DocsIndexEntry, DocsOptions, DocsPreparedPayload, DocsRenderFunction, Entry, GlobalTypes, Globals, IncludeExcludeOptions, IndexEntry, IndexEntryLegacy, IndexedCSFFile, IndexedStory, IndexerOptions, InputType, LegacyAnnotatedStoryFn, LegacyStoryAnnotationsOrFn, LegacyStoryFn, LoadOptions, LoadedPreset, LoaderFunction, ModuleExport, ModuleExports, ModuleImportFn, NormalizedComponentAnnotations, NormalizedProjectAnnotations, NormalizedStoriesSpecifier, NormalizedStoryAnnotations, Options, PackageJson, Parameters, PartialStoryFn, Path, PlayFunction, PlayFunctionContext, PreparedMeta, PreparedStory, PreparedStoryFn, Preset, PresetConfig, PresetProperty, PresetPropertyFn, PresetValue, Presets, PreviewAnnotation, ProjectAnnotations, ReactJSXElement, Ref, ReleaseNotesData, RenderContext, RenderContextCallbacks, RenderToCanvas, Renderer, RendererName, ResolvedModuleExport, ResolvedModuleExportFromType, ResolvedModuleExportType, SBArrayType, SBEnumType, SBIntersectionType, SBObjectType, SBOtherType, SBScalarType, SBType, SBUnionType, SeparatorOptions, SetGlobalsPayload, SetStoriesPayload, SetStoriesStory, SetStoriesStoryData, Stats, StepFunction, StepLabel, StepRunner, Store_CSFExports, StoriesEntry, StoriesWithPartialProps, StoryAnnotations, StoryAnnotationsOrFn, StoryContext, StoryContextForEnhancers, StoryContextForLoaders, StoryContextUpdate, StoryFn, StoryId, StoryIdentifier, StoryIndex, StoryIndexEntry, StoryIndexV2, StoryIndexV3, StoryIndexer, StoryKind, StoryName, StoryPreparedPayload, StoryRenderOptions, StorybookConfig, StorybookConfigOptions, StorybookInternalParameters, StorybookParameters, StrictArgTypes, StrictArgs, StrictGlobalTypes, StrictInputType, Tag, TeardownRenderToCanvas, TypescriptOptions, V3CompatIndexEntry, VersionCheck, ViewMode, WebRenderer };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};__export(src_exports,{Addon_TypesEnum:()=>Addon_TypesEnum});module.exports=__toCommonJS(src_exports);var Addon_TypesEnum=(Addon_TypesEnum2=>(Addon_TypesEnum2.TAB="tab",Addon_TypesEnum2.PANEL="panel",Addon_TypesEnum2.TOOL="tool",Addon_TypesEnum2.TOOLEXTRA="toolextra",Addon_TypesEnum2.PREVIEW="preview",Addon_TypesEnum2.NOTES_ELEMENT="notes-element",Addon_TypesEnum2))(Addon_TypesEnum||{});0&&(module.exports={Addon_TypesEnum});
1
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};__export(src_exports,{Addon_TypesEnum:()=>Addon_TypesEnum});module.exports=__toCommonJS(src_exports);var Addon_TypesEnum=(Addon_TypesEnum2=>(Addon_TypesEnum2.TAB="tab",Addon_TypesEnum2.PANEL="panel",Addon_TypesEnum2.TOOL="tool",Addon_TypesEnum2.TOOLEXTRA="toolextra",Addon_TypesEnum2.PREVIEW="preview",Addon_TypesEnum2.NOTES_ELEMENT="notes-element",Addon_TypesEnum2))(Addon_TypesEnum||{});0&&(module.exports={Addon_TypesEnum});
package/dist/index.mjs CHANGED
@@ -1 +1,3 @@
1
- var Addon_TypesEnum=(Addon_TypesEnum2=>(Addon_TypesEnum2.TAB="tab",Addon_TypesEnum2.PANEL="panel",Addon_TypesEnum2.TOOL="tool",Addon_TypesEnum2.TOOLEXTRA="toolextra",Addon_TypesEnum2.PREVIEW="preview",Addon_TypesEnum2.NOTES_ELEMENT="notes-element",Addon_TypesEnum2))(Addon_TypesEnum||{});export{Addon_TypesEnum};
1
+ var Addon_TypesEnum=(Addon_TypesEnum2=>(Addon_TypesEnum2.TAB="tab",Addon_TypesEnum2.PANEL="panel",Addon_TypesEnum2.TOOL="tool",Addon_TypesEnum2.TOOLEXTRA="toolextra",Addon_TypesEnum2.PREVIEW="preview",Addon_TypesEnum2.NOTES_ELEMENT="notes-element",Addon_TypesEnum2))(Addon_TypesEnum||{});
2
+
3
+ export { Addon_TypesEnum };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@storybook/types",
3
- "version": "7.1.0-alpha.4",
3
+ "version": "7.1.0-alpha.40",
4
4
  "description": "Core Storybook TS Types",
5
5
  "keywords": [
6
6
  "storybook"
7
7
  ],
8
- "homepage": "https://github.com/storybookjs/storybook/tree/main/code/lib/types",
8
+ "homepage": "https://github.com/storybookjs/storybook/tree/next/code/lib/types",
9
9
  "bugs": {
10
10
  "url": "https://github.com/storybookjs/storybook/issues"
11
11
  },
@@ -22,10 +22,10 @@
22
22
  "sideEffects": false,
23
23
  "exports": {
24
24
  ".": {
25
+ "types": "./dist/index.d.ts",
25
26
  "node": "./dist/index.js",
26
27
  "require": "./dist/index.js",
27
- "import": "./dist/index.mjs",
28
- "types": "./dist/index.d.ts"
28
+ "import": "./dist/index.mjs"
29
29
  },
30
30
  "./package.json": "./package.json"
31
31
  },
@@ -43,10 +43,10 @@
43
43
  "prep": "../../../scripts/prepare/bundle.ts"
44
44
  },
45
45
  "dependencies": {
46
- "@storybook/channels": "7.1.0-alpha.4",
46
+ "@storybook/channels": "7.1.0-alpha.40",
47
47
  "@types/babel__core": "^7.0.0",
48
48
  "@types/express": "^4.7.0",
49
- "file-system-cache": "^2.0.0"
49
+ "file-system-cache": "2.3.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@storybook/csf": "^0.1.0",
@@ -61,5 +61,5 @@
61
61
  "./src/index.ts"
62
62
  ]
63
63
  },
64
- "gitHead": "18dcfa6073157150da60c328f6f64abd477ddcad"
65
- }
64
+ "gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17"
65
+ }