Robin Malfait 5ebd5896d7
Add support for custom variants via CSS (#13992)
* implement `@variant` in CSS

* implement `addVariant(name, objectTree)`

* update changelog

* ensure that `@variant` can only be used top-level

* simplify Plugin API type

* Use type instead of interface (for now)

* Use more realistic variant for test

* Allow custom properties to use `@slot` as content

* Use "cannot" instead of "can not"

* Remove `@variant` right away

* Throw when `@variant` is missing a selector or body

* Use "CSS-in-JS" terminology instead of "CSS Tree"

* Rename tests

* Mark some tests that seem wrong

* Tweak comment, remove unnecessary return

* Ensure group is usable with custom selector lists

* Only apply extra `:is(…)` when there are multiple selectors

* Tweak comment

* Throw when @variant has both selector and body

* Rework tests to use more realistic examples

* Compound variants on an isolated copy

This prevents traversals from leaking across variants

* Handle selector lists for peer variants

* Ignore at rules when compounding group and peer variants

* Re-enable skipped tests

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-07-16 16:23:23 -04:00
..
2024-03-05 14:29:15 +01:00