@kbach/react-native 1.0.0-beta.11 → 1.0.0-beta.12

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.
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-YOC3SHF5.mjs";
6
- import "./chunk-H5Z24XX5.mjs";
5
+ } from "./chunk-OJIFXMLD.mjs";
6
+ import "./chunk-3LNPXJEW.mjs";
7
7
  import {
8
8
  createJsxDEV
9
9
  } from "./chunk-4DQXTAM3.mjs";
@@ -1103,6 +1103,36 @@ function lookupHex(theme, key) {
1103
1103
  const entry = theme.colors[key];
1104
1104
  return typeof entry === "string" ? entry : null;
1105
1105
  }
1106
+ function hexToRgb(hex) {
1107
+ const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
1108
+ if (!m) return null;
1109
+ let h = m[1];
1110
+ if (h.length === 3) h = h.split("").map((c) => c + c).join("");
1111
+ const n = parseInt(h, 16);
1112
+ return [n >> 16 & 255, n >> 8 & 255, n & 255];
1113
+ }
1114
+ function splitOpacity(value) {
1115
+ const slash = value.lastIndexOf("/");
1116
+ if (slash === -1) return [value, null];
1117
+ const opacityText = value.slice(slash + 1);
1118
+ const n = Number(opacityText);
1119
+ if (opacityText !== "" && Number.isInteger(n) && n >= 0 && n <= 100) {
1120
+ return [value.slice(0, slash), n];
1121
+ }
1122
+ return [value, null];
1123
+ }
1124
+ function colorValue(theme, parsed) {
1125
+ const value = parsed.value;
1126
+ if (value === null) return null;
1127
+ if (parsed.isArbitrary) return value;
1128
+ const [name, opacity] = splitOpacity(value);
1129
+ const hex = lookupHex(theme, name);
1130
+ if (hex === null) return null;
1131
+ if (opacity === null) return hex;
1132
+ const rgb = hexToRgb(hex);
1133
+ if (rgb === null) return hex;
1134
+ return `rgba(${rgb.join(",")},${opacity / 100})`;
1135
+ }
1106
1136
 
1107
1137
  // src/jsEngine/resolvers/border.ts
1108
1138
  function radiusSize(key) {
@@ -1508,9 +1538,7 @@ function resolveLeadingTrackingNative(parsed) {
1508
1538
  return null;
1509
1539
  }
1510
1540
  function nativeHexColor(parsed, theme) {
1511
- const value = parsed.value;
1512
- if (value === null) return null;
1513
- return parsed.isArbitrary ? value : lookupHex(theme, value);
1541
+ return colorValue(theme, parsed);
1514
1542
  }
1515
1543
  function resolveTextNative(parsed, theme) {
1516
1544
  if (!parsed.isArbitrary && parsed.value !== null) {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  jsx,
3
3
  jsxs
4
- } from "./chunk-5MU6PEXV.mjs";
5
- import "./chunk-XHL653X2.mjs";
4
+ } from "./chunk-7AIH5MXY.mjs";
5
+ import "./chunk-MGXMALPC.mjs";
6
6
  import {
7
7
  Fragment
8
8
  } from "./chunk-4DQXTAM3.mjs";