@@ -74,7 +74,8 @@ function serialize_style_directives(style_directives, element_id, context, is_at
74
74
directive . value === true
75
75
? serialize_get_binding ( { name : directive . name , type : 'Identifier' } , context . state )
76
76
: serialize_attribute_value ( directive . value , context ) [ 1 ] ;
77
- const grouped = b . stmt (
77
+
78
+ const update = b . stmt (
78
79
b . call (
79
80
'$.style' ,
80
81
element_id ,
@@ -85,17 +86,6 @@ function serialize_style_directives(style_directives, element_id, context, is_at
85
86
)
86
87
)
87
88
) ;
88
- const singular = b . stmt (
89
- b . call (
90
- '$.style_effect' ,
91
- element_id ,
92
- b . literal ( directive . name ) ,
93
- b . arrow ( [ ] , value ) ,
94
- /** @type {import('estree').Expression } */ (
95
- directive . modifiers . includes ( 'important' ) ? b . true : undefined
96
- )
97
- )
98
- ) ;
99
89
100
90
const contains_call_expression =
101
91
Array . isArray ( directive . value ) &&
@@ -104,11 +94,11 @@ function serialize_style_directives(style_directives, element_id, context, is_at
104
94
) ;
105
95
106
96
if ( ! is_attributes_reactive && contains_call_expression ) {
107
- state . init . push ( singular ) ;
97
+ state . init . push ( serialize_update ( update ) ) ;
108
98
} else if ( is_attributes_reactive || directive . metadata . dynamic || contains_call_expression ) {
109
- state . update . push ( grouped ) ;
99
+ state . update . push ( update ) ;
110
100
} else {
111
- state . init . push ( grouped ) ;
101
+ state . init . push ( update ) ;
112
102
}
113
103
}
114
104
}
@@ -146,18 +136,15 @@ function serialize_class_directives(class_directives, element_id, context, is_at
146
136
const state = context . state ;
147
137
for ( const directive of class_directives ) {
148
138
const value = /** @type {import('estree').Expression } */ ( context . visit ( directive . expression ) ) ;
149
- const grouped = b . stmt ( b . call ( '$.class_toggle' , element_id , b . literal ( directive . name ) , value ) ) ;
150
- const singular = b . stmt (
151
- b . call ( '$.class_toggle_effect' , element_id , b . literal ( directive . name ) , b . arrow ( [ ] , value ) )
152
- ) ;
139
+ const update = b . stmt ( b . call ( '$.class_toggle' , element_id , b . literal ( directive . name ) , value ) ) ;
153
140
const contains_call_expression = directive . expression . type === 'CallExpression' ;
154
141
155
142
if ( ! is_attributes_reactive && contains_call_expression ) {
156
- state . init . push ( singular ) ;
143
+ state . init . push ( serialize_update ( update ) ) ;
157
144
} else if ( is_attributes_reactive || directive . metadata . dynamic || contains_call_expression ) {
158
- state . update . push ( grouped ) ;
145
+ state . update . push ( update ) ;
159
146
} else {
160
- state . init . push ( grouped ) ;
147
+ state . init . push ( update ) ;
161
148
}
162
149
}
163
150
}
0 commit comments