Add * variant for targeting direct children (#12551)
* add `*` as child variant * add `*` as allowed variant character * update test to reflect Lightning CSS output * add `childVariant` test * Update changelog --------- Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com> Co-authored-by: Robin Malfait <malfait.robin@gmail.com> Co-authored-by: Gregor Kaczmarczyk <github@aggreggator.de>
This commit is contained in:
parent
7642e28cfe
commit
47dbb4a2b3
5 changed files with 49 additions and 1 deletions
|
|
@ -25,6 +25,9 @@ import { normalize } from './util/dataTypes'
|
|||
import { INTERNAL_FEATURES } from './lib/setupContextUtils'
|
||||
|
||||
export let variantPlugins = {
|
||||
childVariant: ({ addVariant }) => {
|
||||
addVariant('*', '& > *')
|
||||
},
|
||||
pseudoElementVariants: ({ addVariant }) => {
|
||||
addVariant('first-letter', '&::first-letter')
|
||||
addVariant('first-line', '&::first-line')
|
||||
|
|
|
|||
|
|
@ -756,6 +756,7 @@ function resolvePlugins(context, root) {
|
|||
// TODO: This is a workaround for backwards compatibility, since custom variants
|
||||
// were historically sorted before screen/stackable variants.
|
||||
let beforeVariants = [
|
||||
variantPlugins['childVariant'],
|
||||
variantPlugins['pseudoElementVariants'],
|
||||
variantPlugins['pseudoClassVariants'],
|
||||
variantPlugins['hasVariants'],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue