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,36 +1,36 @@
1
1
  "use strict";
2
- var g = Object.defineProperty;
2
+ var y = Object.defineProperty;
3
3
  var C = Object.getOwnPropertyDescriptor;
4
4
  var W = Object.getOwnPropertyNames;
5
5
  var M = Object.prototype.hasOwnProperty;
6
- var i = (e, t) => g(e, "name", { value: t, configurable: !0 });
7
- var m = (e, t) => {
6
+ var i = (e, t) => y(e, "name", { value: t, configurable: !0 });
7
+ var l = (e, t) => {
8
8
  for (var o in t)
9
- g(e, o, { get: t[o], enumerable: !0 });
9
+ y(e, o, { get: t[o], enumerable: !0 });
10
10
  }, L = (e, t, o, r) => {
11
11
  if (t && typeof t == "object" || typeof t == "function")
12
12
  for (let n of W(t))
13
- !M.call(e, n) && n !== o && g(e, n, { get: () => t[n], enumerable: !(r = C(t, n)) || r.enumerable });
13
+ !M.call(e, n) && n !== o && y(e, n, { get: () => t[n], enumerable: !(r = C(t, n)) || r.enumerable });
14
14
  return e;
15
15
  };
16
- var V = (e) => L(g({}, "__esModule", { value: !0 }), e);
16
+ var V = (e) => L(y({}, "__esModule", { value: !0 }), e);
17
17
 
18
18
  // src/actions/preview.ts
19
19
  var U = {};
20
- m(U, {
20
+ l(U, {
21
21
  default: () => H
22
22
  });
23
23
  module.exports = V(U);
24
- var F = require("storybook/preview-api");
24
+ var P = require("storybook/preview-api");
25
25
 
26
26
  // src/actions/addArgs.ts
27
27
  var A = {};
28
- m(A, {
28
+ l(A, {
29
29
  argsEnhancers: () => B
30
30
  });
31
31
 
32
32
  // src/actions/runtime/action.ts
33
- var O = require("storybook/internal/preview-errors"), u = require("@storybook/global"), w = require("storybook/preview-api"), v = require("uuid");
33
+ var O = require("storybook/internal/preview-errors"), u = require("@storybook/global"), v = require("storybook/preview-api"), w = require("uuid");
34
34
 
35
35
  // src/actions/constants.ts
36
36
  var f = "storybook/actions", J = `${f}/panel`, E = `${f}/action-event`, Q = `${f}/action-clear`;
@@ -61,20 +61,17 @@ typeof e.persist == "function"), "isReactSyntheticEvent"), Y = /* @__PURE__ */ i
61
61
  }), t;
62
62
  }
63
63
  return e;
64
- }, "serializeArg"), $ = /* @__PURE__ */ i(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? (0, v.v4)() : (
64
+ }, "serializeArg"), $ = /* @__PURE__ */ i(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? (0, w.v4)() : (
65
65
  // pseudo random id, example response lo1e7zm4832bkr7yfl7
66
66
  Date.now().toString(36) + Math.random().toString(36).substring(2)
67
67
  ), "generateId");
