@barocss/kit 0.4.0 → 0.6.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 +8433 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +92 -15
- package/dist/index.js +1439 -999
- 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;
|
|
@@ -319,6 +337,11 @@ function staticUtility(name, decls, opts, ctx) {
|
|
|
319
337
|
priority: opts?.priority
|
|
320
338
|
}, ctx);
|
|
321
339
|
}
|
|
340
|
+
function spacingKeyValue(ctx, key, negative) {
|
|
341
|
+
if (key === "px" || !/^[a-zA-Z][\w-]*$/.test(key) || ctx.theme("spacing", key) == null) return null;
|
|
342
|
+
const ref = `var(--spacing-${key})`;
|
|
343
|
+
return negative ? `calc(${ref} * -1)` : ref;
|
|
344
|
+
}
|
|
322
345
|
function functionalUtility(opts, ctx) {
|
|
323
346
|
registerUtility({
|
|
324
347
|
name: opts.name,
|
|
@@ -337,7 +360,7 @@ function functionalUtility(opts, ctx) {
|
|
|
337
360
|
}
|
|
338
361
|
}
|
|
339
362
|
if (opts.supportsArbitrary && parsedUtility.arbitrary) {
|
|
340
|
-
const processedValue = finalValue.replace(/_/g, " ");
|
|
363
|
+
const processedValue = normalizeMathSpacing(expandThemeFunctions(finalValue.replace(/_/g, " ")));
|
|
341
364
|
if (opts.handle) {
|
|
342
365
|
const result = opts.handle(processedValue, ctx2, token, extra);
|
|
343
366
|
if (result) return result;
|
|
@@ -387,14 +410,19 @@ function functionalUtility(opts, ctx) {
|
|
|
387
410
|
if (opts.supportsFraction && /^-?\d+\/\d+$/.test(value)) {
|
|
388
411
|
finalValue = value;
|
|
389
412
|
}
|
|
413
|
+
const spacingKey = opts.spacingKeys ? spacingKeyValue(ctx2, String(finalValue).replace(/^-/, ""), !!parsedUtility.negative) : null;
|
|
390
414
|
if (parsedUtility.negative && opts.supportsNegative && opts.handleNegativeBareValue) {
|
|
391
|
-
const bare = opts.handleNegativeBareValue({ value: String(finalValue).replace(/^-/, ""), ctx: ctx2, token, extra });
|
|
415
|
+
const bare = opts.handleNegativeBareValue({ value: String(finalValue).replace(/^-/, ""), ctx: ctx2, token, extra }) ?? spacingKey;
|
|
392
416
|
if (bare == null) return [];
|
|
393
417
|
finalValue = bare;
|
|
394
418
|
} else if (opts.handleBareValue) {
|
|
395
|
-
const bare = opts.handleBareValue({ value: finalValue, ctx: ctx2, token, extra });
|
|
419
|
+
const bare = opts.handleBareValue({ value: finalValue, ctx: ctx2, token, extra }) ?? spacingKey;
|
|
396
420
|
if (bare == null) return [];
|
|
397
421
|
finalValue = bare;
|
|
422
|
+
} else if (spacingKey) {
|
|
423
|
+
finalValue = spacingKey;
|
|
424
|
+
} else if (!/^-?(\d|\.\d)/.test(String(finalValue))) {
|
|
425
|
+
return [];
|
|
398
426
|
}
|
|
399
427
|
if (opts.handle) {
|
|
400
428
|
const result = opts.handle(finalValue, ctx2, token, extra);
|
|
@@ -410,6 +438,62 @@ function functionalUtility(opts, ctx) {
|
|
|
410
438
|
priority: opts.priority
|
|
411
439
|
}, ctx);
|
|
412
440
|
}
|
|
441
|
+
const MATH_FNS = /* @__PURE__ */ new Set(["calc", "min", "max", "clamp"]);
|
|
442
|
+
function expandThemeFunctions(value) {
|
|
443
|
+
return value.replace(/--spacing\(\s*([^()]+?)\s*\)/g, "calc(var(--spacing) * $1)");
|
|
444
|
+
}
|
|
445
|
+
const arbitraryPropertyRegistration = {
|
|
446
|
+
name: "[arbitrary-property]",
|
|
447
|
+
match: () => false,
|
|
448
|
+
handler: (value, _ctx, token) => {
|
|
449
|
+
const prop = token.property;
|
|
450
|
+
if (!prop || !value) return [];
|
|
451
|
+
return [decl(prop, normalizeMathSpacing(expandThemeFunctions(value.replace(/_/g, " "))))];
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
function normalizeMathSpacing(value) {
|
|
455
|
+
if (!/(calc|min|max|clamp)\(/.test(value)) return value;
|
|
456
|
+
const stack = [];
|
|
457
|
+
let out = "";
|
|
458
|
+
for (let i = 0; i < value.length; i++) {
|
|
459
|
+
const ch = value[i];
|
|
460
|
+
if (ch === "(") {
|
|
461
|
+
const name = (/([a-z-]*)$/i.exec(out)?.[1] ?? "").toLowerCase();
|
|
462
|
+
const inMath2 = stack.length > 0 && stack[stack.length - 1];
|
|
463
|
+
stack.push(MATH_FNS.has(name) || name === "" && inMath2);
|
|
464
|
+
out += ch;
|
|
465
|
+
continue;
|
|
466
|
+
}
|
|
467
|
+
if (ch === ")") {
|
|
468
|
+
stack.pop();
|
|
469
|
+
out += ch;
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
const inMath = stack.length > 0 && stack[stack.length - 1];
|
|
473
|
+
if (!inMath) {
|
|
474
|
+
out += ch;
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
if (ch === ",") {
|
|
478
|
+
out = out.trimEnd() + ", ";
|
|
479
|
+
while (value[i + 1] === " ") i++;
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
if ("+-*/".includes(ch)) {
|
|
483
|
+
const prev = out.trimEnd();
|
|
484
|
+
const p = prev[prev.length - 1] ?? "";
|
|
485
|
+
const binary = /[\w%)]/.test(p);
|
|
486
|
+
const exponent = (ch === "+" || ch === "-") && /\de$/i.test(prev) && prev.length === out.length && /\d/.test(value[i + 1] ?? "");
|
|
487
|
+
if (binary && !exponent) {
|
|
488
|
+
out = prev + " " + ch + " ";
|
|
489
|
+
while (value[i + 1] === " ") i++;
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
out += ch;
|
|
494
|
+
}
|
|
495
|
+
return out;
|
|
496
|
+
}
|
|
413
497
|
function tokenize(className) {
|
|
414
498
|
const tokens = [];
|
|
415
499
|
let current = "";
|
|
@@ -476,6 +560,9 @@ function parseClassName(className, ctx) {
|
|
|
476
560
|
if (className.startsWith("!")) {
|
|
477
561
|
important = true;
|
|
478
562
|
realClassName = className.slice(1);
|
|
563
|
+
} else if (className.length > 1 && className.endsWith("!")) {
|
|
564
|
+
important = true;
|
|
565
|
+
realClassName = className.slice(0, -1);
|
|
479
566
|
}
|
|
480
567
|
const tokens = tokenize(realClassName);
|
|
481
568
|
const result = parseTokens(tokens, ctx);
|
|
@@ -491,6 +578,16 @@ function parseTokens(tokens, ctx) {
|
|
|
491
578
|
if (tokens.length === 0) {
|
|
492
579
|
return { modifiers, utility: null };
|
|
493
580
|
}
|
|
581
|
+
if (tokens.length > 1) {
|
|
582
|
+
const utilityIndex = isUtilityPrefix(tokens[0].value, ctx) ? 0 : tokens.length - 1;
|
|
583
|
+
if (tokens.some((t, i) => i !== utilityIndex && !isSafeVariantToken(t.value))) {
|
|
584
|
+
return { modifiers, utility: null };
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
const utilityToken = tokens.length > 1 && !isUtilityPrefix(tokens[0].value, ctx) ? tokens[tokens.length - 1] : tokens[0];
|
|
588
|
+
if (!isStructureSafeValue(utilityToken.value)) {
|
|
589
|
+
return { modifiers, utility: null };
|
|
590
|
+
}
|
|
494
591
|
if (tokens.length === 1) {
|
|
495
592
|
utility = parseUtility(tokens[0].value, ctx);
|
|
496
593
|
} else if (tokens.length === 2) {
|
|
@@ -524,6 +621,91 @@ function parseTokens(tokens, ctx) {
|
|
|
524
621
|
}
|
|
525
622
|
return { modifiers, utility };
|
|
526
623
|
}
|
|
624
|
+
const FUNCTIONAL_VALUE_VARIANT = /^-?(?:(?:group|peer)-)?(?:has|not)-\[(.*)\](?:\/[\w-]+)?$/;
|
|
625
|
+
function isSafeVariantToken(value) {
|
|
626
|
+
if (hasCommentToken(value)) return false;
|
|
627
|
+
const m = FUNCTIONAL_VALUE_VARIANT.exec(value);
|
|
628
|
+
if (m) return isSafeVariantValue(m[1], true);
|
|
629
|
+
return isSafeVariantValue(value);
|
|
630
|
+
}
|
|
631
|
+
function hasCommentToken(value) {
|
|
632
|
+
return value.includes("/*") || value.includes("*/");
|
|
633
|
+
}
|
|
634
|
+
function hasCommentDelimiter(text) {
|
|
635
|
+
for (let i = 0; i < text.length - 1; i++) {
|
|
636
|
+
const c = text[i];
|
|
637
|
+
if (c === "\\") {
|
|
638
|
+
i++;
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
const n = text[i + 1];
|
|
642
|
+
if (c === "/" && n === "*" || c === "*" && n === "/") return true;
|
|
643
|
+
}
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
function isStructureSafeValue(value) {
|
|
647
|
+
if (hasCommentToken(value)) return false;
|
|
648
|
+
return isSafeVariantValue(value, true);
|
|
649
|
+
}
|
|
650
|
+
function hasUnquotedAt(value) {
|
|
651
|
+
let quote = "";
|
|
652
|
+
for (let i = 0; i < value.length; i++) {
|
|
653
|
+
const c = value[i];
|
|
654
|
+
if (c === "\\") {
|
|
655
|
+
i++;
|
|
656
|
+
continue;
|
|
657
|
+
}
|
|
658
|
+
if (quote) {
|
|
659
|
+
if (c === quote) quote = "";
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
662
|
+
if (c === '"' || c === "'") quote = c;
|
|
663
|
+
else if (c === "@") return true;
|
|
664
|
+
}
|
|
665
|
+
return false;
|
|
666
|
+
}
|
|
667
|
+
function isSafeVariantValue(value, allowTopLevelComma = false) {
|
|
668
|
+
const stack = [];
|
|
669
|
+
let quote = "";
|
|
670
|
+
let parenDepth = 0;
|
|
671
|
+
for (let i = 0; i < value.length; i++) {
|
|
672
|
+
const c = value[i];
|
|
673
|
+
if (c === "\\") {
|
|
674
|
+
i++;
|
|
675
|
+
continue;
|
|
676
|
+
}
|
|
677
|
+
if (quote) {
|
|
678
|
+
if (c === quote) quote = "";
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
681
|
+
switch (c) {
|
|
682
|
+
case '"':
|
|
683
|
+
case "'":
|
|
684
|
+
quote = c;
|
|
685
|
+
break;
|
|
686
|
+
case "(":
|
|
687
|
+
stack.push(")");
|
|
688
|
+
parenDepth++;
|
|
689
|
+
break;
|
|
690
|
+
case "[":
|
|
691
|
+
stack.push("]");
|
|
692
|
+
break;
|
|
693
|
+
case ")":
|
|
694
|
+
case "]":
|
|
695
|
+
if (stack.pop() !== c) return false;
|
|
696
|
+
if (c === ")") parenDepth--;
|
|
697
|
+
break;
|
|
698
|
+
case "{":
|
|
699
|
+
case "}":
|
|
700
|
+
case ";":
|
|
701
|
+
return false;
|
|
702
|
+
case ",":
|
|
703
|
+
if (parenDepth === 0 && !allowTopLevelComma) return false;
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return stack.length === 0 && !quote;
|
|
708
|
+
}
|
|
527
709
|
function parseModifier(value) {
|
|
528
710
|
let negative = false;
|
|
529
711
|
let modStr = value;
|
|
@@ -548,6 +730,11 @@ function parseUtility(value, ctx) {
|
|
|
548
730
|
let opacity = "";
|
|
549
731
|
let category = "";
|
|
550
732
|
let priority = 0;
|
|
733
|
+
const prop = /^\[(--[a-zA-Z_][a-zA-Z0-9_-]*|-?[a-z][a-z-]*):(.+)\]$/.exec(value);
|
|
734
|
+
if (prop) {
|
|
735
|
+
if (!isStructureSafeValue(prop[2]) || hasUnquotedAt(prop[2])) return { prefix: "", value: "" };
|
|
736
|
+
return { prefix: "", value: prop[2], arbitrary: true, property: prop[1] };
|
|
737
|
+
}
|
|
551
738
|
if (value.startsWith("-")) {
|
|
552
739
|
negative = true;
|
|
553
740
|
}
|
|
@@ -603,6 +790,8 @@ function parseUtility(value, ctx) {
|
|
|
603
790
|
priority
|
|
604
791
|
};
|
|
605
792
|
}
|
|
793
|
+
const isSafePrelude = (text) => !hasCommentDelimiter(String(text ?? ""));
|
|
794
|
+
const isSafeDecl = (prop, value) => isStructureSafeValue(String(prop)) && isStructureSafeValue(String(value ?? ""));
|
|
606
795
|
const importantPrefix = "!important";
|
|
607
796
|
function astToCss(ast, baseSelector, opts, _indent = "") {
|
|
608
797
|
const minify = opts?.minify;
|
|
@@ -611,7 +800,7 @@ function astToCss(ast, baseSelector, opts, _indent = "") {
|
|
|
611
800
|
const important = opts?.important ?? false;
|
|
612
801
|
const importantString = important ? ` ${importantPrefix}` : "";
|
|
613
802
|
if (!ast || ast.length === 0) {
|
|
614
|
-
|
|
803
|
+
debugWarn("[astToCss] Empty AST received:", { ast, baseSelector, minify });
|
|
615
804
|
return "";
|
|
616
805
|
}
|
|
617
806
|
const dedupedAst = [];
|
|
@@ -633,6 +822,7 @@ function astToCss(ast, baseSelector, opts, _indent = "") {
|
|
|
633
822
|
switch (node.type) {
|
|
634
823
|
case "decl": {
|
|
635
824
|
const value = node.value;
|
|
825
|
+
if (!isSafeDecl(node.prop, value)) return "";
|
|
636
826
|
if (node.prop.startsWith("--")) {
|
|
637
827
|
if (minify) {
|
|
638
828
|
const css = `${node.prop}: ${value}${importantString};`;
|
|
@@ -664,6 +854,7 @@ function astToCss(ast, baseSelector, opts, _indent = "") {
|
|
|
664
854
|
}).join(", ");
|
|
665
855
|
}
|
|
666
856
|
}
|
|
857
|
+
if (!isSafePrelude(selector)) return "";
|
|
667
858
|
if (minify) {
|
|
668
859
|
const css = `${indent}${selector}{${astToCss(
|
|
669
860
|
node.nodes,
|
|
@@ -688,6 +879,7 @@ ${astToCss(
|
|
|
688
879
|
}
|
|
689
880
|
}
|
|
690
881
|
case "style-rule": {
|
|
882
|
+
if (!isSafePrelude(node.selector)) return "";
|
|
691
883
|
if (minify) {
|
|
692
884
|
const css = `${indent}${node.selector} {${astToCss(
|
|
693
885
|
node.nodes,
|
|
@@ -712,6 +904,7 @@ ${astToCss(
|
|
|
712
904
|
}
|
|
713
905
|
}
|
|
714
906
|
case "at-rule": {
|
|
907
|
+
if (!isSafePrelude(node.name) || !isSafePrelude(node.params)) return "";
|
|
715
908
|
if (minify) {
|
|
716
909
|
const css = `${indent}@${node.name} ${node.params}{${astToCss(
|
|
717
910
|
node.nodes,
|
|
@@ -740,13 +933,13 @@ ${astToCss(
|
|
|
740
933
|
case "raw":
|
|
741
934
|
return `${indent}${node.value}`;
|
|
742
935
|
default:
|
|
743
|
-
|
|
936
|
+
debugWarn("[astToCss] Unknown node type:", node);
|
|
744
937
|
return "";
|
|
745
938
|
}
|
|
746
939
|
}).filter(Boolean).join(minify ? "" : "\n");
|
|
747
940
|
const finalResult = result + (minify ? "" : "\n");
|
|
748
941
|
if (!finalResult || finalResult.trim() === "") {
|
|
749
|
-
|
|
942
|
+
debugWarn("[astToCss] Empty result generated:", {
|
|
750
943
|
ast,
|
|
751
944
|
baseSelector,
|
|
752
945
|
minify,
|
|
@@ -757,26 +950,270 @@ ${astToCss(
|
|
|
757
950
|
}
|
|
758
951
|
return finalResult;
|
|
759
952
|
}
|
|
760
|
-
function rootToCss(nodes) {
|
|
953
|
+
function rootToCss(nodes, opts) {
|
|
954
|
+
const minify = opts?.minify === true;
|
|
761
955
|
const result = nodes.map((node) => {
|
|
762
956
|
const list = [];
|
|
763
957
|
if (node.type === "decl") {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
958
|
+
if (isSafeDecl(node.prop, node.value)) {
|
|
959
|
+
list.push(minify ? `${node.prop}:${node.value};` : `${node.prop}: ${node.value};`);
|
|
960
|
+
}
|
|
961
|
+
} else if (node.type === "at-rule" && isSafePrelude(node.name) && isSafePrelude(node.params)) {
|
|
962
|
+
if (minify) {
|
|
963
|
+
const body = node.nodes.filter((child) => child.type === "decl" && isSafeDecl(child.prop, child.value)).map((child) => child.type === "decl" ? `${child.prop}:${child.value};` : "").join("");
|
|
964
|
+
list.push(`@${node.name} ${node.params}{${body}}`);
|
|
965
|
+
} else {
|
|
966
|
+
list.push(
|
|
967
|
+
`@${node.name} ${node.params} {
|
|
768
968
|
${node.nodes.map((node2) => {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
969
|
+
if (node2.type === "decl" && isSafeDecl(node2.prop, node2.value)) {
|
|
970
|
+
return ` ${node2.prop}: ${node2.value};`;
|
|
971
|
+
}
|
|
972
|
+
}).join("\n")}
|
|
773
973
|
}`
|
|
774
|
-
|
|
974
|
+
);
|
|
975
|
+
}
|
|
775
976
|
}
|
|
776
|
-
return list.join("\n");
|
|
777
|
-
}).join("\n");
|
|
977
|
+
return list.join(minify ? "" : "\n");
|
|
978
|
+
}).join(minify ? "" : "\n");
|
|
778
979
|
return result;
|
|
779
980
|
}
|
|
981
|
+
function normalizePrefix(prefix) {
|
|
982
|
+
let p = prefix.trim();
|
|
983
|
+
if (!p.startsWith("--")) p = `--${p}`;
|
|
984
|
+
if (!p.endsWith("-")) p = `${p}-`;
|
|
985
|
+
return p;
|
|
986
|
+
}
|
|
987
|
+
function escapeKey(key) {
|
|
988
|
+
return key.replace(".", "\\.");
|
|
989
|
+
}
|
|
990
|
+
function colorsToCssVars(colors) {
|
|
991
|
+
if (!colors) return {};
|
|
992
|
+
const result = {};
|
|
993
|
+
function walk(obj, prefix = []) {
|
|
994
|
+
for (const key in obj) {
|
|
995
|
+
const value = obj[key];
|
|
996
|
+
if (typeof value === "object" && value !== null) {
|
|
997
|
+
walk(value, [...prefix, key]);
|
|
998
|
+
} else {
|
|
999
|
+
const varName2 = "--color-" + [...prefix, key].join("-");
|
|
1000
|
+
result[varName2] = value;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
walk(colors);
|
|
1005
|
+
return result;
|
|
1006
|
+
}
|
|
1007
|
+
function boxShadowToCssVars(boxShadow) {
|
|
1008
|
+
if (!boxShadow) return {};
|
|
1009
|
+
const result = {};
|
|
1010
|
+
for (const key in boxShadow) {
|
|
1011
|
+
result[`--shadow-${key}`] = boxShadow[key];
|
|
1012
|
+
}
|
|
1013
|
+
return result;
|
|
1014
|
+
}
|
|
1015
|
+
function fontSizeToCssVars(fontSize) {
|
|
1016
|
+
if (!fontSize) return {};
|
|
1017
|
+
const result = {};
|
|
1018
|
+
for (const key in fontSize) {
|
|
1019
|
+
const value = fontSize[key];
|
|
1020
|
+
if (Array.isArray(value)) {
|
|
1021
|
+
result[`--text-${key}`] = value[0];
|
|
1022
|
+
if (value[1]) result[`--text-${key}--line-height`] = value[1];
|
|
1023
|
+
} else {
|
|
1024
|
+
result[`--text-${key}`] = value;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
return result;
|
|
1028
|
+
}
|
|
1029
|
+
function fontWeightToCssVars(fontWeight) {
|
|
1030
|
+
if (!fontWeight) return {};
|
|
1031
|
+
const result = {};
|
|
1032
|
+
for (const key in fontWeight) {
|
|
1033
|
+
result[`--font-weight-${key}`] = fontWeight[key];
|
|
1034
|
+
}
|
|
1035
|
+
return result;
|
|
1036
|
+
}
|
|
1037
|
+
function fontFamilyToCssVars(fontFamily) {
|
|
1038
|
+
if (!fontFamily) return {};
|
|
1039
|
+
const result = {};
|
|
1040
|
+
for (const key in fontFamily) {
|
|
1041
|
+
const value = fontFamily[key];
|
|
1042
|
+
if (Array.isArray(value)) {
|
|
1043
|
+
result[`--font-${key}`] = value.join(", ");
|
|
1044
|
+
} else {
|
|
1045
|
+
result[`--font-${key}`] = value;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
return result;
|
|
1049
|
+
}
|
|
1050
|
+
function letterSpacingToCssVars(letterSpacing) {
|
|
1051
|
+
if (!letterSpacing) return {};
|
|
1052
|
+
const result = {};
|
|
1053
|
+
for (const key in letterSpacing) {
|
|
1054
|
+
result[`--letter-spacing-${key}`] = letterSpacing[key];
|
|
1055
|
+
}
|
|
1056
|
+
return result;
|
|
1057
|
+
}
|
|
1058
|
+
function spacingToCssVars(spacing) {
|
|
1059
|
+
if (!spacing) return {};
|
|
1060
|
+
const result = {};
|
|
1061
|
+
for (const key in spacing) {
|
|
1062
|
+
result[`--spacing-${escapeKey(key)}`] = spacing[key];
|
|
1063
|
+
}
|
|
1064
|
+
return result;
|
|
1065
|
+
}
|
|
1066
|
+
function borderRadiusToCssVars(borderRadius) {
|
|
1067
|
+
if (!borderRadius) return {};
|
|
1068
|
+
const result = {};
|
|
1069
|
+
for (const key in borderRadius) {
|
|
1070
|
+
result[`--radius-${escapeKey(key)}`] = borderRadius[key];
|
|
1071
|
+
}
|
|
1072
|
+
return result;
|
|
1073
|
+
}
|
|
1074
|
+
function zIndexToCssVars(zIndex) {
|
|
1075
|
+
if (!zIndex) return {};
|
|
1076
|
+
const result = {};
|
|
1077
|
+
for (const key in zIndex) {
|
|
1078
|
+
result[`--z-${escapeKey(key)}`] = String(zIndex[key]);
|
|
1079
|
+
}
|
|
1080
|
+
return result;
|
|
1081
|
+
}
|
|
1082
|
+
function opacityToCssVars(opacity) {
|
|
1083
|
+
if (!opacity) return {};
|
|
1084
|
+
const result = {};
|
|
1085
|
+
for (const key in opacity) {
|
|
1086
|
+
result[`--opacity-${escapeKey(key)}`] = String(opacity[key]);
|
|
1087
|
+
}
|
|
1088
|
+
return result;
|
|
1089
|
+
}
|
|
1090
|
+
function animationToCssVars(animations) {
|
|
1091
|
+
if (!animations) return {};
|
|
1092
|
+
const result = {};
|
|
1093
|
+
for (const key in animations) {
|
|
1094
|
+
result[`--animate-${escapeKey(key)}`] = animations[key];
|
|
1095
|
+
}
|
|
1096
|
+
return result;
|
|
1097
|
+
}
|
|
1098
|
+
function keyframesToCss(keyframes) {
|
|
1099
|
+
if (!keyframes) return "";
|
|
1100
|
+
let css = "";
|
|
1101
|
+
for (const name in keyframes) {
|
|
1102
|
+
const frames = keyframes[name];
|
|
1103
|
+
css += `@keyframes ${name} {
|
|
1104
|
+
`;
|
|
1105
|
+
for (const step in frames) {
|
|
1106
|
+
css += ` ${step} {`;
|
|
1107
|
+
const props = frames[step];
|
|
1108
|
+
for (const prop in props) {
|
|
1109
|
+
css += ` ${prop}: ${props[prop]};`;
|
|
1110
|
+
}
|
|
1111
|
+
css += " }\n";
|
|
1112
|
+
}
|
|
1113
|
+
css += "}\n";
|
|
1114
|
+
}
|
|
1115
|
+
return css;
|
|
1116
|
+
}
|
|
1117
|
+
function transitionTimingFunctionToCssVars(transition) {
|
|
1118
|
+
const result = {};
|
|
1119
|
+
for (const key in transition) {
|
|
1120
|
+
if (key === "DEFAULT") {
|
|
1121
|
+
result[`--default-transition-timing-function`] = transition[key];
|
|
1122
|
+
} else {
|
|
1123
|
+
result[`--transition-timing-function-${escapeKey(key)}`] = transition[key];
|
|
1124
|
+
if (key !== "linear") result[`--ease-${escapeKey(key)}`] = transition[key];
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
return result;
|
|
1128
|
+
}
|
|
1129
|
+
function transitionDurationToCssVars(transitionDuration) {
|
|
1130
|
+
const result = {};
|
|
1131
|
+
for (const key in transitionDuration) {
|
|
1132
|
+
if (key === "DEFAULT") {
|
|
1133
|
+
result[`--default-transition-duration`] = transitionDuration[key];
|
|
1134
|
+
} else {
|
|
1135
|
+
result[`--transition-duration-${escapeKey(key)}`] = transitionDuration[key];
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
return result;
|
|
1139
|
+
}
|
|
1140
|
+
function transitionDelayToCssVars(transitionDelay) {
|
|
1141
|
+
const result = {};
|
|
1142
|
+
for (const key in transitionDelay) {
|
|
1143
|
+
if (key === "DEFAULT") {
|
|
1144
|
+
result[`--default-transition-delay`] = transitionDelay[key];
|
|
1145
|
+
} else {
|
|
1146
|
+
result[`--transition-delay-${escapeKey(key)}`] = transitionDelay[key];
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
return result;
|
|
1150
|
+
}
|
|
1151
|
+
function blurToCssVars(blur) {
|
|
1152
|
+
const result = {};
|
|
1153
|
+
for (const key in blur) {
|
|
1154
|
+
if (key === "DEFAULT") {
|
|
1155
|
+
result[`--default-blur`] = blur[key];
|
|
1156
|
+
} else {
|
|
1157
|
+
result[`--blur-${escapeKey(key)}`] = blur[key];
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
return result;
|
|
1161
|
+
}
|
|
1162
|
+
function containerToCssVars(container) {
|
|
1163
|
+
const result = {};
|
|
1164
|
+
for (const key in container) {
|
|
1165
|
+
result[`--container-${escapeKey(key)}`] = container[key];
|
|
1166
|
+
}
|
|
1167
|
+
return result;
|
|
1168
|
+
}
|
|
1169
|
+
function themeToCssVarsAll(theme) {
|
|
1170
|
+
return {
|
|
1171
|
+
...colorsToCssVars(theme.colors),
|
|
1172
|
+
...boxShadowToCssVars(theme.boxShadow),
|
|
1173
|
+
...fontSizeToCssVars(theme.fontSize),
|
|
1174
|
+
...fontWeightToCssVars(theme.fontWeight),
|
|
1175
|
+
...fontFamilyToCssVars(theme.fontFamily),
|
|
1176
|
+
...letterSpacingToCssVars(theme.letterSpacing),
|
|
1177
|
+
"--spacing": theme.spacing["1"],
|
|
1178
|
+
...spacingToCssVars(theme.spacing),
|
|
1179
|
+
...containerToCssVars(theme.container),
|
|
1180
|
+
...borderRadiusToCssVars(theme.borderRadius),
|
|
1181
|
+
...zIndexToCssVars(theme.zIndex),
|
|
1182
|
+
...opacityToCssVars(theme.opacity),
|
|
1183
|
+
...animationToCssVars(theme.animations),
|
|
1184
|
+
...transitionTimingFunctionToCssVars(theme.transitionTimingFunction),
|
|
1185
|
+
...transitionDurationToCssVars(theme.transitionDuration),
|
|
1186
|
+
...transitionDelayToCssVars(theme.transitionDelay),
|
|
1187
|
+
...blurToCssVars(theme.blur),
|
|
1188
|
+
...Object.fromEntries(Object.entries(theme.aspect ?? {}).map(([k, v2]) => [`--aspect-${escapeKey(k)}`, v2]))
|
|
1189
|
+
// keyframes handled separately
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
function isSelfReferencingVar(name, value) {
|
|
1193
|
+
if (typeof value !== "string") return false;
|
|
1194
|
+
const m = /^var\(\s*(--[\w-]+)\s*(?:,[\s\S]*)?\)$/.exec(value.trim());
|
|
1195
|
+
return !!m && m[1] === name.trim();
|
|
1196
|
+
}
|
|
1197
|
+
function toCssVarsBlock(vars, extra = "") {
|
|
1198
|
+
return ":root,:host {\n" + Object.entries(vars).filter(([k, v2]) => !isSelfReferencingVar(k, v2)).map(([k, v2]) => ` ${k}: ${v2};`).join("\n") + "\n}\n" + extra + "\n";
|
|
1199
|
+
}
|
|
1200
|
+
const BARO_VAR = /--baro-/g;
|
|
1201
|
+
const PREFIXED_KEYS = /* @__PURE__ */ new Set(["prop", "value", "params", "selector", "nodes", "items"]);
|
|
1202
|
+
function applyVarPrefix(ast, ctx) {
|
|
1203
|
+
const configured = ctx?.config("cssVarPrefix");
|
|
1204
|
+
if (typeof configured !== "string" || !configured.trim()) return ast;
|
|
1205
|
+
const prefix = normalizePrefix(configured);
|
|
1206
|
+
if (prefix === "--baro-") return ast;
|
|
1207
|
+
const walk = (node) => {
|
|
1208
|
+
if (typeof node === "string") return node.includes("--baro-") ? node.replace(BARO_VAR, prefix) : node;
|
|
1209
|
+
if (Array.isArray(node)) return node.map(walk);
|
|
1210
|
+
if (!node || typeof node !== "object") return node;
|
|
1211
|
+
const out = {};
|
|
1212
|
+
for (const [k, val] of Object.entries(node)) out[k] = PREFIXED_KEYS.has(k) ? walk(val) : val;
|
|
1213
|
+
return out;
|
|
1214
|
+
};
|
|
1215
|
+
return walk(ast);
|
|
1216
|
+
}
|
|
780
1217
|
const failureCache = /* @__PURE__ */ new Set();
|
|
781
1218
|
function collectDeclPaths(nodes = [], path = []) {
|
|
782
1219
|
let result = [];
|
|
@@ -932,8 +1369,8 @@ function extractAtRootNodes(nodes, parent, atRootNodes = []) {
|
|
|
932
1369
|
if (node.type === "at-root") {
|
|
933
1370
|
atRootNodes.push(node);
|
|
934
1371
|
delete nodes[i];
|
|
935
|
-
} else if (node.type === "rule" || node.type === "style-rule") {
|
|
936
|
-
extractAtRootNodes(node.nodes, node, atRootNodes);
|
|
1372
|
+
} else if (node.type === "rule" || node.type === "style-rule" || node.type === "at-rule") {
|
|
1373
|
+
extractAtRootNodes(node.nodes ?? [], node, atRootNodes);
|
|
937
1374
|
}
|
|
938
1375
|
}
|
|
939
1376
|
if (parent) {
|
|
@@ -952,33 +1389,40 @@ function parseClassToAst(fullClassName, ctx) {
|
|
|
952
1389
|
}
|
|
953
1390
|
const { modifiers, utility } = parseClassName(fullClassName, ctx);
|
|
954
1391
|
if (!utility) {
|
|
955
|
-
|
|
1392
|
+
debugWarn(`[BAROCSS] Invalid class name format: "${fullClassName}"`);
|
|
956
1393
|
failures.add(fullClassName);
|
|
957
1394
|
return [];
|
|
958
1395
|
}
|
|
959
|
-
const
|
|
1396
|
+
const utilRegs = utility.property ? [arbitraryPropertyRegistration] : getUtility(ctx).filter((u) => {
|
|
960
1397
|
const fullClassName2 = utility.value ? `${utility.prefix}-${utility.value}` : utility.prefix;
|
|
961
1398
|
return u.match(fullClassName2);
|
|
962
1399
|
});
|
|
963
|
-
if (
|
|
1400
|
+
if (utilRegs.length === 0) {
|
|
964
1401
|
const utilityName = utility.value ? `${utility.prefix}-${utility.value}` : utility.prefix;
|
|
965
|
-
|
|
1402
|
+
debugWarn(`[BAROCSS] Unknown utility class: "${utilityName}" in "${fullClassName}"`);
|
|
966
1403
|
failures.add(fullClassName);
|
|
967
1404
|
return [];
|
|
968
1405
|
}
|
|
969
1406
|
let value = utility.value;
|
|
970
1407
|
if (utility.negative && value) value = "-" + value;
|
|
971
|
-
let ast =
|
|
1408
|
+
let ast = [];
|
|
1409
|
+
for (const utilReg of utilRegs) {
|
|
1410
|
+
ast = utilReg.handler(value, ctx, utility, utilReg) || [];
|
|
1411
|
+
if (ast.length > 0) break;
|
|
1412
|
+
}
|
|
972
1413
|
const wrappers = [];
|
|
973
1414
|
const selector = "&";
|
|
974
1415
|
for (let i = 0; i < modifiers.length; i++) {
|
|
975
1416
|
const variant = modifiers[i];
|
|
976
1417
|
const plugin = getModifier(ctx).find((p) => p.match(variant.type, ctx));
|
|
977
1418
|
if (!plugin) {
|
|
978
|
-
|
|
1419
|
+
debugWarn(`[BAROCSS] Unknown variant: "${variant.type}" in "${fullClassName}"`);
|
|
979
1420
|
failures.add(fullClassName);
|
|
980
1421
|
return [];
|
|
981
1422
|
}
|
|
1423
|
+
if (plugin.astHandler) {
|
|
1424
|
+
ast = plugin.astHandler(ast, variant, ctx, modifiers, i);
|
|
1425
|
+
}
|
|
982
1426
|
if (plugin.wrap) {
|
|
983
1427
|
const items = plugin.wrap(variant, ctx);
|
|
984
1428
|
wrappers.push({
|
|
@@ -1055,7 +1499,7 @@ function parseClassToAst(fullClassName, ctx) {
|
|
|
1055
1499
|
}
|
|
1056
1500
|
const atRootNodes = [];
|
|
1057
1501
|
extractAtRootNodes(ast, void 0, atRootNodes);
|
|
1058
|
-
ast = [...atRootNodes, ...ast].filter(Boolean);
|
|
1502
|
+
ast = applyVarPrefix([...atRootNodes, ...ast].filter(Boolean), ctx);
|
|
1059
1503
|
cache.set(fullClassName, ast);
|
|
1060
1504
|
return ast;
|
|
1061
1505
|
}
|
|
@@ -1096,7 +1540,7 @@ function generateCss(classList, ctx, opts) {
|
|
|
1096
1540
|
});
|
|
1097
1541
|
const result = css;
|
|
1098
1542
|
if (!result || result.trim() === "") {
|
|
1099
|
-
|
|
1543
|
+
debugWarn("[generateCss] Empty CSS generated for class:", {
|
|
1100
1544
|
class: cls,
|
|
1101
1545
|
ast: cleanAst,
|
|
1102
1546
|
hasStyleRule,
|
|
@@ -1106,17 +1550,17 @@ function generateCss(classList, ctx, opts) {
|
|
|
1106
1550
|
}
|
|
1107
1551
|
return result;
|
|
1108
1552
|
}).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])))];
|
|
1553
|
+
const rootRules = [...new Set(allAtRootNodes.filter((node) => node.type === "at-rule").map((node) => rootToCss([node], { minify: opts?.minify })))];
|
|
1554
|
+
const rootDeclarations = [...new Set(allAtRootNodes.filter((node) => node.type === "decl").map((node) => rootToCss([node], { minify: opts?.minify })).filter((decl2) => decl2 !== ""))];
|
|
1111
1555
|
const rootCss = [
|
|
1112
1556
|
...rootRules,
|
|
1113
|
-
...rootDeclarations.length ? [`:root,:host {${rootDeclarations.join("\n")}}`] : []
|
|
1557
|
+
...rootDeclarations.length ? [`:root,:host${opts?.minify ? "" : " "}{${rootDeclarations.join(opts?.minify ? "" : "\n")}}`] : []
|
|
1114
1558
|
].join(opts?.minify ? "" : "\n");
|
|
1115
1559
|
if (allAtRootNodes.length > 0) {
|
|
1116
|
-
|
|
1560
|
+
debugLog("[generateCss] All collected atRoot nodes:", allAtRootNodes);
|
|
1117
1561
|
}
|
|
1118
1562
|
if (!results || results.trim() === "") {
|
|
1119
|
-
|
|
1563
|
+
debugWarn("[generateCss] Empty final result:", {
|
|
1120
1564
|
classList,
|
|
1121
1565
|
results,
|
|
1122
1566
|
allAtRootNodes
|
|
@@ -1259,7 +1703,7 @@ class IncrementalParser {
|
|
|
1259
1703
|
}
|
|
1260
1704
|
const ast = parseClassToAst(className, this.ctx);
|
|
1261
1705
|
if (ast.length === 0) {
|
|
1262
|
-
|
|
1706
|
+
debugWarn("[IncrementalParser] ast is empty", className);
|
|
1263
1707
|
return null;
|
|
1264
1708
|
}
|
|
1265
1709
|
const rules = generateCssRules(className, this.ctx, { dedup: false });
|
|
@@ -1280,7 +1724,7 @@ class IncrementalParser {
|
|
|
1280
1724
|
rootCssList: rule2.rootCssList
|
|
1281
1725
|
};
|
|
1282
1726
|
} catch (error) {
|
|
1283
|
-
|
|
1727
|
+
debugWarn("[IncrementalParser] Failed to process class:", className, error);
|
|
1284
1728
|
return null;
|
|
1285
1729
|
}
|
|
1286
1730
|
}
|
|
@@ -1426,6 +1870,15 @@ class IncrementalParser {
|
|
|
1426
1870
|
markProcessed(cls) {
|
|
1427
1871
|
this.processedClasses.add(cls);
|
|
1428
1872
|
}
|
|
1873
|
+
/**
|
|
1874
|
+
* Forgets that a class was processed, so a later request generates it again
|
|
1875
|
+
* (used when the browser runtime reclaims an unused class's rules, #269).
|
|
1876
|
+
*
|
|
1877
|
+
* @param cls - The CSS class name to forget
|
|
1878
|
+
*/
|
|
1879
|
+
unmarkProcessed(cls) {
|
|
1880
|
+
this.processedClasses.delete(cls);
|
|
1881
|
+
}
|
|
1429
1882
|
/**
|
|
1430
1883
|
* Process classes synchronously and update BrowserRuntime cache
|
|
1431
1884
|
* This method is used by ChangeDetector for scan operations
|
|
@@ -1433,223 +1886,17 @@ class IncrementalParser {
|
|
|
1433
1886
|
processClassesSync(classes) {
|
|
1434
1887
|
this.applyClasses(classes);
|
|
1435
1888
|
}
|
|
1436
|
-
/**
|
|
1437
|
-
* 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];
|
|
1889
|
+
/**
|
|
1890
|
+
* Returns all currently processed class names
|
|
1891
|
+
*
|
|
1892
|
+
* This method is useful for debugging and monitoring purposes,
|
|
1893
|
+
* providing visibility into which classes have been processed.
|
|
1894
|
+
*
|
|
1895
|
+
* @returns Array of all processed class names
|
|
1896
|
+
*/
|
|
1897
|
+
getProcessedClasses() {
|
|
1898
|
+
return Array.from(this.processedClasses);
|
|
1626
1899
|
}
|
|
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
1900
|
}
|
|
1654
1901
|
const preflightMinimalCSS = `
|
|
1655
1902
|
/* BaroCSS Preflight - Minimal Reset */
|
|
@@ -1781,6 +2028,10 @@ select {
|
|
|
1781
2028
|
html {
|
|
1782
2029
|
line-height: 1.15;
|
|
1783
2030
|
-webkit-text-size-adjust: 100%;
|
|
2031
|
+
/* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
|
|
2032
|
+
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'));
|
|
2033
|
+
font-feature-settings: var(--default-font-feature-settings, normal);
|
|
2034
|
+
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
1784
2035
|
}
|
|
1785
2036
|
|
|
1786
2037
|
/* Remove the gray background on active links in IE 10 */
|
|
@@ -1946,6 +2197,60 @@ textarea {
|
|
|
1946
2197
|
[type="search"]::-webkit-search-decoration {
|
|
1947
2198
|
-webkit-appearance: none;
|
|
1948
2199
|
}
|
|
2200
|
+
|
|
2201
|
+
/* Tailwind 4.1.13 monospace stack for code-like elements */
|
|
2202
|
+
code,
|
|
2203
|
+
kbd,
|
|
2204
|
+
samp,
|
|
2205
|
+
pre {
|
|
2206
|
+
font-family: var(--default-mono-font-family, var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace));
|
|
2207
|
+
font-feature-settings: var(--default-mono-font-feature-settings, normal);
|
|
2208
|
+
font-variation-settings: var(--default-mono-font-variation-settings, normal);
|
|
2209
|
+
font-size: 1em;
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
/* Tailwind 4.1.13 form-control reset: inherit typography and colour, drop native radius/background (#228) */
|
|
2213
|
+
button,
|
|
2214
|
+
input,
|
|
2215
|
+
select,
|
|
2216
|
+
optgroup,
|
|
2217
|
+
textarea,
|
|
2218
|
+
::file-selector-button {
|
|
2219
|
+
font: inherit;
|
|
2220
|
+
font-feature-settings: inherit;
|
|
2221
|
+
font-variation-settings: inherit;
|
|
2222
|
+
letter-spacing: inherit;
|
|
2223
|
+
color: inherit;
|
|
2224
|
+
border-radius: 0;
|
|
2225
|
+
background-color: transparent;
|
|
2226
|
+
opacity: 1;
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
:where(select:is([multiple], [size])) optgroup {
|
|
2230
|
+
font-weight: bolder;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
:where(select:is([multiple], [size])) optgroup option {
|
|
2234
|
+
padding-inline-start: 20px;
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
::file-selector-button {
|
|
2238
|
+
margin-inline-end: 4px;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
::placeholder {
|
|
2242
|
+
opacity: 1;
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
|
|
2246
|
+
::placeholder {
|
|
2247
|
+
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
textarea {
|
|
2252
|
+
resize: vertical;
|
|
2253
|
+
}
|
|
1949
2254
|
`;
|
|
1950
2255
|
const preflightFullCSS = `
|
|
1951
2256
|
/* BaroCSS Preflight - Full Reset */
|
|
@@ -1958,10 +2263,14 @@ const preflightFullCSS = `
|
|
|
1958
2263
|
box-sizing: border-box;
|
|
1959
2264
|
}
|
|
1960
2265
|
|
|
1961
|
-
/* Remove default margin and padding
|
|
2266
|
+
/* Remove default margin and padding; reset border to Tailwind v4's universal
|
|
2267
|
+
\`border: 0 solid\` so a bare border/border-t (width set by the utility, style
|
|
2268
|
+
otherwise \`none\`) renders. Width 0 keeps borders invisible until a utility
|
|
2269
|
+
sets one. */
|
|
1962
2270
|
* {
|
|
1963
2271
|
margin: 0;
|
|
1964
2272
|
padding: 0;
|
|
2273
|
+
border: 0 solid;
|
|
1965
2274
|
}
|
|
1966
2275
|
|
|
1967
2276
|
/* Set core body defaults */
|
|
@@ -2022,6 +2331,10 @@ html {
|
|
|
2022
2331
|
line-height: 1.15;
|
|
2023
2332
|
-webkit-text-size-adjust: 100%;
|
|
2024
2333
|
-ms-text-size-adjust: 100%;
|
|
2334
|
+
/* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
|
|
2335
|
+
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'));
|
|
2336
|
+
font-feature-settings: var(--default-font-feature-settings, normal);
|
|
2337
|
+
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
2025
2338
|
}
|
|
2026
2339
|
|
|
2027
2340
|
/* Remove the gray background on active links in IE 10 */
|
|
@@ -2207,7 +2520,9 @@ code,
|
|
|
2207
2520
|
kbd,
|
|
2208
2521
|
pre,
|
|
2209
2522
|
samp {
|
|
2210
|
-
font-family: monospace, monospace;
|
|
2523
|
+
font-family: var(--default-mono-font-family, var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace));
|
|
2524
|
+
font-feature-settings: var(--default-mono-font-feature-settings, normal);
|
|
2525
|
+
font-variation-settings: var(--default-mono-font-variation-settings, normal);
|
|
2211
2526
|
font-size: 1em;
|
|
2212
2527
|
}
|
|
2213
2528
|
|
|
@@ -2309,6 +2624,49 @@ template {
|
|
|
2309
2624
|
page-break-after: avoid;
|
|
2310
2625
|
}
|
|
2311
2626
|
}
|
|
2627
|
+
|
|
2628
|
+
/* Tailwind 4.1.13 form-control reset: inherit typography and colour, drop native radius/background (#228) */
|
|
2629
|
+
button,
|
|
2630
|
+
input,
|
|
2631
|
+
select,
|
|
2632
|
+
optgroup,
|
|
2633
|
+
textarea,
|
|
2634
|
+
::file-selector-button {
|
|
2635
|
+
font: inherit;
|
|
2636
|
+
font-feature-settings: inherit;
|
|
2637
|
+
font-variation-settings: inherit;
|
|
2638
|
+
letter-spacing: inherit;
|
|
2639
|
+
color: inherit;
|
|
2640
|
+
border-radius: 0;
|
|
2641
|
+
background-color: transparent;
|
|
2642
|
+
opacity: 1;
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
:where(select:is([multiple], [size])) optgroup {
|
|
2646
|
+
font-weight: bolder;
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
:where(select:is([multiple], [size])) optgroup option {
|
|
2650
|
+
padding-inline-start: 20px;
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
::file-selector-button {
|
|
2654
|
+
margin-inline-end: 4px;
|
|
2655
|
+
}
|
|
2656
|
+
|
|
2657
|
+
::placeholder {
|
|
2658
|
+
opacity: 1;
|
|
2659
|
+
}
|
|
2660
|
+
|
|
2661
|
+
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
|
|
2662
|
+
::placeholder {
|
|
2663
|
+
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
textarea {
|
|
2668
|
+
resize: vertical;
|
|
2669
|
+
}
|
|
2312
2670
|
`;
|
|
2313
2671
|
function getPreflightCSS(level = true) {
|
|
2314
2672
|
if (level === "minimal") {
|
|
@@ -2433,6 +2791,7 @@ ${keyframesToCss(theme.keyframes || {})}
|
|
|
2433
2791
|
return result;
|
|
2434
2792
|
}
|
|
2435
2793
|
function createContext(configObj) {
|
|
2794
|
+
if (configObj.debug !== void 0) setDebug(!!configObj.debug);
|
|
2436
2795
|
const configWithDefaults = {
|
|
2437
2796
|
presets: [
|
|
2438
2797
|
{ theme: defaultTheme },
|
|
@@ -2485,6 +2844,10 @@ function createContext(configObj) {
|
|
|
2485
2844
|
return ctx;
|
|
2486
2845
|
}
|
|
2487
2846
|
function jsonToAst(input, ctx) {
|
|
2847
|
+
const unsafeVariant = (input.variants || []).some(
|
|
2848
|
+
(v) => typeof v === "string" ? !isSafeVariantToken(v) : !isSafeVariantValue(v.name || "") || !isSafeVariantValue(v.value || "") || hasCommentToken(v.name || "") || hasCommentToken(v.value || "")
|
|
2849
|
+
);
|
|
2850
|
+
if (unsafeVariant) return [];
|
|
2488
2851
|
let utilReg = getUtility(ctx).find((u) => u.name === input.utility.name);
|
|
2489
2852
|
if (input.utility.value && !input.utility.arbitrary && !input.utility.customProperty) {
|
|
2490
2853
|
const fullName = `${input.utility.name}-${input.utility.value}`;
|
|
@@ -2494,7 +2857,7 @@ function jsonToAst(input, ctx) {
|
|
|
2494
2857
|
}
|
|
2495
2858
|
}
|
|
2496
2859
|
if (!utilReg) {
|
|
2497
|
-
|
|
2860
|
+
debugWarn(`[jsonToAst] Unknown utility: "${input.utility.name}"`);
|
|
2498
2861
|
return [];
|
|
2499
2862
|
}
|
|
2500
2863
|
const parsedUtility = {
|
|
@@ -2541,9 +2904,12 @@ function jsonToAst(input, ctx) {
|
|
|
2541
2904
|
}
|
|
2542
2905
|
const plugin = getModifier(ctx).find((p) => p.match(matchKey, ctx));
|
|
2543
2906
|
if (!plugin) {
|
|
2544
|
-
|
|
2907
|
+
debugWarn(`[jsonToAst] Unknown variant: "${matchKey}"`);
|
|
2545
2908
|
continue;
|
|
2546
2909
|
}
|
|
2910
|
+
if (plugin.astHandler) {
|
|
2911
|
+
ast = plugin.astHandler(ast, parsedModifier, ctx, [], i);
|
|
2912
|
+
}
|
|
2547
2913
|
if (plugin.modifySelector) {
|
|
2548
2914
|
const result = plugin.modifySelector({
|
|
2549
2915
|
selector,
|
|
@@ -2620,7 +2986,7 @@ function jsonToAst(input, ctx) {
|
|
|
2620
2986
|
}
|
|
2621
2987
|
}
|
|
2622
2988
|
}
|
|
2623
|
-
return ast;
|
|
2989
|
+
return applyVarPrefix(ast, ctx);
|
|
2624
2990
|
}
|
|
2625
2991
|
function generateCssFromJson(inputs, ctx, opts) {
|
|
2626
2992
|
const allAtRootNodes = [];
|
|
@@ -2884,6 +3250,30 @@ function parseColor(input) {
|
|
|
2884
3250
|
}
|
|
2885
3251
|
return null;
|
|
2886
3252
|
}
|
|
3253
|
+
const COLOR_KEYWORDS = /* @__PURE__ */ new Set(["inherit", "currentcolor", "transparent"]);
|
|
3254
|
+
function themeColorDecls(prop, value, extra) {
|
|
3255
|
+
const key = String(extra.realThemeValue);
|
|
3256
|
+
const ref = COLOR_KEYWORDS.has(value.toLowerCase()) || value.startsWith("var(") || !/^[\w-]+$/.test(key) ? value : `var(--color-${key})`;
|
|
3257
|
+
if (!extra.opacity) return [decl(prop, ref)];
|
|
3258
|
+
const alpha = normalizeAlpha(String(extra.opacity));
|
|
3259
|
+
const supports = (amount) => atRule("supports", "(color:color-mix(in lab, red, red))", [decl(prop, `color-mix(in oklab, ${ref} ${amount}, transparent)`)]);
|
|
3260
|
+
if (alpha.isVar) return [decl(prop, value), supports(alpha.amount)];
|
|
3261
|
+
return [decl(prop, `color-mix(in srgb, ${value} ${alpha.amount}, transparent)`), supports(alpha.amount)];
|
|
3262
|
+
}
|
|
3263
|
+
function normalizeAlpha(raw2) {
|
|
3264
|
+
let v = raw2.trim();
|
|
3265
|
+
const bracketed = v.startsWith("[") && v.endsWith("]");
|
|
3266
|
+
if (bracketed) v = v.slice(1, -1).trim();
|
|
3267
|
+
if (v.startsWith("(") && v.endsWith(")")) v = `var(${v.slice(1, -1).trim()})`;
|
|
3268
|
+
if (v.startsWith("var(")) return { amount: v, isVar: true };
|
|
3269
|
+
if (v.endsWith("%")) return { amount: v, isVar: false };
|
|
3270
|
+
const n = Number(v);
|
|
3271
|
+
if (v !== "" && Number.isFinite(n)) {
|
|
3272
|
+
const pct = bracketed && n <= 1 ? n * 100 : n;
|
|
3273
|
+
return { amount: `${+pct.toFixed(4)}%`, isVar: false };
|
|
3274
|
+
}
|
|
3275
|
+
return { amount: v, isVar: false };
|
|
3276
|
+
}
|
|
2887
3277
|
staticUtility("accent-inherit", [["accent-color", "inherit"]], { category: "interactivity" });
|
|
2888
3278
|
staticUtility("accent-current", [["accent-color", "currentColor"]], { category: "interactivity" });
|
|
2889
3279
|
staticUtility("accent-transparent", [["accent-color", "transparent"]], { category: "interactivity" });
|
|
@@ -3035,6 +3425,7 @@ staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]]
|
|
|
3035
3425
|
].forEach(([name, prop]) => {
|
|
3036
3426
|
functionalUtility({
|
|
3037
3427
|
name: `scroll-${name}`,
|
|
3428
|
+
spacingKeys: true,
|
|
3038
3429
|
prop,
|
|
3039
3430
|
supportsArbitrary: true,
|
|
3040
3431
|
supportsCustomProperty: true,
|
|
@@ -3062,6 +3453,7 @@ staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]]
|
|
|
3062
3453
|
].forEach(([name, prop]) => {
|
|
3063
3454
|
functionalUtility({
|
|
3064
3455
|
name: `scroll-${name}`,
|
|
3456
|
+
spacingKeys: true,
|
|
3065
3457
|
prop,
|
|
3066
3458
|
supportsArbitrary: true,
|
|
3067
3459
|
supportsCustomProperty: true,
|
|
@@ -3086,10 +3478,10 @@ staticUtility("touch-pan-up", [["touch-action", "pan-up"]], { category: "interac
|
|
|
3086
3478
|
staticUtility("touch-pan-down", [["touch-action", "pan-down"]], { category: "interactivity" });
|
|
3087
3479
|
staticUtility("touch-pinch-zoom", [["touch-action", "pinch-zoom"]], { category: "interactivity" });
|
|
3088
3480
|
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" });
|
|
3481
|
+
staticUtility("select-none", [["-webkit-user-select", "none"], ["user-select", "none"]], { category: "interactivity" });
|
|
3482
|
+
staticUtility("select-text", [["-webkit-user-select", "text"], ["user-select", "text"]], { category: "interactivity" });
|
|
3483
|
+
staticUtility("select-all", [["-webkit-user-select", "all"], ["user-select", "all"]], { category: "interactivity" });
|
|
3484
|
+
staticUtility("select-auto", [["-webkit-user-select", "auto"], ["user-select", "auto"]], { category: "interactivity" });
|
|
3093
3485
|
staticUtility("will-change-auto", [["will-change", "auto"]], { category: "interactivity" });
|
|
3094
3486
|
staticUtility("will-change-scroll", [["will-change", "scroll-position"]], { category: "interactivity" });
|
|
3095
3487
|
staticUtility("will-change-contents", [["will-change", "contents"]], { category: "interactivity" });
|
|
@@ -3107,7 +3499,7 @@ const defaultDuration = "var(--default-transition-duration)";
|
|
|
3107
3499
|
staticUtility("transition", [
|
|
3108
3500
|
[
|
|
3109
3501
|
"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"
|
|
3502
|
+
"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
3503
|
],
|
|
3112
3504
|
["transition-timing-function", defaultTiming],
|
|
3113
3505
|
["transition-duration", defaultDuration]
|
|
@@ -3120,7 +3512,7 @@ staticUtility("transition-all", [
|
|
|
3120
3512
|
staticUtility("transition-colors", [
|
|
3121
3513
|
[
|
|
3122
3514
|
"transition-property",
|
|
3123
|
-
"color, background-color, border-color, text-decoration-color, fill, stroke, --baro-gradient-from, --baro-gradient-via, --baro-gradient-to"
|
|
3515
|
+
"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --baro-gradient-from, --baro-gradient-via, --baro-gradient-to"
|
|
3124
3516
|
],
|
|
3125
3517
|
["transition-timing-function", defaultTiming],
|
|
3126
3518
|
["transition-duration", defaultDuration]
|
|
@@ -3310,6 +3702,7 @@ const filters$1 = () => {
|
|
|
3310
3702
|
filters$1()
|
|
3311
3703
|
], { category: "effects" });
|
|
3312
3704
|
});
|
|
3705
|
+
staticUtility("blur", [decl("--baro-blur", "blur(8px)"), filters$1()], { category: "effects" });
|
|
3313
3706
|
staticUtility("blur-none", [decl("--baro-blur", ""), filters$1()], { category: "effects" });
|
|
3314
3707
|
functionalUtility({
|
|
3315
3708
|
name: "blur",
|
|
@@ -3548,6 +3941,7 @@ functionalUtility({
|
|
|
3548
3941
|
{ category: "effects" }
|
|
3549
3942
|
);
|
|
3550
3943
|
});
|
|
3944
|
+
staticUtility("backdrop-blur", [decl("--baro-backdrop-blur", "blur(8px)"), ...filters()], { category: "effects" });
|
|
3551
3945
|
staticUtility(
|
|
3552
3946
|
"backdrop-blur-none",
|
|
3553
3947
|
[decl("--baro-backdrop-blur", ""), ...filters()],
|
|
@@ -3776,56 +4170,52 @@ functionalUtility({
|
|
|
3776
4170
|
description: "sepia filter utility (static, number, arbitrary, custom property supported)",
|
|
3777
4171
|
category: "effects"
|
|
3778
4172
|
});
|
|
4173
|
+
const SHADOW_COMPOSITE = "var(--baro-inset-shadow), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow), var(--baro-ring-shadow), var(--baro-shadow)";
|
|
4174
|
+
const ringShadowProperties = () => atRoot([
|
|
4175
|
+
property("--baro-shadow", "0 0 #0000"),
|
|
4176
|
+
property("--baro-inset-shadow", "0 0 #0000"),
|
|
4177
|
+
property("--baro-inset-ring-shadow", "0 0 #0000"),
|
|
4178
|
+
property("--baro-ring-offset-shadow", "0 0 #0000"),
|
|
4179
|
+
property("--baro-ring-shadow", "0 0 #0000"),
|
|
4180
|
+
property("--baro-ring-offset-width", "0px", "<length>"),
|
|
4181
|
+
property("--baro-ring-offset-color", "#fff")
|
|
4182
|
+
]);
|
|
4183
|
+
const shadowLayer = (value) => [
|
|
4184
|
+
ringShadowProperties(),
|
|
4185
|
+
decl("--baro-shadow", value),
|
|
4186
|
+
decl("box-shadow", SHADOW_COMPOSITE)
|
|
4187
|
+
];
|
|
3779
4188
|
[
|
|
3780
4189
|
["shadow-2xs", "var(--shadow-2xs)"],
|
|
3781
4190
|
["shadow-xs", "var(--shadow-xs)"],
|
|
3782
4191
|
["shadow-sm", "var(--shadow-sm)"],
|
|
3783
|
-
["shadow", "
|
|
4192
|
+
["shadow", "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)"],
|
|
3784
4193
|
["shadow-md", "var(--shadow-md)"],
|
|
3785
4194
|
["shadow-lg", "var(--shadow-lg)"],
|
|
3786
4195
|
["shadow-xl", "var(--shadow-xl)"],
|
|
3787
4196
|
["shadow-2xl", "var(--shadow-2xl)"],
|
|
3788
4197
|
["shadow-none", "0 0 #0000"]
|
|
3789
4198
|
].forEach(([name, value]) => {
|
|
3790
|
-
staticUtility(name, [
|
|
4199
|
+
staticUtility(name, [
|
|
4200
|
+
ringShadowProperties,
|
|
4201
|
+
["--baro-shadow", value],
|
|
4202
|
+
["box-shadow", SHADOW_COMPOSITE]
|
|
4203
|
+
], { category: "effects" });
|
|
3791
4204
|
});
|
|
3792
4205
|
[
|
|
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
|
-
],
|
|
4206
|
+
["inset-shadow-2xs", "inset 0 1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4207
|
+
["inset-shadow-xs", "inset 0 1px 1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4208
|
+
["inset-shadow-sm", "inset 0 2px 4px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4209
|
+
["inset-shadow-md", "inset 0 4px 6px -1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4210
|
+
["inset-shadow-lg", "inset 0 10px 15px -3px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4211
|
+
["inset-shadow-xl", "inset 0 20px 25px -5px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4212
|
+
["inset-shadow-2xl", "inset 0 25px 50px -12px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
3821
4213
|
["inset-shadow-none", "0 0 #0000"]
|
|
3822
4214
|
].forEach(([name, value]) => {
|
|
3823
4215
|
staticUtility(name, [
|
|
4216
|
+
ringShadowProperties,
|
|
3824
4217
|
["--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
|
-
]
|
|
4218
|
+
["box-shadow", SHADOW_COMPOSITE]
|
|
3829
4219
|
], { category: "effects" });
|
|
3830
4220
|
});
|
|
3831
4221
|
function createShadowThemeColor(key, main, opacity, realThemeValue) {
|
|
@@ -3890,9 +4280,9 @@ functionalUtility({
|
|
|
3890
4280
|
)
|
|
3891
4281
|
];
|
|
3892
4282
|
}
|
|
3893
|
-
return [decl("
|
|
4283
|
+
return [decl("--baro-shadow-color", main)];
|
|
3894
4284
|
}
|
|
3895
|
-
return
|
|
4285
|
+
return shadowLayer(main);
|
|
3896
4286
|
}
|
|
3897
4287
|
if (main === "inherit" || main === "current" || main === "transparent") {
|
|
3898
4288
|
return [
|
|
@@ -3901,7 +4291,7 @@ functionalUtility({
|
|
|
3901
4291
|
}
|
|
3902
4292
|
return null;
|
|
3903
4293
|
},
|
|
3904
|
-
handleCustomProperty: (value) =>
|
|
4294
|
+
handleCustomProperty: (value) => shadowLayer(`var(${value})`)
|
|
3905
4295
|
});
|
|
3906
4296
|
functionalUtility({
|
|
3907
4297
|
name: "inset-shadow",
|
|
@@ -3960,22 +4350,39 @@ functionalUtility({
|
|
|
3960
4350
|
["ring-8", "8px"]
|
|
3961
4351
|
].forEach(([name, px]) => {
|
|
3962
4352
|
staticUtility(name, [
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
// default blue-500/50
|
|
4353
|
+
ringShadowProperties,
|
|
4354
|
+
// Like Tailwind, ring-N does not set the offset vars (they come from @property defaults and ring-offset-*),
|
|
4355
|
+
// so `ring-N ring-offset-M` composes the same in either rule order.
|
|
4356
|
+
// No hardcoded ring color: Tailwind v4's default ring color is currentColor (via the var() fallback below).
|
|
3968
4357
|
[
|
|
3969
4358
|
"--baro-ring-shadow",
|
|
3970
|
-
|
|
4359
|
+
ringShadowValue(px)
|
|
3971
4360
|
],
|
|
3972
|
-
["--baro-ring-offset-shadow", `0 0 #0000`],
|
|
3973
4361
|
[
|
|
3974
4362
|
"box-shadow",
|
|
3975
4363
|
"var(--baro-inset-shadow), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow), var(--baro-ring-shadow), var(--baro-shadow)"
|
|
3976
4364
|
]
|
|
3977
4365
|
]);
|
|
3978
4366
|
});
|
|
4367
|
+
function ringShadowValue(width) {
|
|
4368
|
+
return `var(--baro-ring-inset,) 0 0 0 calc(${width} + var(--baro-ring-offset-width)) var(--baro-ring-color, currentcolor)`;
|
|
4369
|
+
}
|
|
4370
|
+
[
|
|
4371
|
+
["ring-offset-0", "0px"],
|
|
4372
|
+
["ring-offset-1", "1px"],
|
|
4373
|
+
["ring-offset-2", "2px"],
|
|
4374
|
+
["ring-offset-4", "4px"],
|
|
4375
|
+
["ring-offset-8", "8px"]
|
|
4376
|
+
].forEach(([name, px]) => {
|
|
4377
|
+
staticUtility(name, [
|
|
4378
|
+
["--baro-ring-offset-width", px],
|
|
4379
|
+
["--baro-ring-offset-color", "#fff"],
|
|
4380
|
+
[
|
|
4381
|
+
"--baro-ring-offset-shadow",
|
|
4382
|
+
`var(--baro-ring-inset,) 0 0 0 var(--baro-ring-offset-width) var(--baro-ring-offset-color)`
|
|
4383
|
+
]
|
|
4384
|
+
], { category: "effects" });
|
|
4385
|
+
});
|
|
3979
4386
|
[
|
|
3980
4387
|
["inset-ring", "1px"],
|
|
3981
4388
|
["inset-ring-0", "0px"],
|
|
@@ -3985,20 +4392,11 @@ functionalUtility({
|
|
|
3985
4392
|
["inset-ring-8", "8px"]
|
|
3986
4393
|
].forEach(([name, px]) => {
|
|
3987
4394
|
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
|
-
]);
|
|
4395
|
+
// Tailwind 4.1.13: only the inset-ring layer; the colour defaults to currentcolor via the var() fallback.
|
|
4396
|
+
ringShadowProperties,
|
|
4397
|
+
["--baro-inset-ring-shadow", `inset 0 0 0 ${px} var(--baro-inset-ring-color, currentcolor)`],
|
|
4398
|
+
["box-shadow", SHADOW_COMPOSITE]
|
|
4399
|
+
], { category: "effects" });
|
|
4002
4400
|
});
|
|
4003
4401
|
staticUtility("ring-inset", [["--baro-ring-inset", "inset"]], { category: "effects" });
|
|
4004
4402
|
function createRingColorDecls(key, main, opacity, realThemeValue) {
|
|
@@ -4072,7 +4470,15 @@ functionalUtility({
|
|
|
4072
4470
|
decl("--baro-ring-color", fallback)
|
|
4073
4471
|
];
|
|
4074
4472
|
}
|
|
4075
|
-
|
|
4473
|
+
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)) {
|
|
4474
|
+
const width = main.startsWith("length:") ? main.slice(7) : main;
|
|
4475
|
+
return [
|
|
4476
|
+
ringShadowProperties(),
|
|
4477
|
+
decl("--baro-ring-shadow", ringShadowValue(width)),
|
|
4478
|
+
decl("box-shadow", SHADOW_COMPOSITE)
|
|
4479
|
+
];
|
|
4480
|
+
}
|
|
4481
|
+
return [parseColor(main) ? decl("--baro-ring-color", main) : decl("box-shadow", main)];
|
|
4076
4482
|
}
|
|
4077
4483
|
if (main === "inherit" || main === "current" || main === "transparent") {
|
|
4078
4484
|
return [
|
|
@@ -4314,18 +4720,30 @@ functionalUtility({
|
|
|
4314
4720
|
description: "mask-size utility (static, arbitrary, custom property supported)",
|
|
4315
4721
|
category: "effects"
|
|
4316
4722
|
});
|
|
4723
|
+
const maskProperties = () => atRoot([
|
|
4724
|
+
property("--baro-mask-linear", "linear-gradient(#fff, #fff)"),
|
|
4725
|
+
property("--baro-mask-radial", "linear-gradient(#fff, #fff)"),
|
|
4726
|
+
property("--baro-mask-conic", "linear-gradient(#fff, #fff)"),
|
|
4727
|
+
property("--baro-mask-linear-position", "0deg"),
|
|
4728
|
+
property("--baro-mask-linear-from-position", "0%"),
|
|
4729
|
+
property("--baro-mask-linear-to-position", "100%"),
|
|
4730
|
+
property("--baro-mask-linear-from-color", "black"),
|
|
4731
|
+
property("--baro-mask-linear-to-color", "transparent")
|
|
4732
|
+
]);
|
|
4317
4733
|
functionalUtility({
|
|
4318
4734
|
name: "mask-linear-from",
|
|
4319
4735
|
handleBareValue: ({ value }) => /^(?:100|[1-9]?\d)%$/.test(value) ? value : null,
|
|
4320
4736
|
handle: (value) => [
|
|
4321
|
-
decl("mask-image", "var(--
|
|
4737
|
+
decl("mask-image", "var(--baro-mask-linear), var(--baro-mask-radial), var(--baro-mask-conic)"),
|
|
4322
4738
|
decl("mask-composite", "intersect"),
|
|
4323
|
-
decl("--
|
|
4324
|
-
decl("--
|
|
4325
|
-
decl("--
|
|
4739
|
+
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)"),
|
|
4740
|
+
decl("--baro-mask-linear", "linear-gradient(var(--baro-mask-linear-stops))"),
|
|
4741
|
+
decl("--baro-mask-linear-from-position", value),
|
|
4742
|
+
maskProperties()
|
|
4326
4743
|
],
|
|
4327
4744
|
category: "effects"
|
|
4328
4745
|
});
|
|
4746
|
+
staticUtility("mask-none", [["mask-image", "none"]], { category: "effects" });
|
|
4329
4747
|
functionalUtility({
|
|
4330
4748
|
name: "mask",
|
|
4331
4749
|
supportsArbitrary: true,
|
|
@@ -4361,7 +4779,7 @@ functionalUtility({
|
|
|
4361
4779
|
category: "layout"
|
|
4362
4780
|
});
|
|
4363
4781
|
staticUtility("aspect-square", [["aspect-ratio", "1 / 1"]], { category: "layout" });
|
|
4364
|
-
staticUtility("aspect-video", [["aspect-ratio", "var(--aspect-
|
|
4782
|
+
staticUtility("aspect-video", [["aspect-ratio", "var(--aspect-video)"]], { category: "layout" });
|
|
4365
4783
|
staticUtility("aspect-auto", [["aspect-ratio", "auto"]], { category: "layout" });
|
|
4366
4784
|
functionalUtility({
|
|
4367
4785
|
name: "aspect",
|
|
@@ -4445,10 +4863,10 @@ staticUtility("sr-only", [
|
|
|
4445
4863
|
["position", "absolute"],
|
|
4446
4864
|
["width", "1px"],
|
|
4447
4865
|
["height", "1px"],
|
|
4448
|
-
["margin", "-1px"],
|
|
4449
4866
|
["padding", "0"],
|
|
4867
|
+
["margin", "-1px"],
|
|
4450
4868
|
["overflow", "hidden"],
|
|
4451
|
-
["clip", "
|
|
4869
|
+
["clip-path", "inset(50%)"],
|
|
4452
4870
|
["white-space", "nowrap"],
|
|
4453
4871
|
["border-width", "0"]
|
|
4454
4872
|
], { category: "layout" });
|
|
@@ -4456,12 +4874,39 @@ staticUtility("not-sr-only", [
|
|
|
4456
4874
|
["position", "static"],
|
|
4457
4875
|
["width", "auto"],
|
|
4458
4876
|
["height", "auto"],
|
|
4459
|
-
["margin", "0"],
|
|
4460
4877
|
["padding", "0"],
|
|
4878
|
+
["margin", "0"],
|
|
4461
4879
|
["overflow", "visible"],
|
|
4462
|
-
["clip", "
|
|
4880
|
+
["clip-path", "none"],
|
|
4463
4881
|
["white-space", "normal"]
|
|
4464
4882
|
], { category: "layout" });
|
|
4883
|
+
staticUtility("@container", [["container-type", "inline-size"]], { category: "layout" });
|
|
4884
|
+
staticUtility("@container-normal", [["container-type", "normal"]], { category: "layout" });
|
|
4885
|
+
registerUtility({
|
|
4886
|
+
name: "@container",
|
|
4887
|
+
match: (className) => /^@container\/[a-zA-Z0-9_-]+$/.test(className),
|
|
4888
|
+
handler: (_value, _ctx, token) => {
|
|
4889
|
+
const name = /^@container\/([a-zA-Z0-9_-]+)$/.exec(`${token.prefix}${token.value ? `-${token.value}` : ""}`)?.[1];
|
|
4890
|
+
return name ? [decl("container-type", "inline-size"), decl("container-name", name)] : null;
|
|
4891
|
+
},
|
|
4892
|
+
category: "layout"
|
|
4893
|
+
});
|
|
4894
|
+
const toRem = (v) => {
|
|
4895
|
+
const m = /^(-?\d*\.?\d+)(rem|px|em)$/.exec(v.trim());
|
|
4896
|
+
if (!m) return Number.NaN;
|
|
4897
|
+
return m[2] === "px" ? Number(m[1]) / 16 : Number(m[1]);
|
|
4898
|
+
};
|
|
4899
|
+
registerUtility({
|
|
4900
|
+
name: "container",
|
|
4901
|
+
match: (className) => className === "container",
|
|
4902
|
+
handler: (_value, ctx) => {
|
|
4903
|
+
const bps = ctx.theme("breakpoints") || ctx.config("theme.breakpoints") || {};
|
|
4904
|
+
const values = Object.values(bps).filter((v) => typeof v === "string" && !Number.isNaN(toRem(v)));
|
|
4905
|
+
values.sort((a, b) => toRem(a) - toRem(b));
|
|
4906
|
+
return [decl("width", "100%"), ...values.map((v) => atRule("media", `(width >= ${v})`, [decl("max-width", v)]))];
|
|
4907
|
+
},
|
|
4908
|
+
category: "layout"
|
|
4909
|
+
});
|
|
4465
4910
|
staticUtility("float-right", [["float", "right"]], { category: "layout" });
|
|
4466
4911
|
staticUtility("float-left", [["float", "left"]], { category: "layout" });
|
|
4467
4912
|
staticUtility("float-start", [["float", "inline-start"]], { category: "layout" });
|
|
@@ -4542,6 +4987,7 @@ staticUtility("sticky", [["position", "sticky"]], { category: "layout" });
|
|
|
4542
4987
|
staticUtility(`-${name}-px`, [[prop, "-1px"]], { category: "layout" });
|
|
4543
4988
|
functionalUtility({
|
|
4544
4989
|
name,
|
|
4990
|
+
spacingKeys: true,
|
|
4545
4991
|
prop,
|
|
4546
4992
|
supportsNegative: true,
|
|
4547
4993
|
supportsFraction: true,
|
|
@@ -4572,12 +5018,13 @@ staticUtility("invisible", [["visibility", "hidden"]], { category: "layout" });
|
|
|
4572
5018
|
staticUtility("collapse", [["visibility", "collapse"]], { category: "layout" });
|
|
4573
5019
|
functionalUtility({
|
|
4574
5020
|
name: "gap-x",
|
|
5021
|
+
spacingKeys: true,
|
|
4575
5022
|
prop: "column-gap",
|
|
4576
5023
|
supportsArbitrary: true,
|
|
4577
5024
|
// gap-x-[10vw]
|
|
4578
5025
|
supportsCustomProperty: true,
|
|
4579
5026
|
// gap-x-(--my-gap-x)
|
|
4580
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5027
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4581
5028
|
handle: (value) => {
|
|
4582
5029
|
if (typeof value === "string") return [decl("column-gap", value)];
|
|
4583
5030
|
return null;
|
|
@@ -4588,12 +5035,13 @@ functionalUtility({
|
|
|
4588
5035
|
});
|
|
4589
5036
|
functionalUtility({
|
|
4590
5037
|
name: "gap-y",
|
|
5038
|
+
spacingKeys: true,
|
|
4591
5039
|
prop: "row-gap",
|
|
4592
5040
|
supportsArbitrary: true,
|
|
4593
5041
|
// gap-y-[10vw]
|
|
4594
5042
|
supportsCustomProperty: true,
|
|
4595
5043
|
// gap-y-(--my-gap-y)
|
|
4596
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5044
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4597
5045
|
handle: (value) => {
|
|
4598
5046
|
if (typeof value === "string") return [decl("row-gap", value)];
|
|
4599
5047
|
return null;
|
|
@@ -4604,12 +5052,13 @@ functionalUtility({
|
|
|
4604
5052
|
});
|
|
4605
5053
|
functionalUtility({
|
|
4606
5054
|
name: "gap",
|
|
5055
|
+
spacingKeys: true,
|
|
4607
5056
|
prop: "gap",
|
|
4608
5057
|
supportsArbitrary: true,
|
|
4609
5058
|
// gap-[10vw]
|
|
4610
5059
|
supportsCustomProperty: true,
|
|
4611
5060
|
// gap-(--my-gap)
|
|
4612
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5061
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4613
5062
|
handle: (value) => {
|
|
4614
5063
|
if (typeof value === "string") return [decl("gap", value)];
|
|
4615
5064
|
return null;
|
|
@@ -4668,6 +5117,31 @@ staticUtility("flex-nowrap", [["flex-wrap", "nowrap"]], { category: "flex-grid"
|
|
|
4668
5117
|
staticUtility("flex-auto", [["flex", "1 1 auto"]], { category: "flex-grid" });
|
|
4669
5118
|
staticUtility("flex-initial", [["flex", "0 1 auto"]], { category: "flex-grid" });
|
|
4670
5119
|
staticUtility("flex-none", [["flex", "none"]], { category: "flex-grid" });
|
|
5120
|
+
staticUtility("flex-grow", [["flex-grow", "1"]], { category: "flex-grid" });
|
|
5121
|
+
functionalUtility({
|
|
5122
|
+
name: "flex-grow",
|
|
5123
|
+
prop: "flex-grow",
|
|
5124
|
+
supportsArbitrary: true,
|
|
5125
|
+
// grow-[25vw], grow-[2], grow-[var(--factor)], etc.
|
|
5126
|
+
supportsCustomProperty: true,
|
|
5127
|
+
// grow-(--my-grow)
|
|
5128
|
+
handleBareValue: ({ value }) => parseNumber(value),
|
|
5129
|
+
handle: (value) => [decl("flex-grow", value)],
|
|
5130
|
+
description: "flex-grow utility (number, arbitrary, custom property supported)",
|
|
5131
|
+
category: "flex-grid"
|
|
5132
|
+
});
|
|
5133
|
+
staticUtility("flex-shrink", [["flex-shrink", "1"]], { category: "flex-grid" });
|
|
5134
|
+
functionalUtility({
|
|
5135
|
+
name: "flex-shrink",
|
|
5136
|
+
prop: "flex-shrink",
|
|
5137
|
+
supportsArbitrary: true,
|
|
5138
|
+
// shrink-[2], shrink-[calc(100vw-var(--sidebar))], etc.
|
|
5139
|
+
supportsCustomProperty: true,
|
|
5140
|
+
// shrink-(--my-shrink)
|
|
5141
|
+
handleBareValue: ({ value }) => parseNumber(value),
|
|
5142
|
+
description: "flex-shrink utility (number, arbitrary, custom property supported)",
|
|
5143
|
+
category: "flex-grid"
|
|
5144
|
+
});
|
|
4671
5145
|
functionalUtility({
|
|
4672
5146
|
name: "flex",
|
|
4673
5147
|
supportsArbitrary: true,
|
|
@@ -4901,7 +5375,7 @@ functionalUtility({
|
|
|
4901
5375
|
// gap-x-[10vw]
|
|
4902
5376
|
supportsCustomProperty: true,
|
|
4903
5377
|
// gap-x-(--my-gap-x)
|
|
4904
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5378
|
+
handleBareValue: ({ value }) => value === "px" ? "1px" : parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4905
5379
|
handle: (value) => {
|
|
4906
5380
|
if (typeof value === "string") return [decl("column-gap", value)];
|
|
4907
5381
|
return null;
|
|
@@ -4917,7 +5391,7 @@ functionalUtility({
|
|
|
4917
5391
|
// gap-y-[10vw]
|
|
4918
5392
|
supportsCustomProperty: true,
|
|
4919
5393
|
// gap-y-(--my-gap-y)
|
|
4920
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5394
|
+
handleBareValue: ({ value }) => value === "px" ? "1px" : parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4921
5395
|
handle: (value) => {
|
|
4922
5396
|
if (typeof value === "string") return [decl("row-gap", value)];
|
|
4923
5397
|
return null;
|
|
@@ -4933,7 +5407,7 @@ functionalUtility({
|
|
|
4933
5407
|
// gap-[10vw]
|
|
4934
5408
|
supportsCustomProperty: true,
|
|
4935
5409
|
// gap-(--my-gap)
|
|
4936
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5410
|
+
handleBareValue: ({ value }) => value === "px" ? "1px" : parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4937
5411
|
handle: (value) => {
|
|
4938
5412
|
if (typeof value === "string") return [decl("gap", value)];
|
|
4939
5413
|
return null;
|
|
@@ -4961,11 +5435,11 @@ staticUtility("justify-items-center-safe", [["justify-items", "safe center"]], {
|
|
|
4961
5435
|
staticUtility("justify-items-stretch", [["justify-items", "stretch"]], { category: "flex-grid" });
|
|
4962
5436
|
staticUtility("justify-items-normal", [["justify-items", "normal"]], { category: "flex-grid" });
|
|
4963
5437
|
staticUtility("justify-self-auto", [["justify-self", "auto"]], { category: "flex-grid" });
|
|
4964
|
-
staticUtility("justify-self-start", [["justify-self", "start"]], { category: "flex-grid" });
|
|
5438
|
+
staticUtility("justify-self-start", [["justify-self", "flex-start"]], { category: "flex-grid" });
|
|
4965
5439
|
staticUtility("justify-self-center", [["justify-self", "center"]], { category: "flex-grid" });
|
|
4966
5440
|
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" });
|
|
5441
|
+
staticUtility("justify-self-end", [["justify-self", "flex-end"]], { category: "flex-grid" });
|
|
5442
|
+
staticUtility("justify-self-end-safe", [["justify-self", "safe flex-end"]], { category: "flex-grid" });
|
|
4969
5443
|
staticUtility("justify-self-stretch", [["justify-self", "stretch"]], { category: "flex-grid" });
|
|
4970
5444
|
staticUtility("content-normal", [["align-content", "normal"]], { category: "flex-grid" });
|
|
4971
5445
|
staticUtility("content-center", [["align-content", "center"]], { category: "flex-grid" });
|
|
@@ -5096,11 +5570,12 @@ functionalUtility({
|
|
|
5096
5570
|
].forEach(([name, prop]) => {
|
|
5097
5571
|
staticUtility(`${name}-px`, [[prop, "1px"]], { category: "spacing" });
|
|
5098
5572
|
functionalUtility({
|
|
5573
|
+
spacingKeys: true,
|
|
5099
5574
|
name,
|
|
5100
5575
|
prop,
|
|
5101
5576
|
supportsArbitrary: true,
|
|
5102
5577
|
supportsCustomProperty: true,
|
|
5103
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5578
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5104
5579
|
description: `${name} utility (number, arbitrary, custom property supported)`,
|
|
5105
5580
|
category: "spacing"
|
|
5106
5581
|
});
|
|
@@ -5120,149 +5595,55 @@ functionalUtility({
|
|
|
5120
5595
|
staticUtility(`${name}-px`, [[prop, "1px"]], { category: "spacing" });
|
|
5121
5596
|
staticUtility(`-${name}-px`, [[prop, "-1px"]], { category: "spacing" });
|
|
5122
5597
|
functionalUtility({
|
|
5598
|
+
spacingKeys: true,
|
|
5123
5599
|
name,
|
|
5124
5600
|
prop,
|
|
5125
5601
|
supportsNegative: true,
|
|
5126
5602
|
supportsArbitrary: true,
|
|
5127
5603
|
supportsCustomProperty: true,
|
|
5128
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5129
|
-
handleNegativeBareValue: ({ value }) => `calc(var(--spacing) * -${value})
|
|
5604
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5605
|
+
handleNegativeBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * -${value})` : null,
|
|
5130
5606
|
description: `${name} margin utility (number, negative, arbitrary, custom property, auto, px supported)`,
|
|
5131
5607
|
category: "spacing"
|
|
5132
5608
|
});
|
|
5133
5609
|
});
|
|
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
|
-
|
|
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"
|
|
5610
|
+
const SPACE_SELECTOR = ":where(& > :not(:last-child))";
|
|
5611
|
+
["x", "y"].forEach((axis) => {
|
|
5612
|
+
const name = `space-${axis}`;
|
|
5613
|
+
const rev = `--baro-space-${axis}-reverse`;
|
|
5614
|
+
const [start, end] = axis === "x" ? ["margin-inline-start", "margin-inline-end"] : ["margin-block-start", "margin-block-end"];
|
|
5615
|
+
const reverseProperty = () => atRoot([property(rev, "0")]);
|
|
5616
|
+
const spaceRule = (v) => rule(SPACE_SELECTOR, [
|
|
5617
|
+
decl(rev, "0"),
|
|
5618
|
+
decl(start, `calc(${v} * var(${rev}))`),
|
|
5619
|
+
decl(end, `calc(${v} * calc(1 - var(${rev})))`)
|
|
5620
|
+
]);
|
|
5621
|
+
const body = (v) => [reverseProperty(), spaceRule(v)];
|
|
5622
|
+
staticUtility(`${name}-px`, [reverseProperty, () => spaceRule("1px")], { category: "spacing" });
|
|
5623
|
+
staticUtility(`-${name}-px`, [reverseProperty, () => spaceRule("-1px")], { category: "spacing" });
|
|
5624
|
+
staticUtility(`${name}-reverse`, [
|
|
5625
|
+
reverseProperty,
|
|
5626
|
+
() => rule(SPACE_SELECTOR, [decl(rev, "1")])
|
|
5627
|
+
], { category: "spacing" });
|
|
5628
|
+
functionalUtility({
|
|
5629
|
+
spacingKeys: true,
|
|
5630
|
+
name,
|
|
5631
|
+
supportsNegative: true,
|
|
5632
|
+
supportsArbitrary: true,
|
|
5633
|
+
supportsCustomProperty: true,
|
|
5634
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5635
|
+
handleNegativeBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * -${value})` : null,
|
|
5636
|
+
handle: (value, _ctx, token) => {
|
|
5637
|
+
let v = String(value);
|
|
5638
|
+
if (/^-?\d+(\.\d+)?$/.test(v)) {
|
|
5639
|
+
v = `calc(var(--spacing) * ${token.negative ? "-" : ""}${v})`;
|
|
5640
|
+
}
|
|
5641
|
+
return body(v);
|
|
5642
|
+
},
|
|
5643
|
+
handleCustomProperty: (value) => body(`var(${value})`),
|
|
5644
|
+
description: `${name} utility (number, negative, px, arbitrary, custom property, reverse supported)`,
|
|
5645
|
+
category: "spacing"
|
|
5646
|
+
});
|
|
5266
5647
|
});
|
|
5267
5648
|
[
|
|
5268
5649
|
["w-auto", "auto"],
|
|
@@ -5295,6 +5676,7 @@ functionalUtility({
|
|
|
5295
5676
|
staticUtility(name, [["width", value]]);
|
|
5296
5677
|
});
|
|
5297
5678
|
functionalUtility({
|
|
5679
|
+
spacingKeys: true,
|
|
5298
5680
|
name: "w",
|
|
5299
5681
|
prop: "width",
|
|
5300
5682
|
supportsArbitrary: true,
|
|
@@ -5327,6 +5709,7 @@ functionalUtility({
|
|
|
5327
5709
|
staticUtility(name, [["width", w], ["height", h]]);
|
|
5328
5710
|
});
|
|
5329
5711
|
functionalUtility({
|
|
5712
|
+
spacingKeys: true,
|
|
5330
5713
|
name: "size",
|
|
5331
5714
|
supportsArbitrary: true,
|
|
5332
5715
|
supportsCustomProperty: true,
|
|
@@ -5366,6 +5749,7 @@ functionalUtility({
|
|
|
5366
5749
|
staticUtility(name, [["height", value]]);
|
|
5367
5750
|
});
|
|
5368
5751
|
functionalUtility({
|
|
5752
|
+
spacingKeys: true,
|
|
5369
5753
|
name: "h",
|
|
5370
5754
|
prop: "height",
|
|
5371
5755
|
supportsArbitrary: true,
|
|
@@ -5396,6 +5780,7 @@ functionalUtility({
|
|
|
5396
5780
|
staticUtility(name, [["min-height", value]], { category: "sizing" });
|
|
5397
5781
|
});
|
|
5398
5782
|
functionalUtility({
|
|
5783
|
+
spacingKeys: true,
|
|
5399
5784
|
name: "min-h",
|
|
5400
5785
|
prop: "min-height",
|
|
5401
5786
|
supportsArbitrary: true,
|
|
@@ -5426,6 +5811,7 @@ functionalUtility({
|
|
|
5426
5811
|
staticUtility(name, [["max-height", value]], { category: "sizing" });
|
|
5427
5812
|
});
|
|
5428
5813
|
functionalUtility({
|
|
5814
|
+
spacingKeys: true,
|
|
5429
5815
|
name: "max-h",
|
|
5430
5816
|
prop: "max-height",
|
|
5431
5817
|
supportsArbitrary: true,
|
|
@@ -5472,6 +5858,7 @@ functionalUtility({
|
|
|
5472
5858
|
staticUtility(name, [["min-width", value]], { category: "sizing" });
|
|
5473
5859
|
});
|
|
5474
5860
|
functionalUtility({
|
|
5861
|
+
spacingKeys: true,
|
|
5475
5862
|
name: "min-w",
|
|
5476
5863
|
prop: "min-width",
|
|
5477
5864
|
supportsArbitrary: true,
|
|
@@ -5489,6 +5876,9 @@ functionalUtility({
|
|
|
5489
5876
|
});
|
|
5490
5877
|
[
|
|
5491
5878
|
["max-w-none", "none"],
|
|
5879
|
+
["max-w-min", "min-content"],
|
|
5880
|
+
["max-w-max", "max-content"],
|
|
5881
|
+
["max-w-fit", "fit-content"],
|
|
5492
5882
|
["max-w-xs", "var(--container-xs)"],
|
|
5493
5883
|
["max-w-sm", "var(--container-sm)"],
|
|
5494
5884
|
["max-w-md", "var(--container-md)"],
|
|
@@ -5504,6 +5894,7 @@ functionalUtility({
|
|
|
5504
5894
|
staticUtility(name, [["max-width", value]], { category: "sizing" });
|
|
5505
5895
|
});
|
|
5506
5896
|
functionalUtility({
|
|
5897
|
+
spacingKeys: true,
|
|
5507
5898
|
name: "max-w",
|
|
5508
5899
|
prop: "max-width",
|
|
5509
5900
|
supportsArbitrary: true,
|
|
@@ -5519,22 +5910,23 @@ functionalUtility({
|
|
|
5519
5910
|
description: "max-width utility (spacing, fraction, arbitrary, custom property, static supported)",
|
|
5520
5911
|
category: "sizing"
|
|
5521
5912
|
});
|
|
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-
|
|
5913
|
+
const leadingProperty = () => atRoot([property("--baro-leading")]);
|
|
5914
|
+
staticUtility("font-sans", [["font-family", "var(--font-sans)"]], { category: "typography" });
|
|
5915
|
+
staticUtility("font-serif", [["font-family", "var(--font-serif)"]], { category: "typography" });
|
|
5916
|
+
staticUtility("font-mono", [["font-family", "var(--font-mono)"]], { category: "typography" });
|
|
5917
|
+
staticUtility("text-xs", [["font-size", "var(--text-xs)"], ["line-height", "var(--baro-leading, var(--text-xs--line-height))"]], { category: "typography" });
|
|
5918
|
+
staticUtility("text-sm", [["font-size", "var(--text-sm)"], ["line-height", "var(--baro-leading, var(--text-sm--line-height))"]], { category: "typography" });
|
|
5919
|
+
staticUtility("text-base", [["font-size", "var(--text-base)"], ["line-height", "var(--baro-leading, var(--text-base--line-height))"]], { category: "typography" });
|
|
5920
|
+
staticUtility("text-lg", [["font-size", "var(--text-lg)"], ["line-height", "var(--baro-leading, var(--text-lg--line-height))"]], { category: "typography" });
|
|
5921
|
+
staticUtility("text-xl", [["font-size", "var(--text-xl)"], ["line-height", "var(--baro-leading, var(--text-xl--line-height))"]], { category: "typography" });
|
|
5922
|
+
staticUtility("text-2xl", [["font-size", "var(--text-2xl)"], ["line-height", "var(--baro-leading, var(--text-2xl--line-height))"]], { category: "typography" });
|
|
5923
|
+
staticUtility("text-3xl", [["font-size", "var(--text-3xl)"], ["line-height", "var(--baro-leading, var(--text-3xl--line-height))"]], { category: "typography" });
|
|
5924
|
+
staticUtility("text-4xl", [["font-size", "var(--text-4xl)"], ["line-height", "var(--baro-leading, var(--text-4xl--line-height))"]], { category: "typography" });
|
|
5925
|
+
staticUtility("text-5xl", [["font-size", "var(--text-5xl)"], ["line-height", "var(--baro-leading, var(--text-5xl--line-height))"]], { category: "typography" });
|
|
5926
|
+
staticUtility("text-6xl", [["font-size", "var(--text-6xl)"], ["line-height", "var(--baro-leading, var(--text-6xl--line-height))"]], { category: "typography" });
|
|
5927
|
+
staticUtility("text-7xl", [["font-size", "var(--text-7xl)"], ["line-height", "var(--baro-leading, var(--text-7xl--line-height))"]], { category: "typography" });
|
|
5928
|
+
staticUtility("text-8xl", [["font-size", "var(--text-8xl)"], ["line-height", "var(--baro-leading, var(--text-8xl--line-height))"]], { category: "typography" });
|
|
5929
|
+
staticUtility("text-9xl", [["font-size", "var(--text-9xl)"], ["line-height", "var(--baro-leading, var(--text-9xl--line-height))"]], { category: "typography" });
|
|
5538
5930
|
staticUtility("font-thin", [["font-weight", "var(--font-weight-thin)"]], { category: "typography" });
|
|
5539
5931
|
staticUtility("font-extralight", [["font-weight", "var(--font-weight-extralight)"]], { category: "typography" });
|
|
5540
5932
|
staticUtility("font-light", [["font-weight", "var(--font-weight-light)"]], { category: "typography" });
|
|
@@ -5580,12 +5972,12 @@ functionalUtility({
|
|
|
5580
5972
|
description: "letter-spacing utility (theme, arbitrary, custom property supported)",
|
|
5581
5973
|
category: "typography"
|
|
5582
5974
|
});
|
|
5583
|
-
staticUtility("leading-none", [["
|
|
5584
|
-
staticUtility("leading-tight", [["
|
|
5585
|
-
staticUtility("leading-snug", [["
|
|
5586
|
-
staticUtility("leading-normal", [["
|
|
5587
|
-
staticUtility("leading-relaxed", [["
|
|
5588
|
-
staticUtility("leading-loose", [["
|
|
5975
|
+
staticUtility("leading-none", [["--baro-leading", "var(--leading-none, 1)"], ["line-height", "var(--leading-none, 1)"], leadingProperty()], { category: "typography" });
|
|
5976
|
+
staticUtility("leading-tight", [["--baro-leading", "var(--leading-tight, 1.25)"], ["line-height", "var(--leading-tight, 1.25)"], leadingProperty()], { category: "typography" });
|
|
5977
|
+
staticUtility("leading-snug", [["--baro-leading", "var(--leading-snug, 1.375)"], ["line-height", "var(--leading-snug, 1.375)"], leadingProperty()], { category: "typography" });
|
|
5978
|
+
staticUtility("leading-normal", [["--baro-leading", "var(--leading-normal, 1.5)"], ["line-height", "var(--leading-normal, 1.5)"], leadingProperty()], { category: "typography" });
|
|
5979
|
+
staticUtility("leading-relaxed", [["--baro-leading", "var(--leading-relaxed, 1.625)"], ["line-height", "var(--leading-relaxed, 1.625)"], leadingProperty()], { category: "typography" });
|
|
5980
|
+
staticUtility("leading-loose", [["--baro-leading", "var(--leading-loose, 2)"], ["line-height", "var(--leading-loose, 2)"], leadingProperty()], { category: "typography" });
|
|
5589
5981
|
functionalUtility({
|
|
5590
5982
|
name: "leading",
|
|
5591
5983
|
prop: "line-height",
|
|
@@ -5593,6 +5985,8 @@ functionalUtility({
|
|
|
5593
5985
|
supportsArbitrary: true,
|
|
5594
5986
|
supportsCustomProperty: true,
|
|
5595
5987
|
handleBareValue: ({ value }) => parseNumber(value),
|
|
5988
|
+
handle: (value) => [decl("--baro-leading", value), decl("line-height", value), leadingProperty()],
|
|
5989
|
+
handleCustomProperty: (value) => [decl("--baro-leading", `var(${value})`), decl("line-height", `var(${value})`), leadingProperty()],
|
|
5596
5990
|
description: "line-height utility (theme, number, arbitrary, custom property supported)",
|
|
5597
5991
|
category: "typography"
|
|
5598
5992
|
});
|
|
@@ -5602,6 +5996,17 @@ staticUtility("text-right", [["text-align", "right"]], { category: "typography"
|
|
|
5602
5996
|
staticUtility("text-justify", [["text-align", "justify"]], { category: "typography" });
|
|
5603
5997
|
staticUtility("text-start", [["text-align", "start"]], { category: "typography" });
|
|
5604
5998
|
staticUtility("text-end", [["text-align", "end"]], { category: "typography" });
|
|
5999
|
+
const FONT_SIZE_HINTS = /* @__PURE__ */ new Set(["length", "size", "percentage", "absolute-size", "relative-size"]);
|
|
6000
|
+
const FONT_SIZE_KEYWORDS = /^(xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large|larger|smaller)$/;
|
|
6001
|
+
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;
|
|
6002
|
+
function textArbitraryKind(raw2) {
|
|
6003
|
+
const hint = /^([a-z-]+):(.+)$/.exec(raw2);
|
|
6004
|
+
if (hint && (hint[1] === "color" || FONT_SIZE_HINTS.has(hint[1]))) {
|
|
6005
|
+
return { fontSize: hint[1] !== "color", value: hint[2] };
|
|
6006
|
+
}
|
|
6007
|
+
const fontSize = raw2 === "0" || LENGTH_RE.test(raw2) || FONT_SIZE_KEYWORDS.test(raw2) || /^(calc|min|max|clamp)\(/.test(raw2);
|
|
6008
|
+
return { fontSize, value: raw2 };
|
|
6009
|
+
}
|
|
5605
6010
|
staticUtility("text-inherit", [["color", "inherit"]], { category: "typography" });
|
|
5606
6011
|
staticUtility("text-current", [["color", "currentColor"]], { category: "typography" });
|
|
5607
6012
|
staticUtility("text-transparent", [["color", "transparent"]], { category: "typography" });
|
|
@@ -5615,27 +6020,14 @@ functionalUtility({
|
|
|
5615
6020
|
supportsCustomProperty: true,
|
|
5616
6021
|
supportsOpacity: true,
|
|
5617
6022
|
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)];
|
|
6023
|
+
if (extra?.realThemeValue) return themeColorDecls("color", value, extra);
|
|
6024
|
+
const kind = textArbitraryKind(value);
|
|
6025
|
+
return [decl(kind.fontSize ? "font-size" : "color", kind.value)];
|
|
5633
6026
|
},
|
|
6027
|
+
// Tailwind 4: text-(--x) is a colour; text-(length:--x) is a font-size.
|
|
5634
6028
|
handleCustomProperty: (value) => {
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
}
|
|
5638
|
-
return [decl("font-size", `var(${value})`)];
|
|
6029
|
+
const kind = textArbitraryKind(value);
|
|
6030
|
+
return [decl(kind.fontSize ? "font-size" : "color", `var(${kind.value})`)];
|
|
5639
6031
|
},
|
|
5640
6032
|
description: "text color utility (theme, arbitrary, custom property supported)",
|
|
5641
6033
|
category: "typography"
|
|
@@ -5651,7 +6043,7 @@ functionalUtility({
|
|
|
5651
6043
|
if (Array.isArray(themeValue)) {
|
|
5652
6044
|
return [
|
|
5653
6045
|
decl("font-size", themeValue[0]),
|
|
5654
|
-
decl("line-height", themeValue[1])
|
|
6046
|
+
decl("line-height", `var(--baro-leading, ${themeValue[1]})`)
|
|
5655
6047
|
];
|
|
5656
6048
|
} else {
|
|
5657
6049
|
return [decl("font-size", themeValue)];
|
|
@@ -5765,17 +6157,7 @@ functionalUtility({
|
|
|
5765
6157
|
supportsCustomProperty: true,
|
|
5766
6158
|
supportsOpacity: true,
|
|
5767
6159
|
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
|
-
}
|
|
6160
|
+
if (extra?.realThemeValue) return themeColorDecls("text-decoration-color", value, extra);
|
|
5779
6161
|
return [decl("text-decoration-color", value)];
|
|
5780
6162
|
},
|
|
5781
6163
|
handleCustomProperty: (value) => [decl("text-decoration-color", `var(${value})`)],
|
|
@@ -5799,7 +6181,7 @@ functionalUtility({
|
|
|
5799
6181
|
prop: "text-decoration-thickness",
|
|
5800
6182
|
supportsArbitrary: true,
|
|
5801
6183
|
supportsCustomProperty: true,
|
|
5802
|
-
handleBareValue: ({ value }) => `${value}px
|
|
6184
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `${value}px` : null,
|
|
5803
6185
|
description: "text-decoration-thickness utility (arbitrary, custom property supported)",
|
|
5804
6186
|
category: "typography"
|
|
5805
6187
|
});
|
|
@@ -5814,7 +6196,7 @@ functionalUtility({
|
|
|
5814
6196
|
prop: "text-underline-offset",
|
|
5815
6197
|
supportsArbitrary: true,
|
|
5816
6198
|
supportsCustomProperty: true,
|
|
5817
|
-
handleBareValue: ({ value }) => `${value}px
|
|
6199
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `${value}px` : null,
|
|
5818
6200
|
description: "text-underline-offset utility (arbitrary, custom property supported)",
|
|
5819
6201
|
category: "typography"
|
|
5820
6202
|
});
|
|
@@ -5828,8 +6210,8 @@ functionalUtility({
|
|
|
5828
6210
|
supportsNegative: true,
|
|
5829
6211
|
supportsArbitrary: true,
|
|
5830
6212
|
supportsCustomProperty: true,
|
|
5831
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5832
|
-
handleNegativeBareValue: ({ value }) => `calc(var(--spacing) * -${value})
|
|
6213
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
6214
|
+
handleNegativeBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * -${value})` : null,
|
|
5833
6215
|
description: "text-indent utility (spacing, negative, arbitrary, custom property supported)",
|
|
5834
6216
|
category: "typography"
|
|
5835
6217
|
});
|
|
@@ -5852,14 +6234,14 @@ functionalUtility({
|
|
|
5852
6234
|
staticUtility("hyphens-none", [["hyphens", "none"]], { category: "typography" });
|
|
5853
6235
|
staticUtility("hyphens-manual", [["hyphens", "manual"]], { category: "typography" });
|
|
5854
6236
|
staticUtility("hyphens-auto", [["hyphens", "auto"]], { category: "typography" });
|
|
5855
|
-
staticUtility("content-none", [["content", "none"]], { category: "typography" });
|
|
6237
|
+
staticUtility("content-none", [["--baro-content", "none"], ["content", "none"]], { category: "typography" });
|
|
5856
6238
|
functionalUtility({
|
|
5857
6239
|
name: "content",
|
|
5858
6240
|
prop: "content",
|
|
5859
6241
|
supportsArbitrary: true,
|
|
5860
6242
|
supportsCustomProperty: true,
|
|
5861
|
-
handle: (value) => [decl("content", `"${value}"`)],
|
|
5862
|
-
handleCustomProperty: (value) => [decl("content", `var(${value})`)],
|
|
6243
|
+
handle: (value) => [decl("--baro-content", `"${value}"`), decl("content", "var(--baro-content)")],
|
|
6244
|
+
handleCustomProperty: (value) => [decl("--baro-content", `var(${value})`), decl("content", "var(--baro-content)")],
|
|
5863
6245
|
description: "content utility (arbitrary, custom property supported)",
|
|
5864
6246
|
category: "typography"
|
|
5865
6247
|
});
|
|
@@ -5869,7 +6251,8 @@ const gradientStopProperties = () => {
|
|
|
5869
6251
|
property("--baro-gradient-from", "#0000", "<color>"),
|
|
5870
6252
|
property("--baro-gradient-via", "#0000", "<color>"),
|
|
5871
6253
|
property("--baro-gradient-to", "#0000", "<color>"),
|
|
5872
|
-
property("--baro-gradient-stops"
|
|
6254
|
+
property("--baro-gradient-stops"),
|
|
6255
|
+
property("--baro-gradient-via-stops"),
|
|
5873
6256
|
property("--baro-gradient-from-position", "0%", "<length-percentage>"),
|
|
5874
6257
|
property("--baro-gradient-via-position", "50%", "<length-percentage>"),
|
|
5875
6258
|
property("--baro-gradient-to-position", "100%", "<length-percentage>")
|
|
@@ -5926,19 +6309,18 @@ functionalUtility({
|
|
|
5926
6309
|
supportsCustomProperty: true,
|
|
5927
6310
|
description: "background-size utility (arbitrary, custom property supported)",
|
|
5928
6311
|
category: "background"
|
|
5929
|
-
});
|
|
5930
|
-
const positionValue = (position) =>
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
};
|
|
6312
|
+
});
|
|
6313
|
+
const positionValue = (position) => [
|
|
6314
|
+
decl("--baro-gradient-position", position),
|
|
6315
|
+
atRule("supports", "(background-image: linear-gradient(in lab, red, red))", [
|
|
6316
|
+
decl("--baro-gradient-position", `${position} in oklab`)
|
|
6317
|
+
]),
|
|
6318
|
+
decl("background-image", "linear-gradient(var(--baro-gradient-stops))")
|
|
6319
|
+
];
|
|
6320
|
+
const legacyPositionValue = (position) => [
|
|
6321
|
+
decl("--baro-gradient-position", `${position} in oklab`),
|
|
6322
|
+
decl("background-image", "linear-gradient(var(--baro-gradient-stops))")
|
|
6323
|
+
];
|
|
5942
6324
|
[
|
|
5943
6325
|
["bg-linear-to-t", positionValue("to top")],
|
|
5944
6326
|
["bg-linear-to-tr", positionValue("to top right")],
|
|
@@ -5949,14 +6331,14 @@ const positionValue = (position) => {
|
|
|
5949
6331
|
["bg-linear-to-l", positionValue("to left")],
|
|
5950
6332
|
["bg-linear-to-tl", positionValue("to top left")],
|
|
5951
6333
|
// 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",
|
|
6334
|
+
["bg-gradient-to-t", legacyPositionValue("to top")],
|
|
6335
|
+
["bg-gradient-to-tr", legacyPositionValue("to top right")],
|
|
6336
|
+
["bg-gradient-to-r", legacyPositionValue("to right")],
|
|
6337
|
+
["bg-gradient-to-br", legacyPositionValue("to bottom right")],
|
|
6338
|
+
["bg-gradient-to-b", legacyPositionValue("to bottom")],
|
|
6339
|
+
["bg-gradient-to-bl", legacyPositionValue("to bottom left")],
|
|
6340
|
+
["bg-gradient-to-l", legacyPositionValue("to left")],
|
|
6341
|
+
["bg-gradient-to-tl", legacyPositionValue("to top left")]
|
|
5960
6342
|
].forEach(([name, value]) => {
|
|
5961
6343
|
staticUtility(name, value, { category: "background", priority: 1e3 });
|
|
5962
6344
|
});
|
|
@@ -5967,12 +6349,7 @@ functionalUtility({
|
|
|
5967
6349
|
supportsCustomProperty: true,
|
|
5968
6350
|
handle: (value, context, token) => {
|
|
5969
6351
|
if (parseNumber(value)) {
|
|
5970
|
-
return
|
|
5971
|
-
decl(
|
|
5972
|
-
"background-image",
|
|
5973
|
-
`linear-gradient(${value}deg in oklab, var(--baro-gradient-stops))`
|
|
5974
|
-
)
|
|
5975
|
-
];
|
|
6352
|
+
return positionValue(`${value}deg`);
|
|
5976
6353
|
}
|
|
5977
6354
|
if (token.arbitrary) {
|
|
5978
6355
|
return [
|
|
@@ -6001,79 +6378,60 @@ functionalUtility({
|
|
|
6001
6378
|
description: "linear-gradient background-image utility (angle, arbitrary, custom property supported)",
|
|
6002
6379
|
category: "background"
|
|
6003
6380
|
});
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6381
|
+
const gradientImage = (fn, position, fallback) => [
|
|
6382
|
+
decl("--baro-gradient-position", position),
|
|
6383
|
+
decl("background-image", `${fn}(var(--baro-gradient-stops${fallback ? `,${fallback}` : ""}))`)
|
|
6384
|
+
];
|
|
6385
|
+
staticUtility("bg-radial", gradientImage("radial-gradient", "in oklab"), { category: "background" });
|
|
6007
6386
|
functionalUtility({
|
|
6008
6387
|
name: "bg-radial",
|
|
6009
6388
|
prop: "background-image",
|
|
6010
6389
|
supportsArbitrary: true,
|
|
6011
6390
|
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
|
-
}
|
|
6391
|
+
handle: (value, _context, token) => {
|
|
6392
|
+
if (token.arbitrary) return gradientImage("radial-gradient", value, value);
|
|
6393
|
+
if (token.customProperty) return gradientImage("radial-gradient", `var(${value})`, `var(${value})`);
|
|
6029
6394
|
return null;
|
|
6030
6395
|
},
|
|
6031
|
-
handleCustomProperty: (value) =>
|
|
6032
|
-
decl(
|
|
6033
|
-
"background-image",
|
|
6034
|
-
`radial-gradient(var(--baro-gradient-stops, var(${value})))`
|
|
6035
|
-
)
|
|
6036
|
-
],
|
|
6396
|
+
handleCustomProperty: (value) => gradientImage("radial-gradient", `var(${value})`, `var(${value})`),
|
|
6037
6397
|
description: "radial-gradient background-image utility (arbitrary, custom property supported)",
|
|
6038
6398
|
category: "background"
|
|
6039
6399
|
});
|
|
6040
|
-
staticUtility("bg-conic",
|
|
6041
|
-
[
|
|
6042
|
-
"background-image",
|
|
6043
|
-
"conic-gradient(from 0deg in oklab, var(--baro-gradient-stops))"
|
|
6044
|
-
]
|
|
6045
|
-
], { category: "background" });
|
|
6400
|
+
staticUtility("bg-conic", gradientImage("conic-gradient", "in oklab"), { category: "background" });
|
|
6046
6401
|
functionalUtility({
|
|
6047
6402
|
name: "bg-conic",
|
|
6048
6403
|
prop: "background-image",
|
|
6049
6404
|
supportsArbitrary: true,
|
|
6050
6405
|
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
|
-
];
|
|
6406
|
+
handle: (value, _context, token) => {
|
|
6407
|
+
if (!token.arbitrary && !token.customProperty && parseNumber(value)) {
|
|
6408
|
+
return gradientImage("conic-gradient", `from ${value}deg in oklab`);
|
|
6070
6409
|
}
|
|
6410
|
+
if (token.arbitrary) return gradientImage("conic-gradient", value, value);
|
|
6411
|
+
if (token.customProperty) return gradientImage("conic-gradient", `var(${value})`, `var(${value})`);
|
|
6071
6412
|
return null;
|
|
6072
6413
|
},
|
|
6073
|
-
handleCustomProperty: (value) =>
|
|
6414
|
+
handleCustomProperty: (value) => gradientImage("conic-gradient", `var(${value})`, `var(${value})`),
|
|
6074
6415
|
description: "conic-gradient background-image utility (angle, arbitrary, custom property supported)",
|
|
6075
6416
|
category: "background"
|
|
6076
6417
|
});
|
|
6418
|
+
const G = "--baro-gradient";
|
|
6419
|
+
const stopsDecls = (stop, color) => {
|
|
6420
|
+
const colorDecls = typeof color === "string" ? [decl(`${G}-${stop}`, color)] : color;
|
|
6421
|
+
if (stop === "via") {
|
|
6422
|
+
return [
|
|
6423
|
+
gradientStopProperties(),
|
|
6424
|
+
...colorDecls,
|
|
6425
|
+
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)`),
|
|
6426
|
+
decl(`${G}-stops`, `var(${G}-via-stops)`)
|
|
6427
|
+
];
|
|
6428
|
+
}
|
|
6429
|
+
return [
|
|
6430
|
+
gradientStopProperties(),
|
|
6431
|
+
...colorDecls,
|
|
6432
|
+
decl(`${G}-stops`, `var(${G}-via-stops, var(${G}-position), var(${G}-from) var(${G}-from-position), var(${G}-to) var(${G}-to-position))`)
|
|
6433
|
+
];
|
|
6434
|
+
};
|
|
6077
6435
|
["from", "via", "to"].forEach((stop) => {
|
|
6078
6436
|
functionalUtility({
|
|
6079
6437
|
name: stop,
|
|
@@ -6081,72 +6439,18 @@ functionalUtility({
|
|
|
6081
6439
|
supportsArbitrary: true,
|
|
6082
6440
|
supportsCustomProperty: true,
|
|
6083
6441
|
supportsOpacity: true,
|
|
6084
|
-
handle: (value,
|
|
6442
|
+
handle: (value, _context, _token, extra) => {
|
|
6085
6443
|
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
|
-
}
|
|
6444
|
+
return stopsDecls(stop, themeColorDecls(`${G}-${stop}`, value, extra));
|
|
6120
6445
|
}
|
|
6121
6446
|
if (parseLength(value)) {
|
|
6122
|
-
return [decl(
|
|
6447
|
+
return [gradientStopProperties(), decl(`${G}-${stop}-position`, value)];
|
|
6123
6448
|
}
|
|
6124
6449
|
if (parseNumber(value)) {
|
|
6125
|
-
return [decl(
|
|
6450
|
+
return [gradientStopProperties(), decl(`${G}-${stop}-position`, `${value}%`)];
|
|
6126
6451
|
}
|
|
6127
6452
|
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
|
-
}
|
|
6453
|
+
return stopsDecls(stop, value);
|
|
6150
6454
|
}
|
|
6151
6455
|
return null;
|
|
6152
6456
|
},
|
|
@@ -6181,20 +6485,7 @@ functionalUtility({
|
|
|
6181
6485
|
if (value.startsWith("length:")) {
|
|
6182
6486
|
return [decl("background-size", value.replace("length:", ""))];
|
|
6183
6487
|
}
|
|
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
|
-
}
|
|
6488
|
+
if (extra?.realThemeValue) return themeColorDecls("background-color", value, extra);
|
|
6198
6489
|
if (parseColor(value)) {
|
|
6199
6490
|
const parsedColor = parseColor(value);
|
|
6200
6491
|
if (value.startsWith("color:")) {
|
|
@@ -6207,18 +6498,20 @@ functionalUtility({
|
|
|
6207
6498
|
}
|
|
6208
6499
|
return null;
|
|
6209
6500
|
},
|
|
6210
|
-
handleCustomProperty: (value) => [decl("background-size", `var(${value})`)],
|
|
6501
|
+
handleCustomProperty: (value) => value.startsWith("length:") ? [decl("background-size", `var(${value.slice(7)})`)] : [decl("background-color", `var(${value})`)],
|
|
6211
6502
|
description: "background-size utility (arbitrary, custom property supported)",
|
|
6212
6503
|
category: "background"
|
|
6213
6504
|
});
|
|
6214
6505
|
staticUtility("rounded-none", [["border-radius", "0px"]], { category: "borders" });
|
|
6215
6506
|
staticUtility("rounded-sm", [["border-radius", "var(--radius-sm)"]], { category: "borders" });
|
|
6216
|
-
staticUtility("rounded", [["border-radius", "
|
|
6507
|
+
staticUtility("rounded", [["border-radius", "0.25rem"]], { category: "borders" });
|
|
6217
6508
|
staticUtility("rounded-md", [["border-radius", "var(--radius-md)"]], { category: "borders" });
|
|
6218
6509
|
staticUtility("rounded-lg", [["border-radius", "var(--radius-lg)"]], { category: "borders" });
|
|
6219
6510
|
staticUtility("rounded-xl", [["border-radius", "var(--radius-xl)"]], { category: "borders" });
|
|
6220
6511
|
staticUtility("rounded-2xl", [["border-radius", "var(--radius-2xl)"]], { category: "borders" });
|
|
6221
6512
|
staticUtility("rounded-3xl", [["border-radius", "var(--radius-3xl)"]], { category: "borders" });
|
|
6513
|
+
staticUtility("rounded-4xl", [["border-radius", "var(--radius-4xl)"]], { category: "borders" });
|
|
6514
|
+
staticUtility("rounded-xs", [["border-radius", "var(--radius-xs)"]], { category: "borders" });
|
|
6222
6515
|
staticUtility("rounded-full", [["border-radius", "9999px"]], { category: "borders" });
|
|
6223
6516
|
[
|
|
6224
6517
|
["rounded-t", ["border-top-left-radius", "border-top-right-radius"]],
|
|
@@ -6233,12 +6526,14 @@ staticUtility("rounded-full", [["border-radius", "9999px"]], { category: "border
|
|
|
6233
6526
|
const propList = props;
|
|
6234
6527
|
staticUtility(`${name}-none`, propList.map((prop) => [prop, "0px"]), { category: "borders" });
|
|
6235
6528
|
staticUtility(`${name}-sm`, propList.map((prop) => [prop, "var(--radius-sm)"]), { category: "borders" });
|
|
6236
|
-
staticUtility(`${name}`, propList.map((prop) => [prop, "
|
|
6529
|
+
staticUtility(`${name}`, propList.map((prop) => [prop, "0.25rem"]), { category: "borders" });
|
|
6237
6530
|
staticUtility(`${name}-md`, propList.map((prop) => [prop, "var(--radius-md)"]), { category: "borders" });
|
|
6238
6531
|
staticUtility(`${name}-lg`, propList.map((prop) => [prop, "var(--radius-lg)"]), { category: "borders" });
|
|
6239
6532
|
staticUtility(`${name}-xl`, propList.map((prop) => [prop, "var(--radius-xl)"]), { category: "borders" });
|
|
6240
6533
|
staticUtility(`${name}-2xl`, propList.map((prop) => [prop, "var(--radius-2xl)"]), { category: "borders" });
|
|
6241
6534
|
staticUtility(`${name}-3xl`, propList.map((prop) => [prop, "var(--radius-3xl)"]), { category: "borders" });
|
|
6535
|
+
staticUtility(`${name}-4xl`, propList.map((prop) => [prop, "var(--radius-4xl)"]), { category: "borders" });
|
|
6536
|
+
staticUtility(`${name}-xs`, propList.map((prop) => [prop, "var(--radius-xs)"]), { category: "borders" });
|
|
6242
6537
|
staticUtility(`${name}-full`, propList.map((prop) => [prop, "9999px"]), { category: "borders" });
|
|
6243
6538
|
functionalUtility({
|
|
6244
6539
|
name,
|
|
@@ -6269,11 +6564,15 @@ functionalUtility({
|
|
|
6269
6564
|
description: "border-radius utility (spacing, arbitrary, custom property support)",
|
|
6270
6565
|
category: "borders"
|
|
6271
6566
|
});
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6567
|
+
const borderStyleProperty = () => atRoot([property("--baro-border-style", "solid")]);
|
|
6568
|
+
const withBorderStyle = (props, width) => [
|
|
6569
|
+
borderStyleProperty(),
|
|
6570
|
+
...props.map((prop) => decl(prop.replace("width", "style"), "var(--baro-border-style)")),
|
|
6571
|
+
...props.map((prop) => decl(prop, width))
|
|
6572
|
+
];
|
|
6573
|
+
[["border-0", "0px"], ["border-2", "2px"], ["border-4", "4px"], ["border-8", "8px"], ["border", "1px"]].forEach(([name, width]) => {
|
|
6574
|
+
staticUtility(name, [borderStyleProperty, ["border-style", "var(--baro-border-style)"], ["border-width", width]], { category: "borders" });
|
|
6575
|
+
});
|
|
6277
6576
|
[
|
|
6278
6577
|
["border-x", ["border-left-width", "border-right-width"]],
|
|
6279
6578
|
["border-y", ["border-top-width", "border-bottom-width"]],
|
|
@@ -6283,11 +6582,16 @@ staticUtility("border", [["border-width", "1px"]], { category: "borders" });
|
|
|
6283
6582
|
["border-l", ["border-left-width"]]
|
|
6284
6583
|
].forEach(([name, props]) => {
|
|
6285
6584
|
const propList = props;
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6585
|
+
const styled = (width) => [
|
|
6586
|
+
borderStyleProperty,
|
|
6587
|
+
...propList.map((prop) => [prop.replace("width", "style"), "var(--baro-border-style)"]),
|
|
6588
|
+
...propList.map((prop) => [prop, width])
|
|
6589
|
+
];
|
|
6590
|
+
staticUtility(`${name}-0`, styled("0px"));
|
|
6591
|
+
staticUtility(`${name}-2`, styled("2px"));
|
|
6592
|
+
staticUtility(`${name}-4`, styled("4px"));
|
|
6593
|
+
staticUtility(`${name}-8`, styled("8px"));
|
|
6594
|
+
staticUtility(`${name}`, styled("1px"));
|
|
6291
6595
|
functionalUtility({
|
|
6292
6596
|
name,
|
|
6293
6597
|
themeKeys: ["borderWidth", "colors"],
|
|
@@ -6299,18 +6603,19 @@ staticUtility("border", [["border-width", "1px"]], { category: "borders" });
|
|
|
6299
6603
|
}
|
|
6300
6604
|
return null;
|
|
6301
6605
|
},
|
|
6302
|
-
handle: (value, ctx, token) => {
|
|
6606
|
+
handle: (value, ctx, token, extra) => {
|
|
6607
|
+
if (extra?.realThemeValue) return propList.flatMap((prop) => themeColorDecls(prop.replace("width", "color"), value, extra));
|
|
6303
6608
|
if (parseColor(value)) {
|
|
6304
6609
|
return propList.map((prop) => decl(prop.replace("width", "color"), value));
|
|
6305
6610
|
}
|
|
6306
6611
|
if (token.arbitrary) {
|
|
6307
|
-
return propList
|
|
6612
|
+
return withBorderStyle(propList, value);
|
|
6308
6613
|
}
|
|
6309
6614
|
return null;
|
|
6310
6615
|
},
|
|
6311
6616
|
handleCustomProperty: (value) => {
|
|
6312
6617
|
if (value.startsWith("length:")) {
|
|
6313
|
-
return propList
|
|
6618
|
+
return withBorderStyle(propList, `var(${value.replace("length:", "")})`);
|
|
6314
6619
|
}
|
|
6315
6620
|
return propList.map((prop) => decl(prop.replace("width", "color"), `var(${value})`));
|
|
6316
6621
|
},
|
|
@@ -6321,12 +6626,35 @@ staticUtility("border", [["border-width", "1px"]], { category: "borders" });
|
|
|
6321
6626
|
staticUtility("border-inherit", [["border-color", "inherit"]], { category: "borders" });
|
|
6322
6627
|
staticUtility("border-current", [["border-color", "currentColor"]], { category: "borders" });
|
|
6323
6628
|
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" });
|
|
6629
|
+
staticUtility("border-solid", [["--baro-border-style", "solid"], ["border-style", "solid"]], { category: "borders" });
|
|
6630
|
+
staticUtility("border-dashed", [["--baro-border-style", "dashed"], ["border-style", "dashed"]], { category: "borders" });
|
|
6631
|
+
staticUtility("border-dotted", [["--baro-border-style", "dotted"], ["border-style", "dotted"]], { category: "borders" });
|
|
6632
|
+
staticUtility("border-double", [["--baro-border-style", "double"], ["border-style", "double"]], { category: "borders" });
|
|
6633
|
+
staticUtility("border-hidden", [["--baro-border-style", "hidden"], ["border-style", "hidden"]], { category: "borders" });
|
|
6634
|
+
staticUtility("border-none", [["--baro-border-style", "none"], ["border-style", "none"]], { category: "borders" });
|
|
6635
|
+
const divideSides = { x: ["border-inline-start", "border-inline-end", "border-inline-style"], y: ["border-top", "border-bottom", "border-bottom-style", "border-top-style"] };
|
|
6636
|
+
Object.entries(divideSides).forEach(([axis, [start, end, ...styles]]) => {
|
|
6637
|
+
const rev = `--baro-divide-${axis}-reverse`;
|
|
6638
|
+
const divide = (width) => [
|
|
6639
|
+
borderStyleProperty(),
|
|
6640
|
+
rule(":where(& > :not(:last-child))", [
|
|
6641
|
+
decl(rev, "0"),
|
|
6642
|
+
...styles.map((s) => decl(s, "var(--baro-border-style)")),
|
|
6643
|
+
decl(`${start}-width`, `calc(${width} * var(${rev}))`),
|
|
6644
|
+
decl(`${end}-width`, `calc(${width} * calc(1 - var(${rev})))`)
|
|
6645
|
+
])
|
|
6646
|
+
];
|
|
6647
|
+
staticUtility(`divide-${axis}`, divide("1px"), { category: "borders" });
|
|
6648
|
+
staticUtility(`divide-${axis}-reverse`, [rule(":where(& > :not(:last-child))", [decl(rev, "1")])], { category: "borders" });
|
|
6649
|
+
functionalUtility({
|
|
6650
|
+
name: `divide-${axis}`,
|
|
6651
|
+
supportsArbitrary: true,
|
|
6652
|
+
handleBareValue: ({ value }) => /^\d+$/.test(value) ? `${value}px` : null,
|
|
6653
|
+
handle: (value) => divide(value),
|
|
6654
|
+
description: `divide-${axis} width utility`,
|
|
6655
|
+
category: "borders"
|
|
6656
|
+
});
|
|
6657
|
+
});
|
|
6330
6658
|
functionalUtility({
|
|
6331
6659
|
name: "border",
|
|
6332
6660
|
themeKeys: ["colors", "borderWidth"],
|
|
@@ -6334,25 +6662,15 @@ functionalUtility({
|
|
|
6334
6662
|
supportsCustomProperty: true,
|
|
6335
6663
|
supportsOpacity: true,
|
|
6336
6664
|
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
|
-
}
|
|
6665
|
+
if (extra?.realThemeValue) return themeColorDecls("border-color", value, extra);
|
|
6348
6666
|
if (token.arbitrary) {
|
|
6349
6667
|
if (parseLength(value)) {
|
|
6350
|
-
return [
|
|
6668
|
+
return withBorderStyle(["border-width"], value);
|
|
6351
6669
|
}
|
|
6352
6670
|
return [decl("border-color", value)];
|
|
6353
6671
|
}
|
|
6354
6672
|
if (parseNumber(value)) {
|
|
6355
|
-
return [
|
|
6673
|
+
return withBorderStyle(["border-width"], `${value}px`);
|
|
6356
6674
|
}
|
|
6357
6675
|
if (parseColor(value)) {
|
|
6358
6676
|
return [decl("border-color", value)];
|
|
@@ -6361,26 +6679,35 @@ functionalUtility({
|
|
|
6361
6679
|
},
|
|
6362
6680
|
handleCustomProperty: (value) => {
|
|
6363
6681
|
if (value.startsWith("length:")) {
|
|
6364
|
-
return [
|
|
6682
|
+
return withBorderStyle(["border-width"], `var(${value.replace("length:", "")})`);
|
|
6365
6683
|
}
|
|
6366
6684
|
return [decl("border-color", `var(${value})`)];
|
|
6367
6685
|
},
|
|
6368
6686
|
description: "border-width utility (number, arbitrary, custom property support)",
|
|
6369
6687
|
category: "borders"
|
|
6370
6688
|
});
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6689
|
+
const outlineStyleProperty = () => atRoot([property("--baro-outline-style", "solid")]);
|
|
6690
|
+
const withOutlineStyle = (width) => [
|
|
6691
|
+
outlineStyleProperty(),
|
|
6692
|
+
decl("outline-style", "var(--baro-outline-style)"),
|
|
6693
|
+
decl("outline-width", width)
|
|
6694
|
+
];
|
|
6695
|
+
[["outline-0", "0px"], ["outline-1", "1px"], ["outline-2", "2px"], ["outline-4", "4px"], ["outline-8", "8px"]].forEach(([name, width]) => {
|
|
6696
|
+
staticUtility(name, [outlineStyleProperty, ["outline-style", "var(--baro-outline-style)"], ["outline-width", width]], { category: "borders" });
|
|
6697
|
+
});
|
|
6376
6698
|
staticUtility("outline-inherit", [["outline-color", "inherit"]], { category: "borders" });
|
|
6377
6699
|
staticUtility("outline-current", [["outline-color", "currentColor"]], { category: "borders" });
|
|
6378
6700
|
staticUtility("outline-transparent", [["outline-color", "transparent"]], { category: "borders" });
|
|
6379
|
-
staticUtility("outline-none", [["outline", "
|
|
6380
|
-
staticUtility("outline", [
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6701
|
+
staticUtility("outline-none", [["--baro-outline-style", "none"], ["outline-style", "none"]], { category: "borders" });
|
|
6702
|
+
staticUtility("outline-hidden", [
|
|
6703
|
+
["--baro-outline-style", "none"],
|
|
6704
|
+
["outline-style", "none"],
|
|
6705
|
+
atRule("media", "(forced-colors: active)", [decl("outline", "2px solid transparent"), decl("outline-offset", "2px")])
|
|
6706
|
+
], { category: "borders" });
|
|
6707
|
+
staticUtility("outline", [outlineStyleProperty, ["outline-style", "var(--baro-outline-style)"], ["outline-width", "1px"]], { category: "borders" });
|
|
6708
|
+
["solid", "dashed", "dotted", "double"].forEach((style) => {
|
|
6709
|
+
staticUtility(`outline-${style}`, [["--baro-outline-style", style], ["outline-style", style]], { category: "borders" });
|
|
6710
|
+
});
|
|
6384
6711
|
staticUtility("outline-offset-0", [["outline-offset", "0px"]], { category: "borders" });
|
|
6385
6712
|
staticUtility("outline-offset-1", [["outline-offset", "1px"]], { category: "borders" });
|
|
6386
6713
|
staticUtility("outline-offset-2", [["outline-offset", "2px"]], { category: "borders" });
|
|
@@ -6405,16 +6732,18 @@ functionalUtility({
|
|
|
6405
6732
|
themeKeys: ["colors", "borderWidth"],
|
|
6406
6733
|
supportsArbitrary: true,
|
|
6407
6734
|
supportsCustomProperty: true,
|
|
6408
|
-
|
|
6735
|
+
supportsOpacity: true,
|
|
6736
|
+
handle: (value, ctx, token, extra) => {
|
|
6737
|
+
if (extra?.realThemeValue) return themeColorDecls("outline-color", value, extra);
|
|
6409
6738
|
if (parseColor(value)) {
|
|
6410
6739
|
return [decl("outline-color", value)];
|
|
6411
6740
|
}
|
|
6412
6741
|
if (parseNumber(value)) {
|
|
6413
|
-
return
|
|
6742
|
+
return withOutlineStyle(`${value}px`);
|
|
6414
6743
|
}
|
|
6415
6744
|
if (token.arbitrary) {
|
|
6416
6745
|
if (parseLength(value)) {
|
|
6417
|
-
return
|
|
6746
|
+
return withOutlineStyle(value);
|
|
6418
6747
|
}
|
|
6419
6748
|
return [decl("outline-color", value)];
|
|
6420
6749
|
}
|
|
@@ -6425,7 +6754,7 @@ functionalUtility({
|
|
|
6425
6754
|
return [decl("outline-color", value.replace("color:", ""))];
|
|
6426
6755
|
}
|
|
6427
6756
|
if (value.startsWith("length:")) {
|
|
6428
|
-
return
|
|
6757
|
+
return withOutlineStyle(`var(${value.replace("length:", "")})`);
|
|
6429
6758
|
}
|
|
6430
6759
|
return [decl("outline-color", `var(${value})`)];
|
|
6431
6760
|
},
|
|
@@ -6446,6 +6775,40 @@ functionalUtility({
|
|
|
6446
6775
|
description: "outline-width utility (number, arbitrary, custom property support)",
|
|
6447
6776
|
category: "borders"
|
|
6448
6777
|
});
|
|
6778
|
+
const divideColor = (value) => [rule(":where(& > :not(:last-child))", [decl("border-color", value)])];
|
|
6779
|
+
staticUtility("divide-inherit", divideColor("inherit"), { category: "borders" });
|
|
6780
|
+
staticUtility("divide-current", divideColor("currentColor"), { category: "borders" });
|
|
6781
|
+
staticUtility("divide-transparent", divideColor("transparent"), { category: "borders" });
|
|
6782
|
+
functionalUtility({
|
|
6783
|
+
name: "divide",
|
|
6784
|
+
themeKeys: ["colors"],
|
|
6785
|
+
supportsArbitrary: true,
|
|
6786
|
+
supportsCustomProperty: true,
|
|
6787
|
+
supportsOpacity: true,
|
|
6788
|
+
handle: (value, _ctx, _token, extra) => {
|
|
6789
|
+
if (extra?.realThemeValue) {
|
|
6790
|
+
return [rule(":where(& > :not(:last-child))", themeColorDecls("border-color", value, extra))];
|
|
6791
|
+
}
|
|
6792
|
+
if (parseColor(value)) return divideColor(value);
|
|
6793
|
+
return null;
|
|
6794
|
+
},
|
|
6795
|
+
handleCustomProperty: (value) => divideColor(`var(${value})`),
|
|
6796
|
+
description: "divide-color utility (theme, alpha, arbitrary, custom property)",
|
|
6797
|
+
category: "borders"
|
|
6798
|
+
});
|
|
6799
|
+
const ROTATE_SKEW = "var(--baro-rotate-x,) var(--baro-rotate-y,) var(--baro-rotate-z,) var(--baro-skew-x,) var(--baro-skew-y,)";
|
|
6800
|
+
const rotateAxis = (axis, fn) => [decl(`--baro-rotate-${axis}`, fn), decl("transform", ROTATE_SKEW)];
|
|
6801
|
+
const skewAxis = (axis, fn) => [decl(`--baro-skew-${axis}`, fn), decl("transform", ROTATE_SKEW)];
|
|
6802
|
+
const scaleProperties = () => atRoot([
|
|
6803
|
+
property("--baro-scale-x", "1"),
|
|
6804
|
+
property("--baro-scale-y", "1"),
|
|
6805
|
+
property("--baro-scale-z", "1")
|
|
6806
|
+
]);
|
|
6807
|
+
const scaleAxis = (axis, v) => [
|
|
6808
|
+
scaleProperties(),
|
|
6809
|
+
decl(`--baro-scale-${axis}`, v),
|
|
6810
|
+
decl("scale", axis === "z" ? "var(--baro-scale-x) var(--baro-scale-y) var(--baro-scale-z)" : "var(--baro-scale-x) var(--baro-scale-y)")
|
|
6811
|
+
];
|
|
6449
6812
|
staticUtility("transform-none", [["transform", "none"]], {
|
|
6450
6813
|
category: "transform"
|
|
6451
6814
|
});
|
|
@@ -6454,7 +6817,7 @@ staticUtility(
|
|
|
6454
6817
|
[
|
|
6455
6818
|
[
|
|
6456
6819
|
"transform",
|
|
6457
|
-
|
|
6820
|
+
`translateZ(0) ${ROTATE_SKEW}`
|
|
6458
6821
|
]
|
|
6459
6822
|
],
|
|
6460
6823
|
{ category: "transform" }
|
|
@@ -6462,7 +6825,7 @@ staticUtility(
|
|
|
6462
6825
|
staticUtility("transform-cpu", [
|
|
6463
6826
|
[
|
|
6464
6827
|
"transform",
|
|
6465
|
-
|
|
6828
|
+
ROTATE_SKEW
|
|
6466
6829
|
]
|
|
6467
6830
|
]);
|
|
6468
6831
|
staticUtility("transform-3d", [["transform-style", "preserve-3d"]], {
|
|
@@ -6591,13 +6954,11 @@ functionalUtility({
|
|
|
6591
6954
|
if (parseNumber(value) || negative) {
|
|
6592
6955
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6593
6956
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6594
|
-
return
|
|
6957
|
+
return rotateAxis("x", `rotateX(${sign}${deg})`);
|
|
6595
6958
|
}
|
|
6596
|
-
return
|
|
6959
|
+
return rotateAxis("x", `rotateX(${value})`);
|
|
6597
6960
|
},
|
|
6598
|
-
handleCustomProperty: (value) =>
|
|
6599
|
-
decl("transform", `rotateX(var(${value})) var(--baro-rotate-y)`)
|
|
6600
|
-
],
|
|
6961
|
+
handleCustomProperty: (value) => rotateAxis("x", `rotateX(var(${value}))`),
|
|
6601
6962
|
description: "rotate-x utility (named, arbitrary, custom property supported)",
|
|
6602
6963
|
category: "transform"
|
|
6603
6964
|
});
|
|
@@ -6611,13 +6972,11 @@ functionalUtility({
|
|
|
6611
6972
|
if (parseNumber(value) || negative) {
|
|
6612
6973
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6613
6974
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6614
|
-
return
|
|
6975
|
+
return rotateAxis("y", `rotateY(${sign}${deg})`);
|
|
6615
6976
|
}
|
|
6616
|
-
return
|
|
6977
|
+
return rotateAxis("y", `rotateY(${value})`);
|
|
6617
6978
|
},
|
|
6618
|
-
handleCustomProperty: (value) =>
|
|
6619
|
-
decl("transform", `var(--baro-rotate-x) rotateY(var(${value}))`)
|
|
6620
|
-
],
|
|
6979
|
+
handleCustomProperty: (value) => rotateAxis("y", `rotateY(var(${value}))`),
|
|
6621
6980
|
description: "rotate-y utility (named, arbitrary, custom property supported)",
|
|
6622
6981
|
category: "transform"
|
|
6623
6982
|
});
|
|
@@ -6631,26 +6990,11 @@ functionalUtility({
|
|
|
6631
6990
|
if (parseNumber(value) || negative) {
|
|
6632
6991
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6633
6992
|
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
|
-
];
|
|
6993
|
+
return rotateAxis("z", `rotateZ(${sign}${deg})`);
|
|
6640
6994
|
}
|
|
6641
|
-
return
|
|
6642
|
-
decl(
|
|
6643
|
-
"transform",
|
|
6644
|
-
`var(--baro-rotate-x) var(--baro-rotate-y) rotateZ(${value})`
|
|
6645
|
-
)
|
|
6646
|
-
];
|
|
6995
|
+
return rotateAxis("z", `rotateZ(${value})`);
|
|
6647
6996
|
},
|
|
6648
|
-
handleCustomProperty: (value) =>
|
|
6649
|
-
decl(
|
|
6650
|
-
"transform",
|
|
6651
|
-
`var(--baro-rotate-x) var(--baro-rotate-y) rotateZ(var(${value}))`
|
|
6652
|
-
)
|
|
6653
|
-
],
|
|
6997
|
+
handleCustomProperty: (value) => rotateAxis("z", `rotateZ(var(${value}))`),
|
|
6654
6998
|
description: "rotate-z utility (named, arbitrary, custom property supported)",
|
|
6655
6999
|
category: "transform"
|
|
6656
7000
|
});
|
|
@@ -6677,7 +7021,7 @@ functionalUtility({
|
|
|
6677
7021
|
staticUtility("scale-none", [["scale", "none"]], { category: "transform" });
|
|
6678
7022
|
staticUtility(
|
|
6679
7023
|
"scale-3d",
|
|
6680
|
-
[["scale", "var(--baro-scale-x) var(--baro-scale-y) var(--baro-scale-z)"]],
|
|
7024
|
+
[scaleProperties, ["scale", "var(--baro-scale-x) var(--baro-scale-y) var(--baro-scale-z)"]],
|
|
6681
7025
|
{ category: "transform" }
|
|
6682
7026
|
);
|
|
6683
7027
|
functionalUtility({
|
|
@@ -6688,18 +7032,16 @@ functionalUtility({
|
|
|
6688
7032
|
supportsNegative: true,
|
|
6689
7033
|
handle: (value, ctx, { negative, arbitrary }) => {
|
|
6690
7034
|
if (arbitrary) {
|
|
6691
|
-
return
|
|
7035
|
+
return scaleAxis("x", value);
|
|
6692
7036
|
}
|
|
6693
7037
|
if (parseNumber(value) || negative) {
|
|
6694
7038
|
const pct = `${Math.abs(Number(value))}%`;
|
|
6695
7039
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6696
|
-
return
|
|
7040
|
+
return scaleAxis("x", `calc(${pct} * ${sign}1)`);
|
|
6697
7041
|
}
|
|
6698
|
-
return
|
|
7042
|
+
return scaleAxis("x", value);
|
|
6699
7043
|
},
|
|
6700
|
-
handleCustomProperty: (value) =>
|
|
6701
|
-
decl("scale", `var(${value}) var(--baro-scale-y)`)
|
|
6702
|
-
],
|
|
7044
|
+
handleCustomProperty: (value) => scaleAxis("x", `var(${value})`),
|
|
6703
7045
|
description: "scale-x utility (named, arbitrary, custom property supported)",
|
|
6704
7046
|
category: "transform"
|
|
6705
7047
|
});
|
|
@@ -6711,18 +7053,16 @@ functionalUtility({
|
|
|
6711
7053
|
supportsNegative: true,
|
|
6712
7054
|
handle: (value, ctx, { negative, arbitrary }) => {
|
|
6713
7055
|
if (arbitrary) {
|
|
6714
|
-
return
|
|
7056
|
+
return scaleAxis("y", value);
|
|
6715
7057
|
}
|
|
6716
7058
|
if (parseNumber(value) || negative) {
|
|
6717
7059
|
const pct = `${Math.abs(Number(value))}%`;
|
|
6718
7060
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6719
|
-
return
|
|
7061
|
+
return scaleAxis("y", `calc(${pct} * ${sign}1)`);
|
|
6720
7062
|
}
|
|
6721
|
-
return
|
|
7063
|
+
return scaleAxis("y", value);
|
|
6722
7064
|
},
|
|
6723
|
-
handleCustomProperty: (value) =>
|
|
6724
|
-
decl("scale", `var(--baro-scale-x) var(${value})`)
|
|
6725
|
-
],
|
|
7065
|
+
handleCustomProperty: (value) => scaleAxis("y", `var(${value})`),
|
|
6726
7066
|
description: "scale-y utility (named, arbitrary, custom property supported)",
|
|
6727
7067
|
category: "transform"
|
|
6728
7068
|
});
|
|
@@ -6734,25 +7074,16 @@ functionalUtility({
|
|
|
6734
7074
|
supportsNegative: true,
|
|
6735
7075
|
handle: (value, ctx, { negative, arbitrary }) => {
|
|
6736
7076
|
if (arbitrary) {
|
|
6737
|
-
return
|
|
6738
|
-
decl("scale", `var(--baro-scale-x) var(--baro-scale-y) ${value}`)
|
|
6739
|
-
];
|
|
7077
|
+
return scaleAxis("z", value);
|
|
6740
7078
|
}
|
|
6741
7079
|
if (parseNumber(value) || negative) {
|
|
6742
7080
|
const pct = `${Math.abs(Number(value))}%`;
|
|
6743
7081
|
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
|
-
];
|
|
7082
|
+
return scaleAxis("z", `calc(${pct} * ${sign}1)`);
|
|
6750
7083
|
}
|
|
6751
|
-
return
|
|
7084
|
+
return scaleAxis("z", value);
|
|
6752
7085
|
},
|
|
6753
|
-
handleCustomProperty: (value) =>
|
|
6754
|
-
decl("scale", `var(--baro-scale-x) var(--baro-scale-y) var(${value})`)
|
|
6755
|
-
],
|
|
7086
|
+
handleCustomProperty: (value) => scaleAxis("z", `var(${value})`),
|
|
6756
7087
|
description: "scale-z utility (named, arbitrary, custom property supported)",
|
|
6757
7088
|
category: "transform"
|
|
6758
7089
|
});
|
|
@@ -6791,11 +7122,11 @@ functionalUtility({
|
|
|
6791
7122
|
if (parseNumber(value) || negative) {
|
|
6792
7123
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6793
7124
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6794
|
-
return
|
|
7125
|
+
return skewAxis("x", `skewX(${sign}${deg})`);
|
|
6795
7126
|
}
|
|
6796
|
-
return
|
|
7127
|
+
return skewAxis("x", `skewX(${value})`);
|
|
6797
7128
|
},
|
|
6798
|
-
handleCustomProperty: (value) =>
|
|
7129
|
+
handleCustomProperty: (value) => skewAxis("x", `skewX(var(${value}))`),
|
|
6799
7130
|
description: "skew-x utility (named, arbitrary, custom property supported)",
|
|
6800
7131
|
category: "transform"
|
|
6801
7132
|
});
|
|
@@ -6809,11 +7140,11 @@ functionalUtility({
|
|
|
6809
7140
|
if (parseNumber(value) || negative) {
|
|
6810
7141
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6811
7142
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6812
|
-
return
|
|
7143
|
+
return skewAxis("y", `skewY(${sign}${deg})`);
|
|
6813
7144
|
}
|
|
6814
|
-
return
|
|
7145
|
+
return skewAxis("y", `skewY(${value})`);
|
|
6815
7146
|
},
|
|
6816
|
-
handleCustomProperty: (value) =>
|
|
7147
|
+
handleCustomProperty: (value) => skewAxis("y", `skewY(var(${value}))`),
|
|
6817
7148
|
description: "skew-y utility (named, arbitrary, custom property supported)",
|
|
6818
7149
|
category: "transform"
|
|
6819
7150
|
});
|
|
@@ -6827,12 +7158,14 @@ functionalUtility({
|
|
|
6827
7158
|
if (parseNumber(value) || negative) {
|
|
6828
7159
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6829
7160
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6830
|
-
return [decl("
|
|
7161
|
+
return [decl("--baro-skew-x", `skewX(${sign}${deg})`), decl("--baro-skew-y", `skewY(${sign}${deg})`), decl("transform", ROTATE_SKEW)];
|
|
6831
7162
|
}
|
|
6832
|
-
return [decl("
|
|
7163
|
+
return [decl("--baro-skew-x", `skewX(${value})`), decl("--baro-skew-y", `skewY(${value})`), decl("transform", ROTATE_SKEW)];
|
|
6833
7164
|
},
|
|
6834
7165
|
handleCustomProperty: (value) => [
|
|
6835
|
-
decl("
|
|
7166
|
+
decl("--baro-skew-x", `skewX(var(${value}))`),
|
|
7167
|
+
decl("--baro-skew-y", `skewY(var(${value}))`),
|
|
7168
|
+
decl("transform", ROTATE_SKEW)
|
|
6836
7169
|
],
|
|
6837
7170
|
description: "skew utility (named, arbitrary, custom property supported)",
|
|
6838
7171
|
category: "transform"
|
|
@@ -6877,6 +7210,22 @@ const translateProperties = () => atRoot([
|
|
|
6877
7210
|
property("--baro-translate-y", "0"),
|
|
6878
7211
|
property("--baro-translate-z", "0")
|
|
6879
7212
|
]);
|
|
7213
|
+
const translateAxis = (axis, v) => [
|
|
7214
|
+
translateProperties(),
|
|
7215
|
+
decl(`--baro-translate-${axis}`, v),
|
|
7216
|
+
decl(
|
|
7217
|
+
"translate",
|
|
7218
|
+
axis === "z" ? "var(--baro-translate-x) var(--baro-translate-y) var(--baro-translate-z)" : "var(--baro-translate-x) var(--baro-translate-y)"
|
|
7219
|
+
)
|
|
7220
|
+
];
|
|
7221
|
+
const staticTranslateAxis = (axis, v) => [
|
|
7222
|
+
translateProperties,
|
|
7223
|
+
[`--baro-translate-${axis}`, v],
|
|
7224
|
+
[
|
|
7225
|
+
"translate",
|
|
7226
|
+
axis === "z" ? "var(--baro-translate-x) var(--baro-translate-y) var(--baro-translate-z)" : "var(--baro-translate-x) var(--baro-translate-y)"
|
|
7227
|
+
]
|
|
7228
|
+
];
|
|
6880
7229
|
staticUtility("translate-none", [["translate", "none"]], {
|
|
6881
7230
|
category: "transform"
|
|
6882
7231
|
});
|
|
@@ -6908,52 +7257,52 @@ staticUtility(
|
|
|
6908
7257
|
);
|
|
6909
7258
|
staticUtility(
|
|
6910
7259
|
"translate-x-px",
|
|
6911
|
-
|
|
7260
|
+
staticTranslateAxis("x", "1px"),
|
|
6912
7261
|
{ category: "transform" }
|
|
6913
7262
|
);
|
|
6914
7263
|
staticUtility(
|
|
6915
7264
|
"-translate-x-px",
|
|
6916
|
-
|
|
7265
|
+
staticTranslateAxis("x", "-1px"),
|
|
6917
7266
|
{ category: "transform" }
|
|
6918
7267
|
);
|
|
6919
7268
|
staticUtility(
|
|
6920
7269
|
"translate-x-full",
|
|
6921
|
-
|
|
7270
|
+
staticTranslateAxis("x", "100%"),
|
|
6922
7271
|
{ category: "transform" }
|
|
6923
7272
|
);
|
|
6924
7273
|
staticUtility(
|
|
6925
7274
|
"-translate-x-full",
|
|
6926
|
-
|
|
7275
|
+
staticTranslateAxis("x", "-100%"),
|
|
6927
7276
|
{ category: "transform" }
|
|
6928
7277
|
);
|
|
6929
7278
|
staticUtility(
|
|
6930
7279
|
"translate-y-px",
|
|
6931
|
-
|
|
7280
|
+
staticTranslateAxis("y", "1px"),
|
|
6932
7281
|
{ category: "transform" }
|
|
6933
7282
|
);
|
|
6934
7283
|
staticUtility(
|
|
6935
7284
|
"-translate-y-px",
|
|
6936
|
-
|
|
7285
|
+
staticTranslateAxis("y", "-1px"),
|
|
6937
7286
|
{ category: "transform" }
|
|
6938
7287
|
);
|
|
6939
7288
|
staticUtility(
|
|
6940
7289
|
"translate-y-full",
|
|
6941
|
-
|
|
7290
|
+
staticTranslateAxis("y", "100%"),
|
|
6942
7291
|
{ category: "transform" }
|
|
6943
7292
|
);
|
|
6944
7293
|
staticUtility(
|
|
6945
7294
|
"-translate-y-full",
|
|
6946
|
-
|
|
7295
|
+
staticTranslateAxis("y", "-100%"),
|
|
6947
7296
|
{ category: "transform" }
|
|
6948
7297
|
);
|
|
6949
7298
|
staticUtility(
|
|
6950
7299
|
"translate-z-px",
|
|
6951
|
-
|
|
7300
|
+
staticTranslateAxis("z", "1px"),
|
|
6952
7301
|
{ category: "transform" }
|
|
6953
7302
|
);
|
|
6954
7303
|
staticUtility(
|
|
6955
7304
|
"-translate-z-px",
|
|
6956
|
-
|
|
7305
|
+
staticTranslateAxis("z", "-1px"),
|
|
6957
7306
|
{ category: "transform" }
|
|
6958
7307
|
);
|
|
6959
7308
|
functionalUtility({
|
|
@@ -6963,19 +7312,17 @@ functionalUtility({
|
|
|
6963
7312
|
supportsArbitrary: true,
|
|
6964
7313
|
supportsCustomProperty: true,
|
|
6965
7314
|
handle: (value, ctx, { negative }) => {
|
|
6966
|
-
if (parseFractionOrNumber(value)) {
|
|
7315
|
+
if (value.includes("/") && parseFractionOrNumber(value)) {
|
|
6967
7316
|
const v = `calc(${value} * 100%)`;
|
|
6968
|
-
return
|
|
7317
|
+
return translateAxis("x", v);
|
|
6969
7318
|
}
|
|
6970
7319
|
if (parseNumber(value) || negative) {
|
|
6971
7320
|
const v = `calc(var(--spacing) * ${value})`;
|
|
6972
|
-
return
|
|
7321
|
+
return translateAxis("x", v);
|
|
6973
7322
|
}
|
|
6974
|
-
return
|
|
7323
|
+
return translateAxis("x", value);
|
|
6975
7324
|
},
|
|
6976
|
-
handleCustomProperty: (value) =>
|
|
6977
|
-
decl("translate", `var(${value}) var(--baro-translate-y)`)
|
|
6978
|
-
],
|
|
7325
|
+
handleCustomProperty: (value) => translateAxis("x", `var(${value})`),
|
|
6979
7326
|
description: "translate-x utility (spacing, fraction, arbitrary, custom property, negative)",
|
|
6980
7327
|
category: "transform"
|
|
6981
7328
|
});
|
|
@@ -6986,19 +7333,17 @@ functionalUtility({
|
|
|
6986
7333
|
supportsArbitrary: true,
|
|
6987
7334
|
supportsCustomProperty: true,
|
|
6988
7335
|
handle: (value, ctx, { negative }) => {
|
|
6989
|
-
if (parseFractionOrNumber(value)) {
|
|
7336
|
+
if (value.includes("/") && parseFractionOrNumber(value)) {
|
|
6990
7337
|
const v = `calc(${value} * 100%)`;
|
|
6991
|
-
return
|
|
7338
|
+
return translateAxis("y", v);
|
|
6992
7339
|
}
|
|
6993
7340
|
if (parseNumber(value) || negative) {
|
|
6994
7341
|
const v = `calc(var(--spacing) * ${value})`;
|
|
6995
|
-
return
|
|
7342
|
+
return translateAxis("y", v);
|
|
6996
7343
|
}
|
|
6997
|
-
return
|
|
7344
|
+
return translateAxis("y", value);
|
|
6998
7345
|
},
|
|
6999
|
-
handleCustomProperty: (value) =>
|
|
7000
|
-
decl("translate", `var(--baro-translate-x) var(${value})`)
|
|
7001
|
-
],
|
|
7346
|
+
handleCustomProperty: (value) => translateAxis("y", `var(${value})`),
|
|
7002
7347
|
description: "translate-y utility (spacing, fraction, arbitrary, custom property, negative)",
|
|
7003
7348
|
category: "transform"
|
|
7004
7349
|
});
|
|
@@ -7009,37 +7354,17 @@ functionalUtility({
|
|
|
7009
7354
|
supportsArbitrary: true,
|
|
7010
7355
|
supportsCustomProperty: true,
|
|
7011
7356
|
handle: (value, ctx, { negative }) => {
|
|
7012
|
-
if (parseFractionOrNumber(value)) {
|
|
7357
|
+
if (value.includes("/") && parseFractionOrNumber(value)) {
|
|
7013
7358
|
const v = `calc(${value} * 100%)`;
|
|
7014
|
-
return
|
|
7015
|
-
decl(
|
|
7016
|
-
"translate",
|
|
7017
|
-
`var(--baro-translate-x) var(--baro-translate-y) ${v}`
|
|
7018
|
-
)
|
|
7019
|
-
];
|
|
7359
|
+
return translateAxis("z", v);
|
|
7020
7360
|
}
|
|
7021
7361
|
if (parseNumber(value) || negative) {
|
|
7022
7362
|
const v = `calc(var(--spacing) * ${value})`;
|
|
7023
|
-
return
|
|
7024
|
-
decl(
|
|
7025
|
-
"translate",
|
|
7026
|
-
`var(--baro-translate-x) var(--baro-translate-y) ${v}`
|
|
7027
|
-
)
|
|
7028
|
-
];
|
|
7363
|
+
return translateAxis("z", v);
|
|
7029
7364
|
}
|
|
7030
|
-
return
|
|
7031
|
-
decl(
|
|
7032
|
-
"translate",
|
|
7033
|
-
`var(--baro-translate-x) var(--baro-translate-y) ${value}`
|
|
7034
|
-
)
|
|
7035
|
-
];
|
|
7365
|
+
return translateAxis("z", value);
|
|
7036
7366
|
},
|
|
7037
|
-
handleCustomProperty: (value) =>
|
|
7038
|
-
decl(
|
|
7039
|
-
"translate",
|
|
7040
|
-
`var(--baro-translate-x) var(--baro-translate-y) var(${value})`
|
|
7041
|
-
)
|
|
7042
|
-
],
|
|
7367
|
+
handleCustomProperty: (value) => translateAxis("z", `var(${value})`),
|
|
7043
7368
|
description: "translate-z utility (spacing, fraction, arbitrary, custom property, negative)",
|
|
7044
7369
|
category: "transform"
|
|
7045
7370
|
});
|
|
@@ -7050,7 +7375,7 @@ functionalUtility({
|
|
|
7050
7375
|
supportsArbitrary: true,
|
|
7051
7376
|
supportsCustomProperty: true,
|
|
7052
7377
|
handle: (value, ctx, { negative }) => {
|
|
7053
|
-
if (parseFractionOrNumber(value)) {
|
|
7378
|
+
if (value.includes("/") && parseFractionOrNumber(value)) {
|
|
7054
7379
|
const v = `calc(${value} * 100%)`;
|
|
7055
7380
|
return [decl("translate", `${v} ${v}`)];
|
|
7056
7381
|
}
|
|
@@ -7215,8 +7540,13 @@ staticModifier("rtl", ["&[dir=rtl]"], { order: 20, source: "attribute" });
|
|
|
7215
7540
|
staticModifier("ltr", ["&[dir=ltr]"], { order: 20, source: "attribute" });
|
|
7216
7541
|
staticModifier("inert", ["&[inert]"], { order: 40, source: "attribute" });
|
|
7217
7542
|
staticModifier("open", ["&:is([open], :popover-open, :open)"], { order: 40, source: "attribute" });
|
|
7218
|
-
|
|
7219
|
-
|
|
7543
|
+
const withPseudoContent = (ast) => [
|
|
7544
|
+
atRoot([property("--baro-content", '""')]),
|
|
7545
|
+
...ast,
|
|
7546
|
+
decl("content", "var(--baro-content)")
|
|
7547
|
+
];
|
|
7548
|
+
staticModifier("before", ["&::before"], { source: "pseudo", astHandler: withPseudoContent });
|
|
7549
|
+
staticModifier("after", ["&::after"], { source: "pseudo", astHandler: withPseudoContent });
|
|
7220
7550
|
staticModifier("placeholder", [
|
|
7221
7551
|
"&::placeholder",
|
|
7222
7552
|
"&::-webkit-input-placeholder",
|
|
@@ -7249,9 +7579,6 @@ function createContainerParams(type, value, name) {
|
|
|
7249
7579
|
const condition = type === "min" ? "width >=" : "width <";
|
|
7250
7580
|
return name ? `${name} (${condition} ${value})` : `(${condition} ${value})`;
|
|
7251
7581
|
}
|
|
7252
|
-
function getThemeSize(ctx, key) {
|
|
7253
|
-
return ctx.theme("container." + key) || ctx.theme("breakpoint." + key);
|
|
7254
|
-
}
|
|
7255
7582
|
function createContainerRule(params, ast) {
|
|
7256
7583
|
return {
|
|
7257
7584
|
type: "at-rule",
|
|
@@ -7271,6 +7598,35 @@ function getDefaultBreakpoint(breakpoint) {
|
|
|
7271
7598
|
};
|
|
7272
7599
|
return defaults[breakpoint] || `(min-width: ${breakpoint})`;
|
|
7273
7600
|
}
|
|
7601
|
+
function decodeArbitrarySelector(value) {
|
|
7602
|
+
return value.replace(/\\_|_/g, (m) => m === "_" ? " " : "_");
|
|
7603
|
+
}
|
|
7604
|
+
function attributeVariantSelector(variant) {
|
|
7605
|
+
const bracket = /^(data|aria)-\[([a-zA-Z0-9_-]+)(?:=([^\]]+))?\]$/.exec(variant);
|
|
7606
|
+
if (bracket) {
|
|
7607
|
+
const [, kind, key, raw2] = bracket;
|
|
7608
|
+
if (raw2 === void 0) return `[${kind}-${key}]`;
|
|
7609
|
+
const value = /^(["']).*\1$/.test(raw2) ? raw2 : `"${decodeArbitrarySelector(raw2)}"`;
|
|
7610
|
+
return `[${kind}-${key}=${value}]`;
|
|
7611
|
+
}
|
|
7612
|
+
const bare = /^data-([a-zA-Z0-9_-]+)$/.exec(variant);
|
|
7613
|
+
return bare ? `[data-${bare[1]}]` : void 0;
|
|
7614
|
+
}
|
|
7615
|
+
function functionalArgument(value) {
|
|
7616
|
+
const v = decodeArbitrarySelector(value);
|
|
7617
|
+
return /^[>+~]/.test(v.trim()) || !hasTopLevelComma(v) ? v : `*:is(${v})`;
|
|
7618
|
+
}
|
|
7619
|
+
function hasTopLevelComma(value) {
|
|
7620
|
+
let depth = 0;
|
|
7621
|
+
for (let i = 0; i < value.length; i++) {
|
|
7622
|
+
const c = value[i];
|
|
7623
|
+
if (c === "\\") i++;
|
|
7624
|
+
else if (c === "(" || c === "[") depth++;
|
|
7625
|
+
else if (c === ")" || c === "]") depth--;
|
|
7626
|
+
else if (c === "," && depth === 0) return true;
|
|
7627
|
+
}
|
|
7628
|
+
return false;
|
|
7629
|
+
}
|
|
7274
7630
|
functionalModifier(
|
|
7275
7631
|
(mod, context) => {
|
|
7276
7632
|
const breakpoints = context.theme("breakpoints") || context.config("theme.breakpoints") || {};
|
|
@@ -7301,7 +7657,7 @@ functionalModifier(
|
|
|
7301
7657
|
const breakpoints = context.theme("breakpoints") || context.config("theme.breakpoints") || {};
|
|
7302
7658
|
if (Object.keys(breakpoints).includes(breakpoint)) {
|
|
7303
7659
|
let mediaQuery = context.theme(`breakpoints.${breakpoint}`) || getDefaultBreakpoint(breakpoint);
|
|
7304
|
-
if (/^\d+(px|em|rem)?$/.test(mediaQuery)) {
|
|
7660
|
+
if (/^\d*\.?\d+(px|em|rem)?$/.test(mediaQuery)) {
|
|
7305
7661
|
mediaQuery = `(min-width: ${mediaQuery})`;
|
|
7306
7662
|
}
|
|
7307
7663
|
return [atRule("media", mediaQuery, [], "responsive")];
|
|
@@ -7320,6 +7676,8 @@ functionalModifier(
|
|
|
7320
7676
|
if (value) {
|
|
7321
7677
|
mediaQuery = `(width < ${value})`;
|
|
7322
7678
|
}
|
|
7679
|
+
} else if (/^\d*\.?\d+(px|em|rem)?$/.test(mediaQuery)) {
|
|
7680
|
+
mediaQuery = `(width < ${mediaQuery})`;
|
|
7323
7681
|
}
|
|
7324
7682
|
return [atRule("media", mediaQuery, [], "responsive")];
|
|
7325
7683
|
}
|
|
@@ -7388,132 +7746,137 @@ functionalModifier(
|
|
|
7388
7746
|
return result;
|
|
7389
7747
|
}
|
|
7390
7748
|
);
|
|
7749
|
+
const SIZE_VARIANT = /^@(?:(min|max)-)?(\[[^\]]+\]|[a-zA-Z0-9.]+)(?:\/([a-zA-Z0-9_-]+))?$/;
|
|
7391
7750
|
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),
|
|
7751
|
+
(mod) => SIZE_VARIANT.test(mod) && !/^@container(?:\/|$)/.test(mod),
|
|
7406
7752
|
void 0,
|
|
7407
7753
|
(mod, context) => {
|
|
7408
|
-
const
|
|
7409
|
-
if (
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
return [];
|
|
7754
|
+
const m = SIZE_VARIANT.exec(mod.type);
|
|
7755
|
+
if (!m) return [];
|
|
7756
|
+
const [, type, size, name] = m;
|
|
7757
|
+
const value = size.startsWith("[") ? size.slice(1, -1).replace(/_/g, " ") : context.theme("container." + size);
|
|
7758
|
+
if (!value) return [];
|
|
7759
|
+
return [createContainerRule(createContainerParams(type === "max" ? "max" : "min", value, name), [])];
|
|
7415
7760
|
}
|
|
7416
7761
|
);
|
|
7762
|
+
const startsAtRule = (bracket) => /^[\s_]*@/.test(bracket);
|
|
7417
7763
|
functionalModifier(
|
|
7418
|
-
(mod) =>
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7764
|
+
(mod) => /^has-\[.*\]$/.test(mod) && !startsAtRule(mod.slice(5)),
|
|
7765
|
+
({ selector, mod }) => {
|
|
7766
|
+
const m = /^has-\[(.+)\]$/.exec(mod.type);
|
|
7767
|
+
return m ? {
|
|
7768
|
+
selector: `&:has(${functionalArgument(m[1])})`,
|
|
7769
|
+
flatten: false,
|
|
7770
|
+
wrappingType: "rule",
|
|
7771
|
+
source: "attribute"
|
|
7772
|
+
} : {
|
|
7773
|
+
selector,
|
|
7774
|
+
source: "attribute"
|
|
7775
|
+
};
|
|
7776
|
+
},
|
|
7777
|
+
void 0
|
|
7430
7778
|
);
|
|
7431
7779
|
functionalModifier(
|
|
7432
|
-
(mod) =>
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
return [createContainerRule(params, [])];
|
|
7441
|
-
}
|
|
7442
|
-
return [];
|
|
7443
|
-
}
|
|
7780
|
+
(mod) => /^has-(data|aria)-/.test(mod) && !!attributeVariantSelector(mod.slice(4)),
|
|
7781
|
+
({ mod }) => ({
|
|
7782
|
+
selector: `&:has(*${attributeVariantSelector(mod.type.slice(4))})`,
|
|
7783
|
+
flatten: false,
|
|
7784
|
+
wrappingType: "rule",
|
|
7785
|
+
source: "attribute"
|
|
7786
|
+
}),
|
|
7787
|
+
void 0
|
|
7444
7788
|
);
|
|
7789
|
+
function innerCompound(variant, ctx) {
|
|
7790
|
+
const attr = attributeVariantSelector(variant);
|
|
7791
|
+
if (attr) return { compound: attr };
|
|
7792
|
+
if (/^(has|in|not|group|peer)-|[^a-z0-9-]/.test(variant)) return void 0;
|
|
7793
|
+
const inner = getModifier(ctx).find((m) => m.match(variant, ctx));
|
|
7794
|
+
if (!inner?.modifySelector || inner.astHandler) return void 0;
|
|
7795
|
+
const out = inner.modifySelector({ selector: "&", fullClassName: "", mod: { type: variant }, context: ctx });
|
|
7796
|
+
const list = typeof out === "string" ? [{ selector: out }] : Array.isArray(out) ? out : [out];
|
|
7797
|
+
if (list.length !== 1) return void 0;
|
|
7798
|
+
const sel = list[0].selector;
|
|
7799
|
+
if (!/^&[:[]/.test(sel) || sel.slice(1).includes("&") || /[\s,>+~]/.test(sel.replace(/\([^()]*\)/g, ""))) return void 0;
|
|
7800
|
+
return { compound: sel.slice(1), inner };
|
|
7801
|
+
}
|
|
7802
|
+
function resolveHasIn(mod, ctx) {
|
|
7803
|
+
const m = /^(has|in)-(.+)$/.exec(mod);
|
|
7804
|
+
if (!m) return void 0;
|
|
7805
|
+
const [, kind, v] = m;
|
|
7806
|
+
if (kind === "in" && /^\[.+\]$/.test(v)) {
|
|
7807
|
+
if (startsAtRule(v.slice(1))) return void 0;
|
|
7808
|
+
const sel = decodeArbitrarySelector(v.slice(1, -1));
|
|
7809
|
+
return { kind, compound: sel.startsWith("&") ? sel.slice(1) : `:is(${sel})` };
|
|
7810
|
+
}
|
|
7811
|
+
if (kind === "has" && (v.startsWith("[") || /^(data|aria)-/.test(v))) return void 0;
|
|
7812
|
+
const r = innerCompound(v, ctx);
|
|
7813
|
+
return r && { kind, ...r };
|
|
7814
|
+
}
|
|
7815
|
+
const hasInSelector = ({ selector, mod, context }) => {
|
|
7816
|
+
const r = resolveHasIn(mod.type, context);
|
|
7817
|
+
if (!r) return { selector };
|
|
7818
|
+
return {
|
|
7819
|
+
selector: r.kind === "has" ? `&:has(*${r.compound})` : `:where(*${r.compound}) &`,
|
|
7820
|
+
flatten: false,
|
|
7821
|
+
wrappingType: "rule",
|
|
7822
|
+
source: "attribute"
|
|
7823
|
+
};
|
|
7824
|
+
};
|
|
7445
7825
|
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
|
-
}
|
|
7826
|
+
(mod, ctx) => !!resolveHasIn(mod, ctx)?.inner?.wrap,
|
|
7827
|
+
hasInSelector,
|
|
7828
|
+
(mod, context) => resolveHasIn(mod.type, context).inner.wrap({ ...mod, type: mod.type.replace(/^(has|in)-/, "") }, context)
|
|
7458
7829
|
);
|
|
7459
7830
|
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
|
-
}
|
|
7831
|
+
(mod, ctx) => {
|
|
7832
|
+
const r = resolveHasIn(mod, ctx);
|
|
7833
|
+
return !!r && !r.inner?.wrap;
|
|
7834
|
+
},
|
|
7835
|
+
hasInSelector
|
|
7471
7836
|
);
|
|
7837
|
+
function resolveGroupHas(mod, ctx) {
|
|
7838
|
+
const m = /^(group|peer)-has-(.+?)(?:\/([a-zA-Z0-9_-]+))?$/.exec(mod);
|
|
7839
|
+
if (!m) return void 0;
|
|
7840
|
+
const kind = m[1];
|
|
7841
|
+
const v = m[2];
|
|
7842
|
+
const base = m[3] ? `.${kind}\\/${m[3]}` : `.${kind}`;
|
|
7843
|
+
if (/^\[.+\]$/.test(v)) {
|
|
7844
|
+
if (startsAtRule(v.slice(1))) return void 0;
|
|
7845
|
+
const sel = decodeArbitrarySelector(v.slice(1, -1));
|
|
7846
|
+
return { kind, base, v, arg: /^[>+~]/.test(sel.trim()) ? sel : `*:is(${sel})` };
|
|
7847
|
+
}
|
|
7848
|
+
const r = innerCompound(v, ctx);
|
|
7849
|
+
return r && { kind, base, v, arg: `*${r.compound}`, inner: r.inner };
|
|
7850
|
+
}
|
|
7851
|
+
const groupHasSelector = ({ selector, mod, context }) => {
|
|
7852
|
+
const r = resolveGroupHas(mod.type, context);
|
|
7853
|
+
if (!r) return { selector };
|
|
7854
|
+
const tail = r.kind === "group" ? " *" : " ~ *";
|
|
7855
|
+
return { selector: `&:is(:where(${r.base}):has(${r.arg})${tail})`, wrappingType: "rule", source: r.kind };
|
|
7856
|
+
};
|
|
7472
7857
|
functionalModifier(
|
|
7473
|
-
(mod) =>
|
|
7474
|
-
|
|
7858
|
+
(mod, ctx) => !!resolveGroupHas(mod, ctx)?.inner?.wrap,
|
|
7859
|
+
groupHasSelector,
|
|
7475
7860
|
(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 [];
|
|
7861
|
+
const r = resolveGroupHas(mod.type, context);
|
|
7862
|
+
return r.inner.wrap({ ...mod, type: r.v }, context);
|
|
7483
7863
|
}
|
|
7484
7864
|
);
|
|
7485
7865
|
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
|
-
};
|
|
7866
|
+
(mod, ctx) => {
|
|
7867
|
+
const r = resolveGroupHas(mod, ctx);
|
|
7868
|
+
return !!r && !r.inner?.wrap;
|
|
7506
7869
|
},
|
|
7507
|
-
|
|
7870
|
+
groupHasSelector
|
|
7508
7871
|
);
|
|
7509
7872
|
functionalModifier(
|
|
7510
7873
|
(mod) => /^not-\[.*\]$/.test(mod),
|
|
7511
7874
|
({ selector, mod }) => {
|
|
7512
7875
|
const m = /^not-\[(.+)\]$/.exec(mod.type);
|
|
7513
7876
|
if (m) {
|
|
7514
|
-
if (m[1]
|
|
7877
|
+
if (!/^[a-zA-Z0-9_-]+(=.+)?$/.test(m[1])) {
|
|
7515
7878
|
return {
|
|
7516
|
-
selector: `&:not(${m[1]})`,
|
|
7879
|
+
selector: `&:not(${functionalArgument(m[1])})`,
|
|
7517
7880
|
flatten: false,
|
|
7518
7881
|
wrappingType: "rule",
|
|
7519
7882
|
source: "attribute"
|
|
@@ -7546,27 +7909,14 @@ functionalModifier(
|
|
|
7546
7909
|
);
|
|
7547
7910
|
functionalModifier(
|
|
7548
7911
|
(mod) => mod === "*",
|
|
7549
|
-
(
|
|
7550
|
-
|
|
7551
|
-
return {
|
|
7552
|
-
selector: `:is(.${escapeClassName(fullClassName)} > *)`,
|
|
7553
|
-
flatten: true,
|
|
7554
|
-
wrappingType: isSingle ? "rule" : "style-rule",
|
|
7555
|
-
source: "universal"
|
|
7556
|
-
};
|
|
7912
|
+
() => {
|
|
7913
|
+
return { selector: ":is(& > *)", wrappingType: "rule", source: "universal" };
|
|
7557
7914
|
},
|
|
7558
7915
|
void 0
|
|
7559
7916
|
);
|
|
7560
7917
|
functionalModifier(
|
|
7561
7918
|
(mod) => mod === "**",
|
|
7562
|
-
({ selector,
|
|
7563
|
-
return {
|
|
7564
|
-
selector: `:is(.${escapeClassName(fullClassName)} *)`,
|
|
7565
|
-
flatten: false,
|
|
7566
|
-
wrappingType: "style-rule",
|
|
7567
|
-
source: "universal"
|
|
7568
|
-
};
|
|
7569
|
-
},
|
|
7919
|
+
() => ({ selector: ":is(& *)", wrappingType: "rule", source: "universal" }),
|
|
7570
7920
|
void 0
|
|
7571
7921
|
);
|
|
7572
7922
|
functionalModifier(
|
|
@@ -7574,17 +7924,14 @@ functionalModifier(
|
|
|
7574
7924
|
({ selector, mod }) => {
|
|
7575
7925
|
const m = /^\[(.+)\]$/.exec(mod.type);
|
|
7576
7926
|
if (!m) return { selector };
|
|
7577
|
-
const inner = m[1].trim();
|
|
7927
|
+
const inner = decodeArbitrarySelector(m[1]).trim();
|
|
7578
7928
|
if (/^[a-zA-Z0-9_-]+(=.+)?$/.test(inner)) {
|
|
7579
7929
|
return { selector: `&[${inner}]`, wrappingType: "rule", source: "attribute" };
|
|
7580
7930
|
}
|
|
7581
|
-
if (inner === "&>*") {
|
|
7582
|
-
return { selector: `${inner}`, wrappingType: "style-rule", source: "peer" };
|
|
7583
|
-
}
|
|
7584
7931
|
if (inner.startsWith("&")) {
|
|
7585
7932
|
return { selector: `${inner}`, wrappingType: "rule", source: "pseudo" };
|
|
7586
7933
|
}
|
|
7587
|
-
return { selector:
|
|
7934
|
+
return { selector: `&:is(${inner})`, wrappingType: "rule", source: "base" };
|
|
7588
7935
|
},
|
|
7589
7936
|
void 0
|
|
7590
7937
|
);
|
|
@@ -7628,7 +7975,7 @@ functionalModifier(
|
|
|
7628
7975
|
};
|
|
7629
7976
|
} else {
|
|
7630
7977
|
return {
|
|
7631
|
-
selector: `&:not(${inner})`,
|
|
7978
|
+
selector: `&:not(${functionalArgument(inner)})`,
|
|
7632
7979
|
source: "attribute"
|
|
7633
7980
|
};
|
|
7634
7981
|
}
|
|
@@ -7779,29 +8126,56 @@ functionalModifier(
|
|
|
7779
8126
|
return m ? [atRule("scope", m[1], [])] : [];
|
|
7780
8127
|
}
|
|
7781
8128
|
);
|
|
8129
|
+
const atRuleHas = (mod) => /^(group|peer)-has-\[/.test(mod) && startsAtRule(mod.slice(mod.indexOf("[") + 1));
|
|
8130
|
+
function splitGroupName(kind, variant) {
|
|
8131
|
+
const named = /^(.+)\/([a-zA-Z0-9_-]+)$/.exec(variant);
|
|
8132
|
+
return named ? [named[1], `.${kind}\\/${named[2]}`] : [variant, `.${kind}`];
|
|
8133
|
+
}
|
|
8134
|
+
functionalModifier(
|
|
8135
|
+
(mod) => /^(group|peer)-hover(\/[a-zA-Z0-9_-]+)?$/.test(mod),
|
|
8136
|
+
({ mod }) => {
|
|
8137
|
+
const kind = mod.type.startsWith("group") ? "group" : "peer";
|
|
8138
|
+
const [, base] = splitGroupName(kind, mod.type.slice(kind.length + 1));
|
|
8139
|
+
const tail = kind === "group" ? " *" : " ~ *";
|
|
8140
|
+
return { selector: `&:is(:where(${base}):hover${tail})`, wrappingType: "rule", source: kind };
|
|
8141
|
+
},
|
|
8142
|
+
() => [atRule("media", "(hover: hover)", [])]
|
|
8143
|
+
);
|
|
8144
|
+
function negated(value) {
|
|
8145
|
+
const v = value.slice(4);
|
|
8146
|
+
return v.startsWith("[") && v.endsWith("]") ? `:not(*:is(${decodeArbitrarySelector(v.slice(1, -1))}))` : `:not(:${v})`;
|
|
8147
|
+
}
|
|
7782
8148
|
functionalModifier(
|
|
7783
|
-
(mod) => /^group-(.+)$/.test(mod),
|
|
8149
|
+
(mod) => /^group-(.+)$/.test(mod) && !atRuleHas(mod),
|
|
7784
8150
|
({ selector, mod }) => {
|
|
7785
|
-
const
|
|
8151
|
+
const raw2 = /^group-(.+)$/.exec(mod.type);
|
|
8152
|
+
const [variant, base] = splitGroupName("group", raw2?.[1] ?? "");
|
|
8153
|
+
const m = raw2 ? [raw2[0], variant] : null;
|
|
8154
|
+
const g = `:where(${base})`;
|
|
8155
|
+
const attr = m ? attributeVariantSelector(m[1]) : void 0;
|
|
8156
|
+
if (attr) return { selector: `&:is(${g}${attr} *)`, wrappingType: "rule", source: "group" };
|
|
7786
8157
|
if (m?.[1].startsWith("[") && m?.[1].endsWith("]")) {
|
|
7787
8158
|
const value = m?.[1].slice(1, -1).replace(/_/g, "");
|
|
7788
8159
|
return {
|
|
7789
|
-
selector: `&:is(:
|
|
8160
|
+
selector: `&:is(${g}:is(${value}) *)`,
|
|
7790
8161
|
wrappingType: "rule",
|
|
7791
8162
|
source: "group"
|
|
7792
8163
|
};
|
|
7793
8164
|
}
|
|
8165
|
+
if (m?.[1]?.startsWith("not-")) {
|
|
8166
|
+
return { selector: `&:is(${g}${negated(m[1])} *)`, wrappingType: "rule", source: "group" };
|
|
8167
|
+
}
|
|
7794
8168
|
if (m?.[1]?.startsWith("has-")) {
|
|
7795
8169
|
const pattern = /^has-\[([a-zA-Z0-9_-]+)\]$/.exec(m?.[1]);
|
|
7796
8170
|
if (pattern) {
|
|
7797
8171
|
const value = pattern[1];
|
|
7798
8172
|
return {
|
|
7799
|
-
selector: `&:is(:
|
|
8173
|
+
selector: `&:is(${g}:has(:is(${value})) *)`,
|
|
7800
8174
|
source: "group"
|
|
7801
8175
|
};
|
|
7802
8176
|
}
|
|
7803
8177
|
return {
|
|
7804
|
-
selector: `&:is(:
|
|
8178
|
+
selector: `&:is(${g}:has(${functionalArgument(m[1].slice(5, -1))}) *)`,
|
|
7805
8179
|
source: "group"
|
|
7806
8180
|
};
|
|
7807
8181
|
}
|
|
@@ -7811,19 +8185,19 @@ functionalModifier(
|
|
|
7811
8185
|
const value = pattern[1];
|
|
7812
8186
|
if (pattern[2]) {
|
|
7813
8187
|
return {
|
|
7814
|
-
selector: `&:is(
|
|
8188
|
+
selector: `&:is(${g}[aria-${value}="${pattern[2]}"] *)`,
|
|
7815
8189
|
source: "group"
|
|
7816
8190
|
};
|
|
7817
8191
|
} else {
|
|
7818
8192
|
return {
|
|
7819
|
-
selector: `&:is(
|
|
8193
|
+
selector: `&:is(${g}[aria-${value}] *)`,
|
|
7820
8194
|
source: "group"
|
|
7821
8195
|
};
|
|
7822
8196
|
}
|
|
7823
8197
|
}
|
|
7824
8198
|
}
|
|
7825
8199
|
return m ? {
|
|
7826
|
-
selector: `&:is(
|
|
8200
|
+
selector: `&:is(${g}:${m[1]} *)`,
|
|
7827
8201
|
wrappingType: "rule",
|
|
7828
8202
|
source: "group"
|
|
7829
8203
|
} : {
|
|
@@ -7834,27 +8208,35 @@ functionalModifier(
|
|
|
7834
8208
|
void 0
|
|
7835
8209
|
);
|
|
7836
8210
|
functionalModifier(
|
|
7837
|
-
(mod) => /^peer-(.+)$/.test(mod),
|
|
8211
|
+
(mod) => /^peer-(.+)$/.test(mod) && !atRuleHas(mod),
|
|
7838
8212
|
({ selector, mod }) => {
|
|
7839
|
-
const
|
|
8213
|
+
const raw2 = /^peer-(.+)$/.exec(mod.type);
|
|
8214
|
+
const [variant, base] = splitGroupName("peer", raw2?.[1] ?? "");
|
|
8215
|
+
const m = raw2 ? [raw2[0], variant] : null;
|
|
8216
|
+
const g = `:where(${base})`;
|
|
8217
|
+
const attr = m ? attributeVariantSelector(m[1]) : void 0;
|
|
8218
|
+
if (attr) return { selector: `&:is(${g}${attr} ~ *)`, wrappingType: "rule", source: "peer" };
|
|
7840
8219
|
if (m?.[1].startsWith("[") && m?.[1].endsWith("]")) {
|
|
7841
8220
|
const value2 = m?.[1].slice(1, -1).replace(/_/g, "");
|
|
7842
8221
|
return {
|
|
7843
|
-
selector: `&:is(:
|
|
8222
|
+
selector: `&:is(${g}:is(${value2})~*)`,
|
|
7844
8223
|
wrappingType: "rule",
|
|
7845
8224
|
source: "peer"
|
|
7846
8225
|
};
|
|
7847
8226
|
}
|
|
7848
8227
|
const value = m?.[1];
|
|
8228
|
+
if (value?.startsWith("has-[") && value.endsWith("]")) {
|
|
8229
|
+
return { selector: `&:is(${g}:has(${functionalArgument(value.slice(5, -1))}) ~ *)`, source: "peer" };
|
|
8230
|
+
}
|
|
7849
8231
|
if (value?.startsWith("has-")) {
|
|
7850
8232
|
return {
|
|
7851
|
-
selector: `&:is(:
|
|
8233
|
+
selector: `&:is(${g}:has(:${value.slice(4)})~*)`,
|
|
7852
8234
|
source: "peer"
|
|
7853
8235
|
};
|
|
7854
8236
|
}
|
|
7855
8237
|
if (value?.startsWith("not-")) {
|
|
7856
8238
|
return {
|
|
7857
|
-
selector: `&:is(
|
|
8239
|
+
selector: `&:is(${g}${negated(value)} ~ *)`,
|
|
7858
8240
|
source: "peer"
|
|
7859
8241
|
};
|
|
7860
8242
|
}
|
|
@@ -7863,7 +8245,7 @@ functionalModifier(
|
|
|
7863
8245
|
if (pattern) {
|
|
7864
8246
|
const key = pattern[1];
|
|
7865
8247
|
return {
|
|
7866
|
-
selector: `&:is(
|
|
8248
|
+
selector: `&:is(${g}[aria-${key}]~*)`,
|
|
7867
8249
|
source: "peer"
|
|
7868
8250
|
};
|
|
7869
8251
|
}
|
|
@@ -7873,19 +8255,19 @@ functionalModifier(
|
|
|
7873
8255
|
const value2 = pattern[2];
|
|
7874
8256
|
if (pattern[2]) {
|
|
7875
8257
|
return {
|
|
7876
|
-
selector: `&:is(
|
|
8258
|
+
selector: `&:is(${g}[aria-${key}="${value2}"]~*)`,
|
|
7877
8259
|
source: "peer"
|
|
7878
8260
|
};
|
|
7879
8261
|
} else {
|
|
7880
8262
|
return {
|
|
7881
|
-
selector: `&:is(
|
|
8263
|
+
selector: `&:is(${g}[aria-${key}]~*)`,
|
|
7882
8264
|
source: "peer"
|
|
7883
8265
|
};
|
|
7884
8266
|
}
|
|
7885
8267
|
}
|
|
7886
8268
|
}
|
|
7887
8269
|
return m ? {
|
|
7888
|
-
selector: `&:is(
|
|
8270
|
+
selector: `&:is(${g}:${value}~*)`,
|
|
7889
8271
|
source: "peer"
|
|
7890
8272
|
} : {
|
|
7891
8273
|
selector,
|
|
@@ -7936,12 +8318,58 @@ functionalModifier(
|
|
|
7936
8318
|
},
|
|
7937
8319
|
void 0
|
|
7938
8320
|
);
|
|
8321
|
+
const LEADING_AT = /^\s*@(media|container)\s+([^{]*)\{/;
|
|
8322
|
+
const LATE_MEDIA = /prefers-color-scheme|\bprint\b|forced-colors|orientation/;
|
|
8323
|
+
const MIN_W = /(?:min-width\s*:\s*|width\s*>=?\s*)([\d.]+)(px|rem|em)?/;
|
|
8324
|
+
const MAX_W = /(?:max-width\s*:\s*|width\s*<=?\s*)([\d.]+)(px|rem|em)?/;
|
|
8325
|
+
function toPx(n, unit) {
|
|
8326
|
+
const v = parseFloat(n);
|
|
8327
|
+
return unit === "rem" || unit === "em" ? v * 16 : v;
|
|
8328
|
+
}
|
|
8329
|
+
function preludeKey(kind, prelude) {
|
|
8330
|
+
const container = kind === "container";
|
|
8331
|
+
const min = MIN_W.exec(prelude);
|
|
8332
|
+
if (min) return [container ? 4 : 2, toPx(min[1], min[2])];
|
|
8333
|
+
const max = MAX_W.exec(prelude);
|
|
8334
|
+
if (max) return [container ? 3 : 1, -toPx(max[1], max[2])];
|
|
8335
|
+
if (!container && LATE_MEDIA.test(prelude)) return [5, 0];
|
|
8336
|
+
return [0, 0];
|
|
8337
|
+
}
|
|
8338
|
+
function ruleSortKey(rule2) {
|
|
8339
|
+
const key = [];
|
|
8340
|
+
let rest = rule2;
|
|
8341
|
+
let m;
|
|
8342
|
+
while (m = LEADING_AT.exec(rest)) {
|
|
8343
|
+
const [g, v] = preludeKey(m[1], m[2]);
|
|
8344
|
+
key.push(g, v);
|
|
8345
|
+
rest = rest.slice(m[0].length);
|
|
8346
|
+
}
|
|
8347
|
+
return key;
|
|
8348
|
+
}
|
|
8349
|
+
function compareKeys(a, b) {
|
|
8350
|
+
const n = Math.min(a.length, b.length);
|
|
8351
|
+
for (let i = 0; i < n; i++) {
|
|
8352
|
+
if (a[i] !== b[i]) return a[i] - b[i];
|
|
8353
|
+
}
|
|
8354
|
+
return a.length - b.length;
|
|
8355
|
+
}
|
|
8356
|
+
function upperBound(keys, key) {
|
|
8357
|
+
let lo = 0;
|
|
8358
|
+
let hi = keys.length;
|
|
8359
|
+
while (lo < hi) {
|
|
8360
|
+
const mid = lo + hi >> 1;
|
|
8361
|
+
if (compareKeys(keys[mid], key) <= 0) lo = mid + 1;
|
|
8362
|
+
else hi = mid;
|
|
8363
|
+
}
|
|
8364
|
+
return lo;
|
|
8365
|
+
}
|
|
7939
8366
|
export {
|
|
7940
8367
|
AstCache,
|
|
7941
8368
|
IncrementalParser,
|
|
7942
8369
|
ParseResultCache,
|
|
7943
8370
|
UtilityCache,
|
|
7944
8371
|
WeakCache,
|
|
8372
|
+
arbitraryPropertyRegistration,
|
|
7945
8373
|
astCache,
|
|
7946
8374
|
astToCss,
|
|
7947
8375
|
atRoot,
|
|
@@ -7950,6 +8378,7 @@ export {
|
|
|
7950
8378
|
clearAstCache,
|
|
7951
8379
|
collectDeclPaths,
|
|
7952
8380
|
comment,
|
|
8381
|
+
compareKeys,
|
|
7953
8382
|
configGetter,
|
|
7954
8383
|
createContext,
|
|
7955
8384
|
decl,
|
|
@@ -7957,6 +8386,7 @@ export {
|
|
|
7957
8386
|
deepMerge,
|
|
7958
8387
|
defaultConfig,
|
|
7959
8388
|
escapeClassName,
|
|
8389
|
+
expandThemeFunctions,
|
|
7960
8390
|
functionalModifier,
|
|
7961
8391
|
functionalUtility,
|
|
7962
8392
|
generateCss,
|
|
@@ -7966,10 +8396,17 @@ export {
|
|
|
7966
8396
|
getModifier,
|
|
7967
8397
|
getPreflightCSS,
|
|
7968
8398
|
getUtility,
|
|
8399
|
+
hasCommentDelimiter,
|
|
8400
|
+
hasCommentToken,
|
|
7969
8401
|
hasPreset,
|
|
8402
|
+
isDebug,
|
|
8403
|
+
isSafeVariantToken,
|
|
8404
|
+
isSafeVariantValue,
|
|
8405
|
+
isStructureSafeValue,
|
|
7970
8406
|
jsonToAst,
|
|
7971
8407
|
mergeAstTreeList,
|
|
7972
8408
|
modifierRegistry,
|
|
8409
|
+
normalizeMathSpacing,
|
|
7973
8410
|
optimizeAst,
|
|
7974
8411
|
parseClassName,
|
|
7975
8412
|
parseClassToAst,
|
|
@@ -7981,13 +8418,16 @@ export {
|
|
|
7981
8418
|
resolveTheme,
|
|
7982
8419
|
rootToCss,
|
|
7983
8420
|
rule,
|
|
8421
|
+
ruleSortKey,
|
|
7984
8422
|
setContextCacheReset,
|
|
8423
|
+
setDebug,
|
|
7985
8424
|
staticModifier,
|
|
7986
8425
|
staticUtility,
|
|
7987
8426
|
styleRule,
|
|
7988
8427
|
themeGetter,
|
|
7989
8428
|
themeToCssVars,
|
|
7990
8429
|
tokenize,
|
|
8430
|
+
upperBound,
|
|
7991
8431
|
utilityCache
|
|
7992
8432
|
};
|
|
7993
8433
|
//# sourceMappingURL=index.js.map
|