@ -33,7 +33,7 @@ export default function visitEachBlock(
generator . code . overwrite ( c , c + 4 , 'length' ) ;
const length = ` [✂ ${ c } - ${ c + 4 } ✂] ` ;
const mountOrIntro = node . _block . hasIntroMethod ? 'i ntro ' : 'm ount ';
const mountOrIntro = node . _block . hasIntroMethod ? 'i ' : 'm ';
const vars = {
each ,
create_each_block ,
@ -75,7 +75,7 @@ export default function visitEachBlock(
block . builders . init . addBlock ( deindent `
if ( ! $ { each_block_value } . $ { length } ) {
$ { each_block_else } = $ { node . else . _block . name } ( $ { params } , # component ) ;
$ { each_block_else } . c reate ( ) ;
$ { each_block_else } . c ( ) ;
}
` );
@ -90,14 +90,14 @@ export default function visitEachBlock(
if ( node . else . _block . hasUpdateMethod ) {
block . builders . update . addBlock ( deindent `
if ( ! $ { each_block_value } . $ { length } && $ { each_block_else } ) {
$ { each_block_else } . u pdate ( changed , $ { params } ) ;
$ { each_block_else } . p( changed , $ { params } ) ;
} else if ( ! $ { each_block_value } . $ { length } ) {
$ { each_block_else } = $ { node . else . _block . name } ( $ { params } , # component ) ;
$ { each_block_else } . c reate ( ) ;
$ { each_block_else } . c ( ) ;
$ { each_block_else } . $ { mountOrIntro } ( $ { parentNode } , $ { anchor } ) ;
} else if ( $ { each_block_else } ) {
$ { each_block_else } . u nmount ( ) ;
$ { each_block_else } . d estroy ( ) ;
$ { each_block_else } . u ( ) ;
$ { each_block_else } . d ( ) ;
$ { each_block_else } = null ;
}
` );
@ -105,24 +105,24 @@ export default function visitEachBlock(
block . builders . update . addBlock ( deindent `
if ( $ { each_block_value } . $ { length } ) {
if ( $ { each_block_else } ) {
$ { each_block_else } . u nmount ( ) ;
$ { each_block_else } . d estroy ( ) ;
$ { each_block_else } . u ( ) ;
$ { each_block_else } . d ( ) ;
$ { each_block_else } = null ;
}
} else if ( ! $ { each_block_else } ) {
$ { each_block_else } = $ { node . else . _block . name } ( $ { params } , # component ) ;
$ { each_block_else } . c reate ( ) ;
$ { each_block_else } . c ( ) ;
$ { each_block_else } . $ { mountOrIntro } ( $ { parentNode } , $ { anchor } ) ;
}
` );
}
block . builders . unmount . addLine (
` if ( ${ each_block_else } ) ${ each_block_else } .u nmount ()`
` if ( ${ each_block_else } ) ${ each_block_else } .u ()`
) ;
block . builders . destroy . addBlock ( deindent `
if ( $ { each_block_else } ) $ { each_block_else } . d estroy ( ) ;
if ( $ { each_block_else } ) $ { each_block_else } . d ( ) ;
` );
}
@ -196,7 +196,7 @@ function keyed(
block . builders . create . addBlock ( deindent `
var $ { iteration } = $ { head } ;
while ( $ { iteration } ) {
$ { iteration } . c reate ( ) ;
$ { iteration } . c ( ) ;
$ { iteration } = $ { iteration } . next ;
}
` );
@ -204,7 +204,7 @@ function keyed(
block . builders . claim . addBlock ( deindent `
var $ { iteration } = $ { head } ;
while ( $ { iteration } ) {
$ { iteration } . c laim ( $ { state . parentNodes } ) ;
$ { iteration } . l( $ { state . parentNodes } ) ;
$ { iteration } = $ { iteration } . next ;
}
` );
@ -225,9 +225,9 @@ function keyed(
const fn = block . getUniqueName ( ` ${ each } _outro ` ) ;
block . builders . init . addBlock ( deindent `
function $ { fn } ( iteration ) {
iteration . o utro ( function ( ) {
iteration . u nmount ( ) ;
iteration . d estroy ( ) ;
iteration . o ( function ( ) {
iteration . u ( ) ;
iteration . d ( ) ;
$ { lookup } [ iteration . key ] = null ;
} ) ;
}
@ -249,8 +249,8 @@ function keyed(
const fn = block . getUniqueName ( ` ${ each } _destroy ` ) ;
block . builders . init . addBlock ( deindent `
function $ { fn } ( iteration ) {
iteration . u nmount ( ) ;
iteration . d estroy ( ) ;
iteration . u ( ) ;
iteration . d ( ) ;
$ { lookup } [ iteration . key ] = null ;
}
` );
@ -283,7 +283,7 @@ function keyed(
var $ { iteration } = $ { lookup } [ $ { key } ] ;
$ { dynamic &&
` if ( ${ iteration } ) ${ iteration } . u pdate (changed, ${ params } , ${ each_block_value } , ${ each_block_value } [#i], #i); ` }
` if ( ${ iteration } ) ${ iteration } . p(changed, ${ params } , ${ each_block_value } , ${ each_block_value } [#i], #i); ` }
if ( $ { expected } ) {
if ( $ { key } === $ { expected } . key ) {
@ -301,11 +301,11 @@ function keyed(
$ { iteration } . discard = false ;
$ { iteration } . last = $ { last } ;
if ( ! $ { expected } ) $ { iteration } . m ount ( $ { parentNode } , $ { anchor } ) ;
if ( ! $ { expected } ) $ { iteration } . m ( $ { parentNode } , $ { anchor } ) ;
} else {
// key is being inserted
$ { iteration } = $ { lookup } [ $ { key } ] = $ { create_each_block } ( $ { params } , $ { each_block_value } , $ { each_block_value } [ # i ] , # i , # component , $ { key } ) ;
$ { iteration } . c reate ( ) ;
$ { iteration } . c ( ) ;
$ { iteration } . $ { mountOrIntro } ( $ { parentNode } , $ { expected } . first ) ;
$ { expected } . last = $ { iteration } ;
@ -317,17 +317,17 @@ function keyed(
if ( $ { iteration } ) {
$ { iteration } . discard = false ;
$ { iteration } . next = null ;
$ { iteration } . m ount ( $ { parentNode } , $ { anchor } ) ;
$ { iteration } . m ( $ { parentNode } , $ { anchor } ) ;
} else {
$ { iteration } = $ { lookup } [ $ { key } ] = $ { create_each_block } ( $ { params } , $ { each_block_value } , $ { each_block_value } [ # i ] , # i , # component , $ { key } ) ;
$ { iteration } . c reate ( ) ;
$ { iteration } . c ( ) ;
$ { iteration } . $ { mountOrIntro } ( $ { parentNode } , $ { anchor } ) ;
}
}
if ( $ { last } ) $ { last } . next = $ { iteration } ;
$ { iteration } . last = $ { last } ;
$ { node . _block . hasIntroMethod && ` ${ iteration } .i ntro (${ parentNode } , ${ anchor } ); ` }
$ { node . _block . hasIntroMethod && ` ${ iteration } .i (${ parentNode } , ${ anchor } ); ` }
$ { last } = $ { iteration } ;
}
@ -342,7 +342,7 @@ function keyed(
block . builders . unmount . addBlock ( deindent `
var $ { iteration } = $ { head } ;
while ( $ { iteration } ) {
$ { iteration } . u nmount ( ) ;
$ { iteration } . u ( ) ;
$ { iteration } = $ { iteration } . next ;
}
` );
@ -351,7 +351,7 @@ function keyed(
block . builders . destroy . addBlock ( deindent `
var $ { iteration } = $ { head } ;
while ( $ { iteration } ) {
$ { iteration } . d estroy ( ) ;
$ { iteration } . d ( ) ;
$ { iteration } = $ { iteration } . next ;
}
` );
@ -386,13 +386,13 @@ function unkeyed(
block . builders . create . addBlock ( deindent `
for ( var # i = 0 ; # i < $ { iterations } . length ; # i += 1 ) {
$ { iterations } [ # i ] . c reate ( ) ;
$ { iterations } [ # i ] . c ( ) ;
}
` );
block . builders . claim . addBlock ( deindent `
for ( var # i = 0 ; # i < $ { iterations } . length ; # i += 1 ) {
$ { iterations } [ # i ] . c laim ( $ { state . parentNodes } ) ;
$ { iterations } [ # i ] . l( $ { state . parentNodes } ) ;
}
` );
@ -420,25 +420,25 @@ function unkeyed(
? node . _block . hasIntroMethod
? deindent `
if ( $ { iterations } [ # i ] ) {
$ { iterations } [ # i ] . u pdate ( changed , $ { params } , $ { each_block_value } , $ { each_block_value } [ # i ] , # i ) ;
$ { iterations } [ # i ] . p( changed , $ { params } , $ { each_block_value } , $ { each_block_value } [ # i ] , # i ) ;
} else {
$ { iterations } [ # i ] = $ { create_each_block } ( $ { params } , $ { each_block_value } , $ { each_block_value } [ # i ] , # i , # component ) ;
$ { iterations } [ # i ] . c reate ( ) ;
$ { iterations } [ # i ] . c ( ) ;
}
$ { iterations } [ # i ] . i ntro ( $ { parentNode } , $ { anchor } ) ;
$ { iterations } [ # i ] . i ( $ { parentNode } , $ { anchor } ) ;
`
: deindent `
if ( $ { iterations } [ # i ] ) {
$ { iterations } [ # i ] . u pdate ( changed , $ { params } , $ { each_block_value } , $ { each_block_value } [ # i ] , # i ) ;
$ { iterations } [ # i ] . p( changed , $ { params } , $ { each_block_value } , $ { each_block_value } [ # i ] , # i ) ;
} else {
$ { iterations } [ # i ] = $ { create_each_block } ( $ { params } , $ { each_block_value } , $ { each_block_value } [ # i ] , # i , # component ) ;
$ { iterations } [ # i ] . c reate ( ) ;
$ { iterations } [ # i ] . m ount ( $ { parentNode } , $ { anchor } ) ;
$ { iterations } [ # i ] . c ( ) ;
$ { iterations } [ # i ] . m ( $ { parentNode } , $ { anchor } ) ;
}
`
: deindent `
$ { iterations } [ # i ] = $ { create_each_block } ( $ { params } , $ { each_block_value } , $ { each_block_value } [ # i ] , # i , # component ) ;
$ { iterations } [ # i ] . c reate ( ) ;
$ { iterations } [ # i ] . c ( ) ;
$ { iterations } [ # i ] . $ { mountOrIntro } ( $ { parentNode } , $ { anchor } ) ;
` ;
@ -449,9 +449,9 @@ function unkeyed(
? deindent `
function $ { outro } ( i ) {
if ( $ { iterations } [ i ] ) {
$ { iterations } [ i ] . o utro ( function ( ) {
$ { iterations } [ i ] . u nmount ( ) ;
$ { iterations } [ i ] . d estroy ( ) ;
$ { iterations } [ i ] . o ( function ( ) {
$ { iterations } [ i ] . u ( ) ;
$ { iterations } [ i ] . d ( ) ;
$ { iterations } [ i ] = null ;
} ) ;
}
@ -461,8 +461,8 @@ function unkeyed(
`
: deindent `
for ( ; # i < $ { iterations } . length ; # i += 1 ) {
$ { iterations } [ # i ] . u nmount ( ) ;
$ { iterations } [ # i ] . d estroy ( ) ;
$ { iterations } [ # i ] . u ( ) ;
$ { iterations } [ # i ] . d ( ) ;
}
$ { iterations } . length = $ { each_block_value } . $ { length } ;
` ;
@ -482,7 +482,7 @@ function unkeyed(
block . builders . unmount . addBlock ( deindent `
for ( var # i = 0 ; # i < $ { iterations } . length ; # i += 1 ) {
$ { iterations } [ # i ] . u nmount ( ) ;
$ { iterations } [ # i ] . u ( ) ;
}
` );