Skip to content

Commit

Permalink
fix(preset-typography): allow applying not-prose as parent selector (
Browse files Browse the repository at this point in the history
  • Loading branch information
ydcjeff committed Jun 29, 2022
1 parent 47a861d commit 745796b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions packages/preset-typography/src/preflights/index.ts
Expand Up @@ -11,6 +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} *`

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

css += '{'
Expand Down

0 comments on commit 745796b

Please sign in to comment.