@sanity/ui 2.10.11 → 2.10.13
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/_chunks-cjs/getTheme_v2.js +41 -41
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +41 -41
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +41 -41
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/index.esm.js +466 -1751
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +466 -1751
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +466 -1751
- package/dist/index.mjs.map +1 -1
- package/dist/theme.esm.js +261 -318
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +261 -318
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +261 -318
- package/dist/theme.mjs.map +1 -1
- package/package.json +8 -8
package/dist/theme.js
CHANGED
|
@@ -370,14 +370,6 @@ function createCardStates(opts, base, dark, name, solid, muted) {
|
|
|
370
370
|
})
|
|
371
371
|
};
|
|
372
372
|
}
|
|
373
|
-
var __defProp$8 = Object.defineProperty, __defProps$7 = Object.defineProperties, __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$8 = Object.getOwnPropertySymbols, __hasOwnProp$8 = Object.prototype.hasOwnProperty, __propIsEnum$8 = Object.prototype.propertyIsEnumerable, __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$8 = (a, b) => {
|
|
374
|
-
for (var prop in b || (b = {}))
|
|
375
|
-
__hasOwnProp$8.call(b, prop) && __defNormalProp$8(a, prop, b[prop]);
|
|
376
|
-
if (__getOwnPropSymbols$8)
|
|
377
|
-
for (var prop of __getOwnPropSymbols$8(b))
|
|
378
|
-
__propIsEnum$8.call(b, prop) && __defNormalProp$8(a, prop, b[prop]);
|
|
379
|
-
return a;
|
|
380
|
-
}, __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
381
373
|
const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
382
374
|
default: {
|
|
383
375
|
lightest: "hsl(0, 0%, 95%)",
|
|
@@ -612,7 +604,8 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
612
604
|
mode,
|
|
613
605
|
muted,
|
|
614
606
|
solid
|
|
615
|
-
}) => mode === "bleed" ?
|
|
607
|
+
}) => mode === "bleed" ? {
|
|
608
|
+
...muted,
|
|
616
609
|
enabled: {
|
|
617
610
|
bg: "transparent",
|
|
618
611
|
bg2: "transparent",
|
|
@@ -655,9 +648,10 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
655
648
|
},
|
|
656
649
|
skeleton: base.skeleton
|
|
657
650
|
}
|
|
658
|
-
}
|
|
651
|
+
} : mode === "ghost" ? {
|
|
652
|
+
...solid,
|
|
659
653
|
enabled: muted.enabled
|
|
660
|
-
}
|
|
654
|
+
} : solid,
|
|
661
655
|
card: ({
|
|
662
656
|
base
|
|
663
657
|
}) => ({
|
|
@@ -1082,16 +1076,11 @@ function createSpot(opts, base, dark) {
|
|
|
1082
1076
|
})
|
|
1083
1077
|
};
|
|
1084
1078
|
}
|
|
1085
|
-
var __defProp$7 = Object.defineProperty, __getOwnPropSymbols$7 = Object.getOwnPropertySymbols, __hasOwnProp$7 = Object.prototype.hasOwnProperty, __propIsEnum$7 = Object.prototype.propertyIsEnumerable, __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$7 = (a, b) => {
|
|
1086
|
-
for (var prop in b || (b = {}))
|
|
1087
|
-
__hasOwnProp$7.call(b, prop) && __defNormalProp$7(a, prop, b[prop]);
|
|
1088
|
-
if (__getOwnPropSymbols$7)
|
|
1089
|
-
for (var prop of __getOwnPropSymbols$7(b))
|
|
1090
|
-
__propIsEnum$7.call(b, prop) && __defNormalProp$7(a, prop, b[prop]);
|
|
1091
|
-
return a;
|
|
1092
|
-
};
|
|
1093
1079
|
function createColorTheme(partialOpts = {}) {
|
|
1094
|
-
const builders =
|
|
1080
|
+
const builders = {
|
|
1081
|
+
...defaultOpts,
|
|
1082
|
+
...partialOpts
|
|
1083
|
+
};
|
|
1095
1084
|
return {
|
|
1096
1085
|
light: _createColorScheme(builders, !1),
|
|
1097
1086
|
dark: _createColorScheme(builders, !0)
|
|
@@ -1330,14 +1319,6 @@ function is_v0(themeProp) {
|
|
|
1330
1319
|
function is_v2(themeProp) {
|
|
1331
1320
|
return themeProp._version === 2;
|
|
1332
1321
|
}
|
|
1333
|
-
var __defProp$6 = Object.defineProperty, __defProps$6 = Object.defineProperties, __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$6 = Object.getOwnPropertySymbols, __hasOwnProp$6 = Object.prototype.hasOwnProperty, __propIsEnum$6 = Object.prototype.propertyIsEnumerable, __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$6 = (a, b) => {
|
|
1334
|
-
for (var prop in b || (b = {}))
|
|
1335
|
-
__hasOwnProp$6.call(b, prop) && __defNormalProp$6(a, prop, b[prop]);
|
|
1336
|
-
if (__getOwnPropSymbols$6)
|
|
1337
|
-
for (var prop of __getOwnPropSymbols$6(b))
|
|
1338
|
-
__propIsEnum$6.call(b, prop) && __defNormalProp$6(a, prop, b[prop]);
|
|
1339
|
-
return a;
|
|
1340
|
-
}, __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
1341
1322
|
const cache$2 = /* @__PURE__ */ new WeakMap();
|
|
1342
1323
|
function v0_v2(v0) {
|
|
1343
1324
|
if (v0.v2) return v0.v2;
|
|
@@ -1360,8 +1341,14 @@ function v0_v2(v0) {
|
|
|
1360
1341
|
styles: style
|
|
1361
1342
|
} = v0, v2 = {
|
|
1362
1343
|
_version: 2,
|
|
1363
|
-
avatar:
|
|
1364
|
-
|
|
1344
|
+
avatar: {
|
|
1345
|
+
...getTheme_v2.defaultThemeConfig.avatar,
|
|
1346
|
+
...avatar
|
|
1347
|
+
},
|
|
1348
|
+
button: {
|
|
1349
|
+
...getTheme_v2.defaultThemeConfig.button,
|
|
1350
|
+
...button
|
|
1351
|
+
},
|
|
1365
1352
|
card: getTheme_v2.defaultThemeConfig.card,
|
|
1366
1353
|
color: {
|
|
1367
1354
|
light: {
|
|
@@ -1387,12 +1374,23 @@ function v0_v2(v0) {
|
|
|
1387
1374
|
},
|
|
1388
1375
|
container,
|
|
1389
1376
|
font,
|
|
1390
|
-
input:
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1377
|
+
input: {
|
|
1378
|
+
...getTheme_v2.defaultThemeConfig.input,
|
|
1379
|
+
...input,
|
|
1380
|
+
checkbox: {
|
|
1381
|
+
...getTheme_v2.defaultThemeConfig.input.checkbox,
|
|
1382
|
+
...input.checkbox
|
|
1383
|
+
},
|
|
1384
|
+
radio: {
|
|
1385
|
+
...getTheme_v2.defaultThemeConfig.input.radio,
|
|
1386
|
+
...input.radio
|
|
1387
|
+
},
|
|
1388
|
+
switch: {
|
|
1389
|
+
...getTheme_v2.defaultThemeConfig.input.switch,
|
|
1390
|
+
...input.switch
|
|
1391
|
+
}
|
|
1392
|
+
},
|
|
1393
|
+
layer: layer ?? getTheme_v2.defaultThemeConfig.layer,
|
|
1396
1394
|
media,
|
|
1397
1395
|
radius,
|
|
1398
1396
|
shadow,
|
|
@@ -1401,14 +1399,6 @@ function v0_v2(v0) {
|
|
|
1401
1399
|
};
|
|
1402
1400
|
return cache$2.set(v0, v2), v2;
|
|
1403
1401
|
}
|
|
1404
|
-
var __defProp$5 = Object.defineProperty, __defProps$5 = Object.defineProperties, __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$5 = Object.getOwnPropertySymbols, __hasOwnProp$5 = Object.prototype.hasOwnProperty, __propIsEnum$5 = Object.prototype.propertyIsEnumerable, __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$5 = (a, b) => {
|
|
1405
|
-
for (var prop in b || (b = {}))
|
|
1406
|
-
__hasOwnProp$5.call(b, prop) && __defNormalProp$5(a, prop, b[prop]);
|
|
1407
|
-
if (__getOwnPropSymbols$5)
|
|
1408
|
-
for (var prop of __getOwnPropSymbols$5(b))
|
|
1409
|
-
__propIsEnum$5.call(b, prop) && __defNormalProp$5(a, prop, b[prop]);
|
|
1410
|
-
return a;
|
|
1411
|
-
}, __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
1412
1402
|
const cache$1 = /* @__PURE__ */ new WeakMap();
|
|
1413
1403
|
function v2_v0(v2) {
|
|
1414
1404
|
const cachedTheme = cache$1.get(v2);
|
|
@@ -1476,12 +1466,14 @@ function themeColor_v2_v0(color_v2) {
|
|
|
1476
1466
|
default: inputStatesThemeColor_v2_v0(color_v2.input.default),
|
|
1477
1467
|
invalid: inputStatesThemeColor_v2_v0(color_v2.input.invalid)
|
|
1478
1468
|
},
|
|
1479
|
-
muted:
|
|
1469
|
+
muted: {
|
|
1470
|
+
...color_v2.button.ghost,
|
|
1480
1471
|
transparent: color_v2.button.ghost.default
|
|
1481
|
-
}
|
|
1482
|
-
solid:
|
|
1472
|
+
},
|
|
1473
|
+
solid: {
|
|
1474
|
+
...color_v2.button.default,
|
|
1483
1475
|
transparent: color_v2.button.default.default
|
|
1484
|
-
}
|
|
1476
|
+
},
|
|
1485
1477
|
selectable: color_v2.selectable,
|
|
1486
1478
|
spot: {
|
|
1487
1479
|
gray: color_v2.avatar.gray.bg,
|
|
@@ -1698,8 +1690,7 @@ function isColorConfigBlendKey(str) {
|
|
|
1698
1690
|
return COLOR_CONFIG_BLEND_KEYS.includes(str);
|
|
1699
1691
|
}
|
|
1700
1692
|
function isColorTokenValue(str) {
|
|
1701
|
-
|
|
1702
|
-
return ((_a = parseTokenValue(str)) == null ? void 0 : _a.type) === "color" || ((_b = parseTokenValue(str)) == null ? void 0 : _b.type) === "hue";
|
|
1693
|
+
return parseTokenValue(str)?.type === "color" || parseTokenValue(str)?.type === "hue";
|
|
1703
1694
|
}
|
|
1704
1695
|
function isColorValue(str) {
|
|
1705
1696
|
return str === "black" || str === "white";
|
|
@@ -1711,14 +1702,6 @@ function compileColorTokenValue(node) {
|
|
|
1711
1702
|
let key = "";
|
|
1712
1703
|
return node.key === "black" || node.key === "white" ? key = node.key : key = `${node.hue}/${node.tint}`, node.mix !== void 0 ? `${key} ${node.mix * 100}%` : (node.opacity !== void 0 && (key += `/${node.opacity}`), key);
|
|
1713
1704
|
}
|
|
1714
|
-
var __defProp$4 = Object.defineProperty, __defProps$4 = Object.defineProperties, __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$4 = Object.getOwnPropertySymbols, __hasOwnProp$4 = Object.prototype.hasOwnProperty, __propIsEnum$4 = Object.prototype.propertyIsEnumerable, __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$4 = (a, b) => {
|
|
1715
|
-
for (var prop in b || (b = {}))
|
|
1716
|
-
__hasOwnProp$4.call(b, prop) && __defNormalProp$4(a, prop, b[prop]);
|
|
1717
|
-
if (__getOwnPropSymbols$4)
|
|
1718
|
-
for (var prop of __getOwnPropSymbols$4(b))
|
|
1719
|
-
__propIsEnum$4.call(b, prop) && __defNormalProp$4(a, prop, b[prop]);
|
|
1720
|
-
return a;
|
|
1721
|
-
}, __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1722
1705
|
const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
|
|
1723
1706
|
function resolveColorTokenValue(context, value = DEFAULT_COLOR_TOKEN_VALUE) {
|
|
1724
1707
|
const {
|
|
@@ -1727,9 +1710,10 @@ function resolveColorTokenValue(context, value = DEFAULT_COLOR_TOKEN_VALUE) {
|
|
|
1727
1710
|
} = context, node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
1728
1711
|
if (!node || node.type !== "color")
|
|
1729
1712
|
throw new Error(`Invalid color token: ${value[0]}`);
|
|
1730
|
-
return compileColorTokenValue(
|
|
1713
|
+
return compileColorTokenValue({
|
|
1714
|
+
...node,
|
|
1731
1715
|
hue: node.hue || hue
|
|
1732
|
-
})
|
|
1716
|
+
});
|
|
1733
1717
|
}
|
|
1734
1718
|
const defaultColorTokens = {
|
|
1735
1719
|
base: {
|
|
@@ -2401,14 +2385,6 @@ function _merge(acc, source) {
|
|
|
2401
2385
|
}
|
|
2402
2386
|
return acc;
|
|
2403
2387
|
}
|
|
2404
|
-
var __defProp$3 = Object.defineProperty, __defProps$3 = Object.defineProperties, __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$3 = Object.getOwnPropertySymbols, __hasOwnProp$3 = Object.prototype.hasOwnProperty, __propIsEnum$3 = Object.prototype.propertyIsEnumerable, __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$3 = (a, b) => {
|
|
2405
|
-
for (var prop in b || (b = {}))
|
|
2406
|
-
__hasOwnProp$3.call(b, prop) && __defNormalProp$3(a, prop, b[prop]);
|
|
2407
|
-
if (__getOwnPropSymbols$3)
|
|
2408
|
-
for (var prop of __getOwnPropSymbols$3(b))
|
|
2409
|
-
__propIsEnum$3.call(b, prop) && __defNormalProp$3(a, prop, b[prop]);
|
|
2410
|
-
return a;
|
|
2411
|
-
}, __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
2412
2388
|
function resolveColorTokens(inputTokens) {
|
|
2413
2389
|
const tokens = merge(defaultColorTokens, inputTokens);
|
|
2414
2390
|
return {
|
|
@@ -2426,27 +2402,25 @@ function resolveBaseColorTokens(sparseTokens) {
|
|
|
2426
2402
|
return tokens;
|
|
2427
2403
|
}
|
|
2428
2404
|
function resolveBaseColorTones(inputTokens, tone) {
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2405
|
+
const spec = merge(inputTokens?.base?.["*"], inputTokens?.base?.[tone]), hue = spec._hue || inputTokens?.base?.[tone]?._hue || "gray";
|
|
2406
|
+
return {
|
|
2407
|
+
...spec,
|
|
2432
2408
|
_hue: hue,
|
|
2433
|
-
avatar: color.COLOR_HUES.reduce((acc, hue2) => {
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
[tone2]
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
}, {})
|
|
2449
|
-
});
|
|
2409
|
+
avatar: color.COLOR_HUES.reduce((acc, hue2) => ({
|
|
2410
|
+
...acc,
|
|
2411
|
+
[hue2]: merge({
|
|
2412
|
+
_hue: hue2
|
|
2413
|
+
}, spec.avatar?.["*"], spec.avatar?.[hue2])
|
|
2414
|
+
}), {}),
|
|
2415
|
+
badge: THEME_COLOR_STATE_TONES.reduce((acc, tone2) => ({
|
|
2416
|
+
...acc,
|
|
2417
|
+
[tone2]: {
|
|
2418
|
+
_hue: inputTokens?.base?.[tone2]?._hue || hue,
|
|
2419
|
+
...spec.badge?.["*"],
|
|
2420
|
+
...spec.badge?.[tone2]
|
|
2421
|
+
}
|
|
2422
|
+
}), {})
|
|
2423
|
+
};
|
|
2450
2424
|
}
|
|
2451
2425
|
function resolveButtonColorTokens(inputTokens) {
|
|
2452
2426
|
const tokens = {};
|
|
@@ -2467,27 +2441,25 @@ function resolveButtonModeColorTokens(inputTokens, mode, tone) {
|
|
|
2467
2441
|
return tokens;
|
|
2468
2442
|
}
|
|
2469
2443
|
function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2444
|
+
const spec = merge(inputTokens?.button?.[mode]?.["*"]?.["*"], inputTokens?.button?.[mode]?.[tone]?.["*"], inputTokens?.button?.[mode]?.["*"]?.[state], inputTokens?.button?.[mode]?.[tone]?.[state]), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2445
|
+
return {
|
|
2446
|
+
...spec,
|
|
2473
2447
|
_hue: hue,
|
|
2474
|
-
avatar: color.COLOR_HUES.reduce((acc, hue2) => {
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
[tone2]
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
}, {})
|
|
2490
|
-
});
|
|
2448
|
+
avatar: color.COLOR_HUES.reduce((acc, hue2) => ({
|
|
2449
|
+
...acc,
|
|
2450
|
+
[hue2]: merge({
|
|
2451
|
+
_hue: hue2
|
|
2452
|
+
}, spec.avatar?.["*"], spec.avatar?.[hue2])
|
|
2453
|
+
}), {}),
|
|
2454
|
+
badge: THEME_COLOR_STATE_TONES.reduce((acc, tone2) => ({
|
|
2455
|
+
...acc,
|
|
2456
|
+
[tone2]: {
|
|
2457
|
+
_hue: inputTokens?.base?.[tone2]?._hue || hue,
|
|
2458
|
+
...spec.badge?.["*"],
|
|
2459
|
+
...spec.badge?.[tone2]
|
|
2460
|
+
}
|
|
2461
|
+
}), {})
|
|
2462
|
+
};
|
|
2491
2463
|
}
|
|
2492
2464
|
function resolveInputColorTokens(inputTokens) {
|
|
2493
2465
|
const tokens = {};
|
|
@@ -2502,11 +2474,11 @@ function resolveInputModeColorTokens(inputTokens, mode) {
|
|
|
2502
2474
|
return states;
|
|
2503
2475
|
}
|
|
2504
2476
|
function resolveInputStateColorTokens(inputTokens, mode, state) {
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2477
|
+
const spec = merge(inputTokens?.input?.["*"]?.["*"], inputTokens?.input?.[mode]?.["*"], inputTokens?.input?.["*"]?.[state], inputTokens?.input?.[mode]?.[state]), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
|
|
2478
|
+
return {
|
|
2479
|
+
...spec,
|
|
2508
2480
|
_hue: hue
|
|
2509
|
-
}
|
|
2481
|
+
};
|
|
2510
2482
|
}
|
|
2511
2483
|
function resolveSelectableColorTokens(inputTokens) {
|
|
2512
2484
|
const tokens = {};
|
|
@@ -2515,49 +2487,39 @@ function resolveSelectableColorTokens(inputTokens) {
|
|
|
2515
2487
|
return tokens;
|
|
2516
2488
|
}
|
|
2517
2489
|
function resolveSelectableToneColorTokens(inputTokens, tone) {
|
|
2518
|
-
var _a, _b, _c, _d;
|
|
2519
2490
|
const states = {
|
|
2520
|
-
_hue:
|
|
2491
|
+
_hue: inputTokens?.selectable?.[tone]?._hue || inputTokens?.base?.[tone]?._hue
|
|
2521
2492
|
};
|
|
2522
2493
|
for (const state of THEME_COLOR_STATES)
|
|
2523
2494
|
states[state] = resolveSelectableStateColorTokens(inputTokens, tone, state);
|
|
2524
2495
|
return states;
|
|
2525
2496
|
}
|
|
2526
2497
|
function resolveSelectableStateColorTokens(inputTokens, tone, state) {
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2498
|
+
const spec = merge(inputTokens?.selectable?.["*"]?.["*"], inputTokens?.selectable?.[tone]?.["*"], inputTokens?.selectable?.["*"]?.[state], inputTokens?.selectable?.[tone]?.[state]), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2499
|
+
return {
|
|
2500
|
+
...spec,
|
|
2530
2501
|
_hue: hue,
|
|
2531
|
-
avatar: color.COLOR_HUES.reduce((acc, hue2) => {
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
[tone2]
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
}, {})
|
|
2547
|
-
});
|
|
2502
|
+
avatar: color.COLOR_HUES.reduce((acc, hue2) => ({
|
|
2503
|
+
...acc,
|
|
2504
|
+
[hue2]: merge({
|
|
2505
|
+
_hue: hue2
|
|
2506
|
+
}, spec.avatar?.["*"], spec.avatar?.[hue2])
|
|
2507
|
+
}), {}),
|
|
2508
|
+
badge: THEME_COLOR_STATE_TONES.reduce((acc, tone2) => ({
|
|
2509
|
+
...acc,
|
|
2510
|
+
[tone2]: {
|
|
2511
|
+
_hue: inputTokens?.base?.[tone2]?._hue || hue,
|
|
2512
|
+
...spec.badge?.["*"],
|
|
2513
|
+
...spec.badge?.[tone2]
|
|
2514
|
+
}
|
|
2515
|
+
}), {})
|
|
2516
|
+
};
|
|
2548
2517
|
}
|
|
2549
|
-
var __defProp$2 = Object.defineProperty, __defProps$2 = Object.defineProperties, __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$2 = Object.getOwnPropertySymbols, __hasOwnProp$2 = Object.prototype.hasOwnProperty, __propIsEnum$2 = Object.prototype.propertyIsEnumerable, __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$2 = (a, b) => {
|
|
2550
|
-
for (var prop in b || (b = {}))
|
|
2551
|
-
__hasOwnProp$2.call(b, prop) && __defNormalProp$2(a, prop, b[prop]);
|
|
2552
|
-
if (__getOwnPropSymbols$2)
|
|
2553
|
-
for (var prop of __getOwnPropSymbols$2(b))
|
|
2554
|
-
__propIsEnum$2.call(b, prop) && __defNormalProp$2(a, prop, b[prop]);
|
|
2555
|
-
return a;
|
|
2556
|
-
}, __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
2557
2518
|
function buildColorTheme(config) {
|
|
2558
|
-
const resolvedConfig =
|
|
2559
|
-
|
|
2560
|
-
|
|
2519
|
+
const resolvedConfig = {
|
|
2520
|
+
...config,
|
|
2521
|
+
color: resolveColorTokens(config?.color)
|
|
2522
|
+
};
|
|
2561
2523
|
return {
|
|
2562
2524
|
light: buildColorScheme({
|
|
2563
2525
|
scheme: "light"
|
|
@@ -2579,55 +2541,54 @@ function buildColorScheme(options, config) {
|
|
|
2579
2541
|
return colorScheme;
|
|
2580
2542
|
}
|
|
2581
2543
|
function buildCardColorTheme(options, config) {
|
|
2582
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2583
2544
|
const {
|
|
2584
2545
|
scheme,
|
|
2585
2546
|
tone
|
|
2586
|
-
} = options, tokens =
|
|
2587
|
-
hue:
|
|
2547
|
+
} = options, tokens = config?.color?.base?.[tone], context = {
|
|
2548
|
+
hue: tokens?._hue || "gray",
|
|
2588
2549
|
scheme
|
|
2589
2550
|
};
|
|
2590
2551
|
return {
|
|
2591
|
-
_blend: (
|
|
2552
|
+
_blend: (tokens?._blend || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
|
|
2592
2553
|
_dark: scheme === "dark",
|
|
2593
2554
|
accent: {
|
|
2594
|
-
fg: resolveColorTokenValue(context,
|
|
2555
|
+
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2595
2556
|
},
|
|
2596
2557
|
avatar: buildAvatarColorTheme({
|
|
2597
2558
|
scheme
|
|
2598
2559
|
}, tokens),
|
|
2599
|
-
backdrop: resolveColorTokenValue(context, tokens
|
|
2600
|
-
badge: buildBadgeColorTheme(tokens
|
|
2560
|
+
backdrop: resolveColorTokenValue(context, tokens?.backdrop),
|
|
2561
|
+
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2601
2562
|
scheme
|
|
2602
2563
|
}, config),
|
|
2603
|
-
bg: resolveColorTokenValue(context, tokens
|
|
2604
|
-
border: resolveColorTokenValue(context, tokens
|
|
2564
|
+
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2565
|
+
border: resolveColorTokenValue(context, tokens?.border),
|
|
2605
2566
|
button: buildButtonColorTheme({
|
|
2606
2567
|
scheme,
|
|
2607
2568
|
tone
|
|
2608
2569
|
}, config),
|
|
2609
2570
|
code: {
|
|
2610
|
-
bg: resolveColorTokenValue(context,
|
|
2611
|
-
fg: resolveColorTokenValue(context,
|
|
2571
|
+
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
2572
|
+
fg: resolveColorTokenValue(context, tokens?.code?.fg)
|
|
2612
2573
|
},
|
|
2613
|
-
fg: resolveColorTokenValue(context, tokens
|
|
2614
|
-
focusRing: resolveColorTokenValue(context, tokens
|
|
2615
|
-
icon: resolveColorTokenValue(context, tokens
|
|
2574
|
+
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2575
|
+
focusRing: resolveColorTokenValue(context, tokens?.focusRing),
|
|
2576
|
+
icon: resolveColorTokenValue(context, tokens?.icon),
|
|
2616
2577
|
input: buildInputColorTheme({
|
|
2617
2578
|
scheme,
|
|
2618
2579
|
tone
|
|
2619
2580
|
}, config),
|
|
2620
2581
|
kbd: {
|
|
2621
|
-
bg: resolveColorTokenValue(context,
|
|
2622
|
-
fg: resolveColorTokenValue(context,
|
|
2623
|
-
border: resolveColorTokenValue(context,
|
|
2582
|
+
bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
|
|
2583
|
+
fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
|
|
2584
|
+
border: resolveColorTokenValue(context, tokens?.kbd?.border)
|
|
2624
2585
|
},
|
|
2625
2586
|
link: {
|
|
2626
|
-
fg: resolveColorTokenValue(context,
|
|
2587
|
+
fg: resolveColorTokenValue(context, tokens?.link?.fg)
|
|
2627
2588
|
},
|
|
2628
2589
|
muted: {
|
|
2629
|
-
bg: resolveColorTokenValue(context,
|
|
2630
|
-
fg: resolveColorTokenValue(context,
|
|
2590
|
+
bg: resolveColorTokenValue(context, tokens?.muted?.bg),
|
|
2591
|
+
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2631
2592
|
},
|
|
2632
2593
|
selectable: buildSelectableColorTheme({
|
|
2633
2594
|
scheme,
|
|
@@ -2638,8 +2599,8 @@ function buildCardColorTheme(options, config) {
|
|
|
2638
2599
|
tone
|
|
2639
2600
|
}, config),
|
|
2640
2601
|
skeleton: {
|
|
2641
|
-
from: resolveColorTokenValue(context,
|
|
2642
|
-
to: resolveColorTokenValue(context,
|
|
2602
|
+
from: resolveColorTokenValue(context, tokens?.skeleton?.from),
|
|
2603
|
+
to: resolveColorTokenValue(context, tokens?.skeleton?.to)
|
|
2643
2604
|
},
|
|
2644
2605
|
syntax: buildSyntaxColorTheme({
|
|
2645
2606
|
scheme
|
|
@@ -2647,19 +2608,18 @@ function buildCardColorTheme(options, config) {
|
|
|
2647
2608
|
};
|
|
2648
2609
|
}
|
|
2649
2610
|
function buildShadowColorTheme(options, config) {
|
|
2650
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2651
2611
|
const {
|
|
2652
2612
|
scheme,
|
|
2653
2613
|
tone
|
|
2654
|
-
} = options, tokens =
|
|
2655
|
-
hue:
|
|
2614
|
+
} = options, tokens = config?.color?.base?.[tone], context = {
|
|
2615
|
+
hue: tokens?._hue || "gray",
|
|
2656
2616
|
scheme
|
|
2657
2617
|
};
|
|
2658
2618
|
return {
|
|
2659
|
-
outline: resolveColorTokenValue(context,
|
|
2660
|
-
umbra: resolveColorTokenValue(context,
|
|
2661
|
-
penumbra: resolveColorTokenValue(context,
|
|
2662
|
-
ambient: resolveColorTokenValue(context,
|
|
2619
|
+
outline: resolveColorTokenValue(context, tokens?.shadow?.outline),
|
|
2620
|
+
umbra: resolveColorTokenValue(context, tokens?.shadow?.umbra),
|
|
2621
|
+
penumbra: resolveColorTokenValue(context, tokens?.shadow?.penumbra),
|
|
2622
|
+
ambient: resolveColorTokenValue(context, tokens?.shadow?.ambient)
|
|
2663
2623
|
};
|
|
2664
2624
|
}
|
|
2665
2625
|
function buildAvatarColorTheme(options, stateTokens) {
|
|
@@ -2706,18 +2666,17 @@ function buildAvatarColorTheme(options, stateTokens) {
|
|
|
2706
2666
|
};
|
|
2707
2667
|
}
|
|
2708
2668
|
function _buildAvatarColorTheme(options, stateTokens) {
|
|
2709
|
-
var _a;
|
|
2710
2669
|
const {
|
|
2711
2670
|
color: color2,
|
|
2712
2671
|
scheme
|
|
2713
|
-
} = options, tokens =
|
|
2714
|
-
hue:
|
|
2672
|
+
} = options, tokens = stateTokens?.avatar?.[color2], context = {
|
|
2673
|
+
hue: tokens?._hue || "gray",
|
|
2715
2674
|
scheme
|
|
2716
2675
|
};
|
|
2717
2676
|
return {
|
|
2718
|
-
_blend: (
|
|
2719
|
-
bg: resolveColorTokenValue(context, tokens
|
|
2720
|
-
fg: resolveColorTokenValue(context, tokens
|
|
2677
|
+
_blend: (tokens?._blend || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
|
|
2678
|
+
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2679
|
+
fg: resolveColorTokenValue(context, tokens?.fg)
|
|
2721
2680
|
};
|
|
2722
2681
|
}
|
|
2723
2682
|
function buildBadgeColorTheme(tokens, options, config) {
|
|
@@ -2732,19 +2691,18 @@ function buildBadgeColorTheme(tokens, options, config) {
|
|
|
2732
2691
|
return colorBadge;
|
|
2733
2692
|
}
|
|
2734
2693
|
function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
2735
|
-
var _a, _b, _c;
|
|
2736
2694
|
const {
|
|
2737
2695
|
scheme,
|
|
2738
2696
|
tone
|
|
2739
|
-
} = options, tokens = parentTokens
|
|
2740
|
-
hue:
|
|
2697
|
+
} = options, tokens = parentTokens?.[tone], context = {
|
|
2698
|
+
hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray",
|
|
2741
2699
|
scheme
|
|
2742
2700
|
};
|
|
2743
2701
|
return {
|
|
2744
|
-
bg: resolveColorTokenValue(context, tokens
|
|
2745
|
-
fg: resolveColorTokenValue(context, tokens
|
|
2746
|
-
dot: resolveColorTokenValue(context, tokens
|
|
2747
|
-
icon: resolveColorTokenValue(context, tokens
|
|
2702
|
+
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2703
|
+
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2704
|
+
dot: resolveColorTokenValue(context, tokens?.dot),
|
|
2705
|
+
icon: resolveColorTokenValue(context, tokens?.icon)
|
|
2748
2706
|
};
|
|
2749
2707
|
}
|
|
2750
2708
|
function buildButtonColorTheme(options, config) {
|
|
@@ -2793,51 +2751,50 @@ function buildButtonStatesColorTheme(options, config) {
|
|
|
2793
2751
|
return states;
|
|
2794
2752
|
}
|
|
2795
2753
|
function buildButtonStateColorTheme(options, config) {
|
|
2796
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2797
2754
|
const {
|
|
2798
2755
|
cardTone,
|
|
2799
2756
|
mode,
|
|
2800
2757
|
tone,
|
|
2801
2758
|
scheme,
|
|
2802
2759
|
state
|
|
2803
|
-
} = options, cardTokens =
|
|
2760
|
+
} = options, cardTokens = config?.color?.base?.[cardTone], tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || cardTokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2804
2761
|
hue,
|
|
2805
2762
|
scheme
|
|
2806
2763
|
};
|
|
2807
2764
|
return {
|
|
2808
2765
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2809
2766
|
accent: {
|
|
2810
|
-
fg: resolveColorTokenValue(context,
|
|
2767
|
+
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2811
2768
|
},
|
|
2812
2769
|
avatar: buildAvatarColorTheme({
|
|
2813
2770
|
scheme
|
|
2814
2771
|
}, tokens),
|
|
2815
|
-
badge: buildBadgeColorTheme(tokens
|
|
2772
|
+
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2816
2773
|
scheme
|
|
2817
2774
|
}, config),
|
|
2818
|
-
bg: resolveColorTokenValue(context, tokens
|
|
2819
|
-
border: resolveColorTokenValue(context, tokens
|
|
2775
|
+
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2776
|
+
border: resolveColorTokenValue(context, tokens?.border),
|
|
2820
2777
|
code: {
|
|
2821
|
-
bg: resolveColorTokenValue(context,
|
|
2822
|
-
fg: resolveColorTokenValue(context,
|
|
2778
|
+
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
2779
|
+
fg: resolveColorTokenValue(context, tokens?.code?.fg)
|
|
2823
2780
|
},
|
|
2824
|
-
fg: resolveColorTokenValue(context, tokens
|
|
2825
|
-
icon: resolveColorTokenValue(context, tokens
|
|
2781
|
+
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2782
|
+
icon: resolveColorTokenValue(context, tokens?.icon),
|
|
2826
2783
|
muted: {
|
|
2827
|
-
bg: resolveColorTokenValue(context,
|
|
2828
|
-
fg: resolveColorTokenValue(context,
|
|
2784
|
+
bg: resolveColorTokenValue(context, tokens?.muted?.bg),
|
|
2785
|
+
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2829
2786
|
},
|
|
2830
2787
|
kbd: {
|
|
2831
|
-
bg: resolveColorTokenValue(context,
|
|
2832
|
-
fg: resolveColorTokenValue(context,
|
|
2833
|
-
border: resolveColorTokenValue(context,
|
|
2788
|
+
bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
|
|
2789
|
+
fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
|
|
2790
|
+
border: resolveColorTokenValue(context, tokens?.kbd?.border)
|
|
2834
2791
|
},
|
|
2835
2792
|
link: {
|
|
2836
|
-
fg: resolveColorTokenValue(context,
|
|
2793
|
+
fg: resolveColorTokenValue(context, tokens?.link?.fg)
|
|
2837
2794
|
},
|
|
2838
2795
|
skeleton: {
|
|
2839
|
-
from: resolveColorTokenValue(context,
|
|
2840
|
-
to: resolveColorTokenValue(context,
|
|
2796
|
+
from: resolveColorTokenValue(context, tokens?.skeleton?.from),
|
|
2797
|
+
to: resolveColorTokenValue(context, tokens?.skeleton?.to)
|
|
2841
2798
|
}
|
|
2842
2799
|
};
|
|
2843
2800
|
}
|
|
@@ -2893,25 +2850,24 @@ function buildInputStatesColorTheme(options, config) {
|
|
|
2893
2850
|
};
|
|
2894
2851
|
}
|
|
2895
2852
|
function buildInputStateColorTheme(options, config) {
|
|
2896
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2897
2853
|
const {
|
|
2898
2854
|
cardTone,
|
|
2899
2855
|
mode,
|
|
2900
2856
|
scheme,
|
|
2901
2857
|
state
|
|
2902
|
-
} = options, cardTokens =
|
|
2858
|
+
} = options, cardTokens = config?.color?.base?.[cardTone], tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || cardTokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2903
2859
|
hue,
|
|
2904
2860
|
scheme
|
|
2905
2861
|
};
|
|
2906
2862
|
return {
|
|
2907
2863
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2908
|
-
bg: resolveColorTokenValue(context, tokens
|
|
2909
|
-
border: resolveColorTokenValue(context, tokens
|
|
2910
|
-
fg: resolveColorTokenValue(context, tokens
|
|
2864
|
+
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2865
|
+
border: resolveColorTokenValue(context, tokens?.border),
|
|
2866
|
+
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2911
2867
|
muted: {
|
|
2912
|
-
bg: resolveColorTokenValue(context,
|
|
2868
|
+
bg: resolveColorTokenValue(context, tokens?.muted?.bg)
|
|
2913
2869
|
},
|
|
2914
|
-
placeholder: resolveColorTokenValue(context, tokens
|
|
2870
|
+
placeholder: resolveColorTokenValue(context, tokens?.placeholder)
|
|
2915
2871
|
};
|
|
2916
2872
|
}
|
|
2917
2873
|
function buildSelectableColorTheme(options, config) {
|
|
@@ -2943,98 +2899,96 @@ function buildSelectableStatesColorTheme(options, config) {
|
|
|
2943
2899
|
return states;
|
|
2944
2900
|
}
|
|
2945
2901
|
function buildSelectableStateColorTheme(options, config) {
|
|
2946
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
2947
2902
|
const {
|
|
2948
2903
|
cardTone,
|
|
2949
2904
|
scheme,
|
|
2950
2905
|
state,
|
|
2951
2906
|
tone
|
|
2952
|
-
} = options, cardTokens =
|
|
2907
|
+
} = options, cardTokens = config?.color?.base?.[cardTone], tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || cardTokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2953
2908
|
hue,
|
|
2954
2909
|
scheme
|
|
2955
2910
|
};
|
|
2956
2911
|
return {
|
|
2957
2912
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2958
2913
|
accent: {
|
|
2959
|
-
fg: resolveColorTokenValue(context,
|
|
2914
|
+
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2960
2915
|
},
|
|
2961
2916
|
avatar: buildAvatarColorTheme({
|
|
2962
2917
|
scheme
|
|
2963
2918
|
}, tokens),
|
|
2964
|
-
badge: buildBadgeColorTheme(tokens
|
|
2919
|
+
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2965
2920
|
scheme
|
|
2966
2921
|
}, config),
|
|
2967
|
-
bg: resolveColorTokenValue(context, tokens
|
|
2968
|
-
border: resolveColorTokenValue(context, tokens
|
|
2922
|
+
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2923
|
+
border: resolveColorTokenValue(context, tokens?.border),
|
|
2969
2924
|
code: {
|
|
2970
|
-
bg: resolveColorTokenValue(context,
|
|
2971
|
-
fg: resolveColorTokenValue(context,
|
|
2925
|
+
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
2926
|
+
fg: resolveColorTokenValue(context, tokens?.code?.fg)
|
|
2972
2927
|
},
|
|
2973
|
-
fg: resolveColorTokenValue(context, tokens
|
|
2974
|
-
icon: resolveColorTokenValue(context, tokens
|
|
2928
|
+
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2929
|
+
icon: resolveColorTokenValue(context, tokens?.icon),
|
|
2975
2930
|
muted: {
|
|
2976
|
-
bg: resolveColorTokenValue(context,
|
|
2977
|
-
fg: resolveColorTokenValue(context,
|
|
2931
|
+
bg: resolveColorTokenValue(context, tokens?.muted?.bg),
|
|
2932
|
+
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2978
2933
|
},
|
|
2979
2934
|
kbd: {
|
|
2980
|
-
bg: resolveColorTokenValue(context,
|
|
2981
|
-
fg: resolveColorTokenValue(context,
|
|
2982
|
-
border: resolveColorTokenValue(context,
|
|
2935
|
+
bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
|
|
2936
|
+
fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
|
|
2937
|
+
border: resolveColorTokenValue(context, tokens?.kbd?.border)
|
|
2983
2938
|
},
|
|
2984
2939
|
link: {
|
|
2985
|
-
fg: resolveColorTokenValue(context,
|
|
2940
|
+
fg: resolveColorTokenValue(context, tokens?.link?.fg)
|
|
2986
2941
|
},
|
|
2987
2942
|
skeleton: {
|
|
2988
|
-
from: resolveColorTokenValue(context,
|
|
2989
|
-
to: resolveColorTokenValue(context,
|
|
2943
|
+
from: resolveColorTokenValue(context, tokens?.skeleton?.from),
|
|
2944
|
+
to: resolveColorTokenValue(context, tokens?.skeleton?.to)
|
|
2990
2945
|
}
|
|
2991
2946
|
};
|
|
2992
2947
|
}
|
|
2993
2948
|
function buildSyntaxColorTheme(options, config) {
|
|
2994
|
-
var _a;
|
|
2995
2949
|
const {
|
|
2996
2950
|
scheme
|
|
2997
|
-
} = options, tokens =
|
|
2951
|
+
} = options, tokens = config?.color?.syntax, context = {
|
|
2998
2952
|
hue: "gray",
|
|
2999
2953
|
scheme
|
|
3000
2954
|
};
|
|
3001
2955
|
return {
|
|
3002
|
-
atrule: resolveColorTokenValue(context, tokens
|
|
3003
|
-
attrName: resolveColorTokenValue(context, tokens
|
|
3004
|
-
attrValue: resolveColorTokenValue(context, tokens
|
|
3005
|
-
attribute: resolveColorTokenValue(context, tokens
|
|
3006
|
-
boolean: resolveColorTokenValue(context, tokens
|
|
3007
|
-
builtin: resolveColorTokenValue(context, tokens
|
|
3008
|
-
cdata: resolveColorTokenValue(context, tokens
|
|
3009
|
-
char: resolveColorTokenValue(context, tokens
|
|
3010
|
-
class: resolveColorTokenValue(context, tokens
|
|
3011
|
-
className: resolveColorTokenValue(context, tokens
|
|
3012
|
-
comment: resolveColorTokenValue(context, tokens
|
|
3013
|
-
constant: resolveColorTokenValue(context, tokens
|
|
3014
|
-
deleted: resolveColorTokenValue(context, tokens
|
|
3015
|
-
doctype: resolveColorTokenValue(context, tokens
|
|
3016
|
-
entity: resolveColorTokenValue(context, tokens
|
|
3017
|
-
function: resolveColorTokenValue(context, tokens
|
|
3018
|
-
hexcode: resolveColorTokenValue(context, tokens
|
|
3019
|
-
id: resolveColorTokenValue(context, tokens
|
|
3020
|
-
important: resolveColorTokenValue(context, tokens
|
|
3021
|
-
inserted: resolveColorTokenValue(context, tokens
|
|
3022
|
-
keyword: resolveColorTokenValue(context, tokens
|
|
3023
|
-
number: resolveColorTokenValue(context, tokens
|
|
3024
|
-
operator: resolveColorTokenValue(context, tokens
|
|
3025
|
-
prolog: resolveColorTokenValue(context, tokens
|
|
3026
|
-
property: resolveColorTokenValue(context, tokens
|
|
3027
|
-
pseudoClass: resolveColorTokenValue(context, tokens
|
|
3028
|
-
pseudoElement: resolveColorTokenValue(context, tokens
|
|
3029
|
-
punctuation: resolveColorTokenValue(context, tokens
|
|
3030
|
-
regex: resolveColorTokenValue(context, tokens
|
|
3031
|
-
selector: resolveColorTokenValue(context, tokens
|
|
3032
|
-
string: resolveColorTokenValue(context, tokens
|
|
3033
|
-
symbol: resolveColorTokenValue(context, tokens
|
|
3034
|
-
tag: resolveColorTokenValue(context, tokens
|
|
3035
|
-
unit: resolveColorTokenValue(context, tokens
|
|
3036
|
-
url: resolveColorTokenValue(context, tokens
|
|
3037
|
-
variable: resolveColorTokenValue(context, tokens
|
|
2956
|
+
atrule: resolveColorTokenValue(context, tokens?.atrule),
|
|
2957
|
+
attrName: resolveColorTokenValue(context, tokens?.attrName),
|
|
2958
|
+
attrValue: resolveColorTokenValue(context, tokens?.attrValue),
|
|
2959
|
+
attribute: resolveColorTokenValue(context, tokens?.attribute),
|
|
2960
|
+
boolean: resolveColorTokenValue(context, tokens?.boolean),
|
|
2961
|
+
builtin: resolveColorTokenValue(context, tokens?.builtin),
|
|
2962
|
+
cdata: resolveColorTokenValue(context, tokens?.cdata),
|
|
2963
|
+
char: resolveColorTokenValue(context, tokens?.char),
|
|
2964
|
+
class: resolveColorTokenValue(context, tokens?.class),
|
|
2965
|
+
className: resolveColorTokenValue(context, tokens?.className),
|
|
2966
|
+
comment: resolveColorTokenValue(context, tokens?.comment),
|
|
2967
|
+
constant: resolveColorTokenValue(context, tokens?.constant),
|
|
2968
|
+
deleted: resolveColorTokenValue(context, tokens?.deleted),
|
|
2969
|
+
doctype: resolveColorTokenValue(context, tokens?.doctype),
|
|
2970
|
+
entity: resolveColorTokenValue(context, tokens?.entity),
|
|
2971
|
+
function: resolveColorTokenValue(context, tokens?.function),
|
|
2972
|
+
hexcode: resolveColorTokenValue(context, tokens?.hexcode),
|
|
2973
|
+
id: resolveColorTokenValue(context, tokens?.id),
|
|
2974
|
+
important: resolveColorTokenValue(context, tokens?.important),
|
|
2975
|
+
inserted: resolveColorTokenValue(context, tokens?.inserted),
|
|
2976
|
+
keyword: resolveColorTokenValue(context, tokens?.keyword),
|
|
2977
|
+
number: resolveColorTokenValue(context, tokens?.number),
|
|
2978
|
+
operator: resolveColorTokenValue(context, tokens?.operator),
|
|
2979
|
+
prolog: resolveColorTokenValue(context, tokens?.prolog),
|
|
2980
|
+
property: resolveColorTokenValue(context, tokens?.property),
|
|
2981
|
+
pseudoClass: resolveColorTokenValue(context, tokens?.pseudoClass),
|
|
2982
|
+
pseudoElement: resolveColorTokenValue(context, tokens?.pseudoElement),
|
|
2983
|
+
punctuation: resolveColorTokenValue(context, tokens?.punctuation),
|
|
2984
|
+
regex: resolveColorTokenValue(context, tokens?.regex),
|
|
2985
|
+
selector: resolveColorTokenValue(context, tokens?.selector),
|
|
2986
|
+
string: resolveColorTokenValue(context, tokens?.string),
|
|
2987
|
+
symbol: resolveColorTokenValue(context, tokens?.symbol),
|
|
2988
|
+
tag: resolveColorTokenValue(context, tokens?.tag),
|
|
2989
|
+
unit: resolveColorTokenValue(context, tokens?.unit),
|
|
2990
|
+
url: resolveColorTokenValue(context, tokens?.url),
|
|
2991
|
+
variable: resolveColorTokenValue(context, tokens?.variable)
|
|
3038
2992
|
};
|
|
3039
2993
|
}
|
|
3040
2994
|
const defaultColorPalette = color.color;
|
|
@@ -3249,17 +3203,8 @@ function renderColorValue(str, options) {
|
|
|
3249
3203
|
function renderColorHex(color2) {
|
|
3250
3204
|
return typeof color2 == "string" ? color2 : color2.hex;
|
|
3251
3205
|
}
|
|
3252
|
-
var __defProp$1 = Object.defineProperty, __defProps$1 = Object.defineProperties, __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1 = Object.getOwnPropertySymbols, __hasOwnProp$1 = Object.prototype.hasOwnProperty, __propIsEnum$1 = Object.prototype.propertyIsEnumerable, __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$1 = (a, b) => {
|
|
3253
|
-
for (var prop in b || (b = {}))
|
|
3254
|
-
__hasOwnProp$1.call(b, prop) && __defNormalProp$1(a, prop, b[prop]);
|
|
3255
|
-
if (__getOwnPropSymbols$1)
|
|
3256
|
-
for (var prop of __getOwnPropSymbols$1(b))
|
|
3257
|
-
__propIsEnum$1.call(b, prop) && __defNormalProp$1(a, prop, b[prop]);
|
|
3258
|
-
return a;
|
|
3259
|
-
}, __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
3260
3206
|
function renderThemeColorSchemes(value, config) {
|
|
3261
|
-
|
|
3262
|
-
const colorPalette = (_a = config == null ? void 0 : config.palette) != null ? _a : defaultColorPalette;
|
|
3207
|
+
const colorPalette = config?.palette ?? defaultColorPalette;
|
|
3263
3208
|
return {
|
|
3264
3209
|
light: renderThemeColorScheme(colorPalette, value.light),
|
|
3265
3210
|
dark: renderThemeColorScheme(colorPalette, value.dark)
|
|
@@ -3300,24 +3245,30 @@ function renderThemeColor(value, options) {
|
|
|
3300
3245
|
blendMode
|
|
3301
3246
|
}), shadow = {
|
|
3302
3247
|
outline: renderColorValue(value.shadow.outline, colorOptions),
|
|
3303
|
-
umbra: renderColorValue(value.shadow.umbra,
|
|
3248
|
+
umbra: renderColorValue(value.shadow.umbra, {
|
|
3249
|
+
...colorOptions,
|
|
3304
3250
|
bg: void 0,
|
|
3305
|
-
colorPalette:
|
|
3251
|
+
colorPalette: {
|
|
3252
|
+
...colorPalette,
|
|
3306
3253
|
black: "#000000"
|
|
3307
|
-
}
|
|
3308
|
-
})
|
|
3309
|
-
penumbra: renderColorValue(value.shadow.penumbra,
|
|
3254
|
+
}
|
|
3255
|
+
}),
|
|
3256
|
+
penumbra: renderColorValue(value.shadow.penumbra, {
|
|
3257
|
+
...colorOptions,
|
|
3310
3258
|
bg: void 0,
|
|
3311
|
-
colorPalette:
|
|
3259
|
+
colorPalette: {
|
|
3260
|
+
...colorPalette,
|
|
3312
3261
|
black: "#000000"
|
|
3313
|
-
}
|
|
3314
|
-
})
|
|
3315
|
-
ambient: renderColorValue(value.shadow.ambient,
|
|
3262
|
+
}
|
|
3263
|
+
}),
|
|
3264
|
+
ambient: renderColorValue(value.shadow.ambient, {
|
|
3265
|
+
...colorOptions,
|
|
3316
3266
|
bg: void 0,
|
|
3317
|
-
colorPalette:
|
|
3267
|
+
colorPalette: {
|
|
3268
|
+
...colorPalette,
|
|
3318
3269
|
black: "#000000"
|
|
3319
|
-
}
|
|
3320
|
-
})
|
|
3270
|
+
}
|
|
3271
|
+
})
|
|
3321
3272
|
};
|
|
3322
3273
|
return {
|
|
3323
3274
|
_blend: blendMode,
|
|
@@ -3472,7 +3423,6 @@ function renderThemeColorButtonStates(value, options) {
|
|
|
3472
3423
|
};
|
|
3473
3424
|
}
|
|
3474
3425
|
function renderThemeColorState(value, options) {
|
|
3475
|
-
var _a, _b;
|
|
3476
3426
|
const {
|
|
3477
3427
|
baseBg,
|
|
3478
3428
|
blendMode: rootBlendMode,
|
|
@@ -3522,8 +3472,8 @@ function renderThemeColorState(value, options) {
|
|
|
3522
3472
|
border: renderColorValue(value.kbd.border, colorOptions)
|
|
3523
3473
|
},
|
|
3524
3474
|
skeleton: {
|
|
3525
|
-
from: renderColorValue(
|
|
3526
|
-
to: renderColorValue(
|
|
3475
|
+
from: renderColorValue(value.skeleton?.from, colorOptions),
|
|
3476
|
+
to: renderColorValue(value.skeleton?.to, colorOptions)
|
|
3527
3477
|
}
|
|
3528
3478
|
};
|
|
3529
3479
|
}
|
|
@@ -3631,52 +3581,45 @@ function renderSyntaxColorTheme(value, options) {
|
|
|
3631
3581
|
};
|
|
3632
3582
|
}
|
|
3633
3583
|
function buildTheme(config) {
|
|
3634
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
3635
3584
|
const colorTheme = buildColorTheme(config), v2 = {
|
|
3636
3585
|
_version: 2,
|
|
3637
|
-
avatar:
|
|
3638
|
-
button:
|
|
3639
|
-
card:
|
|
3586
|
+
avatar: config?.avatar ?? getTheme_v2.defaultThemeConfig.avatar,
|
|
3587
|
+
button: config?.button ?? getTheme_v2.defaultThemeConfig.button,
|
|
3588
|
+
card: config?.card ?? getTheme_v2.defaultThemeConfig.card,
|
|
3640
3589
|
// How colors are generated:
|
|
3641
3590
|
// 1. Merge custom tokens with default tokens
|
|
3642
3591
|
// 2. Generate tree of color keys (gray/500, black, white, etc.)
|
|
3643
3592
|
// 3. Apply mixing and render to hex values
|
|
3644
3593
|
// render(build(mergeWithDefaults()))
|
|
3645
3594
|
color: renderThemeColorSchemes(colorTheme, config),
|
|
3646
|
-
container:
|
|
3647
|
-
font:
|
|
3648
|
-
input:
|
|
3649
|
-
layer:
|
|
3650
|
-
media:
|
|
3651
|
-
radius:
|
|
3652
|
-
shadow:
|
|
3653
|
-
space:
|
|
3654
|
-
style:
|
|
3595
|
+
container: config?.container ?? getTheme_v2.defaultThemeConfig.container,
|
|
3596
|
+
font: config?.font ?? defaultThemeFonts,
|
|
3597
|
+
input: config?.input ?? getTheme_v2.defaultThemeConfig.input,
|
|
3598
|
+
layer: config?.layer ?? getTheme_v2.defaultThemeConfig.layer,
|
|
3599
|
+
media: config?.media ?? getTheme_v2.defaultThemeConfig.media,
|
|
3600
|
+
radius: config?.radius ?? getTheme_v2.defaultThemeConfig.radius,
|
|
3601
|
+
shadow: config?.shadow ?? getTheme_v2.defaultThemeConfig.shadow,
|
|
3602
|
+
space: config?.space ?? getTheme_v2.defaultThemeConfig.space,
|
|
3603
|
+
style: config?.style ?? getTheme_v2.defaultThemeConfig.style
|
|
3655
3604
|
};
|
|
3656
3605
|
return v2_v0(v2);
|
|
3657
3606
|
}
|
|
3658
|
-
var __defProp = Object.defineProperty, __defProps = Object.defineProperties, __getOwnPropDescs = Object.getOwnPropertyDescriptors, __getOwnPropSymbols = Object.getOwnPropertySymbols, __hasOwnProp = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable, __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues = (a, b) => {
|
|
3659
|
-
for (var prop in b || (b = {}))
|
|
3660
|
-
__hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);
|
|
3661
|
-
if (__getOwnPropSymbols)
|
|
3662
|
-
for (var prop of __getOwnPropSymbols(b))
|
|
3663
|
-
__propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);
|
|
3664
|
-
return a;
|
|
3665
|
-
}, __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
3666
3607
|
const cache = /* @__PURE__ */ new Map();
|
|
3667
3608
|
function getScopedTheme(themeProp, scheme, tone) {
|
|
3668
3609
|
const cachedTheme = _getCachedTheme(themeProp, scheme, tone);
|
|
3669
3610
|
if (cachedTheme) return cachedTheme;
|
|
3670
3611
|
const v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp, v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp), colorScheme_v0 = v0.color[scheme] || v0.color.light, color_v0 = colorScheme_v0[tone] || colorScheme_v0.default, layer_v0 = v0.layer || getTheme_v2.defaultThemeConfig.layer, colorScheme_v2 = v2.color[scheme] || v2.color.light, color_v2 = colorScheme_v2[tone] || colorScheme_v2.default, layer_v2 = v2.layer || getTheme_v2.defaultThemeConfig.layer, theme = {
|
|
3671
|
-
sanity:
|
|
3612
|
+
sanity: {
|
|
3613
|
+
...v0,
|
|
3672
3614
|
color: color_v0,
|
|
3673
3615
|
layer: layer_v0,
|
|
3674
|
-
v2:
|
|
3616
|
+
v2: {
|
|
3617
|
+
...v2,
|
|
3675
3618
|
_resolved: !0,
|
|
3676
3619
|
color: color_v2,
|
|
3677
3620
|
layer: layer_v2
|
|
3678
|
-
}
|
|
3679
|
-
}
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3680
3623
|
};
|
|
3681
3624
|
return _setCachedTheme(themeProp, scheme, tone, theme), theme;
|
|
3682
3625
|
}
|