From 2b2a1b40cea1c53bcaf7b236e90f6b7596296c6b Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 18 Sep 2017 22:00:28 -0400 Subject: [PATCH] use short method names --- src/generators/dom/Block.ts | 43 +++--- src/generators/dom/index.ts | 10 +- src/generators/dom/visitors/Component.ts | 4 +- src/generators/dom/visitors/EachBlock.ts | 82 +++++----- src/generators/dom/visitors/IfBlock.ts | 76 ++++----- src/shared/dom.js | 2 +- src/shared/index.js | 10 +- .../expected-bundle.js | 28 ++-- .../expected.js | 18 +-- .../component-static/expected-bundle.js | 26 ++-- test/js/samples/component-static/expected.js | 16 +- .../computed-collapsed-if/expected-bundle.js | 24 +-- .../samples/computed-collapsed-if/expected.js | 14 +- .../css-media-query/expected-bundle.js | 28 ++-- test/js/samples/css-media-query/expected.js | 18 +-- .../expected-bundle.js | 24 +-- .../css-shadow-dom-keyframes/expected.js | 14 +- .../expected-bundle.js | 56 +++---- .../each-block-changed-check/expected.js | 44 +++--- .../event-handlers-custom/expected-bundle.js | 28 ++-- .../samples/event-handlers-custom/expected.js | 18 +-- .../if-block-no-update/expected-bundle.js | 56 +++---- .../js/samples/if-block-no-update/expected.js | 46 +++--- .../if-block-simple/expected-bundle.js | 48 +++--- test/js/samples/if-block-simple/expected.js | 38 ++--- .../expected-bundle.js | 28 ++-- .../expected.js | 18 +-- .../expected-bundle.js | 28 ++-- .../inline-style-optimized-url/expected.js | 18 +-- .../inline-style-optimized/expected-bundle.js | 28 ++-- .../inline-style-optimized/expected.js | 18 +-- .../expected-bundle.js | 28 ++-- .../inline-style-unoptimized/expected.js | 18 +-- .../expected-bundle.js | 28 ++-- .../input-without-blowback-guard/expected.js | 18 +-- .../legacy-input-type/expected-bundle.js | 28 ++-- test/js/samples/legacy-input-type/expected.js | 18 +-- .../legacy-quote-class/expected-bundle.js | 32 ++-- .../js/samples/legacy-quote-class/expected.js | 22 +-- .../samples/media-bindings/expected-bundle.js | 28 ++-- test/js/samples/media-bindings/expected.js | 18 +-- .../non-imported-component/expected-bundle.js | 28 ++-- .../non-imported-component/expected.js | 18 +-- .../expected-bundle.js | 24 +-- .../onrender-onteardown-rewritten/expected.js | 14 +- .../samples/setup-method/expected-bundle.js | 24 +-- test/js/samples/setup-method/expected.js | 14 +- .../expected-bundle.js | 144 +++++++++--------- .../use-elements-as-anchors/expected.js | 134 ++++++++-------- 49 files changed, 774 insertions(+), 773 deletions(-) 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 9633eb34a2..581ee0187b 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 dcc47255b3..5918040b0c 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 = { @@ -214,32 +214,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 }; } @@ -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/collapses-text-around-comments/expected.js b/test/js/samples/collapses-text-around-comments/expected.js index caa1bc886b..2dc66cfeea 100644 --- a/test/js/samples/collapses-text-around-comments/expected.js +++ b/test/js/samples/collapses-text-around-comments/expected.js @@ -25,32 +25,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 }; } @@ -63,8 +63,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 2dbef4a1b1..901e40935d 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 = { @@ -183,21 +183,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); } }; @@ -216,8 +216,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 e6f5d12eb7..e7eef6355f 100644 --- a/test/js/samples/component-static/expected.js +++ b/test/js/samples/component-static/expected.js @@ -18,21 +18,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); } }; @@ -51,8 +51,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 752455d407..8863885909 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 = { @@ -179,15 +179,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 }; } @@ -199,8 +199,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 097e5557c8..8ebcd4fa86 100644 --- a/test/js/samples/computed-collapsed-if/expected.js +++ b/test/js/samples/computed-collapsed-if/expected.js @@ -14,15 +14,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 }; } @@ -34,8 +34,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 8268700417..77b9610644 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 = { @@ -202,26 +202,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 }; } @@ -234,8 +234,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 a87dfb878d..5a33892097 100644 --- a/test/js/samples/css-media-query/expected.js +++ b/test/js/samples/css-media-query/expected.js @@ -17,26 +17,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 }; } @@ -49,8 +49,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 4761ffe62c..b0b88edeeb 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/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 = { @@ -191,23 +191,23 @@ function create_main_fragment(state, component) { var div, text; return { - create: function() { + c: function create() { div = createElement("div"); text = createText("fades in"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); appendNode(text, div); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -222,8 +222,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 4268c29877..8ad2ca1cc1 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected.js @@ -6,23 +6,23 @@ function create_main_fragment(state, component) { var div, text; return { - create: function() { + c: function create() { div = createElement("div"); text = createText("fades in"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(div, target, anchor); appendNode(text, div); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -37,8 +37,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 fdb4100a92..2bbbba75d2 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 = { @@ -211,9 +211,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"); @@ -221,9 +221,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); @@ -231,23 +231,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; } @@ -257,16 +257,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); } }; @@ -277,7 +277,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); @@ -289,15 +289,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); @@ -312,7 +312,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; } @@ -327,13 +327,13 @@ function create_each_block(state, comments, comment, i, component) { } }, - unmount: function() { + u: function unmount() { detachAfter(raw_before); detachNode(div); }, - destroy: noop + d: noop }; } @@ -344,8 +344,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 d7bc0e680b..578b25a17d 100644 --- a/test/js/samples/each-block-changed-check/expected.js +++ b/test/js/samples/each-block-changed-check/expected.js @@ -14,9 +14,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"); @@ -24,9 +24,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); @@ -34,23 +34,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; } @@ -60,16 +60,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); } }; @@ -80,7 +80,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); @@ -92,15 +92,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); @@ -115,7 +115,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; } @@ -130,13 +130,13 @@ function create_each_block(state, comments, comment, i, component) { } }, - unmount: function() { + u: function unmount() { detachAfter(raw_before); detachNode(div); }, - destroy: noop + d: noop }; } @@ -147,8 +147,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 028e471852..4a0eba647a 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/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 = { @@ -206,31 +206,31 @@ function create_main_fragment(state, component) { var button, foo_handler, text; return { - create: function() { + c: function create() { button = createElement("button"); text = createText("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); appendNode(text, button); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(button); }, - destroy: function() { + d: function destroy$$1() { foo_handler.teardown(); } }; @@ -243,8 +243,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 1891835aa1..2dcd28dd80 100644 --- a/test/js/samples/event-handlers-custom/expected.js +++ b/test/js/samples/event-handlers-custom/expected.js @@ -21,31 +21,31 @@ function create_main_fragment(state, component) { var button, foo_handler, text; return { - create: function() { + c: function create() { button = createElement("button"); text = createText("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); appendNode(text, button); }, - update: noop, + p: noop, - unmount: function() { + u: function unmount() { detachNode(button); }, - destroy: function() { + d: function destroy() { foo_handler.teardown(); } }; @@ -58,8 +58,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 d68a947cdb..fa03b2cd89 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/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 = { @@ -198,33 +198,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(); } }; } @@ -234,21 +234,21 @@ function create_if_block(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("foo!"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -257,21 +257,21 @@ function create_if_block_1(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("not foo!"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -287,8 +287,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 38600d30d4..8095cb6a03 100644 --- a/test/js/samples/if-block-no-update/expected.js +++ b/test/js/samples/if-block-no-update/expected.js @@ -9,33 +9,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(); } }; } @@ -45,21 +45,21 @@ function create_if_block(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("foo!"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -68,21 +68,21 @@ function create_if_block_1(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("not foo!"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -98,8 +98,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 45ddba0cff..b5244296d6 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/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 = { @@ -197,37 +197,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(); } }; } @@ -237,21 +237,21 @@ function create_if_block(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("foo!"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -262,8 +262,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 81a5ffc975..12071722c0 100644 --- a/test/js/samples/if-block-simple/expected.js +++ b/test/js/samples/if-block-simple/expected.js @@ -8,37 +8,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(); } }; } @@ -48,21 +48,21 @@ function create_if_block(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("foo!"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -73,8 +73,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 3f794ba7ac..07e0c3b741 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 = { @@ -187,21 +187,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); } @@ -211,11 +211,11 @@ function create_main_fragment(state, component) { } }, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -226,8 +226,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 45f2a50c2a..87531b7dd4 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected.js +++ b/test/js/samples/inline-style-optimized-multiple/expected.js @@ -6,21 +6,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); } @@ -30,11 +30,11 @@ function create_main_fragment(state, component) { } }, - unmount: function() { + u: function unmount() { detachNode(div); }, - destroy: noop + d: noop }; } @@ -45,8 +45,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 18205758cc..a8a483f6c0 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 = { @@ -187,30 +187,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 }; } @@ -221,8 +221,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 9452de7328..0a264248ea 100644 --- a/test/js/samples/inline-style-optimized-url/expected.js +++ b/test/js/samples/inline-style-optimized-url/expected.js @@ -6,30 +6,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 }; } @@ -40,8 +40,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 db5b7c8a2c..832561c261 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 = { @@ -187,30 +187,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 }; } @@ -221,8 +221,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 bc4dc0eeda..0ad51ae48a 100644 --- a/test/js/samples/inline-style-optimized/expected.js +++ b/test/js/samples/inline-style-optimized/expected.js @@ -6,30 +6,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 }; } @@ -40,8 +40,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 98235d2576..8f1d93878e 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 = { @@ -187,25 +187,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; } @@ -215,13 +215,13 @@ function create_main_fragment(state, component) { } }, - unmount: function() { + u: function unmount() { detachNode(div); detachNode(text); detachNode(div_1); }, - destroy: noop + d: noop }; } @@ -232,8 +232,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 c15408b3be..9eb67a0109 100644 --- a/test/js/samples/inline-style-unoptimized/expected.js +++ b/test/js/samples/inline-style-unoptimized/expected.js @@ -6,25 +6,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; } @@ -34,13 +34,13 @@ function create_main_fragment(state, component) { } }, - unmount: function() { + u: function unmount() { detachNode(div); detachNode(text); detachNode(div_1); }, - destroy: noop + d: noop }; } @@ -51,8 +51,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 948cd943b1..e5810909a4 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 = { @@ -195,31 +195,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); } }; @@ -232,8 +232,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 86e92e2fc4..66aecd3c7e 100644 --- a/test/js/samples/input-without-blowback-guard/expected.js +++ b/test/js/samples/input-without-blowback-guard/expected.js @@ -10,31 +10,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); } }; @@ -47,8 +47,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 036c77f3c8..23fe88c6a5 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 = { @@ -189,26 +189,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 }; } @@ -219,8 +219,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 9a4d4782cd..a5efd4252c 100644 --- a/test/js/samples/legacy-input-type/expected.js +++ b/test/js/samples/legacy-input-type/expected.js @@ -6,26 +6,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 }; } @@ -36,8 +36,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 552f1c22bc..cbec093bde 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 = { @@ -206,34 +206,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 }; } @@ -245,9 +245,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 93121a357a..3463f8ed4f 100644 --- a/test/js/samples/legacy-quote-class/expected.js +++ b/test/js/samples/legacy-quote-class/expected.js @@ -6,34 +6,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 }; } @@ -45,9 +45,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 7ed611bf35..9f69a1855b 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 = { @@ -237,13 +237,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); @@ -270,11 +270,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 ; } @@ -284,11 +284,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); @@ -313,8 +313,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 5e67ebfb1f..dbcb25a2d6 100644 --- a/test/js/samples/media-bindings/expected.js +++ b/test/js/samples/media-bindings/expected.js @@ -44,13 +44,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); @@ -77,11 +77,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 ; } @@ -91,11 +91,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); @@ -120,8 +120,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 817ab2c4f8..35574351c3 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 = { @@ -201,27 +201,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); } @@ -241,8 +241,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 b2f77857c4..f5bdfbf7e1 100644 --- a/test/js/samples/non-imported-component/expected.js +++ b/test/js/samples/non-imported-component/expected.js @@ -24,27 +24,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); } @@ -64,8 +64,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 2bec66e3e1..d479f91775 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 = { @@ -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 }; } @@ -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); callAll(this._oncreate); } diff --git a/test/js/samples/onrender-onteardown-rewritten/expected.js b/test/js/samples/onrender-onteardown-rewritten/expected.js index 6eb6b55a1e..72f743b20d 100644 --- a/test/js/samples/onrender-onteardown-rewritten/expected.js +++ b/test/js/samples/onrender-onteardown-rewritten/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 }; } @@ -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); callAll(this._oncreate); } diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index 0752ea7839..8710e19029 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 = { @@ -189,15 +189,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 }; } @@ -208,8 +208,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 dcf0b20e8d..62a98aa8f6 100644 --- a/test/js/samples/setup-method/expected.js +++ b/test/js/samples/setup-method/expected.js @@ -24,15 +24,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 }; } @@ -43,8 +43,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 5a9b918376..4defea8de9 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 = { @@ -205,125 +205,125 @@ 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"); text_1 = createText("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"); text_5 = createText("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_1, p); 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_5, p_1); 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(); } }; } @@ -333,21 +333,21 @@ function create_if_block(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("a"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -356,21 +356,21 @@ function create_if_block_1(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("b"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -379,21 +379,21 @@ function create_if_block_2(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("c"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -402,21 +402,21 @@ function create_if_block_3(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("d"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -425,21 +425,21 @@ function create_if_block_4(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("e"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -450,8 +450,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 01d21caa1e..c60d8f9ce1 100644 --- a/test/js/samples/use-elements-as-anchors/expected.js +++ b/test/js/samples/use-elements-as-anchors/expected.js @@ -16,125 +16,125 @@ 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"); text_1 = createText("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"); text_5 = createText("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_1, p); 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_5, p_1); 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(); } }; } @@ -144,21 +144,21 @@ function create_if_block(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("a"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -167,21 +167,21 @@ function create_if_block_1(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("b"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -190,21 +190,21 @@ function create_if_block_2(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("c"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -213,21 +213,21 @@ function create_if_block_3(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("d"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -236,21 +236,21 @@ function create_if_block_4(state, component) { var p, text; return { - create: function() { + c: function create() { p = createElement("p"); text = createText("e"); }, - mount: function(target, anchor) { + m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); }, - unmount: function() { + u: function unmount() { detachNode(p); }, - destroy: noop + d: noop }; } @@ -261,8 +261,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); } }