storybook 9.0.0-alpha.9 → 9.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/assets/docs/addon-backgrounds.gif +0 -0
  2. package/assets/docs/addon-controls-args-annotated.png +0 -0
  3. package/assets/docs/addon-controls-args-background-color.png +0 -0
  4. package/assets/docs/addon-controls-args-background-string.png +0 -0
  5. package/assets/docs/addon-controls-args-docs.png +0 -0
  6. package/assets/docs/addon-controls-args-logging.png +0 -0
  7. package/assets/docs/addon-controls-args-no-annotation.png +0 -0
  8. package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
  9. package/assets/docs/addon-controls-args-reflow.png +0 -0
  10. package/assets/docs/addon-controls-args-template.png +0 -0
  11. package/assets/docs/addon-controls-expanded.png +0 -0
  12. package/assets/docs/addon-controls-hero.gif +0 -0
  13. package/assets/docs/addon-controls-install.png +0 -0
  14. package/assets/docs/hero.gif +0 -0
  15. package/assets/docs/highlight.png +0 -0
  16. package/assets/docs/viewport.png +0 -0
  17. package/assets/server/base-preview-head.html +1 -3
  18. package/bin/index.cjs +2 -2
  19. package/dist/actions/decorator.js +67 -72
  20. package/dist/actions/index.cjs +27 -31
  21. package/dist/actions/index.d.ts +0 -3
  22. package/dist/actions/index.js +27 -31
  23. package/dist/actions/preview.cjs +23 -27
  24. package/dist/actions/preview.d.ts +0 -1
  25. package/dist/actions/preview.js +19 -23
  26. package/dist/babel/index.cjs +822 -816
  27. package/dist/babel/index.js +822 -816
  28. package/dist/backgrounds/index.cjs +148 -0
  29. package/dist/backgrounds/index.d.ts +91 -0
  30. package/dist/backgrounds/index.js +130 -0
  31. package/dist/backgrounds/preview.cjs +143 -0
  32. package/dist/backgrounds/preview.d.ts +54 -0
  33. package/dist/backgrounds/preview.js +127 -0
  34. package/dist/bin/index.cjs +73 -92
  35. package/dist/bin/index.js +66 -85
  36. package/dist/builder-manager/index.cjs +316 -296
  37. package/dist/builder-manager/index.js +567 -547
  38. package/dist/channels/index.cjs +1020 -950
  39. package/dist/channels/index.js +1256 -1201
  40. package/dist/cli/bin/index.cjs +198 -198
  41. package/dist/cli/bin/index.js +204 -204
  42. package/dist/cli/index.cjs +61734 -7589
  43. package/dist/cli/index.d.ts +24 -20
  44. package/dist/cli/index.js +61775 -7630
  45. package/dist/common/index.cjs +16133 -9095
  46. package/dist/common/index.d.ts +32 -24
  47. package/dist/common/index.js +16227 -9183
  48. package/dist/component-testing/index.cjs +23 -0
  49. package/dist/component-testing/index.d.ts +3 -0
  50. package/dist/component-testing/index.js +5 -0
  51. package/dist/component-testing/preview.cjs +40 -0
  52. package/dist/component-testing/preview.d.ts +5 -0
  53. package/dist/component-testing/preview.js +25 -0
  54. package/dist/components/index.cjs +6479 -13005
  55. package/dist/components/index.d.ts +8 -257
  56. package/dist/components/index.js +6160 -18689
  57. package/dist/controls/decorator.d.ts +5 -0
  58. package/dist/controls/decorator.js +8 -0
  59. package/dist/controls/index.cjs +26 -0
  60. package/dist/controls/index.d.ts +39 -0
  61. package/dist/controls/index.js +6 -0
  62. package/dist/controls/preview.cjs +26 -0
  63. package/dist/controls/preview.d.ts +54 -0
  64. package/dist/controls/preview.js +9 -0
  65. package/dist/core-events/index.cjs +91 -106
  66. package/dist/core-events/index.d.ts +2 -80
  67. package/dist/core-events/index.js +79 -94
  68. package/dist/core-server/index.cjs +12409 -12231
  69. package/dist/core-server/index.d.ts +32 -23
  70. package/dist/core-server/index.js +12567 -12389
  71. package/dist/core-server/presets/common-manager.css +170 -0
  72. package/dist/core-server/presets/common-manager.js +12153 -12
  73. package/dist/core-server/presets/common-preset.cjs +3004 -3151
  74. package/dist/core-server/presets/common-preset.js +2833 -2981
  75. package/dist/csf/index.d.ts +1 -3
  76. package/dist/csf-tools/index.cjs +412 -403
  77. package/dist/csf-tools/index.d.ts +0 -4
  78. package/dist/csf-tools/index.js +410 -401
  79. package/dist/docs-tools/index.cjs +2569 -575
  80. package/dist/docs-tools/index.js +2565 -564
  81. package/dist/highlight/index.cjs +27 -0
  82. package/dist/highlight/index.d.ts +61 -0
  83. package/dist/highlight/index.js +7 -0
  84. package/dist/highlight/preview.cjs +535 -0
  85. package/dist/highlight/preview.d.ts +54 -0
  86. package/dist/highlight/preview.js +519 -0
  87. package/dist/instrumenter/index.cjs +1411 -1758
  88. package/dist/instrumenter/index.d.ts +8 -7
  89. package/dist/instrumenter/index.js +1325 -1663
  90. package/dist/manager/globals-module-info.cjs +22 -33
  91. package/dist/manager/globals-module-info.js +7 -18
  92. package/dist/manager/globals-runtime.js +45452 -49541
  93. package/dist/manager/runtime.js +4392 -3774
  94. package/dist/manager-api/index.cjs +2622 -2529
  95. package/dist/manager-api/index.d.ts +109 -114
  96. package/dist/manager-api/index.js +2603 -2475
  97. package/dist/manager-errors.js +41 -37
  98. package/dist/measure/index.cjs +476 -0
  99. package/dist/measure/index.d.ts +66 -0
  100. package/dist/measure/index.js +464 -0
  101. package/dist/measure/preview.cjs +466 -0
  102. package/dist/measure/preview.d.ts +59 -0
  103. package/dist/measure/preview.js +450 -0
  104. package/dist/outline/index.cjs +528 -0
  105. package/dist/outline/index.d.ts +66 -0
  106. package/dist/outline/index.js +500 -0
  107. package/dist/outline/preview.cjs +518 -0
  108. package/dist/outline/preview.d.ts +59 -0
  109. package/dist/outline/preview.js +486 -0
  110. package/dist/preview/runtime.js +41973 -38159
  111. package/dist/preview-api/index.cjs +1204 -1293
  112. package/dist/preview-api/index.d.ts +126 -178
  113. package/dist/preview-api/index.js +1614 -1685
  114. package/dist/preview-errors.cjs +65 -51
  115. package/dist/preview-errors.d.ts +6 -2
  116. package/dist/preview-errors.js +176 -142
  117. package/dist/server-errors.cjs +160 -113
  118. package/dist/server-errors.d.ts +12 -2
  119. package/dist/server-errors.js +157 -110
  120. package/dist/telemetry/index.cjs +374 -370
  121. package/dist/telemetry/index.d.ts +1 -1
  122. package/dist/telemetry/index.js +460 -456
  123. package/dist/test/index.cjs +1553 -1552
  124. package/dist/test/index.js +9603 -9514
  125. package/dist/test/preview.cjs +1906 -1905
  126. package/dist/test/preview.d.ts +0 -6
  127. package/dist/test/preview.js +3664 -3603
  128. package/dist/test/spy.cjs +65 -64
  129. package/dist/test/spy.js +59 -58
  130. package/dist/types/index.cjs +11 -12
  131. package/dist/types/index.d.ts +601 -334
  132. package/dist/types/index.js +1 -2
  133. package/dist/viewport/index.cjs +310 -0
  134. package/dist/viewport/index.d.ts +320 -0
  135. package/dist/viewport/index.js +290 -0
  136. package/dist/viewport/preview.cjs +35 -0
  137. package/dist/viewport/preview.d.ts +68 -0
  138. package/dist/viewport/preview.js +19 -0
  139. package/package.json +207 -12
  140. package/dist/actions/manager.js +0 -1196
