@kbach/react-native 1.0.0-beta.34 → 1.0.0-beta.35
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.
|
Binary file
|
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -849,6 +849,29 @@ function lookupHex(theme, key) {
|
|
|
849
849
|
const entry = theme.colors[key];
|
|
850
850
|
return typeof entry === "string" ? entry : null;
|
|
851
851
|
}
|
|
852
|
+
var MODE_AWARE_COLOR_PREFIXES = ["bg-", "text-", "border-"];
|
|
853
|
+
function findModeAwareColor(base, theme) {
|
|
854
|
+
const important = base.startsWith("!") ? "!" : "";
|
|
855
|
+
const rest = important ? base.slice(1) : base;
|
|
856
|
+
for (const prefix of MODE_AWARE_COLOR_PREFIXES) {
|
|
857
|
+
if (!rest.startsWith(prefix)) continue;
|
|
858
|
+
const value = rest.slice(prefix.length);
|
|
859
|
+
const entry = theme.colors[value];
|
|
860
|
+
if (typeof entry === "object" && entry !== null) {
|
|
861
|
+
return { prefix: `${important}${prefix}`, light: entry.light, dark: entry.dark };
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
return null;
|
|
865
|
+
}
|
|
866
|
+
function substituteModeAwareColorToken(token, theme, colorScheme) {
|
|
867
|
+
const segments = token.split(":");
|
|
868
|
+
const base = segments.pop() ?? token;
|
|
869
|
+
const modifierPrefix = segments.length > 0 ? `${segments.join(":")}:` : "";
|
|
870
|
+
const found = findModeAwareColor(base, theme);
|
|
871
|
+
if (found === null) return token;
|
|
872
|
+
const hex = colorScheme === "dark" ? found.dark : found.light;
|
|
873
|
+
return `${modifierPrefix}${found.prefix}[${hex}]`;
|
|
874
|
+
}
|
|
852
875
|
function hexToRgb(hex) {
|
|
853
876
|
const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
|
|
854
877
|
if (!m) return null;
|
|
@@ -1721,7 +1744,8 @@ function resolveStyleJsWithWarnings(classString, theme, colorScheme, pressed, wi
|
|
|
1721
1744
|
const warnings = [];
|
|
1722
1745
|
let shadowOffset = null;
|
|
1723
1746
|
const transformOps = /* @__PURE__ */ new Map();
|
|
1724
|
-
for (const
|
|
1747
|
+
for (const rawToken of classString.split(/\s+/).filter(Boolean)) {
|
|
1748
|
+
const token = substituteModeAwareColorToken(rawToken, theme, colorScheme);
|
|
1725
1749
|
const parsed = parseClass(token);
|
|
1726
1750
|
const allModifiersHold = parsed.modifiers.every(
|
|
1727
1751
|
(m) => nativeModifierState(m, theme, colorScheme, pressed, width) === true
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -1379,6 +1379,29 @@ function lookupHex(theme, key) {
|
|
|
1379
1379
|
const entry = theme.colors[key];
|
|
1380
1380
|
return typeof entry === "string" ? entry : null;
|
|
1381
1381
|
}
|
|
1382
|
+
var MODE_AWARE_COLOR_PREFIXES = ["bg-", "text-", "border-"];
|
|
1383
|
+
function findModeAwareColor(base, theme) {
|
|
1384
|
+
const important = base.startsWith("!") ? "!" : "";
|
|
1385
|
+
const rest = important ? base.slice(1) : base;
|
|
1386
|
+
for (const prefix of MODE_AWARE_COLOR_PREFIXES) {
|
|
1387
|
+
if (!rest.startsWith(prefix)) continue;
|
|
1388
|
+
const value = rest.slice(prefix.length);
|
|
1389
|
+
const entry = theme.colors[value];
|
|
1390
|
+
if (typeof entry === "object" && entry !== null) {
|
|
1391
|
+
return { prefix: `${important}${prefix}`, light: entry.light, dark: entry.dark };
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
return null;
|
|
1395
|
+
}
|
|
1396
|
+
function substituteModeAwareColorToken(token, theme, colorScheme) {
|
|
1397
|
+
const segments = token.split(":");
|
|
1398
|
+
const base = segments.pop() ?? token;
|
|
1399
|
+
const modifierPrefix = segments.length > 0 ? `${segments.join(":")}:` : "";
|
|
1400
|
+
const found = findModeAwareColor(base, theme);
|
|
1401
|
+
if (found === null) return token;
|
|
1402
|
+
const hex = colorScheme === "dark" ? found.dark : found.light;
|
|
1403
|
+
return `${modifierPrefix}${found.prefix}[${hex}]`;
|
|
1404
|
+
}
|
|
1382
1405
|
function hexToRgb(hex) {
|
|
1383
1406
|
const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
|
|
1384
1407
|
if (!m) return null;
|
|
@@ -2104,7 +2127,8 @@ function resolveStyleJsWithWarnings(classString, theme, colorScheme, pressed, wi
|
|
|
2104
2127
|
const warnings = [];
|
|
2105
2128
|
let shadowOffset = null;
|
|
2106
2129
|
const transformOps = /* @__PURE__ */ new Map();
|
|
2107
|
-
for (const
|
|
2130
|
+
for (const rawToken of classString.split(/\s+/).filter(Boolean)) {
|
|
2131
|
+
const token = substituteModeAwareColorToken(rawToken, theme, colorScheme);
|
|
2108
2132
|
const parsed = parseClass(token);
|
|
2109
2133
|
const allModifiersHold = parsed.modifiers.every(
|
|
2110
2134
|
(m) => nativeModifierState(m, theme, colorScheme, pressed, width) === true
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1370,6 +1370,29 @@ function lookupHex(theme, key) {
|
|
|
1370
1370
|
const entry = theme.colors[key];
|
|
1371
1371
|
return typeof entry === "string" ? entry : null;
|
|
1372
1372
|
}
|
|
1373
|
+
var MODE_AWARE_COLOR_PREFIXES = ["bg-", "text-", "border-"];
|
|
1374
|
+
function findModeAwareColor(base, theme) {
|
|
1375
|
+
const important = base.startsWith("!") ? "!" : "";
|
|
1376
|
+
const rest = important ? base.slice(1) : base;
|
|
1377
|
+
for (const prefix of MODE_AWARE_COLOR_PREFIXES) {
|
|
1378
|
+
if (!rest.startsWith(prefix)) continue;
|
|
1379
|
+
const value = rest.slice(prefix.length);
|
|
1380
|
+
const entry = theme.colors[value];
|
|
1381
|
+
if (typeof entry === "object" && entry !== null) {
|
|
1382
|
+
return { prefix: `${important}${prefix}`, light: entry.light, dark: entry.dark };
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
return null;
|
|
1386
|
+
}
|
|
1387
|
+
function substituteModeAwareColorToken(token, theme, colorScheme) {
|
|
1388
|
+
const segments = token.split(":");
|
|
1389
|
+
const base = segments.pop() ?? token;
|
|
1390
|
+
const modifierPrefix = segments.length > 0 ? `${segments.join(":")}:` : "";
|
|
1391
|
+
const found = findModeAwareColor(base, theme);
|
|
1392
|
+
if (found === null) return token;
|
|
1393
|
+
const hex = colorScheme === "dark" ? found.dark : found.light;
|
|
1394
|
+
return `${modifierPrefix}${found.prefix}[${hex}]`;
|
|
1395
|
+
}
|
|
1373
1396
|
function hexToRgb(hex) {
|
|
1374
1397
|
const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
|
|
1375
1398
|
if (!m) return null;
|
|
@@ -2095,7 +2118,8 @@ function resolveStyleJsWithWarnings(classString, theme, colorScheme, pressed, wi
|
|
|
2095
2118
|
const warnings = [];
|
|
2096
2119
|
let shadowOffset = null;
|
|
2097
2120
|
const transformOps = /* @__PURE__ */ new Map();
|
|
2098
|
-
for (const
|
|
2121
|
+
for (const rawToken of classString.split(/\s+/).filter(Boolean)) {
|
|
2122
|
+
const token = substituteModeAwareColorToken(rawToken, theme, colorScheme);
|
|
2099
2123
|
const parsed = parseClass(token);
|
|
2100
2124
|
const allModifiersHold = parsed.modifiers.every(
|
|
2101
2125
|
(m) => nativeModifierState(m, theme, colorScheme, pressed, width) === true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kbach/react-native",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.35",
|
|
4
4
|
"description": "Kbach's utility-class styling engine for React Native — the same class names as @kbach/react, resolved to a StyleSheet-ready style object via a Kotlin/JNI TurboModule (native), the same WASM engine @kbach/react uses (Expo Web / react-native-web), or a pure-JS fallback engine (Expo Go). Ships its own native Android module — one npm install, no separate native package. Beta. Native is Android-only (no iOS bridge yet); works with the React Native CLI, an Expo dev client, AND Expo Go (a reduced-coverage pure-JS fallback, since Expo Go can't load any custom native module).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|