storybook 9.0.0-alpha.2 → 9.0.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 (79) hide show
  1. package/README.md +1 -1
  2. package/dist/actions/decorator.d.ts +6 -0
  3. package/dist/actions/decorator.js +139 -0
  4. package/dist/actions/index.cjs +127 -0
  5. package/dist/actions/index.d.ts +105 -0
  6. package/dist/actions/index.js +112 -0
  7. package/dist/actions/manager.js +1196 -0
  8. package/dist/actions/preview.cjs +165 -0
  9. package/dist/actions/preview.d.ts +55 -0
  10. package/dist/actions/preview.js +156 -0
  11. package/dist/bin/index.cjs +63 -65
  12. package/dist/bin/index.js +63 -65
  13. package/dist/channels/index.cjs +209 -234
  14. package/dist/channels/index.js +304 -308
  15. package/dist/cli/bin/index.cjs +409 -409
  16. package/dist/cli/bin/index.js +414 -414
  17. package/dist/cli/index.cjs +1 -1
  18. package/dist/cli/index.d.ts +2 -2
  19. package/dist/cli/index.js +1 -1
  20. package/dist/client-logger/index.cjs +56 -88
  21. package/dist/client-logger/index.js +41 -47
  22. package/dist/common/index.cjs +148 -148
  23. package/dist/common/index.d.ts +1 -5
  24. package/dist/common/index.js +171 -171
  25. package/dist/components/index.cjs +9413 -11578
  26. package/dist/components/index.d.ts +92 -92
  27. package/dist/components/index.js +6768 -7544
  28. package/dist/core-events/index.d.ts +138 -25
  29. package/dist/core-server/index.cjs +5244 -5270
  30. package/dist/core-server/index.d.ts +1 -1
  31. package/dist/core-server/index.js +5356 -5380
  32. package/dist/core-server/presets/common-manager.js +11 -19
  33. package/dist/core-server/presets/common-preset.cjs +243 -242
  34. package/dist/core-server/presets/common-preset.js +379 -378
  35. package/dist/csf/index.cjs +76 -120
  36. package/dist/csf/index.d.ts +1 -3
  37. package/dist/csf/index.js +69 -113
  38. package/dist/docs-tools/index.cjs +1 -1
  39. package/dist/docs-tools/index.d.ts +2 -2
  40. package/dist/docs-tools/index.js +1 -1
  41. package/dist/instrumenter/index.cjs +1260 -1289
  42. package/dist/instrumenter/index.js +1344 -1348
  43. package/dist/manager/globals-module-info.cjs +272 -135
  44. package/dist/manager/globals-module-info.d.ts +1 -1
  45. package/dist/manager/globals-module-info.js +257 -120
  46. package/dist/manager/globals-runtime.js +59553 -22373
  47. package/dist/manager/globals.cjs +23 -19
  48. package/dist/manager/globals.d.ts +8 -5
  49. package/dist/manager/globals.js +10 -6
  50. package/dist/manager/runtime.js +129 -129
  51. package/dist/manager-api/index.cjs +1184 -1209
  52. package/dist/manager-api/index.d.ts +3 -3
  53. package/dist/manager-api/index.js +1012 -1012
  54. package/dist/preview/globals.cjs +21 -17
  55. package/dist/preview/globals.d.ts +4 -1
  56. package/dist/preview/globals.js +6 -2
  57. package/dist/preview/runtime.js +43946 -6548
  58. package/dist/preview-api/index.cjs +1245 -1243
  59. package/dist/preview-api/index.d.ts +105 -61
  60. package/dist/preview-api/index.js +1311 -1273
  61. package/dist/preview-errors.cjs +1 -1
  62. package/dist/preview-errors.js +1 -1
  63. package/dist/router/index.cjs +847 -871
  64. package/dist/router/index.js +193 -199
  65. package/dist/test/index.cjs +34778 -0
  66. package/dist/test/index.d.ts +186 -0
  67. package/dist/test/index.js +32916 -0
  68. package/dist/test/preview.cjs +15870 -0
  69. package/dist/test/preview.d.ts +54 -0
  70. package/dist/test/preview.js +14441 -0
  71. package/dist/test/spy.cjs +258 -0
  72. package/dist/test/spy.d.ts +66 -0
  73. package/dist/test/spy.js +240 -0
  74. package/dist/theming/create.cjs +79 -2269
  75. package/dist/theming/create.js +67 -841
  76. package/dist/theming/index.cjs +1065 -3232
  77. package/dist/theming/index.js +951 -1719
  78. package/dist/types/index.d.ts +242 -242
  79. package/package.json +155 -3
