@iress-oss/ids-storybook-config 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/main.js +73 -63
- package/dist/types.d.ts +34 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -19,7 +19,7 @@ function Ze(e) {
|
|
|
19
19
|
e !== null && (e < 32 || e === 127)
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function z(e) {
|
|
23
23
|
return e !== null && e < -2;
|
|
24
24
|
}
|
|
25
25
|
function A(e) {
|
|
@@ -419,7 +419,7 @@ function Lt() {
|
|
|
419
419
|
}
|
|
420
420
|
};
|
|
421
421
|
}
|
|
422
|
-
function
|
|
422
|
+
function It(e) {
|
|
423
423
|
let n = !1;
|
|
424
424
|
return e && e.firstLineBlank && (n = !0), {
|
|
425
425
|
handlers: { footnoteDefinition: t, footnoteReference: we },
|
|
@@ -436,12 +436,12 @@ function zt(e) {
|
|
|
436
436
|
(n ? `
|
|
437
437
|
` : " ") + a.indentLines(
|
|
438
438
|
a.containerFlow(i, u.current()),
|
|
439
|
-
n ? ye :
|
|
439
|
+
n ? ye : zt
|
|
440
440
|
)
|
|
441
441
|
)), s(), o;
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function zt(e, n, t) {
|
|
445
445
|
return n === 0 ? e : ye(e, n, t);
|
|
446
446
|
}
|
|
447
447
|
function ye(e, n, t) {
|
|
@@ -455,7 +455,7 @@ const Pt = [
|
|
|
455
455
|
"titleQuote",
|
|
456
456
|
"titleApostrophe"
|
|
457
457
|
];
|
|
458
|
-
Ce.peek =
|
|
458
|
+
Ce.peek = Ht;
|
|
459
459
|
function _t() {
|
|
460
460
|
return {
|
|
461
461
|
canContainEols: ["delete"],
|
|
@@ -490,13 +490,13 @@ function Ce(e, n, t, i) {
|
|
|
490
490
|
after: "~"
|
|
491
491
|
}), r += l.move("~~"), a(), r;
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function Ht() {
|
|
494
494
|
return "~";
|
|
495
495
|
}
|
|
496
496
|
function Bt(e) {
|
|
497
497
|
return e.length;
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function jt(e, n) {
|
|
500
500
|
const t = n || {}, i = (t.align || []).concat(), l = t.stringLength || Bt, a = [], r = [], u = [], o = [];
|
|
501
501
|
let s = 0, f = -1;
|
|
502
502
|
for (; ++f < e.length; ) {
|
|
@@ -934,8 +934,8 @@ function Le(e, n) {
|
|
|
934
934
|
// references don’t work), space, or angle brackets…
|
|
935
935
|
!/[\0- <>\u007F]/.test(e.url));
|
|
936
936
|
}
|
|
937
|
-
|
|
938
|
-
function
|
|
937
|
+
Ie.peek = sn;
|
|
938
|
+
function Ie(e, n, t, i) {
|
|
939
939
|
const l = te(t), a = l === '"' ? "Quote" : "Apostrophe", r = t.createTracker(i);
|
|
940
940
|
let u, o;
|
|
941
941
|
if (Le(e, t)) {
|
|
@@ -979,8 +979,8 @@ function ze(e, n, t, i) {
|
|
|
979
979
|
function sn(e, n, t) {
|
|
980
980
|
return Le(e, t) ? "<" : "[";
|
|
981
981
|
}
|
|
982
|
-
|
|
983
|
-
function
|
|
982
|
+
ze.peek = cn;
|
|
983
|
+
function ze(e, n, t, i) {
|
|
984
984
|
const l = e.referenceType, a = t.enter("linkReference");
|
|
985
985
|
let r = t.enter("label");
|
|
986
986
|
const u = t.createTracker(i);
|
|
@@ -1191,8 +1191,8 @@ const Re = {
|
|
|
1191
1191
|
image: Ee,
|
|
1192
1192
|
imageReference: Te,
|
|
1193
1193
|
inlineCode: Fe,
|
|
1194
|
-
link:
|
|
1195
|
-
linkReference:
|
|
1194
|
+
link: Ie,
|
|
1195
|
+
linkReference: ze,
|
|
1196
1196
|
list: mn,
|
|
1197
1197
|
listItem: gn,
|
|
1198
1198
|
paragraph: kn,
|
|
@@ -1298,7 +1298,7 @@ function Ln(e) {
|
|
|
1298
1298
|
return x(), k(), w;
|
|
1299
1299
|
}
|
|
1300
1300
|
function s(g, m) {
|
|
1301
|
-
return
|
|
1301
|
+
return jt(g, {
|
|
1302
1302
|
align: m,
|
|
1303
1303
|
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
1304
1304
|
alignDelimiters: i,
|
|
@@ -1329,7 +1329,7 @@ function Ln(e) {
|
|
|
1329
1329
|
return d.stack.includes("tableCell") && (b = b.replace(/\|/g, "\\$&")), b;
|
|
1330
1330
|
}
|
|
1331
1331
|
}
|
|
1332
|
-
function
|
|
1332
|
+
function In() {
|
|
1333
1333
|
return {
|
|
1334
1334
|
exit: {
|
|
1335
1335
|
taskListCheckValueChecked: pe,
|
|
@@ -1338,7 +1338,7 @@ function zn() {
|
|
|
1338
1338
|
}
|
|
1339
1339
|
};
|
|
1340
1340
|
}
|
|
1341
|
-
function
|
|
1341
|
+
function zn() {
|
|
1342
1342
|
return {
|
|
1343
1343
|
unsafe: [{ atBreak: !0, character: "-", after: "[:|-]" }],
|
|
1344
1344
|
handlers: { listItem: _n }
|
|
@@ -1387,21 +1387,21 @@ function Rn() {
|
|
|
1387
1387
|
Lt(),
|
|
1388
1388
|
_t(),
|
|
1389
1389
|
vn(),
|
|
1390
|
-
|
|
1390
|
+
In()
|
|
1391
1391
|
];
|
|
1392
1392
|
}
|
|
1393
1393
|
function Mn(e) {
|
|
1394
1394
|
return {
|
|
1395
1395
|
extensions: [
|
|
1396
1396
|
ct(),
|
|
1397
|
-
|
|
1397
|
+
It(e),
|
|
1398
1398
|
Rt(),
|
|
1399
1399
|
Ln(e),
|
|
1400
|
-
|
|
1400
|
+
zn()
|
|
1401
1401
|
]
|
|
1402
1402
|
};
|
|
1403
1403
|
}
|
|
1404
|
-
function
|
|
1404
|
+
function j(e, n, t, i) {
|
|
1405
1405
|
const l = e.length;
|
|
1406
1406
|
let a = 0, r;
|
|
1407
1407
|
if (n < 0 ? n = -n > l ? 0 : l + n : n = n > l ? l : n, t = t > 0 ? t : 0, i.length < 1e4)
|
|
@@ -1415,10 +1415,10 @@ function On(e) {
|
|
|
1415
1415
|
const n = {};
|
|
1416
1416
|
let t = -1;
|
|
1417
1417
|
for (; ++t < e.length; )
|
|
1418
|
-
|
|
1418
|
+
Hn(n, e[t]);
|
|
1419
1419
|
return n;
|
|
1420
1420
|
}
|
|
1421
|
-
function
|
|
1421
|
+
function Hn(e, n) {
|
|
1422
1422
|
let t;
|
|
1423
1423
|
for (t in n) {
|
|
1424
1424
|
const l = (ge.call(e, t) ? e[t] : void 0) || (e[t] = {}), a = n[t];
|
|
@@ -1440,9 +1440,9 @@ function Bn(e, n) {
|
|
|
1440
1440
|
const i = [];
|
|
1441
1441
|
for (; ++t < n.length; )
|
|
1442
1442
|
(n[t].add === "after" ? e : i).push(n[t]);
|
|
1443
|
-
|
|
1443
|
+
j(e, 0, 0, i);
|
|
1444
1444
|
}
|
|
1445
|
-
const
|
|
1445
|
+
const jn = {
|
|
1446
1446
|
tokenize: Vn,
|
|
1447
1447
|
partial: !0
|
|
1448
1448
|
}, Me = {
|
|
@@ -1451,7 +1451,7 @@ const Hn = {
|
|
|
1451
1451
|
}, Oe = {
|
|
1452
1452
|
tokenize: Qn,
|
|
1453
1453
|
partial: !0
|
|
1454
|
-
},
|
|
1454
|
+
}, He = {
|
|
1455
1455
|
tokenize: Zn,
|
|
1456
1456
|
partial: !0
|
|
1457
1457
|
}, $n = {
|
|
@@ -1461,7 +1461,7 @@ const Hn = {
|
|
|
1461
1461
|
name: "wwwAutolink",
|
|
1462
1462
|
tokenize: Nn,
|
|
1463
1463
|
previous: $e
|
|
1464
|
-
},
|
|
1464
|
+
}, je = {
|
|
1465
1465
|
name: "protocolAutolink",
|
|
1466
1466
|
tokenize: Un,
|
|
1467
1467
|
previous: qe
|
|
@@ -1482,8 +1482,8 @@ S[43] = T;
|
|
|
1482
1482
|
S[45] = T;
|
|
1483
1483
|
S[46] = T;
|
|
1484
1484
|
S[95] = T;
|
|
1485
|
-
S[72] = [T,
|
|
1486
|
-
S[104] = [T,
|
|
1485
|
+
S[72] = [T, je];
|
|
1486
|
+
S[104] = [T, je];
|
|
1487
1487
|
S[87] = [T, Be];
|
|
1488
1488
|
S[119] = [T, Be];
|
|
1489
1489
|
function Wn(e, n, t) {
|
|
@@ -1510,7 +1510,7 @@ function Nn(e, n, t) {
|
|
|
1510
1510
|
const i = this;
|
|
1511
1511
|
return l;
|
|
1512
1512
|
function l(r) {
|
|
1513
|
-
return r !== 87 && r !== 119 || !$e.call(i, i.previous) || re(i.events) ? t(r) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(
|
|
1513
|
+
return r !== 87 && r !== 119 || !$e.call(i, i.previous) || re(i.events) ? t(r) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(jn, e.attempt(Me, e.attempt(Oe, a), t), t)(r));
|
|
1514
1514
|
}
|
|
1515
1515
|
function a(r) {
|
|
1516
1516
|
return e.exit("literalAutolinkWww"), e.exit("literalAutolink"), n(r);
|
|
@@ -1557,7 +1557,7 @@ function Gn(e, n, t) {
|
|
|
1557
1557
|
let i, l, a;
|
|
1558
1558
|
return r;
|
|
1559
1559
|
function r(s) {
|
|
1560
|
-
return s === 46 || s === 95 ? e.check(
|
|
1560
|
+
return s === 46 || s === 95 ? e.check(He, o, u)(s) : s === null || A(s) || L(s) || s !== 45 && W(s) ? o(s) : (a = !0, e.consume(s), r);
|
|
1561
1561
|
}
|
|
1562
1562
|
function u(s) {
|
|
1563
1563
|
return s === 95 ? i = !0 : (l = i, i = void 0), e.consume(s), r;
|
|
@@ -1570,7 +1570,7 @@ function Qn(e, n) {
|
|
|
1570
1570
|
let t = 0, i = 0;
|
|
1571
1571
|
return l;
|
|
1572
1572
|
function l(r) {
|
|
1573
|
-
return r === 40 ? (t++, e.consume(r), l) : r === 41 && i < t ? a(r) : r === 33 || r === 34 || r === 38 || r === 39 || r === 41 || r === 42 || r === 44 || r === 46 || r === 58 || r === 59 || r === 60 || r === 63 || r === 93 || r === 95 || r === 126 ? e.check(
|
|
1573
|
+
return r === 40 ? (t++, e.consume(r), l) : r === 41 && i < t ? a(r) : r === 33 || r === 34 || r === 38 || r === 39 || r === 41 || r === 42 || r === 44 || r === 46 || r === 58 || r === 59 || r === 60 || r === 63 || r === 93 || r === 95 || r === 126 ? e.check(He, n, a)(r) : r === null || A(r) || L(r) ? n(r) : (e.consume(r), l);
|
|
1574
1574
|
}
|
|
1575
1575
|
function a(r) {
|
|
1576
1576
|
return r === 41 && i++, e.consume(r), l;
|
|
@@ -1661,7 +1661,7 @@ function Yn(e, n, t) {
|
|
|
1661
1661
|
return D(a) ? E(e, l, "linePrefix")(a) : l(a);
|
|
1662
1662
|
}
|
|
1663
1663
|
function l(a) {
|
|
1664
|
-
return a === null ||
|
|
1664
|
+
return a === null || z(a) ? n(a) : t(a);
|
|
1665
1665
|
}
|
|
1666
1666
|
}
|
|
1667
1667
|
const er = {
|
|
@@ -1885,7 +1885,7 @@ function sr(e) {
|
|
|
1885
1885
|
start: Object.assign({}, r[s][1].end),
|
|
1886
1886
|
end: Object.assign({}, r[o][1].start)
|
|
1887
1887
|
}, p = [["enter", f, u], ["enter", r[s][1], u], ["exit", r[s][1], u], ["enter", c, u]], g = u.parser.constructs.insideSpan.null;
|
|
1888
|
-
g &&
|
|
1888
|
+
g && j(p, p.length, 0, Jn(g, r.slice(s + 1, o), u)), j(p, p.length, 0, [["exit", c, u], ["enter", r[o][1], u], ["exit", r[o][1], u], ["exit", f, u]]), j(r, s - 1, o - s + 3, p), o = s + p.length - 2;
|
|
1889
1889
|
break;
|
|
1890
1890
|
}
|
|
1891
1891
|
}
|
|
@@ -2031,7 +2031,7 @@ function pr(e, n, t) {
|
|
|
2031
2031
|
return h === 124 || (r = !0, a += 1), f(h);
|
|
2032
2032
|
}
|
|
2033
2033
|
function f(h) {
|
|
2034
|
-
return h === null ? t(h) :
|
|
2034
|
+
return h === null ? t(h) : z(h) ? a > 1 ? (a = 0, i.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(h), e.exit("lineEnding"), g) : t(h) : D(h) ? E(e, f, "whitespace")(h) : (a += 1, r && (r = !1, l += 1), h === 124 ? (e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), r = !0, f) : (e.enter("data"), c(h)));
|
|
2035
2035
|
}
|
|
2036
2036
|
function c(h) {
|
|
2037
2037
|
return h === null || h === 124 || A(h) ? (e.exit("data"), f(h)) : (e.consume(h), h === 92 ? p : c);
|
|
@@ -2049,7 +2049,7 @@ function pr(e, n, t) {
|
|
|
2049
2049
|
return D(h) ? E(e, b, "whitespace")(h) : b(h);
|
|
2050
2050
|
}
|
|
2051
2051
|
function b(h) {
|
|
2052
|
-
return h === 58 ? (a += 1, r = !0, e.enter("tableDelimiterMarker"), e.consume(h), e.exit("tableDelimiterMarker"), k) : h === 45 ? (a += 1, k(h)) : h === null ||
|
|
2052
|
+
return h === 58 ? (a += 1, r = !0, e.enter("tableDelimiterMarker"), e.consume(h), e.exit("tableDelimiterMarker"), k) : h === 45 ? (a += 1, k(h)) : h === null || z(h) ? v(h) : C(h);
|
|
2053
2053
|
}
|
|
2054
2054
|
function k(h) {
|
|
2055
2055
|
return h === 45 ? (e.enter("tableDelimiterFiller"), x(h)) : C(h);
|
|
@@ -2061,7 +2061,7 @@ function pr(e, n, t) {
|
|
|
2061
2061
|
return D(h) ? E(e, v, "whitespace")(h) : v(h);
|
|
2062
2062
|
}
|
|
2063
2063
|
function v(h) {
|
|
2064
|
-
return h === 124 ? m(h) : h === null ||
|
|
2064
|
+
return h === 124 ? m(h) : h === null || z(h) ? !r || l !== a ? C(h) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), n(h)) : C(h);
|
|
2065
2065
|
}
|
|
2066
2066
|
function C(h) {
|
|
2067
2067
|
return t(h);
|
|
@@ -2070,13 +2070,13 @@ function pr(e, n, t) {
|
|
|
2070
2070
|
return e.enter("tableRow"), O(h);
|
|
2071
2071
|
}
|
|
2072
2072
|
function O(h) {
|
|
2073
|
-
return h === 124 ? (e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), O) : h === null ||
|
|
2073
|
+
return h === 124 ? (e.enter("tableCellDivider"), e.consume(h), e.exit("tableCellDivider"), O) : h === null || z(h) ? (e.exit("tableRow"), n(h)) : D(h) ? E(e, O, "whitespace")(h) : (e.enter("data"), H(h));
|
|
2074
2074
|
}
|
|
2075
|
-
function
|
|
2076
|
-
return h === null || h === 124 || A(h) ? (e.exit("data"), O(h)) : (e.consume(h), h === 92 ? Ne :
|
|
2075
|
+
function H(h) {
|
|
2076
|
+
return h === null || h === 124 || A(h) ? (e.exit("data"), O(h)) : (e.consume(h), h === 92 ? Ne : H);
|
|
2077
2077
|
}
|
|
2078
2078
|
function Ne(h) {
|
|
2079
|
-
return h === 92 || h === 124 ? (e.consume(h),
|
|
2079
|
+
return h === 92 || h === 124 ? (e.consume(h), H) : H(h);
|
|
2080
2080
|
}
|
|
2081
2081
|
}
|
|
2082
2082
|
function gr(e, n) {
|
|
@@ -2104,15 +2104,15 @@ function gr(e, n) {
|
|
|
2104
2104
|
}
|
|
2105
2105
|
function B(e, n, t, i, l, a) {
|
|
2106
2106
|
const r = i === 1 ? "tableHeader" : i === 2 ? "tableDelimiter" : "tableData", u = "tableContent";
|
|
2107
|
-
t[0] !== 0 && (a.end = Object.assign({},
|
|
2108
|
-
const o =
|
|
2107
|
+
t[0] !== 0 && (a.end = Object.assign({}, I(n.events, t[0])), e.add(t[0], 0, [["exit", a, n]]));
|
|
2108
|
+
const o = I(n.events, t[1]);
|
|
2109
2109
|
if (a = {
|
|
2110
2110
|
type: r,
|
|
2111
2111
|
start: Object.assign({}, o),
|
|
2112
2112
|
// Note: correct end is set later.
|
|
2113
2113
|
end: Object.assign({}, o)
|
|
2114
2114
|
}, e.add(t[1], 0, [["enter", a, n]]), t[2] !== 0) {
|
|
2115
|
-
const s =
|
|
2115
|
+
const s = I(n.events, t[2]), f = I(n.events, t[3]), c = {
|
|
2116
2116
|
type: u,
|
|
2117
2117
|
start: Object.assign({}, s),
|
|
2118
2118
|
end: Object.assign({}, f)
|
|
@@ -2126,13 +2126,13 @@ function B(e, n, t, i, l, a) {
|
|
|
2126
2126
|
}
|
|
2127
2127
|
e.add(t[3] + 1, 0, [["exit", c, n]]);
|
|
2128
2128
|
}
|
|
2129
|
-
return l !== void 0 && (a.end = Object.assign({},
|
|
2129
|
+
return l !== void 0 && (a.end = Object.assign({}, I(n.events, l)), e.add(l, 0, [["exit", a, n]]), a = void 0), a;
|
|
2130
2130
|
}
|
|
2131
2131
|
function ke(e, n, t, i, l) {
|
|
2132
|
-
const a = [], r =
|
|
2132
|
+
const a = [], r = I(n.events, t);
|
|
2133
2133
|
l && (l.end = Object.assign({}, r), a.push(["exit", l, n])), i.end = Object.assign({}, r), a.push(["exit", i, n]), e.add(t + 1, 0, a);
|
|
2134
2134
|
}
|
|
2135
|
-
function
|
|
2135
|
+
function I(e, n) {
|
|
2136
2136
|
const t = e[n], i = t[0] === "enter" ? "start" : "end";
|
|
2137
2137
|
return t[1][i];
|
|
2138
2138
|
}
|
|
@@ -2165,7 +2165,7 @@ function br(e, n, t) {
|
|
|
2165
2165
|
return o === 93 ? (e.enter("taskListCheckMarker"), e.consume(o), e.exit("taskListCheckMarker"), e.exit("taskListCheck"), u) : t(o);
|
|
2166
2166
|
}
|
|
2167
2167
|
function u(o) {
|
|
2168
|
-
return
|
|
2168
|
+
return z(o) ? n(o) : D(o) ? e.check({
|
|
2169
2169
|
tokenize: xr
|
|
2170
2170
|
}, n, t)(o) : t(o);
|
|
2171
2171
|
}
|
|
@@ -2309,7 +2309,7 @@ const Ar = /* @__PURE__ */ Qe(import.meta.url), vr = /* @__PURE__ */ Ue(Ar), Sr
|
|
|
2309
2309
|
const frames = document.querySelectorAll('iframe');
|
|
2310
2310
|
frames.forEach((f) => {
|
|
2311
2311
|
try {
|
|
2312
|
-
f.contentWindow?.postMessage({ type: 'LOAD_THEME', data }, '*');
|
|
2312
|
+
f.contentWindow?.postMessage({ type: 'LOAD_THEME', ...data }, '*');
|
|
2313
2313
|
} catch (err) {
|
|
2314
2314
|
console.debug('[Storybook Host] Skipped frame broadcast:', err);
|
|
2315
2315
|
}
|
|
@@ -2331,29 +2331,39 @@ const Ar = /* @__PURE__ */ Qe(import.meta.url), vr = /* @__PURE__ */ Ue(Ar), Sr
|
|
|
2331
2331
|
|
|
2332
2332
|
const { name, href, css } = event.data;
|
|
2333
2333
|
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2334
|
+
let existingHref = document.getElementById('storybook-config-theme-href');
|
|
2335
|
+
let existingCss = document.getElementById('storybook-config-theme-css');
|
|
2336
|
+
const existingTheme = document.documentElement.getAttribute('data-theme');
|
|
2337
|
+
|
|
2338
|
+
if (existingTheme) {
|
|
2339
|
+
document.documentElement.classList.remove(existingTheme);
|
|
2339
2340
|
}
|
|
2340
2341
|
|
|
2341
|
-
if (
|
|
2342
|
-
|
|
2342
|
+
if (!name) {
|
|
2343
|
+
existingHref?.remove();
|
|
2344
|
+
existingCss?.remove();
|
|
2345
|
+
return;
|
|
2346
|
+
}
|
|
2343
2347
|
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
+
if (href) {
|
|
2349
|
+
if (!existingHref) {
|
|
2350
|
+
existingHref = document.createElement('link');
|
|
2351
|
+
existingHref.rel = 'stylesheet';
|
|
2352
|
+
existingHref.id = 'storybook-config-theme-href';
|
|
2353
|
+
document.head.appendChild(existingHref);
|
|
2348
2354
|
}
|
|
2349
2355
|
|
|
2350
|
-
|
|
2356
|
+
existingHref.href = href;
|
|
2351
2357
|
}
|
|
2352
2358
|
|
|
2353
|
-
|
|
2359
|
+
if (css) {
|
|
2360
|
+
if (!existingCss) {
|
|
2361
|
+
existingCss = document.createElement('style');
|
|
2362
|
+
existingCss.id = 'storybook-config-theme-css';
|
|
2363
|
+
document.head.appendChild(existingCss);
|
|
2364
|
+
}
|
|
2354
2365
|
|
|
2355
|
-
|
|
2356
|
-
document.documentElement.classList.remove(currentTheme);
|
|
2366
|
+
existingCss.innerHTML = css;
|
|
2357
2367
|
}
|
|
2358
2368
|
|
|
2359
2369
|
document.documentElement.setAttribute('data-theme', name);
|
package/dist/types.d.ts
CHANGED
|
@@ -9,3 +9,37 @@ export interface ParametersConfig {
|
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
export type ReactElementToJSXStringOptions = Exclude<Parameters<typeof reactElementToJSXString>[1], undefined>;
|
|
12
|
+
/**
|
|
13
|
+
* Event for broadcasting hash changes from a parent window to an iframe Storybook instance.
|
|
14
|
+
* Used to communicate hash changes between Storybook compositions.
|
|
15
|
+
*/
|
|
16
|
+
export interface BroadcastHashEvent {
|
|
17
|
+
type: 'UPDATE_HASH';
|
|
18
|
+
hash: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Event for passing theme data between the parent window and iframe Storybook instances.
|
|
22
|
+
* Used to synchronize themes across Storybook compositions.
|
|
23
|
+
*/
|
|
24
|
+
export interface PassThemeEvent {
|
|
25
|
+
type: 'PASS_THEME';
|
|
26
|
+
/**
|
|
27
|
+
* Name of the theme.
|
|
28
|
+
*/
|
|
29
|
+
name: string;
|
|
30
|
+
/**
|
|
31
|
+
* Optional href to a CSS file for the theme.
|
|
32
|
+
*/
|
|
33
|
+
href?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Optional raw CSS string for the theme.
|
|
36
|
+
*/
|
|
37
|
+
css?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Event for loading a theme in an iframe Storybook instance.
|
|
41
|
+
* Sent from the parent window to apply the selected theme.
|
|
42
|
+
*/
|
|
43
|
+
export interface LoadThemeEvent extends Omit<PassThemeEvent, 'type'> {
|
|
44
|
+
type: 'LOAD_THEME';
|
|
45
|
+
}
|