@kbach/react-native 1.0.0-beta.46 → 1.0.0-beta.47

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.
@@ -10,13 +10,13 @@ import {
10
10
  subscribeDynamicTokens,
11
11
  subscribeGlobalDarkMode,
12
12
  toggleGlobalDarkMode
13
- } from "./chunk-KT6TQLWI.mjs";
13
+ } from "./chunk-XOH25F3E.mjs";
14
14
  import {
15
15
  defaultTheme,
16
16
  getTheme,
17
17
  resolveClassName,
18
18
  setTheme
19
- } from "./chunk-DKZM4NUU.mjs";
19
+ } from "./chunk-3KLOVONL.mjs";
20
20
 
21
21
  // src/config.ts
22
22
  function parseHexRgb(hex) {
@@ -2137,6 +2137,12 @@ function isPlainPercentage(value) {
2137
2137
  if (digits.startsWith("-")) digits = digits.slice(1);
2138
2138
  return digits.length > 0 && /^[0-9.]+$/.test(digits);
2139
2139
  }
2140
+ function sanitizeForWarning(value) {
2141
+ const MAX_CHARS = 60;
2142
+ const escaped = value.replace(/"/g, "'").replace(/[\n\r]/g, " ");
2143
+ if (escaped.length <= MAX_CHARS) return escaped;
2144
+ return `${escaped.slice(0, MAX_CHARS)}\u2026`;
2145
+ }
2140
2146
  function rnStyleValue(property, value) {
2141
2147
  if (property === "aspect-ratio") {
2142
2148
  if (value.trim() === "auto") return { value: null, warning: null };
@@ -2177,7 +2183,8 @@ function rnStyleValue(property, value) {
2177
2183
  if (reduced !== null) {
2178
2184
  return { value: reduced, warning: null };
2179
2185
  }
2180
- const warning = `[Kbach] "${value}" isn't a valid native value for "${property}" \u2014 dropped.
2186
+ const sanitizedValue = sanitizeForWarning(value);
2187
+ const warning = `[Kbach] "${sanitizedValue}" isn't a valid native value for "${property}" \u2014 dropped.
2181
2188
  calc()/min()/max()/clamp() only resolve on native when every operand is a constant px/rem length (no %, vw, vh, var(), or other viewport/CSS-variable units \u2014 those need real layout/DOM, which doesn't exist on native at paint time).
2182
2189
  Fix: use a plain px/rem calc, a fraction utility (e.g. w-1/2), or resolve this value in JS instead.`;
2183
2190
  return { value: null, warning };
@@ -2285,14 +2292,27 @@ function resolveStyleUncached(classString, pressed, colorScheme, width, themeJso
2285
2292
  }
2286
2293
  return style;
2287
2294
  }
2295
+ var WARNED_MESSAGES_MAX = 500;
2288
2296
  var warnedMessages = /* @__PURE__ */ new Set();
2297
+ var QUOTED_TOKEN_RE = /"([^"]*)"/;
2298
+ function highlightToken(classString, warning) {
2299
+ const match = QUOTED_TOKEN_RE.exec(warning);
2300
+ if (match === null) return classString;
2301
+ const token = match[1];
2302
+ const parts = classString.split(/(\s+)/);
2303
+ const idx = parts.indexOf(token);
2304
+ if (idx === -1) return classString;
2305
+ parts[idx] = `\xBB${token}\xAB`;
2306
+ return parts.join("");
2307
+ }
2289
2308
  function warnIfDev(classString, warnings) {
2290
2309
  if (warnings.length === 0) return;
2291
2310
  if (typeof __DEV__ !== "undefined" && !__DEV__) return;
2292
2311
  for (const warning of warnings) {
2293
2312
  const message = `${warning}
2294
- From className: "${classString}"`;
2313
+ From className: "${highlightToken(classString, warning)}"`;
2295
2314
  if (warnedMessages.has(message)) continue;
2315
+ if (warnedMessages.size >= WARNED_MESSAGES_MAX) warnedMessages.clear();
2296
2316
  warnedMessages.add(message);
2297
2317
  console.warn(message);
2298
2318
  }