tailwindcss/packages
Robin Malfait e566a926e7
--default(…) should emit values as-is (#20392)
This PR fixes an issue where the `--default(…)` function that can be
used as part of `@utility` definitions goes through the same
pre-processing treatment as `--value(…)` and `--modifier(…)`.

Instead the `--default(…)` value should be emitted as-is.

The pre-processing treatment that's in place today is just to normalize
the value(s) that could be formatted in a strange way if you are dealing
with older Prettier / Biome versions.

Some of the transformations we do ahead of time:

- `--value(--spacing)`                 -> `--value(--spacing-*)`
- `--value(--spacing- *)`              -> `--value(--spacing-*)`
- `--value(--text- * --line-height)` -> `--value(--text-*--line-height)`
- `--value(--text --line-height)` -> `--value(--text-*--line-height)`
- `--value(--text-\\* --line-height)` ->
`--value(--text-*--line-height)`
- `--value([ *])`                      -> `--value([*])`


One of these steps is getting rid of the spaces, that means that if your
`--default(…)` uses spaces, then we will get rid of it.

```css
@theme inline {
  --text-box-trim-start: trim-start;
  --text-box-trim-end: trim-end;
  --text-box-trim-both: trim-both;

  --text-box-edge-cap: cap alphabetic;
  --text-box-edge-cap-text: cap text;
  --text-box-edge-ex: ex alphabetic;
  --text-box-edge-ex-text: ex text;
  --text-box-edge-text: text alphabetic;
  --text-box-edge-text-text: text text;
}
@utility trim-* {
  text-box: --value('normal', 'inherit', 'initial', 'revert', 'revert-layer', 'unset');
  text-box: --value(--text-box-trim-*) --modifier(--text-box-edge-*, --default(box alphabetic));
}
```

When you try to use this:

```html
<div className="trim-both" />
```

Then we get the following CSS out:
```css
.trim-both {
 text-box: trim-both boxalphabetic;
}
```

This PR fixes that, and now the proper CSS will be emitted:
```css
.trim-both {
 text-box: trim-both box alphabetic;
}
```

Fixes: #20391

## Test plan

1. Added an regression test to make sure that `--default(…)` values are
emitted as-is.
2026-08-06 15:25:48 +02:00
..
@tailwindcss-browser Bump dependencies (#20381) 2026-08-04 13:55:03 +02:00
@tailwindcss-cli Bump dependencies (#20381) 2026-08-04 13:55:03 +02:00
@tailwindcss-node Bump dependencies (#20381) 2026-08-04 13:55:03 +02:00
@tailwindcss-postcss Bump dependencies (#20381) 2026-08-04 13:55:03 +02:00
@tailwindcss-standalone Bump dependencies (#20381) 2026-08-04 13:55:03 +02:00
@tailwindcss-turbopack Add Turbopack loader integration coverage 2026-07-31 15:13:38 +02:00
@tailwindcss-upgrade Bump dependencies (#20381) 2026-08-04 13:55:03 +02:00
@tailwindcss-vite Prevent @tailwindcss/vite crash under Vite's experimental bundledDev (#20379) 2026-08-03 15:10:06 +02:00
@tailwindcss-webpack 4.3.3 (#20334) 2026-07-16 07:21:50 -04:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss --default(…) should emit values as-is (#20392) 2026-08-06 15:25:48 +02:00
tsconfig.base.json Improve debug logs (#15303) 2024-12-11 15:27:20 +01:00