@sanity/ui 3.0.0-static.0 → 3.0.0-static.10

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 (1235) hide show
  1. package/LICENSE +1 -1
  2. package/bin/ui.js +0 -1
  3. package/dist/_chunks-cjs/_visual-editing.js +3138 -0
  4. package/dist/_chunks-cjs/_visual-editing.js.map +1 -0
  5. package/dist/_chunks-cjs/buildCommand.js +17 -2821
  6. package/dist/_chunks-cjs/buildCommand.js.map +1 -1
  7. package/dist/_chunks-cjs/refractor.js +27 -0
  8. package/dist/_chunks-cjs/refractor.js.map +1 -0
  9. package/dist/_chunks-es/_visual-editing.mjs +3145 -0
  10. package/dist/_chunks-es/_visual-editing.mjs.map +1 -0
  11. package/dist/_chunks-es/refractor.mjs +26 -0
  12. package/dist/_chunks-es/refractor.mjs.map +1 -0
  13. package/dist/_visual-editing.d.mts +811 -0
  14. package/dist/_visual-editing.d.ts +811 -0
  15. package/dist/_visual-editing.js +31 -0
  16. package/dist/_visual-editing.js.map +1 -0
  17. package/dist/_visual-editing.mjs +31 -0
  18. package/dist/_visual-editing.mjs.map +1 -0
  19. package/dist/cli.js +340 -6
  20. package/dist/cli.js.map +1 -1
  21. package/dist/css.d.mts +970 -440
  22. package/dist/css.d.ts +970 -440
  23. package/dist/css.js +4257 -2514
  24. package/dist/css.js.map +1 -1
  25. package/dist/css.mjs +4259 -2515
  26. package/dist/css.mjs.map +1 -1
  27. package/dist/index.d.mts +499 -561
  28. package/dist/index.d.ts +499 -561
  29. package/dist/index.js +1160 -5463
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +1089 -5401
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/sanity-palette.css +1 -0
  34. package/dist/sanity-theme.css +1 -25
  35. package/dist/system.css +23226 -2941
  36. package/dist/theme.d.mts +399 -112
  37. package/dist/theme.d.ts +399 -112
  38. package/dist/theme.js +2174 -2060
  39. package/dist/theme.js.map +1 -1
  40. package/dist/theme.mjs +2207 -2095
  41. package/dist/theme.mjs.map +1 -1
  42. package/exports/_visual-editing.ts +31 -0
  43. package/exports/index.ts +1 -1
  44. package/package.json +96 -85
  45. package/src/cli/buildCommand.ts +48 -0
  46. package/src/cli/index.ts +38 -0
  47. package/src/css/_comp.test.ts +7 -0
  48. package/src/css/_comp.ts +11 -0
  49. package/src/css/_mergeStyles.ts +31 -0
  50. package/src/css/_resp.ts +16 -6
  51. package/src/css/_responsiveRule.ts +38 -0
  52. package/src/css/aspects/border/border.style.ts +13 -0
  53. package/src/css/aspects/border/border.ts +14 -0
  54. package/src/css/aspects/display/display.style.ts +34 -0
  55. package/src/css/aspects/display/display.ts +7 -0
  56. package/src/css/aspects/display/index.ts +2 -0
  57. package/src/css/aspects/display/types.ts +17 -0
  58. package/src/css/aspects/flex/flex.style.ts +30 -0
  59. package/src/css/aspects/flex/flex.ts +13 -0
  60. package/src/css/aspects/flex/flexAlign.style.ts +12 -0
  61. package/src/css/aspects/flex/flexDirection.style.ts +11 -0
  62. package/src/css/aspects/flex/flexJustify.style.ts +13 -0
  63. package/src/css/aspects/flex/flexWrap.style.ts +10 -0
  64. package/src/css/aspects/flexItem/flex.style.ts +22 -0
  65. package/src/css/aspects/flexItem/flexItem.ts +8 -0
  66. package/src/css/aspects/flexItem/types.ts +27 -0
  67. package/src/css/aspects/font/font.style.ts +151 -0
  68. package/src/css/aspects/font/font.ts +12 -0
  69. package/src/css/aspects/font/types.ts +12 -0
  70. package/src/css/aspects/gap/gap.style.ts +21 -0
  71. package/src/css/aspects/gap/gap.ts +8 -0
  72. package/src/css/aspects/gap/types.ts +10 -0
  73. package/src/css/aspects/grid/grid.ts +13 -0
  74. package/src/css/aspects/grid/gridAutoColumns.style.ts +11 -0
  75. package/src/css/aspects/grid/gridAutoFlow.style.ts +11 -0
  76. package/src/css/aspects/grid/gridAutoRows.style.ts +11 -0
  77. package/src/css/aspects/grid/gridColumns.style.ts +18 -0
  78. package/src/css/aspects/grid/gridRows.style.ts +18 -0
  79. package/src/css/aspects/grid/index.ts +2 -0
  80. package/src/css/aspects/grid/types.ts +29 -0
  81. package/src/css/aspects/gridItem/gridColumn.style.ts +20 -0
  82. package/src/css/aspects/gridItem/gridColumnEnd.style.ts +20 -0
  83. package/src/css/aspects/gridItem/gridColumnStart.style.ts +20 -0
  84. package/src/css/aspects/gridItem/gridItem.ts +15 -0
  85. package/src/css/aspects/gridItem/gridRow.style.ts +20 -0
  86. package/src/css/aspects/gridItem/gridRowEnd.style.ts +20 -0
  87. package/src/css/aspects/gridItem/gridRowStart.style.ts +20 -0
  88. package/src/css/aspects/height/height.style.ts +9 -0
  89. package/src/css/aspects/height/height.ts +17 -0
  90. package/src/css/aspects/height/index.ts +1 -0
  91. package/src/css/aspects/index.ts +21 -0
  92. package/src/css/aspects/inset/index.ts +2 -0
  93. package/src/css/aspects/inset/inset.style.ts +12 -0
  94. package/src/css/aspects/inset/inset.ts +13 -0
  95. package/src/css/aspects/inset/types.ts +13 -0
  96. package/src/css/aspects/margin/margin.style.ts +46 -0
  97. package/src/css/aspects/margin/margin.ts +15 -0
  98. package/src/css/aspects/maxWidth/maxWidth.style.ts +16 -0
  99. package/src/css/aspects/maxWidth/types.ts +7 -0
  100. package/src/css/aspects/minWidth/index.ts +2 -0
  101. package/src/css/aspects/minWidth/minWidth.style.ts +13 -0
  102. package/src/css/aspects/minWidth/minWidth.ts +6 -0
  103. package/src/css/aspects/minWidth/types.ts +7 -0
  104. package/src/css/aspects/outline/outline.style.ts +9 -0
  105. package/src/css/aspects/overflow/index.ts +2 -0
  106. package/src/css/aspects/overflow/overflow.style.ts +11 -0
  107. package/src/css/aspects/overflow/overflow.ts +11 -0
  108. package/src/css/aspects/overflow/types.ts +11 -0
  109. package/src/css/aspects/padding/padding.style.ts +46 -0
  110. package/src/css/aspects/padding/padding.ts +15 -0
  111. package/src/css/aspects/padding/types.ts +14 -0
  112. package/src/css/aspects/pointerEvents/pointerEvents.style.ts +13 -0
  113. package/src/css/aspects/pointerEvents/pointerEvents.ts +6 -0
  114. package/src/css/aspects/position/position.style.ts +12 -0
  115. package/src/css/aspects/position/position.ts +7 -0
  116. package/src/css/aspects/position/types.ts +9 -0
  117. package/src/css/aspects/radius/radius.style.ts +16 -0
  118. package/src/css/aspects/radius/radius.ts +8 -0
  119. package/src/css/aspects/radius/types.ts +8 -0
  120. package/src/css/aspects/shadow/index.ts +2 -0
  121. package/src/css/aspects/shadow/shadow.style.ts +49 -0
  122. package/src/css/aspects/shadow/shadow.ts +7 -0
  123. package/src/css/aspects/shadow/types.ts +8 -0
  124. package/src/css/aspects/textOverflow/index.ts +2 -0
  125. package/src/css/aspects/textOverflow/textOverflow.style.ts +21 -0
  126. package/src/css/aspects/textOverflow/textOverflow.ts +6 -0
  127. package/src/css/aspects/textOverflow/types.ts +8 -0
  128. package/src/css/aspects/width/index.ts +2 -0
  129. package/src/css/aspects/width/rules.ts +8 -0
  130. package/src/css/aspects/width/types.ts +9 -0
  131. package/src/css/aspects/width/width.style.ts +11 -0
  132. package/src/css/compile/compilePalette.ts +27 -0
  133. package/src/css/compile/compileRule.ts +50 -11
  134. package/src/css/compile/compileRules.test.ts +36 -0
  135. package/src/css/compile/compileRules.ts +43 -0
  136. package/src/css/compile/compileStyle.ts +148 -0
  137. package/src/css/compile/compileSystem.ts +6 -3
  138. package/src/css/compile/compileTheme.ts +8 -502
  139. package/src/css/compile/compileTheme_v3.ts +401 -0
  140. package/src/css/compile/types.ts +6 -0
  141. package/src/css/components/breadcrumbs/breadcrumbs.style.ts +9 -0
  142. package/src/css/components/breadcrumbs/breadcrumbs.ts +3 -3
  143. package/src/css/components/breadcrumbs/rules.ts +18 -0
  144. package/src/css/components/dialog/dialog.style.ts +79 -0
  145. package/src/css/components/dialog/dialog.ts +30 -0
  146. package/src/css/components/dialog/index.ts +1 -1
  147. package/src/css/components/dialog/rules.ts +4 -1
  148. package/src/css/components/menu/index.ts +1 -0
  149. package/src/css/components/menu/menu.style.ts +17 -0
  150. package/src/css/components/menu/menu.ts +9 -0
  151. package/src/css/components/menu/rules.ts +15 -0
  152. package/src/css/components/skeleton/index.ts +2 -0
  153. package/src/css/components/skeleton/rules.ts +113 -0
  154. package/src/css/components/skeleton/skeleton.style.ts +96 -0
  155. package/src/css/components/skeleton/skeleton.ts +31 -0
  156. package/src/css/components/skeleton/types.ts +26 -0
  157. package/src/css/components/toast/index.ts +1 -0
  158. package/src/css/components/toast/rules.ts +18 -0
  159. package/src/css/components/toast/toast.style.ts +20 -0
  160. package/src/css/components/toast/toast.ts +21 -0
  161. package/src/css/components/tree/rules.ts +118 -2
  162. package/src/css/components/tree/tree.style.ts +55 -0
  163. package/src/css/components/tree/tree.ts +3 -3
  164. package/src/css/composeClassNames.ts +16 -2
  165. package/src/css/constants.ts +1 -0
  166. package/src/css/index.ts +15 -21
  167. package/src/css/primitives/_arrow/_arrow.style.ts +73 -0
  168. package/src/css/primitives/_arrow/_arrow.ts +14 -0
  169. package/src/css/primitives/_arrow/index.ts +1 -0
  170. package/src/css/primitives/_input/__workshop__/customInput.tsx +16 -0
  171. package/src/css/primitives/_input/__workshop__/index.ts +14 -0
  172. package/src/css/primitives/_input/_input.style.ts +162 -0
  173. package/src/css/primitives/_input/index.ts +2 -0
  174. package/src/css/primitives/_input/input.ts +25 -0
  175. package/src/css/primitives/_input/types.ts +12 -0
  176. package/src/css/primitives/_selectable/__style.ts +117 -0
  177. package/src/css/primitives/_selectable/_contants.ts +11 -0
  178. package/src/css/primitives/_selectable/_selectable.style.ts +132 -0
  179. package/src/css/primitives/_selectable/selectable.ts +9 -0
  180. package/src/css/primitives/_selectable/types.ts +8 -0
  181. package/src/css/primitives/avatar/avatar.style.ts +175 -0
  182. package/src/css/primitives/avatar/avatar.ts +13 -18
  183. package/src/css/primitives/avatar/rules.ts +85 -99
  184. package/src/css/primitives/avatar/types.ts +1 -2
  185. package/src/css/primitives/badge/badge.style.ts +22 -0
  186. package/src/css/primitives/badge/badge.ts +4 -4
  187. package/src/css/primitives/badge/types.ts +2 -2
  188. package/src/css/primitives/box/box.style.ts +31 -0
  189. package/src/css/primitives/box/box.ts +34 -16
  190. package/src/css/primitives/box/types.ts +31 -29
  191. package/src/css/primitives/button/_constants.ts +17 -0
  192. package/src/css/primitives/button/button.style.ts +201 -0
  193. package/src/css/primitives/button/button.ts +29 -14
  194. package/src/css/primitives/button/rules.ts +284 -40
  195. package/src/css/primitives/card/_constants.ts +13 -0
  196. package/src/css/primitives/card/card.style.ts +270 -0
  197. package/src/css/primitives/card/card.ts +9 -16
  198. package/src/css/primitives/card/index.ts +1 -0
  199. package/src/css/primitives/card/types.ts +10 -0
  200. package/src/css/primitives/checkbox/__styles.ts +115 -113
  201. package/src/css/primitives/checkbox/checkbox.style.ts +154 -0
  202. package/src/css/primitives/checkbox/checkbox.ts +5 -5
  203. package/src/css/primitives/checkbox/rules.ts +31 -15
  204. package/src/css/primitives/code/code.style.ts +62 -0
  205. package/src/css/primitives/code/code.ts +4 -4
  206. package/src/css/primitives/code/rules.ts +27 -2
  207. package/src/css/primitives/code/types.ts +1 -1
  208. package/src/css/primitives/container/container.style.ts +10 -0
  209. package/src/css/primitives/container/container.ts +4 -4
  210. package/src/css/primitives/container/types.ts +1 -0
  211. package/src/css/primitives/heading/heading.style.ts +47 -0
  212. package/src/css/primitives/heading/heading.ts +6 -5
  213. package/src/css/primitives/heading/rules.ts +77 -6
  214. package/src/css/primitives/heading/types.ts +2 -2
  215. package/src/css/primitives/kbd/kbd.style.ts +22 -0
  216. package/src/css/primitives/kbd/kbd.ts +4 -4
  217. package/src/css/primitives/kbd/rules.ts +5 -5
  218. package/src/css/primitives/kbd/types.ts +3 -1
  219. package/src/css/primitives/label/label.style.ts +48 -0
  220. package/src/css/primitives/label/label.ts +4 -4
  221. package/src/css/primitives/label/rules.ts +54 -2
  222. package/src/css/primitives/label/types.ts +1 -1
  223. package/src/css/primitives/popover/popover.style.ts +5 -0
  224. package/src/css/primitives/popover/popover.ts +7 -3
  225. package/src/css/primitives/radio/radio.style.ts +123 -0
  226. package/src/css/primitives/radio/radio.ts +3 -3
  227. package/src/css/primitives/radio/rules.ts +117 -1
  228. package/src/css/primitives/select/index.ts +1 -0
  229. package/src/css/primitives/select/rules.ts +18 -1
  230. package/src/css/primitives/select/select.style.ts +24 -0
  231. package/src/css/primitives/select/select.ts +9 -2
  232. package/src/css/primitives/select/types.ts +5 -0
  233. package/src/css/primitives/spinner/rules.ts +6 -7
  234. package/src/css/primitives/spinner/spinner.style.ts +22 -0
  235. package/src/css/primitives/spinner/spinner.ts +7 -3
  236. package/src/css/primitives/stack/stack.style.ts +9 -0
  237. package/src/css/primitives/stack/stack.ts +6 -0
  238. package/src/css/primitives/switch/rules.ts +264 -56
  239. package/src/css/primitives/switch/switch.style.ts +94 -0
  240. package/src/css/primitives/switch/switch.ts +19 -3
  241. package/src/css/primitives/text/rules.ts +93 -4
  242. package/src/css/primitives/text/text.style.ts +64 -0
  243. package/src/css/primitives/text/text.ts +5 -4
  244. package/src/css/primitives/text/types.ts +2 -2
  245. package/src/css/primitives/textArea/index.ts +1 -0
  246. package/src/css/primitives/textArea/rules.ts +3 -1
  247. package/src/css/primitives/textArea/textArea.style.ts +9 -0
  248. package/src/css/primitives/textArea/textArea.ts +5 -2
  249. package/src/css/primitives/textArea/types.ts +5 -0
  250. package/src/css/primitives/textInput/index.ts +1 -0
  251. package/src/css/primitives/textInput/rules.ts +94 -96
  252. package/src/css/primitives/textInput/textInput.style.ts +167 -0
  253. package/src/css/primitives/textInput/textInput.ts +5 -4
  254. package/src/css/primitives/textInput/types.ts +11 -0
  255. package/src/css/primitives/token/rules.ts +37 -37
  256. package/src/css/primitives/token/token.style.ts +49 -0
  257. package/src/css/primitives/tooltip/rules.ts +2 -0
  258. package/src/css/primitives/tooltip/tooltip.style.ts +21 -0
  259. package/src/css/primitives/tooltip/tooltip.ts +5 -5
  260. package/src/css/scopeClassName.ts +6 -0
  261. package/src/css/system.style.ts +158 -0
  262. package/src/css/types.ts +630 -369
  263. package/src/css/util.ts +27 -0
  264. package/src/css/utils/srOnly/srOnly.style.ts +14 -0
  265. package/src/css/utils/srOnly/srOnly.ts +5 -0
  266. package/src/css/varNames.ts +395 -256
  267. package/src/css/vars.ts +422 -246
  268. package/src/theme/_constants.ts +26 -0
  269. package/src/theme/_types.ts +41 -0
  270. package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +1 -1
  271. package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +1 -1
  272. package/src/theme/build/_deprecated/color/button/createButtonModes.ts +1 -6
  273. package/src/theme/build/_deprecated/color/button/createButtonTones.ts +2 -2
  274. package/src/theme/build/_deprecated/color/card/createCardStates.ts +2 -2
  275. package/src/theme/build/_deprecated/color/factory.ts +8 -9
  276. package/src/theme/build/_deprecated/color/input/createInputModes.ts +1 -1
  277. package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
  278. package/src/theme/build/_deprecated/color/spot/createSpot.ts +1 -1
  279. package/src/theme/build/buildColorTheme.ts +62 -52
  280. package/src/theme/build/buildTheme.ts +8 -32
  281. package/src/theme/build/colorToken/colorToken.ts +1 -1
  282. package/src/theme/build/lib/color-fns/rgba.ts +4 -0
  283. package/src/theme/build/merge.ts +0 -2
  284. package/src/theme/build/mixThemeColor.ts +1 -1
  285. package/src/theme/build/renderColorTheme.ts +34 -37
  286. package/src/theme/build/renderColorValue.ts +4 -3
  287. package/src/theme/build/resolveColorTokens.ts +57 -120
  288. package/src/theme/config/helpers.ts +2 -2
  289. package/src/theme/config/system.ts +3 -2
  290. package/src/theme/config/tokens/color/types.ts +5 -18
  291. package/src/theme/config/tokens/parseTokenKey.ts +1 -1
  292. package/src/theme/config/tokens/parseTokenValue.ts +1 -1
  293. package/src/theme/config/tokens/types.ts +3 -2
  294. package/src/theme/config/types.ts +4 -4
  295. package/src/theme/defaults/colorTokens.ts +8 -6
  296. package/src/theme/defaults/config.ts +2 -2
  297. package/src/theme/defaults/fonts.ts +17 -16
  298. package/src/theme/getScopedTheme.ts +10 -4
  299. package/src/theme/index.ts +7 -1
  300. package/src/theme/palette/constants.ts +13 -0
  301. package/src/theme/palette/index.ts +2 -0
  302. package/src/theme/palette/types.ts +4 -0
  303. package/src/theme/types.ts +32 -0
  304. package/src/theme/v0/color/_generic.ts +35 -0
  305. package/src/theme/v0/color/_system.ts +17 -0
  306. package/src/theme/v0/color/color.ts +40 -0
  307. package/src/theme/v0/color/index.ts +11 -0
  308. package/src/theme/v0/color/input.ts +34 -0
  309. package/src/theme/v0/color/spot.ts +13 -0
  310. package/src/theme/v0/css.ts +8 -0
  311. package/src/theme/v0/font.ts +53 -0
  312. package/src/theme/v0/index.ts +10 -0
  313. package/src/theme/v0/theme.ts +72 -0
  314. package/src/theme/v2/avatar.ts +14 -0
  315. package/src/theme/v2/color/_constants.ts +45 -0
  316. package/src/theme/v2/color/_helpers.ts +24 -0
  317. package/src/theme/v2/color/_system.ts +40 -0
  318. package/src/theme/v2/color/badge.ts +16 -0
  319. package/src/theme/v2/color/color.ts +34 -0
  320. package/src/theme/v2/index.ts +4 -0
  321. package/src/theme/v2/input.ts +33 -0
  322. package/src/theme/v2/theme.ts +49 -0
  323. package/src/theme/v3/buildTheme_v3.test.ts +40 -0
  324. package/src/theme/v3/buildTheme_v3.ts +29 -0
  325. package/src/theme/v3/color/buildColor_v3.ts +198 -0
  326. package/src/theme/v3/color/card.ts +121 -0
  327. package/src/theme/v3/color/color.ts +98 -0
  328. package/src/theme/v3/color/element.ts +19 -0
  329. package/src/theme/v3/color/index.ts +7 -0
  330. package/src/theme/v3/color/parseColor.test.ts +79 -0
  331. package/src/theme/v3/color/parseColor.ts +167 -0
  332. package/src/theme/v3/color/renderColor.test.ts +19 -0
  333. package/src/theme/v3/color/renderColor.ts +33 -0
  334. package/src/theme/v3/color/token.ts +17 -0
  335. package/src/theme/v3/color/tokens.ts +5 -0
  336. package/src/theme/v3/defaults.ts +202 -0
  337. package/src/theme/v3/index.ts +6 -0
  338. package/src/theme/v3/merge.ts +22 -0
  339. package/src/theme/v3/resolveTokens.ts +204 -0
  340. package/src/theme/v3/tokens.ts +16 -0
  341. package/src/theme/v3/types.ts +45 -0
  342. package/src/theme/versioning/getTheme_v2.ts +2 -1
  343. package/src/theme/versioning/index.ts +0 -4
  344. package/src/theme/versioning/is_v0.ts +2 -1
  345. package/src/theme/versioning/is_v2.ts +2 -1
  346. package/src/theme/versioning/themeColor_v0_v2.ts +33 -5
  347. package/src/theme/versioning/themeColor_v2_v2_9.ts +49 -0
  348. package/src/theme/versioning/themeColor_v3_v2.ts +206 -0
  349. package/src/theme/versioning/v0_v2.ts +6 -1
  350. package/src/theme/versioning/v2_v0.ts +6 -6
  351. package/src/theme/versioning/v3_v2.ts +108 -0
  352. package/src/ui/StyleTags.tsx +24 -0
  353. package/src/ui/_compat/index.ts +9 -0
  354. package/src/ui/_compat/styles/_responsive.ts +19 -0
  355. package/src/ui/_compat/styles/index.ts +1 -0
  356. package/src/ui/_compat/theme/index.ts +5 -0
  357. package/src/ui/_compat/theme/theme.test.tsx +73 -0
  358. package/src/ui/_compat/theme/themeColorProvider.tsx +30 -0
  359. package/src/ui/_compat/theme/themeContext.ts +10 -0
  360. package/src/ui/_compat/theme/themeProvider.tsx +74 -0
  361. package/src/ui/_compat/theme/useRootTheme.ts +17 -0
  362. package/src/ui/_compat/theme/useTheme.ts +16 -0
  363. package/src/ui/_compat/types.ts +274 -0
  364. package/src/ui/components/autocomplete/__mocks__/apiStore.ts +49 -0
  365. package/src/ui/components/autocomplete/__workshop__/async.tsx +156 -0
  366. package/src/ui/components/autocomplete/__workshop__/constrainedHeight.tsx +131 -0
  367. package/src/ui/components/autocomplete/__workshop__/custom.tsx +90 -0
  368. package/src/ui/components/autocomplete/__workshop__/example.tsx +80 -0
  369. package/src/ui/components/autocomplete/__workshop__/fullscreen.tsx +293 -0
  370. package/src/ui/components/autocomplete/autocomplete.tsx +722 -0
  371. package/src/ui/components/autocomplete/autocompleteOption.tsx +45 -0
  372. package/src/ui/components/autocomplete/types.ts +108 -0
  373. package/src/ui/components/breadcrumbs/__workshop__/example.tsx +62 -0
  374. package/src/ui/components/breadcrumbs/breadcrumbs.tsx +127 -0
  375. package/src/ui/components/dialog/__workshop__/activate.tsx +134 -0
  376. package/src/ui/components/dialog/__workshop__/nested.tsx +72 -0
  377. package/src/ui/components/dialog/__workshop__/onScroll.tsx +39 -0
  378. package/src/ui/components/dialog/__workshop__/panes.tsx +82 -0
  379. package/src/ui/components/dialog/__workshop__/position.tsx +30 -0
  380. package/src/ui/components/dialog/__workshop__/props.tsx +77 -0
  381. package/src/ui/components/dialog/__workshop__/wrapped.tsx +76 -0
  382. package/src/ui/components/dialog/dialog.tsx +432 -0
  383. package/src/ui/components/dialog/dialogProvider.tsx +35 -0
  384. package/src/ui/components/dialog/useDialog.ts +11 -0
  385. package/src/ui/components/hotkeys/hotkeys.tsx +54 -0
  386. package/src/ui/components/menu/__workshop__/asComponent.tsx +45 -0
  387. package/src/ui/components/menu/__workshop__/avatarMenu.tsx +51 -0
  388. package/src/ui/components/menu/__workshop__/constrainedInBoundary.tsx +134 -0
  389. package/src/ui/components/menu/__workshop__/customSelectedState.tsx +39 -0
  390. package/src/ui/components/menu/__workshop__/menuButton.tsx +80 -0
  391. package/src/ui/components/menu/__workshop__/shouldFocus.tsx +47 -0
  392. package/src/ui/components/menu/__workshop__/tones.tsx +25 -0
  393. package/src/ui/components/menu/menu.test.tsx +128 -0
  394. package/src/ui/components/menu/menu.tsx +200 -0
  395. package/src/ui/components/menu/menuButton.tsx +275 -0
  396. package/src/ui/components/menu/menuContext.ts +31 -0
  397. package/src/ui/components/menu/menuDivider.tsx +22 -0
  398. package/src/ui/components/menu/menuGroup.tsx +228 -0
  399. package/src/ui/components/menu/menuItem.tsx +180 -0
  400. package/src/ui/components/menu/useMenu.ts +21 -0
  401. package/src/ui/components/menu/useMenuController.ts +241 -0
  402. package/src/ui/components/skeleton/__workshop__/delay.tsx +70 -0
  403. package/src/ui/components/skeleton/__workshop__/skeleton.tsx +64 -0
  404. package/src/ui/components/skeleton/skeleton.tsx +53 -0
  405. package/src/ui/components/skeleton/textSkeleton.tsx +132 -0
  406. package/src/ui/components/tab/tab.tsx +105 -0
  407. package/src/ui/components/tab/tabList.tsx +74 -0
  408. package/src/ui/components/tab/tabPanel.tsx +40 -0
  409. package/src/ui/components/toast/__workshop__/hook.tsx +71 -0
  410. package/src/ui/components/toast/__workshop__/toast.tsx +26 -0
  411. package/src/ui/components/toast/toast.test.tsx +101 -0
  412. package/src/ui/components/toast/toast.tsx +211 -0
  413. package/src/ui/components/toast/toastLayer.tsx +38 -0
  414. package/src/ui/components/toast/toastProvider.tsx +113 -0
  415. package/src/ui/components/toast/toastState.ts +6 -0
  416. package/src/ui/components/toast/types.ts +28 -0
  417. package/src/ui/components/toast/useToast.ts +25 -0
  418. package/src/ui/components/tree/__workshop__/basic.tsx +105 -0
  419. package/src/ui/components/tree/__workshop__/tabFromElement.tsx +84 -0
  420. package/src/ui/components/tree/tree.tsx +244 -0
  421. package/src/ui/components/tree/treeGroup.tsx +30 -0
  422. package/src/ui/components/tree/treeItem.tsx +220 -0
  423. package/src/ui/components/tree/useTree.ts +17 -0
  424. package/src/ui/constants.ts +85 -0
  425. package/src/ui/helpers/focus.ts +100 -0
  426. package/src/ui/helpers/index.ts +5 -0
  427. package/src/ui/helpers/props.ts +10 -0
  428. package/src/ui/hooks/useArrayProp.ts +29 -0
  429. package/src/ui/hooks/useClickOutside.test.tsx +482 -0
  430. package/src/ui/hooks/useClickOutside.ts +117 -0
  431. package/src/ui/hooks/useClickOutsideEvent.test.tsx +115 -0
  432. package/src/ui/hooks/useClickOutsideEvent.ts +73 -0
  433. package/src/ui/hooks/useDelayed.test.ts +68 -0
  434. package/src/ui/hooks/useDelayedState.ts +28 -0
  435. package/src/ui/hooks/useElementRect/__workshop__/example.tsx +32 -0
  436. package/src/ui/hooks/useElementSize.ts +19 -0
  437. package/src/ui/hooks/useForwardedRef.ts +19 -0
  438. package/src/ui/hooks/useGlobalKeyDown.ts +17 -0
  439. package/src/ui/hooks/useMatchMedia.ts +28 -0
  440. package/src/ui/hooks/useMediaIndex/useMediaIndex.test.tsx +36 -0
  441. package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +102 -0
  442. package/src/ui/hooks/usePrefersDark.hydration.test.tsx +56 -0
  443. package/src/ui/hooks/usePrefersDark.test.tsx +19 -0
  444. package/src/ui/hooks/usePrefersDark.ts +16 -0
  445. package/src/ui/hooks/usePrefersReducedMotion.hydration.test.tsx +56 -0
  446. package/src/ui/hooks/usePrefersReducedMotion.test.tsx +19 -0
  447. package/src/ui/hooks/usePrefersReducedMotion.ts +16 -0
  448. package/src/ui/index.ts +9 -0
  449. package/src/ui/lib/createGlobalScopedContext.ts +34 -0
  450. package/src/ui/lib/globalScope.ts +19 -0
  451. package/src/ui/primitives/_selectable/selectable.tsx +31 -0
  452. package/src/ui/primitives/avatar/__workshop__/asButton.tsx +14 -0
  453. package/src/ui/primitives/avatar/__workshop__/stack.tsx +25 -0
  454. package/src/ui/primitives/avatar/__workshop__/withinButton.tsx +63 -0
  455. package/src/ui/primitives/avatar/__workshop__/withinMenuItem.tsx +72 -0
  456. package/src/ui/primitives/avatar/avatar.tsx +158 -0
  457. package/src/ui/primitives/avatar/avatarCounter.tsx +62 -0
  458. package/src/ui/primitives/avatar/avatarStack.tsx +82 -0
  459. package/src/ui/primitives/avatar/types.ts +17 -0
  460. package/src/ui/primitives/badge/__workshop__/props.tsx +30 -0
  461. package/src/ui/primitives/badge/__workshop__/tones.tsx +21 -0
  462. package/src/ui/primitives/badge/badge.test.tsx +16 -0
  463. package/src/ui/primitives/badge/badge.tsx +64 -0
  464. package/src/ui/primitives/box/__workshop__/props.tsx +20 -0
  465. package/src/ui/primitives/box/box.tsx +162 -0
  466. package/src/ui/primitives/button/__workshop__/custom.tsx +50 -0
  467. package/src/ui/primitives/button/__workshop__/disabled.tsx +74 -0
  468. package/src/ui/primitives/button/__workshop__/props.tsx +58 -0
  469. package/src/ui/primitives/button/__workshop__/sanityUploadButton.tsx +36 -0
  470. package/src/ui/primitives/button/__workshop__/stacked.tsx +59 -0
  471. package/src/ui/primitives/button/__workshop__/styled1.tsx +17 -0
  472. package/src/ui/primitives/button/__workshop__/styled2.tsx +19 -0
  473. package/src/ui/primitives/button/button.test.tsx +44 -0
  474. package/src/ui/primitives/button/button.tsx +207 -0
  475. package/src/ui/primitives/card/__workshop__/allTones.tsx +27 -0
  476. package/src/ui/primitives/card/__workshop__/asButton.tsx +107 -0
  477. package/src/ui/primitives/card/__workshop__/asComponent.tsx +27 -0
  478. package/src/ui/primitives/card/__workshop__/checkered.tsx +26 -0
  479. package/src/ui/primitives/card/__workshop__/interactive.tsx +30 -0
  480. package/src/ui/primitives/card/__workshop__/listNavigation.tsx +80 -0
  481. package/src/ui/primitives/card/__workshop__/props.tsx +55 -0
  482. package/src/ui/primitives/card/__workshop__/selected.tsx +93 -0
  483. package/src/ui/primitives/card/__workshop__/styled.tsx +14 -0
  484. package/src/ui/primitives/card/card.tsx +118 -0
  485. package/src/ui/primitives/card/cardContext.ts +10 -0
  486. package/src/ui/primitives/card/cardProvider.tsx +19 -0
  487. package/src/ui/primitives/card/index.ts +4 -0
  488. package/src/ui/primitives/card/types.ts +27 -0
  489. package/src/ui/primitives/card/useCard.ts +7 -0
  490. package/src/ui/primitives/checkbox/__workshop__/tones.tsx +28 -0
  491. package/src/ui/primitives/checkbox/checkbox.tsx +74 -0
  492. package/src/ui/primitives/code/__workshop__/props.tsx +21 -0
  493. package/src/ui/primitives/code/code.tsx +49 -0
  494. package/src/ui/primitives/code/refractor.tsx +20 -0
  495. package/src/ui/primitives/container/__workshop__/example.tsx +20 -0
  496. package/src/ui/primitives/container/container.tsx +35 -0
  497. package/src/ui/primitives/flex/__workshop__/example.tsx +34 -0
  498. package/src/ui/primitives/flex/__workshop__/gap.tsx +25 -0
  499. package/src/ui/primitives/flex/flex.tsx +29 -0
  500. package/src/ui/primitives/grid/__workshop__/responsive.tsx +54 -0
  501. package/src/ui/primitives/grid/grid.tsx +30 -0
  502. package/src/ui/primitives/heading/__workshop__/opticalAlignment.tsx +54 -0
  503. package/src/ui/primitives/heading/__workshop__/plain.tsx +32 -0
  504. package/src/ui/primitives/heading/heading.tsx +62 -0
  505. package/src/ui/primitives/inline/__workshop__/plain.tsx +27 -0
  506. package/src/ui/primitives/inline/inline.tsx +50 -0
  507. package/src/ui/primitives/kbd/kbd.tsx +55 -0
  508. package/src/ui/primitives/label/__workshop__/opticalAlignment.tsx +54 -0
  509. package/src/ui/primitives/label/__workshop__/plain.tsx +37 -0
  510. package/src/ui/primitives/label/label.tsx +67 -0
  511. package/src/ui/primitives/popover/__workshop__/AlignedStory.tsx +77 -0
  512. package/src/ui/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +32 -0
  513. package/src/ui/primitives/popover/__workshop__/OpenOnMountStory.tsx +11 -0
  514. package/src/ui/primitives/popover/__workshop__/PlainStory.tsx +71 -0
  515. package/src/ui/primitives/popover/__workshop__/SidePanelStory.tsx +93 -0
  516. package/src/ui/primitives/popover/__workshop__/TestStory.tsx +98 -0
  517. package/src/ui/primitives/popover/floating-ui/size.ts +83 -0
  518. package/src/ui/primitives/popover/helpers.ts +32 -0
  519. package/src/ui/primitives/popover/popover.tsx +422 -0
  520. package/src/ui/primitives/popover/popoverCard.tsx +161 -0
  521. package/src/ui/primitives/radio/__workshop__/plain.tsx +28 -0
  522. package/src/ui/primitives/radio/radio.tsx +49 -0
  523. package/src/ui/primitives/select/__workshop__/plain.tsx +30 -0
  524. package/src/ui/primitives/select/__workshop__/readOnly.tsx +23 -0
  525. package/src/ui/primitives/select/select.tsx +85 -0
  526. package/src/ui/primitives/spinner/__workshop__/Props.tsx +16 -0
  527. package/src/ui/primitives/spinner/animatedSpinnerIcon.tsx +16 -0
  528. package/src/ui/primitives/spinner/spinner.tsx +33 -0
  529. package/src/ui/primitives/stack/__workshop__/plain.tsx +32 -0
  530. package/src/ui/primitives/stack/index.ts +1 -0
  531. package/src/ui/primitives/stack/stack.tsx +45 -0
  532. package/src/ui/primitives/switch/switch.tsx +75 -0
  533. package/src/ui/primitives/text/__workshop__/colored.tsx +23 -0
  534. package/src/ui/primitives/text/__workshop__/example.tsx +39 -0
  535. package/src/ui/primitives/text/__workshop__/opticalAlignment.tsx +48 -0
  536. package/src/ui/primitives/text/text.tsx +64 -0
  537. package/src/ui/primitives/textArea/__workshop__/plain.tsx +50 -0
  538. package/src/ui/primitives/textArea/textArea.tsx +71 -0
  539. package/src/ui/primitives/textInput/__workshop__/index.ts +44 -0
  540. package/src/ui/primitives/textInput/__workshop__/plain.tsx +104 -0
  541. package/src/ui/primitives/textInput/__workshop__/readOnly.tsx +9 -0
  542. package/src/ui/primitives/textInput/__workshop__/tones.tsx +277 -0
  543. package/src/ui/primitives/textInput/__workshop__/typed.tsx +23 -0
  544. package/src/ui/primitives/textInput/textInput.tsx +286 -0
  545. package/src/ui/primitives/tooltip/__workshop__/customPortal.tsx +102 -0
  546. package/src/ui/primitives/tooltip/__workshop__/overflowingBoundary.tsx +74 -0
  547. package/src/ui/primitives/tooltip/__workshop__/props.tsx +111 -0
  548. package/src/ui/primitives/tooltip/__workshop__/resizableBoundary.tsx +86 -0
  549. package/src/ui/primitives/tooltip/tooltip.test.tsx +453 -0
  550. package/src/ui/primitives/tooltip/tooltip.tsx +466 -0
  551. package/src/ui/primitives/tooltip/tooltipCard.tsx +115 -0
  552. package/src/ui/primitives/tooltip/tooltipDelayGroup/index.ts +4 -0
  553. package/src/ui/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +55 -0
  554. package/src/ui/primitives/tooltip/tooltipDelayGroup/types.ts +10 -0
  555. package/src/ui/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +13 -0
  556. package/src/ui/primitives/types.ts +166 -0
  557. package/src/ui/types/box.ts +22 -0
  558. package/src/ui/types/button.ts +24 -0
  559. package/src/ui/types/flex.ts +27 -0
  560. package/src/ui/types/grid.ts +17 -0
  561. package/src/ui/types/gridItem.ts +32 -0
  562. package/src/ui/types/index.ts +15 -0
  563. package/src/ui/types/props.ts +18 -0
  564. package/src/ui/types/selectable.ts +7 -0
  565. package/src/ui/types/text.ts +7 -0
  566. package/src/ui/utils/arrow/arrow.tsx +59 -0
  567. package/src/ui/utils/boundaryElement/boundaryElement.test.tsx +100 -0
  568. package/src/ui/utils/boundaryElement/boundaryElementProvider.tsx +24 -0
  569. package/src/ui/utils/boundaryElement/index.ts +3 -0
  570. package/src/ui/utils/boundaryElement/useBoundaryElement.ts +26 -0
  571. package/src/ui/utils/conditionalWrapper/conditionalWrapper.tsx +23 -0
  572. package/src/ui/utils/elementQuery/__workshop__/customMedia.tsx +30 -0
  573. package/src/ui/utils/elementQuery/elementQuery.tsx +53 -0
  574. package/src/ui/utils/errorBoundary.tsx +48 -0
  575. package/src/ui/utils/getElementRef.ts +26 -0
  576. package/src/ui/utils/layer/__workshop__/multipleRoots.tsx +49 -0
  577. package/src/ui/utils/layer/__workshop__/nested.tsx +98 -0
  578. package/src/ui/utils/layer/__workshop__/responsiveZOffset.tsx +13 -0
  579. package/src/ui/utils/layer/index.ts +4 -0
  580. package/src/ui/utils/layer/layer.test.tsx +108 -0
  581. package/src/ui/utils/layer/layer.tsx +112 -0
  582. package/src/ui/utils/layer/layerProvider.tsx +110 -0
  583. package/src/ui/utils/layer/useLayer.ts +26 -0
  584. package/src/ui/utils/portal/portal.test.tsx +103 -0
  585. package/src/ui/utils/portal/portal.ts +46 -0
  586. package/src/ui/utils/portal/portalProvider.tsx +79 -0
  587. package/src/ui/utils/portal/usePortal.ts +25 -0
  588. package/src/ui/utils/spanWithTextOverflow.tsx +10 -0
  589. package/src/ui/utils/srOnly/index.ts +1 -0
  590. package/src/ui/utils/srOnly/srOnly.tsx +35 -0
  591. package/src/ui/utils/virtualList/virtualList.tsx +189 -0
  592. package/dist/_chunks-cjs/getTheme_v2.js +0 -316
  593. package/dist/_chunks-cjs/getTheme_v2.js.map +0 -1
  594. package/dist/_chunks-es/getTheme_v2.mjs +0 -317
  595. package/dist/_chunks-es/getTheme_v2.mjs.map +0 -1
  596. package/dist/_legacy/getTheme_v2.esm.js +0 -317
  597. package/dist/_legacy/getTheme_v2.esm.js.map +0 -1
  598. package/dist/css.esm.js +0 -3135
  599. package/dist/css.esm.js.map +0 -1
  600. package/dist/index.esm.js +0 -5843
  601. package/dist/index.esm.js.map +0 -1
  602. package/dist/theme.esm.js +0 -3088
  603. package/dist/theme.esm.js.map +0 -1
  604. package/src/core/__workshop__/constants.ts +0 -296
  605. package/src/core/__workshop__/fontsPlugin.tsx +0 -76
  606. package/src/core/_compat.ts +0 -264
  607. package/src/core/components/autocomplete/__mocks__/apiStore.ts +0 -49
  608. package/src/core/components/autocomplete/__workshop__/.eslintrc +0 -5
  609. package/src/core/components/autocomplete/__workshop__/async.tsx +0 -155
  610. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -136
  611. package/src/core/components/autocomplete/__workshop__/custom.tsx +0 -88
  612. package/src/core/components/autocomplete/__workshop__/example.tsx +0 -78
  613. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +0 -293
  614. package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -38
  615. package/src/core/components/autocomplete/autocomplete.tsx +0 -735
  616. package/src/core/components/autocomplete/autocompleteOption.tsx +0 -44
  617. package/src/core/components/autocomplete/types.ts +0 -108
  618. package/src/core/components/breadcrumbs/__workshop__/.eslintrc +0 -5
  619. package/src/core/components/breadcrumbs/__workshop__/example.tsx +0 -55
  620. package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -17
  621. package/src/core/components/breadcrumbs/breadcrumbs.tsx +0 -111
  622. package/src/core/components/dialog/__workshop__/.eslintrc +0 -5
  623. package/src/core/components/dialog/__workshop__/activate.tsx +0 -133
  624. package/src/core/components/dialog/__workshop__/nested.tsx +0 -72
  625. package/src/core/components/dialog/__workshop__/onScroll.tsx +0 -39
  626. package/src/core/components/dialog/__workshop__/panes.tsx +0 -81
  627. package/src/core/components/dialog/__workshop__/position.tsx +0 -29
  628. package/src/core/components/dialog/__workshop__/props.tsx +0 -74
  629. package/src/core/components/dialog/__workshop__/wrapped.tsx +0 -78
  630. package/src/core/components/dialog/dialog.tsx +0 -414
  631. package/src/core/components/dialog/dialogProvider.tsx +0 -34
  632. package/src/core/components/dialog/useDialog.ts +0 -10
  633. package/src/core/components/hotkeys/__workshop__/.eslintrc +0 -5
  634. package/src/core/components/hotkeys/hotkeys.tsx +0 -50
  635. package/src/core/components/menu/__workshop__/.eslintrc +0 -5
  636. package/src/core/components/menu/__workshop__/asComponent.tsx +0 -44
  637. package/src/core/components/menu/__workshop__/avatarMenu.tsx +0 -50
  638. package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +0 -133
  639. package/src/core/components/menu/__workshop__/customSelectedState.tsx +0 -38
  640. package/src/core/components/menu/__workshop__/menuButton.tsx +0 -79
  641. package/src/core/components/menu/__workshop__/shouldFocus.tsx +0 -46
  642. package/src/core/components/menu/__workshop__/tones.tsx +0 -25
  643. package/src/core/components/menu/menu.test.tsx +0 -129
  644. package/src/core/components/menu/menu.tsx +0 -175
  645. package/src/core/components/menu/menuButton.tsx +0 -289
  646. package/src/core/components/menu/menuContext.ts +0 -29
  647. package/src/core/components/menu/menuDivider.ts +0 -13
  648. package/src/core/components/menu/menuGroup.tsx +0 -210
  649. package/src/core/components/menu/menuItem.tsx +0 -187
  650. package/src/core/components/menu/useMenu.ts +0 -20
  651. package/src/core/components/menu/useMenuController.ts +0 -230
  652. package/src/core/components/skeleton/__workshop__/.eslintrc +0 -5
  653. package/src/core/components/skeleton/__workshop__/delay.tsx +0 -69
  654. package/src/core/components/skeleton/__workshop__/skeleton.tsx +0 -63
  655. package/src/core/components/skeleton/skeleton.tsx +0 -58
  656. package/src/core/components/skeleton/styles.ts +0 -50
  657. package/src/core/components/skeleton/textSkeleton.tsx +0 -122
  658. package/src/core/components/tab/__workshop__/.eslintrc +0 -5
  659. package/src/core/components/tab/tab.tsx +0 -99
  660. package/src/core/components/tab/tabList.tsx +0 -78
  661. package/src/core/components/tab/tabPanel.tsx +0 -38
  662. package/src/core/components/toast/__workshop__/.eslintrc +0 -5
  663. package/src/core/components/toast/__workshop__/hook.tsx +0 -71
  664. package/src/core/components/toast/__workshop__/toast.tsx +0 -25
  665. package/src/core/components/toast/styles.ts +0 -61
  666. package/src/core/components/toast/toast.test.tsx +0 -102
  667. package/src/core/components/toast/toast.tsx +0 -109
  668. package/src/core/components/toast/toastProvider.tsx +0 -202
  669. package/src/core/components/toast/types.ts +0 -20
  670. package/src/core/components/toast/useToast.ts +0 -24
  671. package/src/core/components/tree/__workshop__/.eslintrc +0 -5
  672. package/src/core/components/tree/__workshop__/basic.tsx +0 -104
  673. package/src/core/components/tree/__workshop__/tabFromElement.tsx +0 -83
  674. package/src/core/components/tree/style.ts +0 -104
  675. package/src/core/components/tree/tree.tsx +0 -242
  676. package/src/core/components/tree/treeGroup.tsx +0 -29
  677. package/src/core/components/tree/treeItem.tsx +0 -217
  678. package/src/core/components/tree/useTree.ts +0 -16
  679. package/src/core/constants.ts +0 -57
  680. package/src/core/helpers/focus.ts +0 -100
  681. package/src/core/helpers/index.ts +0 -4
  682. package/src/core/hooks/useArrayProp.ts +0 -25
  683. package/src/core/hooks/useClickOutside.test.tsx +0 -483
  684. package/src/core/hooks/useClickOutside.ts +0 -116
  685. package/src/core/hooks/useClickOutsideEvent.test.tsx +0 -116
  686. package/src/core/hooks/useClickOutsideEvent.ts +0 -72
  687. package/src/core/hooks/useDelayed.test.ts +0 -67
  688. package/src/core/hooks/useDelayedState.ts +0 -29
  689. package/src/core/hooks/useElementRect/__workshop__/.eslintrc +0 -5
  690. package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -31
  691. package/src/core/hooks/useElementSize.ts +0 -18
  692. package/src/core/hooks/useForwardedRef.ts +0 -19
  693. package/src/core/hooks/useGlobalKeyDown.ts +0 -12
  694. package/src/core/hooks/useMatchMedia.ts +0 -46
  695. package/src/core/hooks/useMediaIndex/__workshop__/.eslintrc +0 -5
  696. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +0 -35
  697. package/src/core/hooks/useMediaIndex/useMediaIndex.ts +0 -101
  698. package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -57
  699. package/src/core/hooks/usePrefersDark.test.tsx +0 -18
  700. package/src/core/hooks/usePrefersDark.ts +0 -16
  701. package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -57
  702. package/src/core/hooks/usePrefersReducedMotion.test.tsx +0 -18
  703. package/src/core/hooks/usePrefersReducedMotion.ts +0 -16
  704. package/src/core/index.ts +0 -11
  705. package/src/core/lib/createGlobalScopedContext.ts +0 -33
  706. package/src/core/lib/globalScope.ts +0 -20
  707. package/src/core/lib/styled/elements.ts +0 -135
  708. package/src/core/lib/styled/index.ts +0 -2
  709. package/src/core/lib/styled/members.ts +0 -15
  710. package/src/core/lib/styled/styled.ts +0 -79
  711. package/src/core/primitives/_selectable/selectable.tsx +0 -27
  712. package/src/core/primitives/avatar/__workshop__/.eslintrc +0 -5
  713. package/src/core/primitives/avatar/__workshop__/asButton.tsx +0 -13
  714. package/src/core/primitives/avatar/__workshop__/stack.tsx +0 -24
  715. package/src/core/primitives/avatar/__workshop__/withinButton.tsx +0 -62
  716. package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -69
  717. package/src/core/primitives/avatar/avatar.tsx +0 -217
  718. package/src/core/primitives/avatar/avatarCounter.tsx +0 -93
  719. package/src/core/primitives/avatar/avatarStack.tsx +0 -100
  720. package/src/core/primitives/avatar/styles.ts +0 -166
  721. package/src/core/primitives/avatar/types.ts +0 -16
  722. package/src/core/primitives/badge/__workshop__/.eslintrc +0 -5
  723. package/src/core/primitives/badge/__workshop__/props.tsx +0 -29
  724. package/src/core/primitives/badge/__workshop__/tones.tsx +0 -20
  725. package/src/core/primitives/badge/badge.test.tsx +0 -15
  726. package/src/core/primitives/badge/badge.tsx +0 -59
  727. package/src/core/primitives/badge/styles.ts +0 -19
  728. package/src/core/primitives/box/__workshop__/.eslintrc +0 -5
  729. package/src/core/primitives/box/__workshop__/props.tsx +0 -19
  730. package/src/core/primitives/box/box.tsx +0 -118
  731. package/src/core/primitives/button/__workshop__/.eslintrc +0 -5
  732. package/src/core/primitives/button/__workshop__/custom.tsx +0 -47
  733. package/src/core/primitives/button/__workshop__/disabled.tsx +0 -73
  734. package/src/core/primitives/button/__workshop__/props.tsx +0 -52
  735. package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +0 -36
  736. package/src/core/primitives/button/__workshop__/stacked.tsx +0 -57
  737. package/src/core/primitives/button/__workshop__/styled1.tsx +0 -17
  738. package/src/core/primitives/button/__workshop__/styled2.tsx +0 -19
  739. package/src/core/primitives/button/button.test.tsx +0 -43
  740. package/src/core/primitives/button/button.tsx +0 -181
  741. package/src/core/primitives/button/styles.ts +0 -116
  742. package/src/core/primitives/card/RootCardContext.ts +0 -3
  743. package/src/core/primitives/card/__workshop__/.eslintrc +0 -5
  744. package/src/core/primitives/card/__workshop__/allTones.tsx +0 -27
  745. package/src/core/primitives/card/__workshop__/asButton.tsx +0 -88
  746. package/src/core/primitives/card/__workshop__/asComponent.tsx +0 -27
  747. package/src/core/primitives/card/__workshop__/checkered.tsx +0 -16
  748. package/src/core/primitives/card/__workshop__/interactive.tsx +0 -23
  749. package/src/core/primitives/card/__workshop__/listNavigation.tsx +0 -77
  750. package/src/core/primitives/card/__workshop__/props.tsx +0 -49
  751. package/src/core/primitives/card/__workshop__/selected.tsx +0 -91
  752. package/src/core/primitives/card/__workshop__/styled.tsx +0 -14
  753. package/src/core/primitives/card/card.tsx +0 -113
  754. package/src/core/primitives/card/index.ts +0 -2
  755. package/src/core/primitives/card/styles.ts +0 -146
  756. package/src/core/primitives/card/types.ts +0 -11
  757. package/src/core/primitives/checkbox/__workshop__/.eslintrc +0 -5
  758. package/src/core/primitives/checkbox/__workshop__/tones.tsx +0 -22
  759. package/src/core/primitives/checkbox/checkbox.tsx +0 -70
  760. package/src/core/primitives/code/__workshop__/.eslintrc +0 -5
  761. package/src/core/primitives/code/__workshop__/props.tsx +0 -20
  762. package/src/core/primitives/code/code.tsx +0 -51
  763. package/src/core/primitives/code/styles.ts +0 -77
  764. package/src/core/primitives/container/__workshop__/.eslintrc +0 -5
  765. package/src/core/primitives/container/__workshop__/example.tsx +0 -19
  766. package/src/core/primitives/container/container.tsx +0 -32
  767. package/src/core/primitives/container/styles.ts +0 -22
  768. package/src/core/primitives/flex/__workshop__/.eslintrc +0 -5
  769. package/src/core/primitives/flex/__workshop__/example.tsx +0 -33
  770. package/src/core/primitives/flex/__workshop__/gap.tsx +0 -25
  771. package/src/core/primitives/flex/flex.tsx +0 -44
  772. package/src/core/primitives/grid/__workshop__/.eslintrc +0 -5
  773. package/src/core/primitives/grid/__workshop__/responsive.tsx +0 -54
  774. package/src/core/primitives/grid/grid.tsx +0 -48
  775. package/src/core/primitives/heading/__workshop__/.eslintrc +0 -5
  776. package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +0 -66
  777. package/src/core/primitives/heading/__workshop__/plain.tsx +0 -31
  778. package/src/core/primitives/heading/heading.tsx +0 -99
  779. package/src/core/primitives/heading/styles.ts +0 -63
  780. package/src/core/primitives/heading/types.ts +0 -7
  781. package/src/core/primitives/inline/__workshop__/.eslintrc +0 -5
  782. package/src/core/primitives/inline/__workshop__/plain.tsx +0 -26
  783. package/src/core/primitives/inline/inline.tsx +0 -56
  784. package/src/core/primitives/inline/styles.ts +0 -31
  785. package/src/core/primitives/kbd/__workshop__/.eslintrc +0 -5
  786. package/src/core/primitives/kbd/kbd.tsx +0 -53
  787. package/src/core/primitives/label/__workshop__/.eslintrc +0 -5
  788. package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +0 -48
  789. package/src/core/primitives/label/__workshop__/plain.tsx +0 -23
  790. package/src/core/primitives/label/label.tsx +0 -96
  791. package/src/core/primitives/label/styles.ts +0 -44
  792. package/src/core/primitives/popover/__workshop__/.eslintrc +0 -5
  793. package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +0 -76
  794. package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -31
  795. package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
  796. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +0 -70
  797. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +0 -86
  798. package/src/core/primitives/popover/__workshop__/TestStory.tsx +0 -96
  799. package/src/core/primitives/popover/floating-ui/size.ts +0 -82
  800. package/src/core/primitives/popover/helpers.ts +0 -31
  801. package/src/core/primitives/popover/popover.tsx +0 -476
  802. package/src/core/primitives/popover/popoverCard.tsx +0 -153
  803. package/src/core/primitives/radio/__workshop__/.eslintrc +0 -5
  804. package/src/core/primitives/radio/__workshop__/plain.tsx +0 -28
  805. package/src/core/primitives/radio/radio.tsx +0 -50
  806. package/src/core/primitives/radio/styles.ts +0 -116
  807. package/src/core/primitives/select/__workshop__/.eslintrc +0 -5
  808. package/src/core/primitives/select/__workshop__/plain.tsx +0 -27
  809. package/src/core/primitives/select/__workshop__/readOnly.tsx +0 -23
  810. package/src/core/primitives/select/select.tsx +0 -86
  811. package/src/core/primitives/select/styles.ts +0 -166
  812. package/src/core/primitives/spinner/__workshop__/.eslintrc +0 -5
  813. package/src/core/primitives/spinner/__workshop__/Props.tsx +0 -14
  814. package/src/core/primitives/spinner/spinner.tsx +0 -31
  815. package/src/core/primitives/stack/__workshop__/.eslintrc +0 -5
  816. package/src/core/primitives/stack/__workshop__/plain.tsx +0 -31
  817. package/src/core/primitives/stack/stack.tsx +0 -41
  818. package/src/core/primitives/stack/styles.ts +0 -31
  819. package/src/core/primitives/switch/__workshop__/.eslintrc +0 -5
  820. package/src/core/primitives/switch/styles.ts +0 -172
  821. package/src/core/primitives/switch/switch.tsx +0 -66
  822. package/src/core/primitives/text/__workshop__/.eslintrc +0 -5
  823. package/src/core/primitives/text/__workshop__/colored.tsx +0 -29
  824. package/src/core/primitives/text/__workshop__/example.tsx +0 -38
  825. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +0 -58
  826. package/src/core/primitives/text/styles.ts +0 -73
  827. package/src/core/primitives/text/text.tsx +0 -85
  828. package/src/core/primitives/textArea/__workshop__/.eslintrc +0 -5
  829. package/src/core/primitives/textArea/__workshop__/plain.tsx +0 -49
  830. package/src/core/primitives/textArea/textArea.tsx +0 -118
  831. package/src/core/primitives/textInput/__workshop__/.eslintrc +0 -5
  832. package/src/core/primitives/textInput/__workshop__/index.ts +0 -49
  833. package/src/core/primitives/textInput/__workshop__/multipleTones.tsx +0 -20
  834. package/src/core/primitives/textInput/__workshop__/plain.tsx +0 -98
  835. package/src/core/primitives/textInput/__workshop__/readOnly.tsx +0 -5
  836. package/src/core/primitives/textInput/__workshop__/tones.tsx +0 -239
  837. package/src/core/primitives/textInput/__workshop__/typed.tsx +0 -22
  838. package/src/core/primitives/textInput/textInput.tsx +0 -440
  839. package/src/core/primitives/tooltip/__workshop__/.eslintrc +0 -5
  840. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +0 -101
  841. package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -73
  842. package/src/core/primitives/tooltip/__workshop__/props.tsx +0 -106
  843. package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -85
  844. package/src/core/primitives/tooltip/tooltip.test.tsx +0 -451
  845. package/src/core/primitives/tooltip/tooltip.tsx +0 -464
  846. package/src/core/primitives/tooltip/tooltipCard.tsx +0 -110
  847. package/src/core/primitives/tooltip/tooltipDelayGroup/index.ts +0 -4
  848. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +0 -57
  849. package/src/core/primitives/tooltip/tooltipDelayGroup/types.ts +0 -11
  850. package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +0 -12
  851. package/src/core/primitives/types.ts +0 -165
  852. package/src/core/styles/border/borderStyle.ts +0 -61
  853. package/src/core/styles/border/index.ts +0 -2
  854. package/src/core/styles/border/types.ts +0 -11
  855. package/src/core/styles/box/boxStyle.ts +0 -74
  856. package/src/core/styles/box/index.ts +0 -2
  857. package/src/core/styles/box/types.ts +0 -11
  858. package/src/core/styles/card/_cardColorStyle.ts +0 -101
  859. package/src/core/styles/card/index.ts +0 -1
  860. package/src/core/styles/flex/flexItemStyle.ts +0 -26
  861. package/src/core/styles/flex/flexStyle.ts +0 -69
  862. package/src/core/styles/flex/index.ts +0 -3
  863. package/src/core/styles/flex/types.ts +0 -24
  864. package/src/core/styles/focusRing/index.ts +0 -25
  865. package/src/core/styles/font/codeFontStyle.ts +0 -12
  866. package/src/core/styles/font/headingFontStyle.ts +0 -12
  867. package/src/core/styles/font/index.ts +0 -6
  868. package/src/core/styles/font/labelFontStyle.ts +0 -12
  869. package/src/core/styles/font/responsiveFont.ts +0 -101
  870. package/src/core/styles/font/textAlignStyle.ts +0 -18
  871. package/src/core/styles/font/textFontStyle.ts +0 -12
  872. package/src/core/styles/font/types.ts +0 -34
  873. package/src/core/styles/grid/gridItemStyle.ts +0 -81
  874. package/src/core/styles/grid/gridStyle.ts +0 -97
  875. package/src/core/styles/grid/index.ts +0 -3
  876. package/src/core/styles/grid/types.ts +0 -37
  877. package/src/core/styles/helpers.ts +0 -81
  878. package/src/core/styles/index.ts +0 -5
  879. package/src/core/styles/input/index.ts +0 -2
  880. package/src/core/styles/input/responsiveInputPaddingStyle.ts +0 -77
  881. package/src/core/styles/input/textInputStyle.ts +0 -263
  882. package/src/core/styles/internal.ts +0 -12
  883. package/src/core/styles/margin/index.ts +0 -2
  884. package/src/core/styles/margin/marginStyle.ts +0 -20
  885. package/src/core/styles/margin/marginsStyle.test.ts +0 -32
  886. package/src/core/styles/margin/types.ts +0 -9
  887. package/src/core/styles/padding/index.ts +0 -2
  888. package/src/core/styles/padding/paddingStyle.test.ts +0 -32
  889. package/src/core/styles/padding/paddingStyle.ts +0 -20
  890. package/src/core/styles/padding/types.ts +0 -12
  891. package/src/core/styles/radius/index.ts +0 -2
  892. package/src/core/styles/radius/radiusStyle.ts +0 -22
  893. package/src/core/styles/radius/types.ts +0 -8
  894. package/src/core/styles/shadow/index.ts +0 -2
  895. package/src/core/styles/shadow/shadowStyle.ts +0 -29
  896. package/src/core/styles/shadow/types.ts +0 -6
  897. package/src/core/styles/types.ts +0 -8
  898. package/src/core/theme/__workshop__/.eslintrc +0 -5
  899. package/src/core/theme/__workshop__/build/Root.tsx +0 -367
  900. package/src/core/theme/__workshop__/build/helpers.ts +0 -46
  901. package/src/core/theme/__workshop__/build/story.tsx +0 -459
  902. package/src/core/theme/__workshop__/canvas.tsx +0 -350
  903. package/src/core/theme/__workshop__/color.tsx +0 -62
  904. package/src/core/theme/__workshop__/debug/story.tsx +0 -401
  905. package/src/core/theme/__workshop__/index.ts +0 -39
  906. package/src/core/theme/__workshop__/layer.tsx +0 -78
  907. package/src/core/theme/__workshop__/nestedProvider.tsx +0 -15
  908. package/src/core/theme/index.ts +0 -5
  909. package/src/core/theme/theme.test.tsx +0 -73
  910. package/src/core/theme/themeColorProvider.tsx +0 -28
  911. package/src/core/theme/themeContext.ts +0 -10
  912. package/src/core/theme/themeProvider.tsx +0 -63
  913. package/src/core/theme/useRootTheme.ts +0 -16
  914. package/src/core/theme/useTheme.ts +0 -16
  915. package/src/core/types/box.ts +0 -19
  916. package/src/core/types/button.ts +0 -22
  917. package/src/core/types/flex.ts +0 -31
  918. package/src/core/types/grid.ts +0 -14
  919. package/src/core/types/gridItem.ts +0 -37
  920. package/src/core/types/index.ts +0 -14
  921. package/src/core/types/selectable.ts +0 -6
  922. package/src/core/types/text.ts +0 -4
  923. package/src/core/utils/arrow/arrow.tsx +0 -122
  924. package/src/core/utils/boundaryElement/__workshop__/.eslintrc +0 -5
  925. package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -101
  926. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +0 -23
  927. package/src/core/utils/boundaryElement/index.ts +0 -3
  928. package/src/core/utils/boundaryElement/useBoundaryElement.ts +0 -25
  929. package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +0 -21
  930. package/src/core/utils/elementQuery/__workshop__/.eslintrc +0 -5
  931. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +0 -30
  932. package/src/core/utils/elementQuery/elementQuery.tsx +0 -53
  933. package/src/core/utils/errorBoundary.tsx +0 -47
  934. package/src/core/utils/layer/__workshop__/.eslintrc +0 -5
  935. package/src/core/utils/layer/__workshop__/multipleRoots.tsx +0 -48
  936. package/src/core/utils/layer/__workshop__/nested.tsx +0 -97
  937. package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +0 -12
  938. package/src/core/utils/layer/index.ts +0 -4
  939. package/src/core/utils/layer/layer.test.tsx +0 -109
  940. package/src/core/utils/layer/layer.tsx +0 -108
  941. package/src/core/utils/layer/layerProvider.tsx +0 -109
  942. package/src/core/utils/layer/useLayer.ts +0 -25
  943. package/src/core/utils/portal/__workshop__/.eslintrc +0 -5
  944. package/src/core/utils/portal/portal.test.tsx +0 -104
  945. package/src/core/utils/portal/portal.ts +0 -31
  946. package/src/core/utils/portal/portalProvider.tsx +0 -78
  947. package/src/core/utils/portal/usePortal.ts +0 -24
  948. package/src/core/utils/srOnly/srOnly.tsx +0 -36
  949. package/src/core/utils/virtualList/__workshop__/.eslintrc +0 -5
  950. package/src/core/utils/virtualList/virtualList.tsx +0 -170
  951. package/src/css/cli/buildCommand.ts +0 -36
  952. package/src/css/cli/index.ts +0 -38
  953. package/src/css/compile/comileRules.ts +0 -59
  954. package/src/css/components/dialog/classes.ts +0 -29
  955. package/src/css/primitives/badge/rules.ts +0 -25
  956. package/src/css/primitives/box/rules.ts +0 -25
  957. package/src/css/primitives/card/rules.ts +0 -93
  958. package/src/css/primitives/selectable/__style.ts +0 -115
  959. package/src/css/primitives/selectable/rules.ts +0 -27
  960. package/src/css/primitives/selectable/selectable.ts +0 -9
  961. package/src/css/primitives/selectable/types.ts +0 -6
  962. package/src/css/rules.ts +0 -121
  963. package/src/css/styles/border/border.ts +0 -22
  964. package/src/css/styles/border/rules.ts +0 -24
  965. package/src/css/styles/display/rules.ts +0 -62
  966. package/src/css/styles/flex/flex.ts +0 -20
  967. package/src/css/styles/flex/rules.ts +0 -28
  968. package/src/css/styles/flexItem/flexItem.ts +0 -8
  969. package/src/css/styles/flexItem/rules.ts +0 -11
  970. package/src/css/styles/flexItem/types.ts +0 -11
  971. package/src/css/styles/font/font.ts +0 -12
  972. package/src/css/styles/font/rules.ts +0 -125
  973. package/src/css/styles/font/types.ts +0 -6
  974. package/src/css/styles/gap/gap.ts +0 -8
  975. package/src/css/styles/gap/rules.ts +0 -33
  976. package/src/css/styles/gap/types.ts +0 -9
  977. package/src/css/styles/grid/rules.ts +0 -35
  978. package/src/css/styles/gridItem/gridItem.ts +0 -15
  979. package/src/css/styles/gridItem/rules.ts +0 -96
  980. package/src/css/styles/margin/margin.ts +0 -15
  981. package/src/css/styles/margin/rules.ts +0 -59
  982. package/src/css/styles/maxWidth/rules.ts +0 -36
  983. package/src/css/styles/maxWidth/types.ts +0 -6
  984. package/src/css/styles/overflow/rules.ts +0 -9
  985. package/src/css/styles/padding/padding.ts +0 -15
  986. package/src/css/styles/padding/rules.ts +0 -59
  987. package/src/css/styles/padding/types.ts +0 -12
  988. package/src/css/styles/pointerEvents/pointerEvents.ts +0 -6
  989. package/src/css/styles/pointerEvents/rules.ts +0 -11
  990. package/src/css/styles/position/position.ts +0 -7
  991. package/src/css/styles/position/rules.ts +0 -31
  992. package/src/css/styles/position/types.ts +0 -13
  993. package/src/css/styles/radius/radius.ts +0 -8
  994. package/src/css/styles/radius/rules.ts +0 -13
  995. package/src/css/styles/radius/types.ts +0 -7
  996. package/src/css/styles/shadow/rules.ts +0 -53
  997. package/src/css/styles/width/index.ts +0 -2
  998. package/src/css/styles/width/rules.ts +0 -7
  999. package/src/css/styles/width/types.ts +0 -8
  1000. package/src/theme/system/_constants.ts +0 -25
  1001. package/src/theme/system/_types.ts +0 -41
  1002. package/src/theme/system/avatar.ts +0 -14
  1003. package/src/theme/system/color/_constants.ts +0 -41
  1004. package/src/theme/system/color/_helpers.ts +0 -23
  1005. package/src/theme/system/color/_system.ts +0 -40
  1006. package/src/theme/system/color/badge.ts +0 -20
  1007. package/src/theme/system/color/color.ts +0 -34
  1008. package/src/theme/system/css.ts +0 -9
  1009. package/src/theme/system/font.ts +0 -52
  1010. package/src/theme/system/index.ts +0 -14
  1011. package/src/theme/system/input.ts +0 -33
  1012. package/src/theme/system/theme.ts +0 -138
  1013. package/src/theme/system/v0/color/_generic.ts +0 -35
  1014. package/src/theme/system/v0/color/_system.ts +0 -13
  1015. package/src/theme/system/v0/color/color.ts +0 -39
  1016. package/src/theme/system/v0/color/index.ts +0 -11
  1017. package/src/theme/system/v0/color/input.ts +0 -34
  1018. package/src/theme/system/v0/color/spot.ts +0 -13
  1019. package/src/theme/system/v0/index.ts +0 -3
  1020. package/theme.js +0 -2
  1021. /package/src/css/{styles → aspects}/border/index.ts +0 -0
  1022. /package/src/css/{styles → aspects}/border/types.ts +0 -0
  1023. /package/src/css/{styles → aspects}/flex/index.ts +0 -0
  1024. /package/src/css/{styles → aspects}/flex/types.ts +0 -0
  1025. /package/src/css/{styles → aspects}/flexItem/index.ts +0 -0
  1026. /package/src/css/{styles → aspects}/font/index.ts +0 -0
  1027. /package/src/css/{styles → aspects}/gap/index.ts +0 -0
  1028. /package/src/css/{styles → aspects}/gridItem/index.ts +0 -0
  1029. /package/src/css/{styles → aspects}/gridItem/types.ts +0 -0
  1030. /package/src/css/{styles → aspects}/height/rules.ts +0 -0
  1031. /package/src/css/{styles → aspects}/margin/index.ts +0 -0
  1032. /package/src/css/{styles → aspects}/margin/types.ts +0 -0
  1033. /package/src/css/{styles → aspects}/maxWidth/index.ts +0 -0
  1034. /package/src/css/{styles → aspects}/maxWidth/maxWidth.ts +0 -0
  1035. /package/src/css/{styles → aspects}/padding/index.ts +0 -0
  1036. /package/src/css/{styles → aspects}/pointerEvents/index.ts +0 -0
  1037. /package/src/css/{styles → aspects}/pointerEvents/types.ts +0 -0
  1038. /package/src/css/{styles → aspects}/position/index.ts +0 -0
  1039. /package/src/css/{styles → aspects}/radius/index.ts +0 -0
  1040. /package/src/css/{styles → aspects}/width/width.ts +0 -0
  1041. /package/src/css/primitives/{selectable → _selectable}/index.ts +0 -0
  1042. /package/src/{core → css}/primitives/stack/index.ts +0 -0
  1043. /package/src/{core → css}/utils/srOnly/index.ts +0 -0
  1044. /package/src/theme/{system/v0 → v0}/avatar.ts +0 -0
  1045. /package/src/theme/{system/v0 → v0}/color/base.ts +0 -0
  1046. /package/src/theme/{system/v0 → v0}/color/button.ts +0 -0
  1047. /package/src/theme/{system/v0 → v0}/color/card.ts +0 -0
  1048. /package/src/theme/{system/v0 → v0}/color/muted.ts +0 -0
  1049. /package/src/theme/{system/v0 → v0}/color/selectable.ts +0 -0
  1050. /package/src/theme/{system/v0 → v0}/color/solid.ts +0 -0
  1051. /package/src/theme/{system → v0}/focusRing.ts +0 -0
  1052. /package/src/theme/{system/v0 → v0}/input.ts +0 -0
  1053. /package/src/theme/{system → v0}/layer.ts +0 -0
  1054. /package/src/theme/{system → v0}/shadow.ts +0 -0
  1055. /package/src/theme/{system → v0}/styles.ts +0 -0
  1056. /package/src/theme/{system → v2}/color/avatar.ts +0 -0
  1057. /package/src/theme/{system → v2}/color/button.ts +0 -0
  1058. /package/src/theme/{system → v2}/color/index.ts +0 -0
  1059. /package/src/theme/{system → v2}/color/input.ts +0 -0
  1060. /package/src/theme/{system → v2}/color/kbd.ts +0 -0
  1061. /package/src/theme/{system → v2}/color/selectable.ts +0 -0
  1062. /package/src/theme/{system → v2}/color/shadow.ts +0 -0
  1063. /package/src/theme/{system → v2}/color/state.ts +0 -0
  1064. /package/src/theme/{system → v2}/color/syntax.ts +0 -0
  1065. /package/src/{core → ui/_compat}/theme/types.ts +0 -0
  1066. /package/src/{core/components/autocomplete/__fixtures__ → ui/components/autocomplete/__mocks__}/countries.ts +0 -0
  1067. /package/src/{core → ui}/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -0
  1068. /package/src/{core → ui}/components/autocomplete/__workshop__/index.ts +0 -0
  1069. /package/src/{core → ui}/components/autocomplete/__workshop__/types.ts +0 -0
  1070. /package/src/{core → ui}/components/autocomplete/autocompleteReducer.ts +0 -0
  1071. /package/src/{core → ui}/components/autocomplete/constants.ts +0 -0
  1072. /package/src/{core → ui}/components/autocomplete/index.ts +0 -0
  1073. /package/src/{core → ui}/components/breadcrumbs/__workshop__/index.ts +0 -0
  1074. /package/src/{core → ui}/components/breadcrumbs/index.ts +0 -0
  1075. /package/src/{core → ui}/components/dialog/__workshop__/autoFocus.tsx +0 -0
  1076. /package/src/{core → ui}/components/dialog/__workshop__/index.ts +0 -0
  1077. /package/src/{core → ui}/components/dialog/__workshop__/layering.tsx +0 -0
  1078. /package/src/{core → ui}/components/dialog/__workshop__/provider.tsx +0 -0
  1079. /package/src/{core → ui}/components/dialog/dialogContext.ts +0 -0
  1080. /package/src/{core → ui}/components/dialog/index.ts +0 -0
  1081. /package/src/{core → ui}/components/hotkeys/__workshop__/index.ts +0 -0
  1082. /package/src/{core → ui}/components/hotkeys/__workshop__/plain.tsx +0 -0
  1083. /package/src/{core → ui}/components/hotkeys/index.ts +0 -0
  1084. /package/src/{core → ui}/components/index.ts +0 -0
  1085. /package/src/{core → ui}/components/menu/__workshop__/closableMenuButton.tsx +0 -0
  1086. /package/src/{core → ui}/components/menu/__workshop__/customMenuItem.tsx +0 -0
  1087. /package/src/{core → ui}/components/menu/__workshop__/disableFocusOnClose.tsx +0 -0
  1088. /package/src/{core → ui}/components/menu/__workshop__/groups.tsx +0 -0
  1089. /package/src/{core → ui}/components/menu/__workshop__/index.ts +0 -0
  1090. /package/src/{core → ui}/components/menu/__workshop__/menuGroupRight.tsx +0 -0
  1091. /package/src/{core → ui}/components/menu/__workshop__/nestedMenu.tsx +0 -0
  1092. /package/src/{core → ui}/components/menu/__workshop__/onCloseMenuButton.tsx +0 -0
  1093. /package/src/{core → ui}/components/menu/__workshop__/selectedItem.tsx +0 -0
  1094. /package/src/{core → ui}/components/menu/__workshop__/withoutArrow.tsx +0 -0
  1095. /package/src/{core → ui}/components/menu/helpers.ts +0 -0
  1096. /package/src/{core → ui}/components/menu/index.ts +0 -0
  1097. /package/src/{core → ui}/components/skeleton/__workshop__/index.ts +0 -0
  1098. /package/src/{core → ui}/components/skeleton/index.ts +0 -0
  1099. /package/src/{core → ui}/components/tab/__workshop__/example.tsx +0 -0
  1100. /package/src/{core → ui}/components/tab/__workshop__/index.ts +0 -0
  1101. /package/src/{core → ui}/components/tab/index.ts +0 -0
  1102. /package/src/{core → ui}/components/toast/__workshop__/index.ts +0 -0
  1103. /package/src/{core → ui}/components/toast/index.ts +0 -0
  1104. /package/src/{core → ui}/components/toast/toastContext.ts +0 -0
  1105. /package/src/{core → ui}/components/tree/__workshop__/basic.perf.ts +0 -0
  1106. /package/src/{core → ui}/components/tree/__workshop__/index.ts +0 -0
  1107. /package/src/{core → ui}/components/tree/helpers.ts +0 -0
  1108. /package/src/{core → ui}/components/tree/index.ts +0 -0
  1109. /package/src/{core → ui}/components/tree/treeContext.ts +0 -0
  1110. /package/src/{core → ui}/components/tree/types.ts +0 -0
  1111. /package/src/{core → ui}/global.ts +0 -0
  1112. /package/src/{core → ui}/helpers/animation.ts +0 -0
  1113. /package/src/{core → ui}/helpers/element.ts +0 -0
  1114. /package/src/{core → ui}/helpers/scroll.ts +0 -0
  1115. /package/src/{core → ui}/hooks/index.ts +0 -0
  1116. /package/src/{core → ui}/hooks/useCustomValidity.ts +0 -0
  1117. /package/src/{core → ui}/hooks/useElementRect/__workshop__/index.ts +0 -0
  1118. /package/src/{core → ui}/hooks/useElementRect/index.ts +0 -0
  1119. /package/src/{core → ui}/hooks/useElementRect/useElementRect.ts +0 -0
  1120. /package/src/{core → ui}/hooks/useIsomorphicEffect.ts +0 -0
  1121. /package/src/{core → ui}/hooks/useMediaIndex/__workshop__/index.ts +0 -0
  1122. /package/src/{core → ui}/hooks/useMediaIndex/__workshop__/test.tsx +0 -0
  1123. /package/src/{core → ui}/hooks/useMediaIndex/index.ts +0 -0
  1124. /package/src/{core → ui}/hooks/useMounted.ts +0 -0
  1125. /package/src/{core → ui}/lib/isRecord.ts +0 -0
  1126. /package/src/{core → ui}/middleware/origin.ts +0 -0
  1127. /package/src/{core → ui}/observers/elementSizeObserver.ts +0 -0
  1128. /package/src/{core → ui}/observers/index.ts +0 -0
  1129. /package/src/{core → ui}/observers/resizeObserver.ts +0 -0
  1130. /package/src/{core → ui}/primitives/_selectable/index.ts +0 -0
  1131. /package/src/{core → ui}/primitives/avatar/__workshop__/index.ts +0 -0
  1132. /package/src/{core → ui}/primitives/avatar/index.ts +0 -0
  1133. /package/src/{core → ui}/primitives/badge/__workshop__/index.ts +0 -0
  1134. /package/src/{core → ui}/primitives/badge/index.ts +0 -0
  1135. /package/src/{core → ui}/primitives/badge/types.ts +0 -0
  1136. /package/src/{core → ui}/primitives/box/__workshop__/index.ts +0 -0
  1137. /package/src/{core → ui}/primitives/box/__workshop__/responsive.tsx +0 -0
  1138. /package/src/{core → ui}/primitives/box/index.ts +0 -0
  1139. /package/src/{core → ui}/primitives/button/__workshop__/customIcons.tsx +0 -0
  1140. /package/src/{core → ui}/primitives/button/__workshop__/index.ts +0 -0
  1141. /package/src/{core → ui}/primitives/button/__workshop__/mixedChildren.tsx +0 -0
  1142. /package/src/{core → ui}/primitives/button/__workshop__/uploadButton.tsx +0 -0
  1143. /package/src/{core → ui}/primitives/button/index.ts +0 -0
  1144. /package/src/{core → ui}/primitives/card/__workshop__/index.ts +0 -0
  1145. /package/src/{core → ui}/primitives/checkbox/__workshop__/example.tsx +0 -0
  1146. /package/src/{core → ui}/primitives/checkbox/__workshop__/index.ts +0 -0
  1147. /package/src/{core → ui}/primitives/checkbox/__workshop__/props.tsx +0 -0
  1148. /package/src/{core → ui}/primitives/checkbox/__workshop__/readOnly.tsx +0 -0
  1149. /package/src/{core → ui}/primitives/checkbox/index.ts +0 -0
  1150. /package/src/{core → ui}/primitives/code/__workshop__/index.ts +0 -0
  1151. /package/src/{core → ui}/primitives/code/__workshop__/opticalAlignment.tsx +0 -0
  1152. /package/src/{core → ui}/primitives/code/index.ts +0 -0
  1153. /package/src/{core → ui}/primitives/container/__workshop__/index.ts +0 -0
  1154. /package/src/{core → ui}/primitives/container/index.ts +0 -0
  1155. /package/src/{core → ui}/primitives/container/types.ts +0 -0
  1156. /package/src/{core → ui}/primitives/flex/__workshop__/index.ts +0 -0
  1157. /package/src/{core → ui}/primitives/flex/index.ts +0 -0
  1158. /package/src/{core → ui}/primitives/grid/__workshop__/index.ts +0 -0
  1159. /package/src/{core → ui}/primitives/grid/index.ts +0 -0
  1160. /package/src/{core → ui}/primitives/heading/__workshop__/index.ts +0 -0
  1161. /package/src/{core → ui}/primitives/heading/index.ts +0 -0
  1162. /package/src/{core → ui}/primitives/index.ts +0 -0
  1163. /package/src/{core → ui}/primitives/inline/__workshop__/index.ts +0 -0
  1164. /package/src/{core → ui}/primitives/inline/index.ts +0 -0
  1165. /package/src/{core → ui}/primitives/inline/types.ts +0 -0
  1166. /package/src/{core → ui}/primitives/kbd/__workshop__/index.ts +0 -0
  1167. /package/src/{core → ui}/primitives/kbd/__workshop__/plain.tsx +0 -0
  1168. /package/src/{core/primitives/kbd/index.tsx → ui/primitives/kbd/index.ts} +0 -0
  1169. /package/src/{core → ui}/primitives/label/__workshop__/index.ts +0 -0
  1170. /package/src/{core → ui}/primitives/label/index.ts +0 -0
  1171. /package/src/{core → ui}/primitives/popover/__workshop__/MarginsStory.tsx +0 -0
  1172. /package/src/{core → ui}/primitives/popover/__workshop__/RecursiveStory.tsx +0 -0
  1173. /package/src/{core → ui}/primitives/popover/__workshop__/index.ts +0 -0
  1174. /package/src/{core → ui}/primitives/popover/constants.ts +0 -0
  1175. /package/src/{core → ui}/primitives/popover/index.ts +0 -0
  1176. /package/src/{core → ui}/primitives/popover/types.ts +0 -0
  1177. /package/src/{core → ui}/primitives/radio/__workshop__/example.tsx +0 -0
  1178. /package/src/{core → ui}/primitives/radio/__workshop__/index.ts +0 -0
  1179. /package/src/{core → ui}/primitives/radio/index.ts +0 -0
  1180. /package/src/{core → ui}/primitives/select/__workshop__/index.ts +0 -0
  1181. /package/src/{core → ui}/primitives/select/index.ts +0 -0
  1182. /package/src/{core → ui}/primitives/spinner/__workshop__/index.ts +0 -0
  1183. /package/src/{core → ui}/primitives/spinner/index.ts +0 -0
  1184. /package/src/{core → ui}/primitives/stack/__workshop__/index.ts +0 -0
  1185. /package/src/{core → ui}/primitives/switch/__workshop__/example.tsx +0 -0
  1186. /package/src/{core → ui}/primitives/switch/__workshop__/index.ts +0 -0
  1187. /package/src/{core → ui}/primitives/switch/__workshop__/props.tsx +0 -0
  1188. /package/src/{core → ui}/primitives/switch/index.ts +0 -0
  1189. /package/src/{core → ui}/primitives/text/__workshop__/index.ts +0 -0
  1190. /package/src/{core → ui}/primitives/text/index.ts +0 -0
  1191. /package/src/{core → ui}/primitives/textArea/__workshop__/index.ts +0 -0
  1192. /package/src/{core → ui}/primitives/textArea/index.ts +0 -0
  1193. /package/src/{core → ui}/primitives/textInput/__workshop__/clearButton.tsx +0 -0
  1194. /package/src/{core → ui}/primitives/textInput/__workshop__/customValidity.tsx +0 -0
  1195. /package/src/{core → ui}/primitives/textInput/__workshop__/states.tsx +0 -0
  1196. /package/src/{core → ui}/primitives/textInput/index.ts +0 -0
  1197. /package/src/{core → ui}/primitives/tooltip/__workshop__/index.ts +0 -0
  1198. /package/src/{core → ui}/primitives/tooltip/constants.ts +0 -0
  1199. /package/src/{core → ui}/primitives/tooltip/index.ts +0 -0
  1200. /package/src/{core → ui}/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +0 -0
  1201. /package/src/{core → ui}/types/avatar.ts +0 -0
  1202. /package/src/{core → ui}/types/badge.ts +0 -0
  1203. /package/src/{core → ui}/types/card.ts +0 -0
  1204. /package/src/{core → ui}/types/dialog.ts +0 -0
  1205. /package/src/{core → ui}/types/placement.ts +0 -0
  1206. /package/src/{core → ui}/types/popover.ts +0 -0
  1207. /package/src/{core → ui}/types/radius.ts +0 -0
  1208. /package/src/{core → ui}/utils/arrow/cmds.ts +0 -0
  1209. /package/src/{core → ui}/utils/arrow/index.ts +0 -0
  1210. /package/src/{core → ui}/utils/boundaryElement/__workshop__/index.ts +0 -0
  1211. /package/src/{core → ui}/utils/boundaryElement/__workshop__/plain.tsx +0 -0
  1212. /package/src/{core → ui}/utils/boundaryElement/boundaryElementContext.ts +0 -0
  1213. /package/src/{core → ui}/utils/boundaryElement/types.ts +0 -0
  1214. /package/src/{core → ui}/utils/conditionalWrapper/index.ts +0 -0
  1215. /package/src/{core → ui}/utils/elementQuery/__workshop__/index.ts +0 -0
  1216. /package/src/{core → ui}/utils/elementQuery/helpers.ts +0 -0
  1217. /package/src/{core → ui}/utils/elementQuery/index.ts +0 -0
  1218. /package/src/{core → ui}/utils/index.ts +0 -0
  1219. /package/src/{core → ui}/utils/layer/__workshop__/_debug.tsx +0 -0
  1220. /package/src/{core → ui}/utils/layer/__workshop__/index.ts +0 -0
  1221. /package/src/{core → ui}/utils/layer/getLayerContext.test.ts +0 -0
  1222. /package/src/{core → ui}/utils/layer/getLayerContext.ts +0 -0
  1223. /package/src/{core → ui}/utils/layer/layerContext.ts +0 -0
  1224. /package/src/{core → ui}/utils/layer/types.ts +0 -0
  1225. /package/src/{core → ui}/utils/portal/__workshop__/index.ts +0 -0
  1226. /package/src/{core → ui}/utils/portal/__workshop__/named.tsx +0 -0
  1227. /package/src/{core → ui}/utils/portal/index.ts +0 -0
  1228. /package/src/{core → ui}/utils/portal/portalContext.ts +0 -0
  1229. /package/src/{core → ui}/utils/portal/types.ts +0 -0
  1230. /package/src/{core → ui}/utils/virtualList/__workshop__/changingProps.tsx +0 -0
  1231. /package/src/{core → ui}/utils/virtualList/__workshop__/elementScroll.tsx +0 -0
  1232. /package/src/{core → ui}/utils/virtualList/__workshop__/index.ts +0 -0
  1233. /package/src/{core → ui}/utils/virtualList/__workshop__/infiniteList.tsx +0 -0
  1234. /package/src/{core → ui}/utils/virtualList/__workshop__/windowScrolll.tsx +0 -0
  1235. /package/src/{core → ui}/utils/virtualList/index.ts +0 -0
