@sanity/ui 3.0.0-static.10 → 3.0.0-static.3

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 (106) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +105 -143
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-cjs/buildCommand.js +1 -1
  4. package/dist/_chunks-cjs/buildCommand.js.map +1 -1
  5. package/dist/_chunks-cjs/v3_v2.js +251 -0
  6. package/dist/_chunks-cjs/v3_v2.js.map +1 -0
  7. package/dist/_chunks-es/_visual-editing.mjs +106 -144
  8. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  9. package/dist/_chunks-es/v3_v2.mjs +252 -0
  10. package/dist/_chunks-es/v3_v2.mjs.map +1 -0
  11. package/dist/_visual-editing.d.mts +11 -14
  12. package/dist/_visual-editing.d.ts +11 -14
  13. package/dist/cli.js +1 -1
  14. package/dist/css.d.mts +1006 -282
  15. package/dist/css.d.ts +1006 -282
  16. package/dist/css.js +743 -852
  17. package/dist/css.js.map +1 -1
  18. package/dist/css.mjs +743 -852
  19. package/dist/css.mjs.map +1 -1
  20. package/dist/index.d.mts +11 -14
  21. package/dist/index.d.ts +11 -14
  22. package/dist/index.js +31 -17
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +33 -19
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/sanity-palette.css +9 -1
  27. package/dist/sanity-theme.css +1 -1
  28. package/dist/system.css +1023 -1448
  29. package/dist/theme.d.mts +119 -85
  30. package/dist/theme.d.ts +119 -85
  31. package/dist/theme.js +219 -432
  32. package/dist/theme.js.map +1 -1
  33. package/dist/theme.mjs +202 -413
  34. package/dist/theme.mjs.map +1 -1
  35. package/package.json +2 -2
  36. package/src/cli/buildCommand.ts +2 -2
  37. package/src/css/_comp.ts +0 -1
  38. package/src/css/aspects/flex/flexJustify.style.ts +3 -3
  39. package/src/css/aspects/grid/types.ts +2 -2
  40. package/src/css/aspects/index.ts +0 -1
  41. package/src/css/aspects/textOverflow/textOverflow.ts +2 -2
  42. package/src/css/compile/compilePalette.ts +41 -8
  43. package/src/css/compile/compileRule.ts +0 -1
  44. package/src/css/compile/compileStyle.ts +1 -1
  45. package/src/css/compile/compileTheme_v3.ts +55 -46
  46. package/src/css/index.ts +2 -2
  47. package/src/css/primitives/_input/__workshop__/index.ts +1 -1
  48. package/src/css/primitives/_selectable/_contants.ts +1 -1
  49. package/src/css/primitives/badge/badge.style.ts +1 -1
  50. package/src/css/primitives/box/box.style.ts +1 -1
  51. package/src/css/primitives/box/box.ts +0 -2
  52. package/src/css/primitives/box/types.ts +0 -2
  53. package/src/css/primitives/button/_constants.ts +1 -1
  54. package/src/css/primitives/button/button.style.ts +13 -32
  55. package/src/css/primitives/card/_constants.ts +2 -2
  56. package/src/css/primitives/card/card.style.ts +44 -116
  57. package/src/css/primitives/card/card.ts +1 -1
  58. package/src/css/primitives/card/rules.ts +473 -0
  59. package/src/css/primitives/card/types.ts +1 -0
  60. package/src/css/primitives/kbd/kbd.style.ts +1 -1
  61. package/src/css/primitives/popover/popover.ts +0 -4
  62. package/src/css/primitives/switch/switch.style.ts +83 -8
  63. package/src/css/primitives/text/text.style.ts +3 -11
  64. package/src/css/system.style.ts +0 -4
  65. package/src/css/types.ts +188 -202
  66. package/src/css/varNames.ts +76 -110
  67. package/src/css/vars.ts +76 -109
  68. package/src/theme/defaults/config.ts +2 -2
  69. package/src/theme/defaults/fonts.ts +4 -4
  70. package/src/theme/palette/constants.ts +3 -1
  71. package/src/theme/palette/types.ts +12 -0
  72. package/src/theme/v3/buildTheme_v3.ts +2 -1
  73. package/src/theme/v3/color/buildColor_v3.ts +38 -43
  74. package/src/theme/v3/color/card.ts +38 -43
  75. package/src/theme/v3/color/color.ts +38 -42
  76. package/src/theme/v3/defaults.ts +72 -69
  77. package/src/theme/v3/resolveTokens.ts +38 -43
  78. package/src/theme/v3/types.ts +3 -0
  79. package/src/theme/versioning/themeColor_v3_v2.ts +1 -1
  80. package/src/ui/StyleTags.tsx +1 -1
  81. package/src/ui/components/autocomplete/__workshop__/async.tsx +1 -0
  82. package/src/ui/components/autocomplete/__workshop__/index.ts +1 -1
  83. package/src/ui/components/autocomplete/autocomplete.tsx +11 -2
  84. package/src/ui/components/dialog/dialog.tsx +4 -3
  85. package/src/ui/constants.ts +0 -6
  86. package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +2 -0
  87. package/src/ui/primitives/box/box.tsx +2 -9
  88. package/src/ui/primitives/button/button.tsx +11 -12
  89. package/src/ui/primitives/card/card.tsx +5 -4
  90. package/src/ui/primitives/code/code.tsx +1 -1
  91. package/src/ui/primitives/heading/heading.tsx +1 -1
  92. package/src/ui/primitives/kbd/kbd.tsx +2 -2
  93. package/src/ui/primitives/popover/popover.tsx +75 -5
  94. package/src/ui/primitives/popover/popoverCard.tsx +39 -45
  95. package/src/ui/primitives/select/select.tsx +3 -3
  96. package/src/ui/primitives/stack/stack.tsx +5 -10
  97. package/src/ui/primitives/text/text.tsx +1 -1
  98. package/src/ui/primitives/textInput/textInput.tsx +1 -1
  99. package/src/ui/primitives/tooltip/tooltip.tsx +3 -2
  100. package/src/css/aspects/minWidth/index.ts +0 -2
  101. package/src/css/aspects/minWidth/minWidth.style.ts +0 -13
  102. package/src/css/aspects/minWidth/minWidth.ts +0 -6
  103. package/src/css/aspects/minWidth/types.ts +0 -7
  104. package/src/css/primitives/stack/index.ts +0 -1
  105. package/src/css/primitives/stack/stack.style.ts +0 -9
  106. package/src/css/primitives/stack/stack.ts +0 -6
