|
|
|
@ -161,7 +161,7 @@ export default class IfBlockWrapper extends Wrapper {
|
|
|
|
|
if (has_outros) {
|
|
|
|
|
this.render_compound_with_outros(block, parent_node, parent_nodes, dynamic, vars, detaching);
|
|
|
|
|
|
|
|
|
|
block.builders.outro.add_line(`if (${name}) ${name}.o();`);
|
|
|
|
|
block.builders.outro.add_line(`@transition_out(${name});`);
|
|
|
|
|
} else {
|
|
|
|
|
this.render_compound(block, parent_node, parent_nodes, dynamic, vars, detaching);
|
|
|
|
|
}
|
|
|
|
@ -169,7 +169,7 @@ export default class IfBlockWrapper extends Wrapper {
|
|
|
|
|
this.render_simple(block, parent_node, parent_nodes, dynamic, vars, detaching);
|
|
|
|
|
|
|
|
|
|
if (has_outros) {
|
|
|
|
|
block.builders.outro.add_line(`if (${name}) ${name}.o();`);
|
|
|
|
|
block.builders.outro.add_line(`@transition_out(${name});`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -182,7 +182,7 @@ export default class IfBlockWrapper extends Wrapper {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (has_intros || has_outros) {
|
|
|
|
|
block.builders.intro.add_line(`if (${name}) ${name}.i();`);
|
|
|
|
|
block.builders.intro.add_line(`@transition_in(${name});`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (needs_anchor) {
|
|
|
|
@ -239,7 +239,7 @@ export default class IfBlockWrapper extends Wrapper {
|
|
|
|
|
${name} = ${current_block_type_and}${current_block_type}(ctx);
|
|
|
|
|
if (${name}) {
|
|
|
|
|
${name}.c();
|
|
|
|
|
${has_transitions && `${name}.i(1);`}
|
|
|
|
|
${has_transitions && `@transition_in(${name}, 1);`}
|
|
|
|
|
${name}.m(${update_mount_node}, ${anchor});
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
@ -327,11 +327,9 @@ export default class IfBlockWrapper extends Wrapper {
|
|
|
|
|
|
|
|
|
|
const destroy_old_block = deindent`
|
|
|
|
|
@group_outros();
|
|
|
|
|
@on_outro(() => {
|
|
|
|
|
${if_blocks}[${previous_block_index}].d(1);
|
|
|
|
|
@transition_out(${if_blocks}[${previous_block_index}], 1, 1, () => {
|
|
|
|
|
${if_blocks}[${previous_block_index}] = null;
|
|
|
|
|
});
|
|
|
|
|
${name}.o(1);
|
|
|
|
|
@check_outros();
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
@ -341,7 +339,7 @@ export default class IfBlockWrapper extends Wrapper {
|
|
|
|
|
${name} = ${if_blocks}[${current_block_type_index}] = ${if_block_creators}[${current_block_type_index}](ctx);
|
|
|
|
|
${name}.c();
|
|
|
|
|
}
|
|
|
|
|
${has_transitions && `${name}.i(1);`}
|
|
|
|
|
${has_transitions && `@transition_in(${name}, 1);`}
|
|
|
|
|
${name}.m(${update_mount_node}, ${anchor});
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
@ -420,11 +418,11 @@ export default class IfBlockWrapper extends Wrapper {
|
|
|
|
|
? deindent`
|
|
|
|
|
if (${name}) {
|
|
|
|
|
${name}.p(changed, ctx);
|
|
|
|
|
${has_transitions && `${name}.i(1);`}
|
|
|
|
|
${has_transitions && `@transition_in(${name}, 1);`}
|
|
|
|
|
} else {
|
|
|
|
|
${name} = ${branch.block.name}(ctx);
|
|
|
|
|
${name}.c();
|
|
|
|
|
${has_transitions && `${name}.i(1);`}
|
|
|
|
|
${has_transitions && `@transition_in(${name}, 1);`}
|
|
|
|
|
${name}.m(${update_mount_node}, ${anchor});
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
@ -432,10 +430,10 @@ export default class IfBlockWrapper extends Wrapper {
|
|
|
|
|
if (!${name}) {
|
|
|
|
|
${name} = ${branch.block.name}(ctx);
|
|
|
|
|
${name}.c();
|
|
|
|
|
${has_transitions && `${name}.i(1);`}
|
|
|
|
|
${has_transitions && `@transition_in(${name}, 1);`}
|
|
|
|
|
${name}.m(${update_mount_node}, ${anchor});
|
|
|
|
|
${has_transitions && `} else {
|
|
|
|
|
${name}.i(1);`}
|
|
|
|
|
@transition_in(${name}, 1);`}
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
@ -449,12 +447,9 @@ export default class IfBlockWrapper extends Wrapper {
|
|
|
|
|
} else if (${name} && !${outroing}) {
|
|
|
|
|
${outroing} = true;
|
|
|
|
|
@group_outros();
|
|
|
|
|
@on_outro(() => {
|
|
|
|
|
${name}.d(1);
|
|
|
|
|
@transition_out(${name}, 1, 1, () => {
|
|
|
|
|
${name} = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
${name}.o(1);
|
|
|
|
|
@check_outros();
|
|
|
|
|
}
|
|
|
|
|
`);
|
|
|
|
|