@@ -3,11 +3,11 @@ import { render_effect } from '../../reactivity/effects.js';
3
3
4
4
/**
5
5
* @param {HTMLDivElement | SVGGElement } element
6
- * @param {() => Record<string, string> } props
6
+ * @param {() => Record<string, string> } get_styles
7
7
* @param {(anchor: Element | Text | Comment) => any } component
8
8
* @returns {void }
9
9
*/
10
- export function css_props ( element , props , component ) {
10
+ export function css_props ( element , get_styles , component ) {
11
11
if ( hydrating ) {
12
12
set_hydrate_nodes (
13
13
/** @type {import('#client').TemplateNode[] } */ ( [ ...element . childNodes ] ) . slice ( 0 , - 1 )
@@ -17,23 +17,23 @@ export function css_props(element, props, component) {
17
17
component ( /** @type {Comment } */ ( element . lastChild ) ) ;
18
18
19
19
/** @type {Record<string, string> } */
20
- let current_props = { } ;
20
+ let styles = { } ;
21
21
22
22
render_effect ( ( ) => {
23
23
render_effect ( ( ) => {
24
- const next_props = props ( ) ;
24
+ const next = get_styles ( ) ;
25
25
26
- for ( const key in current_props ) {
27
- if ( ! ( key in next_props ) ) {
26
+ for ( const key in styles ) {
27
+ if ( ! ( key in next ) ) {
28
28
element . style . removeProperty ( key ) ;
29
29
}
30
30
}
31
31
32
- for ( const key in next_props ) {
33
- element . style . setProperty ( key , next_props [ key ] ) ;
32
+ for ( const key in next ) {
33
+ element . style . setProperty ( key , next [ key ] ) ;
34
34
}
35
35
36
- current_props = next_props ;
36
+ styles = next ;
37
37
} ) ;
38
38
39
39
return ( ) => {
0 commit comments