storybook 9.0.0-beta.1 → 9.0.0-beta.11

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 (94) hide show
  1. package/assets/server/base-preview-head.html +2 -1
  2. package/dist/actions/decorator.js +49 -52
  3. package/dist/actions/index.cjs +42 -44
  4. package/dist/actions/index.js +37 -40
  5. package/dist/actions/preview.cjs +44 -46
  6. package/dist/actions/preview.d.ts +501 -0
  7. package/dist/actions/preview.js +24 -27
  8. package/dist/babel/index.cjs +15060 -14974
  9. package/dist/babel/index.d.ts +37 -18
  10. package/dist/babel/index.js +15097 -15011
  11. package/dist/backgrounds/index.d.ts +501 -0
  12. package/dist/backgrounds/preview.d.ts +501 -0
  13. package/dist/bin/index.cjs +44 -44
  14. package/dist/bin/index.js +44 -44
  15. package/dist/builder-manager/index.cjs +303 -283
  16. package/dist/builder-manager/index.js +545 -524
  17. package/dist/channels/index.js +919 -941
  18. package/dist/cli/bin/index.cjs +4184 -736
  19. package/dist/cli/bin/index.js +4198 -748
  20. package/dist/cli/index.cjs +36838 -28392
  21. package/dist/cli/index.d.ts +974 -1
  22. package/dist/cli/index.js +41620 -33168
  23. package/dist/client-logger/index.d.ts +2 -1
  24. package/dist/common/index.cjs +4783 -4691
  25. package/dist/common/index.d.ts +8 -2
  26. package/dist/common/index.js +5165 -5069
  27. package/dist/components/index.cjs +7905 -5600
  28. package/dist/components/index.d.ts +12 -12
  29. package/dist/components/index.js +4713 -3786
  30. package/dist/controls/preview.d.ts +501 -0
  31. package/dist/core-server/index.cjs +6799 -6708
  32. package/dist/core-server/index.d.ts +526 -25
  33. package/dist/core-server/index.js +6948 -6851
  34. package/dist/core-server/presets/common-manager.js +4528 -3377
  35. package/dist/core-server/presets/common-override-preset.cjs +10 -12
  36. package/dist/core-server/presets/common-override-preset.js +3 -5
  37. package/dist/core-server/presets/common-preset.cjs +2301 -2238
  38. package/dist/core-server/presets/common-preset.js +2389 -2322
  39. package/dist/docs-tools/index.cjs +484 -464
  40. package/dist/docs-tools/index.js +781 -768
  41. package/dist/highlight/index.cjs +19 -18
  42. package/dist/highlight/index.d.ts +4 -5
  43. package/dist/highlight/index.js +3 -2
  44. package/dist/highlight/preview.cjs +314 -310
  45. package/dist/highlight/preview.d.ts +501 -0
  46. package/dist/highlight/preview.js +296 -292
  47. package/dist/instrumenter/index.cjs +561 -559
  48. package/dist/instrumenter/index.js +1564 -1516
  49. package/dist/manager/globals-module-info.cjs +2 -0
  50. package/dist/manager/globals-module-info.js +2 -0
  51. package/dist/manager/globals-runtime.js +23602 -23339
  52. package/dist/manager/runtime.js +4891 -4650
  53. package/dist/manager-api/index.cjs +2400 -2321
  54. package/dist/manager-api/index.d.ts +513 -1
  55. package/dist/manager-api/index.js +1951 -1903
  56. package/dist/manager-errors.js +37 -41
  57. package/dist/measure/index.d.ts +501 -0
  58. package/dist/measure/preview.d.ts +501 -0
  59. package/dist/node-logger/index.cjs +25 -25
  60. package/dist/node-logger/index.js +25 -25
  61. package/dist/outline/index.d.ts +501 -0
  62. package/dist/outline/preview.d.ts +501 -0
  63. package/dist/preview/runtime.js +35803 -35785
  64. package/dist/preview-api/index.cjs +1287 -1265
  65. package/dist/preview-api/index.d.ts +1 -1
  66. package/dist/preview-api/index.js +1367 -1361
  67. package/dist/preview-errors.js +152 -173
  68. package/dist/router/index.cjs +5674 -2282
  69. package/dist/router/index.d.ts +622 -243
  70. package/dist/router/index.js +1318 -872
  71. package/dist/server-errors.cjs +192 -177
  72. package/dist/server-errors.d.ts +11 -1
  73. package/dist/server-errors.js +173 -158
  74. package/dist/telemetry/index.cjs +4934 -1445
  75. package/dist/telemetry/index.d.ts +2 -1
  76. package/dist/telemetry/index.js +4966 -1475
  77. package/dist/test/index.cjs +1876 -1878
  78. package/dist/test/index.d.ts +1269 -83
  79. package/dist/test/index.js +9157 -9248
  80. package/dist/test/preview.cjs +49 -15862
  81. package/dist/test/preview.d.ts +520 -13
  82. package/dist/test/preview.js +42 -14493
  83. package/dist/theming/create.cjs +2244 -79
  84. package/dist/theming/create.js +951 -67
  85. package/dist/theming/index.cjs +3209 -1067
  86. package/dist/theming/index.js +1816 -947
  87. package/dist/types/index.cjs +4 -4
  88. package/dist/types/index.d.ts +3124 -2596
  89. package/dist/viewport/index.d.ts +502 -3
  90. package/dist/viewport/preview.d.ts +501 -0
  91. package/package.json +14 -38
  92. package/dist/test/spy.cjs +0 -258
  93. package/dist/test/spy.d.ts +0 -66
  94. package/dist/test/spy.js +0 -240
