@kbach/react-native 1.0.0-beta.41 → 1.0.0-beta.43
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-YYCSHELO.mjs → chunk-45OSRKPS.mjs} +1 -1
- package/dist/chunk-BTIGG7K2.mjs +564 -0
- package/dist/{chunk-3AY4XSVY.mjs → chunk-ZURXKRQE.mjs} +1 -1
- package/dist/index.js +12 -6
- package/dist/index.web.js +1 -1
- package/dist/index.web.mjs +2 -2
- package/dist/jsx-dev-runtime.js +83 -63
- package/dist/jsx-dev-runtime.web.js +4 -3
- package/dist/jsx-dev-runtime.web.mjs +3 -3
- package/dist/jsx-runtime.js +83 -63
- 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());
|
|
@@ -1885,7 +1891,7 @@ function parseHexRgb(hex) {
|
|
|
1885
1891
|
const n = parseInt(h, 16);
|
|
1886
1892
|
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
1887
1893
|
}
|
|
1888
|
-
function
|
|
1894
|
+
function applyOpacityToHex2(hex, opacityText) {
|
|
1889
1895
|
const rgb = parseHexRgb(hex);
|
|
1890
1896
|
if (!rgb) return hex;
|
|
1891
1897
|
const a = Number(opacityText) / 100;
|
|
@@ -1898,7 +1904,7 @@ function resolveColorEntry(value, lookup) {
|
|
|
1898
1904
|
const opacity = slash === -1 ? void 0 : value.slice(slash + 1);
|
|
1899
1905
|
const base = lookup(name);
|
|
1900
1906
|
if (base === void 0) return value;
|
|
1901
|
-
return opacity === void 0 ? base :
|
|
1907
|
+
return opacity === void 0 ? base : applyOpacityToHex2(base, opacity);
|
|
1902
1908
|
}
|
|
1903
1909
|
function resolveColors(extend, existing) {
|
|
1904
1910
|
const { dark: darkExtend, ...lightExtend } = extend;
|