@kbach/react 0.5.58 → 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.
@@ -7,7 +7,7 @@ import {
7
7
  isNative,
8
8
  isWeb,
9
9
  subscribeGlobalWidth
10
- } from "./chunk-2HWRNTJG.mjs";
10
+ } from "./chunk-NP4FVE77.mjs";
11
11
 
12
12
  // src/core/darkModeStore.ts
13
13
  var KEY = "__kbach_dark_store__";
@@ -6,7 +6,7 @@ import {
6
6
  transformToWebProps,
7
7
  useConditionalWidth,
8
8
  useGlobalDarkMode
9
- } from "./chunk-F5NQX5YO.mjs";
9
+ } from "./chunk-2MVCYYH5.mjs";
10
10
  import {
11
11
  flatten,
12
12
  getActiveBreakpoints,
@@ -22,7 +22,7 @@ import {
22
22
  normalizeClassString,
23
23
  onConfigChange,
24
24
  resolve
25
- } from "./chunk-2HWRNTJG.mjs";
25
+ } from "./chunk-NP4FVE77.mjs";
26
26
 
27
27
  // src/jsx-runtime.tsx
28
28
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -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();
@@ -182,6 +187,14 @@ function processElement(type, rawProps, key, isStaticChildren) {
182
187
  ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
183
188
  }, key);
184
189
  }
190
+ if (classStr && !__kbachStyles && /^(__[^\s]+\s*)+$/.test(classStr.trim())) {
191
+ const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
192
+ return makeElement(isStaticChildren, effectiveType, {
193
+ ...passProps2,
194
+ className: classStr,
195
+ ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
196
+ }, key);
197
+ }
185
198
  if (!classStr && !__kbachStyles) {
186
199
  if (isWeb) return makeElement(isStaticChildren, effectiveType, omitConsumed(workingProps), key);
187
200
  const defaultFont = getCachedDefaultFont();
@@ -2856,7 +2856,7 @@ function resolve(classString, theme, darkMode = "attribute") {
2856
2856
  for (const parsed of parseClasses(classString)) {
2857
2857
  const styles = resolveUtility(parsed, theme);
2858
2858
  if (!styles) {
2859
- if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility)) {
2859
+ if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility) && !parsed.original.startsWith("__")) {
2860
2860
  console.warn(`[kbach] Unknown utility "${parsed.utility}" in class "${parsed.original}"`);
2861
2861
  }
2862
2862
  continue;
package/dist/index.js CHANGED
@@ -2984,7 +2984,7 @@ function resolve(classString, theme, darkMode = "attribute") {
2984
2984
  for (const parsed of parseClasses(classString)) {
2985
2985
  const styles = resolveUtility(parsed, theme);
2986
2986
  if (!styles) {
2987
- if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility)) {
2987
+ if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility) && !parsed.original.startsWith("__")) {
2988
2988
  console.warn(`[kbach] Unknown utility "${parsed.utility}" in class "${parsed.original}"`);
2989
2989
  }
2990
2990
  continue;
@@ -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
@@ -11,7 +11,7 @@ import {
11
11
  useConditionalWidth,
12
12
  useGlobalDarkMode,
13
13
  useGlobalWidth
14
- } from "./chunk-F5NQX5YO.mjs";
14
+ } from "./chunk-2MVCYYH5.mjs";
15
15
  import {
16
16
  __require,
17
17
  buildConfig,
@@ -33,7 +33,7 @@ import {
33
33
  syncGlobalScreens,
34
34
  syncGlobalWidth,
35
35
  updateConfig
36
- } from "./chunk-2HWRNTJG.mjs";
36
+ } from "./chunk-NP4FVE77.mjs";
37
37
 
38
38
  // src/context.tsx
39
39
  import { createContext, useContext } from "react";
@@ -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 }),
@@ -2862,7 +2862,7 @@ function resolve(classString, theme, darkMode = "attribute") {
2862
2862
  for (const parsed of parseClasses(classString)) {
2863
2863
  const styles = resolveUtility(parsed, theme);
2864
2864
  if (!styles) {
2865
- if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility)) {
2865
+ if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility) && !parsed.original.startsWith("__")) {
2866
2866
  console.warn(`[kbach] Unknown utility "${parsed.utility}" in class "${parsed.original}"`);
2867
2867
  }
