storybook 9.0.0-alpha.1 → 9.0.0-alpha.10
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.
- package/README.md +31 -29
- package/assets/browser/favicon.svg +1 -0
- package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-bold.woff2 +0 -0
- package/assets/browser/nunito-sans-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-regular.woff2 +0 -0
- package/assets/docs/addon-controls-args-annotated.png +0 -0
- package/assets/docs/addon-controls-args-background-color.png +0 -0
- package/assets/docs/addon-controls-args-background-string.png +0 -0
- package/assets/docs/addon-controls-args-docs.png +0 -0
- package/assets/docs/addon-controls-args-logging.png +0 -0
- package/assets/docs/addon-controls-args-no-annotation.png +0 -0
- package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
- package/assets/docs/addon-controls-args-reflow.png +0 -0
- package/assets/docs/addon-controls-args-template.png +0 -0
- package/assets/docs/addon-controls-expanded.png +0 -0
- package/assets/docs/addon-controls-hero.gif +0 -0
- package/assets/docs/addon-controls-install.png +0 -0
- package/assets/docs/hero.gif +0 -0
- package/assets/docs/message-reference.png +0 -0
- package/assets/docs/viewport.png +0 -0
- package/assets/server/addon.tsconfig.json +6 -0
- package/assets/server/base-preview-body.html +119 -0
- package/assets/server/base-preview-head.html +451 -0
- package/assets/server/template.ejs +87 -0
- package/bin/index.cjs +1 -1
- package/dist/actions/decorator.d.ts +6 -0
- package/dist/actions/decorator.js +139 -0
- package/dist/actions/index.cjs +127 -0
- package/dist/actions/index.d.ts +105 -0
- package/dist/actions/index.js +112 -0
- package/dist/actions/manager.js +1196 -0
- package/dist/actions/preview.cjs +165 -0
- package/dist/actions/preview.d.ts +55 -0
- package/dist/actions/preview.js +156 -0
- package/dist/babel/index.cjs +54034 -0
- package/dist/babel/index.d.ts +7488 -0
- package/dist/babel/index.js +54044 -0
- package/dist/bin/index.cjs +119 -0
- package/dist/bin/index.js +113 -0
- package/dist/builder-manager/index.cjs +2140 -0
- package/dist/builder-manager/index.d.ts +19 -0
- package/dist/builder-manager/index.js +2162 -0
- package/dist/channels/index.cjs +1913 -0
- package/dist/channels/index.d.ts +108 -0
- package/dist/channels/index.js +1881 -0
- package/dist/cli/bin/index.cjs +2687 -0
- package/dist/cli/bin/index.d.ts +2 -0
- package/dist/cli/bin/index.js +2707 -0
- package/dist/cli/index.cjs +17327 -0
- package/dist/cli/index.d.ts +209 -0
- package/dist/cli/index.js +17349 -0
- package/dist/client-logger/index.cjs +80 -0
- package/dist/client-logger/index.d.ts +29 -0
- package/dist/client-logger/index.js +64 -0
- package/dist/common/index.cjs +20569 -0
- package/dist/common/index.d.ts +949 -0
- package/dist/common/index.js +20654 -0
- package/dist/components/index.cjs +27924 -0
- package/dist/components/index.d.ts +1423 -0
- package/dist/components/index.js +24673 -0
- package/dist/controls/decorator.d.ts +5 -0
- package/dist/controls/decorator.js +8 -0
- package/dist/controls/index.cjs +26 -0
- package/dist/controls/index.d.ts +39 -0
- package/dist/controls/index.js +6 -0
- package/dist/controls/manager.js +5545 -0
- package/dist/controls/preview.cjs +26 -0
- package/dist/controls/preview.d.ts +55 -0
- package/dist/controls/preview.js +9 -0
- package/dist/core-events/index.cjs +167 -0
- package/dist/core-events/index.d.ts +426 -0
- package/dist/core-events/index.js +149 -0
- package/dist/core-server/index.cjs +38183 -0
- package/dist/core-server/index.d.ts +720 -0
- package/dist/core-server/index.js +38272 -0
- package/dist/core-server/presets/common-manager.js +20 -0
- package/dist/core-server/presets/common-override-preset.cjs +4824 -0
- package/dist/core-server/presets/common-override-preset.js +4829 -0
- package/dist/core-server/presets/common-preset.cjs +10231 -0
- package/dist/core-server/presets/common-preset.js +10309 -0
- package/dist/csf/index.cjs +179 -0
- package/dist/csf/index.d.ts +750 -0
- package/dist/csf/index.js +172 -0
- package/dist/csf-tools/index.cjs +1422 -0
- package/dist/csf-tools/index.d.ts +250 -0
- package/dist/csf-tools/index.js +1439 -0
- package/dist/docs-tools/index.cjs +2891 -0
- package/dist/docs-tools/index.d.ts +162 -0
- package/dist/docs-tools/index.js +2876 -0
- package/dist/index.cjs +17 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -7
- package/dist/instrumenter/index.cjs +3485 -0
- package/dist/instrumenter/index.d.ts +104 -0
- package/dist/instrumenter/index.js +4965 -0
- package/dist/manager/globals-module-info.cjs +817 -0
- package/dist/manager/globals-module-info.d.ts +36 -0
- package/dist/manager/globals-module-info.js +804 -0
- package/dist/manager/globals-runtime.js +77536 -0
- package/dist/manager/globals.cjs +47 -0
- package/dist/manager/globals.d.ts +24 -0
- package/dist/manager/globals.js +34 -0
- package/dist/manager/runtime.js +12323 -0
- package/dist/manager-api/index.cjs +11074 -0
- package/dist/manager-api/index.d.ts +1512 -0
- package/dist/manager-api/index.js +4835 -0
- package/dist/manager-errors.d.ts +89 -0
- package/dist/manager-errors.js +99 -0
- package/dist/node-logger/index.cjs +1642 -0
- package/dist/node-logger/index.d.ts +117 -0
- package/dist/node-logger/index.js +1652 -0
- package/dist/preview/globals.cjs +38 -0
- package/dist/preview/globals.d.ts +15 -0
- package/dist/preview/globals.js +25 -0
- package/dist/preview/runtime.js +43629 -0
- package/dist/preview-api/index.cjs +5224 -0
- package/dist/preview-api/index.d.ts +1093 -0
- package/dist/preview-api/index.js +5292 -0
- package/dist/preview-errors.cjs +503 -0
- package/dist/preview-errors.d.ts +212 -0
- package/dist/preview-errors.js +449 -0
- package/dist/router/index.cjs +3296 -0
- package/dist/router/index.d.ts +385 -0
- package/dist/router/index.js +1843 -0
- package/dist/server-errors.cjs +727 -0
- package/dist/server-errors.d.ts +296 -0
- package/dist/server-errors.js +728 -0
- package/dist/telemetry/index.cjs +2756 -0
- package/dist/telemetry/index.d.ts +133 -0
- package/dist/telemetry/index.js +2797 -0
- package/dist/test/index.cjs +35685 -0
- package/dist/test/index.d.ts +186 -0
- package/dist/test/index.js +33751 -0
- package/dist/test/preview.cjs +15869 -0
- package/dist/test/preview.d.ts +54 -0
- package/dist/test/preview.js +14440 -0
- package/dist/test/spy.cjs +257 -0
- package/dist/test/spy.d.ts +66 -0
- package/dist/test/spy.js +239 -0
- package/dist/theming/create.cjs +232 -0
- package/dist/theming/create.d.ts +50 -0
- package/dist/theming/create.js +216 -0
- package/dist/theming/index.cjs +2665 -0
- package/dist/theming/index.d.ts +11939 -0
- package/dist/theming/index.js +2485 -0
- package/dist/types/index.cjs +27 -0
- package/dist/types/index.d.ts +2795 -0
- package/dist/types/index.js +7 -0
- package/dist/viewport/index.cjs +310 -0
- package/dist/viewport/index.d.ts +320 -0
- package/dist/viewport/index.js +290 -0
- package/dist/viewport/manager.js +400 -0
- package/dist/viewport/preview.cjs +35 -0
- package/dist/viewport/preview.d.ts +69 -0
- package/dist/viewport/preview.js +19 -0
- package/package.json +518 -209
- package/.eslintrc.cjs +0 -31
- package/__mocks__/@aw-web-design/x-default-browser.js +0 -2
- package/core/babel/index.cjs +0 -1
- package/core/babel/index.d.ts +0 -2
- package/core/babel/index.js +0 -1
- package/core/builder-manager/index.cjs +0 -1
- package/core/builder-manager/index.d.ts +0 -2
- package/core/builder-manager/index.js +0 -1
- package/core/channels/index.cjs +0 -1
- package/core/channels/index.d.ts +0 -2
- package/core/channels/index.js +0 -1
- package/core/cli/bin/index.cjs +0 -1
- package/core/cli/bin/index.d.ts +0 -2
- package/core/cli/bin/index.js +0 -1
- package/core/cli/index.cjs +0 -1
- package/core/cli/index.d.ts +0 -2
- package/core/cli/index.js +0 -1
- package/core/client-logger/index.cjs +0 -1
- package/core/client-logger/index.d.ts +0 -2
- package/core/client-logger/index.js +0 -1
- package/core/common/index.cjs +0 -1
- package/core/common/index.d.ts +0 -2
- package/core/common/index.js +0 -1
- package/core/components/index.cjs +0 -1
- package/core/components/index.d.ts +0 -2
- package/core/components/index.js +0 -1
- package/core/core-events/index.cjs +0 -1
- package/core/core-events/index.d.ts +0 -2
- package/core/core-events/index.js +0 -1
- package/core/core-server/index.cjs +0 -1
- package/core/core-server/index.d.ts +0 -2
- package/core/core-server/index.js +0 -1
- package/core/core-server/presets/common-manager.js +0 -1
- package/core/core-server/presets/common-override-preset.cjs +0 -1
- package/core/core-server/presets/common-override-preset.js +0 -1
- package/core/core-server/presets/common-preset.cjs +0 -1
- package/core/core-server/presets/common-preset.js +0 -1
- package/core/csf/index.cjs +0 -1
- package/core/csf/index.d.ts +0 -2
- package/core/csf/index.js +0 -1
- package/core/csf-tools/index.cjs +0 -1
- package/core/csf-tools/index.d.ts +0 -2
- package/core/csf-tools/index.js +0 -1
- package/core/docs-tools/index.cjs +0 -1
- package/core/docs-tools/index.d.ts +0 -2
- package/core/docs-tools/index.js +0 -1
- package/core/index.cjs +0 -1
- package/core/index.d.ts +0 -2
- package/core/index.js +0 -1
- package/core/manager/globals-module-info.cjs +0 -1
- package/core/manager/globals-module-info.d.ts +0 -2
- package/core/manager/globals-module-info.js +0 -1
- package/core/manager/globals-runtime.js +0 -1
- package/core/manager/globals.cjs +0 -1
- package/core/manager/globals.d.ts +0 -2
- package/core/manager/globals.js +0 -1
- package/core/manager-api/index.cjs +0 -1
- package/core/manager-api/index.d.ts +0 -2
- package/core/manager-api/index.js +0 -1
- package/core/manager-errors.d.ts +0 -2
- package/core/manager-errors.js +0 -1
- package/core/node-logger/index.cjs +0 -1
- package/core/node-logger/index.d.ts +0 -2
- package/core/node-logger/index.js +0 -1
- package/core/preview/globals.cjs +0 -1
- package/core/preview/globals.d.ts +0 -2
- package/core/preview/globals.js +0 -1
- package/core/preview/runtime.js +0 -1
- package/core/preview-api/index.cjs +0 -1
- package/core/preview-api/index.d.ts +0 -2
- package/core/preview-api/index.js +0 -1
- package/core/preview-errors.cjs +0 -1
- package/core/preview-errors.d.ts +0 -2
- package/core/preview-errors.js +0 -1
- package/core/router/index.cjs +0 -1
- package/core/router/index.d.ts +0 -2
- package/core/router/index.js +0 -1
- package/core/server-errors.cjs +0 -1
- package/core/server-errors.d.ts +0 -2
- package/core/server-errors.js +0 -1
- package/core/telemetry/index.cjs +0 -1
- package/core/telemetry/index.d.ts +0 -2
- package/core/telemetry/index.js +0 -1
- package/core/theming/create.cjs +0 -1
- package/core/theming/create.d.ts +0 -2
- package/core/theming/create.js +0 -1
- package/core/theming/index.cjs +0 -1
- package/core/theming/index.d.ts +0 -2
- package/core/theming/index.js +0 -1
- package/core/types/index.cjs +0 -1
- package/core/types/index.d.ts +0 -2
- package/core/types/index.js +0 -1
- package/core.cjs +0 -0
- package/core.d.ts +0 -0
- package/core.js +0 -1
- package/dist/chunk-OWLSIX54.js +0 -8
- package/dist/core-path.cjs +0 -1
- package/dist/core-path.d.ts +0 -3
- package/dist/core-path.js +0 -9
- package/dist/proxy.cjs +0 -1
- package/dist/proxy.d.ts +0 -2
- package/dist/proxy.js +0 -9
|
@@ -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
|
+
};
|