@sanity/ui 2.0.0-beta.1 → 2.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +6 -3
  3. package/dist/index.cjs.mjs +11 -36
  4. package/dist/index.d.ts +248 -268
  5. package/dist/index.esm.js +502 -356
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.js +511 -569
  8. package/dist/index.js.map +1 -1
  9. package/dist/theme.cjs.mjs +1 -1
  10. package/dist/theme.d.ts +81 -114
  11. package/dist/theme.esm.js +355 -290
  12. package/dist/theme.esm.js.map +1 -1
  13. package/dist/theme.js +355 -290
  14. package/dist/theme.js.map +1 -1
  15. package/package.json +6 -3
  16. package/src/core/__workshop__/constants.ts +3 -2
  17. package/src/core/_compat.ts +236 -87
  18. package/src/core/components/menu/__workshop__/selectedItem.tsx +7 -2
  19. package/src/core/components/menu/menuButton.tsx +12 -1
  20. package/src/core/constants.ts +18 -0
  21. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +6 -3
  22. package/src/core/middleware/origin.ts +47 -0
  23. package/src/core/primitives/avatar/__workshop__/asButton.tsx +1 -1
  24. package/src/core/primitives/avatar/__workshop__/stack.tsx +1 -1
  25. package/src/core/primitives/avatar/avatar.tsx +14 -4
  26. package/src/core/primitives/avatar/avatarCounter.tsx +16 -5
  27. package/src/core/primitives/avatar/avatarStack.tsx +2 -2
  28. package/src/core/primitives/badge/badge.tsx +1 -3
  29. package/src/core/primitives/kbd/kbd.tsx +2 -0
  30. package/src/core/primitives/popover/popover.tsx +67 -13
  31. package/src/core/primitives/popover/popoverCard.tsx +26 -15
  32. package/src/core/primitives/select/select.tsx +1 -1
  33. package/src/core/primitives/switch/styles.ts +6 -1
  34. package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -1
  35. package/src/core/primitives/textInput/__workshop__/states.tsx +10 -2
  36. package/src/core/primitives/tooltip/tooltip.tsx +47 -57
  37. package/src/core/primitives/tooltip/tooltipCard.tsx +104 -0
  38. package/src/core/styles/card/_cardColorStyle.ts +2 -0
  39. package/src/core/styles/input/textInputStyle.ts +33 -2
  40. package/src/core/styles/margin/marginsStyle.test.ts +2 -2
  41. package/src/core/styles/padding/paddingStyle.test.ts +2 -2
  42. package/src/core/theme/__workshop__/build/Root.tsx +20 -3
  43. package/src/core/theme/__workshop__/build/story.tsx +16 -10
  44. package/src/core/theme/__workshop__/canvas.tsx +7 -7
  45. package/src/core/theme/__workshop__/debug/story.tsx +196 -0
  46. package/src/core/theme/__workshop__/index.ts +5 -0
  47. package/src/core/theme/theme.test.tsx +2 -2
  48. package/src/core/types/avatar.ts +1 -1
  49. package/src/core/types/button.ts +1 -2
  50. package/src/core/{primitives/tooltip → utils/conditionalWrapper}/conditionalWrapper.tsx +3 -0
  51. package/src/core/utils/conditionalWrapper/index.ts +1 -0
  52. package/src/core/utils/index.ts +1 -0
  53. package/src/theme/build/_deprecated/color/factory.ts +3 -3
  54. package/src/theme/build/buildColorTheme.test.ts +2 -2
  55. package/src/theme/build/buildColorTheme.ts +16 -16
  56. package/src/theme/build/colorToken/colorToken.ts +19 -0
  57. package/src/theme/build/colorToken/compileColorToken.ts +21 -0
  58. package/src/theme/build/colorToken/index.ts +2 -0
  59. package/src/theme/build/colorToken/types.ts +6 -0
  60. package/src/theme/build/renderColorTheme.ts +14 -15
  61. package/src/theme/build/renderColorValue.ts +9 -2
  62. package/src/theme/config/system.ts +12 -10
  63. package/src/theme/config/tokens/color/types.ts +12 -1
  64. package/src/theme/config/tokens/parseTokenKey.ts +1 -0
  65. package/src/theme/config/tokens/parseTokenValue.test.ts +13 -16
  66. package/src/theme/config/tokens/parseTokenValue.ts +45 -14
  67. package/src/theme/config/tokens/types.ts +3 -2
  68. package/src/theme/defaults/colorTokens.ts +278 -252
  69. package/src/theme/defaults/config.ts +2 -1
  70. package/src/theme/defaults/fonts.ts +13 -5
  71. package/src/theme/index.ts +0 -7
  72. package/src/theme/system/color/_constants.ts +5 -2
  73. package/src/theme/system/color/_system.ts +2 -1
  74. package/src/theme/system/color/avatar.ts +2 -12
  75. package/src/theme/system/color/button.ts +4 -20
  76. package/src/theme/system/color/input.ts +3 -11
  77. package/src/theme/system/color/selectable.ts +3 -14
  78. package/src/theme/system/shadow.ts +0 -6
  79. package/src/theme/system/styles.ts +0 -6
  80. package/src/theme/system/theme.ts +2 -0
  81. package/src/theme/system/v0/avatar.ts +1 -1
  82. package/src/theme/system/v0/color/button.ts +4 -4
  83. package/src/theme/system/v0/color/card.ts +2 -2
  84. package/src/theme/system/v0/color/input.ts +3 -3
  85. package/src/theme/system/v0/color/muted.ts +2 -2
  86. package/src/theme/system/v0/color/solid.ts +2 -2
  87. package/src/theme/versioning/themeColor_v0_v2.ts +2 -2
  88. package/src/theme/versioning/v2_v0.ts +2 -2
  89. package/src/theme/build/colorToken.ts +0 -39
