@kbach/react-native 1.1.1-beta.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 +12 -0
- package/dist/jsx-dev-runtime.js +74 -72
- package/dist/jsx-runtime.js +74 -72
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -133,6 +133,18 @@ as the Rust one by `groups.test.ts`, which reads
|
|
|
133
133
|
two engines on grouped strings, light and dark, pressed or not). Root
|
|
134
134
|
AGENTS.md §8.2 has the syntax.
|
|
135
135
|
|
|
136
|
+
The JSX runtime (`jsxRuntimeCore.ts`'s `processElement`) also expands a group
|
|
137
|
+
before it reads the class string, since its reactivity checks
|
|
138
|
+
(`DARK_MODIFIER_RE`, `BREAKPOINT_MODIFIER_RE`, `HOVER_`/`FOCUS_MODIFIER_RE`,
|
|
139
|
+
`usesModeAwareColor`) only look for a variant after a space or a `:`. The
|
|
140
|
+
`className` prop passed on to a custom component stays as written. In
|
|
141
|
+
1.1.1-beta.0, where only the engines expanded groups, a variant written first
|
|
142
|
+
inside a group was missed: `active:(dark:bg-x)` didn't re-render on a theme
|
|
143
|
+
toggle, `active:(md:p-8)` didn't re-render on a width change, and
|
|
144
|
+
`active:(hover:x)` got no hover handlers. A group with its variant outside
|
|
145
|
+
(`hover:(a b)`, `dark:(a b)`) always worked. Fixed in 1.1.1-beta.1; see the
|
|
146
|
+
"variant groups" tests in `jsx-runtime.test.ts`.
|
|
147
|
+
|
|
136
148
|
## 4. Modifiers on native
|
|
137
149
|
|
|
138
150
|
Native has no selector/cascade engine. Two groups:
|
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) {
|
|
@@ -1151,73 +1220,6 @@ var import_react_native2 = require("react-native");
|
|
|
1151
1220
|
var import_theme2 = require("./theme");
|
|
1152
1221
|
var import_darkModeStore2 = require("./darkModeStore");
|
|
1153
1222
|
|
|
1154
|
-
// src/jsEngine/groups.ts
|
|
1155
|
-
function expandVariantGroups(input) {
|
|
1156
|
-
if (!input.includes(":(")) return input;
|
|
1157
|
-
const out = [];
|
|
1158
|
-
for (const token of splitTopLevel(input)) expandToken(token, "", false, out);
|
|
1159
|
-
return out.join(" ");
|
|
1160
|
-
}
|
|
1161
|
-
function splitTopLevel(s) {
|
|
1162
|
-
const parts = [];
|
|
1163
|
-
let depth = 0;
|
|
1164
|
-
let start = -1;
|
|
1165
|
-
for (let i = 0; i < s.length; i++) {
|
|
1166
|
-
const ch = s[i];
|
|
1167
|
-
if (ch === "(" || ch === "[") depth++;
|
|
1168
|
-
else if (ch === ")" || ch === "]") depth--;
|
|
1169
|
-
const space = /\s/.test(ch);
|
|
1170
|
-
if (space && depth <= 0) {
|
|
1171
|
-
if (start >= 0) {
|
|
1172
|
-
parts.push(s.slice(start, i));
|
|
1173
|
-
start = -1;
|
|
1174
|
-
}
|
|
1175
|
-
depth = Math.max(depth, 0);
|
|
1176
|
-
} else if (start < 0 && !space) {
|
|
1177
|
-
start = i;
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
if (start >= 0) parts.push(s.slice(start));
|
|
1181
|
-
return parts;
|
|
1182
|
-
}
|
|
1183
|
-
function groupOpen(token) {
|
|
1184
|
-
let brackets = 0;
|
|
1185
|
-
for (let i = 0; i < token.length; i++) {
|
|
1186
|
-
const ch = token[i];
|
|
1187
|
-
if (ch === "[") brackets++;
|
|
1188
|
-
else if (ch === "]") brackets--;
|
|
1189
|
-
else if (ch === "(" && brackets === 0 && i > 1 && token[i - 1] === ":") return i;
|
|
1190
|
-
}
|
|
1191
|
-
return -1;
|
|
1192
|
-
}
|
|
1193
|
-
function groupClose(token, open) {
|
|
1194
|
-
let depth = 0;
|
|
1195
|
-
for (let i = open; i < token.length; i++) {
|
|
1196
|
-
const ch = token[i];
|
|
1197
|
-
if (ch === "(" || ch === "[") depth++;
|
|
1198
|
-
else if (ch === ")" || ch === "]") {
|
|
1199
|
-
depth--;
|
|
1200
|
-
if (depth === 0) return ch === ")" ? i : -1;
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
return -1;
|
|
1204
|
-
}
|
|
1205
|
-
function pushClass(prefix, cls, important, out) {
|
|
1206
|
-
if (!cls) return;
|
|
1207
|
-
const bare = cls.split(":").pop() ?? cls;
|
|
1208
|
-
out.push(prefix + cls + (important && !cls.endsWith("!") && !bare.startsWith("!") ? "!" : ""));
|
|
1209
|
-
}
|
|
1210
|
-
function expandToken(token, prefix, important, out) {
|
|
1211
|
-
const open = groupOpen(token);
|
|
1212
|
-
if (open < 0) return pushClass(prefix, token, important, out);
|
|
1213
|
-
const close = groupClose(token, open);
|
|
1214
|
-
if (close < 0) return pushClass(prefix, token, important, out);
|
|
1215
|
-
const rest = token.slice(close + 1);
|
|
1216
|
-
if (rest !== "" && rest !== "!") return pushClass(prefix, token, important, out);
|
|
1217
|
-
const innerPrefix = prefix + token.slice(0, open);
|
|
1218
|
-
for (const part of splitTopLevel(token.slice(open + 1, close))) expandToken(part, innerPrefix, rest === "!" || important, out);
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
1223
|
// src/jsEngine/shared.ts
|
|
1222
1224
|
function decl(property, value) {
|
|
1223
1225
|
return { property, value };
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -915,6 +915,73 @@ 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
|
+
|
|
918
985
|
// src/jsxRuntimeCore.ts
|
|
919
986
|
var DYNAMIC_TOKEN_MATCH_RE = /var\(--([a-zA-Z0-9-]+)\)/g;
|
|
920
987
|
function substituteDynamicTokens(classStrRaw) {
|
|
@@ -1029,6 +1096,7 @@ function ReactiveElement({
|
|
|
1029
1096
|
hostType,
|
|
1030
1097
|
hostRest,
|
|
1031
1098
|
classStrRaw,
|
|
1099
|
+
classNameProp,
|
|
1032
1100
|
userStyle,
|
|
1033
1101
|
resolveStyle: resolveStyle2,
|
|
1034
1102
|
elementKey,
|
|
@@ -1104,7 +1172,7 @@ function ReactiveElement({
|
|
|
1104
1172
|
return makeElement(
|
|
1105
1173
|
isStaticChildren,
|
|
1106
1174
|
hostType,
|
|
1107
|
-
{ ...hostRestWithLayout, className:
|
|
1175
|
+
{ ...hostRestWithLayout, className: classNameProp, style: finalStyle },
|
|
1108
1176
|
elementKey
|
|
1109
1177
|
);
|
|
1110
1178
|
}
|
|
@@ -1112,20 +1180,21 @@ function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
|
|
|
1112
1180
|
if (type === null || typeof type === "symbol" || !rawProps) {
|
|
1113
1181
|
return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
1114
1182
|
}
|
|
1115
|
-
const { className:
|
|
1116
|
-
if (typeof
|
|
1183
|
+
const { className: classNameProp, style: userStyle, ...rest } = rawProps;
|
|
1184
|
+
if (typeof classNameProp !== "string") {
|
|
1117
1185
|
return makeElement(isStaticChildren, type, rawProps, key);
|
|
1118
1186
|
}
|
|
1187
|
+
const classStrRaw = classNameProp.includes(":(") ? expandVariantGroups(classNameProp) : classNameProp;
|
|
1119
1188
|
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
1189
|
return (0, import_jsx_runtime.jsx)(
|
|
1121
1190
|
ReactiveElement,
|
|
1122
|
-
{ hostType: type, hostRest: rest, classStrRaw, userStyle, resolveStyle: resolveStyle2, elementKey: key, isStaticChildren },
|
|
1191
|
+
{ hostType: type, hostRest: rest, classStrRaw, classNameProp, userStyle, resolveStyle: resolveStyle2, elementKey: key, isStaticChildren },
|
|
1123
1192
|
key
|
|
1124
1193
|
);
|
|
1125
1194
|
}
|
|
1126
1195
|
const staticStates = { hover: false, focus: false, disabled: rest.disabled === true };
|
|
1127
1196
|
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:
|
|
1197
|
+
return makeElement(isStaticChildren, type, { ...rest, className: classNameProp, style: finalStyle }, key);
|
|
1129
1198
|
}
|
|
1130
1199
|
function createJsxFunctions(resolveStyle2) {
|
|
1131
1200
|
function jsx2(type, props, key) {
|
|
@@ -1142,73 +1211,6 @@ var import_react_native2 = require("react-native");
|
|
|
1142
1211
|
var import_theme2 = require("./theme");
|
|
1143
1212
|
var import_darkModeStore2 = require("./darkModeStore");
|
|
1144
1213
|
|
|
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
1214
|
// src/jsEngine/shared.ts
|
|
1213
1215
|
function decl(property, value) {
|
|
1214
1216
|
return { property, value };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kbach/react-native",
|
|
3
|
-
"version": "1.1.1-beta.
|
|
3
|
+
"version": "1.1.1-beta.1",
|
|
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",
|