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

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 (85) 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 +494 -354
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.js +503 -567
  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 +299 -252
  12. package/dist/theme.esm.js.map +1 -1
  13. package/dist/theme.js +299 -252
  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/tooltip/tooltip.tsx +47 -57
  35. package/src/core/primitives/tooltip/tooltipCard.tsx +104 -0
  36. package/src/core/styles/card/_cardColorStyle.ts +2 -0
  37. package/src/core/styles/margin/marginsStyle.test.ts +2 -2
  38. package/src/core/styles/padding/paddingStyle.test.ts +2 -2
  39. package/src/core/theme/__workshop__/build/Root.tsx +20 -3
  40. package/src/core/theme/__workshop__/build/story.tsx +16 -10
  41. package/src/core/theme/__workshop__/canvas.tsx +7 -7
  42. package/src/core/theme/__workshop__/debug/story.tsx +159 -0
  43. package/src/core/theme/__workshop__/index.ts +5 -0
  44. package/src/core/theme/theme.test.tsx +2 -2
  45. package/src/core/types/avatar.ts +1 -1
  46. package/src/core/types/button.ts +1 -2
  47. package/src/core/{primitives/tooltip → utils/conditionalWrapper}/conditionalWrapper.tsx +3 -0
  48. package/src/core/utils/conditionalWrapper/index.ts +1 -0
  49. package/src/core/utils/index.ts +1 -0
  50. package/src/theme/build/_deprecated/color/factory.ts +3 -3
  51. package/src/theme/build/buildColorTheme.ts +16 -16
  52. package/src/theme/build/colorToken/colorToken.ts +19 -0
  53. package/src/theme/build/colorToken/compileColorToken.ts +21 -0
  54. package/src/theme/build/colorToken/index.ts +2 -0
  55. package/src/theme/build/colorToken/types.ts +6 -0
  56. package/src/theme/build/renderColorTheme.ts +14 -15
  57. package/src/theme/build/renderColorValue.ts +9 -2
  58. package/src/theme/config/system.ts +12 -10
  59. package/src/theme/config/tokens/color/types.ts +12 -1
  60. package/src/theme/config/tokens/parseTokenKey.ts +1 -0
  61. package/src/theme/config/tokens/parseTokenValue.test.ts +13 -16
  62. package/src/theme/config/tokens/parseTokenValue.ts +45 -14
  63. package/src/theme/config/tokens/types.ts +3 -2
  64. package/src/theme/defaults/colorTokens.ts +219 -211
  65. package/src/theme/defaults/config.ts +2 -1
  66. package/src/theme/defaults/fonts.ts +13 -5
  67. package/src/theme/index.ts +0 -7
  68. package/src/theme/system/color/_constants.ts +5 -2
  69. package/src/theme/system/color/_system.ts +2 -1
  70. package/src/theme/system/color/avatar.ts +2 -12
  71. package/src/theme/system/color/button.ts +4 -20
  72. package/src/theme/system/color/input.ts +3 -11
  73. package/src/theme/system/color/selectable.ts +3 -14
  74. package/src/theme/system/shadow.ts +0 -6
  75. package/src/theme/system/styles.ts +0 -6
  76. package/src/theme/system/theme.ts +2 -0
  77. package/src/theme/system/v0/avatar.ts +1 -1
  78. package/src/theme/system/v0/color/button.ts +4 -4
  79. package/src/theme/system/v0/color/card.ts +2 -2
  80. package/src/theme/system/v0/color/input.ts +3 -3
  81. package/src/theme/system/v0/color/muted.ts +2 -2
  82. package/src/theme/system/v0/color/solid.ts +2 -2
  83. package/src/theme/versioning/themeColor_v0_v2.ts +2 -2
  84. package/src/theme/versioning/v2_v0.ts +2 -2
  85. package/src/theme/build/colorToken.ts +0 -39
