@sanity/ui 2.10.3 → 2.10.5

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