@kbach/react-native 1.0.0-beta.0 → 1.0.0-beta.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/README.md +103 -54
- package/android/build.gradle +36 -0
- package/android/src/main/AndroidManifest.xml +14 -0
- package/android/src/main/java/com/kbachnative/KbachModule.kt +83 -0
- package/android/src/main/java/com/kbachnative/KbachPackage.kt +54 -0
- package/android/src/main/jniLibs/arm64-v8a/libkbach_core_engine.so +0 -0
- package/android/src/main/jniLibs/x86_64/libkbach_core_engine.so +0 -0
- package/dist/chunk-4N7UEVQL.mjs +14 -0
- package/dist/{chunk-SVMYVXY6.mjs → chunk-DLIXI5OW.mjs} +23 -14
- package/dist/chunk-H5Z24XX5.mjs +192 -0
- package/dist/{chunk-YHF3QLRL.mjs → chunk-HK6PDJJK.mjs} +61 -68
- package/dist/chunk-RBJXE32L.mjs +73 -0
- package/dist/chunk-TDWBXJH5.mjs +186 -0
- package/dist/chunk-XHL653X2.mjs +1211 -0
- package/dist/chunk-YOC3SHF5.mjs +40 -0
- package/dist/index.d.mts +37 -102
- package/dist/index.d.ts +37 -102
- package/dist/index.js +1411 -38
- package/dist/index.mjs +19 -61
- package/dist/index.web.d.mts +15 -0
- package/dist/index.web.d.ts +15 -0
- package/dist/index.web.js +829 -0
- package/dist/index.web.mjs +38 -0
- package/dist/jsx-dev-runtime.d.mts +3 -12
- package/dist/jsx-dev-runtime.d.ts +3 -12
- package/dist/jsx-dev-runtime.js +1314 -47
- package/dist/jsx-dev-runtime.mjs +9 -11
- package/dist/jsx-dev-runtime.web.d.mts +10 -0
- package/dist/jsx-dev-runtime.web.d.ts +10 -0
- package/dist/jsx-dev-runtime.web.js +618 -0
- package/dist/jsx-dev-runtime.web.mjs +17 -0
- package/dist/jsx-runtime.d.mts +3 -23
- package/dist/jsx-runtime.d.ts +3 -23
- package/dist/jsx-runtime.js +1305 -39
- package/dist/jsx-runtime.mjs +7 -3
- package/dist/jsx-runtime.web.d.mts +7 -0
- package/dist/jsx-runtime.web.d.ts +7 -0
- package/dist/jsx-runtime.web.js +602 -0
- package/dist/jsx-runtime.web.mjs +12 -0
- package/dist/useColors-C6jyCLuG.d.mts +239 -0
- package/dist/useColors-C6jyCLuG.d.ts +239 -0
- package/package.json +57 -5
- package/react-native.config.js +29 -0
- package/specs/NativeKbachModule.ts +31 -0
- package/src/babel-plugin.js +74 -2
|
@@ -278,19 +278,73 @@ var PALETTE = {
|
|
|
278
278
|
// src/theme.ts
|
|
279
279
|
var defaultTheme = {
|
|
280
280
|
colors: PALETTE,
|
|
281
|
+
// Real Tailwind's default spacing scale in full — every step is exactly
|
|
282
|
+
// `n * 4px`, including the fractional `.5` steps (`1.5` -> 6px, `2.5` ->
|
|
283
|
+
// 10px, `3.5` -> 14px) and the "px" literal (a bare 1px). Only the
|
|
284
|
+
// "usual stops", though — `jsEngine/shared.ts`'s `spacingPx` (and the
|
|
285
|
+
// native Rust dispatcher's own `spacing_px`) falls back to Tailwind v4's
|
|
286
|
+
// live `n * 4px` formula for any bare numeric step not listed here
|
|
287
|
+
// (`p-0.25`, `w-13`, ...), so this table names the common values and
|
|
288
|
+
// gives a theme override something to target, not the full resolvable
|
|
289
|
+
// set. Mirrors @kbach/react's theme.ts exactly.
|
|
281
290
|
spacing: {
|
|
282
|
-
// "0" is always a hardcoded zero in real Tailwind's own scale too,
|
|
283
|
-
// regardless of the base spacing unit — needed for `p-0`/`m-0`/etc.
|
|
284
|
-
// Mirrors the identical fix in @kbach/react's theme.ts.
|
|
285
291
|
"0": 0,
|
|
292
|
+
"px": 1,
|
|
293
|
+
"0.5": 2,
|
|
286
294
|
"1": 4,
|
|
295
|
+
"1.5": 6,
|
|
287
296
|
"2": 8,
|
|
297
|
+
"2.5": 10,
|
|
298
|
+
"3": 12,
|
|
299
|
+
"3.5": 14,
|
|
288
300
|
"4": 16,
|
|
301
|
+
"5": 20,
|
|
289
302
|
"6": 24,
|
|
290
|
-
"
|
|
303
|
+
"7": 28,
|
|
304
|
+
"8": 32,
|
|
305
|
+
"9": 36,
|
|
306
|
+
"10": 40,
|
|
307
|
+
"11": 44,
|
|
308
|
+
"12": 48,
|
|
309
|
+
"14": 56,
|
|
310
|
+
"16": 64,
|
|
311
|
+
"20": 80,
|
|
312
|
+
"24": 96,
|
|
313
|
+
"28": 112,
|
|
314
|
+
"32": 128,
|
|
315
|
+
"36": 144,
|
|
316
|
+
"40": 160,
|
|
317
|
+
"44": 176,
|
|
318
|
+
"48": 192,
|
|
319
|
+
"52": 208,
|
|
320
|
+
"56": 224,
|
|
321
|
+
"60": 240,
|
|
322
|
+
"64": 256,
|
|
323
|
+
"72": 288,
|
|
324
|
+
"80": 320,
|
|
325
|
+
"96": 384
|
|
291
326
|
},
|
|
292
|
-
screens: {
|
|
293
|
-
|
|
327
|
+
screens: {
|
|
328
|
+
sm: 640,
|
|
329
|
+
md: 768,
|
|
330
|
+
lg: 1024,
|
|
331
|
+
xl: 1280,
|
|
332
|
+
"2xl": 1536
|
|
333
|
+
},
|
|
334
|
+
// Byte-for-byte the same three stacks
|
|
335
|
+
// packages/core-engine/src/resolvers/typography.rs's `font_family_value`
|
|
336
|
+
// falls back to. On native these three still effectively no-op (see
|
|
337
|
+
// `first_font_name`'s own doc comment for why a generic CSS keyword
|
|
338
|
+
// isn't a real loadable font) — only a caller-configured custom name
|
|
339
|
+
// changes native rendering; Expo Web uses the full stack as-is.
|
|
340
|
+
fontFamily: {
|
|
341
|
+
sans: 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
|
|
342
|
+
serif: 'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',
|
|
343
|
+
mono: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
|
|
344
|
+
},
|
|
345
|
+
darkMode: "attribute",
|
|
346
|
+
// Empty by default, matching real Tailwind's own defaults.
|
|
347
|
+
container: {}
|
|
294
348
|
};
|
|
295
349
|
var activeTheme = defaultTheme;
|
|
296
350
|
var activeThemeJson = JSON.stringify(defaultTheme);
|
|
@@ -305,70 +359,9 @@ function getThemeJson() {
|
|
|
305
359
|
return activeThemeJson;
|
|
306
360
|
}
|
|
307
361
|
|
|
308
|
-
// src/darkModeStore.ts
|
|
309
|
-
import { Appearance } from "react-native";
|
|
310
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
311
|
-
function systemPrefersDark() {
|
|
312
|
-
return Appearance.getColorScheme() === "dark";
|
|
313
|
-
}
|
|
314
|
-
function resolveIsDark(m) {
|
|
315
|
-
return m === "system" ? systemPrefersDark() : m === "dark";
|
|
316
|
-
}
|
|
317
|
-
var mode = "system";
|
|
318
|
-
var isDark = resolveIsDark(mode);
|
|
319
|
-
var hasExplicitChoice = false;
|
|
320
|
-
var subscription = Appearance.addChangeListener(({ colorScheme }) => {
|
|
321
|
-
if (mode !== "system") return;
|
|
322
|
-
isDark = colorScheme === "dark";
|
|
323
|
-
notify();
|
|
324
|
-
});
|
|
325
|
-
function notify() {
|
|
326
|
-
for (const listener of listeners) listener();
|
|
327
|
-
}
|
|
328
|
-
function getGlobalDarkMode() {
|
|
329
|
-
return isDark;
|
|
330
|
-
}
|
|
331
|
-
function getGlobalThemeMode() {
|
|
332
|
-
return mode;
|
|
333
|
-
}
|
|
334
|
-
function setGlobalThemeMode(nextMode) {
|
|
335
|
-
mode = nextMode;
|
|
336
|
-
isDark = resolveIsDark(nextMode);
|
|
337
|
-
hasExplicitChoice = true;
|
|
338
|
-
notify();
|
|
339
|
-
}
|
|
340
|
-
function toggleGlobalDarkMode() {
|
|
341
|
-
setGlobalThemeMode(isDark ? "light" : "dark");
|
|
342
|
-
}
|
|
343
|
-
function subscribeGlobalDarkMode(listener) {
|
|
344
|
-
listeners.add(listener);
|
|
345
|
-
return () => listeners.delete(listener);
|
|
346
|
-
}
|
|
347
|
-
function seedDefaultMode(fallback) {
|
|
348
|
-
if (hasExplicitChoice || mode === fallback) return;
|
|
349
|
-
mode = fallback;
|
|
350
|
-
isDark = resolveIsDark(fallback);
|
|
351
|
-
notify();
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// src/nativeBridge.ts
|
|
355
|
-
import { TurboModuleRegistry } from "react-native";
|
|
356
|
-
function resolveStyle(classString, pressed = false) {
|
|
357
|
-
const KbachModule = TurboModuleRegistry.getEnforcing("KbachModule");
|
|
358
|
-
const colorScheme = getGlobalDarkMode() ? "dark" : "light";
|
|
359
|
-
const json = KbachModule.resolveStyle(classString, getThemeJson(), colorScheme, pressed);
|
|
360
|
-
return JSON.parse(json);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
362
|
export {
|
|
364
363
|
defaultTheme,
|
|
365
364
|
setTheme,
|
|
366
365
|
getTheme,
|
|
367
|
-
|
|
368
|
-
getGlobalThemeMode,
|
|
369
|
-
setGlobalThemeMode,
|
|
370
|
-
toggleGlobalDarkMode,
|
|
371
|
-
subscribeGlobalDarkMode,
|
|
372
|
-
seedDefaultMode,
|
|
373
|
-
resolveStyle
|
|
366
|
+
getThemeJson
|
|
374
367
|
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getTheme
|
|
3
|
+
} from "./chunk-HK6PDJJK.mjs";
|
|
4
|
+
|
|
5
|
+
// src/darkModeStore.ts
|
|
6
|
+
import { Appearance } from "react-native";
|
|
7
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
8
|
+
function systemPrefersDark() {
|
|
9
|
+
return Appearance.getColorScheme() === "dark";
|
|
10
|
+
}
|
|
11
|
+
function resolveIsDark(m) {
|
|
12
|
+
return m === "system" ? systemPrefersDark() : m === "dark";
|
|
13
|
+
}
|
|
14
|
+
function applyToDom(dark) {
|
|
15
|
+
if (typeof document === "undefined") return;
|
|
16
|
+
const root = document.documentElement;
|
|
17
|
+
const strategy = getTheme().darkMode;
|
|
18
|
+
if (strategy === "class") {
|
|
19
|
+
root.classList.toggle("dark", dark);
|
|
20
|
+
root.classList.toggle("light", !dark);
|
|
21
|
+
} else if (strategy === "attribute") {
|
|
22
|
+
root.setAttribute("data-theme", dark ? "dark" : "light");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
var mode = "system";
|
|
26
|
+
var isDark = resolveIsDark(mode);
|
|
27
|
+
applyToDom(isDark);
|
|
28
|
+
var hasExplicitChoice = false;
|
|
29
|
+
var subscription = Appearance.addChangeListener(({ colorScheme }) => {
|
|
30
|
+
if (mode !== "system") return;
|
|
31
|
+
isDark = colorScheme === "dark";
|
|
32
|
+
applyToDom(isDark);
|
|
33
|
+
notify();
|
|
34
|
+
});
|
|
35
|
+
function notify() {
|
|
36
|
+
for (const listener of listeners) listener();
|
|
37
|
+
}
|
|
38
|
+
function getGlobalDarkMode() {
|
|
39
|
+
return isDark;
|
|
40
|
+
}
|
|
41
|
+
function getGlobalThemeMode() {
|
|
42
|
+
return mode;
|
|
43
|
+
}
|
|
44
|
+
function setGlobalThemeMode(nextMode) {
|
|
45
|
+
mode = nextMode;
|
|
46
|
+
isDark = resolveIsDark(nextMode);
|
|
47
|
+
hasExplicitChoice = true;
|
|
48
|
+
applyToDom(isDark);
|
|
49
|
+
notify();
|
|
50
|
+
}
|
|
51
|
+
function toggleGlobalDarkMode() {
|
|
52
|
+
setGlobalThemeMode(isDark ? "light" : "dark");
|
|
53
|
+
}
|
|
54
|
+
function subscribeGlobalDarkMode(listener) {
|
|
55
|
+
listeners.add(listener);
|
|
56
|
+
return () => listeners.delete(listener);
|
|
57
|
+
}
|
|
58
|
+
function seedDefaultMode(fallback) {
|
|
59
|
+
if (hasExplicitChoice || mode === fallback) return;
|
|
60
|
+
mode = fallback;
|
|
61
|
+
isDark = resolveIsDark(fallback);
|
|
62
|
+
applyToDom(isDark);
|
|
63
|
+
notify();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
getGlobalDarkMode,
|
|
68
|
+
getGlobalThemeMode,
|
|
69
|
+
setGlobalThemeMode,
|
|
70
|
+
toggleGlobalDarkMode,
|
|
71
|
+
subscribeGlobalDarkMode,
|
|
72
|
+
seedDefaultMode
|
|
73
|
+
};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getGlobalDarkMode,
|
|
3
|
+
getGlobalThemeMode,
|
|
4
|
+
seedDefaultMode,
|
|
5
|
+
setGlobalThemeMode,
|
|
6
|
+
subscribeGlobalDarkMode,
|
|
7
|
+
toggleGlobalDarkMode
|
|
8
|
+
} from "./chunk-RBJXE32L.mjs";
|
|
9
|
+
import {
|
|
10
|
+
defaultTheme,
|
|
11
|
+
getTheme,
|
|
12
|
+
setTheme
|
|
13
|
+
} from "./chunk-HK6PDJJK.mjs";
|
|
14
|
+
|
|
15
|
+
// src/config.ts
|
|
16
|
+
function parseHexRgb(hex) {
|
|
17
|
+
const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
|
|
18
|
+
if (!m) return null;
|
|
19
|
+
let h = m[1];
|
|
20
|
+
if (h.length === 3) h = h.split("").map((c) => c + c).join("");
|
|
21
|
+
const n = parseInt(h, 16);
|
|
22
|
+
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
23
|
+
}
|
|
24
|
+
function applyOpacityToHex(hex, opacityText) {
|
|
25
|
+
const rgb = parseHexRgb(hex);
|
|
26
|
+
if (!rgb) return hex;
|
|
27
|
+
const a = Number(opacityText) / 100;
|
|
28
|
+
const clamped = Number.isFinite(a) ? Math.min(1, Math.max(0, a)) : 1;
|
|
29
|
+
return `rgba(${rgb.join(",")},${clamped})`;
|
|
30
|
+
}
|
|
31
|
+
function resolveColorEntry(value, lookup) {
|
|
32
|
+
const slash = value.indexOf("/");
|
|
33
|
+
const name = slash === -1 ? value : value.slice(0, slash);
|
|
34
|
+
const opacity = slash === -1 ? void 0 : value.slice(slash + 1);
|
|
35
|
+
const base = lookup(name);
|
|
36
|
+
if (base === void 0) return value;
|
|
37
|
+
return opacity === void 0 ? base : applyOpacityToHex(base, opacity);
|
|
38
|
+
}
|
|
39
|
+
function resolveColors(extend, existing) {
|
|
40
|
+
const resolved = {};
|
|
41
|
+
const lookup = (name) => {
|
|
42
|
+
const found = resolved[name] ?? existing[name];
|
|
43
|
+
return typeof found === "string" ? found : void 0;
|
|
44
|
+
};
|
|
45
|
+
for (const [name, value] of Object.entries(extend)) {
|
|
46
|
+
resolved[name] = resolveColorEntry(value, lookup);
|
|
47
|
+
}
|
|
48
|
+
return resolved;
|
|
49
|
+
}
|
|
50
|
+
function resolveKbachConfig(config) {
|
|
51
|
+
let theme = { ...defaultTheme, ...config.theme };
|
|
52
|
+
if (config.extend?.colors) {
|
|
53
|
+
theme = { ...theme, colors: { ...theme.colors, ...resolveColors(config.extend.colors, theme.colors) } };
|
|
54
|
+
}
|
|
55
|
+
if (config.extend?.spacing) {
|
|
56
|
+
theme = { ...theme, spacing: { ...theme.spacing, ...config.extend.spacing } };
|
|
57
|
+
}
|
|
58
|
+
if (config.extend?.screens) {
|
|
59
|
+
theme = { ...theme, screens: { ...theme.screens, ...config.extend.screens } };
|
|
60
|
+
}
|
|
61
|
+
if (config.extend?.fontFamily) {
|
|
62
|
+
theme = { ...theme, fontFamily: { ...theme.fontFamily, ...config.extend.fontFamily } };
|
|
63
|
+
}
|
|
64
|
+
if (config.extend?.container) {
|
|
65
|
+
theme = { ...theme, container: { ...theme.container, ...config.extend.container } };
|
|
66
|
+
}
|
|
67
|
+
if (config.darkMode) {
|
|
68
|
+
theme = { ...theme, darkMode: config.darkMode };
|
|
69
|
+
}
|
|
70
|
+
return theme;
|
|
71
|
+
}
|
|
72
|
+
function applyKbachConfig(config) {
|
|
73
|
+
const theme = resolveKbachConfig(config);
|
|
74
|
+
setTheme(theme);
|
|
75
|
+
return theme;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/useTheme.ts
|
|
79
|
+
import { useMemo, useSyncExternalStore } from "react";
|
|
80
|
+
function useTheme() {
|
|
81
|
+
const isDark = useSyncExternalStore(subscribeGlobalDarkMode, getGlobalDarkMode);
|
|
82
|
+
const mode = useSyncExternalStore(subscribeGlobalDarkMode, getGlobalThemeMode);
|
|
83
|
+
return useMemo(
|
|
84
|
+
() => ({ mode, isDark, setMode: setGlobalThemeMode, toggle: toggleGlobalDarkMode }),
|
|
85
|
+
[mode, isDark]
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// src/ThemeProvider.tsx
|
|
90
|
+
import { useEffect, useRef } from "react";
|
|
91
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
92
|
+
var mountedProviderCount = 0;
|
|
93
|
+
var warnedMultipleProviders = false;
|
|
94
|
+
function ThemeProvider({ children, defaultMode = "system" }) {
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
mountedProviderCount++;
|
|
97
|
+
if (mountedProviderCount > 1 && !warnedMultipleProviders) {
|
|
98
|
+
warnedMultipleProviders = true;
|
|
99
|
+
console.warn(
|
|
100
|
+
"[kbach] Multiple <ThemeProvider> instances are mounted at once. Dark-mode state is one global store useTheme() reads everywhere, not scoped per-provider, so their defaultMode seeds will fight over the same state."
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return () => {
|
|
104
|
+
mountedProviderCount--;
|
|
105
|
+
};
|
|
106
|
+
}, []);
|
|
107
|
+
const seeded = useRef(false);
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (seeded.current) return;
|
|
110
|
+
seeded.current = true;
|
|
111
|
+
seedDefaultMode(defaultMode);
|
|
112
|
+
}, []);
|
|
113
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/useColors.ts
|
|
117
|
+
function parseHexRgb2(hex) {
|
|
118
|
+
const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
|
|
119
|
+
if (!m) return null;
|
|
120
|
+
let h = m[1];
|
|
121
|
+
if (h.length === 3) h = h.split("").map((c) => c + c).join("");
|
|
122
|
+
const n = parseInt(h, 16);
|
|
123
|
+
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
124
|
+
}
|
|
125
|
+
function applyOpacity(color, opacity) {
|
|
126
|
+
const a = Math.max(0, Math.min(1, opacity / 100));
|
|
127
|
+
if (color.startsWith("#")) {
|
|
128
|
+
const rgb = parseHexRgb2(color);
|
|
129
|
+
return rgb ? `rgba(${rgb.join(",")},${a})` : color;
|
|
130
|
+
}
|
|
131
|
+
if (color.startsWith("rgb(")) return color.replace("rgb(", "rgba(").replace(")", `,${a})`);
|
|
132
|
+
if (color.startsWith("rgba(")) return color.replace(/,\s*[\d.]+\)$/, `,${a})`);
|
|
133
|
+
return color;
|
|
134
|
+
}
|
|
135
|
+
function resolveEntry(entry, isDark) {
|
|
136
|
+
return typeof entry === "string" ? entry : isDark ? entry.dark : entry.light;
|
|
137
|
+
}
|
|
138
|
+
function makeColorsProxy(theme, isDark) {
|
|
139
|
+
const alpha = (color, opacity) => opacity === void 0 ? color : applyOpacity(color, opacity);
|
|
140
|
+
const cache = /* @__PURE__ */ new Map();
|
|
141
|
+
function resolveNamed(key) {
|
|
142
|
+
let name = key;
|
|
143
|
+
let opacity;
|
|
144
|
+
if (key.includes("/")) {
|
|
145
|
+
const slash = key.indexOf("/");
|
|
146
|
+
name = key.slice(0, slash);
|
|
147
|
+
opacity = Number(key.slice(slash + 1));
|
|
148
|
+
}
|
|
149
|
+
const entry = theme.colors[name];
|
|
150
|
+
if (entry === void 0) return void 0;
|
|
151
|
+
const value = resolveEntry(entry, isDark);
|
|
152
|
+
return opacity === void 0 ? value : applyOpacity(value, opacity);
|
|
153
|
+
}
|
|
154
|
+
function makeFamilyProxy(family) {
|
|
155
|
+
return new Proxy({}, {
|
|
156
|
+
get(_, prop) {
|
|
157
|
+
const key = String(prop);
|
|
158
|
+
if (key === "then") return void 0;
|
|
159
|
+
return resolveNamed(`${family}-${key}`);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return new Proxy({ alpha }, {
|
|
164
|
+
get(_, prop) {
|
|
165
|
+
const key = String(prop);
|
|
166
|
+
if (key === "then") return void 0;
|
|
167
|
+
if (key === "alpha") return alpha;
|
|
168
|
+
const direct = resolveNamed(key);
|
|
169
|
+
if (direct !== void 0) return direct;
|
|
170
|
+
if (!cache.has(key)) cache.set(key, makeFamilyProxy(key));
|
|
171
|
+
return cache.get(key);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function useColors() {
|
|
176
|
+
const { isDark } = useTheme();
|
|
177
|
+
return makeColorsProxy(getTheme(), isDark);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export {
|
|
181
|
+
resolveKbachConfig,
|
|
182
|
+
applyKbachConfig,
|
|
183
|
+
useTheme,
|
|
184
|
+
ThemeProvider,
|
|
185
|
+
useColors
|
|
186
|
+
};
|