@@ -8,7 +8,7 @@ use oxc_ast::ast::{
88use std:: collections:: BTreeMap ;
99
1010use crate :: extract_style:: ExtractStyleValue :: { Dynamic , Static , Typography } ;
11- use crate :: extract_style:: { ExtractDynamicStyle , ExtractStaticStyle , ExtractStyleValue } ;
11+ use crate :: extract_style:: { ExtractDynamicStyle , ExtractStaticStyle } ;
1212use oxc_ast:: AstBuilder ;
1313use oxc_span:: SPAN ;
1414use oxc_syntax:: operator:: { BinaryOperator , LogicalOperator , UnaryOperator } ;
@@ -280,44 +280,42 @@ pub fn extract_style_from_expression<'a>(
280280 selector. map( |s| s. into( ) ) ,
281281 ) )
282282 } ) ] )
283+ } else if typo {
284+ ExtractResult :: ExtractStyle ( vec ! [ ExtractStyleProp :: Expression {
285+ expression: ast_builder. expression_template_literal(
286+ SPAN ,
287+ ast_builder. vec_from_array( [
288+ ast_builder. template_element(
289+ SPAN ,
290+ false ,
291+ TemplateElementValue {
292+ raw: ast_builder. atom( "typo-" ) ,
293+ cooked: None ,
294+ } ,
295+ ) ,
296+ ast_builder. template_element(
297+ SPAN ,
298+ true ,
299+ TemplateElementValue {
300+ raw: ast_builder. atom( "" ) ,
301+ cooked: None ,
302+ } ,
303+ ) ,
304+ ] ) ,
305+ ast_builder
306+ . vec_from_array( [ expression. clone_in( ast_builder. allocator) ] ) ,
307+ ) ,
308+ styles: vec![ ] ,
309+ } ] )
283310 } else {
284- if typo {
285- ExtractResult :: ExtractStyle ( vec ! [ ExtractStyleProp :: Expression {
286- expression: ast_builder. expression_template_literal(
287- SPAN ,
288- ast_builder. vec_from_array( [
289- ast_builder. template_element(
290- SPAN ,
291- false ,
292- TemplateElementValue {
293- raw: ast_builder. atom( "typo-" ) ,
294- cooked: None ,
295- } ,
296- ) ,
297- ast_builder. template_element(
298- SPAN ,
299- true ,
300- TemplateElementValue {
301- raw: ast_builder. atom( "" ) ,
302- cooked: None ,
303- } ,
304- ) ,
305- ] ) ,
306- ast_builder
307- . vec_from_array( [ expression. clone_in( ast_builder. allocator) ] ) ,
308- ) ,
309- styles: vec![ ] ,
310- } ] )
311- } else {
312- ExtractResult :: ExtractStyle ( vec ! [ ExtractStyleProp :: Static ( Dynamic (
313- ExtractDynamicStyle :: new(
314- name,
315- level,
316- expression_to_code( expression) . as_str( ) ,
317- selector. map( |s| s. into( ) ) ,
318- ) ,
319- ) ) ] )
320- }
311+ ExtractResult :: ExtractStyle ( vec ! [ ExtractStyleProp :: Static ( Dynamic (
312+ ExtractDynamicStyle :: new(
313+ name,
314+ level,
315+ expression_to_code( expression) . as_str( ) ,
316+ selector. map( |s| s. into( ) ) ,
317+ ) ,
318+ ) ) ] )
321319 }
322320 } else {
323321 ExtractResult :: Maintain
0 commit comments