@kbach/react-native 1.1.1-beta.0 → 1.1.1-beta.2
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 +22 -0
- package/README.md +25 -2
- 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-FSO4WVCH.mjs → chunk-BN6RWNCE.mjs} +1 -1
- package/dist/chunk-TCSCNQQ7.mjs +623 -0
- package/dist/{chunk-6F44N62F.mjs → chunk-VMI2JVCQ.mjs} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +69 -1
- package/dist/index.web.d.ts +1 -1
- package/dist/index.web.js +12 -1
- package/dist/index.web.mjs +13 -2
- package/dist/jsx-dev-runtime.js +149 -73
- package/dist/jsx-dev-runtime.web.js +1 -1
- package/dist/jsx-dev-runtime.web.mjs +3 -3
- package/dist/jsx-runtime.js +149 -73
- package/dist/jsx-runtime.web.js +1 -1
- package/dist/jsx-runtime.web.mjs +2 -2
- package/dist/{semanticElements-Bk3TB-vt.d.ts → semanticElements-CY-W_7tU.d.ts} +7 -0
- package/dist/theme.d.ts +2 -0
- package/llms.txt +7 -2
- package/package.json +1 -1
- package/dist/chunk-R7E5D3D6.mjs +0 -623
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-BN6RWNCE.mjs";
|
|
2
2
|
import {
|
|
3
3
|
Fragment,
|
|
4
4
|
jsx,
|
|
5
5
|
jsxs
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-VMI2JVCQ.mjs";
|
|
7
|
+
import "./chunk-TCSCNQQ7.mjs";
|
|
8
8
|
|
|
9
9
|
// src/jsxRuntimeCore.ts
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -915,6 +915,130 @@ function parsePercentRelativeExpr(token) {
|
|
|
915
915
|
return parsePercentRelativeMinMaxClamp(token);
|
|
916
916
|
}
|
|
917
917
|
|
|
918
|
+
// src/jsEngine/groups.ts
|
|
919
|
+
function expandVariantGroups(input) {
|
|
920
|
+
if (!input.includes(":(")) return input;
|
|
921
|
+
const out = [];
|
|
922
|
+
for (const token of splitTopLevel(input)) expandToken(token, "", false, out);
|
|
923
|
+
return out.join(" ");
|
|
924
|
+
}
|
|
925
|
+
function splitTopLevel(s) {
|
|
926
|
+
const parts = [];
|
|
927
|
+
let depth = 0;
|
|
928
|
+
let start = -1;
|
|
929
|
+
for (let i = 0; i < s.length; i++) {
|
|
930
|
+
const ch = s[i];
|
|
931
|
+
if (ch === "(" || ch === "[") depth++;
|
|
932
|
+
else if (ch === ")" || ch === "]") depth--;
|
|
933
|
+
const space = /\s/.test(ch);
|
|
934
|
+
if (space && depth <= 0) {
|
|
935
|
+
if (start >= 0) {
|
|
936
|
+
parts.push(s.slice(start, i));
|
|
937
|
+
start = -1;
|
|
938
|
+
}
|
|
939
|
+
depth = Math.max(depth, 0);
|
|
940
|
+
} else if (start < 0 && !space) {
|
|
941
|
+
start = i;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
if (start >= 0) parts.push(s.slice(start));
|
|
945
|
+
return parts;
|
|
946
|
+
}
|
|
947
|
+
function groupOpen(token) {
|
|
948
|
+
let brackets = 0;
|
|
949
|
+
for (let i = 0; i < token.length; i++) {
|
|
950
|
+
const ch = token[i];
|
|
951
|
+
if (ch === "[") brackets++;
|
|
952
|
+
else if (ch === "]") brackets--;
|
|
953
|
+
else if (ch === "(" && brackets === 0 && i > 1 && token[i - 1] === ":") return i;
|
|
954
|
+
}
|
|
955
|
+
return -1;
|
|
956
|
+
}
|
|
957
|
+
function groupClose(token, open) {
|
|
958
|
+
let depth = 0;
|
|
959
|
+
for (let i = open; i < token.length; i++) {
|
|
960
|
+
const ch = token[i];
|
|
961
|
+
if (ch === "(" || ch === "[") depth++;
|
|
962
|
+
else if (ch === ")" || ch === "]") {
|
|
963
|
+
depth--;
|
|
964
|
+
if (depth === 0) return ch === ")" ? i : -1;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
return -1;
|
|
968
|
+
}
|
|
969
|
+
function pushClass(prefix, cls, important, out) {
|
|
970
|
+
if (!cls) return;
|
|
971
|
+
const bare = cls.split(":").pop() ?? cls;
|
|
972
|
+
out.push(prefix + cls + (important && !cls.endsWith("!") && !bare.startsWith("!") ? "!" : ""));
|
|
973
|
+
}
|
|
974
|
+
function expandToken(token, prefix, important, out) {
|
|
975
|
+
const open = groupOpen(token);
|
|
976
|
+
if (open < 0) return pushClass(prefix, token, important, out);
|
|
977
|
+
const close = groupClose(token, open);
|
|
978
|
+
if (close < 0) return pushClass(prefix, token, important, out);
|
|
979
|
+
const rest = token.slice(close + 1);
|
|
980
|
+
if (rest !== "" && rest !== "!") return pushClass(prefix, token, important, out);
|
|
981
|
+
const innerPrefix = prefix + token.slice(0, open);
|
|
982
|
+
for (const part of splitTopLevel(token.slice(open + 1, close))) expandToken(part, innerPrefix, rest === "!" || important, out);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
// src/jsEngine/compose.ts
|
|
986
|
+
var MAX_DEPTH = 8;
|
|
987
|
+
function splitVariants(token) {
|
|
988
|
+
let depth = 0;
|
|
989
|
+
let last = -1;
|
|
990
|
+
for (let i = 0; i < token.length; i++) {
|
|
991
|
+
const ch = token[i];
|
|
992
|
+
if (ch === "[" || ch === "(") depth++;
|
|
993
|
+
else if (ch === "]" || ch === ")") depth--;
|
|
994
|
+
else if (ch === ":" && depth === 0) last = i;
|
|
995
|
+
}
|
|
996
|
+
return last < 0 ? ["", token] : [token.slice(0, last + 1), token.slice(last + 1)];
|
|
997
|
+
}
|
|
998
|
+
function stripImportant(base) {
|
|
999
|
+
if (base.endsWith("!")) return [base.slice(0, -1), true];
|
|
1000
|
+
if (base.startsWith("!")) return [base.slice(1), true];
|
|
1001
|
+
return [base, false];
|
|
1002
|
+
}
|
|
1003
|
+
function withImportant(cls, important) {
|
|
1004
|
+
const [, base] = splitVariants(cls);
|
|
1005
|
+
return important && !cls.endsWith("!") && !base.startsWith("!") ? cls + "!" : cls;
|
|
1006
|
+
}
|
|
1007
|
+
function expandInto(prefix, value, important, compose, path, out) {
|
|
1008
|
+
for (const cls of expandVariantGroups(value).split(/\s+/).filter(Boolean)) {
|
|
1009
|
+
const [variants, base] = splitVariants(cls);
|
|
1010
|
+
const [name, bang] = stripImportant(base);
|
|
1011
|
+
const inner = Object.prototype.hasOwnProperty.call(compose, name) ? compose[name] : void 0;
|
|
1012
|
+
if (inner !== void 0 && path.length < MAX_DEPTH && !path.includes(name)) {
|
|
1013
|
+
path.push(name);
|
|
1014
|
+
expandInto(prefix + variants, inner, important || bang, compose, path, out);
|
|
1015
|
+
path.pop();
|
|
1016
|
+
} else {
|
|
1017
|
+
out.push(withImportant(prefix + cls, important));
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
function expandComposeToken(token, compose) {
|
|
1022
|
+
if (!compose) return null;
|
|
1023
|
+
const [variants, base] = splitVariants(token);
|
|
1024
|
+
const [name, important] = stripImportant(base);
|
|
1025
|
+
if (!Object.prototype.hasOwnProperty.call(compose, name)) return null;
|
|
1026
|
+
const out = [];
|
|
1027
|
+
expandInto(variants, compose[name], important, compose, [name], out);
|
|
1028
|
+
return out;
|
|
1029
|
+
}
|
|
1030
|
+
function expandComposeClasses(classString, compose) {
|
|
1031
|
+
if (!compose || Object.keys(compose).length === 0) return classString;
|
|
1032
|
+
const composed = [];
|
|
1033
|
+
const own = [];
|
|
1034
|
+
for (const token of classString.split(/\s+/).filter(Boolean)) {
|
|
1035
|
+
const classes = expandComposeToken(token, compose);
|
|
1036
|
+
if (classes) composed.push(...classes);
|
|
1037
|
+
else own.push(token);
|
|
1038
|
+
}
|
|
1039
|
+
return composed.length === 0 ? classString : [...composed, ...own].join(" ");
|
|
1040
|
+
}
|
|
1041
|
+
|
|
918
1042
|
// src/jsxRuntimeCore.ts
|
|
919
1043
|
var DYNAMIC_TOKEN_MATCH_RE = /var\(--([a-zA-Z0-9-]+)\)/g;
|
|
920
1044
|
function substituteDynamicTokens(classStrRaw) {
|
|
@@ -1029,6 +1153,7 @@ function ReactiveElement({
|
|
|
1029
1153
|
hostType,
|
|
1030
1154
|
hostRest,
|
|
1031
1155
|
classStrRaw,
|
|
1156
|
+
classNameProp,
|
|
1032
1157
|
userStyle,
|
|
1033
1158
|
resolveStyle: resolveStyle2,
|
|
1034
1159
|
elementKey,
|
|
@@ -1104,28 +1229,46 @@ function ReactiveElement({
|
|
|
1104
1229
|
return makeElement(
|
|
1105
1230
|
isStaticChildren,
|
|
1106
1231
|
hostType,
|
|
1107
|
-
{ ...hostRestWithLayout, className:
|
|
1232
|
+
{ ...hostRestWithLayout, className: classNameProp, style: finalStyle },
|
|
1108
1233
|
elementKey
|
|
1109
1234
|
);
|
|
1110
1235
|
}
|
|
1236
|
+
var flatCache = /* @__PURE__ */ new Map();
|
|
1237
|
+
var flatCacheTheme = null;
|
|
1238
|
+
function flatClasses(classNameProp) {
|
|
1239
|
+
const theme = (0, import_theme.getTheme)();
|
|
1240
|
+
if (!theme.compose && !classNameProp.includes(":(")) return classNameProp;
|
|
1241
|
+
if (theme !== flatCacheTheme) {
|
|
1242
|
+
flatCache.clear();
|
|
1243
|
+
flatCacheTheme = theme;
|
|
1244
|
+
}
|
|
1245
|
+
let flat = flatCache.get(classNameProp);
|
|
1246
|
+
if (flat === void 0) {
|
|
1247
|
+
flat = expandComposeClasses(classNameProp.includes(":(") ? expandVariantGroups(classNameProp) : classNameProp, theme.compose);
|
|
1248
|
+
if (flatCache.size >= 500) flatCache.clear();
|
|
1249
|
+
flatCache.set(classNameProp, flat);
|
|
1250
|
+
}
|
|
1251
|
+
return flat;
|
|
1252
|
+
}
|
|
1111
1253
|
function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
|
|
1112
1254
|
if (type === null || typeof type === "symbol" || !rawProps) {
|
|
1113
1255
|
return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
1114
1256
|
}
|
|
1115
|
-
const { className:
|
|
1116
|
-
if (typeof
|
|
1257
|
+
const { className: classNameProp, style: userStyle, ...rest } = rawProps;
|
|
1258
|
+
if (typeof classNameProp !== "string") {
|
|
1117
1259
|
return makeElement(isStaticChildren, type, rawProps, key);
|
|
1118
1260
|
}
|
|
1261
|
+
const classStrRaw = flatClasses(classNameProp);
|
|
1119
1262
|
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)) {
|
|
1120
1263
|
return (0, import_jsx_runtime.jsx)(
|
|
1121
1264
|
ReactiveElement,
|
|
1122
|
-
{ hostType: type, hostRest: rest, classStrRaw, userStyle, resolveStyle: resolveStyle2, elementKey: key, isStaticChildren },
|
|
1265
|
+
{ hostType: type, hostRest: rest, classStrRaw, classNameProp, userStyle, resolveStyle: resolveStyle2, elementKey: key, isStaticChildren },
|
|
1123
1266
|
key
|
|
1124
1267
|
);
|
|
1125
1268
|
}
|
|
1126
1269
|
const staticStates = { hover: false, focus: false, disabled: rest.disabled === true };
|
|
1127
1270
|
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);
|
|
1128
|
-
return makeElement(isStaticChildren, type, { ...rest, className:
|
|
1271
|
+
return makeElement(isStaticChildren, type, { ...rest, className: classNameProp, style: finalStyle }, key);
|
|
1129
1272
|
}
|
|
1130
1273
|
function createJsxFunctions(resolveStyle2) {
|
|
1131
1274
|
function jsx2(type, props, key) {
|
|
@@ -1142,73 +1285,6 @@ var import_react_native2 = require("react-native");
|
|
|
1142
1285
|
var import_theme2 = require("./theme");
|
|
1143
1286
|
var import_darkModeStore2 = require("./darkModeStore");
|
|
1144
1287
|
|
|
1145
|
-
// src/jsEngine/groups.ts
|
|
1146
|
-
function expandVariantGroups(input) {
|
|
1147
|
-
if (!input.includes(":(")) return input;
|
|
1148
|
-
const out = [];
|
|
1149
|
-
for (const token of splitTopLevel(input)) expandToken(token, "", false, out);
|
|
1150
|
-
return out.join(" ");
|
|
1151
|
-
}
|
|
1152
|
-
function splitTopLevel(s) {
|
|
1153
|
-
const parts = [];
|
|
1154
|
-
let depth = 0;
|
|
1155
|
-
let start = -1;
|
|
1156
|
-
for (let i = 0; i < s.length; i++) {
|
|
1157
|
-
const ch = s[i];
|
|
1158
|
-
if (ch === "(" || ch === "[") depth++;
|
|
1159
|
-
else if (ch === ")" || ch === "]") depth--;
|
|
1160
|
-
const space = /\s/.test(ch);
|
|
1161
|
-
if (space && depth <= 0) {
|
|
1162
|
-
if (start >= 0) {
|
|
1163
|
-
parts.push(s.slice(start, i));
|
|
1164
|
-
start = -1;
|
|
1165
|
-
}
|
|
1166
|
-
depth = Math.max(depth, 0);
|
|
1167
|
-
} else if (start < 0 && !space) {
|
|
1168
|
-
start = i;
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
if (start >= 0) parts.push(s.slice(start));
|
|
1172
|
-
return parts;
|
|
1173
|
-
}
|
|
1174
|
-
function groupOpen(token) {
|
|
1175
|
-
let brackets = 0;
|
|
1176
|
-
for (let i = 0; i < token.length; i++) {
|
|
1177
|
-
const ch = token[i];
|
|
1178
|
-
if (ch === "[") brackets++;
|
|
1179
|
-
else if (ch === "]") brackets--;
|
|
1180
|
-
else if (ch === "(" && brackets === 0 && i > 1 && token[i - 1] === ":") return i;
|
|
1181
|
-
}
|
|
1182
|
-
return -1;
|
|
1183
|
-
}
|
|
1184
|
-
function groupClose(token, open) {
|
|
1185
|
-
let depth = 0;
|
|
1186
|
-
for (let i = open; i < token.length; i++) {
|
|
1187
|
-
const ch = token[i];
|
|
1188
|
-
if (ch === "(" || ch === "[") depth++;
|
|
1189
|
-
else if (ch === ")" || ch === "]") {
|
|
1190
|
-
depth--;
|
|
1191
|
-
if (depth === 0) return ch === ")" ? i : -1;
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
return -1;
|
|
1195
|
-
}
|
|
1196
|
-
function pushClass(prefix, cls, important, out) {
|
|
1197
|
-
if (!cls) return;
|
|
1198
|
-
const bare = cls.split(":").pop() ?? cls;
|
|
1199
|
-
out.push(prefix + cls + (important && !cls.endsWith("!") && !bare.startsWith("!") ? "!" : ""));
|
|
1200
|
-
}
|
|
1201
|
-
function expandToken(token, prefix, important, out) {
|
|
1202
|
-
const open = groupOpen(token);
|
|
1203
|
-
if (open < 0) return pushClass(prefix, token, important, out);
|
|
1204
|
-
const close = groupClose(token, open);
|
|
1205
|
-
if (close < 0) return pushClass(prefix, token, important, out);
|
|
1206
|
-
const rest = token.slice(close + 1);
|
|
1207
|
-
if (rest !== "" && rest !== "!") return pushClass(prefix, token, important, out);
|
|
1208
|
-
const innerPrefix = prefix + token.slice(0, open);
|
|
1209
|
-
for (const part of splitTopLevel(token.slice(open + 1, close))) expandToken(part, innerPrefix, rest === "!" || important, out);
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
1288
|
// src/jsEngine/shared.ts
|
|
1213
1289
|
function decl(property, value) {
|
|
1214
1290
|
return { property, value };
|
|
@@ -2508,7 +2584,7 @@ Fix: use a plain px/rem calc, a fraction utility (e.g. w-1/2), or resolve this v
|
|
|
2508
2584
|
return { value: null, warning };
|
|
2509
2585
|
}
|
|
2510
2586
|
function resolveStyleJsWithWarnings(classString, theme, colorScheme, pressed, width) {
|
|
2511
|
-
classString = expandVariantGroups(classString);
|
|
2587
|
+
classString = expandComposeClasses(expandVariantGroups(classString), theme.compose);
|
|
2512
2588
|
const style = {};
|
|
2513
2589
|
const warnings = [];
|
|
2514
2590
|
let shadowOffset = null;
|