@@ -197,7 +197,8 @@
197
197
  line-height: 19px;
198
198
  border-radius: 4px;
199
199
 
200
- font-family: 'Operator Mono', 'Fira Code Retina', 'Fira Code', 'FiraCode-Retina', 'Andale Mono',
200
+ font-family:
201
+ 'Operator Mono', 'Fira Code Retina', 'Fira Code', 'FiraCode-Retina', 'Andale Mono',
201
202
  'Lucida Console', Consolas, Monaco, monospace;
202
203
  margin: 0;
203
204
  overflow: auto;
@@ -1,17 +1,16 @@
1
- var R = Object.defineProperty;
2
- var r = (e, o) => R(e, "name", { value: o, configurable: !0 });
1
+ var D = Object.defineProperty;
2
+ var r = (e, n) => D(e, "name", { value: n, configurable: !0 });
3
3
 
4
4
  // src/actions/decorator.ts
5
- import { makeDecorator as T, useEffect as k } from "storybook/preview-api";
5
+ import { makeDecorator as P, useEffect as x } from "storybook/preview-api";
6
6
 
7
7
  // src/actions/constants.ts
8
- var h = "actions", y = "storybook/actions", B = `${y}/panel`, g = `${y}/action-event`, H = `${y}/action-clear`;
8
+ var h = "actions", y = "storybook/actions", $ = `${y}/panel`, g = `${y}/action-event`, B = `${y}/action-clear`;
9
9
 
10
10
  // src/actions/runtime/action.ts
11
- import { ImplicitActionsDuringRendering as D } from "storybook/internal/preview-errors";
11
+ import { ImplicitActionsDuringRendering as R } from "storybook/internal/preview-errors";
12
12
  import { global as E } from "@storybook/global";
13
- import { addons as j } from "storybook/preview-api";
14
- import { v4 as S } from "uuid";
13
+ import { addons as S } from "storybook/preview-api";
15
14
 
16
15
  // src/actions/runtime/configureActions.ts
