@@ -3,11 +3,10 @@ use crate::extract_style::extract_dynamic_style::ExtractDynamicStyle;
33use crate :: extract_style:: extract_static_style:: ExtractStaticStyle ;
44use crate :: extract_style:: extract_style_value:: ExtractStyleValue ;
55use crate :: stylex:: {
6- SelectorPart , StylexIncludeRef , decompose_value_conditions, format_number,
7- is_first_that_works_call, is_include_call_static, is_types_call, is_unitless_property,
8- normalize_stylex_property,
6+ SelectorPart , StylexIncludeRef , decompose_value_conditions, is_first_that_works_call,
7+ is_include_call_static, is_types_call, normalize_stylex_property,
98} ;
10- use crate :: utils:: { get_number_by_literal_expression , get_string_by_literal_expression} ;
9+ use crate :: utils:: get_string_by_literal_expression;
1110use css:: optimize_value:: optimize_value;
1211use css:: sheet_to_variable_name;
1312use oxc_ast:: AstBuilder ;
@@ -203,12 +202,6 @@ pub fn extract_stylex_namespace_styles<'a>(
203202 // Phase 1: static string/number values
204203 let css_value = if let Some ( s) = get_string_by_literal_expression ( & style_prop. value ) {
205204 s
206- } else if let Some ( n) = get_number_by_literal_expression ( & style_prop. value ) {
207- if is_unitless_property ( & css_property) || n == 0.0 {
208- format_number ( n)
209- } else {
210- format ! ( "{}px" , format_number( n) )
211- }
212205 } else if matches ! ( & style_prop. value, Expression :: ObjectExpression ( _) ) {
213206 // Phase 2: value-level conditions
214207 for decomposed in decompose_value_conditions ( & css_property, & style_prop. value , & [ ] )
@@ -245,22 +238,6 @@ pub fn extract_stylex_namespace_styles<'a>(
245238 layer : None ,
246239 } ,
247240 ) ) ) ;
248- } else if let Some ( n) = get_number_by_literal_expression ( arg_expr) {
249- let formatted = if is_unitless_property ( & css_property) || n == 0.0 {
250- format_number ( n)
251- } else {
252- format ! ( "{}px" , format_number( n) )
253- } ;
254- styles. push ( ExtractStyleProp :: Static ( ExtractStyleValue :: Static (
255- ExtractStaticStyle {
256- property : css_property. clone ( ) ,
257- value : optimize_value ( & formatted) ,
258- level : 0 ,
259- selector : None ,
260- style_order : None ,
261- layer : None ,
262- } ,
263- ) ) ) ;
264241 }
265242 }
266243 continue ;
@@ -272,12 +249,6 @@ pub fn extract_stylex_namespace_styles<'a>(
272249 let inner = call. arguments [ 0 ] . to_expression ( ) ;
273250 let css_value = if let Some ( s) = get_string_by_literal_expression ( inner) {
274251 s
275- } else if let Some ( n) = get_number_by_literal_expression ( inner) {
276- if is_unitless_property ( & css_property) || n == 0.0 {
277- format_number ( n)
278- } else {
279- format ! ( "{}px" , format_number( n) )
280- }
281252 } else {
282253 continue ; // Can't resolve inner value
283254 } ;
@@ -420,12 +391,6 @@ fn extract_stylex_dynamic_namespace<'a>(
420391 }
421392 let css_value = if let Some ( s) = get_string_by_literal_expression ( & prop. value ) {
422393 s
423- } else if let Some ( n) = get_number_by_literal_expression ( & prop. value ) {
424- if is_unitless_property ( & css_property) || n == 0.0 {
425- format_number ( n)
426- } else {
427- format ! ( "{}px" , format_number( n) )
428- }
429394 } else {
430395 continue ;
431396 } ;
0 commit comments