@xaui/native 0.9.1-alpha.4 → 0.9.1-alpha.41

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 (209) hide show
  1. package/dist/chunk-2EGR4LWD.js +145 -0
  2. package/dist/chunk-2NRZKJG7.js +531 -0
  3. package/dist/chunk-2PMXMKS5.js +67 -0
  4. package/dist/chunk-2XPG2243.js +586 -0
  5. package/dist/chunk-36PRYGAM.js +13 -0
  6. package/dist/chunk-3E7CDKFO.cjs +696 -0
  7. package/dist/chunk-3GFRSZYR.js +54 -0
  8. package/dist/chunk-423RQBOX.js +21 -0
  9. package/dist/chunk-4CUZZWFW.js +92 -0
  10. package/dist/chunk-4GTAZM2C.js +174 -0
  11. package/dist/chunk-4KFKWBN5.cjs +89 -0
  12. package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
  13. package/dist/chunk-5R26NM4M.cjs +402 -0
  14. package/dist/chunk-5VKYNBNA.js +607 -0
  15. package/dist/chunk-64MXEVT3.js +66 -0
  16. package/dist/chunk-6DOLGZVV.cjs +147 -0
  17. package/dist/chunk-6L2TS2R3.cjs +92 -0
  18. package/dist/chunk-6UEZJRVI.js +669 -0
  19. package/dist/chunk-734MFAX4.js +27 -0
  20. package/dist/chunk-73RKQC5X.js +104 -0
  21. package/dist/chunk-7DPL3ZDS.cjs +21 -0
  22. package/dist/chunk-7EIHHOHP.cjs +42 -0
  23. package/dist/chunk-7GHM4GKL.cjs +119 -0
  24. package/dist/chunk-7YF5NAHQ.cjs +74 -0
  25. package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
  26. package/dist/chunk-ABAGZTXZ.cjs +736 -0
  27. package/dist/{chunk-AW63PTQ4.cjs → chunk-ACAPTWE3.cjs} +85 -81
  28. package/dist/chunk-AMCSSOJT.cjs +104 -0
  29. package/dist/chunk-BA2DBSAN.js +102 -0
  30. package/dist/chunk-BRRXFOBY.js +431 -0
  31. package/dist/chunk-C5YLPCFC.cjs +293 -0
  32. package/dist/chunk-DA3OKXHV.cjs +700 -0
  33. package/dist/chunk-DD4276RF.js +366 -0
  34. package/dist/chunk-DG2I4PJG.js +701 -0
  35. package/dist/chunk-DHGLGSH6.js +661 -0
  36. package/dist/chunk-DIBUQ46Y.js +346 -0
  37. package/dist/chunk-EGLLDKN6.js +9 -0
  38. package/dist/chunk-EJQCQPET.cjs +9 -0
  39. package/dist/chunk-EKS3W46M.cjs +66 -0
  40. package/dist/chunk-EZEYMLO3.js +402 -0
  41. package/dist/chunk-F6CQ6CBI.cjs +112 -0
  42. package/dist/chunk-F6W3JQ7K.js +42 -0
  43. package/dist/chunk-FHUYHV6J.js +89 -0
  44. package/dist/chunk-FNEUOBCV.cjs +174 -0
  45. package/dist/chunk-G3CCT4EY.js +518 -0
  46. package/dist/chunk-G7P3ERYF.cjs +478 -0
  47. package/dist/chunk-GA6PBWNT.js +147 -0
  48. package/dist/chunk-GFUZ3MUT.cjs +455 -0
  49. package/dist/chunk-GGW43Q37.cjs +1 -0
  50. package/dist/chunk-GTR5X65M.cjs +27 -0
  51. package/dist/chunk-H4E4HDEP.cjs +13 -0
  52. package/dist/chunk-H7DS4IO7.js +198 -0
  53. package/dist/chunk-HDVVZG4S.cjs +198 -0
  54. package/dist/chunk-IKJVLJKT.js +151 -0
  55. package/dist/chunk-J3MB4PI5.cjs +531 -0
  56. package/dist/chunk-K72UDPVN.js +119 -0
  57. package/dist/chunk-KCMYU7WF.js +86 -0
  58. package/dist/chunk-LRN3RNDO.js +940 -0
  59. package/dist/chunk-LTX6TB5I.js +124 -0
  60. package/dist/chunk-LUPCPLND.cjs +145 -0
  61. package/dist/chunk-M63GFNKV.js +194 -0
  62. package/dist/chunk-N3KTZMPG.js +293 -0
  63. package/dist/chunk-NCTOTTVW.js +13 -0
  64. package/dist/chunk-NWGLP6JX.cjs +410 -0
  65. package/dist/chunk-R73XQK7X.cjs +314 -0
  66. package/dist/chunk-RU7JCMWC.cjs +881 -0
  67. package/dist/chunk-SNIHUKDA.cjs +184 -0
  68. package/dist/chunk-T5FV5F7A.cjs +607 -0
  69. package/dist/chunk-TDTUAIFF.cjs +153 -0
  70. package/dist/chunk-TJ74XVZN.cjs +431 -0
  71. package/dist/chunk-TK44VBIE.cjs +194 -0
  72. package/dist/chunk-UAWBAD4E.cjs +346 -0
  73. package/dist/chunk-UFTCTTKK.js +381 -0
  74. package/dist/chunk-VLKBESEV.cjs +407 -0
  75. package/dist/chunk-WDDXU3OH.cjs +67 -0
  76. package/dist/chunk-WFEMJCXO.cjs +13 -0
  77. package/dist/chunk-WHJTBTYM.js +0 -0
  78. package/dist/{chunk-2KXQATVL.js → chunk-WKCQ6VGW.js} +59 -55
  79. package/dist/chunk-XFPQFCEK.js +455 -0
  80. package/dist/chunk-XSQPVDFH.cjs +60 -0
  81. package/dist/chunk-XTC2SLFT.js +153 -0
  82. package/dist/chunk-XV735BSA.cjs +366 -0
  83. package/dist/chunk-XWNG2U4K.cjs +124 -0
  84. package/dist/chunk-YGYYJ3LQ.js +314 -0
  85. package/dist/chunk-YVHT2UVW.js +74 -0
  86. package/dist/chunk-ZFOOJK37.cjs +86 -0
  87. package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
  88. package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
  89. package/dist/components/accordion/index.cjs +35 -0
  90. package/dist/components/accordion/index.d.cts +299 -0
  91. package/dist/components/accordion/index.d.ts +299 -0
  92. package/dist/components/accordion/index.js +35 -0
  93. package/dist/components/alert/index.cjs +20 -0
  94. package/dist/components/alert/index.d.cts +169 -0
  95. package/dist/components/alert/index.d.ts +169 -0
  96. package/dist/components/alert/index.js +20 -0
  97. package/dist/components/avatar/index.cjs +16 -0
  98. package/dist/components/avatar/index.d.cts +131 -0
  99. package/dist/components/avatar/index.d.ts +131 -0
  100. package/dist/components/avatar/index.js +16 -0
  101. package/dist/components/badge/index.cjs +15 -0
  102. package/dist/components/badge/index.d.cts +157 -0
  103. package/dist/components/badge/index.d.ts +157 -0
  104. package/dist/components/badge/index.js +15 -0
  105. package/dist/components/button/index.cjs +22 -0
  106. package/dist/components/button/index.d.cts +613 -0
  107. package/dist/components/button/index.d.ts +613 -0
  108. package/dist/components/button/index.js +22 -0
  109. package/dist/components/card/index.cjs +22 -0
  110. package/dist/components/card/index.d.cts +620 -0
  111. package/dist/components/card/index.d.ts +620 -0
  112. package/dist/components/card/index.js +22 -0
  113. package/dist/components/checkbox/index.cjs +26 -0
  114. package/dist/components/checkbox/index.d.cts +1136 -0
  115. package/dist/components/checkbox/index.d.ts +1136 -0
  116. package/dist/components/checkbox/index.js +26 -0
  117. package/dist/components/chip/index.cjs +20 -0
  118. package/dist/components/chip/index.d.cts +608 -0
  119. package/dist/components/chip/index.d.ts +608 -0
  120. package/dist/components/chip/index.js +20 -0
  121. package/dist/components/divider/index.cjs +13 -0
  122. package/dist/components/divider/index.d.cts +117 -0
  123. package/dist/components/divider/index.d.ts +117 -0
  124. package/dist/components/divider/index.js +13 -0
  125. package/dist/components/field-group/index.cjs +27 -0
  126. package/dist/components/field-group/index.d.cts +270 -0
  127. package/dist/components/field-group/index.d.ts +270 -0
  128. package/dist/components/field-group/index.js +27 -0
  129. package/dist/components/input-otp/index.cjs +29 -0
  130. package/dist/components/input-otp/index.d.cts +325 -0
  131. package/dist/components/input-otp/index.d.ts +325 -0
  132. package/dist/components/input-otp/index.js +29 -0
  133. package/dist/components/menu/index.cjs +49 -0
  134. package/dist/components/menu/index.d.cts +351 -0
  135. package/dist/components/menu/index.d.ts +351 -0
  136. package/dist/components/menu/index.js +49 -0
  137. package/dist/components/popover/index.cjs +38 -0
  138. package/dist/components/popover/index.d.cts +254 -0
  139. package/dist/components/popover/index.d.ts +254 -0
  140. package/dist/components/popover/index.js +38 -0
  141. package/dist/components/radio/index.cjs +26 -0
  142. package/dist/components/radio/index.d.cts +1102 -0
  143. package/dist/components/radio/index.d.ts +1102 -0
  144. package/dist/components/radio/index.js +26 -0
  145. package/dist/components/select/index.cjs +50 -0
  146. package/dist/components/select/index.d.cts +498 -0
  147. package/dist/components/select/index.d.ts +498 -0
  148. package/dist/components/select/index.js +50 -0
  149. package/dist/components/skeleton/index.cjs +11 -0
  150. package/dist/components/skeleton/index.d.cts +111 -0
  151. package/dist/components/skeleton/index.d.ts +111 -0
  152. package/dist/components/skeleton/index.js +11 -0
  153. package/dist/components/spinner/index.cjs +17 -0
  154. package/dist/components/spinner/index.d.cts +104 -0
  155. package/dist/components/spinner/index.d.ts +104 -0
  156. package/dist/components/spinner/index.js +17 -0
  157. package/dist/components/switch/index.cjs +27 -0
  158. package/dist/components/switch/index.d.cts +1154 -0
  159. package/dist/components/switch/index.d.ts +1154 -0
  160. package/dist/components/switch/index.js +27 -0
  161. package/dist/components/tabs/index.cjs +33 -0
  162. package/dist/components/tabs/index.d.cts +261 -0
  163. package/dist/components/tabs/index.d.ts +261 -0
  164. package/dist/components/tabs/index.js +33 -0
  165. package/dist/components/text-area/index.cjs +14 -0
  166. package/dist/components/text-area/index.d.cts +73 -0
  167. package/dist/components/text-area/index.d.ts +73 -0
  168. package/dist/components/text-area/index.js +14 -0
  169. package/dist/components/text-field/index.cjs +25 -0
  170. package/dist/components/text-field/index.d.cts +205 -0
  171. package/dist/components/text-field/index.d.ts +205 -0
  172. package/dist/components/text-field/index.js +25 -0
  173. package/dist/components/typography/index.cjs +15 -0
  174. package/dist/components/typography/index.d.cts +116 -0
  175. package/dist/components/typography/index.d.ts +116 -0
  176. package/dist/components/typography/index.js +15 -0
  177. package/dist/components/view/index.cjs +17 -0
  178. package/dist/components/view/index.d.cts +152 -0
  179. package/dist/components/view/index.d.ts +152 -0
  180. package/dist/components/view/index.js +17 -0
  181. package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
  182. package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
  183. package/dist/icon.type-Kml72iSz.d.ts +73 -0
  184. package/dist/icon.type-d_i9ma-i.d.cts +73 -0
  185. package/dist/index.cjs +423 -5
  186. package/dist/index.d.cts +119 -4
  187. package/dist/index.d.ts +119 -4
  188. package/dist/index.js +445 -27
  189. package/dist/placement-DHa0Rrh1.d.cts +38 -0
  190. package/dist/placement-DHa0Rrh1.d.ts +38 -0
  191. package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
  192. package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
  193. package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
  194. package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
  195. package/dist/system/index.cjs +73 -4
  196. package/dist/system/index.d.cts +379 -193
  197. package/dist/system/index.d.ts +379 -193
  198. package/dist/system/index.js +87 -18
  199. package/dist/text-field.type-0l73acce.d.ts +167 -0
  200. package/dist/text-field.type-DBh06DU5.d.cts +167 -0
  201. package/dist/theme/index.cjs +5 -3
  202. package/dist/theme/index.d.cts +55 -24
  203. package/dist/theme/index.d.ts +55 -24
  204. package/dist/theme/index.js +4 -2
  205. package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
  206. package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
  207. package/package.json +264 -18
  208. package/dist/chunk-ECDWSSHJ.js +0 -688
  209. package/dist/chunk-IYFGO523.cjs +0 -688