package/README.md CHANGED
@@ -20,7 +20,7 @@ Even though this is where all of the code is located, it is NOT to be the entry
20
20
  Consumers of the code should import like so:
21
21
 
22
22
  ```ts
23
- import { addons } from 'storybook/internal/manager-api';
23
+ import { addons } from 'storybook/manager-api';
24
24
  ```
25
25
 
26
26
  Importing from `@storybook/core` is explicitly NOT supported; it WILL break in a future version of storybook, very likely in a non-major version bump.
@@ -0,0 +1,6 @@
1
+ import { Renderer, PartialStoryFn } from 'storybook/internal/types';
2
+
3
+ /** @deprecated Will be removed in Storybook v10 */
4
+ declare const withActions: <T extends Renderer>(storyFn: PartialStoryFn<T>) => T['storyResult'];
5
+
6
+ export { withActions };
@@ -0,0 +1,139 @@
1
+ var j = Object.defineProperty;
2
+ var r = (o, e) => j(o, "name", { value: e, configurable: !0 });
3
+
4
+ // src/actions/decorator.ts
5
+ import { global as F } from "@storybook/global";
6
+ import { makeDecorator as M, useEffect as C } from "storybook/preview-api";
7
+
8
+ // src/actions/constants.ts
9
+ var h = "actions", y = "storybook/actions", L = `${y}/panel`, g = `${y}/action-event`, W = `${y}/action-clear`;
10
+
11
+ // src/actions/runtime/action.ts
12
+ import { ImplicitActionsDuringRendering as S } from "storybook/internal/preview-errors";
13
+ import { global as E } from "@storybook/global";
14
+ import { addons as I } from "storybook/preview-api";
15
+ import { v4 as P } from "uuid";
16
+
17
+ // src/actions/runtime/configureActions.ts
18
+ var a = {
19
+ depth: 10,
20
+ clearOnStoryChange: !0,
21
+ limit: 50
22
+ };
23
+
24
+ // src/actions/runtime/action.ts
25
+ var A = /* @__PURE__ */ r((o, e) => {
26
+ let t = Object.getPrototypeOf(o);
27
+ return !t || e(t) ? t : A(t, e);
28
+ }, "findProto"), x = /* @__PURE__ */ r((o) => !!(typeof o == "object" && o && A(o, (e) => /^Synthetic(?:Base)?Event$/.test(e.constructor.name)) &&
29
+ typeof o.persist == "function"), "isReactSyntheticEvent"), k = /* @__PURE__ */ r((o) => {
30
+ if (x(o)) {
31
+ let e = Object.create(
32
+ o.constructor.prototype,
33
+ Object.getOwnPropertyDescriptors(o)
34
+ );
35
+ e.persist();
36
+ let t = Object.getOwnPropertyDescriptor(e, "view"), n = t?.value;
37
+ return typeof n == "object" && n?.constructor.name === "Window" && Object.defineProperty(e, "view", {
38
+ ...t,
39
+ value: Object.create(n.constructor.prototype)
40
+ }), e;
41
+ }
42
+ return o;
43
+ }, "serializeArg"), T = /* @__PURE__ */ r(() => typeof crypto == "object" && typeof crypto.getRandomValues == "function" ? P() : (
44
+ // pseudo random id, example response lo1e7zm4832bkr7yfl7
45
+ Date.now().toString(36) + Math.random().toString(36).substring(2)
46
+ ), "generateId");
47
+ function O(o, e = {}) {
48
+ let t = {
49
+ ...a,
50
+ ...e
51
+ }, n = /* @__PURE__ */ r(function(...i) {
52
+ if (e.implicit) {
53
+ let u = ("__STORYBOOK_PREVIEW__" in E ? (
54
+ // eslint-disable-next-line no-underscore-dangle
55
+ E.__STORYBOOK_PREVIEW__
56
+ ) : void 0)?.storyRenders.find(
57
+ (s) => s.phase === "playing" || s.phase === "rendering"
58
+ );
59
+ if (u) {
60
+ let s = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, d = new S({
61
+ phase: u.phase,
62
+ name: o,
63
+ deprecated: s
64
+ });
65
+ if (s)
66
+ console.warn(d);
67
+ else
68
+ throw d;
69
+ }
70
+ }
71
+ let m = I.getChannel(), p = T(), l = 5, f = i.map(k), R = i.length > 1 ? f : f[0], D = {
72
+ id: p,
73
+ count: 0,
74
+ data: { name: o, args: R },
75
+ options: {
76
+ ...t,
77
+ maxDepth: l + (t.depth || 3),
78
+ allowFunction: t.allowFunction || !1
79
+ }
80
+ };
81
+ m.emit(g, D);
82
+ }, "actionHandler");
83
+ return n.isAction = !0, n.implicit = e.implicit, n;
84
+ }
85
+ r(O, "action");
86
+
87
+ // src/actions/runtime/actions.ts
88
+ var b = /* @__PURE__ */ r((...o) => {
89
+ let e = a, t = o;
90
+ t.length === 1 && Array.isArray(t[0]) && ([t] = t), t.length !== 1 && typeof t[t.length - 1] != "string" && (e = {
91
+ ...a,
92
+ ...t.pop()
93
+ });
94
+ let n = t[0];
95
+ (t.length !== 1 || typeof n == "string") && (n = {}, t.forEach((i) => {
96
+ n[i] = i;
97
+ }));
98
+ let c = {};
99
+ return Object.keys(n).forEach((i) => {
100
+ c[i] = O(n[i], e);
101
+ }), c;
102
+ }, "actions");
103
+
104
+ // src/actions/decorator.ts
105
+ var { document: v, Element: w } = F, N = /^(\S+)\s*(.*)$/, V = w != null && !w.prototype.matches, Y = V ? "msMatchesSelector" : "matches", _ = /* @__PURE__ */ r(
106
+ (o, e) => {
107
+ if (o[Y](e))
108
+ return !0;
109
+ let t = o.parentElement;
110
+ return t ? _(t, e) : !1;
111
+ }, "hasMatchInAncestry"), $ = /* @__PURE__ */ r((o, ...e) => {
112
+ let t = o(...e);
113
+ return Object.entries(t).map(([n, c]) => {
114
+ let [i, m, p] = n.match(N) || [];
115
+ return {
116
+ eventName: m,
117
+ handler: /* @__PURE__ */ r((l) => {
118
+ (!p || _(l.target, p)) && c(l);
119
+ }, "handler")
120
+ };
121
+ });
122
+ }, "createHandlers"), B = /* @__PURE__ */ r((o, ...e) => {
123
+ let t = v && v.getElementById("storybook-root");
124
+ C(() => {
125
+ if (t != null) {
126
+ let n = $(o, ...e);
127
+ return n.forEach(({ eventName: c, handler: i }) => t.addEventListener(c, i)), () => n.forEach(({ eventName: c, handler: i }) => t.removeEventListener(
128
+ c, i));
129
+ }
130
+ }, [t, o, e]);
131
+ }, "applyEventHandlers"), mt = M({
132
+ name: "withActions",
133
+ parameterName: h,
134
+ skipIfNoParametersOrOptions: !0,
135
+ wrapper: /* @__PURE__ */ r((o, e, { parameters: t }) => (t?.handles && B(b, ...t.handles), o(e)), "wrapper")
136
+ });
137
+ export {
138
+ mt as withActions
139
+ };
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var a = Object.defineProperty;
3
+ var x = Object.getOwnPropertyDescriptor;
4
+ var R = Object.getOwnPropertyNames;
5
+ var j = Object.prototype.hasOwnProperty;
6
+ var i = (t, o) => a(t, "name", { value: o, configurable: !0 });
7
+ var I = (t, o) => {
8
+ for (var n in o)
9
+ a(t, n, { get: o[n], enumerable: !0 });
10
+ }, P = (t, o, n, e) => {
11
+ if (o && typeof o == "object" || typeof o == "function")
12
+ for (let r of R(o))
13
+ !j.call(t, r) && r !== n && a(t, r, { get: () => o[r], enumerable: !(e = x(o, r)) || e.enumerable });
14
+ return t;
15
+ };
16
+ var S = (t) => P(a({}, "__esModule", { value: !0 }), t);
17
+
18
+ // src/actions/index.ts
19
+ var K = {};
20
+ I(K, {
21
+ ADDON_ID: () => l,
22
+ CLEAR_ID: () => F,
23
+ CYCLIC_KEY: () => C,
24
+ EVENT_ID: () => f,
25
+ PANEL_ID: () => k,
26
+ PARAM_KEY: () => T,
27
+ action: () => y,
28
+ actions: () => B,
29
+ config: () => s,
30
+ configureActions: () => V
31
+ });
32
+ module.exports = S(K);
33
+
34
+ // src/actions/constants.ts
35
+ var T = "actions", l = "storybook/actions", k = `${l}/panel`, f = `${l}/action-event`, F = `${l}/action-clear`, C = "$___storybook.isCyclic";
36
+
37
+ // src/actions/runtime/action.ts
38
+ var A = require("storybook/internal/preview-errors"), m = require("@storybook/global"), O = require("storybook/preview-api"), h = require("uuid");
39
+
40
+ // src/actions/runtime/configureActions.ts
41
+ var s = {
42
+ depth: 10,
43
+ clearOnStoryChange: !0,
44
+ limit: 50
45
+ }, V = /* @__PURE__ */ i((t = {}) => {
46
+ Object.assign(s, t);
47
+ }, "configureActions");
48
+
49
+ // src/actions/runtime/action.ts
50
+ var b = /* @__PURE__ */ i((t, o) => {
51
+ let n = Object.getPrototypeOf(t);
52
+ return !n || o(n) ? n : b(n, o);
53
+ }, "findProto"), W = /* @__PURE__ */ i((t) => !!(typeof t == "object" && t && b(t, (o) => /^Synthetic(?:Base)?Event$/.test(o.constructor.name)) &&
54
+ typeof t.persist == "function"), "isReactSyntheticEvent"), Y = /* @__PURE__ */ i((t) => {
55
+ if (W(t)) {
56
+ let o = Object.create(
57
+ t.constructor.prototype,
58
+ Object.getOwnPropertyDescriptors(t)
59
+ );
60
+ o.persist();
61
+ let n = Object.getOwnPropertyDescriptor(o, "view"), e = n?.value;
62
+ return typeof e == "object" && e?.constructor.name === "Window" && Object.defineProperty(o, "view", {
63
+ ...n,
64
+ value: Object.create(e.constructor.prototype)
65
+ }), o;
66
+ }
67
+ return t;
68
+ }, "serializeArg"), $ = /* @__PURE__ */ i(() => 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 y(t, o = {}) {
73
+ let n = {
74
+ ...s,
75
+ ...o
76
+ }, e = /* @__PURE__ */ i(function(...c) {
77
+ if (o.implicit) {
78
+ let d = ("__STORYBOOK_PREVIEW__" in m.global ? (
79
+ // eslint-disable-next-line no-underscore-dangle
80
+ m.global.__STORYBOOK_PREVIEW__
81
+ ) : void 0)?.storyRenders.find(
82
+ (p) => p.phase === "playing" || p.phase === "rendering"
83
+ );
84
+ if (d) {
85
+ let p = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, g = new A.ImplicitActionsDuringRendering({
86
+ phase: d.phase,
87
+ name: t,
88
+ deprecated: p
89
+ });
90
+ if (p)
91
+ console.warn(g);
92
+ else
93
+ throw g;
94
+ }
95
+ }
96
+ let w = O.addons.getChannel(), E = $(), v = 5, u = c.map(Y), _ = c.length > 1 ? u : u[0], D = {
97
+ id: E,
98
+ count: 0,
99
+ data: { name: t, args: _ },
100
+ options: {
101
+ ...n,
102
+ maxDepth: v + (n.depth || 3),
103
+ allowFunction: n.allowFunction || !1
104
+ }
105
+ };
106
+ w.emit(f, D);
107
+ }, "actionHandler");
108
+ return e.isAction = !0, e.implicit = o.implicit, e;
109
+ }
110
+ i(y, "action");
111
+
112
+ // src/actions/runtime/actions.ts
113
+ var B = /* @__PURE__ */ i((...t) => {
114
+ let o = s, n = t;
115
+ n.length === 1 && Array.isArray(n[0]) && ([n] = n), n.length !== 1 && typeof n[n.length - 1] != "string" && (o = {
116
+ ...s,
117
+ ...n.pop()
118
+ });
119
+ let e = n[0];
120
+ (n.length !== 1 || typeof e == "string") && (e = {}, n.forEach((c) => {
121
+ e[c] = c;
122
+ }));
123
+ let r = {};
124
+ return Object.keys(e).forEach((c) => {
125
+ r[c] = y(e[c], o);
126
+ }), r;
127
+ }, "actions");
@@ -0,0 +1,105 @@
1
+ declare const PARAM_KEY = "actions";
2
+ declare const ADDON_ID = "storybook/actions";
3
+ declare const PANEL_ID = "storybook/actions/panel";
4
+ declare const EVENT_ID = "storybook/actions/action-event";
5
+ declare const CLEAR_ID = "storybook/actions/action-clear";
6
+ declare const CYCLIC_KEY = "$___storybook.isCyclic";
7
+
8
+ interface Options$1 {
9
+ allowRegExp: boolean;
10
+ allowFunction: boolean;
11
+ allowSymbol: boolean;
12
+ allowDate: boolean;
13
+ allowUndefined: boolean;
14
+ allowClass: boolean;
15
+ allowError: boolean;
16
+ maxDepth: number;
17
+ space: number | undefined;
18
+ lazyEval: boolean;
19
+ }
20
+
21
+ interface Options {
22
+ depth: number;
23
+ clearOnStoryChange: boolean;
24
+ limit: number;
25
+ implicit: boolean;
26
+ id: string;
27
+ }
28
+ type ActionOptions = Partial<Options> & Partial<Options$1>;
29
+
30
+ interface ActionDisplay {
31
+ id: string;
32
+ data: {
33
+ name: string;
34
+ args: any[];
35
+ };
36
+ count: number;
37
+ options: ActionOptions;
38
+ }
39
+
40
+ type HandlerFunction = (...args: any[]) => void;
41
+
42
+ type ActionsMap<T extends string = string> = Record<T, HandlerFunction>;
43
+
44
+ interface ActionsFunction {
45
+ <T extends string>(handlerMap: Record<T, string>, options?: ActionOptions): ActionsMap<T>;
46
+ <T extends string>(...handlers: T[]): ActionsMap<T>;
47
+ <T extends string>(handler1: T, options?: ActionOptions): ActionsMap<T>;
48
+ <T extends string>(handler1: T, handler2: T, options?: ActionOptions): ActionsMap<T>;
49
+ <T extends string>(handler1: T, handler2: T, handler3: T, options?: ActionOptions): ActionsMap<T>;
50
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, options?: ActionOptions): ActionsMap<T>;
51
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, handler5: T, options?: ActionOptions): ActionsMap<T>;
52
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, handler5: T, handler6: T, options?: ActionOptions): ActionsMap<T>;
53
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, handler5: T, handler6: T, handler7: T, options?: ActionOptions): ActionsMap<T>;
54
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, handler5: T, handler6: T, handler7: T, handler8: T, options?: ActionOptions): ActionsMap<T>;
55
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, handler5: T, handler6: T, handler7: T, handler8: T, handler9: T, options?: ActionOptions): ActionsMap<T>;
56
+ <T extends string>(handler1: T, handler2: T, handler3: T, handler4: T, handler5: T, handler6: T, handler7: T, handler8: T, handler9: T, handler10: T, options?: ActionOptions): ActionsMap<T>;
57
+ }
58
+
59
+ type DecoratorFunction = (args: any[]) => any[];
60
+
61
+ declare function action(name: string, options?: ActionOptions): HandlerFunction;
62
+
63
+ declare const actions: ActionsFunction;
64
+
65
+ declare const config: ActionOptions;
66
+ declare const configureActions: (options?: ActionOptions) => void;
67
+
68
+ interface ActionsParameters {
69
+ /**
70
+ * Actions configuration
71
+ *
72
+ * @see https://storybook.js.org/docs/essentials/actions#parameters
73
+ */
74
+ actions: {
75
+ /**
76
+ * Create actions for each arg that matches the regex. (**NOT recommended, see below**)
77
+ *
78
+ * This is quite useful when your component has dozens (or hundreds) of methods and you do not
79
+ * want to manually apply the fn utility for each of those methods. However, this is not the
80
+ * recommended way of writing actions. That's because automatically inferred args are not
81
+ * available as spies in your play function. If you use argTypesRegex and your stories have play
82
+ * functions, you will need to also define args with the fn utility to test them in your play
83
+ * function.
84
+ *
85
+ * @example `argTypesRegex: '^on.*'`
86
+ */
87
+ argTypesRegex?: string;
88
+ /** Remove the addon panel and disable the addon's behavior */
89
+ disable?: boolean;
90
+ /**
91
+ * Binds a standard HTML event handler to the outermost HTML element rendered by your component
92
+ * and triggers an action when the event is called for a given selector. The format is
93
+ * `<eventname> <selector>`. The selector is optional; it defaults to all elements.
94
+ *
95
+ * **To enable this feature, you must use the `withActions` decorator.**
96
+ *
97
+ * @example `handles: ['mouseover', 'click .btn']`
98
+ *
99
+ * @see https://storybook.js.org/docs/essentials/actions#action-event-handlers
100
+ */
101
+ handles?: string[];
102
+ };
103
+ }
104
+
105
+ 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 };
@@ -0,0 +1,112 @@
1
+ var E = Object.defineProperty;
2
+ var i = (o, n) => E(o, "name", { value: n, configurable: !0 });
3
+
4
+ // src/actions/constants.ts
5
+ var S = "actions", a = "storybook/actions", T = `${a}/panel`, y = `${a}/action-event`, k = `${a}/action-clear`, F = "$___storybook.isCyclic";
6
+
7
+ // src/actions/runtime/action.ts
8
+ import { ImplicitActionsDuringRendering as v } 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";
12
+
13
+ // src/actions/runtime/configureActions.ts
14
+ var c = {
15
+ depth: 10,
16
+ clearOnStoryChange: !0,
17
+ limit: 50
18
+ }, V = /* @__PURE__ */ i((o = {}) => {
19
+ Object.assign(c, o);
20
+ }, "configureActions");
21
+
22
+ // src/actions/runtime/action.ts
23
+ var d = /* @__PURE__ */ i((o, n) => {
24
+ let t = Object.getPrototypeOf(o);
25
+ return !t || n(t) ? t : d(t, n);
26
+ }, "findProto"), x = /* @__PURE__ */ i((o) => !!(typeof o == "object" && o && d(o, (n) => /^Synthetic(?:Base)?Event$/.test(n.constructor.name)) &&
27
+ typeof o.persist == "function"), "isReactSyntheticEvent"), R = /* @__PURE__ */ i((o) => {
28
+ if (x(o)) {
29
+ let n = Object.create(
30
+ o.constructor.prototype,
31
+ Object.getOwnPropertyDescriptors(o)
32
+ );
33
+ n.persist();
34
+ let t = Object.getOwnPropertyDescriptor(n, "view"), e = t?.value;
35
+ return typeof e == "object" && e?.constructor.name === "Window" && Object.defineProperty(n, "view", {
36
+ ...t,
37
+ value: Object.create(e.constructor.prototype)
38
+ }), n;
39
+ }
40
+ return o;
41
+ }, "serializeArg"), j = /* @__PURE__ */ i(() => 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");
45
+ function g(o, n = {}) {
46
+ let t = {
47
+ ...c,
48
+ ...n
49
+ }, e = /* @__PURE__ */ i(function(...r) {
50
+ if (n.implicit) {
51
+ let f = ("__STORYBOOK_PREVIEW__" in u ? (
52
+ // eslint-disable-next-line no-underscore-dangle
53
+ u.__STORYBOOK_PREVIEW__
54
+ ) : void 0)?.storyRenders.find(
55
+ (s) => s.phase === "playing" || s.phase === "rendering"
56
+ );
57
+ if (f) {
58
+ let s = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, m = new v({
59
+ phase: f.phase,
60
+ name: o,
61
+ deprecated: s
62
+ });
63
+ if (s)
64
+ console.warn(m);
65
+ else
66
+ throw m;
67
+ }
68
+ }
69
+ let A = _.getChannel(), O = j(), h = 5, l = r.map(R), b = r.length > 1 ? l : l[0], w = {
70
+ id: O,
71
+ count: 0,
72
+ data: { name: o, args: b },
73
+ options: {
74
+ ...t,
75
+ maxDepth: h + (t.depth || 3),
76
+ allowFunction: t.allowFunction || !1
77
+ }
78
+ };
79
+ A.emit(y, w);
80
+ }, "actionHandler");
81
+ return e.isAction = !0, e.implicit = n.implicit, e;
82
+ }
83
+ i(g, "action");
84
+
85
+ // src/actions/runtime/actions.ts
86
+ var G = /* @__PURE__ */ i((...o) => {
87
+ let n = c, t = o;
88
+ t.length === 1 && Array.isArray(t[0]) && ([t] = t), t.length !== 1 && typeof t[t.length - 1] != "string" && (n = {
89
+ ...c,
90
+ ...t.pop()
91
+ });
92
+ let e = t[0];
93
+ (t.length !== 1 || typeof e == "string") && (e = {}, t.forEach((r) => {
94
+ e[r] = r;
95
+ }));
96
+ let p = {};
97
+ return Object.keys(e).forEach((r) => {
98
+ p[r] = g(e[r], n);
99
+ }), p;
100
+ }, "actions");
101
+ export {
102
+ a as ADDON_ID,
103
+ k as CLEAR_ID,
104
+ F as CYCLIC_KEY,
105
+ y as EVENT_ID,
106
+ T as PANEL_ID,
107
+ S as PARAM_KEY,
108
+ g as action,
109
+ G as actions,
110
+ c as config,
111
+ V as configureActions
112
+ };