@xaui/native 0.9.1-alpha.3 → 0.9.1-alpha.31

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 (149) hide show
  1. package/dist/chunk-3FV4COTM.js +68 -0
  2. package/dist/chunk-423RQBOX.js +21 -0
  3. package/dist/chunk-42FMGB5M.js +661 -0
  4. package/dist/chunk-4GTAZM2C.js +174 -0
  5. package/dist/chunk-4XPLPQLM.cjs +147 -0
  6. package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
  7. package/dist/chunk-5GO7MAVY.cjs +74 -0
  8. package/dist/chunk-5PTBRJM7.cjs +346 -0
  9. package/dist/chunk-5RQ7AZPN.cjs +455 -0
  10. package/dist/chunk-5Z4P6WHR.cjs +525 -0
  11. package/dist/chunk-7DPL3ZDS.cjs +21 -0
  12. package/dist/chunk-7EIHHOHP.cjs +42 -0
  13. package/dist/chunk-7SEZGVTY.js +62 -0
  14. package/dist/chunk-7XKQJQF2.cjs +70 -0
  15. package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
  16. package/dist/chunk-A5OCK3C2.js +525 -0
  17. package/dist/chunk-AETWQQWU.cjs +92 -0
  18. package/dist/chunk-ANNUYP55.cjs +431 -0
  19. package/dist/chunk-BA2DBSAN.js +102 -0
  20. package/dist/chunk-BFMTUMTU.js +669 -0
  21. package/dist/chunk-BVJQ3UPZ.js +62 -0
  22. package/dist/chunk-DFME724B.js +147 -0
  23. package/dist/chunk-E2CWBQTV.js +119 -0
  24. package/dist/chunk-EGLLDKN6.js +9 -0
  25. package/dist/chunk-EJQCQPET.cjs +9 -0
  26. package/dist/chunk-F6CQ6CBI.cjs +112 -0
  27. package/dist/chunk-F6W3JQ7K.js +42 -0
  28. package/dist/chunk-FNEUOBCV.cjs +174 -0
  29. package/dist/chunk-G7K652GC.js +145 -0
  30. package/dist/chunk-GGW42MY4.js +20 -0
  31. package/dist/chunk-GLGU2WFL.cjs +190 -0
  32. package/dist/chunk-GPVNCJ3Z.cjs +696 -0
  33. package/dist/chunk-GVQOD3VW.js +74 -0
  34. package/dist/chunk-IHOCANCQ.js +293 -0
  35. package/dist/chunk-JDFV4W6N.cjs +700 -0
  36. package/dist/chunk-KOC3KQIT.js +124 -0
  37. package/dist/chunk-KPWZLUES.cjs +124 -0
  38. package/dist/chunk-L7JN6OBQ.cjs +314 -0
  39. package/dist/chunk-MC7SY2QH.cjs +20 -0
  40. package/dist/chunk-MDVSCWJI.js +314 -0
  41. package/dist/chunk-N527BTY4.cjs +366 -0
  42. package/dist/chunk-NYRXUGVL.js +104 -0
  43. package/dist/{chunk-AW63PTQ4.cjs → chunk-OHEHPQLC.cjs} +72 -72
  44. package/dist/chunk-Q3WFY5N3.js +366 -0
  45. package/dist/chunk-QGN2BBJO.cjs +104 -0
  46. package/dist/chunk-RDTKAAHX.js +346 -0
  47. package/dist/chunk-TGZZ3RZU.cjs +86 -0
  48. package/dist/{chunk-2KXQATVL.js → chunk-TZG3DERP.js} +46 -46
  49. package/dist/chunk-URSKA2VR.js +190 -0
  50. package/dist/chunk-V4WDMM6Z.js +86 -0
  51. package/dist/chunk-VJEER76X.js +455 -0
  52. package/dist/chunk-VZBWYWEI.cjs +736 -0
  53. package/dist/chunk-WR7YLDVV.cjs +68 -0
  54. package/dist/chunk-X4HQ4H2V.js +701 -0
  55. package/dist/chunk-XFSW3ZNI.cjs +145 -0
  56. package/dist/chunk-XQFAUDR2.cjs +62 -0
  57. package/dist/chunk-ZH5XVNHG.js +92 -0
  58. package/dist/chunk-ZH6BHLQR.js +431 -0
  59. package/dist/chunk-ZP2E2H2G.cjs +119 -0
  60. package/dist/chunk-ZVWXM3UK.cjs +293 -0
  61. package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
  62. package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
  63. package/dist/components/alert/index.cjs +20 -0
  64. package/dist/components/alert/index.d.cts +169 -0
  65. package/dist/components/alert/index.d.ts +169 -0
  66. package/dist/components/alert/index.js +20 -0
  67. package/dist/components/button/index.cjs +21 -0
  68. package/dist/components/button/index.d.cts +613 -0
  69. package/dist/components/button/index.d.ts +613 -0
  70. package/dist/components/button/index.js +21 -0
  71. package/dist/components/card/index.cjs +22 -0
  72. package/dist/components/card/index.d.cts +620 -0
  73. package/dist/components/card/index.d.ts +620 -0
  74. package/dist/components/card/index.js +22 -0
  75. package/dist/components/checkbox/index.cjs +26 -0
  76. package/dist/components/checkbox/index.d.cts +1136 -0
  77. package/dist/components/checkbox/index.d.ts +1136 -0
  78. package/dist/components/checkbox/index.js +26 -0
  79. package/dist/components/chip/index.cjs +20 -0
  80. package/dist/components/chip/index.d.cts +608 -0
  81. package/dist/components/chip/index.d.ts +608 -0
  82. package/dist/components/chip/index.js +20 -0
  83. package/dist/components/divider/index.cjs +13 -0
  84. package/dist/components/divider/index.d.cts +117 -0
  85. package/dist/components/divider/index.d.ts +117 -0
  86. package/dist/components/divider/index.js +13 -0
  87. package/dist/components/input/index.cjs +25 -0
  88. package/dist/components/input/index.d.cts +205 -0
  89. package/dist/components/input/index.d.ts +205 -0
  90. package/dist/components/input/index.js +25 -0
  91. package/dist/components/input-group/index.cjs +27 -0
  92. package/dist/components/input-group/index.d.cts +270 -0
  93. package/dist/components/input-group/index.d.ts +270 -0
  94. package/dist/components/input-group/index.js +27 -0
  95. package/dist/components/input-otp/index.cjs +29 -0
  96. package/dist/components/input-otp/index.d.cts +325 -0
  97. package/dist/components/input-otp/index.d.ts +325 -0
  98. package/dist/components/input-otp/index.js +29 -0
  99. package/dist/components/radio/index.cjs +26 -0
  100. package/dist/components/radio/index.d.cts +1102 -0
  101. package/dist/components/radio/index.d.ts +1102 -0
  102. package/dist/components/radio/index.js +26 -0
  103. package/dist/components/spinner/index.cjs +16 -0
  104. package/dist/components/spinner/index.d.cts +104 -0
  105. package/dist/components/spinner/index.d.ts +104 -0
  106. package/dist/components/spinner/index.js +16 -0
  107. package/dist/components/switch/index.cjs +27 -0
  108. package/dist/components/switch/index.d.cts +1154 -0
  109. package/dist/components/switch/index.d.ts +1154 -0
  110. package/dist/components/switch/index.js +27 -0
  111. package/dist/components/text-area/index.cjs +14 -0
  112. package/dist/components/text-area/index.d.cts +73 -0
  113. package/dist/components/text-area/index.d.ts +73 -0
  114. package/dist/components/text-area/index.js +14 -0
  115. package/dist/components/typography/index.cjs +15 -0
  116. package/dist/components/typography/index.d.cts +116 -0
  117. package/dist/components/typography/index.d.ts +116 -0
  118. package/dist/components/typography/index.js +15 -0
  119. package/dist/components/view/index.cjs +17 -0
  120. package/dist/components/view/index.d.cts +152 -0
  121. package/dist/components/view/index.d.ts +152 -0
  122. package/dist/components/view/index.js +17 -0
  123. package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
  124. package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
  125. package/dist/icon.type-Kml72iSz.d.ts +73 -0
  126. package/dist/icon.type-d_i9ma-i.d.cts +73 -0
  127. package/dist/index.cjs +252 -4
  128. package/dist/index.d.cts +110 -4
  129. package/dist/index.d.ts +110 -4
  130. package/dist/index.js +271 -23
  131. package/dist/input.type-BUMDlzL9.d.cts +167 -0
  132. package/dist/input.type-D2qgi03E.d.ts +167 -0
  133. package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
  134. package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
  135. package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
  136. package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
  137. package/dist/system/index.cjs +60 -3
  138. package/dist/system/index.d.cts +347 -181
  139. package/dist/system/index.d.ts +347 -181
  140. package/dist/system/index.js +71 -14
  141. package/dist/theme/index.cjs +4 -3
  142. package/dist/theme/index.d.cts +34 -23
  143. package/dist/theme/index.d.ts +34 -23
  144. package/dist/theme/index.js +3 -2
  145. package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
  146. package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
  147. package/package.json +184 -18
  148. package/dist/chunk-QAMNNTGM.js +0 -637
  149. package/dist/chunk-V63JO65F.cjs +0 -637
