@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.
- package/android/src/main/jniLibs/arm64-v8a/libkbach_core_engine.so +0 -0
- package/android/src/main/jniLibs/x86_64/libkbach_core_engine.so +0 -0
- package/dist/chunk-3LNPXJEW.mjs +192 -0
- package/dist/{chunk-5MU6PEXV.mjs → chunk-7AIH5MXY.mjs} +1 -1
- package/dist/{chunk-XHL653X2.mjs → chunk-MGXMALPC.mjs} +31 -3
- package/dist/{chunk-YOC3SHF5.mjs → chunk-OJIFXMLD.mjs} +1 -1
- package/dist/index.js +31 -3
- package/dist/index.mjs +1 -1
- package/dist/index.web.js +1 -1
- package/dist/index.web.mjs +1 -1
- package/dist/jsx-dev-runtime.js +31 -3
- package/dist/jsx-dev-runtime.mjs +2 -2
- package/dist/jsx-dev-runtime.web.js +1 -1
- package/dist/jsx-dev-runtime.web.mjs +2 -2
- package/dist/jsx-runtime.js +31 -3
- package/dist/jsx-runtime.mjs +2 -2
- package/dist/jsx-runtime.web.js +1 -1
- package/dist/jsx-runtime.web.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-H5Z24XX5.mjs +0 -192
|
@@ -642,6 +642,36 @@ function lookupHex(theme, key) {
|
|
|
642
642
|
const entry = theme.colors[key];
|
|
643
643
|
return typeof entry === "string" ? entry : null;
|
|
644
644
|
}
|
|
645
|
+
function hexToRgb(hex) {
|
|
646
|
+
const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
|
|
647
|
+
if (!m) return null;
|
|
648
|
+
let h = m[1];
|
|
649
|
+
if (h.length === 3) h = h.split("").map((c) => c + c).join("");
|
|
650
|
+
const n = parseInt(h, 16);
|
|
651
|
+
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
652
|
+
}
|
|
653
|
+
function splitOpacity(value) {
|
|
654
|
+
const slash = value.lastIndexOf("/");
|
|
655
|
+
if (slash === -1) return [value, null];
|
|
656
|
+
const opacityText = value.slice(slash + 1);
|
|
657
|
+
const n = Number(opacityText);
|
|
658
|
+
if (opacityText !== "" && Number.isInteger(n) && n >= 0 && n <= 100) {
|
|
659
|
+
return [value.slice(0, slash), n];
|
|
660
|
+
}
|
|
661
|
+
return [value, null];
|
|
662
|
+
}
|
|
663
|
+
function colorValue(theme, parsed) {
|
|
664
|
+
const value = parsed.value;
|
|
665
|
+
if (value === null) return null;
|
|
666
|
+
if (parsed.isArbitrary) return value;
|
|
667
|
+
const [name, opacity] = splitOpacity(value);
|
|
668
|
+
const hex = lookupHex(theme, name);
|
|
669
|
+
if (hex === null) return null;
|
|
670
|
+
if (opacity === null) return hex;
|
|
671
|
+
const rgb = hexToRgb(hex);
|
|
672
|
+
if (rgb === null) return hex;
|
|
673
|
+
return `rgba(${rgb.join(",")},${opacity / 100})`;
|
|
674
|
+
}
|
|
645
675
|
|
|
646
676
|
// src/jsEngine/resolvers/border.ts
|
|
647
677
|
function radiusSize(key) {
|
|
@@ -1047,9 +1077,7 @@ function resolveLeadingTrackingNative(parsed) {
|
|
|
1047
1077
|
return null;
|
|
1048
1078
|
}
|
|
1049
1079
|
function nativeHexColor(parsed, theme) {
|
|
1050
|
-
|
|
1051
|
-
if (value === null) return null;
|
|
1052
|
-
return parsed.isArbitrary ? value : lookupHex(theme, value);
|
|
1080
|
+
return colorValue(theme, parsed);
|
|
1053
1081
|
}
|
|
1054
1082
|
function resolveTextNative(parsed, theme) {
|
|
1055
1083
|
if (!parsed.isArbitrary && parsed.value !== null) {
|
package/dist/index.js
CHANGED
|
@@ -1095,6 +1095,36 @@ function lookupHex(theme, key) {
|
|
|
1095
1095
|
const entry = theme.colors[key];
|
|
1096
1096
|
return typeof entry === "string" ? entry : null;
|
|
1097
1097
|
}
|
|
1098
|
+
function hexToRgb(hex) {
|
|
1099
|
+
const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
|
|
1100
|
+
if (!m) return null;
|
|
1101
|
+
let h = m[1];
|
|
1102
|
+
if (h.length === 3) h = h.split("").map((c) => c + c).join("");
|
|
1103
|
+
const n = parseInt(h, 16);
|
|
1104
|
+
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
1105
|
+
}
|
|
1106
|
+
function splitOpacity(value) {
|
|
1107
|
+
const slash = value.lastIndexOf("/");
|
|
1108
|
+
if (slash === -1) return [value, null];
|
|
1109
|
+
const opacityText = value.slice(slash + 1);
|
|
1110
|
+
const n = Number(opacityText);
|
|
1111
|
+
if (opacityText !== "" && Number.isInteger(n) && n >= 0 && n <= 100) {
|
|
1112
|
+
return [value.slice(0, slash), n];
|
|
1113
|
+
}
|
|
1114
|
+
return [value, null];
|
|
1115
|
+
}
|
|
1116
|
+
function colorValue(theme, parsed) {
|
|
1117
|
+
const value = parsed.value;
|
|
1118
|
+
if (value === null) return null;
|
|
1119
|
+
if (parsed.isArbitrary) return value;
|
|
1120
|
+
const [name, opacity] = splitOpacity(value);
|
|
1121
|
+
const hex = lookupHex(theme, name);
|
|
1122
|
+
if (hex === null) return null;
|
|
1123
|
+
if (opacity === null) return hex;
|
|
1124
|
+
const rgb = hexToRgb(hex);
|
|
1125
|
+
if (rgb === null) return hex;
|
|
1126
|
+
return `rgba(${rgb.join(",")},${opacity / 100})`;
|
|
1127
|
+
}
|
|
1098
1128
|
|
|
1099
1129
|
// src/jsEngine/resolvers/border.ts
|
|
1100
1130
|
function radiusSize(key) {
|
|
@@ -1500,9 +1530,7 @@ function resolveLeadingTrackingNative(parsed) {
|
|
|
1500
1530
|
return null;
|
|
1501
1531
|
}
|
|
1502
1532
|
function nativeHexColor(parsed, theme) {
|
|
1503
|
-
|
|
1504
|
-
if (value === null) return null;
|
|
1505
|
-
return parsed.isArbitrary ? value : lookupHex(theme, value);
|
|
1533
|
+
return colorValue(theme, parsed);
|
|
1506
1534
|
}
|
|
1507
1535
|
function resolveTextNative(parsed, theme) {
|
|
1508
1536
|
if (!parsed.isArbitrary && parsed.value !== null) {
|