Skip to content

Commit

Permalink
Merge pull request tailwindlabs#4 from MichaelAllenWarner/not-pseudoc…
Browse files Browse the repository at this point in the history
…lass-variants

Add 'not-' variants for all pseudo-class variants
  • Loading branch information
MichaelAllenWarner authored Mar 28, 2022
2 parents e361b3a + a24f130 commit 7d9f6be
Show file tree
Hide file tree
Showing 3 changed files with 788 additions and 23 deletions.
24 changes: 24 additions & 0 deletions src/corePlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,30 @@ export let variantPlugins = {
return `:merge(.peer)${result} ~ &`
})
}

for (let [variantName, state] of pseudoVariants) {
addVariant(`not-${variantName}`, (ctx) => {
let result = typeof state === 'function' ? state(ctx) : state

return `&:not(${result})`
})
}

for (let [variantName, state] of pseudoVariants) {
addVariant(`group-not-${variantName}`, (ctx) => {
let result = typeof state === 'function' ? state(ctx) : state

return `:merge(.group):not(${result}) &`
})
}

for (let [variantName, state] of pseudoVariants) {
addVariant(`peer-not-${variantName}`, (ctx) => {
let result = typeof state === 'function' ? state(ctx) : state

return `:merge(.peer):not(${result}) ~ &`
})
}
},

directionVariants: ({ addVariant }) => {
Expand Down
Loading

0 comments on commit 7d9f6be

Please sign in to comment.