@kbach/react 0.5.59 → 0.5.60

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.
@@ -90,7 +90,12 @@ var _lastFontVersion = -1;
90
90
  function _invalidateDefaultFontCache() {
91
91
  _defaultFontVersion++;
92
92
  }
93
- onConfigChange(_invalidateDefaultFontCache);
93
+ {
94
+ const _KEY = "__kbach_font_cache_unsub__";
95
+ const g = globalThis;
96
+ if (g[_KEY]) g[_KEY]();
97
+ g[_KEY] = onConfigChange(_invalidateDefaultFontCache);
98
+ }
94
99
  function getCachedDefaultFont() {
95
100
  if (_lastFontVersion !== _defaultFontVersion) {
96
101
  _cachedDefaultFont = getDefaultFontFamily();
package/dist/index.js CHANGED
@@ -3400,8 +3400,14 @@ function ThemeProvider({
3400
3400
  }, [configOverride]);
3401
3401
  (0, import_react3.useEffect)(() => {
3402
3402
  if (configOverride) return;
3403
- const unsub = onConfigChange(setResolvedConfig);
3404
- return unsub;
3403
+ let mounted = true;
3404
+ const unsub = onConfigChange((config) => {
3405
+ if (mounted) setResolvedConfig(config);
3406
+ });
3407
+ return () => {
3408
+ mounted = false;
3409
+ unsub();
3410
+ };
3405
3411
  }, [configOverride]);
3406
3412
  const contextValue = (0, import_react3.useMemo)(
3407
3413
  () => ({ mode, resolvedMode, isDark, setMode, toggle, config: resolvedConfig }),
package/dist/index.mjs CHANGED
@@ -254,8 +254,14 @@ function ThemeProvider({
254
254
  }, [configOverride]);
255
255
  useEffect(() => {
256
256
  if (configOverride) return;
257
- const unsub = onConfigChange(setResolvedConfig);
258
- return unsub;
257
+ let mounted = true;
258
+ const unsub = onConfigChange((config) => {
259
+ if (mounted) setResolvedConfig(config);
260
+ });
261
+ return () => {
262
+ mounted = false;
263
+ unsub();
264
+ };
259
265
  }, [configOverride]);
260
266
  const contextValue = useMemo2(
261
267
  () => ({ mode, resolvedMode, isDark, setMode, toggle, config: resolvedConfig }),
@@ -3631,7 +3631,12 @@ var _lastFontVersion = -1;
3631
3631
  function _invalidateDefaultFontCache() {
3632
3632
  _defaultFontVersion++;
3633
3633
  }
3634
- onConfigChange(_invalidateDefaultFontCache);
3634
+ {
3635
+ const _KEY = "__kbach_font_cache_unsub__";
3636
+ const g = globalThis;
3637
+ if (g[_KEY]) g[_KEY]();
3638
+ g[_KEY] = onConfigChange(_invalidateDefaultFontCache);
3639
+ }
3635
3640
  function getCachedDefaultFont() {
3636
3641
  if (_lastFontVersion !== _defaultFontVersion) {
3637
3642
  _cachedDefaultFont = getDefaultFontFamily();
@@ -2,7 +2,7 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-HRNOI54V.mjs";
5
+ } from "./chunk-LU2QNVYU.mjs";
6
6
  import "./chunk-2MVCYYH5.mjs";
7
7
  import "./chunk-NP4FVE77.mjs";
8
8
 
@@ -3637,7 +3637,12 @@ var _lastFontVersion = -1;
3637
3637
  function _invalidateDefaultFontCache() {
3638
3638
  _defaultFontVersion++;
3639
3639
  }
3640
- onConfigChange(_invalidateDefaultFontCache);
3640
+ {
3641
+ const _KEY = "__kbach_font_cache_unsub__";
3642
+ const g = globalThis;
3643
+ if (g[_KEY]) g[_KEY]();
3644
+ g[_KEY] = onConfigChange(_invalidateDefaultFontCache);
3645
+ }
3641
3646
  function getCachedDefaultFont() {
3642
3647
  if (_lastFontVersion !== _defaultFontVersion) {
3643
3648
  _cachedDefaultFont = getDefaultFontFamily();
@@ -3,7 +3,7 @@ import {
3
3
  _invalidateDefaultFontCache,
4
4
  jsx,
5
5
  jsxs
6
- } from "./chunk-HRNOI54V.mjs";
6
+ } from "./chunk-LU2QNVYU.mjs";
7
7
  import {
8
8
  registerWebElement
9
9
  } from "./chunk-2MVCYYH5.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.5.59",
3
+ "version": "0.5.60",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",