@@ -18,6 +18,14 @@ export function modernizeArbitraryValues(
1818 _userConfig : Config ,
1919 rawCandidate : string ,
2020) : string {
21+ // Empty arbitrary values don't parse anymore. This is a little bit of a hack
22+ // to work around that behavior so we can still perform the migration:
23+ if ( rawCandidate . includes ( 'group-' ) ) {
24+ rawCandidate = rawCandidate . replaceAll ( '-[]:' , '-[--tw-custom-placeholder]:' ) // End of variant
25+ rawCandidate = rawCandidate . replaceAll ( '-[]/' , '-[--tw-custom-placeholder]/' ) // With modifier
26+ rawCandidate = rawCandidate . replaceAll ( '/[]:' , '/[--tw-custom-placeholder]:' ) // Empty modifier
27+ }
28+
2129 for ( let candidate of parseCandidate ( rawCandidate , designSystem ) ) {
2230 let clone = structuredClone ( candidate )
2331 let changed = false
@@ -43,7 +51,7 @@ export function modernizeArbitraryValues(
4351 variant . kind === 'compound' &&
4452 variant . root === 'group' &&
4553 variant . variant . kind === 'arbitrary' &&
46- variant . variant . selector === '&:is()'
54+ variant . variant . selector === '&:is(--tw-custom-placeholder )'
4755 ) {
4856 // `group-[]`
4957 if ( variant . modifier === null ) {
@@ -378,7 +386,16 @@ export function modernizeArbitraryValues(
378386 }
379387 }
380388
381- return changed ? printCandidate ( designSystem , clone ) : rawCandidate
389+ let newCandidate = changed ? printCandidate ( designSystem , clone ) : rawCandidate
390+
391+ // Empty arbitrary values don't parse anymore. This is a little bit of a hack
392+ // to work around that behavior so we can still perform the migration:
393+ if ( newCandidate . includes ( 'group-' ) ) {
394+ newCandidate = newCandidate . replaceAll ( '-[--tw-custom-placeholder]:' , '-[]:' ) // End of variant
395+ newCandidate = newCandidate . replaceAll ( '-[--tw-custom-placeholder]/' , '-[]/' ) // With modifier
396+ newCandidate = newCandidate . replaceAll ( '/[--tw-custom-placeholder]:' , '/[]:' ) // Empty modifier
397+ }
398+ return newCandidate
382399 }
383400
384401 return rawCandidate
0 commit comments