Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(preset-typography)!: reduce specificity in prose selector #1185

Merged
merged 1 commit into from Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/preset-typography/src/preflights/index.ts
Expand Up @@ -11,7 +11,7 @@ function getCSS(
for (const selector in preflights) {
// @ts-expect-error preflights do not have definitive keys
const cssDeclarationBlock = preflights[selector]
const notProse = `.not-${selectorName},.not-${selectorName} *`
const notProseSelector = `:not(:where(.not-${selectorName},.not-${selectorName} *))`

// since pseudo class & elements can't be matched
// within single :where(), they are splitted and rejoined.
Expand All @@ -25,7 +25,7 @@ function getCSS(
if (match) {
const matchStr = match[0]
s = s.replace(matchStr, '')
return `${escapedSelector} :where(${s}):not(${notProse})${matchStr}`
return `${escapedSelector} :where(${s})${notProseSelector}${matchStr}`
}
return null
})
Expand All @@ -38,7 +38,7 @@ function getCSS(
}
else {
// directly from css declaration
css += `${escapedSelector} :where(${selector}):not(${notProse})`
css += `${escapedSelector} :where(${selector})${notProseSelector}`
}

css += '{'
Expand Down