File tree 2 files changed +76
-0
lines changed
2 files changed +76
-0
lines changed Original file line number Diff line number Diff line change @@ -3398,6 +3398,38 @@ describe('@variant', () => {
3398
3398
background : white;
3399
3399
}
3400
3400
}
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
+ }
3401
3433
` ,
3402
3434
[ ] ,
3403
3435
) ,
@@ -3410,6 +3442,38 @@ describe('@variant', () => {
3410
3442
.btn {
3411
3443
background: #fff;
3412
3444
}
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
+ }
3413
3477
}"
3414
3478
` )
3415
3479
} )
Original file line number Diff line number Diff line change @@ -243,6 +243,11 @@ async function parseCss(
243
243
return WalkAction . Stop
244
244
}
245
245
} )
246
+
247
+ // No `@slot` found, so this is still a regular `@variant` at-rule
248
+ if ( node . name === '@variant' ) {
249
+ variantNodes . push ( node )
250
+ }
246
251
}
247
252
}
248
253
@@ -428,6 +433,13 @@ async function parseCss(
428
433
replaceWith ( node . nodes )
429
434
}
430
435
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
+
431
443
return WalkAction . Skip
432
444
}
433
445
You can’t perform that action at this time.
0 commit comments