@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.
- package/dist/{chunk-PBVPOX7D.js → chunk-2KXQATVL.js} +3 -27
- package/dist/{chunk-M7P46XKI.cjs → chunk-3QBT3Q65.cjs} +27 -2
- package/dist/{chunk-NHPQQQ7P.cjs → chunk-AW63PTQ4.cjs} +33 -57
- package/dist/chunk-ECDWSSHJ.js +688 -0
- package/dist/chunk-IYFGO523.cjs +688 -0
- package/dist/{chunk-RBNCR5KB.js → chunk-X2K2FX3W.js} +25 -0
- package/dist/index.cjs +32 -4
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +36 -8
- package/dist/system/index.cjs +31 -3
- package/dist/system/index.d.cts +224 -3
- package/dist/system/index.d.ts +224 -3
- package/dist/system/index.js +32 -4
- package/dist/theme/index.cjs +3 -3
- package/dist/theme/index.d.cts +3 -2
- package/dist/theme/index.d.ts +3 -2
- package/dist/theme/index.js +6 -6
- package/dist/{theme.type-B3ODSLbB.d.cts → theme.type-C9bFJKFm.d.cts} +7 -1
- package/dist/{theme.type-B3ODSLbB.d.ts → theme.type-C9bFJKFm.d.ts} +7 -1
- package/package.json +1 -1
- package/dist/chunk-B755PRVJ.cjs +0 -274
- package/dist/chunk-RCP3SD26.js +0 -274
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ThemeContext,
|
|
2
3
|
alpha,
|
|
3
4
|
mix
|
|
4
|
-
} from "./chunk-
|
|
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/
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
30
|
-
successPressed:
|
|
31
|
-
warningPressed:
|
|
32
|
-
dangerPressed:
|
|
33
|
-
defaultPressed:
|
|
34
|
-
surfacePressed:
|
|
35
|
-
defaultSoft:
|
|
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:
|
|
38
|
-
accentSoft:
|
|
39
|
-
accentSoftForeground:
|
|
40
|
-
accentSoftPressed:
|
|
41
|
-
successSoft:
|
|
42
|
-
successSoftForeground:
|
|
43
|
-
successSoftPressed:
|
|
44
|
-
warningSoft:
|
|
45
|
-
warningSoftForeground:
|
|
46
|
-
warningSoftPressed:
|
|
47
|
-
dangerSoft:
|
|
48
|
-
dangerSoftForeground:
|
|
49
|
-
dangerSoftPressed:
|
|
50
|
-
backgroundSecondary:
|
|
51
|
-
backgroundTertiary:
|
|
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:
|
|
54
|
-
borderTertiary:
|
|
55
|
-
separatorSecondary:
|
|
56
|
-
separatorTertiary:
|
|
57
|
-
fieldPressed:
|
|
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:
|
|
60
|
-
fieldBorderFocus:
|
|
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.
|
|
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;
|