tailwindcss/packages
Robin Malfait 8e97a48357
Discard invalid classes such as bg-red-[#000] (#13970)
* add test that verifies that parsing `bg-red-[#0088cc]` should not work

* improve parsing of arbitrary values, root is known

When using arbitrary values such as `bg-[#0088cc]` then we know that
everything before the `-[` part is the `root` of the utility. This also
means that this should exist in the design system as-is.

If we use `findRoot` instead, it means that `bg-red-[#0088cc]` would
also just parse fine and we don't want.

* small refactor: define `important` and `negative` directly

It's not necessary to track state in a state object. Let's use the
variables directly.

* small refactor: use return on same line for consistency

* add test that verifies that parsing `bg-` should not work

* move `value === ''` check up

The value doesn't change anymore, which means we can discard early and
don't need to start creating candidate objects.

* adjust comment with example

* update changelog
2024-07-10 10:01:23 +02:00
..
@tailwindcss-cli Prep next release: 4.0.0-alpha.17 (#13951) 2024-07-04 19:08:10 +02:00
@tailwindcss-postcss Prep next release: 4.0.0-alpha.17 (#13951) 2024-07-04 19:08:10 +02:00
@tailwindcss-vite Prep next release: 4.0.0-alpha.17 (#13951) 2024-07-04 19:08:10 +02:00
tailwindcss Discard invalid classes such as bg-red-[#000] (#13970) 2024-07-10 10:01:23 +02:00
tsconfig.base.json introduce v4 codebase 2024-03-05 14:29:15 +01:00