(
props: Element["props"],
className: string,
globalOperators: Set<string>,
)
| 370 | } |
| 371 | |
| 372 | private normalizeSelectorList( |
| 373 | props: Element["props"], |
| 374 | className: string, |
| 375 | globalOperators: Set<string>, |
| 376 | ): { selectors: string[]; touched: boolean } { |
| 377 | const selectors: string[] = []; |
| 378 | const scopedPrefix = new RegExp(`^\\.${Sheet.escapeRegExp(className)}\\s*`); |
| 379 | let touched = false; |
| 380 | |
| 381 | for (const entry of Sheet.toArray(props)) { |
| 382 | for (const selector of entry.split(",").map((s) => s.trim())) { |
| 383 | if (!selector) { |
| 384 | continue; |
| 385 | } |
| 386 | |
| 387 | if (!selector.includes(":global")) { |
| 388 | selectors.push(selector); |
| 389 | continue; |
| 390 | } |
| 391 | |
| 392 | touched = true; |
| 393 | |
| 394 | const inners: string[] = []; |
| 395 | const body = unwrapGlobalOperator(selector, inners); |
| 396 | const cleaned = normalizeWhitespace( |
| 397 | inners.some((inner) => globalOperators.has(inner)) |
| 398 | ? body |
| 399 | : body.replace(scopedPrefix, ""), |
| 400 | ); |
| 401 | |
| 402 | if (cleaned) { |
| 403 | selectors.push(cleaned); |
| 404 | } |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | return { selectors, touched }; |
| 409 | } |
| 410 | |
| 411 | getCSS(): string { |
| 412 | this.removeDuplicates(); |
no test coverage detected