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

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-45OSRKPS.mjs";
13
+ } from "./chunk-KT6TQLWI.mjs";
14
14
  import {
15
15
  defaultTheme,
16
16
  getTheme,
17
17
  resolveClassName,
18
18
  setTheme
19
- } from "./chunk-BTIGG7K2.mjs";
19
+ } from "./chunk-DKZM4NUU.mjs";
20
20
 
21
21
  // src/config.ts
22
22
  function parseHexRgb(hex) {
@@ -104,6 +104,12 @@ function colorValue(theme, parsed) {
104
104
  if (rgb === null) return hex;
105
105
  return `rgba(${rgb.join(",")},${opacity / 100})`;
106
106
  }
107
+ var LENGTH_UNITS = ["px", "rem", "em", "%", "vh", "vw"];
108
+ function looksLikeLength(value) {
109
+ const unit = LENGTH_UNITS.find((u) => value.endsWith(u));
110
+ const withoutUnit = unit ? value.slice(0, value.length - unit.length) : value;
111
+ return withoutUnit !== "" && Number.isFinite(Number(withoutUnit));
112
+ }
107
113
 
108
114
  // src/jsxRuntimeCore.ts
109
115
  var import_dynamicTokens = require("./dynamicTokens");
@@ -1503,7 +1509,9 @@ function borderValue(theme, parsed) {
1503
1509
  if (value === "separate") return [decl("border-collapse", "separate")];
1504
1510
  }
1505
1511
  if (parsed.isArbitrary) {
1506
- return [decl("border-width", value)];
1512
+ if (looksLikeLength(value)) return [decl("border-width", value)];
1513
+ const color2 = colorValue(theme, parsed);
1514
+ return color2 === null ? null : [decl("border-color", color2)];
1507
1515
  }
1508
1516
  if (Number.isFinite(Number(value)) && value.trim() !== "") {
1509
1517
  const v = resolveLength(theme, parsed);
@@ -1518,7 +1526,11 @@ function borderValue(theme, parsed) {
1518
1526
  function borderSideValue(theme, parsed, sideProperty) {
1519
1527
  const value = parsed.value;
1520
1528
  if (value === null) return null;
1521
- if (parsed.isArbitrary) return [decl(`${sideProperty}-width`, value)];
1529
+ if (parsed.isArbitrary) {
1530
+ if (looksLikeLength(value)) return [decl(`${sideProperty}-width`, value)];
1531
+ const color2 = colorValue(theme, parsed);
1532
+ return color2 === null ? null : [decl(`${sideProperty}-color`, color2)];
1533
+ }
1522
1534
  if (Number.isFinite(Number(value)) && value.trim() !== "") {
1523
1535
  const v = resolveLength(theme, parsed);
1524
1536
  return v === null ? null : [decl(`${sideProperty}-width`, v)];
@@ -1532,7 +1544,11 @@ function borderSideValue(theme, parsed, sideProperty) {
1532
1544
  function borderAxisValue(theme, parsed, sideA, sideB) {
1533
1545
  const value = parsed.value;
1534
1546
  if (value === null) return null;
1535
- if (parsed.isArbitrary) return [decl(`${sideA}-width`, value), decl(`${sideB}-width`, value)];
1547
+ if (parsed.isArbitrary) {
1548
+ if (looksLikeLength(value)) return [decl(`${sideA}-width`, value), decl(`${sideB}-width`, value)];
1549
+ const color2 = colorValue(theme, parsed);
1550
+ return color2 === null ? null : [decl(`${sideA}-color`, color2), decl(`${sideB}-color`, color2)];
1551
+ }
1536
1552
  if (Number.isFinite(Number(value)) && value.trim() !== "") {
1537
1553
  const v = resolveLength(theme, parsed);
1538
1554
  return v === null ? null : [decl(`${sideA}-width`, v), decl(`${sideB}-width`, v)];
@@ -1599,7 +1615,11 @@ function outlineWidthValue(key) {
1599
1615
  function outlineValue(theme, parsed) {
1600
1616
  const value = parsed.value;
1601
1617
  if (value === null) return null;
1602
- if (parsed.isArbitrary) return [decl("outline-width", value)];
1618
+ if (parsed.isArbitrary) {
1619
+ if (looksLikeLength(value)) return [decl("outline-width", value)];
1620
+ const color2 = colorValue(theme, parsed);
1621
+ return color2 === null ? null : [decl("outline-color", color2)];
1622
+ }
1603
1623
  const w = outlineWidthValue(value);
1604
1624
  if (w !== null) return [decl("outline-width", w)];
1605
1625
  if (OUTLINE_STYLES.includes(value)) return [decl("outline-style", value)];