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

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.
@@ -1,7 +1,8 @@
1
1
  import {
2
+ ThemeContext,
2
3
  alpha,
3
4
  mix
4
- } from "./chunk-RBNCR5KB.js";
5
+ } from "./chunk-X2K2FX3W.js";
5
6
 
6
7
  // src/provider/xaui-provider.tsx
7
8
  import { useColorScheme } from "react-native";
@@ -385,10 +386,6 @@ function createTheme(config = {}) {
385
386
  }
386
387
  var defaultTheme = createTheme();
387
388
 
388
- // src/theme/theme-context.ts
389
- import { createContext } from "react";
390
- var ThemeContext = createContext(null);
391
-
392
389
  // src/provider/xaui-provider.tsx
393
390
  function XAUIProvider({
394
391
  children,
@@ -699,23 +696,6 @@ var primitives = {
699
696
  eclipse: "#18181b"
700
697
  };
701
698
 
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
699
  export {
720
700
  deriveColors,
721
701
  buildRadius,
@@ -724,11 +704,7 @@ export {
724
704
  sourceKeys,
725
705
  createTheme,
726
706
  defaultTheme,
727
- ThemeContext,
728
707
  XAUIProvider,
729
708
  palette,
730
- primitives,
731
- useXAUITheme,
732
- useColorMode,
733
- useThemeColor
709
+ primitives
734
710
  };
@@ -1,4 +1,25 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils/colors.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/theme/theme-context.ts
2
+ var _react = require('react');
3
+ var ThemeContext = _react.createContext.call(void 0, null);
4
+
5
+ // src/theme/theme-hooks.ts
6
+
7
+ function useXAUITheme() {
8
+ const theme = _react.useContext.call(void 0, ThemeContext);
9
+ if (theme === null) {
10
+ throw new Error("XAUI: useXAUITheme must be used within <XAUIProvider>.");
11
+ }
12
+ return theme;
13
+ }
14
+ function useColorMode() {
15
+ return useXAUITheme().mode;
16
+ }
17
+ function useThemeColor(token) {
18
+ const { colors } = useXAUITheme();
19
+ return Array.isArray(token) ? token.map((key) => colors[key]) : colors[token];
20
+ }
21
+
22
+ // src/utils/colors.ts
2
23
  var srgbToLinear = (c) => c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
3
24
  var linearToSrgb = (c) => c <= 31308e-7 ? 12.92 * c : 1.055 * c ** (1 / 2.4) - 0.055;
4
25
  var clamp01 = (n) => Math.min(1, Math.max(0, n));
@@ -97,4 +118,8 @@ function deriveTint(tint, theme) {
97
118
 
98
119
 
99
120
 
100
- exports.mix = mix; exports.alpha = alpha; exports.deriveTint = deriveTint;
121
+
122
+
123
+
124
+
125
+ exports.ThemeContext = ThemeContext; exports.useXAUITheme = useXAUITheme; exports.useColorMode = useColorMode; exports.useThemeColor = useThemeColor; exports.mix = mix; exports.alpha = alpha; exports.deriveTint = deriveTint;
@@ -1,7 +1,8 @@
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
3
 
4
- var _chunkM7P46XKIcjs = require('./chunk-M7P46XKI.cjs');
4
+
5
+ var _chunk3QBT3Q65cjs = require('./chunk-3QBT3Q65.cjs');
5
6
 
6
7
  // src/provider/xaui-provider.tsx
7
8
  var _reactnative = require('react-native');
@@ -26,38 +27,38 @@ function stableHash(value) {
26
27
  // src/theme/derive-colors.ts
27
28
  function deriveColors(s) {
28
29
  return {
29
- accentPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.accent, s.accentForeground, 0.1),
30
- successPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.success, s.successForeground, 0.1),
31
- warningPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.warning, s.warningForeground, 0.1),
32
- dangerPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.danger, s.dangerForeground, 0.1),
33
- defaultPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.default, s.defaultForeground, 0.04),
34
- surfacePressed: _chunkM7P46XKIcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.08),
35
- defaultSoft: _chunkM7P46XKIcjs.alpha.call(void 0, s.default, 0.5),
30
+ accentPressed: _chunk3QBT3Q65cjs.mix.call(void 0, s.accent, s.accentForeground, 0.1),
31
+ successPressed: _chunk3QBT3Q65cjs.mix.call(void 0, s.success, s.successForeground, 0.1),
32
+ warningPressed: _chunk3QBT3Q65cjs.mix.call(void 0, s.warning, s.warningForeground, 0.1),
33
+ dangerPressed: _chunk3QBT3Q65cjs.mix.call(void 0, s.danger, s.dangerForeground, 0.1),
34
+ defaultPressed: _chunk3QBT3Q65cjs.mix.call(void 0, s.default, s.defaultForeground, 0.04),
35
+ surfacePressed: _chunk3QBT3Q65cjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.08),
36
+ defaultSoft: _chunk3QBT3Q65cjs.alpha.call(void 0, s.default, 0.5),
36
37
  defaultSoftForeground: s.defaultForeground,
