tailwindcss/packages
Robin Malfait bb2f170514
Improve canonicalization for bare values exceeding default spacing scale suggestions (#19809)
This PR adds support for canonicalization of utilities that accept bare
values and exceed the default spacing scale we use for intellisense.

Right now, all utilities are behind functions, so the only way to know
whether something compiles is by compiling a candidate, e.g. `w-8` and
passing it to the utility functions. To help us, we use the intellisense
APIs that we use for suggestions.

Most utilities that accept bare values, have suggestions up until
`*-96`, so `w-96 h-96` would be canonicalized to `size-96`. But the
moment we exceed that, the result stays as-is.
```
→ w-96 h-96
= size-96

→ w-1234 h-1234
= h-1234 w-1234
```

This PR ensures that the last scenario also gets canonicalized to
`size-1234` instead of staying as `h-1234 w-1234`.

```
→ w-96 h-96
= size-96

→ w-1234 h-1234
= size-1234
```

## Test plan

1. Existing tests pass
2. Added new tests for utilities with bare values

[ci-all] just to see if this additional logic doesn't cause timeouts in
CI for WIndows. In my testing this doesn't have a significant impact on
performance at all.
2026-03-16 22:44:29 +01:00
..
@tailwindcss-browser 4.2.1 (#19714) 2026-02-23 11:45:12 +01:00
@tailwindcss-cli Add --stream flag to canonicalize subcommand (#19796) 2026-03-16 15:00:11 +00:00
@tailwindcss-node Cleanup inconsistencies related to (regex) escapes (#19804) 2026-03-15 22:04:58 +01:00
@tailwindcss-postcss Cleanup inconsistencies related to (regex) escapes (#19804) 2026-03-15 22:04:58 +01:00
@tailwindcss-standalone 4.2.1 (#19714) 2026-02-23 11:45:12 +01:00
@tailwindcss-upgrade fix: remove unused braces dependencies (#19797) 2026-03-15 21:10:54 +00:00
@tailwindcss-vite Cleanup inconsistencies related to (regex) escapes (#19804) 2026-03-15 22:04:58 +01:00
@tailwindcss-webpack 4.2.1 (#19714) 2026-02-23 11:45:12 +01:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Improve canonicalization for bare values exceeding default spacing scale suggestions (#19809) 2026-03-16 22:44:29 +01:00
tsconfig.base.json Improve debug logs (#15303) 2024-12-11 15:27:20 +01:00