@xaui/native 0.9.1-alpha.21 → 0.9.1-alpha.22

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 (75) hide show
  1. package/dist/{chunk-RMLFMRWL.js → chunk-2U6JR7BF.js} +5 -5
  2. package/dist/{chunk-N7C4UNUL.js → chunk-3JATAB7S.js} +23 -1
  3. package/dist/chunk-4MHJOWM4.cjs +364 -0
  4. package/dist/{chunk-2WMVDMFV.cjs → chunk-6HXWQ5AU.cjs} +2 -2
  5. package/dist/chunk-6WW4CSPY.cjs +82 -0
  6. package/dist/chunk-AHL33YAO.js +425 -0
  7. package/dist/{chunk-XHZBXYVU.js → chunk-AKXG43S4.js} +1 -1
  8. package/dist/{chunk-4NE3SLTM.cjs → chunk-BH5DSJVX.cjs} +102 -73
  9. package/dist/{chunk-BPBY7ON7.cjs → chunk-BNWS26PX.cjs} +19 -21
  10. package/dist/{chunk-5LC6KVL3.cjs → chunk-DXGQ43IV.cjs} +3 -3
  11. package/dist/{chunk-ISVUXVFL.js → chunk-FNQF4KQV.js} +19 -71
  12. package/dist/{chunk-YRCUALUQ.js → chunk-FTCTTBLG.js} +7 -9
  13. package/dist/{chunk-JL27KVRT.js → chunk-FVP5FUVS.js} +3 -3
  14. package/dist/{chunk-UL263KGM.cjs → chunk-GBPWTFTU.cjs} +10 -10
  15. package/dist/{chunk-TUJBDS5M.js → chunk-GG2WWCBK.js} +10 -10
  16. package/dist/{chunk-EVXZGNPA.cjs → chunk-HUZ4AUM2.cjs} +98 -98
  17. package/dist/chunk-I6PE5UUH.cjs +425 -0
  18. package/dist/{chunk-33QILJJH.cjs → chunk-IBEX4XGV.cjs} +11 -11
  19. package/dist/{chunk-IBRVMLUF.js → chunk-KM2TI5IC.js} +107 -80
  20. package/dist/chunk-OGC4RKE3.js +364 -0
  21. package/dist/{chunk-JXLRHKCQ.js → chunk-OYZYWWJ6.js} +1 -1
  22. package/dist/{chunk-EXX6ATAS.js → chunk-PMO62QK4.js} +101 -101
  23. package/dist/{chunk-UBA6AEY6.cjs → chunk-RAWOJ3N3.cjs} +8 -8
  24. package/dist/{chunk-APCBIHLR.cjs → chunk-VDRRD6GM.cjs} +29 -81
  25. package/dist/{chunk-UVO4GFSW.cjs → chunk-YXVKQMCK.cjs} +23 -1
  26. package/dist/chunk-ZQ3JSWRO.js +82 -0
  27. package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
  28. package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
  29. package/dist/components/alert/index.cjs +17 -0
  30. package/dist/components/alert/index.d.cts +169 -0
  31. package/dist/components/alert/index.d.ts +169 -0
  32. package/dist/components/alert/index.js +17 -0
  33. package/dist/components/button/index.cjs +6 -7
  34. package/dist/components/button/index.d.cts +193 -244
  35. package/dist/components/button/index.d.ts +193 -244
  36. package/dist/components/button/index.js +5 -6
  37. package/dist/components/card/index.cjs +5 -6
  38. package/dist/components/card/index.d.cts +193 -193
  39. package/dist/components/card/index.d.ts +193 -193
  40. package/dist/components/card/index.js +4 -5
  41. package/dist/components/chip/index.cjs +17 -0
  42. package/dist/components/chip/index.d.cts +608 -0
  43. package/dist/components/chip/index.d.ts +608 -0
  44. package/dist/components/chip/index.js +17 -0
  45. package/dist/components/typography/index.cjs +4 -4
  46. package/dist/components/typography/index.d.cts +4 -4
  47. package/dist/components/typography/index.d.ts +4 -4
  48. package/dist/components/typography/index.js +3 -3
  49. package/dist/components/view/index.cjs +3 -3
  50. package/dist/components/view/index.d.cts +7 -7
  51. package/dist/components/view/index.d.ts +7 -7
  52. package/dist/components/view/index.js +2 -2
  53. package/dist/{create-recipe-CC3NNCqF.d.ts → create-recipe-CbXika57.d.ts} +4 -3
  54. package/dist/{create-recipe-CPBFg7ym.d.cts → create-recipe-jHlk434p.d.cts} +4 -3
  55. package/dist/{icon.type-Cs1tMX0W.d.cts → icon.type-CF4KiMKl.d.cts} +1 -1
  56. package/dist/{icon.type-BkcEPJbK.d.ts → icon.type-Dq4_qePa.d.ts} +1 -1
  57. package/dist/index.cjs +36 -14
  58. package/dist/index.d.cts +8 -5
  59. package/dist/index.d.ts +8 -5
  60. package/dist/index.js +55 -33
  61. package/dist/{pressable-feedback.type-wfeiJz5m.d.cts → pressable-feedback.type-BA2C9sSz.d.cts} +1 -1
  62. package/dist/{pressable-feedback.type-DsvWZXWC.d.ts → pressable-feedback.type-Bs4dQlGj.d.ts} +1 -1
  63. package/dist/{style-props.type-B1BG5TCm.d.cts → style-props.type-CfnoGEP7.d.cts} +1 -1
  64. package/dist/{style-props.type-B1BG5TCm.d.ts → style-props.type-CfnoGEP7.d.ts} +1 -1
  65. package/dist/system/index.cjs +15 -7
  66. package/dist/system/index.d.cts +174 -100
  67. package/dist/system/index.d.ts +174 -100
  68. package/dist/system/index.js +15 -7
  69. package/dist/theme/index.cjs +2 -2
  70. package/dist/theme/index.d.cts +10 -10
  71. package/dist/theme/index.d.ts +10 -10
  72. package/dist/theme/index.js +1 -1
  73. package/package.json +21 -1
  74. package/dist/chunk-RRRGLRRP.cjs +0 -28
  75. package/dist/chunk-SGHP76GU.js +0 -28
