@sanity/ui 3.0.0-static.1 → 3.0.0-static.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 (1215) hide show
  1. package/LICENSE +1 -1
  2. package/bin/ui.js +0 -1
  3. package/dist/_chunks-cjs/_visual-editing.js +3138 -0
  4. package/dist/_chunks-cjs/_visual-editing.js.map +1 -0
  5. package/dist/_chunks-cjs/buildCommand.js +14 -3524
  6. package/dist/_chunks-cjs/buildCommand.js.map +1 -1
  7. package/dist/_chunks-cjs/refractor.js +27 -0
  8. package/dist/_chunks-cjs/refractor.js.map +1 -0
  9. package/dist/_chunks-es/_visual-editing.mjs +3145 -0
  10. package/dist/_chunks-es/_visual-editing.mjs.map +1 -0
  11. package/dist/_chunks-es/refractor.mjs +26 -0
  12. package/dist/_chunks-es/refractor.mjs.map +1 -0
  13. package/dist/_visual-editing.d.mts +811 -0
  14. package/dist/_visual-editing.d.ts +811 -0
  15. package/dist/_visual-editing.js +31 -0
  16. package/dist/_visual-editing.js.map +1 -0
  17. package/dist/_visual-editing.mjs +31 -0
  18. package/dist/_visual-editing.mjs.map +1 -0
  19. package/dist/cli.js +337 -5
  20. package/dist/cli.js.map +1 -1
  21. package/dist/css.d.mts +866 -455
  22. package/dist/css.d.ts +866 -455
  23. package/dist/css.js +4313 -3229
  24. package/dist/css.js.map +1 -1
  25. package/dist/css.mjs +4299 -3214
  26. package/dist/css.mjs.map +1 -1
  27. package/dist/index.d.mts +461 -531
  28. package/dist/index.d.ts +461 -531
  29. package/dist/index.js +727 -4618
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +623 -4523
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/sanity-palette.css +1 -0
  34. package/dist/sanity-theme.css +1 -25
  35. package/dist/system.css +23230 -3377
  36. package/dist/theme.d.mts +399 -112
  37. package/dist/theme.d.ts +399 -112
  38. package/dist/theme.js +1379 -2380
  39. package/dist/theme.js.map +1 -1
  40. package/dist/theme.mjs +1423 -2424
  41. package/dist/theme.mjs.map +1 -1
  42. package/exports/_visual-editing.ts +31 -0
  43. package/exports/index.ts +1 -1
  44. package/package.json +93 -82
  45. package/src/cli/buildCommand.ts +48 -0
  46. package/src/cli/index.ts +38 -0
  47. package/src/css/_comp.test.ts +7 -0
  48. package/src/css/_comp.ts +11 -0
  49. package/src/css/_mergeStyles.ts +31 -0
  50. package/src/css/_resp.ts +16 -6
  51. package/src/css/_responsiveRule.ts +38 -0
  52. package/src/css/aspects/border/border.style.ts +13 -0
  53. package/src/css/aspects/border/border.ts +14 -0
  54. package/src/css/aspects/display/display.style.ts +34 -0
  55. package/src/css/aspects/display/display.ts +7 -0
  56. package/src/css/aspects/display/index.ts +2 -0
  57. package/src/css/aspects/display/types.ts +17 -0
  58. package/src/css/aspects/flex/flex.style.ts +30 -0
  59. package/src/css/aspects/flex/flex.ts +13 -0
  60. package/src/css/aspects/flex/flexAlign.style.ts +12 -0
  61. package/src/css/aspects/flex/flexDirection.style.ts +11 -0
  62. package/src/css/aspects/flex/flexJustify.style.ts +13 -0
  63. package/src/css/aspects/flex/flexWrap.style.ts +10 -0
  64. package/src/css/aspects/flexItem/flex.style.ts +22 -0
  65. package/src/css/aspects/flexItem/flexItem.ts +8 -0
  66. package/src/css/aspects/flexItem/types.ts +27 -0
  67. package/src/css/aspects/font/font.style.ts +151 -0
  68. package/src/css/aspects/font/font.ts +12 -0
  69. package/src/css/aspects/gap/gap.style.ts +21 -0
  70. package/src/css/aspects/gap/gap.ts +8 -0
  71. package/src/css/aspects/gap/types.ts +10 -0
  72. package/src/css/aspects/grid/grid.ts +13 -0
  73. package/src/css/aspects/grid/gridAutoColumns.style.ts +11 -0
  74. package/src/css/aspects/grid/gridAutoFlow.style.ts +11 -0
  75. package/src/css/aspects/grid/gridAutoRows.style.ts +11 -0
  76. package/src/css/aspects/grid/gridColumns.style.ts +18 -0
  77. package/src/css/aspects/grid/gridRows.style.ts +18 -0
  78. package/src/css/aspects/grid/types.ts +29 -0
  79. package/src/css/aspects/gridItem/gridColumn.style.ts +20 -0
  80. package/src/css/aspects/gridItem/gridColumnEnd.style.ts +20 -0
  81. package/src/css/aspects/gridItem/gridColumnStart.style.ts +20 -0
  82. package/src/css/aspects/gridItem/gridItem.ts +15 -0
  83. package/src/css/aspects/gridItem/gridRow.style.ts +20 -0
  84. package/src/css/aspects/gridItem/gridRowEnd.style.ts +20 -0
  85. package/src/css/aspects/gridItem/gridRowStart.style.ts +20 -0
  86. package/src/css/aspects/height/height.style.ts +9 -0
  87. package/src/css/aspects/height/height.ts +17 -0
  88. package/src/css/aspects/height/index.ts +1 -0
  89. package/src/css/aspects/index.ts +21 -0
  90. package/src/css/aspects/inset/index.ts +2 -0
  91. package/src/css/aspects/inset/inset.style.ts +12 -0
  92. package/src/css/aspects/inset/inset.ts +13 -0
  93. package/src/css/aspects/inset/types.ts +13 -0
  94. package/src/css/aspects/margin/margin.style.ts +46 -0
  95. package/src/css/aspects/margin/margin.ts +15 -0
  96. package/src/css/aspects/maxWidth/maxWidth.style.ts +16 -0
  97. package/src/css/aspects/maxWidth/types.ts +7 -0
  98. package/src/css/aspects/minWidth/index.ts +2 -0
  99. package/src/css/aspects/minWidth/minWidth.style.ts +13 -0
  100. package/src/css/aspects/minWidth/minWidth.ts +6 -0
  101. package/src/css/aspects/minWidth/types.ts +7 -0
  102. package/src/css/aspects/outline/outline.style.ts +9 -0
  103. package/src/css/aspects/overflow/overflow.style.ts +11 -0
  104. package/src/css/aspects/overflow/overflow.ts +11 -0
  105. package/src/css/aspects/padding/padding.style.ts +46 -0
  106. package/src/css/aspects/padding/padding.ts +15 -0
  107. package/src/css/aspects/padding/types.ts +14 -0
  108. package/src/css/aspects/pointerEvents/pointerEvents.style.ts +13 -0
  109. package/src/css/aspects/pointerEvents/pointerEvents.ts +6 -0
  110. package/src/css/aspects/position/position.style.ts +12 -0
  111. package/src/css/aspects/position/position.ts +7 -0
  112. package/src/css/aspects/position/types.ts +9 -0
  113. package/src/css/aspects/radius/radius.style.ts +16 -0
  114. package/src/css/aspects/radius/radius.ts +8 -0
  115. package/src/css/aspects/radius/types.ts +8 -0
  116. package/src/css/aspects/shadow/index.ts +2 -0
  117. package/src/css/aspects/shadow/shadow.style.ts +49 -0
  118. package/src/css/aspects/shadow/shadow.ts +7 -0
  119. package/src/css/aspects/shadow/types.ts +8 -0
  120. package/src/css/aspects/textOverflow/index.ts +2 -0
  121. package/src/css/aspects/textOverflow/textOverflow.style.ts +21 -0
  122. package/src/css/aspects/textOverflow/textOverflow.ts +6 -0
  123. package/src/css/aspects/textOverflow/types.ts +8 -0
  124. package/src/css/aspects/width/index.ts +2 -0
  125. package/src/css/aspects/width/rules.ts +8 -0
  126. package/src/css/aspects/width/types.ts +9 -0
  127. package/src/css/aspects/width/width.style.ts +11 -0
  128. package/src/css/compile/compilePalette.ts +27 -0
  129. package/src/css/compile/compileRule.ts +50 -11
  130. package/src/css/compile/compileRules.test.ts +36 -0
  131. package/src/css/compile/compileRules.ts +17 -30
  132. package/src/css/compile/compileStyle.ts +148 -0
  133. package/src/css/compile/compileSystem.ts +6 -3
  134. package/src/css/compile/compileTheme.ts +8 -505
  135. package/src/css/compile/compileTheme_v3.ts +401 -0
  136. package/src/css/compile/types.ts +6 -0
  137. package/src/css/components/breadcrumbs/breadcrumbs.style.ts +9 -0
  138. package/src/css/components/breadcrumbs/breadcrumbs.ts +3 -3
  139. package/src/css/components/dialog/dialog.style.ts +79 -0
  140. package/src/css/components/dialog/dialog.ts +30 -0
  141. package/src/css/components/dialog/index.ts +1 -1
  142. package/src/css/components/dialog/rules.ts +4 -1
  143. package/src/css/components/menu/menu.style.ts +17 -0
  144. package/src/css/components/menu/menu.ts +7 -3
  145. package/src/css/components/menu/rules.ts +6 -1
  146. package/src/css/components/skeleton/rules.ts +29 -22
  147. package/src/css/components/skeleton/skeleton.style.ts +96 -0
  148. package/src/css/components/skeleton/skeleton.ts +12 -12
  149. package/src/css/components/skeleton/types.ts +3 -1
  150. package/src/css/components/toast/index.ts +1 -0
  151. package/src/css/components/toast/rules.ts +18 -68
  152. package/src/css/components/toast/toast.style.ts +20 -0
  153. package/src/css/components/toast/toast.ts +21 -0
  154. package/src/css/components/tree/rules.ts +3 -2
  155. package/src/css/components/tree/tree.style.ts +55 -0
  156. package/src/css/components/tree/tree.ts +3 -3
  157. package/src/css/composeClassNames.ts +16 -2
  158. package/src/css/constants.ts +1 -0
  159. package/src/css/index.ts +13 -23
  160. package/src/css/primitives/_arrow/_arrow.style.ts +73 -0
  161. package/src/css/primitives/_arrow/_arrow.ts +14 -0
  162. package/src/css/primitives/_arrow/index.ts +1 -0
  163. package/src/css/primitives/_input/__workshop__/customInput.tsx +16 -0
  164. package/src/css/primitives/_input/__workshop__/index.ts +14 -0
  165. package/src/css/primitives/_input/_input.style.ts +162 -0
  166. package/src/css/primitives/_input/index.ts +2 -0
  167. package/src/css/primitives/_input/input.ts +25 -0
  168. package/src/css/primitives/_input/types.ts +12 -0
  169. package/src/css/primitives/_selectable/__style.ts +117 -0
  170. package/src/css/primitives/_selectable/_contants.ts +11 -0
  171. package/src/css/primitives/_selectable/_selectable.style.ts +132 -0
  172. package/src/css/primitives/_selectable/selectable.ts +9 -0
  173. package/src/css/primitives/_selectable/types.ts +8 -0
  174. package/src/css/primitives/avatar/avatar.style.ts +175 -0
  175. package/src/css/primitives/avatar/avatar.ts +13 -18
  176. package/src/css/primitives/avatar/rules.ts +85 -99
  177. package/src/css/primitives/avatar/types.ts +1 -2
  178. package/src/css/primitives/badge/badge.style.ts +22 -0
  179. package/src/css/primitives/badge/badge.ts +4 -4
  180. package/src/css/primitives/badge/types.ts +2 -2
  181. package/src/css/primitives/box/box.style.ts +31 -0
  182. package/src/css/primitives/box/box.ts +31 -17
  183. package/src/css/primitives/box/types.ts +28 -25
  184. package/src/css/primitives/button/_constants.ts +17 -0
  185. package/src/css/primitives/button/button.style.ts +201 -0
  186. package/src/css/primitives/button/button.ts +29 -14
  187. package/src/css/primitives/button/rules.ts +284 -40
  188. package/src/css/primitives/card/_constants.ts +13 -0
  189. package/src/css/primitives/card/card.style.ts +270 -0
  190. package/src/css/primitives/card/card.ts +9 -16
  191. package/src/css/primitives/card/index.ts +1 -0
  192. package/src/css/primitives/card/types.ts +10 -0
  193. package/src/css/primitives/checkbox/checkbox.style.ts +154 -0
  194. package/src/css/primitives/checkbox/checkbox.ts +5 -5
  195. package/src/css/primitives/checkbox/rules.ts +31 -15
  196. package/src/css/primitives/code/code.style.ts +62 -0
  197. package/src/css/primitives/code/code.ts +4 -4
  198. package/src/css/primitives/code/rules.ts +27 -2
  199. package/src/css/primitives/code/types.ts +1 -1
  200. package/src/css/primitives/container/container.style.ts +10 -0
  201. package/src/css/primitives/container/container.ts +4 -4
  202. package/src/css/primitives/container/types.ts +1 -0
  203. package/src/css/primitives/heading/heading.style.ts +47 -0
  204. package/src/css/primitives/heading/heading.ts +6 -5
  205. package/src/css/primitives/heading/rules.ts +77 -6
  206. package/src/css/primitives/heading/types.ts +2 -2
  207. package/src/css/primitives/kbd/kbd.style.ts +22 -0
  208. package/src/css/primitives/kbd/kbd.ts +4 -4
  209. package/src/css/primitives/kbd/rules.ts +5 -5
  210. package/src/css/primitives/kbd/types.ts +3 -1
  211. package/src/css/primitives/label/label.style.ts +48 -0
  212. package/src/css/primitives/label/label.ts +4 -4
  213. package/src/css/primitives/label/rules.ts +54 -2
  214. package/src/css/primitives/label/types.ts +1 -1
  215. package/src/css/primitives/popover/popover.style.ts +5 -0
  216. package/src/css/primitives/popover/popover.ts +7 -3
  217. package/src/css/primitives/radio/radio.style.ts +123 -0
  218. package/src/css/primitives/radio/radio.ts +3 -3
  219. package/src/css/primitives/radio/rules.ts +117 -1
  220. package/src/css/primitives/select/index.ts +1 -0
  221. package/src/css/primitives/select/rules.ts +18 -1
  222. package/src/css/primitives/select/select.style.ts +24 -0
  223. package/src/css/primitives/select/select.ts +9 -2
  224. package/src/css/primitives/select/types.ts +5 -0
  225. package/src/css/primitives/spinner/rules.ts +1 -0
  226. package/src/css/primitives/spinner/spinner.style.ts +22 -0
  227. package/src/css/primitives/spinner/spinner.ts +5 -5
  228. package/src/css/primitives/stack/stack.style.ts +9 -0
  229. package/src/css/primitives/stack/stack.ts +6 -0
  230. package/src/css/primitives/switch/rules.ts +264 -56
  231. package/src/css/primitives/switch/switch.style.ts +94 -0
  232. package/src/css/primitives/switch/switch.ts +19 -3
  233. package/src/css/primitives/text/rules.ts +93 -4
  234. package/src/css/primitives/text/text.style.ts +64 -0
  235. package/src/css/primitives/text/text.ts +5 -4
  236. package/src/css/primitives/text/types.ts +2 -2
  237. package/src/css/primitives/textArea/index.ts +1 -0
  238. package/src/css/primitives/textArea/rules.ts +3 -1
  239. package/src/css/primitives/textArea/textArea.style.ts +9 -0
  240. package/src/css/primitives/textArea/textArea.ts +5 -2
  241. package/src/css/primitives/textArea/types.ts +5 -0
  242. package/src/css/primitives/textInput/rules.ts +33 -130
  243. package/src/css/primitives/textInput/textInput.style.ts +167 -0
  244. package/src/css/primitives/textInput/textInput.ts +4 -11
  245. package/src/css/primitives/textInput/types.ts +8 -5
  246. package/src/css/primitives/token/rules.ts +37 -37
  247. package/src/css/primitives/token/token.style.ts +49 -0
  248. package/src/css/primitives/tooltip/rules.ts +2 -0
  249. package/src/css/primitives/tooltip/tooltip.style.ts +21 -0
  250. package/src/css/primitives/tooltip/tooltip.ts +5 -5
  251. package/src/css/scopeClassName.ts +6 -0
  252. package/src/css/system.style.ts +158 -0
  253. package/src/css/types.ts +604 -378
  254. package/src/css/util.ts +27 -0
  255. package/src/css/utils/srOnly/srOnly.style.ts +14 -0
  256. package/src/css/utils/srOnly/srOnly.ts +5 -0
  257. package/src/css/varNames.ts +395 -256
  258. package/src/css/vars.ts +373 -283
  259. package/src/theme/_constants.ts +26 -0
  260. package/src/theme/_types.ts +41 -0
  261. package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +1 -1
  262. package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +1 -1
  263. package/src/theme/build/_deprecated/color/button/createButtonModes.ts +1 -6
  264. package/src/theme/build/_deprecated/color/button/createButtonTones.ts +2 -2
  265. package/src/theme/build/_deprecated/color/card/createCardStates.ts +2 -2
  266. package/src/theme/build/_deprecated/color/factory.ts +8 -9
  267. package/src/theme/build/_deprecated/color/input/createInputModes.ts +1 -1
  268. package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
  269. package/src/theme/build/_deprecated/color/spot/createSpot.ts +1 -1
  270. package/src/theme/build/buildColorTheme.ts +62 -52
  271. package/src/theme/build/buildTheme.ts +8 -32
  272. package/src/theme/build/colorToken/colorToken.ts +1 -1
  273. package/src/theme/build/lib/color-fns/rgba.ts +4 -0
  274. package/src/theme/build/merge.ts +0 -2
  275. package/src/theme/build/mixThemeColor.ts +1 -1
  276. package/src/theme/build/renderColorTheme.ts +34 -37
  277. package/src/theme/build/renderColorValue.ts +4 -3
  278. package/src/theme/build/resolveColorTokens.ts +57 -120
  279. package/src/theme/config/helpers.ts +2 -2
  280. package/src/theme/config/system.ts +3 -2
  281. package/src/theme/config/tokens/color/types.ts +5 -18
  282. package/src/theme/config/tokens/parseTokenKey.ts +1 -1
  283. package/src/theme/config/tokens/parseTokenValue.ts +1 -1
  284. package/src/theme/config/tokens/types.ts +3 -2
  285. package/src/theme/config/types.ts +4 -4
  286. package/src/theme/defaults/colorTokens.ts +8 -6
  287. package/src/theme/defaults/config.ts +2 -2
  288. package/src/theme/defaults/fonts.ts +17 -16
  289. package/src/theme/getScopedTheme.ts +10 -4
  290. package/src/theme/index.ts +7 -1
  291. package/src/theme/palette/constants.ts +13 -0
  292. package/src/theme/palette/index.ts +2 -0
  293. package/src/theme/palette/types.ts +4 -0
  294. package/src/theme/types.ts +32 -0
  295. package/src/theme/v0/color/_generic.ts +35 -0
  296. package/src/theme/v0/color/_system.ts +17 -0
  297. package/src/theme/v0/color/color.ts +40 -0
  298. package/src/theme/v0/color/index.ts +11 -0
  299. package/src/theme/v0/color/input.ts +34 -0
  300. package/src/theme/v0/color/spot.ts +13 -0
  301. package/src/theme/v0/css.ts +8 -0
  302. package/src/theme/v0/font.ts +53 -0
  303. package/src/theme/v0/index.ts +10 -0
  304. package/src/theme/v0/theme.ts +72 -0
  305. package/src/theme/v2/avatar.ts +14 -0
  306. package/src/theme/v2/color/_constants.ts +45 -0
  307. package/src/theme/v2/color/_helpers.ts +24 -0
  308. package/src/theme/v2/color/_system.ts +40 -0
  309. package/src/theme/v2/color/badge.ts +16 -0
  310. package/src/theme/v2/color/color.ts +34 -0
  311. package/src/theme/v2/index.ts +4 -0
  312. package/src/theme/v2/input.ts +33 -0
  313. package/src/theme/v2/theme.ts +49 -0
  314. package/src/theme/v3/buildTheme_v3.test.ts +40 -0
  315. package/src/theme/v3/buildTheme_v3.ts +29 -0
  316. package/src/theme/v3/color/buildColor_v3.ts +198 -0
  317. package/src/theme/v3/color/card.ts +121 -0
  318. package/src/theme/v3/color/color.ts +98 -0
  319. package/src/theme/v3/color/element.ts +19 -0
  320. package/src/theme/v3/color/index.ts +7 -0
  321. package/src/theme/v3/color/parseColor.test.ts +79 -0
  322. package/src/theme/v3/color/parseColor.ts +167 -0
  323. package/src/theme/v3/color/renderColor.test.ts +19 -0
  324. package/src/theme/v3/color/renderColor.ts +33 -0
  325. package/src/theme/v3/color/token.ts +17 -0
  326. package/src/theme/v3/color/tokens.ts +5 -0
  327. package/src/theme/v3/defaults.ts +202 -0
  328. package/src/theme/v3/index.ts +6 -0
  329. package/src/theme/v3/merge.ts +22 -0
  330. package/src/theme/v3/resolveTokens.ts +204 -0
  331. package/src/theme/v3/tokens.ts +16 -0
  332. package/src/theme/v3/types.ts +45 -0
  333. package/src/theme/versioning/getTheme_v2.ts +2 -1
  334. package/src/theme/versioning/index.ts +0 -4
  335. package/src/theme/versioning/is_v0.ts +2 -1
  336. package/src/theme/versioning/is_v2.ts +2 -1
  337. package/src/theme/versioning/themeColor_v0_v2.ts +33 -5
  338. package/src/theme/versioning/themeColor_v2_v2_9.ts +49 -0
  339. package/src/theme/versioning/themeColor_v3_v2.ts +206 -0
  340. package/src/theme/versioning/v0_v2.ts +6 -1
  341. package/src/theme/versioning/v2_v0.ts +6 -6
  342. package/src/theme/versioning/v3_v2.ts +108 -0
  343. package/src/ui/StyleTags.tsx +24 -0
  344. package/src/ui/_compat/index.ts +9 -0
  345. package/src/ui/_compat/styles/_responsive.ts +19 -0
  346. package/src/ui/_compat/styles/index.ts +1 -0
  347. package/src/ui/_compat/theme/index.ts +5 -0
  348. package/src/ui/_compat/theme/theme.test.tsx +73 -0
  349. package/src/ui/_compat/theme/themeColorProvider.tsx +30 -0
  350. package/src/ui/_compat/theme/themeContext.ts +10 -0
  351. package/src/ui/_compat/theme/themeProvider.tsx +74 -0
  352. package/src/ui/_compat/theme/useRootTheme.ts +17 -0
  353. package/src/ui/_compat/theme/useTheme.ts +16 -0
  354. package/src/ui/_compat/types.ts +274 -0
  355. package/src/ui/components/autocomplete/__mocks__/apiStore.ts +49 -0
  356. package/src/ui/components/autocomplete/__workshop__/async.tsx +156 -0
  357. package/src/ui/components/autocomplete/__workshop__/constrainedHeight.tsx +131 -0
  358. package/src/ui/components/autocomplete/__workshop__/custom.tsx +90 -0
  359. package/src/ui/components/autocomplete/__workshop__/example.tsx +80 -0
  360. package/src/ui/components/autocomplete/__workshop__/fullscreen.tsx +293 -0
  361. package/src/ui/components/autocomplete/autocomplete.tsx +722 -0
  362. package/src/ui/components/autocomplete/autocompleteOption.tsx +45 -0
  363. package/src/ui/components/autocomplete/types.ts +108 -0
  364. package/src/ui/components/breadcrumbs/__workshop__/example.tsx +62 -0
  365. package/src/ui/components/breadcrumbs/breadcrumbs.tsx +127 -0
  366. package/src/ui/components/dialog/__workshop__/activate.tsx +134 -0
  367. package/src/ui/components/dialog/__workshop__/nested.tsx +72 -0
  368. package/src/ui/components/dialog/__workshop__/onScroll.tsx +39 -0
  369. package/src/ui/components/dialog/__workshop__/panes.tsx +82 -0
  370. package/src/ui/components/dialog/__workshop__/position.tsx +30 -0
  371. package/src/ui/components/dialog/__workshop__/props.tsx +77 -0
  372. package/src/ui/components/dialog/__workshop__/wrapped.tsx +76 -0
  373. package/src/ui/components/dialog/dialog.tsx +432 -0
  374. package/src/ui/components/dialog/dialogProvider.tsx +35 -0
  375. package/src/ui/components/dialog/useDialog.ts +11 -0
  376. package/src/ui/components/hotkeys/hotkeys.tsx +54 -0
  377. package/src/ui/components/menu/__workshop__/asComponent.tsx +45 -0
  378. package/src/ui/components/menu/__workshop__/avatarMenu.tsx +51 -0
  379. package/src/ui/components/menu/__workshop__/constrainedInBoundary.tsx +134 -0
  380. package/src/ui/components/menu/__workshop__/customSelectedState.tsx +39 -0
  381. package/src/ui/components/menu/__workshop__/menuButton.tsx +80 -0
  382. package/src/ui/components/menu/__workshop__/shouldFocus.tsx +47 -0
  383. package/src/ui/components/menu/__workshop__/tones.tsx +25 -0
  384. package/src/ui/components/menu/menu.test.tsx +128 -0
  385. package/src/ui/components/menu/menu.tsx +200 -0
  386. package/src/ui/components/menu/menuButton.tsx +275 -0
  387. package/src/ui/components/menu/menuContext.ts +31 -0
  388. package/src/ui/components/menu/menuDivider.tsx +22 -0
  389. package/src/ui/components/menu/menuGroup.tsx +228 -0
  390. package/src/ui/components/menu/menuItem.tsx +180 -0
  391. package/src/ui/components/menu/useMenu.ts +21 -0
  392. package/src/ui/components/menu/useMenuController.ts +241 -0
  393. package/src/ui/components/skeleton/__workshop__/delay.tsx +70 -0
  394. package/src/ui/components/skeleton/__workshop__/skeleton.tsx +64 -0
  395. package/src/ui/components/skeleton/skeleton.tsx +53 -0
  396. package/src/ui/components/skeleton/textSkeleton.tsx +132 -0
  397. package/src/ui/components/tab/tab.tsx +105 -0
  398. package/src/ui/components/tab/tabList.tsx +74 -0
  399. package/src/ui/components/tab/tabPanel.tsx +40 -0
  400. package/src/ui/components/toast/__workshop__/hook.tsx +71 -0
  401. package/src/ui/components/toast/__workshop__/toast.tsx +26 -0
  402. package/src/ui/components/toast/toast.test.tsx +101 -0
  403. package/src/ui/components/toast/toast.tsx +211 -0
  404. package/src/ui/components/toast/toastLayer.tsx +38 -0
  405. package/src/ui/components/toast/toastProvider.tsx +113 -0
  406. package/src/ui/components/toast/toastState.ts +6 -0
  407. package/src/ui/components/toast/types.ts +28 -0
  408. package/src/ui/components/toast/useToast.ts +25 -0
  409. package/src/ui/components/tree/__workshop__/basic.tsx +105 -0
  410. package/src/ui/components/tree/__workshop__/tabFromElement.tsx +84 -0
  411. package/src/ui/components/tree/tree.tsx +244 -0
  412. package/src/ui/components/tree/treeGroup.tsx +30 -0
  413. package/src/ui/components/tree/treeItem.tsx +220 -0
  414. package/src/ui/components/tree/useTree.ts +17 -0
  415. package/src/ui/constants.ts +85 -0
  416. package/src/ui/helpers/focus.ts +100 -0
  417. package/src/ui/helpers/index.ts +5 -0
  418. package/src/ui/helpers/props.ts +10 -0
  419. package/src/ui/hooks/useArrayProp.ts +29 -0
  420. package/src/ui/hooks/useClickOutside.test.tsx +482 -0
  421. package/src/ui/hooks/useClickOutside.ts +117 -0
  422. package/src/ui/hooks/useClickOutsideEvent.test.tsx +115 -0
  423. package/src/ui/hooks/useClickOutsideEvent.ts +73 -0
  424. package/src/ui/hooks/useDelayed.test.ts +68 -0
  425. package/src/ui/hooks/useDelayedState.ts +28 -0
  426. package/src/ui/hooks/useElementRect/__workshop__/example.tsx +32 -0
  427. package/src/ui/hooks/useElementSize.ts +19 -0
  428. package/src/ui/hooks/useForwardedRef.ts +19 -0
  429. package/src/ui/hooks/useGlobalKeyDown.ts +17 -0
  430. package/src/ui/hooks/useMatchMedia.ts +28 -0
  431. package/src/ui/hooks/useMediaIndex/useMediaIndex.test.tsx +36 -0
  432. package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +102 -0
  433. package/src/ui/hooks/usePrefersDark.hydration.test.tsx +56 -0
  434. package/src/ui/hooks/usePrefersDark.test.tsx +19 -0
  435. package/src/ui/hooks/usePrefersDark.ts +16 -0
  436. package/src/ui/hooks/usePrefersReducedMotion.hydration.test.tsx +56 -0
  437. package/src/ui/hooks/usePrefersReducedMotion.test.tsx +19 -0
  438. package/src/ui/hooks/usePrefersReducedMotion.ts +16 -0
  439. package/src/ui/index.ts +9 -0
  440. package/src/ui/lib/createGlobalScopedContext.ts +34 -0
  441. package/src/ui/lib/globalScope.ts +19 -0
  442. package/src/ui/primitives/_selectable/selectable.tsx +31 -0
  443. package/src/ui/primitives/avatar/__workshop__/asButton.tsx +14 -0
  444. package/src/ui/primitives/avatar/__workshop__/stack.tsx +25 -0
  445. package/src/ui/primitives/avatar/__workshop__/withinButton.tsx +63 -0
  446. package/src/ui/primitives/avatar/__workshop__/withinMenuItem.tsx +72 -0
  447. package/src/ui/primitives/avatar/avatar.tsx +158 -0
  448. package/src/ui/primitives/avatar/avatarCounter.tsx +62 -0
  449. package/src/ui/primitives/avatar/avatarStack.tsx +82 -0
  450. package/src/ui/primitives/avatar/types.ts +17 -0
  451. package/src/ui/primitives/badge/__workshop__/props.tsx +30 -0
  452. package/src/ui/primitives/badge/__workshop__/tones.tsx +21 -0
  453. package/src/ui/primitives/badge/badge.test.tsx +16 -0
  454. package/src/ui/primitives/badge/badge.tsx +64 -0
  455. package/src/ui/primitives/box/__workshop__/props.tsx +20 -0
  456. package/src/ui/primitives/box/box.tsx +162 -0
  457. package/src/ui/primitives/button/__workshop__/custom.tsx +50 -0
  458. package/src/ui/primitives/button/__workshop__/disabled.tsx +74 -0
  459. package/src/ui/primitives/button/__workshop__/props.tsx +58 -0
  460. package/src/ui/primitives/button/__workshop__/stacked.tsx +59 -0
  461. package/src/ui/primitives/button/button.test.tsx +44 -0
  462. package/src/ui/primitives/button/button.tsx +207 -0
  463. package/src/ui/primitives/card/__workshop__/allTones.tsx +27 -0
  464. package/src/ui/primitives/card/__workshop__/asButton.tsx +107 -0
  465. package/src/ui/primitives/card/__workshop__/asComponent.tsx +27 -0
  466. package/src/ui/primitives/card/__workshop__/checkered.tsx +26 -0
  467. package/src/ui/primitives/card/__workshop__/interactive.tsx +30 -0
  468. package/src/ui/primitives/card/__workshop__/listNavigation.tsx +80 -0
  469. package/src/ui/primitives/card/__workshop__/props.tsx +55 -0
  470. package/src/ui/primitives/card/__workshop__/selected.tsx +93 -0
  471. package/src/ui/primitives/card/card.tsx +118 -0
  472. package/src/ui/primitives/card/cardContext.ts +10 -0
  473. package/src/ui/primitives/card/cardProvider.tsx +19 -0
  474. package/src/ui/primitives/card/index.ts +4 -0
  475. package/src/ui/primitives/card/types.ts +27 -0
  476. package/src/ui/primitives/card/useCard.ts +7 -0
  477. package/src/ui/primitives/checkbox/__workshop__/tones.tsx +28 -0
  478. package/src/ui/primitives/checkbox/checkbox.tsx +74 -0
  479. package/src/ui/primitives/code/__workshop__/props.tsx +21 -0
  480. package/src/ui/primitives/code/code.tsx +49 -0
  481. package/src/ui/primitives/code/refractor.tsx +20 -0
  482. package/src/ui/primitives/container/__workshop__/example.tsx +20 -0
  483. package/src/ui/primitives/container/container.tsx +35 -0
  484. package/src/ui/primitives/flex/__workshop__/example.tsx +34 -0
  485. package/src/ui/primitives/flex/__workshop__/gap.tsx +25 -0
  486. package/src/ui/primitives/flex/flex.tsx +29 -0
  487. package/src/ui/primitives/grid/__workshop__/responsive.tsx +54 -0
  488. package/src/ui/primitives/grid/grid.tsx +30 -0
  489. package/src/ui/primitives/heading/__workshop__/opticalAlignment.tsx +54 -0
  490. package/src/ui/primitives/heading/__workshop__/plain.tsx +32 -0
  491. package/src/ui/primitives/heading/heading.tsx +62 -0
  492. package/src/ui/primitives/inline/__workshop__/plain.tsx +27 -0
  493. package/src/ui/primitives/inline/inline.tsx +50 -0
  494. package/src/ui/primitives/kbd/kbd.tsx +55 -0
  495. package/src/ui/primitives/label/__workshop__/opticalAlignment.tsx +54 -0
  496. package/src/ui/primitives/label/__workshop__/plain.tsx +37 -0
  497. package/src/ui/primitives/label/label.tsx +67 -0
  498. package/src/ui/primitives/popover/__workshop__/AlignedStory.tsx +77 -0
  499. package/src/ui/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +32 -0
  500. package/src/ui/primitives/popover/__workshop__/OpenOnMountStory.tsx +11 -0
  501. package/src/ui/primitives/popover/__workshop__/PlainStory.tsx +71 -0
  502. package/src/ui/primitives/popover/__workshop__/SidePanelStory.tsx +93 -0
  503. package/src/ui/primitives/popover/__workshop__/TestStory.tsx +98 -0
  504. package/src/ui/primitives/popover/floating-ui/size.ts +83 -0
  505. package/src/ui/primitives/popover/helpers.ts +32 -0
  506. package/src/ui/primitives/popover/popover.tsx +422 -0
  507. package/src/ui/primitives/popover/popoverCard.tsx +161 -0
  508. package/src/ui/primitives/radio/__workshop__/plain.tsx +28 -0
  509. package/src/ui/primitives/radio/radio.tsx +49 -0
  510. package/src/ui/primitives/select/__workshop__/plain.tsx +30 -0
  511. package/src/ui/primitives/select/__workshop__/readOnly.tsx +23 -0
  512. package/src/ui/primitives/select/select.tsx +85 -0
  513. package/src/ui/primitives/spinner/__workshop__/Props.tsx +16 -0
  514. package/src/ui/primitives/spinner/spinner.tsx +33 -0
  515. package/src/ui/primitives/stack/__workshop__/plain.tsx +32 -0
  516. package/src/ui/primitives/stack/index.ts +1 -0
  517. package/src/ui/primitives/stack/stack.tsx +45 -0
  518. package/src/ui/primitives/switch/switch.tsx +75 -0
  519. package/src/ui/primitives/text/__workshop__/colored.tsx +23 -0
  520. package/src/ui/primitives/text/__workshop__/example.tsx +39 -0
  521. package/src/ui/primitives/text/__workshop__/opticalAlignment.tsx +48 -0
  522. package/src/ui/primitives/text/text.tsx +64 -0
  523. package/src/ui/primitives/textArea/__workshop__/plain.tsx +50 -0
  524. package/src/ui/primitives/textArea/textArea.tsx +71 -0
  525. package/src/ui/primitives/textInput/__workshop__/index.ts +44 -0
  526. package/src/ui/primitives/textInput/__workshop__/plain.tsx +104 -0
  527. package/src/ui/primitives/textInput/__workshop__/readOnly.tsx +9 -0
  528. package/src/ui/primitives/textInput/__workshop__/tones.tsx +277 -0
  529. package/src/ui/primitives/textInput/__workshop__/typed.tsx +23 -0
  530. package/src/ui/primitives/textInput/textInput.tsx +286 -0
  531. package/src/ui/primitives/tooltip/__workshop__/customPortal.tsx +102 -0
  532. package/src/ui/primitives/tooltip/__workshop__/overflowingBoundary.tsx +74 -0
  533. package/src/ui/primitives/tooltip/__workshop__/props.tsx +111 -0
  534. package/src/ui/primitives/tooltip/__workshop__/resizableBoundary.tsx +86 -0
  535. package/src/ui/primitives/tooltip/tooltip.test.tsx +453 -0
  536. package/src/ui/primitives/tooltip/tooltip.tsx +466 -0
  537. package/src/ui/primitives/tooltip/tooltipCard.tsx +115 -0
  538. package/src/ui/primitives/tooltip/tooltipDelayGroup/index.ts +4 -0
  539. package/src/ui/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +55 -0
  540. package/src/ui/primitives/tooltip/tooltipDelayGroup/types.ts +10 -0
  541. package/src/ui/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +13 -0
  542. package/src/ui/primitives/types.ts +166 -0
  543. package/src/ui/types/box.ts +22 -0
  544. package/src/ui/types/button.ts +24 -0
  545. package/src/ui/types/flex.ts +27 -0
  546. package/src/ui/types/grid.ts +17 -0
  547. package/src/ui/types/gridItem.ts +32 -0
  548. package/src/ui/types/index.ts +15 -0
  549. package/src/ui/types/props.ts +18 -0
  550. package/src/ui/types/selectable.ts +7 -0
  551. package/src/ui/utils/arrow/arrow.tsx +59 -0
  552. package/src/ui/utils/boundaryElement/boundaryElement.test.tsx +100 -0
  553. package/src/ui/utils/boundaryElement/boundaryElementProvider.tsx +24 -0
  554. package/src/ui/utils/boundaryElement/index.ts +3 -0
  555. package/src/ui/utils/boundaryElement/useBoundaryElement.ts +26 -0
  556. package/src/ui/utils/conditionalWrapper/conditionalWrapper.tsx +23 -0
  557. package/src/ui/utils/elementQuery/elementQuery.tsx +53 -0
  558. package/src/ui/utils/errorBoundary.tsx +48 -0
  559. package/src/ui/utils/getElementRef.ts +26 -0
  560. package/src/ui/utils/layer/__workshop__/multipleRoots.tsx +49 -0
  561. package/src/ui/utils/layer/__workshop__/nested.tsx +98 -0
  562. package/src/ui/utils/layer/__workshop__/responsiveZOffset.tsx +13 -0
  563. package/src/ui/utils/layer/index.ts +4 -0
  564. package/src/ui/utils/layer/layer.test.tsx +108 -0
  565. package/src/ui/utils/layer/layer.tsx +112 -0
  566. package/src/ui/utils/layer/layerProvider.tsx +110 -0
  567. package/src/ui/utils/layer/useLayer.ts +26 -0
  568. package/src/ui/utils/portal/portal.test.tsx +103 -0
  569. package/src/ui/utils/portal/portal.ts +46 -0
  570. package/src/ui/utils/portal/portalProvider.tsx +79 -0
  571. package/src/ui/utils/portal/usePortal.ts +25 -0
  572. package/src/ui/utils/spanWithTextOverflow.tsx +10 -0
  573. package/src/ui/utils/srOnly/index.ts +1 -0
  574. package/src/ui/utils/srOnly/srOnly.tsx +35 -0
  575. package/src/ui/utils/virtualList/virtualList.tsx +189 -0
  576. package/dist/css.esm.js +0 -3794
  577. package/dist/css.esm.js.map +0 -1
  578. package/dist/index.esm.js +0 -5431
  579. package/dist/index.esm.js.map +0 -1
  580. package/dist/theme.esm.js +0 -4201
  581. package/dist/theme.esm.js.map +0 -1
  582. package/src/core/__workshop__/constants.ts +0 -305
  583. package/src/core/__workshop__/fontsPlugin.tsx +0 -76
  584. package/src/core/_compat/index.ts +0 -2
  585. package/src/core/_compat/styles/border/borderStyle.ts +0 -61
  586. package/src/core/_compat/styles/border/index.ts +0 -2
  587. package/src/core/_compat/styles/border/types.ts +0 -11
  588. package/src/core/_compat/styles/box/boxStyle.ts +0 -74
  589. package/src/core/_compat/styles/box/index.ts +0 -2
  590. package/src/core/_compat/styles/box/types.ts +0 -11
  591. package/src/core/_compat/styles/card/_cardColorStyle.ts +0 -101
  592. package/src/core/_compat/styles/card/index.ts +0 -1
  593. package/src/core/_compat/styles/flex/flexItemStyle.ts +0 -26
  594. package/src/core/_compat/styles/flex/flexStyle.ts +0 -69
  595. package/src/core/_compat/styles/flex/index.ts +0 -3
  596. package/src/core/_compat/styles/flex/types.ts +0 -24
  597. package/src/core/_compat/styles/focusRing/index.ts +0 -25
  598. package/src/core/_compat/styles/font/codeFontStyle.ts +0 -12
  599. package/src/core/_compat/styles/font/headingFontStyle.ts +0 -12
  600. package/src/core/_compat/styles/font/index.ts +0 -6
  601. package/src/core/_compat/styles/font/labelFontStyle.ts +0 -12
  602. package/src/core/_compat/styles/font/responsiveFont.ts +0 -101
  603. package/src/core/_compat/styles/font/textAlignStyle.ts +0 -18
  604. package/src/core/_compat/styles/font/textFontStyle.ts +0 -12
  605. package/src/core/_compat/styles/font/types.ts +0 -34
  606. package/src/core/_compat/styles/grid/gridItemStyle.ts +0 -81
  607. package/src/core/_compat/styles/grid/gridStyle.ts +0 -97
  608. package/src/core/_compat/styles/grid/index.ts +0 -3
  609. package/src/core/_compat/styles/grid/types.ts +0 -37
  610. package/src/core/_compat/styles/helpers.ts +0 -81
  611. package/src/core/_compat/styles/index.ts +0 -5
  612. package/src/core/_compat/styles/input/index.ts +0 -2
  613. package/src/core/_compat/styles/input/responsiveInputPaddingStyle.ts +0 -77
  614. package/src/core/_compat/styles/input/textInputStyle.ts +0 -263
  615. package/src/core/_compat/styles/internal.ts +0 -12
  616. package/src/core/_compat/styles/margin/index.ts +0 -2
  617. package/src/core/_compat/styles/margin/marginStyle.ts +0 -20
  618. package/src/core/_compat/styles/margin/marginsStyle.test.ts +0 -32
  619. package/src/core/_compat/styles/margin/types.ts +0 -9
  620. package/src/core/_compat/styles/padding/index.ts +0 -2
  621. package/src/core/_compat/styles/padding/paddingStyle.test.ts +0 -32
  622. package/src/core/_compat/styles/padding/paddingStyle.ts +0 -20
  623. package/src/core/_compat/styles/padding/types.ts +0 -12
  624. package/src/core/_compat/styles/radius/index.ts +0 -2
  625. package/src/core/_compat/styles/radius/radiusStyle.ts +0 -22
  626. package/src/core/_compat/styles/radius/types.ts +0 -8
  627. package/src/core/_compat/styles/shadow/index.ts +0 -2
  628. package/src/core/_compat/styles/shadow/shadowStyle.ts +0 -29
  629. package/src/core/_compat/styles/shadow/types.ts +0 -6
  630. package/src/core/_compat/styles/types.ts +0 -8
  631. package/src/core/_compat/types.ts +0 -264
  632. package/src/core/components/autocomplete/__mocks__/apiStore.ts +0 -49
  633. package/src/core/components/autocomplete/__workshop__/.eslintrc +0 -5
  634. package/src/core/components/autocomplete/__workshop__/async.tsx +0 -155
  635. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -136
  636. package/src/core/components/autocomplete/__workshop__/custom.tsx +0 -89
  637. package/src/core/components/autocomplete/__workshop__/example.tsx +0 -79
  638. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +0 -293
  639. package/src/core/components/autocomplete/autocomplete.tsx +0 -735
  640. package/src/core/components/autocomplete/autocompleteOption.tsx +0 -44
  641. package/src/core/components/autocomplete/types.ts +0 -108
  642. package/src/core/components/breadcrumbs/__workshop__/.eslintrc +0 -5
  643. package/src/core/components/breadcrumbs/__workshop__/example.tsx +0 -55
  644. package/src/core/components/breadcrumbs/breadcrumbs.tsx +0 -111
  645. package/src/core/components/dialog/__workshop__/.eslintrc +0 -5
  646. package/src/core/components/dialog/__workshop__/activate.tsx +0 -133
  647. package/src/core/components/dialog/__workshop__/nested.tsx +0 -72
  648. package/src/core/components/dialog/__workshop__/onScroll.tsx +0 -39
  649. package/src/core/components/dialog/__workshop__/panes.tsx +0 -81
  650. package/src/core/components/dialog/__workshop__/position.tsx +0 -29
  651. package/src/core/components/dialog/__workshop__/props.tsx +0 -76
  652. package/src/core/components/dialog/__workshop__/wrapped.tsx +0 -78
  653. package/src/core/components/dialog/dialog.tsx +0 -410
  654. package/src/core/components/dialog/dialogProvider.tsx +0 -34
  655. package/src/core/components/dialog/useDialog.ts +0 -10
  656. package/src/core/components/hotkeys/__workshop__/.eslintrc +0 -5
  657. package/src/core/components/hotkeys/hotkeys.tsx +0 -50
  658. package/src/core/components/menu/__workshop__/.eslintrc +0 -5
  659. package/src/core/components/menu/__workshop__/asComponent.tsx +0 -44
  660. package/src/core/components/menu/__workshop__/avatarMenu.tsx +0 -50
  661. package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +0 -133
  662. package/src/core/components/menu/__workshop__/customSelectedState.tsx +0 -38
  663. package/src/core/components/menu/__workshop__/menuButton.tsx +0 -79
  664. package/src/core/components/menu/__workshop__/shouldFocus.tsx +0 -46
  665. package/src/core/components/menu/__workshop__/tones.tsx +0 -25
  666. package/src/core/components/menu/menu.test.tsx +0 -129
  667. package/src/core/components/menu/menu.tsx +0 -173
  668. package/src/core/components/menu/menuButton.tsx +0 -289
  669. package/src/core/components/menu/menuContext.ts +0 -29
  670. package/src/core/components/menu/menuDivider.tsx +0 -16
  671. package/src/core/components/menu/menuGroup.tsx +0 -204
  672. package/src/core/components/menu/menuItem.tsx +0 -187
  673. package/src/core/components/menu/useMenu.ts +0 -20
  674. package/src/core/components/menu/useMenuController.ts +0 -230
  675. package/src/core/components/skeleton/__workshop__/.eslintrc +0 -5
  676. package/src/core/components/skeleton/__workshop__/delay.tsx +0 -69
  677. package/src/core/components/skeleton/__workshop__/skeleton.tsx +0 -63
  678. package/src/core/components/skeleton/skeleton.tsx +0 -52
  679. package/src/core/components/skeleton/textSkeleton.tsx +0 -146
  680. package/src/core/components/tab/__workshop__/.eslintrc +0 -5
  681. package/src/core/components/tab/tab.tsx +0 -98
  682. package/src/core/components/tab/tabList.tsx +0 -61
  683. package/src/core/components/tab/tabPanel.tsx +0 -39
  684. package/src/core/components/toast/__workshop__/.eslintrc +0 -5
  685. package/src/core/components/toast/__workshop__/hook.tsx +0 -71
  686. package/src/core/components/toast/__workshop__/toast.tsx +0 -25
  687. package/src/core/components/toast/toast.test.tsx +0 -102
  688. package/src/core/components/toast/toast.tsx +0 -122
  689. package/src/core/components/toast/toastProvider.tsx +0 -193
  690. package/src/core/components/toast/types.ts +0 -20
  691. package/src/core/components/toast/useToast.ts +0 -24
  692. package/src/core/components/tree/__workshop__/.eslintrc +0 -5
  693. package/src/core/components/tree/__workshop__/basic.tsx +0 -104
  694. package/src/core/components/tree/__workshop__/tabFromElement.tsx +0 -83
  695. package/src/core/components/tree/tree.tsx +0 -241
  696. package/src/core/components/tree/treeGroup.tsx +0 -32
  697. package/src/core/components/tree/treeItem.tsx +0 -213
  698. package/src/core/components/tree/useTree.ts +0 -16
  699. package/src/core/constants.ts +0 -57
  700. package/src/core/helpers/focus.ts +0 -100
  701. package/src/core/helpers/index.ts +0 -4
  702. package/src/core/hooks/useArrayProp.ts +0 -25
  703. package/src/core/hooks/useClickOutside.test.tsx +0 -483
  704. package/src/core/hooks/useClickOutside.ts +0 -116
  705. package/src/core/hooks/useClickOutsideEvent.test.tsx +0 -116
  706. package/src/core/hooks/useClickOutsideEvent.ts +0 -72
  707. package/src/core/hooks/useDelayed.test.ts +0 -67
  708. package/src/core/hooks/useDelayedState.ts +0 -29
  709. package/src/core/hooks/useElementRect/__workshop__/.eslintrc +0 -5
  710. package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -31
  711. package/src/core/hooks/useElementSize.ts +0 -18
  712. package/src/core/hooks/useForwardedRef.ts +0 -19
  713. package/src/core/hooks/useGlobalKeyDown.ts +0 -12
  714. package/src/core/hooks/useMatchMedia.ts +0 -46
  715. package/src/core/hooks/useMediaIndex/__workshop__/.eslintrc +0 -5
  716. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +0 -35
  717. package/src/core/hooks/useMediaIndex/useMediaIndex.ts +0 -101
  718. package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -57
  719. package/src/core/hooks/usePrefersDark.test.tsx +0 -18
  720. package/src/core/hooks/usePrefersDark.ts +0 -16
  721. package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -57
  722. package/src/core/hooks/usePrefersReducedMotion.test.tsx +0 -18
  723. package/src/core/hooks/usePrefersReducedMotion.ts +0 -16
  724. package/src/core/index.ts +0 -10
  725. package/src/core/lib/createGlobalScopedContext.ts +0 -33
  726. package/src/core/lib/globalScope.ts +0 -20
  727. package/src/core/lib/styled/elements.ts +0 -135
  728. package/src/core/lib/styled/index.ts +0 -2
  729. package/src/core/lib/styled/members.ts +0 -15
  730. package/src/core/lib/styled/styled.ts +0 -79
  731. package/src/core/primitives/_selectable/selectable.tsx +0 -27
  732. package/src/core/primitives/avatar/__workshop__/.eslintrc +0 -5
  733. package/src/core/primitives/avatar/__workshop__/asButton.tsx +0 -13
  734. package/src/core/primitives/avatar/__workshop__/stack.tsx +0 -24
  735. package/src/core/primitives/avatar/__workshop__/withinButton.tsx +0 -62
  736. package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -69
  737. package/src/core/primitives/avatar/avatar.tsx +0 -196
  738. package/src/core/primitives/avatar/avatarCounter.tsx +0 -93
  739. package/src/core/primitives/avatar/avatarStack.tsx +0 -100
  740. package/src/core/primitives/avatar/styles.ts +0 -166
  741. package/src/core/primitives/avatar/types.ts +0 -16
  742. package/src/core/primitives/badge/__workshop__/.eslintrc +0 -5
  743. package/src/core/primitives/badge/__workshop__/props.tsx +0 -29
  744. package/src/core/primitives/badge/__workshop__/tones.tsx +0 -20
  745. package/src/core/primitives/badge/badge.test.tsx +0 -15
  746. package/src/core/primitives/badge/badge.tsx +0 -59
  747. package/src/core/primitives/badge/styles.ts +0 -19
  748. package/src/core/primitives/box/__workshop__/.eslintrc +0 -5
  749. package/src/core/primitives/box/__workshop__/props.tsx +0 -19
  750. package/src/core/primitives/box/box.tsx +0 -121
  751. package/src/core/primitives/button/__workshop__/.eslintrc +0 -5
  752. package/src/core/primitives/button/__workshop__/custom.tsx +0 -47
  753. package/src/core/primitives/button/__workshop__/disabled.tsx +0 -73
  754. package/src/core/primitives/button/__workshop__/props.tsx +0 -53
  755. package/src/core/primitives/button/__workshop__/stacked.tsx +0 -58
  756. package/src/core/primitives/button/button.test.tsx +0 -43
  757. package/src/core/primitives/button/button.tsx +0 -181
  758. package/src/core/primitives/button/styles.ts +0 -116
  759. package/src/core/primitives/card/RootCardContext.ts +0 -3
  760. package/src/core/primitives/card/__workshop__/.eslintrc +0 -5
  761. package/src/core/primitives/card/__workshop__/allTones.tsx +0 -27
  762. package/src/core/primitives/card/__workshop__/asButton.tsx +0 -88
  763. package/src/core/primitives/card/__workshop__/asComponent.tsx +0 -27
  764. package/src/core/primitives/card/__workshop__/checkered.tsx +0 -16
  765. package/src/core/primitives/card/__workshop__/interactive.tsx +0 -23
  766. package/src/core/primitives/card/__workshop__/listNavigation.tsx +0 -77
  767. package/src/core/primitives/card/__workshop__/props.tsx +0 -49
  768. package/src/core/primitives/card/__workshop__/selected.tsx +0 -91
  769. package/src/core/primitives/card/card.tsx +0 -110
  770. package/src/core/primitives/card/index.ts +0 -2
  771. package/src/core/primitives/card/types.ts +0 -11
  772. package/src/core/primitives/checkbox/__workshop__/.eslintrc +0 -5
  773. package/src/core/primitives/checkbox/__workshop__/tones.tsx +0 -22
  774. package/src/core/primitives/checkbox/checkbox.tsx +0 -70
  775. package/src/core/primitives/code/__workshop__/.eslintrc +0 -5
  776. package/src/core/primitives/code/__workshop__/props.tsx +0 -20
  777. package/src/core/primitives/code/code.tsx +0 -49
  778. package/src/core/primitives/code/styles.ts +0 -77
  779. package/src/core/primitives/container/__workshop__/.eslintrc +0 -5
  780. package/src/core/primitives/container/__workshop__/example.tsx +0 -19
  781. package/src/core/primitives/container/container.tsx +0 -32
  782. package/src/core/primitives/container/styles.ts +0 -22
  783. package/src/core/primitives/flex/__workshop__/.eslintrc +0 -5
  784. package/src/core/primitives/flex/__workshop__/example.tsx +0 -33
  785. package/src/core/primitives/flex/__workshop__/gap.tsx +0 -25
  786. package/src/core/primitives/flex/flex.tsx +0 -32
  787. package/src/core/primitives/grid/__workshop__/.eslintrc +0 -5
  788. package/src/core/primitives/grid/__workshop__/responsive.tsx +0 -54
  789. package/src/core/primitives/grid/grid.tsx +0 -34
  790. package/src/core/primitives/heading/__workshop__/.eslintrc +0 -5
  791. package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +0 -66
  792. package/src/core/primitives/heading/__workshop__/plain.tsx +0 -31
  793. package/src/core/primitives/heading/heading.tsx +0 -82
  794. package/src/core/primitives/heading/styles.ts +0 -63
  795. package/src/core/primitives/heading/types.ts +0 -7
  796. package/src/core/primitives/inline/__workshop__/.eslintrc +0 -5
  797. package/src/core/primitives/inline/__workshop__/plain.tsx +0 -26
  798. package/src/core/primitives/inline/inline.tsx +0 -47
  799. package/src/core/primitives/inline/styles.ts +0 -31
  800. package/src/core/primitives/kbd/__workshop__/.eslintrc +0 -5
  801. package/src/core/primitives/kbd/kbd.tsx +0 -53
  802. package/src/core/primitives/label/__workshop__/.eslintrc +0 -5
  803. package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +0 -48
  804. package/src/core/primitives/label/__workshop__/plain.tsx +0 -23
  805. package/src/core/primitives/label/label.tsx +0 -91
  806. package/src/core/primitives/label/styles.ts +0 -44
  807. package/src/core/primitives/popover/__workshop__/.eslintrc +0 -5
  808. package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +0 -76
  809. package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -31
  810. package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
  811. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +0 -70
  812. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +0 -86
  813. package/src/core/primitives/popover/__workshop__/TestStory.tsx +0 -97
  814. package/src/core/primitives/popover/floating-ui/size.ts +0 -82
  815. package/src/core/primitives/popover/helpers.ts +0 -31
  816. package/src/core/primitives/popover/popover.tsx +0 -476
  817. package/src/core/primitives/popover/popoverCard.tsx +0 -153
  818. package/src/core/primitives/radio/__workshop__/.eslintrc +0 -5
  819. package/src/core/primitives/radio/__workshop__/plain.tsx +0 -28
  820. package/src/core/primitives/radio/radio.tsx +0 -50
  821. package/src/core/primitives/radio/styles.ts +0 -116
  822. package/src/core/primitives/select/__workshop__/.eslintrc +0 -5
  823. package/src/core/primitives/select/__workshop__/plain.tsx +0 -27
  824. package/src/core/primitives/select/__workshop__/readOnly.tsx +0 -23
  825. package/src/core/primitives/select/select.tsx +0 -86
  826. package/src/core/primitives/select/styles.ts +0 -166
  827. package/src/core/primitives/spinner/__workshop__/.eslintrc +0 -5
  828. package/src/core/primitives/spinner/__workshop__/Props.tsx +0 -15
  829. package/src/core/primitives/spinner/spinner.tsx +0 -31
  830. package/src/core/primitives/stack/__workshop__/.eslintrc +0 -5
  831. package/src/core/primitives/stack/__workshop__/plain.tsx +0 -31
  832. package/src/core/primitives/stack/stack.tsx +0 -41
  833. package/src/core/primitives/stack/styles.ts +0 -31
  834. package/src/core/primitives/switch/__workshop__/.eslintrc +0 -5
  835. package/src/core/primitives/switch/styles.ts +0 -172
  836. package/src/core/primitives/switch/switch.tsx +0 -66
  837. package/src/core/primitives/text/__workshop__/.eslintrc +0 -5
  838. package/src/core/primitives/text/__workshop__/colored.tsx +0 -29
  839. package/src/core/primitives/text/__workshop__/example.tsx +0 -38
  840. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +0 -58
  841. package/src/core/primitives/text/styles.ts +0 -73
  842. package/src/core/primitives/text/text.tsx +0 -82
  843. package/src/core/primitives/textArea/__workshop__/.eslintrc +0 -5
  844. package/src/core/primitives/textArea/__workshop__/plain.tsx +0 -49
  845. package/src/core/primitives/textArea/textArea.tsx +0 -118
  846. package/src/core/primitives/textInput/__workshop__/.eslintrc +0 -5
  847. package/src/core/primitives/textInput/__workshop__/index.ts +0 -49
  848. package/src/core/primitives/textInput/__workshop__/multipleTones.tsx +0 -20
  849. package/src/core/primitives/textInput/__workshop__/plain.tsx +0 -99
  850. package/src/core/primitives/textInput/__workshop__/readOnly.tsx +0 -5
  851. package/src/core/primitives/textInput/__workshop__/tones.tsx +0 -239
  852. package/src/core/primitives/textInput/__workshop__/typed.tsx +0 -22
  853. package/src/core/primitives/textInput/textInput.tsx +0 -373
  854. package/src/core/primitives/tooltip/__workshop__/.eslintrc +0 -5
  855. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +0 -101
  856. package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -73
  857. package/src/core/primitives/tooltip/__workshop__/props.tsx +0 -106
  858. package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -85
  859. package/src/core/primitives/tooltip/tooltip.test.tsx +0 -451
  860. package/src/core/primitives/tooltip/tooltip.tsx +0 -464
  861. package/src/core/primitives/tooltip/tooltipCard.tsx +0 -110
  862. package/src/core/primitives/tooltip/tooltipDelayGroup/index.ts +0 -4
  863. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +0 -57
  864. package/src/core/primitives/tooltip/tooltipDelayGroup/types.ts +0 -11
  865. package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +0 -12
  866. package/src/core/primitives/types.ts +0 -166
  867. package/src/core/theme/__workshop__/.eslintrc +0 -5
  868. package/src/core/theme/__workshop__/build/Root.tsx +0 -367
  869. package/src/core/theme/__workshop__/build/helpers.ts +0 -46
  870. package/src/core/theme/__workshop__/build/story.tsx +0 -457
  871. package/src/core/theme/__workshop__/canvas.tsx +0 -350
  872. package/src/core/theme/__workshop__/color.tsx +0 -62
  873. package/src/core/theme/__workshop__/debug/story.tsx +0 -401
  874. package/src/core/theme/__workshop__/index.ts +0 -39
  875. package/src/core/theme/__workshop__/layer.tsx +0 -78
  876. package/src/core/theme/__workshop__/nestedProvider.tsx +0 -15
  877. package/src/core/theme/index.ts +0 -5
  878. package/src/core/theme/theme.test.tsx +0 -73
  879. package/src/core/theme/themeColorProvider.tsx +0 -28
  880. package/src/core/theme/themeContext.ts +0 -10
  881. package/src/core/theme/themeProvider.tsx +0 -63
  882. package/src/core/theme/useRootTheme.ts +0 -16
  883. package/src/core/theme/useTheme.ts +0 -16
  884. package/src/core/types/box.ts +0 -25
  885. package/src/core/types/button.ts +0 -22
  886. package/src/core/types/flex.ts +0 -31
  887. package/src/core/types/grid.ts +0 -19
  888. package/src/core/types/gridItem.ts +0 -37
  889. package/src/core/types/index.ts +0 -14
  890. package/src/core/types/selectable.ts +0 -6
  891. package/src/core/utils/arrow/arrow.tsx +0 -122
  892. package/src/core/utils/boundaryElement/__workshop__/.eslintrc +0 -5
  893. package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -101
  894. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +0 -23
  895. package/src/core/utils/boundaryElement/index.ts +0 -3
  896. package/src/core/utils/boundaryElement/useBoundaryElement.ts +0 -25
  897. package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +0 -21
  898. package/src/core/utils/elementQuery/__workshop__/.eslintrc +0 -5
  899. package/src/core/utils/elementQuery/elementQuery.tsx +0 -53
  900. package/src/core/utils/errorBoundary.tsx +0 -47
  901. package/src/core/utils/layer/__workshop__/.eslintrc +0 -5
  902. package/src/core/utils/layer/__workshop__/multipleRoots.tsx +0 -48
  903. package/src/core/utils/layer/__workshop__/nested.tsx +0 -97
  904. package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +0 -12
  905. package/src/core/utils/layer/index.ts +0 -4
  906. package/src/core/utils/layer/layer.test.tsx +0 -109
  907. package/src/core/utils/layer/layer.tsx +0 -108
  908. package/src/core/utils/layer/layerProvider.tsx +0 -109
  909. package/src/core/utils/layer/useLayer.ts +0 -25
  910. package/src/core/utils/portal/__workshop__/.eslintrc +0 -5
  911. package/src/core/utils/portal/portal.test.tsx +0 -104
  912. package/src/core/utils/portal/portal.ts +0 -31
  913. package/src/core/utils/portal/portalProvider.tsx +0 -78
  914. package/src/core/utils/portal/usePortal.ts +0 -24
  915. package/src/core/utils/srOnly/srOnly.tsx +0 -36
  916. package/src/core/utils/virtualList/__workshop__/.eslintrc +0 -5
  917. package/src/core/utils/virtualList/virtualList.tsx +0 -170
  918. package/src/css/cli/buildCommand.ts +0 -36
  919. package/src/css/cli/index.ts +0 -38
  920. package/src/css/components/dialog/classes.ts +0 -29
  921. package/src/css/primitives/badge/rules.ts +0 -25
  922. package/src/css/primitives/box/rules.ts +0 -25
  923. package/src/css/primitives/card/rules.ts +0 -241
  924. package/src/css/primitives/selectable/__style.ts +0 -117
  925. package/src/css/primitives/selectable/rules.ts +0 -27
  926. package/src/css/primitives/selectable/selectable.ts +0 -9
  927. package/src/css/primitives/selectable/types.ts +0 -6
  928. package/src/css/rules.ts +0 -99
  929. package/src/css/styles/border/border.ts +0 -22
  930. package/src/css/styles/border/rules.ts +0 -24
  931. package/src/css/styles/display/rules.ts +0 -62
  932. package/src/css/styles/flex/flex.ts +0 -20
  933. package/src/css/styles/flex/rules.ts +0 -28
  934. package/src/css/styles/flexItem/flexItem.ts +0 -8
  935. package/src/css/styles/flexItem/rules.ts +0 -11
  936. package/src/css/styles/flexItem/types.ts +0 -11
  937. package/src/css/styles/font/font.ts +0 -17
  938. package/src/css/styles/font/rules.ts +0 -148
  939. package/src/css/styles/gap/gap.ts +0 -8
  940. package/src/css/styles/gap/rules.ts +0 -33
  941. package/src/css/styles/gap/types.ts +0 -9
  942. package/src/css/styles/grid/grid.ts +0 -13
  943. package/src/css/styles/grid/rules.ts +0 -146
  944. package/src/css/styles/grid/types.ts +0 -29
  945. package/src/css/styles/gridItem/gridItem.ts +0 -15
  946. package/src/css/styles/gridItem/rules.ts +0 -96
  947. package/src/css/styles/margin/margin.ts +0 -15
  948. package/src/css/styles/margin/rules.ts +0 -63
  949. package/src/css/styles/maxWidth/rules.ts +0 -36
  950. package/src/css/styles/maxWidth/types.ts +0 -6
  951. package/src/css/styles/outline/rules.ts +0 -7
  952. package/src/css/styles/overflow/overflow.ts +0 -11
  953. package/src/css/styles/overflow/rules.ts +0 -9
  954. package/src/css/styles/padding/padding.ts +0 -15
  955. package/src/css/styles/padding/rules.ts +0 -61
  956. package/src/css/styles/padding/types.ts +0 -12
  957. package/src/css/styles/pointerEvents/pointerEvents.ts +0 -6
  958. package/src/css/styles/pointerEvents/rules.ts +0 -11
  959. package/src/css/styles/position/position.ts +0 -7
  960. package/src/css/styles/position/rules.ts +0 -31
  961. package/src/css/styles/position/types.ts +0 -13
  962. package/src/css/styles/radius/radius.ts +0 -8
  963. package/src/css/styles/radius/rules.ts +0 -13
  964. package/src/css/styles/radius/types.ts +0 -7
  965. package/src/css/styles/shadow/rules.ts +0 -53
  966. package/src/css/styles/width/index.ts +0 -2
  967. package/src/css/styles/width/rules.ts +0 -7
  968. package/src/css/styles/width/types.ts +0 -8
  969. package/src/theme/system/_constants.ts +0 -25
  970. package/src/theme/system/_types.ts +0 -41
  971. package/src/theme/system/avatar.ts +0 -14
  972. package/src/theme/system/color/_constants.ts +0 -41
  973. package/src/theme/system/color/_helpers.ts +0 -23
  974. package/src/theme/system/color/_system.ts +0 -40
  975. package/src/theme/system/color/badge.ts +0 -20
  976. package/src/theme/system/color/color.ts +0 -34
  977. package/src/theme/system/css.ts +0 -9
  978. package/src/theme/system/font.ts +0 -52
  979. package/src/theme/system/index.ts +0 -14
  980. package/src/theme/system/input.ts +0 -33
  981. package/src/theme/system/theme.ts +0 -138
  982. package/src/theme/system/v0/color/_generic.ts +0 -35
  983. package/src/theme/system/v0/color/_system.ts +0 -13
  984. package/src/theme/system/v0/color/color.ts +0 -39
  985. package/src/theme/system/v0/color/index.ts +0 -11
  986. package/src/theme/system/v0/color/input.ts +0 -34
  987. package/src/theme/system/v0/color/spot.ts +0 -13
  988. package/src/theme/system/v0/index.ts +0 -3
  989. package/theme.js +0 -2
  990. /package/src/css/{styles → aspects}/border/index.ts +0 -0
  991. /package/src/css/{styles → aspects}/border/types.ts +0 -0
  992. /package/src/css/{styles → aspects}/flex/index.ts +0 -0
  993. /package/src/css/{styles → aspects}/flex/types.ts +0 -0
  994. /package/src/css/{styles → aspects}/flexItem/index.ts +0 -0
  995. /package/src/css/{styles → aspects}/font/index.ts +0 -0
  996. /package/src/css/{styles → aspects}/font/types.ts +0 -0
  997. /package/src/css/{styles → aspects}/gap/index.ts +0 -0
  998. /package/src/css/{styles → aspects}/grid/index.ts +0 -0
  999. /package/src/css/{styles → aspects}/gridItem/index.ts +0 -0
  1000. /package/src/css/{styles → aspects}/gridItem/types.ts +0 -0
  1001. /package/src/css/{styles → aspects}/height/rules.ts +0 -0
  1002. /package/src/css/{styles → aspects}/margin/index.ts +0 -0
  1003. /package/src/css/{styles → aspects}/margin/types.ts +0 -0
  1004. /package/src/css/{styles → aspects}/maxWidth/index.ts +0 -0
  1005. /package/src/css/{styles → aspects}/maxWidth/maxWidth.ts +0 -0
  1006. /package/src/css/{styles → aspects}/overflow/index.ts +0 -0
  1007. /package/src/css/{styles → aspects}/overflow/types.ts +0 -0
  1008. /package/src/css/{styles → aspects}/padding/index.ts +0 -0
  1009. /package/src/css/{styles → aspects}/pointerEvents/index.ts +0 -0
  1010. /package/src/css/{styles → aspects}/pointerEvents/types.ts +0 -0
  1011. /package/src/css/{styles → aspects}/position/index.ts +0 -0
  1012. /package/src/css/{styles → aspects}/radius/index.ts +0 -0
  1013. /package/src/css/{styles → aspects}/width/width.ts +0 -0
  1014. /package/src/css/primitives/{selectable → _selectable}/index.ts +0 -0
  1015. /package/src/{core → css}/primitives/stack/index.ts +0 -0
  1016. /package/src/{core → css}/utils/srOnly/index.ts +0 -0
  1017. /package/src/theme/{system/v0 → v0}/avatar.ts +0 -0
  1018. /package/src/theme/{system/v0 → v0}/color/base.ts +0 -0
  1019. /package/src/theme/{system/v0 → v0}/color/button.ts +0 -0
  1020. /package/src/theme/{system/v0 → v0}/color/card.ts +0 -0
  1021. /package/src/theme/{system/v0 → v0}/color/muted.ts +0 -0
  1022. /package/src/theme/{system/v0 → v0}/color/selectable.ts +0 -0
  1023. /package/src/theme/{system/v0 → v0}/color/solid.ts +0 -0
  1024. /package/src/theme/{system → v0}/focusRing.ts +0 -0
  1025. /package/src/theme/{system/v0 → v0}/input.ts +0 -0
  1026. /package/src/theme/{system → v0}/layer.ts +0 -0
  1027. /package/src/theme/{system → v0}/shadow.ts +0 -0
  1028. /package/src/theme/{system → v0}/styles.ts +0 -0
  1029. /package/src/theme/{system → v2}/color/avatar.ts +0 -0
  1030. /package/src/theme/{system → v2}/color/button.ts +0 -0
  1031. /package/src/theme/{system → v2}/color/index.ts +0 -0
  1032. /package/src/theme/{system → v2}/color/input.ts +0 -0
  1033. /package/src/theme/{system → v2}/color/kbd.ts +0 -0
  1034. /package/src/theme/{system → v2}/color/selectable.ts +0 -0
  1035. /package/src/theme/{system → v2}/color/shadow.ts +0 -0
  1036. /package/src/theme/{system → v2}/color/state.ts +0 -0
  1037. /package/src/theme/{system → v2}/color/syntax.ts +0 -0
  1038. /package/src/{core → ui/_compat}/theme/types.ts +0 -0
  1039. /package/src/{core/components/autocomplete/__fixtures__ → ui/components/autocomplete/__mocks__}/countries.ts +0 -0
  1040. /package/src/{core → ui}/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -0
  1041. /package/src/{core → ui}/components/autocomplete/__workshop__/index.ts +0 -0
  1042. /package/src/{core → ui}/components/autocomplete/__workshop__/types.ts +0 -0
  1043. /package/src/{core → ui}/components/autocomplete/autocompleteReducer.ts +0 -0
  1044. /package/src/{core → ui}/components/autocomplete/constants.ts +0 -0
  1045. /package/src/{core → ui}/components/autocomplete/index.ts +0 -0
  1046. /package/src/{core → ui}/components/breadcrumbs/__workshop__/index.ts +0 -0
  1047. /package/src/{core → ui}/components/breadcrumbs/index.ts +0 -0
  1048. /package/src/{core → ui}/components/dialog/__workshop__/autoFocus.tsx +0 -0
  1049. /package/src/{core → ui}/components/dialog/__workshop__/index.ts +0 -0
  1050. /package/src/{core → ui}/components/dialog/__workshop__/layering.tsx +0 -0
  1051. /package/src/{core → ui}/components/dialog/__workshop__/provider.tsx +0 -0
  1052. /package/src/{core → ui}/components/dialog/dialogContext.ts +0 -0
  1053. /package/src/{core → ui}/components/dialog/index.ts +0 -0
  1054. /package/src/{core → ui}/components/hotkeys/__workshop__/index.ts +0 -0
  1055. /package/src/{core → ui}/components/hotkeys/__workshop__/plain.tsx +0 -0
  1056. /package/src/{core → ui}/components/hotkeys/index.ts +0 -0
  1057. /package/src/{core → ui}/components/index.ts +0 -0
  1058. /package/src/{core → ui}/components/menu/__workshop__/closableMenuButton.tsx +0 -0
  1059. /package/src/{core → ui}/components/menu/__workshop__/customMenuItem.tsx +0 -0
  1060. /package/src/{core → ui}/components/menu/__workshop__/disableFocusOnClose.tsx +0 -0
  1061. /package/src/{core → ui}/components/menu/__workshop__/groups.tsx +0 -0
  1062. /package/src/{core → ui}/components/menu/__workshop__/index.ts +0 -0
  1063. /package/src/{core → ui}/components/menu/__workshop__/menuGroupRight.tsx +0 -0
  1064. /package/src/{core → ui}/components/menu/__workshop__/nestedMenu.tsx +0 -0
  1065. /package/src/{core → ui}/components/menu/__workshop__/onCloseMenuButton.tsx +0 -0
  1066. /package/src/{core → ui}/components/menu/__workshop__/selectedItem.tsx +0 -0
  1067. /package/src/{core → ui}/components/menu/__workshop__/withoutArrow.tsx +0 -0
  1068. /package/src/{core → ui}/components/menu/helpers.ts +0 -0
  1069. /package/src/{core → ui}/components/menu/index.ts +0 -0
  1070. /package/src/{core → ui}/components/skeleton/__workshop__/index.ts +0 -0
  1071. /package/src/{core → ui}/components/skeleton/index.ts +0 -0
  1072. /package/src/{core → ui}/components/tab/__workshop__/example.tsx +0 -0
  1073. /package/src/{core → ui}/components/tab/__workshop__/index.ts +0 -0
  1074. /package/src/{core → ui}/components/tab/index.ts +0 -0
  1075. /package/src/{core → ui}/components/toast/__workshop__/index.ts +0 -0
  1076. /package/src/{core → ui}/components/toast/index.ts +0 -0
  1077. /package/src/{core → ui}/components/toast/toastContext.ts +0 -0
  1078. /package/src/{core → ui}/components/tree/__workshop__/basic.perf.ts +0 -0
  1079. /package/src/{core → ui}/components/tree/__workshop__/index.ts +0 -0
  1080. /package/src/{core → ui}/components/tree/helpers.ts +0 -0
  1081. /package/src/{core → ui}/components/tree/index.ts +0 -0
  1082. /package/src/{core → ui}/components/tree/treeContext.ts +0 -0
  1083. /package/src/{core → ui}/components/tree/types.ts +0 -0
  1084. /package/src/{core → ui}/global.ts +0 -0
  1085. /package/src/{core → ui}/helpers/animation.ts +0 -0
  1086. /package/src/{core → ui}/helpers/element.ts +0 -0
  1087. /package/src/{core → ui}/helpers/scroll.ts +0 -0
  1088. /package/src/{core → ui}/hooks/index.ts +0 -0
  1089. /package/src/{core → ui}/hooks/useCustomValidity.ts +0 -0
  1090. /package/src/{core → ui}/hooks/useElementRect/__workshop__/index.ts +0 -0
  1091. /package/src/{core → ui}/hooks/useElementRect/index.ts +0 -0
  1092. /package/src/{core → ui}/hooks/useElementRect/useElementRect.ts +0 -0
  1093. /package/src/{core → ui}/hooks/useIsomorphicEffect.ts +0 -0
  1094. /package/src/{core → ui}/hooks/useMediaIndex/__workshop__/index.ts +0 -0
  1095. /package/src/{core → ui}/hooks/useMediaIndex/__workshop__/test.tsx +0 -0
  1096. /package/src/{core → ui}/hooks/useMediaIndex/index.ts +0 -0
  1097. /package/src/{core → ui}/hooks/useMounted.ts +0 -0
  1098. /package/src/{core → ui}/lib/isRecord.ts +0 -0
  1099. /package/src/{core → ui}/middleware/origin.ts +0 -0
  1100. /package/src/{core → ui}/observers/elementSizeObserver.ts +0 -0
  1101. /package/src/{core → ui}/observers/index.ts +0 -0
  1102. /package/src/{core → ui}/observers/resizeObserver.ts +0 -0
  1103. /package/src/{core → ui}/primitives/_selectable/index.ts +0 -0
  1104. /package/src/{core → ui}/primitives/avatar/__workshop__/index.ts +0 -0
  1105. /package/src/{core → ui}/primitives/avatar/index.ts +0 -0
  1106. /package/src/{core → ui}/primitives/badge/__workshop__/index.ts +0 -0
  1107. /package/src/{core → ui}/primitives/badge/index.ts +0 -0
  1108. /package/src/{core → ui}/primitives/badge/types.ts +0 -0
  1109. /package/src/{core → ui}/primitives/box/__workshop__/index.ts +0 -0
  1110. /package/src/{core → ui}/primitives/box/__workshop__/responsive.tsx +0 -0
  1111. /package/src/{core → ui}/primitives/box/index.ts +0 -0
  1112. /package/src/{core → ui}/primitives/button/__workshop__/customIcons.tsx +0 -0
  1113. /package/src/{core → ui}/primitives/button/__workshop__/index.ts +0 -0
  1114. /package/src/{core → ui}/primitives/button/__workshop__/mixedChildren.tsx +0 -0
  1115. /package/src/{core → ui}/primitives/button/__workshop__/sanityUploadButton.tsx +0 -0
  1116. /package/src/{core → ui}/primitives/button/__workshop__/styled1.tsx +0 -0
  1117. /package/src/{core → ui}/primitives/button/__workshop__/styled2.tsx +0 -0
  1118. /package/src/{core → ui}/primitives/button/__workshop__/uploadButton.tsx +0 -0
  1119. /package/src/{core → ui}/primitives/button/index.ts +0 -0
  1120. /package/src/{core → ui}/primitives/card/__workshop__/index.ts +0 -0
  1121. /package/src/{core → ui}/primitives/card/__workshop__/styled.tsx +0 -0
  1122. /package/src/{core → ui}/primitives/checkbox/__workshop__/example.tsx +0 -0
  1123. /package/src/{core → ui}/primitives/checkbox/__workshop__/index.ts +0 -0
  1124. /package/src/{core → ui}/primitives/checkbox/__workshop__/props.tsx +0 -0
  1125. /package/src/{core → ui}/primitives/checkbox/__workshop__/readOnly.tsx +0 -0
  1126. /package/src/{core → ui}/primitives/checkbox/index.ts +0 -0
  1127. /package/src/{core → ui}/primitives/code/__workshop__/index.ts +0 -0
  1128. /package/src/{core → ui}/primitives/code/__workshop__/opticalAlignment.tsx +0 -0
  1129. /package/src/{core → ui}/primitives/code/index.ts +0 -0
  1130. /package/src/{core → ui}/primitives/container/__workshop__/index.ts +0 -0
  1131. /package/src/{core → ui}/primitives/container/index.ts +0 -0
  1132. /package/src/{core → ui}/primitives/container/types.ts +0 -0
  1133. /package/src/{core → ui}/primitives/flex/__workshop__/index.ts +0 -0
  1134. /package/src/{core → ui}/primitives/flex/index.ts +0 -0
  1135. /package/src/{core → ui}/primitives/grid/__workshop__/index.ts +0 -0
  1136. /package/src/{core → ui}/primitives/grid/index.ts +0 -0
  1137. /package/src/{core → ui}/primitives/heading/__workshop__/index.ts +0 -0
  1138. /package/src/{core → ui}/primitives/heading/index.ts +0 -0
  1139. /package/src/{core → ui}/primitives/index.ts +0 -0
  1140. /package/src/{core → ui}/primitives/inline/__workshop__/index.ts +0 -0
  1141. /package/src/{core → ui}/primitives/inline/index.ts +0 -0
  1142. /package/src/{core → ui}/primitives/inline/types.ts +0 -0
  1143. /package/src/{core → ui}/primitives/kbd/__workshop__/index.ts +0 -0
  1144. /package/src/{core → ui}/primitives/kbd/__workshop__/plain.tsx +0 -0
  1145. /package/src/{core/primitives/kbd/index.tsx → ui/primitives/kbd/index.ts} +0 -0
  1146. /package/src/{core → ui}/primitives/label/__workshop__/index.ts +0 -0
  1147. /package/src/{core → ui}/primitives/label/index.ts +0 -0
  1148. /package/src/{core → ui}/primitives/popover/__workshop__/MarginsStory.tsx +0 -0
  1149. /package/src/{core → ui}/primitives/popover/__workshop__/RecursiveStory.tsx +0 -0
  1150. /package/src/{core → ui}/primitives/popover/__workshop__/index.ts +0 -0
  1151. /package/src/{core → ui}/primitives/popover/constants.ts +0 -0
  1152. /package/src/{core → ui}/primitives/popover/index.ts +0 -0
  1153. /package/src/{core → ui}/primitives/popover/types.ts +0 -0
  1154. /package/src/{core → ui}/primitives/radio/__workshop__/example.tsx +0 -0
  1155. /package/src/{core → ui}/primitives/radio/__workshop__/index.ts +0 -0
  1156. /package/src/{core → ui}/primitives/radio/index.ts +0 -0
  1157. /package/src/{core → ui}/primitives/select/__workshop__/index.ts +0 -0
  1158. /package/src/{core → ui}/primitives/select/index.ts +0 -0
  1159. /package/src/{core → ui}/primitives/spinner/__workshop__/index.ts +0 -0
  1160. /package/src/{core → ui}/primitives/spinner/animatedSpinnerIcon.tsx +0 -0
  1161. /package/src/{core → ui}/primitives/spinner/index.ts +0 -0
  1162. /package/src/{core → ui}/primitives/stack/__workshop__/index.ts +0 -0
  1163. /package/src/{core → ui}/primitives/switch/__workshop__/example.tsx +0 -0
  1164. /package/src/{core → ui}/primitives/switch/__workshop__/index.ts +0 -0
  1165. /package/src/{core → ui}/primitives/switch/__workshop__/props.tsx +0 -0
  1166. /package/src/{core → ui}/primitives/switch/index.ts +0 -0
  1167. /package/src/{core → ui}/primitives/text/__workshop__/index.ts +0 -0
  1168. /package/src/{core → ui}/primitives/text/index.ts +0 -0
  1169. /package/src/{core → ui}/primitives/textArea/__workshop__/index.ts +0 -0
  1170. /package/src/{core → ui}/primitives/textArea/index.ts +0 -0
  1171. /package/src/{core → ui}/primitives/textInput/__workshop__/clearButton.tsx +0 -0
  1172. /package/src/{core → ui}/primitives/textInput/__workshop__/customValidity.tsx +0 -0
  1173. /package/src/{core → ui}/primitives/textInput/__workshop__/states.tsx +0 -0
  1174. /package/src/{core → ui}/primitives/textInput/index.ts +0 -0
  1175. /package/src/{core → ui}/primitives/tooltip/__workshop__/index.ts +0 -0
  1176. /package/src/{core → ui}/primitives/tooltip/constants.ts +0 -0
  1177. /package/src/{core → ui}/primitives/tooltip/index.ts +0 -0
  1178. /package/src/{core → ui}/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +0 -0
  1179. /package/src/{core → ui}/types/avatar.ts +0 -0
  1180. /package/src/{core → ui}/types/badge.ts +0 -0
  1181. /package/src/{core → ui}/types/card.ts +0 -0
  1182. /package/src/{core → ui}/types/dialog.ts +0 -0
  1183. /package/src/{core → ui}/types/placement.ts +0 -0
  1184. /package/src/{core → ui}/types/popover.ts +0 -0
  1185. /package/src/{core → ui}/types/radius.ts +0 -0
  1186. /package/src/{core → ui}/types/text.ts +0 -0
  1187. /package/src/{core → ui}/utils/arrow/cmds.ts +0 -0
  1188. /package/src/{core → ui}/utils/arrow/index.ts +0 -0
  1189. /package/src/{core → ui}/utils/boundaryElement/__workshop__/index.ts +0 -0
  1190. /package/src/{core → ui}/utils/boundaryElement/__workshop__/plain.tsx +0 -0
  1191. /package/src/{core → ui}/utils/boundaryElement/boundaryElementContext.ts +0 -0
  1192. /package/src/{core → ui}/utils/boundaryElement/types.ts +0 -0
  1193. /package/src/{core → ui}/utils/conditionalWrapper/index.ts +0 -0
  1194. /package/src/{core → ui}/utils/elementQuery/__workshop__/customMedia.tsx +0 -0
  1195. /package/src/{core → ui}/utils/elementQuery/__workshop__/index.ts +0 -0
  1196. /package/src/{core → ui}/utils/elementQuery/helpers.ts +0 -0
  1197. /package/src/{core → ui}/utils/elementQuery/index.ts +0 -0
  1198. /package/src/{core → ui}/utils/index.ts +0 -0
  1199. /package/src/{core → ui}/utils/layer/__workshop__/_debug.tsx +0 -0
  1200. /package/src/{core → ui}/utils/layer/__workshop__/index.ts +0 -0
  1201. /package/src/{core → ui}/utils/layer/getLayerContext.test.ts +0 -0
  1202. /package/src/{core → ui}/utils/layer/getLayerContext.ts +0 -0
  1203. /package/src/{core → ui}/utils/layer/layerContext.ts +0 -0
  1204. /package/src/{core → ui}/utils/layer/types.ts +0 -0
  1205. /package/src/{core → ui}/utils/portal/__workshop__/index.ts +0 -0
  1206. /package/src/{core → ui}/utils/portal/__workshop__/named.tsx +0 -0
  1207. /package/src/{core → ui}/utils/portal/index.ts +0 -0
  1208. /package/src/{core → ui}/utils/portal/portalContext.ts +0 -0
  1209. /package/src/{core → ui}/utils/portal/types.ts +0 -0
  1210. /package/src/{core → ui}/utils/virtualList/__workshop__/changingProps.tsx +0 -0
  1211. /package/src/{core → ui}/utils/virtualList/__workshop__/elementScroll.tsx +0 -0
  1212. /package/src/{core → ui}/utils/virtualList/__workshop__/index.ts +0 -0
  1213. /package/src/{core → ui}/utils/virtualList/__workshop__/infiniteList.tsx +0 -0
  1214. /package/src/{core → ui}/utils/virtualList/__workshop__/windowScrolll.tsx +0 -0
  1215. /package/src/{core → ui}/utils/virtualList/index.ts +0 -0
