@sanity/ui 2.0.0-alpha.8 → 2.0.0-beta.1

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