File tree Expand file tree Collapse file tree 2 files changed +76
-0
lines changed Expand file tree Collapse file tree 2 files changed +76
-0
lines changed Original file line number Diff line number Diff line change @@ -3398,6 +3398,38 @@ describe('@variant', () => {
33983398 background : white;
33993399 }
34003400 }
3401+
3402+ @variant hover {
3403+ @variant landscape {
3404+ .btn2 {
3405+ color : red;
3406+ }
3407+ }
3408+ }
3409+
3410+ @variant hover {
3411+ .foo {
3412+ color : red;
3413+ }
3414+ @variant landscape {
3415+ .bar {
3416+ color : blue;
3417+ }
3418+ }
3419+ .baz {
3420+ @variant portrait {
3421+ color : green;
3422+ }
3423+ }
3424+ }
3425+
3426+ @media something {
3427+ @variant landscape {
3428+ @page {
3429+ color : red;
3430+ }
3431+ }
3432+ }
34013433 ` ,
34023434 [ ] ,
34033435 ) ,
@@ -3410,6 +3442,38 @@ describe('@variant', () => {
34103442 .btn {
34113443 background: #fff;
34123444 }
3445+ }
3446+
3447+ @media (hover: hover) {
3448+ @media (orientation: landscape) {
3449+ :scope:hover .btn2 {
3450+ color: red;
3451+ }
3452+ }
3453+
3454+ :scope:hover .foo {
3455+ color: red;
3456+ }
3457+
3458+ @media (orientation: landscape) {
3459+ :scope:hover .bar {
3460+ color: #00f;
3461+ }
3462+ }
3463+
3464+ @media (orientation: portrait) {
3465+ :scope:hover .baz {
3466+ color: green;
3467+ }
3468+ }
3469+ }
3470+
3471+ @media something {
3472+ @media (orientation: landscape) {
3473+ @page {
3474+ color: red;
3475+ }
3476+ }
34133477 }"
34143478 ` )
34153479 } )
Original file line number Diff line number Diff line change @@ -243,6 +243,11 @@ async function parseCss(
243243 return WalkAction . Stop
244244 }
245245 } )
246+
247+ // No `@slot` found, so this is still a regular `@variant` at-rule
248+ if ( node . name === '@variant' ) {
249+ variantNodes . push ( node )
250+ }
246251 }
247252 }
248253
@@ -428,6 +433,13 @@ async function parseCss(
428433 replaceWith ( node . nodes )
429434 }
430435
436+ walk ( node . nodes , ( node ) => {
437+ if ( node . kind !== 'at-rule' ) return
438+ if ( node . name !== '@variant' ) return
439+
440+ variantNodes . push ( node )
441+ } )
442+
431443 return WalkAction . Skip
432444 }
433445
You can’t perform that action at this time.
0 commit comments