@xaui/native 0.9.1-alpha.2 → 0.9.1-alpha.20

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 (53) hide show
  1. package/dist/chunk-2WMVDMFV.cjs +62 -0
  2. package/dist/chunk-33QILJJH.cjs +143 -0
  3. package/dist/chunk-4EPS7UBO.js +496 -0
  4. package/dist/{chunk-M7P46XKI.cjs → chunk-57SJ4LJF.cjs} +33 -3
  5. package/dist/chunk-6ARON3XT.cjs +534 -0
  6. package/dist/{chunk-RBNCR5KB.js → chunk-A3EGFI6T.js} +31 -1
  7. package/dist/chunk-A4VD4MHK.cjs +757 -0
  8. package/dist/{chunk-NHPQQQ7P.cjs → chunk-BHTFIZTQ.cjs} +55 -88
  9. package/dist/chunk-EVXZGNPA.cjs +303 -0
  10. package/dist/chunk-EXX6ATAS.js +303 -0
  11. package/dist/chunk-GGW42MY4.js +20 -0
  12. package/dist/chunk-JXLRHKCQ.js +143 -0
  13. package/dist/chunk-MC7SY2QH.cjs +20 -0
  14. package/dist/{chunk-PBVPOX7D.js → chunk-MWXE7D4L.js} +29 -62
  15. package/dist/{chunk-RCP3SD26.js → chunk-N7C4UNUL.js} +2 -126
  16. package/dist/chunk-RMLFMRWL.js +102 -0
  17. package/dist/chunk-UBA6AEY6.cjs +102 -0
  18. package/dist/{chunk-B755PRVJ.cjs → chunk-UVO4GFSW.cjs} +3 -127
  19. package/dist/chunk-WXAME7KB.js +728 -0
  20. package/dist/chunk-XHZBXYVU.js +62 -0
  21. package/dist/components/button/index.cjs +15 -0
  22. package/dist/components/button/index.d.cts +658 -0
  23. package/dist/components/button/index.d.ts +658 -0
  24. package/dist/components/button/index.js +15 -0
  25. package/dist/components/typography/index.cjs +14 -0
  26. package/dist/components/typography/index.d.cts +116 -0
  27. package/dist/components/typography/index.d.ts +116 -0
  28. package/dist/components/typography/index.js +14 -0
  29. package/dist/components/view/index.cjs +16 -0
  30. package/dist/components/view/index.d.cts +152 -0
  31. package/dist/components/view/index.d.ts +152 -0
  32. package/dist/components/view/index.js +16 -0
  33. package/dist/create-recipe-C0XXjuow.d.cts +89 -0
  34. package/dist/create-recipe-CPXFo2rk.d.ts +89 -0
  35. package/dist/index.cjs +151 -5
  36. package/dist/index.d.cts +77 -4
  37. package/dist/index.d.ts +77 -4
  38. package/dist/index.js +155 -9
  39. package/dist/pressable-feedback.type-1K8YEOb8.d.cts +195 -0
  40. package/dist/pressable-feedback.type-BwkKLQlX.d.ts +195 -0
  41. package/dist/style-props.type-B1BG5TCm.d.cts +31 -0
  42. package/dist/style-props.type-B1BG5TCm.d.ts +31 -0
  43. package/dist/system/index.cjs +64 -3
  44. package/dist/system/index.d.cts +299 -75
  45. package/dist/system/index.d.ts +299 -75
  46. package/dist/system/index.js +66 -5
  47. package/dist/theme/index.cjs +4 -3
  48. package/dist/theme/index.d.cts +26 -14
  49. package/dist/theme/index.d.ts +26 -14
  50. package/dist/theme/index.js +7 -6
  51. package/dist/{theme.type-B3ODSLbB.d.cts → theme.type-C2gNHpEx.d.cts} +8 -2
  52. package/dist/{theme.type-B3ODSLbB.d.ts → theme.type-C2gNHpEx.d.ts} +8 -2
  53. package/package.json +64 -18