@@ -0,0 +1,62 @@
1
+ import { mergeRefs } from "./chunk-URSKA2VR.js";
2
+
3
+ // src/hooks/use-merged-ref.ts
4
+ import { useMemo } from "react";
5
+ function useMergedRef(...refs) {
6
+ return useMemo(() => mergeRefs(...refs), refs);
7
+ }
8
+
9
+ // src/hooks/use-previous.ts
10
+ import { useEffect, useRef } from "react";
11
+ function usePrevious(value) {
12
+ const previous = useRef(void 0);
13
+ useEffect(() => {
14
+ previous.current = value;
15
+ }, [value]);
16
+ return previous.current;
17
+ }
18
+
19
+ // src/hooks/use-rotation.ts
20
+ import { useEffect as useEffect2 } from "react";
21
+ import { Easing, cancelAnimation, useAnimatedStyle, useSharedValue, withRepeat, withTiming } from "react-native-reanimated";
22
+ var ROTATION_DURATION = 900;
23
+ const _worklet_9664866718948_init_data = {
24
+ code: "function chunkBVJQ3UPZJs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
25
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-BVJQ3UPZ.js",
26
+ sourceMap: "{\"version\":3,\"names\":[\"chunkBVJQ3UPZJs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-BVJQ3UPZ.js\"],\"mappings\":\"AAyC0B,SAAAA,gBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE5B,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
27
+ };
28
+ function useRotation() {
29
+ const angle = useSharedValue(0);
30
+ useEffect2(() => {
31
+ angle.value = withRepeat(withTiming(360, {
32
+ duration: ROTATION_DURATION,
33
+ easing: Easing.linear
34
+ }), -1, false);
35
+ return () => cancelAnimation(angle);
36
+ }, [angle]);
37
+ return useAnimatedStyle(function chunkBVJQ3UPZJs1Factory({
38
+ _worklet_9664866718948_init_data,
39
+ angle
40
+ }) {
41
+ const _e = [new global.Error(), -2, -27];
42
+ const chunkBVJQ3UPZJs1 = function () {
43
+ return {
44
+ transform: [{
45
+ rotate: `${angle.value}deg`
46
+ }]
47
+ };
48
+ };
49
+ chunkBVJQ3UPZJs1.__closure = {
50
+ angle
51
+ };
52
+ chunkBVJQ3UPZJs1.__workletHash = 9664866718948;
53
+ chunkBVJQ3UPZJs1.__pluginVersion = "0.7.4";
54
+ chunkBVJQ3UPZJs1.__initData = _worklet_9664866718948_init_data;
55
+ chunkBVJQ3UPZJs1.__stackDetails = _e;
56
+ return chunkBVJQ3UPZJs1;
57
+ }({
58
+ _worklet_9664866718948_init_data,
59
+ angle
60
+ }), [angle]);
61
+ }
62
+ export { useMergedRef, usePrevious, ROTATION_DURATION, useRotation };
@@ -0,0 +1,147 @@
1
+ import {
2
+ InputField,
3
+ useInput
4
+ } from "./chunk-A5OCK3C2.js";
5
+ import {
6
+ Icon
7
+ } from "./chunk-3FV4COTM.js";
8
+ import {
9
+ Slot,
10
+ createSlotContext
11
+ } from "./chunk-E2CWBQTV.js";
12
+ import {
13
+ useStyleProps
14
+ } from "./chunk-URSKA2VR.js";
15
+
16
+ // src/components/input-group/input-group-field.tsx
17
+ import { forwardRef, useMemo } from "react";
18
+
19
+ // src/components/input-group/input-group.context.ts
20
+ var [InputGroupProvider, useInputGroup] = createSlotContext("InputGroup");
21
+
22
+ // src/components/input-group/input-group.utils.ts
23
+ function decoratorPadding(prefixWidth, suffixWidth) {
24
+ const paddingStart = prefixWidth > 0 ? prefixWidth : void 0;
25
+ const paddingEnd = suffixWidth > 0 ? suffixWidth : void 0;
26
+ if (paddingStart === void 0 && paddingEnd === void 0) return void 0;
27
+ return { paddingStart, paddingEnd };
28
+ }
29
+
30
+ // src/components/input-group/input-group-field.tsx
31
+ import { jsx } from "react/jsx-runtime";
32
+ var InputGroupField = forwardRef(
33
+ function InputGroupField2({ style, ...props }, ref) {
34
+ const { prefixWidth, suffixWidth } = useInputGroup();
35
+ const padding = useMemo(
36
+ () => decoratorPadding(prefixWidth, suffixWidth),
37
+ [prefixWidth, suffixWidth]
38
+ );
39
+ return /* @__PURE__ */ jsx(InputField, { ref, ...props, style: [padding, style] });
40
+ }
41
+ );
42
+ InputGroupField.displayName = "XAUI.InputGroup.Field";
43
+
44
+ // src/components/input-group/input-group-icon.tsx
45
+ import { jsx as jsx2 } from "react/jsx-runtime";
46
+ function InputGroupIcon({ size, color, ...rest }) {
47
+ const { icon } = useInput();
48
+ return /* @__PURE__ */ jsx2(Icon, { size: size ?? icon.size, color: color ?? icon.color, ...rest });
49
+ }
50
+ InputGroupIcon.displayName = "XAUI.InputGroup.Icon";
51
+
52
+ // src/components/input-group/input-group-prefix.tsx
53
+ import { forwardRef as forwardRef3 } from "react";
54
+
55
+ // src/components/input-group/input-group-decorator.tsx
56
+ import { forwardRef as forwardRef2, useCallback } from "react";
57
+ import { View } from "react-native";
58
+ import { jsx as jsx3 } from "react/jsx-runtime";
59
+ var InputGroupDecorator = forwardRef2(
60
+ function InputGroupDecorator2({ side, children, isDecorative = false, onLayout, style, ...props }, ref) {
61
+ const { prefixStyle, suffixStyle, isDisabled } = useInput();
62
+ const { setPrefixWidth, setSuffixWidth } = useInputGroup();
63
+ const [styleProps, rest] = useStyleProps(props);
64
+ const report = side === "prefix" ? setPrefixWidth : setSuffixWidth;
65
+ const handleLayout = useCallback(
66
+ (event) => {
67
+ report(event.nativeEvent.layout.width);
68
+ onLayout?.(event);
69
+ },
70
+ [report, onLayout]
71
+ );
72
+ const isInert = isDecorative || isDisabled;
73
+ return /* @__PURE__ */ jsx3(
74
+ View,
75
+ {
76
+ ref,
77
+ accessibilityElementsHidden: isDecorative || void 0,
78
+ importantForAccessibility: isDecorative ? "no-hide-descendants" : void 0,
79
+ pointerEvents: isInert ? "none" : void 0,
80
+ ...rest,
81
+ style: [side === "prefix" ? prefixStyle : suffixStyle, styleProps, style],
82
+ onLayout: handleLayout,
83
+ children
84
+ }
85
+ );
86
+ }
87
+ );
88
+ InputGroupDecorator.displayName = "XAUI.InputGroup.Decorator";
89
+
90
+ // src/components/input-group/input-group-prefix.tsx
91
+ import { jsx as jsx4 } from "react/jsx-runtime";
92
+ var InputGroupPrefix = forwardRef3(
93
+ function InputGroupPrefix2(props, ref) {
94
+ return /* @__PURE__ */ jsx4(InputGroupDecorator, { ref, side: "prefix", ...props });
95
+ }
96
+ );
97
+ InputGroupPrefix.displayName = "XAUI.InputGroup.Prefix";
98
+
99
+ // src/components/input-group/input-group-suffix.tsx
100
+ import { forwardRef as forwardRef4 } from "react";
101
+ import { jsx as jsx5 } from "react/jsx-runtime";
102
+ var InputGroupSuffix = forwardRef4(
103
+ function InputGroupSuffix2(props, ref) {
104
+ return /* @__PURE__ */ jsx5(InputGroupDecorator, { ref, side: "suffix", ...props });
105
+ }
106
+ );
107
+ InputGroupSuffix.displayName = "XAUI.InputGroup.Suffix";
108
+
109
+ // src/components/input-group/input-group.tsx
110
+ import { forwardRef as forwardRef5, useMemo as useMemo2, useState } from "react";
111
+ import { View as View2 } from "react-native";
112
+ import { jsx as jsx6 } from "react/jsx-runtime";
113
+ var InputGroupRoot = forwardRef5(function InputGroup({ children, asChild = false, style, ...props }, ref) {
114
+ const [styleProps, rest] = useStyleProps(props);
115
+ const [prefixWidth, setPrefixWidth] = useState(0);
116
+ const [suffixWidth, setSuffixWidth] = useState(0);
117
+ const context = useMemo2(
118
+ () => ({ prefixWidth, suffixWidth, setPrefixWidth, setSuffixWidth }),
119
+ [prefixWidth, suffixWidth]
120
+ );
121
+ const rootStyle = [styleProps, style];
122
+ const surface = asChild ? (
123
+ // R12 — the caller's element *is* the row.
124
+ /* @__PURE__ */ jsx6(Slot, { ref, ...rest, style: rootStyle, children })
125
+ ) : /* @__PURE__ */ jsx6(View2, { ref, ...rest, style: rootStyle, children });
126
+ return /* @__PURE__ */ jsx6(InputGroupProvider, { value: context, children: surface });
127
+ });
128
+ InputGroupRoot.displayName = "XAUI.InputGroup.Root";
129
+
130
+ // src/components/input-group/index.ts
131
+ var InputGroup2 = Object.assign(InputGroupRoot, {
132
+ Prefix: InputGroupPrefix,
133
+ Field: InputGroupField,
134
+ Suffix: InputGroupSuffix,
135
+ Icon: InputGroupIcon
136
+ });
137
+
138
+ export {
139
+ useInputGroup,
140
+ decoratorPadding,
141
+ InputGroupField,
142
+ InputGroupIcon,
143
+ InputGroupPrefix,
144
+ InputGroupSuffix,
145
+ InputGroupRoot,
146
+ InputGroup2 as InputGroup
147
+ };
@@ -0,0 +1,119 @@
1
+ import {
2
+ mergeRefs
3
+ } from "./chunk-URSKA2VR.js";
4
+
5
+ // src/system/slot/create-slot-context.ts
6
+ import { createContext, useContext } from "react";
7
+ function createSlotContext(name) {
8
+ const Context = createContext(null);
9
+ Context.displayName = `XAUI.${name}.Context`;
10
+ function useSlotContext() {
11
+ const value = useContext(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
+ Error.captureStackTrace?.(
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-props.ts
28
+ var EVENT_HANDLER = /^on[A-Z]/;
29
+ function mergeProps(ours, theirs) {
30
+ const merged = { ...ours };
31
+ for (const key of Object.keys(theirs)) {
32
+ const ourValue = ours[key];
33
+ const theirValue = theirs[key];
34
+ if (EVENT_HANDLER.test(key)) {
35
+ merged[key] = composeHandlers(ourValue, theirValue);
36
+ } else if (key === "style") {
37
+ merged[key] = mergeStyles(ourValue, theirValue);
38
+ } else if (key === "ref") {
39
+ merged[key] = mergeRefs(
40
+ ourValue,
41
+ theirValue
42
+ );
43
+ } else {
44
+ merged[key] = theirValue;
45
+ }
46
+ }
47
+ return merged;
48
+ }
49
+ function composeHandlers(ours, theirs) {
50
+ if (typeof ours !== "function") return theirs;
51
+ if (typeof theirs !== "function") return ours;
52
+ return (...args) => {
53
+ ;
54
+ ours(...args);
55
+ return theirs(...args);
56
+ };
57
+ }
58
+ function mergeStyles(ours, theirs) {
59
+ if (typeof ours === "function" || typeof theirs === "function") {
60
+ return (state) => [
61
+ resolveStyle(ours, state),
62
+ resolveStyle(theirs, state)
63
+ ];
64
+ }
65
+ return [ours, theirs];
66
+ }
67
+ function resolveStyle(style, state) {
68
+ return typeof style === "function" ? style(state) : style;
69
+ }
70
+
71
+ // src/system/slot/slot.tsx
72
+ import { cloneElement, forwardRef, isValidElement } from "react";
73
+ var Slot = forwardRef(function Slot2({ children, ...ours }, ref) {
74
+ if (!isValidElement(children)) {
75
+ throw new Error(
76
+ "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."
77
+ );
78
+ }
79
+ const child = children;
80
+ const merged = mergeProps(ours, child.props);
81
+ merged.ref = mergeRefs(ref, refOf(child));
82
+ return cloneElement(child, merged);
83
+ });
84
+ Slot.displayName = "XAUI.Slot";
85
+ function refOf(element) {
86
+ const fromProps = element.props.ref;
87
+ const fromElement = element.ref;
88
+ return fromProps ?? fromElement;
89
+ }
90
+
91
+ // src/system/slot/children-to-string.ts
92
+ import { isValidElement as isValidElement2 } from "react";
93
+ function childrenToString(children) {
94
+ const text = stringify(children);
95
+ return text === null || text === "" ? null : text;
96
+ }
97
+ function stringify(node) {
98
+ if (node === null || node === void 0 || typeof node === "boolean") return "";
99
+ if (typeof node === "string") return node;
100
+ if (typeof node === "number") return String(node);
101
+ if (isValidElement2(node)) return null;
102
+ if (Array.isArray(node)) {
103
+ let text = "";
104
+ for (const child of node) {
105
+ const part = stringify(child);
106
+ if (part === null) return null;
107
+ text += part;
108
+ }
109
+ return text;
110
+ }
111
+ return null;
112
+ }
113
+
114
+ export {
115
+ createSlotContext,
116
+ mergeProps,
117
+ Slot,
118
+ childrenToString
119
+ };
@@ -0,0 +1,9 @@
1
+ // src/utils/warn-dev.ts
2
+ function warnDev(message) {
3
+ if (typeof __DEV__ !== "undefined" && !__DEV__) return;
4
+ console.warn(`XAUI: ${message}`);
5
+ }
6
+
7
+ export {
8
+ warnDev
9
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils/warn-dev.ts
2
+ function warnDev(message) {
3
+ if (typeof __DEV__ !== "undefined" && !__DEV__) return;
4
+ console.warn(`XAUI: ${message}`);
5
+ }
6
+
7
+
8
+
9
+ exports.warnDev = warnDev;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule ? obj : {
8
+ default: obj
9
+ };
10
+ } // src/system/selection-fill/selection-fill.tsx
11
+ var _reactnative = require('react-native');
12
+ var _reactnativereanimated = require('react-native-reanimated');
13
+ var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
14
+ var _jsxruntime = require('react/jsx-runtime');
15
+ var DURATION = 120;
16
+ var FROM_SCALE = 0.8;
17
+ function SelectionFill({
18
+ isVisible,
19
+ style,
20
+ animation = true,
21
+ children
22
+ }) {
23
+ if (!animation) {
24
+ return isVisible ? /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
25
+ style,
26
+ children
27
+ }) : null;
28
+ }
29
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, AnimatedFill, {
30
+ isVisible,
31
+ style,
32
+ children
33
+ });
34
+ }
35
+ SelectionFill.displayName = "XAUI.SelectionFill";
36
+ const _worklet_11674708088880_init_data = {
37
+ code: "function chunkF6CQ6CBICjs1(){const{_reactnativereanimated,isVisible,DURATION}=this.__closure;return _reactnativereanimated.withTiming.call(void 0,isVisible?1:0,{duration:DURATION});}",
38
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-F6CQ6CBI.cjs",
39
+ sourceMap: "{\"version\":3,\"names\":[\"chunkF6CQ6CBICjs1\",\"_reactnativereanimated\",\"isVisible\",\"DURATION\",\"__closure\",\"withTiming\",\"call\",\"duration\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-F6CQ6CBI.cjs\"],\"mappings\":\"AA2BuE,SAAAA,iBAAMA,CAAA,QAAAC,sBAAA,CAAAC,SAAA,CAAAC,QAAA,OAAAC,SAAA,CAEzE,MAAO,CAAAH,sBAAsB,CAACI,UAAU,CAACC,IAAI,CAAC,IAAK,EAAC,CAAEJ,SAAS,CAAG,CAAC,CAAG,CAAC,CAAE,CAAEK,QAAQ,CAAEJ,QAAS,CAAC,CAAC,CAClG\",\"ignoreList\":[]}"
40
+ };
41
+ const _worklet_9756080511809_init_data = {
42
+ code: "function chunkF6CQ6CBICjs2(){const{progress,FROM_SCALE}=this.__closure;return{opacity:progress.value,transform:[{scale:FROM_SCALE+(1-FROM_SCALE)*progress.value}]};}",
43
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-F6CQ6CBI.cjs",
44
+ sourceMap: "{\"version\":3,\"names\":[\"chunkF6CQ6CBICjs2\",\"progress\",\"FROM_SCALE\",\"__closure\",\"opacity\",\"value\",\"transform\",\"scale\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-F6CQ6CBI.cjs\"],\"mappings\":\"AA+B6E,SAAAA,iBAAMA,CAAA,QAAAC,QAAA,CAAAC,UAAA,OAAAC,SAAA,CAE/E,MAAO,CACLC,OAAO,CAAEH,QAAQ,CAACI,KAAK,CACvBC,SAAS,CAAE,CAAC,CAAEC,KAAK,CAAEL,UAAU,CAAG,CAAC,CAAC,CAAGA,UAAU,EAAID,QAAQ,CAACI,KAAM,CAAC,CACvE,CAAC,CACH\",\"ignoreList\":[]}"
45
+ };
46
+ function AnimatedFill({
47
+ isVisible,
48
+ style,
49
+ children
50
+ }) {
51
+ const progress = _reactnativereanimated.useDerivedValue.call(void 0, function chunkF6CQ6CBICjs1Factory({
52
+ _worklet_11674708088880_init_data,
53
+ _reactnativereanimated,
54
+ isVisible,
55
+ DURATION
56
+ }) {
57
+ const _e = [new global.Error(), -4, -27];
58
+ const chunkF6CQ6CBICjs1 = function () {
59
+ return _reactnativereanimated.withTiming.call(void 0, isVisible ? 1 : 0, {
60
+ duration: DURATION
61
+ });
62
+ };
63
+ chunkF6CQ6CBICjs1.__closure = {
64
+ _reactnativereanimated,
65
+ isVisible,
66
+ DURATION
67
+ };
68
+ chunkF6CQ6CBICjs1.__workletHash = 11674708088880;
69
+ chunkF6CQ6CBICjs1.__pluginVersion = "0.7.4";
70
+ chunkF6CQ6CBICjs1.__initData = _worklet_11674708088880_init_data;
71
+ chunkF6CQ6CBICjs1.__stackDetails = _e;
72
+ return chunkF6CQ6CBICjs1;
73
+ }({
74
+ _worklet_11674708088880_init_data,
75
+ _reactnativereanimated,
76
+ isVisible,
77
+ DURATION
78
+ }), [isVisible]);
79
+ const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkF6CQ6CBICjs2Factory({
80
+ _worklet_9756080511809_init_data,
81
+ progress,
82
+ FROM_SCALE
83
+ }) {
84
+ const _e = [new global.Error(), -3, -27];
85
+ const chunkF6CQ6CBICjs2 = function () {
86
+ return {
87
+ opacity: progress.value,
88
+ transform: [{
89
+ scale: FROM_SCALE + (1 - FROM_SCALE) * progress.value
90
+ }]
91
+ };
92
+ };
93
+ chunkF6CQ6CBICjs2.__closure = {
94
+ progress,
95
+ FROM_SCALE
96
+ };
97
+ chunkF6CQ6CBICjs2.__workletHash = 9756080511809;
98
+ chunkF6CQ6CBICjs2.__pluginVersion = "0.7.4";
99
+ chunkF6CQ6CBICjs2.__initData = _worklet_9756080511809_init_data;
100
+ chunkF6CQ6CBICjs2.__stackDetails = _e;
101
+ return chunkF6CQ6CBICjs2;
102
+ }({
103
+ _worklet_9756080511809_init_data,
104
+ progress,
105
+ FROM_SCALE
106
+ }), [progress]);
107
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
108
+ style: [style, animatedStyle],
109
+ children
110
+ });
111
+ }
112
+ exports.SelectionFill = SelectionFill;
@@ -0,0 +1,42 @@
1
+ import {
2
+ warnDev
3
+ } from "./chunk-EGLLDKN6.js";
4
+
5
+ // src/hooks/use-controllable-state.ts
6
+ import { useCallback, useRef, useState } from "react";
7
+ function useControllableState({
8
+ value,
9
+ defaultValue,
10
+ onChange
11
+ }) {
12
+ const [uncontrolled, setUncontrolled] = useState(defaultValue);
13
+ const isControlled = value !== void 0;
14
+ const current = isControlled ? value : uncontrolled;
15
+ useControlWarning(isControlled);
16
+ const latest = useRef(current);
17
+ latest.current = current;
18
+ const onChangeRef = useRef(onChange);
19
+ onChangeRef.current = onChange;
20
+ const controlled = useRef(isControlled);
21
+ controlled.current = isControlled;
22
+ const set = useCallback((next) => {
23
+ const resolved = typeof next === "function" ? next(latest.current) : next;
24
+ if (resolved === latest.current) return;
25
+ if (!controlled.current) setUncontrolled(resolved);
26
+ onChangeRef.current?.(resolved);
27
+ }, []);
28
+ return [current, set];
29
+ }
30
+ function useControlWarning(isControlled) {
31
+ const wasControlled = useRef(isControlled);
32
+ if (wasControlled.current !== isControlled) {
33
+ warnDev(
34
+ `a component switched from ${wasControlled.current ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Decide for the life of the component: pass \`value\` always, or never. Passing \`undefined\` for a value you do control reads as "uncontrolled" here.`
35
+ );
36
+ wasControlled.current = isControlled;
37
+ }
38
+ }
39
+
40
+ export {
41
+ useControllableState
42
+ };
@@ -0,0 +1,174 @@
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 _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
4
+
5
+ // src/system/recipe/resolve-tint.ts
6
+ var TINT_SLICE_BY_SUFFIX = [
7
+ [/SoftForeground$/, "softForeground"],
8
+ [/SoftPressed$/, "softPressed"],
9
+ [/Soft$/, "soft"],
10
+ [/Foreground$/, "foreground"],
11
+ [/Pressed$/, "pressed"]
12
+ ];
13
+ function tintSliceFor(token) {
14
+ for (const [suffix, slice] of TINT_SLICE_BY_SUFFIX) {
15
+ if (suffix.test(token)) return slice;
16
+ }
17
+ return "base";
18
+ }
19
+ function resolveTint(tokens, color, theme) {
20
+ const tint = _chunk57SJ4LJFcjs.deriveTint.call(void 0, color, theme);
21
+ const colors = {};
22
+ for (const [role, token] of Object.entries(_nullishCoalesce(tokens, () => ( {})))) {
23
+ colors[role] = tint[tintSliceFor(token)];
24
+ }
25
+ return colors;
26
+ }
27
+
28
+ // src/system/recipe/style-cache.ts
29
+ var _reactnative = require('react-native');
30
+
31
+ // src/system/recipe/variant-map.ts
32
+ var STATE_ORDER = ["focused", "pressed", "disabled"];
33
+ function resolveSelection(defaultVariants, selection) {
34
+ const resolved = { ...defaultVariants };
35
+ for (const [axis, value] of Object.entries(_nullishCoalesce(selection, () => ( {})))) {
36
+ if (value !== void 0) resolved[axis] = value;
37
+ }
38
+ return resolved;
39
+ }
40
+ function resolveVariantColors(tokens, theme) {
41
+ const colors = {};
42
+ for (const [role, token] of entriesOf(tokens)) {
43
+ const value = theme.colors[token];
44
+ if (value === void 0) {
45
+ throw new Error(
46
+ `XAUI: the recipe names "${token}" for its "${role}" role, but the theme has no such colour token. Check the spelling against XAUIColors.`
47
+ );
48
+ }
49
+ colors[role] = value;
50
+ }
51
+ return colors;
52
+ }
53
+ function activeStateFns(states, active) {
54
+ const fns = [];
55
+ for (const state of STATE_ORDER) {
56
+ const fn = active[state] ? _optionalChain([states, 'optionalAccess', _ => _[state]]) : void 0;
57
+ if (fn) fns.push(fn);
58
+ }
59
+ return fns;
60
+ }
61
+ function collectStyleFns(config, selection, states) {
62
+ const fns = [];
63
+ if (config.base) fns.push(config.base);
64
+ if (config.paint) fns.push(config.paint);
65
+ for (const [axis, values] of Object.entries(_nullishCoalesce(config.variants, () => ( {})))) {
66
+ const value = selection[axis];
67
+ const fn = value === void 0 ? void 0 : values[value];
68
+ if (fn) fns.push(fn);
69
+ }
70
+ for (const compound of _nullishCoalesce(config.compoundVariants, () => ( []))) {
71
+ if (appliesTo(compound.when, selection)) fns.push(compound.style);
72
+ }
73
+ return [...fns, ...activeStateFns(config.states, states)];
74
+ }
75
+ function appliesTo(when, selection) {
76
+ return Object.entries(when).every(([axis, value]) => selection[axis] === value);
77
+ }
78
+ function entriesOf(tokens) {
79
+ return Object.entries(_nullishCoalesce(tokens, () => ( {})));
80
+ }
81
+
82
+ // src/system/recipe/style-cache.ts
83
+ function createStyleCache(slots) {
84
+ const entries = /* @__PURE__ */ new Map();
85
+ return {
86
+ read(key, build) {
87
+ const hit = entries.get(key);
88
+ if (hit) return hit;
89
+ const built = build();
90
+ const complete = {};
91
+ for (const slot of slots) complete[slot] = _nullishCoalesce(built[slot], () => ( {}));
92
+ const created = _reactnative.StyleSheet.create(complete);
93
+ entries.set(key, created);
94
+ return created;
95
+ },
96
+ get size() {
97
+ return entries.size;
98
+ },
99
+ clear() {
100
+ entries.clear();
101
+ }
102
+ };
103
+ }
104
+ function cacheKey(theme, selection, states) {
105
+ const axes = Object.keys(selection).sort().map((axis) => `${axis}:${_nullishCoalesce(selection[axis], () => ( "-"))}`).join("|");
106
+ const active = STATE_ORDER.filter((state) => states[state]).join(",");
107
+ return `${theme.id}|${theme.mode}|${axes}|${active}`;
108
+ }
109
+
110
+ // src/system/recipe/create-recipe.ts
111
+ function createRecipe(config) {
112
+ const cache = createStyleCache(config.slots);
113
+ const tokensFor = (variant) => variant === void 0 ? void 0 : _optionalChain([config, 'access', _2 => _2.variantTokens, 'optionalAccess', _3 => _3[variant]]);
114
+ return {
115
+ slots: config.slots,
116
+ resolve({ theme, selection, states = {} }) {
117
+ const resolved = resolveSelection(config.defaultVariants, selection);
118
+ return cache.read(cacheKey(theme, resolved, states), () => {
119
+ const colors = resolveVariantColors(tokensFor(resolved.variant), theme);
120
+ return apply(collectStyleFns(config, resolved, states), theme, colors);
121
+ });
122
+ },
123
+ tint({ theme, color, selection, states = {} }) {
124
+ if (!config.paint) return {};
125
+ const resolved = resolveSelection(config.defaultVariants, selection);
126
+ const tokens = tokensFor(resolved.variant);
127
+ if (!tokens) return {};
128
+ const colors = resolveTint(tokens, color, theme);
129
+ const fns = [config.paint, ...activeStateFns(config.states, states)];
130
+ return apply(fns, theme, colors);
131
+ }
132
+ };
133
+ }
134
+ function apply(fns, theme, colors) {
135
+ const merged = {};
136
+ for (const fn of fns) {
137
+ const produced = fn(theme, colors);
138
+ for (const slot of Object.keys(produced)) {
139
+ const style = produced[slot];
140
+ if (!style) continue;
141
+ const previous = merged[slot];
142
+ merged[slot] = previous ? { ...previous, ...style } : style;
143
+ }
144
+ }
145
+ return merged;
146
+ }
147
+
148
+ // src/system/recipe/radius-axis.ts
149
+ function radiusAxis(...slots) {
150
+ const axis = {};
151
+ for (const key of RADIUS_KEYS) {
152
+ axis[key] = (theme) => Object.fromEntries(
153
+ slots.map((slot) => [slot, { borderRadius: theme.radius[key] }])
154
+ );
155
+ }
156
+ return axis;
157
+ }
158
+ var RADIUS_KEYS = [
159
+ "xs",
160
+ "sm",
161
+ "md",
162
+ "lg",
163
+ "xl",
164
+ "2xl",
165
+ "3xl",
166
+ "4xl",
167
+ "field",
168
+ "full"
169
+ ];
170
+
171
+
172
+
173
+
174
+ exports.createRecipe = createRecipe; exports.radiusAxis = radiusAxis;