storybook 9.1.0-alpha.3 → 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.
- package/dist/actions/index.cjs +16 -16
- package/dist/actions/index.d.ts +1 -38
- package/dist/actions/index.js +12 -12
- package/dist/actions/preview.cjs +25 -25
- package/dist/actions/preview.d.ts +37 -547
- package/dist/actions/preview.js +18 -18
- package/dist/backgrounds/index.cjs +12 -144
- package/dist/backgrounds/index.d.ts +1 -591
- package/dist/backgrounds/index.js +0 -130
- package/dist/backgrounds/preview.cjs +63 -63
- package/dist/backgrounds/preview.d.ts +40 -542
- package/dist/backgrounds/preview.js +47 -47
- package/dist/bin/index.cjs +50 -50
- package/dist/bin/index.js +50 -50
- package/dist/cli/bin/index.cjs +1 -1
- package/dist/cli/bin/index.js +1 -1
- package/dist/common/index.cjs +732 -731
- package/dist/common/index.d.ts +2 -2
- package/dist/common/index.js +81 -79
- package/dist/component-testing/preview.cjs +12 -12
- package/dist/component-testing/preview.d.ts +2 -2
- package/dist/component-testing/preview.js +7 -7
- package/dist/controls/index.cjs +16 -16
- package/dist/controls/index.d.ts +1 -36
- package/dist/controls/preview.cjs +17 -17
- package/dist/controls/preview.d.ts +34 -546
- package/dist/controls/preview.js +3 -3
- package/dist/csf/index.cjs +1210 -95
- package/dist/csf/index.d.ts +59 -18
- package/dist/csf/index.js +1214 -90
- package/dist/csf-tools/index.cjs +2 -1
- package/dist/csf-tools/index.js +2 -2
- package/dist/highlight/index.cjs +15 -15
- package/dist/highlight/index.d.ts +1 -12
- package/dist/highlight/index.js +4 -4
- package/dist/highlight/preview.cjs +63 -63
- package/dist/highlight/preview.d.ts +11 -546
- package/dist/highlight/preview.js +11 -10
- package/dist/manager/globals-runtime.js +29776 -29777
- package/dist/manager-api/index.cjs +1 -1
- package/dist/manager-api/index.js +1 -1
- package/dist/measure/index.cjs +12 -472
- package/dist/measure/index.d.ts +1 -566
- package/dist/measure/index.js +0 -464
- package/dist/measure/preview.cjs +104 -104
- package/dist/measure/preview.d.ts +11 -546
- package/dist/measure/preview.js +105 -105
- package/dist/outline/index.cjs +12 -524
- package/dist/outline/index.d.ts +1 -566
- package/dist/outline/index.js +0 -500
- package/dist/outline/preview.cjs +32 -32
- package/dist/outline/preview.d.ts +11 -546
- package/dist/outline/preview.js +27 -27
- package/dist/preview/runtime.js +8259 -8266
- package/dist/preview-api/index.cjs +1228 -1261
- package/dist/preview-api/index.d.ts +6 -8
- package/dist/preview-api/index.js +927 -963
- package/dist/telemetry/index.cjs +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/test/preview.cjs +42 -42
- package/dist/test/preview.d.ts +12 -550
- package/dist/test/preview.js +36 -36
- package/dist/types/index.d.ts +5 -3
- package/dist/viewport/index.cjs +17 -24
- package/dist/viewport/index.d.ts +9 -532
- package/dist/viewport/index.js +9 -16
- package/dist/viewport/preview.cjs +22 -22
- package/dist/viewport/preview.d.ts +45 -552
- package/dist/viewport/preview.js +8 -8
- package/package.json +1 -1
package/dist/actions/index.cjs
CHANGED
|
@@ -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
|
-
},
|
|
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
|
|
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: () =>
|
|
27
|
-
action: () =>
|
|
26
|
+
PARAM_KEY: () => P,
|
|
27
|
+
action: () => y,
|
|
28
28
|
actions: () => Y,
|
|
29
29
|
config: () => s,
|
|
30
30
|
configureActions: () => F
|
|
31
31
|
});
|
|
32
|
-
module.exports =
|
|
32
|
+
module.exports = I($);
|
|
33
33
|
|
|
34
34
|
// src/actions/constants.ts
|
|
35
|
-
var
|
|
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
|
|
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
|
|
50
|
+
var A = /* @__PURE__ */ i((t, o) => {
|
|
51
51
|
let n = Object.getPrototypeOf(t);
|
|
52
|
-
return !n || o(n) ? n :
|
|
53
|
-
}, "findProto"), V = /* @__PURE__ */ i((t) => !!(typeof t == "object" && t &&
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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(
|
|
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] =
|
|
119
|
+
r[c] = y(e[c], o);
|
|
120
120
|
}), r;
|
|
121
121
|
}, "actions");
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -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
|
-
|
|
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 };
|
package/dist/actions/index.js
CHANGED
|
@@ -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
|
|
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,
|
|
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(
|
|
57
|
+
console.warn(f);
|
|
58
58
|
else
|
|
59
|
-
throw
|
|
59
|
+
throw f;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
let
|
|
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:
|
|
64
|
+
id: h,
|
|
65
65
|
count: 0,
|
|
66
66
|
data: { name: o, args: E },
|
|
67
67
|
options: {
|
|
68
68
|
...t,
|
|
69
|
-
maxDepth:
|
|
69
|
+
maxDepth: A + (t.depth || 3)
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
|
|
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
|
-
|
|
96
|
+
P as CLEAR_ID,
|
|
97
97
|
T as CYCLIC_KEY,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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,
|
package/dist/actions/preview.cjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
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) =>
|
|
7
|
-
var
|
|
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
|
-
|
|
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 &&
|
|
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(
|
|
16
|
+
var L = (e) => M(g({}, "__esModule", { value: !0 }), e);
|
|
17
17
|
|
|
18
18
|
// src/actions/preview.ts
|
|
19
19
|
var z = {};
|
|
20
|
-
|
|
20
|
+
l(z, {
|
|
21
21
|
default: () => K
|
|
22
22
|
});
|
|
23
23
|
module.exports = L(z);
|
|
24
|
-
var j = require("storybook/
|
|
24
|
+
var j = require("storybook/internal/csf");
|
|
25
25
|
|
|
26
26
|
// src/actions/addArgs.ts
|
|
27
27
|
var A = {};
|
|
28
|
-
|
|
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"),
|
|
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
|
|
46
|
+
var w = /* @__PURE__ */ i((e, t) => {
|
|
47
47
|
let o = Object.getPrototypeOf(e);
|
|
48
|
-
return !o || t(o) ? o :
|
|
49
|
-
}, "findProto"), N = /* @__PURE__ */ i((e) => !!(typeof e == "object" && e &&
|
|
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
|
|
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
|
|
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:
|
|
93
|
+
maxDepth: a + (o.depth || 3)
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
|
|
96
|
+
p.emit(E, S);
|
|
97
97
|
}, "actionHandler");
|
|
98
98
|
return r.isAction = !0, r.implicit = t.implicit, r;
|
|
99
99
|
}
|
|
100
|
-
i(
|
|
100
|
+
i(y, "action");
|
|
101
101
|
|
|
102
102
|
// src/actions/addArgsHelpers.ts
|
|
103
|
-
var
|
|
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, [
|
|
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,
|
|
123
|
-
"string" ? c.action :
|
|
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
|
-
|
|
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))) &&
|
|
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.
|
|
156
|
+
var K = /* @__PURE__ */ i(() => (0, j.definePreviewAddon)({
|
|
157
157
|
...A,
|
|
158
158
|
...h
|
|
159
159
|
}), "default");
|