@sanity/ui 2.0.0-alpha.26 → 2.0.0-alpha.28

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