storybook 10.1.0-alpha.10 → 10.1.0-alpha.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/dist/_browser-chunks/Color-FTG7SQDA.js +1097 -0
- package/dist/_browser-chunks/WithTooltip-LMROHDUP.js +1651 -0
- package/dist/_browser-chunks/chunk-2FRVAXCZ.js +7 -0
- package/dist/_browser-chunks/chunk-3IAH5M2U.js +171 -0
- package/dist/_browser-chunks/chunk-3OXGAGBE.js +779 -0
- package/dist/_browser-chunks/{chunk-TMDZCWME.js → chunk-3PJE6VLG.js} +1 -3
- package/dist/_browser-chunks/{chunk-VAMFPZY3.js → chunk-45UGUKRX.js} +2 -7
- package/dist/_browser-chunks/chunk-6XWLIJQL.js +11 -0
- package/dist/_browser-chunks/{chunk-FDWKXLBI.js → chunk-74YHFU5B.js} +44 -109
- package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
- package/dist/_browser-chunks/chunk-AIOS4NGK.js +252 -0
- package/dist/_browser-chunks/chunk-AS2HQEYC.js +14 -0
- package/dist/_browser-chunks/chunk-AXG2BOBL.js +836 -0
- package/dist/_browser-chunks/chunk-BE2DAXKJ.js +2966 -0
- package/dist/_browser-chunks/{chunk-MH6AXFXB.js → chunk-CHUV5WSW.js} +0 -5
- package/dist/_browser-chunks/chunk-EBHB6RPS.js +61 -0
- package/dist/_browser-chunks/chunk-EUVGDK4H.js +93 -0
- package/dist/_browser-chunks/chunk-EZSQOHRI.js +18 -0
- package/dist/_browser-chunks/{chunk-CADGRH3P.js → chunk-FNXWN6IK.js} +3 -8
- package/dist/_browser-chunks/chunk-GFLS4VP3.js +64 -0
- package/dist/_browser-chunks/{chunk-L2D73C6Z.js → chunk-H6XK3RSC.js} +13 -21
- package/dist/_browser-chunks/chunk-IPA5A322.js +71 -0
- package/dist/_browser-chunks/chunk-JP7NCOJX.js +37 -0
- package/dist/_browser-chunks/chunk-KJHJLCBK.js +11 -0
- package/dist/_browser-chunks/{chunk-QMY4G4R2.js → chunk-L4RMQ7D7.js} +17 -64
- package/dist/_browser-chunks/{chunk-AB7OOPUX.js → chunk-QKODTO7K.js} +0 -5
- package/dist/_browser-chunks/chunk-RP5RXKFU.js +2491 -0
- package/dist/_browser-chunks/chunk-SL75JR6Y.js +9 -0
- package/dist/_browser-chunks/chunk-UD6FQLAF.js +1481 -0
- package/dist/_browser-chunks/chunk-VYJQ7RU5.js +2853 -0
- package/dist/_browser-chunks/chunk-WJYERY3R.js +136 -0
- package/dist/_browser-chunks/chunk-WXP2XJ3O.js +950 -0
- package/dist/_browser-chunks/chunk-X3DUQ5RA.js +47 -0
- package/dist/_browser-chunks/chunk-XJNX76GA.js +85 -0
- package/dist/_browser-chunks/{chunk-F4Q6SGTB.js → chunk-YKE5S47A.js} +177 -399
- package/dist/_browser-chunks/{chunk-SN4J4IQ3.js → chunk-ZUWEVLDX.js} +1 -7
- package/dist/_browser-chunks/{formatter-OMEEQ6HG.js → formatter-QJ4M4OGQ.js} +4 -9
- package/dist/_browser-chunks/{syntaxhighlighter-RJZASWHL.js → syntaxhighlighter-WKBQ5RC7.js} +704 -1848
- package/dist/_node-chunks/{builder-manager-HA7CYFCK.js → builder-manager-PMPHOSM2.js} +475 -1013
- package/dist/_node-chunks/camelcase-K3IOOFQW.js +18 -0
- package/dist/_node-chunks/{chunk-X4XU27M6.js → chunk-32NE3UE3.js} +15 -24
- package/dist/_node-chunks/chunk-4GZCFQFG.js +58 -0
- package/dist/_node-chunks/chunk-5QK5MSOI.js +943 -0
- package/dist/_node-chunks/{chunk-VPR5IBMG.js → chunk-6ZOLETQK.js} +8 -10
- package/dist/_node-chunks/chunk-7I22Y76Z.js +1047 -0
- package/dist/_node-chunks/chunk-AKTRSR3O.js +72 -0
- package/dist/_node-chunks/chunk-BBOP3XCK.js +119 -0
- package/dist/_node-chunks/chunk-C2GQVDWI.js +34 -0
- package/dist/_node-chunks/{chunk-ZHSCUGNP.js → chunk-GG2WQZSG.js} +3799 -7849
- package/dist/_node-chunks/chunk-GQJOWVVR.js +3214 -0
- package/dist/_node-chunks/chunk-JCRM2YVK.js +3009 -0
- package/dist/_node-chunks/chunk-KK4AT5F3.js +1029 -0
- package/dist/_node-chunks/chunk-L7MYXJUM.js +1114 -0
- package/dist/_node-chunks/{chunk-F3XOPI6H.js → chunk-LCZO45L7.js} +469 -983
- package/dist/_node-chunks/chunk-LR3QITDI.js +209 -0
- package/dist/_node-chunks/chunk-LXG4DK35.js +3171 -0
- package/dist/_node-chunks/chunk-MJ3WOS6F.js +37 -0
- package/dist/_node-chunks/chunk-PHOZWZZO.js +61 -0
- package/dist/_node-chunks/chunk-QECOQWRJ.js +936 -0
- package/dist/_node-chunks/chunk-QH4V5YDB.js +20 -0
- package/dist/_node-chunks/chunk-R6HWGZWD.js +26 -0
- package/dist/_node-chunks/chunk-SPQXMU2Q.js +759 -0
- package/dist/_node-chunks/chunk-TXZY6V6O.js +1564 -0
- package/dist/_node-chunks/chunk-UGDPX5LE.js +756 -0
- package/dist/_node-chunks/chunk-UY26MQLT.js +603 -0
- package/dist/_node-chunks/chunk-WK3EMYK6.js +61 -0
- package/dist/_node-chunks/{chunk-OVXB5GGT.js → chunk-WLHMN7AP.js} +292 -688
- package/dist/_node-chunks/chunk-XGVLB4UJ.js +54 -0
- package/dist/_node-chunks/{chunk-RMHAL25C.js → chunk-YHRFI6BE.js} +87 -227
- package/dist/_node-chunks/chunk-YK4KVMFW.js +18 -0
- package/dist/_node-chunks/chunk-ZZALGOA6.js +4523 -0
- package/dist/_node-chunks/chunk-ZZPBSYA5.js +301 -0
- package/dist/_node-chunks/chunk-ZZSRFAC6.js +45571 -0
- package/dist/_node-chunks/dist-4DWOCZUD.js +121 -0
- package/dist/_node-chunks/globby-AAARUKEU.js +3452 -0
- package/dist/_node-chunks/lib-HEUKGL62.js +366 -0
- package/dist/_node-chunks/mdx-N42X6CFJ-DCVRPS6N.js +14329 -0
- package/dist/_node-chunks/p-limit-F5ZKJ6WZ.js +116 -0
- package/dist/_node-chunks/plugin-7YY7JXCH.js +123 -0
- package/dist/_node-chunks/{plugin-6ZPCS4LI.js → plugin-SZP3CW6W.js} +36 -56
- package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-TGKNDPO6.js +46623 -0
- package/dist/_node-chunks/webpack-mock-plugin-LNTZZFBE.js +92 -0
- package/dist/actions/decorator.js +21 -42
- package/dist/actions/index.js +3 -3
- package/dist/babel/index.d.ts +671 -335
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +592 -1546
- package/dist/bin/dispatcher.js +26 -37
- package/dist/bin/loader.js +23 -34
- package/dist/channels/index.js +98 -234
- package/dist/cli/index.js +1951 -5308
- package/dist/client-logger/index.js +31 -61
- package/dist/common/index.js +20 -20
- package/dist/components/index.js +4211 -8586
- package/dist/core-events/index.js +2 -66
- package/dist/core-server/index.js +3054 -7290
- package/dist/core-server/presets/common-manager.css +2 -2
- package/dist/core-server/presets/common-manager.js +1806 -3427
- package/dist/core-server/presets/common-override-preset.js +31 -60
- package/dist/core-server/presets/common-preset.js +434 -924
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +15 -19
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +12 -17
- package/dist/csf/index.js +534 -1179
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +6 -6
- package/dist/highlight/index.js +2 -2
- package/dist/instrumenter/index.js +199 -415
- package/dist/manager/globals-runtime.js +24150 -47364
- package/dist/manager/globals.js +2 -3
- package/dist/manager/runtime.js +3961 -8373
- package/dist/manager-api/index.js +1231 -2425
- package/dist/manager-errors.d.ts +3 -0
- package/dist/manager-errors.js +3 -3
- package/dist/node-logger/index.js +1253 -2601
- package/dist/preview/globals.js +2 -3
- package/dist/preview/runtime.js +10364 -21990
- package/dist/preview-api/index.d.ts +67 -68
- package/dist/preview-api/index.js +13 -13
- package/dist/preview-errors.d.ts +3 -0
- package/dist/preview-errors.js +4 -4
- package/dist/router/index.js +347 -899
- package/dist/server-errors.d.ts +3 -0
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.js +24 -24
- package/dist/test/index.js +5860 -11645
- package/dist/theming/create.js +4 -4
- package/dist/theming/index.d.ts +3363 -2597
- package/dist/theming/index.js +490 -1086
- package/dist/types/index.js +2 -11
- package/dist/viewport/index.js +3 -3
- package/package.json +5 -5
- package/dist/_browser-chunks/Color-FQNEU7YS.js +0 -1695
- package/dist/_browser-chunks/WithTooltip-6NHN2GXF.js +0 -2343
- package/dist/_browser-chunks/chunk-6A7OIVEL.js +0 -66
- package/dist/_browser-chunks/chunk-AW46NMGV.js +0 -1308
- package/dist/_browser-chunks/chunk-B4A3ADP3.js +0 -3816
- package/dist/_browser-chunks/chunk-FSBVR7H5.js +0 -106
- package/dist/_browser-chunks/chunk-FUOHXXZT.js +0 -23
- package/dist/_browser-chunks/chunk-GTKOCWCT.js +0 -17
- package/dist/_browser-chunks/chunk-HHW4FUMO.js +0 -12
- package/dist/_browser-chunks/chunk-JVSKG4YS.js +0 -4052
- package/dist/_browser-chunks/chunk-LASUB7TL.js +0 -76
- package/dist/_browser-chunks/chunk-LYCSRYYR.js +0 -101
- package/dist/_browser-chunks/chunk-NVV6MIOE.js +0 -243
- package/dist/_browser-chunks/chunk-OBXWFEPB.js +0 -852
- package/dist/_browser-chunks/chunk-OPCDBBL3.js +0 -48
- package/dist/_browser-chunks/chunk-PB6FZ3WE.js +0 -130
- package/dist/_browser-chunks/chunk-RW5PKMWM.js +0 -4182
- package/dist/_browser-chunks/chunk-SYS437NN.js +0 -122
- package/dist/_browser-chunks/chunk-U46RQHA4.js +0 -12
- package/dist/_browser-chunks/chunk-UTNZYD2N.js +0 -311
- package/dist/_browser-chunks/chunk-VUAFL5XK.js +0 -20
- package/dist/_browser-chunks/chunk-XDGMHOV7.js +0 -2197
- package/dist/_browser-chunks/chunk-XW6KSYKF.js +0 -16
- package/dist/_browser-chunks/chunk-Y3M7TW6K.js +0 -1041
- package/dist/_browser-chunks/chunk-ZNRFDIVA.js +0 -233
- package/dist/_node-chunks/camelcase-QALD4XFE.js +0 -18
- package/dist/_node-chunks/chunk-2XY53ALL.js +0 -420
- package/dist/_node-chunks/chunk-3CBQMG2A.js +0 -6712
- package/dist/_node-chunks/chunk-3WDAPZYQ.js +0 -28
- package/dist/_node-chunks/chunk-4ZB555EJ.js +0 -697
- package/dist/_node-chunks/chunk-52DXKXY3.js +0 -4272
- package/dist/_node-chunks/chunk-5OVB4A6F.js +0 -69
- package/dist/_node-chunks/chunk-AGHGNXGH.js +0 -18
- package/dist/_node-chunks/chunk-B23X5ZCK.js +0 -1531
- package/dist/_node-chunks/chunk-B2DAHWJK.js +0 -220
- package/dist/_node-chunks/chunk-CC4PW5MJ.js +0 -34
- package/dist/_node-chunks/chunk-D7NIZELR.js +0 -2256
- package/dist/_node-chunks/chunk-DO5Q3H4L.js +0 -1250
- package/dist/_node-chunks/chunk-ECK7WVFX.js +0 -304
- package/dist/_node-chunks/chunk-EUH3NHXA.js +0 -79
- package/dist/_node-chunks/chunk-FOQHPHCV.js +0 -1657
- package/dist/_node-chunks/chunk-G6EL47NS.js +0 -111
- package/dist/_node-chunks/chunk-GFLS4TJB.js +0 -90
- package/dist/_node-chunks/chunk-J3XZKWHE.js +0 -1586
- package/dist/_node-chunks/chunk-LE63EHJ5.js +0 -1518
- package/dist/_node-chunks/chunk-M47XA42S.js +0 -4741
- package/dist/_node-chunks/chunk-OOI74AL3.js +0 -61
- package/dist/_node-chunks/chunk-PRJHT3GJ.js +0 -61
- package/dist/_node-chunks/chunk-Q52PVUSU.js +0 -101
- package/dist/_node-chunks/chunk-SDCF5RNN.js +0 -1198
- package/dist/_node-chunks/chunk-UJ5SJ23M.js +0 -5029
- package/dist/_node-chunks/chunk-UPHK4ETU.js +0 -64658
- package/dist/_node-chunks/chunk-V7VURIPB.js +0 -1544
- package/dist/_node-chunks/dist-6TXHNR5C.js +0 -175
- package/dist/_node-chunks/globby-PBTV6PX6.js +0 -5222
- package/dist/_node-chunks/lib-4RTDZVGX.js +0 -518
- package/dist/_node-chunks/mdx-N42X6CFJ-COWEH7KR.js +0 -22017
- package/dist/_node-chunks/p-limit-PBVZQOFY.js +0 -168
- package/dist/_node-chunks/plugin-EOZKYZAG.js +0 -159
- package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-35HMSMR5.js +0 -69102
- package/dist/_node-chunks/webpack-mock-plugin-GT3MA5E2.js +0 -124
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name
|
|
3
|
-
} from "./chunk-MM7DTO55.js";
|
|
4
|
-
|
|
5
1
|
// ../node_modules/@babel/runtime/helpers/esm/extends.js
|
|
6
2
|
function _extends() {
|
|
7
3
|
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
@@ -12,7 +8,6 @@ function _extends() {
|
|
|
12
8
|
return n;
|
|
13
9
|
}, _extends.apply(null, arguments);
|
|
14
10
|
}
|
|
15
|
-
__name(_extends, "_extends");
|
|
16
11
|
|
|
17
12
|
export {
|
|
18
13
|
_extends
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// src/storybook-error.ts
|
|
2
|
+
function parseErrorCode({
|
|
3
|
+
code,
|
|
4
|
+
category
|
|
5
|
+
}) {
|
|
6
|
+
let paddedCode = String(code).padStart(4, "0");
|
|
7
|
+
return `SB_${category}_${paddedCode}`;
|
|
8
|
+
}
|
|
9
|
+
function appendErrorRef(url) {
|
|
10
|
+
if (/^(?!.*storybook\.js\.org)|[?&]ref=error\b/.test(url))
|
|
11
|
+
return url;
|
|
12
|
+
try {
|
|
13
|
+
let urlObj = new URL(url);
|
|
14
|
+
return urlObj.searchParams.set("ref", "error"), urlObj.toString();
|
|
15
|
+
} catch {
|
|
16
|
+
return url;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
var StorybookError = class _StorybookError extends Error {
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(_StorybookError.getFullMessage(props));
|
|
22
|
+
/**
|
|
23
|
+
* Data associated with the error. Used to provide additional information in the error message or
|
|
24
|
+
* to be passed to telemetry.
|
|
25
|
+
*/
|
|
26
|
+
this.data = {};
|
|
27
|
+
/** Flag used to easily determine if the error originates from Storybook. */
|
|
28
|
+
this.fromStorybook = !0;
|
|
29
|
+
this.category = props.category, this.documentation = props.documentation ?? !1, this.code = props.code, this.name = props.name;
|
|
30
|
+
}
|
|
31
|
+
get fullErrorCode() {
|
|
32
|
+
return parseErrorCode({ code: this.code, category: this.category });
|
|
33
|
+
}
|
|
34
|
+
/** Overrides the default `Error.name` property in the format: SB_<CATEGORY>_<CODE>. */
|
|
35
|
+
get name() {
|
|
36
|
+
let errorName = this._name || this.constructor.name;
|
|
37
|
+
return `${this.fullErrorCode} (${errorName})`;
|
|
38
|
+
}
|
|
39
|
+
set name(name) {
|
|
40
|
+
this._name = name;
|
|
41
|
+
}
|
|
42
|
+
/** Generates the error message along with additional documentation link (if applicable). */
|
|
43
|
+
static getFullMessage({
|
|
44
|
+
documentation,
|
|
45
|
+
code,
|
|
46
|
+
category,
|
|
47
|
+
message
|
|
48
|
+
}) {
|
|
49
|
+
let page;
|
|
50
|
+
return documentation === !0 ? page = `https://storybook.js.org/error/${parseErrorCode({ code, category })}?ref=error` : typeof documentation == "string" ? page = appendErrorRef(documentation) : Array.isArray(documentation) && (page = `
|
|
51
|
+
${documentation.map((doc) => ` - ${appendErrorRef(doc)}`).join(`
|
|
52
|
+
`)}`), `${message}${page != null ? `
|
|
53
|
+
|
|
54
|
+
More info: ${page}
|
|
55
|
+
` : ""}`;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
StorybookError
|
|
61
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EVENT_ID
|
|
3
|
+
} from "./chunk-6XWLIJQL.js";
|
|
4
|
+
|
|
5
|
+
// src/actions/runtime/configureActions.ts
|
|
6
|
+
var config = {
|
|
7
|
+
depth: 10,
|
|
8
|
+
clearOnStoryChange: !0,
|
|
9
|
+
limit: 50
|
|
10
|
+
}, configureActions = (options = {}) => {
|
|
11
|
+
Object.assign(config, options);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/actions/runtime/action.ts
|
|
15
|
+
import { ImplicitActionsDuringRendering } from "storybook/internal/preview-errors";
|
|
16
|
+
import { global } from "@storybook/global";
|
|
17
|
+
import { addons } from "storybook/preview-api";
|
|
18
|
+
var findProto = (obj, callback) => {
|
|
19
|
+
let proto = Object.getPrototypeOf(obj);
|
|
20
|
+
return !proto || callback(proto) ? proto : findProto(proto, callback);
|
|
21
|
+
}, isReactSyntheticEvent = (e) => !!(typeof e == "object" && e && findProto(e, (proto) => /^Synthetic(?:Base)?Event$/.test(proto.constructor.name)) && typeof e.persist == "function"), serializeArg = (a) => {
|
|
22
|
+
if (isReactSyntheticEvent(a)) {
|
|
23
|
+
let e = Object.create(
|
|
24
|
+
a.constructor.prototype,
|
|
25
|
+
Object.getOwnPropertyDescriptors(a)
|
|
26
|
+
);
|
|
27
|
+
e.persist();
|
|
28
|
+
let viewDescriptor = Object.getOwnPropertyDescriptor(e, "view"), view = viewDescriptor?.value;
|
|
29
|
+
return typeof view == "object" && view?.constructor.name === "Window" && Object.defineProperty(e, "view", {
|
|
30
|
+
...viewDescriptor,
|
|
31
|
+
value: Object.create(view.constructor.prototype)
|
|
32
|
+
}), e;
|
|
33
|
+
}
|
|
34
|
+
return a;
|
|
35
|
+
};
|
|
36
|
+
function action(name, options = {}) {
|
|
37
|
+
let actionOptions = {
|
|
38
|
+
...config,
|
|
39
|
+
...options
|
|
40
|
+
}, handler = function(...args) {
|
|
41
|
+
if (options.implicit) {
|
|
42
|
+
let storyRenderer = ("__STORYBOOK_PREVIEW__" in global ? global.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
|
|
43
|
+
(render) => render.phase === "playing" || render.phase === "rendering"
|
|
44
|
+
);
|
|
45
|
+
if (storyRenderer) {
|
|
46
|
+
let deprecated = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, error = new ImplicitActionsDuringRendering({
|
|
47
|
+
phase: storyRenderer.phase,
|
|
48
|
+
name,
|
|
49
|
+
deprecated
|
|
50
|
+
});
|
|
51
|
+
if (deprecated)
|
|
52
|
+
console.warn(error);
|
|
53
|
+
else
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
let channel = addons.getChannel(), id = Date.now().toString(36) + Math.random().toString(36).substring(2), minDepth = 5, serializedArgs = args.map(serializeArg), normalizedArgs = args.length > 1 ? serializedArgs : serializedArgs[0], actionDisplayToEmit = {
|
|
58
|
+
id,
|
|
59
|
+
count: 0,
|
|
60
|
+
data: { name, args: normalizedArgs },
|
|
61
|
+
options: {
|
|
62
|
+
...actionOptions,
|
|
63
|
+
maxDepth: minDepth + (actionOptions.depth || 3)
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
channel.emit(EVENT_ID, actionDisplayToEmit);
|
|
67
|
+
};
|
|
68
|
+
return handler.isAction = !0, handler.implicit = options.implicit, handler;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/actions/runtime/actions.ts
|
|
72
|
+
var actions = (...args) => {
|
|
73
|
+
let options = config, names = args;
|
|
74
|
+
names.length === 1 && Array.isArray(names[0]) && ([names] = names), names.length !== 1 && typeof names[names.length - 1] != "string" && (options = {
|
|
75
|
+
...config,
|
|
76
|
+
...names.pop()
|
|
77
|
+
});
|
|
78
|
+
let namesObject = names[0];
|
|
79
|
+
(names.length !== 1 || typeof namesObject == "string") && (namesObject = {}, names.forEach((name) => {
|
|
80
|
+
namesObject[name] = name;
|
|
81
|
+
}));
|
|
82
|
+
let actionsObject = {};
|
|
83
|
+
return Object.keys(namesObject).forEach((name) => {
|
|
84
|
+
actionsObject[name] = action(namesObject[name], options);
|
|
85
|
+
}), actionsObject;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
config,
|
|
90
|
+
configureActions,
|
|
91
|
+
action,
|
|
92
|
+
actions
|
|
93
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS
|
|
3
|
+
} from "./chunk-A242L54C.js";
|
|
4
|
+
|
|
5
|
+
// ../node_modules/picocolors/picocolors.browser.js
|
|
6
|
+
var require_picocolors_browser = __commonJS({
|
|
7
|
+
"../node_modules/picocolors/picocolors.browser.js"(exports, module) {
|
|
8
|
+
var x = String, create = function() {
|
|
9
|
+
return { isColorSupported: !1, reset: x, bold: x, dim: x, italic: x, underline: x, inverse: x, hidden: x, strikethrough: x, black: x, red: x, green: x, yellow: x, blue: x, magenta: x, cyan: x, white: x, gray: x, bgBlack: x, bgRed: x, bgGreen: x, bgYellow: x, bgBlue: x, bgMagenta: x, bgCyan: x, bgWhite: x, blackBright: x, redBright: x, greenBright: x, yellowBright: x, blueBright: x, magentaBright: x, cyanBright: x, whiteBright: x, bgBlackBright: x, bgRedBright: x, bgGreenBright: x, bgYellowBright: x, bgBlueBright: x, bgMagentaBright: x, bgCyanBright: x, bgWhiteBright: x };
|
|
10
|
+
};
|
|
11
|
+
module.exports = create();
|
|
12
|
+
module.exports.createColors = create;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
require_picocolors_browser
|
|
18
|
+
};
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
// src/backgrounds/constants.ts
|
|
2
|
-
var ADDON_ID = "storybook/background";
|
|
3
|
-
var PARAM_KEY = "backgrounds";
|
|
2
|
+
var ADDON_ID = "storybook/background", PARAM_KEY = "backgrounds";
|
|
4
3
|
var EVENTS = {
|
|
5
4
|
UPDATE: `${ADDON_ID}/update`
|
|
6
5
|
};
|
|
7
6
|
|
|
8
7
|
// src/measure/constants.ts
|
|
9
|
-
var ADDON_ID2 = "storybook/measure-addon"
|
|
10
|
-
var TOOL_ID = `${ADDON_ID2}/tool`;
|
|
11
|
-
var PARAM_KEY2 = "measureEnabled";
|
|
12
|
-
var EVENTS2 = {
|
|
8
|
+
var ADDON_ID2 = "storybook/measure-addon", TOOL_ID = `${ADDON_ID2}/tool`, PARAM_KEY2 = "measureEnabled", EVENTS2 = {
|
|
13
9
|
RESULT: `${ADDON_ID2}/result`,
|
|
14
10
|
REQUEST: `${ADDON_ID2}/request`,
|
|
15
11
|
CLEAR: `${ADDON_ID2}/clear`
|
|
16
12
|
};
|
|
17
13
|
|
|
18
14
|
// src/outline/constants.ts
|
|
19
|
-
var ADDON_ID3 = "storybook/outline";
|
|
20
|
-
var PARAM_KEY3 = "outline";
|
|
15
|
+
var ADDON_ID3 = "storybook/outline", PARAM_KEY3 = "outline";
|
|
21
16
|
|
|
22
17
|
// src/backgrounds/defaults.ts
|
|
23
18
|
var DEFAULT_BACKGROUNDS = {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// ../node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
|
|
2
|
+
function isPlainObject(value) {
|
|
3
|
+
if (!value || typeof value != "object")
|
|
4
|
+
return !1;
|
|
5
|
+
let proto = Object.getPrototypeOf(value);
|
|
6
|
+
return proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null ? Object.prototype.toString.call(value) === "[object Object]" : !1;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// ../node_modules/es-toolkit/dist/predicate/isPrimitive.mjs
|
|
10
|
+
function isPrimitive(value) {
|
|
11
|
+
return value == null || typeof value != "object" && typeof value != "function";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// ../node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
|
|
15
|
+
function isTypedArray(x) {
|
|
16
|
+
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// ../node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
|
|
20
|
+
function getSymbols(object) {
|
|
21
|
+
return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ../node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
|
|
25
|
+
function getTag(value) {
|
|
26
|
+
return value == null ? value === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ../node_modules/es-toolkit/dist/compat/_internal/tags.mjs
|
|
30
|
+
var regexpTag = "[object RegExp]", stringTag = "[object String]", numberTag = "[object Number]", booleanTag = "[object Boolean]", argumentsTag = "[object Arguments]", symbolTag = "[object Symbol]", dateTag = "[object Date]", mapTag = "[object Map]", setTag = "[object Set]", arrayTag = "[object Array]", functionTag = "[object Function]", arrayBufferTag = "[object ArrayBuffer]", objectTag = "[object Object]", errorTag = "[object Error]", dataViewTag = "[object DataView]", uint8ArrayTag = "[object Uint8Array]", uint8ClampedArrayTag = "[object Uint8ClampedArray]", uint16ArrayTag = "[object Uint16Array]", uint32ArrayTag = "[object Uint32Array]", bigUint64ArrayTag = "[object BigUint64Array]", int8ArrayTag = "[object Int8Array]", int16ArrayTag = "[object Int16Array]", int32ArrayTag = "[object Int32Array]", bigInt64ArrayTag = "[object BigInt64Array]", float32ArrayTag = "[object Float32Array]", float64ArrayTag = "[object Float64Array]";
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
isPrimitive,
|
|
34
|
+
isTypedArray,
|
|
35
|
+
getSymbols,
|
|
36
|
+
getTag,
|
|
37
|
+
regexpTag,
|
|
38
|
+
stringTag,
|
|
39
|
+
numberTag,
|
|
40
|
+
booleanTag,
|
|
41
|
+
argumentsTag,
|
|
42
|
+
symbolTag,
|
|
43
|
+
dateTag,
|
|
44
|
+
mapTag,
|
|
45
|
+
setTag,
|
|
46
|
+
arrayTag,
|
|
47
|
+
functionTag,
|
|
48
|
+
arrayBufferTag,
|
|
49
|
+
objectTag,
|
|
50
|
+
errorTag,
|
|
51
|
+
dataViewTag,
|
|
52
|
+
uint8ArrayTag,
|
|
53
|
+
uint8ClampedArrayTag,
|
|
54
|
+
uint16ArrayTag,
|
|
55
|
+
uint32ArrayTag,
|
|
56
|
+
bigUint64ArrayTag,
|
|
57
|
+
int8ArrayTag,
|
|
58
|
+
int16ArrayTag,
|
|
59
|
+
int32ArrayTag,
|
|
60
|
+
bigInt64ArrayTag,
|
|
61
|
+
float32ArrayTag,
|
|
62
|
+
float64ArrayTag,
|
|
63
|
+
isPlainObject
|
|
64
|
+
};
|
|
@@ -1,63 +1,55 @@
|
|
|
1
1
|
import {
|
|
2
2
|
_objectWithoutPropertiesLoose
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
__name
|
|
6
|
-
} from "./chunk-MM7DTO55.js";
|
|
3
|
+
} from "./chunk-45UGUKRX.js";
|
|
7
4
|
|
|
8
5
|
// ../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
9
6
|
function _typeof(o) {
|
|
10
7
|
"@babel/helpers - typeof";
|
|
11
|
-
return _typeof =
|
|
8
|
+
return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
|
|
12
9
|
return typeof o2;
|
|
13
10
|
} : function(o2) {
|
|
14
|
-
return o2 && "function"
|
|
11
|
+
return o2 && typeof Symbol == "function" && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
15
12
|
}, _typeof(o);
|
|
16
13
|
}
|
|
17
|
-
__name(_typeof, "_typeof");
|
|
18
14
|
|
|
19
15
|
// ../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
20
16
|
function toPrimitive(t, r) {
|
|
21
|
-
if (
|
|
17
|
+
if (_typeof(t) != "object" || !t) return t;
|
|
22
18
|
var e = t[Symbol.toPrimitive];
|
|
23
|
-
if (void 0
|
|
19
|
+
if (e !== void 0) {
|
|
24
20
|
var i = e.call(t, r || "default");
|
|
25
|
-
if (
|
|
21
|
+
if (_typeof(i) != "object") return i;
|
|
26
22
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
27
23
|
}
|
|
28
|
-
return ("string"
|
|
24
|
+
return (r === "string" ? String : Number)(t);
|
|
29
25
|
}
|
|
30
|
-
__name(toPrimitive, "toPrimitive");
|
|
31
26
|
|
|
32
27
|
// ../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
33
28
|
function toPropertyKey(t) {
|
|
34
29
|
var i = toPrimitive(t, "string");
|
|
35
|
-
return
|
|
30
|
+
return _typeof(i) == "symbol" ? i : i + "";
|
|
36
31
|
}
|
|
37
|
-
__name(toPropertyKey, "toPropertyKey");
|
|
38
32
|
|
|
39
33
|
// ../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
40
34
|
function _defineProperty(e, r, t) {
|
|
41
35
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
42
36
|
value: t,
|
|
43
|
-
enumerable:
|
|
44
|
-
configurable:
|
|
45
|
-
writable:
|
|
37
|
+
enumerable: !0,
|
|
38
|
+
configurable: !0,
|
|
39
|
+
writable: !0
|
|
46
40
|
}) : e[r] = t, e;
|
|
47
41
|
}
|
|
48
|
-
__name(_defineProperty, "_defineProperty");
|
|
49
42
|
|
|
50
43
|
// ../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
51
44
|
function _objectWithoutProperties(e, t) {
|
|
52
|
-
if (
|
|
45
|
+
if (e == null) return {};
|
|
53
46
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
54
47
|
if (Object.getOwnPropertySymbols) {
|
|
55
48
|
var n = Object.getOwnPropertySymbols(e);
|
|
56
|
-
for (r = 0; r < n.length; r++) o = n[r],
|
|
49
|
+
for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) === -1 && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
57
50
|
}
|
|
58
51
|
return i;
|
|
59
52
|
}
|
|
60
|
-
__name(_objectWithoutProperties, "_objectWithoutProperties");
|
|
61
53
|
|
|
62
54
|
export {
|
|
63
55
|
_objectWithoutProperties,
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// src/preview-api/modules/preview-web/render/animation-utils.ts
|
|
2
|
+
function isTestEnvironment() {
|
|
3
|
+
try {
|
|
4
|
+
return (
|
|
5
|
+
// @ts-expect-error This property exists in Vitest browser mode
|
|
6
|
+
!!globalThis.__vitest_browser__ || !!globalThis.window?.navigator?.userAgent?.match(/StorybookTestRunner/)
|
|
7
|
+
);
|
|
8
|
+
} catch {
|
|
9
|
+
return !1;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function pauseAnimations(atEnd = !0) {
|
|
13
|
+
if (!("document" in globalThis && "createElement" in globalThis.document))
|
|
14
|
+
return () => {
|
|
15
|
+
};
|
|
16
|
+
let disableStyle = document.createElement("style");
|
|
17
|
+
disableStyle.textContent = `*, *:before, *:after {
|
|
18
|
+
animation: none !important;
|
|
19
|
+
}`, document.head.appendChild(disableStyle);
|
|
20
|
+
let pauseStyle = document.createElement("style");
|
|
21
|
+
return pauseStyle.textContent = `*, *:before, *:after {
|
|
22
|
+
animation-delay: 0s !important;
|
|
23
|
+
animation-direction: ${atEnd ? "reverse" : "normal"} !important;
|
|
24
|
+
animation-play-state: paused !important;
|
|
25
|
+
transition: none !important;
|
|
26
|
+
}`, document.head.appendChild(pauseStyle), document.body.clientHeight, document.head.removeChild(disableStyle), () => {
|
|
27
|
+
pauseStyle.parentNode?.removeChild(pauseStyle);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
async function waitForAnimations(signal) {
|
|
31
|
+
if (!("document" in globalThis && "getAnimations" in globalThis.document && "querySelectorAll" in globalThis.document))
|
|
32
|
+
return;
|
|
33
|
+
let timedOut = !1;
|
|
34
|
+
await Promise.race([
|
|
35
|
+
// After 50ms, retrieve any running animations and wait for them to finish
|
|
36
|
+
// If new animations are created while waiting, we'll wait for them too
|
|
37
|
+
new Promise((resolve) => {
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
let animationRoots = [globalThis.document, ...getShadowRoots(globalThis.document)], checkAnimationsFinished = async () => {
|
|
40
|
+
if (timedOut || signal?.aborted)
|
|
41
|
+
return;
|
|
42
|
+
let runningAnimations = animationRoots.flatMap((el) => el?.getAnimations?.() || []).filter((a) => a.playState === "running" && !isInfiniteAnimation(a));
|
|
43
|
+
runningAnimations.length > 0 && (await Promise.all(runningAnimations.map((a) => a.finished)), await checkAnimationsFinished());
|
|
44
|
+
};
|
|
45
|
+
checkAnimationsFinished().then(resolve);
|
|
46
|
+
}, 100);
|
|
47
|
+
}),
|
|
48
|
+
// If animations don't finish within the timeout, continue without waiting
|
|
49
|
+
new Promise(
|
|
50
|
+
(resolve) => setTimeout(() => {
|
|
51
|
+
timedOut = !0, resolve(void 0);
|
|
52
|
+
}, 5e3)
|
|
53
|
+
)
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
56
|
+
function getShadowRoots(doc) {
|
|
57
|
+
return [doc, ...doc.querySelectorAll("*")].reduce((acc, el) => ("shadowRoot" in el && el.shadowRoot && acc.push(el.shadowRoot, ...getShadowRoots(el.shadowRoot)), acc), []);
|
|
58
|
+
}
|
|
59
|
+
function isInfiniteAnimation(anim) {
|
|
60
|
+
if (anim instanceof CSSAnimation && anim.effect instanceof KeyframeEffect && anim.effect.target) {
|
|
61
|
+
let style = getComputedStyle(anim.effect.target, anim.effect.pseudoElement), index = style.animationName?.split(", ").indexOf(anim.animationName);
|
|
62
|
+
return style.animationIterationCount.split(", ")[index] === "infinite";
|
|
63
|
+
}
|
|
64
|
+
return !1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
isTestEnvironment,
|
|
69
|
+
pauseAnimations,
|
|
70
|
+
waitForAnimations
|
|
71
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// ../node_modules/ts-dedent/esm/index.js
|
|
2
|
+
function dedent(templ) {
|
|
3
|
+
for (var values = [], _i = 1; _i < arguments.length; _i++)
|
|
4
|
+
values[_i - 1] = arguments[_i];
|
|
5
|
+
var strings = Array.from(typeof templ == "string" ? [templ] : templ);
|
|
6
|
+
strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
7
|
+
var indentLengths = strings.reduce(function(arr, str) {
|
|
8
|
+
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
9
|
+
return matches ? arr.concat(matches.map(function(match) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
12
|
+
})) : arr;
|
|
13
|
+
}, []);
|
|
14
|
+
if (indentLengths.length) {
|
|
15
|
+
var pattern_1 = new RegExp(`
|
|
16
|
+
[ ]{` + Math.min.apply(Math, indentLengths) + "}", "g");
|
|
17
|
+
strings = strings.map(function(str) {
|
|
18
|
+
return str.replace(pattern_1, `
|
|
19
|
+
`);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
23
|
+
var string = strings[0];
|
|
24
|
+
return values.forEach(function(value, i) {
|
|
25
|
+
var endentations = string.match(/(?:^|\n)( *)$/), endentation = endentations ? endentations[1] : "", indentedValue = value;
|
|
26
|
+
typeof value == "string" && value.includes(`
|
|
27
|
+
`) && (indentedValue = String(value).split(`
|
|
28
|
+
`).map(function(str, i2) {
|
|
29
|
+
return i2 === 0 ? str : "" + endentation + str;
|
|
30
|
+
}).join(`
|
|
31
|
+
`)), string += indentedValue + strings[i + 1];
|
|
32
|
+
}), string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
dedent
|
|
37
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/highlight/constants.ts
|
|
2
|
+
var ADDON_ID = "storybook/highlight", HIGHLIGHT = `${ADDON_ID}/add`, REMOVE_HIGHLIGHT = `${ADDON_ID}/remove`, RESET_HIGHLIGHT = `${ADDON_ID}/reset`, SCROLL_INTO_VIEW = `${ADDON_ID}/scroll-into-view`, MAX_Z_INDEX = 2147483647, MIN_TOUCH_AREA_SIZE = 28;
|
|
3
|
+
|
|
4
|
+
export {
|
|
5
|
+
HIGHLIGHT,
|
|
6
|
+
REMOVE_HIGHLIGHT,
|
|
7
|
+
RESET_HIGHLIGHT,
|
|
8
|
+
SCROLL_INTO_VIEW,
|
|
9
|
+
MAX_Z_INDEX,
|
|
10
|
+
MIN_TOUCH_AREA_SIZE
|
|
11
|
+
};
|
|
@@ -2,10 +2,7 @@ import {
|
|
|
2
2
|
curriedDarken$1,
|
|
3
3
|
curriedLighten$1,
|
|
4
4
|
rgba
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
__name
|
|
8
|
-
} from "./chunk-MM7DTO55.js";
|
|
5
|
+
} from "./chunk-AXG2BOBL.js";
|
|
9
6
|
|
|
10
7
|
// src/theming/base.ts
|
|
11
8
|
var color = {
|
|
@@ -46,8 +43,7 @@ var color = {
|
|
|
46
43
|
positiveText: "#427C27",
|
|
47
44
|
warningText: "#955B1E",
|
|
48
45
|
negativeText: "#C23400"
|
|
49
|
-
}
|
|
50
|
-
var background = {
|
|
46
|
+
}, background = {
|
|
51
47
|
app: "#F6F9FC",
|
|
52
48
|
bar: color.lightest,
|
|
53
49
|
content: color.lightest,
|
|
@@ -59,8 +55,7 @@ var background = {
|
|
|
59
55
|
warning: "#FFF9EB",
|
|
60
56
|
negative: "#FFF0EB",
|
|
61
57
|
critical: "#D13800"
|
|
62
|
-
}
|
|
63
|
-
var typography = {
|
|
58
|
+
}, typography = {
|
|
64
59
|
fonts: {
|
|
65
60
|
base: [
|
|
66
61
|
'"Nunito Sans"',
|
|
@@ -140,8 +135,7 @@ var theme = {
|
|
|
140
135
|
inputBorder: "hsl(0 0 100 / 0.1)",
|
|
141
136
|
inputTextColor: "#C9CCCF",
|
|
142
137
|
inputBorderRadius: 4
|
|
143
|
-
};
|
|
144
|
-
var dark_default = theme;
|
|
138
|
+
}, dark_default = theme;
|
|
145
139
|
|
|
146
140
|
// src/theming/themes/light.ts
|
|
147
141
|
var theme2 = {
|
|
@@ -177,84 +171,43 @@ var theme2 = {
|
|
|
177
171
|
inputBorder: color.border,
|
|
178
172
|
inputTextColor: color.darkest,
|
|
179
173
|
inputBorderRadius: 4
|
|
180
|
-
};
|
|
181
|
-
var light_default = theme2;
|
|
174
|
+
}, light_default = theme2;
|
|
182
175
|
|
|
183
176
|
// src/theming/utils.ts
|
|
184
177
|
import { logger } from "storybook/internal/client-logger";
|
|
185
178
|
import { global } from "@storybook/global";
|
|
186
|
-
var { window: globalWindow } = global
|
|
187
|
-
|
|
188
|
-
var
|
|
189
|
-
if (
|
|
190
|
-
logger.warn(
|
|
191
|
-
`Color passed to theme object should be a string. Instead ${color2}(${typeof color2}) was passed.`
|
|
192
|
-
);
|
|
193
|
-
return false;
|
|
194
|
-
}
|
|
195
|
-
return true;
|
|
196
|
-
}, "isColorString");
|
|
197
|
-
var isValidColorForPolished = /* @__PURE__ */ __name((color2) => {
|
|
198
|
-
return !/(gradient|var|calc)/.test(color2);
|
|
199
|
-
}, "isValidColorForPolished");
|
|
200
|
-
var applyPolished = /* @__PURE__ */ __name((type, color2) => {
|
|
201
|
-
if (type === "darken") {
|
|
202
|
-
return rgba(`${curriedDarken$1(1, color2)}`, 0.95);
|
|
203
|
-
}
|
|
204
|
-
if (type === "lighten") {
|
|
205
|
-
return rgba(`${curriedLighten$1(1, color2)}`, 0.95);
|
|
206
|
-
}
|
|
207
|
-
return color2;
|
|
208
|
-
}, "applyPolished");
|
|
209
|
-
var colorFactory = /* @__PURE__ */ __name((type) => (color2) => {
|
|
210
|
-
if (!isColorString(color2)) {
|
|
179
|
+
var { window: globalWindow } = global, mkColor = (color2) => ({ color: color2 }), isColorString = (color2) => typeof color2 != "string" ? (logger.warn(
|
|
180
|
+
`Color passed to theme object should be a string. Instead ${color2}(${typeof color2}) was passed.`
|
|
181
|
+
), !1) : !0, isValidColorForPolished = (color2) => !/(gradient|var|calc)/.test(color2), applyPolished = (type, color2) => type === "darken" ? rgba(`${curriedDarken$1(1, color2)}`, 0.95) : type === "lighten" ? rgba(`${curriedLighten$1(1, color2)}`, 0.95) : color2, colorFactory = (type) => (color2) => {
|
|
182
|
+
if (!isColorString(color2) || !isValidColorForPolished(color2))
|
|
211
183
|
return color2;
|
|
212
|
-
}
|
|
213
|
-
if (!isValidColorForPolished(color2)) {
|
|
214
|
-
return color2;
|
|
215
|
-
}
|
|
216
184
|
try {
|
|
217
185
|
return applyPolished(type, color2);
|
|
218
|
-
} catch
|
|
186
|
+
} catch {
|
|
219
187
|
return color2;
|
|
220
188
|
}
|
|
221
|
-
}, "colorFactory");
|
|
222
|
-
var lightenColor = colorFactory("lighten");
|
|
223
|
-
var darkenColor = colorFactory("darken");
|
|
224
|
-
var getPreferredColorScheme = /* @__PURE__ */ __name(() => {
|
|
225
|
-
if (!globalWindow || !globalWindow.matchMedia) {
|
|
226
|
-
return "light";
|
|
227
|
-
}
|
|
228
|
-
const isDarkThemePreferred = globalWindow.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
229
|
-
if (isDarkThemePreferred) {
|
|
230
|
-
return "dark";
|
|
231
|
-
}
|
|
232
|
-
return "light";
|
|
233
|
-
}, "getPreferredColorScheme");
|
|
189
|
+
}, lightenColor = colorFactory("lighten"), darkenColor = colorFactory("darken"), getPreferredColorScheme = () => !globalWindow || !globalWindow.matchMedia ? "light" : globalWindow.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
234
190
|
|
|
235
191
|
// src/theming/create.ts
|
|
236
192
|
var themesBase = {
|
|
237
193
|
light: light_default,
|
|
238
194
|
dark: dark_default
|
|
239
|
-
}
|
|
240
|
-
var preferredColorScheme = getPreferredColorScheme();
|
|
241
|
-
var themes = {
|
|
195
|
+
}, preferredColorScheme = getPreferredColorScheme(), themes = {
|
|
242
196
|
...themesBase,
|
|
243
197
|
normal: themesBase[preferredColorScheme]
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
const inherit = {
|
|
198
|
+
}, create = (vars = { base: preferredColorScheme }, rest) => {
|
|
199
|
+
let inherit = {
|
|
247
200
|
...themes[preferredColorScheme],
|
|
248
201
|
...themes[vars.base] || {},
|
|
249
202
|
...vars,
|
|
250
|
-
|
|
203
|
+
base: themes[vars.base] ? vars.base : preferredColorScheme
|
|
251
204
|
};
|
|
252
205
|
return {
|
|
253
206
|
...rest,
|
|
254
207
|
...inherit,
|
|
255
|
-
|
|
208
|
+
barSelectedColor: vars.barSelectedColor || inherit.colorSecondary
|
|
256
209
|
};
|
|
257
|
-
}
|
|
210
|
+
};
|
|
258
211
|
|
|
259
212
|
export {
|
|
260
213
|
color,
|