storybook 9.1.0-alpha.6 → 9.1.0-alpha.8

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.
Files changed (88) hide show
  1. package/assets/browser/favicon-wrapper.svg +46 -0
  2. package/assets/browser/favicon.svg +1 -1
  3. package/dist/bin/index.cjs +43 -43
  4. package/dist/bin/index.js +43 -43
  5. package/dist/cli/bin/index.cjs +513 -513
  6. package/dist/cli/bin/index.js +535 -535
  7. package/dist/cli/index.cjs +2454 -2453
  8. package/dist/cli/index.d.ts +10 -3
  9. package/dist/cli/index.js +2436 -2435
  10. package/dist/common/index.cjs +64 -61
  11. package/dist/common/index.d.ts +9 -3
  12. package/dist/common/index.js +64 -61
  13. package/dist/components/index.cjs +4602 -4427
  14. package/dist/components/index.d.ts +9 -11
  15. package/dist/components/index.js +2760 -2580
  16. package/dist/core-server/index.cjs +5833 -5819
  17. package/dist/core-server/index.d.ts +4 -1
  18. package/dist/core-server/index.js +4848 -4835
  19. package/dist/core-server/presets/common-manager.js +3410 -3332
  20. package/dist/core-server/presets/common-preset.cjs +1831 -1837
  21. package/dist/core-server/presets/common-preset.js +1787 -1792
  22. package/dist/csf/index.cjs +2536 -736
  23. package/dist/csf/index.d.ts +250 -9
  24. package/dist/csf/index.js +2558 -749
  25. package/dist/csf-tools/index.cjs +319 -321
  26. package/dist/csf-tools/index.js +239 -241
  27. package/dist/instrumenter/index.cjs +1150 -1099
  28. package/dist/instrumenter/index.d.ts +1 -0
  29. package/dist/instrumenter/index.js +1261 -1214
  30. package/dist/manager/globals-module-info.cjs +0 -1
  31. package/dist/manager/globals-module-info.js +0 -1
  32. package/dist/manager/globals-runtime.js +21740 -24218
  33. package/dist/manager/runtime.js +3715 -3536
  34. package/dist/manager-api/index.cjs +3 -3
  35. package/dist/manager-api/index.d.ts +4 -1
  36. package/dist/manager-api/index.js +3 -3
  37. package/dist/node-logger/index.cjs +1620 -1620
  38. package/dist/node-logger/index.js +1619 -1619
  39. package/dist/preview/runtime.js +13337 -16032
  40. package/dist/preview-api/index.cjs +273 -271
  41. package/dist/preview-api/index.d.ts +4 -1
  42. package/dist/preview-api/index.js +14 -12
  43. package/dist/telemetry/index.cjs +500 -500
  44. package/dist/telemetry/index.d.ts +1 -1
  45. package/dist/telemetry/index.js +478 -478
  46. package/dist/test/index.cjs +9136 -9815
  47. package/dist/test/index.js +8339 -9025
  48. package/dist/types/index.d.ts +12 -12
  49. package/package.json +5 -196
  50. package/dist/actions/preview.cjs +0 -159
  51. package/dist/actions/preview.d.ts +0 -45
  52. package/dist/actions/preview.js +0 -149
  53. package/dist/backgrounds/index.cjs +0 -16
  54. package/dist/backgrounds/index.d.ts +0 -2
  55. package/dist/backgrounds/index.js +0 -0
  56. package/dist/backgrounds/preview.cjs +0 -143
  57. package/dist/backgrounds/preview.d.ts +0 -53
  58. package/dist/backgrounds/preview.js +0 -127
  59. package/dist/component-testing/index.cjs +0 -23
  60. package/dist/component-testing/index.d.ts +0 -3
  61. package/dist/component-testing/index.js +0 -5
  62. package/dist/component-testing/preview.cjs +0 -40
  63. package/dist/component-testing/preview.d.ts +0 -5
  64. package/dist/component-testing/preview.js +0 -25
  65. package/dist/controls/preview.cjs +0 -26
  66. package/dist/controls/preview.d.ts +0 -43
  67. package/dist/controls/preview.js +0 -9
  68. package/dist/highlight/preview.cjs +0 -590
  69. package/dist/highlight/preview.d.ts +0 -20
  70. package/dist/highlight/preview.js +0 -575
  71. package/dist/measure/index.cjs +0 -16
  72. package/dist/measure/index.d.ts +0 -2
  73. package/dist/measure/index.js +0 -0
  74. package/dist/measure/preview.cjs +0 -466
  75. package/dist/measure/preview.d.ts +0 -25
  76. package/dist/measure/preview.js +0 -450
  77. package/dist/outline/index.cjs +0 -16
  78. package/dist/outline/index.d.ts +0 -2
  79. package/dist/outline/index.js +0 -0
  80. package/dist/outline/preview.cjs +0 -518
  81. package/dist/outline/preview.d.ts +0 -25
  82. package/dist/outline/preview.js +0 -486
  83. package/dist/test/preview.cjs +0 -73
  84. package/dist/test/preview.d.ts +0 -17
  85. package/dist/test/preview.js +0 -66
  86. package/dist/viewport/preview.cjs +0 -35
  87. package/dist/viewport/preview.d.ts +0 -62
  88. package/dist/viewport/preview.js +0 -19
