@kbach/react 0.3.7 → 0.3.9

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.
@@ -8,7 +8,7 @@ import {
8
8
  resolve,
9
9
  useConditionalWidth,
10
10
  useGlobalDarkMode
11
- } from "./chunk-2D35ZED5.mjs";
11
+ } from "./chunk-UG3UVDJA.mjs";
12
12
 
13
13
  // src/jsx-runtime.tsx
14
14
  import { jsx as _jsx, jsxs as _jsxs, Fragment } from "react/jsx-runtime";
@@ -28,7 +28,7 @@ function hasResponsiveBuckets(resolved) {
28
28
  var DarkWrapper = React.forwardRef(
29
29
  function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
30
30
  const isDark = useGlobalDarkMode();
31
- const needsWidth = !isWeb && hasResponsiveBuckets(resolvedStyle);
31
+ const needsWidth = hasResponsiveBuckets(resolvedStyle);
32
32
  const width = useConditionalWidth(needsWidth);
33
33
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
34
34
  const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
@@ -115,6 +115,15 @@ function processElement(type, rawProps, key, isStaticChildren) {
115
115
  return makeElement(isStaticChildren, type, rawProps, key);
116
116
  }
117
117
  const config = getConfig();
118
+ if (isWeb && classStr) {
119
+ resolve(classStr, config.theme, config.darkMode);
120
+ const { style: userStyle2, ...passProps2 } = omitConsumed(rawProps);
121
+ return makeElement(isStaticChildren, type, {
122
+ ...passProps2,
123
+ className: classStr,
124
+ ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
125
+ }, key);
126
+ }
118
127
  const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
119
128
  const { style: userStyle, ...passProps } = omitConsumed(rawProps);
120
129
  const { interactive, modeOrResponsive } = bucketMods(resolved);
@@ -2040,12 +2040,10 @@ function resolve(classString, theme, darkMode = "attribute") {
2040
2040
  }
2041
2041
  }
2042
2042
  styleCache.set(cacheKey, result);
2043
- if (isWeb && injectQueue.length > 0) {
2044
- Promise.resolve().then(() => {
2045
- for (const { cls, bucketKey, styles } of injectQueue) {
2046
- injectClassRule(cls, bucketKey, styles, darkMode);
2047
- }
2048
- });
2043
+ if (isWeb) {
2044
+ for (const { cls, bucketKey, styles } of injectQueue) {
2045
+ injectClassRule(cls, bucketKey, styles, darkMode);
2046
+ }
2049
2047
  }
2050
2048
  return result;
2051
2049
  }
@@ -2362,7 +2360,7 @@ var InteractiveWrapper = forwardRef(
2362
2360
  ...rest
2363
2361
  }, ref) {
2364
2362
  const isDark = useGlobalDarkMode();
2365
- const needsWidth = !isWeb && hasResponsiveBuckets(resolvedStyle);
2363
+ const needsWidth = hasResponsiveBuckets(resolvedStyle);
2366
2364
  const width = useConditionalWidth(needsWidth);
2367
2365
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
2368
2366
  const [pressed, setPressed] = useState(false);
package/dist/index.js CHANGED
@@ -2170,12 +2170,10 @@ function resolve(classString, theme, darkMode = "attribute") {
2170
2170
  }
2171
2171
  }
2172
2172
  styleCache.set(cacheKey, result);
2173
- if (isWeb && injectQueue.length > 0) {
2174
- Promise.resolve().then(() => {
2175
- for (const { cls, bucketKey, styles } of injectQueue) {
2176
- injectClassRule(cls, bucketKey, styles, darkMode);
2177
- }
2178
- });
2173
+ if (isWeb) {
2174
+ for (const { cls, bucketKey, styles } of injectQueue) {
2175
+ injectClassRule(cls, bucketKey, styles, darkMode);
2176
+ }
2179
2177
  }
2180
2178
  return result;
2181
2179
  }
