@xaui/native 0.9.1-alpha.1 → 0.9.1-alpha.10
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-NHPQQQ7P.cjs → chunk-2FEDC7U5.cjs} +34 -57
- package/dist/{chunk-M7P46XKI.cjs → chunk-3QBT3Q65.cjs} +27 -2
- package/dist/chunk-3TIDEII6.js +57 -0
- package/dist/chunk-66OVPWF4.js +716 -0
- package/dist/chunk-7D262JCJ.cjs +716 -0
- package/dist/{chunk-PBVPOX7D.js → chunk-7XGOXTGT.js} +5 -28
- package/dist/chunk-EQGTD5F6.js +353 -0
- package/dist/chunk-ERCOAOO6.cjs +353 -0
- package/dist/chunk-LMUPNKPH.cjs +57 -0
- package/dist/{chunk-RBNCR5KB.js → chunk-X2K2FX3W.js} +25 -0
- package/dist/components/button/index.cjs +12 -0
- package/dist/components/button/index.d.cts +192 -0
- package/dist/components/button/index.d.ts +192 -0
- package/dist/components/button/index.js +12 -0
- package/dist/create-recipe-BjSP0zL_.d.cts +210 -0
- package/dist/create-recipe-Dn9kj5Rs.d.ts +210 -0
- package/dist/index.cjs +116 -5
- package/dist/index.d.cts +73 -4
- package/dist/index.d.ts +73 -4
- package/dist/index.js +119 -8
- package/dist/system/index.cjs +49 -3
- package/dist/system/index.d.cts +251 -72
- package/dist/system/index.d.ts +251 -72
- package/dist/system/index.js +50 -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 +37 -11
- package/dist/chunk-KFCORXWW.cjs +0 -150
- package/dist/chunk-N357EQCZ.js +0 -150
|
@@ -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,11 +386,8 @@ 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
|
|
390
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
393
391
|
function XAUIProvider({
|
|
394
392
|
children,
|
|
395
393
|
theme = defaultTheme,
|
|
@@ -397,7 +395,7 @@ function XAUIProvider({
|
|
|
397
395
|
}) {
|
|
398
396
|
const scheme = _reactnative.useColorScheme.call(void 0, );
|
|
399
397
|
const resolved = colorMode === "system" ? scheme === "dark" ? "dark" : "light" : colorMode;
|
|
400
|
-
return /* @__PURE__ */
|
|
398
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3QBT3Q65cjs.ThemeContext.Provider, { value: theme[resolved], children });
|
|
401
399
|
}
|
|
402
400
|
|
|
403
401
|
// src/theme/palette.ts
|
|
@@ -699,27 +697,6 @@ var primitives = {
|
|
|
699
697
|
eclipse: "#18181b"
|
|
700
698
|
};
|
|
701
699
|
|
|
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
700
|
|
|
724
701
|
|
|
725
702
|
|
|
@@ -731,4 +708,4 @@ function useThemeColor(token) {
|
|
|
731
708
|
|
|
732
709
|
|
|
733
710
|
|
|
734
|
-
exports.deriveColors = deriveColors; exports.buildRadius = buildRadius; exports.buildShadows = buildShadows; exports.tokens = tokens; exports.sourceKeys = sourceKeys; exports.createTheme = createTheme; exports.defaultTheme = defaultTheme; exports.
|
|
711
|
+
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;
|
|
@@ -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;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// src/system/portal/portal.tsx
|
|
2
|
+
import { useContext, useId, useLayoutEffect } from "react";
|
|
3
|
+
|
|
4
|
+
// src/system/portal/portal-context.ts
|
|
5
|
+
import { createContext } from "react";
|
|
6
|
+
var PortalContext = createContext(null);
|
|
7
|
+
|
|
8
|
+
// src/system/portal/portal.tsx
|
|
9
|
+
function Portal({ children }) {
|
|
10
|
+
const context = useContext(PortalContext);
|
|
11
|
+
const key = useId();
|
|
12
|
+
useLayoutEffect(() => {
|
|
13
|
+
context?.addPortal(key, children);
|
|
14
|
+
}, [children, context, key]);
|
|
15
|
+
useLayoutEffect(() => {
|
|
16
|
+
return () => context?.removePortal(key);
|
|
17
|
+
}, [context, key]);
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
Portal.displayName = "XAUI.Portal";
|
|
21
|
+
|
|
22
|
+
// src/system/portal/portal-host.tsx
|
|
23
|
+
import { Fragment, useCallback, useMemo, useState } from "react";
|
|
24
|
+
import { StyleSheet, View } from "react-native";
|
|
25
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
26
|
+
var styles = StyleSheet.create({
|
|
27
|
+
container: { flex: 1 }
|
|
28
|
+
});
|
|
29
|
+
function PortalHost({ children }) {
|
|
30
|
+
const [portals, setPortals] = useState(/* @__PURE__ */ new Map());
|
|
31
|
+
const addPortal = useCallback((key, element) => {
|
|
32
|
+
setPortals((current) => new Map(current).set(key, element));
|
|
33
|
+
}, []);
|
|
34
|
+
const removePortal = useCallback((key) => {
|
|
35
|
+
setPortals((current) => {
|
|
36
|
+
if (!current.has(key)) return current;
|
|
37
|
+
const next = new Map(current);
|
|
38
|
+
next.delete(key);
|
|
39
|
+
return next;
|
|
40
|
+
});
|
|
41
|
+
}, []);
|
|
42
|
+
const methods = useMemo(
|
|
43
|
+
() => ({ addPortal, removePortal }),
|
|
44
|
+
[addPortal, removePortal]
|
|
45
|
+
);
|
|
46
|
+
return /* @__PURE__ */ jsx(PortalContext.Provider, { value: methods, children: /* @__PURE__ */ jsxs(View, { style: styles.container, children: [
|
|
47
|
+
children,
|
|
48
|
+
Array.from(portals, ([key, element]) => /* @__PURE__ */ jsx(Fragment, { children: element }, key))
|
|
49
|
+
] }) });
|
|
50
|
+
}
|
|
51
|
+
PortalHost.displayName = "XAUI.PortalHost";
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
PortalContext,
|
|
55
|
+
Portal,
|
|
56
|
+
PortalHost
|
|
57
|
+
};
|