@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.
@@ -2,63 +2,47 @@
2
2
 
3
3
 
4
4
 
5
- var _chunk3QBT3Q65cjs = require('./chunk-3QBT3Q65.cjs');
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: _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),
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: _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),
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: _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),
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: _chunk3QBT3Q65cjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.12),
61
- fieldBorderFocus: _chunk3QBT3Q65cjs.mix.call(void 0, s.fieldBorder, s.fieldForeground, 0.26)
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, _chunk3QBT3Q65cjs.ThemeContext.Provider, { value: theme[resolved], children });
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});// src/theme/theme-context.ts
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;