storybook 9.1.0-alpha.2 → 9.1.0-alpha.4

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 (77) hide show
  1. package/dist/actions/index.cjs +16 -16
  2. package/dist/actions/index.d.ts +1 -38
  3. package/dist/actions/index.js +12 -12
  4. package/dist/actions/preview.cjs +25 -25
  5. package/dist/actions/preview.d.ts +37 -547
  6. package/dist/actions/preview.js +18 -18
  7. package/dist/backgrounds/index.cjs +12 -144
  8. package/dist/backgrounds/index.d.ts +1 -591
  9. package/dist/backgrounds/index.js +0 -130
  10. package/dist/backgrounds/preview.cjs +63 -63
  11. package/dist/backgrounds/preview.d.ts +40 -542
  12. package/dist/backgrounds/preview.js +47 -47
  13. package/dist/bin/index.cjs +50 -50
  14. package/dist/bin/index.js +50 -50
  15. package/dist/builder-manager/index.cjs +379 -378
  16. package/dist/builder-manager/index.d.ts +567 -2
  17. package/dist/builder-manager/index.js +280 -279
  18. package/dist/cli/bin/index.cjs +1 -1
  19. package/dist/cli/bin/index.js +1 -1
  20. package/dist/common/index.cjs +87 -79
  21. package/dist/common/index.d.ts +2 -2
  22. package/dist/common/index.js +725 -716
  23. package/dist/component-testing/preview.cjs +12 -12
  24. package/dist/component-testing/preview.d.ts +2 -2
  25. package/dist/component-testing/preview.js +7 -7
  26. package/dist/components/index.cjs +1899 -1895
  27. package/dist/components/index.js +1343 -1339
  28. package/dist/controls/index.cjs +16 -16
  29. package/dist/controls/index.d.ts +1 -36
  30. package/dist/controls/preview.cjs +17 -17
  31. package/dist/controls/preview.d.ts +34 -546
  32. package/dist/controls/preview.js +3 -3
  33. package/dist/csf/index.cjs +1210 -95
  34. package/dist/csf/index.d.ts +59 -18
  35. package/dist/csf/index.js +1214 -90
  36. package/dist/csf-tools/index.cjs +2 -1
  37. package/dist/csf-tools/index.js +2 -2
  38. package/dist/highlight/index.cjs +15 -15
  39. package/dist/highlight/index.d.ts +1 -12
  40. package/dist/highlight/index.js +4 -4
  41. package/dist/highlight/preview.cjs +63 -63
  42. package/dist/highlight/preview.d.ts +11 -546
  43. package/dist/highlight/preview.js +11 -10
  44. package/dist/manager/globals-runtime.js +31934 -31888
  45. package/dist/manager-api/index.cjs +1 -1
  46. package/dist/manager-api/index.js +1 -1
  47. package/dist/measure/index.cjs +12 -472
  48. package/dist/measure/index.d.ts +1 -566
  49. package/dist/measure/index.js +0 -464
  50. package/dist/measure/preview.cjs +127 -127
  51. package/dist/measure/preview.d.ts +11 -546
  52. package/dist/measure/preview.js +117 -117
  53. package/dist/outline/index.cjs +12 -524
  54. package/dist/outline/index.d.ts +1 -566
  55. package/dist/outline/index.js +0 -500
  56. package/dist/outline/preview.cjs +32 -32
  57. package/dist/outline/preview.d.ts +11 -546
  58. package/dist/outline/preview.js +27 -27
  59. package/dist/preview/runtime.js +9415 -9379
  60. package/dist/preview-api/index.cjs +1228 -1261
  61. package/dist/preview-api/index.d.ts +6 -8
  62. package/dist/preview-api/index.js +927 -963
  63. package/dist/telemetry/index.cjs +1477 -1288
  64. package/dist/telemetry/index.js +1503 -1314
  65. package/dist/test/index.cjs +4437 -4394
  66. package/dist/test/index.js +3776 -3733
  67. package/dist/test/preview.cjs +42 -42
  68. package/dist/test/preview.d.ts +12 -550
  69. package/dist/test/preview.js +36 -36
  70. package/dist/types/index.d.ts +5 -3
  71. package/dist/viewport/index.cjs +17 -24
  72. package/dist/viewport/index.d.ts +9 -532
  73. package/dist/viewport/index.js +9 -16
  74. package/dist/viewport/preview.cjs +22 -22
  75. package/dist/viewport/preview.d.ts +45 -552
  76. package/dist/viewport/preview.js +8 -8
  77. package/package.json +1 -1
