styles-update

This commit is contained in:
Rogelio
2025-10-23 05:59:44 +00:00
parent b60b35cad4
commit 127413b971
1685 changed files with 272410 additions and 5731 deletions

View File

@@ -0,0 +1,26 @@
import parser from 'postcss-selector-parser'
import { movePseudos } from './pseudoElements'
export function applyImportantSelector(selector, important) {
let sel = parser().astSync(selector)
sel.each((sel) => {
// For nesting, we only need to wrap a selector with :is() if it has a top-level combinator,
// e.g. `.dark .text-white`, to be independent of DOM order. Any other selector, including
// combinators inside of pseudos like `:where()`, are ok to nest.
let shouldWrap = sel.nodes.some((node) => node.type === 'combinator')
if (shouldWrap) {
sel.nodes = [
parser.pseudo({
value: ':is',
nodes: [sel.clone()],
}),
]
}
movePseudos(sel)
})
return `${important} ${sel.toString()}`
}