17
16
  var a = {
@@ -21,39 +20,36 @@ var a = {
21
20
  };
22
21
 
23
22
  // src/actions/runtime/action.ts
24
- var A = /* @__PURE__ */ r((e, o) => {
23
+ var A = /* @__PURE__ */ r((e, n) => {
25
24
  let t = Object.getPrototypeOf(e);
26
- return !t || o(t) ? t : A(t, o);
27
- }, "findProto"), I = /* @__PURE__ */ r((e) => !!(typeof e == "object" && e && A(e, (o) => /^Synthetic(?:Base)?Event$/.test(o.constructor.name)) &&
28
- typeof e.persist == "function"), "isReactSyntheticEvent"), P = /* @__PURE__ */ r((e) => {
29
- if (I(e)) {
30
- let o = Object.create(
25
+ return !t || n(t) ? t : A(t, n);
26
+ }, "findProto"), j = /* @__PURE__ */ r((e) => !!(typeof e == "object" && e && A(e, (n) => /^Synthetic(?:Base)?Event$/.test(n.constructor.name)) &&
27
+ typeof e.persist == "function"), "isReactSyntheticEvent"), I = /* @__PURE__ */ r((e) => {
28
+ if (j(e)) {
29
+ let n = Object.create(
31
30
  e.constructor.prototype,
32
31
  Object.getOwnPropertyDescriptors(e)
33
32
  );
34
- o.persist();
35
- let t = Object.getOwnPropertyDescriptor(o, "view"), n = t?.value;
36
- return typeof n == "object" && n?.constructor.name === "Window" && Object.defineProperty(o, "view", {
33
+ n.persist();
34
+ let t = Object.getOwnPropertyDescriptor(n, "view"), o = t?.value;
35
+ return typeof o == "object" && o?.constructor.name === "Window" && Object.defineProperty(n, "view", {
37
36
  ...t,
38
- value: Object.create(n.constructor.prototype)
39
- }), o;
37
+ value: Object.create(o.constructor.prototype)
38
+ }), n;
40
39
  }
41
40
  return e;
42
- }, "serializeArg"), x = /* @__PURE__ */ r(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? S() : (
43
- // pseudo random id, example response lo1e7zm4832bkr7yfl7
44
- Date.now().toString(36) + Math.random().toString(36).substring(2)
45
- ), "generateId");
46
- function O(e, o = {}) {
41
+ }, "serializeArg");
42
+ function O(e, n = {}) {
47
43
  let t = {
48
44
  ...a,
49
- ...o
50
- }, n = /* @__PURE__ */ r(function(...i) {
51
- if (o.implicit) {
45
+ ...n
46
+ }, o = /* @__PURE__ */ r(function(...i) {
47
+ if (n.implicit) {
52
48
  let d = ("__STORYBOOK_PREVIEW__" in E ? E.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
53
49
  (c) => c.phase === "playing" || c.phase === "rendering"
54
50
  );
55
51
  if (d) {
56
- let c = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, u = new D({
52
+ let c = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, u = new R({
57
53
  phase: d.phase,
58
54
  name: e,
59
55
  deprecated: c
@@ -64,7 +60,8 @@ function O(e, o = {}) {
64
60
  throw u;
65
61
  }
66
62
  }
67
- let m = j.getChannel(), p = x(), l = 5, f = i.map(P), w = i.length > 1 ? f : f[0], _ = {
63
+ let m = S.getChannel(), p = Date.now().toString(36) + Math.random().toString(36).substring(2), l = 5, f = i.map(I), w = i.length > 1 ? f :
64
+ f[0], _ = {
68
65
  id: p,
69
66
  count: 0,
70
67
  data: { name: e, args: w },
@@ -75,38 +72,38 @@ function O(e, o = {}) {
75
72
  };
76
73
  m.emit(g, _);
77
74
  }, "actionHandler");
78
- return n.isAction = !0, n.implicit = o.implicit, n;
75
+ return o.isAction = !0, o.implicit = n.implicit, o;
79
76
  }
80
77
  r(O, "action");
81
78
 
82
79
  // src/actions/runtime/actions.ts
83
80
  var b = /* @__PURE__ */ r((...e) => {
84
- let o = a, t = e;
85
- t.length === 1 && Array.isArray(t[0]) && ([t] = t), t.length !== 1 && typeof t[t.length - 1] != "string" && (o = {
81
+ let n = a, t = e;
82
+ t.length === 1 && Array.isArray(t[0]) && ([t] = t), t.length !== 1 && typeof t[t.length - 1] != "string" && (n = {
86
83
  ...a,
87
84
  ...t.pop()
88
85
  });
89
- let n = t[0];
90
- (t.length !== 1 || typeof n == "string") && (n = {}, t.forEach((i) => {
91
- n[i] = i;
86
+ let o = t[0];
87
+ (t.length !== 1 || typeof o == "string") && (o = {}, t.forEach((i) => {
88
+ o[i] = i;
92
89
  }));
93
90
  let s = {};
94
- return Object.keys(n).forEach((i) => {
95
- s[i] = O(n[i], o);
91
+ return Object.keys(o).forEach((i) => {
92
+ s[i] = O(o[i], n);
96
93
  }), s;
97
94
  }, "actions");
98
95
 
99
96
  // src/actions/decorator.ts
100
- var F = /^(\S+)\s*(.*)$/, M = Element != null && !Element.prototype.matches, C = M ? "msMatchesSelector" : "matches", v = /* @__PURE__ */ r(
101
- (e, o) => {
102
- if (e[C](o))
97
+ var T = /^(\S+)\s*(.*)$/, k = Element != null && !Element.prototype.matches, F = k ? "msMatchesSelector" : "matches", v = /* @__PURE__ */ r(
98
+ (e, n) => {
99
+ if (e[F](n))
103
100
  return !0;
104
101
  let t = e.parentElement;
105
- return t ? v(t, o) : !1;
106
- }, "hasMatchInAncestry"), N = /* @__PURE__ */ r((e, ...o) => {
107
- let t = e(...o);
108
- return Object.entries(t).map(([n, s]) => {
109
- let [i, m, p] = n.match(F) || [];
102
+ return t ? v(t, n) : !1;
103
+ }, "hasMatchInAncestry"), M = /* @__PURE__ */ r((e, ...n) => {
104
+ let t = e(...n);
105
+ return Object.entries(t).map(([o, s]) => {
106
+ let [i, m, p] = o.match(T) || [];
110
107
  return {
111
108
  eventName: m,
112
109
  handler: /* @__PURE__ */ r((l) => {
@@ -114,21 +111,21 @@ var F = /^(\S+)\s*(.*)$/, M = Element != null && !Element.prototype.matches, C =
114
111
  }, "handler")
115
112
  };
116
113
  });
117
- }, "createHandlers"), V = /* @__PURE__ */ r((e, ...o) => {
114
+ }, "createHandlers"), C = /* @__PURE__ */ r((e, ...n) => {
118
115
  let t = typeof globalThis.document < "u" && globalThis.document.getElementById("storybook-root");
119
- k(() => {
116
+ x(() => {
120
117
  if (t) {
121
- let n = N(e, ...o);
122
- return n.forEach(({ eventName: s, handler: i }) => t.addEventListener(s, i)), () => n.forEach(({ eventName: s, handler: i }) => t.removeEventListener(
118
+ let o = M(e, ...n);
119
+ return o.forEach(({ eventName: s, handler: i }) => t.addEventListener(s, i)), () => o.forEach(({ eventName: s, handler: i }) => t.removeEventListener(
123
120
  s, i));
124
121
  }
125
- }, [t, e, o]);
126
- }, "applyEventHandlers"), ct = T({
122
+ }, [t, e, n]);
123
+ }, "applyEventHandlers"), rt = P({
127
124
  name: "withActions",
128
125
  parameterName: h,
129
126
  skipIfNoParametersOrOptions: !0,
130
- wrapper: /* @__PURE__ */ r((e, o, { parameters: t }) => (t?.handles && V(b, ...t.handles), e(o)), "wrapper")
127
+ wrapper: /* @__PURE__ */ r((e, n, { parameters: t }) => (t?.handles && C(b, ...t.handles), e(n)), "wrapper")
131
128
  });
132
129
  export {
133
- ct as withActions
130
+ rt as withActions
134
131
  };
@@ -1,58 +1,58 @@
1
1
  "use strict";
2
2
  var a = Object.defineProperty;
3
- var x = Object.getOwnPropertyDescriptor;
4
- var R = Object.getOwnPropertyNames;
5
- var j = Object.prototype.hasOwnProperty;
6
- var r = (t, o) => a(t, "name", { value: o, configurable: !0 });
7
- var I = (t, o) => {
3
+ var D = Object.getOwnPropertyDescriptor;
4
+ var x = Object.getOwnPropertyNames;
5
+ var R = Object.prototype.hasOwnProperty;
6
+ var i = (t, o) => a(t, "name", { value: o, configurable: !0 });
7
+ var j = (t, o) => {
8
8
  for (var n in o)
9
9
  a(t, n, { get: o[n], enumerable: !0 });
10
10
  }, P = (t, o, n, e) => {
11
11
  if (o && typeof o == "object" || typeof o == "function")
12
- for (let i of R(o))
13
- !j.call(t, i) && i !== n && a(t, i, { get: () => o[i], enumerable: !(e = x(o, i)) || e.enumerable });
12
+ for (let r of x(o))
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
16
  var S = (t) => P(a({}, "__esModule", { value: !0 }), t);
17
17
 
18
18
  // src/actions/index.ts
19
- var K = {};
20
- I(K, {
21
- ADDON_ID: () => m,
22
- CLEAR_ID: () => C,
23
- CYCLIC_KEY: () => F,
24
- EVENT_ID: () => y,
25
- PANEL_ID: () => k,
26
- PARAM_KEY: () => T,
27
- action: () => l,
28
- actions: () => B,
19
+ var $ = {};
20
+ j($, {
21
+ ADDON_ID: () => l,
22
+ CLEAR_ID: () => k,
23
+ CYCLIC_KEY: () => C,
24
+ EVENT_ID: () => m,
25
+ PANEL_ID: () => T,
26
+ PARAM_KEY: () => I,
27
+ action: () => f,
28
+ actions: () => Y,
29
29
  config: () => s,
30
- configureActions: () => V
30
+ configureActions: () => F
31
31
  });
32
- module.exports = S(K);
32
+ module.exports = S($);
33
33
 
34
34
  // src/actions/constants.ts
35
- var T = "actions", m = "storybook/actions", k = `${m}/panel`, y = `${m}/action-event`, C = `${m}/action-clear`, F = "$___storybook.isCyclic";
35
+ var I = "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"), f = require("@storybook/global"), O = require("storybook/preview-api"), h = require("uuid");
38
+ var A = require("storybook/internal/preview-errors"), y = require("@storybook/global"), O = require("storybook/preview-api");
39
39
 
40
40
  // src/actions/runtime/configureActions.ts
41
41
  var s = {
42
42
  depth: 10,
43
43
  clearOnStoryChange: !0,
44
44
  limit: 50
45
- }, V = /* @__PURE__ */ r((t = {}) => {
45
+ }, F = /* @__PURE__ */ i((t = {}) => {
46
46
  Object.assign(s, t);
47
47
  }, "configureActions");
48
48
 
49
49
  // src/actions/runtime/action.ts
50
- var b = /* @__PURE__ */ r((t, o) => {
50
+ var h = /* @__PURE__ */ i((t, o) => {
51
51
  let n = Object.getPrototypeOf(t);
52
- return !n || o(n) ? n : b(n, o);
53
- }, "findProto"), W = /* @__PURE__ */ r((t) => !!(typeof t == "object" && t && b(t, (o) => /^Synthetic(?:Base)?Event$/.test(o.constructor.name)) &&
54
- typeof t.persist == "function"), "isReactSyntheticEvent"), Y = /* @__PURE__ */ r((t) => {
55
- if (W(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)) &&
54
+ typeof t.persist == "function"), "isReactSyntheticEvent"), W = /* @__PURE__ */ i((t) => {
55
+ if (V(t)) {
56
56
  let o = Object.create(
57
57
  t.constructor.prototype,
58
58
  Object.getOwnPropertyDescriptors(t)
@@ -65,22 +65,19 @@ typeof t.persist == "function"), "isReactSyntheticEvent"), Y = /* @__PURE__ */ r
65
65
  }), o;
66
66
  }
67
67
  return t;
68
- }, "serializeArg"), $ = /* @__PURE__ */ r(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? (0, h.v4)() : (
69
- // pseudo random id, example response lo1e7zm4832bkr7yfl7
70
- Date.now().toString(36) + Math.random().toString(36).substring(2)
71
- ), "generateId");
72
- function l(t, o = {}) {
68
+ }, "serializeArg");
69
+ function f(t, o = {}) {
73
70
  let n = {
74
71
  ...s,
75
72
  ...o
76
- }, e = /* @__PURE__ */ r(function(...c) {
73
+ }, e = /* @__PURE__ */ i(function(...c) {
77
74
  if (o.implicit) {
78
- let d = ("__STORYBOOK_PREVIEW__" in f.global ? f.global.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
75
+ let u = ("__STORYBOOK_PREVIEW__" in y.global ? y.global.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
79
76
  (p) => p.phase === "playing" || p.phase === "rendering"
80
77
  );
81
- if (d) {
78
+ if (u) {
82
79
  let p = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, g = new A.ImplicitActionsDuringRendering({
83
- phase: d.phase,
80
+ phase: u.phase,
84
81
  name: t,
85
82
  deprecated: p
86
83
  });
@@ -90,8 +87,9 @@ function l(t, o = {}) {
90
87
  throw g;
91
88
  }
92
89
  }
93
- let E = O.addons.getChannel(), v = $(), w = 5, u = c.map(Y), _ = c.length > 1 ? u : u[0], D = {
94
- id: v,
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 >
91
+ 1 ? d : d[0], v = {
92
+ id: b,
95
93
  count: 0,
96
94
  data: { name: t, args: _ },
97
95
  options: {
@@ -99,14 +97,14 @@ function l(t, o = {}) {
99
97
  maxDepth: w + (n.depth || 3)
100
98
  }
101
99
  };
102
- E.emit(y, D);
100
+ E.emit(m, v);
103
101
  }, "actionHandler");
104
102
  return e.isAction = !0, e.implicit = o.implicit, e;
105
103
  }
106
- r(l, "action");
104
+ i(f, "action");
107
105
 
108
106
  // src/actions/runtime/actions.ts
109
- var B = /* @__PURE__ */ r((...t) => {
107
+ var Y = /* @__PURE__ */ i((...t) => {
110
108
  let o = s, n = t;
111
109
  n.length === 1 && Array.isArray(n[0]) && ([n] = n), n.length !== 1 && typeof n[n.length - 1] != "string" && (o = {
112
110
  ...s,
@@ -116,8 +114,8 @@ var B = /* @__PURE__ */ r((...t) => {
116
114
  (n.length !== 1 || typeof e == "string") && (e = {}, n.forEach((c) => {
117
115
  e[c] = c;
118
116
  }));
119
- let i = {};
117
+ let r = {};
120
118
  return Object.keys(e).forEach((c) => {
121
- i[c] = l(e[c], o);
122
- }), i;
119
+ r[c] = f(e[c], o);
120
+ }), r;
123
121
  }, "actions");
@@ -1,31 +1,30 @@
1
- var v = Object.defineProperty;
2
- var r = (o, n) => v(o, "name", { value: n, configurable: !0 });
1
+ var w = Object.defineProperty;
2
+ var i = (o, n) => w(o, "name", { value: n, configurable: !0 });
3
3
 
4
4
  // src/actions/constants.ts
5
- var S = "actions", a = "storybook/actions", T = `${a}/panel`, l = `${a}/action-event`, k = `${a}/action-clear`, C = "$___storybook.isCyclic";
5
+ var P = "actions", a = "storybook/actions", S = `${a}/panel`, f = `${a}/action-event`, I = `${a}/action-clear`, T = "$___storybook.isCyclic";
6
6
 
7
7
  // src/actions/runtime/action.ts
8
- import { ImplicitActionsDuringRendering as w } from "storybook/internal/preview-errors";
9
- import { global as u } from "@storybook/global";
10
- import { addons as _ } from "storybook/preview-api";
11
- import { v4 as D } from "uuid";
8
+ import { ImplicitActionsDuringRendering as _ } from "storybook/internal/preview-errors";
9
+ import { global as d } from "@storybook/global";
10
+ import { addons as v } from "storybook/preview-api";
12
11
 
13
12
  // src/actions/runtime/configureActions.ts
14
13
  var c = {
15
14
  depth: 10,
16
15
  clearOnStoryChange: !0,
17
16
  limit: 50
18
- }, V = /* @__PURE__ */ r((o = {}) => {
17
+ }, C = /* @__PURE__ */ i((o = {}) => {
19
18
  Object.assign(c, o);
20
19
  }, "configureActions");
21
20
 
22
21
  // src/actions/runtime/action.ts
23
- var d = /* @__PURE__ */ r((o, n) => {
22
+ var u = /* @__PURE__ */ i((o, n) => {
24
23
  let t = Object.getPrototypeOf(o);
25
- return !t || n(t) ? t : d(t, n);
26
- }, "findProto"), x = /* @__PURE__ */ r((o) => !!(typeof o == "object" && o && d(o, (n) => /^Synthetic(?:Base)?Event$/.test(n.constructor.name)) &&
27
- typeof o.persist == "function"), "isReactSyntheticEvent"), R = /* @__PURE__ */ r((o) => {
28
- if (x(o)) {
24
+ return !t || n(t) ? t : u(t, n);
25
+ }, "findProto"), D = /* @__PURE__ */ i((o) => !!(typeof o == "object" && o && u(o, (n) => /^Synthetic(?:Base)?Event$/.test(n.constructor.name)) &&
26
+ typeof o.persist == "function"), "isReactSyntheticEvent"), x = /* @__PURE__ */ i((o) => {
27
+ if (D(o)) {
29
28
  let n = Object.create(
30
29
  o.constructor.prototype,
31
30
  Object.getOwnPropertyDescriptors(o)
@@ -38,71 +37,69 @@ typeof o.persist == "function"), "isReactSyntheticEvent"), R = /* @__PURE__ */ r
38
37
  }), n;
39
38
  }
40
39
  return o;
41
- }, "serializeArg"), j = /* @__PURE__ */ r(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? D() : (
42
- // pseudo random id, example response lo1e7zm4832bkr7yfl7
43
- Date.now().toString(36) + Math.random().toString(36).substring(2)
44
- ), "generateId");
40
+ }, "serializeArg");
45
41
  function g(o, n = {}) {
46
42
  let t = {
47
43
  ...c,
48
44
  ...n
49
- }, e = /* @__PURE__ */ r(function(...i) {
45
+ }, e = /* @__PURE__ */ i(function(...r) {
50
46
  if (n.implicit) {
51
- let y = ("__STORYBOOK_PREVIEW__" in u ? u.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
47
+ let m = ("__STORYBOOK_PREVIEW__" in d ? d.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
52
48
  (s) => s.phase === "playing" || s.phase === "rendering"
53
49
  );
54
- if (y) {
55
- let s = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, f = new w({
56
- phase: y.phase,
50
+ if (m) {
51
+ let s = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, y = new _({
52
+ phase: m.phase,
57
53
  name: o,
58
54
  deprecated: s
59
55
  });
60
56
  if (s)
61
- console.warn(f);
57
+ console.warn(y);
62
58
  else
63
- throw f;
59
+ throw y;
64
60
  }
65
61
  }
66
- let A = _.getChannel(), O = j(), h = 5, m = i.map(R), b = i.length > 1 ? m : m[0], E = {
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 :
63
+ l[0], b = {
67
64
  id: O,
68
65
  count: 0,
69
- data: { name: o, args: b },
66
+ data: { name: o, args: E },
70
67
  options: {
71
68
  ...t,
72
69
  maxDepth: h + (t.depth || 3)
73
70
  }
74
71
  };
75
- A.emit(l, E);
72
+ A.emit(f, b);
76
73
  }, "actionHandler");
77
74
  return e.isAction = !0, e.implicit = n.implicit, e;
78
75
  }
79
- r(g, "action");
76
+ i(g, "action");
80
77
 
81
78
  // src/actions/runtime/actions.ts
82
- var G = /* @__PURE__ */ r((...o) => {
79
+ var L = /* @__PURE__ */ i((...o) => {
83
80
  let n = c, t = o;
84
81
  t.length === 1 && Array.isArray(t[0]) && ([t] = t), t.length !== 1 && typeof t[t.length - 1] != "string" && (n = {
85
82
  ...c,
86
83
  ...t.pop()
87
84
  });
88
85
  let e = t[0];
89
- (t.length !== 1 || typeof e == "string") && (e = {}, t.forEach((i) => {
90
- e[i] = i;
86
+ (t.length !== 1 || typeof e == "string") && (e = {}, t.forEach((r) => {
87
+ e[r] = r;
91
88
  }));
92
89
  let p = {};
93
- return Object.keys(e).forEach((i) => {
94
- p[i] = g(e[i], n);
90
+ return Object.keys(e).forEach((r) => {
91
+ p[r] = g(e[r], n);
95
92
  }), p;
96
93
  }, "actions");
97
94
  export {
98
95
  a as ADDON_ID,
99
- k as CLEAR_ID,
100
- C as CYCLIC_KEY,
101
- l as EVENT_ID,
102
- T as PANEL_ID,
103
- S as PARAM_KEY,
96
+ I as CLEAR_ID,
97
+ T as CYCLIC_KEY,
98
+ f as EVENT_ID,
99
+ S as PANEL_ID,
100
+ P as PARAM_KEY,
104
101
  g as action,
105
- G as actions,
102
+ L as actions,
106
103
  c as config,
107
- V as configureActions
104
+ C as configureActions
108
105
  };