@@ -1,76 +1,77 @@
1
1
  "use strict";
2
- var H = Object.create;
2
+ var U = Object.create;
3
3
  var g = Object.defineProperty;
4
4
  var K = Object.getOwnPropertyDescriptor;
5
- var U = Object.getOwnPropertyNames;
6
- var X = Object.getPrototypeOf, J = Object.prototype.hasOwnProperty;
5
+ var X = Object.getOwnPropertyNames;
6
+ var J = Object.getPrototypeOf, B = Object.prototype.hasOwnProperty;
7
7
  var s = (t, o) => g(t, "name", { value: o, configurable: !0 });
8
- var B = (t, o) => () => (o || t((o = { exports: {} }).exports, o), o.exports), z = (t, o) => {
8
+ var z = (t, o) => () => (o || t((o = { exports: {} }).exports, o), o.exports), q = (t, o) => {
9
9
  for (var e in o)
10
10
  g(t, e, { get: o[e], enumerable: !0 });
11
- }, j = (t, o, e, i) => {
11
+ }, M = (t, o, e, i) => {
12
12
  if (o && typeof o == "object" || typeof o == "function")
13
- for (let u of U(o))
14
- !J.call(t, u) && u !== e && g(t, u, { get: () => o[u], enumerable: !(i = K(o, u)) || i.enumerable });
13
+ for (let u of X(o))
14
+ !B.call(t, u) && u !== e && g(t, u, { get: () => o[u], enumerable: !(i = K(o, u)) || i.enumerable });
15
15
  return t;
16
16
  };
17
- var q = (t, o, e) => (e = t != null ? H(X(t)) : {}, j(
17
+ var Q = (t, o, e) => (e = t != null ? U(J(t)) : {}, M(
18
18
  // If the importer is in node compatibility mode or this is not an ESM
19
19
  // file that has been converted to a CommonJS file using a Babel-
20
20
  // compatible transform (i.e. "__esModule" has not been set), then set
21
21
  // "default" to the CommonJS "module.exports" for node compatibility.
22
22
  o || !t || !t.__esModule ? g(e, "default", { value: t, enumerable: !0 }) : e,
23
23
  t
24
- )), Q = (t) => j(g({}, "__esModule", { value: !0 }), t);
24
+ )), Z = (t) => M(g({}, "__esModule", { value: !0 }), t);
25
25
 
26
26
  // ../node_modules/ts-dedent/dist/index.js
27
- var L = B((h) => {
27
+ var F = z((h) => {
28
28
  "use strict";
29
29
  Object.defineProperty(h, "__esModule", { value: !0 });
30
30
  h.dedent = void 0;
31
- function M(t) {
31
+ function L(t) {
32
32
  for (var o = [], e = 1; e < arguments.length; e++)
33
33
  o[e - 1] = arguments[e];
34
34
  var i = Array.from(typeof t == "string" ? [t] : t);
35
35
  i[i.length - 1] = i[i.length - 1].replace(/\r?\n([\t ]*)$/, "");
36
- var u = i.reduce(function(c, m) {
37
- var p = m.match(/\n([\t ]+|(?!\s).)/g);
36
+ var u = i.reduce(function(c, E) {
37
+ var p = E.match(/\n([\t ]+|(?!\s).)/g);
38
38
  return p ? c.concat(p.map(function(f) {
39
39
  var l, y;
40
40
  return (y = (l = f.match(/[\t ]/g)) === null || l === void 0 ? void 0 : l.length) !== null && y !== void 0 ? y : 0;
41
41
  })) : c;
42
42
  }, []);
43
43
  if (u.length) {
44
- var E = new RegExp(`
44
+ var m = new RegExp(`
45
45
  [ ]{` + Math.min.apply(Math, u) + "}", "g");
46
46
  i = i.map(function(c) {
47
- return c.replace(E, `
47
+ return c.replace(m, `
48
48
  `);
49
49
  });
50
50
  }
51
51
  i[0] = i[0].replace(/^\r?\n/, "");
52
52
  var d = i[0];
53
- return o.forEach(function(c, m) {
53
+ return o.forEach(function(c, E) {
54
54
  var p = d.match(/(?:^|\n)( *)$/), f = p ? p[1] : "", l = c;
55
55
  typeof c == "string" && c.includes(`
56
56
  `) && (l = String(c).split(`
57
- `).map(function(y, Y) {
58
- return Y === 0 ? y : "" + f + y;
57
+ `).map(function(y, H) {
58
+ return H === 0 ? y : "" + f + y;
59
59
  }).join(`
60
- `)), d += l + i[m + 1];
60
+ `)), d += l + i[E + 1];
61
61
  }), d;
62
62
  }
63
- s(M, "dedent");
64
- h.dedent = M;
65
- h.default = M;
63
+ s(L, "dedent");
64
+ h.dedent = L;
65
+ h.default = L;
66
66
  });
67
67
 
68
68
  // src/preview-errors.ts
69
- var Z = {};
70
- z(Z, {
69
+ var ee = {};
70
+ q(ee, {
71
71
  CalledExtractOnStoreError: () => I,
72
- CalledPreviewMethodBeforeInitializationError: () => P,
72
+ CalledPreviewMethodBeforeInitializationError: () => x,
73
73
  Category: () => G,
74
+ ElementA11yParameterError: () => j,
74
75
  EmptyIndexError: () => w,
75
76
  ImplicitActionsDuringRendering: () => b,
76
77
  MdxFileWithNoCsfReferencesError: () => S,
@@ -78,29 +79,29 @@ z(Z, {
78
79
  MissingStoryAfterHmrError: () => R,
79
80
  MissingStoryFromCsfFileError: () => k,
80
81
  MountMustBeDestructuredError: () => N,
81
- NextJsSharpError: () => $,
82
- NextjsRouterMocksNotAvailable: () => O,
83
- NoRenderFunctionError: () => V,
82
+ NextJsSharpError: () => W,
83
+ NextjsRouterMocksNotAvailable: () => $,
84
+ NoRenderFunctionError: () => A,
84
85
  NoStoryMatchError: () => T,
85
- NoStoryMountedError: () => A,
86
- StatusTypeIdMismatchError: () => W,
87
- StoryIndexFetchError: () => x,
86
+ NoStoryMountedError: () => V,
87
+ StatusTypeIdMismatchError: () => O,
88
+ StoryIndexFetchError: () => P,
88
89
  StoryStoreAccessedBeforeInitializationError: () => v,
89
- UnknownArgTypesError: () => C,
90
- UnsupportedViewportDimensionError: () => D
90
+ UnknownArgTypesError: () => D,
91
+ UnsupportedViewportDimensionError: () => C
91
92
  });
92
- module.exports = Q(Z);
93
- var a = q(L(), 1);
93
+ module.exports = Z(ee);
94
+ var a = Q(F(), 1);
94
95
 
95
96
  // src/storybook-error.ts
96
- function F({
97
+ function Y({
97
98
  code: t,
98
99
  category: o
99
100
  }) {
100
101
  let e = String(t).padStart(4, "0");
101
102
  return `SB_${o}_${e}`;
102
103
  }
103
- s(F, "parseErrorCode");
104
+ s(Y, "parseErrorCode");
104
105
  var r = class t extends Error {
105
106
  constructor(e) {
106
107
  super(t.getFullMessage(e));
@@ -117,7 +118,7 @@ var r = class t extends Error {
117
118
  s(this, "StorybookError");
118
119
  }
119
120
  get fullErrorCode() {
120
- return F({ code: this.code, category: this.category });
121
+ return Y({ code: this.code, category: this.category });
121
122
  }
122
123
  /** Overrides the default `Error.name` property in the format: SB_<CATEGORY>_<CODE>. */
123
124
  get name() {
@@ -129,13 +130,13 @@ var r = class t extends Error {
129
130
  documentation: e,
130
131
  code: i,
131
132
  category: u,
132
- message: E
133
+ message: m
133
134
  }) {
134
135
  let d;
135
- return e === !0 ? d = `https://storybook.js.org/error/${F({ code: i, category: u })}` : typeof e == "string" ? d = e : Array.isArray(e) &&
136
+ return e === !0 ? d = `https://storybook.js.org/error/${Y({ code: i, category: u })}` : typeof e == "string" ? d = e : Array.isArray(e) &&
136
137
  (d = `
137
138
  ${e.map((c) => ` - ${c}`).join(`
138
- `)}`), `${E}${d != null ? `
139
+ `)}`), `${m}${d != null ? `
139
140
 
140
141
  More info: ${d}
141
142
  ` : ""}`;
@@ -148,7 +149,7 @@ var G = /* @__PURE__ */ ((n) => (n.BLOCKS = "BLOCKS", n.DOCS_TOOLS = "DOCS-TOOLS
148
149
  _API", n.PREVIEW_REACT_DOM_SHIM = "PREVIEW_REACT-DOM-SHIM", n.PREVIEW_ROUTER = "PREVIEW_ROUTER", n.PREVIEW_THEMING = "PREVIEW_THEMING", n.RENDERER_HTML =
149
150
  "RENDERER_HTML", n.RENDERER_PREACT = "RENDERER_PREACT", n.RENDERER_REACT = "RENDERER_REACT", n.RENDERER_SERVER = "RENDERER_SERVER", n.RENDERER_SVELTE =
150
151
  "RENDERER_SVELTE", n.RENDERER_VUE = "RENDERER_VUE", n.RENDERER_VUE3 = "RENDERER_VUE3", n.RENDERER_WEB_COMPONENTS = "RENDERER_WEB-COMPONENTS",
151
- n.FRAMEWORK_NEXTJS = "FRAMEWORK_NEXTJS", n.ADDON_VITEST = "ADDON_VITEST", n))(G || {}), R = class extends r {
152
+ n.FRAMEWORK_NEXTJS = "FRAMEWORK_NEXTJS", n.ADDON_VITEST = "ADDON_VITEST", n.ADDON_A11Y = "ADDON_A11Y", n))(G || {}), R = class extends r {
152
153
  constructor(e) {
153
154
  super({
154
155
  category: "PREVIEW_API",
@@ -219,7 +220,7 @@ This is deprecated and won't work in Storybook 8 anymore.
219
220
  documentation: "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#mainjs-framework-field"
220
221
  });
221
222
  }
222
- }, P = class extends r {
223
+ }, x = class extends r {
223
224
  constructor(e) {
224
225
  super({
225
226
  category: "PREVIEW_API",
@@ -238,7 +239,7 @@ This is deprecated and won't work in Storybook 8 anymore.
238
239
  static {
239
240
  s(this, "CalledPreviewMethodBeforeInitializationError");
240
241
  }
241
- }, x = class extends r {
242
+ }, P = class extends r {
242
243
  constructor(e) {
243
244
  super({
244
245
  category: "PREVIEW_API",
@@ -372,7 +373,7 @@ This is deprecated and won't work in Storybook 8 anymore.
372
373
  static {
373
374
  s(this, "MountMustBeDestructuredError");
374
375
  }
375
- }, V = class extends r {
376
+ }, A = class extends r {
376
377
  constructor(e) {
377
378
  super({
378
379
  category: "PREVIEW_API",
@@ -386,7 +387,7 @@ This is deprecated and won't work in Storybook 8 anymore.
386
387
  static {
387
388
  s(this, "NoRenderFunctionError");
388
389
  }
389
- }, A = class extends r {
390
+ }, V = class extends r {
390
391
  static {
391
392
  s(this, "NoStoryMountedError");
392
393
  }
@@ -412,7 +413,7 @@ This is deprecated and won't work in Storybook 8 anymore.
412
413
  `
413
414
  });
414
415
  }
415
- }, W = class extends r {
416
+ }, O = class extends r {
416
417
  constructor(e) {
417
418
  super({
418
419
  category: "PREVIEW_API",
@@ -428,7 +429,7 @@ This is deprecated and won't work in Storybook 8 anymore.
428
429
  static {
429
430
  s(this, "StatusTypeIdMismatchError");
430
431
  }
431
- }, $ = class extends r {
432
+ }, W = class extends r {
432
433
  static {
433
434
  s(this, "NextJsSharpError");
434
435
  }
@@ -444,7 +445,7 @@ This is deprecated and won't work in Storybook 8 anymore.
444
445
  `
445
446
  });
446
447
  }
447
- }, O = class extends r {
448
+ }, $ = class extends r {
448
449
  constructor(e) {
449
450
  super({
450
451
  category: "FRAMEWORK_NEXTJS",
@@ -458,7 +459,7 @@ This is deprecated and won't work in Storybook 8 anymore.
458
459
  static {
459
460
  s(this, "NextjsRouterMocksNotAvailable");
460
461
  }
461
- }, C = class extends r {
462
+ }, D = class extends r {
462
463
  constructor(e) {
463
464
  super({
464
465
  category: "DOCS-TOOLS",
@@ -479,7 +480,7 @@ This is deprecated and won't work in Storybook 8 anymore.
479
480
  static {
480
481
  s(this, "UnknownArgTypesError");
481
482
  }
482
- }, D = class extends r {
483
+ }, C = class extends r {
483
484
  constructor(e) {
484
485
  super({
485
486
  category: "ADDON_VITEST",
@@ -500,4 +501,17 @@ This is deprecated and won't work in Storybook 8 anymore.
500
501
  static {
501
502
  s(this, "UnsupportedViewportDimensionError");
502
503
  }
504
+ }, j = class extends r {
505
+ static {
506
+ s(this, "ElementA11yParameterError");
507
+ }
508
+ constructor() {
509
+ super({
510
+ category: "ADDON_A11Y",
511
+ code: 1,
512
+ documentation: "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#a11y-addon-replace-element-parameter-with-context-para\
513
+ meter",
514
+ message: 'The "element" parameter in parameters.a11y has been removed. Use "context" instead.'
515
+ });
516
+ }
503
517
  };
@@ -74,7 +74,8 @@ declare enum Category {
74
74
  RENDERER_VUE3 = "RENDERER_VUE3",
75
75
  RENDERER_WEB_COMPONENTS = "RENDERER_WEB-COMPONENTS",
76
76
  FRAMEWORK_NEXTJS = "FRAMEWORK_NEXTJS",
77
- ADDON_VITEST = "ADDON_VITEST"
77
+ ADDON_VITEST = "ADDON_VITEST",
78
+ ADDON_A11Y = "ADDON_A11Y"
78
79
  }
79
80
  declare class MissingStoryAfterHmrError extends StorybookError {
80
81
  data: {
@@ -208,5 +209,8 @@ declare class UnsupportedViewportDimensionError extends StorybookError {
208
209
  value: string;
209
210
  });
210
211
  }
212
+ declare class ElementA11yParameterError extends StorybookError {
213
+ constructor();
214
+ }
211
215
 
212
- export { CalledExtractOnStoreError, CalledPreviewMethodBeforeInitializationError, Category, EmptyIndexError, ImplicitActionsDuringRendering, MdxFileWithNoCsfReferencesError, MissingRenderToCanvasError, MissingStoryAfterHmrError, MissingStoryFromCsfFileError, MountMustBeDestructuredError, NextJsSharpError, NextjsRouterMocksNotAvailable, NoRenderFunctionError, NoStoryMatchError, NoStoryMountedError, StatusTypeIdMismatchError, StoryIndexFetchError, StoryStoreAccessedBeforeInitializationError, UnknownArgTypesError, UnsupportedViewportDimensionError };
216
+ export { CalledExtractOnStoreError, CalledPreviewMethodBeforeInitializationError, Category, ElementA11yParameterError, EmptyIndexError, ImplicitActionsDuringRendering, MdxFileWithNoCsfReferencesError, MissingRenderToCanvasError, MissingStoryAfterHmrError, MissingStoryFromCsfFileError, MountMustBeDestructuredError, NextJsSharpError, NextjsRouterMocksNotAvailable, NoRenderFunctionError, NoStoryMatchError, NoStoryMountedError, StatusTypeIdMismatchError, StoryIndexFetchError, StoryStoreAccessedBeforeInitializationError, UnknownArgTypesError, UnsupportedViewportDimensionError };