@kbach/react 0.6.23 → 0.6.25
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-YUX2JPTM.mjs → chunk-RUI5EQDF.mjs} +1 -1
- package/dist/{chunk-GJSZUC6Q.mjs → chunk-XISB5W3A.mjs} +6 -4
- package/dist/index.js +8 -5
- package/dist/index.mjs +4 -2
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/jsx-dev-runtime.mjs +2 -2
- package/dist/jsx-runtime.js +2 -2
- package/dist/jsx-runtime.mjs +2 -2
- package/package.json +1 -1
|
@@ -2686,7 +2686,7 @@ var RESPONSIVE_KEY = "__kbach_responsive__";
|
|
|
2686
2686
|
function getStore() {
|
|
2687
2687
|
const g = globalThis;
|
|
2688
2688
|
if (!g[RESPONSIVE_KEY]) {
|
|
2689
|
-
g[RESPONSIVE_KEY] = { width: 0, screens: {}, listeners: /* @__PURE__ */ new Set() };
|
|
2689
|
+
g[RESPONSIVE_KEY] = { width: 0, notifiedWidth: 0, screens: {}, listeners: /* @__PURE__ */ new Set() };
|
|
2690
2690
|
}
|
|
2691
2691
|
return g[RESPONSIVE_KEY];
|
|
2692
2692
|
}
|
|
@@ -2701,8 +2701,9 @@ function getGlobalScreens() {
|
|
|
2701
2701
|
}
|
|
2702
2702
|
function setGlobalWidth(width) {
|
|
2703
2703
|
const store = getStore();
|
|
2704
|
-
if (store.width === width) return;
|
|
2705
2704
|
store.width = width;
|
|
2705
|
+
if (store.notifiedWidth === width) return;
|
|
2706
|
+
store.notifiedWidth = width;
|
|
2706
2707
|
for (const l of store.listeners) l();
|
|
2707
2708
|
}
|
|
2708
2709
|
function getGlobalWidth() {
|
|
@@ -3273,7 +3274,7 @@ var KEY = "__kbach_dark_store__";
|
|
|
3273
3274
|
function getStore2() {
|
|
3274
3275
|
const g = globalThis;
|
|
3275
3276
|
if (!g[KEY]) {
|
|
3276
|
-
g[KEY] = { isDark: false, subscribers: /* @__PURE__ */ new Set() };
|
|
3277
|
+
g[KEY] = { isDark: false, notifiedIsDark: false, subscribers: /* @__PURE__ */ new Set() };
|
|
3277
3278
|
}
|
|
3278
3279
|
return g[KEY];
|
|
3279
3280
|
}
|
|
@@ -3282,8 +3283,9 @@ function syncGlobalDarkMode(isDark) {
|
|
|
3282
3283
|
}
|
|
3283
3284
|
function setGlobalDarkMode(isDark) {
|
|
3284
3285
|
const store = getStore2();
|
|
3285
|
-
if (store.isDark === isDark) return;
|
|
3286
3286
|
store.isDark = isDark;
|
|
3287
|
+
if (store.notifiedIsDark === isDark) return;
|
|
3288
|
+
store.notifiedIsDark = isDark;
|
|
3287
3289
|
for (const sub of store.subscribers) sub();
|
|
3288
3290
|
}
|
|
3289
3291
|
function getGlobalDarkMode() {
|
package/dist/index.js
CHANGED
|
@@ -2765,7 +2765,7 @@ var RESPONSIVE_KEY = "__kbach_responsive__";
|
|
|
2765
2765
|
function getStore() {
|
|
2766
2766
|
const g = globalThis;
|
|
2767
2767
|
if (!g[RESPONSIVE_KEY]) {
|
|
2768
|
-
g[RESPONSIVE_KEY] = { width: 0, screens: {}, listeners: /* @__PURE__ */ new Set() };
|
|
2768
|
+
g[RESPONSIVE_KEY] = { width: 0, notifiedWidth: 0, screens: {}, listeners: /* @__PURE__ */ new Set() };
|
|
2769
2769
|
}
|
|
2770
2770
|
return g[RESPONSIVE_KEY];
|
|
2771
2771
|
}
|
|
@@ -2780,8 +2780,9 @@ function getGlobalScreens() {
|
|
|
2780
2780
|
}
|
|
2781
2781
|
function setGlobalWidth(width) {
|
|
2782
2782
|
const store = getStore();
|
|
2783
|
-
if (store.width === width) return;
|
|
2784
2783
|
store.width = width;
|
|
2784
|
+
if (store.notifiedWidth === width) return;
|
|
2785
|
+
store.notifiedWidth = width;
|
|
2785
2786
|
for (const l of store.listeners) l();
|
|
2786
2787
|
}
|
|
2787
2788
|
function getGlobalWidth() {
|
|
@@ -3352,7 +3353,7 @@ var KEY = "__kbach_dark_store__";
|
|
|
3352
3353
|
function getStore2() {
|
|
3353
3354
|
const g = globalThis;
|
|
3354
3355
|
if (!g[KEY]) {
|
|
3355
|
-
g[KEY] = { isDark: false, subscribers: /* @__PURE__ */ new Set() };
|
|
3356
|
+
g[KEY] = { isDark: false, notifiedIsDark: false, subscribers: /* @__PURE__ */ new Set() };
|
|
3356
3357
|
}
|
|
3357
3358
|
return g[KEY];
|
|
3358
3359
|
}
|
|
@@ -3361,8 +3362,9 @@ function syncGlobalDarkMode(isDark) {
|
|
|
3361
3362
|
}
|
|
3362
3363
|
function setGlobalDarkMode(isDark) {
|
|
3363
3364
|
const store = getStore2();
|
|
3364
|
-
if (store.isDark === isDark) return;
|
|
3365
3365
|
store.isDark = isDark;
|
|
3366
|
+
if (store.notifiedIsDark === isDark) return;
|
|
3367
|
+
store.notifiedIsDark = isDark;
|
|
3366
3368
|
for (const sub of store.subscribers) sub();
|
|
3367
3369
|
}
|
|
3368
3370
|
function getGlobalDarkMode() {
|
|
@@ -3444,6 +3446,7 @@ var useSyncExternalStore = import_react3.default.useSyncExternalStore ?? functio
|
|
|
3444
3446
|
|
|
3445
3447
|
// src/ThemeProvider.tsx
|
|
3446
3448
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
3449
|
+
var useIsomorphicLayoutEffect = isWeb || isNative ? import_react4.useLayoutEffect : import_react4.useEffect;
|
|
3447
3450
|
var STORAGE_KEY = "kbach-theme";
|
|
3448
3451
|
var _mountedProviderCount = 0;
|
|
3449
3452
|
var _warnedMultipleProviders = false;
|
|
@@ -3583,7 +3586,7 @@ function ThemeProvider({
|
|
|
3583
3586
|
const resolvedMode = mode === "system" ? systemScheme : mode;
|
|
3584
3587
|
const isDark = resolvedMode === "dark";
|
|
3585
3588
|
syncGlobalDarkMode(isDark);
|
|
3586
|
-
(
|
|
3589
|
+
useIsomorphicLayoutEffect(() => {
|
|
3587
3590
|
applyWebTheme(resolvedMode, resolvedConfig.darkMode);
|
|
3588
3591
|
setGlobalDarkMode(isDark);
|
|
3589
3592
|
}, [isDark, resolvedMode, resolvedConfig.darkMode]);
|
package/dist/index.mjs
CHANGED
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
useGlobalDarkMode,
|
|
43
43
|
useGlobalWidth,
|
|
44
44
|
useSyncExternalStore
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-XISB5W3A.mjs";
|
|
46
46
|
|
|
47
47
|
// src/context.tsx
|
|
48
48
|
import { createContext, useContext } from "react";
|
|
@@ -122,11 +122,13 @@ function useColors() {
|
|
|
122
122
|
import {
|
|
123
123
|
useCallback,
|
|
124
124
|
useEffect,
|
|
125
|
+
useLayoutEffect,
|
|
125
126
|
useMemo as useMemo2,
|
|
126
127
|
useRef,
|
|
127
128
|
useState
|
|
128
129
|
} from "react";
|
|
129
130
|
import { jsx } from "react/jsx-runtime";
|
|
131
|
+
var useIsomorphicLayoutEffect = isWeb || isNative ? useLayoutEffect : useEffect;
|
|
130
132
|
var STORAGE_KEY = "kbach-theme";
|
|
131
133
|
var _mountedProviderCount = 0;
|
|
132
134
|
var _warnedMultipleProviders = false;
|
|
@@ -266,7 +268,7 @@ function ThemeProvider({
|
|
|
266
268
|
const resolvedMode = mode === "system" ? systemScheme : mode;
|
|
267
269
|
const isDark = resolvedMode === "dark";
|
|
268
270
|
syncGlobalDarkMode(isDark);
|
|
269
|
-
|
|
271
|
+
useIsomorphicLayoutEffect(() => {
|
|
270
272
|
applyWebTheme(resolvedMode, resolvedConfig.darkMode);
|
|
271
273
|
setGlobalDarkMode(isDark);
|
|
272
274
|
}, [isDark, resolvedMode, resolvedConfig.darkMode]);
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -2723,7 +2723,7 @@ var RESPONSIVE_KEY = "__kbach_responsive__";
|
|
|
2723
2723
|
function getStore() {
|
|
2724
2724
|
const g = globalThis;
|
|
2725
2725
|
if (!g[RESPONSIVE_KEY]) {
|
|
2726
|
-
g[RESPONSIVE_KEY] = { width: 0, screens: {}, listeners: /* @__PURE__ */ new Set() };
|
|
2726
|
+
g[RESPONSIVE_KEY] = { width: 0, notifiedWidth: 0, screens: {}, listeners: /* @__PURE__ */ new Set() };
|
|
2727
2727
|
}
|
|
2728
2728
|
return g[RESPONSIVE_KEY];
|
|
2729
2729
|
}
|
|
@@ -3270,7 +3270,7 @@ var KEY = "__kbach_dark_store__";
|
|
|
3270
3270
|
function getStore2() {
|
|
3271
3271
|
const g = globalThis;
|
|
3272
3272
|
if (!g[KEY]) {
|
|
3273
|
-
g[KEY] = { isDark: false, subscribers: /* @__PURE__ */ new Set() };
|
|
3273
|
+
g[KEY] = { isDark: false, notifiedIsDark: false, subscribers: /* @__PURE__ */ new Set() };
|
|
3274
3274
|
}
|
|
3275
3275
|
return g[KEY];
|
|
3276
3276
|
}
|
package/dist/jsx-dev-runtime.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
Fragment,
|
|
4
4
|
jsx,
|
|
5
5
|
jsxs
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-RUI5EQDF.mjs";
|
|
7
|
+
import "./chunk-XISB5W3A.mjs";
|
|
8
8
|
|
|
9
9
|
// src/jsx-dev-runtime.tsx
|
|
10
10
|
function jsxDEV(type, props, key, isStaticChildren, source, self) {
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -2724,7 +2724,7 @@ var RESPONSIVE_KEY = "__kbach_responsive__";
|
|
|
2724
2724
|
function getStore() {
|
|
2725
2725
|
const g = globalThis;
|
|
2726
2726
|
if (!g[RESPONSIVE_KEY]) {
|
|
2727
|
-
g[RESPONSIVE_KEY] = { width: 0, screens: {}, listeners: /* @__PURE__ */ new Set() };
|
|
2727
|
+
g[RESPONSIVE_KEY] = { width: 0, notifiedWidth: 0, screens: {}, listeners: /* @__PURE__ */ new Set() };
|
|
2728
2728
|
}
|
|
2729
2729
|
return g[RESPONSIVE_KEY];
|
|
2730
2730
|
}
|
|
@@ -3271,7 +3271,7 @@ var KEY = "__kbach_dark_store__";
|
|
|
3271
3271
|
function getStore2() {
|
|
3272
3272
|
const g = globalThis;
|
|
3273
3273
|
if (!g[KEY]) {
|
|
3274
|
-
g[KEY] = { isDark: false, subscribers: /* @__PURE__ */ new Set() };
|
|
3274
|
+
g[KEY] = { isDark: false, notifiedIsDark: false, subscribers: /* @__PURE__ */ new Set() };
|
|
3275
3275
|
}
|
|
3276
3276
|
return g[KEY];
|
|
3277
3277
|
}
|
package/dist/jsx-runtime.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
_invalidateDefaultFontCache,
|
|
5
5
|
jsx,
|
|
6
6
|
jsxs
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RUI5EQDF.mjs";
|
|
8
8
|
import {
|
|
9
9
|
registerWebElement
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XISB5W3A.mjs";
|
|
11
11
|
export {
|
|
12
12
|
Fragment,
|
|
13
13
|
_invalidateDefaultFontCache,
|