@barocss/kit 0.4.0 → 0.5.0
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/README.md +2 -0
- package/dist/index.cjs +8330 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +46 -1
- package/dist/index.js +1332 -995
- package/dist/index.js.map +1 -1
- package/dist/theme/default.cjs +606 -0
- package/dist/theme/default.cjs.map +1 -0
- package/dist/theme/default.js +20 -15
- package/dist/theme/default.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -34,6 +34,19 @@ function property(name, initialValue, syntax, source) {
|
|
|
34
34
|
}
|
|
35
35
|
return atRule("property", name, nodes, source);
|
|
36
36
|
}
|
|
37
|
+
let debugEnabled = false;
|
|
38
|
+
function setDebug(enabled) {
|
|
39
|
+
debugEnabled = enabled;
|
|
40
|
+
}
|
|
41
|
+
function isDebug() {
|
|
42
|
+
return debugEnabled;
|
|
43
|
+
}
|
|
44
|
+
function debugLog(...args) {
|
|
45
|
+
if (debugEnabled) console.log(...args);
|
|
46
|
+
}
|
|
47
|
+
function debugWarn(...args) {
|
|
48
|
+
if (debugEnabled) console.warn(...args);
|
|
49
|
+
}
|
|
37
50
|
class AstCache {
|
|
38
51
|
constructor() {
|
|
39
52
|
this.cache = /* @__PURE__ */ new Map();
|
|
@@ -142,7 +155,7 @@ function clearAllCaches() {
|
|
|
142
155
|
parseResultCache.clear();
|
|
143
156
|
utilityCache.clear();
|
|
144
157
|
resetContextCaches?.();
|
|
145
|
-
|
|
158
|
+
debugLog("[clearAllCaches] All caches cleared");
|
|
146
159
|
}
|
|
147
160
|
class WeakCache {
|
|
148
161
|
constructor() {
|
|
@@ -223,7 +236,12 @@ function registerUtility(util, ctx) {
|
|
|
223
236
|
const state = ctx && getContextState(ctx);
|
|
224
237
|
if (ctx && !state) throw new Error("Utility registration requires a context from createContext");
|
|
225
238
|
(state?.utilities || utilityRegistry).push(util);
|
|
226
|
-
if (ctx)
|
|
239
|
+
if (ctx) {
|
|
240
|
+
clearContextCaches(ctx);
|
|
241
|
+
} else {
|
|
242
|
+
parseResultCache.clear();
|
|
243
|
+
utilityCache.clear();
|
|
244
|
+
}
|
|
227
245
|
}
|
|
228
246
|
function getUtility(ctx) {
|
|
229
247
|
return ctx && getContextState(ctx)?.utilities || utilityRegistry;
|
|
@@ -337,7 +355,7 @@ function functionalUtility(opts, ctx) {
|
|
|
337
355
|
}
|
|
338
356
|
}
|
|
339
357
|
if (opts.supportsArbitrary && parsedUtility.arbitrary) {
|
|
340
|
-
const processedValue = finalValue.replace(/_/g, " ");
|
|
358
|
+
const processedValue = normalizeMathSpacing(expandThemeFunctions(finalValue.replace(/_/g, " ")));
|
|
341
359
|
if (opts.handle) {
|
|
342
360
|
const result = opts.handle(processedValue, ctx2, token, extra);
|
|
343
361
|
if (result) return result;
|
|
@@ -395,6 +413,8 @@ function functionalUtility(opts, ctx) {
|
|
|
395
413
|
const bare = opts.handleBareValue({ value: finalValue, ctx: ctx2, token, extra });
|
|
396
414
|
if (bare == null) return [];
|
|
397
415
|
finalValue = bare;
|
|
416
|
+
} else if (!/^-?(\d|\.\d)/.test(String(finalValue))) {
|
|
417
|
+
return [];
|
|
398
418
|
}
|
|
399
419
|
if (opts.handle) {
|
|
400
420
|
const result = opts.handle(finalValue, ctx2, token, extra);
|
|
@@ -410,6 +430,62 @@ function functionalUtility(opts, ctx) {
|
|
|
410
430
|
priority: opts.priority
|
|
411
431
|
}, ctx);
|
|
412
432
|
}
|
|
433
|
+
const MATH_FNS = /* @__PURE__ */ new Set(["calc", "min", "max", "clamp"]);
|
|
434
|
+
function expandThemeFunctions(value) {
|
|
435
|
+
return value.replace(/--spacing\(\s*([^()]+?)\s*\)/g, "calc(var(--spacing) * $1)");
|
|
436
|
+
}
|
|
437
|
+
const arbitraryPropertyRegistration = {
|
|
438
|
+
name: "[arbitrary-property]",
|
|
439
|
+
match: () => false,
|
|
440
|
+
handler: (value, _ctx, token) => {
|
|
441
|
+
const prop = token.property;
|
|
442
|
+
if (!prop || !value) return [];
|
|
443
|
+
return [decl(prop, normalizeMathSpacing(expandThemeFunctions(value.replace(/_/g, " "))))];
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
function normalizeMathSpacing(value) {
|
|
447
|
+
if (!/(calc|min|max|clamp)\(/.test(value)) return value;
|
|
448
|
+
const stack = [];
|
|
449
|
+
let out = "";
|
|
450
|
+
for (let i = 0; i < value.length; i++) {
|
|
451
|
+
const ch = value[i];
|
|
452
|
+
if (ch === "(") {
|
|
453
|
+
const name = (/([a-z-]*)$/i.exec(out)?.[1] ?? "").toLowerCase();
|
|
454
|
+
const inMath2 = stack.length > 0 && stack[stack.length - 1];
|
|
455
|
+
stack.push(MATH_FNS.has(name) || name === "" && inMath2);
|
|
456
|
+
out += ch;
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
if (ch === ")") {
|
|
460
|
+
stack.pop();
|
|
461
|
+
out += ch;
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
const inMath = stack.length > 0 && stack[stack.length - 1];
|
|
465
|
+
if (!inMath) {
|
|
466
|
+
out += ch;
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
if (ch === ",") {
|
|
470
|
+
out = out.trimEnd() + ", ";
|
|
471
|
+
while (value[i + 1] === " ") i++;
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
if ("+-*/".includes(ch)) {
|
|
475
|
+
const prev = out.trimEnd();
|
|
476
|
+
const p = prev[prev.length - 1] ?? "";
|
|
477
|
+
const binary = /[\w%)]/.test(p);
|
|
478
|
+
const exponent = (ch === "+" || ch === "-") && /\de$/i.test(prev) && prev.length === out.length && /\d/.test(value[i + 1] ?? "");
|
|
479
|
+
if (binary && !exponent) {
|
|
480
|
+
out = prev + " " + ch + " ";
|
|
481
|
+
while (value[i + 1] === " ") i++;
|
|
482
|
+
continue;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
out += ch;
|
|
486
|
+
}
|
|
487
|
+
return out;
|
|
488
|
+
}
|
|
413
489
|
function tokenize(className) {
|
|
414
490
|
const tokens = [];
|
|
415
491
|
let current = "";
|
|
@@ -476,6 +552,9 @@ function parseClassName(className, ctx) {
|
|
|
476
552
|
if (className.startsWith("!")) {
|
|
477
553
|
important = true;
|
|
478
554
|
realClassName = className.slice(1);
|
|
555
|
+
} else if (className.length > 1 && className.endsWith("!")) {
|
|
556
|
+
important = true;
|
|
557
|
+
realClassName = className.slice(0, -1);
|
|
479
558
|
}
|
|
480
559
|
const tokens = tokenize(realClassName);
|
|
481
560
|
const result = parseTokens(tokens, ctx);
|
|
@@ -491,6 +570,16 @@ function parseTokens(tokens, ctx) {
|
|
|
491
570
|
if (tokens.length === 0) {
|
|
492
571
|
return { modifiers, utility: null };
|
|
493
572
|
}
|
|
573
|
+
if (tokens.length > 1) {
|
|
574
|
+
const utilityIndex = isUtilityPrefix(tokens[0].value, ctx) ? 0 : tokens.length - 1;
|
|
575
|
+
if (tokens.some((t, i) => i !== utilityIndex && !isSafeVariantToken(t.value))) {
|
|
576
|
+
return { modifiers, utility: null };
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
const utilityToken = tokens.length > 1 && !isUtilityPrefix(tokens[0].value, ctx) ? tokens[tokens.length - 1] : tokens[0];
|
|
580
|
+
if (!isStructureSafeValue(utilityToken.value)) {
|
|
581
|
+
return { modifiers, utility: null };
|
|
582
|
+
}
|
|
494
583
|
if (tokens.length === 1) {
|
|
495
584
|
utility = parseUtility(tokens[0].value, ctx);
|
|
496
585
|
} else if (tokens.length === 2) {
|
|
@@ -524,6 +613,79 @@ function parseTokens(tokens, ctx) {
|
|
|
524
613
|
}
|
|
525
614
|
return { modifiers, utility };
|
|
526
615
|
}
|
|
616
|
+
const FUNCTIONAL_VALUE_VARIANT = /^-?(?:(?:group|peer)-)?(?:has|not)-\[(.*)\](?:\/[\w-]+)?$/;
|
|
617
|
+
function isSafeVariantToken(value) {
|
|
618
|
+
if (hasCommentToken(value)) return false;
|
|
619
|
+
const m = FUNCTIONAL_VALUE_VARIANT.exec(value);
|
|
620
|
+
if (m) return isSafeVariantValue(m[1], true);
|
|
621
|
+
return isSafeVariantValue(value);
|
|
622
|
+
}
|
|
623
|
+
function hasCommentToken(value) {
|
|
624
|
+
return value.includes("/*") || value.includes("*/");
|
|
625
|
+
}
|
|
626
|
+
function isStructureSafeValue(value) {
|
|
627
|
+
if (hasCommentToken(value)) return false;
|
|
628
|
+
return isSafeVariantValue(value, true);
|
|
629
|
+
}
|
|
630
|
+
function hasUnquotedAt(value) {
|
|
631
|
+
let quote = "";
|
|
632
|
+
for (let i = 0; i < value.length; i++) {
|
|
633
|
+
const c = value[i];
|
|
634
|
+
if (c === "\\") {
|
|
635
|
+
i++;
|
|
636
|
+
continue;
|
|
637
|
+
}
|
|
638
|
+
if (quote) {
|
|
639
|
+
if (c === quote) quote = "";
|
|
640
|
+
continue;
|
|
641
|
+
}
|
|
642
|
+
if (c === '"' || c === "'") quote = c;
|
|
643
|
+
else if (c === "@") return true;
|
|
644
|
+
}
|
|
645
|
+
return false;
|
|
646
|
+
}
|
|
647
|
+
function isSafeVariantValue(value, allowTopLevelComma = false) {
|
|
648
|
+
const stack = [];
|
|
649
|
+
let quote = "";
|
|
650
|
+
let parenDepth = 0;
|
|
651
|
+
for (let i = 0; i < value.length; i++) {
|
|
652
|
+
const c = value[i];
|
|
653
|
+
if (c === "\\") {
|
|
654
|
+
i++;
|
|
655
|
+
continue;
|
|
656
|
+
}
|
|
657
|
+
if (quote) {
|
|
658
|
+
if (c === quote) quote = "";
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
switch (c) {
|
|
662
|
+
case '"':
|
|
663
|
+
case "'":
|
|
664
|
+
quote = c;
|
|
665
|
+
break;
|
|
666
|
+
case "(":
|
|
667
|
+
stack.push(")");
|
|
668
|
+
parenDepth++;
|
|
669
|
+
break;
|
|
670
|
+
case "[":
|
|
671
|
+
stack.push("]");
|
|
672
|
+
break;
|
|
673
|
+
case ")":
|
|
674
|
+
case "]":
|
|
675
|
+
if (stack.pop() !== c) return false;
|
|
676
|
+
if (c === ")") parenDepth--;
|
|
677
|
+
break;
|
|
678
|
+
case "{":
|
|
679
|
+
case "}":
|
|
680
|
+
case ";":
|
|
681
|
+
return false;
|
|
682
|
+
case ",":
|
|
683
|
+
if (parenDepth === 0 && !allowTopLevelComma) return false;
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
return stack.length === 0 && !quote;
|
|
688
|
+
}
|
|
527
689
|
function parseModifier(value) {
|
|
528
690
|
let negative = false;
|
|
529
691
|
let modStr = value;
|
|
@@ -548,6 +710,11 @@ function parseUtility(value, ctx) {
|
|
|
548
710
|
let opacity = "";
|
|
549
711
|
let category = "";
|
|
550
712
|
let priority = 0;
|
|
713
|
+
const prop = /^\[(--[a-zA-Z_][a-zA-Z0-9_-]*|-?[a-z][a-z-]*):(.+)\]$/.exec(value);
|
|
714
|
+
if (prop) {
|
|
715
|
+
if (!isStructureSafeValue(prop[2]) || hasUnquotedAt(prop[2])) return { prefix: "", value: "" };
|
|
716
|
+
return { prefix: "", value: prop[2], arbitrary: true, property: prop[1] };
|
|
717
|
+
}
|
|
551
718
|
if (value.startsWith("-")) {
|
|
552
719
|
negative = true;
|
|
553
720
|
}
|
|
@@ -603,6 +770,7 @@ function parseUtility(value, ctx) {
|
|
|
603
770
|
priority
|
|
604
771
|
};
|
|
605
772
|
}
|
|
773
|
+
const isSafeDecl = (prop, value) => isStructureSafeValue(String(prop)) && isStructureSafeValue(String(value ?? ""));
|
|
606
774
|
const importantPrefix = "!important";
|
|
607
775
|
function astToCss(ast, baseSelector, opts, _indent = "") {
|
|
608
776
|
const minify = opts?.minify;
|
|
@@ -611,7 +779,7 @@ function astToCss(ast, baseSelector, opts, _indent = "") {
|
|
|
611
779
|
const important = opts?.important ?? false;
|
|
612
780
|
const importantString = important ? ` ${importantPrefix}` : "";
|
|
613
781
|
if (!ast || ast.length === 0) {
|
|
614
|
-
|
|
782
|
+
debugWarn("[astToCss] Empty AST received:", { ast, baseSelector, minify });
|
|
615
783
|
return "";
|
|
616
784
|
}
|
|
617
785
|
const dedupedAst = [];
|
|
@@ -633,6 +801,7 @@ function astToCss(ast, baseSelector, opts, _indent = "") {
|
|
|
633
801
|
switch (node.type) {
|
|
634
802
|
case "decl": {
|
|
635
803
|
const value = node.value;
|
|
804
|
+
if (!isSafeDecl(node.prop, value)) return "";
|
|
636
805
|
if (node.prop.startsWith("--")) {
|
|
637
806
|
if (minify) {
|
|
638
807
|
const css = `${node.prop}: ${value}${importantString};`;
|
|
@@ -740,13 +909,13 @@ ${astToCss(
|
|
|
740
909
|
case "raw":
|
|
741
910
|
return `${indent}${node.value}`;
|
|
742
911
|
default:
|
|
743
|
-
|
|
912
|
+
debugWarn("[astToCss] Unknown node type:", node);
|
|
744
913
|
return "";
|
|
745
914
|
}
|
|
746
915
|
}).filter(Boolean).join(minify ? "" : "\n");
|
|
747
916
|
const finalResult = result + (minify ? "" : "\n");
|
|
748
917
|
if (!finalResult || finalResult.trim() === "") {
|
|
749
|
-
|
|
918
|
+
debugWarn("[astToCss] Empty result generated:", {
|
|
750
919
|
ast,
|
|
751
920
|
baseSelector,
|
|
752
921
|
minify,
|
|
@@ -757,26 +926,265 @@ ${astToCss(
|
|
|
757
926
|
}
|
|
758
927
|
return finalResult;
|
|
759
928
|
}
|
|
760
|
-
function rootToCss(nodes) {
|
|
929
|
+
function rootToCss(nodes, opts) {
|
|
930
|
+
const minify = opts?.minify === true;
|
|
761
931
|
const result = nodes.map((node) => {
|
|
762
932
|
const list = [];
|
|
763
933
|
if (node.type === "decl") {
|
|
764
|
-
|
|
934
|
+
if (isSafeDecl(node.prop, node.value)) {
|
|
935
|
+
list.push(minify ? `${node.prop}:${node.value};` : `${node.prop}: ${node.value};`);
|
|
936
|
+
}
|
|
765
937
|
} else if (node.type === "at-rule") {
|
|
766
|
-
|
|
767
|
-
|
|
938
|
+
if (minify) {
|
|
939
|
+
const body = node.nodes.filter((child) => child.type === "decl" && isSafeDecl(child.prop, child.value)).map((child) => child.type === "decl" ? `${child.prop}:${child.value};` : "").join("");
|
|
940
|
+
list.push(`@${node.name} ${node.params}{${body}}`);
|
|
941
|
+
} else {
|
|
942
|
+
list.push(
|
|
943
|
+
`@${node.name} ${node.params} {
|
|
768
944
|
${node.nodes.map((node2) => {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
945
|
+
if (node2.type === "decl" && isSafeDecl(node2.prop, node2.value)) {
|
|
946
|
+
return ` ${node2.prop}: ${node2.value};`;
|
|
947
|
+
}
|
|
948
|
+
}).join("\n")}
|
|
773
949
|
}`
|
|
774
|
-
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
return list.join(minify ? "" : "\n");
|
|
954
|
+
}).join(minify ? "" : "\n");
|
|
955
|
+
return result;
|
|
956
|
+
}
|
|
957
|
+
function normalizePrefix(prefix) {
|
|
958
|
+
let p = prefix.trim();
|
|
959
|
+
if (!p.startsWith("--")) p = `--${p}`;
|
|
960
|
+
if (!p.endsWith("-")) p = `${p}-`;
|
|
961
|
+
return p;
|
|
962
|
+
}
|
|
963
|
+
function escapeKey(key) {
|
|
964
|
+
return key.replace(".", "\\.");
|
|
965
|
+
}
|
|
966
|
+
function colorsToCssVars(colors) {
|
|
967
|
+
if (!colors) return {};
|
|
968
|
+
const result = {};
|
|
969
|
+
function walk(obj, prefix = []) {
|
|
970
|
+
for (const key in obj) {
|
|
971
|
+
const value = obj[key];
|
|
972
|
+
if (typeof value === "object" && value !== null) {
|
|
973
|
+
walk(value, [...prefix, key]);
|
|
974
|
+
} else {
|
|
975
|
+
const varName2 = "--color-" + [...prefix, key].join("-");
|
|
976
|
+
result[varName2] = value;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
walk(colors);
|
|
981
|
+
return result;
|
|
982
|
+
}
|
|
983
|
+
function boxShadowToCssVars(boxShadow) {
|
|
984
|
+
if (!boxShadow) return {};
|
|
985
|
+
const result = {};
|
|
986
|
+
for (const key in boxShadow) {
|
|
987
|
+
result[`--shadow-${key}`] = boxShadow[key];
|
|
988
|
+
}
|
|
989
|
+
return result;
|
|
990
|
+
}
|
|
991
|
+
function fontSizeToCssVars(fontSize) {
|
|
992
|
+
if (!fontSize) return {};
|
|
993
|
+
const result = {};
|
|
994
|
+
for (const key in fontSize) {
|
|
995
|
+
const value = fontSize[key];
|
|
996
|
+
if (Array.isArray(value)) {
|
|
997
|
+
result[`--text-${key}`] = value[0];
|
|
998
|
+
if (value[1]) result[`--text-${key}--line-height`] = value[1];
|
|
999
|
+
} else {
|
|
1000
|
+
result[`--text-${key}`] = value;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
return result;
|
|
1004
|
+
}
|
|
1005
|
+
function fontWeightToCssVars(fontWeight) {
|
|
1006
|
+
if (!fontWeight) return {};
|
|
1007
|
+
const result = {};
|
|
1008
|
+
for (const key in fontWeight) {
|
|
1009
|
+
result[`--font-weight-${key}`] = fontWeight[key];
|
|
1010
|
+
}
|
|
1011
|
+
return result;
|
|
1012
|
+
}
|
|
1013
|
+
function fontFamilyToCssVars(fontFamily) {
|
|
1014
|
+
if (!fontFamily) return {};
|
|
1015
|
+
const result = {};
|
|
1016
|
+
for (const key in fontFamily) {
|
|
1017
|
+
const value = fontFamily[key];
|
|
1018
|
+
if (Array.isArray(value)) {
|
|
1019
|
+
result[`--font-${key}`] = value.join(", ");
|
|
1020
|
+
} else {
|
|
1021
|
+
result[`--font-${key}`] = value;
|
|
775
1022
|
}
|
|
776
|
-
|
|
777
|
-
}).join("\n");
|
|
1023
|
+
}
|
|
778
1024
|
return result;
|
|
779
1025
|
}
|
|
1026
|
+
function letterSpacingToCssVars(letterSpacing) {
|
|
1027
|
+
if (!letterSpacing) return {};
|
|
1028
|
+
const result = {};
|
|
1029
|
+
for (const key in letterSpacing) {
|
|
1030
|
+
result[`--letter-spacing-${key}`] = letterSpacing[key];
|
|
1031
|
+
}
|
|
1032
|
+
return result;
|
|
1033
|
+
}
|
|
1034
|
+
function spacingToCssVars(spacing) {
|
|
1035
|
+
if (!spacing) return {};
|
|
1036
|
+
const result = {};
|
|
1037
|
+
for (const key in spacing) {
|
|
1038
|
+
result[`--spacing-${escapeKey(key)}`] = spacing[key];
|
|
1039
|
+
}
|
|
1040
|
+
return result;
|
|
1041
|
+
}
|
|
1042
|
+
function borderRadiusToCssVars(borderRadius) {
|
|
1043
|
+
if (!borderRadius) return {};
|
|
1044
|
+
const result = {};
|
|
1045
|
+
for (const key in borderRadius) {
|
|
1046
|
+
result[`--radius-${escapeKey(key)}`] = borderRadius[key];
|
|
1047
|
+
}
|
|
1048
|
+
return result;
|
|
1049
|
+
}
|
|
1050
|
+
function zIndexToCssVars(zIndex) {
|
|
1051
|
+
if (!zIndex) return {};
|
|
1052
|
+
const result = {};
|
|
1053
|
+
for (const key in zIndex) {
|
|
1054
|
+
result[`--z-${escapeKey(key)}`] = String(zIndex[key]);
|
|
1055
|
+
}
|
|
1056
|
+
return result;
|
|
1057
|
+
}
|
|
1058
|
+
function opacityToCssVars(opacity) {
|
|
1059
|
+
if (!opacity) return {};
|
|
1060
|
+
const result = {};
|
|
1061
|
+
for (const key in opacity) {
|
|
1062
|
+
result[`--opacity-${escapeKey(key)}`] = String(opacity[key]);
|
|
1063
|
+
}
|
|
1064
|
+
return result;
|
|
1065
|
+
}
|
|
1066
|
+
function animationToCssVars(animations) {
|
|
1067
|
+
if (!animations) return {};
|
|
1068
|
+
const result = {};
|
|
1069
|
+
for (const key in animations) {
|
|
1070
|
+
result[`--animate-${escapeKey(key)}`] = animations[key];
|
|
1071
|
+
}
|
|
1072
|
+
return result;
|
|
1073
|
+
}
|
|
1074
|
+
function keyframesToCss(keyframes) {
|
|
1075
|
+
if (!keyframes) return "";
|
|
1076
|
+
let css = "";
|
|
1077
|
+
for (const name in keyframes) {
|
|
1078
|
+
const frames = keyframes[name];
|
|
1079
|
+
css += `@keyframes ${name} {
|
|
1080
|
+
`;
|
|
1081
|
+
for (const step in frames) {
|
|
1082
|
+
css += ` ${step} {`;
|
|
1083
|
+
const props = frames[step];
|
|
1084
|
+
for (const prop in props) {
|
|
1085
|
+
css += ` ${prop}: ${props[prop]};`;
|
|
1086
|
+
}
|
|
1087
|
+
css += " }\n";
|
|
1088
|
+
}
|
|
1089
|
+
css += "}\n";
|
|
1090
|
+
}
|
|
1091
|
+
return css;
|
|
1092
|
+
}
|
|
1093
|
+
function transitionTimingFunctionToCssVars(transition) {
|
|
1094
|
+
const result = {};
|
|
1095
|
+
for (const key in transition) {
|
|
1096
|
+
if (key === "DEFAULT") {
|
|
1097
|
+
result[`--default-transition-timing-function`] = transition[key];
|
|
1098
|
+
} else {
|
|
1099
|
+
result[`--transition-timing-function-${escapeKey(key)}`] = transition[key];
|
|
1100
|
+
if (key !== "linear") result[`--ease-${escapeKey(key)}`] = transition[key];
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
return result;
|
|
1104
|
+
}
|
|
1105
|
+
function transitionDurationToCssVars(transitionDuration) {
|
|
1106
|
+
const result = {};
|
|
1107
|
+
for (const key in transitionDuration) {
|
|
1108
|
+
if (key === "DEFAULT") {
|
|
1109
|
+
result[`--default-transition-duration`] = transitionDuration[key];
|
|
1110
|
+
} else {
|
|
1111
|
+
result[`--transition-duration-${escapeKey(key)}`] = transitionDuration[key];
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
return result;
|
|
1115
|
+
}
|
|
1116
|
+
function transitionDelayToCssVars(transitionDelay) {
|
|
1117
|
+
const result = {};
|
|
1118
|
+
for (const key in transitionDelay) {
|
|
1119
|
+
if (key === "DEFAULT") {
|
|
1120
|
+
result[`--default-transition-delay`] = transitionDelay[key];
|
|
1121
|
+
} else {
|
|
1122
|
+
result[`--transition-delay-${escapeKey(key)}`] = transitionDelay[key];
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
return result;
|
|
1126
|
+
}
|
|
1127
|
+
function blurToCssVars(blur) {
|
|
1128
|
+
const result = {};
|
|
1129
|
+
for (const key in blur) {
|
|
1130
|
+
if (key === "DEFAULT") {
|
|
1131
|
+
result[`--default-blur`] = blur[key];
|
|
1132
|
+
} else {
|
|
1133
|
+
result[`--blur-${escapeKey(key)}`] = blur[key];
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
return result;
|
|
1137
|
+
}
|
|
1138
|
+
function containerToCssVars(container) {
|
|
1139
|
+
const result = {};
|
|
1140
|
+
for (const key in container) {
|
|
1141
|
+
result[`--container-${escapeKey(key)}`] = container[key];
|
|
1142
|
+
}
|
|
1143
|
+
return result;
|
|
1144
|
+
}
|
|
1145
|
+
function themeToCssVarsAll(theme) {
|
|
1146
|
+
return {
|
|
1147
|
+
...colorsToCssVars(theme.colors),
|
|
1148
|
+
...boxShadowToCssVars(theme.boxShadow),
|
|
1149
|
+
...fontSizeToCssVars(theme.fontSize),
|
|
1150
|
+
...fontWeightToCssVars(theme.fontWeight),
|
|
1151
|
+
...fontFamilyToCssVars(theme.fontFamily),
|
|
1152
|
+
...letterSpacingToCssVars(theme.letterSpacing),
|
|
1153
|
+
"--spacing": theme.spacing["1"],
|
|
1154
|
+
...spacingToCssVars(theme.spacing),
|
|
1155
|
+
...containerToCssVars(theme.container),
|
|
1156
|
+
...borderRadiusToCssVars(theme.borderRadius),
|
|
1157
|
+
...zIndexToCssVars(theme.zIndex),
|
|
1158
|
+
...opacityToCssVars(theme.opacity),
|
|
1159
|
+
...animationToCssVars(theme.animations),
|
|
1160
|
+
...transitionTimingFunctionToCssVars(theme.transitionTimingFunction),
|
|
1161
|
+
...transitionDurationToCssVars(theme.transitionDuration),
|
|
1162
|
+
...transitionDelayToCssVars(theme.transitionDelay),
|
|
1163
|
+
...blurToCssVars(theme.blur),
|
|
1164
|
+
...Object.fromEntries(Object.entries(theme.aspect ?? {}).map(([k, v2]) => [`--aspect-${escapeKey(k)}`, v2]))
|
|
1165
|
+
// keyframes handled separately
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
function toCssVarsBlock(vars, extra = "") {
|
|
1169
|
+
return ":root,:host {\n" + Object.entries(vars).map(([k, v2]) => ` ${k}: ${v2};`).join("\n") + "\n}\n" + extra + "\n";
|
|
1170
|
+
}
|
|
1171
|
+
const BARO_VAR = /--baro-/g;
|
|
1172
|
+
const PREFIXED_KEYS = /* @__PURE__ */ new Set(["prop", "value", "params", "selector", "nodes", "items"]);
|
|
1173
|
+
function applyVarPrefix(ast, ctx) {
|
|
1174
|
+
const configured = ctx?.config("cssVarPrefix");
|
|
1175
|
+
if (typeof configured !== "string" || !configured.trim()) return ast;
|
|
1176
|
+
const prefix = normalizePrefix(configured);
|
|
1177
|
+
if (prefix === "--baro-") return ast;
|
|
1178
|
+
const walk = (node) => {
|
|
1179
|
+
if (typeof node === "string") return node.includes("--baro-") ? node.replace(BARO_VAR, prefix) : node;
|
|
1180
|
+
if (Array.isArray(node)) return node.map(walk);
|
|
1181
|
+
if (!node || typeof node !== "object") return node;
|
|
1182
|
+
const out = {};
|
|
1183
|
+
for (const [k, val] of Object.entries(node)) out[k] = PREFIXED_KEYS.has(k) ? walk(val) : val;
|
|
1184
|
+
return out;
|
|
1185
|
+
};
|
|
1186
|
+
return walk(ast);
|
|
1187
|
+
}
|
|
780
1188
|
const failureCache = /* @__PURE__ */ new Set();
|
|
781
1189
|
function collectDeclPaths(nodes = [], path = []) {
|
|
782
1190
|
let result = [];
|
|
@@ -932,8 +1340,8 @@ function extractAtRootNodes(nodes, parent, atRootNodes = []) {
|
|
|
932
1340
|
if (node.type === "at-root") {
|
|
933
1341
|
atRootNodes.push(node);
|
|
934
1342
|
delete nodes[i];
|
|
935
|
-
} else if (node.type === "rule" || node.type === "style-rule") {
|
|
936
|
-
extractAtRootNodes(node.nodes, node, atRootNodes);
|
|
1343
|
+
} else if (node.type === "rule" || node.type === "style-rule" || node.type === "at-rule") {
|
|
1344
|
+
extractAtRootNodes(node.nodes ?? [], node, atRootNodes);
|
|
937
1345
|
}
|
|
938
1346
|
}
|
|
939
1347
|
if (parent) {
|
|
@@ -952,33 +1360,40 @@ function parseClassToAst(fullClassName, ctx) {
|
|
|
952
1360
|
}
|
|
953
1361
|
const { modifiers, utility } = parseClassName(fullClassName, ctx);
|
|
954
1362
|
if (!utility) {
|
|
955
|
-
|
|
1363
|
+
debugWarn(`[BAROCSS] Invalid class name format: "${fullClassName}"`);
|
|
956
1364
|
failures.add(fullClassName);
|
|
957
1365
|
return [];
|
|
958
1366
|
}
|
|
959
|
-
const
|
|
1367
|
+
const utilRegs = utility.property ? [arbitraryPropertyRegistration] : getUtility(ctx).filter((u) => {
|
|
960
1368
|
const fullClassName2 = utility.value ? `${utility.prefix}-${utility.value}` : utility.prefix;
|
|
961
1369
|
return u.match(fullClassName2);
|
|
962
1370
|
});
|
|
963
|
-
if (
|
|
1371
|
+
if (utilRegs.length === 0) {
|
|
964
1372
|
const utilityName = utility.value ? `${utility.prefix}-${utility.value}` : utility.prefix;
|
|
965
|
-
|
|
1373
|
+
debugWarn(`[BAROCSS] Unknown utility class: "${utilityName}" in "${fullClassName}"`);
|
|
966
1374
|
failures.add(fullClassName);
|
|
967
1375
|
return [];
|
|
968
1376
|
}
|
|
969
1377
|
let value = utility.value;
|
|
970
1378
|
if (utility.negative && value) value = "-" + value;
|
|
971
|
-
let ast =
|
|
1379
|
+
let ast = [];
|
|
1380
|
+
for (const utilReg of utilRegs) {
|
|
1381
|
+
ast = utilReg.handler(value, ctx, utility, utilReg) || [];
|
|
1382
|
+
if (ast.length > 0) break;
|
|
1383
|
+
}
|
|
972
1384
|
const wrappers = [];
|
|
973
1385
|
const selector = "&";
|
|
974
1386
|
for (let i = 0; i < modifiers.length; i++) {
|
|
975
1387
|
const variant = modifiers[i];
|
|
976
1388
|
const plugin = getModifier(ctx).find((p) => p.match(variant.type, ctx));
|
|
977
1389
|
if (!plugin) {
|
|
978
|
-
|
|
1390
|
+
debugWarn(`[BAROCSS] Unknown variant: "${variant.type}" in "${fullClassName}"`);
|
|
979
1391
|
failures.add(fullClassName);
|
|
980
1392
|
return [];
|
|
981
1393
|
}
|
|
1394
|
+
if (plugin.astHandler) {
|
|
1395
|
+
ast = plugin.astHandler(ast, variant, ctx, modifiers, i);
|
|
1396
|
+
}
|
|
982
1397
|
if (plugin.wrap) {
|
|
983
1398
|
const items = plugin.wrap(variant, ctx);
|
|
984
1399
|
wrappers.push({
|
|
@@ -1055,7 +1470,7 @@ function parseClassToAst(fullClassName, ctx) {
|
|
|
1055
1470
|
}
|
|
1056
1471
|
const atRootNodes = [];
|
|
1057
1472
|
extractAtRootNodes(ast, void 0, atRootNodes);
|
|
1058
|
-
ast = [...atRootNodes, ...ast].filter(Boolean);
|
|
1473
|
+
ast = applyVarPrefix([...atRootNodes, ...ast].filter(Boolean), ctx);
|
|
1059
1474
|
cache.set(fullClassName, ast);
|
|
1060
1475
|
return ast;
|
|
1061
1476
|
}
|
|
@@ -1096,7 +1511,7 @@ function generateCss(classList, ctx, opts) {
|
|
|
1096
1511
|
});
|
|
1097
1512
|
const result = css;
|
|
1098
1513
|
if (!result || result.trim() === "") {
|
|
1099
|
-
|
|
1514
|
+
debugWarn("[generateCss] Empty CSS generated for class:", {
|
|
1100
1515
|
class: cls,
|
|
1101
1516
|
ast: cleanAst,
|
|
1102
1517
|
hasStyleRule,
|
|
@@ -1106,17 +1521,17 @@ function generateCss(classList, ctx, opts) {
|
|
|
1106
1521
|
}
|
|
1107
1522
|
return result;
|
|
1108
1523
|
}).join(opts?.minify ? "" : "\n");
|
|
1109
|
-
const rootRules = [...new Set(allAtRootNodes.filter((node) => node.type === "at-rule").map((node) => rootToCss([node])))];
|
|
1110
|
-
const rootDeclarations = [...new Set(allAtRootNodes.filter((node) => node.type === "decl").map((node) => rootToCss([node])))];
|
|
1524
|
+
const rootRules = [...new Set(allAtRootNodes.filter((node) => node.type === "at-rule").map((node) => rootToCss([node], { minify: opts?.minify })))];
|
|
1525
|
+
const rootDeclarations = [...new Set(allAtRootNodes.filter((node) => node.type === "decl").map((node) => rootToCss([node], { minify: opts?.minify })).filter((decl2) => decl2 !== ""))];
|
|
1111
1526
|
const rootCss = [
|
|
1112
1527
|
...rootRules,
|
|
1113
|
-
...rootDeclarations.length ? [`:root,:host {${rootDeclarations.join("\n")}}`] : []
|
|
1528
|
+
...rootDeclarations.length ? [`:root,:host${opts?.minify ? "" : " "}{${rootDeclarations.join(opts?.minify ? "" : "\n")}}`] : []
|
|
1114
1529
|
].join(opts?.minify ? "" : "\n");
|
|
1115
1530
|
if (allAtRootNodes.length > 0) {
|
|
1116
|
-
|
|
1531
|
+
debugLog("[generateCss] All collected atRoot nodes:", allAtRootNodes);
|
|
1117
1532
|
}
|
|
1118
1533
|
if (!results || results.trim() === "") {
|
|
1119
|
-
|
|
1534
|
+
debugWarn("[generateCss] Empty final result:", {
|
|
1120
1535
|
classList,
|
|
1121
1536
|
results,
|
|
1122
1537
|
allAtRootNodes
|
|
@@ -1259,7 +1674,7 @@ class IncrementalParser {
|
|
|
1259
1674
|
}
|
|
1260
1675
|
const ast = parseClassToAst(className, this.ctx);
|
|
1261
1676
|
if (ast.length === 0) {
|
|
1262
|
-
|
|
1677
|
+
debugWarn("[IncrementalParser] ast is empty", className);
|
|
1263
1678
|
return null;
|
|
1264
1679
|
}
|
|
1265
1680
|
const rules = generateCssRules(className, this.ctx, { dedup: false });
|
|
@@ -1280,7 +1695,7 @@ class IncrementalParser {
|
|
|
1280
1695
|
rootCssList: rule2.rootCssList
|
|
1281
1696
|
};
|
|
1282
1697
|
} catch (error) {
|
|
1283
|
-
|
|
1698
|
+
debugWarn("[IncrementalParser] Failed to process class:", className, error);
|
|
1284
1699
|
return null;
|
|
1285
1700
|
}
|
|
1286
1701
|
}
|
|
@@ -1435,221 +1850,15 @@ class IncrementalParser {
|
|
|
1435
1850
|
}
|
|
1436
1851
|
/**
|
|
1437
1852
|
* Returns all currently processed class names
|
|
1438
|
-
*
|
|
1439
|
-
* This method is useful for debugging and monitoring purposes,
|
|
1440
|
-
* providing visibility into which classes have been processed.
|
|
1441
|
-
*
|
|
1442
|
-
* @returns Array of all processed class names
|
|
1443
|
-
*/
|
|
1444
|
-
getProcessedClasses() {
|
|
1445
|
-
return Array.from(this.processedClasses);
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
function escapeKey(key) {
|
|
1449
|
-
return key.replace(".", "\\.");
|
|
1450
|
-
}
|
|
1451
|
-
function colorsToCssVars(colors) {
|
|
1452
|
-
if (!colors) return {};
|
|
1453
|
-
const result = {};
|
|
1454
|
-
function walk(obj, prefix = []) {
|
|
1455
|
-
for (const key in obj) {
|
|
1456
|
-
const value = obj[key];
|
|
1457
|
-
if (typeof value === "object" && value !== null) {
|
|
1458
|
-
walk(value, [...prefix, key]);
|
|
1459
|
-
} else {
|
|
1460
|
-
const varName2 = "--color-" + [...prefix, key].join("-");
|
|
1461
|
-
result[varName2] = value;
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
walk(colors);
|
|
1466
|
-
return result;
|
|
1467
|
-
}
|
|
1468
|
-
function boxShadowToCssVars(boxShadow) {
|
|
1469
|
-
if (!boxShadow) return {};
|
|
1470
|
-
const result = {};
|
|
1471
|
-
for (const key in boxShadow) {
|
|
1472
|
-
result[`--shadow-${key}`] = boxShadow[key];
|
|
1473
|
-
}
|
|
1474
|
-
return result;
|
|
1475
|
-
}
|
|
1476
|
-
function fontSizeToCssVars(fontSize) {
|
|
1477
|
-
if (!fontSize) return {};
|
|
1478
|
-
const result = {};
|
|
1479
|
-
for (const key in fontSize) {
|
|
1480
|
-
const value = fontSize[key];
|
|
1481
|
-
if (Array.isArray(value)) {
|
|
1482
|
-
result[`--text-${key}`] = value[0];
|
|
1483
|
-
if (value[1]) result[`--text-${key}--line-height`] = value[1];
|
|
1484
|
-
} else {
|
|
1485
|
-
result[`--text-${key}`] = value;
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
return result;
|
|
1489
|
-
}
|
|
1490
|
-
function fontWeightToCssVars(fontWeight) {
|
|
1491
|
-
if (!fontWeight) return {};
|
|
1492
|
-
const result = {};
|
|
1493
|
-
for (const key in fontWeight) {
|
|
1494
|
-
result[`--font-weight-${key}`] = fontWeight[key];
|
|
1495
|
-
}
|
|
1496
|
-
return result;
|
|
1497
|
-
}
|
|
1498
|
-
function fontFamilyToCssVars(fontFamily) {
|
|
1499
|
-
if (!fontFamily) return {};
|
|
1500
|
-
const result = {};
|
|
1501
|
-
for (const key in fontFamily) {
|
|
1502
|
-
const value = fontFamily[key];
|
|
1503
|
-
if (Array.isArray(value)) {
|
|
1504
|
-
result[`--font-${key}`] = value.join(", ");
|
|
1505
|
-
} else {
|
|
1506
|
-
result[`--font-${key}`] = value;
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
return result;
|
|
1510
|
-
}
|
|
1511
|
-
function letterSpacingToCssVars(letterSpacing) {
|
|
1512
|
-
if (!letterSpacing) return {};
|
|
1513
|
-
const result = {};
|
|
1514
|
-
for (const key in letterSpacing) {
|
|
1515
|
-
result[`--letter-spacing-${key}`] = letterSpacing[key];
|
|
1516
|
-
}
|
|
1517
|
-
return result;
|
|
1518
|
-
}
|
|
1519
|
-
function spacingToCssVars(spacing) {
|
|
1520
|
-
if (!spacing) return {};
|
|
1521
|
-
const result = {};
|
|
1522
|
-
for (const key in spacing) {
|
|
1523
|
-
result[`--spacing-${escapeKey(key)}`] = spacing[key];
|
|
1524
|
-
}
|
|
1525
|
-
return result;
|
|
1526
|
-
}
|
|
1527
|
-
function borderRadiusToCssVars(borderRadius) {
|
|
1528
|
-
if (!borderRadius) return {};
|
|
1529
|
-
const result = {};
|
|
1530
|
-
for (const key in borderRadius) {
|
|
1531
|
-
result[`--radius-${escapeKey(key)}`] = borderRadius[key];
|
|
1532
|
-
}
|
|
1533
|
-
return result;
|
|
1534
|
-
}
|
|
1535
|
-
function zIndexToCssVars(zIndex) {
|
|
1536
|
-
if (!zIndex) return {};
|
|
1537
|
-
const result = {};
|
|
1538
|
-
for (const key in zIndex) {
|
|
1539
|
-
result[`--z-${escapeKey(key)}`] = String(zIndex[key]);
|
|
1540
|
-
}
|
|
1541
|
-
return result;
|
|
1542
|
-
}
|
|
1543
|
-
function opacityToCssVars(opacity) {
|
|
1544
|
-
if (!opacity) return {};
|
|
1545
|
-
const result = {};
|
|
1546
|
-
for (const key in opacity) {
|
|
1547
|
-
result[`--opacity-${escapeKey(key)}`] = String(opacity[key]);
|
|
1548
|
-
}
|
|
1549
|
-
return result;
|
|
1550
|
-
}
|
|
1551
|
-
function animationToCssVars(animations) {
|
|
1552
|
-
if (!animations) return {};
|
|
1553
|
-
const result = {};
|
|
1554
|
-
for (const key in animations) {
|
|
1555
|
-
result[`--animate-${escapeKey(key)}`] = animations[key];
|
|
1556
|
-
}
|
|
1557
|
-
return result;
|
|
1558
|
-
}
|
|
1559
|
-
function keyframesToCss(keyframes) {
|
|
1560
|
-
if (!keyframes) return "";
|
|
1561
|
-
let css = "";
|
|
1562
|
-
for (const name in keyframes) {
|
|
1563
|
-
const frames = keyframes[name];
|
|
1564
|
-
css += `@keyframes ${name} {
|
|
1565
|
-
`;
|
|
1566
|
-
for (const step in frames) {
|
|
1567
|
-
css += ` ${step} {`;
|
|
1568
|
-
const props = frames[step];
|
|
1569
|
-
for (const prop in props) {
|
|
1570
|
-
css += ` ${prop}: ${props[prop]};`;
|
|
1571
|
-
}
|
|
1572
|
-
css += " }\n";
|
|
1573
|
-
}
|
|
1574
|
-
css += "}\n";
|
|
1575
|
-
}
|
|
1576
|
-
return css;
|
|
1577
|
-
}
|
|
1578
|
-
function transitionTimingFunctionToCssVars(transition) {
|
|
1579
|
-
const result = {};
|
|
1580
|
-
for (const key in transition) {
|
|
1581
|
-
if (key === "DEFAULT") {
|
|
1582
|
-
result[`--default-transition-timing-function`] = transition[key];
|
|
1583
|
-
} else {
|
|
1584
|
-
result[`--transition-timing-function-${escapeKey(key)}`] = transition[key];
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
return result;
|
|
1588
|
-
}
|
|
1589
|
-
function transitionDurationToCssVars(transitionDuration) {
|
|
1590
|
-
const result = {};
|
|
1591
|
-
for (const key in transitionDuration) {
|
|
1592
|
-
if (key === "DEFAULT") {
|
|
1593
|
-
result[`--default-transition-duration`] = transitionDuration[key];
|
|
1594
|
-
} else {
|
|
1595
|
-
result[`--transition-duration-${escapeKey(key)}`] = transitionDuration[key];
|
|
1596
|
-
}
|
|
1597
|
-
}
|
|
1598
|
-
return result;
|
|
1599
|
-
}
|
|
1600
|
-
function transitionDelayToCssVars(transitionDelay) {
|
|
1601
|
-
const result = {};
|
|
1602
|
-
for (const key in transitionDelay) {
|
|
1603
|
-
if (key === "DEFAULT") {
|
|
1604
|
-
result[`--default-transition-delay`] = transitionDelay[key];
|
|
1605
|
-
} else {
|
|
1606
|
-
result[`--transition-delay-${escapeKey(key)}`] = transitionDelay[key];
|
|
1607
|
-
}
|
|
1608
|
-
}
|
|
1609
|
-
return result;
|
|
1610
|
-
}
|
|
1611
|
-
function blurToCssVars(blur) {
|
|
1612
|
-
const result = {};
|
|
1613
|
-
for (const key in blur) {
|
|
1614
|
-
if (key === "DEFAULT") {
|
|
1615
|
-
result[`--default-blur`] = blur[key];
|
|
1616
|
-
} else {
|
|
1617
|
-
result[`--blur-${escapeKey(key)}`] = blur[key];
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
|
-
return result;
|
|
1621
|
-
}
|
|
1622
|
-
function containerToCssVars(container) {
|
|
1623
|
-
const result = {};
|
|
1624
|
-
for (const key in container) {
|
|
1625
|
-
result[`--container-${escapeKey(key)}`] = container[key];
|
|
1853
|
+
*
|
|
1854
|
+
* This method is useful for debugging and monitoring purposes,
|
|
1855
|
+
* providing visibility into which classes have been processed.
|
|
1856
|
+
*
|
|
1857
|
+
* @returns Array of all processed class names
|
|
1858
|
+
*/
|
|
1859
|
+
getProcessedClasses() {
|
|
1860
|
+
return Array.from(this.processedClasses);
|
|
1626
1861
|
}
|
|
1627
|
-
return result;
|
|
1628
|
-
}
|
|
1629
|
-
function themeToCssVarsAll(theme) {
|
|
1630
|
-
return {
|
|
1631
|
-
...colorsToCssVars(theme.colors),
|
|
1632
|
-
...boxShadowToCssVars(theme.boxShadow),
|
|
1633
|
-
...fontSizeToCssVars(theme.fontSize),
|
|
1634
|
-
...fontWeightToCssVars(theme.fontWeight),
|
|
1635
|
-
...fontFamilyToCssVars(theme.fontFamily),
|
|
1636
|
-
...letterSpacingToCssVars(theme.letterSpacing),
|
|
1637
|
-
"--spacing": theme.spacing["1"],
|
|
1638
|
-
...spacingToCssVars(theme.spacing),
|
|
1639
|
-
...containerToCssVars(theme.container),
|
|
1640
|
-
...borderRadiusToCssVars(theme.borderRadius),
|
|
1641
|
-
...zIndexToCssVars(theme.zIndex),
|
|
1642
|
-
...opacityToCssVars(theme.opacity),
|
|
1643
|
-
...animationToCssVars(theme.animations),
|
|
1644
|
-
...transitionTimingFunctionToCssVars(theme.transitionTimingFunction),
|
|
1645
|
-
...transitionDurationToCssVars(theme.transitionDuration),
|
|
1646
|
-
...transitionDelayToCssVars(theme.transitionDelay),
|
|
1647
|
-
...blurToCssVars(theme.blur)
|
|
1648
|
-
// keyframes handled separately
|
|
1649
|
-
};
|
|
1650
|
-
}
|
|
1651
|
-
function toCssVarsBlock(vars, extra = "") {
|
|
1652
|
-
return ":root,:host {\n" + Object.entries(vars).map(([k, v2]) => ` ${k}: ${v2};`).join("\n") + "\n}\n" + extra + "\n";
|
|
1653
1862
|
}
|
|
1654
1863
|
const preflightMinimalCSS = `
|
|
1655
1864
|
/* BaroCSS Preflight - Minimal Reset */
|
|
@@ -1781,6 +1990,10 @@ select {
|
|
|
1781
1990
|
html {
|
|
1782
1991
|
line-height: 1.15;
|
|
1783
1992
|
-webkit-text-size-adjust: 100%;
|
|
1993
|
+
/* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
|
|
1994
|
+
font-family: var(--default-font-family, var(--font-sans, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'));
|
|
1995
|
+
font-feature-settings: var(--default-font-feature-settings, normal);
|
|
1996
|
+
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
1784
1997
|
}
|
|
1785
1998
|
|
|
1786
1999
|
/* Remove the gray background on active links in IE 10 */
|
|
@@ -1946,6 +2159,60 @@ textarea {
|
|
|
1946
2159
|
[type="search"]::-webkit-search-decoration {
|
|
1947
2160
|
-webkit-appearance: none;
|
|
1948
2161
|
}
|
|
2162
|
+
|
|
2163
|
+
/* Tailwind 4.1.13 monospace stack for code-like elements */
|
|
2164
|
+
code,
|
|
2165
|
+
kbd,
|
|
2166
|
+
samp,
|
|
2167
|
+
pre {
|
|
2168
|
+
font-family: var(--default-mono-font-family, var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace));
|
|
2169
|
+
font-feature-settings: var(--default-mono-font-feature-settings, normal);
|
|
2170
|
+
font-variation-settings: var(--default-mono-font-variation-settings, normal);
|
|
2171
|
+
font-size: 1em;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
/* Tailwind 4.1.13 form-control reset: inherit typography and colour, drop native radius/background (#228) */
|
|
2175
|
+
button,
|
|
2176
|
+
input,
|
|
2177
|
+
select,
|
|
2178
|
+
optgroup,
|
|
2179
|
+
textarea,
|
|
2180
|
+
::file-selector-button {
|
|
2181
|
+
font: inherit;
|
|
2182
|
+
font-feature-settings: inherit;
|
|
2183
|
+
font-variation-settings: inherit;
|
|
2184
|
+
letter-spacing: inherit;
|
|
2185
|
+
color: inherit;
|
|
2186
|
+
border-radius: 0;
|
|
2187
|
+
background-color: transparent;
|
|
2188
|
+
opacity: 1;
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
:where(select:is([multiple], [size])) optgroup {
|
|
2192
|
+
font-weight: bolder;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
:where(select:is([multiple], [size])) optgroup option {
|
|
2196
|
+
padding-inline-start: 20px;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
::file-selector-button {
|
|
2200
|
+
margin-inline-end: 4px;
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
::placeholder {
|
|
2204
|
+
opacity: 1;
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
|
|
2208
|
+
::placeholder {
|
|
2209
|
+
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
textarea {
|
|
2214
|
+
resize: vertical;
|
|
2215
|
+
}
|
|
1949
2216
|
`;
|
|
1950
2217
|
const preflightFullCSS = `
|
|
1951
2218
|
/* BaroCSS Preflight - Full Reset */
|
|
@@ -1958,10 +2225,14 @@ const preflightFullCSS = `
|
|
|
1958
2225
|
box-sizing: border-box;
|
|
1959
2226
|
}
|
|
1960
2227
|
|
|
1961
|
-
/* Remove default margin and padding
|
|
2228
|
+
/* Remove default margin and padding; reset border to Tailwind v4's universal
|
|
2229
|
+
\`border: 0 solid\` so a bare border/border-t (width set by the utility, style
|
|
2230
|
+
otherwise \`none\`) renders. Width 0 keeps borders invisible until a utility
|
|
2231
|
+
sets one. */
|
|
1962
2232
|
* {
|
|
1963
2233
|
margin: 0;
|
|
1964
2234
|
padding: 0;
|
|
2235
|
+
border: 0 solid;
|
|
1965
2236
|
}
|
|
1966
2237
|
|
|
1967
2238
|
/* Set core body defaults */
|
|
@@ -2022,6 +2293,10 @@ html {
|
|
|
2022
2293
|
line-height: 1.15;
|
|
2023
2294
|
-webkit-text-size-adjust: 100%;
|
|
2024
2295
|
-ms-text-size-adjust: 100%;
|
|
2296
|
+
/* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
|
|
2297
|
+
font-family: var(--default-font-family, var(--font-sans, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'));
|
|
2298
|
+
font-feature-settings: var(--default-font-feature-settings, normal);
|
|
2299
|
+
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
2025
2300
|
}
|
|
2026
2301
|
|
|
2027
2302
|
/* Remove the gray background on active links in IE 10 */
|
|
@@ -2207,7 +2482,9 @@ code,
|
|
|
2207
2482
|
kbd,
|
|
2208
2483
|
pre,
|
|
2209
2484
|
samp {
|
|
2210
|
-
font-family: monospace, monospace;
|
|
2485
|
+
font-family: var(--default-mono-font-family, var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace));
|
|
2486
|
+
font-feature-settings: var(--default-mono-font-feature-settings, normal);
|
|
2487
|
+
font-variation-settings: var(--default-mono-font-variation-settings, normal);
|
|
2211
2488
|
font-size: 1em;
|
|
2212
2489
|
}
|
|
2213
2490
|
|
|
@@ -2309,6 +2586,49 @@ template {
|
|
|
2309
2586
|
page-break-after: avoid;
|
|
2310
2587
|
}
|
|
2311
2588
|
}
|
|
2589
|
+
|
|
2590
|
+
/* Tailwind 4.1.13 form-control reset: inherit typography and colour, drop native radius/background (#228) */
|
|
2591
|
+
button,
|
|
2592
|
+
input,
|
|
2593
|
+
select,
|
|
2594
|
+
optgroup,
|
|
2595
|
+
textarea,
|
|
2596
|
+
::file-selector-button {
|
|
2597
|
+
font: inherit;
|
|
2598
|
+
font-feature-settings: inherit;
|
|
2599
|
+
font-variation-settings: inherit;
|
|
2600
|
+
letter-spacing: inherit;
|
|
2601
|
+
color: inherit;
|
|
2602
|
+
border-radius: 0;
|
|
2603
|
+
background-color: transparent;
|
|
2604
|
+
opacity: 1;
|
|
2605
|
+
}
|
|
2606
|
+
|
|
2607
|
+
:where(select:is([multiple], [size])) optgroup {
|
|
2608
|
+
font-weight: bolder;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
:where(select:is([multiple], [size])) optgroup option {
|
|
2612
|
+
padding-inline-start: 20px;
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
::file-selector-button {
|
|
2616
|
+
margin-inline-end: 4px;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
::placeholder {
|
|
2620
|
+
opacity: 1;
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
|
|
2624
|
+
::placeholder {
|
|
2625
|
+
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
textarea {
|
|
2630
|
+
resize: vertical;
|
|
2631
|
+
}
|
|
2312
2632
|
`;
|
|
2313
2633
|
function getPreflightCSS(level = true) {
|
|
2314
2634
|
if (level === "minimal") {
|
|
@@ -2433,6 +2753,7 @@ ${keyframesToCss(theme.keyframes || {})}
|
|
|
2433
2753
|
return result;
|
|
2434
2754
|
}
|
|
2435
2755
|
function createContext(configObj) {
|
|
2756
|
+
if (configObj.debug !== void 0) setDebug(!!configObj.debug);
|
|
2436
2757
|
const configWithDefaults = {
|
|
2437
2758
|
presets: [
|
|
2438
2759
|
{ theme: defaultTheme },
|
|
@@ -2485,6 +2806,10 @@ function createContext(configObj) {
|
|
|
2485
2806
|
return ctx;
|
|
2486
2807
|
}
|
|
2487
2808
|
function jsonToAst(input, ctx) {
|
|
2809
|
+
const unsafeVariant = (input.variants || []).some(
|
|
2810
|
+
(v) => typeof v === "string" ? !isSafeVariantToken(v) : !isSafeVariantValue(v.name || "") || !isSafeVariantValue(v.value || "") || hasCommentToken(v.name || "") || hasCommentToken(v.value || "")
|
|
2811
|
+
);
|
|
2812
|
+
if (unsafeVariant) return [];
|
|
2488
2813
|
let utilReg = getUtility(ctx).find((u) => u.name === input.utility.name);
|
|
2489
2814
|
if (input.utility.value && !input.utility.arbitrary && !input.utility.customProperty) {
|
|
2490
2815
|
const fullName = `${input.utility.name}-${input.utility.value}`;
|
|
@@ -2494,7 +2819,7 @@ function jsonToAst(input, ctx) {
|
|
|
2494
2819
|
}
|
|
2495
2820
|
}
|
|
2496
2821
|
if (!utilReg) {
|
|
2497
|
-
|
|
2822
|
+
debugWarn(`[jsonToAst] Unknown utility: "${input.utility.name}"`);
|
|
2498
2823
|
return [];
|
|
2499
2824
|
}
|
|
2500
2825
|
const parsedUtility = {
|
|
@@ -2541,9 +2866,12 @@ function jsonToAst(input, ctx) {
|
|
|
2541
2866
|
}
|
|
2542
2867
|
const plugin = getModifier(ctx).find((p) => p.match(matchKey, ctx));
|
|
2543
2868
|
if (!plugin) {
|
|
2544
|
-
|
|
2869
|
+
debugWarn(`[jsonToAst] Unknown variant: "${matchKey}"`);
|
|
2545
2870
|
continue;
|
|
2546
2871
|
}
|
|
2872
|
+
if (plugin.astHandler) {
|
|
2873
|
+
ast = plugin.astHandler(ast, parsedModifier, ctx, [], i);
|
|
2874
|
+
}
|
|
2547
2875
|
if (plugin.modifySelector) {
|
|
2548
2876
|
const result = plugin.modifySelector({
|
|
2549
2877
|
selector,
|
|
@@ -2620,7 +2948,7 @@ function jsonToAst(input, ctx) {
|
|
|
2620
2948
|
}
|
|
2621
2949
|
}
|
|
2622
2950
|
}
|
|
2623
|
-
return ast;
|
|
2951
|
+
return applyVarPrefix(ast, ctx);
|
|
2624
2952
|
}
|
|
2625
2953
|
function generateCssFromJson(inputs, ctx, opts) {
|
|
2626
2954
|
const allAtRootNodes = [];
|
|
@@ -2884,6 +3212,30 @@ function parseColor(input) {
|
|
|
2884
3212
|
}
|
|
2885
3213
|
return null;
|
|
2886
3214
|
}
|
|
3215
|
+
const COLOR_KEYWORDS = /* @__PURE__ */ new Set(["inherit", "currentcolor", "transparent"]);
|
|
3216
|
+
function themeColorDecls(prop, value, extra) {
|
|
3217
|
+
const key = String(extra.realThemeValue);
|
|
3218
|
+
const ref = COLOR_KEYWORDS.has(value.toLowerCase()) || value.startsWith("var(") || !/^[\w-]+$/.test(key) ? value : `var(--color-${key})`;
|
|
3219
|
+
if (!extra.opacity) return [decl(prop, ref)];
|
|
3220
|
+
const alpha = normalizeAlpha(String(extra.opacity));
|
|
3221
|
+
const supports = (amount) => atRule("supports", "(color:color-mix(in lab, red, red))", [decl(prop, `color-mix(in oklab, ${ref} ${amount}, transparent)`)]);
|
|
3222
|
+
if (alpha.isVar) return [decl(prop, value), supports(alpha.amount)];
|
|
3223
|
+
return [decl(prop, `color-mix(in srgb, ${value} ${alpha.amount}, transparent)`), supports(alpha.amount)];
|
|
3224
|
+
}
|
|
3225
|
+
function normalizeAlpha(raw2) {
|
|
3226
|
+
let v = raw2.trim();
|
|
3227
|
+
const bracketed = v.startsWith("[") && v.endsWith("]");
|
|
3228
|
+
if (bracketed) v = v.slice(1, -1).trim();
|
|
3229
|
+
if (v.startsWith("(") && v.endsWith(")")) v = `var(${v.slice(1, -1).trim()})`;
|
|
3230
|
+
if (v.startsWith("var(")) return { amount: v, isVar: true };
|
|
3231
|
+
if (v.endsWith("%")) return { amount: v, isVar: false };
|
|
3232
|
+
const n = Number(v);
|
|
3233
|
+
if (v !== "" && Number.isFinite(n)) {
|
|
3234
|
+
const pct = bracketed && n <= 1 ? n * 100 : n;
|
|
3235
|
+
return { amount: `${+pct.toFixed(4)}%`, isVar: false };
|
|
3236
|
+
}
|
|
3237
|
+
return { amount: v, isVar: false };
|
|
3238
|
+
}
|
|
2887
3239
|
staticUtility("accent-inherit", [["accent-color", "inherit"]], { category: "interactivity" });
|
|
2888
3240
|
staticUtility("accent-current", [["accent-color", "currentColor"]], { category: "interactivity" });
|
|
2889
3241
|
staticUtility("accent-transparent", [["accent-color", "transparent"]], { category: "interactivity" });
|
|
@@ -3086,10 +3438,10 @@ staticUtility("touch-pan-up", [["touch-action", "pan-up"]], { category: "interac
|
|
|
3086
3438
|
staticUtility("touch-pan-down", [["touch-action", "pan-down"]], { category: "interactivity" });
|
|
3087
3439
|
staticUtility("touch-pinch-zoom", [["touch-action", "pinch-zoom"]], { category: "interactivity" });
|
|
3088
3440
|
staticUtility("touch-manipulation", [["touch-action", "manipulation"]], { category: "interactivity" });
|
|
3089
|
-
staticUtility("select-none", [["user-select", "none"]], { category: "interactivity" });
|
|
3090
|
-
staticUtility("select-text", [["user-select", "text"]], { category: "interactivity" });
|
|
3091
|
-
staticUtility("select-all", [["user-select", "all"]], { category: "interactivity" });
|
|
3092
|
-
staticUtility("select-auto", [["user-select", "auto"]], { category: "interactivity" });
|
|
3441
|
+
staticUtility("select-none", [["-webkit-user-select", "none"], ["user-select", "none"]], { category: "interactivity" });
|
|
3442
|
+
staticUtility("select-text", [["-webkit-user-select", "text"], ["user-select", "text"]], { category: "interactivity" });
|
|
3443
|
+
staticUtility("select-all", [["-webkit-user-select", "all"], ["user-select", "all"]], { category: "interactivity" });
|
|
3444
|
+
staticUtility("select-auto", [["-webkit-user-select", "auto"], ["user-select", "auto"]], { category: "interactivity" });
|
|
3093
3445
|
staticUtility("will-change-auto", [["will-change", "auto"]], { category: "interactivity" });
|
|
3094
3446
|
staticUtility("will-change-scroll", [["will-change", "scroll-position"]], { category: "interactivity" });
|
|
3095
3447
|
staticUtility("will-change-contents", [["will-change", "contents"]], { category: "interactivity" });
|
|
@@ -3107,7 +3459,7 @@ const defaultDuration = "var(--default-transition-duration)";
|
|
|
3107
3459
|
staticUtility("transition", [
|
|
3108
3460
|
[
|
|
3109
3461
|
"transition-property",
|
|
3110
|
-
"color, background-color, border-color, text-decoration-color, fill, stroke, --baro-gradient-from, --baro-gradient-via, --baro-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter"
|
|
3462
|
+
"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --baro-gradient-from, --baro-gradient-via, --baro-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events"
|
|
3111
3463
|
],
|
|
3112
3464
|
["transition-timing-function", defaultTiming],
|
|
3113
3465
|
["transition-duration", defaultDuration]
|
|
@@ -3120,7 +3472,7 @@ staticUtility("transition-all", [
|
|
|
3120
3472
|
staticUtility("transition-colors", [
|
|
3121
3473
|
[
|
|
3122
3474
|
"transition-property",
|
|
3123
|
-
"color, background-color, border-color, text-decoration-color, fill, stroke, --baro-gradient-from, --baro-gradient-via, --baro-gradient-to"
|
|
3475
|
+
"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --baro-gradient-from, --baro-gradient-via, --baro-gradient-to"
|
|
3124
3476
|
],
|
|
3125
3477
|
["transition-timing-function", defaultTiming],
|
|
3126
3478
|
["transition-duration", defaultDuration]
|
|
@@ -3310,6 +3662,7 @@ const filters$1 = () => {
|
|
|
3310
3662
|
filters$1()
|
|
3311
3663
|
], { category: "effects" });
|
|
3312
3664
|
});
|
|
3665
|
+
staticUtility("blur", [decl("--baro-blur", "blur(8px)"), filters$1()], { category: "effects" });
|
|
3313
3666
|
staticUtility("blur-none", [decl("--baro-blur", ""), filters$1()], { category: "effects" });
|
|
3314
3667
|
functionalUtility({
|
|
3315
3668
|
name: "blur",
|
|
@@ -3548,6 +3901,7 @@ functionalUtility({
|
|
|
3548
3901
|
{ category: "effects" }
|
|
3549
3902
|
);
|
|
3550
3903
|
});
|
|
3904
|
+
staticUtility("backdrop-blur", [decl("--baro-backdrop-blur", "blur(8px)"), ...filters()], { category: "effects" });
|
|
3551
3905
|
staticUtility(
|
|
3552
3906
|
"backdrop-blur-none",
|
|
3553
3907
|
[decl("--baro-backdrop-blur", ""), ...filters()],
|
|
@@ -3776,56 +4130,52 @@ functionalUtility({
|
|
|
3776
4130
|
description: "sepia filter utility (static, number, arbitrary, custom property supported)",
|
|
3777
4131
|
category: "effects"
|
|
3778
4132
|
});
|
|
4133
|
+
const SHADOW_COMPOSITE = "var(--baro-inset-shadow), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow), var(--baro-ring-shadow), var(--baro-shadow)";
|
|
4134
|
+
const ringShadowProperties = () => atRoot([
|
|
4135
|
+
property("--baro-shadow", "0 0 #0000"),
|
|
4136
|
+
property("--baro-inset-shadow", "0 0 #0000"),
|
|
4137
|
+
property("--baro-inset-ring-shadow", "0 0 #0000"),
|
|
4138
|
+
property("--baro-ring-offset-shadow", "0 0 #0000"),
|
|
4139
|
+
property("--baro-ring-shadow", "0 0 #0000"),
|
|
4140
|
+
property("--baro-ring-offset-width", "0px", "<length>"),
|
|
4141
|
+
property("--baro-ring-offset-color", "#fff")
|
|
4142
|
+
]);
|
|
4143
|
+
const shadowLayer = (value) => [
|
|
4144
|
+
ringShadowProperties(),
|
|
4145
|
+
decl("--baro-shadow", value),
|
|
4146
|
+
decl("box-shadow", SHADOW_COMPOSITE)
|
|
4147
|
+
];
|
|
3779
4148
|
[
|
|
3780
4149
|
["shadow-2xs", "var(--shadow-2xs)"],
|
|
3781
4150
|
["shadow-xs", "var(--shadow-xs)"],
|
|
3782
4151
|
["shadow-sm", "var(--shadow-sm)"],
|
|
3783
|
-
["shadow", "
|
|
4152
|
+
["shadow", "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)"],
|
|
3784
4153
|
["shadow-md", "var(--shadow-md)"],
|
|
3785
4154
|
["shadow-lg", "var(--shadow-lg)"],
|
|
3786
4155
|
["shadow-xl", "var(--shadow-xl)"],
|
|
3787
4156
|
["shadow-2xl", "var(--shadow-2xl)"],
|
|
3788
4157
|
["shadow-none", "0 0 #0000"]
|
|
3789
4158
|
].forEach(([name, value]) => {
|
|
3790
|
-
staticUtility(name, [
|
|
4159
|
+
staticUtility(name, [
|
|
4160
|
+
ringShadowProperties,
|
|
4161
|
+
["--baro-shadow", value],
|
|
4162
|
+
["box-shadow", SHADOW_COMPOSITE]
|
|
4163
|
+
], { category: "effects" });
|
|
3791
4164
|
});
|
|
3792
4165
|
[
|
|
3793
|
-
[
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
],
|
|
3797
|
-
[
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
],
|
|
3801
|
-
[
|
|
3802
|
-
"inset-shadow-sm",
|
|
3803
|
-
"inset 0 2px 4px var(--baro-inset-shadow-color, #0000000d)"
|
|
3804
|
-
],
|
|
3805
|
-
[
|
|
3806
|
-
"inset-shadow-md",
|
|
3807
|
-
"inset 0 4px 6px -1px var(--baro-inset-shadow-color, #0000000d)"
|
|
3808
|
-
],
|
|
3809
|
-
[
|
|
3810
|
-
"inset-shadow-lg",
|
|
3811
|
-
"inset 0 10px 15px -3px var(--baro-inset-shadow-color, #0000000d)"
|
|
3812
|
-
],
|
|
3813
|
-
[
|
|
3814
|
-
"inset-shadow-xl",
|
|
3815
|
-
"inset 0 20px 25px -5px var(--baro-inset-shadow-color, #0000000d)"
|
|
3816
|
-
],
|
|
3817
|
-
[
|
|
3818
|
-
"inset-shadow-2xl",
|
|
3819
|
-
"inset 0 25px 50px -12px var(--baro-inset-shadow-color, #0000000d)"
|
|
3820
|
-
],
|
|
4166
|
+
["inset-shadow-2xs", "inset 0 1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4167
|
+
["inset-shadow-xs", "inset 0 1px 1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4168
|
+
["inset-shadow-sm", "inset 0 2px 4px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4169
|
+
["inset-shadow-md", "inset 0 4px 6px -1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4170
|
+
["inset-shadow-lg", "inset 0 10px 15px -3px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4171
|
+
["inset-shadow-xl", "inset 0 20px 25px -5px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4172
|
+
["inset-shadow-2xl", "inset 0 25px 50px -12px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
3821
4173
|
["inset-shadow-none", "0 0 #0000"]
|
|
3822
4174
|
].forEach(([name, value]) => {
|
|
3823
4175
|
staticUtility(name, [
|
|
4176
|
+
ringShadowProperties,
|
|
3824
4177
|
["--baro-inset-shadow", value],
|
|
3825
|
-
[
|
|
3826
|
-
"box-shadow",
|
|
3827
|
-
"var(--baro-inset-shadow), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow), var(--baro-ring-shadow), var(--baro-shadow)"
|
|
3828
|
-
]
|
|
4178
|
+
["box-shadow", SHADOW_COMPOSITE]
|
|
3829
4179
|
], { category: "effects" });
|
|
3830
4180
|
});
|
|
3831
4181
|
function createShadowThemeColor(key, main, opacity, realThemeValue) {
|
|
@@ -3890,9 +4240,9 @@ functionalUtility({
|
|
|
3890
4240
|
)
|
|
3891
4241
|
];
|
|
3892
4242
|
}
|
|
3893
|
-
return [decl("
|
|
4243
|
+
return [decl("--baro-shadow-color", main)];
|
|
3894
4244
|
}
|
|
3895
|
-
return
|
|
4245
|
+
return shadowLayer(main);
|
|
3896
4246
|
}
|
|
3897
4247
|
if (main === "inherit" || main === "current" || main === "transparent") {
|
|
3898
4248
|
return [
|
|
@@ -3901,7 +4251,7 @@ functionalUtility({
|
|
|
3901
4251
|
}
|
|
3902
4252
|
return null;
|
|
3903
4253
|
},
|
|
3904
|
-
handleCustomProperty: (value) =>
|
|
4254
|
+
handleCustomProperty: (value) => shadowLayer(`var(${value})`)
|
|
3905
4255
|
});
|
|
3906
4256
|
functionalUtility({
|
|
3907
4257
|
name: "inset-shadow",
|
|
@@ -3960,22 +4310,39 @@ functionalUtility({
|
|
|
3960
4310
|
["ring-8", "8px"]
|
|
3961
4311
|
].forEach(([name, px]) => {
|
|
3962
4312
|
staticUtility(name, [
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
// default blue-500/50
|
|
4313
|
+
ringShadowProperties,
|
|
4314
|
+
// Like Tailwind, ring-N does not set the offset vars (they come from @property defaults and ring-offset-*),
|
|
4315
|
+
// so `ring-N ring-offset-M` composes the same in either rule order.
|
|
4316
|
+
// No hardcoded ring color: Tailwind v4's default ring color is currentColor (via the var() fallback below).
|
|
3968
4317
|
[
|
|
3969
4318
|
"--baro-ring-shadow",
|
|
3970
|
-
|
|
4319
|
+
ringShadowValue(px)
|
|
3971
4320
|
],
|
|
3972
|
-
["--baro-ring-offset-shadow", `0 0 #0000`],
|
|
3973
4321
|
[
|
|
3974
4322
|
"box-shadow",
|
|
3975
4323
|
"var(--baro-inset-shadow), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow), var(--baro-ring-shadow), var(--baro-shadow)"
|
|
3976
4324
|
]
|
|
3977
4325
|
]);
|
|
3978
4326
|
});
|
|
4327
|
+
function ringShadowValue(width) {
|
|
4328
|
+
return `var(--baro-ring-inset,) 0 0 0 calc(${width} + var(--baro-ring-offset-width)) var(--baro-ring-color, currentcolor)`;
|
|
4329
|
+
}
|
|
4330
|
+
[
|
|
4331
|
+
["ring-offset-0", "0px"],
|
|
4332
|
+
["ring-offset-1", "1px"],
|
|
4333
|
+
["ring-offset-2", "2px"],
|
|
4334
|
+
["ring-offset-4", "4px"],
|
|
4335
|
+
["ring-offset-8", "8px"]
|
|
4336
|
+
].forEach(([name, px]) => {
|
|
4337
|
+
staticUtility(name, [
|
|
4338
|
+
["--baro-ring-offset-width", px],
|
|
4339
|
+
["--baro-ring-offset-color", "#fff"],
|
|
4340
|
+
[
|
|
4341
|
+
"--baro-ring-offset-shadow",
|
|
4342
|
+
`var(--baro-ring-inset,) 0 0 0 var(--baro-ring-offset-width) var(--baro-ring-offset-color)`
|
|
4343
|
+
]
|
|
4344
|
+
], { category: "effects" });
|
|
4345
|
+
});
|
|
3979
4346
|
[
|
|
3980
4347
|
["inset-ring", "1px"],
|
|
3981
4348
|
["inset-ring-0", "0px"],
|
|
@@ -3985,20 +4352,11 @@ functionalUtility({
|
|
|
3985
4352
|
["inset-ring-8", "8px"]
|
|
3986
4353
|
].forEach(([name, px]) => {
|
|
3987
4354
|
staticUtility(name, [
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
["--baro-ring-
|
|
3991
|
-
["
|
|
3992
|
-
|
|
3993
|
-
"--baro-inset-ring-shadow",
|
|
3994
|
-
`var(--baro-ring-inset) 0 0 0 calc(${px} + var(--baro-ring-offset-width)) var(--baro-inset-ring-color, currentcolor)`
|
|
3995
|
-
],
|
|
3996
|
-
["--baro-ring-offset-shadow", `0 0 #0000`],
|
|
3997
|
-
[
|
|
3998
|
-
"box-shadow",
|
|
3999
|
-
"var(--baro-inset-shadow, 0 0 #0000), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow, 0 0 #0000), var(--baro-ring-shadow, 0 0 #0000), var(--baro-shadow, 0 0 #0000)"
|
|
4000
|
-
]
|
|
4001
|
-
]);
|
|
4355
|
+
// Tailwind 4.1.13: only the inset-ring layer; the colour defaults to currentcolor via the var() fallback.
|
|
4356
|
+
ringShadowProperties,
|
|
4357
|
+
["--baro-inset-ring-shadow", `inset 0 0 0 ${px} var(--baro-inset-ring-color, currentcolor)`],
|
|
4358
|
+
["box-shadow", SHADOW_COMPOSITE]
|
|
4359
|
+
], { category: "effects" });
|
|
4002
4360
|
});
|
|
4003
4361
|
staticUtility("ring-inset", [["--baro-ring-inset", "inset"]], { category: "effects" });
|
|
4004
4362
|
function createRingColorDecls(key, main, opacity, realThemeValue) {
|
|
@@ -4072,7 +4430,15 @@ functionalUtility({
|
|
|
4072
4430
|
decl("--baro-ring-color", fallback)
|
|
4073
4431
|
];
|
|
4074
4432
|
}
|
|
4075
|
-
|
|
4433
|
+
if (!parseColor(main) && /^(-?(\d+\.?\d*|\.\d+)(px|rem|em|%|vw|vh|vmin|vmax|ch|ex|pt|cm|mm|in|pc)|0|(length:.+)|calc\(.+\))$/i.test(main)) {
|
|
4434
|
+
const width = main.startsWith("length:") ? main.slice(7) : main;
|
|
4435
|
+
return [
|
|
4436
|
+
ringShadowProperties(),
|
|
4437
|
+
decl("--baro-ring-shadow", ringShadowValue(width)),
|
|
4438
|
+
decl("box-shadow", SHADOW_COMPOSITE)
|
|
4439
|
+
];
|
|
4440
|
+
}
|
|
4441
|
+
return [parseColor(main) ? decl("--baro-ring-color", main) : decl("box-shadow", main)];
|
|
4076
4442
|
}
|
|
4077
4443
|
if (main === "inherit" || main === "current" || main === "transparent") {
|
|
4078
4444
|
return [
|
|
@@ -4314,18 +4680,30 @@ functionalUtility({
|
|
|
4314
4680
|
description: "mask-size utility (static, arbitrary, custom property supported)",
|
|
4315
4681
|
category: "effects"
|
|
4316
4682
|
});
|
|
4683
|
+
const maskProperties = () => atRoot([
|
|
4684
|
+
property("--baro-mask-linear", "linear-gradient(#fff, #fff)"),
|
|
4685
|
+
property("--baro-mask-radial", "linear-gradient(#fff, #fff)"),
|
|
4686
|
+
property("--baro-mask-conic", "linear-gradient(#fff, #fff)"),
|
|
4687
|
+
property("--baro-mask-linear-position", "0deg"),
|
|
4688
|
+
property("--baro-mask-linear-from-position", "0%"),
|
|
4689
|
+
property("--baro-mask-linear-to-position", "100%"),
|
|
4690
|
+
property("--baro-mask-linear-from-color", "black"),
|
|
4691
|
+
property("--baro-mask-linear-to-color", "transparent")
|
|
4692
|
+
]);
|
|
4317
4693
|
functionalUtility({
|
|
4318
4694
|
name: "mask-linear-from",
|
|
4319
4695
|
handleBareValue: ({ value }) => /^(?:100|[1-9]?\d)%$/.test(value) ? value : null,
|
|
4320
4696
|
handle: (value) => [
|
|
4321
|
-
decl("mask-image", "var(--
|
|
4697
|
+
decl("mask-image", "var(--baro-mask-linear), var(--baro-mask-radial), var(--baro-mask-conic)"),
|
|
4322
4698
|
decl("mask-composite", "intersect"),
|
|
4323
|
-
decl("--
|
|
4324
|
-
decl("--
|
|
4325
|
-
decl("--
|
|
4699
|
+
decl("--baro-mask-linear-stops", "var(--baro-mask-linear-position), var(--baro-mask-linear-from-color) var(--baro-mask-linear-from-position), var(--baro-mask-linear-to-color) var(--baro-mask-linear-to-position)"),
|
|
4700
|
+
decl("--baro-mask-linear", "linear-gradient(var(--baro-mask-linear-stops))"),
|
|
4701
|
+
decl("--baro-mask-linear-from-position", value),
|
|
4702
|
+
maskProperties()
|
|
4326
4703
|
],
|
|
4327
4704
|
category: "effects"
|
|
4328
4705
|
});
|
|
4706
|
+
staticUtility("mask-none", [["mask-image", "none"]], { category: "effects" });
|
|
4329
4707
|
functionalUtility({
|
|
4330
4708
|
name: "mask",
|
|
4331
4709
|
supportsArbitrary: true,
|
|
@@ -4361,7 +4739,7 @@ functionalUtility({
|
|
|
4361
4739
|
category: "layout"
|
|
4362
4740
|
});
|
|
4363
4741
|
staticUtility("aspect-square", [["aspect-ratio", "1 / 1"]], { category: "layout" });
|
|
4364
|
-
staticUtility("aspect-video", [["aspect-ratio", "var(--aspect-
|
|
4742
|
+
staticUtility("aspect-video", [["aspect-ratio", "var(--aspect-video)"]], { category: "layout" });
|
|
4365
4743
|
staticUtility("aspect-auto", [["aspect-ratio", "auto"]], { category: "layout" });
|
|
4366
4744
|
functionalUtility({
|
|
4367
4745
|
name: "aspect",
|
|
@@ -4445,10 +4823,10 @@ staticUtility("sr-only", [
|
|
|
4445
4823
|
["position", "absolute"],
|
|
4446
4824
|
["width", "1px"],
|
|
4447
4825
|
["height", "1px"],
|
|
4448
|
-
["margin", "-1px"],
|
|
4449
4826
|
["padding", "0"],
|
|
4827
|
+
["margin", "-1px"],
|
|
4450
4828
|
["overflow", "hidden"],
|
|
4451
|
-
["clip", "
|
|
4829
|
+
["clip-path", "inset(50%)"],
|
|
4452
4830
|
["white-space", "nowrap"],
|
|
4453
4831
|
["border-width", "0"]
|
|
4454
4832
|
], { category: "layout" });
|
|
@@ -4456,12 +4834,39 @@ staticUtility("not-sr-only", [
|
|
|
4456
4834
|
["position", "static"],
|
|
4457
4835
|
["width", "auto"],
|
|
4458
4836
|
["height", "auto"],
|
|
4459
|
-
["margin", "0"],
|
|
4460
4837
|
["padding", "0"],
|
|
4838
|
+
["margin", "0"],
|
|
4461
4839
|
["overflow", "visible"],
|
|
4462
|
-
["clip", "
|
|
4840
|
+
["clip-path", "none"],
|
|
4463
4841
|
["white-space", "normal"]
|
|
4464
4842
|
], { category: "layout" });
|
|
4843
|
+
staticUtility("@container", [["container-type", "inline-size"]], { category: "layout" });
|
|
4844
|
+
staticUtility("@container-normal", [["container-type", "normal"]], { category: "layout" });
|
|
4845
|
+
registerUtility({
|
|
4846
|
+
name: "@container",
|
|
4847
|
+
match: (className) => /^@container\/[a-zA-Z0-9_-]+$/.test(className),
|
|
4848
|
+
handler: (_value, _ctx, token) => {
|
|
4849
|
+
const name = /^@container\/([a-zA-Z0-9_-]+)$/.exec(`${token.prefix}${token.value ? `-${token.value}` : ""}`)?.[1];
|
|
4850
|
+
return name ? [decl("container-type", "inline-size"), decl("container-name", name)] : null;
|
|
4851
|
+
},
|
|
4852
|
+
category: "layout"
|
|
4853
|
+
});
|
|
4854
|
+
const toRem = (v) => {
|
|
4855
|
+
const m = /^(-?\d*\.?\d+)(rem|px|em)$/.exec(v.trim());
|
|
4856
|
+
if (!m) return Number.NaN;
|
|
4857
|
+
return m[2] === "px" ? Number(m[1]) / 16 : Number(m[1]);
|
|
4858
|
+
};
|
|
4859
|
+
registerUtility({
|
|
4860
|
+
name: "container",
|
|
4861
|
+
match: (className) => className === "container",
|
|
4862
|
+
handler: (_value, ctx) => {
|
|
4863
|
+
const bps = ctx.theme("breakpoints") || ctx.config("theme.breakpoints") || {};
|
|
4864
|
+
const values = Object.values(bps).filter((v) => typeof v === "string" && !Number.isNaN(toRem(v)));
|
|
4865
|
+
values.sort((a, b) => toRem(a) - toRem(b));
|
|
4866
|
+
return [decl("width", "100%"), ...values.map((v) => atRule("media", `(width >= ${v})`, [decl("max-width", v)]))];
|
|
4867
|
+
},
|
|
4868
|
+
category: "layout"
|
|
4869
|
+
});
|
|
4465
4870
|
staticUtility("float-right", [["float", "right"]], { category: "layout" });
|
|
4466
4871
|
staticUtility("float-left", [["float", "left"]], { category: "layout" });
|
|
4467
4872
|
staticUtility("float-start", [["float", "inline-start"]], { category: "layout" });
|
|
@@ -4577,7 +4982,7 @@ functionalUtility({
|
|
|
4577
4982
|
// gap-x-[10vw]
|
|
4578
4983
|
supportsCustomProperty: true,
|
|
4579
4984
|
// gap-x-(--my-gap-x)
|
|
4580
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
4985
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4581
4986
|
handle: (value) => {
|
|
4582
4987
|
if (typeof value === "string") return [decl("column-gap", value)];
|
|
4583
4988
|
return null;
|
|
@@ -4593,7 +4998,7 @@ functionalUtility({
|
|
|
4593
4998
|
// gap-y-[10vw]
|
|
4594
4999
|
supportsCustomProperty: true,
|
|
4595
5000
|
// gap-y-(--my-gap-y)
|
|
4596
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5001
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4597
5002
|
handle: (value) => {
|
|
4598
5003
|
if (typeof value === "string") return [decl("row-gap", value)];
|
|
4599
5004
|
return null;
|
|
@@ -4609,7 +5014,7 @@ functionalUtility({
|
|
|
4609
5014
|
// gap-[10vw]
|
|
4610
5015
|
supportsCustomProperty: true,
|
|
4611
5016
|
// gap-(--my-gap)
|
|
4612
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5017
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4613
5018
|
handle: (value) => {
|
|
4614
5019
|
if (typeof value === "string") return [decl("gap", value)];
|
|
4615
5020
|
return null;
|
|
@@ -4668,6 +5073,31 @@ staticUtility("flex-nowrap", [["flex-wrap", "nowrap"]], { category: "flex-grid"
|
|
|
4668
5073
|
staticUtility("flex-auto", [["flex", "1 1 auto"]], { category: "flex-grid" });
|
|
4669
5074
|
staticUtility("flex-initial", [["flex", "0 1 auto"]], { category: "flex-grid" });
|
|
4670
5075
|
staticUtility("flex-none", [["flex", "none"]], { category: "flex-grid" });
|
|
5076
|
+
staticUtility("flex-grow", [["flex-grow", "1"]], { category: "flex-grid" });
|
|
5077
|
+
functionalUtility({
|
|
5078
|
+
name: "flex-grow",
|
|
5079
|
+
prop: "flex-grow",
|
|
5080
|
+
supportsArbitrary: true,
|
|
5081
|
+
// grow-[25vw], grow-[2], grow-[var(--factor)], etc.
|
|
5082
|
+
supportsCustomProperty: true,
|
|
5083
|
+
// grow-(--my-grow)
|
|
5084
|
+
handleBareValue: ({ value }) => parseNumber(value),
|
|
5085
|
+
handle: (value) => [decl("flex-grow", value)],
|
|
5086
|
+
description: "flex-grow utility (number, arbitrary, custom property supported)",
|
|
5087
|
+
category: "flex-grid"
|
|
5088
|
+
});
|
|
5089
|
+
staticUtility("flex-shrink", [["flex-shrink", "1"]], { category: "flex-grid" });
|
|
5090
|
+
functionalUtility({
|
|
5091
|
+
name: "flex-shrink",
|
|
5092
|
+
prop: "flex-shrink",
|
|
5093
|
+
supportsArbitrary: true,
|
|
5094
|
+
// shrink-[2], shrink-[calc(100vw-var(--sidebar))], etc.
|
|
5095
|
+
supportsCustomProperty: true,
|
|
5096
|
+
// shrink-(--my-shrink)
|
|
5097
|
+
handleBareValue: ({ value }) => parseNumber(value),
|
|
5098
|
+
description: "flex-shrink utility (number, arbitrary, custom property supported)",
|
|
5099
|
+
category: "flex-grid"
|
|
5100
|
+
});
|
|
4671
5101
|
functionalUtility({
|
|
4672
5102
|
name: "flex",
|
|
4673
5103
|
supportsArbitrary: true,
|
|
@@ -4901,7 +5331,7 @@ functionalUtility({
|
|
|
4901
5331
|
// gap-x-[10vw]
|
|
4902
5332
|
supportsCustomProperty: true,
|
|
4903
5333
|
// gap-x-(--my-gap-x)
|
|
4904
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5334
|
+
handleBareValue: ({ value }) => value === "px" ? "1px" : parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4905
5335
|
handle: (value) => {
|
|
4906
5336
|
if (typeof value === "string") return [decl("column-gap", value)];
|
|
4907
5337
|
return null;
|
|
@@ -4917,7 +5347,7 @@ functionalUtility({
|
|
|
4917
5347
|
// gap-y-[10vw]
|
|
4918
5348
|
supportsCustomProperty: true,
|
|
4919
5349
|
// gap-y-(--my-gap-y)
|
|
4920
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5350
|
+
handleBareValue: ({ value }) => value === "px" ? "1px" : parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4921
5351
|
handle: (value) => {
|
|
4922
5352
|
if (typeof value === "string") return [decl("row-gap", value)];
|
|
4923
5353
|
return null;
|
|
@@ -4933,7 +5363,7 @@ functionalUtility({
|
|
|
4933
5363
|
// gap-[10vw]
|
|
4934
5364
|
supportsCustomProperty: true,
|
|
4935
5365
|
// gap-(--my-gap)
|
|
4936
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5366
|
+
handleBareValue: ({ value }) => value === "px" ? "1px" : parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4937
5367
|
handle: (value) => {
|
|
4938
5368
|
if (typeof value === "string") return [decl("gap", value)];
|
|
4939
5369
|
return null;
|
|
@@ -4961,11 +5391,11 @@ staticUtility("justify-items-center-safe", [["justify-items", "safe center"]], {
|
|
|
4961
5391
|
staticUtility("justify-items-stretch", [["justify-items", "stretch"]], { category: "flex-grid" });
|
|
4962
5392
|
staticUtility("justify-items-normal", [["justify-items", "normal"]], { category: "flex-grid" });
|
|
4963
5393
|
staticUtility("justify-self-auto", [["justify-self", "auto"]], { category: "flex-grid" });
|
|
4964
|
-
staticUtility("justify-self-start", [["justify-self", "start"]], { category: "flex-grid" });
|
|
5394
|
+
staticUtility("justify-self-start", [["justify-self", "flex-start"]], { category: "flex-grid" });
|
|
4965
5395
|
staticUtility("justify-self-center", [["justify-self", "center"]], { category: "flex-grid" });
|
|
4966
5396
|
staticUtility("justify-self-center-safe", [["justify-self", "safe center"]], { category: "flex-grid" });
|
|
4967
|
-
staticUtility("justify-self-end", [["justify-self", "end"]], { category: "flex-grid" });
|
|
4968
|
-
staticUtility("justify-self-end-safe", [["justify-self", "safe end"]], { category: "flex-grid" });
|
|
5397
|
+
staticUtility("justify-self-end", [["justify-self", "flex-end"]], { category: "flex-grid" });
|
|
5398
|
+
staticUtility("justify-self-end-safe", [["justify-self", "safe flex-end"]], { category: "flex-grid" });
|
|
4969
5399
|
staticUtility("justify-self-stretch", [["justify-self", "stretch"]], { category: "flex-grid" });
|
|
4970
5400
|
staticUtility("content-normal", [["align-content", "normal"]], { category: "flex-grid" });
|
|
4971
5401
|
staticUtility("content-center", [["align-content", "center"]], { category: "flex-grid" });
|
|
@@ -5100,7 +5530,7 @@ functionalUtility({
|
|
|
5100
5530
|
prop,
|
|
5101
5531
|
supportsArbitrary: true,
|
|
5102
5532
|
supportsCustomProperty: true,
|
|
5103
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5533
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5104
5534
|
description: `${name} utility (number, arbitrary, custom property supported)`,
|
|
5105
5535
|
category: "spacing"
|
|
5106
5536
|
});
|
|
@@ -5125,144 +5555,48 @@ functionalUtility({
|
|
|
5125
5555
|
supportsNegative: true,
|
|
5126
5556
|
supportsArbitrary: true,
|
|
5127
5557
|
supportsCustomProperty: true,
|
|
5128
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5129
|
-
handleNegativeBareValue: ({ value }) => `calc(var(--spacing) * -${value})
|
|
5558
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5559
|
+
handleNegativeBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * -${value})` : null,
|
|
5130
5560
|
description: `${name} margin utility (number, negative, arbitrary, custom property, auto, px supported)`,
|
|
5131
5561
|
category: "spacing"
|
|
5132
5562
|
});
|
|
5133
5563
|
});
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
]
|
|
5146
|
-
], { category: "spacing" });
|
|
5147
|
-
staticUtility(
|
|
5148
|
-
[
|
|
5149
|
-
|
|
5150
|
-
[
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
handle: (value, ctx, token) => {
|
|
5171
|
-
let v = value;
|
|
5172
|
-
if (typeof v === "number" || /^-?\d+(\.\d+)?$/.test(v)) {
|
|
5173
|
-
v = `calc(var(--spacing) * ${token.negative ? "-" : ""}${v})`;
|
|
5174
|
-
}
|
|
5175
|
-
return [
|
|
5176
|
-
rule("& > :not([hidden]) ~ :not([hidden])", [
|
|
5177
|
-
decl("--baro-space-x-reverse", "0"),
|
|
5178
|
-
decl(
|
|
5179
|
-
"margin-inline-start",
|
|
5180
|
-
`calc(${v} * calc(1 - var(--baro-space-x-reverse)))`
|
|
5181
|
-
),
|
|
5182
|
-
decl("margin-inline-end", `calc(${v} * var(--baro-space-x-reverse))`)
|
|
5183
|
-
])
|
|
5184
|
-
];
|
|
5185
|
-
},
|
|
5186
|
-
handleCustomProperty: (value) => [
|
|
5187
|
-
rule("& > :not([hidden]) ~ :not([hidden])", [
|
|
5188
|
-
decl("--baro-space-x-reverse", "0"),
|
|
5189
|
-
decl(
|
|
5190
|
-
"margin-inline-start",
|
|
5191
|
-
`calc(var(${value}) * calc(1 - var(--baro-space-x-reverse)))`
|
|
5192
|
-
),
|
|
5193
|
-
decl(
|
|
5194
|
-
"margin-inline-end",
|
|
5195
|
-
`calc(var(${value}) * var(--baro-space-x-reverse))`
|
|
5196
|
-
)
|
|
5197
|
-
])
|
|
5198
|
-
],
|
|
5199
|
-
description: "space-x utility (number, negative, px, arbitrary, custom property, reverse supported)",
|
|
5200
|
-
category: "spacing"
|
|
5201
|
-
});
|
|
5202
|
-
staticUtility("space-y-px", [
|
|
5203
|
-
[
|
|
5204
|
-
"& > :not([hidden]) ~ :not([hidden])",
|
|
5205
|
-
[
|
|
5206
|
-
["--baro-space-y-reverse", "0"],
|
|
5207
|
-
["margin-block-start", "calc(1px * calc(1 - var(--baro-space-y-reverse)))"],
|
|
5208
|
-
["margin-block-end", "calc(1px * var(--baro-space-y-reverse))"]
|
|
5209
|
-
]
|
|
5210
|
-
]
|
|
5211
|
-
], { category: "spacing" });
|
|
5212
|
-
staticUtility("-space-y-px", [
|
|
5213
|
-
[
|
|
5214
|
-
"& > :not([hidden]) ~ :not([hidden])",
|
|
5215
|
-
[
|
|
5216
|
-
["--baro-space-y-reverse", "0"],
|
|
5217
|
-
[
|
|
5218
|
-
"margin-block-start",
|
|
5219
|
-
"calc(-1px * calc(1 - var(--baro-space-y-reverse)))"
|
|
5220
|
-
],
|
|
5221
|
-
["margin-block-end", "calc(-1px * var(--baro-space-y-reverse))"]
|
|
5222
|
-
]
|
|
5223
|
-
]
|
|
5224
|
-
], { category: "spacing" });
|
|
5225
|
-
staticUtility("space-y-reverse", [
|
|
5226
|
-
["& > :not([hidden]) ~ :not([hidden])", [["--baro-space-y-reverse", "1"]]]
|
|
5227
|
-
], { category: "spacing" });
|
|
5228
|
-
functionalUtility({
|
|
5229
|
-
name: "space-y",
|
|
5230
|
-
supportsNegative: true,
|
|
5231
|
-
supportsArbitrary: true,
|
|
5232
|
-
supportsCustomProperty: true,
|
|
5233
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
|
|
5234
|
-
handleNegativeBareValue: ({ value }) => `calc(var(--spacing) * -${value})`,
|
|
5235
|
-
handle: (value, ctx, token) => {
|
|
5236
|
-
let v = value;
|
|
5237
|
-
if (typeof v === "number" || /^-?\d+(\.\d+)?$/.test(v)) {
|
|
5238
|
-
v = `calc(var(--spacing) * ${token.negative ? "-" : ""}${v})`;
|
|
5239
|
-
}
|
|
5240
|
-
return [
|
|
5241
|
-
rule("& > :not([hidden]) ~ :not([hidden])", [
|
|
5242
|
-
decl("--baro-space-y-reverse", "0"),
|
|
5243
|
-
decl(
|
|
5244
|
-
"margin-block-start",
|
|
5245
|
-
`calc(${v} * calc(1 - var(--baro-space-y-reverse)))`
|
|
5246
|
-
),
|
|
5247
|
-
decl("margin-block-end", `calc(${v} * var(--baro-space-y-reverse))`)
|
|
5248
|
-
])
|
|
5249
|
-
];
|
|
5250
|
-
},
|
|
5251
|
-
handleCustomProperty: (value) => [
|
|
5252
|
-
rule("& > :not([hidden]) ~ :not([hidden])", [
|
|
5253
|
-
decl("--baro-space-y-reverse", "0"),
|
|
5254
|
-
decl(
|
|
5255
|
-
"margin-block-start",
|
|
5256
|
-
`calc(var(${value}) * calc(1 - var(--baro-space-y-reverse)))`
|
|
5257
|
-
),
|
|
5258
|
-
decl(
|
|
5259
|
-
"margin-block-end",
|
|
5260
|
-
`calc(var(${value}) * var(--baro-space-y-reverse))`
|
|
5261
|
-
)
|
|
5262
|
-
])
|
|
5263
|
-
],
|
|
5264
|
-
description: "space-y utility (number, negative, px, arbitrary, custom property, reverse supported)",
|
|
5265
|
-
category: "spacing"
|
|
5564
|
+
const SPACE_SELECTOR = ":where(& > :not(:last-child))";
|
|
5565
|
+
["x", "y"].forEach((axis) => {
|
|
5566
|
+
const name = `space-${axis}`;
|
|
5567
|
+
const rev = `--baro-space-${axis}-reverse`;
|
|
5568
|
+
const [start, end] = axis === "x" ? ["margin-inline-start", "margin-inline-end"] : ["margin-block-start", "margin-block-end"];
|
|
5569
|
+
const reverseProperty = () => atRoot([property(rev, "0")]);
|
|
5570
|
+
const spaceRule = (v) => rule(SPACE_SELECTOR, [
|
|
5571
|
+
decl(rev, "0"),
|
|
5572
|
+
decl(start, `calc(${v} * var(${rev}))`),
|
|
5573
|
+
decl(end, `calc(${v} * calc(1 - var(${rev})))`)
|
|
5574
|
+
]);
|
|
5575
|
+
const body = (v) => [reverseProperty(), spaceRule(v)];
|
|
5576
|
+
staticUtility(`${name}-px`, [reverseProperty, () => spaceRule("1px")], { category: "spacing" });
|
|
5577
|
+
staticUtility(`-${name}-px`, [reverseProperty, () => spaceRule("-1px")], { category: "spacing" });
|
|
5578
|
+
staticUtility(`${name}-reverse`, [
|
|
5579
|
+
reverseProperty,
|
|
5580
|
+
() => rule(SPACE_SELECTOR, [decl(rev, "1")])
|
|
5581
|
+
], { category: "spacing" });
|
|
5582
|
+
functionalUtility({
|
|
5583
|
+
name,
|
|
5584
|
+
supportsNegative: true,
|
|
5585
|
+
supportsArbitrary: true,
|
|
5586
|
+
supportsCustomProperty: true,
|
|
5587
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5588
|
+
handleNegativeBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * -${value})` : null,
|
|
5589
|
+
handle: (value, _ctx, token) => {
|
|
5590
|
+
let v = String(value);
|
|
5591
|
+
if (/^-?\d+(\.\d+)?$/.test(v)) {
|
|
5592
|
+
v = `calc(var(--spacing) * ${token.negative ? "-" : ""}${v})`;
|
|
5593
|
+
}
|
|
5594
|
+
return body(v);
|
|
5595
|
+
},
|
|
5596
|
+
handleCustomProperty: (value) => body(`var(${value})`),
|
|
5597
|
+
description: `${name} utility (number, negative, px, arbitrary, custom property, reverse supported)`,
|
|
5598
|
+
category: "spacing"
|
|
5599
|
+
});
|
|
5266
5600
|
});
|
|
5267
5601
|
[
|
|
5268
5602
|
["w-auto", "auto"],
|
|
@@ -5489,6 +5823,9 @@ functionalUtility({
|
|
|
5489
5823
|
});
|
|
5490
5824
|
[
|
|
5491
5825
|
["max-w-none", "none"],
|
|
5826
|
+
["max-w-min", "min-content"],
|
|
5827
|
+
["max-w-max", "max-content"],
|
|
5828
|
+
["max-w-fit", "fit-content"],
|
|
5492
5829
|
["max-w-xs", "var(--container-xs)"],
|
|
5493
5830
|
["max-w-sm", "var(--container-sm)"],
|
|
5494
5831
|
["max-w-md", "var(--container-md)"],
|
|
@@ -5519,22 +5856,23 @@ functionalUtility({
|
|
|
5519
5856
|
description: "max-width utility (spacing, fraction, arbitrary, custom property, static supported)",
|
|
5520
5857
|
category: "sizing"
|
|
5521
5858
|
});
|
|
5522
|
-
|
|
5523
|
-
staticUtility("font-
|
|
5524
|
-
staticUtility("font-
|
|
5525
|
-
staticUtility("
|
|
5526
|
-
staticUtility("text-
|
|
5527
|
-
staticUtility("text-
|
|
5528
|
-
staticUtility("text-
|
|
5529
|
-
staticUtility("text-
|
|
5530
|
-
staticUtility("text-
|
|
5531
|
-
staticUtility("text-
|
|
5532
|
-
staticUtility("text-
|
|
5533
|
-
staticUtility("text-
|
|
5534
|
-
staticUtility("text-
|
|
5535
|
-
staticUtility("text-
|
|
5536
|
-
staticUtility("text-
|
|
5537
|
-
staticUtility("text-
|
|
5859
|
+
const leadingProperty = () => atRoot([property("--baro-leading")]);
|
|
5860
|
+
staticUtility("font-sans", [["font-family", "var(--font-sans)"]], { category: "typography" });
|
|
5861
|
+
staticUtility("font-serif", [["font-family", "var(--font-serif)"]], { category: "typography" });
|
|
5862
|
+
staticUtility("font-mono", [["font-family", "var(--font-mono)"]], { category: "typography" });
|
|
5863
|
+
staticUtility("text-xs", [["font-size", "var(--text-xs)"], ["line-height", "var(--baro-leading, var(--text-xs--line-height))"]], { category: "typography" });
|
|
5864
|
+
staticUtility("text-sm", [["font-size", "var(--text-sm)"], ["line-height", "var(--baro-leading, var(--text-sm--line-height))"]], { category: "typography" });
|
|
5865
|
+
staticUtility("text-base", [["font-size", "var(--text-base)"], ["line-height", "var(--baro-leading, var(--text-base--line-height))"]], { category: "typography" });
|
|
5866
|
+
staticUtility("text-lg", [["font-size", "var(--text-lg)"], ["line-height", "var(--baro-leading, var(--text-lg--line-height))"]], { category: "typography" });
|
|
5867
|
+
staticUtility("text-xl", [["font-size", "var(--text-xl)"], ["line-height", "var(--baro-leading, var(--text-xl--line-height))"]], { category: "typography" });
|
|
5868
|
+
staticUtility("text-2xl", [["font-size", "var(--text-2xl)"], ["line-height", "var(--baro-leading, var(--text-2xl--line-height))"]], { category: "typography" });
|
|
5869
|
+
staticUtility("text-3xl", [["font-size", "var(--text-3xl)"], ["line-height", "var(--baro-leading, var(--text-3xl--line-height))"]], { category: "typography" });
|
|
5870
|
+
staticUtility("text-4xl", [["font-size", "var(--text-4xl)"], ["line-height", "var(--baro-leading, var(--text-4xl--line-height))"]], { category: "typography" });
|
|
5871
|
+
staticUtility("text-5xl", [["font-size", "var(--text-5xl)"], ["line-height", "var(--baro-leading, var(--text-5xl--line-height))"]], { category: "typography" });
|
|
5872
|
+
staticUtility("text-6xl", [["font-size", "var(--text-6xl)"], ["line-height", "var(--baro-leading, var(--text-6xl--line-height))"]], { category: "typography" });
|
|
5873
|
+
staticUtility("text-7xl", [["font-size", "var(--text-7xl)"], ["line-height", "var(--baro-leading, var(--text-7xl--line-height))"]], { category: "typography" });
|
|
5874
|
+
staticUtility("text-8xl", [["font-size", "var(--text-8xl)"], ["line-height", "var(--baro-leading, var(--text-8xl--line-height))"]], { category: "typography" });
|
|
5875
|
+
staticUtility("text-9xl", [["font-size", "var(--text-9xl)"], ["line-height", "var(--baro-leading, var(--text-9xl--line-height))"]], { category: "typography" });
|
|
5538
5876
|
staticUtility("font-thin", [["font-weight", "var(--font-weight-thin)"]], { category: "typography" });
|
|
5539
5877
|
staticUtility("font-extralight", [["font-weight", "var(--font-weight-extralight)"]], { category: "typography" });
|
|
5540
5878
|
staticUtility("font-light", [["font-weight", "var(--font-weight-light)"]], { category: "typography" });
|
|
@@ -5580,12 +5918,12 @@ functionalUtility({
|
|
|
5580
5918
|
description: "letter-spacing utility (theme, arbitrary, custom property supported)",
|
|
5581
5919
|
category: "typography"
|
|
5582
5920
|
});
|
|
5583
|
-
staticUtility("leading-none", [["
|
|
5584
|
-
staticUtility("leading-tight", [["
|
|
5585
|
-
staticUtility("leading-snug", [["
|
|
5586
|
-
staticUtility("leading-normal", [["
|
|
5587
|
-
staticUtility("leading-relaxed", [["
|
|
5588
|
-
staticUtility("leading-loose", [["
|
|
5921
|
+
staticUtility("leading-none", [["--baro-leading", "var(--leading-none, 1)"], ["line-height", "var(--leading-none, 1)"], leadingProperty()], { category: "typography" });
|
|
5922
|
+
staticUtility("leading-tight", [["--baro-leading", "var(--leading-tight, 1.25)"], ["line-height", "var(--leading-tight, 1.25)"], leadingProperty()], { category: "typography" });
|
|
5923
|
+
staticUtility("leading-snug", [["--baro-leading", "var(--leading-snug, 1.375)"], ["line-height", "var(--leading-snug, 1.375)"], leadingProperty()], { category: "typography" });
|
|
5924
|
+
staticUtility("leading-normal", [["--baro-leading", "var(--leading-normal, 1.5)"], ["line-height", "var(--leading-normal, 1.5)"], leadingProperty()], { category: "typography" });
|
|
5925
|
+
staticUtility("leading-relaxed", [["--baro-leading", "var(--leading-relaxed, 1.625)"], ["line-height", "var(--leading-relaxed, 1.625)"], leadingProperty()], { category: "typography" });
|
|
5926
|
+
staticUtility("leading-loose", [["--baro-leading", "var(--leading-loose, 2)"], ["line-height", "var(--leading-loose, 2)"], leadingProperty()], { category: "typography" });
|
|
5589
5927
|
functionalUtility({
|
|
5590
5928
|
name: "leading",
|
|
5591
5929
|
prop: "line-height",
|
|
@@ -5593,6 +5931,8 @@ functionalUtility({
|
|
|
5593
5931
|
supportsArbitrary: true,
|
|
5594
5932
|
supportsCustomProperty: true,
|
|
5595
5933
|
handleBareValue: ({ value }) => parseNumber(value),
|
|
5934
|
+
handle: (value) => [decl("--baro-leading", value), decl("line-height", value), leadingProperty()],
|
|
5935
|
+
handleCustomProperty: (value) => [decl("--baro-leading", `var(${value})`), decl("line-height", `var(${value})`), leadingProperty()],
|
|
5596
5936
|
description: "line-height utility (theme, number, arbitrary, custom property supported)",
|
|
5597
5937
|
category: "typography"
|
|
5598
5938
|
});
|
|
@@ -5602,6 +5942,17 @@ staticUtility("text-right", [["text-align", "right"]], { category: "typography"
|
|
|
5602
5942
|
staticUtility("text-justify", [["text-align", "justify"]], { category: "typography" });
|
|
5603
5943
|
staticUtility("text-start", [["text-align", "start"]], { category: "typography" });
|
|
5604
5944
|
staticUtility("text-end", [["text-align", "end"]], { category: "typography" });
|
|
5945
|
+
const FONT_SIZE_HINTS = /* @__PURE__ */ new Set(["length", "size", "percentage", "absolute-size", "relative-size"]);
|
|
5946
|
+
const FONT_SIZE_KEYWORDS = /^(xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large|larger|smaller)$/;
|
|
5947
|
+
const LENGTH_RE = /^-?(\d+\.?\d*|\.\d+)(px|r?em|r?lh|r?cap|r?ch|r?ex|r?ic|%|vh|vw|vmin|vmax|[sdl]v[hwib]|v[ib]|cq[whib]|cqmin|cqmax|pt|pc|in|cm|mm|q)$/i;
|
|
5948
|
+
function textArbitraryKind(raw2) {
|
|
5949
|
+
const hint = /^([a-z-]+):(.+)$/.exec(raw2);
|
|
5950
|
+
if (hint && (hint[1] === "color" || FONT_SIZE_HINTS.has(hint[1]))) {
|
|
5951
|
+
return { fontSize: hint[1] !== "color", value: hint[2] };
|
|
5952
|
+
}
|
|
5953
|
+
const fontSize = raw2 === "0" || LENGTH_RE.test(raw2) || FONT_SIZE_KEYWORDS.test(raw2) || /^(calc|min|max|clamp)\(/.test(raw2);
|
|
5954
|
+
return { fontSize, value: raw2 };
|
|
5955
|
+
}
|
|
5605
5956
|
staticUtility("text-inherit", [["color", "inherit"]], { category: "typography" });
|
|
5606
5957
|
staticUtility("text-current", [["color", "currentColor"]], { category: "typography" });
|
|
5607
5958
|
staticUtility("text-transparent", [["color", "transparent"]], { category: "typography" });
|
|
@@ -5615,27 +5966,14 @@ functionalUtility({
|
|
|
5615
5966
|
supportsCustomProperty: true,
|
|
5616
5967
|
supportsOpacity: true,
|
|
5617
5968
|
handle: (value, ctx, token, extra) => {
|
|
5618
|
-
if (extra?.realThemeValue)
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
atRule("supports", `(color:color-mix(in lab, red, red))`, [
|
|
5622
|
-
decl("color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
|
|
5623
|
-
]),
|
|
5624
|
-
decl("color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
|
|
5625
|
-
];
|
|
5626
|
-
}
|
|
5627
|
-
return [decl("color", value)];
|
|
5628
|
-
}
|
|
5629
|
-
if (parseLength(value)) {
|
|
5630
|
-
return [decl("font-size", value)];
|
|
5631
|
-
}
|
|
5632
|
-
return [decl("color", value)];
|
|
5969
|
+
if (extra?.realThemeValue) return themeColorDecls("color", value, extra);
|
|
5970
|
+
const kind = textArbitraryKind(value);
|
|
5971
|
+
return [decl(kind.fontSize ? "font-size" : "color", kind.value)];
|
|
5633
5972
|
},
|
|
5973
|
+
// Tailwind 4: text-(--x) is a colour; text-(length:--x) is a font-size.
|
|
5634
5974
|
handleCustomProperty: (value) => {
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
}
|
|
5638
|
-
return [decl("font-size", `var(${value})`)];
|
|
5975
|
+
const kind = textArbitraryKind(value);
|
|
5976
|
+
return [decl(kind.fontSize ? "font-size" : "color", `var(${kind.value})`)];
|
|
5639
5977
|
},
|
|
5640
5978
|
description: "text color utility (theme, arbitrary, custom property supported)",
|
|
5641
5979
|
category: "typography"
|
|
@@ -5651,7 +5989,7 @@ functionalUtility({
|
|
|
5651
5989
|
if (Array.isArray(themeValue)) {
|
|
5652
5990
|
return [
|
|
5653
5991
|
decl("font-size", themeValue[0]),
|
|
5654
|
-
decl("line-height", themeValue[1])
|
|
5992
|
+
decl("line-height", `var(--baro-leading, ${themeValue[1]})`)
|
|
5655
5993
|
];
|
|
5656
5994
|
} else {
|
|
5657
5995
|
return [decl("font-size", themeValue)];
|
|
@@ -5765,17 +6103,7 @@ functionalUtility({
|
|
|
5765
6103
|
supportsCustomProperty: true,
|
|
5766
6104
|
supportsOpacity: true,
|
|
5767
6105
|
handle: (value, ctx, token, extra) => {
|
|
5768
|
-
if (extra?.realThemeValue)
|
|
5769
|
-
if (extra.opacity) {
|
|
5770
|
-
return [
|
|
5771
|
-
atRule("supports", `(color:color-mix(in lab, red, red))`, [
|
|
5772
|
-
decl("text-decoration-color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
|
|
5773
|
-
]),
|
|
5774
|
-
decl("text-decoration-color", value)
|
|
5775
|
-
];
|
|
5776
|
-
}
|
|
5777
|
-
return [decl("text-decoration-color", value)];
|
|
5778
|
-
}
|
|
6106
|
+
if (extra?.realThemeValue) return themeColorDecls("text-decoration-color", value, extra);
|
|
5779
6107
|
return [decl("text-decoration-color", value)];
|
|
5780
6108
|
},
|
|
5781
6109
|
handleCustomProperty: (value) => [decl("text-decoration-color", `var(${value})`)],
|
|
@@ -5799,7 +6127,7 @@ functionalUtility({
|
|
|
5799
6127
|
prop: "text-decoration-thickness",
|
|
5800
6128
|
supportsArbitrary: true,
|
|
5801
6129
|
supportsCustomProperty: true,
|
|
5802
|
-
handleBareValue: ({ value }) => `${value}px
|
|
6130
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `${value}px` : null,
|
|
5803
6131
|
description: "text-decoration-thickness utility (arbitrary, custom property supported)",
|
|
5804
6132
|
category: "typography"
|
|
5805
6133
|
});
|
|
@@ -5814,7 +6142,7 @@ functionalUtility({
|
|
|
5814
6142
|
prop: "text-underline-offset",
|
|
5815
6143
|
supportsArbitrary: true,
|
|
5816
6144
|
supportsCustomProperty: true,
|
|
5817
|
-
handleBareValue: ({ value }) => `${value}px
|
|
6145
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `${value}px` : null,
|
|
5818
6146
|
description: "text-underline-offset utility (arbitrary, custom property supported)",
|
|
5819
6147
|
category: "typography"
|
|
5820
6148
|
});
|
|
@@ -5828,8 +6156,8 @@ functionalUtility({
|
|
|
5828
6156
|
supportsNegative: true,
|
|
5829
6157
|
supportsArbitrary: true,
|
|
5830
6158
|
supportsCustomProperty: true,
|
|
5831
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5832
|
-
handleNegativeBareValue: ({ value }) => `calc(var(--spacing) * -${value})
|
|
6159
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
6160
|
+
handleNegativeBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * -${value})` : null,
|
|
5833
6161
|
description: "text-indent utility (spacing, negative, arbitrary, custom property supported)",
|
|
5834
6162
|
category: "typography"
|
|
5835
6163
|
});
|
|
@@ -5852,14 +6180,14 @@ functionalUtility({
|
|
|
5852
6180
|
staticUtility("hyphens-none", [["hyphens", "none"]], { category: "typography" });
|
|
5853
6181
|
staticUtility("hyphens-manual", [["hyphens", "manual"]], { category: "typography" });
|
|
5854
6182
|
staticUtility("hyphens-auto", [["hyphens", "auto"]], { category: "typography" });
|
|
5855
|
-
staticUtility("content-none", [["content", "none"]], { category: "typography" });
|
|
6183
|
+
staticUtility("content-none", [["--baro-content", "none"], ["content", "none"]], { category: "typography" });
|
|
5856
6184
|
functionalUtility({
|
|
5857
6185
|
name: "content",
|
|
5858
6186
|
prop: "content",
|
|
5859
6187
|
supportsArbitrary: true,
|
|
5860
6188
|
supportsCustomProperty: true,
|
|
5861
|
-
handle: (value) => [decl("content", `"${value}"`)],
|
|
5862
|
-
handleCustomProperty: (value) => [decl("content", `var(${value})`)],
|
|
6189
|
+
handle: (value) => [decl("--baro-content", `"${value}"`), decl("content", "var(--baro-content)")],
|
|
6190
|
+
handleCustomProperty: (value) => [decl("--baro-content", `var(${value})`), decl("content", "var(--baro-content)")],
|
|
5863
6191
|
description: "content utility (arbitrary, custom property supported)",
|
|
5864
6192
|
category: "typography"
|
|
5865
6193
|
});
|
|
@@ -5869,7 +6197,8 @@ const gradientStopProperties = () => {
|
|
|
5869
6197
|
property("--baro-gradient-from", "#0000", "<color>"),
|
|
5870
6198
|
property("--baro-gradient-via", "#0000", "<color>"),
|
|
5871
6199
|
property("--baro-gradient-to", "#0000", "<color>"),
|
|
5872
|
-
property("--baro-gradient-stops"
|
|
6200
|
+
property("--baro-gradient-stops"),
|
|
6201
|
+
property("--baro-gradient-via-stops"),
|
|
5873
6202
|
property("--baro-gradient-from-position", "0%", "<length-percentage>"),
|
|
5874
6203
|
property("--baro-gradient-via-position", "50%", "<length-percentage>"),
|
|
5875
6204
|
property("--baro-gradient-to-position", "100%", "<length-percentage>")
|
|
@@ -5925,20 +6254,19 @@ functionalUtility({
|
|
|
5925
6254
|
supportsArbitrary: true,
|
|
5926
6255
|
supportsCustomProperty: true,
|
|
5927
6256
|
description: "background-size utility (arbitrary, custom property supported)",
|
|
5928
|
-
category: "background"
|
|
5929
|
-
});
|
|
5930
|
-
const positionValue = (position) =>
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
};
|
|
6257
|
+
category: "background"
|
|
6258
|
+
});
|
|
6259
|
+
const positionValue = (position) => [
|
|
6260
|
+
decl("--baro-gradient-position", position),
|
|
6261
|
+
atRule("supports", "(background-image: linear-gradient(in lab, red, red))", [
|
|
6262
|
+
decl("--baro-gradient-position", `${position} in oklab`)
|
|
6263
|
+
]),
|
|
6264
|
+
decl("background-image", "linear-gradient(var(--baro-gradient-stops))")
|
|
6265
|
+
];
|
|
6266
|
+
const legacyPositionValue = (position) => [
|
|
6267
|
+
decl("--baro-gradient-position", `${position} in oklab`),
|
|
6268
|
+
decl("background-image", "linear-gradient(var(--baro-gradient-stops))")
|
|
6269
|
+
];
|
|
5942
6270
|
[
|
|
5943
6271
|
["bg-linear-to-t", positionValue("to top")],
|
|
5944
6272
|
["bg-linear-to-tr", positionValue("to top right")],
|
|
@@ -5949,14 +6277,14 @@ const positionValue = (position) => {
|
|
|
5949
6277
|
["bg-linear-to-l", positionValue("to left")],
|
|
5950
6278
|
["bg-linear-to-tl", positionValue("to top left")],
|
|
5951
6279
|
// fallback , legacy CSS compatibility
|
|
5952
|
-
["bg-gradient-to-t",
|
|
5953
|
-
["bg-gradient-to-tr",
|
|
5954
|
-
["bg-gradient-to-r",
|
|
5955
|
-
["bg-gradient-to-br",
|
|
5956
|
-
["bg-gradient-to-b",
|
|
5957
|
-
["bg-gradient-to-bl",
|
|
5958
|
-
["bg-gradient-to-l",
|
|
5959
|
-
["bg-gradient-to-tl",
|
|
6280
|
+
["bg-gradient-to-t", legacyPositionValue("to top")],
|
|
6281
|
+
["bg-gradient-to-tr", legacyPositionValue("to top right")],
|
|
6282
|
+
["bg-gradient-to-r", legacyPositionValue("to right")],
|
|
6283
|
+
["bg-gradient-to-br", legacyPositionValue("to bottom right")],
|
|
6284
|
+
["bg-gradient-to-b", legacyPositionValue("to bottom")],
|
|
6285
|
+
["bg-gradient-to-bl", legacyPositionValue("to bottom left")],
|
|
6286
|
+
["bg-gradient-to-l", legacyPositionValue("to left")],
|
|
6287
|
+
["bg-gradient-to-tl", legacyPositionValue("to top left")]
|
|
5960
6288
|
].forEach(([name, value]) => {
|
|
5961
6289
|
staticUtility(name, value, { category: "background", priority: 1e3 });
|
|
5962
6290
|
});
|
|
@@ -5967,12 +6295,7 @@ functionalUtility({
|
|
|
5967
6295
|
supportsCustomProperty: true,
|
|
5968
6296
|
handle: (value, context, token) => {
|
|
5969
6297
|
if (parseNumber(value)) {
|
|
5970
|
-
return
|
|
5971
|
-
decl(
|
|
5972
|
-
"background-image",
|
|
5973
|
-
`linear-gradient(${value}deg in oklab, var(--baro-gradient-stops))`
|
|
5974
|
-
)
|
|
5975
|
-
];
|
|
6298
|
+
return positionValue(`${value}deg`);
|
|
5976
6299
|
}
|
|
5977
6300
|
if (token.arbitrary) {
|
|
5978
6301
|
return [
|
|
@@ -6001,79 +6324,60 @@ functionalUtility({
|
|
|
6001
6324
|
description: "linear-gradient background-image utility (angle, arbitrary, custom property supported)",
|
|
6002
6325
|
category: "background"
|
|
6003
6326
|
});
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6327
|
+
const gradientImage = (fn, position, fallback) => [
|
|
6328
|
+
decl("--baro-gradient-position", position),
|
|
6329
|
+
decl("background-image", `${fn}(var(--baro-gradient-stops${fallback ? `,${fallback}` : ""}))`)
|
|
6330
|
+
];
|
|
6331
|
+
staticUtility("bg-radial", gradientImage("radial-gradient", "in oklab"), { category: "background" });
|
|
6007
6332
|
functionalUtility({
|
|
6008
6333
|
name: "bg-radial",
|
|
6009
6334
|
prop: "background-image",
|
|
6010
6335
|
supportsArbitrary: true,
|
|
6011
6336
|
supportsCustomProperty: true,
|
|
6012
|
-
handle: (value,
|
|
6013
|
-
if (token.arbitrary)
|
|
6014
|
-
|
|
6015
|
-
decl(
|
|
6016
|
-
"background-image",
|
|
6017
|
-
`radial-gradient(var(--baro-gradient-stops, ${value}))`
|
|
6018
|
-
)
|
|
6019
|
-
];
|
|
6020
|
-
}
|
|
6021
|
-
if (token.customProperty) {
|
|
6022
|
-
return [
|
|
6023
|
-
decl(
|
|
6024
|
-
"background-image",
|
|
6025
|
-
`radial-gradient(var(--baro-gradient-stops, var(${value})))`
|
|
6026
|
-
)
|
|
6027
|
-
];
|
|
6028
|
-
}
|
|
6337
|
+
handle: (value, _context, token) => {
|
|
6338
|
+
if (token.arbitrary) return gradientImage("radial-gradient", value, value);
|
|
6339
|
+
if (token.customProperty) return gradientImage("radial-gradient", `var(${value})`, `var(${value})`);
|
|
6029
6340
|
return null;
|
|
6030
6341
|
},
|
|
6031
|
-
handleCustomProperty: (value) =>
|
|
6032
|
-
decl(
|
|
6033
|
-
"background-image",
|
|
6034
|
-
`radial-gradient(var(--baro-gradient-stops, var(${value})))`
|
|
6035
|
-
)
|
|
6036
|
-
],
|
|
6342
|
+
handleCustomProperty: (value) => gradientImage("radial-gradient", `var(${value})`, `var(${value})`),
|
|
6037
6343
|
description: "radial-gradient background-image utility (arbitrary, custom property supported)",
|
|
6038
6344
|
category: "background"
|
|
6039
6345
|
});
|
|
6040
|
-
staticUtility("bg-conic",
|
|
6041
|
-
[
|
|
6042
|
-
"background-image",
|
|
6043
|
-
"conic-gradient(from 0deg in oklab, var(--baro-gradient-stops))"
|
|
6044
|
-
]
|
|
6045
|
-
], { category: "background" });
|
|
6346
|
+
staticUtility("bg-conic", gradientImage("conic-gradient", "in oklab"), { category: "background" });
|
|
6046
6347
|
functionalUtility({
|
|
6047
6348
|
name: "bg-conic",
|
|
6048
6349
|
prop: "background-image",
|
|
6049
6350
|
supportsArbitrary: true,
|
|
6050
6351
|
supportsCustomProperty: true,
|
|
6051
|
-
handle: (value,
|
|
6052
|
-
if (parseNumber(value)) {
|
|
6053
|
-
return
|
|
6054
|
-
decl(
|
|
6055
|
-
"background-image",
|
|
6056
|
-
`conic-gradient(from ${value}deg in oklab, var(--baro-gradient-stops))`
|
|
6057
|
-
)
|
|
6058
|
-
];
|
|
6059
|
-
}
|
|
6060
|
-
if (token.arbitrary) {
|
|
6061
|
-
return [decl("background-image", `${value}`)];
|
|
6062
|
-
}
|
|
6063
|
-
if (token.customProperty) {
|
|
6064
|
-
return [
|
|
6065
|
-
decl(
|
|
6066
|
-
"background-image",
|
|
6067
|
-
`conic-gradient(var(--baro-gradient-stops, var(${value})))`
|
|
6068
|
-
)
|
|
6069
|
-
];
|
|
6352
|
+
handle: (value, _context, token) => {
|
|
6353
|
+
if (!token.arbitrary && !token.customProperty && parseNumber(value)) {
|
|
6354
|
+
return gradientImage("conic-gradient", `from ${value}deg in oklab`);
|
|
6070
6355
|
}
|
|
6356
|
+
if (token.arbitrary) return gradientImage("conic-gradient", value, value);
|
|
6357
|
+
if (token.customProperty) return gradientImage("conic-gradient", `var(${value})`, `var(${value})`);
|
|
6071
6358
|
return null;
|
|
6072
6359
|
},
|
|
6073
|
-
handleCustomProperty: (value) =>
|
|
6360
|
+
handleCustomProperty: (value) => gradientImage("conic-gradient", `var(${value})`, `var(${value})`),
|
|
6074
6361
|
description: "conic-gradient background-image utility (angle, arbitrary, custom property supported)",
|
|
6075
6362
|
category: "background"
|
|
6076
6363
|
});
|
|
6364
|
+
const G = "--baro-gradient";
|
|
6365
|
+
const stopsDecls = (stop, color) => {
|
|
6366
|
+
const colorDecls = typeof color === "string" ? [decl(`${G}-${stop}`, color)] : color;
|
|
6367
|
+
if (stop === "via") {
|
|
6368
|
+
return [
|
|
6369
|
+
gradientStopProperties(),
|
|
6370
|
+
...colorDecls,
|
|
6371
|
+
decl(`${G}-via-stops`, `var(${G}-position), var(${G}-from) var(${G}-from-position), var(${G}-via) var(${G}-via-position), var(${G}-to) var(${G}-to-position)`),
|
|
6372
|
+
decl(`${G}-stops`, `var(${G}-via-stops)`)
|
|
6373
|
+
];
|
|
6374
|
+
}
|
|
6375
|
+
return [
|
|
6376
|
+
gradientStopProperties(),
|
|
6377
|
+
...colorDecls,
|
|
6378
|
+
decl(`${G}-stops`, `var(${G}-via-stops, var(${G}-position), var(${G}-from) var(${G}-from-position), var(${G}-to) var(${G}-to-position))`)
|
|
6379
|
+
];
|
|
6380
|
+
};
|
|
6077
6381
|
["from", "via", "to"].forEach((stop) => {
|
|
6078
6382
|
functionalUtility({
|
|
6079
6383
|
name: stop,
|
|
@@ -6081,72 +6385,18 @@ functionalUtility({
|
|
|
6081
6385
|
supportsArbitrary: true,
|
|
6082
6386
|
supportsCustomProperty: true,
|
|
6083
6387
|
supportsOpacity: true,
|
|
6084
|
-
handle: (value,
|
|
6388
|
+
handle: (value, _context, _token, extra) => {
|
|
6085
6389
|
if (extra?.realThemeValue) {
|
|
6086
|
-
|
|
6087
|
-
let color = value;
|
|
6088
|
-
if (extra?.opacity) {
|
|
6089
|
-
color = `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`;
|
|
6090
|
-
}
|
|
6091
|
-
return [
|
|
6092
|
-
gradientStopProperties(),
|
|
6093
|
-
decl(`--baro-gradient-from`, color),
|
|
6094
|
-
// decl(`--baro-gradient-to`, "var(--baro-gradient-to, transparent)"),
|
|
6095
|
-
decl(`--baro-gradient-stops`, "var(--baro-gradient-from),var(--baro-gradient-to)")
|
|
6096
|
-
];
|
|
6097
|
-
}
|
|
6098
|
-
if (stop === "via") {
|
|
6099
|
-
let color = value;
|
|
6100
|
-
if (extra?.opacity) {
|
|
6101
|
-
color = `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`;
|
|
6102
|
-
}
|
|
6103
|
-
return [
|
|
6104
|
-
gradientStopProperties(),
|
|
6105
|
-
decl(`--baro-gradient-to`, color),
|
|
6106
|
-
decl(`--baro-gradient-stops`, `var(--baro-gradient-from), ${value} var(--baro-gradient-via-position), var(--baro-gradient-to)`)
|
|
6107
|
-
// via 포함 stops
|
|
6108
|
-
];
|
|
6109
|
-
}
|
|
6110
|
-
if (stop === "to") {
|
|
6111
|
-
let color = value;
|
|
6112
|
-
if (extra?.opacity) {
|
|
6113
|
-
color = `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`;
|
|
6114
|
-
}
|
|
6115
|
-
return [
|
|
6116
|
-
gradientStopProperties(),
|
|
6117
|
-
decl(`--baro-gradient-to`, color)
|
|
6118
|
-
];
|
|
6119
|
-
}
|
|
6390
|
+
return stopsDecls(stop, themeColorDecls(`${G}-${stop}`, value, extra));
|
|
6120
6391
|
}
|
|
6121
6392
|
if (parseLength(value)) {
|
|
6122
|
-
return [decl(
|
|
6393
|
+
return [gradientStopProperties(), decl(`${G}-${stop}-position`, value)];
|
|
6123
6394
|
}
|
|
6124
6395
|
if (parseNumber(value)) {
|
|
6125
|
-
return [decl(
|
|
6396
|
+
return [gradientStopProperties(), decl(`${G}-${stop}-position`, `${value}%`)];
|
|
6126
6397
|
}
|
|
6127
6398
|
if (parseColor(value)) {
|
|
6128
|
-
|
|
6129
|
-
return [
|
|
6130
|
-
gradientStopProperties(),
|
|
6131
|
-
decl(`--baro-gradient-from`, value),
|
|
6132
|
-
decl(`--baro-gradient-to`, "transparent"),
|
|
6133
|
-
decl(`--baro-gradient-stops`, "var(--baro-gradient-from),var(--baro-gradient-to)")
|
|
6134
|
-
];
|
|
6135
|
-
}
|
|
6136
|
-
if (stop === "via") {
|
|
6137
|
-
return [
|
|
6138
|
-
gradientStopProperties(),
|
|
6139
|
-
decl(`--baro-gradient-to`, value),
|
|
6140
|
-
decl(`--baro-gradient-stops`, `var(--baro-gradient-from), ${value} var(--baro-gradient-via-position), var(--baro-gradient-to)`)
|
|
6141
|
-
// via 포함 stops
|
|
6142
|
-
];
|
|
6143
|
-
}
|
|
6144
|
-
if (stop === "to") {
|
|
6145
|
-
return [
|
|
6146
|
-
gradientStopProperties(),
|
|
6147
|
-
decl(`--baro-gradient-to`, value)
|
|
6148
|
-
];
|
|
6149
|
-
}
|
|
6399
|
+
return stopsDecls(stop, value);
|
|
6150
6400
|
}
|
|
6151
6401
|
return null;
|
|
6152
6402
|
},
|
|
@@ -6181,20 +6431,7 @@ functionalUtility({
|
|
|
6181
6431
|
if (value.startsWith("length:")) {
|
|
6182
6432
|
return [decl("background-size", value.replace("length:", ""))];
|
|
6183
6433
|
}
|
|
6184
|
-
if (extra?.realThemeValue)
|
|
6185
|
-
if (extra.opacity) {
|
|
6186
|
-
return [
|
|
6187
|
-
atRule("supports", `(color:color-mix(in lab, red, red))`, [
|
|
6188
|
-
decl(
|
|
6189
|
-
"background-color",
|
|
6190
|
-
`color-mix(in lab, ${value} ${extra.opacity}%, transparent)`
|
|
6191
|
-
)
|
|
6192
|
-
]),
|
|
6193
|
-
decl("background-color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
|
|
6194
|
-
];
|
|
6195
|
-
}
|
|
6196
|
-
return [decl("background-color", value)];
|
|
6197
|
-
}
|
|
6434
|
+
if (extra?.realThemeValue) return themeColorDecls("background-color", value, extra);
|
|
6198
6435
|
if (parseColor(value)) {
|
|
6199
6436
|
const parsedColor = parseColor(value);
|
|
6200
6437
|
if (value.startsWith("color:")) {
|
|
@@ -6207,18 +6444,20 @@ functionalUtility({
|
|
|
6207
6444
|
}
|
|
6208
6445
|
return null;
|
|
6209
6446
|
},
|
|
6210
|
-
handleCustomProperty: (value) => [decl("background-size", `var(${value})`)],
|
|
6447
|
+
handleCustomProperty: (value) => value.startsWith("length:") ? [decl("background-size", `var(${value.slice(7)})`)] : [decl("background-color", `var(${value})`)],
|
|
6211
6448
|
description: "background-size utility (arbitrary, custom property supported)",
|
|
6212
6449
|
category: "background"
|
|
6213
6450
|
});
|
|
6214
6451
|
staticUtility("rounded-none", [["border-radius", "0px"]], { category: "borders" });
|
|
6215
6452
|
staticUtility("rounded-sm", [["border-radius", "var(--radius-sm)"]], { category: "borders" });
|
|
6216
|
-
staticUtility("rounded", [["border-radius", "
|
|
6453
|
+
staticUtility("rounded", [["border-radius", "0.25rem"]], { category: "borders" });
|
|
6217
6454
|
staticUtility("rounded-md", [["border-radius", "var(--radius-md)"]], { category: "borders" });
|
|
6218
6455
|
staticUtility("rounded-lg", [["border-radius", "var(--radius-lg)"]], { category: "borders" });
|
|
6219
6456
|
staticUtility("rounded-xl", [["border-radius", "var(--radius-xl)"]], { category: "borders" });
|
|
6220
6457
|
staticUtility("rounded-2xl", [["border-radius", "var(--radius-2xl)"]], { category: "borders" });
|
|
6221
6458
|
staticUtility("rounded-3xl", [["border-radius", "var(--radius-3xl)"]], { category: "borders" });
|
|
6459
|
+
staticUtility("rounded-4xl", [["border-radius", "var(--radius-4xl)"]], { category: "borders" });
|
|
6460
|
+
staticUtility("rounded-xs", [["border-radius", "var(--radius-xs)"]], { category: "borders" });
|
|
6222
6461
|
staticUtility("rounded-full", [["border-radius", "9999px"]], { category: "borders" });
|
|
6223
6462
|
[
|
|
6224
6463
|
["rounded-t", ["border-top-left-radius", "border-top-right-radius"]],
|
|
@@ -6233,12 +6472,14 @@ staticUtility("rounded-full", [["border-radius", "9999px"]], { category: "border
|
|
|
6233
6472
|
const propList = props;
|
|
6234
6473
|
staticUtility(`${name}-none`, propList.map((prop) => [prop, "0px"]), { category: "borders" });
|
|
6235
6474
|
staticUtility(`${name}-sm`, propList.map((prop) => [prop, "var(--radius-sm)"]), { category: "borders" });
|
|
6236
|
-
staticUtility(`${name}`, propList.map((prop) => [prop, "
|
|
6475
|
+
staticUtility(`${name}`, propList.map((prop) => [prop, "0.25rem"]), { category: "borders" });
|
|
6237
6476
|
staticUtility(`${name}-md`, propList.map((prop) => [prop, "var(--radius-md)"]), { category: "borders" });
|
|
6238
6477
|
staticUtility(`${name}-lg`, propList.map((prop) => [prop, "var(--radius-lg)"]), { category: "borders" });
|
|
6239
6478
|
staticUtility(`${name}-xl`, propList.map((prop) => [prop, "var(--radius-xl)"]), { category: "borders" });
|
|
6240
6479
|
staticUtility(`${name}-2xl`, propList.map((prop) => [prop, "var(--radius-2xl)"]), { category: "borders" });
|
|
6241
6480
|
staticUtility(`${name}-3xl`, propList.map((prop) => [prop, "var(--radius-3xl)"]), { category: "borders" });
|
|
6481
|
+
staticUtility(`${name}-4xl`, propList.map((prop) => [prop, "var(--radius-4xl)"]), { category: "borders" });
|
|
6482
|
+
staticUtility(`${name}-xs`, propList.map((prop) => [prop, "var(--radius-xs)"]), { category: "borders" });
|
|
6242
6483
|
staticUtility(`${name}-full`, propList.map((prop) => [prop, "9999px"]), { category: "borders" });
|
|
6243
6484
|
functionalUtility({
|
|
6244
6485
|
name,
|
|
@@ -6269,11 +6510,15 @@ functionalUtility({
|
|
|
6269
6510
|
description: "border-radius utility (spacing, arbitrary, custom property support)",
|
|
6270
6511
|
category: "borders"
|
|
6271
6512
|
});
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6513
|
+
const borderStyleProperty = () => atRoot([property("--baro-border-style", "solid")]);
|
|
6514
|
+
const withBorderStyle = (props, width) => [
|
|
6515
|
+
borderStyleProperty(),
|
|
6516
|
+
...props.map((prop) => decl(prop.replace("width", "style"), "var(--baro-border-style)")),
|
|
6517
|
+
...props.map((prop) => decl(prop, width))
|
|
6518
|
+
];
|
|
6519
|
+
[["border-0", "0px"], ["border-2", "2px"], ["border-4", "4px"], ["border-8", "8px"], ["border", "1px"]].forEach(([name, width]) => {
|
|
6520
|
+
staticUtility(name, [borderStyleProperty, ["border-style", "var(--baro-border-style)"], ["border-width", width]], { category: "borders" });
|
|
6521
|
+
});
|
|
6277
6522
|
[
|
|
6278
6523
|
["border-x", ["border-left-width", "border-right-width"]],
|
|
6279
6524
|
["border-y", ["border-top-width", "border-bottom-width"]],
|
|
@@ -6283,11 +6528,16 @@ staticUtility("border", [["border-width", "1px"]], { category: "borders" });
|
|
|
6283
6528
|
["border-l", ["border-left-width"]]
|
|
6284
6529
|
].forEach(([name, props]) => {
|
|
6285
6530
|
const propList = props;
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6531
|
+
const styled = (width) => [
|
|
6532
|
+
borderStyleProperty,
|
|
6533
|
+
...propList.map((prop) => [prop.replace("width", "style"), "var(--baro-border-style)"]),
|
|
6534
|
+
...propList.map((prop) => [prop, width])
|
|
6535
|
+
];
|
|
6536
|
+
staticUtility(`${name}-0`, styled("0px"));
|
|
6537
|
+
staticUtility(`${name}-2`, styled("2px"));
|
|
6538
|
+
staticUtility(`${name}-4`, styled("4px"));
|
|
6539
|
+
staticUtility(`${name}-8`, styled("8px"));
|
|
6540
|
+
staticUtility(`${name}`, styled("1px"));
|
|
6291
6541
|
functionalUtility({
|
|
6292
6542
|
name,
|
|
6293
6543
|
themeKeys: ["borderWidth", "colors"],
|
|
@@ -6299,18 +6549,19 @@ staticUtility("border", [["border-width", "1px"]], { category: "borders" });
|
|
|
6299
6549
|
}
|
|
6300
6550
|
return null;
|
|
6301
6551
|
},
|
|
6302
|
-
handle: (value, ctx, token) => {
|
|
6552
|
+
handle: (value, ctx, token, extra) => {
|
|
6553
|
+
if (extra?.realThemeValue) return propList.flatMap((prop) => themeColorDecls(prop.replace("width", "color"), value, extra));
|
|
6303
6554
|
if (parseColor(value)) {
|
|
6304
6555
|
return propList.map((prop) => decl(prop.replace("width", "color"), value));
|
|
6305
6556
|
}
|
|
6306
6557
|
if (token.arbitrary) {
|
|
6307
|
-
return propList
|
|
6558
|
+
return withBorderStyle(propList, value);
|
|
6308
6559
|
}
|
|
6309
6560
|
return null;
|
|
6310
6561
|
},
|
|
6311
6562
|
handleCustomProperty: (value) => {
|
|
6312
6563
|
if (value.startsWith("length:")) {
|
|
6313
|
-
return propList
|
|
6564
|
+
return withBorderStyle(propList, `var(${value.replace("length:", "")})`);
|
|
6314
6565
|
}
|
|
6315
6566
|
return propList.map((prop) => decl(prop.replace("width", "color"), `var(${value})`));
|
|
6316
6567
|
},
|
|
@@ -6321,12 +6572,35 @@ staticUtility("border", [["border-width", "1px"]], { category: "borders" });
|
|
|
6321
6572
|
staticUtility("border-inherit", [["border-color", "inherit"]], { category: "borders" });
|
|
6322
6573
|
staticUtility("border-current", [["border-color", "currentColor"]], { category: "borders" });
|
|
6323
6574
|
staticUtility("border-transparent", [["border-color", "transparent"]], { category: "borders" });
|
|
6324
|
-
staticUtility("border-solid", [["border-style", "solid"]], { category: "borders" });
|
|
6325
|
-
staticUtility("border-dashed", [["border-style", "dashed"]], { category: "borders" });
|
|
6326
|
-
staticUtility("border-dotted", [["border-style", "dotted"]], { category: "borders" });
|
|
6327
|
-
staticUtility("border-double", [["border-style", "double"]], { category: "borders" });
|
|
6328
|
-
staticUtility("border-hidden", [["border-style", "hidden"]], { category: "borders" });
|
|
6329
|
-
staticUtility("border-none", [["border-style", "none"]], { category: "borders" });
|
|
6575
|
+
staticUtility("border-solid", [["--baro-border-style", "solid"], ["border-style", "solid"]], { category: "borders" });
|
|
6576
|
+
staticUtility("border-dashed", [["--baro-border-style", "dashed"], ["border-style", "dashed"]], { category: "borders" });
|
|
6577
|
+
staticUtility("border-dotted", [["--baro-border-style", "dotted"], ["border-style", "dotted"]], { category: "borders" });
|
|
6578
|
+
staticUtility("border-double", [["--baro-border-style", "double"], ["border-style", "double"]], { category: "borders" });
|
|
6579
|
+
staticUtility("border-hidden", [["--baro-border-style", "hidden"], ["border-style", "hidden"]], { category: "borders" });
|
|
6580
|
+
staticUtility("border-none", [["--baro-border-style", "none"], ["border-style", "none"]], { category: "borders" });
|
|
6581
|
+
const divideSides = { x: ["border-inline-start", "border-inline-end", "border-inline-style"], y: ["border-top", "border-bottom", "border-bottom-style", "border-top-style"] };
|
|
6582
|
+
Object.entries(divideSides).forEach(([axis, [start, end, ...styles]]) => {
|
|
6583
|
+
const rev = `--baro-divide-${axis}-reverse`;
|
|
6584
|
+
const divide = (width) => [
|
|
6585
|
+
borderStyleProperty(),
|
|
6586
|
+
rule(":where(& > :not(:last-child))", [
|
|
6587
|
+
decl(rev, "0"),
|
|
6588
|
+
...styles.map((s) => decl(s, "var(--baro-border-style)")),
|
|
6589
|
+
decl(`${start}-width`, `calc(${width} * var(${rev}))`),
|
|
6590
|
+
decl(`${end}-width`, `calc(${width} * calc(1 - var(${rev})))`)
|
|
6591
|
+
])
|
|
6592
|
+
];
|
|
6593
|
+
staticUtility(`divide-${axis}`, divide("1px"), { category: "borders" });
|
|
6594
|
+
staticUtility(`divide-${axis}-reverse`, [rule(":where(& > :not(:last-child))", [decl(rev, "1")])], { category: "borders" });
|
|
6595
|
+
functionalUtility({
|
|
6596
|
+
name: `divide-${axis}`,
|
|
6597
|
+
supportsArbitrary: true,
|
|
6598
|
+
handleBareValue: ({ value }) => /^\d+$/.test(value) ? `${value}px` : null,
|
|
6599
|
+
handle: (value) => divide(value),
|
|
6600
|
+
description: `divide-${axis} width utility`,
|
|
6601
|
+
category: "borders"
|
|
6602
|
+
});
|
|
6603
|
+
});
|
|
6330
6604
|
functionalUtility({
|
|
6331
6605
|
name: "border",
|
|
6332
6606
|
themeKeys: ["colors", "borderWidth"],
|
|
@@ -6334,25 +6608,15 @@ functionalUtility({
|
|
|
6334
6608
|
supportsCustomProperty: true,
|
|
6335
6609
|
supportsOpacity: true,
|
|
6336
6610
|
handle: (value, ctx, token, extra) => {
|
|
6337
|
-
if (extra?.realThemeValue)
|
|
6338
|
-
if (extra.opacity) {
|
|
6339
|
-
return [
|
|
6340
|
-
atRule("supports", `(color:color-mix(in lab, red, red))`, [
|
|
6341
|
-
decl("border-color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
|
|
6342
|
-
]),
|
|
6343
|
-
decl("border-color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
|
|
6344
|
-
];
|
|
6345
|
-
}
|
|
6346
|
-
return [decl("border-color", value)];
|
|
6347
|
-
}
|
|
6611
|
+
if (extra?.realThemeValue) return themeColorDecls("border-color", value, extra);
|
|
6348
6612
|
if (token.arbitrary) {
|
|
6349
6613
|
if (parseLength(value)) {
|
|
6350
|
-
return [
|
|
6614
|
+
return withBorderStyle(["border-width"], value);
|
|
6351
6615
|
}
|
|
6352
6616
|
return [decl("border-color", value)];
|
|
6353
6617
|
}
|
|
6354
6618
|
if (parseNumber(value)) {
|
|
6355
|
-
return [
|
|
6619
|
+
return withBorderStyle(["border-width"], `${value}px`);
|
|
6356
6620
|
}
|
|
6357
6621
|
if (parseColor(value)) {
|
|
6358
6622
|
return [decl("border-color", value)];
|
|
@@ -6361,26 +6625,35 @@ functionalUtility({
|
|
|
6361
6625
|
},
|
|
6362
6626
|
handleCustomProperty: (value) => {
|
|
6363
6627
|
if (value.startsWith("length:")) {
|
|
6364
|
-
return [
|
|
6628
|
+
return withBorderStyle(["border-width"], `var(${value.replace("length:", "")})`);
|
|
6365
6629
|
}
|
|
6366
6630
|
return [decl("border-color", `var(${value})`)];
|
|
6367
6631
|
},
|
|
6368
6632
|
description: "border-width utility (number, arbitrary, custom property support)",
|
|
6369
6633
|
category: "borders"
|
|
6370
6634
|
});
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6635
|
+
const outlineStyleProperty = () => atRoot([property("--baro-outline-style", "solid")]);
|
|
6636
|
+
const withOutlineStyle = (width) => [
|
|
6637
|
+
outlineStyleProperty(),
|
|
6638
|
+
decl("outline-style", "var(--baro-outline-style)"),
|
|
6639
|
+
decl("outline-width", width)
|
|
6640
|
+
];
|
|
6641
|
+
[["outline-0", "0px"], ["outline-1", "1px"], ["outline-2", "2px"], ["outline-4", "4px"], ["outline-8", "8px"]].forEach(([name, width]) => {
|
|
6642
|
+
staticUtility(name, [outlineStyleProperty, ["outline-style", "var(--baro-outline-style)"], ["outline-width", width]], { category: "borders" });
|
|
6643
|
+
});
|
|
6376
6644
|
staticUtility("outline-inherit", [["outline-color", "inherit"]], { category: "borders" });
|
|
6377
6645
|
staticUtility("outline-current", [["outline-color", "currentColor"]], { category: "borders" });
|
|
6378
6646
|
staticUtility("outline-transparent", [["outline-color", "transparent"]], { category: "borders" });
|
|
6379
|
-
staticUtility("outline-none", [["outline", "
|
|
6380
|
-
staticUtility("outline", [
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6647
|
+
staticUtility("outline-none", [["--baro-outline-style", "none"], ["outline-style", "none"]], { category: "borders" });
|
|
6648
|
+
staticUtility("outline-hidden", [
|
|
6649
|
+
["--baro-outline-style", "none"],
|
|
6650
|
+
["outline-style", "none"],
|
|
6651
|
+
atRule("media", "(forced-colors: active)", [decl("outline", "2px solid transparent"), decl("outline-offset", "2px")])
|
|
6652
|
+
], { category: "borders" });
|
|
6653
|
+
staticUtility("outline", [outlineStyleProperty, ["outline-style", "var(--baro-outline-style)"], ["outline-width", "1px"]], { category: "borders" });
|
|
6654
|
+
["solid", "dashed", "dotted", "double"].forEach((style) => {
|
|
6655
|
+
staticUtility(`outline-${style}`, [["--baro-outline-style", style], ["outline-style", style]], { category: "borders" });
|
|
6656
|
+
});
|
|
6384
6657
|
staticUtility("outline-offset-0", [["outline-offset", "0px"]], { category: "borders" });
|
|
6385
6658
|
staticUtility("outline-offset-1", [["outline-offset", "1px"]], { category: "borders" });
|
|
6386
6659
|
staticUtility("outline-offset-2", [["outline-offset", "2px"]], { category: "borders" });
|
|
@@ -6405,16 +6678,18 @@ functionalUtility({
|
|
|
6405
6678
|
themeKeys: ["colors", "borderWidth"],
|
|
6406
6679
|
supportsArbitrary: true,
|
|
6407
6680
|
supportsCustomProperty: true,
|
|
6408
|
-
|
|
6681
|
+
supportsOpacity: true,
|
|
6682
|
+
handle: (value, ctx, token, extra) => {
|
|
6683
|
+
if (extra?.realThemeValue) return themeColorDecls("outline-color", value, extra);
|
|
6409
6684
|
if (parseColor(value)) {
|
|
6410
6685
|
return [decl("outline-color", value)];
|
|
6411
6686
|
}
|
|
6412
6687
|
if (parseNumber(value)) {
|
|
6413
|
-
return
|
|
6688
|
+
return withOutlineStyle(`${value}px`);
|
|
6414
6689
|
}
|
|
6415
6690
|
if (token.arbitrary) {
|
|
6416
6691
|
if (parseLength(value)) {
|
|
6417
|
-
return
|
|
6692
|
+
return withOutlineStyle(value);
|
|
6418
6693
|
}
|
|
6419
6694
|
return [decl("outline-color", value)];
|
|
6420
6695
|
}
|
|
@@ -6425,7 +6700,7 @@ functionalUtility({
|
|
|
6425
6700
|
return [decl("outline-color", value.replace("color:", ""))];
|
|
6426
6701
|
}
|
|
6427
6702
|
if (value.startsWith("length:")) {
|
|
6428
|
-
return
|
|
6703
|
+
return withOutlineStyle(`var(${value.replace("length:", "")})`);
|
|
6429
6704
|
}
|
|
6430
6705
|
return [decl("outline-color", `var(${value})`)];
|
|
6431
6706
|
},
|
|
@@ -6446,6 +6721,40 @@ functionalUtility({
|
|
|
6446
6721
|
description: "outline-width utility (number, arbitrary, custom property support)",
|
|
6447
6722
|
category: "borders"
|
|
6448
6723
|
});
|
|
6724
|
+
const divideColor = (value) => [rule(":where(& > :not(:last-child))", [decl("border-color", value)])];
|
|
6725
|
+
staticUtility("divide-inherit", divideColor("inherit"), { category: "borders" });
|
|
6726
|
+
staticUtility("divide-current", divideColor("currentColor"), { category: "borders" });
|
|
6727
|
+
staticUtility("divide-transparent", divideColor("transparent"), { category: "borders" });
|
|
6728
|
+
functionalUtility({
|
|
6729
|
+
name: "divide",
|
|
6730
|
+
themeKeys: ["colors"],
|
|
6731
|
+
supportsArbitrary: true,
|
|
6732
|
+
supportsCustomProperty: true,
|
|
6733
|
+
supportsOpacity: true,
|
|
6734
|
+
handle: (value, _ctx, _token, extra) => {
|
|
6735
|
+
if (extra?.realThemeValue) {
|
|
6736
|
+
return [rule(":where(& > :not(:last-child))", themeColorDecls("border-color", value, extra))];
|
|
6737
|
+
}
|
|
6738
|
+
if (parseColor(value)) return divideColor(value);
|
|
6739
|
+
return null;
|
|
6740
|
+
},
|
|
6741
|
+
handleCustomProperty: (value) => divideColor(`var(${value})`),
|
|
6742
|
+
description: "divide-color utility (theme, alpha, arbitrary, custom property)",
|
|
6743
|
+
category: "borders"
|
|
6744
|
+
});
|
|
6745
|
+
const ROTATE_SKEW = "var(--baro-rotate-x,) var(--baro-rotate-y,) var(--baro-rotate-z,) var(--baro-skew-x,) var(--baro-skew-y,)";
|
|
6746
|
+
const rotateAxis = (axis, fn) => [decl(`--baro-rotate-${axis}`, fn), decl("transform", ROTATE_SKEW)];
|
|
6747
|
+
const skewAxis = (axis, fn) => [decl(`--baro-skew-${axis}`, fn), decl("transform", ROTATE_SKEW)];
|
|
6748
|
+
const scaleProperties = () => atRoot([
|
|
6749
|
+
property("--baro-scale-x", "1"),
|
|
6750
|
+
property("--baro-scale-y", "1"),
|
|
6751
|
+
property("--baro-scale-z", "1")
|
|
6752
|
+
]);
|
|
6753
|
+
const scaleAxis = (axis, v) => [
|
|
6754
|
+
scaleProperties(),
|
|
6755
|
+
decl(`--baro-scale-${axis}`, v),
|
|
6756
|
+
decl("scale", axis === "z" ? "var(--baro-scale-x) var(--baro-scale-y) var(--baro-scale-z)" : "var(--baro-scale-x) var(--baro-scale-y)")
|
|
6757
|
+
];
|
|
6449
6758
|
staticUtility("transform-none", [["transform", "none"]], {
|
|
6450
6759
|
category: "transform"
|
|
6451
6760
|
});
|
|
@@ -6454,7 +6763,7 @@ staticUtility(
|
|
|
6454
6763
|
[
|
|
6455
6764
|
[
|
|
6456
6765
|
"transform",
|
|
6457
|
-
|
|
6766
|
+
`translateZ(0) ${ROTATE_SKEW}`
|
|
6458
6767
|
]
|
|
6459
6768
|
],
|
|
6460
6769
|
{ category: "transform" }
|
|
@@ -6462,7 +6771,7 @@ staticUtility(
|
|
|
6462
6771
|
staticUtility("transform-cpu", [
|
|
6463
6772
|
[
|
|
6464
6773
|
"transform",
|
|
6465
|
-
|
|
6774
|
+
ROTATE_SKEW
|
|
6466
6775
|
]
|
|
6467
6776
|
]);
|
|
6468
6777
|
staticUtility("transform-3d", [["transform-style", "preserve-3d"]], {
|
|
@@ -6591,13 +6900,11 @@ functionalUtility({
|
|
|
6591
6900
|
if (parseNumber(value) || negative) {
|
|
6592
6901
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6593
6902
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6594
|
-
return
|
|
6903
|
+
return rotateAxis("x", `rotateX(${sign}${deg})`);
|
|
6595
6904
|
}
|
|
6596
|
-
return
|
|
6905
|
+
return rotateAxis("x", `rotateX(${value})`);
|
|
6597
6906
|
},
|
|
6598
|
-
handleCustomProperty: (value) =>
|
|
6599
|
-
decl("transform", `rotateX(var(${value})) var(--baro-rotate-y)`)
|
|
6600
|
-
],
|
|
6907
|
+
handleCustomProperty: (value) => rotateAxis("x", `rotateX(var(${value}))`),
|
|
6601
6908
|
description: "rotate-x utility (named, arbitrary, custom property supported)",
|
|
6602
6909
|
category: "transform"
|
|
6603
6910
|
});
|
|
@@ -6611,13 +6918,11 @@ functionalUtility({
|
|
|
6611
6918
|
if (parseNumber(value) || negative) {
|
|
6612
6919
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6613
6920
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6614
|
-
return
|
|
6921
|
+
return rotateAxis("y", `rotateY(${sign}${deg})`);
|
|
6615
6922
|
}
|
|
6616
|
-
return
|
|
6923
|
+
return rotateAxis("y", `rotateY(${value})`);
|
|
6617
6924
|
},
|
|
6618
|
-
handleCustomProperty: (value) =>
|
|
6619
|
-
decl("transform", `var(--baro-rotate-x) rotateY(var(${value}))`)
|
|
6620
|
-
],
|
|
6925
|
+
handleCustomProperty: (value) => rotateAxis("y", `rotateY(var(${value}))`),
|
|
6621
6926
|
description: "rotate-y utility (named, arbitrary, custom property supported)",
|
|
6622
6927
|
category: "transform"
|
|
6623
6928
|
});
|
|
@@ -6631,26 +6936,11 @@ functionalUtility({
|
|
|
6631
6936
|
if (parseNumber(value) || negative) {
|
|
6632
6937
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6633
6938
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6634
|
-
return
|
|
6635
|
-
decl(
|
|
6636
|
-
"transform",
|
|
6637
|
-
`var(--baro-rotate-x) var(--baro-rotate-y) rotateZ(${sign}${deg})`
|
|
6638
|
-
)
|
|
6639
|
-
];
|
|
6939
|
+
return rotateAxis("z", `rotateZ(${sign}${deg})`);
|
|
6640
6940
|
}
|
|
6641
|
-
return
|
|
6642
|
-
decl(
|
|
6643
|
-
"transform",
|
|
6644
|
-
`var(--baro-rotate-x) var(--baro-rotate-y) rotateZ(${value})`
|
|
6645
|
-
)
|
|
6646
|
-
];
|
|
6941
|
+
return rotateAxis("z", `rotateZ(${value})`);
|
|
6647
6942
|
},
|
|
6648
|
-
handleCustomProperty: (value) =>
|
|
6649
|
-
decl(
|
|
6650
|
-
"transform",
|
|
6651
|
-
`var(--baro-rotate-x) var(--baro-rotate-y) rotateZ(var(${value}))`
|
|
6652
|
-
)
|
|
6653
|
-
],
|
|
6943
|
+
handleCustomProperty: (value) => rotateAxis("z", `rotateZ(var(${value}))`),
|
|
6654
6944
|
description: "rotate-z utility (named, arbitrary, custom property supported)",
|
|
6655
6945
|
category: "transform"
|
|
6656
6946
|
});
|
|
@@ -6677,7 +6967,7 @@ functionalUtility({
|
|
|
6677
6967
|
staticUtility("scale-none", [["scale", "none"]], { category: "transform" });
|
|
6678
6968
|
staticUtility(
|
|
6679
6969
|
"scale-3d",
|
|
6680
|
-
[["scale", "var(--baro-scale-x) var(--baro-scale-y) var(--baro-scale-z)"]],
|
|
6970
|
+
[scaleProperties, ["scale", "var(--baro-scale-x) var(--baro-scale-y) var(--baro-scale-z)"]],
|
|
6681
6971
|
{ category: "transform" }
|
|
6682
6972
|
);
|
|
6683
6973
|
functionalUtility({
|
|
@@ -6688,18 +6978,16 @@ functionalUtility({
|
|
|
6688
6978
|
supportsNegative: true,
|
|
6689
6979
|
handle: (value, ctx, { negative, arbitrary }) => {
|
|
6690
6980
|
if (arbitrary) {
|
|
6691
|
-
return
|
|
6981
|
+
return scaleAxis("x", value);
|
|
6692
6982
|
}
|
|
6693
6983
|
if (parseNumber(value) || negative) {
|
|
6694
6984
|
const pct = `${Math.abs(Number(value))}%`;
|
|
6695
6985
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6696
|
-
return
|
|
6986
|
+
return scaleAxis("x", `calc(${pct} * ${sign}1)`);
|
|
6697
6987
|
}
|
|
6698
|
-
return
|
|
6988
|
+
return scaleAxis("x", value);
|
|
6699
6989
|
},
|
|
6700
|
-
handleCustomProperty: (value) =>
|
|
6701
|
-
decl("scale", `var(${value}) var(--baro-scale-y)`)
|
|
6702
|
-
],
|
|
6990
|
+
handleCustomProperty: (value) => scaleAxis("x", `var(${value})`),
|
|
6703
6991
|
description: "scale-x utility (named, arbitrary, custom property supported)",
|
|
6704
6992
|
category: "transform"
|
|
6705
6993
|
});
|
|
@@ -6711,18 +6999,16 @@ functionalUtility({
|
|
|
6711
6999
|
supportsNegative: true,
|
|
6712
7000
|
handle: (value, ctx, { negative, arbitrary }) => {
|
|
6713
7001
|
if (arbitrary) {
|
|
6714
|
-
return
|
|
7002
|
+
return scaleAxis("y", value);
|
|
6715
7003
|
}
|
|
6716
7004
|
if (parseNumber(value) || negative) {
|
|
6717
7005
|
const pct = `${Math.abs(Number(value))}%`;
|
|
6718
7006
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6719
|
-
return
|
|
7007
|
+
return scaleAxis("y", `calc(${pct} * ${sign}1)`);
|
|
6720
7008
|
}
|
|
6721
|
-
return
|
|
7009
|
+
return scaleAxis("y", value);
|
|
6722
7010
|
},
|
|
6723
|
-
handleCustomProperty: (value) =>
|
|
6724
|
-
decl("scale", `var(--baro-scale-x) var(${value})`)
|
|
6725
|
-
],
|
|
7011
|
+
handleCustomProperty: (value) => scaleAxis("y", `var(${value})`),
|
|
6726
7012
|
description: "scale-y utility (named, arbitrary, custom property supported)",
|
|
6727
7013
|
category: "transform"
|
|
6728
7014
|
});
|
|
@@ -6734,25 +7020,16 @@ functionalUtility({
|
|
|
6734
7020
|
supportsNegative: true,
|
|
6735
7021
|
handle: (value, ctx, { negative, arbitrary }) => {
|
|
6736
7022
|
if (arbitrary) {
|
|
6737
|
-
return
|
|
6738
|
-
decl("scale", `var(--baro-scale-x) var(--baro-scale-y) ${value}`)
|
|
6739
|
-
];
|
|
7023
|
+
return scaleAxis("z", value);
|
|
6740
7024
|
}
|
|
6741
7025
|
if (parseNumber(value) || negative) {
|
|
6742
7026
|
const pct = `${Math.abs(Number(value))}%`;
|
|
6743
7027
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6744
|
-
return
|
|
6745
|
-
decl(
|
|
6746
|
-
"scale",
|
|
6747
|
-
`var(--baro-scale-x) var(--baro-scale-y) calc(${pct} * ${sign}1)`
|
|
6748
|
-
)
|
|
6749
|
-
];
|
|
7028
|
+
return scaleAxis("z", `calc(${pct} * ${sign}1)`);
|
|
6750
7029
|
}
|
|
6751
|
-
return
|
|
7030
|
+
return scaleAxis("z", value);
|
|
6752
7031
|
},
|
|
6753
|
-
handleCustomProperty: (value) =>
|
|
6754
|
-
decl("scale", `var(--baro-scale-x) var(--baro-scale-y) var(${value})`)
|
|
6755
|
-
],
|
|
7032
|
+
handleCustomProperty: (value) => scaleAxis("z", `var(${value})`),
|
|
6756
7033
|
description: "scale-z utility (named, arbitrary, custom property supported)",
|
|
6757
7034
|
category: "transform"
|
|
6758
7035
|
});
|
|
@@ -6791,11 +7068,11 @@ functionalUtility({
|
|
|
6791
7068
|
if (parseNumber(value) || negative) {
|
|
6792
7069
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6793
7070
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6794
|
-
return
|
|
7071
|
+
return skewAxis("x", `skewX(${sign}${deg})`);
|
|
6795
7072
|
}
|
|
6796
|
-
return
|
|
7073
|
+
return skewAxis("x", `skewX(${value})`);
|
|
6797
7074
|
},
|
|
6798
|
-
handleCustomProperty: (value) =>
|
|
7075
|
+
handleCustomProperty: (value) => skewAxis("x", `skewX(var(${value}))`),
|
|
6799
7076
|
description: "skew-x utility (named, arbitrary, custom property supported)",
|
|
6800
7077
|
category: "transform"
|
|
6801
7078
|
});
|
|
@@ -6809,11 +7086,11 @@ functionalUtility({
|
|
|
6809
7086
|
if (parseNumber(value) || negative) {
|
|
6810
7087
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6811
7088
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6812
|
-
return
|
|
7089
|
+
return skewAxis("y", `skewY(${sign}${deg})`);
|
|
6813
7090
|
}
|
|
6814
|
-
return
|
|
7091
|
+
return skewAxis("y", `skewY(${value})`);
|
|
6815
7092
|
},
|
|
6816
|
-
handleCustomProperty: (value) =>
|
|
7093
|
+
handleCustomProperty: (value) => skewAxis("y", `skewY(var(${value}))`),
|
|
6817
7094
|
description: "skew-y utility (named, arbitrary, custom property supported)",
|
|
6818
7095
|
category: "transform"
|
|
6819
7096
|
});
|
|
@@ -6827,12 +7104,14 @@ functionalUtility({
|
|
|
6827
7104
|
if (parseNumber(value) || negative) {
|
|
6828
7105
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6829
7106
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6830
|
-
return [decl("
|
|
7107
|
+
return [decl("--baro-skew-x", `skewX(${sign}${deg})`), decl("--baro-skew-y", `skewY(${sign}${deg})`), decl("transform", ROTATE_SKEW)];
|
|
6831
7108
|
}
|
|
6832
|
-
return [decl("
|
|
7109
|
+
return [decl("--baro-skew-x", `skewX(${value})`), decl("--baro-skew-y", `skewY(${value})`), decl("transform", ROTATE_SKEW)];
|
|
6833
7110
|
},
|
|
6834
7111
|
handleCustomProperty: (value) => [
|
|
6835
|
-
decl("
|
|
7112
|
+
decl("--baro-skew-x", `skewX(var(${value}))`),
|
|
7113
|
+
decl("--baro-skew-y", `skewY(var(${value}))`),
|
|
7114
|
+
decl("transform", ROTATE_SKEW)
|
|
6836
7115
|
],
|
|
6837
7116
|
description: "skew utility (named, arbitrary, custom property supported)",
|
|
6838
7117
|
category: "transform"
|
|
@@ -6877,6 +7156,22 @@ const translateProperties = () => atRoot([
|
|
|
6877
7156
|
property("--baro-translate-y", "0"),
|
|
6878
7157
|
property("--baro-translate-z", "0")
|
|
6879
7158
|
]);
|
|
7159
|
+
const translateAxis = (axis, v) => [
|
|
7160
|
+
translateProperties(),
|
|
7161
|
+
decl(`--baro-translate-${axis}`, v),
|
|
7162
|
+
decl(
|
|
7163
|
+
"translate",
|
|
7164
|
+
axis === "z" ? "var(--baro-translate-x) var(--baro-translate-y) var(--baro-translate-z)" : "var(--baro-translate-x) var(--baro-translate-y)"
|
|
7165
|
+
)
|
|
7166
|
+
];
|
|
7167
|
+
const staticTranslateAxis = (axis, v) => [
|
|
7168
|
+
translateProperties,
|
|
7169
|
+
[`--baro-translate-${axis}`, v],
|
|
7170
|
+
[
|
|
7171
|
+
"translate",
|
|
7172
|
+
axis === "z" ? "var(--baro-translate-x) var(--baro-translate-y) var(--baro-translate-z)" : "var(--baro-translate-x) var(--baro-translate-y)"
|
|
7173
|
+
]
|
|
7174
|
+
];
|
|
6880
7175
|
staticUtility("translate-none", [["translate", "none"]], {
|
|
6881
7176
|
category: "transform"
|
|
6882
7177
|
});
|
|
@@ -6908,52 +7203,52 @@ staticUtility(
|
|
|
6908
7203
|
);
|
|
6909
7204
|
staticUtility(
|
|
6910
7205
|
"translate-x-px",
|
|
6911
|
-
|
|
7206
|
+
staticTranslateAxis("x", "1px"),
|
|
6912
7207
|
{ category: "transform" }
|
|
6913
7208
|
);
|
|
6914
7209
|
staticUtility(
|
|
6915
7210
|
"-translate-x-px",
|
|
6916
|
-
|
|
7211
|
+
staticTranslateAxis("x", "-1px"),
|
|
6917
7212
|
{ category: "transform" }
|
|
6918
7213
|
);
|
|
6919
7214
|
staticUtility(
|
|
6920
7215
|
"translate-x-full",
|
|
6921
|
-
|
|
7216
|
+
staticTranslateAxis("x", "100%"),
|
|
6922
7217
|
{ category: "transform" }
|
|
6923
7218
|
);
|
|
6924
7219
|
staticUtility(
|
|
6925
7220
|
"-translate-x-full",
|
|
6926
|
-
|
|
7221
|
+
staticTranslateAxis("x", "-100%"),
|
|
6927
7222
|
{ category: "transform" }
|
|
6928
7223
|
);
|
|
6929
7224
|
staticUtility(
|
|
6930
7225
|
"translate-y-px",
|
|
6931
|
-
|
|
7226
|
+
staticTranslateAxis("y", "1px"),
|
|
6932
7227
|
{ category: "transform" }
|
|
6933
7228
|
);
|
|
6934
7229
|
staticUtility(
|
|
6935
7230
|
"-translate-y-px",
|
|
6936
|
-
|
|
7231
|
+
staticTranslateAxis("y", "-1px"),
|
|
6937
7232
|
{ category: "transform" }
|
|
6938
7233
|
);
|
|
6939
7234
|
staticUtility(
|
|
6940
7235
|
"translate-y-full",
|
|
6941
|
-
|
|
7236
|
+
staticTranslateAxis("y", "100%"),
|
|
6942
7237
|
{ category: "transform" }
|
|
6943
7238
|
);
|
|
6944
7239
|
staticUtility(
|
|
6945
7240
|
"-translate-y-full",
|
|
6946
|
-
|
|
7241
|
+
staticTranslateAxis("y", "-100%"),
|
|
6947
7242
|
{ category: "transform" }
|
|
6948
7243
|
);
|
|
6949
7244
|
staticUtility(
|
|
6950
7245
|
"translate-z-px",
|
|
6951
|
-
|
|
7246
|
+
staticTranslateAxis("z", "1px"),
|
|
6952
7247
|
{ category: "transform" }
|
|
6953
7248
|
);
|
|
6954
7249
|
staticUtility(
|
|
6955
7250
|
"-translate-z-px",
|
|
6956
|
-
|
|
7251
|
+
staticTranslateAxis("z", "-1px"),
|
|
6957
7252
|
{ category: "transform" }
|
|
6958
7253
|
);
|
|
6959
7254
|
functionalUtility({
|
|
@@ -6963,19 +7258,17 @@ functionalUtility({
|
|
|
6963
7258
|
supportsArbitrary: true,
|
|
6964
7259
|
supportsCustomProperty: true,
|
|
6965
7260
|
handle: (value, ctx, { negative }) => {
|
|
6966
|
-
if (parseFractionOrNumber(value)) {
|
|
7261
|
+
if (value.includes("/") && parseFractionOrNumber(value)) {
|
|
6967
7262
|
const v = `calc(${value} * 100%)`;
|
|
6968
|
-
return
|
|
7263
|
+
return translateAxis("x", v);
|
|
6969
7264
|
}
|
|
6970
7265
|
if (parseNumber(value) || negative) {
|
|
6971
7266
|
const v = `calc(var(--spacing) * ${value})`;
|
|
6972
|
-
return
|
|
7267
|
+
return translateAxis("x", v);
|
|
6973
7268
|
}
|
|
6974
|
-
return
|
|
7269
|
+
return translateAxis("x", value);
|
|
6975
7270
|
},
|
|
6976
|
-
handleCustomProperty: (value) =>
|
|
6977
|
-
decl("translate", `var(${value}) var(--baro-translate-y)`)
|
|
6978
|
-
],
|
|
7271
|
+
handleCustomProperty: (value) => translateAxis("x", `var(${value})`),
|
|
6979
7272
|
description: "translate-x utility (spacing, fraction, arbitrary, custom property, negative)",
|
|
6980
7273
|
category: "transform"
|
|
6981
7274
|
});
|
|
@@ -6986,19 +7279,17 @@ functionalUtility({
|
|
|
6986
7279
|
supportsArbitrary: true,
|
|
6987
7280
|
supportsCustomProperty: true,
|
|
6988
7281
|
handle: (value, ctx, { negative }) => {
|
|
6989
|
-
if (parseFractionOrNumber(value)) {
|
|
7282
|
+
if (value.includes("/") && parseFractionOrNumber(value)) {
|
|
6990
7283
|
const v = `calc(${value} * 100%)`;
|
|
6991
|
-
return
|
|
7284
|
+
return translateAxis("y", v);
|
|
6992
7285
|
}
|
|
6993
7286
|
if (parseNumber(value) || negative) {
|
|
6994
7287
|
const v = `calc(var(--spacing) * ${value})`;
|
|
6995
|
-
return
|
|
7288
|
+
return translateAxis("y", v);
|
|
6996
7289
|
}
|
|
6997
|
-
return
|
|
7290
|
+
return translateAxis("y", value);
|
|
6998
7291
|
},
|
|
6999
|
-
handleCustomProperty: (value) =>
|
|
7000
|
-
decl("translate", `var(--baro-translate-x) var(${value})`)
|
|
7001
|
-
],
|
|
7292
|
+
handleCustomProperty: (value) => translateAxis("y", `var(${value})`),
|
|
7002
7293
|
description: "translate-y utility (spacing, fraction, arbitrary, custom property, negative)",
|
|
7003
7294
|
category: "transform"
|
|
7004
7295
|
});
|
|
@@ -7009,37 +7300,17 @@ functionalUtility({
|
|
|
7009
7300
|
supportsArbitrary: true,
|
|
7010
7301
|
supportsCustomProperty: true,
|
|
7011
7302
|
handle: (value, ctx, { negative }) => {
|
|
7012
|
-
if (parseFractionOrNumber(value)) {
|
|
7303
|
+
if (value.includes("/") && parseFractionOrNumber(value)) {
|
|
7013
7304
|
const v = `calc(${value} * 100%)`;
|
|
7014
|
-
return
|
|
7015
|
-
decl(
|
|
7016
|
-
"translate",
|
|
7017
|
-
`var(--baro-translate-x) var(--baro-translate-y) ${v}`
|
|
7018
|
-
)
|
|
7019
|
-
];
|
|
7305
|
+
return translateAxis("z", v);
|
|
7020
7306
|
}
|
|
7021
7307
|
if (parseNumber(value) || negative) {
|
|
7022
7308
|
const v = `calc(var(--spacing) * ${value})`;
|
|
7023
|
-
return
|
|
7024
|
-
decl(
|
|
7025
|
-
"translate",
|
|
7026
|
-
`var(--baro-translate-x) var(--baro-translate-y) ${v}`
|
|
7027
|
-
)
|
|
7028
|
-
];
|
|
7309
|
+
return translateAxis("z", v);
|
|
7029
7310
|
}
|
|
7030
|
-
return
|
|
7031
|
-
decl(
|
|
7032
|
-
"translate",
|
|
7033
|
-
`var(--baro-translate-x) var(--baro-translate-y) ${value}`
|
|
7034
|
-
)
|
|
7035
|
-
];
|
|
7311
|
+
return translateAxis("z", value);
|
|
7036
7312
|
},
|
|
7037
|
-
handleCustomProperty: (value) =>
|
|
7038
|
-
decl(
|
|
7039
|
-
"translate",
|
|
7040
|
-
`var(--baro-translate-x) var(--baro-translate-y) var(${value})`
|
|
7041
|
-
)
|
|
7042
|
-
],
|
|
7313
|
+
handleCustomProperty: (value) => translateAxis("z", `var(${value})`),
|
|
7043
7314
|
description: "translate-z utility (spacing, fraction, arbitrary, custom property, negative)",
|
|
7044
7315
|
category: "transform"
|
|
7045
7316
|
});
|
|
@@ -7050,7 +7321,7 @@ functionalUtility({
|
|
|
7050
7321
|
supportsArbitrary: true,
|
|
7051
7322
|
supportsCustomProperty: true,
|
|
7052
7323
|
handle: (value, ctx, { negative }) => {
|
|
7053
|
-
if (parseFractionOrNumber(value)) {
|
|
7324
|
+
if (value.includes("/") && parseFractionOrNumber(value)) {
|
|
7054
7325
|
const v = `calc(${value} * 100%)`;
|
|
7055
7326
|
return [decl("translate", `${v} ${v}`)];
|
|
7056
7327
|
}
|
|
@@ -7215,8 +7486,13 @@ staticModifier("rtl", ["&[dir=rtl]"], { order: 20, source: "attribute" });
|
|
|
7215
7486
|
staticModifier("ltr", ["&[dir=ltr]"], { order: 20, source: "attribute" });
|
|
7216
7487
|
staticModifier("inert", ["&[inert]"], { order: 40, source: "attribute" });
|
|
7217
7488
|
staticModifier("open", ["&:is([open], :popover-open, :open)"], { order: 40, source: "attribute" });
|
|
7218
|
-
|
|
7219
|
-
|
|
7489
|
+
const withPseudoContent = (ast) => [
|
|
7490
|
+
atRoot([property("--baro-content", '""')]),
|
|
7491
|
+
...ast,
|
|
7492
|
+
decl("content", "var(--baro-content)")
|
|
7493
|
+
];
|
|
7494
|
+
staticModifier("before", ["&::before"], { source: "pseudo", astHandler: withPseudoContent });
|
|
7495
|
+
staticModifier("after", ["&::after"], { source: "pseudo", astHandler: withPseudoContent });
|
|
7220
7496
|
staticModifier("placeholder", [
|
|
7221
7497
|
"&::placeholder",
|
|
7222
7498
|
"&::-webkit-input-placeholder",
|
|
@@ -7249,9 +7525,6 @@ function createContainerParams(type, value, name) {
|
|
|
7249
7525
|
const condition = type === "min" ? "width >=" : "width <";
|
|
7250
7526
|
return name ? `${name} (${condition} ${value})` : `(${condition} ${value})`;
|
|
7251
7527
|
}
|
|
7252
|
-
function getThemeSize(ctx, key) {
|
|
7253
|
-
return ctx.theme("container." + key) || ctx.theme("breakpoint." + key);
|
|
7254
|
-
}
|
|
7255
7528
|
function createContainerRule(params, ast) {
|
|
7256
7529
|
return {
|
|
7257
7530
|
type: "at-rule",
|
|
@@ -7271,6 +7544,35 @@ function getDefaultBreakpoint(breakpoint) {
|
|
|
7271
7544
|
};
|
|
7272
7545
|
return defaults[breakpoint] || `(min-width: ${breakpoint})`;
|
|
7273
7546
|
}
|
|
7547
|
+
function decodeArbitrarySelector(value) {
|
|
7548
|
+
return value.replace(/\\_|_/g, (m) => m === "_" ? " " : "_");
|
|
7549
|
+
}
|
|
7550
|
+
function attributeVariantSelector(variant) {
|
|
7551
|
+
const bracket = /^(data|aria)-\[([a-zA-Z0-9_-]+)(?:=([^\]]+))?\]$/.exec(variant);
|
|
7552
|
+
if (bracket) {
|
|
7553
|
+
const [, kind, key, raw2] = bracket;
|
|
7554
|
+
if (raw2 === void 0) return `[${kind}-${key}]`;
|
|
7555
|
+
const value = /^(["']).*\1$/.test(raw2) ? raw2 : `"${decodeArbitrarySelector(raw2)}"`;
|
|
7556
|
+
return `[${kind}-${key}=${value}]`;
|
|
7557
|
+
}
|
|
7558
|
+
const bare = /^data-([a-zA-Z0-9_-]+)$/.exec(variant);
|
|
7559
|
+
return bare ? `[data-${bare[1]}]` : void 0;
|
|
7560
|
+
}
|
|
7561
|
+
function functionalArgument(value) {
|
|
7562
|
+
const v = decodeArbitrarySelector(value);
|
|
7563
|
+
return /^[>+~]/.test(v.trim()) || !hasTopLevelComma(v) ? v : `*:is(${v})`;
|
|
7564
|
+
}
|
|
7565
|
+
function hasTopLevelComma(value) {
|
|
7566
|
+
let depth = 0;
|
|
7567
|
+
for (let i = 0; i < value.length; i++) {
|
|
7568
|
+
const c = value[i];
|
|
7569
|
+
if (c === "\\") i++;
|
|
7570
|
+
else if (c === "(" || c === "[") depth++;
|
|
7571
|
+
else if (c === ")" || c === "]") depth--;
|
|
7572
|
+
else if (c === "," && depth === 0) return true;
|
|
7573
|
+
}
|
|
7574
|
+
return false;
|
|
7575
|
+
}
|
|
7274
7576
|
functionalModifier(
|
|
7275
7577
|
(mod, context) => {
|
|
7276
7578
|
const breakpoints = context.theme("breakpoints") || context.config("theme.breakpoints") || {};
|
|
@@ -7301,7 +7603,7 @@ functionalModifier(
|
|
|
7301
7603
|
const breakpoints = context.theme("breakpoints") || context.config("theme.breakpoints") || {};
|
|
7302
7604
|
if (Object.keys(breakpoints).includes(breakpoint)) {
|
|
7303
7605
|
let mediaQuery = context.theme(`breakpoints.${breakpoint}`) || getDefaultBreakpoint(breakpoint);
|
|
7304
|
-
if (/^\d+(px|em|rem)?$/.test(mediaQuery)) {
|
|
7606
|
+
if (/^\d*\.?\d+(px|em|rem)?$/.test(mediaQuery)) {
|
|
7305
7607
|
mediaQuery = `(min-width: ${mediaQuery})`;
|
|
7306
7608
|
}
|
|
7307
7609
|
return [atRule("media", mediaQuery, [], "responsive")];
|
|
@@ -7320,6 +7622,8 @@ functionalModifier(
|
|
|
7320
7622
|
if (value) {
|
|
7321
7623
|
mediaQuery = `(width < ${value})`;
|
|
7322
7624
|
}
|
|
7625
|
+
} else if (/^\d*\.?\d+(px|em|rem)?$/.test(mediaQuery)) {
|
|
7626
|
+
mediaQuery = `(width < ${mediaQuery})`;
|
|
7323
7627
|
}
|
|
7324
7628
|
return [atRule("media", mediaQuery, [], "responsive")];
|
|
7325
7629
|
}
|
|
@@ -7388,132 +7692,137 @@ functionalModifier(
|
|
|
7388
7692
|
return result;
|
|
7389
7693
|
}
|
|
7390
7694
|
);
|
|
7695
|
+
const SIZE_VARIANT = /^@(?:(min|max)-)?(\[[^\]]+\]|[a-zA-Z0-9.]+)(?:\/([a-zA-Z0-9_-]+))?$/;
|
|
7391
7696
|
functionalModifier(
|
|
7392
|
-
(mod) =>
|
|
7393
|
-
void 0,
|
|
7394
|
-
(mod, context) => {
|
|
7395
|
-
const containerMatch = /^@container\/([a-zA-Z0-9_-]+)$/.exec(mod.type);
|
|
7396
|
-
if (containerMatch) {
|
|
7397
|
-
const name = containerMatch[1];
|
|
7398
|
-
const params = name;
|
|
7399
|
-
return [createContainerRule(params, [])];
|
|
7400
|
-
}
|
|
7401
|
-
return [];
|
|
7402
|
-
}
|
|
7403
|
-
);
|
|
7404
|
-
functionalModifier(
|
|
7405
|
-
(mod) => /^@container\/([a-zA-Z0-9_-]+)\s+\(([^)]+)\)$/.test(mod),
|
|
7697
|
+
(mod) => SIZE_VARIANT.test(mod) && !/^@container(?:\/|$)/.test(mod),
|
|
7406
7698
|
void 0,
|
|
7407
7699
|
(mod, context) => {
|
|
7408
|
-
const
|
|
7409
|
-
if (
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
return [];
|
|
7700
|
+
const m = SIZE_VARIANT.exec(mod.type);
|
|
7701
|
+
if (!m) return [];
|
|
7702
|
+
const [, type, size, name] = m;
|
|
7703
|
+
const value = size.startsWith("[") ? size.slice(1, -1).replace(/_/g, " ") : context.theme("container." + size);
|
|
7704
|
+
if (!value) return [];
|
|
7705
|
+
return [createContainerRule(createContainerParams(type === "max" ? "max" : "min", value, name), [])];
|
|
7415
7706
|
}
|
|
7416
7707
|
);
|
|
7708
|
+
const startsAtRule = (bracket) => /^[\s_]*@/.test(bracket);
|
|
7417
7709
|
functionalModifier(
|
|
7418
|
-
(mod) =>
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7710
|
+
(mod) => /^has-\[.*\]$/.test(mod) && !startsAtRule(mod.slice(5)),
|
|
7711
|
+
({ selector, mod }) => {
|
|
7712
|
+
const m = /^has-\[(.+)\]$/.exec(mod.type);
|
|
7713
|
+
return m ? {
|
|
7714
|
+
selector: `&:has(${functionalArgument(m[1])})`,
|
|
7715
|
+
flatten: false,
|
|
7716
|
+
wrappingType: "rule",
|
|
7717
|
+
source: "attribute"
|
|
7718
|
+
} : {
|
|
7719
|
+
selector,
|
|
7720
|
+
source: "attribute"
|
|
7721
|
+
};
|
|
7722
|
+
},
|
|
7723
|
+
void 0
|
|
7430
7724
|
);
|
|
7431
7725
|
functionalModifier(
|
|
7432
|
-
(mod) =>
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
return [createContainerRule(params, [])];
|
|
7441
|
-
}
|
|
7442
|
-
return [];
|
|
7443
|
-
}
|
|
7726
|
+
(mod) => /^has-(data|aria)-/.test(mod) && !!attributeVariantSelector(mod.slice(4)),
|
|
7727
|
+
({ mod }) => ({
|
|
7728
|
+
selector: `&:has(*${attributeVariantSelector(mod.type.slice(4))})`,
|
|
7729
|
+
flatten: false,
|
|
7730
|
+
wrappingType: "rule",
|
|
7731
|
+
source: "attribute"
|
|
7732
|
+
}),
|
|
7733
|
+
void 0
|
|
7444
7734
|
);
|
|
7735
|
+
function innerCompound(variant, ctx) {
|
|
7736
|
+
const attr = attributeVariantSelector(variant);
|
|
7737
|
+
if (attr) return { compound: attr };
|
|
7738
|
+
if (/^(has|in|not|group|peer)-|[^a-z0-9-]/.test(variant)) return void 0;
|
|
7739
|
+
const inner = getModifier(ctx).find((m) => m.match(variant, ctx));
|
|
7740
|
+
if (!inner?.modifySelector || inner.astHandler) return void 0;
|
|
7741
|
+
const out = inner.modifySelector({ selector: "&", fullClassName: "", mod: { type: variant }, context: ctx });
|
|
7742
|
+
const list = typeof out === "string" ? [{ selector: out }] : Array.isArray(out) ? out : [out];
|
|
7743
|
+
if (list.length !== 1) return void 0;
|
|
7744
|
+
const sel = list[0].selector;
|
|
7745
|
+
if (!/^&[:[]/.test(sel) || sel.slice(1).includes("&") || /[\s,>+~]/.test(sel.replace(/\([^()]*\)/g, ""))) return void 0;
|
|
7746
|
+
return { compound: sel.slice(1), inner };
|
|
7747
|
+
}
|
|
7748
|
+
function resolveHasIn(mod, ctx) {
|
|
7749
|
+
const m = /^(has|in)-(.+)$/.exec(mod);
|
|
7750
|
+
if (!m) return void 0;
|
|
7751
|
+
const [, kind, v] = m;
|
|
7752
|
+
if (kind === "in" && /^\[.+\]$/.test(v)) {
|
|
7753
|
+
if (startsAtRule(v.slice(1))) return void 0;
|
|
7754
|
+
const sel = decodeArbitrarySelector(v.slice(1, -1));
|
|
7755
|
+
return { kind, compound: sel.startsWith("&") ? sel.slice(1) : `:is(${sel})` };
|
|
7756
|
+
}
|
|
7757
|
+
if (kind === "has" && (v.startsWith("[") || /^(data|aria)-/.test(v))) return void 0;
|
|
7758
|
+
const r = innerCompound(v, ctx);
|
|
7759
|
+
return r && { kind, ...r };
|
|
7760
|
+
}
|
|
7761
|
+
const hasInSelector = ({ selector, mod, context }) => {
|
|
7762
|
+
const r = resolveHasIn(mod.type, context);
|
|
7763
|
+
if (!r) return { selector };
|
|
7764
|
+
return {
|
|
7765
|
+
selector: r.kind === "has" ? `&:has(*${r.compound})` : `:where(*${r.compound}) &`,
|
|
7766
|
+
flatten: false,
|
|
7767
|
+
wrappingType: "rule",
|
|
7768
|
+
source: "attribute"
|
|
7769
|
+
};
|
|
7770
|
+
};
|
|
7445
7771
|
functionalModifier(
|
|
7446
|
-
(mod) =>
|
|
7447
|
-
|
|
7448
|
-
(mod, context) => {
|
|
7449
|
-
const themeSizeMatch = /^@max-(sm|md|lg|xl|2xl)$/.exec(mod.type);
|
|
7450
|
-
if (themeSizeMatch) {
|
|
7451
|
-
const size = themeSizeMatch[1];
|
|
7452
|
-
const sizeValue = getThemeSize(context, size) || size;
|
|
7453
|
-
const params = createContainerParams("max", sizeValue);
|
|
7454
|
-
return [createContainerRule(params, [])];
|
|
7455
|
-
}
|
|
7456
|
-
return [];
|
|
7457
|
-
}
|
|
7772
|
+
(mod, ctx) => !!resolveHasIn(mod, ctx)?.inner?.wrap,
|
|
7773
|
+
hasInSelector,
|
|
7774
|
+
(mod, context) => resolveHasIn(mod.type, context).inner.wrap({ ...mod, type: mod.type.replace(/^(has|in)-/, "") }, context)
|
|
7458
7775
|
);
|
|
7459
7776
|
functionalModifier(
|
|
7460
|
-
(mod) =>
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
const [, type, value] = arbitraryMatch;
|
|
7466
|
-
const params = createContainerParams(type, value);
|
|
7467
|
-
return [createContainerRule(params, [])];
|
|
7468
|
-
}
|
|
7469
|
-
return [];
|
|
7470
|
-
}
|
|
7777
|
+
(mod, ctx) => {
|
|
7778
|
+
const r = resolveHasIn(mod, ctx);
|
|
7779
|
+
return !!r && !r.inner?.wrap;
|
|
7780
|
+
},
|
|
7781
|
+
hasInSelector
|
|
7471
7782
|
);
|
|
7783
|
+
function resolveGroupHas(mod, ctx) {
|
|
7784
|
+
const m = /^(group|peer)-has-(.+?)(?:\/([a-zA-Z0-9_-]+))?$/.exec(mod);
|
|
7785
|
+
if (!m) return void 0;
|
|
7786
|
+
const kind = m[1];
|
|
7787
|
+
const v = m[2];
|
|
7788
|
+
const base = m[3] ? `.${kind}\\/${m[3]}` : `.${kind}`;
|
|
7789
|
+
if (/^\[.+\]$/.test(v)) {
|
|
7790
|
+
if (startsAtRule(v.slice(1))) return void 0;
|
|
7791
|
+
const sel = decodeArbitrarySelector(v.slice(1, -1));
|
|
7792
|
+
return { kind, base, v, arg: /^[>+~]/.test(sel.trim()) ? sel : `*:is(${sel})` };
|
|
7793
|
+
}
|
|
7794
|
+
const r = innerCompound(v, ctx);
|
|
7795
|
+
return r && { kind, base, v, arg: `*${r.compound}`, inner: r.inner };
|
|
7796
|
+
}
|
|
7797
|
+
const groupHasSelector = ({ selector, mod, context }) => {
|
|
7798
|
+
const r = resolveGroupHas(mod.type, context);
|
|
7799
|
+
if (!r) return { selector };
|
|
7800
|
+
const tail = r.kind === "group" ? " *" : " ~ *";
|
|
7801
|
+
return { selector: `&:is(:where(${r.base}):has(${r.arg})${tail})`, wrappingType: "rule", source: r.kind };
|
|
7802
|
+
};
|
|
7472
7803
|
functionalModifier(
|
|
7473
|
-
(mod) =>
|
|
7474
|
-
|
|
7804
|
+
(mod, ctx) => !!resolveGroupHas(mod, ctx)?.inner?.wrap,
|
|
7805
|
+
groupHasSelector,
|
|
7475
7806
|
(mod, context) => {
|
|
7476
|
-
const
|
|
7477
|
-
|
|
7478
|
-
const [, type, value, name] = arbitraryNamedMatch;
|
|
7479
|
-
const params = createContainerParams(type, value, name);
|
|
7480
|
-
return [createContainerRule(params, [])];
|
|
7481
|
-
}
|
|
7482
|
-
return [];
|
|
7807
|
+
const r = resolveGroupHas(mod.type, context);
|
|
7808
|
+
return r.inner.wrap({ ...mod, type: r.v }, context);
|
|
7483
7809
|
}
|
|
7484
7810
|
);
|
|
7485
7811
|
functionalModifier(
|
|
7486
|
-
(mod) =>
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
if (m && m[1].startsWith(".")) {
|
|
7490
|
-
return {
|
|
7491
|
-
selector: `&:has(${m[1]})`,
|
|
7492
|
-
flatten: false,
|
|
7493
|
-
wrappingType: "rule",
|
|
7494
|
-
source: "attribute"
|
|
7495
|
-
};
|
|
7496
|
-
}
|
|
7497
|
-
return m ? {
|
|
7498
|
-
selector: `&:has(${m[1]})`,
|
|
7499
|
-
flatten: false,
|
|
7500
|
-
wrappingType: "rule",
|
|
7501
|
-
source: "attribute"
|
|
7502
|
-
} : {
|
|
7503
|
-
selector,
|
|
7504
|
-
source: "attribute"
|
|
7505
|
-
};
|
|
7812
|
+
(mod, ctx) => {
|
|
7813
|
+
const r = resolveGroupHas(mod, ctx);
|
|
7814
|
+
return !!r && !r.inner?.wrap;
|
|
7506
7815
|
},
|
|
7507
|
-
|
|
7816
|
+
groupHasSelector
|
|
7508
7817
|
);
|
|
7509
7818
|
functionalModifier(
|
|
7510
7819
|
(mod) => /^not-\[.*\]$/.test(mod),
|
|
7511
7820
|
({ selector, mod }) => {
|
|
7512
7821
|
const m = /^not-\[(.+)\]$/.exec(mod.type);
|
|
7513
7822
|
if (m) {
|
|
7514
|
-
if (m[1]
|
|
7823
|
+
if (!/^[a-zA-Z0-9_-]+(=.+)?$/.test(m[1])) {
|
|
7515
7824
|
return {
|
|
7516
|
-
selector: `&:not(${m[1]})`,
|
|
7825
|
+
selector: `&:not(${functionalArgument(m[1])})`,
|
|
7517
7826
|
flatten: false,
|
|
7518
7827
|
wrappingType: "rule",
|
|
7519
7828
|
source: "attribute"
|
|
@@ -7546,27 +7855,14 @@ functionalModifier(
|
|
|
7546
7855
|
);
|
|
7547
7856
|
functionalModifier(
|
|
7548
7857
|
(mod) => mod === "*",
|
|
7549
|
-
(
|
|
7550
|
-
|
|
7551
|
-
return {
|
|
7552
|
-
selector: `:is(.${escapeClassName(fullClassName)} > *)`,
|
|
7553
|
-
flatten: true,
|
|
7554
|
-
wrappingType: isSingle ? "rule" : "style-rule",
|
|
7555
|
-
source: "universal"
|
|
7556
|
-
};
|
|
7858
|
+
() => {
|
|
7859
|
+
return { selector: ":is(& > *)", wrappingType: "rule", source: "universal" };
|
|
7557
7860
|
},
|
|
7558
7861
|
void 0
|
|
7559
7862
|
);
|
|
7560
7863
|
functionalModifier(
|
|
7561
7864
|
(mod) => mod === "**",
|
|
7562
|
-
({ selector,
|
|
7563
|
-
return {
|
|
7564
|
-
selector: `:is(.${escapeClassName(fullClassName)} *)`,
|
|
7565
|
-
flatten: false,
|
|
7566
|
-
wrappingType: "style-rule",
|
|
7567
|
-
source: "universal"
|
|
7568
|
-
};
|
|
7569
|
-
},
|
|
7865
|
+
() => ({ selector: ":is(& *)", wrappingType: "rule", source: "universal" }),
|
|
7570
7866
|
void 0
|
|
7571
7867
|
);
|
|
7572
7868
|
functionalModifier(
|
|
@@ -7574,17 +7870,14 @@ functionalModifier(
|
|
|
7574
7870
|
({ selector, mod }) => {
|
|
7575
7871
|
const m = /^\[(.+)\]$/.exec(mod.type);
|
|
7576
7872
|
if (!m) return { selector };
|
|
7577
|
-
const inner = m[1].trim();
|
|
7873
|
+
const inner = decodeArbitrarySelector(m[1]).trim();
|
|
7578
7874
|
if (/^[a-zA-Z0-9_-]+(=.+)?$/.test(inner)) {
|
|
7579
7875
|
return { selector: `&[${inner}]`, wrappingType: "rule", source: "attribute" };
|
|
7580
7876
|
}
|
|
7581
|
-
if (inner === "&>*") {
|
|
7582
|
-
return { selector: `${inner}`, wrappingType: "style-rule", source: "peer" };
|
|
7583
|
-
}
|
|
7584
7877
|
if (inner.startsWith("&")) {
|
|
7585
7878
|
return { selector: `${inner}`, wrappingType: "rule", source: "pseudo" };
|
|
7586
7879
|
}
|
|
7587
|
-
return { selector:
|
|
7880
|
+
return { selector: `&:is(${inner})`, wrappingType: "rule", source: "base" };
|
|
7588
7881
|
},
|
|
7589
7882
|
void 0
|
|
7590
7883
|
);
|
|
@@ -7628,7 +7921,7 @@ functionalModifier(
|
|
|
7628
7921
|
};
|
|
7629
7922
|
} else {
|
|
7630
7923
|
return {
|
|
7631
|
-
selector: `&:not(${inner})`,
|
|
7924
|
+
selector: `&:not(${functionalArgument(inner)})`,
|
|
7632
7925
|
source: "attribute"
|
|
7633
7926
|
};
|
|
7634
7927
|
}
|
|
@@ -7779,29 +8072,56 @@ functionalModifier(
|
|
|
7779
8072
|
return m ? [atRule("scope", m[1], [])] : [];
|
|
7780
8073
|
}
|
|
7781
8074
|
);
|
|
8075
|
+
const atRuleHas = (mod) => /^(group|peer)-has-\[/.test(mod) && startsAtRule(mod.slice(mod.indexOf("[") + 1));
|
|
8076
|
+
function splitGroupName(kind, variant) {
|
|
8077
|
+
const named = /^(.+)\/([a-zA-Z0-9_-]+)$/.exec(variant);
|
|
8078
|
+
return named ? [named[1], `.${kind}\\/${named[2]}`] : [variant, `.${kind}`];
|
|
8079
|
+
}
|
|
8080
|
+
functionalModifier(
|
|
8081
|
+
(mod) => /^(group|peer)-hover(\/[a-zA-Z0-9_-]+)?$/.test(mod),
|
|
8082
|
+
({ mod }) => {
|
|
8083
|
+
const kind = mod.type.startsWith("group") ? "group" : "peer";
|
|
8084
|
+
const [, base] = splitGroupName(kind, mod.type.slice(kind.length + 1));
|
|
8085
|
+
const tail = kind === "group" ? " *" : " ~ *";
|
|
8086
|
+
return { selector: `&:is(:where(${base}):hover${tail})`, wrappingType: "rule", source: kind };
|
|
8087
|
+
},
|
|
8088
|
+
() => [atRule("media", "(hover: hover)", [])]
|
|
8089
|
+
);
|
|
8090
|
+
function negated(value) {
|
|
8091
|
+
const v = value.slice(4);
|
|
8092
|
+
return v.startsWith("[") && v.endsWith("]") ? `:not(*:is(${decodeArbitrarySelector(v.slice(1, -1))}))` : `:not(:${v})`;
|
|
8093
|
+
}
|
|
7782
8094
|
functionalModifier(
|
|
7783
|
-
(mod) => /^group-(.+)$/.test(mod),
|
|
8095
|
+
(mod) => /^group-(.+)$/.test(mod) && !atRuleHas(mod),
|
|
7784
8096
|
({ selector, mod }) => {
|
|
7785
|
-
const
|
|
8097
|
+
const raw2 = /^group-(.+)$/.exec(mod.type);
|
|
8098
|
+
const [variant, base] = splitGroupName("group", raw2?.[1] ?? "");
|
|
8099
|
+
const m = raw2 ? [raw2[0], variant] : null;
|
|
8100
|
+
const g = `:where(${base})`;
|
|
8101
|
+
const attr = m ? attributeVariantSelector(m[1]) : void 0;
|
|
8102
|
+
if (attr) return { selector: `&:is(${g}${attr} *)`, wrappingType: "rule", source: "group" };
|
|
7786
8103
|
if (m?.[1].startsWith("[") && m?.[1].endsWith("]")) {
|
|
7787
8104
|
const value = m?.[1].slice(1, -1).replace(/_/g, "");
|
|
7788
8105
|
return {
|
|
7789
|
-
selector: `&:is(:
|
|
8106
|
+
selector: `&:is(${g}:is(${value}) *)`,
|
|
7790
8107
|
wrappingType: "rule",
|
|
7791
8108
|
source: "group"
|
|
7792
8109
|
};
|
|
7793
8110
|
}
|
|
8111
|
+
if (m?.[1]?.startsWith("not-")) {
|
|
8112
|
+
return { selector: `&:is(${g}${negated(m[1])} *)`, wrappingType: "rule", source: "group" };
|
|
8113
|
+
}
|
|
7794
8114
|
if (m?.[1]?.startsWith("has-")) {
|
|
7795
8115
|
const pattern = /^has-\[([a-zA-Z0-9_-]+)\]$/.exec(m?.[1]);
|
|
7796
8116
|
if (pattern) {
|
|
7797
8117
|
const value = pattern[1];
|
|
7798
8118
|
return {
|
|
7799
|
-
selector: `&:is(:
|
|
8119
|
+
selector: `&:is(${g}:has(:is(${value})) *)`,
|
|
7800
8120
|
source: "group"
|
|
7801
8121
|
};
|
|
7802
8122
|
}
|
|
7803
8123
|
return {
|
|
7804
|
-
selector: `&:is(:
|
|
8124
|
+
selector: `&:is(${g}:has(${functionalArgument(m[1].slice(5, -1))}) *)`,
|
|
7805
8125
|
source: "group"
|
|
7806
8126
|
};
|
|
7807
8127
|
}
|
|
@@ -7811,19 +8131,19 @@ functionalModifier(
|
|
|
7811
8131
|
const value = pattern[1];
|
|
7812
8132
|
if (pattern[2]) {
|
|
7813
8133
|
return {
|
|
7814
|
-
selector: `&:is(
|
|
8134
|
+
selector: `&:is(${g}[aria-${value}="${pattern[2]}"] *)`,
|
|
7815
8135
|
source: "group"
|
|
7816
8136
|
};
|
|
7817
8137
|
} else {
|
|
7818
8138
|
return {
|
|
7819
|
-
selector: `&:is(
|
|
8139
|
+
selector: `&:is(${g}[aria-${value}] *)`,
|
|
7820
8140
|
source: "group"
|
|
7821
8141
|
};
|
|
7822
8142
|
}
|
|
7823
8143
|
}
|
|
7824
8144
|
}
|
|
7825
8145
|
return m ? {
|
|
7826
|
-
selector: `&:is(
|
|
8146
|
+
selector: `&:is(${g}:${m[1]} *)`,
|
|
7827
8147
|
wrappingType: "rule",
|
|
7828
8148
|
source: "group"
|
|
7829
8149
|
} : {
|
|
@@ -7834,27 +8154,35 @@ functionalModifier(
|
|
|
7834
8154
|
void 0
|
|
7835
8155
|
);
|
|
7836
8156
|
functionalModifier(
|
|
7837
|
-
(mod) => /^peer-(.+)$/.test(mod),
|
|
8157
|
+
(mod) => /^peer-(.+)$/.test(mod) && !atRuleHas(mod),
|
|
7838
8158
|
({ selector, mod }) => {
|
|
7839
|
-
const
|
|
8159
|
+
const raw2 = /^peer-(.+)$/.exec(mod.type);
|
|
8160
|
+
const [variant, base] = splitGroupName("peer", raw2?.[1] ?? "");
|
|
8161
|
+
const m = raw2 ? [raw2[0], variant] : null;
|
|
8162
|
+
const g = `:where(${base})`;
|
|
8163
|
+
const attr = m ? attributeVariantSelector(m[1]) : void 0;
|
|
8164
|
+
if (attr) return { selector: `&:is(${g}${attr} ~ *)`, wrappingType: "rule", source: "peer" };
|
|
7840
8165
|
if (m?.[1].startsWith("[") && m?.[1].endsWith("]")) {
|
|
7841
8166
|
const value2 = m?.[1].slice(1, -1).replace(/_/g, "");
|
|
7842
8167
|
return {
|
|
7843
|
-
selector: `&:is(:
|
|
8168
|
+
selector: `&:is(${g}:is(${value2})~*)`,
|
|
7844
8169
|
wrappingType: "rule",
|
|
7845
8170
|
source: "peer"
|
|
7846
8171
|
};
|
|
7847
8172
|
}
|
|
7848
8173
|
const value = m?.[1];
|
|
8174
|
+
if (value?.startsWith("has-[") && value.endsWith("]")) {
|
|
8175
|
+
return { selector: `&:is(${g}:has(${functionalArgument(value.slice(5, -1))}) ~ *)`, source: "peer" };
|
|
8176
|
+
}
|
|
7849
8177
|
if (value?.startsWith("has-")) {
|
|
7850
8178
|
return {
|
|
7851
|
-
selector: `&:is(:
|
|
8179
|
+
selector: `&:is(${g}:has(:${value.slice(4)})~*)`,
|
|
7852
8180
|
source: "peer"
|
|
7853
8181
|
};
|
|
7854
8182
|
}
|
|
7855
8183
|
if (value?.startsWith("not-")) {
|
|
7856
8184
|
return {
|
|
7857
|
-
selector: `&:is(
|
|
8185
|
+
selector: `&:is(${g}${negated(value)} ~ *)`,
|
|
7858
8186
|
source: "peer"
|
|
7859
8187
|
};
|
|
7860
8188
|
}
|
|
@@ -7863,7 +8191,7 @@ functionalModifier(
|
|
|
7863
8191
|
if (pattern) {
|
|
7864
8192
|
const key = pattern[1];
|
|
7865
8193
|
return {
|
|
7866
|
-
selector: `&:is(
|
|
8194
|
+
selector: `&:is(${g}[aria-${key}]~*)`,
|
|
7867
8195
|
source: "peer"
|
|
7868
8196
|
};
|
|
7869
8197
|
}
|
|
@@ -7873,19 +8201,19 @@ functionalModifier(
|
|
|
7873
8201
|
const value2 = pattern[2];
|
|
7874
8202
|
if (pattern[2]) {
|
|
7875
8203
|
return {
|
|
7876
|
-
selector: `&:is(
|
|
8204
|
+
selector: `&:is(${g}[aria-${key}="${value2}"]~*)`,
|
|
7877
8205
|
source: "peer"
|
|
7878
8206
|
};
|
|
7879
8207
|
} else {
|
|
7880
8208
|
return {
|
|
7881
|
-
selector: `&:is(
|
|
8209
|
+
selector: `&:is(${g}[aria-${key}]~*)`,
|
|
7882
8210
|
source: "peer"
|
|
7883
8211
|
};
|
|
7884
8212
|
}
|
|
7885
8213
|
}
|
|
7886
8214
|
}
|
|
7887
8215
|
return m ? {
|
|
7888
|
-
selector: `&:is(
|
|
8216
|
+
selector: `&:is(${g}:${value}~*)`,
|
|
7889
8217
|
source: "peer"
|
|
7890
8218
|
} : {
|
|
7891
8219
|
selector,
|
|
@@ -7942,6 +8270,7 @@ export {
|
|
|
7942
8270
|
ParseResultCache,
|
|
7943
8271
|
UtilityCache,
|
|
7944
8272
|
WeakCache,
|
|
8273
|
+
arbitraryPropertyRegistration,
|
|
7945
8274
|
astCache,
|
|
7946
8275
|
astToCss,
|
|
7947
8276
|
atRoot,
|
|
@@ -7957,6 +8286,7 @@ export {
|
|
|
7957
8286
|
deepMerge,
|
|
7958
8287
|
defaultConfig,
|
|
7959
8288
|
escapeClassName,
|
|
8289
|
+
expandThemeFunctions,
|
|
7960
8290
|
functionalModifier,
|
|
7961
8291
|
functionalUtility,
|
|
7962
8292
|
generateCss,
|
|
@@ -7966,10 +8296,16 @@ export {
|
|
|
7966
8296
|
getModifier,
|
|
7967
8297
|
getPreflightCSS,
|
|
7968
8298
|
getUtility,
|
|
8299
|
+
hasCommentToken,
|
|
7969
8300
|
hasPreset,
|
|
8301
|
+
isDebug,
|
|
8302
|
+
isSafeVariantToken,
|
|
8303
|
+
isSafeVariantValue,
|
|
8304
|
+
isStructureSafeValue,
|
|
7970
8305
|
jsonToAst,
|
|
7971
8306
|
mergeAstTreeList,
|
|
7972
8307
|
modifierRegistry,
|
|
8308
|
+
normalizeMathSpacing,
|
|
7973
8309
|
optimizeAst,
|
|
7974
8310
|
parseClassName,
|
|
7975
8311
|
parseClassToAst,
|
|
@@ -7982,6 +8318,7 @@ export {
|
|
|
7982
8318
|
rootToCss,
|
|
7983
8319
|
rule,
|
|
7984
8320
|
setContextCacheReset,
|
|
8321
|
+
setDebug,
|
|
7985
8322
|
staticModifier,
|
|
7986
8323
|
staticUtility,
|
|
7987
8324
|
styleRule,
|