@@ -1,12 +1,4 @@
1
1
  import { StorybookTypes, Renderer as Renderer$1, ProjectAnnotations as ProjectAnnotations$1, NormalizedProjectAnnotations, Args as Args$1, ComponentAnnotations as ComponentAnnotations$1, StoryAnnotations as StoryAnnotations$1, ComposedStoryFn } from 'storybook/internal/types';
2
- import { ActionsTypes } from 'storybook/actions/preview';
3
- import { BackgroundTypes } from 'storybook/backgrounds/preview';
4
- import { ControlsTypes } from 'storybook/controls/preview';
5
- import { HighlightTypes } from 'storybook/highlight/preview';
6
- import { MeasureTypes } from 'storybook/measure/preview';
7
- import { OutlineTypes } from 'storybook/outline/preview';
8
- import { TestTypes } from 'storybook/test/preview';
9
- import { ViewportTypes } from 'storybook/viewport/preview';
10
2
  import { AddonTypes as AddonTypes$1, StoryContext as StoryContext$1 } from 'storybook/internal/csf';
11
3
 
12
4
  declare global {
@@ -298,6 +290,253 @@ type SBOtherType = SBBaseType & {
298
290
  };
299
291
  type SBType = SBScalarType | SBEnumType | SBArrayType | SBObjectType | SBIntersectionType | SBUnionType | SBOtherType;
300
292
 
293
+ interface ActionsParameters {
294
+ /**
295
+ * Actions configuration
296
+ *
297
+ * @see https://storybook.js.org/docs/essentials/actions#parameters
298
+ */
299
+ actions?: {
300
+ /**
301
+ * Create actions for each arg that matches the regex. (**NOT recommended, see below**)
302
+ *
303
+ * This is quite useful when your component has dozens (or hundreds) of methods and you do not
304
+ * want to manually apply the fn utility for each of those methods. However, this is not the
305
+ * recommended way of writing actions. That's because automatically inferred args are not
306
+ * available as spies in your play function. If you use argTypesRegex and your stories have play
307
+ * functions, you will need to also define args with the fn utility to test them in your play
308
+ * function.
309
+ *
310
+ * @example `argTypesRegex: '^on.*'`
311
+ */
312
+ argTypesRegex?: string;
313
+ /** Remove the addon panel and disable the addon's behavior */
314
+ disable?: boolean;
315
+ /**
316
+ * Binds a standard HTML event handler to the outermost HTML element rendered by your component
317
+ * and triggers an action when the event is called for a given selector. The format is
318
+ * `<eventname> <selector>`. The selector is optional; it defaults to all elements.
319
+ *
320
+ * **To enable this feature, you must use the `withActions` decorator.**
321
+ *
322
+ * @example `handles: ['mouseover', 'click .btn']`
323
+ *
324
+ * @see https://storybook.js.org/docs/essentials/actions#action-event-handlers
325
+ */
326
+ handles?: string[];
327
+ };
328
+ }
329
+ interface ActionsTypes {
330
+ parameters: ActionsParameters;
331
+ }
332
+
333
+ declare const PARAM_KEY = "backgrounds";
334
+
335
+ interface Background {
336
+ name: string;
337
+ value: string;
338
+ }
339
+ type BackgroundMap = Record<string, Background>;
340
+ interface GridConfig {
341
+ cellAmount: number;
342
+ cellSize: number;
343
+ opacity: number;
344
+ offsetX?: number;
345
+ offsetY?: number;
346
+ }
347
+ type GlobalState$1 = {
348
+ value: string | undefined;
349
+ grid?: boolean;
350
+ };
351
+ interface BackgroundsParameters {
352
+ /**
353
+ * Backgrounds configuration
354
+ *
355
+ * @see https://storybook.js.org/docs/essentials/backgrounds#parameters
356
+ */
357
+ backgrounds?: {
358
+ /** Default background color */
359
+ default?: string;
360
+ /** Remove the addon panel and disable the addon's behavior */
361
+ disable?: boolean;
362
+ /** Configuration for the background grid */
363
+ grid?: GridConfig;
364
+ /** Available background colors */
365
+ options?: BackgroundMap;
366
+ };
367
+ }
368
+ interface BackgroundsGlobals {
369
+ /**
370
+ * Backgrounds configuration
371
+ *
372
+ * @see https://storybook.js.org/docs/essentials/backgrounds#globals
373
+ */
374
+ [PARAM_KEY]?: GlobalState$1 | GlobalState$1['value'];
375
+ }
376
+ interface BackgroundTypes {
377
+ parameters: BackgroundsParameters;
378
+ globals: BackgroundsGlobals;
379
+ }
380
+
381
+ interface ControlsParameters {
382
+ /**
383
+ * Controls configuration
384
+ *
385
+ * @see https://storybook.js.org/docs/essentials/controls#parameters-1
386
+ */
387
+ controls?: {
388
+ /** Remove the addon panel and disable the addon's behavior */
389
+ disable?: boolean;
390
+ /** Disable the ability to create or edit stories from the Controls panel */
391
+ disableSaveFromUI?: boolean;
392
+ /** Exclude specific properties from the Controls panel */
393
+ exclude?: string[] | RegExp;
394
+ /**
395
+ * Show the full documentation for each property in the Controls addon panel, including the
396
+ * description and default value.
397
+ */
398
+ expanded?: boolean;
399
+ /** Exclude only specific properties in the Controls panel */
400
+ include?: string[] | RegExp;
401
+ /**
402
+ * Custom control type matchers
403
+ *
404
+ * @see https://storybook.js.org/docs/essentials/controls#custom-control-type-matchers
405
+ */
406
+ matchers?: {
407
+ date?: RegExp;
408
+ color?: RegExp;
409
+ };
410
+ /**
411
+ * Preset color swatches for the color picker control
412
+ *
413
+ * @example PresetColors: [{ color: '#ff4785', title: 'Coral' }, 'rgba(0, 159, 183, 1)',
414
+ * '#fe4a49']
415
+ */
416
+ presetColors?: Array<string | {
417
+ color: string;
418
+ title?: string;
419
+ }>;
420
+ /** Controls sorting order */
421
+ sort?: 'none' | 'alpha' | 'requiredFirst';
422
+ };
423
+ }
424
+ interface ControlsTypes {
425
+ parameters: ControlsParameters;
426
+ }
427
+
428
+ interface HighlightTypes {
429
+ parameters: HighlightParameters;
430
+ }
431
+ interface HighlightParameters {
432
+ /**
433
+ * Highlight configuration
434
+ *
435
+ * @see https://storybook.js.org/docs/essentials/highlight#parameters
436
+ */
437
+ highlight?: {
438
+ /** Remove the addon panel and disable the addon's behavior */
439
+ disable?: boolean;
440
+ };
441
+ }
442
+
443
+ interface MeasureParameters {
444
+ /**
445
+ * Measure configuration
446
+ *
447
+ * @see https://storybook.js.org/docs/essentials/measure-and-outline#parameters
448
+ */
449
+ measure?: {
450
+ /** Remove the addon panel and disable the addon's behavior */
451
+ disable?: boolean;
452
+ };
453
+ }
454
+ interface MeasureTypes {
455
+ parameters: MeasureParameters;
456
+ }
457
+
458
+ interface OutlineParameters {
459
+ /**
460
+ * Outline configuration
461
+ *
462
+ * @see https://storybook.js.org/docs/essentials/measure-and-outline#parameters
463
+ */
464
+ outline?: {
465
+ /** Remove the addon panel and disable the addon's behavior */
466
+ disable?: boolean;
467
+ };
468
+ }
469
+ interface OutlineTypes {
470
+ parameters: OutlineParameters;
471
+ }
472
+
473
+ interface TestParameters {
474
+ test?: {
475
+ /** Ignore unhandled errors during test execution */
476
+ dangerouslyIgnoreUnhandledErrors?: boolean;
477
+ /** Whether to throw exceptions coming from the play function */
478
+ throwPlayFunctionExceptions?: boolean;
479
+ };
480
+ }
481
+ interface TestTypes {
482
+ parameters: TestParameters;
483
+ }
484
+
485
+ interface Viewport {
486
+ name: string;
487
+ styles: ViewportStyles;
488
+ type?: 'desktop' | 'mobile' | 'tablet' | 'other';
489
+ }
490
+ interface ViewportStyles {
491
+ height: string;
492
+ width: string;
493
+ }
494
+ type GlobalState = {
495
+ /**
496
+ * When set, the viewport is applied and cannot be changed using the toolbar. Must match the key
497
+ * of one of the available viewports.
498
+ */
499
+ value: string | undefined;
500
+ /**
501
+ * When true the viewport applied will be rotated 90°, e.g. it will rotate from portrait to
502
+ * landscape orientation.
503
+ */
504
+ isRotated?: boolean;
505
+ };
506
+ interface ViewportParameters {
507
+ /**
508
+ * Viewport configuration
509
+ *
510
+ * @see https://storybook.js.org/docs/essentials/viewport#parameters
511
+ */
512
+ viewport?: {
513
+ /**
514
+ * Remove the addon panel and disable the addon's behavior . If you wish to turn off this addon
515
+ * for the entire Storybook, you should do so when registering addon-essentials
516
+ *
517
+ * @see https://storybook.js.org/docs/essentials/index#disabling-addons
518
+ */
519
+ disable?: boolean;
520
+ /**
521
+ * Specify the available viewports. The width and height values must include the unit, e.g.
522
+ * '320px'.
523
+ */
524
+ options: Record<string, Viewport>;
525
+ };
526
+ }
527
+ interface ViewportGlobals {
528
+ /**
529
+ * Viewport configuration
530
+ *
531
+ * @see https://storybook.js.org/docs/essentials/viewport#globals
532
+ */
533
+ viewport?: GlobalState | GlobalState['value'];
534
+ }
535
+ interface ViewportTypes {
536
+ parameters: ViewportParameters;
537
+ globals: ViewportGlobals;
538
+ }
539
+
301
540
  type CoreTypes = StorybookTypes & ActionsTypes & BackgroundTypes & ControlsTypes & HighlightTypes & MeasureTypes & OutlineTypes & TestTypes & ViewportTypes;
302
541
  declare function getCoreAnnotations(): any[];
303
542
 
@@ -671,7 +910,9 @@ interface ComponentAnnotations<TRenderer extends Renderer = Renderer, TArgs = Ar
671
910
  *
672
911
  * By defining them each component will have its tab in the args table.
673
912
  */
674
- subcomponents?: Record<string, TRenderer['component']>;
913
+ subcomponents?: Record<string, (TRenderer & {
914
+ T: any;
915
+ })['component']>;
675
916
  /** Function that is executed after the story is rendered. */
676
917
  play?: PlayFunction<TRenderer, TArgs>;
677
918
  /** Override the globals values for all stories in this component */