tailwindcss/packages
Robin Malfait 28d526859d
Collapse more utilities by expanding their declarations (#19842)
This PR adds more declaration expansions such that we can collapse more
utilities.

While testing #19837 I noticed that in my tests some utilities weren't
canonicalized correctly. As part of that PR, we check for
`parsedCandidate.value === null`, which means that a functional utility
without a value is skipped. We do have utilities like that such as
`border` (which is equivalent to `border-1`). But while testing, I
noticed that `border-x border-y` should collapse to `border` but they
didn't. This PR fixes that.

By expanding these properties to their long-form physical properties
(instead of the shorter logical properties) we make the signatures of
utilities a bit bigger, but also more correct such that we can collapse
the physical form into logical utilities.

To make this more concrete, this PR allows for the following
canonicalizations now:

| Input | Output |
| --- | --- |
| `border-t-123 border-r-123 border-b-123 border-l-123` | `border-123` |
| `border-t-1 border-r-1 border-b-1 border-l-1` | `border` |
| `border-t-123 border-b-123` | `border-y-123` |
| `border-l-123 border-r-123` | `border-x-123` |
| `border-t-red-500 border-r-red-500 border-b-red-500 border-l-red-500`
| `border-red-500` |
| `border-t-red-500 border-b-red-500` | `border-y-red-500` |
| `border-l-red-500 border-r-red-500` | `border-x-red-500` |
| `scroll-mt-123 scroll-mr-123 scroll-mb-123 scroll-ml-123` |
`scroll-m-123` |
| `scroll-mt-123 scroll-mb-123` | `scroll-my-123` |
| `scroll-ml-123 scroll-mr-123` | `scroll-mx-123` |
| `scroll-pt-123 scroll-pr-123 scroll-pb-123 scroll-pl-123` |
`scroll-p-123` |
| `scroll-pt-123 scroll-pb-123` | `scroll-py-123` |
| `scroll-pl-123 scroll-pr-123` | `scroll-px-123` |
| `overflow-x-hidden overflow-y-hidden` | `overflow-hidden` |
| `overscroll-x-contain overscroll-y-contain` | `overscroll-contain` |

## Test plan

1. Existing tests pass
2. Added a few more tests to verify that these canonicalizations work
2026-03-23 15:33:44 +01:00
..
@tailwindcss-browser 4.2.2 (#19821) 2026-03-18 11:44:08 -04:00
@tailwindcss-cli 4.2.2 (#19821) 2026-03-18 11:44:08 -04:00
@tailwindcss-node 4.2.2 (#19821) 2026-03-18 11:44:08 -04:00
@tailwindcss-postcss 4.2.2 (#19821) 2026-03-18 11:44:08 -04:00
@tailwindcss-standalone 4.2.2 (#19821) 2026-03-18 11:44:08 -04:00
@tailwindcss-upgrade 4.2.2 (#19821) 2026-03-18 11:44:08 -04:00
@tailwindcss-vite fix(vite): resolve tsconfig paths in CSS and JS resolvers (#19803) 2026-03-20 15:19:18 +00:00
@tailwindcss-webpack Fix webpack loader cache key for resource queries (#19723) 2026-03-20 16:34:11 +00:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Collapse more utilities by expanding their declarations (#19842) 2026-03-23 15:33:44 +01:00
tsconfig.base.json Improve debug logs (#15303) 2024-12-11 15:27:20 +01:00