@@ -0,0 +1,124 @@
1
+ import {
2
+ useRotation
3
+ } from "./chunk-3GFRSZYR.js";
4
+ import {
5
+ createRecipe
6
+ } from "./chunk-4GTAZM2C.js";
7
+ import {
8
+ alpha,
9
+ useXAUITheme
10
+ } from "./chunk-A3EGFI6T.js";
11
+ import {
12
+ useStyleProps
13
+ } from "./chunk-M63GFNKV.js";
14
+
15
+ // src/components/spinner/spinner.tsx
16
+ import { forwardRef } from "react";
17
+ import { View } from "react-native";
18
+ import Animated from "react-native-reanimated";
19
+
20
+ // src/components/spinner/spinner.recipe.ts
21
+ var SLOTS = ["root", "arc"];
22
+ var VARIANT_TOKENS = {
23
+ primary: { fg: "accent" },
24
+ secondary: { fg: "accentSoftForeground" },
25
+ default: { fg: "foreground" },
26
+ tertiary: { fg: "muted" },
27
+ success: { fg: "success" },
28
+ warning: { fg: "warning" },
29
+ danger: { fg: "danger" }
30
+ };
31
+ var TRACK_OPACITY = 0.18;
32
+ function sizeAxis(step) {
33
+ return (theme) => {
34
+ const diameter = theme.spacing(step.diameter);
35
+ const stroke = theme.borderWidth.default * step.stroke;
36
+ return {
37
+ root: {
38
+ width: diameter,
39
+ height: diameter,
40
+ borderRadius: diameter / 2,
41
+ borderWidth: stroke
42
+ },
43
+ // The arc is the same ring, drawn one stroke outside the track's box so the two
44
+ // circles land on each other rather than nesting. R13 — `start` and `end`, so the
45
+ // inset mirrors with the layout instead of staying put.
46
+ arc: {
47
+ position: "absolute",
48
+ top: -stroke,
49
+ bottom: -stroke,
50
+ start: -stroke,
51
+ end: -stroke,
52
+ borderRadius: diameter / 2 + stroke,
53
+ borderWidth: stroke
54
+ }
55
+ };
56
+ };
57
+ }
58
+ var SIZES = {
59
+ xs: { diameter: 4, stroke: 2 },
60
+ sm: { diameter: 5, stroke: 2 },
61
+ md: { diameter: 6, stroke: 2 },
62
+ lg: { diameter: 8, stroke: 3 }
63
+ };
64
+ var spinnerRecipe = createRecipe({
65
+ slots: SLOTS,
66
+ base: () => ({
67
+ // Squircle corners are meaningless on a full circle, and `overflow` would clip the
68
+ // arc that deliberately sits outside this box.
69
+ root: { alignItems: "center", justifyContent: "center" }
70
+ }),
71
+ variantTokens: VARIANT_TOKENS,
72
+ /**
73
+ * One ink, two opacities, and the gap that makes the rotation visible.
74
+ *
75
+ * `borderTopColor: 'transparent'` is structural rather than a colour the theme has an
76
+ * opinion about — it is the quarter of the circle that is missing, and without it a
77
+ * rotating ring is a ring.
78
+ */
79
+ paint: (_theme, colors) => ({
80
+ root: { borderColor: colors.fg ? alpha(colors.fg, TRACK_OPACITY) : void 0 },
81
+ arc: { borderColor: colors.fg, borderTopColor: "transparent" }
82
+ }),
83
+ variants: {
84
+ size: {
85
+ xs: sizeAxis(SIZES.xs),
86
+ sm: sizeAxis(SIZES.sm),
87
+ md: sizeAxis(SIZES.md),
88
+ lg: sizeAxis(SIZES.lg)
89
+ }
90
+ },
91
+ defaultVariants: { variant: "primary", size: "md" }
92
+ });
93
+
94
+ // src/components/spinner/spinner.tsx
95
+ import { jsx } from "react/jsx-runtime";
96
+ var Spinner = forwardRef(function Spinner2({ variant, size, color, animation = true, style, ...props }, ref) {
97
+ const theme = useXAUITheme();
98
+ const [styleProps, rest] = useStyleProps(props);
99
+ const selection = { variant, size };
100
+ const styles = spinnerRecipe.resolve({ theme, selection });
101
+ const tint = color ? spinnerRecipe.tint({ theme, color, selection }) : void 0;
102
+ const arcStyle = [styles.arc, tint?.arc];
103
+ return /* @__PURE__ */ jsx(
104
+ View,
105
+ {
106
+ ref,
107
+ accessibilityRole: "progressbar",
108
+ accessibilityState: { busy: animation },
109
+ ...rest,
110
+ style: [styles.root, tint?.root, styleProps, style],
111
+ children: animation ? /* @__PURE__ */ jsx(SpinningArc, { style: arcStyle }) : /* @__PURE__ */ jsx(View, { style: arcStyle })
112
+ }
113
+ );
114
+ });
115
+ Spinner.displayName = "XAUI.Spinner";
116
+ function SpinningArc({ style }) {
117
+ const rotation = useRotation();
118
+ return /* @__PURE__ */ jsx(Animated.View, { style: [style, rotation] });
119
+ }
120
+
121
+ export {
122
+ spinnerRecipe,
123
+ Spinner
124
+ };
@@ -0,0 +1,145 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkWDDXU3OHcjs = require('./chunk-WDDXU3OH.cjs');
4
+
5
+ // src/hooks/use-anchored-position.ts
6
+ var _react = require('react');
7
+ var _reactnative = require('react-native');
8
+
9
+ // src/utils/placement.ts
10
+ var OPPOSITE = {
11
+ top: "bottom",
12
+ bottom: "top",
13
+ start: "end",
14
+ end: "start"
15
+ };
16
+ function axisOf(placement) {
17
+ return placement === "top" || placement === "bottom" ? "vertical" : "horizontal";
18
+ }
19
+ function resolvePlacement(input) {
20
+ const { anchor, content, window, offset, alignOffset, insets } = input;
21
+ const available = window.width - insets.start - insets.end;
22
+ const width = Math.min(resolveWidth(input), Math.max(available, 0));
23
+ const placement = choosePlacement(input);
24
+ const room = Math.max(roomFor(placement, input), 0);
25
+ const vertical = axisOf(placement) === "vertical";
26
+ const maxHeight = vertical ? room : Math.max(window.height - insets.top - insets.bottom, 0);
27
+ const height = Math.min(content.height, maxHeight);
28
+ const top = clamp(
29
+ vertical ? placement === "bottom" ? anchor.y + anchor.height + offset : anchor.y - offset - height : alignedCross(input, height) + alignOffset,
30
+ insets.top,
31
+ Math.max(window.height - insets.bottom - height, insets.top)
32
+ );
33
+ const start = clamp(
34
+ vertical ? alignedCross(input, width) + alignOffset : placement === "end" ? anchor.x + anchor.width + offset : anchor.x - offset - width,
35
+ insets.start,
36
+ Math.max(window.width - insets.end - width, insets.start)
37
+ );
38
+ return { top, start, width, maxHeight, placement };
39
+ }
40
+ function resolveWidth(input) {
41
+ const { width, anchor, content, placement, window, insets } = input;
42
+ if (width === "trigger") {
43
+ return axisOf(placement) === "vertical" ? anchor.width : content.width;
44
+ }
45
+ if (width === "full") return Math.max(window.width - insets.start - insets.end, 0);
46
+ if (width === "content-fit") return content.width;
47
+ return width;
48
+ }
49
+ function choosePlacement(input) {
50
+ const { placement, avoidCollisions, content } = input;
51
+ if (!avoidCollisions) return placement;
52
+ const wanted = axisOf(placement) === "vertical" ? content.height : content.width;
53
+ if (roomFor(placement, input) >= wanted) return placement;
54
+ const other = OPPOSITE[placement];
55
+ return roomFor(other, input) > roomFor(placement, input) ? other : placement;
56
+ }
57
+ function roomFor(placement, input) {
58
+ const { anchor, window, offset, insets } = input;
59
+ switch (placement) {
60
+ case "bottom":
61
+ return window.height - insets.bottom - (anchor.y + anchor.height) - offset;
62
+ case "top":
63
+ return anchor.y - insets.top - offset;
64
+ case "end":
65
+ return window.width - insets.end - (anchor.x + anchor.width) - offset;
66
+ case "start":
67
+ return anchor.x - insets.start - offset;
68
+ }
69
+ }
70
+ function alignedCross({ align, anchor, placement }, size) {
71
+ const vertical = axisOf(placement) === "vertical";
72
+ const origin = vertical ? anchor.x : anchor.y;
73
+ const extent = vertical ? anchor.width : anchor.height;
74
+ if (align === "start") return origin;
75
+ if (align === "end") return origin + extent - size;
76
+ return origin + (extent - size) / 2;
77
+ }
78
+ function clamp(value, min, max) {
79
+ return Math.min(Math.max(value, min), max);
80
+ }
81
+
82
+ // src/hooks/use-anchored-position.ts
83
+ function useAnchoredPosition({
84
+ anchor,
85
+ isOpen,
86
+ onLayout,
87
+ ...options
88
+ }) {
89
+ const window = _reactnative.useWindowDimensions.call(void 0, );
90
+ const origin = _nullishCoalesce(_optionalChain([_react.useContext.call(void 0, _chunkWDDXU3OHcjs.PortalContext), 'optionalAccess', _ => _.origin]), () => ( ZERO));
91
+ const [measured, setMeasured] = _react.useState.call(void 0, null);
92
+ const onContentLayout = _react.useCallback.call(void 0,
93
+ (event) => {
94
+ _optionalChain([onLayout, 'optionalCall', _2 => _2(event)]);
95
+ const { width, height } = event.nativeEvent.layout;
96
+ setMeasured(
97
+ (current) => current !== null && current.width === width && current.height === height ? current : { width, height }
98
+ );
99
+ },
100
+ [onLayout]
101
+ );
102
+ if (!isOpen && measured !== null) setMeasured(null);
103
+ const local = anchor && {
104
+ ...anchor,
105
+ x: anchor.x - origin.x,
106
+ y: anchor.y - origin.y
107
+ };
108
+ const position = local && measured ? resolvePlacement({
109
+ anchor: local,
110
+ content: measured,
111
+ window: {
112
+ width: window.width - origin.x,
113
+ height: window.height - origin.y
114
+ },
115
+ ...options
116
+ }) : null;
117
+ return {
118
+ position,
119
+ onContentLayout,
120
+ measuringStyle: {
121
+ // Invisible, and at the start of the host, so the reader never sees the panel at
122
+ // the wrong place during the frame it is being measured in.
123
+ opacity: 0,
124
+ top: 0,
125
+ start: 0,
126
+ ...measuringWidth(options, _optionalChain([local, 'optionalAccess', _3 => _3.width]), window)
127
+ }
128
+ };
129
+ }
130
+ function measuringWidth({
131
+ width,
132
+ maxWidth,
133
+ insets
134
+ }, anchorWidth, window) {
135
+ const screen = Math.max(window.width - insets.start - insets.end, 0);
136
+ if (width === "trigger") return { width: anchorWidth };
137
+ if (width === "full") return { width: screen };
138
+ if (typeof width === "number") return { width };
139
+ return { maxWidth: Math.min(_nullishCoalesce(maxWidth, () => ( Number.POSITIVE_INFINITY)), screen) };
140
+ }
141
+ var ZERO = { x: 0, y: 0 };
142
+
143
+
144
+
145
+ exports.useAnchoredPosition = useAnchoredPosition;
@@ -0,0 +1,194 @@
1
+ // src/system/style-props/use-style-props.ts
2
+ import { useMemo } from "react";
3
+
4
+ // src/utils/stable-hash.ts
5
+ function canonical(value) {
6
+ if (value === null || typeof value !== "object")
7
+ return JSON.stringify(value) ?? "null";
8
+ if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
9
+ const entries = Object.entries(value).filter(([, v]) => typeof v !== "function").sort(([a], [b]) => a < b ? -1 : 1).map(([k, v]) => `${JSON.stringify(k)}:${canonical(v)}`);
10
+ return `{${entries.join(",")}}`;
11
+ }
12
+ function stableHash(value) {
13
+ const input = canonical(value);
14
+ let hash = 2166136261;
15
+ for (let i = 0; i < input.length; i++) {
16
+ hash ^= input.charCodeAt(i);
17
+ hash = Math.imul(hash, 16777619) >>> 0;
18
+ }
19
+ return hash.toString(36);
20
+ }
21
+
22
+ // src/utils/style-props.ts
23
+ var STYLE_PROP_KEYS = [
24
+ // Flex and layout
25
+ "alignContent",
26
+ "alignItems",
27
+ "alignSelf",
28
+ "aspectRatio",
29
+ "boxSizing",
30
+ "columnGap",
31
+ "direction",
32
+ "display",
33
+ "flex",
34
+ "flexBasis",
35
+ "flexDirection",
36
+ "flexGrow",
37
+ "flexShrink",
38
+ "flexWrap",
39
+ "gap",
40
+ "justifyContent",
41
+ "overflow",
42
+ "rowGap",
43
+ // Position
44
+ "bottom",
45
+ "end",
46
+ "inset",
47
+ "insetBlock",
48
+ "insetBlockEnd",
49
+ "insetBlockStart",
50
+ "insetInline",
51
+ "insetInlineEnd",
52
+ "insetInlineStart",
53
+ "position",
54
+ "start",
55
+ "top",
56
+ "zIndex",
57
+ // Margin
58
+ "margin",
59
+ "marginBlock",
60
+ "marginBlockEnd",
61
+ "marginBlockStart",
62
+ "marginBottom",
63
+ "marginEnd",
64
+ "marginHorizontal",
65
+ "marginInline",
66
+ "marginInlineEnd",
67
+ "marginInlineStart",
68
+ "marginStart",
69
+ "marginTop",
70
+ "marginVertical",
71
+ // Padding
72
+ "padding",
73
+ "paddingBlock",
74
+ "paddingBlockEnd",
75
+ "paddingBlockStart",
76
+ "paddingBottom",
77
+ "paddingEnd",
78
+ "paddingHorizontal",
79
+ "paddingInline",
80
+ "paddingInlineEnd",
81
+ "paddingInlineStart",
82
+ "paddingStart",
83
+ "paddingTop",
84
+ "paddingVertical",
85
+ // Size
86
+ "height",
87
+ "maxHeight",
88
+ "maxWidth",
89
+ "minHeight",
90
+ "minWidth",
91
+ "width",
92
+ // Border
93
+ "borderBlockColor",
94
+ "borderBlockEndColor",
95
+ "borderBlockStartColor",
96
+ "borderBottomColor",
97
+ "borderBottomEndRadius",
98
+ "borderBottomStartRadius",
99
+ "borderBottomWidth",
100
+ "borderColor",
101
+ "borderCurve",
102
+ "borderEndColor",
103
+ "borderEndEndRadius",
104
+ "borderEndStartRadius",
105
+ "borderEndWidth",
106
+ "borderRadius",
107
+ "borderStartColor",
108
+ "borderStartEndRadius",
109
+ "borderStartStartRadius",
110
+ "borderStartWidth",
111
+ "borderStyle",
112
+ "borderTopColor",
113
+ "borderTopEndRadius",
114
+ "borderTopStartRadius",
115
+ "borderTopWidth",
116
+ "borderWidth",
117
+ // Fill, shadow, and the rest of a box's paint
118
+ "backfaceVisibility",
119
+ "backgroundColor",
120
+ "boxShadow",
121
+ "cursor",
122
+ "elevation",
123
+ "experimental_backgroundImage",
124
+ "filter",
125
+ "isolation",
126
+ "mixBlendMode",
127
+ "opacity",
128
+ "outlineColor",
129
+ "outlineOffset",
130
+ "outlineStyle",
131
+ "outlineWidth",
132
+ "shadowColor",
133
+ "shadowOffset",
134
+ "shadowOpacity",
135
+ "shadowRadius",
136
+ // Transform
137
+ "rotation",
138
+ "scaleX",
139
+ "scaleY",
140
+ "transform",
141
+ "transformMatrix",
142
+ "transformOrigin",
143
+ "translateX",
144
+ "translateY",
145
+ // Text — a text slot only
146
+ "color",
147
+ "fontFamily",
148
+ "fontSize",
149
+ "fontStyle",
150
+ "fontVariant",
151
+ "fontWeight",
152
+ "includeFontPadding",
153
+ "letterSpacing",
154
+ "lineHeight",
155
+ "textAlign",
156
+ "textAlignVertical",
157
+ "textDecorationColor",
158
+ "textDecorationLine",
159
+ "textDecorationStyle",
160
+ "textShadowColor",
161
+ "textShadowOffset",
162
+ "textShadowRadius",
163
+ "textTransform",
164
+ "userSelect",
165
+ "verticalAlign",
166
+ "writingDirection",
167
+ // Image — an image slot only
168
+ "objectFit",
169
+ "overlayColor",
170
+ "resizeMode",
171
+ "tintColor"
172
+ ];
173
+ var STYLE_PROP_KEY_SET = new Set(STYLE_PROP_KEYS);
174
+ function splitStyleProps(props) {
175
+ const styleProps = {};
176
+ const rest = {};
177
+ for (const [key, value] of Object.entries(props)) {
178
+ if (STYLE_PROP_KEY_SET.has(key)) styleProps[key] = value;
179
+ else rest[key] = value;
180
+ }
181
+ return [styleProps, rest];
182
+ }
183
+
184
+ // src/system/style-props/use-style-props.ts
185
+ function useStyleProps(props) {
186
+ const [styleProps, rest] = splitStyleProps(props);
187
+ const key = stableHash(styleProps);
188
+ return [useMemo(() => styleProps, [key]), rest];
189
+ }
190
+
191
+ export {
192
+ stableHash,
193
+ useStyleProps
194
+ };