|
|
@ -119,7 +119,7 @@ export default class EachBlock extends Node {
|
|
|
|
this.else.block.hasUpdateMethod = this.else.block.dependencies.size > 0;
|
|
|
|
this.else.block.hasUpdateMethod = this.else.block.dependencies.size > 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.block.hasOutroMethod || (this.else && this.else.block.hasOutroMethod)) {
|
|
|
|
if (this.block.hasOutros || (this.else && this.else.block.hasOutros)) {
|
|
|
|
block.addOutro();
|
|
|
|
block.addOutro();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -317,14 +317,14 @@ export default class EachBlock extends Node {
|
|
|
|
const rects = block.getUniqueName('rects');
|
|
|
|
const rects = block.getUniqueName('rects');
|
|
|
|
const destroy = this.block.hasAnimation
|
|
|
|
const destroy = this.block.hasAnimation
|
|
|
|
? `@fixAndOutroAndDestroyBlock`
|
|
|
|
? `@fixAndOutroAndDestroyBlock`
|
|
|
|
: this.block.hasOutroMethod
|
|
|
|
: this.block.hasOutros
|
|
|
|
? `@outroAndDestroyBlock`
|
|
|
|
? `@outroAndDestroyBlock`
|
|
|
|
: `@destroyBlock`;
|
|
|
|
: `@destroyBlock`;
|
|
|
|
|
|
|
|
|
|
|
|
block.builders.update.addBlock(deindent`
|
|
|
|
block.builders.update.addBlock(deindent`
|
|
|
|
const ${this.each_block_value} = ${snippet};
|
|
|
|
const ${this.each_block_value} = ${snippet};
|
|
|
|
|
|
|
|
|
|
|
|
${this.block.hasOutroMethod && `@transitionManager.groupOutros();`}
|
|
|
|
${this.block.hasOutros && `@transitionManager.groupOutros();`}
|
|
|
|
${this.block.hasAnimation && `for (let #i = 0; #i < ${blocks}.length; #i += 1) ${blocks}[#i].r();`}
|
|
|
|
${this.block.hasAnimation && `for (let #i = 0; #i < ${blocks}.length; #i += 1) ${blocks}[#i].r();`}
|
|
|
|
${blocks} = @updateKeyedEach(${blocks}, #component, changed, ${get_key}, ${dynamic ? '1' : '0'}, ctx, ${this.each_block_value}, ${lookup}, ${updateMountNode}, ${destroy}, ${create_each_block}, "${mountOrIntro}", ${anchor}, ${this.get_each_context});
|
|
|
|
${blocks} = @updateKeyedEach(${blocks}, #component, changed, ${get_key}, ${dynamic ? '1' : '0'}, ctx, ${this.each_block_value}, ${lookup}, ${updateMountNode}, ${destroy}, ${create_each_block}, "${mountOrIntro}", ${anchor}, ${this.get_each_context});
|
|
|
|
${this.block.hasAnimation && `for (let #i = 0; #i < ${blocks}.length; #i += 1) ${blocks}[#i].a();`}
|
|
|
|
${this.block.hasAnimation && `for (let #i = 0; #i < ${blocks}.length; #i += 1) ${blocks}[#i].a();`}
|
|
|
@ -393,7 +393,7 @@ export default class EachBlock extends Node {
|
|
|
|
allDependencies.add(dependency);
|
|
|
|
allDependencies.add(dependency);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const outro = this.block.hasOutroMethod && block.getUniqueName('outro')
|
|
|
|
const outro = this.block.hasOutros && block.getUniqueName('outro')
|
|
|
|
if (outro) {
|
|
|
|
if (outro) {
|
|
|
|
block.builders.init.addBlock(deindent`
|
|
|
|
block.builders.init.addBlock(deindent`
|
|
|
|
function ${outro}(i, detach, fn) {
|
|
|
|
function ${outro}(i, detach, fn) {
|
|
|
@ -415,7 +415,7 @@ export default class EachBlock extends Node {
|
|
|
|
|
|
|
|
|
|
|
|
if (condition !== '') {
|
|
|
|
if (condition !== '') {
|
|
|
|
const forLoopBody = this.block.hasUpdateMethod
|
|
|
|
const forLoopBody = this.block.hasUpdateMethod
|
|
|
|
? (this.block.hasIntroMethod || this.block.hasOutroMethod)
|
|
|
|
? (this.block.hasIntros || this.block.hasOutros)
|
|
|
|
? deindent`
|
|
|
|
? deindent`
|
|
|
|
if (${iterations}[#i]) {
|
|
|
|
if (${iterations}[#i]) {
|
|
|
|
${iterations}[#i].p(changed, child_ctx);
|
|
|
|
${iterations}[#i].p(changed, child_ctx);
|
|
|
@ -444,7 +444,7 @@ export default class EachBlock extends Node {
|
|
|
|
|
|
|
|
|
|
|
|
let destroy;
|
|
|
|
let destroy;
|
|
|
|
|
|
|
|
|
|
|
|
if (this.block.hasOutroMethod) {
|
|
|
|
if (this.block.hasOutros) {
|
|
|
|
destroy = deindent`
|
|
|
|
destroy = deindent`
|
|
|
|
@transitionManager.groupOutros();
|
|
|
|
@transitionManager.groupOutros();
|
|
|
|
for (; #i < ${iterations}.length; #i += 1) ${outro}(#i, 1);
|
|
|
|
for (; #i < ${iterations}.length; #i += 1) ${outro}(#i, 1);
|
|
|
|