@sanity/ui 2.0.0-alpha.9 → 2.0.0-beta.2

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