@kbach/react 0.3.16 → 0.3.18

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.
@@ -1536,7 +1536,7 @@ var RESOLVERS = {
1536
1536
  },
1537
1537
  // ── Grid (responsive column count: grid-1 … grid-12) ─────────────────────
1538
1538
  grid: ({ value }) => {
1539
- if (!value || !isWeb) return null;
1539
+ if (!value || typeof document === "undefined") return null;
1540
1540
  const n = parseInt(value, 10);
1541
1541
  if (isNaN(n) || n < 1 || n > 12) return null;
1542
1542
  return { display: "grid", gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` };
@@ -1800,6 +1800,12 @@ var RESOLVERS = {
1800
1800
  function resolveUtility(parsed, theme) {
1801
1801
  if (!parsed.value) {
1802
1802
  if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
1803
+ if (parsed.utility === "grd" || parsed.utility === "grid") {
1804
+ return typeof document !== "undefined" ? { display: "grid" } : null;
1805
+ }
1806
+ if (parsed.utility === "inline-grid") {
1807
+ return typeof document !== "undefined" ? { display: "inline-grid" } : null;
1808
+ }
1803
1809
  if (parsed.utility in STANDALONE) return STANDALONE[parsed.utility] ?? null;
1804
1810
  }
1805
1811
  const resolver = PLUGIN_RESOLVERS[parsed.utility] ?? RESOLVERS[parsed.utility];
@@ -2046,12 +2052,12 @@ function resolve(classString, theme, darkMode = "attribute") {
2046
2052
  const bucketKey = parsed.modifiers.length === 0 ? "base" : parsed.modifiers.join(":");
2047
2053
  if (!result[bucketKey]) result[bucketKey] = {};
2048
2054
  Object.assign(result[bucketKey], styles);
2049
- if (isWeb) {
2055
+ if (typeof document !== "undefined") {
2050
2056
  injectQueue.push({ cls: parsed.original, bucketKey, styles });
2051
2057
  }
2052
2058
  }
2053
2059
  styleCache.set(cacheKey, result);
2054
- if (isWeb) {
2060
+ if (typeof document !== "undefined") {
2055
2061
  for (const { cls, bucketKey, styles } of injectQueue) {
2056
2062
  injectClassRule(cls, bucketKey, styles, darkMode);
2057
2063
  }
@@ -2418,7 +2424,7 @@ var InteractiveWrapper = forwardRef(
2418
2424
  const computedStyle = useMemo(
2419
2425
  () => {
2420
2426
  const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
2421
- if (isWeb && typeof Component !== "string") {
2427
+ if (typeof Component !== "string") {
2422
2428
  if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2423
2429
  delete s.gridTemplateColumns;
2424
2430
  delete s.gridTemplateRows;
@@ -8,7 +8,7 @@ import {
8
8
  resolve,
9
9
  useConditionalWidth,
10
10
  useGlobalDarkMode
11
- } from "./chunk-PDPOXGSG.mjs";
11
+ } from "./chunk-437T7FQC.mjs";
12
12
 
13
13
  // src/jsx-runtime.tsx
14
14
  import { jsx as _jsx, jsxs as _jsxs, Fragment } from "react/jsx-runtime";
@@ -32,7 +32,7 @@ var DarkWrapper = React.forwardRef(
32
32
  const width = useConditionalWidth(needsWidth);
33
33
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
34
34
  const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
35
- if (isWeb && typeof Component !== "string") stripWebGridProps(computedStyle);
35
+ if (typeof Component !== "string") stripWebGridProps(computedStyle);
36
36
  const finalStyle = styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
37
37
  const props = { ref, ...rest, style: finalStyle };
38
38
  return Array.isArray(children) ? React.createElement(Component, props, ...children) : React.createElement(Component, props, children);
@@ -127,7 +127,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
127
127
  return makeElement(isStaticChildren, type, rawProps, key);
128
128
  }
129
129
  const config = getConfig();
130
- const isGrdOnWeb = isWeb && classStr != null && /(?:^|\s)grd(?:\s|$)/.test(classStr);
130
+ const isGrdOnWeb = typeof document !== "undefined" && classStr != null && /(?:^|\s)grd(?:\s|$)/.test(classStr);
131
131
  const actualType = isGrdOnWeb ? "div" : type;
132
132
  const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
133
133
  const { style: userStyle, ...passProps } = omitConsumed(rawProps);
@@ -151,7 +151,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
151
151
  }, key);
152
152
  }
153
153
  const computedStyle = flatten(resolved, false);
154
- if (isWeb && typeof actualType !== "string") {
154
+ if (typeof actualType !== "string") {
155
155
  if (computedStyle.display === "grid" || computedStyle.display === "inline-grid") delete computedStyle.display;
156
156
  delete computedStyle.gridTemplateColumns;
157
157
  delete computedStyle.gridTemplateRows;
package/dist/index.js CHANGED
@@ -1702,7 +1702,7 @@ var RESOLVERS = {
1702
1702
  },
1703
1703
  // ── Grid (responsive column count: grid-1 … grid-12) ─────────────────────
1704
1704
  grid: ({ value }) => {
1705
- if (!value || !isWeb) return null;
1705
+ if (!value || typeof document === "undefined") return null;
1706
1706
  const n = parseInt(value, 10);
1707
1707
  if (isNaN(n) || n < 1 || n > 12) return null;
1708
1708
  return { display: "grid", gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` };
@@ -1966,6 +1966,12 @@ var RESOLVERS = {
1966
1966
  function resolveUtility(parsed, theme) {
1967
1967
  if (!parsed.value) {
1968
1968
  if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
1969
+ if (parsed.utility === "grd" || parsed.utility === "grid") {
1970
+ return typeof document !== "undefined" ? { display: "grid" } : null;
1971
+ }
1972
+ if (parsed.utility === "inline-grid") {
1973
+ return typeof document !== "undefined" ? { display: "inline-grid" } : null;
1974
+ }
1969
1975
  if (parsed.utility in STANDALONE) return STANDALONE[parsed.utility] ?? null;
1970
1976
  }
1971
1977
  const resolver = PLUGIN_RESOLVERS[parsed.utility] ?? RESOLVERS[parsed.utility];
@@ -2176,12 +2182,12 @@ function resolve(classString, theme, darkMode = "attribute") {
2176
2182
  const bucketKey = parsed.modifiers.length === 0 ? "base" : parsed.modifiers.join(":");
2177
2183
  if (!result[bucketKey]) result[bucketKey] = {};
2178
2184
  Object.assign(result[bucketKey], styles);
2179
- if (isWeb) {
2185
+ if (typeof document !== "undefined") {
2180
2186
  injectQueue.push({ cls: parsed.original, bucketKey, styles });
2181
2187
  }
2182
2188
  }
2183
2189
  styleCache.set(cacheKey, result);
2184
- if (isWeb) {
2190
+ if (typeof document !== "undefined") {
2185
2191
  for (const { cls, bucketKey, styles } of injectQueue) {
2186
2192
  injectClassRule(cls, bucketKey, styles, darkMode);
2187
2193
  }
@@ -2922,7 +2928,7 @@ var InteractiveWrapper = (0, import_react9.forwardRef)(
2922
2928
  const computedStyle = (0, import_react9.useMemo)(
2923
2929
  () => {
2924
2930
  const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
2925
- if (isWeb && typeof Component !== "string") {
2931
+ if (typeof Component !== "string") {
2926
2932
  if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2927
2933
  delete s.gridTemplateColumns;
2928
2934
  delete s.gridTemplateRows;
package/dist/index.mjs CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  updateConfig,
22
22
  useGlobalDarkMode,
23
23
  useGlobalWidth
24
- } from "./chunk-PDPOXGSG.mjs";
24
+ } from "./chunk-437T7FQC.mjs";
25
25
 
26
26
  // src/context.tsx
27
27
  import { createContext, useContext } from "react";
@@ -1605,7 +1605,7 @@ var RESOLVERS = {
1605
1605
  },
1606
1606
  // ── Grid (responsive column count: grid-1 … grid-12) ─────────────────────
1607
1607
  grid: ({ value }) => {
1608
- if (!value || !isWeb) return null;
1608
+ if (!value || typeof document === "undefined") return null;
1609
1609
  const n = parseInt(value, 10);
1610
1610
  if (isNaN(n) || n < 1 || n > 12) return null;
1611
1611
  return { display: "grid", gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` };
@@ -1869,6 +1869,12 @@ var RESOLVERS = {
1869
1869
  function resolveUtility(parsed, theme) {
1870
1870
  if (!parsed.value) {
1871
1871
  if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
1872
+ if (parsed.utility === "grd" || parsed.utility === "grid") {
1873
+ return typeof document !== "undefined" ? { display: "grid" } : null;
1874
+ }
1875
+ if (parsed.utility === "inline-grid") {
1876
+ return typeof document !== "undefined" ? { display: "inline-grid" } : null;
1877
+ }
1872
1878
  if (parsed.utility in STANDALONE) return STANDALONE[parsed.utility] ?? null;
1873
1879
  }
1874
1880
  const resolver = PLUGIN_RESOLVERS[parsed.utility] ?? RESOLVERS[parsed.utility];
@@ -2067,12 +2073,12 @@ function resolve(classString, theme, darkMode = "attribute") {
2067
2073
  const bucketKey = parsed.modifiers.length === 0 ? "base" : parsed.modifiers.join(":");
2068
2074
  if (!result[bucketKey]) result[bucketKey] = {};
2069
2075
  Object.assign(result[bucketKey], styles);
2070
- if (isWeb) {
2076
+ if (typeof document !== "undefined") {
2071
2077
  injectQueue.push({ cls: parsed.original, bucketKey, styles });
2072
2078
  }
2073
2079
  }
2074
2080
  styleCache.set(cacheKey, result);
2075
- if (isWeb) {
2081
+ if (typeof document !== "undefined") {
2076
2082
  for (const { cls, bucketKey, styles } of injectQueue) {
2077
2083
  injectClassRule(cls, bucketKey, styles, darkMode);
2078
2084
  }
@@ -2401,7 +2407,7 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
2401
2407
  const computedStyle = (0, import_react3.useMemo)(
2402
2408
  () => {
2403
2409
  const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
2404
- if (isWeb && typeof Component !== "string") {
2410
+ if (typeof Component !== "string") {
2405
2411
  if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2406
2412
  delete s.gridTemplateColumns;
2407
2413
  delete s.gridTemplateRows;
@@ -2455,7 +2461,7 @@ var DarkWrapper = import_react4.default.forwardRef(
2455
2461
  const width = useConditionalWidth(needsWidth);
2456
2462
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
2457
2463
  const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
2458
- if (isWeb && typeof Component !== "string") stripWebGridProps(computedStyle);
2464
+ if (typeof Component !== "string") stripWebGridProps(computedStyle);
2459
2465
  const finalStyle = styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
2460
2466
  const props = { ref, ...rest, style: finalStyle };
2461
2467
  return Array.isArray(children) ? import_react4.default.createElement(Component, props, ...children) : import_react4.default.createElement(Component, props, children);
@@ -2550,7 +2556,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
2550
2556
  return makeElement(isStaticChildren, type, rawProps, key);
2551
2557
  }
2552
2558
  const config = getConfig();
2553
- const isGrdOnWeb = isWeb && classStr != null && /(?:^|\s)grd(?:\s|$)/.test(classStr);
2559
+ const isGrdOnWeb = typeof document !== "undefined" && classStr != null && /(?:^|\s)grd(?:\s|$)/.test(classStr);
2554
2560
  const actualType = isGrdOnWeb ? "div" : type;
2555
2561
  const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
2556
2562
  const { style: userStyle, ...passProps } = omitConsumed(rawProps);
@@ -2574,7 +2580,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
2574
2580
  }, key);
2575
2581
  }
2576
2582
  const computedStyle = flatten(resolved, false);
2577
- if (isWeb && typeof actualType !== "string") {
2583
+ if (typeof actualType !== "string") {
2578
2584
  if (computedStyle.display === "grid" || computedStyle.display === "inline-grid") delete computedStyle.display;
2579
2585
  delete computedStyle.gridTemplateColumns;
2580
2586
  delete computedStyle.gridTemplateRows;
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-7DGFJPDP.mjs";
6
- import "./chunk-PDPOXGSG.mjs";
5
+ } from "./chunk-CIK3ADJB.mjs";
6
+ import "./chunk-437T7FQC.mjs";
7
7
 
8
8
  // src/jsx-dev-runtime.tsx
9
9
  function jsxDEV(type, props, key, isStaticChildren, _source, _self) {
@@ -1604,7 +1604,7 @@ var RESOLVERS = {
1604
1604
  },
1605
1605
  // ── Grid (responsive column count: grid-1 … grid-12) ─────────────────────
1606
1606
  grid: ({ value }) => {
1607
- if (!value || !isWeb) return null;
1607
+ if (!value || typeof document === "undefined") return null;
1608
1608
  const n = parseInt(value, 10);
1609
1609
  if (isNaN(n) || n < 1 || n > 12) return null;
1610
1610
  return { display: "grid", gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` };
@@ -1868,6 +1868,12 @@ var RESOLVERS = {
1868
1868
  function resolveUtility(parsed, theme) {
1869
1869
  if (!parsed.value) {
1870
1870
  if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
1871
+ if (parsed.utility === "grd" || parsed.utility === "grid") {
1872
+ return typeof document !== "undefined" ? { display: "grid" } : null;
1873
+ }
1874
+ if (parsed.utility === "inline-grid") {
1875
+ return typeof document !== "undefined" ? { display: "inline-grid" } : null;
1876
+ }
1871
1877
  if (parsed.utility in STANDALONE) return STANDALONE[parsed.utility] ?? null;
1872
1878
  }
1873
1879
  const resolver = PLUGIN_RESOLVERS[parsed.utility] ?? RESOLVERS[parsed.utility];
@@ -2066,12 +2072,12 @@ function resolve(classString, theme, darkMode = "attribute") {
2066
2072
  const bucketKey = parsed.modifiers.length === 0 ? "base" : parsed.modifiers.join(":");
2067
2073
  if (!result[bucketKey]) result[bucketKey] = {};
2068
2074
  Object.assign(result[bucketKey], styles);
2069
- if (isWeb) {
2075
+ if (typeof document !== "undefined") {
2070
2076
  injectQueue.push({ cls: parsed.original, bucketKey, styles });
2071
2077
  }
2072
2078
  }
2073
2079
  styleCache.set(cacheKey, result);
2074
- if (isWeb) {
2080
+ if (typeof document !== "undefined") {
2075
2081
  for (const { cls, bucketKey, styles } of injectQueue) {
2076
2082
  injectClassRule(cls, bucketKey, styles, darkMode);
2077
2083
  }
@@ -2400,7 +2406,7 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
2400
2406
  const computedStyle = (0, import_react3.useMemo)(
2401
2407
  () => {
2402
2408
  const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
2403
- if (isWeb && typeof Component !== "string") {
2409
+ if (typeof Component !== "string") {
2404
2410
  if (s.display === "grid" || s.display === "inline-grid") delete s.display;
2405
2411
  delete s.gridTemplateColumns;
2406
2412
  delete s.gridTemplateRows;
@@ -2454,7 +2460,7 @@ var DarkWrapper = import_react4.default.forwardRef(
2454
2460
  const width = useConditionalWidth(needsWidth);
2455
2461
  const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
2456
2462
  const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
2457
- if (isWeb && typeof Component !== "string") stripWebGridProps(computedStyle);
2463
+ if (typeof Component !== "string") stripWebGridProps(computedStyle);
2458
2464
  const finalStyle = styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
2459
2465
  const props = { ref, ...rest, style: finalStyle };
2460
2466
  return Array.isArray(children) ? import_react4.default.createElement(Component, props, ...children) : import_react4.default.createElement(Component, props, children);
@@ -2549,7 +2555,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
2549
2555
  return makeElement(isStaticChildren, type, rawProps, key);
2550
2556
  }
2551
2557
  const config = getConfig();
2552
- const isGrdOnWeb = isWeb && classStr != null && /(?:^|\s)grd(?:\s|$)/.test(classStr);
2558
+ const isGrdOnWeb = typeof document !== "undefined" && classStr != null && /(?:^|\s)grd(?:\s|$)/.test(classStr);
2553
2559
  const actualType = isGrdOnWeb ? "div" : type;
2554
2560
  const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
2555
2561
  const { style: userStyle, ...passProps } = omitConsumed(rawProps);
@@ -2573,7 +2579,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
2573
2579
  }, key);
2574
2580
  }
2575
2581
  const computedStyle = flatten(resolved, false);
2576
- if (isWeb && typeof actualType !== "string") {
2582
+ if (typeof actualType !== "string") {
2577
2583
  if (computedStyle.display === "grid" || computedStyle.display === "inline-grid") delete computedStyle.display;
2578
2584
  delete computedStyle.gridTemplateColumns;
2579
2585
  delete computedStyle.gridTemplateRows;
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-7DGFJPDP.mjs";
6
- import "./chunk-PDPOXGSG.mjs";
5
+ } from "./chunk-CIK3ADJB.mjs";
6
+ import "./chunk-437T7FQC.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.16",
3
+ "version": "0.3.18",
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",