package/dist/theme.js CHANGED
@@ -1166,6 +1166,9 @@ const defaultThemeConfig = {
1166
1166
  _version: 2,
1167
1167
  avatar: {
1168
1168
  sizes: [{
1169
+ distance: -4,
1170
+ size: 19
1171
+ }, {
1169
1172
  distance: -4,
1170
1173
  size: 25
1171
1174
  }, {
@@ -1260,7 +1263,7 @@ const defaultThemeConfig = {
1260
1263
  switch: {
1261
1264
  width: 25,
1262
1265
  height: 17,
1263
- padding: 2,
1266
+ padding: 5,
1264
1267
  transitionDurationMs: 150,
1265
1268
  transitionTimingFunction: "ease-out",
1266
1269
  focusRing: {
@@ -1403,35 +1406,42 @@ const defaultThemeFonts = {
1403
1406
  sizes: [{
1404
1407
  ascenderHeight: 2,
1405
1408
  descenderHeight: 2,
1406
- fontSize: 9.8,
1409
+ fontSize: 8.1,
1410
+ iconSize: 13,
1411
+ lineHeight: 10,
1412
+ letterSpacing: 0.5
1413
+ }, {
1414
+ ascenderHeight: 2,
1415
+ descenderHeight: 2,
1416
+ fontSize: 9.5,
1407
1417
  iconSize: 15,
1408
1418
  lineHeight: 11,
1409
1419
  letterSpacing: 0.5
1410
1420
  }, {
1411
1421
  ascenderHeight: 2,
1412
1422
  descenderHeight: 2,
1413
- fontSize: 11.25,
1423
+ fontSize: 10.8,
1414
1424
  iconSize: 17,
1415
1425
  lineHeight: 12,
1416
1426
  letterSpacing: 0.5
1417
1427
  }, {
1418
1428
  ascenderHeight: 2,
1419
1429
  descenderHeight: 2,
1420
- fontSize: 12.75,
1430
+ fontSize: 12.25,
1421
1431
  iconSize: 19,
1422
1432
  lineHeight: 13,
1423
1433
  letterSpacing: 0.5
1424
1434
  }, {
1425
1435
  ascenderHeight: 2,
1426
1436
  descenderHeight: 2,
1427
- fontSize: 14,
1437
+ fontSize: 13.6,
1428
1438
  iconSize: 21,
1429
1439
  lineHeight: 14,
1430
1440
  letterSpacing: 0.5
1431
1441
  }, {
1432
1442
  ascenderHeight: 2,
1433
1443
  descenderHeight: 2,
1434
- fontSize: 15.5,
1444
+ fontSize: 15,
1435
1445
  iconSize: 23,
1436
1446
  lineHeight: 15,
1437
1447
  letterSpacing: 0.5
@@ -1911,13 +1921,10 @@ function inputStateThemeColor_v2_v0(t) {
1911
1921
  placeholder: t.placeholder
1912
1922
  };
1913
1923
  }
1924
+ const THEME_COLOR_SCHEMES = ["light", "dark"];
1914
1925
  const THEME_COLOR_BLEND_MODES = ["multiply", "screen"];
1915
- const THEME_COLOR_CARD_TONES = ["transparent", "default", "primary",
1916
- // todo: rename to `accent` in the next breaking major version
1917
- "positive", "caution", "critical"];
1918
- const THEME_COLOR_STATE_TONES = ["default", "primary",
1919
- // todo: rename to `accent` in the next breaking major version
1920
- "positive", "caution", "critical"];
1926
+ const THEME_COLOR_CARD_TONES = ["transparent", "default", "primary", "positive", "caution", "critical"];
1927
+ const THEME_COLOR_STATE_TONES = ["default", "primary", "positive", "caution", "critical"];
1921
1928
  const THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"];
1922
1929
  const THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"];
1923
1930
  const THEME_COLOR_INPUT_MODES = ["default", "invalid"];
@@ -1991,12 +1998,24 @@ function parseTokenKey(str) {
1991
1998
  }
1992
1999
  return void 0;
1993
2000
  }
2001
+ function isColorMixPercentValue(str) {
2002
+ return /^\d+%$/.test(str);
2003
+ }
1994
2004
  function parseTokenValue(str) {
1995
2005
  const segments = str.split("/");
1996
- const segment0 = segments.shift() || "";
2006
+ let nextSegment = segments.shift() || "";
2007
+ const [segment0, segment0mix] = nextSegment.split(" ");
1997
2008
  if (isColorTintKey(segment0)) {
1998
2009
  const tint = segment0;
1999
2010
  const segment1 = segments.shift() || "";
2011
+ if (isColorMixPercentValue(segment0mix)) {
2012
+ const mix = Number(segment0mix.slice(0, -1)) / 100;
2013
+ return {
2014
+ type: "color",
2015
+ tint,
2016
+ mix
2017
+ };
2018
+ }
2000
2019
  if (isColorOpacityValue(segment1)) {
2001
2020
  const opacity = Number(segment1);
2002
2021
  return {
@@ -2013,6 +2032,14 @@ function parseTokenValue(str) {
2013
2032
  if (isColorValue(segment0)) {
2014
2033
  const key = segment0;
2015
2034
  const segment1 = segments.shift() || "";
2035
+ if (isColorMixPercentValue(segment0mix)) {
2036
+ const mix = Number(segment0mix.slice(0, -1)) / 100;
2037
+ return {
2038
+ type: "color",
2039
+ key,
2040
+ mix
2041
+ };
2042
+ }
2016
2043
  if (isColorOpacityValue(segment1)) {
2017
2044
  const opacity = Number(segment1);
2018
2045
  return {
@@ -2028,15 +2055,24 @@ function parseTokenValue(str) {
2028
2055
  }
2029
2056
  if (isColorHueKey(segment0)) {
2030
2057
  const hue = segment0;
2031
- const segment1 = segments.shift() || "";
2058
+ nextSegment = segments.shift() || "";
2059
+ const [segment1, segment1mix] = nextSegment.split(" ");
2032
2060
  if (isColorTintKey(segment1)) {
2033
2061
  const tint = segment1;
2034
2062
  const segment2 = segments.shift() || "";
2063
+ if (isColorMixPercentValue(segment1mix)) {
2064
+ const mix = Number(segment1mix.slice(0, -1)) / 100;
2065
+ return {
2066
+ type: "color",
2067
+ hue,
2068
+ tint,
2069
+ mix
2070
+ };
2071
+ }
2035
2072
  if (isColorOpacityValue(segment2)) {
2036
2073
  const opacity = Number(segment2);
2037
2074
  return {
2038
2075
  type: "color",
2039
- key: "".concat(hue, "/").concat(tint),
2040
2076
  hue,
2041
2077
  tint,
2042
2078
  opacity
@@ -2044,21 +2080,13 @@ function parseTokenValue(str) {
2044
2080
  }
2045
2081
  return {
2046
2082
  type: "color",
2047
- key: "".concat(hue, "/").concat(tint),
2048
2083
  hue,
2049
2084
  tint
2050
2085
  };
2051
2086
  }
2052
2087
  return {
2053
2088
  type: "hue",
2054
- value: "".concat(hue)
2055
- };
2056
- }
2057
- if (isColorOpacityValue(segment0)) {
2058
- const opacity = Number(segment0);
2059
- return {
2060
- type: "color",
2061
- opacity
2089
+ value: hue
2062
2090
  };
2063
2091
  }
2064
2092
  if (isColorBlendModeValue(segment0)) {
@@ -2095,6 +2123,21 @@ function isColorValue(str) {
2095
2123
  function isColorOpacityValue(str) {
2096
2124
  return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
2097
2125
  }
2126
+ function compileColorTokenValue(node) {
2127
+ let key = "";
2128
+ if (node.key === "black" || node.key === "white") {
2129
+ key = node.key;
2130
+ } else {
2131
+ key = "".concat(node.hue, "/").concat(node.tint);
2132
+ }
2133
+ if (node.mix !== void 0) {
2134
+ return "".concat(key, " ").concat(node.mix * 100, "%");
2135
+ }
2136
+ if (node.opacity !== void 0) {
2137
+ key += "/".concat(node.opacity);
2138
+ }
2139
+ return key;
2140
+ }
2098
2141
  const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
2099
2142
  function resolveColorTokenValue(context) {
2100
2143
  let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_COLOR_TOKEN_VALUE;
@@ -2111,51 +2154,35 @@ function resolveColorTokenValue(context) {
2111
2154
  hue: node.hue || hue
2112
2155
  });
2113
2156
  }
2114
- function compileColorTokenValue(node) {
2115
- let key = "";
2116
- if (node.key === "black" || node.key === "white") {
2117
- key = node.key;
2118
- } else {
2119
- key = "".concat(node.hue, "/").concat(node.tint);
2120
- }
2121
- if (node.opacity !== void 0) {
2122
- key += "/".concat(node.opacity);
2123
- }
2124
- return key;
2125
- }
2126
2157
  const defaultColorTokens = {
2127
2158
  base: {
2128
2159
  "*": {
2129
2160
  _blend: ["multiply", "screen"],
2161
+ accent: {
2162
+ fg: ["purple/600", "purple/400"]
2163
+ },
2130
2164
  avatar: {
2131
2165
  "*": {
2132
2166
  _blend: ["screen", "multiply"],
2133
2167
  bg: ["500", "400"],
2134
2168
  fg: ["white", "black"]
2135
- },
2136
- yellow: {
2137
- bg: ["600", "400"]
2138
- },
2139
- green: {
2140
- bg: ["600", "400"]
2141
- },
2142
- cyan: {
2143
- bg: ["600", "400"]
2144
2169
  }
2145
2170
  },
2146
2171
  backdrop: ["gray/200/0.2", "black/0.5"],
2147
2172
  badge: {
2148
2173
  "*": {
2149
2174
  bg: ["100", "900"],
2150
- fg: ["600", "400"]
2175
+ fg: ["600", "400"],
2176
+ icon: ["500", "500"],
2177
+ dot: ["500", "500"]
2151
2178
  },
2152
2179
  positive: {
2153
- bg: ["200/0.6", "900"],
2154
- fg: ["700", "500"]
2180
+ bg: ["200 50%", "900"],
2181
+ fg: ["600", "500"]
2155
2182
  },
2156
2183
  caution: {
2157
- bg: ["200/0.7", "900"],
2158
- fg: ["700", "500"]
2184
+ bg: ["200 50%", "900"],
2185
+ fg: ["600", "500"]
2159
2186
  }
2160
2187
  },
2161
2188
  bg: ["50", "950"],
@@ -2166,17 +2193,18 @@ const defaultColorTokens = {
2166
2193
  },
2167
2194
  fg: ["800", "200"],
2168
2195
  focusRing: ["blue/500", "blue/500"],
2196
+ icon: ["600", "400"],
2169
2197
  kbd: {
2170
2198
  bg: ["white", "black"],
2171
2199
  fg: ["600", "400"],
2172
2200
  border: ["200", "800"]
2173
2201
  },
2174
2202
  link: {
2175
- fg: ["blue/600", "blue/400"]
2203
+ fg: ["blue/600", "blue/300"]
2176
2204
  },
2177
2205
  muted: {
2178
2206
  bg: ["50", "950"],
2179
- fg: ["600", "400"]
2207
+ fg: ["700 75%", "300 75%"]
2180
2208
  },
2181
2209
  shadow: {
2182
2210
  outline: ["500/0.3", "500/0.4"],
@@ -2186,16 +2214,18 @@ const defaultColorTokens = {
2186
2214
  },
2187
2215
  skeleton: {
2188
2216
  from: ["100", "900"],
2189
- to: ["100/0.5", "900/0.5"]
2217
+ to: ["100 50%", "900 50%"]
2190
2218
  }
2191
2219
  },
2192
2220
  transparent: {
2193
- bg: ["50", "black"],
2194
- fg: ["600", "400"]
2221
+ bg: ["50", "black"]
2195
2222
  },
2196
2223
  default: {
2197
2224
  bg: ["white", "950"],
2198
- fg: ["black", "200"]
2225
+ fg: ["800", "200"],
2226
+ muted: {
2227
+ fg: ["600", "400"]
2228
+ }
2199
2229
  },
2200
2230
  primary: {
2201
2231
  _hue: "blue"
@@ -2203,20 +2233,17 @@ const defaultColorTokens = {
2203
2233
  positive: {
2204
2234
  _hue: "green",
2205
2235
  shadow: {
2206
- outline: ["600/0.3", "500/0.25"]
2236
+ outline: ["500/0.4", "500/0.4"]
2207
2237
  }
2208
2238
  },
2209
2239
  caution: {
2210
2240
  _hue: "yellow",
2211
2241
  shadow: {
2212
- outline: ["600/0.3", "500/0.25"]
2242
+ outline: ["600/0.3", "500/0.4"]
2213
2243
  }
2214
2244
  },
2215
2245
  critical: {
2216
- _hue: "red",
2217
- shadow: {
2218
- outline: ["500/0.3", "500/0.3"]
2219
- }
2246
+ _hue: "red"
2220
2247
  }
2221
2248
  },
2222
2249
  button: {
@@ -2225,58 +2252,89 @@ const defaultColorTokens = {
2225
2252
  "*": {
2226
2253
  _blend: ["screen", "multiply"],
2227
2254
  accent: {
2228
- fg: ["purple/200", "purple/700"]
2255
+ fg: ["purple/300", "purple/700"]
2256
+ },
2257
+ avatar: {
2258
+ "*": {
2259
+ _blend: ["multiply", "screen"],
2260
+ bg: ["white", "black"],
2261
+ fg: ["black", "white"]
2262
+ }
2229
2263
  },
2230
2264
  badge: {
2231
2265
  "*": {
2232
- dot: ["300", "700"],
2233
- icon: ["600", "400"]
2266
+ bg: ["900", "100"],
2267
+ fg: ["400", "600"],
2268
+ dot: ["500", "500"],
2269
+ icon: ["500", "500"]
2234
2270
  }
2235
2271
  },
2236
2272
  bg: ["500", "400"],
2237
2273
  border: ["500/0", "400/0"],
2238
2274
  code: {
2239
- bg: ["500/0.2", "400/0.2"],
2240
- fg: ["200", "700"]
2275
+ bg: ["500 20%", "400 20%"],
2276
+ fg: ["200", "600"]
2241
2277
  },
2242
2278
  fg: ["white", "black"],
2243
- icon: ["200", "800"],
2279
+ icon: ["100 70%", "900 70%"],
2244
2280
  kbd: {
2245
- bg: ["900", "50"],
2246
- fg: ["white", "black"],
2281
+ bg: ["black", "white"],
2282
+ fg: ["200", "600"],
2247
2283
  border: ["800", "200"]
2248
2284
  },
2249
2285
  link: {
2250
- fg: ["blue/200", "blue/700"]
2286
+ fg: ["blue/200", "blue/600"]
2251
2287
  },
2252
2288
  muted: {
2253
- bg: ["900", "50"],
2254
- fg: ["200", "700"]
2289
+ bg: ["950", "50"],
2290
+ fg: ["100 70%", "900 70%"]
2255
2291
  },
2256
2292
  skeleton: {
2257
2293
  from: ["900", "100"],
2258
- to: ["900/0.5", "100/0.5"]
2294
+ to: ["900 50%", "100 50%"]
2259
2295
  }
2260
2296
  },
2261
2297
  hovered: {
2262
- bg: ["600", "300"],
2263
- border: ["600/0", "300/0"]
2298
+ bg: ["700", "300"],
2299
+ border: ["700/0", "300/0"]
2264
2300
  },
2265
2301
  pressed: {
2266
- bg: ["700", "200"]
2302
+ bg: ["700", "300"]
2267
2303
  },
2268
2304
  selected: {
2269
- bg: ["700", "200"]
2305
+ bg: ["700", "300"]
2270
2306
  },
2271
2307
  disabled: {
2272
2308
  _hue: "gray",
2309
+ accent: {
2310
+ fg: ["100 70%", "900 70%"]
2311
+ },
2312
+ badge: {
2313
+ "*": {
2314
+ bg: ["gray/700", "gray/300"],
2315
+ fg: ["white", "black"],
2316
+ dot: ["white", "black"],
2317
+ icon: ["white", "black"]
2318
+ }
2319
+ },
2273
2320
  bg: ["200", "800"],
2274
- icon: ["white", "black"]
2321
+ kbd: {
2322
+ bg: ["black", "white"],
2323
+ fg: ["white", "black"],
2324
+ border: ["700", "300"]
2325
+ },
2326
+ link: {
2327
+ fg: ["100 70%", "900 70%"]
2328
+ }
2275
2329
  }
2276
2330
  },
2277
2331
  default: {
2278
2332
  "*": {
2279
- bg: ["800", "200"]
2333
+ bg: ["800", "200"],
2334
+ muted: {
2335
+ bg: ["950", "50"],
2336
+ fg: ["400", "600"]
2337
+ }
2280
2338
  },
2281
2339
  hovered: {
2282
2340
  bg: ["900", "100"]
@@ -2287,67 +2345,46 @@ const defaultColorTokens = {
2287
2345
  selected: {
2288
2346
  bg: ["black", "white"]
2289
2347
  }
2290
- },
2291
- positive: {
2292
- "*": {
2293
- bg: ["600", "400"]
2294
- },
2295
- hovered: {
2296
- bg: ["700", "300"]
2297
- },
2298
- pressed: {
2299
- bg: ["800", "200"]
2300
- },
2301
- selected: {
2302
- bg: ["800", "200"]
2303
- }
2304
- },
2305
- caution: {
2306
- "*": {
2307
- bg: ["600", "400"]
2308
- },
2309
- hovered: {
2310
- bg: ["700", "300"]
2311
- },
2312
- pressed: {
2313
- bg: ["800", "200"]
2314
- },
2315
- selected: {
2316
- bg: ["800", "200"]
2317
- }
2318
2348
  }
2319
2349
  },
2320
2350
  ghost: {
2321
2351
  "*": {
2322
2352
  "*": {
2323
2353
  _blend: ["multiply", "screen"],
2354
+ accent: {
2355
+ fg: ["purple/700 60%", "purple/300 70%"]
2356
+ },
2357
+ badge: {
2358
+ "*": {
2359
+ bg: ["100", "900"],
2360
+ fg: ["600", "400"],
2361
+ dot: ["500", "500"],
2362
+ icon: ["500", "500"]
2363
+ }
2364
+ },
2324
2365
  bg: ["50", "950"],
2325
- fg: ["700", "400"],
2326
- icon: ["600", "500"],
2327
2366
  border: ["100", "900"],
2328
- accent: {
2329
- fg: ["purple/700/0.6", "purple/400/0.8"]
2367
+ code: {
2368
+ bg: ["500 10%", "400 10%"],
2369
+ fg: ["700 60%", "400 60%"]
2370
+ },
2371
+ fg: ["600", "400"],
2372
+ icon: ["700 60%", "300 60%"],
2373
+ kbd: {
2374
+ bg: ["white", "black"],
2375
+ fg: ["600", "400"],
2376
+ border: ["200", "800"]
2330
2377
  },
2331
2378
  link: {
2332
- fg: ["blue/700/0.6", "blue/400/0.8"]
2379
+ fg: ["blue/700 60%", "blue/300 60%"]
2333
2380
  },
2334
2381
  muted: {
2335
2382
  bg: ["100", "950"],
2336
- fg: ["700/0.6", "400/0.6"]
2337
- },
2338
- code: {
2339
- bg: ["500/0.1", "400/0.1"],
2340
- fg: ["700/0.6", "400/0.6"]
2383
+ fg: ["700 60%", "300 60%"]
2341
2384
  },
2342
2385
  skeleton: {
2343
2386
  from: ["100", "900"],
2344
- to: ["100/0.5", "900/0.5"]
2345
- },
2346
- badge: {
2347
- "*": {
2348
- dot: ["300", "700"],
2349
- icon: ["600", "400"]
2350
- }
2387
+ to: ["100 50%", "900 50%"]
2351
2388
  }
2352
2389
  },
2353
2390
  hovered: {
@@ -2364,32 +2401,46 @@ const defaultColorTokens = {
2364
2401
  },
2365
2402
  disabled: {
2366
2403
  _hue: "gray",
2367
- fg: ["200", "800"],
2368
- icon: ["200", "800"],
2404
+ accent: {
2405
+ fg: ["200", "800"]
2406
+ },
2407
+ badge: {
2408
+ "*": {
2409
+ _hue: "gray",
2410
+ bg: ["50", "950"],
2411
+ fg: ["gray/200", "gray/800"],
2412
+ dot: ["gray/200", "gray/800"],
2413
+ icon: ["gray/200", "gray/800"]
2414
+ }
2415
+ },
2369
2416
  border: ["100", "900"],
2370
- muted: {
2371
- fg: ["200/0.6", "900/0.6"]
2417
+ code: {
2418
+ bg: ["50", "950"],
2419
+ fg: ["200", "800"]
2372
2420
  },
2373
- accent: {
2374
- fg: ["200/0.6", "900/0.6"]
2421
+ fg: ["200", "800"],
2422
+ icon: ["200", "800"],
2423
+ kbd: {
2424
+ bg: ["white", "black"],
2425
+ fg: ["200", "800"],
2426
+ border: ["100", "900"]
2375
2427
  },
2376
2428
  link: {
2377
- fg: ["200/0.6", "900/0.6"]
2429
+ fg: ["200", "800"]
2378
2430
  },
2379
- code: {
2380
- bg: ["50/0.5", "950/0.5"],
2381
- fg: ["200/0.6", "900/0.6"]
2431
+ muted: {
2432
+ fg: ["200", "800"]
2382
2433
  }
2383
2434
  }
2384
2435
  },
2385
2436
  positive: {
2386
2437
  "*": {
2387
- border: ["600/0.2", "800"]
2438
+ border: ["600 20%", "800"]
2388
2439
  }
2389
2440
  },
2390
2441
  caution: {
2391
2442
  "*": {
2392
- border: ["600/0.2", "800"]
2443
+ border: ["600 20%", "800"]
2393
2444
  }
2394
2445
  }
2395
2446
  },
@@ -2397,65 +2448,86 @@ const defaultColorTokens = {
2397
2448
  "*": {
2398
2449
  "*": {
2399
2450
  _blend: ["multiply", "screen"],
2451
+ accent: {
2452
+ fg: ["purple/700 70%", "purple/300 70%"]
2453
+ },
2454
+ badge: {
2455
+ "*": {
2456
+ bg: ["100", "900"],
2457
+ fg: ["600", "400"],
2458
+ dot: ["500", "500"],
2459
+ icon: ["500", "500"]
2460
+ }
2461
+ },
2400
2462
  bg: ["white", "black"],
2401
- fg: ["700", "300"],
2402
- icon: ["700/0.7", "300/0.7"],
2403
2463
  border: ["white/0", "black/0"],
2404
- muted: {
2405
- bg: ["100", "950"],
2406
- fg: ["700/0.7", "300/0.7"]
2464
+ code: {
2465
+ bg: ["50", "950"],
2466
+ fg: ["700 75%", "300 75%"]
2407
2467
  },
2408
- accent: {
2409
- fg: ["purple/700/0.7", "purple/300/0.7"]
2468
+ fg: ["700", "300"],
2469
+ icon: ["700 75%", "300 75%"],
2470
+ kbd: {
2471
+ bg: ["white", "black"],
2472
+ fg: ["700", "300"],
2473
+ border: ["200", "800"]
2410
2474
  },
2411
2475
  link: {
2412
- fg: ["blue/700/0.7", "blue/300/0.7"]
2476
+ fg: ["blue/700 70%", "blue/300 70%"]
2413
2477
  },
2414
- code: {
2478
+ muted: {
2415
2479
  bg: ["100", "950"],
2416
- fg: ["600", "300"]
2480
+ fg: ["700 75%", "300 75%"]
2417
2481
  },
2418
2482
  skeleton: {
2419
2483
  from: ["100", "900"],
2420
- to: ["100/0.5", "900/0.5"]
2421
- },
2422
- badge: {
2423
- "*": {
2424
- dot: ["300", "700"],
2425
- icon: ["600", "400"]
2426
- }
2484
+ to: ["100 50%", "900 50%"]
2427
2485
  }
2428
2486
  },
2429
2487
  hovered: {
2430
2488
  bg: ["50", "950"],
2431
- fg: ["700", "300"],
2432
- icon: ["700/0.7", "400/0.7"]
2489
+ icon: ["700 70%", "400 70%"]
2433
2490
  },
2434
2491
  pressed: {
2435
2492
  bg: ["100", "900"],
2436
2493
  fg: ["800", "200"],
2437
- icon: ["800/0.7", "200/0.7"]
2494
+ icon: ["800 70%", "200 70%"]
2438
2495
  },
2439
2496
  selected: {
2440
2497
  bg: ["100", "900"],
2441
2498
  fg: ["800", "200"],
2442
- icon: ["800/0.7", "200/0.7"]
2499
+ icon: ["800 60%", "200 60%"]
2443
2500
  },
2444
2501
  disabled: {
2445
2502
  _hue: "gray",
2446
- fg: ["200", "800"],
2447
- muted: {
2448
- fg: ["200/0.6", "900/0.6"]
2449
- },
2450
2503
  accent: {
2451
- fg: ["200/0.6", "900/0.6"]
2504
+ fg: ["200", "800"]
2452
2505
  },
2453
- link: {
2454
- fg: ["200/0.6", "900/0.6"]
2506
+ badge: {
2507
+ "*": {
2508
+ _hue: "gray",
2509
+ bg: ["50", "950"],
2510
+ fg: ["gray/200", "gray/800"],
2511
+ dot: ["gray/200", "gray/800"],
2512
+ icon: ["gray/200", "gray/800"]
2513
+ }
2455
2514
  },
2456
2515
  code: {
2457
- bg: ["50/0.5", "950/0.5"],
2458
- fg: ["200/0.6", "900/0.6"]
2516
+ bg: ["50", "950"],
2517
+ fg: ["200", "800"]
2518
+ },
2519
+ fg: ["200", "800"],
2520
+ icon: ["200", "800"],
2521
+ kbd: {
2522
+ bg: ["white", "black"],
2523
+ fg: ["200", "800"],
2524
+ border: ["100", "900"]
2525
+ },
2526
+ link: {
2527
+ fg: ["200", "800"]
2528
+ },
2529
+ muted: {
2530
+ fg: ["200", "800"]
2459
2531
  }
2460
2532
  }
2461
2533
  }
@@ -2471,14 +2543,14 @@ const defaultColorTokens = {
2471
2543
  muted: {
2472
2544
  bg: ["50", "950"]
2473
2545
  },
2474
- placeholder: ["400", "600/0.5"]
2546
+ placeholder: ["400", "600 50%"]
2475
2547
  },
2476
2548
  hovered: {
2477
- border: ["300", "800"]
2549
+ border: ["300", "700"]
2478
2550
  },
2479
2551
  readOnly: {
2480
- border: ["200/0", "900/0"],
2481
- bg: ["100", "950"],
2552
+ bg: ["50", "950"],
2553
+ border: ["200", "800"],
2482
2554
  fg: ["800", "200"]
2483
2555
  },
2484
2556
  disabled: {
@@ -2497,52 +2569,40 @@ const defaultColorTokens = {
2497
2569
  "*": {
2498
2570
  "*": {
2499
2571
  _blend: ["multiply", "screen"],
2500
- bg: ["white", "black"],
2501
- fg: ["800", "200"],
2502
- icon: ["700/0.7", "300/0.7"],
2503
- avatar: {
2572
+ accent: {
2573
+ fg: ["purple/700 70%", "purple/300 70%"]
2574
+ },
2575
+ badge: {
2504
2576
  "*": {
2505
- _blend: ["screen", "multiply"],
2506
- bg: ["500", "400"],
2507
- fg: ["white", "black"]
2577
+ bg: ["100", "900"],
2578
+ fg: ["600", "400"],
2579
+ dot: ["500", "500"],
2580
+ icon: ["500", "500"]
2508
2581
  }
2509
- // yellow: {bg: ['600', '400']},
2510
- // green: {bg: ['600', '400']},
2511
- // cyan: {bg: ['600', '400']},
2512
2582
  },
2583
+ bg: ["white", "black"],
2513
2584
  border: ["200", "800"],
2514
- muted: {
2585
+ code: {
2515
2586
  bg: ["50", "950"],
2516
- fg: ["700", "300"]
2587
+ fg: ["600", "400"]
2517
2588
  },
2518
- accent: {
2519
- fg: ["purple/600", "purple/400"]
2589
+ fg: ["700", "300"],
2590
+ icon: ["700 75%", "300 75%"],
2591
+ kbd: {
2592
+ bg: ["white", "black"],
2593
+ fg: ["600", "400"],
2594
+ border: ["200", "800"]
2520
2595
  },
2521
2596
  link: {
2522
- fg: ["blue/700", "blue/300"]
2597
+ fg: ["blue/700 70%", "blue/300 70%"]
2523
2598
  },
2524
- code: {
2599
+ muted: {
2525
2600
  bg: ["100", "950"],
2526
- fg: ["700", "300"]
2601
+ fg: ["700 75%", "300 75%"]
2527
2602
  },
2528
2603
  skeleton: {
2529
2604
  from: ["100", "900"],
2530
- to: ["100/0.5", "900/0.5"]
2531
- },
2532
- badge: {
2533
- "*": {
2534
- // _blend: ['multiply', 'screen'],
2535
- bg: ["100", "900"],
2536
- fg: ["600", "200"],
2537
- dot: ["300", "700"],
2538
- icon: ["600", "400"]
2539
- }
2540
- },
2541
- kbd: {
2542
- // _blend: ['multiply', 'screen'],
2543
- bg: ["white", "black"],
2544
- fg: ["600", "400"],
2545
- border: ["200", "800"]
2605
+ to: ["100 50%", "900 50%"]
2546
2606
  }
2547
2607
  },
2548
2608
  hovered: {
@@ -2553,127 +2613,129 @@ const defaultColorTokens = {
2553
2613
  },
2554
2614
  selected: {
2555
2615
  _blend: ["screen", "multiply"],
2556
- bg: ["500", "400"],
2557
- fg: ["white", "black"],
2558
- icon: ["200", "800"],
2616
+ accent: {
2617
+ fg: ["purple/300", "purple/700"]
2618
+ },
2559
2619
  avatar: {
2560
2620
  "*": {
2561
2621
  _blend: ["multiply", "screen"],
2562
2622
  bg: ["white", "black"],
2563
2623
  fg: ["black", "white"]
2564
2624
  }
2565
- // magenta: {_hue: 'green'},
2566
- // yellow: {bg: ['600', '400']},
2567
- // green: {bg: ['600', '400']},
2568
- // cyan: {bg: ['600', '400']},
2569
2625
  },
2570
2626
  badge: {
2571
2627
  "*": {
2572
- // _blend: ['multiply', 'screen'],
2573
- // _blend: ['screen', 'multiply'],
2574
- bg: ["700", "300"],
2575
- fg: ["white", "black"]
2628
+ bg: ["900", "100"],
2629
+ fg: ["400", "600"],
2630
+ dot: ["500", "500"],
2631
+ icon: ["500", "500"]
2576
2632
  }
2577
2633
  },
2578
- border: ["500/0.2", "400/0.2"],
2579
- muted: {
2580
- bg: ["900", "50"],
2581
- fg: ["200", "800"]
2582
- },
2583
- accent: {
2584
- fg: ["purple/200", "purple/800"]
2634
+ bg: ["500", "400"],
2635
+ border: ["500 20%", "400 20%"],
2636
+ code: {
2637
+ bg: ["500 20%", "400 20%"],
2638
+ fg: ["200", "600"]
2585
2639
  },
2640
+ fg: ["white", "black"],
2641
+ icon: ["100 70%", "900 70%"],
2586
2642
  kbd: {
2587
- bg: ["black/0", "white/0"],
2588
- fg: ["white", "black"],
2589
- border: ["gray/700", "gray/300"]
2643
+ bg: ["black", "white"],
2644
+ fg: ["200", "600"],
2645
+ border: ["800", "200"]
2590
2646
  },
2591
2647
  link: {
2592
- fg: ["blue/200", "blue/800"]
2648
+ fg: ["blue/200", "blue/600"]
2593
2649
  },
2594
- code: {
2595
- bg: ["500/0.2", "400/0.2"],
2596
- fg: ["200", "700"]
2650
+ muted: {
2651
+ bg: ["950", "50"],
2652
+ fg: ["100 70%", "900 70%"]
2597
2653
  },
2598
2654
  skeleton: {
2599
2655
  from: ["900", "100"],
2600
- to: ["900/0.5", "100/0.5"]
2656
+ to: ["900 50%", "100 50%"]
2601
2657
  }
2602
- // badge: {
2603
- // '*': {
2604
- // _blend: ['multiply', 'screen'],
2605
- // bg: ['900', '100'],
2606
- // fg: ['white', 'black'],
2607
- // dot: ['700', '300'],
2608
- // icon: ['400', '600'],
2609
- // },
2610
- // },
2611
2658
  },
2612
2659
  disabled: {
2660
+ _hue: "gray",
2661
+ accent: {
2662
+ fg: ["200", "800"]
2663
+ },
2664
+ badge: {
2665
+ "*": {
2666
+ _hue: "gray",
2667
+ bg: ["50", "950"],
2668
+ fg: ["gray/200", "gray/800"],
2669
+ dot: ["gray/200", "gray/800"],
2670
+ icon: ["gray/200", "gray/800"]
2671
+ }
2672
+ },
2673
+ border: ["100", "900"],
2674
+ code: {
2675
+ bg: ["50", "950"],
2676
+ fg: ["200", "800"]
2677
+ },
2613
2678
  fg: ["200", "800"],
2614
2679
  icon: ["200", "800"],
2615
- muted: {
2616
- fg: ["200", "800/0.5"]
2617
- },
2618
- accent: {
2619
- fg: ["purple/200", "purple/800/0.5"]
2680
+ kbd: {
2681
+ bg: ["white", "black"],
2682
+ fg: ["200", "800"],
2683
+ border: ["100", "900"]
2620
2684
  },
2621
2685
  link: {
2622
- fg: ["blue/200", "blue/800/0.5"]
2686
+ fg: ["200", "800"]
2623
2687
  },
2624
- code: {
2625
- bg: ["100", "950/0.5"],
2626
- fg: ["200", "800/0.5"]
2688
+ muted: {
2689
+ fg: ["200", "800"]
2627
2690
  }
2628
2691
  }
2629
2692
  },
2630
2693
  default: {
2631
2694
  selected: {
2632
2695
  _hue: "blue"
2633
- // bg: ['500', '400'],
2634
2696
  }
2635
2697
  },
2636
2698
  critical: {
2637
2699
  disabled: {
2638
- bg: ["50/0.5", "950/0.5"]
2700
+ bg: ["50 50%", "950 50%"]
2639
2701
  }
2640
2702
  }
2641
2703
  },
2642
2704
  syntax: {
2643
- atrule: ["purple/700", "purple/400"],
2644
- attrName: ["green/700", "green/400"],
2645
- attrValue: ["yellow/700", "yellow/400"],
2646
- attribute: ["yellow/700", "yellow/400"],
2647
- boolean: ["purple/700", "purple/400"],
2648
- builtin: ["purple/700", "purple/400"],
2649
- cdata: ["yellow/700", "yellow/400"],
2650
- char: ["yellow/700", "yellow/400"],
2651
- class: ["orange/700", "orange/400"],
2652
- className: ["cyan/700", "cyan/400"],
2653
- comment: ["gray/700/0.5", "gray/400/0.5"],
2654
- constant: ["purple/700", "purple/400"],
2655
- deleted: ["red/700", "red/400"],
2656
- entity: ["red/700", "red/400"],
2657
- function: ["green/700", "green/400"],
2658
- hexcode: ["blue/700", "blue/400"],
2659
- id: ["purple/700", "purple/400"],
2660
- important: ["purple/700", "purple/400"],
2661
- inserted: ["yellow/700", "yellow/400"],
2662
- keyword: ["magenta/700", "magenta/400"],
2663
- number: ["purple/700", "purple/400"],
2664
- operator: ["magenta/700", "magenta/400"],
2665
- property: ["blue/700", "blue/400"],
2666
- pseudoClass: ["yellow/700", "yellow/400"],
2667
- pseudoElement: ["yellow/700", "yellow/400"],
2668
- punctuation: ["gray/700", "gray/400"],
2669
- regex: ["blue/700", "blue/400"],
2670
- selector: ["red/700", "red/400"],
2671
- string: ["yellow/700", "yellow/400"],
2672
- symbol: ["purple/700", "purple/400"],
2673
- tag: ["red/700", "red/400"],
2674
- unit: ["orange/700", "orange/400"],
2675
- url: ["red/700", "red/400"],
2676
- variable: ["red/700", "red/400"]
2705
+ atrule: ["purple/600", "purple/400"],
2706
+ attrName: ["green/600", "green/400"],
2707
+ attrValue: ["yellow/600", "yellow/400"],
2708
+ attribute: ["yellow/600", "yellow/400"],
2709
+ boolean: ["purple/600", "purple/400"],
2710
+ builtin: ["purple/600", "purple/400"],
2711
+ cdata: ["yellow/600", "yellow/400"],
2712
+ char: ["yellow/600", "yellow/400"],
2713
+ class: ["orange/600", "orange/400"],
2714
+ className: ["cyan/600", "cyan/400"],
2715
+ comment: ["gray/400", "gray/600"],
2716
+ constant: ["purple/600", "purple/400"],
2717
+ deleted: ["red/600", "red/400"],
2718
+ entity: ["red/600", "red/400"],
2719
+ function: ["green/600", "green/400"],
2720
+ hexcode: ["blue/600", "blue/400"],
2721
+ id: ["purple/600", "purple/400"],
2722
+ important: ["purple/600", "purple/400"],
2723
+ inserted: ["yellow/600", "yellow/400"],
2724
+ keyword: ["magenta/600", "magenta/400"],
2725
+ number: ["purple/600", "purple/400"],
2726
+ operator: ["magenta/600", "magenta/400"],
2727
+ property: ["blue/600", "blue/400"],
2728
+ pseudoClass: ["yellow/600", "yellow/400"],
2729
+ pseudoElement: ["yellow/600", "yellow/400"],
2730
+ punctuation: ["gray/600", "gray/400"],
2731
+ regex: ["blue/600", "blue/400"],
2732
+ selector: ["red/600", "red/400"],
2733
+ string: ["yellow/600", "yellow/400"],
2734
+ symbol: ["purple/600", "purple/400"],
2735
+ tag: ["red/600", "red/400"],
2736
+ unit: ["orange/600", "orange/400"],
2737
+ url: ["red/600", "red/400"],
2738
+ variable: ["red/600", "red/400"]
2677
2739
  }
2678
2740
  };
2679
2741
  function isRecord(value) {
@@ -3812,8 +3874,13 @@ function renderColorValue(str, options) {
3812
3874
  };
3813
3875
  try {
3814
3876
  hex = mixThemeColor(hex, mixOptions);
3877
+ if (bg && node.mix !== void 0) {
3878
+ const from = hexToRgb(bg);
3879
+ const to = hexToRgb(hex);
3880
+ hex = rgbToHex(mix(from, to, node.mix));
3881
+ }
3815
3882
  } catch (err) {
3816
- console.log("could not blend", hex, mixOptions);
3883
+ console.warn("could not blend", hex, mixOptions);
3817
3884
  throw err;
3818
3885
  }
3819
3886
  if (hex === "#aN") {
@@ -4065,10 +4132,9 @@ function renderThemeColorBadgeColor(value, options) {
4065
4132
  colorPalette
4066
4133
  };
4067
4134
  return {
4068
- // _blend: blendMode,
4069
4135
  bg,
4070
- fg: renderColorValue(value.fg, colorOptions),
4071
4136
  dot: renderColorValue(value.dot, colorOptions),
4137
+ fg: renderColorValue(value.fg, colorOptions),
4072
4138
  icon: renderColorValue(value.icon, colorOptions)
4073
4139
  };
4074
4140
  }
@@ -4127,7 +4193,7 @@ function renderThemeColorState(value, options) {
4127
4193
  blendMode
4128
4194
  }),
4129
4195
  badge: renderThemeColorBadge(value.badge, {
4130
- baseBg,
4196
+ baseBg: bg,
4131
4197
  colorPalette,
4132
4198
  blendMode
4133
4199
  }),
@@ -4335,7 +4401,6 @@ function _setCachedTheme(rootTheme, scheme, tone, theme) {
4335
4401
  const toneCache = schemeCache.get(tone);
4336
4402
  toneCache.set(rootTheme, theme);
4337
4403
  }
4338
- const defaultTheme = buildTheme();
4339
4404
  exports.COLOR_CONFIG_AVATAR_COLORS = COLOR_CONFIG_AVATAR_COLORS;
4340
4405
  exports.COLOR_CONFIG_BLEND_KEYS = COLOR_CONFIG_BLEND_KEYS;
4341
4406
  exports.COLOR_CONFIG_CARD_KEYS = COLOR_CONFIG_CARD_KEYS;
@@ -4351,11 +4416,11 @@ exports.THEME_COLOR_BUTTON_MODES = THEME_COLOR_BUTTON_MODES;
4351
4416
  exports.THEME_COLOR_CARD_TONES = THEME_COLOR_CARD_TONES;
4352
4417
  exports.THEME_COLOR_INPUT_MODES = THEME_COLOR_INPUT_MODES;
4353
4418
  exports.THEME_COLOR_INPUT_STATES = THEME_COLOR_INPUT_STATES;
4419
+ exports.THEME_COLOR_SCHEMES = THEME_COLOR_SCHEMES;
4354
4420
  exports.THEME_COLOR_STATES = THEME_COLOR_STATES;
4355
4421
  exports.THEME_COLOR_STATE_TONES = THEME_COLOR_STATE_TONES;
4356
4422
  exports.buildTheme = buildTheme;
4357
4423
  exports.createColorTheme = createColorTheme;
4358
- exports.defaultTheme = defaultTheme;
4359
4424
  exports.getContrastRatio = getContrastRatio;
4360
4425
  exports.getScopedTheme = getScopedTheme;
4361
4426
  exports.getTheme_v2 = getTheme_v2;