@@ -26,8 +26,7 @@ export function modernizeArbitraryValues(
2626 // Expecting a single selector node
2727 if ( ast . nodes . length !== 1 ) continue
2828
29- // Track whether we need to add a `*:` variant
30- let addStarVariant = false
29+ let prefixedVariant : Variant | null = null
3130
3231 // Track whether we need to add a `**:` variant
3332 let addStarStarVariant = false
@@ -46,7 +45,7 @@ export function modernizeArbitraryValues(
4645 ast . nodes [ 0 ] . nodes [ 2 ] . type === 'attribute'
4746 ) {
4847 ast . nodes [ 0 ] . nodes = [ ast . nodes [ 0 ] . nodes [ 2 ] ]
49- addStarVariant = true
48+ prefixedVariant = designSystem . parseVariant ( '*' )
5049 }
5150
5251 // Handling a grand child combinator. E.g.: `[&_[data-visible]]` => `**:data-visible`
@@ -63,7 +62,7 @@ export function modernizeArbitraryValues(
6362 ast . nodes [ 0 ] . nodes [ 2 ] . type === 'attribute'
6463 ) {
6564 ast . nodes [ 0 ] . nodes = [ ast . nodes [ 0 ] . nodes [ 2 ] ]
66- addStarStarVariant = true
65+ prefixedVariant = designSystem . parseVariant ( '**' )
6766 }
6867
6968 // Filter out `&`. E.g.: `&[data-foo]` => `[data-foo]`
@@ -252,20 +251,12 @@ export function modernizeArbitraryValues(
252251 }
253252 }
254253
255- if ( addStarVariant ) {
254+ if ( prefixedVariant ) {
256255 let idx = clone . variants . indexOf ( variant )
257256 if ( idx === - 1 ) continue
258257
259- // Ensure we have the `*:` variant
260- clone . variants . splice ( idx , 1 , variant , { kind : 'static' , root : '*' } )
261- }
262-
263- if ( addStarStarVariant ) {
264- let idx = clone . variants . indexOf ( variant )
265- if ( idx === - 1 ) continue
266-
267- // Ensure we have the `**:` variant
268- clone . variants . splice ( idx , 1 , variant , { kind : 'static' , root : '**' } )
258+ // Ensure we inject the prefixed variant
259+ clone . variants . splice ( idx , 1 , variant , prefixedVariant )
269260 }
270261 }
271262
0 commit comments