@xaui/native 0.9.1-alpha.18 → 0.9.1-alpha.19

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 (49) hide show
  1. package/dist/{chunk-M2VYRHVS.cjs → chunk-2WMVDMFV.cjs} +2 -2
  2. package/dist/{chunk-MBLPPOSO.js → chunk-4EPS7UBO.js} +18 -17
  3. package/dist/{chunk-6N5JXRUZ.cjs → chunk-57SJ4LJF.cjs} +2 -20
  4. package/dist/{chunk-ODH5WAVM.cjs → chunk-6ARON3XT.cjs} +27 -26
  5. package/dist/{chunk-XJARE6SC.js → chunk-A3EGFI6T.js} +0 -18
  6. package/dist/{chunk-P5MKOLIW.cjs → chunk-A4VD4MHK.cjs} +73 -73
  7. package/dist/chunk-BFB6K4M7.cjs +31 -0
  8. package/dist/{chunk-BHAHJHAI.cjs → chunk-BHTFIZTQ.cjs} +34 -32
  9. package/dist/{chunk-5SU7FXWH.cjs → chunk-EVXZGNPA.cjs} +3 -148
  10. package/dist/{chunk-4K3LZS7M.js → chunk-EXX6ATAS.js} +2 -147
  11. package/dist/chunk-GGW42MY4.js +20 -0
  12. package/dist/chunk-MAYVGK6W.js +31 -0
  13. package/dist/chunk-MC7SY2QH.cjs +20 -0
  14. package/dist/{chunk-XQE5PXOD.js → chunk-MWXE7D4L.js} +4 -2
  15. package/dist/chunk-N7C4UNUL.js +150 -0
  16. package/dist/{chunk-6PZF4PI7.js → chunk-RMLFMRWL.js} +5 -3
  17. package/dist/{chunk-6VTBGBPP.cjs → chunk-UBA6AEY6.cjs} +10 -8
  18. package/dist/chunk-UVO4GFSW.cjs +150 -0
  19. package/dist/{chunk-VQPP6FCB.js → chunk-WXAME7KB.js} +76 -76
  20. package/dist/{chunk-L3AQNVRN.js → chunk-XHZBXYVU.js} +1 -1
  21. package/dist/components/button/index.cjs +7 -5
  22. package/dist/components/button/index.d.cts +3 -2
  23. package/dist/components/button/index.d.ts +3 -2
  24. package/dist/components/button/index.js +6 -4
  25. package/dist/components/typography/index.cjs +6 -4
  26. package/dist/components/typography/index.d.cts +2 -1
  27. package/dist/components/typography/index.d.ts +2 -1
  28. package/dist/components/typography/index.js +5 -3
  29. package/dist/components/view/index.cjs +10 -0
  30. package/dist/components/view/index.d.cts +77 -0
  31. package/dist/components/view/index.d.ts +77 -0
  32. package/dist/components/view/index.js +10 -0
  33. package/dist/{create-recipe-3_ElpCYt.d.cts → create-recipe-C0XXjuow.d.cts} +2 -30
  34. package/dist/{create-recipe-DImq1AZA.d.ts → create-recipe-CPXFo2rk.d.ts} +2 -30
  35. package/dist/index.cjs +19 -10
  36. package/dist/index.d.cts +4 -2
  37. package/dist/index.d.ts +4 -2
  38. package/dist/index.js +17 -8
  39. package/dist/{pressable-feedback.type-UwqIG6ES.d.ts → pressable-feedback.type-1K8YEOb8.d.cts} +1 -1
  40. package/dist/{pressable-feedback.type-lgW5wQx5.d.cts → pressable-feedback.type-BwkKLQlX.d.ts} +1 -1
  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 +8 -5
  44. package/dist/system/index.d.cts +5 -4
  45. package/dist/system/index.d.ts +5 -4
  46. package/dist/system/index.js +8 -5
  47. package/dist/theme/index.cjs +4 -3
  48. package/dist/theme/index.js +3 -2
  49. package/package.json +11 -1
@@ -0,0 +1,31 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkEVXZGNPAcjs = require('./chunk-EVXZGNPA.cjs');
5
+
6
+ // src/components/view/row.tsx
7
+ var _react = require('react');
8
+ var _reactnative = require('react-native');
9
+ var _jsxruntime = require('react/jsx-runtime');
10
+ var Row = _react.forwardRef.call(void 0, function Row2({ children, asChild = false, style, ...props }, ref) {
11
+ const [styleProps, rest] = _chunkEVXZGNPAcjs.useStyleProps.call(void 0, props);
12
+ const Root = asChild ? _chunkEVXZGNPAcjs.Slot : _reactnative.View;
13
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ flexDirection: "row" }, styleProps, style], ...rest, children });
14
+ });
15
+ Row.displayName = "XAUI.Row";
16
+
17
+ // src/components/view/column.tsx
18
+
19
+
20
+
21
+ var Column = _react.forwardRef.call(void 0, function Column2({ children, asChild = false, style, ...props }, ref) {
22
+ const [styleProps, rest] = _chunkEVXZGNPAcjs.useStyleProps.call(void 0, props);
23
+ const Root = asChild ? _chunkEVXZGNPAcjs.Slot : _reactnative.View;
24
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ flexDirection: "column" }, styleProps, style], ...rest, children });
25
+ });
26
+ Column.displayName = "XAUI.Column";
27
+
28
+
29
+
30
+
31
+ exports.Row = Row; exports.Column = Column;
@@ -2,8 +2,10 @@
2
2
 
3
3
 
4
4
 
5
+ var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
5
6
 
6
- var _chunk6N5JXRUZcjs = require('./chunk-6N5JXRUZ.cjs');
7
+
8
+ var _chunkMC7SY2QHcjs = require('./chunk-MC7SY2QH.cjs');
7
9
 
8
10
  // src/provider/xaui-provider.tsx
9
11
  var _reactnative = require('react-native');
@@ -11,38 +13,38 @@ var _reactnative = require('react-native');
11
13
  // src/theme/derive-colors.ts
12
14
  function deriveColors(s) {
13
15
  return {
14
- accentPressed: _chunk6N5JXRUZcjs.mix.call(void 0, s.accent, s.foreground, 0.1),
15
- successPressed: _chunk6N5JXRUZcjs.mix.call(void 0, s.success, s.foreground, 0.1),
16
- warningPressed: _chunk6N5JXRUZcjs.mix.call(void 0, s.warning, s.foreground, 0.1),
17
- dangerPressed: _chunk6N5JXRUZcjs.mix.call(void 0, s.danger, s.foreground, 0.1),
18
- defaultPressed: _chunk6N5JXRUZcjs.mix.call(void 0, s.default, s.defaultForeground, 0.04),
19
- surfacePressed: _chunk6N5JXRUZcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.08),
20
- defaultSoft: _chunk6N5JXRUZcjs.alpha.call(void 0, s.default, 0.5),
16
+ accentPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.accent, s.foreground, 0.1),
17
+ successPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.success, s.foreground, 0.1),
18
+ warningPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.warning, s.foreground, 0.1),
19
+ dangerPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.danger, s.foreground, 0.1),
20
+ defaultPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.default, s.defaultForeground, 0.04),
21
+ surfacePressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.08),
22
+ defaultSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.default, 0.5),
21
23
  defaultSoftForeground: s.defaultForeground,
22
- defaultSoftPressed: _chunk6N5JXRUZcjs.alpha.call(void 0, s.default, 0.6),
23
- accentSoft: _chunk6N5JXRUZcjs.alpha.call(void 0, s.accent, 0.15),
24
- accentSoftForeground: _chunk6N5JXRUZcjs.mix.call(void 0, s.accent, s.foreground, 0.2),
25
- accentSoftPressed: _chunk6N5JXRUZcjs.alpha.call(void 0, s.accent, 0.2),
26
- successSoft: _chunk6N5JXRUZcjs.alpha.call(void 0, s.success, 0.15),
27
- successSoftForeground: _chunk6N5JXRUZcjs.mix.call(void 0, s.success, s.foreground, 0.3),
28
- successSoftPressed: _chunk6N5JXRUZcjs.alpha.call(void 0, s.success, 0.2),
29
- warningSoft: _chunk6N5JXRUZcjs.alpha.call(void 0, s.warning, 0.15),
30
- warningSoftForeground: _chunk6N5JXRUZcjs.mix.call(void 0, s.warning, s.foreground, 0.35),
31
- warningSoftPressed: _chunk6N5JXRUZcjs.alpha.call(void 0, s.warning, 0.2),
32
- dangerSoft: _chunk6N5JXRUZcjs.alpha.call(void 0, s.danger, 0.15),
33
- dangerSoftForeground: _chunk6N5JXRUZcjs.mix.call(void 0, s.danger, s.foreground, 0.2),
34
- dangerSoftPressed: _chunk6N5JXRUZcjs.alpha.call(void 0, s.danger, 0.2),
35
- backgroundSecondary: _chunk6N5JXRUZcjs.mix.call(void 0, s.background, s.foreground, 0.04),
36
- backgroundTertiary: _chunk6N5JXRUZcjs.mix.call(void 0, s.background, s.foreground, 0.08),
24
+ defaultSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.default, 0.6),
25
+ accentSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.accent, 0.15),
26
+ accentSoftForeground: _chunk57SJ4LJFcjs.mix.call(void 0, s.accent, s.foreground, 0.2),
27
+ accentSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.accent, 0.2),
28
+ successSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.success, 0.15),
29
+ successSoftForeground: _chunk57SJ4LJFcjs.mix.call(void 0, s.success, s.foreground, 0.3),
30
+ successSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.success, 0.2),
31
+ warningSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.warning, 0.15),
32
+ warningSoftForeground: _chunk57SJ4LJFcjs.mix.call(void 0, s.warning, s.foreground, 0.35),
33
+ warningSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.warning, 0.2),
34
+ dangerSoft: _chunk57SJ4LJFcjs.alpha.call(void 0, s.danger, 0.15),
35
+ dangerSoftForeground: _chunk57SJ4LJFcjs.mix.call(void 0, s.danger, s.foreground, 0.2),
36
+ dangerSoftPressed: _chunk57SJ4LJFcjs.alpha.call(void 0, s.danger, 0.2),
37
+ backgroundSecondary: _chunk57SJ4LJFcjs.mix.call(void 0, s.background, s.foreground, 0.04),
38
+ backgroundTertiary: _chunk57SJ4LJFcjs.mix.call(void 0, s.background, s.foreground, 0.08),
37
39
  backgroundInverse: s.foreground,
38
- borderSecondary: _chunk6N5JXRUZcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.22),
39
- borderTertiary: _chunk6N5JXRUZcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.34),
40
- separatorSecondary: _chunk6N5JXRUZcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.15),
41
- separatorTertiary: _chunk6N5JXRUZcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.19),
42
- fieldPressed: _chunk6N5JXRUZcjs.mix.call(void 0, s.fieldBackground, s.fieldForeground, 0.1),
40
+ borderSecondary: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.22),
41
+ borderTertiary: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.34),
42
+ separatorSecondary: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.15),
43
+ separatorTertiary: _chunk57SJ4LJFcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.19),
44
+ fieldPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.fieldBackground, s.fieldForeground, 0.1),
43
45
  fieldFocus: s.fieldBackground,
44
- fieldBorderPressed: _chunk6N5JXRUZcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.12),
45
- fieldBorderFocus: _chunk6N5JXRUZcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.26)
46
+ fieldBorderPressed: _chunk57SJ4LJFcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.12),
47
+ fieldBorderFocus: _chunk57SJ4LJFcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.26)
46
48
  };
47
49
  }
48
50
 
@@ -365,7 +367,7 @@ function resolveMode(mode, config, id) {
365
367
  };
366
368
  }
367
369
  function createTheme(config = {}) {
368
- const id = _chunk6N5JXRUZcjs.stableHash.call(void 0, config);
370
+ const id = _chunkMC7SY2QHcjs.stableHash.call(void 0, config);
369
371
  return {
370
372
  id,
371
373
  light: resolveMode("light", config, id),
@@ -383,7 +385,7 @@ function XAUIProvider({
383
385
  }) {
384
386
  const scheme = _reactnative.useColorScheme.call(void 0, );
385
387
  const resolved = colorMode === "system" ? scheme === "dark" ? "dark" : "light" : colorMode;
386
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6N5JXRUZcjs.ThemeContext.Provider, { value: theme[resolved], children });
388
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk57SJ4LJFcjs.ThemeContext.Provider, { value: theme[resolved], children });
387
389
  }
388
390
 
389
391
  // src/theme/palette.ts
@@ -1,7 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
-
4
- var _chunk6N5JXRUZcjs = require('./chunk-6N5JXRUZ.cjs');
3
+ var _chunkMC7SY2QHcjs = require('./chunk-MC7SY2QH.cjs');
5
4
 
6
5
  // src/system/style-props/use-style-props.ts
7
6
  var _react = require('react');
@@ -171,7 +170,7 @@ function splitStyleProps(props) {
171
170
  // src/system/style-props/use-style-props.ts
172
171
  function useStyleProps(props) {
173
172
  const [styleProps, rest] = splitStyleProps(props);
174
- const key = _chunk6N5JXRUZcjs.stableHash.call(void 0, styleProps);
173
+ const key = _chunkMC7SY2QHcjs.stableHash.call(void 0, styleProps);
175
174
  return [_react.useMemo.call(void 0, () => styleProps, [key]), rest];
176
175
  }
177
176
 
@@ -294,150 +293,6 @@ function refOf(element) {
294
293
  return _nullishCoalesce(fromProps, () => ( fromElement));
295
294
  }
296
295
 
297
- // src/system/recipe/resolve-tint.ts
298
- var TINT_SLICE_BY_SUFFIX = [
299
- [/SoftForeground$/, "softForeground"],
300
- [/SoftPressed$/, "softPressed"],
301
- [/Soft$/, "soft"],
302
- [/Foreground$/, "foreground"],
303
- [/Pressed$/, "pressed"]
304
- ];
305
- function tintSliceFor(token) {
306
- for (const [suffix, slice] of TINT_SLICE_BY_SUFFIX) {
307
- if (suffix.test(token)) return slice;
308
- }
309
- return "base";
310
- }
311
- function resolveTint(tokens, color, theme) {
312
- const tint = _chunk6N5JXRUZcjs.deriveTint.call(void 0, color, theme);
313
- const colors = {};
314
- for (const [role, token] of Object.entries(_nullishCoalesce(tokens, () => ( {})))) {
315
- colors[role] = tint[tintSliceFor(token)];
316
- }
317
- return colors;
318
- }
319
-
320
- // src/system/recipe/style-cache.ts
321
- var _reactnative = require('react-native');
322
-
323
- // src/system/recipe/variant-map.ts
324
- var STATE_ORDER = ["focused", "pressed", "disabled"];
325
- function resolveSelection(defaultVariants, selection) {
326
- const resolved = { ...defaultVariants };
327
- for (const [axis, value] of Object.entries(_nullishCoalesce(selection, () => ( {})))) {
328
- if (value !== void 0) resolved[axis] = value;
329
- }
330
- return resolved;
331
- }
332
- function resolveVariantColors(tokens, theme) {
333
- const colors = {};
334
- for (const [role, token] of entriesOf(tokens)) {
335
- const value = theme.colors[token];
336
- if (value === void 0) {
337
- throw new Error(
338
- `XAUI: the recipe names "${token}" for its "${role}" role, but the theme has no such colour token. Check the spelling against XAUIColors.`
339
- );
340
- }
341
- colors[role] = value;
342
- }
343
- return colors;
344
- }
345
- function activeStateFns(states, active) {
346
- const fns = [];
347
- for (const state of STATE_ORDER) {
348
- const fn = active[state] ? _optionalChain([states, 'optionalAccess', _3 => _3[state]]) : void 0;
349
- if (fn) fns.push(fn);
350
- }
351
- return fns;
352
- }
353
- function collectStyleFns(config, selection, states) {
354
- const fns = [];
355
- if (config.base) fns.push(config.base);
356
- if (config.paint) fns.push(config.paint);
357
- for (const [axis, values] of Object.entries(_nullishCoalesce(config.variants, () => ( {})))) {
358
- const value = selection[axis];
359
- const fn = value === void 0 ? void 0 : values[value];
360
- if (fn) fns.push(fn);
361
- }
362
- for (const compound of _nullishCoalesce(config.compoundVariants, () => ( []))) {
363
- if (appliesTo(compound.when, selection)) fns.push(compound.style);
364
- }
365
- return [...fns, ...activeStateFns(config.states, states)];
366
- }
367
- function appliesTo(when, selection) {
368
- return Object.entries(when).every(([axis, value]) => selection[axis] === value);
369
- }
370
- function entriesOf(tokens) {
371
- return Object.entries(_nullishCoalesce(tokens, () => ( {})));
372
- }
373
-
374
- // src/system/recipe/style-cache.ts
375
- function createStyleCache(slots) {
376
- const entries = /* @__PURE__ */ new Map();
377
- return {
378
- read(key, build) {
379
- const hit = entries.get(key);
380
- if (hit) return hit;
381
- const built = build();
382
- const complete = {};
383
- for (const slot of slots) complete[slot] = _nullishCoalesce(built[slot], () => ( {}));
384
- const created = _reactnative.StyleSheet.create(complete);
385
- entries.set(key, created);
386
- return created;
387
- },
388
- get size() {
389
- return entries.size;
390
- },
391
- clear() {
392
- entries.clear();
393
- }
394
- };
395
- }
396
- function cacheKey(theme, selection, states) {
397
- const axes = Object.keys(selection).sort().map((axis) => `${axis}:${_nullishCoalesce(selection[axis], () => ( "-"))}`).join("|");
398
- const active = STATE_ORDER.filter((state) => states[state]).join(",");
399
- return `${theme.id}|${theme.mode}|${axes}|${active}`;
400
- }
401
-
402
- // src/system/recipe/create-recipe.ts
403
- function createRecipe(config) {
404
- const cache = createStyleCache(config.slots);
405
- const tokensFor = (variant) => variant === void 0 ? void 0 : _optionalChain([config, 'access', _4 => _4.variantTokens, 'optionalAccess', _5 => _5[variant]]);
406
- return {
407
- slots: config.slots,
408
- resolve({ theme, selection, states = {} }) {
409
- const resolved = resolveSelection(config.defaultVariants, selection);
410
- return cache.read(cacheKey(theme, resolved, states), () => {
411
- const colors = resolveVariantColors(tokensFor(resolved.variant), theme);
412
- return apply(collectStyleFns(config, resolved, states), theme, colors);
413
- });
414
- },
415
- tint({ theme, color, selection, states = {} }) {
416
- if (!config.paint) return {};
417
- const resolved = resolveSelection(config.defaultVariants, selection);
418
- const tokens = tokensFor(resolved.variant);
419
- if (!tokens) return {};
420
- const colors = resolveTint(tokens, color, theme);
421
- const fns = [config.paint, ...activeStateFns(config.states, states)];
422
- return apply(fns, theme, colors);
423
- }
424
- };
425
- }
426
- function apply(fns, theme, colors) {
427
- const merged = {};
428
- for (const fn of fns) {
429
- const produced = fn(theme, colors);
430
- for (const slot of Object.keys(produced)) {
431
- const style = produced[slot];
432
- if (!style) continue;
433
- const previous = merged[slot];
434
- merged[slot] = previous ? { ...previous, ...style } : style;
435
- }
436
- }
437
- return merged;
438
- }
439
-
440
-
441
296
 
442
297
 
443
298
 
@@ -445,4 +300,4 @@ function apply(fns, theme, colors) {
445
300
 
446
301
 
447
302
 
448
- exports.useStyleProps = useStyleProps; exports.childrenToString = childrenToString; exports.createSlotContext = createSlotContext; exports.mergeRefs = mergeRefs; exports.mergeProps = mergeProps; exports.Slot = Slot; exports.createRecipe = createRecipe;
303
+ exports.useStyleProps = useStyleProps; exports.childrenToString = childrenToString; exports.createSlotContext = createSlotContext; exports.mergeRefs = mergeRefs; exports.mergeProps = mergeProps; exports.Slot = Slot;
@@ -1,7 +1,6 @@
1
1
  import {
2
- deriveTint,
3
2
  stableHash
4
- } from "./chunk-XJARE6SC.js";
3
+ } from "./chunk-GGW42MY4.js";
5
4
 
6
5
  // src/system/style-props/use-style-props.ts
7
6
  import { useMemo } from "react";
@@ -294,155 +293,11 @@ function refOf(element) {
294
293
  return fromProps ?? fromElement;
295
294
  }
296
295
 
297
- // src/system/recipe/resolve-tint.ts
298
- var TINT_SLICE_BY_SUFFIX = [
299
- [/SoftForeground$/, "softForeground"],
300
- [/SoftPressed$/, "softPressed"],
301
- [/Soft$/, "soft"],
302
- [/Foreground$/, "foreground"],
303
- [/Pressed$/, "pressed"]
304
- ];
305
- function tintSliceFor(token) {
306
- for (const [suffix, slice] of TINT_SLICE_BY_SUFFIX) {
307
- if (suffix.test(token)) return slice;
308
- }
309
- return "base";
310
- }
311
- function resolveTint(tokens, color, theme) {
312
- const tint = deriveTint(color, theme);
313
- const colors = {};
314
- for (const [role, token] of Object.entries(tokens ?? {})) {
315
- colors[role] = tint[tintSliceFor(token)];
316
- }
317
- return colors;
318
- }
319
-
320
- // src/system/recipe/style-cache.ts
321
- import { StyleSheet } from "react-native";
322
-
323
- // src/system/recipe/variant-map.ts
324
- var STATE_ORDER = ["focused", "pressed", "disabled"];
325
- function resolveSelection(defaultVariants, selection) {
326
- const resolved = { ...defaultVariants };
327
- for (const [axis, value] of Object.entries(selection ?? {})) {
328
- if (value !== void 0) resolved[axis] = value;
329
- }
330
- return resolved;
331
- }
332
- function resolveVariantColors(tokens, theme) {
333
- const colors = {};
334
- for (const [role, token] of entriesOf(tokens)) {
335
- const value = theme.colors[token];
336
- if (value === void 0) {
337
- throw new Error(
338
- `XAUI: the recipe names "${token}" for its "${role}" role, but the theme has no such colour token. Check the spelling against XAUIColors.`
339
- );
340
- }
341
- colors[role] = value;
342
- }
343
- return colors;
344
- }
345
- function activeStateFns(states, active) {
346
- const fns = [];
347
- for (const state of STATE_ORDER) {
348
- const fn = active[state] ? states?.[state] : void 0;
349
- if (fn) fns.push(fn);
350
- }
351
- return fns;
352
- }
353
- function collectStyleFns(config, selection, states) {
354
- const fns = [];
355
- if (config.base) fns.push(config.base);
356
- if (config.paint) fns.push(config.paint);
357
- for (const [axis, values] of Object.entries(config.variants ?? {})) {
358
- const value = selection[axis];
359
- const fn = value === void 0 ? void 0 : values[value];
360
- if (fn) fns.push(fn);
361
- }
362
- for (const compound of config.compoundVariants ?? []) {
363
- if (appliesTo(compound.when, selection)) fns.push(compound.style);
364
- }
365
- return [...fns, ...activeStateFns(config.states, states)];
366
- }
367
- function appliesTo(when, selection) {
368
- return Object.entries(when).every(([axis, value]) => selection[axis] === value);
369
- }
370
- function entriesOf(tokens) {
371
- return Object.entries(tokens ?? {});
372
- }
373
-
374
- // src/system/recipe/style-cache.ts
375
- function createStyleCache(slots) {
376
- const entries = /* @__PURE__ */ new Map();
377
- return {
378
- read(key, build) {
379
- const hit = entries.get(key);
380
- if (hit) return hit;
381
- const built = build();
382
- const complete = {};
383
- for (const slot of slots) complete[slot] = built[slot] ?? {};
384
- const created = StyleSheet.create(complete);
385
- entries.set(key, created);
386
- return created;
387
- },
388
- get size() {
389
- return entries.size;
390
- },
391
- clear() {
392
- entries.clear();
393
- }
394
- };
395
- }
396
- function cacheKey(theme, selection, states) {
397
- const axes = Object.keys(selection).sort().map((axis) => `${axis}:${selection[axis] ?? "-"}`).join("|");
398
- const active = STATE_ORDER.filter((state) => states[state]).join(",");
399
- return `${theme.id}|${theme.mode}|${axes}|${active}`;
400
- }
401
-
402
- // src/system/recipe/create-recipe.ts
403
- function createRecipe(config) {
404
- const cache = createStyleCache(config.slots);
405
- const tokensFor = (variant) => variant === void 0 ? void 0 : config.variantTokens?.[variant];
406
- return {
407
- slots: config.slots,
408
- resolve({ theme, selection, states = {} }) {
409
- const resolved = resolveSelection(config.defaultVariants, selection);
410
- return cache.read(cacheKey(theme, resolved, states), () => {
411
- const colors = resolveVariantColors(tokensFor(resolved.variant), theme);
412
- return apply(collectStyleFns(config, resolved, states), theme, colors);
413
- });
414
- },
415
- tint({ theme, color, selection, states = {} }) {
416
- if (!config.paint) return {};
417
- const resolved = resolveSelection(config.defaultVariants, selection);
418
- const tokens = tokensFor(resolved.variant);
419
- if (!tokens) return {};
420
- const colors = resolveTint(tokens, color, theme);
421
- const fns = [config.paint, ...activeStateFns(config.states, states)];
422
- return apply(fns, theme, colors);
423
- }
424
- };
425
- }
426
- function apply(fns, theme, colors) {
427
- const merged = {};
428
- for (const fn of fns) {
429
- const produced = fn(theme, colors);
430
- for (const slot of Object.keys(produced)) {
431
- const style = produced[slot];
432
- if (!style) continue;
433
- const previous = merged[slot];
434
- merged[slot] = previous ? { ...previous, ...style } : style;
435
- }
436
- }
437
- return merged;
438
- }
439
-
440
296
  export {
441
297
  useStyleProps,
442
298
  childrenToString,
443
299
  createSlotContext,
444
300
  mergeRefs,
445
301
  mergeProps,
446
- Slot,
447
- createRecipe
302
+ Slot
448
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,31 @@
1
+ import {
2
+ Slot,
3
+ useStyleProps
4
+ } from "./chunk-EXX6ATAS.js";
5
+
6
+ // src/components/view/row.tsx
7
+ import { forwardRef } from "react";
8
+ import { View } from "react-native";
9
+ import { jsx } from "react/jsx-runtime";
10
+ var Row = forwardRef(function Row2({ children, asChild = false, style, ...props }, ref) {
11
+ const [styleProps, rest] = useStyleProps(props);
12
+ const Root = asChild ? Slot : View;
13
+ return /* @__PURE__ */ jsx(Root, { ref, style: [{ flexDirection: "row" }, styleProps, style], ...rest, children });
14
+ });
15
+ Row.displayName = "XAUI.Row";
16
+
17
+ // src/components/view/column.tsx
18
+ import { forwardRef as forwardRef2 } from "react";
19
+ import { View as View2 } from "react-native";
20
+ import { jsx as jsx2 } from "react/jsx-runtime";
21
+ var Column = forwardRef2(function Column2({ children, asChild = false, style, ...props }, ref) {
22
+ const [styleProps, rest] = useStyleProps(props);
23
+ const Root = asChild ? Slot : View2;
24
+ return /* @__PURE__ */ jsx2(Root, { ref, style: [{ flexDirection: "column" }, styleProps, style], ...rest, children });
25
+ });
26
+ Column.displayName = "XAUI.Column";
27
+
28
+ export {
29
+ Row,
30
+ Column
31
+ };
@@ -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,9 +1,11 @@
1
1
  import {
2
2
  ThemeContext,
3
3
  alpha,
4
- mix,
4
+ mix
5
+ } from "./chunk-A3EGFI6T.js";
6
+ import {
5
7
  stableHash
6
- } from "./chunk-XJARE6SC.js";
8
+ } from "./chunk-GGW42MY4.js";
7
9
 
8
10
  // src/provider/xaui-provider.tsx
9
11
  import { useColorScheme } from "react-native";