@sanity/ui 2.0.0-alpha.13 → 2.0.0-alpha.15

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.
Files changed (34) hide show
  1. package/dist/index.cjs.mjs +27 -0
  2. package/dist/index.d.ts +359 -7
  3. package/dist/index.esm.js +860 -60
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +887 -60
  6. package/dist/index.js.map +1 -1
  7. package/package.json +2 -2
  8. package/src/components/dialog/dialog.tsx +4 -2
  9. package/src/theme/_internal/__workshop__/build/story.tsx +288 -0
  10. package/src/theme/_internal/__workshop__/build/theme.ts +3 -0
  11. package/src/theme/_internal/__workshop__/index.ts +14 -0
  12. package/src/theme/_internal/build/buildTheme.test.ts +78 -0
  13. package/src/theme/_internal/build/buildTheme.ts +16 -0
  14. package/src/theme/_internal/build/colorTheme/buildColorTheme.test.ts +185 -0
  15. package/src/theme/_internal/build/colorTheme/buildColorTheme.ts +164 -0
  16. package/src/theme/_internal/build/colorTheme/renderColorTheme.ts +242 -0
  17. package/src/theme/_internal/build/colorTheme/resolveColorTokens.ts +121 -0
  18. package/src/theme/_internal/build/defaults/colorPalette.ts +8 -0
  19. package/src/theme/_internal/build/defaults/colorTokens.ts +147 -0
  20. package/src/theme/_internal/build/helpers.ts +65 -0
  21. package/src/theme/_internal/build/index.ts +1 -0
  22. package/src/theme/_internal/config/helpers.ts +47 -0
  23. package/src/theme/_internal/config/index.ts +3 -0
  24. package/src/theme/_internal/config/token/index.ts +2 -0
  25. package/src/theme/_internal/config/token/parseTokenKey.test.ts +72 -0
  26. package/src/theme/_internal/config/token/parseTokenKey.ts +88 -0
  27. package/src/theme/_internal/config/token/parseTokenValue.test.ts +45 -0
  28. package/src/theme/_internal/config/token/parseTokenValue.ts +123 -0
  29. package/src/theme/_internal/config/types.ts +137 -0
  30. package/src/theme/_internal/constants.ts +48 -0
  31. package/src/theme/_internal/helpers.ts +19 -0
  32. package/src/theme/_internal/index.ts +5 -0
  33. package/src/theme/_internal/types.ts +91 -0
  34. package/src/theme/index.ts +1 -0
package/dist/index.js CHANGED
@@ -844,10 +844,166 @@ function useGlobalKeyDown(onKeyDown) {
844
844
  return () => removeEventListener("keydown", onKeyDown);
845
845
  }, [onKeyDown]);
846
846
  }
847
+ const COLOR_HUES = ["gray", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "green"];
848
+ const COLOR_TINTS = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
849
+ const COLOR_BASE_TONES = ["transparent", "default", "primary",
850
+ // todo: rename to `accent`
851
+ "positive", "caution", "critical"];
852
+ const COLOR_STATE_TONES = ["default", "primary",
853
+ // todo: rename to `accent`
854
+ "positive", "caution", "critical"];
855
+ const COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"];
856
+ const COLOR_BUTTON_MODES = ["default", "ghost", "bleed"];
857
+ const COLOR_BLEND_MODES = ["multiply", "screen"];
858
+ const defaultColorTokens = {
859
+ "*": {
860
+ _blend: ["multiply", "screen"],
861
+ bg: ["50", "950"],
862
+ fg: ["800", "200"],
863
+ border: ["200", "800"],
864
+ focusRing: ["cyan/500", "cyan/500"],
865
+ shadow: {
866
+ outline: ["500/0.25", "400/0.3"],
867
+ umbra: ["500/0.1", "black/0.4"],
868
+ penumbra: ["500/0.07", "black/0.28"],
869
+ ambient: ["500/0.06", "black/0.24"]
870
+ },
871
+ skeleton: {
872
+ from: ["100", "900"],
873
+ to: ["100/0.5", "900/0.5"]
874
+ }
875
+ },
876
+ transparent: {
877
+ bg: ["50", "black"],
878
+ fg: ["600", "400"]
879
+ },
880
+ default: {
881
+ bg: ["white", "950"],
882
+ fg: ["black", "200"]
883
+ },
884
+ primary: {
885
+ _hue: "cyan"
886
+ },
887
+ positive: {
888
+ _hue: "cyan"
889
+ },
890
+ caution: {
891
+ _hue: "yellow"
892
+ },
893
+ critical: {
894
+ _hue: "red"
895
+ },
896
+ button: {
897
+ "*": {
898
+ default: {
899
+ "*": {
900
+ _blend: ["screen", "multiply"],
901
+ bg: ["500", "400"],
902
+ bg2: ["950", "50"],
903
+ border: ["500/0", "400/0"],
904
+ muted: {
905
+ fg: ["200", "700"]
906
+ }
907
+ },
908
+ hovered: {
909
+ bg: ["600", "300"],
910
+ border: ["600/0", "300/0"]
911
+ },
912
+ pressed: {
913
+ bg: ["700", "200"]
914
+ },
915
+ selected: {
916
+ bg: ["700", "200"]
917
+ },
918
+ disabled: {
919
+ _hue: "gray",
920
+ bg: ["200", "900"]
921
+ }
922
+ },
923
+ ghost: {
924
+ "*": {
925
+ _blend: ["multiply", "screen"],
926
+ bg: ["white", "black"],
927
+ bg2: ["50", "950"],
928
+ fg: ["600", "400"],
929
+ border: ["200", "800"],
930
+ muted: {
931
+ fg: ["600/0.6", "400/0.6"]
932
+ }
933
+ },
934
+ hovered: {
935
+ bg: ["50", "950"],
936
+ fg: ["700", "300"]
937
+ },
938
+ pressed: {
939
+ bg: ["100", "900"],
940
+ fg: ["800", "200"]
941
+ },
942
+ selected: {
943
+ bg: ["100", "900"],
944
+ fg: ["800", "200"]
945
+ },
946
+ disabled: {
947
+ _hue: "gray",
948
+ fg: ["200", "900"],
949
+ border: ["100", "950"]
950
+ }
951
+ },
952
+ bleed: {
953
+ "*": {
954
+ _blend: ["multiply", "screen"],
955
+ bg: ["white", "black"],
956
+ bg2: ["50", "950"],
957
+ fg: ["600", "400"],
958
+ border: ["white/0", "black/0"],
959
+ muted: {
960
+ fg: ["600/0.6", "400/0.6"]
961
+ }
962
+ },
963
+ hovered: {
964
+ bg: ["50", "950"],
965
+ fg: ["700", "300"]
966
+ },
967
+ pressed: {
968
+ bg: ["100", "900"],
969
+ fg: ["800", "200"]
970
+ },
971
+ selected: {
972
+ bg: ["100", "900"],
973
+ fg: ["800", "200"]
974
+ },
975
+ disabled: {
976
+ _hue: "gray",
977
+ fg: ["200", "900"]
978
+ }
979
+ }
980
+ },
981
+ default: {
982
+ default: {
983
+ "*": {
984
+ bg: ["900", "200"]
985
+ },
986
+ hovered: {
987
+ bg: ["black", "100"]
988
+ },
989
+ pressed: {
990
+ bg: ["900", "200"]
991
+ },
992
+ selected: {
993
+ bg: ["black", "200"]
994
+ },
995
+ disabled: {
996
+ _hue: "gray",
997
+ bg: ["200", "900"]
998
+ }
999
+ }
1000
+ }
1001
+ }
1002
+ };
847
1003
  function multiplyChannel(b, s) {
848
1004
  return b * s;
849
1005
  }
