@kbach/react 0.5.40 → 0.5.42

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.
@@ -4,7 +4,7 @@ import {
4
4
  hasResponsiveBuckets,
5
5
  useConditionalWidth,
6
6
  useGlobalDarkMode
7
- } from "./chunk-EYPBYQSB.mjs";
7
+ } from "./chunk-GOQNOKFN.mjs";
8
8
  import {
9
9
  flatten,
10
10
  getActiveBreakpoints,
@@ -13,10 +13,10 @@ import {
13
13
  getInteractiveModifiers,
14
14
  getModeModifiers,
15
15
  getResponsiveModifiers,
16
- isWeb,
16
+ isNative,
17
17
  normalizeClassString,
18
18
  resolve
19
- } from "./chunk-IZ3W6G3V.mjs";
19
+ } from "./chunk-VCNP57PR.mjs";
20
20
 
21
21
  // src/jsx-runtime.tsx
22
22
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -195,7 +195,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
195
195
  return _jsx(InteractiveWrapper, {
196
196
  Component: actualType,
197
197
  resolvedStyle: resolved,
198
- ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {},
198
+ ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
199
199
  style: userStyle,
200
200
  ...passProps
201
201
  }, key);
@@ -204,7 +204,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
204
204
  return _jsx(DarkWrapper, {
205
205
  Component: actualType,
206
206
  resolvedStyle: resolved,
207
- ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {},
207
+ ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
208
208
  style: userStyle,
209
209
  ...passProps
210
210
  }, key);
@@ -216,7 +216,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
216
216
  return makeElement(isStaticChildren, actualType, {
217
217
  ...passProps,
218
218
  style: finalStyle,
219
- ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {}
219
+ ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {}
220
220
  }, key);
221
221
  }
222
222
  function jsx(type, props, key) {
@@ -3,9 +3,10 @@ import {
3
3
  getActiveBreakpoints,
4
4
  getGlobalWidth,
5
5
  getResponsiveModifiers,
6
+ isNative,
6
7
  isWeb,
7
8
  subscribeGlobalWidth
8
- } from "./chunk-IZ3W6G3V.mjs";
9
+ } from "./chunk-VCNP57PR.mjs";
9
10
 
10
11
  // src/core/darkModeStore.ts
11
12
  var KEY = "__kbach_dark_store__";
