@storybook/types 7.0.0-alpha.44

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.
@@ -0,0 +1,2744 @@
1
+ import { FileSystemCache } from 'file-system-cache';
2
+ import { TransformOptions } from '@babel/core';
3
+ import { Router } from 'express';
4
+ import { Server } from 'http';
5
+
6
+ /**
7
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
8
+
9
+ @category Type
10
+ */
11
+ type Primitive =
12
+ | null
13
+ | undefined
14
+ | string
15
+ | number
16
+ | boolean
17
+ | symbol
18
+ | bigint;
19
+
20
+ declare global {
21
+ interface SymbolConstructor {
22
+ readonly observable: symbol;
23
+ }
24
+ }
25
+
26
+ /**
27
+ @see Simplify
28
+ */
29
+ interface SimplifyOptions {
30
+ /**
31
+ Do the simplification recursively.
32
+
33
+ @default false
34
+ */
35
+ deep?: boolean;
36
+ }
37
+
38
+ // Flatten a type without worrying about the result.
39
+ type Flatten<
40
+ AnyType,
41
+ Options extends SimplifyOptions = {},
42
+ > = Options['deep'] extends true
43
+ ? {[KeyType in keyof AnyType]: Simplify<AnyType[KeyType], Options>}
44
+ : {[KeyType in keyof AnyType]: AnyType[KeyType]};
45
+
46
+ /**
47
+ 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.
48
+
49
+ @example
50
+ ```
51
+ import type {Simplify} from 'type-fest';
52
+
53
+ type PositionProps = {
54
+ top: number;
55
+ left: number;
56
+ };
57
+
58
+ type SizeProps = {
59
+ width: number;
60
+ height: number;
61
+ };
62
+
63
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
64
+ type Props = Simplify<PositionProps & SizeProps>;
65
+ ```
66
+
67
+ Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
68
+
69
+ If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
70
+
71
+ @example
72
+ ```
73
+ import type {Simplify} from 'type-fest';
74
+
75
+ interface SomeInterface {
76
+ foo: number;
77
+ bar?: string;
78
+ baz: number | undefined;
79
+ }
80
+
81
+ type SomeType = {
82
+ foo: number;
83
+ bar?: string;
84
+ baz: number | undefined;
85
+ };
86
+
87
+ const literal = {foo: 123, bar: 'hello', baz: 456};
88
+ const someType: SomeType = literal;
89
+ const someInterface: SomeInterface = literal;
90
+
91
+ function fn(object: Record<string, unknown>): void {}
92
+
93
+ fn(literal); // Good: literal object type is sealed
94
+ fn(someType); // Good: type is sealed
95
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
96
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
97
+ ```
98
+
99
+ @link https://github.com/microsoft/TypeScript/issues/15300
100
+
101
+ @category Object
102
+ */
103
+ type Simplify<
104
+ AnyType,
105
+ Options extends SimplifyOptions = {},
106
+ > = Flatten<AnyType> extends AnyType
107
+ ? Flatten<AnyType, Options>
108
+ : AnyType;
109
+
110
+ /**
111
+ Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
112
+
113
+ Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
114
+
115
+ This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
116
+
117
+ @example
118
+ ```
119
+ import type {LiteralUnion} from 'type-fest';
120
+
121
+ // Before
122
+
123
+ type Pet = 'dog' | 'cat' | string;
124
+
125
+ const pet: Pet = '';
126
+ // Start typing in your TypeScript-enabled IDE.
127
+ // You **will not** get auto-completion for `dog` and `cat` literals.
128
+
129
+ // After
130
+
131
+ type Pet2 = LiteralUnion<'dog' | 'cat', string>;
132
+
133
+ const pet: Pet2 = '';
134
+ // You **will** get auto-completion for `dog` and `cat` literals.
135
+ ```
136
+
137
+ @category Type
138
+ */
139
+ type LiteralUnion<
140
+ LiteralType,
141
+ BaseType extends Primitive,
142
+ > = LiteralType | (BaseType & Record<never, never>);
143
+
144
+ /**
145
+ Convert a union type to an intersection type using [distributive conditional types](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
146
+
147
+ Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153).
148
+
149
+ @example
150
+ ```
151
+ import type {UnionToIntersection} from 'type-fest';
152
+
153
+ type Union = {the(): void} | {great(arg: string): void} | {escape: boolean};
154
+
155
+ type Intersection = UnionToIntersection<Union>;
156
+ //=> {the(): void; great(arg: string): void; escape: boolean};
157
+ ```
158
+
159
+ A more applicable example which could make its way into your library code follows.
160
+
161
+ @example
162
+ ```
163
+ import type {UnionToIntersection} from 'type-fest';
164
+
165
+ class CommandOne {
166
+ commands: {
167
+ a1: () => undefined,
168
+ b1: () => undefined,
169
+ }
170
+ }
171
+
172
+ class CommandTwo {
173
+ commands: {
174
+ a2: (argA: string) => undefined,
175
+ b2: (argB: string) => undefined,
176
+ }
177
+ }
178
+
179
+ const union = [new CommandOne(), new CommandTwo()].map(instance => instance.commands);
180
+ type Union = typeof union;
181
+ //=> {a1(): void; b1(): void} | {a2(argA: string): void; b2(argB: string): void}
182
+
183
+ type Intersection = UnionToIntersection<Union>;
184
+ //=> {a1(): void; b1(): void; a2(argA: string): void; b2(argB: string): void}
185
+ ```
186
+
187
+ @category Type
188
+ */
189
+ type UnionToIntersection<Union> = (
190
+ // `extends unknown` is always going to be the case and is used to convert the
191
+ // `Union` into a [distributive conditional
192
+ // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
193
+ Union extends unknown
194
+ // The union type is used as the only argument to a function since the union
195
+ // of function arguments is an intersection.
196
+ ? (distributedUnion: Union) => void
197
+ // This won't happen.
198
+ : never
199
+ // Infer the `Intersection` type since TypeScript represents the positional
200
+ // arguments of unions of functions as an intersection of the union.
201
+ ) extends ((mergedIntersection: infer Intersection) => void)
202
+ ? Intersection
203
+ : never;
204
+
205
+ declare namespace PackageJson$1 {
206
+ /**
207
+ A person who has been involved in creating or maintaining the package.
208
+ */
209
+ export type Person =
210
+ | string
211
+ | {
212
+ name: string;
213
+ url?: string;
214
+ email?: string;
215
+ };
216
+
217
+ export type BugsLocation =
218
+ | string
219
+ | {
220
+ /**
221
+ The URL to the package's issue tracker.
222
+ */
223
+ url?: string;
224
+
225
+ /**
226
+ The email address to which issues should be reported.
227
+ */
228
+ email?: string;
229
+ };
230
+
231
+ export interface DirectoryLocations {
232
+ [directoryType: string]: unknown;
233
+
234
+ /**
235
+ Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder.
236
+ */
237
+ bin?: string;
238
+
239
+ /**
240
+ Location for Markdown files.
241
+ */
242
+ doc?: string;
243
+
244
+ /**
245
+ Location for example scripts.
246
+ */
247
+ example?: string;
248
+
249
+ /**
250
+ Location for the bulk of the library.
251
+ */
252
+ lib?: string;
253
+
254
+ /**
255
+ Location for man pages. Sugar to generate a `man` array by walking the folder.
256
+ */
257
+ man?: string;
258
+
259
+ /**
260
+ Location for test files.
261
+ */
262
+ test?: string;
263
+ }
264
+
265
+ export type Scripts = {
266
+ /**
267
+ Run **before** the package is published (Also run on local `npm install` without any arguments).
268
+ */
269
+ prepublish?: string;
270
+
271
+ /**
272
+ Run both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`.
273
+ */
274
+ prepare?: string;
275
+
276
+ /**
277
+ Run **before** the package is prepared and packed, **only** on `npm publish`.
278
+ */
279
+ prepublishOnly?: string;
280
+
281
+ /**
282
+ Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies).
283
+ */
284
+ prepack?: string;
285
+
286
+ /**
287
+ Run **after** the tarball has been generated and moved to its final destination.
288
+ */
289
+ postpack?: string;
290
+
291
+ /**
292
+ Run **after** the package is published.
293
+ */
294
+ publish?: string;
295
+
296
+ /**
297
+ Run **after** the package is published.
298
+ */
299
+ postpublish?: string;
300
+
301
+ /**
302
+ Run **before** the package is installed.
303
+ */
304
+ preinstall?: string;
305
+
306
+ /**
307
+ Run **after** the package is installed.
308
+ */
309
+ install?: string;
310
+
311
+ /**
312
+ Run **after** the package is installed and after `install`.
313
+ */
314
+ postinstall?: string;
315
+
316
+ /**
317
+ Run **before** the package is uninstalled and before `uninstall`.
318
+ */
319
+ preuninstall?: string;
320
+
321
+ /**
322
+ Run **before** the package is uninstalled.
323
+ */
324
+ uninstall?: string;
325
+
326
+ /**
327
+ Run **after** the package is uninstalled.
328
+ */
329
+ postuninstall?: string;
330
+
331
+ /**
332
+ Run **before** bump the package version and before `version`.
333
+ */
334
+ preversion?: string;
335
+
336
+ /**
337
+ Run **before** bump the package version.
338
+ */
339
+ version?: string;
340
+
341
+ /**
342
+ Run **after** bump the package version.
343
+ */
344
+ postversion?: string;
345
+
346
+ /**
347
+ Run with the `npm test` command, before `test`.
348
+ */
349
+ pretest?: string;
350
+
351
+ /**
352
+ Run with the `npm test` command.
353
+ */
354
+ test?: string;
355
+
356
+ /**
357
+ Run with the `npm test` command, after `test`.
358
+ */
359
+ posttest?: string;
360
+
361
+ /**
362
+ Run with the `npm stop` command, before `stop`.
363
+ */
364
+ prestop?: string;
365
+
366
+ /**
367
+ Run with the `npm stop` command.
368
+ */
369
+ stop?: string;
370
+
371
+ /**
372
+ Run with the `npm stop` command, after `stop`.
373
+ */
374
+ poststop?: string;
375
+
376
+ /**
377
+ Run with the `npm start` command, before `start`.
378
+ */
379
+ prestart?: string;
380
+
381
+ /**
382
+ Run with the `npm start` command.
383
+ */
384
+ start?: string;
385
+
386
+ /**
387
+ Run with the `npm start` command, after `start`.
388
+ */
389
+ poststart?: string;
390
+
391
+ /**
392
+ Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
393
+ */
394
+ prerestart?: string;
395
+
396
+ /**
397
+ Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
398
+ */
399
+ restart?: string;
400
+
401
+ /**
402
+ Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
403
+ */
404
+ postrestart?: string;
405
+ } & Partial<Record<string, string>>;
406
+
407
+ /**
408
+ Dependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL.
409
+ */
410
+ export type Dependency = Partial<Record<string, string>>;
411
+
412
+ /**
413
+ Conditions which provide a way to resolve a package entry point based on the environment.
414
+ */
415
+ export type ExportCondition = LiteralUnion<
416
+ | 'import'
417
+ | 'require'
418
+ | 'node'
419
+ | 'node-addons'
420
+ | 'deno'
421
+ | 'browser'
422
+ | 'electron'
423
+ | 'react-native'
424
+ | 'default',
425
+ string
426
+ >;
427
+
428
+ type ExportConditions = {[condition in ExportCondition]: Exports};
429
+
430
+ /**
431
+ Entry points of a module, optionally with conditions and subpath exports.
432
+ */
433
+ export type Exports =
434
+ | null
435
+ | string
436
+ | Array<string | ExportConditions>
437
+ | ExportConditions
438
+ | {[path: string]: Exports}; // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
439
+
440
+ /**
441
+ Import map entries of a module, optionally with conditions.
442
+ */
443
+ export type Imports = { // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
444
+ [key: string]: string | {[key in ExportCondition]: Exports};
445
+ };
446
+
447
+ export interface NonStandardEntryPoints {
448
+ /**
449
+ An ECMAScript module ID that is the primary entry point to the program.
450
+ */
451
+ module?: string;
452
+
453
+ /**
454
+ A module ID with untranspiled code that is the primary entry point to the program.
455
+ */
456
+ esnext?:
457
+ | string
458
+ | {
459
+ [moduleName: string]: string | undefined;
460
+ main?: string;
461
+ browser?: string;
462
+ };
463
+
464
+ /**
465
+ A hint to JavaScript bundlers or component tools when packaging modules for client side use.
466
+ */
467
+ browser?:
468
+ | string
469
+ | Partial<Record<string, string | false>>;
470
+
471
+ /**
472
+ Denote which files in your project are "pure" and therefore safe for Webpack to prune if unused.
473
+
474
+ [Read more.](https://webpack.js.org/guides/tree-shaking/)
475
+ */
476
+ sideEffects?: boolean | string[];
477
+ }
478
+
479
+ export interface TypeScriptConfiguration {
480
+ /**
481
+ Location of the bundled TypeScript declaration file.
482
+ */
483
+ types?: string;
484
+
485
+ /**
486
+ Version selection map of TypeScript.
487
+ */
488
+ typesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>>;
489
+
490
+ /**
491
+ Location of the bundled TypeScript declaration file. Alias of `types`.
492
+ */
493
+ typings?: string;
494
+ }
495
+
496
+ /**
497
+ An alternative configuration for Yarn workspaces.
498
+ */
499
+ export interface WorkspaceConfig {
500
+ /**
501
+ An array of workspace pattern strings which contain the workspace packages.
502
+ */
503
+ packages?: WorkspacePattern[];
504
+
505
+ /**
506
+ 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.
507
+
508
+ [Read more](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/)
509
+ */
510
+ nohoist?: WorkspacePattern[];
511
+ }
512
+
513
+ /**
514
+ A workspace pattern points to a directory or group of directories which contain packages that should be included in the workspace installation process.
515
+
516
+ The patterns are handled with [minimatch](https://github.com/isaacs/minimatch).
517
+
518
+ @example
519
+ `docs` → Include the docs directory and install its dependencies.
520
+ `packages/*` → Include all nested directories within the packages directory, like `packages/cli` and `packages/core`.
521
+ */
522
+ type WorkspacePattern = string;
523
+
524
+ export interface YarnConfiguration {
525
+ /**
526
+ Used to configure [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/).
527
+
528
+ 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.
529
+
530
+ Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces.
531
+ */
532
+ workspaces?: WorkspacePattern[] | WorkspaceConfig;
533
+
534
+ /**
535
+ 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`.
536
+
537
+ Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an app), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line.
538
+ */
539
+ flat?: boolean;
540
+
541
+ /**
542
+ Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file.
543
+ */
544
+ resolutions?: Dependency;
545
+ }
546
+
547
+ export interface JSPMConfiguration {
548
+ /**
549
+ JSPM configuration.
550
+ */
551
+ jspm?: PackageJson$1;
552
+ }
553
+
554
+ /**
555
+ Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Containing standard npm properties.
556
+ */
557
+ export interface PackageJsonStandard {
558
+ /**
559
+ The name of the package.
560
+ */
561
+ name?: string;
562
+
563
+ /**
564
+ Package version, parseable by [`node-semver`](https://github.com/npm/node-semver).
565
+ */
566
+ version?: string;
567
+
568
+ /**
569
+ Package description, listed in `npm search`.
570
+ */
571
+ description?: string;
572
+
573
+ /**
574
+ Keywords associated with package, listed in `npm search`.
575
+ */
576
+ keywords?: string[];
577
+
578
+ /**
579
+ The URL to the package's homepage.
580
+ */
581
+ homepage?: LiteralUnion<'.', string>;
582
+
583
+ /**
584
+ The URL to the package's issue tracker and/or the email address to which issues should be reported.
585
+ */
586
+ bugs?: BugsLocation;
587
+
588
+ /**
589
+ The license for the package.
590
+ */
591
+ license?: string;
592
+
593
+ /**
594
+ The licenses for the package.
595
+ */
596
+ licenses?: Array<{
597
+ type?: string;
598
+ url?: string;
599
+ }>;
600
+
601
+ author?: Person;
602
+
603
+ /**
604
+ A list of people who contributed to the package.
605
+ */
606
+ contributors?: Person[];
607
+
608
+ /**
609
+ A list of people who maintain the package.
610
+ */
611
+ maintainers?: Person[];
612
+
613
+ /**
614
+ The files included in the package.
615
+ */
616
+ files?: string[];
617
+
618
+ /**
619
+ Resolution algorithm for importing ".js" files from the package's scope.
620
+
621
+ [Read more.](https://nodejs.org/api/esm.html#esm_package_json_type_field)
622
+ */
623
+ type?: 'module' | 'commonjs';
624
+
625
+ /**
626
+ The module ID that is the primary entry point to the program.
627
+ */
628
+ main?: string;
629
+
630
+ /**
631
+ Subpath exports to define entry points of the package.
632
+
633
+ [Read more.](https://nodejs.org/api/packages.html#subpath-exports)
634
+ */
635
+ exports?: Exports;
636
+
637
+ /**
638
+ Subpath imports to define internal package import maps that only apply to import specifiers from within the package itself.
639
+
640
+ [Read more.](https://nodejs.org/api/packages.html#subpath-imports)
641
+ */
642
+ imports?: Imports;
643
+
644
+ /**
645
+ The executable files that should be installed into the `PATH`.
646
+ */
647
+ bin?:
648
+ | string
649
+ | Partial<Record<string, string>>;
650
+
651
+ /**
652
+ Filenames to put in place for the `man` program to find.
653
+ */
654
+ man?: string | string[];
655
+
656
+ /**
657
+ Indicates the structure of the package.
658
+ */
659
+ directories?: DirectoryLocations;
660
+
661
+ /**
662
+ Location for the code repository.
663
+ */
664
+ repository?:
665
+ | string
666
+ | {
667
+ type: string;
668
+ url: string;
669
+
670
+ /**
671
+ Relative path to package.json if it is placed in non-root directory (for example if it is part of a monorepo).
672
+
673
+ [Read more.](https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md)
674
+ */
675
+ directory?: string;
676
+ };
677
+
678
+ /**
679
+ Script commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point.
680
+ */
681
+ scripts?: Scripts;
682
+
683
+ /**
684
+ Is used to set configuration parameters used in package scripts that persist across upgrades.
685
+ */
686
+ config?: Record<string, unknown>;
687
+
688
+ /**
689
+ The dependencies of the package.
690
+ */
691
+ dependencies?: Dependency;
692
+
693
+ /**
694
+ Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling.
695
+ */
696
+ devDependencies?: Dependency;
697
+
698
+ /**
699
+ Dependencies that are skipped if they fail to install.
700
+ */
701
+ optionalDependencies?: Dependency;
702
+
703
+ /**
704
+ Dependencies that will usually be required by the package user directly or via another dependency.
705
+ */
706
+ peerDependencies?: Dependency;
707
+
708
+ /**
709
+ Indicate peer dependencies that are optional.
710
+ */
711
+ peerDependenciesMeta?: Partial<Record<string, {optional: true}>>;
712
+
713
+ /**
714
+ Package names that are bundled when the package is published.
715
+ */
716
+ bundledDependencies?: string[];
717
+
718
+ /**
719
+ Alias of `bundledDependencies`.
720
+ */
721
+ bundleDependencies?: string[];
722
+
723
+ /**
724
+ Engines that this package runs on.
725
+ */
726
+ engines?: {
727
+ [EngineName in 'npm' | 'node' | string]?: string;
728
+ };
729
+
730
+ /**
731
+ @deprecated
732
+ */
733
+ engineStrict?: boolean;
734
+
735
+ /**
736
+ Operating systems the module runs on.
737
+ */
738
+ os?: Array<LiteralUnion<
739
+ | 'aix'
740
+ | 'darwin'
741
+ | 'freebsd'
742
+ | 'linux'
743
+ | 'openbsd'
744
+ | 'sunos'
745
+ | 'win32'
746
+ | '!aix'
747
+ | '!darwin'
748
+ | '!freebsd'
749
+ | '!linux'
750
+ | '!openbsd'
751
+ | '!sunos'
752
+ | '!win32',
753
+ string
754
+ >>;
755
+
756
+ /**
757
+ CPU architectures the module runs on.
758
+ */
759
+ cpu?: Array<LiteralUnion<
760
+ | 'arm'
761
+ | 'arm64'
762
+ | 'ia32'
763
+ | 'mips'
764
+ | 'mipsel'
765
+ | 'ppc'
766
+ | 'ppc64'
767
+ | 's390'
768
+ | 's390x'
769
+ | 'x32'
770
+ | 'x64'
771
+ | '!arm'
772
+ | '!arm64'
773
+ | '!ia32'
774
+ | '!mips'
775
+ | '!mipsel'
776
+ | '!ppc'
777
+ | '!ppc64'
778
+ | '!s390'
779
+ | '!s390x'
780
+ | '!x32'
781
+ | '!x64',
782
+ string
783
+ >>;
784
+
785
+ /**
786
+ If set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally.
787
+
788
+ @deprecated
789
+ */
790
+ preferGlobal?: boolean;
791
+
792
+ /**
793
+ If set to `true`, then npm will refuse to publish it.
794
+ */
795
+ private?: boolean;
796
+
797
+ /**
798
+ A set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default.
799
+ */
800
+ publishConfig?: PublishConfig;
801
+
802
+ /**
803
+ Describes and notifies consumers of a package's monetary support information.
804
+
805
+ [Read more.](https://github.com/npm/rfcs/blob/latest/accepted/0017-add-funding-support.md)
806
+ */
807
+ funding?: string | {
808
+ /**
809
+ The type of funding.
810
+ */
811
+ type?: LiteralUnion<
812
+ | 'github'
813
+ | 'opencollective'
814
+ | 'patreon'
815
+ | 'individual'
816
+ | 'foundation'
817
+ | 'corporation',
818
+ string
819
+ >;
820
+
821
+ /**
822
+ The URL to the funding page.
823
+ */
824
+ url: string;
825
+ };
826
+ }
827
+
828
+ export interface PublishConfig {
829
+ /**
830
+ Additional, less common properties from the [npm docs on `publishConfig`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#publishconfig).
831
+ */
832
+ [additionalProperties: string]: unknown;
833
+
834
+ /**
835
+ 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.
836
+ */
837
+ access?: 'public' | 'restricted';
838
+
839
+ /**
840
+ The base URL of the npm registry.
841
+
842
+ Default: `'https://registry.npmjs.org/'`
843
+ */
844
+ registry?: string;
845
+
846
+ /**
847
+ The tag to publish the package under.
848
+
849
+ Default: `'latest'`
850
+ */
851
+ tag?: string;
852
+ }
853
+ }
854
+
855
+ /**
856
+ Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn.
857
+
858
+ @category File
859
+ */
860
+ type PackageJson$1 =
861
+ PackageJson$1.PackageJsonStandard &
862
+ PackageJson$1.NonStandardEntryPoints &
863
+ PackageJson$1.TypeScriptConfiguration &
864
+ PackageJson$1.YarnConfiguration &
865
+ PackageJson$1.JSPMConfiguration;
866
+
867
+ interface SBBaseType {
868
+ required?: boolean;
869
+ raw?: string;
870
+ }
871
+ declare type SBScalarType = SBBaseType & {
872
+ name: 'boolean' | 'string' | 'number' | 'function' | 'symbol';
873
+ };
874
+ declare type SBArrayType = SBBaseType & {
875
+ name: 'array';
876
+ value: SBType;
877
+ };
878
+ declare type SBObjectType = SBBaseType & {
879
+ name: 'object';
880
+ value: Record<string, SBType>;
881
+ };
882
+ declare type SBEnumType = SBBaseType & {
883
+ name: 'enum';
884
+ value: (string | number)[];
885
+ };
886
+ declare type SBIntersectionType = SBBaseType & {
887
+ name: 'intersection';
888
+ value: SBType[];
889
+ };
890
+ declare type SBUnionType = SBBaseType & {
891
+ name: 'union';
892
+ value: SBType[];
893
+ };
894
+ declare type SBOtherType = SBBaseType & {
895
+ name: 'other';
896
+ value: string;
897
+ };
898
+ declare type SBType = SBScalarType | SBEnumType | SBArrayType | SBObjectType | SBIntersectionType | SBUnionType | SBOtherType;
899
+
900
+ declare type StoryId = string;
901
+ declare type ComponentId = string;
902
+ declare type ComponentTitle = string;
903
+ declare type StoryName = string;
904
+ /** @deprecated */
905
+ declare type StoryKind = ComponentTitle;
906
+ declare type Tag = string;
907
+ interface StoryIdentifier {
908
+ componentId: ComponentId;
909
+ title: ComponentTitle;
910
+ /** @deprecated */
911
+ kind: ComponentTitle;
912
+ id: StoryId;
913
+ name: StoryName;
914
+ /** @deprecated */
915
+ story: StoryName;
916
+ tags: Tag[];
917
+ }
918
+ declare type Parameters$1 = {
919
+ [name: string]: any;
920
+ };
921
+ declare type ConditionalTest = {
922
+ truthy?: boolean;
923
+ } | {
924
+ exists: boolean;
925
+ } | {
926
+ eq: any;
927
+ } | {
928
+ neq: any;
929
+ };
930
+ declare type ConditionalValue = {
931
+ arg: string;
932
+ } | {
933
+ global: string;
934
+ };
935
+ declare type Conditional = ConditionalValue & ConditionalTest;
936
+ interface InputType {
937
+ name?: string;
938
+ description?: string;
939
+ defaultValue?: any;
940
+ type?: SBType | SBScalarType['name'];
941
+ if?: Conditional;
942
+ [key: string]: any;
943
+ }
944
+ interface StrictInputType extends InputType {
945
+ name: string;
946
+ type?: SBType;
947
+ }
948
+ declare type Args = {
949
+ [name: string]: any;
950
+ };
951
+ declare type ArgTypes<TArgs = Args> = {
952
+ [name in keyof TArgs]: InputType;
953
+ };
954
+ declare type StrictArgTypes<TArgs = Args> = {
955
+ [name in keyof TArgs]: StrictInputType;
956
+ };
957
+ declare type Globals = {
958
+ [name: string]: any;
959
+ };
960
+ declare type GlobalTypes = {
961
+ [name: string]: InputType;
962
+ };
963
+ declare type StrictGlobalTypes = {
964
+ [name: string]: StrictInputType;
965
+ };
966
+ declare type AnyFramework = {
967
+ component: unknown;
968
+ storyResult: unknown;
969
+ T?: unknown;
970
+ };
971
+ declare type StoryContextForEnhancers<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = StoryIdentifier & {
972
+ component?: (TFramework & {
973
+ T: any;
974
+ })['component'];
975
+ subcomponents?: Record<string, (TFramework & {
976
+ T: any;
977
+ })['component']>;
978
+ parameters: Parameters$1;
979
+ initialArgs: TArgs;
980
+ argTypes: StrictArgTypes<TArgs>;
981
+ };
982
+ declare type ArgsEnhancer<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (context: StoryContextForEnhancers<TFramework, TArgs>) => TArgs;
983
+ declare type ArgTypesEnhancer<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = ((context: StoryContextForEnhancers<TFramework, TArgs>) => StrictArgTypes<TArgs>) & {
984
+ secondPass?: boolean;
985
+ };
986
+ declare type StoryContextUpdate<TArgs = Args> = {
987
+ args?: TArgs;
988
+ globals?: Globals;
989
+ [key: string]: any;
990
+ };
991
+ declare type ViewMode$1 = 'story' | 'docs';
992
+ declare type StoryContextForLoaders<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = StoryContextForEnhancers<TFramework, TArgs> & Required<StoryContextUpdate<TArgs>> & {
993
+ hooks: unknown;
994
+ viewMode: ViewMode$1;
995
+ originalStoryFn: StoryFn<TFramework>;
996
+ };
997
+ declare type LoaderFunction<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (context: StoryContextForLoaders<TFramework, TArgs>) => Promise<Record<string, any>>;
998
+ declare type StoryContext<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = StoryContextForLoaders<TFramework, TArgs> & {
999
+ loaded: Record<string, any>;
1000
+ abortSignal: AbortSignal;
1001
+ canvasElement: HTMLElement;
1002
+ };
1003
+ declare type StepLabel = string;
1004
+ declare type StepFunction<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (label: StepLabel, play: PlayFunction<TFramework, TArgs>) => Promise<void> | void;
1005
+ declare type PlayFunctionContext<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = StoryContext<TFramework, TArgs> & {
1006
+ step: StepFunction<TFramework, TArgs>;
1007
+ };
1008
+ declare type PlayFunction<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (context: PlayFunctionContext<TFramework, TArgs>) => Promise<void> | void;
1009
+ declare type PartialStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (update?: StoryContextUpdate<Partial<TArgs>>) => TFramework['storyResult'];
1010
+ declare type LegacyStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (context: StoryContext<TFramework, TArgs>) => TFramework['storyResult'];
1011
+ declare type ArgsStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (args: TArgs, context: StoryContext<TFramework, TArgs>) => (TFramework & {
1012
+ T: TArgs;
1013
+ })['storyResult'];
1014
+ declare type StoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = LegacyStoryFn<TFramework, TArgs> | ArgsStoryFn<TFramework, TArgs>;
1015
+ declare type DecoratorFunction<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (fn: PartialStoryFn<TFramework, TArgs>, c: StoryContext<TFramework, TArgs>) => TFramework['storyResult'];
1016
+ declare type DecoratorApplicator<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (storyFn: LegacyStoryFn<TFramework, TArgs>, decorators: DecoratorFunction<TFramework, TArgs>[]) => LegacyStoryFn<TFramework, TArgs>;
1017
+ declare type StepRunner<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = (label: StepLabel, play: PlayFunction<TFramework, TArgs>, context: PlayFunctionContext<TFramework, TArgs>) => Promise<void>;
1018
+ declare type BaseAnnotations<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = {
1019
+ /**
1020
+ * Wrapper components or Storybook decorators that wrap a story.
1021
+ *
1022
+ * Decorators defined in Meta will be applied to every story variation.
1023
+ * @see [Decorators](https://storybook.js.org/docs/addons/introduction/#1-decorators)
1024
+ */
1025
+ decorators?: DecoratorFunction<TFramework, TArgs>[];
1026
+ /**
1027
+ * Custom metadata for a story.
1028
+ * @see [Parameters](https://storybook.js.org/docs/basics/writing-stories/#parameters)
1029
+ */
1030
+ parameters?: Parameters$1;
1031
+ /**
1032
+ * Dynamic data that are provided (and possibly updated by) Storybook and its addons.
1033
+ * @see [Arg story inputs](https://storybook.js.org/docs/react/api/csf#args-story-inputs)
1034
+ */
1035
+ args?: Partial<TArgs>;
1036
+ /**
1037
+ * ArgTypes encode basic metadata for args, such as `name`, `description`, `defaultValue` for an arg. These get automatically filled in by Storybook Docs.
1038
+ * @see [Control annotations](https://github.com/storybookjs/storybook/blob/91e9dee33faa8eff0b342a366845de7100415367/addons/controls/README.md#control-annotations)
1039
+ */
1040
+ argTypes?: Partial<ArgTypes<TArgs>>;
1041
+ /**
1042
+ * Asynchronous functions which provide data for a story.
1043
+ * @see [Loaders](https://storybook.js.org/docs/react/writing-stories/loaders)
1044
+ */
1045
+ loaders?: LoaderFunction<TFramework, TArgs>[];
1046
+ /**
1047
+ * Define a custom render function for the story(ies). If not passed, a default render function by the framework will be used.
1048
+ */
1049
+ render?: ArgsStoryFn<TFramework, TArgs>;
1050
+ };
1051
+ declare type ProjectAnnotations<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = BaseAnnotations<TFramework, TArgs> & {
1052
+ argsEnhancers?: ArgsEnhancer<TFramework, Args>[];
1053
+ argTypesEnhancers?: ArgTypesEnhancer<TFramework, Args>[];
1054
+ globals?: Globals;
1055
+ globalTypes?: GlobalTypes;
1056
+ applyDecorators?: DecoratorApplicator<TFramework, Args>;
1057
+ runStep?: StepRunner<TFramework, TArgs>;
1058
+ };
1059
+ declare type StoryDescriptor$1 = string[] | RegExp;
1060
+ interface ComponentAnnotations<TFramework extends AnyFramework = AnyFramework, TArgs = Args> extends BaseAnnotations<TFramework, TArgs> {
1061
+ /**
1062
+ * Title of the component which will be presented in the navigation. **Should be unique.**
1063
+ *
1064
+ * Components can be organized in a nested structure using "/" as a separator.
1065
+ *
1066
+ * Since CSF 3.0 this property is optional -- it can be inferred from the filesystem path
1067
+ *
1068
+ * @example
1069
+ * export default {
1070
+ * ...
1071
+ * title: 'Design System/Atoms/Button'
1072
+ * }
1073
+ *
1074
+ * @see [Story Hierarchy](https://storybook.js.org/docs/basics/writing-stories/#story-hierarchy)
1075
+ */
1076
+ title?: ComponentTitle;
1077
+ /**
1078
+ * Id of the component (prefix of the story id) which is used for URLs.
1079
+ *
1080
+ * By default is inferred from sanitizing the title
1081
+ *
1082
+ * @see [Story Hierarchy](https://storybook.js.org/docs/basics/writing-stories/#story-hierarchy)
1083
+ */
1084
+ id?: ComponentId;
1085
+ /**
1086
+ * Used to only include certain named exports as stories. Useful when you want to have non-story exports such as mock data or ignore a few stories.
1087
+ * @example
1088
+ * includeStories: ['SimpleStory', 'ComplexStory']
1089
+ * includeStories: /.*Story$/
1090
+ *
1091
+ * @see [Non-story exports](https://storybook.js.org/docs/formats/component-story-format/#non-story-exports)
1092
+ */
1093
+ includeStories?: StoryDescriptor$1;
1094
+ /**
1095
+ * Used to exclude certain named exports. Useful when you want to have non-story exports such as mock data or ignore a few stories.
1096
+ * @example
1097
+ * excludeStories: ['simpleData', 'complexData']
1098
+ * excludeStories: /.*Data$/
1099
+ *
1100
+ * @see [Non-story exports](https://storybook.js.org/docs/formats/component-story-format/#non-story-exports)
1101
+ */
1102
+ excludeStories?: StoryDescriptor$1;
1103
+ /**
1104
+ * The primary component for your story.
1105
+ *
1106
+ * Used by addons for automatic prop table generation and display of other component metadata.
1107
+ */
1108
+ component?: (TFramework & {
1109
+ T: Args extends TArgs ? any : TArgs;
1110
+ })['component'];
1111
+ /**
1112
+ * Auxiliary subcomponents that are part of the stories.
1113
+ *
1114
+ * Used by addons for automatic prop table generation and display of other component metadata.
1115
+ *
1116
+ * @example
1117
+ * import { Button, ButtonGroup } from './components';
1118
+ *
1119
+ * export default {
1120
+ * ...
1121
+ * subcomponents: { Button, ButtonGroup }
1122
+ * }
1123
+ *
1124
+ * By defining them each component will have its tab in the args table.
1125
+ */
1126
+ subcomponents?: Record<string, TFramework['component']>;
1127
+ /**
1128
+ * Function that is executed after the story is rendered.
1129
+ */
1130
+ play?: PlayFunction<TFramework, TArgs>;
1131
+ /**
1132
+ * Named tags for a story, used to filter stories in different contexts.
1133
+ */
1134
+ tags?: Tag[];
1135
+ }
1136
+ declare type StoryAnnotations<TFramework extends AnyFramework = AnyFramework, TArgs = Args, TRequiredArgs = Partial<TArgs>> = BaseAnnotations<TFramework, TArgs> & {
1137
+ /**
1138
+ * Override the display name in the UI (CSF v3)
1139
+ */
1140
+ name?: StoryName;
1141
+ /**
1142
+ * Override the display name in the UI (CSF v2)
1143
+ */
1144
+ storyName?: StoryName;
1145
+ /**
1146
+ * Function that is executed after the story is rendered.
1147
+ */
1148
+ play?: PlayFunction<TFramework, TArgs>;
1149
+ /**
1150
+ * Named tags for a story, used to filter stories in different contexts.
1151
+ */
1152
+ tags?: Tag[];
1153
+ /** @deprecated */
1154
+ story?: Omit<StoryAnnotations<TFramework, TArgs>, 'story'>;
1155
+ } & ({} extends TRequiredArgs ? {
1156
+ args?: TRequiredArgs;
1157
+ } : {
1158
+ args: TRequiredArgs;
1159
+ });
1160
+ declare type LegacyAnnotatedStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = StoryFn<TFramework, TArgs> & StoryAnnotations<TFramework, TArgs>;
1161
+ declare type LegacyStoryAnnotationsOrFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = LegacyAnnotatedStoryFn<TFramework, TArgs> | StoryAnnotations<TFramework, TArgs>;
1162
+ declare type AnnotatedStoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = ArgsStoryFn<TFramework, TArgs> & StoryAnnotations<TFramework, TArgs>;
1163
+ declare type StoryAnnotationsOrFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = AnnotatedStoryFn<TFramework, TArgs> | StoryAnnotations<TFramework, TArgs>;
1164
+ declare type ArgsFromMeta<TFramework extends AnyFramework, Meta> = Meta extends {
1165
+ render?: ArgsStoryFn<TFramework, infer RArgs>;
1166
+ loaders?: (infer Loaders)[];
1167
+ decorators?: (infer Decorators)[];
1168
+ } ? Simplify<RArgs & DecoratorsArgs<TFramework, Decorators> & LoaderArgs<TFramework, Loaders>> : unknown;
1169
+ declare type DecoratorsArgs<TFramework extends AnyFramework, Decorators> = UnionToIntersection<Decorators extends DecoratorFunction<TFramework, infer TArgs> ? TArgs : unknown>;
1170
+ declare type LoaderArgs<TFramework extends AnyFramework, Loaders> = UnionToIntersection<Loaders extends LoaderFunction<TFramework, infer TArgs> ? TArgs : unknown>;
1171
+ declare type StoryDescriptor = string[] | RegExp;
1172
+ interface IncludeExcludeOptions {
1173
+ includeStories?: StoryDescriptor;
1174
+ excludeStories?: StoryDescriptor;
1175
+ }
1176
+ interface SeparatorOptions {
1177
+ rootSeparator: string | RegExp;
1178
+ groupSeparator: string | RegExp;
1179
+ }
1180
+
1181
+ /**
1182
+ * A URL pathname, beginning with a /.
1183
+ *
1184
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.pathname
1185
+ */
1186
+ declare type Pathname = string;
1187
+ /**
1188
+ * A URL search string, beginning with a ?.
1189
+ *
1190
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.search
1191
+ */
1192
+ declare type Search = string;
1193
+ /**
1194
+ * A URL fragment identifier, beginning with a #.
1195
+ *
1196
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.hash
1197
+ */
1198
+ declare type Hash = string;
1199
+ /**
1200
+ * A unique string associated with a location. May be used to safely store
1201
+ * and retrieve data in some other storage API, like `localStorage`.
1202
+ *
1203
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.key
1204
+ */
1205
+ declare type Key = string;
1206
+ /**
1207
+ * The pathname, search, and hash values of a URL.
1208
+ */
1209
+ interface Path$1 {
1210
+ /**
1211
+ * A URL pathname, beginning with a /.
1212
+ *
1213
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.pathname
1214
+ */
1215
+ pathname: Pathname;
1216
+ /**
1217
+ * A URL search string, beginning with a ?.
1218
+ *
1219
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.search
1220
+ */
1221
+ search: Search;
1222
+ /**
1223
+ * A URL fragment identifier, beginning with a #.
1224
+ *
1225
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.hash
1226
+ */
1227
+ hash: Hash;
1228
+ }
1229
+ /**
1230
+ * An entry in a history stack. A location contains information about the
1231
+ * URL path, as well as possibly some arbitrary state and a key.
1232
+ *
1233
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location
1234
+ */
1235
+ interface Location extends Path$1 {
1236
+ /**
1237
+ * A value of arbitrary data associated with this location.
1238
+ *
1239
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.state
1240
+ */
1241
+ state: unknown;
1242
+ /**
1243
+ * A unique string associated with this location. May be used to safely store
1244
+ * and retrieve data in some other storage API, like `localStorage`.
1245
+ *
1246
+ * Note: This value is always "default" on the initial location.
1247
+ *
1248
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#location.key
1249
+ */
1250
+ key: Key;
1251
+ }
1252
+
1253
+ interface StoryData {
1254
+ viewMode?: string;
1255
+ storyId?: string;
1256
+ refId?: string;
1257
+ }
1258
+
1259
+ interface Other extends StoryData {
1260
+ path: string;
1261
+ singleStory?: boolean;
1262
+ }
1263
+ declare type RouterData = {
1264
+ location: Partial<Location>;
1265
+ navigate: ReturnType<typeof useNavigate>;
1266
+ } & Other;
1267
+ declare type RenderData = Pick<RouterData, 'location'> & Other;
1268
+ declare const useNavigate: () => (to: string | number, { plain, ...options }?: any) => void;
1269
+
1270
+ interface ThemeVars {
1271
+ base: 'light' | 'dark';
1272
+ colorPrimary?: string;
1273
+ colorSecondary?: string;
1274
+ appBg?: string;
1275
+ appContentBg?: string;
1276
+ appBorderColor?: string;
1277
+ appBorderRadius?: number;
1278
+ fontBase?: string;
1279
+ fontCode?: string;
1280
+ textColor?: string;
1281
+ textInverseColor?: string;
1282
+ textMutedColor?: string;
1283
+ barTextColor?: string;
1284
+ barSelectedColor?: string;
1285
+ barBg?: string;
1286
+ buttonBg?: string;
1287
+ buttonBorder?: string;
1288
+ booleanBg?: string;
1289
+ booleanSelectedBg?: string;
1290
+ inputBg?: string;
1291
+ inputBorder?: string;
1292
+ inputTextColor?: string;
1293
+ inputBorderRadius?: number;
1294
+ brandTitle?: string;
1295
+ brandUrl?: string;
1296
+ brandImage?: string;
1297
+ brandTarget?: string;
1298
+ gridCellSize?: number;
1299
+ }
1300
+
1301
+ declare type Addon_Types = Addon_TypesEnum | string;
1302
+ interface Addon_ArgType<TArg = unknown> extends InputType {
1303
+ defaultValue?: TArg;
1304
+ }
1305
+ declare type Addons_ArgTypes<TArgs = Args> = {
1306
+ [key in keyof Partial<TArgs>]: Addon_ArgType<TArgs[key]>;
1307
+ } & {
1308
+ [key in string]: Addon_ArgType<unknown>;
1309
+ };
1310
+ declare type Addon_Comparator<T> = ((a: T, b: T) => boolean) | ((a: T, b: T) => number);
1311
+ declare type Addon_StorySortMethod = 'configure' | 'alphabetical';
1312
+ interface Addon_StorySortObjectParameter {
1313
+ method?: Addon_StorySortMethod;
1314
+ order?: any[];
1315
+ locales?: string;
1316
+ includeNames?: boolean;
1317
+ }
1318
+ interface Addon_BaseIndexEntry {
1319
+ id: StoryId;
1320
+ name: StoryName;
1321
+ title: ComponentTitle;
1322
+ tags?: Tag[];
1323
+ importPath: Path;
1324
+ }
1325
+ declare type Addon_StoryIndexEntry = Addon_BaseIndexEntry & {
1326
+ type: 'story';
1327
+ };
1328
+ declare type Addon_DocsIndexEntry = Addon_BaseIndexEntry & {
1329
+ storiesImports: Path[];
1330
+ type: 'docs';
1331
+ standalone: boolean;
1332
+ };
1333
+ /** A StandaloneDocsIndexExtry represents a file who's default export is directly renderable */
1334
+ declare type Addon_StandaloneDocsIndexEntry = Addon_DocsIndexEntry & {
1335
+ standalone: true;
1336
+ };
1337
+ /** A TemplateDocsIndexEntry represents a stories file that gets rendered in "docs" mode */
1338
+ declare type Addon_TemplateDocsIndexEntry = Addon_DocsIndexEntry & {
1339
+ standalone: false;
1340
+ };
1341
+ declare type Addon_IndexEntry = Addon_StoryIndexEntry | Addon_DocsIndexEntry;
1342
+ declare type Addon_IndexEntryLegacy = [StoryId, any, Parameters, Parameters];
1343
+ declare type Addon_StorySortComparator = Addon_Comparator<Addon_IndexEntryLegacy>;
1344
+ declare type Addon_StorySortParameter = Addon_StorySortComparator | Addon_StorySortObjectParameter;
1345
+ declare type Addon_StorySortComparatorV7 = Addon_Comparator<Addon_IndexEntry>;
1346
+ declare type Addon_StorySortParameterV7 = Addon_StorySortComparatorV7 | Addon_StorySortObjectParameter;
1347
+ interface Addon_OptionsParameter extends Object {
1348
+ storySort?: Addon_StorySortParameter;
1349
+ theme?: {
1350
+ base: string;
1351
+ brandTitle?: string;
1352
+ };
1353
+ [key: string]: any;
1354
+ }
1355
+ declare type Addon_StoryContext<TFramework extends AnyFramework = AnyFramework> = StoryContext<TFramework>;
1356
+ declare type Addon_StoryContextUpdate = Partial<Addon_StoryContext>;
1357
+ declare type Addon_ReturnTypeFramework<ReturnType> = {
1358
+ component: any;
1359
+ storyResult: ReturnType;
1360
+ };
1361
+ declare type Addon_PartialStoryFn<ReturnType = unknown> = PartialStoryFn<Addon_ReturnTypeFramework<ReturnType>>;
1362
+ declare type Addon_LegacyStoryFn<ReturnType = unknown> = LegacyStoryFn<Addon_ReturnTypeFramework<ReturnType>>;
1363
+ declare type Addon_ArgsStoryFn<ReturnType = unknown> = ArgsStoryFn<Addon_ReturnTypeFramework<ReturnType>>;
1364
+ declare type Addon_StoryFn<ReturnType = unknown> = StoryFn<Addon_ReturnTypeFramework<ReturnType>>;
1365
+ declare type Addon_DecoratorFunction<StoryFnReturnType = unknown> = DecoratorFunction<Addon_ReturnTypeFramework<StoryFnReturnType>>;
1366
+ declare type Addon_LoaderFunction = LoaderFunction<Addon_ReturnTypeFramework<unknown>>;
1367
+ interface Addon_WrapperSettings {
1368
+ options: object;
1369
+ parameters: {
1370
+ [key: string]: any;
1371
+ };
1372
+ }
1373
+ declare type Addon_StoryWrapper = (storyFn: Addon_LegacyStoryFn, context: Addon_StoryContext, settings: Addon_WrapperSettings) => any;
1374
+ declare type Addon_MakeDecoratorResult = (...args: any) => any;
1375
+ interface Addon_AddStoryArgs<StoryFnReturnType = unknown> {
1376
+ id: StoryId;
1377
+ kind: StoryKind;
1378
+ name: StoryName;
1379
+ storyFn: Addon_StoryFn<StoryFnReturnType>;
1380
+ parameters: Parameters;
1381
+ }
1382
+ interface Addon_ClientApiAddon<StoryFnReturnType = unknown> extends Addon_Type {
1383
+ apply: (a: Addon_StoryApi<StoryFnReturnType>, b: any[]) => any;
1384
+ }
1385
+ interface Addon_ClientApiAddons<StoryFnReturnType> {
1386
+ [key: string]: Addon_ClientApiAddon<StoryFnReturnType>;
1387
+ }
1388
+ declare type Addon_ClientApiReturnFn<StoryFnReturnType = unknown> = (...args: any[]) => Addon_StoryApi<StoryFnReturnType>;
1389
+ interface Addon_StoryApi<StoryFnReturnType = unknown> {
1390
+ kind: StoryKind;
1391
+ add: (storyName: StoryName, storyFn: Addon_StoryFn<StoryFnReturnType>, parameters?: Parameters) => Addon_StoryApi<StoryFnReturnType>;
1392
+ addDecorator: (decorator: Addon_DecoratorFunction<StoryFnReturnType>) => Addon_StoryApi<StoryFnReturnType>;
1393
+ addLoader: (decorator: Addon_LoaderFunction) => Addon_StoryApi<StoryFnReturnType>;
1394
+ addParameters: (parameters: Parameters) => Addon_StoryApi<StoryFnReturnType>;
1395
+ [k: string]: string | Addon_ClientApiReturnFn<StoryFnReturnType>;
1396
+ }
1397
+ interface Addon_ClientStoryApi<StoryFnReturnType = unknown> {
1398
+ storiesOf(kind: StoryKind, module: any): Addon_StoryApi<StoryFnReturnType>;
1399
+ }
1400
+ declare type Addon_LoadFn = () => any;
1401
+ declare type Addon_RequireContext = any;
1402
+ declare type Addon_Loadable = Addon_RequireContext | [Addon_RequireContext] | Addon_LoadFn;
1403
+ declare type Addon_BaseDecorators<StoryFnReturnType> = Array<(story: () => StoryFnReturnType, context: Addon_StoryContext) => StoryFnReturnType>;
1404
+ interface Addon_BaseAnnotations<TArgs, StoryFnReturnType> {
1405
+ /**
1406
+ * Dynamic data that are provided (and possibly updated by) Storybook and its addons.
1407
+ * @see [Arg story inputs](https://storybook.js.org/docs/react/api/csf#args-story-inputs)
1408
+ */
1409
+ args?: Partial<TArgs>;
1410
+ /**
1411
+ * ArgTypes encode basic metadata for args, such as `name`, `description`, `defaultValue` for an arg. These get automatically filled in by Storybook Docs.
1412
+ * @see [Control annotations](https://github.com/storybookjs/storybook/blob/91e9dee33faa8eff0b342a366845de7100415367/addons/controls/README.md#control-annotations)
1413
+ */
1414
+ argTypes?: Addons_ArgTypes<TArgs>;
1415
+ /**
1416
+ * Custom metadata for a story.
1417
+ * @see [Parameters](https://storybook.js.org/docs/basics/writing-stories/#parameters)
1418
+ */
1419
+ parameters?: Parameters;
1420
+ /**
1421
+ * Wrapper components or Storybook decorators that wrap a story.
1422
+ *
1423
+ * Decorators defined in Meta will be applied to every story variation.
1424
+ * @see [Decorators](https://storybook.js.org/docs/addons/introduction/#1-decorators)
1425
+ */
1426
+ decorators?: Addon_BaseDecorators<StoryFnReturnType>;
1427
+ /**
1428
+ * Define a custom render function for the story(ies). If not passed, a default render function by the framework will be used.
1429
+ */
1430
+ render?: (args: TArgs, context: Addon_StoryContext) => StoryFnReturnType;
1431
+ /**
1432
+ * Function that is executed after the story is rendered.
1433
+ */
1434
+ play?: (context: Addon_StoryContext) => Promise<void> | void;
1435
+ }
1436
+ interface Addon_Annotations<TArgs, StoryFnReturnType> extends Addon_BaseAnnotations<TArgs, StoryFnReturnType> {
1437
+ /**
1438
+ * Used to only include certain named exports as stories. Useful when you want to have non-story exports such as mock data or ignore a few stories.
1439
+ * @example
1440
+ * includeStories: ['SimpleStory', 'ComplexStory']
1441
+ * includeStories: /.*Story$/
1442
+ *
1443
+ * @see [Non-story exports](https://storybook.js.org/docs/formats/component-story-format/#non-story-exports)
1444
+ */
1445
+ includeStories?: string[] | RegExp;
1446
+ /**
1447
+ * Used to exclude certain named exports. Useful when you want to have non-story exports such as mock data or ignore a few stories.
1448
+ * @example
1449
+ * excludeStories: ['simpleData', 'complexData']
1450
+ * excludeStories: /.*Data$/
1451
+ *
1452
+ * @see [Non-story exports](https://storybook.js.org/docs/formats/component-story-format/#non-story-exports)
1453
+ */
1454
+ excludeStories?: string[] | RegExp;
1455
+ }
1456
+ interface Addon_BaseMeta<ComponentType> {
1457
+ /**
1458
+ * Title of the story which will be presented in the navigation. **Should be unique.**
1459
+ *
1460
+ * Stories can be organized in a nested structure using "/" as a separator.
1461
+ *
1462
+ * Since CSF 3.0 this property is optional.
1463
+ *
1464
+ * @example
1465
+ * export default {
1466
+ * ...
1467
+ * title: 'Design System/Atoms/Button'
1468
+ * }
1469
+ *
1470
+ * @see [Story Hierarchy](https://storybook.js.org/docs/basics/writing-stories/#story-hierarchy)
1471
+ */
1472
+ title?: string;
1473
+ /**
1474
+ * Manually set the id of a story, which in particular is useful if you want to rename stories without breaking permalinks.
1475
+ *
1476
+ * Storybook will prioritize the id over the title for ID generation, if provided, and will prioritize the story.storyName over the export key for display.
1477
+ *
1478
+ * @see [Sidebar and URLs](https://storybook.js.org/docs/react/configure/sidebar-and-urls#permalinking-to-stories)
1479
+ */
1480
+ id?: string;
1481
+ /**
1482
+ * The primary component for your story.
1483
+ *
1484
+ * Used by addons for automatic prop table generation and display of other component metadata.
1485
+ */
1486
+ component?: ComponentType;
1487
+ /**
1488
+ * Auxiliary subcomponents that are part of the stories.
1489
+ *
1490
+ * Used by addons for automatic prop table generation and display of other component metadata.
1491
+ *
1492
+ * @example
1493
+ * import { Button, ButtonGroup } from './components';
1494
+ *
1495
+ * export default {
1496
+ * ...
1497
+ * subcomponents: { Button, ButtonGroup }
1498
+ * }
1499
+ *
1500
+ * By defining them each component will have its tab in the args table.
1501
+ */
1502
+ subcomponents?: Record<string, ComponentType>;
1503
+ }
1504
+ declare type Addon_BaseStoryObject<TArgs, StoryFnReturnType> = {
1505
+ /**
1506
+ * Override the display name in the UI
1507
+ */
1508
+ storyName?: string;
1509
+ };
1510
+ declare type Addon_BaseStoryFn<TArgs, StoryFnReturnType> = {
1511
+ (args: TArgs, context: Addon_StoryContext): StoryFnReturnType;
1512
+ } & Addon_BaseStoryObject<TArgs, StoryFnReturnType>;
1513
+ declare type BaseStory<TArgs, StoryFnReturnType> = Addon_BaseStoryFn<TArgs, StoryFnReturnType> | Addon_BaseStoryObject<TArgs, StoryFnReturnType>;
1514
+ interface Addon_RenderOptions {
1515
+ active?: boolean;
1516
+ key?: string;
1517
+ }
1518
+ interface Addon_Type {
1519
+ title: (() => string) | string;
1520
+ type?: Addon_Types;
1521
+ id?: string;
1522
+ route?: (routeOptions: RenderData) => string;
1523
+ match?: (matchOptions: RenderData) => boolean;
1524
+ render: (renderOptions: Addon_RenderOptions) => any | null;
1525
+ paramKey?: string;
1526
+ disabled?: boolean;
1527
+ hidden?: boolean;
1528
+ }
1529
+ declare type Addon_Loader<API> = (api: API) => void;
1530
+ interface Addon_Loaders<API> {
1531
+ [key: string]: Addon_Loader<API>;
1532
+ }
1533
+ interface Addon_Collection {
1534
+ [key: string]: Addon_Type;
1535
+ }
1536
+ interface Addon_Elements {
1537
+ [key: string]: Addon_Collection;
1538
+ }
1539
+ interface Addon_ToolbarConfig {
1540
+ hidden?: boolean;
1541
+ }
1542
+ interface Addon_Config {
1543
+ theme?: ThemeVars;
1544
+ toolbar?: {
1545
+ [id: string]: Addon_ToolbarConfig;
1546
+ };
1547
+ [key: string]: any;
1548
+ }
1549
+ declare enum Addon_TypesEnum {
1550
+ TAB = "tab",
1551
+ PANEL = "panel",
1552
+ TOOL = "tool",
1553
+ TOOLEXTRA = "toolextra",
1554
+ PREVIEW = "preview",
1555
+ NOTES_ELEMENT = "notes-element"
1556
+ }
1557
+
1558
+ declare type CSF_Tag = string;
1559
+ interface CSF_Meta {
1560
+ id?: string;
1561
+ title?: string;
1562
+ component?: string;
1563
+ includeStories?: string[] | RegExp;
1564
+ excludeStories?: string[] | RegExp;
1565
+ tags?: CSF_Tag[];
1566
+ }
1567
+ interface CSF_Story {
1568
+ id: string;
1569
+ name: string;
1570
+ parameters: Parameters;
1571
+ tags?: CSF_Tag[];
1572
+ }
1573
+ declare type ViewMode = ViewMode$1 | 'story' | 'info' | 'settings' | string | undefined;
1574
+ declare type Layout = 'centered' | 'fullscreen' | 'padded' | 'none';
1575
+ interface Parameters extends Parameters$1 {
1576
+ fileName?: string;
1577
+ options?: Addon_OptionsParameter;
1578
+ /** The layout property defines basic styles added to the preview body where the story is rendered. If you pass 'none', no styles are applied. */
1579
+ layout?: Layout;
1580
+ docsOnly?: boolean;
1581
+ [key: string]: any;
1582
+ }
1583
+ declare type Path = string;
1584
+
1585
+ type ValueOrPromiseOfValue<T> = T | PromiseLike<T>
1586
+ type RejectedOutcome = {
1587
+ status: "rejected",
1588
+ reason: any
1589
+ }
1590
+ type FulfilledOutcome<T> = {
1591
+ status: "fulfilled",
1592
+ value: T
1593
+ }
1594
+ type SettledOutcome<T> = FulfilledOutcome<T> | RejectedOutcome
1595
+
1596
+ interface SynchronousPromiseConstructor {
1597
+ /**
1598
+ * A reference to the prototype.
1599
+ */
1600
+ prototype: SynchronousPromise<any>;
1601
+
1602
+ /**
1603
+ * Creates a new Promise.
1604
+ * @param executor A callback used to initialize the promise. This callback is passed two arguments:
1605
+ * a resolve callback used resolve the promise with a value or the result of another promise,
1606
+ * and a reject callback used to reject the promise with a provided reason or error.
1607
+ */
1608
+ new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): SynchronousPromise<T>;
1609
+
1610
+ /**
1611
+ * Creates a Promise that is resolved with an array of results when all of the provided Promises
1612
+ * resolve, or rejected when any Promise is rejected.
1613
+ * @param v1 An array of Promises
1614
+ * @returns A new Promise.
1615
+ */
1616
+ all<T>(v1: ValueOrPromiseOfValue<T>[]): SynchronousPromise<T[]>;
1617
+ /**
1618
+ * Creates a Promise that is resolved with an array of results when all of the provided Promises
1619
+ * resolve, or rejected when any Promise is rejected.
1620
+ * @param values Any number of Promises.
1621
+ * @returns A new Promise.
1622
+ */
1623
+ all<T>(...values: ValueOrPromiseOfValue<T>[]): SynchronousPromise<T[]>;
1624
+
1625
+ /**
1626
+ * Creates a Promise that is resolved with an array of outcome objects after all of the provided Promises
1627
+ * have settled. Each outcome object has a .status of either "fulfilled" or "rejected" and corresponding
1628
+ * "value" or "reason" properties.
1629
+ * @param v1 An array of Promises.
1630
+ * @returns A new Promise.
1631
+ */
1632
+ allSettled<T>(v1: ValueOrPromiseOfValue<T>[]): SynchronousPromise<SettledOutcome<T>[]>;
1633
+ /**
1634
+ * Creates a Promise that is resolved with an array of outcome objects after all of the provided Promises
1635
+ * have settled. Each outcome object has a .status of either "fulfilled" or "rejected" and corresponding
1636
+ * "value" or "reason" properties.
1637
+ * @param values Any number of promises
1638
+ * @returns A new Promise.
1639
+ */
1640
+ allSettled<TAllSettled>(...values: ValueOrPromiseOfValue<TAllSettled>[]): SynchronousPromise<SettledOutcome<TAllSettled>[]>;
1641
+
1642
+ /**
1643
+ * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
1644
+ * or rejected.
1645
+ * @param values An array of Promises.
1646
+ * @returns A new Promise.
1647
+ */
1648
+ // race<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T>;
1649
+
1650
+ /**
1651
+ * Creates a Promise that is resolved with the first value from the provided
1652
+ * Promises, or rejected when all provided Promises reject
1653
+ * @param v1 An array of Promises
1654
+ */
1655
+ any<T>(v1: ValueOrPromiseOfValue<T>[]): SynchronousPromise<T>;
1656
+ /**
1657
+ * Creates a Promise that is resolved with the first value from the provided
1658
+ * Promises, or rejected when all provided Promises reject
1659
+ * @param values Any number of Promises
1660
+ */
1661
+ any<T>(...values: ValueOrPromiseOfValue<T>[]): SynchronousPromise<T>;
1662
+
1663
+ /**
1664
+ * Creates a new rejected promise for the provided reason.
1665
+ * @param reason The reason the promise was rejected.
1666
+ * @returns A new rejected Promise.
1667
+ */
1668
+ reject(reason: any): SynchronousPromise<void>;
1669
+
1670
+ /**
1671
+ * Creates a new rejected promise for the provided reason.
1672
+ * @param reason The reason the promise was rejected.
1673
+ * @returns A new rejected Promise.
1674
+ */
1675
+ reject<T>(reason: any): SynchronousPromise<T>;
1676
+
1677
+ /**
1678
+ * Creates a new resolved promise for the provided value.
1679
+ * @param value A promise.
1680
+ * @returns A promise whose internal state matches the provided promise.
1681
+ */
1682
+ resolve<T>(value: T | PromiseLike<T>): SynchronousPromise<T>;
1683
+
1684
+ /**
1685
+ * Creates a new resolved promise .
1686
+ * @returns A resolved promise.
1687
+ */
1688
+ resolve(): SynchronousPromise<void>;
1689
+
1690
+ /**
1691
+ * Creates a new unresolved promise with the `resolve` and `reject` methods exposed
1692
+ * @returns An unresolved promise with the `resolve` and `reject` methods exposed
1693
+ */
1694
+ unresolved<T>(): UnresolvedSynchronousPromise<T>;
1695
+
1696
+
1697
+ /**
1698
+ * Installs SynchronousPromise as the global Promise implementation.
1699
+ * When running from within typescript, you will need to use this to
1700
+ * patch the generated __awaiter to ensure it gets a _real_ Promise implementation
1701
+ * (see https://github.com/Microsoft/TypeScript/issues/19909).
1702
+ *
1703
+ * Use the following code:
1704
+ * declare var __awaiter: Function;
1705
+ * __awaiter = SynchronousPromise.installGlobally();
1706
+ *
1707
+ * This is non-destructive to the __awaiter: it simply wraps it in a closure
1708
+ * where the real implementation of Promise has already been captured.
1709
+ */
1710
+ installGlobally(__awaiter: Function): Function;
1711
+
1712
+ /*
1713
+ * Uninstalls SynchronousPromise as the global Promise implementation,
1714
+ * if it is already installed.
1715
+ */
1716
+ uninstallGlobally(): void;
1717
+ }
1718
+
1719
+ /**
1720
+ * Interface type only exposed when using the static unresolved() convenience method
1721
+ */
1722
+ interface UnresolvedSynchronousPromise<T> extends SynchronousPromise<T> {
1723
+ resolve<T>(data: T): void;
1724
+ resolve(): void;
1725
+ reject<T>(data: T): void;
1726
+ }interface SynchronousPromise<T> extends Promise<T> {
1727
+ pause: () => SynchronousPromise<T>
1728
+ resume: () => SynchronousPromise<T>
1729
+ }
1730
+
1731
+ declare var SynchronousPromise: SynchronousPromiseConstructor;
1732
+
1733
+ declare type Store_ModuleExport = any;
1734
+ declare type Store_ModuleExports = Record<string, Store_ModuleExport>;
1735
+ declare type Store_PromiseLike<T> = Promise<T> | SynchronousPromise<T>;
1736
+ declare type Store_ModuleImportFn = (path: Path) => Store_PromiseLike<Store_ModuleExports>;
1737
+ declare type Store_MaybePromise<T> = Promise<T> | T;
1738
+ declare type Store_TeardownRenderToDOM = () => Store_MaybePromise<void>;
1739
+ declare type Store_RenderToDOM<TFramework extends AnyFramework> = (context: Store_RenderContext<TFramework>, element: Element) => Store_MaybePromise<void | Store_TeardownRenderToDOM>;
1740
+ declare type Store_WebProjectAnnotations<TFramework extends AnyFramework> = ProjectAnnotations<TFramework> & {
1741
+ renderToDOM?: Store_RenderToDOM<TFramework>;
1742
+ };
1743
+ declare type Store_NormalizedProjectAnnotations<TFramework extends AnyFramework = AnyFramework> = ProjectAnnotations<TFramework> & {
1744
+ argTypes?: StrictArgTypes;
1745
+ globalTypes?: StrictGlobalTypes;
1746
+ };
1747
+ declare type Store_NormalizedComponentAnnotations<TFramework extends AnyFramework = AnyFramework> = ComponentAnnotations<TFramework> & {
1748
+ id: ComponentId;
1749
+ title: ComponentTitle;
1750
+ argTypes?: StrictArgTypes;
1751
+ };
1752
+ declare type Store_NormalizedStoryAnnotations<TFramework extends AnyFramework = AnyFramework> = Omit<StoryAnnotations<TFramework>, 'storyName' | 'story'> & {
1753
+ moduleExport: Store_ModuleExport;
1754
+ id: StoryId;
1755
+ argTypes?: StrictArgTypes;
1756
+ name: StoryName;
1757
+ userStoryFn?: StoryFn<TFramework>;
1758
+ };
1759
+ declare type Store_CSFFile<TFramework extends AnyFramework = AnyFramework> = {
1760
+ meta: Store_NormalizedComponentAnnotations<TFramework>;
1761
+ stories: Record<StoryId, Store_NormalizedStoryAnnotations<TFramework>>;
1762
+ };
1763
+ declare type Store_Story<TFramework extends AnyFramework = AnyFramework> = StoryContextForEnhancers<TFramework> & {
1764
+ moduleExport: Store_ModuleExport;
1765
+ originalStoryFn: StoryFn<TFramework>;
1766
+ undecoratedStoryFn: LegacyStoryFn<TFramework>;
1767
+ unboundStoryFn: LegacyStoryFn<TFramework>;
1768
+ applyLoaders: (context: StoryContextForLoaders<TFramework>) => Promise<StoryContextForLoaders<TFramework> & {
1769
+ loaded: StoryContext<TFramework>['loaded'];
1770
+ }>;
1771
+ playFunction?: (context: StoryContext<TFramework>) => Promise<void> | void;
1772
+ };
1773
+ declare type Store_BoundStory<TFramework extends AnyFramework = AnyFramework> = Store_Story<TFramework> & {
1774
+ storyFn: PartialStoryFn<TFramework>;
1775
+ };
1776
+ declare type Store_RenderContext<TFramework extends AnyFramework = AnyFramework> = StoryIdentifier & {
1777
+ showMain: () => void;
1778
+ showError: (error: {
1779
+ title: string;
1780
+ description: string;
1781
+ }) => void;
1782
+ showException: (err: Error) => void;
1783
+ forceRemount: boolean;
1784
+ storyContext: StoryContext<TFramework>;
1785
+ storyFn: PartialStoryFn<TFramework>;
1786
+ unboundStoryFn: LegacyStoryFn<TFramework>;
1787
+ };
1788
+ interface Store_V2CompatIndexEntry extends Omit<Addon_StoryIndexEntry, 'type'> {
1789
+ kind: Addon_StoryIndexEntry['title'];
1790
+ story: Addon_StoryIndexEntry['name'];
1791
+ parameters: Parameters;
1792
+ }
1793
+ interface Store_StoryIndexV3 {
1794
+ v: number;
1795
+ stories: Record<StoryId, Store_V2CompatIndexEntry>;
1796
+ }
1797
+ interface Store_StoryIndex {
1798
+ v: number;
1799
+ entries: Record<StoryId, Addon_IndexEntry>;
1800
+ }
1801
+ declare type Store_StorySpecifier = StoryId | {
1802
+ name: StoryName;
1803
+ title: ComponentTitle;
1804
+ } | '*';
1805
+ interface Store_SelectionSpecifier {
1806
+ storySpecifier: Store_StorySpecifier;
1807
+ viewMode: ViewMode;
1808
+ args?: Args;
1809
+ globals?: Args;
1810
+ }
1811
+ interface Store_Selection {
1812
+ storyId: StoryId;
1813
+ viewMode: ViewMode;
1814
+ }
1815
+ declare type Store_DecoratorApplicator<TFramework extends AnyFramework = AnyFramework> = (storyFn: LegacyStoryFn<TFramework>, decorators: DecoratorFunction<TFramework>[]) => LegacyStoryFn<TFramework>;
1816
+ interface Store_StoriesSpecifier {
1817
+ directory: string;
1818
+ titlePrefix?: string;
1819
+ }
1820
+ interface Store_NormalizedStoriesSpecifier {
1821
+ glob?: string;
1822
+ specifier?: Store_StoriesSpecifier;
1823
+ }
1824
+ declare type Store_ExtractOptions = {
1825
+ includeDocsOnly?: boolean;
1826
+ };
1827
+ interface Store_NormalizedStoriesSpecifierEntry {
1828
+ titlePrefix?: string;
1829
+ directory: string;
1830
+ files?: string;
1831
+ importPathMatcher: RegExp;
1832
+ }
1833
+ declare type Store_ContextStore<TFramework extends AnyFramework> = {
1834
+ value?: StoryContext<TFramework>;
1835
+ };
1836
+ declare type Store_PropDescriptor = string[] | RegExp;
1837
+ declare type Store_CSFExports<TFramework extends AnyFramework = AnyFramework> = {
1838
+ default: ComponentAnnotations<TFramework, Args>;
1839
+ __esModule?: boolean;
1840
+ __namedExportsOrder?: string[];
1841
+ };
1842
+ declare type Store_ComposedStoryPlayContext = Partial<StoryContext> & Pick<StoryContext, 'canvasElement'>;
1843
+ declare type Store_ComposedStoryPlayFn = (context: Store_ComposedStoryPlayContext) => Promise<void> | void;
1844
+ declare type Store_StoryFn<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = AnnotatedStoryFn<TFramework, TArgs> & {
1845
+ play: Store_ComposedStoryPlayFn;
1846
+ };
1847
+ declare type Store_ComposedStory<TFramework extends AnyFramework = AnyFramework, TArgs = Args> = StoryFn<TFramework, TArgs> | StoryAnnotations<TFramework, TArgs>;
1848
+ /**
1849
+ * T represents the whole ES module of a stories file. K of T means named exports (basically the Story type)
1850
+ * 1. pick the keys K of T that have properties that are Story<AnyProps>
1851
+ * 2. infer the actual prop type for each Story
1852
+ * 3. reconstruct Story with Partial. Story<Props> -> Story<Partial<Props>>
1853
+ */
1854
+ declare type Store_StoriesWithPartialProps<TFramework extends AnyFramework, TModule> = {
1855
+ [K in keyof TModule]: TModule[K] extends Store_ComposedStory<infer _, infer TProps> ? AnnotatedStoryFn<TFramework, Partial<TProps>> : unknown;
1856
+ };
1857
+ declare type Store_ControlsMatchers = {
1858
+ date: RegExp;
1859
+ color: RegExp;
1860
+ };
1861
+ interface Store_ComposeStory<TFramework extends AnyFramework = AnyFramework, TArgs extends Args = Args> {
1862
+ (storyAnnotations: AnnotatedStoryFn<TFramework, TArgs> | StoryAnnotations<TFramework, TArgs>, componentAnnotations: ComponentAnnotations<TFramework, TArgs>, projectAnnotations: ProjectAnnotations<TFramework>, exportsName?: string): {
1863
+ (extraArgs: Partial<TArgs>): TFramework['storyResult'];
1864
+ storyName: string;
1865
+ args: Args;
1866
+ play: Store_ComposedStoryPlayFn;
1867
+ parameters: Parameters;
1868
+ };
1869
+ }
1870
+
1871
+ interface ClientAPI_ErrorLike {
1872
+ message: string;
1873
+ stack: string;
1874
+ }
1875
+ interface ClientAPI_StoryMetadata {
1876
+ parameters?: Parameters;
1877
+ decorators?: DecoratorFunction[];
1878
+ loaders?: LoaderFunction[];
1879
+ }
1880
+ declare type ClientAPI_ArgTypesEnhancer = (context: StoryContext) => ArgTypes;
1881
+ declare type ClientAPI_ArgsEnhancer = (context: StoryContext) => Args;
1882
+ declare type StorySpecifier = StoryId | {
1883
+ name: StoryName;
1884
+ kind: StoryKind;
1885
+ } | '*';
1886
+ interface ClientAPI_StoreSelectionSpecifier {
1887
+ storySpecifier: StorySpecifier;
1888
+ viewMode: ViewMode;
1889
+ singleStory?: boolean;
1890
+ args?: Args;
1891
+ globals?: Args;
1892
+ }
1893
+ interface ClientAPI_StoreSelection {
1894
+ storyId: StoryId;
1895
+ viewMode: ViewMode;
1896
+ }
1897
+ declare type ClientAPI_AddStoryArgs = StoryIdentifier & {
1898
+ storyFn: StoryFn<any>;
1899
+ parameters?: Parameters;
1900
+ decorators?: DecoratorFunction[];
1901
+ loaders?: LoaderFunction[];
1902
+ };
1903
+ declare type ClientAPI_ClientApiReturnFn<StoryFnReturnType> = (...args: any[]) => Addon_StoryApi<StoryFnReturnType>;
1904
+ interface ClientAPI_ClientApiAddon<StoryFnReturnType = unknown> extends Addon_Type {
1905
+ apply: (a: Addon_StoryApi<StoryFnReturnType>, b: any[]) => any;
1906
+ }
1907
+ interface ClientAPI_ClientApiAddons<StoryFnReturnType> {
1908
+ [key: string]: ClientAPI_ClientApiAddon<StoryFnReturnType>;
1909
+ }
1910
+ declare type ClientAPI_RenderContextWithoutStoryContext = Omit<Store_RenderContext, 'storyContext'>;
1911
+ interface ClientAPI_GetStorybookStory<TFramework extends AnyFramework> {
1912
+ name: string;
1913
+ render: LegacyStoryFn<TFramework>;
1914
+ }
1915
+ interface ClientAPI_GetStorybookKind<TFramework extends AnyFramework> {
1916
+ kind: string;
1917
+ fileName: string;
1918
+ stories: ClientAPI_GetStorybookStory<TFramework>[];
1919
+ }
1920
+
1921
+ interface CoreClient_PreviewError {
1922
+ message?: string;
1923
+ stack?: string;
1924
+ }
1925
+ interface CoreClient_RequireContext {
1926
+ keys: () => string[];
1927
+ (id: string): any;
1928
+ resolve(id: string): string;
1929
+ }
1930
+ declare type CoreClient_LoaderFunction = () => void | any[];
1931
+ declare type Loadable = CoreClient_RequireContext | CoreClient_RequireContext[] | CoreClient_LoaderFunction;
1932
+
1933
+ declare type CoreClient_RenderStoryFunction = (context: Store_RenderContext) => void;
1934
+
1935
+ interface Options$1 {
1936
+ allowRegExp: boolean;
1937
+ allowFunction: boolean;
1938
+ allowSymbol: boolean;
1939
+ allowDate: boolean;
1940
+ allowUndefined: boolean;
1941
+ allowClass: boolean;
1942
+ maxDepth: number;
1943
+ space: number | undefined;
1944
+ lazyEval: boolean;
1945
+ }
1946
+
1947
+ /**
1948
+ * ⚠️ This file contains internal WIP types they MUST NOT be exported outside this package for now!
1949
+ */
1950
+ declare type BuilderName = 'webpack5' | '@storybook/builder-webpack5' | string;
1951
+ declare type RendererName = string;
1952
+ interface CoreConfig {
1953
+ builder?: BuilderName | {
1954
+ name: BuilderName;
1955
+ options?: Record<string, any>;
1956
+ };
1957
+ renderer?: RendererName;
1958
+ disableWebpackDefaults?: boolean;
1959
+ channelOptions?: Partial<Options$1>;
1960
+ /**
1961
+ * Disables the generation of project.json, a file containing Storybook metadata
1962
+ */
1963
+ disableProjectJson?: boolean;
1964
+ /**
1965
+ * Disables Storybook telemetry
1966
+ * @see https://storybook.js.org/telemetry
1967
+ */
1968
+ disableTelemetry?: boolean;
1969
+ /**
1970
+ * Enable crash reports to be sent to Storybook telemetry
1971
+ * @see https://storybook.js.org/telemetry
1972
+ */
1973
+ enableCrashReports?: boolean;
1974
+ /**
1975
+ * enable CORS headings to run document in a "secure context"
1976
+ * see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements
1977
+ * This enables these headers in development-mode:
1978
+ * Cross-Origin-Opener-Policy: same-origin
1979
+ * Cross-Origin-Embedder-Policy: require-corp
1980
+ */
1981
+ crossOriginIsolated?: boolean;
1982
+ }
1983
+ interface DirectoryMapping {
1984
+ from: string;
1985
+ to: string;
1986
+ }
1987
+ interface Presets {
1988
+ apply(extension: 'typescript', config: TypescriptOptions, args?: Options): Promise<TypescriptOptions>;
1989
+ apply(extension: 'framework', config?: {}, args?: any): Promise<Preset>;
1990
+ apply(extension: 'babel', config?: {}, args?: any): Promise<TransformOptions>;
1991
+ apply(extension: 'entries', config?: [], args?: any): Promise<unknown>;
1992
+ apply(extension: 'stories', config?: [], args?: any): Promise<CoreCommon_StoriesEntry[]>;
1993
+ apply(extension: 'managerEntries', config: [], args?: any): Promise<string[]>;
1994
+ apply(extension: 'refs', config?: [], args?: any): Promise<unknown>;
1995
+ apply(extension: 'core', config?: {}, args?: any): Promise<CoreConfig>;
1996
+ apply<T>(extension: string, config?: T, args?: unknown): Promise<T>;
1997
+ }
1998
+ interface LoadedPreset {
1999
+ name: string;
2000
+ preset: any;
2001
+ options: any;
2002
+ }
2003
+ declare type PresetConfig = string | {
2004
+ name: string;
2005
+ options?: unknown;
2006
+ };
2007
+ interface Ref {
2008
+ id: string;
2009
+ url: string;
2010
+ title: string;
2011
+ version: string;
2012
+ type?: string;
2013
+ disable?: boolean;
2014
+ }
2015
+ interface VersionCheck {
2016
+ success: boolean;
2017
+ data?: any;
2018
+ error?: any;
2019
+ time: number;
2020
+ }
2021
+ interface ReleaseNotesData {
2022
+ success: boolean;
2023
+ currentVersion: string;
2024
+ showOnFirstLaunch: boolean;
2025
+ }
2026
+ interface Stats {
2027
+ toJson: () => any;
2028
+ }
2029
+ interface BuilderResult {
2030
+ totalTime?: ReturnType<typeof process.hrtime>;
2031
+ stats?: Stats;
2032
+ }
2033
+ declare type PackageJson = PackageJson$1 & Record<string, any>;
2034
+ interface LoadOptions {
2035
+ packageJson: PackageJson;
2036
+ outputDir?: string;
2037
+ configDir?: string;
2038
+ ignorePreview?: boolean;
2039
+ extendServer?: (server: Server) => void;
2040
+ }
2041
+ interface CLIOptions {
2042
+ port?: number;
2043
+ ignorePreview?: boolean;
2044
+ previewUrl?: string;
2045
+ forceBuildPreview?: boolean;
2046
+ disableTelemetry?: boolean;
2047
+ enableCrashReports?: boolean;
2048
+ host?: string;
2049
+ /**
2050
+ * @deprecated Use 'staticDirs' Storybook Configuration option instead
2051
+ */
2052
+ staticDir?: string[];
2053
+ configDir?: string;
2054
+ https?: boolean;
2055
+ sslCa?: string[];
2056
+ sslCert?: string;
2057
+ sslKey?: string;
2058
+ smokeTest?: boolean;
2059
+ managerCache?: boolean;
2060
+ open?: boolean;
2061
+ ci?: boolean;
2062
+ loglevel?: string;
2063
+ quiet?: boolean;
2064
+ versionUpdates?: boolean;
2065
+ releaseNotes?: boolean;
2066
+ dll?: boolean;
2067
+ docs?: boolean;
2068
+ docsDll?: boolean;
2069
+ uiDll?: boolean;
2070
+ debugWebpack?: boolean;
2071
+ webpackStatsJson?: string | boolean;
2072
+ outputDir?: string;
2073
+ }
2074
+ interface BuilderOptions {
2075
+ configType?: 'DEVELOPMENT' | 'PRODUCTION';
2076
+ ignorePreview: boolean;
2077
+ cache: FileSystemCache;
2078
+ configDir: string;
2079
+ docsMode: boolean;
2080
+ features?: StorybookConfig['features'];
2081
+ versionCheck?: VersionCheck;
2082
+ releaseNotesData?: ReleaseNotesData;
2083
+ disableWebpackDefaults?: boolean;
2084
+ serverChannelUrl?: string;
2085
+ }
2086
+ interface StorybookConfigOptions {
2087
+ presets: Presets;
2088
+ presetsList?: LoadedPreset[];
2089
+ }
2090
+ declare type Options = LoadOptions & StorybookConfigOptions & CLIOptions & BuilderOptions;
2091
+ interface Builder<Config, BuilderStats extends Stats = Stats> {
2092
+ getConfig: (options: Options) => Promise<Config>;
2093
+ start: (args: {
2094
+ options: Options;
2095
+ startTime: ReturnType<typeof process.hrtime>;
2096
+ router: Router;
2097
+ server: Server;
2098
+ }) => Promise<void | {
2099
+ stats?: BuilderStats;
2100
+ totalTime: ReturnType<typeof process.hrtime>;
2101
+ bail: (e?: Error) => Promise<void>;
2102
+ }>;
2103
+ build: (arg: {
2104
+ options: Options;
2105
+ startTime: ReturnType<typeof process.hrtime>;
2106
+ }) => Promise<void | BuilderStats>;
2107
+ bail: (e?: Error) => Promise<void>;
2108
+ corePresets?: string[];
2109
+ overridePresets?: string[];
2110
+ }
2111
+ interface CoreCommon_IndexerOptions {
2112
+ makeTitle: (userTitle?: string) => string;
2113
+ }
2114
+ interface CoreCommon_IndexedStory {
2115
+ id: string;
2116
+ name: string;
2117
+ tags?: Tag[];
2118
+ parameters?: Parameters;
2119
+ }
2120
+ interface CoreCommon_StoryIndex {
2121
+ meta: {
2122
+ title?: string;
2123
+ tags?: Tag[];
2124
+ };
2125
+ stories: CoreCommon_IndexedStory[];
2126
+ }
2127
+ interface CoreCommon_StoryIndexer {
2128
+ test: RegExp;
2129
+ indexer: (fileName: string, options: CoreCommon_IndexerOptions) => Promise<CoreCommon_StoryIndex>;
2130
+ addDocsTemplate?: boolean;
2131
+ }
2132
+ /**
2133
+ * Options for TypeScript usage within Storybook.
2134
+ */
2135
+ interface TypescriptOptions {
2136
+ /**
2137
+ * Enables type checking within Storybook.
2138
+ *
2139
+ * @default `false`
2140
+ */
2141
+ check: boolean;
2142
+ /**
2143
+ * Disable parsing typescript files through babel.
2144
+ *
2145
+ * @default `false`
2146
+ */
2147
+ skipBabel: boolean;
2148
+ }
2149
+ interface CoreCommon_StoriesSpecifier {
2150
+ /**
2151
+ * When auto-titling, what to prefix all generated titles with (default: '')
2152
+ */
2153
+ titlePrefix?: string;
2154
+ /**
2155
+ * Where to start looking for story files
2156
+ */
2157
+ directory: string;
2158
+ /**
2159
+ * What does the filename of a story file look like?
2160
+ * (a glob, relative to directory, no leading `./`)
2161
+ * If unset, we use `** / *.stories.@(mdx|tsx|ts|jsx|js)` (no spaces)
2162
+ */
2163
+ files?: string;
2164
+ }
2165
+ declare type CoreCommon_StoriesEntry = string | CoreCommon_StoriesSpecifier;
2166
+ declare type CoreCommon_NormalizedStoriesSpecifier = Required<CoreCommon_StoriesSpecifier> & {
2167
+ importPathMatcher: RegExp;
2168
+ };
2169
+ declare type Preset = string | {
2170
+ name: string;
2171
+ options?: any;
2172
+ };
2173
+ /**
2174
+ * An additional script that gets injected into the
2175
+ * preview or the manager,
2176
+ */
2177
+ declare type Entry = string;
2178
+ declare type CoreCommon_StorybookRefs = Record<string, {
2179
+ title: string;
2180
+ url: string;
2181
+ } | {
2182
+ disable: boolean;
2183
+ }>;
2184
+ declare type DocsOptions = {
2185
+ /**
2186
+ * Should we generate docs entries at all under any circumstances? (i.e. can they be rendered)
2187
+ */
2188
+ enabled?: boolean;
2189
+ /**
2190
+ * What should we call the generated docs entries?
2191
+ */
2192
+ defaultName?: string;
2193
+ /**
2194
+ * Should we generate a docs entry per CSF file?
2195
+ */
2196
+ docsPage?: boolean;
2197
+ /**
2198
+ * Only show doc entries in the side bar (usually set with the `--docs` CLI flag)
2199
+ */
2200
+ docsMode?: boolean;
2201
+ };
2202
+ /**
2203
+ * The interface for Storybook configuration in `main.ts` files.
2204
+ */
2205
+ interface StorybookConfig {
2206
+ /**
2207
+ * Sets the addons you want to use with Storybook.
2208
+ *
2209
+ * @example `['@storybook/addon-essentials']` or `[{ name: '@storybook/addon-essentials', options: { backgrounds: false } }]`
2210
+ */
2211
+ addons?: Preset[];
2212
+ core?: CoreConfig;
2213
+ /**
2214
+ * Sets a list of directories of static files to be loaded by Storybook server
2215
+ *
2216
+ * @example `['./public']` or `[{from: './public', 'to': '/assets'}]`
2217
+ */
2218
+ staticDirs?: (DirectoryMapping | string)[];
2219
+ logLevel?: string;
2220
+ features?: {
2221
+ /**
2222
+ * Allows to disable deprecated implicit PostCSS loader. (will be removed in 7.0)
2223
+ */
2224
+ postcss?: boolean;
2225
+ /**
2226
+ * Build stories.json automatically on start/build
2227
+ */
2228
+ buildStoriesJson?: boolean;
2229
+ /**
2230
+ * Activate preview of CSF v3.0
2231
+ *
2232
+ * @deprecated This is always on now from 6.4 regardless of the setting
2233
+ */
2234
+ previewCsfV3?: boolean;
2235
+ /**
2236
+ * Activate on demand story store
2237
+ */
2238
+ storyStoreV7?: boolean;
2239
+ /**
2240
+ * Enable a set of planned breaking changes for SB7.0
2241
+ */
2242
+ breakingChangesV7?: boolean;
2243
+ /**
2244
+ * Enable the step debugger functionality in Addon-interactions.
2245
+ */
2246
+ interactionsDebugger?: boolean;
2247
+ /**
2248
+ * Use Storybook 7.0 babel config scheme
2249
+ */
2250
+ babelModeV7?: boolean;
2251
+ /**
2252
+ * Filter args with a "target" on the type from the render function (EXPERIMENTAL)
2253
+ */
2254
+ argTypeTargetsV7?: boolean;
2255
+ /**
2256
+ * Warn when there is a pre-6.0 hierarchy separator ('.' / '|') in the story title.
2257
+ * Will be removed in 7.0.
2258
+ */
2259
+ warnOnLegacyHierarchySeparator?: boolean;
2260
+ };
2261
+ /**
2262
+ * Tells Storybook where to find stories.
2263
+ *
2264
+ * @example `['./src/*.stories.@(j|t)sx?']`
2265
+ */
2266
+ stories: CoreCommon_StoriesEntry[];
2267
+ /**
2268
+ * Framework, e.g. '@storybook/react', required in v7
2269
+ */
2270
+ framework?: Preset;
2271
+ /**
2272
+ * Controls how Storybook handles TypeScript files.
2273
+ */
2274
+ typescript?: Partial<TypescriptOptions>;
2275
+ /**
2276
+ * References external Storybooks
2277
+ */
2278
+ refs?: CoreCommon_StorybookRefs | ((config: any, options: Options) => CoreCommon_StorybookRefs);
2279
+ /**
2280
+ * Modify or return babel config.
2281
+ */
2282
+ babel?: (config: TransformOptions, options: Options) => TransformOptions | Promise<TransformOptions>;
2283
+ /**
2284
+ * Modify or return babel config.
2285
+ */
2286
+ babelDefault?: (config: TransformOptions, options: Options) => TransformOptions | Promise<TransformOptions>;
2287
+ /**
2288
+ * Add additional scripts to run in the preview a la `.storybook/preview.js`
2289
+ *
2290
+ * @deprecated use `previewAnnotations` or `/preview.js` file instead
2291
+ */
2292
+ config?: (entries: Entry[], options: Options) => Entry[];
2293
+ /**
2294
+ * Add additional scripts to run in the preview a la `.storybook/preview.js`
2295
+ */
2296
+ previewAnnotations?: (entries: Entry[], options: Options) => Entry[];
2297
+ /**
2298
+ * Process CSF files for the story index.
2299
+ */
2300
+ storyIndexers?: (indexers: CoreCommon_StoryIndexer[], options: Options) => CoreCommon_StoryIndexer[];
2301
+ /**
2302
+ * Docs related features in index generation
2303
+ */
2304
+ docs?: DocsOptions;
2305
+ /**
2306
+ * Programmatically modify the preview head/body HTML.
2307
+ * The previewHead and previewBody functions accept a string,
2308
+ * which is the existing head/body, and return a modified string.
2309
+ */
2310
+ previewHead?: (head: string, options: Options) => string;
2311
+ previewBody?: (body: string, options: Options) => string;
2312
+ }
2313
+ declare type PresetProperty<K, TStorybookConfig = StorybookConfig> = TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | PresetPropertyFn<K, TStorybookConfig>;
2314
+ declare type PresetPropertyFn<K, TStorybookConfig = StorybookConfig, TOptions = {}> = (config: TStorybookConfig[K extends keyof TStorybookConfig ? K : never], options: Options & TOptions) => TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | Promise<TStorybookConfig[K extends keyof TStorybookConfig ? K : never]>;
2315
+ interface CoreCommon_ResolvedAddonPreset {
2316
+ type: 'presets';
2317
+ name: string;
2318
+ }
2319
+ interface CoreCommon_ResolvedAddonVirtual {
2320
+ type: 'virtual';
2321
+ name: string;
2322
+ managerEntries?: string[];
2323
+ previewAnnotations?: string[];
2324
+ presets?: (string | {
2325
+ name: string;
2326
+ options?: any;
2327
+ })[];
2328
+ }
2329
+ declare type CoreCommon_OptionsEntry = {
2330
+ name: string;
2331
+ };
2332
+ declare type CoreCommon_AddonEntry = string | CoreCommon_OptionsEntry;
2333
+ declare type CoreCommon_AddonInfo = {
2334
+ name: string;
2335
+ inEssentials: boolean;
2336
+ };
2337
+ interface CoreCommon_StorybookInfo {
2338
+ version: string;
2339
+ framework: string;
2340
+ frameworkPackage: string;
2341
+ renderer: string;
2342
+ rendererPackage: string;
2343
+ configDir?: string;
2344
+ mainConfig?: string;
2345
+ previewConfig?: string;
2346
+ managerConfig?: string;
2347
+ }
2348
+
2349
+ interface BuilderStats {
2350
+ toJson: () => any;
2351
+ }
2352
+ declare type Builder_WithRequiredProperty<Type, Key extends keyof Type> = Type & {
2353
+ [Property in Key]-?: Type[Property];
2354
+ };
2355
+ declare type Builder_Unpromise<T extends Promise<any>> = T extends Promise<infer U> ? U : never;
2356
+ declare type Builder_EnvsRaw = Record<string, string>;
2357
+
2358
+ declare type ChannelHandler = (event: ChannelEvent) => void;
2359
+ interface ChannelTransport {
2360
+ send(event: ChannelEvent, options?: any): void;
2361
+ setHandler(handler: ChannelHandler): void;
2362
+ }
2363
+ interface ChannelEvent {
2364
+ type: string;
2365
+ from: string;
2366
+ args: any[];
2367
+ }
2368
+ interface Listener {
2369
+ (...args: any[]): void;
2370
+ }
2371
+ interface ChannelArgs {
2372
+ transport?: ChannelTransport;
2373
+ async?: boolean;
2374
+ }
2375
+ declare class Channel {
2376
+ readonly isAsync: boolean;
2377
+ private sender;
2378
+ private events;
2379
+ private data;
2380
+ private readonly transport;
2381
+ constructor({ transport, async }?: ChannelArgs);
2382
+ get hasTransport(): boolean;
2383
+ addListener(eventName: string, listener: Listener): void;
2384
+ emit(eventName: string, ...args: any): void;
2385
+ last(eventName: string): any;
2386
+ eventNames(): string[];
2387
+ listenerCount(eventName: string): number;
2388
+ listeners(eventName: string): Listener[] | undefined;
2389
+ once(eventName: string, listener: Listener): void;
2390
+ removeAllListeners(eventName?: string): void;
2391
+ removeListener(eventName: string, listener: Listener): void;
2392
+ on(eventName: string, listener: Listener): void;
2393
+ off(eventName: string, listener: Listener): void;
2394
+ private handleEvent;
2395
+ private onceListener;
2396
+ }
2397
+
2398
+ interface API_BaseEntry {
2399
+ id: StoryId;
2400
+ depth: number;
2401
+ name: string;
2402
+ refId?: string;
2403
+ renderLabel?: (item: API_BaseEntry) => any;
2404
+ /** @deprecated */
2405
+ isRoot: boolean;
2406
+ /** @deprecated */
2407
+ isComponent: boolean;
2408
+ /** @deprecated */
2409
+ isLeaf: boolean;
2410
+ }
2411
+ interface API_RootEntry extends API_BaseEntry {
2412
+ type: 'root';
2413
+ startCollapsed?: boolean;
2414
+ children: StoryId[];
2415
+ /** @deprecated */
2416
+ isRoot: true;
2417
+ /** @deprecated */
2418
+ isComponent: false;
2419
+ /** @deprecated */
2420
+ isLeaf: false;
2421
+ }
2422
+ interface API_GroupEntry extends API_BaseEntry {
2423
+ type: 'group';
2424
+ parent?: StoryId;
2425
+ children: StoryId[];
2426
+ /** @deprecated */
2427
+ isRoot: false;
2428
+ /** @deprecated */
2429
+ isComponent: false;
2430
+ /** @deprecated */
2431
+ isLeaf: false;
2432
+ }
2433
+ interface API_ComponentEntry extends API_BaseEntry {
2434
+ type: 'component';
2435
+ parent?: StoryId;
2436
+ children: StoryId[];
2437
+ /** @deprecated */
2438
+ isRoot: false;
2439
+ /** @deprecated */
2440
+ isComponent: true;
2441
+ /** @deprecated */
2442
+ isLeaf: false;
2443
+ }
2444
+ interface API_DocsEntry extends API_BaseEntry {
2445
+ type: 'docs';
2446
+ parent: StoryId;
2447
+ title: ComponentTitle;
2448
+ /** @deprecated */
2449
+ kind: ComponentTitle;
2450
+ importPath: Path;
2451
+ /** @deprecated */
2452
+ isRoot: false;
2453
+ /** @deprecated */
2454
+ isComponent: false;
2455
+ /** @deprecated */
2456
+ isLeaf: true;
2457
+ }
2458
+ interface API_StoryEntry extends API_BaseEntry {
2459
+ type: 'story';
2460
+ parent: StoryId;
2461
+ title: ComponentTitle;
2462
+ /** @deprecated */
2463
+ kind: ComponentTitle;
2464
+ importPath: Path;
2465
+ tags: Tag[];
2466
+ prepared: boolean;
2467
+ parameters?: {
2468
+ [parameterName: string]: any;
2469
+ };
2470
+ args?: Args;
2471
+ argTypes?: ArgTypes;
2472
+ initialArgs?: Args;
2473
+ /** @deprecated */
2474
+ isRoot: false;
2475
+ /** @deprecated */
2476
+ isComponent: false;
2477
+ /** @deprecated */
2478
+ isLeaf: true;
2479
+ }
2480
+ declare type API_LeafEntry = API_DocsEntry | API_StoryEntry;
2481
+ declare type API_HashEntry = API_RootEntry | API_GroupEntry | API_ComponentEntry | API_DocsEntry | API_StoryEntry;
2482
+ /** @deprecated */
2483
+ declare type API_Root = API_RootEntry;
2484
+ /** @deprecated */
2485
+ declare type API_Group = API_GroupEntry | API_ComponentEntry;
2486
+ /** @deprecated */
2487
+ declare type API_Story = API_LeafEntry;
2488
+ /**
2489
+ * The `StoriesHash` is our manager-side representation of the `StoryIndex`.
2490
+ * We create entries in the hash not only for each story or docs entry, but
2491
+ * also for each "group" of the component (split on '/'), as that's how things
2492
+ * are manipulated in the manager (i.e. in the sidebar)
2493
+ */
2494
+ interface API_StoriesHash {
2495
+ [id: string]: API_HashEntry;
2496
+ }
2497
+ interface API_SetStoriesStory {
2498
+ id: StoryId;
2499
+ name: string;
2500
+ refId?: string;
2501
+ componentId?: ComponentId;
2502
+ kind: StoryKind;
2503
+ parameters: {
2504
+ fileName: string;
2505
+ options: {
2506
+ [optionName: string]: any;
2507
+ };
2508
+ docsOnly?: boolean;
2509
+ viewMode?: API_ViewMode;
2510
+ [parameterName: string]: any;
2511
+ };
2512
+ argTypes?: ArgTypes;
2513
+ args?: Args;
2514
+ initialArgs?: Args;
2515
+ }
2516
+ interface API_SetStoriesStoryData {
2517
+ [id: string]: API_SetStoriesStory;
2518
+ }
2519
+ interface API_StoryKey {
2520
+ id: StoryId;
2521
+ refId?: string;
2522
+ }
2523
+ declare type API_SetStoriesPayload = {
2524
+ v: 2;
2525
+ error?: Error;
2526
+ globals: Args;
2527
+ globalParameters: Parameters;
2528
+ stories: API_SetStoriesStoryData;
2529
+ kindParameters: {
2530
+ [kind: string]: Parameters;
2531
+ };
2532
+ } | ({
2533
+ v?: number;
2534
+ stories: API_SetStoriesStoryData;
2535
+ } & Record<string, never>);
2536
+ interface API_BaseIndexEntry {
2537
+ id: StoryId;
2538
+ name: StoryName;
2539
+ title: ComponentTitle;
2540
+ importPath: Path;
2541
+ }
2542
+ declare type API_StoryIndexEntry = API_BaseIndexEntry & {
2543
+ type?: 'story';
2544
+ };
2545
+ interface API_V3IndexEntry extends API_BaseIndexEntry {
2546
+ parameters?: Parameters;
2547
+ }
2548
+ interface API_StoryIndexV3 {
2549
+ v: 3;
2550
+ stories: Record<StoryId, API_V3IndexEntry>;
2551
+ }
2552
+ declare type API_DocsIndexEntry = API_BaseIndexEntry & {
2553
+ storiesImports: Path[];
2554
+ type: 'docs';
2555
+ };
2556
+ declare type API_IndexEntry = API_StoryIndexEntry | API_DocsIndexEntry;
2557
+ interface StoryIndex {
2558
+ v: number;
2559
+ entries: Record<StoryId, API_IndexEntry>;
2560
+ }
2561
+ declare type API_PreparedIndexEntry = API_IndexEntry & {
2562
+ parameters?: Parameters;
2563
+ argTypes?: ArgTypes;
2564
+ args?: Args;
2565
+ initialArgs?: Args;
2566
+ };
2567
+ interface API_PreparedStoryIndex {
2568
+ v: number;
2569
+ entries: Record<StoryId, API_PreparedIndexEntry>;
2570
+ }
2571
+ interface API_StoryIndex {
2572
+ v: number;
2573
+ entries: Record<StoryId, API_IndexEntry>;
2574
+ }
2575
+ declare type API_OptionsData = {
2576
+ docsOptions: DocsOptions;
2577
+ };
2578
+ interface API_Args {
2579
+ [key: string]: any;
2580
+ }
2581
+ interface API_ArgType {
2582
+ name?: string;
2583
+ description?: string;
2584
+ defaultValue?: any;
2585
+ if?: Conditional;
2586
+ [key: string]: any;
2587
+ }
2588
+ interface API_ArgTypes {
2589
+ [key: string]: API_ArgType;
2590
+ }
2591
+ interface API_ReleaseNotes {
2592
+ success?: boolean;
2593
+ currentVersion?: string;
2594
+ showOnFirstLaunch?: boolean;
2595
+ }
2596
+ interface API_Settings {
2597
+ lastTrackedStoryId: string;
2598
+ }
2599
+ interface API_SetGlobalsPayload {
2600
+ globals: Globals;
2601
+ globalTypes: GlobalTypes;
2602
+ }
2603
+ interface API_Version {
2604
+ version: string;
2605
+ info?: {
2606
+ plain: string;
2607
+ };
2608
+ [key: string]: any;
2609
+ }
2610
+ interface API_UnknownEntries {
2611
+ [key: string]: {
2612
+ [key: string]: any;
2613
+ };
2614
+ }
2615
+ interface API_Versions$1 {
2616
+ latest?: API_Version;
2617
+ next?: API_Version;
2618
+ current?: API_Version;
2619
+ }
2620
+
2621
+ declare type API_ViewMode = 'story' | 'info' | 'settings' | 'page' | undefined | string;
2622
+ interface API_RenderOptions {
2623
+ active: boolean;
2624
+ key: string;
2625
+ }
2626
+ interface API_RouteOptions {
2627
+ storyId: string;
2628
+ viewMode: API_ViewMode;
2629
+ location: RenderData['location'];
2630
+ path: string;
2631
+ }
2632
+ interface API_MatchOptions {
2633
+ storyId: string;
2634
+ viewMode: API_ViewMode;
2635
+ location: RenderData['location'];
2636
+ path: string;
2637
+ }
2638
+ interface API_Addon {
2639
+ title: string;
2640
+ type?: Addon_Types;
2641
+ id?: string;
2642
+ route?: (routeOptions: API_RouteOptions) => string;
2643
+ match?: (matchOptions: API_MatchOptions) => boolean;
2644
+ render: (renderOptions: API_RenderOptions) => any;
2645
+ paramKey?: string;
2646
+ disabled?: boolean;
2647
+ hidden?: boolean;
2648
+ }
2649
+ interface API_Collection<T = API_Addon> {
2650
+ [key: string]: T;
2651
+ }
2652
+ declare type API_Panels = API_Collection<API_Addon>;
2653
+ declare type API_StateMerger<S> = (input: S) => S;
2654
+ interface API_ProviderData<API> {
2655
+ provider: API_Provider<API>;
2656
+ docsOptions: DocsOptions;
2657
+ }
2658
+ interface API_Provider<API> {
2659
+ channel?: Channel;
2660
+ serverChannel?: Channel;
2661
+ renderPreview?: API_IframeRenderer;
2662
+ handleAPI(api: API): void;
2663
+ getConfig(): {
2664
+ sidebar?: API_SidebarOptions;
2665
+ theme?: ThemeVars;
2666
+ StoryMapper?: API_StoryMapper;
2667
+ [k: string]: any;
2668
+ } & Partial<API_UIOptions>;
2669
+ [key: string]: any;
2670
+ }
2671
+ declare type API_IframeRenderer = (storyId: string, viewMode: ViewMode, id: string, baseUrl: string, scale: number, queryParams: Record<string, any>) => any;
2672
+ interface API_UIOptions {
2673
+ name?: string;
2674
+ url?: string;
2675
+ goFullScreen: boolean;
2676
+ showStoriesPanel: boolean;
2677
+ showAddonPanel: boolean;
2678
+ addonPanelInRight: boolean;
2679
+ theme?: ThemeVars;
2680
+ selectedPanel?: string;
2681
+ }
2682
+ interface API_Layout {
2683
+ initialActive: API_ActiveTabsType;
2684
+ isFullscreen: boolean;
2685
+ showPanel: boolean;
2686
+ panelPosition: API_PanelPositions;
2687
+ showNav: boolean;
2688
+ showTabs: boolean;
2689
+ showToolbar: boolean;
2690
+ /**
2691
+ * @deprecated
2692
+ */
2693
+ isToolshown?: boolean;
2694
+ }
2695
+ interface API_UI {
2696
+ name?: string;
2697
+ url?: string;
2698
+ enableShortcuts: boolean;
2699
+ }
2700
+ declare type API_PanelPositions = 'bottom' | 'right';
2701
+ declare type API_ActiveTabsType = 'sidebar' | 'canvas' | 'addons';
2702
+ interface API_SidebarOptions {
2703
+ showRoots?: boolean;
2704
+ collapsedRoots?: string[];
2705
+ renderLabel?: (item: API_HashEntry) => any;
2706
+ }
2707
+ interface API_Notification {
2708
+ id: string;
2709
+ link: string;
2710
+ content: {
2711
+ headline: string;
2712
+ subHeadline?: string | any;
2713
+ };
2714
+ icon?: {
2715
+ name: string;
2716
+ color?: string;
2717
+ };
2718
+ onClear?: () => void;
2719
+ }
2720
+ declare type API_Versions = Record<string, string>;
2721
+ declare type API_SetRefData = Partial<API_ComposedRef & {
2722
+ setStoriesData: API_SetStoriesStoryData;
2723
+ storyIndex: API_StoryIndex;
2724
+ }>;
2725
+ declare type API_StoryMapper = (ref: API_ComposedRef, story: API_SetStoriesStory) => API_SetStoriesStory;
2726
+ interface API_ComposedRef {
2727
+ id: string;
2728
+ title?: string;
2729
+ url: string;
2730
+ type?: 'auto-inject' | 'unknown' | 'lazy' | 'server-checked';
2731
+ expanded?: boolean;
2732
+ stories: API_StoriesHash;
2733
+ versions?: API_Versions;
2734
+ loginUrl?: string;
2735
+ version?: string;
2736
+ ready?: boolean;
2737
+ error?: any;
2738
+ }
2739
+ declare type API_ComposedRefUpdate = Partial<Pick<API_ComposedRef, 'title' | 'type' | 'expanded' | 'stories' | 'versions' | 'loginUrl' | 'version' | 'ready' | 'error'>>;
2740
+ declare type API_Refs = Record<string, API_ComposedRef>;
2741
+ declare type API_RefId = string;
2742
+ declare type API_RefUrl = string;
2743
+
2744
+ export { API_ActiveTabsType, API_Addon, API_ArgType, API_ArgTypes, API_Args, API_BaseEntry, API_Collection, API_ComponentEntry, API_ComposedRef, API_ComposedRefUpdate, API_DocsEntry, API_DocsIndexEntry, API_Group, API_GroupEntry, API_HashEntry, API_IframeRenderer, API_IndexEntry, API_Layout, API_LeafEntry, 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_SetGlobalsPayload, API_SetRefData, API_SetStoriesPayload, API_SetStoriesStory, API_SetStoriesStoryData, API_Settings, API_SidebarOptions, API_StateMerger, API_StoriesHash, API_Story, API_StoryEntry, API_StoryIndex, API_StoryIndexEntry, API_StoryIndexV3, API_StoryKey, 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_BaseIndexEntry, Addon_BaseMeta, Addon_BaseStoryFn, Addon_BaseStoryObject, Addon_ClientApiAddon, Addon_ClientApiAddons, Addon_ClientApiReturnFn, Addon_ClientStoryApi, Addon_Collection, Addon_Comparator, Addon_Config, Addon_DecoratorFunction, Addon_DocsIndexEntry, Addon_Elements, Addon_IndexEntry, Addon_IndexEntryLegacy, Addon_LegacyStoryFn, Addon_LoadFn, Addon_Loadable, Addon_Loader, Addon_LoaderFunction, Addon_Loaders, Addon_MakeDecoratorResult, Addon_OptionsParameter, Addon_PartialStoryFn, Addon_RenderOptions, Addon_RequireContext, Addon_StandaloneDocsIndexEntry, Addon_StoryApi, Addon_StoryContext, Addon_StoryContextUpdate, Addon_StoryFn, Addon_StoryIndexEntry, Addon_StorySortComparator, Addon_StorySortComparatorV7, Addon_StorySortMethod, Addon_StorySortObjectParameter, Addon_StorySortParameter, Addon_StorySortParameterV7, Addon_StoryWrapper, Addon_TemplateDocsIndexEntry, Addon_ToolbarConfig, Addon_Type, Addon_Types, Addon_TypesEnum, Addon_WrapperSettings, Addons_ArgTypes, AnnotatedStoryFn, AnyFramework, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations, BaseStory, Builder, BuilderName, BuilderOptions, BuilderResult, BuilderStats, Builder_EnvsRaw, Builder_Unpromise, Builder_WithRequiredProperty, CLIOptions, CSF_Meta, CSF_Story, CSF_Tag, ClientAPI_AddStoryArgs, ClientAPI_ArgTypesEnhancer, ClientAPI_ArgsEnhancer, ClientAPI_ClientApiAddon, ClientAPI_ClientApiAddons, ClientAPI_ClientApiReturnFn, ClientAPI_ErrorLike, ClientAPI_GetStorybookKind, ClientAPI_GetStorybookStory, ClientAPI_RenderContextWithoutStoryContext, ClientAPI_StoreSelection, ClientAPI_StoreSelectionSpecifier, ClientAPI_StoryMetadata, ComponentAnnotations, ComponentId, ComponentTitle, Conditional, CoreClient_LoaderFunction, CoreClient_PreviewError, CoreClient_RenderStoryFunction, CoreClient_RequireContext, CoreCommon_AddonEntry, CoreCommon_AddonInfo, CoreCommon_IndexedStory, CoreCommon_IndexerOptions, CoreCommon_NormalizedStoriesSpecifier, CoreCommon_OptionsEntry, CoreCommon_ResolvedAddonPreset, CoreCommon_ResolvedAddonVirtual, CoreCommon_StoriesEntry, CoreCommon_StoryIndex, CoreCommon_StoryIndexer, CoreCommon_StorybookInfo, CoreConfig, DecoratorApplicator, DecoratorFunction, DocsOptions, Entry, GlobalTypes, Globals, IncludeExcludeOptions, InputType, LegacyAnnotatedStoryFn, LegacyStoryAnnotationsOrFn, LegacyStoryFn, LoadOptions, Loadable, LoadedPreset, LoaderFunction, Options, PackageJson, Parameters, PartialStoryFn, Path, PlayFunction, PlayFunctionContext, Preset, PresetConfig, PresetProperty, PresetPropertyFn, Presets, ProjectAnnotations, Ref, ReleaseNotesData, Store_RenderContext as RenderContext, RendererName, SBArrayType, SBEnumType, SBIntersectionType, SBObjectType, SBOtherType, SBScalarType, SBType, SBUnionType, SeparatorOptions, Stats, StepFunction, StepLabel, StepRunner, Store_BoundStory, Store_CSFExports, Store_CSFFile, Store_ComposeStory, Store_ComposedStory, Store_ComposedStoryPlayContext, Store_ComposedStoryPlayFn, Store_ContextStore, Store_ControlsMatchers, Store_DecoratorApplicator, Store_ExtractOptions, Store_ModuleExport, Store_ModuleExports, Store_ModuleImportFn, Store_NormalizedComponentAnnotations, Store_NormalizedProjectAnnotations, Store_NormalizedStoriesSpecifier, Store_NormalizedStoriesSpecifierEntry, Store_NormalizedStoryAnnotations, Store_PromiseLike, Store_PropDescriptor, Store_RenderContext, Store_RenderToDOM, Store_Selection, Store_SelectionSpecifier, Store_StoriesSpecifier, Store_StoriesWithPartialProps, Store_Story, Store_StoryFn, Store_StoryIndex, Store_StoryIndexV3, Store_StorySpecifier, Store_TeardownRenderToDOM, Store_V2CompatIndexEntry, Store_WebProjectAnnotations, StoryAnnotations, StoryAnnotationsOrFn, StoryContext, StoryContextForEnhancers, StoryContextForLoaders, StoryContextUpdate, StoryFn, StoryId, StoryIdentifier, StoryIndex, StoryKind, StoryName, StorybookConfig, StorybookConfigOptions, StrictArgTypes, StrictGlobalTypes, StrictInputType, Tag, TypescriptOptions, VersionCheck, ViewMode };