|
|
|
@ -308,40 +308,58 @@ export default class ElementWrapper extends Wrapper {
|
|
|
|
const has_transitions = !!(this.node.intro || this.node.outro);
|
|
|
|
const has_transitions = !!(this.node.intro || this.node.outro);
|
|
|
|
const not_equal = this.renderer.component.component_options.immutable ? x`@not_equal` : x`@safe_not_equal`;
|
|
|
|
const not_equal = this.renderer.component.component_options.immutable ? x`@not_equal` : x`@safe_not_equal`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const tag_will_be_removed = block.get_unique_name('tag_will_be_removed');
|
|
|
|
|
|
|
|
if (has_transitions) {
|
|
|
|
|
|
|
|
block.add_variable(tag_will_be_removed, x`false`);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
block.chunks.update.push(b`
|
|
|
|
block.chunks.update.push(b`
|
|
|
|
if (${tag}) {
|
|
|
|
if (${tag}) {
|
|
|
|
if (!${previous_tag}) {
|
|
|
|
if (!${previous_tag}) {
|
|
|
|
${this.var} = ${this.child_dynamic_element_block.name}(#ctx);
|
|
|
|
${this.var} = ${this.child_dynamic_element_block.name}(#ctx);
|
|
|
|
|
|
|
|
${previous_tag} = ${tag};
|
|
|
|
${this.var}.c();
|
|
|
|
${this.var}.c();
|
|
|
|
${has_transitions && b`@transition_in(${this.var})`}
|
|
|
|
${has_transitions && b`@transition_in(${this.var});`}
|
|
|
|
${this.var}.m(${this.get_update_mount_node(anchor)}, ${anchor});
|
|
|
|
${this.var}.m(${this.get_update_mount_node(anchor)}, ${anchor});
|
|
|
|
} else if (${not_equal}(${previous_tag}, ${tag})) {
|
|
|
|
} else if (${not_equal}(${previous_tag}, ${tag})) {
|
|
|
|
${this.var}.d(1);
|
|
|
|
${this.var}.d(1);
|
|
|
|
${this.renderer.options.dev && b`@validate_dynamic_element(${tag});`}
|
|
|
|
${this.renderer.options.dev && b`@validate_dynamic_element(${tag});`}
|
|
|
|
${this.renderer.options.dev && this.node.children.length > 0 && b`@validate_void_dynamic_element(${tag});`}
|
|
|
|
${this.renderer.options.dev && this.node.children.length > 0 && b`@validate_void_dynamic_element(${tag});`}
|
|
|
|
${this.var} = ${this.child_dynamic_element_block.name}(#ctx);
|
|
|
|
${this.var} = ${this.child_dynamic_element_block.name}(#ctx);
|
|
|
|
|
|
|
|
${previous_tag} = ${tag};
|
|
|
|
${this.var}.c();
|
|
|
|
${this.var}.c();
|
|
|
|
|
|
|
|
${has_transitions && b`if (${tag_will_be_removed}) {
|
|
|
|
|
|
|
|
${tag_will_be_removed} = false;
|
|
|
|
|
|
|
|
@transition_in(${this.var})
|
|
|
|
|
|
|
|
}`}
|
|
|
|
${this.var}.m(${this.get_update_mount_node(anchor)}, ${anchor});
|
|
|
|
${this.var}.m(${this.get_update_mount_node(anchor)}, ${anchor});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
${has_transitions && b`if (${tag_will_be_removed}) {
|
|
|
|
|
|
|
|
${tag_will_be_removed} = false;
|
|
|
|
|
|
|
|
@transition_in(${this.var})
|
|
|
|
|
|
|
|
}`}
|
|
|
|
${this.var}.p(#ctx, #dirty);
|
|
|
|
${this.var}.p(#ctx, #dirty);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (${previous_tag}) {
|
|
|
|
} else if (${previous_tag}) {
|
|
|
|
${
|
|
|
|
${
|
|
|
|
has_transitions
|
|
|
|
has_transitions
|
|
|
|
? b`
|
|
|
|
? b`
|
|
|
|
|
|
|
|
${tag_will_be_removed} = true;
|
|
|
|
@group_outros();
|
|
|
|
@group_outros();
|
|
|
|
@transition_out(${this.var}, 1, 1, () => {
|
|
|
|
@transition_out(${this.var}, 1, 1, () => {
|
|
|
|
${this.var} = null;
|
|
|
|
${this.var} = null;
|
|
|
|
|
|
|
|
${previous_tag} = ${tag};
|
|
|
|
|
|
|
|
${tag_will_be_removed} = false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@check_outros();
|
|
|
|
@check_outros();
|
|
|
|
`
|
|
|
|
`
|
|
|
|
: b`
|
|
|
|
: b`
|
|
|
|
${this.var}.d(1);
|
|
|
|
${this.var}.d(1);
|
|
|
|
${this.var} = null;
|
|
|
|
${this.var} = null;
|
|
|
|
|
|
|
|
${previous_tag} = ${tag};
|
|
|
|
`
|
|
|
|
`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
${previous_tag} = ${tag};
|
|
|
|
|
|
|
|
`);
|
|
|
|
`);
|
|
|
|
|
|
|
|
|
|
|
|
if (this.child_dynamic_element_block.has_intros) {
|
|
|
|
if (this.child_dynamic_element_block.has_intros) {
|
|
|
|
|