2868
2868
  continue;
@@ -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();
@@ -3723,6 +3728,14 @@ function processElement(type, rawProps, key, isStaticChildren) {
3723
3728
  ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
3724
3729
  }, key);
3725
3730
  }
3731
+ if (classStr && !__kbachStyles && /^(__[^\s]+\s*)+$/.test(classStr.trim())) {
3732
+ const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
3733
+ return makeElement(isStaticChildren, effectiveType, {
3734
+ ...passProps2,
3735
+ className: classStr,
3736
+ ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
3737
+ }, key);
3738
+ }
3726
3739
  if (!classStr && !__kbachStyles) {
3727
3740
  if (isWeb) return makeElement(isStaticChildren, effectiveType, omitConsumed(workingProps), key);
3728
3741
  const defaultFont = getCachedDefaultFont();
@@ -2,9 +2,9 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-EMSB47ES.mjs";
6
- import "./chunk-F5NQX5YO.mjs";
7
- import "./chunk-2HWRNTJG.mjs";
5
+ } from "./chunk-LU2QNVYU.mjs";
6
+ import "./chunk-2MVCYYH5.mjs";
7
+ import "./chunk-NP4FVE77.mjs";
8
8
 
9
9
  // src/jsx-dev-runtime.tsx
10
10
  function jsxDEV(type, props, key, isStaticChildren, source, self) {
@@ -2863,7 +2863,7 @@ function resolve(classString, theme, darkMode = "attribute") {
2863
2863
  for (const parsed of parseClasses(classString)) {
2864
2864
  const styles = resolveUtility(parsed, theme);
2865
2865
  if (!styles) {
2866
- if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility)) {
2866
+ if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility) && !parsed.original.startsWith("__")) {
2867
2867
  console.warn(`[kbach] Unknown utility "${parsed.utility}" in class "${parsed.original}"`);
2868
2868
  }
2869
2869
  continue;
@@ -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();
@@ -3729,6 +3734,14 @@ function processElement(type, rawProps, key, isStaticChildren) {
3729
3734
  ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
3730
3735
  }, key);
3731
3736
  }
3737
+ if (classStr && !__kbachStyles && /^(__[^\s]+\s*)+$/.test(classStr.trim())) {
3738
+ const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
3739
+ return makeElement(isStaticChildren, effectiveType, {
3740
+ ...passProps2,
3741
+ className: classStr,
3742
+ ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
3743
+ }, key);
3744
+ }
3732
3745
  if (!classStr && !__kbachStyles) {
3733
3746
  if (isWeb) return makeElement(isStaticChildren, effectiveType, omitConsumed(workingProps), key);
3734
3747
  const defaultFont = getCachedDefaultFont();
@@ -3,11 +3,11 @@ import {
3
3
  _invalidateDefaultFontCache,
4
4
  jsx,
5
5
  jsxs
6
- } from "./chunk-EMSB47ES.mjs";
6
+ } from "./chunk-LU2QNVYU.mjs";
7
7
  import {
8
8
  registerWebElement
9
- } from "./chunk-F5NQX5YO.mjs";
10
- import "./chunk-2HWRNTJG.mjs";
9
+ } from "./chunk-2MVCYYH5.mjs";
10
+ import "./chunk-NP4FVE77.mjs";
11
11
  export {
12
12
  Fragment,
13
13
  _invalidateDefaultFontCache,
@@ -4,7 +4,7 @@ import {
4
4
  generateClassCSS,
5
5
  setCSSGenMode,
6
6
  splitClassTokens
7
- } from "./chunk-2HWRNTJG.mjs";
7
+ } from "./chunk-NP4FVE77.mjs";
8
8
 
9
9
  // src/vite-plugin.ts
10
10
  import { readFileSync, writeFileSync, readdirSync, statSync } from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.5.58",
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",