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

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 (203) 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-G7P3ERYF.cjs +478 -0
  46. package/dist/chunk-GA6PBWNT.js +147 -0
  47. package/dist/chunk-GFUZ3MUT.cjs +455 -0
  48. package/dist/chunk-GGW43Q37.cjs +1 -0
  49. package/dist/chunk-GTR5X65M.cjs +27 -0
  50. package/dist/chunk-H4E4HDEP.cjs +13 -0
  51. package/dist/chunk-H7DS4IO7.js +198 -0
  52. package/dist/chunk-HDVVZG4S.cjs +198 -0
  53. package/dist/chunk-IKJVLJKT.js +151 -0
  54. package/dist/chunk-J3MB4PI5.cjs +531 -0
  55. package/dist/chunk-K72UDPVN.js +119 -0
  56. package/dist/chunk-KCMYU7WF.js +86 -0
  57. package/dist/chunk-LRN3RNDO.js +940 -0
  58. package/dist/chunk-LTX6TB5I.js +124 -0
  59. package/dist/chunk-LUPCPLND.cjs +145 -0
  60. package/dist/chunk-M63GFNKV.js +194 -0
  61. package/dist/chunk-N3KTZMPG.js +293 -0
  62. package/dist/chunk-NCTOTTVW.js +13 -0
  63. package/dist/chunk-NWGLP6JX.cjs +410 -0
  64. package/dist/chunk-R73XQK7X.cjs +314 -0
  65. package/dist/chunk-RU7JCMWC.cjs +881 -0
  66. package/dist/chunk-SNIHUKDA.cjs +184 -0
  67. package/dist/chunk-T5FV5F7A.cjs +607 -0
  68. package/dist/chunk-TDTUAIFF.cjs +153 -0
  69. package/dist/chunk-TJ74XVZN.cjs +431 -0
  70. package/dist/chunk-TK44VBIE.cjs +194 -0
  71. package/dist/chunk-UAWBAD4E.cjs +346 -0
  72. package/dist/chunk-UFTCTTKK.js +381 -0
  73. package/dist/chunk-WDDXU3OH.cjs +67 -0
  74. package/dist/chunk-WFEMJCXO.cjs +13 -0
  75. package/dist/chunk-WHJTBTYM.js +0 -0
  76. package/dist/{chunk-2KXQATVL.js → chunk-WKCQ6VGW.js} +59 -55
  77. package/dist/chunk-XFPQFCEK.js +455 -0
  78. package/dist/chunk-XSQPVDFH.cjs +60 -0
  79. package/dist/chunk-XTC2SLFT.js +153 -0
  80. package/dist/chunk-XV735BSA.cjs +366 -0
  81. package/dist/chunk-XWNG2U4K.cjs +124 -0
  82. package/dist/chunk-YGYYJ3LQ.js +314 -0
  83. package/dist/chunk-YVHT2UVW.js +74 -0
  84. package/dist/chunk-ZFOOJK37.cjs +86 -0
  85. package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
  86. package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
  87. package/dist/components/accordion/index.cjs +35 -0
  88. package/dist/components/accordion/index.d.cts +299 -0
  89. package/dist/components/accordion/index.d.ts +299 -0
  90. package/dist/components/accordion/index.js +35 -0
  91. package/dist/components/alert/index.cjs +20 -0
  92. package/dist/components/alert/index.d.cts +169 -0
  93. package/dist/components/alert/index.d.ts +169 -0
  94. package/dist/components/alert/index.js +20 -0
  95. package/dist/components/avatar/index.cjs +16 -0
  96. package/dist/components/avatar/index.d.cts +131 -0
  97. package/dist/components/avatar/index.d.ts +131 -0
  98. package/dist/components/avatar/index.js +16 -0
  99. package/dist/components/badge/index.cjs +15 -0
  100. package/dist/components/badge/index.d.cts +157 -0
  101. package/dist/components/badge/index.d.ts +157 -0
  102. package/dist/components/badge/index.js +15 -0
  103. package/dist/components/button/index.cjs +22 -0
  104. package/dist/components/button/index.d.cts +613 -0
  105. package/dist/components/button/index.d.ts +613 -0
  106. package/dist/components/button/index.js +22 -0
  107. package/dist/components/card/index.cjs +22 -0
  108. package/dist/components/card/index.d.cts +620 -0
  109. package/dist/components/card/index.d.ts +620 -0
  110. package/dist/components/card/index.js +22 -0
  111. package/dist/components/checkbox/index.cjs +26 -0
  112. package/dist/components/checkbox/index.d.cts +1136 -0
  113. package/dist/components/checkbox/index.d.ts +1136 -0
  114. package/dist/components/checkbox/index.js +26 -0
  115. package/dist/components/chip/index.cjs +20 -0
  116. package/dist/components/chip/index.d.cts +608 -0
  117. package/dist/components/chip/index.d.ts +608 -0
  118. package/dist/components/chip/index.js +20 -0
  119. package/dist/components/divider/index.cjs +13 -0
  120. package/dist/components/divider/index.d.cts +117 -0
  121. package/dist/components/divider/index.d.ts +117 -0
  122. package/dist/components/divider/index.js +13 -0
  123. package/dist/components/field-group/index.cjs +27 -0
  124. package/dist/components/field-group/index.d.cts +270 -0
  125. package/dist/components/field-group/index.d.ts +270 -0
  126. package/dist/components/field-group/index.js +27 -0
  127. package/dist/components/input-otp/index.cjs +29 -0
  128. package/dist/components/input-otp/index.d.cts +325 -0
  129. package/dist/components/input-otp/index.d.ts +325 -0
  130. package/dist/components/input-otp/index.js +29 -0
  131. package/dist/components/menu/index.cjs +49 -0
  132. package/dist/components/menu/index.d.cts +351 -0
  133. package/dist/components/menu/index.d.ts +351 -0
  134. package/dist/components/menu/index.js +49 -0
  135. package/dist/components/popover/index.cjs +38 -0
  136. package/dist/components/popover/index.d.cts +254 -0
  137. package/dist/components/popover/index.d.ts +254 -0
  138. package/dist/components/popover/index.js +38 -0
  139. package/dist/components/radio/index.cjs +26 -0
  140. package/dist/components/radio/index.d.cts +1102 -0
  141. package/dist/components/radio/index.d.ts +1102 -0
  142. package/dist/components/radio/index.js +26 -0
  143. package/dist/components/select/index.cjs +50 -0
  144. package/dist/components/select/index.d.cts +498 -0
  145. package/dist/components/select/index.d.ts +498 -0
  146. package/dist/components/select/index.js +50 -0
  147. package/dist/components/skeleton/index.cjs +11 -0
  148. package/dist/components/skeleton/index.d.cts +111 -0
  149. package/dist/components/skeleton/index.d.ts +111 -0
  150. package/dist/components/skeleton/index.js +11 -0
  151. package/dist/components/spinner/index.cjs +17 -0
  152. package/dist/components/spinner/index.d.cts +104 -0
  153. package/dist/components/spinner/index.d.ts +104 -0
  154. package/dist/components/spinner/index.js +17 -0
  155. package/dist/components/switch/index.cjs +27 -0
  156. package/dist/components/switch/index.d.cts +1154 -0
  157. package/dist/components/switch/index.d.ts +1154 -0
  158. package/dist/components/switch/index.js +27 -0
  159. package/dist/components/text-area/index.cjs +14 -0
  160. package/dist/components/text-area/index.d.cts +73 -0
  161. package/dist/components/text-area/index.d.ts +73 -0
  162. package/dist/components/text-area/index.js +14 -0
  163. package/dist/components/text-field/index.cjs +25 -0
  164. package/dist/components/text-field/index.d.cts +205 -0
  165. package/dist/components/text-field/index.d.ts +205 -0
  166. package/dist/components/text-field/index.js +25 -0
  167. package/dist/components/typography/index.cjs +15 -0
  168. package/dist/components/typography/index.d.cts +116 -0
  169. package/dist/components/typography/index.d.ts +116 -0
  170. package/dist/components/typography/index.js +15 -0
  171. package/dist/components/view/index.cjs +17 -0
  172. package/dist/components/view/index.d.cts +152 -0
  173. package/dist/components/view/index.d.ts +152 -0
  174. package/dist/components/view/index.js +17 -0
  175. package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
  176. package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
  177. package/dist/icon.type-Kml72iSz.d.ts +73 -0
  178. package/dist/icon.type-d_i9ma-i.d.cts +73 -0
  179. package/dist/index.cjs +400 -4
  180. package/dist/index.d.cts +118 -4
  181. package/dist/index.d.ts +118 -4
  182. package/dist/index.js +423 -27
  183. package/dist/placement-DHa0Rrh1.d.cts +38 -0
  184. package/dist/placement-DHa0Rrh1.d.ts +38 -0
  185. package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
  186. package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
  187. package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
  188. package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
  189. package/dist/system/index.cjs +73 -4
  190. package/dist/system/index.d.cts +379 -193
  191. package/dist/system/index.d.ts +379 -193
  192. package/dist/system/index.js +87 -18
  193. package/dist/text-field.type-0l73acce.d.ts +167 -0
  194. package/dist/text-field.type-DBh06DU5.d.cts +167 -0
  195. package/dist/theme/index.cjs +5 -3
  196. package/dist/theme/index.d.cts +55 -24
  197. package/dist/theme/index.d.ts +55 -24
  198. package/dist/theme/index.js +4 -2
  199. package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
  200. package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
  201. package/package.json +254 -18
  202. package/dist/chunk-ECDWSSHJ.js +0 -688
  203. package/dist/chunk-IYFGO523.cjs +0 -688