package/dist/theme.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import { COLOR_HUES, COLOR_TINTS, color } from "@sanity/color";
1
+ import { COLOR_HUES, COLOR_TINTS } from "@sanity/color";
2
+ 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];
2
3
  function createSelectableTones(opts, base, dark, solid, muted) {
3
4
  return {
4
5
  default: _createSelectableStates(opts, base, dark, solid, muted, "default"),
@@ -505,13 +506,13 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
505
506
  state,
506
507
  tone
507
508
  }) => {
508
- const color2 = colors[tone];
509
+ const color = colors[tone];
509
510
  return state === "hovered" ? {
510
- bg: dark ? color2.light : color2.dark,
511
- bg2: dark ? color2.light : color2.dark,
512
- border: dark ? color2.lighter : color2.darker,
513
- fg: dark ? color2.darkest : color2.lightest,
514
- icon: dark ? color2.darkest : color2.lightest,
511
+ bg: dark ? color.light : color.dark,
512
+ bg2: dark ? color.light : color.dark,
513
+ border: dark ? color.lighter : color.darker,
514
+ fg: dark ? color.darkest : color.lightest,
515
+ icon: dark ? color.darkest : color.lightest,
515
516
  muted: {
516
517
  fg: black
517
518
  },
@@ -527,11 +528,11 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
527
528
  },
528
529
  skeleton: base.skeleton
529
530
  } : {
530
- bg: color2.base,
531
- bg2: color2.base,
532
- border: dark ? color2.light : color2.dark,
533
- fg: dark ? color2.darkest : color2.lightest,
534
- icon: dark ? color2.darkest : color2.lightest,
531
+ bg: color.base,
532
+ bg2: color.base,
533
+ border: dark ? color.light : color.dark,
534
+ fg: dark ? color.darkest : color.lightest,
535
+ icon: dark ? color.darkest : color.lightest,
535
536
  muted: {
536
537
  fg: black
537
538
  },
@@ -554,13 +555,13 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
554
555
  state,
555
556
  tone
556
557
  }) => {
557
- const color2 = colors[tone];
558
+ const color = colors[tone];
558
559
  return state === "hovered" ? {
559
- bg: dark ? color2.darker : color2.lighter,
560
- bg2: dark ? color2.darker : color2.lighter,
561
- border: dark ? color2.lighter : color2.darker,
562
- fg: dark ? color2.lightest : color2.darkest,
563
- icon: dark ? color2.lightest : color2.darkest,
560
+ bg: dark ? color.darker : color.lighter,
561
+ bg2: dark ? color.darker : color.lighter,
562
+ border: dark ? color.lighter : color.darker,
563
+ fg: dark ? color.lightest : color.darkest,
564
+ icon: dark ? color.lightest : color.darkest,
564
565
  muted: {
565
566
  fg: black
566
567
  },
@@ -576,11 +577,11 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
576
577
  },
577
578
  skeleton: base.skeleton
578
579
  } : {
579
- bg: dark ? color2.darkest : color2.lightest,
580
- bg2: dark ? color2.darkest : color2.lightest,
581
- border: dark ? color2.darker : color2.lighter,
582
- fg: dark ? color2.lighter : color2.darker,
583
- icon: dark ? color2.lighter : color2.darker,
580
+ bg: dark ? color.darkest : color.lightest,
581
+ bg2: dark ? color.darkest : color.lightest,
582
+ border: dark ? color.darker : color.lighter,
583
+ fg: dark ? color.lighter : color.darker,
584
+ icon: dark ? color.lighter : color.darker,
584
585
  muted: {
585
586
  fg: black
586
587
  },
@@ -1116,7 +1117,6 @@ function _createColor(opts, dark, name) {
1116
1117
  };
1117
1118
  }
