argh so close

pull/3046/head
Richard Harris 6 years ago
parent 42c2ce1065
commit 74d5e72f18

@ -424,7 +424,7 @@ export default class InlineComponentWrapper extends Wrapper {
@group_outros();
const old_component = ${name};
@transition_out(old_component.$$.fragment, 1, 1, () => {
@destroy(old_component);
@destroy_component(old_component);
});
@check_outros();
}
@ -457,10 +457,10 @@ export default class InlineComponentWrapper extends Wrapper {
}
block.builders.outro.add_line(
`if (${name}) @transition_out(${name}.$$.fragment, #local);`
`if (${name}) @transition_out(${name}.$$.fragment, 0, #local);`
);
block.builders.destroy.add_line(`if (${name}) ${name}.$destroy(${parent_node ? '' : 'detaching'});`);
block.builders.destroy.add_line(`if (${name}) @destroy_component(${name}, ${parent_node ? '' : 'detaching'});`);
} else {
const expression = this.node.name === 'svelte:self'
? '__svelte:self__' // TODO conflict-proof this
@ -500,7 +500,7 @@ export default class InlineComponentWrapper extends Wrapper {
}
block.builders.destroy.add_block(deindent`
${name}.$destroy(${parent_node ? '' : 'detaching'});
@destroy_component(${name}, ${parent_node ? '' : 'detaching'});
`);
block.builders.outro.add_line(

@ -146,7 +146,7 @@ export default class SlotWrapper extends Wrapper {
);
block.builders.outro.add_line(
`@transition_out(${slot}, #local);`
`@transition_out(${slot}, 0, #local);`
);
let update_conditions = [...this.dependencies].map(name => `changed.${name}`).join(' || ');

@ -50,10 +50,12 @@ export function mount_component(component, target, anchor) {
after_render.forEach(add_render_callback);
}
export function destroy(component) {
export function destroy_component(component, detaching) {
if (component.$$) {
run_all(component.$$.on_destroy);
if (detaching) component.$$.fragment.d(1);
// TODO null out other refs, including component.$$ (but need to
// preserve final state?)
component.$$.on_destroy = component.$$.fragment = null;
@ -153,9 +155,7 @@ if (typeof HTMLElement !== 'undefined') {
}
$destroy() {
const { fragment } = this.$$;
destroy(this);
fragment.d(1);
destroy_component(this, 1);
this.$destroy = noop;
}
@ -180,9 +180,7 @@ export class SvelteComponent {
$$: T$$;
$destroy() {
const { fragment } = this.$$;
destroy(this);
fragment.d(1);
destroy_component(this, 1);
this.$destroy = noop;
}

@ -53,7 +53,7 @@ export function transition_out(block, detaching: 0 | 1, local: 0 | 1, callback)
outroing.add(block);
outros.callbacks.push(() => {
outroing.delete(block);
if (local) block.d(detaching);
if (detaching) block.d(detaching);
if (callback) callback();
});

@ -1,6 +1,7 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
destroy_component,
init,
mount_component,
noop,
@ -39,7 +40,7 @@ function create_fragment(ctx) {
},
d(detaching) {
nested.$destroy(detaching);
destroy_component(nested, detaching);
}
};
}

@ -1,6 +1,7 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
destroy_component,
init,
mount_component,
noop,
@ -39,7 +40,7 @@ function create_fragment(ctx) {
},
d(detaching) {
nested.$destroy(detaching);
destroy_component(nested, detaching);
}
};
}

@ -1,6 +1,7 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
destroy_component,
init,
mount_component,
noop,
@ -39,7 +40,7 @@ function create_fragment(ctx) {
},
d(detaching) {
nested.$destroy(detaching);
destroy_component(nested, detaching);
}
};
}

@ -1,6 +1,7 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
destroy_component,
init,
mount_component,
noop,
@ -39,7 +40,7 @@ function create_fragment(ctx) {
},
d(detaching) {
nested.$destroy(detaching);
destroy_component(nested, detaching);
}
};
}

@ -53,7 +53,7 @@ function create_fragment(ctx) {
i: noop,
o: noop,
d: function destroy_1(detaching) {
d: function destroy(detaching) {
if (detaching) {
detach(h1);
detach(t3);

@ -59,7 +59,7 @@ function create_each_block(ctx) {
}
},
d: function destroy_1(detaching) {
d: function destroy(detaching) {
if (detaching) {
detach(span);
detach(t1);
@ -137,7 +137,7 @@ function create_fragment(ctx) {
i: noop,
o: noop,
d: function destroy_1(detaching) {
d: function destroy(detaching) {
destroy_each(each_blocks, detaching);
if (detaching) {

@ -59,7 +59,7 @@ function create_each_block(ctx) {
}
},
d: function destroy_1(detaching) {
d: function destroy(detaching) {
if (detaching) {
detach(span);
detach(t1);
@ -137,7 +137,7 @@ function create_fragment(ctx) {
i: noop,
o: noop,
d: function destroy_1(detaching) {
d: function destroy(detaching) {
destroy_each(each_blocks, detaching);
if (detaching) {

@ -52,7 +52,7 @@ function create_fragment(ctx) {
i: noop,
o: noop,
d: function destroy_1(detaching) {
d: function destroy(detaching) {
if (detaching) {
detach(p);
}

@ -1,6 +1,7 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
destroy_component,
init,
mount_component,
noop,
@ -40,7 +41,7 @@ function create_fragment(ctx) {
},
d(detaching) {
lazyload.$destroy(detaching);
destroy_component(lazyload, detaching);
}
};
}

@ -1,6 +1,7 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
destroy_component,
detach,
init,
insert,
@ -52,13 +53,13 @@ function create_fragment(ctx) {
},
d(detaching) {
imported.$destroy(detaching);
destroy_component(imported, detaching);
if (detaching) {
detach(t);
}
nonimported.$destroy(detaching);
destroy_component(nonimported, detaching);
}
};
}

Loading…
Cancel
Save