diff --git a/src/generators/dom/Block.ts b/src/generators/dom/Block.ts index 91a92bbe07..6b696b5ad5 100644 --- a/src/generators/dom/Block.ts +++ b/src/generators/dom/Block.ts @@ -226,24 +226,24 @@ export default class Block { } if (this.builders.create.isEmpty()) { - properties.addBlock(`create: @noop,`); + properties.addBlock(`c: @noop,`); } else { properties.addBlock(deindent` - create: function() { + c: function create() { ${this.builders.create} - ${!this.builders.hydrate.isEmpty() && `this.hydrate();`} + ${!this.builders.hydrate.isEmpty() && `this.h();`} }, `); } if (this.generator.hydratable) { if (this.builders.claim.isEmpty()) { - properties.addBlock(`claim: @noop,`); + properties.addBlock(`l: @noop,`); } else { properties.addBlock(deindent` - claim: function(nodes) { + l: function claim(nodes) { ${this.builders.claim} - ${!this.builders.hydrate.isEmpty() && `this.hydrate();`} + ${!this.builders.hydrate.isEmpty() && `this.h();`} }, `); } @@ -251,17 +251,17 @@ export default class Block { if (!this.builders.hydrate.isEmpty()) { properties.addBlock(deindent` - hydrate: function() { + h: function hydrate() { ${this.builders.hydrate} }, `); } if (this.builders.mount.isEmpty()) { - properties.addBlock(`mount: @noop,`); + properties.addBlock(`m: @noop,`); } else { properties.addBlock(deindent` - mount: function(#target, anchor) { + m: function mount(#target, anchor) { ${this.builders.mount} }, `); @@ -269,10 +269,10 @@ export default class Block { if (this.hasUpdateMethod) { if (this.builders.update.isEmpty()) { - properties.addBlock(`update: @noop,`); + properties.addBlock(`p: @noop,`); } else { properties.addBlock(deindent` - update: function(changed, ${this.params.join(', ')}) { + p: function update(changed, ${this.params.join(', ')}) { ${this.builders.update} }, `); @@ -282,20 +282,20 @@ export default class Block { if (this.hasIntroMethod) { if (hasIntros) { properties.addBlock(deindent` - intro: function(#target, anchor) { + i: function intro(#target, anchor) { if (${introing}) return; ${introing} = true; ${hasOutros && `${outroing} = false;`} ${this.builders.intro} - this.mount(#target, anchor); + this.m(#target, anchor); }, `); } else { properties.addBlock(deindent` - intro: function(#target, anchor) { - this.mount(#target, anchor); + i: function intro(#target, anchor) { + this.m(#target, anchor); }, `); } @@ -304,7 +304,7 @@ export default class Block { if (this.hasOutroMethod) { if (hasOutros) { properties.addBlock(deindent` - outro: function(${this.alias('outrocallback')}) { + o: function outro(${this.alias('outrocallback')}) { if (${outroing}) return; ${outroing} = true; ${hasIntros && `${introing} = false;`} @@ -315,8 +315,9 @@ export default class Block { }, `); } else { + // TODO should this be a helper? properties.addBlock(deindent` - outro: function(outrocallback) { + o: function outro(outrocallback) { outrocallback(); }, `); @@ -324,20 +325,20 @@ export default class Block { } if (this.builders.unmount.isEmpty()) { - properties.addBlock(`unmount: @noop,`); + properties.addBlock(`u: @noop,`); } else { properties.addBlock(deindent` - unmount: function() { + u: function unmount() { ${this.builders.unmount} }, `); } if (this.builders.destroy.isEmpty()) { - properties.addBlock(`destroy: @noop`); + properties.addBlock(`d: @noop`); } else { properties.addBlock(deindent` - destroy: function() { + d: function destroy() { ${this.builders.destroy} } `); diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts index 22371c71bc..33bcd0d9db 100644 --- a/src/generators/dom/index.ts +++ b/src/generators/dom/index.ts @@ -236,8 +236,8 @@ export default function dom( this._fragment = @create_main_fragment(this._state, this); ${generator.customElement ? deindent` - this._fragment.create(); - this._fragment.${block.hasIntroMethod ? 'intro' : 'mount'}(this.shadowRoot, null); + this._fragment.c(); + this._fragment.${block.hasIntroMethod ? 'i' : 'm'}(this.shadowRoot, null); if (options.target) this._mount(options.target, options.anchor || null); ` : deindent` @@ -245,14 +245,14 @@ export default function dom( ${generator.hydratable ? deindent` var nodes = @children(options.target); - options.hydrate ? this._fragment.claim(nodes) : this._fragment.create(); + options.hydrate ? this._fragment.l(nodes) : this._fragment.c(); nodes.forEach(@detachNode); ` : deindent` ${options.dev && `if (options.hydrate) throw new Error("options.hydrate only works if the component was compiled with the \`hydratable: true\` option");`} - this._fragment.create(); + this._fragment.c(); `} - this._fragment.${block.hasIntroMethod ? 'intro' : 'mount'}(options.target, options.anchor || null); + this._fragment.${block.hasIntroMethod ? 'i' : 'm'}(options.target, options.anchor || null); ${(generator.hasComponents || generator.hasComplexBindings || templateProperties.oncreate || generator.hasIntroTransitions) && deindent` ${generator.hasComponents && `this._lock = true;`} diff --git a/src/generators/dom/visitors/Component.ts b/src/generators/dom/visitors/Component.ts index 5085ee9969..30f912690d 100644 --- a/src/generators/dom/visitors/Component.ts +++ b/src/generators/dom/visitors/Component.ts @@ -230,10 +230,10 @@ export default function visitComponent( ${beforecreate} `); - block.builders.create.addLine(`${name}._fragment.create();`); + block.builders.create.addLine(`${name}._fragment.c();`); block.builders.claim.addLine( - `${name}._fragment.claim( ${state.parentNodes} );` + `${name}._fragment.l( ${state.parentNodes} );` ); block.builders.mount.addLine( diff --git a/src/generators/dom/visitors/EachBlock.ts b/src/generators/dom/visitors/EachBlock.ts index a17285a8d2..a9259adf06 100644 --- a/src/generators/dom/visitors/EachBlock.ts +++ b/src/generators/dom/visitors/EachBlock.ts @@ -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 ? 'intro' : 'mount'; + 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}.create(); + ${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}.update( 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}.create(); + ${each_block_else}.c(); ${each_block_else}.${mountOrIntro}(${parentNode}, ${anchor}); } else if (${each_block_else}) { - ${each_block_else}.unmount(); - ${each_block_else}.destroy(); + ${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}.unmount(); - ${each_block_else}.destroy(); + ${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}.create(); + ${each_block_else}.c(); ${each_block_else}.${mountOrIntro}(${parentNode}, ${anchor}); } `); } block.builders.unmount.addLine( - `if (${each_block_else}) ${each_block_else}.unmount()` + `if (${each_block_else}) ${each_block_else}.u()` ); block.builders.destroy.addBlock(deindent` - if (${each_block_else}) ${each_block_else}.destroy(); + 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}.create(); + ${iteration}.c(); ${iteration} = ${iteration}.next; } `); @@ -204,7 +204,7 @@ function keyed( block.builders.claim.addBlock(deindent` var ${iteration} = ${head}; while (${iteration}) { - ${iteration}.claim(${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.outro(function() { - iteration.unmount(); - iteration.destroy(); + 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.unmount(); - iteration.destroy(); + iteration.u(); + iteration.d(); ${lookup}[iteration.key] = null; } `); @@ -283,7 +283,7 @@ function keyed( var ${iteration} = ${lookup}[${key}]; ${dynamic && - `if (${iteration}) ${iteration}.update(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}.mount(${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}.create(); + ${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}.mount(${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}.create(); + ${iteration}.c(); ${iteration}.${mountOrIntro}(${parentNode}, ${anchor}); } } if (${last}) ${last}.next = ${iteration}; ${iteration}.last = ${last}; - ${node._block.hasIntroMethod && `${iteration}.intro(${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}.unmount(); + ${iteration}.u(); ${iteration} = ${iteration}.next; } `); @@ -351,7 +351,7 @@ function keyed( block.builders.destroy.addBlock(deindent` var ${iteration} = ${head}; while (${iteration}) { - ${iteration}.destroy(); + ${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].create(); + ${iterations}[#i].c(); } `); block.builders.claim.addBlock(deindent` for (var #i = 0; #i < ${iterations}.length; #i += 1) { - ${iterations}[#i].claim(${state.parentNodes}); + ${iterations}[#i].l(${state.parentNodes}); } `); @@ -420,25 +420,25 @@ function unkeyed( ? node._block.hasIntroMethod ? deindent` if (${iterations}[#i]) { - ${iterations}[#i].update(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].create(); + ${iterations}[#i].c(); } - ${iterations}[#i].intro(${parentNode}, ${anchor}); + ${iterations}[#i].i(${parentNode}, ${anchor}); ` : deindent` if (${iterations}[#i]) { - ${iterations}[#i].update(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].create(); - ${iterations}[#i].mount(${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].create(); + ${iterations}[#i].c(); ${iterations}[#i].${mountOrIntro}(${parentNode}, ${anchor}); `; @@ -449,9 +449,9 @@ function unkeyed( ? deindent` function ${outro}(i) { if (${iterations}[i]) { - ${iterations}[i].outro(function() { - ${iterations}[i].unmount(); - ${iterations}[i].destroy(); + ${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].unmount(); - ${iterations}[#i].destroy(); + ${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].unmount(); + ${iterations}[#i].u(); } `); diff --git a/src/generators/dom/visitors/IfBlock.ts b/src/generators/dom/visitors/IfBlock.ts index 2aa22d502c..6c939a698e 100644 --- a/src/generators/dom/visitors/IfBlock.ts +++ b/src/generators/dom/visitors/IfBlock.ts @@ -114,10 +114,10 @@ export default function visitIfBlock( simple(generator, block, state, node, branches[0], dynamic, vars); } - block.builders.create.addLine(`${if_name}${name}.create();`); + block.builders.create.addLine(`${if_name}${name}.c();`); block.builders.claim.addLine( - `${if_name}${name}.claim(${state.parentNodes});` + `${if_name}${name}.l(${state.parentNodes});` ); if (needsAnchor) { @@ -144,7 +144,7 @@ function simple( `); const isTopLevel = !state.parentNode; - const mountOrIntro = branch.hasIntroMethod ? 'intro' : 'mount'; + const mountOrIntro = branch.hasIntroMethod ? 'i' : 'm'; const targetNode = state.parentNode || '#target'; const anchorNode = state.parentNode ? 'null' : 'anchor'; @@ -158,52 +158,52 @@ function simple( ? branch.hasIntroMethod ? deindent` if (${name}) { - ${name}.update(changed, ${params}); + ${name}.p(changed, ${params}); } else { ${name} = ${branch.block}(${params}, #component); - if (${name}) ${name}.create(); + if (${name}) ${name}.c(); } - ${name}.intro(${parentNode}, ${anchor}); + ${name}.i(${parentNode}, ${anchor}); ` : deindent` if (${name}) { - ${name}.update(changed, ${params}); + ${name}.p(changed, ${params}); } else { ${name} = ${branch.block}(${params}, #component); - ${name}.create(); - ${name}.mount(${parentNode}, ${anchor}); + ${name}.c(); + ${name}.m(${parentNode}, ${anchor}); } ` : branch.hasIntroMethod ? deindent` if (!${name}) { ${name} = ${branch.block}(${params}, #component); - ${name}.create(); + ${name}.c(); } - ${name}.intro(${parentNode}, ${anchor}); + ${name}.i(${parentNode}, ${anchor}); ` : deindent` if (!${name}) { ${name} = ${branch.block}(${params}, #component); - ${name}.create(); - ${name}.mount(${parentNode}, ${anchor}); + ${name}.c(); + ${name}.m(${parentNode}, ${anchor}); } `; - // no `update()` here — we don't want to update outroing nodes, + // no `p()` here — we don't want to update outroing nodes, // as that will typically result in glitching const exit = branch.hasOutroMethod ? deindent` - ${name}.outro(function() { - ${name}.unmount(); - ${name}.destroy(); + ${name}.o(function() { + ${name}.u(); + ${name}.d(); ${name} = null; }); ` : deindent` - ${name}.unmount(); - ${name}.destroy(); + ${name}.u(); + ${name}.d(); ${name} = null; `; @@ -215,9 +215,9 @@ function simple( } `); - block.builders.unmount.addLine(`${if_name}${name}.unmount();`); + block.builders.unmount.addLine(`${if_name}${name}.u();`); - block.builders.destroy.addLine(`${if_name}${name}.destroy();`); + block.builders.destroy.addLine(`${if_name}${name}.d();`); } function compound( @@ -247,7 +247,7 @@ function compound( `); const isTopLevel = !state.parentNode; - const mountOrIntro = branches[0].hasIntroMethod ? 'intro' : 'mount'; + const mountOrIntro = branches[0].hasIntroMethod ? 'i' : 'm'; const targetNode = state.parentNode || '#target'; const anchorNode = state.parentNode ? 'null' : 'anchor'; @@ -260,23 +260,23 @@ function compound( const changeBlock = deindent` ${hasElse ? deindent` - ${name}.unmount(); - ${name}.destroy(); + ${name}.u(); + ${name}.d(); ` : deindent` if (${name}) { - ${name}.unmount(); - ${name}.destroy(); + ${name}.u(); + ${name}.d(); }`} ${name} = ${current_block_type_and}${current_block_type}(${params}, #component); - ${if_name}${name}.create(); + ${if_name}${name}.c(); ${if_name}${name}.${mountOrIntro}(${parentNode}, ${anchor}); `; if (dynamic) { block.builders.update.addBlock(deindent` if (${current_block_type} === (${current_block_type} = ${select_block_type}(${params})) && ${name}) { - ${name}.update(changed, ${params}); + ${name}.p(changed, ${params}); } else { ${changeBlock} } @@ -289,9 +289,9 @@ function compound( `); } - block.builders.unmount.addLine(`${if_name}${name}.unmount();`); + block.builders.unmount.addLine(`${if_name}${name}.u();`); - block.builders.destroy.addLine(`${if_name}${name}.destroy();`); + block.builders.destroy.addLine(`${if_name}${name}.d();`); } // if any of the siblings have outros, we need to keep references to the blocks @@ -346,7 +346,7 @@ function compoundWithOutros( } const isTopLevel = !state.parentNode; - const mountOrIntro = branches[0].hasIntroMethod ? 'intro' : 'mount'; + const mountOrIntro = branches[0].hasIntroMethod ? 'i' : 'm'; const targetNode = state.parentNode || '#target'; const anchorNode = state.parentNode ? 'null' : 'anchor'; @@ -357,9 +357,9 @@ function compoundWithOutros( const parentNode = (state.parentNode && !needsAnchor) ? state.parentNode : `${anchor}.parentNode`; const destroyOldBlock = deindent` - ${name}.outro(function() { - ${if_blocks}[ ${previous_block_index} ].unmount(); - ${if_blocks}[ ${previous_block_index} ].destroy(); + ${name}.o(function() { + ${if_blocks}[ ${previous_block_index} ].u(); + ${if_blocks}[ ${previous_block_index} ].d(); ${if_blocks}[ ${previous_block_index} ] = null; }); `; @@ -368,7 +368,7 @@ function compoundWithOutros( ${name} = ${if_blocks}[${current_block_type_index}]; if (!${name}) { ${name} = ${if_blocks}[${current_block_type_index}] = ${if_block_creators}[${current_block_type_index}](${params}, #component); - ${name}.create(); + ${name}.c(); } ${name}.${mountOrIntro}(${parentNode}, ${anchor}); `; @@ -396,7 +396,7 @@ function compoundWithOutros( var ${previous_block_index} = ${current_block_type_index}; ${current_block_type_index} = ${select_block_type}(${params}); if (${current_block_type_index} === ${previous_block_index}) { - ${if_current_block_type_index}${if_blocks}[${current_block_type_index}].update(changed, ${params}); + ${if_current_block_type_index}${if_blocks}[${current_block_type_index}].p(changed, ${params}); } else { ${changeBlock} } @@ -413,8 +413,8 @@ function compoundWithOutros( block.builders.destroy.addLine(deindent` ${if_current_block_type_index}{ - ${if_blocks}[${current_block_type_index}].unmount(); - ${if_blocks}[${current_block_type_index}].destroy(); + ${if_blocks}[${current_block_type_index}].u(); + ${if_blocks}[${current_block_type_index}].d(); } `); } diff --git a/src/shared/dom.js b/src/shared/dom.js index bae9ed86c4..29cf58e12c 100644 --- a/src/shared/dom.js +++ b/src/shared/dom.js @@ -49,7 +49,7 @@ export function reinsertBefore(after, target) { export function destroyEach(iterations) { for (var i = 0; i < iterations.length; i += 1) { - if (iterations[i]) iterations[i].destroy(); + if (iterations[i]) iterations[i].d(); } } diff --git a/src/shared/index.js b/src/shared/index.js index c2e14744f3..9659db9753 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -13,8 +13,8 @@ export function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -158,7 +158,7 @@ export function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -178,11 +178,11 @@ export function callAll(fns) { } export function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } export function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } export var proto = { diff --git a/test/js/samples/collapses-text-around-comments/expected-bundle.js b/test/js/samples/collapses-text-around-comments/expected-bundle.js index 5d44708a27..402045ae74 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -46,8 +46,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -159,7 +159,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -168,11 +168,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -213,32 +213,32 @@ function create_main_fragment(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText(state.foo); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { encapsulateStyles(p); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - update: function(changed, state) { + p: function update(changed, state) { if (changed.foo) { text.data = state.foo; } }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -251,8 +251,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/collapses-text-around-comments/expected.js b/test/js/samples/collapses-text-around-comments/expected.js index 83841b4eb8..b4ba5f9c54 100644 --- a/test/js/samples/collapses-text-around-comments/expected.js +++ b/test/js/samples/collapses-text-around-comments/expected.js @@ -24,32 +24,32 @@ function create_main_fragment(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText(state.foo); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { encapsulateStyles(p); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - update: function(changed, state) { + p: function update(changed, state) { if (changed.foo) { text.data = state.foo; } }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -62,8 +62,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js index a9769110cb..888c437806 100644 --- a/test/js/samples/component-static/expected-bundle.js +++ b/test/js/samples/component-static/expected-bundle.js @@ -22,8 +22,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -135,7 +135,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -144,11 +144,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -182,21 +182,21 @@ function create_main_fragment(state, component) { }); return { - create: function() { - nested._fragment.create(); + c: function create() { + nested._fragment.c(); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { nested._mount(target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { nested._unmount(); }, - destroy: function() { + d: function destroy$$1() { nested.destroy(false); } }; @@ -215,8 +215,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/component-static/expected.js b/test/js/samples/component-static/expected.js index 8a22292037..7ca873cc5f 100644 --- a/test/js/samples/component-static/expected.js +++ b/test/js/samples/component-static/expected.js @@ -17,21 +17,21 @@ function create_main_fragment(state, component) { }); return { - create: function() { - nested._fragment.create(); + c: function create() { + nested._fragment.c(); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { nested._mount(target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { nested._unmount(); }, - destroy: function() { + d: function destroy() { nested.destroy(false); } }; @@ -50,8 +50,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index e6e9152b1e..949b0e8e26 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -22,8 +22,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -135,7 +135,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -144,11 +144,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -178,15 +178,15 @@ var template = (function() { function create_main_fragment(state, component) { return { - create: noop, + c: noop, - mount: noop, + m: noop, - update: noop, + p: noop, - unmount: noop, + u: noop, - destroy: noop + d: noop }; } @@ -198,8 +198,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/computed-collapsed-if/expected.js b/test/js/samples/computed-collapsed-if/expected.js index 7b9207a955..1ad70b617d 100644 --- a/test/js/samples/computed-collapsed-if/expected.js +++ b/test/js/samples/computed-collapsed-if/expected.js @@ -13,15 +13,15 @@ var template = (function() { function create_main_fragment(state, component) { return { - create: noop, + c: noop, - mount: noop, + m: noop, - update: noop, + p: noop, - unmount: noop, + u: noop, - destroy: noop + d: noop }; } @@ -33,8 +33,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js index e37322f9e6..862f721ebc 100644 --- a/test/js/samples/css-media-query/expected-bundle.js +++ b/test/js/samples/css-media-query/expected-bundle.js @@ -42,8 +42,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -155,7 +155,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -164,11 +164,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -201,26 +201,26 @@ function create_main_fragment(state, component) { var div; return { - create: function() { + c: function create() { div = createElement("div"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { encapsulateStyles(div); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -233,8 +233,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/css-media-query/expected.js b/test/js/samples/css-media-query/expected.js index 58d4b5e991..5b77893900 100644 --- a/test/js/samples/css-media-query/expected.js +++ b/test/js/samples/css-media-query/expected.js @@ -16,26 +16,26 @@ function create_main_fragment(state, component) { var div; return { - create: function() { + c: function create() { div = createElement("div"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { encapsulateStyles(div); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -48,8 +48,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js index 6155fc8ecb..4c8fad71f7 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js @@ -34,8 +34,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -147,7 +147,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -156,11 +156,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -182,22 +182,22 @@ function create_main_fragment(state, component) { var div; return { - create: function() { + c: function create() { div = createElement("div"); div.textContent = "fades in"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -212,8 +212,8 @@ class SvelteComponent extends HTMLElement { this._fragment = create_main_fragment(this._state, this); - this._fragment.create(); - this._fragment.mount(this.shadowRoot, null); + this._fragment.c(); + this._fragment.m(this.shadowRoot, null); if (options.target) this._mount(options.target, options.anchor || null); } diff --git a/test/js/samples/css-shadow-dom-keyframes/expected.js b/test/js/samples/css-shadow-dom-keyframes/expected.js index 06a9f08bf6..c004ec7df6 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected.js @@ -5,22 +5,22 @@ function create_main_fragment(state, component) { var div; return { - create: function() { + c: function create() { div = createElement("div"); div.textContent = "fades in"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -35,8 +35,8 @@ class SvelteComponent extends HTMLElement { this._fragment = create_main_fragment(this._state, this); - this._fragment.create(); - this._fragment.mount(this.shadowRoot, null); + this._fragment.c(); + this._fragment.m(this.shadowRoot, null); if (options.target) this._mount(options.target, options.anchor || null); } diff --git a/test/js/samples/each-block-changed-check/expected-bundle.js b/test/js/samples/each-block-changed-check/expected-bundle.js index 882e55dfbb..33bd98ba74 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -33,7 +33,7 @@ function detachAfter(before) { function destroyEach(iterations) { for (var i = 0; i < iterations.length; i += 1) { - if (iterations[i]) iterations[i].destroy(); + if (iterations[i]) iterations[i].d(); } } @@ -54,8 +54,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -167,7 +167,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -176,11 +176,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -210,9 +210,9 @@ function create_main_fragment(state, component) { } return { - create: function() { + c: function create() { for (var i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].create(); + each_blocks[i].c(); } text = createText("\n\n"); @@ -220,9 +220,9 @@ function create_main_fragment(state, component) { text_1 = createText(state.foo); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { for (var i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].mount(target, anchor); + each_blocks[i].m(target, anchor); } insertNode(text, target, anchor); @@ -230,23 +230,23 @@ function create_main_fragment(state, component) { appendNode(text_1, p); }, - update: function(changed, state) { + p: function update(changed, state) { var comments = state.comments; if (changed.comments || changed.elapsed || changed.time) { for (var i = 0; i < comments.length; i += 1) { if (each_blocks[i]) { - each_blocks[i].update(changed, state, comments, comments[i], i); + each_blocks[i].p(changed, state, comments, comments[i], i); } else { each_blocks[i] = create_each_block(state, comments, comments[i], i, component); - each_blocks[i].create(); - each_blocks[i].mount(text.parentNode, text); + each_blocks[i].c(); + each_blocks[i].m(text.parentNode, text); } } for (; i < each_blocks.length; i += 1) { - each_blocks[i].unmount(); - each_blocks[i].destroy(); + each_blocks[i].u(); + each_blocks[i].d(); } each_blocks.length = comments.length; } @@ -256,16 +256,16 @@ function create_main_fragment(state, component) { } }, - unmount: function() { + u: function unmount() { for (var i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].unmount(); + each_blocks[i].u(); } detachNode(text); detachNode(p); }, - destroy: function() { + d: function destroy$$1() { destroyEach(each_blocks); } }; @@ -276,7 +276,7 @@ function create_each_block(state, comments, comment, i, component) { var div, strong, text, text_1, span, text_2_value = comment.author, text_2, text_3, text_4_value = state.elapsed(comment.time, state.time), text_4, text_5, text_6, raw_value = comment.html, raw_before; return { - create: function() { + c: function create() { div = createElement("div"); strong = createElement("strong"); text = createText(i); @@ -288,15 +288,15 @@ function create_each_block(state, comments, comment, i, component) { text_5 = createText(" ago:"); text_6 = createText("\n\n\t\t"); raw_before = createElement('noscript'); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { div.className = "comment"; span.className = "meta"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); appendNode(strong, div); appendNode(text, strong); @@ -311,7 +311,7 @@ function create_each_block(state, comments, comment, i, component) { raw_before.insertAdjacentHTML("afterend", raw_value); }, - update: function(changed, state, comments, comment, i) { + p: function update(changed, state, comments, comment, i) { if ((changed.comments) && text_2_value !== (text_2_value = comment.author)) { text_2.data = text_2_value; } @@ -326,13 +326,13 @@ function create_each_block(state, comments, comment, i, component) { } }, - unmount: function() { + u: function unmount() { detachAfter(raw_before); detachNode(div); }, - destroy: noop + d: noop }; } @@ -343,8 +343,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/each-block-changed-check/expected.js b/test/js/samples/each-block-changed-check/expected.js index 613fea0bf5..37c12c1acd 100644 --- a/test/js/samples/each-block-changed-check/expected.js +++ b/test/js/samples/each-block-changed-check/expected.js @@ -13,9 +13,9 @@ function create_main_fragment(state, component) { } return { - create: function() { + c: function create() { for (var i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].create(); + each_blocks[i].c(); } text = createText("\n\n"); @@ -23,9 +23,9 @@ function create_main_fragment(state, component) { text_1 = createText(state.foo); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { for (var i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].mount(target, anchor); + each_blocks[i].m(target, anchor); } insertNode(text, target, anchor); @@ -33,23 +33,23 @@ function create_main_fragment(state, component) { appendNode(text_1, p); }, - update: function(changed, state) { + p: function update(changed, state) { var comments = state.comments; if (changed.comments || changed.elapsed || changed.time) { for (var i = 0; i < comments.length; i += 1) { if (each_blocks[i]) { - each_blocks[i].update(changed, state, comments, comments[i], i); + each_blocks[i].p(changed, state, comments, comments[i], i); } else { each_blocks[i] = create_each_block(state, comments, comments[i], i, component); - each_blocks[i].create(); - each_blocks[i].mount(text.parentNode, text); + each_blocks[i].c(); + each_blocks[i].m(text.parentNode, text); } } for (; i < each_blocks.length; i += 1) { - each_blocks[i].unmount(); - each_blocks[i].destroy(); + each_blocks[i].u(); + each_blocks[i].d(); } each_blocks.length = comments.length; } @@ -59,16 +59,16 @@ function create_main_fragment(state, component) { } }, - unmount: function() { + u: function unmount() { for (var i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].unmount(); + each_blocks[i].u(); } detachNode(text); detachNode(p); }, - destroy: function() { + d: function destroy() { destroyEach(each_blocks); } }; @@ -79,7 +79,7 @@ function create_each_block(state, comments, comment, i, component) { var div, strong, text, text_1, span, text_2_value = comment.author, text_2, text_3, text_4_value = state.elapsed(comment.time, state.time), text_4, text_5, text_6, raw_value = comment.html, raw_before; return { - create: function() { + c: function create() { div = createElement("div"); strong = createElement("strong"); text = createText(i); @@ -91,15 +91,15 @@ function create_each_block(state, comments, comment, i, component) { text_5 = createText(" ago:"); text_6 = createText("\n\n\t\t"); raw_before = createElement('noscript'); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { div.className = "comment"; span.className = "meta"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); appendNode(strong, div); appendNode(text, strong); @@ -114,7 +114,7 @@ function create_each_block(state, comments, comment, i, component) { raw_before.insertAdjacentHTML("afterend", raw_value); }, - update: function(changed, state, comments, comment, i) { + p: function update(changed, state, comments, comment, i) { if ((changed.comments) && text_2_value !== (text_2_value = comment.author)) { text_2.data = text_2_value; } @@ -129,13 +129,13 @@ function create_each_block(state, comments, comment, i, component) { } }, - unmount: function() { + u: function unmount() { detachAfter(raw_before); detachNode(div); }, - destroy: noop + d: noop }; } @@ -146,8 +146,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index 7b896bf8f1..b94a6a848a 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -34,8 +34,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -147,7 +147,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -156,11 +156,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -197,30 +197,30 @@ function create_main_fragment(state, component) { var button, foo_handler; return { - create: function() { + c: function create() { button = createElement("button"); button.textContent = "foo"; - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { foo_handler = template.events.foo.call(component, button, function(event) { var state = component.get(); component.foo( state.bar ); }); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(button, target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(button); }, - destroy: function() { + d: function destroy$$1() { foo_handler.teardown(); } }; @@ -233,8 +233,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/event-handlers-custom/expected.js b/test/js/samples/event-handlers-custom/expected.js index 34832b6000..5164130066 100644 --- a/test/js/samples/event-handlers-custom/expected.js +++ b/test/js/samples/event-handlers-custom/expected.js @@ -20,30 +20,30 @@ function create_main_fragment(state, component) { var button, foo_handler; return { - create: function() { + c: function create() { button = createElement("button"); button.textContent = "foo"; - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { foo_handler = template.events.foo.call(component, button, function(event) { var state = component.get(); component.foo( state.bar ); }); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(button, target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(button); }, - destroy: function() { + d: function destroy() { foo_handler.teardown(); } }; @@ -56,8 +56,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/if-block-no-update/expected-bundle.js b/test/js/samples/if-block-no-update/expected-bundle.js index 6b6a6255b9..f68dbd24e3 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -38,8 +38,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -151,7 +151,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -160,11 +160,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -189,33 +189,33 @@ function create_main_fragment(state, component) { var if_block = current_block_type(state, component); return { - create: function() { - if_block.create(); + c: function create() { + if_block.c(); if_block_anchor = createComment(); }, - mount: function(target, anchor) { - if_block.mount(target, anchor); + m: function mount(target, anchor) { + if_block.m(target, anchor); insertNode(if_block_anchor, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (current_block_type !== (current_block_type = select_block_type(state))) { - if_block.unmount(); - if_block.destroy(); + if_block.u(); + if_block.d(); if_block = current_block_type(state, component); - if_block.create(); - if_block.mount(if_block_anchor.parentNode, if_block_anchor); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); } }, - unmount: function() { - if_block.unmount(); + u: function unmount() { + if_block.u(); detachNode(if_block_anchor); }, - destroy: function() { - if_block.destroy(); + d: function destroy$$1() { + if_block.d(); } }; } @@ -225,20 +225,20 @@ function create_if_block(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "foo!"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -247,20 +247,20 @@ function create_if_block_1(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "not foo!"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -276,8 +276,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/if-block-no-update/expected.js b/test/js/samples/if-block-no-update/expected.js index 10ecf2297b..6a0a4456c5 100644 --- a/test/js/samples/if-block-no-update/expected.js +++ b/test/js/samples/if-block-no-update/expected.js @@ -8,33 +8,33 @@ function create_main_fragment(state, component) { var if_block = current_block_type(state, component); return { - create: function() { - if_block.create(); + c: function create() { + if_block.c(); if_block_anchor = createComment(); }, - mount: function(target, anchor) { - if_block.mount(target, anchor); + m: function mount(target, anchor) { + if_block.m(target, anchor); insertNode(if_block_anchor, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (current_block_type !== (current_block_type = select_block_type(state))) { - if_block.unmount(); - if_block.destroy(); + if_block.u(); + if_block.d(); if_block = current_block_type(state, component); - if_block.create(); - if_block.mount(if_block_anchor.parentNode, if_block_anchor); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); } }, - unmount: function() { - if_block.unmount(); + u: function unmount() { + if_block.u(); detachNode(if_block_anchor); }, - destroy: function() { - if_block.destroy(); + d: function destroy() { + if_block.d(); } }; } @@ -44,20 +44,20 @@ function create_if_block(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "foo!"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -66,20 +66,20 @@ function create_if_block_1(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "not foo!"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -95,8 +95,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index 9f3c06d6a0..9c99dd0275 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -38,8 +38,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -151,7 +151,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -160,11 +160,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -188,37 +188,37 @@ function create_main_fragment(state, component) { var if_block = (state.foo) && create_if_block(state, component); return { - create: function() { - if (if_block) if_block.create(); + c: function create() { + if (if_block) if_block.c(); if_block_anchor = createComment(); }, - mount: function(target, anchor) { - if (if_block) if_block.mount(target, anchor); + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); insertNode(if_block_anchor, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (state.foo) { if (!if_block) { if_block = create_if_block(state, component); - if_block.create(); - if_block.mount(if_block_anchor.parentNode, if_block_anchor); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); } } else if (if_block) { - if_block.unmount(); - if_block.destroy(); + if_block.u(); + if_block.d(); if_block = null; } }, - unmount: function() { - if (if_block) if_block.unmount(); + u: function unmount() { + if (if_block) if_block.u(); detachNode(if_block_anchor); }, - destroy: function() { - if (if_block) if_block.destroy(); + d: function destroy$$1() { + if (if_block) if_block.d(); } }; } @@ -228,20 +228,20 @@ function create_if_block(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "foo!"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -252,8 +252,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/if-block-simple/expected.js b/test/js/samples/if-block-simple/expected.js index 67ef669468..9bfd8e211d 100644 --- a/test/js/samples/if-block-simple/expected.js +++ b/test/js/samples/if-block-simple/expected.js @@ -7,37 +7,37 @@ function create_main_fragment(state, component) { var if_block = (state.foo) && create_if_block(state, component); return { - create: function() { - if (if_block) if_block.create(); + c: function create() { + if (if_block) if_block.c(); if_block_anchor = createComment(); }, - mount: function(target, anchor) { - if (if_block) if_block.mount(target, anchor); + m: function mount(target, anchor) { + if (if_block) if_block.m(target, anchor); insertNode(if_block_anchor, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (state.foo) { if (!if_block) { if_block = create_if_block(state, component); - if_block.create(); - if_block.mount(if_block_anchor.parentNode, if_block_anchor); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); } } else if (if_block) { - if_block.unmount(); - if_block.destroy(); + if_block.u(); + if_block.d(); if_block = null; } }, - unmount: function() { - if (if_block) if_block.unmount(); + u: function unmount() { + if (if_block) if_block.u(); detachNode(if_block_anchor); }, - destroy: function() { - if (if_block) if_block.destroy(); + d: function destroy() { + if (if_block) if_block.d(); } }; } @@ -47,20 +47,20 @@ function create_if_block(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "foo!"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -71,8 +71,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js index 745f0a2f26..80998f97b2 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js @@ -38,8 +38,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -151,7 +151,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -160,11 +160,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -186,21 +186,21 @@ function create_main_fragment(state, component) { var div; return { - create: function() { + c: function create() { div = createElement("div"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { setStyle(div, "color", state.color); setStyle(div, "transform", "translate(" + state.x + "px," + state.y + "px)"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (changed.color) { setStyle(div, "color", state.color); } @@ -210,11 +210,11 @@ function create_main_fragment(state, component) { } }, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -225,8 +225,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-optimized-multiple/expected.js b/test/js/samples/inline-style-optimized-multiple/expected.js index 35de49a17c..a92f5d3053 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected.js +++ b/test/js/samples/inline-style-optimized-multiple/expected.js @@ -5,21 +5,21 @@ function create_main_fragment(state, component) { var div; return { - create: function() { + c: function create() { div = createElement("div"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { setStyle(div, "color", state.color); setStyle(div, "transform", "translate(" + state.x + "px," + state.y + "px)"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (changed.color) { setStyle(div, "color", state.color); } @@ -29,11 +29,11 @@ function create_main_fragment(state, component) { } }, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -44,8 +44,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-optimized-url/expected-bundle.js b/test/js/samples/inline-style-optimized-url/expected-bundle.js index 2985f7cb15..236aaee071 100644 --- a/test/js/samples/inline-style-optimized-url/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js @@ -38,8 +38,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -151,7 +151,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -160,11 +160,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -186,30 +186,30 @@ function create_main_fragment(state, component) { var div; return { - create: function() { + c: function create() { div = createElement("div"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { setStyle(div, "background", "url(data:image/png;base64," + state.data + ")"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (changed.data) { setStyle(div, "background", "url(data:image/png;base64," + state.data + ")"); } }, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -220,8 +220,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-optimized-url/expected.js b/test/js/samples/inline-style-optimized-url/expected.js index 659bc4b20b..e10acd8dd8 100644 --- a/test/js/samples/inline-style-optimized-url/expected.js +++ b/test/js/samples/inline-style-optimized-url/expected.js @@ -5,30 +5,30 @@ function create_main_fragment(state, component) { var div; return { - create: function() { + c: function create() { div = createElement("div"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { setStyle(div, "background", "url(data:image/png;base64," + state.data + ")"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (changed.data) { setStyle(div, "background", "url(data:image/png;base64," + state.data + ")"); } }, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -39,8 +39,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js index fa4dfc93a9..f8084094be 100644 --- a/test/js/samples/inline-style-optimized/expected-bundle.js +++ b/test/js/samples/inline-style-optimized/expected-bundle.js @@ -38,8 +38,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -151,7 +151,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -160,11 +160,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -186,30 +186,30 @@ function create_main_fragment(state, component) { var div; return { - create: function() { + c: function create() { div = createElement("div"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { setStyle(div, "color", state.color); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (changed.color) { setStyle(div, "color", state.color); } }, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -220,8 +220,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-optimized/expected.js b/test/js/samples/inline-style-optimized/expected.js index 8b07a3eaad..e9d42fec07 100644 --- a/test/js/samples/inline-style-optimized/expected.js +++ b/test/js/samples/inline-style-optimized/expected.js @@ -5,30 +5,30 @@ function create_main_fragment(state, component) { var div; return { - create: function() { + c: function create() { div = createElement("div"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { setStyle(div, "color", state.color); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (changed.color) { setStyle(div, "color", state.color); } }, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -39,8 +39,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js index e0770b55c7..d0b2a2dcfe 100644 --- a/test/js/samples/inline-style-unoptimized/expected-bundle.js +++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js @@ -38,8 +38,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -151,7 +151,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -160,11 +160,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -186,25 +186,25 @@ function create_main_fragment(state, component) { var div, text, div_1, div_1_style_value; return { - create: function() { + c: function create() { div = createElement("div"); text = createText("\n"); div_1 = createElement("div"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { div.style.cssText = state.style; div_1.style.cssText = div_1_style_value = "" + state.key + ": " + state.value; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); insertNode(text, target, anchor); insertNode(div_1, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (changed.style) { div.style.cssText = state.style; } @@ -214,13 +214,13 @@ function create_main_fragment(state, component) { } }, - unmount: function() { + u: function unmount() { detachNode(div); detachNode(text); detachNode(div_1); }, - destroy: noop + d: noop }; } @@ -231,8 +231,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/inline-style-unoptimized/expected.js b/test/js/samples/inline-style-unoptimized/expected.js index 9dcb2296bb..b2b4f5ad53 100644 --- a/test/js/samples/inline-style-unoptimized/expected.js +++ b/test/js/samples/inline-style-unoptimized/expected.js @@ -5,25 +5,25 @@ function create_main_fragment(state, component) { var div, text, div_1, div_1_style_value; return { - create: function() { + c: function create() { div = createElement("div"); text = createText("\n"); div_1 = createElement("div"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { div.style.cssText = state.style; div_1.style.cssText = div_1_style_value = "" + state.key + ": " + state.value; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); insertNode(text, target, anchor); insertNode(div_1, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (changed.style) { div.style.cssText = state.style; } @@ -33,13 +33,13 @@ function create_main_fragment(state, component) { } }, - unmount: function() { + u: function unmount() { detachNode(div); detachNode(text); detachNode(div_1); }, - destroy: noop + d: noop }; } @@ -50,8 +50,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/input-without-blowback-guard/expected-bundle.js b/test/js/samples/input-without-blowback-guard/expected-bundle.js index 8a0c36accc..792342604d 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -42,8 +42,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -155,7 +155,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -164,11 +164,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -194,31 +194,31 @@ function create_main_fragment(state, component) { } return { - create: function() { + c: function create() { input = createElement("input"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { input.type = "checkbox"; addListener(input, "change", input_change_handler); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(input, target, anchor); input.checked = state.foo; }, - update: function(changed, state) { + p: function update(changed, state) { input.checked = state.foo; }, - unmount: function() { + u: function unmount() { detachNode(input); }, - destroy: function() { + d: function destroy$$1() { removeListener(input, "change", input_change_handler); } }; @@ -231,8 +231,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/input-without-blowback-guard/expected.js b/test/js/samples/input-without-blowback-guard/expected.js index 074a6126eb..f9ae72b1bd 100644 --- a/test/js/samples/input-without-blowback-guard/expected.js +++ b/test/js/samples/input-without-blowback-guard/expected.js @@ -9,31 +9,31 @@ function create_main_fragment(state, component) { } return { - create: function() { + c: function create() { input = createElement("input"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { input.type = "checkbox"; addListener(input, "change", input_change_handler); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(input, target, anchor); input.checked = state.foo; }, - update: function(changed, state) { + p: function update(changed, state) { input.checked = state.foo; }, - unmount: function() { + u: function unmount() { detachNode(input); }, - destroy: function() { + d: function destroy() { removeListener(input, "change", input_change_handler); } }; @@ -46,8 +46,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js index 6475e22fa8..26f30cf194 100644 --- a/test/js/samples/legacy-input-type/expected-bundle.js +++ b/test/js/samples/legacy-input-type/expected-bundle.js @@ -40,8 +40,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -153,7 +153,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -162,11 +162,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -188,26 +188,26 @@ function create_main_fragment(state, component) { var input; return { - create: function() { + c: function create() { input = createElement("input"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { setInputType(input, "search"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(input, target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(input); }, - destroy: noop + d: noop }; } @@ -218,8 +218,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/legacy-input-type/expected.js b/test/js/samples/legacy-input-type/expected.js index c7785c6ed4..5309c86cfd 100644 --- a/test/js/samples/legacy-input-type/expected.js +++ b/test/js/samples/legacy-input-type/expected.js @@ -5,26 +5,26 @@ function create_main_fragment(state, component) { var input; return { - create: function() { + c: function create() { input = createElement("input"); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { setInputType(input, "search"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(input, target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(input); }, - destroy: noop + d: noop }; } @@ -35,8 +35,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/legacy-quote-class/expected-bundle.js b/test/js/samples/legacy-quote-class/expected-bundle.js index 139958519b..3be6136b4a 100644 --- a/test/js/samples/legacy-quote-class/expected-bundle.js +++ b/test/js/samples/legacy-quote-class/expected-bundle.js @@ -57,8 +57,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -170,7 +170,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -179,11 +179,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -205,34 +205,34 @@ function create_main_fragment(state, component) { var div; return { - create: function() { + c: function create() { div = createElement("div"); - this.hydrate(); + this.h(); }, - claim: function(nodes) { + l: function claim(nodes) { div = claimElement(nodes, "DIV", { "class": true }, false); var div_nodes = children(div); div_nodes.forEach(detachNode); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { div.className = "foo"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -244,9 +244,9 @@ function SvelteComponent(options) { if (options.target) { var nodes = children(options.target); - options.hydrate ? this._fragment.claim(nodes) : this._fragment.create(); + options.hydrate ? this._fragment.l(nodes) : this._fragment.c(); nodes.forEach(detachNode); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/legacy-quote-class/expected.js b/test/js/samples/legacy-quote-class/expected.js index dd10330458..82eebe600c 100644 --- a/test/js/samples/legacy-quote-class/expected.js +++ b/test/js/samples/legacy-quote-class/expected.js @@ -5,34 +5,34 @@ function create_main_fragment(state, component) { var div; return { - create: function() { + c: function create() { div = createElement("div"); - this.hydrate(); + this.h(); }, - claim: function(nodes) { + l: function claim(nodes) { div = claimElement(nodes, "DIV", { "class": true }, false); var div_nodes = children(div); div_nodes.forEach(detachNode); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { div.className = "foo"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -44,9 +44,9 @@ function SvelteComponent(options) { if (options.target) { var nodes = children(options.target); - options.hydrate ? this._fragment.claim(nodes) : this._fragment.create(); + options.hydrate ? this._fragment.l(nodes) : this._fragment.c(); nodes.forEach(detachNode); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js index d784e6fabe..820db0a4fe 100644 --- a/test/js/samples/media-bindings/expected-bundle.js +++ b/test/js/samples/media-bindings/expected-bundle.js @@ -50,8 +50,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -163,7 +163,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -172,11 +172,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -236,13 +236,13 @@ function create_main_fragment(state, component) { } return { - create: function() { + c: function create() { audio = createElement("audio"); addListener(audio, "play", audio_pause_handler); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { component._root._beforecreate.push(audio_progress_loadedmetadata_handler); addListener(audio, "progress", audio_progress_loadedmetadata_handler); @@ -269,11 +269,11 @@ function create_main_fragment(state, component) { addListener(audio, "pause", audio_pause_handler); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(audio, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (!audio_updating && !isNaN(state.currentTime )) { audio.currentTime = state.currentTime ; } @@ -283,11 +283,11 @@ function create_main_fragment(state, component) { } }, - unmount: function() { + u: function unmount() { detachNode(audio); }, - destroy: function() { + d: function destroy$$1() { removeListener(audio, "progress", audio_progress_loadedmetadata_handler); removeListener(audio, "loadedmetadata", audio_progress_loadedmetadata_handler); removeListener(audio, "loadedmetadata", audio_loadedmetadata_handler); @@ -312,8 +312,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); callAll(this._beforecreate); } diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js index 531a2a1b58..832826ffd5 100644 --- a/test/js/samples/media-bindings/expected.js +++ b/test/js/samples/media-bindings/expected.js @@ -43,13 +43,13 @@ function create_main_fragment(state, component) { } return { - create: function() { + c: function create() { audio = createElement("audio"); addListener(audio, "play", audio_pause_handler); - this.hydrate(); + this.h(); }, - hydrate: function() { + h: function hydrate() { component._root._beforecreate.push(audio_progress_loadedmetadata_handler); addListener(audio, "progress", audio_progress_loadedmetadata_handler); @@ -76,11 +76,11 @@ function create_main_fragment(state, component) { addListener(audio, "pause", audio_pause_handler); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(audio, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (!audio_updating && !isNaN(state.currentTime )) { audio.currentTime = state.currentTime ; } @@ -90,11 +90,11 @@ function create_main_fragment(state, component) { } }, - unmount: function() { + u: function unmount() { detachNode(audio); }, - destroy: function() { + d: function destroy() { removeListener(audio, "progress", audio_progress_loadedmetadata_handler); removeListener(audio, "loadedmetadata", audio_progress_loadedmetadata_handler); removeListener(audio, "loadedmetadata", audio_loadedmetadata_handler); @@ -119,8 +119,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); callAll(this._beforecreate); } diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index 2252eb1635..f6cd719f54 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -36,8 +36,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -149,7 +149,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -158,11 +158,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -200,27 +200,27 @@ function create_main_fragment(state, component) { }); return { - create: function() { - imported._fragment.create(); + c: function create() { + imported._fragment.c(); text = createText("\n"); - nonimported._fragment.create(); + nonimported._fragment.c(); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { imported._mount(target, anchor); insertNode(text, target, anchor); nonimported._mount(target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { imported._unmount(); detachNode(text); nonimported._unmount(); }, - destroy: function() { + d: function destroy$$1() { imported.destroy(false); nonimported.destroy(false); } @@ -240,8 +240,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/non-imported-component/expected.js b/test/js/samples/non-imported-component/expected.js index e424bb6ffd..aee3a35280 100644 --- a/test/js/samples/non-imported-component/expected.js +++ b/test/js/samples/non-imported-component/expected.js @@ -22,27 +22,27 @@ function create_main_fragment(state, component) { }); return { - create: function() { - imported._fragment.create(); + c: function create() { + imported._fragment.c(); text = createText("\n"); - nonimported._fragment.create(); + nonimported._fragment.c(); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { imported._mount(target, anchor); insertNode(text, target, anchor); nonimported._mount(target, anchor); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { imported._unmount(); detachNode(text); nonimported._unmount(); }, - destroy: function() { + d: function destroy() { imported.destroy(false); nonimported.destroy(false); } @@ -62,8 +62,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); this._lock = true; callAll(this._beforecreate); diff --git a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js index bebd336b6c..57bbff1fc0 100644 --- a/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js +++ b/test/js/samples/onrender-onteardown-rewritten/expected-bundle.js @@ -22,8 +22,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -135,7 +135,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -144,11 +144,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -177,15 +177,15 @@ var template = (function() { function create_main_fragment(state, component) { return { - create: noop, + c: noop, - mount: noop, + m: noop, - update: noop, + p: noop, - unmount: noop, + u: noop, - destroy: noop + d: noop }; } @@ -206,8 +206,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); callAll(this._oncreate); } diff --git a/test/js/samples/onrender-onteardown-rewritten/expected.js b/test/js/samples/onrender-onteardown-rewritten/expected.js index d29f9fd752..0464d7a0d2 100644 --- a/test/js/samples/onrender-onteardown-rewritten/expected.js +++ b/test/js/samples/onrender-onteardown-rewritten/expected.js @@ -12,15 +12,15 @@ var template = (function() { function create_main_fragment(state, component) { return { - create: noop, + c: noop, - mount: noop, + m: noop, - update: noop, + p: noop, - unmount: noop, + u: noop, - destroy: noop + d: noop }; } @@ -41,8 +41,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); callAll(this._oncreate); } diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index 85bc643281..145647d7c2 100644 --- a/test/js/samples/setup-method/expected-bundle.js +++ b/test/js/samples/setup-method/expected-bundle.js @@ -22,8 +22,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -135,7 +135,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -144,11 +144,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -188,15 +188,15 @@ var template = (function() { function create_main_fragment(state, component) { return { - create: noop, + c: noop, - mount: noop, + m: noop, - update: noop, + p: noop, - unmount: noop, + u: noop, - destroy: noop + d: noop }; } @@ -207,8 +207,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/setup-method/expected.js b/test/js/samples/setup-method/expected.js index b3bd9fcc8e..e7cd138aa3 100644 --- a/test/js/samples/setup-method/expected.js +++ b/test/js/samples/setup-method/expected.js @@ -23,15 +23,15 @@ var template = (function() { function create_main_fragment(state, component) { return { - create: noop, + c: noop, - mount: noop, + m: noop, - update: noop, + p: noop, - unmount: noop, + u: noop, - destroy: noop + d: noop }; } @@ -42,8 +42,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/use-elements-as-anchors/expected-bundle.js b/test/js/samples/use-elements-as-anchors/expected-bundle.js index 1541e69175..92e3f9bbd3 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -46,8 +46,8 @@ function destroy(detach) { this.fire('destroy'); this.set = this.get = noop; - if (detach !== false) this._fragment.unmount(); - this._fragment.destroy(); + if (detach !== false) this._fragment.u(); + this._fragment.d(); this._fragment = this._state = null; } @@ -159,7 +159,7 @@ function _set(newState) { this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); dispatchObservers(this, this._observers.pre, changed, this._state, oldState); - this._fragment.update(changed, this._state); + this._fragment.p(changed, this._state); dispatchObservers(this, this._observers.post, changed, this._state, oldState); } @@ -168,11 +168,11 @@ function callAll(fns) { } function _mount(target, anchor) { - this._fragment.mount(target, anchor); + this._fragment.m(target, anchor); } function _unmount() { - this._fragment.unmount(); + this._fragment.u(); } var proto = { @@ -204,123 +204,123 @@ function create_main_fragment(state, component) { var if_block_4 = (state.e) && create_if_block_4(state, component); return { - create: function() { + c: function create() { div = createElement("div"); - if (if_block) if_block.create(); + if (if_block) if_block.c(); text = createText("\n\n\t"); p = createElement("p"); p.textContent = "this can be used as an anchor"; text_2 = createText("\n\n\t"); - if (if_block_1) if_block_1.create(); + if (if_block_1) if_block_1.c(); text_3 = createText("\n\n\t"); - if (if_block_2) if_block_2.create(); + if (if_block_2) if_block_2.c(); text_4 = createText("\n\n\t"); p_1 = createElement("p"); p_1.textContent = "so can this"; text_6 = createText("\n\n\t"); - if (if_block_3) if_block_3.create(); + if (if_block_3) if_block_3.c(); text_8 = createText("\n\n"); - if (if_block_4) if_block_4.create(); + if (if_block_4) if_block_4.c(); if_block_4_anchor = createComment(); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); - if (if_block) if_block.mount(div, null); + if (if_block) if_block.m(div, null); appendNode(text, div); appendNode(p, div); appendNode(text_2, div); - if (if_block_1) if_block_1.mount(div, null); + if (if_block_1) if_block_1.m(div, null); appendNode(text_3, div); - if (if_block_2) if_block_2.mount(div, null); + if (if_block_2) if_block_2.m(div, null); appendNode(text_4, div); appendNode(p_1, div); appendNode(text_6, div); - if (if_block_3) if_block_3.mount(div, null); + if (if_block_3) if_block_3.m(div, null); insertNode(text_8, target, anchor); - if (if_block_4) if_block_4.mount(target, anchor); + if (if_block_4) if_block_4.m(target, anchor); insertNode(if_block_4_anchor, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (state.a) { if (!if_block) { if_block = create_if_block(state, component); - if_block.create(); - if_block.mount(div, text); + if_block.c(); + if_block.m(div, text); } } else if (if_block) { - if_block.unmount(); - if_block.destroy(); + if_block.u(); + if_block.d(); if_block = null; } if (state.b) { if (!if_block_1) { if_block_1 = create_if_block_1(state, component); - if_block_1.create(); - if_block_1.mount(div, text_3); + if_block_1.c(); + if_block_1.m(div, text_3); } } else if (if_block_1) { - if_block_1.unmount(); - if_block_1.destroy(); + if_block_1.u(); + if_block_1.d(); if_block_1 = null; } if (state.c) { if (!if_block_2) { if_block_2 = create_if_block_2(state, component); - if_block_2.create(); - if_block_2.mount(div, text_4); + if_block_2.c(); + if_block_2.m(div, text_4); } } else if (if_block_2) { - if_block_2.unmount(); - if_block_2.destroy(); + if_block_2.u(); + if_block_2.d(); if_block_2 = null; } if (state.d) { if (!if_block_3) { if_block_3 = create_if_block_3(state, component); - if_block_3.create(); - if_block_3.mount(div, null); + if_block_3.c(); + if_block_3.m(div, null); } } else if (if_block_3) { - if_block_3.unmount(); - if_block_3.destroy(); + if_block_3.u(); + if_block_3.d(); if_block_3 = null; } if (state.e) { if (!if_block_4) { if_block_4 = create_if_block_4(state, component); - if_block_4.create(); - if_block_4.mount(if_block_4_anchor.parentNode, if_block_4_anchor); + if_block_4.c(); + if_block_4.m(if_block_4_anchor.parentNode, if_block_4_anchor); } } else if (if_block_4) { - if_block_4.unmount(); - if_block_4.destroy(); + if_block_4.u(); + if_block_4.d(); if_block_4 = null; } }, - unmount: function() { + u: function unmount() { detachNode(div); - if (if_block) if_block.unmount(); - if (if_block_1) if_block_1.unmount(); - if (if_block_2) if_block_2.unmount(); - if (if_block_3) if_block_3.unmount(); + if (if_block) if_block.u(); + if (if_block_1) if_block_1.u(); + if (if_block_2) if_block_2.u(); + if (if_block_3) if_block_3.u(); detachNode(text_8); - if (if_block_4) if_block_4.unmount(); + if (if_block_4) if_block_4.u(); detachNode(if_block_4_anchor); }, - destroy: function() { - if (if_block) if_block.destroy(); - if (if_block_1) if_block_1.destroy(); - if (if_block_2) if_block_2.destroy(); - if (if_block_3) if_block_3.destroy(); - if (if_block_4) if_block_4.destroy(); + d: function destroy$$1() { + if (if_block) if_block.d(); + if (if_block_1) if_block_1.d(); + if (if_block_2) if_block_2.d(); + if (if_block_3) if_block_3.d(); + if (if_block_4) if_block_4.d(); } }; } @@ -330,20 +330,20 @@ function create_if_block(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "a"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -352,20 +352,20 @@ function create_if_block_1(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "b"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -374,20 +374,20 @@ function create_if_block_2(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "c"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -396,20 +396,20 @@ function create_if_block_3(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "d"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -418,20 +418,20 @@ function create_if_block_4(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "e"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -442,8 +442,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } } diff --git a/test/js/samples/use-elements-as-anchors/expected.js b/test/js/samples/use-elements-as-anchors/expected.js index 2a1b93eb36..f23b9ec205 100644 --- a/test/js/samples/use-elements-as-anchors/expected.js +++ b/test/js/samples/use-elements-as-anchors/expected.js @@ -15,123 +15,123 @@ function create_main_fragment(state, component) { var if_block_4 = (state.e) && create_if_block_4(state, component); return { - create: function() { + c: function create() { div = createElement("div"); - if (if_block) if_block.create(); + if (if_block) if_block.c(); text = createText("\n\n\t"); p = createElement("p"); p.textContent = "this can be used as an anchor"; text_2 = createText("\n\n\t"); - if (if_block_1) if_block_1.create(); + if (if_block_1) if_block_1.c(); text_3 = createText("\n\n\t"); - if (if_block_2) if_block_2.create(); + if (if_block_2) if_block_2.c(); text_4 = createText("\n\n\t"); p_1 = createElement("p"); p_1.textContent = "so can this"; text_6 = createText("\n\n\t"); - if (if_block_3) if_block_3.create(); + if (if_block_3) if_block_3.c(); text_8 = createText("\n\n"); - if (if_block_4) if_block_4.create(); + if (if_block_4) if_block_4.c(); if_block_4_anchor = createComment(); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); - if (if_block) if_block.mount(div, null); + if (if_block) if_block.m(div, null); appendNode(text, div); appendNode(p, div); appendNode(text_2, div); - if (if_block_1) if_block_1.mount(div, null); + if (if_block_1) if_block_1.m(div, null); appendNode(text_3, div); - if (if_block_2) if_block_2.mount(div, null); + if (if_block_2) if_block_2.m(div, null); appendNode(text_4, div); appendNode(p_1, div); appendNode(text_6, div); - if (if_block_3) if_block_3.mount(div, null); + if (if_block_3) if_block_3.m(div, null); insertNode(text_8, target, anchor); - if (if_block_4) if_block_4.mount(target, anchor); + if (if_block_4) if_block_4.m(target, anchor); insertNode(if_block_4_anchor, target, anchor); }, - update: function(changed, state) { + p: function update(changed, state) { if (state.a) { if (!if_block) { if_block = create_if_block(state, component); - if_block.create(); - if_block.mount(div, text); + if_block.c(); + if_block.m(div, text); } } else if (if_block) { - if_block.unmount(); - if_block.destroy(); + if_block.u(); + if_block.d(); if_block = null; } if (state.b) { if (!if_block_1) { if_block_1 = create_if_block_1(state, component); - if_block_1.create(); - if_block_1.mount(div, text_3); + if_block_1.c(); + if_block_1.m(div, text_3); } } else if (if_block_1) { - if_block_1.unmount(); - if_block_1.destroy(); + if_block_1.u(); + if_block_1.d(); if_block_1 = null; } if (state.c) { if (!if_block_2) { if_block_2 = create_if_block_2(state, component); - if_block_2.create(); - if_block_2.mount(div, text_4); + if_block_2.c(); + if_block_2.m(div, text_4); } } else if (if_block_2) { - if_block_2.unmount(); - if_block_2.destroy(); + if_block_2.u(); + if_block_2.d(); if_block_2 = null; } if (state.d) { if (!if_block_3) { if_block_3 = create_if_block_3(state, component); - if_block_3.create(); - if_block_3.mount(div, null); + if_block_3.c(); + if_block_3.m(div, null); } } else if (if_block_3) { - if_block_3.unmount(); - if_block_3.destroy(); + if_block_3.u(); + if_block_3.d(); if_block_3 = null; } if (state.e) { if (!if_block_4) { if_block_4 = create_if_block_4(state, component); - if_block_4.create(); - if_block_4.mount(if_block_4_anchor.parentNode, if_block_4_anchor); + if_block_4.c(); + if_block_4.m(if_block_4_anchor.parentNode, if_block_4_anchor); } } else if (if_block_4) { - if_block_4.unmount(); - if_block_4.destroy(); + if_block_4.u(); + if_block_4.d(); if_block_4 = null; } }, - unmount: function() { + u: function unmount() { detachNode(div); - if (if_block) if_block.unmount(); - if (if_block_1) if_block_1.unmount(); - if (if_block_2) if_block_2.unmount(); - if (if_block_3) if_block_3.unmount(); + if (if_block) if_block.u(); + if (if_block_1) if_block_1.u(); + if (if_block_2) if_block_2.u(); + if (if_block_3) if_block_3.u(); detachNode(text_8); - if (if_block_4) if_block_4.unmount(); + if (if_block_4) if_block_4.u(); detachNode(if_block_4_anchor); }, - destroy: function() { - if (if_block) if_block.destroy(); - if (if_block_1) if_block_1.destroy(); - if (if_block_2) if_block_2.destroy(); - if (if_block_3) if_block_3.destroy(); - if (if_block_4) if_block_4.destroy(); + d: function destroy() { + if (if_block) if_block.d(); + if (if_block_1) if_block_1.d(); + if (if_block_2) if_block_2.d(); + if (if_block_3) if_block_3.d(); + if (if_block_4) if_block_4.d(); } }; } @@ -141,20 +141,20 @@ function create_if_block(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "a"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -163,20 +163,20 @@ function create_if_block_1(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "b"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -185,20 +185,20 @@ function create_if_block_2(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "c"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -207,20 +207,20 @@ function create_if_block_3(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "d"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -229,20 +229,20 @@ function create_if_block_4(state, component) { var p; return { - create: function() { + c: function create() { p = createElement("p"); p.textContent = "e"; }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -253,8 +253,8 @@ function SvelteComponent(options) { this._fragment = create_main_fragment(this._state, this); if (options.target) { - this._fragment.create(); - this._fragment.mount(options.target, options.anchor || null); + this._fragment.c(); + this._fragment.m(options.target, options.anchor || null); } }