@@ -2779,7 +2777,7 @@ function useConditionalWidth(active) {
2779
2777
  function useStyles(classString, state = {}) {
2780
2778
  const { isDark, config } = useTheme();
2781
2779
  const width = useGlobalWidth();
2782
- const breakpoints = isWeb ? EMPTY_BREAKPOINTS : getActiveBreakpoints(width);
2780
+ const breakpoints = getActiveBreakpoints(width);
2783
2781
  const normalised = Array.isArray(classString) ? classString.join(" ") : classString;
2784
2782
  return (0, import_react7.useMemo)(() => {
2785
2783
  const resolved = resolve(normalised, config.theme, config.darkMode);
@@ -2866,7 +2864,7 @@ var InteractiveWrapper = (0, import_react9.forwardRef)(
2866
2864
  ...rest
2867
2865
  }, ref) {
2868
2866
  const isDark = useGlobalDarkMode();
2869
- const needsWidth = !isWeb && hasResponsiveBuckets(resolvedStyle);
2867
+ const needsWidth = hasResponsiveBuckets(resolvedStyle);
2870
2868
  const width = useConditionalWidth(needsWidth);
2871
2869
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
2872
2870
  const [pressed, setPressed] = (0, import_react9.useState)(false);
package/dist/index.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import {
2
- EMPTY_BREAKPOINTS,
3
2
  InteractiveWrapper,
4
3
  __require,
5
4
  buildConfig,
@@ -22,7 +21,7 @@ import {
22
21
  updateConfig,
23
22
  useGlobalDarkMode,
24
23
  useGlobalWidth
25
- } from "./chunk-2D35ZED5.mjs";
24
+ } from "./chunk-UG3UVDJA.mjs";
26
25
 
27
26
  // src/context.tsx
28
27
  import { createContext, useContext } from "react";
@@ -445,7 +444,7 @@ import { useMemo as useMemo4 } from "react";
445
444
  function useStyles(classString, state = {}) {
446
445
  const { isDark, config } = useTheme();
447
446
  const width = useGlobalWidth();
448
- const breakpoints = isWeb ? EMPTY_BREAKPOINTS : getActiveBreakpoints(width);
447
+ const breakpoints = getActiveBreakpoints(width);
449
448
  const normalised = Array.isArray(classString) ? classString.join(" ") : classString;
450
449
  return useMemo4(() => {
451
450
  const resolved = resolve(normalised, config.theme, config.darkMode);
@@ -2061,12 +2061,10 @@ function resolve(classString, theme, darkMode = "attribute") {
2061
2061
  }
2062
2062
  }
2063
2063
  styleCache.set(cacheKey, result);
2064
- if (isWeb && injectQueue.length > 0) {
2065
- Promise.resolve().then(() => {
2066
- for (const { cls, bucketKey, styles } of injectQueue) {
2067
- injectClassRule(cls, bucketKey, styles, darkMode);
2068
- }
2069
- });
2064
+ if (isWeb) {
2065
+ for (const { cls, bucketKey, styles } of injectQueue) {
2066
+ injectClassRule(cls, bucketKey, styles, darkMode);
2067
+ }
2070
2068
  }
2071
2069
  return result;
2072
2070
  }
@@ -2349,7 +2347,7 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
2349
2347
  ...rest
2350
2348
  }, ref) {
2351
2349
  const isDark = useGlobalDarkMode();
2352
- const needsWidth = !isWeb && hasResponsiveBuckets(resolvedStyle);
2350
+ const needsWidth = hasResponsiveBuckets(resolvedStyle);
2353
2351
  const width = useConditionalWidth(needsWidth);
2354
2352
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
2355
2353
  const [pressed, setPressed] = (0, import_react3.useState)(false);
@@ -2400,7 +2398,7 @@ function hasResponsiveBuckets2(resolved) {
2400
2398
  var DarkWrapper = import_react4.default.forwardRef(
2401
2399
  function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
2402
2400
  const isDark = useGlobalDarkMode();
2403
- const needsWidth = !isWeb && hasResponsiveBuckets2(resolvedStyle);
2401
+ const needsWidth = hasResponsiveBuckets2(resolvedStyle);
2404
2402
  const width = useConditionalWidth(needsWidth);
2405
2403
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
2406
2404
  const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
@@ -2487,6 +2485,15 @@ function processElement(type, rawProps, key, isStaticChildren) {
2487
2485
  return makeElement(isStaticChildren, type, rawProps, key);
2488
2486
  }
2489
2487
  const config = getConfig();
2488
+ if (isWeb && classStr) {
2489
+ resolve(classStr, config.theme, config.darkMode);
2490
+ const { style: userStyle2, ...passProps2 } = omitConsumed(rawProps);
2491
+ return makeElement(isStaticChildren, type, {
2492
+ ...passProps2,
2493
+ className: classStr,
2494
+ ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
2495
+ }, key);
2496
+ }
2490
2497
  const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
2491
2498
  const { style: userStyle, ...passProps } = omitConsumed(rawProps);
2492
2499
  const { interactive, modeOrResponsive } = bucketMods(resolved);
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-VTAK5IRJ.mjs";
6
- import "./chunk-2D35ZED5.mjs";
5
+ } from "./chunk-HDKCXMOY.mjs";
6
+ import "./chunk-UG3UVDJA.mjs";
7
7
 
8
8
  // src/jsx-dev-runtime.tsx
9
9
  function jsxDEV(type, props, key, isStaticChildren, _source, _self) {
@@ -2060,12 +2060,10 @@ function resolve(classString, theme, darkMode = "attribute") {
2060
2060
  }
2061
2061
  }
2062
2062
  styleCache.set(cacheKey, result);
2063
- if (isWeb && injectQueue.length > 0) {
2064
- Promise.resolve().then(() => {
2065
- for (const { cls, bucketKey, styles } of injectQueue) {
2066
- injectClassRule(cls, bucketKey, styles, darkMode);
2067
- }
2068
- });
2063
+ if (isWeb) {
2064
+ for (const { cls, bucketKey, styles } of injectQueue) {
2065
+ injectClassRule(cls, bucketKey, styles, darkMode);
2066
+ }
2069
2067
  }
2070
2068
  return result;
2071
2069
  }
@@ -2348,7 +2346,7 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
2348
2346
  ...rest
2349
2347
  }, ref) {
2350
2348
  const isDark = useGlobalDarkMode();
2351
- const needsWidth = !isWeb && hasResponsiveBuckets(resolvedStyle);
2349
+ const needsWidth = hasResponsiveBuckets(resolvedStyle);
2352
2350
  const width = useConditionalWidth(needsWidth);
2353
2351
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
2354
2352
  const [pressed, setPressed] = (0, import_react3.useState)(false);
@@ -2399,7 +2397,7 @@ function hasResponsiveBuckets2(resolved) {
2399
2397
  var DarkWrapper = import_react4.default.forwardRef(
2400
2398
  function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
2401
2399
  const isDark = useGlobalDarkMode();
2402
- const needsWidth = !isWeb && hasResponsiveBuckets2(resolvedStyle);
2400
+ const needsWidth = hasResponsiveBuckets2(resolvedStyle);
2403
2401
  const width = useConditionalWidth(needsWidth);
2404
2402
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
2405
2403
  const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
@@ -2486,6 +2484,15 @@ function processElement(type, rawProps, key, isStaticChildren) {
2486
2484
  return makeElement(isStaticChildren, type, rawProps, key);
2487
2485
  }
2488
2486
  const config = getConfig();
2487
+ if (isWeb && classStr) {
2488
+ resolve(classStr, config.theme, config.darkMode);
2489
+ const { style: userStyle2, ...passProps2 } = omitConsumed(rawProps);
2490
+ return makeElement(isStaticChildren, type, {
2491
+ ...passProps2,
2492
+ className: classStr,
2493
+ ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
2494
+ }, key);
2495
+ }
2489
2496
  const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
2490
2497
  const { style: userStyle, ...passProps } = omitConsumed(rawProps);
2491
2498
  const { interactive, modeOrResponsive } = bucketMods(resolved);
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-VTAK5IRJ.mjs";
6
- import "./chunk-2D35ZED5.mjs";
5
+ } from "./chunk-HDKCXMOY.mjs";
6
+ import "./chunk-UG3UVDJA.mjs";
7
7
  export {
8
8
  Fragment,
9
9
  jsx,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
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",