@sanity/ui 4.2.0 → 5.0.0-alpha.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 (339) hide show
  1. package/README.md +194 -28
  2. package/bin/sanity-ui.js +14 -0
  3. package/dist/_chunks-es/LazyRefractor.js +20 -0
  4. package/dist/_chunks-es/LazyRefractor.js.map +1 -0
  5. package/dist/cli/checks.js +148 -0
  6. package/dist/cli/config.js +23 -0
  7. package/dist/cli/detect.js +181 -0
  8. package/dist/cli/doctor.js +49 -0
  9. package/dist/cli/index.js +69 -0
  10. package/dist/cli/init.js +189 -0
  11. package/dist/cli/install.js +79 -0
  12. package/dist/cli/log.js +66 -0
  13. package/dist/cli/selfPackage.js +11 -0
  14. package/dist/cli/styles.js +185 -0
  15. package/dist/cli/test-utils.js +8 -0
  16. package/dist/cli/tsconfig.js +236 -0
  17. package/dist/cli/types.js +1 -0
  18. package/dist/cli/versions.js +45 -0
  19. package/dist/index.d.ts +1203 -1469
  20. package/dist/index.js +2123 -1989
  21. package/dist/index.js.map +1 -1
  22. package/dist/polyfills.d.ts +1 -0
  23. package/dist/polyfills.js +5 -0
  24. package/dist/polyfills.js.map +1 -0
  25. package/dist/styles.css +1 -547
  26. package/package.json +57 -58
  27. package/src/cli/checks.test.ts +38 -0
  28. package/src/cli/checks.ts +200 -0
  29. package/src/cli/config.ts +44 -0
  30. package/src/cli/detect.test.ts +191 -0
  31. package/src/cli/detect.ts +205 -0
  32. package/src/cli/doctor.test.ts +52 -0
  33. package/src/cli/doctor.ts +65 -0
  34. package/src/cli/index.ts +77 -0
  35. package/src/cli/init.ts +225 -0
  36. package/src/cli/install.test.ts +52 -0
  37. package/src/cli/install.ts +108 -0
  38. package/src/cli/log.ts +79 -0
  39. package/src/cli/selfPackage.ts +14 -0
  40. package/src/cli/styles.test.ts +130 -0
  41. package/src/cli/styles.ts +205 -0
  42. package/src/cli/test-utils.ts +10 -0
  43. package/src/cli/tsconfig.test.ts +174 -0
  44. package/src/cli/tsconfig.ts +282 -0
  45. package/src/cli/types.ts +77 -0
  46. package/src/cli/versions.test.ts +35 -0
  47. package/src/cli/versions.ts +41 -0
  48. package/src/components/badge/Badge.tsx +53 -0
  49. package/src/components/badge/badge.css +6 -0
  50. package/src/components/badge/badge.props.ts +31 -0
  51. package/src/components/box/Box.tsx +30 -0
  52. package/src/components/box/box.css +4 -0
  53. package/src/components/box/box.props.ts +29 -0
  54. package/src/components/button/Button.tsx +78 -0
  55. package/src/components/button/button.css +72 -0
  56. package/src/components/button/button.props.ts +122 -0
  57. package/src/components/card/Card.tsx +31 -0
  58. package/src/components/card/card.css +4 -0
  59. package/src/components/card/card.props.ts +58 -0
  60. package/src/components/checkbox/Checkbox.tsx +64 -0
  61. package/src/components/checkbox/checkbox.css +100 -0
  62. package/src/components/checkbox/checkbox.props.ts +33 -0
  63. package/src/components/code/Code.tsx +38 -0
  64. package/src/components/code/LazyRefractor.tsx +9 -0
  65. package/src/components/code/code.css +40 -0
  66. package/src/components/code/code.props.ts +44 -0
  67. package/src/components/container/Container.tsx +30 -0
  68. package/src/components/container/container.css +4 -0
  69. package/src/components/container/container.props.ts +28 -0
  70. package/src/components/dialog/Dialog.tsx +139 -0
  71. package/src/components/dialog/dialog.css +49 -0
  72. package/src/components/dialog/dialog.props.ts +45 -0
  73. package/src/components/divider/Divider.tsx +23 -0
  74. package/src/components/divider/divider.props.ts +9 -0
  75. package/src/components/eyebrow/Eyebrow.tsx +54 -0
  76. package/src/components/eyebrow/eyebrow.css +11 -0
  77. package/src/components/eyebrow/eyebrow.props.ts +28 -0
  78. package/src/components/flex/Flex.tsx +30 -0
  79. package/src/components/flex/flex.css +4 -0
  80. package/src/components/flex/flex.props.ts +33 -0
  81. package/src/components/grid/Grid.tsx +30 -0
  82. package/src/components/grid/grid.css +4 -0
  83. package/src/components/grid/grid.props.ts +33 -0
  84. package/src/components/h-stack/HStack.tsx +34 -0
  85. package/src/components/h-stack/hStack.props.ts +17 -0
  86. package/src/components/heading/Heading.tsx +54 -0
  87. package/src/components/heading/heading.css +9 -0
  88. package/src/components/heading/heading.props.ts +31 -0
  89. package/src/components/icon/Icon.tsx +24 -0
  90. package/src/components/icon/icon.css +17 -0
  91. package/src/components/icon/icon.props.ts +35 -0
  92. package/src/components/icon-button/IconButton.tsx +32 -0
  93. package/src/components/icon-button/iconButton.props.ts +31 -0
  94. package/src/components/index.css +28 -0
  95. package/src/components/indicator/Indicator.tsx +42 -0
  96. package/src/components/indicator/indicator.css +4 -0
  97. package/src/components/indicator/indicator.props.ts +24 -0
  98. package/src/components/indicator-stack/IndicatorStack.tsx +31 -0
  99. package/src/components/indicator-stack/indicator-stack.css +7 -0
  100. package/src/components/indicator-stack/indicatorStack.props.ts +15 -0
  101. package/src/components/inline/Inline.tsx +38 -0
  102. package/src/components/inline/inline.css +4 -0
  103. package/src/components/inline/inline.props.ts +100 -0
  104. package/src/components/label/Label.tsx +34 -0
  105. package/src/components/label/label.css +3 -0
  106. package/src/components/label/label.props.ts +25 -0
  107. package/src/components/link/Link.tsx +29 -0
  108. package/src/components/link/link.css +12 -0
  109. package/src/components/link/link.props.ts +23 -0
  110. package/src/components/list/List.tsx +167 -0
  111. package/src/components/list/list.css +25 -0
  112. package/src/components/list/list.props.ts +130 -0
  113. package/src/components/popover/Popover.tsx +85 -0
  114. package/src/components/popover/popover.css +21 -0
  115. package/src/components/popover/popover.props.ts +38 -0
  116. package/src/components/press-area/PressArea.tsx +29 -0
  117. package/src/components/press-area/press-area.css +22 -0
  118. package/src/components/press-area/pressArea.props.ts +16 -0
  119. package/src/components/radio/Radio.tsx +48 -0
  120. package/src/components/radio/radio.css +97 -0
  121. package/src/components/radio/radio.props.ts +25 -0
  122. package/src/components/skip-to-content/SkipToContent.tsx +35 -0
  123. package/src/components/skip-to-content/skip-to-content.css +9 -0
  124. package/src/components/skip-to-content/skipToContent.props.ts +25 -0
  125. package/src/components/spinner/Spinner.tsx +28 -0
  126. package/src/components/spinner/spinner.css +10 -0
  127. package/src/components/spinner/spinner.props.ts +19 -0
  128. package/src/components/switch/Switch.tsx +48 -0
  129. package/src/components/switch/switch.css +119 -0
  130. package/src/components/switch/switch.props.ts +25 -0
  131. package/src/components/text/Text.tsx +53 -0
  132. package/src/components/text/text.css +9 -0
  133. package/src/components/text/text.props.ts +28 -0
  134. package/src/components/tooltip/Tooltip.tsx +97 -0
  135. package/src/components/tooltip/tooltip.css +31 -0
  136. package/src/components/tooltip/tooltip.props.ts +36 -0
  137. package/src/components/tooltip-group/TooltipGroup.tsx +64 -0
  138. package/src/components/tooltip-group/tooltipGroup.props.ts +15 -0
  139. package/src/components/v-stack/VStack.tsx +32 -0
  140. package/src/components/v-stack/vStack.props.ts +17 -0
  141. package/src/components/visually-hidden/VisuallyHidden.tsx +29 -0
  142. package/src/components/visually-hidden/visually-hidden.css +9 -0
  143. package/src/components/visually-hidden/visuallyHidden.props.ts +23 -0
  144. package/src/css/classes/dynamic/flex-child.css +5 -0
  145. package/src/css/classes/dynamic/grid-child.css +8 -0
  146. package/src/css/classes/dynamic/grid-parent.css +6 -0
  147. package/src/css/classes/dynamic/height.css +5 -0
  148. package/src/css/classes/dynamic/index.css +7 -0
  149. package/src/css/classes/dynamic/line-clamp.css +5 -0
  150. package/src/css/classes/dynamic/readme.md +3 -0
  151. package/src/css/classes/dynamic/width.css +7 -0
  152. package/src/css/classes/dynamic/z-index.css +3 -0
  153. package/src/css/classes/generic/display.css +10 -0
  154. package/src/css/classes/generic/flex.css +24 -0
  155. package/src/css/classes/generic/grid.css +7 -0
  156. package/src/css/classes/generic/index.css +7 -0
  157. package/src/css/classes/generic/overflow.css +19 -0
  158. package/src/css/classes/generic/placement.css +202 -0
  159. package/src/css/classes/generic/position.css +7 -0
  160. package/src/css/classes/generic/readme.md +3 -0
  161. package/src/css/classes/generic/text-align.css +5 -0
  162. package/src/css/classes/index.css +4 -0
  163. package/src/css/classes/local/animation.css +4 -0
  164. package/src/css/classes/local/border.css +20 -0
  165. package/src/css/classes/local/index.css +6 -0
  166. package/src/css/classes/local/readme.md +3 -0
  167. package/src/css/classes/local/text-overflow.css +5 -0
  168. package/src/css/classes/local/text-trim.css +45 -0
  169. package/src/css/classes/local/tone.css +75 -0
  170. package/src/css/classes/local/top-anchor.css +4 -0
  171. package/src/css/classes/system/color.css +223 -0
  172. package/src/css/classes/system/container.css +8 -0
  173. package/src/css/classes/system/font-family.css +2 -0
  174. package/src/css/classes/system/font-weight.css +4 -0
  175. package/src/css/classes/system/gap.css +37 -0
  176. package/src/css/classes/system/index.css +10 -0
  177. package/src/css/classes/system/inset.css +56 -0
  178. package/src/css/classes/system/margin.css +148 -0
  179. package/src/css/classes/system/padding.css +78 -0
  180. package/src/css/classes/system/radius.css +10 -0
  181. package/src/css/classes/system/readme.md +3 -0
  182. package/src/css/classes/system/shadow.css +6 -0
  183. package/src/css/classes/system/typography.css +31 -0
  184. package/src/css/global/font-face.css +20 -0
  185. package/src/css/global/index.css +2 -0
  186. package/src/css/global/reset.css +76 -0
  187. package/src/css/tokens/index.css +3 -0
  188. package/src/css/tokens/opacity.css +6 -0
  189. package/src/css/tokens/semantic.css +25 -0
  190. package/src/css/tokens/surface.css +27 -0
  191. package/src/hooks/useIsClient.ts +10 -0
  192. package/src/index.css +18 -0
  193. package/src/index.ts +65 -0
  194. package/src/polyfills.ts +15 -0
  195. package/src/props/border.ts +51 -0
  196. package/src/props/flexChild.ts +29 -0
  197. package/src/props/flexParent.ts +47 -0
  198. package/src/props/gap.ts +31 -0
  199. package/src/props/gridChild.ts +50 -0
  200. package/src/props/gridParent.ts +45 -0
  201. package/src/props/height.ts +29 -0
  202. package/src/props/layout.ts +44 -0
  203. package/src/props/margin.ts +59 -0
  204. package/src/props/overflow.ts +30 -0
  205. package/src/props/padding.ts +59 -0
  206. package/src/props/placement.ts +16 -0
  207. package/src/props/position.ts +52 -0
  208. package/src/props/shadow.ts +15 -0
  209. package/src/props/tone.ts +15 -0
  210. package/src/props/typography.ts +62 -0
  211. package/src/props/width.ts +29 -0
  212. package/src/props/zIndex.ts +15 -0
  213. package/src/styles.css.d.ts +1 -0
  214. package/src/styles.css.node.js +2 -0
  215. package/src/styles.css.test.ts +24 -0
  216. package/src/types/Button.ts +8 -0
  217. package/src/types/Code.ts +6 -0
  218. package/src/types/Container.ts +3 -0
  219. package/src/types/Density.ts +3 -0
  220. package/src/types/Display.ts +11 -0
  221. package/src/types/Eyebrow.ts +3 -0
  222. package/src/types/Flex.ts +22 -0
  223. package/src/types/FontWeight.ts +3 -0
  224. package/src/types/Grid.ts +3 -0
  225. package/src/types/Heading.ts +6 -0
  226. package/src/types/Icon.ts +3 -0
  227. package/src/types/Interactive.ts +8 -0
  228. package/src/types/List.ts +2 -0
  229. package/src/types/Overflow.ts +3 -0
  230. package/src/types/Placement.ts +16 -0
  231. package/src/types/Position.ts +3 -0
  232. package/src/types/PropDef.ts +73 -0
  233. package/src/types/Radius.ts +3 -0
  234. package/src/types/Responsive.ts +10 -0
  235. package/src/types/Shadow.ts +3 -0
  236. package/src/types/Space.ts +15 -0
  237. package/src/types/Text.ts +3 -0
  238. package/src/types/TextAlign.ts +3 -0
  239. package/src/types/Tone.ts +3 -0
  240. package/src/utils/getProps.test.ts +156 -0
  241. package/src/utils/getProps.ts +156 -0
  242. package/src/utils/mergeTriggerProps.ts +66 -0
  243. package/src/utils/renderPortal.tsx +14 -0
  244. package/src/utils/suffixClassName.ts +5 -0
  245. package/src/version.ts +3 -0
  246. package/LICENSE +0 -21
  247. package/dist/_system-CTe2lb5l.d.ts +0 -40
  248. package/dist/_system-CTe2lb5l.d.ts.map +0 -1
  249. package/dist/arrow-BmX6qbAS.js +0 -170
  250. package/dist/arrow-BmX6qbAS.js.map +0 -1
  251. package/dist/autocomplete.d.ts +0 -140
  252. package/dist/autocomplete.d.ts.map +0 -1
  253. package/dist/autocomplete.js +0 -470
  254. package/dist/autocomplete.js.map +0 -1
  255. package/dist/breadcrumbs.d.ts +0 -18
  256. package/dist/breadcrumbs.d.ts.map +0 -1
  257. package/dist/breadcrumbs.js +0 -119
  258. package/dist/breadcrumbs.js.map +0 -1
  259. package/dist/button-BNyKSDyA.js +0 -180
  260. package/dist/button-BNyKSDyA.js.map +0 -1
  261. package/dist/button-dnqMFkWg.d.ts +0 -76
  262. package/dist/button-dnqMFkWg.d.ts.map +0 -1
  263. package/dist/card-C0a0wQTc.d.ts +0 -7
  264. package/dist/card-C0a0wQTc.d.ts.map +0 -1
  265. package/dist/code.d.ts +0 -20
  266. package/dist/code.d.ts.map +0 -1
  267. package/dist/code.js +0 -90
  268. package/dist/code.js.map +0 -1
  269. package/dist/codeFontStyle-84SMhFtI.js +0 -11
  270. package/dist/codeFontStyle-84SMhFtI.js.map +0 -1
  271. package/dist/component-DVlwaWB-.d.ts +0 -25
  272. package/dist/component-DVlwaWB-.d.ts.map +0 -1
  273. package/dist/element-BYgCE_iK.js +0 -51
  274. package/dist/element-BYgCE_iK.js.map +0 -1
  275. package/dist/factory-BzXTX8_Q.js +0 -3056
  276. package/dist/factory-BzXTX8_Q.js.map +0 -1
  277. package/dist/flex-DmbDG2ks.js +0 -76
  278. package/dist/flex-DmbDG2ks.js.map +0 -1
  279. package/dist/font-EtfxKPUz.d.ts +0 -49
  280. package/dist/font-EtfxKPUz.d.ts.map +0 -1
  281. package/dist/getElementRef-Jw7gY0eV.js +0 -102
  282. package/dist/getElementRef-Jw7gY0eV.js.map +0 -1
  283. package/dist/getScopedTheme-C-sZsyAz.js +0 -267
  284. package/dist/getScopedTheme-C-sZsyAz.js.map +0 -1
  285. package/dist/getTheme_v2-y09KqtEb.js +0 -487
  286. package/dist/getTheme_v2-y09KqtEb.js.map +0 -1
  287. package/dist/grid-6JSgMj1O.js +0 -115
  288. package/dist/grid-6JSgMj1O.js.map +0 -1
  289. package/dist/helpers-C8xxXAQC.js +0 -63
  290. package/dist/helpers-C8xxXAQC.js.map +0 -1
  291. package/dist/hotkeys-CaHsQlsO.js +0 -168
  292. package/dist/hotkeys-CaHsQlsO.js.map +0 -1
  293. package/dist/index.d.ts.map +0 -1
  294. package/dist/layer-Bl5R3uNR.js +0 -61
  295. package/dist/layer-Bl5R3uNR.js.map +0 -1
  296. package/dist/layer-ChlP9Ik6.d.ts +0 -242
  297. package/dist/layer-ChlP9Ik6.d.ts.map +0 -1
  298. package/dist/menu.d.ts +0 -146
  299. package/dist/menu.d.ts.map +0 -1
  300. package/dist/menu.js +0 -626
  301. package/dist/menu.js.map +0 -1
  302. package/dist/popover-B7-28L8y.js +0 -408
  303. package/dist/popover-B7-28L8y.js.map +0 -1
  304. package/dist/popover-CMlQeKn0.d.ts +0 -96
  305. package/dist/popover-CMlQeKn0.d.ts.map +0 -1
  306. package/dist/popover.d.ts +0 -2
  307. package/dist/popover.js +0 -3
  308. package/dist/refractor-CC48DwHi.js +0 -20
  309. package/dist/refractor-CC48DwHi.js.map +0 -1
  310. package/dist/responsiveFont-CilwaORG.js +0 -55
  311. package/dist/responsiveFont-CilwaORG.js.map +0 -1
  312. package/dist/rgba-BSYaEUW6.d.ts +0 -846
  313. package/dist/rgba-BSYaEUW6.d.ts.map +0 -1
  314. package/dist/selectable-B0GUIL74.d.ts +0 -7
  315. package/dist/selectable-B0GUIL74.d.ts.map +0 -1
  316. package/dist/stack-rsNFPq2-.js +0 -112
  317. package/dist/stack-rsNFPq2-.js.map +0 -1
  318. package/dist/styles-css.d.ts +0 -2
  319. package/dist/styles-css.js +0 -4
  320. package/dist/textInput-pSfQjkmx.js +0 -313
  321. package/dist/textInput-pSfQjkmx.js.map +0 -1
  322. package/dist/theme.d.ts +0 -280
  323. package/dist/theme.d.ts.map +0 -1
  324. package/dist/theme.js +0 -55
  325. package/dist/theme.js.map +0 -1
  326. package/dist/toast.d.ts +0 -73
  327. package/dist/toast.d.ts.map +0 -1
  328. package/dist/toast.js +0 -302
  329. package/dist/toast.js.map +0 -1
  330. package/dist/tooltip.d.ts +0 -88
  331. package/dist/tooltip.d.ts.map +0 -1
  332. package/dist/tooltip.js +0 -435
  333. package/dist/tooltip.js.map +0 -1
  334. package/dist/useClickOutsideEvent-wGLGWBZN.js +0 -36
  335. package/dist/useClickOutsideEvent-wGLGWBZN.js.map +0 -1
  336. package/dist/useElementSize-BJvbGHq8.js +0 -51
  337. package/dist/useElementSize-BJvbGHq8.js.map +0 -1
  338. package/dist/useLayer-D1usxIE0.js +0 -712
  339. package/dist/useLayer-D1usxIE0.js.map +0 -1