@@ -7,13 +7,13 @@ var i = (t, o) => a(t, "name", { value: o, configurable: !0 });
7
7
  var j = (t, o) => {
8
8
  for (var n in o)
9
9
  a(t, n, { get: o[n], enumerable: !0 });
10
- }, P = (t, o, n, e) => {
10
+ }, S = (t, o, n, e) => {
11
11
  if (o && typeof o == "object" || typeof o == "function")
12
12
  for (let r of x(o))
13
13
  !R.call(t, r) && r !== n && a(t, r, { get: () => o[r], enumerable: !(e = D(o, r)) || e.enumerable });
14
14
  return t;
15
15
  };
16
- var S = (t) => P(a({}, "__esModule", { value: !0 }), t);
16
+ var I = (t) => S(a({}, "__esModule", { value: !0 }), t);
17
17
 
18
18
  // src/actions/index.ts
19
19
  var $ = {};
@@ -23,19 +23,19 @@ j($, {
23
23
  CYCLIC_KEY: () => C,
24
24
  EVENT_ID: () => m,
25
25
  PANEL_ID: () => T,
26
- PARAM_KEY: () => I,
27
- action: () => f,
26
+ PARAM_KEY: () => P,
27
+ action: () => y,
28
28
  actions: () => Y,
29
29
  config: () => s,
30
30
  configureActions: () => F
31
31
  });
32
- module.exports = S($);
32
+ module.exports = I($);
33
33
 
34
34
  // src/actions/constants.ts
35
- var I = "actions", l = "storybook/actions", T = `${l}/panel`, m = `${l}/action-event`, k = `${l}/action-clear`, C = "$___storybook.isCyclic";
35
+ var P = "actions", l = "storybook/actions", T = `${l}/panel`, m = `${l}/action-event`, k = `${l}/action-clear`, C = "$___storybook.isCyclic";
36
36
 
37
37
  // src/actions/runtime/action.ts
38
- var A = require("storybook/internal/preview-errors"), y = require("@storybook/global"), O = require("storybook/preview-api");
38
+ var O = require("storybook/internal/preview-errors"), f = require("@storybook/global"), h = require("storybook/preview-api");
39
39
 
40
40
  // src/actions/runtime/configureActions.ts
41
41
  var s = {
@@ -47,10 +47,10 @@ var s = {
47
47
  }, "configureActions");
48
48
 
49
49
  // src/actions/runtime/action.ts
