@xaui/native 0.9.1-alpha.10 → 0.9.1-alpha.12
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-7XGOXTGT.js → chunk-5TKZV7IC.js} +3 -19
- package/dist/chunk-CTULMYVI.cjs +545 -0
- package/dist/{chunk-X2K2FX3W.js → chunk-EMXBFHIP.js} +20 -0
- package/dist/{chunk-2FEDC7U5.cjs → chunk-ESOOMXV4.cjs} +33 -49
- package/dist/{chunk-3QBT3Q65.cjs → chunk-FDUI4IAM.cjs} +22 -2
- package/dist/chunk-GZIOB63O.cjs +1044 -0
- package/dist/chunk-KLHHV4RU.js +1010 -0
- package/dist/chunk-SKVKAJ5Y.js +507 -0
- package/dist/components/button/index.cjs +4 -4
- package/dist/components/button/index.d.cts +147 -8
- package/dist/components/button/index.d.ts +147 -8
- package/dist/components/button/index.js +3 -3
- package/dist/{create-recipe-Dn9kj5Rs.d.ts → create-recipe-3OPwcC6P.d.ts} +81 -21
- package/dist/{create-recipe-BjSP0zL_.d.cts → create-recipe-oiLAlJ4u.d.cts} +81 -21
- package/dist/index.cjs +28 -8
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -12
- package/dist/system/index.cjs +24 -4
- package/dist/system/index.d.cts +159 -31
- package/dist/system/index.d.ts +159 -31
- package/dist/system/index.js +31 -11
- package/dist/theme/index.cjs +3 -3
- package/dist/theme/index.js +2 -2
- package/package.json +8 -8
- package/dist/chunk-66OVPWF4.js +0 -716
- package/dist/chunk-7D262JCJ.cjs +0 -716
- package/dist/chunk-EQGTD5F6.js +0 -353
- package/dist/chunk-ERCOAOO6.cjs +0 -353
- /package/dist/{chunk-LMUPNKPH.cjs → chunk-2FOEFUPM.cjs} +0 -0
- /package/dist/{chunk-3TIDEII6.js → chunk-TO6DAGFB.js} +0 -0
|
@@ -2,63 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
var _chunkFDUI4IAMcjs = require('./chunk-FDUI4IAM.cjs');
|
|
6
7
|
|
|
7
8
|
// src/provider/xaui-provider.tsx
|
|
8
9
|
var _reactnative = require('react-native');
|
|
9
10
|
|
|
10
|
-
// src/utils/stable-hash.ts
|
|
11
|
-
function canonical(value) {
|
|
12
|
-
if (value === null || typeof value !== "object") return _nullishCoalesce(JSON.stringify(value), () => ( "null"));
|
|
13
|
-
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
14
|
-
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)}`);
|
|
15
|
-
return `{${entries.join(",")}}`;
|
|
16
|
-
}
|
|
17
|
-
function stableHash(value) {
|
|
18
|
-
const input = canonical(value);
|
|
19
|
-
let hash = 2166136261;
|
|
20
|
-
for (let i = 0; i < input.length; i++) {
|
|
21
|
-
hash ^= input.charCodeAt(i);
|
|
22
|
-
hash = Math.imul(hash, 16777619) >>> 0;
|
|
23
|
-
}
|
|
24
|
-
return hash.toString(36);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
11
|
// src/theme/derive-colors.ts
|
|
28
12
|
function deriveColors(s) {
|
|
29
13
|
return {
|
|
30
|
-
accentPressed:
|
|
31
|
-
successPressed:
|
|
32
|
-
warningPressed:
|
|
33
|
-
dangerPressed:
|
|
34
|
-
defaultPressed:
|
|
35
|
-
surfacePressed:
|
|
36
|
-
defaultSoft:
|
|
14
|
+
accentPressed: _chunkFDUI4IAMcjs.mix.call(void 0, s.accent, s.accentForeground, 0.1),
|
|
15
|
+
successPressed: _chunkFDUI4IAMcjs.mix.call(void 0, s.success, s.successForeground, 0.1),
|
|
16
|
+
warningPressed: _chunkFDUI4IAMcjs.mix.call(void 0, s.warning, s.warningForeground, 0.1),
|
|
17
|
+
dangerPressed: _chunkFDUI4IAMcjs.mix.call(void 0, s.danger, s.dangerForeground, 0.1),
|
|
18
|
+
defaultPressed: _chunkFDUI4IAMcjs.mix.call(void 0, s.default, s.defaultForeground, 0.04),
|
|
19
|
+
surfacePressed: _chunkFDUI4IAMcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.08),
|
|
20
|
+
defaultSoft: _chunkFDUI4IAMcjs.alpha.call(void 0, s.default, 0.5),
|
|
37
21
|
defaultSoftForeground: s.defaultForeground,
|
|
38
|
-
defaultSoftPressed:
|
|
39
|
-
accentSoft:
|
|
40
|
-
accentSoftForeground:
|
|
41
|
-
accentSoftPressed:
|
|
42
|
-
successSoft:
|
|
43
|
-
successSoftForeground:
|
|
44
|
-
successSoftPressed:
|
|
45
|
-
warningSoft:
|
|
46
|
-
warningSoftForeground:
|
|
47
|
-
warningSoftPressed:
|
|
48
|
-
dangerSoft:
|
|
49
|
-
dangerSoftForeground:
|
|
50
|
-
dangerSoftPressed:
|
|
51
|
-
backgroundSecondary:
|
|
52
|
-
backgroundTertiary:
|
|
22
|
+
defaultSoftPressed: _chunkFDUI4IAMcjs.alpha.call(void 0, s.default, 0.6),
|
|
23
|
+
accentSoft: _chunkFDUI4IAMcjs.alpha.call(void 0, s.accent, 0.15),
|
|
24
|
+
accentSoftForeground: _chunkFDUI4IAMcjs.mix.call(void 0, s.accent, s.foreground, 0.2),
|
|
25
|
+
accentSoftPressed: _chunkFDUI4IAMcjs.alpha.call(void 0, s.accent, 0.2),
|
|
26
|
+
successSoft: _chunkFDUI4IAMcjs.alpha.call(void 0, s.success, 0.15),
|
|
27
|
+
successSoftForeground: _chunkFDUI4IAMcjs.mix.call(void 0, s.success, s.foreground, 0.3),
|
|
28
|
+
successSoftPressed: _chunkFDUI4IAMcjs.alpha.call(void 0, s.success, 0.2),
|
|
29
|
+
warningSoft: _chunkFDUI4IAMcjs.alpha.call(void 0, s.warning, 0.15),
|
|
30
|
+
warningSoftForeground: _chunkFDUI4IAMcjs.mix.call(void 0, s.warning, s.foreground, 0.35),
|
|
31
|
+
warningSoftPressed: _chunkFDUI4IAMcjs.alpha.call(void 0, s.warning, 0.2),
|
|
32
|
+
dangerSoft: _chunkFDUI4IAMcjs.alpha.call(void 0, s.danger, 0.15),
|
|
33
|
+
dangerSoftForeground: _chunkFDUI4IAMcjs.mix.call(void 0, s.danger, s.foreground, 0.2),
|
|
34
|
+
dangerSoftPressed: _chunkFDUI4IAMcjs.alpha.call(void 0, s.danger, 0.2),
|
|
35
|
+
backgroundSecondary: _chunkFDUI4IAMcjs.mix.call(void 0, s.background, s.foreground, 0.04),
|
|
36
|
+
backgroundTertiary: _chunkFDUI4IAMcjs.mix.call(void 0, s.background, s.foreground, 0.08),
|
|
53
37
|
backgroundInverse: s.foreground,
|
|
54
|
-
borderSecondary:
|
|
55
|
-
borderTertiary:
|
|
56
|
-
separatorSecondary:
|
|
57
|
-
separatorTertiary:
|
|
58
|
-
fieldPressed:
|
|
38
|
+
borderSecondary: _chunkFDUI4IAMcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.22),
|
|
39
|
+
borderTertiary: _chunkFDUI4IAMcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.34),
|
|
40
|
+
separatorSecondary: _chunkFDUI4IAMcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.15),
|
|
41
|
+
separatorTertiary: _chunkFDUI4IAMcjs.mix.call(void 0, s.surface, s.surfaceForeground, 0.19),
|
|
42
|
+
fieldPressed: _chunkFDUI4IAMcjs.mix.call(void 0, s.fieldBackground, s.fieldForeground, 0.1),
|
|
59
43
|
fieldFocus: s.fieldBackground,
|
|
60
|
-
fieldBorderPressed:
|
|
61
|
-
fieldBorderFocus:
|
|
44
|
+
fieldBorderPressed: _chunkFDUI4IAMcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.12),
|
|
45
|
+
fieldBorderFocus: _chunkFDUI4IAMcjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.26)
|
|
62
46
|
};
|
|
63
47
|
}
|
|
64
48
|
|
|
@@ -377,7 +361,7 @@ function resolveMode(mode, config, id) {
|
|
|
377
361
|
};
|
|
378
362
|
}
|
|
379
363
|
function createTheme(config = {}) {
|
|
380
|
-
const id = stableHash(config);
|
|
364
|
+
const id = _chunkFDUI4IAMcjs.stableHash.call(void 0, config);
|
|
381
365
|
return {
|
|
382
366
|
id,
|
|
383
367
|
light: resolveMode("light", config, id),
|
|
@@ -395,7 +379,7 @@ function XAUIProvider({
|
|
|
395
379
|
}) {
|
|
396
380
|
const scheme = _reactnative.useColorScheme.call(void 0, );
|
|
397
381
|
const resolved = colorMode === "system" ? scheme === "dark" ? "dark" : "light" : colorMode;
|
|
398
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
382
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFDUI4IAMcjs.ThemeContext.Provider, { value: theme[resolved], children });
|
|
399
383
|
}
|
|
400
384
|
|
|
401
385
|
// src/theme/palette.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/theme/theme-context.ts
|
|
2
2
|
var _react = require('react');
|
|
3
3
|
var ThemeContext = _react.createContext.call(void 0, null);
|
|
4
4
|
|
|
@@ -114,6 +114,26 @@ function deriveTint(tint, theme) {
|
|
|
114
114
|
return derived;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
// src/utils/stable-hash.ts
|
|
118
|
+
function canonical(value) {
|
|
119
|
+
if (value === null || typeof value !== "object") return _nullishCoalesce(JSON.stringify(value), () => ( "null"));
|
|
120
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
121
|
+
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)}`);
|
|
122
|
+
return `{${entries.join(",")}}`;
|
|
123
|
+
}
|
|
124
|
+
function stableHash(value) {
|
|
125
|
+
const input = canonical(value);
|
|
126
|
+
let hash = 2166136261;
|
|
127
|
+
for (let i = 0; i < input.length; i++) {
|
|
128
|
+
hash ^= input.charCodeAt(i);
|
|
129
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
130
|
+
}
|
|
131
|
+
return hash.toString(36);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
117
137
|
|
|
118
138
|
|
|
119
139
|
|
|
@@ -122,4 +142,4 @@ function deriveTint(tint, theme) {
|
|
|
122
142
|
|
|
123
143
|
|
|
124
144
|
|
|
125
|
-
exports.ThemeContext = ThemeContext; exports.useXAUITheme = useXAUITheme; exports.useColorMode = useColorMode; exports.useThemeColor = useThemeColor; exports.mix = mix; exports.alpha = alpha; exports.deriveTint = deriveTint;
|
|
145
|
+
exports.ThemeContext = ThemeContext; exports.useXAUITheme = useXAUITheme; exports.useColorMode = useColorMode; exports.useThemeColor = useThemeColor; exports.stableHash = stableHash; exports.isHex = isHex; exports.mix = mix; exports.alpha = alpha; exports.contrastOn = contrastOn; exports.deriveTint = deriveTint;
|