@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
@@ -0,0 +1,303 @@
1
+ import {
2
+ stableHash
3
+ } from "./chunk-GGW42MY4.js";
4
+
5
+ // src/system/style-props/use-style-props.ts
6
+ import { useMemo } from "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 = stableHash(styleProps);
174
+ return [useMemo(() => styleProps, [key]), rest];
175
+ }
176
+
177
+ // src/system/slot/children-to-string.ts
178
+ import { isValidElement } from "react";
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 (isValidElement(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
+ import { createContext, useContext } from "react";
202
+ function createSlotContext(name) {
203
+ const Context = createContext(null);
204
+ Context.displayName = `XAUI.${name}.Context`;
205
+ function useSlotContext() {
206
+ const value = useContext(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
+ Error.captureStackTrace?.(
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
+ import { cloneElement, forwardRef, isValidElement as isValidElement2 } from "react";
278
+ var Slot = forwardRef(function Slot2({ children, ...ours }, ref) {
279
+ if (!isValidElement2(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 cloneElement(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 fromProps ?? fromElement;
294
+ }
295
+
296
+ export {
297
+ useStyleProps,
298
+ childrenToString,
299
+ createSlotContext,
300
+ mergeRefs,
301
+ mergeProps,
302
+ Slot
303
+ };
@@ -0,0 +1,20 @@
1
+ // src/utils/stable-hash.ts
2
+ function canonical(value) {
3
+ if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
4
+ if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
5
+ 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)}`);
6
+ return `{${entries.join(",")}}`;
7
+ }
8
+ function stableHash(value) {
9
+ const input = canonical(value);
10
+ let hash = 2166136261;
11
+ for (let i = 0; i < input.length; i++) {
12
+ hash ^= input.charCodeAt(i);
13
+ hash = Math.imul(hash, 16777619) >>> 0;
14
+ }
15
+ return hash.toString(36);
16
+ }
17
+
18
+ export {
19
+ stableHash
20
+ };
@@ -0,0 +1,143 @@
1
+ import {
2
+ Slot,
3
+ useStyleProps
4
+ } from "./chunk-EXX6ATAS.js";
5
+
6
+ // src/components/view/grid.tsx
7
+ import { Children, forwardRef, useMemo, useState } from "react";
8
+ import { View } from "react-native";
9
+
10
+ // src/components/view/grid.context.ts
11
+ import { createContext, useContext } from "react";
12
+ var GridContext = createContext(null);
13
+ var GridProvider = GridContext.Provider;
14
+ function useGrid() {
15
+ const value = useContext(GridContext);
16
+ if (value === null) {
17
+ throw new Error(
18
+ "XAUI: Grid.Item must be rendered inside a Grid \u2014 it spans that grid\u2019s columns, and outside one there is nothing to span."
19
+ );
20
+ }
21
+ return value;
22
+ }
23
+ function spanWidth({ cellWidth, columns, gap }, span) {
24
+ const clamped = Math.min(Math.max(Math.floor(span), 1), columns);
25
+ if (cellWidth === void 0) return `${100 / columns * clamped}%`;
26
+ return cellWidth * clamped + gap * (clamped - 1);
27
+ }
28
+
29
+ // src/components/view/grid.tsx
30
+ import { jsx } from "react/jsx-runtime";
31
+ var GridRoot = forwardRef(function Grid({ children, columns = 2, gap = 0, style, onLayout, ...props }, ref) {
32
+ const [width, setWidth] = useState();
33
+ const [styleProps, rest] = useStyleProps(props);
34
+ const safeColumns = Math.max(Math.floor(columns), 1);
35
+ const cellWidth = width === void 0 ? void 0 : (width - gap * (safeColumns - 1)) / safeColumns;
36
+ const context = useMemo(
37
+ () => ({ cellWidth, columns: safeColumns, gap }),
38
+ [cellWidth, safeColumns, gap]
39
+ );
40
+ const handleLayout = (event) => {
41
+ const next = event.nativeEvent.layout.width;
42
+ if (next > 0 && next !== width) setWidth(next);
43
+ onLayout?.(event);
44
+ };
45
+ return /* @__PURE__ */ jsx(GridProvider, { value: context, children: /* @__PURE__ */ jsx(
46
+ View,
47
+ {
48
+ ref,
49
+ onLayout: handleLayout,
50
+ style: [
51
+ { flexDirection: "row", flexWrap: "wrap", rowGap: gap, columnGap: gap },
52
+ styleProps,
53
+ style
54
+ ],
55
+ ...rest,
56
+ children: Children.map(
57
+ children,
58
+ (child) => isGridItem(child) ? child : /* @__PURE__ */ jsx(View, { style: { width: spanWidth(context, 1) }, children: child })
59
+ )
60
+ }
61
+ ) });
62
+ });
63
+ GridRoot.displayName = "XAUI.Grid";
64
+ function isGridItem(child) {
65
+ if (child === null || typeof child !== "object") return false;
66
+ const type = child.type;
67
+ return type?.displayName === "XAUI.Grid.Item";
68
+ }
69
+
70
+ // src/components/view/grid-item.tsx
71
+ import { forwardRef as forwardRef2 } from "react";
72
+ import { View as View2 } from "react-native";
73
+ import { jsx as jsx2 } from "react/jsx-runtime";
74
+ var GridItem = forwardRef2(function GridItem2({ children, span = 1, style, ...props }, ref) {
75
+ const grid = useGrid();
76
+ const [styleProps, rest] = useStyleProps(props);
77
+ return /* @__PURE__ */ jsx2(
78
+ View2,
79
+ {
80
+ ref,
81
+ style: [{ width: spanWidth(grid, span) }, styleProps, style],
82
+ ...rest,
83
+ children
84
+ }
85
+ );
86
+ });
87
+ GridItem.displayName = "XAUI.Grid.Item";
88
+
89
+ // src/components/view/stack.tsx
90
+ import { forwardRef as forwardRef3 } from "react";
91
+ import { View as View3 } from "react-native";
92
+ import { jsx as jsx3 } from "react/jsx-runtime";
93
+ var StackRoot = forwardRef3(function Stack({ children, asChild = false, style, ...props }, ref) {
94
+ const [styleProps, rest] = useStyleProps(props);
95
+ const Root = asChild ? Slot : View3;
96
+ return /* @__PURE__ */ jsx3(Root, { ref, style: [{ position: "relative" }, styleProps, style], ...rest, children });
97
+ });
98
+ StackRoot.displayName = "XAUI.Stack";
99
+
100
+ // src/components/view/stack-item.tsx
101
+ import { forwardRef as forwardRef4 } from "react";
102
+ import { View as View4 } from "react-native";
103
+ import { jsx as jsx4 } from "react/jsx-runtime";
104
+ var StackItem = forwardRef4(function StackItem2({ children, asChild = false, style, ...props }, ref) {
105
+ const [styleProps, rest] = useStyleProps(props);
106
+ const Root = asChild ? Slot : View4;
107
+ return /* @__PURE__ */ jsx4(Root, { ref, style: [{ position: "absolute" }, styleProps, style], ...rest, children });
108
+ });
109
+ StackItem.displayName = "XAUI.Stack.Item";
110
+
111
+ // src/components/view/row.tsx
112
+ import { forwardRef as forwardRef5 } from "react";
113
+ import { View as View5 } from "react-native";
114
+ import { jsx as jsx5 } from "react/jsx-runtime";
115
+ var Row = forwardRef5(function Row2({ children, asChild = false, style, ...props }, ref) {
116
+ const [styleProps, rest] = useStyleProps(props);
117
+ const Root = asChild ? Slot : View5;
118
+ return /* @__PURE__ */ jsx5(Root, { ref, style: [{ flexDirection: "row" }, styleProps, style], ...rest, children });
119
+ });
120
+ Row.displayName = "XAUI.Row";
121
+
122
+ // src/components/view/column.tsx
123
+ import { forwardRef as forwardRef6 } from "react";
124
+ import { View as View6 } from "react-native";
125
+ import { jsx as jsx6 } from "react/jsx-runtime";
126
+ var Column = forwardRef6(function Column2({ children, asChild = false, style, ...props }, ref) {
127
+ const [styleProps, rest] = useStyleProps(props);
128
+ const Root = asChild ? Slot : View6;
129
+ return /* @__PURE__ */ jsx6(Root, { ref, style: [{ flexDirection: "column" }, styleProps, style], ...rest, children });
130
+ });
131
+ Column.displayName = "XAUI.Column";
132
+
133
+ // src/components/view/index.ts
134
+ var Stack2 = Object.assign(StackRoot, { Item: StackItem });
135
+ var Grid2 = Object.assign(GridRoot, { Item: GridItem });
136
+
137
+ export {
138
+ useGrid,
139
+ Row,
140
+ Column,
141
+ Stack2 as Stack,
142
+ Grid2 as Grid
143
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/utils/stable-hash.ts
2
+ function canonical(value) {
3
+ if (value === null || typeof value !== "object") return _nullishCoalesce(JSON.stringify(value), () => ( "null"));
4
+ if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
5
+ 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)}`);
6
+ return `{${entries.join(",")}}`;
7
+ }
8
+ function stableHash(value) {
9
+ const input = canonical(value);
10
+ let hash = 2166136261;
11
+ for (let i = 0; i < input.length; i++) {
12
+ hash ^= input.charCodeAt(i);
13
+ hash = Math.imul(hash, 16777619) >>> 0;
14
+ }
15
+ return hash.toString(36);
16
+ }
17
+
18
+
19
+
20
+ exports.stableHash = stableHash;
@@ -1,35 +1,22 @@
1
1
  import {
2
+ ThemeContext,
2
3
  alpha,
3
4
  mix
4
- } from "./chunk-RBNCR5KB.js";
5
+ } from "./chunk-A3EGFI6T.js";
6
+ import {
7
+ stableHash
8
+ } from "./chunk-GGW42MY4.js";
5
9
 
6
10
  // src/provider/xaui-provider.tsx
7
11
  import { useColorScheme } from "react-native";
8
12
 
9
- // src/utils/stable-hash.ts
10
- function canonical(value) {
11
- if (value === null || typeof value !== "object") return 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: mix(s.accent, s.accentForeground, 0.1),
30
- successPressed: mix(s.success, s.successForeground, 0.1),
31
- warningPressed: mix(s.warning, s.warningForeground, 0.1),
32
- dangerPressed: mix(s.danger, s.dangerForeground, 0.1),
16
+ accentPressed: mix(s.accent, s.foreground, 0.1),
17
+ successPressed: mix(s.success, s.foreground, 0.1),
18
+ warningPressed: mix(s.warning, s.foreground, 0.1),
19
+ dangerPressed: mix(s.danger, s.foreground, 0.1),
33
20
  defaultPressed: mix(s.default, s.defaultForeground, 0.04),
34
21
  surfacePressed: mix(s.surface, s.surfaceForeground, 0.08),
35
22
  defaultSoft: alpha(s.default, 0.5),
@@ -62,6 +49,7 @@ function deriveColors(s) {
62
49
  }
63
50
 
64
51
  // src/theme/scales.ts
52
+ import { Platform } from "react-native";
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: 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)",
@@ -385,11 +376,8 @@ function createTheme(config = {}) {
385
376
  }
386
377
  var defaultTheme = createTheme();
387
378
 
388
- // src/theme/theme-context.ts
389
- import { createContext } from "react";
390
- var ThemeContext = createContext(null);
391
-
392
379
  // src/provider/xaui-provider.tsx
380
+ import { jsx } from "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 = useColorScheme();
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__ */ jsx(ThemeContext.Provider, { value: theme[resolved], children });
401
389
  }
402
390
 
403
391
  // src/theme/palette.ts
@@ -699,23 +687,6 @@ var primitives = {
699
687
  eclipse: "#18181b"
700
688
  };
701
689
 
702
- // src/theme/theme-hooks.ts
703
- import { useContext } from "react";
704
- function useXAUITheme() {
705
- const theme = useContext(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
690
  export {
720
691
  deriveColors,
721
692
  buildRadius,
@@ -724,11 +695,7 @@ export {
724
695
  sourceKeys,
725
696
  createTheme,
726
697
  defaultTheme,
727
- ThemeContext,
728
698
  XAUIProvider,
729
699
  palette,
730
- primitives,
731
- useXAUITheme,
732
- useColorMode,
733
- useThemeColor
700
+ primitives
734
701
  };