@@ -1,9 +1,8 @@
1
- import { usePressState, warnDev } from "./chunk-SGHP76GU.js";
2
- import { Icon } from "./chunk-JL27KVRT.js";
3
- import { PressableFeedback } from "./chunk-IBRVMLUF.js";
4
- import { createRecipe } from "./chunk-N7C4UNUL.js";
5
- import { childrenToString, createSlotContext, useStyleProps } from "./chunk-EXX6ATAS.js";
1
+ import { Icon } from "./chunk-FVP5FUVS.js";
2
+ import { PressableFeedback, usePressState, warnDev } from "./chunk-KM2TI5IC.js";
3
+ import { createRecipe, radiusAxis } from "./chunk-3JATAB7S.js";
6
4
  import { useXAUITheme } from "./chunk-A3EGFI6T.js";
5
+ import { childrenToString, createSlotContext, useStyleProps } from "./chunk-PMO62QK4.js";
7
6
 
8
7
  // src/components/button/button.context.ts
9
8
  var [ButtonProvider, useButton] = createSlotContext("Button");
@@ -74,10 +73,10 @@ function ButtonSpinner({
74
73
  });
75
74
  }
76
75
  ButtonSpinner.displayName = "XAUI.Button.Spinner";
77
- const _worklet_4101557563546_init_data = {
78
- code: "function chunkISVUXVFLJs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
79
- location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-ISVUXVFL.js",
80
- sourceMap: "{\"version\":3,\"names\":[\"chunkISVUXVFLJs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-ISVUXVFL.js\"],\"mappings\":\"AAoFyC,SAAAA,gBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE3C,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
76
+ const _worklet_763735822272_init_data = {
77
+ code: "function chunkFNQF4KQVJs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
78
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-FNQF4KQV.js",
79
+ sourceMap: "{\"version\":3,\"names\":[\"chunkFNQF4KQVJs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-FNQF4KQV.js\"],\"mappings\":\"AAmFyC,SAAAA,gBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE3C,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
81
80
  };
82
81
  function SpinningRing({
83
82
  style
@@ -90,28 +89,28 @@ function SpinningRing({
90
89
  }), -1, false);
91
90
  return () => cancelAnimation(angle);
92
91
  }, [angle]);
