tailwindcss/packages
Robin Malfait dd3441bf82
Add new in-* variant (#15025)
This PR adds a new `in-*` variant that allows you to apply utilities
when you are in a certain selector.

While doing research for codemods, we notice that some people use
`group-[]:flex` (yep, the arbitrary value is empty…). The idea behind is
that people want to know if you are in a `.group` or not.

Similarly, some people use `group-[]/name:flex` to know when you are in
a `.group/name` class or not.

This new `in-*` variant allows you to do that without any hacks.

If you want to check whether you are inside of a `p` tag, then you can
write `in-[p]:flex`. If you want to check that you are inside of a
`.group`, you can write `in-[.group]`.

This variant is also a compound variant, which means that you can write
`in-data-visible:flex` which generates the following CSS:
```css
:where([data-visible]) .in-data-visible\:flex {
  display: flex;
}
```

This variant also compounds with `not-*`, for example:
`not-in-[.group]:flex`.

Additionally, this PR also includes a codemod to convert `group-[]:flex`
to `in-[.group]:flex`.

---

This was proposed before for v3 in #13912

---------

Co-authored-by: Eloy Espinaco <eloyesp@gmail.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-11-18 15:28:16 +00:00
..
@tailwindcss-cli Ensure clients pin the tailwindcss version (#15011) 2024-11-15 17:18:48 +01:00
@tailwindcss-node Ensure clients pin the tailwindcss version (#15011) 2024-11-15 17:18:48 +01:00
@tailwindcss-postcss Ensure clients pin the tailwindcss version (#15011) 2024-11-15 17:18:48 +01:00
@tailwindcss-standalone Prepare v4.0.0-alpha.34 (#15002) 2024-11-14 18:23:40 +01:00
@tailwindcss-upgrade Add new in-* variant (#15025) 2024-11-18 15:28:16 +00:00
@tailwindcss-vite Ensure clients pin the tailwindcss version (#15011) 2024-11-15 17:18:48 +01:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Add new in-* variant (#15025) 2024-11-18 15:28:16 +00:00
tsconfig.base.json introduce v4 codebase 2024-03-05 14:29:15 +01:00