@sanity/ui 4.0.0-static.9 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (677) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +25 -7
  3. package/dist/_system-CTe2lb5l.d.ts +40 -0
  4. package/dist/_system-CTe2lb5l.d.ts.map +1 -0
  5. package/dist/arrow-CHE8-_G7.js +161 -0
  6. package/dist/arrow-CHE8-_G7.js.map +1 -0
  7. package/dist/autocomplete.d.ts +140 -0
  8. package/dist/autocomplete.d.ts.map +1 -0
  9. package/dist/autocomplete.js +475 -0
  10. package/dist/autocomplete.js.map +1 -0
  11. package/dist/breadcrumbs.d.ts +18 -0
  12. package/dist/breadcrumbs.d.ts.map +1 -0
  13. package/dist/breadcrumbs.js +116 -0
  14. package/dist/breadcrumbs.js.map +1 -0
  15. package/dist/button-dnqMFkWg.d.ts +76 -0
  16. package/dist/button-dnqMFkWg.d.ts.map +1 -0
  17. package/dist/button-mxfSqr0n.js +179 -0
  18. package/dist/button-mxfSqr0n.js.map +1 -0
  19. package/dist/card-C0a0wQTc.d.ts +7 -0
  20. package/dist/card-C0a0wQTc.d.ts.map +1 -0
  21. package/dist/code.d.ts +20 -0
  22. package/dist/code.d.ts.map +1 -0
  23. package/dist/code.js +90 -0
  24. package/dist/code.js.map +1 -0
  25. package/dist/codeFontStyle-DYUujk7K.js +11 -0
  26. package/dist/codeFontStyle-DYUujk7K.js.map +1 -0
  27. package/dist/component-DVlwaWB-.d.ts +25 -0
  28. package/dist/component-DVlwaWB-.d.ts.map +1 -0
  29. package/dist/element-BYgCE_iK.js +51 -0
  30. package/dist/element-BYgCE_iK.js.map +1 -0
  31. package/dist/factory-BA3gEfyI.js +3056 -0
  32. package/dist/factory-BA3gEfyI.js.map +1 -0
  33. package/dist/flex-C-5JHi1C.js +76 -0
  34. package/dist/flex-C-5JHi1C.js.map +1 -0
  35. package/dist/font-EtfxKPUz.d.ts +49 -0
  36. package/dist/font-EtfxKPUz.d.ts.map +1 -0
  37. package/dist/getElementRef-5HZQ-Owu.js +91 -0
  38. package/dist/getElementRef-5HZQ-Owu.js.map +1 -0
  39. package/dist/getScopedTheme-C-sZsyAz.js +267 -0
  40. package/dist/getScopedTheme-C-sZsyAz.js.map +1 -0
  41. package/dist/getTheme_v2-y09KqtEb.js +487 -0
  42. package/dist/getTheme_v2-y09KqtEb.js.map +1 -0
  43. package/dist/grid-BXHFJhf_.js +115 -0
  44. package/dist/grid-BXHFJhf_.js.map +1 -0
  45. package/dist/helpers-bwfx1e-Y.js +67 -0
  46. package/dist/helpers-bwfx1e-Y.js.map +1 -0
  47. package/dist/hotkeys-CmmTQZpn.js +165 -0
  48. package/dist/hotkeys-CmmTQZpn.js.map +1 -0
  49. package/dist/index.d.ts +1192 -2168
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js +2069 -4483
  52. package/dist/index.js.map +1 -1
  53. package/dist/layer-B98ynOf2.js +61 -0
  54. package/dist/layer-B98ynOf2.js.map +1 -0
  55. package/dist/layer-ChlP9Ik6.d.ts +242 -0
  56. package/dist/layer-ChlP9Ik6.d.ts.map +1 -0
  57. package/dist/menu.d.ts +146 -0
  58. package/dist/menu.d.ts.map +1 -0
  59. package/dist/menu.js +614 -0
  60. package/dist/menu.js.map +1 -0
  61. package/dist/popover-CMlQeKn0.d.ts +96 -0
  62. package/dist/popover-CMlQeKn0.d.ts.map +1 -0
  63. package/dist/popover-PorX5Jv9.js +419 -0
  64. package/dist/popover-PorX5Jv9.js.map +1 -0
  65. package/dist/popover.d.ts +2 -0
  66. package/dist/popover.js +3 -0
  67. package/dist/refractor-CC48DwHi.js +20 -0
  68. package/dist/refractor-CC48DwHi.js.map +1 -0
  69. package/dist/responsiveFont-hN1mZFjm.js +55 -0
  70. package/dist/responsiveFont-hN1mZFjm.js.map +1 -0
  71. package/dist/rgba-BSYaEUW6.d.ts +846 -0
  72. package/dist/rgba-BSYaEUW6.d.ts.map +1 -0
  73. package/dist/selectable-B0GUIL74.d.ts +7 -0
  74. package/dist/selectable-B0GUIL74.d.ts.map +1 -0
  75. package/dist/stack-iW9HuGLg.js +112 -0
  76. package/dist/stack-iW9HuGLg.js.map +1 -0
  77. package/dist/styles-css.d.ts +2 -0
  78. package/dist/styles-css.js +4 -0
  79. package/dist/styles.css +28 -0
  80. package/dist/textInput-udxyGbm1.js +321 -0
  81. package/dist/textInput-udxyGbm1.js.map +1 -0
  82. package/dist/theme.d.ts +240 -459
  83. package/dist/theme.d.ts.map +1 -0
  84. package/dist/theme.js +55 -870
  85. package/dist/theme.js.map +1 -1
  86. package/dist/toast.d.ts +73 -0
  87. package/dist/toast.d.ts.map +1 -0
  88. package/dist/toast.js +297 -0
  89. package/dist/toast.js.map +1 -0
  90. package/dist/tooltip.d.ts +88 -0
  91. package/dist/tooltip.d.ts.map +1 -0
  92. package/dist/tooltip.js +447 -0
  93. package/dist/tooltip.js.map +1 -0
  94. package/dist/useClickOutsideEvent-lEVhDFCQ.js +36 -0
  95. package/dist/useClickOutsideEvent-lEVhDFCQ.js.map +1 -0
  96. package/dist/useElementSize-BJvbGHq8.js +51 -0
  97. package/dist/useElementSize-BJvbGHq8.js.map +1 -0
  98. package/dist/useLayer-BAVfmbNN.js +712 -0
  99. package/dist/useLayer-BAVfmbNN.js.map +1 -0
  100. package/package.json +73 -208
  101. package/dist/_chunks-cjs/refractor.cjs +0 -22
  102. package/dist/_chunks-cjs/refractor.cjs.map +0 -1
  103. package/dist/_chunks-es/refractor.js +0 -25
  104. package/dist/_chunks-es/refractor.js.map +0 -1
  105. package/dist/css/index.cjs +0 -966
  106. package/dist/css/index.cjs.map +0 -1
  107. package/dist/css/index.css +0 -23387
  108. package/dist/css/index.css.map +0 -1
  109. package/dist/css/index.d.cts +0 -1394
  110. package/dist/css/index.d.ts +0 -1394
  111. package/dist/css/index.js +0 -967
  112. package/dist/css/index.js.map +0 -1
  113. package/dist/index.cjs +0 -4515
  114. package/dist/index.cjs.map +0 -1
  115. package/dist/index.d.cts +0 -2521
  116. package/dist/theme.cjs +0 -870
  117. package/dist/theme.cjs.map +0 -1
  118. package/dist/theme.d.cts +0 -499
  119. package/exports/css.ts +0 -1
  120. package/exports/index.ts +0 -1
  121. package/exports/theme.ts +0 -1
  122. package/src/core/Root.tsx +0 -88
  123. package/src/core/RootProvider.tsx +0 -40
  124. package/src/core/__workshop__/boundary.tsx +0 -28
  125. package/src/core/__workshop__/index.ts +0 -16
  126. package/src/core/components/autocomplete/__workshop__/async.tsx +0 -156
  127. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -131
  128. package/src/core/components/autocomplete/__workshop__/custom.tsx +0 -91
  129. package/src/core/components/autocomplete/__workshop__/example.tsx +0 -80
  130. package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -36
  131. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +0 -292
  132. package/src/core/components/autocomplete/__workshop__/index.ts +0 -41
  133. package/src/core/components/autocomplete/__workshop__/mock/apiStore.ts +0 -49
  134. package/src/core/components/autocomplete/__workshop__/mock/countries.ts +0 -245
  135. package/src/core/components/autocomplete/__workshop__/types.ts +0 -4
  136. package/src/core/components/autocomplete/autocomplete.tsx +0 -690
  137. package/src/core/components/autocomplete/autocompleteOption.tsx +0 -45
  138. package/src/core/components/autocomplete/autocompleteReducer.ts +0 -47
  139. package/src/core/components/autocomplete/constants.ts +0 -28
  140. package/src/core/components/autocomplete/types.ts +0 -103
  141. package/src/core/components/breadcrumbs/__workshop__/example.tsx +0 -61
  142. package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -16
  143. package/src/core/components/breadcrumbs/breadcrumbs.tsx +0 -131
  144. package/src/core/components/dialog/__workshop__/activate.tsx +0 -141
  145. package/src/core/components/dialog/__workshop__/autoFocus.tsx +0 -29
  146. package/src/core/components/dialog/__workshop__/index.ts +0 -21
  147. package/src/core/components/dialog/__workshop__/layering.tsx +0 -41
  148. package/src/core/components/dialog/__workshop__/nested.tsx +0 -71
  149. package/src/core/components/dialog/__workshop__/onScroll.tsx +0 -51
  150. package/src/core/components/dialog/__workshop__/panes.tsx +0 -89
  151. package/src/core/components/dialog/__workshop__/position.tsx +0 -30
  152. package/src/core/components/dialog/__workshop__/props.tsx +0 -77
  153. package/src/core/components/dialog/__workshop__/provider.tsx +0 -11
  154. package/src/core/components/dialog/__workshop__/wrapped.tsx +0 -76
  155. package/src/core/components/dialog/dialog.tsx +0 -232
  156. package/src/core/components/dialog/dialogCard.tsx +0 -233
  157. package/src/core/components/dialog/dialogContext.ts +0 -21
  158. package/src/core/components/dialog/dialogProvider.tsx +0 -34
  159. package/src/core/components/dialog/isTargetWithinScope.ts +0 -14
  160. package/src/core/components/dialog/types.ts +0 -2
  161. package/src/core/components/dialog/useDialog.ts +0 -11
  162. package/src/core/components/hotkeys/__workshop__/index.ts +0 -16
  163. package/src/core/components/hotkeys/__workshop__/plain.tsx +0 -9
  164. package/src/core/components/hotkeys/hotkeys.tsx +0 -60
  165. package/src/core/components/menu/__workshop__/asComponent.tsx +0 -45
  166. package/src/core/components/menu/__workshop__/avatarMenu.tsx +0 -57
  167. package/src/core/components/menu/__workshop__/closableMenuButton.tsx +0 -47
  168. package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +0 -133
  169. package/src/core/components/menu/__workshop__/customMenuItem.tsx +0 -45
  170. package/src/core/components/menu/__workshop__/customSelectedState.tsx +0 -35
  171. package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +0 -40
  172. package/src/core/components/menu/__workshop__/groups.tsx +0 -156
  173. package/src/core/components/menu/__workshop__/index.ts +0 -91
  174. package/src/core/components/menu/__workshop__/menuButton.tsx +0 -80
  175. package/src/core/components/menu/__workshop__/menuGroupRight.tsx +0 -65
  176. package/src/core/components/menu/__workshop__/nestedMenu.tsx +0 -22
  177. package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +0 -50
  178. package/src/core/components/menu/__workshop__/selectedItem.tsx +0 -69
  179. package/src/core/components/menu/__workshop__/shouldFocus.tsx +0 -42
  180. package/src/core/components/menu/__workshop__/tones.tsx +0 -25
  181. package/src/core/components/menu/__workshop__/withoutArrow.tsx +0 -32
  182. package/src/core/components/menu/helpers.ts +0 -82
  183. package/src/core/components/menu/menu.test.tsx +0 -129
  184. package/src/core/components/menu/menu.tsx +0 -179
  185. package/src/core/components/menu/menuButton.tsx +0 -225
  186. package/src/core/components/menu/menuContext.ts +0 -19
  187. package/src/core/components/menu/menuDivider.tsx +0 -32
  188. package/src/core/components/menu/menuGroup.tsx +0 -233
  189. package/src/core/components/menu/menuItem.tsx +0 -184
  190. package/src/core/components/menu/useMenu.ts +0 -21
  191. package/src/core/components/menu/useMenuController.ts +0 -241
  192. package/src/core/components/tab/__workshop__/example.tsx +0 -79
  193. package/src/core/components/tab/__workshop__/index.ts +0 -16
  194. package/src/core/components/tab/tab.tsx +0 -109
  195. package/src/core/components/tab/tabList.tsx +0 -90
  196. package/src/core/components/tab/tabPanel.tsx +0 -47
  197. package/src/core/components/toast/__workshop__/hook.tsx +0 -71
  198. package/src/core/components/toast/__workshop__/index.ts +0 -21
  199. package/src/core/components/toast/__workshop__/toast.tsx +0 -26
  200. package/src/core/components/toast/toast.test.tsx +0 -103
  201. package/src/core/components/toast/toast.tsx +0 -191
  202. package/src/core/components/toast/toastContext.ts +0 -7
  203. package/src/core/components/toast/toastLayer.tsx +0 -54
  204. package/src/core/components/toast/toastProvider.tsx +0 -112
  205. package/src/core/components/toast/toastState.ts +0 -6
  206. package/src/core/components/toast/types.ts +0 -24
  207. package/src/core/components/toast/useToast.ts +0 -23
  208. package/src/core/components/tree/__workshop__/basic.perf.ts +0 -19
  209. package/src/core/components/tree/__workshop__/basic.tsx +0 -105
  210. package/src/core/components/tree/__workshop__/index.ts +0 -23
  211. package/src/core/components/tree/__workshop__/tabFromElement.tsx +0 -84
  212. package/src/core/components/tree/helpers.ts +0 -105
  213. package/src/core/components/tree/tree.tsx +0 -248
  214. package/src/core/components/tree/treeContext.ts +0 -10
  215. package/src/core/components/tree/treeGroup.tsx +0 -46
  216. package/src/core/components/tree/treeItem.tsx +0 -237
  217. package/src/core/components/tree/types.ts +0 -24
  218. package/src/core/components/tree/useTree.ts +0 -17
  219. package/src/core/components/virtualList/__workshop__/changingProps.tsx +0 -36
  220. package/src/core/components/virtualList/__workshop__/elementScroll.tsx +0 -24
  221. package/src/core/components/virtualList/__workshop__/index.ts +0 -31
  222. package/src/core/components/virtualList/__workshop__/infiniteList.tsx +0 -48
  223. package/src/core/components/virtualList/__workshop__/windowScrolll.tsx +0 -22
  224. package/src/core/components/virtualList/virtualList.tsx +0 -209
  225. package/src/core/constants.ts +0 -67
  226. package/src/core/helpers/animation.ts +0 -27
  227. package/src/core/helpers/element.ts +0 -55
  228. package/src/core/helpers/focus.ts +0 -92
  229. package/src/core/helpers/props.ts +0 -28
  230. package/src/core/helpers/scroll.ts +0 -15
  231. package/src/core/hooks/useClickOutsideEvent.test.tsx +0 -114
  232. package/src/core/hooks/useClickOutsideEvent.ts +0 -67
  233. package/src/core/hooks/useCustomValidity.ts +0 -13
  234. package/src/core/hooks/useDelayed.test.ts +0 -67
  235. package/src/core/hooks/useDelayedState.ts +0 -28
  236. package/src/core/hooks/useElementSize.ts +0 -19
  237. package/src/core/hooks/useGlobalKeyDown.ts +0 -17
  238. package/src/core/hooks/useMatchMedia.ts +0 -28
  239. package/src/core/hooks/useMediaIndex/__workshop__/index.ts +0 -16
  240. package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +0 -14
  241. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +0 -21
  242. package/src/core/hooks/useMediaIndex/useMediaIndex.ts +0 -107
  243. package/src/core/hooks/useMounted.ts +0 -15
  244. package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -56
  245. package/src/core/hooks/usePrefersDark.test.tsx +0 -20
  246. package/src/core/hooks/usePrefersDark.ts +0 -16
  247. package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -56
  248. package/src/core/hooks/usePrefersReducedMotion.test.tsx +0 -20
  249. package/src/core/hooks/usePrefersReducedMotion.ts +0 -16
  250. package/src/core/hooks/useResponsiveProp.ts +0 -28
  251. package/src/core/index.ts +0 -115
  252. package/src/core/lib/createGlobalScopedContext.ts +0 -37
  253. package/src/core/lib/globalScope.ts +0 -19
  254. package/src/core/lib/isArray.ts +0 -3
  255. package/src/core/lib/isRecord.ts +0 -3
  256. package/src/core/middleware/origin.ts +0 -47
  257. package/src/core/observers/elementSize.ts +0 -116
  258. package/src/core/observers/resize.ts +0 -9
  259. package/src/core/primitives/arrow/arrow.tsx +0 -74
  260. package/src/core/primitives/arrow/cmds.ts +0 -91
  261. package/src/core/primitives/avatar/__workshop__/asButton.tsx +0 -14
  262. package/src/core/primitives/avatar/__workshop__/index.ts +0 -31
  263. package/src/core/primitives/avatar/__workshop__/stack.tsx +0 -25
  264. package/src/core/primitives/avatar/__workshop__/withinButton.tsx +0 -55
  265. package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -72
  266. package/src/core/primitives/avatar/avatar.tsx +0 -147
  267. package/src/core/primitives/avatar/avatarCounter.tsx +0 -69
  268. package/src/core/primitives/avatar/avatarStack.tsx +0 -79
  269. package/src/core/primitives/avatar/types.ts +0 -2
  270. package/src/core/primitives/badge/__workshop__/index.ts +0 -21
  271. package/src/core/primitives/badge/__workshop__/props.tsx +0 -19
  272. package/src/core/primitives/badge/__workshop__/tones.tsx +0 -16
  273. package/src/core/primitives/badge/badge.test.tsx +0 -16
  274. package/src/core/primitives/badge/badge.tsx +0 -61
  275. package/src/core/primitives/box/__workshop__/index.ts +0 -21
  276. package/src/core/primitives/box/__workshop__/props.tsx +0 -20
  277. package/src/core/primitives/box/__workshop__/responsive.tsx +0 -20
  278. package/src/core/primitives/box/box.tsx +0 -222
  279. package/src/core/primitives/button/__workshop__/custom.tsx +0 -27
  280. package/src/core/primitives/button/__workshop__/customIcons.tsx +0 -30
  281. package/src/core/primitives/button/__workshop__/disabled.tsx +0 -54
  282. package/src/core/primitives/button/__workshop__/index.ts +0 -66
  283. package/src/core/primitives/button/__workshop__/mixedChildren.tsx +0 -12
  284. package/src/core/primitives/button/__workshop__/props.tsx +0 -55
  285. package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +0 -36
  286. package/src/core/primitives/button/__workshop__/stacked.tsx +0 -58
  287. package/src/core/primitives/button/__workshop__/styled1.tsx +0 -17
  288. package/src/core/primitives/button/__workshop__/styled2.tsx +0 -19
  289. package/src/core/primitives/button/__workshop__/textOverflow.tsx +0 -13
  290. package/src/core/primitives/button/__workshop__/uploadButton.tsx +0 -29
  291. package/src/core/primitives/button/button.test.tsx +0 -30
  292. package/src/core/primitives/button/button.tsx +0 -193
  293. package/src/core/primitives/button/types.ts +0 -2
  294. package/src/core/primitives/card/__workshop__/asButton.tsx +0 -107
  295. package/src/core/primitives/card/__workshop__/asComponent.tsx +0 -27
  296. package/src/core/primitives/card/__workshop__/checkered.tsx +0 -26
  297. package/src/core/primitives/card/__workshop__/index.ts +0 -20
  298. package/src/core/primitives/card/__workshop__/interactive.tsx +0 -29
  299. package/src/core/primitives/card/__workshop__/listNavigation.tsx +0 -78
  300. package/src/core/primitives/card/__workshop__/props.tsx +0 -52
  301. package/src/core/primitives/card/__workshop__/selected.tsx +0 -62
  302. package/src/core/primitives/card/__workshop__/styled.tsx +0 -14
  303. package/src/core/primitives/card/__workshop__/tones.tsx +0 -27
  304. package/src/core/primitives/card/card.tsx +0 -109
  305. package/src/core/primitives/card/cardContext.ts +0 -10
  306. package/src/core/primitives/card/cardProvider.tsx +0 -27
  307. package/src/core/primitives/card/types.ts +0 -17
  308. package/src/core/primitives/card/useCard.ts +0 -15
  309. package/src/core/primitives/checkbox/__workshop__/example.tsx +0 -25
  310. package/src/core/primitives/checkbox/__workshop__/index.ts +0 -15
  311. package/src/core/primitives/checkbox/__workshop__/props.tsx +0 -35
  312. package/src/core/primitives/checkbox/__workshop__/readOnly.tsx +0 -16
  313. package/src/core/primitives/checkbox/__workshop__/tones.tsx +0 -27
  314. package/src/core/primitives/checkbox/checkbox.tsx +0 -80
  315. package/src/core/primitives/code/__workshop__/index.ts +0 -21
  316. package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +0 -23
  317. package/src/core/primitives/code/__workshop__/props.tsx +0 -18
  318. package/src/core/primitives/code/code.tsx +0 -48
  319. package/src/core/primitives/code/refractor.tsx +0 -18
  320. package/src/core/primitives/container/__workshop__/example.tsx +0 -20
  321. package/src/core/primitives/container/__workshop__/index.ts +0 -10
  322. package/src/core/primitives/container/container.tsx +0 -37
  323. package/src/core/primitives/container/types.ts +0 -6
  324. package/src/core/primitives/flex/__workshop__/example.tsx +0 -34
  325. package/src/core/primitives/flex/__workshop__/gap.tsx +0 -25
  326. package/src/core/primitives/flex/__workshop__/index.ts +0 -13
  327. package/src/core/primitives/flex/flex.tsx +0 -58
  328. package/src/core/primitives/grid/__workshop__/index.ts +0 -12
  329. package/src/core/primitives/grid/__workshop__/responsive.tsx +0 -54
  330. package/src/core/primitives/grid/grid.tsx +0 -35
  331. package/src/core/primitives/heading/__workshop__/index.ts +0 -21
  332. package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +0 -54
  333. package/src/core/primitives/heading/__workshop__/plain.tsx +0 -29
  334. package/src/core/primitives/heading/heading.tsx +0 -78
  335. package/src/core/primitives/inline/__workshop__/index.ts +0 -10
  336. package/src/core/primitives/inline/__workshop__/plain.tsx +0 -24
  337. package/src/core/primitives/inline/inline.tsx +0 -62
  338. package/src/core/primitives/kbd/__workshop__/index.ts +0 -10
  339. package/src/core/primitives/kbd/__workshop__/plain.tsx +0 -9
  340. package/src/core/primitives/kbd/kbd.tsx +0 -57
  341. package/src/core/primitives/label/__workshop__/index.ts +0 -21
  342. package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +0 -54
  343. package/src/core/primitives/label/__workshop__/plain.tsx +0 -28
  344. package/src/core/primitives/label/label.tsx +0 -75
  345. package/src/core/primitives/layer/__workshop__/_debug.tsx +0 -17
  346. package/src/core/primitives/layer/__workshop__/index.ts +0 -26
  347. package/src/core/primitives/layer/__workshop__/multipleRoots.tsx +0 -49
  348. package/src/core/primitives/layer/__workshop__/nested.tsx +0 -98
  349. package/src/core/primitives/layer/__workshop__/responsiveZOffset.tsx +0 -17
  350. package/src/core/primitives/layer/getLayerContext.test.ts +0 -32
  351. package/src/core/primitives/layer/getLayerContext.ts +0 -21
  352. package/src/core/primitives/layer/layer.test.tsx +0 -110
  353. package/src/core/primitives/layer/layer.tsx +0 -42
  354. package/src/core/primitives/layer/layerCard.tsx +0 -90
  355. package/src/core/primitives/layer/layerContext.ts +0 -7
  356. package/src/core/primitives/layer/layerProvider.tsx +0 -106
  357. package/src/core/primitives/layer/types.ts +0 -9
  358. package/src/core/primitives/layer/useLayer.ts +0 -24
  359. package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +0 -77
  360. package/src/core/primitives/popover/__workshop__/MarginsStory.tsx +0 -31
  361. package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -32
  362. package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
  363. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +0 -71
  364. package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -69
  365. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +0 -96
  366. package/src/core/primitives/popover/__workshop__/TestStory.tsx +0 -100
  367. package/src/core/primitives/popover/__workshop__/index.ts +0 -51
  368. package/src/core/primitives/popover/constants.ts +0 -22
  369. package/src/core/primitives/popover/floating-ui/size.ts +0 -83
  370. package/src/core/primitives/popover/helpers.ts +0 -32
  371. package/src/core/primitives/popover/popover.tsx +0 -443
  372. package/src/core/primitives/popover/popoverLayer.tsx +0 -149
  373. package/src/core/primitives/popover/types.ts +0 -12
  374. package/src/core/primitives/radio/__workshop__/example.tsx +0 -63
  375. package/src/core/primitives/radio/__workshop__/index.ts +0 -13
  376. package/src/core/primitives/radio/__workshop__/plain.tsx +0 -28
  377. package/src/core/primitives/radio/radio.tsx +0 -64
  378. package/src/core/primitives/select/__workshop__/index.ts +0 -13
  379. package/src/core/primitives/select/__workshop__/plain.tsx +0 -39
  380. package/src/core/primitives/select/__workshop__/readOnly.tsx +0 -23
  381. package/src/core/primitives/select/select.tsx +0 -75
  382. package/src/core/primitives/selectable/selectable.tsx +0 -50
  383. package/src/core/primitives/skeleton/__workshop__/delay.tsx +0 -70
  384. package/src/core/primitives/skeleton/__workshop__/index.ts +0 -13
  385. package/src/core/primitives/skeleton/__workshop__/skeleton.tsx +0 -64
  386. package/src/core/primitives/skeleton/codeSkeleton.tsx +0 -49
  387. package/src/core/primitives/skeleton/headingSkeleton.tsx +0 -48
  388. package/src/core/primitives/skeleton/labelSkeleton.tsx +0 -47
  389. package/src/core/primitives/skeleton/skeleton.tsx +0 -70
  390. package/src/core/primitives/skeleton/textSkeleton.tsx +0 -49
  391. package/src/core/primitives/spinner/__workshop__/Props.tsx +0 -15
  392. package/src/core/primitives/spinner/__workshop__/index.ts +0 -16
  393. package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +0 -14
  394. package/src/core/primitives/spinner/spinner.tsx +0 -45
  395. package/src/core/primitives/srOnly/srOnly.tsx +0 -33
  396. package/src/core/primitives/stack/__workshop__/index.ts +0 -16
  397. package/src/core/primitives/stack/__workshop__/plain.tsx +0 -32
  398. package/src/core/primitives/stack/stack.tsx +0 -60
  399. package/src/core/primitives/switch/__workshop__/example.tsx +0 -23
  400. package/src/core/primitives/switch/__workshop__/index.ts +0 -13
  401. package/src/core/primitives/switch/__workshop__/props.tsx +0 -21
  402. package/src/core/primitives/switch/switch.tsx +0 -84
  403. package/src/core/primitives/text/__workshop__/colored.tsx +0 -23
  404. package/src/core/primitives/text/__workshop__/example.tsx +0 -28
  405. package/src/core/primitives/text/__workshop__/index.ts +0 -26
  406. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +0 -23
  407. package/src/core/primitives/text/text.tsx +0 -76
  408. package/src/core/primitives/textArea/__workshop__/index.ts +0 -16
  409. package/src/core/primitives/textArea/__workshop__/plain.tsx +0 -61
  410. package/src/core/primitives/textArea/textArea.tsx +0 -84
  411. package/src/core/primitives/textInput/__workshop__/clearButton.tsx +0 -30
  412. package/src/core/primitives/textInput/__workshop__/customValidity.tsx +0 -17
  413. package/src/core/primitives/textInput/__workshop__/index.ts +0 -46
  414. package/src/core/primitives/textInput/__workshop__/plain.tsx +0 -110
  415. package/src/core/primitives/textInput/__workshop__/readOnly.tsx +0 -9
  416. package/src/core/primitives/textInput/__workshop__/states.tsx +0 -53
  417. package/src/core/primitives/textInput/__workshop__/tones.tsx +0 -277
  418. package/src/core/primitives/textInput/__workshop__/typed.tsx +0 -23
  419. package/src/core/primitives/textInput/textInput.tsx +0 -258
  420. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +0 -102
  421. package/src/core/primitives/tooltip/__workshop__/index.ts +0 -31
  422. package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -74
  423. package/src/core/primitives/tooltip/__workshop__/props.tsx +0 -112
  424. package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -86
  425. package/src/core/primitives/tooltip/constants.ts +0 -23
  426. package/src/core/primitives/tooltip/tooltip.test.tsx +0 -452
  427. package/src/core/primitives/tooltip/tooltip.tsx +0 -482
  428. package/src/core/primitives/tooltip/tooltipDelayGroup/index.ts +0 -4
  429. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +0 -13
  430. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +0 -55
  431. package/src/core/primitives/tooltip/tooltipDelayGroup/types.ts +0 -10
  432. package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +0 -13
  433. package/src/core/primitives/tooltip/tooltipLayer.tsx +0 -106
  434. package/src/core/types.ts +0 -56
  435. package/src/core/utils/boundaryElement/__workshop__/index.ts +0 -16
  436. package/src/core/utils/boundaryElement/__workshop__/plain.tsx +0 -19
  437. package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -102
  438. package/src/core/utils/boundaryElement/boundaryElementContext.ts +0 -10
  439. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +0 -18
  440. package/src/core/utils/boundaryElement/types.ts +0 -5
  441. package/src/core/utils/boundaryElement/useBoundaryElement.ts +0 -24
  442. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +0 -41
  443. package/src/core/utils/elementQuery/__workshop__/index.ts +0 -16
  444. package/src/core/utils/elementQuery/elementQuery.tsx +0 -75
  445. package/src/core/utils/elementQuery/helpers.ts +0 -27
  446. package/src/core/utils/errorBoundary.tsx +0 -50
  447. package/src/core/utils/getElementRef.ts +0 -29
  448. package/src/core/utils/portal/__workshop__/index.ts +0 -16
  449. package/src/core/utils/portal/__workshop__/named.tsx +0 -63
  450. package/src/core/utils/portal/portal.test.tsx +0 -105
  451. package/src/core/utils/portal/portal.tsx +0 -36
  452. package/src/core/utils/portal/portalContext.ts +0 -37
  453. package/src/core/utils/portal/portalProvider.tsx +0 -70
  454. package/src/core/utils/portal/types.ts +0 -7
  455. package/src/core/utils/portal/usePortal.ts +0 -23
  456. package/src/css/_assign.ts +0 -3
  457. package/src/css/_composeClassNames.ts +0 -12
  458. package/src/css/_fromEntries.ts +0 -3
  459. package/src/css/_getClassNames.ts +0 -9
  460. package/src/css/_responsiveClassName.ts +0 -45
  461. package/src/css/_responsiveStyle.css.ts +0 -34
  462. package/src/css/_style.css.ts +0 -9
  463. package/src/css/components/breadcrumbs/breadcrumbs.css.ts +0 -6
  464. package/src/css/components/breadcrumbs/breadcrumbs.ts +0 -7
  465. package/src/css/components/dialog/dialog.css.ts +0 -98
  466. package/src/css/components/dialog/dialog.ts +0 -58
  467. package/src/css/components/menu/menu.css.ts +0 -14
  468. package/src/css/components/menu/menu.ts +0 -12
  469. package/src/css/components/skeleton/skeleton.css.ts +0 -128
  470. package/src/css/components/skeleton/skeleton.ts +0 -38
  471. package/src/css/components/skeleton/types.ts +0 -36
  472. package/src/css/components/toast/toast.css.ts +0 -17
  473. package/src/css/components/toast/toast.ts +0 -11
  474. package/src/css/components/tree/tree.css.ts +0 -65
  475. package/src/css/components/tree/tree.ts +0 -7
  476. package/src/css/constants.ts +0 -10
  477. package/src/css/getVarName.ts +0 -27
  478. package/src/css/index.ts +0 -146
  479. package/src/css/layers.css.ts +0 -12
  480. package/src/css/primitives/_arrow/_arrow.css.ts +0 -68
  481. package/src/css/primitives/_arrow/_arrow.ts +0 -26
  482. package/src/css/primitives/_input/_input.css.ts +0 -261
  483. package/src/css/primitives/_input/input.ts +0 -29
  484. package/src/css/primitives/_input/types.ts +0 -13
  485. package/src/css/primitives/avatar/avatar.css.ts +0 -201
  486. package/src/css/primitives/avatar/avatar.ts +0 -68
  487. package/src/css/primitives/avatar/types.ts +0 -10
  488. package/src/css/primitives/badge/badge.css.ts +0 -27
  489. package/src/css/primitives/badge/badge.ts +0 -8
  490. package/src/css/primitives/badge/types.ts +0 -13
  491. package/src/css/primitives/box/box.css.ts +0 -19
  492. package/src/css/primitives/box/box.ts +0 -82
  493. package/src/css/primitives/box/types.ts +0 -75
  494. package/src/css/primitives/button/button.css.ts +0 -287
  495. package/src/css/primitives/button/button.ts +0 -26
  496. package/src/css/primitives/button/types.ts +0 -12
  497. package/src/css/primitives/card/__workshop__/color.tsx +0 -75
  498. package/src/css/primitives/card/__workshop__/index.ts +0 -16
  499. package/src/css/primitives/card/card.css.ts +0 -387
  500. package/src/css/primitives/card/card.ts +0 -13
  501. package/src/css/primitives/card/types.ts +0 -9
  502. package/src/css/primitives/checkbox/checkbox.css.ts +0 -193
  503. package/src/css/primitives/checkbox/checkbox.ts +0 -17
  504. package/src/css/primitives/code/code.css.ts +0 -272
  505. package/src/css/primitives/code/code.ts +0 -19
  506. package/src/css/primitives/code/types.ts +0 -11
  507. package/src/css/primitives/container/container.css.ts +0 -4
  508. package/src/css/primitives/container/container.ts +0 -17
  509. package/src/css/primitives/container/types.ts +0 -9
  510. package/src/css/primitives/heading/heading.css.ts +0 -86
  511. package/src/css/primitives/heading/heading.ts +0 -22
  512. package/src/css/primitives/heading/types.ts +0 -14
  513. package/src/css/primitives/kbd/kbd.css.ts +0 -16
  514. package/src/css/primitives/kbd/kbd.ts +0 -9
  515. package/src/css/primitives/kbd/types.ts +0 -6
  516. package/src/css/primitives/label/label.css.ts +0 -87
  517. package/src/css/primitives/label/label.ts +0 -22
  518. package/src/css/primitives/label/types.ts +0 -14
  519. package/src/css/primitives/popover/popover.css.ts +0 -6
  520. package/src/css/primitives/popover/popover.ts +0 -12
  521. package/src/css/primitives/radio/radio.css.ts +0 -78
  522. package/src/css/primitives/radio/radio.ts +0 -17
  523. package/src/css/primitives/root/root.css.ts +0 -19
  524. package/src/css/primitives/root/root.ts +0 -17
  525. package/src/css/primitives/root/types.ts +0 -10
  526. package/src/css/primitives/select/select.css.ts +0 -24
  527. package/src/css/primitives/select/select.ts +0 -14
  528. package/src/css/primitives/select/types.ts +0 -5
  529. package/src/css/primitives/selectable/selectable.css.ts +0 -131
  530. package/src/css/primitives/selectable/selectable.ts +0 -9
  531. package/src/css/primitives/selectable/types.ts +0 -9
  532. package/src/css/primitives/spinner/spinner.css.ts +0 -19
  533. package/src/css/primitives/spinner/spinner.ts +0 -13
  534. package/src/css/primitives/spinner/types.ts +0 -4
  535. package/src/css/primitives/srOnly/srOnly.css.ts +0 -10
  536. package/src/css/primitives/srOnly/srOnly.ts +0 -7
  537. package/src/css/primitives/stack/stack.css.ts +0 -6
  538. package/src/css/primitives/stack/stack.ts +0 -7
  539. package/src/css/primitives/switch/switch.css.ts +0 -98
  540. package/src/css/primitives/switch/switch.ts +0 -27
  541. package/src/css/primitives/text/text.css.ts +0 -86
  542. package/src/css/primitives/text/text.ts +0 -24
  543. package/src/css/primitives/text/types.ts +0 -18
  544. package/src/css/primitives/textArea/textArea.css.ts +0 -4
  545. package/src/css/primitives/textArea/textArea.ts +0 -9
  546. package/src/css/primitives/textArea/types.ts +0 -7
  547. package/src/css/primitives/textInput/textInput.css.ts +0 -43
  548. package/src/css/primitives/textInput/textInput.ts +0 -24
  549. package/src/css/primitives/textInput/types.ts +0 -7
  550. package/src/css/primitives/tooltip/tooltip.css.ts +0 -4
  551. package/src/css/primitives/tooltip/tooltip.ts +0 -8
  552. package/src/css/primitives/tooltip/types.ts +0 -4
  553. package/src/css/props/alignItems/alignItems.css.ts +0 -22
  554. package/src/css/props/alignItems/alignItems.ts +0 -8
  555. package/src/css/props/alignItems/types.ts +0 -9
  556. package/src/css/props/border/border.css.ts +0 -65
  557. package/src/css/props/border/border.ts +0 -21
  558. package/src/css/props/border/types.ts +0 -13
  559. package/src/css/props/boxSizing/boxSizing.css.ts +0 -12
  560. package/src/css/props/boxSizing/boxSizing.ts +0 -7
  561. package/src/css/props/boxSizing/types.ts +0 -7
  562. package/src/css/props/display/display.css.ts +0 -56
  563. package/src/css/props/display/display.ts +0 -8
  564. package/src/css/props/display/types.ts +0 -16
  565. package/src/css/props/flex/flex.css.ts +0 -52
  566. package/src/css/props/flex/flex.ts +0 -8
  567. package/src/css/props/flex/types.ts +0 -9
  568. package/src/css/props/flexDirection/flexDirection.css.ts +0 -19
  569. package/src/css/props/flexDirection/flexDirection.ts +0 -8
  570. package/src/css/props/flexDirection/types.ts +0 -9
  571. package/src/css/props/flexWrap/flexWrap.css.ts +0 -16
  572. package/src/css/props/flexWrap/flexWrap.ts +0 -8
  573. package/src/css/props/flexWrap/types.ts +0 -9
  574. package/src/css/props/font/font.css.ts +0 -94
  575. package/src/css/props/font/font.ts +0 -8
  576. package/src/css/props/font/types.ts +0 -6
  577. package/src/css/props/gap/gap.css.ts +0 -40
  578. package/src/css/props/gap/gap.ts +0 -13
  579. package/src/css/props/gap/types.ts +0 -10
  580. package/src/css/props/gridAutoColumns/gridAutoColumns.css.ts +0 -19
  581. package/src/css/props/gridAutoColumns/gridAutoColumns.ts +0 -8
  582. package/src/css/props/gridAutoColumns/types.ts +0 -9
  583. package/src/css/props/gridAutoFlow/gridAutoFlow.css.ts +0 -19
  584. package/src/css/props/gridAutoFlow/gridAutoFlow.ts +0 -8
  585. package/src/css/props/gridAutoFlow/types.ts +0 -9
  586. package/src/css/props/gridAutoRows/gridAutoRows.css.ts +0 -19
  587. package/src/css/props/gridAutoRows/gridAutoRows.ts +0 -8
  588. package/src/css/props/gridAutoRows/types.ts +0 -9
  589. package/src/css/props/gridColumn/gridColumn.css.ts +0 -49
  590. package/src/css/props/gridColumn/gridColumn.ts +0 -8
  591. package/src/css/props/gridColumn/types.ts +0 -9
  592. package/src/css/props/gridColumnEnd/gridColumnEnd.css.ts +0 -46
  593. package/src/css/props/gridColumnEnd/gridColumnEnd.ts +0 -8
  594. package/src/css/props/gridColumnEnd/types.ts +0 -9
  595. package/src/css/props/gridColumnStart/gridColumnStart.css.ts +0 -46
  596. package/src/css/props/gridColumnStart/gridColumnStart.ts +0 -8
  597. package/src/css/props/gridColumnStart/types.ts +0 -9
  598. package/src/css/props/gridRow/gridRow.css.ts +0 -49
  599. package/src/css/props/gridRow/gridRow.ts +0 -8
  600. package/src/css/props/gridRow/types.ts +0 -9
  601. package/src/css/props/gridRowEnd/gridRowEnd.css.ts +0 -46
  602. package/src/css/props/gridRowEnd/gridRowEnd.ts +0 -8
  603. package/src/css/props/gridRowEnd/types.ts +0 -9
  604. package/src/css/props/gridRowStart/gridRowStart.css.ts +0 -46
  605. package/src/css/props/gridRowStart/gridRowStart.ts +0 -8
  606. package/src/css/props/gridRowStart/types.ts +0 -9
  607. package/src/css/props/gridTemplateColumns/gridTemplateColumns.css.ts +0 -43
  608. package/src/css/props/gridTemplateColumns/gridTemplateColumns.ts +0 -8
  609. package/src/css/props/gridTemplateColumns/types.ts +0 -9
  610. package/src/css/props/gridTemplateRows/gridTemplateRows.css.ts +0 -43
  611. package/src/css/props/gridTemplateRows/gridTemplateRows.ts +0 -8
  612. package/src/css/props/gridTemplateRows/types.ts +0 -9
  613. package/src/css/props/height/height.css.ts +0 -25
  614. package/src/css/props/height/height.ts +0 -8
  615. package/src/css/props/height/types.ts +0 -9
  616. package/src/css/props/inset/inset.css.ts +0 -37
  617. package/src/css/props/inset/inset.ts +0 -21
  618. package/src/css/props/inset/types.ts +0 -13
  619. package/src/css/props/justifyContent/justifyContent.css.ts +0 -25
  620. package/src/css/props/justifyContent/justifyContent.ts +0 -8
  621. package/src/css/props/justifyContent/types.ts +0 -15
  622. package/src/css/props/margin/margin.css.ts +0 -117
  623. package/src/css/props/margin/margin.ts +0 -25
  624. package/src/css/props/margin/types.ts +0 -17
  625. package/src/css/props/maxWidth/maxWidth.css.ts +0 -32
  626. package/src/css/props/maxWidth/maxWidth.ts +0 -8
  627. package/src/css/props/maxWidth/types.ts +0 -11
  628. package/src/css/props/minHeight/minHeight.css.ts +0 -13
  629. package/src/css/props/minHeight/minHeight.ts +0 -8
  630. package/src/css/props/minHeight/types.ts +0 -9
  631. package/src/css/props/minWidth/minWidth.css.ts +0 -25
  632. package/src/css/props/minWidth/minWidth.ts +0 -8
  633. package/src/css/props/minWidth/types.ts +0 -9
  634. package/src/css/props/outline/outline.css.ts +0 -10
  635. package/src/css/props/outline/outline.ts +0 -8
  636. package/src/css/props/outline/types.ts +0 -7
  637. package/src/css/props/overflow/overflow.css.ts +0 -16
  638. package/src/css/props/overflow/overflow.ts +0 -8
  639. package/src/css/props/overflow/types.ts +0 -11
  640. package/src/css/props/padding/padding.css.ts +0 -87
  641. package/src/css/props/padding/padding.ts +0 -25
  642. package/src/css/props/padding/types.ts +0 -17
  643. package/src/css/props/pointerEvents/pointerEvents.css.ts +0 -13
  644. package/src/css/props/pointerEvents/pointerEvents.ts +0 -8
  645. package/src/css/props/pointerEvents/types.ts +0 -7
  646. package/src/css/props/position/position.css.ts +0 -22
  647. package/src/css/props/position/position.ts +0 -8
  648. package/src/css/props/position/types.ts +0 -9
  649. package/src/css/props/radius/radius.css.ts +0 -21
  650. package/src/css/props/radius/radius.ts +0 -8
  651. package/src/css/props/radius/types.ts +0 -8
  652. package/src/css/props/shadow/shadow.css.ts +0 -23
  653. package/src/css/props/shadow/shadow.ts +0 -8
  654. package/src/css/props/shadow/types.ts +0 -8
  655. package/src/css/props/textAlign/textAlign.css.ts +0 -22
  656. package/src/css/props/textAlign/textAlign.ts +0 -8
  657. package/src/css/props/textAlign/types.ts +0 -7
  658. package/src/css/props/textOverflow/textOverflow.css.ts +0 -19
  659. package/src/css/props/textOverflow/textOverflow.ts +0 -8
  660. package/src/css/props/textOverflow/types.ts +0 -12
  661. package/src/css/props/width/types.ts +0 -11
  662. package/src/css/props/width/width.css.ts +0 -31
  663. package/src/css/props/width/width.ts +0 -8
  664. package/src/css/theme/buildCSSTheme.ts +0 -488
  665. package/src/css/theme/defaultTheme.css.ts +0 -64
  666. package/src/css/types.ts +0 -427
  667. package/src/css/vars.css.ts +0 -676
  668. package/src/theme/_parseColorToken.ts +0 -180
  669. package/src/theme/buildTheme.ts +0 -32
  670. package/src/theme/constants.ts +0 -90
  671. package/src/theme/defaults/color.ts +0 -197
  672. package/src/theme/defaults/common.ts +0 -71
  673. package/src/theme/defaults/fonts.ts +0 -250
  674. package/src/theme/index.ts +0 -5
  675. package/src/theme/merge.ts +0 -24
  676. package/src/theme/resolveTokens.ts +0 -204
  677. package/src/theme/types.ts +0 -366
@@ -0,0 +1,3056 @@
1
+ import { r as defaultThemeConfig } from "./getTheme_v2-y09KqtEb.js";
2
+ import { a as defineLazyProperty, n as v2_v0 } from "./getScopedTheme-C-sZsyAz.js";
3
+ import { COLOR_HUES, COLOR_TINTS, color } from "@sanity/color";
4
+ const defaultThemeFonts = {
5
+ code: {
6
+ family: "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
7
+ weights: {
8
+ regular: 400,
9
+ medium: 500,
10
+ semibold: 600,
11
+ bold: 700
12
+ },
13
+ sizes: [
14
+ {
15
+ ascenderHeight: 4,
16
+ descenderHeight: 4,
17
+ fontSize: 10,
18
+ iconSize: 17,
19
+ lineHeight: 15,
20
+ letterSpacing: 0
21
+ },
22
+ {
23
+ ascenderHeight: 5,
24
+ descenderHeight: 5,
25
+ fontSize: 13,
26
+ iconSize: 21,
27
+ lineHeight: 19,
28
+ letterSpacing: 0
29
+ },
30
+ {
31
+ ascenderHeight: 6,
32
+ descenderHeight: 6,
33
+ fontSize: 16,
34
+ iconSize: 25,
35
+ lineHeight: 23,
36
+ letterSpacing: 0
37
+ },
38
+ {
39
+ ascenderHeight: 7,
40
+ descenderHeight: 7,
41
+ fontSize: 19,
42
+ iconSize: 29,
43
+ lineHeight: 27,
44
+ letterSpacing: 0
45
+ },
46
+ {
47
+ ascenderHeight: 8,
48
+ descenderHeight: 8,
49
+ fontSize: 22,
50
+ iconSize: 33,
51
+ lineHeight: 31,
52
+ letterSpacing: 0
53
+ }
54
+ ]
55
+ },
56
+ heading: {
57
+ family: "Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Liberation Sans\", Helvetica, Arial, system-ui, sans-serif",
58
+ weights: {
59
+ regular: 700,
60
+ medium: 800,
61
+ semibold: 900,
62
+ bold: 900
63
+ },
64
+ sizes: [
65
+ {
66
+ ascenderHeight: 5,
67
+ descenderHeight: 5,
68
+ fontSize: 13,
69
+ iconSize: 17,
70
+ lineHeight: 19,
71
+ letterSpacing: 0
72
+ },
73
+ {
74
+ ascenderHeight: 6,
75
+ descenderHeight: 6,
76
+ fontSize: 16,
77
+ iconSize: 25,
78
+ lineHeight: 23,
79
+ letterSpacing: 0
80
+ },
81
+ {
82
+ ascenderHeight: 7,
83
+ descenderHeight: 7,
84
+ fontSize: 21,
85
+ iconSize: 33,
86
+ lineHeight: 29,
87
+ letterSpacing: 0
88
+ },
89
+ {
90
+ ascenderHeight: 8,
91
+ descenderHeight: 8,
92
+ fontSize: 27,
93
+ iconSize: 41,
94
+ lineHeight: 35,
95
+ letterSpacing: 0
96
+ },
97
+ {
98
+ ascenderHeight: 9.5,
99
+ descenderHeight: 8.5,
100
+ fontSize: 33,
101
+ iconSize: 49,
102
+ lineHeight: 41,
103
+ letterSpacing: 0
104
+ },
105
+ {
106
+ ascenderHeight: 10.5,
107
+ descenderHeight: 9.5,
108
+ fontSize: 38,
109
+ iconSize: 53,
110
+ lineHeight: 47,
111
+ letterSpacing: 0
112
+ }
113
+ ]
114
+ },
115
+ label: {
116
+ family: "Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Liberation Sans\", system-ui, sans-serif",
117
+ weights: {
118
+ regular: 600,
119
+ medium: 700,
120
+ semibold: 800,
121
+ bold: 900
122
+ },
123
+ sizes: [
124
+ {
125
+ ascenderHeight: 2,
126
+ descenderHeight: 2,
127
+ fontSize: 8.1,
128
+ iconSize: 13,
129
+ lineHeight: 10,
130
+ letterSpacing: .5
131
+ },
132
+ {
133
+ ascenderHeight: 2,
134
+ descenderHeight: 2,
135
+ fontSize: 9.5,
136
+ iconSize: 15,
137
+ lineHeight: 11,
138
+ letterSpacing: .5
139
+ },
140
+ {
141
+ ascenderHeight: 2,
142
+ descenderHeight: 2,
143
+ fontSize: 10.8,
144
+ iconSize: 17,
145
+ lineHeight: 12,
146
+ letterSpacing: .5
147
+ },
148
+ {
149
+ ascenderHeight: 2,
150
+ descenderHeight: 2,
151
+ fontSize: 12.25,
152
+ iconSize: 19,
153
+ lineHeight: 13,
154
+ letterSpacing: .5
155
+ },
156
+ {
157
+ ascenderHeight: 2,
158
+ descenderHeight: 2,
159
+ fontSize: 13.6,
160
+ iconSize: 21,
161
+ lineHeight: 14,
162
+ letterSpacing: .5
163
+ },
164
+ {
165
+ ascenderHeight: 2,
166
+ descenderHeight: 2,
167
+ fontSize: 15,
168
+ iconSize: 23,
169
+ lineHeight: 15,
170
+ letterSpacing: .5
171
+ }
172
+ ]
173
+ },
174
+ text: {
175
+ family: "Inter, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Liberation Sans\", Helvetica, Arial, system-ui, sans-serif",
176
+ weights: {
177
+ regular: 400,
178
+ medium: 500,
179
+ semibold: 600,
180
+ bold: 700
181
+ },
182
+ sizes: [
183
+ {
184
+ ascenderHeight: 4,
185
+ descenderHeight: 4,
186
+ fontSize: 10,
187
+ iconSize: 17,
188
+ lineHeight: 15,
189
+ letterSpacing: 0
190
+ },
191
+ {
192
+ ascenderHeight: 5,
193
+ descenderHeight: 5,
194
+ fontSize: 13,
195
+ iconSize: 21,
196
+ lineHeight: 19,
197
+ letterSpacing: 0
198
+ },
199
+ {
200
+ ascenderHeight: 6,
201
+ descenderHeight: 6,
202
+ fontSize: 15,
203
+ iconSize: 25,
204
+ lineHeight: 23,
205
+ letterSpacing: 0
206
+ },
207
+ {
208
+ ascenderHeight: 7,
209
+ descenderHeight: 7,
210
+ fontSize: 18,
211
+ iconSize: 29,
212
+ lineHeight: 27,
213
+ letterSpacing: 0
214
+ },
215
+ {
216
+ ascenderHeight: 8,
217
+ descenderHeight: 8,
218
+ fontSize: 21,
219
+ iconSize: 33,
220
+ lineHeight: 31,
221
+ letterSpacing: 0
222
+ }
223
+ ]
224
+ }
225
+ }, THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
226
+ "transparent",
227
+ "default",
228
+ "neutral",
229
+ "primary",
230
+ "suggest",
231
+ "positive",
232
+ "caution",
233
+ "critical"
234
+ ], THEME_COLOR_STATE_TONES = [
235
+ "default",
236
+ "neutral",
237
+ "primary",
238
+ "suggest",
239
+ "positive",
240
+ "caution",
241
+ "critical"
242
+ ], THEME_COLOR_STATES = [
243
+ "enabled",
244
+ "hovered",
245
+ "pressed",
246
+ "selected",
247
+ "disabled"
248
+ ], THEME_COLOR_BUTTON_MODES = [
249
+ "default",
250
+ "ghost",
251
+ "bleed"
252
+ ], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = [
253
+ "enabled",
254
+ "hovered",
255
+ "readOnly",
256
+ "disabled"
257
+ ], THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
258
+ /** @internal */
259
+ function isColorBlendModeValue(str) {
260
+ return THEME_COLOR_BLEND_MODES.includes(str);
261
+ }
262
+ /** @internal */
263
+ function isColorHueKey(str) {
264
+ return COLOR_HUES.includes(str);
265
+ }
266
+ /** @internal */
267
+ function isColorTintKey(str) {
268
+ return COLOR_TINTS.includes(str);
269
+ }
270
+ /** @internal */
271
+ function isColorButtonMode(str) {
272
+ return THEME_COLOR_BUTTON_MODES.includes(str);
273
+ }
274
+ /** @public */
275
+ const COLOR_CONFIG_STATE_KEYS = [
276
+ "_hue",
277
+ "bg",
278
+ "fg",
279
+ "border",
280
+ "focusRing",
281
+ "muted/fg",
282
+ "accent/fg",
283
+ "link/fg",
284
+ "code/bg",
285
+ "code/fg",
286
+ "skeleton/from",
287
+ "skeleton/to",
288
+ "status/dot",
289
+ "status/icon"
290
+ ], COLOR_CONFIG_CARD_KEYS = [
291
+ ...COLOR_CONFIG_STATE_KEYS,
292
+ "_hue",
293
+ "bg",
294
+ "fg",
295
+ "border",
296
+ "focusRing",
297
+ "shadow/outline",
298
+ "shadow/umbra",
299
+ "shadow/penumbra",
300
+ "shadow/ambient"
301
+ ], 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];
302
+ /** @internal */
303
+ function isColorConfigBaseTone(str) {
304
+ return COLOR_CONFIG_CARD_TONES.includes(str);
305
+ }
306
+ /** @internal */
307
+ function isColorConfigBaseKey(str) {
308
+ return COLOR_CONFIG_CARD_KEYS.includes(str);
309
+ }
310
+ /** @internal */
311
+ function isColorConfigStateKey(str) {
312
+ return COLOR_CONFIG_STATE_KEYS.includes(str);
313
+ }
314
+ /** @internal */
315
+ function isColorConfigStateTone(str) {
316
+ return COLOR_CONFIG_STATE_TONES.includes(str);
317
+ }
318
+ /** @internal */
319
+ function isColorConfigBlendKey(str) {
320
+ return COLOR_CONFIG_BLEND_KEYS.includes(str);
321
+ }
322
+ /** @internal */
323
+ function isColorTokenValue(str) {
324
+ return parseTokenValue(str)?.type === "color" || parseTokenValue(str)?.type === "hue";
325
+ }
326
+ /** @internal */
327
+ function isColorValue(str) {
328
+ return str === "black" || str === "white";
329
+ }
330
+ /** @internal */
331
+ function isColorOpacityValue(str) {
332
+ return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
333
+ }
334
+ function isColorMixPercentValue(str) {
335
+ return /^\d+%$/.test(str);
336
+ }
337
+ /** @internal */
338
+ function parseTokenValue(str) {
339
+ let segments = str.split("/"), nextSegment = segments.shift() || "", [segment0, segment0mix] = nextSegment.split(" ");
340
+ if (isColorTintKey(segment0)) {
341
+ let tint = segment0, segment1 = segments.shift() || "";
342
+ return isColorMixPercentValue(segment0mix) ? {
343
+ type: "color",
344
+ tint,
345
+ mix: Number(segment0mix.slice(0, -1)) / 100
346
+ } : isColorOpacityValue(segment1) ? {
347
+ type: "color",
348
+ tint,
349
+ opacity: Number(segment1)
350
+ } : {
351
+ type: "color",
352
+ tint
353
+ };
354
+ }
355
+ if (isColorValue(segment0)) {
356
+ let key = segment0, segment1 = segments.shift() || "";
357
+ return isColorMixPercentValue(segment0mix) ? {
358
+ type: "color",
359
+ key,
360
+ mix: Number(segment0mix.slice(0, -1)) / 100
361
+ } : isColorOpacityValue(segment1) ? {
362
+ type: "color",
363
+ key,
364
+ opacity: Number(segment1)
365
+ } : {
366
+ type: "color",
367
+ key
368
+ };
369
+ }
370
+ if (isColorHueKey(segment0)) {
371
+ let hue = segment0;
372
+ nextSegment = segments.shift() || "";
373
+ let [segment1, segment1mix] = nextSegment.split(" ");
374
+ if (isColorTintKey(segment1)) {
375
+ let tint = segment1, segment2 = segments.shift() || "";
376
+ return isColorMixPercentValue(segment1mix) ? {
377
+ type: "color",
378
+ hue,
379
+ tint,
380
+ mix: Number(segment1mix.slice(0, -1)) / 100
381
+ } : isColorOpacityValue(segment2) ? {
382
+ type: "color",
383
+ hue,
384
+ tint,
385
+ opacity: Number(segment2)
386
+ } : {
387
+ type: "color",
388
+ hue,
389
+ tint
390
+ };
391
+ }
392
+ return {
393
+ type: "hue",
394
+ value: hue
395
+ };
396
+ }
397
+ if (isColorBlendModeValue(segment0)) return {
398
+ type: "blendMode",
399
+ value: segment0
400
+ };
401
+ }
402
+ function compileColorTokenValue(node) {
403
+ let key = "";
404
+ return key = node.key === "black" || node.key === "white" ? node.key : `${node.hue}/${node.tint}`, node.mix === void 0 ? (node.opacity !== void 0 && (key += `/${node.opacity}`), key) : `${key} ${node.mix * 100}%`;
405
+ }
406
+ const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
407
+ function resolveColorTokenValue(context, value = DEFAULT_COLOR_TOKEN_VALUE) {
408
+ let { hue, scheme } = context, node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
409
+ if (!node || node.type !== "color") throw Error(`Invalid color token: ${value[0]}`);
410
+ return compileColorTokenValue({
411
+ ...node,
412
+ hue: node.hue || hue
413
+ });
414
+ }
415
+ const defaultColorTokens = {
416
+ base: {
417
+ "*": {
418
+ _blend: ["multiply", "screen"],
419
+ accent: { fg: ["purple/600", "purple/400"] },
420
+ avatar: { "*": {
421
+ _blend: ["screen", "multiply"],
422
+ bg: ["500", "400"],
423
+ fg: ["white", "black"]
424
+ } },
425
+ backdrop: ["gray/200/0.5", "black/0.5"],
426
+ badge: {
427
+ "*": {
428
+ bg: ["100", "900"],
429
+ fg: ["600", "400"],
430
+ icon: ["500", "500"],
431
+ dot: ["500", "500"]
432
+ },
433
+ positive: {
434
+ bg: ["200 50%", "900"],
435
+ fg: ["600", "500"]
436
+ },
437
+ caution: {
438
+ bg: ["200 50%", "900"],
439
+ fg: ["600", "500"]
440
+ }
441
+ },
442
+ bg: ["50", "950"],
443
+ border: ["200", "800"],
444
+ code: {
445
+ bg: ["50", "950"],
446
+ fg: ["600", "400"]
447
+ },
448
+ fg: ["800", "200"],
449
+ focusRing: ["blue/500", "blue/500"],
450
+ icon: ["600", "400"],
451
+ kbd: {
452
+ bg: ["white", "black"],
453
+ fg: ["600", "400"],
454
+ border: ["200", "800"]
455
+ },
456
+ link: { fg: ["blue/600", "blue/300"] },
457
+ muted: {
458
+ bg: ["50", "950"],
459
+ fg: ["700 75%", "300 75%"]
460
+ },
461
+ shadow: {
462
+ outline: ["500/0.3", "500/0.4"],
463
+ umbra: ["gray/500/0.1", "black/0.2"],
464
+ penumbra: ["gray/500/0.07", "black/0.14"],
465
+ ambient: ["gray/500/0.06", "black/0.12"]
466
+ },
467
+ skeleton: {
468
+ from: ["100", "900"],
469
+ to: ["100 50%", "900 50%"]
470
+ }
471
+ },
472
+ transparent: { bg: ["50", "black"] },
473
+ default: {
474
+ bg: ["white", "950"],
475
+ fg: ["800", "200"],
476
+ muted: { fg: ["600", "400"] }
477
+ },
478
+ primary: { _hue: "blue" },
479
+ suggest: { _hue: "purple" },
480
+ positive: {
481
+ _hue: "green",
482
+ shadow: { outline: ["500/0.4", "500/0.4"] }
483
+ },
484
+ caution: {
485
+ _hue: "yellow",
486
+ shadow: { outline: ["600/0.3", "500/0.4"] }
487
+ },
488
+ critical: { _hue: "red" }
489
+ },
490
+ button: {
491
+ default: {
492
+ "*": {
493
+ "*": {
494
+ _blend: ["screen", "multiply"],
495
+ accent: { fg: ["purple/300", "purple/700"] },
496
+ avatar: { "*": {
497
+ _blend: ["screen", "multiply"],
498
+ bg: ["500", "400"],
499
+ fg: ["white", "black"]
500
+ } },
501
+ badge: { "*": {
502
+ bg: ["900", "100"],
503
+ fg: ["400", "600"],
504
+ dot: ["500", "500"],
505
+ icon: ["500", "500"]
506
+ } },
507
+ bg: ["500", "400"],
508
+ border: ["500/0", "400/0"],
509
+ code: {
510
+ bg: ["500 20%", "400 20%"],
511
+ fg: ["200", "600"]
512
+ },
513
+ fg: ["white", "black"],
514
+ icon: ["100 70%", "900 70%"],
515
+ kbd: {
516
+ bg: ["black", "white"],
517
+ fg: ["200", "600"],
518
+ border: ["800", "200"]
519
+ },
520
+ link: { fg: ["blue/200", "blue/600"] },
521
+ muted: {
522
+ bg: ["950", "50"],
523
+ fg: ["100 70%", "900 70%"]
524
+ },
525
+ skeleton: {
526
+ from: ["900", "100"],
527
+ to: ["900 50%", "100 50%"]
528
+ }
529
+ },
530
+ hovered: {
531
+ bg: ["600", "300"],
532
+ border: ["700/0", "300/0"]
533
+ },
534
+ pressed: { bg: ["700", "300"] },
535
+ selected: { bg: ["700", "300"] },
536
+ disabled: {
537
+ _hue: "gray",
538
+ accent: { fg: ["100 70%", "900 70%"] },
539
+ avatar: { "*": {
540
+ _blend: ["screen", "multiply"],
541
+ bg: ["gray/500", "gray/400"],
542
+ fg: ["white", "black"]
543
+ } },
544
+ badge: { "*": {
545
+ bg: ["gray/700", "gray/300"],
546
+ fg: ["white", "black"],
547
+ dot: ["white", "black"],
548
+ icon: ["white", "black"]
549
+ } },
550
+ bg: ["300", "600"],
551
+ code: {
552
+ bg: ["950", "50"],
553
+ fg: ["300", "600"]
554
+ },
555
+ fg: ["300", "600"],
556
+ muted: {
557
+ bg: ["950", "50"],
558
+ fg: ["300", "600"]
559
+ },
560
+ kbd: {
561
+ bg: ["black", "white"],
562
+ fg: ["white", "black"],
563
+ border: ["700", "300"]
564
+ },
565
+ link: { fg: ["100 70%", "900 70%"] }
566
+ }
567
+ },
568
+ default: {
569
+ "*": {
570
+ avatar: { "*": {
571
+ _blend: ["screen", "multiply"],
572
+ bg: ["500", "400"],
573
+ fg: ["white", "black"]
574
+ } },
575
+ bg: ["800", "200"],
576
+ muted: {
577
+ bg: ["950", "50"],
578
+ fg: ["400", "600"]
579
+ }
580
+ },
581
+ hovered: { bg: ["900", "100"] },
582
+ pressed: { bg: ["black", "white"] },
583
+ selected: { bg: ["black", "white"] }
584
+ }
585
+ },
586
+ ghost: {
587
+ "*": {
588
+ "*": {
589
+ _blend: ["multiply", "screen"],
590
+ accent: { fg: ["purple/700 60%", "purple/300 70%"] },
591
+ avatar: { "*": {
592
+ _blend: ["screen", "multiply"],
593
+ bg: ["500", "400"],
594
+ fg: ["white", "black"]
595
+ } },
596
+ badge: { "*": {
597
+ bg: ["100", "900"],
598
+ fg: ["600", "400"],
599
+ dot: ["500", "500"],
600
+ icon: ["500", "500"]
601
+ } },
602
+ bg: ["50", "950"],
603
+ border: ["100", "900"],
604
+ code: {
605
+ bg: ["500 10%", "400 10%"],
606
+ fg: ["700 60%", "400 60%"]
607
+ },
608
+ fg: ["600", "400"],
609
+ icon: ["700 60%", "300 60%"],
610
+ kbd: {
611
+ bg: ["white", "black"],
612
+ fg: ["600", "400"],
613
+ border: ["200", "800"]
614
+ },
615
+ link: { fg: ["blue/700 60%", "blue/300 60%"] },
616
+ muted: {
617
+ bg: ["100", "950"],
618
+ fg: ["700 60%", "300 60%"]
619
+ },
620
+ skeleton: {
621
+ from: ["100", "900"],
622
+ to: ["100 50%", "900 50%"]
623
+ }
624
+ },
625
+ hovered: {
626
+ bg: ["100", "900"],
627
+ fg: ["700", "300"]
628
+ },
629
+ pressed: {
630
+ bg: ["200", "800"],
631
+ fg: ["800", "200"]
632
+ },
633
+ selected: {
634
+ bg: ["200", "800"],
635
+ fg: ["800", "200"]
636
+ },
637
+ disabled: {
638
+ _hue: "gray",
639
+ accent: { fg: ["200", "800"] },
640
+ avatar: { "*": {
641
+ _blend: ["screen", "multiply"],
642
+ bg: ["gray/100", "gray/900"],
643
+ fg: ["white", "black"]
644
+ } },
645
+ badge: { "*": {
646
+ _hue: "gray",
647
+ bg: ["50", "950"],
648
+ fg: ["gray/200", "gray/800"],
649
+ dot: ["gray/200", "gray/800"],
650
+ icon: ["gray/200", "gray/800"]
651
+ } },
652
+ border: ["100", "900"],
653
+ code: {
654
+ bg: ["50", "950"],
655
+ fg: ["200", "800"]
656
+ },
657
+ fg: ["400", "600"],
658
+ icon: ["300", "700"],
659
+ muted: { fg: ["300", "700"] },
660
+ kbd: {
661
+ bg: ["white", "black"],
662
+ fg: ["200", "800"],
663
+ border: ["100", "900"]
664
+ },
665
+ link: { fg: ["200", "800"] }
666
+ }
667
+ },
668
+ positive: { "*": { border: ["600 20%", "800"] } },
669
+ caution: { "*": { border: ["600 20%", "800"] } }
670
+ },
671
+ bleed: { "*": {
672
+ "*": {
673
+ _blend: ["multiply", "screen"],
674
+ accent: { fg: ["purple/700 70%", "purple/300 70%"] },
675
+ avatar: { "*": {
676
+ _blend: ["screen", "multiply"],
677
+ bg: ["500", "400"],
678
+ fg: ["white", "black"]
679
+ } },
680
+ badge: { "*": {
681
+ bg: ["100", "900"],
682
+ fg: ["600", "400"],
683
+ dot: ["500", "500"],
684
+ icon: ["500", "500"]
685
+ } },
686
+ bg: ["white", "black"],
687
+ border: ["white/0", "black/0"],
688
+ code: {
689
+ bg: ["50", "950"],
690
+ fg: ["700 75%", "300 75%"]
691
+ },
692
+ fg: ["700", "300"],
693
+ icon: ["700 75%", "300 75%"],
694
+ kbd: {
695
+ bg: ["white", "black"],
696
+ fg: ["700", "300"],
697
+ border: ["200", "800"]
698
+ },
699
+ link: { fg: ["blue/700 70%", "blue/300 70%"] },
700
+ muted: {
701
+ bg: ["100", "950"],
702
+ fg: ["700 75%", "300 75%"]
703
+ },
704
+ skeleton: {
705
+ from: ["100", "900"],
706
+ to: ["100 50%", "900 50%"]
707
+ }
708
+ },
709
+ hovered: {
710
+ bg: ["50", "900"],
711
+ fg: ["800", "200"],
712
+ icon: ["800 70%", "300 70%"]
713
+ },
714
+ pressed: {
715
+ bg: ["100", "800"],
716
+ fg: ["800", "200"],
717
+ icon: ["800 70%", "200 70%"]
718
+ },
719
+ selected: {
720
+ bg: ["100", "900"],
721
+ fg: ["800", "200"],
722
+ icon: ["800 60%", "200 60%"]
723
+ },
724
+ disabled: {
725
+ _hue: "gray",
726
+ accent: { fg: ["200", "800"] },
727
+ avatar: { "*": {
728
+ _blend: ["screen", "multiply"],
729
+ bg: ["gray/100", "gray/900"],
730
+ fg: ["white", "black"]
731
+ } },
732
+ badge: { "*": {
733
+ _hue: "gray",
734
+ bg: ["50", "950"],
735
+ fg: ["gray/200", "gray/800"],
736
+ dot: ["gray/200", "gray/800"],
737
+ icon: ["gray/200", "gray/800"]
738
+ } },
739
+ code: {
740
+ bg: ["50", "950"],
741
+ fg: ["200", "800"]
742
+ },
743
+ fg: ["400", "600"],
744
+ icon: ["300", "700"],
745
+ muted: { fg: ["400", "600"] },
746
+ kbd: {
747
+ bg: ["white", "black"],
748
+ fg: ["200", "800"],
749
+ border: ["100", "900"]
750
+ },
751
+ link: { fg: ["200", "800"] }
752
+ }
753
+ } }
754
+ },
755
+ input: {
756
+ "*": {
757
+ "*": {
758
+ _blend: ["multiply", "screen"],
759
+ bg: ["white", "black"],
760
+ border: ["200", "700"],
761
+ fg: ["black", "200"],
762
+ muted: { bg: ["50", "950"] },
763
+ placeholder: ["400", "600"]
764
+ },
765
+ hovered: { border: ["300", "700"] },
766
+ readOnly: {
767
+ bg: ["50", "950"],
768
+ border: ["200", "800"],
769
+ fg: ["800", "200"]
770
+ },
771
+ disabled: {
772
+ bg: ["50", "950"],
773
+ fg: ["400", "600"],
774
+ border: ["100", "900"],
775
+ placeholder: ["200", "800 50%"]
776
+ }
777
+ },
778
+ invalid: { "*": {
779
+ _hue: "red",
780
+ bg: ["100", "950"]
781
+ } }
782
+ },
783
+ selectable: {
784
+ "*": {
785
+ "*": {
786
+ _blend: ["multiply", "screen"],
787
+ accent: { fg: ["purple/700 70%", "purple/300 70%"] },
788
+ avatar: { "*": {
789
+ _blend: ["screen", "multiply"],
790
+ bg: ["500", "400"],
791
+ fg: ["white", "black"]
792
+ } },
793
+ badge: { "*": {
794
+ bg: ["100", "900"],
795
+ fg: ["600", "400"],
796
+ dot: ["500", "500"],
797
+ icon: ["500", "500"]
798
+ } },
799
+ bg: ["white", "black"],
800
+ border: ["200", "800"],
801
+ code: {
802
+ bg: ["50", "950"],
803
+ fg: ["600", "400"]
804
+ },
805
+ fg: ["700", "300"],
806
+ icon: ["700 75%", "300 75%"],
807
+ kbd: {
808
+ bg: ["white", "black"],
809
+ fg: ["600", "400"],
810
+ border: ["200", "800"]
811
+ },
812
+ link: { fg: ["blue/700 70%", "blue/300 70%"] },
813
+ muted: {
814
+ bg: ["50", "950"],
815
+ fg: ["700 75%", "300 75%"]
816
+ },
817
+ skeleton: {
818
+ from: ["100", "900"],
819
+ to: ["100 50%", "900 50%"]
820
+ }
821
+ },
822
+ hovered: { bg: ["50", "950"] },
823
+ pressed: { bg: ["100", "900"] },
824
+ selected: {
825
+ _blend: ["screen", "multiply"],
826
+ accent: { fg: ["purple/300", "purple/700"] },
827
+ avatar: { "*": {
828
+ _blend: ["multiply", "screen"],
829
+ bg: ["white", "black"],
830
+ fg: ["black", "white"]
831
+ } },
832
+ badge: { "*": {
833
+ bg: ["900", "100"],
834
+ fg: ["400", "600"],
835
+ dot: ["500", "500"],
836
+ icon: ["500", "500"]
837
+ } },
838
+ bg: ["500", "400"],
839
+ border: ["500 20%", "400 20%"],
840
+ code: {
841
+ bg: ["500 20%", "400 20%"],
842
+ fg: ["200", "600"]
843
+ },
844
+ fg: ["white", "black"],
845
+ icon: ["100 70%", "900 70%"],
846
+ kbd: {
847
+ bg: ["black", "white"],
848
+ fg: ["200", "600"],
849
+ border: ["800", "200"]
850
+ },
851
+ link: { fg: ["blue/200", "blue/600"] },
852
+ muted: {
853
+ bg: ["500 10%", "400 10%"],
854
+ fg: ["100 70%", "900 70%"]
855
+ },
856
+ skeleton: {
857
+ from: ["900", "100"],
858
+ to: ["900 50%", "100 50%"]
859
+ }
860
+ },
861
+ disabled: {
862
+ _hue: "gray",
863
+ accent: { fg: ["200", "800"] },
864
+ avatar: { "*": {
865
+ _blend: ["screen", "multiply"],
866
+ bg: ["gray/100", "gray/900"],
867
+ fg: ["white", "black"]
868
+ } },
869
+ badge: { "*": {
870
+ _hue: "gray",
871
+ bg: ["50", "950"],
872
+ fg: ["gray/200", "gray/800"],
873
+ dot: ["gray/200", "gray/800"],
874
+ icon: ["gray/200", "gray/800"]
875
+ } },
876
+ border: ["100", "900"],
877
+ code: {
878
+ bg: ["50", "950"],
879
+ fg: ["200", "800"]
880
+ },
881
+ fg: ["200", "800"],
882
+ icon: ["200", "800"],
883
+ kbd: {
884
+ bg: ["white", "black"],
885
+ fg: ["200", "800"],
886
+ border: ["100", "900"]
887
+ },
888
+ link: { fg: ["200", "800"] },
889
+ muted: {
890
+ bg: ["50 50%", "950 50%"],
891
+ fg: ["200", "800"]
892
+ }
893
+ }
894
+ },
895
+ default: { selected: { _hue: "blue" } },
896
+ critical: { disabled: { bg: ["50 50%", "950 50%"] } }
897
+ },
898
+ syntax: {
899
+ atrule: ["purple/600", "purple/400"],
900
+ attrName: ["green/600", "green/400"],
901
+ attrValue: ["yellow/600", "yellow/400"],
902
+ attribute: ["yellow/600", "yellow/400"],
903
+ boolean: ["purple/600", "purple/400"],
904
+ builtin: ["purple/600", "purple/400"],
905
+ cdata: ["yellow/600", "yellow/400"],
906
+ char: ["yellow/600", "yellow/400"],
907
+ class: ["orange/600", "orange/400"],
908
+ className: ["cyan/600", "cyan/400"],
909
+ comment: ["gray/400", "gray/600"],
910
+ constant: ["purple/600", "purple/400"],
911
+ deleted: ["red/600", "red/400"],
912
+ entity: ["red/600", "red/400"],
913
+ function: ["green/600", "green/400"],
914
+ hexcode: ["blue/600", "blue/400"],
915
+ id: ["purple/600", "purple/400"],
916
+ important: ["purple/600", "purple/400"],
917
+ inserted: ["yellow/600", "yellow/400"],
918
+ keyword: ["magenta/600", "magenta/400"],
919
+ number: ["purple/600", "purple/400"],
920
+ operator: ["magenta/600", "magenta/400"],
921
+ property: ["blue/600", "blue/400"],
922
+ pseudoClass: ["yellow/600", "yellow/400"],
923
+ pseudoElement: ["yellow/600", "yellow/400"],
924
+ punctuation: ["gray/600", "gray/400"],
925
+ regex: ["blue/600", "blue/400"],
926
+ selector: ["red/600", "red/400"],
927
+ string: ["yellow/600", "yellow/400"],
928
+ symbol: ["purple/600", "purple/400"],
929
+ tag: ["red/600", "red/400"],
930
+ unit: ["orange/600", "orange/400"],
931
+ url: ["red/600", "red/400"],
932
+ variable: ["red/600", "red/400"]
933
+ }
934
+ };
935
+ function isRecord(value) {
936
+ return !!(value && typeof value == "object" && !Array.isArray(value));
937
+ }
938
+ function merge(...records) {
939
+ let _records = records.filter(Boolean);
940
+ return _records.length === 0 ? {} : _records.reduce(_merge, {});
941
+ }
942
+ function _merge(acc, source) {
943
+ for (let key of Object.keys(source)) {
944
+ let prevValue = acc[key], nextValue = source[key];
945
+ acc[key] = isRecord(prevValue) && isRecord(nextValue) ? merge(prevValue, nextValue) : nextValue;
946
+ }
947
+ return acc;
948
+ }
949
+ /**
950
+ * Convert a tree of color tokens from a sparse format to a dense format.
951
+ */
952
+ function resolveColorTokens(inputTokens) {
953
+ let tokens = merge(defaultColorTokens, inputTokens);
954
+ return {
955
+ base: resolveBaseColorTokens(tokens),
956
+ button: resolveButtonColorTokens(tokens),
957
+ input: resolveInputColorTokens(tokens),
958
+ selectable: resolveSelectableColorTokens(tokens),
959
+ syntax: tokens.syntax
960
+ };
961
+ }
962
+ function resolveBaseColorTokens(sparseTokens) {
963
+ let tokens = {};
964
+ for (let tone of THEME_COLOR_CARD_TONES) tokens[tone] = resolveBaseColorTones(sparseTokens, tone);
965
+ return tokens;
966
+ }
967
+ function resolveBaseColorTones(inputTokens, tone) {
968
+ let spec = merge(inputTokens?.base?.["*"], inputTokens?.base?.[tone]), hue = spec._hue || inputTokens?.base?.[tone]?._hue || "gray";
969
+ return {
970
+ ...spec,
971
+ _hue: hue,
972
+ avatar: COLOR_HUES.reduce((acc, hue) => ({
973
+ ...acc,
974
+ [hue]: merge({ _hue: hue }, spec.avatar?.["*"], spec.avatar?.[hue])
975
+ }), {}),
976
+ badge: THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
977
+ ...acc,
978
+ [tone]: {
979
+ _hue: inputTokens?.base?.[tone]?._hue || hue,
980
+ ...spec.badge?.["*"],
981
+ ...spec.badge?.[tone]
982
+ }
983
+ }), {})
984
+ };
985
+ }
986
+ function resolveButtonColorTokens(inputTokens) {
987
+ let tokens = {};
988
+ for (let mode of THEME_COLOR_BUTTON_MODES) tokens[mode] = resolveButtonToneColorTokens(inputTokens, mode);
989
+ return tokens;
990
+ }
991
+ function resolveButtonToneColorTokens(inputTokens, mode) {
992
+ let tokens = {};
993
+ for (let tone of THEME_COLOR_STATE_TONES) tokens[tone] = resolveButtonModeColorTokens(inputTokens, mode, tone);
994
+ return tokens;
995
+ }
996
+ function resolveButtonModeColorTokens(inputTokens, mode, tone) {
997
+ let tokens = {};
998
+ for (let state of THEME_COLOR_STATES) tokens[state] = resolveButtonStateColorTokens(inputTokens, tone, mode, state);
999
+ return tokens;
1000
+ }
1001
+ function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
1002
+ let 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;
1003
+ return {
1004
+ ...spec,
1005
+ _hue: hue,
1006
+ avatar: COLOR_HUES.reduce((acc, hue) => ({
1007
+ ...acc,
1008
+ [hue]: merge({ _hue: hue }, spec.avatar?.["*"], spec.avatar?.[hue])
1009
+ }), {}),
1010
+ badge: THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
1011
+ ...acc,
1012
+ [tone]: {
1013
+ _hue: inputTokens?.base?.[tone]?._hue || hue,
1014
+ ...spec.badge?.["*"],
1015
+ ...spec.badge?.[tone]
1016
+ }
1017
+ }), {})
1018
+ };
1019
+ }
1020
+ function resolveInputColorTokens(inputTokens) {
1021
+ let tokens = {};
1022
+ for (let mode of THEME_COLOR_INPUT_MODES) tokens[mode] = resolveInputModeColorTokens(inputTokens, mode);
1023
+ return tokens;
1024
+ }
1025
+ function resolveInputModeColorTokens(inputTokens, mode) {
1026
+ let states = {};
1027
+ for (let state of THEME_COLOR_INPUT_STATES) states[state] = resolveInputStateColorTokens(inputTokens, mode, state);
1028
+ return states;
1029
+ }
1030
+ function resolveInputStateColorTokens(inputTokens, mode, state) {
1031
+ let spec = merge(inputTokens?.input?.["*"]?.["*"], inputTokens?.input?.[mode]?.["*"], inputTokens?.input?.["*"]?.[state], inputTokens?.input?.[mode]?.[state]), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
1032
+ return {
1033
+ ...spec,
1034
+ _hue: hue
1035
+ };
1036
+ }
1037
+ function resolveSelectableColorTokens(inputTokens) {
1038
+ let tokens = {};
1039
+ for (let tone of THEME_COLOR_STATE_TONES) tokens[tone] = resolveSelectableToneColorTokens(inputTokens, tone);
1040
+ return tokens;
1041
+ }
1042
+ function resolveSelectableToneColorTokens(inputTokens, tone) {
1043
+ let states = { _hue: inputTokens?.selectable?.[tone]?._hue || inputTokens?.base?.[tone]?._hue };
1044
+ for (let state of THEME_COLOR_STATES) states[state] = resolveSelectableStateColorTokens(inputTokens, tone, state);
1045
+ return states;
1046
+ }
1047
+ function resolveSelectableStateColorTokens(inputTokens, tone, state) {
1048
+ let spec = merge(inputTokens?.selectable?.["*"]?.["*"], inputTokens?.selectable?.[tone]?.["*"], inputTokens?.selectable?.["*"]?.[state], inputTokens?.selectable?.[tone]?.[state]), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
1049
+ return {
1050
+ ...spec,
1051
+ _hue: hue,
1052
+ avatar: COLOR_HUES.reduce((acc, hue) => ({
1053
+ ...acc,
1054
+ [hue]: merge({ _hue: hue }, spec.avatar?.["*"], spec.avatar?.[hue])
1055
+ }), {}),
1056
+ badge: THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
1057
+ ...acc,
1058
+ [tone]: {
1059
+ _hue: inputTokens?.base?.[tone]?._hue || hue,
1060
+ ...spec.badge?.["*"],
1061
+ ...spec.badge?.[tone]
1062
+ }
1063
+ }), {})
1064
+ };
1065
+ }
1066
+ function buildColorTheme(config) {
1067
+ let resolvedConfig = {
1068
+ ...config,
1069
+ color: resolveColorTokens(config?.color)
1070
+ }, schemes = {};
1071
+ return defineLazyProperty(schemes, "light", () => buildColorScheme({ scheme: "light" }, resolvedConfig)), defineLazyProperty(schemes, "dark", () => buildColorScheme({ scheme: "dark" }, resolvedConfig)), schemes;
1072
+ }
1073
+ function buildColorScheme(options, config) {
1074
+ let { scheme } = options, colorScheme = {};
1075
+ for (let tone of THEME_COLOR_CARD_TONES) defineLazyProperty(colorScheme, tone, () => buildCardColorTheme({
1076
+ scheme,
1077
+ tone
1078
+ }, config));
1079
+ return colorScheme;
1080
+ }
1081
+ function buildCardColorTheme(options, config) {
1082
+ let { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = {
1083
+ hue: tokens?._hue || "gray",
1084
+ scheme
1085
+ };
1086
+ return {
1087
+ _blend: (tokens?._blend || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
1088
+ _dark: scheme === "dark",
1089
+ accent: { fg: resolveColorTokenValue(context, tokens?.accent?.fg) },
1090
+ avatar: buildAvatarColorTheme({ scheme }, tokens),
1091
+ backdrop: resolveColorTokenValue(context, tokens?.backdrop),
1092
+ badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
1093
+ bg: resolveColorTokenValue(context, tokens?.bg),
1094
+ border: resolveColorTokenValue(context, tokens?.border),
1095
+ button: buildButtonColorTheme({
1096
+ scheme,
1097
+ tone
1098
+ }, config),
1099
+ code: {
1100
+ bg: resolveColorTokenValue(context, tokens?.code?.bg),
1101
+ fg: resolveColorTokenValue(context, tokens?.code?.fg)
1102
+ },
1103
+ fg: resolveColorTokenValue(context, tokens?.fg),
1104
+ focusRing: resolveColorTokenValue(context, tokens?.focusRing),
1105
+ icon: resolveColorTokenValue(context, tokens?.icon),
1106
+ input: buildInputColorTheme({
1107
+ scheme,
1108
+ tone
1109
+ }, config),
1110
+ kbd: {
1111
+ bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
1112
+ fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
1113
+ border: resolveColorTokenValue(context, tokens?.kbd?.border)
1114
+ },
1115
+ link: { fg: resolveColorTokenValue(context, tokens?.link?.fg) },
1116
+ muted: {
1117
+ bg: resolveColorTokenValue(context, tokens?.muted?.bg),
1118
+ fg: resolveColorTokenValue(context, tokens?.muted?.fg)
1119
+ },
1120
+ selectable: buildSelectableColorTheme({
1121
+ scheme,
1122
+ tone
1123
+ }, config),
1124
+ shadow: buildShadowColorTheme({
1125
+ scheme,
1126
+ tone
1127
+ }, config),
1128
+ skeleton: {
1129
+ from: resolveColorTokenValue(context, tokens?.skeleton?.from),
1130
+ to: resolveColorTokenValue(context, tokens?.skeleton?.to)
1131
+ },
1132
+ syntax: buildSyntaxColorTheme({ scheme }, config)
1133
+ };
1134
+ }
1135
+ function buildShadowColorTheme(options, config) {
1136
+ let { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = {
1137
+ hue: tokens?._hue || "gray",
1138
+ scheme
1139
+ };
1140
+ return {
1141
+ outline: resolveColorTokenValue(context, tokens?.shadow?.outline),
1142
+ umbra: resolveColorTokenValue(context, tokens?.shadow?.umbra),
1143
+ penumbra: resolveColorTokenValue(context, tokens?.shadow?.penumbra),
1144
+ ambient: resolveColorTokenValue(context, tokens?.shadow?.ambient)
1145
+ };
1146
+ }
1147
+ function buildAvatarColorTheme(options, stateTokens) {
1148
+ let { scheme } = options;
1149
+ return {
1150
+ gray: _buildAvatarColorTheme({
1151
+ color: "gray",
1152
+ scheme
1153
+ }, stateTokens),
1154
+ blue: _buildAvatarColorTheme({
1155
+ color: "blue",
1156
+ scheme
1157
+ }, stateTokens),
1158
+ purple: _buildAvatarColorTheme({
1159
+ color: "purple",
1160
+ scheme
1161
+ }, stateTokens),
1162
+ magenta: _buildAvatarColorTheme({
1163
+ color: "magenta",
1164
+ scheme
1165
+ }, stateTokens),
1166
+ red: _buildAvatarColorTheme({
1167
+ color: "red",
1168
+ scheme
1169
+ }, stateTokens),
1170
+ orange: _buildAvatarColorTheme({
1171
+ color: "orange",
1172
+ scheme
1173
+ }, stateTokens),
1174
+ yellow: _buildAvatarColorTheme({
1175
+ color: "yellow",
1176
+ scheme
1177
+ }, stateTokens),
1178
+ green: _buildAvatarColorTheme({
1179
+ color: "green",
1180
+ scheme
1181
+ }, stateTokens),
1182
+ cyan: _buildAvatarColorTheme({
1183
+ color: "cyan",
1184
+ scheme
1185
+ }, stateTokens)
1186
+ };
1187
+ }
1188
+ function _buildAvatarColorTheme(options, stateTokens) {
1189
+ let { color, scheme } = options, tokens = stateTokens?.avatar?.[color], context = {
1190
+ hue: tokens?._hue || "gray",
1191
+ scheme
1192
+ };
1193
+ return {
1194
+ _blend: (tokens?._blend || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
1195
+ bg: resolveColorTokenValue(context, tokens?.bg),
1196
+ fg: resolveColorTokenValue(context, tokens?.fg)
1197
+ };
1198
+ }
1199
+ function buildBadgeColorTheme(tokens, options, config) {
1200
+ let { scheme } = options, colorBadge = {};
1201
+ for (let tone of THEME_COLOR_STATE_TONES) colorBadge[tone] = _buildBadgeColorTheme(tokens, {
1202
+ scheme,
1203
+ tone
1204
+ }, config);
1205
+ return colorBadge;
1206
+ }
1207
+ function _buildBadgeColorTheme(parentTokens, options, config) {
1208
+ let { scheme, tone } = options, tokens = parentTokens?.[tone], context = {
1209
+ hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray",
1210
+ scheme
1211
+ };
1212
+ return {
1213
+ bg: resolveColorTokenValue(context, tokens?.bg),
1214
+ fg: resolveColorTokenValue(context, tokens?.fg),
1215
+ dot: resolveColorTokenValue(context, tokens?.dot),
1216
+ icon: resolveColorTokenValue(context, tokens?.icon)
1217
+ };
1218
+ }
1219
+ function buildButtonColorTheme(options, config) {
1220
+ let { scheme, tone: cardTone } = options, modes = {};
1221
+ for (let mode of THEME_COLOR_BUTTON_MODES) modes[mode] = buildButtonTonesColorTheme({
1222
+ cardTone,
1223
+ scheme,
1224
+ mode
1225
+ }, config);
1226
+ return modes;
1227
+ }
1228
+ function buildButtonTonesColorTheme(options, config) {
1229
+ let { cardTone, mode, scheme } = options, tones = {};
1230
+ for (let tone of THEME_COLOR_STATE_TONES) tones[tone] = buildButtonStatesColorTheme({
1231
+ cardTone,
1232
+ mode,
1233
+ scheme,
1234
+ tone
1235
+ }, config);
1236
+ return tones;
1237
+ }
1238
+ function buildButtonStatesColorTheme(options, config) {
1239
+ let { cardTone, mode, scheme, tone } = options, states = {};
1240
+ for (let state of THEME_COLOR_STATES) states[state] = buildButtonStateColorTheme({
1241
+ cardTone,
1242
+ mode,
1243
+ tone,
1244
+ scheme,
1245
+ state
1246
+ }, config);
1247
+ return states;
1248
+ }
1249
+ function buildButtonStateColorTheme(options, config) {
1250
+ let { cardTone, mode, tone, scheme, state } = 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 = {
1251
+ hue,
1252
+ scheme
1253
+ };
1254
+ return {
1255
+ _blend: blendMode[scheme === "light" ? 0 : 1],
1256
+ accent: { fg: resolveColorTokenValue(context, tokens?.accent?.fg) },
1257
+ avatar: buildAvatarColorTheme({ scheme }, tokens),
1258
+ badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
1259
+ bg: resolveColorTokenValue(context, tokens?.bg),
1260
+ border: resolveColorTokenValue(context, tokens?.border),
1261
+ code: {
1262
+ bg: resolveColorTokenValue(context, tokens?.code?.bg),
1263
+ fg: resolveColorTokenValue(context, tokens?.code?.fg)
1264
+ },
1265
+ fg: resolveColorTokenValue(context, tokens?.fg),
1266
+ icon: resolveColorTokenValue(context, tokens?.icon),
1267
+ muted: {
1268
+ bg: resolveColorTokenValue(context, tokens?.muted?.bg),
1269
+ fg: resolveColorTokenValue(context, tokens?.muted?.fg)
1270
+ },
1271
+ kbd: {
1272
+ bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
1273
+ fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
1274
+ border: resolveColorTokenValue(context, tokens?.kbd?.border)
1275
+ },
1276
+ link: { fg: resolveColorTokenValue(context, tokens?.link?.fg) },
1277
+ skeleton: {
1278
+ from: resolveColorTokenValue(context, tokens?.skeleton?.from),
1279
+ to: resolveColorTokenValue(context, tokens?.skeleton?.to)
1280
+ }
1281
+ };
1282
+ }
1283
+ function buildInputColorTheme(options, config) {
1284
+ let { scheme, tone } = options;
1285
+ return {
1286
+ default: buildInputStatesColorTheme({
1287
+ mode: "default",
1288
+ scheme,
1289
+ tone
1290
+ }, config),
1291
+ invalid: buildInputStatesColorTheme({
1292
+ mode: "invalid",
1293
+ scheme,
1294
+ tone
1295
+ }, config)
1296
+ };
1297
+ }
1298
+ function buildInputStatesColorTheme(options, config) {
1299
+ let { mode, scheme, tone } = options;
1300
+ return {
1301
+ enabled: buildInputStateColorTheme({
1302
+ mode,
1303
+ scheme,
1304
+ state: "enabled",
1305
+ cardTone: tone
1306
+ }, config),
1307
+ hovered: buildInputStateColorTheme({
1308
+ mode,
1309
+ scheme,
1310
+ state: "hovered",
1311
+ cardTone: tone
1312
+ }, config),
1313
+ readOnly: buildInputStateColorTheme({
1314
+ mode,
1315
+ scheme,
1316
+ state: "readOnly",
1317
+ cardTone: tone
1318
+ }, config),
1319
+ disabled: buildInputStateColorTheme({
1320
+ mode,
1321
+ scheme,
1322
+ state: "disabled",
1323
+ cardTone: tone
1324
+ }, config)
1325
+ };
1326
+ }
1327
+ function buildInputStateColorTheme(options, config) {
1328
+ let { cardTone, mode, scheme, state } = options, cardTokens = config?.color?.base?.[cardTone], tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || cardTokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
1329
+ hue,
1330
+ scheme
1331
+ };
1332
+ return {
1333
+ _blend: blendMode[scheme === "light" ? 0 : 1],
1334
+ bg: resolveColorTokenValue(context, tokens?.bg),
1335
+ border: resolveColorTokenValue(context, tokens?.border),
1336
+ fg: resolveColorTokenValue(context, tokens?.fg),
1337
+ muted: { bg: resolveColorTokenValue(context, tokens?.muted?.bg) },
1338
+ placeholder: resolveColorTokenValue(context, tokens?.placeholder)
1339
+ };
1340
+ }
1341
+ function buildSelectableColorTheme(options, config) {
1342
+ let { scheme, tone: cardTone } = options, tones = {};
1343
+ for (let tone of THEME_COLOR_STATE_TONES) tones[tone] = buildSelectableStatesColorTheme({
1344
+ cardTone,
1345
+ scheme,
1346
+ tone
1347
+ }, config);
1348
+ return tones;
1349
+ }
1350
+ function buildSelectableStatesColorTheme(options, config) {
1351
+ let { cardTone, scheme, tone } = options, states = {};
1352
+ for (let state of THEME_COLOR_STATES) states[state] = buildSelectableStateColorTheme({
1353
+ cardTone,
1354
+ tone,
1355
+ scheme,
1356
+ state
1357
+ }, config);
1358
+ return states;
1359
+ }
1360
+ function buildSelectableStateColorTheme(options, config) {
1361
+ let { cardTone, scheme, state, tone } = options, cardTokens = config?.color?.base?.[cardTone], tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || cardTokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
1362
+ hue,
1363
+ scheme
1364
+ };
1365
+ return {
1366
+ _blend: blendMode[scheme === "light" ? 0 : 1],
1367
+ accent: { fg: resolveColorTokenValue(context, tokens?.accent?.fg) },
1368
+ avatar: buildAvatarColorTheme({ scheme }, tokens),
1369
+ badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
1370
+ bg: resolveColorTokenValue(context, tokens?.bg),
1371
+ border: resolveColorTokenValue(context, tokens?.border),
1372
+ code: {
1373
+ bg: resolveColorTokenValue(context, tokens?.code?.bg),
1374
+ fg: resolveColorTokenValue(context, tokens?.code?.fg)
1375
+ },
1376
+ fg: resolveColorTokenValue(context, tokens?.fg),
1377
+ icon: resolveColorTokenValue(context, tokens?.icon),
1378
+ muted: {
1379
+ bg: resolveColorTokenValue(context, tokens?.muted?.bg),
1380
+ fg: resolveColorTokenValue(context, tokens?.muted?.fg)
1381
+ },
1382
+ kbd: {
1383
+ bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
1384
+ fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
1385
+ border: resolveColorTokenValue(context, tokens?.kbd?.border)
1386
+ },
1387
+ link: { fg: resolveColorTokenValue(context, tokens?.link?.fg) },
1388
+ skeleton: {
1389
+ from: resolveColorTokenValue(context, tokens?.skeleton?.from),
1390
+ to: resolveColorTokenValue(context, tokens?.skeleton?.to)
1391
+ }
1392
+ };
1393
+ }
1394
+ function buildSyntaxColorTheme(options, config) {
1395
+ let { scheme } = options, tokens = config?.color?.syntax, context = {
1396
+ hue: "gray",
1397
+ scheme
1398
+ };
1399
+ return {
1400
+ atrule: resolveColorTokenValue(context, tokens?.atrule),
1401
+ attrName: resolveColorTokenValue(context, tokens?.attrName),
1402
+ attrValue: resolveColorTokenValue(context, tokens?.attrValue),
1403
+ attribute: resolveColorTokenValue(context, tokens?.attribute),
1404
+ boolean: resolveColorTokenValue(context, tokens?.boolean),
1405
+ builtin: resolveColorTokenValue(context, tokens?.builtin),
1406
+ cdata: resolveColorTokenValue(context, tokens?.cdata),
1407
+ char: resolveColorTokenValue(context, tokens?.char),
1408
+ class: resolveColorTokenValue(context, tokens?.class),
1409
+ className: resolveColorTokenValue(context, tokens?.className),
1410
+ comment: resolveColorTokenValue(context, tokens?.comment),
1411
+ constant: resolveColorTokenValue(context, tokens?.constant),
1412
+ deleted: resolveColorTokenValue(context, tokens?.deleted),
1413
+ doctype: resolveColorTokenValue(context, tokens?.doctype),
1414
+ entity: resolveColorTokenValue(context, tokens?.entity),
1415
+ function: resolveColorTokenValue(context, tokens?.function),
1416
+ hexcode: resolveColorTokenValue(context, tokens?.hexcode),
1417
+ id: resolveColorTokenValue(context, tokens?.id),
1418
+ important: resolveColorTokenValue(context, tokens?.important),
1419
+ inserted: resolveColorTokenValue(context, tokens?.inserted),
1420
+ keyword: resolveColorTokenValue(context, tokens?.keyword),
1421
+ number: resolveColorTokenValue(context, tokens?.number),
1422
+ operator: resolveColorTokenValue(context, tokens?.operator),
1423
+ prolog: resolveColorTokenValue(context, tokens?.prolog),
1424
+ property: resolveColorTokenValue(context, tokens?.property),
1425
+ pseudoClass: resolveColorTokenValue(context, tokens?.pseudoClass),
1426
+ pseudoElement: resolveColorTokenValue(context, tokens?.pseudoElement),
1427
+ punctuation: resolveColorTokenValue(context, tokens?.punctuation),
1428
+ regex: resolveColorTokenValue(context, tokens?.regex),
1429
+ selector: resolveColorTokenValue(context, tokens?.selector),
1430
+ string: resolveColorTokenValue(context, tokens?.string),
1431
+ symbol: resolveColorTokenValue(context, tokens?.symbol),
1432
+ tag: resolveColorTokenValue(context, tokens?.tag),
1433
+ unit: resolveColorTokenValue(context, tokens?.unit),
1434
+ url: resolveColorTokenValue(context, tokens?.url),
1435
+ variable: resolveColorTokenValue(context, tokens?.variable)
1436
+ };
1437
+ }
1438
+ const defaultColorPalette = color;
1439
+ function mixChannel(b, s, weight) {
1440
+ return b + (s - b) * weight;
1441
+ }
1442
+ /**
1443
+ * Apply the \`mix\` blend mode
1444
+ * @internal
1445
+ */
1446
+ function mix(b, s, weight) {
1447
+ return {
1448
+ r: mixChannel(b.r, s.r, weight),
1449
+ g: mixChannel(b.g, s.g, weight),
1450
+ b: mixChannel(b.b, s.b, weight)
1451
+ };
1452
+ }
1453
+ function lerp(x, y, a) {
1454
+ return x * (1 - a) + y * a;
1455
+ }
1456
+ function invlerp(x, y, a) {
1457
+ return clamp((a - x) / (y - x));
1458
+ }
1459
+ function clamp(a, min = 0, max = 1) {
1460
+ return Math.min(max, Math.max(min, a));
1461
+ }
1462
+ function range(x1, y1, x2, y2, a) {
1463
+ return lerp(x2, y2, invlerp(x1, y1, a));
1464
+ }
1465
+ function round(value) {
1466
+ return Math.round(value);
1467
+ }
1468
+ /**
1469
+ * @internal
1470
+ */
1471
+ function hexToRgb(hex) {
1472
+ if (hex.length === 4) {
1473
+ let hexR = hex.slice(1, 2), hexG = hex.slice(2, 3), hexB = hex.slice(3, 4);
1474
+ return {
1475
+ r: parseInt(hexR + hexR, 16),
1476
+ g: parseInt(hexG + hexG, 16),
1477
+ b: parseInt(hexB + hexB, 16)
1478
+ };
1479
+ }
1480
+ return {
1481
+ r: parseInt(hex.slice(1, 3), 16),
1482
+ g: parseInt(hex.slice(3, 5), 16),
1483
+ b: parseInt(hex.slice(5, 7), 16)
1484
+ };
1485
+ }
1486
+ /**
1487
+ * @internal
1488
+ */
1489
+ function rgbaToRGBA(rgba) {
1490
+ let values = rgba.replace(/rgba\(|\)/g, "").split(",");
1491
+ return {
1492
+ r: parseInt(values[0]),
1493
+ g: parseInt(values[1]),
1494
+ b: parseInt(values[2]),
1495
+ a: parseFloat(values[3])
1496
+ };
1497
+ }
1498
+ /**
1499
+ * @internal
1500
+ */
1501
+ function rgbToHex(color) {
1502
+ let r = round(clamp(Math.round(color.r), 0, 255)), g = round(clamp(Math.round(color.g), 0, 255)), b = round(clamp(Math.round(color.b), 0, 255));
1503
+ return "a" in color ? `rgba(${r},${g},${b},${color.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
1504
+ }
1505
+ /**
1506
+ * @internal
1507
+ * @see https://css-tricks.com/converting-color-spaces-in-javascript/
1508
+ */
1509
+ function rgbToHsl({ r, g, b }) {
1510
+ r /= 255, g /= 255, b /= 255;
1511
+ let cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin, h = 0, s = 0, l = 0;
1512
+ return h = delta == 0 ? 0 : cmax == r ? (g - b) / delta % 6 : cmax == g ? (b - r) / delta + 2 : (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), {
1513
+ h,
1514
+ s,
1515
+ l
1516
+ };
1517
+ }
1518
+ /**
1519
+ * @internal
1520
+ */
1521
+ function hslToRgb(hsl) {
1522
+ let 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, r = 0, g = 0, b = 0;
1523
+ 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), {
1524
+ r: Math.round((r + m) * 255),
1525
+ g: Math.round((g + m) * 255),
1526
+ b: Math.round((b + m) * 255)
1527
+ };
1528
+ }
1529
+ const HSL_RE = /hsl\(\s*(\d+)\s*,\s*((\d+(?:\.\d+)?)%)\s*,\s*((\d+(?:\.\d+)?)%)\s*\)/i;
1530
+ function isHexChars(str) {
1531
+ for (let c of str) if ("0123456789ABCDEFabcdef".indexOf(c) === -1) return !1;
1532
+ return !0;
1533
+ }
1534
+ function isHex(str) {
1535
+ return str[0] !== "#" || str.length !== 4 && str.length !== 7 ? !1 : isHexChars(str.slice(1));
1536
+ }
1537
+ function parseHsl(str) {
1538
+ let res = HSL_RE.exec(str);
1539
+ if (!res) throw Error(`parseHsl: string is not a HSL color: "${str}"`);
1540
+ return {
1541
+ h: parseInt(res[1]),
1542
+ s: parseFloat(res[3]),
1543
+ l: parseFloat(res[5])
1544
+ };
1545
+ }
1546
+ /**
1547
+ * @internal
1548
+ */
1549
+ function parseColor(color) {
1550
+ if (!color) return {
1551
+ r: 0,
1552
+ g: 0,
1553
+ b: 0
1554
+ };
1555
+ if (typeof color != "string") throw Error("parseColor: expected a string");
1556
+ if (isHex(color)) return hexToRgb(color);
1557
+ if (color.startsWith("hsl(")) return hslToRgb(parseHsl(color));
1558
+ if (color.startsWith("rgba(")) return rgbaToRGBA(color);
1559
+ throw Error(`parseColor: unexpected color format: "${color}"`);
1560
+ }
1561
+ /**
1562
+ * @internal
1563
+ */
1564
+ function rgba(color, a) {
1565
+ let rgb = parseColor(color);
1566
+ return `rgba(${rgb.r},${rgb.g},${rgb.b},${a})`;
1567
+ }
1568
+ function multiplyChannel(b, s) {
1569
+ return b * s;
1570
+ }
1571
+ /**
1572
+ * Apply the \`multiply\` blend mode
1573
+ * Source: https://www.w3.org/TR/compositing-1/#blendingmultiply
1574
+ * @internal
1575
+ */
1576
+ function multiply(b, s) {
1577
+ return {
1578
+ r: multiplyChannel(b.r / 255, s.r / 255) * 255,
1579
+ g: multiplyChannel(b.g / 255, s.g / 255) * 255,
1580
+ b: multiplyChannel(b.b / 255, s.b / 255) * 255
1581
+ };
1582
+ }
1583
+ function screenChannel(b, s) {
1584
+ return b + s - b * s;
1585
+ }
1586
+ /**
1587
+ * Apply the \`screen\` blend mode
1588
+ * Source: https://www.w3.org/TR/compositing-1/#blendingscreen
1589
+ * @internal
1590
+ */
1591
+ function screen(b, s) {
1592
+ return {
1593
+ r: screenChannel(b.r / 255, s.r / 255) * 255,
1594
+ g: screenChannel(b.g / 255, s.g / 255) * 255,
1595
+ b: screenChannel(b.b / 255, s.b / 255) * 255
1596
+ };
1597
+ }
1598
+ const RGB_RANGE = [0, 255];
1599
+ function mixThemeColor(value, options) {
1600
+ let { blendMode } = options, color = parseColor(value), black = parseColor(options.black), white = parseColor(options.white), bg = options.bg ? parseColor(options.bg) : blendMode === "multiply" ? white : black, paletteRange = {
1601
+ r: [black.r, white.r],
1602
+ g: [black.g, white.g],
1603
+ b: [black.b, white.b]
1604
+ }, convertedBgColor = {
1605
+ r: clamp(range(...paletteRange.r, ...RGB_RANGE, bg.r), ...RGB_RANGE),
1606
+ g: clamp(range(...paletteRange.g, ...RGB_RANGE, bg.g), ...RGB_RANGE),
1607
+ b: clamp(range(...paletteRange.b, ...RGB_RANGE, bg.b), ...RGB_RANGE)
1608
+ }, convertedColor = {
1609
+ r: clamp(range(...paletteRange.r, ...RGB_RANGE, color.r), ...RGB_RANGE),
1610
+ g: clamp(range(...paletteRange.g, ...RGB_RANGE, color.g), ...RGB_RANGE),
1611
+ b: clamp(range(...paletteRange.b, ...RGB_RANGE, color.b), ...RGB_RANGE)
1612
+ }, resultColor = blendMode === "multiply" ? multiply(convertedBgColor, convertedColor) : screen(convertedBgColor, convertedColor);
1613
+ return rgbToHex({
1614
+ r: clamp(range(...RGB_RANGE, ...paletteRange.r, resultColor.r), ...paletteRange.r),
1615
+ g: clamp(range(...RGB_RANGE, ...paletteRange.g, resultColor.g), ...paletteRange.g),
1616
+ b: clamp(range(...RGB_RANGE, ...paletteRange.b, resultColor.b), ...paletteRange.b)
1617
+ });
1618
+ }
1619
+ function renderColorValue(str, options) {
1620
+ let { bg, blendMode, colorPalette } = options;
1621
+ if (bg === "white") throw Error("Cannot blend with white background");
1622
+ let node = parseTokenValue(str);
1623
+ if (!node || node.type !== "color") throw Error(`Invalid color token value: ${str}`);
1624
+ let hex = "";
1625
+ 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) throw Error(`Invalid color token value: ${str}`);
1626
+ let hexBeforeMix = hex, mixOptions = {
1627
+ blendMode,
1628
+ bg,
1629
+ black: renderColorHex(colorPalette.black),
1630
+ white: renderColorHex(colorPalette.white)
1631
+ };
1632
+ try {
1633
+ hex = mixThemeColor(hex, mixOptions), bg && node.mix !== void 0 && (hex = rgbToHex(mix(hexToRgb(bg), hexToRgb(hex), node.mix)));
1634
+ } catch (err) {
1635
+ throw console.warn("could not blend", hex, mixOptions), err;
1636
+ }
1637
+ return hex === "#aN" && (console.warn(`invalid color token value: ${str}`), hex = hexBeforeMix), node.opacity !== void 0 && (hex = rgba(hex, node.opacity)), hex;
1638
+ }
1639
+ function renderColorHex(color) {
1640
+ return typeof color == "string" ? color : color.hex;
1641
+ }
1642
+ function renderThemeColorSchemes(value, config) {
1643
+ let colorPalette = config?.palette ?? defaultColorPalette, schemes = {};
1644
+ return defineLazyProperty(schemes, "light", () => renderThemeColorScheme(colorPalette, value.light)), defineLazyProperty(schemes, "dark", () => renderThemeColorScheme(colorPalette, value.dark)), schemes;
1645
+ }
1646
+ function renderThemeColorScheme(colorPalette, value) {
1647
+ let renderedDefaultTone = renderThemeColor(value.default, { colorPalette }), bg = renderedDefaultTone.bg;
1648
+ if (bg === "white") throw Error("Cannot blend with white background");
1649
+ let scheme = { default: renderedDefaultTone };
1650
+ for (let tone of THEME_COLOR_CARD_TONES) {
1651
+ if (tone === "default") continue;
1652
+ let opts = tone === "transparent" ? { colorPalette } : {
1653
+ bg,
1654
+ colorPalette
1655
+ };
1656
+ defineLazyProperty(scheme, tone, () => renderThemeColor(value[tone], opts));
1657
+ }
1658
+ return scheme;
1659
+ }
1660
+ function renderThemeColor(value, options) {
1661
+ let { colorPalette, bg } = options, blendMode = value._blend || "multiply", baseBg = renderColorValue(value.bg, {
1662
+ colorPalette,
1663
+ bg,
1664
+ blendMode
1665
+ }), colorOptions = {
1666
+ colorPalette,
1667
+ bg: baseBg,
1668
+ blendMode
1669
+ }, button = renderThemeColorButton(value.button, {
1670
+ baseBg,
1671
+ blendMode,
1672
+ colorPalette
1673
+ }), selectable = renderThemeColorSelectable(value.selectable, {
1674
+ colorPalette,
1675
+ baseBg,
1676
+ blendMode
1677
+ }), shadow = {
1678
+ outline: renderColorValue(value.shadow.outline, colorOptions),
1679
+ umbra: renderColorValue(value.shadow.umbra, {
1680
+ ...colorOptions,
1681
+ bg: void 0,
1682
+ colorPalette: {
1683
+ ...colorPalette,
1684
+ black: "#000000"
1685
+ }
1686
+ }),
1687
+ penumbra: renderColorValue(value.shadow.penumbra, {
1688
+ ...colorOptions,
1689
+ bg: void 0,
1690
+ colorPalette: {
1691
+ ...colorPalette,
1692
+ black: "#000000"
1693
+ }
1694
+ }),
1695
+ ambient: renderColorValue(value.shadow.ambient, {
1696
+ ...colorOptions,
1697
+ bg: void 0,
1698
+ colorPalette: {
1699
+ ...colorPalette,
1700
+ black: "#000000"
1701
+ }
1702
+ })
1703
+ };
1704
+ return {
1705
+ _blend: blendMode,
1706
+ _dark: value._dark,
1707
+ accent: { fg: renderColorValue(value.accent.fg, colorOptions) },
1708
+ avatar: renderThemeColorAvatar(value.avatar, {
1709
+ baseBg,
1710
+ colorPalette,
1711
+ blendMode
1712
+ }),
1713
+ backdrop: renderColorValue(value.backdrop, colorOptions),
1714
+ badge: renderThemeColorBadge(value.badge, {
1715
+ baseBg,
1716
+ colorPalette,
1717
+ blendMode
1718
+ }),
1719
+ bg: baseBg,
1720
+ border: renderColorValue(value.border, colorOptions),
1721
+ button,
1722
+ code: {
1723
+ bg: renderColorValue(value.code.bg, colorOptions),
1724
+ fg: renderColorValue(value.code.fg, colorOptions)
1725
+ },
1726
+ fg: renderColorValue(value.fg, colorOptions),
1727
+ focusRing: renderColorValue(value.focusRing, colorOptions),
1728
+ icon: renderColorValue(value.icon, colorOptions),
1729
+ input: renderThemeColorInput(value.input, {
1730
+ baseBg,
1731
+ colorPalette,
1732
+ blendMode
1733
+ }),
1734
+ kbd: renderThemeColorKBD(value.kbd, {
1735
+ baseBg,
1736
+ colorPalette,
1737
+ blendMode
1738
+ }),
1739
+ link: { fg: renderColorValue(value.link.fg, colorOptions) },
1740
+ muted: {
1741
+ bg: renderColorValue(value.muted.bg, colorOptions),
1742
+ fg: renderColorValue(value.muted.fg, colorOptions)
1743
+ },
1744
+ shadow,
1745
+ skeleton: {
1746
+ from: renderColorValue(value.skeleton.from, colorOptions),
1747
+ to: renderColorValue(value.skeleton.to, colorOptions)
1748
+ },
1749
+ syntax: renderSyntaxColorTheme(value.syntax, {
1750
+ baseBg,
1751
+ colorPalette,
1752
+ blendMode
1753
+ }),
1754
+ selectable
1755
+ };
1756
+ }
1757
+ function renderThemeColorKBD(value, options) {
1758
+ let { baseBg, blendMode, colorPalette } = options, rootOptions = {
1759
+ bg: baseBg,
1760
+ blendMode,
1761
+ colorPalette
1762
+ }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
1763
+ bg,
1764
+ blendMode,
1765
+ colorPalette
1766
+ };
1767
+ return {
1768
+ bg,
1769
+ fg: renderColorValue(value.fg, colorOptions),
1770
+ border: renderColorValue(value.border, colorOptions)
1771
+ };
1772
+ }
1773
+ function renderThemeColorAvatar(value, options) {
1774
+ let colorAvatar = {};
1775
+ for (let hue of COLOR_HUES) colorAvatar[hue] = renderThemeColorAvatarColor(value[hue], options);
1776
+ return colorAvatar;
1777
+ }
1778
+ function renderThemeColorAvatarColor(value, options) {
1779
+ let { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
1780
+ bg: baseBg,
1781
+ blendMode: rootBlendMode,
1782
+ colorPalette
1783
+ }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
1784
+ bg,
1785
+ blendMode,
1786
+ colorPalette
1787
+ };
1788
+ return {
1789
+ _blend: blendMode,
1790
+ bg,
1791
+ fg: renderColorValue(value.fg, colorOptions)
1792
+ };
1793
+ }
1794
+ function renderThemeColorBadge(value, options) {
1795
+ let colorBadge = {};
1796
+ for (let tone of THEME_COLOR_STATE_TONES) colorBadge[tone] = renderThemeColorBadgeColor(value[tone], options);
1797
+ return colorBadge;
1798
+ }
1799
+ function renderThemeColorBadgeColor(value, options) {
1800
+ let { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = rootBlendMode, rootOptions = {
1801
+ bg: baseBg,
1802
+ blendMode: rootBlendMode,
1803
+ colorPalette
1804
+ }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
1805
+ bg,
1806
+ blendMode,
1807
+ colorPalette
1808
+ };
1809
+ return {
1810
+ bg,
1811
+ dot: renderColorValue(value.dot, colorOptions),
1812
+ fg: renderColorValue(value.fg, colorOptions),
1813
+ icon: renderColorValue(value.icon, colorOptions)
1814
+ };
1815
+ }
1816
+ function renderThemeColorButton(value, options) {
1817
+ return {
1818
+ default: renderThemeColorButtonTones(value.default, options),
1819
+ ghost: renderThemeColorButtonTones(value.ghost, options),
1820
+ bleed: renderThemeColorButtonTones(value.bleed, options)
1821
+ };
1822
+ }
1823
+ function renderThemeColorButtonTones(value, options) {
1824
+ let colorButtonMode = {};
1825
+ for (let tone of THEME_COLOR_STATE_TONES) colorButtonMode[tone] = renderThemeColorButtonStates(value[tone], options);
1826
+ return colorButtonMode;
1827
+ }
1828
+ function renderThemeColorButtonStates(value, options) {
1829
+ return {
1830
+ enabled: renderThemeColorState(value.enabled, options),
1831
+ hovered: renderThemeColorState(value.hovered, options),
1832
+ pressed: renderThemeColorState(value.pressed, options),
1833
+ selected: renderThemeColorState(value.selected, options),
1834
+ disabled: renderThemeColorState(value.disabled, options)
1835
+ };
1836
+ }
1837
+ function renderThemeColorState(value, options) {
1838
+ let { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
1839
+ bg: baseBg,
1840
+ blendMode: rootBlendMode,
1841
+ colorPalette
1842
+ }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
1843
+ bg,
1844
+ blendMode,
1845
+ colorPalette
1846
+ };
1847
+ return {
1848
+ _blend: blendMode,
1849
+ accent: { fg: renderColorValue(value.accent.fg, colorOptions) },
1850
+ avatar: renderThemeColorAvatar(value.avatar, {
1851
+ baseBg: bg,
1852
+ colorPalette,
1853
+ blendMode
1854
+ }),
1855
+ badge: renderThemeColorBadge(value.badge, {
1856
+ baseBg: bg,
1857
+ colorPalette,
1858
+ blendMode
1859
+ }),
1860
+ bg,
1861
+ border: renderColorValue(value.border, colorOptions),
1862
+ code: {
1863
+ bg: renderColorValue(value.code.bg, colorOptions),
1864
+ fg: renderColorValue(value.code.fg, colorOptions)
1865
+ },
1866
+ fg: renderColorValue(value.fg, colorOptions),
1867
+ icon: renderColorValue(value.icon, colorOptions),
1868
+ link: { fg: renderColorValue(value.link.fg, colorOptions) },
1869
+ muted: {
1870
+ bg: renderColorValue(value.muted.bg, colorOptions),
1871
+ fg: renderColorValue(value.muted.fg, colorOptions)
1872
+ },
1873
+ kbd: {
1874
+ bg: renderColorValue(value.kbd.bg, colorOptions),
1875
+ fg: renderColorValue(value.kbd.fg, colorOptions),
1876
+ border: renderColorValue(value.kbd.border, colorOptions)
1877
+ },
1878
+ skeleton: {
1879
+ from: renderColorValue(value.skeleton?.from, colorOptions),
1880
+ to: renderColorValue(value.skeleton?.to, colorOptions)
1881
+ }
1882
+ };
1883
+ }
1884
+ function renderThemeColorInput(value, options) {
1885
+ return {
1886
+ default: renderInputStatesColorTheme(value.default, options),
1887
+ invalid: renderInputStatesColorTheme(value.invalid, options)
1888
+ };
1889
+ }
1890
+ function renderInputStatesColorTheme(value, options) {
1891
+ return {
1892
+ enabled: renderInputStateColorTheme(value.enabled, options),
1893
+ hovered: renderInputStateColorTheme(value.hovered, options),
1894
+ readOnly: renderInputStateColorTheme(value.readOnly, options),
1895
+ disabled: renderInputStateColorTheme(value.disabled, options)
1896
+ };
1897
+ }
1898
+ function renderInputStateColorTheme(value, options) {
1899
+ let { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
1900
+ colorPalette,
1901
+ bg: baseBg,
1902
+ blendMode: rootBlendMode
1903
+ }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
1904
+ colorPalette,
1905
+ bg,
1906
+ blendMode
1907
+ };
1908
+ return {
1909
+ _blend: blendMode,
1910
+ bg,
1911
+ border: renderColorValue(value.border, colorOptions),
1912
+ fg: renderColorValue(value.fg, colorOptions),
1913
+ muted: { bg: renderColorValue(value.muted.bg, colorOptions) },
1914
+ placeholder: renderColorValue(value.placeholder, colorOptions)
1915
+ };
1916
+ }
1917
+ function renderThemeColorSelectable(value, options) {
1918
+ let colorSelectable = {};
1919
+ for (let tone of THEME_COLOR_STATE_TONES) colorSelectable[tone] = renderThemeColorSelectableStates(value[tone], options);
1920
+ return colorSelectable;
1921
+ }
1922
+ function renderThemeColorSelectableStates(value, options) {
1923
+ return {
1924
+ enabled: renderThemeColorState(value.enabled, options),
1925
+ hovered: renderThemeColorState(value.hovered, options),
1926
+ pressed: renderThemeColorState(value.pressed, options),
1927
+ selected: renderThemeColorState(value.selected, options),
1928
+ disabled: renderThemeColorState(value.disabled, options)
1929
+ };
1930
+ }
1931
+ function renderSyntaxColorTheme(value, options) {
1932
+ let { colorPalette, baseBg, blendMode } = options, colorOptions = {
1933
+ colorPalette,
1934
+ bg: baseBg,
1935
+ blendMode
1936
+ };
1937
+ return {
1938
+ atrule: renderColorValue(value.atrule, colorOptions),
1939
+ attrName: renderColorValue(value.attrName, colorOptions),
1940
+ attrValue: renderColorValue(value.attrValue, colorOptions),
1941
+ attribute: renderColorValue(value.attribute, colorOptions),
1942
+ boolean: renderColorValue(value.boolean, colorOptions),
1943
+ builtin: renderColorValue(value.builtin, colorOptions),
1944
+ cdata: renderColorValue(value.cdata, colorOptions),
1945
+ char: renderColorValue(value.char, colorOptions),
1946
+ class: renderColorValue(value.class, colorOptions),
1947
+ className: renderColorValue(value.className, colorOptions),
1948
+ comment: renderColorValue(value.comment, colorOptions),
1949
+ constant: renderColorValue(value.constant, colorOptions),
1950
+ deleted: renderColorValue(value.deleted, colorOptions),
1951
+ doctype: renderColorValue(value.doctype, colorOptions),
1952
+ entity: renderColorValue(value.entity, colorOptions),
1953
+ function: renderColorValue(value.function, colorOptions),
1954
+ hexcode: renderColorValue(value.hexcode, colorOptions),
1955
+ id: renderColorValue(value.id, colorOptions),
1956
+ important: renderColorValue(value.important, colorOptions),
1957
+ inserted: renderColorValue(value.inserted, colorOptions),
1958
+ keyword: renderColorValue(value.keyword, colorOptions),
1959
+ number: renderColorValue(value.number, colorOptions),
1960
+ operator: renderColorValue(value.operator, colorOptions),
1961
+ prolog: renderColorValue(value.prolog, colorOptions),
1962
+ property: renderColorValue(value.property, colorOptions),
1963
+ pseudoClass: renderColorValue(value.pseudoClass, colorOptions),
1964
+ pseudoElement: renderColorValue(value.pseudoElement, colorOptions),
1965
+ punctuation: renderColorValue(value.punctuation, colorOptions),
1966
+ regex: renderColorValue(value.regex, colorOptions),
1967
+ selector: renderColorValue(value.selector, colorOptions),
1968
+ string: renderColorValue(value.string, colorOptions),
1969
+ symbol: renderColorValue(value.symbol, colorOptions),
1970
+ tag: renderColorValue(value.tag, colorOptions),
1971
+ unit: renderColorValue(value.unit, colorOptions),
1972
+ url: renderColorValue(value.url, colorOptions),
1973
+ variable: renderColorValue(value.variable, colorOptions)
1974
+ };
1975
+ }
1976
+ /** @internal */
1977
+ function buildTheme(config) {
1978
+ let colorTheme = buildColorTheme(config), v2 = {
1979
+ _version: 2,
1980
+ avatar: config?.avatar ?? defaultThemeConfig.avatar,
1981
+ button: config?.button ?? defaultThemeConfig.button,
1982
+ card: config?.card ?? defaultThemeConfig.card,
1983
+ color: renderThemeColorSchemes(colorTheme, config),
1984
+ container: config?.container ?? defaultThemeConfig.container,
1985
+ font: config?.font ?? defaultThemeFonts,
1986
+ input: config?.input ?? defaultThemeConfig.input,
1987
+ layer: config?.layer ?? defaultThemeConfig.layer,
1988
+ media: config?.media ?? defaultThemeConfig.media,
1989
+ radius: config?.radius ?? defaultThemeConfig.radius,
1990
+ shadow: config?.shadow ?? defaultThemeConfig.shadow,
1991
+ space: config?.space ?? defaultThemeConfig.space,
1992
+ style: config?.style ?? defaultThemeConfig.style
1993
+ };
1994
+ return v2_v0(v2);
1995
+ }
1996
+ function createSelectableTones(opts, base, dark, solid, muted) {
1997
+ return {
1998
+ default: _createSelectableStates(opts, base, dark, solid, muted, "default"),
1999
+ primary: _createSelectableStates(opts, base, dark, solid, muted, "primary"),
2000
+ positive: _createSelectableStates(opts, base, dark, solid, muted, "positive"),
2001
+ caution: _createSelectableStates(opts, base, dark, solid, muted, "caution"),
2002
+ critical: _createSelectableStates(opts, base, dark, solid, muted, "critical")
2003
+ };
2004
+ }
2005
+ function _createSelectableStates(opts, base, dark, solid, muted, tone) {
2006
+ return {
2007
+ enabled: opts.selectable({
2008
+ base,
2009
+ dark,
2010
+ solid,
2011
+ muted,
2012
+ state: "enabled",
2013
+ tone
2014
+ }),
2015
+ hovered: opts.selectable({
2016
+ base,
2017
+ dark,
2018
+ solid,
2019
+ muted,
2020
+ state: "hovered",
2021
+ tone
2022
+ }),
2023
+ pressed: opts.selectable({
2024
+ base,
2025
+ dark,
2026
+ solid,
2027
+ muted,
2028
+ state: "pressed",
2029
+ tone
2030
+ }),
2031
+ selected: opts.selectable({
2032
+ base,
2033
+ dark,
2034
+ solid,
2035
+ muted,
2036
+ state: "selected",
2037
+ tone
2038
+ }),
2039
+ disabled: opts.selectable({
2040
+ base,
2041
+ dark,
2042
+ solid,
2043
+ muted,
2044
+ state: "disabled",
2045
+ tone
2046
+ })
2047
+ };
2048
+ }
2049
+ function createSolidTones(opts, base, dark, name) {
2050
+ return {
2051
+ default: {
2052
+ enabled: opts.solid({
2053
+ base,
2054
+ dark,
2055
+ tone: "default",
2056
+ name,
2057
+ state: "enabled"
2058
+ }),
2059
+ disabled: opts.solid({
2060
+ base,
2061
+ dark,
2062
+ tone: "default",
2063
+ name,
2064
+ state: "disabled"
2065
+ }),
2066
+ hovered: opts.solid({
2067
+ base,
2068
+ dark,
2069
+ tone: "default",
2070
+ name,
2071
+ state: "hovered"
2072
+ }),
2073
+ pressed: opts.solid({
2074
+ base,
2075
+ dark,
2076
+ tone: "default",
2077
+ name,
2078
+ state: "pressed"
2079
+ }),
2080
+ selected: opts.solid({
2081
+ base,
2082
+ dark,
2083
+ tone: "default",
2084
+ name,
2085
+ state: "selected"
2086
+ })
2087
+ },
2088
+ transparent: {
2089
+ enabled: opts.solid({
2090
+ base,
2091
+ dark,
2092
+ tone: "transparent",
2093
+ name,
2094
+ state: "enabled"
2095
+ }),
2096
+ disabled: opts.solid({
2097
+ base,
2098
+ dark,
2099
+ tone: "transparent",
2100
+ name,
2101
+ state: "disabled"
2102
+ }),
2103
+ hovered: opts.solid({
2104
+ base,
2105
+ dark,
2106
+ tone: "transparent",
2107
+ name,
2108
+ state: "hovered"
2109
+ }),
2110
+ pressed: opts.solid({
2111
+ base,
2112
+ dark,
2113
+ tone: "transparent",
2114
+ name,
2115
+ state: "pressed"
2116
+ }),
2117
+ selected: opts.solid({
2118
+ base,
2119
+ dark,
2120
+ tone: "transparent",
2121
+ name,
2122
+ state: "selected"
2123
+ })
2124
+ },
2125
+ primary: {
2126
+ enabled: opts.solid({
2127
+ base,
2128
+ dark,
2129
+ tone: "primary",
2130
+ name,
2131
+ state: "enabled"
2132
+ }),
2133
+ disabled: opts.solid({
2134
+ base,
2135
+ dark,
2136
+ tone: "primary",
2137
+ name,
2138
+ state: "disabled"
2139
+ }),
2140
+ hovered: opts.solid({
2141
+ base,
2142
+ dark,
2143
+ tone: "primary",
2144
+ name,
2145
+ state: "hovered"
2146
+ }),
2147
+ pressed: opts.solid({
2148
+ base,
2149
+ dark,
2150
+ tone: "primary",
2151
+ name,
2152
+ state: "pressed"
2153
+ }),
2154
+ selected: opts.solid({
2155
+ base,
2156
+ dark,
2157
+ tone: "primary",
2158
+ name,
2159
+ state: "selected"
2160
+ })
2161
+ },
2162
+ positive: {
2163
+ enabled: opts.solid({
2164
+ base,
2165
+ dark,
2166
+ tone: "positive",
2167
+ name,
2168
+ state: "enabled"
2169
+ }),
2170
+ disabled: opts.solid({
2171
+ base,
2172
+ dark,
2173
+ tone: "positive",
2174
+ name,
2175
+ state: "disabled"
2176
+ }),
2177
+ hovered: opts.solid({
2178
+ base,
2179
+ dark,
2180
+ tone: "positive",
2181
+ name,
2182
+ state: "hovered"
2183
+ }),
2184
+ pressed: opts.solid({
2185
+ base,
2186
+ dark,
2187
+ tone: "positive",
2188
+ name,
2189
+ state: "pressed"
2190
+ }),
2191
+ selected: opts.solid({
2192
+ base,
2193
+ dark,
2194
+ tone: "positive",
2195
+ name,
2196
+ state: "selected"
2197
+ })
2198
+ },
2199
+ caution: {
2200
+ enabled: opts.solid({
2201
+ base,
2202
+ dark,
2203
+ tone: "caution",
2204
+ name,
2205
+ state: "enabled"
2206
+ }),
2207
+ disabled: opts.solid({
2208
+ base,
2209
+ dark,
2210
+ tone: "caution",
2211
+ name,
2212
+ state: "disabled"
2213
+ }),
2214
+ hovered: opts.solid({
2215
+ base,
2216
+ dark,
2217
+ tone: "caution",
2218
+ name,
2219
+ state: "hovered"
2220
+ }),
2221
+ pressed: opts.solid({
2222
+ base,
2223
+ dark,
2224
+ tone: "caution",
2225
+ name,
2226
+ state: "pressed"
2227
+ }),
2228
+ selected: opts.solid({
2229
+ base,
2230
+ dark,
2231
+ tone: "caution",
2232
+ name,
2233
+ state: "selected"
2234
+ })
2235
+ },
2236
+ critical: {
2237
+ enabled: opts.solid({
2238
+ base,
2239
+ dark,
2240
+ tone: "critical",
2241
+ name,
2242
+ state: "enabled"
2243
+ }),
2244
+ disabled: opts.solid({
2245
+ base,
2246
+ dark,
2247
+ tone: "critical",
2248
+ name,
2249
+ state: "disabled"
2250
+ }),
2251
+ hovered: opts.solid({
2252
+ base,
2253
+ dark,
2254
+ tone: "critical",
2255
+ name,
2256
+ state: "hovered"
2257
+ }),
2258
+ pressed: opts.solid({
2259
+ base,
2260
+ dark,
2261
+ tone: "critical",
2262
+ name,
2263
+ state: "pressed"
2264
+ }),
2265
+ selected: opts.solid({
2266
+ base,
2267
+ dark,
2268
+ tone: "critical",
2269
+ name,
2270
+ state: "selected"
2271
+ })
2272
+ }
2273
+ };
2274
+ }
2275
+ function createButtonTones(opts, base, dark, solid, muted, mode) {
2276
+ return {
2277
+ default: opts.button({
2278
+ base,
2279
+ dark,
2280
+ solid: solid.default,
2281
+ muted: muted.default,
2282
+ mode
2283
+ }),
2284
+ primary: opts.button({
2285
+ base,
2286
+ dark,
2287
+ solid: solid.primary,
2288
+ muted: muted.primary,
2289
+ mode
2290
+ }),
2291
+ positive: opts.button({
2292
+ base,
2293
+ dark,
2294
+ solid: solid.positive,
2295
+ muted: muted.positive,
2296
+ mode
2297
+ }),
2298
+ caution: opts.button({
2299
+ base,
2300
+ dark,
2301
+ solid: solid.caution,
2302
+ muted: muted.caution,
2303
+ mode
2304
+ }),
2305
+ critical: opts.button({
2306
+ base,
2307
+ dark,
2308
+ solid: solid.critical,
2309
+ muted: muted.critical,
2310
+ mode
2311
+ })
2312
+ };
2313
+ }
2314
+ function createButtonModes(opts, base, dark, solid, muted) {
2315
+ return {
2316
+ default: createButtonTones(opts, base, dark, solid, muted, "default"),
2317
+ ghost: createButtonTones(opts, base, dark, solid, muted, "ghost"),
2318
+ bleed: createButtonTones(opts, base, dark, solid, muted, "bleed")
2319
+ };
2320
+ }
2321
+ function createCardStates(opts, base, dark, name, solid, muted) {
2322
+ return {
2323
+ enabled: opts.card({
2324
+ base,
2325
+ dark,
2326
+ name,
2327
+ state: "enabled",
2328
+ solid,
2329
+ muted
2330
+ }),
2331
+ disabled: opts.card({
2332
+ base,
2333
+ dark,
2334
+ name,
2335
+ state: "disabled",
2336
+ solid,
2337
+ muted
2338
+ }),
2339
+ hovered: opts.card({
2340
+ base,
2341
+ dark,
2342
+ name,
2343
+ state: "hovered",
2344
+ solid,
2345
+ muted
2346
+ }),
2347
+ pressed: opts.card({
2348
+ base,
2349
+ dark,
2350
+ name,
2351
+ state: "pressed",
2352
+ solid,
2353
+ muted
2354
+ }),
2355
+ selected: opts.card({
2356
+ base,
2357
+ dark,
2358
+ name,
2359
+ state: "selected",
2360
+ solid,
2361
+ muted
2362
+ })
2363
+ };
2364
+ }
2365
+ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
2366
+ default: {
2367
+ lightest: "hsl(0, 0%, 95%)",
2368
+ lighter: "hsl(0, 0%, 70%)",
2369
+ light: "hsl(0, 0%, 65%)",
2370
+ base: "hsl(0, 0%, 50%)",
2371
+ dark: "hsl(0, 0%, 35%)",
2372
+ darker: "hsl(0, 0%, 20%)",
2373
+ darkest: "hsl(0, 0%, 5%)"
2374
+ },
2375
+ transparent: {
2376
+ lightest: "hsl(240, 100%, 95%)",
2377
+ lighter: "hsl(240, 100%, 70%)",
2378
+ light: "hsl(240, 100%, 65%)",
2379
+ base: "hsl(240, 100%, 50%)",
2380
+ dark: "hsl(240, 100%, 35%)",
2381
+ darker: "hsl(240, 100%, 20%)",
2382
+ darkest: "hsl(240, 100%, 5%)"
2383
+ },
2384
+ primary: {
2385
+ lightest: "hsl(240, 100%, 95%)",
2386
+ lighter: "hsl(240, 100%, 70%)",
2387
+ light: "hsl(240, 100%, 65%)",
2388
+ base: "hsl(240, 100%, 50%)",
2389
+ dark: "hsl(240, 100%, 35%)",
2390
+ darker: "hsl(240, 100%, 20%)",
2391
+ darkest: "hsl(240, 100%, 5%)"
2392
+ },
2393
+ positive: {
2394
+ lightest: "hsl(120, 100%, 95%)",
2395
+ lighter: "hsl(120, 100%, 70%)",
2396
+ light: "hsl(120, 100%, 65%)",
2397
+ base: "hsl(120, 100%, 50%)",
2398
+ dark: "hsl(120, 100%, 35%)",
2399
+ darker: "hsl(120, 100%, 20%)",
2400
+ darkest: "hsl(120, 100%, 5%)"
2401
+ },
2402
+ caution: {
2403
+ lightest: "hsl(60, 100%, 95%)",
2404
+ lighter: "hsl(60, 100%, 70%)",
2405
+ light: "hsl(60, 100%, 65%)",
2406
+ base: "hsl(60, 100%, 50%)",
2407
+ dark: "hsl(60, 100%, 35%)",
2408
+ darker: "hsl(60, 100%, 20%)",
2409
+ darkest: "hsl(60, 100%, 5%)"
2410
+ },
2411
+ critical: {
2412
+ lightest: "hsl(0, 100%, 95%)",
2413
+ lighter: "hsl(0, 100%, 70%)",
2414
+ light: "hsl(0, 100%, 65%)",
2415
+ base: "hsl(0, 100%, 50%)",
2416
+ dark: "hsl(0, 100%, 35%)",
2417
+ darker: "hsl(0, 100%, 20%)",
2418
+ darkest: "hsl(0, 100%, 5%)"
2419
+ }
2420
+ }, spots = {
2421
+ gray: "hsl(0, 0%, 50%)",
2422
+ red: "hsl(0, 100%, 50%)",
2423
+ orange: "hsl(30, 100%, 50%)",
2424
+ yellow: "hsl(60, 100%, 50%)",
2425
+ green: "hsl(120, 100%, 50%)",
2426
+ cyan: "hsl(180, 100%, 50%)",
2427
+ blue: "hsl(240, 100%, 50%)",
2428
+ purple: "hsl(270, 100%, 50%)",
2429
+ magenta: "hsl(300, 100%, 50%)"
2430
+ }, tones = {
2431
+ transparent: {
2432
+ bg: [colors.transparent.darkest, colors.transparent.lightest],
2433
+ fg: [colors.transparent.lightest, colors.transparent.darkest],
2434
+ border: [colors.transparent.darker, colors.transparent.lighter],
2435
+ focusRing: [colors.transparent.base, colors.transparent.base]
2436
+ },
2437
+ primary: {
2438
+ bg: [colors.primary.darkest, colors.primary.lightest],
2439
+ fg: [colors.primary.lightest, colors.primary.darkest],
2440
+ border: [colors.primary.darker, colors.primary.lighter],
2441
+ focusRing: [colors.primary.base, colors.primary.base]
2442
+ },
2443
+ positive: {
2444
+ bg: [colors.positive.darkest, colors.positive.lightest],
2445
+ fg: [colors.positive.lightest, colors.positive.darkest],
2446
+ border: [colors.positive.darker, colors.positive.lighter],
2447
+ focusRing: [colors.positive.base, colors.positive.base]
2448
+ },
2449
+ caution: {
2450
+ bg: [colors.caution.darkest, colors.caution.lightest],
2451
+ fg: [colors.caution.lightest, colors.caution.darkest],
2452
+ border: [colors.caution.darker, colors.caution.lighter],
2453
+ focusRing: [colors.caution.base, colors.caution.base]
2454
+ },
2455
+ critical: {
2456
+ bg: [colors.critical.darkest, colors.critical.lightest],
2457
+ fg: [colors.critical.lightest, colors.critical.darkest],
2458
+ border: [colors.critical.darker, colors.critical.lighter],
2459
+ focusRing: [colors.critical.base, colors.critical.base]
2460
+ }
2461
+ }, defaultOpts = {
2462
+ base: ({ dark, name }) => name === "default" ? {
2463
+ bg: dark ? black : white,
2464
+ fg: dark ? white : black,
2465
+ border: dark ? colors.default.darkest : colors.default.lightest,
2466
+ focusRing: colors.primary.base,
2467
+ shadow: {
2468
+ outline: black,
2469
+ umbra: black,
2470
+ penumbra: black,
2471
+ ambient: black
2472
+ },
2473
+ skeleton: {
2474
+ from: dark ? white : black,
2475
+ to: dark ? white : black
2476
+ }
2477
+ } : {
2478
+ bg: tones[name].bg[+!dark],
2479
+ fg: tones[name].fg[+!dark],
2480
+ border: tones[name].border[+!dark],
2481
+ focusRing: tones[name].focusRing[+!dark],
2482
+ shadow: {
2483
+ outline: black,
2484
+ umbra: black,
2485
+ penumbra: black,
2486
+ ambient: black
2487
+ },
2488
+ skeleton: {
2489
+ from: dark ? white : black,
2490
+ to: dark ? white : black
2491
+ }
2492
+ },
2493
+ solid: ({ base, dark, state, tone }) => {
2494
+ let color = colors[tone];
2495
+ return state === "hovered" ? {
2496
+ bg: dark ? color.light : color.dark,
2497
+ bg2: dark ? color.light : color.dark,
2498
+ border: dark ? color.lighter : color.darker,
2499
+ fg: dark ? color.darkest : color.lightest,
2500
+ icon: dark ? color.darkest : color.lightest,
2501
+ muted: { fg: black },
2502
+ accent: { fg: black },
2503
+ link: { fg: black },
2504
+ code: {
2505
+ bg: black,
2506
+ fg: black
2507
+ },
2508
+ skeleton: base.skeleton
2509
+ } : {
2510
+ bg: color.base,
2511
+ bg2: color.base,
2512
+ border: dark ? color.light : color.dark,
2513
+ fg: dark ? color.darkest : color.lightest,
2514
+ icon: dark ? color.darkest : color.lightest,
2515
+ muted: { fg: black },
2516
+ accent: { fg: black },
2517
+ link: { fg: black },
2518
+ code: {
2519
+ bg: black,
2520
+ fg: black
2521
+ },
2522
+ skeleton: base.skeleton
2523
+ };
2524
+ },
2525
+ muted: ({ base, dark, state, tone }) => {
2526
+ let color = colors[tone];
2527
+ return state === "hovered" ? {
2528
+ bg: dark ? color.darker : color.lighter,
2529
+ bg2: dark ? color.darker : color.lighter,
2530
+ border: dark ? color.lighter : color.darker,
2531
+ fg: dark ? color.lightest : color.darkest,
2532
+ icon: dark ? color.lightest : color.darkest,
2533
+ muted: { fg: black },
2534
+ accent: { fg: black },
2535
+ link: { fg: black },
2536
+ code: {
2537
+ bg: black,
2538
+ fg: black
2539
+ },
2540
+ skeleton: base.skeleton
2541
+ } : {
2542
+ bg: dark ? color.darkest : color.lightest,
2543
+ bg2: dark ? color.darkest : color.lightest,
2544
+ border: dark ? color.darker : color.lighter,
2545
+ fg: dark ? color.lighter : color.darker,
2546
+ icon: dark ? color.lighter : color.darker,
2547
+ muted: { fg: black },
2548
+ accent: { fg: black },
2549
+ link: { fg: black },
2550
+ code: {
2551
+ bg: black,
2552
+ fg: black
2553
+ },
2554
+ skeleton: base.skeleton
2555
+ };
2556
+ },
2557
+ button: ({ base, mode, muted, solid }) => mode === "bleed" ? {
2558
+ ...muted,
2559
+ enabled: {
2560
+ bg: "transparent",
2561
+ bg2: "transparent",
2562
+ fg: muted.enabled.fg,
2563
+ icon: muted.enabled.fg,
2564
+ border: "transparent",
2565
+ muted: { fg: black },
2566
+ accent: { fg: black },
2567
+ link: { fg: black },
2568
+ code: {
2569
+ bg: black,
2570
+ fg: black
2571
+ },
2572
+ skeleton: base.skeleton
2573
+ },
2574
+ hovered: {
2575
+ bg: muted.enabled.bg,
2576
+ bg2: muted.enabled.bg,
2577
+ fg: muted.hovered.fg,
2578
+ icon: muted.hovered.fg,
2579
+ border: "transparent",
2580
+ muted: { fg: black },
2581
+ accent: { fg: black },
2582
+ link: { fg: black },
2583
+ code: {
2584
+ bg: black,
2585
+ fg: black
2586
+ },
2587
+ skeleton: base.skeleton
2588
+ }
2589
+ } : mode === "ghost" ? {
2590
+ ...solid,
2591
+ enabled: muted.enabled
2592
+ } : solid,
2593
+ card: ({ base }) => ({
2594
+ bg: black,
2595
+ bg2: black,
2596
+ fg: black,
2597
+ icon: black,
2598
+ border: black,
2599
+ muted: { fg: black },
2600
+ accent: { fg: black },
2601
+ link: { fg: black },
2602
+ code: {
2603
+ bg: black,
2604
+ fg: black
2605
+ },
2606
+ skeleton: base.skeleton
2607
+ }),
2608
+ input: () => ({
2609
+ bg: black,
2610
+ bg2: black,
2611
+ fg: black,
2612
+ border: black,
2613
+ placeholder: black
2614
+ }),
2615
+ selectable: ({ muted, state, tone }) => muted[tone][state],
2616
+ spot: ({ key }) => spots[key],
2617
+ syntax: () => ({
2618
+ atrule: black,
2619
+ attrName: black,
2620
+ attrValue: black,
2621
+ attribute: black,
2622
+ boolean: black,
2623
+ builtin: black,
2624
+ cdata: black,
2625
+ char: black,
2626
+ class: black,
2627
+ className: black,
2628
+ comment: black,
2629
+ constant: black,
2630
+ deleted: black,
2631
+ doctype: black,
2632
+ entity: black,
2633
+ function: black,
2634
+ hexcode: black,
2635
+ id: black,
2636
+ important: black,
2637
+ inserted: black,
2638
+ keyword: black,
2639
+ number: black,
2640
+ operator: black,
2641
+ prolog: black,
2642
+ property: black,
2643
+ pseudoClass: black,
2644
+ pseudoElement: black,
2645
+ punctuation: black,
2646
+ regex: black,
2647
+ selector: black,
2648
+ string: black,
2649
+ symbol: black,
2650
+ tag: black,
2651
+ unit: black,
2652
+ url: black,
2653
+ variable: black
2654
+ })
2655
+ };
2656
+ function createInputModes(opts, base, dark, solid, muted) {
2657
+ return {
2658
+ default: {
2659
+ enabled: opts.input({
2660
+ base,
2661
+ dark,
2662
+ mode: "default",
2663
+ state: "enabled",
2664
+ solid: solid.default,
2665
+ muted: muted.default
2666
+ }),
2667
+ disabled: opts.input({
2668
+ base,
2669
+ dark,
2670
+ mode: "default",
2671
+ state: "disabled",
2672
+ solid: solid.default,
2673
+ muted: muted.default
2674
+ }),
2675
+ hovered: opts.input({
2676
+ base,
2677
+ dark,
2678
+ mode: "default",
2679
+ state: "hovered",
2680
+ solid: solid.default,
2681
+ muted: muted.default
2682
+ }),
2683
+ readOnly: opts.input({
2684
+ base,
2685
+ dark,
2686
+ mode: "default",
2687
+ state: "readOnly",
2688
+ solid: solid.default,
2689
+ muted: muted.default
2690
+ })
2691
+ },
2692
+ invalid: {
2693
+ enabled: opts.input({
2694
+ base,
2695
+ dark,
2696
+ mode: "invalid",
2697
+ state: "enabled",
2698
+ solid: solid.default,
2699
+ muted: muted.default
2700
+ }),
2701
+ disabled: opts.input({
2702
+ base,
2703
+ dark,
2704
+ mode: "invalid",
2705
+ state: "disabled",
2706
+ solid: solid.default,
2707
+ muted: muted.default
2708
+ }),
2709
+ hovered: opts.input({
2710
+ base,
2711
+ dark,
2712
+ mode: "invalid",
2713
+ state: "hovered",
2714
+ solid: solid.default,
2715
+ muted: muted.default
2716
+ }),
2717
+ readOnly: opts.input({
2718
+ base,
2719
+ dark,
2720
+ mode: "invalid",
2721
+ state: "readOnly",
2722
+ solid: solid.default,
2723
+ muted: muted.default
2724
+ })
2725
+ }
2726
+ };
2727
+ }
2728
+ function createMutedTones(opts, base, dark, name) {
2729
+ return {
2730
+ default: {
2731
+ enabled: opts.muted({
2732
+ base,
2733
+ dark,
2734
+ tone: "default",
2735
+ name,
2736
+ state: "enabled"
2737
+ }),
2738
+ disabled: opts.muted({
2739
+ base,
2740
+ dark,
2741
+ tone: "default",
2742
+ name,
2743
+ state: "disabled"
2744
+ }),
2745
+ hovered: opts.muted({
2746
+ base,
2747
+ dark,
2748
+ tone: "default",
2749
+ name,
2750
+ state: "hovered"
2751
+ }),
2752
+ pressed: opts.muted({
2753
+ base,
2754
+ dark,
2755
+ tone: "default",
2756
+ name,
2757
+ state: "pressed"
2758
+ }),
2759
+ selected: opts.muted({
2760
+ base,
2761
+ dark,
2762
+ tone: "default",
2763
+ name,
2764
+ state: "selected"
2765
+ })
2766
+ },
2767
+ transparent: {
2768
+ enabled: opts.muted({
2769
+ base,
2770
+ dark,
2771
+ tone: "transparent",
2772
+ name,
2773
+ state: "enabled"
2774
+ }),
2775
+ disabled: opts.muted({
2776
+ base,
2777
+ dark,
2778
+ tone: "transparent",
2779
+ name,
2780
+ state: "disabled"
2781
+ }),
2782
+ hovered: opts.muted({
2783
+ base,
2784
+ dark,
2785
+ tone: "transparent",
2786
+ name,
2787
+ state: "hovered"
2788
+ }),
2789
+ pressed: opts.muted({
2790
+ base,
2791
+ dark,
2792
+ tone: "transparent",
2793
+ name,
2794
+ state: "pressed"
2795
+ }),
2796
+ selected: opts.muted({
2797
+ base,
2798
+ dark,
2799
+ tone: "transparent",
2800
+ name,
2801
+ state: "selected"
2802
+ })
2803
+ },
2804
+ primary: {
2805
+ enabled: opts.muted({
2806
+ base,
2807
+ dark,
2808
+ tone: "primary",
2809
+ name,
2810
+ state: "enabled"
2811
+ }),
2812
+ disabled: opts.muted({
2813
+ base,
2814
+ dark,
2815
+ tone: "primary",
2816
+ name,
2817
+ state: "disabled"
2818
+ }),
2819
+ hovered: opts.muted({
2820
+ base,
2821
+ dark,
2822
+ tone: "primary",
2823
+ name,
2824
+ state: "hovered"
2825
+ }),
2826
+ pressed: opts.muted({
2827
+ base,
2828
+ dark,
2829
+ tone: "primary",
2830
+ name,
2831
+ state: "pressed"
2832
+ }),
2833
+ selected: opts.muted({
2834
+ base,
2835
+ dark,
2836
+ tone: "primary",
2837
+ name,
2838
+ state: "selected"
2839
+ })
2840
+ },
2841
+ positive: {
2842
+ enabled: opts.muted({
2843
+ base,
2844
+ dark,
2845
+ tone: "positive",
2846
+ name,
2847
+ state: "enabled"
2848
+ }),
2849
+ disabled: opts.muted({
2850
+ base,
2851
+ dark,
2852
+ tone: "positive",
2853
+ name,
2854
+ state: "disabled"
2855
+ }),
2856
+ hovered: opts.muted({
2857
+ base,
2858
+ dark,
2859
+ tone: "positive",
2860
+ name,
2861
+ state: "hovered"
2862
+ }),
2863
+ pressed: opts.muted({
2864
+ base,
2865
+ dark,
2866
+ tone: "positive",
2867
+ name,
2868
+ state: "pressed"
2869
+ }),
2870
+ selected: opts.muted({
2871
+ base,
2872
+ dark,
2873
+ tone: "positive",
2874
+ name,
2875
+ state: "selected"
2876
+ })
2877
+ },
2878
+ caution: {
2879
+ enabled: opts.muted({
2880
+ base,
2881
+ dark,
2882
+ tone: "caution",
2883
+ name,
2884
+ state: "enabled"
2885
+ }),
2886
+ disabled: opts.muted({
2887
+ base,
2888
+ dark,
2889
+ tone: "caution",
2890
+ name,
2891
+ state: "disabled"
2892
+ }),
2893
+ hovered: opts.muted({
2894
+ base,
2895
+ dark,
2896
+ tone: "caution",
2897
+ name,
2898
+ state: "hovered"
2899
+ }),
2900
+ pressed: opts.muted({
2901
+ base,
2902
+ dark,
2903
+ tone: "caution",
2904
+ name,
2905
+ state: "pressed"
2906
+ }),
2907
+ selected: opts.muted({
2908
+ base,
2909
+ dark,
2910
+ tone: "caution",
2911
+ name,
2912
+ state: "selected"
2913
+ })
2914
+ },
2915
+ critical: {
2916
+ enabled: opts.muted({
2917
+ base,
2918
+ dark,
2919
+ tone: "critical",
2920
+ name,
2921
+ state: "enabled"
2922
+ }),
2923
+ disabled: opts.muted({
2924
+ base,
2925
+ dark,
2926
+ tone: "critical",
2927
+ name,
2928
+ state: "disabled"
2929
+ }),
2930
+ hovered: opts.muted({
2931
+ base,
2932
+ dark,
2933
+ tone: "critical",
2934
+ name,
2935
+ state: "hovered"
2936
+ }),
2937
+ pressed: opts.muted({
2938
+ base,
2939
+ dark,
2940
+ tone: "critical",
2941
+ name,
2942
+ state: "pressed"
2943
+ }),
2944
+ selected: opts.muted({
2945
+ base,
2946
+ dark,
2947
+ tone: "critical",
2948
+ name,
2949
+ state: "selected"
2950
+ })
2951
+ }
2952
+ };
2953
+ }
2954
+ function createSpot(opts, base, dark) {
2955
+ return {
2956
+ gray: opts.spot({
2957
+ base,
2958
+ dark,
2959
+ key: "gray"
2960
+ }),
2961
+ blue: opts.spot({
2962
+ base,
2963
+ dark,
2964
+ key: "blue"
2965
+ }),
2966
+ purple: opts.spot({
2967
+ base,
2968
+ dark,
2969
+ key: "purple"
2970
+ }),
2971
+ magenta: opts.spot({
2972
+ base,
2973
+ dark,
2974
+ key: "magenta"
2975
+ }),
2976
+ red: opts.spot({
2977
+ base,
2978
+ dark,
2979
+ key: "red"
2980
+ }),
2981
+ orange: opts.spot({
2982
+ base,
2983
+ dark,
2984
+ key: "orange"
2985
+ }),
2986
+ yellow: opts.spot({
2987
+ base,
2988
+ dark,
2989
+ key: "yellow"
2990
+ }),
2991
+ green: opts.spot({
2992
+ base,
2993
+ dark,
2994
+ key: "green"
2995
+ }),
2996
+ cyan: opts.spot({
2997
+ base,
2998
+ dark,
2999
+ key: "cyan"
3000
+ })
3001
+ };
3002
+ }
3003
+ /**
3004
+ * @public
3005
+ * @deprecated Use `buildColorTheme` instead.
3006
+ */
3007
+ function createColorTheme(partialOpts = {}) {
3008
+ let builders = {
3009
+ ...defaultOpts,
3010
+ ...partialOpts
3011
+ };
3012
+ return {
3013
+ light: _createColorScheme(builders, !1),
3014
+ dark: _createColorScheme(builders, !0)
3015
+ };
3016
+ }
3017
+ /**
3018
+ * @internal
3019
+ */
3020
+ function _createColorScheme(opts, dark) {
3021
+ return {
3022
+ default: _createColor(opts, dark, "default"),
3023
+ transparent: _createColor(opts, dark, "transparent"),
3024
+ primary: _createColor(opts, dark, "primary"),
3025
+ positive: _createColor(opts, dark, "positive"),
3026
+ caution: _createColor(opts, dark, "caution"),
3027
+ critical: _createColor(opts, dark, "critical")
3028
+ };
3029
+ }
3030
+ /**
3031
+ * @internal
3032
+ */
3033
+ function _createColor(opts, dark, name) {
3034
+ let base = opts.base({
3035
+ dark,
3036
+ name
3037
+ }), solid = createSolidTones(opts, base, dark, name), muted = createMutedTones(opts, base, dark, name);
3038
+ return {
3039
+ base,
3040
+ button: createButtonModes(opts, base, dark, solid, muted),
3041
+ card: createCardStates(opts, base, dark, name, solid, muted),
3042
+ dark,
3043
+ input: createInputModes(opts, base, dark, solid, muted),
3044
+ selectable: createSelectableTones(opts, base, dark, solid, muted),
3045
+ spot: createSpot(opts, base, dark),
3046
+ syntax: opts.syntax({
3047
+ base,
3048
+ dark
3049
+ }),
3050
+ solid,
3051
+ muted
3052
+ };
3053
+ }
3054
+ export { COLOR_CONFIG_STATE_TONES as A, THEME_COLOR_INPUT_STATES as B, COLOR_CONFIG_BLEND_KEYS as C, COLOR_CONFIG_INPUT_STATES as D, COLOR_CONFIG_INPUT_MODES as E, THEME_COLOR_AVATAR_COLORS as F, THEME_COLOR_STATES as H, THEME_COLOR_BLEND_MODES as I, THEME_COLOR_BUTTON_MODES as L, isColorButtonMode as M, isColorHueKey as N, COLOR_CONFIG_STATES as O, isColorTintKey as P, THEME_COLOR_CARD_TONES as R, COLOR_CONFIG_AVATAR_COLORS as S, COLOR_CONFIG_CARD_TONES as T, THEME_COLOR_STATE_TONES as U, THEME_COLOR_SCHEMES as V, isColorConfigStateKey as _, rgba as a, isColorTokenValue as b, hslToRgb as c, rgbaToRGBA as d, mix as f, isColorConfigBlendKey as g, isColorConfigBaseTone as h, multiply as i, isColorBlendModeValue as j, COLOR_CONFIG_STATE_KEYS as k, rgbToHex as l, isColorConfigBaseKey as m, buildTheme as n, parseColor as o, parseTokenValue as p, screen as r, hexToRgb as s, createColorTheme as t, rgbToHsl as u, isColorConfigStateTone as v, COLOR_CONFIG_CARD_KEYS as w, isColorValue as x, isColorOpacityValue as y, THEME_COLOR_INPUT_MODES as z };
3055
+
3056
+ //# sourceMappingURL=factory-BA3gEfyI.js.map