Skip to content

Commit

Permalink
fix(preset-typography)!: reduce specificity in prose selector (#1185)
Browse files Browse the repository at this point in the history
  • Loading branch information
ydcjeff committed Jun 30, 2022
1 parent a40b389 commit d27f5af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
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

0 comments on commit d27f5af

Please sign in to comment.