@kbach/react-native 1.0.0 → 1.1.1-beta.1
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/AGENTS.md +21 -0
- package/README.md +8 -0
- 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-HYQFT32E.mjs → chunk-6F44N62F.mjs} +1 -1
- package/dist/{chunk-7CNURQSH.mjs → chunk-FSO4WVCH.mjs} +1 -1
- package/dist/chunk-R7E5D3D6.mjs +623 -0
- package/dist/index.js +68 -0
- package/dist/index.web.js +1 -1
- package/dist/index.web.mjs +2 -2
- package/dist/jsx-dev-runtime.js +75 -5
- package/dist/jsx-dev-runtime.web.js +1 -1
- package/dist/jsx-dev-runtime.web.mjs +3 -3
- package/dist/jsx-runtime.js +75 -5
- package/dist/jsx-runtime.web.js +1 -1
- package/dist/jsx-runtime.web.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-MUPEQJRT.mjs +0 -623
package/dist/index.web.mjs
CHANGED
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
subscribeDynamicTokens,
|
|
11
11
|
subscribeGlobalDarkMode,
|
|
12
12
|
toggleGlobalDarkMode
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FSO4WVCH.mjs";
|
|
14
14
|
import {
|
|
15
15
|
defaultTheme,
|
|
16
16
|
getTheme,
|
|
17
17
|
resolveClassName,
|
|
18
18
|
setTheme
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-R7E5D3D6.mjs";
|
|
20
20
|
|
|
21
21
|
// src/config.ts
|
|
22
22
|
function parseHexRgb(hex) {
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -914,6 +914,73 @@ function parsePercentRelativeExpr(token) {
|
|
|
914
914
|
return parsePercentRelativeMinMaxClamp(token);
|
|
915
915
|
}
|
|
916
916
|
|
|
917
|
+
// src/jsEngine/groups.ts
|
|
918
|
+
function expandVariantGroups(input) {
|
|
919
|
+
if (!input.includes(":(")) return input;
|
|
920
|
+
const out = [];
|
|
921
|
+
for (const token of splitTopLevel(input)) expandToken(token, "", false, out);
|
|
922
|
+
return out.join(" ");
|
|
923
|
+
}
|
|
924
|
+
function splitTopLevel(s) {
|
|
925
|
+
const parts = [];
|
|
926
|
+
let depth = 0;
|
|
927
|
+
let start = -1;
|
|
928
|
+
for (let i = 0; i < s.length; i++) {
|
|
929
|
+
const ch = s[i];
|
|
930
|
+
if (ch === "(" || ch === "[") depth++;
|
|
931
|
+
else if (ch === ")" || ch === "]") depth--;
|
|
932
|
+
const space = /\s/.test(ch);
|
|
933
|
+
if (space && depth <= 0) {
|
|
934
|
+
if (start >= 0) {
|
|
935
|
+
parts.push(s.slice(start, i));
|
|
936
|
+
start = -1;
|
|
937
|
+
}
|
|
938
|
+
depth = Math.max(depth, 0);
|
|
939
|
+
} else if (start < 0 && !space) {
|
|
940
|
+
start = i;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
if (start >= 0) parts.push(s.slice(start));
|
|
944
|
+
return parts;
|
|
945
|
+
}
|
|
946
|
+
function groupOpen(token) {
|
|
947
|
+
let brackets = 0;
|
|
948
|
+
for (let i = 0; i < token.length; i++) {
|
|
949
|
+
const ch = token[i];
|
|
950
|
+
if (ch === "[") brackets++;
|
|
951
|
+
else if (ch === "]") brackets--;
|
|
952
|
+
else if (ch === "(" && brackets === 0 && i > 1 && token[i - 1] === ":") return i;
|
|
953
|
+
}
|
|
954
|
+
return -1;
|
|
955
|
+
}
|
|
956
|
+
function groupClose(token, open) {
|
|
957
|
+
let depth = 0;
|
|
958
|
+
for (let i = open; i < token.length; i++) {
|
|
959
|
+
const ch = token[i];
|
|
960
|
+
if (ch === "(" || ch === "[") depth++;
|
|
961
|
+
else if (ch === ")" || ch === "]") {
|
|
962
|
+
depth--;
|
|
963
|
+
if (depth === 0) return ch === ")" ? i : -1;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
return -1;
|
|
967
|
+
}
|
|
968
|
+
function pushClass(prefix, cls, important, out) {
|
|
969
|
+
if (!cls) return;
|
|
970
|
+
const bare = cls.split(":").pop() ?? cls;
|
|
971
|
+
out.push(prefix + cls + (important && !cls.endsWith("!") && !bare.startsWith("!") ? "!" : ""));
|
|
972
|
+
}
|
|
973
|
+
function expandToken(token, prefix, important, out) {
|
|
974
|
+
const open = groupOpen(token);
|
|
975
|
+
if (open < 0) return pushClass(prefix, token, important, out);
|
|
976
|
+
const close = groupClose(token, open);
|
|
977
|
+
if (close < 0) return pushClass(prefix, token, important, out);
|
|
978
|
+
const rest = token.slice(close + 1);
|
|
979
|
+
if (rest !== "" && rest !== "!") return pushClass(prefix, token, important, out);
|
|
980
|
+
const innerPrefix = prefix + token.slice(0, open);
|
|
981
|
+
for (const part of splitTopLevel(token.slice(open + 1, close))) expandToken(part, innerPrefix, rest === "!" || important, out);
|
|
982
|
+
}
|
|
983
|
+
|
|
917
984
|
// src/jsxRuntimeCore.ts
|
|
918
985
|
var DYNAMIC_TOKEN_MATCH_RE = /var\(--([a-zA-Z0-9-]+)\)/g;
|
|
919
986
|
function substituteDynamicTokens(classStrRaw) {
|
|
@@ -1028,6 +1095,7 @@ function ReactiveElement({
|
|
|
1028
1095
|
hostType,
|
|
1029
1096
|
hostRest,
|
|
1030
1097
|
classStrRaw,
|
|
1098
|
+
classNameProp,
|
|
1031
1099
|
userStyle,
|
|
1032
1100
|
resolveStyle: resolveStyle2,
|
|
1033
1101
|
elementKey,
|
|
@@ -1103,7 +1171,7 @@ function ReactiveElement({
|
|
|
1103
1171
|
return makeElement(
|
|
1104
1172
|
isStaticChildren,
|
|
1105
1173
|
hostType,
|
|
1106
|
-
{ ...hostRestWithLayout, className:
|
|
1174
|
+
{ ...hostRestWithLayout, className: classNameProp, style: finalStyle },
|
|
1107
1175
|
elementKey
|
|
1108
1176
|
);
|
|
1109
1177
|
}
|
|
@@ -1111,20 +1179,21 @@ function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
|
|
|
1111
1179
|
if (type === null || typeof type === "symbol" || !rawProps) {
|
|
1112
1180
|
return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
1113
1181
|
}
|
|
1114
|
-
const { className:
|
|
1115
|
-
if (typeof
|
|
1182
|
+
const { className: classNameProp, style: userStyle, ...rest } = rawProps;
|
|
1183
|
+
if (typeof classNameProp !== "string") {
|
|
1116
1184
|
return makeElement(isStaticChildren, type, rawProps, key);
|
|
1117
1185
|
}
|
|
1186
|
+
const classStrRaw = classNameProp.includes(":(") ? expandVariantGroups(classNameProp) : classNameProp;
|
|
1118
1187
|
if (DARK_MODIFIER_RE.test(classStrRaw) || BREAKPOINT_MODIFIER_RE.test(classStrRaw) || HOVER_MODIFIER_RE.test(classStrRaw) || FOCUS_MODIFIER_RE.test(classStrRaw) || classStrRaw.includes("var(--") || PERCENT_RELATIVE_CALC_HINT_RE.test(classStrRaw) || usesModeAwareColor(classStrRaw)) {
|
|
1119
1188
|
return (0, import_jsx_runtime.jsx)(
|
|
1120
1189
|
ReactiveElement,
|
|
1121
|
-
{ hostType: type, hostRest: rest, classStrRaw, userStyle, resolveStyle: resolveStyle2, elementKey: key, isStaticChildren },
|
|
1190
|
+
{ hostType: type, hostRest: rest, classStrRaw, classNameProp, userStyle, resolveStyle: resolveStyle2, elementKey: key, isStaticChildren },
|
|
1122
1191
|
key
|
|
1123
1192
|
);
|
|
1124
1193
|
}
|
|
1125
1194
|
const staticStates = { hover: false, focus: false, disabled: rest.disabled === true };
|
|
1126
1195
|
const finalStyle = type === import_react_native.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed, rest, void 0, staticStates) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false, rest, void 0, staticStates);
|
|
1127
|
-
return makeElement(isStaticChildren, type, { ...rest, className:
|
|
1196
|
+
return makeElement(isStaticChildren, type, { ...rest, className: classNameProp, style: finalStyle }, key);
|
|
1128
1197
|
}
|
|
1129
1198
|
function createJsxFunctions(resolveStyle2) {
|
|
1130
1199
|
function jsx2(type, props, key) {
|
|
@@ -2450,6 +2519,7 @@ Fix: use a plain px/rem calc, a fraction utility (e.g. w-1/2), or resolve this v
|
|
|
2450
2519
|
return { value: null, warning };
|
|
2451
2520
|
}
|
|
2452
2521
|
function resolveStyleJsWithWarnings(classString, theme, colorScheme, pressed, width) {
|
|
2522
|
+
classString = expandVariantGroups(classString);
|
|
2453
2523
|
const style = {};
|
|
2454
2524
|
const warnings = [];
|
|
2455
2525
|
let shadowOffset = null;
|