@@ -0,0 +1,54 @@
1
+ // src/hooks/use-previous.ts
2
+ import { useEffect, useRef } from "react";
3
+ function usePrevious(value) {
4
+ const previous = useRef(void 0);
5
+ useEffect(() => {
6
+ previous.current = value;
7
+ }, [value]);
8
+ return previous.current;
9
+ }
10
+
11
+ // src/hooks/use-rotation.ts
12
+ import { useEffect as useEffect2 } from "react";
13
+ import { Easing, cancelAnimation, useAnimatedStyle, useSharedValue, withRepeat, withTiming } from "react-native-reanimated";
14
+ var ROTATION_DURATION = 900;
15
+ const _worklet_6356758416325_init_data = {
16
+ code: "function chunk3GFRSZYRJs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
17
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-3GFRSZYR.js",
18
+ sourceMap: "{\"version\":3,\"names\":[\"chunk3GFRSZYRJs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-3GFRSZYR.js\"],\"mappings\":\"AA+B0B,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\":[]}"
19
+ };
20
+ function useRotation() {
21
+ const angle = useSharedValue(0);
22
+ useEffect2(() => {
23
+ angle.value = withRepeat(withTiming(360, {
24
+ duration: ROTATION_DURATION,
25
+ easing: Easing.linear
26
+ }), -1, false);
27
+ return () => cancelAnimation(angle);
28
+ }, [angle]);
29
+ return useAnimatedStyle(function chunk3GFRSZYRJs1Factory({
30
+ _worklet_6356758416325_init_data,
31
+ angle
32
+ }) {
33
+ const _e = [new global.Error(), -2, -27];
34
+ const chunk3GFRSZYRJs1 = function () {
35
+ return {
36
+ transform: [{
37
+ rotate: `${angle.value}deg`
38
+ }]
39
+ };
40
+ };
41
+ chunk3GFRSZYRJs1.__closure = {
42
+ angle
43
+ };
44
+ chunk3GFRSZYRJs1.__workletHash = 6356758416325;
45
+ chunk3GFRSZYRJs1.__pluginVersion = "0.7.4";
46
+ chunk3GFRSZYRJs1.__initData = _worklet_6356758416325_init_data;
47
+ chunk3GFRSZYRJs1.__stackDetails = _e;
48
+ return chunk3GFRSZYRJs1;
49
+ }({
50
+ _worklet_6356758416325_init_data,
51
+ angle
52
+ }), [angle]);
53
+ }
54
+ export { usePrevious, ROTATION_DURATION, useRotation };
@@ -0,0 +1,21 @@
1
+ // src/hooks/use-press-state.ts
2
+ import { useCallback, useRef, useState } from "react";
3
+ function usePressState(handlers = {}) {
4
+ const [isPressed, setIsPressed] = useState(false);
5
+ const latest = useRef(handlers);
6
+ latest.current = handlers;
7
+ const onPressIn = useCallback((event) => {
8
+ setIsPressed(true);
9
+ latest.current.onPressIn?.(event);
10
+ }, []);
11
+ const onPressOut = useCallback((event) => {
12
+ setIsPressed(false);
13
+ latest.current.onPressOut?.(event);
14
+ }, []);
15
+ const press = useRef({ onPressIn, onPressOut }).current;
16
+ return [isPressed, press];
17
+ }
18
+
19
+ export {
20
+ usePressState
21
+ };
@@ -0,0 +1,92 @@
1
+ import {
2
+ createRecipe
3
+ } from "./chunk-4GTAZM2C.js";
4
+ import {
5
+ useXAUITheme
6
+ } from "./chunk-A3EGFI6T.js";
7
+ import {
8
+ Slot
9
+ } from "./chunk-K72UDPVN.js";
10
+ import {
11
+ useStyleProps
12
+ } from "./chunk-M63GFNKV.js";
13
+
14
+ // src/components/divider/divider.tsx
15
+ import { forwardRef } from "react";
16
+ import { View } from "react-native";
17
+
18
+ // src/components/divider/divider.recipe.ts
19
+ import { StyleSheet } from "react-native";
20
+ var SLOTS = ["root"];
21
+ var VARIANT_TOKENS = { default: { bg: "separator" } };
22
+ var HAIRLINE = StyleSheet.hairlineWidth;
23
+ function thickness(of) {
24
+ return (theme) => {
25
+ const value = of(theme);
26
+ return { root: { height: value, width: value } };
27
+ };
28
+ }
29
+ var dividerRecipe = createRecipe({
30
+ slots: SLOTS,
31
+ base: () => ({
32
+ // One line for both orientations. In a column the cross axis is horizontal, so a
33
+ // stretched child is full width; in a row it is vertical, so the same word makes a
34
+ // vertical rule full height. `stretch` is ignored on the axis the thickness fixes,
35
+ // which is what lets one declaration serve both.
36
+ root: { alignSelf: "stretch" }
37
+ }),
38
+ variantTokens: VARIANT_TOKENS,
39
+ paint: (_theme, colors) => ({ root: { backgroundColor: colors.bg } }),
40
+ variants: {
41
+ // Multiples of `borderWidth.default`, so a theme that thickens its edges thickens
42
+ // these with it. Only the hairline stands outside the scale, being a device pixel.
43
+ size: {
44
+ xs: thickness(() => HAIRLINE),
45
+ sm: thickness((theme) => theme.borderWidth.default),
46
+ md: thickness((theme) => theme.borderWidth.default * 2),
47
+ lg: thickness((theme) => theme.borderWidth.default * 6)
48
+ },
49
+ /** Second, so it releases the axis `size` had to write blind. */
50
+ orientation: {
51
+ horizontal: () => ({ root: { width: "auto" } }),
52
+ vertical: () => ({ root: { height: "auto" } })
53
+ }
54
+ },
55
+ /**
56
+ * `xs` where every other component defaults to `md`, and it is the one place in the
57
+ * library that departs from that: a rule you notice is a rule that is too thick, and
58
+ * the hairline is what a separator is at rest.
59
+ *
60
+ * `variant` is named here and nowhere else — there is one, the caller cannot choose it,
61
+ * and the recipe still needs it selected for `paint` and the tint to resolve.
62
+ */
63
+ defaultVariants: { variant: "default", size: "xs", orientation: "horizontal" }
64
+ });
65
+
66
+ // src/components/divider/divider.tsx
67
+ import { jsx } from "react/jsx-runtime";
68
+ var Divider = forwardRef(function Divider2({ children, orientation, size, color, asChild = false, style, ...props }, ref) {
69
+ const theme = useXAUITheme();
70
+ const [styleProps, rest] = useStyleProps(props);
71
+ const selection = { orientation, size };
72
+ const styles = dividerRecipe.resolve({ theme, selection });
73
+ const tint = color ? dividerRecipe.tint({ theme, color, selection }) : void 0;
74
+ const Root = asChild ? Slot : View;
75
+ return /* @__PURE__ */ jsx(
76
+ Root,
77
+ {
78
+ ref,
79
+ accessibilityElementsHidden: true,
80
+ importantForAccessibility: "no",
81
+ ...rest,
82
+ style: [styles.root, tint?.root, styleProps, style],
83
+ children: asChild ? children : null
84
+ }
85
+ );
86
+ });
87
+ Divider.displayName = "XAUI.Divider";
88
+
89
+ export {
90
+ dividerRecipe,
91
+ Divider
92
+ };
@@ -0,0 +1,174 @@
1
+ import {
2
+ deriveTint
3
+ } from "./chunk-A3EGFI6T.js";
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 = deriveTint(color, theme);
21
+ const colors = {};
22
+ for (const [role, token] of Object.entries(tokens ?? {})) {
23
+ colors[role] = tint[tintSliceFor(token)];
24
+ }
25
+ return colors;
26
+ }
27
+
28
+ // src/system/recipe/style-cache.ts
29
+ import { StyleSheet } from "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(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] ? states?.[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(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 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(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] = built[slot] ?? {};
92
+ const created = 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}:${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 : config.variantTokens?.[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
+ export {
172
+ createRecipe,
173
+ radiusAxis
174
+ };
@@ -0,0 +1,89 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
4
+
5
+
6
+ var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
7
+
8
+ // src/system/icon/chevron-down-icon.tsx
9
+ var _reactnativesvg = require('react-native-svg');
10
+ var _jsxruntime = require('react/jsx-runtime');
11
+ function ChevronDownIcon({
12
+ size = 20,
13
+ color = "currentColor"
14
+ }) {
15
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativesvg.Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
16
+ _reactnativesvg.Path,
17
+ {
18
+ d: "m6 9 6 6 6-6",
19
+ stroke: color,
20
+ strokeWidth: 2,
21
+ strokeLinecap: "round",
22
+ strokeLinejoin: "round"
23
+ }
24
+ ) });
25
+ }
26
+ ChevronDownIcon.displayName = "XAUI.ChevronDownIcon";
27
+
28
+ // src/system/icon/icon-context.ts
29
+ var _react = require('react');
30
+ var IconContext = _react.createContext.call(void 0, {});
31
+ IconContext.displayName = "XAUI.Icon.Context";
32
+ function useIconContext() {
33
+ return _react.useContext.call(void 0, IconContext);
34
+ }
35
+
36
+ // src/system/icon/icon.tsx
37
+
38
+ var _reactnative = require('react-native');
39
+
40
+ function Icon(props) {
41
+ const inherited = useIconContext();
42
+ const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
43
+ const size = _nullishCoalesce(_nullishCoalesce(props.size, () => ( inherited.size)), () => ( theme.fontSizes.md));
44
+ const color = _nullishCoalesce(_nullishCoalesce(props.color, () => ( inherited.color)), () => ( theme.colors.foreground));
45
+ if (props.as) {
46
+ const Component = props.as;
47
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component, { size, color });
48
+ }
49
+ if (_react.isValidElement.call(void 0, props.children)) {
50
+ return _react.cloneElement.call(void 0, props.children, {
51
+ width: size,
52
+ height: size,
53
+ color
54
+ });
55
+ }
56
+ if (props.source) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, IconImage, { ...props, resolved: { size, color } });
57
+ throw new Error(
58
+ "XAUI: Icon needs one of `as` (an icon component), a raw SVG element as its child, or `source` (an image). It renders nothing on its own."
59
+ );
60
+ }
61
+ Icon.displayName = "XAUI.Icon";
62
+ function IconImage({
63
+ source,
64
+ style,
65
+ resolved,
66
+ size: _size,
67
+ color: _color,
68
+ ...props
69
+ }) {
70
+ const [styleProps] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
71
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
72
+ _reactnative.Image,
73
+ {
74
+ source,
75
+ style: [
76
+ { width: resolved.size, height: resolved.size, tintColor: resolved.color },
77
+ styleProps,
78
+ style
79
+ ]
80
+ }
81
+ );
82
+ }
83
+
84
+
85
+
86
+
87
+
88
+
89
+ exports.ChevronDownIcon = ChevronDownIcon; exports.IconContext = IconContext; exports.useIconContext = useIconContext; exports.Icon = Icon;
@@ -107,7 +107,10 @@ function deriveTint(tint, theme) {
107
107
  foreground,
108
108
  soft: alpha(tint, 0.15),
109
109
  softForeground: mix(tint, theme.colors.foreground, 0.2),
110
- pressed: mix(tint, foreground, 0.1),
110
+ // Towards the mode's ink, not the tint's own foreground — the same single direction
111
+ // the token layer takes (P2-API-REVIEW §E). A raw tint has to behave like `accent`
112
+ // under the finger as much as it does at rest.
113
+ pressed: mix(tint, theme.colors.foreground, 0.1),
111
114
  softPressed: alpha(tint, 0.2)
112
115
  };
113
116
  cache.set(key, derived);
@@ -122,4 +125,6 @@ function deriveTint(tint, theme) {
122
125
 
123
126
 
124
127
 
125
- exports.ThemeContext = ThemeContext; exports.useXAUITheme = useXAUITheme; exports.useColorMode = useColorMode; exports.useThemeColor = useThemeColor; exports.mix = mix; exports.alpha = alpha; exports.deriveTint = deriveTint;
128
+
129
+
130
+ exports.ThemeContext = ThemeContext; exports.useXAUITheme = useXAUITheme; exports.useColorMode = useColorMode; exports.useThemeColor = useThemeColor; exports.isHex = isHex; exports.mix = mix; exports.alpha = alpha; exports.contrastOn = contrastOn; exports.deriveTint = deriveTint;