package/dist/theme.mjs CHANGED
@@ -1,4 +1,18 @@
1
+ import { THEME_COLOR_BLEND_MODES, THEME_COLOR_BUTTON_MODES, THEME_COLOR_CARD_TONES, THEME_COLOR_STATE_TONES, THEME_COLOR_AVATAR_COLORS, v3_v2, THEME_COLOR_STATES, THEME_COLOR_INPUT_MODES, THEME_COLOR_INPUT_STATES } from "./_chunks-es/v3_v2.mjs";
2
+ import { THEME_COLOR_SCHEMES } from "./_chunks-es/v3_v2.mjs";
1
3
  import { COLOR_HUES, COLOR_TINTS } from "@sanity/color";
4
+ function isColorBlendModeValue(str) {
5
+ return THEME_COLOR_BLEND_MODES.includes(str);
6
+ }
7
+ function isColorHueKey(str) {
8
+ return COLOR_HUES.includes(str);
9
+ }
10
+ function isColorTintKey(str) {
11
+ return COLOR_TINTS.includes(str);
12
+ }
13
+ function isColorButtonMode(str) {
14
+ return THEME_COLOR_BUTTON_MODES.includes(str);
15
+ }
2
16
  const AVATAR_SIZE = [0, 1, 2, 3], CONTAINER = [0, 1, 2, 3, 4, 5, "auto"], RADIUS = [0, 1, 2, 3, 4, 5, 6, "full"], SPACE = [0, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9], FONT_CODE_SIZE = [0, 1, 2, 3, 4], FONT_HEADING_SIZE = [0, 1, 2, 3, 4, 5], FONT_LABEL_SIZE = [0, 1, 2, 3, 4, 5], FONT_TEXT_SIZE = [0, 1, 2, 3, 4], SHADOW = [0, 1, 2, 3, 4, 5];
