MCPcopy
hub / github.com/tailwindlabs/tailwindcss / compoundsForSelectors

Function compoundsForSelectors

packages/tailwindcss/src/variants.ts:320–347  ·  packages/tailwindcss/src/variants.ts::compoundsForSelectors
(selectors: string[])

Source from the content-addressed store, hash-verified

318}
319
320export function compoundsForSelectors(selectors: string[]) {
321 let compounds = Compounds.Never
322
323 for (let sel of selectors) {
324 if (sel[0] === class="st">'@') {
325 class="cm">// Non-conditional at-rules are present so we can't compound
326 if (
327 !sel.startsWith(class="st">'@media') &&
328 !sel.startsWith(class="st">'@supports') &&
329 !sel.startsWith(class="st">'@container')
330 ) {
331 return Compounds.Never
332 }
333
334 compounds |= Compounds.AtRules
335 continue
336 }
337
338 class="cm">// Pseudo-elements are present so we can't compound
339 if (sel.includes(class="st">'::')) {
340 return Compounds.Never
341 }
342
343 compounds |= Compounds.StyleRules
344 }
345
346 return compounds
347}
348
349export function createVariants(theme: Theme): Variants {
350 class="cm">// In the future we may want to support returning a rule here if some complex

Callers 6

variants.test.tsFile · 0.90
parseCssFunction · 0.90
addVariantFunction · 0.90
fromAstMethod · 0.85
compoundsWithMethod · 0.85
staticVariantFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected