File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,14 @@ export function classify(
1616 const token = raw . trim ( ) ;
1717 if ( ! token ) return { bucket : Bucket . Mod , processed : '' } ;
1818
19+ // Quoted string literals should be treated as value tokens (e.g., "" for content)
20+ if (
21+ ( token . startsWith ( '"' ) && token . endsWith ( '"' ) ) ||
22+ ( token . startsWith ( "'" ) && token . endsWith ( "'" ) )
23+ ) {
24+ return { bucket : Bucket . Value , processed : token } ;
25+ }
26+
1927 // 0. Direct var(--*-color) token
2028 const varColorMatch = token . match ( / ^ v a r \( - - ( [ a - z 0 - 9 - ] + ) - c o l o r \) $ / ) ;
2129 if ( varColorMatch ) {
Original file line number Diff line number Diff line change @@ -173,4 +173,17 @@ describe('StyleProcessor', () => {
173173 const r = parser . process ( '#dark-02' ) ;
174174 expect ( r . groups [ 0 ] . colors ) . toEqual ( [ 'var(--dark-02-color)' ] ) ;
175175 } ) ;
176+
177+ test ( 'parses empty string literal' , ( ) => {
178+ const res = parser . process ( '""' ) ;
179+ expect ( res . groups [ 0 ] . values ) . toEqual ( [ '""' ] ) ;
180+ } ) ;
181+
182+ test ( 'parses calc with custom props inside parentheses' , ( ) => {
183+ const expr = '(@slider-range-end - @slider-range-start)' ;
184+ const res = parser . process ( expr ) ;
185+ expect ( res . groups [ 0 ] . values ) . toEqual ( [
186+ 'calc(var(--slider-range-end) - var(--slider-range-start))' ,
187+ ] ) ;
188+ } ) ;
176189} ) ;
You can’t perform that action at this time.
0 commit comments