storybook 9.0.0-beta.1 → 9.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/server/base-preview-head.html +2 -1
- package/dist/actions/decorator.js +49 -52
- package/dist/actions/index.cjs +42 -44
- package/dist/actions/index.js +37 -40
- package/dist/actions/preview.cjs +44 -46
- package/dist/actions/preview.d.ts +501 -0
- package/dist/actions/preview.js +24 -27
- package/dist/babel/index.cjs +15060 -14974
- package/dist/babel/index.d.ts +37 -18
- package/dist/babel/index.js +15097 -15011
- package/dist/backgrounds/index.d.ts +501 -0
- package/dist/backgrounds/preview.d.ts +501 -0
- package/dist/bin/index.cjs +44 -44
- package/dist/bin/index.js +44 -44
- package/dist/builder-manager/index.cjs +303 -283
- package/dist/builder-manager/index.js +545 -524
- package/dist/channels/index.js +919 -941
- package/dist/cli/bin/index.cjs +4184 -736
- package/dist/cli/bin/index.js +4198 -748
- package/dist/cli/index.cjs +36838 -28392
- package/dist/cli/index.d.ts +974 -1
- package/dist/cli/index.js +41620 -33168
- package/dist/client-logger/index.d.ts +2 -1
- package/dist/common/index.cjs +4783 -4691
- package/dist/common/index.d.ts +8 -2
- package/dist/common/index.js +5165 -5069
- package/dist/components/index.cjs +7905 -5600
- package/dist/components/index.d.ts +12 -12
- package/dist/components/index.js +4713 -3786
- package/dist/controls/preview.d.ts +501 -0
- package/dist/core-server/index.cjs +6799 -6708
- package/dist/core-server/index.d.ts +526 -25
- package/dist/core-server/index.js +6948 -6851
- package/dist/core-server/presets/common-manager.js +4528 -3377
- package/dist/core-server/presets/common-override-preset.cjs +10 -12
- package/dist/core-server/presets/common-override-preset.js +3 -5
- package/dist/core-server/presets/common-preset.cjs +2301 -2238
- package/dist/core-server/presets/common-preset.js +2389 -2322
- package/dist/docs-tools/index.cjs +484 -464
- package/dist/docs-tools/index.js +781 -768
- package/dist/highlight/index.cjs +19 -18
- package/dist/highlight/index.d.ts +4 -5
- package/dist/highlight/index.js +3 -2
- package/dist/highlight/preview.cjs +314 -310
- package/dist/highlight/preview.d.ts +501 -0
- package/dist/highlight/preview.js +296 -292
- package/dist/instrumenter/index.cjs +561 -559
- package/dist/instrumenter/index.js +1564 -1516
- package/dist/manager/globals-module-info.cjs +2 -0
- package/dist/manager/globals-module-info.js +2 -0
- package/dist/manager/globals-runtime.js +23602 -23339
- package/dist/manager/runtime.js +4891 -4650
- package/dist/manager-api/index.cjs +2400 -2321
- package/dist/manager-api/index.d.ts +513 -1
- package/dist/manager-api/index.js +1951 -1903
- package/dist/manager-errors.js +37 -41
- package/dist/measure/index.d.ts +501 -0
- package/dist/measure/preview.d.ts +501 -0
- package/dist/node-logger/index.cjs +25 -25
- package/dist/node-logger/index.js +25 -25
- package/dist/outline/index.d.ts +501 -0
- package/dist/outline/preview.d.ts +501 -0
- package/dist/preview/runtime.js +35803 -35785
- package/dist/preview-api/index.cjs +1287 -1265
- package/dist/preview-api/index.d.ts +1 -1
- package/dist/preview-api/index.js +1367 -1361
- package/dist/preview-errors.js +152 -173
- package/dist/router/index.cjs +5674 -2282
- package/dist/router/index.d.ts +622 -243
- package/dist/router/index.js +1318 -872
- package/dist/server-errors.cjs +192 -177
- package/dist/server-errors.d.ts +11 -1
- package/dist/server-errors.js +173 -158
- package/dist/telemetry/index.cjs +4934 -1445
- package/dist/telemetry/index.d.ts +2 -1
- package/dist/telemetry/index.js +4966 -1475
- package/dist/test/index.cjs +1876 -1878
- package/dist/test/index.d.ts +1269 -83
- package/dist/test/index.js +9157 -9248
- package/dist/test/preview.cjs +49 -15862
- package/dist/test/preview.d.ts +520 -13
- package/dist/test/preview.js +42 -14493
- package/dist/theming/create.cjs +2244 -79
- package/dist/theming/create.js +951 -67
- package/dist/theming/index.cjs +3209 -1067
- package/dist/theming/index.js +1816 -947
- package/dist/types/index.cjs +4 -4
- package/dist/types/index.d.ts +3124 -2596
- package/dist/viewport/index.d.ts +502 -3
- package/dist/viewport/preview.d.ts +501 -0
- package/package.json +14 -38
- package/dist/test/spy.cjs +0 -258
- package/dist/test/spy.d.ts +0 -66
- package/dist/test/spy.js +0 -240
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var n = (r, e) =>
|
|
1
|
+
var Kn = Object.create;
|
|
2
|
+
var hr = Object.defineProperty;
|
|
3
|
+
var Xn = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var Jn = Object.getOwnPropertyNames;
|
|
5
|
+
var Qn = Object.getPrototypeOf, Zn = Object.prototype.hasOwnProperty;
|
|
6
|
+
var n = (r, e) => hr(r, "name", { value: e, configurable: !0 }), we = /* @__PURE__ */ ((r) => typeof require < "u" ? require : typeof Proxy <
|
|
7
7
|
"u" ? new Proxy(r, {
|
|
8
8
|
get: (e, t) => (typeof require < "u" ? require : e)[t]
|
|
9
9
|
}) : r)(function(r) {
|
|
@@ -11,26 +11,26 @@ var n = (r, e) => yr(r, "name", { value: e, configurable: !0 }), Ae = /* @__PURE
|
|
|
11
11
|
throw Error('Dynamic require of "' + r + '" is not supported');
|
|
12
12
|
});
|
|
13
13
|
var O = (r, e) => () => (e || r((e = { exports: {} }).exports, e), e.exports);
|
|
14
|
-
var
|
|
14
|
+
var es = (r, e, t, o) => {
|
|
15
15
|
if (e && typeof e == "object" || typeof e == "function")
|
|
16
|
-
for (let s of
|
|
17
|
-
!
|
|
16
|
+
for (let s of Jn(e))
|
|
17
|
+
!Zn.call(r, s) && s !== t && hr(r, s, { get: () => e[s], enumerable: !(o = Xn(e, s)) || o.enumerable });
|
|
18
18
|
return r;
|
|
19
19
|
};
|
|
20
|
-
var
|
|
20
|
+
var pe = (r, e, t) => (t = r != null ? Kn(Qn(r)) : {}, es(
|
|
21
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
22
|
// file that has been converted to a CommonJS file using a Babel-
|
|
23
23
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
24
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
e || !r || !r.__esModule ?
|
|
25
|
+
e || !r || !r.__esModule ? hr(t, "default", { value: r, enumerable: !0 }) : t,
|
|
26
26
|
r
|
|
27
27
|
));
|
|
28
28
|
|
|
29
29
|
// ../node_modules/memoizerific/memoizerific.js
|
|
30
|
-
var
|
|
30
|
+
var kr = O((oo, Dr) => {
|
|
31
31
|
(function(r) {
|
|
32
|
-
if (typeof
|
|
33
|
-
|
|
32
|
+
if (typeof oo == "object" && typeof Dr < "u")
|
|
33
|
+
Dr.exports = r();
|
|
34
34
|
else if (typeof define == "function" && define.amd)
|
|
35
35
|
define([], r);
|
|
36
36
|
else {
|
|
@@ -43,22 +43,22 @@ var Fr = O((_t, Pr) => {
|
|
|
43
43
|
function l(p, u) {
|
|
44
44
|
if (!i[p]) {
|
|
45
45
|
if (!s[p]) {
|
|
46
|
-
var y = typeof
|
|
46
|
+
var y = typeof we == "function" && we;
|
|
47
47
|
if (!u && y) return y(p, !0);
|
|
48
48
|
if (c) return c(p, !0);
|
|
49
|
-
var
|
|
50
|
-
throw
|
|
49
|
+
var h = new Error("Cannot find module '" + p + "'");
|
|
50
|
+
throw h.code = "MODULE_NOT_FOUND", h;
|
|
51
51
|
}
|
|
52
|
-
var
|
|
53
|
-
s[p][0].call(
|
|
54
|
-
var
|
|
55
|
-
return l(
|
|
56
|
-
},
|
|
52
|
+
var g = i[p] = { exports: {} };
|
|
53
|
+
s[p][0].call(g.exports, function(b) {
|
|
54
|
+
var m = s[p][1][b];
|
|
55
|
+
return l(m || b);
|
|
56
|
+
}, g, g.exports, o, s, i, a);
|
|
57
57
|
}
|
|
58
58
|
return i[p].exports;
|
|
59
59
|
}
|
|
60
60
|
n(l, "s");
|
|
61
|
-
for (var c = typeof
|
|
61
|
+
for (var c = typeof we == "function" && we, d = 0; d < a.length; d++) l(a[d]);
|
|
62
62
|
return l;
|
|
63
63
|
}, "e"))({ 1: [function(o, s, i) {
|
|
64
64
|
s.exports = function(a) {
|
|
@@ -107,47 +107,47 @@ var Fr = O((_t, Pr) => {
|
|
|
107
107
|
var a = o("map-or-similar");
|
|
108
108
|
s.exports = function(p) {
|
|
109
109
|
var u = new a(!1), y = [];
|
|
110
|
-
return function(
|
|
111
|
-
var
|
|
112
|
-
var b = u,
|
|
113
|
-
if ((
|
|
110
|
+
return function(h) {
|
|
111
|
+
var g = /* @__PURE__ */ n(function() {
|
|
112
|
+
var b = u, m, T, x = arguments.length - 1, f = Array(x + 1), S = !0, R;
|
|
113
|
+
if ((g.numArgs || g.numArgs === 0) && g.numArgs !== x + 1)
|
|
114
114
|
throw new Error("Memoizerific functions should always be called with the same number of arguments");
|
|
115
|
-
for (
|
|
116
|
-
if (f[
|
|
115
|
+
for (R = 0; R < x; R++) {
|
|
116
|
+
if (f[R] = {
|
|
117
117
|
cacheItem: b,
|
|
118
|
-
arg: arguments[
|
|
119
|
-
}, b.has(arguments[
|
|
120
|
-
b = b.get(arguments[
|
|
118
|
+
arg: arguments[R]
|
|
119
|
+
}, b.has(arguments[R])) {
|
|
120
|
+
b = b.get(arguments[R]);
|
|
121
121
|
continue;
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
S = !1, m = new a(!1), b.set(arguments[R], m), b = m;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
126
|
-
p > 0 && (f[
|
|
125
|
+
return S && (b.has(arguments[x]) ? T = b.get(arguments[x]) : S = !1), S || (T = h.apply(null, arguments), b.set(arguments[x], T)),
|
|
126
|
+
p > 0 && (f[x] = {
|
|
127
127
|
cacheItem: b,
|
|
128
|
-
arg: arguments[
|
|
129
|
-
},
|
|
128
|
+
arg: arguments[x]
|
|
129
|
+
}, S ? l(y, f) : y.push(f), y.length > p && c(y.shift())), g.wasMemoized = S, g.numArgs = x + 1, T;
|
|
130
130
|
}, "memoizerific");
|
|
131
|
-
return
|
|
131
|
+
return g.limit = p, g.wasMemoized = !1, g.cache = u, g.lru = y, g;
|
|
132
132
|
};
|
|
133
133
|
};
|
|
134
134
|
function l(p, u) {
|
|
135
|
-
var y = p.length,
|
|
135
|
+
var y = p.length, h = u.length, g, b, m;
|
|
136
136
|
for (b = 0; b < y; b++) {
|
|
137
|
-
for (
|
|
138
|
-
if (!d(p[b][
|
|
139
|
-
|
|
137
|
+
for (g = !0, m = 0; m < h; m++)
|
|
138
|
+
if (!d(p[b][m].arg, u[m].arg)) {
|
|
139
|
+
g = !1;
|
|
140
140
|
break;
|
|
141
141
|
}
|
|
142
|
-
if (
|
|
142
|
+
if (g)
|
|
143
143
|
break;
|
|
144
144
|
}
|
|
145
145
|
p.push(p.splice(b, 1)[0]);
|
|
146
146
|
}
|
|
147
147
|
n(l, "moveToMostRecentLru");
|
|
148
148
|
function c(p) {
|
|
149
|
-
var u = p.length, y = p[u - 1],
|
|
150
|
-
for (y.cacheItem.delete(y.arg),
|
|
149
|
+
var u = p.length, y = p[u - 1], h, g;
|
|
150
|
+
for (y.cacheItem.delete(y.arg), g = u - 2; g >= 0 && (y = p[g], h = y.cacheItem.get(y.arg), !h || !h.size); g--)
|
|
151
151
|
y.cacheItem.delete(y.arg);
|
|
152
152
|
}
|
|
153
153
|
n(c, "removeCachedResult");
|
|
@@ -160,11 +160,11 @@ var Fr = O((_t, Pr) => {
|
|
|
160
160
|
});
|
|
161
161
|
|
|
162
162
|
// ../node_modules/picoquery/lib/string-util.js
|
|
163
|
-
var
|
|
163
|
+
var st = O((nt) => {
|
|
164
164
|
"use strict";
|
|
165
|
-
Object.defineProperty(
|
|
166
|
-
|
|
167
|
-
var
|
|
165
|
+
Object.defineProperty(nt, "__esModule", { value: !0 });
|
|
166
|
+
nt.encodeString = ia;
|
|
167
|
+
var z = Array.from({ length: 256 }, (r, e) => "%" + ((e < 16 ? "0" : "") + e.toString(16)).toUpperCase()), sa = new Int8Array([
|
|
168
168
|
0,
|
|
169
169
|
0,
|
|
170
170
|
0,
|
|
@@ -294,7 +294,7 @@ var Vr = O((Ur) => {
|
|
|
294
294
|
1,
|
|
295
295
|
0
|
|
296
296
|
]);
|
|
297
|
-
function
|
|
297
|
+
function ia(r) {
|
|
298
298
|
let e = r.length;
|
|
299
299
|
if (e === 0)
|
|
300
300
|
return "";
|
|
@@ -302,107 +302,107 @@ var Vr = O((Ur) => {
|
|
|
302
302
|
e: for (; s < e; s++) {
|
|
303
303
|
let i = r.charCodeAt(s);
|
|
304
304
|
for (; i < 128; ) {
|
|
305
|
-
if (
|
|
305
|
+
if (sa[i] !== 1 && (o < s && (t += r.slice(o, s)), o = s + 1, t += z[i]), ++s === e)
|
|
306
306
|
break e;
|
|
307
307
|
i = r.charCodeAt(s);
|
|
308
308
|
}
|
|
309
309
|
if (o < s && (t += r.slice(o, s)), i < 2048) {
|
|
310
|
-
o = s + 1, t +=
|
|
310
|
+
o = s + 1, t += z[192 | i >> 6] + z[128 | i & 63];
|
|
311
311
|
continue;
|
|
312
312
|
}
|
|
313
313
|
if (i < 55296 || i >= 57344) {
|
|
314
|
-
o = s + 1, t +=
|
|
314
|
+
o = s + 1, t += z[224 | i >> 12] + z[128 | i >> 6 & 63] + z[128 | i & 63];
|
|
315
315
|
continue;
|
|
316
316
|
}
|
|
317
317
|
if (++s, s >= e)
|
|
318
318
|
throw new Error("URI malformed");
|
|
319
319
|
let a = r.charCodeAt(s) & 1023;
|
|
320
|
-
o = s + 1, i = 65536 + ((i & 1023) << 10 | a), t +=
|
|
320
|
+
o = s + 1, i = 65536 + ((i & 1023) << 10 | a), t += z[240 | i >> 18] + z[128 | i >> 12 & 63] + z[128 | i >> 6 & 63] + z[128 | i & 63];
|
|
321
321
|
}
|
|
322
322
|
return o === 0 ? r : o < e ? t + r.slice(o) : t;
|
|
323
323
|
}
|
|
324
|
-
n(
|
|
324
|
+
n(ia, "encodeString");
|
|
325
325
|
});
|
|
326
326
|
|
|
327
327
|
// ../node_modules/picoquery/lib/shared.js
|
|
328
|
-
var
|
|
328
|
+
var tr = O((G) => {
|
|
329
329
|
"use strict";
|
|
330
330
|
Object.defineProperty(G, "__esModule", { value: !0 });
|
|
331
331
|
G.defaultOptions = G.defaultShouldSerializeObject = G.defaultValueSerializer = void 0;
|
|
332
|
-
var
|
|
332
|
+
var it = st(), aa = /* @__PURE__ */ n((r) => {
|
|
333
333
|
switch (typeof r) {
|
|
334
334
|
case "string":
|
|
335
|
-
return (0,
|
|
335
|
+
return (0, it.encodeString)(r);
|
|
336
336
|
case "bigint":
|
|
337
337
|
case "boolean":
|
|
338
338
|
return "" + r;
|
|
339
339
|
case "number":
|
|
340
340
|
if (Number.isFinite(r))
|
|
341
|
-
return r < 1e21 ? "" + r : (0,
|
|
341
|
+
return r < 1e21 ? "" + r : (0, it.encodeString)("" + r);
|
|
342
342
|
break;
|
|
343
343
|
}
|
|
344
|
-
return r instanceof Date ? (0,
|
|
344
|
+
return r instanceof Date ? (0, it.encodeString)(r.toISOString()) : "";
|
|
345
345
|
}, "defaultValueSerializer");
|
|
346
|
-
G.defaultValueSerializer =
|
|
347
|
-
var
|
|
348
|
-
G.defaultShouldSerializeObject =
|
|
349
|
-
var
|
|
346
|
+
G.defaultValueSerializer = aa;
|
|
347
|
+
var la = /* @__PURE__ */ n((r) => r instanceof Date, "defaultShouldSerializeObject");
|
|
348
|
+
G.defaultShouldSerializeObject = la;
|
|
349
|
+
var Vo = /* @__PURE__ */ n((r) => r, "identityFunc");
|
|
350
350
|
G.defaultOptions = {
|
|
351
351
|
nesting: !0,
|
|
352
352
|
nestingSyntax: "dot",
|
|
353
353
|
arrayRepeat: !1,
|
|
354
354
|
arrayRepeatSyntax: "repeat",
|
|
355
355
|
delimiter: 38,
|
|
356
|
-
valueDeserializer:
|
|
356
|
+
valueDeserializer: Vo,
|
|
357
357
|
valueSerializer: G.defaultValueSerializer,
|
|
358
|
-
keyDeserializer:
|
|
358
|
+
keyDeserializer: Vo,
|
|
359
359
|
shouldSerializeObject: G.defaultShouldSerializeObject
|
|
360
360
|
};
|
|
361
361
|
});
|
|
362
362
|
|
|
363
363
|
// ../node_modules/picoquery/lib/object-util.js
|
|
364
|
-
var
|
|
364
|
+
var at = O((or) => {
|
|
365
365
|
"use strict";
|
|
366
|
-
Object.defineProperty(
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
var
|
|
370
|
-
function
|
|
366
|
+
Object.defineProperty(or, "__esModule", { value: !0 });
|
|
367
|
+
or.getDeepObject = pa;
|
|
368
|
+
or.stringifyObject = Wo;
|
|
369
|
+
var ie = tr(), ca = st();
|
|
370
|
+
function da(r) {
|
|
371
371
|
return r === "__proto__" || r === "constructor" || r === "prototype";
|
|
372
372
|
}
|
|
373
|
-
n(
|
|
374
|
-
function
|
|
375
|
-
if (
|
|
373
|
+
n(da, "isPrototypeKey");
|
|
374
|
+
function pa(r, e, t, o, s) {
|
|
375
|
+
if (da(e))
|
|
376
376
|
return r;
|
|
377
377
|
let i = r[e];
|
|
378
378
|
return typeof i == "object" && i !== null ? i : !o && (s || typeof t == "number" || typeof t == "string" && t * 0 === 0 && t.indexOf(".") ===
|
|
379
379
|
-1) ? r[e] = [] : r[e] = {};
|
|
380
380
|
}
|
|
381
|
-
n(
|
|
382
|
-
var
|
|
383
|
-
function
|
|
384
|
-
let { nestingSyntax: i =
|
|
385
|
-
arrayRepeatSyntax, nesting: c =
|
|
386
|
-
valueSerializer, shouldSerializeObject: u =
|
|
387
|
-
d) : d,
|
|
388
|
-
if (t >
|
|
381
|
+
n(pa, "getDeepObject");
|
|
382
|
+
var ua = 20, fa = "[]", ya = "[", ma = "]", ha = ".";
|
|
383
|
+
function Wo(r, e, t = 0, o, s) {
|
|
384
|
+
let { nestingSyntax: i = ie.defaultOptions.nestingSyntax, arrayRepeat: a = ie.defaultOptions.arrayRepeat, arrayRepeatSyntax: l = ie.defaultOptions.
|
|
385
|
+
arrayRepeatSyntax, nesting: c = ie.defaultOptions.nesting, delimiter: d = ie.defaultOptions.delimiter, valueSerializer: p = ie.defaultOptions.
|
|
386
|
+
valueSerializer, shouldSerializeObject: u = ie.defaultOptions.shouldSerializeObject } = e, y = typeof d == "number" ? String.fromCharCode(
|
|
387
|
+
d) : d, h = s === !0 && a, g = i === "dot" || i === "js" && !s;
|
|
388
|
+
if (t > ua)
|
|
389
389
|
return "";
|
|
390
|
-
let b = "",
|
|
391
|
-
for (let
|
|
392
|
-
let f = r[
|
|
393
|
-
o ? (
|
|
394
|
-
"object" && f !== null && !u(f) ? (T = f.pop !== void 0, (c || a && T) && (b +=
|
|
395
|
-
b += "=", b += p(f,
|
|
390
|
+
let b = "", m = !0, T = !1;
|
|
391
|
+
for (let x in r) {
|
|
392
|
+
let f = r[x], S;
|
|
393
|
+
o ? (S = o, h ? l === "bracket" && (S += fa) : g ? (S += ha, S += x) : (S += ya, S += x, S += ma)) : S = x, m || (b += y), typeof f ==
|
|
394
|
+
"object" && f !== null && !u(f) ? (T = f.pop !== void 0, (c || a && T) && (b += Wo(f, e, t + 1, S, T))) : (b += (0, ca.encodeString)(S),
|
|
395
|
+
b += "=", b += p(f, x)), m && (m = !1);
|
|
396
396
|
}
|
|
397
397
|
return b;
|
|
398
398
|
}
|
|
399
|
-
n(
|
|
399
|
+
n(Wo, "stringifyObject");
|
|
400
400
|
});
|
|
401
401
|
|
|
402
402
|
// ../node_modules/fast-decode-uri-component/index.js
|
|
403
|
-
var
|
|
403
|
+
var Xo = O((uf, Ko) => {
|
|
404
404
|
"use strict";
|
|
405
|
-
var
|
|
405
|
+
var $o = 12, ga = 0, lt = [
|
|
406
406
|
// The first part of the table maps bytes to character to a transition.
|
|
407
407
|
0,
|
|
408
408
|
0,
|
|
@@ -785,18 +785,18 @@ var Io = O((_u, Fo) => {
|
|
|
785
785
|
7,
|
|
786
786
|
7
|
|
787
787
|
];
|
|
788
|
-
function
|
|
788
|
+
function ba(r) {
|
|
789
789
|
var e = r.indexOf("%");
|
|
790
790
|
if (e === -1) return r;
|
|
791
|
-
for (var t = r.length, o = "", s = 0, i = 0, a = e, l =
|
|
792
|
-
var c =
|
|
793
|
-
if (l =
|
|
791
|
+
for (var t = r.length, o = "", s = 0, i = 0, a = e, l = $o; e > -1 && e < t; ) {
|
|
792
|
+
var c = Yo(r[e + 1], 4), d = Yo(r[e + 2], 0), p = c | d, u = lt[p];
|
|
793
|
+
if (l = lt[256 + l + u], i = i << 6 | p & lt[364 + u], l === $o)
|
|
794
794
|
o += r.slice(s, a), o += i <= 65535 ? String.fromCharCode(i) : String.fromCharCode(
|
|
795
795
|
55232 + (i >> 10),
|
|
796
796
|
56320 + (i & 1023)
|
|
797
797
|
), i = 0, s = e + 3, e = a = r.indexOf("%", s);
|
|
798
798
|
else {
|
|
799
|
-
if (l ===
|
|
799
|
+
if (l === ga)
|
|
800
800
|
return null;
|
|
801
801
|
if (e += 3, e < t && r.charCodeAt(e) === 37) continue;
|
|
802
802
|
return null;
|
|
@@ -804,8 +804,8 @@ var Io = O((_u, Fo) => {
|
|
|
804
804
|
}
|
|
805
805
|
return o + r.slice(s);
|
|
806
806
|
}
|
|
807
|
-
n(
|
|
808
|
-
var
|
|
807
|
+
n(ba, "decodeURIComponent");
|
|
808
|
+
var Sa = {
|
|
809
809
|
0: 0,
|
|
810
810
|
1: 1,
|
|
811
811
|
2: 2,
|
|
@@ -829,95 +829,95 @@ var Io = O((_u, Fo) => {
|
|
|
829
829
|
f: 15,
|
|
830
830
|
F: 15
|
|
831
831
|
};
|
|
832
|
-
function
|
|
833
|
-
var t =
|
|
832
|
+
function Yo(r, e) {
|
|
833
|
+
var t = Sa[r];
|
|
834
834
|
return t === void 0 ? 255 : t << e;
|
|
835
835
|
}
|
|
836
|
-
n(
|
|
837
|
-
|
|
836
|
+
n(Yo, "hexCodeToInt");
|
|
837
|
+
Ko.exports = ba;
|
|
838
838
|
});
|
|
839
839
|
|
|
840
840
|
// ../node_modules/picoquery/lib/parse.js
|
|
841
|
-
var
|
|
841
|
+
var en = O((W) => {
|
|
842
842
|
"use strict";
|
|
843
|
-
var
|
|
843
|
+
var Ta = W && W.__importDefault || function(r) {
|
|
844
844
|
return r && r.__esModule ? r : { default: r };
|
|
845
845
|
};
|
|
846
|
-
Object.defineProperty(
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
var
|
|
846
|
+
Object.defineProperty(W, "__esModule", { value: !0 });
|
|
847
|
+
W.numberValueDeserializer = W.numberKeyDeserializer = void 0;
|
|
848
|
+
W.parse = wa;
|
|
849
|
+
var nr = at(), ae = tr(), Jo = Ta(Xo()), xa = /* @__PURE__ */ n((r) => {
|
|
850
850
|
let e = Number(r);
|
|
851
851
|
return Number.isNaN(e) ? r : e;
|
|
852
852
|
}, "numberKeyDeserializer");
|
|
853
|
-
|
|
854
|
-
var
|
|
853
|
+
W.numberKeyDeserializer = xa;
|
|
854
|
+
var Ra = /* @__PURE__ */ n((r) => {
|
|
855
855
|
let e = Number(r);
|
|
856
856
|
return Number.isNaN(e) ? r : e;
|
|
857
857
|
}, "numberValueDeserializer");
|
|
858
|
-
|
|
859
|
-
var
|
|
858
|
+
W.numberValueDeserializer = Ra;
|
|
859
|
+
var Qo = /\+/g, Zo = /* @__PURE__ */ n(function() {
|
|
860
860
|
}, "Empty");
|
|
861
|
-
|
|
862
|
-
function
|
|
861
|
+
Zo.prototype = /* @__PURE__ */ Object.create(null);
|
|
862
|
+
function sr(r, e, t, o, s) {
|
|
863
863
|
let i = r.substring(e, t);
|
|
864
|
-
return o && (i = i.replace(
|
|
865
|
-
}
|
|
866
|
-
n(
|
|
867
|
-
function
|
|
868
|
-
let { valueDeserializer: t =
|
|
869
|
-
defaultOptions.arrayRepeatSyntax, nesting: i =
|
|
870
|
-
defaultOptions.nestingSyntax, delimiter: c =
|
|
871
|
-
"js", u = new
|
|
864
|
+
return o && (i = i.replace(Qo, " ")), s && (i = (0, Jo.default)(i) || i), i;
|
|
865
|
+
}
|
|
866
|
+
n(sr, "computeKeySlice");
|
|
867
|
+
function wa(r, e) {
|
|
868
|
+
let { valueDeserializer: t = ae.defaultOptions.valueDeserializer, keyDeserializer: o = ae.defaultOptions.keyDeserializer, arrayRepeatSyntax: s = ae.
|
|
869
|
+
defaultOptions.arrayRepeatSyntax, nesting: i = ae.defaultOptions.nesting, arrayRepeat: a = ae.defaultOptions.arrayRepeat, nestingSyntax: l = ae.
|
|
870
|
+
defaultOptions.nestingSyntax, delimiter: c = ae.defaultOptions.delimiter } = e ?? {}, d = typeof c == "string" ? c.charCodeAt(0) : c, p = l ===
|
|
871
|
+
"js", u = new Zo();
|
|
872
872
|
if (typeof r != "string")
|
|
873
873
|
return u;
|
|
874
|
-
let y = r.length,
|
|
875
|
-
|
|
874
|
+
let y = r.length, h = "", g = -1, b = -1, m = -1, T = u, x, f = "", S = "", R = !1, w = !1, E = !1, F = !1, j = !1, N = !1, de = !1, C = 0,
|
|
875
|
+
B = -1, xe = -1, wt = -1;
|
|
876
876
|
for (let I = 0; I < y + 1; I++) {
|
|
877
877
|
if (C = I !== y ? r.charCodeAt(I) : d, C === d) {
|
|
878
|
-
if (
|
|
879
|
-
T,
|
|
880
|
-
|
|
881
|
-
let
|
|
878
|
+
if (de = b > g, de || (b = I), m !== b - 1 && (S = sr(r, m + 1, B > -1 ? B : b, E, R), f = o(S), x !== void 0 && (T = (0, nr.getDeepObject)(
|
|
879
|
+
T, x, f, p && j, p && N))), de || f !== "") {
|
|
880
|
+
de && (h = r.slice(b + 1, I), F && (h = h.replace(Qo, " ")), w && (h = (0, Jo.default)(h) || h));
|
|
881
|
+
let Re = t(h, f);
|
|
882
882
|
if (a) {
|
|
883
|
-
let
|
|
884
|
-
|
|
883
|
+
let Be = T[f];
|
|
884
|
+
Be === void 0 ? B > -1 ? T[f] = [Re] : T[f] = Re : Be.pop ? Be.push(Re) : T[f] = [Be, Re];
|
|
885
885
|
} else
|
|
886
|
-
T[f] =
|
|
886
|
+
T[f] = Re;
|
|
887
887
|
}
|
|
888
|
-
|
|
889
|
-
} else C === 93 ? (a && s === "bracket" &&
|
|
890
|
-
I,
|
|
891
|
-
C === 46 ? i && (l === "dot" || p) && b <=
|
|
892
|
-
T,
|
|
893
|
-
r,
|
|
894
|
-
I) : C === 61 ? b <=
|
|
895
|
-
|
|
888
|
+
h = "", g = I, b = I, R = !1, w = !1, E = !1, F = !1, j = !1, N = !1, B = -1, m = I, T = u, x = void 0, f = "";
|
|
889
|
+
} else C === 93 ? (a && s === "bracket" && wt === 91 && (B = xe), i && (l === "index" || p) && b <= g && (m !== xe && (S = sr(r, m + 1,
|
|
890
|
+
I, E, R), f = o(S), x !== void 0 && (T = (0, nr.getDeepObject)(T, x, f, void 0, p)), x = f, E = !1, R = !1), m = I, N = !0, j = !1)) :
|
|
891
|
+
C === 46 ? i && (l === "dot" || p) && b <= g && (m !== xe && (S = sr(r, m + 1, I, E, R), f = o(S), x !== void 0 && (T = (0, nr.getDeepObject)(
|
|
892
|
+
T, x, f, p)), x = f, E = !1, R = !1), j = !0, N = !1, m = I) : C === 91 ? i && (l === "index" || p) && b <= g && (m !== xe && (S = sr(
|
|
893
|
+
r, m + 1, I, E, R), f = o(S), p && x !== void 0 && (T = (0, nr.getDeepObject)(T, x, f, p)), x = f, E = !1, R = !1, j = !1, N = !0), m =
|
|
894
|
+
I) : C === 61 ? b <= g ? b = I : w = !0 : C === 43 ? b > g ? F = !0 : E = !0 : C === 37 && (b > g ? w = !0 : R = !0);
|
|
895
|
+
xe = I, wt = C;
|
|
896
896
|
}
|
|
897
897
|
return u;
|
|
898
898
|
}
|
|
899
|
-
n(
|
|
899
|
+
n(wa, "parse");
|
|
900
900
|
});
|
|
901
901
|
|
|
902
902
|
// ../node_modules/picoquery/lib/stringify.js
|
|
903
|
-
var
|
|
903
|
+
var rn = O((ct) => {
|
|
904
904
|
"use strict";
|
|
905
|
-
Object.defineProperty(
|
|
906
|
-
|
|
907
|
-
var
|
|
908
|
-
function
|
|
905
|
+
Object.defineProperty(ct, "__esModule", { value: !0 });
|
|
906
|
+
ct.stringify = Ea;
|
|
907
|
+
var Aa = at();
|
|
908
|
+
function Ea(r, e) {
|
|
909
909
|
if (r === null || typeof r != "object")
|
|
910
910
|
return "";
|
|
911
911
|
let t = e ?? {};
|
|
912
|
-
return (0,
|
|
912
|
+
return (0, Aa.stringifyObject)(r, t);
|
|
913
913
|
}
|
|
914
|
-
n(
|
|
914
|
+
n(Ea, "stringify");
|
|
915
915
|
});
|
|
916
916
|
|
|
917
917
|
// ../node_modules/picoquery/lib/main.js
|
|
918
|
-
var
|
|
918
|
+
var ir = O((q) => {
|
|
919
919
|
"use strict";
|
|
920
|
-
var
|
|
920
|
+
var Ca = q && q.__createBinding || (Object.create ? function(r, e, t, o) {
|
|
921
921
|
o === void 0 && (o = t);
|
|
922
922
|
var s = Object.getOwnPropertyDescriptor(e, t);
|
|
923
923
|
(!s || ("get" in s ? !e.__esModule : s.writable || s.configurable)) && (s = { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
@@ -925,25 +925,25 @@ var nr = O((q) => {
|
|
|
925
925
|
}, "get") }), Object.defineProperty(r, o, s);
|
|
926
926
|
} : function(r, e, t, o) {
|
|
927
927
|
o === void 0 && (o = t), r[o] = e[t];
|
|
928
|
-
}),
|
|
929
|
-
for (var t in r) t !== "default" && !Object.prototype.hasOwnProperty.call(e, t) &&
|
|
928
|
+
}), va = q && q.__exportStar || function(r, e) {
|
|
929
|
+
for (var t in r) t !== "default" && !Object.prototype.hasOwnProperty.call(e, t) && Ca(e, r, t);
|
|
930
930
|
};
|
|
931
931
|
Object.defineProperty(q, "__esModule", { value: !0 });
|
|
932
932
|
q.stringify = q.parse = void 0;
|
|
933
|
-
var
|
|
933
|
+
var Pa = en();
|
|
934
934
|
Object.defineProperty(q, "parse", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
935
|
-
return
|
|
935
|
+
return Pa.parse;
|
|
936
936
|
}, "get") });
|
|
937
|
-
var
|
|
937
|
+
var Fa = rn();
|
|
938
938
|
Object.defineProperty(q, "stringify", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
939
|
-
return
|
|
939
|
+
return Fa.stringify;
|
|
940
940
|
}, "get") });
|
|
941
|
-
|
|
941
|
+
va(tr(), q);
|
|
942
942
|
});
|
|
943
943
|
|
|
944
|
-
// ../node_modules/
|
|
945
|
-
var
|
|
946
|
-
|
|
944
|
+
// ../node_modules/entities/lib/maps/entities.json
|
|
945
|
+
var ft = O((Ff, Na) => {
|
|
946
|
+
Na.exports = { Aacute: "\xC1", aacute: "\xE1", Abreve: "\u0102", abreve: "\u0103", ac: "\u223E", acd: "\u223F", acE: "\u223E\u0333", Acirc: "\
|
|
947
947
|
\xC2", acirc: "\xE2", acute: "\xB4", Acy: "\u0410", acy: "\u0430", AElig: "\xC6", aelig: "\xE6", af: "\u2061", Afr: "\u{1D504}", afr: "\u{1D51E}",
|
|
948
948
|
Agrave: "\xC0", agrave: "\xE0", alefsym: "\u2135", aleph: "\u2135", Alpha: "\u0391", alpha: "\u03B1", Amacr: "\u0100", amacr: "\u0101", amalg: "\
|
|
949
949
|
\u2A3F", amp: "&", AMP: "&", andand: "\u2A55", And: "\u2A53", and: "\u2227", andd: "\u2A5C", andslope: "\u2A58", andv: "\u2A5A", ang: "\u2220",
|
|
@@ -1223,9 +1223,9 @@ var Jr = O((Zu, ba) => {
|
|
|
1223
1223
|
zwnj: "\u200C" };
|
|
1224
1224
|
});
|
|
1225
1225
|
|
|
1226
|
-
// ../node_modules/
|
|
1227
|
-
var
|
|
1228
|
-
|
|
1226
|
+
// ../node_modules/entities/lib/maps/legacy.json
|
|
1227
|
+
var cn = O((If, qa) => {
|
|
1228
|
+
qa.exports = { Aacute: "\xC1", aacute: "\xE1", Acirc: "\xC2", acirc: "\xE2", acute: "\xB4", AElig: "\xC6", aelig: "\xE6", Agrave: "\xC0", agrave: "\
|
|
1229
1229
|
\xE0", amp: "&", AMP: "&", Aring: "\xC5", aring: "\xE5", Atilde: "\xC3", atilde: "\xE3", Auml: "\xC4", auml: "\xE4", brvbar: "\xA6", Ccedil: "\
|
|
1230
1230
|
\xC7", ccedil: "\xE7", cedil: "\xB8", cent: "\xA2", copy: "\xA9", COPY: "\xA9", curren: "\xA4", deg: "\xB0", divide: "\xF7", Eacute: "\xC9",
|
|
1231
1231
|
eacute: "\xE9", Ecirc: "\xCA", ecirc: "\xEA", Egrave: "\xC8", egrave: "\xE8", ETH: "\xD0", eth: "\xF0", Euml: "\xCB", euml: "\xEB", frac12: "\
|
|
@@ -1238,26 +1238,26 @@ var Go = O((ef, Sa) => {
|
|
|
1238
1238
|
Ugrave: "\xD9", ugrave: "\xF9", uml: "\xA8", Uuml: "\xDC", uuml: "\xFC", Yacute: "\xDD", yacute: "\xFD", yen: "\xA5", yuml: "\xFF" };
|
|
1239
1239
|
});
|
|
1240
1240
|
|
|
1241
|
-
// ../node_modules/
|
|
1242
|
-
var
|
|
1243
|
-
|
|
1241
|
+
// ../node_modules/entities/lib/maps/xml.json
|
|
1242
|
+
var yt = O((Of, Ba) => {
|
|
1243
|
+
Ba.exports = { amp: "&", apos: "'", gt: ">", lt: "<", quot: '"' };
|
|
1244
1244
|
});
|
|
1245
1245
|
|
|
1246
|
-
// ../node_modules/
|
|
1247
|
-
var
|
|
1248
|
-
|
|
1246
|
+
// ../node_modules/entities/lib/maps/decode.json
|
|
1247
|
+
var dn = O((Df, za) => {
|
|
1248
|
+
za.exports = { "0": 65533, "128": 8364, "130": 8218, "131": 402, "132": 8222, "133": 8230, "134": 8224, "135": 8225, "136": 710, "137": 8240,
|
|
1249
1249
|
"138": 352, "139": 8249, "140": 338, "142": 381, "145": 8216, "146": 8217, "147": 8220, "148": 8221, "149": 8226, "150": 8211, "151": 8212,
|
|
1250
1250
|
"152": 732, "153": 8482, "154": 353, "155": 8250, "156": 339, "158": 382, "159": 376 };
|
|
1251
1251
|
});
|
|
1252
1252
|
|
|
1253
|
-
// ../node_modules/
|
|
1254
|
-
var
|
|
1253
|
+
// ../node_modules/entities/lib/decode_codepoint.js
|
|
1254
|
+
var un = O((qe) => {
|
|
1255
1255
|
"use strict";
|
|
1256
|
-
var
|
|
1256
|
+
var Ga = qe && qe.__importDefault || function(r) {
|
|
1257
1257
|
return r && r.__esModule ? r : { default: r };
|
|
1258
1258
|
};
|
|
1259
|
-
Object.defineProperty(
|
|
1260
|
-
var
|
|
1259
|
+
Object.defineProperty(qe, "__esModule", { value: !0 });
|
|
1260
|
+
var pn = Ga(dn()), Ua = (
|
|
1261
1261
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1262
1262
|
String.fromCodePoint || function(r) {
|
|
1263
1263
|
var e = "";
|
|
@@ -1265,38 +1265,38 @@ var Ho = O((Ne) => {
|
|
|
1265
1265
|
e;
|
|
1266
1266
|
}
|
|
1267
1267
|
);
|
|
1268
|
-
function
|
|
1269
|
-
return r >= 55296 && r <= 57343 || r > 1114111 ? "\uFFFD" : (r in
|
|
1268
|
+
function Ha(r) {
|
|
1269
|
+
return r >= 55296 && r <= 57343 || r > 1114111 ? "\uFFFD" : (r in pn.default && (r = pn.default[r]), Ua(r));
|
|
1270
1270
|
}
|
|
1271
|
-
n(
|
|
1272
|
-
|
|
1271
|
+
n(Ha, "decodeCodePoint");
|
|
1272
|
+
qe.default = Ha;
|
|
1273
1273
|
});
|
|
1274
1274
|
|
|
1275
|
-
// ../node_modules/
|
|
1276
|
-
var
|
|
1275
|
+
// ../node_modules/entities/lib/decode.js
|
|
1276
|
+
var ht = O((U) => {
|
|
1277
1277
|
"use strict";
|
|
1278
|
-
var
|
|
1278
|
+
var ar = U && U.__importDefault || function(r) {
|
|
1279
1279
|
return r && r.__esModule ? r : { default: r };
|
|
1280
1280
|
};
|
|
1281
1281
|
Object.defineProperty(U, "__esModule", { value: !0 });
|
|
1282
1282
|
U.decodeHTML = U.decodeHTMLStrict = U.decodeXML = void 0;
|
|
1283
|
-
var
|
|
1284
|
-
U.decodeXML =
|
|
1285
|
-
U.decodeHTMLStrict =
|
|
1286
|
-
function
|
|
1287
|
-
var e =
|
|
1283
|
+
var mt = ar(ft()), Va = ar(cn()), Wa = ar(yt()), fn = ar(un()), $a = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;
|
|
1284
|
+
U.decodeXML = mn(Wa.default);
|
|
1285
|
+
U.decodeHTMLStrict = mn(mt.default);
|
|
1286
|
+
function mn(r) {
|
|
1287
|
+
var e = hn(r);
|
|
1288
1288
|
return function(t) {
|
|
1289
|
-
return String(t).replace(
|
|
1289
|
+
return String(t).replace($a, e);
|
|
1290
1290
|
};
|
|
1291
1291
|
}
|
|
1292
|
-
n(
|
|
1293
|
-
var
|
|
1292
|
+
n(mn, "getStrictDecoder");
|
|
1293
|
+
var yn = /* @__PURE__ */ n(function(r, e) {
|
|
1294
1294
|
return r < e ? 1 : -1;
|
|
1295
1295
|
}, "sorter");
|
|
1296
1296
|
U.decodeHTML = function() {
|
|
1297
|
-
for (var r = Object.keys(
|
|
1297
|
+
for (var r = Object.keys(Va.default).sort(yn), e = Object.keys(mt.default).sort(yn), t = 0, o = 0; t < e.length; t++)
|
|
1298
1298
|
r[o] === e[t] ? (e[t] += ";?", o++) : e[t] += ";";
|
|
1299
|
-
var s = new RegExp("&(?:" + e.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"), i =
|
|
1299
|
+
var s = new RegExp("&(?:" + e.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"), i = hn(mt.default);
|
|
1300
1300
|
function a(l) {
|
|
1301
1301
|
return l.substr(-1) !== ";" && (l += ";"), i(l);
|
|
1302
1302
|
}
|
|
@@ -1304,38 +1304,38 @@ var et = O((U) => {
|
|
|
1304
1304
|
return String(l).replace(s, a);
|
|
1305
1305
|
};
|
|
1306
1306
|
}();
|
|
1307
|
-
function
|
|
1307
|
+
function hn(r) {
|
|
1308
1308
|
return /* @__PURE__ */ n(function(t) {
|
|
1309
1309
|
if (t.charAt(1) === "#") {
|
|
1310
1310
|
var o = t.charAt(2);
|
|
1311
|
-
return o === "X" || o === "x" ?
|
|
1311
|
+
return o === "X" || o === "x" ? fn.default(parseInt(t.substr(3), 16)) : fn.default(parseInt(t.substr(2), 10));
|
|
1312
1312
|
}
|
|
1313
1313
|
return r[t.slice(1, -1)] || t;
|
|
1314
1314
|
}, "replace");
|
|
1315
1315
|
}
|
|
1316
|
-
n(
|
|
1316
|
+
n(hn, "getReplacer");
|
|
1317
1317
|
});
|
|
1318
1318
|
|
|
1319
|
-
// ../node_modules/
|
|
1320
|
-
var
|
|
1319
|
+
// ../node_modules/entities/lib/encode.js
|
|
1320
|
+
var bt = O((M) => {
|
|
1321
1321
|
"use strict";
|
|
1322
|
-
var
|
|
1322
|
+
var gn = M && M.__importDefault || function(r) {
|
|
1323
1323
|
return r && r.__esModule ? r : { default: r };
|
|
1324
1324
|
};
|
|
1325
1325
|
Object.defineProperty(M, "__esModule", { value: !0 });
|
|
1326
1326
|
M.escapeUTF8 = M.escape = M.encodeNonAsciiHTML = M.encodeHTML = M.encodeXML = void 0;
|
|
1327
|
-
var
|
|
1328
|
-
M.encodeXML =
|
|
1329
|
-
var
|
|
1330
|
-
M.encodeHTML =
|
|
1331
|
-
M.encodeNonAsciiHTML =
|
|
1332
|
-
function
|
|
1327
|
+
var Ya = gn(yt()), bn = Tn(Ya.default), Sn = xn(bn);
|
|
1328
|
+
M.encodeXML = An(bn);
|
|
1329
|
+
var Ka = gn(ft()), gt = Tn(Ka.default), Xa = xn(gt);
|
|
1330
|
+
M.encodeHTML = Qa(gt, Xa);
|
|
1331
|
+
M.encodeNonAsciiHTML = An(gt);
|
|
1332
|
+
function Tn(r) {
|
|
1333
1333
|
return Object.keys(r).sort().reduce(function(e, t) {
|
|
1334
1334
|
return e[r[t]] = "&" + t + ";", e;
|
|
1335
1335
|
}, {});
|
|
1336
1336
|
}
|
|
1337
|
-
n(
|
|
1338
|
-
function
|
|
1337
|
+
n(Tn, "getInverseObj");
|
|
1338
|
+
function xn(r) {
|
|
1339
1339
|
for (var e = [], t = [], o = 0, s = Object.keys(r); o < s.length; o++) {
|
|
1340
1340
|
var i = s[o];
|
|
1341
1341
|
i.length === 1 ? e.push("\\" + i) : t.push(i);
|
|
@@ -1349,9 +1349,9 @@ var tt = O((M) => {
|
|
|
1349
1349
|
}
|
|
1350
1350
|
return t.unshift("[" + e.join("") + "]"), new RegExp(t.join("|"), "g");
|
|
1351
1351
|
}
|
|
1352
|
-
n(
|
|
1353
|
-
var
|
|
1354
|
-
|
|
1352
|
+
n(xn, "getInverseReplacer");
|
|
1353
|
+
var Rn = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,
|
|
1354
|
+
Ja = (
|
|
1355
1355
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1356
1356
|
String.prototype.codePointAt != null ? (
|
|
1357
1357
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -1365,134 +1365,134 @@ var tt = O((M) => {
|
|
|
1365
1365
|
}
|
|
1366
1366
|
)
|
|
1367
1367
|
);
|
|
1368
|
-
function
|
|
1369
|
-
return "&#x" + (r.length > 1 ?
|
|
1368
|
+
function lr(r) {
|
|
1369
|
+
return "&#x" + (r.length > 1 ? Ja(r) : r.charCodeAt(0)).toString(16).toUpperCase() + ";";
|
|
1370
1370
|
}
|
|
1371
|
-
n(
|
|
1372
|
-
function
|
|
1371
|
+
n(lr, "singleCharReplacer");
|
|
1372
|
+
function Qa(r, e) {
|
|
1373
1373
|
return function(t) {
|
|
1374
1374
|
return t.replace(e, function(o) {
|
|
1375
1375
|
return r[o];
|
|
1376
|
-
}).replace(
|
|
1376
|
+
}).replace(Rn, lr);
|
|
1377
1377
|
};
|
|
1378
1378
|
}
|
|
1379
|
-
n(
|
|
1380
|
-
var
|
|
1381
|
-
function
|
|
1382
|
-
return r.replace(
|
|
1379
|
+
n(Qa, "getInverse");
|
|
1380
|
+
var wn = new RegExp(Sn.source + "|" + Rn.source, "g");
|
|
1381
|
+
function Za(r) {
|
|
1382
|
+
return r.replace(wn, lr);
|
|
1383
1383
|
}
|
|
1384
|
-
n(
|
|
1385
|
-
M.escape =
|
|
1386
|
-
function
|
|
1387
|
-
return r.replace(
|
|
1384
|
+
n(Za, "escape");
|
|
1385
|
+
M.escape = Za;
|
|
1386
|
+
function el(r) {
|
|
1387
|
+
return r.replace(Sn, lr);
|
|
1388
1388
|
}
|
|
1389
|
-
n(
|
|
1390
|
-
M.escapeUTF8 =
|
|
1391
|
-
function
|
|
1389
|
+
n(el, "escapeUTF8");
|
|
1390
|
+
M.escapeUTF8 = el;
|
|
1391
|
+
function An(r) {
|
|
1392
1392
|
return function(e) {
|
|
1393
|
-
return e.replace(
|
|
1394
|
-
return r[t] ||
|
|
1393
|
+
return e.replace(wn, function(t) {
|
|
1394
|
+
return r[t] || lr(t);
|
|
1395
1395
|
});
|
|
1396
1396
|
};
|
|
1397
1397
|
}
|
|
1398
|
-
n(
|
|
1398
|
+
n(An, "getASCIIEncoder");
|
|
1399
1399
|
});
|
|
1400
1400
|
|
|
1401
|
-
// ../node_modules/
|
|
1402
|
-
var
|
|
1401
|
+
// ../node_modules/entities/lib/index.js
|
|
1402
|
+
var Cn = O((A) => {
|
|
1403
1403
|
"use strict";
|
|
1404
|
-
Object.defineProperty(
|
|
1405
|
-
|
|
1406
|
-
|
|
1404
|
+
Object.defineProperty(A, "__esModule", { value: !0 });
|
|
1405
|
+
A.decodeXMLStrict = A.decodeHTML5Strict = A.decodeHTML4Strict = A.decodeHTML5 = A.decodeHTML4 = A.decodeHTMLStrict = A.decodeHTML = A.decodeXML =
|
|
1406
|
+
A.encodeHTML5 = A.encodeHTML4 = A.escapeUTF8 = A.escape = A.encodeNonAsciiHTML = A.encodeHTML = A.encodeXML = A.encode = A.decodeStrict = A.
|
|
1407
1407
|
decode = void 0;
|
|
1408
|
-
var
|
|
1409
|
-
function
|
|
1410
|
-
return (!e || e <= 0 ?
|
|
1411
|
-
}
|
|
1412
|
-
n(
|
|
1413
|
-
|
|
1414
|
-
function
|
|
1415
|
-
return (!e || e <= 0 ?
|
|
1416
|
-
}
|
|
1417
|
-
n(
|
|
1418
|
-
|
|
1419
|
-
function
|
|
1420
|
-
return (!e || e <= 0 ?
|
|
1421
|
-
}
|
|
1422
|
-
n(
|
|
1423
|
-
|
|
1424
|
-
var
|
|
1425
|
-
Object.defineProperty(
|
|
1426
|
-
return
|
|
1408
|
+
var cr = ht(), En = bt();
|
|
1409
|
+
function rl(r, e) {
|
|
1410
|
+
return (!e || e <= 0 ? cr.decodeXML : cr.decodeHTML)(r);
|
|
1411
|
+
}
|
|
1412
|
+
n(rl, "decode");
|
|
1413
|
+
A.decode = rl;
|
|
1414
|
+
function tl(r, e) {
|
|
1415
|
+
return (!e || e <= 0 ? cr.decodeXML : cr.decodeHTMLStrict)(r);
|
|
1416
|
+
}
|
|
1417
|
+
n(tl, "decodeStrict");
|
|
1418
|
+
A.decodeStrict = tl;
|
|
1419
|
+
function ol(r, e) {
|
|
1420
|
+
return (!e || e <= 0 ? En.encodeXML : En.encodeHTML)(r);
|
|
1421
|
+
}
|
|
1422
|
+
n(ol, "encode");
|
|
1423
|
+
A.encode = ol;
|
|
1424
|
+
var le = bt();
|
|
1425
|
+
Object.defineProperty(A, "encodeXML", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1426
|
+
return le.encodeXML;
|
|
1427
1427
|
}, "get") });
|
|
1428
|
-
Object.defineProperty(
|
|
1429
|
-
return
|
|
1428
|
+
Object.defineProperty(A, "encodeHTML", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1429
|
+
return le.encodeHTML;
|
|
1430
1430
|
}, "get") });
|
|
1431
|
-
Object.defineProperty(
|
|
1432
|
-
return
|
|
1431
|
+
Object.defineProperty(A, "encodeNonAsciiHTML", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1432
|
+
return le.encodeNonAsciiHTML;
|
|
1433
1433
|
}, "get") });
|
|
1434
|
-
Object.defineProperty(
|
|
1435
|
-
return
|
|
1434
|
+
Object.defineProperty(A, "escape", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1435
|
+
return le.escape;
|
|
1436
1436
|
}, "get") });
|
|
1437
|
-
Object.defineProperty(
|
|
1438
|
-
return
|
|
1437
|
+
Object.defineProperty(A, "escapeUTF8", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1438
|
+
return le.escapeUTF8;
|
|
1439
1439
|
}, "get") });
|
|
1440
|
-
Object.defineProperty(
|
|
1441
|
-
return
|
|
1440
|
+
Object.defineProperty(A, "encodeHTML4", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1441
|
+
return le.encodeHTML;
|
|
1442
1442
|
}, "get") });
|
|
1443
|
-
Object.defineProperty(
|
|
1444
|
-
return
|
|
1443
|
+
Object.defineProperty(A, "encodeHTML5", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1444
|
+
return le.encodeHTML;
|
|
1445
1445
|
}, "get") });
|
|
1446
|
-
var
|
|
1447
|
-
Object.defineProperty(
|
|
1448
|
-
return
|
|
1446
|
+
var Z = ht();
|
|
1447
|
+
Object.defineProperty(A, "decodeXML", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1448
|
+
return Z.decodeXML;
|
|
1449
1449
|
}, "get") });
|
|
1450
|
-
Object.defineProperty(
|
|
1451
|
-
return
|
|
1450
|
+
Object.defineProperty(A, "decodeHTML", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1451
|
+
return Z.decodeHTML;
|
|
1452
1452
|
}, "get") });
|
|
1453
|
-
Object.defineProperty(
|
|
1454
|
-
return
|
|
1453
|
+
Object.defineProperty(A, "decodeHTMLStrict", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1454
|
+
return Z.decodeHTMLStrict;
|
|
1455
1455
|
}, "get") });
|
|
1456
|
-
Object.defineProperty(
|
|
1457
|
-
return
|
|
1456
|
+
Object.defineProperty(A, "decodeHTML4", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1457
|
+
return Z.decodeHTML;
|
|
1458
1458
|
}, "get") });
|
|
1459
|
-
Object.defineProperty(
|
|
1460
|
-
return
|
|
1459
|
+
Object.defineProperty(A, "decodeHTML5", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1460
|
+
return Z.decodeHTML;
|
|
1461
1461
|
}, "get") });
|
|
1462
|
-
Object.defineProperty(
|
|
1463
|
-
return
|
|
1462
|
+
Object.defineProperty(A, "decodeHTML4Strict", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1463
|
+
return Z.decodeHTMLStrict;
|
|
1464
1464
|
}, "get") });
|
|
1465
|
-
Object.defineProperty(
|
|
1466
|
-
return
|
|
1465
|
+
Object.defineProperty(A, "decodeHTML5Strict", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1466
|
+
return Z.decodeHTMLStrict;
|
|
1467
1467
|
}, "get") });
|
|
1468
|
-
Object.defineProperty(
|
|
1469
|
-
return
|
|
1468
|
+
Object.defineProperty(A, "decodeXMLStrict", { enumerable: !0, get: /* @__PURE__ */ n(function() {
|
|
1469
|
+
return Z.decodeXML;
|
|
1470
1470
|
}, "get") });
|
|
1471
1471
|
});
|
|
1472
1472
|
|
|
1473
1473
|
// ../node_modules/ansi-to-html/lib/ansi_to_html.js
|
|
1474
|
-
var
|
|
1474
|
+
var Ln = O((zf, _n) => {
|
|
1475
1475
|
"use strict";
|
|
1476
|
-
function
|
|
1476
|
+
function nl(r, e) {
|
|
1477
1477
|
if (!(r instanceof e))
|
|
1478
1478
|
throw new TypeError("Cannot call a class as a function");
|
|
1479
1479
|
}
|
|
1480
|
-
n(
|
|
1481
|
-
function
|
|
1480
|
+
n(nl, "_classCallCheck");
|
|
1481
|
+
function vn(r, e) {
|
|
1482
1482
|
for (var t = 0; t < e.length; t++) {
|
|
1483
1483
|
var o = e[t];
|
|
1484
1484
|
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(r, o.key, o);
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
|
-
n(
|
|
1488
|
-
function
|
|
1489
|
-
return e &&
|
|
1487
|
+
n(vn, "_defineProperties");
|
|
1488
|
+
function sl(r, e, t) {
|
|
1489
|
+
return e && vn(r.prototype, e), t && vn(r, t), r;
|
|
1490
1490
|
}
|
|
1491
|
-
n(
|
|
1492
|
-
function
|
|
1491
|
+
n(sl, "_createClass");
|
|
1492
|
+
function kn(r, e) {
|
|
1493
1493
|
var t = typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
|
|
1494
1494
|
if (!t) {
|
|
1495
|
-
if (Array.isArray(r) || (t =
|
|
1495
|
+
if (Array.isArray(r) || (t = il(r)) || e && r && typeof r.length == "number") {
|
|
1496
1496
|
t && (r = t);
|
|
1497
1497
|
var o = 0, s = /* @__PURE__ */ n(function() {
|
|
1498
1498
|
}, "F");
|
|
@@ -1521,32 +1521,32 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1521
1521
|
}
|
|
1522
1522
|
}, "f") };
|
|
1523
1523
|
}
|
|
1524
|
-
n(
|
|
1525
|
-
function
|
|
1524
|
+
n(kn, "_createForOfIteratorHelper");
|
|
1525
|
+
function il(r, e) {
|
|
1526
1526
|
if (r) {
|
|
1527
|
-
if (typeof r == "string") return
|
|
1527
|
+
if (typeof r == "string") return Pn(r, e);
|
|
1528
1528
|
var t = Object.prototype.toString.call(r).slice(8, -1);
|
|
1529
1529
|
if (t === "Object" && r.constructor && (t = r.constructor.name), t === "Map" || t === "Set") return Array.from(r);
|
|
1530
|
-
if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return
|
|
1530
|
+
if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return Pn(r, e);
|
|
1531
1531
|
}
|
|
1532
1532
|
}
|
|
1533
|
-
n(
|
|
1534
|
-
function
|
|
1533
|
+
n(il, "_unsupportedIterableToArray");
|
|
1534
|
+
function Pn(r, e) {
|
|
1535
1535
|
(e == null || e > r.length) && (e = r.length);
|
|
1536
1536
|
for (var t = 0, o = new Array(e); t < e; t++)
|
|
1537
1537
|
o[t] = r[t];
|
|
1538
1538
|
return o;
|
|
1539
1539
|
}
|
|
1540
|
-
n(
|
|
1541
|
-
var
|
|
1540
|
+
n(Pn, "_arrayLikeToArray");
|
|
1541
|
+
var al = Cn(), Fn = {
|
|
1542
1542
|
fg: "#FFF",
|
|
1543
1543
|
bg: "#000",
|
|
1544
1544
|
newline: !1,
|
|
1545
1545
|
escapeXML: !1,
|
|
1546
1546
|
stream: !1,
|
|
1547
|
-
colors:
|
|
1547
|
+
colors: ll()
|
|
1548
1548
|
};
|
|
1549
|
-
function
|
|
1549
|
+
function ll() {
|
|
1550
1550
|
var r = {
|
|
1551
1551
|
0: "#000",
|
|
1552
1552
|
1: "#A00",
|
|
@@ -1565,35 +1565,35 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1565
1565
|
14: "#5FF",
|
|
1566
1566
|
15: "#FFF"
|
|
1567
1567
|
};
|
|
1568
|
-
return
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
return
|
|
1568
|
+
return dr(0, 5).forEach(function(e) {
|
|
1569
|
+
dr(0, 5).forEach(function(t) {
|
|
1570
|
+
dr(0, 5).forEach(function(o) {
|
|
1571
|
+
return cl(e, t, o, r);
|
|
1572
1572
|
});
|
|
1573
1573
|
});
|
|
1574
|
-
}),
|
|
1575
|
-
var t = e + 232, o =
|
|
1574
|
+
}), dr(0, 23).forEach(function(e) {
|
|
1575
|
+
var t = e + 232, o = jn(e * 10 + 8);
|
|
1576
1576
|
r[t] = "#" + o + o + o;
|
|
1577
1577
|
}), r;
|
|
1578
1578
|
}
|
|
1579
|
-
n(
|
|
1580
|
-
function
|
|
1579
|
+
n(ll, "getDefaultColors");
|
|
1580
|
+
function cl(r, e, t, o) {
|
|
1581
1581
|
var s = 16 + r * 36 + e * 6 + t, i = r > 0 ? r * 40 + 55 : 0, a = e > 0 ? e * 40 + 55 : 0, l = t > 0 ? t * 40 + 55 : 0;
|
|
1582
|
-
o[s] =
|
|
1582
|
+
o[s] = dl([i, a, l]);
|
|
1583
1583
|
}
|
|
1584
|
-
n(
|
|
1585
|
-
function
|
|
1584
|
+
n(cl, "setStyleColor");
|
|
1585
|
+
function jn(r) {
|
|
1586
1586
|
for (var e = r.toString(16); e.length < 2; )
|
|
1587
1587
|
e = "0" + e;
|
|
1588
1588
|
return e;
|
|
1589
1589
|
}
|
|
1590
|
-
n(
|
|
1591
|
-
function
|
|
1592
|
-
var e = [], t =
|
|
1590
|
+
n(jn, "toHexString");
|
|
1591
|
+
function dl(r) {
|
|
1592
|
+
var e = [], t = kn(r), o;
|
|
1593
1593
|
try {
|
|
1594
1594
|
for (t.s(); !(o = t.n()).done; ) {
|
|
1595
1595
|
var s = o.value;
|
|
1596
|
-
e.push(
|
|
1596
|
+
e.push(jn(s));
|
|
1597
1597
|
}
|
|
1598
1598
|
} catch (i) {
|
|
1599
1599
|
t.e(i);
|
|
@@ -1602,162 +1602,162 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1602
1602
|
}
|
|
1603
1603
|
return "#" + e.join("");
|
|
1604
1604
|
}
|
|
1605
|
-
n(
|
|
1606
|
-
function
|
|
1605
|
+
n(dl, "toColorHexString");
|
|
1606
|
+
function In(r, e, t, o) {
|
|
1607
1607
|
var s;
|
|
1608
|
-
return e === "text" ? s =
|
|
1609
|
-
erm256Background" ? s =
|
|
1608
|
+
return e === "text" ? s = yl(t, o) : e === "display" ? s = ul(r, t, o) : e === "xterm256Foreground" ? s = ur(r, o.colors[t]) : e === "xt\
|
|
1609
|
+
erm256Background" ? s = fr(r, o.colors[t]) : e === "rgb" && (s = pl(r, t)), s;
|
|
1610
1610
|
}
|
|
1611
|
-
n(
|
|
1612
|
-
function
|
|
1611
|
+
n(In, "generateOutput");
|
|
1612
|
+
function pl(r, e) {
|
|
1613
1613
|
e = e.substring(2).slice(0, -1);
|
|
1614
1614
|
var t = +e.substr(0, 2), o = e.substring(5).split(";"), s = o.map(function(i) {
|
|
1615
1615
|
return ("0" + Number(i).toString(16)).substr(-2);
|
|
1616
1616
|
}).join("");
|
|
1617
|
-
return
|
|
1617
|
+
return pr(r, (t === 38 ? "color:#" : "background-color:#") + s);
|
|
1618
1618
|
}
|
|
1619
|
-
n(
|
|
1620
|
-
function
|
|
1619
|
+
n(pl, "handleRgb");
|
|
1620
|
+
function ul(r, e, t) {
|
|
1621
1621
|
e = parseInt(e, 10);
|
|
1622
1622
|
var o = {
|
|
1623
1623
|
"-1": /* @__PURE__ */ n(function() {
|
|
1624
1624
|
return "<br/>";
|
|
1625
1625
|
}, "_"),
|
|
1626
1626
|
0: /* @__PURE__ */ n(function() {
|
|
1627
|
-
return r.length &&
|
|
1627
|
+
return r.length && Mn(r);
|
|
1628
1628
|
}, "_"),
|
|
1629
1629
|
1: /* @__PURE__ */ n(function() {
|
|
1630
|
-
return
|
|
1630
|
+
return ee(r, "b");
|
|
1631
1631
|
}, "_"),
|
|
1632
1632
|
3: /* @__PURE__ */ n(function() {
|
|
1633
|
-
return
|
|
1633
|
+
return ee(r, "i");
|
|
1634
1634
|
}, "_"),
|
|
1635
1635
|
4: /* @__PURE__ */ n(function() {
|
|
1636
|
-
return
|
|
1636
|
+
return ee(r, "u");
|
|
1637
1637
|
}, "_"),
|
|
1638
1638
|
8: /* @__PURE__ */ n(function() {
|
|
1639
|
-
return
|
|
1639
|
+
return pr(r, "display:none");
|
|
1640
1640
|
}, "_"),
|
|
1641
1641
|
9: /* @__PURE__ */ n(function() {
|
|
1642
|
-
return
|
|
1642
|
+
return ee(r, "strike");
|
|
1643
1643
|
}, "_"),
|
|
1644
1644
|
22: /* @__PURE__ */ n(function() {
|
|
1645
|
-
return
|
|
1645
|
+
return pr(r, "font-weight:normal;text-decoration:none;font-style:normal");
|
|
1646
1646
|
}, "_"),
|
|
1647
1647
|
23: /* @__PURE__ */ n(function() {
|
|
1648
|
-
return
|
|
1648
|
+
return Dn(r, "i");
|
|
1649
1649
|
}, "_"),
|
|
1650
1650
|
24: /* @__PURE__ */ n(function() {
|
|
1651
|
-
return
|
|
1651
|
+
return Dn(r, "u");
|
|
1652
1652
|
}, "_"),
|
|
1653
1653
|
39: /* @__PURE__ */ n(function() {
|
|
1654
|
-
return
|
|
1654
|
+
return ur(r, t.fg);
|
|
1655
1655
|
}, "_"),
|
|
1656
1656
|
49: /* @__PURE__ */ n(function() {
|
|
1657
|
-
return
|
|
1657
|
+
return fr(r, t.bg);
|
|
1658
1658
|
}, "_"),
|
|
1659
1659
|
53: /* @__PURE__ */ n(function() {
|
|
1660
|
-
return
|
|
1660
|
+
return pr(r, "text-decoration:overline");
|
|
1661
1661
|
}, "_")
|
|
1662
1662
|
}, s;
|
|
1663
|
-
return o[e] ? s = o[e]() : 4 < e && e < 7 ? s =
|
|
1664
|
-
|
|
1663
|
+
return o[e] ? s = o[e]() : 4 < e && e < 7 ? s = ee(r, "blink") : 29 < e && e < 38 ? s = ur(r, t.colors[e - 30]) : 39 < e && e < 48 ? s =
|
|
1664
|
+
fr(r, t.colors[e - 40]) : 89 < e && e < 98 ? s = ur(r, t.colors[8 + (e - 90)]) : 99 < e && e < 108 && (s = fr(r, t.colors[8 + (e - 100)])),
|
|
1665
1665
|
s;
|
|
1666
1666
|
}
|
|
1667
|
-
n(
|
|
1668
|
-
function
|
|
1667
|
+
n(ul, "handleDisplay");
|
|
1668
|
+
function Mn(r) {
|
|
1669
1669
|
var e = r.slice(0);
|
|
1670
1670
|
return r.length = 0, e.reverse().map(function(t) {
|
|
1671
1671
|
return "</" + t + ">";
|
|
1672
1672
|
}).join("");
|
|
1673
1673
|
}
|
|
1674
|
-
n(
|
|
1675
|
-
function
|
|
1674
|
+
n(Mn, "resetStyles");
|
|
1675
|
+
function dr(r, e) {
|
|
1676
1676
|
for (var t = [], o = r; o <= e; o++)
|
|
1677
1677
|
t.push(o);
|
|
1678
1678
|
return t;
|
|
1679
1679
|
}
|
|
1680
|
-
n(
|
|
1681
|
-
function
|
|
1680
|
+
n(dr, "range");
|
|
1681
|
+
function fl(r) {
|
|
1682
1682
|
return function(e) {
|
|
1683
1683
|
return (r === null || e.category !== r) && r !== "all";
|
|
1684
1684
|
};
|
|
1685
1685
|
}
|
|
1686
|
-
n(
|
|
1687
|
-
function
|
|
1686
|
+
n(fl, "notCategory");
|
|
1687
|
+
function On(r) {
|
|
1688
1688
|
r = parseInt(r, 10);
|
|
1689
1689
|
var e = null;
|
|
1690
1690
|
return r === 0 ? e = "all" : r === 1 ? e = "bold" : 2 < r && r < 5 ? e = "underline" : 4 < r && r < 7 ? e = "blink" : r === 8 ? e = "hid\
|
|
1691
1691
|
e" : r === 9 ? e = "strike" : 29 < r && r < 38 || r === 39 || 89 < r && r < 98 ? e = "foreground-color" : (39 < r && r < 48 || r === 49 || 99 <
|
|
1692
1692
|
r && r < 108) && (e = "background-color"), e;
|
|
1693
1693
|
}
|
|
1694
|
-
n(
|
|
1695
|
-
function
|
|
1696
|
-
return e.escapeXML ?
|
|
1694
|
+
n(On, "categoryForCode");
|
|
1695
|
+
function yl(r, e) {
|
|
1696
|
+
return e.escapeXML ? al.encodeXML(r) : r;
|
|
1697
1697
|
}
|
|
1698
|
-
n(
|
|
1699
|
-
function
|
|
1698
|
+
n(yl, "pushText");
|
|
1699
|
+
function ee(r, e, t) {
|
|
1700
1700
|
return t || (t = ""), r.push(e), "<".concat(e).concat(t ? ' style="'.concat(t, '"') : "", ">");
|
|
1701
1701
|
}
|
|
1702
|
-
n(
|
|
1703
|
-
function
|
|
1704
|
-
return
|
|
1702
|
+
n(ee, "pushTag");
|
|
1703
|
+
function pr(r, e) {
|
|
1704
|
+
return ee(r, "span", e);
|
|
1705
1705
|
}
|
|
1706
|
-
n(
|
|
1707
|
-
function
|
|
1708
|
-
return
|
|
1706
|
+
n(pr, "pushStyle");
|
|
1707
|
+
function ur(r, e) {
|
|
1708
|
+
return ee(r, "span", "color:" + e);
|
|
1709
1709
|
}
|
|
1710
|
-
n(
|
|
1711
|
-
function
|
|
1712
|
-
return
|
|
1710
|
+
n(ur, "pushForegroundColor");
|
|
1711
|
+
function fr(r, e) {
|
|
1712
|
+
return ee(r, "span", "background-color:" + e);
|
|
1713
1713
|
}
|
|
1714
|
-
n(
|
|
1715
|
-
function
|
|
1714
|
+
n(fr, "pushBackgroundColor");
|
|
1715
|
+
function Dn(r, e) {
|
|
1716
1716
|
var t;
|
|
1717
1717
|
if (r.slice(-1)[0] === e && (t = r.pop()), t)
|
|
1718
1718
|
return "</" + e + ">";
|
|
1719
1719
|
}
|
|
1720
|
-
n(
|
|
1721
|
-
function
|
|
1720
|
+
n(Dn, "closeTag");
|
|
1721
|
+
function ml(r, e, t) {
|
|
1722
1722
|
var o = !1, s = 3;
|
|
1723
1723
|
function i() {
|
|
1724
1724
|
return "";
|
|
1725
1725
|
}
|
|
1726
1726
|
n(i, "remove");
|
|
1727
|
-
function a(
|
|
1728
|
-
return t("xterm256Foreground",
|
|
1727
|
+
function a(R, w) {
|
|
1728
|
+
return t("xterm256Foreground", w), "";
|
|
1729
1729
|
}
|
|
1730
1730
|
n(a, "removeXterm256Foreground");
|
|
1731
|
-
function l(
|
|
1732
|
-
return t("xterm256Background",
|
|
1731
|
+
function l(R, w) {
|
|
1732
|
+
return t("xterm256Background", w), "";
|
|
1733
1733
|
}
|
|
1734
1734
|
n(l, "removeXterm256Background");
|
|
1735
|
-
function c(
|
|
1736
|
-
return e.newline ? t("display", -1) : t("text",
|
|
1735
|
+
function c(R) {
|
|
1736
|
+
return e.newline ? t("display", -1) : t("text", R), "";
|
|
1737
1737
|
}
|
|
1738
1738
|
n(c, "newline");
|
|
1739
|
-
function d(
|
|
1740
|
-
o = !0,
|
|
1741
|
-
var
|
|
1739
|
+
function d(R, w) {
|
|
1740
|
+
o = !0, w.trim().length === 0 && (w = "0"), w = w.trimRight(";").split(";");
|
|
1741
|
+
var E = kn(w), F;
|
|
1742
1742
|
try {
|
|
1743
|
-
for (
|
|
1743
|
+
for (E.s(); !(F = E.n()).done; ) {
|
|
1744
1744
|
var j = F.value;
|
|
1745
1745
|
t("display", j);
|
|
1746
1746
|
}
|
|
1747
1747
|
} catch (N) {
|
|
1748
|
-
|
|
1748
|
+
E.e(N);
|
|
1749
1749
|
} finally {
|
|
1750
|
-
|
|
1750
|
+
E.f();
|
|
1751
1751
|
}
|
|
1752
1752
|
return "";
|
|
1753
1753
|
}
|
|
1754
1754
|
n(d, "ansiMess");
|
|
1755
|
-
function p(
|
|
1756
|
-
return t("text",
|
|
1755
|
+
function p(R) {
|
|
1756
|
+
return t("text", R), "";
|
|
1757
1757
|
}
|
|
1758
1758
|
n(p, "realText");
|
|
1759
|
-
function u(
|
|
1760
|
-
return t("rgb",
|
|
1759
|
+
function u(R) {
|
|
1760
|
+
return t("rgb", R), "";
|
|
1761
1761
|
}
|
|
1762
1762
|
n(u, "rgb");
|
|
1763
1763
|
var y = [{
|
|
@@ -1820,80 +1820,80 @@ e" : r === 9 ? e = "strike" : 29 < r && r < 38 || r === 39 || 89 < r && r < 98 ?
|
|
|
1820
1820
|
pattern: /^(([^\x1b\x08\r\n])+)/,
|
|
1821
1821
|
sub: p
|
|
1822
1822
|
}];
|
|
1823
|
-
function
|
|
1824
|
-
|
|
1823
|
+
function h(R, w) {
|
|
1824
|
+
w > s && o || (o = !1, r = r.replace(R.pattern, R.sub));
|
|
1825
1825
|
}
|
|
1826
|
-
n(
|
|
1827
|
-
var
|
|
1828
|
-
e: for (;
|
|
1829
|
-
for (var T = 0,
|
|
1830
|
-
var
|
|
1831
|
-
if (
|
|
1832
|
-
|
|
1826
|
+
n(h, "process");
|
|
1827
|
+
var g = [], b = r, m = b.length;
|
|
1828
|
+
e: for (; m > 0; ) {
|
|
1829
|
+
for (var T = 0, x = 0, f = y.length; x < f; T = ++x) {
|
|
1830
|
+
var S = y[T];
|
|
1831
|
+
if (h(S, T), r.length !== m) {
|
|
1832
|
+
m = r.length;
|
|
1833
1833
|
continue e;
|
|
1834
1834
|
}
|
|
1835
1835
|
}
|
|
1836
|
-
if (r.length ===
|
|
1836
|
+
if (r.length === m)
|
|
1837
1837
|
break;
|
|
1838
|
-
|
|
1838
|
+
g.push(0), m = r.length;
|
|
1839
1839
|
}
|
|
1840
|
-
return
|
|
1840
|
+
return g;
|
|
1841
1841
|
}
|
|
1842
|
-
n(
|
|
1843
|
-
function
|
|
1844
|
-
return e !== "text" && (r = r.filter(
|
|
1842
|
+
n(ml, "tokenize");
|
|
1843
|
+
function hl(r, e, t) {
|
|
1844
|
+
return e !== "text" && (r = r.filter(fl(On(t))), r.push({
|
|
1845
1845
|
token: e,
|
|
1846
1846
|
data: t,
|
|
1847
|
-
category:
|
|
1847
|
+
category: On(t)
|
|
1848
1848
|
})), r;
|
|
1849
1849
|
}
|
|
1850
|
-
n(
|
|
1851
|
-
var
|
|
1850
|
+
n(hl, "updateStickyStack");
|
|
1851
|
+
var gl = /* @__PURE__ */ function() {
|
|
1852
1852
|
function r(e) {
|
|
1853
|
-
|
|
1853
|
+
nl(this, r), e = e || {}, e.colors && (e.colors = Object.assign({}, Fn.colors, e.colors)), this.options = Object.assign({}, Fn, e), this.
|
|
1854
1854
|
stack = [], this.stickyStack = [];
|
|
1855
1855
|
}
|
|
1856
|
-
return n(r, "Filter"),
|
|
1856
|
+
return n(r, "Filter"), sl(r, [{
|
|
1857
1857
|
key: "toHtml",
|
|
1858
1858
|
value: /* @__PURE__ */ n(function(t) {
|
|
1859
1859
|
var o = this;
|
|
1860
1860
|
t = typeof t == "string" ? [t] : t;
|
|
1861
1861
|
var s = this.stack, i = this.options, a = [];
|
|
1862
1862
|
return this.stickyStack.forEach(function(l) {
|
|
1863
|
-
var c =
|
|
1863
|
+
var c = In(s, l.token, l.data, i);
|
|
1864
1864
|
c && a.push(c);
|
|
1865
|
-
}),
|
|
1866
|
-
var d =
|
|
1867
|
-
d && a.push(d), i.stream && (o.stickyStack =
|
|
1868
|
-
}), s.length && a.push(
|
|
1865
|
+
}), ml(t.join(""), i, function(l, c) {
|
|
1866
|
+
var d = In(s, l, c, i);
|
|
1867
|
+
d && a.push(d), i.stream && (o.stickyStack = hl(o.stickyStack, l, c));
|
|
1868
|
+
}), s.length && a.push(Mn(s)), a.join("");
|
|
1869
1869
|
}, "toHtml")
|
|
1870
1870
|
}]), r;
|
|
1871
1871
|
}();
|
|
1872
|
-
|
|
1872
|
+
_n.exports = gl;
|
|
1873
1873
|
});
|
|
1874
1874
|
|
|
1875
1875
|
// src/preview-api/modules/addons/main.ts
|
|
1876
|
-
import { global as
|
|
1876
|
+
import { global as br } from "@storybook/global";
|
|
1877
1877
|
|
|
1878
1878
|
// src/preview-api/modules/addons/storybook-channel-mock.ts
|
|
1879
|
-
import { Channel as
|
|
1880
|
-
function
|
|
1879
|
+
import { Channel as rs } from "storybook/internal/channels";
|
|
1880
|
+
function gr() {
|
|
1881
1881
|
let r = {
|
|
1882
1882
|
setHandler: /* @__PURE__ */ n(() => {
|
|
1883
1883
|
}, "setHandler"),
|
|
1884
1884
|
send: /* @__PURE__ */ n(() => {
|
|
1885
1885
|
}, "send")
|
|
1886
1886
|
};
|
|
1887
|
-
return new
|
|
1887
|
+
return new rs({ transport: r });
|
|
1888
1888
|
}
|
|
1889
|
-
n(
|
|
1889
|
+
n(gr, "mockChannel");
|
|
1890
1890
|
|
|
1891
1891
|
// src/preview-api/modules/addons/main.ts
|
|
1892
|
-
var
|
|
1892
|
+
var xr = class xr {
|
|
1893
1893
|
constructor() {
|
|
1894
1894
|
this.getChannel = /* @__PURE__ */ n(() => {
|
|
1895
1895
|
if (!this.channel) {
|
|
1896
|
-
let e =
|
|
1896
|
+
let e = gr();
|
|
1897
1897
|
return this.setChannel(e), e;
|
|
1898
1898
|
}
|
|
1899
1899
|
return this.channel;
|
|
@@ -1907,33 +1907,32 @@ var br = class {
|
|
|
1907
1907
|
this.resolve = () => e(this.getChannel());
|
|
1908
1908
|
});
|
|
1909
1909
|
}
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
return hr[gr] || (hr[gr] = new br()), hr[gr];
|
|
1910
|
+
};
|
|
1911
|
+
n(xr, "AddonStore");
|
|
1912
|
+
var Tr = xr, Sr = "__STORYBOOK_ADDONS_PREVIEW";
|
|
1913
|
+
function ts() {
|
|
1914
|
+
return br[Sr] || (br[Sr] = new Tr()), br[Sr];
|
|
1916
1915
|
}
|
|
1917
|
-
n(
|
|
1918
|
-
var _ =
|
|
1916
|
+
n(ts, "getAddonsStore");
|
|
1917
|
+
var _ = ts();
|
|
1919
1918
|
|
|
1920
1919
|
// src/preview-api/modules/addons/definePreview.ts
|
|
1921
|
-
function
|
|
1920
|
+
function os(r) {
|
|
1922
1921
|
return r;
|
|
1923
1922
|
}
|
|
1924
|
-
n(
|
|
1923
|
+
n(os, "definePreview");
|
|
1925
1924
|
|
|
1926
1925
|
// src/preview-api/modules/addons/hooks.ts
|
|
1927
|
-
import { logger as
|
|
1926
|
+
import { logger as Ae } from "storybook/internal/client-logger";
|
|
1928
1927
|
import {
|
|
1929
|
-
FORCE_RE_RENDER as
|
|
1930
|
-
RESET_STORY_ARGS as
|
|
1931
|
-
STORY_RENDERED as
|
|
1932
|
-
UPDATE_GLOBALS as
|
|
1933
|
-
UPDATE_STORY_ARGS as
|
|
1928
|
+
FORCE_RE_RENDER as ns,
|
|
1929
|
+
RESET_STORY_ARGS as ss,
|
|
1930
|
+
STORY_RENDERED as At,
|
|
1931
|
+
UPDATE_GLOBALS as is,
|
|
1932
|
+
UPDATE_STORY_ARGS as as
|
|
1934
1933
|
} from "storybook/internal/core-events";
|
|
1935
1934
|
import { global as ze } from "@storybook/global";
|
|
1936
|
-
var
|
|
1935
|
+
var Cr = class Cr {
|
|
1937
1936
|
constructor() {
|
|
1938
1937
|
this.hookListsMap = void 0;
|
|
1939
1938
|
this.mountedDecorators = void 0;
|
|
@@ -1951,9 +1950,6 @@ var te = class {
|
|
|
1951
1950
|
}, "renderListener");
|
|
1952
1951
|
this.init();
|
|
1953
1952
|
}
|
|
1954
|
-
static {
|
|
1955
|
-
n(this, "HooksContext");
|
|
1956
|
-
}
|
|
1957
1953
|
init() {
|
|
1958
1954
|
this.hookListsMap = /* @__PURE__ */ new WeakMap(), this.mountedDecorators = /* @__PURE__ */ new Set(), this.prevMountedDecorators = /* @__PURE__ */ new Set(),
|
|
1959
1955
|
this.currentHooks = [], this.nextHookIndex = 0, this.currentPhase = "NONE", this.currentEffects = [], this.prevEffects = [], this.currentDecoratorName =
|
|
@@ -1976,13 +1972,15 @@ var te = class {
|
|
|
1976
1972
|
}), this.prevEffects = this.currentEffects, this.currentEffects = [];
|
|
1977
1973
|
}
|
|
1978
1974
|
addRenderListeners() {
|
|
1979
|
-
this.removeRenderListeners(), _.getChannel().on(
|
|
1975
|
+
this.removeRenderListeners(), _.getChannel().on(At, this.renderListener);
|
|
1980
1976
|
}
|
|
1981
1977
|
removeRenderListeners() {
|
|
1982
|
-
_.getChannel().removeListener(
|
|
1978
|
+
_.getChannel().removeListener(At, this.renderListener);
|
|
1983
1979
|
}
|
|
1984
1980
|
};
|
|
1985
|
-
|
|
1981
|
+
n(Cr, "HooksContext");
|
|
1982
|
+
var re = Cr;
|
|
1983
|
+
function Et(r) {
|
|
1986
1984
|
let e = /* @__PURE__ */ n((...t) => {
|
|
1987
1985
|
let { hooks: o } = typeof t[0] == "function" ? t[1] : t[0], s = o.currentPhase, i = o.currentHooks, a = o.nextHookIndex, l = o.currentDecoratorName;
|
|
1988
1986
|
o.currentDecoratorName = r.name, o.prevMountedDecorators.has(r) ? (o.currentPhase = "UPDATE", o.currentHooks = o.hookListsMap.get(r) || []) :
|
|
@@ -1999,41 +1997,41 @@ function at(r) {
|
|
|
1999
1997
|
}, "hookified");
|
|
2000
1998
|
return e.originalFn = r, e;
|
|
2001
1999
|
}
|
|
2002
|
-
n(
|
|
2003
|
-
var
|
|
2000
|
+
n(Et, "hookify");
|
|
2001
|
+
var Rr = 0, ls = 25, wr = /* @__PURE__ */ n((r) => (e, t) => {
|
|
2004
2002
|
let o = r(
|
|
2005
|
-
|
|
2006
|
-
t.map((s) =>
|
|
2003
|
+
Et(e),
|
|
2004
|
+
t.map((s) => Et(s))
|
|
2007
2005
|
);
|
|
2008
2006
|
return (s) => {
|
|
2009
2007
|
let { hooks: i } = s;
|
|
2010
2008
|
i.prevMountedDecorators ??= /* @__PURE__ */ new Set(), i.mountedDecorators = /* @__PURE__ */ new Set([e, ...t]), i.currentContext = s, i.
|
|
2011
2009
|
hasUpdates = !1;
|
|
2012
2010
|
let a = o(s);
|
|
2013
|
-
for (
|
|
2014
|
-
if (i.hasUpdates = !1, i.currentEffects = [], a = o(s),
|
|
2011
|
+
for (Rr = 1; i.hasUpdates; )
|
|
2012
|
+
if (i.hasUpdates = !1, i.currentEffects = [], a = o(s), Rr += 1, Rr > ls)
|
|
2015
2013
|
throw new Error(
|
|
2016
2014
|
"Too many re-renders. Storybook limits the number of renders to prevent an infinite loop."
|
|
2017
2015
|
);
|
|
2018
2016
|
return i.addRenderListeners(), a;
|
|
2019
2017
|
};
|
|
2020
|
-
}, "applyHooks"),
|
|
2018
|
+
}, "applyHooks"), cs = /* @__PURE__ */ n((r, e) => r.length === e.length && r.every((t, o) => t === e[o]), "areDepsEqual"), Ar = /* @__PURE__ */ n(
|
|
2021
2019
|
() => new Error("Storybook preview hooks can only be called inside decorators and story functions."), "invalidHooksError");
|
|
2022
|
-
function
|
|
2020
|
+
function Ct() {
|
|
2023
2021
|
return ze.STORYBOOK_HOOKS_CONTEXT || null;
|
|
2024
2022
|
}
|
|
2025
|
-
n(
|
|
2026
|
-
function
|
|
2027
|
-
let r =
|
|
2023
|
+
n(Ct, "getHooksContextOrNull");
|
|
2024
|
+
function Er() {
|
|
2025
|
+
let r = Ct();
|
|
2028
2026
|
if (r == null)
|
|
2029
|
-
throw
|
|
2027
|
+
throw Ar();
|
|
2030
2028
|
return r;
|
|
2031
2029
|
}
|
|
2032
|
-
n(
|
|
2033
|
-
function
|
|
2034
|
-
let o =
|
|
2030
|
+
n(Er, "getHooksContextOrThrow");
|
|
2031
|
+
function ds(r, e, t) {
|
|
2032
|
+
let o = Er();
|
|
2035
2033
|
if (o.currentPhase === "MOUNT") {
|
|
2036
|
-
t != null && !Array.isArray(t) &&
|
|
2034
|
+
t != null && !Array.isArray(t) && Ae.warn(
|
|
2037
2035
|
`${r} received a final argument that is not an array (instead, received ${t}). When specified, the final argument must be an array.`
|
|
2038
2036
|
);
|
|
2039
2037
|
let s = { name: r, deps: t };
|
|
@@ -2043,22 +2041,22 @@ function Vn(r, e, t) {
|
|
|
2043
2041
|
let s = o.getNextHook();
|
|
2044
2042
|
if (s == null)
|
|
2045
2043
|
throw new Error("Rendered more hooks than during the previous render.");
|
|
2046
|
-
return s.name !== r &&
|
|
2044
|
+
return s.name !== r && Ae.warn(
|
|
2047
2045
|
`Storybook has detected a change in the order of Hooks${o.currentDecoratorName ? ` called by ${o.currentDecoratorName}` : ""}. This wi\
|
|
2048
2046
|
ll lead to bugs and errors if not fixed.`
|
|
2049
|
-
), t != null && s.deps == null &&
|
|
2047
|
+
), t != null && s.deps == null && Ae.warn(
|
|
2050
2048
|
`${r} received a final argument during this render, but not during the previous render. Even though the final argument is optional, it\
|
|
2051
2049
|
s type cannot change between renders.`
|
|
2052
|
-
), t != null && s.deps != null && t.length !== s.deps.length &&
|
|
2050
|
+
), t != null && s.deps != null && t.length !== s.deps.length && Ae.warn(`The final argument passed to ${r} changed size between renders.\
|
|
2053
2051
|
The order and size of this array must remain constant.
|
|
2054
2052
|
Previous: ${s.deps}
|
|
2055
|
-
Incoming: ${t}`), (t == null || s.deps == null || !
|
|
2053
|
+
Incoming: ${t}`), (t == null || s.deps == null || !cs(t, s.deps)) && (e(s), s.deps = t), s;
|
|
2056
2054
|
}
|
|
2057
|
-
throw
|
|
2055
|
+
throw Ar();
|
|
2058
2056
|
}
|
|
2059
|
-
n(
|
|
2060
|
-
function
|
|
2061
|
-
let { memoizedState: o } =
|
|
2057
|
+
n(ds, "useHook");
|
|
2058
|
+
function Ge(r, e, t) {
|
|
2059
|
+
let { memoizedState: o } = ds(
|
|
2062
2060
|
r,
|
|
2063
2061
|
(s) => {
|
|
2064
2062
|
s.memoizedState = e();
|
|
@@ -2067,104 +2065,104 @@ function Be(r, e, t) {
|
|
|
2067
2065
|
);
|
|
2068
2066
|
return o;
|
|
2069
2067
|
}
|
|
2070
|
-
n(
|
|
2071
|
-
function
|
|
2072
|
-
return
|
|
2068
|
+
n(Ge, "useMemoLike");
|
|
2069
|
+
function ps(r, e) {
|
|
2070
|
+
return Ge("useMemo", r, e);
|
|
2073
2071
|
}
|
|
2074
|
-
n(
|
|
2075
|
-
function
|
|
2076
|
-
return
|
|
2072
|
+
n(ps, "useMemo");
|
|
2073
|
+
function Ee(r, e) {
|
|
2074
|
+
return Ge("useCallback", () => r, e);
|
|
2077
2075
|
}
|
|
2078
|
-
n(
|
|
2079
|
-
function
|
|
2080
|
-
return
|
|
2076
|
+
n(Ee, "useCallback");
|
|
2077
|
+
function vt(r, e) {
|
|
2078
|
+
return Ge(r, () => ({ current: e }), []);
|
|
2081
2079
|
}
|
|
2082
|
-
n(
|
|
2083
|
-
function
|
|
2084
|
-
return
|
|
2080
|
+
n(vt, "useRefLike");
|
|
2081
|
+
function us(r) {
|
|
2082
|
+
return vt("useRef", r);
|
|
2085
2083
|
}
|
|
2086
|
-
n(
|
|
2087
|
-
function
|
|
2088
|
-
let r =
|
|
2084
|
+
n(us, "useRef");
|
|
2085
|
+
function fs() {
|
|
2086
|
+
let r = Ct();
|
|
2089
2087
|
if (r != null && r.currentPhase !== "NONE")
|
|
2090
2088
|
r.hasUpdates = !0;
|
|
2091
2089
|
else
|
|
2092
2090
|
try {
|
|
2093
|
-
_.getChannel().emit(
|
|
2091
|
+
_.getChannel().emit(ns);
|
|
2094
2092
|
} catch {
|
|
2095
|
-
|
|
2093
|
+
Ae.warn("State updates of Storybook preview hooks work only in browser");
|
|
2096
2094
|
}
|
|
2097
2095
|
}
|
|
2098
|
-
n(
|
|
2099
|
-
function
|
|
2100
|
-
let t =
|
|
2096
|
+
n(fs, "triggerUpdate");
|
|
2097
|
+
function Pt(r, e) {
|
|
2098
|
+
let t = vt(
|
|
2101
2099
|
r,
|
|
2102
2100
|
// @ts-expect-error S type should never be function, but there's no way to tell that to TypeScript
|
|
2103
2101
|
typeof e == "function" ? e() : e
|
|
2104
2102
|
), o = /* @__PURE__ */ n((s) => {
|
|
2105
|
-
t.current = typeof s == "function" ? s(t.current) : s,
|
|
2103
|
+
t.current = typeof s == "function" ? s(t.current) : s, fs();
|
|
2106
2104
|
}, "setState");
|
|
2107
2105
|
return [t.current, o];
|
|
2108
2106
|
}
|
|
2109
|
-
n(
|
|
2110
|
-
function
|
|
2111
|
-
return
|
|
2107
|
+
n(Pt, "useStateLike");
|
|
2108
|
+
function ys(r) {
|
|
2109
|
+
return Pt("useState", r);
|
|
2112
2110
|
}
|
|
2113
|
-
n(
|
|
2114
|
-
function
|
|
2115
|
-
let o = t != null ? () => t(e) : e, [s, i] =
|
|
2111
|
+
n(ys, "useState");
|
|
2112
|
+
function ms(r, e, t) {
|
|
2113
|
+
let o = t != null ? () => t(e) : e, [s, i] = Pt("useReducer", o);
|
|
2116
2114
|
return [s, /* @__PURE__ */ n((l) => i((c) => r(c, l)), "dispatch")];
|
|
2117
2115
|
}
|
|
2118
|
-
n(
|
|
2119
|
-
function
|
|
2120
|
-
let t =
|
|
2116
|
+
n(ms, "useReducer");
|
|
2117
|
+
function Ft(r, e) {
|
|
2118
|
+
let t = Er(), o = Ge("useEffect", () => ({ create: r }), e);
|
|
2121
2119
|
t.currentEffects.includes(o) || t.currentEffects.push(o);
|
|
2122
2120
|
}
|
|
2123
|
-
n(
|
|
2124
|
-
function
|
|
2121
|
+
n(Ft, "useEffect");
|
|
2122
|
+
function hs(r, e = []) {
|
|
2125
2123
|
let t = _.getChannel();
|
|
2126
|
-
return
|
|
2124
|
+
return Ft(() => (Object.entries(r).forEach(([o, s]) => t.on(o, s)), () => {
|
|
2127
2125
|
Object.entries(r).forEach(
|
|
2128
2126
|
([o, s]) => t.removeListener(o, s)
|
|
2129
2127
|
);
|
|
2130
|
-
}), [...Object.keys(r), ...e]),
|
|
2128
|
+
}), [...Object.keys(r), ...e]), Ee(t.emit.bind(t), [t]);
|
|
2131
2129
|
}
|
|
2132
|
-
n(
|
|
2133
|
-
function
|
|
2134
|
-
let { currentContext: r } =
|
|
2130
|
+
n(hs, "useChannel");
|
|
2131
|
+
function Ue() {
|
|
2132
|
+
let { currentContext: r } = Er();
|
|
2135
2133
|
if (r == null)
|
|
2136
|
-
throw
|
|
2134
|
+
throw Ar();
|
|
2137
2135
|
return r;
|
|
2138
2136
|
}
|
|
2139
|
-
n(
|
|
2140
|
-
function
|
|
2141
|
-
let { parameters: t } =
|
|
2137
|
+
n(Ue, "useStoryContext");
|
|
2138
|
+
function gs(r, e) {
|
|
2139
|
+
let { parameters: t } = Ue();
|
|
2142
2140
|
if (r)
|
|
2143
2141
|
return t[r] ?? e;
|
|
2144
2142
|
}
|
|
2145
|
-
n(
|
|
2146
|
-
function
|
|
2147
|
-
let r = _.getChannel(), { id: e, args: t } =
|
|
2148
|
-
(i) => r.emit(
|
|
2143
|
+
n(gs, "useParameter");
|
|
2144
|
+
function bs() {
|
|
2145
|
+
let r = _.getChannel(), { id: e, args: t } = Ue(), o = Ee(
|
|
2146
|
+
(i) => r.emit(as, { storyId: e, updatedArgs: i }),
|
|
2149
2147
|
[r, e]
|
|
2150
|
-
), s =
|
|
2151
|
-
(i) => r.emit(
|
|
2148
|
+
), s = Ee(
|
|
2149
|
+
(i) => r.emit(ss, { storyId: e, argNames: i }),
|
|
2152
2150
|
[r, e]
|
|
2153
2151
|
);
|
|
2154
2152
|
return [t, o, s];
|
|
2155
2153
|
}
|
|
2156
|
-
n(
|
|
2157
|
-
function
|
|
2158
|
-
let r = _.getChannel(), { globals: e } =
|
|
2159
|
-
(o) => r.emit(
|
|
2154
|
+
n(bs, "useArgs");
|
|
2155
|
+
function Ss() {
|
|
2156
|
+
let r = _.getChannel(), { globals: e } = Ue(), t = Ee(
|
|
2157
|
+
(o) => r.emit(is, { globals: o }),
|
|
2160
2158
|
[r]
|
|
2161
2159
|
);
|
|
2162
2160
|
return [e, t];
|
|
2163
2161
|
}
|
|
2164
|
-
n(
|
|
2162
|
+
n(Ss, "useGlobals");
|
|
2165
2163
|
|
|
2166
2164
|
// src/preview-api/modules/addons/make-decorator.ts
|
|
2167
|
-
var
|
|
2165
|
+
var Ts = /* @__PURE__ */ n(({
|
|
2168
2166
|
name: r,
|
|
2169
2167
|
parameterName: e,
|
|
2170
2168
|
wrapper: t,
|
|
@@ -2189,38 +2187,46 @@ var es = /* @__PURE__ */ n(({
|
|
|
2189
2187
|
|
|
2190
2188
|
// src/preview-api/modules/store/StoryStore.ts
|
|
2191
2189
|
import {
|
|
2192
|
-
CalledExtractOnStoreError as
|
|
2193
|
-
MissingStoryFromCsfFileError as
|
|
2190
|
+
CalledExtractOnStoreError as si,
|
|
2191
|
+
MissingStoryFromCsfFileError as ii
|
|
2194
2192
|
} from "storybook/internal/preview-errors";
|
|
2195
2193
|
|
|
2196
|
-
// ../node_modules/es-toolkit/dist/
|
|
2197
|
-
function
|
|
2198
|
-
let t = {}, o = Object.entries(r);
|
|
2199
|
-
for (let s = 0; s < o.length; s++) {
|
|
2200
|
-
let [i, a] = o[s];
|
|
2201
|
-
e(a, i) && (t[i] = a);
|
|
2202
|
-
}
|
|
2203
|
-
return t;
|
|
2194
|
+
// ../node_modules/es-toolkit/dist/function/noop.mjs
|
|
2195
|
+
function It() {
|
|
2204
2196
|
}
|
|
2205
|
-
n(
|
|
2197
|
+
n(It, "noop");
|
|
2198
|
+
|
|
2199
|
+
// ../node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
|
|
2200
|
+
function vr(r) {
|
|
2201
|
+
return Object.getOwnPropertySymbols(r).filter((e) => Object.prototype.propertyIsEnumerable.call(r, e));
|
|
2202
|
+
}
|
|
2203
|
+
n(vr, "getSymbols");
|
|
2204
|
+
|
|
2205
|
+
// ../node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
|
|
2206
|
+
function Pr(r) {
|
|
2207
|
+
return r == null ? r === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(r);
|
|
2208
|
+
}
|
|
2209
|
+
n(Pr, "getTag");
|
|
2210
|
+
|
|
2211
|
+
// ../node_modules/es-toolkit/dist/compat/_internal/tags.mjs
|
|
2212
|
+
var Ot = "[object RegExp]", Dt = "[object String]", kt = "[object Number]", jt = "[object Boolean]", Fr = "[object Arguments]", Mt = "[objec\
|
|
2213
|
+
t Symbol]", _t = "[object Date]", Lt = "[object Map]", Nt = "[object Set]", qt = "[object Array]", Bt = "[object Function]", zt = "[object A\
|
|
2214
|
+
rrayBuffer]", He = "[object Object]", Gt = "[object Error]", Ut = "[object DataView]", Ht = "[object Uint8Array]", Vt = "[object Uint8Clampe\
|
|
2215
|
+
dArray]", Wt = "[object Uint16Array]", $t = "[object Uint32Array]", Yt = "[object BigUint64Array]", Kt = "[object Int8Array]", Xt = "[object\
|
|
2216
|
+
Int16Array]", Jt = "[object Int32Array]", Qt = "[object BigInt64Array]", Zt = "[object Float32Array]", eo = "[object Float64Array]";
|
|
2206
2217
|
|
|
2207
2218
|
// ../node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
|
|
2208
2219
|
function k(r) {
|
|
2209
|
-
if (typeof r != "object"
|
|
2210
|
-
return !1;
|
|
2211
|
-
if (Object.getPrototypeOf(r) === null)
|
|
2212
|
-
return !0;
|
|
2213
|
-
if (r.toString() !== "[object Object]")
|
|
2220
|
+
if (!r || typeof r != "object")
|
|
2214
2221
|
return !1;
|
|
2215
|
-
let e = r;
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
return Object.getPrototypeOf(r) === e;
|
|
2222
|
+
let e = Object.getPrototypeOf(r);
|
|
2223
|
+
return e === null || e === Object.prototype || Object.getPrototypeOf(e) === null ? Object.prototype.toString.call(r) === "[object Object]" :
|
|
2224
|
+
!1;
|
|
2219
2225
|
}
|
|
2220
2226
|
n(k, "isPlainObject");
|
|
2221
2227
|
|
|
2222
2228
|
// ../node_modules/es-toolkit/dist/object/mapValues.mjs
|
|
2223
|
-
function
|
|
2229
|
+
function H(r, e) {
|
|
2224
2230
|
let t = {}, o = Object.keys(r);
|
|
2225
2231
|
for (let s = 0; s < o.length; s++) {
|
|
2226
2232
|
let i = o[s], a = r[i];
|
|
@@ -2228,29 +2234,34 @@ function V(r, e) {
|
|
|
2228
2234
|
}
|
|
2229
2235
|
return t;
|
|
2230
2236
|
}
|
|
2231
|
-
n(
|
|
2237
|
+
n(H, "mapValues");
|
|
2232
2238
|
|
|
2233
|
-
// ../node_modules/es-toolkit/dist/
|
|
2234
|
-
|
|
2235
|
-
t
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
function Ar(r) {
|
|
2242
|
-
return Object.getOwnPropertySymbols(r).filter((e) => Object.prototype.propertyIsEnumerable.call(r, e));
|
|
2239
|
+
// ../node_modules/es-toolkit/dist/object/pickBy.mjs
|
|
2240
|
+
function Ir(r, e) {
|
|
2241
|
+
let t = {}, o = Object.keys(r);
|
|
2242
|
+
for (let s = 0; s < o.length; s++) {
|
|
2243
|
+
let i = o[s], a = r[i];
|
|
2244
|
+
e(a, i) && (t[i] = a);
|
|
2245
|
+
}
|
|
2246
|
+
return t;
|
|
2243
2247
|
}
|
|
2244
|
-
n(
|
|
2248
|
+
n(Ir, "pickBy");
|
|
2245
2249
|
|
|
2246
|
-
// ../node_modules/es-toolkit/dist/compat/
|
|
2247
|
-
function
|
|
2248
|
-
return r
|
|
2250
|
+
// ../node_modules/es-toolkit/dist/compat/util/eq.mjs
|
|
2251
|
+
function ro(r, e) {
|
|
2252
|
+
return r === e || Number.isNaN(r) && Number.isNaN(e);
|
|
2249
2253
|
}
|
|
2250
|
-
n(
|
|
2254
|
+
n(ro, "eq");
|
|
2251
2255
|
|
|
2252
|
-
// ../node_modules/es-toolkit/dist/predicate/
|
|
2253
|
-
function
|
|
2256
|
+
// ../node_modules/es-toolkit/dist/predicate/isEqualWith.mjs
|
|
2257
|
+
function to(r, e, t) {
|
|
2258
|
+
return Ce(r, e, void 0, void 0, void 0, void 0, t);
|
|
2259
|
+
}
|
|
2260
|
+
n(to, "isEqualWith");
|
|
2261
|
+
function Ce(r, e, t, o, s, i, a) {
|
|
2262
|
+
let l = a(r, e, t, o, s, i);
|
|
2263
|
+
if (l !== void 0)
|
|
2264
|
+
return l;
|
|
2254
2265
|
if (typeof r == typeof e)
|
|
2255
2266
|
switch (typeof r) {
|
|
2256
2267
|
case "bigint":
|
|
@@ -2264,97 +2275,97 @@ function vr(r, e) {
|
|
|
2264
2275
|
case "function":
|
|
2265
2276
|
return r === e;
|
|
2266
2277
|
case "object":
|
|
2267
|
-
return
|
|
2278
|
+
return ve(r, e, i, a);
|
|
2268
2279
|
}
|
|
2269
|
-
return
|
|
2280
|
+
return ve(r, e, i, a);
|
|
2270
2281
|
}
|
|
2271
|
-
n(
|
|
2272
|
-
function
|
|
2282
|
+
n(Ce, "isEqualWithImpl");
|
|
2283
|
+
function ve(r, e, t, o) {
|
|
2273
2284
|
if (Object.is(r, e))
|
|
2274
2285
|
return !0;
|
|
2275
|
-
let
|
|
2276
|
-
if (
|
|
2286
|
+
let s = Pr(r), i = Pr(e);
|
|
2287
|
+
if (s === Fr && (s = He), i === Fr && (i = He), s !== i)
|
|
2277
2288
|
return !1;
|
|
2278
|
-
switch (
|
|
2279
|
-
case
|
|
2289
|
+
switch (s) {
|
|
2290
|
+
case Dt:
|
|
2280
2291
|
return r.toString() === e.toString();
|
|
2281
|
-
case
|
|
2282
|
-
let
|
|
2283
|
-
return
|
|
2292
|
+
case kt: {
|
|
2293
|
+
let c = r.valueOf(), d = e.valueOf();
|
|
2294
|
+
return ro(c, d);
|
|
2284
2295
|
}
|
|
2285
|
-
case
|
|
2286
|
-
case
|
|
2287
|
-
case
|
|
2296
|
+
case jt:
|
|
2297
|
+
case _t:
|
|
2298
|
+
case Mt:
|
|
2288
2299
|
return Object.is(r.valueOf(), e.valueOf());
|
|
2289
|
-
case
|
|
2300
|
+
case Ot:
|
|
2290
2301
|
return r.source === e.source && r.flags === e.flags;
|
|
2291
|
-
case
|
|
2302
|
+
case Bt:
|
|
2292
2303
|
return r === e;
|
|
2293
2304
|
}
|
|
2294
2305
|
t = t ?? /* @__PURE__ */ new Map();
|
|
2295
|
-
let
|
|
2296
|
-
if (
|
|
2297
|
-
return
|
|
2306
|
+
let a = t.get(r), l = t.get(e);
|
|
2307
|
+
if (a != null && l != null)
|
|
2308
|
+
return a === e;
|
|
2298
2309
|
t.set(r, e), t.set(e, r);
|
|
2299
2310
|
try {
|
|
2300
|
-
switch (
|
|
2301
|
-
case
|
|
2311
|
+
switch (s) {
|
|
2312
|
+
case Lt: {
|
|
2302
2313
|
if (r.size !== e.size)
|
|
2303
2314
|
return !1;
|
|
2304
|
-
for (let [
|
|
2305
|
-
if (!e.has(
|
|
2315
|
+
for (let [c, d] of r.entries())
|
|
2316
|
+
if (!e.has(c) || !Ce(d, e.get(c), c, r, e, t, o))
|
|
2306
2317
|
return !1;
|
|
2307
2318
|
return !0;
|
|
2308
2319
|
}
|
|
2309
|
-
case
|
|
2320
|
+
case Nt: {
|
|
2310
2321
|
if (r.size !== e.size)
|
|
2311
2322
|
return !1;
|
|
2312
|
-
let
|
|
2313
|
-
for (let
|
|
2314
|
-
let
|
|
2315
|
-
if (
|
|
2323
|
+
let c = Array.from(r.values()), d = Array.from(e.values());
|
|
2324
|
+
for (let p = 0; p < c.length; p++) {
|
|
2325
|
+
let u = c[p], y = d.findIndex((h) => Ce(u, h, void 0, r, e, t, o));
|
|
2326
|
+
if (y === -1)
|
|
2316
2327
|
return !1;
|
|
2317
|
-
|
|
2328
|
+
d.splice(y, 1);
|
|
2318
2329
|
}
|
|
2319
2330
|
return !0;
|
|
2320
2331
|
}
|
|
2321
|
-
case
|
|
2322
|
-
case
|
|
2323
|
-
case
|
|
2324
|
-
case
|
|
2325
|
-
case
|
|
2326
|
-
case
|
|
2327
|
-
case
|
|
2328
|
-
case
|
|
2329
|
-
case
|
|
2330
|
-
case
|
|
2331
|
-
case
|
|
2332
|
-
case
|
|
2332
|
+
case qt:
|
|
2333
|
+
case Ht:
|
|
2334
|
+
case Vt:
|
|
2335
|
+
case Wt:
|
|
2336
|
+
case $t:
|
|
2337
|
+
case Yt:
|
|
2338
|
+
case Kt:
|
|
2339
|
+
case Xt:
|
|
2340
|
+
case Jt:
|
|
2341
|
+
case Qt:
|
|
2342
|
+
case Zt:
|
|
2343
|
+
case eo: {
|
|
2333
2344
|
if (typeof Buffer < "u" && Buffer.isBuffer(r) !== Buffer.isBuffer(e) || r.length !== e.length)
|
|
2334
2345
|
return !1;
|
|
2335
|
-
for (let
|
|
2336
|
-
if (!
|
|
2346
|
+
for (let c = 0; c < r.length; c++)
|
|
2347
|
+
if (!Ce(r[c], e[c], c, r, e, t, o))
|
|
2337
2348
|
return !1;
|
|
2338
2349
|
return !0;
|
|
2339
2350
|
}
|
|
2340
|
-
case
|
|
2341
|
-
return r.byteLength !== e.byteLength ? !1 :
|
|
2342
|
-
case
|
|
2343
|
-
return r.byteLength !== e.byteLength || r.byteOffset !== e.byteOffset ? !1 :
|
|
2344
|
-
case
|
|
2351
|
+
case zt:
|
|
2352
|
+
return r.byteLength !== e.byteLength ? !1 : ve(new Uint8Array(r), new Uint8Array(e), t, o);
|
|
2353
|
+
case Ut:
|
|
2354
|
+
return r.byteLength !== e.byteLength || r.byteOffset !== e.byteOffset ? !1 : ve(new Uint8Array(r), new Uint8Array(e), t, o);
|
|
2355
|
+
case Gt:
|
|
2345
2356
|
return r.name === e.name && r.message === e.message;
|
|
2346
|
-
case
|
|
2347
|
-
if (!(
|
|
2357
|
+
case He: {
|
|
2358
|
+
if (!(ve(r.constructor, e.constructor, t, o) || k(r) && k(e)))
|
|
2348
2359
|
return !1;
|
|
2349
|
-
let
|
|
2350
|
-
if (
|
|
2360
|
+
let d = [...Object.keys(r), ...vr(r)], p = [...Object.keys(e), ...vr(e)];
|
|
2361
|
+
if (d.length !== p.length)
|
|
2351
2362
|
return !1;
|
|
2352
|
-
for (let
|
|
2353
|
-
let
|
|
2354
|
-
if (!Object.
|
|
2363
|
+
for (let u = 0; u < d.length; u++) {
|
|
2364
|
+
let y = d[u], h = r[y];
|
|
2365
|
+
if (!Object.hasOwn(e, y))
|
|
2355
2366
|
return !1;
|
|
2356
|
-
let g = e[
|
|
2357
|
-
if (!
|
|
2367
|
+
let g = e[y];
|
|
2368
|
+
if (!Ce(h, g, y, r, e, t, o))
|
|
2358
2369
|
return !1;
|
|
2359
2370
|
}
|
|
2360
2371
|
return !0;
|
|
@@ -2366,44 +2377,50 @@ function H(r, e, t) {
|
|
|
2366
2377
|
t.delete(r), t.delete(e);
|
|
2367
2378
|
}
|
|
2368
2379
|
}
|
|
2369
|
-
n(
|
|
2380
|
+
n(ve, "areObjectsEqual");
|
|
2381
|
+
|
|
2382
|
+
// ../node_modules/es-toolkit/dist/predicate/isEqual.mjs
|
|
2383
|
+
function Or(r, e) {
|
|
2384
|
+
return to(r, e, It);
|
|
2385
|
+
}
|
|
2386
|
+
n(Or, "isEqual");
|
|
2370
2387
|
|
|
2371
2388
|
// src/preview-api/modules/store/StoryStore.ts
|
|
2372
|
-
var
|
|
2389
|
+
var Ze = pe(kr(), 1);
|
|
2373
2390
|
|
|
2374
|
-
// src/preview
|
|
2375
|
-
import
|
|
2376
|
-
import
|
|
2377
|
-
import
|
|
2378
|
-
import
|
|
2379
|
-
import
|
|
2380
|
-
import
|
|
2381
|
-
import
|
|
2382
|
-
import
|
|
2383
|
-
function
|
|
2391
|
+
// src/shared/preview/core-annotations.ts
|
|
2392
|
+
import no from "storybook/internal/component-testing/preview";
|
|
2393
|
+
import so from "storybook/actions/preview";
|
|
2394
|
+
import io from "storybook/backgrounds/preview";
|
|
2395
|
+
import ao from "storybook/highlight/preview";
|
|
2396
|
+
import lo from "storybook/measure/preview";
|
|
2397
|
+
import co from "storybook/outline/preview";
|
|
2398
|
+
import po from "storybook/test/preview";
|
|
2399
|
+
import uo from "storybook/viewport/preview";
|
|
2400
|
+
function Pe() {
|
|
2384
2401
|
return [
|
|
2385
2402
|
// @ts-expect-error CJS fallback
|
|
2386
|
-
(
|
|
2403
|
+
(lo.default ?? lo)(),
|
|
2387
2404
|
// @ts-expect-error CJS fallback
|
|
2388
|
-
(
|
|
2405
|
+
(io.default ?? io)(),
|
|
2389
2406
|
// @ts-expect-error CJS fallback
|
|
2390
|
-
(
|
|
2407
|
+
(ao.default ?? ao)(),
|
|
2391
2408
|
// @ts-expect-error CJS fallback
|
|
2392
|
-
(
|
|
2409
|
+
(co.default ?? co)(),
|
|
2393
2410
|
// @ts-expect-error CJS fallback
|
|
2394
|
-
(
|
|
2411
|
+
(uo.default ?? uo)(),
|
|
2395
2412
|
// @ts-expect-error CJS fallback
|
|
2396
|
-
(
|
|
2413
|
+
(so.default ?? so)(),
|
|
2397
2414
|
// @ts-expect-error CJS fallback
|
|
2398
|
-
(
|
|
2415
|
+
(no.default ?? no)(),
|
|
2399
2416
|
// @ts-expect-error CJS fallback
|
|
2400
|
-
(
|
|
2417
|
+
(po.default ?? po)()
|
|
2401
2418
|
];
|
|
2402
2419
|
}
|
|
2403
|
-
n(
|
|
2420
|
+
n(Pe, "getCoreAnnotations");
|
|
2404
2421
|
|
|
2405
2422
|
// src/preview-api/modules/store/args.ts
|
|
2406
|
-
import { once as
|
|
2423
|
+
import { once as jr } from "storybook/internal/client-logger";
|
|
2407
2424
|
|
|
2408
2425
|
// ../node_modules/ts-dedent/esm/index.js
|
|
2409
2426
|
function P(r) {
|
|
@@ -2432,8 +2449,8 @@ function P(r) {
|
|
|
2432
2449
|
var d = a.match(/(?:^|\n)( *)$/), p = d ? d[1] : "", u = l;
|
|
2433
2450
|
typeof l == "string" && l.includes(`
|
|
2434
2451
|
`) && (u = String(l).split(`
|
|
2435
|
-
`).map(function(y,
|
|
2436
|
-
return
|
|
2452
|
+
`).map(function(y, h) {
|
|
2453
|
+
return h === 0 ? y : "" + p + y;
|
|
2437
2454
|
}).join(`
|
|
2438
2455
|
`)), a += u + o[c + 1];
|
|
2439
2456
|
}), a;
|
|
@@ -2441,7 +2458,7 @@ function P(r) {
|
|
|
2441
2458
|
n(P, "dedent");
|
|
2442
2459
|
|
|
2443
2460
|
// src/preview-api/modules/store/args.ts
|
|
2444
|
-
var
|
|
2461
|
+
var ue = Symbol("incompatible"), Mr = /* @__PURE__ */ n((r, e) => {
|
|
2445
2462
|
let t = e.type;
|
|
2446
2463
|
if (r == null || !t || e.mapping)
|
|
2447
2464
|
return r;
|
|
@@ -2455,47 +2472,47 @@ var ye = Symbol("incompatible"), Or = /* @__PURE__ */ n((r, e) => {
|
|
|
2455
2472
|
case "boolean":
|
|
2456
2473
|
return String(r) === "true";
|
|
2457
2474
|
case "array":
|
|
2458
|
-
return !t.value || !Array.isArray(r) ?
|
|
2459
|
-
let a =
|
|
2460
|
-
return a !==
|
|
2475
|
+
return !t.value || !Array.isArray(r) ? ue : r.reduce((o, s, i) => {
|
|
2476
|
+
let a = Mr(s, { type: t.value });
|
|
2477
|
+
return a !== ue && (o[i] = a), o;
|
|
2461
2478
|
}, new Array(r.length));
|
|
2462
2479
|
case "object":
|
|
2463
|
-
return typeof r == "string" || typeof r == "number" ? r : !t.value || typeof r != "object" ?
|
|
2464
|
-
let a =
|
|
2465
|
-
return a ===
|
|
2480
|
+
return typeof r == "string" || typeof r == "number" ? r : !t.value || typeof r != "object" ? ue : Object.entries(r).reduce((o, [s, i]) => {
|
|
2481
|
+
let a = Mr(i, { type: t.value[s] });
|
|
2482
|
+
return a === ue ? o : Object.assign(o, { [s]: a });
|
|
2466
2483
|
}, {});
|
|
2467
2484
|
default:
|
|
2468
|
-
return
|
|
2485
|
+
return ue;
|
|
2469
2486
|
}
|
|
2470
|
-
}, "map"),
|
|
2487
|
+
}, "map"), fo = /* @__PURE__ */ n((r, e) => Object.entries(r).reduce((t, [o, s]) => {
|
|
2471
2488
|
if (!e[o])
|
|
2472
2489
|
return t;
|
|
2473
|
-
let i =
|
|
2474
|
-
return i ===
|
|
2475
|
-
}, {}), "mapArgsToTypes"),
|
|
2476
|
-
(t, o, s) => (t[s] =
|
|
2490
|
+
let i = Mr(s, e[o]);
|
|
2491
|
+
return i === ue ? t : Object.assign(t, { [o]: i });
|
|
2492
|
+
}, {}), "mapArgsToTypes"), Fe = /* @__PURE__ */ n((r, e) => Array.isArray(r) && Array.isArray(e) ? e.reduce(
|
|
2493
|
+
(t, o, s) => (t[s] = Fe(r[s], e[s]), t),
|
|
2477
2494
|
[...r]
|
|
2478
2495
|
).filter((t) => t !== void 0) : !k(r) || !k(e) ? e : Object.keys({ ...r, ...e }).reduce((t, o) => {
|
|
2479
2496
|
if (o in e) {
|
|
2480
|
-
let s =
|
|
2497
|
+
let s = Fe(r[o], e[o]);
|
|
2481
2498
|
s !== void 0 && (t[o] = s);
|
|
2482
2499
|
} else
|
|
2483
2500
|
t[o] = r[o];
|
|
2484
2501
|
return t;
|
|
2485
|
-
}, {}), "combineArgs"),
|
|
2502
|
+
}, {}), "combineArgs"), yo = /* @__PURE__ */ n((r, e) => Object.entries(e).reduce((t, [o, { options: s }]) => {
|
|
2486
2503
|
function i() {
|
|
2487
2504
|
return o in r && (t[o] = r[o]), t;
|
|
2488
2505
|
}
|
|
2489
2506
|
if (n(i, "allowArg"), !s)
|
|
2490
2507
|
return i();
|
|
2491
2508
|
if (!Array.isArray(s))
|
|
2492
|
-
return
|
|
2509
|
+
return jr.error(P`
|
|
2493
2510
|
Invalid argType: '${o}.options' should be an array.
|
|
2494
2511
|
|
|
2495
2512
|
More info: https://storybook.js.org/docs/api/arg-types
|
|
2496
2513
|
`), i();
|
|
2497
2514
|
if (s.some((u) => u && ["object", "function"].includes(typeof u)))
|
|
2498
|
-
return
|
|
2515
|
+
return jr.error(P`
|
|
2499
2516
|
Invalid argType: '${o}.options' should only contain primitives. Use a 'mapping' for complex values.
|
|
2500
2517
|
|
|
2501
2518
|
More info: https://storybook.js.org/docs/writing-stories/args#mapping-to-complex-arg-values
|
|
@@ -2504,49 +2521,46 @@ var ye = Symbol("incompatible"), Or = /* @__PURE__ */ n((r, e) => {
|
|
|
2504
2521
|
if (r[o] === void 0 || s.includes(r[o]) || c)
|
|
2505
2522
|
return i();
|
|
2506
2523
|
let d = a ? `${o}[${l}]` : o, p = s.map((u) => typeof u == "string" ? `'${u}'` : String(u)).join(", ");
|
|
2507
|
-
return
|
|
2508
|
-
}, {}), "validateOptions"),
|
|
2524
|
+
return jr.warn(`Received illegal value for '${d}'. Supported options: ${p}`), t;
|
|
2525
|
+
}, {}), "validateOptions"), te = Symbol("Deeply equal"), fe = /* @__PURE__ */ n((r, e) => {
|
|
2509
2526
|
if (typeof r != typeof e)
|
|
2510
2527
|
return e;
|
|
2511
|
-
if (
|
|
2512
|
-
return
|
|
2528
|
+
if (Or(r, e))
|
|
2529
|
+
return te;
|
|
2513
2530
|
if (Array.isArray(r) && Array.isArray(e)) {
|
|
2514
2531
|
let t = e.reduce((o, s, i) => {
|
|
2515
|
-
let a =
|
|
2516
|
-
return a !==
|
|
2532
|
+
let a = fe(r[i], s);
|
|
2533
|
+
return a !== te && (o[i] = a), o;
|
|
2517
2534
|
}, new Array(e.length));
|
|
2518
2535
|
return e.length >= r.length ? t : t.concat(new Array(r.length - e.length).fill(void 0));
|
|
2519
2536
|
}
|
|
2520
2537
|
return k(r) && k(e) ? Object.keys({ ...r, ...e }).reduce((t, o) => {
|
|
2521
|
-
let s =
|
|
2522
|
-
return s ===
|
|
2538
|
+
let s = fe(r?.[o], e?.[o]);
|
|
2539
|
+
return s === te ? t : Object.assign(t, { [o]: s });
|
|
2523
2540
|
}, {}) : e;
|
|
2524
|
-
}, "deepDiff"),
|
|
2525
|
-
function
|
|
2541
|
+
}, "deepDiff"), _r = "UNTARGETED";
|
|
2542
|
+
function mo({
|
|
2526
2543
|
args: r,
|
|
2527
2544
|
argTypes: e
|
|
2528
2545
|
}) {
|
|
2529
2546
|
let t = {};
|
|
2530
2547
|
return Object.entries(r).forEach(([o, s]) => {
|
|
2531
|
-
let { target: i =
|
|
2548
|
+
let { target: i = _r } = e[o] || {};
|
|
2532
2549
|
t[i] = t[i] || {}, t[i][o] = s;
|
|
2533
2550
|
}), t;
|
|
2534
2551
|
}
|
|
2535
|
-
n(
|
|
2552
|
+
n(mo, "groupArgsByTarget");
|
|
2536
2553
|
|
|
2537
2554
|
// src/preview-api/modules/store/ArgsStore.ts
|
|
2538
|
-
function
|
|
2555
|
+
function xs(r) {
|
|
2539
2556
|
return Object.keys(r).forEach((e) => r[e] === void 0 && delete r[e]), r;
|
|
2540
2557
|
}
|
|
2541
|
-
n(
|
|
2542
|
-
var
|
|
2558
|
+
n(xs, "deleteUndefined");
|
|
2559
|
+
var Lr = class Lr {
|
|
2543
2560
|
constructor() {
|
|
2544
2561
|
this.initialArgsByStoryId = {};
|
|
2545
2562
|
this.argsByStoryId = {};
|
|
2546
2563
|
}
|
|
2547
|
-
static {
|
|
2548
|
-
n(this, "ArgsStore");
|
|
2549
|
-
}
|
|
2550
2564
|
get(e) {
|
|
2551
2565
|
if (!(e in this.argsByStoryId))
|
|
2552
2566
|
throw new Error(`No args known for ${e} -- has it been rendered yet?`);
|
|
@@ -2556,40 +2570,39 @@ var Ve = class {
|
|
|
2556
2570
|
if (!this.initialArgsByStoryId[e.id])
|
|
2557
2571
|
this.initialArgsByStoryId[e.id] = e.initialArgs, this.argsByStoryId[e.id] = e.initialArgs;
|
|
2558
2572
|
else if (this.initialArgsByStoryId[e.id] !== e.initialArgs) {
|
|
2559
|
-
let t =
|
|
2560
|
-
this.initialArgsByStoryId[e.id] = e.initialArgs, this.argsByStoryId[e.id] = e.initialArgs, t !==
|
|
2573
|
+
let t = fe(this.initialArgsByStoryId[e.id], this.argsByStoryId[e.id]);
|
|
2574
|
+
this.initialArgsByStoryId[e.id] = e.initialArgs, this.argsByStoryId[e.id] = e.initialArgs, t !== te && this.updateFromDelta(e, t);
|
|
2561
2575
|
}
|
|
2562
2576
|
}
|
|
2563
2577
|
updateFromDelta(e, t) {
|
|
2564
|
-
let o =
|
|
2565
|
-
this.argsByStoryId[e.id] =
|
|
2578
|
+
let o = yo(t, e.argTypes);
|
|
2579
|
+
this.argsByStoryId[e.id] = Fe(this.argsByStoryId[e.id], o);
|
|
2566
2580
|
}
|
|
2567
2581
|
updateFromPersisted(e, t) {
|
|
2568
|
-
let o =
|
|
2582
|
+
let o = fo(t, e.argTypes);
|
|
2569
2583
|
return this.updateFromDelta(e, o);
|
|
2570
2584
|
}
|
|
2571
2585
|
update(e, t) {
|
|
2572
2586
|
if (!(e in this.argsByStoryId))
|
|
2573
2587
|
throw new Error(`No args known for ${e} -- has it been rendered yet?`);
|
|
2574
|
-
this.argsByStoryId[e] =
|
|
2588
|
+
this.argsByStoryId[e] = xs({
|
|
2575
2589
|
...this.argsByStoryId[e],
|
|
2576
2590
|
...t
|
|
2577
2591
|
});
|
|
2578
2592
|
}
|
|
2579
2593
|
};
|
|
2594
|
+
n(Lr, "ArgsStore");
|
|
2595
|
+
var Ve = Lr;
|
|
2580
2596
|
|
|
2581
2597
|
// src/preview-api/modules/store/GlobalsStore.ts
|
|
2582
|
-
import { logger as
|
|
2598
|
+
import { logger as Rs } from "storybook/internal/client-logger";
|
|
2583
2599
|
|
|
2584
2600
|
// src/preview-api/modules/store/csf/getValuesFromArgTypes.ts
|
|
2585
|
-
var
|
|
2601
|
+
var We = /* @__PURE__ */ n((r = {}) => Object.entries(r).reduce((e, [t, { defaultValue: o }]) => (typeof o < "u" && (e[t] = o), e), {}), "ge\
|
|
2586
2602
|
tValuesFromArgTypes");
|
|
2587
2603
|
|
|
2588
2604
|
// src/preview-api/modules/store/GlobalsStore.ts
|
|
2589
|
-
var
|
|
2590
|
-
static {
|
|
2591
|
-
n(this, "GlobalsStore");
|
|
2592
|
-
}
|
|
2605
|
+
var Nr = class Nr {
|
|
2593
2606
|
constructor({
|
|
2594
2607
|
globals: e = {},
|
|
2595
2608
|
globalTypes: t = {}
|
|
@@ -2597,13 +2610,13 @@ var He = class {
|
|
|
2597
2610
|
this.set({ globals: e, globalTypes: t });
|
|
2598
2611
|
}
|
|
2599
2612
|
set({ globals: e = {}, globalTypes: t = {} }) {
|
|
2600
|
-
let o = this.initialGlobals &&
|
|
2613
|
+
let o = this.initialGlobals && fe(this.initialGlobals, this.globals);
|
|
2601
2614
|
this.allowedGlobalNames = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
|
|
2602
|
-
let s =
|
|
2603
|
-
this.initialGlobals = { ...s, ...e }, this.globals = this.initialGlobals, o && o !==
|
|
2615
|
+
let s = We(t);
|
|
2616
|
+
this.initialGlobals = { ...s, ...e }, this.globals = this.initialGlobals, o && o !== te && this.updateFromPersisted(o);
|
|
2604
2617
|
}
|
|
2605
2618
|
filterAllowedGlobals(e) {
|
|
2606
|
-
return Object.entries(e).reduce((t, [o, s]) => (this.allowedGlobalNames.has(o) ? t[o] = s :
|
|
2619
|
+
return Object.entries(e).reduce((t, [o, s]) => (this.allowedGlobalNames.has(o) ? t[o] = s : Rs.warn(
|
|
2607
2620
|
`Attempted to set a global (${o}) that is not defined in initial globals or globalTypes`
|
|
2608
2621
|
), t), {});
|
|
2609
2622
|
}
|
|
@@ -2616,21 +2629,22 @@ var He = class {
|
|
|
2616
2629
|
}
|
|
2617
2630
|
update(e) {
|
|
2618
2631
|
this.globals = { ...this.globals, ...this.filterAllowedGlobals(e) };
|
|
2632
|
+
for (let t in e)
|
|
2633
|
+
e[t] === void 0 && (this.globals[t] = this.initialGlobals[t]);
|
|
2619
2634
|
}
|
|
2620
2635
|
};
|
|
2636
|
+
n(Nr, "GlobalsStore");
|
|
2637
|
+
var $e = Nr;
|
|
2621
2638
|
|
|
2622
2639
|
// src/preview-api/modules/store/StoryIndexStore.ts
|
|
2623
|
-
var
|
|
2624
|
-
import { MissingStoryAfterHmrError as
|
|
2625
|
-
var
|
|
2640
|
+
var ho = pe(kr(), 1);
|
|
2641
|
+
import { MissingStoryAfterHmrError as ws } from "storybook/internal/preview-errors";
|
|
2642
|
+
var As = (0, ho.default)(1)(
|
|
2626
2643
|
(r) => Object.values(r).reduce(
|
|
2627
2644
|
(e, t) => (e[t.importPath] = e[t.importPath] || t, e),
|
|
2628
2645
|
{}
|
|
2629
2646
|
)
|
|
2630
|
-
),
|
|
2631
|
-
static {
|
|
2632
|
-
n(this, "StoryIndexStore");
|
|
2633
|
-
}
|
|
2647
|
+
), qr = class qr {
|
|
2634
2648
|
constructor({ entries: e } = { v: 5, entries: {} }) {
|
|
2635
2649
|
this.entries = e;
|
|
2636
2650
|
}
|
|
@@ -2646,52 +2660,54 @@ var ns = (0, Kt.default)(1)(
|
|
|
2646
2660
|
storyIdToEntry(e) {
|
|
2647
2661
|
let t = this.entries[e];
|
|
2648
2662
|
if (!t)
|
|
2649
|
-
throw new
|
|
2663
|
+
throw new ws({ storyId: e });
|
|
2650
2664
|
return t;
|
|
2651
2665
|
}
|
|
2652
2666
|
importPathToEntry(e) {
|
|
2653
|
-
return
|
|
2667
|
+
return As(this.entries)[e];
|
|
2654
2668
|
}
|
|
2655
2669
|
};
|
|
2670
|
+
n(qr, "StoryIndexStore");
|
|
2671
|
+
var Ye = qr;
|
|
2656
2672
|
|
|
2657
2673
|
// src/preview-api/modules/store/csf/normalizeInputTypes.ts
|
|
2658
|
-
var
|
|
2659
|
-
g" ? { type: r } : r, "normalizeControl"),
|
|
2674
|
+
var Es = /* @__PURE__ */ n((r) => typeof r == "string" ? { name: r } : r, "normalizeType"), Cs = /* @__PURE__ */ n((r) => typeof r == "strin\
|
|
2675
|
+
g" ? { type: r } : r, "normalizeControl"), vs = /* @__PURE__ */ n((r, e) => {
|
|
2660
2676
|
let { type: t, control: o, ...s } = r, i = {
|
|
2661
2677
|
name: e,
|
|
2662
2678
|
...s
|
|
2663
2679
|
};
|
|
2664
|
-
return t && (i.type =
|
|
2665
|
-
}, "normalizeInputType"),
|
|
2680
|
+
return t && (i.type = Es(t)), o ? i.control = Cs(o) : o === !1 && (i.control = { disable: !0 }), i;
|
|
2681
|
+
}, "normalizeInputType"), oe = /* @__PURE__ */ n((r) => H(r, vs), "normalizeInputTypes");
|
|
2666
2682
|
|
|
2667
2683
|
// src/preview-api/modules/store/csf/normalizeStory.ts
|
|
2668
|
-
import { deprecate as
|
|
2669
|
-
import { storyNameFromExport as
|
|
2684
|
+
import { deprecate as Ps, logger as Fs } from "storybook/internal/client-logger";
|
|
2685
|
+
import { storyNameFromExport as Is, toId as Os } from "storybook/internal/csf";
|
|
2670
2686
|
|
|
2671
2687
|
// src/preview-api/modules/store/csf/normalizeArrays.ts
|
|
2672
2688
|
var v = /* @__PURE__ */ n((r) => Array.isArray(r) ? r : r ? [r] : [], "normalizeArrays");
|
|
2673
2689
|
|
|
2674
2690
|
// src/preview-api/modules/store/csf/normalizeStory.ts
|
|
2675
|
-
var
|
|
2691
|
+
var Ds = P`
|
|
2676
2692
|
CSF .story annotations deprecated; annotate story functions directly:
|
|
2677
2693
|
- StoryFn.story.name => StoryFn.storyName
|
|
2678
2694
|
- StoryFn.story.(parameters|decorators) => StoryFn.(parameters|decorators)
|
|
2679
2695
|
See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#hoisted-csf-annotations for details and codemod.
|
|
2680
2696
|
`;
|
|
2681
|
-
function
|
|
2697
|
+
function ye(r, e, t) {
|
|
2682
2698
|
let o = e, s = typeof e == "function" ? e : null, { story: i } = o;
|
|
2683
|
-
i && (
|
|
2684
|
-
let a =
|
|
2699
|
+
i && (Fs.debug("deprecated story", i), Ps(Ds));
|
|
2700
|
+
let a = Is(r), l = typeof o != "function" && o.name || o.storyName || i?.name || a, c = [
|
|
2685
2701
|
...v(o.decorators),
|
|
2686
2702
|
...v(i?.decorators)
|
|
2687
2703
|
], d = { ...i?.parameters, ...o.parameters }, p = { ...i?.args, ...o.args }, u = { ...i?.argTypes, ...o.argTypes }, y = [...v(o.loaders), ...v(
|
|
2688
|
-
i?.loaders)],
|
|
2704
|
+
i?.loaders)], h = [
|
|
2689
2705
|
...v(o.beforeEach),
|
|
2690
2706
|
...v(i?.beforeEach)
|
|
2691
|
-
],
|
|
2707
|
+
], g = [
|
|
2692
2708
|
...v(o.experimental_afterEach),
|
|
2693
2709
|
...v(i?.experimental_afterEach)
|
|
2694
|
-
], { render: b, play:
|
|
2710
|
+
], { render: b, play: m, tags: T = [], globals: x = {} } = o, f = d.__id || Os(t.id, a);
|
|
2695
2711
|
return {
|
|
2696
2712
|
moduleExport: e,
|
|
2697
2713
|
id: f,
|
|
@@ -2700,107 +2716,107 @@ function he(r, e, t) {
|
|
|
2700
2716
|
decorators: c,
|
|
2701
2717
|
parameters: d,
|
|
2702
2718
|
args: p,
|
|
2703
|
-
argTypes:
|
|
2719
|
+
argTypes: oe(u),
|
|
2704
2720
|
loaders: y,
|
|
2705
|
-
beforeEach:
|
|
2706
|
-
experimental_afterEach:
|
|
2707
|
-
globals:
|
|
2721
|
+
beforeEach: h,
|
|
2722
|
+
experimental_afterEach: g,
|
|
2723
|
+
globals: x,
|
|
2708
2724
|
...b && { render: b },
|
|
2709
2725
|
...s && { userStoryFn: s },
|
|
2710
|
-
...
|
|
2726
|
+
...m && { play: m }
|
|
2711
2727
|
};
|
|
2712
2728
|
}
|
|
2713
|
-
n(
|
|
2729
|
+
n(ye, "normalizeStory");
|
|
2714
2730
|
|
|
2715
2731
|
// src/preview-api/modules/store/csf/processCSFFile.ts
|
|
2716
|
-
import { logger as
|
|
2717
|
-
import { isExportStory as
|
|
2732
|
+
import { logger as bo } from "storybook/internal/client-logger";
|
|
2733
|
+
import { isExportStory as go, isStory as js } from "storybook/internal/csf";
|
|
2718
2734
|
|
|
2719
2735
|
// src/preview-api/modules/store/csf/normalizeComponentAnnotations.ts
|
|
2720
|
-
import { sanitize as
|
|
2721
|
-
function
|
|
2736
|
+
import { sanitize as ks } from "storybook/internal/csf";
|
|
2737
|
+
function Ie(r, e = r.title, t) {
|
|
2722
2738
|
let { id: o, argTypes: s } = r;
|
|
2723
2739
|
return {
|
|
2724
|
-
id:
|
|
2740
|
+
id: ks(o || e),
|
|
2725
2741
|
...r,
|
|
2726
2742
|
title: e,
|
|
2727
|
-
...s && { argTypes:
|
|
2743
|
+
...s && { argTypes: oe(s) },
|
|
2728
2744
|
parameters: {
|
|
2729
2745
|
fileName: t,
|
|
2730
2746
|
...r.parameters
|
|
2731
2747
|
}
|
|
2732
2748
|
};
|
|
2733
2749
|
}
|
|
2734
|
-
n(
|
|
2750
|
+
n(Ie, "normalizeComponentAnnotations");
|
|
2735
2751
|
|
|
2736
2752
|
// src/preview-api/modules/store/csf/processCSFFile.ts
|
|
2737
|
-
var
|
|
2753
|
+
var Ms = /* @__PURE__ */ n((r) => {
|
|
2738
2754
|
let { globals: e, globalTypes: t } = r;
|
|
2739
|
-
(e || t) &&
|
|
2755
|
+
(e || t) && bo.error(
|
|
2740
2756
|
"Global args/argTypes can only be set globally",
|
|
2741
2757
|
JSON.stringify({
|
|
2742
2758
|
globals: e,
|
|
2743
2759
|
globalTypes: t
|
|
2744
2760
|
})
|
|
2745
2761
|
);
|
|
2746
|
-
}, "checkGlobals"),
|
|
2762
|
+
}, "checkGlobals"), _s = /* @__PURE__ */ n((r) => {
|
|
2747
2763
|
let { options: e } = r;
|
|
2748
|
-
e?.storySort &&
|
|
2749
|
-
}, "checkStorySort"),
|
|
2750
|
-
r && (
|
|
2764
|
+
e?.storySort && bo.error("The storySort option parameter can only be set globally");
|
|
2765
|
+
}, "checkStorySort"), Ke = /* @__PURE__ */ n((r) => {
|
|
2766
|
+
r && (Ms(r), _s(r));
|
|
2751
2767
|
}, "checkDisallowedParameters");
|
|
2752
|
-
function
|
|
2768
|
+
function So(r, e, t) {
|
|
2753
2769
|
let { default: o, __namedExportsOrder: s, ...i } = r, a = Object.values(i)[0];
|
|
2754
|
-
if (
|
|
2755
|
-
let d =
|
|
2756
|
-
|
|
2770
|
+
if (js(a)) {
|
|
2771
|
+
let d = Ie(a.meta.input, t, e);
|
|
2772
|
+
Ke(d.parameters);
|
|
2757
2773
|
let p = { meta: d, stories: {}, moduleExports: r };
|
|
2758
2774
|
return Object.keys(i).forEach((u) => {
|
|
2759
|
-
if (
|
|
2760
|
-
let y =
|
|
2761
|
-
|
|
2775
|
+
if (go(u, d)) {
|
|
2776
|
+
let y = ye(u, i[u].input, d);
|
|
2777
|
+
Ke(y.parameters), p.stories[y.id] = y;
|
|
2762
2778
|
}
|
|
2763
2779
|
}), p.projectAnnotations = a.meta.preview.composed, p;
|
|
2764
2780
|
}
|
|
2765
|
-
let l =
|
|
2781
|
+
let l = Ie(
|
|
2766
2782
|
o,
|
|
2767
2783
|
t,
|
|
2768
2784
|
e
|
|
2769
2785
|
);
|
|
2770
|
-
|
|
2786
|
+
Ke(l.parameters);
|
|
2771
2787
|
let c = { meta: l, stories: {}, moduleExports: r };
|
|
2772
2788
|
return Object.keys(i).forEach((d) => {
|
|
2773
|
-
if (
|
|
2774
|
-
let p =
|
|
2775
|
-
|
|
2789
|
+
if (go(d, l)) {
|
|
2790
|
+
let p = ye(d, i[d], l);
|
|
2791
|
+
Ke(p.parameters), c.stories[p.id] = p;
|
|
2776
2792
|
}
|
|
2777
2793
|
}), c;
|
|
2778
2794
|
}
|
|
2779
|
-
n(
|
|
2795
|
+
n(So, "processCSFFile");
|
|
2780
2796
|
|
|
2781
2797
|
// src/preview-api/modules/store/csf/prepareStory.ts
|
|
2782
|
-
import { combineTags as
|
|
2783
|
-
import { NoRenderFunctionError as
|
|
2784
|
-
import { global as
|
|
2785
|
-
import { global as
|
|
2798
|
+
import { combineTags as Ns, includeConditionalArg as qs } from "storybook/internal/csf";
|
|
2799
|
+
import { NoRenderFunctionError as Bs } from "storybook/internal/preview-errors";
|
|
2800
|
+
import { global as zs } from "@storybook/global";
|
|
2801
|
+
import { global as Gs } from "@storybook/global";
|
|
2786
2802
|
|
|
2787
2803
|
// src/preview-api/modules/preview-web/render/mount-utils.ts
|
|
2788
|
-
function
|
|
2789
|
-
return r != null &&
|
|
2804
|
+
function xo(r) {
|
|
2805
|
+
return r != null && Ls(r).includes("mount");
|
|
2790
2806
|
}
|
|
2791
|
-
n(
|
|
2792
|
-
function
|
|
2807
|
+
n(xo, "mountDestructured");
|
|
2808
|
+
function Ls(r) {
|
|
2793
2809
|
let e = r.toString().match(/[^(]*\(([^)]*)/);
|
|
2794
2810
|
if (!e)
|
|
2795
2811
|
return [];
|
|
2796
|
-
let t =
|
|
2812
|
+
let t = To(e[1]);
|
|
2797
2813
|
if (!t.length)
|
|
2798
2814
|
return [];
|
|
2799
2815
|
let o = t[0];
|
|
2800
|
-
return o.startsWith("{") && o.endsWith("}") ?
|
|
2816
|
+
return o.startsWith("{") && o.endsWith("}") ? To(o.slice(1, -1).replace(/\s/g, "")).map((i) => i.replace(/:.*|=.*/g, "")) : [];
|
|
2801
2817
|
}
|
|
2802
|
-
n(
|
|
2803
|
-
function
|
|
2818
|
+
n(Ls, "getUsedProps");
|
|
2819
|
+
function To(r) {
|
|
2804
2820
|
let e = [], t = [], o = 0;
|
|
2805
2821
|
for (let i = 0; i < r.length; i++)
|
|
2806
2822
|
if (r[i] === "{" || r[i] === "[")
|
|
@@ -2814,15 +2830,15 @@ function Zt(r) {
|
|
|
2814
2830
|
let s = r.substring(o).trim();
|
|
2815
2831
|
return s && e.push(s), e;
|
|
2816
2832
|
}
|
|
2817
|
-
n(
|
|
2833
|
+
n(To, "splitByComma");
|
|
2818
2834
|
|
|
2819
2835
|
// src/preview-api/modules/store/decorators.ts
|
|
2820
|
-
function
|
|
2836
|
+
function Ro(r, e, t) {
|
|
2821
2837
|
let o = t(r);
|
|
2822
2838
|
return (s) => e(o, s);
|
|
2823
2839
|
}
|
|
2824
|
-
n(
|
|
2825
|
-
function
|
|
2840
|
+
n(Ro, "decorateStory");
|
|
2841
|
+
function wo({
|
|
2826
2842
|
componentId: r,
|
|
2827
2843
|
title: e,
|
|
2828
2844
|
kind: t,
|
|
@@ -2836,22 +2852,22 @@ function to({
|
|
|
2836
2852
|
} = {}) {
|
|
2837
2853
|
return d;
|
|
2838
2854
|
}
|
|
2839
|
-
n(
|
|
2840
|
-
function
|
|
2855
|
+
n(wo, "sanitizeStoryContextUpdate");
|
|
2856
|
+
function Br(r, e) {
|
|
2841
2857
|
let t = {}, o = /* @__PURE__ */ n((i) => (a) => {
|
|
2842
2858
|
if (!t.value)
|
|
2843
2859
|
throw new Error("Decorated function called without init");
|
|
2844
2860
|
return t.value = {
|
|
2845
2861
|
...t.value,
|
|
2846
|
-
...
|
|
2862
|
+
...wo(a)
|
|
2847
2863
|
}, i(t.value);
|
|
2848
2864
|
}, "bindWithContext"), s = e.reduce(
|
|
2849
|
-
(i, a) =>
|
|
2865
|
+
(i, a) => Ro(i, a, o),
|
|
2850
2866
|
r
|
|
2851
2867
|
);
|
|
2852
2868
|
return (i) => (t.value = i, s(i));
|
|
2853
2869
|
}
|
|
2854
|
-
n(
|
|
2870
|
+
n(Br, "defaultDecorateStory");
|
|
2855
2871
|
|
|
2856
2872
|
// src/preview-api/modules/store/parameters.ts
|
|
2857
2873
|
var L = /* @__PURE__ */ n((...r) => {
|
|
@@ -2866,59 +2882,59 @@ var L = /* @__PURE__ */ n((...r) => {
|
|
|
2866
2882
|
}, "combineParameters");
|
|
2867
2883
|
|
|
2868
2884
|
// src/preview-api/modules/store/csf/prepareStory.ts
|
|
2869
|
-
function
|
|
2870
|
-
let { moduleExport: o, id: s, name: i } = r || {}, a =
|
|
2885
|
+
function Oe(r, e, t) {
|
|
2886
|
+
let { moduleExport: o, id: s, name: i } = r || {}, a = Ao(
|
|
2871
2887
|
r,
|
|
2872
2888
|
e,
|
|
2873
2889
|
t
|
|
2874
|
-
), l = /* @__PURE__ */ n(async (
|
|
2875
|
-
let
|
|
2890
|
+
), l = /* @__PURE__ */ n(async (w) => {
|
|
2891
|
+
let E = {};
|
|
2876
2892
|
for (let F of [
|
|
2877
2893
|
v(t.loaders),
|
|
2878
2894
|
v(e.loaders),
|
|
2879
2895
|
v(r.loaders)
|
|
2880
2896
|
]) {
|
|
2881
|
-
if (
|
|
2882
|
-
return
|
|
2883
|
-
let j = await Promise.all(F.map((N) => N(
|
|
2884
|
-
Object.assign(
|
|
2897
|
+
if (w.abortSignal.aborted)
|
|
2898
|
+
return E;
|
|
2899
|
+
let j = await Promise.all(F.map((N) => N(w)));
|
|
2900
|
+
Object.assign(E, ...j);
|
|
2885
2901
|
}
|
|
2886
|
-
return
|
|
2887
|
-
}, "applyLoaders"), c = /* @__PURE__ */ n(async (
|
|
2888
|
-
let
|
|
2902
|
+
return E;
|
|
2903
|
+
}, "applyLoaders"), c = /* @__PURE__ */ n(async (w) => {
|
|
2904
|
+
let E = new Array();
|
|
2889
2905
|
for (let F of [
|
|
2890
2906
|
...v(t.beforeEach),
|
|
2891
2907
|
...v(e.beforeEach),
|
|
2892
2908
|
...v(r.beforeEach)
|
|
2893
2909
|
]) {
|
|
2894
|
-
if (
|
|
2895
|
-
return
|
|
2896
|
-
let j = await F(
|
|
2897
|
-
j &&
|
|
2910
|
+
if (w.abortSignal.aborted)
|
|
2911
|
+
return E;
|
|
2912
|
+
let j = await F(w);
|
|
2913
|
+
j && E.push(j);
|
|
2898
2914
|
}
|
|
2899
|
-
return
|
|
2900
|
-
}, "applyBeforeEach"), d = /* @__PURE__ */ n(async (
|
|
2901
|
-
let
|
|
2915
|
+
return E;
|
|
2916
|
+
}, "applyBeforeEach"), d = /* @__PURE__ */ n(async (w) => {
|
|
2917
|
+
let E = [
|
|
2902
2918
|
...v(t.experimental_afterEach),
|
|
2903
2919
|
...v(e.experimental_afterEach),
|
|
2904
2920
|
...v(r.experimental_afterEach)
|
|
2905
2921
|
].reverse();
|
|
2906
|
-
for (let F of
|
|
2907
|
-
if (
|
|
2922
|
+
for (let F of E) {
|
|
2923
|
+
if (w.abortSignal.aborted)
|
|
2908
2924
|
return;
|
|
2909
|
-
await F(
|
|
2925
|
+
await F(w);
|
|
2910
2926
|
}
|
|
2911
|
-
}, "applyAfterEach"), p = /* @__PURE__ */ n((
|
|
2912
|
-
|
|
2927
|
+
}, "applyAfterEach"), p = /* @__PURE__ */ n((w) => w.originalStoryFn(w.args, w), "undecoratedStoryFn"), { applyDecorators: u = Br, runStep: y } = t,
|
|
2928
|
+
h = [
|
|
2913
2929
|
...v(r?.decorators),
|
|
2914
2930
|
...v(e?.decorators),
|
|
2915
2931
|
...v(t?.decorators)
|
|
2916
|
-
],
|
|
2917
|
-
play ?? e?.play,
|
|
2918
|
-
if (!
|
|
2919
|
-
throw new
|
|
2920
|
-
let f = /* @__PURE__ */ n((
|
|
2921
|
-
|
|
2932
|
+
], g = r?.userStoryFn || r?.render || e.render || t.render, b = wr(u)(p, h), m = /* @__PURE__ */ n((w) => b(w), "unboundStoryFn"), T = r?.
|
|
2933
|
+
play ?? e?.play, x = xo(T);
|
|
2934
|
+
if (!g && !x)
|
|
2935
|
+
throw new Bs({ id: s });
|
|
2936
|
+
let f = /* @__PURE__ */ n((w) => async () => (await w.renderToCanvas(), w.canvas), "defaultMount"), S = r.mount ?? e.mount ?? t.mount ?? f,
|
|
2937
|
+
R = t.testingLibraryRender;
|
|
2922
2938
|
return {
|
|
2923
2939
|
storyGlobals: {},
|
|
2924
2940
|
...a,
|
|
@@ -2926,30 +2942,30 @@ function Ie(r, e, t) {
|
|
|
2926
2942
|
id: s,
|
|
2927
2943
|
name: i,
|
|
2928
2944
|
story: i,
|
|
2929
|
-
originalStoryFn:
|
|
2945
|
+
originalStoryFn: g,
|
|
2930
2946
|
undecoratedStoryFn: p,
|
|
2931
|
-
unboundStoryFn:
|
|
2947
|
+
unboundStoryFn: m,
|
|
2932
2948
|
applyLoaders: l,
|
|
2933
2949
|
applyBeforeEach: c,
|
|
2934
2950
|
applyAfterEach: d,
|
|
2935
2951
|
playFunction: T,
|
|
2936
2952
|
runStep: y,
|
|
2937
|
-
mount:
|
|
2938
|
-
testingLibraryRender:
|
|
2953
|
+
mount: S,
|
|
2954
|
+
testingLibraryRender: R,
|
|
2939
2955
|
renderToCanvas: t.renderToCanvas,
|
|
2940
|
-
usesMount:
|
|
2956
|
+
usesMount: x
|
|
2941
2957
|
};
|
|
2942
2958
|
}
|
|
2943
|
-
n(
|
|
2944
|
-
function
|
|
2959
|
+
n(Oe, "prepareStory");
|
|
2960
|
+
function zr(r, e, t) {
|
|
2945
2961
|
return {
|
|
2946
|
-
...
|
|
2962
|
+
...Ao(void 0, r, e),
|
|
2947
2963
|
moduleExport: t
|
|
2948
2964
|
};
|
|
2949
2965
|
}
|
|
2950
|
-
n(
|
|
2951
|
-
function
|
|
2952
|
-
let o = ["dev", "test"], s =
|
|
2966
|
+
n(zr, "prepareMeta");
|
|
2967
|
+
function Ao(r, e, t) {
|
|
2968
|
+
let o = ["dev", "test"], s = Gs.DOCS_OPTIONS?.autodocs === !0 ? ["autodocs"] : [], i = Ns(
|
|
2953
2969
|
...o,
|
|
2954
2970
|
...s,
|
|
2955
2971
|
...t.tags ?? [],
|
|
@@ -2994,37 +3010,37 @@ function oo(r, e, t) {
|
|
|
2994
3010
|
storyGlobals: u
|
|
2995
3011
|
};
|
|
2996
3012
|
y.argTypes = l.reduce(
|
|
2997
|
-
(T,
|
|
3013
|
+
(T, x) => x({ ...y, argTypes: T }),
|
|
2998
3014
|
y.argTypes
|
|
2999
3015
|
);
|
|
3000
|
-
let
|
|
3016
|
+
let h = { ...p };
|
|
3001
3017
|
y.initialArgs = [...c].reduce(
|
|
3002
|
-
(T,
|
|
3018
|
+
(T, x) => ({
|
|
3003
3019
|
...T,
|
|
3004
|
-
...
|
|
3020
|
+
...x({
|
|
3005
3021
|
...y,
|
|
3006
3022
|
initialArgs: T
|
|
3007
3023
|
})
|
|
3008
3024
|
}),
|
|
3009
|
-
|
|
3025
|
+
h
|
|
3010
3026
|
);
|
|
3011
|
-
let { name:
|
|
3012
|
-
return
|
|
3027
|
+
let { name: g, story: b, ...m } = y;
|
|
3028
|
+
return m;
|
|
3013
3029
|
}
|
|
3014
|
-
n(
|
|
3015
|
-
function
|
|
3030
|
+
n(Ao, "preparePartialAnnotations");
|
|
3031
|
+
function Xe(r) {
|
|
3016
3032
|
let { args: e } = r, t = {
|
|
3017
3033
|
...r,
|
|
3018
3034
|
allArgs: void 0,
|
|
3019
3035
|
argsByTarget: void 0
|
|
3020
3036
|
};
|
|
3021
|
-
if (
|
|
3022
|
-
let i =
|
|
3037
|
+
if (zs.FEATURES?.argTypeTargetsV7) {
|
|
3038
|
+
let i = mo(r);
|
|
3023
3039
|
t = {
|
|
3024
3040
|
...r,
|
|
3025
3041
|
allArgs: r.args,
|
|
3026
3042
|
argsByTarget: i,
|
|
3027
|
-
args: i[
|
|
3043
|
+
args: i[_r] || {}
|
|
3028
3044
|
};
|
|
3029
3045
|
}
|
|
3030
3046
|
let o = Object.entries(t.args).reduce((i, [a, l]) => {
|
|
@@ -3037,15 +3053,15 @@ function Ye(r) {
|
|
|
3037
3053
|
return i[a] = Array.isArray(l) ? l.map(c) : c(l), i;
|
|
3038
3054
|
}, {}), s = Object.entries(o).reduce((i, [a, l]) => {
|
|
3039
3055
|
let c = t.argTypes[a] || {};
|
|
3040
|
-
return
|
|
3056
|
+
return qs(c, o, t.globals) && (i[a] = l), i;
|
|
3041
3057
|
}, {});
|
|
3042
3058
|
return { ...t, unmappedArgs: e, args: s };
|
|
3043
3059
|
}
|
|
3044
|
-
n(
|
|
3060
|
+
n(Xe, "prepareContext");
|
|
3045
3061
|
|
|
3046
3062
|
// src/preview-api/modules/store/inferArgTypes.ts
|
|
3047
|
-
import { logger as
|
|
3048
|
-
var
|
|
3063
|
+
import { logger as Us } from "storybook/internal/client-logger";
|
|
3064
|
+
var Gr = /* @__PURE__ */ n((r, e, t) => {
|
|
3049
3065
|
let o = typeof r;
|
|
3050
3066
|
switch (o) {
|
|
3051
3067
|
case "boolean":
|
|
@@ -3057,44 +3073,44 @@ var Mr = /* @__PURE__ */ n((r, e, t) => {
|
|
|
3057
3073
|
default:
|
|
3058
3074
|
break;
|
|
3059
3075
|
}
|
|
3060
|
-
return r ? t.has(r) ? (
|
|
3076
|
+
return r ? t.has(r) ? (Us.warn(P`
|
|
3061
3077
|
We've detected a cycle in arg '${e}'. Args should be JSON-serializable.
|
|
3062
3078
|
|
|
3063
3079
|
Consider using the mapping feature or fully custom args:
|
|
3064
3080
|
- Mapping: https://storybook.js.org/docs/writing-stories/args#mapping-to-complex-arg-values
|
|
3065
3081
|
- Custom args: https://storybook.js.org/docs/essentials/controls#fully-custom-args
|
|
3066
|
-
`), { name: "other", value: "cyclic object" }) : (t.add(r), Array.isArray(r) ? { name: "array", value: r.length > 0 ?
|
|
3067
|
-
t)) : { name: "other", value: "unknown" } } : { name: "object", value:
|
|
3068
|
-
}, "inferType"),
|
|
3069
|
-
let { id: e, argTypes: t = {}, initialArgs: o = {} } = r, s =
|
|
3082
|
+
`), { name: "other", value: "cyclic object" }) : (t.add(r), Array.isArray(r) ? { name: "array", value: r.length > 0 ? Gr(r[0], e, new Set(
|
|
3083
|
+
t)) : { name: "other", value: "unknown" } } : { name: "object", value: H(r, (i) => Gr(i, e, new Set(t))) }) : { name: "object", value: {} };
|
|
3084
|
+
}, "inferType"), Ur = /* @__PURE__ */ n((r) => {
|
|
3085
|
+
let { id: e, argTypes: t = {}, initialArgs: o = {} } = r, s = H(o, (a, l) => ({
|
|
3070
3086
|
name: l,
|
|
3071
|
-
type:
|
|
3072
|
-
})), i =
|
|
3087
|
+
type: Gr(a, `${e}.${l}`, /* @__PURE__ */ new Set())
|
|
3088
|
+
})), i = H(t, (a, l) => ({
|
|
3073
3089
|
name: l
|
|
3074
3090
|
}));
|
|
3075
3091
|
return L(s, i, t);
|
|
3076
3092
|
}, "inferArgTypes");
|
|
3077
|
-
|
|
3093
|
+
Ur.secondPass = !0;
|
|
3078
3094
|
|
|
3079
3095
|
// src/preview-api/modules/store/inferControls.ts
|
|
3080
|
-
import { logger as
|
|
3096
|
+
import { logger as Hs } from "storybook/internal/client-logger";
|
|
3081
3097
|
|
|
3082
3098
|
// src/preview-api/modules/store/filterArgTypes.ts
|
|
3083
|
-
var
|
|
3084
|
-
r : r &&
|
|
3099
|
+
var Eo = /* @__PURE__ */ n((r, e) => Array.isArray(e) ? e.includes(r) : r.match(e), "matches"), Je = /* @__PURE__ */ n((r, e, t) => !e && !t ?
|
|
3100
|
+
r : r && Ir(r, (o, s) => {
|
|
3085
3101
|
let i = o.name || s.toString();
|
|
3086
|
-
return !!(!e ||
|
|
3102
|
+
return !!(!e || Eo(i, e)) && (!t || !Eo(i, t));
|
|
3087
3103
|
}), "filterArgTypes");
|
|
3088
3104
|
|
|
3089
3105
|
// src/preview-api/modules/store/inferControls.ts
|
|
3090
|
-
var
|
|
3106
|
+
var Vs = /* @__PURE__ */ n((r, e, t) => {
|
|
3091
3107
|
let { type: o, options: s } = r;
|
|
3092
3108
|
if (o) {
|
|
3093
3109
|
if (t.color && t.color.test(e)) {
|
|
3094
3110
|
let i = o.name;
|
|
3095
3111
|
if (i === "string")
|
|
3096
3112
|
return { control: { type: "color" } };
|
|
3097
|
-
i !== "enum" &&
|
|
3113
|
+
i !== "enum" && Hs.warn(
|
|
3098
3114
|
`Addon controls: Control of type color only supports string, received "${i}" instead`
|
|
3099
3115
|
);
|
|
3100
3116
|
}
|
|
@@ -3120,20 +3136,20 @@ var As = /* @__PURE__ */ n((r, e, t) => {
|
|
|
3120
3136
|
return { control: { type: s ? "select" : "object" } };
|
|
3121
3137
|
}
|
|
3122
3138
|
}
|
|
3123
|
-
}, "inferControl"),
|
|
3139
|
+
}, "inferControl"), De = /* @__PURE__ */ n((r) => {
|
|
3124
3140
|
let {
|
|
3125
3141
|
argTypes: e,
|
|
3126
3142
|
parameters: { __isArgsStory: t, controls: { include: o = null, exclude: s = null, matchers: i = {} } = {} }
|
|
3127
3143
|
} = r;
|
|
3128
3144
|
if (!t)
|
|
3129
3145
|
return e;
|
|
3130
|
-
let a =
|
|
3146
|
+
let a = Je(e, o, s), l = H(a, (c, d) => c?.type && Vs(c, d.toString(), i));
|
|
3131
3147
|
return L(l, a);
|
|
3132
3148
|
}, "inferControls");
|
|
3133
|
-
|
|
3149
|
+
De.secondPass = !0;
|
|
3134
3150
|
|
|
3135
3151
|
// src/preview-api/modules/store/csf/normalizeProjectAnnotations.ts
|
|
3136
|
-
function
|
|
3152
|
+
function me({
|
|
3137
3153
|
argTypes: r,
|
|
3138
3154
|
globalTypes: e,
|
|
3139
3155
|
argTypesEnhancers: t,
|
|
@@ -3145,15 +3161,15 @@ function ge({
|
|
|
3145
3161
|
...c
|
|
3146
3162
|
}) {
|
|
3147
3163
|
return {
|
|
3148
|
-
...r && { argTypes:
|
|
3149
|
-
...e && { globalTypes:
|
|
3164
|
+
...r && { argTypes: oe(r) },
|
|
3165
|
+
...e && { globalTypes: oe(e) },
|
|
3150
3166
|
decorators: v(o),
|
|
3151
3167
|
loaders: v(s),
|
|
3152
3168
|
beforeEach: v(i),
|
|
3153
3169
|
experimental_afterEach: v(a),
|
|
3154
3170
|
argTypesEnhancers: [
|
|
3155
3171
|
...t || [],
|
|
3156
|
-
|
|
3172
|
+
Ur,
|
|
3157
3173
|
// There's an architectural decision to be made regarding embedded addons in core:
|
|
3158
3174
|
//
|
|
3159
3175
|
// Option 1: Keep embedded addons but ensure consistency by moving addon-specific code
|
|
@@ -3169,19 +3185,19 @@ function ge({
|
|
|
3169
3185
|
// currently rely on this behavior.
|
|
3170
3186
|
//
|
|
3171
3187
|
// TODO: Make an architectural decision on the handling of core addons
|
|
3172
|
-
|
|
3188
|
+
De
|
|
3173
3189
|
],
|
|
3174
3190
|
initialGlobals: l,
|
|
3175
3191
|
...c
|
|
3176
3192
|
};
|
|
3177
3193
|
}
|
|
3178
|
-
n(
|
|
3194
|
+
n(me, "normalizeProjectAnnotations");
|
|
3179
3195
|
|
|
3180
3196
|
// src/preview-api/modules/store/csf/composeConfigs.ts
|
|
3181
|
-
import { global as
|
|
3197
|
+
import { global as Ws } from "@storybook/global";
|
|
3182
3198
|
|
|
3183
3199
|
// src/preview-api/modules/store/csf/beforeAll.ts
|
|
3184
|
-
var
|
|
3200
|
+
var Co = /* @__PURE__ */ n((r) => async () => {
|
|
3185
3201
|
let e = [];
|
|
3186
3202
|
for (let t of r) {
|
|
3187
3203
|
let o = await t();
|
|
@@ -3194,7 +3210,7 @@ var so = /* @__PURE__ */ n((r) => async () => {
|
|
|
3194
3210
|
}, "composeBeforeAllHooks");
|
|
3195
3211
|
|
|
3196
3212
|
// src/preview-api/modules/store/csf/stepRunners.ts
|
|
3197
|
-
function
|
|
3213
|
+
function Hr(r) {
|
|
3198
3214
|
return async (e, t, o) => {
|
|
3199
3215
|
await r.reduceRight(
|
|
3200
3216
|
(i, a) => async () => a(e, i, o),
|
|
@@ -3202,137 +3218,137 @@ function Lr(r) {
|
|
|
3202
3218
|
)();
|
|
3203
3219
|
};
|
|
3204
3220
|
}
|
|
3205
|
-
n(
|
|
3221
|
+
n(Hr, "composeStepRunners");
|
|
3206
3222
|
|
|
3207
3223
|
// src/preview-api/modules/store/csf/composeConfigs.ts
|
|
3208
|
-
function
|
|
3224
|
+
function je(r, e) {
|
|
3209
3225
|
return r.map((t) => t.default?.[e] ?? t[e]).filter(Boolean);
|
|
3210
3226
|
}
|
|
3211
|
-
n(
|
|
3212
|
-
function
|
|
3213
|
-
return
|
|
3227
|
+
n(je, "getField");
|
|
3228
|
+
function $(r, e, t = {}) {
|
|
3229
|
+
return je(r, e).reduce((o, s) => {
|
|
3214
3230
|
let i = v(s);
|
|
3215
3231
|
return t.reverseFileOrder ? [...i, ...o] : [...o, ...i];
|
|
3216
3232
|
}, []);
|
|
3217
3233
|
}
|
|
3218
|
-
n(
|
|
3219
|
-
function
|
|
3220
|
-
return Object.assign({}, ...
|
|
3234
|
+
n($, "getArrayField");
|
|
3235
|
+
function Qe(r, e) {
|
|
3236
|
+
return Object.assign({}, ...je(r, e));
|
|
3221
3237
|
}
|
|
3222
|
-
n(
|
|
3223
|
-
function
|
|
3224
|
-
return
|
|
3238
|
+
n(Qe, "getObjectField");
|
|
3239
|
+
function ke(r, e) {
|
|
3240
|
+
return je(r, e).pop();
|
|
3225
3241
|
}
|
|
3226
|
-
n(
|
|
3227
|
-
function
|
|
3228
|
-
let e =
|
|
3242
|
+
n(ke, "getSingletonField");
|
|
3243
|
+
function Y(r) {
|
|
3244
|
+
let e = $(r, "argTypesEnhancers"), t = je(r, "runStep"), o = $(r, "beforeAll");
|
|
3229
3245
|
return {
|
|
3230
|
-
parameters: L(...
|
|
3231
|
-
decorators:
|
|
3232
|
-
reverseFileOrder: !(
|
|
3246
|
+
parameters: L(...je(r, "parameters")),
|
|
3247
|
+
decorators: $(r, "decorators", {
|
|
3248
|
+
reverseFileOrder: !(Ws.FEATURES?.legacyDecoratorFileOrder ?? !1)
|
|
3233
3249
|
}),
|
|
3234
|
-
args:
|
|
3235
|
-
argsEnhancers:
|
|
3236
|
-
argTypes:
|
|
3250
|
+
args: Qe(r, "args"),
|
|
3251
|
+
argsEnhancers: $(r, "argsEnhancers"),
|
|
3252
|
+
argTypes: Qe(r, "argTypes"),
|
|
3237
3253
|
argTypesEnhancers: [
|
|
3238
|
-
...
|
|
3239
|
-
...
|
|
3254
|
+
...e.filter((s) => !s.secondPass),
|
|
3255
|
+
...e.filter((s) => s.secondPass)
|
|
3240
3256
|
],
|
|
3241
|
-
initialGlobals:
|
|
3242
|
-
globalTypes:
|
|
3243
|
-
loaders:
|
|
3244
|
-
beforeAll:
|
|
3245
|
-
beforeEach:
|
|
3246
|
-
experimental_afterEach:
|
|
3247
|
-
render:
|
|
3248
|
-
renderToCanvas:
|
|
3249
|
-
applyDecorators:
|
|
3250
|
-
runStep:
|
|
3251
|
-
tags:
|
|
3252
|
-
mount:
|
|
3253
|
-
testingLibraryRender:
|
|
3257
|
+
initialGlobals: Qe(r, "initialGlobals"),
|
|
3258
|
+
globalTypes: Qe(r, "globalTypes"),
|
|
3259
|
+
loaders: $(r, "loaders"),
|
|
3260
|
+
beforeAll: Co(o),
|
|
3261
|
+
beforeEach: $(r, "beforeEach"),
|
|
3262
|
+
experimental_afterEach: $(r, "experimental_afterEach"),
|
|
3263
|
+
render: ke(r, "render"),
|
|
3264
|
+
renderToCanvas: ke(r, "renderToCanvas"),
|
|
3265
|
+
applyDecorators: ke(r, "applyDecorators"),
|
|
3266
|
+
runStep: Hr(t),
|
|
3267
|
+
tags: $(r, "tags"),
|
|
3268
|
+
mount: ke(r, "mount"),
|
|
3269
|
+
testingLibraryRender: ke(r, "testingLibraryRender")
|
|
3254
3270
|
};
|
|
3255
3271
|
}
|
|
3256
|
-
n(
|
|
3272
|
+
n(Y, "composeConfigs");
|
|
3257
3273
|
|
|
3258
3274
|
// src/preview-api/modules/store/csf/portable-stories.ts
|
|
3259
|
-
import { isExportStory as
|
|
3260
|
-
import { MountMustBeDestructuredError as
|
|
3275
|
+
import { isExportStory as Ys } from "storybook/internal/csf";
|
|
3276
|
+
import { MountMustBeDestructuredError as Ks } from "storybook/internal/preview-errors";
|
|
3261
3277
|
|
|
3262
3278
|
// src/preview-api/modules/store/reporter-api.ts
|
|
3263
|
-
var
|
|
3279
|
+
var Vr = class Vr {
|
|
3264
3280
|
constructor() {
|
|
3265
3281
|
this.reports = [];
|
|
3266
3282
|
}
|
|
3267
|
-
static {
|
|
3268
|
-
n(this, "ReporterAPI");
|
|
3269
|
-
}
|
|
3270
3283
|
async addReport(e) {
|
|
3271
3284
|
this.reports.push(e);
|
|
3272
3285
|
}
|
|
3273
3286
|
};
|
|
3287
|
+
n(Vr, "ReporterAPI");
|
|
3288
|
+
var ne = Vr;
|
|
3274
3289
|
|
|
3275
3290
|
// src/preview-api/modules/store/csf/csf-factory-utils.ts
|
|
3276
|
-
import { isStory as
|
|
3277
|
-
function
|
|
3278
|
-
return
|
|
3291
|
+
import { isStory as $s } from "storybook/internal/csf";
|
|
3292
|
+
function Wr(r, e, t) {
|
|
3293
|
+
return $s(r) ? {
|
|
3279
3294
|
story: r.input,
|
|
3280
3295
|
meta: r.meta.input,
|
|
3281
3296
|
preview: r.meta.preview.composed
|
|
3282
3297
|
} : { story: r, meta: e, preview: t };
|
|
3283
3298
|
}
|
|
3284
|
-
n(
|
|
3299
|
+
n(Wr, "getCsfFactoryAnnotations");
|
|
3285
3300
|
|
|
3286
3301
|
// src/preview-api/modules/store/csf/portable-stories.ts
|
|
3287
|
-
function
|
|
3302
|
+
function Xs(r) {
|
|
3288
3303
|
globalThis.defaultProjectAnnotations = r;
|
|
3289
3304
|
}
|
|
3290
|
-
n(
|
|
3291
|
-
var
|
|
3292
|
-
function
|
|
3293
|
-
return r ?
|
|
3305
|
+
n(Xs, "setDefaultProjectAnnotations");
|
|
3306
|
+
var Js = "ComposedStory", Qs = "Unnamed Story";
|
|
3307
|
+
function Zs(r) {
|
|
3308
|
+
return r ? Y([r]) : {};
|
|
3294
3309
|
}
|
|
3295
|
-
n(
|
|
3296
|
-
function
|
|
3310
|
+
n(Zs, "extractAnnotation");
|
|
3311
|
+
function ei(r) {
|
|
3297
3312
|
let e = Array.isArray(r) ? r : [r];
|
|
3298
|
-
return globalThis.globalProjectAnnotations =
|
|
3313
|
+
return globalThis.globalProjectAnnotations = Y([
|
|
3314
|
+
...Pe(),
|
|
3299
3315
|
globalThis.defaultProjectAnnotations ?? {},
|
|
3300
|
-
|
|
3316
|
+
Y(e.map(Zs))
|
|
3301
3317
|
]), globalThis.globalProjectAnnotations ?? {};
|
|
3302
3318
|
}
|
|
3303
|
-
n(
|
|
3304
|
-
var
|
|
3305
|
-
function
|
|
3319
|
+
n(ei, "setProjectAnnotations");
|
|
3320
|
+
var K = [];
|
|
3321
|
+
function vo(r, e, t, o, s) {
|
|
3306
3322
|
if (r === void 0)
|
|
3307
3323
|
throw new Error("Expected a story but received undefined.");
|
|
3308
|
-
e.title = e.title ??
|
|
3309
|
-
let i =
|
|
3324
|
+
e.title = e.title ?? Js;
|
|
3325
|
+
let i = Ie(e), a = s || r.storyName || r.story?.name || r.name || Qs, l = ye(
|
|
3310
3326
|
a,
|
|
3311
3327
|
r,
|
|
3312
3328
|
i
|
|
3313
|
-
), c =
|
|
3314
|
-
|
|
3315
|
-
...oe(),
|
|
3329
|
+
), c = me(
|
|
3330
|
+
Y([
|
|
3316
3331
|
o ?? globalThis.globalProjectAnnotations ?? {},
|
|
3317
3332
|
t ?? {}
|
|
3318
3333
|
])
|
|
3319
|
-
), d =
|
|
3334
|
+
), d = Oe(
|
|
3320
3335
|
l,
|
|
3321
3336
|
i,
|
|
3322
3337
|
c
|
|
3323
|
-
),
|
|
3338
|
+
), u = {
|
|
3339
|
+
...We(c.globalTypes),
|
|
3324
3340
|
...c.initialGlobals,
|
|
3325
3341
|
...d.storyGlobals
|
|
3326
|
-
},
|
|
3327
|
-
let
|
|
3328
|
-
hooks: new
|
|
3329
|
-
globals:
|
|
3342
|
+
}, y = new ne(), h = /* @__PURE__ */ n(() => {
|
|
3343
|
+
let f = Xe({
|
|
3344
|
+
hooks: new re(),
|
|
3345
|
+
globals: u,
|
|
3330
3346
|
args: { ...d.initialArgs },
|
|
3331
3347
|
viewMode: "story",
|
|
3332
|
-
reporting:
|
|
3348
|
+
reporting: y,
|
|
3333
3349
|
loaded: {},
|
|
3334
3350
|
abortSignal: new AbortController().signal,
|
|
3335
|
-
step: /* @__PURE__ */ n((
|
|
3351
|
+
step: /* @__PURE__ */ n((S, R) => d.runStep(S, R, f), "step"),
|
|
3336
3352
|
canvasElement: null,
|
|
3337
3353
|
canvas: {},
|
|
3338
3354
|
userEvent: {},
|
|
@@ -3341,8 +3357,8 @@ function io(r, e, t, o, s) {
|
|
|
3341
3357
|
context: null,
|
|
3342
3358
|
mount: null
|
|
3343
3359
|
});
|
|
3344
|
-
return
|
|
3345
|
-
let
|
|
3360
|
+
return f.parameters.__isPortableStory = !0, f.context = f, d.renderToCanvas && (f.renderToCanvas = async () => {
|
|
3361
|
+
let S = await d.renderToCanvas?.(
|
|
3346
3362
|
{
|
|
3347
3363
|
componentId: d.componentId,
|
|
3348
3364
|
title: d.title,
|
|
@@ -3351,74 +3367,74 @@ function io(r, e, t, o, s) {
|
|
|
3351
3367
|
tags: d.tags,
|
|
3352
3368
|
showMain: /* @__PURE__ */ n(() => {
|
|
3353
3369
|
}, "showMain"),
|
|
3354
|
-
showError: /* @__PURE__ */ n((
|
|
3355
|
-
throw new Error(`${
|
|
3356
|
-
${
|
|
3370
|
+
showError: /* @__PURE__ */ n((R) => {
|
|
3371
|
+
throw new Error(`${R.title}
|
|
3372
|
+
${R.description}`);
|
|
3357
3373
|
}, "showError"),
|
|
3358
|
-
showException: /* @__PURE__ */ n((
|
|
3359
|
-
throw
|
|
3374
|
+
showException: /* @__PURE__ */ n((R) => {
|
|
3375
|
+
throw R;
|
|
3360
3376
|
}, "showException"),
|
|
3361
3377
|
forceRemount: !0,
|
|
3362
|
-
storyContext:
|
|
3363
|
-
storyFn: /* @__PURE__ */ n(() => d.unboundStoryFn(
|
|
3378
|
+
storyContext: f,
|
|
3379
|
+
storyFn: /* @__PURE__ */ n(() => d.unboundStoryFn(f), "storyFn"),
|
|
3364
3380
|
unboundStoryFn: d.unboundStoryFn
|
|
3365
3381
|
},
|
|
3366
|
-
|
|
3382
|
+
f.canvasElement
|
|
3367
3383
|
);
|
|
3368
|
-
|
|
3369
|
-
}),
|
|
3370
|
-
}, "initializeContext"), g,
|
|
3371
|
-
let
|
|
3372
|
-
return
|
|
3373
|
-
}, "play"),
|
|
3374
|
-
let
|
|
3375
|
-
return Object.assign(
|
|
3376
|
-
}, "run"),
|
|
3384
|
+
S && K.push(S);
|
|
3385
|
+
}), f.mount = d.mount(f), f;
|
|
3386
|
+
}, "initializeContext"), g, b = /* @__PURE__ */ n(async (f) => {
|
|
3387
|
+
let S = h();
|
|
3388
|
+
return S.canvasElement ??= globalThis?.document?.body, g && (S.loaded = g.loaded), Object.assign(S, f), d.playFunction(S);
|
|
3389
|
+
}, "play"), m = /* @__PURE__ */ n((f) => {
|
|
3390
|
+
let S = h();
|
|
3391
|
+
return Object.assign(S, f), ni(d, S);
|
|
3392
|
+
}, "run"), T = d.playFunction ? b : void 0;
|
|
3377
3393
|
return Object.assign(
|
|
3378
|
-
/* @__PURE__ */ n(function(
|
|
3379
|
-
let
|
|
3380
|
-
return g && (
|
|
3381
|
-
...
|
|
3382
|
-
...
|
|
3383
|
-
}, d.unboundStoryFn(
|
|
3394
|
+
/* @__PURE__ */ n(function(S) {
|
|
3395
|
+
let R = h();
|
|
3396
|
+
return g && (R.loaded = g.loaded), R.args = {
|
|
3397
|
+
...R.initialArgs,
|
|
3398
|
+
...S
|
|
3399
|
+
}, d.unboundStoryFn(R);
|
|
3384
3400
|
}, "storyFn"),
|
|
3385
3401
|
{
|
|
3386
3402
|
id: d.id,
|
|
3387
3403
|
storyName: a,
|
|
3388
3404
|
load: /* @__PURE__ */ n(async () => {
|
|
3389
|
-
for (let
|
|
3390
|
-
await
|
|
3391
|
-
|
|
3392
|
-
let
|
|
3393
|
-
|
|
3405
|
+
for (let S of [...K].reverse())
|
|
3406
|
+
await S();
|
|
3407
|
+
K.length = 0;
|
|
3408
|
+
let f = h();
|
|
3409
|
+
f.loaded = await d.applyLoaders(f), K.push(...(await d.applyBeforeEach(f)).filter(Boolean)), g = f;
|
|
3394
3410
|
}, "load"),
|
|
3395
|
-
globals:
|
|
3411
|
+
globals: u,
|
|
3396
3412
|
args: d.initialArgs,
|
|
3397
3413
|
parameters: d.parameters,
|
|
3398
3414
|
argTypes: d.argTypes,
|
|
3399
|
-
play:
|
|
3400
|
-
run:
|
|
3401
|
-
reporting:
|
|
3415
|
+
play: T,
|
|
3416
|
+
run: m,
|
|
3417
|
+
reporting: y,
|
|
3402
3418
|
tags: d.tags
|
|
3403
3419
|
}
|
|
3404
3420
|
);
|
|
3405
3421
|
}
|
|
3406
|
-
n(
|
|
3407
|
-
var
|
|
3408
|
-
function
|
|
3422
|
+
n(vo, "composeStory");
|
|
3423
|
+
var ri = /* @__PURE__ */ n((r, e, t, o) => vo(r, e, t, {}, o), "defaultComposeStory");
|
|
3424
|
+
function ti(r, e, t = ri) {
|
|
3409
3425
|
let { default: o, __esModule: s, __namedExportsOrder: i, ...a } = r, l = o;
|
|
3410
3426
|
return Object.entries(a).reduce(
|
|
3411
3427
|
(d, [p, u]) => {
|
|
3412
|
-
let { story: y, meta:
|
|
3413
|
-
return !l &&
|
|
3428
|
+
let { story: y, meta: h } = Wr(u);
|
|
3429
|
+
return !l && h && (l = h), Ys(p, l) ? Object.assign(d, {
|
|
3414
3430
|
[p]: t(y, l, e, p)
|
|
3415
3431
|
}) : d;
|
|
3416
3432
|
},
|
|
3417
3433
|
{}
|
|
3418
3434
|
);
|
|
3419
3435
|
}
|
|
3420
|
-
n(
|
|
3421
|
-
function
|
|
3436
|
+
n(ti, "composeStories");
|
|
3437
|
+
function oi(r) {
|
|
3422
3438
|
return r.extend({
|
|
3423
3439
|
mount: /* @__PURE__ */ n(async ({ mount: e, page: t }, o) => {
|
|
3424
3440
|
await o(async (s, ...i) => {
|
|
@@ -3448,42 +3464,39 @@ function Ls(r) {
|
|
|
3448
3464
|
}, "mount")
|
|
3449
3465
|
});
|
|
3450
3466
|
}
|
|
3451
|
-
n(
|
|
3452
|
-
async function
|
|
3453
|
-
for (let s of [...
|
|
3467
|
+
n(oi, "createPlaywrightTest");
|
|
3468
|
+
async function ni(r, e) {
|
|
3469
|
+
for (let s of [...K].reverse())
|
|
3454
3470
|
await s();
|
|
3455
|
-
if (
|
|
3471
|
+
if (K.length = 0, !e.canvasElement) {
|
|
3456
3472
|
let s = document.createElement("div");
|
|
3457
|
-
globalThis?.document?.body?.appendChild(s), e.canvasElement = s,
|
|
3473
|
+
globalThis?.document?.body?.appendChild(s), e.canvasElement = s, K.push(() => {
|
|
3458
3474
|
globalThis?.document?.body?.contains(s) && globalThis?.document?.body?.removeChild(s);
|
|
3459
3475
|
});
|
|
3460
3476
|
}
|
|
3461
3477
|
if (e.loaded = await r.applyLoaders(e), e.abortSignal.aborted)
|
|
3462
3478
|
return;
|
|
3463
|
-
|
|
3479
|
+
K.push(...(await r.applyBeforeEach(e)).filter(Boolean));
|
|
3464
3480
|
let t = r.playFunction, o = r.usesMount;
|
|
3465
3481
|
o || await e.mount(), !e.abortSignal.aborted && (t && (o || (e.mount = async () => {
|
|
3466
|
-
throw new
|
|
3482
|
+
throw new Ks({ playFunction: t.toString() });
|
|
3467
3483
|
}), await t(e)), await r.applyAfterEach(e));
|
|
3468
3484
|
}
|
|
3469
|
-
n(
|
|
3485
|
+
n(ni, "runStory");
|
|
3470
3486
|
|
|
3471
3487
|
// src/preview-api/modules/store/StoryStore.ts
|
|
3472
|
-
var
|
|
3488
|
+
var Po = 1e3, ai = 1e4, $r = class $r {
|
|
3473
3489
|
constructor(e, t, o) {
|
|
3474
3490
|
this.importFn = t;
|
|
3475
|
-
this.storyIndex = new
|
|
3476
|
-
|
|
3491
|
+
this.storyIndex = new Ye(e), this.projectAnnotations = me(
|
|
3492
|
+
Y([...Pe(), o])
|
|
3477
3493
|
);
|
|
3478
3494
|
let { initialGlobals: s, globalTypes: i } = this.projectAnnotations;
|
|
3479
|
-
this.args = new Ve(), this.userGlobals = new
|
|
3480
|
-
(0,
|
|
3481
|
-
}
|
|
3482
|
-
static {
|
|
3483
|
-
n(this, "StoryStore");
|
|
3495
|
+
this.args = new Ve(), this.userGlobals = new $e({ globals: s, globalTypes: i }), this.hooks = {}, this.cleanupCallbacks = {}, this.processCSFFileWithCache =
|
|
3496
|
+
(0, Ze.default)(Po)(So), this.prepareMetaWithCache = (0, Ze.default)(Po)(zr), this.prepareStoryWithCache = (0, Ze.default)(ai)(Oe);
|
|
3484
3497
|
}
|
|
3485
3498
|
setProjectAnnotations(e) {
|
|
3486
|
-
this.projectAnnotations =
|
|
3499
|
+
this.projectAnnotations = me(e);
|
|
3487
3500
|
let { initialGlobals: t, globalTypes: o } = e;
|
|
3488
3501
|
this.userGlobals.set({ globals: t, globalTypes: o });
|
|
3489
3502
|
}
|
|
@@ -3544,13 +3557,13 @@ var ao = 1e3, Bs = 1e4, be = class {
|
|
|
3544
3557
|
}) {
|
|
3545
3558
|
let o = t.stories[e];
|
|
3546
3559
|
if (!o)
|
|
3547
|
-
throw new
|
|
3560
|
+
throw new ii({ storyId: e });
|
|
3548
3561
|
let s = t.meta, i = this.prepareStoryWithCache(
|
|
3549
3562
|
o,
|
|
3550
3563
|
s,
|
|
3551
3564
|
t.projectAnnotations ?? this.projectAnnotations
|
|
3552
3565
|
);
|
|
3553
|
-
return this.args.setInitial(i), this.hooks[i.id] = this.hooks[i.id] || new
|
|
3566
|
+
return this.args.setInitial(i), this.hooks[i.id] = this.hooks[i.id] || new re(), i;
|
|
3554
3567
|
}
|
|
3555
3568
|
// If we have a CSF file we can get all the stories from it synchronously
|
|
3556
3569
|
componentStoriesFromCSFFile({
|
|
@@ -3571,8 +3584,8 @@ var ao = 1e3, Bs = 1e4, be = class {
|
|
|
3571
3584
|
// A prepared story does not include args, globals or hooks. These are stored in the story store
|
|
3572
3585
|
// and updated separtely to the (immutable) story.
|
|
3573
3586
|
getStoryContext(e, { forceInitialArgs: t = !1 } = {}) {
|
|
3574
|
-
let o = this.userGlobals.get(), { initialGlobals: s } = this.userGlobals, i = new
|
|
3575
|
-
return
|
|
3587
|
+
let o = this.userGlobals.get(), { initialGlobals: s } = this.userGlobals, i = new ne();
|
|
3588
|
+
return Xe({
|
|
3576
3589
|
...e,
|
|
3577
3590
|
args: t ? e.initialArgs : this.args.get(e.id),
|
|
3578
3591
|
initialGlobals: s,
|
|
@@ -3600,7 +3613,7 @@ var ao = 1e3, Bs = 1e4, be = class {
|
|
|
3600
3613
|
extract(e = { includeDocsOnly: !1 }) {
|
|
3601
3614
|
let { cachedCSFFiles: t } = this;
|
|
3602
3615
|
if (!t)
|
|
3603
|
-
throw new
|
|
3616
|
+
throw new si();
|
|
3604
3617
|
return Object.entries(this.storyIndex.entries).reduce(
|
|
3605
3618
|
(o, [s, { type: i, importPath: a }]) => {
|
|
3606
3619
|
if (i === "docs")
|
|
@@ -3624,18 +3637,20 @@ var ao = 1e3, Bs = 1e4, be = class {
|
|
|
3624
3637
|
);
|
|
3625
3638
|
}
|
|
3626
3639
|
};
|
|
3640
|
+
n($r, "StoryStore");
|
|
3641
|
+
var he = $r;
|
|
3627
3642
|
|
|
3628
3643
|
// src/preview-api/modules/store/autoTitle.ts
|
|
3629
|
-
import { once as
|
|
3644
|
+
import { once as li } from "storybook/internal/client-logger";
|
|
3630
3645
|
|
|
3631
3646
|
// ../node_modules/slash/index.js
|
|
3632
|
-
function
|
|
3647
|
+
function Yr(r) {
|
|
3633
3648
|
return r.startsWith("\\\\?\\") ? r : r.replace(/\\/g, "/");
|
|
3634
3649
|
}
|
|
3635
|
-
n(
|
|
3650
|
+
n(Yr, "slash");
|
|
3636
3651
|
|
|
3637
3652
|
// src/preview-api/modules/store/autoTitle.ts
|
|
3638
|
-
var
|
|
3653
|
+
var ci = /* @__PURE__ */ n((r) => {
|
|
3639
3654
|
if (r.length === 0)
|
|
3640
3655
|
return r;
|
|
3641
3656
|
let e = r[r.length - 1], t = e?.replace(/(?:[.](?:story|stories))?([.][^.]+)$/i, "");
|
|
@@ -3645,28 +3660,28 @@ var Us = /* @__PURE__ */ n((r) => {
|
|
|
3645
3660
|
return t && o && t.toLowerCase() === o.toLowerCase() ? [...r.slice(0, -2), t] : t && (/^(story|stories)([.][^.]+)$/i.test(e) || /^index$/i.
|
|
3646
3661
|
test(t)) ? r.slice(0, -1) : [...r.slice(0, -1), t];
|
|
3647
3662
|
}, "sanitize");
|
|
3648
|
-
function
|
|
3663
|
+
function Fo(r) {
|
|
3649
3664
|
return r.flatMap((e) => e.split("/")).filter(Boolean).join("/");
|
|
3650
3665
|
}
|
|
3651
|
-
n(
|
|
3652
|
-
var
|
|
3666
|
+
n(Fo, "pathJoin");
|
|
3667
|
+
var Io = /* @__PURE__ */ n((r, e, t) => {
|
|
3653
3668
|
let { directory: o, importPathMatcher: s, titlePrefix: i = "" } = e || {};
|
|
3654
|
-
typeof r == "number" &&
|
|
3669
|
+
typeof r == "number" && li.warn(P`
|
|
3655
3670
|
CSF Auto-title received a numeric fileName. This typically happens when
|
|
3656
3671
|
webpack is mis-configured in production mode. To force webpack to produce
|
|
3657
3672
|
filenames, set optimization.moduleIds = "named" in your webpack config.
|
|
3658
3673
|
`);
|
|
3659
|
-
let a =
|
|
3674
|
+
let a = Yr(String(r));
|
|
3660
3675
|
if (s.exec(a)) {
|
|
3661
3676
|
if (!t) {
|
|
3662
|
-
let l = a.replace(o, ""), c =
|
|
3663
|
-
return c =
|
|
3677
|
+
let l = a.replace(o, ""), c = Fo([i, l]).split("/");
|
|
3678
|
+
return c = ci(c), c.join("/");
|
|
3664
3679
|
}
|
|
3665
|
-
return i ?
|
|
3680
|
+
return i ? Fo([i, t]) : t;
|
|
3666
3681
|
}
|
|
3667
|
-
}, "userOrAutoTitleFromSpecifier"),
|
|
3682
|
+
}, "userOrAutoTitleFromSpecifier"), di = /* @__PURE__ */ n((r, e, t) => {
|
|
3668
3683
|
for (let o = 0; o < e.length; o += 1) {
|
|
3669
|
-
let s =
|
|
3684
|
+
let s = Io(r, e[o], t);
|
|
3670
3685
|
if (s)
|
|
3671
3686
|
return s;
|
|
3672
3687
|
}
|
|
@@ -3674,10 +3689,10 @@ var co = /* @__PURE__ */ n((r, e, t) => {
|
|
|
3674
3689
|
}, "userOrAutoTitle");
|
|
3675
3690
|
|
|
3676
3691
|
// src/preview-api/modules/store/storySort.ts
|
|
3677
|
-
var
|
|
3692
|
+
var Oo = /\s*\/\s*/, Do = /* @__PURE__ */ n((r = {}) => (e, t) => {
|
|
3678
3693
|
if (e.title === t.title && !r.includeNames)
|
|
3679
3694
|
return 0;
|
|
3680
|
-
let o = r.method || "configure", s = r.order || [], i = e.title.trim().split(
|
|
3695
|
+
let o = r.method || "configure", s = r.order || [], i = e.title.trim().split(Oo), a = t.title.trim().split(Oo);
|
|
3681
3696
|
r.includeNames && (i.push(e.name), a.push(t.name));
|
|
3682
3697
|
let l = 0;
|
|
3683
3698
|
for (; i[l] || a[l]; ) {
|
|
@@ -3687,8 +3702,8 @@ var po = /\s*\/\s*/, uo = /* @__PURE__ */ n((r = {}) => (e, t) => {
|
|
|
3687
3702
|
return 1;
|
|
3688
3703
|
let c = i[l], d = a[l];
|
|
3689
3704
|
if (c !== d) {
|
|
3690
|
-
let u = s.indexOf(c), y = s.indexOf(d),
|
|
3691
|
-
return u !== -1 || y !== -1 ? (u === -1 && (
|
|
3705
|
+
let u = s.indexOf(c), y = s.indexOf(d), h = s.indexOf("*");
|
|
3706
|
+
return u !== -1 || y !== -1 ? (u === -1 && (h !== -1 ? u = h : u = s.length), y === -1 && (h !== -1 ? y = h : y = s.length), u - y) : o ===
|
|
3692
3707
|
"configure" ? 0 : c.localeCompare(d, r.locales ? r.locales : void 0, {
|
|
3693
3708
|
numeric: !0,
|
|
3694
3709
|
sensitivity: "accent"
|
|
@@ -3701,18 +3716,18 @@ var po = /\s*\/\s*/, uo = /* @__PURE__ */ n((r = {}) => (e, t) => {
|
|
|
3701
3716
|
}, "storySort");
|
|
3702
3717
|
|
|
3703
3718
|
// src/preview-api/modules/store/sortStories.ts
|
|
3704
|
-
var
|
|
3719
|
+
var pi = /* @__PURE__ */ n((r, e, t) => {
|
|
3705
3720
|
if (e) {
|
|
3706
3721
|
let o;
|
|
3707
|
-
typeof e == "function" ? o = e : o =
|
|
3722
|
+
typeof e == "function" ? o = e : o = Do(e), r.sort(o);
|
|
3708
3723
|
} else
|
|
3709
3724
|
r.sort(
|
|
3710
3725
|
(o, s) => t.indexOf(o.importPath) - t.indexOf(s.importPath)
|
|
3711
3726
|
);
|
|
3712
3727
|
return r;
|
|
3713
|
-
}, "sortStoriesCommon"),
|
|
3728
|
+
}, "sortStoriesCommon"), ui = /* @__PURE__ */ n((r, e, t) => {
|
|
3714
3729
|
try {
|
|
3715
|
-
return
|
|
3730
|
+
return pi(r, e, t);
|
|
3716
3731
|
} catch (o) {
|
|
3717
3732
|
throw new Error(P`
|
|
3718
3733
|
Error sorting stories with sort parameter ${e}:
|
|
@@ -3727,48 +3742,48 @@ var Hs = /* @__PURE__ */ n((r, e, t) => {
|
|
|
3727
3742
|
}, "sortStoriesV7");
|
|
3728
3743
|
|
|
3729
3744
|
// src/preview-api/modules/preview-web/Preview.tsx
|
|
3730
|
-
import { deprecate as
|
|
3745
|
+
import { deprecate as bi, logger as Lo } from "storybook/internal/client-logger";
|
|
3731
3746
|
import {
|
|
3732
|
-
ARGTYPES_INFO_REQUEST as
|
|
3733
|
-
ARGTYPES_INFO_RESPONSE as
|
|
3734
|
-
CONFIG_ERROR as
|
|
3735
|
-
FORCE_REMOUNT as
|
|
3736
|
-
FORCE_RE_RENDER as
|
|
3737
|
-
GLOBALS_UPDATED as
|
|
3738
|
-
RESET_STORY_ARGS as
|
|
3739
|
-
SET_GLOBALS as
|
|
3740
|
-
STORY_ARGS_UPDATED as
|
|
3741
|
-
STORY_INDEX_INVALIDATED as
|
|
3742
|
-
UPDATE_GLOBALS as
|
|
3743
|
-
UPDATE_STORY_ARGS as
|
|
3747
|
+
ARGTYPES_INFO_REQUEST as Si,
|
|
3748
|
+
ARGTYPES_INFO_RESPONSE as No,
|
|
3749
|
+
CONFIG_ERROR as Ti,
|
|
3750
|
+
FORCE_REMOUNT as xi,
|
|
3751
|
+
FORCE_RE_RENDER as Ri,
|
|
3752
|
+
GLOBALS_UPDATED as qo,
|
|
3753
|
+
RESET_STORY_ARGS as wi,
|
|
3754
|
+
SET_GLOBALS as Ai,
|
|
3755
|
+
STORY_ARGS_UPDATED as Ei,
|
|
3756
|
+
STORY_INDEX_INVALIDATED as Ci,
|
|
3757
|
+
UPDATE_GLOBALS as vi,
|
|
3758
|
+
UPDATE_STORY_ARGS as Pi
|
|
3744
3759
|
} from "storybook/internal/core-events";
|
|
3745
3760
|
import {
|
|
3746
|
-
CalledPreviewMethodBeforeInitializationError as
|
|
3747
|
-
MissingRenderToCanvasError as
|
|
3748
|
-
StoryIndexFetchError as
|
|
3749
|
-
StoryStoreAccessedBeforeInitializationError as
|
|
3761
|
+
CalledPreviewMethodBeforeInitializationError as V,
|
|
3762
|
+
MissingRenderToCanvasError as Fi,
|
|
3763
|
+
StoryIndexFetchError as Ii,
|
|
3764
|
+
StoryStoreAccessedBeforeInitializationError as Oi
|
|
3750
3765
|
} from "storybook/internal/preview-errors";
|
|
3751
|
-
import { global as
|
|
3766
|
+
import { global as Di } from "@storybook/global";
|
|
3752
3767
|
|
|
3753
3768
|
// src/preview-api/modules/preview-web/render/StoryRender.ts
|
|
3754
3769
|
import {
|
|
3755
|
-
PLAY_FUNCTION_THREW_EXCEPTION as
|
|
3756
|
-
STORY_FINISHED as
|
|
3757
|
-
STORY_RENDERED as
|
|
3758
|
-
STORY_RENDER_PHASE_CHANGED as
|
|
3759
|
-
UNHANDLED_ERRORS_WHILE_PLAYING as
|
|
3770
|
+
PLAY_FUNCTION_THREW_EXCEPTION as fi,
|
|
3771
|
+
STORY_FINISHED as ko,
|
|
3772
|
+
STORY_RENDERED as yi,
|
|
3773
|
+
STORY_RENDER_PHASE_CHANGED as jo,
|
|
3774
|
+
UNHANDLED_ERRORS_WHILE_PLAYING as mi
|
|
3760
3775
|
} from "storybook/internal/core-events";
|
|
3761
3776
|
import {
|
|
3762
|
-
MountMustBeDestructuredError as
|
|
3763
|
-
NoStoryMountedError as
|
|
3777
|
+
MountMustBeDestructuredError as hi,
|
|
3778
|
+
NoStoryMountedError as gi
|
|
3764
3779
|
} from "storybook/internal/preview-errors";
|
|
3765
3780
|
|
|
3766
3781
|
// src/preview-api/modules/preview-web/render/Render.ts
|
|
3767
|
-
var
|
|
3782
|
+
var X = new Error("prepareAborted");
|
|
3768
3783
|
|
|
3769
3784
|
// src/preview-api/modules/preview-web/render/StoryRender.ts
|
|
3770
|
-
var { AbortController:
|
|
3771
|
-
function
|
|
3785
|
+
var { AbortController: Mo } = globalThis;
|
|
3786
|
+
function _o(r) {
|
|
3772
3787
|
try {
|
|
3773
3788
|
let { name: e = "Error", message: t = String(r), stack: o } = r;
|
|
3774
3789
|
return { name: e, message: t, stack: o };
|
|
@@ -3776,8 +3791,8 @@ function ho(r) {
|
|
|
3776
3791
|
return { name: "Error", message: String(r) };
|
|
3777
3792
|
}
|
|
3778
3793
|
}
|
|
3779
|
-
n(
|
|
3780
|
-
var
|
|
3794
|
+
n(_o, "serializeError");
|
|
3795
|
+
var Kr = class Kr {
|
|
3781
3796
|
constructor(e, t, o, s, i, a, l = { autoplay: !0, forceInitialArgs: !1 }, c) {
|
|
3782
3797
|
this.channel = e;
|
|
3783
3798
|
this.store = t;
|
|
@@ -3793,22 +3808,19 @@ var ae = class {
|
|
|
3793
3808
|
this.teardownRender = /* @__PURE__ */ n(() => {
|
|
3794
3809
|
}, "teardownRender");
|
|
3795
3810
|
this.torndown = !1;
|
|
3796
|
-
this.abortController = new
|
|
3797
|
-
}
|
|
3798
|
-
static {
|
|
3799
|
-
n(this, "StoryRender");
|
|
3811
|
+
this.abortController = new Mo(), c && (this.story = c, this.phase = "preparing");
|
|
3800
3812
|
}
|
|
3801
3813
|
async runPhase(e, t, o) {
|
|
3802
|
-
this.phase = t, this.channel.emit(
|
|
3814
|
+
this.phase = t, this.channel.emit(jo, { newPhase: this.phase, storyId: this.id }), o && (await o(), this.checkIfAborted(e));
|
|
3803
3815
|
}
|
|
3804
3816
|
checkIfAborted(e) {
|
|
3805
|
-
return e.aborted ? (this.phase = "aborted", this.channel.emit(
|
|
3817
|
+
return e.aborted ? (this.phase = "aborted", this.channel.emit(jo, { newPhase: this.phase, storyId: this.id }), !0) : !1;
|
|
3806
3818
|
}
|
|
3807
3819
|
async prepare() {
|
|
3808
3820
|
if (await this.runPhase(this.abortController.signal, "preparing", async () => {
|
|
3809
3821
|
this.story = await this.store.loadStory({ storyId: this.id });
|
|
3810
3822
|
}), this.abortController.signal.aborted)
|
|
3811
|
-
throw await this.store.cleanupStory(this.story),
|
|
3823
|
+
throw await this.store.cleanupStory(this.story), X;
|
|
3812
3824
|
}
|
|
3813
3825
|
// The two story "renders" are equal and have both loaded the same story
|
|
3814
3826
|
isEqual(e) {
|
|
@@ -3850,25 +3862,25 @@ var ae = class {
|
|
|
3850
3862
|
applyLoaders: p,
|
|
3851
3863
|
applyBeforeEach: u,
|
|
3852
3864
|
applyAfterEach: y,
|
|
3853
|
-
unboundStoryFn:
|
|
3854
|
-
playFunction:
|
|
3865
|
+
unboundStoryFn: h,
|
|
3866
|
+
playFunction: g,
|
|
3855
3867
|
runStep: b
|
|
3856
3868
|
} = s;
|
|
3857
|
-
t && !e && (this.cancelRender(), this.abortController = new
|
|
3858
|
-
let
|
|
3869
|
+
t && !e && (this.cancelRender(), this.abortController = new Mo());
|
|
3870
|
+
let m = this.abortController.signal, T = !1, x = s.usesMount;
|
|
3859
3871
|
try {
|
|
3860
3872
|
let f = {
|
|
3861
3873
|
...this.storyContext(),
|
|
3862
3874
|
viewMode: this.viewMode,
|
|
3863
|
-
abortSignal:
|
|
3875
|
+
abortSignal: m,
|
|
3864
3876
|
canvasElement: o,
|
|
3865
3877
|
loaded: {},
|
|
3866
|
-
step: /* @__PURE__ */ n((C,
|
|
3878
|
+
step: /* @__PURE__ */ n((C, B) => b(C, B, f), "step"),
|
|
3867
3879
|
context: null,
|
|
3868
3880
|
canvas: {},
|
|
3869
3881
|
userEvent: {},
|
|
3870
3882
|
renderToCanvas: /* @__PURE__ */ n(async () => {
|
|
3871
|
-
let C = await this.renderToScreen(
|
|
3883
|
+
let C = await this.renderToScreen(S, o);
|
|
3872
3884
|
this.teardownRender = C || (() => {
|
|
3873
3885
|
}), T = !0;
|
|
3874
3886
|
}, "renderToCanvas"),
|
|
@@ -3879,14 +3891,14 @@ var ae = class {
|
|
|
3879
3891
|
// so that a user can just call it as await mount(...args) in their play function.
|
|
3880
3892
|
mount: /* @__PURE__ */ n(async (...C) => {
|
|
3881
3893
|
this.callbacks.showStoryDuringRender?.();
|
|
3882
|
-
let
|
|
3883
|
-
return await this.runPhase(
|
|
3884
|
-
|
|
3885
|
-
}),
|
|
3894
|
+
let B = null;
|
|
3895
|
+
return await this.runPhase(m, "rendering", async () => {
|
|
3896
|
+
B = await s.mount(f)(...C);
|
|
3897
|
+
}), x && await this.runPhase(m, "playing"), B;
|
|
3886
3898
|
}, "mount")
|
|
3887
3899
|
};
|
|
3888
3900
|
f.context = f;
|
|
3889
|
-
let
|
|
3901
|
+
let S = {
|
|
3890
3902
|
componentId: a,
|
|
3891
3903
|
title: l,
|
|
3892
3904
|
kind: l,
|
|
@@ -3899,63 +3911,63 @@ var ae = class {
|
|
|
3899
3911
|
showException: /* @__PURE__ */ n((C) => (this.phase = "errored", this.callbacks.showException(C)), "showException"),
|
|
3900
3912
|
forceRemount: t || this.notYetRendered,
|
|
3901
3913
|
storyContext: f,
|
|
3902
|
-
storyFn: /* @__PURE__ */ n(() =>
|
|
3903
|
-
unboundStoryFn:
|
|
3914
|
+
storyFn: /* @__PURE__ */ n(() => h(f), "storyFn"),
|
|
3915
|
+
unboundStoryFn: h
|
|
3904
3916
|
};
|
|
3905
|
-
if (await this.runPhase(
|
|
3917
|
+
if (await this.runPhase(m, "loading", async () => {
|
|
3906
3918
|
f.loaded = await p(f);
|
|
3907
|
-
}),
|
|
3919
|
+
}), m.aborted)
|
|
3908
3920
|
return;
|
|
3909
|
-
let
|
|
3910
|
-
if (this.store.addCleanupCallbacks(s,
|
|
3921
|
+
let R = await u(f);
|
|
3922
|
+
if (this.store.addCleanupCallbacks(s, R), this.checkIfAborted(m) || (!T && !x && await f.mount(), this.notYetRendered = !1, m.aborted))
|
|
3911
3923
|
return;
|
|
3912
|
-
let
|
|
3924
|
+
let w = this.story.parameters?.test?.dangerouslyIgnoreUnhandledErrors === !0, E = /* @__PURE__ */ new Set(), F = /* @__PURE__ */ n((C) => E.
|
|
3913
3925
|
add("error" in C ? C.error : C.reason), "onError");
|
|
3914
|
-
if (this.renderOptions.autoplay && t &&
|
|
3926
|
+
if (this.renderOptions.autoplay && t && g && this.phase !== "errored") {
|
|
3915
3927
|
window.addEventListener("error", F), window.addEventListener("unhandledrejection", F), this.disableKeyListeners = !0;
|
|
3916
3928
|
try {
|
|
3917
|
-
if (
|
|
3918
|
-
throw new
|
|
3919
|
-
}, await this.runPhase(
|
|
3920
|
-
throw new
|
|
3921
|
-
this.checkIfAborted(
|
|
3929
|
+
if (x ? await g(f) : (f.mount = async () => {
|
|
3930
|
+
throw new hi({ playFunction: g.toString() });
|
|
3931
|
+
}, await this.runPhase(m, "playing", async () => g(f))), !T)
|
|
3932
|
+
throw new gi();
|
|
3933
|
+
this.checkIfAborted(m), !w && E.size > 0 ? await this.runPhase(m, "errored") : await this.runPhase(m, "played");
|
|
3922
3934
|
} catch (C) {
|
|
3923
|
-
if (this.callbacks.showStoryDuringRender?.(), await this.runPhase(
|
|
3924
|
-
this.channel.emit(
|
|
3935
|
+
if (this.callbacks.showStoryDuringRender?.(), await this.runPhase(m, "errored", async () => {
|
|
3936
|
+
this.channel.emit(fi, _o(C));
|
|
3925
3937
|
}), this.story.parameters.throwPlayFunctionExceptions !== !1)
|
|
3926
3938
|
throw C;
|
|
3927
3939
|
console.error(C);
|
|
3928
3940
|
}
|
|
3929
|
-
if (!
|
|
3930
|
-
|
|
3931
|
-
Array.from(
|
|
3932
|
-
), this.disableKeyListeners = !1, window.removeEventListener("unhandledrejection", F), window.removeEventListener("error", F),
|
|
3941
|
+
if (!w && E.size > 0 && this.channel.emit(
|
|
3942
|
+
mi,
|
|
3943
|
+
Array.from(E).map(_o)
|
|
3944
|
+
), this.disableKeyListeners = !1, window.removeEventListener("unhandledrejection", F), window.removeEventListener("error", F), m.aborted)
|
|
3933
3945
|
return;
|
|
3934
3946
|
}
|
|
3935
3947
|
await this.runPhase(
|
|
3936
|
-
|
|
3948
|
+
m,
|
|
3937
3949
|
"completed",
|
|
3938
|
-
async () => this.channel.emit(
|
|
3939
|
-
), this.phase !== "errored" && await this.runPhase(
|
|
3950
|
+
async () => this.channel.emit(yi, i)
|
|
3951
|
+
), this.phase !== "errored" && await this.runPhase(m, "afterEach", async () => {
|
|
3940
3952
|
await y(f);
|
|
3941
3953
|
});
|
|
3942
|
-
let j = !
|
|
3954
|
+
let j = !w && E.size > 0, N = f.reporting.reports.some(
|
|
3943
3955
|
(C) => C.status === "failed"
|
|
3944
|
-
),
|
|
3956
|
+
), de = j || N;
|
|
3945
3957
|
await this.runPhase(
|
|
3946
|
-
|
|
3958
|
+
m,
|
|
3947
3959
|
"finished",
|
|
3948
|
-
async () => this.channel.emit(
|
|
3960
|
+
async () => this.channel.emit(ko, {
|
|
3949
3961
|
storyId: i,
|
|
3950
|
-
status:
|
|
3962
|
+
status: de ? "error" : "success",
|
|
3951
3963
|
reporters: f.reporting.reports
|
|
3952
3964
|
})
|
|
3953
3965
|
);
|
|
3954
3966
|
} catch (f) {
|
|
3955
3967
|
this.phase = "errored", this.callbacks.showException(f), await this.runPhase(
|
|
3956
|
-
|
|
3968
|
+
m,
|
|
3957
3969
|
"finished",
|
|
3958
|
-
async () => this.channel.emit(
|
|
3970
|
+
async () => this.channel.emit(ko, {
|
|
3959
3971
|
storyId: i,
|
|
3960
3972
|
status: "error",
|
|
3961
3973
|
reporters: []
|
|
@@ -4000,9 +4012,11 @@ var ae = class {
|
|
|
4000
4012
|
});
|
|
4001
4013
|
}
|
|
4002
4014
|
};
|
|
4015
|
+
n(Kr, "StoryRender");
|
|
4016
|
+
var se = Kr;
|
|
4003
4017
|
|
|
4004
4018
|
// src/preview-api/modules/preview-web/Preview.tsx
|
|
4005
|
-
var { fetch:
|
|
4019
|
+
var { fetch: ki } = Di, ji = "./index.json", Xr = class Xr {
|
|
4006
4020
|
constructor(e, t, o = _.getChannel(), s = !0) {
|
|
4007
4021
|
this.importFn = e;
|
|
4008
4022
|
this.getProjectAnnotations = t;
|
|
@@ -4012,9 +4026,6 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4012
4026
|
this.resolveStoreInitializationPromise = i, this.rejectStoreInitializationPromise = a;
|
|
4013
4027
|
}), s && this.initialize();
|
|
4014
4028
|
}
|
|
4015
|
-
static {
|
|
4016
|
-
n(this, "Preview");
|
|
4017
|
-
}
|
|
4018
4029
|
// Create a proxy object for `__STORYBOOK_STORY_STORE__` and `__STORYBOOK_PREVIEW__.storyStore`
|
|
4019
4030
|
// That proxies through to the store once ready, and errors beforehand. This means we can set
|
|
4020
4031
|
// `__STORYBOOK_STORY_STORE__ = __STORYBOOK_PREVIEW__.storyStore` without having to wait, and
|
|
@@ -4026,8 +4037,8 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4026
4037
|
{
|
|
4027
4038
|
get: /* @__PURE__ */ n((e, t) => {
|
|
4028
4039
|
if (this.storyStoreValue)
|
|
4029
|
-
return
|
|
4030
|
-
throw new
|
|
4040
|
+
return bi("Accessing the Story Store is deprecated and will be removed in 9.0"), this.storyStoreValue[t];
|
|
4041
|
+
throw new Oi();
|
|
4031
4042
|
}, "get")
|
|
4032
4043
|
}
|
|
4033
4044
|
);
|
|
@@ -4046,15 +4057,15 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4046
4057
|
return this.storeInitializationPromise;
|
|
4047
4058
|
}
|
|
4048
4059
|
setupListeners() {
|
|
4049
|
-
this.channel.on(
|
|
4050
|
-
onUpdateArgs.bind(this)), this.channel.on(
|
|
4051
|
-
channel.on(
|
|
4060
|
+
this.channel.on(Ci, this.onStoryIndexChanged.bind(this)), this.channel.on(vi, this.onUpdateGlobals.bind(this)), this.channel.on(Pi, this.
|
|
4061
|
+
onUpdateArgs.bind(this)), this.channel.on(Si, this.onRequestArgTypesInfo.bind(this)), this.channel.on(wi, this.onResetArgs.bind(this)), this.
|
|
4062
|
+
channel.on(Ri, this.onForceReRender.bind(this)), this.channel.on(xi, this.onForceRemount.bind(this));
|
|
4052
4063
|
}
|
|
4053
4064
|
async getProjectAnnotationsOrRenderError() {
|
|
4054
4065
|
try {
|
|
4055
4066
|
let e = await this.getProjectAnnotations();
|
|
4056
4067
|
if (this.renderToCanvas = e.renderToCanvas, !this.renderToCanvas)
|
|
4057
|
-
throw new
|
|
4068
|
+
throw new Fi();
|
|
4058
4069
|
return e;
|
|
4059
4070
|
} catch (e) {
|
|
4060
4071
|
throw this.renderPreviewEntryError("Error reading preview.js:", e), e;
|
|
@@ -4078,16 +4089,16 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4078
4089
|
}
|
|
4079
4090
|
}
|
|
4080
4091
|
async getStoryIndexFromServer() {
|
|
4081
|
-
let e = await
|
|
4092
|
+
let e = await ki(ji);
|
|
4082
4093
|
if (e.status === 200)
|
|
4083
4094
|
return e.json();
|
|
4084
|
-
throw new
|
|
4095
|
+
throw new Ii({ text: await e.text() });
|
|
4085
4096
|
}
|
|
4086
4097
|
// If initialization gets as far as the story index, this function runs.
|
|
4087
4098
|
initializeWithStoryIndex(e) {
|
|
4088
4099
|
if (!this.projectAnnotationsBeforeInitialization)
|
|
4089
4100
|
throw new Error("Cannot call initializeWithStoryIndex until project annotations resolve");
|
|
4090
|
-
this.storyStoreValue = new
|
|
4101
|
+
this.storyStoreValue = new he(
|
|
4091
4102
|
e,
|
|
4092
4103
|
this.importFn,
|
|
4093
4104
|
this.projectAnnotationsBeforeInitialization
|
|
@@ -4098,12 +4109,12 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4098
4109
|
}
|
|
4099
4110
|
emitGlobals() {
|
|
4100
4111
|
if (!this.storyStoreValue)
|
|
4101
|
-
throw new
|
|
4112
|
+
throw new V({ methodName: "emitGlobals" });
|
|
4102
4113
|
let e = {
|
|
4103
4114
|
globals: this.storyStoreValue.userGlobals.get() || {},
|
|
4104
4115
|
globalTypes: this.storyStoreValue.projectAnnotations.globalTypes || {}
|
|
4105
4116
|
};
|
|
4106
|
-
this.channel.emit(
|
|
4117
|
+
this.channel.emit(Ai, e);
|
|
4107
4118
|
}
|
|
4108
4119
|
// EVENT HANDLERS
|
|
4109
4120
|
// This happens when a config file gets reloaded
|
|
@@ -4137,7 +4148,7 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4137
4148
|
storyIndex: t
|
|
4138
4149
|
}) {
|
|
4139
4150
|
if (!this.storyStoreValue)
|
|
4140
|
-
throw new
|
|
4151
|
+
throw new V({ methodName: "onStoriesChanged" });
|
|
4141
4152
|
await this.storyStoreValue.onStoriesChanged({ importFn: e, storyIndex: t });
|
|
4142
4153
|
}
|
|
4143
4154
|
async onUpdateGlobals({
|
|
@@ -4145,10 +4156,10 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4145
4156
|
currentStory: t
|
|
4146
4157
|
}) {
|
|
4147
4158
|
if (this.storyStoreValue || await this.storeInitializationPromise, !this.storyStoreValue)
|
|
4148
|
-
throw new
|
|
4159
|
+
throw new V({ methodName: "onUpdateGlobals" });
|
|
4149
4160
|
if (this.storyStoreValue.userGlobals.update(e), t) {
|
|
4150
4161
|
let { initialGlobals: o, storyGlobals: s, userGlobals: i, globals: a } = this.storyStoreValue.getStoryContext(t);
|
|
4151
|
-
this.channel.emit(
|
|
4162
|
+
this.channel.emit(qo, {
|
|
4152
4163
|
initialGlobals: o,
|
|
4153
4164
|
userGlobals: i,
|
|
4154
4165
|
storyGlobals: s,
|
|
@@ -4156,7 +4167,7 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4156
4167
|
});
|
|
4157
4168
|
} else {
|
|
4158
4169
|
let { initialGlobals: o, globals: s } = this.storyStoreValue.userGlobals;
|
|
4159
|
-
this.channel.emit(
|
|
4170
|
+
this.channel.emit(qo, {
|
|
4160
4171
|
initialGlobals: o,
|
|
4161
4172
|
userGlobals: s,
|
|
4162
4173
|
storyGlobals: {},
|
|
@@ -4167,7 +4178,7 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4167
4178
|
}
|
|
4168
4179
|
async onUpdateArgs({ storyId: e, updatedArgs: t }) {
|
|
4169
4180
|
if (!this.storyStoreValue)
|
|
4170
|
-
throw new
|
|
4181
|
+
throw new V({ methodName: "onUpdateArgs" });
|
|
4171
4182
|
this.storyStoreValue.args.update(e, t), await Promise.all(
|
|
4172
4183
|
this.storyRenders.filter((o) => o.id === e && !o.renderOptions.forceInitialArgs).map(
|
|
4173
4184
|
(o) => (
|
|
@@ -4176,7 +4187,7 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4176
4187
|
o.story && o.story.usesMount ? o.remount() : o.rerender()
|
|
4177
4188
|
)
|
|
4178
4189
|
)
|
|
4179
|
-
), this.channel.emit(
|
|
4190
|
+
), this.channel.emit(Ei, {
|
|
4180
4191
|
storyId: e,
|
|
4181
4192
|
args: this.storyStoreValue.args.get(e)
|
|
4182
4193
|
});
|
|
@@ -4185,14 +4196,14 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4185
4196
|
try {
|
|
4186
4197
|
await this.storeInitializationPromise;
|
|
4187
4198
|
let o = await this.storyStoreValue?.loadStory(t);
|
|
4188
|
-
this.channel.emit(
|
|
4199
|
+
this.channel.emit(No, {
|
|
4189
4200
|
id: e,
|
|
4190
4201
|
success: !0,
|
|
4191
4202
|
payload: { argTypes: o?.argTypes || {} },
|
|
4192
4203
|
error: null
|
|
4193
4204
|
});
|
|
4194
4205
|
} catch (o) {
|
|
4195
|
-
this.channel.emit(
|
|
4206
|
+
this.channel.emit(No, {
|
|
4196
4207
|
id: e,
|
|
4197
4208
|
success: !1,
|
|
4198
4209
|
error: o?.message
|
|
@@ -4201,7 +4212,7 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4201
4212
|
}
|
|
4202
4213
|
async onResetArgs({ storyId: e, argNames: t }) {
|
|
4203
4214
|
if (!this.storyStoreValue)
|
|
4204
|
-
throw new
|
|
4215
|
+
throw new V({ methodName: "onResetArgs" });
|
|
4205
4216
|
let s = this.storyRenders.find((l) => l.id === e)?.story || await this.storyStoreValue.loadStory({ storyId: e }), a = (t || [
|
|
4206
4217
|
.../* @__PURE__ */ new Set([
|
|
4207
4218
|
...Object.keys(s.initialArgs),
|
|
@@ -4225,10 +4236,10 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4225
4236
|
// "instant", although async.
|
|
4226
4237
|
renderStoryToElement(e, t, o, s) {
|
|
4227
4238
|
if (!this.renderToCanvas || !this.storyStoreValue)
|
|
4228
|
-
throw new
|
|
4239
|
+
throw new V({
|
|
4229
4240
|
methodName: "renderStoryToElement"
|
|
4230
4241
|
});
|
|
4231
|
-
let i = new
|
|
4242
|
+
let i = new se(
|
|
4232
4243
|
this.channel,
|
|
4233
4244
|
this.storyStoreValue,
|
|
4234
4245
|
this.renderToCanvas,
|
|
@@ -4248,74 +4259,76 @@ var { fetch: fi } = ui, yi = "./index.json", Se = class {
|
|
|
4248
4259
|
// API
|
|
4249
4260
|
async loadStory({ storyId: e }) {
|
|
4250
4261
|
if (!this.storyStoreValue)
|
|
4251
|
-
throw new
|
|
4262
|
+
throw new V({ methodName: "loadStory" });
|
|
4252
4263
|
return this.storyStoreValue.loadStory({ storyId: e });
|
|
4253
4264
|
}
|
|
4254
4265
|
getStoryContext(e, { forceInitialArgs: t = !1 } = {}) {
|
|
4255
4266
|
if (!this.storyStoreValue)
|
|
4256
|
-
throw new
|
|
4267
|
+
throw new V({ methodName: "getStoryContext" });
|
|
4257
4268
|
return this.storyStoreValue.getStoryContext(e, { forceInitialArgs: t });
|
|
4258
4269
|
}
|
|
4259
4270
|
async extract(e) {
|
|
4260
4271
|
if (!this.storyStoreValue)
|
|
4261
|
-
throw new
|
|
4272
|
+
throw new V({ methodName: "extract" });
|
|
4262
4273
|
if (this.previewEntryError)
|
|
4263
4274
|
throw this.previewEntryError;
|
|
4264
4275
|
return await this.storyStoreValue.cacheAllCSFFiles(), this.storyStoreValue.extract(e);
|
|
4265
4276
|
}
|
|
4266
4277
|
// UTILITIES
|
|
4267
4278
|
renderPreviewEntryError(e, t) {
|
|
4268
|
-
this.previewEntryError = t,
|
|
4279
|
+
this.previewEntryError = t, Lo.error(e), Lo.error(t), this.channel.emit(Ti, t);
|
|
4269
4280
|
}
|
|
4270
4281
|
};
|
|
4282
|
+
n(Xr, "Preview");
|
|
4283
|
+
var ge = Xr;
|
|
4271
4284
|
|
|
4272
4285
|
// src/preview-api/modules/preview-web/PreviewWeb.tsx
|
|
4273
|
-
import { global as
|
|
4286
|
+
import { global as Tl } from "@storybook/global";
|
|
4274
4287
|
|
|
4275
4288
|
// src/preview-api/modules/preview-web/PreviewWithSelection.tsx
|
|
4276
|
-
import { logger as
|
|
4289
|
+
import { logger as rr } from "storybook/internal/client-logger";
|
|
4277
4290
|
import {
|
|
4278
|
-
CURRENT_STORY_WAS_SET as
|
|
4279
|
-
DOCS_PREPARED as
|
|
4280
|
-
GLOBALS_UPDATED as
|
|
4281
|
-
PRELOAD_ENTRIES as
|
|
4282
|
-
PREVIEW_KEYDOWN as
|
|
4283
|
-
SET_CURRENT_STORY as
|
|
4284
|
-
STORY_CHANGED as
|
|
4285
|
-
STORY_ERRORED as
|
|
4286
|
-
STORY_MISSING as
|
|
4287
|
-
STORY_PREPARED as
|
|
4288
|
-
STORY_RENDER_PHASE_CHANGED as
|
|
4289
|
-
STORY_SPECIFIED as
|
|
4290
|
-
STORY_THREW_EXCEPTION as
|
|
4291
|
-
STORY_UNCHANGED as
|
|
4292
|
-
UPDATE_QUERY_PARAMS as
|
|
4291
|
+
CURRENT_STORY_WAS_SET as Bo,
|
|
4292
|
+
DOCS_PREPARED as qi,
|
|
4293
|
+
GLOBALS_UPDATED as zo,
|
|
4294
|
+
PRELOAD_ENTRIES as Bi,
|
|
4295
|
+
PREVIEW_KEYDOWN as zi,
|
|
4296
|
+
SET_CURRENT_STORY as Gi,
|
|
4297
|
+
STORY_CHANGED as Ui,
|
|
4298
|
+
STORY_ERRORED as Hi,
|
|
4299
|
+
STORY_MISSING as Go,
|
|
4300
|
+
STORY_PREPARED as Vi,
|
|
4301
|
+
STORY_RENDER_PHASE_CHANGED as Uo,
|
|
4302
|
+
STORY_SPECIFIED as Wi,
|
|
4303
|
+
STORY_THREW_EXCEPTION as $i,
|
|
4304
|
+
STORY_UNCHANGED as Yi,
|
|
4305
|
+
UPDATE_QUERY_PARAMS as Ki
|
|
4293
4306
|
} from "storybook/internal/core-events";
|
|
4294
4307
|
import {
|
|
4295
|
-
CalledPreviewMethodBeforeInitializationError as
|
|
4296
|
-
EmptyIndexError as
|
|
4297
|
-
MdxFileWithNoCsfReferencesError as
|
|
4298
|
-
NoStoryMatchError as
|
|
4308
|
+
CalledPreviewMethodBeforeInitializationError as rt,
|
|
4309
|
+
EmptyIndexError as Xi,
|
|
4310
|
+
MdxFileWithNoCsfReferencesError as Ji,
|
|
4311
|
+
NoStoryMatchError as Qi
|
|
4299
4312
|
} from "storybook/internal/preview-errors";
|
|
4300
4313
|
|
|
4301
4314
|
// ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
4302
|
-
var
|
|
4303
|
-
function
|
|
4315
|
+
var Mi = !1, Jr = "Invariant failed";
|
|
4316
|
+
function er(r, e) {
|
|
4304
4317
|
if (!r) {
|
|
4305
|
-
if (
|
|
4306
|
-
throw new Error(
|
|
4307
|
-
var t = typeof e == "function" ? e() : e, o = t ? "".concat(
|
|
4318
|
+
if (Mi)
|
|
4319
|
+
throw new Error(Jr);
|
|
4320
|
+
var t = typeof e == "function" ? e() : e, o = t ? "".concat(Jr, ": ").concat(t) : Jr;
|
|
4308
4321
|
throw new Error(o);
|
|
4309
4322
|
}
|
|
4310
4323
|
}
|
|
4311
|
-
n(
|
|
4324
|
+
n(er, "invariant");
|
|
4312
4325
|
|
|
4313
4326
|
// src/preview-api/modules/preview-web/render/CsfDocsRender.ts
|
|
4314
|
-
import { DOCS_RENDERED as
|
|
4327
|
+
import { DOCS_RENDERED as Li } from "storybook/internal/core-events";
|
|
4315
4328
|
|
|
4316
4329
|
// src/preview-api/modules/preview-web/docs-context/DocsContext.ts
|
|
4317
|
-
import { isStory as
|
|
4318
|
-
var
|
|
4330
|
+
import { isStory as _i } from "storybook/internal/csf";
|
|
4331
|
+
var Qr = class Qr {
|
|
4319
4332
|
constructor(e, t, o, s) {
|
|
4320
4333
|
this.channel = e;
|
|
4321
4334
|
this.store = t;
|
|
@@ -4354,9 +4367,6 @@ mCSFFile");
|
|
|
4354
4367
|
this.referenceCSFFile(i);
|
|
4355
4368
|
});
|
|
4356
4369
|
}
|
|
4357
|
-
static {
|
|
4358
|
-
n(this, "DocsContext");
|
|
4359
|
-
}
|
|
4360
4370
|
// This docs entry references this CSF file and can synchronously load the stories, as well
|
|
4361
4371
|
// as reference them by module export. If the CSF is part of the "component" stories, they
|
|
4362
4372
|
// can also be referenced by name and are in the componentStories list.
|
|
@@ -4418,7 +4428,7 @@ CSF file?"
|
|
|
4418
4428
|
if (t)
|
|
4419
4429
|
return { type: "meta", csfFile: t };
|
|
4420
4430
|
let o = this.exportToStory.get(
|
|
4421
|
-
|
|
4431
|
+
_i(e) ? e.input : e
|
|
4422
4432
|
);
|
|
4423
4433
|
return o ? { type: "story", story: o } : { type: "component", component: e };
|
|
4424
4434
|
}
|
|
@@ -4456,9 +4466,11 @@ CSF file?"
|
|
|
4456
4466
|
}
|
|
4457
4467
|
}
|
|
4458
4468
|
};
|
|
4469
|
+
n(Qr, "DocsContext");
|
|
4470
|
+
var J = Qr;
|
|
4459
4471
|
|
|
4460
4472
|
// src/preview-api/modules/preview-web/render/CsfDocsRender.ts
|
|
4461
|
-
var
|
|
4473
|
+
var Zr = class Zr {
|
|
4462
4474
|
constructor(e, t, o, s) {
|
|
4463
4475
|
this.channel = e;
|
|
4464
4476
|
this.store = t;
|
|
@@ -4471,9 +4483,6 @@ var je = class {
|
|
|
4471
4483
|
this.preparing = !1;
|
|
4472
4484
|
this.id = o.id;
|
|
4473
4485
|
}
|
|
4474
|
-
static {
|
|
4475
|
-
n(this, "CsfDocsRender");
|
|
4476
|
-
}
|
|
4477
4486
|
isPreparing() {
|
|
4478
4487
|
return this.preparing;
|
|
4479
4488
|
}
|
|
@@ -4481,7 +4490,7 @@ var je = class {
|
|
|
4481
4490
|
this.preparing = !0;
|
|
4482
4491
|
let { entryExports: e, csfFiles: t = [] } = await this.store.loadEntry(this.id);
|
|
4483
4492
|
if (this.torndown)
|
|
4484
|
-
throw
|
|
4493
|
+
throw X;
|
|
4485
4494
|
let { importPath: o, title: s } = this.entry, i = this.store.processCSFFileWithCache(
|
|
4486
4495
|
e,
|
|
4487
4496
|
o,
|
|
@@ -4495,7 +4504,7 @@ var je = class {
|
|
|
4495
4504
|
docsContext(e) {
|
|
4496
4505
|
if (!this.csfFiles)
|
|
4497
4506
|
throw new Error("Cannot render docs before preparing");
|
|
4498
|
-
let t = new
|
|
4507
|
+
let t = new J(
|
|
4499
4508
|
this.channel,
|
|
4500
4509
|
this.store,
|
|
4501
4510
|
e,
|
|
@@ -4513,7 +4522,7 @@ var je = class {
|
|
|
4513
4522
|
);
|
|
4514
4523
|
let i = await s.renderer(), { render: a } = i, l = /* @__PURE__ */ n(async () => {
|
|
4515
4524
|
try {
|
|
4516
|
-
await a(o, s, e), this.channel.emit(
|
|
4525
|
+
await a(o, s, e), this.channel.emit(Li, this.id);
|
|
4517
4526
|
} catch (c) {
|
|
4518
4527
|
this.callbacks.showException(c);
|
|
4519
4528
|
}
|
|
@@ -4526,10 +4535,12 @@ var je = class {
|
|
|
4526
4535
|
this.teardownRender?.({ viewModeChanged: e }), this.torndown = !0;
|
|
4527
4536
|
}
|
|
4528
4537
|
};
|
|
4538
|
+
n(Zr, "CsfDocsRender");
|
|
4539
|
+
var Me = Zr;
|
|
4529
4540
|
|
|
4530
4541
|
// src/preview-api/modules/preview-web/render/MdxDocsRender.ts
|
|
4531
|
-
import { DOCS_RENDERED as
|
|
4532
|
-
var
|
|
4542
|
+
import { DOCS_RENDERED as Ni } from "storybook/internal/core-events";
|
|
4543
|
+
var et = class et {
|
|
4533
4544
|
constructor(e, t, o, s) {
|
|
4534
4545
|
this.channel = e;
|
|
4535
4546
|
this.store = t;
|
|
@@ -4542,9 +4553,6 @@ var Me = class {
|
|
|
4542
4553
|
this.preparing = !1;
|
|
4543
4554
|
this.id = o.id;
|
|
4544
4555
|
}
|
|
4545
|
-
static {
|
|
4546
|
-
n(this, "MdxDocsRender");
|
|
4547
|
-
}
|
|
4548
4556
|
isPreparing() {
|
|
4549
4557
|
return this.preparing;
|
|
4550
4558
|
}
|
|
@@ -4552,7 +4560,7 @@ var Me = class {
|
|
|
4552
4560
|
this.preparing = !0;
|
|
4553
4561
|
let { entryExports: e, csfFiles: t = [] } = await this.store.loadEntry(this.id);
|
|
4554
4562
|
if (this.torndown)
|
|
4555
|
-
throw
|
|
4563
|
+
throw X;
|
|
4556
4564
|
this.csfFiles = t, this.exports = e, this.preparing = !1;
|
|
4557
4565
|
}
|
|
4558
4566
|
isEqual(e) {
|
|
@@ -4561,7 +4569,7 @@ var Me = class {
|
|
|
4561
4569
|
docsContext(e) {
|
|
4562
4570
|
if (!this.csfFiles)
|
|
4563
4571
|
throw new Error("Cannot render docs before preparing");
|
|
4564
|
-
return new
|
|
4572
|
+
return new J(
|
|
4565
4573
|
this.channel,
|
|
4566
4574
|
this.store,
|
|
4567
4575
|
e,
|
|
@@ -4578,7 +4586,7 @@ var Me = class {
|
|
|
4578
4586
|
);
|
|
4579
4587
|
let i = { ...s, page: this.exports.default }, a = await s.renderer(), { render: l } = a, c = /* @__PURE__ */ n(async () => {
|
|
4580
4588
|
try {
|
|
4581
|
-
await l(o, i, e), this.channel.emit(
|
|
4589
|
+
await l(o, i, e), this.channel.emit(Ni, this.id);
|
|
4582
4590
|
} catch (d) {
|
|
4583
4591
|
this.callbacks.showException(d);
|
|
4584
4592
|
}
|
|
@@ -4591,32 +4599,34 @@ var Me = class {
|
|
|
4591
4599
|
this.teardownRender?.({ viewModeChanged: e }), this.torndown = !0;
|
|
4592
4600
|
}
|
|
4593
4601
|
};
|
|
4602
|
+
n(et, "MdxDocsRender");
|
|
4603
|
+
var _e = et;
|
|
4594
4604
|
|
|
4595
4605
|
// src/preview-api/modules/preview-web/PreviewWithSelection.tsx
|
|
4596
|
-
var
|
|
4597
|
-
function
|
|
4606
|
+
var Zi = globalThis;
|
|
4607
|
+
function ea(r) {
|
|
4598
4608
|
let e = r.composedPath && r.composedPath()[0] || r.target;
|
|
4599
4609
|
return /input|textarea/i.test(e.tagName) || e.getAttribute("contenteditable") !== null;
|
|
4600
4610
|
}
|
|
4601
|
-
n(
|
|
4602
|
-
var
|
|
4603
|
-
function
|
|
4604
|
-
return r?.includes(
|
|
4611
|
+
n(ea, "focusInInput");
|
|
4612
|
+
var Ho = "attached-mdx", ra = "unattached-mdx";
|
|
4613
|
+
function ta({ tags: r }) {
|
|
4614
|
+
return r?.includes(ra) || r?.includes(Ho);
|
|
4605
4615
|
}
|
|
4606
|
-
n(
|
|
4607
|
-
function
|
|
4616
|
+
n(ta, "isMdxEntry");
|
|
4617
|
+
function tt(r) {
|
|
4608
4618
|
return r.type === "story";
|
|
4609
4619
|
}
|
|
4610
|
-
n(
|
|
4611
|
-
function
|
|
4620
|
+
n(tt, "isStoryRender");
|
|
4621
|
+
function oa(r) {
|
|
4612
4622
|
return r.type === "docs";
|
|
4613
4623
|
}
|
|
4614
|
-
n(
|
|
4615
|
-
function
|
|
4616
|
-
return
|
|
4624
|
+
n(oa, "isDocsRender");
|
|
4625
|
+
function na(r) {
|
|
4626
|
+
return oa(r) && r.subtype === "csf";
|
|
4617
4627
|
}
|
|
4618
|
-
n(
|
|
4619
|
-
var
|
|
4628
|
+
n(na, "isCsfDocsRender");
|
|
4629
|
+
var ot = class ot extends ge {
|
|
4620
4630
|
constructor(t, o, s, i) {
|
|
4621
4631
|
super(t, o, void 0, !1);
|
|
4622
4632
|
this.importFn = t;
|
|
@@ -4625,16 +4635,13 @@ var Te = class extends Se {
|
|
|
4625
4635
|
this.view = i;
|
|
4626
4636
|
this.initialize();
|
|
4627
4637
|
}
|
|
4628
|
-
static {
|
|
4629
|
-
n(this, "PreviewWithSelection");
|
|
4630
|
-
}
|
|
4631
4638
|
setupListeners() {
|
|
4632
|
-
super.setupListeners(),
|
|
4633
|
-
|
|
4639
|
+
super.setupListeners(), Zi.onkeydown = this.onKeydown.bind(this), this.channel.on(Gi, this.onSetCurrentStory.bind(this)), this.channel.on(
|
|
4640
|
+
Ki, this.onUpdateQueryParams.bind(this)), this.channel.on(Bi, this.onPreloadStories.bind(this));
|
|
4634
4641
|
}
|
|
4635
4642
|
async setInitialGlobals() {
|
|
4636
4643
|
if (!this.storyStoreValue)
|
|
4637
|
-
throw new
|
|
4644
|
+
throw new rt({ methodName: "setInitialGlobals" });
|
|
4638
4645
|
let { globals: t } = this.selectionStore.selectionSpecifier || {};
|
|
4639
4646
|
t && this.storyStoreValue.userGlobals.updateFromPersisted(t), this.emitGlobals();
|
|
4640
4647
|
}
|
|
@@ -4645,7 +4652,7 @@ var Te = class extends Se {
|
|
|
4645
4652
|
// Use the selection specifier to choose a story, then render it
|
|
4646
4653
|
async selectSpecifiedStory() {
|
|
4647
4654
|
if (!this.storyStoreValue)
|
|
4648
|
-
throw new
|
|
4655
|
+
throw new rt({
|
|
4649
4656
|
methodName: "selectSpecifiedStory"
|
|
4650
4657
|
});
|
|
4651
4658
|
if (this.selectionStore.selection) {
|
|
@@ -4658,14 +4665,14 @@ var Te = class extends Se {
|
|
|
4658
4665
|
}
|
|
4659
4666
|
let { storySpecifier: t, args: o } = this.selectionStore.selectionSpecifier, s = this.storyStoreValue.storyIndex.entryFromSpecifier(t);
|
|
4660
4667
|
if (!s) {
|
|
4661
|
-
t === "*" ? this.renderStoryLoadingException(t, new
|
|
4668
|
+
t === "*" ? this.renderStoryLoadingException(t, new Xi()) : this.renderStoryLoadingException(
|
|
4662
4669
|
t,
|
|
4663
|
-
new
|
|
4670
|
+
new Qi({ storySpecifier: t.toString() })
|
|
4664
4671
|
);
|
|
4665
4672
|
return;
|
|
4666
4673
|
}
|
|
4667
4674
|
let { id: i, type: a } = s;
|
|
4668
|
-
this.selectionStore.setSelection({ storyId: i, viewMode: a }), this.channel.emit(
|
|
4675
|
+
this.selectionStore.setSelection({ storyId: i, viewMode: a }), this.channel.emit(Wi, this.selectionStore.selection), this.channel.emit(Bo,
|
|
4669
4676
|
this.selectionStore.selection), await this.renderSelection({ persistedArgs: o });
|
|
4670
4677
|
}
|
|
4671
4678
|
// EVENT HANDLERS
|
|
@@ -4684,23 +4691,23 @@ var Te = class extends Se {
|
|
|
4684
4691
|
selectSpecifiedStory();
|
|
4685
4692
|
}
|
|
4686
4693
|
onKeydown(t) {
|
|
4687
|
-
if (!this.storyRenders.find((o) => o.disableKeyListeners) && !
|
|
4694
|
+
if (!this.storyRenders.find((o) => o.disableKeyListeners) && !ea(t)) {
|
|
4688
4695
|
let { altKey: o, ctrlKey: s, metaKey: i, shiftKey: a, key: l, code: c, keyCode: d } = t;
|
|
4689
|
-
this.channel.emit(
|
|
4696
|
+
this.channel.emit(zi, {
|
|
4690
4697
|
event: { altKey: o, ctrlKey: s, metaKey: i, shiftKey: a, key: l, code: c, keyCode: d }
|
|
4691
4698
|
});
|
|
4692
4699
|
}
|
|
4693
4700
|
}
|
|
4694
4701
|
async onSetCurrentStory(t) {
|
|
4695
|
-
this.selectionStore.setSelection({ viewMode: "story", ...t }), await this.storeInitializationPromise, this.channel.emit(
|
|
4702
|
+
this.selectionStore.setSelection({ viewMode: "story", ...t }), await this.storeInitializationPromise, this.channel.emit(Bo, this.selectionStore.
|
|
4696
4703
|
selection), this.renderSelection();
|
|
4697
4704
|
}
|
|
4698
4705
|
onUpdateQueryParams(t) {
|
|
4699
4706
|
this.selectionStore.setQueryParams(t);
|
|
4700
4707
|
}
|
|
4701
4708
|
async onUpdateGlobals({ globals: t }) {
|
|
4702
|
-
let o = this.currentRender instanceof
|
|
4703
|
-
super.onUpdateGlobals({ globals: t, currentStory: o }), (this.currentRender instanceof
|
|
4709
|
+
let o = this.currentRender instanceof se && this.currentRender.story || void 0;
|
|
4710
|
+
super.onUpdateGlobals({ globals: t, currentStory: o }), (this.currentRender instanceof _e || this.currentRender instanceof Me) && await this.
|
|
4704
4711
|
currentRender.rerender?.();
|
|
4705
4712
|
}
|
|
4706
4713
|
async onUpdateArgs({ storyId: t, updatedArgs: o }) {
|
|
@@ -4718,34 +4725,34 @@ var Te = class extends Se {
|
|
|
4718
4725
|
async renderSelection({ persistedArgs: t } = {}) {
|
|
4719
4726
|
let { renderToCanvas: o } = this;
|
|
4720
4727
|
if (!this.storyStoreValue || !o)
|
|
4721
|
-
throw new
|
|
4728
|
+
throw new rt({ methodName: "renderSelection" });
|
|
4722
4729
|
let { selection: s } = this.selectionStore;
|
|
4723
4730
|
if (!s)
|
|
4724
4731
|
throw new Error("Cannot call renderSelection as no selection was made");
|
|
4725
4732
|
let { storyId: i } = s, a;
|
|
4726
4733
|
try {
|
|
4727
4734
|
a = await this.storyStoreValue.storyIdToEntry(i);
|
|
4728
|
-
} catch (
|
|
4729
|
-
this.currentRender && await this.teardownRender(this.currentRender), this.renderStoryLoadingException(i,
|
|
4735
|
+
} catch (h) {
|
|
4736
|
+
this.currentRender && await this.teardownRender(this.currentRender), this.renderStoryLoadingException(i, h);
|
|
4730
4737
|
return;
|
|
4731
4738
|
}
|
|
4732
4739
|
let l = this.currentSelection?.storyId !== i, c = this.currentRender?.type !== a.type;
|
|
4733
4740
|
a.type === "story" ? this.view.showPreparingStory({ immediate: c }) : this.view.showPreparingDocs({ immediate: c }), this.currentRender?.
|
|
4734
4741
|
isPreparing() && await this.teardownRender(this.currentRender);
|
|
4735
4742
|
let d;
|
|
4736
|
-
a.type === "story" ? d = new
|
|
4743
|
+
a.type === "story" ? d = new se(
|
|
4737
4744
|
this.channel,
|
|
4738
4745
|
this.storyStoreValue,
|
|
4739
4746
|
o,
|
|
4740
4747
|
this.mainStoryCallbacks(i),
|
|
4741
4748
|
i,
|
|
4742
4749
|
"story"
|
|
4743
|
-
) :
|
|
4750
|
+
) : ta(a) ? d = new _e(
|
|
4744
4751
|
this.channel,
|
|
4745
4752
|
this.storyStoreValue,
|
|
4746
4753
|
a,
|
|
4747
4754
|
this.mainStoryCallbacks(i)
|
|
4748
|
-
) : d = new
|
|
4755
|
+
) : d = new Me(
|
|
4749
4756
|
this.channel,
|
|
4750
4757
|
this.storyStoreValue,
|
|
4751
4758
|
a,
|
|
@@ -4757,54 +4764,54 @@ var Te = class extends Se {
|
|
|
4757
4764
|
this.currentRender = d;
|
|
4758
4765
|
try {
|
|
4759
4766
|
await d.prepare();
|
|
4760
|
-
} catch (
|
|
4761
|
-
u && await this.teardownRender(u),
|
|
4767
|
+
} catch (h) {
|
|
4768
|
+
u && await this.teardownRender(u), h !== X && this.renderStoryLoadingException(i, h);
|
|
4762
4769
|
return;
|
|
4763
4770
|
}
|
|
4764
4771
|
let y = !l && u && !d.isEqual(u);
|
|
4765
|
-
if (t &&
|
|
4766
|
-
this.currentRender = u, this.channel.emit(
|
|
4772
|
+
if (t && tt(d) && (er(!!d.story), this.storyStoreValue.args.updateFromPersisted(d.story, t)), u && !u.torndown && !l && !y && !c) {
|
|
4773
|
+
this.currentRender = u, this.channel.emit(Yi, i), this.view.showMain();
|
|
4767
4774
|
return;
|
|
4768
4775
|
}
|
|
4769
|
-
if (u && await this.teardownRender(u, { viewModeChanged: c }), p && (l || c) && this.channel.emit(
|
|
4770
|
-
|
|
4776
|
+
if (u && await this.teardownRender(u, { viewModeChanged: c }), p && (l || c) && this.channel.emit(Ui, i), tt(d)) {
|
|
4777
|
+
er(!!d.story);
|
|
4771
4778
|
let {
|
|
4772
|
-
parameters:
|
|
4773
|
-
initialArgs:
|
|
4779
|
+
parameters: h,
|
|
4780
|
+
initialArgs: g,
|
|
4774
4781
|
argTypes: b,
|
|
4775
|
-
unmappedArgs:
|
|
4782
|
+
unmappedArgs: m,
|
|
4776
4783
|
initialGlobals: T,
|
|
4777
|
-
userGlobals:
|
|
4784
|
+
userGlobals: x,
|
|
4778
4785
|
storyGlobals: f,
|
|
4779
|
-
globals:
|
|
4786
|
+
globals: S
|
|
4780
4787
|
} = this.storyStoreValue.getStoryContext(d.story);
|
|
4781
|
-
this.channel.emit(
|
|
4788
|
+
this.channel.emit(Vi, {
|
|
4782
4789
|
id: i,
|
|
4783
|
-
parameters:
|
|
4784
|
-
initialArgs:
|
|
4790
|
+
parameters: h,
|
|
4791
|
+
initialArgs: g,
|
|
4785
4792
|
argTypes: b,
|
|
4786
|
-
args:
|
|
4787
|
-
}), this.channel.emit(
|
|
4793
|
+
args: m
|
|
4794
|
+
}), this.channel.emit(zo, { userGlobals: x, storyGlobals: f, globals: S, initialGlobals: T });
|
|
4788
4795
|
} else {
|
|
4789
|
-
let { parameters:
|
|
4790
|
-
if (this.channel.emit(
|
|
4796
|
+
let { parameters: h } = this.storyStoreValue.projectAnnotations, { initialGlobals: g, globals: b } = this.storyStoreValue.userGlobals;
|
|
4797
|
+
if (this.channel.emit(zo, {
|
|
4791
4798
|
globals: b,
|
|
4792
|
-
initialGlobals:
|
|
4799
|
+
initialGlobals: g,
|
|
4793
4800
|
storyGlobals: {},
|
|
4794
4801
|
userGlobals: b
|
|
4795
|
-
}),
|
|
4802
|
+
}), na(d) || d.entry.tags?.includes(Ho)) {
|
|
4796
4803
|
if (!d.csfFiles)
|
|
4797
|
-
throw new
|
|
4798
|
-
({ parameters:
|
|
4804
|
+
throw new Ji({ storyId: i });
|
|
4805
|
+
({ parameters: h } = this.storyStoreValue.preparedMetaFromCSFFile({
|
|
4799
4806
|
csfFile: d.csfFiles[0]
|
|
4800
4807
|
}));
|
|
4801
4808
|
}
|
|
4802
|
-
this.channel.emit(
|
|
4809
|
+
this.channel.emit(qi, {
|
|
4803
4810
|
id: i,
|
|
4804
|
-
parameters:
|
|
4811
|
+
parameters: h
|
|
4805
4812
|
});
|
|
4806
4813
|
}
|
|
4807
|
-
|
|
4814
|
+
tt(d) ? (er(!!d.story), this.storyRenders.push(d), this.currentRender.renderToElement(
|
|
4808
4815
|
this.view.prepareForStory(d.story)
|
|
4809
4816
|
)) : this.currentRender.renderToElement(
|
|
4810
4817
|
this.view.prepareForDocs(),
|
|
@@ -4828,39 +4835,41 @@ var Te = class extends Se {
|
|
|
4828
4835
|
super.renderPreviewEntryError(t, o), this.view.showErrorDisplay(o);
|
|
4829
4836
|
}
|
|
4830
4837
|
renderMissingStory() {
|
|
4831
|
-
this.view.showNoPreview(), this.channel.emit(
|
|
4838
|
+
this.view.showNoPreview(), this.channel.emit(Go);
|
|
4832
4839
|
}
|
|
4833
4840
|
renderStoryLoadingException(t, o) {
|
|
4834
|
-
|
|
4841
|
+
rr.error(o), this.view.showErrorDisplay(o), this.channel.emit(Go, t);
|
|
4835
4842
|
}
|
|
4836
4843
|
// renderException is used if we fail to render the story and it is uncaught by the app layer
|
|
4837
4844
|
renderException(t, o) {
|
|
4838
4845
|
let { name: s = "Error", message: i = String(o), stack: a } = o;
|
|
4839
|
-
this.channel.emit(
|
|
4840
|
-
o),
|
|
4846
|
+
this.channel.emit($i, { name: s, message: i, stack: a }), this.channel.emit(Uo, { newPhase: "errored", storyId: t }), this.view.showErrorDisplay(
|
|
4847
|
+
o), rr.error(`Error rendering story '${t}':`), rr.error(o);
|
|
4841
4848
|
}
|
|
4842
4849
|
// renderError is used by the various app layers to inform the user they have done something
|
|
4843
4850
|
// wrong -- for instance returned the wrong thing from a story
|
|
4844
4851
|
renderError(t, { title: o, description: s }) {
|
|
4845
|
-
|
|
4852
|
+
rr.error(`Error rendering story ${o}: ${s}`), this.channel.emit(Hi, { title: o, description: s }), this.channel.emit(Uo, { newPhase: "er\
|
|
4846
4853
|
rored", storyId: t }), this.view.showErrorDisplay({
|
|
4847
4854
|
message: o,
|
|
4848
4855
|
stack: s
|
|
4849
4856
|
});
|
|
4850
4857
|
}
|
|
4851
4858
|
};
|
|
4859
|
+
n(ot, "PreviewWithSelection");
|
|
4860
|
+
var be = ot;
|
|
4852
4861
|
|
|
4853
4862
|
// src/preview-api/modules/preview-web/UrlStore.ts
|
|
4854
|
-
var
|
|
4855
|
-
import { global as
|
|
4863
|
+
var Ne = pe(ir(), 1);
|
|
4864
|
+
import { global as ka } from "@storybook/global";
|
|
4856
4865
|
|
|
4857
4866
|
// src/preview-api/modules/preview-web/parseArgsParam.ts
|
|
4858
|
-
import { once as
|
|
4859
|
-
var
|
|
4860
|
-
var
|
|
4861
|
-
|
|
4862
|
-
typeof e == "boolean" ? !0 : typeof e == "string" ?
|
|
4863
|
-
r, t)) : k(e) ? Object.entries(e).every(([t, o]) =>
|
|
4867
|
+
import { once as Ia } from "storybook/internal/client-logger";
|
|
4868
|
+
var on = pe(ir(), 1);
|
|
4869
|
+
var tn = /^[a-zA-Z0-9 _-]*$/, nn = /^-?[0-9]+(\.[0-9]+)?$/, Oa = /^#([a-f0-9]{3,4}|[a-f0-9]{6}|[a-f0-9]{8})$/i, sn = /^(rgba?|hsla?)\(([0-9]{1,3}),\s?([0-9]{1,3})%?,\s?([0-9]{1,3})%?,?\s?([0-9](\.[0-9]{1,2})?)?\)$/i,
|
|
4870
|
+
dt = /* @__PURE__ */ n((r = "", e) => r === null || r === "" || !tn.test(r) ? !1 : e == null || e instanceof Date || typeof e == "number" ||
|
|
4871
|
+
typeof e == "boolean" ? !0 : typeof e == "string" ? tn.test(e) || nn.test(e) || Oa.test(e) || sn.test(e) : Array.isArray(e) ? e.every((t) => dt(
|
|
4872
|
+
r, t)) : k(e) ? Object.entries(e).every(([t, o]) => dt(t, o)) : !1, "validateArgs"), Da = {
|
|
4864
4873
|
delimiter: ";",
|
|
4865
4874
|
// we're parsing a single query param
|
|
4866
4875
|
nesting: !0,
|
|
@@ -4882,17 +4891,17 @@ r, t)) : k(e) ? Object.entries(e).every(([t, o]) => Kr(t, o)) : !1, "validateArg
|
|
|
4882
4891
|
return new Date(r.replaceAll(" ", "+").slice(6, -1));
|
|
4883
4892
|
if (r.startsWith("!hex(") && r.endsWith(")"))
|
|
4884
4893
|
return `#${r.slice(5, -1)}`;
|
|
4885
|
-
let e = r.slice(1).match(
|
|
4894
|
+
let e = r.slice(1).match(sn);
|
|
4886
4895
|
if (e)
|
|
4887
4896
|
return r.startsWith("!rgba") || r.startsWith("!RGBA") ? `${e[1]}(${e[2]}, ${e[3]}, ${e[4]}, ${e[5]})` : r.startsWith("!hsla") || r.startsWith(
|
|
4888
4897
|
"!HSLA") ? `${e[1]}(${e[2]}, ${e[3]}%, ${e[4]}%, ${e[5]})` : r.startsWith("!rgb") || r.startsWith("!RGB") ? `${e[1]}(${e[2]}, ${e[3]}\
|
|
4889
4898
|
, ${e[4]})` : `${e[1]}(${e[2]}, ${e[3]}%, ${e[4]}%)`;
|
|
4890
4899
|
}
|
|
4891
|
-
return
|
|
4900
|
+
return nn.test(r) ? Number(r) : r;
|
|
4892
4901
|
}
|
|
4893
|
-
},
|
|
4902
|
+
}, pt = /* @__PURE__ */ n((r) => {
|
|
4894
4903
|
let e = r.split(";").map((t) => t.replace("=", "~").replace(":", "="));
|
|
4895
|
-
return Object.entries((0,
|
|
4904
|
+
return Object.entries((0, on.parse)(e.join(";"), Da)).reduce((t, [o, s]) => dt(o, s) ? Object.assign(t, { [o]: s }) : (Ia.warn(P`
|
|
4896
4905
|
Omitted potentially unsafe URL args.
|
|
4897
4906
|
|
|
4898
4907
|
More info: https://storybook.js.org/docs/writing-stories/args#setting-args-through-the-url
|
|
@@ -4900,89 +4909,88 @@ r, t)) : k(e) ? Object.entries(e).every(([t, o]) => Kr(t, o)) : !1, "validateArg
|
|
|
4900
4909
|
}, "parseArgsParam");
|
|
4901
4910
|
|
|
4902
4911
|
// src/preview-api/modules/preview-web/UrlStore.ts
|
|
4903
|
-
var { history:
|
|
4904
|
-
function
|
|
4912
|
+
var { history: an, document: Q } = ka;
|
|
4913
|
+
function ja(r) {
|
|
4905
4914
|
let e = (r || "").match(/^\/story\/(.+)/);
|
|
4906
4915
|
if (!e)
|
|
4907
4916
|
throw new Error(`Invalid path '${r}', must start with '/story/'`);
|
|
4908
4917
|
return e[1];
|
|
4909
4918
|
}
|
|
4910
|
-
n(
|
|
4911
|
-
var
|
|
4919
|
+
n(ja, "pathToId");
|
|
4920
|
+
var ln = /* @__PURE__ */ n(({
|
|
4912
4921
|
selection: r,
|
|
4913
4922
|
extraParams: e
|
|
4914
4923
|
}) => {
|
|
4915
|
-
let t =
|
|
4916
|
-
return `?${(0,
|
|
4924
|
+
let t = Q?.location.search.slice(1), { path: o, selectedKind: s, selectedStory: i, ...a } = (0, Ne.parse)(t);
|
|
4925
|
+
return `?${(0, Ne.stringify)({
|
|
4917
4926
|
...a,
|
|
4918
4927
|
...e,
|
|
4919
4928
|
...r && { id: r.storyId, viewMode: r.viewMode }
|
|
4920
4929
|
})}`;
|
|
4921
|
-
}, "getQueryString"),
|
|
4930
|
+
}, "getQueryString"), Ma = /* @__PURE__ */ n((r) => {
|
|
4922
4931
|
if (!r)
|
|
4923
4932
|
return;
|
|
4924
|
-
let e =
|
|
4925
|
-
|
|
4926
|
-
}, "setPath"),
|
|
4933
|
+
let e = ln({ selection: r }), { hash: t = "" } = Q.location;
|
|
4934
|
+
Q.title = r.storyId, an.replaceState({}, "", `${Q.location.pathname}${e}${t}`);
|
|
4935
|
+
}, "setPath"), _a = /* @__PURE__ */ n((r) => r != null && typeof r == "object" && Array.isArray(r) === !1, "isObject"), Le = /* @__PURE__ */ n(
|
|
4927
4936
|
(r) => {
|
|
4928
4937
|
if (r !== void 0) {
|
|
4929
4938
|
if (typeof r == "string")
|
|
4930
4939
|
return r;
|
|
4931
4940
|
if (Array.isArray(r))
|
|
4932
|
-
return
|
|
4933
|
-
if (
|
|
4934
|
-
return
|
|
4941
|
+
return Le(r[0]);
|
|
4942
|
+
if (_a(r))
|
|
4943
|
+
return Le(
|
|
4935
4944
|
Object.values(r).filter(Boolean)
|
|
4936
4945
|
);
|
|
4937
4946
|
}
|
|
4938
|
-
}, "getFirstString"),
|
|
4939
|
-
if (typeof
|
|
4940
|
-
let r =
|
|
4941
|
-
string" ?
|
|
4947
|
+
}, "getFirstString"), La = /* @__PURE__ */ n(() => {
|
|
4948
|
+
if (typeof Q < "u") {
|
|
4949
|
+
let r = Q.location.search.slice(1), e = (0, Ne.parse)(r), t = typeof e.args == "string" ? pt(e.args) : void 0, o = typeof e.globals == "\
|
|
4950
|
+
string" ? pt(e.globals) : void 0, s = Le(e.viewMode);
|
|
4942
4951
|
(typeof s != "string" || !s.match(/docs|story/)) && (s = "story");
|
|
4943
|
-
let i =
|
|
4952
|
+
let i = Le(e.path), a = i ? ja(i) : Le(e.id);
|
|
4944
4953
|
if (a)
|
|
4945
4954
|
return { storySpecifier: a, args: t, globals: o, viewMode: s };
|
|
4946
4955
|
}
|
|
4947
4956
|
return null;
|
|
4948
|
-
}, "getSelectionSpecifierFromPath"),
|
|
4949
|
-
static {
|
|
4950
|
-
n(this, "UrlStore");
|
|
4951
|
-
}
|
|
4957
|
+
}, "getSelectionSpecifierFromPath"), ut = class ut {
|
|
4952
4958
|
constructor() {
|
|
4953
|
-
this.selectionSpecifier =
|
|
4959
|
+
this.selectionSpecifier = La();
|
|
4954
4960
|
}
|
|
4955
4961
|
setSelection(e) {
|
|
4956
|
-
this.selection = e,
|
|
4962
|
+
this.selection = e, Ma(this.selection);
|
|
4957
4963
|
}
|
|
4958
4964
|
setQueryParams(e) {
|
|
4959
|
-
let t =
|
|
4960
|
-
|
|
4965
|
+
let t = ln({ extraParams: e }), { hash: o = "" } = Q.location;
|
|
4966
|
+
an.replaceState({}, "", `${Q.location.pathname}${t}${o}`);
|
|
4961
4967
|
}
|
|
4962
4968
|
};
|
|
4969
|
+
n(ut, "UrlStore");
|
|
4970
|
+
var Se = ut;
|
|
4963
4971
|
|
|
4964
4972
|
// src/preview-api/modules/preview-web/WebView.ts
|
|
4965
|
-
var
|
|
4966
|
-
import { logger as
|
|
4967
|
-
import { global as
|
|
4968
|
-
var { document: D } =
|
|
4969
|
-
_STORY", i.PREPARING_DOCS = "PREPARING_DOCS", i.ERROR = "ERROR", i))(
|
|
4973
|
+
var Bn = pe(Ln(), 1), zn = pe(ir(), 1);
|
|
4974
|
+
import { logger as bl } from "storybook/internal/client-logger";
|
|
4975
|
+
import { global as Sl } from "@storybook/global";
|
|
4976
|
+
var { document: D } = Sl, Nn = 100, Gn = /* @__PURE__ */ ((i) => (i.MAIN = "MAIN", i.NOPREVIEW = "NOPREVIEW", i.PREPARING_STORY = "PREPARING\
|
|
4977
|
+
_STORY", i.PREPARING_DOCS = "PREPARING_DOCS", i.ERROR = "ERROR", i))(Gn || {}), St = {
|
|
4970
4978
|
PREPARING_STORY: "sb-show-preparing-story",
|
|
4971
4979
|
PREPARING_DOCS: "sb-show-preparing-docs",
|
|
4972
4980
|
MAIN: "sb-show-main",
|
|
4973
4981
|
NOPREVIEW: "sb-show-nopreview",
|
|
4974
4982
|
ERROR: "sb-show-errordisplay"
|
|
4975
|
-
},
|
|
4983
|
+
}, Tt = {
|
|
4976
4984
|
centered: "sb-main-centered",
|
|
4977
4985
|
fullscreen: "sb-main-fullscreen",
|
|
4978
4986
|
padded: "sb-main-padded"
|
|
4979
|
-
},
|
|
4987
|
+
}, qn = new Bn.default({
|
|
4980
4988
|
escapeXML: !0
|
|
4981
|
-
}),
|
|
4989
|
+
}), xt = class xt {
|
|
4982
4990
|
constructor() {
|
|
4983
4991
|
this.testing = !1;
|
|
4984
4992
|
if (typeof D < "u") {
|
|
4985
|
-
let { __SPECIAL_TEST_PARAMETER__: e } = (0,
|
|
4993
|
+
let { __SPECIAL_TEST_PARAMETER__: e } = (0, zn.parse)(D.location.search.slice(1));
|
|
4986
4994
|
switch (e) {
|
|
4987
4995
|
case "preparing-story": {
|
|
4988
4996
|
this.showPreparingStory(), this.testing = !0;
|
|
@@ -4996,9 +5004,6 @@ _STORY", i.PREPARING_DOCS = "PREPARING_DOCS", i.ERROR = "ERROR", i))(Rn || {}),
|
|
|
4996
5004
|
}
|
|
4997
5005
|
}
|
|
4998
5006
|
}
|
|
4999
|
-
static {
|
|
5000
|
-
n(this, "WebView");
|
|
5001
|
-
}
|
|
5002
5007
|
// Get ready to render a story, returning the element to render to
|
|
5003
5008
|
prepareForStory(e) {
|
|
5004
5009
|
return this.showStory(), this.applyLayout(e.parameters.layout), D.documentElement.scrollTop = 0, D.documentElement.scrollLeft = 0, this.
|
|
@@ -5020,27 +5025,27 @@ _STORY", i.PREPARING_DOCS = "PREPARING_DOCS", i.ERROR = "ERROR", i))(Rn || {}),
|
|
|
5020
5025
|
return;
|
|
5021
5026
|
}
|
|
5022
5027
|
this.checkIfLayoutExists(e);
|
|
5023
|
-
let t =
|
|
5028
|
+
let t = Tt[e];
|
|
5024
5029
|
D.body.classList.remove(this.currentLayoutClass), D.body.classList.add(t), this.currentLayoutClass = t;
|
|
5025
5030
|
}
|
|
5026
5031
|
checkIfLayoutExists(e) {
|
|
5027
|
-
|
|
5032
|
+
Tt[e] || bl.warn(
|
|
5028
5033
|
P`
|
|
5029
5034
|
The desired layout: ${e} is not a valid option.
|
|
5030
|
-
The possible options are: ${Object.keys(
|
|
5035
|
+
The possible options are: ${Object.keys(Tt).join(", ")}, none.
|
|
5031
5036
|
`
|
|
5032
5037
|
);
|
|
5033
5038
|
}
|
|
5034
5039
|
showMode(e) {
|
|
5035
|
-
clearTimeout(this.preparingTimeout), Object.keys(
|
|
5036
|
-
t === e ? D.body.classList.add(
|
|
5040
|
+
clearTimeout(this.preparingTimeout), Object.keys(Gn).forEach((t) => {
|
|
5041
|
+
t === e ? D.body.classList.add(St[t]) : D.body.classList.remove(St[t]);
|
|
5037
5042
|
});
|
|
5038
5043
|
}
|
|
5039
5044
|
showErrorDisplay({ message: e = "", stack: t = "" }) {
|
|
5040
5045
|
let o = e, s = t, i = e.split(`
|
|
5041
5046
|
`);
|
|
5042
5047
|
i.length > 1 && ([o] = i, s = i.slice(1).join(`
|
|
5043
|
-
`).replace(/^\n/, "")), D.getElementById("error-message").innerHTML =
|
|
5048
|
+
`).replace(/^\n/, "")), D.getElementById("error-message").innerHTML = qn.toHtml(o), D.getElementById("error-stack").innerHTML = qn.toHtml(s),
|
|
5044
5049
|
this.showMode("ERROR");
|
|
5045
5050
|
}
|
|
5046
5051
|
showNoPreview() {
|
|
@@ -5050,12 +5055,12 @@ true"));
|
|
|
5050
5055
|
showPreparingStory({ immediate: e = !1 } = {}) {
|
|
5051
5056
|
clearTimeout(this.preparingTimeout), e ? this.showMode("PREPARING_STORY") : this.preparingTimeout = setTimeout(
|
|
5052
5057
|
() => this.showMode("PREPARING_STORY"),
|
|
5053
|
-
|
|
5058
|
+
Nn
|
|
5054
5059
|
);
|
|
5055
5060
|
}
|
|
5056
5061
|
showPreparingDocs({ immediate: e = !1 } = {}) {
|
|
5057
5062
|
clearTimeout(this.preparingTimeout), e ? this.showMode("PREPARING_DOCS") : this.preparingTimeout = setTimeout(() => this.showMode("PREPA\
|
|
5058
|
-
RING_DOCS"),
|
|
5063
|
+
RING_DOCS"), Nn);
|
|
5059
5064
|
}
|
|
5060
5065
|
showMain() {
|
|
5061
5066
|
this.showMode("MAIN");
|
|
@@ -5067,26 +5072,27 @@ RING_DOCS"), bn);
|
|
|
5067
5072
|
this.docsRoot().setAttribute("hidden", "true"), this.storyRoot().removeAttribute("hidden");
|
|
5068
5073
|
}
|
|
5069
5074
|
showStoryDuringRender() {
|
|
5070
|
-
D.body.classList.add(
|
|
5075
|
+
D.body.classList.add(St.MAIN);
|
|
5071
5076
|
}
|
|
5072
5077
|
};
|
|
5078
|
+
n(xt, "WebView");
|
|
5079
|
+
var Te = xt;
|
|
5073
5080
|
|
|
5074
5081
|
// src/preview-api/modules/preview-web/PreviewWeb.tsx
|
|
5075
|
-
var
|
|
5082
|
+
var Rt = class Rt extends be {
|
|
5076
5083
|
constructor(t, o) {
|
|
5077
|
-
super(t, o, new
|
|
5084
|
+
super(t, o, new Se(), new Te());
|
|
5078
5085
|
this.importFn = t;
|
|
5079
5086
|
this.getProjectAnnotations = o;
|
|
5080
|
-
|
|
5081
|
-
}
|
|
5082
|
-
static {
|
|
5083
|
-
n(this, "PreviewWeb");
|
|
5087
|
+
Tl.__STORYBOOK_PREVIEW__ = this;
|
|
5084
5088
|
}
|
|
5085
5089
|
};
|
|
5090
|
+
n(Rt, "PreviewWeb");
|
|
5091
|
+
var yr = Rt;
|
|
5086
5092
|
|
|
5087
5093
|
// src/preview-api/modules/preview-web/simulate-pageload.ts
|
|
5088
|
-
import { global as
|
|
5089
|
-
var { document:
|
|
5094
|
+
import { global as xl } from "@storybook/global";
|
|
5095
|
+
var { document: ce } = xl, Rl = [
|
|
5090
5096
|
"application/javascript",
|
|
5091
5097
|
"application/ecmascript",
|
|
5092
5098
|
"application/x-ecmascript",
|
|
@@ -5105,103 +5111,103 @@ var { document: pe } = rl, tl = [
|
|
|
5105
5111
|
"text/x-javascript",
|
|
5106
5112
|
// Support modern javascript
|
|
5107
5113
|
"module"
|
|
5108
|
-
],
|
|
5109
|
-
function
|
|
5110
|
-
let r =
|
|
5111
|
-
r.initEvent("DOMContentLoaded", !0, !0),
|
|
5114
|
+
], wl = "script", Un = "scripts-root";
|
|
5115
|
+
function mr() {
|
|
5116
|
+
let r = ce.createEvent("Event");
|
|
5117
|
+
r.initEvent("DOMContentLoaded", !0, !0), ce.dispatchEvent(r);
|
|
5112
5118
|
}
|
|
5113
|
-
n(
|
|
5114
|
-
function
|
|
5115
|
-
let o =
|
|
5119
|
+
n(mr, "simulateDOMContentLoaded");
|
|
5120
|
+
function Al(r, e, t) {
|
|
5121
|
+
let o = ce.createElement("script");
|
|
5116
5122
|
o.type = r.type === "module" ? "module" : "text/javascript", r.src ? (o.onload = e, o.onerror = e, o.src = r.src) : o.textContent = r.innerText,
|
|
5117
|
-
t ? t.appendChild(o) :
|
|
5123
|
+
t ? t.appendChild(o) : ce.head.appendChild(o), r.parentNode.removeChild(r), r.src || e();
|
|
5118
5124
|
}
|
|
5119
|
-
n(
|
|
5120
|
-
function
|
|
5125
|
+
n(Al, "insertScript");
|
|
5126
|
+
function Hn(r, e, t = 0) {
|
|
5121
5127
|
r[t](() => {
|
|
5122
|
-
t++, t === r.length ? e() :
|
|
5128
|
+
t++, t === r.length ? e() : Hn(r, e, t);
|
|
5123
5129
|
});
|
|
5124
5130
|
}
|
|
5125
|
-
n(
|
|
5126
|
-
function
|
|
5127
|
-
let e =
|
|
5128
|
-
e ? e.innerHTML = "" : (e =
|
|
5129
|
-
let t = Array.from(r.querySelectorAll(
|
|
5131
|
+
n(Hn, "insertScriptsSequentially");
|
|
5132
|
+
function Vn(r) {
|
|
5133
|
+
let e = ce.getElementById(Un);
|
|
5134
|
+
e ? e.innerHTML = "" : (e = ce.createElement("div"), e.id = Un, ce.body.appendChild(e));
|
|
5135
|
+
let t = Array.from(r.querySelectorAll(wl));
|
|
5130
5136
|
if (t.length) {
|
|
5131
5137
|
let o = [];
|
|
5132
5138
|
t.forEach((s) => {
|
|
5133
5139
|
let i = s.getAttribute("type");
|
|
5134
|
-
(!i ||
|
|
5135
|
-
}), o.length &&
|
|
5140
|
+
(!i || Rl.includes(i)) && o.push((a) => Al(s, a, e));
|
|
5141
|
+
}), o.length && Hn(o, mr, void 0);
|
|
5136
5142
|
} else
|
|
5137
|
-
|
|
5143
|
+
mr();
|
|
5138
5144
|
}
|
|
5139
|
-
n(
|
|
5145
|
+
n(Vn, "simulatePageLoad");
|
|
5140
5146
|
|
|
5141
5147
|
// src/docs-tools/shared.ts
|
|
5142
|
-
var
|
|
5143
|
-
var
|
|
5148
|
+
var Wn = "storybook/docs", oy = `${Wn}/panel`;
|
|
5149
|
+
var $n = `${Wn}/snippet-rendered`;
|
|
5144
5150
|
|
|
5145
5151
|
// src/preview-api/modules/preview-web/emitTransformCode.ts
|
|
5146
|
-
async function
|
|
5152
|
+
async function Yn(r, e) {
|
|
5147
5153
|
let t = e.parameters?.docs?.source?.transform, { id: o, unmappedArgs: s } = e, i = t && r ? t?.(r, e) : r, a = i ? await i : void 0;
|
|
5148
|
-
_.getChannel().emit(
|
|
5154
|
+
_.getChannel().emit($n, {
|
|
5149
5155
|
id: o,
|
|
5150
5156
|
source: a,
|
|
5151
5157
|
args: s
|
|
5152
5158
|
});
|
|
5153
5159
|
}
|
|
5154
|
-
n(
|
|
5160
|
+
n(Yn, "emitTransformCode");
|
|
5155
5161
|
export {
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5162
|
+
J as DocsContext,
|
|
5163
|
+
re as HooksContext,
|
|
5164
|
+
ge as Preview,
|
|
5165
|
+
yr as PreviewWeb,
|
|
5166
|
+
be as PreviewWithSelection,
|
|
5167
|
+
ne as ReporterAPI,
|
|
5168
|
+
he as StoryStore,
|
|
5169
|
+
Se as UrlStore,
|
|
5170
|
+
Te as WebView,
|
|
5165
5171
|
_ as addons,
|
|
5166
|
-
|
|
5167
|
-
|
|
5172
|
+
wr as applyHooks,
|
|
5173
|
+
Fe as combineArgs,
|
|
5168
5174
|
L as combineParameters,
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5175
|
+
Y as composeConfigs,
|
|
5176
|
+
Hr as composeStepRunners,
|
|
5177
|
+
ti as composeStories,
|
|
5178
|
+
vo as composeStory,
|
|
5179
|
+
oi as createPlaywrightTest,
|
|
5180
|
+
Ro as decorateStory,
|
|
5181
|
+
Br as defaultDecorateStory,
|
|
5182
|
+
os as definePreview,
|
|
5183
|
+
Yn as emitTransformCode,
|
|
5184
|
+
Je as filterArgTypes,
|
|
5185
|
+
Pe as getCoreAnnotations,
|
|
5186
|
+
Wr as getCsfFactoryAnnotations,
|
|
5187
|
+
De as inferControls,
|
|
5188
|
+
Ts as makeDecorator,
|
|
5189
|
+
gr as mockChannel,
|
|
5190
|
+
me as normalizeProjectAnnotations,
|
|
5191
|
+
ye as normalizeStory,
|
|
5192
|
+
zr as prepareMeta,
|
|
5193
|
+
Oe as prepareStory,
|
|
5194
|
+
wo as sanitizeStoryContextUpdate,
|
|
5195
|
+
Xs as setDefaultProjectAnnotations,
|
|
5196
|
+
ei as setProjectAnnotations,
|
|
5197
|
+
mr as simulateDOMContentLoaded,
|
|
5198
|
+
Vn as simulatePageLoad,
|
|
5199
|
+
ui as sortStoriesV7,
|
|
5200
|
+
bs as useArgs,
|
|
5201
|
+
Ee as useCallback,
|
|
5202
|
+
hs as useChannel,
|
|
5203
|
+
Ft as useEffect,
|
|
5204
|
+
Ss as useGlobals,
|
|
5205
|
+
ps as useMemo,
|
|
5206
|
+
gs as useParameter,
|
|
5207
|
+
ms as useReducer,
|
|
5208
|
+
us as useRef,
|
|
5209
|
+
ys as useState,
|
|
5210
|
+
Ue as useStoryContext,
|
|
5211
|
+
di as userOrAutoTitle,
|
|
5212
|
+
Io as userOrAutoTitleFromSpecifier
|
|
5207
5213
|
};
|