@barocss/browser 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -5
- package/dist/cdn/barocss.js +1595 -1061
- package/dist/cdn/barocss.js.map +1 -1
- package/dist/cdn/barocss.umd.cjs +1 -1
- package/dist/cdn/barocss.umd.cjs.map +1 -1
- package/dist/index.d.ts +66 -4
- package/dist/index.es.js +267 -85
- package/dist/index.umd.js +9 -6
- package/package.json +2 -2
package/dist/cdn/barocss.js
CHANGED
|
@@ -11,9 +11,6 @@ function atRoot(nodes, source) {
|
|
|
11
11
|
function atRule(name, params, nodes, source) {
|
|
12
12
|
return { type: "at-rule", name, params, nodes, source };
|
|
13
13
|
}
|
|
14
|
-
function styleRule(selector, nodes, source) {
|
|
15
|
-
return { type: "style-rule", selector, nodes, source };
|
|
16
|
-
}
|
|
17
14
|
function rule(selector, nodes, source) {
|
|
18
15
|
return { type: "rule", selector, nodes, source };
|
|
19
16
|
}
|
|
@@ -27,6 +24,16 @@ function property(name, initialValue, syntax, source) {
|
|
|
27
24
|
}
|
|
28
25
|
return atRule("property", name, nodes, source);
|
|
29
26
|
}
|
|
27
|
+
let debugEnabled = false;
|
|
28
|
+
function setDebug(enabled) {
|
|
29
|
+
debugEnabled = enabled;
|
|
30
|
+
}
|
|
31
|
+
function debugLog(...args) {
|
|
32
|
+
if (debugEnabled) console.log(...args);
|
|
33
|
+
}
|
|
34
|
+
function debugWarn(...args) {
|
|
35
|
+
if (debugEnabled) console.warn(...args);
|
|
36
|
+
}
|
|
30
37
|
class AstCache {
|
|
31
38
|
constructor() {
|
|
32
39
|
this.cache = /* @__PURE__ */ new Map();
|
|
@@ -135,7 +142,7 @@ function clearAllCaches() {
|
|
|
135
142
|
parseResultCache.clear();
|
|
136
143
|
utilityCache.clear();
|
|
137
144
|
resetContextCaches?.();
|
|
138
|
-
|
|
145
|
+
debugLog("[clearAllCaches] All caches cleared");
|
|
139
146
|
}
|
|
140
147
|
const states = /* @__PURE__ */ new WeakMap();
|
|
141
148
|
let cacheGeneration = 0;
|
|
@@ -172,6 +179,10 @@ function clearContextCaches(ctx) {
|
|
|
172
179
|
const utilityRegistry = [];
|
|
173
180
|
function registerUtility(util, ctx) {
|
|
174
181
|
utilityRegistry.push(util);
|
|
182
|
+
{
|
|
183
|
+
parseResultCache.clear();
|
|
184
|
+
utilityCache.clear();
|
|
185
|
+
}
|
|
175
186
|
}
|
|
176
187
|
function getUtility(ctx) {
|
|
177
188
|
return ctx && getContextState(ctx)?.utilities || utilityRegistry;
|
|
@@ -282,7 +293,7 @@ function functionalUtility(opts, ctx) {
|
|
|
282
293
|
}
|
|
283
294
|
}
|
|
284
295
|
if (opts.supportsArbitrary && parsedUtility.arbitrary) {
|
|
285
|
-
const processedValue = finalValue.replace(/_/g, " ");
|
|
296
|
+
const processedValue = normalizeMathSpacing(expandThemeFunctions(finalValue.replace(/_/g, " ")));
|
|
286
297
|
if (opts.handle) {
|
|
287
298
|
const result = opts.handle(processedValue, ctx2, token, extra);
|
|
288
299
|
if (result) return result;
|
|
@@ -340,6 +351,8 @@ function functionalUtility(opts, ctx) {
|
|
|
340
351
|
const bare = opts.handleBareValue({ value: finalValue, ctx: ctx2, token, extra });
|
|
341
352
|
if (bare == null) return [];
|
|
342
353
|
finalValue = bare;
|
|
354
|
+
} else if (!/^-?(\d|\.\d)/.test(String(finalValue))) {
|
|
355
|
+
return [];
|
|
343
356
|
}
|
|
344
357
|
if (opts.handle) {
|
|
345
358
|
const result = opts.handle(finalValue, ctx2, token, extra);
|
|
@@ -355,6 +368,62 @@ function functionalUtility(opts, ctx) {
|
|
|
355
368
|
priority: opts.priority
|
|
356
369
|
});
|
|
357
370
|
}
|
|
371
|
+
const MATH_FNS = /* @__PURE__ */ new Set(["calc", "min", "max", "clamp"]);
|
|
372
|
+
function expandThemeFunctions(value) {
|
|
373
|
+
return value.replace(/--spacing\(\s*([^()]+?)\s*\)/g, "calc(var(--spacing) * $1)");
|
|
374
|
+
}
|
|
375
|
+
const arbitraryPropertyRegistration = {
|
|
376
|
+
name: "[arbitrary-property]",
|
|
377
|
+
match: () => false,
|
|
378
|
+
handler: (value, _ctx, token) => {
|
|
379
|
+
const prop = token.property;
|
|
380
|
+
if (!prop || !value) return [];
|
|
381
|
+
return [decl(prop, normalizeMathSpacing(expandThemeFunctions(value.replace(/_/g, " "))))];
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
function normalizeMathSpacing(value) {
|
|
385
|
+
if (!/(calc|min|max|clamp)\(/.test(value)) return value;
|
|
386
|
+
const stack = [];
|
|
387
|
+
let out = "";
|
|
388
|
+
for (let i = 0; i < value.length; i++) {
|
|
389
|
+
const ch = value[i];
|
|
390
|
+
if (ch === "(") {
|
|
391
|
+
const name = (/([a-z-]*)$/i.exec(out)?.[1] ?? "").toLowerCase();
|
|
392
|
+
const inMath2 = stack.length > 0 && stack[stack.length - 1];
|
|
393
|
+
stack.push(MATH_FNS.has(name) || name === "" && inMath2);
|
|
394
|
+
out += ch;
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
if (ch === ")") {
|
|
398
|
+
stack.pop();
|
|
399
|
+
out += ch;
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
const inMath = stack.length > 0 && stack[stack.length - 1];
|
|
403
|
+
if (!inMath) {
|
|
404
|
+
out += ch;
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
if (ch === ",") {
|
|
408
|
+
out = out.trimEnd() + ", ";
|
|
409
|
+
while (value[i + 1] === " ") i++;
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
if ("+-*/".includes(ch)) {
|
|
413
|
+
const prev = out.trimEnd();
|
|
414
|
+
const p = prev[prev.length - 1] ?? "";
|
|
415
|
+
const binary = /[\w%)]/.test(p);
|
|
416
|
+
const exponent = (ch === "+" || ch === "-") && /\de$/i.test(prev) && prev.length === out.length && /\d/.test(value[i + 1] ?? "");
|
|
417
|
+
if (binary && !exponent) {
|
|
418
|
+
out = prev + " " + ch + " ";
|
|
419
|
+
while (value[i + 1] === " ") i++;
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
out += ch;
|
|
424
|
+
}
|
|
425
|
+
return out;
|
|
426
|
+
}
|
|
358
427
|
function tokenize(className) {
|
|
359
428
|
const tokens = [];
|
|
360
429
|
let current = "";
|
|
@@ -421,6 +490,9 @@ function parseClassName(className, ctx) {
|
|
|
421
490
|
if (className.startsWith("!")) {
|
|
422
491
|
important = true;
|
|
423
492
|
realClassName = className.slice(1);
|
|
493
|
+
} else if (className.length > 1 && className.endsWith("!")) {
|
|
494
|
+
important = true;
|
|
495
|
+
realClassName = className.slice(0, -1);
|
|
424
496
|
}
|
|
425
497
|
const tokens = tokenize(realClassName);
|
|
426
498
|
const result = parseTokens(tokens, ctx);
|
|
@@ -436,6 +508,16 @@ function parseTokens(tokens, ctx) {
|
|
|
436
508
|
if (tokens.length === 0) {
|
|
437
509
|
return { modifiers, utility: null };
|
|
438
510
|
}
|
|
511
|
+
if (tokens.length > 1) {
|
|
512
|
+
const utilityIndex = isUtilityPrefix(tokens[0].value, ctx) ? 0 : tokens.length - 1;
|
|
513
|
+
if (tokens.some((t, i) => i !== utilityIndex && !isSafeVariantToken(t.value))) {
|
|
514
|
+
return { modifiers, utility: null };
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
const utilityToken = tokens.length > 1 && !isUtilityPrefix(tokens[0].value, ctx) ? tokens[tokens.length - 1] : tokens[0];
|
|
518
|
+
if (!isStructureSafeValue(utilityToken.value)) {
|
|
519
|
+
return { modifiers, utility: null };
|
|
520
|
+
}
|
|
439
521
|
if (tokens.length === 1) {
|
|
440
522
|
utility = parseUtility(tokens[0].value, ctx);
|
|
441
523
|
} else if (tokens.length === 2) {
|
|
@@ -469,6 +551,79 @@ function parseTokens(tokens, ctx) {
|
|
|
469
551
|
}
|
|
470
552
|
return { modifiers, utility };
|
|
471
553
|
}
|
|
554
|
+
const FUNCTIONAL_VALUE_VARIANT = /^-?(?:(?:group|peer)-)?(?:has|not)-\[(.*)\](?:\/[\w-]+)?$/;
|
|
555
|
+
function isSafeVariantToken(value) {
|
|
556
|
+
if (hasCommentToken(value)) return false;
|
|
557
|
+
const m = FUNCTIONAL_VALUE_VARIANT.exec(value);
|
|
558
|
+
if (m) return isSafeVariantValue(m[1], true);
|
|
559
|
+
return isSafeVariantValue(value);
|
|
560
|
+
}
|
|
561
|
+
function hasCommentToken(value) {
|
|
562
|
+
return value.includes("/*") || value.includes("*/");
|
|
563
|
+
}
|
|
564
|
+
function isStructureSafeValue(value) {
|
|
565
|
+
if (hasCommentToken(value)) return false;
|
|
566
|
+
return isSafeVariantValue(value, true);
|
|
567
|
+
}
|
|
568
|
+
function hasUnquotedAt(value) {
|
|
569
|
+
let quote = "";
|
|
570
|
+
for (let i = 0; i < value.length; i++) {
|
|
571
|
+
const c = value[i];
|
|
572
|
+
if (c === "\\") {
|
|
573
|
+
i++;
|
|
574
|
+
continue;
|
|
575
|
+
}
|
|
576
|
+
if (quote) {
|
|
577
|
+
if (c === quote) quote = "";
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
if (c === '"' || c === "'") quote = c;
|
|
581
|
+
else if (c === "@") return true;
|
|
582
|
+
}
|
|
583
|
+
return false;
|
|
584
|
+
}
|
|
585
|
+
function isSafeVariantValue(value, allowTopLevelComma = false) {
|
|
586
|
+
const stack = [];
|
|
587
|
+
let quote = "";
|
|
588
|
+
let parenDepth = 0;
|
|
589
|
+
for (let i = 0; i < value.length; i++) {
|
|
590
|
+
const c = value[i];
|
|
591
|
+
if (c === "\\") {
|
|
592
|
+
i++;
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
if (quote) {
|
|
596
|
+
if (c === quote) quote = "";
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
switch (c) {
|
|
600
|
+
case '"':
|
|
601
|
+
case "'":
|
|
602
|
+
quote = c;
|
|
603
|
+
break;
|
|
604
|
+
case "(":
|
|
605
|
+
stack.push(")");
|
|
606
|
+
parenDepth++;
|
|
607
|
+
break;
|
|
608
|
+
case "[":
|
|
609
|
+
stack.push("]");
|
|
610
|
+
break;
|
|
611
|
+
case ")":
|
|
612
|
+
case "]":
|
|
613
|
+
if (stack.pop() !== c) return false;
|
|
614
|
+
if (c === ")") parenDepth--;
|
|
615
|
+
break;
|
|
616
|
+
case "{":
|
|
617
|
+
case "}":
|
|
618
|
+
case ";":
|
|
619
|
+
return false;
|
|
620
|
+
case ",":
|
|
621
|
+
if (parenDepth === 0 && !allowTopLevelComma) return false;
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
return stack.length === 0 && !quote;
|
|
626
|
+
}
|
|
472
627
|
function parseModifier(value) {
|
|
473
628
|
let negative = false;
|
|
474
629
|
let modStr = value;
|
|
@@ -493,6 +648,11 @@ function parseUtility(value, ctx) {
|
|
|
493
648
|
let opacity2 = "";
|
|
494
649
|
let category = "";
|
|
495
650
|
let priority = 0;
|
|
651
|
+
const prop = /^\[(--[a-zA-Z_][a-zA-Z0-9_-]*|-?[a-z][a-z-]*):(.+)\]$/.exec(value);
|
|
652
|
+
if (prop) {
|
|
653
|
+
if (!isStructureSafeValue(prop[2]) || hasUnquotedAt(prop[2])) return { prefix: "", value: "" };
|
|
654
|
+
return { prefix: "", value: prop[2], arbitrary: true, property: prop[1] };
|
|
655
|
+
}
|
|
496
656
|
if (value.startsWith("-")) {
|
|
497
657
|
negative = true;
|
|
498
658
|
}
|
|
@@ -548,6 +708,7 @@ function parseUtility(value, ctx) {
|
|
|
548
708
|
priority
|
|
549
709
|
};
|
|
550
710
|
}
|
|
711
|
+
const isSafeDecl = (prop, value) => isStructureSafeValue(String(prop)) && isStructureSafeValue(String(value ?? ""));
|
|
551
712
|
const importantPrefix = "!important";
|
|
552
713
|
function astToCss(ast, baseSelector, opts, _indent = "") {
|
|
553
714
|
const minify = opts?.minify;
|
|
@@ -556,7 +717,7 @@ function astToCss(ast, baseSelector, opts, _indent = "") {
|
|
|
556
717
|
const important = opts?.important ?? false;
|
|
557
718
|
const importantString = important ? ` ${importantPrefix}` : "";
|
|
558
719
|
if (!ast || ast.length === 0) {
|
|
559
|
-
|
|
720
|
+
debugWarn("[astToCss] Empty AST received:", { ast, baseSelector, minify });
|
|
560
721
|
return "";
|
|
561
722
|
}
|
|
562
723
|
const dedupedAst = [];
|
|
@@ -578,6 +739,7 @@ function astToCss(ast, baseSelector, opts, _indent = "") {
|
|
|
578
739
|
switch (node.type) {
|
|
579
740
|
case "decl": {
|
|
580
741
|
const value = node.value;
|
|
742
|
+
if (!isSafeDecl(node.prop, value)) return "";
|
|
581
743
|
if (node.prop.startsWith("--")) {
|
|
582
744
|
if (minify) {
|
|
583
745
|
const css = `${node.prop}: ${value}${importantString};`;
|
|
@@ -685,13 +847,13 @@ ${astToCss(
|
|
|
685
847
|
case "raw":
|
|
686
848
|
return `${indent}${node.value}`;
|
|
687
849
|
default:
|
|
688
|
-
|
|
850
|
+
debugWarn("[astToCss] Unknown node type:", node);
|
|
689
851
|
return "";
|
|
690
852
|
}
|
|
691
853
|
}).filter(Boolean).join(minify ? "" : "\n");
|
|
692
854
|
const finalResult = result + (minify ? "" : "\n");
|
|
693
855
|
if (!finalResult || finalResult.trim() === "") {
|
|
694
|
-
|
|
856
|
+
debugWarn("[astToCss] Empty result generated:", {
|
|
695
857
|
ast,
|
|
696
858
|
baseSelector,
|
|
697
859
|
minify,
|
|
@@ -702,26 +864,261 @@ ${astToCss(
|
|
|
702
864
|
}
|
|
703
865
|
return finalResult;
|
|
704
866
|
}
|
|
705
|
-
function rootToCss(nodes) {
|
|
867
|
+
function rootToCss(nodes, opts) {
|
|
706
868
|
const result = nodes.map((node) => {
|
|
707
869
|
const list = [];
|
|
708
870
|
if (node.type === "decl") {
|
|
709
|
-
|
|
871
|
+
if (isSafeDecl(node.prop, node.value)) {
|
|
872
|
+
list.push(`${node.prop}: ${node.value};`);
|
|
873
|
+
}
|
|
710
874
|
} else if (node.type === "at-rule") {
|
|
711
|
-
|
|
712
|
-
|
|
875
|
+
{
|
|
876
|
+
list.push(
|
|
877
|
+
`@${node.name} ${node.params} {
|
|
713
878
|
${node.nodes.map((node2) => {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
879
|
+
if (node2.type === "decl" && isSafeDecl(node2.prop, node2.value)) {
|
|
880
|
+
return ` ${node2.prop}: ${node2.value};`;
|
|
881
|
+
}
|
|
882
|
+
}).join("\n")}
|
|
718
883
|
}`
|
|
719
|
-
|
|
884
|
+
);
|
|
885
|
+
}
|
|
720
886
|
}
|
|
721
887
|
return list.join("\n");
|
|
722
888
|
}).join("\n");
|
|
723
889
|
return result;
|
|
724
890
|
}
|
|
891
|
+
function normalizePrefix(prefix) {
|
|
892
|
+
let p = prefix.trim();
|
|
893
|
+
if (!p.startsWith("--")) p = `--${p}`;
|
|
894
|
+
if (!p.endsWith("-")) p = `${p}-`;
|
|
895
|
+
return p;
|
|
896
|
+
}
|
|
897
|
+
function escapeKey(key) {
|
|
898
|
+
return key.replace(".", "\\.");
|
|
899
|
+
}
|
|
900
|
+
function colorsToCssVars(colors2) {
|
|
901
|
+
if (!colors2) return {};
|
|
902
|
+
const result = {};
|
|
903
|
+
function walk(obj, prefix = []) {
|
|
904
|
+
for (const key in obj) {
|
|
905
|
+
const value = obj[key];
|
|
906
|
+
if (typeof value === "object" && value !== null) {
|
|
907
|
+
walk(value, [...prefix, key]);
|
|
908
|
+
} else {
|
|
909
|
+
const varName2 = "--color-" + [...prefix, key].join("-");
|
|
910
|
+
result[varName2] = value;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
walk(colors2);
|
|
915
|
+
return result;
|
|
916
|
+
}
|
|
917
|
+
function boxShadowToCssVars(boxShadow2) {
|
|
918
|
+
if (!boxShadow2) return {};
|
|
919
|
+
const result = {};
|
|
920
|
+
for (const key in boxShadow2) {
|
|
921
|
+
result[`--shadow-${key}`] = boxShadow2[key];
|
|
922
|
+
}
|
|
923
|
+
return result;
|
|
924
|
+
}
|
|
925
|
+
function fontSizeToCssVars(fontSize2) {
|
|
926
|
+
if (!fontSize2) return {};
|
|
927
|
+
const result = {};
|
|
928
|
+
for (const key in fontSize2) {
|
|
929
|
+
const value = fontSize2[key];
|
|
930
|
+
if (Array.isArray(value)) {
|
|
931
|
+
result[`--text-${key}`] = value[0];
|
|
932
|
+
if (value[1]) result[`--text-${key}--line-height`] = value[1];
|
|
933
|
+
} else {
|
|
934
|
+
result[`--text-${key}`] = value;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
return result;
|
|
938
|
+
}
|
|
939
|
+
function fontWeightToCssVars(fontWeight2) {
|
|
940
|
+
if (!fontWeight2) return {};
|
|
941
|
+
const result = {};
|
|
942
|
+
for (const key in fontWeight2) {
|
|
943
|
+
result[`--font-weight-${key}`] = fontWeight2[key];
|
|
944
|
+
}
|
|
945
|
+
return result;
|
|
946
|
+
}
|
|
947
|
+
function fontFamilyToCssVars(fontFamily2) {
|
|
948
|
+
if (!fontFamily2) return {};
|
|
949
|
+
const result = {};
|
|
950
|
+
for (const key in fontFamily2) {
|
|
951
|
+
const value = fontFamily2[key];
|
|
952
|
+
if (Array.isArray(value)) {
|
|
953
|
+
result[`--font-${key}`] = value.join(", ");
|
|
954
|
+
} else {
|
|
955
|
+
result[`--font-${key}`] = value;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
return result;
|
|
959
|
+
}
|
|
960
|
+
function letterSpacingToCssVars(letterSpacing2) {
|
|
961
|
+
if (!letterSpacing2) return {};
|
|
962
|
+
const result = {};
|
|
963
|
+
for (const key in letterSpacing2) {
|
|
964
|
+
result[`--letter-spacing-${key}`] = letterSpacing2[key];
|
|
965
|
+
}
|
|
966
|
+
return result;
|
|
967
|
+
}
|
|
968
|
+
function spacingToCssVars(spacing2) {
|
|
969
|
+
if (!spacing2) return {};
|
|
970
|
+
const result = {};
|
|
971
|
+
for (const key in spacing2) {
|
|
972
|
+
result[`--spacing-${escapeKey(key)}`] = spacing2[key];
|
|
973
|
+
}
|
|
974
|
+
return result;
|
|
975
|
+
}
|
|
976
|
+
function borderRadiusToCssVars(borderRadius2) {
|
|
977
|
+
if (!borderRadius2) return {};
|
|
978
|
+
const result = {};
|
|
979
|
+
for (const key in borderRadius2) {
|
|
980
|
+
result[`--radius-${escapeKey(key)}`] = borderRadius2[key];
|
|
981
|
+
}
|
|
982
|
+
return result;
|
|
983
|
+
}
|
|
984
|
+
function zIndexToCssVars(zIndex2) {
|
|
985
|
+
if (!zIndex2) return {};
|
|
986
|
+
const result = {};
|
|
987
|
+
for (const key in zIndex2) {
|
|
988
|
+
result[`--z-${escapeKey(key)}`] = String(zIndex2[key]);
|
|
989
|
+
}
|
|
990
|
+
return result;
|
|
991
|
+
}
|
|
992
|
+
function opacityToCssVars(opacity2) {
|
|
993
|
+
if (!opacity2) return {};
|
|
994
|
+
const result = {};
|
|
995
|
+
for (const key in opacity2) {
|
|
996
|
+
result[`--opacity-${escapeKey(key)}`] = String(opacity2[key]);
|
|
997
|
+
}
|
|
998
|
+
return result;
|
|
999
|
+
}
|
|
1000
|
+
function animationToCssVars(animations2) {
|
|
1001
|
+
if (!animations2) return {};
|
|
1002
|
+
const result = {};
|
|
1003
|
+
for (const key in animations2) {
|
|
1004
|
+
result[`--animate-${escapeKey(key)}`] = animations2[key];
|
|
1005
|
+
}
|
|
1006
|
+
return result;
|
|
1007
|
+
}
|
|
1008
|
+
function keyframesToCss(keyframes2) {
|
|
1009
|
+
if (!keyframes2) return "";
|
|
1010
|
+
let css = "";
|
|
1011
|
+
for (const name in keyframes2) {
|
|
1012
|
+
const frames = keyframes2[name];
|
|
1013
|
+
css += `@keyframes ${name} {
|
|
1014
|
+
`;
|
|
1015
|
+
for (const step in frames) {
|
|
1016
|
+
css += ` ${step} {`;
|
|
1017
|
+
const props = frames[step];
|
|
1018
|
+
for (const prop in props) {
|
|
1019
|
+
css += ` ${prop}: ${props[prop]};`;
|
|
1020
|
+
}
|
|
1021
|
+
css += " }\n";
|
|
1022
|
+
}
|
|
1023
|
+
css += "}\n";
|
|
1024
|
+
}
|
|
1025
|
+
return css;
|
|
1026
|
+
}
|
|
1027
|
+
function transitionTimingFunctionToCssVars(transition) {
|
|
1028
|
+
const result = {};
|
|
1029
|
+
for (const key in transition) {
|
|
1030
|
+
if (key === "DEFAULT") {
|
|
1031
|
+
result[`--default-transition-timing-function`] = transition[key];
|
|
1032
|
+
} else {
|
|
1033
|
+
result[`--transition-timing-function-${escapeKey(key)}`] = transition[key];
|
|
1034
|
+
if (key !== "linear") result[`--ease-${escapeKey(key)}`] = transition[key];
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
return result;
|
|
1038
|
+
}
|
|
1039
|
+
function transitionDurationToCssVars(transitionDuration2) {
|
|
1040
|
+
const result = {};
|
|
1041
|
+
for (const key in transitionDuration2) {
|
|
1042
|
+
if (key === "DEFAULT") {
|
|
1043
|
+
result[`--default-transition-duration`] = transitionDuration2[key];
|
|
1044
|
+
} else {
|
|
1045
|
+
result[`--transition-duration-${escapeKey(key)}`] = transitionDuration2[key];
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
return result;
|
|
1049
|
+
}
|
|
1050
|
+
function transitionDelayToCssVars(transitionDelay2) {
|
|
1051
|
+
const result = {};
|
|
1052
|
+
for (const key in transitionDelay2) {
|
|
1053
|
+
if (key === "DEFAULT") {
|
|
1054
|
+
result[`--default-transition-delay`] = transitionDelay2[key];
|
|
1055
|
+
} else {
|
|
1056
|
+
result[`--transition-delay-${escapeKey(key)}`] = transitionDelay2[key];
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
return result;
|
|
1060
|
+
}
|
|
1061
|
+
function blurToCssVars(blur2) {
|
|
1062
|
+
const result = {};
|
|
1063
|
+
for (const key in blur2) {
|
|
1064
|
+
if (key === "DEFAULT") {
|
|
1065
|
+
result[`--default-blur`] = blur2[key];
|
|
1066
|
+
} else {
|
|
1067
|
+
result[`--blur-${escapeKey(key)}`] = blur2[key];
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
return result;
|
|
1071
|
+
}
|
|
1072
|
+
function containerToCssVars(container2) {
|
|
1073
|
+
const result = {};
|
|
1074
|
+
for (const key in container2) {
|
|
1075
|
+
result[`--container-${escapeKey(key)}`] = container2[key];
|
|
1076
|
+
}
|
|
1077
|
+
return result;
|
|
1078
|
+
}
|
|
1079
|
+
function themeToCssVarsAll(theme) {
|
|
1080
|
+
return {
|
|
1081
|
+
...colorsToCssVars(theme.colors),
|
|
1082
|
+
...boxShadowToCssVars(theme.boxShadow),
|
|
1083
|
+
...fontSizeToCssVars(theme.fontSize),
|
|
1084
|
+
...fontWeightToCssVars(theme.fontWeight),
|
|
1085
|
+
...fontFamilyToCssVars(theme.fontFamily),
|
|
1086
|
+
...letterSpacingToCssVars(theme.letterSpacing),
|
|
1087
|
+
"--spacing": theme.spacing["1"],
|
|
1088
|
+
...spacingToCssVars(theme.spacing),
|
|
1089
|
+
...containerToCssVars(theme.container),
|
|
1090
|
+
...borderRadiusToCssVars(theme.borderRadius),
|
|
1091
|
+
...zIndexToCssVars(theme.zIndex),
|
|
1092
|
+
...opacityToCssVars(theme.opacity),
|
|
1093
|
+
...animationToCssVars(theme.animations),
|
|
1094
|
+
...transitionTimingFunctionToCssVars(theme.transitionTimingFunction),
|
|
1095
|
+
...transitionDurationToCssVars(theme.transitionDuration),
|
|
1096
|
+
...transitionDelayToCssVars(theme.transitionDelay),
|
|
1097
|
+
...blurToCssVars(theme.blur),
|
|
1098
|
+
...Object.fromEntries(Object.entries(theme.aspect ?? {}).map(([k, v2]) => [`--aspect-${escapeKey(k)}`, v2]))
|
|
1099
|
+
// keyframes handled separately
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
function toCssVarsBlock(vars, extra = "") {
|
|
1103
|
+
return ":root,:host {\n" + Object.entries(vars).map(([k, v2]) => ` ${k}: ${v2};`).join("\n") + "\n}\n" + extra + "\n";
|
|
1104
|
+
}
|
|
1105
|
+
const BARO_VAR = /--baro-/g;
|
|
1106
|
+
const PREFIXED_KEYS = /* @__PURE__ */ new Set(["prop", "value", "params", "selector", "nodes", "items"]);
|
|
1107
|
+
function applyVarPrefix(ast, ctx) {
|
|
1108
|
+
const configured = ctx?.config("cssVarPrefix");
|
|
1109
|
+
if (typeof configured !== "string" || !configured.trim()) return ast;
|
|
1110
|
+
const prefix = normalizePrefix(configured);
|
|
1111
|
+
if (prefix === "--baro-") return ast;
|
|
1112
|
+
const walk = (node) => {
|
|
1113
|
+
if (typeof node === "string") return node.includes("--baro-") ? node.replace(BARO_VAR, prefix) : node;
|
|
1114
|
+
if (Array.isArray(node)) return node.map(walk);
|
|
1115
|
+
if (!node || typeof node !== "object") return node;
|
|
1116
|
+
const out = {};
|
|
1117
|
+
for (const [k, val] of Object.entries(node)) out[k] = PREFIXED_KEYS.has(k) ? walk(val) : val;
|
|
1118
|
+
return out;
|
|
1119
|
+
};
|
|
1120
|
+
return walk(ast);
|
|
1121
|
+
}
|
|
725
1122
|
const failureCache = /* @__PURE__ */ new Set();
|
|
726
1123
|
function collectDeclPaths(nodes = [], path = []) {
|
|
727
1124
|
let result = [];
|
|
@@ -877,8 +1274,8 @@ function extractAtRootNodes(nodes, parent, atRootNodes = []) {
|
|
|
877
1274
|
if (node.type === "at-root") {
|
|
878
1275
|
atRootNodes.push(node);
|
|
879
1276
|
delete nodes[i];
|
|
880
|
-
} else if (node.type === "rule" || node.type === "style-rule") {
|
|
881
|
-
extractAtRootNodes(node.nodes, node, atRootNodes);
|
|
1277
|
+
} else if (node.type === "rule" || node.type === "style-rule" || node.type === "at-rule") {
|
|
1278
|
+
extractAtRootNodes(node.nodes ?? [], node, atRootNodes);
|
|
882
1279
|
}
|
|
883
1280
|
}
|
|
884
1281
|
if (parent) {
|
|
@@ -897,33 +1294,40 @@ function parseClassToAst(fullClassName, ctx) {
|
|
|
897
1294
|
}
|
|
898
1295
|
const { modifiers, utility } = parseClassName(fullClassName, ctx);
|
|
899
1296
|
if (!utility) {
|
|
900
|
-
|
|
1297
|
+
debugWarn(`[BAROCSS] Invalid class name format: "${fullClassName}"`);
|
|
901
1298
|
failures.add(fullClassName);
|
|
902
1299
|
return [];
|
|
903
1300
|
}
|
|
904
|
-
const
|
|
1301
|
+
const utilRegs = utility.property ? [arbitraryPropertyRegistration] : getUtility(ctx).filter((u) => {
|
|
905
1302
|
const fullClassName2 = utility.value ? `${utility.prefix}-${utility.value}` : utility.prefix;
|
|
906
1303
|
return u.match(fullClassName2);
|
|
907
1304
|
});
|
|
908
|
-
if (
|
|
1305
|
+
if (utilRegs.length === 0) {
|
|
909
1306
|
const utilityName = utility.value ? `${utility.prefix}-${utility.value}` : utility.prefix;
|
|
910
|
-
|
|
1307
|
+
debugWarn(`[BAROCSS] Unknown utility class: "${utilityName}" in "${fullClassName}"`);
|
|
911
1308
|
failures.add(fullClassName);
|
|
912
1309
|
return [];
|
|
913
1310
|
}
|
|
914
1311
|
let value = utility.value;
|
|
915
1312
|
if (utility.negative && value) value = "-" + value;
|
|
916
|
-
let ast =
|
|
1313
|
+
let ast = [];
|
|
1314
|
+
for (const utilReg of utilRegs) {
|
|
1315
|
+
ast = utilReg.handler(value, ctx, utility, utilReg) || [];
|
|
1316
|
+
if (ast.length > 0) break;
|
|
1317
|
+
}
|
|
917
1318
|
const wrappers = [];
|
|
918
1319
|
const selector = "&";
|
|
919
1320
|
for (let i = 0; i < modifiers.length; i++) {
|
|
920
1321
|
const variant = modifiers[i];
|
|
921
1322
|
const plugin = getModifier(ctx).find((p) => p.match(variant.type, ctx));
|
|
922
1323
|
if (!plugin) {
|
|
923
|
-
|
|
1324
|
+
debugWarn(`[BAROCSS] Unknown variant: "${variant.type}" in "${fullClassName}"`);
|
|
924
1325
|
failures.add(fullClassName);
|
|
925
1326
|
return [];
|
|
926
1327
|
}
|
|
1328
|
+
if (plugin.astHandler) {
|
|
1329
|
+
ast = plugin.astHandler(ast, variant, ctx, modifiers, i);
|
|
1330
|
+
}
|
|
927
1331
|
if (plugin.wrap) {
|
|
928
1332
|
const items = plugin.wrap(variant, ctx);
|
|
929
1333
|
wrappers.push({
|
|
@@ -1000,7 +1404,7 @@ function parseClassToAst(fullClassName, ctx) {
|
|
|
1000
1404
|
}
|
|
1001
1405
|
const atRootNodes = [];
|
|
1002
1406
|
extractAtRootNodes(ast, void 0, atRootNodes);
|
|
1003
|
-
ast = [...atRootNodes, ...ast].filter(Boolean);
|
|
1407
|
+
ast = applyVarPrefix([...atRootNodes, ...ast].filter(Boolean), ctx);
|
|
1004
1408
|
cache.set(fullClassName, ast);
|
|
1005
1409
|
return ast;
|
|
1006
1410
|
}
|
|
@@ -1142,7 +1546,7 @@ class IncrementalParser {
|
|
|
1142
1546
|
}
|
|
1143
1547
|
const ast = parseClassToAst(className, this.ctx);
|
|
1144
1548
|
if (ast.length === 0) {
|
|
1145
|
-
|
|
1549
|
+
debugWarn("[IncrementalParser] ast is empty", className);
|
|
1146
1550
|
return null;
|
|
1147
1551
|
}
|
|
1148
1552
|
const rules = generateCssRules(className, this.ctx, { dedup: false });
|
|
@@ -1163,7 +1567,7 @@ class IncrementalParser {
|
|
|
1163
1567
|
rootCssList: rule2.rootCssList
|
|
1164
1568
|
};
|
|
1165
1569
|
} catch (error) {
|
|
1166
|
-
|
|
1570
|
+
debugWarn("[IncrementalParser] Failed to process class:", className, error);
|
|
1167
1571
|
return null;
|
|
1168
1572
|
}
|
|
1169
1573
|
}
|
|
@@ -1662,13 +2066,15 @@ const spacing = {
|
|
|
1662
2066
|
};
|
|
1663
2067
|
const borderRadius = {
|
|
1664
2068
|
none: "0px",
|
|
1665
|
-
|
|
2069
|
+
xs: "0.125rem",
|
|
2070
|
+
sm: "0.25rem",
|
|
1666
2071
|
DEFAULT: "0.25rem",
|
|
1667
2072
|
md: "0.375rem",
|
|
1668
2073
|
lg: "0.5rem",
|
|
1669
2074
|
xl: "0.75rem",
|
|
1670
2075
|
"2xl": "1rem",
|
|
1671
2076
|
"3xl": "1.5rem",
|
|
2077
|
+
"4xl": "2rem",
|
|
1672
2078
|
full: "9999px"
|
|
1673
2079
|
};
|
|
1674
2080
|
const fontSize = {
|
|
@@ -1745,11 +2151,13 @@ const lineHeight = {
|
|
|
1745
2151
|
12: "3rem"
|
|
1746
2152
|
};
|
|
1747
2153
|
const boxShadow = {
|
|
1748
|
-
|
|
2154
|
+
"2xs": "0 1px rgb(0 0 0 / 0.05)",
|
|
2155
|
+
xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
2156
|
+
sm: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
|
1749
2157
|
DEFAULT: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px 0 rgb(0 0 0 / 0.06)",
|
|
1750
|
-
md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -
|
|
1751
|
-
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -
|
|
1752
|
-
xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0
|
|
2158
|
+
md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
2159
|
+
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
2160
|
+
xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
|
|
1753
2161
|
"2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)",
|
|
1754
2162
|
inner: "inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",
|
|
1755
2163
|
none: "none"
|
|
@@ -1892,15 +2300,14 @@ const letterSpacing = {
|
|
|
1892
2300
|
widest: "0.1em"
|
|
1893
2301
|
};
|
|
1894
2302
|
const blur = {
|
|
1895
|
-
DEFAULT: "
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
"
|
|
1902
|
-
"
|
|
1903
|
-
"5xl": "48px"
|
|
2303
|
+
DEFAULT: "8px",
|
|
2304
|
+
xs: "4px",
|
|
2305
|
+
sm: "8px",
|
|
2306
|
+
md: "12px",
|
|
2307
|
+
lg: "16px",
|
|
2308
|
+
xl: "24px",
|
|
2309
|
+
"2xl": "40px",
|
|
2310
|
+
"3xl": "64px"
|
|
1904
2311
|
};
|
|
1905
2312
|
const defaultTheme = {
|
|
1906
2313
|
colors,
|
|
@@ -1923,214 +2330,10 @@ const defaultTheme = {
|
|
|
1923
2330
|
animations,
|
|
1924
2331
|
keyframes,
|
|
1925
2332
|
animationVars,
|
|
1926
|
-
blur
|
|
2333
|
+
blur,
|
|
2334
|
+
// Tailwind 4.1.13 --aspect-* (aspect-video → var(--aspect-video))
|
|
2335
|
+
aspect: { video: "16 / 9" }
|
|
1927
2336
|
};
|
|
1928
|
-
function escapeKey(key) {
|
|
1929
|
-
return key.replace(".", "\\.");
|
|
1930
|
-
}
|
|
1931
|
-
function colorsToCssVars(colors2) {
|
|
1932
|
-
if (!colors2) return {};
|
|
1933
|
-
const result = {};
|
|
1934
|
-
function walk(obj, prefix = []) {
|
|
1935
|
-
for (const key in obj) {
|
|
1936
|
-
const value = obj[key];
|
|
1937
|
-
if (typeof value === "object" && value !== null) {
|
|
1938
|
-
walk(value, [...prefix, key]);
|
|
1939
|
-
} else {
|
|
1940
|
-
const varName2 = "--color-" + [...prefix, key].join("-");
|
|
1941
|
-
result[varName2] = value;
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
}
|
|
1945
|
-
walk(colors2);
|
|
1946
|
-
return result;
|
|
1947
|
-
}
|
|
1948
|
-
function boxShadowToCssVars(boxShadow2) {
|
|
1949
|
-
if (!boxShadow2) return {};
|
|
1950
|
-
const result = {};
|
|
1951
|
-
for (const key in boxShadow2) {
|
|
1952
|
-
result[`--shadow-${key}`] = boxShadow2[key];
|
|
1953
|
-
}
|
|
1954
|
-
return result;
|
|
1955
|
-
}
|
|
1956
|
-
function fontSizeToCssVars(fontSize2) {
|
|
1957
|
-
if (!fontSize2) return {};
|
|
1958
|
-
const result = {};
|
|
1959
|
-
for (const key in fontSize2) {
|
|
1960
|
-
const value = fontSize2[key];
|
|
1961
|
-
if (Array.isArray(value)) {
|
|
1962
|
-
result[`--text-${key}`] = value[0];
|
|
1963
|
-
if (value[1]) result[`--text-${key}--line-height`] = value[1];
|
|
1964
|
-
} else {
|
|
1965
|
-
result[`--text-${key}`] = value;
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
|
-
return result;
|
|
1969
|
-
}
|
|
1970
|
-
function fontWeightToCssVars(fontWeight2) {
|
|
1971
|
-
if (!fontWeight2) return {};
|
|
1972
|
-
const result = {};
|
|
1973
|
-
for (const key in fontWeight2) {
|
|
1974
|
-
result[`--font-weight-${key}`] = fontWeight2[key];
|
|
1975
|
-
}
|
|
1976
|
-
return result;
|
|
1977
|
-
}
|
|
1978
|
-
function fontFamilyToCssVars(fontFamily2) {
|
|
1979
|
-
if (!fontFamily2) return {};
|
|
1980
|
-
const result = {};
|
|
1981
|
-
for (const key in fontFamily2) {
|
|
1982
|
-
const value = fontFamily2[key];
|
|
1983
|
-
if (Array.isArray(value)) {
|
|
1984
|
-
result[`--font-${key}`] = value.join(", ");
|
|
1985
|
-
} else {
|
|
1986
|
-
result[`--font-${key}`] = value;
|
|
1987
|
-
}
|
|
1988
|
-
}
|
|
1989
|
-
return result;
|
|
1990
|
-
}
|
|
1991
|
-
function letterSpacingToCssVars(letterSpacing2) {
|
|
1992
|
-
if (!letterSpacing2) return {};
|
|
1993
|
-
const result = {};
|
|
1994
|
-
for (const key in letterSpacing2) {
|
|
1995
|
-
result[`--letter-spacing-${key}`] = letterSpacing2[key];
|
|
1996
|
-
}
|
|
1997
|
-
return result;
|
|
1998
|
-
}
|
|
1999
|
-
function spacingToCssVars(spacing2) {
|
|
2000
|
-
if (!spacing2) return {};
|
|
2001
|
-
const result = {};
|
|
2002
|
-
for (const key in spacing2) {
|
|
2003
|
-
result[`--spacing-${escapeKey(key)}`] = spacing2[key];
|
|
2004
|
-
}
|
|
2005
|
-
return result;
|
|
2006
|
-
}
|
|
2007
|
-
function borderRadiusToCssVars(borderRadius2) {
|
|
2008
|
-
if (!borderRadius2) return {};
|
|
2009
|
-
const result = {};
|
|
2010
|
-
for (const key in borderRadius2) {
|
|
2011
|
-
result[`--radius-${escapeKey(key)}`] = borderRadius2[key];
|
|
2012
|
-
}
|
|
2013
|
-
return result;
|
|
2014
|
-
}
|
|
2015
|
-
function zIndexToCssVars(zIndex2) {
|
|
2016
|
-
if (!zIndex2) return {};
|
|
2017
|
-
const result = {};
|
|
2018
|
-
for (const key in zIndex2) {
|
|
2019
|
-
result[`--z-${escapeKey(key)}`] = String(zIndex2[key]);
|
|
2020
|
-
}
|
|
2021
|
-
return result;
|
|
2022
|
-
}
|
|
2023
|
-
function opacityToCssVars(opacity2) {
|
|
2024
|
-
if (!opacity2) return {};
|
|
2025
|
-
const result = {};
|
|
2026
|
-
for (const key in opacity2) {
|
|
2027
|
-
result[`--opacity-${escapeKey(key)}`] = String(opacity2[key]);
|
|
2028
|
-
}
|
|
2029
|
-
return result;
|
|
2030
|
-
}
|
|
2031
|
-
function animationToCssVars(animations2) {
|
|
2032
|
-
if (!animations2) return {};
|
|
2033
|
-
const result = {};
|
|
2034
|
-
for (const key in animations2) {
|
|
2035
|
-
result[`--animate-${escapeKey(key)}`] = animations2[key];
|
|
2036
|
-
}
|
|
2037
|
-
return result;
|
|
2038
|
-
}
|
|
2039
|
-
function keyframesToCss(keyframes2) {
|
|
2040
|
-
if (!keyframes2) return "";
|
|
2041
|
-
let css = "";
|
|
2042
|
-
for (const name in keyframes2) {
|
|
2043
|
-
const frames = keyframes2[name];
|
|
2044
|
-
css += `@keyframes ${name} {
|
|
2045
|
-
`;
|
|
2046
|
-
for (const step in frames) {
|
|
2047
|
-
css += ` ${step} {`;
|
|
2048
|
-
const props = frames[step];
|
|
2049
|
-
for (const prop in props) {
|
|
2050
|
-
css += ` ${prop}: ${props[prop]};`;
|
|
2051
|
-
}
|
|
2052
|
-
css += " }\n";
|
|
2053
|
-
}
|
|
2054
|
-
css += "}\n";
|
|
2055
|
-
}
|
|
2056
|
-
return css;
|
|
2057
|
-
}
|
|
2058
|
-
function transitionTimingFunctionToCssVars(transition) {
|
|
2059
|
-
const result = {};
|
|
2060
|
-
for (const key in transition) {
|
|
2061
|
-
if (key === "DEFAULT") {
|
|
2062
|
-
result[`--default-transition-timing-function`] = transition[key];
|
|
2063
|
-
} else {
|
|
2064
|
-
result[`--transition-timing-function-${escapeKey(key)}`] = transition[key];
|
|
2065
|
-
}
|
|
2066
|
-
}
|
|
2067
|
-
return result;
|
|
2068
|
-
}
|
|
2069
|
-
function transitionDurationToCssVars(transitionDuration2) {
|
|
2070
|
-
const result = {};
|
|
2071
|
-
for (const key in transitionDuration2) {
|
|
2072
|
-
if (key === "DEFAULT") {
|
|
2073
|
-
result[`--default-transition-duration`] = transitionDuration2[key];
|
|
2074
|
-
} else {
|
|
2075
|
-
result[`--transition-duration-${escapeKey(key)}`] = transitionDuration2[key];
|
|
2076
|
-
}
|
|
2077
|
-
}
|
|
2078
|
-
return result;
|
|
2079
|
-
}
|
|
2080
|
-
function transitionDelayToCssVars(transitionDelay2) {
|
|
2081
|
-
const result = {};
|
|
2082
|
-
for (const key in transitionDelay2) {
|
|
2083
|
-
if (key === "DEFAULT") {
|
|
2084
|
-
result[`--default-transition-delay`] = transitionDelay2[key];
|
|
2085
|
-
} else {
|
|
2086
|
-
result[`--transition-delay-${escapeKey(key)}`] = transitionDelay2[key];
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
return result;
|
|
2090
|
-
}
|
|
2091
|
-
function blurToCssVars(blur2) {
|
|
2092
|
-
const result = {};
|
|
2093
|
-
for (const key in blur2) {
|
|
2094
|
-
if (key === "DEFAULT") {
|
|
2095
|
-
result[`--default-blur`] = blur2[key];
|
|
2096
|
-
} else {
|
|
2097
|
-
result[`--blur-${escapeKey(key)}`] = blur2[key];
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
return result;
|
|
2101
|
-
}
|
|
2102
|
-
function containerToCssVars(container2) {
|
|
2103
|
-
const result = {};
|
|
2104
|
-
for (const key in container2) {
|
|
2105
|
-
result[`--container-${escapeKey(key)}`] = container2[key];
|
|
2106
|
-
}
|
|
2107
|
-
return result;
|
|
2108
|
-
}
|
|
2109
|
-
function themeToCssVarsAll(theme) {
|
|
2110
|
-
return {
|
|
2111
|
-
...colorsToCssVars(theme.colors),
|
|
2112
|
-
...boxShadowToCssVars(theme.boxShadow),
|
|
2113
|
-
...fontSizeToCssVars(theme.fontSize),
|
|
2114
|
-
...fontWeightToCssVars(theme.fontWeight),
|
|
2115
|
-
...fontFamilyToCssVars(theme.fontFamily),
|
|
2116
|
-
...letterSpacingToCssVars(theme.letterSpacing),
|
|
2117
|
-
"--spacing": theme.spacing["1"],
|
|
2118
|
-
...spacingToCssVars(theme.spacing),
|
|
2119
|
-
...containerToCssVars(theme.container),
|
|
2120
|
-
...borderRadiusToCssVars(theme.borderRadius),
|
|
2121
|
-
...zIndexToCssVars(theme.zIndex),
|
|
2122
|
-
...opacityToCssVars(theme.opacity),
|
|
2123
|
-
...animationToCssVars(theme.animations),
|
|
2124
|
-
...transitionTimingFunctionToCssVars(theme.transitionTimingFunction),
|
|
2125
|
-
...transitionDurationToCssVars(theme.transitionDuration),
|
|
2126
|
-
...transitionDelayToCssVars(theme.transitionDelay),
|
|
2127
|
-
...blurToCssVars(theme.blur)
|
|
2128
|
-
// keyframes handled separately
|
|
2129
|
-
};
|
|
2130
|
-
}
|
|
2131
|
-
function toCssVarsBlock(vars, extra = "") {
|
|
2132
|
-
return ":root,:host {\n" + Object.entries(vars).map(([k, v2]) => ` ${k}: ${v2};`).join("\n") + "\n}\n" + extra + "\n";
|
|
2133
|
-
}
|
|
2134
2337
|
const preflightMinimalCSS = `
|
|
2135
2338
|
/* BaroCSS Preflight - Minimal Reset */
|
|
2136
2339
|
/* ================================= */
|
|
@@ -2261,6 +2464,10 @@ select {
|
|
|
2261
2464
|
html {
|
|
2262
2465
|
line-height: 1.15;
|
|
2263
2466
|
-webkit-text-size-adjust: 100%;
|
|
2467
|
+
/* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
|
|
2468
|
+
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'));
|
|
2469
|
+
font-feature-settings: var(--default-font-feature-settings, normal);
|
|
2470
|
+
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
2264
2471
|
}
|
|
2265
2472
|
|
|
2266
2473
|
/* Remove the gray background on active links in IE 10 */
|
|
@@ -2405,26 +2612,80 @@ textarea {
|
|
|
2405
2612
|
-webkit-appearance: none;
|
|
2406
2613
|
}
|
|
2407
2614
|
|
|
2408
|
-
/* Remove the default vertical scrollbar in IE */
|
|
2409
|
-
textarea {
|
|
2410
|
-
overflow: auto;
|
|
2615
|
+
/* Remove the default vertical scrollbar in IE */
|
|
2616
|
+
textarea {
|
|
2617
|
+
overflow: auto;
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
/* Correct the cursor style of increment and decrement buttons in Chrome */
|
|
2621
|
+
[type="number"]::-webkit-inner-spin-button,
|
|
2622
|
+
[type="number"]::-webkit-outer-spin-button {
|
|
2623
|
+
height: auto;
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
/* Remove the inner padding in Chrome and Safari on macOS */
|
|
2627
|
+
[type="search"] {
|
|
2628
|
+
-webkit-appearance: textfield;
|
|
2629
|
+
outline-offset: -2px;
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
/* Remove the inner padding in Chrome and Safari on macOS */
|
|
2633
|
+
[type="search"]::-webkit-search-decoration {
|
|
2634
|
+
-webkit-appearance: none;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
/* Tailwind 4.1.13 monospace stack for code-like elements */
|
|
2638
|
+
code,
|
|
2639
|
+
kbd,
|
|
2640
|
+
samp,
|
|
2641
|
+
pre {
|
|
2642
|
+
font-family: var(--default-mono-font-family, var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace));
|
|
2643
|
+
font-feature-settings: var(--default-mono-font-feature-settings, normal);
|
|
2644
|
+
font-variation-settings: var(--default-mono-font-variation-settings, normal);
|
|
2645
|
+
font-size: 1em;
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
/* Tailwind 4.1.13 form-control reset: inherit typography and colour, drop native radius/background (#228) */
|
|
2649
|
+
button,
|
|
2650
|
+
input,
|
|
2651
|
+
select,
|
|
2652
|
+
optgroup,
|
|
2653
|
+
textarea,
|
|
2654
|
+
::file-selector-button {
|
|
2655
|
+
font: inherit;
|
|
2656
|
+
font-feature-settings: inherit;
|
|
2657
|
+
font-variation-settings: inherit;
|
|
2658
|
+
letter-spacing: inherit;
|
|
2659
|
+
color: inherit;
|
|
2660
|
+
border-radius: 0;
|
|
2661
|
+
background-color: transparent;
|
|
2662
|
+
opacity: 1;
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
:where(select:is([multiple], [size])) optgroup {
|
|
2666
|
+
font-weight: bolder;
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2669
|
+
:where(select:is([multiple], [size])) optgroup option {
|
|
2670
|
+
padding-inline-start: 20px;
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
::file-selector-button {
|
|
2674
|
+
margin-inline-end: 4px;
|
|
2411
2675
|
}
|
|
2412
2676
|
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
[type="number"]::-webkit-outer-spin-button {
|
|
2416
|
-
height: auto;
|
|
2677
|
+
::placeholder {
|
|
2678
|
+
opacity: 1;
|
|
2417
2679
|
}
|
|
2418
2680
|
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2681
|
+
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
|
|
2682
|
+
::placeholder {
|
|
2683
|
+
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
2684
|
+
}
|
|
2423
2685
|
}
|
|
2424
2686
|
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
-webkit-appearance: none;
|
|
2687
|
+
textarea {
|
|
2688
|
+
resize: vertical;
|
|
2428
2689
|
}
|
|
2429
2690
|
`;
|
|
2430
2691
|
const preflightFullCSS = `
|
|
@@ -2438,10 +2699,14 @@ const preflightFullCSS = `
|
|
|
2438
2699
|
box-sizing: border-box;
|
|
2439
2700
|
}
|
|
2440
2701
|
|
|
2441
|
-
/* Remove default margin and padding
|
|
2702
|
+
/* Remove default margin and padding; reset border to Tailwind v4's universal
|
|
2703
|
+
\`border: 0 solid\` so a bare border/border-t (width set by the utility, style
|
|
2704
|
+
otherwise \`none\`) renders. Width 0 keeps borders invisible until a utility
|
|
2705
|
+
sets one. */
|
|
2442
2706
|
* {
|
|
2443
2707
|
margin: 0;
|
|
2444
2708
|
padding: 0;
|
|
2709
|
+
border: 0 solid;
|
|
2445
2710
|
}
|
|
2446
2711
|
|
|
2447
2712
|
/* Set core body defaults */
|
|
@@ -2502,6 +2767,10 @@ html {
|
|
|
2502
2767
|
line-height: 1.15;
|
|
2503
2768
|
-webkit-text-size-adjust: 100%;
|
|
2504
2769
|
-ms-text-size-adjust: 100%;
|
|
2770
|
+
/* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
|
|
2771
|
+
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'));
|
|
2772
|
+
font-feature-settings: var(--default-font-feature-settings, normal);
|
|
2773
|
+
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
2505
2774
|
}
|
|
2506
2775
|
|
|
2507
2776
|
/* Remove the gray background on active links in IE 10 */
|
|
@@ -2687,7 +2956,9 @@ code,
|
|
|
2687
2956
|
kbd,
|
|
2688
2957
|
pre,
|
|
2689
2958
|
samp {
|
|
2690
|
-
font-family: monospace, monospace;
|
|
2959
|
+
font-family: var(--default-mono-font-family, var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace));
|
|
2960
|
+
font-feature-settings: var(--default-mono-font-feature-settings, normal);
|
|
2961
|
+
font-variation-settings: var(--default-mono-font-variation-settings, normal);
|
|
2691
2962
|
font-size: 1em;
|
|
2692
2963
|
}
|
|
2693
2964
|
|
|
@@ -2789,6 +3060,49 @@ template {
|
|
|
2789
3060
|
page-break-after: avoid;
|
|
2790
3061
|
}
|
|
2791
3062
|
}
|
|
3063
|
+
|
|
3064
|
+
/* Tailwind 4.1.13 form-control reset: inherit typography and colour, drop native radius/background (#228) */
|
|
3065
|
+
button,
|
|
3066
|
+
input,
|
|
3067
|
+
select,
|
|
3068
|
+
optgroup,
|
|
3069
|
+
textarea,
|
|
3070
|
+
::file-selector-button {
|
|
3071
|
+
font: inherit;
|
|
3072
|
+
font-feature-settings: inherit;
|
|
3073
|
+
font-variation-settings: inherit;
|
|
3074
|
+
letter-spacing: inherit;
|
|
3075
|
+
color: inherit;
|
|
3076
|
+
border-radius: 0;
|
|
3077
|
+
background-color: transparent;
|
|
3078
|
+
opacity: 1;
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
:where(select:is([multiple], [size])) optgroup {
|
|
3082
|
+
font-weight: bolder;
|
|
3083
|
+
}
|
|
3084
|
+
|
|
3085
|
+
:where(select:is([multiple], [size])) optgroup option {
|
|
3086
|
+
padding-inline-start: 20px;
|
|
3087
|
+
}
|
|
3088
|
+
|
|
3089
|
+
::file-selector-button {
|
|
3090
|
+
margin-inline-end: 4px;
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3093
|
+
::placeholder {
|
|
3094
|
+
opacity: 1;
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3097
|
+
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
|
|
3098
|
+
::placeholder {
|
|
3099
|
+
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
3100
|
+
}
|
|
3101
|
+
}
|
|
3102
|
+
|
|
3103
|
+
textarea {
|
|
3104
|
+
resize: vertical;
|
|
3105
|
+
}
|
|
2792
3106
|
`;
|
|
2793
3107
|
function getPreflightCSS(level = true) {
|
|
2794
3108
|
if (level === "minimal") {
|
|
@@ -2908,6 +3222,7 @@ ${keyframesToCss(theme.keyframes || {})}
|
|
|
2908
3222
|
return result;
|
|
2909
3223
|
}
|
|
2910
3224
|
function createContext(configObj) {
|
|
3225
|
+
if (configObj.debug !== void 0) setDebug(!!configObj.debug);
|
|
2911
3226
|
const configWithDefaults = {
|
|
2912
3227
|
presets: [
|
|
2913
3228
|
{ theme: defaultTheme },
|
|
@@ -3192,6 +3507,30 @@ function parseColor(input) {
|
|
|
3192
3507
|
}
|
|
3193
3508
|
return null;
|
|
3194
3509
|
}
|
|
3510
|
+
const COLOR_KEYWORDS = /* @__PURE__ */ new Set(["inherit", "currentcolor", "transparent"]);
|
|
3511
|
+
function themeColorDecls(prop, value, extra) {
|
|
3512
|
+
const key = String(extra.realThemeValue);
|
|
3513
|
+
const ref = COLOR_KEYWORDS.has(value.toLowerCase()) || value.startsWith("var(") || !/^[\w-]+$/.test(key) ? value : `var(--color-${key})`;
|
|
3514
|
+
if (!extra.opacity) return [decl(prop, ref)];
|
|
3515
|
+
const alpha = normalizeAlpha(String(extra.opacity));
|
|
3516
|
+
const supports = (amount) => atRule("supports", "(color:color-mix(in lab, red, red))", [decl(prop, `color-mix(in oklab, ${ref} ${amount}, transparent)`)]);
|
|
3517
|
+
if (alpha.isVar) return [decl(prop, value), supports(alpha.amount)];
|
|
3518
|
+
return [decl(prop, `color-mix(in srgb, ${value} ${alpha.amount}, transparent)`), supports(alpha.amount)];
|
|
3519
|
+
}
|
|
3520
|
+
function normalizeAlpha(raw) {
|
|
3521
|
+
let v = raw.trim();
|
|
3522
|
+
const bracketed = v.startsWith("[") && v.endsWith("]");
|
|
3523
|
+
if (bracketed) v = v.slice(1, -1).trim();
|
|
3524
|
+
if (v.startsWith("(") && v.endsWith(")")) v = `var(${v.slice(1, -1).trim()})`;
|
|
3525
|
+
if (v.startsWith("var(")) return { amount: v, isVar: true };
|
|
3526
|
+
if (v.endsWith("%")) return { amount: v, isVar: false };
|
|
3527
|
+
const n = Number(v);
|
|
3528
|
+
if (v !== "" && Number.isFinite(n)) {
|
|
3529
|
+
const pct = bracketed && n <= 1 ? n * 100 : n;
|
|
3530
|
+
return { amount: `${+pct.toFixed(4)}%`, isVar: false };
|
|
3531
|
+
}
|
|
3532
|
+
return { amount: v, isVar: false };
|
|
3533
|
+
}
|
|
3195
3534
|
staticUtility("accent-inherit", [["accent-color", "inherit"]], { category: "interactivity" });
|
|
3196
3535
|
staticUtility("accent-current", [["accent-color", "currentColor"]], { category: "interactivity" });
|
|
3197
3536
|
staticUtility("accent-transparent", [["accent-color", "transparent"]], { category: "interactivity" });
|
|
@@ -3394,10 +3733,10 @@ staticUtility("touch-pan-up", [["touch-action", "pan-up"]], { category: "interac
|
|
|
3394
3733
|
staticUtility("touch-pan-down", [["touch-action", "pan-down"]], { category: "interactivity" });
|
|
3395
3734
|
staticUtility("touch-pinch-zoom", [["touch-action", "pinch-zoom"]], { category: "interactivity" });
|
|
3396
3735
|
staticUtility("touch-manipulation", [["touch-action", "manipulation"]], { category: "interactivity" });
|
|
3397
|
-
staticUtility("select-none", [["user-select", "none"]], { category: "interactivity" });
|
|
3398
|
-
staticUtility("select-text", [["user-select", "text"]], { category: "interactivity" });
|
|
3399
|
-
staticUtility("select-all", [["user-select", "all"]], { category: "interactivity" });
|
|
3400
|
-
staticUtility("select-auto", [["user-select", "auto"]], { category: "interactivity" });
|
|
3736
|
+
staticUtility("select-none", [["-webkit-user-select", "none"], ["user-select", "none"]], { category: "interactivity" });
|
|
3737
|
+
staticUtility("select-text", [["-webkit-user-select", "text"], ["user-select", "text"]], { category: "interactivity" });
|
|
3738
|
+
staticUtility("select-all", [["-webkit-user-select", "all"], ["user-select", "all"]], { category: "interactivity" });
|
|
3739
|
+
staticUtility("select-auto", [["-webkit-user-select", "auto"], ["user-select", "auto"]], { category: "interactivity" });
|
|
3401
3740
|
staticUtility("will-change-auto", [["will-change", "auto"]], { category: "interactivity" });
|
|
3402
3741
|
staticUtility("will-change-scroll", [["will-change", "scroll-position"]], { category: "interactivity" });
|
|
3403
3742
|
staticUtility("will-change-contents", [["will-change", "contents"]], { category: "interactivity" });
|
|
@@ -3415,7 +3754,7 @@ const defaultDuration = "var(--default-transition-duration)";
|
|
|
3415
3754
|
staticUtility("transition", [
|
|
3416
3755
|
[
|
|
3417
3756
|
"transition-property",
|
|
3418
|
-
"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"
|
|
3757
|
+
"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"
|
|
3419
3758
|
],
|
|
3420
3759
|
["transition-timing-function", defaultTiming],
|
|
3421
3760
|
["transition-duration", defaultDuration]
|
|
@@ -3428,7 +3767,7 @@ staticUtility("transition-all", [
|
|
|
3428
3767
|
staticUtility("transition-colors", [
|
|
3429
3768
|
[
|
|
3430
3769
|
"transition-property",
|
|
3431
|
-
"color, background-color, border-color, text-decoration-color, fill, stroke, --baro-gradient-from, --baro-gradient-via, --baro-gradient-to"
|
|
3770
|
+
"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --baro-gradient-from, --baro-gradient-via, --baro-gradient-to"
|
|
3432
3771
|
],
|
|
3433
3772
|
["transition-timing-function", defaultTiming],
|
|
3434
3773
|
["transition-duration", defaultDuration]
|
|
@@ -3618,6 +3957,7 @@ const filters$1 = () => {
|
|
|
3618
3957
|
filters$1()
|
|
3619
3958
|
], { category: "effects" });
|
|
3620
3959
|
});
|
|
3960
|
+
staticUtility("blur", [decl("--baro-blur", "blur(8px)"), filters$1()], { category: "effects" });
|
|
3621
3961
|
staticUtility("blur-none", [decl("--baro-blur", ""), filters$1()], { category: "effects" });
|
|
3622
3962
|
functionalUtility({
|
|
3623
3963
|
name: "blur",
|
|
@@ -3856,6 +4196,7 @@ functionalUtility({
|
|
|
3856
4196
|
{ category: "effects" }
|
|
3857
4197
|
);
|
|
3858
4198
|
});
|
|
4199
|
+
staticUtility("backdrop-blur", [decl("--baro-backdrop-blur", "blur(8px)"), ...filters()], { category: "effects" });
|
|
3859
4200
|
staticUtility(
|
|
3860
4201
|
"backdrop-blur-none",
|
|
3861
4202
|
[decl("--baro-backdrop-blur", ""), ...filters()],
|
|
@@ -4084,56 +4425,52 @@ functionalUtility({
|
|
|
4084
4425
|
description: "sepia filter utility (static, number, arbitrary, custom property supported)",
|
|
4085
4426
|
category: "effects"
|
|
4086
4427
|
});
|
|
4428
|
+
const SHADOW_COMPOSITE = "var(--baro-inset-shadow), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow), var(--baro-ring-shadow), var(--baro-shadow)";
|
|
4429
|
+
const ringShadowProperties = () => atRoot([
|
|
4430
|
+
property("--baro-shadow", "0 0 #0000"),
|
|
4431
|
+
property("--baro-inset-shadow", "0 0 #0000"),
|
|
4432
|
+
property("--baro-inset-ring-shadow", "0 0 #0000"),
|
|
4433
|
+
property("--baro-ring-offset-shadow", "0 0 #0000"),
|
|
4434
|
+
property("--baro-ring-shadow", "0 0 #0000"),
|
|
4435
|
+
property("--baro-ring-offset-width", "0px", "<length>"),
|
|
4436
|
+
property("--baro-ring-offset-color", "#fff")
|
|
4437
|
+
]);
|
|
4438
|
+
const shadowLayer = (value) => [
|
|
4439
|
+
ringShadowProperties(),
|
|
4440
|
+
decl("--baro-shadow", value),
|
|
4441
|
+
decl("box-shadow", SHADOW_COMPOSITE)
|
|
4442
|
+
];
|
|
4087
4443
|
[
|
|
4088
4444
|
["shadow-2xs", "var(--shadow-2xs)"],
|
|
4089
4445
|
["shadow-xs", "var(--shadow-xs)"],
|
|
4090
4446
|
["shadow-sm", "var(--shadow-sm)"],
|
|
4091
|
-
["shadow", "
|
|
4447
|
+
["shadow", "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)"],
|
|
4092
4448
|
["shadow-md", "var(--shadow-md)"],
|
|
4093
4449
|
["shadow-lg", "var(--shadow-lg)"],
|
|
4094
4450
|
["shadow-xl", "var(--shadow-xl)"],
|
|
4095
4451
|
["shadow-2xl", "var(--shadow-2xl)"],
|
|
4096
4452
|
["shadow-none", "0 0 #0000"]
|
|
4097
4453
|
].forEach(([name, value]) => {
|
|
4098
|
-
staticUtility(name, [
|
|
4454
|
+
staticUtility(name, [
|
|
4455
|
+
ringShadowProperties,
|
|
4456
|
+
["--baro-shadow", value],
|
|
4457
|
+
["box-shadow", SHADOW_COMPOSITE]
|
|
4458
|
+
], { category: "effects" });
|
|
4099
4459
|
});
|
|
4100
4460
|
[
|
|
4101
|
-
[
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
],
|
|
4105
|
-
[
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
],
|
|
4109
|
-
[
|
|
4110
|
-
"inset-shadow-sm",
|
|
4111
|
-
"inset 0 2px 4px var(--baro-inset-shadow-color, #0000000d)"
|
|
4112
|
-
],
|
|
4113
|
-
[
|
|
4114
|
-
"inset-shadow-md",
|
|
4115
|
-
"inset 0 4px 6px -1px var(--baro-inset-shadow-color, #0000000d)"
|
|
4116
|
-
],
|
|
4117
|
-
[
|
|
4118
|
-
"inset-shadow-lg",
|
|
4119
|
-
"inset 0 10px 15px -3px var(--baro-inset-shadow-color, #0000000d)"
|
|
4120
|
-
],
|
|
4121
|
-
[
|
|
4122
|
-
"inset-shadow-xl",
|
|
4123
|
-
"inset 0 20px 25px -5px var(--baro-inset-shadow-color, #0000000d)"
|
|
4124
|
-
],
|
|
4125
|
-
[
|
|
4126
|
-
"inset-shadow-2xl",
|
|
4127
|
-
"inset 0 25px 50px -12px var(--baro-inset-shadow-color, #0000000d)"
|
|
4128
|
-
],
|
|
4461
|
+
["inset-shadow-2xs", "inset 0 1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4462
|
+
["inset-shadow-xs", "inset 0 1px 1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4463
|
+
["inset-shadow-sm", "inset 0 2px 4px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4464
|
+
["inset-shadow-md", "inset 0 4px 6px -1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4465
|
+
["inset-shadow-lg", "inset 0 10px 15px -3px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4466
|
+
["inset-shadow-xl", "inset 0 20px 25px -5px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4467
|
+
["inset-shadow-2xl", "inset 0 25px 50px -12px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
|
|
4129
4468
|
["inset-shadow-none", "0 0 #0000"]
|
|
4130
4469
|
].forEach(([name, value]) => {
|
|
4131
4470
|
staticUtility(name, [
|
|
4471
|
+
ringShadowProperties,
|
|
4132
4472
|
["--baro-inset-shadow", value],
|
|
4133
|
-
[
|
|
4134
|
-
"box-shadow",
|
|
4135
|
-
"var(--baro-inset-shadow), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow), var(--baro-ring-shadow), var(--baro-shadow)"
|
|
4136
|
-
]
|
|
4473
|
+
["box-shadow", SHADOW_COMPOSITE]
|
|
4137
4474
|
], { category: "effects" });
|
|
4138
4475
|
});
|
|
4139
4476
|
function createShadowThemeColor(key, main, opacity2, realThemeValue) {
|
|
@@ -4198,9 +4535,9 @@ functionalUtility({
|
|
|
4198
4535
|
)
|
|
4199
4536
|
];
|
|
4200
4537
|
}
|
|
4201
|
-
return [decl("
|
|
4538
|
+
return [decl("--baro-shadow-color", main)];
|
|
4202
4539
|
}
|
|
4203
|
-
return
|
|
4540
|
+
return shadowLayer(main);
|
|
4204
4541
|
}
|
|
4205
4542
|
if (main === "inherit" || main === "current" || main === "transparent") {
|
|
4206
4543
|
return [
|
|
@@ -4209,7 +4546,7 @@ functionalUtility({
|
|
|
4209
4546
|
}
|
|
4210
4547
|
return null;
|
|
4211
4548
|
},
|
|
4212
|
-
handleCustomProperty: (value) =>
|
|
4549
|
+
handleCustomProperty: (value) => shadowLayer(`var(${value})`)
|
|
4213
4550
|
});
|
|
4214
4551
|
functionalUtility({
|
|
4215
4552
|
name: "inset-shadow",
|
|
@@ -4268,22 +4605,39 @@ functionalUtility({
|
|
|
4268
4605
|
["ring-8", "8px"]
|
|
4269
4606
|
].forEach(([name, px]) => {
|
|
4270
4607
|
staticUtility(name, [
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
// default blue-500/50
|
|
4608
|
+
ringShadowProperties,
|
|
4609
|
+
// Like Tailwind, ring-N does not set the offset vars (they come from @property defaults and ring-offset-*),
|
|
4610
|
+
// so `ring-N ring-offset-M` composes the same in either rule order.
|
|
4611
|
+
// No hardcoded ring color: Tailwind v4's default ring color is currentColor (via the var() fallback below).
|
|
4276
4612
|
[
|
|
4277
4613
|
"--baro-ring-shadow",
|
|
4278
|
-
|
|
4614
|
+
ringShadowValue(px)
|
|
4279
4615
|
],
|
|
4280
|
-
["--baro-ring-offset-shadow", `0 0 #0000`],
|
|
4281
4616
|
[
|
|
4282
4617
|
"box-shadow",
|
|
4283
4618
|
"var(--baro-inset-shadow), var(--baro-inset-ring-shadow), var(--baro-ring-offset-shadow), var(--baro-ring-shadow), var(--baro-shadow)"
|
|
4284
4619
|
]
|
|
4285
4620
|
]);
|
|
4286
4621
|
});
|
|
4622
|
+
function ringShadowValue(width) {
|
|
4623
|
+
return `var(--baro-ring-inset,) 0 0 0 calc(${width} + var(--baro-ring-offset-width)) var(--baro-ring-color, currentcolor)`;
|
|
4624
|
+
}
|
|
4625
|
+
[
|
|
4626
|
+
["ring-offset-0", "0px"],
|
|
4627
|
+
["ring-offset-1", "1px"],
|
|
4628
|
+
["ring-offset-2", "2px"],
|
|
4629
|
+
["ring-offset-4", "4px"],
|
|
4630
|
+
["ring-offset-8", "8px"]
|
|
4631
|
+
].forEach(([name, px]) => {
|
|
4632
|
+
staticUtility(name, [
|
|
4633
|
+
["--baro-ring-offset-width", px],
|
|
4634
|
+
["--baro-ring-offset-color", "#fff"],
|
|
4635
|
+
[
|
|
4636
|
+
"--baro-ring-offset-shadow",
|
|
4637
|
+
`var(--baro-ring-inset,) 0 0 0 var(--baro-ring-offset-width) var(--baro-ring-offset-color)`
|
|
4638
|
+
]
|
|
4639
|
+
], { category: "effects" });
|
|
4640
|
+
});
|
|
4287
4641
|
[
|
|
4288
4642
|
["inset-ring", "1px"],
|
|
4289
4643
|
["inset-ring-0", "0px"],
|
|
@@ -4293,20 +4647,11 @@ functionalUtility({
|
|
|
4293
4647
|
["inset-ring-8", "8px"]
|
|
4294
4648
|
].forEach(([name, px]) => {
|
|
4295
4649
|
staticUtility(name, [
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
["--baro-ring-
|
|
4299
|
-
["
|
|
4300
|
-
|
|
4301
|
-
"--baro-inset-ring-shadow",
|
|
4302
|
-
`var(--baro-ring-inset) 0 0 0 calc(${px} + var(--baro-ring-offset-width)) var(--baro-inset-ring-color, currentcolor)`
|
|
4303
|
-
],
|
|
4304
|
-
["--baro-ring-offset-shadow", `0 0 #0000`],
|
|
4305
|
-
[
|
|
4306
|
-
"box-shadow",
|
|
4307
|
-
"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)"
|
|
4308
|
-
]
|
|
4309
|
-
]);
|
|
4650
|
+
// Tailwind 4.1.13: only the inset-ring layer; the colour defaults to currentcolor via the var() fallback.
|
|
4651
|
+
ringShadowProperties,
|
|
4652
|
+
["--baro-inset-ring-shadow", `inset 0 0 0 ${px} var(--baro-inset-ring-color, currentcolor)`],
|
|
4653
|
+
["box-shadow", SHADOW_COMPOSITE]
|
|
4654
|
+
], { category: "effects" });
|
|
4310
4655
|
});
|
|
4311
4656
|
staticUtility("ring-inset", [["--baro-ring-inset", "inset"]], { category: "effects" });
|
|
4312
4657
|
function createRingColorDecls(key, main, opacity2, realThemeValue) {
|
|
@@ -4380,7 +4725,15 @@ functionalUtility({
|
|
|
4380
4725
|
decl("--baro-ring-color", fallback)
|
|
4381
4726
|
];
|
|
4382
4727
|
}
|
|
4383
|
-
|
|
4728
|
+
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)) {
|
|
4729
|
+
const width = main.startsWith("length:") ? main.slice(7) : main;
|
|
4730
|
+
return [
|
|
4731
|
+
ringShadowProperties(),
|
|
4732
|
+
decl("--baro-ring-shadow", ringShadowValue(width)),
|
|
4733
|
+
decl("box-shadow", SHADOW_COMPOSITE)
|
|
4734
|
+
];
|
|
4735
|
+
}
|
|
4736
|
+
return [parseColor(main) ? decl("--baro-ring-color", main) : decl("box-shadow", main)];
|
|
4384
4737
|
}
|
|
4385
4738
|
if (main === "inherit" || main === "current" || main === "transparent") {
|
|
4386
4739
|
return [
|
|
@@ -4622,18 +4975,30 @@ functionalUtility({
|
|
|
4622
4975
|
description: "mask-size utility (static, arbitrary, custom property supported)",
|
|
4623
4976
|
category: "effects"
|
|
4624
4977
|
});
|
|
4978
|
+
const maskProperties = () => atRoot([
|
|
4979
|
+
property("--baro-mask-linear", "linear-gradient(#fff, #fff)"),
|
|
4980
|
+
property("--baro-mask-radial", "linear-gradient(#fff, #fff)"),
|
|
4981
|
+
property("--baro-mask-conic", "linear-gradient(#fff, #fff)"),
|
|
4982
|
+
property("--baro-mask-linear-position", "0deg"),
|
|
4983
|
+
property("--baro-mask-linear-from-position", "0%"),
|
|
4984
|
+
property("--baro-mask-linear-to-position", "100%"),
|
|
4985
|
+
property("--baro-mask-linear-from-color", "black"),
|
|
4986
|
+
property("--baro-mask-linear-to-color", "transparent")
|
|
4987
|
+
]);
|
|
4625
4988
|
functionalUtility({
|
|
4626
4989
|
name: "mask-linear-from",
|
|
4627
4990
|
handleBareValue: ({ value }) => /^(?:100|[1-9]?\d)%$/.test(value) ? value : null,
|
|
4628
4991
|
handle: (value) => [
|
|
4629
|
-
decl("mask-image", "var(--
|
|
4992
|
+
decl("mask-image", "var(--baro-mask-linear), var(--baro-mask-radial), var(--baro-mask-conic)"),
|
|
4630
4993
|
decl("mask-composite", "intersect"),
|
|
4631
|
-
decl("--
|
|
4632
|
-
decl("--
|
|
4633
|
-
decl("--
|
|
4994
|
+
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)"),
|
|
4995
|
+
decl("--baro-mask-linear", "linear-gradient(var(--baro-mask-linear-stops))"),
|
|
4996
|
+
decl("--baro-mask-linear-from-position", value),
|
|
4997
|
+
maskProperties()
|
|
4634
4998
|
],
|
|
4635
4999
|
category: "effects"
|
|
4636
5000
|
});
|
|
5001
|
+
staticUtility("mask-none", [["mask-image", "none"]], { category: "effects" });
|
|
4637
5002
|
functionalUtility({
|
|
4638
5003
|
name: "mask",
|
|
4639
5004
|
supportsArbitrary: true,
|
|
@@ -4669,7 +5034,7 @@ functionalUtility({
|
|
|
4669
5034
|
category: "layout"
|
|
4670
5035
|
});
|
|
4671
5036
|
staticUtility("aspect-square", [["aspect-ratio", "1 / 1"]], { category: "layout" });
|
|
4672
|
-
staticUtility("aspect-video", [["aspect-ratio", "var(--aspect-
|
|
5037
|
+
staticUtility("aspect-video", [["aspect-ratio", "var(--aspect-video)"]], { category: "layout" });
|
|
4673
5038
|
staticUtility("aspect-auto", [["aspect-ratio", "auto"]], { category: "layout" });
|
|
4674
5039
|
functionalUtility({
|
|
4675
5040
|
name: "aspect",
|
|
@@ -4753,10 +5118,10 @@ staticUtility("sr-only", [
|
|
|
4753
5118
|
["position", "absolute"],
|
|
4754
5119
|
["width", "1px"],
|
|
4755
5120
|
["height", "1px"],
|
|
4756
|
-
["margin", "-1px"],
|
|
4757
5121
|
["padding", "0"],
|
|
5122
|
+
["margin", "-1px"],
|
|
4758
5123
|
["overflow", "hidden"],
|
|
4759
|
-
["clip", "
|
|
5124
|
+
["clip-path", "inset(50%)"],
|
|
4760
5125
|
["white-space", "nowrap"],
|
|
4761
5126
|
["border-width", "0"]
|
|
4762
5127
|
], { category: "layout" });
|
|
@@ -4764,12 +5129,39 @@ staticUtility("not-sr-only", [
|
|
|
4764
5129
|
["position", "static"],
|
|
4765
5130
|
["width", "auto"],
|
|
4766
5131
|
["height", "auto"],
|
|
4767
|
-
["margin", "0"],
|
|
4768
5132
|
["padding", "0"],
|
|
5133
|
+
["margin", "0"],
|
|
4769
5134
|
["overflow", "visible"],
|
|
4770
|
-
["clip", "
|
|
5135
|
+
["clip-path", "none"],
|
|
4771
5136
|
["white-space", "normal"]
|
|
4772
5137
|
], { category: "layout" });
|
|
5138
|
+
staticUtility("@container", [["container-type", "inline-size"]], { category: "layout" });
|
|
5139
|
+
staticUtility("@container-normal", [["container-type", "normal"]], { category: "layout" });
|
|
5140
|
+
registerUtility({
|
|
5141
|
+
name: "@container",
|
|
5142
|
+
match: (className) => /^@container\/[a-zA-Z0-9_-]+$/.test(className),
|
|
5143
|
+
handler: (_value, _ctx, token) => {
|
|
5144
|
+
const name = /^@container\/([a-zA-Z0-9_-]+)$/.exec(`${token.prefix}${token.value ? `-${token.value}` : ""}`)?.[1];
|
|
5145
|
+
return name ? [decl("container-type", "inline-size"), decl("container-name", name)] : null;
|
|
5146
|
+
},
|
|
5147
|
+
category: "layout"
|
|
5148
|
+
});
|
|
5149
|
+
const toRem = (v) => {
|
|
5150
|
+
const m = /^(-?\d*\.?\d+)(rem|px|em)$/.exec(v.trim());
|
|
5151
|
+
if (!m) return Number.NaN;
|
|
5152
|
+
return m[2] === "px" ? Number(m[1]) / 16 : Number(m[1]);
|
|
5153
|
+
};
|
|
5154
|
+
registerUtility({
|
|
5155
|
+
name: "container",
|
|
5156
|
+
match: (className) => className === "container",
|
|
5157
|
+
handler: (_value, ctx) => {
|
|
5158
|
+
const bps = ctx.theme("breakpoints") || ctx.config("theme.breakpoints") || {};
|
|
5159
|
+
const values = Object.values(bps).filter((v) => typeof v === "string" && !Number.isNaN(toRem(v)));
|
|
5160
|
+
values.sort((a, b) => toRem(a) - toRem(b));
|
|
5161
|
+
return [decl("width", "100%"), ...values.map((v) => atRule("media", `(width >= ${v})`, [decl("max-width", v)]))];
|
|
5162
|
+
},
|
|
5163
|
+
category: "layout"
|
|
5164
|
+
});
|
|
4773
5165
|
staticUtility("float-right", [["float", "right"]], { category: "layout" });
|
|
4774
5166
|
staticUtility("float-left", [["float", "left"]], { category: "layout" });
|
|
4775
5167
|
staticUtility("float-start", [["float", "inline-start"]], { category: "layout" });
|
|
@@ -4885,7 +5277,7 @@ functionalUtility({
|
|
|
4885
5277
|
// gap-x-[10vw]
|
|
4886
5278
|
supportsCustomProperty: true,
|
|
4887
5279
|
// gap-x-(--my-gap-x)
|
|
4888
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5280
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4889
5281
|
handle: (value) => {
|
|
4890
5282
|
if (typeof value === "string") return [decl("column-gap", value)];
|
|
4891
5283
|
return null;
|
|
@@ -4901,7 +5293,7 @@ functionalUtility({
|
|
|
4901
5293
|
// gap-y-[10vw]
|
|
4902
5294
|
supportsCustomProperty: true,
|
|
4903
5295
|
// gap-y-(--my-gap-y)
|
|
4904
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5296
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4905
5297
|
handle: (value) => {
|
|
4906
5298
|
if (typeof value === "string") return [decl("row-gap", value)];
|
|
4907
5299
|
return null;
|
|
@@ -4917,7 +5309,7 @@ functionalUtility({
|
|
|
4917
5309
|
// gap-[10vw]
|
|
4918
5310
|
supportsCustomProperty: true,
|
|
4919
5311
|
// gap-(--my-gap)
|
|
4920
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5312
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
4921
5313
|
handle: (value) => {
|
|
4922
5314
|
if (typeof value === "string") return [decl("gap", value)];
|
|
4923
5315
|
return null;
|
|
@@ -4976,6 +5368,31 @@ staticUtility("flex-nowrap", [["flex-wrap", "nowrap"]], { category: "flex-grid"
|
|
|
4976
5368
|
staticUtility("flex-auto", [["flex", "1 1 auto"]], { category: "flex-grid" });
|
|
4977
5369
|
staticUtility("flex-initial", [["flex", "0 1 auto"]], { category: "flex-grid" });
|
|
4978
5370
|
staticUtility("flex-none", [["flex", "none"]], { category: "flex-grid" });
|
|
5371
|
+
staticUtility("flex-grow", [["flex-grow", "1"]], { category: "flex-grid" });
|
|
5372
|
+
functionalUtility({
|
|
5373
|
+
name: "flex-grow",
|
|
5374
|
+
prop: "flex-grow",
|
|
5375
|
+
supportsArbitrary: true,
|
|
5376
|
+
// grow-[25vw], grow-[2], grow-[var(--factor)], etc.
|
|
5377
|
+
supportsCustomProperty: true,
|
|
5378
|
+
// grow-(--my-grow)
|
|
5379
|
+
handleBareValue: ({ value }) => parseNumber(value),
|
|
5380
|
+
handle: (value) => [decl("flex-grow", value)],
|
|
5381
|
+
description: "flex-grow utility (number, arbitrary, custom property supported)",
|
|
5382
|
+
category: "flex-grid"
|
|
5383
|
+
});
|
|
5384
|
+
staticUtility("flex-shrink", [["flex-shrink", "1"]], { category: "flex-grid" });
|
|
5385
|
+
functionalUtility({
|
|
5386
|
+
name: "flex-shrink",
|
|
5387
|
+
prop: "flex-shrink",
|
|
5388
|
+
supportsArbitrary: true,
|
|
5389
|
+
// shrink-[2], shrink-[calc(100vw-var(--sidebar))], etc.
|
|
5390
|
+
supportsCustomProperty: true,
|
|
5391
|
+
// shrink-(--my-shrink)
|
|
5392
|
+
handleBareValue: ({ value }) => parseNumber(value),
|
|
5393
|
+
description: "flex-shrink utility (number, arbitrary, custom property supported)",
|
|
5394
|
+
category: "flex-grid"
|
|
5395
|
+
});
|
|
4979
5396
|
functionalUtility({
|
|
4980
5397
|
name: "flex",
|
|
4981
5398
|
supportsArbitrary: true,
|
|
@@ -5209,7 +5626,7 @@ functionalUtility({
|
|
|
5209
5626
|
// gap-x-[10vw]
|
|
5210
5627
|
supportsCustomProperty: true,
|
|
5211
5628
|
// gap-x-(--my-gap-x)
|
|
5212
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5629
|
+
handleBareValue: ({ value }) => value === "px" ? "1px" : parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5213
5630
|
handle: (value) => {
|
|
5214
5631
|
if (typeof value === "string") return [decl("column-gap", value)];
|
|
5215
5632
|
return null;
|
|
@@ -5225,7 +5642,7 @@ functionalUtility({
|
|
|
5225
5642
|
// gap-y-[10vw]
|
|
5226
5643
|
supportsCustomProperty: true,
|
|
5227
5644
|
// gap-y-(--my-gap-y)
|
|
5228
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5645
|
+
handleBareValue: ({ value }) => value === "px" ? "1px" : parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5229
5646
|
handle: (value) => {
|
|
5230
5647
|
if (typeof value === "string") return [decl("row-gap", value)];
|
|
5231
5648
|
return null;
|
|
@@ -5241,7 +5658,7 @@ functionalUtility({
|
|
|
5241
5658
|
// gap-[10vw]
|
|
5242
5659
|
supportsCustomProperty: true,
|
|
5243
5660
|
// gap-(--my-gap)
|
|
5244
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5661
|
+
handleBareValue: ({ value }) => value === "px" ? "1px" : parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5245
5662
|
handle: (value) => {
|
|
5246
5663
|
if (typeof value === "string") return [decl("gap", value)];
|
|
5247
5664
|
return null;
|
|
@@ -5269,11 +5686,11 @@ staticUtility("justify-items-center-safe", [["justify-items", "safe center"]], {
|
|
|
5269
5686
|
staticUtility("justify-items-stretch", [["justify-items", "stretch"]], { category: "flex-grid" });
|
|
5270
5687
|
staticUtility("justify-items-normal", [["justify-items", "normal"]], { category: "flex-grid" });
|
|
5271
5688
|
staticUtility("justify-self-auto", [["justify-self", "auto"]], { category: "flex-grid" });
|
|
5272
|
-
staticUtility("justify-self-start", [["justify-self", "start"]], { category: "flex-grid" });
|
|
5689
|
+
staticUtility("justify-self-start", [["justify-self", "flex-start"]], { category: "flex-grid" });
|
|
5273
5690
|
staticUtility("justify-self-center", [["justify-self", "center"]], { category: "flex-grid" });
|
|
5274
5691
|
staticUtility("justify-self-center-safe", [["justify-self", "safe center"]], { category: "flex-grid" });
|
|
5275
|
-
staticUtility("justify-self-end", [["justify-self", "end"]], { category: "flex-grid" });
|
|
5276
|
-
staticUtility("justify-self-end-safe", [["justify-self", "safe end"]], { category: "flex-grid" });
|
|
5692
|
+
staticUtility("justify-self-end", [["justify-self", "flex-end"]], { category: "flex-grid" });
|
|
5693
|
+
staticUtility("justify-self-end-safe", [["justify-self", "safe flex-end"]], { category: "flex-grid" });
|
|
5277
5694
|
staticUtility("justify-self-stretch", [["justify-self", "stretch"]], { category: "flex-grid" });
|
|
5278
5695
|
staticUtility("content-normal", [["align-content", "normal"]], { category: "flex-grid" });
|
|
5279
5696
|
staticUtility("content-center", [["align-content", "center"]], { category: "flex-grid" });
|
|
@@ -5408,7 +5825,7 @@ functionalUtility({
|
|
|
5408
5825
|
prop,
|
|
5409
5826
|
supportsArbitrary: true,
|
|
5410
5827
|
supportsCustomProperty: true,
|
|
5411
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5828
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5412
5829
|
description: `${name} utility (number, arbitrary, custom property supported)`,
|
|
5413
5830
|
category: "spacing"
|
|
5414
5831
|
});
|
|
@@ -5433,144 +5850,48 @@ functionalUtility({
|
|
|
5433
5850
|
supportsNegative: true,
|
|
5434
5851
|
supportsArbitrary: true,
|
|
5435
5852
|
supportsCustomProperty: true,
|
|
5436
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
5437
|
-
handleNegativeBareValue: ({ value }) => `calc(var(--spacing) * -${value})
|
|
5853
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5854
|
+
handleNegativeBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * -${value})` : null,
|
|
5438
5855
|
description: `${name} margin utility (number, negative, arbitrary, custom property, auto, px supported)`,
|
|
5439
5856
|
category: "spacing"
|
|
5440
5857
|
});
|
|
5441
5858
|
});
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
]
|
|
5454
|
-
], { category: "spacing" });
|
|
5455
|
-
staticUtility(
|
|
5456
|
-
[
|
|
5457
|
-
|
|
5458
|
-
[
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
handle: (value, ctx, token) => {
|
|
5479
|
-
let v = value;
|
|
5480
|
-
if (typeof v === "number" || /^-?\d+(\.\d+)?$/.test(v)) {
|
|
5481
|
-
v = `calc(var(--spacing) * ${token.negative ? "-" : ""}${v})`;
|
|
5482
|
-
}
|
|
5483
|
-
return [
|
|
5484
|
-
rule("& > :not([hidden]) ~ :not([hidden])", [
|
|
5485
|
-
decl("--baro-space-x-reverse", "0"),
|
|
5486
|
-
decl(
|
|
5487
|
-
"margin-inline-start",
|
|
5488
|
-
`calc(${v} * calc(1 - var(--baro-space-x-reverse)))`
|
|
5489
|
-
),
|
|
5490
|
-
decl("margin-inline-end", `calc(${v} * var(--baro-space-x-reverse))`)
|
|
5491
|
-
])
|
|
5492
|
-
];
|
|
5493
|
-
},
|
|
5494
|
-
handleCustomProperty: (value) => [
|
|
5495
|
-
rule("& > :not([hidden]) ~ :not([hidden])", [
|
|
5496
|
-
decl("--baro-space-x-reverse", "0"),
|
|
5497
|
-
decl(
|
|
5498
|
-
"margin-inline-start",
|
|
5499
|
-
`calc(var(${value}) * calc(1 - var(--baro-space-x-reverse)))`
|
|
5500
|
-
),
|
|
5501
|
-
decl(
|
|
5502
|
-
"margin-inline-end",
|
|
5503
|
-
`calc(var(${value}) * var(--baro-space-x-reverse))`
|
|
5504
|
-
)
|
|
5505
|
-
])
|
|
5506
|
-
],
|
|
5507
|
-
description: "space-x utility (number, negative, px, arbitrary, custom property, reverse supported)",
|
|
5508
|
-
category: "spacing"
|
|
5509
|
-
});
|
|
5510
|
-
staticUtility("space-y-px", [
|
|
5511
|
-
[
|
|
5512
|
-
"& > :not([hidden]) ~ :not([hidden])",
|
|
5513
|
-
[
|
|
5514
|
-
["--baro-space-y-reverse", "0"],
|
|
5515
|
-
["margin-block-start", "calc(1px * calc(1 - var(--baro-space-y-reverse)))"],
|
|
5516
|
-
["margin-block-end", "calc(1px * var(--baro-space-y-reverse))"]
|
|
5517
|
-
]
|
|
5518
|
-
]
|
|
5519
|
-
], { category: "spacing" });
|
|
5520
|
-
staticUtility("-space-y-px", [
|
|
5521
|
-
[
|
|
5522
|
-
"& > :not([hidden]) ~ :not([hidden])",
|
|
5523
|
-
[
|
|
5524
|
-
["--baro-space-y-reverse", "0"],
|
|
5525
|
-
[
|
|
5526
|
-
"margin-block-start",
|
|
5527
|
-
"calc(-1px * calc(1 - var(--baro-space-y-reverse)))"
|
|
5528
|
-
],
|
|
5529
|
-
["margin-block-end", "calc(-1px * var(--baro-space-y-reverse))"]
|
|
5530
|
-
]
|
|
5531
|
-
]
|
|
5532
|
-
], { category: "spacing" });
|
|
5533
|
-
staticUtility("space-y-reverse", [
|
|
5534
|
-
["& > :not([hidden]) ~ :not([hidden])", [["--baro-space-y-reverse", "1"]]]
|
|
5535
|
-
], { category: "spacing" });
|
|
5536
|
-
functionalUtility({
|
|
5537
|
-
name: "space-y",
|
|
5538
|
-
supportsNegative: true,
|
|
5539
|
-
supportsArbitrary: true,
|
|
5540
|
-
supportsCustomProperty: true,
|
|
5541
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})`,
|
|
5542
|
-
handleNegativeBareValue: ({ value }) => `calc(var(--spacing) * -${value})`,
|
|
5543
|
-
handle: (value, ctx, token) => {
|
|
5544
|
-
let v = value;
|
|
5545
|
-
if (typeof v === "number" || /^-?\d+(\.\d+)?$/.test(v)) {
|
|
5546
|
-
v = `calc(var(--spacing) * ${token.negative ? "-" : ""}${v})`;
|
|
5547
|
-
}
|
|
5548
|
-
return [
|
|
5549
|
-
rule("& > :not([hidden]) ~ :not([hidden])", [
|
|
5550
|
-
decl("--baro-space-y-reverse", "0"),
|
|
5551
|
-
decl(
|
|
5552
|
-
"margin-block-start",
|
|
5553
|
-
`calc(${v} * calc(1 - var(--baro-space-y-reverse)))`
|
|
5554
|
-
),
|
|
5555
|
-
decl("margin-block-end", `calc(${v} * var(--baro-space-y-reverse))`)
|
|
5556
|
-
])
|
|
5557
|
-
];
|
|
5558
|
-
},
|
|
5559
|
-
handleCustomProperty: (value) => [
|
|
5560
|
-
rule("& > :not([hidden]) ~ :not([hidden])", [
|
|
5561
|
-
decl("--baro-space-y-reverse", "0"),
|
|
5562
|
-
decl(
|
|
5563
|
-
"margin-block-start",
|
|
5564
|
-
`calc(var(${value}) * calc(1 - var(--baro-space-y-reverse)))`
|
|
5565
|
-
),
|
|
5566
|
-
decl(
|
|
5567
|
-
"margin-block-end",
|
|
5568
|
-
`calc(var(${value}) * var(--baro-space-y-reverse))`
|
|
5569
|
-
)
|
|
5570
|
-
])
|
|
5571
|
-
],
|
|
5572
|
-
description: "space-y utility (number, negative, px, arbitrary, custom property, reverse supported)",
|
|
5573
|
-
category: "spacing"
|
|
5859
|
+
const SPACE_SELECTOR = ":where(& > :not(:last-child))";
|
|
5860
|
+
["x", "y"].forEach((axis) => {
|
|
5861
|
+
const name = `space-${axis}`;
|
|
5862
|
+
const rev = `--baro-space-${axis}-reverse`;
|
|
5863
|
+
const [start, end] = axis === "x" ? ["margin-inline-start", "margin-inline-end"] : ["margin-block-start", "margin-block-end"];
|
|
5864
|
+
const reverseProperty = () => atRoot([property(rev, "0")]);
|
|
5865
|
+
const spaceRule = (v) => rule(SPACE_SELECTOR, [
|
|
5866
|
+
decl(rev, "0"),
|
|
5867
|
+
decl(start, `calc(${v} * var(${rev}))`),
|
|
5868
|
+
decl(end, `calc(${v} * calc(1 - var(${rev})))`)
|
|
5869
|
+
]);
|
|
5870
|
+
const body = (v) => [reverseProperty(), spaceRule(v)];
|
|
5871
|
+
staticUtility(`${name}-px`, [reverseProperty, () => spaceRule("1px")], { category: "spacing" });
|
|
5872
|
+
staticUtility(`-${name}-px`, [reverseProperty, () => spaceRule("-1px")], { category: "spacing" });
|
|
5873
|
+
staticUtility(`${name}-reverse`, [
|
|
5874
|
+
reverseProperty,
|
|
5875
|
+
() => rule(SPACE_SELECTOR, [decl(rev, "1")])
|
|
5876
|
+
], { category: "spacing" });
|
|
5877
|
+
functionalUtility({
|
|
5878
|
+
name,
|
|
5879
|
+
supportsNegative: true,
|
|
5880
|
+
supportsArbitrary: true,
|
|
5881
|
+
supportsCustomProperty: true,
|
|
5882
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5883
|
+
handleNegativeBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * -${value})` : null,
|
|
5884
|
+
handle: (value, _ctx, token) => {
|
|
5885
|
+
let v = String(value);
|
|
5886
|
+
if (/^-?\d+(\.\d+)?$/.test(v)) {
|
|
5887
|
+
v = `calc(var(--spacing) * ${token.negative ? "-" : ""}${v})`;
|
|
5888
|
+
}
|
|
5889
|
+
return body(v);
|
|
5890
|
+
},
|
|
5891
|
+
handleCustomProperty: (value) => body(`var(${value})`),
|
|
5892
|
+
description: `${name} utility (number, negative, px, arbitrary, custom property, reverse supported)`,
|
|
5893
|
+
category: "spacing"
|
|
5894
|
+
});
|
|
5574
5895
|
});
|
|
5575
5896
|
[
|
|
5576
5897
|
["w-auto", "auto"],
|
|
@@ -5797,6 +6118,9 @@ functionalUtility({
|
|
|
5797
6118
|
});
|
|
5798
6119
|
[
|
|
5799
6120
|
["max-w-none", "none"],
|
|
6121
|
+
["max-w-min", "min-content"],
|
|
6122
|
+
["max-w-max", "max-content"],
|
|
6123
|
+
["max-w-fit", "fit-content"],
|
|
5800
6124
|
["max-w-xs", "var(--container-xs)"],
|
|
5801
6125
|
["max-w-sm", "var(--container-sm)"],
|
|
5802
6126
|
["max-w-md", "var(--container-md)"],
|
|
@@ -5827,22 +6151,23 @@ functionalUtility({
|
|
|
5827
6151
|
description: "max-width utility (spacing, fraction, arbitrary, custom property, static supported)",
|
|
5828
6152
|
category: "sizing"
|
|
5829
6153
|
});
|
|
5830
|
-
|
|
5831
|
-
staticUtility("font-
|
|
5832
|
-
staticUtility("font-
|
|
5833
|
-
staticUtility("
|
|
5834
|
-
staticUtility("text-
|
|
5835
|
-
staticUtility("text-
|
|
5836
|
-
staticUtility("text-
|
|
5837
|
-
staticUtility("text-
|
|
5838
|
-
staticUtility("text-
|
|
5839
|
-
staticUtility("text-
|
|
5840
|
-
staticUtility("text-
|
|
5841
|
-
staticUtility("text-
|
|
5842
|
-
staticUtility("text-
|
|
5843
|
-
staticUtility("text-
|
|
5844
|
-
staticUtility("text-
|
|
5845
|
-
staticUtility("text-
|
|
6154
|
+
const leadingProperty = () => atRoot([property("--baro-leading")]);
|
|
6155
|
+
staticUtility("font-sans", [["font-family", "var(--font-sans)"]], { category: "typography" });
|
|
6156
|
+
staticUtility("font-serif", [["font-family", "var(--font-serif)"]], { category: "typography" });
|
|
6157
|
+
staticUtility("font-mono", [["font-family", "var(--font-mono)"]], { category: "typography" });
|
|
6158
|
+
staticUtility("text-xs", [["font-size", "var(--text-xs)"], ["line-height", "var(--baro-leading, var(--text-xs--line-height))"]], { category: "typography" });
|
|
6159
|
+
staticUtility("text-sm", [["font-size", "var(--text-sm)"], ["line-height", "var(--baro-leading, var(--text-sm--line-height))"]], { category: "typography" });
|
|
6160
|
+
staticUtility("text-base", [["font-size", "var(--text-base)"], ["line-height", "var(--baro-leading, var(--text-base--line-height))"]], { category: "typography" });
|
|
6161
|
+
staticUtility("text-lg", [["font-size", "var(--text-lg)"], ["line-height", "var(--baro-leading, var(--text-lg--line-height))"]], { category: "typography" });
|
|
6162
|
+
staticUtility("text-xl", [["font-size", "var(--text-xl)"], ["line-height", "var(--baro-leading, var(--text-xl--line-height))"]], { category: "typography" });
|
|
6163
|
+
staticUtility("text-2xl", [["font-size", "var(--text-2xl)"], ["line-height", "var(--baro-leading, var(--text-2xl--line-height))"]], { category: "typography" });
|
|
6164
|
+
staticUtility("text-3xl", [["font-size", "var(--text-3xl)"], ["line-height", "var(--baro-leading, var(--text-3xl--line-height))"]], { category: "typography" });
|
|
6165
|
+
staticUtility("text-4xl", [["font-size", "var(--text-4xl)"], ["line-height", "var(--baro-leading, var(--text-4xl--line-height))"]], { category: "typography" });
|
|
6166
|
+
staticUtility("text-5xl", [["font-size", "var(--text-5xl)"], ["line-height", "var(--baro-leading, var(--text-5xl--line-height))"]], { category: "typography" });
|
|
6167
|
+
staticUtility("text-6xl", [["font-size", "var(--text-6xl)"], ["line-height", "var(--baro-leading, var(--text-6xl--line-height))"]], { category: "typography" });
|
|
6168
|
+
staticUtility("text-7xl", [["font-size", "var(--text-7xl)"], ["line-height", "var(--baro-leading, var(--text-7xl--line-height))"]], { category: "typography" });
|
|
6169
|
+
staticUtility("text-8xl", [["font-size", "var(--text-8xl)"], ["line-height", "var(--baro-leading, var(--text-8xl--line-height))"]], { category: "typography" });
|
|
6170
|
+
staticUtility("text-9xl", [["font-size", "var(--text-9xl)"], ["line-height", "var(--baro-leading, var(--text-9xl--line-height))"]], { category: "typography" });
|
|
5846
6171
|
staticUtility("font-thin", [["font-weight", "var(--font-weight-thin)"]], { category: "typography" });
|
|
5847
6172
|
staticUtility("font-extralight", [["font-weight", "var(--font-weight-extralight)"]], { category: "typography" });
|
|
5848
6173
|
staticUtility("font-light", [["font-weight", "var(--font-weight-light)"]], { category: "typography" });
|
|
@@ -5888,12 +6213,12 @@ functionalUtility({
|
|
|
5888
6213
|
description: "letter-spacing utility (theme, arbitrary, custom property supported)",
|
|
5889
6214
|
category: "typography"
|
|
5890
6215
|
});
|
|
5891
|
-
staticUtility("leading-none", [["
|
|
5892
|
-
staticUtility("leading-tight", [["
|
|
5893
|
-
staticUtility("leading-snug", [["
|
|
5894
|
-
staticUtility("leading-normal", [["
|
|
5895
|
-
staticUtility("leading-relaxed", [["
|
|
5896
|
-
staticUtility("leading-loose", [["
|
|
6216
|
+
staticUtility("leading-none", [["--baro-leading", "var(--leading-none, 1)"], ["line-height", "var(--leading-none, 1)"], leadingProperty()], { category: "typography" });
|
|
6217
|
+
staticUtility("leading-tight", [["--baro-leading", "var(--leading-tight, 1.25)"], ["line-height", "var(--leading-tight, 1.25)"], leadingProperty()], { category: "typography" });
|
|
6218
|
+
staticUtility("leading-snug", [["--baro-leading", "var(--leading-snug, 1.375)"], ["line-height", "var(--leading-snug, 1.375)"], leadingProperty()], { category: "typography" });
|
|
6219
|
+
staticUtility("leading-normal", [["--baro-leading", "var(--leading-normal, 1.5)"], ["line-height", "var(--leading-normal, 1.5)"], leadingProperty()], { category: "typography" });
|
|
6220
|
+
staticUtility("leading-relaxed", [["--baro-leading", "var(--leading-relaxed, 1.625)"], ["line-height", "var(--leading-relaxed, 1.625)"], leadingProperty()], { category: "typography" });
|
|
6221
|
+
staticUtility("leading-loose", [["--baro-leading", "var(--leading-loose, 2)"], ["line-height", "var(--leading-loose, 2)"], leadingProperty()], { category: "typography" });
|
|
5897
6222
|
functionalUtility({
|
|
5898
6223
|
name: "leading",
|
|
5899
6224
|
prop: "line-height",
|
|
@@ -5901,6 +6226,8 @@ functionalUtility({
|
|
|
5901
6226
|
supportsArbitrary: true,
|
|
5902
6227
|
supportsCustomProperty: true,
|
|
5903
6228
|
handleBareValue: ({ value }) => parseNumber(value),
|
|
6229
|
+
handle: (value) => [decl("--baro-leading", value), decl("line-height", value), leadingProperty()],
|
|
6230
|
+
handleCustomProperty: (value) => [decl("--baro-leading", `var(${value})`), decl("line-height", `var(${value})`), leadingProperty()],
|
|
5904
6231
|
description: "line-height utility (theme, number, arbitrary, custom property supported)",
|
|
5905
6232
|
category: "typography"
|
|
5906
6233
|
});
|
|
@@ -5910,6 +6237,17 @@ staticUtility("text-right", [["text-align", "right"]], { category: "typography"
|
|
|
5910
6237
|
staticUtility("text-justify", [["text-align", "justify"]], { category: "typography" });
|
|
5911
6238
|
staticUtility("text-start", [["text-align", "start"]], { category: "typography" });
|
|
5912
6239
|
staticUtility("text-end", [["text-align", "end"]], { category: "typography" });
|
|
6240
|
+
const FONT_SIZE_HINTS = /* @__PURE__ */ new Set(["length", "size", "percentage", "absolute-size", "relative-size"]);
|
|
6241
|
+
const FONT_SIZE_KEYWORDS = /^(xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large|larger|smaller)$/;
|
|
6242
|
+
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;
|
|
6243
|
+
function textArbitraryKind(raw) {
|
|
6244
|
+
const hint = /^([a-z-]+):(.+)$/.exec(raw);
|
|
6245
|
+
if (hint && (hint[1] === "color" || FONT_SIZE_HINTS.has(hint[1]))) {
|
|
6246
|
+
return { fontSize: hint[1] !== "color", value: hint[2] };
|
|
6247
|
+
}
|
|
6248
|
+
const fontSize2 = raw === "0" || LENGTH_RE.test(raw) || FONT_SIZE_KEYWORDS.test(raw) || /^(calc|min|max|clamp)\(/.test(raw);
|
|
6249
|
+
return { fontSize: fontSize2, value: raw };
|
|
6250
|
+
}
|
|
5913
6251
|
staticUtility("text-inherit", [["color", "inherit"]], { category: "typography" });
|
|
5914
6252
|
staticUtility("text-current", [["color", "currentColor"]], { category: "typography" });
|
|
5915
6253
|
staticUtility("text-transparent", [["color", "transparent"]], { category: "typography" });
|
|
@@ -5923,27 +6261,14 @@ functionalUtility({
|
|
|
5923
6261
|
supportsCustomProperty: true,
|
|
5924
6262
|
supportsOpacity: true,
|
|
5925
6263
|
handle: (value, ctx, token, extra) => {
|
|
5926
|
-
if (extra?.realThemeValue)
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
atRule("supports", `(color:color-mix(in lab, red, red))`, [
|
|
5930
|
-
decl("color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
|
|
5931
|
-
]),
|
|
5932
|
-
decl("color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
|
|
5933
|
-
];
|
|
5934
|
-
}
|
|
5935
|
-
return [decl("color", value)];
|
|
5936
|
-
}
|
|
5937
|
-
if (parseLength(value)) {
|
|
5938
|
-
return [decl("font-size", value)];
|
|
5939
|
-
}
|
|
5940
|
-
return [decl("color", value)];
|
|
6264
|
+
if (extra?.realThemeValue) return themeColorDecls("color", value, extra);
|
|
6265
|
+
const kind = textArbitraryKind(value);
|
|
6266
|
+
return [decl(kind.fontSize ? "font-size" : "color", kind.value)];
|
|
5941
6267
|
},
|
|
6268
|
+
// Tailwind 4: text-(--x) is a colour; text-(length:--x) is a font-size.
|
|
5942
6269
|
handleCustomProperty: (value) => {
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
}
|
|
5946
|
-
return [decl("font-size", `var(${value})`)];
|
|
6270
|
+
const kind = textArbitraryKind(value);
|
|
6271
|
+
return [decl(kind.fontSize ? "font-size" : "color", `var(${kind.value})`)];
|
|
5947
6272
|
},
|
|
5948
6273
|
description: "text color utility (theme, arbitrary, custom property supported)",
|
|
5949
6274
|
category: "typography"
|
|
@@ -5959,7 +6284,7 @@ functionalUtility({
|
|
|
5959
6284
|
if (Array.isArray(themeValue)) {
|
|
5960
6285
|
return [
|
|
5961
6286
|
decl("font-size", themeValue[0]),
|
|
5962
|
-
decl("line-height", themeValue[1])
|
|
6287
|
+
decl("line-height", `var(--baro-leading, ${themeValue[1]})`)
|
|
5963
6288
|
];
|
|
5964
6289
|
} else {
|
|
5965
6290
|
return [decl("font-size", themeValue)];
|
|
@@ -6073,17 +6398,7 @@ functionalUtility({
|
|
|
6073
6398
|
supportsCustomProperty: true,
|
|
6074
6399
|
supportsOpacity: true,
|
|
6075
6400
|
handle: (value, ctx, token, extra) => {
|
|
6076
|
-
if (extra?.realThemeValue)
|
|
6077
|
-
if (extra.opacity) {
|
|
6078
|
-
return [
|
|
6079
|
-
atRule("supports", `(color:color-mix(in lab, red, red))`, [
|
|
6080
|
-
decl("text-decoration-color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
|
|
6081
|
-
]),
|
|
6082
|
-
decl("text-decoration-color", value)
|
|
6083
|
-
];
|
|
6084
|
-
}
|
|
6085
|
-
return [decl("text-decoration-color", value)];
|
|
6086
|
-
}
|
|
6401
|
+
if (extra?.realThemeValue) return themeColorDecls("text-decoration-color", value, extra);
|
|
6087
6402
|
return [decl("text-decoration-color", value)];
|
|
6088
6403
|
},
|
|
6089
6404
|
handleCustomProperty: (value) => [decl("text-decoration-color", `var(${value})`)],
|
|
@@ -6107,7 +6422,7 @@ functionalUtility({
|
|
|
6107
6422
|
prop: "text-decoration-thickness",
|
|
6108
6423
|
supportsArbitrary: true,
|
|
6109
6424
|
supportsCustomProperty: true,
|
|
6110
|
-
handleBareValue: ({ value }) => `${value}px
|
|
6425
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `${value}px` : null,
|
|
6111
6426
|
description: "text-decoration-thickness utility (arbitrary, custom property supported)",
|
|
6112
6427
|
category: "typography"
|
|
6113
6428
|
});
|
|
@@ -6122,7 +6437,7 @@ functionalUtility({
|
|
|
6122
6437
|
prop: "text-underline-offset",
|
|
6123
6438
|
supportsArbitrary: true,
|
|
6124
6439
|
supportsCustomProperty: true,
|
|
6125
|
-
handleBareValue: ({ value }) => `${value}px
|
|
6440
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `${value}px` : null,
|
|
6126
6441
|
description: "text-underline-offset utility (arbitrary, custom property supported)",
|
|
6127
6442
|
category: "typography"
|
|
6128
6443
|
});
|
|
@@ -6136,8 +6451,8 @@ functionalUtility({
|
|
|
6136
6451
|
supportsNegative: true,
|
|
6137
6452
|
supportsArbitrary: true,
|
|
6138
6453
|
supportsCustomProperty: true,
|
|
6139
|
-
handleBareValue: ({ value }) => `calc(var(--spacing) * ${value})
|
|
6140
|
-
handleNegativeBareValue: ({ value }) => `calc(var(--spacing) * -${value})
|
|
6454
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
6455
|
+
handleNegativeBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * -${value})` : null,
|
|
6141
6456
|
description: "text-indent utility (spacing, negative, arbitrary, custom property supported)",
|
|
6142
6457
|
category: "typography"
|
|
6143
6458
|
});
|
|
@@ -6160,14 +6475,14 @@ functionalUtility({
|
|
|
6160
6475
|
staticUtility("hyphens-none", [["hyphens", "none"]], { category: "typography" });
|
|
6161
6476
|
staticUtility("hyphens-manual", [["hyphens", "manual"]], { category: "typography" });
|
|
6162
6477
|
staticUtility("hyphens-auto", [["hyphens", "auto"]], { category: "typography" });
|
|
6163
|
-
staticUtility("content-none", [["content", "none"]], { category: "typography" });
|
|
6478
|
+
staticUtility("content-none", [["--baro-content", "none"], ["content", "none"]], { category: "typography" });
|
|
6164
6479
|
functionalUtility({
|
|
6165
6480
|
name: "content",
|
|
6166
6481
|
prop: "content",
|
|
6167
6482
|
supportsArbitrary: true,
|
|
6168
6483
|
supportsCustomProperty: true,
|
|
6169
|
-
handle: (value) => [decl("content", `"${value}"`)],
|
|
6170
|
-
handleCustomProperty: (value) => [decl("content", `var(${value})`)],
|
|
6484
|
+
handle: (value) => [decl("--baro-content", `"${value}"`), decl("content", "var(--baro-content)")],
|
|
6485
|
+
handleCustomProperty: (value) => [decl("--baro-content", `var(${value})`), decl("content", "var(--baro-content)")],
|
|
6171
6486
|
description: "content utility (arbitrary, custom property supported)",
|
|
6172
6487
|
category: "typography"
|
|
6173
6488
|
});
|
|
@@ -6177,7 +6492,8 @@ const gradientStopProperties = () => {
|
|
|
6177
6492
|
property("--baro-gradient-from", "#0000", "<color>"),
|
|
6178
6493
|
property("--baro-gradient-via", "#0000", "<color>"),
|
|
6179
6494
|
property("--baro-gradient-to", "#0000", "<color>"),
|
|
6180
|
-
property("--baro-gradient-stops"
|
|
6495
|
+
property("--baro-gradient-stops"),
|
|
6496
|
+
property("--baro-gradient-via-stops"),
|
|
6181
6497
|
property("--baro-gradient-from-position", "0%", "<length-percentage>"),
|
|
6182
6498
|
property("--baro-gradient-via-position", "50%", "<length-percentage>"),
|
|
6183
6499
|
property("--baro-gradient-to-position", "100%", "<length-percentage>")
|
|
@@ -6235,18 +6551,17 @@ functionalUtility({
|
|
|
6235
6551
|
description: "background-size utility (arbitrary, custom property supported)",
|
|
6236
6552
|
category: "background"
|
|
6237
6553
|
});
|
|
6238
|
-
const positionValue = (position) =>
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
};
|
|
6554
|
+
const positionValue = (position) => [
|
|
6555
|
+
decl("--baro-gradient-position", position),
|
|
6556
|
+
atRule("supports", "(background-image: linear-gradient(in lab, red, red))", [
|
|
6557
|
+
decl("--baro-gradient-position", `${position} in oklab`)
|
|
6558
|
+
]),
|
|
6559
|
+
decl("background-image", "linear-gradient(var(--baro-gradient-stops))")
|
|
6560
|
+
];
|
|
6561
|
+
const legacyPositionValue = (position) => [
|
|
6562
|
+
decl("--baro-gradient-position", `${position} in oklab`),
|
|
6563
|
+
decl("background-image", "linear-gradient(var(--baro-gradient-stops))")
|
|
6564
|
+
];
|
|
6250
6565
|
[
|
|
6251
6566
|
["bg-linear-to-t", positionValue("to top")],
|
|
6252
6567
|
["bg-linear-to-tr", positionValue("to top right")],
|
|
@@ -6257,14 +6572,14 @@ const positionValue = (position) => {
|
|
|
6257
6572
|
["bg-linear-to-l", positionValue("to left")],
|
|
6258
6573
|
["bg-linear-to-tl", positionValue("to top left")],
|
|
6259
6574
|
// fallback , legacy CSS compatibility
|
|
6260
|
-
["bg-gradient-to-t",
|
|
6261
|
-
["bg-gradient-to-tr",
|
|
6262
|
-
["bg-gradient-to-r",
|
|
6263
|
-
["bg-gradient-to-br",
|
|
6264
|
-
["bg-gradient-to-b",
|
|
6265
|
-
["bg-gradient-to-bl",
|
|
6266
|
-
["bg-gradient-to-l",
|
|
6267
|
-
["bg-gradient-to-tl",
|
|
6575
|
+
["bg-gradient-to-t", legacyPositionValue("to top")],
|
|
6576
|
+
["bg-gradient-to-tr", legacyPositionValue("to top right")],
|
|
6577
|
+
["bg-gradient-to-r", legacyPositionValue("to right")],
|
|
6578
|
+
["bg-gradient-to-br", legacyPositionValue("to bottom right")],
|
|
6579
|
+
["bg-gradient-to-b", legacyPositionValue("to bottom")],
|
|
6580
|
+
["bg-gradient-to-bl", legacyPositionValue("to bottom left")],
|
|
6581
|
+
["bg-gradient-to-l", legacyPositionValue("to left")],
|
|
6582
|
+
["bg-gradient-to-tl", legacyPositionValue("to top left")]
|
|
6268
6583
|
].forEach(([name, value]) => {
|
|
6269
6584
|
staticUtility(name, value, { category: "background", priority: 1e3 });
|
|
6270
6585
|
});
|
|
@@ -6275,12 +6590,7 @@ functionalUtility({
|
|
|
6275
6590
|
supportsCustomProperty: true,
|
|
6276
6591
|
handle: (value, context, token) => {
|
|
6277
6592
|
if (parseNumber(value)) {
|
|
6278
|
-
return
|
|
6279
|
-
decl(
|
|
6280
|
-
"background-image",
|
|
6281
|
-
`linear-gradient(${value}deg in oklab, var(--baro-gradient-stops))`
|
|
6282
|
-
)
|
|
6283
|
-
];
|
|
6593
|
+
return positionValue(`${value}deg`);
|
|
6284
6594
|
}
|
|
6285
6595
|
if (token.arbitrary) {
|
|
6286
6596
|
return [
|
|
@@ -6309,79 +6619,60 @@ functionalUtility({
|
|
|
6309
6619
|
description: "linear-gradient background-image utility (angle, arbitrary, custom property supported)",
|
|
6310
6620
|
category: "background"
|
|
6311
6621
|
});
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6622
|
+
const gradientImage = (fn, position, fallback) => [
|
|
6623
|
+
decl("--baro-gradient-position", position),
|
|
6624
|
+
decl("background-image", `${fn}(var(--baro-gradient-stops${fallback ? `,${fallback}` : ""}))`)
|
|
6625
|
+
];
|
|
6626
|
+
staticUtility("bg-radial", gradientImage("radial-gradient", "in oklab"), { category: "background" });
|
|
6315
6627
|
functionalUtility({
|
|
6316
6628
|
name: "bg-radial",
|
|
6317
6629
|
prop: "background-image",
|
|
6318
6630
|
supportsArbitrary: true,
|
|
6319
6631
|
supportsCustomProperty: true,
|
|
6320
|
-
handle: (value,
|
|
6321
|
-
if (token.arbitrary)
|
|
6322
|
-
|
|
6323
|
-
decl(
|
|
6324
|
-
"background-image",
|
|
6325
|
-
`radial-gradient(var(--baro-gradient-stops, ${value}))`
|
|
6326
|
-
)
|
|
6327
|
-
];
|
|
6328
|
-
}
|
|
6329
|
-
if (token.customProperty) {
|
|
6330
|
-
return [
|
|
6331
|
-
decl(
|
|
6332
|
-
"background-image",
|
|
6333
|
-
`radial-gradient(var(--baro-gradient-stops, var(${value})))`
|
|
6334
|
-
)
|
|
6335
|
-
];
|
|
6336
|
-
}
|
|
6632
|
+
handle: (value, _context, token) => {
|
|
6633
|
+
if (token.arbitrary) return gradientImage("radial-gradient", value, value);
|
|
6634
|
+
if (token.customProperty) return gradientImage("radial-gradient", `var(${value})`, `var(${value})`);
|
|
6337
6635
|
return null;
|
|
6338
|
-
},
|
|
6339
|
-
handleCustomProperty: (value) =>
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
]
|
|
6353
|
-
], { category: "background" });
|
|
6354
|
-
functionalUtility({
|
|
6355
|
-
name: "bg-conic",
|
|
6356
|
-
prop: "background-image",
|
|
6357
|
-
supportsArbitrary: true,
|
|
6358
|
-
supportsCustomProperty: true,
|
|
6359
|
-
handle: (value, context, token) => {
|
|
6360
|
-
if (parseNumber(value)) {
|
|
6361
|
-
return [
|
|
6362
|
-
decl(
|
|
6363
|
-
"background-image",
|
|
6364
|
-
`conic-gradient(from ${value}deg in oklab, var(--baro-gradient-stops))`
|
|
6365
|
-
)
|
|
6366
|
-
];
|
|
6367
|
-
}
|
|
6368
|
-
if (token.arbitrary) {
|
|
6369
|
-
return [decl("background-image", `${value}`)];
|
|
6370
|
-
}
|
|
6371
|
-
if (token.customProperty) {
|
|
6372
|
-
return [
|
|
6373
|
-
decl(
|
|
6374
|
-
"background-image",
|
|
6375
|
-
`conic-gradient(var(--baro-gradient-stops, var(${value})))`
|
|
6376
|
-
)
|
|
6377
|
-
];
|
|
6636
|
+
},
|
|
6637
|
+
handleCustomProperty: (value) => gradientImage("radial-gradient", `var(${value})`, `var(${value})`),
|
|
6638
|
+
description: "radial-gradient background-image utility (arbitrary, custom property supported)",
|
|
6639
|
+
category: "background"
|
|
6640
|
+
});
|
|
6641
|
+
staticUtility("bg-conic", gradientImage("conic-gradient", "in oklab"), { category: "background" });
|
|
6642
|
+
functionalUtility({
|
|
6643
|
+
name: "bg-conic",
|
|
6644
|
+
prop: "background-image",
|
|
6645
|
+
supportsArbitrary: true,
|
|
6646
|
+
supportsCustomProperty: true,
|
|
6647
|
+
handle: (value, _context, token) => {
|
|
6648
|
+
if (!token.arbitrary && !token.customProperty && parseNumber(value)) {
|
|
6649
|
+
return gradientImage("conic-gradient", `from ${value}deg in oklab`);
|
|
6378
6650
|
}
|
|
6651
|
+
if (token.arbitrary) return gradientImage("conic-gradient", value, value);
|
|
6652
|
+
if (token.customProperty) return gradientImage("conic-gradient", `var(${value})`, `var(${value})`);
|
|
6379
6653
|
return null;
|
|
6380
6654
|
},
|
|
6381
|
-
handleCustomProperty: (value) =>
|
|
6655
|
+
handleCustomProperty: (value) => gradientImage("conic-gradient", `var(${value})`, `var(${value})`),
|
|
6382
6656
|
description: "conic-gradient background-image utility (angle, arbitrary, custom property supported)",
|
|
6383
6657
|
category: "background"
|
|
6384
6658
|
});
|
|
6659
|
+
const G = "--baro-gradient";
|
|
6660
|
+
const stopsDecls = (stop, color) => {
|
|
6661
|
+
const colorDecls = typeof color === "string" ? [decl(`${G}-${stop}`, color)] : color;
|
|
6662
|
+
if (stop === "via") {
|
|
6663
|
+
return [
|
|
6664
|
+
gradientStopProperties(),
|
|
6665
|
+
...colorDecls,
|
|
6666
|
+
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)`),
|
|
6667
|
+
decl(`${G}-stops`, `var(${G}-via-stops)`)
|
|
6668
|
+
];
|
|
6669
|
+
}
|
|
6670
|
+
return [
|
|
6671
|
+
gradientStopProperties(),
|
|
6672
|
+
...colorDecls,
|
|
6673
|
+
decl(`${G}-stops`, `var(${G}-via-stops, var(${G}-position), var(${G}-from) var(${G}-from-position), var(${G}-to) var(${G}-to-position))`)
|
|
6674
|
+
];
|
|
6675
|
+
};
|
|
6385
6676
|
["from", "via", "to"].forEach((stop) => {
|
|
6386
6677
|
functionalUtility({
|
|
6387
6678
|
name: stop,
|
|
@@ -6389,72 +6680,18 @@ functionalUtility({
|
|
|
6389
6680
|
supportsArbitrary: true,
|
|
6390
6681
|
supportsCustomProperty: true,
|
|
6391
6682
|
supportsOpacity: true,
|
|
6392
|
-
handle: (value,
|
|
6683
|
+
handle: (value, _context, _token, extra) => {
|
|
6393
6684
|
if (extra?.realThemeValue) {
|
|
6394
|
-
|
|
6395
|
-
let color = value;
|
|
6396
|
-
if (extra?.opacity) {
|
|
6397
|
-
color = `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`;
|
|
6398
|
-
}
|
|
6399
|
-
return [
|
|
6400
|
-
gradientStopProperties(),
|
|
6401
|
-
decl(`--baro-gradient-from`, color),
|
|
6402
|
-
// decl(`--baro-gradient-to`, "var(--baro-gradient-to, transparent)"),
|
|
6403
|
-
decl(`--baro-gradient-stops`, "var(--baro-gradient-from),var(--baro-gradient-to)")
|
|
6404
|
-
];
|
|
6405
|
-
}
|
|
6406
|
-
if (stop === "via") {
|
|
6407
|
-
let color = value;
|
|
6408
|
-
if (extra?.opacity) {
|
|
6409
|
-
color = `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`;
|
|
6410
|
-
}
|
|
6411
|
-
return [
|
|
6412
|
-
gradientStopProperties(),
|
|
6413
|
-
decl(`--baro-gradient-to`, color),
|
|
6414
|
-
decl(`--baro-gradient-stops`, `var(--baro-gradient-from), ${value} var(--baro-gradient-via-position), var(--baro-gradient-to)`)
|
|
6415
|
-
// via 포함 stops
|
|
6416
|
-
];
|
|
6417
|
-
}
|
|
6418
|
-
if (stop === "to") {
|
|
6419
|
-
let color = value;
|
|
6420
|
-
if (extra?.opacity) {
|
|
6421
|
-
color = `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`;
|
|
6422
|
-
}
|
|
6423
|
-
return [
|
|
6424
|
-
gradientStopProperties(),
|
|
6425
|
-
decl(`--baro-gradient-to`, color)
|
|
6426
|
-
];
|
|
6427
|
-
}
|
|
6685
|
+
return stopsDecls(stop, themeColorDecls(`${G}-${stop}`, value, extra));
|
|
6428
6686
|
}
|
|
6429
6687
|
if (parseLength(value)) {
|
|
6430
|
-
return [decl(
|
|
6688
|
+
return [gradientStopProperties(), decl(`${G}-${stop}-position`, value)];
|
|
6431
6689
|
}
|
|
6432
6690
|
if (parseNumber(value)) {
|
|
6433
|
-
return [decl(
|
|
6691
|
+
return [gradientStopProperties(), decl(`${G}-${stop}-position`, `${value}%`)];
|
|
6434
6692
|
}
|
|
6435
6693
|
if (parseColor(value)) {
|
|
6436
|
-
|
|
6437
|
-
return [
|
|
6438
|
-
gradientStopProperties(),
|
|
6439
|
-
decl(`--baro-gradient-from`, value),
|
|
6440
|
-
decl(`--baro-gradient-to`, "transparent"),
|
|
6441
|
-
decl(`--baro-gradient-stops`, "var(--baro-gradient-from),var(--baro-gradient-to)")
|
|
6442
|
-
];
|
|
6443
|
-
}
|
|
6444
|
-
if (stop === "via") {
|
|
6445
|
-
return [
|
|
6446
|
-
gradientStopProperties(),
|
|
6447
|
-
decl(`--baro-gradient-to`, value),
|
|
6448
|
-
decl(`--baro-gradient-stops`, `var(--baro-gradient-from), ${value} var(--baro-gradient-via-position), var(--baro-gradient-to)`)
|
|
6449
|
-
// via 포함 stops
|
|
6450
|
-
];
|
|
6451
|
-
}
|
|
6452
|
-
if (stop === "to") {
|
|
6453
|
-
return [
|
|
6454
|
-
gradientStopProperties(),
|
|
6455
|
-
decl(`--baro-gradient-to`, value)
|
|
6456
|
-
];
|
|
6457
|
-
}
|
|
6694
|
+
return stopsDecls(stop, value);
|
|
6458
6695
|
}
|
|
6459
6696
|
return null;
|
|
6460
6697
|
},
|
|
@@ -6489,20 +6726,7 @@ functionalUtility({
|
|
|
6489
6726
|
if (value.startsWith("length:")) {
|
|
6490
6727
|
return [decl("background-size", value.replace("length:", ""))];
|
|
6491
6728
|
}
|
|
6492
|
-
if (extra?.realThemeValue)
|
|
6493
|
-
if (extra.opacity) {
|
|
6494
|
-
return [
|
|
6495
|
-
atRule("supports", `(color:color-mix(in lab, red, red))`, [
|
|
6496
|
-
decl(
|
|
6497
|
-
"background-color",
|
|
6498
|
-
`color-mix(in lab, ${value} ${extra.opacity}%, transparent)`
|
|
6499
|
-
)
|
|
6500
|
-
]),
|
|
6501
|
-
decl("background-color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
|
|
6502
|
-
];
|
|
6503
|
-
}
|
|
6504
|
-
return [decl("background-color", value)];
|
|
6505
|
-
}
|
|
6729
|
+
if (extra?.realThemeValue) return themeColorDecls("background-color", value, extra);
|
|
6506
6730
|
if (parseColor(value)) {
|
|
6507
6731
|
const parsedColor = parseColor(value);
|
|
6508
6732
|
if (value.startsWith("color:")) {
|
|
@@ -6515,18 +6739,20 @@ functionalUtility({
|
|
|
6515
6739
|
}
|
|
6516
6740
|
return null;
|
|
6517
6741
|
},
|
|
6518
|
-
handleCustomProperty: (value) => [decl("background-size", `var(${value})`)],
|
|
6742
|
+
handleCustomProperty: (value) => value.startsWith("length:") ? [decl("background-size", `var(${value.slice(7)})`)] : [decl("background-color", `var(${value})`)],
|
|
6519
6743
|
description: "background-size utility (arbitrary, custom property supported)",
|
|
6520
6744
|
category: "background"
|
|
6521
6745
|
});
|
|
6522
6746
|
staticUtility("rounded-none", [["border-radius", "0px"]], { category: "borders" });
|
|
6523
6747
|
staticUtility("rounded-sm", [["border-radius", "var(--radius-sm)"]], { category: "borders" });
|
|
6524
|
-
staticUtility("rounded", [["border-radius", "
|
|
6748
|
+
staticUtility("rounded", [["border-radius", "0.25rem"]], { category: "borders" });
|
|
6525
6749
|
staticUtility("rounded-md", [["border-radius", "var(--radius-md)"]], { category: "borders" });
|
|
6526
6750
|
staticUtility("rounded-lg", [["border-radius", "var(--radius-lg)"]], { category: "borders" });
|
|
6527
6751
|
staticUtility("rounded-xl", [["border-radius", "var(--radius-xl)"]], { category: "borders" });
|
|
6528
6752
|
staticUtility("rounded-2xl", [["border-radius", "var(--radius-2xl)"]], { category: "borders" });
|
|
6529
6753
|
staticUtility("rounded-3xl", [["border-radius", "var(--radius-3xl)"]], { category: "borders" });
|
|
6754
|
+
staticUtility("rounded-4xl", [["border-radius", "var(--radius-4xl)"]], { category: "borders" });
|
|
6755
|
+
staticUtility("rounded-xs", [["border-radius", "var(--radius-xs)"]], { category: "borders" });
|
|
6530
6756
|
staticUtility("rounded-full", [["border-radius", "9999px"]], { category: "borders" });
|
|
6531
6757
|
[
|
|
6532
6758
|
["rounded-t", ["border-top-left-radius", "border-top-right-radius"]],
|
|
@@ -6541,12 +6767,14 @@ staticUtility("rounded-full", [["border-radius", "9999px"]], { category: "border
|
|
|
6541
6767
|
const propList = props;
|
|
6542
6768
|
staticUtility(`${name}-none`, propList.map((prop) => [prop, "0px"]), { category: "borders" });
|
|
6543
6769
|
staticUtility(`${name}-sm`, propList.map((prop) => [prop, "var(--radius-sm)"]), { category: "borders" });
|
|
6544
|
-
staticUtility(`${name}`, propList.map((prop) => [prop, "
|
|
6770
|
+
staticUtility(`${name}`, propList.map((prop) => [prop, "0.25rem"]), { category: "borders" });
|
|
6545
6771
|
staticUtility(`${name}-md`, propList.map((prop) => [prop, "var(--radius-md)"]), { category: "borders" });
|
|
6546
6772
|
staticUtility(`${name}-lg`, propList.map((prop) => [prop, "var(--radius-lg)"]), { category: "borders" });
|
|
6547
6773
|
staticUtility(`${name}-xl`, propList.map((prop) => [prop, "var(--radius-xl)"]), { category: "borders" });
|
|
6548
6774
|
staticUtility(`${name}-2xl`, propList.map((prop) => [prop, "var(--radius-2xl)"]), { category: "borders" });
|
|
6549
6775
|
staticUtility(`${name}-3xl`, propList.map((prop) => [prop, "var(--radius-3xl)"]), { category: "borders" });
|
|
6776
|
+
staticUtility(`${name}-4xl`, propList.map((prop) => [prop, "var(--radius-4xl)"]), { category: "borders" });
|
|
6777
|
+
staticUtility(`${name}-xs`, propList.map((prop) => [prop, "var(--radius-xs)"]), { category: "borders" });
|
|
6550
6778
|
staticUtility(`${name}-full`, propList.map((prop) => [prop, "9999px"]), { category: "borders" });
|
|
6551
6779
|
functionalUtility({
|
|
6552
6780
|
name,
|
|
@@ -6577,11 +6805,15 @@ functionalUtility({
|
|
|
6577
6805
|
description: "border-radius utility (spacing, arbitrary, custom property support)",
|
|
6578
6806
|
category: "borders"
|
|
6579
6807
|
});
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6808
|
+
const borderStyleProperty = () => atRoot([property("--baro-border-style", "solid")]);
|
|
6809
|
+
const withBorderStyle = (props, width) => [
|
|
6810
|
+
borderStyleProperty(),
|
|
6811
|
+
...props.map((prop) => decl(prop.replace("width", "style"), "var(--baro-border-style)")),
|
|
6812
|
+
...props.map((prop) => decl(prop, width))
|
|
6813
|
+
];
|
|
6814
|
+
[["border-0", "0px"], ["border-2", "2px"], ["border-4", "4px"], ["border-8", "8px"], ["border", "1px"]].forEach(([name, width]) => {
|
|
6815
|
+
staticUtility(name, [borderStyleProperty, ["border-style", "var(--baro-border-style)"], ["border-width", width]], { category: "borders" });
|
|
6816
|
+
});
|
|
6585
6817
|
[
|
|
6586
6818
|
["border-x", ["border-left-width", "border-right-width"]],
|
|
6587
6819
|
["border-y", ["border-top-width", "border-bottom-width"]],
|
|
@@ -6591,11 +6823,16 @@ staticUtility("border", [["border-width", "1px"]], { category: "borders" });
|
|
|
6591
6823
|
["border-l", ["border-left-width"]]
|
|
6592
6824
|
].forEach(([name, props]) => {
|
|
6593
6825
|
const propList = props;
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6826
|
+
const styled = (width) => [
|
|
6827
|
+
borderStyleProperty,
|
|
6828
|
+
...propList.map((prop) => [prop.replace("width", "style"), "var(--baro-border-style)"]),
|
|
6829
|
+
...propList.map((prop) => [prop, width])
|
|
6830
|
+
];
|
|
6831
|
+
staticUtility(`${name}-0`, styled("0px"));
|
|
6832
|
+
staticUtility(`${name}-2`, styled("2px"));
|
|
6833
|
+
staticUtility(`${name}-4`, styled("4px"));
|
|
6834
|
+
staticUtility(`${name}-8`, styled("8px"));
|
|
6835
|
+
staticUtility(`${name}`, styled("1px"));
|
|
6599
6836
|
functionalUtility({
|
|
6600
6837
|
name,
|
|
6601
6838
|
themeKeys: ["borderWidth", "colors"],
|
|
@@ -6607,18 +6844,19 @@ staticUtility("border", [["border-width", "1px"]], { category: "borders" });
|
|
|
6607
6844
|
}
|
|
6608
6845
|
return null;
|
|
6609
6846
|
},
|
|
6610
|
-
handle: (value, ctx, token) => {
|
|
6847
|
+
handle: (value, ctx, token, extra) => {
|
|
6848
|
+
if (extra?.realThemeValue) return propList.flatMap((prop) => themeColorDecls(prop.replace("width", "color"), value, extra));
|
|
6611
6849
|
if (parseColor(value)) {
|
|
6612
6850
|
return propList.map((prop) => decl(prop.replace("width", "color"), value));
|
|
6613
6851
|
}
|
|
6614
6852
|
if (token.arbitrary) {
|
|
6615
|
-
return propList
|
|
6853
|
+
return withBorderStyle(propList, value);
|
|
6616
6854
|
}
|
|
6617
6855
|
return null;
|
|
6618
6856
|
},
|
|
6619
6857
|
handleCustomProperty: (value) => {
|
|
6620
6858
|
if (value.startsWith("length:")) {
|
|
6621
|
-
return propList
|
|
6859
|
+
return withBorderStyle(propList, `var(${value.replace("length:", "")})`);
|
|
6622
6860
|
}
|
|
6623
6861
|
return propList.map((prop) => decl(prop.replace("width", "color"), `var(${value})`));
|
|
6624
6862
|
},
|
|
@@ -6629,12 +6867,35 @@ staticUtility("border", [["border-width", "1px"]], { category: "borders" });
|
|
|
6629
6867
|
staticUtility("border-inherit", [["border-color", "inherit"]], { category: "borders" });
|
|
6630
6868
|
staticUtility("border-current", [["border-color", "currentColor"]], { category: "borders" });
|
|
6631
6869
|
staticUtility("border-transparent", [["border-color", "transparent"]], { category: "borders" });
|
|
6632
|
-
staticUtility("border-solid", [["border-style", "solid"]], { category: "borders" });
|
|
6633
|
-
staticUtility("border-dashed", [["border-style", "dashed"]], { category: "borders" });
|
|
6634
|
-
staticUtility("border-dotted", [["border-style", "dotted"]], { category: "borders" });
|
|
6635
|
-
staticUtility("border-double", [["border-style", "double"]], { category: "borders" });
|
|
6636
|
-
staticUtility("border-hidden", [["border-style", "hidden"]], { category: "borders" });
|
|
6637
|
-
staticUtility("border-none", [["border-style", "none"]], { category: "borders" });
|
|
6870
|
+
staticUtility("border-solid", [["--baro-border-style", "solid"], ["border-style", "solid"]], { category: "borders" });
|
|
6871
|
+
staticUtility("border-dashed", [["--baro-border-style", "dashed"], ["border-style", "dashed"]], { category: "borders" });
|
|
6872
|
+
staticUtility("border-dotted", [["--baro-border-style", "dotted"], ["border-style", "dotted"]], { category: "borders" });
|
|
6873
|
+
staticUtility("border-double", [["--baro-border-style", "double"], ["border-style", "double"]], { category: "borders" });
|
|
6874
|
+
staticUtility("border-hidden", [["--baro-border-style", "hidden"], ["border-style", "hidden"]], { category: "borders" });
|
|
6875
|
+
staticUtility("border-none", [["--baro-border-style", "none"], ["border-style", "none"]], { category: "borders" });
|
|
6876
|
+
const divideSides = { x: ["border-inline-start", "border-inline-end", "border-inline-style"], y: ["border-top", "border-bottom", "border-bottom-style", "border-top-style"] };
|
|
6877
|
+
Object.entries(divideSides).forEach(([axis, [start, end, ...styles]]) => {
|
|
6878
|
+
const rev = `--baro-divide-${axis}-reverse`;
|
|
6879
|
+
const divide = (width) => [
|
|
6880
|
+
borderStyleProperty(),
|
|
6881
|
+
rule(":where(& > :not(:last-child))", [
|
|
6882
|
+
decl(rev, "0"),
|
|
6883
|
+
...styles.map((s) => decl(s, "var(--baro-border-style)")),
|
|
6884
|
+
decl(`${start}-width`, `calc(${width} * var(${rev}))`),
|
|
6885
|
+
decl(`${end}-width`, `calc(${width} * calc(1 - var(${rev})))`)
|
|
6886
|
+
])
|
|
6887
|
+
];
|
|
6888
|
+
staticUtility(`divide-${axis}`, divide("1px"), { category: "borders" });
|
|
6889
|
+
staticUtility(`divide-${axis}-reverse`, [rule(":where(& > :not(:last-child))", [decl(rev, "1")])], { category: "borders" });
|
|
6890
|
+
functionalUtility({
|
|
6891
|
+
name: `divide-${axis}`,
|
|
6892
|
+
supportsArbitrary: true,
|
|
6893
|
+
handleBareValue: ({ value }) => /^\d+$/.test(value) ? `${value}px` : null,
|
|
6894
|
+
handle: (value) => divide(value),
|
|
6895
|
+
description: `divide-${axis} width utility`,
|
|
6896
|
+
category: "borders"
|
|
6897
|
+
});
|
|
6898
|
+
});
|
|
6638
6899
|
functionalUtility({
|
|
6639
6900
|
name: "border",
|
|
6640
6901
|
themeKeys: ["colors", "borderWidth"],
|
|
@@ -6642,25 +6903,15 @@ functionalUtility({
|
|
|
6642
6903
|
supportsCustomProperty: true,
|
|
6643
6904
|
supportsOpacity: true,
|
|
6644
6905
|
handle: (value, ctx, token, extra) => {
|
|
6645
|
-
if (extra?.realThemeValue)
|
|
6646
|
-
if (extra.opacity) {
|
|
6647
|
-
return [
|
|
6648
|
-
atRule("supports", `(color:color-mix(in lab, red, red))`, [
|
|
6649
|
-
decl("border-color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
|
|
6650
|
-
]),
|
|
6651
|
-
decl("border-color", `color-mix(in lab, ${value} ${extra.opacity}%, transparent)`)
|
|
6652
|
-
];
|
|
6653
|
-
}
|
|
6654
|
-
return [decl("border-color", value)];
|
|
6655
|
-
}
|
|
6906
|
+
if (extra?.realThemeValue) return themeColorDecls("border-color", value, extra);
|
|
6656
6907
|
if (token.arbitrary) {
|
|
6657
6908
|
if (parseLength(value)) {
|
|
6658
|
-
return [
|
|
6909
|
+
return withBorderStyle(["border-width"], value);
|
|
6659
6910
|
}
|
|
6660
6911
|
return [decl("border-color", value)];
|
|
6661
6912
|
}
|
|
6662
6913
|
if (parseNumber(value)) {
|
|
6663
|
-
return [
|
|
6914
|
+
return withBorderStyle(["border-width"], `${value}px`);
|
|
6664
6915
|
}
|
|
6665
6916
|
if (parseColor(value)) {
|
|
6666
6917
|
return [decl("border-color", value)];
|
|
@@ -6669,26 +6920,35 @@ functionalUtility({
|
|
|
6669
6920
|
},
|
|
6670
6921
|
handleCustomProperty: (value) => {
|
|
6671
6922
|
if (value.startsWith("length:")) {
|
|
6672
|
-
return [
|
|
6923
|
+
return withBorderStyle(["border-width"], `var(${value.replace("length:", "")})`);
|
|
6673
6924
|
}
|
|
6674
6925
|
return [decl("border-color", `var(${value})`)];
|
|
6675
6926
|
},
|
|
6676
6927
|
description: "border-width utility (number, arbitrary, custom property support)",
|
|
6677
6928
|
category: "borders"
|
|
6678
6929
|
});
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6930
|
+
const outlineStyleProperty = () => atRoot([property("--baro-outline-style", "solid")]);
|
|
6931
|
+
const withOutlineStyle = (width) => [
|
|
6932
|
+
outlineStyleProperty(),
|
|
6933
|
+
decl("outline-style", "var(--baro-outline-style)"),
|
|
6934
|
+
decl("outline-width", width)
|
|
6935
|
+
];
|
|
6936
|
+
[["outline-0", "0px"], ["outline-1", "1px"], ["outline-2", "2px"], ["outline-4", "4px"], ["outline-8", "8px"]].forEach(([name, width]) => {
|
|
6937
|
+
staticUtility(name, [outlineStyleProperty, ["outline-style", "var(--baro-outline-style)"], ["outline-width", width]], { category: "borders" });
|
|
6938
|
+
});
|
|
6684
6939
|
staticUtility("outline-inherit", [["outline-color", "inherit"]], { category: "borders" });
|
|
6685
6940
|
staticUtility("outline-current", [["outline-color", "currentColor"]], { category: "borders" });
|
|
6686
6941
|
staticUtility("outline-transparent", [["outline-color", "transparent"]], { category: "borders" });
|
|
6687
|
-
staticUtility("outline-none", [["outline", "
|
|
6688
|
-
staticUtility("outline", [
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6942
|
+
staticUtility("outline-none", [["--baro-outline-style", "none"], ["outline-style", "none"]], { category: "borders" });
|
|
6943
|
+
staticUtility("outline-hidden", [
|
|
6944
|
+
["--baro-outline-style", "none"],
|
|
6945
|
+
["outline-style", "none"],
|
|
6946
|
+
atRule("media", "(forced-colors: active)", [decl("outline", "2px solid transparent"), decl("outline-offset", "2px")])
|
|
6947
|
+
], { category: "borders" });
|
|
6948
|
+
staticUtility("outline", [outlineStyleProperty, ["outline-style", "var(--baro-outline-style)"], ["outline-width", "1px"]], { category: "borders" });
|
|
6949
|
+
["solid", "dashed", "dotted", "double"].forEach((style) => {
|
|
6950
|
+
staticUtility(`outline-${style}`, [["--baro-outline-style", style], ["outline-style", style]], { category: "borders" });
|
|
6951
|
+
});
|
|
6692
6952
|
staticUtility("outline-offset-0", [["outline-offset", "0px"]], { category: "borders" });
|
|
6693
6953
|
staticUtility("outline-offset-1", [["outline-offset", "1px"]], { category: "borders" });
|
|
6694
6954
|
staticUtility("outline-offset-2", [["outline-offset", "2px"]], { category: "borders" });
|
|
@@ -6713,16 +6973,18 @@ functionalUtility({
|
|
|
6713
6973
|
themeKeys: ["colors", "borderWidth"],
|
|
6714
6974
|
supportsArbitrary: true,
|
|
6715
6975
|
supportsCustomProperty: true,
|
|
6716
|
-
|
|
6976
|
+
supportsOpacity: true,
|
|
6977
|
+
handle: (value, ctx, token, extra) => {
|
|
6978
|
+
if (extra?.realThemeValue) return themeColorDecls("outline-color", value, extra);
|
|
6717
6979
|
if (parseColor(value)) {
|
|
6718
6980
|
return [decl("outline-color", value)];
|
|
6719
6981
|
}
|
|
6720
6982
|
if (parseNumber(value)) {
|
|
6721
|
-
return
|
|
6983
|
+
return withOutlineStyle(`${value}px`);
|
|
6722
6984
|
}
|
|
6723
6985
|
if (token.arbitrary) {
|
|
6724
6986
|
if (parseLength(value)) {
|
|
6725
|
-
return
|
|
6987
|
+
return withOutlineStyle(value);
|
|
6726
6988
|
}
|
|
6727
6989
|
return [decl("outline-color", value)];
|
|
6728
6990
|
}
|
|
@@ -6733,7 +6995,7 @@ functionalUtility({
|
|
|
6733
6995
|
return [decl("outline-color", value.replace("color:", ""))];
|
|
6734
6996
|
}
|
|
6735
6997
|
if (value.startsWith("length:")) {
|
|
6736
|
-
return
|
|
6998
|
+
return withOutlineStyle(`var(${value.replace("length:", "")})`);
|
|
6737
6999
|
}
|
|
6738
7000
|
return [decl("outline-color", `var(${value})`)];
|
|
6739
7001
|
},
|
|
@@ -6754,6 +7016,40 @@ functionalUtility({
|
|
|
6754
7016
|
description: "outline-width utility (number, arbitrary, custom property support)",
|
|
6755
7017
|
category: "borders"
|
|
6756
7018
|
});
|
|
7019
|
+
const divideColor = (value) => [rule(":where(& > :not(:last-child))", [decl("border-color", value)])];
|
|
7020
|
+
staticUtility("divide-inherit", divideColor("inherit"), { category: "borders" });
|
|
7021
|
+
staticUtility("divide-current", divideColor("currentColor"), { category: "borders" });
|
|
7022
|
+
staticUtility("divide-transparent", divideColor("transparent"), { category: "borders" });
|
|
7023
|
+
functionalUtility({
|
|
7024
|
+
name: "divide",
|
|
7025
|
+
themeKeys: ["colors"],
|
|
7026
|
+
supportsArbitrary: true,
|
|
7027
|
+
supportsCustomProperty: true,
|
|
7028
|
+
supportsOpacity: true,
|
|
7029
|
+
handle: (value, _ctx, _token, extra) => {
|
|
7030
|
+
if (extra?.realThemeValue) {
|
|
7031
|
+
return [rule(":where(& > :not(:last-child))", themeColorDecls("border-color", value, extra))];
|
|
7032
|
+
}
|
|
7033
|
+
if (parseColor(value)) return divideColor(value);
|
|
7034
|
+
return null;
|
|
7035
|
+
},
|
|
7036
|
+
handleCustomProperty: (value) => divideColor(`var(${value})`),
|
|
7037
|
+
description: "divide-color utility (theme, alpha, arbitrary, custom property)",
|
|
7038
|
+
category: "borders"
|
|
7039
|
+
});
|
|
7040
|
+
const ROTATE_SKEW = "var(--baro-rotate-x,) var(--baro-rotate-y,) var(--baro-rotate-z,) var(--baro-skew-x,) var(--baro-skew-y,)";
|
|
7041
|
+
const rotateAxis = (axis, fn) => [decl(`--baro-rotate-${axis}`, fn), decl("transform", ROTATE_SKEW)];
|
|
7042
|
+
const skewAxis = (axis, fn) => [decl(`--baro-skew-${axis}`, fn), decl("transform", ROTATE_SKEW)];
|
|
7043
|
+
const scaleProperties = () => atRoot([
|
|
7044
|
+
property("--baro-scale-x", "1"),
|
|
7045
|
+
property("--baro-scale-y", "1"),
|
|
7046
|
+
property("--baro-scale-z", "1")
|
|
7047
|
+
]);
|
|
7048
|
+
const scaleAxis = (axis, v) => [
|
|
7049
|
+
scaleProperties(),
|
|
7050
|
+
decl(`--baro-scale-${axis}`, v),
|
|
7051
|
+
decl("scale", axis === "z" ? "var(--baro-scale-x) var(--baro-scale-y) var(--baro-scale-z)" : "var(--baro-scale-x) var(--baro-scale-y)")
|
|
7052
|
+
];
|
|
6757
7053
|
staticUtility("transform-none", [["transform", "none"]], {
|
|
6758
7054
|
category: "transform"
|
|
6759
7055
|
});
|
|
@@ -6762,7 +7058,7 @@ staticUtility(
|
|
|
6762
7058
|
[
|
|
6763
7059
|
[
|
|
6764
7060
|
"transform",
|
|
6765
|
-
|
|
7061
|
+
`translateZ(0) ${ROTATE_SKEW}`
|
|
6766
7062
|
]
|
|
6767
7063
|
],
|
|
6768
7064
|
{ category: "transform" }
|
|
@@ -6770,7 +7066,7 @@ staticUtility(
|
|
|
6770
7066
|
staticUtility("transform-cpu", [
|
|
6771
7067
|
[
|
|
6772
7068
|
"transform",
|
|
6773
|
-
|
|
7069
|
+
ROTATE_SKEW
|
|
6774
7070
|
]
|
|
6775
7071
|
]);
|
|
6776
7072
|
staticUtility("transform-3d", [["transform-style", "preserve-3d"]], {
|
|
@@ -6899,13 +7195,11 @@ functionalUtility({
|
|
|
6899
7195
|
if (parseNumber(value) || negative) {
|
|
6900
7196
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6901
7197
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6902
|
-
return
|
|
7198
|
+
return rotateAxis("x", `rotateX(${sign}${deg})`);
|
|
6903
7199
|
}
|
|
6904
|
-
return
|
|
7200
|
+
return rotateAxis("x", `rotateX(${value})`);
|
|
6905
7201
|
},
|
|
6906
|
-
handleCustomProperty: (value) =>
|
|
6907
|
-
decl("transform", `rotateX(var(${value})) var(--baro-rotate-y)`)
|
|
6908
|
-
],
|
|
7202
|
+
handleCustomProperty: (value) => rotateAxis("x", `rotateX(var(${value}))`),
|
|
6909
7203
|
description: "rotate-x utility (named, arbitrary, custom property supported)",
|
|
6910
7204
|
category: "transform"
|
|
6911
7205
|
});
|
|
@@ -6919,13 +7213,11 @@ functionalUtility({
|
|
|
6919
7213
|
if (parseNumber(value) || negative) {
|
|
6920
7214
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6921
7215
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6922
|
-
return
|
|
7216
|
+
return rotateAxis("y", `rotateY(${sign}${deg})`);
|
|
6923
7217
|
}
|
|
6924
|
-
return
|
|
7218
|
+
return rotateAxis("y", `rotateY(${value})`);
|
|
6925
7219
|
},
|
|
6926
|
-
handleCustomProperty: (value) =>
|
|
6927
|
-
decl("transform", `var(--baro-rotate-x) rotateY(var(${value}))`)
|
|
6928
|
-
],
|
|
7220
|
+
handleCustomProperty: (value) => rotateAxis("y", `rotateY(var(${value}))`),
|
|
6929
7221
|
description: "rotate-y utility (named, arbitrary, custom property supported)",
|
|
6930
7222
|
category: "transform"
|
|
6931
7223
|
});
|
|
@@ -6939,26 +7231,11 @@ functionalUtility({
|
|
|
6939
7231
|
if (parseNumber(value) || negative) {
|
|
6940
7232
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
6941
7233
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
6942
|
-
return
|
|
6943
|
-
decl(
|
|
6944
|
-
"transform",
|
|
6945
|
-
`var(--baro-rotate-x) var(--baro-rotate-y) rotateZ(${sign}${deg})`
|
|
6946
|
-
)
|
|
6947
|
-
];
|
|
7234
|
+
return rotateAxis("z", `rotateZ(${sign}${deg})`);
|
|
6948
7235
|
}
|
|
6949
|
-
return
|
|
6950
|
-
decl(
|
|
6951
|
-
"transform",
|
|
6952
|
-
`var(--baro-rotate-x) var(--baro-rotate-y) rotateZ(${value})`
|
|
6953
|
-
)
|
|
6954
|
-
];
|
|
7236
|
+
return rotateAxis("z", `rotateZ(${value})`);
|
|
6955
7237
|
},
|
|
6956
|
-
handleCustomProperty: (value) =>
|
|
6957
|
-
decl(
|
|
6958
|
-
"transform",
|
|
6959
|
-
`var(--baro-rotate-x) var(--baro-rotate-y) rotateZ(var(${value}))`
|
|
6960
|
-
)
|
|
6961
|
-
],
|
|
7238
|
+
handleCustomProperty: (value) => rotateAxis("z", `rotateZ(var(${value}))`),
|
|
6962
7239
|
description: "rotate-z utility (named, arbitrary, custom property supported)",
|
|
6963
7240
|
category: "transform"
|
|
6964
7241
|
});
|
|
@@ -6985,7 +7262,7 @@ functionalUtility({
|
|
|
6985
7262
|
staticUtility("scale-none", [["scale", "none"]], { category: "transform" });
|
|
6986
7263
|
staticUtility(
|
|
6987
7264
|
"scale-3d",
|
|
6988
|
-
[["scale", "var(--baro-scale-x) var(--baro-scale-y) var(--baro-scale-z)"]],
|
|
7265
|
+
[scaleProperties, ["scale", "var(--baro-scale-x) var(--baro-scale-y) var(--baro-scale-z)"]],
|
|
6989
7266
|
{ category: "transform" }
|
|
6990
7267
|
);
|
|
6991
7268
|
functionalUtility({
|
|
@@ -6996,18 +7273,16 @@ functionalUtility({
|
|
|
6996
7273
|
supportsNegative: true,
|
|
6997
7274
|
handle: (value, ctx, { negative, arbitrary }) => {
|
|
6998
7275
|
if (arbitrary) {
|
|
6999
|
-
return
|
|
7276
|
+
return scaleAxis("x", value);
|
|
7000
7277
|
}
|
|
7001
7278
|
if (parseNumber(value) || negative) {
|
|
7002
7279
|
const pct = `${Math.abs(Number(value))}%`;
|
|
7003
7280
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
7004
|
-
return
|
|
7281
|
+
return scaleAxis("x", `calc(${pct} * ${sign}1)`);
|
|
7005
7282
|
}
|
|
7006
|
-
return
|
|
7283
|
+
return scaleAxis("x", value);
|
|
7007
7284
|
},
|
|
7008
|
-
handleCustomProperty: (value) =>
|
|
7009
|
-
decl("scale", `var(${value}) var(--baro-scale-y)`)
|
|
7010
|
-
],
|
|
7285
|
+
handleCustomProperty: (value) => scaleAxis("x", `var(${value})`),
|
|
7011
7286
|
description: "scale-x utility (named, arbitrary, custom property supported)",
|
|
7012
7287
|
category: "transform"
|
|
7013
7288
|
});
|
|
@@ -7019,18 +7294,16 @@ functionalUtility({
|
|
|
7019
7294
|
supportsNegative: true,
|
|
7020
7295
|
handle: (value, ctx, { negative, arbitrary }) => {
|
|
7021
7296
|
if (arbitrary) {
|
|
7022
|
-
return
|
|
7297
|
+
return scaleAxis("y", value);
|
|
7023
7298
|
}
|
|
7024
7299
|
if (parseNumber(value) || negative) {
|
|
7025
7300
|
const pct = `${Math.abs(Number(value))}%`;
|
|
7026
7301
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
7027
|
-
return
|
|
7302
|
+
return scaleAxis("y", `calc(${pct} * ${sign}1)`);
|
|
7028
7303
|
}
|
|
7029
|
-
return
|
|
7304
|
+
return scaleAxis("y", value);
|
|
7030
7305
|
},
|
|
7031
|
-
handleCustomProperty: (value) =>
|
|
7032
|
-
decl("scale", `var(--baro-scale-x) var(${value})`)
|
|
7033
|
-
],
|
|
7306
|
+
handleCustomProperty: (value) => scaleAxis("y", `var(${value})`),
|
|
7034
7307
|
description: "scale-y utility (named, arbitrary, custom property supported)",
|
|
7035
7308
|
category: "transform"
|
|
7036
7309
|
});
|
|
@@ -7042,25 +7315,16 @@ functionalUtility({
|
|
|
7042
7315
|
supportsNegative: true,
|
|
7043
7316
|
handle: (value, ctx, { negative, arbitrary }) => {
|
|
7044
7317
|
if (arbitrary) {
|
|
7045
|
-
return
|
|
7046
|
-
decl("scale", `var(--baro-scale-x) var(--baro-scale-y) ${value}`)
|
|
7047
|
-
];
|
|
7318
|
+
return scaleAxis("z", value);
|
|
7048
7319
|
}
|
|
7049
7320
|
if (parseNumber(value) || negative) {
|
|
7050
7321
|
const pct = `${Math.abs(Number(value))}%`;
|
|
7051
7322
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
7052
|
-
return
|
|
7053
|
-
decl(
|
|
7054
|
-
"scale",
|
|
7055
|
-
`var(--baro-scale-x) var(--baro-scale-y) calc(${pct} * ${sign}1)`
|
|
7056
|
-
)
|
|
7057
|
-
];
|
|
7323
|
+
return scaleAxis("z", `calc(${pct} * ${sign}1)`);
|
|
7058
7324
|
}
|
|
7059
|
-
return
|
|
7325
|
+
return scaleAxis("z", value);
|
|
7060
7326
|
},
|
|
7061
|
-
handleCustomProperty: (value) =>
|
|
7062
|
-
decl("scale", `var(--baro-scale-x) var(--baro-scale-y) var(${value})`)
|
|
7063
|
-
],
|
|
7327
|
+
handleCustomProperty: (value) => scaleAxis("z", `var(${value})`),
|
|
7064
7328
|
description: "scale-z utility (named, arbitrary, custom property supported)",
|
|
7065
7329
|
category: "transform"
|
|
7066
7330
|
});
|
|
@@ -7099,11 +7363,11 @@ functionalUtility({
|
|
|
7099
7363
|
if (parseNumber(value) || negative) {
|
|
7100
7364
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
7101
7365
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
7102
|
-
return
|
|
7366
|
+
return skewAxis("x", `skewX(${sign}${deg})`);
|
|
7103
7367
|
}
|
|
7104
|
-
return
|
|
7368
|
+
return skewAxis("x", `skewX(${value})`);
|
|
7105
7369
|
},
|
|
7106
|
-
handleCustomProperty: (value) =>
|
|
7370
|
+
handleCustomProperty: (value) => skewAxis("x", `skewX(var(${value}))`),
|
|
7107
7371
|
description: "skew-x utility (named, arbitrary, custom property supported)",
|
|
7108
7372
|
category: "transform"
|
|
7109
7373
|
});
|
|
@@ -7117,11 +7381,11 @@ functionalUtility({
|
|
|
7117
7381
|
if (parseNumber(value) || negative) {
|
|
7118
7382
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
7119
7383
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
7120
|
-
return
|
|
7384
|
+
return skewAxis("y", `skewY(${sign}${deg})`);
|
|
7121
7385
|
}
|
|
7122
|
-
return
|
|
7386
|
+
return skewAxis("y", `skewY(${value})`);
|
|
7123
7387
|
},
|
|
7124
|
-
handleCustomProperty: (value) =>
|
|
7388
|
+
handleCustomProperty: (value) => skewAxis("y", `skewY(var(${value}))`),
|
|
7125
7389
|
description: "skew-y utility (named, arbitrary, custom property supported)",
|
|
7126
7390
|
category: "transform"
|
|
7127
7391
|
});
|
|
@@ -7135,12 +7399,14 @@ functionalUtility({
|
|
|
7135
7399
|
if (parseNumber(value) || negative) {
|
|
7136
7400
|
const deg = `${Math.abs(Number(value))}deg`;
|
|
7137
7401
|
const sign = negative || String(value).startsWith("-") ? "-" : "";
|
|
7138
|
-
return [decl("
|
|
7402
|
+
return [decl("--baro-skew-x", `skewX(${sign}${deg})`), decl("--baro-skew-y", `skewY(${sign}${deg})`), decl("transform", ROTATE_SKEW)];
|
|
7139
7403
|
}
|
|
7140
|
-
return [decl("
|
|
7404
|
+
return [decl("--baro-skew-x", `skewX(${value})`), decl("--baro-skew-y", `skewY(${value})`), decl("transform", ROTATE_SKEW)];
|
|
7141
7405
|
},
|
|
7142
7406
|
handleCustomProperty: (value) => [
|
|
7143
|
-
decl("
|
|
7407
|
+
decl("--baro-skew-x", `skewX(var(${value}))`),
|
|
7408
|
+
decl("--baro-skew-y", `skewY(var(${value}))`),
|
|
7409
|
+
decl("transform", ROTATE_SKEW)
|
|
7144
7410
|
],
|
|
7145
7411
|
description: "skew utility (named, arbitrary, custom property supported)",
|
|
7146
7412
|
category: "transform"
|
|
@@ -7185,6 +7451,22 @@ const translateProperties = () => atRoot([
|
|
|
7185
7451
|
property("--baro-translate-y", "0"),
|
|
7186
7452
|
property("--baro-translate-z", "0")
|
|
7187
7453
|
]);
|
|
7454
|
+
const translateAxis = (axis, v) => [
|
|
7455
|
+
translateProperties(),
|
|
7456
|
+
decl(`--baro-translate-${axis}`, v),
|
|
7457
|
+
decl(
|
|
7458
|
+
"translate",
|
|
7459
|
+
axis === "z" ? "var(--baro-translate-x) var(--baro-translate-y) var(--baro-translate-z)" : "var(--baro-translate-x) var(--baro-translate-y)"
|
|
7460
|
+
)
|
|
7461
|
+
];
|
|
7462
|
+
const staticTranslateAxis = (axis, v) => [
|
|
7463
|
+
translateProperties,
|
|
7464
|
+
[`--baro-translate-${axis}`, v],
|
|
7465
|
+
[
|
|
7466
|
+
"translate",
|
|
7467
|
+
axis === "z" ? "var(--baro-translate-x) var(--baro-translate-y) var(--baro-translate-z)" : "var(--baro-translate-x) var(--baro-translate-y)"
|
|
7468
|
+
]
|
|
7469
|
+
];
|
|
7188
7470
|
staticUtility("translate-none", [["translate", "none"]], {
|
|
7189
7471
|
category: "transform"
|
|
7190
7472
|
});
|
|
@@ -7216,52 +7498,52 @@ staticUtility(
|
|
|
7216
7498
|
);
|
|
7217
7499
|
staticUtility(
|
|
7218
7500
|
"translate-x-px",
|
|
7219
|
-
|
|
7501
|
+
staticTranslateAxis("x", "1px"),
|
|
7220
7502
|
{ category: "transform" }
|
|
7221
7503
|
);
|
|
7222
7504
|
staticUtility(
|
|
7223
7505
|
"-translate-x-px",
|
|
7224
|
-
|
|
7506
|
+
staticTranslateAxis("x", "-1px"),
|
|
7225
7507
|
{ category: "transform" }
|
|
7226
7508
|
);
|
|
7227
7509
|
staticUtility(
|
|
7228
7510
|
"translate-x-full",
|
|
7229
|
-
|
|
7511
|
+
staticTranslateAxis("x", "100%"),
|
|
7230
7512
|
{ category: "transform" }
|
|
7231
7513
|
);
|
|
7232
7514
|
staticUtility(
|
|
7233
7515
|
"-translate-x-full",
|
|
7234
|
-
|
|
7516
|
+
staticTranslateAxis("x", "-100%"),
|
|
7235
7517
|
{ category: "transform" }
|
|
7236
7518
|
);
|
|
7237
7519
|
staticUtility(
|
|
7238
7520
|
"translate-y-px",
|
|
7239
|
-
|
|
7521
|
+
staticTranslateAxis("y", "1px"),
|
|
7240
7522
|
{ category: "transform" }
|
|
7241
7523
|
);
|
|
7242
7524
|
staticUtility(
|
|
7243
7525
|
"-translate-y-px",
|
|
7244
|
-
|
|
7526
|
+
staticTranslateAxis("y", "-1px"),
|
|
7245
7527
|
{ category: "transform" }
|
|
7246
7528
|
);
|
|
7247
7529
|
staticUtility(
|
|
7248
7530
|
"translate-y-full",
|
|
7249
|
-
|
|
7531
|
+
staticTranslateAxis("y", "100%"),
|
|
7250
7532
|
{ category: "transform" }
|
|
7251
7533
|
);
|
|
7252
7534
|
staticUtility(
|
|
7253
7535
|
"-translate-y-full",
|
|
7254
|
-
|
|
7536
|
+
staticTranslateAxis("y", "-100%"),
|
|
7255
7537
|
{ category: "transform" }
|
|
7256
7538
|
);
|
|
7257
7539
|
staticUtility(
|
|
7258
7540
|
"translate-z-px",
|
|
7259
|
-
|
|
7541
|
+
staticTranslateAxis("z", "1px"),
|
|
7260
7542
|
{ category: "transform" }
|
|
7261
7543
|
);
|
|
7262
7544
|
staticUtility(
|
|
7263
7545
|
"-translate-z-px",
|
|
7264
|
-
|
|
7546
|
+
staticTranslateAxis("z", "-1px"),
|
|
7265
7547
|
{ category: "transform" }
|
|
7266
7548
|
);
|
|
7267
7549
|
functionalUtility({
|
|
@@ -7271,19 +7553,17 @@ functionalUtility({
|
|
|
7271
7553
|
supportsArbitrary: true,
|
|
7272
7554
|
supportsCustomProperty: true,
|
|
7273
7555
|
handle: (value, ctx, { negative }) => {
|
|
7274
|
-
if (parseFractionOrNumber(value)) {
|
|
7556
|
+
if (value.includes("/") && parseFractionOrNumber(value)) {
|
|
7275
7557
|
const v = `calc(${value} * 100%)`;
|
|
7276
|
-
return
|
|
7558
|
+
return translateAxis("x", v);
|
|
7277
7559
|
}
|
|
7278
7560
|
if (parseNumber(value) || negative) {
|
|
7279
7561
|
const v = `calc(var(--spacing) * ${value})`;
|
|
7280
|
-
return
|
|
7562
|
+
return translateAxis("x", v);
|
|
7281
7563
|
}
|
|
7282
|
-
return
|
|
7564
|
+
return translateAxis("x", value);
|
|
7283
7565
|
},
|
|
7284
|
-
handleCustomProperty: (value) =>
|
|
7285
|
-
decl("translate", `var(${value}) var(--baro-translate-y)`)
|
|
7286
|
-
],
|
|
7566
|
+
handleCustomProperty: (value) => translateAxis("x", `var(${value})`),
|
|
7287
7567
|
description: "translate-x utility (spacing, fraction, arbitrary, custom property, negative)",
|
|
7288
7568
|
category: "transform"
|
|
7289
7569
|
});
|
|
@@ -7294,19 +7574,17 @@ functionalUtility({
|
|
|
7294
7574
|
supportsArbitrary: true,
|
|
7295
7575
|
supportsCustomProperty: true,
|
|
7296
7576
|
handle: (value, ctx, { negative }) => {
|
|
7297
|
-
if (parseFractionOrNumber(value)) {
|
|
7577
|
+
if (value.includes("/") && parseFractionOrNumber(value)) {
|
|
7298
7578
|
const v = `calc(${value} * 100%)`;
|
|
7299
|
-
return
|
|
7579
|
+
return translateAxis("y", v);
|
|
7300
7580
|
}
|
|
7301
7581
|
if (parseNumber(value) || negative) {
|
|
7302
7582
|
const v = `calc(var(--spacing) * ${value})`;
|
|
7303
|
-
return
|
|
7583
|
+
return translateAxis("y", v);
|
|
7304
7584
|
}
|
|
7305
|
-
return
|
|
7585
|
+
return translateAxis("y", value);
|
|
7306
7586
|
},
|
|
7307
|
-
handleCustomProperty: (value) =>
|
|
7308
|
-
decl("translate", `var(--baro-translate-x) var(${value})`)
|
|
7309
|
-
],
|
|
7587
|
+
handleCustomProperty: (value) => translateAxis("y", `var(${value})`),
|
|
7310
7588
|
description: "translate-y utility (spacing, fraction, arbitrary, custom property, negative)",
|
|
7311
7589
|
category: "transform"
|
|
7312
7590
|
});
|
|
@@ -7317,37 +7595,17 @@ functionalUtility({
|
|
|
7317
7595
|
supportsArbitrary: true,
|
|
7318
7596
|
supportsCustomProperty: true,
|
|
7319
7597
|
handle: (value, ctx, { negative }) => {
|
|
7320
|
-
if (parseFractionOrNumber(value)) {
|
|
7598
|
+
if (value.includes("/") && parseFractionOrNumber(value)) {
|
|
7321
7599
|
const v = `calc(${value} * 100%)`;
|
|
7322
|
-
return
|
|
7323
|
-
decl(
|
|
7324
|
-
"translate",
|
|
7325
|
-
`var(--baro-translate-x) var(--baro-translate-y) ${v}`
|
|
7326
|
-
)
|
|
7327
|
-
];
|
|
7600
|
+
return translateAxis("z", v);
|
|
7328
7601
|
}
|
|
7329
7602
|
if (parseNumber(value) || negative) {
|
|
7330
7603
|
const v = `calc(var(--spacing) * ${value})`;
|
|
7331
|
-
return
|
|
7332
|
-
decl(
|
|
7333
|
-
"translate",
|
|
7334
|
-
`var(--baro-translate-x) var(--baro-translate-y) ${v}`
|
|
7335
|
-
)
|
|
7336
|
-
];
|
|
7604
|
+
return translateAxis("z", v);
|
|
7337
7605
|
}
|
|
7338
|
-
return
|
|
7339
|
-
decl(
|
|
7340
|
-
"translate",
|
|
7341
|
-
`var(--baro-translate-x) var(--baro-translate-y) ${value}`
|
|
7342
|
-
)
|
|
7343
|
-
];
|
|
7606
|
+
return translateAxis("z", value);
|
|
7344
7607
|
},
|
|
7345
|
-
handleCustomProperty: (value) =>
|
|
7346
|
-
decl(
|
|
7347
|
-
"translate",
|
|
7348
|
-
`var(--baro-translate-x) var(--baro-translate-y) var(${value})`
|
|
7349
|
-
)
|
|
7350
|
-
],
|
|
7608
|
+
handleCustomProperty: (value) => translateAxis("z", `var(${value})`),
|
|
7351
7609
|
description: "translate-z utility (spacing, fraction, arbitrary, custom property, negative)",
|
|
7352
7610
|
category: "transform"
|
|
7353
7611
|
});
|
|
@@ -7358,7 +7616,7 @@ functionalUtility({
|
|
|
7358
7616
|
supportsArbitrary: true,
|
|
7359
7617
|
supportsCustomProperty: true,
|
|
7360
7618
|
handle: (value, ctx, { negative }) => {
|
|
7361
|
-
if (parseFractionOrNumber(value)) {
|
|
7619
|
+
if (value.includes("/") && parseFractionOrNumber(value)) {
|
|
7362
7620
|
const v = `calc(${value} * 100%)`;
|
|
7363
7621
|
return [decl("translate", `${v} ${v}`)];
|
|
7364
7622
|
}
|
|
@@ -7523,8 +7781,13 @@ staticModifier("rtl", ["&[dir=rtl]"], { order: 20, source: "attribute" });
|
|
|
7523
7781
|
staticModifier("ltr", ["&[dir=ltr]"], { order: 20, source: "attribute" });
|
|
7524
7782
|
staticModifier("inert", ["&[inert]"], { order: 40, source: "attribute" });
|
|
7525
7783
|
staticModifier("open", ["&:is([open], :popover-open, :open)"], { order: 40, source: "attribute" });
|
|
7526
|
-
|
|
7527
|
-
|
|
7784
|
+
const withPseudoContent = (ast) => [
|
|
7785
|
+
atRoot([property("--baro-content", '""')]),
|
|
7786
|
+
...ast,
|
|
7787
|
+
decl("content", "var(--baro-content)")
|
|
7788
|
+
];
|
|
7789
|
+
staticModifier("before", ["&::before"], { source: "pseudo", astHandler: withPseudoContent });
|
|
7790
|
+
staticModifier("after", ["&::after"], { source: "pseudo", astHandler: withPseudoContent });
|
|
7528
7791
|
staticModifier("placeholder", [
|
|
7529
7792
|
"&::placeholder",
|
|
7530
7793
|
"&::-webkit-input-placeholder",
|
|
@@ -7557,9 +7820,6 @@ function createContainerParams(type, value, name) {
|
|
|
7557
7820
|
const condition = type === "min" ? "width >=" : "width <";
|
|
7558
7821
|
return name ? `${name} (${condition} ${value})` : `(${condition} ${value})`;
|
|
7559
7822
|
}
|
|
7560
|
-
function getThemeSize(ctx, key) {
|
|
7561
|
-
return ctx.theme("container." + key) || ctx.theme("breakpoint." + key);
|
|
7562
|
-
}
|
|
7563
7823
|
function createContainerRule(params, ast) {
|
|
7564
7824
|
return {
|
|
7565
7825
|
type: "at-rule",
|
|
@@ -7579,6 +7839,35 @@ function getDefaultBreakpoint(breakpoint) {
|
|
|
7579
7839
|
};
|
|
7580
7840
|
return defaults[breakpoint] || `(min-width: ${breakpoint})`;
|
|
7581
7841
|
}
|
|
7842
|
+
function decodeArbitrarySelector(value) {
|
|
7843
|
+
return value.replace(/\\_|_/g, (m) => m === "_" ? " " : "_");
|
|
7844
|
+
}
|
|
7845
|
+
function attributeVariantSelector(variant) {
|
|
7846
|
+
const bracket = /^(data|aria)-\[([a-zA-Z0-9_-]+)(?:=([^\]]+))?\]$/.exec(variant);
|
|
7847
|
+
if (bracket) {
|
|
7848
|
+
const [, kind, key, raw] = bracket;
|
|
7849
|
+
if (raw === void 0) return `[${kind}-${key}]`;
|
|
7850
|
+
const value = /^(["']).*\1$/.test(raw) ? raw : `"${decodeArbitrarySelector(raw)}"`;
|
|
7851
|
+
return `[${kind}-${key}=${value}]`;
|
|
7852
|
+
}
|
|
7853
|
+
const bare = /^data-([a-zA-Z0-9_-]+)$/.exec(variant);
|
|
7854
|
+
return bare ? `[data-${bare[1]}]` : void 0;
|
|
7855
|
+
}
|
|
7856
|
+
function functionalArgument(value) {
|
|
7857
|
+
const v = decodeArbitrarySelector(value);
|
|
7858
|
+
return /^[>+~]/.test(v.trim()) || !hasTopLevelComma(v) ? v : `*:is(${v})`;
|
|
7859
|
+
}
|
|
7860
|
+
function hasTopLevelComma(value) {
|
|
7861
|
+
let depth = 0;
|
|
7862
|
+
for (let i = 0; i < value.length; i++) {
|
|
7863
|
+
const c = value[i];
|
|
7864
|
+
if (c === "\\") i++;
|
|
7865
|
+
else if (c === "(" || c === "[") depth++;
|
|
7866
|
+
else if (c === ")" || c === "]") depth--;
|
|
7867
|
+
else if (c === "," && depth === 0) return true;
|
|
7868
|
+
}
|
|
7869
|
+
return false;
|
|
7870
|
+
}
|
|
7582
7871
|
functionalModifier(
|
|
7583
7872
|
(mod, context) => {
|
|
7584
7873
|
const breakpoints2 = context.theme("breakpoints") || context.config("theme.breakpoints") || {};
|
|
@@ -7609,7 +7898,7 @@ functionalModifier(
|
|
|
7609
7898
|
const breakpoints2 = context.theme("breakpoints") || context.config("theme.breakpoints") || {};
|
|
7610
7899
|
if (Object.keys(breakpoints2).includes(breakpoint)) {
|
|
7611
7900
|
let mediaQuery = context.theme(`breakpoints.${breakpoint}`) || getDefaultBreakpoint(breakpoint);
|
|
7612
|
-
if (/^\d+(px|em|rem)?$/.test(mediaQuery)) {
|
|
7901
|
+
if (/^\d*\.?\d+(px|em|rem)?$/.test(mediaQuery)) {
|
|
7613
7902
|
mediaQuery = `(min-width: ${mediaQuery})`;
|
|
7614
7903
|
}
|
|
7615
7904
|
return [atRule("media", mediaQuery, [], "responsive")];
|
|
@@ -7628,6 +7917,8 @@ functionalModifier(
|
|
|
7628
7917
|
if (value) {
|
|
7629
7918
|
mediaQuery = `(width < ${value})`;
|
|
7630
7919
|
}
|
|
7920
|
+
} else if (/^\d*\.?\d+(px|em|rem)?$/.test(mediaQuery)) {
|
|
7921
|
+
mediaQuery = `(width < ${mediaQuery})`;
|
|
7631
7922
|
}
|
|
7632
7923
|
return [atRule("media", mediaQuery, [], "responsive")];
|
|
7633
7924
|
}
|
|
@@ -7696,132 +7987,137 @@ functionalModifier(
|
|
|
7696
7987
|
return result;
|
|
7697
7988
|
}
|
|
7698
7989
|
);
|
|
7990
|
+
const SIZE_VARIANT = /^@(?:(min|max)-)?(\[[^\]]+\]|[a-zA-Z0-9.]+)(?:\/([a-zA-Z0-9_-]+))?$/;
|
|
7699
7991
|
functionalModifier(
|
|
7700
|
-
(mod) =>
|
|
7701
|
-
void 0,
|
|
7702
|
-
(mod, context) => {
|
|
7703
|
-
const containerMatch = /^@container\/([a-zA-Z0-9_-]+)$/.exec(mod.type);
|
|
7704
|
-
if (containerMatch) {
|
|
7705
|
-
const name = containerMatch[1];
|
|
7706
|
-
const params = name;
|
|
7707
|
-
return [createContainerRule(params, [])];
|
|
7708
|
-
}
|
|
7709
|
-
return [];
|
|
7710
|
-
}
|
|
7711
|
-
);
|
|
7712
|
-
functionalModifier(
|
|
7713
|
-
(mod) => /^@container\/([a-zA-Z0-9_-]+)\s+\(([^)]+)\)$/.test(mod),
|
|
7992
|
+
(mod) => SIZE_VARIANT.test(mod) && !/^@container(?:\/|$)/.test(mod),
|
|
7714
7993
|
void 0,
|
|
7715
7994
|
(mod, context) => {
|
|
7716
|
-
const
|
|
7717
|
-
if (
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
return [];
|
|
7995
|
+
const m = SIZE_VARIANT.exec(mod.type);
|
|
7996
|
+
if (!m) return [];
|
|
7997
|
+
const [, type, size, name] = m;
|
|
7998
|
+
const value = size.startsWith("[") ? size.slice(1, -1).replace(/_/g, " ") : context.theme("container." + size);
|
|
7999
|
+
if (!value) return [];
|
|
8000
|
+
return [createContainerRule(createContainerParams(type === "max" ? "max" : "min", value, name), [])];
|
|
7723
8001
|
}
|
|
7724
8002
|
);
|
|
8003
|
+
const startsAtRule = (bracket) => /^[\s_]*@/.test(bracket);
|
|
7725
8004
|
functionalModifier(
|
|
7726
|
-
(mod) =>
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
8005
|
+
(mod) => /^has-\[.*\]$/.test(mod) && !startsAtRule(mod.slice(5)),
|
|
8006
|
+
({ selector, mod }) => {
|
|
8007
|
+
const m = /^has-\[(.+)\]$/.exec(mod.type);
|
|
8008
|
+
return m ? {
|
|
8009
|
+
selector: `&:has(${functionalArgument(m[1])})`,
|
|
8010
|
+
flatten: false,
|
|
8011
|
+
wrappingType: "rule",
|
|
8012
|
+
source: "attribute"
|
|
8013
|
+
} : {
|
|
8014
|
+
selector,
|
|
8015
|
+
source: "attribute"
|
|
8016
|
+
};
|
|
8017
|
+
},
|
|
8018
|
+
void 0
|
|
7738
8019
|
);
|
|
7739
8020
|
functionalModifier(
|
|
7740
|
-
(mod) =>
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
return [createContainerRule(params, [])];
|
|
7749
|
-
}
|
|
7750
|
-
return [];
|
|
7751
|
-
}
|
|
8021
|
+
(mod) => /^has-(data|aria)-/.test(mod) && !!attributeVariantSelector(mod.slice(4)),
|
|
8022
|
+
({ mod }) => ({
|
|
8023
|
+
selector: `&:has(*${attributeVariantSelector(mod.type.slice(4))})`,
|
|
8024
|
+
flatten: false,
|
|
8025
|
+
wrappingType: "rule",
|
|
8026
|
+
source: "attribute"
|
|
8027
|
+
}),
|
|
8028
|
+
void 0
|
|
7752
8029
|
);
|
|
8030
|
+
function innerCompound(variant, ctx) {
|
|
8031
|
+
const attr = attributeVariantSelector(variant);
|
|
8032
|
+
if (attr) return { compound: attr };
|
|
8033
|
+
if (/^(has|in|not|group|peer)-|[^a-z0-9-]/.test(variant)) return void 0;
|
|
8034
|
+
const inner = getModifier(ctx).find((m) => m.match(variant, ctx));
|
|
8035
|
+
if (!inner?.modifySelector || inner.astHandler) return void 0;
|
|
8036
|
+
const out = inner.modifySelector({ selector: "&", fullClassName: "", mod: { type: variant }, context: ctx });
|
|
8037
|
+
const list = typeof out === "string" ? [{ selector: out }] : Array.isArray(out) ? out : [out];
|
|
8038
|
+
if (list.length !== 1) return void 0;
|
|
8039
|
+
const sel = list[0].selector;
|
|
8040
|
+
if (!/^&[:[]/.test(sel) || sel.slice(1).includes("&") || /[\s,>+~]/.test(sel.replace(/\([^()]*\)/g, ""))) return void 0;
|
|
8041
|
+
return { compound: sel.slice(1), inner };
|
|
8042
|
+
}
|
|
8043
|
+
function resolveHasIn(mod, ctx) {
|
|
8044
|
+
const m = /^(has|in)-(.+)$/.exec(mod);
|
|
8045
|
+
if (!m) return void 0;
|
|
8046
|
+
const [, kind, v] = m;
|
|
8047
|
+
if (kind === "in" && /^\[.+\]$/.test(v)) {
|
|
8048
|
+
if (startsAtRule(v.slice(1))) return void 0;
|
|
8049
|
+
const sel = decodeArbitrarySelector(v.slice(1, -1));
|
|
8050
|
+
return { kind, compound: sel.startsWith("&") ? sel.slice(1) : `:is(${sel})` };
|
|
8051
|
+
}
|
|
8052
|
+
if (kind === "has" && (v.startsWith("[") || /^(data|aria)-/.test(v))) return void 0;
|
|
8053
|
+
const r = innerCompound(v, ctx);
|
|
8054
|
+
return r && { kind, ...r };
|
|
8055
|
+
}
|
|
8056
|
+
const hasInSelector = ({ selector, mod, context }) => {
|
|
8057
|
+
const r = resolveHasIn(mod.type, context);
|
|
8058
|
+
if (!r) return { selector };
|
|
8059
|
+
return {
|
|
8060
|
+
selector: r.kind === "has" ? `&:has(*${r.compound})` : `:where(*${r.compound}) &`,
|
|
8061
|
+
flatten: false,
|
|
8062
|
+
wrappingType: "rule",
|
|
8063
|
+
source: "attribute"
|
|
8064
|
+
};
|
|
8065
|
+
};
|
|
7753
8066
|
functionalModifier(
|
|
7754
|
-
(mod) =>
|
|
7755
|
-
|
|
7756
|
-
(mod, context) => {
|
|
7757
|
-
const themeSizeMatch = /^@max-(sm|md|lg|xl|2xl)$/.exec(mod.type);
|
|
7758
|
-
if (themeSizeMatch) {
|
|
7759
|
-
const size = themeSizeMatch[1];
|
|
7760
|
-
const sizeValue = getThemeSize(context, size) || size;
|
|
7761
|
-
const params = createContainerParams("max", sizeValue);
|
|
7762
|
-
return [createContainerRule(params, [])];
|
|
7763
|
-
}
|
|
7764
|
-
return [];
|
|
7765
|
-
}
|
|
8067
|
+
(mod, ctx) => !!resolveHasIn(mod, ctx)?.inner?.wrap,
|
|
8068
|
+
hasInSelector,
|
|
8069
|
+
(mod, context) => resolveHasIn(mod.type, context).inner.wrap({ ...mod, type: mod.type.replace(/^(has|in)-/, "") }, context)
|
|
7766
8070
|
);
|
|
7767
8071
|
functionalModifier(
|
|
7768
|
-
(mod) =>
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
const [, type, value] = arbitraryMatch;
|
|
7774
|
-
const params = createContainerParams(type, value);
|
|
7775
|
-
return [createContainerRule(params, [])];
|
|
7776
|
-
}
|
|
7777
|
-
return [];
|
|
7778
|
-
}
|
|
8072
|
+
(mod, ctx) => {
|
|
8073
|
+
const r = resolveHasIn(mod, ctx);
|
|
8074
|
+
return !!r && !r.inner?.wrap;
|
|
8075
|
+
},
|
|
8076
|
+
hasInSelector
|
|
7779
8077
|
);
|
|
8078
|
+
function resolveGroupHas(mod, ctx) {
|
|
8079
|
+
const m = /^(group|peer)-has-(.+?)(?:\/([a-zA-Z0-9_-]+))?$/.exec(mod);
|
|
8080
|
+
if (!m) return void 0;
|
|
8081
|
+
const kind = m[1];
|
|
8082
|
+
const v = m[2];
|
|
8083
|
+
const base = m[3] ? `.${kind}\\/${m[3]}` : `.${kind}`;
|
|
8084
|
+
if (/^\[.+\]$/.test(v)) {
|
|
8085
|
+
if (startsAtRule(v.slice(1))) return void 0;
|
|
8086
|
+
const sel = decodeArbitrarySelector(v.slice(1, -1));
|
|
8087
|
+
return { kind, base, v, arg: /^[>+~]/.test(sel.trim()) ? sel : `*:is(${sel})` };
|
|
8088
|
+
}
|
|
8089
|
+
const r = innerCompound(v, ctx);
|
|
8090
|
+
return r && { kind, base, v, arg: `*${r.compound}`, inner: r.inner };
|
|
8091
|
+
}
|
|
8092
|
+
const groupHasSelector = ({ selector, mod, context }) => {
|
|
8093
|
+
const r = resolveGroupHas(mod.type, context);
|
|
8094
|
+
if (!r) return { selector };
|
|
8095
|
+
const tail = r.kind === "group" ? " *" : " ~ *";
|
|
8096
|
+
return { selector: `&:is(:where(${r.base}):has(${r.arg})${tail})`, wrappingType: "rule", source: r.kind };
|
|
8097
|
+
};
|
|
7780
8098
|
functionalModifier(
|
|
7781
|
-
(mod) =>
|
|
7782
|
-
|
|
8099
|
+
(mod, ctx) => !!resolveGroupHas(mod, ctx)?.inner?.wrap,
|
|
8100
|
+
groupHasSelector,
|
|
7783
8101
|
(mod, context) => {
|
|
7784
|
-
const
|
|
7785
|
-
|
|
7786
|
-
const [, type, value, name] = arbitraryNamedMatch;
|
|
7787
|
-
const params = createContainerParams(type, value, name);
|
|
7788
|
-
return [createContainerRule(params, [])];
|
|
7789
|
-
}
|
|
7790
|
-
return [];
|
|
8102
|
+
const r = resolveGroupHas(mod.type, context);
|
|
8103
|
+
return r.inner.wrap({ ...mod, type: r.v }, context);
|
|
7791
8104
|
}
|
|
7792
8105
|
);
|
|
7793
8106
|
functionalModifier(
|
|
7794
|
-
(mod) =>
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
if (m && m[1].startsWith(".")) {
|
|
7798
|
-
return {
|
|
7799
|
-
selector: `&:has(${m[1]})`,
|
|
7800
|
-
flatten: false,
|
|
7801
|
-
wrappingType: "rule",
|
|
7802
|
-
source: "attribute"
|
|
7803
|
-
};
|
|
7804
|
-
}
|
|
7805
|
-
return m ? {
|
|
7806
|
-
selector: `&:has(${m[1]})`,
|
|
7807
|
-
flatten: false,
|
|
7808
|
-
wrappingType: "rule",
|
|
7809
|
-
source: "attribute"
|
|
7810
|
-
} : {
|
|
7811
|
-
selector,
|
|
7812
|
-
source: "attribute"
|
|
7813
|
-
};
|
|
8107
|
+
(mod, ctx) => {
|
|
8108
|
+
const r = resolveGroupHas(mod, ctx);
|
|
8109
|
+
return !!r && !r.inner?.wrap;
|
|
7814
8110
|
},
|
|
7815
|
-
|
|
8111
|
+
groupHasSelector
|
|
7816
8112
|
);
|
|
7817
8113
|
functionalModifier(
|
|
7818
8114
|
(mod) => /^not-\[.*\]$/.test(mod),
|
|
7819
8115
|
({ selector, mod }) => {
|
|
7820
8116
|
const m = /^not-\[(.+)\]$/.exec(mod.type);
|
|
7821
8117
|
if (m) {
|
|
7822
|
-
if (m[1]
|
|
8118
|
+
if (!/^[a-zA-Z0-9_-]+(=.+)?$/.test(m[1])) {
|
|
7823
8119
|
return {
|
|
7824
|
-
selector: `&:not(${m[1]})`,
|
|
8120
|
+
selector: `&:not(${functionalArgument(m[1])})`,
|
|
7825
8121
|
flatten: false,
|
|
7826
8122
|
wrappingType: "rule",
|
|
7827
8123
|
source: "attribute"
|
|
@@ -7854,27 +8150,14 @@ functionalModifier(
|
|
|
7854
8150
|
);
|
|
7855
8151
|
functionalModifier(
|
|
7856
8152
|
(mod) => mod === "*",
|
|
7857
|
-
(
|
|
7858
|
-
|
|
7859
|
-
return {
|
|
7860
|
-
selector: `:is(.${escapeClassName(fullClassName)} > *)`,
|
|
7861
|
-
flatten: true,
|
|
7862
|
-
wrappingType: isSingle ? "rule" : "style-rule",
|
|
7863
|
-
source: "universal"
|
|
7864
|
-
};
|
|
8153
|
+
() => {
|
|
8154
|
+
return { selector: ":is(& > *)", wrappingType: "rule", source: "universal" };
|
|
7865
8155
|
},
|
|
7866
8156
|
void 0
|
|
7867
8157
|
);
|
|
7868
8158
|
functionalModifier(
|
|
7869
8159
|
(mod) => mod === "**",
|
|
7870
|
-
({ selector,
|
|
7871
|
-
return {
|
|
7872
|
-
selector: `:is(.${escapeClassName(fullClassName)} *)`,
|
|
7873
|
-
flatten: false,
|
|
7874
|
-
wrappingType: "style-rule",
|
|
7875
|
-
source: "universal"
|
|
7876
|
-
};
|
|
7877
|
-
},
|
|
8160
|
+
() => ({ selector: ":is(& *)", wrappingType: "rule", source: "universal" }),
|
|
7878
8161
|
void 0
|
|
7879
8162
|
);
|
|
7880
8163
|
functionalModifier(
|
|
@@ -7882,17 +8165,14 @@ functionalModifier(
|
|
|
7882
8165
|
({ selector, mod }) => {
|
|
7883
8166
|
const m = /^\[(.+)\]$/.exec(mod.type);
|
|
7884
8167
|
if (!m) return { selector };
|
|
7885
|
-
const inner = m[1].trim();
|
|
8168
|
+
const inner = decodeArbitrarySelector(m[1]).trim();
|
|
7886
8169
|
if (/^[a-zA-Z0-9_-]+(=.+)?$/.test(inner)) {
|
|
7887
8170
|
return { selector: `&[${inner}]`, wrappingType: "rule", source: "attribute" };
|
|
7888
8171
|
}
|
|
7889
|
-
if (inner === "&>*") {
|
|
7890
|
-
return { selector: `${inner}`, wrappingType: "style-rule", source: "peer" };
|
|
7891
|
-
}
|
|
7892
8172
|
if (inner.startsWith("&")) {
|
|
7893
8173
|
return { selector: `${inner}`, wrappingType: "rule", source: "pseudo" };
|
|
7894
8174
|
}
|
|
7895
|
-
return { selector:
|
|
8175
|
+
return { selector: `&:is(${inner})`, wrappingType: "rule", source: "base" };
|
|
7896
8176
|
},
|
|
7897
8177
|
void 0
|
|
7898
8178
|
);
|
|
@@ -7936,7 +8216,7 @@ functionalModifier(
|
|
|
7936
8216
|
};
|
|
7937
8217
|
} else {
|
|
7938
8218
|
return {
|
|
7939
|
-
selector: `&:not(${inner})`,
|
|
8219
|
+
selector: `&:not(${functionalArgument(inner)})`,
|
|
7940
8220
|
source: "attribute"
|
|
7941
8221
|
};
|
|
7942
8222
|
}
|
|
@@ -8087,29 +8367,56 @@ functionalModifier(
|
|
|
8087
8367
|
return m ? [atRule("scope", m[1], [])] : [];
|
|
8088
8368
|
}
|
|
8089
8369
|
);
|
|
8370
|
+
const atRuleHas = (mod) => /^(group|peer)-has-\[/.test(mod) && startsAtRule(mod.slice(mod.indexOf("[") + 1));
|
|
8371
|
+
function splitGroupName(kind, variant) {
|
|
8372
|
+
const named = /^(.+)\/([a-zA-Z0-9_-]+)$/.exec(variant);
|
|
8373
|
+
return named ? [named[1], `.${kind}\\/${named[2]}`] : [variant, `.${kind}`];
|
|
8374
|
+
}
|
|
8375
|
+
functionalModifier(
|
|
8376
|
+
(mod) => /^(group|peer)-hover(\/[a-zA-Z0-9_-]+)?$/.test(mod),
|
|
8377
|
+
({ mod }) => {
|
|
8378
|
+
const kind = mod.type.startsWith("group") ? "group" : "peer";
|
|
8379
|
+
const [, base] = splitGroupName(kind, mod.type.slice(kind.length + 1));
|
|
8380
|
+
const tail = kind === "group" ? " *" : " ~ *";
|
|
8381
|
+
return { selector: `&:is(:where(${base}):hover${tail})`, wrappingType: "rule", source: kind };
|
|
8382
|
+
},
|
|
8383
|
+
() => [atRule("media", "(hover: hover)", [])]
|
|
8384
|
+
);
|
|
8385
|
+
function negated(value) {
|
|
8386
|
+
const v = value.slice(4);
|
|
8387
|
+
return v.startsWith("[") && v.endsWith("]") ? `:not(*:is(${decodeArbitrarySelector(v.slice(1, -1))}))` : `:not(:${v})`;
|
|
8388
|
+
}
|
|
8090
8389
|
functionalModifier(
|
|
8091
|
-
(mod) => /^group-(.+)$/.test(mod),
|
|
8390
|
+
(mod) => /^group-(.+)$/.test(mod) && !atRuleHas(mod),
|
|
8092
8391
|
({ selector, mod }) => {
|
|
8093
|
-
const
|
|
8392
|
+
const raw = /^group-(.+)$/.exec(mod.type);
|
|
8393
|
+
const [variant, base] = splitGroupName("group", raw?.[1] ?? "");
|
|
8394
|
+
const m = raw ? [raw[0], variant] : null;
|
|
8395
|
+
const g = `:where(${base})`;
|
|
8396
|
+
const attr = m ? attributeVariantSelector(m[1]) : void 0;
|
|
8397
|
+
if (attr) return { selector: `&:is(${g}${attr} *)`, wrappingType: "rule", source: "group" };
|
|
8094
8398
|
if (m?.[1].startsWith("[") && m?.[1].endsWith("]")) {
|
|
8095
8399
|
const value = m?.[1].slice(1, -1).replace(/_/g, "");
|
|
8096
8400
|
return {
|
|
8097
|
-
selector: `&:is(:
|
|
8401
|
+
selector: `&:is(${g}:is(${value}) *)`,
|
|
8098
8402
|
wrappingType: "rule",
|
|
8099
8403
|
source: "group"
|
|
8100
8404
|
};
|
|
8101
8405
|
}
|
|
8406
|
+
if (m?.[1]?.startsWith("not-")) {
|
|
8407
|
+
return { selector: `&:is(${g}${negated(m[1])} *)`, wrappingType: "rule", source: "group" };
|
|
8408
|
+
}
|
|
8102
8409
|
if (m?.[1]?.startsWith("has-")) {
|
|
8103
8410
|
const pattern = /^has-\[([a-zA-Z0-9_-]+)\]$/.exec(m?.[1]);
|
|
8104
8411
|
if (pattern) {
|
|
8105
8412
|
const value = pattern[1];
|
|
8106
8413
|
return {
|
|
8107
|
-
selector: `&:is(:
|
|
8414
|
+
selector: `&:is(${g}:has(:is(${value})) *)`,
|
|
8108
8415
|
source: "group"
|
|
8109
8416
|
};
|
|
8110
8417
|
}
|
|
8111
8418
|
return {
|
|
8112
|
-
selector: `&:is(:
|
|
8419
|
+
selector: `&:is(${g}:has(${functionalArgument(m[1].slice(5, -1))}) *)`,
|
|
8113
8420
|
source: "group"
|
|
8114
8421
|
};
|
|
8115
8422
|
}
|
|
@@ -8119,19 +8426,19 @@ functionalModifier(
|
|
|
8119
8426
|
const value = pattern[1];
|
|
8120
8427
|
if (pattern[2]) {
|
|
8121
8428
|
return {
|
|
8122
|
-
selector: `&:is(
|
|
8429
|
+
selector: `&:is(${g}[aria-${value}="${pattern[2]}"] *)`,
|
|
8123
8430
|
source: "group"
|
|
8124
8431
|
};
|
|
8125
8432
|
} else {
|
|
8126
8433
|
return {
|
|
8127
|
-
selector: `&:is(
|
|
8434
|
+
selector: `&:is(${g}[aria-${value}] *)`,
|
|
8128
8435
|
source: "group"
|
|
8129
8436
|
};
|
|
8130
8437
|
}
|
|
8131
8438
|
}
|
|
8132
8439
|
}
|
|
8133
8440
|
return m ? {
|
|
8134
|
-
selector: `&:is(
|
|
8441
|
+
selector: `&:is(${g}:${m[1]} *)`,
|
|
8135
8442
|
wrappingType: "rule",
|
|
8136
8443
|
source: "group"
|
|
8137
8444
|
} : {
|
|
@@ -8142,27 +8449,35 @@ functionalModifier(
|
|
|
8142
8449
|
void 0
|
|
8143
8450
|
);
|
|
8144
8451
|
functionalModifier(
|
|
8145
|
-
(mod) => /^peer-(.+)$/.test(mod),
|
|
8452
|
+
(mod) => /^peer-(.+)$/.test(mod) && !atRuleHas(mod),
|
|
8146
8453
|
({ selector, mod }) => {
|
|
8147
|
-
const
|
|
8454
|
+
const raw = /^peer-(.+)$/.exec(mod.type);
|
|
8455
|
+
const [variant, base] = splitGroupName("peer", raw?.[1] ?? "");
|
|
8456
|
+
const m = raw ? [raw[0], variant] : null;
|
|
8457
|
+
const g = `:where(${base})`;
|
|
8458
|
+
const attr = m ? attributeVariantSelector(m[1]) : void 0;
|
|
8459
|
+
if (attr) return { selector: `&:is(${g}${attr} ~ *)`, wrappingType: "rule", source: "peer" };
|
|
8148
8460
|
if (m?.[1].startsWith("[") && m?.[1].endsWith("]")) {
|
|
8149
8461
|
const value2 = m?.[1].slice(1, -1).replace(/_/g, "");
|
|
8150
8462
|
return {
|
|
8151
|
-
selector: `&:is(:
|
|
8463
|
+
selector: `&:is(${g}:is(${value2})~*)`,
|
|
8152
8464
|
wrappingType: "rule",
|
|
8153
8465
|
source: "peer"
|
|
8154
8466
|
};
|
|
8155
8467
|
}
|
|
8156
8468
|
const value = m?.[1];
|
|
8469
|
+
if (value?.startsWith("has-[") && value.endsWith("]")) {
|
|
8470
|
+
return { selector: `&:is(${g}:has(${functionalArgument(value.slice(5, -1))}) ~ *)`, source: "peer" };
|
|
8471
|
+
}
|
|
8157
8472
|
if (value?.startsWith("has-")) {
|
|
8158
8473
|
return {
|
|
8159
|
-
selector: `&:is(:
|
|
8474
|
+
selector: `&:is(${g}:has(:${value.slice(4)})~*)`,
|
|
8160
8475
|
source: "peer"
|
|
8161
8476
|
};
|
|
8162
8477
|
}
|
|
8163
8478
|
if (value?.startsWith("not-")) {
|
|
8164
8479
|
return {
|
|
8165
|
-
selector: `&:is(
|
|
8480
|
+
selector: `&:is(${g}${negated(value)} ~ *)`,
|
|
8166
8481
|
source: "peer"
|
|
8167
8482
|
};
|
|
8168
8483
|
}
|
|
@@ -8171,7 +8486,7 @@ functionalModifier(
|
|
|
8171
8486
|
if (pattern) {
|
|
8172
8487
|
const key = pattern[1];
|
|
8173
8488
|
return {
|
|
8174
|
-
selector: `&:is(
|
|
8489
|
+
selector: `&:is(${g}[aria-${key}]~*)`,
|
|
8175
8490
|
source: "peer"
|
|
8176
8491
|
};
|
|
8177
8492
|
}
|
|
@@ -8181,19 +8496,19 @@ functionalModifier(
|
|
|
8181
8496
|
const value2 = pattern[2];
|
|
8182
8497
|
if (pattern[2]) {
|
|
8183
8498
|
return {
|
|
8184
|
-
selector: `&:is(
|
|
8499
|
+
selector: `&:is(${g}[aria-${key}="${value2}"]~*)`,
|
|
8185
8500
|
source: "peer"
|
|
8186
8501
|
};
|
|
8187
8502
|
} else {
|
|
8188
8503
|
return {
|
|
8189
|
-
selector: `&:is(
|
|
8504
|
+
selector: `&:is(${g}[aria-${key}]~*)`,
|
|
8190
8505
|
source: "peer"
|
|
8191
8506
|
};
|
|
8192
8507
|
}
|
|
8193
8508
|
}
|
|
8194
8509
|
}
|
|
8195
8510
|
return m ? {
|
|
8196
|
-
selector: `&:is(
|
|
8511
|
+
selector: `&:is(${g}:${value}~*)`,
|
|
8197
8512
|
source: "peer"
|
|
8198
8513
|
} : {
|
|
8199
8514
|
selector,
|
|
@@ -8244,8 +8559,53 @@ functionalModifier(
|
|
|
8244
8559
|
},
|
|
8245
8560
|
void 0
|
|
8246
8561
|
);
|
|
8562
|
+
const LEADING_AT = /^\s*@(media|container)\s+([^{]*)\{/;
|
|
8563
|
+
const LATE_MEDIA = /prefers-color-scheme|\bprint\b|forced-colors|orientation/;
|
|
8564
|
+
const MIN_W = /(?:min-width\s*:\s*|width\s*>=?\s*)([\d.]+)(px|rem|em)?/;
|
|
8565
|
+
const MAX_W = /(?:max-width\s*:\s*|width\s*<=?\s*)([\d.]+)(px|rem|em)?/;
|
|
8566
|
+
function toPx(n, unit) {
|
|
8567
|
+
const v = parseFloat(n);
|
|
8568
|
+
return unit === "rem" || unit === "em" ? v * 16 : v;
|
|
8569
|
+
}
|
|
8570
|
+
function preludeKey(kind, prelude) {
|
|
8571
|
+
const container2 = kind === "container";
|
|
8572
|
+
const min = MIN_W.exec(prelude);
|
|
8573
|
+
if (min) return [container2 ? 4 : 2, toPx(min[1], min[2])];
|
|
8574
|
+
const max = MAX_W.exec(prelude);
|
|
8575
|
+
if (max) return [container2 ? 3 : 1, -toPx(max[1], max[2])];
|
|
8576
|
+
if (!container2 && LATE_MEDIA.test(prelude)) return [5, 0];
|
|
8577
|
+
return [0, 0];
|
|
8578
|
+
}
|
|
8579
|
+
function ruleSortKey(rule2) {
|
|
8580
|
+
const key = [];
|
|
8581
|
+
let rest = rule2;
|
|
8582
|
+
let m;
|
|
8583
|
+
while (m = LEADING_AT.exec(rest)) {
|
|
8584
|
+
const [g, v] = preludeKey(m[1], m[2]);
|
|
8585
|
+
key.push(g, v);
|
|
8586
|
+
rest = rest.slice(m[0].length);
|
|
8587
|
+
}
|
|
8588
|
+
return key;
|
|
8589
|
+
}
|
|
8590
|
+
function compareKeys(a, b) {
|
|
8591
|
+
const n = Math.min(a.length, b.length);
|
|
8592
|
+
for (let i = 0; i < n; i++) {
|
|
8593
|
+
if (a[i] !== b[i]) return a[i] - b[i];
|
|
8594
|
+
}
|
|
8595
|
+
return a.length - b.length;
|
|
8596
|
+
}
|
|
8597
|
+
function upperBound(keys, key) {
|
|
8598
|
+
let lo = 0;
|
|
8599
|
+
let hi = keys.length;
|
|
8600
|
+
while (lo < hi) {
|
|
8601
|
+
const mid = lo + hi >> 1;
|
|
8602
|
+
if (compareKeys(keys[mid], key) <= 0) lo = mid + 1;
|
|
8603
|
+
else hi = mid;
|
|
8604
|
+
}
|
|
8605
|
+
return lo;
|
|
8606
|
+
}
|
|
8247
8607
|
class StylePartitionManager {
|
|
8248
|
-
constructor(insertionPoint, maxRulesPerPartition = 50, styleIdPrefix = "barocss-style-partition-") {
|
|
8608
|
+
constructor(insertionPoint, maxRulesPerPartition = 50, styleIdPrefix = "barocss-style-partition-", getCategory = (cls) => parseClassName(cls).utility?.category) {
|
|
8249
8609
|
this.partitions = [];
|
|
8250
8610
|
this.categoryPartitions = /* @__PURE__ */ new Map();
|
|
8251
8611
|
this.partitionCounter = 0;
|
|
@@ -8256,12 +8616,30 @@ class StylePartitionManager {
|
|
|
8256
8616
|
this.insertionPoint = insertionPoint;
|
|
8257
8617
|
this.maxRulesPerPartition = maxRulesPerPartition;
|
|
8258
8618
|
this.styleIdPrefix = styleIdPrefix;
|
|
8619
|
+
this.getCategory = getCategory;
|
|
8259
8620
|
this.initializeDefaultPartition();
|
|
8260
8621
|
}
|
|
8622
|
+
/**
|
|
8623
|
+
* Insert `rule` at its Tailwind variant position within `partition` (#254):
|
|
8624
|
+
* one insertRule at a binary-searched index, no sheet rewrite.
|
|
8625
|
+
*/
|
|
8626
|
+
insertSorted(partition, rule2, key) {
|
|
8627
|
+
const keys = partition.keys ??= [];
|
|
8628
|
+
const index = upperBound(keys, key);
|
|
8629
|
+
const sheet = partition.styleElement.sheet;
|
|
8630
|
+
if (sheet && sheet.cssRules.length === keys.length) {
|
|
8631
|
+
sheet.insertRule(this.escapeCssRule(rule2), index);
|
|
8632
|
+
partition.styles.splice(index, 0, rule2);
|
|
8633
|
+
} else {
|
|
8634
|
+
partition.styles.splice(index, 0, rule2);
|
|
8635
|
+
partition.styleElement.textContent = partition.styles.join("\n") + "\n";
|
|
8636
|
+
}
|
|
8637
|
+
keys.splice(index, 0, key);
|
|
8638
|
+
}
|
|
8261
8639
|
initializeDefaultPartition() {
|
|
8262
8640
|
this.createNewPartition();
|
|
8263
8641
|
}
|
|
8264
|
-
createNewCategoryPartition(category) {
|
|
8642
|
+
createNewCategoryPartition(category, atDocumentStart = false) {
|
|
8265
8643
|
const newPartition = {
|
|
8266
8644
|
id: this.styleIdPrefix + `-${category}`,
|
|
8267
8645
|
styles: [],
|
|
@@ -8270,7 +8648,12 @@ class StylePartitionManager {
|
|
|
8270
8648
|
newPartition.styleElement.id = newPartition.id;
|
|
8271
8649
|
newPartition.styleElement.setAttribute("data-barocss", "partition");
|
|
8272
8650
|
newPartition.styleElement.setAttribute("data-category", category);
|
|
8273
|
-
this.insertionPoint.
|
|
8651
|
+
const head = this.insertionPoint.ownerDocument?.head;
|
|
8652
|
+
if (atDocumentStart && head) {
|
|
8653
|
+
head.insertBefore(newPartition.styleElement, head.firstChild);
|
|
8654
|
+
} else {
|
|
8655
|
+
this.insertionPoint.appendChild(newPartition.styleElement);
|
|
8656
|
+
}
|
|
8274
8657
|
this.categoryPartitions.set(category, newPartition);
|
|
8275
8658
|
return newPartition;
|
|
8276
8659
|
}
|
|
@@ -8324,20 +8707,21 @@ class StylePartitionManager {
|
|
|
8324
8707
|
if (this.hasRule(rule2)) {
|
|
8325
8708
|
return false;
|
|
8326
8709
|
}
|
|
8327
|
-
|
|
8328
|
-
|
|
8710
|
+
const key = ruleSortKey(rule2);
|
|
8711
|
+
let partitionIndex = this.partitions.findIndex((p) => {
|
|
8712
|
+
const keys = p.keys;
|
|
8713
|
+
return !!keys && keys.length > 0 && compareKeys(keys[keys.length - 1], key) > 0;
|
|
8714
|
+
});
|
|
8715
|
+
if (partitionIndex === -1) {
|
|
8716
|
+
if (this.currentPartition.styles.length >= this.maxRulesPerPartition) {
|
|
8717
|
+
this.createNewPartition();
|
|
8718
|
+
}
|
|
8719
|
+
partitionIndex = this.partitions.length - 1;
|
|
8329
8720
|
}
|
|
8330
|
-
const
|
|
8331
|
-
const partitionIndex = this.partitions.length - 1;
|
|
8721
|
+
const partition = this.partitions[partitionIndex];
|
|
8332
8722
|
try {
|
|
8333
|
-
|
|
8334
|
-
if (sheet) {
|
|
8335
|
-
sheet.insertRule(this.escapeCssRule(rule2), sheet.cssRules.length);
|
|
8336
|
-
} else {
|
|
8337
|
-
currentPartition.styleElement.textContent += rule2 + "\n";
|
|
8338
|
-
}
|
|
8723
|
+
this.insertSorted(partition, rule2, key);
|
|
8339
8724
|
this.setRuleCache(rule2, partitionIndex);
|
|
8340
|
-
currentPartition.styles.push(rule2);
|
|
8341
8725
|
return true;
|
|
8342
8726
|
} catch (error) {
|
|
8343
8727
|
console.warn(
|
|
@@ -8356,12 +8740,7 @@ class StylePartitionManager {
|
|
|
8356
8740
|
categoryPartition = this.createNewCategoryPartition(category);
|
|
8357
8741
|
}
|
|
8358
8742
|
try {
|
|
8359
|
-
|
|
8360
|
-
if (sheet) {
|
|
8361
|
-
sheet.insertRule(this.escapeCssRule(rule2), sheet.cssRules.length);
|
|
8362
|
-
} else {
|
|
8363
|
-
categoryPartition.styleElement.textContent += rule2 + "\n";
|
|
8364
|
-
}
|
|
8743
|
+
this.insertSorted(categoryPartition, rule2, ruleSortKey(rule2));
|
|
8365
8744
|
} catch (error) {
|
|
8366
8745
|
console.warn(
|
|
8367
8746
|
`[StylePartitionManager] Failed to insert rule in category: ${category} ${rule2}`,
|
|
@@ -8370,7 +8749,6 @@ class StylePartitionManager {
|
|
|
8370
8749
|
return false;
|
|
8371
8750
|
}
|
|
8372
8751
|
this.setCategoryRuleCache(rule2, category);
|
|
8373
|
-
categoryPartition.styles.push(rule2);
|
|
8374
8752
|
return true;
|
|
8375
8753
|
}
|
|
8376
8754
|
addRootRules(rules) {
|
|
@@ -8400,8 +8778,7 @@ class StylePartitionManager {
|
|
|
8400
8778
|
let success = 0;
|
|
8401
8779
|
let failed = 0;
|
|
8402
8780
|
for (const rule2 of rules) {
|
|
8403
|
-
const
|
|
8404
|
-
const category = parsedResult?.utility?.category;
|
|
8781
|
+
const category = this.getCategory(rule2.cls);
|
|
8405
8782
|
if (category) {
|
|
8406
8783
|
for (const css of rule2.cssList) {
|
|
8407
8784
|
this.addCategoryRule(css, category);
|
|
@@ -8432,12 +8809,12 @@ class StylePartitionManager {
|
|
|
8432
8809
|
}
|
|
8433
8810
|
return null;
|
|
8434
8811
|
}
|
|
8435
|
-
updateRuleContent(category, ruleContent) {
|
|
8812
|
+
updateRuleContent(category, ruleContent, atDocumentStart = false) {
|
|
8436
8813
|
const partition = this.getCategoryPartition(category);
|
|
8437
8814
|
if (partition) {
|
|
8438
8815
|
partition.styleElement.textContent = ruleContent;
|
|
8439
8816
|
} else {
|
|
8440
|
-
const newPartition = this.createNewCategoryPartition(category);
|
|
8817
|
+
const newPartition = this.createNewCategoryPartition(category, atDocumentStart);
|
|
8441
8818
|
console.log(`[StylePartitionManager] Created new partition for category: ${category}`);
|
|
8442
8819
|
newPartition.styleElement.textContent = ruleContent;
|
|
8443
8820
|
}
|
|
@@ -8465,8 +8842,8 @@ class StylePartitionManager {
|
|
|
8465
8842
|
}
|
|
8466
8843
|
function normalizeClassName(className) {
|
|
8467
8844
|
if (!className) return "";
|
|
8468
|
-
if (className
|
|
8469
|
-
return className.baseVal
|
|
8845
|
+
if (typeof className === "object" && typeof className.baseVal === "string") {
|
|
8846
|
+
return className.baseVal;
|
|
8470
8847
|
}
|
|
8471
8848
|
return className.toString();
|
|
8472
8849
|
}
|
|
@@ -8481,10 +8858,11 @@ class ChangeDetector {
|
|
|
8481
8858
|
* @param incrementalParser - IncrementalParser instance for class processing
|
|
8482
8859
|
* @param BrowserRuntime - Optional BrowserRuntime instance for CSS injection
|
|
8483
8860
|
*/
|
|
8484
|
-
constructor(incrementalParser, BrowserRuntime2) {
|
|
8861
|
+
constructor(incrementalParser, BrowserRuntime2, getCategory = (cls) => parseClassName(cls).utility?.category) {
|
|
8485
8862
|
this.observer = null;
|
|
8486
8863
|
this.incrementalParser = incrementalParser;
|
|
8487
8864
|
this.BrowserRuntime = BrowserRuntime2;
|
|
8865
|
+
this.getCategory = getCategory;
|
|
8488
8866
|
}
|
|
8489
8867
|
setParser(parser) {
|
|
8490
8868
|
this.incrementalParser = parser;
|
|
@@ -8515,7 +8893,7 @@ class ChangeDetector {
|
|
|
8515
8893
|
this.observer = new MutationObserver((mutations) => {
|
|
8516
8894
|
const newClasses = /* @__PURE__ */ new Set();
|
|
8517
8895
|
mutations.forEach((mutation) => {
|
|
8518
|
-
if (mutation.type === "attributes" && mutation.attributeName === "class") {
|
|
8896
|
+
if (mutation.type === "attributes" && mutation.attributeName === "class" && root.contains(mutation.target)) {
|
|
8519
8897
|
const target = mutation.target;
|
|
8520
8898
|
if (target.className) {
|
|
8521
8899
|
const classes = normalizeClassNameList(target.className);
|
|
@@ -8528,9 +8906,10 @@ class ChangeDetector {
|
|
|
8528
8906
|
}
|
|
8529
8907
|
if (mutation.type === "childList") {
|
|
8530
8908
|
mutation.addedNodes.forEach((node) => {
|
|
8531
|
-
if (node
|
|
8532
|
-
|
|
8533
|
-
|
|
8909
|
+
if (node.nodeType === Node.ELEMENT_NODE && root.contains(node)) {
|
|
8910
|
+
const element = node;
|
|
8911
|
+
this.processElement(element, newClasses);
|
|
8912
|
+
element.querySelectorAll("[class]").forEach((el) => {
|
|
8534
8913
|
this.processElement(el, newClasses);
|
|
8535
8914
|
});
|
|
8536
8915
|
}
|
|
@@ -8541,6 +8920,8 @@ class ChangeDetector {
|
|
|
8541
8920
|
const classesArray = Array.from(newClasses);
|
|
8542
8921
|
const results = this.incrementalParser.processClasses(classesArray);
|
|
8543
8922
|
this.BrowserRuntime?.applyParseResults(results);
|
|
8923
|
+
} else {
|
|
8924
|
+
this.BrowserRuntime?.applyParseResults([]);
|
|
8544
8925
|
}
|
|
8545
8926
|
});
|
|
8546
8927
|
this.observer.observe(root, {
|
|
@@ -8581,11 +8962,13 @@ class ChangeDetector {
|
|
|
8581
8962
|
if (existingClasses.size > 0) {
|
|
8582
8963
|
const classes = Array.from(existingClasses);
|
|
8583
8964
|
const results = this.incrementalParser.processClasses(classes);
|
|
8584
|
-
const layoutResults = results.filter((result) =>
|
|
8585
|
-
const nonLayoutResults = results.filter((result) =>
|
|
8965
|
+
const layoutResults = results.filter((result) => this.getCategory(result.cls) === "layout");
|
|
8966
|
+
const nonLayoutResults = results.filter((result) => this.getCategory(result.cls) !== "layout");
|
|
8586
8967
|
this.BrowserRuntime?.applyParseResults(layoutResults);
|
|
8587
8968
|
options?.onReady?.();
|
|
8588
8969
|
this.BrowserRuntime?.applyParseResults(nonLayoutResults);
|
|
8970
|
+
} else {
|
|
8971
|
+
options?.onReady?.();
|
|
8589
8972
|
}
|
|
8590
8973
|
}
|
|
8591
8974
|
/**
|
|
@@ -8624,22 +9007,61 @@ class ChangeDetector {
|
|
|
8624
9007
|
}
|
|
8625
9008
|
}
|
|
8626
9009
|
}
|
|
9010
|
+
function unescapeCssIdent(s) {
|
|
9011
|
+
return s.replace(/\\([0-9a-fA-F]{1,6})\s?|\\(.)/g, (_m, hex, ch) => hex ? String.fromCodePoint(parseInt(hex, 16)) : ch);
|
|
9012
|
+
}
|
|
9013
|
+
const LEADING_CLASS = /^\s*\.((?:\\[0-9a-fA-F]{1,6}\s?|\\.|[\w-]|[^\x00-\x7F])+)/;
|
|
9014
|
+
function splitTopLevel(sel) {
|
|
9015
|
+
const parts = [];
|
|
9016
|
+
let depth = 0, start = 0;
|
|
9017
|
+
for (let i = 0; i < sel.length; i++) {
|
|
9018
|
+
const c = sel[i];
|
|
9019
|
+
if (c === "\\") i++;
|
|
9020
|
+
else if (c === "(" || c === "[") depth++;
|
|
9021
|
+
else if (c === ")" || c === "]") depth--;
|
|
9022
|
+
else if (c === "," && depth === 0) {
|
|
9023
|
+
parts.push(sel.slice(start, i));
|
|
9024
|
+
start = i + 1;
|
|
9025
|
+
}
|
|
9026
|
+
}
|
|
9027
|
+
parts.push(sel.slice(start));
|
|
9028
|
+
return parts;
|
|
9029
|
+
}
|
|
9030
|
+
function collectLeadingClasses(rules, out = /* @__PURE__ */ new Set()) {
|
|
9031
|
+
for (const rule2 of Array.from(rules)) {
|
|
9032
|
+
const selectorText = rule2.selectorText;
|
|
9033
|
+
if (typeof selectorText === "string") {
|
|
9034
|
+
for (const part of splitTopLevel(selectorText)) {
|
|
9035
|
+
const m = LEADING_CLASS.exec(part);
|
|
9036
|
+
if (m) out.add(unescapeCssIdent(m[1]));
|
|
9037
|
+
}
|
|
9038
|
+
}
|
|
9039
|
+
const inner = rule2.cssRules;
|
|
9040
|
+
if (inner && inner.length) collectLeadingClasses(inner, out);
|
|
9041
|
+
}
|
|
9042
|
+
return out;
|
|
9043
|
+
}
|
|
9044
|
+
const LAYER_ORDER = "@layer theme, base, components, utilities;";
|
|
8627
9045
|
class BrowserRuntime {
|
|
8628
9046
|
constructor(options = {}) {
|
|
8629
9047
|
this.cache = /* @__PURE__ */ new Map();
|
|
8630
9048
|
this.rootCache = /* @__PURE__ */ new Set();
|
|
8631
9049
|
this.isDestroyed = false;
|
|
9050
|
+
this.existing = null;
|
|
9051
|
+
this.existingSheetCount = -1;
|
|
9052
|
+
this.getCategory = (cls) => parseClassName(cls, this.context).utility?.category;
|
|
8632
9053
|
const defaultConfig = {};
|
|
8633
9054
|
this.options = {
|
|
8634
9055
|
config: options.config || defaultConfig,
|
|
8635
9056
|
styleId: options.styleId || "barocss-runtime",
|
|
8636
9057
|
insertionPoint: options.insertionPoint || "head",
|
|
8637
|
-
maxRulesPerPartition: options.maxRulesPerPartition || 50
|
|
9058
|
+
maxRulesPerPartition: options.maxRulesPerPartition || 50,
|
|
9059
|
+
skipExisting: options.skipExisting ?? false
|
|
8638
9060
|
};
|
|
8639
9061
|
this.context = createContext(this.options.config);
|
|
8640
9062
|
this.incrementalParser = new IncrementalParser(this.context);
|
|
8641
|
-
this.changeDetector = new ChangeDetector(this.incrementalParser, this);
|
|
8642
|
-
this.stylePartitionManager = new StylePartitionManager(this.getInsertionPoint(), this.options.maxRulesPerPartition, `${this.options.styleId}-partition
|
|
9063
|
+
this.changeDetector = new ChangeDetector(this.incrementalParser, this, this.getCategory);
|
|
9064
|
+
this.stylePartitionManager = new StylePartitionManager(this.getInsertionPoint(), this.options.maxRulesPerPartition, `${this.options.styleId}-partition`, this.getCategory);
|
|
8643
9065
|
this.init();
|
|
8644
9066
|
}
|
|
8645
9067
|
// Debugging and logging helpers
|
|
@@ -8656,9 +9078,17 @@ class BrowserRuntime {
|
|
|
8656
9078
|
this.ensureCssVars();
|
|
8657
9079
|
}
|
|
8658
9080
|
injectPreflightCSS() {
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
this.
|
|
9081
|
+
const level = this.options.config.preflight ?? true;
|
|
9082
|
+
if (level) {
|
|
9083
|
+
const preflightCSS = this.context.getPreflightCSS(level);
|
|
9084
|
+
this.stylePartitionManager.updateRuleContent(
|
|
9085
|
+
"preflight",
|
|
9086
|
+
`${LAYER_ORDER}
|
|
9087
|
+
@layer base {
|
|
9088
|
+
${preflightCSS}
|
|
9089
|
+
}`,
|
|
9090
|
+
true
|
|
9091
|
+
);
|
|
8662
9092
|
}
|
|
8663
9093
|
}
|
|
8664
9094
|
ensureCssVars() {
|
|
@@ -8667,7 +9097,7 @@ class BrowserRuntime {
|
|
|
8667
9097
|
this.stylePartitionManager.updateRuleContent("css-vars", cssVars);
|
|
8668
9098
|
}
|
|
8669
9099
|
getInsertionPoint() {
|
|
8670
|
-
if (this.options.insertionPoint
|
|
9100
|
+
if (typeof this.options.insertionPoint !== "string") {
|
|
8671
9101
|
return this.options.insertionPoint;
|
|
8672
9102
|
}
|
|
8673
9103
|
switch (this.options.insertionPoint) {
|
|
@@ -8712,6 +9142,11 @@ class BrowserRuntime {
|
|
|
8712
9142
|
results = [...existingResults, ...results];
|
|
8713
9143
|
results.forEach((result) => this.incrementalParser.markProcessed(result.cls));
|
|
8714
9144
|
}
|
|
9145
|
+
if (this.options.skipExisting && results.length > 0 && typeof document !== "undefined") {
|
|
9146
|
+
const existing = this.getExistingClasses();
|
|
9147
|
+
results = results.filter((result) => !existing.has(result.cls));
|
|
9148
|
+
}
|
|
9149
|
+
if (results.length === 0) return;
|
|
8715
9150
|
const cssRules = [];
|
|
8716
9151
|
const rootCssRules = [];
|
|
8717
9152
|
for (const result of results) {
|
|
@@ -8739,6 +9174,27 @@ class BrowserRuntime {
|
|
|
8739
9174
|
rootCssCount: rootCssRules.length
|
|
8740
9175
|
});
|
|
8741
9176
|
}
|
|
9177
|
+
/** Class names defined by the page's own stylesheets (BaroCSS's sheets and cross-origin sheets excluded). */
|
|
9178
|
+
getExistingClasses() {
|
|
9179
|
+
const sheets = Array.from(document.styleSheets).filter((sheet) => {
|
|
9180
|
+
const owner = sheet.ownerNode;
|
|
9181
|
+
return !(owner && typeof owner.hasAttribute === "function" && (owner.hasAttribute("data-barocss") || (owner.id || "").startsWith(this.options.styleId)));
|
|
9182
|
+
});
|
|
9183
|
+
if (this.existing && sheets.length === this.existingSheetCount) return this.existing;
|
|
9184
|
+
const out = /* @__PURE__ */ new Set();
|
|
9185
|
+
for (const sheet of sheets) {
|
|
9186
|
+
let rules;
|
|
9187
|
+
try {
|
|
9188
|
+
rules = sheet.cssRules;
|
|
9189
|
+
} catch {
|
|
9190
|
+
continue;
|
|
9191
|
+
}
|
|
9192
|
+
collectLeadingClasses(rules, out);
|
|
9193
|
+
}
|
|
9194
|
+
this.existing = out;
|
|
9195
|
+
this.existingSheetCount = sheets.length;
|
|
9196
|
+
return out;
|
|
9197
|
+
}
|
|
8742
9198
|
/**
|
|
8743
9199
|
* MutationObserver instance method to automatically call addClass when class attributes change in DOM
|
|
8744
9200
|
*/
|
|
@@ -8757,7 +9213,7 @@ class BrowserRuntime {
|
|
|
8757
9213
|
return css;
|
|
8758
9214
|
}
|
|
8759
9215
|
getAllCss() {
|
|
8760
|
-
const all = Array.from(this.cache.values()).flatMap((result) => result.cssList).join("\n");
|
|
9216
|
+
const all = [...this.rootCache, ...Array.from(this.cache.values()).flatMap((result) => result.cssList)].join("\n");
|
|
8761
9217
|
return all;
|
|
8762
9218
|
}
|
|
8763
9219
|
getClasses() {
|
|
@@ -8788,7 +9244,7 @@ class BrowserRuntime {
|
|
|
8788
9244
|
clearAstCache(this.context);
|
|
8789
9245
|
this.incrementalParser.clearProcessed();
|
|
8790
9246
|
this.stylePartitionManager.cleanup();
|
|
8791
|
-
this.stylePartitionManager = new StylePartitionManager(this.getInsertionPoint(), this.options.maxRulesPerPartition, `${this.options.styleId}-partition
|
|
9247
|
+
this.stylePartitionManager = new StylePartitionManager(this.getInsertionPoint(), this.options.maxRulesPerPartition, `${this.options.styleId}-partition`, this.getCategory);
|
|
8792
9248
|
this.injectPreflightCSS();
|
|
8793
9249
|
this.ensureCssVars();
|
|
8794
9250
|
}
|
|
@@ -8798,7 +9254,7 @@ class BrowserRuntime {
|
|
|
8798
9254
|
this.rootCache.clear();
|
|
8799
9255
|
this.incrementalParser.clearProcessed();
|
|
8800
9256
|
this.stylePartitionManager.cleanup();
|
|
8801
|
-
this.stylePartitionManager = new StylePartitionManager(this.getInsertionPoint(), this.options.maxRulesPerPartition, `${this.options.styleId}-partition
|
|
9257
|
+
this.stylePartitionManager = new StylePartitionManager(this.getInsertionPoint(), this.options.maxRulesPerPartition, `${this.options.styleId}-partition`, this.getCategory);
|
|
8802
9258
|
this.injectPreflightCSS();
|
|
8803
9259
|
this.ensureCssVars();
|
|
8804
9260
|
}
|
|
@@ -8843,13 +9299,22 @@ class BrowserRuntime {
|
|
|
8843
9299
|
}
|
|
8844
9300
|
}
|
|
8845
9301
|
let runtime = null;
|
|
8846
|
-
|
|
8847
|
-
|
|
9302
|
+
let runtimeConfig;
|
|
9303
|
+
function getRuntime(options = {}) {
|
|
9304
|
+
if (!runtime || runtime.getStats().isDestroyed) {
|
|
8848
9305
|
runtime = new BrowserRuntime(options);
|
|
9306
|
+
runtimeConfig = options.config;
|
|
9307
|
+
} else if (options.config && options.config !== runtimeConfig) {
|
|
9308
|
+
runtime.updateConfig(options.config);
|
|
9309
|
+
runtimeConfig = options.config;
|
|
8849
9310
|
}
|
|
8850
9311
|
return runtime;
|
|
8851
9312
|
}
|
|
8852
9313
|
function baroBoot({ loadingClassName = "baro-boot", ...options } = {}) {
|
|
9314
|
+
if (!document.body) {
|
|
9315
|
+
document.addEventListener("DOMContentLoaded", () => baroBoot({ loadingClassName, ...options }), { once: true });
|
|
9316
|
+
return;
|
|
9317
|
+
}
|
|
8853
9318
|
const startClassName = `${loadingClassName}-doing`;
|
|
8854
9319
|
const endClassName = `${loadingClassName}-done`;
|
|
8855
9320
|
try {
|
|
@@ -8860,18 +9325,87 @@ function baroBoot({ loadingClassName = "baro-boot", ...options } = {}) {
|
|
|
8860
9325
|
document.body.classList.add(endClassName);
|
|
8861
9326
|
} });
|
|
8862
9327
|
} catch (error) {
|
|
9328
|
+
document.body?.classList.remove(startClassName);
|
|
8863
9329
|
console.error("BaroCSS boot failed:", error);
|
|
8864
9330
|
}
|
|
8865
9331
|
}
|
|
8866
9332
|
const baroStart = baroBoot;
|
|
9333
|
+
function collectJsonRenderClassNames(spec) {
|
|
9334
|
+
if (!spec || typeof spec !== "object" || Array.isArray(spec)) return [];
|
|
9335
|
+
const elements = spec.elements;
|
|
9336
|
+
if (!elements || typeof elements !== "object" || Array.isArray(elements)) return [];
|
|
9337
|
+
const classes = /* @__PURE__ */ new Set();
|
|
9338
|
+
for (const key of Object.keys(elements)) {
|
|
9339
|
+
const element = elements[key];
|
|
9340
|
+
if (!element || typeof element !== "object" || Array.isArray(element)) continue;
|
|
9341
|
+
const props = element.props;
|
|
9342
|
+
if (!props || typeof props !== "object" || Array.isArray(props)) continue;
|
|
9343
|
+
const className = props.className;
|
|
9344
|
+
if (typeof className !== "string") continue;
|
|
9345
|
+
for (const cls of className.split(/\s+/)) {
|
|
9346
|
+
if (cls) classes.add(cls);
|
|
9347
|
+
}
|
|
9348
|
+
}
|
|
9349
|
+
return Array.from(classes);
|
|
9350
|
+
}
|
|
9351
|
+
function preloadJsonRenderClasses(spec, runtime2) {
|
|
9352
|
+
const classes = collectJsonRenderClassNames(spec);
|
|
9353
|
+
if (classes.length > 0) runtime2.addClass(classes);
|
|
9354
|
+
}
|
|
9355
|
+
const SHADCN_COLOR_NAMES = [
|
|
9356
|
+
"background",
|
|
9357
|
+
"foreground",
|
|
9358
|
+
"card",
|
|
9359
|
+
"card-foreground",
|
|
9360
|
+
"popover",
|
|
9361
|
+
"popover-foreground",
|
|
9362
|
+
"primary",
|
|
9363
|
+
"primary-foreground",
|
|
9364
|
+
"secondary",
|
|
9365
|
+
"secondary-foreground",
|
|
9366
|
+
"muted",
|
|
9367
|
+
"muted-foreground",
|
|
9368
|
+
"accent",
|
|
9369
|
+
"accent-foreground",
|
|
9370
|
+
"destructive",
|
|
9371
|
+
"border",
|
|
9372
|
+
"input",
|
|
9373
|
+
"ring",
|
|
9374
|
+
"chart-1",
|
|
9375
|
+
"chart-2",
|
|
9376
|
+
"chart-3",
|
|
9377
|
+
"chart-4",
|
|
9378
|
+
"chart-5",
|
|
9379
|
+
"sidebar",
|
|
9380
|
+
"sidebar-foreground",
|
|
9381
|
+
"sidebar-primary",
|
|
9382
|
+
"sidebar-primary-foreground",
|
|
9383
|
+
"sidebar-accent",
|
|
9384
|
+
"sidebar-accent-foreground",
|
|
9385
|
+
"sidebar-border",
|
|
9386
|
+
"sidebar-ring"
|
|
9387
|
+
];
|
|
9388
|
+
const shadcnTheme = {
|
|
9389
|
+
colors: Object.fromEntries(SHADCN_COLOR_NAMES.map((n) => [n, `var(--${n})`])),
|
|
9390
|
+
borderRadius: {
|
|
9391
|
+
sm: "calc(var(--radius) - 4px)",
|
|
9392
|
+
md: "calc(var(--radius) - 2px)",
|
|
9393
|
+
lg: "var(--radius)",
|
|
9394
|
+
xl: "calc(var(--radius) + 4px)"
|
|
9395
|
+
}
|
|
9396
|
+
};
|
|
8867
9397
|
export {
|
|
8868
9398
|
BrowserRuntime,
|
|
8869
9399
|
ChangeDetector,
|
|
9400
|
+
LAYER_ORDER,
|
|
8870
9401
|
StylePartitionManager,
|
|
8871
9402
|
baroBoot,
|
|
8872
9403
|
baroStart,
|
|
9404
|
+
collectJsonRenderClassNames,
|
|
8873
9405
|
getRuntime,
|
|
8874
9406
|
normalizeClassName,
|
|
8875
|
-
normalizeClassNameList
|
|
9407
|
+
normalizeClassNameList,
|
|
9408
|
+
preloadJsonRenderClasses,
|
|
9409
|
+
shadcnTheme
|
|
8876
9410
|
};
|
|
8877
9411
|
//# sourceMappingURL=barocss.js.map
|