93
- const animatedStyle = useAnimatedStyle(function chunkISVUXVFLJs1Factory({
94
- _worklet_4101557563546_init_data,
92
+ const animatedStyle = useAnimatedStyle(function chunkFNQF4KQVJs1Factory({
93
+ _worklet_763735822272_init_data,
95
94
  angle
96
95
  }) {
97
96
  const _e = [new global.Error(), -2, -27];
98
- const chunkISVUXVFLJs1 = function () {
97
+ const chunkFNQF4KQVJs1 = function () {
99
98
  return {
100
99
  transform: [{
101
100
  rotate: `${angle.value}deg`
102
101
  }]
103
102
  };
104
103
  };
105
- chunkISVUXVFLJs1.__closure = {
104
+ chunkFNQF4KQVJs1.__closure = {
106
105
  angle
107
106
  };
108
- chunkISVUXVFLJs1.__workletHash = 4101557563546;
109
- chunkISVUXVFLJs1.__pluginVersion = "0.7.4";
110
- chunkISVUXVFLJs1.__initData = _worklet_4101557563546_init_data;
111
- chunkISVUXVFLJs1.__stackDetails = _e;
112
- return chunkISVUXVFLJs1;
107
+ chunkFNQF4KQVJs1.__workletHash = 763735822272;
108
+ chunkFNQF4KQVJs1.__pluginVersion = "0.7.4";
109
+ chunkFNQF4KQVJs1.__initData = _worklet_763735822272_init_data;
110
+ chunkFNQF4KQVJs1.__stackDetails = _e;
111
+ return chunkFNQF4KQVJs1;
113
112
  }({
114
- _worklet_4101557563546_init_data,
113
+ _worklet_763735822272_init_data,
115
114
  angle
116
115
  }), [angle]);
117
116
  return /* @__PURE__ */jsx3(Animated.View, {
@@ -273,58 +272,7 @@ var buttonRecipe = createRecipe({
273
272
  radius: "4xl"
274
273
  })
275
274
  },
276
- radius: {
277
- xs: t => ({
278
- root: {
279
- borderRadius: t.radius.xs
280
- }
281
- }),
282
- sm: t => ({
283
- root: {
284
- borderRadius: t.radius.sm
285
- }
286
- }),
287
- md: t => ({
288
- root: {
289
- borderRadius: t.radius.md
290
- }
291
- }),
292
- lg: t => ({
293
- root: {
294
- borderRadius: t.radius.lg
295
- }
296
- }),
297
- xl: t => ({
298
- root: {
299
- borderRadius: t.radius.xl
300
- }
301
- }),
302
- "2xl": t => ({
303
- root: {
304
- borderRadius: t.radius["2xl"]
305
- }
306
- }),
307
- "3xl": t => ({
308
- root: {
309
- borderRadius: t.radius["3xl"]
310
- }
311
- }),
312
- "4xl": t => ({
313
- root: {
314
- borderRadius: t.radius["4xl"]
315
- }
316
- }),
317
- field: t => ({
318
- root: {
319
- borderRadius: t.radius.field
320
- }
321
- }),
322
- full: t => ({
323
- root: {
324
- borderRadius: t.radius.full
325
- }
326
- })
327
- },
275
+ radius: radiusAxis("root"),
328
276
  // A square on a fixed height. No width is computed, and none needs to be.
329
277
  isIconOnly: {
330
278
  true: () => ({
@@ -1,22 +1,20 @@
1
1
  import {
2
+ PressableFeedback,
2
3
  usePressState,
3
4
  warnDev
4
- } from "./chunk-SGHP76GU.js";
5
- import {
6
- PressableFeedback
7
- } from "./chunk-IBRVMLUF.js";
5
+ } from "./chunk-KM2TI5IC.js";
8
6
  import {
9
7
  createRecipe
10
- } from "./chunk-N7C4UNUL.js";
8
+ } from "./chunk-3JATAB7S.js";
9
+ import {
10
+ useXAUITheme
11
+ } from "./chunk-A3EGFI6T.js";
11
12
  import {
12
13
  Slot,
13
14
  childrenToString,
14
15
  createSlotContext,
15
16
  useStyleProps
16
- } from "./chunk-EXX6ATAS.js";
17
- import {
18
- useXAUITheme
19
- } from "./chunk-A3EGFI6T.js";
17
+ } from "./chunk-PMO62QK4.js";
20
18
 
21
19
  // src/components/card/card-background.tsx
22
20
  import { forwardRef } from "react";
@@ -1,9 +1,9 @@
1
- import {
2
- useStyleProps
3
- } from "./chunk-EXX6ATAS.js";
4
1
  import {
5
2
  useXAUITheme
6
3
  } from "./chunk-A3EGFI6T.js";
4
+ import {
5
+ useStyleProps
6
+ } from "./chunk-PMO62QK4.js";
7
7
 
8
8
  // src/system/icon/icon-context.ts
9
9
  import { createContext, useContext } from "react";
@@ -179,7 +179,7 @@ var tokens = {
179
179
  fieldBorder: "#e4e4e7",
180
180
  success: "#15803d",
181
181
  successForeground: "#fafafa",
182
- warning: "#b45309",
182
+ warning: "#c2410c",
183
183
  warningForeground: "#fafafa",
184
184
  danger: "#dc2626",
185
185
  dangerForeground: "#fafafa",
@@ -191,7 +191,7 @@ var tokens = {
191
191
  link: "#18181b",
192
192
  accentPressed: "#8533d3",
193
193
  successPressed: "#1b753a",
194
- warningPressed: "#a34d13",
194
+ warningPressed: "#af3e15",
195
195
  dangerPressed: "#c72927",
196
196
  defaultPressed: "#dbdbde",
197
197
  surfacePressed: "#eaeaea",
@@ -204,9 +204,9 @@ var tokens = {
204
204
  successSoft: "rgba(21, 128, 61, 0.15)",
205
205
  successSoftForeground: "#205f34",
206
206
  successSoftPressed: "rgba(21, 128, 61, 0.2)",
207
- warningSoft: "rgba(180, 83, 9, 0.15)",
208
- warningSoftForeground: "#793f1e",
209
- warningSoftPressed: "rgba(180, 83, 9, 0.2)",
207
+ warningSoft: "rgba(194, 65, 12, 0.15)",
208
+ warningSoftForeground: "#82361e",
209
+ warningSoftPressed: "rgba(194, 65, 12, 0.2)",
210
210
  dangerSoft: "rgba(220, 38, 38, 0.15)",
211
211
  dangerSoftForeground: "#b22b28",
212
212
  dangerSoftPressed: "rgba(220, 38, 38, 0.2)",
@@ -249,7 +249,7 @@ var tokens = {
249
249
  fieldBorder: "#3f3f46",
250
250
  success: "#4ade80",
251
251
  successForeground: "#18181b",
252
- warning: "#fbbf24",
252
+ warning: "#fb923c",
253
253
  warningForeground: "#18181b",
254
254
  danger: "#f87171",
255
255
  dangerForeground: "#18181b",
@@ -261,7 +261,7 @@ var tokens = {
261
261
  link: "#fafafa",
262
262
  accentPressed: "#c691fd",
263
263
  successPressed: "#64e18d",
264
- warningPressed: "#fbc54b",
264
+ warningPressed: "#fc9d55",
265
265
  dangerPressed: "#fa807e",
266
266
  defaultPressed: "#2e2e31",
267
267
  surfacePressed: "#27272a",
@@ -274,9 +274,9 @@ var tokens = {
274
274
  successSoft: "rgba(74, 222, 128, 0.15)",
275
275
  successSoftForeground: "#8de8a6",
276
276
  successSoftPressed: "rgba(74, 222, 128, 0.2)",
277
- warningSoft: "rgba(251, 191, 36, 0.15)",
278
- warningSoftForeground: "#fbd586",
279
- warningSoftPressed: "rgba(251, 191, 36, 0.2)",
277
+ warningSoft: "rgba(251, 146, 60, 0.15)",
278
+ warningSoftForeground: "#feb887",
279
+ warningSoftPressed: "rgba(251, 146, 60, 0.2)",
280
280
  dangerSoft: "rgba(248, 113, 113, 0.15)",
281
281
  dangerSoftForeground: "#fc8f8c",
282
282
  dangerSoftPressed: "rgba(248, 113, 113, 0.2)",
@@ -179,7 +179,7 @@ var tokens = {
179
179
  fieldBorder: "#e4e4e7",
180
180
  success: "#15803d",
181
181
  successForeground: "#fafafa",
182
- warning: "#b45309",
182
+ warning: "#c2410c",
183
183
  warningForeground: "#fafafa",
184
184
  danger: "#dc2626",
185
185
  dangerForeground: "#fafafa",
@@ -191,7 +191,7 @@ var tokens = {
191
191
  link: "#18181b",
192
192
  accentPressed: "#8533d3",
193
193
  successPressed: "#1b753a",
194
- warningPressed: "#a34d13",
194
+ warningPressed: "#af3e15",
195
195
  dangerPressed: "#c72927",
196
196
  defaultPressed: "#dbdbde",
197
197
  surfacePressed: "#eaeaea",
@@ -204,9 +204,9 @@ var tokens = {
204
204
  successSoft: "rgba(21, 128, 61, 0.15)",
205
205
  successSoftForeground: "#205f34",
206
206
  successSoftPressed: "rgba(21, 128, 61, 0.2)",
207
- warningSoft: "rgba(180, 83, 9, 0.15)",
208
- warningSoftForeground: "#793f1e",
209
- warningSoftPressed: "rgba(180, 83, 9, 0.2)",
207
+ warningSoft: "rgba(194, 65, 12, 0.15)",
208
+ warningSoftForeground: "#82361e",
209
+ warningSoftPressed: "rgba(194, 65, 12, 0.2)",
210
210
  dangerSoft: "rgba(220, 38, 38, 0.15)",
211
211
  dangerSoftForeground: "#b22b28",
212
212
  dangerSoftPressed: "rgba(220, 38, 38, 0.2)",
@@ -249,7 +249,7 @@ var tokens = {
249
249
  fieldBorder: "#3f3f46",
250
250
  success: "#4ade80",
251
251
  successForeground: "#18181b",
252
- warning: "#fbbf24",
252
+ warning: "#fb923c",
253
253
  warningForeground: "#18181b",
254
254
  danger: "#f87171",
255
255
  dangerForeground: "#18181b",
@@ -261,7 +261,7 @@ var tokens = {
261
261
  link: "#fafafa",
262
262
  accentPressed: "#c691fd",
263
263
  successPressed: "#64e18d",
264
- warningPressed: "#fbc54b",
264
+ warningPressed: "#fc9d55",
265
265
  dangerPressed: "#fa807e",
266
266
  defaultPressed: "#2e2e31",
267
267
  surfacePressed: "#27272a",
@@ -274,9 +274,9 @@ var tokens = {
274
274
  successSoft: "rgba(74, 222, 128, 0.15)",
275
275
  successSoftForeground: "#8de8a6",
276
276
  successSoftPressed: "rgba(74, 222, 128, 0.2)",
277
- warningSoft: "rgba(251, 191, 36, 0.15)",
278
- warningSoftForeground: "#fbd586",
279
- warningSoftPressed: "rgba(251, 191, 36, 0.2)",
277
+ warningSoft: "rgba(251, 146, 60, 0.15)",
278
+ warningSoftForeground: "#feb887",
279
+ warningSoftPressed: "rgba(251, 146, 60, 0.2)",
280
280
  dangerSoft: "rgba(248, 113, 113, 0.15)",
281
281
  dangerSoftForeground: "#fc8f8c",
282
282
  dangerSoftPressed: "rgba(248, 113, 113, 0.2)",
@@ -2,8 +2,104 @@
2
2
 
3
3
  var _chunkMC7SY2QHcjs = require('./chunk-MC7SY2QH.cjs');
4
4
 
5
- // src/system/style-props/use-style-props.ts
5
+ // src/system/slot/create-slot-context.ts
6
6
  var _react = require('react');
7
+ function createSlotContext(name) {
8
+ const Context = _react.createContext.call(void 0, null);
9
+ Context.displayName = `XAUI.${name}.Context`;
10
+ function useSlotContext() {
11
+ const value = _react.useContext.call(void 0, Context);
12
+ if (value === null) {
13
+ const error = new Error(
14
+ `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.`
15
+ );
16
+ _optionalChain([Error, 'access', _ => _.captureStackTrace, 'optionalCall', _2 => _2(
17
+ error,
18
+ useSlotContext
19
+ )]);
20
+ throw error;
21
+ }
22
+ return value;
23
+ }
24
+ return [Context.Provider, useSlotContext];
25
+ }
26
+
27
+ // src/system/slot/merge-refs.ts
28
+ function mergeRefs(...refs) {
29
+ return (value) => {
30
+ for (const ref of refs) {
31
+ if (typeof ref === "function") ref(value);
32
+ else if (ref) ref.current = value;
33
+ }
34
+ };
35
+ }
36
+
37
+ // src/system/slot/merge-props.ts
38
+ var EVENT_HANDLER = /^on[A-Z]/;
39
+ function mergeProps(ours, theirs) {
40
+ const merged = { ...ours };
41
+ for (const key of Object.keys(theirs)) {
42
+ const ourValue = ours[key];
43
+ const theirValue = theirs[key];
44
+ if (EVENT_HANDLER.test(key)) {
45
+ merged[key] = composeHandlers(ourValue, theirValue);
46
+ } else if (key === "style") {
47
+ merged[key] = mergeStyles(ourValue, theirValue);
48
+ } else if (key === "ref") {
49
+ merged[key] = mergeRefs(
50
+ ourValue,
51
+ theirValue
52
+ );
53
+ } else {
54
+ merged[key] = theirValue;
55
+ }
56
+ }
57
+ return merged;
58
+ }
59
+ function composeHandlers(ours, theirs) {
60
+ if (typeof ours !== "function") return theirs;
61
+ if (typeof theirs !== "function") return ours;
62
+ return (...args) => {
63
+ ;
64
+ ours(...args);
65
+ return theirs(...args);
66
+ };
67
+ }
68
+ function mergeStyles(ours, theirs) {
69
+ if (typeof ours === "function" || typeof theirs === "function") {
70
+ return (state) => [
71
+ resolveStyle(ours, state),
72
+ resolveStyle(theirs, state)
73
+ ];
74
+ }
75
+ return [ours, theirs];
76
+ }
77
+ function resolveStyle(style, state) {
78
+ return typeof style === "function" ? style(state) : style;
79
+ }
80
+
81
+ // src/system/slot/slot.tsx
82
+
83
+ var Slot = _react.forwardRef.call(void 0, function Slot2({ children, ...ours }, ref) {
84
+ if (!_react.isValidElement.call(void 0, children)) {
85
+ throw new Error(
86
+ "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."
87
+ );
88
+ }
89
+ const child = children;
90
+ const merged = mergeProps(ours, child.props);
91
+ merged.ref = mergeRefs(ref, refOf(child));
92
+ return _react.cloneElement.call(void 0, child, merged);
93
+ });
94
+ Slot.displayName = "XAUI.Slot";
95
+ function refOf(element) {
96
+ const fromProps = element.props.ref;
97
+ const fromElement = element.ref;
98
+ return _nullishCoalesce(fromProps, () => ( fromElement));
99
+ }
100
+
101
+ // src/system/style-props/use-style-props.ts
102
+
7
103
 
8
104
  // src/utils/style-props.ts
9
105
  var STYLE_PROP_KEYS = [
@@ -197,102 +293,6 @@ function stringify(node) {
197
293
  return null;
198
294
  }
199
295
 
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
296
 
297
297
 
298
298
 
@@ -300,4 +300,4 @@ function refOf(element) {
300
300
 
301
301
 
302
302
 
303
- exports.useStyleProps = useStyleProps; exports.childrenToString = childrenToString; exports.createSlotContext = createSlotContext; exports.mergeRefs = mergeRefs; exports.mergeProps = mergeProps; exports.Slot = Slot;
303
+ exports.createSlotContext = createSlotContext; exports.mergeRefs = mergeRefs; exports.mergeProps = mergeProps; exports.Slot = Slot; exports.useStyleProps = useStyleProps; exports.childrenToString = childrenToString;