|
|
|
@ -15,27 +15,26 @@ export function css_props(anchor, is_html, props, component) {
|
|
|
|
|
hydrate_block_anchor(anchor);
|
|
|
|
|
|
|
|
|
|
/** @type {HTMLElement | SVGElement} */
|
|
|
|
|
let tag;
|
|
|
|
|
let element;
|
|
|
|
|
|
|
|
|
|
/** @type {Text | Comment} */
|
|
|
|
|
let component_anchor;
|
|
|
|
|
|
|
|
|
|
if (hydrating) {
|
|
|
|
|
// Hydration: css props element is surrounded by a ssr comment ...
|
|
|
|
|
tag = /** @type {HTMLElement | SVGElement} */ (hydrate_nodes[0]);
|
|
|
|
|
element = /** @type {HTMLElement | SVGElement} */ (hydrate_nodes[0]);
|
|
|
|
|
// ... and the child(ren) of the css props element is also surround by a ssr comment
|
|
|
|
|
component_anchor = /** @type {Comment} */ (tag.firstChild);
|
|
|
|
|
component_anchor = /** @type {Comment} */ (element.firstChild);
|
|
|
|
|
} else {
|
|
|
|
|
if (is_html) {
|
|
|
|
|
tag = document.createElement('div');
|
|
|
|
|
tag.style.display = 'contents';
|
|
|
|
|
element = document.createElement('div');
|
|
|
|
|
element.style.display = 'contents';
|
|
|
|
|
} else {
|
|
|
|
|
tag = document.createElementNS(namespace_svg, 'g');
|
|
|
|
|
element = document.createElementNS(namespace_svg, 'g');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
anchor.before(tag);
|
|
|
|
|
component_anchor = empty();
|
|
|
|
|
tag.appendChild(component_anchor);
|
|
|
|
|
anchor.before(element);
|
|
|
|
|
component_anchor = element.appendChild(empty());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
component(component_anchor);
|
|
|
|
@ -48,18 +47,18 @@ export function css_props(anchor, is_html, props, component) {
|
|
|
|
|
|
|
|
|
|
for (const key in current_props) {
|
|
|
|
|
if (!(key in next_props)) {
|
|
|
|
|
tag.style.removeProperty(key);
|
|
|
|
|
element.style.removeProperty(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const key in next_props) {
|
|
|
|
|
tag.style.setProperty(key, next_props[key]);
|
|
|
|
|
element.style.setProperty(key, next_props[key]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current_props = next_props;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
effect.ondestroy = () => {
|
|
|
|
|
remove(tag);
|
|
|
|
|
remove(element);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|