|
|
|
@ -280,9 +280,7 @@ export default class ElementWrapper extends Wrapper {
|
|
|
|
(x`#nodes` as unknown) as Identifier
|
|
|
|
(x`#nodes` as unknown) as Identifier
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const previous_tag = block.get_unique_name('previous_tag');
|
|
|
|
|
|
|
|
const tag = this.node.tag_expr.manipulate(block);
|
|
|
|
const tag = this.node.tag_expr.manipulate(block);
|
|
|
|
block.add_variable(previous_tag, tag);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
block.chunks.init.push(b`
|
|
|
|
block.chunks.init.push(b`
|
|
|
|
${this.renderer.options.dev && b`@validate_dynamic_element(${tag});`}
|
|
|
|
${this.renderer.options.dev && b`@validate_dynamic_element(${tag});`}
|
|
|
|
@ -304,6 +302,11 @@ export default class ElementWrapper extends Wrapper {
|
|
|
|
if (${this.var}) ${this.var}.m(${parent_node || '#target'}, ${parent_node ? 'null' : '#anchor'});
|
|
|
|
if (${this.var}) ${this.var}.m(${parent_node || '#target'}, ${parent_node ? 'null' : '#anchor'});
|
|
|
|
`);
|
|
|
|
`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.node.tag_expr.dynamic_dependencies().length == 0) {
|
|
|
|
|
|
|
|
block.chunks.update.push(b`if (${this.var}) ${this.var}.p(#ctx, #dirty)`);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
const previous_tag = block.get_unique_name('previous_tag');
|
|
|
|
|
|
|
|
block.add_variable(previous_tag, tag);
|
|
|
|
const anchor = this.get_or_create_anchor(block, parent_node, parent_nodes);
|
|
|
|
const anchor = this.get_or_create_anchor(block, parent_node, parent_nodes);
|
|
|
|
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`;
|
|
|
|
@ -312,7 +315,6 @@ export default class ElementWrapper extends Wrapper {
|
|
|
|
if (has_transitions) {
|
|
|
|
if (has_transitions) {
|
|
|
|
block.add_variable(tag_will_be_removed, x`false`);
|
|
|
|
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}) {
|
|
|
|
@ -361,6 +363,7 @@ export default class ElementWrapper extends Wrapper {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
`);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.child_dynamic_element_block.has_intros) {
|
|
|
|
if (this.child_dynamic_element_block.has_intros) {
|
|
|
|
block.chunks.intro.push(b`@transition_in(${this.var});`);
|
|
|
|
block.chunks.intro.push(b`@transition_in(${this.var});`);
|
|
|
|
|