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