@barocss/browser 0.7.0 → 0.8.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 +4 -0
- package/dist/cdn/barocss.js +501 -264
- 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/package.json +3 -3
package/dist/cdn/barocss.js
CHANGED
|
@@ -194,6 +194,7 @@ function getUtility(ctx) {
|
|
|
194
194
|
const modifierRegistry = [];
|
|
195
195
|
function staticModifier(name, selectors, options = {}, ctx) {
|
|
196
196
|
registerModifier({
|
|
197
|
+
name,
|
|
197
198
|
match: (mod) => mod === name,
|
|
198
199
|
modifySelector: ({ ..._rest }) => {
|
|
199
200
|
return selectors.map((sel) => ({
|
|
@@ -1153,6 +1154,8 @@ function themeToCssVarsAll(theme) {
|
|
|
1153
1154
|
...transitionDurationToCssVars(theme.transitionDuration),
|
|
1154
1155
|
...transitionDelayToCssVars(theme.transitionDelay),
|
|
1155
1156
|
...blurToCssVars(theme.blur),
|
|
1157
|
+
...Object.fromEntries(Object.entries(theme.textShadow ?? {}).map(([k, v2]) => [`--text-shadow-${escapeKey(k)}`, v2])),
|
|
1158
|
+
...Object.fromEntries(Object.entries(theme.dropShadow ?? {}).map(([k, v2]) => [`--drop-shadow-${escapeKey(k)}`, v2])),
|
|
1156
1159
|
...Object.fromEntries(Object.entries(theme.aspect ?? {}).map(([k, v2]) => [`--aspect-${escapeKey(k)}`, v2]))
|
|
1157
1160
|
// keyframes handled separately
|
|
1158
1161
|
};
|
|
@@ -1838,7 +1841,7 @@ const colors = {
|
|
|
1838
1841
|
"950": "oklch(13% 0.028 261.692)"
|
|
1839
1842
|
},
|
|
1840
1843
|
zinc: {
|
|
1841
|
-
"50": "oklch(98.5% 0
|
|
1844
|
+
"50": "oklch(98.5% 0 none)",
|
|
1842
1845
|
"100": "oklch(96.7% 0.001 286.375)",
|
|
1843
1846
|
"200": "oklch(92% 0.004 286.32)",
|
|
1844
1847
|
"300": "oklch(87.1% 0.006 286.286)",
|
|
@@ -1851,17 +1854,17 @@ const colors = {
|
|
|
1851
1854
|
"950": "oklch(14.1% 0.005 285.823)"
|
|
1852
1855
|
},
|
|
1853
1856
|
neutral: {
|
|
1854
|
-
"50": "oklch(98.5% 0
|
|
1855
|
-
"100": "oklch(97% 0
|
|
1856
|
-
"200": "oklch(92.2% 0
|
|
1857
|
-
"300": "oklch(87% 0
|
|
1858
|
-
"400": "oklch(70.8% 0
|
|
1859
|
-
"500": "oklch(55.6% 0
|
|
1860
|
-
"600": "oklch(43.9% 0
|
|
1861
|
-
"700": "oklch(37.1% 0
|
|
1862
|
-
"800": "oklch(26.9% 0
|
|
1863
|
-
"900": "oklch(20.5% 0
|
|
1864
|
-
"950": "oklch(14.5% 0
|
|
1857
|
+
"50": "oklch(98.5% 0 none)",
|
|
1858
|
+
"100": "oklch(97% 0 none)",
|
|
1859
|
+
"200": "oklch(92.2% 0 none)",
|
|
1860
|
+
"300": "oklch(87% 0 none)",
|
|
1861
|
+
"400": "oklch(70.8% 0 none)",
|
|
1862
|
+
"500": "oklch(55.6% 0 none)",
|
|
1863
|
+
"600": "oklch(43.9% 0 none)",
|
|
1864
|
+
"700": "oklch(37.1% 0 none)",
|
|
1865
|
+
"800": "oklch(26.9% 0 none)",
|
|
1866
|
+
"900": "oklch(20.5% 0 none)",
|
|
1867
|
+
"950": "oklch(14.5% 0 none)"
|
|
1865
1868
|
},
|
|
1866
1869
|
stone: {
|
|
1867
1870
|
"50": "oklch(98.5% 0.001 106.423)",
|
|
@@ -2096,6 +2099,58 @@ const colors = {
|
|
|
2096
2099
|
"800": "oklch(45.5% 0.188 13.697)",
|
|
2097
2100
|
"900": "oklch(41% 0.159 10.272)",
|
|
2098
2101
|
"950": "oklch(27.1% 0.105 12.094)"
|
|
2102
|
+
},
|
|
2103
|
+
mauve: {
|
|
2104
|
+
"50": "oklch(98.5% 0 none)",
|
|
2105
|
+
"100": "oklch(96% 0.003 325.6)",
|
|
2106
|
+
"200": "oklch(92.2% 0.005 325.62)",
|
|
2107
|
+
"300": "oklch(86.5% 0.012 325.68)",
|
|
2108
|
+
"400": "oklch(71.1% 0.019 323.02)",
|
|
2109
|
+
"500": "oklch(54.2% 0.034 322.5)",
|
|
2110
|
+
"600": "oklch(43.5% 0.029 321.78)",
|
|
2111
|
+
"700": "oklch(36.4% 0.029 323.89)",
|
|
2112
|
+
"800": "oklch(26.3% 0.024 320.12)",
|
|
2113
|
+
"900": "oklch(21.2% 0.019 322.12)",
|
|
2114
|
+
"950": "oklch(14.5% 0.008 326)"
|
|
2115
|
+
},
|
|
2116
|
+
olive: {
|
|
2117
|
+
"50": "oklch(98.8% 0.003 106.5)",
|
|
2118
|
+
"100": "oklch(96.6% 0.005 106.5)",
|
|
2119
|
+
"200": "oklch(93% 0.007 106.5)",
|
|
2120
|
+
"300": "oklch(88% 0.011 106.6)",
|
|
2121
|
+
"400": "oklch(73.7% 0.021 106.9)",
|
|
2122
|
+
"500": "oklch(58% 0.031 107.3)",
|
|
2123
|
+
"600": "oklch(46.6% 0.025 107.3)",
|
|
2124
|
+
"700": "oklch(39.4% 0.023 107.4)",
|
|
2125
|
+
"800": "oklch(28.6% 0.016 107.4)",
|
|
2126
|
+
"900": "oklch(22.8% 0.013 107.4)",
|
|
2127
|
+
"950": "oklch(15.3% 0.006 107.1)"
|
|
2128
|
+
},
|
|
2129
|
+
mist: {
|
|
2130
|
+
"50": "oklch(98.7% 0.002 197.1)",
|
|
2131
|
+
"100": "oklch(96.3% 0.002 197.1)",
|
|
2132
|
+
"200": "oklch(92.5% 0.005 214.3)",
|
|
2133
|
+
"300": "oklch(87.2% 0.007 219.6)",
|
|
2134
|
+
"400": "oklch(72.3% 0.014 214.4)",
|
|
2135
|
+
"500": "oklch(56% 0.021 213.5)",
|
|
2136
|
+
"600": "oklch(45% 0.017 213.2)",
|
|
2137
|
+
"700": "oklch(37.8% 0.015 216)",
|
|
2138
|
+
"800": "oklch(27.5% 0.011 216.9)",
|
|
2139
|
+
"900": "oklch(21.8% 0.008 223.9)",
|
|
2140
|
+
"950": "oklch(14.8% 0.004 228.8)"
|
|
2141
|
+
},
|
|
2142
|
+
taupe: {
|
|
2143
|
+
"50": "oklch(98.6% 0.002 67.8)",
|
|
2144
|
+
"100": "oklch(96% 0.002 17.2)",
|
|
2145
|
+
"200": "oklch(92.2% 0.005 34.3)",
|
|
2146
|
+
"300": "oklch(86.8% 0.007 39.5)",
|
|
2147
|
+
"400": "oklch(71.4% 0.014 41.2)",
|
|
2148
|
+
"500": "oklch(54.7% 0.021 43.1)",
|
|
2149
|
+
"600": "oklch(43.8% 0.017 39.3)",
|
|
2150
|
+
"700": "oklch(36.7% 0.016 35.7)",
|
|
2151
|
+
"800": "oklch(26.8% 0.011 36.5)",
|
|
2152
|
+
"900": "oklch(21.4% 0.009 43.1)",
|
|
2153
|
+
"950": "oklch(14.7% 0.004 49.3)"
|
|
2099
2154
|
}
|
|
2100
2155
|
};
|
|
2101
2156
|
const spacing = {
|
|
@@ -2167,8 +2222,13 @@ const fontSize = {
|
|
|
2167
2222
|
};
|
|
2168
2223
|
const fontFamily = {
|
|
2169
2224
|
sans: [
|
|
2170
|
-
"
|
|
2171
|
-
"
|
|
2225
|
+
"-apple-system",
|
|
2226
|
+
"BlinkMacSystemFont",
|
|
2227
|
+
"Segoe UI",
|
|
2228
|
+
"Roboto",
|
|
2229
|
+
"Helvetica Neue",
|
|
2230
|
+
"Noto Sans",
|
|
2231
|
+
"Arial",
|
|
2172
2232
|
"sans-serif",
|
|
2173
2233
|
"Apple Color Emoji",
|
|
2174
2234
|
"Segoe UI Emoji",
|
|
@@ -2379,6 +2439,21 @@ const blur = {
|
|
|
2379
2439
|
"2xl": "40px",
|
|
2380
2440
|
"3xl": "64px"
|
|
2381
2441
|
};
|
|
2442
|
+
const textShadow = {
|
|
2443
|
+
"2xs": "0px 1px 0px rgb(0 0 0 / 0.15)",
|
|
2444
|
+
xs: "0px 1px 1px rgb(0 0 0 / 0.2)",
|
|
2445
|
+
sm: "0px 1px 0px rgb(0 0 0 / 0.075), 0px 1px 1px rgb(0 0 0 / 0.075), 0px 2px 2px rgb(0 0 0 / 0.075)",
|
|
2446
|
+
md: "0px 1px 1px rgb(0 0 0 / 0.1), 0px 1px 2px rgb(0 0 0 / 0.1), 0px 2px 4px rgb(0 0 0 / 0.1)",
|
|
2447
|
+
lg: "0px 1px 2px rgb(0 0 0 / 0.1), 0px 3px 2px rgb(0 0 0 / 0.1), 0px 4px 8px rgb(0 0 0 / 0.1)"
|
|
2448
|
+
};
|
|
2449
|
+
const dropShadow = {
|
|
2450
|
+
xs: "0 1px 1px rgb(0 0 0 / 0.05)",
|
|
2451
|
+
sm: "0 1px 2px rgb(0 0 0 / 0.15)",
|
|
2452
|
+
md: "0 3px 3px rgb(0 0 0 / 0.12)",
|
|
2453
|
+
lg: "0 4px 4px rgb(0 0 0 / 0.15)",
|
|
2454
|
+
xl: "0 9px 7px rgb(0 0 0 / 0.1)",
|
|
2455
|
+
"2xl": "0 25px 25px rgb(0 0 0 / 0.15)"
|
|
2456
|
+
};
|
|
2382
2457
|
const defaultTheme = {
|
|
2383
2458
|
colors,
|
|
2384
2459
|
spacing,
|
|
@@ -2401,6 +2476,8 @@ const defaultTheme = {
|
|
|
2401
2476
|
keyframes,
|
|
2402
2477
|
animationVars,
|
|
2403
2478
|
blur,
|
|
2479
|
+
textShadow,
|
|
2480
|
+
dropShadow,
|
|
2404
2481
|
// Tailwind 4.1.13 --aspect-* (aspect-video → var(--aspect-video))
|
|
2405
2482
|
aspect: { video: "16 / 9" }
|
|
2406
2483
|
};
|
|
@@ -2577,7 +2654,7 @@ html {
|
|
|
2577
2654
|
line-height: 1.15;
|
|
2578
2655
|
-webkit-text-size-adjust: 100%;
|
|
2579
2656
|
/* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
|
|
2580
|
-
font-family: var(--default-font-family, var(--font-sans,
|
|
2657
|
+
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'));
|
|
2581
2658
|
font-feature-settings: var(--default-font-feature-settings, normal);
|
|
2582
2659
|
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
2583
2660
|
}
|
|
@@ -2880,7 +2957,7 @@ html {
|
|
|
2880
2957
|
-webkit-text-size-adjust: 100%;
|
|
2881
2958
|
-ms-text-size-adjust: 100%;
|
|
2882
2959
|
/* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
|
|
2883
|
-
font-family: var(--default-font-family, var(--font-sans,
|
|
2960
|
+
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'));
|
|
2884
2961
|
font-feature-settings: var(--default-font-feature-settings, normal);
|
|
2885
2962
|
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
2886
2963
|
}
|
|
@@ -3781,6 +3858,9 @@ staticUtility("snap-both", [["scroll-snap-type", "both var(--baro-scroll-snap-st
|
|
|
3781
3858
|
staticUtility("snap-mandatory", [["--baro-scroll-snap-strictness", "mandatory"]], { category: "interactivity" });
|
|
3782
3859
|
staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]], { category: "interactivity" });
|
|
3783
3860
|
[
|
|
3861
|
+
["mbs", "scroll-margin-block-start"],
|
|
3862
|
+
// #311 (Tailwind 4.3), before `mb`
|
|
3863
|
+
["mbe", "scroll-margin-block-end"],
|
|
3784
3864
|
["mt", "scroll-margin-top"],
|
|
3785
3865
|
["mr", "scroll-margin-right"],
|
|
3786
3866
|
["mb", "scroll-margin-bottom"],
|
|
@@ -3791,6 +3871,8 @@ staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]]
|
|
|
3791
3871
|
["me", "scroll-margin-inline-end"],
|
|
3792
3872
|
["m", "scroll-margin"]
|
|
3793
3873
|
].forEach(([name, prop]) => {
|
|
3874
|
+
staticUtility(`scroll-${name}-px`, [[prop, "1px"]], { category: "interactivity" });
|
|
3875
|
+
staticUtility(`-scroll-${name}-px`, [[prop, "-1px"]], { category: "interactivity" });
|
|
3794
3876
|
functionalUtility({
|
|
3795
3877
|
name: `scroll-${name}`,
|
|
3796
3878
|
spacingKeys: true,
|
|
@@ -3809,6 +3891,9 @@ staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]]
|
|
|
3809
3891
|
});
|
|
3810
3892
|
});
|
|
3811
3893
|
[
|
|
3894
|
+
["pbs", "scroll-padding-block-start"],
|
|
3895
|
+
// #311 (Tailwind 4.3), before `pb`
|
|
3896
|
+
["pbe", "scroll-padding-block-end"],
|
|
3812
3897
|
["pt", "scroll-padding-top"],
|
|
3813
3898
|
["pr", "scroll-padding-right"],
|
|
3814
3899
|
["pb", "scroll-padding-bottom"],
|
|
@@ -3825,13 +3910,15 @@ staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]]
|
|
|
3825
3910
|
prop,
|
|
3826
3911
|
supportsArbitrary: true,
|
|
3827
3912
|
supportsCustomProperty: true,
|
|
3913
|
+
handleBareValue: ({ value }) => value === "px" ? "1px" : /^(\d|\.\d)/.test(value) ? value : null,
|
|
3828
3914
|
handle: (value, _ctx, token, _extra) => {
|
|
3829
|
-
if (
|
|
3915
|
+
if (token.negative) return [];
|
|
3916
|
+
if (parseNumber(value)) {
|
|
3830
3917
|
return [decl(prop, `calc(var(--spacing) * ${value})`)];
|
|
3831
3918
|
}
|
|
3832
3919
|
return [decl(prop, value)];
|
|
3833
3920
|
},
|
|
3834
|
-
handleCustomProperty: (value) => [decl(prop, `var(${value})`)],
|
|
3921
|
+
handleCustomProperty: (value, _ctx, token) => token.negative ? [] : [decl(prop, `var(${value})`)],
|
|
3835
3922
|
description: `scroll-${name} utility (static, arbitrary, custom property supported)`,
|
|
3836
3923
|
category: "interactivity"
|
|
3837
3924
|
});
|
|
@@ -3862,6 +3949,40 @@ functionalUtility({
|
|
|
3862
3949
|
description: "will-change utility (static, arbitrary, custom property supported)",
|
|
3863
3950
|
category: "interactivity"
|
|
3864
3951
|
});
|
|
3952
|
+
staticUtility("scrollbar-auto", [["scrollbar-width", "auto"]], { category: "interactivity" });
|
|
3953
|
+
staticUtility("scrollbar-thin", [["scrollbar-width", "thin"]], { category: "interactivity" });
|
|
3954
|
+
staticUtility("scrollbar-none", [["scrollbar-width", "none"]], { category: "interactivity" });
|
|
3955
|
+
staticUtility("scrollbar-gutter-auto", [["scrollbar-gutter", "auto"]], { category: "interactivity" });
|
|
3956
|
+
staticUtility("scrollbar-gutter-stable", [["scrollbar-gutter", "stable"]], { category: "interactivity" });
|
|
3957
|
+
staticUtility("scrollbar-gutter-both", [["scrollbar-gutter", "stable both-edges"]], { category: "interactivity" });
|
|
3958
|
+
const SCROLLBAR_COLOR = "var(--baro-scrollbar-thumb) var(--baro-scrollbar-track)";
|
|
3959
|
+
const scrollbarProperties = () => atRoot([
|
|
3960
|
+
property("--baro-scrollbar-thumb", "#0000", "<color>"),
|
|
3961
|
+
property("--baro-scrollbar-track", "#0000", "<color>")
|
|
3962
|
+
]);
|
|
3963
|
+
const stripColorHint = (v) => v.replace(/^color:/, "");
|
|
3964
|
+
for (const part of ["thumb", "track"]) {
|
|
3965
|
+
const key = `--baro-scrollbar-${part}`;
|
|
3966
|
+
const compose = (inner) => [scrollbarProperties(), ...inner, decl("scrollbar-color", SCROLLBAR_COLOR)];
|
|
3967
|
+
const withOpacity = (color, opacity2) => opacity2 ? [decl(key, `color-mix(in oklab, ${color} ${opacity2.replace(/^\[(.*)\]$/, "$1").replace(/%$/, "")}%, transparent)`)] : [decl(key, color)];
|
|
3968
|
+
functionalUtility({
|
|
3969
|
+
name: `scrollbar-${part}`,
|
|
3970
|
+
themeKeys: ["colors"],
|
|
3971
|
+
supportsOpacity: true,
|
|
3972
|
+
supportsArbitrary: true,
|
|
3973
|
+
supportsCustomProperty: true,
|
|
3974
|
+
handle: (value, _ctx, token, extra) => {
|
|
3975
|
+
if (extra?.realThemeValue) return compose(withOpacity(`var(--color-${extra.realThemeValue})`, extra.opacity));
|
|
3976
|
+
if (token.arbitrary) return compose(withOpacity(stripColorHint(value), extra?.opacity));
|
|
3977
|
+
if (value === "inherit" || value === "transparent") return compose([decl(key, value)]);
|
|
3978
|
+
if (value === "current") return compose(withOpacity("currentcolor", extra?.opacity));
|
|
3979
|
+
return null;
|
|
3980
|
+
},
|
|
3981
|
+
handleCustomProperty: (value, _ctx, _token, extra) => compose(withOpacity(`var(${stripColorHint(value)})`, extra?.opacity)),
|
|
3982
|
+
description: `scrollbar-color ${part} utility (theme, arbitrary, custom property, opacity)`,
|
|
3983
|
+
category: "interactivity"
|
|
3984
|
+
});
|
|
3985
|
+
}
|
|
3865
3986
|
const defaultTiming = "var(--default-transition-timing-function)";
|
|
3866
3987
|
const defaultDuration = "var(--default-transition-duration)";
|
|
3867
3988
|
staticUtility("transition", [
|
|
@@ -3999,53 +4120,99 @@ staticUtility("border-collapse", [["border-collapse", "collapse"]], { category:
|
|
|
3999
4120
|
staticUtility("border-separate", [["border-collapse", "separate"]], { category: "table" });
|
|
4000
4121
|
staticUtility("table-auto", [["table-layout", "auto"]], { category: "table" });
|
|
4001
4122
|
staticUtility("table-fixed", [["table-layout", "fixed"]], { category: "table" });
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
});
|
|
4032
|
-
functionalUtility({
|
|
4033
|
-
name: "border-spacing",
|
|
4034
|
-
prop: "border-spacing",
|
|
4035
|
-
supportsArbitrary: true,
|
|
4036
|
-
supportsCustomProperty: true,
|
|
4037
|
-
handle: (value, _ctx, _token) => {
|
|
4038
|
-
if (parseNumber(value)) {
|
|
4039
|
-
return [decl("border-spacing", `calc(var(--spacing) * ${value})`)];
|
|
4040
|
-
}
|
|
4041
|
-
return [decl("border-spacing", value)];
|
|
4042
|
-
},
|
|
4043
|
-
handleCustomProperty: (value) => [decl("border-spacing", `var(${value})`)],
|
|
4044
|
-
description: "border-spacing utility (static, number, arbitrary, custom property supported)",
|
|
4045
|
-
category: "table"
|
|
4123
|
+
const borderSpacingProperties = () => atRoot([
|
|
4124
|
+
property("--baro-border-spacing-x", "0", "<length>"),
|
|
4125
|
+
property("--baro-border-spacing-y", "0", "<length>")
|
|
4126
|
+
]);
|
|
4127
|
+
const BORDER_SPACING = "var(--baro-border-spacing-x) var(--baro-border-spacing-y)";
|
|
4128
|
+
const borderSpacing = (axes, v) => [
|
|
4129
|
+
borderSpacingProperties(),
|
|
4130
|
+
...axes.map((a) => decl(`--baro-border-spacing-${a}`, v)),
|
|
4131
|
+
decl("border-spacing", BORDER_SPACING)
|
|
4132
|
+
];
|
|
4133
|
+
[
|
|
4134
|
+
["border-spacing-x", ["x"]],
|
|
4135
|
+
["border-spacing-y", ["y"]],
|
|
4136
|
+
["border-spacing", ["x", "y"]]
|
|
4137
|
+
].forEach(([name, axes]) => {
|
|
4138
|
+
staticUtility(`${name}-px`, [
|
|
4139
|
+
borderSpacingProperties,
|
|
4140
|
+
...axes.map((a) => [`--baro-border-spacing-${a}`, "1px"]),
|
|
4141
|
+
["border-spacing", BORDER_SPACING]
|
|
4142
|
+
], { category: "table" });
|
|
4143
|
+
functionalUtility({
|
|
4144
|
+
name,
|
|
4145
|
+
prop: "border-spacing",
|
|
4146
|
+
supportsArbitrary: true,
|
|
4147
|
+
supportsCustomProperty: true,
|
|
4148
|
+
handle: (value) => borderSpacing(axes, parseNumber(value) ? `calc(var(--spacing) * ${value})` : value),
|
|
4149
|
+
handleCustomProperty: (value) => borderSpacing(axes, `var(${value})`),
|
|
4150
|
+
description: `${name} utility (number, px, arbitrary, custom property supported)`,
|
|
4151
|
+
category: "table"
|
|
4152
|
+
});
|
|
4046
4153
|
});
|
|
4047
4154
|
staticUtility("caption-top", [["caption-side", "top"]], { category: "table" });
|
|
4048
4155
|
staticUtility("caption-bottom", [["caption-side", "bottom"]], { category: "table" });
|
|
4156
|
+
function parseAlpha(op) {
|
|
4157
|
+
if (!op) return null;
|
|
4158
|
+
if (/^\d+(\.\d+)?$/.test(op)) return { alpha: `${op}%`, isVar: false };
|
|
4159
|
+
const pct = /^\[(\d+(?:\.\d+)?)%\]$/.exec(op);
|
|
4160
|
+
if (pct) return { alpha: `${pct[1]}%`, isVar: false };
|
|
4161
|
+
const cp = /^\((--[\w-]+)\)$/.exec(op);
|
|
4162
|
+
if (cp) return { alpha: `var(${cp[1]})`, isVar: true };
|
|
4163
|
+
return null;
|
|
4164
|
+
}
|
|
4165
|
+
function splitTop(value, sep) {
|
|
4166
|
+
const out = [];
|
|
4167
|
+
let depth = 0;
|
|
4168
|
+
let cur = "";
|
|
4169
|
+
for (const ch of value) {
|
|
4170
|
+
if (ch === "(") depth++;
|
|
4171
|
+
else if (ch === ")") depth--;
|
|
4172
|
+
if (depth === 0 && (sep === " " ? /\s/.test(ch) : ch === sep)) {
|
|
4173
|
+
if (cur.trim()) out.push(cur.trim());
|
|
4174
|
+
cur = "";
|
|
4175
|
+
} else cur += ch;
|
|
4176
|
+
}
|
|
4177
|
+
if (cur.trim()) out.push(cur.trim());
|
|
4178
|
+
return out;
|
|
4179
|
+
}
|
|
4180
|
+
const LENGTH = /^-?(\d*\.)?\d+([a-z]+|%)?$/i;
|
|
4181
|
+
function shadowLayers(value, layer, alpha) {
|
|
4182
|
+
return splitTop(value, ",").map((l) => {
|
|
4183
|
+
const parts = splitTop(l, " ");
|
|
4184
|
+
const i = parts.findIndex((p) => p !== "inset" && !LENGTH.test(p));
|
|
4185
|
+
const c = i < 0 ? "currentcolor" : parts[i];
|
|
4186
|
+
parts[i < 0 ? parts.length : i] = `var(--baro-${layer}-color, ${alpha ? `oklab(from ${c} l a b / ${alpha})` : c})`;
|
|
4187
|
+
return parts.join(" ");
|
|
4188
|
+
});
|
|
4189
|
+
}
|
|
4190
|
+
function shadowValueDecls(layer, prop, value, opacity2, render = (l) => l.join(", ")) {
|
|
4191
|
+
const a = parseAlpha(opacity2);
|
|
4192
|
+
if (opacity2 && !a) return null;
|
|
4193
|
+
if (!a) return [decl(prop, render(shadowLayers(value, layer)))];
|
|
4194
|
+
const alphaDecl = decl(`--baro-${layer}-alpha`, a.alpha);
|
|
4195
|
+
if (!a.isVar) return [alphaDecl, decl(prop, render(shadowLayers(value, layer, a.alpha)))];
|
|
4196
|
+
return [
|
|
4197
|
+
alphaDecl,
|
|
4198
|
+
decl(prop, render(shadowLayers(value, layer))),
|
|
4199
|
+
atRule("supports", "(color: lab(from red l a b))", [decl(prop, render(shadowLayers(value, layer, a.alpha)))])
|
|
4200
|
+
];
|
|
4201
|
+
}
|
|
4202
|
+
function shadowColorDecls(layer, color, opacity2, ref = color) {
|
|
4203
|
+
const key = `--baro-${layer}-color`;
|
|
4204
|
+
if (color === "inherit") return [decl(key, "inherit")];
|
|
4205
|
+
const a = parseAlpha(opacity2);
|
|
4206
|
+
if (opacity2 && !a) return null;
|
|
4207
|
+
const inner = a ? `color-mix(in oklab, ${ref} ${a.alpha}, transparent)` : ref;
|
|
4208
|
+
const fallback = a ? `color-mix(in srgb, ${color} ${a.alpha}, transparent)` : color;
|
|
4209
|
+
return [
|
|
4210
|
+
decl(key, fallback),
|
|
4211
|
+
atRule("supports", "(color: color-mix(in lab, red, red))", [
|
|
4212
|
+
decl(key, `color-mix(in oklab, ${inner} var(--baro-${layer}-alpha), transparent)`)
|
|
4213
|
+
])
|
|
4214
|
+
];
|
|
4215
|
+
}
|
|
4049
4216
|
staticUtility("filter-none", [["filter", "none"]], { category: "effects" });
|
|
4050
4217
|
functionalUtility({
|
|
4051
4218
|
name: "filter",
|
|
@@ -4130,57 +4297,68 @@ functionalUtility({
|
|
|
4130
4297
|
description: "contrast filter utility (static, number, arbitrary, custom property supported)",
|
|
4131
4298
|
category: "effects"
|
|
4132
4299
|
});
|
|
4133
|
-
[
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4300
|
+
const dropShadowProperties = () => atRoot([
|
|
4301
|
+
property("--baro-drop-shadow"),
|
|
4302
|
+
property("--baro-drop-shadow-color"),
|
|
4303
|
+
property("--baro-drop-shadow-alpha", "100%", "<percentage>"),
|
|
4304
|
+
property("--baro-drop-shadow-size")
|
|
4305
|
+
]);
|
|
4306
|
+
const wrapDropShadow = (layers) => layers.map((l) => `drop-shadow(${l})`).join(" ");
|
|
4307
|
+
const DROP_SHADOW_DEFAULT = "0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06)";
|
|
4308
|
+
const namedDropShadow = (ctx, name) => {
|
|
4309
|
+
const v = ctx.theme("dropShadow", name);
|
|
4310
|
+
return typeof v === "string" && /^[\w.-]+$/.test(name) ? v : null;
|
|
4311
|
+
};
|
|
4312
|
+
function dropShadowValue(value, opacity2, named, keepNamed = false) {
|
|
4313
|
+
const decls = shadowValueDecls("drop-shadow", "--baro-drop-shadow-size", value, opacity2, wrapDropShadow);
|
|
4314
|
+
if (!decls) return null;
|
|
4315
|
+
const composed = named !== void 0 && (!opacity2 || keepNamed) ? named : "var(--baro-drop-shadow-size)";
|
|
4316
|
+
return [dropShadowProperties(), ...decls, decl("--baro-drop-shadow", composed), filters$1()];
|
|
4317
|
+
}
|
|
4318
|
+
staticUtility("drop-shadow-none", [decl("--baro-drop-shadow", " "), filters$1()]);
|
|
4319
|
+
registerUtility({
|
|
4320
|
+
name: "drop-shadow",
|
|
4321
|
+
match: (className) => /^drop-shadow(\/.+)?$/.test(className),
|
|
4322
|
+
handler: (value, _ctx, token) => {
|
|
4323
|
+
const full = value ? `${token.prefix}-${value}` : token.prefix;
|
|
4324
|
+
const cut = full.indexOf("/");
|
|
4325
|
+
const opacity2 = cut < 0 ? void 0 : full.slice(cut + 1);
|
|
4326
|
+
const literal = "drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow( 0 1px 1px rgb(0 0 0 / 0.06))";
|
|
4327
|
+
return dropShadowValue(DROP_SHADOW_DEFAULT, opacity2, literal, true) ?? [];
|
|
4328
|
+
},
|
|
4329
|
+
category: "effects"
|
|
4157
4330
|
});
|
|
4331
|
+
const dropShadowColor = (color, opacity2, ref) => {
|
|
4332
|
+
const decls = shadowColorDecls("drop-shadow", color, opacity2, ref);
|
|
4333
|
+
return decls && [dropShadowProperties(), ...decls, decl("--baro-drop-shadow", "var(--baro-drop-shadow-size)")];
|
|
4334
|
+
};
|
|
4158
4335
|
functionalUtility({
|
|
4159
4336
|
name: "drop-shadow",
|
|
4160
4337
|
themeKeys: ["colors"],
|
|
4161
4338
|
supportsArbitrary: true,
|
|
4162
4339
|
supportsCustomProperty: true,
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4340
|
+
supportsOpacity: true,
|
|
4341
|
+
handleBareValue: ({ value, ctx }) => namedDropShadow(ctx, value) ? value : null,
|
|
4342
|
+
handle: (value, ctx, token, extra) => {
|
|
4343
|
+
const opacity2 = extra?.opacity;
|
|
4344
|
+
const keyword = token.arbitrary ? void 0 : { inherit: "inherit", current: "currentcolor", transparent: "transparent" }[extra?.realThemeValue ?? value];
|
|
4345
|
+
if (keyword) return dropShadowColor(keyword, opacity2);
|
|
4346
|
+
if (extra?.realThemeValue) return dropShadowColor(value, opacity2, `var(--color-${extra.realThemeValue})`);
|
|
4347
|
+
if (token.arbitrary) {
|
|
4348
|
+
if (parseColor(value)) return dropShadowColor(value, opacity2);
|
|
4349
|
+
return dropShadowValue(value, opacity2);
|
|
4169
4350
|
}
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
];
|
|
4351
|
+
const named = namedDropShadow(ctx, value);
|
|
4352
|
+
if (named) return dropShadowValue(named, opacity2, `drop-shadow(var(--drop-shadow-${value}))`);
|
|
4353
|
+
return null;
|
|
4174
4354
|
},
|
|
4175
4355
|
handleCustomProperty: (value) => {
|
|
4176
|
-
if (value.startsWith("color:")) {
|
|
4177
|
-
return [
|
|
4178
|
-
decl("--baro-drop-shadow-color", `var(${value.replace("color:", "")})`)
|
|
4179
|
-
];
|
|
4180
|
-
}
|
|
4356
|
+
if (value.startsWith("color:")) return dropShadowColor(`var(${value.slice(6)})`, void 0) ?? [];
|
|
4181
4357
|
return [
|
|
4358
|
+
dropShadowProperties(),
|
|
4182
4359
|
decl("--baro-drop-shadow-size", `drop-shadow(var(${value}))`),
|
|
4183
|
-
decl("--baro-drop-shadow", `var(--baro-drop-shadow-size)`)
|
|
4360
|
+
decl("--baro-drop-shadow", `var(--baro-drop-shadow-size)`),
|
|
4361
|
+
filters$1()
|
|
4184
4362
|
];
|
|
4185
4363
|
},
|
|
4186
4364
|
description: "drop-shadow filter utility (static, arbitrary, custom property supported)",
|
|
@@ -4550,166 +4728,119 @@ const ringShadowProperties = () => atRoot([
|
|
|
4550
4728
|
property("--baro-ring-offset-width", "0px", "<length>"),
|
|
4551
4729
|
property("--baro-ring-offset-color", "#fff")
|
|
4552
4730
|
]);
|
|
4553
|
-
const
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
function createShadowThemeColor(key, main, opacity2, realThemeValue) {
|
|
4592
|
-
let fallbackColor = main;
|
|
4593
|
-
const colorVar = `var(--color-${realThemeValue})`;
|
|
4594
|
-
let colorValue = colorVar;
|
|
4595
|
-
if (opacity2) {
|
|
4596
|
-
colorValue = `color-mix(in oklab, color-mix(in oklab, ${colorVar} ${opacity2}%, transparent) var(--baro-shadow-alpha),transparent)`;
|
|
4597
|
-
if (parseColor(main)) {
|
|
4598
|
-
if (main.startsWith("#")) {
|
|
4599
|
-
const opacityValue = Math.round(Number(opacity2) / 100 * 255);
|
|
4600
|
-
fallbackColor = `${main}${opacityValue.toString(16).padStart(2, "0")}`;
|
|
4601
|
-
} else {
|
|
4602
|
-
fallbackColor = `color-mix(in oklab, ${main} ${opacity2}%, transparent)`;
|
|
4603
|
-
}
|
|
4604
|
-
}
|
|
4605
|
-
}
|
|
4606
|
-
return [
|
|
4607
|
-
atRule("supports", "(color:color-mix(in lab, red, red))", [
|
|
4608
|
-
decl(key, colorValue)
|
|
4609
|
-
]),
|
|
4610
|
-
decl(key, fallbackColor)
|
|
4611
|
-
];
|
|
4731
|
+
const shadowColorProperties = (layer) => atRoot([
|
|
4732
|
+
property(`--baro-${layer}-color`),
|
|
4733
|
+
property(`--baro-${layer}-alpha`, "100%", "<percentage>")
|
|
4734
|
+
]);
|
|
4735
|
+
const NAMED_SHADOWS = {
|
|
4736
|
+
"": "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
|
4737
|
+
"2xs": "0 1px rgb(0 0 0 / 0.05)",
|
|
4738
|
+
xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
4739
|
+
sm: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
|
4740
|
+
md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
4741
|
+
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
4742
|
+
xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
|
|
4743
|
+
"2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)",
|
|
4744
|
+
inner: "inset 0 2px 4px 0 rgb(0 0 0 / 0.05)"
|
|
4745
|
+
};
|
|
4746
|
+
const NAMED_INSET_SHADOWS = {
|
|
4747
|
+
"2xs": "inset 0 1px rgb(0 0 0 / 0.05)",
|
|
4748
|
+
xs: "inset 0 1px 1px rgb(0 0 0 / 0.05)",
|
|
4749
|
+
sm: "inset 0 2px 4px rgb(0 0 0 / 0.05)"
|
|
4750
|
+
};
|
|
4751
|
+
const INSET_EXTENSIONS = {
|
|
4752
|
+
md: "inset 0 4px 6px -1px rgb(0 0 0 / 0.05)",
|
|
4753
|
+
lg: "inset 0 10px 15px -3px rgb(0 0 0 / 0.05)",
|
|
4754
|
+
xl: "inset 0 20px 25px -5px rgb(0 0 0 / 0.05)",
|
|
4755
|
+
"2xl": "inset 0 25px 50px -12px rgb(0 0 0 / 0.05)"
|
|
4756
|
+
};
|
|
4757
|
+
const insetEach = (value) => value.split(/,(?![^(]*\))/).map((l) => `inset ${l.trim()}`).join(", ");
|
|
4758
|
+
const own = (table, key) => Object.prototype.hasOwnProperty.call(table, key);
|
|
4759
|
+
function boxShadowLayer(layer, value, opacity2) {
|
|
4760
|
+
const decls = shadowValueDecls(layer, `--baro-${layer}`, value, opacity2);
|
|
4761
|
+
if (!decls) return null;
|
|
4762
|
+
return [ringShadowProperties(), shadowColorProperties(layer), ...decls, decl("box-shadow", SHADOW_COMPOSITE)];
|
|
4763
|
+
}
|
|
4764
|
+
function namedBoxShadow(layer, name, opacity2) {
|
|
4765
|
+
if (layer === "shadow") return own(NAMED_SHADOWS, name) ? boxShadowLayer(layer, NAMED_SHADOWS[name], opacity2) : null;
|
|
4766
|
+
if (own(NAMED_INSET_SHADOWS, name)) return boxShadowLayer(layer, NAMED_INSET_SHADOWS[name], opacity2);
|
|
4767
|
+
if (!opacity2 && own(INSET_EXTENSIONS, name)) return boxShadowLayer(layer, INSET_EXTENSIONS[name], void 0);
|
|
4768
|
+
return null;
|
|
4612
4769
|
}
|
|
4613
|
-
|
|
4770
|
+
staticUtility("shadow-none", [ringShadowProperties, ["--baro-shadow", "0 0 #0000"], ["box-shadow", SHADOW_COMPOSITE]], { category: "effects" });
|
|
4771
|
+
staticUtility("inset-shadow-none", [ringShadowProperties, ["--baro-inset-shadow", "inset 0 0 #0000"], ["box-shadow", SHADOW_COMPOSITE]], { category: "effects" });
|
|
4772
|
+
registerUtility({
|
|
4614
4773
|
name: "shadow",
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
const main = value;
|
|
4621
|
-
const opacity2 = extra?.opacity;
|
|
4622
|
-
const realThemeValue = extra?.realThemeValue;
|
|
4623
|
-
if (realThemeValue) {
|
|
4624
|
-
return createShadowThemeColor(
|
|
4625
|
-
"--baro-shadow-color",
|
|
4626
|
-
main,
|
|
4627
|
-
opacity2,
|
|
4628
|
-
realThemeValue
|
|
4629
|
-
);
|
|
4630
|
-
}
|
|
4631
|
-
if (main.startsWith("color:")) {
|
|
4632
|
-
const cp = main.replace("color:", "");
|
|
4633
|
-
if (opacity2) {
|
|
4634
|
-
return [
|
|
4635
|
-
decl(
|
|
4636
|
-
"--baro-shadow-color",
|
|
4637
|
-
`color-mix(in oklab, var(${cp}) ${opacity2}%, transparent)`
|
|
4638
|
-
)
|
|
4639
|
-
];
|
|
4640
|
-
}
|
|
4641
|
-
return [decl("--baro-shadow-color", `var(${cp})`)];
|
|
4642
|
-
}
|
|
4643
|
-
if (token.arbitrary) {
|
|
4644
|
-
if (parseColor(main)) {
|
|
4645
|
-
if (opacity2) {
|
|
4646
|
-
return [
|
|
4647
|
-
decl(
|
|
4648
|
-
"--baro-shadow-color",
|
|
4649
|
-
`color-mix(in oklab, ${main} ${opacity2}%, transparent)`
|
|
4650
|
-
)
|
|
4651
|
-
];
|
|
4652
|
-
}
|
|
4653
|
-
return [decl("--baro-shadow-color", main)];
|
|
4654
|
-
}
|
|
4655
|
-
return shadowLayer(main);
|
|
4656
|
-
}
|
|
4657
|
-
if (main === "inherit" || main === "current" || main === "transparent") {
|
|
4658
|
-
return [
|
|
4659
|
-
decl("--baro-shadow-color", main === "current" ? "currentColor" : main)
|
|
4660
|
-
];
|
|
4661
|
-
}
|
|
4662
|
-
return null;
|
|
4774
|
+
match: (className) => /^shadow(\/.+)?$/.test(className),
|
|
4775
|
+
handler: (value, _ctx, token) => {
|
|
4776
|
+
const full = value ? `${token.prefix}-${value}` : token.prefix;
|
|
4777
|
+
const cut = full.indexOf("/");
|
|
4778
|
+
return namedBoxShadow("shadow", "", cut < 0 ? void 0 : full.slice(cut + 1)) ?? [];
|
|
4663
4779
|
},
|
|
4664
|
-
|
|
4780
|
+
category: "effects"
|
|
4665
4781
|
});
|
|
4782
|
+
const KEYWORD_COLORS = { inherit: "inherit", current: "currentcolor", transparent: "transparent" };
|
|
4783
|
+
function layerColor(layer, main, opacity2, token, realThemeValue) {
|
|
4784
|
+
const keyword = token.arbitrary ? void 0 : KEYWORD_COLORS[realThemeValue ?? main];
|
|
4785
|
+
if (keyword) return shadowColorDecls(layer, keyword, opacity2);
|
|
4786
|
+
if (realThemeValue) return shadowColorDecls(layer, main, opacity2, `var(--color-${realThemeValue})`);
|
|
4787
|
+
if (main.startsWith("color:")) return shadowColorDecls(layer, `var(${main.slice(6)})`, opacity2);
|
|
4788
|
+
if (token.arbitrary && parseColor(main)) return shadowColorDecls(layer, main, opacity2);
|
|
4789
|
+
return void 0;
|
|
4790
|
+
}
|
|
4791
|
+
for (const layer of ["shadow", "inset-shadow"]) {
|
|
4792
|
+
functionalUtility({
|
|
4793
|
+
name: layer,
|
|
4794
|
+
supportsArbitrary: true,
|
|
4795
|
+
supportsCustomProperty: true,
|
|
4796
|
+
supportsOpacity: true,
|
|
4797
|
+
themeKeys: ["colors"],
|
|
4798
|
+
handleBareValue: ({ value, extra }) => namedBoxShadow(layer, value, extra?.opacity) ? value : null,
|
|
4799
|
+
handle: (value, _ctx, token, extra) => {
|
|
4800
|
+
const opacity2 = extra?.opacity;
|
|
4801
|
+
const named = !extra?.realThemeValue && !token.arbitrary ? namedBoxShadow(layer, value, opacity2) : null;
|
|
4802
|
+
if (named) return named;
|
|
4803
|
+
const color = layerColor(layer, value, opacity2, token, extra?.realThemeValue);
|
|
4804
|
+
if (color !== void 0) return color;
|
|
4805
|
+
if (token.arbitrary) return boxShadowLayer(layer, layer === "inset-shadow" ? insetEach(value) : value, opacity2);
|
|
4806
|
+
return null;
|
|
4807
|
+
},
|
|
4808
|
+
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)]
|
|
4809
|
+
});
|
|
4810
|
+
}
|
|
4811
|
+
const textShadowProperties = () => atRoot([
|
|
4812
|
+
property("--baro-text-shadow-color"),
|
|
4813
|
+
property("--baro-text-shadow-alpha", "100%", "<percentage>")
|
|
4814
|
+
]);
|
|
4815
|
+
const namedTextShadow = (ctx, name) => {
|
|
4816
|
+
const v = ctx.theme("textShadow", name);
|
|
4817
|
+
return typeof v === "string" && /^[\w.-]+$/.test(name) ? v : null;
|
|
4818
|
+
};
|
|
4819
|
+
const textShadowValue = (value, opacity2) => {
|
|
4820
|
+
const decls = shadowValueDecls("text-shadow", "text-shadow", value, opacity2);
|
|
4821
|
+
return decls ? [textShadowProperties(), ...decls] : null;
|
|
4822
|
+
};
|
|
4823
|
+
staticUtility("text-shadow-none", [textShadowProperties, ["text-shadow", "none"]], { category: "effects" });
|
|
4666
4824
|
functionalUtility({
|
|
4667
|
-
name: "
|
|
4825
|
+
name: "text-shadow",
|
|
4668
4826
|
supportsArbitrary: true,
|
|
4669
4827
|
supportsCustomProperty: true,
|
|
4670
4828
|
supportsOpacity: true,
|
|
4671
|
-
themeKeys: ["colors"
|
|
4829
|
+
themeKeys: ["colors"],
|
|
4830
|
+
handleBareValue: ({ value, ctx }) => namedTextShadow(ctx, value) ? value : null,
|
|
4672
4831
|
handle: (value, ctx, token, extra) => {
|
|
4673
|
-
const main = value;
|
|
4674
4832
|
const opacity2 = extra?.opacity;
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
return
|
|
4678
|
-
"--baro-inset-shadow-color",
|
|
4679
|
-
main,
|
|
4680
|
-
opacity2,
|
|
4681
|
-
realThemeValue
|
|
4682
|
-
);
|
|
4683
|
-
}
|
|
4684
|
-
if (main.startsWith("color:")) {
|
|
4685
|
-
const cp = main.replace("color:", "");
|
|
4686
|
-
let colorValue = `var(${cp})`;
|
|
4687
|
-
if (opacity2) {
|
|
4688
|
-
colorValue = `color-mix(in oklab, var(${cp}) ${opacity2}%, transparent)`;
|
|
4689
|
-
}
|
|
4690
|
-
return [decl("--baro-inset-shadow-color", colorValue)];
|
|
4691
|
-
}
|
|
4692
|
-
if (token.arbitrary) {
|
|
4693
|
-
if (parseColor(main)) {
|
|
4694
|
-
let colorValue = main;
|
|
4695
|
-
if (opacity2) {
|
|
4696
|
-
colorValue = `color-mix(in oklab, ${main} ${opacity2}%, transparent)`;
|
|
4697
|
-
}
|
|
4698
|
-
return [decl("--baro-inset-shadow-color", colorValue)];
|
|
4699
|
-
}
|
|
4700
|
-
return [decl("box-shadow", `inset ${main}`)];
|
|
4701
|
-
}
|
|
4702
|
-
if (main === "inherit" || main === "current" || main === "transparent") {
|
|
4703
|
-
return [
|
|
4704
|
-
decl(
|
|
4705
|
-
"--baro-inset-shadow-color",
|
|
4706
|
-
main === "current" ? "currentColor" : main
|
|
4707
|
-
)
|
|
4708
|
-
];
|
|
4833
|
+
if (!extra?.realThemeValue && !token.arbitrary) {
|
|
4834
|
+
const named = namedTextShadow(ctx, value);
|
|
4835
|
+
if (named) return textShadowValue(named, opacity2);
|
|
4709
4836
|
}
|
|
4837
|
+
const color = layerColor("text-shadow", value, opacity2, token, extra?.realThemeValue);
|
|
4838
|
+
if (color !== void 0) return color && [textShadowProperties(), ...color];
|
|
4839
|
+
if (token.arbitrary) return textShadowValue(value, opacity2);
|
|
4710
4840
|
return null;
|
|
4711
4841
|
},
|
|
4712
|
-
handleCustomProperty: (value) => [decl("
|
|
4842
|
+
handleCustomProperty: (value) => value.startsWith("color:") ? [textShadowProperties(), ...shadowColorDecls("text-shadow", `var(${value.slice(6)})`, void 0) ?? []] : [textShadowProperties(), decl("text-shadow", `var(${value})`)],
|
|
4843
|
+
category: "effects"
|
|
4713
4844
|
});
|
|
4714
4845
|
[
|
|
4715
4846
|
["ring", "1px"],
|
|
@@ -5252,12 +5383,15 @@ staticUtility("not-sr-only", [
|
|
|
5252
5383
|
], { category: "layout" });
|
|
5253
5384
|
staticUtility("@container", [["container-type", "inline-size"]], { category: "layout" });
|
|
5254
5385
|
staticUtility("@container-normal", [["container-type", "normal"]], { category: "layout" });
|
|
5386
|
+
staticUtility("@container-size", [["container-type", "size"]], { category: "layout" });
|
|
5387
|
+
const NAMED_CONTAINER = /^@container(-normal|-size)?\/([a-zA-Z0-9_-]+)$/;
|
|
5388
|
+
const CONTAINER_TYPE = { "": "inline-size", "-normal": "normal", "-size": "size" };
|
|
5255
5389
|
registerUtility({
|
|
5256
5390
|
name: "@container",
|
|
5257
|
-
match: (className) =>
|
|
5391
|
+
match: (className) => NAMED_CONTAINER.test(className),
|
|
5258
5392
|
handler: (_value, _ctx, token) => {
|
|
5259
|
-
const
|
|
5260
|
-
return
|
|
5393
|
+
const m = NAMED_CONTAINER.exec(`${token.prefix}${token.value ? `-${token.value}` : ""}`);
|
|
5394
|
+
return m ? [decl("container-type", CONTAINER_TYPE[m[1] ?? ""]), decl("container-name", m[2])] : null;
|
|
5261
5395
|
},
|
|
5262
5396
|
category: "layout"
|
|
5263
5397
|
});
|
|
@@ -5342,6 +5476,11 @@ staticUtility("sticky", [["position", "sticky"]], { category: "layout" });
|
|
|
5342
5476
|
[
|
|
5343
5477
|
["inset-x", "inset-inline"],
|
|
5344
5478
|
["inset-y", "inset-block"],
|
|
5479
|
+
// Tailwind 4.3 logical sides; registered before `inset` so their handler runs first for `inset-s-*` etc.
|
|
5480
|
+
["inset-s", "inset-inline-start"],
|
|
5481
|
+
["inset-e", "inset-inline-end"],
|
|
5482
|
+
["inset-bs", "inset-block-start"],
|
|
5483
|
+
["inset-be", "inset-block-end"],
|
|
5345
5484
|
["inset", "inset"],
|
|
5346
5485
|
["start", "inset-inline-start"],
|
|
5347
5486
|
["end", "inset-inline-end"],
|
|
@@ -5437,6 +5576,15 @@ functionalUtility({
|
|
|
5437
5576
|
description: "gap utility (number, arbitrary, custom property supported)",
|
|
5438
5577
|
category: "layout"
|
|
5439
5578
|
});
|
|
5579
|
+
functionalUtility({
|
|
5580
|
+
name: "zoom",
|
|
5581
|
+
prop: "zoom",
|
|
5582
|
+
supportsArbitrary: true,
|
|
5583
|
+
supportsCustomProperty: true,
|
|
5584
|
+
handleBareValue: ({ value }) => /^\d+$/.test(value) ? `${value}%` : null,
|
|
5585
|
+
description: "zoom utility (integer percent, arbitrary, custom property)",
|
|
5586
|
+
category: "layout"
|
|
5587
|
+
});
|
|
5440
5588
|
staticUtility("basis-full", [["flex-basis", "100%"]], { category: "flex-grid" });
|
|
5441
5589
|
staticUtility("basis-auto", [["flex-basis", "auto"]], { category: "flex-grid" });
|
|
5442
5590
|
staticUtility("basis-3xs", [["flex-basis", "var(--container-3xs)"]], { category: "flex-grid" });
|
|
@@ -5711,6 +5859,8 @@ functionalUtility({
|
|
|
5711
5859
|
// auto-cols-[minmax(0,2fr)]
|
|
5712
5860
|
supportsCustomProperty: true,
|
|
5713
5861
|
// auto-cols-(--my-auto-cols)
|
|
5862
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5863
|
+
// #310: auto-cols-4
|
|
5714
5864
|
handle: (value) => {
|
|
5715
5865
|
if (typeof value === "string") return [decl("grid-auto-columns", value)];
|
|
5716
5866
|
return null;
|
|
@@ -5730,6 +5880,8 @@ functionalUtility({
|
|
|
5730
5880
|
// auto-rows-[minmax(0,2fr)]
|
|
5731
5881
|
supportsCustomProperty: true,
|
|
5732
5882
|
// auto-rows-(--my-auto-rows)
|
|
5883
|
+
handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
|
|
5884
|
+
// #310: auto-rows-12
|
|
5733
5885
|
handle: (value) => {
|
|
5734
5886
|
if (typeof value === "string") return [decl("grid-auto-rows", value)];
|
|
5735
5887
|
return null;
|
|
@@ -5932,6 +6084,8 @@ functionalUtility({
|
|
|
5932
6084
|
["py", "padding-block"],
|
|
5933
6085
|
["ps", "padding-inline-start"],
|
|
5934
6086
|
["pe", "padding-inline-end"],
|
|
6087
|
+
["pbs", "padding-block-start"],
|
|
6088
|
+
["pbe", "padding-block-end"],
|
|
5935
6089
|
["pt", "padding-top"],
|
|
5936
6090
|
["pr", "padding-right"],
|
|
5937
6091
|
["pb", "padding-bottom"],
|
|
@@ -5955,6 +6109,8 @@ functionalUtility({
|
|
|
5955
6109
|
["my", "margin-block"],
|
|
5956
6110
|
["ms", "margin-inline-start"],
|
|
5957
6111
|
["me", "margin-inline-end"],
|
|
6112
|
+
["mbs", "margin-block-start"],
|
|
6113
|
+
["mbe", "margin-block-end"],
|
|
5958
6114
|
["mt", "margin-top"],
|
|
5959
6115
|
["mr", "margin-right"],
|
|
5960
6116
|
["mb", "margin-bottom"],
|
|
@@ -6280,6 +6436,41 @@ functionalUtility({
|
|
|
6280
6436
|
description: "max-width utility (spacing, fraction, arbitrary, custom property, static supported)",
|
|
6281
6437
|
category: "sizing"
|
|
6282
6438
|
});
|
|
6439
|
+
{
|
|
6440
|
+
const containers = ["3xs", "2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "5xl", "6xl", "7xl"].map(
|
|
6441
|
+
(k) => [k, `var(--container-${k})`]
|
|
6442
|
+
);
|
|
6443
|
+
const common = [["0", "0px"], ["px", "1px"], ["full", "100%"], ["min", "min-content"], ["max", "max-content"], ["fit", "fit-content"]];
|
|
6444
|
+
const inlineVp = [["screen", "100vw"], ["dvw", "100dvw"], ["lvw", "100lvw"], ["svw", "100svw"]];
|
|
6445
|
+
const blockVp = [["screen", "100vh"], ["dvh", "100dvh"], ["lvh", "100lvh"], ["svh", "100svh"], ["lh", "1lh"]];
|
|
6446
|
+
const families = [
|
|
6447
|
+
["inline", "inline-size", [...common, ["auto", "auto"], ...inlineVp, ...containers]],
|
|
6448
|
+
["min-inline", "min-inline-size", [...common, ["auto", "auto"], ...inlineVp, ...containers]],
|
|
6449
|
+
["max-inline", "max-inline-size", [...common, ["none", "none"], ...inlineVp, ...containers]],
|
|
6450
|
+
["block", "block-size", [...common, ["auto", "auto"], ...blockVp]],
|
|
6451
|
+
["min-block", "min-block-size", [...common, ["auto", "auto"], ...blockVp]],
|
|
6452
|
+
["max-block", "max-block-size", [...common, ["none", "none"], ...blockVp]]
|
|
6453
|
+
];
|
|
6454
|
+
for (const [name, prop, statics] of families) {
|
|
6455
|
+
for (const [key, value] of statics) staticUtility(`${name}-${key}`, [[prop, value]], { category: "sizing" });
|
|
6456
|
+
functionalUtility({
|
|
6457
|
+
spacingKeys: true,
|
|
6458
|
+
name,
|
|
6459
|
+
prop,
|
|
6460
|
+
supportsArbitrary: true,
|
|
6461
|
+
supportsCustomProperty: true,
|
|
6462
|
+
supportsFraction: true,
|
|
6463
|
+
handleBareValue: ({ value, token }) => {
|
|
6464
|
+
if (token.negative) return null;
|
|
6465
|
+
if (parseNumber(value)) return `calc(var(--spacing) * ${value})`;
|
|
6466
|
+
if (parseFractionOrNumber(value)) return `calc(${value} * 100%)`;
|
|
6467
|
+
return null;
|
|
6468
|
+
},
|
|
6469
|
+
description: `${prop} utility (spacing, fraction, arbitrary, custom property, keywords)`,
|
|
6470
|
+
category: "sizing"
|
|
6471
|
+
});
|
|
6472
|
+
}
|
|
6473
|
+
}
|
|
6283
6474
|
const leadingProperty = () => atRoot([property("--baro-leading")]);
|
|
6284
6475
|
staticUtility("font-sans", [["font-family", "var(--font-sans)"]], { category: "typography" });
|
|
6285
6476
|
staticUtility("font-serif", [["font-family", "var(--font-serif)"]], { category: "typography" });
|
|
@@ -6310,13 +6501,15 @@ functionalUtility({
|
|
|
6310
6501
|
name: "font",
|
|
6311
6502
|
supportsArbitrary: true,
|
|
6312
6503
|
supportsCustomProperty: true,
|
|
6313
|
-
handle: (value) => {
|
|
6504
|
+
handle: (value, _ctx, token) => {
|
|
6505
|
+
if (token.prefix !== "font") return null;
|
|
6314
6506
|
if (parseNumber(value)) {
|
|
6315
6507
|
return [decl("font-weight", value)];
|
|
6316
6508
|
}
|
|
6317
6509
|
return [decl("font-family", value)];
|
|
6318
6510
|
},
|
|
6319
|
-
handleCustomProperty: (value) => {
|
|
6511
|
+
handleCustomProperty: (value, _ctx, token) => {
|
|
6512
|
+
if (token.prefix !== "font") return null;
|
|
6320
6513
|
if (value.startsWith("font-name:")) {
|
|
6321
6514
|
return [decl("font-family", `var(${value.replace("font-name:", "")})`)];
|
|
6322
6515
|
}
|
|
@@ -6615,6 +6808,42 @@ functionalUtility({
|
|
|
6615
6808
|
description: "content utility (arbitrary, custom property supported)",
|
|
6616
6809
|
category: "typography"
|
|
6617
6810
|
});
|
|
6811
|
+
const placeholderColor = (value) => [rule("&::placeholder", [decl("color", value)])];
|
|
6812
|
+
staticUtility("placeholder-inherit", placeholderColor("inherit"), { category: "typography" });
|
|
6813
|
+
staticUtility("placeholder-current", placeholderColor("currentcolor"), { category: "typography" });
|
|
6814
|
+
staticUtility("placeholder-transparent", placeholderColor("transparent"), { category: "typography" });
|
|
6815
|
+
functionalUtility({
|
|
6816
|
+
name: "placeholder",
|
|
6817
|
+
themeKeys: ["colors"],
|
|
6818
|
+
supportsArbitrary: true,
|
|
6819
|
+
supportsCustomProperty: true,
|
|
6820
|
+
supportsOpacity: true,
|
|
6821
|
+
handle: (value, _ctx, _token, extra) => {
|
|
6822
|
+
if (extra?.realThemeValue) return [rule("&::placeholder", themeColorDecls("color", value, extra))];
|
|
6823
|
+
if (parseColor(value)) return placeholderColor(value);
|
|
6824
|
+
return null;
|
|
6825
|
+
},
|
|
6826
|
+
handleCustomProperty: (value) => placeholderColor(`var(${value})`),
|
|
6827
|
+
description: "placeholder color utility (theme, alpha, arbitrary, custom property)"
|
|
6828
|
+
});
|
|
6829
|
+
functionalUtility({
|
|
6830
|
+
name: "font-features",
|
|
6831
|
+
supportsArbitrary: true,
|
|
6832
|
+
supportsCustomProperty: true,
|
|
6833
|
+
handle: (value, _ctx, token) => token.arbitrary ? [decl("font-feature-settings", value)] : null,
|
|
6834
|
+
handleCustomProperty: (value) => [decl("font-feature-settings", `var(${value.replace(/^[a-z-]+:(?=--)/, "")})`)],
|
|
6835
|
+
description: "font-feature-settings utility (arbitrary, custom property)",
|
|
6836
|
+
category: "typography"
|
|
6837
|
+
});
|
|
6838
|
+
functionalUtility({
|
|
6839
|
+
name: "tab",
|
|
6840
|
+
prop: "tab-size",
|
|
6841
|
+
supportsArbitrary: true,
|
|
6842
|
+
supportsCustomProperty: true,
|
|
6843
|
+
handleBareValue: ({ value }) => /^\d+$/.test(value) ? value : null,
|
|
6844
|
+
description: "tab-size utility (integer, arbitrary, custom property)",
|
|
6845
|
+
category: "typography"
|
|
6846
|
+
});
|
|
6618
6847
|
const gradientStopProperties = () => {
|
|
6619
6848
|
return atRoot([
|
|
6620
6849
|
property("--baro-gradient-position"),
|
|
@@ -6946,6 +7175,11 @@ const withBorderStyle = (props, width) => [
|
|
|
6946
7175
|
[
|
|
6947
7176
|
["border-x", ["border-left-width", "border-right-width"]],
|
|
6948
7177
|
["border-y", ["border-top-width", "border-bottom-width"]],
|
|
7178
|
+
["border-bs", ["border-block-start-width"]],
|
|
7179
|
+
["border-be", ["border-block-end-width"]],
|
|
7180
|
+
["border-s", ["border-inline-start-width"]],
|
|
7181
|
+
// #311 (Tailwind 4.3)
|
|
7182
|
+
["border-e", ["border-inline-end-width"]],
|
|
6949
7183
|
["border-t", ["border-top-width"]],
|
|
6950
7184
|
["border-r", ["border-right-width"]],
|
|
6951
7185
|
["border-b", ["border-bottom-width"]],
|
|
@@ -6965,6 +7199,7 @@ const withBorderStyle = (props, width) => [
|
|
|
6965
7199
|
functionalUtility({
|
|
6966
7200
|
name,
|
|
6967
7201
|
themeKeys: ["borderWidth", "colors"],
|
|
7202
|
+
supportsOpacity: true,
|
|
6968
7203
|
supportsArbitrary: true,
|
|
6969
7204
|
supportsCustomProperty: true,
|
|
6970
7205
|
handleBareValue: ({ value }) => {
|
|
@@ -7945,9 +8180,10 @@ staticModifier("starting", ["&"], {
|
|
|
7945
8180
|
wrap: () => [atRule("starting-style", "", [], "starting")],
|
|
7946
8181
|
source: "starting"
|
|
7947
8182
|
});
|
|
7948
|
-
function createContainerParams(type, value, name) {
|
|
8183
|
+
function createContainerParams(type, value, name, negate = false) {
|
|
7949
8184
|
const condition = type === "min" ? "width >=" : "width <";
|
|
7950
|
-
|
|
8185
|
+
const query = `${negate ? "not " : ""}(${condition} ${value})`;
|
|
8186
|
+
return name ? `${name} ${query}` : query;
|
|
7951
8187
|
}
|
|
7952
8188
|
function createContainerRule(params, ast) {
|
|
7953
8189
|
return {
|
|
@@ -8116,17 +8352,17 @@ functionalModifier(
|
|
|
8116
8352
|
return result;
|
|
8117
8353
|
}
|
|
8118
8354
|
);
|
|
8119
|
-
const SIZE_VARIANT =
|
|
8355
|
+
const SIZE_VARIANT = /^(not-)?@(?:(min|max)-)?(\[[^\]]+\]|[a-zA-Z0-9.]+)(?:\/([a-zA-Z0-9_-]+))?$/;
|
|
8120
8356
|
functionalModifier(
|
|
8121
|
-
(mod) => SIZE_VARIANT.test(mod) &&
|
|
8357
|
+
(mod) => SIZE_VARIANT.test(mod) && !/^(?:not-)?@container(?:\/|$)/.test(mod),
|
|
8122
8358
|
void 0,
|
|
8123
8359
|
(mod, context) => {
|
|
8124
8360
|
const m = SIZE_VARIANT.exec(mod.type);
|
|
8125
8361
|
if (!m) return [];
|
|
8126
|
-
const [, type, size, name] = m;
|
|
8362
|
+
const [, not, type, size, name] = m;
|
|
8127
8363
|
const value = size.startsWith("[") ? size.slice(1, -1).replace(/_/g, " ") : context.theme("container." + size);
|
|
8128
8364
|
if (!value) return [];
|
|
8129
|
-
return [createContainerRule(createContainerParams(type === "max" ? "max" : "min", value, name), [])];
|
|
8365
|
+
return [createContainerRule(createContainerParams(type === "max" ? "max" : "min", value, name, !!not), [])];
|
|
8130
8366
|
}
|
|
8131
8367
|
);
|
|
8132
8368
|
const startsAtRule = (bracket) => /^[\s_]*@/.test(bracket);
|
|
@@ -8266,7 +8502,7 @@ functionalModifier(
|
|
|
8266
8502
|
}
|
|
8267
8503
|
);
|
|
8268
8504
|
functionalModifier(
|
|
8269
|
-
(mod) => /^not-/.test(mod),
|
|
8505
|
+
(mod) => /^not-/.test(mod) && !mod.startsWith("not-@"),
|
|
8270
8506
|
({ selector, mod }) => {
|
|
8271
8507
|
const m = /^not-(.+)$/.exec(mod.type);
|
|
8272
8508
|
return {
|
|
@@ -8333,7 +8569,8 @@ functionalModifier(
|
|
|
8333
8569
|
void 0
|
|
8334
8570
|
);
|
|
8335
8571
|
functionalModifier(
|
|
8336
|
-
(mod) => mod.startsWith("not-"),
|
|
8572
|
+
(mod) => mod.startsWith("not-") && !mod.startsWith("not-@"),
|
|
8573
|
+
// not-@… is container negation (#311)
|
|
8337
8574
|
({ selector, mod }) => {
|
|
8338
8575
|
const pseudo = mod.type.replace("not-", "");
|
|
8339
8576
|
if (pseudo.startsWith("[")) {
|
|
@@ -9568,9 +9805,9 @@ ${preflightCSS}
|
|
|
9568
9805
|
}
|
|
9569
9806
|
/** Class names defined by the page's own stylesheets (BaroCSS's sheets and cross-origin sheets excluded). */
|
|
9570
9807
|
getExistingClasses() {
|
|
9571
|
-
const
|
|
9808
|
+
const own2 = new Set(Array.from(document.querySelectorAll("style[data-barocss]"), (s) => s.sheet));
|
|
9572
9809
|
const sheets = Array.from(document.styleSheets).filter((sheet) => {
|
|
9573
|
-
if (
|
|
9810
|
+
if (own2.has(sheet)) return false;
|
|
9574
9811
|
const owner = sheet.ownerNode;
|
|
9575
9812
|
return !(owner && typeof owner.hasAttribute === "function" && (owner.hasAttribute("data-barocss") || (owner.id || "").startsWith(this.options.styleId)));
|
|
9576
9813
|
});
|