@kbach/react-native 1.0.0-beta.56 → 1.0.0-beta.57
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 +5 -3
- 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-APVTYFEK.mjs +623 -0
- package/dist/{chunk-YDA2XA35.mjs → chunk-PLSCNADJ.mjs} +1 -1
- package/dist/{chunk-VWGUF2NB.mjs → chunk-T6YWFA2C.mjs} +1 -1
- package/dist/index.js +210 -43
- package/dist/index.web.js +1 -1
- package/dist/index.web.mjs +2 -2
- package/dist/jsx-dev-runtime.js +924 -757
- package/dist/jsx-dev-runtime.web.js +1 -1
- package/dist/jsx-dev-runtime.web.mjs +3 -3
- package/dist/jsx-runtime.js +924 -757
- package/dist/jsx-runtime.web.js +1 -1
- package/dist/jsx-runtime.web.mjs +2 -2
- package/dist/theme.js +48 -0
- package/package.json +1 -1
- package/dist/chunk-4WQ2DOOC.mjs +0 -575
package/dist/index.js
CHANGED
|
@@ -153,6 +153,7 @@ var VALUE_PREFIXES = [
|
|
|
153
153
|
"leading-",
|
|
154
154
|
"tracking-",
|
|
155
155
|
"font-",
|
|
156
|
+
"align-",
|
|
156
157
|
"z-",
|
|
157
158
|
"inset-x-",
|
|
158
159
|
"inset-y-",
|
|
@@ -315,12 +316,20 @@ var TYPE_HINTS = /* @__PURE__ */ new Set([
|
|
|
315
316
|
"position",
|
|
316
317
|
"bg-size",
|
|
317
318
|
"family-name",
|
|
319
|
+
"generic-name",
|
|
318
320
|
"absolute-size",
|
|
319
321
|
"relative-size",
|
|
320
322
|
"angle",
|
|
321
323
|
"shadow",
|
|
322
324
|
"any"
|
|
323
325
|
]);
|
|
326
|
+
function arbitraryModifier(modifier) {
|
|
327
|
+
const bracketed = parenVarShorthand(modifier) ?? modifier;
|
|
328
|
+
if (!(bracketed.length > 2 && bracketed.startsWith("[") && bracketed.endsWith("]"))) return null;
|
|
329
|
+
const raw = bracketed.slice(1, -1);
|
|
330
|
+
if (!isSafeArbitraryValue(raw)) return null;
|
|
331
|
+
return normalizeMathWhitespace(raw.replace(/_/g, " "));
|
|
332
|
+
}
|
|
324
333
|
function splitTypeHint(raw) {
|
|
325
334
|
const i = raw.indexOf(":");
|
|
326
335
|
if (i > 0 && i < raw.length - 1 && TYPE_HINTS.has(raw.slice(0, i))) return [raw.slice(0, i), raw.slice(i + 1)];
|
|
@@ -333,28 +342,95 @@ function parenVarShorthand(value) {
|
|
|
333
342
|
if (hint !== void 0 && !TYPE_HINTS.has(hint)) return null;
|
|
334
343
|
return hint ? `[${hint}:var(--${name})]${tail}` : `[var(--${name})]${tail}`;
|
|
335
344
|
}
|
|
336
|
-
function
|
|
337
|
-
if (value.startsWith("["))
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
345
|
+
function splitBracketModifier(value) {
|
|
346
|
+
if (!value.startsWith("[")) return [value, null];
|
|
347
|
+
let depth = 0;
|
|
348
|
+
for (let i = 0; i < value.length; i++) {
|
|
349
|
+
const ch = value[i];
|
|
350
|
+
if (ch === "[") depth += 1;
|
|
351
|
+
else if (ch === "]") {
|
|
352
|
+
depth -= 1;
|
|
353
|
+
if (depth === 0) {
|
|
354
|
+
const after = value.slice(i + 1);
|
|
355
|
+
return after.startsWith("/") && after.length > 1 ? [value.slice(0, i + 1), after.slice(1)] : [value, null];
|
|
356
|
+
}
|
|
342
357
|
}
|
|
343
358
|
}
|
|
344
359
|
return [value, null];
|
|
345
360
|
}
|
|
361
|
+
function trimNumber(n) {
|
|
362
|
+
return `${Math.round(n * 1e6) / 1e6}`;
|
|
363
|
+
}
|
|
364
|
+
function parseAlpha(modifier) {
|
|
365
|
+
const raw = arbitraryModifier(modifier);
|
|
366
|
+
if (raw !== null) {
|
|
367
|
+
if (raw.endsWith("%")) {
|
|
368
|
+
const n3 = strictNumber(raw.slice(0, -1));
|
|
369
|
+
return n3 !== null && n3 >= 0 && n3 <= 100 ? { fraction: n3 / 100 } : null;
|
|
370
|
+
}
|
|
371
|
+
const n2 = strictNumber(raw);
|
|
372
|
+
if (n2 !== null) return n2 >= 0 && n2 <= 1 ? { fraction: n2 } : null;
|
|
373
|
+
return raw.startsWith("var(") || raw.startsWith("calc(") ? { raw } : null;
|
|
374
|
+
}
|
|
375
|
+
if (!/^(?:\d+\.?\d*|\.\d+)$/.test(modifier)) return null;
|
|
376
|
+
const n = Number(modifier);
|
|
377
|
+
return n <= 100 ? { fraction: n / 100 } : null;
|
|
378
|
+
}
|
|
379
|
+
function strictNumber(text) {
|
|
380
|
+
return /^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(text) ? Number(text) : null;
|
|
381
|
+
}
|
|
382
|
+
function expandThemeFunctions(raw) {
|
|
383
|
+
if (!raw.includes("--spacing(") && !raw.includes("--alpha(")) return raw;
|
|
384
|
+
let out = "";
|
|
385
|
+
let rest = raw;
|
|
386
|
+
for (; ; ) {
|
|
387
|
+
const found = ["--spacing(", "--alpha("].map((name) => ({ name, at: rest.indexOf(name) })).filter((f) => f.at !== -1).sort((a, b) => a.at - b.at)[0];
|
|
388
|
+
if (found === void 0) break;
|
|
389
|
+
const argsFrom = found.at + found.name.length;
|
|
390
|
+
let depth = 1;
|
|
391
|
+
let close = -1;
|
|
392
|
+
for (let i = argsFrom; i < rest.length; i++) {
|
|
393
|
+
if (rest[i] === "(") depth += 1;
|
|
394
|
+
else if (rest[i] === ")") {
|
|
395
|
+
depth -= 1;
|
|
396
|
+
if (depth === 0) {
|
|
397
|
+
close = i;
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (close === -1) break;
|
|
403
|
+
const arg = expandThemeFunctions(rest.slice(argsFrom, close).trim());
|
|
404
|
+
out += rest.slice(0, found.at);
|
|
405
|
+
if (found.name === "--spacing(") {
|
|
406
|
+
const n = strictNumber(arg);
|
|
407
|
+
out += n !== null ? `${trimNumber(n * 4)}px` : `calc(4px * ${arg})`;
|
|
408
|
+
} else {
|
|
409
|
+
const slash = arg.lastIndexOf("/");
|
|
410
|
+
if (slash === -1) {
|
|
411
|
+
out += arg;
|
|
412
|
+
} else {
|
|
413
|
+
const alpha = arg.slice(slash + 1).trim();
|
|
414
|
+
const n = strictNumber(alpha);
|
|
415
|
+
out += `color-mix(in srgb, ${arg.slice(0, slash).trim()} ${n !== null ? `${trimNumber(n * 100)}%` : alpha}, transparent)`;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
rest = rest.slice(close + 1);
|
|
419
|
+
}
|
|
420
|
+
return out + rest;
|
|
421
|
+
}
|
|
346
422
|
var COLOR_FUNCTIONS = ["rgb(", "rgba(", "hsl(", "hsla(", "hwb(", "lab(", "lch(", "oklab(", "oklch(", "color(", "color-mix(", "var("];
|
|
347
423
|
function looksLikeColor(value) {
|
|
348
424
|
return value.startsWith("#") || COLOR_FUNCTIONS.some((f) => value.startsWith(f)) || /^[A-Za-z]+$/.test(value);
|
|
349
425
|
}
|
|
350
|
-
function colorWithOpacity(color,
|
|
426
|
+
function colorWithOpacity(color, alpha) {
|
|
351
427
|
const m = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(color);
|
|
352
|
-
if (m) {
|
|
428
|
+
if (m && "fraction" in alpha) {
|
|
353
429
|
const h = m[1].length === 3 ? m[1].split("").map((c) => c + c).join("") : m[1];
|
|
354
430
|
const [r, g, b] = [0, 2, 4].map((i) => parseInt(h.slice(i, i + 2), 16));
|
|
355
|
-
return `rgba(${r},${g},${b},${
|
|
431
|
+
return `rgba(${r},${g},${b},${trimNumber(alpha.fraction)})`;
|
|
356
432
|
}
|
|
357
|
-
return `color-mix(in srgb, ${color} ${
|
|
433
|
+
return `color-mix(in srgb, ${color} ${"fraction" in alpha ? `${trimNumber(alpha.fraction * 100)}%` : alpha.raw}, transparent)`;
|
|
358
434
|
}
|
|
359
435
|
function splitRespectingBrackets(token) {
|
|
360
436
|
const parts = [];
|
|
@@ -393,7 +469,7 @@ function parseClass(token) {
|
|
|
393
469
|
const property = raw.slice(0, colonIdx);
|
|
394
470
|
const rawValue = raw.slice(colonIdx + 1);
|
|
395
471
|
if (property !== "" && rawValue !== "" && isSafeArbitraryValue(raw)) {
|
|
396
|
-
const value = normalizeMathWhitespace(rawValue.replace(/_/g, " "));
|
|
472
|
+
const value = normalizeMathWhitespace(expandThemeFunctions(rawValue.replace(/_/g, " ")));
|
|
397
473
|
return {
|
|
398
474
|
modifiers,
|
|
399
475
|
utility: ARBITRARY_PROPERTY_SENTINEL,
|
|
@@ -410,18 +486,26 @@ function parseClass(token) {
|
|
|
410
486
|
if (!base.startsWith(prefix)) continue;
|
|
411
487
|
const written = base.slice(prefix.length);
|
|
412
488
|
if (written === "") continue;
|
|
413
|
-
const [value,
|
|
489
|
+
const [value, tail] = splitBracketModifier(parenVarShorthand(written) ?? written);
|
|
414
490
|
if (value.length >= 2 && value.startsWith("[") && value.endsWith("]")) {
|
|
415
491
|
const raw = value.slice(1, -1);
|
|
416
492
|
if (!isSafeArbitraryValue(raw)) {
|
|
417
493
|
continue;
|
|
418
494
|
}
|
|
419
|
-
const spaced = normalizeMathWhitespace(raw.replace(/_/g, " "));
|
|
495
|
+
const spaced = normalizeMathWhitespace(expandThemeFunctions(raw.replace(/_/g, " ")));
|
|
420
496
|
let [typeHint, hinted] = splitTypeHint(spaced);
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
497
|
+
let modifier = null;
|
|
498
|
+
if (tail !== null) {
|
|
499
|
+
const isColor = typeHint === "color" || typeHint === null && looksLikeColor(hinted);
|
|
500
|
+
const alpha = isColor ? parseAlpha(tail) : null;
|
|
501
|
+
if (alpha !== null) {
|
|
502
|
+
hinted = colorWithOpacity(hinted, alpha);
|
|
503
|
+
typeHint = "color";
|
|
504
|
+
} else if (prefix === "text-") {
|
|
505
|
+
modifier = tail;
|
|
506
|
+
} else {
|
|
507
|
+
continue;
|
|
508
|
+
}
|
|
425
509
|
}
|
|
426
510
|
return {
|
|
427
511
|
modifiers,
|
|
@@ -431,14 +515,15 @@ function parseClass(token) {
|
|
|
431
515
|
isArbitrary: true,
|
|
432
516
|
important,
|
|
433
517
|
negative,
|
|
434
|
-
original: token
|
|
518
|
+
original: token,
|
|
519
|
+
modifier
|
|
435
520
|
};
|
|
436
521
|
}
|
|
437
522
|
return {
|
|
438
523
|
modifiers,
|
|
439
524
|
utility: prefix.slice(0, -1),
|
|
440
525
|
// a named value keeps its own /opacity (`bg-blue-6/50`)
|
|
441
|
-
value:
|
|
526
|
+
value: tail === null ? value : `${value}/${tail}`,
|
|
442
527
|
isArbitrary: false,
|
|
443
528
|
important,
|
|
444
529
|
negative,
|
|
@@ -512,6 +597,11 @@ function resolveNegatableSize(theme, parsed) {
|
|
|
512
597
|
}
|
|
513
598
|
return resolveNegatableLength(theme, parsed);
|
|
514
599
|
}
|
|
600
|
+
function negate(value) {
|
|
601
|
+
const numeric = (v) => /^[\d.]/.test(v);
|
|
602
|
+
if (value.startsWith("-")) return numeric(value.slice(1)) ? value.slice(1) : `calc(${value} * -1)`;
|
|
603
|
+
return numeric(value) ? `-${value}` : `calc(${value} * -1)`;
|
|
604
|
+
}
|
|
515
605
|
function resolvePercent(parsed) {
|
|
516
606
|
if (parsed.negative) return null;
|
|
517
607
|
const value = parsed.value;
|
|
@@ -737,8 +827,10 @@ function resolve(parsed, theme) {
|
|
|
737
827
|
return [decl("aspect-ratio", "16 / 9")];
|
|
738
828
|
case "auto":
|
|
739
829
|
return [decl("aspect-ratio", "auto")];
|
|
740
|
-
default:
|
|
741
|
-
|
|
830
|
+
default: {
|
|
831
|
+
const m = /^(\d+(?:\.\d*)?|\.\d+)\/(\d+(?:\.\d*)?|\.\d+)$/.exec(value);
|
|
832
|
+
return m ? [decl("aspect-ratio", `${m[1]} / ${m[2]}`)] : null;
|
|
833
|
+
}
|
|
742
834
|
}
|
|
743
835
|
}
|
|
744
836
|
default:
|
|
@@ -971,9 +1063,8 @@ function findModeAwareColor(base, theme) {
|
|
|
971
1063
|
}
|
|
972
1064
|
function applyOpacityToHex(hex, opacity) {
|
|
973
1065
|
if (opacity === null) return hex;
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
return `rgba(${rgb.join(",")},${opacity / 100})`;
|
|
1066
|
+
if (hexToRgb(hex) === null) return hex;
|
|
1067
|
+
return colorWithOpacity(hex.trim(), opacity).replace(/ /g, "_");
|
|
977
1068
|
}
|
|
978
1069
|
function substituteModeAwareColorToken(token, theme, colorScheme) {
|
|
979
1070
|
const segments = token.split(":");
|
|
@@ -993,14 +1084,10 @@ function hexToRgb(hex) {
|
|
|
993
1084
|
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
994
1085
|
}
|
|
995
1086
|
function splitOpacity(value) {
|
|
996
|
-
const slash = value.
|
|
1087
|
+
const slash = value.indexOf("/");
|
|
997
1088
|
if (slash === -1) return [value, null];
|
|
998
|
-
const
|
|
999
|
-
|
|
1000
|
-
if (opacityText !== "" && Number.isInteger(n) && n >= 0 && n <= 100) {
|
|
1001
|
-
return [value.slice(0, slash), n];
|
|
1002
|
-
}
|
|
1003
|
-
return [value, null];
|
|
1089
|
+
const alpha = parseAlpha(value.slice(slash + 1));
|
|
1090
|
+
return alpha === null ? [value, null] : [value.slice(0, slash), alpha];
|
|
1004
1091
|
}
|
|
1005
1092
|
function colorValue(theme, parsed) {
|
|
1006
1093
|
const value = parsed.value;
|
|
@@ -1009,10 +1096,7 @@ function colorValue(theme, parsed) {
|
|
|
1009
1096
|
const [name, opacity] = splitOpacity(value);
|
|
1010
1097
|
const hex = lookupHex(theme, name);
|
|
1011
1098
|
if (hex === null) return null;
|
|
1012
|
-
|
|
1013
|
-
const rgb = hexToRgb(hex);
|
|
1014
|
-
if (rgb === null) return hex;
|
|
1015
|
-
return `rgba(${rgb.join(",")},${opacity / 100})`;
|
|
1099
|
+
return opacity === null ? hex : colorWithOpacity(hex, opacity);
|
|
1016
1100
|
}
|
|
1017
1101
|
var LENGTH_UNITS = ["px", "rem", "em", "%", "vh", "vw"];
|
|
1018
1102
|
function looksLikeLength(value) {
|
|
@@ -1216,9 +1300,9 @@ function outlineValue(theme, parsed) {
|
|
|
1216
1300
|
function outlineOffsetValue(parsed) {
|
|
1217
1301
|
const value = parsed.value;
|
|
1218
1302
|
if (value === null) return null;
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
return
|
|
1303
|
+
const v = parsed.isArbitrary ? value : outlineWidthValue(value);
|
|
1304
|
+
if (v === null) return null;
|
|
1305
|
+
return [decl("outline-offset", parsed.negative ? negate(v) : v)];
|
|
1222
1306
|
}
|
|
1223
1307
|
var RADIUS_SIDES = /* @__PURE__ */ new Set(["t", "r", "b", "l", "tl", "tr", "br", "bl"]);
|
|
1224
1308
|
function resolve3(parsed, theme) {
|
|
@@ -1311,6 +1395,55 @@ function lineHeightSize(key) {
|
|
|
1311
1395
|
const n = Number(key);
|
|
1312
1396
|
return Number.isFinite(n) && n >= 0 ? `${n * 0.25}rem` : null;
|
|
1313
1397
|
}
|
|
1398
|
+
function leadingNamed(key) {
|
|
1399
|
+
switch (key) {
|
|
1400
|
+
case "none":
|
|
1401
|
+
return 1;
|
|
1402
|
+
case "tight":
|
|
1403
|
+
return 1.25;
|
|
1404
|
+
case "snug":
|
|
1405
|
+
return 1.375;
|
|
1406
|
+
case "normal":
|
|
1407
|
+
return 1.5;
|
|
1408
|
+
case "relaxed":
|
|
1409
|
+
return 1.625;
|
|
1410
|
+
case "loose":
|
|
1411
|
+
return 2;
|
|
1412
|
+
default:
|
|
1413
|
+
return null;
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
function splitSizeLeading(value) {
|
|
1417
|
+
const i = value.indexOf("/");
|
|
1418
|
+
if (i === -1) return null;
|
|
1419
|
+
const size = textSize(value.slice(0, i));
|
|
1420
|
+
const leading = value.slice(i + 1);
|
|
1421
|
+
return size === null || leading === "" ? null : [size, leading];
|
|
1422
|
+
}
|
|
1423
|
+
function sizeLeadingNative(size, leading) {
|
|
1424
|
+
const rem = (n) => {
|
|
1425
|
+
const unit = size.endsWith("rem") ? "rem" : size.endsWith("px") ? "px" : null;
|
|
1426
|
+
if (unit === null) return null;
|
|
1427
|
+
const number = size.slice(0, -unit.length);
|
|
1428
|
+
const s = Number(number);
|
|
1429
|
+
return number.trim() !== "" && Number.isFinite(s) ? `${s * n}${unit}` : null;
|
|
1430
|
+
};
|
|
1431
|
+
const arbitrary = arbitraryModifier(leading);
|
|
1432
|
+
if (arbitrary !== null) {
|
|
1433
|
+
if (arbitrary.startsWith("var(")) return null;
|
|
1434
|
+
const n = Number(arbitrary);
|
|
1435
|
+
return arbitrary.trim() !== "" && Number.isFinite(n) ? rem(n) : arbitrary;
|
|
1436
|
+
}
|
|
1437
|
+
const scale = lineHeightSize(leading);
|
|
1438
|
+
if (scale !== null) return scale;
|
|
1439
|
+
const m = leadingNamed(leading);
|
|
1440
|
+
return m === null ? null : rem(m);
|
|
1441
|
+
}
|
|
1442
|
+
function arbitraryFontIsWeight(parsed, value) {
|
|
1443
|
+
const hint = parsed.typeHint ?? null;
|
|
1444
|
+
if (hint !== null) return hint === "number" || hint === "integer";
|
|
1445
|
+
return value.trim() !== "" && Number.isFinite(Number(value)) || value.startsWith("var(") && value.endsWith(")") && !value.includes(",");
|
|
1446
|
+
}
|
|
1314
1447
|
function textAlign(key) {
|
|
1315
1448
|
switch (key) {
|
|
1316
1449
|
case "left":
|
|
@@ -1414,10 +1547,11 @@ function nativeShadowDeclarations(parsed) {
|
|
|
1414
1547
|
|
|
1415
1548
|
// src/jsEngine/resolvers/transform.ts
|
|
1416
1549
|
function scaleFactor(parsed) {
|
|
1417
|
-
if (parsed.value === null) return null;
|
|
1550
|
+
if (parsed.value === null || parsed.value.trim() === "") return null;
|
|
1418
1551
|
const n = Number(parsed.value);
|
|
1419
1552
|
if (!Number.isFinite(n)) return null;
|
|
1420
|
-
|
|
1553
|
+
const factor = parsed.isArbitrary ? n : n / 100;
|
|
1554
|
+
return parsed.negative ? -factor : factor;
|
|
1421
1555
|
}
|
|
1422
1556
|
function angle(parsed) {
|
|
1423
1557
|
if (parsed.value === null) return null;
|
|
@@ -1510,6 +1644,10 @@ function resolveTypographyNative(parsed, theme) {
|
|
|
1510
1644
|
case "font": {
|
|
1511
1645
|
if (parsed.value === null) return null;
|
|
1512
1646
|
if (parsed.isArbitrary) {
|
|
1647
|
+
if (arbitraryFontIsWeight(parsed, parsed.value)) {
|
|
1648
|
+
const n = Number(parsed.value);
|
|
1649
|
+
return /^\d+$/.test(parsed.value) && n % 100 === 0 && n >= 100 && n <= 900 ? [decl("font-weight", parsed.value)] : null;
|
|
1650
|
+
}
|
|
1513
1651
|
return [decl("font-family", firstFontName(parsed.value))];
|
|
1514
1652
|
}
|
|
1515
1653
|
const w = fontWeight(parsed.value);
|
|
@@ -1557,10 +1695,21 @@ function resolveTextNative(parsed, theme) {
|
|
|
1557
1695
|
if (!parsed.isArbitrary && parsed.value !== null) {
|
|
1558
1696
|
const size = textSize(parsed.value);
|
|
1559
1697
|
if (size !== null) return [decl("font-size", size)];
|
|
1698
|
+
const sized = splitSizeLeading(parsed.value);
|
|
1699
|
+
if (sized !== null) {
|
|
1700
|
+
const lh = sizeLeadingNative(sized[0], sized[1]);
|
|
1701
|
+
return lh === null ? null : [decl("font-size", sized[0]), decl("line-height", lh)];
|
|
1702
|
+
}
|
|
1560
1703
|
const align = textAlign(parsed.value);
|
|
1561
1704
|
if (align !== null) return [decl("text-align", align)];
|
|
1562
|
-
} else if (parsed.isArbitrary && parsed.value !== null
|
|
1563
|
-
|
|
1705
|
+
} else if (parsed.isArbitrary && parsed.value !== null) {
|
|
1706
|
+
const leading = parsed.modifier ?? null;
|
|
1707
|
+
if (isLength(parsed, parsed.value)) {
|
|
1708
|
+
if (leading === null) return [decl("font-size", parsed.value)];
|
|
1709
|
+
const lh = sizeLeadingNative(parsed.value, leading);
|
|
1710
|
+
return lh === null ? null : [decl("font-size", parsed.value), decl("line-height", lh)];
|
|
1711
|
+
}
|
|
1712
|
+
if (leading !== null) return null;
|
|
1564
1713
|
}
|
|
1565
1714
|
const hex = nativeHexColor(parsed, theme);
|
|
1566
1715
|
return hex === null ? null : [decl("color", hex)];
|
|
@@ -1751,7 +1900,7 @@ function nativeModifierState(modifier, theme, colorScheme, pressed, width) {
|
|
|
1751
1900
|
}
|
|
1752
1901
|
if (modifier.startsWith("max-[") && modifier.endsWith("]")) {
|
|
1753
1902
|
const px = reduceConstantMath(`calc(${modifier.slice(5, -1).trim()})`);
|
|
1754
|
-
return px === null ? null : width
|
|
1903
|
+
return px === null ? null : width < px;
|
|
1755
1904
|
}
|
|
1756
1905
|
const screen = (name) => Object.prototype.hasOwnProperty.call(theme.screens, name) ? theme.screens[name] : void 0;
|
|
1757
1906
|
const custom = screen(modifier);
|
|
@@ -1760,6 +1909,19 @@ function nativeModifierState(modifier, theme, colorScheme, pressed, width) {
|
|
|
1760
1909
|
const max = screen(modifier.slice(4));
|
|
1761
1910
|
if (typeof max === "number") return width < max;
|
|
1762
1911
|
}
|
|
1912
|
+
if (modifier.startsWith("min-")) {
|
|
1913
|
+
const min = screen(modifier.slice(4));
|
|
1914
|
+
if (typeof min === "number") return width >= min;
|
|
1915
|
+
}
|
|
1916
|
+
if (modifier.startsWith("not-")) {
|
|
1917
|
+
const rest = modifier.slice(4);
|
|
1918
|
+
if (rest === "dark") return colorScheme !== "dark";
|
|
1919
|
+
const isBreakpoint = (name) => typeof screen(name) === "number";
|
|
1920
|
+
if (isBreakpoint(rest) || (rest.startsWith("max-") || rest.startsWith("min-")) && isBreakpoint(rest.slice(4))) {
|
|
1921
|
+
const holds = nativeModifierState(rest, theme, colorScheme, pressed, width);
|
|
1922
|
+
return holds === null ? null : !holds;
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1763
1925
|
return null;
|
|
1764
1926
|
}
|
|
1765
1927
|
function kebabToCamel(s) {
|
|
@@ -1857,6 +2019,11 @@ function sanitizeForWarning(value) {
|
|
|
1857
2019
|
return `${escaped.slice(0, MAX_CHARS)}\u2026`;
|
|
1858
2020
|
}
|
|
1859
2021
|
function rnStyleValue(property, value) {
|
|
2022
|
+
if (value.startsWith("color-mix(in srgb, ") && value.endsWith(", transparent)")) {
|
|
2023
|
+
const inner = value.slice("color-mix(in srgb, ".length, -", transparent)".length);
|
|
2024
|
+
const space = inner.lastIndexOf(" ");
|
|
2025
|
+
if (space !== -1) return rnStyleValue(property, inner.slice(0, space));
|
|
2026
|
+
}
|
|
1860
2027
|
if (property === "aspect-ratio") {
|
|
1861
2028
|
if (value.trim() === "auto") return { value: null, warning: null };
|
|
1862
2029
|
const parts = value.split("/").map((s) => s.trim());
|