|
|
@ -121,12 +121,15 @@ export default class SlotWrapper extends Wrapper {
|
|
|
|
const ${slot} = @create_slot(${slot_definition}, #ctx, ${get_slot_context});
|
|
|
|
const ${slot} = @create_slot(${slot_definition}, #ctx, ${get_slot_context});
|
|
|
|
`);
|
|
|
|
`);
|
|
|
|
|
|
|
|
|
|
|
|
// block.builders.create.push_condition(`!${slot}`);
|
|
|
|
// TODO this is a dreadful hack! Should probably make this nicer
|
|
|
|
// block.builders.claim.push_condition(`!${slot}`);
|
|
|
|
const { create, claim, hydrate, mount, update, destroy } = block.chunks;
|
|
|
|
// block.builders.hydrate.push_condition(`!${slot}`);
|
|
|
|
|
|
|
|
// block.builders.mount.push_condition(`!${slot}`);
|
|
|
|
block.chunks.create = [];
|
|
|
|
// block.builders.update.push_condition(`!${slot}`);
|
|
|
|
block.chunks.claim = [];
|
|
|
|
// block.builders.destroy.push_condition(`!${slot}`);
|
|
|
|
block.chunks.hydrate = [];
|
|
|
|
|
|
|
|
block.chunks.mount = [];
|
|
|
|
|
|
|
|
block.chunks.update = [];
|
|
|
|
|
|
|
|
block.chunks.destroy = [];
|
|
|
|
|
|
|
|
|
|
|
|
const listeners = block.event_listeners;
|
|
|
|
const listeners = block.event_listeners;
|
|
|
|
block.event_listeners = [];
|
|
|
|
block.event_listeners = [];
|
|
|
@ -134,12 +137,19 @@ export default class SlotWrapper extends Wrapper {
|
|
|
|
block.render_listeners(`_${slot.name}`);
|
|
|
|
block.render_listeners(`_${slot.name}`);
|
|
|
|
block.event_listeners = listeners;
|
|
|
|
block.event_listeners = listeners;
|
|
|
|
|
|
|
|
|
|
|
|
// block.builders.create.pop_condition();
|
|
|
|
if (block.chunks.create) create.push(b`if (!${slot}) { ${block.chunks.create} }`);
|
|
|
|
// block.builders.claim.pop_condition();
|
|
|
|
if (block.chunks.claim) claim.push(b`if (!${slot}) { ${block.chunks.claim} }`);
|
|
|
|
// block.builders.hydrate.pop_condition();
|
|
|
|
if (block.chunks.hydrate) hydrate.push(b`if (!${slot}) { ${block.chunks.hydrate} }`);
|
|
|
|
// block.builders.mount.pop_condition();
|
|
|
|
if (block.chunks.mount) mount.push(b`if (!${slot}) { ${block.chunks.mount} }`);
|
|
|
|
// block.builders.update.pop_condition();
|
|
|
|
if (block.chunks.update) update.push(b`if (!${slot}) { ${block.chunks.update} }`);
|
|
|
|
// block.builders.destroy.pop_condition();
|
|
|
|
if (block.chunks.destroy) destroy.push(b`if (!${slot}) { ${block.chunks.destroy} }`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
block.chunks.create = create;
|
|
|
|
|
|
|
|
block.chunks.claim = claim;
|
|
|
|
|
|
|
|
block.chunks.hydrate = hydrate;
|
|
|
|
|
|
|
|
block.chunks.mount = mount;
|
|
|
|
|
|
|
|
block.chunks.update = update;
|
|
|
|
|
|
|
|
block.chunks.destroy = destroy;
|
|
|
|
|
|
|
|
|
|
|
|
block.chunks.create.push(
|
|
|
|
block.chunks.create.push(
|
|
|
|
b`if (${slot}) ${slot}.c();`
|
|
|
|
b`if (${slot}) ${slot}.c();`
|
|
|
|