@xaui/native 0.9.1-alpha.11 → 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-6OHFG32Y.cjs → chunk-CTULMYVI.cjs} +34 -33
- 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-NQ5WWF77.js → chunk-SKVKAJ5Y.js} +28 -27
- 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 +160 -35
- package/dist/system/index.d.ts +160 -35
- package/dist/system/index.js +31 -11
- package/dist/theme/index.cjs +3 -3
- package/dist/theme/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-E2UGZJBT.cjs +0 -959
- package/dist/chunk-R4HJCQPI.js +0 -889
- /package/dist/{chunk-LMUPNKPH.cjs → chunk-2FOEFUPM.cjs} +0 -0
- /package/dist/{chunk-3TIDEII6.js → chunk-TO6DAGFB.js} +0 -0
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ThemeContext,
|
|
3
3
|
alpha,
|
|
4
|
-
mix
|
|
5
|
-
|
|
4
|
+
mix,
|
|
5
|
+
stableHash
|
|
6
|
+
} from "./chunk-EMXBFHIP.js";
|
|
6
7
|
|
|
7
8
|
// src/provider/xaui-provider.tsx
|
|
8
9
|
import { useColorScheme } from "react-native";
|
|
9
10
|
|
|
10
|
-
// src/utils/stable-hash.ts
|
|
11
|
-
function canonical(value) {
|
|
12
|
-
if (value === null || typeof value !== "object") return 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 {
|
|
@@ -36,11 +36,11 @@ function _optionalChain(ops) {
|
|
|
36
36
|
}
|
|
37
37
|
return value;
|
|
38
38
|
}
|
|
39
|
-
var
|
|
40
|
-
var
|
|
39
|
+
var _chunkGZIOB63Ocjs = require('./chunk-GZIOB63O.cjs');
|
|
40
|
+
var _chunkFDUI4IAMcjs = require('./chunk-FDUI4IAM.cjs');
|
|
41
41
|
|
|
42
42
|
// src/components/button/button.context.ts
|
|
43
|
-
var [ButtonProvider, useButton] =
|
|
43
|
+
var [ButtonProvider, useButton] = _chunkGZIOB63Ocjs.createSlotContext.call(void 0, "Button");
|
|
44
44
|
|
|
45
45
|
// src/components/button/button-icon.tsx
|
|
46
46
|
var _jsxruntime = require('react/jsx-runtime');
|
|
@@ -52,7 +52,7 @@ function ButtonIcon({
|
|
|
52
52
|
const {
|
|
53
53
|
icon
|
|
54
54
|
} = useButton();
|
|
55
|
-
return /* @__PURE__ */_jsxruntime.jsx.call(void 0,
|
|
55
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _chunkGZIOB63Ocjs.Icon, {
|
|
56
56
|
size: _nullishCoalesce(size, () => icon.size),
|
|
57
57
|
color: _nullishCoalesce(color, () => icon.color),
|
|
58
58
|
...rest
|
|
@@ -67,15 +67,16 @@ var ButtonLabel = _react.forwardRef.call(void 0, function ButtonLabel2({
|
|
|
67
67
|
children,
|
|
68
68
|
style,
|
|
69
69
|
numberOfLines = 1,
|
|
70
|
-
...
|
|
70
|
+
...props
|
|
71
71
|
}, ref) {
|
|
72
72
|
const {
|
|
73
73
|
labelStyle
|
|
74
74
|
} = useButton();
|
|
75
|
+
const [styleProps, rest] = _chunkGZIOB63Ocjs.useStyleProps.call(void 0, props);
|
|
75
76
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.Text, {
|
|
76
77
|
ref,
|
|
77
78
|
numberOfLines,
|
|
78
|
-
style: [labelStyle, style],
|
|
79
|
+
style: [labelStyle, styleProps, style],
|
|
79
80
|
...rest,
|
|
80
81
|
children
|
|
81
82
|
});
|
|
@@ -89,23 +90,26 @@ var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
|
89
90
|
var ROTATION_DURATION = 800;
|
|
90
91
|
function ButtonSpinner({
|
|
91
92
|
style,
|
|
92
|
-
animation = true
|
|
93
|
+
animation = true,
|
|
94
|
+
...props
|
|
93
95
|
}) {
|
|
94
96
|
const {
|
|
95
97
|
spinnerStyle
|
|
96
98
|
} = useButton();
|
|
99
|
+
const [styleProps] = _chunkGZIOB63Ocjs.useStyleProps.call(void 0, props);
|
|
100
|
+
const ringStyle = [spinnerStyle, styleProps, style];
|
|
97
101
|
if (!animation) return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
|
|
98
|
-
style:
|
|
102
|
+
style: ringStyle
|
|
99
103
|
});
|
|
100
104
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, SpinningRing, {
|
|
101
|
-
style:
|
|
105
|
+
style: ringStyle
|
|
102
106
|
});
|
|
103
107
|
}
|
|
104
108
|
ButtonSpinner.displayName = "XAUI.Button.Spinner";
|
|
105
|
-
const
|
|
106
|
-
code: "function
|
|
107
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-
|
|
108
|
-
sourceMap: "{\"version\":3,\"names\":[\"
|
|
109
|
+
const _worklet_5280721983457_init_data = {
|
|
110
|
+
code: "function chunkCTULMYVICjs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
|
|
111
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-CTULMYVI.cjs",
|
|
112
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkCTULMYVICjs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-CTULMYVI.cjs\"],\"mappings\":\"AA0E6E,SAAAA,iBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE/E,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
|
|
109
113
|
};
|
|
110
114
|
function SpinningRing({
|
|
111
115
|
style
|
|
@@ -118,28 +122,28 @@ function SpinningRing({
|
|
|
118
122
|
}), -1, false);
|
|
119
123
|
return () => _reactnativereanimated.cancelAnimation.call(void 0, angle);
|
|
120
124
|
}, [angle]);
|
|
121
|
-
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function
|
|
122
|
-
|
|
125
|
+
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkCTULMYVICjs1Factory({
|
|
126
|
+
_worklet_5280721983457_init_data,
|
|
123
127
|
angle
|
|
124
128
|
}) {
|
|
125
129
|
const _e = [new global.Error(), -2, -27];
|
|
126
|
-
const
|
|
130
|
+
const chunkCTULMYVICjs1 = function () {
|
|
127
131
|
return {
|
|
128
132
|
transform: [{
|
|
129
133
|
rotate: `${angle.value}deg`
|
|
130
134
|
}]
|
|
131
135
|
};
|
|
132
136
|
};
|
|
133
|
-
|
|
137
|
+
chunkCTULMYVICjs1.__closure = {
|
|
134
138
|
angle
|
|
135
139
|
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return
|
|
140
|
+
chunkCTULMYVICjs1.__workletHash = 5280721983457;
|
|
141
|
+
chunkCTULMYVICjs1.__pluginVersion = "0.7.4";
|
|
142
|
+
chunkCTULMYVICjs1.__initData = _worklet_5280721983457_init_data;
|
|
143
|
+
chunkCTULMYVICjs1.__stackDetails = _e;
|
|
144
|
+
return chunkCTULMYVICjs1;
|
|
141
145
|
}({
|
|
142
|
-
|
|
146
|
+
_worklet_5280721983457_init_data,
|
|
143
147
|
angle
|
|
144
148
|
}), [angle]);
|
|
145
149
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
|
|
@@ -263,7 +267,7 @@ function sizeAxis(step) {
|
|
|
263
267
|
spinner: ring(theme, theme.fontSizes[glyph])
|
|
264
268
|
});
|
|
265
269
|
}
|
|
266
|
-
var buttonRecipe =
|
|
270
|
+
var buttonRecipe = _chunkGZIOB63Ocjs.createRecipe.call(void 0, {
|
|
267
271
|
slots: SLOTS,
|
|
268
272
|
base: theme => ({
|
|
269
273
|
root: {
|
|
@@ -444,17 +448,15 @@ var ButtonRoot = _react.forwardRef.call(void 0, function Button({
|
|
|
444
448
|
isLoading = false,
|
|
445
449
|
isIconOnly = false,
|
|
446
450
|
asChild = false,
|
|
447
|
-
// `scale` and not `scale-highlight`: the recipe's `pressed` state already paints the
|
|
448
|
-
// variant's own pressed colour, and a neutral wash on top would darken it twice.
|
|
449
|
-
feedbackVariant = "scale",
|
|
450
451
|
accessibilityRole = "button",
|
|
451
452
|
accessibilityState,
|
|
452
453
|
style,
|
|
453
454
|
onPressIn,
|
|
454
455
|
onPressOut,
|
|
455
|
-
...
|
|
456
|
+
...props
|
|
456
457
|
}, ref) {
|
|
457
|
-
const theme =
|
|
458
|
+
const theme = _chunkFDUI4IAMcjs.useXAUITheme.call(void 0);
|
|
459
|
+
const [styleProps, rest] = _chunkGZIOB63Ocjs.useStyleProps.call(void 0, props);
|
|
458
460
|
const [isPressed, press] = usePressState({
|
|
459
461
|
onPressIn,
|
|
460
462
|
onPressOut
|
|
@@ -495,22 +497,21 @@ var ButtonRoot = _react.forwardRef.call(void 0, function Button({
|
|
|
495
497
|
isLoading
|
|
496
498
|
};
|
|
497
499
|
}, [styles, tint, isDisabled, isLoading]);
|
|
498
|
-
const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _8 => _8.root]), typeof style === "function" ? style({
|
|
500
|
+
const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _8 => _8.root]), styleProps, typeof style === "function" ? style({
|
|
499
501
|
pressed: isPressed
|
|
500
502
|
}) : style];
|
|
501
|
-
const text =
|
|
503
|
+
const text = _chunkGZIOB63Ocjs.childrenToString.call(void 0, children);
|
|
502
504
|
const showSpinner = isLoading && !containsElementOfType(children, ButtonSpinner);
|
|
503
505
|
if (isIconOnly && !rest.accessibilityLabel && !rest["aria-label"]) {
|
|
504
506
|
warnDev("Button: an icon-only button needs an `accessibilityLabel` \u2014 there is no text for a screen reader to read, so it announces as an unlabelled button.");
|
|
505
507
|
}
|
|
506
508
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, ButtonProvider, {
|
|
507
509
|
value: context,
|
|
508
|
-
children: /* @__PURE__ */_jsxruntime.jsx.call(void 0,
|
|
510
|
+
children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, _chunkGZIOB63Ocjs.PressableFeedback, {
|
|
509
511
|
ref,
|
|
510
512
|
isPressed,
|
|
511
513
|
isDisabled: isDisabled || isLoading,
|
|
512
514
|
asChild,
|
|
513
|
-
feedbackVariant,
|
|
514
515
|
accessibilityRole,
|
|
515
516
|
accessibilityState: {
|
|
516
517
|
disabled: isDisabled,
|
|
@@ -114,12 +114,32 @@ 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 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
|
+
|
|
117
134
|
export {
|
|
118
135
|
ThemeContext,
|
|
119
136
|
useXAUITheme,
|
|
120
137
|
useColorMode,
|
|
121
138
|
useThemeColor,
|
|
139
|
+
stableHash,
|
|
140
|
+
isHex,
|
|
122
141
|
mix,
|
|
123
142
|
alpha,
|
|
143
|
+
contrastOn,
|
|
124
144
|
deriveTint
|
|
125
145
|
};
|
|
@@ -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;
|