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