@barocss/kit 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +429 -252
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +429 -252
- package/dist/index.js.map +1 -1
- package/dist/theme/default.cjs +88 -14
- package/dist/theme/default.cjs.map +1 -1
- package/dist/theme/default.js +88 -14
- package/dist/theme/default.js.map +1 -1
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -251,6 +251,7 @@ function getUtility(ctx) {
|
|
|
251
251
|
const modifierRegistry = [];
|
|
252
252
|
function staticModifier(name, selectors, options = {}, ctx) {
|
|
253
253
|
registerModifier({
|
|
254
|
+
name,
|
|
254
255
|
match: (mod) => mod === name,
|
|
255
256
|
modifySelector: ({ ..._rest }) => {
|
|
256
257
|
return selectors.map((sel) => ({
|
|
@@ -658,6 +659,9 @@ function hasCommentDelimiter(text) {
|
|
|
658
659
|
}
|
|
659
660
|
return false;
|
|
660
661
|
}
|
|
662
|
+
function hasHtmlEndTagOpener(text) {
|
|
663
|
+
return text.includes("</");
|
|
664
|
+
}
|
|
661
665
|
function isStructureSafeValue(value) {
|
|
662
666
|
if (hasCommentToken(value)) return false;
|
|
663
667
|
return isSafeVariantValue(value, true);
|
|
@@ -805,8 +809,11 @@ function parseUtility(value, ctx) {
|
|
|
805
809
|
priority
|
|
806
810
|
};
|
|
807
811
|
}
|
|
808
|
-
const isSafePrelude = (text) =>
|
|
809
|
-
const
|
|
812
|
+
const isSafePrelude = (text) => {
|
|
813
|
+
const t = String(text ?? "");
|
|
814
|
+
return !hasCommentDelimiter(t) && !hasHtmlEndTagOpener(t);
|
|
815
|
+
};
|
|
816
|
+
const isSafeDecl = (prop, value) => isStructureSafeValue(String(prop)) && isStructureSafeValue(String(value ?? "")) && !hasHtmlEndTagOpener(String(prop)) && !hasHtmlEndTagOpener(String(value ?? ""));
|
|
810
817
|
const importantPrefix = "!important";
|
|
811
818
|
function astToCss(ast, baseSelector, opts, _indent = "") {
|
|
812
819
|
const minify = opts?.minify;
|
|
@@ -1110,7 +1117,7 @@ function animationToCssVars(animations) {
|
|
|
1110
1117
|
}
|
|
1111
1118
|
return result;
|
|
1112
1119
|
}
|
|
1113
|
-
const COMMENT_OR_BLOCK = /\/\*|\*\/|[{};]
|
|
1120
|
+
const COMMENT_OR_BLOCK = /\/\*|\*\/|[{};]|<\//;
|
|
1114
1121
|
function keyframesBlock(name, frames) {
|
|
1115
1122
|
if (!name || COMMENT_OR_BLOCK.test(name) || /\s/.test(name) || !frames || typeof frames !== "object") return "";
|
|
1116
1123
|
let body = "";
|
|
@@ -1217,6 +1224,8 @@ function themeToCssVarsAll(theme) {
|
|
|
1217
1224
|
...transitionDurationToCssVars(theme.transitionDuration),
|
|
1218
1225
|
...transitionDelayToCssVars(theme.transitionDelay),
|
|
1219
1226
|
...blurToCssVars(theme.blur),
|
|
1227
|
+
...Object.fromEntries(Object.entries(theme.textShadow ?? {}).map(([k, v2]) => [`--text-shadow-${escapeKey(k)}`, v2])),
|
|
1228
|
+
...Object.fromEntries(Object.entries(theme.dropShadow ?? {}).map(([k, v2]) => [`--drop-shadow-${escapeKey(k)}`, v2])),
|
|
1220
1229
|
...Object.fromEntries(Object.entries(theme.aspect ?? {}).map(([k, v2]) => [`--aspect-${escapeKey(k)}`, v2]))
|
|
1221
1230
|
// keyframes handled separately
|
|
1222
1231
|
};
|
|
@@ -1226,8 +1235,15 @@ function isSelfReferencingVar(name, value) {
|
|
|
1226
1235
|
const m = /^var\(\s*(--[\w-]+)\s*(?:,[\s\S]*)?\)$/.exec(value.trim());
|
|
1227
1236
|
return !!m && m[1] === name.trim();
|
|
1228
1237
|
}
|
|
1238
|
+
const SAFE_VAR_NAME = /^--(?:[\w-]|\\\.)+$/;
|
|
1239
|
+
function isSafeThemeVar(name, value) {
|
|
1240
|
+
if (typeof name !== "string" || !SAFE_VAR_NAME.test(name) || hasHtmlEndTagOpener(name)) return false;
|
|
1241
|
+
if (typeof value !== "string" && typeof value !== "number") return false;
|
|
1242
|
+
const v2 = String(value);
|
|
1243
|
+
return v2.trim() !== "" && isStructureSafeValue(v2) && !hasCommentDelimiter(v2) && !hasHtmlEndTagOpener(v2);
|
|
1244
|
+
}
|
|
1229
1245
|
function toCssVarsBlock(vars, extra = "") {
|
|
1230
|
-
return ":root,:host {\n" + Object.entries(vars).filter(([k, v2]) => !isSelfReferencingVar(k, v2)).map(([k, v2]) => ` ${k}: ${v2};`).join("\n") + "\n}\n" + extra + "\n";
|
|
1246
|
+
return ":root,:host {\n" + Object.entries(vars).filter(([k, v2]) => isSafeThemeVar(k, v2) && !isSelfReferencingVar(k, v2)).map(([k, v2]) => ` ${k}: ${v2};`).join("\n") + "\n}\n" + extra + "\n";
|
|
1231
1247
|
}
|
|
1232
1248
|
const BARO_VAR = /--baro-/g;
|
|
1233
1249
|
const PREFIXED_KEYS = /* @__PURE__ */ new Set(["prop", "value", "params", "selector", "nodes", "items"]);
|
|
@@ -2108,7 +2124,7 @@ html {
|
|
|
2108
2124
|
line-height: 1.15;
|
|
2109
2125
|
-webkit-text-size-adjust: 100%;
|
|
2110
2126
|
/* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
|
|
2111
|
-
font-family: var(--default-font-family, var(--font-sans,
|
|
2127
|
+
font-family: var(--default-font-family, var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'));
|
|
2112
2128
|
font-feature-settings: var(--default-font-feature-settings, normal);
|
|
2113
2129
|
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
2114
2130
|
}
|
|
@@ -2411,7 +2427,7 @@ html {
|
|
|
2411
2427
|
-webkit-text-size-adjust: 100%;
|
|
2412
2428
|
-ms-text-size-adjust: 100%;
|
|
2413
2429
|
/* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
|
|
2414
|
-
font-family: var(--default-font-family, var(--font-sans,
|
|
2430
|
+
font-family: var(--default-font-family, var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'));
|
|
2415
2431
|
font-feature-settings: var(--default-font-feature-settings, normal);
|
|
2416
2432
|
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
2417
2433
|
}
|
|
@@ -3490,6 +3506,9 @@ staticUtility("snap-both", [["scroll-snap-type", "both var(--baro-scroll-snap-st
|
|
|
3490
3506
|
staticUtility("snap-mandatory", [["--baro-scroll-snap-strictness", "mandatory"]], { category: "interactivity" });
|
|
3491
3507
|
staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]], { category: "interactivity" });
|
|
3492
3508
|
[
|
|
3509
|
+
["mbs", "scroll-margin-block-start"],
|
|
3510
|
+
// #311 (Tailwind 4.3), before `mb`
|
|
3511
|
+
["mbe", "scroll-margin-block-end"],
|
|
3493
3512
|
["mt", "scroll-margin-top"],
|
|
3494
3513
|
["mr", "scroll-margin-right"],
|
|
3495
3514
|
["mb", "scroll-margin-bottom"],
|
|
@@ -3500,6 +3519,8 @@ staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]]
|
|
|
3500
3519
|
["me", "scroll-margin-inline-end"],
|
|
3501
3520
|
["m", "scroll-margin"]
|
|
3502
3521
|
].forEach(([name, prop]) => {
|
|
3522
|
+
staticUtility(`scroll-${name}-px`, [[prop, "1px"]], { category: "interactivity" });
|
|
3523
|
+
staticUtility(`-scroll-${name}-px`, [[prop, "-1px"]], { category: "interactivity" });
|
|
3503
3524
|
functionalUtility({
|
|
3504
3525
|
name: `scroll-${name}`,
|
|
3505
3526
|
spacingKeys: true,
|
|
@@ -3518,6 +3539,9 @@ staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]]
|
|
|
3518
3539
|
});
|
|
3519
3540
|
});
|
|
3520
3541
|
[
|
|
3542
|
+
["pbs", "scroll-padding-block-start"],
|
|
3543
|
+
// #311 (Tailwind 4.3), before `pb`
|
|
3544
|
+
["pbe", "scroll-padding-block-end"],
|
|
3521
3545
|
["pt", "scroll-padding-top"],
|
|
3522
3546
|
["pr", "scroll-padding-right"],
|
|
3523
3547
|
["pb", "scroll-padding-bottom"],
|
|
@@ -3534,13 +3558,15 @@ staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]]
|
|
|
3534
3558
|
prop,
|
|
3535
3559
|
supportsArbitrary: true,
|
|
3536
3560
|
supportsCustomProperty: true,
|
|
3561
|
+
handleBareValue: ({ value }) => value === "px" ? "1px" : /^(\d|\.\d)/.test(value) ? value : null,
|
|
3537
3562
|
handle: (value, _ctx, token, _extra) => {
|
|
3538
|
-
if (
|
|
3563
|
+
if (token.negative) return [];
|
|
3564
|
+
if (parseNumber(value)) {
|
|
3539
3565
|
return [decl(prop, `calc(var(--spacing) * ${value})`)];
|
|
3540
3566
|
}
|
|
3541
3567
|
return [decl(prop, value)];
|
|
3542
3568
|
},
|
|
3543
|
-
handleCustomProperty: (value) => [decl(prop, `var(${value})`)],
|
|
3569
|
+
handleCustomProperty: (value, _ctx, token) => token.negative ? [] : [decl(prop, `var(${value})`)],
|
|
3544
3570
|
description: `scroll-${name} utility (static, arbitrary, custom property supported)`,
|
|
3545
3571
|
category: "interactivity"
|
|
3546
3572
|
});
|
|
@@ -3571,6 +3597,40 @@ functionalUtility({
|
|
|
3571
3597
|
description: "will-change utility (static, arbitrary, custom property supported)",
|
|
3572
3598
|
category: "interactivity"
|
|
3573
3599
|
});
|
|
3600
|
+
staticUtility("scrollbar-auto", [["scrollbar-width", "auto"]], { category: "interactivity" });
|
|
3601
|
+
staticUtility("scrollbar-thin", [["scrollbar-width", "thin"]], { category: "interactivity" });
|
|
3602
|
+
staticUtility("scrollbar-none", [["scrollbar-width", "none"]], { category: "interactivity" });
|
|
3603
|
+
staticUtility("scrollbar-gutter-auto", [["scrollbar-gutter", "auto"]], { category: "interactivity" });
|
|
3604
|
+
staticUtility("scrollbar-gutter-stable", [["scrollbar-gutter", "stable"]], { category: "interactivity" });
|
|
3605
|
+
staticUtility("scrollbar-gutter-both", [["scrollbar-gutter", "stable both-edges"]], { category: "interactivity" });
|
|
3606
|
+
const SCROLLBAR_COLOR = "var(--baro-scrollbar-thumb) var(--baro-scrollbar-track)";
|
|
3607
|
+
const scrollbarProperties = () => atRoot([
|
|
3608
|
+
property("--baro-scrollbar-thumb", "#0000", "<color>"),
|
|
3609
|
+
property("--baro-scrollbar-track", "#0000", "<color>")
|
|
3610
|
+
]);
|
|
3611
|
+
const stripColorHint = (v) => v.replace(/^color:/, "");
|
|
3612
|
+
for (const part of ["thumb", "track"]) {
|
|
3613
|
+
const key = `--baro-scrollbar-${part}`;
|
|
3614
|
+
const compose = (inner) => [scrollbarProperties(), ...inner, decl("scrollbar-color", SCROLLBAR_COLOR)];
|
|
3615
|
+
const withOpacity = (color, opacity) => opacity ? [decl(key, `color-mix(in oklab, ${color} ${opacity.replace(/^\[(.*)\]$/, "$1").replace(/%$/, "")}%, transparent)`)] : [decl(key, color)];
|
|
3616
|
+
functionalUtility({
|
|
3617
|
+
name: `scrollbar-${part}`,
|
|
3618
|
+
themeKeys: ["colors"],
|
|
3619
|
+
supportsOpacity: true,
|
|
3620
|
+
supportsArbitrary: true,
|
|
3621
|
+
supportsCustomProperty: true,
|
|
3622
|
+
handle: (value, _ctx, token, extra) => {
|
|
3623
|
+
if (extra?.realThemeValue) return compose(withOpacity(`var(--color-${extra.realThemeValue})`, extra.opacity));
|
|
3624
|
+
if (token.arbitrary) return compose(withOpacity(stripColorHint(value), extra?.opacity));
|
|
3625
|
+
if (value === "inherit" || value === "transparent") return compose([decl(key, value)]);
|
|
3626
|
+
if (value === "current") return compose(withOpacity("currentcolor", extra?.opacity));
|
|
3627
|
+
return null;
|
|
3628
|
+
},
|
|
3629
|
+
handleCustomProperty: (value, _ctx, _token, extra) => compose(withOpacity(`var(${stripColorHint(value)})`, extra?.opacity)),
|
|
3630
|
+
description: `scrollbar-color ${part} utility (theme, arbitrary, custom property, opacity)`,
|
|
3631
|
+
category: "interactivity"
|
|
3632
|
+
});
|
|
3633
|
+
}
|
|
3574
3634
|
const defaultTiming = "var(--default-transition-timing-function)";
|
|
3575
3635
|
const defaultDuration = "var(--default-transition-duration)";
|
|
3576
3636
|
staticUtility("transition", [
|
|
@@ -3708,53 +3768,99 @@ staticUtility("border-collapse", [["border-collapse", "collapse"]], { category:
|
|
|
3708
3768
|
staticUtility("border-separate", [["border-collapse", "separate"]], { category: "table" });
|
|
3709
3769
|
staticUtility("table-auto", [["table-layout", "auto"]], { category: "table" });
|
|
3710
3770
|
staticUtility("table-fixed", [["table-layout", "fixed"]], { category: "table" });
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
});
|
|
3741
|
-
functionalUtility({
|
|
3742
|
-
name: "border-spacing",
|
|
3743
|
-
prop: "border-spacing",
|
|
3744
|
-
supportsArbitrary: true,
|
|
3745
|
-
supportsCustomProperty: true,
|
|
3746
|
-
handle: (value, _ctx, _token) => {
|
|
3747
|
-
if (parseNumber(value)) {
|
|
3748
|
-
return [decl("border-spacing", `calc(var(--spacing) * ${value})`)];
|
|
3749
|
-
}
|
|
3750
|
-
return [decl("border-spacing", value)];
|
|
3751
|
-
},
|
|
3752
|
-
handleCustomProperty: (value) => [decl("border-spacing", `var(${value})`)],
|
|
3753
|
-
description: "border-spacing utility (static, number, arbitrary, custom property supported)",
|
|
3754
|
-
category: "table"
|
|
3771
|
+
const borderSpacingProperties = () => atRoot([
|
|
3772
|
+
property("--baro-border-spacing-x", "0", "<length>"),
|
|
3773
|
+
property("--baro-border-spacing-y", "0", "<length>")
|
|
3774
|
+
]);
|
|
3775
|
+
const BORDER_SPACING = "var(--baro-border-spacing-x) var(--baro-border-spacing-y)";
|
|
3776
|
+
const borderSpacing = (axes, v) => [
|
|
3777
|
+
borderSpacingProperties(),
|
|
3778
|
+
...axes.map((a) => decl(`--baro-border-spacing-${a}`, v)),
|
|
3779
|
+
decl("border-spacing", BORDER_SPACING)
|
|
3780
|
+
];
|
|
3781
|
+
[
|
|
3782
|
+
["border-spacing-x", ["x"]],
|
|
3783
|
+
["border-spacing-y", ["y"]],
|
|
3784
|
+
["border-spacing", ["x", "y"]]
|
|
3785
|
+
].forEach(([name, axes]) => {
|
|
3786
|
+
staticUtility(`${name}-px`, [
|
|
3787
|
+
borderSpacingProperties,
|
|
3788
|
+
...axes.map((a) => [`--baro-border-spacing-${a}`, "1px"]),
|
|
3789
|
+
["border-spacing", BORDER_SPACING]
|
|
3790
|
+
], { category: "table" });
|
|
3791
|
+
functionalUtility({
|
|
3792
|
+
name,
|
|
3793
|
+
prop: "border-spacing",
|
|
3794
|
+
supportsArbitrary: true,
|
|
3795
|
+
supportsCustomProperty: true,
|
|
3796
|
+
handle: (value) => borderSpacing(axes, parseNumber(value) ? `calc(var(--spacing) * ${value})` : value),
|
|
3797
|
+
handleCustomProperty: (value) => borderSpacing(axes, `var(${value})`),
|
|
3798
|
+
description: `${name} utility (number, px, arbitrary, custom property supported)`,
|
|
3799
|
+
category: "table"
|
|
3800
|
+
});
|
|
3755
3801
|
});
|
|
3756
3802
|
staticUtility("caption-top", [["caption-side", "top"]], { category: "table" });
|
|
3757
3803
|
staticUtility("caption-bottom", [["caption-side", "bottom"]], { category: "table" });
|
|
3804
|
+
function parseAlpha(op) {
|
|
3805
|
+
if (!op) return null;
|
|
3806
|
+
if (/^\d+(\.\d+)?$/.test(op)) return { alpha: `${op}%`, isVar: false };
|
|
3807
|
+
const pct = /^\[(\d+(?:\.\d+)?)%\]$/.exec(op);
|
|
3808
|
+
if (pct) return { alpha: `${pct[1]}%`, isVar: false };
|
|
3809
|
+
const cp = /^\((--[\w-]+)\)$/.exec(op);
|
|
3810
|
+
if (cp) return { alpha: `var(${cp[1]})`, isVar: true };
|
|
3811
|
+
return null;
|
|
3812
|
+
}
|
|
3813
|
+
function splitTop(value, sep) {
|
|
3814
|
+
const out = [];
|
|
3815
|
+
let depth = 0;
|
|
3816
|
+
let cur = "";
|
|
3817
|
+
for (const ch of value) {
|
|
3818
|
+
if (ch === "(") depth++;
|
|
3819
|
+
else if (ch === ")") depth--;
|
|
3820
|
+
if (depth === 0 && (sep === " " ? /\s/.test(ch) : ch === sep)) {
|
|
3821
|
+
if (cur.trim()) out.push(cur.trim());
|
|
3822
|
+
cur = "";
|
|
3823
|
+
} else cur += ch;
|
|
3824
|
+
}
|
|
3825
|
+
if (cur.trim()) out.push(cur.trim());
|
|
3826
|
+
return out;
|
|
3827
|
+
}
|
|
3828
|
+
const LENGTH = /^-?(\d*\.)?\d+([a-z]+|%)?$/i;
|
|
3829
|
+
function shadowLayers(value, layer, alpha) {
|
|
3830
|
+
return splitTop(value, ",").map((l) => {
|
|
3831
|
+
const parts = splitTop(l, " ");
|
|
3832
|
+
const i = parts.findIndex((p) => p !== "inset" && !LENGTH.test(p));
|
|
3833
|
+
const c = i < 0 ? "currentcolor" : parts[i];
|
|
3834
|
+
parts[i < 0 ? parts.length : i] = `var(--baro-${layer}-color, ${alpha ? `oklab(from ${c} l a b / ${alpha})` : c})`;
|
|
3835
|
+
return parts.join(" ");
|
|
3836
|
+
});
|
|
3837
|
+
}
|
|
3838
|
+
function shadowValueDecls(layer, prop, value, opacity, render = (l) => l.join(", ")) {
|
|
3839
|
+
const a = parseAlpha(opacity);
|
|
3840
|
+
if (opacity && !a) return null;
|
|
3841
|
+
if (!a) return [decl(prop, render(shadowLayers(value, layer)))];
|
|
3842
|
+
const alphaDecl = decl(`--baro-${layer}-alpha`, a.alpha);
|
|
3843
|
+
if (!a.isVar) return [alphaDecl, decl(prop, render(shadowLayers(value, layer, a.alpha)))];
|
|
3844
|
+
return [
|
|
3845
|
+
alphaDecl,
|
|
3846
|
+
decl(prop, render(shadowLayers(value, layer))),
|
|
3847
|
+
atRule("supports", "(color: lab(from red l a b))", [decl(prop, render(shadowLayers(value, layer, a.alpha)))])
|
|
3848
|
+
];
|
|
3849
|
+
}
|
|
3850
|
+
function shadowColorDecls(layer, color, opacity, ref = color) {
|
|
3851
|
+
const key = `--baro-${layer}-color`;
|
|
3852
|
+
if (color === "inherit") return [decl(key, "inherit")];
|
|
3853
|
+
const a = parseAlpha(opacity);
|
|
3854
|
+
if (opacity && !a) return null;
|
|
3855
|
+
const inner = a ? `color-mix(in oklab, ${ref} ${a.alpha}, transparent)` : ref;
|
|
3856
|
+
const fallback = a ? `color-mix(in srgb, ${color} ${a.alpha}, transparent)` : color;
|
|
3857
|
+
return [
|
|
3858
|
+
decl(key, fallback),
|
|
3859
|
+
atRule("supports", "(color: color-mix(in lab, red, red))", [
|
|
3860
|
+
decl(key, `color-mix(in oklab, ${inner} var(--baro-${layer}-alpha), transparent)`)
|
|
3861
|
+
])
|
|
3862
|
+
];
|
|
3863
|
+
}
|
|
3758
3864
|
staticUtility("filter-none", [["filter", "none"]], { category: "effects" });
|
|
3759
3865
|
functionalUtility({
|
|
3760
3866
|
name: "filter",
|
|
@@ -3839,57 +3945,68 @@ functionalUtility({
|
|
|
3839
3945
|
description: "contrast filter utility (static, number, arbitrary, custom property supported)",
|
|
3840
3946
|
category: "effects"
|
|
3841
3947
|
});
|
|
3842
|
-
[
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3948
|
+
const dropShadowProperties = () => atRoot([
|
|
3949
|
+
property("--baro-drop-shadow"),
|
|
3950
|
+
property("--baro-drop-shadow-color"),
|
|
3951
|
+
property("--baro-drop-shadow-alpha", "100%", "<percentage>"),
|
|
3952
|
+
property("--baro-drop-shadow-size")
|
|
3953
|
+
]);
|
|
3954
|
+
const wrapDropShadow = (layers) => layers.map((l) => `drop-shadow(${l})`).join(" ");
|
|
3955
|
+
const DROP_SHADOW_DEFAULT = "0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06)";
|
|
3956
|
+
const namedDropShadow = (ctx, name) => {
|
|
3957
|
+
const v = ctx.theme("dropShadow", name);
|
|
3958
|
+
return typeof v === "string" && /^[\w.-]+$/.test(name) ? v : null;
|
|
3959
|
+
};
|
|
3960
|
+
function dropShadowValue(value, opacity, named, keepNamed = false) {
|
|
3961
|
+
const decls = shadowValueDecls("drop-shadow", "--baro-drop-shadow-size", value, opacity, wrapDropShadow);
|
|
3962
|
+
if (!decls) return null;
|
|
3963
|
+
const composed = named !== void 0 && (!opacity || keepNamed) ? named : "var(--baro-drop-shadow-size)";
|
|
3964
|
+
return [dropShadowProperties(), ...decls, decl("--baro-drop-shadow", composed), filters$1()];
|
|
3965
|
+
}
|
|
3966
|
+
staticUtility("drop-shadow-none", [decl("--baro-drop-shadow", " "), filters$1()]);
|
|
3967
|
+
registerUtility({
|
|
3968
|
+
name: "drop-shadow",
|
|
3969
|
+
match: (className) => /^drop-shadow(\/.+)?$/.test(className),
|
|
3970
|
+
handler: (value, _ctx, token) => {
|
|
3971
|
+
const full = value ? `${token.prefix}-${value}` : token.prefix;
|
|
3972
|
+
const cut = full.indexOf("/");
|
|
3973
|
+
const opacity = cut < 0 ? void 0 : full.slice(cut + 1);
|
|
3974
|
+
const literal = "drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow( 0 1px 1px rgb(0 0 0 / 0.06))";
|
|
3975
|
+
return dropShadowValue(DROP_SHADOW_DEFAULT, opacity, literal, true) ?? [];
|
|
3976
|
+
},
|
|
3977
|
+
category: "effects"
|
|
3866
3978
|
});
|
|
3979
|
+
const dropShadowColor = (color, opacity, ref) => {
|
|
3980
|
+
const decls = shadowColorDecls("drop-shadow", color, opacity, ref);
|
|
3981
|
+
return decls && [dropShadowProperties(), ...decls, decl("--baro-drop-shadow", "var(--baro-drop-shadow-size)")];
|
|
3982
|
+
};
|
|
3867
3983
|
functionalUtility({
|
|
3868
3984
|
name: "drop-shadow",
|
|
3869
3985
|
themeKeys: ["colors"],
|
|
3870
3986
|
supportsArbitrary: true,
|
|
3871
3987
|
supportsCustomProperty: true,
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3988
|
+
supportsOpacity: true,
|
|
3989
|
+
handleBareValue: ({ value, ctx }) => namedDropShadow(ctx, value) ? value : null,
|
|
3990
|
+
handle: (value, ctx, token, extra) => {
|
|
3991
|
+
const opacity = extra?.opacity;
|
|
3992
|
+
const keyword = token.arbitrary ? void 0 : { inherit: "inherit", current: "currentcolor", transparent: "transparent" }[extra?.realThemeValue ?? value];
|
|
3993
|
+
if (keyword) return dropShadowColor(keyword, opacity);
|
|
3994
|
+
if (extra?.realThemeValue) return dropShadowColor(value, opacity, `var(--color-${extra.realThemeValue})`);
|
|
3995
|
+
if (token.arbitrary) {
|
|
3996
|
+
if (parseColor(value)) return dropShadowColor(value, opacity);
|
|
3997
|
+
return dropShadowValue(value, opacity);
|
|
3878
3998
|
}
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
];
|
|
3999
|
+
const named = namedDropShadow(ctx, value);
|
|
4000
|
+
if (named) return dropShadowValue(named, opacity, `drop-shadow(var(--drop-shadow-${value}))`);
|
|
4001
|
+
return null;
|
|
3883
4002
|
},
|
|
3884
4003
|
handleCustomProperty: (value) => {
|
|
3885
|
-
if (value.startsWith("color:")) {
|
|
3886
|
-
return [
|
|
3887
|
-
decl("--baro-drop-shadow-color", `var(${value.replace("color:", "")})`)
|
|
3888
|
-
];
|
|
3889
|
-
}
|
|
4004
|
+
if (value.startsWith("color:")) return dropShadowColor(`var(${value.slice(6)})`, void 0) ?? [];
|
|
3890
4005
|
return [
|
|
4006
|
+
dropShadowProperties(),
|
|
3891
4007
|
decl("--baro-drop-shadow-size", `drop-shadow(var(${value}))`),
|
|
3892
|
-
decl("--baro-drop-shadow", `var(--baro-drop-shadow-size)`)
|
|
4008
|
+
decl("--baro-drop-shadow", `var(--baro-drop-shadow-size)`),
|
|
4009
|
+
filters$1()
|
|
3893
4010
|
];
|
|
3894
4011
|
},
|
|
3895
4012
|
description: "drop-shadow filter utility (static, arbitrary, custom property supported)",
|
|
@@ -4259,166 +4376,119 @@ const ringShadowProperties = () => atRoot([
|
|
|
4259
4376
|
property("--baro-ring-offset-width", "0px", "<length>"),
|
|
4260
4377
|
property("--baro-ring-offset-color", "#fff")
|
|
4261
4378
|
]);
|
|
4262
|
-
const
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
function createShadowThemeColor(key, main, opacity, realThemeValue) {
|
|
4301
|
-
let fallbackColor = main;
|
|
4302
|
-
const colorVar = `var(--color-${realThemeValue})`;
|
|
4303
|
-
let colorValue = colorVar;
|
|
4304
|
-
if (opacity) {
|
|
4305
|
-
colorValue = `color-mix(in oklab, color-mix(in oklab, ${colorVar} ${opacity}%, transparent) var(--baro-shadow-alpha),transparent)`;
|
|
4306
|
-
if (parseColor(main)) {
|
|
4307
|
-
if (main.startsWith("#")) {
|
|
4308
|
-
const opacityValue = Math.round(Number(opacity) / 100 * 255);
|
|
4309
|
-
fallbackColor = `${main}${opacityValue.toString(16).padStart(2, "0")}`;
|
|
4310
|
-
} else {
|
|
4311
|
-
fallbackColor = `color-mix(in oklab, ${main} ${opacity}%, transparent)`;
|
|
4312
|
-
}
|
|
4313
|
-
}
|
|
4314
|
-
}
|
|
4315
|
-
return [
|
|
4316
|
-
atRule("supports", "(color:color-mix(in lab, red, red))", [
|
|
4317
|
-
decl(key, colorValue)
|
|
4318
|
-
]),
|
|
4319
|
-
decl(key, fallbackColor)
|
|
4320
|
-
];
|
|
4379
|
+
const shadowColorProperties = (layer) => atRoot([
|
|
4380
|
+
property(`--baro-${layer}-color`),
|
|
4381
|
+
property(`--baro-${layer}-alpha`, "100%", "<percentage>")
|
|
4382
|
+
]);
|
|
4383
|
+
const NAMED_SHADOWS = {
|
|
4384
|
+
"": "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
|
4385
|
+
"2xs": "0 1px rgb(0 0 0 / 0.05)",
|
|
4386
|
+
xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
4387
|
+
sm: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
|
4388
|
+
md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
4389
|
+
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
4390
|
+
xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
|
|
4391
|
+
"2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)",
|
|
4392
|
+
inner: "inset 0 2px 4px 0 rgb(0 0 0 / 0.05)"
|
|
4393
|
+
};
|
|
4394
|
+
const NAMED_INSET_SHADOWS = {
|
|
4395
|
+
"2xs": "inset 0 1px rgb(0 0 0 / 0.05)",
|
|
4396
|
+
xs: "inset 0 1px 1px rgb(0 0 0 / 0.05)",
|
|
4397
|
+
sm: "inset 0 2px 4px rgb(0 0 0 / 0.05)"
|
|
4398
|
+
};
|
|
4399
|
+
const INSET_EXTENSIONS = {
|
|
4400
|
+
md: "inset 0 4px 6px -1px rgb(0 0 0 / 0.05)",
|
|
4401
|
+
lg: "inset 0 10px 15px -3px rgb(0 0 0 / 0.05)",
|
|
4402
|
+
xl: "inset 0 20px 25px -5px rgb(0 0 0 / 0.05)",
|
|
4403
|
+
"2xl": "inset 0 25px 50px -12px rgb(0 0 0 / 0.05)"
|
|
4404
|
+
};
|
|
4405
|
+
const insetEach = (value) => value.split(/,(?![^(]*\))/).map((l) => `inset ${l.trim()}`).join(", ");
|
|
4406
|
+
const own = (table, key) => Object.prototype.hasOwnProperty.call(table, key);
|
|
4407
|
+
function boxShadowLayer(layer, value, opacity) {
|
|
4408
|
+
const decls = shadowValueDecls(layer, `--baro-${layer}`, value, opacity);
|
|
4409
|
+
if (!decls) return null;
|
|
4410
|
+
return [ringShadowProperties(), shadowColorProperties(layer), ...decls, decl("box-shadow", SHADOW_COMPOSITE)];
|
|
4411
|
+
}
|
|
4412
|
+
function namedBoxShadow(layer, name, opacity) {
|
|
4413
|
+
if (layer === "shadow") return own(NAMED_SHADOWS, name) ? boxShadowLayer(layer, NAMED_SHADOWS[name], opacity) : null;
|
|
4414
|
+
if (own(NAMED_INSET_SHADOWS, name)) return boxShadowLayer(layer, NAMED_INSET_SHADOWS[name], opacity);
|
|
4415
|
+
if (!opacity && own(INSET_EXTENSIONS, name)) return boxShadowLayer(layer, INSET_EXTENSIONS[name], void 0);
|
|
4416
|
+
return null;
|
|
4321
4417
|
}
|
|
4322
|
-
|
|
4418
|
+
staticUtility("shadow-none", [ringShadowProperties, ["--baro-shadow", "0 0 #0000"], ["box-shadow", SHADOW_COMPOSITE]], { category: "effects" });
|
|
4419
|
+
staticUtility("inset-shadow-none", [ringShadowProperties, ["--baro-inset-shadow", "inset 0 0 #0000"], ["box-shadow", SHADOW_COMPOSITE]], { category: "effects" });
|
|
4420
|
+
registerUtility({
|
|
4323
4421
|
name: "shadow",
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
const main = value;
|
|
4330
|
-
const opacity = extra?.opacity;
|
|
4331
|
-
const realThemeValue = extra?.realThemeValue;
|
|
4332
|
-
if (realThemeValue) {
|
|
4333
|
-
return createShadowThemeColor(
|
|
4334
|
-
"--baro-shadow-color",
|
|
4335
|
-
main,
|
|
4336
|
-
opacity,
|
|
4337
|
-
realThemeValue
|
|
4338
|
-
);
|
|
4339
|
-
}
|
|
4340
|
-
if (main.startsWith("color:")) {
|
|
4341
|
-
const cp = main.replace("color:", "");
|
|
4342
|
-
if (opacity) {
|
|
4343
|
-
return [
|
|
4344
|
-
decl(
|
|
4345
|
-
"--baro-shadow-color",
|
|
4346
|
-
`color-mix(in oklab, var(${cp}) ${opacity}%, transparent)`
|
|
4347
|
-
)
|
|
4348
|
-
];
|
|
4349
|
-
}
|
|
4350
|
-
return [decl("--baro-shadow-color", `var(${cp})`)];
|
|
4351
|
-
}
|
|
4352
|
-
if (token.arbitrary) {
|
|
4353
|
-
if (parseColor(main)) {
|
|
4354
|
-
if (opacity) {
|
|
4355
|
-
return [
|
|
4356
|
-
decl(
|
|
4357
|
-
"--baro-shadow-color",
|
|
4358
|
-
`color-mix(in oklab, ${main} ${opacity}%, transparent)`
|
|
4359
|
-
)
|
|
4360
|
-
];
|
|
4361
|
-
}
|
|
4362
|
-
return [decl("--baro-shadow-color", main)];
|
|
4363
|
-
}
|
|
4364
|
-
return shadowLayer(main);
|
|
4365
|
-
}
|
|
4366
|
-
if (main === "inherit" || main === "current" || main === "transparent") {
|
|
4367
|
-
return [
|
|
4368
|
-
decl("--baro-shadow-color", main === "current" ? "currentColor" : main)
|
|
4369
|
-
];
|
|
4370
|
-
}
|
|
4371
|
-
return null;
|
|
4422
|
+
match: (className) => /^shadow(\/.+)?$/.test(className),
|
|
4423
|
+
handler: (value, _ctx, token) => {
|
|
4424
|
+
const full = value ? `${token.prefix}-${value}` : token.prefix;
|
|
4425
|
+
const cut = full.indexOf("/");
|
|
4426
|
+
return namedBoxShadow("shadow", "", cut < 0 ? void 0 : full.slice(cut + 1)) ?? [];
|
|
4372
4427
|
},
|
|
4373
|
-
|
|
4428
|
+
category: "effects"
|
|
4374
4429
|
});
|
|
4430
|
+
const KEYWORD_COLORS = { inherit: "inherit", current: "currentcolor", transparent: "transparent" };
|
|
4431
|
+
function layerColor(layer, main, opacity, token, realThemeValue) {
|
|
4432
|
+
const keyword = token.arbitrary ? void 0 : KEYWORD_COLORS[realThemeValue ?? main];
|
|
4433
|
+
if (keyword) return shadowColorDecls(layer, keyword, opacity);
|
|
4434
|
+
if (realThemeValue) return shadowColorDecls(layer, main, opacity, `var(--color-${realThemeValue})`);
|
|
4435
|
+
if (main.startsWith("color:")) return shadowColorDecls(layer, `var(${main.slice(6)})`, opacity);
|
|
4436
|
+
if (token.arbitrary && parseColor(main)) return shadowColorDecls(layer, main, opacity);
|
|
4437
|
+
return void 0;
|
|
4438
|
+
}
|
|
4439
|
+
for (const layer of ["shadow", "inset-shadow"]) {
|
|
4440
|
+
functionalUtility({
|
|
4441
|
+
name: layer,
|
|
4442
|
+
supportsArbitrary: true,
|
|
4443
|
+
supportsCustomProperty: true,
|
|
4444
|
+
supportsOpacity: true,
|
|
4445
|
+
themeKeys: ["colors"],
|
|
4446
|
+
handleBareValue: ({ value, extra }) => namedBoxShadow(layer, value, extra?.opacity) ? value : null,
|
|
4447
|
+
handle: (value, _ctx, token, extra) => {
|
|
4448
|
+
const opacity = extra?.opacity;
|
|
4449
|
+
const named = !extra?.realThemeValue && !token.arbitrary ? namedBoxShadow(layer, value, opacity) : null;
|
|
4450
|
+
if (named) return named;
|
|
4451
|
+
const color = layerColor(layer, value, opacity, token, extra?.realThemeValue);
|
|
4452
|
+
if (color !== void 0) return color;
|
|
4453
|
+
if (token.arbitrary) return boxShadowLayer(layer, layer === "inset-shadow" ? insetEach(value) : value, opacity);
|
|
4454
|
+
return null;
|
|
4455
|
+
},
|
|
4456
|
+
handleCustomProperty: (value) => value.startsWith("color:") ? shadowColorDecls(layer, `var(${value.slice(6)})`, void 0) ?? [] : [ringShadowProperties(), decl(`--baro-${layer}`, layer === "inset-shadow" ? `inset var(${value})` : `var(${value})`), decl("box-shadow", SHADOW_COMPOSITE)]
|
|
4457
|
+
});
|
|
4458
|
+
}
|
|
4459
|
+
const textShadowProperties = () => atRoot([
|
|
4460
|
+
property("--baro-text-shadow-color"),
|
|
4461
|
+
property("--baro-text-shadow-alpha", "100%", "<percentage>")
|
|
4462
|
+
]);
|
|
4463
|
+
const namedTextShadow = (ctx, name) => {
|
|
4464
|
+
const v = ctx.theme("textShadow", name);
|
|
4465
|
+
return typeof v === "string" && /^[\w.-]+$/.test(name) ? v : null;
|
|
4466
|
+
};
|
|
4467
|
+
const textShadowValue = (value, opacity) => {
|
|
4468
|
+
const decls = shadowValueDecls("text-shadow", "text-shadow", value, opacity);
|
|
4469
|
+
return decls ? [textShadowProperties(), ...decls] : null;
|
|
4470
|
+
};
|
|
4471
|
+
staticUtility("text-shadow-none", [textShadowProperties, ["text-shadow", "none"]], { category: "effects" });
|
|
4375
4472
|
functionalUtility({
|
|
4376
|
-
name: "
|
|
4473
|
+
name: "text-shadow",
|
|
4377
4474
|
supportsArbitrary: true,
|
|
4378
4475
|
supportsCustomProperty: true,
|
|
4379
4476
|
supportsOpacity: true,
|
|
4380
|
-
themeKeys: ["colors"
|
|
4477
|
+
themeKeys: ["colors"],
|
|
4478
|
+
handleBareValue: ({ value, ctx }) => namedTextShadow(ctx, value) ? value : null,
|
|
4381
4479
|
handle: (value, ctx, token, extra) => {
|
|
4382
|
-
const main = value;
|
|
4383
4480
|
const opacity = extra?.opacity;
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
return
|
|
4387
|
-
"--baro-inset-shadow-color",
|
|
4388
|
-
main,
|
|
4389
|
-
opacity,
|
|
4390
|
-
realThemeValue
|
|
4391
|
-
);
|
|
4392
|
-
}
|
|
4393
|
-
if (main.startsWith("color:")) {
|
|
4394
|
-
const cp = main.replace("color:", "");
|
|
4395
|
-
let colorValue = `var(${cp})`;
|
|
4396
|
-
if (opacity) {
|
|
4397
|
-
colorValue = `color-mix(in oklab, var(${cp}) ${opacity}%, transparent)`;
|
|
4398
|
-
}
|
|
4399
|
-
return [decl("--baro-inset-shadow-color", colorValue)];
|
|
4400
|
-
}
|
|
4401
|
-
if (token.arbitrary) {
|
|
4402
|
-
if (parseColor(main)) {
|
|
4403
|
-
let colorValue = main;
|
|
4404
|
-
if (opacity) {
|
|
4405
|
-
colorValue = `color-mix(in oklab, ${main} ${opacity}%, transparent)`;
|
|
4406
|
-
}
|
|
4407
|
-
return [decl("--baro-inset-shadow-color", colorValue)];
|
|
4408
|
-
}
|
|
4409
|
-
return [decl("box-shadow", `inset ${main}`)];
|
|
4410
|
-
}
|
|
4411
|
-
if (main === "inherit" || main === "current" || main === "transparent") {
|
|
4412
|
-
return [
|
|
4413
|
-
decl(
|
|
4414
|
-
"--baro-inset-shadow-color",
|
|
4415
|
-
main === "current" ? "currentColor" : main
|
|
4416
|
-
)
|
|
4417
|
-
];
|
|
4481
|
+
if (!extra?.realThemeValue && !token.arbitrary) {
|
|
4482
|
+
const named = namedTextShadow(ctx, value);
|
|
4483
|
+
if (named) return textShadowValue(named, opacity);
|
|
4418
4484
|
}
|
|
4485
|
+
const color = layerColor("text-shadow", value, opacity, token, extra?.realThemeValue);
|
|
4486
|
+
if (color !== void 0) return color && [textShadowProperties(), ...color];
|
|
4487
|
+
if (token.arbitrary) return textShadowValue(value, opacity);
|
|
4419
4488
|
return null;
|
|
4420
4489
|
},
|
|
4421
|
-
handleCustomProperty: (value) => [decl("
|
|
4490
|
+
handleCustomProperty: (value) => value.startsWith("color:") ? [textShadowProperties(), ...shadowColorDecls("text-shadow", `var(${value.slice(6)})`, void 0) ?? []] : [textShadowProperties(), decl("text-shadow", `var(${value})`)],
|
|
4491
|
+
category: "effects"
|
|
4422
4492
|
});
|
|
4423
4493
|
[
|
|
4424
4494
|
["ring", "1px"],
|
|
@@ -4961,12 +5031,15 @@ staticUtility("not-sr-only", [
|
|
|
4961
5031
|
], { category: "layout" });
|
|
4962
5032
|
staticUtility("@container", [["container-type", "inline-size"]], { category: "layout" });
|
|
4963
5033
|
staticUtility("@container-normal", [["container-type", "normal"]], { category: "layout" });
|
|
5034
|
+
staticUtility("@container-size", [["container-type", "size"]], { category: "layout" });
|
|
5035
|
+
const NAMED_CONTAINER = /^@container(-normal|-size)?\/([a-zA-Z0-9_-]+)$/;
|
|
5036
|
+
const CONTAINER_TYPE = { "": "inline-size", "-normal": "normal", "-size": "size" };
|
|
4964
5037
|
registerUtility({
|
|
4965
5038
|
name: "@container",
|
|
4966
|
-
match: (className) =>
|
|
5039
|
+
match: (className) => NAMED_CONTAINER.test(className),
|
|
4967
5040
|
handler: (_value, _ctx, token) => {
|
|
4968
|
-
const
|
|
4969
|
-
return
|
|
5041
|
+
const m = NAMED_CONTAINER.exec(`${token.prefix}${token.value ? `-${token.value}` : ""}`);
|
|
5042
|
+
return m ? [decl("container-type", CONTAINER_TYPE[m[1] ?? ""]), decl("container-name", m[2])] : null;
|
|
4970
5043
|
},
|
|
4971
5044
|
category: "layout"
|
|
4972
5045
|
});
|
|
@@ -5051,6 +5124,11 @@ staticUtility("sticky", [["position", "sticky"]], { category: "layout" });
|
|
|
5051
5124
|
[
|
|
5052
5125
|
["inset-x", "inset-inline"],
|
|
5053
5126
|
["inset-y", "inset-block"],
|
|
5127
|
+
// Tailwind 4.3 logical sides; registered before `inset` so their handler runs first for `inset-s-*` etc.
|
|
5128
|
+
["inset-s", "inset-inline-start"],
|
|
5129
|
+
["inset-e", "inset-inline-end"],
|
|
5130
|
+
["inset-bs", "inset-block-start"],
|
|
5131
|
+
["inset-be", "inset-block-end"],
|
|
5054
5132
|
["inset", "inset"],
|
|
5055
5133
|
["start", "inset-inline-start"],
|
|
5056
5134
|
["end", "inset-inline-end"],
|
|
@@ -5146,6 +5224,15 @@ functionalUtility({
|
|
|
5146
5224
|
description: "gap utility (number, arbitrary, custom property supported)",
|
|
5147
5225
|
category: "layout"
|
|
5148
5226
|
});
|
|
5227
|
+
functionalUtility({
|
|
5228
|
+
name: "zoom",
|
|
5229
|
+
prop: "zoom",
|
|
5230
|
+
supportsArbitrary: true,
|
|
5231
|
+
supportsCustomProperty: true,
|
|
5232
|
+
handleBareValue: ({ value }) => /^\d+$/.test(value) ? `${value}%` : null,
|
|
5233
|
+
description: "zoom utility (integer percent, arbitrary, custom property)",
|
|
5234
|
+
category: "layout"
|
|
5235
|
+
});
|
|
5149
5236
|
staticUtility("basis-full", [["flex-basis", "100%"]], { category: "flex-grid" });
|
|
5150
5237
|
staticUtility("basis-auto", [["flex-basis", "auto"]], { category: "flex-grid" });
|
|
5151
5238
|
staticUtility("basis-3xs", [["flex-basis", "var(--container-3xs)"]], { category: "flex-grid" });
|
|
@@ -5420,6 +5507,8 @@ functionalUtility({
|
|
|
5420
5507
|
// auto-cols-[minmax(0,2fr)]
|
|
5421
5508
|
supportsCustomProperty: true,
|
|
5422
5509
|
// auto-cols-(--my-auto-cols)
|
|
5510
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5511
|
+
// #310: auto-cols-4
|
|
5423
5512
|
handle: (value) => {
|
|
5424
5513
|
if (typeof value === "string") return [decl("grid-auto-columns", value)];
|
|
5425
5514
|
return null;
|
|
@@ -5439,6 +5528,8 @@ functionalUtility({
|
|
|
5439
5528
|
// auto-rows-[minmax(0,2fr)]
|
|
5440
5529
|
supportsCustomProperty: true,
|
|
5441
5530
|
// auto-rows-(--my-auto-rows)
|
|
5531
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5532
|
+
// #310: auto-rows-12
|
|
5442
5533
|
handle: (value) => {
|
|
5443
5534
|
if (typeof value === "string") return [decl("grid-auto-rows", value)];
|
|
5444
5535
|
return null;
|
|
@@ -5641,6 +5732,8 @@ functionalUtility({
|
|
|
5641
5732
|
["py", "padding-block"],
|
|
5642
5733
|
["ps", "padding-inline-start"],
|
|
5643
5734
|
["pe", "padding-inline-end"],
|
|
5735
|
+
["pbs", "padding-block-start"],
|
|
5736
|
+
["pbe", "padding-block-end"],
|
|
5644
5737
|
["pt", "padding-top"],
|
|
5645
5738
|
["pr", "padding-right"],
|
|
5646
5739
|
["pb", "padding-bottom"],
|
|
@@ -5664,6 +5757,8 @@ functionalUtility({
|
|
|
5664
5757
|
["my", "margin-block"],
|
|
5665
5758
|
["ms", "margin-inline-start"],
|
|
5666
5759
|
["me", "margin-inline-end"],
|
|
5760
|
+
["mbs", "margin-block-start"],
|
|
5761
|
+
["mbe", "margin-block-end"],
|
|
5667
5762
|
["mt", "margin-top"],
|
|
5668
5763
|
["mr", "margin-right"],
|
|
5669
5764
|
["mb", "margin-bottom"],
|
|
@@ -5989,6 +6084,41 @@ functionalUtility({
|
|
|
5989
6084
|
description: "max-width utility (spacing, fraction, arbitrary, custom property, static supported)",
|
|
5990
6085
|
category: "sizing"
|
|
5991
6086
|
});
|
|
6087
|
+
{
|
|
6088
|
+
const containers = ["3xs", "2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "5xl", "6xl", "7xl"].map(
|
|
6089
|
+
(k) => [k, `var(--container-${k})`]
|
|
6090
|
+
);
|
|
6091
|
+
const common = [["0", "0px"], ["px", "1px"], ["full", "100%"], ["min", "min-content"], ["max", "max-content"], ["fit", "fit-content"]];
|
|
6092
|
+
const inlineVp = [["screen", "100vw"], ["dvw", "100dvw"], ["lvw", "100lvw"], ["svw", "100svw"]];
|
|
6093
|
+
const blockVp = [["screen", "100vh"], ["dvh", "100dvh"], ["lvh", "100lvh"], ["svh", "100svh"], ["lh", "1lh"]];
|
|
6094
|
+
const families = [
|
|
6095
|
+
["inline", "inline-size", [...common, ["auto", "auto"], ...inlineVp, ...containers]],
|
|
6096
|
+
["min-inline", "min-inline-size", [...common, ["auto", "auto"], ...inlineVp, ...containers]],
|
|
6097
|
+
["max-inline", "max-inline-size", [...common, ["none", "none"], ...inlineVp, ...containers]],
|
|
6098
|
+
["block", "block-size", [...common, ["auto", "auto"], ...blockVp]],
|
|
6099
|
+
["min-block", "min-block-size", [...common, ["auto", "auto"], ...blockVp]],
|
|
6100
|
+
["max-block", "max-block-size", [...common, ["none", "none"], ...blockVp]]
|
|
6101
|
+
];
|
|
6102
|
+
for (const [name, prop, statics] of families) {
|
|
6103
|
+
for (const [key, value] of statics) staticUtility(`${name}-${key}`, [[prop, value]], { category: "sizing" });
|
|
6104
|
+
functionalUtility({
|
|
6105
|
+
spacingKeys: true,
|
|
6106
|
+
name,
|
|
6107
|
+
prop,
|
|
6108
|
+
supportsArbitrary: true,
|
|
6109
|
+
supportsCustomProperty: true,
|
|
6110
|
+
supportsFraction: true,
|
|
6111
|
+
handleBareValue: ({ value, token }) => {
|
|
6112
|
+
if (token.negative) return null;
|
|
6113
|
+
if (parseNumber(value)) return `calc(var(--spacing) * ${value})`;
|
|
6114
|
+
if (parseFractionOrNumber(value)) return `calc(${value} * 100%)`;
|
|
6115
|
+
return null;
|
|
6116
|
+
},
|
|
6117
|
+
description: `${prop} utility (spacing, fraction, arbitrary, custom property, keywords)`,
|
|
6118
|
+
category: "sizing"
|
|
6119
|
+
});
|
|
6120
|
+
}
|
|
6121
|
+
}
|
|
5992
6122
|
const leadingProperty = () => atRoot([property("--baro-leading")]);
|
|
5993
6123
|
staticUtility("font-sans", [["font-family", "var(--font-sans)"]], { category: "typography" });
|
|
5994
6124
|
staticUtility("font-serif", [["font-family", "var(--font-serif)"]], { category: "typography" });
|
|
@@ -6019,13 +6149,15 @@ functionalUtility({
|
|
|
6019
6149
|
name: "font",
|
|
6020
6150
|
supportsArbitrary: true,
|
|
6021
6151
|
supportsCustomProperty: true,
|
|
6022
|
-
handle: (value) => {
|
|
6152
|
+
handle: (value, _ctx, token) => {
|
|
6153
|
+
if (token.prefix !== "font") return null;
|
|
6023
6154
|
if (parseNumber(value)) {
|
|
6024
6155
|
return [decl("font-weight", value)];
|
|
6025
6156
|
}
|
|
6026
6157
|
return [decl("font-family", value)];
|
|
6027
6158
|
},
|
|
6028
|
-
handleCustomProperty: (value) => {
|
|
6159
|
+
handleCustomProperty: (value, _ctx, token) => {
|
|
6160
|
+
if (token.prefix !== "font") return null;
|
|
6029
6161
|
if (value.startsWith("font-name:")) {
|
|
6030
6162
|
return [decl("font-family", `var(${value.replace("font-name:", "")})`)];
|
|
6031
6163
|
}
|
|
@@ -6324,6 +6456,42 @@ functionalUtility({
|
|
|
6324
6456
|
description: "content utility (arbitrary, custom property supported)",
|
|
6325
6457
|
category: "typography"
|
|
6326
6458
|
});
|
|
6459
|
+
const placeholderColor = (value) => [rule("&::placeholder", [decl("color", value)])];
|
|
6460
|
+
staticUtility("placeholder-inherit", placeholderColor("inherit"), { category: "typography" });
|
|
6461
|
+
staticUtility("placeholder-current", placeholderColor("currentcolor"), { category: "typography" });
|
|
6462
|
+
staticUtility("placeholder-transparent", placeholderColor("transparent"), { category: "typography" });
|
|
6463
|
+
functionalUtility({
|
|
6464
|
+
name: "placeholder",
|
|
6465
|
+
themeKeys: ["colors"],
|
|
6466
|
+
supportsArbitrary: true,
|
|
6467
|
+
supportsCustomProperty: true,
|
|
6468
|
+
supportsOpacity: true,
|
|
6469
|
+
handle: (value, _ctx, _token, extra) => {
|
|
6470
|
+
if (extra?.realThemeValue) return [rule("&::placeholder", themeColorDecls("color", value, extra))];
|
|
6471
|
+
if (parseColor(value)) return placeholderColor(value);
|
|
6472
|
+
return null;
|
|
6473
|
+
},
|
|
6474
|
+
handleCustomProperty: (value) => placeholderColor(`var(${value})`),
|
|
6475
|
+
description: "placeholder color utility (theme, alpha, arbitrary, custom property)"
|
|
6476
|
+
});
|
|
6477
|
+
functionalUtility({
|
|
6478
|
+
name: "font-features",
|
|
6479
|
+
supportsArbitrary: true,
|
|
6480
|
+
supportsCustomProperty: true,
|
|
6481
|
+
handle: (value, _ctx, token) => token.arbitrary ? [decl("font-feature-settings", value)] : null,
|
|
6482
|
+
handleCustomProperty: (value) => [decl("font-feature-settings", `var(${value.replace(/^[a-z-]+:(?=--)/, "")})`)],
|
|
6483
|
+
description: "font-feature-settings utility (arbitrary, custom property)",
|
|
6484
|
+
category: "typography"
|
|
6485
|
+
});
|
|
6486
|
+
functionalUtility({
|
|
6487
|
+
name: "tab",
|
|
6488
|
+
prop: "tab-size",
|
|
6489
|
+
supportsArbitrary: true,
|
|
6490
|
+
supportsCustomProperty: true,
|
|
6491
|
+
handleBareValue: ({ value }) => /^\d+$/.test(value) ? value : null,
|
|
6492
|
+
description: "tab-size utility (integer, arbitrary, custom property)",
|
|
6493
|
+
category: "typography"
|
|
6494
|
+
});
|
|
6327
6495
|
const gradientStopProperties = () => {
|
|
6328
6496
|
return atRoot([
|
|
6329
6497
|
property("--baro-gradient-position"),
|
|
@@ -6655,6 +6823,11 @@ const withBorderStyle = (props, width) => [
|
|
|
6655
6823
|
[
|
|
6656
6824
|
["border-x", ["border-left-width", "border-right-width"]],
|
|
6657
6825
|
["border-y", ["border-top-width", "border-bottom-width"]],
|
|
6826
|
+
["border-bs", ["border-block-start-width"]],
|
|
6827
|
+
["border-be", ["border-block-end-width"]],
|
|
6828
|
+
["border-s", ["border-inline-start-width"]],
|
|
6829
|
+
// #311 (Tailwind 4.3)
|
|
6830
|
+
["border-e", ["border-inline-end-width"]],
|
|
6658
6831
|
["border-t", ["border-top-width"]],
|
|
6659
6832
|
["border-r", ["border-right-width"]],
|
|
6660
6833
|
["border-b", ["border-bottom-width"]],
|
|
@@ -6674,6 +6847,7 @@ const withBorderStyle = (props, width) => [
|
|
|
6674
6847
|
functionalUtility({
|
|
6675
6848
|
name,
|
|
6676
6849
|
themeKeys: ["borderWidth", "colors"],
|
|
6850
|
+
supportsOpacity: true,
|
|
6677
6851
|
supportsArbitrary: true,
|
|
6678
6852
|
supportsCustomProperty: true,
|
|
6679
6853
|
handleBareValue: ({ value }) => {
|
|
@@ -7654,9 +7828,10 @@ staticModifier("starting", ["&"], {
|
|
|
7654
7828
|
wrap: () => [atRule("starting-style", "", [], "starting")],
|
|
7655
7829
|
source: "starting"
|
|
7656
7830
|
});
|
|
7657
|
-
function createContainerParams(type, value, name) {
|
|
7831
|
+
function createContainerParams(type, value, name, negate = false) {
|
|
7658
7832
|
const condition = type === "min" ? "width >=" : "width <";
|
|
7659
|
-
|
|
7833
|
+
const query = `${negate ? "not " : ""}(${condition} ${value})`;
|
|
7834
|
+
return name ? `${name} ${query}` : query;
|
|
7660
7835
|
}
|
|
7661
7836
|
function createContainerRule(params, ast) {
|
|
7662
7837
|
return {
|
|
@@ -7825,17 +8000,17 @@ functionalModifier(
|
|
|
7825
8000
|
return result;
|
|
7826
8001
|
}
|
|
7827
8002
|
);
|
|
7828
|
-
const SIZE_VARIANT =
|
|
8003
|
+
const SIZE_VARIANT = /^(not-)?@(?:(min|max)-)?(\[[^\]]+\]|[a-zA-Z0-9.]+)(?:\/([a-zA-Z0-9_-]+))?$/;
|
|
7829
8004
|
functionalModifier(
|
|
7830
|
-
(mod) => SIZE_VARIANT.test(mod) &&
|
|
8005
|
+
(mod) => SIZE_VARIANT.test(mod) && !/^(?:not-)?@container(?:\/|$)/.test(mod),
|
|
7831
8006
|
void 0,
|
|
7832
8007
|
(mod, context) => {
|
|
7833
8008
|
const m = SIZE_VARIANT.exec(mod.type);
|
|
7834
8009
|
if (!m) return [];
|
|
7835
|
-
const [, type, size, name] = m;
|
|
8010
|
+
const [, not, type, size, name] = m;
|
|
7836
8011
|
const value = size.startsWith("[") ? size.slice(1, -1).replace(/_/g, " ") : context.theme("container." + size);
|
|
7837
8012
|
if (!value) return [];
|
|
7838
|
-
return [createContainerRule(createContainerParams(type === "max" ? "max" : "min", value, name), [])];
|
|
8013
|
+
return [createContainerRule(createContainerParams(type === "max" ? "max" : "min", value, name, !!not), [])];
|
|
7839
8014
|
}
|
|
7840
8015
|
);
|
|
7841
8016
|
const startsAtRule = (bracket) => /^[\s_]*@/.test(bracket);
|
|
@@ -7975,7 +8150,7 @@ functionalModifier(
|
|
|
7975
8150
|
}
|
|
7976
8151
|
);
|
|
7977
8152
|
functionalModifier(
|
|
7978
|
-
(mod) => /^not-/.test(mod),
|
|
8153
|
+
(mod) => /^not-/.test(mod) && !mod.startsWith("not-@"),
|
|
7979
8154
|
({ selector, mod }) => {
|
|
7980
8155
|
const m = /^not-(.+)$/.exec(mod.type);
|
|
7981
8156
|
return {
|
|
@@ -8042,7 +8217,8 @@ functionalModifier(
|
|
|
8042
8217
|
void 0
|
|
8043
8218
|
);
|
|
8044
8219
|
functionalModifier(
|
|
8045
|
-
(mod) => mod.startsWith("not-"),
|
|
8220
|
+
(mod) => mod.startsWith("not-") && !mod.startsWith("not-@"),
|
|
8221
|
+
// not-@… is container negation (#311)
|
|
8046
8222
|
({ selector, mod }) => {
|
|
8047
8223
|
const pseudo = mod.type.replace("not-", "");
|
|
8048
8224
|
if (pseudo.startsWith("[")) {
|
|
@@ -8476,6 +8652,7 @@ exports.getPreflightCSS = getPreflightCSS;
|
|
|
8476
8652
|
exports.getUtility = getUtility;
|
|
8477
8653
|
exports.hasCommentDelimiter = hasCommentDelimiter;
|
|
8478
8654
|
exports.hasCommentToken = hasCommentToken;
|
|
8655
|
+
exports.hasHtmlEndTagOpener = hasHtmlEndTagOpener;
|
|
8479
8656
|
exports.hasPreset = hasPreset;
|
|
8480
8657
|
exports.isDebug = isDebug;
|
|
8481
8658
|
exports.isSafeVariantToken = isSafeVariantToken;
|