1118
1119
  const defaultThemeConfig = {
1119
- _version: 2,
1120
1120
  avatar: {
1121
1121
  sizes: [{
1122
1122
  distance: -4,
@@ -1171,7 +1171,7 @@ const defaultThemeConfig = {
1171
1171
  zOffset: 200
1172
1172
  }
1173
1173
  },
1174
- radius: [0, 1, 5, 9, 13, 21, 33],
1174
+ radius: [0, 1, 3, 7, 11, 15, 23, 43, 75, 127],
1175
1175
  shadow: [null, {
1176
1176
  umbra: [0, 0, 0, 0],
1177
1177
  penumbra: [0, 0, 0, 0],
@@ -1236,18 +1236,6 @@ const defaultThemeConfig = {
1236
1236
  width: 1
1237
1237
  }
1238
1238
  }
1239
- },
1240
- style: {
1241
- button: {
1242
- root: {
1243
- transition: "background-color 100ms,border-color 100ms,color 100ms"
1244
- }
1245
- }
1246
- // card: {
1247
- // root: {
1248
- // transition: 'background-color 100ms,border-color 100ms,color 100ms',
1249
- // },
1250
- // },
1251
1239
  }
1252
1240
  }, defaultThemeFonts = {
1253
1241
  code: {
@@ -1297,10 +1285,11 @@ const defaultThemeConfig = {
1297
1285
  },
1298
1286
  heading: {
1299
1287
  family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
1288
+ featureSettings: "'liga' 1, 'calt' 1, 'ss01' 1, 'ss03' 1, 'zero' 1",
1300
1289
  weights: {
1301
- regular: 700,
1302
- medium: 800,
1303
- semibold: 900,
1290
+ regular: 600,
1291
+ medium: 700,
1292
+ semibold: 800,
1304
1293
  bold: 900
1305
1294
  },
1306
1295
  sizes: [{
@@ -1323,37 +1312,37 @@ const defaultThemeConfig = {
1323
1312
  fontSize: 21,
1324
1313
  iconSize: 33,
1325
1314
  lineHeight: 29,
1326
- letterSpacing: 0
1315
+ letterSpacing: -0.25
1327
1316
  }, {
1328
1317
  ascenderHeight: 8,
1329
1318
  descenderHeight: 8,
1330
1319
  fontSize: 27,
1331
1320
  iconSize: 41,
1332
1321
  lineHeight: 35,
1333
- letterSpacing: 0
1322
+ letterSpacing: -0.5
1334
1323
  }, {
1335
1324
  ascenderHeight: 9.5,
1336
1325
  descenderHeight: 8.5,
1337
1326
  fontSize: 33,
1338
1327
  iconSize: 49,
1339
1328
  lineHeight: 41,
1340
- letterSpacing: 0
1329
+ letterSpacing: -1
1341
1330
  }, {
1342
1331
  ascenderHeight: 10.5,
1343
1332
  descenderHeight: 9.5,
1344
1333
  fontSize: 38,
1345
1334
  iconSize: 53,
1346
1335
  lineHeight: 47,
1347
- letterSpacing: 0
1336
+ letterSpacing: -1
1348
1337
  }]
1349
1338
  },
1350
1339
  label: {
1351
1340
  family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',
1352
1341
  weights: {
1353
- regular: 600,
1354
- medium: 700,
1355
- semibold: 800,
1356
- bold: 900
1342
+ regular: 500,
1343
+ medium: 600,
1344
+ semibold: 700,
1345
+ bold: 800
1357
1346
  },
1358
1347
  sizes: [{
1359
1348
  ascenderHeight: 2,
@@ -1363,8 +1352,8 @@ const defaultThemeConfig = {
1363
1352
  lineHeight: 10,
1364
1353
  letterSpacing: 0.5
1365
1354
  }, {
1366
- ascenderHeight: 2,
1367
- descenderHeight: 2,
1355
+ ascenderHeight: 1.5,
1356
+ descenderHeight: 2.5,
1368
1357
  fontSize: 9.5,
1369
1358
  iconSize: 15,
1370
1359
  lineHeight: 11,
@@ -1384,8 +1373,8 @@ const defaultThemeConfig = {
1384
1373
  lineHeight: 13,
1385
1374
  letterSpacing: 0.5
1386
1375
  }, {
1387
- ascenderHeight: 2,
1388
- descenderHeight: 2,
1376
+ ascenderHeight: 1.5,
1377
+ descenderHeight: 2.5,
1389
1378
  fontSize: 13.6,
1390
1379
  iconSize: 21,
1391
1380
  lineHeight: 14,
@@ -1444,329 +1433,668 @@ const defaultThemeConfig = {
1444
1433
  letterSpacing: 0
1445
1434
  }]
1446
1435
  }
1447
- }, cache$4 = /* @__PURE__ */ new WeakMap();
1448
- function themeColor_v0_v2(color_v0) {
1449
- const cached_v2 = cache$4.get(color_v0);
1450
- if (cached_v2) return cached_v2;
1451
- const base = stateThemeColor_v0_v2(color_v0, color_v0.card.enabled), color_v2 = {
1452
- _blend: color_v0._blend || (color_v0.dark ? "screen" : "multiply"),
1453
- _dark: color_v0.dark,
1454
- accent: base.accent,
1455
- avatar: base.avatar,
1456
- backdrop: color_v0.base.shadow.ambient,
1457
- badge: base.badge,
1458
- bg: color_v0.base.bg,
1459
- border: color_v0.base.border,
1460
- button: {
1461
- default: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.default),
1462
- ghost: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.ghost),
1463
- bleed: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.bleed)
1464
- },
1465
- code: base.code,
1466
- fg: color_v0.base.fg,
1467
- focusRing: color_v0.base.focusRing,
1468
- icon: base.muted.fg,
1469
- input: {
1470
- default: inputStatesThemeColor_v0_v2(color_v0.input.default),
1471
- invalid: inputStatesThemeColor_v0_v2(color_v0.input.invalid)
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]+)?/;
1469
+ function parseColor$1(str) {
1470
+ let cursor = 0;
1471
+ const color = getColor();
1472
+ if (!color)
1473
+ throw new Error(`Invalid color: ${str}`);
1474
+ const opacity = getOpacity(), mix2 = getMixPercentage();
1475
+ return {
1476
+ color,
1477
+ mix: mix2,
1478
+ opacity
1479
+ };
1480
+ function _consume(s) {
1481
+ if (str.startsWith(s, cursor))
1482
+ return cursor += s.length, s;
1483
+ }
1484
+ function _peek() {
1485
+ return str[cursor];
1486
+ }
1487
+ function getColor() {
1488
+ ignoreWhitespace();
1489
+ let v = _consume("black") || _consume("white");
1490
+ if (v)
1491
+ return {
1492
+ type: v
1493
+ };
1494
+ for (const hue of HUES)
1495
+ if (v = _consume(String(hue)), v) {
1496
+ if (_peek() !== "/")
1497
+ throw new Error("Expected slash after hue");
1498
+ cursor += 1;
1499
+ const tint2 = getTint();
1500
+ if (!tint2)
1501
+ throw new Error("Expected tint after hue");
1502
+ return {
1503
+ type: "hue",
1504
+ hue,
1505
+ tint: tint2
1506
+ };
1507
+ }
1508
+ const tint = getTint();
1509
+ if (tint)
1510
+ return {
1511
+ type: "hue",
1512
+ hue: void 0,
1513
+ tint
1514
+ };
1515
+ }
1516
+ function getTint() {
1517
+ ignoreWhitespace();
1518
+ let v = Number(str.slice(cursor, cursor + 3));
1519
+ if (TINTS.includes(v))
1520
+ return cursor += 3, v;
1521
+ if (v = Number(str.slice(cursor, cursor + 2)), TINTS.includes(v))
1522
+ return cursor += 2, v;
1523
+ }
1524
+ function getMixPercentage() {
1525
+ ignoreWhitespace();
1526
+ const match = RE_PERCENTAGE.exec(str.slice(cursor));
1527
+ if (match)
1528
+ return cursor += match[0].length, parseFloat(match[1]);
1529
+ }
1530
+ function getOpacity() {
1531
+ if (ignoreWhitespace(), _peek() === "/") {
1532
+ cursor += 1;
1533
+ const match = RE_OPACITY.exec(str.slice(cursor));
1534
+ if (match)
1535
+ return cursor += match[0].length, parseFloat(match[1]);
1536
+ cursor -= 1;
1537
+ }
1538
+ }
1539
+ function ignoreWhitespace() {
1540
+ for (; _peek() === " "; )
1541
+ cursor++;
1542
+ }
1543
+ }
1544
+ function renderColor(token, context) {
1545
+ const {
1546
+ bgVar,
1547
+ hue,
1548
+ scheme
1549
+ } = context, result = parseColor$1(token[scheme === "dark" ? 0 : 1]), colorVar = result.color.type === "hue" ? `--${result.color.hue ?? hue}-${result.color.tint}` : `--${result.color.type}`;
1550
+ return result.mix !== void 0 ? `color-mix(in srgb, var(${bgVar}), var(${colorVar}) ${result.mix}%)` : result.opacity !== void 0 ? `color-mix(in srgb, transparent, var(${colorVar}) ${result.opacity * 100}%)` : `var(${colorVar})`;
1551
+ }
1552
+ function buildColor_v3(tokens) {
1553
+ return {
1554
+ dark: buildColorScheme_v3(tokens, {
1555
+ scheme: "dark"
1556
+ }),
1557
+ light: buildColorScheme_v3(tokens, {
1558
+ scheme: "light"
1559
+ })
1560
+ };
1561
+ }
1562
+ function buildColorScheme_v3(tokens, options) {
1563
+ const {
1564
+ scheme
1565
+ } = options;
1566
+ return {
1567
+ card: THEME_COLOR_CARD_TONES.reduce((acc, tone) => (acc[tone] = buildColorCard_v3(tokens[tone], {
1568
+ scheme
1569
+ }), acc), {})
1570
+ };
1571
+ }
1572
+ function buildColorCard_v3(tokens, options) {
1573
+ const {
1574
+ scheme
1575
+ } = options, context = {
1576
+ bgVar: "--color-bg-1",
1577
+ hue: tokens._hue,
1578
+ scheme
1579
+ };
1580
+ return {
1581
+ _hue: tokens._hue ?? "gray",
1582
+ avatar: THEME_COLOR_AVATAR_COLORS.reduce((acc, hue) => {
1583
+ const avatarTokens = tokens.avatar[hue];
1584
+ return acc[hue] = {
1585
+ bg: renderColor(avatarTokens.bg, {
1586
+ bgVar: "--color-bg-1",
1587
+ hue: avatarTokens._hue,
1588
+ scheme
1589
+ }),
1590
+ fg: renderColor(avatarTokens.fg, {
1591
+ bgVar: "--color-bg-1",
1592
+ hue: avatarTokens._hue,
1593
+ scheme
1594
+ })
1595
+ }, acc;
1596
+ }, {}),
1597
+ 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
+ }
1472
1639
  },
1473
- kbd: base.kbd,
1474
- link: base.link,
1475
- muted: {
1476
- ...base.muted,
1477
- bg: color_v0.selectable?.default.enabled.bg2 || color_v0.base.bg
1640
+ focusRing: renderColor(tokens.focusRing, context),
1641
+ shadow: {
1642
+ outline: renderColor(tokens.shadow.outline, context),
1643
+ umbra: renderColor(tokens.shadow.umbra, context),
1644
+ penumbra: renderColor(tokens.shadow.penumbra, context),
1645
+ ambient: renderColor(tokens.shadow.ambient, context)
1478
1646
  },
1479
- selectable: stateTonesThemeColor_v0_v2(color_v0, color_v0.selectable || color_v0.muted),
1480
- shadow: color_v0.base.shadow,
1481
1647
  skeleton: {
1482
- from: color_v0.skeleton?.from || color_v0.base.border,
1483
- to: color_v0.skeleton?.to || color_v0.base.border
1484
- },
1485
- syntax: color_v0.syntax
1648
+ from: renderColor(tokens.skeleton.from, context),
1649
+ to: renderColor(tokens.skeleton.to, context)
1650
+ },
1651
+ variant: {
1652
+ solid: {
1653
+ ...THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
1654
+ ...acc,
1655
+ [tone]: buildColorElement_v3(tokens.variant.solid[tone], {
1656
+ scheme
1657
+ })
1658
+ }), {})
1659
+ },
1660
+ tinted: {
1661
+ ...THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
1662
+ ...acc,
1663
+ [tone]: buildColorElement_v3(tokens.variant.tinted[tone], {
1664
+ scheme
1665
+ })
1666
+ }), {})
1667
+ }
1668
+ }
1486
1669
  };
