@kbach/react 0.6.13 → 0.6.15

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.
@@ -23,7 +23,7 @@ import {
23
23
  transformToWebProps,
24
24
  useConditionalWidth,
25
25
  useGlobalDarkMode
26
- } from "./chunk-HCRWLOJE.mjs";
26
+ } from "./chunk-YH2IOSKT.mjs";
27
27
 
28
28
  // src/jsx-runtime.tsx
29
29
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -2289,7 +2289,7 @@ var RESOLVERS = {
2289
2289
  "translate-x": ({ value, negative, isArbitrary }, { spacing }) => {
2290
2290
  const v = resolveSpacing(value, negative, spacing, isArbitrary);
2291
2291
  if (v === null) return null;
2292
- if (getEffectiveIsWeb()) return { transform: `translateX(${v})` };
2292
+ if (getEffectiveIsWeb()) return { transform: `translateX(${typeof v === "number" ? `${v}px` : v})` };
2293
2293
  if (typeof v === "string") {
2294
2294
  const n = parseFloat(v);
2295
2295
  return isNaN(n) ? null : { transform: [{ translateX: n }] };
@@ -2299,7 +2299,7 @@ var RESOLVERS = {
2299
2299
  "translate-y": ({ value, negative, isArbitrary }, { spacing }) => {
2300
2300
  const v = resolveSpacing(value, negative, spacing, isArbitrary);
2301
2301
  if (v === null) return null;
2302
- if (getEffectiveIsWeb()) return { transform: `translateY(${v})` };
2302
+ if (getEffectiveIsWeb()) return { transform: `translateY(${typeof v === "number" ? `${v}px` : v})` };
2303
2303
  if (typeof v === "string") {
2304
2304
  const n = parseFloat(v);
2305
2305
  return isNaN(n) ? null : { transform: [{ translateY: n }] };
package/dist/index.js CHANGED
@@ -2450,7 +2450,7 @@ var RESOLVERS = {
2450
2450
  "translate-x": ({ value, negative, isArbitrary }, { spacing }) => {
2451
2451
  const v = resolveSpacing(value, negative, spacing, isArbitrary);
2452
2452
  if (v === null) return null;
2453
- if (getEffectiveIsWeb()) return { transform: `translateX(${v})` };
2453
+ if (getEffectiveIsWeb()) return { transform: `translateX(${typeof v === "number" ? `${v}px` : v})` };
2454
2454
  if (typeof v === "string") {
2455
2455
  const n = parseFloat(v);
2456
2456
  return isNaN(n) ? null : { transform: [{ translateX: n }] };
@@ -2460,7 +2460,7 @@ var RESOLVERS = {
2460
2460
  "translate-y": ({ value, negative, isArbitrary }, { spacing }) => {
2461
2461
  const v = resolveSpacing(value, negative, spacing, isArbitrary);
2462
2462
  if (v === null) return null;
2463
- if (getEffectiveIsWeb()) return { transform: `translateY(${v})` };
2463
+ if (getEffectiveIsWeb()) return { transform: `translateY(${typeof v === "number" ? `${v}px` : v})` };
2464
2464
  if (typeof v === "string") {
2465
2465
  const n = parseFloat(v);
2466
2466
  return isNaN(n) ? null : { transform: [{ translateY: n }] };
package/dist/index.mjs CHANGED
@@ -39,7 +39,7 @@ import {
39
39
  useGlobalDarkMode,
40
40
  useGlobalWidth,
41
41
  useSyncExternalStore
42
- } from "./chunk-HCRWLOJE.mjs";
42
+ } from "./chunk-YH2IOSKT.mjs";
43
43
 
44
44
  // src/context.tsx
45
45
  import { createContext, useContext } from "react";
@@ -2408,7 +2408,7 @@ var RESOLVERS = {
2408
2408
  "translate-x": ({ value, negative, isArbitrary }, { spacing }) => {
2409
2409
  const v = resolveSpacing(value, negative, spacing, isArbitrary);
2410
2410
  if (v === null) return null;
2411
- if (getEffectiveIsWeb()) return { transform: `translateX(${v})` };
2411
+ if (getEffectiveIsWeb()) return { transform: `translateX(${typeof v === "number" ? `${v}px` : v})` };
2412
2412
  if (typeof v === "string") {
2413
2413
  const n = parseFloat(v);
2414
2414
  return isNaN(n) ? null : { transform: [{ translateX: n }] };
@@ -2418,7 +2418,7 @@ var RESOLVERS = {
2418
2418
  "translate-y": ({ value, negative, isArbitrary }, { spacing }) => {
2419
2419
  const v = resolveSpacing(value, negative, spacing, isArbitrary);
2420
2420
  if (v === null) return null;
2421
- if (getEffectiveIsWeb()) return { transform: `translateY(${v})` };
2421
+ if (getEffectiveIsWeb()) return { transform: `translateY(${typeof v === "number" ? `${v}px` : v})` };
2422
2422
  if (typeof v === "string") {
2423
2423
  const n = parseFloat(v);
2424
2424
  return isNaN(n) ? null : { transform: [{ translateY: n }] };
@@ -3,8 +3,8 @@ import {
3
3
  Fragment,
4
4
  jsx,
5
5
  jsxs
6
- } from "./chunk-7DHBNCL5.mjs";
7
- import "./chunk-HCRWLOJE.mjs";
6
+ } from "./chunk-THJIAZ6E.mjs";
7
+ import "./chunk-YH2IOSKT.mjs";
8
8
 
9
9
  // src/jsx-dev-runtime.tsx
10
10
  function jsxDEV(type, props, key, isStaticChildren, source, self) {
@@ -2409,7 +2409,7 @@ var RESOLVERS = {
2409
2409
  "translate-x": ({ value, negative, isArbitrary }, { spacing }) => {
2410
2410
  const v = resolveSpacing(value, negative, spacing, isArbitrary);
2411
2411
  if (v === null) return null;
2412
- if (getEffectiveIsWeb()) return { transform: `translateX(${v})` };
2412
+ if (getEffectiveIsWeb()) return { transform: `translateX(${typeof v === "number" ? `${v}px` : v})` };
2413
2413
  if (typeof v === "string") {
2414
2414
  const n = parseFloat(v);
2415
2415
  return isNaN(n) ? null : { transform: [{ translateX: n }] };
@@ -2419,7 +2419,7 @@ var RESOLVERS = {
2419
2419
  "translate-y": ({ value, negative, isArbitrary }, { spacing }) => {
2420
2420
  const v = resolveSpacing(value, negative, spacing, isArbitrary);
2421
2421
  if (v === null) return null;
2422
- if (getEffectiveIsWeb()) return { transform: `translateY(${v})` };
2422
+ if (getEffectiveIsWeb()) return { transform: `translateY(${typeof v === "number" ? `${v}px` : v})` };
2423
2423
  if (typeof v === "string") {
2424
2424
  const n = parseFloat(v);
2425
2425
  return isNaN(n) ? null : { transform: [{ translateY: n }] };
@@ -4,10 +4,10 @@ import {
4
4
  _invalidateDefaultFontCache,
5
5
  jsx,
6
6
  jsxs
7
- } from "./chunk-7DHBNCL5.mjs";
7
+ } from "./chunk-THJIAZ6E.mjs";
8
8
  import {
9
9
  registerWebElement
10
- } from "./chunk-HCRWLOJE.mjs";
10
+ } from "./chunk-YH2IOSKT.mjs";
11
11
  export {
12
12
  Fragment,
13
13
  _invalidateDefaultFontCache,
@@ -2223,7 +2223,7 @@ var RESOLVERS = {
2223
2223
  "translate-x": ({ value, negative, isArbitrary }, { spacing }) => {
2224
2224
  const v = resolveSpacing(value, negative, spacing, isArbitrary);
2225
2225
  if (v === null) return null;
2226
- if (getEffectiveIsWeb()) return { transform: `translateX(${v})` };
2226
+ if (getEffectiveIsWeb()) return { transform: `translateX(${typeof v === "number" ? `${v}px` : v})` };
2227
2227
  if (typeof v === "string") {
2228
2228
  const n = parseFloat(v);
2229
2229
  return isNaN(n) ? null : { transform: [{ translateX: n }] };
@@ -2233,7 +2233,7 @@ var RESOLVERS = {
2233
2233
  "translate-y": ({ value, negative, isArbitrary }, { spacing }) => {
2234
2234
  const v = resolveSpacing(value, negative, spacing, isArbitrary);
2235
2235
  if (v === null) return null;
2236
- if (getEffectiveIsWeb()) return { transform: `translateY(${v})` };
2236
+ if (getEffectiveIsWeb()) return { transform: `translateY(${typeof v === "number" ? `${v}px` : v})` };
2237
2237
  if (typeof v === "string") {
2238
2238
  const n = parseFloat(v);
2239
2239
  return isNaN(n) ? null : { transform: [{ translateY: n }] };
@@ -3493,9 +3493,21 @@ function kbach(userConfigOrOptions) {
3493
3493
  },
3494
3494
  // When any JS/TS file imports kbach.css, prepend a disableRuntimeCSS() call
3495
3495
  // so styles come solely from the static stylesheet — no duplicate injection.
3496
+ //
3497
+ // Anchored to the START of a source line (^\s*, with the m flag) rather than a
3498
+ // bare \bimport\b anywhere in the file — disableRuntimeCSS() sets a globalThis
3499
+ // flag with no way to re-enable it, so a false match here doesn't just misfire
3500
+ // once, it silently kills ALL runtime CSS injection for the rest of that page's
3501
+ // JS lifetime, including on completely unrelated components. A real import
3502
+ // statement is always the first token on its line (give or take whitespace);
3503
+ // this same text appearing as part of a STRING — e.g. a docs site's own code
3504
+ // sample literally showing `import "./kbach.css";` as example text, which is
3505
+ // exactly what happened here — is never positioned that way, since something
3506
+ // always precedes it syntactically (a quote, JSX braces, an array bracket, …).
3496
3507
  transform(code, id) {
3497
3508
  if (!/\.(tsx?|jsx?|mjs?)$/.test(id)) return;
3498
- if (!/\bimport\b[^;]*['"].*kbach\.css['"]/i.test(code)) return;
3509
+ if (!/^\s*import\b[^;]*['"][^'"]*kbach\.css['"]/im.test(code)) return;
3510
+ warn(`disableRuntimeCSS() auto-triggered by an import in ${id.replace(/\\/g, "/")}`);
3499
3511
  return {
3500
3512
  code: `import { disableRuntimeCSS } from '@kbach/react';
3501
3513
  disableRuntimeCSS();
@@ -2189,7 +2189,7 @@ var RESOLVERS = {
2189
2189
  "translate-x": ({ value, negative, isArbitrary }, { spacing }) => {
2190
2190
  const v = resolveSpacing(value, negative, spacing, isArbitrary);
2191
2191
  if (v === null) return null;
2192
- if (getEffectiveIsWeb()) return { transform: `translateX(${v})` };
2192
+ if (getEffectiveIsWeb()) return { transform: `translateX(${typeof v === "number" ? `${v}px` : v})` };
2193
2193
  if (typeof v === "string") {
2194
2194
  const n = parseFloat(v);
2195
2195
  return isNaN(n) ? null : { transform: [{ translateX: n }] };
@@ -2199,7 +2199,7 @@ var RESOLVERS = {
2199
2199
  "translate-y": ({ value, negative, isArbitrary }, { spacing }) => {
2200
2200
  const v = resolveSpacing(value, negative, spacing, isArbitrary);
2201
2201
  if (v === null) return null;
2202
- if (getEffectiveIsWeb()) return { transform: `translateY(${v})` };
2202
+ if (getEffectiveIsWeb()) return { transform: `translateY(${typeof v === "number" ? `${v}px` : v})` };
2203
2203
  if (typeof v === "string") {
2204
2204
  const n = parseFloat(v);
2205
2205
  return isNaN(n) ? null : { transform: [{ translateY: n }] };
@@ -3459,9 +3459,21 @@ function kbach(userConfigOrOptions) {
3459
3459
  },
3460
3460
  // When any JS/TS file imports kbach.css, prepend a disableRuntimeCSS() call
3461
3461
  // so styles come solely from the static stylesheet — no duplicate injection.
3462
+ //
3463
+ // Anchored to the START of a source line (^\s*, with the m flag) rather than a
3464
+ // bare \bimport\b anywhere in the file — disableRuntimeCSS() sets a globalThis
3465
+ // flag with no way to re-enable it, so a false match here doesn't just misfire
3466
+ // once, it silently kills ALL runtime CSS injection for the rest of that page's
3467
+ // JS lifetime, including on completely unrelated components. A real import
3468
+ // statement is always the first token on its line (give or take whitespace);
3469
+ // this same text appearing as part of a STRING — e.g. a docs site's own code
3470
+ // sample literally showing `import "./kbach.css";` as example text, which is
3471
+ // exactly what happened here — is never positioned that way, since something
3472
+ // always precedes it syntactically (a quote, JSX braces, an array bracket, …).
3462
3473
  transform(code, id) {
3463
3474
  if (!/\.(tsx?|jsx?|mjs?)$/.test(id)) return;
3464
- if (!/\bimport\b[^;]*['"].*kbach\.css['"]/i.test(code)) return;
3475
+ if (!/^\s*import\b[^;]*['"][^'"]*kbach\.css['"]/im.test(code)) return;
3476
+ warn(`disableRuntimeCSS() auto-triggered by an import in ${id.replace(/\\/g, "/")}`);
3465
3477
  return {
3466
3478
  code: `import { disableRuntimeCSS } from '@kbach/react';
3467
3479
  disableRuntimeCSS();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.6.13",
3
+ "version": "0.6.15",
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",