850
- function multiply$1(b, s) {
1006
+ function multiply$2(b, s) {
851
1007
  return {
852
1008
  r: Math.round(clamp$1(multiplyChannel(b.r / 255, s.r / 255) * 255)),
853
1009
  g: Math.round(clamp$1(multiplyChannel(b.g / 255, s.g / 255) * 255)),
@@ -860,7 +1016,7 @@ function clamp$1(num) {
860
1016
  function screenChannel(b, s) {
861
1017
  return b + s - b * s;
862
1018
  }
863
- function screen$1(b, s) {
1019
+ function screen$2(b, s) {
864
1020
  return {
865
1021
  r: Math.round(clamp(screenChannel(b.r / 255, s.r / 255) * 255)),
866
1022
  g: Math.round(clamp(screenChannel(b.g / 255, s.g / 255) * 255)),
@@ -1022,6 +1178,649 @@ function rgba(color, a) {
1022
1178
  const rgb = parseColor(color);
1023
1179
  return "rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ",").concat(a, ")");
1024
1180
  }
1181
+ function isColorBlendModeValue(str) {
1182
+ return COLOR_BLEND_MODES.includes(str);
1183
+ }
1184
+ function isColorHueValue(str) {
1185
+ return COLOR_HUES.includes(str);
1186
+ }
1187
+ function isColorTintValue(str) {
1188
+ return COLOR_TINTS.includes(str);
1189
+ }
1190
+ function isColorButtonMode(str) {
1191
+ return COLOR_BUTTON_MODES.includes(str);
1192
+ }
1193
+ function parseTokenKey(str) {
1194
+ const segments = str.split("/");
1195
+ const segment0 = segments.shift() || "";
1196
+ if (isColorConfigBaseTone(segment0)) {
1197
+ const key = segments.join("/");
1198
+ if (isColorConfigBaseKey(key)) {
1199
+ return {
1200
+ type: "base",
1201
+ tone: segment0,
1202
+ key
1203
+ };
1204
+ }
1205
+ if (isColorConfigBlendKey(key)) {
1206
+ return {
1207
+ type: "base",
1208
+ tone: segment0,
1209
+ key
1210
+ };
1211
+ }
1212
+ }
1213
+ if (segment0 === "button") {
1214
+ const segment1 = segments.shift() || "";
1215
+ if (isColorConfigStateTone(segment1)) {
1216
+ const segment2 = segments.shift() || "";
1217
+ if (isColorButtonMode(segment2)) {
1218
+ const key = segments.join("/");
1219
+ if (isColorConfigStateKey(key)) {
1220
+ return {
1221
+ type: "button",
1222
+ tone: segment1,
1223
+ mode: segment2,
1224
+ key
1225
+ };
1226
+ }
1227
+ if (isColorConfigBlendKey(key)) {
1228
+ return {
1229
+ type: "button",
1230
+ tone: segment1,
1231
+ mode: segment2,
1232
+ key
1233
+ };
1234
+ }
1235
+ }
1236
+ }
1237
+ }
1238
+ return void 0;
1239
+ }
1240
+ function parseTokenValue(str) {
1241
+ const segments = str.split("/");
1242
+ const segment0 = segments.shift() || "";
1243
+ if (isColorTintValue(segment0)) {
1244
+ const tint = segment0;
1245
+ const segment1 = segments.shift() || "";
1246
+ if (isColorOpacityValue(segment1)) {
1247
+ const opacity = Number(segment1);
1248
+ return {
1249
+ type: "color",
1250
+ tint,
1251
+ opacity
1252
+ };
1253
+ }
1254
+ return {
1255
+ type: "color",
1256
+ tint
1257
+ };
1258
+ }
1259
+ if (isColorValue(segment0)) {
1260
+ const key = segment0;
1261
+ const segment1 = segments.shift() || "";
1262
+ if (isColorOpacityValue(segment1)) {
1263
+ const opacity = Number(segment1);
1264
+ return {
1265
+ type: "color",
1266
+ key,
1267
+ opacity
1268
+ };
1269
+ }
1270
+ return {
1271
+ type: "color",
1272
+ key
1273
+ };
1274
+ }
1275
+ if (isColorHueValue(segment0)) {
1276
+ const hue = segment0;
1277
+ const segment1 = segments.shift() || "";
1278
+ if (isColorTintValue(segment1)) {
1279
+ const tint = segment1;
1280
+ const segment2 = segments.shift() || "";
1281
+ if (isColorOpacityValue(segment2)) {
1282
+ const opacity = Number(segment2);
1283
+ return {
1284
+ type: "color",
1285
+ key: "".concat(hue, "/").concat(tint),
1286
+ hue,
1287
+ tint,
1288
+ opacity
1289
+ };
1290
+ }
1291
+ return {
1292
+ type: "color",
1293
+ key: "".concat(hue, "/").concat(tint),
1294
+ hue,
1295
+ tint
1296
+ };
1297
+ }
1298
+ return {
1299
+ type: "hue",
1300
+ value: "".concat(hue)
1301
+ };
1302
+ }
1303
+ if (isColorOpacityValue(segment0)) {
1304
+ const opacity = Number(segment0);
1305
+ return {
1306
+ type: "color",
1307
+ opacity
1308
+ };
1309
+ }
1310
+ if (isColorBlendModeValue(segment0)) {
1311
+ const value = segment0;
1312
+ return {
1313
+ type: "blendMode",
1314
+ value
1315
+ };
1316
+ }
1317
+ return void 0;
1318
+ }
1319
+ const COLOR_CONFIG_BASE_TONES = ["*", ...COLOR_BASE_TONES];
1320
+ const COLOR_CONFIG_STATE_TONES = ["*", ...COLOR_STATE_TONES];
1321
+ const COLOR_CONFIG_BASE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "link/fg", "code/bg", "code/fg", "shadow/outline", "shadow/umbra", "shadow/penumbra", "shadow/ambient", "skeleton/from", "skeleton/to"];
1322
+ const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to"];
1323
+ const COLOR_CONFIG_BLEND_KEYS = ["_blend"];
1324
+ function isColorConfigBaseTone(str) {
1325
+ return COLOR_CONFIG_BASE_TONES.includes(str);
1326
+ }
1327
+ function isColorConfigBaseKey(str) {
1328
+ return COLOR_CONFIG_BASE_KEYS.includes(str);
1329
+ }
1330
+ function isColorConfigStateKey(str) {
1331
+ return COLOR_CONFIG_STATE_KEYS.includes(str);
1332
+ }
1333
+ function isColorConfigStateTone(str) {
1334
+ return COLOR_CONFIG_STATE_TONES.includes(str);
1335
+ }
1336
+ function isColorConfigBlendKey(str) {
1337
+ return COLOR_CONFIG_BLEND_KEYS.includes(str);
1338
+ }
1339
+ function isColorTokenValue(str) {
1340
+ var _a, _b;
1341
+ return ((_a = parseTokenValue(str)) == null ? void 0 : _a.type) === "color" || ((_b = parseTokenValue(str)) == null ? void 0 : _b.type) === "hue";
1342
+ }
1343
+ function isColorValue(str) {
1344
+ return str === "black" || str === "white";
1345
+ }
1346
+ function isColorOpacityValue(str) {
1347
+ return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
1348
+ }
1349
+ function resolveColorTokenValue(context, value) {
1350
+ const {
1351
+ hue,
1352
+ scheme
1353
+ } = context;
1354
+ const node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
1355
+ if (!node || node.type !== "color") {
1356
+ throw new Error("Invalid color token: ".concat(value[0]));
1357
+ }
1358
+ return compileColorTokenValue({
1359
+ ...node,
1360
+ hue: node.hue || hue
1361
+ });
1362
+ }
1363
+ function compileColorTokenValue(node) {
1364
+ let key = "";
1365
+ if (node.key === "black" || node.key === "white") {
1366
+ key = node.key;
1367
+ } else {
1368
+ key = "".concat(node.hue, "/").concat(node.tint);
1369
+ }
1370
+ if (node.opacity !== void 0) {
1371
+ key += "/".concat(node.opacity);
1372
+ }
1373
+ return key;
1374
+ }
1375
+ function multiply$1(bg, fg) {
1376
+ const b = parseColor(bg);
1377
+ const s = parseColor(fg);
1378
+ const hex = rgbToHex(multiply$2(b, s));
1379
+ if (s.a !== void 0) {
1380
+ return rgba(hex, s.a);
1381
+ }
1382
+ return hex;
1383
+ }
1384
+ function screen$1(bg, fg) {
1385
+ const b = parseColor(bg);
1386
+ const s = parseColor(fg);
1387
+ const hex = rgbToHex(screen$2(b, s));
1388
+ if (s.a !== void 0) {
1389
+ return rgba(hex, s.a);
1390
+ }
1391
+ return hex;
1392
+ }
1393
+ function resolveColorTokens(sparseTokens) {
1394
+ const denseTokens = {
1395
+ ...sparseTokens
1396
+ };
1397
+ for (const tone of COLOR_BASE_TONES) {
1398
+ denseTokens[tone] = resolveBaseColorTones(sparseTokens, tone);
1399
+ }
1400
+ denseTokens.button = resolveButtonColorTokens(sparseTokens);
1401
+ return denseTokens;
1402
+ }
1403
+ function resolveBaseColorTones(sparseTokens, tone) {
1404
+ const spec0 = sparseTokens == null ? void 0 : sparseTokens[tone];
1405
+ const spec1 = sparseTokens == null ? void 0 : sparseTokens["*"];
1406
+ return {
1407
+ ...spec1,
1408
+ ...spec0,
1409
+ shadow: {
1410
+ ...(spec1 == null ? void 0 : spec1.shadow),
1411
+ ...(spec0 == null ? void 0 : spec0.shadow)
1412
+ },
1413
+ skeleton: {
1414
+ ...(spec1 == null ? void 0 : spec1.skeleton),
1415
+ ...(spec0 == null ? void 0 : spec0.skeleton)
1416
+ }
1417
+ };
1418
+ }
1419
+ function resolveButtonColorTokens(sparseTokens) {
1420
+ const tokens = {};
1421
+ for (const tone of COLOR_STATE_TONES) {
1422
+ tokens[tone] = resolveButtonToneColorTokens(sparseTokens, tone);
1423
+ }
1424
+ return tokens;
1425
+ }
1426
+ function resolveButtonToneColorTokens(sparseTokens, tone) {
1427
+ var _a, _b;
1428
+ const tokens = {
1429
+ ...((_a = sparseTokens.button) == null ? void 0 : _a[tone]),
1430
+ ...((_b = sparseTokens.button) == null ? void 0 : _b["*"])
1431
+ };
1432
+ for (const mode of COLOR_BUTTON_MODES) {
1433
+ tokens[mode] = resolveButtonModeColorTokens(sparseTokens, tone, mode);
1434
+ }
1435
+ return tokens;
1436
+ }
1437
+ function resolveButtonModeColorTokens(sparseTokens, tone, mode) {
1438
+ var _a, _b, _c, _d;
1439
+ const spec0 = (_b = (_a = sparseTokens.button) == null ? void 0 : _a[tone]) == null ? void 0 : _b[mode];
1440
+ const spec1 = (_d = (_c = sparseTokens.button) == null ? void 0 : _c["*"]) == null ? void 0 : _d[mode];
1441
+ const tokens = {
1442
+ ...spec1,
1443
+ ...spec0
1444
+ };
1445
+ for (const state of COLOR_STATES) {
1446
+ tokens[state] = resolveButtonStateColorTokens(sparseTokens, tone, mode, state);
1447
+ }
1448
+ return tokens;
1449
+ }
1450
+ function resolveButtonStateColorTokens(tokens, tone, mode, state) {
1451
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
1452
+ const spec0 = (_c = (_b = (_a = tokens == null ? void 0 : tokens.button) == null ? void 0 : _a[tone]) == null ? void 0 : _b[mode]) == null ? void 0 : _c[state];
1453
+ const spec1 = (_f = (_e = (_d = tokens == null ? void 0 : tokens.button) == null ? void 0 : _d[tone]) == null ? void 0 : _e[mode]) == null ? void 0 : _f["*"];
1454
+ const spec2 = (_i = (_h = (_g = tokens == null ? void 0 : tokens.button) == null ? void 0 : _g["*"]) == null ? void 0 : _h[mode]) == null ? void 0 : _i[state];
1455
+ const spec3 = (_l = (_k = (_j = tokens == null ? void 0 : tokens.button) == null ? void 0 : _j["*"]) == null ? void 0 : _k[mode]) == null ? void 0 : _l["*"];
1456
+ const hue = (spec0 == null ? void 0 : spec0._hue) || (spec1 == null ? void 0 : spec1._hue) || (spec2 == null ? void 0 : spec2._hue) || (spec3 == null ? void 0 : spec3._hue) || ((_n = (_m = tokens == null ? void 0 : tokens.button) == null ? void 0 : _m[tone]) == null ? void 0 : _n._hue) || ((_o = tokens == null ? void 0 : tokens[tone]) == null ? void 0 : _o._hue);
1457
+ return {
1458
+ ...spec3,
1459
+ ...spec2,
1460
+ ...spec1,
1461
+ ...spec0,
1462
+ _hue: hue,
1463
+ muted: {
1464
+ ...(spec3 == null ? void 0 : spec3.muted),
1465
+ ...(spec2 == null ? void 0 : spec2.muted),
1466
+ ...(spec1 == null ? void 0 : spec1.muted),
1467
+ ...(spec0 == null ? void 0 : spec0.muted)
1468
+ },
1469
+ accent: {
1470
+ ...(spec3 == null ? void 0 : spec3.accent),
1471
+ ...(spec2 == null ? void 0 : spec2.accent),
1472
+ ...(spec1 == null ? void 0 : spec1.accent),
1473
+ ...(spec0 == null ? void 0 : spec0.accent)
1474
+ },
1475
+ link: {
1476
+ ...(spec3 == null ? void 0 : spec3.link),
1477
+ ...(spec2 == null ? void 0 : spec2.link),
1478
+ ...(spec1 == null ? void 0 : spec1.link),
1479
+ ...(spec0 == null ? void 0 : spec0.link)
1480
+ },
1481
+ code: {
1482
+ ...(spec3 == null ? void 0 : spec3.code),
1483
+ ...(spec2 == null ? void 0 : spec2.code),
1484
+ ...(spec1 == null ? void 0 : spec1.code),
1485
+ ...(spec0 == null ? void 0 : spec0.code)
1486
+ },
1487
+ skeleton: {
1488
+ ...(spec3 == null ? void 0 : spec3.skeleton),
1489
+ ...(spec2 == null ? void 0 : spec2.skeleton),
1490
+ ...(spec1 == null ? void 0 : spec1.skeleton),
1491
+ ...(spec0 == null ? void 0 : spec0.skeleton)
1492
+ }
1493
+ };
1494
+ }
1495
+ function buildColorTheme(options, config) {
1496
+ var _a, _b;
1497
+ const {
1498
+ scheme
1499
+ } = options;
1500
+ const resolvedConfig = {
1501
+ ...config,
1502
+ color: {
1503
+ ...(config == null ? void 0 : config.color),
1504
+ tokens: resolveColorTokens((_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) != null ? _b : defaultColorTokens)
1505
+ }
1506
+ };
1507
+ return {
1508
+ transparent: buildBaseColorTheme({
1509
+ scheme,
1510
+ tone: "transparent"
1511
+ }, resolvedConfig),
1512
+ default: buildBaseColorTheme({
1513
+ scheme,
1514
+ tone: "default"
1515
+ }, resolvedConfig),
1516
+ primary: buildBaseColorTheme({
1517
+ scheme,
1518
+ tone: "primary"
1519
+ }, resolvedConfig),
1520
+ positive: buildBaseColorTheme({
1521
+ scheme,
1522
+ tone: "positive"
1523
+ }, resolvedConfig),
1524
+ caution: buildBaseColorTheme({
1525
+ scheme,
1526
+ tone: "caution"
1527
+ }, resolvedConfig),
1528
+ critical: buildBaseColorTheme({
1529
+ scheme,
1530
+ tone: "critical"
1531
+ }, resolvedConfig)
1532
+ };
1533
+ }
1534
+ function buildBaseColorTheme(options, config) {
1535
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1536
+ const {
1537
+ scheme,
1538
+ tone
1539
+ } = options;
1540
+ const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) == null ? void 0 : _b[tone];
1541
+ const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
1542
+ const context = {
1543
+ hue,
1544
+ scheme
1545
+ };
1546
+ const bg = resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["gray/50", "black"]);
1547
+ const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
1548
+ return {
1549
+ _blend: blendMode[scheme === "light" ? 0 : 1],
1550
+ dark: scheme === "dark",
1551
+ base: {
1552
+ bg,
1553
+ fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["black", "white"]),
1554
+ border: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.border) || ["black", "white"]),
1555
+ focusRing: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.focusRing) || ["black", "white"]),
1556
+ shadow: {
1557
+ outline: resolveColorTokenValue(context, ((_c = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _c.outline) || ["500/0.2", "500/0.2"]),
1558
+ umbra: resolveColorTokenValue(context, ((_d = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _d.umbra) || ["500/0.2", "500/0.2"]),
1559
+ penumbra: resolveColorTokenValue(context, ((_e = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _e.penumbra) || ["500/0.2", "500/0.2"]),
1560
+ ambient: resolveColorTokenValue(context, ((_f = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _f.ambient) || ["500/0.2", "500/0.2"])
1561
+ },
1562
+ skeleton: {
1563
+ from: resolveColorTokenValue(context, ((_g = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _g.from) || ["500/0.2", "500/0.2"]),
1564
+ to: resolveColorTokenValue(context, ((_h = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _h.to) || ["500/0.2", "500/0.2"])
1565
+ }
1566
+ },
1567
+ button: buildButtonColorTheme({
1568
+ scheme
1569
+ }, config)
1570
+ };
1571
+ }
1572
+ function buildButtonColorTheme(options, config) {
1573
+ const {
1574
+ scheme
1575
+ } = options;
1576
+ const tones = COLOR_STATE_TONES.map(tone => {
1577
+ return {
1578
+ [tone]: buildButtonColorToneTheme({
1579
+ scheme,
1580
+ tone
1581
+ }, config)
1582
+ };
1583
+ });
1584
+ return Object.assign({}, ...tones);
1585
+ }
1586
+ function buildButtonColorToneTheme(options, config) {
1587
+ const {
1588
+ scheme,
1589
+ tone
1590
+ } = options;
1591
+ const modes = COLOR_BUTTON_MODES.map(mode => {
1592
+ return {
1593
+ [mode]: buildButtonModeColorTheme({
1594
+ mode,
1595
+ scheme,
1596
+ tone
1597
+ }, config)
1598
+ };
1599
+ });
1600
+ return Object.assign({}, ...modes);
1601
+ }
1602
+ function buildButtonModeColorTheme(options, config) {
1603
+ const {
1604
+ mode,
1605
+ scheme,
1606
+ tone
1607
+ } = options;
1608
+ const states = COLOR_STATES.map(state => {
1609
+ return {
1610
+ [state]: buildButtonStateColorTheme({
1611
+ mode,
1612
+ tone,
1613
+ scheme,
1614
+ state
1615
+ }, config)
1616
+ };
1617
+ });
1618
+ return Object.assign({}, ...states);
1619
+ }
1620
+ function buildButtonStateColorTheme(options, config) {
1621
+ var _a, _b, _c, _d, _e;
1622
+ const {
1623
+ mode,
1624
+ tone,
1625
+ scheme,
1626
+ state
1627
+ } = options;
1628
+ const tokens = (_e = (_d = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) == null ? void 0 : _b.button) == null ? void 0 : _c[tone]) == null ? void 0 : _d[mode]) == null ? void 0 : _e[state];
1629
+ const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
1630
+ const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
1631
+ const context = {
1632
+ hue,
1633
+ scheme
1634
+ };
1635
+ return {
1636
+ _blend: blendMode[scheme === "light" ? 0 : 1],
1637
+ bg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["500", "400"]),
1638
+ bg2: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg2) || ["500", "400"]),
1639
+ fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["white", "black"]),
1640
+ border: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.border) || ["500", "400"]),
1641
+ muted: {
1642
+ fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
1643
+ },
1644
+ accent: {
1645
+ fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
1646
+ },
1647
+ link: {
1648
+ fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
1649
+ },
1650
+ code: {
1651
+ bg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["500", "400"]),
1652
+ fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
1653
+ }
1654
+ };
1655
+ }
1656
+ const defaultColorPalette = {
1657
+ ...color$1.color,
1658
+ black: "#000000"
1659
+ };
1660
+ function renderColorTheme(value, config) {
1661
+ var _a, _b;
1662
+ const colorPalette = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.palette) != null ? _b : defaultColorPalette;
1663
+ return {
1664
+ light: renderColorScheme(colorPalette, value.light),
1665
+ dark: renderColorScheme(colorPalette, value.dark)
1666
+ };
1667
+ }
1668
+ function renderColorScheme(colorPalette, value) {
1669
+ const toneEntries = Object.entries(value);
1670
+ const [, transparentTone] = toneEntries.find(_ref4 => {
1671
+ let [k] = _ref4;
1672
+ return k === "transparent";
1673
+ });
1674
+ const [, defaultTone] = toneEntries.find(_ref5 => {
1675
+ let [k] = _ref5;
1676
+ return k === "default";
1677
+ });
1678
+ const renderedTransparentTone = renderColorBase(colorPalette, transparentTone, transparentTone._blend === "multiply" ? "#ffffff" : "#000000");
1679
+ const renderedDefaultTone = renderColorBase(colorPalette, defaultTone, defaultTone._blend === "multiply" ? "#ffffff" : "#000000");
1680
+ return Object.fromEntries([["transparent", renderedTransparentTone], ["default", renderedDefaultTone], ...toneEntries.filter(_ref6 => {
1681
+ let [k] = _ref6;
1682
+ return k !== "default" && k !== "transparent";
1683
+ }).map(_ref7 => {
1684
+ let [k, v] = _ref7;
1685
+ return [k, renderColorBase(colorPalette, v, renderedDefaultTone.base.bg)];
1686
+ })]);
1687
+ }
1688
+ function renderColorBase(colorPalette, value, bg) {
1689
+ const nestedBg = renderColorValue(colorPalette, bg, value._blend, value.base.bg);
1690
+ return {
1691
+ _blend: value._blend,
1692
+ dark: value.dark,
1693
+ base: {
1694
+ bg: nestedBg,
1695
+ fg: renderColorValue(colorPalette, nestedBg, value._blend, value.base.fg),
1696
+ border: renderColorValue(colorPalette, nestedBg, value._blend, value.base.border),
1697
+ focusRing: renderColorValue(colorPalette, nestedBg, value._blend, value.base.focusRing),
1698
+ shadow: {
1699
+ outline: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.outline),
1700
+ umbra: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.umbra),
1701
+ penumbra: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.penumbra),
1702
+ ambient: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.ambient)
1703
+ },
1704
+ skeleton: {
1705
+ from: renderColorValue(colorPalette, nestedBg, value._blend, value.base.skeleton.from),
1706
+ to: renderColorValue(colorPalette, nestedBg, value._blend, value.base.skeleton.to)
1707
+ }
1708
+ },
1709
+ button: renderButtonColorTheme(colorPalette, nestedBg, value._blend, value.button)
1710
+ };
1711
+ }
1712
+ function renderButtonColorTheme(colorPalette, bg, baseBlendMode, value) {
1713
+ return {
1714
+ default: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.default),
1715
+ primary: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.primary),
1716
+ positive: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.positive),
1717
+ caution: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.caution),
1718
+ critical: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.critical)
1719
+ };
1720
+ }
1721
+ function renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value) {
1722
+ return {
1723
+ default: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.default),
1724
+ ghost: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.ghost),
1725
+ bleed: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.bleed)
1726
+ };
1727
+ }
1728
+ function renderStatesColorTheme(colorPalette, bg, baseBlendMode, value) {
1729
+ return {
1730
+ enabled: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.enabled),
1731
+ hovered: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.hovered),
1732
+ pressed: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.pressed),
1733
+ selected: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.selected),
1734
+ disabled: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.disabled)
1735
+ };
1736
+ }
1737
+ function renderStateColorTheme(colorPalette, baseBg, rootBlendMode, value) {
1738
+ const blendMode = value._blend;
1739
+ const bg = rootBlendMode === "multiply" && value.bg === "white" ? "#ffffff" : rootBlendMode === "screen" && value.bg === "black" ? "#000000" : renderColorValue(colorPalette, rootBlendMode === "multiply" ? "#ffffff" : "#000000", rootBlendMode, value.bg);
1740
+ const blend = rootBlendMode === "multiply" ? multiply$1 : screen$1;
1741
+ const unmixed = {
1742
+ bg2: renderColorValue(colorPalette, bg, blendMode, value.bg2 || value.bg),
1743
+ fg: renderColorValue(colorPalette, bg, blendMode, value.fg),
1744
+ border: renderColorValue(colorPalette, bg, blendMode, value.border),
1745
+ muted: {
1746
+ fg: renderColorValue(colorPalette, bg, blendMode, value.muted.fg)
1747
+ },
1748
+ accent: {
1749
+ fg: renderColorValue(colorPalette, bg, blendMode, value.accent.fg)
1750
+ },
1751
+ link: {
1752
+ fg: renderColorValue(colorPalette, bg, blendMode, value.link.fg)
1753
+ },
1754
+ code: {
1755
+ bg: renderColorValue(colorPalette, bg, blendMode, value.code.bg),
1756
+ fg: renderColorValue(colorPalette, bg, blendMode, value.code.fg)
1757
+ }
1758
+ };
1759
+ return {
1760
+ _blend: blendMode,
1761
+ bg: blend(baseBg, bg),
1762
+ bg2: blend(baseBg, unmixed.bg2),
1763
+ fg: blend(baseBg, unmixed.fg),
1764
+ border: blend(baseBg, unmixed.border),
1765
+ muted: {
1766
+ fg: blend(baseBg, unmixed.muted.fg)
1767
+ },
1768
+ accent: {
1769
+ fg: blend(baseBg, unmixed.accent.fg)
1770
+ },
1771
+ link: {
1772
+ fg: blend(baseBg, unmixed.link.fg)
1773
+ },
1774
+ code: {
1775
+ bg: blend(baseBg, unmixed.code.bg),
1776
+ fg: blend(baseBg, unmixed.code.fg)
1777
+ }
1778
+ };
1779
+ }
1780
+ function renderColorValue(colorPalette, bg, blendMode, str) {
1781
+ const node = parseTokenValue(str);
1782
+ if (!node || node.type !== "color") {
1783
+ throw new Error("Invalid color token value: ".concat(str));
1784
+ }
1785
+ let hex = "";
1786
+ if (node.key === "black") {
1787
+ hex = renderColorHex(colorPalette.black);
1788
+ }
1789
+ if (node.key === "white") {
1790
+ hex = renderColorHex(colorPalette.white);
1791
+ }
1792
+ if (node.hue && node.tint) {
1793
+ hex = renderColorHex(colorPalette[node.hue][node.tint]);
1794
+ }
1795
+ if (!hex) {
1796
+ throw new Error("Invalid color token value: ".concat(str));
1797
+ }
1798
+ try {
1799
+ hex = blendMode === "multiply" ? multiply$1(bg, hex) : screen$1(bg, hex);
1800
+ } catch (err) {
1801
+ console.log("could not blend", hex);
1802
+ }
1803
+ if (node.opacity !== void 0) {
1804
+ hex = rgba(hex, node.opacity);
1805
+ }
1806
+ return hex;
1807
+ }
1808
+ function renderColorHex(color) {
1809
+ return typeof color === "string" ? color : color.hex;
1810
+ }
1811
+ function buildTheme(config) {
1812
+ const color = {
1813
+ light: buildColorTheme({
1814
+ scheme: "light"
1815
+ }, config),
1816
+ dark: buildColorTheme({
1817
+ scheme: "dark"
1818
+ }, config)
1819
+ };
1820
+ return {
1821
+ color: renderColorTheme(color, config)
1822
+ };
1823
+ }
1025
1824
  function createButtonTones(opts, base, dark, solid, muted, mode) {
1026
1825
  return {
1027
1826
  default: opts.button({
@@ -1214,11 +2013,11 @@ const tones$1 = {
1214
2013
  }
1215
2014
  };
1216
2015
  const defaultOpts = {
1217
- base: _ref4 => {
2016
+ base: _ref8 => {
1218
2017
  let {
1219
2018
  dark,
1220
2019
  name
1221
- } = _ref4;
2020
+ } = _ref8;
1222
2021
  if (name === "default") {
1223
2022
  return {
1224
2023
  bg: dark ? black : white,
@@ -1254,13 +2053,13 @@ const defaultOpts = {
1254
2053
  }
1255
2054
  };
1256
2055
  },
1257
- solid: _ref5 => {
2056
+ solid: _ref9 => {
1258
2057
  let {
1259
2058
  base,
1260
2059
  dark,
1261
2060
  state,
1262
2061
  tone
1263
- } = _ref5;
2062
+ } = _ref9;
1264
2063
  const color = colors[tone];
1265
2064
  if (state === "hovered") {
1266
2065
  return {
@@ -1307,13 +2106,13 @@ const defaultOpts = {
1307
2106
  skeleton: base.skeleton
1308
2107
  };
1309
2108
  },
1310
- muted: _ref6 => {
2109
+ muted: _ref10 => {
1311
2110
  let {
1312
2111
  base,
1313
2112
  dark,
1314
2113
  state,
1315
2114
  tone
1316
- } = _ref6;
2115
+ } = _ref10;
1317
2116
  const color = colors[tone];
1318
2117
  if (state === "hovered") {
1319
2118
  return {
@@ -1360,13 +2159,13 @@ const defaultOpts = {
1360
2159
  skeleton: base.skeleton
1361
2160
  };
1362
2161
  },
1363
- button: _ref7 => {
2162
+ button: _ref11 => {
1364
2163
  let {
1365
2164
  base,
1366
2165
  mode,
1367
2166
  muted,
1368
2167
  solid
1369
- } = _ref7;
2168
+ } = _ref11;
1370
2169
  if (mode === "bleed") {
1371
2170
  return {
1372
2171
  ...muted,
@@ -1420,10 +2219,10 @@ const defaultOpts = {
1420
2219
  };
1421
2220
  return solid;
1422
2221
  },
1423
- card: _ref8 => {
2222
+ card: _ref12 => {
1424
2223
  let {
1425
2224
  base
1426
- } = _ref8;
2225
+ } = _ref12;
1427
2226
  return {
1428
2227
  bg: black,
1429
2228
  bg2: black,
@@ -1455,18 +2254,18 @@ const defaultOpts = {
1455
2254
  placeholder: black
1456
2255
  };
1457
2256
  },
1458
- selectable: _ref9 => {
2257
+ selectable: _ref13 => {
1459
2258
  let {
1460
2259
  muted,
1461
2260
  state,
1462
2261
  tone
1463
- } = _ref9;
2262
+ } = _ref13;
1464
2263
  return muted[tone][state];
1465
2264
  },
1466
- spot: _ref10 => {
2265
+ spot: _ref14 => {
1467
2266
  let {
1468
2267
  key
1469
- } = _ref10;
2268
+ } = _ref14;
1470
2269
  return spots[key];
1471
2270
  },
1472
2271
  syntax: () => ({
@@ -2181,7 +2980,7 @@ function _createColor(opts, dark, name) {
2181
2980
  function multiply(bg, fg) {
2182
2981
  const b = parseColor(bg);
2183
2982
  const s = parseColor(fg);
2184
- const hex = rgbToHex(multiply$1(b, s));
2983
+ const hex = rgbToHex(multiply$2(b, s));
2185
2984
  if (s.a) {
2186
2985
  return rgba(hex, s.a);
2187
2986
  }
@@ -2190,7 +2989,7 @@ function multiply(bg, fg) {
2190
2989
  function screen(bg, fg) {
2191
2990
  const b = parseColor(bg);
2192
2991
  const s = parseColor(fg);
2193
- const hex = rgbToHex(screen$1(b, s));
2992
+ const hex = rgbToHex(screen$2(b, s));
2194
2993
  if (s.a) {
2195
2994
  return rgba(hex, s.a);
2196
2995
  }
@@ -2206,11 +3005,11 @@ const tones = {
2206
3005
  };
2207
3006
  const NEUTRAL_TONES = ["default", "transparent"];
2208
3007
  const color = createColorTheme({
2209
- base: _ref11 => {
3008
+ base: _ref15 => {
2210
3009
  let {
2211
3010
  dark,
2212
3011
  name
2213
- } = _ref11;
3012
+ } = _ref15;
2214
3013
  if (name === "default") {
2215
3014
  const tints2 = color$1.hues.gray;
2216
3015
  const skeletonFrom2 = dark ? tints2[900].hex : tints2[100].hex;
@@ -2270,14 +3069,14 @@ const color = createColorTheme({
2270
3069
  }
2271
3070
  };
2272
3071
  },
2273
- solid: _ref12 => {
3072
+ solid: _ref16 => {
2274
3073
  let {
2275
3074
  base,
2276
3075
  dark,
2277
3076
  name,
2278
3077
  state,
2279
3078
  tone
2280
- } = _ref12;
3079
+ } = _ref16;
2281
3080
  const mix = dark ? screen : multiply;
2282
3081
  const mix2 = dark ? multiply : screen;
2283
3082
  const defaultTints = tones[name] || tones.default;
@@ -2431,14 +3230,14 @@ const color = createColorTheme({
2431
3230
  }
2432
3231
  };
2433
3232
  },
2434
- muted: _ref13 => {
3233
+ muted: _ref17 => {
2435
3234
  let {
2436
3235
  base,
2437
3236
  dark,
2438
3237
  name,
2439
3238
  state,
2440
3239
  tone
2441
- } = _ref13;
3240
+ } = _ref17;
2442
3241
  const mix = dark ? screen : multiply;
2443
3242
  const defaultTints = tones[name] || tones.default;
2444
3243
  const isNeutral = NEUTRAL_TONES.includes(name) && NEUTRAL_TONES.includes(tone);
@@ -2594,13 +3393,13 @@ const color = createColorTheme({
2594
3393
  }
2595
3394
  };
2596
3395
  },
2597
- button: _ref14 => {
3396
+ button: _ref18 => {
2598
3397
  let {
2599
3398
  base,
2600
3399
  mode,
2601
3400
  muted,
2602
3401
  solid
2603
- } = _ref14;
3402
+ } = _ref18;
2604
3403
  if (mode === "bleed") {
2605
3404
  return {
2606
3405
  enabled: {
@@ -2637,7 +3436,7 @@ const color = createColorTheme({
2637
3436
  }
2638
3437
  return solid;
2639
3438
  },
2640
- card: _ref15 => {
3439
+ card: _ref19 => {
2641
3440
  let {
2642
3441
  base,
2643
3442
  dark,
@@ -2645,7 +3444,7 @@ const color = createColorTheme({
2645
3444
  name,
2646
3445
  solid,
2647
3446
  state
2648
- } = _ref15;
3447
+ } = _ref19;
2649
3448
  if (state === "hovered") {
2650
3449
  return muted[name].hovered;
2651
3450
  }
@@ -2695,13 +3494,13 @@ const color = createColorTheme({
2695
3494
  }
2696
3495
  };
2697
3496
  },
2698
- input: _ref16 => {
3497
+ input: _ref20 => {
2699
3498
  let {
2700
3499
  base,
2701
3500
  dark,
2702
3501
  mode,
2703
3502
  state
2704
- } = _ref16;
3503
+ } = _ref20;
2705
3504
  const mix = dark ? screen : multiply;
2706
3505
  if (mode === "invalid") {
2707
3506
  const tints = tones.critical;
@@ -2753,14 +3552,14 @@ const color = createColorTheme({
2753
3552
  placeholder: mix(base.bg, color$1.hues.gray[dark ? 600 : 400].hex)
2754
3553
  };
2755
3554
  },
2756
- selectable: _ref17 => {
3555
+ selectable: _ref21 => {
2757
3556
  let {
2758
3557
  base,
2759
3558
  muted,
2760
3559
  tone,
2761
3560
  solid,
2762
3561
  state
2763
- } = _ref17;
3562
+ } = _ref21;
2764
3563
  if (state === "enabled") {
2765
3564
  return {
2766
3565
  ...muted[tone].enabled,
@@ -2787,20 +3586,20 @@ const color = createColorTheme({
2787
3586
  }
2788
3587
  return muted[tone][state];
2789
3588
  },
2790
- spot: _ref18 => {
3589
+ spot: _ref22 => {
2791
3590
  let {
2792
3591
  base,
2793
3592
  dark,
2794
3593
  key
2795
- } = _ref18;
3594
+ } = _ref22;
2796
3595
  const mix = dark ? screen : multiply;
2797
3596
  return mix(base.bg, color$1.hues[key][dark ? 400 : 500].hex);
2798
3597
  },
2799
- syntax: _ref19 => {
3598
+ syntax: _ref23 => {
2800
3599
  let {
2801
3600
  base,
2802
3601
  dark
2803
- } = _ref19;
3602
+ } = _ref23;
2804
3603
  const mix = dark ? screen : multiply;
2805
3604
  const mainShade = dark ? 400 : 600;
2806
3605
  const secondaryShade = dark ? 600 : 400;
@@ -4649,10 +5448,10 @@ var __template$x = (cooked, raw) => __freeze$x(__defProp$y(cooked, "raw", {
4649
5448
  value: __freeze$x(raw || cooked.slice())
4650
5449
  }));
4651
5450
  var _a$x, _b$k;
4652
- function buttonBaseStyles(_ref20) {
5451
+ function buttonBaseStyles(_ref24) {
4653
5452
  let {
4654
5453
  $width
4655
- } = _ref20;
5454
+ } = _ref24;
4656
5455
  return styled.css(_b$k || (_b$k = __template$x(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n ", "\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])), $width === "fill" && styled.css(_a$x || (_a$x = __template$x(["\n width: -webkit-fill-available;\n width: stretch;\n "]))));
4657
5456
  }
4658
5457
  const buttonTheme = {
@@ -5010,10 +5809,10 @@ var __template$t = (cooked, raw) => __freeze$t(__defProp$u(cooked, "raw", {
5010
5809
  value: __freeze$t(raw || cooked.slice())
5011
5810
  }));
5012
5811
  var _a$t;
5013
- function codeSyntaxHighlightingStyle(_ref21) {
5812
+ function codeSyntaxHighlightingStyle(_ref25) {
5014
5813
  let {
5015
5814
  theme
5016
- } = _ref21;
5815
+ } = _ref25;
5017
5816
  const color = theme.sanity.color.syntax;
5018
5817
  return {
5019
5818
  "&.atrule": {
@@ -6321,13 +7120,13 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
6321
7120
  }));
6322
7121
  if (constrainSize || matchReferenceWidth) {
6323
7122
  ret.push(size({
6324
- apply(_ref22) {
7123
+ apply(_ref26) {
6325
7124
  let {
6326
7125
  availableWidth,
6327
7126
  availableHeight,
6328
7127
  elements,
6329
7128
  referenceWidth
6330
- } = _ref22;
7129
+ } = _ref26;
6331
7130
  referenceWidthRef.current = referenceWidth;
6332
7131
  const _currentWidth = widthRef.current;
6333
7132
  const _maxWidth = maxWidthRef.current;
@@ -7136,12 +7935,12 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
7136
7935
  mainAxis: 3
7137
7936
  }));
7138
7937
  ret.push(reactDom$1.size({
7139
- apply(_ref23) {
7938
+ apply(_ref27) {
7140
7939
  let {
7141
7940
  availableWidth,
7142
7941
  availableHeight,
7143
7942
  elements
7144
- } = _ref23;
7943
+ } = _ref27;
7145
7944
  Object.assign(elements.floating.style, {
7146
7945
  maxWidth: "".concat(availableWidth - 4 * 2, "px"),
7147
7946
  // the padding is `4px`
@@ -7447,10 +8246,10 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7447
8246
  query,
7448
8247
  value
7449
8248
  } = state;
7450
- const defaultRenderOption = react.useCallback(_ref24 => {
8249
+ const defaultRenderOption = react.useCallback(_ref28 => {
7451
8250
  let {
7452
8251
  value: value2
7453
- } = _ref24;
8252
+ } = _ref28;
7454
8253
  return /* @__PURE__ */jsxRuntime.jsx(Card, {
7455
8254
  "data-as": "button",
7456
8255
  padding: paddingProp,
@@ -7904,10 +8703,10 @@ const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
7904
8703
  });
7905
8704
  });
7906
8705
  const BORDER_OFFSET_X = 12;
7907
- function dialogStyle(_ref25) {
8706
+ function dialogStyle(_ref29) {
7908
8707
  let {
7909
8708
  theme
7910
- } = _ref25;
8709
+ } = _ref29;
7911
8710
  const color = theme.sanity.color.base;
7912
8711
  return {
7913
8712
  "&:not([hidden])": {
@@ -8061,12 +8860,13 @@ const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
8061
8860
  children: [showHeader && /* @__PURE__ */jsxRuntime.jsx(DialogHeader, {
8062
8861
  $isContentScrollable: isContentScrollable,
8063
8862
  $hasScrolledFromTop: hasScrolledFromTop,
8064
- padding: 3,
8863
+ paddingLeft: 4,
8864
+ paddingRight: 3,
8865
+ paddingY: 3,
8065
8866
  children: /* @__PURE__ */jsxRuntime.jsxs(Flex, {
8066
8867
  align: "center",
8067
8868
  children: [/* @__PURE__ */jsxRuntime.jsx(Box, {
8068
8869
  flex: 1,
8069
- padding: 3,
8070
8870
  children: header && /* @__PURE__ */jsxRuntime.jsx(Text, {
8071
8871
  id: labelId,
8072
8872
  size: 1,
@@ -8992,15 +9792,15 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
8992
9792
  var _a$6, _b$3, _c$1, _d;
8993
9793
  const keyframe = styled.keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8994
9794
  const animation = styled.css(_b$3 || (_b$3 = __template$6(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), keyframe);
8995
- const skeletonStyle = styled.css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref26 => {
9795
+ const skeletonStyle = styled.css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref30 => {
8996
9796
  let {
8997
9797
  $visible
8998
- } = _ref26;
9798
+ } = _ref30;
8999
9799
  return $visible ? 1 : 0;
9000
- }, _ref27 => {
9800
+ }, _ref31 => {
9001
9801
  let {
9002
9802
  $animated
9003
- } = _ref27;
9803
+ } = _ref31;
9004
9804
  return $animated ? animation : styled.css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
9005
9805
  });
9006
9806
  const Root$4 = styled__default.default(Box)(responsiveRadiusStyle, skeletonStyle);
@@ -9031,12 +9831,12 @@ const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
9031
9831
  ref
9032
9832
  });
9033
9833
  });
9034
- const Root$3 = styled__default.default(Skeleton)(_ref28 => {
9834
+ const Root$3 = styled__default.default(Skeleton)(_ref32 => {
9035
9835
  let {
9036
9836
  $size,
9037
9837
  $style,
9038
9838
  theme
9039
- } = _ref28;
9839
+ } = _ref32;
9040
9840
  const {
9041
9841
  media
9042
9842
  } = theme.sanity;
@@ -9384,12 +10184,12 @@ function ToastProvider(props) {
9384
10184
  paddingY,
9385
10185
  children: /* @__PURE__ */jsxRuntime.jsx(framerMotion.AnimatePresence, {
9386
10186
  initial: false,
9387
- children: state.map(_ref29 => {
10187
+ children: state.map(_ref33 => {
9388
10188
  let {
9389
10189
  dismiss,
9390
10190
  id,
9391
10191
  params
9392
- } = _ref29;
10192
+ } = _ref33;
9393
10193
  return /* @__PURE__ */jsxRuntime.jsx(framerMotion.motion.div, {
9394
10194
  animate: {
9395
10195
  opacity: 1,
@@ -9898,6 +10698,18 @@ exports.BoundaryElementProvider = BoundaryElementProvider;
9898
10698
  exports.Box = Box;
9899
10699
  exports.Breadcrumbs = Breadcrumbs;
9900
10700
  exports.Button = Button;
10701
+ exports.COLOR_BASE_TONES = COLOR_BASE_TONES;
10702
+ exports.COLOR_BLEND_MODES = COLOR_BLEND_MODES;
10703
+ exports.COLOR_BUTTON_MODES = COLOR_BUTTON_MODES;
10704
+ exports.COLOR_CONFIG_BASE_KEYS = COLOR_CONFIG_BASE_KEYS;
10705
+ exports.COLOR_CONFIG_BASE_TONES = COLOR_CONFIG_BASE_TONES;
10706
+ exports.COLOR_CONFIG_BLEND_KEYS = COLOR_CONFIG_BLEND_KEYS;
10707
+ exports.COLOR_CONFIG_STATE_KEYS = COLOR_CONFIG_STATE_KEYS;
10708
+ exports.COLOR_CONFIG_STATE_TONES = COLOR_CONFIG_STATE_TONES;
10709
+ exports.COLOR_HUES = COLOR_HUES;
10710
+ exports.COLOR_STATES = COLOR_STATES;
10711
+ exports.COLOR_STATE_TONES = COLOR_STATE_TONES;
10712
+ exports.COLOR_TINTS = COLOR_TINTS;
9901
10713
  exports.Card = Card;
9902
10714
  exports.Checkbox = Checkbox;
9903
10715
  exports.Code = Code;
@@ -9963,12 +10775,25 @@ exports._raf = _raf;
9963
10775
  exports._raf2 = _raf2;
9964
10776
  exports._responsive = _responsive;
9965
10777
  exports.attemptFocus = attemptFocus;
10778
+ exports.buildTheme = buildTheme;
9966
10779
  exports.containsOrEqualsElement = containsOrEqualsElement;
9967
10780
  exports.createColorTheme = createColorTheme;
9968
10781
  exports.focusFirstDescendant = focusFirstDescendant;
9969
10782
  exports.focusLastDescendant = focusLastDescendant;
9970
10783
  exports.hexToRgb = hexToRgb;
9971
10784
  exports.hslToRgb = hslToRgb;
10785
+ exports.isColorBlendModeValue = isColorBlendModeValue;
10786
+ exports.isColorButtonMode = isColorButtonMode;
10787
+ exports.isColorConfigBaseKey = isColorConfigBaseKey;
10788
+ exports.isColorConfigBaseTone = isColorConfigBaseTone;
10789
+ exports.isColorConfigBlendKey = isColorConfigBlendKey;
10790
+ exports.isColorConfigStateKey = isColorConfigStateKey;
10791
+ exports.isColorConfigStateTone = isColorConfigStateTone;
10792
+ exports.isColorHueValue = isColorHueValue;
10793
+ exports.isColorOpacityValue = isColorOpacityValue;
10794
+ exports.isColorTintValue = isColorTintValue;
10795
+ exports.isColorTokenValue = isColorTokenValue;
10796
+ exports.isColorValue = isColorValue;
9972
10797
  exports.isFocusable = isFocusable;
9973
10798
  exports.isHTMLAnchorElement = isHTMLAnchorElement;
9974
10799
  exports.isHTMLButtonElement = isHTMLButtonElement;
@@ -9976,8 +10801,10 @@ exports.isHTMLElement = isHTMLElement;
9976
10801
  exports.isHTMLInputElement = isHTMLInputElement;
9977
10802
  exports.isHTMLSelectElement = isHTMLSelectElement;
9978
10803
  exports.isHTMLTextAreaElement = isHTMLTextAreaElement;
9979
- exports.multiply = multiply$1;
10804
+ exports.multiply = multiply$2;
9980
10805
  exports.parseColor = parseColor;
10806
+ exports.parseTokenKey = parseTokenKey;
10807
+ exports.parseTokenValue = parseTokenValue;
9981
10808
  exports.rem = rem;
9982
10809
  exports.responsiveCodeFontStyle = responsiveCodeFontStyle;
9983
10810
  exports.responsiveHeadingFont = responsiveHeadingFont;
@@ -9988,7 +10815,7 @@ exports.rgbToHex = rgbToHex;
9988
10815
  exports.rgbToHsl = rgbToHsl;
9989
10816
  exports.rgba = rgba;
9990
10817
  exports.rgbaToRGBA = rgbaToRGBA;
9991
- exports.screen = screen$1;
10818
+ exports.screen = screen$2;
9992
10819
  exports.studioTheme = studioTheme;
9993
10820
  exports.useArrayProp = useArrayProp;
9994
10821
  exports.useBoundaryElement = useBoundaryElement;