Revert "fix: css"

This reverts commit 234c2e2c65.
This commit is contained in:
Pujit Mehrotra
2025-10-28 10:02:28 -04:00
parent fd57e789db
commit 4b680e94ee
4 changed files with 60 additions and 37 deletions

View File

@@ -35,8 +35,7 @@ const DEFAULT_INCLUDE_ROOT = true;
const KEYFRAME_AT_RULES = new Set(['keyframes']);
const NON_SCOPED_AT_RULES = new Set(['font-face', 'page']);
const MERGE_WITH_SCOPE_PATTERNS: RegExp[] = [/^\.theme-/, /^\.has-custom-/, /^\.dark\b/, /^\.light\b/];
const ROOT_ELEMENT_PATTERN = /^(html|body)(?=$|[.#[:\s>+~])/;
const MERGE_WITH_SCOPE_PATTERNS: RegExp[] = [/^\.theme-/, /^\.has-custom-/, /^\.dark\b/];
function shouldScopeRule(rule: Rule, targetLayers: Set<string>, includeRootRules: boolean): boolean {
const hasSelectorString = typeof rule.selector === 'string' && rule.selector.length > 0;
@@ -105,12 +104,6 @@ function prefixSelector(selector: string, scope: string): string {
return trimmed;
}
const rootElementMatch = trimmed.match(ROOT_ELEMENT_PATTERN);
if (rootElementMatch) {
const suffix = trimmed.slice(rootElementMatch[0].length);
return suffix ? `${scope}${suffix}` : scope;
}
if (trimmed === ':root') {
return scope;
}