@kbach/react-native 1.0.0-beta.42 → 1.0.0-beta.44
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-DKZM4NUU.mjs +564 -0
- package/dist/{chunk-YYCSHELO.mjs → chunk-KT6TQLWI.mjs} +1 -1
- package/dist/{chunk-3AY4XSVY.mjs → chunk-UFSVFF3V.mjs} +1 -1
- package/dist/index.js +36 -10
- package/dist/index.web.js +1 -1
- package/dist/index.web.mjs +2 -2
- package/dist/jsx-dev-runtime.js +34 -8
- package/dist/jsx-dev-runtime.web.js +1 -1
- package/dist/jsx-dev-runtime.web.mjs +3 -3
- package/dist/jsx-runtime.js +34 -8
- package/dist/jsx-runtime.web.js +1 -1
- package/dist/jsx-runtime.web.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-A3PV4XGK.mjs +0 -564
package/dist/index.js
CHANGED
|
@@ -855,14 +855,20 @@ function findModeAwareColor(base, theme) {
|
|
|
855
855
|
const rest = important ? base.slice(1) : base;
|
|
856
856
|
for (const prefix of MODE_AWARE_COLOR_PREFIXES) {
|
|
857
857
|
if (!rest.startsWith(prefix)) continue;
|
|
858
|
-
const
|
|
859
|
-
const entry = theme.colors[
|
|
858
|
+
const [name, opacity] = splitOpacity(rest.slice(prefix.length));
|
|
859
|
+
const entry = theme.colors[name];
|
|
860
860
|
if (typeof entry === "object" && entry !== null) {
|
|
861
|
-
return { prefix: `${important}${prefix}`, light: entry.light, dark: entry.dark };
|
|
861
|
+
return { prefix: `${important}${prefix}`, opacity, light: entry.light, dark: entry.dark };
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
864
|
return null;
|
|
865
865
|
}
|
|
866
|
+
function applyOpacityToHex(hex, opacity) {
|
|
867
|
+
if (opacity === null) return hex;
|
|
868
|
+
const rgb = hexToRgb(hex);
|
|
869
|
+
if (rgb === null) return hex;
|
|
870
|
+
return `rgba(${rgb.join(",")},${opacity / 100})`;
|
|
871
|
+
}
|
|
866
872
|
function substituteModeAwareColorToken(token, theme, colorScheme) {
|
|
867
873
|
const segments = token.split(":");
|
|
868
874
|
const base = segments.pop() ?? token;
|
|
@@ -870,7 +876,7 @@ function substituteModeAwareColorToken(token, theme, colorScheme) {
|
|
|
870
876
|
const found = findModeAwareColor(base, theme);
|
|
871
877
|
if (found === null) return token;
|
|
872
878
|
const hex = colorScheme === "dark" ? found.dark : found.light;
|
|
873
|
-
return `${modifierPrefix}${found.prefix}[${hex}]`;
|
|
879
|
+
return `${modifierPrefix}${found.prefix}[${applyOpacityToHex(hex, found.opacity)}]`;
|
|
874
880
|
}
|
|
875
881
|
function hexToRgb(hex) {
|
|
876
882
|
const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
|
|
@@ -902,6 +908,12 @@ function colorValue(theme, parsed) {
|
|
|
902
908
|
if (rgb === null) return hex;
|
|
903
909
|
return `rgba(${rgb.join(",")},${opacity / 100})`;
|
|
904
910
|
}
|
|
911
|
+
var LENGTH_UNITS = ["px", "rem", "em", "%", "vh", "vw"];
|
|
912
|
+
function looksLikeLength(value) {
|
|
913
|
+
const unit = LENGTH_UNITS.find((u) => value.endsWith(u));
|
|
914
|
+
const withoutUnit = unit ? value.slice(0, value.length - unit.length) : value;
|
|
915
|
+
return withoutUnit !== "" && Number.isFinite(Number(withoutUnit));
|
|
916
|
+
}
|
|
905
917
|
|
|
906
918
|
// src/jsEngine/resolvers/border.ts
|
|
907
919
|
function radiusSize(key) {
|
|
@@ -952,7 +964,9 @@ function borderValue(theme, parsed) {
|
|
|
952
964
|
if (value === "separate") return [decl("border-collapse", "separate")];
|
|
953
965
|
}
|
|
954
966
|
if (parsed.isArbitrary) {
|
|
955
|
-
return [decl("border-width", value)];
|
|
967
|
+
if (looksLikeLength(value)) return [decl("border-width", value)];
|
|
968
|
+
const color2 = colorValue(theme, parsed);
|
|
969
|
+
return color2 === null ? null : [decl("border-color", color2)];
|
|
956
970
|
}
|
|
957
971
|
if (Number.isFinite(Number(value)) && value.trim() !== "") {
|
|
958
972
|
const v = resolveLength(theme, parsed);
|
|
@@ -967,7 +981,11 @@ function borderValue(theme, parsed) {
|
|
|
967
981
|
function borderSideValue(theme, parsed, sideProperty) {
|
|
968
982
|
const value = parsed.value;
|
|
969
983
|
if (value === null) return null;
|
|
970
|
-
if (parsed.isArbitrary)
|
|
984
|
+
if (parsed.isArbitrary) {
|
|
985
|
+
if (looksLikeLength(value)) return [decl(`${sideProperty}-width`, value)];
|
|
986
|
+
const color2 = colorValue(theme, parsed);
|
|
987
|
+
return color2 === null ? null : [decl(`${sideProperty}-color`, color2)];
|
|
988
|
+
}
|
|
971
989
|
if (Number.isFinite(Number(value)) && value.trim() !== "") {
|
|
972
990
|
const v = resolveLength(theme, parsed);
|
|
973
991
|
return v === null ? null : [decl(`${sideProperty}-width`, v)];
|
|
@@ -981,7 +999,11 @@ function borderSideValue(theme, parsed, sideProperty) {
|
|
|
981
999
|
function borderAxisValue(theme, parsed, sideA, sideB) {
|
|
982
1000
|
const value = parsed.value;
|
|
983
1001
|
if (value === null) return null;
|
|
984
|
-
if (parsed.isArbitrary)
|
|
1002
|
+
if (parsed.isArbitrary) {
|
|
1003
|
+
if (looksLikeLength(value)) return [decl(`${sideA}-width`, value), decl(`${sideB}-width`, value)];
|
|
1004
|
+
const color2 = colorValue(theme, parsed);
|
|
1005
|
+
return color2 === null ? null : [decl(`${sideA}-color`, color2), decl(`${sideB}-color`, color2)];
|
|
1006
|
+
}
|
|
985
1007
|
if (Number.isFinite(Number(value)) && value.trim() !== "") {
|
|
986
1008
|
const v = resolveLength(theme, parsed);
|
|
987
1009
|
return v === null ? null : [decl(`${sideA}-width`, v), decl(`${sideB}-width`, v)];
|
|
@@ -1048,7 +1070,11 @@ function outlineWidthValue(key) {
|
|
|
1048
1070
|
function outlineValue(theme, parsed) {
|
|
1049
1071
|
const value = parsed.value;
|
|
1050
1072
|
if (value === null) return null;
|
|
1051
|
-
if (parsed.isArbitrary)
|
|
1073
|
+
if (parsed.isArbitrary) {
|
|
1074
|
+
if (looksLikeLength(value)) return [decl("outline-width", value)];
|
|
1075
|
+
const color2 = colorValue(theme, parsed);
|
|
1076
|
+
return color2 === null ? null : [decl("outline-color", color2)];
|
|
1077
|
+
}
|
|
1052
1078
|
const w = outlineWidthValue(value);
|
|
1053
1079
|
if (w !== null) return [decl("outline-width", w)];
|
|
1054
1080
|
if (OUTLINE_STYLES.includes(value)) return [decl("outline-style", value)];
|
|
@@ -1885,7 +1911,7 @@ function parseHexRgb(hex) {
|
|
|
1885
1911
|
const n = parseInt(h, 16);
|
|
1886
1912
|
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
1887
1913
|
}
|
|
1888
|
-
function
|
|
1914
|
+
function applyOpacityToHex2(hex, opacityText) {
|
|
1889
1915
|
const rgb = parseHexRgb(hex);
|
|
1890
1916
|
if (!rgb) return hex;
|
|
1891
1917
|
const a = Number(opacityText) / 100;
|
|
@@ -1898,7 +1924,7 @@ function resolveColorEntry(value, lookup) {
|
|
|
1898
1924
|
const opacity = slash === -1 ? void 0 : value.slice(slash + 1);
|
|
1899
1925
|
const base = lookup(name);
|
|
1900
1926
|
if (base === void 0) return value;
|
|
1901
|
-
return opacity === void 0 ? base :
|
|
1927
|
+
return opacity === void 0 ? base : applyOpacityToHex2(base, opacity);
|
|
1902
1928
|
}
|
|
1903
1929
|
function resolveColors(extend, existing) {
|
|
1904
1930
|
const { dark: darkExtend, ...lightExtend } = extend;
|