@@ -1,102 +0,0 @@
1
- import { c } from "react/compiler-runtime";
2
- import { Activity, useState } from "react";
3
- import { jsx } from "react/jsx-runtime";
4
- import { PresenceChild, invariant } from "motion/react";
5
- /**
6
- * Custom floating-ui middleware which calculates transform-origin X + Y offsets
7
- * based on the current floating rect's dimensions and shift offset.
8
- *
9
- * Scaling popovers with these transform-origin offsets will give the effect of
10
- * popvers slightly 'growing' from the origin/reference element.
11
- *
12
- * This middleware must be applied after both `@sanity/ui/size` and `shift` middlewares.
13
- */
14
- const origin = {
15
- name: "@sanity/ui/origin",
16
- fn({ middlewareData, placement, rects }) {
17
- let [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
18
- if (floatingWidth <= 0 || floatingHeight <= 0) return {};
19
- let { originX, originY } = ["bottom", "top"].includes(side) ? {
20
- originX: clamp(.5 - shiftX / floatingWidth, 0, 1),
21
- originY: side === "bottom" ? 0 : 1
22
- } : {
23
- originX: +(side === "left"),
24
- originY: clamp(.5 - shiftY / floatingHeight, 0, 1)
25
- };
26
- return { data: {
27
- originX,
28
- originY
29
- } };
30
- }
31
- };
32
- /**
33
- * Converts the `origin` middleware data into a plain `transform-origin` CSS value.
34
- *
35
- * The value is intentionally applied as a regular CSS property rather than motion's
36
- * `originX`/`originY` style keys: motion turns those into motion values that it resets to
37
- * their initial (unpositioned, `undefined`) state whenever the element re-mounts, which is
38
- * what happens every time an `Activity`-hidden popover or tooltip is shown again.
39
- */
40
- function getTransformOrigin(originX, originY) {
41
- if (originX !== void 0 && originY !== void 0) return `${originX * 100}% ${originY * 100}%`;
42
- }
43
- function clamp(num, min, max) {
44
- return Math.min(Math.max(num, min), max);
45
- }
46
- /**
47
- * MIT License
48
- *
49
- * Copyright (c) 2024 Motion One
50
- *
51
- * Permission is hereby granted, free of charge, to any person obtaining a copy
52
- * of this software and associated documentation files (the "Software"), to deal
53
- * in the Software without restriction, including without limitation the rights
54
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
55
- * copies of the Software, and to permit persons to whom the Software is
56
- * furnished to do so, subject to the following conditions:
57
- *
58
- * The above copyright notice and this permission notice shall be included in all
59
- * copies or substantial portions of the Software.
60
- *
61
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
63
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
64
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
65
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
66
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
67
- * SOFTWARE.
68
- */
69
- /**
70
- * Animated version of React's `Activity` that defers `mode="hidden"` until
71
- * child exit animations have finished.
72
- *
73
- * @internal
74
- */
75
- function AnimateActivity(t0) {
76
- let $ = c(9), { mode: modeFromProps, layoutMode, children } = t0, [mode, setMode] = useState(modeFromProps), isPresent = modeFromProps === "visible";
77
- if (isPresent && mode !== "visible") return setMode("visible"), null;
78
- let t1;
79
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => setMode("hidden"), $[0] = t1) : t1 = $[0];
80
- let onExitComplete = t1;
81
- invariant(!!Activity, "Activity component not found - upgrade to React 19.2.0 or higher");
82
- let t2 = isPresent ? void 0 : onExitComplete, t3 = layoutMode === "pop" ? "popLayout" : "sync", t4 = children, t5;
83
- $[1] !== isPresent || $[2] !== t2 || $[3] !== t3 || $[4] !== t4 ? (t5 = /* @__PURE__ */ jsx(PresenceChild, {
84
- isPresent,
85
- onExitComplete: t2,
86
- presenceAffectsLayout: !1,
87
- mode: t3,
88
- children: t4
89
- }), $[1] = isPresent, $[2] = t2, $[3] = t3, $[4] = t4, $[5] = t5) : t5 = $[5];
90
- let t6;
91
- return $[6] !== mode || $[7] !== t5 ? (t6 = /* @__PURE__ */ jsx(Activity, {
92
- mode,
93
- children: t5
94
- }), $[6] = mode, $[7] = t5, $[8] = t6) : t6 = $[8], t6;
95
- }
96
- function getElementRef(element) {
97
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
98
- return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
99
- }
100
- export { origin as i, AnimateActivity as n, getTransformOrigin as r, getElementRef as t };
101
-
102
- //# sourceMappingURL=getElementRef-Jw7gY0eV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getElementRef-Jw7gY0eV.js","names":["{mode: modeFromProps, layoutMode, children}: AnimateActivityProps","() => setMode('hidden')","<PresenceChild\n isPresent={isPresent}\n onExitComplete={!isPresent ? onExitComplete : undefined}\n presenceAffectsLayout={false}\n mode={layoutMode === 'pop' ? 'popLayout' : 'sync'}\n >\n {/* oxlint-disable-next-line no-unsafe-type-assertion -- PresenceChild expects a single ReactElement */}\n {children as any}\n </PresenceChild>","!isPresent ? onExitComplete : undefined","layoutMode === 'pop' ? 'popLayout' : 'sync'","children as any","<Activity mode={mode}>\n <PresenceChild\n isPresent={isPresent}\n onExitComplete={!isPresent ? onExitComplete : undefined}\n presenceAffectsLayout={false}\n mode={layoutMode === 'pop' ? 'popLayout' : 'sync'}\n >\n {/* oxlint-disable-next-line no-unsafe-type-assertion -- PresenceChild expects a single ReactElement */}\n {children as any}\n </PresenceChild>\n </Activity>"],"sources":["../src/core/middleware/origin.ts","../src/core/utils/animateActivity.tsx","../src/core/utils/getElementRef.ts"],"sourcesContent":["import {Middleware} from '@floating-ui/react-dom'\n\n/**\n * Custom floating-ui middleware which calculates transform-origin X + Y offsets\n * based on the current floating rect's dimensions and shift offset.\n *\n * Scaling popovers with these transform-origin offsets will give the effect of\n * popvers slightly 'growing' from the origin/reference element.\n *\n * This middleware must be applied after both `@sanity/ui/size` and `shift` middlewares.\n */\nexport const origin: Middleware = {\n name: '@sanity/ui/origin',\n fn({middlewareData, placement, rects}) {\n const [side] = placement.split('-')\n\n const floatingWidth = rects.floating.width\n const floatingHeight = rects.floating.height\n\n const shiftX = middlewareData.shift?.x || 0\n const shiftY = middlewareData.shift?.y || 0\n\n if (floatingWidth <= 0 || floatingHeight <= 0) {\n return {}\n }\n\n const isVerticalPlacement = ['bottom', 'top'].includes(side)\n\n const {originX, originY}: {originX: number; originY: number} = isVerticalPlacement\n ? {\n originX: clamp(0.5 - shiftX / floatingWidth, 0, 1),\n originY: side === 'bottom' ? 0 : 1,\n }\n : {\n originX: side === 'left' ? 1 : 0,\n originY: clamp(0.5 - shiftY / floatingHeight, 0, 1),\n }\n\n return {\n data: {originX, originY},\n }\n },\n}\n\n/**\n * Converts the `origin` middleware data into a plain `transform-origin` CSS value.\n *\n * The value is intentionally applied as a regular CSS property rather than motion's\n * `originX`/`originY` style keys: motion turns those into motion values that it resets to\n * their initial (unpositioned, `undefined`) state whenever the element re-mounts, which is\n * what happens every time an `Activity`-hidden popover or tooltip is shown again.\n */\nexport function getTransformOrigin(originX?: number, originY?: number): string | undefined {\n if (originX === undefined || originY === undefined) return undefined\n\n return `${originX * 100}% ${originY * 100}%`\n}\n\nfunction clamp(num: number, min: number, max: number) {\n return Math.min(Math.max(num, min), max)\n}\n","/**\n * MIT License\n *\n * Copyright (c) 2024 Motion One\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport {invariant, PresenceChild} from 'motion/react'\nimport {Activity, useState} from 'react'\n\ninterface AnimateActivityProps {\n mode: 'visible' | 'hidden'\n layoutMode: 'default' | 'pop'\n children: React.ReactNode\n}\n\n/**\n * Animated version of React's `Activity` that defers `mode=\"hidden\"` until\n * child exit animations have finished.\n *\n * @internal\n */\nexport function AnimateActivity({mode: modeFromProps, layoutMode, children}: AnimateActivityProps) {\n /**\n * This is the mode that we'll render.\n */\n const [mode, setMode] = useState(modeFromProps)\n\n /**\n * This is the goal state as defined by props.\n */\n const isPresent = modeFromProps === 'visible'\n\n /**\n * Immediately switch to mode=\"visible\" when the user\n * changes the mode prop.\n */\n if (isPresent && mode !== 'visible') {\n setMode('visible')\n return null\n }\n\n /**\n * Set mode to \"hidden\" only when the exit animation is complete.\n */\n const onExitComplete = () => setMode('hidden')\n\n invariant(Boolean(Activity), 'Activity component not found - upgrade to React 19.2.0 or higher')\n\n return (\n <Activity mode={mode}>\n <PresenceChild\n isPresent={isPresent}\n onExitComplete={!isPresent ? onExitComplete : undefined}\n presenceAffectsLayout={false}\n mode={layoutMode === 'pop' ? 'popLayout' : 'sync'}\n >\n {/* oxlint-disable-next-line no-unsafe-type-assertion -- PresenceChild expects a single ReactElement */}\n {children as any}\n </PresenceChild>\n </Activity>\n )\n}\n","// Based on https://github.com/radix-ui/primitives/blob/0bade6a704e5821b90a6da0f3d8cfa8a7711127d/packages/react/slot/src/Slot.tsx#L128-L150\n// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`\n// After React 19 accessing `element.ref` does the opposite.\n// https://github.com/facebook/react/pull/28348\n//\n// Access the ref using the method that doesn't yield a warning.\nexport function getElementRef(element: React.ReactElement) {\n // React <=18 in DEV\n // oxlint-disable-next-line unbound-method\n let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get\n let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning\n\n if (mayWarn) {\n // oxlint-disable-next-line no-unsafe-type-assertion\n return (element as any).ref\n }\n\n // React 19 in DEV\n // oxlint-disable-next-line unbound-method\n getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get\n mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning\n\n if (mayWarn) {\n // oxlint-disable-next-line no-unsafe-type-assertion\n return (element.props as {ref?: React.Ref<unknown>}).ref\n }\n\n // Not DEV\n // oxlint-disable-next-line no-unsafe-type-assertion\n return (element.props as {ref?: React.Ref<unknown>}).ref || (element as any).ref\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,SAAqB;CAChC,MAAM;CACN,GAAG,EAAC,gBAAgB,WAAW,SAAQ;EACrC,IAAM,CAAC,QAAQ,UAAU,MAAM,GAAG,GAE5B,gBAAgB,MAAM,SAAS,OAC/B,iBAAiB,MAAM,SAAS,QAEhC,SAAS,eAAe,OAAO,KAAK,GACpC,SAAS,eAAe,OAAO,KAAK;EAE1C,IAAI,iBAAiB,KAAK,kB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,KAAAA;CARLC,IAAAA;CADF,OACkB,EAAA,OAAA,QAAA,EAAA,OACdJ,MADF,KAAA,oBAAC,UAAD;EAAgB;EACdA,UAAAA;CASQ,CAAA,GAVM,EAAA,KAAA,MACdA,EAAAA,KAAAA,4BADFI;AAYJ;ACzEA,SAAgB,cAAc,SAA6B;CAGzD,IAAI,SAAS,OAAO,yBAAyB,QAAQ,OAAO,KAAK,CAAC,EAAE,KAChE,UAAU,UAAU,oBAAoB,UAAU,OAAO;CAmB7D,OAjBI,UAEM,QAAgB,OAK1B,SAAS,OAAO,yBAAyB,SAAS,KAAK,CAAC,EAAE,KAC1D,UAAU,UAAU,oBAAoB,UAAU,OAAO,gBAErD,UAEM,QAAQ,MAAqC,MAK/C,QAAQ,MAAqC,OAAQ,QAAgB;AAC/E"}
@@ -1,267 +0,0 @@
1
- import { n as themeColor_v0_v2, r as defaultThemeConfig } from "./getTheme_v2-y09KqtEb.js";
2
- /**
3
- * Defines a lazy, self-replacing property on `obj`.
4
- *
5
- * On first access the `factory` is called and the getter is replaced with the
6
- * computed plain value — subsequent reads have zero overhead.
7
- *
8
- * The property is enumerable (visible in `Object.keys` / spread) in both states.
9
- *
10
- * @internal
11
- */
12
- function defineLazyProperty(obj, key, factory) {
13
- Object.defineProperty(obj, key, {
14
- get() {
15
- let value = factory();
16
- return Object.defineProperty(obj, key, {
17
- value,
18
- enumerable: !0,
19
- writable: !1,
20
- configurable: !1
21
- }), value;
22
- },
23
- enumerable: !0,
24
- configurable: !0
25
- });
26
- }
27
- /** @internal */
28
- function is_v2(themeProp) {
29
- return themeProp._version === 2;
30
- }
31
- /**
32
- * Apply `neutral` and `suggest` if they're not already part of the color object,
33
- * as this was introduced in v2.9, but is not compatible with v2.0.
34
- *
35
- * @param color - The color object to upgrade
36
- * @returns The upgraded color object. Returns as-is if already upgraded.
37
- * @internal
38
- */
39
- function themeColor_v0_v2_9(color) {
40
- if ("neutral" in color.badge) return color;
41
- let colors = color;
42
- return {
43
- ...colors,
44
- badge: {
45
- ...colors.badge,
46
- neutral: colors.badge.default,
47
- suggest: colors.badge.primary
48
- },
49
- button: {
50
- bleed: {
51
- ...colors.button.bleed,
52
- neutral: colors.button.bleed.default,
53
- suggest: colors.button.bleed.primary
54
- },
55
- default: {
56
- ...colors.button.default,
57
- neutral: colors.button.default.default,
58
- suggest: colors.button.default.primary
59
- },
60
- ghost: {
61
- ...colors.button.ghost,
62
- neutral: colors.button.ghost.default,
63
- suggest: colors.button.ghost.primary
64
- }
65
- },
66
- selectable: {
67
- ...colors.selectable,
68
- neutral: colors.selectable.default,
69
- suggest: colors.selectable.primary
70
- }
71
- };
72
- }
73
- const cache$2 = /* @__PURE__ */ new WeakMap();
74
- /** @internal */
75
- function v0_v2(v0) {
76
- if (v0.v2) return v0.v2;
77
- let cached_v2 = cache$2.get(v0);
78
- if (cached_v2) return cached_v2;
79
- let { avatar, button, color, container, focusRing: _unused_focusRing, fonts: font, input, layer, media, radius, shadows: shadow, space, styles: style } = v0, v2 = {
80
- _version: 2,
81
- avatar: {
82
- ...defaultThemeConfig.avatar,
83
- ...avatar
84
- },
85
- button: {
86
- ...defaultThemeConfig.button,
87
- ...button
88
- },
89
- card: defaultThemeConfig.card,
90
- color: {
91
- light: {
92
- transparent: themeColor_v0_v2(color.light.transparent),
93
- default: themeColor_v0_v2(color.light.default),
94
- neutral: themeColor_v0_v2(color.light.transparent),
95
- primary: themeColor_v0_v2(color.light.primary),
96
- suggest: themeColor_v0_v2(color.light.primary),
97
- positive: themeColor_v0_v2(color.light.positive),
98
- caution: themeColor_v0_v2(color.light.caution),
99
- critical: themeColor_v0_v2(color.light.critical)
100
- },
101
- dark: {
102
- transparent: themeColor_v0_v2(color.dark.transparent),
103
- default: themeColor_v0_v2(color.dark.default),
104
- neutral: themeColor_v0_v2(color.dark.transparent),
105
- primary: themeColor_v0_v2(color.dark.primary),
106
- suggest: themeColor_v0_v2(color.dark.primary),
107
- positive: themeColor_v0_v2(color.dark.positive),
108
- caution: themeColor_v0_v2(color.dark.caution),
109
- critical: themeColor_v0_v2(color.dark.critical)
110
- }
111
- },
112
- container,
113
- font,
114
- input: {
115
- ...defaultThemeConfig.input,
116
- ...input,
117
- checkbox: {
118
- ...defaultThemeConfig.input.checkbox,
119
- ...input.checkbox
120
- },
121
- radio: {
122
- ...defaultThemeConfig.input.radio,
123
- ...input.radio
124
- },
125
- switch: {
126
- ...defaultThemeConfig.input.switch,
127
- ...input.switch
128
- }
129
- },
130
- layer: layer ?? defaultThemeConfig.layer,
131
- media,
132
- radius,
133
- shadow,
134
- space,
135
- style
136
- };
137
- return cache$2.set(v0, v2), v2;
138
- }
139
- const cache$1 = /* @__PURE__ */ new WeakMap(), V0_TONES = [
140
- "transparent",
141
- "default",
142
- "primary",
143
- "positive",
144
- "caution",
145
- "critical"
146
- ];
147
- function lazyV0Scheme(schemeKey, color) {
148
- let scheme = {};
149
- for (let tone of V0_TONES) defineLazyProperty(scheme, tone, () => themeColor_v2_v0(color[schemeKey][tone]));
150
- return scheme;
151
- }
152
- /** @internal */
153
- function v2_v0(v2) {
154
- let cachedTheme = cache$1.get(v2);
155
- if (cachedTheme) return cachedTheme;
156
- let { avatar, button, color, container, font: fonts, input, media, radius, shadow: shadows, space, style: styles } = v2, v0Color = {};
157
- defineLazyProperty(v0Color, "light", () => lazyV0Scheme("light", color)), defineLazyProperty(v0Color, "dark", () => lazyV0Scheme("dark", color));
158
- let theme = {
159
- _version: 0,
160
- avatar,
161
- button,
162
- container,
163
- color: v0Color,
164
- focusRing: input.text.focusRing,
165
- fonts,
166
- input,
167
- media,
168
- radius,
169
- shadows,
170
- space,
171
- styles,
172
- v2
173
- };
174
- return cache$1.set(v2, theme), theme;
175
- }
176
- function themeColor_v2_v0(color_v2) {
177
- return {
178
- base: {
179
- bg: color_v2.bg,
180
- fg: color_v2.fg,
181
- border: color_v2.border,
182
- focusRing: color_v2.focusRing,
183
- shadow: color_v2.shadow
184
- },
185
- button: color_v2.button,
186
- card: color_v2.selectable.default,
187
- dark: color_v2._dark,
188
- input: {
189
- default: inputStatesThemeColor_v2_v0(color_v2.input.default),
190
- invalid: inputStatesThemeColor_v2_v0(color_v2.input.invalid)
191
- },
192
- muted: {
193
- ...color_v2.button.ghost,
194
- transparent: color_v2.button.ghost.default
195
- },
196
- solid: {
197
- ...color_v2.button.default,
198
- transparent: color_v2.button.default.default
199
- },
200
- selectable: color_v2.selectable,
201
- spot: {
202
- gray: color_v2.avatar.gray.bg,
203
- blue: color_v2.avatar.blue.bg,
204
- purple: color_v2.avatar.purple.bg,
205
- magenta: color_v2.avatar.magenta.bg,
206
- red: color_v2.avatar.red.bg,
207
- orange: color_v2.avatar.orange.bg,
208
- yellow: color_v2.avatar.yellow.bg,
209
- green: color_v2.avatar.green.bg,
210
- cyan: color_v2.avatar.cyan.bg
211
- },
212
- syntax: color_v2.syntax
213
- };
214
- }
215
- function inputStatesThemeColor_v2_v0(t) {
216
- return {
217
- enabled: inputStateThemeColor_v2_v0(t.enabled),
218
- disabled: inputStateThemeColor_v2_v0(t.disabled),
219
- readOnly: inputStateThemeColor_v2_v0(t.readOnly),
220
- hovered: inputStateThemeColor_v2_v0(t.hovered)
221
- };
222
- }
223
- function inputStateThemeColor_v2_v0(t) {
224
- return {
225
- bg: t.bg,
226
- bg2: t.muted.bg,
227
- border: t.border,
228
- fg: t.fg,
229
- placeholder: t.placeholder
230
- };
231
- }
232
- const cache = /* @__PURE__ */ new Map();
233
- /** @internal */
234
- function getScopedTheme(themeProp, scheme, tone) {
235
- let cachedTheme = _getCachedTheme(themeProp, scheme, tone);
236
- if (cachedTheme) return cachedTheme;
237
- let v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp, v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp), layer_v0 = v0.layer || defaultThemeConfig.layer, colorScheme_v2 = v2.color[scheme] || v2.color.light, color_v2_9 = themeColor_v0_v2_9(colorScheme_v2[tone] || colorScheme_v2.default), layer_v2 = v2.layer || defaultThemeConfig.layer, { color: _v0Color, ...v0Rest } = v0, sanity = {
238
- ...v0Rest,
239
- layer: layer_v0,
240
- v2: {
241
- ...v2,
242
- _resolved: !0,
243
- color: color_v2_9,
244
- layer: layer_v2
245
- }
246
- };
247
- defineLazyProperty(sanity, "color", () => {
248
- let colorScheme_v0 = v0.color[scheme] || v0.color.light;
249
- return colorScheme_v0[tone] || colorScheme_v0.default;
250
- });
251
- let theme = { sanity };
252
- return _setCachedTheme(themeProp, scheme, tone, theme), theme;
253
- }
254
- function _getCachedTheme(rootTheme, scheme, tone) {
255
- let schemeCache = cache.get(scheme);
256
- if (!schemeCache) return;
257
- let toneCache = schemeCache.get(tone);
258
- if (toneCache) return toneCache.get(rootTheme);
259
- }
260
- function _setCachedTheme(rootTheme, scheme, tone, theme) {
261
- cache.has(scheme) || cache.set(scheme, /* @__PURE__ */ new Map());
262
- let schemeCache = cache.get(scheme);
263
- schemeCache.has(tone) || schemeCache.set(tone, /* @__PURE__ */ new WeakMap()), schemeCache.get(tone).set(rootTheme, theme);
264
- }
265
- export { defineLazyProperty as a, is_v2 as i, v2_v0 as n, v0_v2 as r, getScopedTheme as t };
266
-
267
- //# sourceMappingURL=getScopedTheme-C-sZsyAz.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getScopedTheme-C-sZsyAz.js","names":[],"sources":["../src/theme/build/lib/lazy.ts","../src/theme/versioning/is_v2.ts","../src/theme/versioning/themeColor_v2_v2_9.ts","../src/theme/versioning/v0_v2.ts","../src/theme/versioning/v2_v0.ts","../src/theme/getScopedTheme.ts"],"sourcesContent":["/**\n * Defines a lazy, self-replacing property on `obj`.\n *\n * On first access the `factory` is called and the getter is replaced with the\n * computed plain value — subsequent reads have zero overhead.\n *\n * The property is enumerable (visible in `Object.keys` / spread) in both states.\n *\n * @internal\n */\nexport function defineLazyProperty<T extends object, K extends keyof T>(\n obj: T,\n key: K,\n factory: () => T[K],\n): void {\n Object.defineProperty(obj, key, {\n get() {\n const value = factory()\n Object.defineProperty(obj, key, {\n value,\n enumerable: true,\n writable: false,\n configurable: false,\n })\n return value\n },\n enumerable: true,\n configurable: true,\n })\n}\n","import {RootTheme, RootTheme_v2} from '../system/theme'\n\n/** @internal */\nexport function is_v2(themeProp: RootTheme | RootTheme_v2): themeProp is RootTheme_v2 {\n return themeProp._version === 2\n}\n","import type {ThemeColorCard_v2} from '../system/color/color'\n\n/**\n * Apply `neutral` and `suggest` if they're not already part of the color object,\n * as this was introduced in v2.9, but is not compatible with v2.0.\n *\n * @param color - The color object to upgrade\n * @returns The upgraded color object. Returns as-is if already upgraded.\n * @internal\n */\nexport function themeColor_v0_v2_9(color: ThemeColorCard_v2): ThemeColorCard_v2 {\n if ('neutral' in color.badge) {\n return color // Already at >= v2.9\n }\n\n // TypeScript narrows to `never` because the above should always be true\n // oxlint-disable-next-line no-unnecessary-type-assertion\n const colors = color as ThemeColorCard_v2\n\n return {\n ...colors,\n badge: {\n ...colors.badge,\n neutral: colors.badge.default,\n suggest: colors.badge.primary,\n },\n button: {\n bleed: {\n ...colors.button.bleed,\n neutral: colors.button.bleed.default,\n suggest: colors.button.bleed.primary,\n },\n default: {\n ...colors.button.default,\n neutral: colors.button.default.default,\n suggest: colors.button.default.primary,\n },\n ghost: {\n ...colors.button.ghost,\n neutral: colors.button.ghost.default,\n suggest: colors.button.ghost.primary,\n },\n },\n selectable: {\n ...colors.selectable,\n neutral: colors.selectable.default,\n suggest: colors.selectable.primary,\n },\n }\n}\n","import {defaultThemeConfig} from '../defaults/config'\nimport {RootTheme, RootTheme_v2} from '../system/theme'\nimport {themeColor_v0_v2} from './themeColor_v0_v2'\n\nconst cache = new WeakMap<RootTheme, RootTheme_v2>()\n\n/** @internal */\nexport function v0_v2(v0: RootTheme): RootTheme_v2 {\n if (v0.v2) return v0.v2\n\n const cached_v2 = cache.get(v0)\n\n if (cached_v2) return cached_v2\n\n const {\n // oxlint-disable-next-line no-deprecated\n avatar,\n // oxlint-disable-next-line no-deprecated\n button,\n // oxlint-disable-next-line no-deprecated\n color,\n // oxlint-disable-next-line no-deprecated\n container,\n // oxlint-disable-next-line no-deprecated\n focusRing: _unused_focusRing,\n // oxlint-disable-next-line no-deprecated\n fonts: font,\n // oxlint-disable-next-line no-deprecated\n input,\n // oxlint-disable-next-line no-deprecated\n layer,\n // oxlint-disable-next-line no-deprecated\n media,\n // oxlint-disable-next-line no-deprecated\n radius,\n // oxlint-disable-next-line no-deprecated\n shadows: shadow,\n // oxlint-disable-next-line no-deprecated\n space,\n // oxlint-disable-next-line no-deprecated\n styles: style,\n } = v0\n\n const v2: RootTheme_v2 = {\n _version: 2,\n avatar: {\n ...defaultThemeConfig.avatar,\n ...avatar,\n },\n button: {\n ...defaultThemeConfig.button,\n ...button,\n },\n card: defaultThemeConfig.card,\n color: {\n light: {\n transparent: themeColor_v0_v2(color.light.transparent),\n default: themeColor_v0_v2(color.light.default),\n neutral: themeColor_v0_v2(color.light.transparent),\n primary: themeColor_v0_v2(color.light.primary),\n suggest: themeColor_v0_v2(color.light.primary),\n positive: themeColor_v0_v2(color.light.positive),\n caution: themeColor_v0_v2(color.light.caution),\n critical: themeColor_v0_v2(color.light.critical),\n },\n dark: {\n transparent: themeColor_v0_v2(color.dark.transparent),\n default: themeColor_v0_v2(color.dark.default),\n neutral: themeColor_v0_v2(color.dark.transparent),\n primary: themeColor_v0_v2(color.dark.primary),\n suggest: themeColor_v0_v2(color.dark.primary),\n positive: themeColor_v0_v2(color.dark.positive),\n caution: themeColor_v0_v2(color.dark.caution),\n critical: themeColor_v0_v2(color.dark.critical),\n },\n },\n container,\n font,\n input: {\n ...defaultThemeConfig.input,\n ...input,\n checkbox: {\n ...defaultThemeConfig.input.checkbox,\n ...input.checkbox,\n },\n radio: {\n ...defaultThemeConfig.input.radio,\n ...input.radio,\n },\n switch: {\n ...defaultThemeConfig.input.switch,\n ...input.switch,\n },\n },\n layer: layer ?? defaultThemeConfig.layer,\n media,\n radius,\n shadow,\n space,\n style,\n }\n\n cache.set(v0, v2)\n\n return v2\n}\n","import {defineLazyProperty} from '../build/lib/lazy'\nimport {ThemeColorCard_v2} from '../system/color/color'\nimport {ThemeColorInputMode_v2, ThemeColorInputState_v2} from '../system/color/input'\nimport {RootTheme, RootTheme_v2} from '../system/theme'\nimport {ThemeColor, ThemeColorScheme} from '../system/v0/color/color'\nimport {ThemeColorInputState, ThemeColorInputStates} from '../system/v0/color/input'\n\nconst cache = new WeakMap<RootTheme_v2, RootTheme>()\n\nconst V0_TONES = ['transparent', 'default', 'primary', 'positive', 'caution', 'critical'] as const\n\n// oxlint-disable-next-line no-deprecated\nfunction lazyV0Scheme(schemeKey: 'light' | 'dark', color: RootTheme_v2['color']): ThemeColorScheme {\n // oxlint-disable-next-line no-deprecated, no-unsafe-type-assertion\n const scheme = {} as ThemeColorScheme\n\n for (const tone of V0_TONES) {\n defineLazyProperty(scheme, tone, () => themeColor_v2_v0(color[schemeKey][tone]))\n }\n\n return scheme\n}\n\n/** @internal */\nexport function v2_v0(v2: RootTheme_v2): RootTheme {\n const cachedTheme = cache.get(v2)\n\n if (cachedTheme) return cachedTheme\n\n const {\n avatar,\n button,\n color,\n container,\n font: fonts,\n input,\n media,\n radius,\n shadow: shadows,\n space,\n style: styles,\n } = v2\n\n // Lazy v0 color — two-level lazy structure so we don't force-evaluate\n // the v2 lazy getters until a v0 tone is actually accessed.\n // oxlint-disable-next-line no-unsafe-type-assertion\n const v0Color = {} as RootTheme['color']\n\n defineLazyProperty(v0Color, 'light', () => lazyV0Scheme('light', color))\n defineLazyProperty(v0Color, 'dark', () => lazyV0Scheme('dark', color))\n\n const theme: RootTheme = {\n _version: 0,\n // oxlint-disable-next-line no-deprecated\n avatar,\n // oxlint-disable-next-line no-deprecated\n button,\n // oxlint-disable-next-line no-deprecated\n container,\n // oxlint-disable-next-line no-deprecated\n color: v0Color,\n // oxlint-disable-next-line no-deprecated\n focusRing: input.text.focusRing,\n // oxlint-disable-next-line no-deprecated\n fonts,\n // oxlint-disable-next-line no-deprecated\n input,\n // oxlint-disable-next-line no-deprecated\n media,\n // oxlint-disable-next-line no-deprecated\n radius,\n // oxlint-disable-next-line no-deprecated\n shadows,\n // oxlint-disable-next-line no-deprecated\n space,\n // oxlint-disable-next-line no-deprecated\n styles,\n\n v2,\n }\n\n cache.set(v2, theme)\n\n return theme\n}\n\n// oxlint-disable-next-line no-deprecated\nfunction themeColor_v2_v0(color_v2: ThemeColorCard_v2): ThemeColor {\n return {\n base: {\n bg: color_v2.bg,\n fg: color_v2.fg,\n border: color_v2.border,\n focusRing: color_v2.focusRing,\n shadow: color_v2.shadow,\n },\n button: color_v2.button,\n card: color_v2.selectable.default,\n dark: color_v2._dark,\n input: {\n default: inputStatesThemeColor_v2_v0(color_v2.input.default),\n invalid: inputStatesThemeColor_v2_v0(color_v2.input.invalid),\n },\n muted: {\n ...color_v2.button.ghost,\n transparent: color_v2.button.ghost.default,\n },\n solid: {\n ...color_v2.button.default,\n transparent: color_v2.button.default.default,\n },\n selectable: color_v2.selectable,\n spot: {\n gray: color_v2.avatar.gray.bg,\n blue: color_v2.avatar.blue.bg,\n purple: color_v2.avatar.purple.bg,\n magenta: color_v2.avatar.magenta.bg,\n red: color_v2.avatar.red.bg,\n orange: color_v2.avatar.orange.bg,\n yellow: color_v2.avatar.yellow.bg,\n green: color_v2.avatar.green.bg,\n cyan: color_v2.avatar.cyan.bg,\n },\n syntax: color_v2.syntax,\n }\n}\n\n// oxlint-disable-next-line no-deprecated\nfunction inputStatesThemeColor_v2_v0(t: ThemeColorInputMode_v2): ThemeColorInputStates {\n return {\n enabled: inputStateThemeColor_v2_v0(t.enabled),\n disabled: inputStateThemeColor_v2_v0(t.disabled),\n readOnly: inputStateThemeColor_v2_v0(t.readOnly),\n hovered: inputStateThemeColor_v2_v0(t.hovered),\n }\n}\n\n// oxlint-disable-next-line no-deprecated\nfunction inputStateThemeColor_v2_v0(t: ThemeColorInputState_v2): ThemeColorInputState {\n return {\n bg: t.bg,\n bg2: t.muted.bg,\n border: t.border,\n fg: t.fg,\n placeholder: t.placeholder,\n }\n}\n","import {defineLazyProperty} from './build/lib/lazy'\nimport {defaultThemeConfig} from './defaults/config'\nimport {ThemeColorCardToneKey, ThemeColorSchemeKey} from './system/color/_system'\nimport {RootTheme, RootTheme_v2, Theme} from './system/theme'\nimport {ThemeColor} from './system/v0/color/color'\nimport {is_v2} from './versioning/is_v2'\nimport {themeColor_v0_v2_9} from './versioning/themeColor_v2_v2_9'\nimport {v0_v2} from './versioning/v0_v2'\nimport {v2_v0} from './versioning/v2_v0'\n\n// cache[scheme][tone][rootTheme] = theme\nconst cache = new Map<\n ThemeColorSchemeKey,\n Map<ThemeColorCardToneKey, WeakMap<RootTheme | RootTheme_v2, Theme>>\n>()\n\n/** @internal */\nexport function getScopedTheme(\n themeProp: RootTheme | RootTheme_v2,\n scheme: ThemeColorSchemeKey,\n tone: ThemeColorCardToneKey,\n): Theme {\n const cachedTheme = _getCachedTheme(themeProp, scheme, tone)\n\n if (cachedTheme) return cachedTheme\n\n const v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp\n const v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp)\n\n // oxlint-disable-next-line no-deprecated\n const layer_v0 = v0.layer || defaultThemeConfig.layer\n\n const colorScheme_v2 = v2.color[scheme] || v2.color.light\n const color_v2 = colorScheme_v2[tone] || colorScheme_v2.default\n const color_v2_9 = themeColor_v0_v2_9(color_v2)\n const layer_v2 = v2.layer || defaultThemeConfig.layer\n\n // oxlint-disable-next-line no-deprecated\n const {color: _v0Color, ...v0Rest} = v0\n\n // oxlint-disable-next-line no-unsafe-type-assertion\n const sanity = {\n ...v0Rest,\n // oxlint-disable-next-line no-deprecated\n layer: layer_v0,\n v2: {\n ...v2,\n _resolved: true,\n color: color_v2_9,\n layer: layer_v2,\n },\n } as Theme['sanity']\n\n // Defer v0 color computation — only resolved if legacy code reads theme.sanity.color\n defineLazyProperty(sanity, 'color', () => {\n // oxlint-disable-next-line no-deprecated\n const colorScheme_v0 = v0.color[scheme] || v0.color.light\n // oxlint-disable-next-line no-deprecated\n return (colorScheme_v0 as Record<string, ThemeColor>)[tone] || colorScheme_v0.default\n })\n\n const theme: Theme = {sanity}\n\n _setCachedTheme(themeProp, scheme, tone, theme)\n\n return theme\n}\n\nfunction _getCachedTheme(\n rootTheme: RootTheme | RootTheme_v2,\n scheme: ThemeColorSchemeKey,\n tone: ThemeColorCardToneKey,\n) {\n const schemeCache = cache.get(scheme)\n\n if (!schemeCache) return undefined\n\n const toneCache = schemeCache.get(tone)\n\n if (!toneCache) return undefined\n\n return toneCache.get(rootTheme)\n}\n\nfunction _setCachedTheme(\n rootTheme: RootTheme | RootTheme_v2,\n scheme: ThemeColorSchemeKey,\n tone: ThemeColorCardToneKey,\n theme: Theme,\n) {\n if (!cache.has(scheme)) cache.set(scheme, new Map())\n\n const schemeCache = cache.get(scheme)!\n\n if (!schemeCache.has(tone)) schemeCache.set(tone, new WeakMap())\n\n const toneCache = schemeCache.get(tone)!\n\n toneCache.set(rootTheme, theme)\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,mBACd,KACA,KACA,SACM;CACN,OAAO,eAAe,KAAK,KAAK;EAC9B,MAAM;GACJ,IAAM,QAAQ,QAAQ;GAOtB,OANA,OAAO,eAAe,KAAK,KAAK;IAC9B;IACA,YAAY;IACZ,UAAU;IACV,cAAc;GAChB,CAAC,GACM;EACT;EACA,YAAY;EACZ,cAAc;CAChB,CAAC;AACH;;AC1BA,SAAgB,MAAM,WAAgE;CACpF,OAAO,UAAU,aAAa;AAChC;;;;;;;;;ACKA,SAAgB,mBAAmB,OAA6C;CAC9E,IAAI,aAAa,MAAM,OACrB,OAAO;CAKT,IAAM,SAAS;CAEf,OAAO;EACL,GAAG;EACH,OAAO;GACL,GAAG,OAAO;GACV,SAAS,OAAO,MAAM;GACtB,SAAS,OAAO,MAAM;EACxB;EACA,QAAQ;GACN,OAAO;IACL,GAAG,OAAO,OAAO;IACjB,SAAS,OAAO,OAAO,MAAM;IAC7B,SAAS,O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