37
- defaultSoftPressed: _chunkM7P46XKIcjs.alpha.call(void 0, s.default, 0.6),
38
- accentSoft: _chunkM7P46XKIcjs.alpha.call(void 0, s.accent, 0.15),
39
- accentSoftForeground: _chunkM7P46XKIcjs.mix.call(void 0, s.accent, s.foreground, 0.2),
40
- accentSoftPressed: _chunkM7P46XKIcjs.alpha.call(void 0, s.accent, 0.2),
41
- successSoft: _chunkM7P46XKIcjs.alpha.call(void 0, s.success, 0.15),
42
- successSoftForeground: _chunkM7P46XKIcjs.mix.call(void 0, s.success, s.foreground, 0.3),
43
- successSoftPressed: _chunkM7P46XKIcjs.alpha.call(void 0, s.success, 0.2),
44
- warningSoft: _chunkM7P46XKIcjs.alpha.call(void 0, s.warning, 0.15),
45
- warningSoftForeground: _chunkM7P46XKIcjs.mix.call(void 0, s.warning, s.foreground, 0.35),
46
- warningSoftPressed: _chunkM7P46XKIcjs.alpha.call(void 0, s.warning, 0.2),
47
- dangerSoft: _chunkM7P46XKIcjs.alpha.call(void 0, s.danger, 0.15),
48
- dangerSoftForeground: _chunkM7P46XKIcjs.mix.call(void 0, s.danger, s.foreground, 0.2),
49
- dangerSoftPressed: _chunkM7P46XKIcjs.alpha.call(void 0, s.danger, 0.2),
50
- backgroundSecondary: _chunkM7P46XKIcjs.mix.call(void 0, s.background, s.foreground, 0.04),
51
- backgroundTertiary: _chunkM7P46XKIcjs.mix.call(void 0, s.background, s.foreground, 0.08),
38
+ defaultSoftPressed: _chunk3QBT3Q65cjs.alpha.call(void 0, s.default, 0.6),
39
+ accentSoft: _chunk3QBT3Q65cjs.alpha.call(void 0, s.accent, 0.15),
40
+ accentSoftForeground: _chunk3QBT3Q65cjs.mix.call(void 0, s.accent, s.foreground, 0.2),
41
+ accentSoftPressed: _chunk3QBT3Q65cjs.alpha.call(void 0, s.accent, 0.2),
42
+ successSoft: _chunk3QBT3Q65cjs.alpha.call(void 0, s.success, 0.15),
43
+ successSoftForeground: _chunk3QBT3Q65cjs.mix.call(void 0, s.success, s.foreground, 0.3),
44
+ successSoftPressed: _chunk3QBT3Q65cjs.alpha.call(void 0, s.success, 0.2),
45
+ warningSoft: _chunk3QBT3Q65cjs.alpha.call(void 0, s.warning, 0.15),
46
+ warningSoftForeground: _chunk3QBT3Q65cjs.mix.call(void 0, s.warning, s.foreground, 0.35),
47
+ warningSoftPressed: _chunk3QBT3Q65cjs.alpha.call(void 0, s.warning, 0.2),
48
+ dangerSoft: _chunk3QBT3Q65cjs.alpha.call(void 0, s.danger, 0.15),
49
+ dangerSoftForeground: _chunk3QBT3Q65cjs.mix.call(void 0, s.danger, s.foreground, 0.2),
50
+ dangerSoftPressed: _chunk3QBT3Q65cjs.alpha.call(void 0, s.danger, 0.2),
51
+ backgroundSecondary: _chunk3QBT3Q65cjs.mix.call(void 0, s.background, s.foreground, 0.04),
52
+ backgroundTertiary: _chunk3QBT3Q65cjs.mix.call(void 0, s.background, s.foreground, 0.08),
52
53
  backgroundInverse: s.foreground,
53
- borderSecondary: _chunkM7P46XKIcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.22),
54
- borderTertiary: _chunkM7P46XKIcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.34),
55
- separatorSecondary: _chunkM7P46XKIcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.15),
56
- separatorTertiary: _chunkM7P46XKIcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.19),
57
- fieldPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.fieldBackground, s.fieldForeground, 0.1),
54
+ borderSecondary: _chunk3QBT3Q65cjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.22),
55
+ borderTertiary: _chunk3QBT3Q65cjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.34),
56
+ separatorSecondary: _chunk3QBT3Q65cjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.15),
57
+ separatorTertiary: _chunk3QBT3Q65cjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.19),
58
+ fieldPressed: _chunk3QBT3Q65cjs.mix.call(void 0, s.fieldBackground, s.fieldForeground, 0.1),
58
59
  fieldFocus: s.fieldBackground,
59
- fieldBorderPressed: _chunkM7P46XKIcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.12),
60
- fieldBorderFocus: _chunkM7P46XKIcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.26)
60
+ fieldBorderPressed: _chunk3QBT3Q65cjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.12),
61
+ fieldBorderFocus: _chunk3QBT3Q65cjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.26)
61
62
  };
62
63
  }
63
64
 
@@ -385,10 +386,6 @@ function createTheme(config = {}) {
385
386
  }
386
387
  var defaultTheme = createTheme();
387
388
 
388
- // src/theme/theme-context.ts
389
- var _react = require('react');
390
- var ThemeContext = _react.createContext.call(void 0, null);
391
-
392
389
  // src/provider/xaui-provider.tsx
393
390
  function XAUIProvider({
394
391
  children,
@@ -397,7 +394,7 @@ function XAUIProvider({
397
394
  }) {
398
395
  const scheme = _reactnative.useColorScheme.call(void 0, );
399
396
  const resolved = colorMode === "system" ? scheme === "dark" ? "dark" : "light" : colorMode;
400
- return /* @__PURE__ */ React.createElement(ThemeContext.Provider, { value: theme[resolved] }, children);
397
+ return /* @__PURE__ */ React.createElement(_chunk3QBT3Q65cjs.ThemeContext.Provider, { value: theme[resolved] }, children);
401
398
  }
402
399
 
403
400
  // src/theme/palette.ts
@@ -699,27 +696,6 @@ var primitives = {
699
696
  eclipse: "#18181b"
700
697
  };
701
698
 
702
- // src/theme/theme-hooks.ts
703
-
704
- function useXAUITheme() {
705
- const theme = _react.useContext.call(void 0, 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
-
720
-
721
-
722
-
723
699
 
724
700
 
725
701
 
@@ -731,4 +707,4 @@ function useThemeColor(token) {
731
707
 
732
708
 
733
709
 
734
- exports.deriveColors = deriveColors; exports.buildRadius = buildRadius; exports.buildShadows = buildShadows; exports.tokens = tokens; exports.sourceKeys = sourceKeys; exports.createTheme = createTheme; exports.defaultTheme = defaultTheme; exports.ThemeContext = ThemeContext; exports.XAUIProvider = XAUIProvider; exports.palette = palette; exports.primitives = primitives; exports.useXAUITheme = useXAUITheme; exports.useColorMode = useColorMode; exports.useThemeColor = useThemeColor;
710
+ exports.deriveColors = deriveColors; exports.buildRadius = buildRadius; exports.buildShadows = buildShadows; exports.tokens = tokens; exports.sourceKeys = sourceKeys; exports.createTheme = createTheme; exports.defaultTheme = defaultTheme; exports.XAUIProvider = XAUIProvider; exports.palette = palette; exports.primitives = primitives;