package/dist/theme.esm.js DELETED
@@ -1,3088 +0,0 @@
1
- import { defaultThemeConfig, themeColor_v0_v2 } from "./_legacy/getTheme_v2.esm.js";
2
- import { getTheme_v2 } from "./_legacy/getTheme_v2.esm.js";
3
- import { COLOR_HUES, COLOR_TINTS, color } from "@sanity/color";
4
- function createSelectableTones(opts, base, dark, solid, muted) {
5
- return {
6
- default: _createSelectableStates(opts, base, dark, solid, muted, "default"),
7
- primary: _createSelectableStates(opts, base, dark, solid, muted, "primary"),
8
- positive: _createSelectableStates(opts, base, dark, solid, muted, "positive"),
9
- caution: _createSelectableStates(opts, base, dark, solid, muted, "caution"),
10
- critical: _createSelectableStates(opts, base, dark, solid, muted, "critical")
11
- };
12
- }
13
- function _createSelectableStates(opts, base, dark, solid, muted, tone) {
14
- return {
15
- enabled: opts.selectable({
16
- base,
17
- dark,
18
- solid,
19
- muted,
20
- state: "enabled",
21
- tone
22
- }),
23
- hovered: opts.selectable({
24
- base,
25
- dark,
26
- solid,
27
- muted,
28
- state: "hovered",
29
- tone
30
- }),
31
- pressed: opts.selectable({
32
- base,
33
- dark,
34
- solid,
35
- muted,
36
- state: "pressed",
37
- tone
38
- }),
39
- selected: opts.selectable({
40
- base,
41
- dark,
42
- solid,
43
- muted,
44
- state: "selected",
45
- tone
46
- }),
47
- disabled: opts.selectable({
48
- base,
49
- dark,
50
- solid,
51
- muted,
52
- state: "disabled",
53
- tone
54
- })
55
- };
56
- }
57
- function createSolidTones(opts, base, dark, name) {
58
- return {
59
- default: {
60
- enabled: opts.solid({ base, dark, tone: "default", name, state: "enabled" }),
61
- disabled: opts.solid({ base, dark, tone: "default", name, state: "disabled" }),
62
- hovered: opts.solid({ base, dark, tone: "default", name, state: "hovered" }),
63
- pressed: opts.solid({ base, dark, tone: "default", name, state: "pressed" }),
64
- selected: opts.solid({ base, dark, tone: "default", name, state: "selected" })
65
- },
66
- transparent: {
67
- enabled: opts.solid({ base, dark, tone: "transparent", name, state: "enabled" }),
68
- disabled: opts.solid({ base, dark, tone: "transparent", name, state: "disabled" }),
69
- hovered: opts.solid({ base, dark, tone: "transparent", name, state: "hovered" }),
70
- pressed: opts.solid({ base, dark, tone: "transparent", name, state: "pressed" }),
71
- selected: opts.solid({ base, dark, tone: "transparent", name, state: "selected" })
72
- },
73
- primary: {
74
- enabled: opts.solid({ base, dark, tone: "primary", name, state: "enabled" }),
75
- disabled: opts.solid({ base, dark, tone: "primary", name, state: "disabled" }),
76
- hovered: opts.solid({ base, dark, tone: "primary", name, state: "hovered" }),
77
- pressed: opts.solid({ base, dark, tone: "primary", name, state: "pressed" }),
78
- selected: opts.solid({ base, dark, tone: "primary", name, state: "selected" })
79
- },
80
- positive: {
81
- enabled: opts.solid({ base, dark, tone: "positive", name, state: "enabled" }),
82
- disabled: opts.solid({ base, dark, tone: "positive", name, state: "disabled" }),
83
- hovered: opts.solid({ base, dark, tone: "positive", name, state: "hovered" }),
84
- pressed: opts.solid({ base, dark, tone: "positive", name, state: "pressed" }),
85
- selected: opts.solid({ base, dark, tone: "positive", name, state: "selected" })
86
- },
87
- caution: {
88
- enabled: opts.solid({ base, dark, tone: "caution", name, state: "enabled" }),
89
- disabled: opts.solid({ base, dark, tone: "caution", name, state: "disabled" }),
90
- hovered: opts.solid({ base, dark, tone: "caution", name, state: "hovered" }),
91
- pressed: opts.solid({ base, dark, tone: "caution", name, state: "pressed" }),
92
- selected: opts.solid({ base, dark, tone: "caution", name, state: "selected" })
93
- },
94
- critical: {
95
- enabled: opts.solid({ base, dark, tone: "critical", name, state: "enabled" }),
96
- disabled: opts.solid({ base, dark, tone: "critical", name, state: "disabled" }),
97
- hovered: opts.solid({ base, dark, tone: "critical", name, state: "hovered" }),
98
- pressed: opts.solid({ base, dark, tone: "critical", name, state: "pressed" }),
99
- selected: opts.solid({ base, dark, tone: "critical", name, state: "selected" })
100
- }
101
- };
102
- }
103
- function createButtonTones(opts, base, dark, solid, muted, mode) {
104
- return {
105
- default: opts.button({
106
- base,
107
- dark,
108
- solid: solid.default,
109
- muted: muted.default,
110
- mode
111
- }),
112
- primary: opts.button({
113
- base,
114
- dark,
115
- solid: solid.primary,
116
- muted: muted.primary,
117
- mode
118
- }),
119
- positive: opts.button({
120
- base,
121
- dark,
122
- solid: solid.positive,
123
- muted: muted.positive,
124
- mode
125
- }),
126
- caution: opts.button({
127
- base,
128
- dark,
129
- solid: solid.caution,
130
- muted: muted.caution,
131
- mode
132
- }),
133
- critical: opts.button({
134
- base,
135
- dark,
136
- solid: solid.critical,
137
- muted: muted.critical,
138
- mode
139
- })
140
- };
141
- }
142
- function createButtonModes(opts, base, dark, solid, muted) {
143
- return {
144
- default: createButtonTones(opts, base, dark, solid, muted, "default"),
145
- ghost: createButtonTones(opts, base, dark, solid, muted, "ghost"),
146
- bleed: createButtonTones(opts, base, dark, solid, muted, "bleed")
147
- };
148
- }
149
- function createCardStates(opts, base, dark, name, solid, muted) {
150
- return {
151
- enabled: opts.card({
152
- base,
153
- dark,
154
- name,
155
- state: "enabled",
156
- solid,
157
- muted
158
- }),
159
- disabled: opts.card({
160
- base,
161
- dark,
162
- name,
163
- state: "disabled",
164
- solid,
165
- muted
166
- }),
167
- hovered: opts.card({
168
- base,
169
- dark,
170
- name,
171
- state: "hovered",
172
- solid,
173
- muted
174
- }),
175
- pressed: opts.card({
176
- base,
177
- dark,
178
- name,
179
- state: "pressed",
180
- solid,
181
- muted
182
- }),
183
- selected: opts.card({
184
- base,
185
- dark,
186
- name,
187
- state: "selected",
188
- solid,
189
- muted
190
- })
191
- };
192
- }
193
- const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
194
- default: {
195
- lightest: "hsl(0, 0%, 95%)",
196
- lighter: "hsl(0, 0%, 70%)",
197
- light: "hsl(0, 0%, 65%)",
198
- base: "hsl(0, 0%, 50%)",
199
- dark: "hsl(0, 0%, 35%)",
200
- darker: "hsl(0, 0%, 20%)",
201
- darkest: "hsl(0, 0%, 5%)"
202
- },
203
- transparent: {
204
- lightest: "hsl(240, 100%, 95%)",
205
- lighter: "hsl(240, 100%, 70%)",
206
- light: "hsl(240, 100%, 65%)",
207
- base: "hsl(240, 100%, 50%)",
208
- dark: "hsl(240, 100%, 35%)",
209
- darker: "hsl(240, 100%, 20%)",
210
- darkest: "hsl(240, 100%, 5%)"
211
- },
212
- primary: {
213
- lightest: "hsl(240, 100%, 95%)",
214
- lighter: "hsl(240, 100%, 70%)",
215
- light: "hsl(240, 100%, 65%)",
216
- base: "hsl(240, 100%, 50%)",
217
- dark: "hsl(240, 100%, 35%)",
218
- darker: "hsl(240, 100%, 20%)",
219
- darkest: "hsl(240, 100%, 5%)"
220
- },
221
- positive: {
222
- lightest: "hsl(120, 100%, 95%)",
223
- lighter: "hsl(120, 100%, 70%)",
224
- light: "hsl(120, 100%, 65%)",
225
- base: "hsl(120, 100%, 50%)",
226
- dark: "hsl(120, 100%, 35%)",
227
- darker: "hsl(120, 100%, 20%)",
228
- darkest: "hsl(120, 100%, 5%)"
229
- },
230
- caution: {
231
- lightest: "hsl(60, 100%, 95%)",
232
- lighter: "hsl(60, 100%, 70%)",
233
- light: "hsl(60, 100%, 65%)",
234
- base: "hsl(60, 100%, 50%)",
235
- dark: "hsl(60, 100%, 35%)",
236
- darker: "hsl(60, 100%, 20%)",
237
- darkest: "hsl(60, 100%, 5%)"
238
- },
239
- critical: {
240
- lightest: "hsl(0, 100%, 95%)",
241
- lighter: "hsl(0, 100%, 70%)",
242
- light: "hsl(0, 100%, 65%)",
243
- base: "hsl(0, 100%, 50%)",
244
- dark: "hsl(0, 100%, 35%)",
245
- darker: "hsl(0, 100%, 20%)",
246
- darkest: "hsl(0, 100%, 5%)"
247
- }
248
- }, spots = {
249
- gray: "hsl(0, 0%, 50%)",
250
- red: "hsl(0, 100%, 50%)",
251
- orange: "hsl(30, 100%, 50%)",
252
- yellow: "hsl(60, 100%, 50%)",
253
- green: "hsl(120, 100%, 50%)",
254
- cyan: "hsl(180, 100%, 50%)",
255
- blue: "hsl(240, 100%, 50%)",
256
- purple: "hsl(270, 100%, 50%)",
257
- magenta: "hsl(300, 100%, 50%)"
258
- }, tones = {
259
- transparent: {
260
- bg: [colors.transparent.darkest, colors.transparent.lightest],
261
- fg: [colors.transparent.lightest, colors.transparent.darkest],
262
- border: [colors.transparent.darker, colors.transparent.lighter],
263
- focusRing: [colors.transparent.base, colors.transparent.base]
264
- },
265
- primary: {
266
- bg: [colors.primary.darkest, colors.primary.lightest],
267
- fg: [colors.primary.lightest, colors.primary.darkest],
268
- border: [colors.primary.darker, colors.primary.lighter],
269
- focusRing: [colors.primary.base, colors.primary.base]
270
- },
271
- positive: {
272
- bg: [colors.positive.darkest, colors.positive.lightest],
273
- fg: [colors.positive.lightest, colors.positive.darkest],
274
- border: [colors.positive.darker, colors.positive.lighter],
275
- focusRing: [colors.positive.base, colors.positive.base]
276
- },
277
- caution: {
278
- bg: [colors.caution.darkest, colors.caution.lightest],
279
- fg: [colors.caution.lightest, colors.caution.darkest],
280
- border: [colors.caution.darker, colors.caution.lighter],
281
- focusRing: [colors.caution.base, colors.caution.base]
282
- },
283
- critical: {
284
- bg: [colors.critical.darkest, colors.critical.lightest],
285
- fg: [colors.critical.lightest, colors.critical.darkest],
286
- border: [colors.critical.darker, colors.critical.lighter],
287
- focusRing: [colors.critical.base, colors.critical.base]
288
- }
289
- }, defaultOpts = {
290
- base: ({ dark, name }) => name === "default" ? {
291
- bg: dark ? black : white,
292
- fg: dark ? white : black,
293
- border: dark ? colors.default.darkest : colors.default.lightest,
294
- focusRing: colors.primary.base,
295
- shadow: {
296
- outline: black,
297
- umbra: black,
298
- penumbra: black,
299
- ambient: black
300
- },
301
- skeleton: {
302
- from: dark ? white : black,
303
- to: dark ? white : black
304
- }
305
- } : {
306
- bg: tones[name].bg[dark ? 0 : 1],
307
- fg: tones[name].fg[dark ? 0 : 1],
308
- border: tones[name].border[dark ? 0 : 1],
309
- focusRing: tones[name].focusRing[dark ? 0 : 1],
310
- shadow: {
311
- outline: black,
312
- umbra: black,
313
- penumbra: black,
314
- ambient: black
315
- },
316
- skeleton: {
317
- from: dark ? white : black,
318
- to: dark ? white : black
319
- }
320
- },
321
- solid: ({ base, dark, state, tone }) => {
322
- const color2 = colors[tone];
323
- return state === "hovered" ? {
324
- bg: dark ? color2.light : color2.dark,
325
- bg2: dark ? color2.light : color2.dark,
326
- border: dark ? color2.lighter : color2.darker,
327
- fg: dark ? color2.darkest : color2.lightest,
328
- icon: dark ? color2.darkest : color2.lightest,
329
- muted: {
330
- fg: black
331
- },
332
- accent: {
333
- fg: black
334
- },
335
- link: {
336
- fg: black
337
- },
338
- code: {
339
- bg: black,
340
- fg: black
341
- },
342
- skeleton: base.skeleton
343
- } : {
344
- bg: color2.base,
345
- bg2: color2.base,
346
- border: dark ? color2.light : color2.dark,
347
- fg: dark ? color2.darkest : color2.lightest,
348
- icon: dark ? color2.darkest : color2.lightest,
349
- muted: {
350
- fg: black
351
- },
352
- accent: {
353
- fg: black
354
- },
355
- link: {
356
- fg: black
357
- },
358
- code: {
359
- bg: black,
360
- fg: black
361
- },
362
- skeleton: base.skeleton
363
- };
364
- },
365
- muted: ({ base, dark, state, tone }) => {
366
- const color2 = colors[tone];
367
- return state === "hovered" ? {
368
- bg: dark ? color2.darker : color2.lighter,
369
- bg2: dark ? color2.darker : color2.lighter,
370
- border: dark ? color2.lighter : color2.darker,
371
- fg: dark ? color2.lightest : color2.darkest,
372
- icon: dark ? color2.lightest : color2.darkest,
373
- muted: {
374
- fg: black
375
- },
376
- accent: {
377
- fg: black
378
- },
379
- link: {
380
- fg: black
381
- },
382
- code: {
383
- bg: black,
384
- fg: black
385
- },
386
- skeleton: base.skeleton
387
- } : {
388
- bg: dark ? color2.darkest : color2.lightest,
389
- bg2: dark ? color2.darkest : color2.lightest,
390
- border: dark ? color2.darker : color2.lighter,
391
- fg: dark ? color2.lighter : color2.darker,
392
- icon: dark ? color2.lighter : color2.darker,
393
- muted: {
394
- fg: black
395
- },
396
- accent: {
397
- fg: black
398
- },
399
- link: {
400
- fg: black
401
- },
402
- code: {
403
- bg: black,
404
- fg: black
405
- },
406
- skeleton: base.skeleton
407
- };
408
- },
409
- button: ({ base, mode, muted, solid }) => mode === "bleed" ? {
410
- ...muted,
411
- enabled: {
412
- bg: "transparent",
413
- bg2: "transparent",
414
- fg: muted.enabled.fg,
415
- icon: muted.enabled.fg,
416
- border: "transparent",
417
- muted: {
418
- fg: black
419
- },
420
- accent: {
421
- fg: black
422
- },
423
- link: {
424
- fg: black
425
- },
426
- code: {
427
- bg: black,
428
- fg: black
429
- },
430
- skeleton: base.skeleton
431
- },
432
- hovered: {
433
- bg: muted.enabled.bg,
434
- bg2: muted.enabled.bg,
435
- fg: muted.hovered.fg,
436
- icon: muted.hovered.fg,
437
- border: "transparent",
438
- muted: {
439
- fg: black
440
- },
441
- accent: {
442
- fg: black
443
- },
444
- link: {
445
- fg: black
446
- },
447
- code: {
448
- bg: black,
449
- fg: black
450
- },
451
- skeleton: base.skeleton
452
- }
453
- } : mode === "ghost" ? {
454
- ...solid,
455
- enabled: muted.enabled
456
- } : solid,
457
- card: ({ base }) => ({
458
- bg: black,
459
- bg2: black,
460
- fg: black,
461
- icon: black,
462
- border: black,
463
- muted: {
464
- fg: black
465
- },
466
- accent: {
467
- fg: black
468
- },
469
- link: {
470
- fg: black
471
- },
472
- code: {
473
- bg: black,
474
- fg: black
475
- },
476
- skeleton: base.skeleton
477
- }),
478
- input: () => ({
479
- bg: black,
480
- bg2: black,
481
- fg: black,
482
- border: black,
483
- placeholder: black
484
- }),
485
- selectable: ({ muted, state, tone }) => muted[tone][state],
486
- spot: ({ key }) => spots[key],
487
- syntax: () => ({
488
- atrule: black,
489
- attrName: black,
490
- attrValue: black,
491
- attribute: black,
492
- boolean: black,
493
- builtin: black,
494
- cdata: black,
495
- char: black,
496
- class: black,
497
- className: black,
498
- comment: black,
499
- constant: black,
500
- deleted: black,
501
- doctype: black,
502
- entity: black,
503
- function: black,
504
- hexcode: black,
505
- id: black,
506
- important: black,
507
- inserted: black,
508
- keyword: black,
509
- number: black,
510
- operator: black,
511
- prolog: black,
512
- property: black,
513
- pseudoClass: black,
514
- pseudoElement: black,
515
- punctuation: black,
516
- regex: black,
517
- selector: black,
518
- string: black,
519
- symbol: black,
520
- tag: black,
521
- unit: black,
522
- url: black,
523
- variable: black
524
- })
525
- };
526
- function createInputModes(opts, base, dark, solid, muted) {
527
- return {
528
- default: {
529
- enabled: opts.input({
530
- base,
531
- dark,
532
- mode: "default",
533
- state: "enabled",
534
- solid: solid.default,
535
- muted: muted.default
536
- }),
537
- disabled: opts.input({
538
- base,
539
- dark,
540
- mode: "default",
541
- state: "disabled",
542
- solid: solid.default,
543
- muted: muted.default
544
- }),
545
- hovered: opts.input({
546
- base,
547
- dark,
548
- mode: "default",
549
- state: "hovered",
550
- solid: solid.default,
551
- muted: muted.default
552
- }),
553
- readOnly: opts.input({
554
- base,
555
- dark,
556
- mode: "default",
557
- state: "readOnly",
558
- solid: solid.default,
559
- muted: muted.default
560
- })
561
- },
562
- invalid: {
563
- enabled: opts.input({
564
- base,
565
- dark,
566
- mode: "invalid",
567
- state: "enabled",
568
- solid: solid.default,
569
- muted: muted.default
570
- }),
571
- disabled: opts.input({
572
- base,
573
- dark,
574
- mode: "invalid",
575
- state: "disabled",
576
- solid: solid.default,
577
- muted: muted.default
578
- }),
579
- hovered: opts.input({
580
- base,
581
- dark,
582
- mode: "invalid",
583
- state: "hovered",
584
- solid: solid.default,
585
- muted: muted.default
586
- }),
587
- readOnly: opts.input({
588
- base,
589
- dark,
590
- mode: "invalid",
591
- state: "readOnly",
592
- solid: solid.default,
593
- muted: muted.default
594
- })
595
- }
596
- };
597
- }
598
- function createMutedTones(opts, base, dark, name) {
599
- return {
600
- default: {
601
- enabled: opts.muted({ base, dark, tone: "default", name, state: "enabled" }),
602
- disabled: opts.muted({ base, dark, tone: "default", name, state: "disabled" }),
603
- hovered: opts.muted({ base, dark, tone: "default", name, state: "hovered" }),
604
- pressed: opts.muted({ base, dark, tone: "default", name, state: "pressed" }),
605
- selected: opts.muted({ base, dark, tone: "default", name, state: "selected" })
606
- },
607
- transparent: {
608
- enabled: opts.muted({ base, dark, tone: "transparent", name, state: "enabled" }),
609
- disabled: opts.muted({ base, dark, tone: "transparent", name, state: "disabled" }),
610
- hovered: opts.muted({ base, dark, tone: "transparent", name, state: "hovered" }),
611
- pressed: opts.muted({ base, dark, tone: "transparent", name, state: "pressed" }),
612
- selected: opts.muted({ base, dark, tone: "transparent", name, state: "selected" })
613
- },
614
- primary: {
615
- enabled: opts.muted({ base, dark, tone: "primary", name, state: "enabled" }),
616
- disabled: opts.muted({ base, dark, tone: "primary", name, state: "disabled" }),
617
- hovered: opts.muted({ base, dark, tone: "primary", name, state: "hovered" }),
618
- pressed: opts.muted({ base, dark, tone: "primary", name, state: "pressed" }),
619
- selected: opts.muted({ base, dark, tone: "primary", name, state: "selected" })
620
- },
621
- positive: {
622
- enabled: opts.muted({ base, dark, tone: "positive", name, state: "enabled" }),
623
- disabled: opts.muted({ base, dark, tone: "positive", name, state: "disabled" }),
624
- hovered: opts.muted({ base, dark, tone: "positive", name, state: "hovered" }),
625
- pressed: opts.muted({ base, dark, tone: "positive", name, state: "pressed" }),
626
- selected: opts.muted({ base, dark, tone: "positive", name, state: "selected" })
627
- },
628
- caution: {
629
- enabled: opts.muted({ base, dark, tone: "caution", name, state: "enabled" }),
630
- disabled: opts.muted({ base, dark, tone: "caution", name, state: "disabled" }),
631
- hovered: opts.muted({ base, dark, tone: "caution", name, state: "hovered" }),
632
- pressed: opts.muted({ base, dark, tone: "caution", name, state: "pressed" }),
633
- selected: opts.muted({ base, dark, tone: "caution", name, state: "selected" })
634
- },
635
- critical: {
636
- enabled: opts.muted({ base, dark, tone: "critical", name, state: "enabled" }),
637
- disabled: opts.muted({ base, dark, tone: "critical", name, state: "disabled" }),
638
- hovered: opts.muted({ base, dark, tone: "critical", name, state: "hovered" }),
639
- pressed: opts.muted({ base, dark, tone: "critical", name, state: "pressed" }),
640
- selected: opts.muted({ base, dark, tone: "critical", name, state: "selected" })
641
- }
642
- };
643
- }
644
- function createSpot(opts, base, dark) {
645
- return {
646
- gray: opts.spot({ base, dark, key: "gray" }),
647
- blue: opts.spot({ base, dark, key: "blue" }),
648
- purple: opts.spot({ base, dark, key: "purple" }),
649
- magenta: opts.spot({ base, dark, key: "magenta" }),
650
- red: opts.spot({ base, dark, key: "red" }),
651
- orange: opts.spot({ base, dark, key: "orange" }),
652
- yellow: opts.spot({ base, dark, key: "yellow" }),
653
- green: opts.spot({ base, dark, key: "green" }),
654
- cyan: opts.spot({ base, dark, key: "cyan" })
655
- };
656
- }
657
- function createColorTheme(partialOpts = {}) {
658
- const builders = { ...defaultOpts, ...partialOpts };
659
- return {
660
- light: _createColorScheme(builders, !1),
661
- dark: _createColorScheme(builders, !0)
662
- };
663
- }
664
- function _createColorScheme(opts, dark) {
665
- return {
666
- default: _createColor(opts, dark, "default"),
667
- transparent: _createColor(opts, dark, "transparent"),
668
- primary: _createColor(opts, dark, "primary"),
669
- positive: _createColor(opts, dark, "positive"),
670
- caution: _createColor(opts, dark, "caution"),
671
- critical: _createColor(opts, dark, "critical")
672
- };
673
- }
674
- function _createColor(opts, dark, name) {
675
- const base = opts.base({ dark, name }), solid = createSolidTones(opts, base, dark, name), muted = createMutedTones(opts, base, dark, name);
676
- return {
677
- base,
678
- button: createButtonModes(opts, base, dark, solid, muted),
679
- card: createCardStates(opts, base, dark, name, solid, muted),
680
- dark,
681
- input: createInputModes(opts, base, dark, solid, muted),
682
- selectable: createSelectableTones(opts, base, dark, solid, muted),
683
- spot: createSpot(opts, base, dark),
684
- syntax: opts.syntax({ base, dark }),
685
- solid,
686
- muted
687
- };
688
- }
689
- const defaultThemeFonts = {
690
- code: {
691
- family: "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
692
- weights: {
693
- regular: 400,
694
- medium: 500,
695
- semibold: 600,
696
- bold: 700
697
- },
698
- sizes: [
699
- {
700
- ascenderHeight: 4,
701
- descenderHeight: 4,
702
- fontSize: 10,
703
- iconSize: 17,
704
- lineHeight: 15,
705
- letterSpacing: 0
706
- },
707
- {
708
- ascenderHeight: 5,
709
- descenderHeight: 5,
710
- fontSize: 13,
711
- iconSize: 21,
712
- lineHeight: 19,
713
- letterSpacing: 0
714
- },
715
- {
716
- ascenderHeight: 6,
717
- descenderHeight: 6,
718
- fontSize: 16,
719
- iconSize: 25,
720
- lineHeight: 23,
721
- letterSpacing: 0
722
- },
723
- {
724
- ascenderHeight: 7,
725
- descenderHeight: 7,
726
- fontSize: 19,
727
- iconSize: 29,
728
- lineHeight: 27,
729
- letterSpacing: 0
730
- },
731
- {
732
- ascenderHeight: 8,
733
- descenderHeight: 8,
734
- fontSize: 22,
735
- iconSize: 33,
736
- lineHeight: 31,
737
- letterSpacing: 0
738
- }
739
- ]
740
- },
741
- heading: {
742
- family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
743
- weights: {
744
- regular: 700,
745
- medium: 800,
746
- semibold: 900,
747
- bold: 900
748
- },
749
- sizes: [
750
- {
751
- ascenderHeight: 5,
752
- descenderHeight: 5,
753
- fontSize: 13,
754
- iconSize: 17,
755
- lineHeight: 19,
756
- letterSpacing: 0
757
- },
758
- {
759
- ascenderHeight: 6,
760
- descenderHeight: 6,
761
- fontSize: 16,
762
- iconSize: 25,
763
- lineHeight: 23,
764
- letterSpacing: 0
765
- },
766
- {
767
- ascenderHeight: 7,
768
- descenderHeight: 7,
769
- fontSize: 21,
770
- iconSize: 33,
771
- lineHeight: 29,
772
- letterSpacing: 0
773
- },
774
- {
775
- ascenderHeight: 8,
776
- descenderHeight: 8,
777
- fontSize: 27,
778
- iconSize: 41,
779
- lineHeight: 35,
780
- letterSpacing: 0
781
- },
782
- {
783
- ascenderHeight: 9.5,
784
- descenderHeight: 8.5,
785
- fontSize: 33,
786
- iconSize: 49,
787
- lineHeight: 41,
788
- letterSpacing: 0
789
- },
790
- {
791
- ascenderHeight: 10.5,
792
- descenderHeight: 9.5,
793
- fontSize: 38,
794
- iconSize: 53,
795
- lineHeight: 47,
796
- letterSpacing: 0
797
- }
798
- ]
799
- },
800
- label: {
801
- family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',
802
- weights: {
803
- regular: 600,
804
- medium: 700,
805
- semibold: 800,
806
- bold: 900
807
- },
808
- sizes: [
809
- {
810
- ascenderHeight: 2,
811
- descenderHeight: 2,
812
- fontSize: 8.1,
813
- iconSize: 13,
814
- lineHeight: 10,
815
- letterSpacing: 0.5
816
- },
817
- {
818
- ascenderHeight: 2,
819
- descenderHeight: 2,
820
- fontSize: 9.5,
821
- iconSize: 15,
822
- lineHeight: 11,
823
- letterSpacing: 0.5
824
- },
825
- {
826
- ascenderHeight: 2,
827
- descenderHeight: 2,
828
- fontSize: 10.8,
829
- iconSize: 17,
830
- lineHeight: 12,
831
- letterSpacing: 0.5
832
- },
833
- {
834
- ascenderHeight: 2,
835
- descenderHeight: 2,
836
- fontSize: 12.25,
837
- iconSize: 19,
838
- lineHeight: 13,
839
- letterSpacing: 0.5
840
- },
841
- {
842
- ascenderHeight: 2,
843
- descenderHeight: 2,
844
- fontSize: 13.6,
845
- iconSize: 21,
846
- lineHeight: 14,
847
- letterSpacing: 0.5
848
- },
849
- {
850
- ascenderHeight: 2,
851
- descenderHeight: 2,
852
- fontSize: 15,
853
- iconSize: 23,
854
- lineHeight: 15,
855
- letterSpacing: 0.5
856
- }
857
- ]
858
- },
859
- text: {
860
- family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
861
- weights: {
862
- regular: 400,
863
- medium: 500,
864
- semibold: 600,
865
- bold: 700
866
- },
867
- sizes: [
868
- {
869
- ascenderHeight: 4,
870
- descenderHeight: 4,
871
- fontSize: 10,
872
- iconSize: 17,
873
- lineHeight: 15,
874
- letterSpacing: 0
875
- },
876
- {
877
- ascenderHeight: 5,
878
- descenderHeight: 5,
879
- fontSize: 13,
880
- iconSize: 21,
881
- lineHeight: 19,
882
- letterSpacing: 0
883
- },
884
- {
885
- ascenderHeight: 6,
886
- descenderHeight: 6,
887
- fontSize: 15,
888
- iconSize: 25,
889
- lineHeight: 23,
890
- letterSpacing: 0
891
- },
892
- {
893
- ascenderHeight: 7,
894
- descenderHeight: 7,
895
- fontSize: 18,
896
- iconSize: 29,
897
- lineHeight: 27,
898
- letterSpacing: 0
899
- },
900
- {
901
- ascenderHeight: 8,
902
- descenderHeight: 8,
903
- fontSize: 21,
904
- iconSize: 33,
905
- lineHeight: 31,
906
- letterSpacing: 0
907
- }
908
- ]
909
- }
910
- };
911
- function is_v0(themeProp) {
912
- return themeProp._version === 0;
913
- }
914
- function is_v2(themeProp) {
915
- return themeProp._version === 2;
916
- }
917
- const cache$2 = /* @__PURE__ */ new WeakMap();
918
- function v0_v2(v0) {
919
- if (v0.v2) return v0.v2;
920
- const cached_v2 = cache$2.get(v0);
921
- if (cached_v2) return cached_v2;
922
- const {
923
- avatar,
924
- button,
925
- color: color2,
926
- container,
927
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
928
- focusRing: _unused_focusRing,
929
- fonts: font,
930
- input,
931
- layer,
932
- media,
933
- radius,
934
- shadows: shadow,
935
- space,
936
- styles: style
937
- } = v0, v2 = {
938
- _version: 2,
939
- avatar: {
940
- ...defaultThemeConfig.avatar,
941
- ...avatar
942
- },
943
- button: {
944
- ...defaultThemeConfig.button,
945
- ...button
946
- },
947
- card: defaultThemeConfig.card,
948
- color: {
949
- light: {
950
- transparent: themeColor_v0_v2(color2.light.transparent),
951
- default: themeColor_v0_v2(color2.light.default),
952
- primary: themeColor_v0_v2(color2.light.primary),
953
- positive: themeColor_v0_v2(color2.light.positive),
954
- caution: themeColor_v0_v2(color2.light.caution),
955
- critical: themeColor_v0_v2(color2.light.critical)
956
- },
957
- dark: {
958
- transparent: themeColor_v0_v2(color2.dark.transparent),
959
- default: themeColor_v0_v2(color2.dark.default),
960
- primary: themeColor_v0_v2(color2.dark.primary),
961
- positive: themeColor_v0_v2(color2.dark.positive),
962
- caution: themeColor_v0_v2(color2.dark.caution),
963
- critical: themeColor_v0_v2(color2.dark.critical)
964
- }
965
- },
966
- container,
967
- font,
968
- input: {
969
- ...defaultThemeConfig.input,
970
- ...input,
971
- checkbox: {
972
- ...defaultThemeConfig.input.checkbox,
973
- ...input.checkbox
974
- },
975
- radio: {
976
- ...defaultThemeConfig.input.radio,
977
- ...input.radio
978
- },
979
- switch: {
980
- ...defaultThemeConfig.input.switch,
981
- ...input.switch
982
- }
983
- },
984
- layer: layer ?? defaultThemeConfig.layer,
985
- media,
986
- radius,
987
- shadow,
988
- space,
989
- style
990
- };
991
- return cache$2.set(v0, v2), v2;
992
- }
993
- const cache$1 = /* @__PURE__ */ new WeakMap();
994
- function v2_v0(v2) {
995
- const cachedTheme = cache$1.get(v2);
996
- if (cachedTheme) return cachedTheme;
997
- const {
998
- avatar,
999
- button,
1000
- color: color2,
1001
- container,
1002
- font: fonts,
1003
- input,
1004
- media,
1005
- radius,
1006
- shadow: shadows,
1007
- space,
1008
- style: styles
1009
- } = v2;
1010
- return {
1011
- _version: 0,
1012
- avatar,
1013
- button,
1014
- container,
1015
- color: {
1016
- light: {
1017
- transparent: themeColor_v2_v0(color2.light.transparent),
1018
- default: themeColor_v2_v0(color2.light.default),
1019
- primary: themeColor_v2_v0(color2.light.primary),
1020
- positive: themeColor_v2_v0(color2.light.positive),
1021
- caution: themeColor_v2_v0(color2.light.caution),
1022
- critical: themeColor_v2_v0(color2.light.critical)
1023
- },
1024
- dark: {
1025
- transparent: themeColor_v2_v0(color2.dark.transparent),
1026
- default: themeColor_v2_v0(color2.dark.default),
1027
- primary: themeColor_v2_v0(color2.dark.primary),
1028
- positive: themeColor_v2_v0(color2.dark.positive),
1029
- caution: themeColor_v2_v0(color2.dark.caution),
1030
- critical: themeColor_v2_v0(color2.dark.critical)
1031
- }
1032
- },
1033
- focusRing: input.text.focusRing,
1034
- fonts,
1035
- input,
1036
- media,
1037
- radius,
1038
- shadows,
1039
- space,
1040
- styles,
1041
- v2
1042
- };
1043
- }
1044
- function themeColor_v2_v0(color_v2) {
1045
- return {
1046
- base: {
1047
- bg: color_v2.bg,
1048
- fg: color_v2.fg,
1049
- border: color_v2.border,
1050
- focusRing: color_v2.focusRing,
1051
- shadow: color_v2.shadow
1052
- },
1053
- button: color_v2.button,
1054
- card: color_v2.selectable.default,
1055
- dark: color_v2._dark,
1056
- input: {
1057
- default: inputStatesThemeColor_v2_v0(color_v2.input.default),
1058
- invalid: inputStatesThemeColor_v2_v0(color_v2.input.invalid)
1059
- },
1060
- muted: {
1061
- ...color_v2.button.ghost,
1062
- transparent: color_v2.button.ghost.default
1063
- },
1064
- solid: {
1065
- ...color_v2.button.default,
1066
- transparent: color_v2.button.default.default
1067
- },
1068
- selectable: color_v2.selectable,
1069
- spot: {
1070
- gray: color_v2.avatar.gray.bg,
1071
- blue: color_v2.avatar.blue.bg,
1072
- purple: color_v2.avatar.purple.bg,
1073
- magenta: color_v2.avatar.magenta.bg,
1074
- red: color_v2.avatar.red.bg,
1075
- orange: color_v2.avatar.orange.bg,
1076
- yellow: color_v2.avatar.yellow.bg,
1077
- green: color_v2.avatar.green.bg,
1078
- cyan: color_v2.avatar.cyan.bg
1079
- },
1080
- syntax: color_v2.syntax
1081
- };
1082
- }
1083
- function inputStatesThemeColor_v2_v0(t) {
1084
- return {
1085
- enabled: inputStateThemeColor_v2_v0(t.enabled),
1086
- disabled: inputStateThemeColor_v2_v0(t.disabled),
1087
- readOnly: inputStateThemeColor_v2_v0(t.readOnly),
1088
- hovered: inputStateThemeColor_v2_v0(t.hovered)
1089
- };
1090
- }
1091
- function inputStateThemeColor_v2_v0(t) {
1092
- return {
1093
- bg: t.bg,
1094
- bg2: t.muted.bg,
1095
- border: t.border,
1096
- fg: t.fg,
1097
- placeholder: t.placeholder
1098
- };
1099
- }
1100
- const AVATAR_SIZE = [0, 1, 2, 3], CONTAINER = [0, 1, 2, 3, 4, 5], RADIUS = [0, 1, 2, 3, 4, 5, 6, "full"], SPACE = [0, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9], FONT_CODE_SIZE = [0, 1, 2, 3, 4, 5], FONT_HEADING_SIZE = [0, 1, 2, 3, 4, 5, 6], FONT_LABEL_SIZE = [0, 1, 2, 3, 4, 5, 6], FONT_TEXT_SIZE = [0, 1, 2, 3, 4, 5], SHADOW = [0, 1, 2, 3, 4, 5], THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
1101
- "transparent",
1102
- "default",
1103
- "primary",
1104
- "positive",
1105
- "caution",
1106
- "critical"
1107
- ], THEME_COLOR_STATE_TONES = [
1108
- "default",
1109
- "primary",
1110
- "positive",
1111
- "caution",
1112
- "critical"
1113
- ], THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"], THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"], THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
1114
- function isColorBlendModeValue(str) {
1115
- return THEME_COLOR_BLEND_MODES.includes(str);
1116
- }
1117
- function isColorHueKey(str) {
1118
- return COLOR_HUES.includes(str);
1119
- }
1120
- function isColorTintKey(str) {
1121
- return COLOR_TINTS.includes(str);
1122
- }
1123
- function isColorButtonMode(str) {
1124
- return THEME_COLOR_BUTTON_MODES.includes(str);
1125
- }
1126
- const COLOR_CONFIG_STATE_KEYS = [
1127
- "_hue",
1128
- "bg",
1129
- "fg",
1130
- "border",
1131
- "focusRing",
1132
- "muted/fg",
1133
- "accent/fg",
1134
- "link/fg",
1135
- "code/bg",
1136
- "code/fg",
1137
- "skeleton/from",
1138
- "skeleton/to",
1139
- "status/dot",
1140
- "status/icon"
1141
- ], COLOR_CONFIG_CARD_KEYS = [
1142
- ...COLOR_CONFIG_STATE_KEYS,
1143
- "_hue",
1144
- "bg",
1145
- "fg",
1146
- "border",
1147
- "focusRing",
1148
- "shadow/outline",
1149
- "shadow/umbra",
1150
- "shadow/penumbra",
1151
- "shadow/ambient"
1152
- ], COLOR_CONFIG_BLEND_KEYS = ["_blend"], COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS], COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES], COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES], COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES], COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES], COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
1153
- function parseTokenKey(str) {
1154
- const segments = str.split("/"), segment0 = segments.shift() || "";
1155
- if (isColorConfigBaseTone(segment0)) {
1156
- const key = segments.join("/");
1157
- if (isColorConfigBaseKey(key))
1158
- return {
1159
- type: "base",
1160
- tone: segment0,
1161
- key
1162
- };
1163
- if (isColorConfigBlendKey(key))
1164
- return {
1165
- type: "base",
1166
- tone: segment0,
1167
- key
1168
- };
1169
- }
1170
- if (segment0 === "button") {
1171
- const segment1 = segments.shift() || "";
1172
- if (isColorConfigStateTone(segment1)) {
1173
- const segment2 = segments.shift() || "";
1174
- if (isColorButtonMode(segment2)) {
1175
- const key = segments.join("/");
1176
- if (isColorConfigStateKey(key))
1177
- return {
1178
- type: "button",
1179
- tone: segment1,
1180
- mode: segment2,
1181
- key
1182
- };
1183
- if (isColorConfigBlendKey(key))
1184
- return {
1185
- type: "button",
1186
- tone: segment1,
1187
- mode: segment2,
1188
- key
1189
- };
1190
- }
1191
- }
1192
- }
1193
- }
1194
- function isColorMixPercentValue(str) {
1195
- return /^\d+%$/.test(str);
1196
- }
1197
- function parseTokenValue(str) {
1198
- const segments = str.split("/");
1199
- let nextSegment = segments.shift() || "";
1200
- const [segment0, segment0mix] = nextSegment.split(" ");
1201
- if (isColorTintKey(segment0)) {
1202
- const tint = segment0, segment1 = segments.shift() || "";
1203
- if (isColorMixPercentValue(segment0mix)) {
1204
- const mix2 = Number(segment0mix.slice(0, -1)) / 100;
1205
- return {
1206
- type: "color",
1207
- tint,
1208
- mix: mix2
1209
- };
1210
- }
1211
- if (isColorOpacityValue(segment1)) {
1212
- const opacity = Number(segment1);
1213
- return {
1214
- type: "color",
1215
- tint,
1216
- opacity
1217
- };
1218
- }
1219
- return {
1220
- type: "color",
1221
- tint
1222
- };
1223
- }
1224
- if (isColorValue(segment0)) {
1225
- const key = segment0, segment1 = segments.shift() || "";
1226
- if (isColorMixPercentValue(segment0mix)) {
1227
- const mix2 = Number(segment0mix.slice(0, -1)) / 100;
1228
- return {
1229
- type: "color",
1230
- key,
1231
- mix: mix2
1232
- };
1233
- }
1234
- if (isColorOpacityValue(segment1)) {
1235
- const opacity = Number(segment1);
1236
- return {
1237
- type: "color",
1238
- key,
1239
- opacity
1240
- };
1241
- }
1242
- return {
1243
- type: "color",
1244
- key
1245
- };
1246
- }
1247
- if (isColorHueKey(segment0)) {
1248
- const hue = segment0;
1249
- nextSegment = segments.shift() || "";
1250
- const [segment1, segment1mix] = nextSegment.split(" ");
1251
- if (isColorTintKey(segment1)) {
1252
- const tint = segment1, segment2 = segments.shift() || "";
1253
- if (isColorMixPercentValue(segment1mix)) {
1254
- const mix2 = Number(segment1mix.slice(0, -1)) / 100;
1255
- return {
1256
- type: "color",
1257
- hue,
1258
- tint,
1259
- mix: mix2
1260
- };
1261
- }
1262
- if (isColorOpacityValue(segment2)) {
1263
- const opacity = Number(segment2);
1264
- return {
1265
- type: "color",
1266
- hue,
1267
- tint,
1268
- opacity
1269
- };
1270
- }
1271
- return {
1272
- type: "color",
1273
- hue,
1274
- tint
1275
- };
1276
- }
1277
- return {
1278
- type: "hue",
1279
- value: hue
1280
- };
1281
- }
1282
- if (isColorBlendModeValue(segment0))
1283
- return {
1284
- type: "blendMode",
1285
- value: segment0
1286
- };
1287
- }
1288
- function isColorConfigBaseTone(str) {
1289
- return COLOR_CONFIG_CARD_TONES.includes(str);
1290
- }
1291
- function isColorConfigBaseKey(str) {
1292
- return COLOR_CONFIG_CARD_KEYS.includes(str);
1293
- }
1294
- function isColorConfigStateKey(str) {
1295
- return COLOR_CONFIG_STATE_KEYS.includes(str);
1296
- }
1297
- function isColorConfigStateTone(str) {
1298
- return COLOR_CONFIG_STATE_TONES.includes(str);
1299
- }
1300
- function isColorConfigBlendKey(str) {
1301
- return COLOR_CONFIG_BLEND_KEYS.includes(str);
1302
- }
1303
- function isColorTokenValue(str) {
1304
- return parseTokenValue(str)?.type === "color" || parseTokenValue(str)?.type === "hue";
1305
- }
1306
- function isColorValue(str) {
1307
- return str === "black" || str === "white";
1308
- }
1309
- function isColorOpacityValue(str) {
1310
- return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
1311
- }
1312
- function compileColorTokenValue(node) {
1313
- let key = "";
1314
- return node.key === "black" || node.key === "white" ? key = node.key : key = `${node.hue}/${node.tint}`, node.mix !== void 0 ? `${key} ${node.mix * 100}%` : (node.opacity !== void 0 && (key += `/${node.opacity}`), key);
1315
- }
1316
- const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
1317
- function resolveColorTokenValue(context, value = DEFAULT_COLOR_TOKEN_VALUE) {
1318
- const { hue, scheme } = context, node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
1319
- if (!node || node.type !== "color")
1320
- throw new Error(`Invalid color token: ${value[0]}`);
1321
- return compileColorTokenValue({ ...node, hue: node.hue || hue });
1322
- }
1323
- const defaultColorTokens = {
1324
- base: {
1325
- "*": {
1326
- _blend: ["multiply", "screen"],
1327
- accent: {
1328
- fg: ["purple/600", "purple/400"]
1329
- },
1330
- avatar: {
1331
- "*": {
1332
- _blend: ["screen", "multiply"],
1333
- bg: ["500", "400"],
1334
- fg: ["white", "black"]
1335
- }
1336
- },
1337
- backdrop: ["gray/200/0.5", "black/0.5"],
1338
- badge: {
1339
- "*": {
1340
- bg: ["100", "900"],
1341
- fg: ["600", "400"],
1342
- icon: ["500", "500"],
1343
- dot: ["500", "500"]
1344
- },
1345
- positive: {
1346
- bg: ["200 50%", "900"],
1347
- fg: ["600", "500"]
1348
- },
1349
- caution: {
1350
- bg: ["200 50%", "900"],
1351
- fg: ["600", "500"]
1352
- }
1353
- },
1354
- bg: ["50", "950"],
1355
- border: ["200", "800"],
1356
- code: {
1357
- bg: ["50", "950"],
1358
- fg: ["600", "400"]
1359
- },
1360
- fg: ["800", "200"],
1361
- focusRing: ["blue/500", "blue/500"],
1362
- icon: ["600", "400"],
1363
- kbd: {
1364
- bg: ["white", "black"],
1365
- fg: ["600", "400"],
1366
- border: ["200", "800"]
1367
- },
1368
- link: {
1369
- fg: ["blue/600", "blue/300"]
1370
- },
1371
- muted: {
1372
- bg: ["50", "950"],
1373
- fg: ["700 75%", "300 75%"]
1374
- },
1375
- shadow: {
1376
- outline: ["500/0.3", "500/0.4"],
1377
- umbra: ["gray/500/0.1", "black/0.2"],
1378
- penumbra: ["gray/500/0.07", "black/0.14"],
1379
- ambient: ["gray/500/0.06", "black/0.12"]
1380
- },
1381
- skeleton: {
1382
- from: ["100", "900"],
1383
- to: ["100 50%", "900 50%"]
1384
- }
1385
- },
1386
- transparent: {
1387
- bg: ["50", "black"]
1388
- },
1389
- default: {
1390
- bg: ["white", "950"],
1391
- fg: ["800", "200"],
1392
- muted: {
1393
- fg: ["600", "400"]
1394
- }
1395
- },
1396
- primary: { _hue: "blue" },
1397
- positive: {
1398
- _hue: "green",
1399
- shadow: { outline: ["500/0.4", "500/0.4"] }
1400
- },
1401
- caution: {
1402
- _hue: "yellow",
1403
- shadow: { outline: ["600/0.3", "500/0.4"] }
1404
- },
1405
- critical: { _hue: "red" }
1406
- },
1407
- button: {
1408
- default: {
1409
- "*": {
1410
- "*": {
1411
- _blend: ["screen", "multiply"],
1412
- accent: {
1413
- fg: ["purple/300", "purple/700"]
1414
- },
1415
- avatar: {
1416
- "*": {
1417
- _blend: ["screen", "multiply"],
1418
- bg: ["500", "400"],
1419
- fg: ["white", "black"]
1420
- }
1421
- },
1422
- badge: {
1423
- "*": {
1424
- bg: ["900", "100"],
1425
- fg: ["400", "600"],
1426
- dot: ["500", "500"],
1427
- icon: ["500", "500"]
1428
- }
1429
- },
1430
- bg: ["500", "400"],
1431
- border: ["500/0", "400/0"],
1432
- code: {
1433
- bg: ["500 20%", "400 20%"],
1434
- fg: ["200", "600"]
1435
- },
1436
- fg: ["white", "black"],
1437
- icon: ["100 70%", "900 70%"],
1438
- kbd: {
1439
- bg: ["black", "white"],
1440
- fg: ["200", "600"],
1441
- border: ["800", "200"]
1442
- },
1443
- link: {
1444
- fg: ["blue/200", "blue/600"]
1445
- },
1446
- muted: {
1447
- bg: ["950", "50"],
1448
- fg: ["100 70%", "900 70%"]
1449
- },
1450
- skeleton: {
1451
- from: ["900", "100"],
1452
- to: ["900 50%", "100 50%"]
1453
- }
1454
- },
1455
- hovered: {
1456
- bg: ["700", "300"],
1457
- border: ["700/0", "300/0"]
1458
- },
1459
- pressed: {
1460
- bg: ["700", "300"]
1461
- },
1462
- selected: {
1463
- bg: ["700", "300"]
1464
- },
1465
- disabled: {
1466
- _hue: "gray",
1467
- accent: {
1468
- fg: ["100 70%", "900 70%"]
1469
- },
1470
- avatar: {
1471
- "*": {
1472
- _blend: ["screen", "multiply"],
1473
- bg: ["gray/500", "gray/400"],
1474
- fg: ["white", "black"]
1475
- }
1476
- },
1477
- badge: {
1478
- "*": {
1479
- bg: ["gray/700", "gray/300"],
1480
- fg: ["white", "black"],
1481
- dot: ["white", "black"],
1482
- icon: ["white", "black"]
1483
- }
1484
- },
1485
- bg: ["300", "600"],
1486
- code: {
1487
- bg: ["950", "50"],
1488
- fg: ["300", "600"]
1489
- },
1490
- fg: ["300", "600"],
1491
- muted: {
1492
- bg: ["950", "50"],
1493
- fg: ["300", "600"]
1494
- },
1495
- kbd: {
1496
- bg: ["black", "white"],
1497
- fg: ["white", "black"],
1498
- border: ["700", "300"]
1499
- },
1500
- link: {
1501
- fg: ["100 70%", "900 70%"]
1502
- }
1503
- }
1504
- },
1505
- default: {
1506
- "*": {
1507
- avatar: {
1508
- "*": {
1509
- _blend: ["screen", "multiply"],
1510
- bg: ["500", "400"],
1511
- fg: ["white", "black"]
1512
- }
1513
- },
1514
- bg: ["800", "200"],
1515
- muted: {
1516
- bg: ["950", "50"],
1517
- fg: ["400", "600"]
1518
- }
1519
- },
1520
- hovered: {
1521
- bg: ["900", "100"]
1522
- },
1523
- pressed: {
1524
- bg: ["black", "white"]
1525
- },
1526
- selected: {
1527
- bg: ["black", "white"]
1528
- }
1529
- }
1530
- },
1531
- ghost: {
1532
- "*": {
1533
- "*": {
1534
- _blend: ["multiply", "screen"],
1535
- accent: {
1536
- fg: ["purple/700 60%", "purple/300 70%"]
1537
- },
1538
- avatar: {
1539
- "*": {
1540
- _blend: ["screen", "multiply"],
1541
- bg: ["500", "400"],
1542
- fg: ["white", "black"]
1543
- }
1544
- },
1545
- badge: {
1546
- "*": {
1547
- bg: ["100", "900"],
1548
- fg: ["600", "400"],
1549
- dot: ["500", "500"],
1550
- icon: ["500", "500"]
1551
- }
1552
- },
1553
- bg: ["50", "950"],
1554
- border: ["100", "900"],
1555
- code: {
1556
- bg: ["500 10%", "400 10%"],
1557
- fg: ["700 60%", "400 60%"]
1558
- },
1559
- fg: ["600", "400"],
1560
- icon: ["700 60%", "300 60%"],
1561
- kbd: {
1562
- bg: ["white", "black"],
1563
- fg: ["600", "400"],
1564
- border: ["200", "800"]
1565
- },
1566
- link: {
1567
- fg: ["blue/700 60%", "blue/300 60%"]
1568
- },
1569
- muted: {
1570
- bg: ["100", "950"],
1571
- fg: ["700 60%", "300 60%"]
1572
- },
1573
- skeleton: {
1574
- from: ["100", "900"],
1575
- to: ["100 50%", "900 50%"]
1576
- }
1577
- },
1578
- hovered: {
1579
- bg: ["100", "900"],
1580
- fg: ["700", "300"]
1581
- },
1582
- pressed: {
1583
- bg: ["100", "900"],
1584
- fg: ["800", "200"]
1585
- },
1586
- selected: {
1587
- bg: ["100", "900"],
1588
- fg: ["800", "200"]
1589
- },
1590
- disabled: {
1591
- _hue: "gray",
1592
- accent: {
1593
- fg: ["200", "800"]
1594
- },
1595
- avatar: {
1596
- "*": {
1597
- _blend: ["screen", "multiply"],
1598
- bg: ["gray/100", "gray/900"],
1599
- fg: ["white", "black"]
1600
- }
1601
- },
1602
- badge: {
1603
- "*": {
1604
- _hue: "gray",
1605
- bg: ["50", "950"],
1606
- fg: ["gray/200", "gray/800"],
1607
- dot: ["gray/200", "gray/800"],
1608
- icon: ["gray/200", "gray/800"]
1609
- }
1610
- },
1611
- border: ["100", "900"],
1612
- code: {
1613
- bg: ["50", "950"],
1614
- fg: ["200", "800"]
1615
- },
1616
- fg: ["400", "600"],
1617
- icon: ["300", "700"],
1618
- muted: {
1619
- fg: ["300", "700"]
1620
- },
1621
- kbd: {
1622
- bg: ["white", "black"],
1623
- fg: ["200", "800"],
1624
- border: ["100", "900"]
1625
- },
1626
- link: {
1627
- fg: ["200", "800"]
1628
- }
1629
- }
1630
- },
1631
- positive: {
1632
- "*": {
1633
- border: ["600 20%", "800"]
1634
- }
1635
- },
1636
- caution: {
1637
- "*": {
1638
- border: ["600 20%", "800"]
1639
- }
1640
- }
1641
- },
1642
- bleed: {
1643
- "*": {
1644
- "*": {
1645
- _blend: ["multiply", "screen"],
1646
- accent: {
1647
- fg: ["purple/700 70%", "purple/300 70%"]
1648
- },
1649
- avatar: {
1650
- "*": {
1651
- _blend: ["screen", "multiply"],
1652
- bg: ["500", "400"],
1653
- fg: ["white", "black"]
1654
- }
1655
- },
1656
- badge: {
1657
- "*": {
1658
- bg: ["100", "900"],
1659
- fg: ["600", "400"],
1660
- dot: ["500", "500"],
1661
- icon: ["500", "500"]
1662
- }
1663
- },
1664
- bg: ["white", "black"],
1665
- border: ["white/0", "black/0"],
1666
- code: {
1667
- bg: ["50", "950"],
1668
- fg: ["700 75%", "300 75%"]
1669
- },
1670
- fg: ["700", "300"],
1671
- icon: ["700 75%", "300 75%"],
1672
- kbd: {
1673
- bg: ["white", "black"],
1674
- fg: ["700", "300"],
1675
- border: ["200", "800"]
1676
- },
1677
- link: {
1678
- fg: ["blue/700 70%", "blue/300 70%"]
1679
- },
1680
- muted: {
1681
- bg: ["100", "950"],
1682
- fg: ["700 75%", "300 75%"]
1683
- },
1684
- skeleton: {
1685
- from: ["100", "900"],
1686
- to: ["100 50%", "900 50%"]
1687
- }
1688
- },
1689
- hovered: {
1690
- bg: ["50", "950"],
1691
- icon: ["700 70%", "400 70%"]
1692
- },
1693
- pressed: {
1694
- bg: ["100", "900"],
1695
- fg: ["800", "200"],
1696
- icon: ["800 70%", "200 70%"]
1697
- },
1698
- selected: {
1699
- bg: ["100", "900"],
1700
- fg: ["800", "200"],
1701
- icon: ["800 60%", "200 60%"]
1702
- },
1703
- disabled: {
1704
- _hue: "gray",
1705
- accent: {
1706
- fg: ["200", "800"]
1707
- },
1708
- avatar: {
1709
- "*": {
1710
- _blend: ["screen", "multiply"],
1711
- bg: ["gray/100", "gray/900"],
1712
- fg: ["white", "black"]
1713
- }
1714
- },
1715
- badge: {
1716
- "*": {
1717
- _hue: "gray",
1718
- bg: ["50", "950"],
1719
- fg: ["gray/200", "gray/800"],
1720
- dot: ["gray/200", "gray/800"],
1721
- icon: ["gray/200", "gray/800"]
1722
- }
1723
- },
1724
- code: {
1725
- bg: ["50", "950"],
1726
- fg: ["200", "800"]
1727
- },
1728
- fg: ["400", "600"],
1729
- icon: ["300", "700"],
1730
- muted: {
1731
- fg: ["400", "600"]
1732
- },
1733
- kbd: {
1734
- bg: ["white", "black"],
1735
- fg: ["200", "800"],
1736
- border: ["100", "900"]
1737
- },
1738
- link: {
1739
- fg: ["200", "800"]
1740
- }
1741
- }
1742
- }
1743
- }
1744
- },
1745
- input: {
1746
- "*": {
1747
- "*": {
1748
- _blend: ["multiply", "screen"],
1749
- bg: ["white", "black"],
1750
- border: ["200", "700"],
1751
- fg: ["black", "200"],
1752
- muted: {
1753
- bg: ["50", "950"]
1754
- },
1755
- placeholder: ["400", "600"]
1756
- },
1757
- hovered: {
1758
- border: ["300", "700"]
1759
- },
1760
- readOnly: {
1761
- bg: ["50", "950"],
1762
- border: ["200", "800"],
1763
- fg: ["800", "200"]
1764
- },
1765
- disabled: {
1766
- bg: ["50", "950"],
1767
- fg: ["400", "600"],
1768
- border: ["100", "900"],
1769
- placeholder: ["200", "800 50%"]
1770
- }
1771
- },
1772
- invalid: {
1773
- "*": {
1774
- _hue: "red",
1775
- bg: ["100", "950"]
1776
- }
1777
- }
1778
- },
1779
- selectable: {
1780
- "*": {
1781
- "*": {
1782
- _blend: ["multiply", "screen"],
1783
- accent: {
1784
- fg: ["purple/700 70%", "purple/300 70%"]
1785
- },
1786
- avatar: {
1787
- "*": {
1788
- _blend: ["screen", "multiply"],
1789
- bg: ["500", "400"],
1790
- fg: ["white", "black"]
1791
- }
1792
- },
1793
- badge: {
1794
- "*": {
1795
- bg: ["100", "900"],
1796
- fg: ["600", "400"],
1797
- dot: ["500", "500"],
1798
- icon: ["500", "500"]
1799
- }
1800
- },
1801
- bg: ["white", "black"],
1802
- border: ["200", "800"],
1803
- code: {
1804
- bg: ["50", "950"],
1805
- fg: ["600", "400"]
1806
- },
1807
- fg: ["700", "300"],
1808
- icon: ["700 75%", "300 75%"],
1809
- kbd: {
1810
- bg: ["white", "black"],
1811
- fg: ["600", "400"],
1812
- border: ["200", "800"]
1813
- },
1814
- link: {
1815
- fg: ["blue/700 70%", "blue/300 70%"]
1816
- },
1817
- muted: {
1818
- bg: ["50", "950"],
1819
- fg: ["700 75%", "300 75%"]
1820
- },
1821
- skeleton: {
1822
- from: ["100", "900"],
1823
- to: ["100 50%", "900 50%"]
1824
- }
1825
- },
1826
- hovered: {
1827
- bg: ["50", "950"]
1828
- },
1829
- pressed: {
1830
- bg: ["100", "900"]
1831
- },
1832
- selected: {
1833
- _blend: ["screen", "multiply"],
1834
- accent: {
1835
- fg: ["purple/300", "purple/700"]
1836
- },
1837
- avatar: {
1838
- "*": {
1839
- _blend: ["multiply", "screen"],
1840
- bg: ["white", "black"],
1841
- fg: ["black", "white"]
1842
- }
1843
- },
1844
- badge: {
1845
- "*": {
1846
- bg: ["900", "100"],
1847
- fg: ["400", "600"],
1848
- dot: ["500", "500"],
1849
- icon: ["500", "500"]
1850
- }
1851
- },
1852
- bg: ["500", "400"],
1853
- border: ["500 20%", "400 20%"],
1854
- code: {
1855
- bg: ["500 20%", "400 20%"],
1856
- fg: ["200", "600"]
1857
- },
1858
- fg: ["white", "black"],
1859
- icon: ["100 70%", "900 70%"],
1860
- kbd: {
1861
- bg: ["black", "white"],
1862
- fg: ["200", "600"],
1863
- border: ["800", "200"]
1864
- },
1865
- link: {
1866
- fg: ["blue/200", "blue/600"]
1867
- },
1868
- muted: {
1869
- bg: ["500 10%", "400 10%"],
1870
- fg: ["100 70%", "900 70%"]
1871
- },
1872
- skeleton: {
1873
- from: ["900", "100"],
1874
- to: ["900 50%", "100 50%"]
1875
- }
1876
- },
1877
- disabled: {
1878
- _hue: "gray",
1879
- accent: {
1880
- fg: ["200", "800"]
1881
- },
1882
- avatar: {
1883
- "*": {
1884
- _blend: ["screen", "multiply"],
1885
- bg: ["gray/100", "gray/900"],
1886
- fg: ["white", "black"]
1887
- }
1888
- },
1889
- badge: {
1890
- "*": {
1891
- _hue: "gray",
1892
- bg: ["50", "950"],
1893
- fg: ["gray/200", "gray/800"],
1894
- dot: ["gray/200", "gray/800"],
1895
- icon: ["gray/200", "gray/800"]
1896
- }
1897
- },
1898
- border: ["100", "900"],
1899
- code: {
1900
- bg: ["50", "950"],
1901
- fg: ["200", "800"]
1902
- },
1903
- fg: ["200", "800"],
1904
- icon: ["200", "800"],
1905
- kbd: {
1906
- bg: ["white", "black"],
1907
- fg: ["200", "800"],
1908
- border: ["100", "900"]
1909
- },
1910
- link: {
1911
- fg: ["200", "800"]
1912
- },
1913
- muted: {
1914
- bg: ["50 50%", "950 50%"],
1915
- fg: ["200", "800"]
1916
- }
1917
- }
1918
- },
1919
- default: {
1920
- selected: {
1921
- _hue: "blue"
1922
- }
1923
- },
1924
- critical: {
1925
- disabled: {
1926
- bg: ["50 50%", "950 50%"]
1927
- }
1928
- }
1929
- },
1930
- syntax: {
1931
- atrule: ["purple/600", "purple/400"],
1932
- attrName: ["green/600", "green/400"],
1933
- attrValue: ["yellow/600", "yellow/400"],
1934
- attribute: ["yellow/600", "yellow/400"],
1935
- boolean: ["purple/600", "purple/400"],
1936
- builtin: ["purple/600", "purple/400"],
1937
- cdata: ["yellow/600", "yellow/400"],
1938
- char: ["yellow/600", "yellow/400"],
1939
- class: ["orange/600", "orange/400"],
1940
- className: ["cyan/600", "cyan/400"],
1941
- comment: ["gray/400", "gray/600"],
1942
- constant: ["purple/600", "purple/400"],
1943
- deleted: ["red/600", "red/400"],
1944
- entity: ["red/600", "red/400"],
1945
- function: ["green/600", "green/400"],
1946
- hexcode: ["blue/600", "blue/400"],
1947
- id: ["purple/600", "purple/400"],
1948
- important: ["purple/600", "purple/400"],
1949
- inserted: ["yellow/600", "yellow/400"],
1950
- keyword: ["magenta/600", "magenta/400"],
1951
- number: ["purple/600", "purple/400"],
1952
- operator: ["magenta/600", "magenta/400"],
1953
- property: ["blue/600", "blue/400"],
1954
- pseudoClass: ["yellow/600", "yellow/400"],
1955
- pseudoElement: ["yellow/600", "yellow/400"],
1956
- punctuation: ["gray/600", "gray/400"],
1957
- regex: ["blue/600", "blue/400"],
1958
- selector: ["red/600", "red/400"],
1959
- string: ["yellow/600", "yellow/400"],
1960
- symbol: ["purple/600", "purple/400"],
1961
- tag: ["red/600", "red/400"],
1962
- unit: ["orange/600", "orange/400"],
1963
- url: ["red/600", "red/400"],
1964
- variable: ["red/600", "red/400"]
1965
- }
1966
- };
1967
- function isRecord(value) {
1968
- return !!(value && typeof value == "object" && !Array.isArray(value));
1969
- }
1970
- function merge(...records) {
1971
- const _records = records.filter(Boolean);
1972
- return _records.length === 0 ? {} : _records.reduce(_merge, {});
1973
- }
1974
- function _merge(acc, source) {
1975
- for (const key of Object.keys(source)) {
1976
- const prevValue = acc[key], nextValue = source[key];
1977
- isRecord(prevValue) && isRecord(nextValue) ? acc[key] = merge(prevValue, nextValue) : acc[key] = nextValue;
1978
- }
1979
- return acc;
1980
- }
1981
- function resolveColorTokens(inputTokens) {
1982
- const tokens = merge(defaultColorTokens, inputTokens);
1983
- return {
1984
- base: resolveBaseColorTokens(tokens),
1985
- button: resolveButtonColorTokens(tokens),
1986
- input: resolveInputColorTokens(tokens),
1987
- selectable: resolveSelectableColorTokens(tokens),
1988
- syntax: tokens.syntax
1989
- };
1990
- }
1991
- function resolveBaseColorTokens(sparseTokens) {
1992
- const tokens = {};
1993
- for (const tone of THEME_COLOR_CARD_TONES)
1994
- tokens[tone] = resolveBaseColorTones(sparseTokens, tone);
1995
- return tokens;
1996
- }
1997
- function resolveBaseColorTones(inputTokens, tone) {
1998
- const spec = merge(inputTokens?.base?.["*"], inputTokens?.base?.[tone]), hue = spec._hue || inputTokens?.base?.[tone]?._hue || "gray";
1999
- return {
2000
- ...spec,
2001
- _hue: hue,
2002
- avatar: {
2003
- gray: merge({ _hue: "gray" }, spec.avatar?.["*"], spec.avatar?.gray),
2004
- blue: merge({ _hue: "blue" }, spec.avatar?.["*"], spec.avatar?.blue),
2005
- purple: merge({ _hue: "purple" }, spec.avatar?.["*"], spec.avatar?.purple),
2006
- magenta: merge({ _hue: "magenta" }, spec.avatar?.["*"], spec.avatar?.magenta),
2007
- red: merge({ _hue: "red" }, spec.avatar?.["*"], spec.avatar?.red),
2008
- orange: merge({ _hue: "orange" }, spec.avatar?.["*"], spec.avatar?.orange),
2009
- yellow: merge({ _hue: "yellow" }, spec.avatar?.["*"], spec.avatar?.yellow),
2010
- green: merge({ _hue: "green" }, spec.avatar?.["*"], spec.avatar?.green),
2011
- cyan: merge({ _hue: "cyan" }, spec.avatar?.["*"], spec.avatar?.cyan)
2012
- },
2013
- badge: {
2014
- default: {
2015
- _hue: inputTokens?.base?.default?._hue || hue,
2016
- ...spec.badge?.["*"],
2017
- ...spec.badge?.default
2018
- },
2019
- primary: {
2020
- _hue: inputTokens?.base?.primary?._hue || hue,
2021
- ...spec.badge?.["*"],
2022
- ...spec.badge?.primary
2023
- },
2024
- positive: {
2025
- _hue: inputTokens?.base?.positive?._hue || hue,
2026
- ...spec.badge?.["*"],
2027
- ...spec.badge?.positive
2028
- },
2029
- caution: {
2030
- _hue: inputTokens?.base?.caution?._hue || hue,
2031
- ...spec.badge?.["*"],
2032
- ...spec.badge?.caution
2033
- },
2034
- critical: {
2035
- _hue: inputTokens?.base?.critical?._hue || hue,
2036
- ...spec.badge?.["*"],
2037
- ...spec.badge?.critical
2038
- }
2039
- }
2040
- };
2041
- }
2042
- function resolveButtonColorTokens(inputTokens) {
2043
- const tokens = {};
2044
- for (const mode of THEME_COLOR_BUTTON_MODES)
2045
- tokens[mode] = resolveButtonToneColorTokens(inputTokens, mode);
2046
- return tokens;
2047
- }
2048
- function resolveButtonToneColorTokens(inputTokens, mode) {
2049
- const tokens = {};
2050
- for (const tone of THEME_COLOR_STATE_TONES)
2051
- tokens[tone] = resolveButtonModeColorTokens(inputTokens, mode, tone);
2052
- return tokens;
2053
- }
2054
- function resolveButtonModeColorTokens(inputTokens, mode, tone) {
2055
- const tokens = {};
2056
- for (const state of THEME_COLOR_STATES)
2057
- tokens[state] = resolveButtonStateColorTokens(inputTokens, tone, mode, state);
2058
- return tokens;
2059
- }
2060
- function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
2061
- const spec = merge(
2062
- inputTokens?.button?.[mode]?.["*"]?.["*"],
2063
- inputTokens?.button?.[mode]?.[tone]?.["*"],
2064
- inputTokens?.button?.[mode]?.["*"]?.[state],
2065
- inputTokens?.button?.[mode]?.[tone]?.[state]
2066
- ), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
2067
- return {
2068
- ...spec,
2069
- _hue: hue,
2070
- avatar: {
2071
- gray: merge({ _hue: "gray" }, spec.avatar?.["*"], spec.avatar?.gray),
2072
- blue: merge({ _hue: "blue" }, spec.avatar?.["*"], spec.avatar?.blue),
2073
- purple: merge({ _hue: "purple" }, spec.avatar?.["*"], spec.avatar?.purple),
2074
- magenta: merge({ _hue: "magenta" }, spec.avatar?.["*"], spec.avatar?.magenta),
2075
- red: merge({ _hue: "red" }, spec.avatar?.["*"], spec.avatar?.red),
2076
- orange: merge({ _hue: "orange" }, spec.avatar?.["*"], spec.avatar?.orange),
2077
- yellow: merge({ _hue: "yellow" }, spec.avatar?.["*"], spec.avatar?.yellow),
2078
- green: merge({ _hue: "green" }, spec.avatar?.["*"], spec.avatar?.green),
2079
- cyan: merge({ _hue: "cyan" }, spec.avatar?.["*"], spec.avatar?.cyan)
2080
- },
2081
- badge: {
2082
- default: {
2083
- _hue: inputTokens?.base?.default?._hue,
2084
- ...spec.badge?.["*"],
2085
- ...spec.badge?.default
2086
- },
2087
- primary: {
2088
- _hue: inputTokens?.base?.primary?._hue,
2089
- ...spec.badge?.["*"],
2090
- ...spec.badge?.primary
2091
- },
2092
- positive: {
2093
- _hue: inputTokens?.base?.positive?._hue,
2094
- ...spec.badge?.["*"],
2095
- ...spec.badge?.positive
2096
- },
2097
- caution: {
2098
- _hue: inputTokens?.base?.caution?._hue,
2099
- ...spec.badge?.["*"],
2100
- ...spec.badge?.caution
2101
- },
2102
- critical: {
2103
- _hue: inputTokens?.base?.critical?._hue,
2104
- ...spec.badge?.["*"],
2105
- ...spec.badge?.critical
2106
- }
2107
- }
2108
- };
2109
- }
2110
- function resolveInputColorTokens(inputTokens) {
2111
- const tokens = {};
2112
- for (const mode of THEME_COLOR_INPUT_MODES)
2113
- tokens[mode] = resolveInputModeColorTokens(inputTokens, mode);
2114
- return tokens;
2115
- }
2116
- function resolveInputModeColorTokens(inputTokens, mode) {
2117
- const states = {};
2118
- for (const state of THEME_COLOR_INPUT_STATES)
2119
- states[state] = resolveInputStateColorTokens(inputTokens, mode, state);
2120
- return states;
2121
- }
2122
- function resolveInputStateColorTokens(inputTokens, mode, state) {
2123
- const spec = merge(
2124
- inputTokens?.input?.["*"]?.["*"],
2125
- inputTokens?.input?.[mode]?.["*"],
2126
- inputTokens?.input?.["*"]?.[state],
2127
- inputTokens?.input?.[mode]?.[state]
2128
- ), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
2129
- return { ...spec, _hue: hue };
2130
- }
2131
- function resolveSelectableColorTokens(inputTokens) {
2132
- const tokens = {};
2133
- for (const tone of THEME_COLOR_STATE_TONES)
2134
- tokens[tone] = resolveSelectableToneColorTokens(inputTokens, tone);
2135
- return tokens;
2136
- }
2137
- function resolveSelectableToneColorTokens(inputTokens, tone) {
2138
- const states = {
2139
- _hue: inputTokens?.selectable?.[tone]?._hue || inputTokens?.base?.[tone]?._hue
2140
- };
2141
- for (const state of THEME_COLOR_STATES)
2142
- states[state] = resolveSelectableStateColorTokens(inputTokens, tone, state);
2143
- return states;
2144
- }
2145
- function resolveSelectableStateColorTokens(inputTokens, tone, state) {
2146
- const spec = merge(
2147
- inputTokens?.selectable?.["*"]?.["*"],
2148
- inputTokens?.selectable?.[tone]?.["*"],
2149
- inputTokens?.selectable?.["*"]?.[state],
2150
- inputTokens?.selectable?.[tone]?.[state]
2151
- ), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
2152
- return {
2153
- ...spec,
2154
- _hue: hue,
2155
- avatar: {
2156
- gray: merge({ _hue: "gray" }, spec.avatar?.["*"], spec.avatar?.gray),
2157
- blue: merge({ _hue: "blue" }, spec.avatar?.["*"], spec.avatar?.blue),
2158
- purple: merge({ _hue: "purple" }, spec.avatar?.["*"], spec.avatar?.purple),
2159
- magenta: merge({ _hue: "magenta" }, spec.avatar?.["*"], spec.avatar?.magenta),
2160
- red: merge({ _hue: "red" }, spec.avatar?.["*"], spec.avatar?.red),
2161
- orange: merge({ _hue: "orange" }, spec.avatar?.["*"], spec.avatar?.orange),
2162
- yellow: merge({ _hue: "yellow" }, spec.avatar?.["*"], spec.avatar?.yellow),
2163
- green: merge({ _hue: "green" }, spec.avatar?.["*"], spec.avatar?.green),
2164
- cyan: merge({ _hue: "cyan" }, spec.avatar?.["*"], spec.avatar?.cyan)
2165
- },
2166
- badge: {
2167
- default: {
2168
- _hue: inputTokens?.base?.default?._hue,
2169
- ...spec.badge?.["*"],
2170
- ...spec.badge?.default
2171
- },
2172
- primary: {
2173
- _hue: inputTokens?.base?.primary?._hue,
2174
- ...spec.badge?.["*"],
2175
- ...spec.badge?.primary
2176
- },
2177
- positive: {
2178
- _hue: inputTokens?.base?.positive?._hue,
2179
- ...spec.badge?.["*"],
2180
- ...spec.badge?.positive
2181
- },
2182
- caution: {
2183
- _hue: inputTokens?.base?.caution?._hue,
2184
- ...spec.badge?.["*"],
2185
- ...spec.badge?.caution
2186
- },
2187
- critical: {
2188
- _hue: inputTokens?.base?.critical?._hue,
2189
- ...spec.badge?.["*"],
2190
- ...spec.badge?.critical
2191
- }
2192
- }
2193
- };
2194
- }
2195
- function buildColorTheme(config) {
2196
- const resolvedConfig = {
2197
- ...config,
2198
- color: resolveColorTokens(config?.color)
2199
- };
2200
- return {
2201
- light: buildColorScheme({ scheme: "light" }, resolvedConfig),
2202
- dark: buildColorScheme({ scheme: "dark" }, resolvedConfig)
2203
- };
2204
- }
2205
- function buildColorScheme(options, config) {
2206
- const { scheme } = options;
2207
- return {
2208
- transparent: buildCardColorTheme({ scheme, tone: "transparent" }, config),
2209
- default: buildCardColorTheme({ scheme, tone: "default" }, config),
2210
- primary: buildCardColorTheme({ scheme, tone: "primary" }, config),
2211
- positive: buildCardColorTheme({ scheme, tone: "positive" }, config),
2212
- caution: buildCardColorTheme({ scheme, tone: "caution" }, config),
2213
- critical: buildCardColorTheme({ scheme, tone: "critical" }, config)
2214
- };
2215
- }
2216
- function buildCardColorTheme(options, config) {
2217
- const { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = { hue: tokens?._hue || "gray", scheme };
2218
- return {
2219
- _blend: (tokens?._blend || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
2220
- _dark: scheme === "dark",
2221
- accent: {
2222
- fg: resolveColorTokenValue(context, tokens?.accent?.fg)
2223
- },
2224
- avatar: buildAvatarColorTheme({ scheme }, tokens),
2225
- backdrop: resolveColorTokenValue(context, tokens?.backdrop),
2226
- badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
2227
- bg: resolveColorTokenValue(context, tokens?.bg),
2228
- border: resolveColorTokenValue(context, tokens?.border),
2229
- button: buildButtonColorTheme({ scheme }, config),
2230
- code: {
2231
- bg: resolveColorTokenValue(context, tokens?.code?.bg),
2232
- fg: resolveColorTokenValue(context, tokens?.code?.fg)
2233
- },
2234
- fg: resolveColorTokenValue(context, tokens?.fg),
2235
- focusRing: resolveColorTokenValue(context, tokens?.focusRing),
2236
- icon: resolveColorTokenValue(context, tokens?.icon),
2237
- input: buildInputColorTheme({ scheme, tone }, config),
2238
- kbd: {
2239
- bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
2240
- fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
2241
- border: resolveColorTokenValue(context, tokens?.kbd?.border)
2242
- },
2243
- link: {
2244
- fg: resolveColorTokenValue(context, tokens?.link?.fg)
2245
- },
2246
- muted: {
2247
- bg: resolveColorTokenValue(context, tokens?.muted?.bg),
2248
- fg: resolveColorTokenValue(context, tokens?.muted?.fg)
2249
- },
2250
- selectable: buildSelectableColorTheme({ scheme }, config),
2251
- shadow: buildShadowColorTheme({ scheme, tone }, config),
2252
- skeleton: {
2253
- from: resolveColorTokenValue(context, tokens?.skeleton?.from),
2254
- to: resolveColorTokenValue(context, tokens?.skeleton?.to)
2255
- },
2256
- syntax: buildSyntaxColorTheme({ scheme }, config)
2257
- };
2258
- }
2259
- function buildShadowColorTheme(options, config) {
2260
- const { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = { hue: tokens?._hue || "gray", scheme };
2261
- return {
2262
- outline: resolveColorTokenValue(context, tokens?.shadow?.outline),
2263
- umbra: resolveColorTokenValue(context, tokens?.shadow?.umbra),
2264
- penumbra: resolveColorTokenValue(context, tokens?.shadow?.penumbra),
2265
- ambient: resolveColorTokenValue(context, tokens?.shadow?.ambient)
2266
- };
2267
- }
2268
- function buildAvatarColorTheme(options, stateTokens) {
2269
- const { scheme } = options;
2270
- return {
2271
- gray: _buildAvatarColorTheme({ color: "gray", scheme }, stateTokens),
2272
- blue: _buildAvatarColorTheme({ color: "blue", scheme }, stateTokens),
2273
- purple: _buildAvatarColorTheme({ color: "purple", scheme }, stateTokens),
2274
- magenta: _buildAvatarColorTheme({ color: "magenta", scheme }, stateTokens),
2275
- red: _buildAvatarColorTheme({ color: "red", scheme }, stateTokens),
2276
- orange: _buildAvatarColorTheme({ color: "orange", scheme }, stateTokens),
2277
- yellow: _buildAvatarColorTheme({ color: "yellow", scheme }, stateTokens),
2278
- green: _buildAvatarColorTheme({ color: "green", scheme }, stateTokens),
2279
- cyan: _buildAvatarColorTheme({ color: "cyan", scheme }, stateTokens)
2280
- };
2281
- }
2282
- function _buildAvatarColorTheme(options, stateTokens) {
2283
- const { color: color2, scheme } = options, tokens = stateTokens?.avatar?.[color2], context = { hue: tokens?._hue || "gray", scheme };
2284
- return {
2285
- _blend: (tokens?._blend || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
2286
- bg: resolveColorTokenValue(context, tokens?.bg),
2287
- fg: resolveColorTokenValue(context, tokens?.fg)
2288
- };
2289
- }
2290
- function buildBadgeColorTheme(tokens, options, config) {
2291
- const { scheme } = options;
2292
- return {
2293
- default: _buildBadgeColorTheme(tokens, { scheme, tone: "default" }, config),
2294
- primary: _buildBadgeColorTheme(tokens, { scheme, tone: "primary" }, config),
2295
- positive: _buildBadgeColorTheme(tokens, { scheme, tone: "positive" }, config),
2296
- caution: _buildBadgeColorTheme(tokens, { scheme, tone: "caution" }, config),
2297
- critical: _buildBadgeColorTheme(tokens, { scheme, tone: "critical" }, config)
2298
- };
2299
- }
2300
- function _buildBadgeColorTheme(parentTokens, options, config) {
2301
- const { scheme, tone } = options, tokens = parentTokens?.[tone], context = { hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", scheme };
2302
- return {
2303
- bg: resolveColorTokenValue(context, tokens?.bg),
2304
- fg: resolveColorTokenValue(context, tokens?.fg),
2305
- dot: resolveColorTokenValue(context, tokens?.dot),
2306
- icon: resolveColorTokenValue(context, tokens?.icon)
2307
- };
2308
- }
2309
- function buildButtonColorTheme(options, config) {
2310
- const { scheme } = options, modes = {};
2311
- for (const mode of THEME_COLOR_BUTTON_MODES)
2312
- modes[mode] = buildButtonTonesColorTheme({ scheme, mode }, config);
2313
- return modes;
2314
- }
2315
- function buildButtonTonesColorTheme(options, config) {
2316
- const { mode, scheme } = options, tones2 = {};
2317
- for (const tone of THEME_COLOR_STATE_TONES)
2318
- tones2[tone] = buildButtonStatesColorTheme({ mode, scheme, tone }, config);
2319
- return tones2;
2320
- }
2321
- function buildButtonStatesColorTheme(options, config) {
2322
- const { mode, scheme, tone } = options, states = {};
2323
- for (const state of THEME_COLOR_STATES)
2324
- states[state] = buildButtonStateColorTheme({ mode, tone, scheme, state }, config);
2325
- return states;
2326
- }
2327
- function buildButtonStateColorTheme(options, config) {
2328
- const { mode, tone, scheme, state } = options, tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
2329
- return {
2330
- _blend: blendMode[scheme === "light" ? 0 : 1],
2331
- accent: {
2332
- fg: resolveColorTokenValue(context, tokens?.accent?.fg)
2333
- },
2334
- avatar: buildAvatarColorTheme({ scheme }, tokens),
2335
- badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
2336
- bg: resolveColorTokenValue(context, tokens?.bg),
2337
- border: resolveColorTokenValue(context, tokens?.border),
2338
- code: {
2339
- bg: resolveColorTokenValue(context, tokens?.code?.bg),
2340
- fg: resolveColorTokenValue(context, tokens?.code?.fg)
2341
- },
2342
- fg: resolveColorTokenValue(context, tokens?.fg),
2343
- icon: resolveColorTokenValue(context, tokens?.icon),
2344
- muted: {
2345
- bg: resolveColorTokenValue(context, tokens?.muted?.bg),
2346
- fg: resolveColorTokenValue(context, tokens?.muted?.fg)
2347
- },
2348
- kbd: {
2349
- bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
2350
- fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
2351
- border: resolveColorTokenValue(context, tokens?.kbd?.border)
2352
- },
2353
- link: {
2354
- fg: resolveColorTokenValue(context, tokens?.link?.fg)
2355
- },
2356
- skeleton: {
2357
- from: resolveColorTokenValue(context, tokens?.skeleton?.from),
2358
- to: resolveColorTokenValue(context, tokens?.skeleton?.to)
2359
- }
2360
- };
2361
- }
2362
- function buildInputColorTheme(options, config) {
2363
- const { scheme, tone } = options;
2364
- return {
2365
- default: buildInputStatesColorTheme({ mode: "default", scheme, tone }, config),
2366
- invalid: buildInputStatesColorTheme({ mode: "invalid", scheme, tone }, config)
2367
- };
2368
- }
2369
- function buildInputStatesColorTheme(options, config) {
2370
- const { mode, scheme, tone } = options;
2371
- return {
2372
- enabled: buildInputStateColorTheme({ mode, scheme, state: "enabled", tone }, config),
2373
- hovered: buildInputStateColorTheme({ mode, scheme, state: "hovered", tone }, config),
2374
- readOnly: buildInputStateColorTheme({ mode, scheme, state: "readOnly", tone }, config),
2375
- disabled: buildInputStateColorTheme({ mode, scheme, state: "disabled", tone }, config)
2376
- };
2377
- }
2378
- function buildInputStateColorTheme(options, config) {
2379
- const { mode, tone, scheme, state } = options, tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
2380
- return {
2381
- _blend: blendMode[scheme === "light" ? 0 : 1],
2382
- bg: resolveColorTokenValue(context, tokens?.bg),
2383
- border: resolveColorTokenValue(context, tokens?.border),
2384
- fg: resolveColorTokenValue(context, tokens?.fg),
2385
- muted: {
2386
- bg: resolveColorTokenValue(context, tokens?.muted?.bg)
2387
- },
2388
- placeholder: resolveColorTokenValue(context, tokens?.placeholder)
2389
- };
2390
- }
2391
- function buildSelectableColorTheme(options, config) {
2392
- const { scheme } = options, tones2 = {};
2393
- for (const tone of THEME_COLOR_STATE_TONES)
2394
- tones2[tone] = buildSelectableStatesColorTheme({ scheme, tone }, config);
2395
- return tones2;
2396
- }
2397
- function buildSelectableStatesColorTheme(options, config) {
2398
- const { scheme, tone } = options, states = {};
2399
- for (const state of THEME_COLOR_STATES)
2400
- states[state] = buildSelectableStateColorTheme({ tone, scheme, state }, config);
2401
- return states;
2402
- }
2403
- function buildSelectableStateColorTheme(options, config) {
2404
- const { scheme, state, tone } = options, tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
2405
- return {
2406
- _blend: blendMode[scheme === "light" ? 0 : 1],
2407
- accent: {
2408
- fg: resolveColorTokenValue(context, tokens?.accent?.fg)
2409
- },
2410
- avatar: buildAvatarColorTheme({ scheme }, tokens),
2411
- badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
2412
- bg: resolveColorTokenValue(context, tokens?.bg),
2413
- border: resolveColorTokenValue(context, tokens?.border),
2414
- code: {
2415
- bg: resolveColorTokenValue(context, tokens?.code?.bg),
2416
- fg: resolveColorTokenValue(context, tokens?.code?.fg)
2417
- },
2418
- fg: resolveColorTokenValue(context, tokens?.fg),
2419
- icon: resolveColorTokenValue(context, tokens?.icon),
2420
- muted: {
2421
- bg: resolveColorTokenValue(context, tokens?.muted?.bg),
2422
- fg: resolveColorTokenValue(context, tokens?.muted?.fg)
2423
- },
2424
- kbd: {
2425
- bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
2426
- fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
2427
- border: resolveColorTokenValue(context, tokens?.kbd?.border)
2428
- },
2429
- link: {
2430
- fg: resolveColorTokenValue(context, tokens?.link?.fg)
2431
- },
2432
- skeleton: {
2433
- from: resolveColorTokenValue(context, tokens?.skeleton?.from),
2434
- to: resolveColorTokenValue(context, tokens?.skeleton?.to)
2435
- }
2436
- };
2437
- }
2438
- function buildSyntaxColorTheme(options, config) {
2439
- const { scheme } = options, tokens = config?.color?.syntax, context = { hue: "gray", scheme };
2440
- return {
2441
- atrule: resolveColorTokenValue(context, tokens?.atrule),
2442
- attrName: resolveColorTokenValue(context, tokens?.attrName),
2443
- attrValue: resolveColorTokenValue(context, tokens?.attrValue),
2444
- attribute: resolveColorTokenValue(context, tokens?.attribute),
2445
- boolean: resolveColorTokenValue(context, tokens?.boolean),
2446
- builtin: resolveColorTokenValue(context, tokens?.builtin),
2447
- cdata: resolveColorTokenValue(context, tokens?.cdata),
2448
- char: resolveColorTokenValue(context, tokens?.char),
2449
- class: resolveColorTokenValue(context, tokens?.class),
2450
- className: resolveColorTokenValue(context, tokens?.className),
2451
- comment: resolveColorTokenValue(context, tokens?.comment),
2452
- constant: resolveColorTokenValue(context, tokens?.constant),
2453
- deleted: resolveColorTokenValue(context, tokens?.deleted),
2454
- doctype: resolveColorTokenValue(context, tokens?.doctype),
2455
- entity: resolveColorTokenValue(context, tokens?.entity),
2456
- function: resolveColorTokenValue(context, tokens?.function),
2457
- hexcode: resolveColorTokenValue(context, tokens?.hexcode),
2458
- id: resolveColorTokenValue(context, tokens?.id),
2459
- important: resolveColorTokenValue(context, tokens?.important),
2460
- inserted: resolveColorTokenValue(context, tokens?.inserted),
2461
- keyword: resolveColorTokenValue(context, tokens?.keyword),
2462
- number: resolveColorTokenValue(context, tokens?.number),
2463
- operator: resolveColorTokenValue(context, tokens?.operator),
2464
- prolog: resolveColorTokenValue(context, tokens?.prolog),
2465
- property: resolveColorTokenValue(context, tokens?.property),
2466
- pseudoClass: resolveColorTokenValue(context, tokens?.pseudoClass),
2467
- pseudoElement: resolveColorTokenValue(context, tokens?.pseudoElement),
2468
- punctuation: resolveColorTokenValue(context, tokens?.punctuation),
2469
- regex: resolveColorTokenValue(context, tokens?.regex),
2470
- selector: resolveColorTokenValue(context, tokens?.selector),
2471
- string: resolveColorTokenValue(context, tokens?.string),
2472
- symbol: resolveColorTokenValue(context, tokens?.symbol),
2473
- tag: resolveColorTokenValue(context, tokens?.tag),
2474
- unit: resolveColorTokenValue(context, tokens?.unit),
2475
- url: resolveColorTokenValue(context, tokens?.url),
2476
- variable: resolveColorTokenValue(context, tokens?.variable)
2477
- };
2478
- }
2479
- const defaultColorPalette = color;
2480
- function mixChannel(b, s, weight) {
2481
- const delta = (s - b) * weight;
2482
- return b + delta;
2483
- }
2484
- function mix(b, s, weight) {
2485
- return {
2486
- r: mixChannel(b.r, s.r, weight),
2487
- g: mixChannel(b.g, s.g, weight),
2488
- b: mixChannel(b.b, s.b, weight)
2489
- };
2490
- }
2491
- function multiplyChannel(b, s) {
2492
- return b * s;
2493
- }
2494
- function multiply(b, s) {
2495
- return {
2496
- r: multiplyChannel(b.r / 255, s.r / 255) * 255,
2497
- g: multiplyChannel(b.g / 255, s.g / 255) * 255,
2498
- b: multiplyChannel(b.b / 255, s.b / 255) * 255
2499
- };
2500
- }
2501
- function screenChannel(b, s) {
2502
- return b + s - b * s;
2503
- }
2504
- function screen(b, s) {
2505
- return {
2506
- r: screenChannel(b.r / 255, s.r / 255) * 255,
2507
- g: screenChannel(b.g / 255, s.g / 255) * 255,
2508
- b: screenChannel(b.b / 255, s.b / 255) * 255
2509
- };
2510
- }
2511
- function lerp(x, y, a) {
2512
- return x * (1 - a) + y * a;
2513
- }
2514
- function invlerp(x, y, a) {
2515
- return clamp((a - x) / (y - x));
2516
- }
2517
- function clamp(a, min = 0, max = 1) {
2518
- return Math.min(max, Math.max(min, a));
2519
- }
2520
- function range(x1, y1, x2, y2, a) {
2521
- return lerp(x2, y2, invlerp(x1, y1, a));
2522
- }
2523
- function round(value) {
2524
- return Math.round(value);
2525
- }
2526
- function hexToRgb(hex) {
2527
- if (hex.length === 4) {
2528
- const hexR = hex.slice(1, 2), hexG = hex.slice(2, 3), hexB = hex.slice(3, 4);
2529
- return {
2530
- r: parseInt(hexR + hexR, 16),
2531
- g: parseInt(hexG + hexG, 16),
2532
- b: parseInt(hexB + hexB, 16)
2533
- };
2534
- }
2535
- return {
2536
- r: parseInt(hex.slice(1, 3), 16),
2537
- g: parseInt(hex.slice(3, 5), 16),
2538
- b: parseInt(hex.slice(5, 7), 16)
2539
- };
2540
- }
2541
- function rgbaToRGBA(rgba2) {
2542
- const values = rgba2.replace(/rgba\(|\)/g, "").split(",");
2543
- return {
2544
- r: parseInt(values[0]),
2545
- g: parseInt(values[1]),
2546
- b: parseInt(values[2]),
2547
- a: parseFloat(values[3])
2548
- };
2549
- }
2550
- function rgbToHex(color2) {
2551
- const r = round(clamp(Math.round(color2.r), 0, 255)), g = round(clamp(Math.round(color2.g), 0, 255)), b = round(clamp(Math.round(color2.b), 0, 255));
2552
- return "a" in color2 ? `rgba(${r},${g},${b},${color2.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
2553
- }
2554
- function rgbToHsl({ r, g, b }) {
2555
- r /= 255, g /= 255, b /= 255;
2556
- const cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin;
2557
- let h = 0, s = 0, l = 0;
2558
- return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), { h, s, l };
2559
- }
2560
- function hslToRgb(hsl) {
2561
- const s = hsl.s / 100, l = hsl.l / 100, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hsl.h / 60 % 2 - 1)), m = l - c / 2;
2562
- let r = 0, g = 0, b = 0;
2563
- return 0 <= hsl.h && hsl.h < 60 ? (r = c, g = x, b = 0) : 60 <= hsl.h && hsl.h < 120 ? (r = x, g = c, b = 0) : 120 <= hsl.h && hsl.h < 180 ? (r = 0, g = c, b = x) : 180 <= hsl.h && hsl.h < 240 ? (r = 0, g = x, b = c) : 240 <= hsl.h && hsl.h < 300 ? (r = x, g = 0, b = c) : 300 <= hsl.h && hsl.h < 360 && (r = c, g = 0, b = x), {
2564
- r: Math.round((r + m) * 255),
2565
- g: Math.round((g + m) * 255),
2566
- b: Math.round((b + m) * 255)
2567
- };
2568
- }
2569
- const HEX_CHARS = "0123456789ABCDEFabcdef", HSL_RE = /hsl\(\s*(\d+)\s*,\s*((\d+(?:\.\d+)?)%)\s*,\s*((\d+(?:\.\d+)?)%)\s*\)/i;
2570
- function isHexChars(str) {
2571
- for (const c of str)
2572
- if (HEX_CHARS.indexOf(c) === -1)
2573
- return !1;
2574
- return !0;
2575
- }
2576
- function isHex(str) {
2577
- return str[0] !== "#" || !(str.length === 4 || str.length === 7) ? !1 : isHexChars(str.slice(1));
2578
- }
2579
- function parseHsl(str) {
2580
- const res = HSL_RE.exec(str);
2581
- if (!res)
2582
- throw new Error(`parseHsl: string is not a HSL color: "${str}"`);
2583
- return { h: parseInt(res[1]), s: parseFloat(res[3]), l: parseFloat(res[5]) };
2584
- }
2585
- function parseColor(color2) {
2586
- if (!color2) return { r: 0, g: 0, b: 0 };
2587
- if (typeof color2 != "string")
2588
- throw new Error("parseColor: expected a string");
2589
- if (isHex(color2))
2590
- return hexToRgb(color2);
2591
- if (color2.startsWith("hsl("))
2592
- return hslToRgb(parseHsl(color2));
2593
- if (color2.startsWith("rgba("))
2594
- return rgbaToRGBA(color2);
2595
- throw new Error(`parseColor: unexpected color format: "${color2}"`);
2596
- }
2597
- function getContrastRatio(bg, fg) {
2598
- const rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
2599
- return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
2600
- }
2601
- function rgb_lrgb({ r, g, b }) {
2602
- return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
2603
- }
2604
- function rgb_lrgb1(v) {
2605
- return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
2606
- }
2607
- function lrgb_luminance([r, g, b]) {
2608
- return 0.2126 * r + 0.7152 * g + 0.0722 * b;
2609
- }
2610
- function rgba(color2, a) {
2611
- const rgb = parseColor(color2);
2612
- return `rgba(${rgb.r},${rgb.g},${rgb.b},${a})`;
2613
- }
2614
- const RGB_RANGE = [0, 255];
2615
- function mixThemeColor(value, options) {
2616
- const { blendMode } = options, color2 = parseColor(value), black2 = parseColor(options.black), white2 = parseColor(options.white), bg = options.bg ? parseColor(options.bg) : blendMode === "multiply" ? white2 : black2, paletteRange = {
2617
- r: [black2.r, white2.r],
2618
- g: [black2.g, white2.g],
2619
- b: [black2.b, white2.b]
2620
- }, convertedBgColor = {
2621
- r: clamp(range(...paletteRange.r, ...RGB_RANGE, bg.r), ...RGB_RANGE),
2622
- g: clamp(range(...paletteRange.g, ...RGB_RANGE, bg.g), ...RGB_RANGE),
2623
- b: clamp(range(...paletteRange.b, ...RGB_RANGE, bg.b), ...RGB_RANGE)
2624
- }, convertedColor = {
2625
- r: clamp(range(...paletteRange.r, ...RGB_RANGE, color2.r), ...RGB_RANGE),
2626
- g: clamp(range(...paletteRange.g, ...RGB_RANGE, color2.g), ...RGB_RANGE),
2627
- b: clamp(range(...paletteRange.b, ...RGB_RANGE, color2.b), ...RGB_RANGE)
2628
- }, resultColor = blendMode === "multiply" ? multiply(convertedBgColor, convertedColor) : screen(convertedBgColor, convertedColor), v = {
2629
- r: clamp(range(...RGB_RANGE, ...paletteRange.r, resultColor.r), ...paletteRange.r),
2630
- g: clamp(range(...RGB_RANGE, ...paletteRange.g, resultColor.g), ...paletteRange.g),
2631
- b: clamp(range(...RGB_RANGE, ...paletteRange.b, resultColor.b), ...paletteRange.b)
2632
- };
2633
- return rgbToHex(v);
2634
- }
2635
- function renderColorValue(str, options) {
2636
- const { bg, blendMode, colorPalette } = options;
2637
- if (bg === "white")
2638
- throw new Error("Cannot blend with white background");
2639
- const node = parseTokenValue(str);
2640
- if (!node || node.type !== "color")
2641
- throw new Error(`Invalid color token value: ${str}`);
2642
- let hex = "";
2643
- if (node.key === "black" && (hex = renderColorHex(colorPalette.black)), node.key === "white" && (hex = renderColorHex(colorPalette.white)), node.hue && node.tint && (hex = renderColorHex(colorPalette[node.hue][node.tint])), !hex)
2644
- throw new Error(`Invalid color token value: ${str}`);
2645
- const hexBeforeMix = hex, mixOptions = {
2646
- blendMode,
2647
- bg,
2648
- black: renderColorHex(colorPalette.black),
2649
- // opacity: node.opacity,
2650
- white: renderColorHex(colorPalette.white)
2651
- };
2652
- try {
2653
- if (hex = mixThemeColor(hex, mixOptions), bg && node.mix !== void 0) {
2654
- const from = hexToRgb(bg), to = hexToRgb(hex);
2655
- hex = rgbToHex(mix(from, to, node.mix));
2656
- }
2657
- } catch (err) {
2658
- throw console.warn("could not blend", hex, mixOptions), err;
2659
- }
2660
- return hex === "#aN" && (console.warn(`invalid color token value: ${str}`), hex = hexBeforeMix), node.opacity !== void 0 && (hex = rgba(hex, node.opacity)), hex;
2661
- }
2662
- function renderColorHex(color2) {
2663
- return typeof color2 == "string" ? color2 : color2.hex;
2664
- }
2665
- function renderThemeColorSchemes(value, config) {
2666
- const colorPalette = config?.palette ?? defaultColorPalette;
2667
- return {
2668
- light: renderThemeColorScheme(colorPalette, value.light),
2669
- dark: renderThemeColorScheme(colorPalette, value.dark)
2670
- };
2671
- }
2672
- function renderThemeColorScheme(colorPalette, value) {
2673
- const toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, { colorPalette }), renderedDefaultTone = renderThemeColor(defaultTone, { colorPalette }), bg = renderedDefaultTone.bg;
2674
- if (bg === "white")
2675
- throw new Error("Cannot blend with white background");
2676
- return Object.fromEntries([
2677
- ["transparent", renderedTransparentTone],
2678
- ["default", renderedDefaultTone],
2679
- ...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [k, renderThemeColor(v, { bg, colorPalette })])
2680
- ]);
2681
- }
2682
- function renderThemeColor(value, options) {
2683
- const { colorPalette, bg } = options, blendMode = value._blend || "multiply", baseBg = renderColorValue(value.bg, { colorPalette, bg, blendMode }), colorOptions = { colorPalette, bg: baseBg, blendMode }, button = renderThemeColorButton(value.button, {
2684
- baseBg,
2685
- blendMode,
2686
- colorPalette
2687
- }), selectable = renderThemeColorSelectable(value.selectable, {
2688
- colorPalette,
2689
- baseBg,
2690
- blendMode
2691
- }), shadow = {
2692
- outline: renderColorValue(value.shadow.outline, colorOptions),
2693
- umbra: renderColorValue(value.shadow.umbra, {
2694
- ...colorOptions,
2695
- bg: void 0,
2696
- colorPalette: { ...colorPalette, black: "#000000" }
2697
- }),
2698
- penumbra: renderColorValue(value.shadow.penumbra, {
2699
- ...colorOptions,
2700
- bg: void 0,
2701
- colorPalette: { ...colorPalette, black: "#000000" }
2702
- }),
2703
- ambient: renderColorValue(value.shadow.ambient, {
2704
- ...colorOptions,
2705
- bg: void 0,
2706
- colorPalette: { ...colorPalette, black: "#000000" }
2707
- })
2708
- };
2709
- return {
2710
- _blend: blendMode,
2711
- _dark: value._dark,
2712
- accent: {
2713
- fg: renderColorValue(value.accent.fg, colorOptions)
2714
- },
2715
- avatar: renderThemeColorAvatar(value.avatar, { baseBg, colorPalette, blendMode }),
2716
- backdrop: renderColorValue(value.backdrop, colorOptions),
2717
- badge: renderThemeColorBadge(value.badge, { baseBg, colorPalette, blendMode }),
2718
- bg: baseBg,
2719
- border: renderColorValue(value.border, colorOptions),
2720
- button,
2721
- code: {
2722
- bg: renderColorValue(value.code.bg, colorOptions),
2723
- fg: renderColorValue(value.code.fg, colorOptions)
2724
- },
2725
- fg: renderColorValue(value.fg, colorOptions),
2726
- focusRing: renderColorValue(value.focusRing, colorOptions),
2727
- icon: renderColorValue(value.icon, colorOptions),
2728
- input: renderThemeColorInput(value.input, { baseBg, colorPalette, blendMode }),
2729
- kbd: renderThemeColorKBD(value.kbd, { baseBg, colorPalette, blendMode }),
2730
- link: {
2731
- fg: renderColorValue(value.link.fg, colorOptions)
2732
- },
2733
- muted: {
2734
- bg: renderColorValue(value.muted.bg, colorOptions),
2735
- fg: renderColorValue(value.muted.fg, colorOptions)
2736
- },
2737
- shadow,
2738
- skeleton: {
2739
- from: renderColorValue(value.skeleton.from, colorOptions),
2740
- to: renderColorValue(value.skeleton.to, colorOptions)
2741
- },
2742
- syntax: renderSyntaxColorTheme(value.syntax, { baseBg, colorPalette, blendMode }),
2743
- selectable
2744
- };
2745
- }
2746
- function renderThemeColorKBD(value, options) {
2747
- const { baseBg, blendMode, colorPalette } = options, rootOptions = {
2748
- bg: baseBg,
2749
- blendMode,
2750
- colorPalette
2751
- }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
2752
- bg,
2753
- blendMode,
2754
- colorPalette
2755
- };
2756
- return {
2757
- bg,
2758
- fg: renderColorValue(value.fg, colorOptions),
2759
- border: renderColorValue(value.border, colorOptions)
2760
- };
2761
- }
2762
- function renderThemeColorAvatar(value, options) {
2763
- return {
2764
- gray: renderThemeColorAvatarColor(value.gray, options),
2765
- blue: renderThemeColorAvatarColor(value.blue, options),
2766
- purple: renderThemeColorAvatarColor(value.purple, options),
2767
- magenta: renderThemeColorAvatarColor(value.magenta, options),
2768
- red: renderThemeColorAvatarColor(value.red, options),
2769
- orange: renderThemeColorAvatarColor(value.orange, options),
2770
- yellow: renderThemeColorAvatarColor(value.yellow, options),
2771
- green: renderThemeColorAvatarColor(value.green, options),
2772
- cyan: renderThemeColorAvatarColor(value.cyan, options)
2773
- };
2774
- }
2775
- function renderThemeColorAvatarColor(value, options) {
2776
- const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
2777
- bg: baseBg,
2778
- blendMode: rootBlendMode,
2779
- colorPalette
2780
- }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
2781
- bg,
2782
- blendMode,
2783
- colorPalette
2784
- };
2785
- return {
2786
- _blend: blendMode,
2787
- bg,
2788
- fg: renderColorValue(value.fg, colorOptions)
2789
- };
2790
- }
2791
- function renderThemeColorBadge(value, options) {
2792
- return {
2793
- default: renderThemeColorBadgeColor(value.default, options),
2794
- primary: renderThemeColorBadgeColor(value.primary, options),
2795
- positive: renderThemeColorBadgeColor(value.positive, options),
2796
- caution: renderThemeColorBadgeColor(value.caution, options),
2797
- critical: renderThemeColorBadgeColor(value.critical, options)
2798
- };
2799
- }
2800
- function renderThemeColorBadgeColor(value, options) {
2801
- const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = rootBlendMode, rootOptions = {
2802
- bg: baseBg,
2803
- blendMode: rootBlendMode,
2804
- colorPalette
2805
- }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
2806
- bg,
2807
- blendMode,
2808
- colorPalette
2809
- };
2810
- return {
2811
- bg,
2812
- dot: renderColorValue(value.dot, colorOptions),
2813
- fg: renderColorValue(value.fg, colorOptions),
2814
- icon: renderColorValue(value.icon, colorOptions)
2815
- };
2816
- }
2817
- function renderThemeColorButton(value, options) {
2818
- return {
2819
- default: renderThemeColorButtonTones(value.default, options),
2820
- ghost: renderThemeColorButtonTones(value.ghost, options),
2821
- bleed: renderThemeColorButtonTones(value.bleed, options)
2822
- };
2823
- }
2824
- function renderThemeColorButtonTones(value, options) {
2825
- return {
2826
- default: renderThemeColorButtonStates(value.default, options),
2827
- primary: renderThemeColorButtonStates(value.primary, options),
2828
- positive: renderThemeColorButtonStates(value.positive, options),
2829
- caution: renderThemeColorButtonStates(value.caution, options),
2830
- critical: renderThemeColorButtonStates(value.critical, options)
2831
- };
2832
- }
2833
- function renderThemeColorButtonStates(value, options) {
2834
- return {
2835
- enabled: renderThemeColorState(value.enabled, options),
2836
- hovered: renderThemeColorState(value.hovered, options),
2837
- pressed: renderThemeColorState(value.pressed, options),
2838
- selected: renderThemeColorState(value.selected, options),
2839
- disabled: renderThemeColorState(value.disabled, options)
2840
- };
2841
- }
2842
- function renderThemeColorState(value, options) {
2843
- const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
2844
- bg: baseBg,
2845
- blendMode: rootBlendMode,
2846
- colorPalette
2847
- }, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
2848
- bg,
2849
- blendMode,
2850
- colorPalette
2851
- };
2852
- return {
2853
- _blend: blendMode,
2854
- accent: {
2855
- fg: renderColorValue(value.accent.fg, colorOptions)
2856
- },
2857
- avatar: renderThemeColorAvatar(value.avatar, { baseBg: bg, colorPalette, blendMode }),
2858
- badge: renderThemeColorBadge(value.badge, { baseBg: bg, colorPalette, blendMode }),
2859
- bg,
2860
- border: renderColorValue(value.border, colorOptions),
2861
- code: {
2862
- bg: renderColorValue(value.code.bg, colorOptions),
2863
- fg: renderColorValue(value.code.fg, colorOptions)
2864
- },
2865
- fg: renderColorValue(value.fg, colorOptions),
2866
- icon: renderColorValue(value.icon, colorOptions),
2867
- link: {
2868
- fg: renderColorValue(value.link.fg, colorOptions)
2869
- },
2870
- muted: {
2871
- bg: renderColorValue(value.muted.bg, colorOptions),
2872
- fg: renderColorValue(value.muted.fg, colorOptions)
2873
- },
2874
- kbd: {
2875
- bg: renderColorValue(value.kbd.bg, colorOptions),
2876
- fg: renderColorValue(value.kbd.fg, colorOptions),
2877
- border: renderColorValue(value.kbd.border, colorOptions)
2878
- },
2879
- skeleton: {
2880
- from: renderColorValue(value.skeleton?.from, colorOptions),
2881
- to: renderColorValue(value.skeleton?.to, colorOptions)
2882
- }
2883
- };
2884
- }
2885
- function renderThemeColorInput(value, options) {
2886
- return {
2887
- default: renderInputStatesColorTheme(value.default, options),
2888
- invalid: renderInputStatesColorTheme(value.invalid, options)
2889
- };
2890
- }
2891
- function renderInputStatesColorTheme(value, options) {
2892
- return {
2893
- enabled: renderInputStateColorTheme(value.enabled, options),
2894
- hovered: renderInputStateColorTheme(value.hovered, options),
2895
- readOnly: renderInputStateColorTheme(value.readOnly, options),
2896
- disabled: renderInputStateColorTheme(value.disabled, options)
2897
- };
2898
- }
2899
- function renderInputStateColorTheme(value, options) {
2900
- const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = { colorPalette, bg: baseBg, blendMode: rootBlendMode }, bg = renderColorValue(value.bg, rootOptions), colorOptions = { colorPalette, bg, blendMode };
2901
- return {
2902
- _blend: blendMode,
2903
- bg,
2904
- border: renderColorValue(value.border, colorOptions),
2905
- fg: renderColorValue(value.fg, colorOptions),
2906
- muted: {
2907
- bg: renderColorValue(value.muted.bg, colorOptions)
2908
- },
2909
- placeholder: renderColorValue(value.placeholder, colorOptions)
2910
- };
2911
- }
2912
- function renderThemeColorSelectable(value, options) {
2913
- return {
2914
- default: renderThemeColorSelectableStates(value.default, options),
2915
- primary: renderThemeColorSelectableStates(value.primary, options),
2916
- positive: renderThemeColorSelectableStates(value.positive, options),
2917
- caution: renderThemeColorSelectableStates(value.caution, options),
2918
- critical: renderThemeColorSelectableStates(value.critical, options)
2919
- };
2920
- }
2921
- function renderThemeColorSelectableStates(value, options) {
2922
- return {
2923
- enabled: renderThemeColorState(value.enabled, options),
2924
- hovered: renderThemeColorState(value.hovered, options),
2925
- pressed: renderThemeColorState(value.pressed, options),
2926
- selected: renderThemeColorState(value.selected, options),
2927
- disabled: renderThemeColorState(value.disabled, options)
2928
- };
2929
- }
2930
- function renderSyntaxColorTheme(value, options) {
2931
- const { colorPalette, baseBg, blendMode } = options, colorOptions = { colorPalette, bg: baseBg, blendMode };
2932
- return {
2933
- atrule: renderColorValue(value.atrule, colorOptions),
2934
- attrName: renderColorValue(value.attrName, colorOptions),
2935
- attrValue: renderColorValue(value.attrValue, colorOptions),
2936
- attribute: renderColorValue(value.attribute, colorOptions),
2937
- boolean: renderColorValue(value.boolean, colorOptions),
2938
- builtin: renderColorValue(value.builtin, colorOptions),
2939
- cdata: renderColorValue(value.cdata, colorOptions),
2940
- char: renderColorValue(value.char, colorOptions),
2941
- class: renderColorValue(value.class, colorOptions),
2942
- className: renderColorValue(value.className, colorOptions),
2943
- comment: renderColorValue(value.comment, colorOptions),
2944
- constant: renderColorValue(value.constant, colorOptions),
2945
- deleted: renderColorValue(value.deleted, colorOptions),
2946
- doctype: renderColorValue(value.doctype, colorOptions),
2947
- entity: renderColorValue(value.entity, colorOptions),
2948
- function: renderColorValue(value.function, colorOptions),
2949
- hexcode: renderColorValue(value.hexcode, colorOptions),
2950
- id: renderColorValue(value.id, colorOptions),
2951
- important: renderColorValue(value.important, colorOptions),
2952
- inserted: renderColorValue(value.inserted, colorOptions),
2953
- keyword: renderColorValue(value.keyword, colorOptions),
2954
- number: renderColorValue(value.number, colorOptions),
2955
- operator: renderColorValue(value.operator, colorOptions),
2956
- prolog: renderColorValue(value.prolog, colorOptions),
2957
- property: renderColorValue(value.property, colorOptions),
2958
- pseudoClass: renderColorValue(value.pseudoClass, colorOptions),
2959
- pseudoElement: renderColorValue(value.pseudoElement, colorOptions),
2960
- punctuation: renderColorValue(value.punctuation, colorOptions),
2961
- regex: renderColorValue(value.regex, colorOptions),
2962
- selector: renderColorValue(value.selector, colorOptions),
2963
- string: renderColorValue(value.string, colorOptions),
2964
- symbol: renderColorValue(value.symbol, colorOptions),
2965
- tag: renderColorValue(value.tag, colorOptions),
2966
- unit: renderColorValue(value.unit, colorOptions),
2967
- url: renderColorValue(value.url, colorOptions),
2968
- variable: renderColorValue(value.variable, colorOptions)
2969
- };
2970
- }
2971
- function buildTheme(config) {
2972
- const colorTheme = buildColorTheme(config), v2 = {
2973
- _version: 2,
2974
- avatar: config?.avatar ?? defaultThemeConfig.avatar,
2975
- button: config?.button ?? defaultThemeConfig.button,
2976
- card: config?.card ?? defaultThemeConfig.card,
2977
- // How colors are generated:
2978
- // 1. Merge custom tokens with default tokens
2979
- // 2. Generate tree of color keys (gray/500, black, white, etc.)
2980
- // 3. Apply mixing and render to hex values
2981
- // render(build(mergeWithDefaults()))
2982
- color: renderThemeColorSchemes(colorTheme, config),
2983
- container: config?.container ?? defaultThemeConfig.container,
2984
- font: config?.font ?? defaultThemeFonts,
2985
- input: config?.input ?? defaultThemeConfig.input,
2986
- layer: config?.layer ?? defaultThemeConfig.layer,
2987
- media: config?.media ?? defaultThemeConfig.media,
2988
- radius: config?.radius ?? defaultThemeConfig.radius,
2989
- shadow: config?.shadow ?? defaultThemeConfig.shadow,
2990
- space: config?.space ?? defaultThemeConfig.space,
2991
- style: config?.style ?? defaultThemeConfig.style
2992
- };
2993
- return v2_v0(v2);
2994
- }
2995
- const cache = /* @__PURE__ */ new Map();
2996
- function getScopedTheme(themeProp, scheme, tone) {
2997
- const cachedTheme = _getCachedTheme(themeProp, scheme, tone);
2998
- if (cachedTheme) return cachedTheme;
2999
- const v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp, v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp), colorScheme_v0 = v0.color[scheme] || v0.color.light, color_v0 = colorScheme_v0[tone] || colorScheme_v0.default, layer_v0 = v0.layer || defaultThemeConfig.layer, colorScheme_v2 = v2.color[scheme] || v2.color.light, color_v2 = colorScheme_v2[tone] || colorScheme_v2.default, layer_v2 = v2.layer || defaultThemeConfig.layer, theme = {
3000
- sanity: {
3001
- ...v0,
3002
- color: color_v0,
3003
- layer: layer_v0,
3004
- v2: {
3005
- ...v2,
3006
- _resolved: !0,
3007
- color: color_v2,
3008
- layer: layer_v2
3009
- }
3010
- }
3011
- };
3012
- return _setCachedTheme(themeProp, scheme, tone, theme), theme;
3013
- }
3014
- function _getCachedTheme(rootTheme, scheme, tone) {
3015
- const schemeCache = cache.get(scheme);
3016
- if (!schemeCache) return;
3017
- const toneCache = schemeCache.get(tone);
3018
- if (toneCache)
3019
- return toneCache.get(rootTheme);
3020
- }
3021
- function _setCachedTheme(rootTheme, scheme, tone, theme) {
3022
- cache.has(scheme) || cache.set(scheme, /* @__PURE__ */ new Map());
3023
- const schemeCache = cache.get(scheme);
3024
- schemeCache.has(tone) || schemeCache.set(tone, /* @__PURE__ */ new WeakMap()), schemeCache.get(tone).set(rootTheme, theme);
3025
- }
3026
- export {
3027
- AVATAR_SIZE,
3028
- COLOR_CONFIG_AVATAR_COLORS,
3029
- COLOR_CONFIG_BLEND_KEYS,
3030
- COLOR_CONFIG_CARD_KEYS,
3031
- COLOR_CONFIG_CARD_TONES,
3032
- COLOR_CONFIG_INPUT_MODES,
3033
- COLOR_CONFIG_INPUT_STATES,
3034
- COLOR_CONFIG_STATES,
3035
- COLOR_CONFIG_STATE_KEYS,
3036
- COLOR_CONFIG_STATE_TONES,
3037
- CONTAINER,
3038
- FONT_CODE_SIZE,
3039
- FONT_HEADING_SIZE,
3040
- FONT_LABEL_SIZE,
3041
- FONT_TEXT_SIZE,
3042
- RADIUS,
3043
- SHADOW,
3044
- SPACE,
3045
- THEME_COLOR_AVATAR_COLORS,
3046
- THEME_COLOR_BLEND_MODES,
3047
- THEME_COLOR_BUTTON_MODES,
3048
- THEME_COLOR_CARD_TONES,
3049
- THEME_COLOR_INPUT_MODES,
3050
- THEME_COLOR_INPUT_STATES,
3051
- THEME_COLOR_SCHEMES,
3052
- THEME_COLOR_STATES,
3053
- THEME_COLOR_STATE_TONES,
3054
- buildTheme,
3055
- createColorTheme,
3056
- getContrastRatio,
3057
- getScopedTheme,
3058
- getTheme_v2,
3059
- hexToRgb,
3060
- hslToRgb,
3061
- isColorBlendModeValue,
3062
- isColorButtonMode,
3063
- isColorConfigBaseKey,
3064
- isColorConfigBaseTone,
3065
- isColorConfigBlendKey,
3066
- isColorConfigStateKey,
3067
- isColorConfigStateTone,
3068
- isColorHueKey,
3069
- isColorOpacityValue,
3070
- isColorTintKey,
3071
- isColorTokenValue,
3072
- isColorValue,
3073
- is_v0,
3074
- is_v2,
3075
- mix,
3076
- multiply,
3077
- parseColor,
3078
- parseTokenKey,
3079
- parseTokenValue,
3080
- rgbToHex,
3081
- rgbToHsl,
3082
- rgba,
3083
- rgbaToRGBA,
3084
- screen,
3085
- v0_v2,
3086
- v2_v0
3087
- };
3088
- //# sourceMappingURL=theme.esm.js.map