@@ -89,20 +89,33 @@ export function applyPrefix(input: string, prefix: string = '') {
8989 const prefixed : string [ ] = [ ]
9090 for ( const className of classNames ) {
9191 const [ variant , value , modifier ] = splitClassName ( className )
92+ const valueWithPrefix = handleNegativeVariants ( value , prefix )
9293 if ( variant ) {
9394 modifier
94- ? prefixed . push ( `${ variant } :${ prefix } ${ value } /${ modifier } ` )
95- : prefixed . push ( `${ variant } :${ prefix } ${ value } ` )
95+ ? prefixed . push ( `${ variant } :${ valueWithPrefix } /${ modifier } ` )
96+ : prefixed . push ( `${ variant } :${ valueWithPrefix } ` )
9697 }
9798 else {
9899 modifier
99- ? prefixed . push ( `${ prefix } ${ value } /${ modifier } ` )
100- : prefixed . push ( `${ prefix } ${ value } ` )
100+ ? prefixed . push ( `${ valueWithPrefix } /${ modifier } ` )
101+ : prefixed . push ( `${ valueWithPrefix } ` )
101102 }
102103 }
103104 return prefixed . join ( ' ' )
104105}
105106
107+ function handleNegativeVariants ( value : string | null , prefix : string = '' ) {
108+ if ( ! prefix || ! value ) {
109+ return value
110+ }
111+
112+ if ( value . startsWith ( '-' ) ) {
113+ return `-${ prefix } ${ value . substring ( 1 ) } `
114+ }
115+
116+ return `${ prefix } ${ value } `
117+ }
118+
106119export function applyPrefixesCss ( css : string , prefix : string ) {
107120 const lines = css . split ( '\n' )
108121 for ( const line of lines ) {
0 commit comments