1487
- return cache$4.set(color_v0, color_v2), color_v2;
1488
1670
  }
1489
- function stateTonesThemeColor_v0_v2(v0, t) {
1671
+ function buildColorElement_v3(tokens, options) {
1672
+ const {
1673
+ scheme
1674
+ } = options, context = {
1675
+ bgVar: "--bg",
1676
+ hue: tokens._hue,
1677
+ scheme
1678
+ };
1490
1679
  return {
1680
+ _hue: tokens._hue ?? "gray",
1681
+ bg: {
1682
+ 0: renderColor(tokens.bg[0], context),
1683
+ 4: renderColor(tokens.bg[4], context)
1684
+ },
1685
+ border: {
1686
+ 0: renderColor(tokens.border[0], context),
1687
+ 4: renderColor(tokens.border[4], context)
1688
+ },
1689
+ fg: {
1690
+ 0: renderColor(tokens.fg[0], context),
1691
+ 4: renderColor(tokens.fg[4], context)
1692
+ }
1693
+ };
1694
+ }
1695
+ const defaultTokens = {
1696
+ color: {
1697
+ "*": {
1698
+ // backdrop: ['black/0.2', '200/0.2'],
1699
+ 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"],
1742
+ link: {
1743
+ fg: ["blue/400", "blue/600"]
1744
+ },
1745
+ shadow: {
1746
+ outline: ["500/0.4", "500/0.3"],
1747
+ umbra: ["black/0.2", "500/0.1"],
1748
+ penumbra: ["black/0.14", "500/0.07"],
1749
+ ambient: ["black/0.12", "500/0.06"]
1750
+ },
1751
+ variant: {
1752
+ tinted: {
1753
+ "*": {
1754
+ bg: {
1755
+ 0: ["950", "50"],
1756
+ 4: ["800", "200"]
1757
+ },
1758
+ border: {
1759
+ 0: ["700", "100"],
1760
+ 4: ["500", "300"]
1761
+ },
1762
+ fg: {
1763
+ 0: ["100", "900"],
1764
+ 4: ["300", "700"]
1765
+ }
1766
+ },
1767
+ primary: {
1768
+ _hue: "blue"
1769
+ },
1770
+ suggest: {
1771
+ _hue: "purple"
1772
+ },
1773
+ positive: {
1774
+ _hue: "green"
1775
+ },
1776
+ caution: {
1777
+ _hue: "yellow"
1778
+ },
1779
+ critical: {
1780
+ _hue: "red"
1781
+ }
1782
+ },
1783
+ solid: {
1784
+ "*": {
1785
+ bg: {
1786
+ 0: ["400", "500"],
1787
+ 4: ["300", "600"]
1788
+ },
1789
+ border: {
1790
+ 0: ["200", "400"],
1791
+ 4: ["100", "500"]
1792
+ },
1793
+ fg: {
1794
+ 0: ["black", "white"],
1795
+ 4: ["600", "400"]
1796
+ }
1797
+ },
1798
+ default: {
1799
+ bg: {
1800
+ 0: ["200", "800"],
1801
+ 4: ["white", "black"]
1802
+ },
1803
+ border: {
1804
+ 0: ["300", "700"],
1805
+ 4: ["200", "800"]
1806
+ }
1807
+ },
1808
+ primary: {
1809
+ _hue: "blue"
1810
+ },
1811
+ suggest: {
1812
+ _hue: "purple"
1813
+ },
1814
+ positive: {
1815
+ _hue: "green"
1816
+ },
1817
+ caution: {
1818
+ _hue: "yellow"
1819
+ },
1820
+ critical: {
1821
+ _hue: "red"
1822
+ }
1823
+ }
1824
+ }
1825
+ },
1826
+ transparent: {
1827
+ variant: {
1828
+ tinted: {
1829
+ "*": {
1830
+ bg: {
1831
+ 0: ["black", "gray/50"],
1832
+ 4: ["800", "300 50%"]
1833
+ },
1834
+ border: {
1835
+ 0: ["800", "300 40%"],
1836
+ 4: ["600", "300"]
1837
+ },
1838
+ fg: {
1839
+ 0: ["100", "black"],
1840
+ 4: ["400", "700"]
1841
+ }
1842
+ }
1843
+ }
1844
+ }
1845
+ },
1491
1846
  default: {
1492
- enabled: stateThemeColor_v0_v2(v0, t.default.enabled),
1493
- hovered: stateThemeColor_v0_v2(v0, t.default.hovered),
1494
- pressed: stateThemeColor_v0_v2(v0, t.default.pressed),
1495
- selected: stateThemeColor_v0_v2(v0, t.default.selected),
1496
- disabled: stateThemeColor_v0_v2(v0, t.default.disabled)
1847
+ variant: {
1848
+ tinted: {
1849
+ "*": {
1850
+ bg: {
1851
+ 0: ["950", "white"],
1852
+ 4: ["800", "200"]
1853
+ },
1854
+ border: {
1855
+ 0: ["800", "100"],
1856
+ 4: ["600", "300"]
1857
+ },
1858
+ fg: {
1859
+ 0: ["white", "black"],
1860
+ 4: ["400", "600"]
1861
+ }
1862
+ }
1863
+ }
1864
+ }
1865
+ },
1866
+ neutral: {
1867
+ variant: {
1868
+ tinted: {
1869
+ "*": {
1870
+ bg: {
1871
+ 0: ["900", "50"],
1872
+ 4: ["700", "200"]
1873
+ }
1874
+ }
1875
+ }
1876
+ }
1497
1877
  },
1498
1878
  primary: {
1499
- enabled: stateThemeColor_v0_v2(v0, t.primary.enabled),
1500
- hovered: stateThemeColor_v0_v2(v0, t.primary.hovered),
1501
- pressed: stateThemeColor_v0_v2(v0, t.primary.pressed),
1502
- selected: stateThemeColor_v0_v2(v0, t.primary.selected),
1503
- disabled: stateThemeColor_v0_v2(v0, t.primary.disabled)
1879
+ _hue: "blue"
1880
+ },
1881
+ suggest: {
1882
+ _hue: "purple"
1504
1883
  },
1505
1884
  positive: {
1506
- enabled: stateThemeColor_v0_v2(v0, t.positive.enabled),
1507
- hovered: stateThemeColor_v0_v2(v0, t.positive.hovered),
1508
- pressed: stateThemeColor_v0_v2(v0, t.positive.pressed),
1509
- selected: stateThemeColor_v0_v2(v0, t.positive.selected),
1510
- disabled: stateThemeColor_v0_v2(v0, t.positive.disabled)
1885
+ _hue: "green"
1511
1886
  },
1512
1887
  caution: {
1513
- enabled: stateThemeColor_v0_v2(v0, t.caution.enabled),
1514
- hovered: stateThemeColor_v0_v2(v0, t.caution.hovered),
1515
- pressed: stateThemeColor_v0_v2(v0, t.caution.pressed),
1516
- selected: stateThemeColor_v0_v2(v0, t.caution.selected),
1517
- disabled: stateThemeColor_v0_v2(v0, t.caution.disabled)
1888
+ _hue: "yellow"
1518
1889
  },
1519
1890
  critical: {
1520
- enabled: stateThemeColor_v0_v2(v0, t.critical.enabled),
1521
- hovered: stateThemeColor_v0_v2(v0, t.critical.hovered),
1522
- pressed: stateThemeColor_v0_v2(v0, t.critical.pressed),
1523
- selected: stateThemeColor_v0_v2(v0, t.critical.selected),
1524
- disabled: stateThemeColor_v0_v2(v0, t.critical.disabled)
1891
+ _hue: "red"
1892
+ }
1893
+ }
1894
+ };
1895
+ function merge(...records) {
1896
+ return records.filter(Boolean).reduce(_merge, {});
1897
+ }
1898
+ function _merge(acc, source) {
1899
+ for (const key of Object.keys(source)) {
1900
+ const prevValue = acc[key], nextValue = source[key];
1901
+ isRecord(prevValue) && isRecord(nextValue) ? acc[key] = merge(prevValue, nextValue) : acc[key] = nextValue;
1902
+ }
1903
+ return acc;
1904
+ }
1905
+ function isRecord(value) {
1906
+ return value !== null && typeof value == "object" && !Array.isArray(value);
1907
+ }
1908
+ const defaultElementTokens = {
1909
+ bg: {
1910
+ 0: ["950", "50"],
1911
+ 4: ["700", "300"]
1912
+ },
1913
+ border: {
1914
+ 0: ["700", "300"],
1915
+ 4: ["400", "600"]
1916
+ },
1917
+ fg: {
1918
+ 0: ["100", "900"],
1919
+ 4: ["400", "600"]
1920
+ }
1921
+ };
1922
+ function resolveTokens(tokens = {}) {
1923
+ return {
1924
+ color: {
1925
+ "*": resolveCardColorTokens(tokens.color?.["*"]),
1926
+ ...THEME_COLOR_CARD_TONES.reduce((acc, tone) => ({
1927
+ ...acc,
1928
+ [tone]: resolveCardColorTokens(merge(tokens.color?.["*"], tokens.color?.[tone]))
1929
+ }), {})
1525
1930
  }
1526
1931
  };
1527
1932
  }
1528
- function stateThemeColor_v0_v2(v0, state) {
1933
+ function resolveCardColorTokens(tokens) {
1529
1934
  return {
1530
- ...state,
1935
+ _hue: tokens?._hue ?? "gray",
1531
1936
  avatar: {
1532
1937
  gray: {
1533
- bg: v0.spot.gray,
1534
- fg: v0.base.bg
1938
+ _hue: tokens?.avatar?.gray?._hue ?? "gray",
1939
+ bg: tokens?.avatar?.gray?.bg ?? ["400", "400"],
1940
+ fg: tokens?.avatar?.gray?.fg ?? ["900", "900"]
1535
1941
  },
1536
1942
  blue: {
1537
- bg: v0.spot.blue,
1538
- fg: v0.base.bg
1943
+ _hue: tokens?.avatar?.blue?._hue ?? "blue",
1944
+ bg: tokens?.avatar?.blue?.bg ?? ["400", "400"],
1945
+ fg: tokens?.avatar?.blue?.fg ?? ["900", "900"]
1539
1946
  },
1540
1947
  purple: {
1541
- bg: v0.spot.purple,
1542
- fg: v0.base.bg
1948
+ _hue: tokens?.avatar?.purple?._hue ?? "purple",
1949
+ bg: tokens?.avatar?.purple?.bg ?? ["400", "400"],
1950
+ fg: tokens?.avatar?.purple?.fg ?? ["900", "900"]
1543
1951
  },
1544
1952
  magenta: {
1545
- bg: v0.spot.magenta,
1546
- fg: v0.base.bg
1953
+ _hue: tokens?.avatar?.magenta?._hue ?? "magenta",
1954
+ bg: tokens?.avatar?.magenta?.bg ?? ["400", "400"],
1955
+ fg: tokens?.avatar?.magenta?.fg ?? ["900", "900"]
1547
1956
  },
1548
1957
  red: {
1549
- bg: v0.spot.red,
1550
- fg: v0.base.bg
1958
+ _hue: tokens?.avatar?.red?._hue ?? "red",
1959
+ bg: tokens?.avatar?.red?.bg ?? ["400", "400"],
1960
+ fg: tokens?.avatar?.red?.fg ?? ["900", "900"]
1551
1961
  },
1552
1962
  orange: {
1553
- bg: v0.spot.orange,
1554
- fg: v0.base.bg
1963
+ _hue: tokens?.avatar?.orange?._hue ?? "orange",
1964
+ bg: tokens?.avatar?.orange?.bg ?? ["400", "400"],
1965
+ fg: tokens?.avatar?.orange?.fg ?? ["900", "900"]
1555
1966
  },
1556
1967
  yellow: {
1557
- bg: v0.spot.yellow,
1558
- fg: v0.base.bg
1968
+ _hue: tokens?.avatar?.yellow?._hue ?? "yellow",
1969
+ bg: tokens?.avatar?.yellow?.bg ?? ["400", "400"],
1970
+ fg: tokens?.avatar?.yellow?.fg ?? ["900", "900"]
1559
1971
  },
1560
1972
  green: {
1561
- bg: v0.spot.green,
1562
- fg: v0.base.bg
1973
+ _hue: tokens?.avatar?.green?._hue ?? "green",
1974
+ bg: tokens?.avatar?.green?.bg ?? ["400", "400"],
1975
+ fg: tokens?.avatar?.green?.fg ?? ["900", "900"]
1563
1976
  },
1564
1977
  cyan: {
1565
- bg: v0.spot.cyan,
1566
- fg: v0.base.bg
1978
+ _hue: tokens?.avatar?.cyan?._hue ?? "cyan",
1979
+ bg: tokens?.avatar?.cyan?.bg ?? ["400", "400"],
1980
+ fg: tokens?.avatar?.cyan?.fg ?? ["900", "900"]
1567
1981
  }
1568
1982
  },
1569
- badge: {
1570
- default: {
1571
- bg: v0.muted.default.enabled.bg,
1572
- fg: v0.muted.default.enabled.fg,
1573
- dot: v0.muted.default.enabled.muted.fg,
1574
- icon: v0.muted.default.enabled.muted.fg
1983
+ 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
+ focusRing: tokens?.focusRing ?? ["500", "500"],
2027
+ link: {
2028
+ fg: tokens?.link?.fg ?? ["400", "600"]
2029
+ },
2030
+ shadow: {
2031
+ outline: tokens?.shadow?.outline ?? ["500", "500"],
2032
+ umbra: tokens?.shadow?.umbra ?? ["500", "500"],
2033
+ penumbra: tokens?.shadow?.penumbra ?? ["500", "500"],
2034
+ ambient: tokens?.shadow?.ambient ?? ["500", "500"]
2035
+ },
2036
+ skeleton: {
2037
+ from: tokens?.skeleton?.from ?? ["900", "100"],
2038
+ to: tokens?.skeleton?.to ?? ["950", "50"]
2039
+ },
2040
+ variant: {
2041
+ solid: {
2042
+ "*": resolveElementTokens(tokens?.variant?.solid?.["*"]),
2043
+ ...THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = resolveElementTokens(merge(tokens, tokens?.variant?.solid?.["*"], tokens?.variant?.solid?.[tone])), acc), {})
1575
2044
  },
1576
- primary: {
1577
- bg: v0.muted.primary.enabled.bg,
1578
- fg: v0.muted.primary.enabled.fg,
1579
- dot: v0.muted.primary.enabled.muted.fg,
1580
- icon: v0.muted.primary.enabled.muted.fg
1581
- },
1582
- positive: {
1583
- bg: v0.muted.positive.enabled.bg,
1584
- fg: v0.muted.positive.enabled.fg,
1585
- dot: v0.muted.positive.enabled.muted.fg,
1586
- icon: v0.muted.positive.enabled.muted.fg
1587
- },
1588
- caution: {
1589
- bg: v0.muted.caution.enabled.bg,
1590
- fg: v0.muted.caution.enabled.fg,
1591
- dot: v0.muted.caution.enabled.muted.fg,
1592
- icon: v0.muted.caution.enabled.muted.fg
1593
- },
1594
- critical: {
1595
- bg: v0.muted.critical.enabled.bg,
1596
- fg: v0.muted.critical.enabled.fg,
1597
- dot: v0.muted.critical.enabled.muted.fg,
1598
- icon: v0.muted.critical.enabled.muted.fg
2045
+ tinted: {
2046
+ "*": resolveElementTokens(tokens?.variant?.tinted?.["*"]),
2047
+ ...THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = resolveElementTokens(merge(tokens, tokens?.variant?.tinted?.["*"], tokens?.variant?.tinted?.[tone])), acc), {})
1599
2048
  }
1600
- },
1601
- kbd: {
1602
- bg: v0.muted.default.enabled.bg,
1603
- fg: v0.muted.default.enabled.fg,
1604
- border: v0.muted.default.enabled.border
1605
- },
1606
- muted: {
1607
- ...v0.muted.default.enabled.muted,
1608
- bg: state.bg2 || state.bg
1609
- },
1610
- skeleton: {
1611
- from: state.skeleton?.from || state.border,
1612
- to: state.skeleton?.to || state.border
1613
2049
  }
1614
2050
  };
1615
2051
  }
1616
- function inputStatesThemeColor_v0_v2(states) {
1617
- return {
1618
- enabled: inputStateThemeColor_v0_v2(states.enabled),
1619
- disabled: inputStateThemeColor_v0_v2(states.disabled),
1620
- readOnly: inputStateThemeColor_v0_v2(states.readOnly),
1621
- hovered: inputStateThemeColor_v0_v2(states.hovered)
1622
- };
1623
- }
1624
- function inputStateThemeColor_v0_v2(state) {
2052
+ function resolveElementTokens(tokens) {
1625
2053
  return {
1626
- bg: state.bg,
1627
- border: state.border,
1628
- fg: state.fg,
1629
- muted: {
1630
- bg: state.bg2
1631
- },
1632
- placeholder: state.placeholder
1633
- };
1634
- }
1635
- const cache$3 = /* @__PURE__ */ new WeakMap();
1636
- function getTheme_v2(theme) {
1637
- if (theme.sanity.v2?._resolved) return theme.sanity.v2;
1638
- const cached_v2 = cache$3.get(theme);
1639
- if (cached_v2) return cached_v2;
1640
- const v2 = {
1641
- _version: 2,
1642
- _resolved: !0,
1643
- avatar: {
1644
- ...defaultThemeConfig.avatar,
1645
- ...theme.sanity.avatar
2054
+ _hue: tokens?._hue ?? "gray",
2055
+ bg: {
2056
+ 0: tokens?.bg?.[0] ?? defaultElementTokens.bg[0],
2057
+ 4: tokens?.bg?.[4] ?? defaultElementTokens.bg[4]
1646
2058
  },
1647
- button: {
1648
- ...defaultThemeConfig.button,
1649
- ...theme.sanity.button
1650
- },
1651
- card: defaultThemeConfig.card,
1652
- color: themeColor_v0_v2(theme.sanity.color),
1653
- container: theme.sanity.container,
1654
- font: theme.sanity.fonts,
1655
- input: {
1656
- ...defaultThemeConfig.input,
1657
- ...theme.sanity.input,
1658
- checkbox: {
1659
- ...defaultThemeConfig.input.checkbox,
1660
- ...theme.sanity.input.checkbox
1661
- },
1662
- radio: {
1663
- ...defaultThemeConfig.input.radio,
1664
- ...theme.sanity.input.radio
1665
- },
1666
- switch: {
1667
- ...defaultThemeConfig.input.switch,
1668
- ...theme.sanity.input.switch
1669
- }
2059
+ border: {
2060
+ 0: tokens?.border?.[0] ?? defaultElementTokens.border[0],
2061
+ 4: tokens?.border?.[4] ?? defaultElementTokens.border[4]
1670
2062
  },
1671
- layer: theme.sanity.layer ?? defaultThemeConfig.layer,
1672
- media: theme.sanity.media,
1673
- radius: theme.sanity.radius,
1674
- shadow: theme.sanity.shadows,
1675
- space: theme.sanity.space,
1676
- style: theme.sanity.styles
2063
+ fg: {
2064
+ 0: tokens?.fg?.[0] ?? defaultElementTokens.fg[0],
2065
+ 4: tokens?.fg?.[4] ?? defaultElementTokens.fg[4]
2066
+ }
1677
2067
  };
1678
- return cache$3.set(theme, v2), v2;
1679
- }
1680
- function is_v0(themeProp) {
1681
- return themeProp._version === 0;
1682
2068
  }
1683
- function is_v2(themeProp) {
1684
- return themeProp._version === 2;
1685
- }
1686
- const cache$2 = /* @__PURE__ */ new WeakMap();
1687
- function v0_v2(v0) {
1688
- if (v0.v2) return v0.v2;
1689
- const cached_v2 = cache$2.get(v0);
1690
- if (cached_v2) return cached_v2;
2069
+ function buildTheme_v3(options) {
1691
2070
  const {
1692
- avatar,
1693
- button,
1694
- color: color2,
1695
- container,
1696
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1697
- focusRing: _unused_focusRing,
1698
- fonts: font,
1699
- input,
1700
- layer,
1701
- media,
1702
- radius,
1703
- shadows: shadow,
1704
- space,
1705
- styles: style
1706
- } = v0, v2 = {
1707
- _version: 2,
1708
- avatar: {
1709
- ...defaultThemeConfig.avatar,
1710
- ...avatar
1711
- },
1712
- button: {
1713
- ...defaultThemeConfig.button,
1714
- ...button
1715
- },
1716
- card: defaultThemeConfig.card,
1717
- color: {
1718
- light: {
1719
- transparent: themeColor_v0_v2(color2.light.transparent),
1720
- default: themeColor_v0_v2(color2.light.default),
1721
- primary: themeColor_v0_v2(color2.light.primary),
1722
- positive: themeColor_v0_v2(color2.light.positive),
1723
- caution: themeColor_v0_v2(color2.light.caution),
1724
- critical: themeColor_v0_v2(color2.light.critical)
1725
- },
1726
- dark: {
1727
- transparent: themeColor_v0_v2(color2.dark.transparent),
1728
- default: themeColor_v0_v2(color2.dark.default),
1729
- primary: themeColor_v0_v2(color2.dark.primary),
1730
- positive: themeColor_v0_v2(color2.dark.positive),
1731
- caution: themeColor_v0_v2(color2.dark.caution),
1732
- critical: themeColor_v0_v2(color2.dark.critical)
1733
- }
1734
- },
1735
- container,
1736
- font,
1737
- input: {
1738
- ...defaultThemeConfig.input,
1739
- ...input,
1740
- checkbox: {
1741
- ...defaultThemeConfig.input.checkbox,
1742
- ...input.checkbox
1743
- },
1744
- radio: {
1745
- ...defaultThemeConfig.input.radio,
1746
- ...input.radio
1747
- },
1748
- switch: {
1749
- ...defaultThemeConfig.input.switch,
1750
- ...input.switch
1751
- }
1752
- },
1753
- layer: layer ?? defaultThemeConfig.layer,
1754
- media,
1755
- radius,
1756
- shadow,
1757
- space,
1758
- style
1759
- };
1760
- return cache$2.set(v0, v2), v2;
1761
- }
1762
- const cache$1 = /* @__PURE__ */ new WeakMap();
1763
- function v2_v0(v2) {
1764
- const cachedTheme = cache$1.get(v2);
2071
+ v2
2072
+ } = options ?? {}, tokens = resolveTokens(options?.tokens ?? defaultTokens);
2073
+ return {
2074
+ _version: 3,
2075
+ _tokens: tokens,
2076
+ avatar: v2?.avatar ?? defaultThemeConfig.avatar,
2077
+ button: v2?.button ?? defaultThemeConfig.button,
2078
+ card: v2?.card ?? defaultThemeConfig.card,
2079
+ color: buildColor_v3(tokens.color),
2080
+ container: v2?.container ?? defaultThemeConfig.container,
2081
+ font: v2?.font ?? defaultThemeFonts,
2082
+ input: v2?.input ?? defaultThemeConfig.input,
2083
+ layer: v2?.layer ?? defaultThemeConfig.layer,
2084
+ media: v2?.media ?? defaultThemeConfig.media,
2085
+ radius: v2?.radius ?? defaultThemeConfig.radius,
2086
+ shadow: v2?.shadow ?? defaultThemeConfig.shadow,
2087
+ space: v2?.space ?? defaultThemeConfig.space
2088
+ };
2089
+ }
2090
+ const cache$4 = /* @__PURE__ */ new WeakMap();
2091
+ function v2_v0(v2, v3) {
2092
+ const cachedTheme = cache$4.get(v2);
1765
2093
  if (cachedTheme) return cachedTheme;
1766
2094
  const {
1767
2095
  avatar,
1768
2096
  button,
1769
- color: color2,
2097
+ color,
1770
2098
  container,
1771
2099
  font: fonts,
1772
2100
  input,
@@ -1783,20 +2111,20 @@ function v2_v0(v2) {
1783
2111
  container,
1784
2112
  color: {
1785
2113
  light: {
1786
- transparent: themeColor_v2_v0(color2.light.transparent),
1787
- default: themeColor_v2_v0(color2.light.default),
1788
- primary: themeColor_v2_v0(color2.light.primary),
1789
- positive: themeColor_v2_v0(color2.light.positive),
1790
- caution: themeColor_v2_v0(color2.light.caution),
1791
- critical: themeColor_v2_v0(color2.light.critical)
2114
+ transparent: themeColor_v2_v0(color.light.transparent),
2115
+ default: themeColor_v2_v0(color.light.default),
2116
+ primary: themeColor_v2_v0(color.light.primary),
2117
+ positive: themeColor_v2_v0(color.light.positive),
2118
+ caution: themeColor_v2_v0(color.light.caution),
2119
+ critical: themeColor_v2_v0(color.light.critical)
1792
2120
  },
1793
2121
  dark: {
1794
- transparent: themeColor_v2_v0(color2.dark.transparent),
1795
- default: themeColor_v2_v0(color2.dark.default),
1796
- primary: themeColor_v2_v0(color2.dark.primary),
1797
- positive: themeColor_v2_v0(color2.dark.positive),
1798
- caution: themeColor_v2_v0(color2.dark.caution),
1799
- critical: themeColor_v2_v0(color2.dark.critical)
2122
+ transparent: themeColor_v2_v0(color.dark.transparent),
2123
+ default: themeColor_v2_v0(color.dark.default),
2124
+ primary: themeColor_v2_v0(color.dark.primary),
2125
+ positive: themeColor_v2_v0(color.dark.positive),
2126
+ caution: themeColor_v2_v0(color.dark.caution),
2127
+ critical: themeColor_v2_v0(color.dark.critical)
1800
2128
  }
1801
2129
  },
1802
2130
  focusRing: input.text.focusRing,
@@ -1807,7 +2135,8 @@ function v2_v0(v2) {
1807
2135
  shadows,
1808
2136
  space,
1809
2137
  styles,
1810
- v2
2138
+ v2,
2139
+ v3
1811
2140
  };
1812
2141
  }
1813
2142
  function themeColor_v2_v0(color_v2) {
@@ -1866,67 +2195,425 @@ function inputStateThemeColor_v2_v0(t) {
1866
2195
  placeholder: t.placeholder
1867
2196
  };
1868
2197
  }
1869
- const AVATAR_SIZE = [0, 1, 2, 3], CONTAINER = [0, 1, 2, 3, 4, 5], 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, 5], FONT_HEADING_SIZE = [0, 1, 2, 3, 4, 5, 6], FONT_LABEL_SIZE = [0, 1, 2, 3, 4, 5, 6], FONT_TEXT_SIZE = [0, 1, 2, 3, 4, 5], SHADOW = [0, 1, 2, 3, 4, 5], THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = ["transparent", "default", "primary", "positive", "caution", "critical"], THEME_COLOR_STATE_TONES = ["default", "primary", "positive", "caution", "critical"], 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;
1870
- function isColorBlendModeValue(str) {
1871
- return THEME_COLOR_BLEND_MODES.includes(str);
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
+ };
1872
2231
  }
1873
- function isColorHueKey(str) {
1874
- return COLOR_HUES.includes(str);
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}%)`;
1875
2261
  }
1876
- function isColorTintKey(str) {
1877
- return COLOR_TINTS.includes(str);
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
+ };
1878
2302
  }
1879
- function isColorButtonMode(str) {
1880
- return THEME_COLOR_BUTTON_MODES.includes(str);
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
+ };
1881
2313
  }
1882
- const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "accent/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to", "status/dot", "status/icon"], COLOR_CONFIG_CARD_KEYS = [...COLOR_CONFIG_STATE_KEYS, "_hue", "bg", "fg", "border", "focusRing", "shadow/outline", "shadow/umbra", "shadow/penumbra", "shadow/ambient"], COLOR_CONFIG_BLEND_KEYS = ["_blend"], COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS], COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES], COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES], COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES], COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES], COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
1883
- function parseTokenKey(str) {
1884
- const segments = str.split("/"), segment0 = segments.shift() || "";
1885
- if (isColorConfigBaseTone(segment0)) {
1886
- const key = segments.join("/");
1887
- if (isColorConfigBaseKey(key))
1888
- return {
1889
- type: "base",
1890
- tone: segment0,
1891
- key
1892
- };
1893
- if (isColorConfigBlendKey(key))
1894
- return {
1895
- type: "base",
1896
- tone: segment0,
1897
- key
1898
- };
1899
- }
1900
- if (segment0 === "button") {
1901
- const segment1 = segments.shift() || "";
1902
- if (isColorConfigStateTone(segment1)) {
1903
- const segment2 = segments.shift() || "";
1904
- if (isColorButtonMode(segment2)) {
1905
- const key = segments.join("/");
1906
- if (isColorConfigStateKey(key))
1907
- return {
1908
- type: "button",
1909
- tone: segment1,
1910
- mode: segment2,
1911
- key
1912
- };
1913
- if (isColorConfigBlendKey(key))
1914
- return {
1915
- type: "button",
1916
- tone: segment1,
1917
- mode: segment2,
1918
- key
1919
- };
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
+ })
1920
2404
  }
1921
- }
1922
- }
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
+ };
1923
2415
  }
1924
- function isColorMixPercentValue(str) {
1925
- return /^\d+%$/.test(str);
2416
+ function buildTheme(_config) {
2417
+ const v3 = buildTheme_v3({
2418
+ v2: _config
2419
+ });
2420
+ return v2_v0(v3_v2(v3), v3);
1926
2421
  }
1927
- function parseTokenValue(str) {
1928
- const segments = str.split("/");
1929
- let nextSegment = segments.shift() || "";
2422
+ function mixChannel(b, s, weight) {
2423
+ const delta = (s - b) * weight;
2424
+ return b + delta;
2425
+ }
2426
+ function mix(b, s, weight) {
2427
+ return {
2428
+ r: mixChannel(b.r, s.r, weight),
2429
+ g: mixChannel(b.g, s.g, weight),
2430
+ b: mixChannel(b.b, s.b, weight)
2431
+ };
2432
+ }
2433
+ function multiplyChannel(b, s) {
2434
+ return b * s;
2435
+ }
2436
+ function multiply(b, s) {
2437
+ return {
2438
+ r: multiplyChannel(b.r / 255, s.r / 255) * 255,
2439
+ g: multiplyChannel(b.g / 255, s.g / 255) * 255,
2440
+ b: multiplyChannel(b.b / 255, s.b / 255) * 255
2441
+ };
2442
+ }
2443
+ function screenChannel(b, s) {
2444
+ return b + s - b * s;
2445
+ }
2446
+ function screen(b, s) {
2447
+ return {
2448
+ r: screenChannel(b.r / 255, s.r / 255) * 255,
2449
+ g: screenChannel(b.g / 255, s.g / 255) * 255,
2450
+ b: screenChannel(b.b / 255, s.b / 255) * 255
2451
+ };
2452
+ }
2453
+ function clamp(a, min = 0, max = 1) {
2454
+ return Math.min(max, Math.max(min, a));
2455
+ }
2456
+ function round(value) {
2457
+ return Math.round(value);
2458
+ }
2459
+ function hexToRgb(hex) {
2460
+ if (hex.length === 4) {
2461
+ const hexR = hex.slice(1, 2), hexG = hex.slice(2, 3), hexB = hex.slice(3, 4);
2462
+ return {
2463
+ r: parseInt(hexR + hexR, 16),
2464
+ g: parseInt(hexG + hexG, 16),
2465
+ b: parseInt(hexB + hexB, 16)
2466
+ };
2467
+ }
2468
+ return {
2469
+ r: parseInt(hex.slice(1, 3), 16),
2470
+ g: parseInt(hex.slice(3, 5), 16),
2471
+ b: parseInt(hex.slice(5, 7), 16)
2472
+ };
2473
+ }
2474
+ function rgbaToRGBA(rgba2) {
2475
+ const values = rgba2.replace(/rgba\(|\)/g, "").split(",");
2476
+ return {
2477
+ r: parseInt(values[0]),
2478
+ g: parseInt(values[1]),
2479
+ b: parseInt(values[2]),
2480
+ a: parseFloat(values[3])
2481
+ };
2482
+ }
2483
+ function rgbToHex(color) {
2484
+ const r = round(clamp(Math.round(color.r), 0, 255)), g = round(clamp(Math.round(color.g), 0, 255)), b = round(clamp(Math.round(color.b), 0, 255));
2485
+ return "a" in color ? `rgba(${r},${g},${b},${color.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
2486
+ }
2487
+ function rgbToHsl({
2488
+ r,
2489
+ g,
2490
+ b
2491
+ }) {
2492
+ r /= 255, g /= 255, b /= 255;
2493
+ const cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin;
2494
+ let h = 0, s = 0, l = 0;
2495
+ return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), {
2496
+ h,
2497
+ s,
2498
+ l
2499
+ };
2500
+ }
2501
+ function hslToRgb(hsl) {
2502
+ const s = hsl.s / 100, l = hsl.l / 100, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hsl.h / 60 % 2 - 1)), m = l - c / 2;
2503
+ let r = 0, g = 0, b = 0;
2504
+ return 0 <= hsl.h && hsl.h < 60 ? (r = c, g = x, b = 0) : 60 <= hsl.h && hsl.h < 120 ? (r = x, g = c, b = 0) : 120 <= hsl.h && hsl.h < 180 ? (r = 0, g = c, b = x) : 180 <= hsl.h && hsl.h < 240 ? (r = 0, g = x, b = c) : 240 <= hsl.h && hsl.h < 300 ? (r = x, g = 0, b = c) : 300 <= hsl.h && hsl.h < 360 && (r = c, g = 0, b = x), {
2505
+ r: Math.round((r + m) * 255),
2506
+ g: Math.round((g + m) * 255),
2507
+ b: Math.round((b + m) * 255)
2508
+ };
2509
+ }
2510
+ const HEX_CHARS = "0123456789ABCDEFabcdef", HSL_RE = /hsl\(\s*(\d+)\s*,\s*((\d+(?:\.\d+)?)%)\s*,\s*((\d+(?:\.\d+)?)%)\s*\)/i;
2511
+ function isHexChars(str) {
2512
+ for (const c of str)
2513
+ if (HEX_CHARS.indexOf(c) === -1)
2514
+ return !1;
2515
+ return !0;
2516
+ }
2517
+ function isHex(str) {
2518
+ return str[0] !== "#" || !(str.length === 4 || str.length === 7) ? !1 : isHexChars(str.slice(1));
2519
+ }
2520
+ function parseHsl(str) {
2521
+ const res = HSL_RE.exec(str);
2522
+ if (!res)
2523
+ throw new Error(`parseHsl: string is not a HSL color: "${str}"`);
2524
+ return {
2525
+ h: parseInt(res[1]),
2526
+ s: parseFloat(res[3]),
2527
+ l: parseFloat(res[5])
2528
+ };
2529
+ }
2530
+ function parseColor(color) {
2531
+ if (!color) return {
2532
+ r: 0,
2533
+ g: 0,
2534
+ b: 0
2535
+ };
2536
+ if (typeof color != "string")
2537
+ throw new Error("parseColor: expected a string");
2538
+ if (isHex(color))
2539
+ return hexToRgb(color);
2540
+ if (color.startsWith("hsl("))
2541
+ return hslToRgb(parseHsl(color));
2542
+ if (color.startsWith("rgba("))
2543
+ return rgbaToRGBA(color);
2544
+ throw new Error(`parseColor: unexpected color format: "${color}"`);
2545
+ }
2546
+ function getContrastRatio(bg, fg) {
2547
+ const rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
2548
+ return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
2549
+ }
2550
+ function rgb_lrgb({
2551
+ r,
2552
+ g,
2553
+ b
2554
+ }) {
2555
+ return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
2556
+ }
2557
+ function rgb_lrgb1(v) {
2558
+ return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
2559
+ }
2560
+ function lrgb_luminance([r, g, b]) {
2561
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
2562
+ }
2563
+ function rgba(color, a) {
2564
+ if (typeof color == "string" && color.startsWith("var("))
2565
+ return `color-mix(in srgb, transparent, ${color} ${a * 100}%)`;
2566
+ const rgb = parseColor(color);
2567
+ return `rgba(${rgb.r},${rgb.g},${rgb.b},${a})`;
2568
+ }
2569
+ const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "accent/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to", "status/dot", "status/icon"], COLOR_CONFIG_CARD_KEYS = [...COLOR_CONFIG_STATE_KEYS, "_hue", "bg", "fg", "border", "focusRing", "shadow/outline", "shadow/umbra", "shadow/penumbra", "shadow/ambient"], COLOR_CONFIG_BLEND_KEYS = ["_blend"], COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS], COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES], COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES], COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES], COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES], COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
2570
+ function parseTokenKey(str) {
2571
+ const segments = str.split("/"), segment0 = segments.shift() || "";
2572
+ if (isColorConfigBaseTone(segment0)) {
2573
+ const key = segments.join("/");
2574
+ if (isColorConfigBaseKey(key))
2575
+ return {
2576
+ type: "base",
2577
+ tone: segment0,
2578
+ key
2579
+ };
2580
+ if (isColorConfigBlendKey(key))
2581
+ return {
2582
+ type: "base",
2583
+ tone: segment0,
2584
+ key
2585
+ };
2586
+ }
2587
+ if (segment0 === "button") {
2588
+ const segment1 = segments.shift() || "";
2589
+ if (isColorConfigStateTone(segment1)) {
2590
+ const segment2 = segments.shift() || "";
2591
+ if (isColorButtonMode(segment2)) {
2592
+ const key = segments.join("/");
2593
+ if (isColorConfigStateKey(key))
2594
+ return {
2595
+ type: "button",
2596
+ tone: segment1,
2597
+ mode: segment2,
2598
+ key
2599
+ };
2600
+ if (isColorConfigBlendKey(key))
2601
+ return {
2602
+ type: "button",
2603
+ tone: segment1,
2604
+ mode: segment2,
2605
+ key
2606
+ };
2607
+ }
2608
+ }
2609
+ }
2610
+ }
2611
+ function isColorMixPercentValue(str) {
2612
+ return /^\d+%$/.test(str);
2613
+ }
2614
+ function parseTokenValue(str) {
2615
+ const segments = str.split("/");
2616
+ let nextSegment = segments.shift() || "";
1930
2617
  const [segment0, segment0mix] = nextSegment.split(" ");
1931
2618
  if (isColorTintKey(segment0)) {
1932
2619
  const tint = segment0, segment1 = segments.shift() || "";
@@ -2039,2077 +2726,341 @@ function isColorValue(str) {
2039
2726
  function isColorOpacityValue(str) {
2040
2727
  return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
2041
2728
  }
2042
- function compileColorTokenValue(node) {
2043
- let key = "";
2044
- return node.key === "black" || node.key === "white" ? key = node.key : key = `${node.hue}/${node.tint}`, node.mix !== void 0 ? `${key} ${node.mix * 100}%` : (node.opacity !== void 0 && (key += `/${node.opacity}`), key);
2045
- }
2046
- const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
2047
- function resolveColorTokenValue(context, value = DEFAULT_COLOR_TOKEN_VALUE) {
2048
- const {
2049
- hue,
2050
- scheme
2051
- } = context, node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
2052
- if (!node || node.type !== "color")
2053
- throw new Error(`Invalid color token: ${value[0]}`);
2054
- return compileColorTokenValue({
2055
- ...node,
2056
- hue: node.hue || hue
2057
- });
2729
+ function is_v2(themeProp) {
2730
+ return themeProp._version === 2;
2058
2731
  }
2059
- const defaultColorTokens = {
2060
- base: {
2061
- "*": {
2062
- _blend: ["multiply", "screen"],
2063
- accent: {
2064
- fg: ["purple/600", "purple/400"]
2065
- },
2066
- avatar: {
2067
- "*": {
2068
- _blend: ["screen", "multiply"],
2069
- bg: ["500", "400"],
2070
- fg: ["white", "black"]
2071
- }
2072
- },
2073
- backdrop: ["gray/200/0.5", "black/0.5"],
2074
- badge: {
2075
- "*": {
2076
- bg: ["100", "900"],
2077
- fg: ["600", "400"],
2078
- icon: ["500", "500"],
2079
- dot: ["500", "500"]
2080
- },
2081
- positive: {
2082
- bg: ["200 50%", "900"],
2083
- fg: ["600", "500"]
2084
- },
2085
- caution: {
2086
- bg: ["200 50%", "900"],
2087
- fg: ["600", "500"]
2088
- }
2089
- },
2090
- bg: ["50", "950"],
2091
- border: ["200", "800"],
2092
- code: {
2093
- bg: ["50", "950"],
2094
- fg: ["600", "400"]
2095
- },
2096
- fg: ["800", "200"],
2097
- focusRing: ["blue/500", "blue/500"],
2098
- icon: ["600", "400"],
2099
- kbd: {
2100
- bg: ["white", "black"],
2101
- fg: ["600", "400"],
2102
- border: ["200", "800"]
2103
- },
2104
- link: {
2105
- fg: ["blue/600", "blue/300"]
2106
- },
2107
- muted: {
2108
- bg: ["50", "950"],
2109
- fg: ["700 75%", "300 75%"]
2110
- },
2111
- shadow: {
2112
- outline: ["500/0.3", "500/0.4"],
2113
- umbra: ["gray/500/0.1", "black/0.2"],
2114
- penumbra: ["gray/500/0.07", "black/0.14"],
2115
- ambient: ["gray/500/0.06", "black/0.12"]
2732
+ function themeColor_v0_v2_9(color) {
2733
+ if ("neutral" in color.badge)
2734
+ return color;
2735
+ const colors2 = color;
2736
+ return {
2737
+ ...colors2,
2738
+ badge: {
2739
+ ...colors2.badge,
2740
+ neutral: colors2.badge.default,
2741
+ suggest: colors2.badge.primary
2742
+ },
2743
+ button: {
2744
+ bleed: {
2745
+ ...colors2.button.bleed,
2746
+ neutral: colors2.button.bleed.default,
2747
+ suggest: colors2.button.bleed.primary
2116
2748
  },
2117
- skeleton: {
2118
- from: ["100", "900"],
2119
- to: ["100 50%", "900 50%"]
2749
+ default: {
2750
+ ...colors2.button.default,
2751
+ neutral: colors2.button.default.default,
2752
+ suggest: colors2.button.default.primary
2753
+ },
2754
+ ghost: {
2755
+ ...colors2.button.ghost,
2756
+ neutral: colors2.button.ghost.default,
2757
+ suggest: colors2.button.ghost.primary
2120
2758
  }
2121
2759
  },
2122
- transparent: {
2123
- bg: ["50", "black"]
2760
+ selectable: {
2761
+ ...colors2.selectable,
2762
+ neutral: colors2.selectable.default,
2763
+ suggest: colors2.selectable.primary
2764
+ }
2765
+ };
2766
+ }
2767
+ const cache$3 = /* @__PURE__ */ new WeakMap();
2768
+ function themeColor_v0_v2(color_v0) {
2769
+ const cached_v2 = cache$3.get(color_v0);
2770
+ if (cached_v2) return cached_v2;
2771
+ const base = stateThemeColor_v0_v2(color_v0, color_v0.card.enabled), color_v2 = {
2772
+ _blend: color_v0._blend || (color_v0.dark ? "screen" : "multiply"),
2773
+ _dark: color_v0.dark,
2774
+ accent: base.accent,
2775
+ avatar: base.avatar,
2776
+ backdrop: color_v0.base.shadow.ambient,
2777
+ badge: base.badge,
2778
+ bg: color_v0.base.bg,
2779
+ border: color_v0.base.border,
2780
+ button: {
2781
+ default: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.default),
2782
+ ghost: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.ghost),
2783
+ bleed: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.bleed)
2124
2784
  },
2125
- default: {
2126
- bg: ["white", "950"],
2127
- fg: ["800", "200"],
2128
- muted: {
2129
- fg: ["600", "400"]
2130
- }
2785
+ code: base.code,
2786
+ fg: color_v0.base.fg,
2787
+ focusRing: color_v0.base.focusRing,
2788
+ icon: base.muted.fg,
2789
+ input: {
2790
+ default: inputStatesThemeColor_v0_v2(color_v0.input.default),
2791
+ invalid: inputStatesThemeColor_v0_v2(color_v0.input.invalid)
2131
2792
  },
2132
- primary: {
2133
- _hue: "blue"
2793
+ kbd: base.kbd,
2794
+ link: base.link,
2795
+ muted: {
2796
+ ...base.muted,
2797
+ bg: color_v0.selectable?.default.enabled.bg2 || color_v0.base.bg
2134
2798
  },
2135
- positive: {
2136
- _hue: "green",
2137
- shadow: {
2138
- outline: ["500/0.4", "500/0.4"]
2139
- }
2799
+ selectable: stateTonesThemeColor_v0_v2(color_v0, color_v0.selectable || color_v0.muted),
2800
+ shadow: color_v0.base.shadow,
2801
+ skeleton: {
2802
+ from: color_v0.skeleton?.from || color_v0.base.border,
2803
+ to: color_v0.skeleton?.to || color_v0.base.border
2140
2804
  },
2141
- caution: {
2142
- _hue: "yellow",
2143
- shadow: {
2144
- outline: ["600/0.3", "500/0.4"]
2145
- }
2146
- },
2147
- critical: {
2148
- _hue: "red"
2149
- }
2150
- },
2151
- button: {
2152
- default: {
2153
- "*": {
2154
- "*": {
2155
- _blend: ["screen", "multiply"],
2156
- accent: {
2157
- fg: ["purple/300", "purple/700"]
2158
- },
2159
- avatar: {
2160
- "*": {
2161
- _blend: ["screen", "multiply"],
2162
- bg: ["500", "400"],
2163
- fg: ["white", "black"]
2164
- }
2165
- },
2166
- badge: {
2167
- "*": {
2168
- bg: ["900", "100"],
2169
- fg: ["400", "600"],
2170
- dot: ["500", "500"],
2171
- icon: ["500", "500"]
2172
- }
2173
- },
2174
- bg: ["500", "400"],
2175
- border: ["500/0", "400/0"],
2176
- code: {
2177
- bg: ["500 20%", "400 20%"],
2178
- fg: ["200", "600"]
2179
- },
2180
- fg: ["white", "black"],
2181
- icon: ["100 70%", "900 70%"],
2182
- kbd: {
2183
- bg: ["black", "white"],
2184
- fg: ["200", "600"],
2185
- border: ["800", "200"]
2186
- },
2187
- link: {
2188
- fg: ["blue/200", "blue/600"]
2189
- },
2190
- muted: {
2191
- bg: ["950", "50"],
2192
- fg: ["100 70%", "900 70%"]
2193
- },
2194
- skeleton: {
2195
- from: ["900", "100"],
2196
- to: ["900 50%", "100 50%"]
2197
- }
2198
- },
2199
- hovered: {
2200
- bg: ["700", "300"],
2201
- border: ["700/0", "300/0"]
2202
- },
2203
- pressed: {
2204
- bg: ["700", "300"]
2205
- },
2206
- selected: {
2207
- bg: ["700", "300"]
2208
- },
2209
- disabled: {
2210
- _hue: "gray",
2211
- accent: {
2212
- fg: ["100 70%", "900 70%"]
2213
- },
2214
- avatar: {
2215
- "*": {
2216
- _blend: ["screen", "multiply"],
2217
- bg: ["gray/500", "gray/400"],
2218
- fg: ["white", "black"]
2219
- }
2220
- },
2221
- badge: {
2222
- "*": {
2223
- bg: ["gray/700", "gray/300"],
2224
- fg: ["white", "black"],
2225
- dot: ["white", "black"],
2226
- icon: ["white", "black"]
2227
- }
2228
- },
2229
- bg: ["300", "600"],
2230
- code: {
2231
- bg: ["950", "50"],
2232
- fg: ["300", "600"]
2233
- },
2234
- fg: ["300", "600"],
2235
- muted: {
2236
- bg: ["950", "50"],
2237
- fg: ["300", "600"]
2238
- },
2239
- kbd: {
2240
- bg: ["black", "white"],
2241
- fg: ["white", "black"],
2242
- border: ["700", "300"]
2243
- },
2244
- link: {
2245
- fg: ["100 70%", "900 70%"]
2246
- }
2247
- }
2248
- },
2249
- default: {
2250
- "*": {
2251
- avatar: {
2252
- "*": {
2253
- _blend: ["screen", "multiply"],
2254
- bg: ["500", "400"],
2255
- fg: ["white", "black"]
2256
- }
2257
- },
2258
- bg: ["800", "200"],
2259
- muted: {
2260
- bg: ["950", "50"],
2261
- fg: ["400", "600"]
2262
- }
2263
- },
2264
- hovered: {
2265
- bg: ["900", "100"]
2266
- },
2267
- pressed: {
2268
- bg: ["black", "white"]
2269
- },
2270
- selected: {
2271
- bg: ["black", "white"]
2272
- }
2273
- }
2274
- },
2275
- ghost: {
2276
- "*": {
2277
- "*": {
2278
- _blend: ["multiply", "screen"],
2279
- accent: {
2280
- fg: ["purple/700 60%", "purple/300 70%"]
2281
- },
2282
- avatar: {
2283
- "*": {
2284
- _blend: ["screen", "multiply"],
2285
- bg: ["500", "400"],
2286
- fg: ["white", "black"]
2287
- }
2288
- },
2289
- badge: {
2290
- "*": {
2291
- bg: ["100", "900"],
2292
- fg: ["600", "400"],
2293
- dot: ["500", "500"],
2294
- icon: ["500", "500"]
2295
- }
2296
- },
2297
- bg: ["50", "950"],
2298
- border: ["100", "900"],
2299
- code: {
2300
- bg: ["500 10%", "400 10%"],
2301
- fg: ["700 60%", "400 60%"]
2302
- },
2303
- fg: ["600", "400"],
2304
- icon: ["700 60%", "300 60%"],
2305
- kbd: {
2306
- bg: ["white", "black"],
2307
- fg: ["600", "400"],
2308
- border: ["200", "800"]
2309
- },
2310
- link: {
2311
- fg: ["blue/700 60%", "blue/300 60%"]
2312
- },
2313
- muted: {
2314
- bg: ["100", "950"],
2315
- fg: ["700 60%", "300 60%"]
2316
- },
2317
- skeleton: {
2318
- from: ["100", "900"],
2319
- to: ["100 50%", "900 50%"]
2320
- }
2321
- },
2322
- hovered: {
2323
- bg: ["100", "900"],
2324
- fg: ["700", "300"]
2325
- },
2326
- pressed: {
2327
- bg: ["100", "900"],
2328
- fg: ["800", "200"]
2329
- },
2330
- selected: {
2331
- bg: ["100", "900"],
2332
- fg: ["800", "200"]
2333
- },
2334
- disabled: {
2335
- _hue: "gray",
2336
- accent: {
2337
- fg: ["200", "800"]
2338
- },
2339
- avatar: {
2340
- "*": {
2341
- _blend: ["screen", "multiply"],
2342
- bg: ["gray/100", "gray/900"],
2343
- fg: ["white", "black"]
2344
- }
2345
- },
2346
- badge: {
2347
- "*": {
2348
- _hue: "gray",
2349
- bg: ["50", "950"],
2350
- fg: ["gray/200", "gray/800"],
2351
- dot: ["gray/200", "gray/800"],
2352
- icon: ["gray/200", "gray/800"]
2353
- }
2354
- },
2355
- border: ["100", "900"],
2356
- code: {
2357
- bg: ["50", "950"],
2358
- fg: ["200", "800"]
2359
- },
2360
- fg: ["400", "600"],
2361
- icon: ["300", "700"],
2362
- muted: {
2363
- fg: ["300", "700"]
2364
- },
2365
- kbd: {
2366
- bg: ["white", "black"],
2367
- fg: ["200", "800"],
2368
- border: ["100", "900"]
2369
- },
2370
- link: {
2371
- fg: ["200", "800"]
2372
- }
2373
- }
2374
- },
2375
- positive: {
2376
- "*": {
2377
- border: ["600 20%", "800"]
2378
- }
2379
- },
2380
- caution: {
2381
- "*": {
2382
- border: ["600 20%", "800"]
2383
- }
2384
- }
2385
- },
2386
- bleed: {
2387
- "*": {
2388
- "*": {
2389
- _blend: ["multiply", "screen"],
2390
- accent: {
2391
- fg: ["purple/700 70%", "purple/300 70%"]
2392
- },
2393
- avatar: {
2394
- "*": {
2395
- _blend: ["screen", "multiply"],
2396
- bg: ["500", "400"],
2397
- fg: ["white", "black"]
2398
- }
2399
- },
2400
- badge: {
2401
- "*": {
2402
- bg: ["100", "900"],
2403
- fg: ["600", "400"],
2404
- dot: ["500", "500"],
2405
- icon: ["500", "500"]
2406
- }
2407
- },
2408
- bg: ["white", "black"],
2409
- border: ["white/0", "black/0"],
2410
- code: {
2411
- bg: ["50", "950"],
2412
- fg: ["700 75%", "300 75%"]
2413
- },
2414
- fg: ["700", "300"],
2415
- icon: ["700 75%", "300 75%"],
2416
- kbd: {
2417
- bg: ["white", "black"],
2418
- fg: ["700", "300"],
2419
- border: ["200", "800"]
2420
- },
2421
- link: {
2422
- fg: ["blue/700 70%", "blue/300 70%"]
2423
- },
2424
- muted: {
2425
- bg: ["100", "950"],
2426
- fg: ["700 75%", "300 75%"]
2427
- },
2428
- skeleton: {
2429
- from: ["100", "900"],
2430
- to: ["100 50%", "900 50%"]
2431
- }
2432
- },
2433
- hovered: {
2434
- bg: ["50", "950"],
2435
- icon: ["700 70%", "400 70%"]
2436
- },
2437
- pressed: {
2438
- bg: ["100", "900"],
2439
- fg: ["800", "200"],
2440
- icon: ["800 70%", "200 70%"]
2441
- },
2442
- selected: {
2443
- bg: ["100", "900"],
2444
- fg: ["800", "200"],
2445
- icon: ["800 60%", "200 60%"]
2446
- },
2447
- disabled: {
2448
- _hue: "gray",
2449
- accent: {
2450
- fg: ["200", "800"]
2451
- },
2452
- avatar: {
2453
- "*": {
2454
- _blend: ["screen", "multiply"],
2455
- bg: ["gray/100", "gray/900"],
2456
- fg: ["white", "black"]
2457
- }
2458
- },
2459
- badge: {
2460
- "*": {
2461
- _hue: "gray",
2462
- bg: ["50", "950"],
2463
- fg: ["gray/200", "gray/800"],
2464
- dot: ["gray/200", "gray/800"],
2465
- icon: ["gray/200", "gray/800"]
2466
- }
2467
- },
2468
- code: {
2469
- bg: ["50", "950"],
2470
- fg: ["200", "800"]
2471
- },
2472
- fg: ["400", "600"],
2473
- icon: ["300", "700"],
2474
- muted: {
2475
- fg: ["400", "600"]
2476
- },
2477
- kbd: {
2478
- bg: ["white", "black"],
2479
- fg: ["200", "800"],
2480
- border: ["100", "900"]
2481
- },
2482
- link: {
2483
- fg: ["200", "800"]
2484
- }
2485
- }
2486
- }
2487
- }
2488
- },
2489
- input: {
2490
- "*": {
2491
- "*": {
2492
- _blend: ["multiply", "screen"],
2493
- bg: ["white", "black"],
2494
- border: ["200", "700"],
2495
- fg: ["black", "200"],
2496
- muted: {
2497
- bg: ["50", "950"]
2498
- },
2499
- placeholder: ["400", "600"]
2500
- },
2501
- hovered: {
2502
- border: ["300", "700"]
2503
- },
2504
- readOnly: {
2505
- bg: ["50", "950"],
2506
- border: ["200", "800"],
2507
- fg: ["800", "200"]
2508
- },
2509
- disabled: {
2510
- bg: ["50", "950"],
2511
- fg: ["400", "600"],
2512
- border: ["100", "900"],
2513
- placeholder: ["200", "800 50%"]
2514
- }
2515
- },
2516
- invalid: {
2517
- "*": {
2518
- _hue: "red",
2519
- bg: ["100", "950"]
2520
- }
2521
- }
2522
- },
2523
- selectable: {
2524
- "*": {
2525
- "*": {
2526
- _blend: ["multiply", "screen"],
2527
- accent: {
2528
- fg: ["purple/700 70%", "purple/300 70%"]
2529
- },
2530
- avatar: {
2531
- "*": {
2532
- _blend: ["screen", "multiply"],
2533
- bg: ["500", "400"],
2534
- fg: ["white", "black"]
2535
- }
2536
- },
2537
- badge: {
2538
- "*": {
2539
- bg: ["100", "900"],
2540
- fg: ["600", "400"],
2541
- dot: ["500", "500"],
2542
- icon: ["500", "500"]
2543
- }
2544
- },
2545
- bg: ["white", "black"],
2546
- border: ["200", "800"],
2547
- code: {
2548
- bg: ["50", "950"],
2549
- fg: ["600", "400"]
2550
- },
2551
- fg: ["700", "300"],
2552
- icon: ["700 75%", "300 75%"],
2553
- kbd: {
2554
- bg: ["white", "black"],
2555
- fg: ["600", "400"],
2556
- border: ["200", "800"]
2557
- },
2558
- link: {
2559
- fg: ["blue/700 70%", "blue/300 70%"]
2560
- },
2561
- muted: {
2562
- bg: ["50", "950"],
2563
- fg: ["700 75%", "300 75%"]
2564
- },
2565
- skeleton: {
2566
- from: ["100", "900"],
2567
- to: ["100 50%", "900 50%"]
2568
- }
2569
- },
2570
- hovered: {
2571
- bg: ["50", "950"]
2572
- },
2573
- pressed: {
2574
- bg: ["100", "900"]
2575
- },
2576
- selected: {
2577
- _blend: ["screen", "multiply"],
2578
- accent: {
2579
- fg: ["purple/300", "purple/700"]
2580
- },
2581
- avatar: {
2582
- "*": {
2583
- _blend: ["multiply", "screen"],
2584
- bg: ["white", "black"],
2585
- fg: ["black", "white"]
2586
- }
2587
- },
2588
- badge: {
2589
- "*": {
2590
- bg: ["900", "100"],
2591
- fg: ["400", "600"],
2592
- dot: ["500", "500"],
2593
- icon: ["500", "500"]
2594
- }
2595
- },
2596
- bg: ["500", "400"],
2597
- border: ["500 20%", "400 20%"],
2598
- code: {
2599
- bg: ["500 20%", "400 20%"],
2600
- fg: ["200", "600"]
2601
- },
2602
- fg: ["white", "black"],
2603
- icon: ["100 70%", "900 70%"],
2604
- kbd: {
2605
- bg: ["black", "white"],
2606
- fg: ["200", "600"],
2607
- border: ["800", "200"]
2608
- },
2609
- link: {
2610
- fg: ["blue/200", "blue/600"]
2611
- },
2612
- muted: {
2613
- bg: ["500 10%", "400 10%"],
2614
- fg: ["100 70%", "900 70%"]
2615
- },
2616
- skeleton: {
2617
- from: ["900", "100"],
2618
- to: ["900 50%", "100 50%"]
2619
- }
2620
- },
2621
- disabled: {
2622
- _hue: "gray",
2623
- accent: {
2624
- fg: ["200", "800"]
2625
- },
2626
- avatar: {
2627
- "*": {
2628
- _blend: ["screen", "multiply"],
2629
- bg: ["gray/100", "gray/900"],
2630
- fg: ["white", "black"]
2631
- }
2632
- },
2633
- badge: {
2634
- "*": {
2635
- _hue: "gray",
2636
- bg: ["50", "950"],
2637
- fg: ["gray/200", "gray/800"],
2638
- dot: ["gray/200", "gray/800"],
2639
- icon: ["gray/200", "gray/800"]
2640
- }
2641
- },
2642
- border: ["100", "900"],
2643
- code: {
2644
- bg: ["50", "950"],
2645
- fg: ["200", "800"]
2646
- },
2647
- fg: ["200", "800"],
2648
- icon: ["200", "800"],
2649
- kbd: {
2650
- bg: ["white", "black"],
2651
- fg: ["200", "800"],
2652
- border: ["100", "900"]
2653
- },
2654
- link: {
2655
- fg: ["200", "800"]
2656
- },
2657
- muted: {
2658
- bg: ["50 50%", "950 50%"],
2659
- fg: ["200", "800"]
2660
- }
2661
- }
2662
- },
2663
- default: {
2664
- selected: {
2665
- _hue: "blue"
2666
- }
2667
- },
2668
- critical: {
2669
- disabled: {
2670
- bg: ["50 50%", "950 50%"]
2671
- }
2672
- }
2673
- },
2674
- syntax: {
2675
- atrule: ["purple/600", "purple/400"],
2676
- attrName: ["green/600", "green/400"],
2677
- attrValue: ["yellow/600", "yellow/400"],
2678
- attribute: ["yellow/600", "yellow/400"],
2679
- boolean: ["purple/600", "purple/400"],
2680
- builtin: ["purple/600", "purple/400"],
2681
- cdata: ["yellow/600", "yellow/400"],
2682
- char: ["yellow/600", "yellow/400"],
2683
- class: ["orange/600", "orange/400"],
2684
- className: ["cyan/600", "cyan/400"],
2685
- comment: ["gray/400", "gray/600"],
2686
- constant: ["purple/600", "purple/400"],
2687
- deleted: ["red/600", "red/400"],
2688
- entity: ["red/600", "red/400"],
2689
- function: ["green/600", "green/400"],
2690
- hexcode: ["blue/600", "blue/400"],
2691
- id: ["purple/600", "purple/400"],
2692
- important: ["purple/600", "purple/400"],
2693
- inserted: ["yellow/600", "yellow/400"],
2694
- keyword: ["magenta/600", "magenta/400"],
2695
- number: ["purple/600", "purple/400"],
2696
- operator: ["magenta/600", "magenta/400"],
2697
- property: ["blue/600", "blue/400"],
2698
- pseudoClass: ["yellow/600", "yellow/400"],
2699
- pseudoElement: ["yellow/600", "yellow/400"],
2700
- punctuation: ["gray/600", "gray/400"],
2701
- regex: ["blue/600", "blue/400"],
2702
- selector: ["red/600", "red/400"],
2703
- string: ["yellow/600", "yellow/400"],
2704
- symbol: ["purple/600", "purple/400"],
2705
- tag: ["red/600", "red/400"],
2706
- unit: ["orange/600", "orange/400"],
2707
- url: ["red/600", "red/400"],
2708
- variable: ["red/600", "red/400"]
2709
- }
2710
- };
2711
- function isRecord(value) {
2712
- return !!(value && typeof value == "object" && !Array.isArray(value));
2713
- }
2714
- function merge(...records) {
2715
- const _records = records.filter(Boolean);
2716
- return _records.length === 0 ? {} : _records.reduce(_merge, {});
2717
- }
2718
- function _merge(acc, source) {
2719
- for (const key of Object.keys(source)) {
2720
- const prevValue = acc[key], nextValue = source[key];
2721
- isRecord(prevValue) && isRecord(nextValue) ? acc[key] = merge(prevValue, nextValue) : acc[key] = nextValue;
2722
- }
2723
- return acc;
2724
- }
2725
- function resolveColorTokens(inputTokens) {
2726
- const tokens = merge(defaultColorTokens, inputTokens);
2727
- return {
2728
- base: resolveBaseColorTokens(tokens),
2729
- button: resolveButtonColorTokens(tokens),
2730
- input: resolveInputColorTokens(tokens),
2731
- selectable: resolveSelectableColorTokens(tokens),
2732
- syntax: tokens.syntax
2733
- };
2734
- }
2735
- function resolveBaseColorTokens(sparseTokens) {
2736
- const tokens = {};
2737
- for (const tone of THEME_COLOR_CARD_TONES)
2738
- tokens[tone] = resolveBaseColorTones(sparseTokens, tone);
2739
- return tokens;
2740
- }
2741
- function resolveBaseColorTones(inputTokens, tone) {
2742
- const spec = merge(inputTokens?.base?.["*"], inputTokens?.base?.[tone]), hue = spec._hue || inputTokens?.base?.[tone]?._hue || "gray";
2743
- return {
2744
- ...spec,
2745
- _hue: hue,
2746
- avatar: {
2747
- gray: merge({
2748
- _hue: "gray"
2749
- }, spec.avatar?.["*"], spec.avatar?.gray),
2750
- blue: merge({
2751
- _hue: "blue"
2752
- }, spec.avatar?.["*"], spec.avatar?.blue),
2753
- purple: merge({
2754
- _hue: "purple"
2755
- }, spec.avatar?.["*"], spec.avatar?.purple),
2756
- magenta: merge({
2757
- _hue: "magenta"
2758
- }, spec.avatar?.["*"], spec.avatar?.magenta),
2759
- red: merge({
2760
- _hue: "red"
2761
- }, spec.avatar?.["*"], spec.avatar?.red),
2762
- orange: merge({
2763
- _hue: "orange"
2764
- }, spec.avatar?.["*"], spec.avatar?.orange),
2765
- yellow: merge({
2766
- _hue: "yellow"
2767
- }, spec.avatar?.["*"], spec.avatar?.yellow),
2768
- green: merge({
2769
- _hue: "green"
2770
- }, spec.avatar?.["*"], spec.avatar?.green),
2771
- cyan: merge({
2772
- _hue: "cyan"
2773
- }, spec.avatar?.["*"], spec.avatar?.cyan)
2774
- },
2775
- badge: {
2776
- default: {
2777
- _hue: inputTokens?.base?.default?._hue || hue,
2778
- ...spec.badge?.["*"],
2779
- ...spec.badge?.default
2780
- },
2781
- primary: {
2782
- _hue: inputTokens?.base?.primary?._hue || hue,
2783
- ...spec.badge?.["*"],
2784
- ...spec.badge?.primary
2785
- },
2786
- positive: {
2787
- _hue: inputTokens?.base?.positive?._hue || hue,
2788
- ...spec.badge?.["*"],
2789
- ...spec.badge?.positive
2790
- },
2791
- caution: {
2792
- _hue: inputTokens?.base?.caution?._hue || hue,
2793
- ...spec.badge?.["*"],
2794
- ...spec.badge?.caution
2795
- },
2796
- critical: {
2797
- _hue: inputTokens?.base?.critical?._hue || hue,
2798
- ...spec.badge?.["*"],
2799
- ...spec.badge?.critical
2800
- }
2801
- }
2802
- };
2803
- }
2804
- function resolveButtonColorTokens(inputTokens) {
2805
- const tokens = {};
2806
- for (const mode of THEME_COLOR_BUTTON_MODES)
2807
- tokens[mode] = resolveButtonToneColorTokens(inputTokens, mode);
2808
- return tokens;
2809
- }
2810
- function resolveButtonToneColorTokens(inputTokens, mode) {
2811
- const tokens = {};
2812
- for (const tone of THEME_COLOR_STATE_TONES)
2813
- tokens[tone] = resolveButtonModeColorTokens(inputTokens, mode, tone);
2814
- return tokens;
2815
- }
2816
- function resolveButtonModeColorTokens(inputTokens, mode, tone) {
2817
- const tokens = {};
2818
- for (const state of THEME_COLOR_STATES)
2819
- tokens[state] = resolveButtonStateColorTokens(inputTokens, tone, mode, state);
2820
- return tokens;
2821
- }
2822
- function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
2823
- const spec = merge(inputTokens?.button?.[mode]?.["*"]?.["*"], inputTokens?.button?.[mode]?.[tone]?.["*"], inputTokens?.button?.[mode]?.["*"]?.[state], inputTokens?.button?.[mode]?.[tone]?.[state]), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
2824
- return {
2825
- ...spec,
2826
- _hue: hue,
2827
- avatar: {
2828
- gray: merge({
2829
- _hue: "gray"
2830
- }, spec.avatar?.["*"], spec.avatar?.gray),
2831
- blue: merge({
2832
- _hue: "blue"
2833
- }, spec.avatar?.["*"], spec.avatar?.blue),
2834
- purple: merge({
2835
- _hue: "purple"
2836
- }, spec.avatar?.["*"], spec.avatar?.purple),
2837
- magenta: merge({
2838
- _hue: "magenta"
2839
- }, spec.avatar?.["*"], spec.avatar?.magenta),
2840
- red: merge({
2841
- _hue: "red"
2842
- }, spec.avatar?.["*"], spec.avatar?.red),
2843
- orange: merge({
2844
- _hue: "orange"
2845
- }, spec.avatar?.["*"], spec.avatar?.orange),
2846
- yellow: merge({
2847
- _hue: "yellow"
2848
- }, spec.avatar?.["*"], spec.avatar?.yellow),
2849
- green: merge({
2850
- _hue: "green"
2851
- }, spec.avatar?.["*"], spec.avatar?.green),
2852
- cyan: merge({
2853
- _hue: "cyan"
2854
- }, spec.avatar?.["*"], spec.avatar?.cyan)
2855
- },
2856
- badge: {
2857
- default: {
2858
- _hue: inputTokens?.base?.default?._hue,
2859
- ...spec.badge?.["*"],
2860
- ...spec.badge?.default
2861
- },
2862
- primary: {
2863
- _hue: inputTokens?.base?.primary?._hue,
2864
- ...spec.badge?.["*"],
2865
- ...spec.badge?.primary
2866
- },
2867
- positive: {
2868
- _hue: inputTokens?.base?.positive?._hue,
2869
- ...spec.badge?.["*"],
2870
- ...spec.badge?.positive
2871
- },
2872
- caution: {
2873
- _hue: inputTokens?.base?.caution?._hue,
2874
- ...spec.badge?.["*"],
2875
- ...spec.badge?.caution
2876
- },
2877
- critical: {
2878
- _hue: inputTokens?.base?.critical?._hue,
2879
- ...spec.badge?.["*"],
2880
- ...spec.badge?.critical
2881
- }
2882
- }
2883
- };
2884
- }
2885
- function resolveInputColorTokens(inputTokens) {
2886
- const tokens = {};
2887
- for (const mode of THEME_COLOR_INPUT_MODES)
2888
- tokens[mode] = resolveInputModeColorTokens(inputTokens, mode);
2889
- return tokens;
2890
- }
2891
- function resolveInputModeColorTokens(inputTokens, mode) {
2892
- const states = {};
2893
- for (const state of THEME_COLOR_INPUT_STATES)
2894
- states[state] = resolveInputStateColorTokens(inputTokens, mode, state);
2895
- return states;
2896
- }
2897
- function resolveInputStateColorTokens(inputTokens, mode, state) {
2898
- const spec = merge(inputTokens?.input?.["*"]?.["*"], inputTokens?.input?.[mode]?.["*"], inputTokens?.input?.["*"]?.[state], inputTokens?.input?.[mode]?.[state]), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
2899
- return {
2900
- ...spec,
2901
- _hue: hue
2902
- };
2903
- }
2904
- function resolveSelectableColorTokens(inputTokens) {
2905
- const tokens = {};
2906
- for (const tone of THEME_COLOR_STATE_TONES)
2907
- tokens[tone] = resolveSelectableToneColorTokens(inputTokens, tone);
2908
- return tokens;
2909
- }
2910
- function resolveSelectableToneColorTokens(inputTokens, tone) {
2911
- const states = {
2912
- _hue: inputTokens?.selectable?.[tone]?._hue || inputTokens?.base?.[tone]?._hue
2913
- };
2914
- for (const state of THEME_COLOR_STATES)
2915
- states[state] = resolveSelectableStateColorTokens(inputTokens, tone, state);
2916
- return states;
2917
- }
2918
- function resolveSelectableStateColorTokens(inputTokens, tone, state) {
2919
- const spec = merge(inputTokens?.selectable?.["*"]?.["*"], inputTokens?.selectable?.[tone]?.["*"], inputTokens?.selectable?.["*"]?.[state], inputTokens?.selectable?.[tone]?.[state]), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
2920
- return {
2921
- ...spec,
2922
- _hue: hue,
2923
- avatar: {
2924
- gray: merge({
2925
- _hue: "gray"
2926
- }, spec.avatar?.["*"], spec.avatar?.gray),
2927
- blue: merge({
2928
- _hue: "blue"
2929
- }, spec.avatar?.["*"], spec.avatar?.blue),
2930
- purple: merge({
2931
- _hue: "purple"
2932
- }, spec.avatar?.["*"], spec.avatar?.purple),
2933
- magenta: merge({
2934
- _hue: "magenta"
2935
- }, spec.avatar?.["*"], spec.avatar?.magenta),
2936
- red: merge({
2937
- _hue: "red"
2938
- }, spec.avatar?.["*"], spec.avatar?.red),
2939
- orange: merge({
2940
- _hue: "orange"
2941
- }, spec.avatar?.["*"], spec.avatar?.orange),
2942
- yellow: merge({
2943
- _hue: "yellow"
2944
- }, spec.avatar?.["*"], spec.avatar?.yellow),
2945
- green: merge({
2946
- _hue: "green"
2947
- }, spec.avatar?.["*"], spec.avatar?.green),
2948
- cyan: merge({
2949
- _hue: "cyan"
2950
- }, spec.avatar?.["*"], spec.avatar?.cyan)
2951
- },
2952
- badge: {
2953
- default: {
2954
- _hue: inputTokens?.base?.default?._hue,
2955
- ...spec.badge?.["*"],
2956
- ...spec.badge?.default
2957
- },
2958
- primary: {
2959
- _hue: inputTokens?.base?.primary?._hue,
2960
- ...spec.badge?.["*"],
2961
- ...spec.badge?.primary
2962
- },
2963
- positive: {
2964
- _hue: inputTokens?.base?.positive?._hue,
2965
- ...spec.badge?.["*"],
2966
- ...spec.badge?.positive
2967
- },
2968
- caution: {
2969
- _hue: inputTokens?.base?.caution?._hue,
2970
- ...spec.badge?.["*"],
2971
- ...spec.badge?.caution
2972
- },
2973
- critical: {
2974
- _hue: inputTokens?.base?.critical?._hue,
2975
- ...spec.badge?.["*"],
2976
- ...spec.badge?.critical
2977
- }
2978
- }
2979
- };
2980
- }
2981
- function buildColorTheme(config) {
2982
- const resolvedConfig = {
2983
- ...config,
2984
- color: resolveColorTokens(config?.color)
2985
- };
2986
- return {
2987
- light: buildColorScheme({
2988
- scheme: "light"
2989
- }, resolvedConfig),
2990
- dark: buildColorScheme({
2991
- scheme: "dark"
2992
- }, resolvedConfig)
2993
- };
2994
- }
2995
- function buildColorScheme(options, config) {
2996
- const {
2997
- scheme
2998
- } = options;
2999
- return {
3000
- transparent: buildCardColorTheme({
3001
- scheme,
3002
- tone: "transparent"
3003
- }, config),
3004
- default: buildCardColorTheme({
3005
- scheme,
3006
- tone: "default"
3007
- }, config),
3008
- primary: buildCardColorTheme({
3009
- scheme,
3010
- tone: "primary"
3011
- }, config),
3012
- positive: buildCardColorTheme({
3013
- scheme,
3014
- tone: "positive"
3015
- }, config),
3016
- caution: buildCardColorTheme({
3017
- scheme,
3018
- tone: "caution"
3019
- }, config),
3020
- critical: buildCardColorTheme({
3021
- scheme,
3022
- tone: "critical"
3023
- }, config)
3024
- };
3025
- }
3026
- function buildCardColorTheme(options, config) {
3027
- const {
3028
- scheme,
3029
- tone
3030
- } = options, tokens = config?.color?.base?.[tone], context = {
3031
- hue: tokens?._hue || "gray",
3032
- scheme
3033
- };
3034
- return {
3035
- _blend: (tokens?._blend || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
3036
- _dark: scheme === "dark",
3037
- accent: {
3038
- fg: resolveColorTokenValue(context, tokens?.accent?.fg)
3039
- },
3040
- avatar: buildAvatarColorTheme({
3041
- scheme
3042
- }, tokens),
3043
- backdrop: resolveColorTokenValue(context, tokens?.backdrop),
3044
- badge: buildBadgeColorTheme(tokens?.badge, {
3045
- scheme
3046
- }, config),
3047
- bg: resolveColorTokenValue(context, tokens?.bg),
3048
- border: resolveColorTokenValue(context, tokens?.border),
3049
- button: buildButtonColorTheme({
3050
- scheme
3051
- }, config),
3052
- code: {
3053
- bg: resolveColorTokenValue(context, tokens?.code?.bg),
3054
- fg: resolveColorTokenValue(context, tokens?.code?.fg)
3055
- },
3056
- fg: resolveColorTokenValue(context, tokens?.fg),
3057
- focusRing: resolveColorTokenValue(context, tokens?.focusRing),
3058
- icon: resolveColorTokenValue(context, tokens?.icon),
3059
- input: buildInputColorTheme({
3060
- scheme,
3061
- tone
3062
- }, config),
3063
- kbd: {
3064
- bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
3065
- fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
3066
- border: resolveColorTokenValue(context, tokens?.kbd?.border)
3067
- },
3068
- link: {
3069
- fg: resolveColorTokenValue(context, tokens?.link?.fg)
3070
- },
3071
- muted: {
3072
- bg: resolveColorTokenValue(context, tokens?.muted?.bg),
3073
- fg: resolveColorTokenValue(context, tokens?.muted?.fg)
3074
- },
3075
- selectable: buildSelectableColorTheme({
3076
- scheme
3077
- }, config),
3078
- shadow: buildShadowColorTheme({
3079
- scheme,
3080
- tone
3081
- }, config),
3082
- skeleton: {
3083
- from: resolveColorTokenValue(context, tokens?.skeleton?.from),
3084
- to: resolveColorTokenValue(context, tokens?.skeleton?.to)
3085
- },
3086
- syntax: buildSyntaxColorTheme({
3087
- scheme
3088
- }, config)
3089
- };
3090
- }
3091
- function buildShadowColorTheme(options, config) {
3092
- const {
3093
- scheme,
3094
- tone
3095
- } = options, tokens = config?.color?.base?.[tone], context = {
3096
- hue: tokens?._hue || "gray",
3097
- scheme
3098
- };
3099
- return {
3100
- outline: resolveColorTokenValue(context, tokens?.shadow?.outline),
3101
- umbra: resolveColorTokenValue(context, tokens?.shadow?.umbra),
3102
- penumbra: resolveColorTokenValue(context, tokens?.shadow?.penumbra),
3103
- ambient: resolveColorTokenValue(context, tokens?.shadow?.ambient)
3104
- };
3105
- }
3106
- function buildAvatarColorTheme(options, stateTokens) {
3107
- const {
3108
- scheme
3109
- } = options;
3110
- return {
3111
- gray: _buildAvatarColorTheme({
3112
- color: "gray",
3113
- scheme
3114
- }, stateTokens),
3115
- blue: _buildAvatarColorTheme({
3116
- color: "blue",
3117
- scheme
3118
- }, stateTokens),
3119
- purple: _buildAvatarColorTheme({
3120
- color: "purple",
3121
- scheme
3122
- }, stateTokens),
3123
- magenta: _buildAvatarColorTheme({
3124
- color: "magenta",
3125
- scheme
3126
- }, stateTokens),
3127
- red: _buildAvatarColorTheme({
3128
- color: "red",
3129
- scheme
3130
- }, stateTokens),
3131
- orange: _buildAvatarColorTheme({
3132
- color: "orange",
3133
- scheme
3134
- }, stateTokens),
3135
- yellow: _buildAvatarColorTheme({
3136
- color: "yellow",
3137
- scheme
3138
- }, stateTokens),
3139
- green: _buildAvatarColorTheme({
3140
- color: "green",
3141
- scheme
3142
- }, stateTokens),
3143
- cyan: _buildAvatarColorTheme({
3144
- color: "cyan",
3145
- scheme
3146
- }, stateTokens)
3147
- };
3148
- }
3149
- function _buildAvatarColorTheme(options, stateTokens) {
3150
- const {
3151
- color: color2,
3152
- scheme
3153
- } = options, tokens = stateTokens?.avatar?.[color2], context = {
3154
- hue: tokens?._hue || "gray",
3155
- scheme
3156
- };
3157
- return {
3158
- _blend: (tokens?._blend || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
3159
- bg: resolveColorTokenValue(context, tokens?.bg),
3160
- fg: resolveColorTokenValue(context, tokens?.fg)
3161
- };
3162
- }
3163
- function buildBadgeColorTheme(tokens, options, config) {
3164
- const {
3165
- scheme
3166
- } = options;
3167
- return {
3168
- default: _buildBadgeColorTheme(tokens, {
3169
- scheme,
3170
- tone: "default"
3171
- }, config),
3172
- primary: _buildBadgeColorTheme(tokens, {
3173
- scheme,
3174
- tone: "primary"
3175
- }, config),
3176
- positive: _buildBadgeColorTheme(tokens, {
3177
- scheme,
3178
- tone: "positive"
3179
- }, config),
3180
- caution: _buildBadgeColorTheme(tokens, {
3181
- scheme,
3182
- tone: "caution"
3183
- }, config),
3184
- critical: _buildBadgeColorTheme(tokens, {
3185
- scheme,
3186
- tone: "critical"
3187
- }, config)
3188
- };
3189
- }
3190
- function _buildBadgeColorTheme(parentTokens, options, config) {
3191
- const {
3192
- scheme,
3193
- tone
3194
- } = options, tokens = parentTokens?.[tone], context = {
3195
- hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray",
3196
- scheme
3197
- };
3198
- return {
3199
- bg: resolveColorTokenValue(context, tokens?.bg),
3200
- fg: resolveColorTokenValue(context, tokens?.fg),
3201
- dot: resolveColorTokenValue(context, tokens?.dot),
3202
- icon: resolveColorTokenValue(context, tokens?.icon)
3203
- };
3204
- }
3205
- function buildButtonColorTheme(options, config) {
3206
- const {
3207
- scheme
3208
- } = options, modes = {};
3209
- for (const mode of THEME_COLOR_BUTTON_MODES)
3210
- modes[mode] = buildButtonTonesColorTheme({
3211
- scheme,
3212
- mode
3213
- }, config);
3214
- return modes;
3215
- }
3216
- function buildButtonTonesColorTheme(options, config) {
3217
- const {
3218
- mode,
3219
- scheme
3220
- } = options, tones2 = {};
3221
- for (const tone of THEME_COLOR_STATE_TONES)
3222
- tones2[tone] = buildButtonStatesColorTheme({
3223
- mode,
3224
- scheme,
3225
- tone
3226
- }, config);
3227
- return tones2;
3228
- }
3229
- function buildButtonStatesColorTheme(options, config) {
3230
- const {
3231
- mode,
3232
- scheme,
3233
- tone
3234
- } = options, states = {};
3235
- for (const state of THEME_COLOR_STATES)
3236
- states[state] = buildButtonStateColorTheme({
3237
- mode,
3238
- tone,
3239
- scheme,
3240
- state
3241
- }, config);
3242
- return states;
3243
- }
3244
- function buildButtonStateColorTheme(options, config) {
3245
- const {
3246
- mode,
3247
- tone,
3248
- scheme,
3249
- state
3250
- } = options, tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
3251
- hue,
3252
- scheme
3253
- };
3254
- return {
3255
- _blend: blendMode[scheme === "light" ? 0 : 1],
3256
- accent: {
3257
- fg: resolveColorTokenValue(context, tokens?.accent?.fg)
3258
- },
3259
- avatar: buildAvatarColorTheme({
3260
- scheme
3261
- }, tokens),
3262
- badge: buildBadgeColorTheme(tokens?.badge, {
3263
- scheme
3264
- }, config),
3265
- bg: resolveColorTokenValue(context, tokens?.bg),
3266
- border: resolveColorTokenValue(context, tokens?.border),
3267
- code: {
3268
- bg: resolveColorTokenValue(context, tokens?.code?.bg),
3269
- fg: resolveColorTokenValue(context, tokens?.code?.fg)
3270
- },
3271
- fg: resolveColorTokenValue(context, tokens?.fg),
3272
- icon: resolveColorTokenValue(context, tokens?.icon),
3273
- muted: {
3274
- bg: resolveColorTokenValue(context, tokens?.muted?.bg),
3275
- fg: resolveColorTokenValue(context, tokens?.muted?.fg)
3276
- },
3277
- kbd: {
3278
- bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
3279
- fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
3280
- border: resolveColorTokenValue(context, tokens?.kbd?.border)
3281
- },
3282
- link: {
3283
- fg: resolveColorTokenValue(context, tokens?.link?.fg)
3284
- },
3285
- skeleton: {
3286
- from: resolveColorTokenValue(context, tokens?.skeleton?.from),
3287
- to: resolveColorTokenValue(context, tokens?.skeleton?.to)
3288
- }
3289
- };
3290
- }
3291
- function buildInputColorTheme(options, config) {
3292
- const {
3293
- scheme,
3294
- tone
3295
- } = options;
3296
- return {
3297
- default: buildInputStatesColorTheme({
3298
- mode: "default",
3299
- scheme,
3300
- tone
3301
- }, config),
3302
- invalid: buildInputStatesColorTheme({
3303
- mode: "invalid",
3304
- scheme,
3305
- tone
3306
- }, config)
3307
- };
3308
- }
3309
- function buildInputStatesColorTheme(options, config) {
3310
- const {
3311
- mode,
3312
- scheme,
3313
- tone
3314
- } = options;
3315
- return {
3316
- enabled: buildInputStateColorTheme({
3317
- mode,
3318
- scheme,
3319
- state: "enabled",
3320
- tone
3321
- }, config),
3322
- hovered: buildInputStateColorTheme({
3323
- mode,
3324
- scheme,
3325
- state: "hovered",
3326
- tone
3327
- }, config),
3328
- readOnly: buildInputStateColorTheme({
3329
- mode,
3330
- scheme,
3331
- state: "readOnly",
3332
- tone
3333
- }, config),
3334
- disabled: buildInputStateColorTheme({
3335
- mode,
3336
- scheme,
3337
- state: "disabled",
3338
- tone
3339
- }, config)
3340
- };
3341
- }
3342
- function buildInputStateColorTheme(options, config) {
3343
- const {
3344
- mode,
3345
- tone,
3346
- scheme,
3347
- state
3348
- } = options, tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
3349
- hue,
3350
- scheme
3351
- };
3352
- return {
3353
- _blend: blendMode[scheme === "light" ? 0 : 1],
3354
- bg: resolveColorTokenValue(context, tokens?.bg),
3355
- border: resolveColorTokenValue(context, tokens?.border),
3356
- fg: resolveColorTokenValue(context, tokens?.fg),
3357
- muted: {
3358
- bg: resolveColorTokenValue(context, tokens?.muted?.bg)
3359
- },
3360
- placeholder: resolveColorTokenValue(context, tokens?.placeholder)
2805
+ syntax: color_v0.syntax
3361
2806
  };
2807
+ return cache$3.set(color_v0, color_v2), color_v2;
3362
2808
  }
3363
- function buildSelectableColorTheme(options, config) {
3364
- const {
3365
- scheme
3366
- } = options, tones2 = {};
3367
- for (const tone of THEME_COLOR_STATE_TONES)
3368
- tones2[tone] = buildSelectableStatesColorTheme({
3369
- scheme,
3370
- tone
3371
- }, config);
3372
- return tones2;
3373
- }
3374
- function buildSelectableStatesColorTheme(options, config) {
3375
- const {
3376
- scheme,
3377
- tone
3378
- } = options, states = {};
3379
- for (const state of THEME_COLOR_STATES)
3380
- states[state] = buildSelectableStateColorTheme({
3381
- tone,
3382
- scheme,
3383
- state
3384
- }, config);
3385
- return states;
3386
- }
3387
- function buildSelectableStateColorTheme(options, config) {
3388
- const {
3389
- scheme,
3390
- state,
3391
- tone
3392
- } = options, tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
3393
- hue,
3394
- scheme
3395
- };
2809
+ function stateTonesThemeColor_v0_v2(v0, t) {
3396
2810
  return {
3397
- _blend: blendMode[scheme === "light" ? 0 : 1],
3398
- accent: {
3399
- fg: resolveColorTokenValue(context, tokens?.accent?.fg)
3400
- },
3401
- avatar: buildAvatarColorTheme({
3402
- scheme
3403
- }, tokens),
3404
- badge: buildBadgeColorTheme(tokens?.badge, {
3405
- scheme
3406
- }, config),
3407
- bg: resolveColorTokenValue(context, tokens?.bg),
3408
- border: resolveColorTokenValue(context, tokens?.border),
3409
- code: {
3410
- bg: resolveColorTokenValue(context, tokens?.code?.bg),
3411
- fg: resolveColorTokenValue(context, tokens?.code?.fg)
3412
- },
3413
- fg: resolveColorTokenValue(context, tokens?.fg),
3414
- icon: resolveColorTokenValue(context, tokens?.icon),
3415
- muted: {
3416
- bg: resolveColorTokenValue(context, tokens?.muted?.bg),
3417
- fg: resolveColorTokenValue(context, tokens?.muted?.fg)
3418
- },
3419
- kbd: {
3420
- bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
3421
- fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
3422
- border: resolveColorTokenValue(context, tokens?.kbd?.border)
3423
- },
3424
- link: {
3425
- fg: resolveColorTokenValue(context, tokens?.link?.fg)
2811
+ default: {
2812
+ enabled: stateThemeColor_v0_v2(v0, t.default.enabled),
2813
+ hovered: stateThemeColor_v0_v2(v0, t.default.hovered),
2814
+ pressed: stateThemeColor_v0_v2(v0, t.default.pressed),
2815
+ selected: stateThemeColor_v0_v2(v0, t.default.selected),
2816
+ disabled: stateThemeColor_v0_v2(v0, t.default.disabled)
3426
2817
  },
3427
- skeleton: {
3428
- from: resolveColorTokenValue(context, tokens?.skeleton?.from),
3429
- to: resolveColorTokenValue(context, tokens?.skeleton?.to)
3430
- }
3431
- };
3432
- }
3433
- function buildSyntaxColorTheme(options, config) {
3434
- const {
3435
- scheme
3436
- } = options, tokens = config?.color?.syntax, context = {
3437
- hue: "gray",
3438
- scheme
3439
- };
3440
- return {
3441
- atrule: resolveColorTokenValue(context, tokens?.atrule),
3442
- attrName: resolveColorTokenValue(context, tokens?.attrName),
3443
- attrValue: resolveColorTokenValue(context, tokens?.attrValue),
3444
- attribute: resolveColorTokenValue(context, tokens?.attribute),
3445
- boolean: resolveColorTokenValue(context, tokens?.boolean),
3446
- builtin: resolveColorTokenValue(context, tokens?.builtin),
3447
- cdata: resolveColorTokenValue(context, tokens?.cdata),
3448
- char: resolveColorTokenValue(context, tokens?.char),
3449
- class: resolveColorTokenValue(context, tokens?.class),
3450
- className: resolveColorTokenValue(context, tokens?.className),
3451
- comment: resolveColorTokenValue(context, tokens?.comment),
3452
- constant: resolveColorTokenValue(context, tokens?.constant),
3453
- deleted: resolveColorTokenValue(context, tokens?.deleted),
3454
- doctype: resolveColorTokenValue(context, tokens?.doctype),
3455
- entity: resolveColorTokenValue(context, tokens?.entity),
3456
- function: resolveColorTokenValue(context, tokens?.function),
3457
- hexcode: resolveColorTokenValue(context, tokens?.hexcode),
3458
- id: resolveColorTokenValue(context, tokens?.id),
3459
- important: resolveColorTokenValue(context, tokens?.important),
3460
- inserted: resolveColorTokenValue(context, tokens?.inserted),
3461
- keyword: resolveColorTokenValue(context, tokens?.keyword),
3462
- number: resolveColorTokenValue(context, tokens?.number),
3463
- operator: resolveColorTokenValue(context, tokens?.operator),
3464
- prolog: resolveColorTokenValue(context, tokens?.prolog),
3465
- property: resolveColorTokenValue(context, tokens?.property),
3466
- pseudoClass: resolveColorTokenValue(context, tokens?.pseudoClass),
3467
- pseudoElement: resolveColorTokenValue(context, tokens?.pseudoElement),
3468
- punctuation: resolveColorTokenValue(context, tokens?.punctuation),
3469
- regex: resolveColorTokenValue(context, tokens?.regex),
3470
- selector: resolveColorTokenValue(context, tokens?.selector),
3471
- string: resolveColorTokenValue(context, tokens?.string),
3472
- symbol: resolveColorTokenValue(context, tokens?.symbol),
3473
- tag: resolveColorTokenValue(context, tokens?.tag),
3474
- unit: resolveColorTokenValue(context, tokens?.unit),
3475
- url: resolveColorTokenValue(context, tokens?.url),
3476
- variable: resolveColorTokenValue(context, tokens?.variable)
3477
- };
3478
- }
3479
- const defaultColorPalette = color;
3480
- function mixChannel(b, s, weight) {
3481
- const delta = (s - b) * weight;
3482
- return b + delta;
3483
- }
3484
- function mix(b, s, weight) {
3485
- return {
3486
- r: mixChannel(b.r, s.r, weight),
3487
- g: mixChannel(b.g, s.g, weight),
3488
- b: mixChannel(b.b, s.b, weight)
3489
- };
3490
- }
3491
- function multiplyChannel(b, s) {
3492
- return b * s;
3493
- }
3494
- function multiply(b, s) {
3495
- return {
3496
- r: multiplyChannel(b.r / 255, s.r / 255) * 255,
3497
- g: multiplyChannel(b.g / 255, s.g / 255) * 255,
3498
- b: multiplyChannel(b.b / 255, s.b / 255) * 255
3499
- };
3500
- }
3501
- function screenChannel(b, s) {
3502
- return b + s - b * s;
3503
- }
3504
- function screen(b, s) {
3505
- return {
3506
- r: screenChannel(b.r / 255, s.r / 255) * 255,
3507
- g: screenChannel(b.g / 255, s.g / 255) * 255,
3508
- b: screenChannel(b.b / 255, s.b / 255) * 255
3509
- };
3510
- }
3511
- function lerp(x, y, a) {
3512
- return x * (1 - a) + y * a;
3513
- }
3514
- function invlerp(x, y, a) {
3515
- return clamp((a - x) / (y - x));
3516
- }
3517
- function clamp(a, min = 0, max = 1) {
3518
- return Math.min(max, Math.max(min, a));
3519
- }
3520
- function range(x1, y1, x2, y2, a) {
3521
- return lerp(x2, y2, invlerp(x1, y1, a));
3522
- }
3523
- function round(value) {
3524
- return Math.round(value);
3525
- }
3526
- function hexToRgb(hex) {
3527
- if (hex.length === 4) {
3528
- const hexR = hex.slice(1, 2), hexG = hex.slice(2, 3), hexB = hex.slice(3, 4);
3529
- return {
3530
- r: parseInt(hexR + hexR, 16),
3531
- g: parseInt(hexG + hexG, 16),
3532
- b: parseInt(hexB + hexB, 16)
3533
- };
3534
- }
3535
- return {
3536
- r: parseInt(hex.slice(1, 3), 16),
3537
- g: parseInt(hex.slice(3, 5), 16),
3538
- b: parseInt(hex.slice(5, 7), 16)
3539
- };
3540
- }
3541
- function rgbaToRGBA(rgba2) {
3542
- const values = rgba2.replace(/rgba\(|\)/g, "").split(",");
3543
- return {
3544
- r: parseInt(values[0]),
3545
- g: parseInt(values[1]),
3546
- b: parseInt(values[2]),
3547
- a: parseFloat(values[3])
3548
- };
3549
- }
3550
- function rgbToHex(color2) {
3551
- const r = round(clamp(Math.round(color2.r), 0, 255)), g = round(clamp(Math.round(color2.g), 0, 255)), b = round(clamp(Math.round(color2.b), 0, 255));
3552
- return "a" in color2 ? `rgba(${r},${g},${b},${color2.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
3553
- }
3554
- function rgbToHsl({
3555
- r,
3556
- g,
3557
- b
3558
- }) {
3559
- r /= 255, g /= 255, b /= 255;
3560
- const cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin;
3561
- let h = 0, s = 0, l = 0;
3562
- return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), {
3563
- h,
3564
- s,
3565
- l
3566
- };
3567
- }
3568
- function hslToRgb(hsl) {
3569
- const s = hsl.s / 100, l = hsl.l / 100, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hsl.h / 60 % 2 - 1)), m = l - c / 2;
3570
- let r = 0, g = 0, b = 0;
3571
- return 0 <= hsl.h && hsl.h < 60 ? (r = c, g = x, b = 0) : 60 <= hsl.h && hsl.h < 120 ? (r = x, g = c, b = 0) : 120 <= hsl.h && hsl.h < 180 ? (r = 0, g = c, b = x) : 180 <= hsl.h && hsl.h < 240 ? (r = 0, g = x, b = c) : 240 <= hsl.h && hsl.h < 300 ? (r = x, g = 0, b = c) : 300 <= hsl.h && hsl.h < 360 && (r = c, g = 0, b = x), {
3572
- r: Math.round((r + m) * 255),
3573
- g: Math.round((g + m) * 255),
3574
- b: Math.round((b + m) * 255)
3575
- };
3576
- }
3577
- const HEX_CHARS = "0123456789ABCDEFabcdef", HSL_RE = /hsl\(\s*(\d+)\s*,\s*((\d+(?:\.\d+)?)%)\s*,\s*((\d+(?:\.\d+)?)%)\s*\)/i;
3578
- function isHexChars(str) {
3579
- for (const c of str)
3580
- if (HEX_CHARS.indexOf(c) === -1)
3581
- return !1;
3582
- return !0;
3583
- }
3584
- function isHex(str) {
3585
- return str[0] !== "#" || !(str.length === 4 || str.length === 7) ? !1 : isHexChars(str.slice(1));
3586
- }
3587
- function parseHsl(str) {
3588
- const res = HSL_RE.exec(str);
3589
- if (!res)
3590
- throw new Error(`parseHsl: string is not a HSL color: "${str}"`);
3591
- return {
3592
- h: parseInt(res[1]),
3593
- s: parseFloat(res[3]),
3594
- l: parseFloat(res[5])
3595
- };
3596
- }
3597
- function parseColor(color2) {
3598
- if (!color2) return {
3599
- r: 0,
3600
- g: 0,
3601
- b: 0
3602
- };
3603
- if (typeof color2 != "string")
3604
- throw new Error("parseColor: expected a string");
3605
- if (isHex(color2))
3606
- return hexToRgb(color2);
3607
- if (color2.startsWith("hsl("))
3608
- return hslToRgb(parseHsl(color2));
3609
- if (color2.startsWith("rgba("))
3610
- return rgbaToRGBA(color2);
3611
- throw new Error(`parseColor: unexpected color format: "${color2}"`);
3612
- }
3613
- function getContrastRatio(bg, fg) {
3614
- const rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
3615
- return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
3616
- }
3617
- function rgb_lrgb({
3618
- r,
3619
- g,
3620
- b
3621
- }) {
3622
- return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
3623
- }
3624
- function rgb_lrgb1(v) {
3625
- return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
3626
- }
3627
- function lrgb_luminance([r, g, b]) {
3628
- return 0.2126 * r + 0.7152 * g + 0.0722 * b;
3629
- }
3630
- function rgba(color2, a) {
3631
- const rgb = parseColor(color2);
3632
- return `rgba(${rgb.r},${rgb.g},${rgb.b},${a})`;
3633
- }
3634
- const RGB_RANGE = [0, 255];
3635
- function mixThemeColor(value, options) {
3636
- const {
3637
- blendMode
3638
- } = options, color2 = parseColor(value), black2 = parseColor(options.black), white2 = parseColor(options.white), bg = options.bg ? parseColor(options.bg) : blendMode === "multiply" ? white2 : black2, paletteRange = {
3639
- r: [black2.r, white2.r],
3640
- g: [black2.g, white2.g],
3641
- b: [black2.b, white2.b]
3642
- }, convertedBgColor = {
3643
- r: clamp(range(...paletteRange.r, ...RGB_RANGE, bg.r), ...RGB_RANGE),
3644
- g: clamp(range(...paletteRange.g, ...RGB_RANGE, bg.g), ...RGB_RANGE),
3645
- b: clamp(range(...paletteRange.b, ...RGB_RANGE, bg.b), ...RGB_RANGE)
3646
- }, convertedColor = {
3647
- r: clamp(range(...paletteRange.r, ...RGB_RANGE, color2.r), ...RGB_RANGE),
3648
- g: clamp(range(...paletteRange.g, ...RGB_RANGE, color2.g), ...RGB_RANGE),
3649
- b: clamp(range(...paletteRange.b, ...RGB_RANGE, color2.b), ...RGB_RANGE)
3650
- }, resultColor = blendMode === "multiply" ? multiply(convertedBgColor, convertedColor) : screen(convertedBgColor, convertedColor), v = {
3651
- r: clamp(range(...RGB_RANGE, ...paletteRange.r, resultColor.r), ...paletteRange.r),
3652
- g: clamp(range(...RGB_RANGE, ...paletteRange.g, resultColor.g), ...paletteRange.g),
3653
- b: clamp(range(...RGB_RANGE, ...paletteRange.b, resultColor.b), ...paletteRange.b)
3654
- };
3655
- return rgbToHex(v);
3656
- }
3657
- function renderColorValue(str, options) {
3658
- const {
3659
- bg,
3660
- blendMode,
3661
- colorPalette
3662
- } = options;
3663
- if (bg === "white")
3664
- throw new Error("Cannot blend with white background");
3665
- const node = parseTokenValue(str);
3666
- if (!node || node.type !== "color")
3667
- throw new Error(`Invalid color token value: ${str}`);
3668
- let hex = "";
3669
- if (node.key === "black" && (hex = renderColorHex(colorPalette.black)), node.key === "white" && (hex = renderColorHex(colorPalette.white)), node.hue && node.tint && (hex = renderColorHex(colorPalette[node.hue][node.tint])), !hex)
3670
- throw new Error(`Invalid color token value: ${str}`);
3671
- const hexBeforeMix = hex, mixOptions = {
3672
- blendMode,
3673
- bg,
3674
- black: renderColorHex(colorPalette.black),
3675
- // opacity: node.opacity,
3676
- white: renderColorHex(colorPalette.white)
3677
- };
3678
- try {
3679
- if (hex = mixThemeColor(hex, mixOptions), bg && node.mix !== void 0) {
3680
- const from = hexToRgb(bg), to = hexToRgb(hex);
3681
- hex = rgbToHex(mix(from, to, node.mix));
3682
- }
3683
- } catch (err) {
3684
- throw console.warn("could not blend", hex, mixOptions), err;
3685
- }
3686
- return hex === "#aN" && (console.warn(`invalid color token value: ${str}`), hex = hexBeforeMix), node.opacity !== void 0 && (hex = rgba(hex, node.opacity)), hex;
3687
- }
3688
- function renderColorHex(color2) {
3689
- return typeof color2 == "string" ? color2 : color2.hex;
3690
- }
3691
- function renderThemeColorSchemes(value, config) {
3692
- const colorPalette = config?.palette ?? defaultColorPalette;
3693
- return {
3694
- light: renderThemeColorScheme(colorPalette, value.light),
3695
- dark: renderThemeColorScheme(colorPalette, value.dark)
3696
- };
3697
- }
3698
- function renderThemeColorScheme(colorPalette, value) {
3699
- const toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, {
3700
- colorPalette
3701
- }), renderedDefaultTone = renderThemeColor(defaultTone, {
3702
- colorPalette
3703
- }), bg = renderedDefaultTone.bg;
3704
- if (bg === "white")
3705
- throw new Error("Cannot blend with white background");
3706
- return Object.fromEntries([["transparent", renderedTransparentTone], ["default", renderedDefaultTone], ...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [k, renderThemeColor(v, {
3707
- bg,
3708
- colorPalette
3709
- })])]);
3710
- }
3711
- function renderThemeColor(value, options) {
3712
- const {
3713
- colorPalette,
3714
- bg
3715
- } = options, blendMode = value._blend || "multiply", baseBg = renderColorValue(value.bg, {
3716
- colorPalette,
3717
- bg,
3718
- blendMode
3719
- }), colorOptions = {
3720
- colorPalette,
3721
- bg: baseBg,
3722
- blendMode
3723
- }, button = renderThemeColorButton(value.button, {
3724
- baseBg,
3725
- blendMode,
3726
- colorPalette
3727
- }), selectable = renderThemeColorSelectable(value.selectable, {
3728
- colorPalette,
3729
- baseBg,
3730
- blendMode
3731
- }), shadow = {
3732
- outline: renderColorValue(value.shadow.outline, colorOptions),
3733
- umbra: renderColorValue(value.shadow.umbra, {
3734
- ...colorOptions,
3735
- bg: void 0,
3736
- colorPalette: {
3737
- ...colorPalette,
3738
- black: "#000000"
3739
- }
3740
- }),
3741
- penumbra: renderColorValue(value.shadow.penumbra, {
3742
- ...colorOptions,
3743
- bg: void 0,
3744
- colorPalette: {
3745
- ...colorPalette,
3746
- black: "#000000"
3747
- }
3748
- }),
3749
- ambient: renderColorValue(value.shadow.ambient, {
3750
- ...colorOptions,
3751
- bg: void 0,
3752
- colorPalette: {
3753
- ...colorPalette,
3754
- black: "#000000"
3755
- }
3756
- })
3757
- };
3758
- return {
3759
- _blend: blendMode,
3760
- _dark: value._dark,
3761
- accent: {
3762
- fg: renderColorValue(value.accent.fg, colorOptions)
2818
+ neutral: {
2819
+ enabled: stateThemeColor_v0_v2(v0, t.default.enabled),
2820
+ hovered: stateThemeColor_v0_v2(v0, t.default.hovered),
2821
+ pressed: stateThemeColor_v0_v2(v0, t.default.pressed),
2822
+ selected: stateThemeColor_v0_v2(v0, t.default.selected),
2823
+ disabled: stateThemeColor_v0_v2(v0, t.default.disabled)
3763
2824
  },
3764
- avatar: renderThemeColorAvatar(value.avatar, {
3765
- baseBg,
3766
- colorPalette,
3767
- blendMode
3768
- }),
3769
- backdrop: renderColorValue(value.backdrop, colorOptions),
3770
- badge: renderThemeColorBadge(value.badge, {
3771
- baseBg,
3772
- colorPalette,
3773
- blendMode
3774
- }),
3775
- bg: baseBg,
3776
- border: renderColorValue(value.border, colorOptions),
3777
- button,
3778
- code: {
3779
- bg: renderColorValue(value.code.bg, colorOptions),
3780
- fg: renderColorValue(value.code.fg, colorOptions)
2825
+ primary: {
2826
+ enabled: stateThemeColor_v0_v2(v0, t.primary.enabled),
2827
+ hovered: stateThemeColor_v0_v2(v0, t.primary.hovered),
2828
+ pressed: stateThemeColor_v0_v2(v0, t.primary.pressed),
2829
+ selected: stateThemeColor_v0_v2(v0, t.primary.selected),
2830
+ disabled: stateThemeColor_v0_v2(v0, t.primary.disabled)
3781
2831
  },
3782
- fg: renderColorValue(value.fg, colorOptions),
3783
- focusRing: renderColorValue(value.focusRing, colorOptions),
3784
- icon: renderColorValue(value.icon, colorOptions),
3785
- input: renderThemeColorInput(value.input, {
3786
- baseBg,
3787
- colorPalette,
3788
- blendMode
3789
- }),
3790
- kbd: renderThemeColorKBD(value.kbd, {
3791
- baseBg,
3792
- colorPalette,
3793
- blendMode
3794
- }),
3795
- link: {
3796
- fg: renderColorValue(value.link.fg, colorOptions)
2832
+ suggest: {
2833
+ enabled: stateThemeColor_v0_v2(v0, t.primary.enabled),
2834
+ hovered: stateThemeColor_v0_v2(v0, t.primary.hovered),
2835
+ pressed: stateThemeColor_v0_v2(v0, t.primary.pressed),
2836
+ selected: stateThemeColor_v0_v2(v0, t.primary.selected),
2837
+ disabled: stateThemeColor_v0_v2(v0, t.primary.disabled)
3797
2838
  },
3798
- muted: {
3799
- bg: renderColorValue(value.muted.bg, colorOptions),
3800
- fg: renderColorValue(value.muted.fg, colorOptions)
2839
+ positive: {
2840
+ enabled: stateThemeColor_v0_v2(v0, t.positive.enabled),
2841
+ hovered: stateThemeColor_v0_v2(v0, t.positive.hovered),
2842
+ pressed: stateThemeColor_v0_v2(v0, t.positive.pressed),
2843
+ selected: stateThemeColor_v0_v2(v0, t.positive.selected),
2844
+ disabled: stateThemeColor_v0_v2(v0, t.positive.disabled)
3801
2845
  },
3802
- shadow,
3803
- skeleton: {
3804
- from: renderColorValue(value.skeleton.from, colorOptions),
3805
- to: renderColorValue(value.skeleton.to, colorOptions)
2846
+ caution: {
2847
+ enabled: stateThemeColor_v0_v2(v0, t.caution.enabled),
2848
+ hovered: stateThemeColor_v0_v2(v0, t.caution.hovered),
2849
+ pressed: stateThemeColor_v0_v2(v0, t.caution.pressed),
2850
+ selected: stateThemeColor_v0_v2(v0, t.caution.selected),
2851
+ disabled: stateThemeColor_v0_v2(v0, t.caution.disabled)
3806
2852
  },
3807
- syntax: renderSyntaxColorTheme(value.syntax, {
3808
- baseBg,
3809
- colorPalette,
3810
- blendMode
3811
- }),
3812
- selectable
3813
- };
3814
- }
3815
- function renderThemeColorKBD(value, options) {
3816
- const {
3817
- baseBg,
3818
- blendMode,
3819
- colorPalette
3820
- } = options, rootOptions = {
3821
- bg: baseBg,
3822
- blendMode,
3823
- colorPalette
3824
- }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
3825
- bg,
3826
- blendMode,
3827
- colorPalette
3828
- };
3829
- return {
3830
- bg,
3831
- fg: renderColorValue(value.fg, colorOptions),
3832
- border: renderColorValue(value.border, colorOptions)
3833
- };
3834
- }
3835
- function renderThemeColorAvatar(value, options) {
3836
- return {
3837
- gray: renderThemeColorAvatarColor(value.gray, options),
3838
- blue: renderThemeColorAvatarColor(value.blue, options),
3839
- purple: renderThemeColorAvatarColor(value.purple, options),
3840
- magenta: renderThemeColorAvatarColor(value.magenta, options),
3841
- red: renderThemeColorAvatarColor(value.red, options),
3842
- orange: renderThemeColorAvatarColor(value.orange, options),
3843
- yellow: renderThemeColorAvatarColor(value.yellow, options),
3844
- green: renderThemeColorAvatarColor(value.green, options),
3845
- cyan: renderThemeColorAvatarColor(value.cyan, options)
3846
- };
3847
- }
3848
- function renderThemeColorAvatarColor(value, options) {
3849
- const {
3850
- baseBg,
3851
- blendMode: rootBlendMode,
3852
- colorPalette
3853
- } = options, blendMode = value._blend || "multiply", rootOptions = {
3854
- bg: baseBg,
3855
- blendMode: rootBlendMode,
3856
- colorPalette
3857
- }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
3858
- bg,
3859
- blendMode,
3860
- colorPalette
3861
- };
3862
- return {
3863
- _blend: blendMode,
3864
- bg,
3865
- fg: renderColorValue(value.fg, colorOptions)
3866
- };
3867
- }
3868
- function renderThemeColorBadge(value, options) {
3869
- return {
3870
- default: renderThemeColorBadgeColor(value.default, options),
3871
- primary: renderThemeColorBadgeColor(value.primary, options),
3872
- positive: renderThemeColorBadgeColor(value.positive, options),
3873
- caution: renderThemeColorBadgeColor(value.caution, options),
3874
- critical: renderThemeColorBadgeColor(value.critical, options)
3875
- };
3876
- }
3877
- function renderThemeColorBadgeColor(value, options) {
3878
- const {
3879
- baseBg,
3880
- blendMode: rootBlendMode,
3881
- colorPalette
3882
- } = options, blendMode = rootBlendMode, rootOptions = {
3883
- bg: baseBg,
3884
- blendMode: rootBlendMode,
3885
- colorPalette
3886
- }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
3887
- bg,
3888
- blendMode,
3889
- colorPalette
3890
- };
3891
- return {
3892
- bg,
3893
- dot: renderColorValue(value.dot, colorOptions),
3894
- fg: renderColorValue(value.fg, colorOptions),
3895
- icon: renderColorValue(value.icon, colorOptions)
3896
- };
3897
- }
3898
- function renderThemeColorButton(value, options) {
3899
- return {
3900
- default: renderThemeColorButtonTones(value.default, options),
3901
- ghost: renderThemeColorButtonTones(value.ghost, options),
3902
- bleed: renderThemeColorButtonTones(value.bleed, options)
3903
- };
3904
- }
3905
- function renderThemeColorButtonTones(value, options) {
3906
- return {
3907
- default: renderThemeColorButtonStates(value.default, options),
3908
- primary: renderThemeColorButtonStates(value.primary, options),
3909
- positive: renderThemeColorButtonStates(value.positive, options),
3910
- caution: renderThemeColorButtonStates(value.caution, options),
3911
- critical: renderThemeColorButtonStates(value.critical, options)
3912
- };
3913
- }
3914
- function renderThemeColorButtonStates(value, options) {
3915
- return {
3916
- enabled: renderThemeColorState(value.enabled, options),
3917
- hovered: renderThemeColorState(value.hovered, options),
3918
- pressed: renderThemeColorState(value.pressed, options),
3919
- selected: renderThemeColorState(value.selected, options),
3920
- disabled: renderThemeColorState(value.disabled, options)
2853
+ critical: {
2854
+ enabled: stateThemeColor_v0_v2(v0, t.critical.enabled),
2855
+ hovered: stateThemeColor_v0_v2(v0, t.critical.hovered),
2856
+ pressed: stateThemeColor_v0_v2(v0, t.critical.pressed),
2857
+ selected: stateThemeColor_v0_v2(v0, t.critical.selected),
2858
+ disabled: stateThemeColor_v0_v2(v0, t.critical.disabled)
2859
+ }
3921
2860
  };
3922
2861
  }
3923
- function renderThemeColorState(value, options) {
3924
- const {
3925
- baseBg,
3926
- blendMode: rootBlendMode,
3927
- colorPalette
3928
- } = options, blendMode = value._blend || "multiply", rootOptions = {
3929
- bg: baseBg,
3930
- blendMode: rootBlendMode,
3931
- colorPalette
3932
- }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
3933
- bg,
3934
- blendMode,
3935
- colorPalette
3936
- };
2862
+ function stateThemeColor_v0_v2(v0, state) {
3937
2863
  return {
3938
- _blend: blendMode,
3939
- accent: {
3940
- fg: renderColorValue(value.accent.fg, colorOptions)
2864
+ ...state,
2865
+ avatar: {
2866
+ gray: {
2867
+ bg: v0.spot.gray,
2868
+ fg: v0.base.bg
2869
+ },
2870
+ blue: {
2871
+ bg: v0.spot.blue,
2872
+ fg: v0.base.bg
2873
+ },
2874
+ purple: {
2875
+ bg: v0.spot.purple,
2876
+ fg: v0.base.bg
2877
+ },
2878
+ magenta: {
2879
+ bg: v0.spot.magenta,
2880
+ fg: v0.base.bg
2881
+ },
2882
+ red: {
2883
+ bg: v0.spot.red,
2884
+ fg: v0.base.bg
2885
+ },
2886
+ orange: {
2887
+ bg: v0.spot.orange,
2888
+ fg: v0.base.bg
2889
+ },
2890
+ yellow: {
2891
+ bg: v0.spot.yellow,
2892
+ fg: v0.base.bg
2893
+ },
2894
+ green: {
2895
+ bg: v0.spot.green,
2896
+ fg: v0.base.bg
2897
+ },
2898
+ cyan: {
2899
+ bg: v0.spot.cyan,
2900
+ fg: v0.base.bg
2901
+ }
3941
2902
  },
3942
- avatar: renderThemeColorAvatar(value.avatar, {
3943
- baseBg: bg,
3944
- colorPalette,
3945
- blendMode
3946
- }),
3947
- badge: renderThemeColorBadge(value.badge, {
3948
- baseBg: bg,
3949
- colorPalette,
3950
- blendMode
3951
- }),
3952
- bg,
3953
- border: renderColorValue(value.border, colorOptions),
3954
- code: {
3955
- bg: renderColorValue(value.code.bg, colorOptions),
3956
- fg: renderColorValue(value.code.fg, colorOptions)
2903
+ badge: {
2904
+ default: {
2905
+ bg: v0.muted.default.enabled.bg,
2906
+ fg: v0.muted.default.enabled.fg,
2907
+ dot: v0.muted.default.enabled.muted.fg,
2908
+ icon: v0.muted.default.enabled.muted.fg
2909
+ },
2910
+ neutral: {
2911
+ bg: v0.muted.transparent.enabled.bg,
2912
+ fg: v0.muted.transparent.enabled.fg,
2913
+ dot: v0.muted.transparent.enabled.muted.fg,
2914
+ icon: v0.muted.transparent.enabled.muted.fg
2915
+ },
2916
+ primary: {
2917
+ bg: v0.muted.primary.enabled.bg,
2918
+ fg: v0.muted.primary.enabled.fg,
2919
+ dot: v0.muted.primary.enabled.muted.fg,
2920
+ icon: v0.muted.primary.enabled.muted.fg
2921
+ },
2922
+ suggest: {
2923
+ bg: v0.muted.primary.enabled.bg,
2924
+ fg: v0.muted.primary.enabled.fg,
2925
+ dot: v0.muted.primary.enabled.muted.fg,
2926
+ icon: v0.muted.primary.enabled.muted.fg
2927
+ },
2928
+ positive: {
2929
+ bg: v0.muted.positive.enabled.bg,
2930
+ fg: v0.muted.positive.enabled.fg,
2931
+ dot: v0.muted.positive.enabled.muted.fg,
2932
+ icon: v0.muted.positive.enabled.muted.fg
2933
+ },
2934
+ caution: {
2935
+ bg: v0.muted.caution.enabled.bg,
2936
+ fg: v0.muted.caution.enabled.fg,
2937
+ dot: v0.muted.caution.enabled.muted.fg,
2938
+ icon: v0.muted.caution.enabled.muted.fg
2939
+ },
2940
+ critical: {
2941
+ bg: v0.muted.critical.enabled.bg,
2942
+ fg: v0.muted.critical.enabled.fg,
2943
+ dot: v0.muted.critical.enabled.muted.fg,
2944
+ icon: v0.muted.critical.enabled.muted.fg
2945
+ }
3957
2946
  },
3958
- fg: renderColorValue(value.fg, colorOptions),
3959
- icon: renderColorValue(value.icon, colorOptions),
3960
- link: {
3961
- fg: renderColorValue(value.link.fg, colorOptions)
2947
+ kbd: {
2948
+ bg: v0.muted.default.enabled.bg,
2949
+ fg: v0.muted.default.enabled.fg,
2950
+ border: v0.muted.default.enabled.border
3962
2951
  },
3963
2952
  muted: {
3964
- bg: renderColorValue(value.muted.bg, colorOptions),
3965
- fg: renderColorValue(value.muted.fg, colorOptions)
3966
- },
3967
- kbd: {
3968
- bg: renderColorValue(value.kbd.bg, colorOptions),
3969
- fg: renderColorValue(value.kbd.fg, colorOptions),
3970
- border: renderColorValue(value.kbd.border, colorOptions)
2953
+ ...v0.muted.default.enabled.muted,
2954
+ bg: state.bg2 || state.bg
3971
2955
  },
3972
2956
  skeleton: {
3973
- from: renderColorValue(value.skeleton?.from, colorOptions),
3974
- to: renderColorValue(value.skeleton?.to, colorOptions)
2957
+ from: state.skeleton?.from || state.border,
2958
+ to: state.skeleton?.to || state.border
3975
2959
  }
3976
2960
  };
3977
2961
  }
3978
- function renderThemeColorInput(value, options) {
3979
- return {
3980
- default: renderInputStatesColorTheme(value.default, options),
3981
- invalid: renderInputStatesColorTheme(value.invalid, options)
3982
- };
3983
- }
3984
- function renderInputStatesColorTheme(value, options) {
2962
+ function inputStatesThemeColor_v0_v2(states) {
3985
2963
  return {
3986
- enabled: renderInputStateColorTheme(value.enabled, options),
3987
- hovered: renderInputStateColorTheme(value.hovered, options),
3988
- readOnly: renderInputStateColorTheme(value.readOnly, options),
3989
- disabled: renderInputStateColorTheme(value.disabled, options)
2964
+ enabled: inputStateThemeColor_v0_v2(states.enabled),
2965
+ disabled: inputStateThemeColor_v0_v2(states.disabled),
2966
+ readOnly: inputStateThemeColor_v0_v2(states.readOnly),
2967
+ hovered: inputStateThemeColor_v0_v2(states.hovered)
3990
2968
  };
3991
2969
  }
3992
- function renderInputStateColorTheme(value, options) {
3993
- const {
3994
- baseBg,
3995
- blendMode: rootBlendMode,
3996
- colorPalette
3997
- } = options, blendMode = value._blend || "multiply", rootOptions = {
3998
- colorPalette,
3999
- bg: baseBg,
4000
- blendMode: rootBlendMode
4001
- }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
4002
- colorPalette,
4003
- bg,
4004
- blendMode
4005
- };
2970
+ function inputStateThemeColor_v0_v2(state) {
4006
2971
  return {
4007
- _blend: blendMode,
4008
- bg,
4009
- border: renderColorValue(value.border, colorOptions),
4010
- fg: renderColorValue(value.fg, colorOptions),
2972
+ bg: state.bg,
2973
+ border: state.border,
2974
+ fg: state.fg,
4011
2975
  muted: {
4012
- bg: renderColorValue(value.muted.bg, colorOptions)
2976
+ bg: state.bg2
4013
2977
  },
4014
- placeholder: renderColorValue(value.placeholder, colorOptions)
4015
- };
4016
- }
4017
- function renderThemeColorSelectable(value, options) {
4018
- return {
4019
- default: renderThemeColorSelectableStates(value.default, options),
4020
- primary: renderThemeColorSelectableStates(value.primary, options),
4021
- positive: renderThemeColorSelectableStates(value.positive, options),
4022
- caution: renderThemeColorSelectableStates(value.caution, options),
4023
- critical: renderThemeColorSelectableStates(value.critical, options)
4024
- };
4025
- }
4026
- function renderThemeColorSelectableStates(value, options) {
4027
- return {
4028
- enabled: renderThemeColorState(value.enabled, options),
4029
- hovered: renderThemeColorState(value.hovered, options),
4030
- pressed: renderThemeColorState(value.pressed, options),
4031
- selected: renderThemeColorState(value.selected, options),
4032
- disabled: renderThemeColorState(value.disabled, options)
2978
+ placeholder: state.placeholder
4033
2979
  };
4034
2980
  }
4035
- function renderSyntaxColorTheme(value, options) {
2981
+ const cache$2 = /* @__PURE__ */ new WeakMap();
2982
+ function v0_v2(v0) {
2983
+ if (v0.v2) return v0.v2;
2984
+ const cached_v2 = cache$2.get(v0);
2985
+ if (cached_v2) return cached_v2;
4036
2986
  const {
4037
- colorPalette,
4038
- baseBg,
4039
- blendMode
4040
- } = options, colorOptions = {
4041
- colorPalette,
4042
- bg: baseBg,
4043
- blendMode
4044
- };
4045
- return {
4046
- atrule: renderColorValue(value.atrule, colorOptions),
4047
- attrName: renderColorValue(value.attrName, colorOptions),
4048
- attrValue: renderColorValue(value.attrValue, colorOptions),
4049
- attribute: renderColorValue(value.attribute, colorOptions),
4050
- boolean: renderColorValue(value.boolean, colorOptions),
4051
- builtin: renderColorValue(value.builtin, colorOptions),
4052
- cdata: renderColorValue(value.cdata, colorOptions),
4053
- char: renderColorValue(value.char, colorOptions),
4054
- class: renderColorValue(value.class, colorOptions),
4055
- className: renderColorValue(value.className, colorOptions),
4056
- comment: renderColorValue(value.comment, colorOptions),
4057
- constant: renderColorValue(value.constant, colorOptions),
4058
- deleted: renderColorValue(value.deleted, colorOptions),
4059
- doctype: renderColorValue(value.doctype, colorOptions),
4060
- entity: renderColorValue(value.entity, colorOptions),
4061
- function: renderColorValue(value.function, colorOptions),
4062
- hexcode: renderColorValue(value.hexcode, colorOptions),
4063
- id: renderColorValue(value.id, colorOptions),
4064
- important: renderColorValue(value.important, colorOptions),
4065
- inserted: renderColorValue(value.inserted, colorOptions),
4066
- keyword: renderColorValue(value.keyword, colorOptions),
4067
- number: renderColorValue(value.number, colorOptions),
4068
- operator: renderColorValue(value.operator, colorOptions),
4069
- prolog: renderColorValue(value.prolog, colorOptions),
4070
- property: renderColorValue(value.property, colorOptions),
4071
- pseudoClass: renderColorValue(value.pseudoClass, colorOptions),
4072
- pseudoElement: renderColorValue(value.pseudoElement, colorOptions),
4073
- punctuation: renderColorValue(value.punctuation, colorOptions),
4074
- regex: renderColorValue(value.regex, colorOptions),
4075
- selector: renderColorValue(value.selector, colorOptions),
4076
- string: renderColorValue(value.string, colorOptions),
4077
- symbol: renderColorValue(value.symbol, colorOptions),
4078
- tag: renderColorValue(value.tag, colorOptions),
4079
- unit: renderColorValue(value.unit, colorOptions),
4080
- url: renderColorValue(value.url, colorOptions),
4081
- variable: renderColorValue(value.variable, colorOptions)
4082
- };
4083
- }
4084
- function buildTheme(config) {
4085
- const colorTheme = buildColorTheme(config), v2 = {
2987
+ avatar,
2988
+ button,
2989
+ color,
2990
+ container,
2991
+ fonts: font,
2992
+ input,
2993
+ layer,
2994
+ media,
2995
+ radius,
2996
+ shadows: shadow,
2997
+ space,
2998
+ styles: style
2999
+ } = v0, v2 = {
4086
3000
  _version: 2,
4087
- avatar: config?.avatar ?? defaultThemeConfig.avatar,
4088
- button: config?.button ?? defaultThemeConfig.button,
4089
- card: config?.card ?? defaultThemeConfig.card,
4090
- // How colors are generated:
4091
- // 1. Merge custom tokens with default tokens
4092
- // 2. Generate tree of color keys (gray/500, black, white, etc.)
4093
- // 3. Apply mixing and render to hex values
4094
- // render(build(mergeWithDefaults()))
4095
- color: renderThemeColorSchemes(colorTheme, config),
4096
- container: config?.container ?? defaultThemeConfig.container,
4097
- font: config?.font ?? defaultThemeFonts,
4098
- input: config?.input ?? defaultThemeConfig.input,
4099
- layer: config?.layer ?? defaultThemeConfig.layer,
4100
- media: config?.media ?? defaultThemeConfig.media,
4101
- radius: config?.radius ?? defaultThemeConfig.radius,
4102
- shadow: config?.shadow ?? defaultThemeConfig.shadow,
4103
- space: config?.space ?? defaultThemeConfig.space,
4104
- style: config?.style ?? defaultThemeConfig.style
3001
+ avatar: {
3002
+ ...defaultThemeConfig.avatar,
3003
+ ...avatar
3004
+ },
3005
+ button: {
3006
+ ...defaultThemeConfig.button,
3007
+ ...button
3008
+ },
3009
+ card: defaultThemeConfig.card,
3010
+ color: {
3011
+ light: {
3012
+ transparent: themeColor_v0_v2(color.light.transparent),
3013
+ default: themeColor_v0_v2(color.light.default),
3014
+ neutral: themeColor_v0_v2(color.light.transparent),
3015
+ primary: themeColor_v0_v2(color.light.primary),
3016
+ suggest: themeColor_v0_v2(color.light.primary),
3017
+ positive: themeColor_v0_v2(color.light.positive),
3018
+ caution: themeColor_v0_v2(color.light.caution),
3019
+ critical: themeColor_v0_v2(color.light.critical)
3020
+ },
3021
+ dark: {
3022
+ transparent: themeColor_v0_v2(color.dark.transparent),
3023
+ default: themeColor_v0_v2(color.dark.default),
3024
+ neutral: themeColor_v0_v2(color.dark.transparent),
3025
+ primary: themeColor_v0_v2(color.dark.primary),
3026
+ suggest: themeColor_v0_v2(color.dark.primary),
3027
+ positive: themeColor_v0_v2(color.dark.positive),
3028
+ caution: themeColor_v0_v2(color.dark.caution),
3029
+ critical: themeColor_v0_v2(color.dark.critical)
3030
+ }
3031
+ },
3032
+ container,
3033
+ font,
3034
+ input: {
3035
+ ...defaultThemeConfig.input,
3036
+ ...input,
3037
+ checkbox: {
3038
+ ...defaultThemeConfig.input.checkbox,
3039
+ ...input.checkbox
3040
+ },
3041
+ radio: {
3042
+ ...defaultThemeConfig.input.radio,
3043
+ ...input.radio
3044
+ },
3045
+ switch: {
3046
+ ...defaultThemeConfig.input.switch,
3047
+ ...input.switch
3048
+ }
3049
+ },
3050
+ layer: layer ?? defaultThemeConfig.layer,
3051
+ media,
3052
+ radius,
3053
+ shadow,
3054
+ space,
3055
+ style
4105
3056
  };
4106
- return v2_v0(v2);
3057
+ return cache$2.set(v0, v2), v2;
4107
3058
  }
4108
- const cache = /* @__PURE__ */ new Map();
3059
+ const cache$1 = /* @__PURE__ */ new Map();
4109
3060
  function getScopedTheme(themeProp, scheme, tone) {
4110
3061
  const cachedTheme = _getCachedTheme(themeProp, scheme, tone);
4111
3062
  if (cachedTheme) return cachedTheme;
4112
- const v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp, v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp), colorScheme_v0 = v0.color[scheme] || v0.color.light, color_v0 = colorScheme_v0[tone] || colorScheme_v0.default, layer_v0 = v0.layer || defaultThemeConfig.layer, colorScheme_v2 = v2.color[scheme] || v2.color.light, color_v2 = colorScheme_v2[tone] || colorScheme_v2.default, layer_v2 = v2.layer || defaultThemeConfig.layer, theme = {
3063
+ const v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp, v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp), colorScheme_v0 = v0.color[scheme] || v0.color.light, color_v0 = colorScheme_v0[tone] || colorScheme_v0.default, layer_v0 = v0.layer || defaultThemeConfig.layer, colorScheme_v2 = v2.color[scheme] || v2.color.light, color_v2 = colorScheme_v2[tone] || colorScheme_v2.default, color_v2_9 = themeColor_v0_v2_9(color_v2), layer_v2 = v2.layer || defaultThemeConfig.layer, theme = {
4113
3064
  sanity: {
4114
3065
  ...v0,
4115
3066
  color: color_v0,
@@ -4117,7 +3068,7 @@ function getScopedTheme(themeProp, scheme, tone) {
4117
3068
  v2: {
4118
3069
  ...v2,
4119
3070
  _resolved: !0,
4120
- color: color_v2,
3071
+ color: color_v2_9,
4121
3072
  layer: layer_v2
4122
3073
  }
4123
3074
  }
@@ -4125,17 +3076,62 @@ function getScopedTheme(themeProp, scheme, tone) {
4125
3076
  return _setCachedTheme(themeProp, scheme, tone, theme), theme;
4126
3077
  }
4127
3078
  function _getCachedTheme(rootTheme, scheme, tone) {
4128
- const schemeCache = cache.get(scheme);
3079
+ const schemeCache = cache$1.get(scheme);
4129
3080
  if (!schemeCache) return;
4130
3081
  const toneCache = schemeCache.get(tone);
4131
3082
  if (toneCache)
4132
3083
  return toneCache.get(rootTheme);
4133
3084
  }
4134
3085
  function _setCachedTheme(rootTheme, scheme, tone, theme) {
4135
- cache.has(scheme) || cache.set(scheme, /* @__PURE__ */ new Map());
4136
- const schemeCache = cache.get(scheme);
3086
+ cache$1.has(scheme) || cache$1.set(scheme, /* @__PURE__ */ new Map());
3087
+ const schemeCache = cache$1.get(scheme);
4137
3088
  schemeCache.has(tone) || schemeCache.set(tone, /* @__PURE__ */ new WeakMap()), schemeCache.get(tone).set(rootTheme, theme);
4138
3089
  }
3090
+ const cache = /* @__PURE__ */ new WeakMap();
3091
+ function getTheme_v2(theme) {
3092
+ if (theme.sanity.v2?._resolved) return theme.sanity.v2;
3093
+ const cached_v2 = cache.get(theme);
3094
+ if (cached_v2) return cached_v2;
3095
+ const v2 = {
3096
+ _version: 2,
3097
+ _resolved: !0,
3098
+ avatar: {
3099
+ ...defaultThemeConfig.avatar,
3100
+ ...theme.sanity.avatar
3101
+ },
3102
+ button: {
3103
+ ...defaultThemeConfig.button,
3104
+ ...theme.sanity.button
3105
+ },
3106
+ card: defaultThemeConfig.card,
3107
+ color: themeColor_v0_v2(theme.sanity.color),
3108
+ container: theme.sanity.container,
3109
+ font: theme.sanity.fonts,
3110
+ input: {
3111
+ ...defaultThemeConfig.input,
3112
+ ...theme.sanity.input,
3113
+ checkbox: {
3114
+ ...defaultThemeConfig.input.checkbox,
3115
+ ...theme.sanity.input.checkbox
3116
+ },
3117
+ radio: {
3118
+ ...defaultThemeConfig.input.radio,
3119
+ ...theme.sanity.input.radio
3120
+ },
3121
+ switch: {
3122
+ ...defaultThemeConfig.input.switch,
3123
+ ...theme.sanity.input.switch
3124
+ }
3125
+ },
3126
+ layer: theme.sanity.layer ?? defaultThemeConfig.layer,
3127
+ media: theme.sanity.media,
3128
+ radius: theme.sanity.radius,
3129
+ shadow: theme.sanity.shadows,
3130
+ space: theme.sanity.space,
3131
+ style: theme.sanity.styles
3132
+ };
3133
+ return cache.set(theme, v2), v2;
3134
+ }
4139
3135
  export {
4140
3136
  AVATAR_SIZE,
4141
3137
  COLOR_CONFIG_AVATAR_COLORS,
@@ -4152,6 +3148,7 @@ export {
4152
3148
  FONT_HEADING_SIZE,
4153
3149
  FONT_LABEL_SIZE,
4154
3150
  FONT_TEXT_SIZE,
3151
+ HUES,
4155
3152
  RADIUS,
4156
3153
  SHADOW,
4157
3154
  SPACE,
@@ -4164,8 +3161,12 @@ export {
4164
3161
  THEME_COLOR_SCHEMES,
4165
3162
  THEME_COLOR_STATES,
4166
3163
  THEME_COLOR_STATE_TONES,
3164
+ TINTS,
3165
+ buildColor_v3,
4167
3166
  buildTheme,
3167
+ buildTheme_v3,
4168
3168
  createColorTheme,
3169
+ defaultTokens,
4169
3170
  getContrastRatio,
4170
3171
  getScopedTheme,
4171
3172
  getTheme_v2,
@@ -4183,19 +3184,17 @@ export {
4183
3184
  isColorTintKey,
4184
3185
  isColorTokenValue,
4185
3186
  isColorValue,
4186
- is_v0,
4187
- is_v2,
4188
3187
  mix,
4189
3188
  multiply,
4190
3189
  parseColor,
4191
3190
  parseTokenKey,
4192
3191
  parseTokenValue,
3192
+ renderColor,
3193
+ resolveTokens,
4193
3194
  rgbToHex,
4194
3195
  rgbToHsl,
4195
3196
  rgba,
4196
3197
  rgbaToRGBA,
4197
- screen,
4198
- v0_v2,
4199
- v2_v0
3198
+ screen
4200
3199
  };
4201
3200
  //# sourceMappingURL=theme.mjs.map