68
- function l(e, t = {}) {
68
+ function g(e, t = {}) {
69
69
  let o = {
70
70
  ...R,
71
71
  ...t
72
72
  }, r = /* @__PURE__ */ i(function(...s) {
73
73
  if (t.implicit) {
74
- let x = ("__STORYBOOK_PREVIEW__" in u.global ? (
75
- // eslint-disable-next-line no-underscore-dangle
76
- u.global.__STORYBOOK_PREVIEW__
77
- ) : void 0)?.storyRenders.find(
74
+ let x = ("__STORYBOOK_PREVIEW__" in u.global ? u.global.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
78
75
  (d) => d.phase === "playing" || d.phase === "rendering"
79
76
  );
80
77
  if (x) {
@@ -89,21 +86,20 @@ function l(e, t = {}) {
89
86
  throw b;
90
87
  }
91
88
  }
92
- let a = w.addons.getChannel(), c = $(), p = 5, y = s.map(Y), P = s.length > 1 ? y : y[0], S = {
89
+ let a = v.addons.getChannel(), c = $(), p = 5, m = s.map(Y), S = s.length > 1 ? m : m[0], F = {
93
90
  id: c,
94
91
  count: 0,
95
- data: { name: e, args: P },
92
+ data: { name: e, args: S },
96
93
  options: {
97
94
  ...o,
98
- maxDepth: p + (o.depth || 3),
99
- allowFunction: o.allowFunction || !1
95
+ maxDepth: p + (o.depth || 3)
100
96
  }
101
97
  };
102
- a.emit(E, S);
98
+ a.emit(E, F);
103
99
  }, "actionHandler");
104
100
  return r.isAction = !0, r.implicit = t.implicit, r;
105
101
  }
106
- i(l, "action");
102
+ i(g, "action");
107
103
 
108
104
  // src/actions/addArgsHelpers.ts
109
105
  var _ = /* @__PURE__ */ i((e, t) => typeof t[e] > "u" && !(e in t), "isInInitialArgs"), D = /* @__PURE__ */ i((e) => {
@@ -118,14 +114,14 @@ var _ = /* @__PURE__ */ i((e, t) => typeof t[e] > "u" && !(e in t), "isInInitial
118
114
  let s = new RegExp(n.argTypesRegex);
119
115
  return Object.entries(o).filter(
120
116
  ([c]) => !!s.test(c)
121
- ).reduce((c, [p, y]) => (_(p, t) && (c[p] = l(p, { implicit: !0, id: r })), c), {});
117
+ ).reduce((c, [p, m]) => (_(p, t) && (c[p] = g(p, { implicit: !0, id: r })), c), {});
122
118
  }, "inferActionsFromArgTypesRegex"), k = /* @__PURE__ */ i((e) => {
123
119
  let {
124
120
  initialArgs: t,
125
121
  argTypes: o,
126
122
  parameters: { actions: r }
127
123
  } = e;
128
- return r?.disable || !o ? {} : Object.entries(o).filter(([s, a]) => !!a.action).reduce((s, [a, c]) => (_(a, t) && (s[a] = l(typeof c.action ==
124
+ return r?.disable || !o ? {} : Object.entries(o).filter(([s, a]) => !!a.action).reduce((s, [a, c]) => (_(a, t) && (s[a] = g(typeof c.action ==
129
125
  "string" ? c.action : a)), s), {});
130
126
  }, "addActionsFromArgTypes");
131
127
 
@@ -137,7 +133,7 @@ var B = [
137
133
 
138
134
  // src/actions/loaders.ts
139
135
  var h = {};
140
- m(h, {
136
+ l(h, {
141
137
  loaders: () => z
142
138
  });
143
139
  var j = require("storybook/test/spy");
@@ -154,12 +150,12 @@ var I = !1, K = /* @__PURE__ */ i((e) => {
154
150
  "next/headers::cookies().delete",
155
151
  "next/headers::headers().set",
156
152
  "next/headers::headers().delete"
157
- ].some((s) => n.startsWith(s))) && l(n)(r);
153
+ ].some((s) => n.startsWith(s))) && g(n)(r);
158
154
  }), I = !0);
159
155
  }, "logActionsWhenMockCalled"), z = [K];
160
156
 
161
157
  // src/actions/preview.ts
162
- var H = /* @__PURE__ */ i(() => (0, F.definePreview)({
158
+ var H = /* @__PURE__ */ i(() => (0, P.definePreview)({
163
159
  ...A,
164
160
  ...h
165
161
  }), "default");
@@ -19,7 +19,6 @@ interface ProjectAnnotations<TRenderer extends Renderer> extends ProjectAnnotati
19
19
  unmount: () => void;
20
20
  };
21
21
  renderToCanvas?: RenderToCanvas<TRenderer>;
22
- renderToDOM?: RenderToCanvas<TRenderer>;
23
22
  }
24
23
  declare type RenderContext<TRenderer extends Renderer = Renderer> = StoryIdentifier & {
25
24
  showMain: () => void;
@@ -9,8 +9,8 @@ var x = (t, e) => {
9
9
  import { definePreview as N } from "storybook/preview-api";
10
10
 
11
11
  // src/actions/addArgs.ts
12
- var m = {};
13
- x(m, {
12
+ var l = {};
13
+ x(l, {
14
14
  argsEnhancers: () => W
15
15
  });
16
16
 
@@ -18,10 +18,10 @@ x(m, {
18
18
  import { ImplicitActionsDuringRendering as I } from "storybook/internal/preview-errors";
19
19
  import { global as R } from "@storybook/global";
20
20
  import { addons as j } from "storybook/preview-api";
21
- import { v4 as F } from "uuid";
21
+ import { v4 as P } from "uuid";
22
22
 
23
23
  // src/actions/constants.ts
24
- var y = "storybook/actions", B = `${y}/panel`, b = `${y}/action-event`, K = `${y}/action-clear`;
24
+ var m = "storybook/actions", B = `${m}/panel`, b = `${m}/action-event`, K = `${m}/action-clear`;
25
25
 
26
26
  // src/actions/runtime/configureActions.ts
27
27
  var E = {
@@ -34,9 +34,9 @@ var E = {
34
34
  var O = /* @__PURE__ */ n((t, e) => {
35
35
  let o = Object.getPrototypeOf(t);
36
36
  return !o || e(o) ? o : O(o, e);
37
- }, "findProto"), P = /* @__PURE__ */ n((t) => !!(typeof t == "object" && t && O(t, (e) => /^Synthetic(?:Base)?Event$/.test(e.constructor.name)) &&
38
- typeof t.persist == "function"), "isReactSyntheticEvent"), S = /* @__PURE__ */ n((t) => {
39
- if (P(t)) {
37
+ }, "findProto"), S = /* @__PURE__ */ n((t) => !!(typeof t == "object" && t && O(t, (e) => /^Synthetic(?:Base)?Event$/.test(e.constructor.name)) &&
38
+ typeof t.persist == "function"), "isReactSyntheticEvent"), F = /* @__PURE__ */ n((t) => {
39
+ if (S(t)) {
40
40
  let e = Object.create(
41
41
  t.constructor.prototype,
42
42
  Object.getOwnPropertyDescriptors(t)
@@ -49,20 +49,17 @@ typeof t.persist == "function"), "isReactSyntheticEvent"), S = /* @__PURE__ */ n
49
49
  }), e;
50
50
  }
51
51
  return t;
52
- }, "serializeArg"), C = /* @__PURE__ */ n(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? F() : (
52
+ }, "serializeArg"), C = /* @__PURE__ */ n(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? P() : (
53
53
  // pseudo random id, example response lo1e7zm4832bkr7yfl7
54
54
  Date.now().toString(36) + Math.random().toString(36).substring(2)
55
55
  ), "generateId");
56
- function l(t, e = {}) {
56
+ function g(t, e = {}) {
57
57
  let o = {
58
58
  ...E,
59
59
  ...e
60
60
  }, r = /* @__PURE__ */ n(function(...s) {
61
61
  if (e.implicit) {
62
- let u = ("__STORYBOOK_PREVIEW__" in R ? (
63
- // eslint-disable-next-line no-underscore-dangle
64
- R.__STORYBOOK_PREVIEW__
65
- ) : void 0)?.storyRenders.find(
62
+ let u = ("__STORYBOOK_PREVIEW__" in R ? R.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
66
63
  (d) => d.phase === "playing" || d.phase === "rendering"
67
64
  );
68
65
  if (u) {
@@ -77,24 +74,23 @@ function l(t, e = {}) {
77
74
  throw A;
78
75
  }
79
76
  }
80
- let a = j.getChannel(), c = C(), p = 5, g = s.map(S), D = s.length > 1 ? g : g[0], k = {
77
+ let a = j.getChannel(), c = C(), p = 5, y = s.map(F), D = s.length > 1 ? y : y[0], k = {
81
78
  id: c,
82
79
  count: 0,
83
80
  data: { name: t, args: D },
84
81
  options: {
85
82
  ...o,
86
- maxDepth: p + (o.depth || 3),
87
- allowFunction: o.allowFunction || !1
83
+ maxDepth: p + (o.depth || 3)
88
84
  }
89
85
  };
90
86
  a.emit(b, k);
91
87
  }, "actionHandler");
92
88
  return r.isAction = !0, r.implicit = e.implicit, r;
93
89
  }
94
- n(l, "action");
90
+ n(g, "action");
95
91
 
96
92
  // src/actions/addArgsHelpers.ts
97
- var w = /* @__PURE__ */ n((t, e) => typeof e[t] > "u" && !(t in e), "isInInitialArgs"), v = /* @__PURE__ */ n((t) => {
93
+ var v = /* @__PURE__ */ n((t, e) => typeof e[t] > "u" && !(t in e), "isInInitialArgs"), w = /* @__PURE__ */ n((t) => {
98
94
  let {
99
95
  initialArgs: e,
100
96
  argTypes: o,
@@ -106,21 +102,21 @@ var w = /* @__PURE__ */ n((t, e) => typeof e[t] > "u" && !(t in e), "isInInitial
106
102
  let s = new RegExp(i.argTypesRegex);
107
103
  return Object.entries(o).filter(
108
104
  ([c]) => !!s.test(c)
109
- ).reduce((c, [p, g]) => (w(p, e) && (c[p] = l(p, { implicit: !0, id: r })), c), {});
105
+ ).reduce((c, [p, y]) => (v(p, e) && (c[p] = g(p, { implicit: !0, id: r })), c), {});
110
106
  }, "inferActionsFromArgTypesRegex"), T = /* @__PURE__ */ n((t) => {
111
107
  let {
112
108
  initialArgs: e,
113
109
  argTypes: o,
114
110
  parameters: { actions: r }
115
111
  } = t;
116
- return r?.disable || !o ? {} : Object.entries(o).filter(([s, a]) => !!a.action).reduce((s, [a, c]) => (w(a, e) && (s[a] = l(typeof c.action ==
112
+ return r?.disable || !o ? {} : Object.entries(o).filter(([s, a]) => !!a.action).reduce((s, [a, c]) => (v(a, e) && (s[a] = g(typeof c.action ==
117
113
  "string" ? c.action : a)), s), {});
118
114
  }, "addActionsFromArgTypes");
119
115
 
120
116
  // src/actions/addArgs.ts
121
117
  var W = [
122
118
  T,
123
- v
119
+ w
124
120
  ];
125
121
 
126
122
  // src/actions/loaders.ts
@@ -142,13 +138,13 @@ var _ = !1, L = /* @__PURE__ */ n((t) => {
142
138
  "next/headers::cookies().delete",
143
139
  "next/headers::headers().set",
144
140
  "next/headers::headers().delete"
145
- ].some((s) => i.startsWith(s))) && l(i)(r);
141
+ ].some((s) => i.startsWith(s))) && g(i)(r);
146
142
  }), _ = !0);
147
143
  }, "logActionsWhenMockCalled"), V = [L];
148
144
 
149
145
  // src/actions/preview.ts
150
146
  var dt = /* @__PURE__ */ n(() => N({
151
- ...m,
147
+ ...l,
152
148
  ...f
153
149
  }), "default");
154
150
  export {