package/dist/theme.esm.js CHANGED
@@ -1161,6 +1161,9 @@ const defaultThemeConfig = {
1161
1161
  _version: 2,
1162
1162
  avatar: {
1163
1163
  sizes: [{
1164
+ distance: -4,
1165
+ size: 19
1166
+ }, {
1164
1167
  distance: -4,
1165
1168
  size: 25
1166
1169
  }, {
@@ -1255,7 +1258,7 @@ const defaultThemeConfig = {
1255
1258
  switch: {
1256
1259
  width: 25,
1257
1260
  height: 17,
1258
- padding: 2,
1261
+ padding: 5,
1259
1262
  transitionDurationMs: 150,
1260
1263
  transitionTimingFunction: "ease-out",
1261
1264
  focusRing: {
@@ -1398,35 +1401,42 @@ const defaultThemeFonts = {
1398
1401
  sizes: [{
1399
1402
  ascenderHeight: 2,
1400
1403
  descenderHeight: 2,
1401
- fontSize: 9.8,
1404
+ fontSize: 8.1,
1405
+ iconSize: 13,
1406
+ lineHeight: 10,
1407
+ letterSpacing: 0.5
1408
+ }, {
1409
+ ascenderHeight: 2,
1410
+ descenderHeight: 2,
1411
+ fontSize: 9.5,
1402
1412
  iconSize: 15,
1403
1413
  lineHeight: 11,
1404
1414
  letterSpacing: 0.5
1405
1415
  }, {
1406
1416
  ascenderHeight: 2,
1407
1417
  descenderHeight: 2,
1408
- fontSize: 11.25,
1418
+ fontSize: 10.8,
1409
1419
  iconSize: 17,
1410
1420
  lineHeight: 12,
1411
1421
  letterSpacing: 0.5
1412
1422
  }, {
1413
1423
  ascenderHeight: 2,
1414
1424
  descenderHeight: 2,
1415
- fontSize: 12.75,
1425
+ fontSize: 12.25,
1416
1426
  iconSize: 19,
1417
1427
  lineHeight: 13,
1418
1428
  letterSpacing: 0.5
1419
1429
  }, {
1420
1430
  ascenderHeight: 2,
1421
1431
  descenderHeight: 2,
1422
- fontSize: 14,
1432
+ fontSize: 13.6,
1423
1433
  iconSize: 21,
1424
1434
  lineHeight: 14,
1425
1435
  letterSpacing: 0.5
1426
1436
  }, {
1427
1437
  ascenderHeight: 2,
1428
1438
  descenderHeight: 2,
1429
- fontSize: 15.5,
1439
+ fontSize: 15,
1430
1440
  iconSize: 23,
1431
1441
  lineHeight: 15,
1432
1442
  letterSpacing: 0.5
@@ -1906,13 +1916,10 @@ function inputStateThemeColor_v2_v0(t) {
1906
1916
  placeholder: t.placeholder
1907
1917
  };
1908
1918
  }
1919
+ const THEME_COLOR_SCHEMES = ["light", "dark"];
1909
1920
  const THEME_COLOR_BLEND_MODES = ["multiply", "screen"];
1910
- const THEME_COLOR_CARD_TONES = ["transparent", "default", "primary",
1911
- // todo: rename to `accent` in the next breaking major version
1912
- "positive", "caution", "critical"];
1913
- const THEME_COLOR_STATE_TONES = ["default", "primary",
1914
- // todo: rename to `accent` in the next breaking major version
1915
- "positive", "caution", "critical"];
1921
+ const THEME_COLOR_CARD_TONES = ["transparent", "default", "primary", "positive", "caution", "critical"];
1922
+ const THEME_COLOR_STATE_TONES = ["default", "primary", "positive", "caution", "critical"];
1916
1923
  const THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"];
1917
1924
  const THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"];
1918
1925
  const THEME_COLOR_INPUT_MODES = ["default", "invalid"];
@@ -1986,12 +1993,24 @@ function parseTokenKey(str) {
1986
1993
  }
1987
1994
  return void 0;
1988
1995
  }
1996
+ function isColorMixPercentValue(str) {
1997
+ return /^\d+%$/.test(str);
1998
+ }
1989
1999
  function parseTokenValue(str) {
1990
2000
  const segments = str.split("/");
1991
- const segment0 = segments.shift() || "";
2001
+ let nextSegment = segments.shift() || "";
2002
+ const [segment0, segment0mix] = nextSegment.split(" ");
1992
2003
  if (isColorTintKey(segment0)) {
1993
2004
  const tint = segment0;
1994
2005
  const segment1 = segments.shift() || "";
2006
+ if (isColorMixPercentValue(segment0mix)) {
2007
+ const mix = Number(segment0mix.slice(0, -1)) / 100;
2008
+ return {
2009
+ type: "color",
2010
+ tint,
2011
+ mix
2012
+ };
2013
+ }
1995
2014
  if (isColorOpacityValue(segment1)) {
1996
2015
  const opacity = Number(segment1);
1997
2016
  return {
@@ -2008,6 +2027,14 @@ function parseTokenValue(str) {
2008
2027
  if (isColorValue(segment0)) {
2009
2028
  const key = segment0;
2010
2029
  const segment1 = segments.shift() || "";
2030
+ if (isColorMixPercentValue(segment0mix)) {
2031
+ const mix = Number(segment0mix.slice(0, -1)) / 100;
2032
+ return {
2033
+ type: "color",
2034
+ key,
2035
+ mix
2036
+ };
2037
+ }
2011
2038
  if (isColorOpacityValue(segment1)) {
2012
2039
  const opacity = Number(segment1);
2013
2040
  return {
@@ -2023,15 +2050,24 @@ function parseTokenValue(str) {
2023
2050
  }
2024
2051
  if (isColorHueKey(segment0)) {
2025
2052
  const hue = segment0;
2026
- const segment1 = segments.shift() || "";
2053
+ nextSegment = segments.shift() || "";
2054
+ const [segment1, segment1mix] = nextSegment.split(" ");
2027
2055
  if (isColorTintKey(segment1)) {
2028
2056
  const tint = segment1;
2029
2057
  const segment2 = segments.shift() || "";
2058
+ if (isColorMixPercentValue(segment1mix)) {
2059
+ const mix = Number(segment1mix.slice(0, -1)) / 100;
2060
+ return {
2061
+ type: "color",
2062
+ hue,
2063
+ tint,
2064
+ mix
2065
+ };
2066
+ }
2030
2067
  if (isColorOpacityValue(segment2)) {
2031
2068
  const opacity = Number(segment2);
2032
2069
  return {
2033
2070
  type: "color",
2034
- key: "".concat(hue, "/").concat(tint),
2035
2071
  hue,
2036
2072
  tint,
2037
2073
  opacity
@@ -2039,21 +2075,13 @@ function parseTokenValue(str) {
2039
2075
  }
2040
2076
  return {
2041
2077
  type: "color",
2042
- key: "".concat(hue, "/").concat(tint),
2043
2078
  hue,
2044
2079
  tint
2045
2080
  };
2046
2081
  }
2047
2082
  return {
2048
2083
  type: "hue",
2049
- value: "".concat(hue)
2050
- };
2051
- }
2052
- if (isColorOpacityValue(segment0)) {
2053
- const opacity = Number(segment0);
2054
- return {
2055
- type: "color",
2056
- opacity
2084
+ value: hue
2057
2085
  };
2058
2086
  }
2059
2087
  if (isColorBlendModeValue(segment0)) {
@@ -2090,6 +2118,21 @@ function isColorValue(str) {
2090
2118
  function isColorOpacityValue(str) {
2091
2119
  return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
2092
2120
  }
2121
+ function compileColorTokenValue(node) {
2122
+ let key = "";
2123
+ if (node.key === "black" || node.key === "white") {
2124
+ key = node.key;
2125
+ } else {
2126
+ key = "".concat(node.hue, "/").concat(node.tint);
2127
+ }
2128
+ if (node.mix !== void 0) {
2129
+ return "".concat(key, " ").concat(node.mix * 100, "%");
2130
+ }
2131
+ if (node.opacity !== void 0) {
2132
+ key += "/".concat(node.opacity);
2133
+ }
2134
+ return key;
2135
+ }
2093
2136
  const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
2094
2137
  function resolveColorTokenValue(context) {
2095
2138
  let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_COLOR_TOKEN_VALUE;
@@ -2106,58 +2149,42 @@ function resolveColorTokenValue(context) {
2106
2149
  hue: node.hue || hue
2107
2150
  });
2108
2151
  }
2109
- function compileColorTokenValue(node) {
2110
- let key = "";
2111
- if (node.key === "black" || node.key === "white") {
2112
- key = node.key;
2113
- } else {
2114
- key = "".concat(node.hue, "/").concat(node.tint);
2115
- }
2116
- if (node.opacity !== void 0) {
2117
- key += "/".concat(node.opacity);
2118
- }
2119
- return key;
2120
- }
2121
2152
  const defaultColorTokens = {
2122
2153
  base: {
2123
2154
  "*": {
2124
2155
  _blend: ["multiply", "screen"],
2156
+ accent: {
2157
+ fg: ["purple/600", "purple/400"]
2158
+ },
2125
2159
  avatar: {
2126
2160
  "*": {
2127
2161
  _blend: ["screen", "multiply"],
2128
2162
  bg: ["500", "400"],
2129
2163
  fg: ["white", "black"]
2130
- },
2131
- yellow: {
2132
- bg: ["600", "400"]
2133
- },
2134
- green: {
2135
- bg: ["600", "400"]
2136
- },
2137
- cyan: {
2138
- bg: ["600", "400"]
2139
2164
  }
2140
2165
  },
2141
2166
  backdrop: ["gray/200/0.2", "black/0.5"],
2142
2167
  badge: {
2143
2168
  "*": {
2144
2169
  bg: ["100", "900"],
2145
- fg: ["600", "400"]
2170
+ fg: ["600", "400"],
2171
+ icon: ["500", "500"],
2172
+ dot: ["500", "500"]
2146
2173
  },
2147
2174
  positive: {
2148
- bg: ["200/0.6", "900"],
2149
- fg: ["700", "500"]
2175
+ bg: ["200 50%", "900"],
2176
+ fg: ["600", "500"]
2150
2177
  },
2151
2178
  caution: {
2152
- bg: ["200/0.7", "900"],
2153
- fg: ["700", "500"]
2179
+ bg: ["200 50%", "900"],
2180
+ fg: ["600", "500"]
2154
2181
  }
2155
2182
  },
2156
2183
  bg: ["50", "950"],
2157
2184
  border: ["200", "800"],
2158
2185
  code: {
2159
2186
  bg: ["50", "950"],
2160
- fg: ["600", "400"]
2187
+ fg: ["600", "300"]
2161
2188
  },
2162
2189
  fg: ["800", "200"],
2163
2190
  focusRing: ["blue/500", "blue/500"],
@@ -2167,11 +2194,11 @@ const defaultColorTokens = {
2167
2194
  border: ["200", "800"]
2168
2195
  },
2169
2196
  link: {
2170
- fg: ["blue/600", "blue/400"]
2197
+ fg: ["blue/600", "blue/300"]
2171
2198
  },
2172
2199
  muted: {
2173
2200
  bg: ["50", "950"],
2174
- fg: ["600", "400"]
2201
+ fg: ["700 70%", "300 70%"]
2175
2202
  },
2176
2203
  shadow: {
2177
2204
  outline: ["500/0.3", "500/0.4"],
@@ -2181,16 +2208,22 @@ const defaultColorTokens = {
2181
2208
  },
2182
2209
  skeleton: {
2183
2210
  from: ["100", "900"],
2184
- to: ["100/0.5", "900/0.5"]
2211
+ to: ["100 50%", "900 50%"]
2185
2212
  }
2186
2213
  },
2187
2214
  transparent: {
2188
2215
  bg: ["50", "black"],
2189
- fg: ["600", "400"]
2216
+ fg: ["600", "400"],
2217
+ muted: {
2218
+ fg: ["600", "400"]
2219
+ }
2190
2220
  },
2191
2221
  default: {
2192
2222
  bg: ["white", "950"],
2193
- fg: ["black", "200"]
2223
+ fg: ["black", "200"],
2224
+ muted: {
2225
+ fg: ["600", "400"]
2226
+ }
2194
2227
  },
2195
2228
  primary: {
2196
2229
  _hue: "blue"
@@ -2198,20 +2231,17 @@ const defaultColorTokens = {
2198
2231
  positive: {
2199
2232
  _hue: "green",
2200
2233
  shadow: {
2201
- outline: ["600/0.3", "500/0.25"]
2234
+ outline: ["500/0.4", "500/0.4"]
2202
2235
  }
2203
2236
  },
2204
2237
  caution: {
2205
2238
  _hue: "yellow",
2206
2239
  shadow: {
2207
- outline: ["600/0.3", "500/0.25"]
2240
+ outline: ["600/0.3", "500/0.4"]
2208
2241
  }
2209
2242
  },
2210
2243
  critical: {
2211
- _hue: "red",
2212
- shadow: {
2213
- outline: ["500/0.3", "500/0.3"]
2214
- }
2244
+ _hue: "red"
2215
2245
  }
2216
2246
  },
2217
2247
  button: {
@@ -2220,58 +2250,77 @@ const defaultColorTokens = {
2220
2250
  "*": {
2221
2251
  _blend: ["screen", "multiply"],
2222
2252
  accent: {
2223
- fg: ["purple/200", "purple/700"]
2253
+ fg: ["purple/300", "purple/700"]
2224
2254
  },
2225
2255
  badge: {
2226
2256
  "*": {
2227
- dot: ["300", "700"],
2228
- icon: ["600", "400"]
2257
+ bg: ["900", "100"],
2258
+ fg: ["400", "600"],
2259
+ dot: ["500", "500"],
2260
+ icon: ["500", "500"]
2229
2261
  }
2230
2262
  },
2231
2263
  bg: ["500", "400"],
2232
2264
  border: ["500/0", "400/0"],
2233
2265
  code: {
2234
- bg: ["500/0.2", "400/0.2"],
2235
- fg: ["200", "700"]
2266
+ bg: ["500 20%", "400 20%"],
2267
+ fg: ["200", "600"]
2236
2268
  },
2237
2269
  fg: ["white", "black"],
2238
2270
  icon: ["200", "800"],
2239
2271
  kbd: {
2240
- bg: ["900", "50"],
2241
- fg: ["white", "black"],
2272
+ bg: ["black", "white"],
2273
+ fg: ["200", "800"],
2242
2274
  border: ["800", "200"]
2243
2275
  },
2244
2276
  link: {
2245
2277
  fg: ["blue/200", "blue/700"]
2246
2278
  },
2247
2279
  muted: {
2248
- bg: ["900", "50"],
2249
- fg: ["200", "700"]
2280
+ bg: ["950", "50"],
2281
+ fg: ["100 70%", "600"]
2250
2282
  },
2251
2283
  skeleton: {
2252
2284
  from: ["900", "100"],
2253
- to: ["900/0.5", "100/0.5"]
2285
+ to: ["900 50%", "100 50%"]
2254
2286
  }
2255
2287
  },
2256
2288
  hovered: {
2257
- bg: ["600", "300"],
2258
- border: ["600/0", "300/0"]
2289
+ bg: ["700", "300"],
2290
+ border: ["700/0", "300/0"]
2259
2291
  },
2260
2292
  pressed: {
2261
- bg: ["700", "200"]
2293
+ bg: ["700", "300"]
2262
2294
  },
2263
2295
  selected: {
2264
- bg: ["700", "200"]
2296
+ bg: ["700", "300"]
2265
2297
  },
2266
2298
  disabled: {
2267
2299
  _hue: "gray",
2300
+ badge: {
2301
+ "*": {
2302
+ bg: ["gray/700", "gray/300"],
2303
+ fg: ["white", "black"],
2304
+ dot: ["white", "black"],
2305
+ icon: ["white", "black"]
2306
+ }
2307
+ },
2268
2308
  bg: ["200", "800"],
2269
- icon: ["white", "black"]
2309
+ icon: ["white", "black"],
2310
+ kbd: {
2311
+ bg: ["black", "white"],
2312
+ fg: ["white", "black"],
2313
+ border: ["700", "300"]
2314
+ }
2270
2315
  }
2271
2316
  },
2272
2317
  default: {
2273
2318
  "*": {
2274
- bg: ["800", "200"]
2319
+ bg: ["800", "200"],
2320
+ muted: {
2321
+ bg: ["950", "50"],
2322
+ fg: ["400", "600"]
2323
+ }
2275
2324
  },
2276
2325
  hovered: {
2277
2326
  bg: ["900", "100"]
@@ -2282,67 +2331,46 @@ const defaultColorTokens = {
2282
2331
  selected: {
2283
2332
  bg: ["black", "white"]
2284
2333
  }
2285
- },
2286
- positive: {
2287
- "*": {
2288
- bg: ["600", "400"]
2289
- },
2290
- hovered: {
2291
- bg: ["700", "300"]
2292
- },
2293
- pressed: {
2294
- bg: ["800", "200"]
2295
- },
2296
- selected: {
2297
- bg: ["800", "200"]
2298
- }
2299
- },
2300
- caution: {
2301
- "*": {
2302
- bg: ["600", "400"]
2303
- },
2304
- hovered: {
2305
- bg: ["700", "300"]
2306
- },
2307
- pressed: {
2308
- bg: ["800", "200"]
2309
- },
2310
- selected: {
2311
- bg: ["800", "200"]
2312
- }
2313
2334
  }
2314
2335
  },
2315
2336
  ghost: {
2316
2337
  "*": {
2317
2338
  "*": {
2318
2339
  _blend: ["multiply", "screen"],
2340
+ accent: {
2341
+ fg: ["purple/700 60%", "purple/300 70%"]
2342
+ },
2343
+ badge: {
2344
+ "*": {
2345
+ bg: ["100", "900"],
2346
+ fg: ["600", "400"],
2347
+ dot: ["500", "500"],
2348
+ icon: ["500", "500"]
2349
+ }
2350
+ },
2319
2351
  bg: ["50", "950"],
2320
- fg: ["700", "400"],
2321
- icon: ["600", "500"],
2322
2352
  border: ["100", "900"],
2323
- accent: {
2324
- fg: ["purple/700/0.6", "purple/400/0.8"]
2353
+ code: {
2354
+ bg: ["500 10%", "400 10%"],
2355
+ fg: ["700 60%", "400 60%"]
2356
+ },
2357
+ fg: ["600", "400"],
2358
+ icon: ["600", "500"],
2359
+ kbd: {
2360
+ bg: ["white", "black"],
2361
+ fg: ["600", "400"],
2362
+ border: ["200", "800"]
2325
2363
  },
2326
2364
  link: {
2327
- fg: ["blue/700/0.6", "blue/400/0.8"]
2365
+ fg: ["blue/700 60%", "blue/300 60%"]
2328
2366
  },
2329
2367
  muted: {
2330
2368
  bg: ["100", "950"],
2331
- fg: ["700/0.6", "400/0.6"]
2332
- },
2333
- code: {
2334
- bg: ["500/0.1", "400/0.1"],
2335
- fg: ["700/0.6", "400/0.6"]
2369
+ fg: ["700 60%", "300 60%"]
2336
2370
  },
2337
2371
  skeleton: {
2338
2372
  from: ["100", "900"],
2339
- to: ["100/0.5", "900/0.5"]
2340
- },
2341
- badge: {
2342
- "*": {
2343
- dot: ["300", "700"],
2344
- icon: ["600", "400"]
2345
- }
2373
+ to: ["100 50%", "900 50%"]
2346
2374
  }
2347
2375
  },
2348
2376
  hovered: {
@@ -2359,32 +2387,46 @@ const defaultColorTokens = {
2359
2387
  },
2360
2388
  disabled: {
2361
2389
  _hue: "gray",
2362
- fg: ["200", "800"],
2363
- icon: ["200", "800"],
2390
+ accent: {
2391
+ fg: ["200", "800"]
2392
+ },
2393
+ badge: {
2394
+ "*": {
2395
+ _hue: "gray",
2396
+ bg: ["50", "950"],
2397
+ fg: ["gray/200", "gray/800"],
2398
+ dot: ["gray/200", "gray/800"],
2399
+ icon: ["gray/200", "gray/800"]
2400
+ }
2401
+ },
2364
2402
  border: ["100", "900"],
2365
- muted: {
2366
- fg: ["200/0.6", "900/0.6"]
2403
+ code: {
2404
+ bg: ["50", "950"],
2405
+ fg: ["200", "800"]
2367
2406
  },
2368
- accent: {
2369
- fg: ["200/0.6", "900/0.6"]
2407
+ fg: ["200", "800"],
2408
+ icon: ["200", "800"],
2409
+ kbd: {
2410
+ bg: ["white", "black"],
2411
+ fg: ["200", "800"],
2412
+ border: ["100", "900"]
2370
2413
  },
2371
2414
  link: {
2372
- fg: ["200/0.6", "900/0.6"]
2415
+ fg: ["200", "800"]
2373
2416
  },
2374
- code: {
2375
- bg: ["50/0.5", "950/0.5"],
2376
- fg: ["200/0.6", "900/0.6"]
2417
+ muted: {
2418
+ fg: ["200", "800"]
2377
2419
  }
2378
2420
  }
2379
2421
  },
2380
2422
  positive: {
2381
2423
  "*": {
2382
- border: ["600/0.2", "800"]
2424
+ border: ["600 20%", "800"]
2383
2425
  }
2384
2426
  },
2385
2427
  caution: {
2386
2428
  "*": {
2387
- border: ["600/0.2", "800"]
2429
+ border: ["600 20%", "800"]
2388
2430
  }
2389
2431
  }
2390
2432
  },
@@ -2392,65 +2434,86 @@ const defaultColorTokens = {
2392
2434
  "*": {
2393
2435
  "*": {
2394
2436
  _blend: ["multiply", "screen"],
2437
+ accent: {
2438
+ fg: ["purple/700 70%", "purple/300 70%"]
2439
+ },
2440
+ badge: {
2441
+ "*": {
2442
+ bg: ["100", "900"],
2443
+ fg: ["600", "400"],
2444
+ dot: ["500", "500"],
2445
+ icon: ["500", "500"]
2446
+ }
2447
+ },
2395
2448
  bg: ["white", "black"],
2396
- fg: ["700", "300"],
2397
- icon: ["700/0.7", "300/0.7"],
2398
2449
  border: ["white/0", "black/0"],
2399
- muted: {
2450
+ code: {
2400
2451
  bg: ["100", "950"],
2401
- fg: ["700/0.7", "300/0.7"]
2452
+ fg: ["600", "300"]
2402
2453
  },
2403
- accent: {
2404
- fg: ["purple/700/0.7", "purple/300/0.7"]
2454
+ fg: ["700", "300"],
2455
+ icon: ["700 70%", "300 70%"],
2456
+ kbd: {
2457
+ bg: ["white", "black"],
2458
+ fg: ["600", "400"],
2459
+ border: ["200", "800"]
2405
2460
  },
2406
2461
  link: {
2407
- fg: ["blue/700/0.7", "blue/300/0.7"]
2462
+ fg: ["blue/700 70%", "blue/300 70%"]
2408
2463
  },
2409
- code: {
2464
+ muted: {
2410
2465
  bg: ["100", "950"],
2411
- fg: ["600", "300"]
2466
+ fg: ["700 70%", "300 70%"]
2412
2467
  },
2413
2468
  skeleton: {
2414
2469
  from: ["100", "900"],
2415
- to: ["100/0.5", "900/0.5"]
2416
- },
2417
- badge: {
2418
- "*": {
2419
- dot: ["300", "700"],
2420
- icon: ["600", "400"]
2421
- }
2470
+ to: ["100 50%", "900 50%"]
2422
2471
  }
2423
2472
  },
2424
2473
  hovered: {
2425
2474
  bg: ["50", "950"],
2426
2475
  fg: ["700", "300"],
2427
- icon: ["700/0.7", "400/0.7"]
2476
+ icon: ["700 70%", "400 70%"]
2428
2477
  },
2429
2478
  pressed: {
2430
2479
  bg: ["100", "900"],
2431
2480
  fg: ["800", "200"],
2432
- icon: ["800/0.7", "200/0.7"]
2481
+ icon: ["800 70%", "200 70%"]
2433
2482
  },
2434
2483
  selected: {
2435
2484
  bg: ["100", "900"],
2436
2485
  fg: ["800", "200"],
2437
- icon: ["800/0.7", "200/0.7"]
2486
+ icon: ["800 60%", "200 60%"]
2438
2487
  },
2439
2488
  disabled: {
2440
2489
  _hue: "gray",
2490
+ badge: {
2491
+ "*": {
2492
+ _hue: "gray",
2493
+ bg: ["50", "950"],
2494
+ fg: ["gray/200", "gray/800"],
2495
+ dot: ["gray/200", "gray/800"],
2496
+ icon: ["gray/200", "gray/800"]
2497
+ }
2498
+ },
2441
2499
  fg: ["200", "800"],
2442
2500
  muted: {
2443
- fg: ["200/0.6", "900/0.6"]
2501
+ fg: ["200", "800"]
2444
2502
  },
2445
2503
  accent: {
2446
- fg: ["200/0.6", "900/0.6"]
2504
+ fg: ["200", "800"]
2505
+ },
2506
+ kbd: {
2507
+ bg: ["white", "black"],
2508
+ fg: ["200", "800"],
2509
+ border: ["100", "900"]
2447
2510
  },
2448
2511
  link: {
2449
- fg: ["200/0.6", "900/0.6"]
2512
+ fg: ["200", "800"]
2450
2513
  },
2451
2514
  code: {
2452
- bg: ["50/0.5", "950/0.5"],
2453
- fg: ["200/0.6", "900/0.6"]
2515
+ bg: ["50", "950"],
2516
+ fg: ["200", "800"]
2454
2517
  }
2455
2518
  }
2456
2519
  }
@@ -2466,14 +2529,14 @@ const defaultColorTokens = {
2466
2529
  muted: {
2467
2530
  bg: ["50", "950"]
2468
2531
  },
2469
- placeholder: ["400", "600/0.5"]
2532
+ placeholder: ["400", "600 50%"]
2470
2533
  },
2471
2534
  hovered: {
2472
- border: ["300", "800"]
2535
+ border: ["300", "700"]
2473
2536
  },
2474
2537
  readOnly: {
2475
- border: ["200/0", "900/0"],
2476
- bg: ["100", "950"],
2538
+ bg: ["50", "950"],
2539
+ border: ["200", "800"],
2477
2540
  fg: ["800", "200"]
2478
2541
  },
2479
2542
  disabled: {
@@ -2494,16 +2557,21 @@ const defaultColorTokens = {
2494
2557
  _blend: ["multiply", "screen"],
2495
2558
  bg: ["white", "black"],
2496
2559
  fg: ["800", "200"],
2497
- icon: ["700/0.7", "300/0.7"],
2560
+ icon: ["700 70%", "300 70%"],
2498
2561
  avatar: {
2499
2562
  "*": {
2500
2563
  _blend: ["screen", "multiply"],
2501
2564
  bg: ["500", "400"],
2502
2565
  fg: ["white", "black"]
2503
2566
  }
2504
- // yellow: {bg: ['600', '400']},
2505
- // green: {bg: ['600', '400']},
2506
- // cyan: {bg: ['600', '400']},
2567
+ },
2568
+ badge: {
2569
+ "*": {
2570
+ bg: ["100", "900"],
2571
+ fg: ["600", "400"],
2572
+ dot: ["500", "500"],
2573
+ icon: ["500", "500"]
2574
+ }
2507
2575
  },
2508
2576
  border: ["200", "800"],
2509
2577
  muted: {
@@ -2513,31 +2581,21 @@ const defaultColorTokens = {
2513
2581
  accent: {
2514
2582
  fg: ["purple/600", "purple/400"]
2515
2583
  },
2584
+ kbd: {
2585
+ bg: ["white", "black"],
2586
+ fg: ["600", "400"],
2587
+ border: ["200", "800"]
2588
+ },
2516
2589
  link: {
2517
2590
  fg: ["blue/700", "blue/300"]
2518
2591
  },
2519
2592
  code: {
2520
- bg: ["100", "950"],
2593
+ bg: ["50", "950"],
2521
2594
  fg: ["700", "300"]
2522
2595
  },
2523
2596
  skeleton: {
2524
2597
  from: ["100", "900"],
2525
- to: ["100/0.5", "900/0.5"]
2526
- },
2527
- badge: {
2528
- "*": {
2529
- // _blend: ['multiply', 'screen'],
2530
- bg: ["100", "900"],
2531
- fg: ["600", "200"],
2532
- dot: ["300", "700"],
2533
- icon: ["600", "400"]
2534
- }
2535
- },
2536
- kbd: {
2537
- // _blend: ['multiply', 'screen'],
2538
- bg: ["white", "black"],
2539
- fg: ["600", "400"],
2540
- border: ["200", "800"]
2598
+ to: ["100 50%", "900 50%"]
2541
2599
  }
2542
2600
  },
2543
2601
  hovered: {
@@ -2557,22 +2615,18 @@ const defaultColorTokens = {
2557
2615
  bg: ["white", "black"],
2558
2616
  fg: ["black", "white"]
2559
2617
  }
2560
- // magenta: {_hue: 'green'},
2561
- // yellow: {bg: ['600', '400']},
2562
- // green: {bg: ['600', '400']},
2563
- // cyan: {bg: ['600', '400']},
2564
2618
  },
2565
2619
  badge: {
2566
2620
  "*": {
2567
- // _blend: ['multiply', 'screen'],
2568
- // _blend: ['screen', 'multiply'],
2569
2621
  bg: ["700", "300"],
2570
- fg: ["white", "black"]
2622
+ fg: ["white", "black"],
2623
+ dot: ["300", "700"],
2624
+ icon: ["300", "700"]
2571
2625
  }
2572
2626
  },
2573
- border: ["500/0.2", "400/0.2"],
2627
+ border: ["500 20%", "400 20%"],
2574
2628
  muted: {
2575
- bg: ["900", "50"],
2629
+ bg: ["950", "50"],
2576
2630
  fg: ["200", "800"]
2577
2631
  },
2578
2632
  accent: {
@@ -2587,88 +2641,78 @@ const defaultColorTokens = {
2587
2641
  fg: ["blue/200", "blue/800"]
2588
2642
  },
2589
2643
  code: {
2590
- bg: ["500/0.2", "400/0.2"],
2591
- fg: ["200", "700"]
2644
+ bg: ["500 20%", "400 20%"],
2645
+ fg: ["300", "700"]
2592
2646
  },
2593
2647
  skeleton: {
2594
2648
  from: ["900", "100"],
2595
- to: ["900/0.5", "100/0.5"]
2649
+ to: ["900 50%", "100 50%"]
2596
2650
  }
2597
- // badge: {
2598
- // '*': {
2599
- // _blend: ['multiply', 'screen'],
2600
- // bg: ['900', '100'],
2601
- // fg: ['white', 'black'],
2602
- // dot: ['700', '300'],
2603
- // icon: ['400', '600'],
2604
- // },
2605
- // },
2606
2651
  },
2607
2652
  disabled: {
2608
2653
  fg: ["200", "800"],
2609
2654
  icon: ["200", "800"],
2610
2655
  muted: {
2611
- fg: ["200", "800/0.5"]
2656
+ fg: ["200", "800"]
2612
2657
  },
2613
2658
  accent: {
2614
- fg: ["purple/200", "purple/800/0.5"]
2659
+ fg: ["purple/200", "purple/800"]
2615
2660
  },
2616
2661
  link: {
2617
- fg: ["blue/200", "blue/800/0.5"]
2662
+ fg: ["blue/200", "blue/800"]
2618
2663
  },
2619
2664
  code: {
2620
- bg: ["100", "950/0.5"],
2621
- fg: ["200", "800/0.5"]
2665
+ bg: ["50", "950"],
2666
+ fg: ["200", "800"]
2622
2667
  }
2623
2668
  }
2624
2669
  },
2625
2670
  default: {
2626
2671
  selected: {
2627
2672
  _hue: "blue"
2628
- // bg: ['500', '400'],
2629
2673
  }
2630
2674
  },
2631
2675
  critical: {
2632
2676
  disabled: {
2633
- bg: ["50/0.5", "950/0.5"]
2677
+ bg: ["50 50%", "950 50%"]
2634
2678
  }
2635
2679
  }
2636
2680
  },
2637
2681
  syntax: {
2638
- atrule: ["purple/700", "purple/400"],
2639
- attrName: ["green/700", "green/400"],
2640
- attrValue: ["yellow/700", "yellow/400"],
2641
- attribute: ["yellow/700", "yellow/400"],
2642
- boolean: ["purple/700", "purple/400"],
2643
- builtin: ["purple/700", "purple/400"],
2644
- cdata: ["yellow/700", "yellow/400"],
2645
- char: ["yellow/700", "yellow/400"],
2646
- class: ["orange/700", "orange/400"],
2647
- className: ["cyan/700", "cyan/400"],
2648
- comment: ["gray/700/0.5", "gray/400/0.5"],
2649
- constant: ["purple/700", "purple/400"],
2650
- deleted: ["red/700", "red/400"],
2651
- entity: ["red/700", "red/400"],
2652
- function: ["green/700", "green/400"],
2653
- hexcode: ["blue/700", "blue/400"],
2654
- id: ["purple/700", "purple/400"],
2655
- important: ["purple/700", "purple/400"],
2656
- inserted: ["yellow/700", "yellow/400"],
2657
- keyword: ["magenta/700", "magenta/400"],
2658
- number: ["purple/700", "purple/400"],
2659
- operator: ["magenta/700", "magenta/400"],
2660
- property: ["blue/700", "blue/400"],
2661
- pseudoClass: ["yellow/700", "yellow/400"],
2662
- pseudoElement: ["yellow/700", "yellow/400"],
2663
- punctuation: ["gray/700", "gray/400"],
2664
- regex: ["blue/700", "blue/400"],
2665
- selector: ["red/700", "red/400"],
2666
- string: ["yellow/700", "yellow/400"],
2667
- symbol: ["purple/700", "purple/400"],
2668
- tag: ["red/700", "red/400"],
2669
- unit: ["orange/700", "orange/400"],
2670
- url: ["red/700", "red/400"],
2671
- variable: ["red/700", "red/400"]
2682
+ atrule: ["purple/600", "purple/400"],
2683
+ attrName: ["green/600", "green/400"],
2684
+ attrValue: ["yellow/600", "yellow/400"],
2685
+ attribute: ["yellow/600", "yellow/400"],
2686
+ boolean: ["purple/600", "purple/400"],
2687
+ builtin: ["purple/600", "purple/400"],
2688
+ cdata: ["yellow/600", "yellow/400"],
2689
+ char: ["yellow/600", "yellow/400"],
2690
+ class: ["orange/600", "orange/400"],
2691
+ className: ["cyan/600", "cyan/400"],
2692
+ comment: ["gray/400", "gray/600"],
2693
+ constant: ["purple/600", "purple/400"],
2694
+ deleted: ["red/600", "red/400"],
2695
+ entity: ["red/600", "red/400"],
2696
+ function: ["green/600", "green/400"],
2697
+ hexcode: ["blue/600", "blue/400"],
2698
+ id: ["purple/600", "purple/400"],
2699
+ important: ["purple/600", "purple/400"],
2700
+ inserted: ["yellow/600", "yellow/400"],
2701
+ keyword: ["magenta/600", "magenta/400"],
2702
+ number: ["purple/600", "purple/400"],
2703
+ operator: ["magenta/600", "magenta/400"],
2704
+ property: ["blue/600", "blue/400"],
2705
+ pseudoClass: ["yellow/600", "yellow/400"],
2706
+ pseudoElement: ["yellow/600", "yellow/400"],
2707
+ punctuation: ["gray/600", "gray/400"],
2708
+ regex: ["blue/600", "blue/400"],
2709
+ selector: ["red/600", "red/400"],
2710
+ string: ["yellow/600", "yellow/400"],
2711
+ symbol: ["purple/600", "purple/400"],
2712
+ tag: ["red/600", "red/400"],
2713
+ unit: ["orange/600", "orange/400"],
2714
+ url: ["red/600", "red/400"],
2715
+ variable: ["red/600", "red/400"]
2672
2716
  }
2673
2717
  };
2674
2718
  function isRecord(value) {
@@ -3807,8 +3851,13 @@ function renderColorValue(str, options) {
3807
3851
  };
3808
3852
  try {
3809
3853
  hex = mixThemeColor(hex, mixOptions);
3854
+ if (bg && node.mix !== void 0) {
3855
+ const from = hexToRgb(bg);
3856
+ const to = hexToRgb(hex);
3857
+ hex = rgbToHex(mix(from, to, node.mix));
3858
+ }
3810
3859
  } catch (err) {
3811
- console.log("could not blend", hex, mixOptions);
3860
+ console.warn("could not blend", hex, mixOptions);
3812
3861
  throw err;
3813
3862
  }
3814
3863
  if (hex === "#aN") {
@@ -4060,10 +4109,9 @@ function renderThemeColorBadgeColor(value, options) {
4060
4109
  colorPalette
4061
4110
  };
4062
4111
  return {
4063
- // _blend: blendMode,
4064
4112
  bg,
4065
- fg: renderColorValue(value.fg, colorOptions),
4066
4113
  dot: renderColorValue(value.dot, colorOptions),
4114
+ fg: renderColorValue(value.fg, colorOptions),
4067
4115
  icon: renderColorValue(value.icon, colorOptions)
4068
4116
  };
4069
4117
  }
@@ -4122,7 +4170,7 @@ function renderThemeColorState(value, options) {
4122
4170
  blendMode
4123
4171
  }),
4124
4172
  badge: renderThemeColorBadge(value.badge, {
4125
- baseBg,
4173
+ baseBg: bg,
4126
4174
  colorPalette,
4127
4175
  blendMode
4128
4176
  }),
@@ -4330,6 +4378,5 @@ function _setCachedTheme(rootTheme, scheme, tone, theme) {
4330
4378
  const toneCache = schemeCache.get(tone);
4331
4379
  toneCache.set(rootTheme, theme);
4332
4380
  }
4333
- const defaultTheme = buildTheme();
4334
- export { COLOR_CONFIG_AVATAR_COLORS, COLOR_CONFIG_BLEND_KEYS, COLOR_CONFIG_CARD_KEYS, COLOR_CONFIG_CARD_TONES, COLOR_CONFIG_INPUT_MODES, COLOR_CONFIG_INPUT_STATES, COLOR_CONFIG_STATES, COLOR_CONFIG_STATE_KEYS, COLOR_CONFIG_STATE_TONES, THEME_COLOR_AVATAR_COLORS, THEME_COLOR_BLEND_MODES, THEME_COLOR_BUTTON_MODES, THEME_COLOR_CARD_TONES, THEME_COLOR_INPUT_MODES, THEME_COLOR_INPUT_STATES, THEME_COLOR_STATES, THEME_COLOR_STATE_TONES, buildTheme, createColorTheme, defaultTheme, getContrastRatio, getScopedTheme, getTheme_v2, hexToRgb, hslToRgb, isColorBlendModeValue, isColorButtonMode, isColorConfigBaseKey, isColorConfigBaseTone, isColorConfigBlendKey, isColorConfigStateKey, isColorConfigStateTone, isColorHueKey, isColorOpacityValue, isColorTintKey, isColorTokenValue, isColorValue, is_v0, is_v2, mix, multiply, parseColor, parseTokenKey, parseTokenValue, rgbToHex, rgbToHsl, rgba, rgbaToRGBA, screen, v0_v2, v2_v0 };
4381
+ export { COLOR_CONFIG_AVATAR_COLORS, COLOR_CONFIG_BLEND_KEYS, COLOR_CONFIG_CARD_KEYS, COLOR_CONFIG_CARD_TONES, COLOR_CONFIG_INPUT_MODES, COLOR_CONFIG_INPUT_STATES, COLOR_CONFIG_STATES, COLOR_CONFIG_STATE_KEYS, COLOR_CONFIG_STATE_TONES, THEME_COLOR_AVATAR_COLORS, THEME_COLOR_BLEND_MODES, THEME_COLOR_BUTTON_MODES, THEME_COLOR_CARD_TONES, THEME_COLOR_INPUT_MODES, THEME_COLOR_INPUT_STATES, THEME_COLOR_SCHEMES, THEME_COLOR_STATES, THEME_COLOR_STATE_TONES, buildTheme, createColorTheme, getContrastRatio, getScopedTheme, getTheme_v2, hexToRgb, hslToRgb, isColorBlendModeValue, isColorButtonMode, isColorConfigBaseKey, isColorConfigBaseTone, isColorConfigBlendKey, isColorConfigStateKey, isColorConfigStateTone, isColorHueKey, isColorOpacityValue, isColorTintKey, isColorTokenValue, isColorValue, is_v0, is_v2, mix, multiply, parseColor, parseTokenKey, parseTokenValue, rgbToHex, rgbToHsl, rgba, rgbaToRGBA, screen, v0_v2, v2_v0 };
4335
4382
  //# sourceMappingURL=theme.esm.js.map