@sanity/ui 3.0.0-static.8 → 3.0.0

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