@sanity/ui 2.0.0-alpha.3 → 2.0.0-alpha.31

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