@kbach/react 0.2.1 → 0.2.3
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-7SN3LQKS.mjs → chunk-23GRUDYB.mjs} +1 -1
- package/dist/{chunk-MXJINF4T.mjs → chunk-IYY3U6L2.mjs} +57 -22
- package/dist/index.js +74 -60
- package/dist/index.mjs +18 -39
- package/dist/jsx-dev-runtime.js +44 -10
- package/dist/jsx-dev-runtime.mjs +2 -2
- package/dist/jsx-runtime.js +44 -10
- package/dist/jsx-runtime.mjs +2 -2
- package/package.json +1 -1
|
@@ -1872,11 +1872,19 @@ function deepMerge(base, override) {
|
|
|
1872
1872
|
}
|
|
1873
1873
|
return result;
|
|
1874
1874
|
}
|
|
1875
|
-
var
|
|
1875
|
+
var CONFIG_KEY = "__kbach_config_store__";
|
|
1876
|
+
function getConfigStore() {
|
|
1877
|
+
const g = globalThis;
|
|
1878
|
+
if (!g[CONFIG_KEY]) {
|
|
1879
|
+
g[CONFIG_KEY] = { resolved: null, listeners: /* @__PURE__ */ new Set(), customVariants: {} };
|
|
1880
|
+
}
|
|
1881
|
+
return g[CONFIG_KEY];
|
|
1882
|
+
}
|
|
1876
1883
|
function getConfig() {
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1884
|
+
const store = getConfigStore();
|
|
1885
|
+
if (store.resolved) return store.resolved;
|
|
1886
|
+
store.resolved = buildConfig({});
|
|
1887
|
+
return store.resolved;
|
|
1880
1888
|
}
|
|
1881
1889
|
function buildConfig(userConfig) {
|
|
1882
1890
|
let theme = { ...defaultTheme };
|
|
@@ -1930,38 +1938,65 @@ function makePluginAPI(theme) {
|
|
|
1930
1938
|
}
|
|
1931
1939
|
};
|
|
1932
1940
|
}
|
|
1933
|
-
var customVariants = {};
|
|
1934
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
1935
1941
|
function onConfigChange(listener) {
|
|
1936
|
-
|
|
1937
|
-
|
|
1942
|
+
const store = getConfigStore();
|
|
1943
|
+
store.listeners.add(listener);
|
|
1944
|
+
return () => store.listeners.delete(listener);
|
|
1938
1945
|
}
|
|
1939
1946
|
function updateConfig(userConfig) {
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1947
|
+
const store = getConfigStore();
|
|
1948
|
+
store.resolved = buildConfig(userConfig);
|
|
1949
|
+
for (const listener of store.listeners) {
|
|
1950
|
+
listener(store.resolved);
|
|
1943
1951
|
}
|
|
1944
1952
|
}
|
|
1953
|
+
var customVariants = new Proxy(
|
|
1954
|
+
{},
|
|
1955
|
+
{
|
|
1956
|
+
get(_t, p) {
|
|
1957
|
+
return typeof p === "string" ? getConfigStore().customVariants[p] : void 0;
|
|
1958
|
+
},
|
|
1959
|
+
set(_t, p, v) {
|
|
1960
|
+
if (typeof p === "string") getConfigStore().customVariants[p] = v;
|
|
1961
|
+
return true;
|
|
1962
|
+
},
|
|
1963
|
+
ownKeys() {
|
|
1964
|
+
return Object.keys(getConfigStore().customVariants);
|
|
1965
|
+
},
|
|
1966
|
+
getOwnPropertyDescriptor(_t, p) {
|
|
1967
|
+
if (typeof p !== "string") return void 0;
|
|
1968
|
+
const v = getConfigStore().customVariants[p];
|
|
1969
|
+
return v !== void 0 ? { value: v, writable: true, enumerable: true, configurable: true } : void 0;
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
);
|
|
1945
1973
|
|
|
1946
1974
|
// src/core/darkModeStore.ts
|
|
1947
|
-
var
|
|
1948
|
-
|
|
1949
|
-
|
|
1975
|
+
var KEY = "__kbach_dark_store__";
|
|
1976
|
+
function getStore() {
|
|
1977
|
+
const g = globalThis;
|
|
1978
|
+
if (!g[KEY]) {
|
|
1979
|
+
g[KEY] = { isDark: false, lastNotified: false, subscribers: /* @__PURE__ */ new Set() };
|
|
1980
|
+
}
|
|
1981
|
+
return g[KEY];
|
|
1982
|
+
}
|
|
1950
1983
|
function syncGlobalDarkMode(isDark) {
|
|
1951
|
-
|
|
1984
|
+
getStore().isDark = isDark;
|
|
1952
1985
|
}
|
|
1953
1986
|
function setGlobalDarkMode(isDark) {
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1987
|
+
const store = getStore();
|
|
1988
|
+
store.isDark = isDark;
|
|
1989
|
+
if (store.lastNotified === isDark) return;
|
|
1990
|
+
store.lastNotified = isDark;
|
|
1991
|
+
for (const sub of store.subscribers) sub();
|
|
1958
1992
|
}
|
|
1959
1993
|
function getGlobalDarkMode() {
|
|
1960
|
-
return
|
|
1994
|
+
return getStore().isDark;
|
|
1961
1995
|
}
|
|
1962
1996
|
function subscribeGlobalDarkMode(callback) {
|
|
1963
|
-
|
|
1964
|
-
|
|
1997
|
+
const store = getStore();
|
|
1998
|
+
store.subscribers.add(callback);
|
|
1999
|
+
return () => store.subscribers.delete(callback);
|
|
1965
2000
|
}
|
|
1966
2001
|
|
|
1967
2002
|
// src/useGlobalDarkMode.ts
|
package/dist/index.js
CHANGED
|
@@ -1936,11 +1936,19 @@ function deepMerge(base, override) {
|
|
|
1936
1936
|
}
|
|
1937
1937
|
return result;
|
|
1938
1938
|
}
|
|
1939
|
-
var
|
|
1939
|
+
var CONFIG_KEY = "__kbach_config_store__";
|
|
1940
|
+
function getConfigStore() {
|
|
1941
|
+
const g = globalThis;
|
|
1942
|
+
if (!g[CONFIG_KEY]) {
|
|
1943
|
+
g[CONFIG_KEY] = { resolved: null, listeners: /* @__PURE__ */ new Set(), customVariants: {} };
|
|
1944
|
+
}
|
|
1945
|
+
return g[CONFIG_KEY];
|
|
1946
|
+
}
|
|
1940
1947
|
function getConfig() {
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1948
|
+
const store = getConfigStore();
|
|
1949
|
+
if (store.resolved) return store.resolved;
|
|
1950
|
+
store.resolved = buildConfig({});
|
|
1951
|
+
return store.resolved;
|
|
1944
1952
|
}
|
|
1945
1953
|
function buildConfig(userConfig) {
|
|
1946
1954
|
let theme = { ...defaultTheme };
|
|
@@ -1994,53 +2002,78 @@ function makePluginAPI(theme) {
|
|
|
1994
2002
|
}
|
|
1995
2003
|
};
|
|
1996
2004
|
}
|
|
1997
|
-
var customVariants = {};
|
|
1998
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
1999
2005
|
function onConfigChange(listener) {
|
|
2000
|
-
|
|
2001
|
-
|
|
2006
|
+
const store = getConfigStore();
|
|
2007
|
+
store.listeners.add(listener);
|
|
2008
|
+
return () => store.listeners.delete(listener);
|
|
2002
2009
|
}
|
|
2003
2010
|
function updateConfig(userConfig) {
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2011
|
+
const store = getConfigStore();
|
|
2012
|
+
store.resolved = buildConfig(userConfig);
|
|
2013
|
+
for (const listener of store.listeners) {
|
|
2014
|
+
listener(store.resolved);
|
|
2007
2015
|
}
|
|
2008
2016
|
}
|
|
2017
|
+
var customVariants = new Proxy(
|
|
2018
|
+
{},
|
|
2019
|
+
{
|
|
2020
|
+
get(_t, p) {
|
|
2021
|
+
return typeof p === "string" ? getConfigStore().customVariants[p] : void 0;
|
|
2022
|
+
},
|
|
2023
|
+
set(_t, p, v) {
|
|
2024
|
+
if (typeof p === "string") getConfigStore().customVariants[p] = v;
|
|
2025
|
+
return true;
|
|
2026
|
+
},
|
|
2027
|
+
ownKeys() {
|
|
2028
|
+
return Object.keys(getConfigStore().customVariants);
|
|
2029
|
+
},
|
|
2030
|
+
getOwnPropertyDescriptor(_t, p) {
|
|
2031
|
+
if (typeof p !== "string") return void 0;
|
|
2032
|
+
const v = getConfigStore().customVariants[p];
|
|
2033
|
+
return v !== void 0 ? { value: v, writable: true, enumerable: true, configurable: true } : void 0;
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
);
|
|
2009
2037
|
|
|
2010
2038
|
// src/core/darkModeStore.ts
|
|
2011
|
-
var
|
|
2012
|
-
|
|
2013
|
-
|
|
2039
|
+
var KEY = "__kbach_dark_store__";
|
|
2040
|
+
function getStore() {
|
|
2041
|
+
const g = globalThis;
|
|
2042
|
+
if (!g[KEY]) {
|
|
2043
|
+
g[KEY] = { isDark: false, lastNotified: false, subscribers: /* @__PURE__ */ new Set() };
|
|
2044
|
+
}
|
|
2045
|
+
return g[KEY];
|
|
2046
|
+
}
|
|
2014
2047
|
function syncGlobalDarkMode(isDark) {
|
|
2015
|
-
|
|
2048
|
+
getStore().isDark = isDark;
|
|
2016
2049
|
}
|
|
2017
2050
|
function setGlobalDarkMode(isDark) {
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2051
|
+
const store = getStore();
|
|
2052
|
+
store.isDark = isDark;
|
|
2053
|
+
if (store.lastNotified === isDark) return;
|
|
2054
|
+
store.lastNotified = isDark;
|
|
2055
|
+
for (const sub of store.subscribers) sub();
|
|
2022
2056
|
}
|
|
2023
2057
|
function getGlobalDarkMode() {
|
|
2024
|
-
return
|
|
2058
|
+
return getStore().isDark;
|
|
2025
2059
|
}
|
|
2026
2060
|
function subscribeGlobalDarkMode(callback) {
|
|
2027
|
-
|
|
2028
|
-
|
|
2061
|
+
const store = getStore();
|
|
2062
|
+
store.subscribers.add(callback);
|
|
2063
|
+
return () => store.subscribers.delete(callback);
|
|
2029
2064
|
}
|
|
2030
2065
|
|
|
2031
2066
|
// src/ThemeProvider.tsx
|
|
2032
2067
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
2033
|
-
var
|
|
2068
|
+
var _useColorScheme;
|
|
2034
2069
|
try {
|
|
2035
|
-
({
|
|
2070
|
+
({ useColorScheme: _useColorScheme } = require("react-native"));
|
|
2036
2071
|
} catch {
|
|
2037
2072
|
}
|
|
2038
2073
|
var STORAGE_KEY = "kbach-theme";
|
|
2039
2074
|
function loadPersistedMode() {
|
|
2040
2075
|
try {
|
|
2041
|
-
if (isWeb)
|
|
2042
|
-
return localStorage.getItem(STORAGE_KEY);
|
|
2043
|
-
}
|
|
2076
|
+
if (isWeb) return localStorage.getItem(STORAGE_KEY);
|
|
2044
2077
|
return null;
|
|
2045
2078
|
} catch {
|
|
2046
2079
|
return null;
|
|
@@ -2071,17 +2104,14 @@ function ThemeProvider({
|
|
|
2071
2104
|
const [resolvedConfig, setResolvedConfig] = (0, import_react2.useState)(
|
|
2072
2105
|
() => configOverride ? buildConfig(configOverride) : getConfig()
|
|
2073
2106
|
);
|
|
2074
|
-
const
|
|
2107
|
+
const nativeScheme = _useColorScheme?.();
|
|
2108
|
+
const [webScheme, setWebScheme] = (0, import_react2.useState)(() => {
|
|
2075
2109
|
if (isWeb && typeof window !== "undefined") {
|
|
2076
2110
|
return window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
2077
2111
|
}
|
|
2078
|
-
if (Appearance) {
|
|
2079
|
-
const scheme = Appearance.getColorScheme();
|
|
2080
|
-
return scheme === "dark" ? "dark" : "light";
|
|
2081
|
-
}
|
|
2082
2112
|
return "light";
|
|
2083
|
-
}
|
|
2084
|
-
const
|
|
2113
|
+
});
|
|
2114
|
+
const systemScheme = isWeb ? webScheme : nativeScheme === "dark" ? "dark" : "light";
|
|
2085
2115
|
const [mode, _setMode] = (0, import_react2.useState)(() => {
|
|
2086
2116
|
if (!disablePersistence) {
|
|
2087
2117
|
const persisted = loadPersistedMode();
|
|
@@ -2103,33 +2133,17 @@ function ThemeProvider({
|
|
|
2103
2133
|
applyWebTheme(resolvedMode, resolvedConfig.darkMode);
|
|
2104
2134
|
setGlobalDarkMode(isDark);
|
|
2105
2135
|
}, [isDark, resolvedMode, resolvedConfig.darkMode]);
|
|
2106
|
-
const
|
|
2107
|
-
|
|
2108
|
-
(0, import_react2.useEffect)(() => {
|
|
2109
|
-
if (Appearance) {
|
|
2110
|
-
const scheme = Appearance.getColorScheme();
|
|
2111
|
-
if (scheme != null) {
|
|
2112
|
-
setSystemSchemeRef.current(scheme === "dark" ? "dark" : "light");
|
|
2113
|
-
}
|
|
2114
|
-
}
|
|
2115
|
-
}, []);
|
|
2136
|
+
const setWebSchemeRef = (0, import_react2.useRef)(setWebScheme);
|
|
2137
|
+
setWebSchemeRef.current = setWebScheme;
|
|
2116
2138
|
(0, import_react2.useEffect)(() => {
|
|
2117
|
-
if (isWeb
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
}
|
|
2126
|
-
if (Appearance) {
|
|
2127
|
-
const sub = Appearance.addChangeListener(({ colorScheme }) => {
|
|
2128
|
-
setSystemSchemeRef.current(colorScheme === "dark" ? "dark" : "light");
|
|
2129
|
-
});
|
|
2130
|
-
return () => sub.remove();
|
|
2131
|
-
}
|
|
2132
|
-
return void 0;
|
|
2139
|
+
if (!isWeb || typeof window === "undefined") return;
|
|
2140
|
+
const mq = window.matchMedia?.("(prefers-color-scheme: dark)");
|
|
2141
|
+
if (!mq) return;
|
|
2142
|
+
const handler = (e) => {
|
|
2143
|
+
setWebSchemeRef.current(e.matches ? "dark" : "light");
|
|
2144
|
+
};
|
|
2145
|
+
mq.addEventListener("change", handler);
|
|
2146
|
+
return () => mq.removeEventListener("change", handler);
|
|
2133
2147
|
}, []);
|
|
2134
2148
|
(0, import_react2.useEffect)(() => {
|
|
2135
2149
|
if (configOverride) return;
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
syncGlobalDarkMode,
|
|
16
16
|
updateConfig,
|
|
17
17
|
useGlobalDarkMode
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-IYY3U6L2.mjs";
|
|
19
19
|
|
|
20
20
|
// src/context.tsx
|
|
21
21
|
import { createContext, useContext } from "react";
|
|
@@ -39,17 +39,15 @@ import {
|
|
|
39
39
|
useState
|
|
40
40
|
} from "react";
|
|
41
41
|
import { jsx } from "react/jsx-runtime";
|
|
42
|
-
var
|
|
42
|
+
var _useColorScheme;
|
|
43
43
|
try {
|
|
44
|
-
({
|
|
44
|
+
({ useColorScheme: _useColorScheme } = __require("react-native"));
|
|
45
45
|
} catch {
|
|
46
46
|
}
|
|
47
47
|
var STORAGE_KEY = "kbach-theme";
|
|
48
48
|
function loadPersistedMode() {
|
|
49
49
|
try {
|
|
50
|
-
if (isWeb)
|
|
51
|
-
return localStorage.getItem(STORAGE_KEY);
|
|
52
|
-
}
|
|
50
|
+
if (isWeb) return localStorage.getItem(STORAGE_KEY);
|
|
53
51
|
return null;
|
|
54
52
|
} catch {
|
|
55
53
|
return null;
|
|
@@ -80,17 +78,14 @@ function ThemeProvider({
|
|
|
80
78
|
const [resolvedConfig, setResolvedConfig] = useState(
|
|
81
79
|
() => configOverride ? buildConfig(configOverride) : getConfig()
|
|
82
80
|
);
|
|
83
|
-
const
|
|
81
|
+
const nativeScheme = _useColorScheme?.();
|
|
82
|
+
const [webScheme, setWebScheme] = useState(() => {
|
|
84
83
|
if (isWeb && typeof window !== "undefined") {
|
|
85
84
|
return window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
86
85
|
}
|
|
87
|
-
if (Appearance) {
|
|
88
|
-
const scheme = Appearance.getColorScheme();
|
|
89
|
-
return scheme === "dark" ? "dark" : "light";
|
|
90
|
-
}
|
|
91
86
|
return "light";
|
|
92
|
-
}
|
|
93
|
-
const
|
|
87
|
+
});
|
|
88
|
+
const systemScheme = isWeb ? webScheme : nativeScheme === "dark" ? "dark" : "light";
|
|
94
89
|
const [mode, _setMode] = useState(() => {
|
|
95
90
|
if (!disablePersistence) {
|
|
96
91
|
const persisted = loadPersistedMode();
|
|
@@ -112,33 +107,17 @@ function ThemeProvider({
|
|
|
112
107
|
applyWebTheme(resolvedMode, resolvedConfig.darkMode);
|
|
113
108
|
setGlobalDarkMode(isDark);
|
|
114
109
|
}, [isDark, resolvedMode, resolvedConfig.darkMode]);
|
|
115
|
-
const
|
|
116
|
-
|
|
110
|
+
const setWebSchemeRef = useRef(setWebScheme);
|
|
111
|
+
setWebSchemeRef.current = setWebScheme;
|
|
117
112
|
useEffect(() => {
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (isWeb && typeof window !== "undefined") {
|
|
127
|
-
const mq = window.matchMedia?.("(prefers-color-scheme: dark)");
|
|
128
|
-
if (!mq) return;
|
|
129
|
-
const handler = (e) => {
|
|
130
|
-
setSystemSchemeRef.current(e.matches ? "dark" : "light");
|
|
131
|
-
};
|
|
132
|
-
mq.addEventListener("change", handler);
|
|
133
|
-
return () => mq.removeEventListener("change", handler);
|
|
134
|
-
}
|
|
135
|
-
if (Appearance) {
|
|
136
|
-
const sub = Appearance.addChangeListener(({ colorScheme }) => {
|
|
137
|
-
setSystemSchemeRef.current(colorScheme === "dark" ? "dark" : "light");
|
|
138
|
-
});
|
|
139
|
-
return () => sub.remove();
|
|
140
|
-
}
|
|
141
|
-
return void 0;
|
|
113
|
+
if (!isWeb || typeof window === "undefined") return;
|
|
114
|
+
const mq = window.matchMedia?.("(prefers-color-scheme: dark)");
|
|
115
|
+
if (!mq) return;
|
|
116
|
+
const handler = (e) => {
|
|
117
|
+
setWebSchemeRef.current(e.matches ? "dark" : "light");
|
|
118
|
+
};
|
|
119
|
+
mq.addEventListener("change", handler);
|
|
120
|
+
return () => mq.removeEventListener("change", handler);
|
|
142
121
|
}, []);
|
|
143
122
|
useEffect(() => {
|
|
144
123
|
if (configOverride) return;
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -1905,11 +1905,19 @@ function deepMerge(base, override) {
|
|
|
1905
1905
|
}
|
|
1906
1906
|
return result;
|
|
1907
1907
|
}
|
|
1908
|
-
var
|
|
1908
|
+
var CONFIG_KEY = "__kbach_config_store__";
|
|
1909
|
+
function getConfigStore() {
|
|
1910
|
+
const g = globalThis;
|
|
1911
|
+
if (!g[CONFIG_KEY]) {
|
|
1912
|
+
g[CONFIG_KEY] = { resolved: null, listeners: /* @__PURE__ */ new Set(), customVariants: {} };
|
|
1913
|
+
}
|
|
1914
|
+
return g[CONFIG_KEY];
|
|
1915
|
+
}
|
|
1909
1916
|
function getConfig() {
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1917
|
+
const store = getConfigStore();
|
|
1918
|
+
if (store.resolved) return store.resolved;
|
|
1919
|
+
store.resolved = buildConfig({});
|
|
1920
|
+
return store.resolved;
|
|
1913
1921
|
}
|
|
1914
1922
|
function buildConfig(userConfig) {
|
|
1915
1923
|
let theme = { ...defaultTheme };
|
|
@@ -1963,17 +1971,43 @@ function makePluginAPI(theme) {
|
|
|
1963
1971
|
}
|
|
1964
1972
|
};
|
|
1965
1973
|
}
|
|
1966
|
-
var customVariants =
|
|
1974
|
+
var customVariants = new Proxy(
|
|
1975
|
+
{},
|
|
1976
|
+
{
|
|
1977
|
+
get(_t, p) {
|
|
1978
|
+
return typeof p === "string" ? getConfigStore().customVariants[p] : void 0;
|
|
1979
|
+
},
|
|
1980
|
+
set(_t, p, v) {
|
|
1981
|
+
if (typeof p === "string") getConfigStore().customVariants[p] = v;
|
|
1982
|
+
return true;
|
|
1983
|
+
},
|
|
1984
|
+
ownKeys() {
|
|
1985
|
+
return Object.keys(getConfigStore().customVariants);
|
|
1986
|
+
},
|
|
1987
|
+
getOwnPropertyDescriptor(_t, p) {
|
|
1988
|
+
if (typeof p !== "string") return void 0;
|
|
1989
|
+
const v = getConfigStore().customVariants[p];
|
|
1990
|
+
return v !== void 0 ? { value: v, writable: true, enumerable: true, configurable: true } : void 0;
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
);
|
|
1967
1994
|
|
|
1968
1995
|
// src/core/darkModeStore.ts
|
|
1969
|
-
var
|
|
1970
|
-
|
|
1996
|
+
var KEY = "__kbach_dark_store__";
|
|
1997
|
+
function getStore() {
|
|
1998
|
+
const g = globalThis;
|
|
1999
|
+
if (!g[KEY]) {
|
|
2000
|
+
g[KEY] = { isDark: false, lastNotified: false, subscribers: /* @__PURE__ */ new Set() };
|
|
2001
|
+
}
|
|
2002
|
+
return g[KEY];
|
|
2003
|
+
}
|
|
1971
2004
|
function getGlobalDarkMode() {
|
|
1972
|
-
return
|
|
2005
|
+
return getStore().isDark;
|
|
1973
2006
|
}
|
|
1974
2007
|
function subscribeGlobalDarkMode(callback) {
|
|
1975
|
-
|
|
1976
|
-
|
|
2008
|
+
const store = getStore();
|
|
2009
|
+
store.subscribers.add(callback);
|
|
2010
|
+
return () => store.subscribers.delete(callback);
|
|
1977
2011
|
}
|
|
1978
2012
|
|
|
1979
2013
|
// src/InteractiveWrapper.tsx
|
package/dist/jsx-dev-runtime.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
Fragment,
|
|
3
3
|
jsx,
|
|
4
4
|
jsxs
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-23GRUDYB.mjs";
|
|
6
|
+
import "./chunk-IYY3U6L2.mjs";
|
|
7
7
|
|
|
8
8
|
// src/jsx-dev-runtime.tsx
|
|
9
9
|
function jsxDEV(type, props, key, isStaticChildren, _source, _self) {
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1904,11 +1904,19 @@ function deepMerge(base, override) {
|
|
|
1904
1904
|
}
|
|
1905
1905
|
return result;
|
|
1906
1906
|
}
|
|
1907
|
-
var
|
|
1907
|
+
var CONFIG_KEY = "__kbach_config_store__";
|
|
1908
|
+
function getConfigStore() {
|
|
1909
|
+
const g = globalThis;
|
|
1910
|
+
if (!g[CONFIG_KEY]) {
|
|
1911
|
+
g[CONFIG_KEY] = { resolved: null, listeners: /* @__PURE__ */ new Set(), customVariants: {} };
|
|
1912
|
+
}
|
|
1913
|
+
return g[CONFIG_KEY];
|
|
1914
|
+
}
|
|
1908
1915
|
function getConfig() {
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1916
|
+
const store = getConfigStore();
|
|
1917
|
+
if (store.resolved) return store.resolved;
|
|
1918
|
+
store.resolved = buildConfig({});
|
|
1919
|
+
return store.resolved;
|
|
1912
1920
|
}
|
|
1913
1921
|
function buildConfig(userConfig) {
|
|
1914
1922
|
let theme = { ...defaultTheme };
|
|
@@ -1962,17 +1970,43 @@ function makePluginAPI(theme) {
|
|
|
1962
1970
|
}
|
|
1963
1971
|
};
|
|
1964
1972
|
}
|
|
1965
|
-
var customVariants =
|
|
1973
|
+
var customVariants = new Proxy(
|
|
1974
|
+
{},
|
|
1975
|
+
{
|
|
1976
|
+
get(_t, p) {
|
|
1977
|
+
return typeof p === "string" ? getConfigStore().customVariants[p] : void 0;
|
|
1978
|
+
},
|
|
1979
|
+
set(_t, p, v) {
|
|
1980
|
+
if (typeof p === "string") getConfigStore().customVariants[p] = v;
|
|
1981
|
+
return true;
|
|
1982
|
+
},
|
|
1983
|
+
ownKeys() {
|
|
1984
|
+
return Object.keys(getConfigStore().customVariants);
|
|
1985
|
+
},
|
|
1986
|
+
getOwnPropertyDescriptor(_t, p) {
|
|
1987
|
+
if (typeof p !== "string") return void 0;
|
|
1988
|
+
const v = getConfigStore().customVariants[p];
|
|
1989
|
+
return v !== void 0 ? { value: v, writable: true, enumerable: true, configurable: true } : void 0;
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
);
|
|
1966
1993
|
|
|
1967
1994
|
// src/core/darkModeStore.ts
|
|
1968
|
-
var
|
|
1969
|
-
|
|
1995
|
+
var KEY = "__kbach_dark_store__";
|
|
1996
|
+
function getStore() {
|
|
1997
|
+
const g = globalThis;
|
|
1998
|
+
if (!g[KEY]) {
|
|
1999
|
+
g[KEY] = { isDark: false, lastNotified: false, subscribers: /* @__PURE__ */ new Set() };
|
|
2000
|
+
}
|
|
2001
|
+
return g[KEY];
|
|
2002
|
+
}
|
|
1970
2003
|
function getGlobalDarkMode() {
|
|
1971
|
-
return
|
|
2004
|
+
return getStore().isDark;
|
|
1972
2005
|
}
|
|
1973
2006
|
function subscribeGlobalDarkMode(callback) {
|
|
1974
|
-
|
|
1975
|
-
|
|
2007
|
+
const store = getStore();
|
|
2008
|
+
store.subscribers.add(callback);
|
|
2009
|
+
return () => store.subscribers.delete(callback);
|
|
1976
2010
|
}
|
|
1977
2011
|
|
|
1978
2012
|
// src/InteractiveWrapper.tsx
|
package/dist/jsx-runtime.mjs
CHANGED