@@ -203,10 +204,10 @@ var InteractiveWrapper = forwardRef(
203
204
  ref,
204
205
  ...restWithoutChildren,
205
206
  style: finalStyle,
206
- ...isWeb && className ? { className } : {},
207
+ ...!isNative && className ? { className } : {},
207
208
  // onPressIn / onPressOut are React Native-only.
208
209
  // On web, onPointerDown/Up drive the pressed state instead (covers mouse + touch).
209
- ...isWeb ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
210
+ ...!isNative ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
210
211
  onMouseEnter: handleMouseEnter,
211
212
  onMouseLeave: handleMouseLeave,
212
213
  onFocus: handleFocus,
@@ -543,12 +543,13 @@ var defaultTheme = {
543
543
 
544
544
  // src/core/platform.ts
545
545
  var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
546
+ var isNative = !isWeb && (typeof globalThis.HermesInternal !== "undefined" || typeof globalThis.__fbBatchedBridge !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative");
546
547
  var _cssGenMode = false;
547
548
  function setCSSGenMode(on) {
548
549
  _cssGenMode = on;
549
550
  }
550
551
  function getEffectiveIsWeb() {
551
- return isWeb || _cssGenMode;
552
+ return isWeb || _cssGenMode || !isNative;
552
553
  }
553
554
  function toNativeValue(raw) {
554
555
  if (/^-?\d+(\.\d+)?px$/.test(raw)) return parseFloat(raw);
@@ -2780,7 +2781,7 @@ function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new
2780
2781
  if (defaultFont && !("fontFamily" in result)) {
2781
2782
  result.fontFamily = defaultFont;
2782
2783
  }
2783
- if (isWeb) {
2784
+ if (!isNative) {
2784
2785
  const r = result;
2785
2786
  const ph = r.paddingHorizontal;
2786
2787
  if (ph !== void 0) {
@@ -3000,6 +3001,7 @@ export {
3000
3001
  defaultColors,
3001
3002
  defaultTheme,
3002
3003
  isWeb,
3004
+ isNative,
3003
3005
  setCSSGenMode,
3004
3006
  getInteractiveModifiers,
3005
3007
  getModeModifiers,
package/dist/index.js CHANGED
@@ -728,9 +728,10 @@ var LRUCache = class {
728
728
 
729
729
  // src/core/platform.ts
730
730
  var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
731
+ var isNative = !isWeb && (typeof globalThis.HermesInternal !== "undefined" || typeof globalThis.__fbBatchedBridge !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative");
731
732
  var _cssGenMode = false;
732
733
  function getEffectiveIsWeb() {
733
- return isWeb || _cssGenMode;
734
+ return isWeb || _cssGenMode || !isNative;
734
735
  }
735
736
  function toNativeValue(raw) {
736
737
  if (/^-?\d+(\.\d+)?px$/.test(raw)) return parseFloat(raw);
@@ -2900,7 +2901,7 @@ function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new
2900
2901
  if (defaultFont && !("fontFamily" in result)) {
2901
2902
  result.fontFamily = defaultFont;
2902
2903
  }
2903
- if (isWeb) {
2904
+ if (!isNative) {
2904
2905
  const r = result;
2905
2906
  const ph = r.paddingHorizontal;
2906
2907
  if (ph !== void 0) {
@@ -3718,10 +3719,10 @@ var InteractiveWrapper = (0, import_react10.forwardRef)(
3718
3719
  ref,
3719
3720
  ...restWithoutChildren,
3720
3721
  style: finalStyle,
3721
- ...isWeb && className ? { className } : {},
3722
+ ...!isNative && className ? { className } : {},
3722
3723
  // onPressIn / onPressOut are React Native-only.
3723
3724
  // On web, onPointerDown/Up drive the pressed state instead (covers mouse + touch).
3724
- ...isWeb ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
3725
+ ...!isNative ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
3725
3726
  onMouseEnter: handleMouseEnter,
3726
3727
  onMouseLeave: handleMouseLeave,
3727
3728
  onFocus: handleFocus,
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  useConditionalWidth,
8
8
  useGlobalDarkMode,
9
9
  useGlobalWidth
10
- } from "./chunk-EYPBYQSB.mjs";
10
+ } from "./chunk-GOQNOKFN.mjs";
11
11
  import {
12
12
  __require,
13
13
  buildConfig,
@@ -28,7 +28,7 @@ import {
28
28
  syncGlobalScreens,
29
29
  syncGlobalWidth,
30
30
  updateConfig
31
- } from "./chunk-IZ3W6G3V.mjs";
31
+ } from "./chunk-VCNP57PR.mjs";
32
32
 
33
33
  // src/context.tsx
34
34
  import { createContext, useContext } from "react";
@@ -617,9 +617,10 @@ var LRUCache = class {
617
617
 
618
618
  // src/core/platform.ts
619
619
  var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
620
+ var isNative = !isWeb && (typeof globalThis.HermesInternal !== "undefined" || typeof globalThis.__fbBatchedBridge !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative");
620
621
  var _cssGenMode = false;
621
622
  function getEffectiveIsWeb() {
622
- return isWeb || _cssGenMode;
623
+ return isWeb || _cssGenMode || !isNative;
623
624
  }
624
625
  function toNativeValue(raw) {
625
626
  if (/^-?\d+(\.\d+)?px$/.test(raw)) return parseFloat(raw);
@@ -2789,7 +2790,7 @@ function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new
2789
2790
  if (defaultFont && !("fontFamily" in result)) {
2790
2791
  result.fontFamily = defaultFont;
2791
2792
  }
2792
- if (isWeb) {
2793
+ if (!isNative) {
2793
2794
  const r = result;
2794
2795
  const ph = r.paddingHorizontal;
2795
2796
  if (ph !== void 0) {
@@ -3158,10 +3159,10 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
3158
3159
  ref,
3159
3160
  ...restWithoutChildren,
3160
3161
  style: finalStyle,
3161
- ...isWeb && className ? { className } : {},
3162
+ ...!isNative && className ? { className } : {},
3162
3163
  // onPressIn / onPressOut are React Native-only.
3163
3164
  // On web, onPointerDown/Up drive the pressed state instead (covers mouse + touch).
3164
- ...isWeb ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
3165
+ ...!isNative ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
3165
3166
  onMouseEnter: handleMouseEnter,
3166
3167
  onMouseLeave: handleMouseLeave,
3167
3168
  onFocus: handleFocus,
@@ -3342,7 +3343,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3342
3343
  return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
3343
3344
  Component: actualType,
3344
3345
  resolvedStyle: resolved,
3345
- ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {},
3346
+ ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
3346
3347
  style: userStyle,
3347
3348
  ...passProps
3348
3349
  }, key);
@@ -3351,7 +3352,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3351
3352
  return (0, import_jsx_runtime.jsx)(DarkWrapper, {
3352
3353
  Component: actualType,
3353
3354
  resolvedStyle: resolved,
3354
- ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {},
3355
+ ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
3355
3356
  style: userStyle,
3356
3357
  ...passProps
3357
3358
  }, key);
@@ -3363,7 +3364,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3363
3364
  return makeElement(isStaticChildren, actualType, {
3364
3365
  ...passProps,
3365
3366
  style: finalStyle,
3366
- ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {}
3367
+ ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {}
3367
3368
  }, key);
3368
3369
  }
3369
3370
  function jsx(type, props, key) {
@@ -2,9 +2,9 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-6NHHYHNV.mjs";
6
- import "./chunk-EYPBYQSB.mjs";
7
- import "./chunk-IZ3W6G3V.mjs";
5
+ } from "./chunk-AAPA3CRV.mjs";
6
+ import "./chunk-GOQNOKFN.mjs";
7
+ import "./chunk-VCNP57PR.mjs";
8
8
 
9
9
  // src/jsx-dev-runtime.tsx
10
10
  function jsxDEV(type, props, key, isStaticChildren, source, self) {
@@ -617,9 +617,10 @@ var LRUCache = class {
617
617
 
618
618
  // src/core/platform.ts
619
619
  var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
620
+ var isNative = !isWeb && (typeof globalThis.HermesInternal !== "undefined" || typeof globalThis.__fbBatchedBridge !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative");
620
621
  var _cssGenMode = false;
621
622
  function getEffectiveIsWeb() {
622
- return isWeb || _cssGenMode;
623
+ return isWeb || _cssGenMode || !isNative;
623
624
  }
624
625
  function toNativeValue(raw) {
625
626
  if (/^-?\d+(\.\d+)?px$/.test(raw)) return parseFloat(raw);
@@ -2789,7 +2790,7 @@ function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new
2789
2790
  if (defaultFont && !("fontFamily" in result)) {
2790
2791
  result.fontFamily = defaultFont;
2791
2792
  }
2792
- if (isWeb) {
2793
+ if (!isNative) {
2793
2794
  const r = result;
2794
2795
  const ph = r.paddingHorizontal;
2795
2796
  if (ph !== void 0) {
@@ -3158,10 +3159,10 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
3158
3159
  ref,
3159
3160
  ...restWithoutChildren,
3160
3161
  style: finalStyle,
3161
- ...isWeb && className ? { className } : {},
3162
+ ...!isNative && className ? { className } : {},
3162
3163
  // onPressIn / onPressOut are React Native-only.
3163
3164
  // On web, onPointerDown/Up drive the pressed state instead (covers mouse + touch).
3164
- ...isWeb ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
3165
+ ...!isNative ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
3165
3166
  onMouseEnter: handleMouseEnter,
3166
3167
  onMouseLeave: handleMouseLeave,
3167
3168
  onFocus: handleFocus,
@@ -3345,7 +3346,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3345
3346
  return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
3346
3347
  Component: actualType,
3347
3348
  resolvedStyle: resolved,
3348
- ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {},
3349
+ ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
3349
3350
  style: userStyle,
3350
3351
  ...passProps
3351
3352
  }, key);
@@ -3354,7 +3355,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3354
3355
  return (0, import_jsx_runtime.jsx)(DarkWrapper, {
3355
3356
  Component: actualType,
3356
3357
  resolvedStyle: resolved,
3357
- ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {},
3358
+ ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
3358
3359
  style: userStyle,
3359
3360
  ...passProps
3360
3361
  }, key);
@@ -3366,7 +3367,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3366
3367
  return makeElement(isStaticChildren, actualType, {
3367
3368
  ...passProps,
3368
3369
  style: finalStyle,
3369
- ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {}
3370
+ ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {}
3370
3371
  }, key);
3371
3372
  }
3372
3373
  function jsx(type, props, key) {
@@ -3,9 +3,9 @@ import {
3
3
  _invalidateDefaultFontCache,
4
4
  jsx,
5
5
  jsxs
6
- } from "./chunk-6NHHYHNV.mjs";
7
- import "./chunk-EYPBYQSB.mjs";
8
- import "./chunk-IZ3W6G3V.mjs";
6
+ } from "./chunk-AAPA3CRV.mjs";
7
+ import "./chunk-GOQNOKFN.mjs";
8
+ import "./chunk-VCNP57PR.mjs";
9
9
  export {
10
10
  Fragment,
11
11
  _invalidateDefaultFontCache,
@@ -28,12 +28,13 @@ var import_path = require("path");
28
28
 
29
29
  // src/core/platform.ts
30
30
  var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
31
+ var isNative = !isWeb && (typeof globalThis.HermesInternal !== "undefined" || typeof globalThis.__fbBatchedBridge !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative");
31
32
  var _cssGenMode = false;
32
33
  function setCSSGenMode(on) {
33
34
  _cssGenMode = on;
34
35
  }
35
36
  function getEffectiveIsWeb() {
36
- return isWeb || _cssGenMode;
37
+ return isWeb || _cssGenMode || !isNative;
37
38
  }
38
39
  function toNativeValue(raw) {
39
40
  if (/^-?\d+(\.\d+)?px$/.test(raw)) return parseFloat(raw);
@@ -2804,6 +2805,10 @@ var customVariants = new Proxy(
2804
2805
  );
2805
2806
 
2806
2807
  // src/vite-plugin.ts
2808
+ function normPath(p) {
2809
+ const fwd = p.replace(/\\/g, "/");
2810
+ return process.platform === "win32" ? fwd.toLowerCase() : fwd;
2811
+ }
2807
2812
  setCSSGenMode(true);
2808
2813
  var KBACH_START = "/* kbach:start */";
2809
2814
  var KBACH_END = "/* kbach:end */";
@@ -2972,6 +2977,7 @@ function kbach(userConfig) {
2972
2977
  const fileTokens = /* @__PURE__ */ new Map();
2973
2978
  const tokenCSS = /* @__PURE__ */ new Map();
2974
2979
  function processFile(filePath, code) {
2980
+ const key = normPath(filePath);
2975
2981
  const tokens = /* @__PURE__ */ new Set();
2976
2982
  for (const cls of extractClassStrings(code)) {
2977
2983
  for (const tok of splitClassTokens(cls)) {
@@ -2981,7 +2987,7 @@ function kbach(userConfig) {
2981
2987
  }
2982
2988
  }
2983
2989
  }
2984
- fileTokens.set(filePath, tokens);
2990
+ fileTokens.set(key, tokens);
2985
2991
  }
2986
2992
  function buildTokenCSSView() {
2987
2993
  const active = /* @__PURE__ */ new Set();
@@ -3017,7 +3023,7 @@ function kbach(userConfig) {
3017
3023
  try {
3018
3024
  processFile(file, (0, import_fs.readFileSync)(file, "utf-8"));
3019
3025
  } catch {
3020
- fileTokens.delete(file);
3026
+ fileTokens.delete(normPath(file));
3021
3027
  }
3022
3028
  if (mainCSSFile) writeKbachToFile(mainCSSFile, generateCSS());
3023
3029
  }
@@ -3,11 +3,15 @@ import {
3
3
  generateClassCSS,
4
4
  setCSSGenMode,
5
5
  splitClassTokens
6
- } from "./chunk-IZ3W6G3V.mjs";
6
+ } from "./chunk-VCNP57PR.mjs";
7
7
 
8
8
  // src/vite-plugin.ts
9
9
  import { readFileSync, writeFileSync, existsSync, readdirSync, statSync } from "fs";
10
10
  import { join } from "path";
11
+ function normPath(p) {
12
+ const fwd = p.replace(/\\/g, "/");
13
+ return process.platform === "win32" ? fwd.toLowerCase() : fwd;
14
+ }
11
15
  setCSSGenMode(true);
12
16
  var KBACH_START = "/* kbach:start */";
13
17
  var KBACH_END = "/* kbach:end */";
@@ -176,6 +180,7 @@ function kbach(userConfig) {
176
180
  const fileTokens = /* @__PURE__ */ new Map();
177
181
  const tokenCSS = /* @__PURE__ */ new Map();
178
182
  function processFile(filePath, code) {
183
+ const key = normPath(filePath);
179
184
  const tokens = /* @__PURE__ */ new Set();
180
185
  for (const cls of extractClassStrings(code)) {
181
186
  for (const tok of splitClassTokens(cls)) {
@@ -185,7 +190,7 @@ function kbach(userConfig) {
185
190
  }
186
191
  }
187
192
  }
188
- fileTokens.set(filePath, tokens);
193
+ fileTokens.set(key, tokens);
189
194
  }
190
195
  function buildTokenCSSView() {
191
196
  const active = /* @__PURE__ */ new Set();
@@ -221,7 +226,7 @@ function kbach(userConfig) {
221
226
  try {
222
227
  processFile(file, readFileSync(file, "utf-8"));
223
228
  } catch {
224
- fileTokens.delete(file);
229
+ fileTokens.delete(normPath(file));
225
230
  }
226
231
  if (mainCSSFile) writeKbachToFile(mainCSSFile, generateCSS());
227
232
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.5.40",
3
+ "version": "0.5.42",
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",