3
17
  function createSelectableTones(opts, base, dark, solid, muted) {
4
18
  return {
@@ -1139,7 +1153,7 @@ const defaultThemeConfig = {
1139
1153
  button: {
1140
1154
  textWeight: "medium",
1141
1155
  border: {
1142
- width: 1
1156
+ width: 0.5
1143
1157
  },
1144
1158
  focusRing: {
1145
1159
  offset: -1,
@@ -1148,7 +1162,7 @@ const defaultThemeConfig = {
1148
1162
  },
1149
1163
  card: {
1150
1164
  border: {
1151
- width: 1
1165
+ width: 0.5
1152
1166
  },
1153
1167
  focusRing: {
1154
1168
  offset: -1,
@@ -1171,7 +1185,7 @@ const defaultThemeConfig = {
1171
1185
  zOffset: 200
1172
1186
  }
1173
1187
  },
1174
- radius: [0, 1, 3, 7, 11, 15, 23, 43, 75, 127],
1188
+ radius: [0, 1, 5, 9, 13, 17, 25, 45, 77, 129],
1175
1189
  shadow: [null, {
1176
1190
  umbra: [0, 0, 0, 0],
1177
1191
  penumbra: [0, 0, 0, 0],
@@ -1196,7 +1210,7 @@ const defaultThemeConfig = {
1196
1210
  space: [0, 4, 8, 12, 20, 32, 52, 84, 136, 220],
1197
1211
  input: {
1198
1212
  border: {
1199
- width: 1
1213
+ width: 0.5
1200
1214
  },
1201
1215
  checkbox: {
1202
1216
  size: 17,
@@ -1287,10 +1301,10 @@ const defaultThemeConfig = {
1287
1301
  family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
1288
1302
  featureSettings: "'liga' 1, 'calt' 1, 'ss01' 1, 'ss03' 1, 'zero' 1",
1289
1303
  weights: {
1290
- regular: 600,
1291
- medium: 700,
1292
- semibold: 800,
1293
- bold: 900
1304
+ regular: 400,
1305
+ medium: 500,
1306
+ semibold: 600,
1307
+ bold: 700
1294
1308
  },
1295
1309
  sizes: [{
1296
1310
  ascenderHeight: 5,
@@ -1433,39 +1447,7 @@ const defaultThemeConfig = {
1433
1447
  letterSpacing: 0
1434
1448
  }]
1435
1449
  }
1436
- }, THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
1437
- "transparent",
1438
- "default",
1439
- "neutral",
1440
- "primary",
1441
- // deprecated
1442
- "suggest",
1443
- "positive",
1444
- "caution",
1445
- "critical"
1446
- ], THEME_COLOR_STATE_TONES = [
1447
- "default",
1448
- "neutral",
1449
- "primary",
1450
- // deprecated
1451
- "suggest",
1452
- "positive",
1453
- "caution",
1454
- "critical"
1455
- ], THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"], THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"], THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
1456
- function isColorBlendModeValue(str) {
1457
- return THEME_COLOR_BLEND_MODES.includes(str);
1458
- }
1459
- function isColorHueKey(str) {
1460
- return COLOR_HUES.includes(str);
1461
- }
1462
- function isColorTintKey(str) {
1463
- return COLOR_TINTS.includes(str);
1464
- }
1465
- function isColorButtonMode(str) {
1466
- return THEME_COLOR_BUTTON_MODES.includes(str);
1467
- }
1468
- const HUES = ["gray", "blue", "purple", "magenta", "red", "orange", "yellow", "green", "cyan"], TINTS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950], RE_PERCENTAGE = /^([0-9]+)%/, RE_OPACITY = /^(1|0\.[0-9]+)?/;
1450
+ }, HUES = ["gray", "blue", "purple", "magenta", "red", "orange", "yellow", "green", "cyan"], TINTS = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950], RE_PERCENTAGE = /^([0-9]+)%/, RE_OPACITY = /^(1|0\.[0-9]+)?/;
1469
1451
  function parseColor$1(str) {
1470
1452
  let cursor = 0;
1471
1453
  const color = getColor();
@@ -1595,48 +1577,6 @@ function buildColorCard_v3(tokens, options) {
1595
1577
  }, acc;
1596
1578
  }, {}),
1597
1579
  backdrop: renderColor(tokens.backdrop, context),
1598
- code: {
1599
- bg: renderColor(tokens.code.bg, context),
1600
- fg: renderColor(tokens.code.fg, context),
1601
- token: {
1602
- atrule: renderColor(tokens.code.token.atrule, context),
1603
- attrName: renderColor(tokens.code.token.attrName, context),
1604
- attrValue: renderColor(tokens.code.token.attrValue, context),
1605
- attribute: renderColor(tokens.code.token.attribute, context),
1606
- boolean: renderColor(tokens.code.token.boolean, context),
1607
- builtin: renderColor(tokens.code.token.builtin, context),
1608
- cdata: renderColor(tokens.code.token.cdata, context),
1609
- char: renderColor(tokens.code.token.char, context),
1610
- class: renderColor(tokens.code.token.class, context),
1611
- className: renderColor(tokens.code.token.className, context),
1612
- comment: renderColor(tokens.code.token.comment, context),
1613
- constant: renderColor(tokens.code.token.constant, context),
1614
- deleted: renderColor(tokens.code.token.deleted, context),
1615
- doctype: renderColor(tokens.code.token.doctype, context),
1616
- entity: renderColor(tokens.code.token.entity, context),
1617
- function: renderColor(tokens.code.token.function, context),
1618
- hexcode: renderColor(tokens.code.token.hexcode, context),
1619
- id: renderColor(tokens.code.token.id, context),
1620
- important: renderColor(tokens.code.token.important, context),
1621
- inserted: renderColor(tokens.code.token.inserted, context),
1622
- keyword: renderColor(tokens.code.token.keyword, context),
1623
- number: renderColor(tokens.code.token.number, context),
1624
- operator: renderColor(tokens.code.token.operator, context),
1625
- prolog: renderColor(tokens.code.token.prolog, context),
1626
- property: renderColor(tokens.code.token.property, context),
1627
- pseudoClass: renderColor(tokens.code.token.pseudoClass, context),
1628
- pseudoElement: renderColor(tokens.code.token.pseudoElement, context),
1629
- punctuation: renderColor(tokens.code.token.punctuation, context),
1630
- regex: renderColor(tokens.code.token.regex, context),
1631
- selector: renderColor(tokens.code.token.selector, context),
1632
- string: renderColor(tokens.code.token.string, context),
1633
- symbol: renderColor(tokens.code.token.symbol, context),
1634
- tag: renderColor(tokens.code.token.tag, context),
1635
- unit: renderColor(tokens.code.token.unit, context),
1636
- url: renderColor(tokens.code.token.url, context),
1637
- variable: renderColor(tokens.code.token.variable, context)
1638
- }
1639
- },
1640
1580
  focusRing: renderColor(tokens.focusRing, context),
1641
1581
  shadow: {
1642
1582
  outline: renderColor(tokens.shadow.outline, context),
@@ -1648,6 +1588,44 @@ function buildColorCard_v3(tokens, options) {
1648
1588
  from: renderColor(tokens.skeleton.from, context),
1649
1589
  to: renderColor(tokens.skeleton.to, context)
1650
1590
  },
1591
+ token: {
1592
+ atrule: renderColor(tokens.token.atrule, context),
1593
+ attrName: renderColor(tokens.token.attrName, context),
1594
+ attrValue: renderColor(tokens.token.attrValue, context),
1595
+ attribute: renderColor(tokens.token.attribute, context),
1596
+ boolean: renderColor(tokens.token.boolean, context),
1597
+ builtin: renderColor(tokens.token.builtin, context),
1598
+ cdata: renderColor(tokens.token.cdata, context),
1599
+ char: renderColor(tokens.token.char, context),
1600
+ class: renderColor(tokens.token.class, context),
1601
+ className: renderColor(tokens.token.className, context),
1602
+ comment: renderColor(tokens.token.comment, context),
1603
+ constant: renderColor(tokens.token.constant, context),
1604
+ deleted: renderColor(tokens.token.deleted, context),
1605
+ doctype: renderColor(tokens.token.doctype, context),
1606
+ entity: renderColor(tokens.token.entity, context),
1607
+ function: renderColor(tokens.token.function, context),
1608
+ hexcode: renderColor(tokens.token.hexcode, context),
1609
+ id: renderColor(tokens.token.id, context),
1610
+ important: renderColor(tokens.token.important, context),
1611
+ inserted: renderColor(tokens.token.inserted, context),
1612
+ keyword: renderColor(tokens.token.keyword, context),
1613
+ number: renderColor(tokens.token.number, context),
1614
+ operator: renderColor(tokens.token.operator, context),
1615
+ prolog: renderColor(tokens.token.prolog, context),
1616
+ property: renderColor(tokens.token.property, context),
1617
+ pseudoClass: renderColor(tokens.token.pseudoClass, context),
1618
+ pseudoElement: renderColor(tokens.token.pseudoElement, context),
1619
+ punctuation: renderColor(tokens.token.punctuation, context),
1620
+ regex: renderColor(tokens.token.regex, context),
1621
+ selector: renderColor(tokens.token.selector, context),
1622
+ string: renderColor(tokens.token.string, context),
1623
+ symbol: renderColor(tokens.token.symbol, context),
1624
+ tag: renderColor(tokens.token.tag, context),
1625
+ unit: renderColor(tokens.token.unit, context),
1626
+ url: renderColor(tokens.token.url, context),
1627
+ variable: renderColor(tokens.token.variable, context)
1628
+ },
1651
1629
  variant: {
1652
1630
  solid: {
1653
1631
  ...THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
@@ -1692,53 +1670,59 @@ function buildColorElement_v3(tokens, options) {
1692
1670
  }
1693
1671
  };
1694
1672
  }
1695
- const defaultTokens = {
1673
+ const defaultPalette = {
1674
+ chroma: {
1675
+ min: 5e-3,
1676
+ max: 0.2325
1677
+ },
1678
+ luminosity: {
1679
+ min: 0.1875,
1680
+ max: 1
1681
+ },
1682
+ hues: {
1683
+ gray: {
1684
+ h: 277,
1685
+ c: 0.04
1686
+ },
1687
+ blue: {
1688
+ h: 273,
1689
+ c: 0.185
1690
+ },
1691
+ purple: {
1692
+ h: 295,
1693
+ c: 0.4
1694
+ },
1695
+ magenta: {
1696
+ h: 12,
1697
+ c: 0.4
1698
+ },
1699
+ red: {
1700
+ h: 30,
1701
+ c: 0.4
1702
+ },
1703
+ orange: {
1704
+ h: 68,
1705
+ c: 0.4
1706
+ },
1707
+ yellow: {
1708
+ h: 90,
1709
+ c: 0.4
1710
+ },
1711
+ green: {
1712
+ h: 171,
1713
+ c: 0.4
1714
+ },
1715
+ cyan: {
1716
+ h: 194,
1717
+ c: 0.4
1718
+ }
1719
+ }
1720
+ }, defaultTokens = {
1696
1721
  color: {
1697
1722
  "*": {
1698
1723
  // backdrop: ['black/0.2', '200/0.2'],
1699
1724
  backdrop: ["black/0.5", "gray/100/0.5"],
1700
- code: {
1701
- bg: ["950", "50"],
1702
- fg: ["300", "700"],
1703
- token: {
1704
- atrule: ["purple/300", "purple/600"],
1705
- attrName: ["green/300", "green/600"],
1706
- attrValue: ["yellow/300", "yellow/600"],
1707
- attribute: ["yellow/300", "yellow/600"],
1708
- boolean: ["purple/300", "purple/600"],
1709
- builtin: ["purple/300", "purple/600"],
1710
- cdata: ["yellow/300", "yellow/600"],
1711
- char: ["yellow/300", "yellow/600"],
1712
- class: ["orange/300", "orange/600"],
1713
- className: ["cyan/300", "cyan/600"],
1714
- comment: ["gray/600", "gray/300"],
1715
- constant: ["purple/300", "purple/600"],
1716
- deleted: ["red/300", "red/600"],
1717
- entity: ["red/300", "red/600"],
1718
- function: ["green/300", "green/600"],
1719
- hexcode: ["blue/300", "blue/600"],
1720
- id: ["purple/300", "purple/600"],
1721
- important: ["purple/300", "purple/600"],
1722
- inserted: ["green/300", "green/600"],
1723
- keyword: ["magenta/300", "magenta/600"],
1724
- number: ["purple/300", "purple/600"],
1725
- operator: ["magenta/300", "magenta/600"],
1726
- prolog: ["gray/300", "gray/600"],
1727
- property: ["blue/300", "blue/600"],
1728
- pseudoClass: ["yellow/300", "yellow/600"],
1729
- pseudoElement: ["yellow/300", "yellow/600"],
1730
- punctuation: ["gray/300", "gray/600"],
1731
- regex: ["blue/300", "blue/600"],
1732
- selector: ["red/300", "red/600"],
1733
- string: ["yellow/300", "yellow/600"],
1734
- symbol: ["purple/300", "purple/600"],
1735
- tag: ["red/300", "red/600"],
1736
- unit: ["orange/300", "orange/600"],
1737
- url: ["red/300", "red/600"],
1738
- variable: ["red/300", "red/600"]
1739
- }
1740
- },
1741
- focusRing: ["blue/500", "blue/500"],
1725
+ focusRing: ["blue/500", "blue/300"],
1742
1726
  link: {
1743
1727
  fg: ["blue/400", "blue/600"]
1744
1728
  },
@@ -1748,16 +1732,53 @@ const defaultTokens = {
1748
1732
  penumbra: ["black/0.14", "500/0.07"],
1749
1733
  ambient: ["black/0.12", "500/0.06"]
1750
1734
  },
1735
+ token: {
1736
+ atrule: ["purple/300", "purple/600"],
1737
+ attrName: ["green/300", "green/600"],
1738
+ attrValue: ["yellow/300", "yellow/600"],
1739
+ attribute: ["yellow/300", "yellow/600"],
1740
+ boolean: ["purple/300", "purple/600"],
1741
+ builtin: ["purple/300", "purple/600"],
1742
+ cdata: ["yellow/300", "yellow/600"],
1743
+ char: ["yellow/300", "yellow/600"],
1744
+ class: ["orange/300", "orange/600"],
1745
+ className: ["cyan/300", "cyan/600"],
1746
+ comment: ["gray/600", "gray/300"],
1747
+ constant: ["purple/300", "purple/600"],
1748
+ deleted: ["red/300", "red/600"],
1749
+ entity: ["red/300", "red/600"],
1750
+ function: ["green/300", "green/600"],
1751
+ hexcode: ["blue/300", "blue/600"],
1752
+ id: ["purple/300", "purple/600"],
1753
+ important: ["purple/300", "purple/600"],
1754
+ inserted: ["green/300", "green/600"],
1755
+ keyword: ["magenta/300", "magenta/600"],
1756
+ number: ["purple/300", "purple/600"],
1757
+ operator: ["magenta/300", "magenta/600"],
1758
+ prolog: ["gray/300", "gray/600"],
1759
+ property: ["blue/300", "blue/600"],
1760
+ pseudoClass: ["yellow/300", "yellow/600"],
1761
+ pseudoElement: ["yellow/300", "yellow/600"],
1762
+ punctuation: ["gray/300", "gray/600"],
1763
+ regex: ["blue/300", "blue/600"],
1764
+ selector: ["red/300", "red/600"],
1765
+ string: ["yellow/300", "yellow/600"],
1766
+ symbol: ["purple/300", "purple/600"],
1767
+ tag: ["red/300", "red/600"],
1768
+ unit: ["orange/300", "orange/600"],
1769
+ url: ["red/300", "red/600"],
1770
+ variable: ["red/300", "red/600"]
1771
+ },
1751
1772
  variant: {
1752
1773
  tinted: {
1753
1774
  "*": {
1754
1775
  bg: {
1755
- 0: ["950", "50"],
1756
- 4: ["800", "200"]
1776
+ 0: ["900", "50"],
1777
+ 4: ["800", "150"]
1757
1778
  },
1758
1779
  border: {
1759
- 0: ["700", "100"],
1760
- 4: ["500", "300"]
1780
+ 0: ["800", "150"],
1781
+ 4: ["600", "350"]
1761
1782
  },
1762
1783
  fg: {
1763
1784
  0: ["100", "900"],
@@ -1783,8 +1804,8 @@ const defaultTokens = {
1783
1804
  solid: {
1784
1805
  "*": {
1785
1806
  bg: {
1786
- 0: ["400", "500"],
1787
- 4: ["300", "600"]
1807
+ 0: ["300", "500"],
1808
+ 4: ["200", "600"]
1788
1809
  },
1789
1810
  border: {
1790
1811
  0: ["200", "400"],
@@ -1829,15 +1850,15 @@ const defaultTokens = {
1829
1850
  "*": {
1830
1851
  bg: {
1831
1852
  0: ["black", "gray/50"],
1832
- 4: ["800", "300 50%"]
1853
+ 4: ["900", "150"]
1833
1854
  },
1834
1855
  border: {
1835
- 0: ["800", "300 40%"],
1836
- 4: ["600", "300"]
1856
+ 0: ["900", "150"],
1857
+ 4: ["700", "350"]
1837
1858
  },
1838
1859
  fg: {
1839
- 0: ["100", "black"],
1840
- 4: ["400", "700"]
1860
+ 0: ["150", "black"],
1861
+ 4: ["550", "600"]
1841
1862
  }
1842
1863
  }
1843
1864
  }
@@ -1848,12 +1869,12 @@ const defaultTokens = {
1848
1869
  tinted: {
1849
1870
  "*": {
1850
1871
  bg: {
1851
- 0: ["950", "white"],
1852
- 4: ["800", "200"]
1872
+ 0: ["gray/950", "white"],
1873
+ 4: ["850", "100"]
1853
1874
  },
1854
1875
  border: {
1855
- 0: ["800", "100"],
1856
- 4: ["600", "300"]
1876
+ 0: ["850", "100"],
1877
+ 4: ["650", "300"]
1857
1878
  },
1858
1879
  fg: {
1859
1880
  0: ["white", "black"],
@@ -1863,18 +1884,6 @@ const defaultTokens = {
1863
1884
  }
1864
1885
  }
1865
1886
  },
1866
- neutral: {
1867
- variant: {
1868
- tinted: {
1869
- "*": {
1870
- bg: {
1871
- 0: ["900", "50"],
1872
- 4: ["700", "200"]
1873
- }
1874
- }
1875
- }
1876
- }
1877
- },
1878
1887
  primary: {
1879
1888
  _hue: "blue"
1880
1889
  },
@@ -1981,48 +1990,6 @@ function resolveCardColorTokens(tokens) {
1981
1990
  }
1982
1991
  },
1983
1992
  backdrop: tokens?.backdrop ?? ["900", "100"],
1984
- code: {
1985
- bg: tokens?.code?.bg ?? ["950", "50"],
1986
- fg: tokens?.code?.fg ?? ["400", "600"],
1987
- token: {
1988
- atrule: tokens?.code?.token?.atrule ?? ["400", "600"],
1989
- attribute: tokens?.code?.token?.attribute ?? ["400", "600"],
1990
- attrName: tokens?.code?.token?.attrName ?? ["400", "600"],
1991
- attrValue: tokens?.code?.token?.attrValue ?? ["400", "600"],
1992
- boolean: tokens?.code?.token?.boolean ?? ["400", "600"],
1993
- builtin: tokens?.code?.token?.builtin ?? ["400", "600"],
1994
- cdata: tokens?.code?.token?.cdata ?? ["400", "600"],
1995
- char: tokens?.code?.token?.char ?? ["400", "600"],
1996
- class: tokens?.code?.token?.class ?? ["400", "600"],
1997
- className: tokens?.code?.token?.className ?? ["400", "600"],
1998
- comment: tokens?.code?.token?.comment ?? ["600", "400"],
1999
- constant: tokens?.code?.token?.constant ?? ["400", "600"],
2000
- deleted: tokens?.code?.token?.deleted ?? ["400", "600"],
2001
- doctype: tokens?.code?.token?.doctype ?? ["400", "600"],
2002
- entity: tokens?.code?.token?.entity ?? ["400", "600"],
2003
- function: tokens?.code?.token?.function ?? ["400", "600"],
2004
- hexcode: tokens?.code?.token?.hexcode ?? ["400", "600"],
2005
- id: tokens?.code?.token?.id ?? ["400", "600"],
2006
- important: tokens?.code?.token?.important ?? ["400", "600"],
2007
- inserted: tokens?.code?.token?.inserted ?? ["400", "600"],
2008
- keyword: tokens?.code?.token?.keyword ?? ["400", "600"],
2009
- number: tokens?.code?.token?.number ?? ["400", "600"],
2010
- operator: tokens?.code?.token?.operator ?? ["400", "600"],
2011
- prolog: tokens?.code?.token?.prolog ?? ["400", "600"],
2012
- property: tokens?.code?.token?.property ?? ["400", "600"],
2013
- pseudoClass: tokens?.code?.token?.pseudoClass ?? ["400", "600"],
2014
- pseudoElement: tokens?.code?.token?.pseudoElement ?? ["400", "600"],
2015
- punctuation: tokens?.code?.token?.punctuation ?? ["400", "600"],
2016
- regex: tokens?.code?.token?.regex ?? ["400", "600"],
2017
- selector: tokens?.code?.token?.selector ?? ["400", "600"],
2018
- string: tokens?.code?.token?.string ?? ["400", "600"],
2019
- symbol: tokens?.code?.token?.symbol ?? ["400", "600"],
2020
- tag: tokens?.code?.token?.tag ?? ["400", "600"],
2021
- unit: tokens?.code?.token?.unit ?? ["400", "600"],
2022
- url: tokens?.code?.token?.url ?? ["400", "600"],
2023
- variable: tokens?.code?.token?.variable ?? ["400", "600"]
2024
- }
2025
- },
2026
1993
  focusRing: tokens?.focusRing ?? ["500", "500"],
2027
1994
  link: {
2028
1995
  fg: tokens?.link?.fg ?? ["400", "600"]
@@ -2037,6 +2004,44 @@ function resolveCardColorTokens(tokens) {
2037
2004
  from: tokens?.skeleton?.from ?? ["900", "100"],
2038
2005
  to: tokens?.skeleton?.to ?? ["950", "50"]
2039
2006
  },
2007
+ token: {
2008
+ atrule: tokens?.token?.atrule ?? ["400", "600"],
2009
+ attribute: tokens?.token?.attribute ?? ["400", "600"],
2010
+ attrName: tokens?.token?.attrName ?? ["400", "600"],
2011
+ attrValue: tokens?.token?.attrValue ?? ["400", "600"],
2012
+ boolean: tokens?.token?.boolean ?? ["400", "600"],
2013
+ builtin: tokens?.token?.builtin ?? ["400", "600"],
2014
+ cdata: tokens?.token?.cdata ?? ["400", "600"],
2015
+ char: tokens?.token?.char ?? ["400", "600"],
2016
+ class: tokens?.token?.class ?? ["400", "600"],
2017
+ className: tokens?.token?.className ?? ["400", "600"],
2018
+ comment: tokens?.token?.comment ?? ["600", "400"],
2019
+ constant: tokens?.token?.constant ?? ["400", "600"],
2020
+ deleted: tokens?.token?.deleted ?? ["400", "600"],
2021
+ doctype: tokens?.token?.doctype ?? ["400", "600"],
2022
+ entity: tokens?.token?.entity ?? ["400", "600"],
2023
+ function: tokens?.token?.function ?? ["400", "600"],
2024
+ hexcode: tokens?.token?.hexcode ?? ["400", "600"],
2025
+ id: tokens?.token?.id ?? ["400", "600"],
2026
+ important: tokens?.token?.important ?? ["400", "600"],
2027
+ inserted: tokens?.token?.inserted ?? ["400", "600"],
2028
+ keyword: tokens?.token?.keyword ?? ["400", "600"],
2029
+ number: tokens?.token?.number ?? ["400", "600"],
2030
+ operator: tokens?.token?.operator ?? ["400", "600"],
2031
+ prolog: tokens?.token?.prolog ?? ["400", "600"],
2032
+ property: tokens?.token?.property ?? ["400", "600"],
2033
+ pseudoClass: tokens?.token?.pseudoClass ?? ["400", "600"],
2034
+ pseudoElement: tokens?.token?.pseudoElement ?? ["400", "600"],
2035
+ punctuation: tokens?.token?.punctuation ?? ["400", "600"],
2036
+ regex: tokens?.token?.regex ?? ["400", "600"],
2037
+ selector: tokens?.token?.selector ?? ["400", "600"],
2038
+ string: tokens?.token?.string ?? ["400", "600"],
2039
+ symbol: tokens?.token?.symbol ?? ["400", "600"],
2040
+ tag: tokens?.token?.tag ?? ["400", "600"],
2041
+ unit: tokens?.token?.unit ?? ["400", "600"],
2042
+ url: tokens?.token?.url ?? ["400", "600"],
2043
+ variable: tokens?.token?.variable ?? ["400", "600"]
2044
+ },
2040
2045
  variant: {
2041
2046
  solid: {
2042
2047
  "*": resolveElementTokens(tokens?.variant?.solid?.["*"]),
@@ -2072,6 +2077,7 @@ function buildTheme_v3(options) {
2072
2077
  } = options ?? {}, tokens = resolveTokens(options?.tokens ?? defaultTokens);
2073
2078
  return {
2074
2079
  _version: 3,
2080
+ _palette: options?.palette ?? defaultPalette,
2075
2081
  _tokens: tokens,
2076
2082
  avatar: v2?.avatar ?? defaultThemeConfig.avatar,
2077
2083
  button: v2?.button ?? defaultThemeConfig.button,
@@ -2195,224 +2201,6 @@ function inputStateThemeColor_v2_v0(t) {
2195
2201
  placeholder: t.placeholder
2196
2202
  };
2197
2203
  }
2198
- function themeColor_v3_v2(options) {
2199
- const {
2200
- color,
2201
- dark
2202
- } = options;
2203
- return {
2204
- _blend: "screen",
2205
- _dark: dark,
2206
- ...buildColorState({
2207
- cardColor: color,
2208
- state: "enabled",
2209
- tone: "default",
2210
- variant: "tinted"
2211
- }),
2212
- backdrop: color.backdrop,
2213
- button: THEME_COLOR_BUTTON_MODES.reduce((modes, mode) => (modes[mode] = THEME_COLOR_STATE_TONES.reduce((tones2, tone) => (tones2[tone] = THEME_COLOR_STATES.reduce((states, state) => (states[state] = buildColorState({
2214
- cardColor: color,
2215
- state,
2216
- tone,
2217
- variant: mode === "default" ? "solid" : "tinted"
2218
- }), mode === "bleed" && (states[state].border = "transparent"), states), {}), tones2), {}), modes), {}),
2219
- focusRing: color.focusRing,
2220
- input: THEME_COLOR_INPUT_MODES.reduce((modes, mode) => (modes[mode] = THEME_COLOR_INPUT_STATES.reduce((states, state) => (states[state] = buildInputState(color.variant.tinted.default), states), {}), modes), {}),
2221
- selectable: THEME_COLOR_STATE_TONES.reduce((tones2, tone) => (tones2[tone] = THEME_COLOR_STATES.reduce((states, state) => (states[state] = buildColorState({
2222
- cardColor: color,
2223
- // cardVars: vars,
2224
- state,
2225
- tone,
2226
- variant: "tinted"
2227
- }), states), {}), tones2), {}),
2228
- shadow: color.shadow,
2229
- syntax: color.code.token
2230
- };
2231
- }
2232
- const stateShades = {
2233
- enabled: {
2234
- bg: [0, 1, 2],
2235
- border: [0, 1, 2],
2236
- fg: [0, 1, 2]
2237
- },
2238
- hovered: {
2239
- bg: [1, 2, 3],
2240
- border: [1, 2, 3],
2241
- fg: [1, 2, 3]
2242
- },
2243
- pressed: {
2244
- bg: [2, 3, 4],
2245
- border: [2, 3, 4],
2246
- fg: [2, 3, 4]
2247
- },
2248
- selected: {
2249
- bg: [3, 4, 4],
2250
- border: [3, 4, 4],
2251
- fg: [3, 4, 4]
2252
- },
2253
- disabled: {
2254
- bg: [4, 4, 4],
2255
- border: [4, 4, 4],
2256
- fg: [4, 4, 4]
2257
- }
2258
- };
2259
- function mix$1(tokens, index) {
2260
- return index === 0 ? tokens[0] : index === 4 ? tokens[4] : `color-mix(in oklch, ${tokens[0]}, ${tokens[4]} ${index * 25}%)`;
2261
- }
2262
- function buildColorState(options) {
2263
- const {
2264
- cardColor,
2265
- state,
2266
- tone,
2267
- variant
2268
- } = options, color = cardColor.variant[variant][tone], shades = stateShades[state];
2269
- return {
2270
- accent: {
2271
- fg: color.fg[4]
2272
- },
2273
- avatar: cardColor.avatar,
2274
- badge: THEME_COLOR_STATE_TONES.reduce((tones2, tone2) => (tones2[tone2] = {
2275
- bg: mix$1(color.bg, 1),
2276
- fg: mix$1(color.fg, 1),
2277
- dot: mix$1(color.fg, 3),
2278
- icon: mix$1(color.fg, 3)
2279
- }, tones2), {}),
2280
- bg: mix$1(color.bg, shades.bg[0]),
2281
- border: mix$1(color.border, shades.border[0]),
2282
- fg: mix$1(color.fg, shades.fg[0]),
2283
- code: {
2284
- bg: mix$1(color.bg, shades.bg[1]),
2285
- fg: mix$1(color.fg, shades.fg[2])
2286
- },
2287
- icon: mix$1(color.fg, shades.fg[2]),
2288
- kbd: {
2289
- bg: mix$1(color.bg, 0),
2290
- fg: mix$1(color.fg, 0),
2291
- border: mix$1(color.bg, 0)
2292
- },
2293
- link: {
2294
- fg: mix$1(color.fg, shades.fg[2])
2295
- },
2296
- muted: {
2297
- bg: mix$1(color.bg, shades.bg[1]),
2298
- fg: mix$1(color.fg, shades.fg[2])
2299
- },
2300
- skeleton: cardColor.skeleton
2301
- };
2302
- }
2303
- function buildInputState(colorElement) {
2304
- return {
2305
- bg: colorElement.bg[0],
2306
- border: colorElement.bg[0],
2307
- fg: colorElement.fg[0],
2308
- muted: {
2309
- bg: colorElement.bg[0]
2310
- },
2311
- placeholder: colorElement.fg[0]
2312
- };
2313
- }
2314
- function v3_v2(theme_v3) {
2315
- return {
2316
- _version: 2,
2317
- avatar: theme_v3.avatar,
2318
- button: theme_v3.button,
2319
- card: theme_v3.card,
2320
- color: {
2321
- dark: {
2322
- transparent: themeColor_v3_v2({
2323
- color: theme_v3.color.dark.card.transparent,
2324
- dark: !0
2325
- // vars: vars.color.dark.transparent,
2326
- }),
2327
- default: themeColor_v3_v2({
2328
- color: theme_v3.color.dark.card.default,
2329
- dark: !0
2330
- // vars: vars.color.dark.default,
2331
- }),
2332
- neutral: themeColor_v3_v2({
2333
- color: theme_v3.color.dark.card.neutral,
2334
- dark: !0
2335
- // vars: vars.color.dark.neutral,
2336
- }),
2337
- primary: themeColor_v3_v2({
2338
- color: theme_v3.color.dark.card.primary,
2339
- dark: !0
2340
- // vars: vars.color.dark.primary,
2341
- }),
2342
- suggest: themeColor_v3_v2({
2343
- color: theme_v3.color.dark.card.suggest,
2344
- dark: !0
2345
- // vars: vars.color.dark.suggest,
2346
- }),
2347
- positive: themeColor_v3_v2({
2348
- color: theme_v3.color.dark.card.positive,
2349
- dark: !0
2350
- // vars: vars.color.dark.positive,
2351
- }),
2352
- caution: themeColor_v3_v2({
2353
- color: theme_v3.color.dark.card.caution,
2354
- dark: !0
2355
- // vars: vars.color.dark.caution,
2356
- }),
2357
- critical: themeColor_v3_v2({
2358
- color: theme_v3.color.dark.card.critical,
2359
- dark: !0
2360
- // vars: vars.color.dark.critical,
2361
- })
2362
- },
2363
- light: {
2364
- transparent: themeColor_v3_v2({
2365
- color: theme_v3.color.light.card.transparent,
2366
- dark: !1
2367
- // vars: vars.color.light.transparent,
2368
- }),
2369
- default: themeColor_v3_v2({
2370
- color: theme_v3.color.light.card.default,
2371
- dark: !1
2372
- // vars: vars.color.light.default,
2373
- }),
2374
- neutral: themeColor_v3_v2({
2375
- color: theme_v3.color.light.card.neutral,
2376
- dark: !1
2377
- // vars: vars.color.light.neutral,
2378
- }),
2379
- primary: themeColor_v3_v2({
2380
- color: theme_v3.color.light.card.primary,
2381
- dark: !1
2382
- // vars: vars.color.light.primary,
2383
- }),
2384
- suggest: themeColor_v3_v2({
2385
- color: theme_v3.color.light.card.suggest,
2386
- dark: !1
2387
- // vars: vars.color.light.suggest,
2388
- }),
2389
- positive: themeColor_v3_v2({
2390
- color: theme_v3.color.light.card.positive,
2391
- dark: !1
2392
- // vars: vars.color.light.positive,
2393
- }),
2394
- caution: themeColor_v3_v2({
2395
- color: theme_v3.color.light.card.caution,
2396
- dark: !1
2397
- // vars: vars.color.light.caution,
2398
- }),
2399
- critical: themeColor_v3_v2({
2400
- color: theme_v3.color.light.card.critical,
2401
- dark: !1
2402
- // vars: vars.color.light.critical,
2403
- })
2404
- }
2405
- },
2406
- container: theme_v3.container,
2407
- font: theme_v3.font,
2408
- input: theme_v3.input,
2409
- layer: theme_v3.layer,
2410
- media: theme_v3.media,
2411
- radius: theme_v3.radius,
2412
- shadow: theme_v3.shadow,
2413
- space: theme_v3.space
2414
- };
2415
- }
2416
2204
  function buildTheme(_config) {
2417
2205
  const v3 = buildTheme_v3({
2418
2206
  v2: _config
@@ -3166,6 +2954,7 @@ export {
3166
2954
  buildTheme,
3167
2955
  buildTheme_v3,
3168
2956
  createColorTheme,
2957
+ defaultPalette,
3169
2958
  defaultTokens,
3170
2959
  getContrastRatio,
3171
2960
  getScopedTheme,