50
- var h = /* @__PURE__ */ i((t, o) => {
50
+ var A = /* @__PURE__ */ i((t, o) => {
51
51
  let n = Object.getPrototypeOf(t);
52
- return !n || o(n) ? n : h(n, o);
53
- }, "findProto"), V = /* @__PURE__ */ i((t) => !!(typeof t == "object" && t && h(t, (o) => /^Synthetic(?:Base)?Event$/.test(o.constructor.name)) &&
52
+ return !n || o(n) ? n : A(n, o);
53
+ }, "findProto"), V = /* @__PURE__ */ i((t) => !!(typeof t == "object" && t && A(t, (o) => /^Synthetic(?:Base)?Event$/.test(o.constructor.name)) &&
54
54
  typeof t.persist == "function"), "isReactSyntheticEvent"), W = /* @__PURE__ */ i((t) => {
55
55
  if (V(t)) {
56
56
  let o = Object.create(
@@ -66,17 +66,17 @@ typeof t.persist == "function"), "isReactSyntheticEvent"), W = /* @__PURE__ */ i
66
66
  }
67
67
  return t;
68
68
  }, "serializeArg");
69
- function f(t, o = {}) {
69
+ function y(t, o = {}) {
70
70
  let n = {
71
71
  ...s,
72
72
  ...o
73
73
  }, e = /* @__PURE__ */ i(function(...c) {
74
74
  if (o.implicit) {
75
- let u = ("__STORYBOOK_PREVIEW__" in y.global ? y.global.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
75
+ let u = ("__STORYBOOK_PREVIEW__" in f.global ? f.global.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
76
76
  (p) => p.phase === "playing" || p.phase === "rendering"
77
77
  );
78
78
  if (u) {
79
- let p = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, g = new A.ImplicitActionsDuringRendering({
79
+ let p = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, g = new O.ImplicitActionsDuringRendering({
80
80
  phase: u.phase,
81
81
  name: t,
82
82
  deprecated: p
@@ -87,7 +87,7 @@ function f(t, o = {}) {
87
87
  throw g;
88
88
  }
89
89
  }
90
- let E = O.addons.getChannel(), b = Date.now().toString(36) + Math.random().toString(36).substring(2), w = 5, d = c.map(W), _ = c.length >
90
+ let E = h.addons.getChannel(), b = Date.now().toString(36) + Math.random().toString(36).substring(2), w = 5, d = c.map(W), _ = c.length >
91
91
  1 ? d : d[0], v = {
92
92
  id: b,
93
93
  count: 0,
@@ -101,7 +101,7 @@ function f(t, o = {}) {
101
101
  }, "actionHandler");
102
102
  return e.isAction = !0, e.implicit = o.implicit, e;
103
103
  }
104
- i(f, "action");
104
+ i(y, "action");
105
105
 
106
106
  // src/actions/runtime/actions.ts
107
107
  var Y = /* @__PURE__ */ i((...t) => {
@@ -116,6 +116,6 @@ var Y = /* @__PURE__ */ i((...t) => {
116
116
  }));
117
117
  let r = {};
118
118
  return Object.keys(e).forEach((c) => {
119
- r[c] = f(e[c], o);
119
+ r[c] = y(e[c], o);
120
120
  }), r;
121
121
  }, "actions");
@@ -62,41 +62,4 @@ declare const actions: ActionsFunction;
62
62
  declare const config: ActionOptions;
63
63
  declare const configureActions: (options?: ActionOptions) => void;
64
64
 
65
- interface ActionsParameters {
66
- /**
67
- * Actions configuration
68
- *
69
- * @see https://storybook.js.org/docs/essentials/actions#parameters
70
- */
71
- actions: {
72
- /**
73
- * Create actions for each arg that matches the regex. (**NOT recommended, see below**)
74
- *
75
- * This is quite useful when your component has dozens (or hundreds) of methods and you do not
76
- * want to manually apply the fn utility for each of those methods. However, this is not the
77
- * recommended way of writing actions. That's because automatically inferred args are not
78
- * available as spies in your play function. If you use argTypesRegex and your stories have play
79
- * functions, you will need to also define args with the fn utility to test them in your play
80
- * function.
81
- *
82
- * @example `argTypesRegex: '^on.*'`
83
- */
84
- argTypesRegex?: string;
85
- /** Remove the addon panel and disable the addon's behavior */
86
- disable?: boolean;
87
- /**
88
- * Binds a standard HTML event handler to the outermost HTML element rendered by your component
89
- * and triggers an action when the event is called for a given selector. The format is
90
- * `<eventname> <selector>`. The selector is optional; it defaults to all elements.
91
- *
92
- * **To enable this feature, you must use the `withActions` decorator.**
93
- *
94
- * @example `handles: ['mouseover', 'click .btn']`
95
- *
96
- * @see https://storybook.js.org/docs/essentials/actions#action-event-handlers
97
- */
98
- handles?: string[];
99
- };
100
- }
101
-
102
- export { ADDON_ID, type ActionDisplay, type ActionOptions, type ActionsFunction, type ActionsMap, type ActionsParameters, CLEAR_ID, CYCLIC_KEY, type DecoratorFunction, EVENT_ID, type HandlerFunction, PANEL_ID, PARAM_KEY, action, actions, config, configureActions };
65
+ export { ADDON_ID, type ActionDisplay, type ActionOptions, type ActionsFunction, type ActionsMap, CLEAR_ID, CYCLIC_KEY, type DecoratorFunction, EVENT_ID, type HandlerFunction, PANEL_ID, PARAM_KEY, action, actions, config, configureActions };
@@ -2,7 +2,7 @@ var w = Object.defineProperty;
2
2
  var i = (o, n) => w(o, "name", { value: n, configurable: !0 });
3
3
 
4
4
  // src/actions/constants.ts
5
- var P = "actions", a = "storybook/actions", S = `${a}/panel`, f = `${a}/action-event`, I = `${a}/action-clear`, T = "$___storybook.isCyclic";
5
+ var S = "actions", a = "storybook/actions", I = `${a}/panel`, y = `${a}/action-event`, P = `${a}/action-clear`, T = "$___storybook.isCyclic";
6
6
 
7
7
  // src/actions/runtime/action.ts
8
8
  import { ImplicitActionsDuringRendering as _ } from "storybook/internal/preview-errors";
@@ -48,28 +48,28 @@ function g(o, n = {}) {
48
48
  (s) => s.phase === "playing" || s.phase === "rendering"
49
49
  );
50
50
  if (m) {
51
- let s = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, y = new _({
51
+ let s = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, f = new _({
52
52
  phase: m.phase,
53
53
  name: o,
54
54
  deprecated: s
55
55
  });
56
56
  if (s)
57
- console.warn(y);
57
+ console.warn(f);
58
58
  else
59
- throw y;
59
+ throw f;
60
60
  }
61
61
  }
62
- let A = v.getChannel(), O = Date.now().toString(36) + Math.random().toString(36).substring(2), h = 5, l = r.map(x), E = r.length > 1 ? l :
62
+ let O = v.getChannel(), h = Date.now().toString(36) + Math.random().toString(36).substring(2), A = 5, l = r.map(x), E = r.length > 1 ? l :
63
63
  l[0], b = {
64
- id: O,
64
+ id: h,
65
65
  count: 0,
66
66
  data: { name: o, args: E },
67
67
  options: {
68
68
  ...t,
69
- maxDepth: h + (t.depth || 3)
69
+ maxDepth: A + (t.depth || 3)
70
70
  }
71
71
  };
72
- A.emit(f, b);
72
+ O.emit(y, b);
73
73
  }, "actionHandler");
74
74
  return e.isAction = !0, e.implicit = n.implicit, e;
75
75
  }
@@ -93,11 +93,11 @@ var L = /* @__PURE__ */ i((...o) => {
93
93
  }, "actions");
94
94
  export {
95
95
  a as ADDON_ID,
96
- I as CLEAR_ID,
96
+ P as CLEAR_ID,
97
97
  T as CYCLIC_KEY,
98
- f as EVENT_ID,
99
- S as PANEL_ID,
100
- P as PARAM_KEY,
98
+ y as EVENT_ID,
99
+ I as PANEL_ID,
100
+ S as PARAM_KEY,
101
101
  g as action,
102
102
  L as actions,
103
103
  c as config,
@@ -1,36 +1,36 @@
1
1
  "use strict";
2
- var l = Object.defineProperty;
2
+ var g = Object.defineProperty;
3
3
  var F = Object.getOwnPropertyDescriptor;
4
4
  var C = Object.getOwnPropertyNames;
5
5
  var W = Object.prototype.hasOwnProperty;
6
- var i = (e, t) => l(e, "name", { value: t, configurable: !0 });
7
- var y = (e, t) => {
6
+ var i = (e, t) => g(e, "name", { value: t, configurable: !0 });
7
+ var l = (e, t) => {
8
8
  for (var o in t)
9
- l(e, o, { get: t[o], enumerable: !0 });
9
+ g(e, o, { get: t[o], enumerable: !0 });
10
10
  }, M = (e, t, o, r) => {
11
11
  if (t && typeof t == "object" || typeof t == "function")
12
12
  for (let n of C(t))
13
- !W.call(e, n) && n !== o && l(e, n, { get: () => t[n], enumerable: !(r = F(t, n)) || r.enumerable });
13
+ !W.call(e, n) && n !== o && g(e, n, { get: () => t[n], enumerable: !(r = F(t, n)) || r.enumerable });
14
14
  return e;
15
15
  };
16
- var L = (e) => M(l({}, "__esModule", { value: !0 }), e);
16
+ var L = (e) => M(g({}, "__esModule", { value: !0 }), e);
17
17
 
18
18
  // src/actions/preview.ts
19
19
  var z = {};
20
- y(z, {
20
+ l(z, {
21
21
  default: () => K
22
22
  });
23
23
  module.exports = L(z);
24
- var j = require("storybook/preview-api");
24
+ var j = require("storybook/internal/csf");
25
25
 
26
26
  // src/actions/addArgs.ts
27
27
  var A = {};
28
- y(A, {
28
+ l(A, {
29
29
  argsEnhancers: () => Y
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");
33
+ var O = require("storybook/internal/preview-errors"), u = require("@storybook/global"), T = require("storybook/preview-api");
34
34
 
35
35
  // src/actions/constants.ts
36
36
  var f = "storybook/actions", q = `${f}/panel`, E = `${f}/action-event`, G = `${f}/action-clear`;
@@ -43,10 +43,10 @@ var R = {
43
43
  };
44
44
 
45
45
  // src/actions/runtime/action.ts
46
- var v = /* @__PURE__ */ i((e, t) => {
46
+ var w = /* @__PURE__ */ i((e, t) => {
47
47
  let o = Object.getPrototypeOf(e);
48
- return !o || t(o) ? o : v(o, t);
49
- }, "findProto"), N = /* @__PURE__ */ i((e) => !!(typeof e == "object" && e && v(e, (t) => /^Synthetic(?:Base)?Event$/.test(t.constructor.name)) &&
48
+ return !o || t(o) ? o : w(o, t);
49
+ }, "findProto"), N = /* @__PURE__ */ i((e) => !!(typeof e == "object" && e && w(e, (t) => /^Synthetic(?:Base)?Event$/.test(t.constructor.name)) &&
50
50
  typeof e.persist == "function"), "isReactSyntheticEvent"), V = /* @__PURE__ */ i((e) => {
51
51
  if (N(e)) {
52
52
  let t = Object.create(
@@ -62,7 +62,7 @@ typeof e.persist == "function"), "isReactSyntheticEvent"), V = /* @__PURE__ */ i
62
62
  }
63
63
  return e;
64
64
  }, "serializeArg");
65
- function g(e, t = {}) {
65
+ function y(e, t = {}) {
66
66
  let o = {
67
67
  ...R,
68
68
  ...t
@@ -83,24 +83,24 @@ function g(e, t = {}) {
83
83
  throw b;
84
84
  }
85
85
  }
86
- let a = w.addons.getChannel(), c = Date.now().toString(36) + Math.random().toString(36).substring(2), p = 5, m = s.map(V), P = s.length >
86
+ let p = T.addons.getChannel(), c = Date.now().toString(36) + Math.random().toString(36).substring(2), a = 5, m = s.map(V), P = s.length >
87
87
  1 ? m : m[0], S = {
88
88
  id: c,
89
89
  count: 0,
90
90
  data: { name: e, args: P },
91
91
  options: {
92
92
  ...o,
93
- maxDepth: p + (o.depth || 3)
93
+ maxDepth: a + (o.depth || 3)
94
94
  }
95
95
  };
96
- a.emit(E, S);
96
+ p.emit(E, S);
97
97
  }, "actionHandler");
98
98
  return r.isAction = !0, r.implicit = t.implicit, r;
99
99
  }
100
- i(g, "action");
100
+ i(y, "action");
101
101
 
102
102
  // src/actions/addArgsHelpers.ts
103
- var T = /* @__PURE__ */ i((e, t) => typeof t[e] > "u" && !(e in t), "isInInitialArgs"), _ = /* @__PURE__ */ i((e) => {
103
+ var v = /* @__PURE__ */ i((e, t) => typeof t[e] > "u" && !(e in t), "isInInitialArgs"), _ = /* @__PURE__ */ i((e) => {
104
104
  let {
105
105
  initialArgs: t,
106
106
  argTypes: o,
@@ -112,15 +112,15 @@ var T = /* @__PURE__ */ i((e, t) => typeof t[e] > "u" && !(e in t), "isInInitial
112
112
  let s = new RegExp(n.argTypesRegex);
113
113
  return Object.entries(o).filter(
114
114
  ([c]) => !!s.test(c)
115
- ).reduce((c, [p, m]) => (T(p, t) && (c[p] = g(p, { implicit: !0, id: r })), c), {});
115
+ ).reduce((c, [a, m]) => (v(a, t) && (c[a] = y(a, { implicit: !0, id: r })), c), {});
116
116
  }, "inferActionsFromArgTypesRegex"), D = /* @__PURE__ */ i((e) => {
117
117
  let {
118
118
  initialArgs: t,
119
119
  argTypes: o,
120
120
  parameters: { actions: r }
121
121
  } = e;
122
- return r?.disable || !o ? {} : Object.entries(o).filter(([s, a]) => !!a.action).reduce((s, [a, c]) => (T(a, t) && (s[a] = g(typeof c.action ==
123
- "string" ? c.action : a)), s), {});
122
+ return r?.disable || !o ? {} : Object.entries(o).filter(([s, p]) => !!p.action).reduce((s, [p, c]) => (v(p, t) && (s[p] = y(typeof c.action ==
123
+ "string" ? c.action : p)), s), {});
124
124
  }, "addActionsFromArgTypes");
125
125
 
126
126
  // src/actions/addArgs.ts
@@ -131,7 +131,7 @@ var Y = [
131
131
 
132
132
  // src/actions/loaders.ts
133
133
  var h = {};
134
- y(h, {
134
+ l(h, {
135
135
  loaders: () => B
136
136
  });
137
137
  var I = require("storybook/test");
@@ -148,12 +148,12 @@ var k = !1, $ = /* @__PURE__ */ i((e) => {
148
148
  "next/headers::cookies().delete",
149
149
  "next/headers::headers().set",
150
150
  "next/headers::headers().delete"
151
- ].some((s) => n.startsWith(s))) && g(n)(r);
151
+ ].some((s) => n.startsWith(s))) && y(n)(r);
152
152
  }), k = !0);
153
153
  }, "logActionsWhenMockCalled"), B = [$];
154
154
 
155
155
  // src/actions/preview.ts
156
- var K = /* @__PURE__ */ i(() => (0, j.definePreview)({
156
+ var K = /* @__PURE__ */ i(() => (0, j.definePreviewAddon)({
157
157
  ...A,
158
158
  ...h
159
159
  }), "default");