storybook 9.1.0-alpha.3 → 9.1.0-alpha.5
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 +755 -756
- package/dist/common/index.d.ts +9 -5
- package/dist/common/index.js +700 -700
- 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/csf/index.cjs
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
2
|
+
var dr = Object.create;
|
|
3
|
+
var I = Object.defineProperty;
|
|
4
|
+
var lr = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var ur = Object.getOwnPropertyNames;
|
|
6
|
+
var fr = Object.getPrototypeOf, mr = Object.prototype.hasOwnProperty;
|
|
7
|
+
var s = (e, r) => I(e, "name", { value: r, configurable: !0 });
|
|
8
|
+
var be = (e, r) => () => (r || e((r = { exports: {} }).exports, r), r.exports), yr = (e, r) => {
|
|
9
9
|
for (var t in r)
|
|
10
|
-
|
|
11
|
-
},
|
|
10
|
+
I(e, t, { get: r[t], enumerable: !0 });
|
|
11
|
+
}, Ce = (e, r, t, o) => {
|
|
12
12
|
if (r && typeof r == "object" || typeof r == "function")
|
|
13
|
-
for (let
|
|
14
|
-
!
|
|
13
|
+
for (let a of ur(r))
|
|
14
|
+
!mr.call(e, a) && a !== t && I(e, a, { get: () => r[a], enumerable: !(o = lr(r, a)) || o.enumerable });
|
|
15
15
|
return e;
|
|
16
16
|
};
|
|
17
|
-
var
|
|
17
|
+
var b = (e, r, t) => (t = e != null ? dr(fr(e)) : {}, Ce(
|
|
18
18
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
19
|
// file that has been converted to a CommonJS file using a Babel-
|
|
20
20
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
21
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
-
r || !e || !e.__esModule ?
|
|
22
|
+
r || !e || !e.__esModule ? I(t, "default", { value: e, enumerable: !0 }) : t,
|
|
23
23
|
e
|
|
24
|
-
)),
|
|
24
|
+
)), gr = (e) => Ce(I({}, "__esModule", { value: !0 }), e);
|
|
25
25
|
|
|
26
26
|
// ../node_modules/@ngard/tiny-isequal/index.js
|
|
27
|
-
var
|
|
28
|
-
Object.defineProperty(
|
|
29
|
-
var e = Object.prototype.toString, r = Object.getPrototypeOf, t = Object.getOwnPropertySymbols ? function(
|
|
30
|
-
return Object.keys(
|
|
27
|
+
var Ee = be((Z) => {
|
|
28
|
+
Object.defineProperty(Z, "__esModule", { value: !0 }), Z.isEqual = /* @__PURE__ */ function() {
|
|
29
|
+
var e = Object.prototype.toString, r = Object.getPrototypeOf, t = Object.getOwnPropertySymbols ? function(o) {
|
|
30
|
+
return Object.keys(o).concat(Object.getOwnPropertySymbols(o));
|
|
31
31
|
} : Object.keys;
|
|
32
|
-
return function(
|
|
33
|
-
return (/* @__PURE__ */
|
|
34
|
-
var c,
|
|
35
|
-
if (
|
|
36
|
-
if (
|
|
37
|
-
if (
|
|
38
|
-
if (
|
|
39
|
-
return !
|
|
32
|
+
return function(o, a) {
|
|
33
|
+
return (/* @__PURE__ */ s(function n(i, p, d) {
|
|
34
|
+
var c, m, u, y = e.call(i), h = e.call(p);
|
|
35
|
+
if (i === p) return !0;
|
|
36
|
+
if (i == null || p == null) return !1;
|
|
37
|
+
if (d.indexOf(i) > -1 && d.indexOf(p) > -1) return !0;
|
|
38
|
+
if (d.push(i, p), y != h || (c = t(i), m = t(p), c.length != m.length || c.some(function(S) {
|
|
39
|
+
return !n(i[S], p[S], d);
|
|
40
40
|
}))) return !1;
|
|
41
|
-
switch (
|
|
41
|
+
switch (y.slice(8, -1)) {
|
|
42
42
|
case "Symbol":
|
|
43
|
-
return
|
|
43
|
+
return i.valueOf() == p.valueOf();
|
|
44
44
|
case "Date":
|
|
45
45
|
case "Number":
|
|
46
|
-
return +
|
|
46
|
+
return +i == +p || +i != +i && +p != +p;
|
|
47
47
|
case "RegExp":
|
|
48
48
|
case "Function":
|
|
49
49
|
case "String":
|
|
50
50
|
case "Boolean":
|
|
51
|
-
return "" +
|
|
51
|
+
return "" + i == "" + p;
|
|
52
52
|
case "Set":
|
|
53
53
|
case "Map":
|
|
54
|
-
c =
|
|
54
|
+
c = i.entries(), m = p.entries();
|
|
55
55
|
do
|
|
56
|
-
if (!
|
|
56
|
+
if (!n((u = c.next()).value, m.next().value, d)) return !1;
|
|
57
57
|
while (!u.done);
|
|
58
58
|
return !0;
|
|
59
59
|
case "ArrayBuffer":
|
|
60
|
-
|
|
60
|
+
i = new Uint8Array(i), p = new Uint8Array(p);
|
|
61
61
|
case "DataView":
|
|
62
|
-
|
|
62
|
+
i = new Uint8Array(i.buffer), p = new Uint8Array(p.buffer);
|
|
63
63
|
case "Float32Array":
|
|
64
64
|
case "Float64Array":
|
|
65
65
|
case "Int8Array":
|
|
@@ -71,109 +71,1224 @@ var w = P((g) => {
|
|
|
71
71
|
case "Uint8ClampedArray":
|
|
72
72
|
case "Arguments":
|
|
73
73
|
case "Array":
|
|
74
|
-
if (
|
|
75
|
-
for (u = 0; u <
|
|
74
|
+
if (i.length != p.length) return !1;
|
|
75
|
+
for (u = 0; u < i.length; u++) if ((u in i || u in p) && (u in i != u in p || !n(i[u], p[u], d))) return !1;
|
|
76
76
|
return !0;
|
|
77
77
|
case "Object":
|
|
78
|
-
return
|
|
78
|
+
return n(r(i), r(p), d);
|
|
79
79
|
default:
|
|
80
80
|
return !1;
|
|
81
81
|
}
|
|
82
|
-
}, "n"))(
|
|
82
|
+
}, "n"))(o, a, []);
|
|
83
83
|
};
|
|
84
84
|
}();
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
+
// ../node_modules/ts-dedent/dist/index.js
|
|
88
|
+
var M = be((D) => {
|
|
89
|
+
"use strict";
|
|
90
|
+
Object.defineProperty(D, "__esModule", { value: !0 });
|
|
91
|
+
D.dedent = void 0;
|
|
92
|
+
function _e(e) {
|
|
93
|
+
for (var r = [], t = 1; t < arguments.length; t++)
|
|
94
|
+
r[t - 1] = arguments[t];
|
|
95
|
+
var o = Array.from(typeof e == "string" ? [e] : e);
|
|
96
|
+
o[o.length - 1] = o[o.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
97
|
+
var a = o.reduce(function(p, d) {
|
|
98
|
+
var c = d.match(/\n([\t ]+|(?!\s).)/g);
|
|
99
|
+
return c ? p.concat(c.map(function(m) {
|
|
100
|
+
var u, y;
|
|
101
|
+
return (y = (u = m.match(/[\t ]/g)) === null || u === void 0 ? void 0 : u.length) !== null && y !== void 0 ? y : 0;
|
|
102
|
+
})) : p;
|
|
103
|
+
}, []);
|
|
104
|
+
if (a.length) {
|
|
105
|
+
var n = new RegExp(`
|
|
106
|
+
[ ]{` + Math.min.apply(Math, a) + "}", "g");
|
|
107
|
+
o = o.map(function(p) {
|
|
108
|
+
return p.replace(n, `
|
|
109
|
+
`);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
o[0] = o[0].replace(/^\r?\n/, "");
|
|
113
|
+
var i = o[0];
|
|
114
|
+
return r.forEach(function(p, d) {
|
|
115
|
+
var c = i.match(/(?:^|\n)( *)$/), m = c ? c[1] : "", u = p;
|
|
116
|
+
typeof p == "string" && p.includes(`
|
|
117
|
+
`) && (u = String(p).split(`
|
|
118
|
+
`).map(function(y, h) {
|
|
119
|
+
return h === 0 ? y : "" + m + y;
|
|
120
|
+
}).join(`
|
|
121
|
+
`)), i += u + o[d + 1];
|
|
122
|
+
}), i;
|
|
123
|
+
}
|
|
124
|
+
s(_e, "dedent");
|
|
125
|
+
D.dedent = _e;
|
|
126
|
+
D.default = _e;
|
|
127
|
+
});
|
|
128
|
+
|
|
87
129
|
// src/csf/index.ts
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
combineTags: () =>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
130
|
+
var Kr = {};
|
|
131
|
+
yr(Kr, {
|
|
132
|
+
combineTags: () => qr,
|
|
133
|
+
definePreview: () => Mr,
|
|
134
|
+
definePreviewAddon: () => zr,
|
|
135
|
+
getCoreAnnotations: () => Re,
|
|
136
|
+
includeConditionalArg: () => ve,
|
|
137
|
+
isExportStory: () => Gr,
|
|
138
|
+
isMeta: () => Ur,
|
|
139
|
+
isPreview: () => Br,
|
|
140
|
+
isStory: () => $r,
|
|
141
|
+
parseKind: () => Vr,
|
|
142
|
+
sanitize: () => pr,
|
|
143
|
+
storyNameFromExport: () => Wr,
|
|
144
|
+
toId: () => Lr
|
|
100
145
|
});
|
|
101
|
-
module.exports =
|
|
146
|
+
module.exports = gr(Kr);
|
|
102
147
|
|
|
103
148
|
// src/csf/toStartCaseStr.ts
|
|
104
|
-
function
|
|
105
|
-
return e.replace(/_/g, " ").replace(/-/g, " ").replace(/\./g, " ").replace(/([^\n])([A-Z])([a-z])/g, (r, t,
|
|
106
|
-
/([a-z])([A-Z])/g, (r, t,
|
|
107
|
-
${
|
|
149
|
+
function we(e) {
|
|
150
|
+
return e.replace(/_/g, " ").replace(/-/g, " ").replace(/\./g, " ").replace(/([^\n])([A-Z])([a-z])/g, (r, t, o, a) => `${t} ${o}${a}`).replace(
|
|
151
|
+
/([a-z])([A-Z])/g, (r, t, o) => `${t} ${o}`).replace(/([a-z])([0-9])/gi, (r, t, o) => `${t} ${o}`).replace(/([0-9])([a-z])/gi, (r, t, o) => `${t}\
|
|
152
|
+
${o}`).replace(/(\s|^)(\w)/g, (r, t, o) => `${t}${o.toUpperCase()}`).replace(/ +/g, " ").trim();
|
|
108
153
|
}
|
|
109
|
-
|
|
154
|
+
s(we, "toStartCaseStr");
|
|
110
155
|
|
|
111
156
|
// src/csf/includeConditionalArg.ts
|
|
112
|
-
var
|
|
113
|
-
var
|
|
114
|
-
let { exists: t, eq:
|
|
115
|
-
if (
|
|
116
|
-
throw new Error(`Invalid conditional test ${JSON.stringify({ exists: t, eq:
|
|
117
|
-
if (typeof
|
|
118
|
-
return (0,
|
|
119
|
-
if (typeof
|
|
120
|
-
return !(0,
|
|
157
|
+
var Q = b(Ee(), 1);
|
|
158
|
+
var Pe = /* @__PURE__ */ s((e) => e.map((r) => typeof r < "u").filter(Boolean).length, "count"), Tr = /* @__PURE__ */ s((e, r) => {
|
|
159
|
+
let { exists: t, eq: o, neq: a, truthy: n } = e;
|
|
160
|
+
if (Pe([t, o, a, n]) > 1)
|
|
161
|
+
throw new Error(`Invalid conditional test ${JSON.stringify({ exists: t, eq: o, neq: a })}`);
|
|
162
|
+
if (typeof o < "u")
|
|
163
|
+
return (0, Q.isEqual)(r, o);
|
|
164
|
+
if (typeof a < "u")
|
|
165
|
+
return !(0, Q.isEqual)(r, a);
|
|
121
166
|
if (typeof t < "u") {
|
|
122
|
-
let
|
|
123
|
-
return t ?
|
|
167
|
+
let p = typeof r < "u";
|
|
168
|
+
return t ? p : !p;
|
|
124
169
|
}
|
|
125
|
-
return (typeof
|
|
126
|
-
}, "testValue"),
|
|
170
|
+
return (typeof n > "u" ? !0 : n) ? !!r : !r;
|
|
171
|
+
}, "testValue"), ve = /* @__PURE__ */ s((e, r, t) => {
|
|
127
172
|
if (!e.if)
|
|
128
173
|
return !0;
|
|
129
|
-
let { arg:
|
|
130
|
-
if (
|
|
131
|
-
throw new Error(`Invalid conditional value ${JSON.stringify({ arg:
|
|
132
|
-
let
|
|
133
|
-
return
|
|
174
|
+
let { arg: o, global: a } = e.if;
|
|
175
|
+
if (Pe([o, a]) !== 1)
|
|
176
|
+
throw new Error(`Invalid conditional value ${JSON.stringify({ arg: o, global: a })}`);
|
|
177
|
+
let n = o ? r[o] : t[a];
|
|
178
|
+
return Tr(e.if, n);
|
|
134
179
|
}, "includeConditionalArg");
|
|
135
180
|
|
|
136
181
|
// src/csf/csf-factories.ts
|
|
137
|
-
|
|
182
|
+
var nr = require("storybook/internal/csf");
|
|
183
|
+
|
|
184
|
+
// src/preview-api/modules/addons/main.ts
|
|
185
|
+
var L = require("@storybook/global");
|
|
186
|
+
|
|
187
|
+
// src/preview-api/modules/addons/storybook-channel-mock.ts
|
|
188
|
+
var ke = require("storybook/internal/channels");
|
|
189
|
+
function Oe() {
|
|
190
|
+
let e = {
|
|
191
|
+
setHandler: /* @__PURE__ */ s(() => {
|
|
192
|
+
}, "setHandler"),
|
|
193
|
+
send: /* @__PURE__ */ s(() => {
|
|
194
|
+
}, "send")
|
|
195
|
+
};
|
|
196
|
+
return new ke.Channel({ transport: e });
|
|
197
|
+
}
|
|
198
|
+
s(Oe, "mockChannel");
|
|
199
|
+
|
|
200
|
+
// src/preview-api/modules/addons/main.ts
|
|
201
|
+
var re = class {
|
|
202
|
+
constructor() {
|
|
203
|
+
this.getChannel = /* @__PURE__ */ s(() => {
|
|
204
|
+
if (!this.channel) {
|
|
205
|
+
let r = Oe();
|
|
206
|
+
return this.setChannel(r), r;
|
|
207
|
+
}
|
|
208
|
+
return this.channel;
|
|
209
|
+
}, "getChannel");
|
|
210
|
+
this.ready = /* @__PURE__ */ s(() => this.promise, "ready");
|
|
211
|
+
this.hasChannel = /* @__PURE__ */ s(() => !!this.channel, "hasChannel");
|
|
212
|
+
this.setChannel = /* @__PURE__ */ s((r) => {
|
|
213
|
+
this.channel = r, this.resolve();
|
|
214
|
+
}, "setChannel");
|
|
215
|
+
this.promise = new Promise((r) => {
|
|
216
|
+
this.resolve = () => r(this.getChannel());
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
static {
|
|
220
|
+
s(this, "AddonStore");
|
|
221
|
+
}
|
|
222
|
+
}, ee = "__STORYBOOK_ADDONS_PREVIEW";
|
|
223
|
+
function xr() {
|
|
224
|
+
return L.global[ee] || (L.global[ee] = new re()), L.global[ee];
|
|
225
|
+
}
|
|
226
|
+
s(xr, "getAddonsStore");
|
|
227
|
+
var te = xr();
|
|
228
|
+
|
|
229
|
+
// src/preview-api/modules/addons/hooks.ts
|
|
230
|
+
var hr = require("storybook/internal/client-logger"), F = require("storybook/internal/core-events"), W = require("@storybook/global");
|
|
231
|
+
var G = class {
|
|
232
|
+
constructor() {
|
|
233
|
+
this.hookListsMap = void 0;
|
|
234
|
+
this.mountedDecorators = void 0;
|
|
235
|
+
this.prevMountedDecorators = void 0;
|
|
236
|
+
this.currentHooks = void 0;
|
|
237
|
+
this.nextHookIndex = void 0;
|
|
238
|
+
this.currentPhase = void 0;
|
|
239
|
+
this.currentEffects = void 0;
|
|
240
|
+
this.prevEffects = void 0;
|
|
241
|
+
this.currentDecoratorName = void 0;
|
|
242
|
+
this.hasUpdates = void 0;
|
|
243
|
+
this.currentContext = void 0;
|
|
244
|
+
this.renderListener = /* @__PURE__ */ s((r) => {
|
|
245
|
+
r === this.currentContext?.id && (this.triggerEffects(), this.currentContext = null, this.removeRenderListeners());
|
|
246
|
+
}, "renderListener");
|
|
247
|
+
this.init();
|
|
248
|
+
}
|
|
249
|
+
static {
|
|
250
|
+
s(this, "HooksContext");
|
|
251
|
+
}
|
|
252
|
+
init() {
|
|
253
|
+
this.hookListsMap = /* @__PURE__ */ new WeakMap(), this.mountedDecorators = /* @__PURE__ */ new Set(), this.prevMountedDecorators = /* @__PURE__ */ new Set(),
|
|
254
|
+
this.currentHooks = [], this.nextHookIndex = 0, this.currentPhase = "NONE", this.currentEffects = [], this.prevEffects = [], this.currentDecoratorName =
|
|
255
|
+
null, this.hasUpdates = !1, this.currentContext = null;
|
|
256
|
+
}
|
|
257
|
+
clean() {
|
|
258
|
+
this.prevEffects.forEach((r) => {
|
|
259
|
+
r.destroy && r.destroy();
|
|
260
|
+
}), this.init(), this.removeRenderListeners();
|
|
261
|
+
}
|
|
262
|
+
getNextHook() {
|
|
263
|
+
let r = this.currentHooks[this.nextHookIndex];
|
|
264
|
+
return this.nextHookIndex += 1, r;
|
|
265
|
+
}
|
|
266
|
+
triggerEffects() {
|
|
267
|
+
this.prevEffects.forEach((r) => {
|
|
268
|
+
!this.currentEffects.includes(r) && r.destroy && r.destroy();
|
|
269
|
+
}), this.currentEffects.forEach((r) => {
|
|
270
|
+
this.prevEffects.includes(r) || (r.destroy = r.create());
|
|
271
|
+
}), this.prevEffects = this.currentEffects, this.currentEffects = [];
|
|
272
|
+
}
|
|
273
|
+
addRenderListeners() {
|
|
274
|
+
this.removeRenderListeners(), te.getChannel().on(F.STORY_RENDERED, this.renderListener);
|
|
275
|
+
}
|
|
276
|
+
removeRenderListeners() {
|
|
277
|
+
te.getChannel().removeListener(F.STORY_RENDERED, this.renderListener);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
function Fe(e) {
|
|
281
|
+
let r = /* @__PURE__ */ s((...t) => {
|
|
282
|
+
let { hooks: o } = typeof t[0] == "function" ? t[1] : t[0], a = o.currentPhase, n = o.currentHooks, i = o.nextHookIndex, p = o.currentDecoratorName;
|
|
283
|
+
o.currentDecoratorName = e.name, o.prevMountedDecorators.has(e) ? (o.currentPhase = "UPDATE", o.currentHooks = o.hookListsMap.get(e) || []) :
|
|
284
|
+
(o.currentPhase = "MOUNT", o.currentHooks = [], o.hookListsMap.set(e, o.currentHooks), o.prevMountedDecorators.add(e)), o.nextHookIndex =
|
|
285
|
+
0;
|
|
286
|
+
let d = W.global.STORYBOOK_HOOKS_CONTEXT;
|
|
287
|
+
W.global.STORYBOOK_HOOKS_CONTEXT = o;
|
|
288
|
+
let c = e(...t);
|
|
289
|
+
if (W.global.STORYBOOK_HOOKS_CONTEXT = d, o.currentPhase === "UPDATE" && o.getNextHook() != null)
|
|
290
|
+
throw new Error(
|
|
291
|
+
"Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
|
|
292
|
+
);
|
|
293
|
+
return o.currentPhase = a, o.currentHooks = n, o.nextHookIndex = i, o.currentDecoratorName = p, c;
|
|
294
|
+
}, "hookified");
|
|
295
|
+
return r.originalFn = e, r;
|
|
296
|
+
}
|
|
297
|
+
s(Fe, "hookify");
|
|
298
|
+
var oe = 0, Sr = 25, je = /* @__PURE__ */ s((e) => (r, t) => {
|
|
299
|
+
let o = e(
|
|
300
|
+
Fe(r),
|
|
301
|
+
t.map((a) => Fe(a))
|
|
302
|
+
);
|
|
303
|
+
return (a) => {
|
|
304
|
+
let { hooks: n } = a;
|
|
305
|
+
n.prevMountedDecorators ??= /* @__PURE__ */ new Set(), n.mountedDecorators = /* @__PURE__ */ new Set([r, ...t]), n.currentContext = a, n.
|
|
306
|
+
hasUpdates = !1;
|
|
307
|
+
let i = o(a);
|
|
308
|
+
for (oe = 1; n.hasUpdates; )
|
|
309
|
+
if (n.hasUpdates = !1, n.currentEffects = [], i = o(a), oe += 1, oe > Sr)
|
|
310
|
+
throw new Error(
|
|
311
|
+
"Too many re-renders. Storybook limits the number of renders to prevent an infinite loop."
|
|
312
|
+
);
|
|
313
|
+
return n.addRenderListeners(), i;
|
|
314
|
+
};
|
|
315
|
+
}, "applyHooks");
|
|
316
|
+
|
|
317
|
+
// ../node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
|
|
318
|
+
function N(e) {
|
|
319
|
+
if (!e || typeof e != "object")
|
|
320
|
+
return !1;
|
|
321
|
+
let r = Object.getPrototypeOf(e);
|
|
322
|
+
return r === null || r === Object.prototype || Object.getPrototypeOf(r) === null ? Object.prototype.toString.call(e) === "[object Object]" :
|
|
323
|
+
!1;
|
|
324
|
+
}
|
|
325
|
+
s(N, "isPlainObject");
|
|
326
|
+
|
|
327
|
+
// ../node_modules/es-toolkit/dist/object/mapValues.mjs
|
|
328
|
+
function E(e, r) {
|
|
329
|
+
let t = {}, o = Object.keys(e);
|
|
330
|
+
for (let a = 0; a < o.length; a++) {
|
|
331
|
+
let n = o[a], i = e[n];
|
|
332
|
+
t[n] = r(i, n, e);
|
|
333
|
+
}
|
|
334
|
+
return t;
|
|
335
|
+
}
|
|
336
|
+
s(E, "mapValues");
|
|
337
|
+
|
|
338
|
+
// ../node_modules/es-toolkit/dist/object/pickBy.mjs
|
|
339
|
+
function ne(e, r) {
|
|
340
|
+
let t = {}, o = Object.keys(e);
|
|
341
|
+
for (let a = 0; a < o.length; a++) {
|
|
342
|
+
let n = o[a], i = e[n];
|
|
343
|
+
r(i, n) && (t[n] = i);
|
|
344
|
+
}
|
|
345
|
+
return t;
|
|
346
|
+
}
|
|
347
|
+
s(ne, "pickBy");
|
|
348
|
+
|
|
349
|
+
// src/preview-api/modules/store/args.ts
|
|
350
|
+
var Ar = require("storybook/internal/client-logger");
|
|
351
|
+
var Rr = b(M(), 1);
|
|
352
|
+
var Rt = Symbol("incompatible");
|
|
353
|
+
var bt = Symbol("Deeply equal");
|
|
354
|
+
var se = "UNTARGETED";
|
|
355
|
+
function Ie({
|
|
356
|
+
args: e,
|
|
357
|
+
argTypes: r
|
|
358
|
+
}) {
|
|
359
|
+
let t = {};
|
|
360
|
+
return Object.entries(e).forEach(([o, a]) => {
|
|
361
|
+
let { target: n = se } = r[o] || {};
|
|
362
|
+
t[n] = t[n] || {}, t[n][o] = a;
|
|
363
|
+
}), t;
|
|
364
|
+
}
|
|
365
|
+
s(Ie, "groupArgsByTarget");
|
|
366
|
+
|
|
367
|
+
// src/preview-api/modules/store/csf/getValuesFromArgTypes.ts
|
|
368
|
+
var Ne = /* @__PURE__ */ s((e = {}) => Object.entries(e).reduce((r, [t, { defaultValue: o }]) => (typeof o < "u" && (r[t] = o), r), {}), "ge\
|
|
369
|
+
tValuesFromArgTypes");
|
|
370
|
+
|
|
371
|
+
// src/preview-api/modules/store/csf/normalizeInputTypes.ts
|
|
372
|
+
var br = /* @__PURE__ */ s((e) => typeof e == "string" ? { name: e } : e, "normalizeType"), Cr = /* @__PURE__ */ s((e) => typeof e == "strin\
|
|
373
|
+
g" ? { type: e } : e, "normalizeControl"), wr = /* @__PURE__ */ s((e, r) => {
|
|
374
|
+
let { type: t, control: o, ...a } = e, n = {
|
|
375
|
+
name: r,
|
|
376
|
+
...a
|
|
377
|
+
};
|
|
378
|
+
return t && (n.type = br(t)), o ? n.control = Cr(o) : o === !1 && (n.control = { disable: !0 }), n;
|
|
379
|
+
}, "normalizeInputType"), j = /* @__PURE__ */ s((e) => E(e, wr), "normalizeInputTypes");
|
|
380
|
+
|
|
381
|
+
// src/preview-api/modules/store/csf/normalizeStory.ts
|
|
382
|
+
var V = require("storybook/internal/client-logger"), q = require("storybook/internal/csf"), De = b(M(), 1);
|
|
383
|
+
|
|
384
|
+
// src/preview-api/modules/store/csf/normalizeArrays.ts
|
|
385
|
+
var l = /* @__PURE__ */ s((e) => Array.isArray(e) ? e : e ? [e] : [], "normalizeArrays");
|
|
386
|
+
|
|
387
|
+
// src/preview-api/modules/store/csf/normalizeStory.ts
|
|
388
|
+
var Er = De.dedent`
|
|
389
|
+
CSF .story annotations deprecated; annotate story functions directly:
|
|
390
|
+
- StoryFn.story.name => StoryFn.storyName
|
|
391
|
+
- StoryFn.story.(parameters|decorators) => StoryFn.(parameters|decorators)
|
|
392
|
+
See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#hoisted-csf-annotations for details and codemod.
|
|
393
|
+
`;
|
|
394
|
+
function ae(e, r, t) {
|
|
395
|
+
let o = r, a = typeof r == "function" ? r : null, { story: n } = o;
|
|
396
|
+
n && (V.logger.debug("deprecated story", n), (0, V.deprecate)(Er));
|
|
397
|
+
let i = (0, q.storyNameFromExport)(e), p = typeof o != "function" && o.name || o.storyName || n?.name || i, d = [
|
|
398
|
+
...l(o.decorators),
|
|
399
|
+
...l(n?.decorators)
|
|
400
|
+
], c = { ...n?.parameters, ...o.parameters }, m = { ...n?.args, ...o.args }, u = { ...n?.argTypes, ...o.argTypes }, y = [...l(o.loaders), ...l(
|
|
401
|
+
n?.loaders)], h = [
|
|
402
|
+
...l(o.beforeEach),
|
|
403
|
+
...l(n?.beforeEach)
|
|
404
|
+
], S = [
|
|
405
|
+
...l(o.afterEach),
|
|
406
|
+
...l(n?.afterEach)
|
|
407
|
+
], { render: O, play: P, tags: A = [], globals: C = {} } = o, f = c.__id || (0, q.toId)(t.id, i);
|
|
408
|
+
return {
|
|
409
|
+
moduleExport: r,
|
|
410
|
+
id: f,
|
|
411
|
+
name: p,
|
|
412
|
+
tags: A,
|
|
413
|
+
decorators: d,
|
|
414
|
+
parameters: c,
|
|
415
|
+
args: m,
|
|
416
|
+
argTypes: j(u),
|
|
417
|
+
loaders: y,
|
|
418
|
+
beforeEach: h,
|
|
419
|
+
afterEach: S,
|
|
420
|
+
globals: C,
|
|
421
|
+
...O && { render: O },
|
|
422
|
+
...a && { userStoryFn: a },
|
|
423
|
+
...P && { play: P }
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
s(ae, "normalizeStory");
|
|
427
|
+
|
|
428
|
+
// src/preview-api/modules/store/csf/normalizeComponentAnnotations.ts
|
|
429
|
+
var Me = require("storybook/internal/csf");
|
|
430
|
+
function ze(e, r = e.title, t) {
|
|
431
|
+
let { id: o, argTypes: a } = e;
|
|
432
|
+
return {
|
|
433
|
+
id: (0, Me.sanitize)(o || r),
|
|
434
|
+
...e,
|
|
435
|
+
title: r,
|
|
436
|
+
...a && { argTypes: j(a) },
|
|
437
|
+
parameters: {
|
|
438
|
+
fileName: t,
|
|
439
|
+
...e.parameters
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
s(ze, "normalizeComponentAnnotations");
|
|
444
|
+
|
|
445
|
+
// src/preview-api/modules/store/csf/prepareStory.ts
|
|
446
|
+
var K = require("storybook/internal/csf"), Le = require("storybook/internal/preview-errors"), We = require("@storybook/global"), Ge = require("@storybook/global");
|
|
447
|
+
|
|
448
|
+
// src/preview-api/modules/preview-web/render/mount-utils.ts
|
|
449
|
+
function Ue(e) {
|
|
450
|
+
return e != null && Pr(e).includes("mount");
|
|
451
|
+
}
|
|
452
|
+
s(Ue, "mountDestructured");
|
|
453
|
+
function Pr(e) {
|
|
454
|
+
let r = e.toString().match(/[^(]*\(([^)]*)/);
|
|
455
|
+
if (!r)
|
|
456
|
+
return [];
|
|
457
|
+
let t = Be(r[1]);
|
|
458
|
+
if (!t.length)
|
|
459
|
+
return [];
|
|
460
|
+
let o = t[0];
|
|
461
|
+
return o.startsWith("{") && o.endsWith("}") ? Be(o.slice(1, -1).replace(/\s/g, "")).map((n) => n.replace(/:.*|=.*/g, "")) : [];
|
|
462
|
+
}
|
|
463
|
+
s(Pr, "getUsedProps");
|
|
464
|
+
function Be(e) {
|
|
465
|
+
let r = [], t = [], o = 0;
|
|
466
|
+
for (let n = 0; n < e.length; n++)
|
|
467
|
+
if (e[n] === "{" || e[n] === "[")
|
|
468
|
+
t.push(e[n] === "{" ? "}" : "]");
|
|
469
|
+
else if (e[n] === t[t.length - 1])
|
|
470
|
+
t.pop();
|
|
471
|
+
else if (!t.length && e[n] === ",") {
|
|
472
|
+
let i = e.substring(o, n).trim();
|
|
473
|
+
i && r.push(i), o = n + 1;
|
|
474
|
+
}
|
|
475
|
+
let a = e.substring(o).trim();
|
|
476
|
+
return a && r.push(a), r;
|
|
477
|
+
}
|
|
478
|
+
s(Be, "splitByComma");
|
|
479
|
+
|
|
480
|
+
// src/preview-api/modules/store/decorators.ts
|
|
481
|
+
function He(e, r, t) {
|
|
482
|
+
let o = t(e);
|
|
483
|
+
return (a) => r(o, a);
|
|
484
|
+
}
|
|
485
|
+
s(He, "decorateStory");
|
|
486
|
+
function $e({
|
|
487
|
+
componentId: e,
|
|
488
|
+
title: r,
|
|
489
|
+
kind: t,
|
|
490
|
+
id: o,
|
|
491
|
+
name: a,
|
|
492
|
+
story: n,
|
|
493
|
+
parameters: i,
|
|
494
|
+
initialArgs: p,
|
|
495
|
+
argTypes: d,
|
|
496
|
+
...c
|
|
497
|
+
} = {}) {
|
|
498
|
+
return c;
|
|
499
|
+
}
|
|
500
|
+
s($e, "sanitizeStoryContextUpdate");
|
|
501
|
+
function ie(e, r) {
|
|
502
|
+
let t = {}, o = /* @__PURE__ */ s((n) => (i) => {
|
|
503
|
+
if (!t.value)
|
|
504
|
+
throw new Error("Decorated function called without init");
|
|
505
|
+
return t.value = {
|
|
506
|
+
...t.value,
|
|
507
|
+
...$e(i)
|
|
508
|
+
}, n(t.value);
|
|
509
|
+
}, "bindWithContext"), a = r.reduce(
|
|
510
|
+
(n, i) => He(n, i, o),
|
|
511
|
+
e
|
|
512
|
+
);
|
|
513
|
+
return (n) => (t.value = n, a(n));
|
|
514
|
+
}
|
|
515
|
+
s(ie, "defaultDecorateStory");
|
|
516
|
+
|
|
517
|
+
// src/preview-api/modules/store/parameters.ts
|
|
518
|
+
var x = /* @__PURE__ */ s((...e) => {
|
|
519
|
+
let r = {}, t = e.filter(Boolean), o = t.reduce((a, n) => (Object.entries(n).forEach(([i, p]) => {
|
|
520
|
+
let d = a[i];
|
|
521
|
+
Array.isArray(p) || typeof d > "u" ? a[i] = p : N(p) && N(d) ? r[i] = !0 : typeof p < "u" && (a[i] = p);
|
|
522
|
+
}), a), {});
|
|
523
|
+
return Object.keys(r).forEach((a) => {
|
|
524
|
+
let n = t.filter(Boolean).map((i) => i[a]).filter((i) => typeof i < "u");
|
|
525
|
+
n.every((i) => N(i)) ? o[a] = x(...n) : o[a] = n[n.length - 1];
|
|
526
|
+
}), o;
|
|
527
|
+
}, "combineParameters");
|
|
528
|
+
|
|
529
|
+
// src/preview-api/modules/store/csf/prepareStory.ts
|
|
530
|
+
function pe(e, r, t) {
|
|
531
|
+
let { moduleExport: o, id: a, name: n } = e || {}, i = vr(
|
|
532
|
+
e,
|
|
533
|
+
r,
|
|
534
|
+
t
|
|
535
|
+
), p = /* @__PURE__ */ s(async (T) => {
|
|
536
|
+
let w = {};
|
|
537
|
+
for (let _ of [
|
|
538
|
+
l(t.loaders),
|
|
539
|
+
l(r.loaders),
|
|
540
|
+
l(e.loaders)
|
|
541
|
+
]) {
|
|
542
|
+
if (T.abortSignal.aborted)
|
|
543
|
+
return w;
|
|
544
|
+
let $ = await Promise.all(_.map((cr) => cr(T)));
|
|
545
|
+
Object.assign(w, ...$);
|
|
546
|
+
}
|
|
547
|
+
return w;
|
|
548
|
+
}, "applyLoaders"), d = /* @__PURE__ */ s(async (T) => {
|
|
549
|
+
let w = new Array();
|
|
550
|
+
for (let _ of [
|
|
551
|
+
...l(t.beforeEach),
|
|
552
|
+
...l(r.beforeEach),
|
|
553
|
+
...l(e.beforeEach)
|
|
554
|
+
]) {
|
|
555
|
+
if (T.abortSignal.aborted)
|
|
556
|
+
return w;
|
|
557
|
+
let $ = await _(T);
|
|
558
|
+
$ && w.push($);
|
|
559
|
+
}
|
|
560
|
+
return w;
|
|
561
|
+
}, "applyBeforeEach"), c = /* @__PURE__ */ s(async (T) => {
|
|
562
|
+
let w = [
|
|
563
|
+
...l(t.afterEach),
|
|
564
|
+
...l(r.afterEach),
|
|
565
|
+
...l(e.afterEach)
|
|
566
|
+
].reverse();
|
|
567
|
+
for (let _ of w) {
|
|
568
|
+
if (T.abortSignal.aborted)
|
|
569
|
+
return;
|
|
570
|
+
await _(T);
|
|
571
|
+
}
|
|
572
|
+
}, "applyAfterEach"), m = /* @__PURE__ */ s((T) => T.originalStoryFn(T.args, T), "undecoratedStoryFn"), { applyDecorators: u = ie, runStep: y } = t,
|
|
573
|
+
h = [
|
|
574
|
+
...l(e?.decorators),
|
|
575
|
+
...l(r?.decorators),
|
|
576
|
+
...l(t?.decorators)
|
|
577
|
+
], S = e?.userStoryFn || e?.render || r.render || t.render, O = je(u)(m, h), P = /* @__PURE__ */ s((T) => O(T), "unboundStoryFn"), A = e?.
|
|
578
|
+
play ?? r?.play, C = Ue(A);
|
|
579
|
+
if (!S && !C)
|
|
580
|
+
throw new Le.NoRenderFunctionError({ id: a });
|
|
581
|
+
let f = /* @__PURE__ */ s((T) => async () => (await T.renderToCanvas(), T.canvas), "defaultMount"), g = e.mount ?? r.mount ?? t.mount ?? f,
|
|
582
|
+
R = t.testingLibraryRender;
|
|
583
|
+
return {
|
|
584
|
+
storyGlobals: {},
|
|
585
|
+
...i,
|
|
586
|
+
moduleExport: o,
|
|
587
|
+
id: a,
|
|
588
|
+
name: n,
|
|
589
|
+
story: n,
|
|
590
|
+
originalStoryFn: S,
|
|
591
|
+
undecoratedStoryFn: m,
|
|
592
|
+
unboundStoryFn: P,
|
|
593
|
+
applyLoaders: p,
|
|
594
|
+
applyBeforeEach: d,
|
|
595
|
+
applyAfterEach: c,
|
|
596
|
+
playFunction: A,
|
|
597
|
+
runStep: y,
|
|
598
|
+
mount: g,
|
|
599
|
+
testingLibraryRender: R,
|
|
600
|
+
renderToCanvas: t.renderToCanvas,
|
|
601
|
+
usesMount: C
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
s(pe, "prepareStory");
|
|
605
|
+
function vr(e, r, t) {
|
|
606
|
+
let o = ["dev", "test"], a = Ge.global.DOCS_OPTIONS?.autodocs === !0 ? ["autodocs"] : [], n = (0, K.combineTags)(
|
|
607
|
+
...o,
|
|
608
|
+
...a,
|
|
609
|
+
...t.tags ?? [],
|
|
610
|
+
...r.tags ?? [],
|
|
611
|
+
...e?.tags ?? []
|
|
612
|
+
), i = x(
|
|
613
|
+
t.parameters,
|
|
614
|
+
r.parameters,
|
|
615
|
+
e?.parameters
|
|
616
|
+
), { argTypesEnhancers: p = [], argsEnhancers: d = [] } = t, c = x(
|
|
617
|
+
t.argTypes,
|
|
618
|
+
r.argTypes,
|
|
619
|
+
e?.argTypes
|
|
620
|
+
);
|
|
621
|
+
if (e) {
|
|
622
|
+
let A = e?.userStoryFn || e?.render || r.render || t.render;
|
|
623
|
+
i.__isArgsStory = A && A.length > 0;
|
|
624
|
+
}
|
|
625
|
+
let m = {
|
|
626
|
+
...t.args,
|
|
627
|
+
...r.args,
|
|
628
|
+
...e?.args
|
|
629
|
+
}, u = {
|
|
630
|
+
...r.globals,
|
|
631
|
+
...e?.globals
|
|
632
|
+
}, y = {
|
|
633
|
+
componentId: r.id,
|
|
634
|
+
title: r.title,
|
|
635
|
+
kind: r.title,
|
|
636
|
+
// Back compat
|
|
637
|
+
id: e?.id || r.id,
|
|
638
|
+
// if there's no story name, we create a fake one since enhancers expect a name
|
|
639
|
+
name: e?.name || "__meta",
|
|
640
|
+
story: e?.name || "__meta",
|
|
641
|
+
// Back compat
|
|
642
|
+
component: r.component,
|
|
643
|
+
subcomponents: r.subcomponents,
|
|
644
|
+
tags: n,
|
|
645
|
+
parameters: i,
|
|
646
|
+
initialArgs: m,
|
|
647
|
+
argTypes: c,
|
|
648
|
+
storyGlobals: u
|
|
649
|
+
};
|
|
650
|
+
y.argTypes = p.reduce(
|
|
651
|
+
(A, C) => C({ ...y, argTypes: A }),
|
|
652
|
+
y.argTypes
|
|
653
|
+
);
|
|
654
|
+
let h = { ...m };
|
|
655
|
+
y.initialArgs = [...d].reduce(
|
|
656
|
+
(A, C) => ({
|
|
657
|
+
...A,
|
|
658
|
+
...C({
|
|
659
|
+
...y,
|
|
660
|
+
initialArgs: A
|
|
661
|
+
})
|
|
662
|
+
}),
|
|
663
|
+
h
|
|
664
|
+
);
|
|
665
|
+
let { name: S, story: O, ...P } = y;
|
|
666
|
+
return P;
|
|
667
|
+
}
|
|
668
|
+
s(vr, "preparePartialAnnotations");
|
|
669
|
+
function Ve(e) {
|
|
670
|
+
let { args: r } = e, t = {
|
|
671
|
+
...e,
|
|
672
|
+
allArgs: void 0,
|
|
673
|
+
argsByTarget: void 0
|
|
674
|
+
};
|
|
675
|
+
if (We.global.FEATURES?.argTypeTargetsV7) {
|
|
676
|
+
let n = Ie(e);
|
|
677
|
+
t = {
|
|
678
|
+
...e,
|
|
679
|
+
allArgs: e.args,
|
|
680
|
+
argsByTarget: n,
|
|
681
|
+
args: n[se] || {}
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
let o = Object.entries(t.args).reduce((n, [i, p]) => {
|
|
685
|
+
if (!t.argTypes[i]?.mapping)
|
|
686
|
+
return n[i] = p, n;
|
|
687
|
+
let d = /* @__PURE__ */ s((c) => {
|
|
688
|
+
let m = t.argTypes[i].mapping;
|
|
689
|
+
return m && c in m ? m[c] : c;
|
|
690
|
+
}, "mappingFn");
|
|
691
|
+
return n[i] = Array.isArray(p) ? p.map(d) : d(p), n;
|
|
692
|
+
}, {}), a = Object.entries(o).reduce((n, [i, p]) => {
|
|
693
|
+
let d = t.argTypes[i] || {};
|
|
694
|
+
return (0, K.includeConditionalArg)(d, o, t.globals) && (n[i] = p), n;
|
|
695
|
+
}, {});
|
|
696
|
+
return { ...t, unmappedArgs: r, args: a };
|
|
697
|
+
}
|
|
698
|
+
s(Ve, "prepareContext");
|
|
699
|
+
|
|
700
|
+
// src/preview-api/modules/store/inferArgTypes.ts
|
|
701
|
+
var qe = require("storybook/internal/client-logger");
|
|
702
|
+
var Ke = b(M(), 1);
|
|
703
|
+
var ce = /* @__PURE__ */ s((e, r, t) => {
|
|
704
|
+
let o = typeof e;
|
|
705
|
+
switch (o) {
|
|
706
|
+
case "boolean":
|
|
707
|
+
case "string":
|
|
708
|
+
case "number":
|
|
709
|
+
case "function":
|
|
710
|
+
case "symbol":
|
|
711
|
+
return { name: o };
|
|
712
|
+
default:
|
|
713
|
+
break;
|
|
714
|
+
}
|
|
715
|
+
return e ? t.has(e) ? (qe.logger.warn(Ke.dedent`
|
|
716
|
+
We've detected a cycle in arg '${r}'. Args should be JSON-serializable.
|
|
717
|
+
|
|
718
|
+
Consider using the mapping feature or fully custom args:
|
|
719
|
+
- Mapping: https://storybook.js.org/docs/writing-stories/args#mapping-to-complex-arg-values
|
|
720
|
+
- Custom args: https://storybook.js.org/docs/essentials/controls#fully-custom-args
|
|
721
|
+
`), { name: "other", value: "cyclic object" }) : (t.add(e), Array.isArray(e) ? { name: "array", value: e.length > 0 ? ce(e[0], r, new Set(
|
|
722
|
+
t)) : { name: "other", value: "unknown" } } : { name: "object", value: E(e, (n) => ce(n, r, new Set(t))) }) : { name: "object", value: {} };
|
|
723
|
+
}, "inferType"), de = /* @__PURE__ */ s((e) => {
|
|
724
|
+
let { id: r, argTypes: t = {}, initialArgs: o = {} } = e, a = E(o, (i, p) => ({
|
|
725
|
+
name: p,
|
|
726
|
+
type: ce(i, `${r}.${p}`, /* @__PURE__ */ new Set())
|
|
727
|
+
})), n = E(t, (i, p) => ({
|
|
728
|
+
name: p
|
|
729
|
+
}));
|
|
730
|
+
return x(a, n, t);
|
|
731
|
+
}, "inferArgTypes");
|
|
732
|
+
de.secondPass = !0;
|
|
733
|
+
|
|
734
|
+
// src/preview-api/modules/store/inferControls.ts
|
|
735
|
+
var Je = require("storybook/internal/client-logger");
|
|
736
|
+
|
|
737
|
+
// src/preview-api/modules/store/filterArgTypes.ts
|
|
738
|
+
var Ye = /* @__PURE__ */ s((e, r) => Array.isArray(r) ? r.includes(e) : e.match(r), "matches"), le = /* @__PURE__ */ s((e, r, t) => !r && !t ?
|
|
739
|
+
e : e && ne(e, (o, a) => {
|
|
740
|
+
let n = o.name || a.toString();
|
|
741
|
+
return !!(!r || Ye(n, r)) && (!t || !Ye(n, t));
|
|
742
|
+
}), "filterArgTypes");
|
|
743
|
+
|
|
744
|
+
// src/preview-api/modules/store/inferControls.ts
|
|
745
|
+
var kr = /* @__PURE__ */ s((e, r, t) => {
|
|
746
|
+
let { type: o, options: a } = e;
|
|
747
|
+
if (o) {
|
|
748
|
+
if (t.color && t.color.test(r)) {
|
|
749
|
+
let n = o.name;
|
|
750
|
+
if (n === "string")
|
|
751
|
+
return { control: { type: "color" } };
|
|
752
|
+
n !== "enum" && Je.logger.warn(
|
|
753
|
+
`Addon controls: Control of type color only supports string, received "${n}" instead`
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
if (t.date && t.date.test(r))
|
|
757
|
+
return { control: { type: "date" } };
|
|
758
|
+
switch (o.name) {
|
|
759
|
+
case "array":
|
|
760
|
+
return { control: { type: "object" } };
|
|
761
|
+
case "boolean":
|
|
762
|
+
return { control: { type: "boolean" } };
|
|
763
|
+
case "string":
|
|
764
|
+
return { control: { type: "text" } };
|
|
765
|
+
case "number":
|
|
766
|
+
return { control: { type: "number" } };
|
|
767
|
+
case "enum": {
|
|
768
|
+
let { value: n } = o;
|
|
769
|
+
return { control: { type: n?.length <= 5 ? "radio" : "select" }, options: n };
|
|
770
|
+
}
|
|
771
|
+
case "function":
|
|
772
|
+
case "symbol":
|
|
773
|
+
return null;
|
|
774
|
+
default:
|
|
775
|
+
return { control: { type: a ? "select" : "object" } };
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}, "inferControl"), Y = /* @__PURE__ */ s((e) => {
|
|
779
|
+
let {
|
|
780
|
+
argTypes: r,
|
|
781
|
+
parameters: { __isArgsStory: t, controls: { include: o = null, exclude: a = null, matchers: n = {} } = {} }
|
|
782
|
+
} = e;
|
|
783
|
+
if (!t)
|
|
784
|
+
return r;
|
|
785
|
+
let i = le(r, o, a), p = E(i, (d, c) => d?.type && kr(d, c.toString(), n));
|
|
786
|
+
return x(p, i);
|
|
787
|
+
}, "inferControls");
|
|
788
|
+
Y.secondPass = !0;
|
|
789
|
+
|
|
790
|
+
// src/preview-api/modules/store/csf/normalizeProjectAnnotations.ts
|
|
791
|
+
function z({
|
|
792
|
+
argTypes: e,
|
|
793
|
+
globalTypes: r,
|
|
794
|
+
argTypesEnhancers: t,
|
|
795
|
+
decorators: o,
|
|
796
|
+
loaders: a,
|
|
797
|
+
beforeEach: n,
|
|
798
|
+
afterEach: i,
|
|
799
|
+
initialGlobals: p,
|
|
800
|
+
...d
|
|
801
|
+
}) {
|
|
802
|
+
return {
|
|
803
|
+
...e && { argTypes: j(e) },
|
|
804
|
+
...r && { globalTypes: j(r) },
|
|
805
|
+
decorators: l(o),
|
|
806
|
+
loaders: l(a),
|
|
807
|
+
beforeEach: l(n),
|
|
808
|
+
afterEach: l(i),
|
|
809
|
+
argTypesEnhancers: [
|
|
810
|
+
...t || [],
|
|
811
|
+
de,
|
|
812
|
+
// There's an architectural decision to be made regarding embedded addons in core:
|
|
813
|
+
//
|
|
814
|
+
// Option 1: Keep embedded addons but ensure consistency by moving addon-specific code
|
|
815
|
+
// (like inferControls) to live alongside the addon code itself. This maintains the
|
|
816
|
+
// concept of core addons while improving code organization.
|
|
817
|
+
//
|
|
818
|
+
// Option 2: Fully integrate these addons into core, potentially moving UI components
|
|
819
|
+
// into the manager and treating them as core features rather than addons. This is a
|
|
820
|
+
// bigger architectural change requiring careful consideration.
|
|
821
|
+
//
|
|
822
|
+
// For now, we're keeping inferControls here as we need time to properly evaluate
|
|
823
|
+
// these options and their implications. Some features (like Angular's cleanArgsDecorator)
|
|
824
|
+
// currently rely on this behavior.
|
|
825
|
+
//
|
|
826
|
+
// TODO: Make an architectural decision on the handling of core addons
|
|
827
|
+
Y
|
|
828
|
+
],
|
|
829
|
+
initialGlobals: p,
|
|
830
|
+
...d
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
s(z, "normalizeProjectAnnotations");
|
|
834
|
+
|
|
835
|
+
// src/preview-api/modules/store/csf/composeConfigs.ts
|
|
836
|
+
var Ze = require("@storybook/global");
|
|
837
|
+
|
|
838
|
+
// src/preview-api/modules/store/csf/beforeAll.ts
|
|
839
|
+
var Xe = /* @__PURE__ */ s((e) => async () => {
|
|
840
|
+
let r = [];
|
|
841
|
+
for (let t of e) {
|
|
842
|
+
let o = await t();
|
|
843
|
+
o && r.unshift(o);
|
|
844
|
+
}
|
|
845
|
+
return async () => {
|
|
846
|
+
for (let t of r)
|
|
847
|
+
await t();
|
|
848
|
+
};
|
|
849
|
+
}, "composeBeforeAllHooks");
|
|
850
|
+
|
|
851
|
+
// src/preview-api/modules/store/csf/stepRunners.ts
|
|
852
|
+
function ue(e) {
|
|
853
|
+
return async (r, t, o) => {
|
|
854
|
+
await e.reduceRight(
|
|
855
|
+
(n, i) => async () => i(r, n, o),
|
|
856
|
+
async () => t(o)
|
|
857
|
+
)();
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
s(ue, "composeStepRunners");
|
|
861
|
+
|
|
862
|
+
// src/preview-api/modules/store/csf/composeConfigs.ts
|
|
863
|
+
function U(e, r) {
|
|
864
|
+
return e.map((t) => t.default?.[r] ?? t[r]).filter(Boolean);
|
|
865
|
+
}
|
|
866
|
+
s(U, "getField");
|
|
867
|
+
function v(e, r, t = {}) {
|
|
868
|
+
return U(e, r).reduce((o, a) => {
|
|
869
|
+
let n = l(a);
|
|
870
|
+
return t.reverseFileOrder ? [...n, ...o] : [...o, ...n];
|
|
871
|
+
}, []);
|
|
872
|
+
}
|
|
873
|
+
s(v, "getArrayField");
|
|
874
|
+
function J(e, r) {
|
|
875
|
+
return Object.assign({}, ...U(e, r));
|
|
876
|
+
}
|
|
877
|
+
s(J, "getObjectField");
|
|
878
|
+
function B(e, r) {
|
|
879
|
+
return U(e, r).pop();
|
|
880
|
+
}
|
|
881
|
+
s(B, "getSingletonField");
|
|
882
|
+
function H(e) {
|
|
883
|
+
let r = v(e, "argTypesEnhancers"), t = U(e, "runStep"), o = v(e, "beforeAll");
|
|
884
|
+
return {
|
|
885
|
+
parameters: x(...U(e, "parameters")),
|
|
886
|
+
decorators: v(e, "decorators", {
|
|
887
|
+
reverseFileOrder: !(Ze.global.FEATURES?.legacyDecoratorFileOrder ?? !1)
|
|
888
|
+
}),
|
|
889
|
+
args: J(e, "args"),
|
|
890
|
+
argsEnhancers: v(e, "argsEnhancers"),
|
|
891
|
+
argTypes: J(e, "argTypes"),
|
|
892
|
+
argTypesEnhancers: [
|
|
893
|
+
...r.filter((a) => !a.secondPass),
|
|
894
|
+
...r.filter((a) => a.secondPass)
|
|
895
|
+
],
|
|
896
|
+
initialGlobals: J(e, "initialGlobals"),
|
|
897
|
+
globalTypes: J(e, "globalTypes"),
|
|
898
|
+
loaders: v(e, "loaders"),
|
|
899
|
+
beforeAll: Xe(o),
|
|
900
|
+
beforeEach: v(e, "beforeEach"),
|
|
901
|
+
afterEach: v(e, "afterEach"),
|
|
902
|
+
render: B(e, "render"),
|
|
903
|
+
renderToCanvas: B(e, "renderToCanvas"),
|
|
904
|
+
applyDecorators: B(e, "applyDecorators"),
|
|
905
|
+
runStep: ue(t),
|
|
906
|
+
tags: v(e, "tags"),
|
|
907
|
+
mount: B(e, "mount"),
|
|
908
|
+
testingLibraryRender: B(e, "testingLibraryRender")
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
s(H, "composeConfigs");
|
|
912
|
+
|
|
913
|
+
// src/preview-api/modules/store/csf/portable-stories.ts
|
|
914
|
+
var Fr = require("storybook/internal/csf"), jr = require("storybook/internal/csf"), or = require("storybook/internal/preview-errors"), _r = b(M(), 1);
|
|
915
|
+
|
|
916
|
+
// src/preview-api/modules/preview-web/render/animation-utils.ts
|
|
917
|
+
function Qe() {
|
|
918
|
+
try {
|
|
919
|
+
return (
|
|
920
|
+
// @ts-expect-error this property exists in certain environments
|
|
921
|
+
!!globalThis.__vitest_browser__ || // @ts-expect-error this property exists in certain environments
|
|
922
|
+
!!globalThis.__playwright__binding__
|
|
923
|
+
);
|
|
924
|
+
} catch {
|
|
925
|
+
return !1;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
s(Qe, "isTestEnvironment");
|
|
929
|
+
function er(e = !0) {
|
|
930
|
+
if (!("document" in globalThis && "createElement" in globalThis.document))
|
|
931
|
+
return () => {
|
|
932
|
+
};
|
|
933
|
+
let r = document.createElement("style");
|
|
934
|
+
r.textContent = `*, *:before, *:after {
|
|
935
|
+
animation: none !important;
|
|
936
|
+
}`, document.head.appendChild(r);
|
|
937
|
+
let t = document.createElement("style");
|
|
938
|
+
return t.textContent = `*, *:before, *:after {
|
|
939
|
+
animation-delay: 0s !important;
|
|
940
|
+
animation-direction: ${e ? "reverse" : "normal"} !important;
|
|
941
|
+
animation-play-state: paused !important;
|
|
942
|
+
transition: none !important;
|
|
943
|
+
}`, document.head.appendChild(t), document.body.clientHeight, document.head.removeChild(r), () => {
|
|
944
|
+
t.parentNode?.removeChild(t);
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
s(er, "pauseAnimations");
|
|
948
|
+
async function rr(e) {
|
|
949
|
+
if (!("document" in globalThis && "getAnimations" in globalThis.document && "querySelectorAll" in globalThis.document))
|
|
950
|
+
return;
|
|
951
|
+
let r = !1;
|
|
952
|
+
await Promise.race([
|
|
953
|
+
// After 50ms, retrieve any running animations and wait for them to finish
|
|
954
|
+
// If new animations are created while waiting, we'll wait for them too
|
|
955
|
+
new Promise((t) => {
|
|
956
|
+
setTimeout(() => {
|
|
957
|
+
let o = [globalThis.document, ...tr(globalThis.document)], a = /* @__PURE__ */ s(async () => {
|
|
958
|
+
if (r || e?.aborted)
|
|
959
|
+
return;
|
|
960
|
+
let n = o.flatMap((i) => i?.getAnimations?.() || []).filter((i) => i.playState === "running" && !Or(i));
|
|
961
|
+
n.length > 0 && (await Promise.all(n.map((i) => i.finished)), await a());
|
|
962
|
+
}, "checkAnimationsFinished");
|
|
963
|
+
a().then(t);
|
|
964
|
+
}, 100);
|
|
965
|
+
}),
|
|
966
|
+
// If animations don't finish within the timeout, continue without waiting
|
|
967
|
+
new Promise(
|
|
968
|
+
(t) => setTimeout(() => {
|
|
969
|
+
r = !0, t(void 0);
|
|
970
|
+
}, 5e3)
|
|
971
|
+
)
|
|
972
|
+
]);
|
|
973
|
+
}
|
|
974
|
+
s(rr, "waitForAnimations");
|
|
975
|
+
function tr(e) {
|
|
976
|
+
return [e, ...e.querySelectorAll("*")].reduce((r, t) => ("shadowRoot" in t && t.shadowRoot && r.push(t.shadowRoot, ...tr(t.shadowRoot)), r),
|
|
977
|
+
[]);
|
|
978
|
+
}
|
|
979
|
+
s(tr, "getShadowRoots");
|
|
980
|
+
function Or(e) {
|
|
981
|
+
if (e instanceof CSSAnimation && e.effect instanceof KeyframeEffect && e.effect.target) {
|
|
982
|
+
let r = getComputedStyle(e.effect.target, e.effect.pseudoElement), t = r.animationName?.split(", ").indexOf(e.animationName);
|
|
983
|
+
return r.animationIterationCount.split(", ")[t] === "infinite";
|
|
984
|
+
}
|
|
985
|
+
return !1;
|
|
986
|
+
}
|
|
987
|
+
s(Or, "isInfiniteAnimation");
|
|
988
|
+
|
|
989
|
+
// src/preview-api/modules/store/reporter-api.ts
|
|
990
|
+
var X = class {
|
|
991
|
+
constructor() {
|
|
992
|
+
this.reports = [];
|
|
993
|
+
}
|
|
994
|
+
static {
|
|
995
|
+
s(this, "ReporterAPI");
|
|
996
|
+
}
|
|
997
|
+
async addReport(r) {
|
|
998
|
+
this.reports.push(r);
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
|
|
1002
|
+
// src/preview-api/modules/store/csf/portable-stories.ts
|
|
1003
|
+
var Ir = "ComposedStory", Nr = "Unnamed Story";
|
|
1004
|
+
var k = [];
|
|
1005
|
+
function fe(e, r, t, o, a) {
|
|
1006
|
+
if (e === void 0)
|
|
1007
|
+
throw new Error("Expected a story but received undefined.");
|
|
1008
|
+
r.title = r.title ?? Ir;
|
|
1009
|
+
let n = ze(r), i = a || e.storyName || e.story?.name || e.name || Nr, p = ae(
|
|
1010
|
+
i,
|
|
1011
|
+
e,
|
|
1012
|
+
n
|
|
1013
|
+
), d = z(
|
|
1014
|
+
H([
|
|
1015
|
+
o ?? globalThis.globalProjectAnnotations ?? {},
|
|
1016
|
+
t ?? {}
|
|
1017
|
+
])
|
|
1018
|
+
), c = pe(
|
|
1019
|
+
p,
|
|
1020
|
+
n,
|
|
1021
|
+
d
|
|
1022
|
+
), u = {
|
|
1023
|
+
...Ne(d.globalTypes),
|
|
1024
|
+
...d.initialGlobals,
|
|
1025
|
+
...c.storyGlobals
|
|
1026
|
+
}, y = new X(), h = /* @__PURE__ */ s(() => {
|
|
1027
|
+
let f = Ve({
|
|
1028
|
+
hooks: new G(),
|
|
1029
|
+
globals: u,
|
|
1030
|
+
args: { ...c.initialArgs },
|
|
1031
|
+
viewMode: "story",
|
|
1032
|
+
reporting: y,
|
|
1033
|
+
loaded: {},
|
|
1034
|
+
abortSignal: new AbortController().signal,
|
|
1035
|
+
step: /* @__PURE__ */ s((g, R) => c.runStep(g, R, f), "step"),
|
|
1036
|
+
canvasElement: null,
|
|
1037
|
+
canvas: {},
|
|
1038
|
+
userEvent: {},
|
|
1039
|
+
globalTypes: d.globalTypes,
|
|
1040
|
+
...c,
|
|
1041
|
+
context: null,
|
|
1042
|
+
mount: null
|
|
1043
|
+
});
|
|
1044
|
+
return f.parameters.__isPortableStory = !0, f.context = f, c.renderToCanvas && (f.renderToCanvas = async () => {
|
|
1045
|
+
let g = await c.renderToCanvas?.(
|
|
1046
|
+
{
|
|
1047
|
+
componentId: c.componentId,
|
|
1048
|
+
title: c.title,
|
|
1049
|
+
id: c.id,
|
|
1050
|
+
name: c.name,
|
|
1051
|
+
tags: c.tags,
|
|
1052
|
+
showMain: /* @__PURE__ */ s(() => {
|
|
1053
|
+
}, "showMain"),
|
|
1054
|
+
showError: /* @__PURE__ */ s((R) => {
|
|
1055
|
+
throw new Error(`${R.title}
|
|
1056
|
+
${R.description}`);
|
|
1057
|
+
}, "showError"),
|
|
1058
|
+
showException: /* @__PURE__ */ s((R) => {
|
|
1059
|
+
throw R;
|
|
1060
|
+
}, "showException"),
|
|
1061
|
+
forceRemount: !0,
|
|
1062
|
+
storyContext: f,
|
|
1063
|
+
storyFn: /* @__PURE__ */ s(() => c.unboundStoryFn(f), "storyFn"),
|
|
1064
|
+
unboundStoryFn: c.unboundStoryFn
|
|
1065
|
+
},
|
|
1066
|
+
f.canvasElement
|
|
1067
|
+
);
|
|
1068
|
+
g && k.push(g);
|
|
1069
|
+
}), f.mount = c.mount(f), f;
|
|
1070
|
+
}, "initializeContext"), S, O = /* @__PURE__ */ s(async (f) => {
|
|
1071
|
+
let g = h();
|
|
1072
|
+
return g.canvasElement ??= globalThis?.document?.body, S && (g.loaded = S.loaded), Object.assign(g, f), c.playFunction(g);
|
|
1073
|
+
}, "play"), P = /* @__PURE__ */ s((f) => {
|
|
1074
|
+
let g = h();
|
|
1075
|
+
return Object.assign(g, f), Dr(c, g);
|
|
1076
|
+
}, "run"), A = c.playFunction ? O : void 0;
|
|
1077
|
+
return Object.assign(
|
|
1078
|
+
/* @__PURE__ */ s(function(g) {
|
|
1079
|
+
let R = h();
|
|
1080
|
+
return S && (R.loaded = S.loaded), R.args = {
|
|
1081
|
+
...R.initialArgs,
|
|
1082
|
+
...g
|
|
1083
|
+
}, c.unboundStoryFn(R);
|
|
1084
|
+
}, "storyFn"),
|
|
1085
|
+
{
|
|
1086
|
+
id: c.id,
|
|
1087
|
+
storyName: i,
|
|
1088
|
+
load: /* @__PURE__ */ s(async () => {
|
|
1089
|
+
for (let g of [...k].reverse())
|
|
1090
|
+
await g();
|
|
1091
|
+
k.length = 0;
|
|
1092
|
+
let f = h();
|
|
1093
|
+
f.loaded = await c.applyLoaders(f), k.push(...(await c.applyBeforeEach(f)).filter(Boolean)), S = f;
|
|
1094
|
+
}, "load"),
|
|
1095
|
+
globals: u,
|
|
1096
|
+
args: c.initialArgs,
|
|
1097
|
+
parameters: c.parameters,
|
|
1098
|
+
argTypes: c.argTypes,
|
|
1099
|
+
play: A,
|
|
1100
|
+
run: P,
|
|
1101
|
+
reporting: y,
|
|
1102
|
+
tags: c.tags
|
|
1103
|
+
}
|
|
1104
|
+
);
|
|
1105
|
+
}
|
|
1106
|
+
s(fe, "composeStory");
|
|
1107
|
+
async function Dr(e, r) {
|
|
1108
|
+
for (let n of [...k].reverse())
|
|
1109
|
+
await n();
|
|
1110
|
+
if (k.length = 0, !r.canvasElement) {
|
|
1111
|
+
let n = document.createElement("div");
|
|
1112
|
+
globalThis?.document?.body?.appendChild(n), r.canvasElement = n, k.push(() => {
|
|
1113
|
+
globalThis?.document?.body?.contains(n) && globalThis?.document?.body?.removeChild(n);
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
if (r.loaded = await e.applyLoaders(r), r.abortSignal.aborted)
|
|
1117
|
+
return;
|
|
1118
|
+
k.push(...(await e.applyBeforeEach(r)).filter(Boolean));
|
|
1119
|
+
let t = e.playFunction, o = e.usesMount;
|
|
1120
|
+
if (o || await r.mount(), r.abortSignal.aborted)
|
|
1121
|
+
return;
|
|
1122
|
+
t && (o || (r.mount = async () => {
|
|
1123
|
+
throw new or.MountMustBeDestructuredError({ playFunction: t.toString() });
|
|
1124
|
+
}), await t(r));
|
|
1125
|
+
let a;
|
|
1126
|
+
Qe() ? a = er() : await rr(r.abortSignal), await e.applyAfterEach(r), await a?.();
|
|
1127
|
+
}
|
|
1128
|
+
s(Dr, "runStory");
|
|
1129
|
+
|
|
1130
|
+
// src/csf/core-annotations.ts
|
|
1131
|
+
var me = b(require("storybook/internal/component-testing/preview"), 1), ye = b(require("storybook/actions/preview"), 1), ge = b(require("storybook/backgrounds/preview"), 1),
|
|
1132
|
+
Te = b(require("storybook/highlight/preview"), 1), xe = b(require("storybook/measure/preview"), 1), he = b(require("storybook/outline/preview"), 1),
|
|
1133
|
+
Se = b(require("storybook/test/preview"), 1), Ae = b(require("storybook/viewport/preview"), 1);
|
|
1134
|
+
function Re() {
|
|
1135
|
+
return [
|
|
1136
|
+
// @ts-expect-error CJS fallback
|
|
1137
|
+
(xe.default.default ?? xe.default)(),
|
|
1138
|
+
// @ts-expect-error CJS fallback
|
|
1139
|
+
(ge.default.default ?? ge.default)(),
|
|
1140
|
+
// @ts-expect-error CJS fallback
|
|
1141
|
+
(Te.default.default ?? Te.default)(),
|
|
1142
|
+
// @ts-expect-error CJS fallback
|
|
1143
|
+
(he.default.default ?? he.default)(),
|
|
1144
|
+
// @ts-expect-error CJS fallback
|
|
1145
|
+
(Ae.default.default ?? Ae.default)(),
|
|
1146
|
+
// @ts-expect-error CJS fallback
|
|
1147
|
+
(ye.default.default ?? ye.default)(),
|
|
1148
|
+
// @ts-expect-error CJS fallback
|
|
1149
|
+
(me.default.default ?? me.default)(),
|
|
1150
|
+
// @ts-expect-error CJS fallback
|
|
1151
|
+
(Se.default.default ?? Se.default)()
|
|
1152
|
+
];
|
|
1153
|
+
}
|
|
1154
|
+
s(Re, "getCoreAnnotations");
|
|
1155
|
+
|
|
1156
|
+
// src/csf/csf-factories.ts
|
|
1157
|
+
function Mr(e) {
|
|
1158
|
+
let r, t = {
|
|
1159
|
+
_tag: "Preview",
|
|
1160
|
+
input: e,
|
|
1161
|
+
get composed() {
|
|
1162
|
+
if (r)
|
|
1163
|
+
return r;
|
|
1164
|
+
let { addons: o, ...a } = e;
|
|
1165
|
+
return r = z(
|
|
1166
|
+
H([...Re(), ...o ?? [], a])
|
|
1167
|
+
), r;
|
|
1168
|
+
},
|
|
1169
|
+
meta(o) {
|
|
1170
|
+
return Hr(o, this);
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
return globalThis.globalProjectAnnotations = t.composed, t;
|
|
1174
|
+
}
|
|
1175
|
+
s(Mr, "definePreview");
|
|
1176
|
+
function zr(e) {
|
|
1177
|
+
return e;
|
|
1178
|
+
}
|
|
1179
|
+
s(zr, "definePreviewAddon");
|
|
1180
|
+
function Br(e) {
|
|
138
1181
|
return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Preview";
|
|
139
1182
|
}
|
|
140
|
-
|
|
141
|
-
function
|
|
1183
|
+
s(Br, "isPreview");
|
|
1184
|
+
function Ur(e) {
|
|
142
1185
|
return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Meta";
|
|
143
1186
|
}
|
|
144
|
-
|
|
145
|
-
function
|
|
1187
|
+
s(Ur, "isMeta");
|
|
1188
|
+
function Hr(e, r) {
|
|
1189
|
+
return {
|
|
1190
|
+
_tag: "Meta",
|
|
1191
|
+
input: e,
|
|
1192
|
+
preview: r,
|
|
1193
|
+
get composed() {
|
|
1194
|
+
throw new Error("Not implemented");
|
|
1195
|
+
},
|
|
1196
|
+
// @ts-expect-error hard
|
|
1197
|
+
story(t = {}) {
|
|
1198
|
+
return sr(typeof t == "function" ? { render: t } : t, this);
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
s(Hr, "defineMeta");
|
|
1203
|
+
function $r(e) {
|
|
146
1204
|
return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Story";
|
|
147
1205
|
}
|
|
148
|
-
|
|
1206
|
+
s($r, "isStory");
|
|
1207
|
+
function sr(e, r) {
|
|
1208
|
+
let t, o = /* @__PURE__ */ s(() => (t || (t = fe(
|
|
1209
|
+
e,
|
|
1210
|
+
r.input,
|
|
1211
|
+
void 0,
|
|
1212
|
+
r.preview.composed
|
|
1213
|
+
)), t), "compose");
|
|
1214
|
+
return {
|
|
1215
|
+
_tag: "Story",
|
|
1216
|
+
input: e,
|
|
1217
|
+
meta: r,
|
|
1218
|
+
__compose: o,
|
|
1219
|
+
get composed() {
|
|
1220
|
+
let a = o(), { args: n, argTypes: i, parameters: p, id: d, tags: c, globals: m, storyName: u } = a;
|
|
1221
|
+
return { args: n, argTypes: i, parameters: p, id: d, tags: c, name: u, globals: m };
|
|
1222
|
+
},
|
|
1223
|
+
get play() {
|
|
1224
|
+
return e.play ?? r.input?.play ?? (async () => {
|
|
1225
|
+
});
|
|
1226
|
+
},
|
|
1227
|
+
get run() {
|
|
1228
|
+
return o().run ?? (async () => {
|
|
1229
|
+
});
|
|
1230
|
+
},
|
|
1231
|
+
extend(a) {
|
|
1232
|
+
return sr(
|
|
1233
|
+
{
|
|
1234
|
+
...this.input,
|
|
1235
|
+
...a,
|
|
1236
|
+
args: { ...this.input.args, ...a.args },
|
|
1237
|
+
argTypes: x(this.input.argTypes, a.argTypes),
|
|
1238
|
+
afterEach: [
|
|
1239
|
+
...l(this.input?.afterEach ?? []),
|
|
1240
|
+
...l(a.afterEach ?? [])
|
|
1241
|
+
],
|
|
1242
|
+
beforeEach: [
|
|
1243
|
+
...l(this.input?.beforeEach ?? []),
|
|
1244
|
+
...l(a.beforeEach ?? [])
|
|
1245
|
+
],
|
|
1246
|
+
decorators: [
|
|
1247
|
+
...l(this.input?.decorators ?? []),
|
|
1248
|
+
...l(a.decorators ?? [])
|
|
1249
|
+
],
|
|
1250
|
+
globals: { ...this.input.globals, ...a.globals },
|
|
1251
|
+
loaders: [
|
|
1252
|
+
...l(this.input?.loaders ?? []),
|
|
1253
|
+
...l(a.loaders ?? [])
|
|
1254
|
+
],
|
|
1255
|
+
parameters: x(this.input.parameters, a.parameters),
|
|
1256
|
+
tags: (0, nr.combineTags)(...this.input.tags ?? [], ...a.tags ?? [])
|
|
1257
|
+
},
|
|
1258
|
+
this.meta
|
|
1259
|
+
);
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
}
|
|
1263
|
+
s(sr, "defineStory");
|
|
149
1264
|
|
|
150
1265
|
// src/csf/index.ts
|
|
151
|
-
var
|
|
152
|
-
"-").replace(/^-+/, "").replace(/-+$/, ""), "sanitize"),
|
|
153
|
-
let t =
|
|
1266
|
+
var pr = /* @__PURE__ */ s((e) => e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/-+/g,
|
|
1267
|
+
"-").replace(/^-+/, "").replace(/-+$/, ""), "sanitize"), ar = /* @__PURE__ */ s((e, r) => {
|
|
1268
|
+
let t = pr(e);
|
|
154
1269
|
if (t === "")
|
|
155
1270
|
throw new Error(`Invalid ${r} '${e}', must include alphanumeric characters`);
|
|
156
1271
|
return t;
|
|
157
|
-
}, "sanitizeSafe"),
|
|
1272
|
+
}, "sanitizeSafe"), Lr = /* @__PURE__ */ s((e, r) => `${ar(e, "kind")}${r ? `--${ar(r, "name")}` : ""}`, "toId"), Wr = /* @__PURE__ */ s((e) => we(
|
|
158
1273
|
e), "storyNameFromExport");
|
|
159
|
-
function
|
|
1274
|
+
function ir(e, r) {
|
|
160
1275
|
return Array.isArray(r) ? r.includes(e) : e.match(r);
|
|
161
1276
|
}
|
|
162
|
-
|
|
163
|
-
function
|
|
1277
|
+
s(ir, "matches");
|
|
1278
|
+
function Gr(e, { includeStories: r, excludeStories: t }) {
|
|
164
1279
|
return (
|
|
165
1280
|
// https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs
|
|
166
|
-
e !== "__esModule" && (!r ||
|
|
1281
|
+
e !== "__esModule" && (!r || ir(e, r)) && (!t || !ir(e, t))
|
|
167
1282
|
);
|
|
168
1283
|
}
|
|
169
|
-
|
|
170
|
-
var
|
|
171
|
-
let [
|
|
1284
|
+
s(Gr, "isExportStory");
|
|
1285
|
+
var Vr = /* @__PURE__ */ s((e, { rootSeparator: r, groupSeparator: t }) => {
|
|
1286
|
+
let [o, a] = e.split(r, 2), n = (a || e).split(t).filter((i) => !!i);
|
|
172
1287
|
return {
|
|
173
|
-
root:
|
|
174
|
-
groups:
|
|
1288
|
+
root: a ? o : null,
|
|
1289
|
+
groups: n
|
|
175
1290
|
};
|
|
176
|
-
}, "parseKind"),
|
|
177
|
-
let r = e.reduce((t,
|
|
1291
|
+
}, "parseKind"), qr = /* @__PURE__ */ s((...e) => {
|
|
1292
|
+
let r = e.reduce((t, o) => (o.startsWith("!") ? t.delete(o.slice(1)) : t.add(o), t), /* @__PURE__ */ new Set());
|
|
178
1293
|
return Array.from(r);
|
|
179
1294
|
}, "combineTags");
|