@@ -1,67 +1,55 @@
1
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
2
 
3
3
 
4
- var _chunkM7P46XKIcjs = require('./chunk-M7P46XKI.cjs');
4
+
5
+ var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
6
+
7
+
8
+ var _chunkMC7SY2QHcjs = require('./chunk-MC7SY2QH.cjs');
5
9
 
6
10
  // src/provider/xaui-provider.tsx
7
11
  var _reactnative = require('react-native');
8
12
 
9
- // src/utils/stable-hash.ts
10
- function canonical(value) {
11
- if (value === null || typeof value !== "object") return _nullishCoalesce(JSON.stringify(value), () => ( "null"));
12
- if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
13
- 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)}`);
14
- return `{${entries.join(",")}}`;
15
- }
16
- function stableHash(value) {
17
- const input = canonical(value);
18
- let hash = 2166136261;
19
- for (let i = 0; i < input.length; i++) {
20
- hash ^= input.charCodeAt(i);
21
- hash = Math.imul(hash, 16777619) >>> 0;
22
- }
23
- return hash.toString(36);
24
- }
25
-
26
13
  // src/theme/derive-colors.ts
27
14
  function deriveColors(s) {
28
15
  return {
29
- accentPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.accent, s.accentForeground, 0.1),
30
- successPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.success, s.successForeground, 0.1),
31
- warningPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.warning, s.warningForeground, 0.1),
32
- dangerPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.danger, s.dangerForeground, 0.1),
33
- defaultPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.default, s.defaultForeground, 0.04),
34
- surfacePressed: _chunkM7P46XKIcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.08),
35
- defaultSoft: _chunkM7P46XKIcjs.alpha.call(void 0, s.default, 0.5),
16
+ accentPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.accent, s.foreground, 0.1),
17
+ successPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.success, s.foreground, 0.1),
18
+ warningPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.warning, s.foreground, 0.1),
19
+ dangerPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.danger, s.foreground, 0.1),
20
+ defaultPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.default, s.defaultForeground, 0.04),
21
+ surfacePressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.08),
22
+ defaultSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.default, 0.5),
36
23
  defaultSoftForeground: s.defaultForeground,
37
- defaultSoftPressed: _chunkM7P46XKIcjs.alpha.call(void 0, s.default, 0.6),
38
- accentSoft: _chunkM7P46XKIcjs.alpha.call(void 0, s.accent, 0.15),
39
- accentSoftForeground: _chunkM7P46XKIcjs.mix.call(void 0, s.accent, s.foreground, 0.2),
40
- accentSoftPressed: _chunkM7P46XKIcjs.alpha.call(void 0, s.accent, 0.2),
41
- successSoft: _chunkM7P46XKIcjs.alpha.call(void 0, s.success, 0.15),
42
- successSoftForeground: _chunkM7P46XKIcjs.mix.call(void 0, s.success, s.foreground, 0.3),
43
- successSoftPressed: _chunkM7P46XKIcjs.alpha.call(void 0, s.success, 0.2),
44
- warningSoft: _chunkM7P46XKIcjs.alpha.call(void 0, s.warning, 0.15),
45
- warningSoftForeground: _chunkM7P46XKIcjs.mix.call(void 0, s.warning, s.foreground, 0.35),
46
- warningSoftPressed: _chunkM7P46XKIcjs.alpha.call(void 0, s.warning, 0.2),
47
- dangerSoft: _chunkM7P46XKIcjs.alpha.call(void 0, s.danger, 0.15),
48
- dangerSoftForeground: _chunkM7P46XKIcjs.mix.call(void 0, s.danger, s.foreground, 0.2),
49
- dangerSoftPressed: _chunkM7P46XKIcjs.alpha.call(void 0, s.danger, 0.2),
50
- backgroundSecondary: _chunkM7P46XKIcjs.mix.call(void 0, s.background, s.foreground, 0.04),
51
- backgroundTertiary: _chunkM7P46XKIcjs.mix.call(void 0, s.background, s.foreground, 0.08),
24
+ defaultSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.default, 0.6),
25
+ accentSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.accent, 0.15),
26
+ accentSoftForeground: _chunk57SJ4LJFcjs.mix.call(void 0, s.accent, s.foreground, 0.2),
27
+ accentSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.accent, 0.2),
28
+ successSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.success, 0.15),
29
+ successSoftForeground: _chunk57SJ4LJFcjs.mix.call(void 0, s.success, s.foreground, 0.3),
30
+ successSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.success, 0.2),
31
+ warningSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.warning, 0.15),
32
+ warningSoftForeground: _chunk57SJ4LJFcjs.mix.call(void 0, s.warning, s.foreground, 0.35),
33
+ warningSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.warning, 0.2),
34
+ dangerSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.danger, 0.15),
35
+ dangerSoftForeground: _chunk57SJ4LJFcjs.mix.call(void 0, s.danger, s.foreground, 0.2),
36
+ dangerSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.danger, 0.2),
37
+ backgroundSecondary: _chunk57SJ4LJFcjs.mix.call(void 0, s.background, s.foreground, 0.04),
38
+ backgroundTertiary: _chunk57SJ4LJFcjs.mix.call(void 0, s.background, s.foreground, 0.08),
52
39
  backgroundInverse: s.foreground,
53
- borderSecondary: _chunkM7P46XKIcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.22),
54
- borderTertiary: _chunkM7P46XKIcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.34),
55
- separatorSecondary: _chunkM7P46XKIcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.15),
56
- separatorTertiary: _chunkM7P46XKIcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.19),
57
- fieldPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.fieldBackground, s.fieldForeground, 0.1),
40
+ borderSecondary: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.22),
41
+ borderTertiary: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.34),
42
+ separatorSecondary: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.15),
43
+ separatorTertiary: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.19),
44
+ fieldPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.fieldBackground, s.fieldForeground, 0.1),
58
45
  fieldFocus: s.fieldBackground,
59
- fieldBorderPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.12),
60
- fieldBorderFocus: _chunkM7P46XKIcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.26)
46
+ fieldBorderPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.12),
47
+ fieldBorderFocus: _chunk57SJ4LJFcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.26)
61
48
  };
62
49
  }
63
50
 
64
51
  // src/theme/scales.ts
52
+
65
53
  var SPACING_UNIT = 4;
66
54
  var RADIUS_BASE = 12;
67
55
  function buildRadius(base) {
@@ -113,7 +101,10 @@ var fontWeights = {
113
101
  var fontFamilies = {
114
102
  body: "System",
115
103
  heading: "System",
116
- mono: "monospace"
104
+ // `'monospace'` is an Android family name, not a generic one: iOS does not resolve it and
105
+ // silently falls back to the system face, so code set with it is not monospaced there.
106
+ // Menlo is the face iOS ships, and it is what HeroUI Native selects for the same reason.
107
+ mono: _reactnative.Platform.OS === "ios" ? "Menlo" : "monospace"
117
108
  };
118
109
  var borderWidth = { default: 1, field: 1 };
119
110
  var opacity = { disabled: 0.5 };
@@ -178,7 +169,7 @@ var tokens = {
178
169
  overlayForeground: "#18181b",
179
170
  backdrop: "rgba(0, 0, 0, 0.2)",
180
171
  muted: "#71717a",
181
- default: "#f4f4f5",
172
+ default: "#e4e4e7",
182
173
  defaultForeground: "#18181b",
183
174
  accent: "#9333ea",
184
175
  accentForeground: "#faf5ff",
@@ -198,15 +189,15 @@ var tokens = {
198
189
  separator: "#d4d4d8",
199
190
  focus: "#9333ea",
200
191
  link: "#18181b",
201
- accentPressed: "#9c4eee",
202
- successPressed: "#378c50",
203
- warningPressed: "#bd642f",
204
- dangerPressed: "#e2473f",
205
- defaultPressed: "#eaeaeb",
192
+ accentPressed: "#8533d3",
193
+ successPressed: "#1b753a",
194
+ warningPressed: "#a34d13",
195
+ dangerPressed: "#c72927",
196
+ defaultPressed: "#dbdbde",
206
197
  surfacePressed: "#eaeaea",
207
- defaultSoft: "rgba(244, 244, 245, 0.5)",
198
+ defaultSoft: "rgba(228, 228, 231, 0.5)",
208
199
  defaultSoftForeground: "#18181b",
209
- defaultSoftPressed: "rgba(244, 244, 245, 0.6)",
200
+ defaultSoftPressed: "rgba(228, 228, 231, 0.6)",
210
201
  accentSoft: "rgba(147, 51, 234, 0.15)",
211
202
  accentSoftForeground: "#7833bc",
212
203
  accentSoftPressed: "rgba(147, 51, 234, 0.2)",
@@ -268,10 +259,10 @@ var tokens = {
268
259
  separator: "#52525b",
269
260
  focus: "#c084fc",
270
261
  link: "#fafafa",
271
- accentPressed: "#ad78e3",
272
- successPressed: "#47c875",
273
- warningPressed: "#e1ac2b",
274
- dangerPressed: "#df6868",
262
+ accentPressed: "#c691fd",
263
+ successPressed: "#64e18d",
264
+ warningPressed: "#fbc54b",
265
+ dangerPressed: "#fa807e",
275
266
  defaultPressed: "#2e2e31",
276
267
  surfacePressed: "#27272a",
277
268
  defaultSoft: "rgba(39, 39, 42, 0.5)",
@@ -376,7 +367,7 @@ function resolveMode(mode, config, id) {
376
367
  };
377
368
  }
378
369
  function createTheme(config = {}) {
379
- const id = stableHash(config);
370
+ const id = _chunkMC7SY2QHcjs.stableHash.call(void 0, config);
380
371
  return {
381
372
  id,
382
373
  light: resolveMode("light", config, id),
@@ -385,11 +376,8 @@ function createTheme(config = {}) {
385
376
  }
386
377
  var defaultTheme = createTheme();
387
378
 
388
- // src/theme/theme-context.ts
389
- var _react = require('react');
390
- var ThemeContext = _react.createContext.call(void 0, null);
391
-
392
379
  // src/provider/xaui-provider.tsx
380
+ var _jsxruntime = require('react/jsx-runtime');
393
381
  function XAUIProvider({
394
382
  children,
395
383
  theme = defaultTheme,
@@ -397,7 +385,7 @@ function XAUIProvider({
397
385
  }) {
398
386
  const scheme = _reactnative.useColorScheme.call(void 0, );
399
387
  const resolved = colorMode === "system" ? scheme === "dark" ? "dark" : "light" : colorMode;
400
- return /* @__PURE__ */ React.createElement(ThemeContext.Provider, { value: theme[resolved] }, children);
388
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk57SJ4LJFcjs.ThemeContext.Provider, { value: theme[resolved], children });
401
389
  }
402
390
 
403
391
  // src/theme/palette.ts
@@ -699,27 +687,6 @@ var primitives = {
699
687
  eclipse: "#18181b"
700
688
  };
701
689
 
702
- // src/theme/theme-hooks.ts
703
-
704
- function useXAUITheme() {
705
- const theme = _react.useContext.call(void 0, ThemeContext);
706
- if (theme === null) {
707
- throw new Error("XAUI: useXAUITheme must be used within <XAUIProvider>.");
708
- }
709
- return theme;
710
- }
711
- function useColorMode() {
712
- return useXAUITheme().mode;
713
- }
714
- function useThemeColor(token) {
715
- const { colors } = useXAUITheme();
716
- return Array.isArray(token) ? token.map((key) => colors[key]) : colors[token];
717
- }
718
-
719
-
720
-
721
-
722
-
723
690
 
724
691
 
725
692
 
@@ -731,4 +698,4 @@ function useThemeColor(token) {
731
698
 
732
699
 
733
700
 
734
- exports.deriveColors = deriveColors; exports.buildRadius = buildRadius; exports.buildShadows = buildShadows; exports.tokens = tokens; exports.sourceKeys = sourceKeys; exports.createTheme = createTheme; exports.defaultTheme = defaultTheme; exports.ThemeContext = ThemeContext; exports.XAUIProvider = XAUIProvider; exports.palette = palette; exports.primitives = primitives; exports.useXAUITheme = useXAUITheme; exports.useColorMode = useColorMode; exports.useThemeColor = useThemeColor;
701
+ exports.deriveColors = deriveColors; exports.buildRadius = buildRadius; exports.buildShadows = buildShadows; exports.tokens = tokens; exports.sourceKeys = sourceKeys; exports.createTheme = createTheme; exports.defaultTheme = defaultTheme; exports.XAUIProvider = XAUIProvider; exports.palette = palette; exports.primitives = primitives;
@@ -0,0 +1,303 @@
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 _chunkMC7SY2QHcjs = require('./chunk-MC7SY2QH.cjs');
4
+
5
+ // src/system/style-props/use-style-props.ts
6
+ var _react = require('react');
7
+
8
+ // src/utils/style-props.ts
9
+ var STYLE_PROP_KEYS = [
10
+ // Flex and layout
11
+ "alignContent",
12
+ "alignItems",
13
+ "alignSelf",
14
+ "aspectRatio",
15
+ "boxSizing",
16
+ "columnGap",
17
+ "direction",
18
+ "display",
19
+ "flex",
20
+ "flexBasis",
21
+ "flexDirection",
22
+ "flexGrow",
23
+ "flexShrink",
24
+ "flexWrap",
25
+ "gap",
26
+ "justifyContent",
27
+ "overflow",
28
+ "rowGap",
29
+ // Position
30
+ "bottom",
31
+ "end",
32
+ "inset",
33
+ "insetBlock",
34
+ "insetBlockEnd",
35
+ "insetBlockStart",
36
+ "insetInline",
37
+ "insetInlineEnd",
38
+ "insetInlineStart",
39
+ "position",
40
+ "start",
41
+ "top",
42
+ "zIndex",
43
+ // Margin
44
+ "margin",
45
+ "marginBlock",
46
+ "marginBlockEnd",
47
+ "marginBlockStart",
48
+ "marginBottom",
49
+ "marginEnd",
50
+ "marginHorizontal",
51
+ "marginInline",
52
+ "marginInlineEnd",
53
+ "marginInlineStart",
54
+ "marginStart",
55
+ "marginTop",
56
+ "marginVertical",
57
+ // Padding
58
+ "padding",
59
+ "paddingBlock",
60
+ "paddingBlockEnd",
61
+ "paddingBlockStart",
62
+ "paddingBottom",
63
+ "paddingEnd",
64
+ "paddingHorizontal",
65
+ "paddingInline",
66
+ "paddingInlineEnd",
67
+ "paddingInlineStart",
68
+ "paddingStart",
69
+ "paddingTop",
70
+ "paddingVertical",
71
+ // Size
72
+ "height",
73
+ "maxHeight",
74
+ "maxWidth",
75
+ "minHeight",
76
+ "minWidth",
77
+ "width",
78
+ // Border
79
+ "borderBlockColor",
80
+ "borderBlockEndColor",
81
+ "borderBlockStartColor",
82
+ "borderBottomColor",
83
+ "borderBottomEndRadius",
84
+ "borderBottomStartRadius",
85
+ "borderBottomWidth",
86
+ "borderColor",
87
+ "borderCurve",
88
+ "borderEndColor",
89
+ "borderEndEndRadius",
90
+ "borderEndStartRadius",
91
+ "borderEndWidth",
92
+ "borderRadius",
93
+ "borderStartColor",
94
+ "borderStartEndRadius",
95
+ "borderStartStartRadius",
96
+ "borderStartWidth",
97
+ "borderStyle",
98
+ "borderTopColor",
99
+ "borderTopEndRadius",
100
+ "borderTopStartRadius",
101
+ "borderTopWidth",
102
+ "borderWidth",
103
+ // Fill, shadow, and the rest of a box's paint
104
+ "backfaceVisibility",
105
+ "backgroundColor",
106
+ "boxShadow",
107
+ "cursor",
108
+ "elevation",
109
+ "experimental_backgroundImage",
110
+ "filter",
111
+ "isolation",
112
+ "mixBlendMode",
113
+ "opacity",
114
+ "outlineColor",
115
+ "outlineOffset",
116
+ "outlineStyle",
117
+ "outlineWidth",
118
+ "shadowColor",
119
+ "shadowOffset",
120
+ "shadowOpacity",
121
+ "shadowRadius",
122
+ // Transform
123
+ "rotation",
124
+ "scaleX",
125
+ "scaleY",
126
+ "transform",
127
+ "transformMatrix",
128
+ "transformOrigin",
129
+ "translateX",
130
+ "translateY",
131
+ // Text — a text slot only
132
+ "color",
133
+ "fontFamily",
134
+ "fontSize",
135
+ "fontStyle",
136
+ "fontVariant",
137
+ "fontWeight",
138
+ "includeFontPadding",
139
+ "letterSpacing",
140
+ "lineHeight",
141
+ "textAlign",
142
+ "textAlignVertical",
143
+ "textDecorationColor",
144
+ "textDecorationLine",
145
+ "textDecorationStyle",
146
+ "textShadowColor",
147
+ "textShadowOffset",
148
+ "textShadowRadius",
149
+ "textTransform",
150
+ "userSelect",
151
+ "verticalAlign",
152
+ "writingDirection",
153
+ // Image — an image slot only
154
+ "objectFit",
155
+ "overlayColor",
156
+ "resizeMode",
157
+ "tintColor"
158
+ ];
159
+ var STYLE_PROP_KEY_SET = new Set(STYLE_PROP_KEYS);
160
+ function splitStyleProps(props) {
161
+ const styleProps = {};
162
+ const rest = {};
163
+ for (const [key, value] of Object.entries(props)) {
164
+ if (STYLE_PROP_KEY_SET.has(key)) styleProps[key] = value;
165
+ else rest[key] = value;
166
+ }
167
+ return [styleProps, rest];
168
+ }
169
+
170
+ // src/system/style-props/use-style-props.ts
171
+ function useStyleProps(props) {
172
+ const [styleProps, rest] = splitStyleProps(props);
173
+ const key = _chunkMC7SY2QHcjs.stableHash.call(void 0, styleProps);
174
+ return [_react.useMemo.call(void 0, () => styleProps, [key]), rest];
175
+ }
176
+
177
+ // src/system/slot/children-to-string.ts
178
+
179
+ function childrenToString(children) {
180
+ const text = stringify(children);
181
+ return text === null || text === "" ? null : text;
182
+ }
183
+ function stringify(node) {
184
+ if (node === null || node === void 0 || typeof node === "boolean") return "";
185
+ if (typeof node === "string") return node;
186
+ if (typeof node === "number") return String(node);
187
+ if (_react.isValidElement.call(void 0, node)) return null;
188
+ if (Array.isArray(node)) {
189
+ let text = "";
190
+ for (const child of node) {
191
+ const part = stringify(child);
192
+ if (part === null) return null;
193
+ text += part;
194
+ }
195
+ return text;
196
+ }
197
+ return null;
198
+ }
199
+
200
+ // src/system/slot/create-slot-context.ts
201
+
202
+ function createSlotContext(name) {
203
+ const Context = _react.createContext.call(void 0, null);
204
+ Context.displayName = `XAUI.${name}.Context`;
205
+ function useSlotContext() {
206
+ const value = _react.useContext.call(void 0, Context);
207
+ if (value === null) {
208
+ const error = new Error(
209
+ `XAUI: use${name} must be called inside <${name}>. A slot reads the values its root resolved, so it can only be rendered as a child of one.`
210
+ );
211
+ _optionalChain([Error, 'access', _ => _.captureStackTrace, 'optionalCall', _2 => _2(
212
+ error,
213
+ useSlotContext
214
+ )]);
215
+ throw error;
216
+ }
217
+ return value;
218
+ }
219
+ return [Context.Provider, useSlotContext];
220
+ }
221
+
222
+ // src/system/slot/merge-refs.ts
223
+ function mergeRefs(...refs) {
224
+ return (value) => {
225
+ for (const ref of refs) {
226
+ if (typeof ref === "function") ref(value);
227
+ else if (ref) ref.current = value;
228
+ }
229
+ };
230
+ }
231
+
232
+ // src/system/slot/merge-props.ts
233
+ var EVENT_HANDLER = /^on[A-Z]/;
234
+ function mergeProps(ours, theirs) {
235
+ const merged = { ...ours };
236
+ for (const key of Object.keys(theirs)) {
237
+ const ourValue = ours[key];
238
+ const theirValue = theirs[key];
239
+ if (EVENT_HANDLER.test(key)) {
240
+ merged[key] = composeHandlers(ourValue, theirValue);
241
+ } else if (key === "style") {
242
+ merged[key] = mergeStyles(ourValue, theirValue);
243
+ } else if (key === "ref") {
244
+ merged[key] = mergeRefs(
245
+ ourValue,
246
+ theirValue
247
+ );
248
+ } else {
249
+ merged[key] = theirValue;
250
+ }
251
+ }
252
+ return merged;
253
+ }
254
+ function composeHandlers(ours, theirs) {
255
+ if (typeof ours !== "function") return theirs;
256
+ if (typeof theirs !== "function") return ours;
257
+ return (...args) => {
258
+ ;
259
+ ours(...args);
260
+ return theirs(...args);
261
+ };
262
+ }
263
+ function mergeStyles(ours, theirs) {
264
+ if (typeof ours === "function" || typeof theirs === "function") {
265
+ return (state) => [
266
+ resolveStyle(ours, state),
267
+ resolveStyle(theirs, state)
268
+ ];
269
+ }
270
+ return [ours, theirs];
271
+ }
272
+ function resolveStyle(style, state) {
273
+ return typeof style === "function" ? style(state) : style;
274
+ }
275
+
276
+ // src/system/slot/slot.tsx
277
+
278
+ var Slot = _react.forwardRef.call(void 0, function Slot2({ children, ...ours }, ref) {
279
+ if (!_react.isValidElement.call(void 0, children)) {
280
+ throw new Error(
281
+ "XAUI: asChild expects exactly one React element as its child, and merges the component's props into it. Text, a fragment, several children or none give it nothing to merge into \u2014 drop `asChild` to render the component itself."
282
+ );
283
+ }
284
+ const child = children;
285
+ const merged = mergeProps(ours, child.props);
286
+ merged.ref = mergeRefs(ref, refOf(child));
287
+ return _react.cloneElement.call(void 0, child, merged);
288
+ });
289
+ Slot.displayName = "XAUI.Slot";
290
+ function refOf(element) {
291
+ const fromProps = element.props.ref;
292
+ const fromElement = element.ref;
293
+ return _nullishCoalesce(fromProps, () => ( fromElement));
294
+ }
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+ exports.useStyleProps = useStyleProps; exports.childrenToString = childrenToString; exports.createSlotContext = createSlotContext; exports.mergeRefs = mergeRefs; exports.mergeProps = mergeProps; exports.Slot = Slot;