@barocss/browser 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.
@@ -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) => ({
@@ -598,6 +599,9 @@ function hasCommentDelimiter(text) {
598
599
  }
599
600
  return false;
600
601
  }
602
+ function hasHtmlEndTagOpener(text) {
603
+ return text.includes("</");
604
+ }
601
605
  function isStructureSafeValue(value) {
602
606
  if (hasCommentToken(value)) return false;
603
607
  return isSafeVariantValue(value, true);
@@ -745,8 +749,11 @@ function parseUtility(value, ctx) {
745
749
  priority
746
750
  };
747
751
  }
748
- const isSafePrelude = (text) => !hasCommentDelimiter(String(text ?? ""));
749
- const isSafeDecl = (prop, value) => isStructureSafeValue(String(prop)) && isStructureSafeValue(String(value ?? ""));
752
+ const isSafePrelude = (text) => {
753
+ const t = String(text ?? "");
754
+ return !hasCommentDelimiter(t) && !hasHtmlEndTagOpener(t);
755
+ };
756
+ const isSafeDecl = (prop, value) => isStructureSafeValue(String(prop)) && isStructureSafeValue(String(value ?? "")) && !hasHtmlEndTagOpener(String(prop)) && !hasHtmlEndTagOpener(String(value ?? ""));
750
757
  const importantPrefix = "!important";
751
758
  function astToCss(ast, baseSelector, opts, _indent = "") {
752
759
  const minify = opts?.minify;
@@ -1046,7 +1053,7 @@ function animationToCssVars(animations2) {
1046
1053
  }
1047
1054
  return result;
1048
1055
  }
1049
- const COMMENT_OR_BLOCK = /\/\*|\*\/|[{};]/;
1056
+ const COMMENT_OR_BLOCK = /\/\*|\*\/|[{};]|<\//;
1050
1057
  function keyframesBlock(name, frames) {
1051
1058
  if (!name || COMMENT_OR_BLOCK.test(name) || /\s/.test(name) || !frames || typeof frames !== "object") return "";
1052
1059
  let body = "";
@@ -1153,6 +1160,8 @@ function themeToCssVarsAll(theme) {
1153
1160
  ...transitionDurationToCssVars(theme.transitionDuration),
1154
1161
  ...transitionDelayToCssVars(theme.transitionDelay),
1155
1162
  ...blurToCssVars(theme.blur),
1163
+ ...Object.fromEntries(Object.entries(theme.textShadow ?? {}).map(([k, v2]) => [`--text-shadow-${escapeKey(k)}`, v2])),
1164
+ ...Object.fromEntries(Object.entries(theme.dropShadow ?? {}).map(([k, v2]) => [`--drop-shadow-${escapeKey(k)}`, v2])),
1156
1165
  ...Object.fromEntries(Object.entries(theme.aspect ?? {}).map(([k, v2]) => [`--aspect-${escapeKey(k)}`, v2]))
1157
1166
  // keyframes handled separately
1158
1167
  };
@@ -1162,8 +1171,15 @@ function isSelfReferencingVar(name, value) {
1162
1171
  const m = /^var\(\s*(--[\w-]+)\s*(?:,[\s\S]*)?\)$/.exec(value.trim());
1163
1172
  return !!m && m[1] === name.trim();
1164
1173
  }
1174
+ const SAFE_VAR_NAME = /^--(?:[\w-]|\\\.)+$/;
1175
+ function isSafeThemeVar(name, value) {
1176
+ if (typeof name !== "string" || !SAFE_VAR_NAME.test(name) || hasHtmlEndTagOpener(name)) return false;
1177
+ if (typeof value !== "string" && typeof value !== "number") return false;
1178
+ const v2 = String(value);
1179
+ return v2.trim() !== "" && isStructureSafeValue(v2) && !hasCommentDelimiter(v2) && !hasHtmlEndTagOpener(v2);
1180
+ }
1165
1181
  function toCssVarsBlock(vars, extra = "") {
1166
- return ":root,:host {\n" + Object.entries(vars).filter(([k, v2]) => !isSelfReferencingVar(k, v2)).map(([k, v2]) => ` ${k}: ${v2};`).join("\n") + "\n}\n" + extra + "\n";
1182
+ 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";
1167
1183
  }
1168
1184
  const BARO_VAR = /--baro-/g;
1169
1185
  const PREFIXED_KEYS = /* @__PURE__ */ new Set(["prop", "value", "params", "selector", "nodes", "items"]);
@@ -1838,7 +1854,7 @@ const colors = {
1838
1854
  "950": "oklch(13% 0.028 261.692)"
1839
1855
  },
1840
1856
  zinc: {
1841
- "50": "oklch(98.5% 0 0)",
1857
+ "50": "oklch(98.5% 0 none)",
1842
1858
  "100": "oklch(96.7% 0.001 286.375)",
1843
1859
  "200": "oklch(92% 0.004 286.32)",
1844
1860
  "300": "oklch(87.1% 0.006 286.286)",
@@ -1851,17 +1867,17 @@ const colors = {
1851
1867
  "950": "oklch(14.1% 0.005 285.823)"
1852
1868
  },
1853
1869
  neutral: {
1854
- "50": "oklch(98.5% 0 0)",
1855
- "100": "oklch(97% 0 0)",
1856
- "200": "oklch(92.2% 0 0)",
1857
- "300": "oklch(87% 0 0)",
1858
- "400": "oklch(70.8% 0 0)",
1859
- "500": "oklch(55.6% 0 0)",
1860
- "600": "oklch(43.9% 0 0)",
1861
- "700": "oklch(37.1% 0 0)",
1862
- "800": "oklch(26.9% 0 0)",
1863
- "900": "oklch(20.5% 0 0)",
1864
- "950": "oklch(14.5% 0 0)"
1870
+ "50": "oklch(98.5% 0 none)",
1871
+ "100": "oklch(97% 0 none)",
1872
+ "200": "oklch(92.2% 0 none)",
1873
+ "300": "oklch(87% 0 none)",
1874
+ "400": "oklch(70.8% 0 none)",
1875
+ "500": "oklch(55.6% 0 none)",
1876
+ "600": "oklch(43.9% 0 none)",
1877
+ "700": "oklch(37.1% 0 none)",
1878
+ "800": "oklch(26.9% 0 none)",
1879
+ "900": "oklch(20.5% 0 none)",
1880
+ "950": "oklch(14.5% 0 none)"
1865
1881
  },
1866
1882
  stone: {
1867
1883
  "50": "oklch(98.5% 0.001 106.423)",
@@ -2096,6 +2112,58 @@ const colors = {
2096
2112
  "800": "oklch(45.5% 0.188 13.697)",
2097
2113
  "900": "oklch(41% 0.159 10.272)",
2098
2114
  "950": "oklch(27.1% 0.105 12.094)"
2115
+ },
2116
+ mauve: {
2117
+ "50": "oklch(98.5% 0 none)",
2118
+ "100": "oklch(96% 0.003 325.6)",
2119
+ "200": "oklch(92.2% 0.005 325.62)",
2120
+ "300": "oklch(86.5% 0.012 325.68)",
2121
+ "400": "oklch(71.1% 0.019 323.02)",
2122
+ "500": "oklch(54.2% 0.034 322.5)",
2123
+ "600": "oklch(43.5% 0.029 321.78)",
2124
+ "700": "oklch(36.4% 0.029 323.89)",
2125
+ "800": "oklch(26.3% 0.024 320.12)",
2126
+ "900": "oklch(21.2% 0.019 322.12)",
2127
+ "950": "oklch(14.5% 0.008 326)"
2128
+ },
2129
+ olive: {
2130
+ "50": "oklch(98.8% 0.003 106.5)",
2131
+ "100": "oklch(96.6% 0.005 106.5)",
2132
+ "200": "oklch(93% 0.007 106.5)",
2133
+ "300": "oklch(88% 0.011 106.6)",
2134
+ "400": "oklch(73.7% 0.021 106.9)",
2135
+ "500": "oklch(58% 0.031 107.3)",
2136
+ "600": "oklch(46.6% 0.025 107.3)",
2137
+ "700": "oklch(39.4% 0.023 107.4)",
2138
+ "800": "oklch(28.6% 0.016 107.4)",
2139
+ "900": "oklch(22.8% 0.013 107.4)",
2140
+ "950": "oklch(15.3% 0.006 107.1)"
2141
+ },
2142
+ mist: {
2143
+ "50": "oklch(98.7% 0.002 197.1)",
2144
+ "100": "oklch(96.3% 0.002 197.1)",
2145
+ "200": "oklch(92.5% 0.005 214.3)",
2146
+ "300": "oklch(87.2% 0.007 219.6)",
2147
+ "400": "oklch(72.3% 0.014 214.4)",
2148
+ "500": "oklch(56% 0.021 213.5)",
2149
+ "600": "oklch(45% 0.017 213.2)",
2150
+ "700": "oklch(37.8% 0.015 216)",
2151
+ "800": "oklch(27.5% 0.011 216.9)",
2152
+ "900": "oklch(21.8% 0.008 223.9)",
2153
+ "950": "oklch(14.8% 0.004 228.8)"
2154
+ },
2155
+ taupe: {
2156
+ "50": "oklch(98.6% 0.002 67.8)",
2157
+ "100": "oklch(96% 0.002 17.2)",
2158
+ "200": "oklch(92.2% 0.005 34.3)",
2159
+ "300": "oklch(86.8% 0.007 39.5)",
2160
+ "400": "oklch(71.4% 0.014 41.2)",
2161
+ "500": "oklch(54.7% 0.021 43.1)",
2162
+ "600": "oklch(43.8% 0.017 39.3)",
2163
+ "700": "oklch(36.7% 0.016 35.7)",
2164
+ "800": "oklch(26.8% 0.011 36.5)",
2165
+ "900": "oklch(21.4% 0.009 43.1)",
2166
+ "950": "oklch(14.7% 0.004 49.3)"
2099
2167
  }
2100
2168
  };
2101
2169
  const spacing = {
@@ -2167,8 +2235,13 @@ const fontSize = {
2167
2235
  };
2168
2236
  const fontFamily = {
2169
2237
  sans: [
2170
- "ui-sans-serif",
2171
- "system-ui",
2238
+ "-apple-system",
2239
+ "BlinkMacSystemFont",
2240
+ "Segoe UI",
2241
+ "Roboto",
2242
+ "Helvetica Neue",
2243
+ "Noto Sans",
2244
+ "Arial",
2172
2245
  "sans-serif",
2173
2246
  "Apple Color Emoji",
2174
2247
  "Segoe UI Emoji",
@@ -2379,6 +2452,21 @@ const blur = {
2379
2452
  "2xl": "40px",
2380
2453
  "3xl": "64px"
2381
2454
  };
2455
+ const textShadow = {
2456
+ "2xs": "0px 1px 0px rgb(0 0 0 / 0.15)",
2457
+ xs: "0px 1px 1px rgb(0 0 0 / 0.2)",
2458
+ 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)",
2459
+ 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)",
2460
+ 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)"
2461
+ };
2462
+ const dropShadow = {
2463
+ xs: "0 1px 1px rgb(0 0 0 / 0.05)",
2464
+ sm: "0 1px 2px rgb(0 0 0 / 0.15)",
2465
+ md: "0 3px 3px rgb(0 0 0 / 0.12)",
2466
+ lg: "0 4px 4px rgb(0 0 0 / 0.15)",
2467
+ xl: "0 9px 7px rgb(0 0 0 / 0.1)",
2468
+ "2xl": "0 25px 25px rgb(0 0 0 / 0.15)"
2469
+ };
2382
2470
  const defaultTheme = {
2383
2471
  colors,
2384
2472
  spacing,
@@ -2401,6 +2489,8 @@ const defaultTheme = {
2401
2489
  keyframes,
2402
2490
  animationVars,
2403
2491
  blur,
2492
+ textShadow,
2493
+ dropShadow,
2404
2494
  // Tailwind 4.1.13 --aspect-* (aspect-video → var(--aspect-video))
2405
2495
  aspect: { video: "16 / 9" }
2406
2496
  };
@@ -2577,7 +2667,7 @@ html {
2577
2667
  line-height: 1.15;
2578
2668
  -webkit-text-size-adjust: 100%;
2579
2669
  /* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
2580
- font-family: var(--default-font-family, var(--font-sans, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'));
2670
+ 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
2671
  font-feature-settings: var(--default-font-feature-settings, normal);
2582
2672
  font-variation-settings: var(--default-font-variation-settings, normal);
2583
2673
  }
@@ -2880,7 +2970,7 @@ html {
2880
2970
  -webkit-text-size-adjust: 100%;
2881
2971
  -ms-text-size-adjust: 100%;
2882
2972
  /* Tailwind 4.1.13 root font (app --default-font-family / --font-sans win) */
2883
- font-family: var(--default-font-family, var(--font-sans, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'));
2973
+ 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
2974
  font-feature-settings: var(--default-font-feature-settings, normal);
2885
2975
  font-variation-settings: var(--default-font-variation-settings, normal);
2886
2976
  }
@@ -3781,6 +3871,9 @@ staticUtility("snap-both", [["scroll-snap-type", "both var(--baro-scroll-snap-st
3781
3871
  staticUtility("snap-mandatory", [["--baro-scroll-snap-strictness", "mandatory"]], { category: "interactivity" });
3782
3872
  staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]], { category: "interactivity" });
3783
3873
  [
3874
+ ["mbs", "scroll-margin-block-start"],
3875
+ // #311 (Tailwind 4.3), before `mb`
3876
+ ["mbe", "scroll-margin-block-end"],
3784
3877
  ["mt", "scroll-margin-top"],
3785
3878
  ["mr", "scroll-margin-right"],
3786
3879
  ["mb", "scroll-margin-bottom"],
@@ -3791,6 +3884,8 @@ staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]]
3791
3884
  ["me", "scroll-margin-inline-end"],
3792
3885
  ["m", "scroll-margin"]
3793
3886
  ].forEach(([name, prop]) => {
3887
+ staticUtility(`scroll-${name}-px`, [[prop, "1px"]], { category: "interactivity" });
3888
+ staticUtility(`-scroll-${name}-px`, [[prop, "-1px"]], { category: "interactivity" });
3794
3889
  functionalUtility({
3795
3890
  name: `scroll-${name}`,
3796
3891
  spacingKeys: true,
@@ -3809,6 +3904,9 @@ staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]]
3809
3904
  });
3810
3905
  });
3811
3906
  [
3907
+ ["pbs", "scroll-padding-block-start"],
3908
+ // #311 (Tailwind 4.3), before `pb`
3909
+ ["pbe", "scroll-padding-block-end"],
3812
3910
  ["pt", "scroll-padding-top"],
3813
3911
  ["pr", "scroll-padding-right"],
3814
3912
  ["pb", "scroll-padding-bottom"],
@@ -3825,13 +3923,15 @@ staticUtility("snap-proximity", [["--baro-scroll-snap-strictness", "proximity"]]
3825
3923
  prop,
3826
3924
  supportsArbitrary: true,
3827
3925
  supportsCustomProperty: true,
3926
+ handleBareValue: ({ value }) => value === "px" ? "1px" : /^(\d|\.\d)/.test(value) ? value : null,
3828
3927
  handle: (value, _ctx, token, _extra) => {
3829
- if (parseNumber(value) || token.negative) {
3928
+ if (token.negative) return [];
3929
+ if (parseNumber(value)) {
3830
3930
  return [decl(prop, `calc(var(--spacing) * ${value})`)];
3831
3931
  }
3832
3932
  return [decl(prop, value)];
3833
3933
  },
3834
- handleCustomProperty: (value) => [decl(prop, `var(${value})`)],
3934
+ handleCustomProperty: (value, _ctx, token) => token.negative ? [] : [decl(prop, `var(${value})`)],
3835
3935
  description: `scroll-${name} utility (static, arbitrary, custom property supported)`,
3836
3936
  category: "interactivity"
3837
3937
  });
@@ -3862,6 +3962,40 @@ functionalUtility({
3862
3962
  description: "will-change utility (static, arbitrary, custom property supported)",
3863
3963
  category: "interactivity"
3864
3964
  });
3965
+ staticUtility("scrollbar-auto", [["scrollbar-width", "auto"]], { category: "interactivity" });
3966
+ staticUtility("scrollbar-thin", [["scrollbar-width", "thin"]], { category: "interactivity" });
3967
+ staticUtility("scrollbar-none", [["scrollbar-width", "none"]], { category: "interactivity" });
3968
+ staticUtility("scrollbar-gutter-auto", [["scrollbar-gutter", "auto"]], { category: "interactivity" });
3969
+ staticUtility("scrollbar-gutter-stable", [["scrollbar-gutter", "stable"]], { category: "interactivity" });
3970
+ staticUtility("scrollbar-gutter-both", [["scrollbar-gutter", "stable both-edges"]], { category: "interactivity" });
3971
+ const SCROLLBAR_COLOR = "var(--baro-scrollbar-thumb) var(--baro-scrollbar-track)";
3972
+ const scrollbarProperties = () => atRoot([
3973
+ property("--baro-scrollbar-thumb", "#0000", "<color>"),
3974
+ property("--baro-scrollbar-track", "#0000", "<color>")
3975
+ ]);
3976
+ const stripColorHint = (v) => v.replace(/^color:/, "");
3977
+ for (const part of ["thumb", "track"]) {
3978
+ const key = `--baro-scrollbar-${part}`;
3979
+ const compose = (inner) => [scrollbarProperties(), ...inner, decl("scrollbar-color", SCROLLBAR_COLOR)];
3980
+ const withOpacity = (color, opacity2) => opacity2 ? [decl(key, `color-mix(in oklab, ${color} ${opacity2.replace(/^\[(.*)\]$/, "$1").replace(/%$/, "")}%, transparent)`)] : [decl(key, color)];
3981
+ functionalUtility({
3982
+ name: `scrollbar-${part}`,
3983
+ themeKeys: ["colors"],
3984
+ supportsOpacity: true,
3985
+ supportsArbitrary: true,
3986
+ supportsCustomProperty: true,
3987
+ handle: (value, _ctx, token, extra) => {
3988
+ if (extra?.realThemeValue) return compose(withOpacity(`var(--color-${extra.realThemeValue})`, extra.opacity));
3989
+ if (token.arbitrary) return compose(withOpacity(stripColorHint(value), extra?.opacity));
3990
+ if (value === "inherit" || value === "transparent") return compose([decl(key, value)]);
3991
+ if (value === "current") return compose(withOpacity("currentcolor", extra?.opacity));
3992
+ return null;
3993
+ },
3994
+ handleCustomProperty: (value, _ctx, _token, extra) => compose(withOpacity(`var(${stripColorHint(value)})`, extra?.opacity)),
3995
+ description: `scrollbar-color ${part} utility (theme, arbitrary, custom property, opacity)`,
3996
+ category: "interactivity"
3997
+ });
3998
+ }
3865
3999
  const defaultTiming = "var(--default-transition-timing-function)";
3866
4000
  const defaultDuration = "var(--default-transition-duration)";
3867
4001
  staticUtility("transition", [
@@ -3999,53 +4133,99 @@ staticUtility("border-collapse", [["border-collapse", "collapse"]], { category:
3999
4133
  staticUtility("border-separate", [["border-collapse", "separate"]], { category: "table" });
4000
4134
  staticUtility("table-auto", [["table-layout", "auto"]], { category: "table" });
4001
4135
  staticUtility("table-fixed", [["table-layout", "fixed"]], { category: "table" });
4002
- functionalUtility({
4003
- name: "border-spacing-x",
4004
- prop: "border-spacing",
4005
- supportsArbitrary: true,
4006
- supportsCustomProperty: true,
4007
- handle: (value, _ctx, _token) => {
4008
- if (parseNumber(value)) {
4009
- return [decl("border-spacing", `calc(var(--spacing) * ${value}) var(--baro-border-spacing-y)`)];
4010
- }
4011
- return [decl("border-spacing", `${value} var(--baro-border-spacing-y)`)];
4012
- },
4013
- handleCustomProperty: (value) => [decl("border-spacing", `var(${value}) var(--baro-border-spacing-y)`)],
4014
- description: "border-spacing-x utility (static, number, arbitrary, custom property supported)",
4015
- category: "table"
4016
- });
4017
- functionalUtility({
4018
- name: "border-spacing-y",
4019
- prop: "border-spacing",
4020
- supportsArbitrary: true,
4021
- supportsCustomProperty: true,
4022
- handle: (value, _ctx, _token) => {
4023
- if (parseNumber(value)) {
4024
- return [decl("border-spacing", `var(--baro-border-spacing-x) calc(var(--spacing) * ${value})`)];
4025
- }
4026
- return [decl("border-spacing", `var(--baro-border-spacing-x) ${value}`)];
4027
- },
4028
- handleCustomProperty: (value) => [decl("border-spacing", `var(--baro-border-spacing-x) var(${value})`)],
4029
- description: "border-spacing-y utility (static, number, arbitrary, custom property supported)",
4030
- category: "table"
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"
4136
+ const borderSpacingProperties = () => atRoot([
4137
+ property("--baro-border-spacing-x", "0", "<length>"),
4138
+ property("--baro-border-spacing-y", "0", "<length>")
4139
+ ]);
4140
+ const BORDER_SPACING = "var(--baro-border-spacing-x) var(--baro-border-spacing-y)";
4141
+ const borderSpacing = (axes, v) => [
4142
+ borderSpacingProperties(),
4143
+ ...axes.map((a) => decl(`--baro-border-spacing-${a}`, v)),
4144
+ decl("border-spacing", BORDER_SPACING)
4145
+ ];
4146
+ [
4147
+ ["border-spacing-x", ["x"]],
4148
+ ["border-spacing-y", ["y"]],
4149
+ ["border-spacing", ["x", "y"]]
4150
+ ].forEach(([name, axes]) => {
4151
+ staticUtility(`${name}-px`, [
4152
+ borderSpacingProperties,
4153
+ ...axes.map((a) => [`--baro-border-spacing-${a}`, "1px"]),
4154
+ ["border-spacing", BORDER_SPACING]
4155
+ ], { category: "table" });
4156
+ functionalUtility({
4157
+ name,
4158
+ prop: "border-spacing",
4159
+ supportsArbitrary: true,
4160
+ supportsCustomProperty: true,
4161
+ handle: (value) => borderSpacing(axes, parseNumber(value) ? `calc(var(--spacing) * ${value})` : value),
4162
+ handleCustomProperty: (value) => borderSpacing(axes, `var(${value})`),
4163
+ description: `${name} utility (number, px, arbitrary, custom property supported)`,
4164
+ category: "table"
4165
+ });
4046
4166
  });
4047
4167
  staticUtility("caption-top", [["caption-side", "top"]], { category: "table" });
4048
4168
  staticUtility("caption-bottom", [["caption-side", "bottom"]], { category: "table" });
4169
+ function parseAlpha(op) {
4170
+ if (!op) return null;
4171
+ if (/^\d+(\.\d+)?$/.test(op)) return { alpha: `${op}%`, isVar: false };
4172
+ const pct = /^\[(\d+(?:\.\d+)?)%\]$/.exec(op);
4173
+ if (pct) return { alpha: `${pct[1]}%`, isVar: false };
4174
+ const cp = /^\((--[\w-]+)\)$/.exec(op);
4175
+ if (cp) return { alpha: `var(${cp[1]})`, isVar: true };
4176
+ return null;
4177
+ }
4178
+ function splitTop(value, sep) {
4179
+ const out = [];
4180
+ let depth = 0;
4181
+ let cur = "";
4182
+ for (const ch of value) {
4183
+ if (ch === "(") depth++;
4184
+ else if (ch === ")") depth--;
4185
+ if (depth === 0 && (sep === " " ? /\s/.test(ch) : ch === sep)) {
4186
+ if (cur.trim()) out.push(cur.trim());
4187
+ cur = "";
4188
+ } else cur += ch;
4189
+ }
4190
+ if (cur.trim()) out.push(cur.trim());
4191
+ return out;
4192
+ }
4193
+ const LENGTH = /^-?(\d*\.)?\d+([a-z]+|%)?$/i;
4194
+ function shadowLayers(value, layer, alpha) {
4195
+ return splitTop(value, ",").map((l) => {
4196
+ const parts = splitTop(l, " ");
4197
+ const i = parts.findIndex((p) => p !== "inset" && !LENGTH.test(p));
4198
+ const c = i < 0 ? "currentcolor" : parts[i];
4199
+ parts[i < 0 ? parts.length : i] = `var(--baro-${layer}-color, ${alpha ? `oklab(from ${c} l a b / ${alpha})` : c})`;
4200
+ return parts.join(" ");
4201
+ });
4202
+ }
4203
+ function shadowValueDecls(layer, prop, value, opacity2, render = (l) => l.join(", ")) {
4204
+ const a = parseAlpha(opacity2);
4205
+ if (opacity2 && !a) return null;
4206
+ if (!a) return [decl(prop, render(shadowLayers(value, layer)))];
4207
+ const alphaDecl = decl(`--baro-${layer}-alpha`, a.alpha);
4208
+ if (!a.isVar) return [alphaDecl, decl(prop, render(shadowLayers(value, layer, a.alpha)))];
4209
+ return [
4210
+ alphaDecl,
4211
+ decl(prop, render(shadowLayers(value, layer))),
4212
+ atRule("supports", "(color: lab(from red l a b))", [decl(prop, render(shadowLayers(value, layer, a.alpha)))])
4213
+ ];
4214
+ }
4215
+ function shadowColorDecls(layer, color, opacity2, ref = color) {
4216
+ const key = `--baro-${layer}-color`;
4217
+ if (color === "inherit") return [decl(key, "inherit")];
4218
+ const a = parseAlpha(opacity2);
4219
+ if (opacity2 && !a) return null;
4220
+ const inner = a ? `color-mix(in oklab, ${ref} ${a.alpha}, transparent)` : ref;
4221
+ const fallback = a ? `color-mix(in srgb, ${color} ${a.alpha}, transparent)` : color;
4222
+ return [
4223
+ decl(key, fallback),
4224
+ atRule("supports", "(color: color-mix(in lab, red, red))", [
4225
+ decl(key, `color-mix(in oklab, ${inner} var(--baro-${layer}-alpha), transparent)`)
4226
+ ])
4227
+ ];
4228
+ }
4049
4229
  staticUtility("filter-none", [["filter", "none"]], { category: "effects" });
4050
4230
  functionalUtility({
4051
4231
  name: "filter",
@@ -4130,57 +4310,68 @@ functionalUtility({
4130
4310
  description: "contrast filter utility (static, number, arbitrary, custom property supported)",
4131
4311
  category: "effects"
4132
4312
  });
4133
- [
4134
- ["drop-shadow-xs", "xs", "0 1px 1px var(--baro-drop-shadow-color, #0000001a)"],
4135
- ["drop-shadow-sm", "sm", "0 1px 2px var(--baro-drop-shadow-color, #0000001a)"],
4136
- ["drop-shadow-md", "md", "0 3px 3px var(--baro-drop-shadow-color, #0000001a)"],
4137
- ["drop-shadow-lg", "lg", "0 4px 4px var(--baro-drop-shadow-color, #0000001a)"],
4138
- ["drop-shadow-xl", "xl", "0 9px 7px var(--baro-drop-shadow-color, #0000001a)"],
4139
- ["drop-shadow-2xl", "2xl", "0 25px 25px var(--baro-drop-shadow-color, #0000001a)"]
4140
- ].forEach(([name, size, sizeValue]) => {
4141
- staticUtility(name, [
4142
- decl("--baro-drop-shadow-size", `drop-shadow(${sizeValue})`),
4143
- decl("--baro-drop-shadow", `var(--drop-shadow-${size})`),
4144
- filters$1()
4145
- ]);
4146
- });
4147
- staticUtility("drop-shadow-none", [decl("--baro-drop-shadow", "drop-shadow(0 0 #0000)"), filters$1()]);
4148
- ["inherit", "current", "transparent"].forEach((name) => {
4149
- staticUtility(`drop-shadow-${name}`, [
4150
- decl("--baro-drop-shadow-color", name === "current" ? "currentColor" : name)
4151
- ]);
4152
- });
4153
- ["black", "white"].forEach((name) => {
4154
- staticUtility(`drop-shadow-${name}`, [
4155
- decl("--baro-drop-shadow-color", `var(--color-${name})`)
4156
- ]);
4313
+ const dropShadowProperties = () => atRoot([
4314
+ property("--baro-drop-shadow"),
4315
+ property("--baro-drop-shadow-color"),
4316
+ property("--baro-drop-shadow-alpha", "100%", "<percentage>"),
4317
+ property("--baro-drop-shadow-size")
4318
+ ]);
4319
+ const wrapDropShadow = (layers) => layers.map((l) => `drop-shadow(${l})`).join(" ");
4320
+ const DROP_SHADOW_DEFAULT = "0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06)";
4321
+ const namedDropShadow = (ctx, name) => {
4322
+ const v = ctx.theme("dropShadow", name);
4323
+ return typeof v === "string" && /^[\w.-]+$/.test(name) ? v : null;
4324
+ };
4325
+ function dropShadowValue(value, opacity2, named, keepNamed = false) {
4326
+ const decls = shadowValueDecls("drop-shadow", "--baro-drop-shadow-size", value, opacity2, wrapDropShadow);
4327
+ if (!decls) return null;
4328
+ const composed = named !== void 0 && (!opacity2 || keepNamed) ? named : "var(--baro-drop-shadow-size)";
4329
+ return [dropShadowProperties(), ...decls, decl("--baro-drop-shadow", composed), filters$1()];
4330
+ }
4331
+ staticUtility("drop-shadow-none", [decl("--baro-drop-shadow", " "), filters$1()]);
4332
+ registerUtility({
4333
+ name: "drop-shadow",
4334
+ match: (className) => /^drop-shadow(\/.+)?$/.test(className),
4335
+ handler: (value, _ctx, token) => {
4336
+ const full = value ? `${token.prefix}-${value}` : token.prefix;
4337
+ const cut = full.indexOf("/");
4338
+ const opacity2 = cut < 0 ? void 0 : full.slice(cut + 1);
4339
+ const literal = "drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow( 0 1px 1px rgb(0 0 0 / 0.06))";
4340
+ return dropShadowValue(DROP_SHADOW_DEFAULT, opacity2, literal, true) ?? [];
4341
+ },
4342
+ category: "effects"
4157
4343
  });
4344
+ const dropShadowColor = (color, opacity2, ref) => {
4345
+ const decls = shadowColorDecls("drop-shadow", color, opacity2, ref);
4346
+ return decls && [dropShadowProperties(), ...decls, decl("--baro-drop-shadow", "var(--baro-drop-shadow-size)")];
4347
+ };
4158
4348
  functionalUtility({
4159
4349
  name: "drop-shadow",
4160
4350
  themeKeys: ["colors"],
4161
4351
  supportsArbitrary: true,
4162
4352
  supportsCustomProperty: true,
4163
- handle: (value, _ctx, _token, extra) => {
4164
- if (extra?.realThemeValue) {
4165
- return [decl("--baro-drop-shadow-color", `var(--color-${extra.realThemeValue})`)];
4166
- }
4167
- if (parseColor(value)) {
4168
- return [decl("--baro-drop-shadow-color", value)];
4353
+ supportsOpacity: true,
4354
+ handleBareValue: ({ value, ctx }) => namedDropShadow(ctx, value) ? value : null,
4355
+ handle: (value, ctx, token, extra) => {
4356
+ const opacity2 = extra?.opacity;
4357
+ const keyword = token.arbitrary ? void 0 : { inherit: "inherit", current: "currentcolor", transparent: "transparent" }[extra?.realThemeValue ?? value];
4358
+ if (keyword) return dropShadowColor(keyword, opacity2);
4359
+ if (extra?.realThemeValue) return dropShadowColor(value, opacity2, `var(--color-${extra.realThemeValue})`);
4360
+ if (token.arbitrary) {
4361
+ if (parseColor(value)) return dropShadowColor(value, opacity2);
4362
+ return dropShadowValue(value, opacity2);
4169
4363
  }
4170
- return [
4171
- decl("--baro-drop-shadow-size", `drop-shadow(${value})`),
4172
- decl("--baro-drop-shadow", `var(--baro-drop-shadow-size)`)
4173
- ];
4364
+ const named = namedDropShadow(ctx, value);
4365
+ if (named) return dropShadowValue(named, opacity2, `drop-shadow(var(--drop-shadow-${value}))`);
4366
+ return null;
4174
4367
  },
4175
4368
  handleCustomProperty: (value) => {
4176
- if (value.startsWith("color:")) {
4177
- return [
4178
- decl("--baro-drop-shadow-color", `var(${value.replace("color:", "")})`)
4179
- ];
4180
- }
4369
+ if (value.startsWith("color:")) return dropShadowColor(`var(${value.slice(6)})`, void 0) ?? [];
4181
4370
  return [
4371
+ dropShadowProperties(),
4182
4372
  decl("--baro-drop-shadow-size", `drop-shadow(var(${value}))`),
4183
- decl("--baro-drop-shadow", `var(--baro-drop-shadow-size)`)
4373
+ decl("--baro-drop-shadow", `var(--baro-drop-shadow-size)`),
4374
+ filters$1()
4184
4375
  ];
4185
4376
  },
4186
4377
  description: "drop-shadow filter utility (static, arbitrary, custom property supported)",
@@ -4550,166 +4741,119 @@ const ringShadowProperties = () => atRoot([
4550
4741
  property("--baro-ring-offset-width", "0px", "<length>"),
4551
4742
  property("--baro-ring-offset-color", "#fff")
4552
4743
  ]);
4553
- const shadowLayer = (value) => [
4554
- ringShadowProperties(),
4555
- decl("--baro-shadow", value),
4556
- decl("box-shadow", SHADOW_COMPOSITE)
4557
- ];
4558
- [
4559
- ["shadow-2xs", "var(--shadow-2xs)"],
4560
- ["shadow-xs", "var(--shadow-xs)"],
4561
- ["shadow-sm", "var(--shadow-sm)"],
4562
- ["shadow", "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)"],
4563
- ["shadow-md", "var(--shadow-md)"],
4564
- ["shadow-lg", "var(--shadow-lg)"],
4565
- ["shadow-xl", "var(--shadow-xl)"],
4566
- ["shadow-2xl", "var(--shadow-2xl)"],
4567
- ["shadow-none", "0 0 #0000"]
4568
- ].forEach(([name, value]) => {
4569
- staticUtility(name, [
4570
- ringShadowProperties,
4571
- ["--baro-shadow", value],
4572
- ["box-shadow", SHADOW_COMPOSITE]
4573
- ], { category: "effects" });
4574
- });
4575
- [
4576
- ["inset-shadow-2xs", "inset 0 1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4577
- ["inset-shadow-xs", "inset 0 1px 1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4578
- ["inset-shadow-sm", "inset 0 2px 4px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4579
- ["inset-shadow-md", "inset 0 4px 6px -1px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4580
- ["inset-shadow-lg", "inset 0 10px 15px -3px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4581
- ["inset-shadow-xl", "inset 0 20px 25px -5px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4582
- ["inset-shadow-2xl", "inset 0 25px 50px -12px var(--baro-inset-shadow-color, rgb(0 0 0 / 0.05))"],
4583
- ["inset-shadow-none", "0 0 #0000"]
4584
- ].forEach(([name, value]) => {
4585
- staticUtility(name, [
4586
- ringShadowProperties,
4587
- ["--baro-inset-shadow", value],
4588
- ["box-shadow", SHADOW_COMPOSITE]
4589
- ], { category: "effects" });
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
- ];
4744
+ const shadowColorProperties = (layer) => atRoot([
4745
+ property(`--baro-${layer}-color`),
4746
+ property(`--baro-${layer}-alpha`, "100%", "<percentage>")
4747
+ ]);
4748
+ const NAMED_SHADOWS = {
4749
+ "": "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
4750
+ "2xs": "0 1px rgb(0 0 0 / 0.05)",
4751
+ xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
4752
+ sm: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
4753
+ md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
4754
+ lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
4755
+ xl: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
4756
+ "2xl": "0 25px 50px -12px rgb(0 0 0 / 0.25)",
4757
+ inner: "inset 0 2px 4px 0 rgb(0 0 0 / 0.05)"
4758
+ };
4759
+ const NAMED_INSET_SHADOWS = {
4760
+ "2xs": "inset 0 1px rgb(0 0 0 / 0.05)",
4761
+ xs: "inset 0 1px 1px rgb(0 0 0 / 0.05)",
4762
+ sm: "inset 0 2px 4px rgb(0 0 0 / 0.05)"
4763
+ };
4764
+ const INSET_EXTENSIONS = {
4765
+ md: "inset 0 4px 6px -1px rgb(0 0 0 / 0.05)",
4766
+ lg: "inset 0 10px 15px -3px rgb(0 0 0 / 0.05)",
4767
+ xl: "inset 0 20px 25px -5px rgb(0 0 0 / 0.05)",
4768
+ "2xl": "inset 0 25px 50px -12px rgb(0 0 0 / 0.05)"
4769
+ };
4770
+ const insetEach = (value) => value.split(/,(?![^(]*\))/).map((l) => `inset ${l.trim()}`).join(", ");
4771
+ const own = (table, key) => Object.prototype.hasOwnProperty.call(table, key);
4772
+ function boxShadowLayer(layer, value, opacity2) {
4773
+ const decls = shadowValueDecls(layer, `--baro-${layer}`, value, opacity2);
4774
+ if (!decls) return null;
4775
+ return [ringShadowProperties(), shadowColorProperties(layer), ...decls, decl("box-shadow", SHADOW_COMPOSITE)];
4776
+ }
4777
+ function namedBoxShadow(layer, name, opacity2) {
4778
+ if (layer === "shadow") return own(NAMED_SHADOWS, name) ? boxShadowLayer(layer, NAMED_SHADOWS[name], opacity2) : null;
4779
+ if (own(NAMED_INSET_SHADOWS, name)) return boxShadowLayer(layer, NAMED_INSET_SHADOWS[name], opacity2);
4780
+ if (!opacity2 && own(INSET_EXTENSIONS, name)) return boxShadowLayer(layer, INSET_EXTENSIONS[name], void 0);
4781
+ return null;
4612
4782
  }
4613
- functionalUtility({
4783
+ staticUtility("shadow-none", [ringShadowProperties, ["--baro-shadow", "0 0 #0000"], ["box-shadow", SHADOW_COMPOSITE]], { category: "effects" });
4784
+ staticUtility("inset-shadow-none", [ringShadowProperties, ["--baro-inset-shadow", "inset 0 0 #0000"], ["box-shadow", SHADOW_COMPOSITE]], { category: "effects" });
4785
+ registerUtility({
4614
4786
  name: "shadow",
4615
- supportsArbitrary: true,
4616
- supportsCustomProperty: true,
4617
- supportsOpacity: true,
4618
- themeKeys: ["colors", "shadows"],
4619
- handle: (value, ctx, token, extra) => {
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;
4787
+ match: (className) => /^shadow(\/.+)?$/.test(className),
4788
+ handler: (value, _ctx, token) => {
4789
+ const full = value ? `${token.prefix}-${value}` : token.prefix;
4790
+ const cut = full.indexOf("/");
4791
+ return namedBoxShadow("shadow", "", cut < 0 ? void 0 : full.slice(cut + 1)) ?? [];
4663
4792
  },
4664
- handleCustomProperty: (value) => shadowLayer(`var(${value})`)
4793
+ category: "effects"
4665
4794
  });
4795
+ const KEYWORD_COLORS = { inherit: "inherit", current: "currentcolor", transparent: "transparent" };
4796
+ function layerColor(layer, main, opacity2, token, realThemeValue) {
4797
+ const keyword = token.arbitrary ? void 0 : KEYWORD_COLORS[realThemeValue ?? main];
4798
+ if (keyword) return shadowColorDecls(layer, keyword, opacity2);
4799
+ if (realThemeValue) return shadowColorDecls(layer, main, opacity2, `var(--color-${realThemeValue})`);
4800
+ if (main.startsWith("color:")) return shadowColorDecls(layer, `var(${main.slice(6)})`, opacity2);
4801
+ if (token.arbitrary && parseColor(main)) return shadowColorDecls(layer, main, opacity2);
4802
+ return void 0;
4803
+ }
4804
+ for (const layer of ["shadow", "inset-shadow"]) {
4805
+ functionalUtility({
4806
+ name: layer,
4807
+ supportsArbitrary: true,
4808
+ supportsCustomProperty: true,
4809
+ supportsOpacity: true,
4810
+ themeKeys: ["colors"],
4811
+ handleBareValue: ({ value, extra }) => namedBoxShadow(layer, value, extra?.opacity) ? value : null,
4812
+ handle: (value, _ctx, token, extra) => {
4813
+ const opacity2 = extra?.opacity;
4814
+ const named = !extra?.realThemeValue && !token.arbitrary ? namedBoxShadow(layer, value, opacity2) : null;
4815
+ if (named) return named;
4816
+ const color = layerColor(layer, value, opacity2, token, extra?.realThemeValue);
4817
+ if (color !== void 0) return color;
4818
+ if (token.arbitrary) return boxShadowLayer(layer, layer === "inset-shadow" ? insetEach(value) : value, opacity2);
4819
+ return null;
4820
+ },
4821
+ 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)]
4822
+ });
4823
+ }
4824
+ const textShadowProperties = () => atRoot([
4825
+ property("--baro-text-shadow-color"),
4826
+ property("--baro-text-shadow-alpha", "100%", "<percentage>")
4827
+ ]);
4828
+ const namedTextShadow = (ctx, name) => {
4829
+ const v = ctx.theme("textShadow", name);
4830
+ return typeof v === "string" && /^[\w.-]+$/.test(name) ? v : null;
4831
+ };
4832
+ const textShadowValue = (value, opacity2) => {
4833
+ const decls = shadowValueDecls("text-shadow", "text-shadow", value, opacity2);
4834
+ return decls ? [textShadowProperties(), ...decls] : null;
4835
+ };
4836
+ staticUtility("text-shadow-none", [textShadowProperties, ["text-shadow", "none"]], { category: "effects" });
4666
4837
  functionalUtility({
4667
- name: "inset-shadow",
4838
+ name: "text-shadow",
4668
4839
  supportsArbitrary: true,
4669
4840
  supportsCustomProperty: true,
4670
4841
  supportsOpacity: true,
4671
- themeKeys: ["colors", "shadows"],
4842
+ themeKeys: ["colors"],
4843
+ handleBareValue: ({ value, ctx }) => namedTextShadow(ctx, value) ? value : null,
4672
4844
  handle: (value, ctx, token, extra) => {
4673
- const main = value;
4674
4845
  const opacity2 = extra?.opacity;
4675
- const realThemeValue = extra?.realThemeValue;
4676
- if (realThemeValue) {
4677
- return createShadowThemeColor(
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
- ];
4846
+ if (!extra?.realThemeValue && !token.arbitrary) {
4847
+ const named = namedTextShadow(ctx, value);
4848
+ if (named) return textShadowValue(named, opacity2);
4709
4849
  }
4850
+ const color = layerColor("text-shadow", value, opacity2, token, extra?.realThemeValue);
4851
+ if (color !== void 0) return color && [textShadowProperties(), ...color];
4852
+ if (token.arbitrary) return textShadowValue(value, opacity2);
4710
4853
  return null;
4711
4854
  },
4712
- handleCustomProperty: (value) => [decl("box-shadow", `var(${value})`)]
4855
+ handleCustomProperty: (value) => value.startsWith("color:") ? [textShadowProperties(), ...shadowColorDecls("text-shadow", `var(${value.slice(6)})`, void 0) ?? []] : [textShadowProperties(), decl("text-shadow", `var(${value})`)],
4856
+ category: "effects"
4713
4857
  });
4714
4858
  [
4715
4859
  ["ring", "1px"],
@@ -5252,12 +5396,15 @@ staticUtility("not-sr-only", [
5252
5396
  ], { category: "layout" });
5253
5397
  staticUtility("@container", [["container-type", "inline-size"]], { category: "layout" });
5254
5398
  staticUtility("@container-normal", [["container-type", "normal"]], { category: "layout" });
5399
+ staticUtility("@container-size", [["container-type", "size"]], { category: "layout" });
5400
+ const NAMED_CONTAINER = /^@container(-normal|-size)?\/([a-zA-Z0-9_-]+)$/;
5401
+ const CONTAINER_TYPE = { "": "inline-size", "-normal": "normal", "-size": "size" };
5255
5402
  registerUtility({
5256
5403
  name: "@container",
5257
- match: (className) => /^@container\/[a-zA-Z0-9_-]+$/.test(className),
5404
+ match: (className) => NAMED_CONTAINER.test(className),
5258
5405
  handler: (_value, _ctx, token) => {
5259
- const name = /^@container\/([a-zA-Z0-9_-]+)$/.exec(`${token.prefix}${token.value ? `-${token.value}` : ""}`)?.[1];
5260
- return name ? [decl("container-type", "inline-size"), decl("container-name", name)] : null;
5406
+ const m = NAMED_CONTAINER.exec(`${token.prefix}${token.value ? `-${token.value}` : ""}`);
5407
+ return m ? [decl("container-type", CONTAINER_TYPE[m[1] ?? ""]), decl("container-name", m[2])] : null;
5261
5408
  },
5262
5409
  category: "layout"
5263
5410
  });
@@ -5342,6 +5489,11 @@ staticUtility("sticky", [["position", "sticky"]], { category: "layout" });
5342
5489
  [
5343
5490
  ["inset-x", "inset-inline"],
5344
5491
  ["inset-y", "inset-block"],
5492
+ // Tailwind 4.3 logical sides; registered before `inset` so their handler runs first for `inset-s-*` etc.
5493
+ ["inset-s", "inset-inline-start"],
5494
+ ["inset-e", "inset-inline-end"],
5495
+ ["inset-bs", "inset-block-start"],
5496
+ ["inset-be", "inset-block-end"],
5345
5497
  ["inset", "inset"],
5346
5498
  ["start", "inset-inline-start"],
5347
5499
  ["end", "inset-inline-end"],
@@ -5437,6 +5589,15 @@ functionalUtility({
5437
5589
  description: "gap utility (number, arbitrary, custom property supported)",
5438
5590
  category: "layout"
5439
5591
  });
5592
+ functionalUtility({
5593
+ name: "zoom",
5594
+ prop: "zoom",
5595
+ supportsArbitrary: true,
5596
+ supportsCustomProperty: true,
5597
+ handleBareValue: ({ value }) => /^\d+$/.test(value) ? `${value}%` : null,
5598
+ description: "zoom utility (integer percent, arbitrary, custom property)",
5599
+ category: "layout"
5600
+ });
5440
5601
  staticUtility("basis-full", [["flex-basis", "100%"]], { category: "flex-grid" });
5441
5602
  staticUtility("basis-auto", [["flex-basis", "auto"]], { category: "flex-grid" });
5442
5603
  staticUtility("basis-3xs", [["flex-basis", "var(--container-3xs)"]], { category: "flex-grid" });
@@ -5711,6 +5872,8 @@ functionalUtility({
5711
5872
  // auto-cols-[minmax(0,2fr)]
5712
5873
  supportsCustomProperty: true,
5713
5874
  // auto-cols-(--my-auto-cols)
5875
+ handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
5876
+ // #310: auto-cols-4
5714
5877
  handle: (value) => {
5715
5878
  if (typeof value === "string") return [decl("grid-auto-columns", value)];
5716
5879
  return null;
@@ -5730,6 +5893,8 @@ functionalUtility({
5730
5893
  // auto-rows-[minmax(0,2fr)]
5731
5894
  supportsCustomProperty: true,
5732
5895
  // auto-rows-(--my-auto-rows)
5896
+ handleBareValue: ({ value }) => parseNumber(value) ? `calc(var(--spacing) * ${value})` : null,
5897
+ // #310: auto-rows-12
5733
5898
  handle: (value) => {
5734
5899
  if (typeof value === "string") return [decl("grid-auto-rows", value)];
5735
5900
  return null;
@@ -5932,6 +6097,8 @@ functionalUtility({
5932
6097
  ["py", "padding-block"],
5933
6098
  ["ps", "padding-inline-start"],
5934
6099
  ["pe", "padding-inline-end"],
6100
+ ["pbs", "padding-block-start"],
6101
+ ["pbe", "padding-block-end"],
5935
6102
  ["pt", "padding-top"],
5936
6103
  ["pr", "padding-right"],
5937
6104
  ["pb", "padding-bottom"],
@@ -5955,6 +6122,8 @@ functionalUtility({
5955
6122
  ["my", "margin-block"],
5956
6123
  ["ms", "margin-inline-start"],
5957
6124
  ["me", "margin-inline-end"],
6125
+ ["mbs", "margin-block-start"],
6126
+ ["mbe", "margin-block-end"],
5958
6127
  ["mt", "margin-top"],
5959
6128
  ["mr", "margin-right"],
5960
6129
  ["mb", "margin-bottom"],
@@ -6280,6 +6449,41 @@ functionalUtility({
6280
6449
  description: "max-width utility (spacing, fraction, arbitrary, custom property, static supported)",
6281
6450
  category: "sizing"
6282
6451
  });
6452
+ {
6453
+ const containers = ["3xs", "2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "5xl", "6xl", "7xl"].map(
6454
+ (k) => [k, `var(--container-${k})`]
6455
+ );
6456
+ const common = [["0", "0px"], ["px", "1px"], ["full", "100%"], ["min", "min-content"], ["max", "max-content"], ["fit", "fit-content"]];
6457
+ const inlineVp = [["screen", "100vw"], ["dvw", "100dvw"], ["lvw", "100lvw"], ["svw", "100svw"]];
6458
+ const blockVp = [["screen", "100vh"], ["dvh", "100dvh"], ["lvh", "100lvh"], ["svh", "100svh"], ["lh", "1lh"]];
6459
+ const families = [
6460
+ ["inline", "inline-size", [...common, ["auto", "auto"], ...inlineVp, ...containers]],
6461
+ ["min-inline", "min-inline-size", [...common, ["auto", "auto"], ...inlineVp, ...containers]],
6462
+ ["max-inline", "max-inline-size", [...common, ["none", "none"], ...inlineVp, ...containers]],
6463
+ ["block", "block-size", [...common, ["auto", "auto"], ...blockVp]],
6464
+ ["min-block", "min-block-size", [...common, ["auto", "auto"], ...blockVp]],
6465
+ ["max-block", "max-block-size", [...common, ["none", "none"], ...blockVp]]
6466
+ ];
6467
+ for (const [name, prop, statics] of families) {
6468
+ for (const [key, value] of statics) staticUtility(`${name}-${key}`, [[prop, value]], { category: "sizing" });
6469
+ functionalUtility({
6470
+ spacingKeys: true,
6471
+ name,
6472
+ prop,
6473
+ supportsArbitrary: true,
6474
+ supportsCustomProperty: true,
6475
+ supportsFraction: true,
6476
+ handleBareValue: ({ value, token }) => {
6477
+ if (token.negative) return null;
6478
+ if (parseNumber(value)) return `calc(var(--spacing) * ${value})`;
6479
+ if (parseFractionOrNumber(value)) return `calc(${value} * 100%)`;
6480
+ return null;
6481
+ },
6482
+ description: `${prop} utility (spacing, fraction, arbitrary, custom property, keywords)`,
6483
+ category: "sizing"
6484
+ });
6485
+ }
6486
+ }
6283
6487
  const leadingProperty = () => atRoot([property("--baro-leading")]);
6284
6488
  staticUtility("font-sans", [["font-family", "var(--font-sans)"]], { category: "typography" });
6285
6489
  staticUtility("font-serif", [["font-family", "var(--font-serif)"]], { category: "typography" });
@@ -6310,13 +6514,15 @@ functionalUtility({
6310
6514
  name: "font",
6311
6515
  supportsArbitrary: true,
6312
6516
  supportsCustomProperty: true,
6313
- handle: (value) => {
6517
+ handle: (value, _ctx, token) => {
6518
+ if (token.prefix !== "font") return null;
6314
6519
  if (parseNumber(value)) {
6315
6520
  return [decl("font-weight", value)];
6316
6521
  }
6317
6522
  return [decl("font-family", value)];
6318
6523
  },
6319
- handleCustomProperty: (value) => {
6524
+ handleCustomProperty: (value, _ctx, token) => {
6525
+ if (token.prefix !== "font") return null;
6320
6526
  if (value.startsWith("font-name:")) {
6321
6527
  return [decl("font-family", `var(${value.replace("font-name:", "")})`)];
6322
6528
  }
@@ -6615,6 +6821,42 @@ functionalUtility({
6615
6821
  description: "content utility (arbitrary, custom property supported)",
6616
6822
  category: "typography"
6617
6823
  });
6824
+ const placeholderColor = (value) => [rule("&::placeholder", [decl("color", value)])];
6825
+ staticUtility("placeholder-inherit", placeholderColor("inherit"), { category: "typography" });
6826
+ staticUtility("placeholder-current", placeholderColor("currentcolor"), { category: "typography" });
6827
+ staticUtility("placeholder-transparent", placeholderColor("transparent"), { category: "typography" });
6828
+ functionalUtility({
6829
+ name: "placeholder",
6830
+ themeKeys: ["colors"],
6831
+ supportsArbitrary: true,
6832
+ supportsCustomProperty: true,
6833
+ supportsOpacity: true,
6834
+ handle: (value, _ctx, _token, extra) => {
6835
+ if (extra?.realThemeValue) return [rule("&::placeholder", themeColorDecls("color", value, extra))];
6836
+ if (parseColor(value)) return placeholderColor(value);
6837
+ return null;
6838
+ },
6839
+ handleCustomProperty: (value) => placeholderColor(`var(${value})`),
6840
+ description: "placeholder color utility (theme, alpha, arbitrary, custom property)"
6841
+ });
6842
+ functionalUtility({
6843
+ name: "font-features",
6844
+ supportsArbitrary: true,
6845
+ supportsCustomProperty: true,
6846
+ handle: (value, _ctx, token) => token.arbitrary ? [decl("font-feature-settings", value)] : null,
6847
+ handleCustomProperty: (value) => [decl("font-feature-settings", `var(${value.replace(/^[a-z-]+:(?=--)/, "")})`)],
6848
+ description: "font-feature-settings utility (arbitrary, custom property)",
6849
+ category: "typography"
6850
+ });
6851
+ functionalUtility({
6852
+ name: "tab",
6853
+ prop: "tab-size",
6854
+ supportsArbitrary: true,
6855
+ supportsCustomProperty: true,
6856
+ handleBareValue: ({ value }) => /^\d+$/.test(value) ? value : null,
6857
+ description: "tab-size utility (integer, arbitrary, custom property)",
6858
+ category: "typography"
6859
+ });
6618
6860
  const gradientStopProperties = () => {
6619
6861
  return atRoot([
6620
6862
  property("--baro-gradient-position"),
@@ -6946,6 +7188,11 @@ const withBorderStyle = (props, width) => [
6946
7188
  [
6947
7189
  ["border-x", ["border-left-width", "border-right-width"]],
6948
7190
  ["border-y", ["border-top-width", "border-bottom-width"]],
7191
+ ["border-bs", ["border-block-start-width"]],
7192
+ ["border-be", ["border-block-end-width"]],
7193
+ ["border-s", ["border-inline-start-width"]],
7194
+ // #311 (Tailwind 4.3)
7195
+ ["border-e", ["border-inline-end-width"]],
6949
7196
  ["border-t", ["border-top-width"]],
6950
7197
  ["border-r", ["border-right-width"]],
6951
7198
  ["border-b", ["border-bottom-width"]],
@@ -6965,6 +7212,7 @@ const withBorderStyle = (props, width) => [
6965
7212
  functionalUtility({
6966
7213
  name,
6967
7214
  themeKeys: ["borderWidth", "colors"],
7215
+ supportsOpacity: true,
6968
7216
  supportsArbitrary: true,
6969
7217
  supportsCustomProperty: true,
6970
7218
  handleBareValue: ({ value }) => {
@@ -7945,9 +8193,10 @@ staticModifier("starting", ["&"], {
7945
8193
  wrap: () => [atRule("starting-style", "", [], "starting")],
7946
8194
  source: "starting"
7947
8195
  });
7948
- function createContainerParams(type, value, name) {
8196
+ function createContainerParams(type, value, name, negate = false) {
7949
8197
  const condition = type === "min" ? "width >=" : "width <";
7950
- return name ? `${name} (${condition} ${value})` : `(${condition} ${value})`;
8198
+ const query = `${negate ? "not " : ""}(${condition} ${value})`;
8199
+ return name ? `${name} ${query}` : query;
7951
8200
  }
7952
8201
  function createContainerRule(params, ast) {
7953
8202
  return {
@@ -8116,17 +8365,17 @@ functionalModifier(
8116
8365
  return result;
8117
8366
  }
8118
8367
  );
8119
- const SIZE_VARIANT = /^@(?:(min|max)-)?(\[[^\]]+\]|[a-zA-Z0-9.]+)(?:\/([a-zA-Z0-9_-]+))?$/;
8368
+ const SIZE_VARIANT = /^(not-)?@(?:(min|max)-)?(\[[^\]]+\]|[a-zA-Z0-9.]+)(?:\/([a-zA-Z0-9_-]+))?$/;
8120
8369
  functionalModifier(
8121
- (mod) => SIZE_VARIANT.test(mod) && !/^@container(?:\/|$)/.test(mod),
8370
+ (mod) => SIZE_VARIANT.test(mod) && !/^(?:not-)?@container(?:\/|$)/.test(mod),
8122
8371
  void 0,
8123
8372
  (mod, context) => {
8124
8373
  const m = SIZE_VARIANT.exec(mod.type);
8125
8374
  if (!m) return [];
8126
- const [, type, size, name] = m;
8375
+ const [, not, type, size, name] = m;
8127
8376
  const value = size.startsWith("[") ? size.slice(1, -1).replace(/_/g, " ") : context.theme("container." + size);
8128
8377
  if (!value) return [];
8129
- return [createContainerRule(createContainerParams(type === "max" ? "max" : "min", value, name), [])];
8378
+ return [createContainerRule(createContainerParams(type === "max" ? "max" : "min", value, name, !!not), [])];
8130
8379
  }
8131
8380
  );
8132
8381
  const startsAtRule = (bracket) => /^[\s_]*@/.test(bracket);
@@ -8266,7 +8515,7 @@ functionalModifier(
8266
8515
  }
8267
8516
  );
8268
8517
  functionalModifier(
8269
- (mod) => /^not-/.test(mod),
8518
+ (mod) => /^not-/.test(mod) && !mod.startsWith("not-@"),
8270
8519
  ({ selector, mod }) => {
8271
8520
  const m = /^not-(.+)$/.exec(mod.type);
8272
8521
  return {
@@ -8333,7 +8582,8 @@ functionalModifier(
8333
8582
  void 0
8334
8583
  );
8335
8584
  functionalModifier(
8336
- (mod) => mod.startsWith("not-"),
8585
+ (mod) => mod.startsWith("not-") && !mod.startsWith("not-@"),
8586
+ // not-@… is container negation (#311)
8337
8587
  ({ selector, mod }) => {
8338
8588
  const pseudo = mod.type.replace("not-", "");
8339
8589
  if (pseudo.startsWith("[")) {
@@ -9568,9 +9818,9 @@ ${preflightCSS}
9568
9818
  }
9569
9819
  /** Class names defined by the page's own stylesheets (BaroCSS's sheets and cross-origin sheets excluded). */
9570
9820
  getExistingClasses() {
9571
- const own = new Set(Array.from(document.querySelectorAll("style[data-barocss]"), (s) => s.sheet));
9821
+ const own2 = new Set(Array.from(document.querySelectorAll("style[data-barocss]"), (s) => s.sheet));
9572
9822
  const sheets = Array.from(document.styleSheets).filter((sheet) => {
9573
- if (own.has(sheet)) return false;
9823
+ if (own2.has(sheet)) return false;
9574
9824
  const owner = sheet.ownerNode;
9575
9825
  return !(owner && typeof owner.hasAttribute === "function" && (owner.hasAttribute("data-barocss") || (owner.id || "").startsWith(this.options.styleId)));
9576
9826
  });