add skipIntroByDefault compiler option ()

pull/1448/head
Rich Harris 7 years ago
parent 3c1bcfab79
commit 44bb2da29b

@ -227,7 +227,7 @@ export default function dom(
this._fragment.c();
this._fragment.${block.hasIntroMethod ? 'i' : 'm'}(this.shadowRoot, null);
if (options.target) this._mount(options.target, options.anchor);
if (options.target) this._mount(options.target, options.anchor, ${options.skipIntroByDefault ? `options.intro` : 'true'});
` : deindent`
if (options.target) {
${compiler.options.hydratable
@ -240,7 +240,7 @@ export default function dom(
${options.dev && `if (options.hydrate) throw new Error("options.hydrate only works if the component was compiled with the \`hydratable: true\` option");`}
this._fragment.c();
`}
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, ${options.skipIntroByDefault ? `options.intro` : 'true'});
${(compiler.hasComponents || target.hasComplexBindings || hasInitHooks || target.hasIntroTransitions) && deindent`
${compiler.hasComponents && `this._lock = true;`}

@ -383,7 +383,7 @@ export default class Component extends Node {
block.builders.mount.addBlock(deindent`
if (${name}) {
${name}._mount(${parentNode || '#target'}, ${parentNode ? 'null' : 'anchor'});
${name}._mount(${parentNode || '#target'}, ${parentNode ? 'null' : 'anchor'}, ${compiler.options.skipIntroByDefault ? 'false' : 'true'});
${this.ref && `#component.refs.${this.ref} = ${name};`}
}
`);
@ -405,7 +405,7 @@ export default class Component extends Node {
${name}._fragment.c();
${this.children.map(child => child.remount(name))}
${name}._mount(${updateMountNode}, ${anchor});
${name}._mount(${updateMountNode}, ${anchor}, ${compiler.options.skipIntroByDefault ? 'false' : 'true'});
${this.handlers.map(handler => deindent`
${name}.on("${handler.name}", ${handler.var});
@ -464,7 +464,7 @@ export default class Component extends Node {
}
block.builders.mount.addLine(
`${name}._mount(${parentNode || '#target'}, ${parentNode ? 'null' : 'anchor'});`
`${name}._mount(${parentNode || '#target'}, ${parentNode ? 'null' : 'anchor'}, ${compiler.options.skipIntroByDefault ? 'false' : 'true'});`
);
if (updates.length) {
@ -483,7 +483,7 @@ export default class Component extends Node {
}
remount(name: string) {
return `${this.var}._mount(${name}._slotted.default, null);`;
return `${this.var}._mount(${name}._slotted.default, null, ${this.compiler.options.skipIntroByDefault ? 'false' : 'true'});`;
}
ssr() {

@ -64,6 +64,9 @@ export interface CompileOptions {
onerror?: (error: Error) => void;
onwarn?: (warning: Warning) => void;
// to remove in v3
skipIntroByDefault?: boolean;
}
export interface GenerateOptions {

@ -128,8 +128,8 @@ export function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
export function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
export function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
export var PENDING = {};

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte v2.4.4 */
/* src/Main.html generated by Svelte v2.5.1 */
function create_main_fragment(component, ctx) {
var p;
@ -31,7 +31,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}
@ -149,8 +149,8 @@ function _set(newState) {
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte v2.4.4 */
/* src/Main.html generated by Svelte v2.5.1 */
function create_main_fragment(component, ctx) {
var p;
@ -37,7 +37,7 @@ class Main extends HTMLElement {
this._fragment.c();
this._fragment.m(this.shadowRoot, null);
if (options.target) this._mount(options.target, options.anchor);
if (options.target) this._mount(options.target, options.anchor, true);
}
static get observedAttributes() {
@ -170,8 +170,8 @@ function _set(newState) {
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte v2.4.4 */
/* src/Main.html generated by Svelte v2.5.1 */
function create_main_fragment(component, ctx) {
var p;
@ -34,7 +34,7 @@ function Main(options) {
if (options.target) {
if (options.hydrate) throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}
@ -153,8 +153,8 @@ function _set(newState) {
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte v2.4.4 */
/* src/Main.html generated by Svelte v2.5.1 */
import Widget from './Widget.html';
@ -15,7 +15,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
widget._mount(target, anchor);
widget._mount(target, anchor, true);
},
p: noop,
@ -40,7 +40,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);
@ -156,8 +156,8 @@ function _set(newState) {
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -1,4 +1,4 @@
/* src/Widget.html generated by Svelte v2.4.4 */
/* src/Widget.html generated by Svelte v2.5.1 */
function create_main_fragment(component, ctx) {
var p;
@ -31,7 +31,7 @@ function Widget(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}
@ -149,8 +149,8 @@ function _set(newState) {
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte v2.4.4 */
/* src/Main.html generated by Svelte v2.5.1 */
import Widget from './widget/Widget.html';
@ -15,7 +15,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
widget._mount(target, anchor);
widget._mount(target, anchor, true);
},
p: noop,
@ -40,7 +40,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);
@ -156,8 +156,8 @@ function _set(newState) {
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -1,4 +1,4 @@
/* src/widget/Widget.html generated by Svelte v2.4.4 */
/* src/widget/Widget.html generated by Svelte v2.5.1 */
function create_main_fragment(component, ctx) {
var p;
@ -31,7 +31,7 @@ function Widget(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}
@ -149,8 +149,8 @@ function _set(newState) {
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte v2.4.4 */
/* src/Main.html generated by Svelte v2.5.1 */
import Widget from './Widget.html';
@ -15,7 +15,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
widget._mount(target, anchor);
widget._mount(target, anchor, true);
},
p: noop,
@ -40,7 +40,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);
@ -156,8 +156,8 @@ function _set(newState) {
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -1,4 +1,4 @@
/* src/Widget.html generated by Svelte v2.4.4 */
/* src/Widget.html generated by Svelte v2.5.1 */
function create_main_fragment(component, ctx) {
var p;
@ -31,7 +31,7 @@ function Widget(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}
@ -149,8 +149,8 @@ function _set(newState) {
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte v2.4.4 */
/* src/Main.html generated by Svelte v2.5.1 */
var Main = (function(answer) { "use strict";
answer = (answer && answer.__esModule) ? answer["default"] : answer;
@ -46,7 +46,7 @@ var Main = (function(answer) { "use strict";
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}
@ -170,8 +170,8 @@ var Main = (function(answer) { "use strict";
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte v2.4.4 */
/* src/Main.html generated by Svelte v2.5.1 */
function create_main_fragment(component, ctx) {
var p;
@ -31,7 +31,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}
@ -149,8 +149,8 @@ function _set(newState) {
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte v2.4.4 */
/* src/Main.html generated by Svelte v2.5.1 */
function create_main_fragment(component, ctx) {
var p;
@ -31,7 +31,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}
@ -149,8 +149,8 @@ function _set(newState) {
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -1,4 +1,4 @@
/* src/Main.html generated by Svelte v2.4.4 */
/* src/Main.html generated by Svelte v2.5.1 */
function create_main_fragment(component, ctx) {
var h1, text, text_1;
@ -41,7 +41,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}
@ -169,8 +169,8 @@ function _set(newState) {
}
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -111,8 +111,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -179,7 +179,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -52,7 +52,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -143,8 +143,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -205,7 +205,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
callAll(this._beforecreate);
}

@ -45,7 +45,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
callAll(this._beforecreate);
}

@ -119,8 +119,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -186,7 +186,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -51,7 +51,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -99,8 +99,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -133,7 +133,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
nested._mount(target, anchor);
nested._mount(target, anchor, true);
},
p: noop,
@ -158,7 +158,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);

@ -17,7 +17,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
nested._mount(target, anchor);
nested._mount(target, anchor, true);
},
p: noop,
@ -42,7 +42,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);

@ -103,8 +103,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -137,7 +137,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
nested._mount(target, anchor);
nested._mount(target, anchor, true);
},
p: noop,
@ -162,7 +162,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);

@ -17,7 +17,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
nested._mount(target, anchor);
nested._mount(target, anchor, true);
},
p: noop,
@ -42,7 +42,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);

@ -103,8 +103,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -137,7 +137,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
nested._mount(target, anchor);
nested._mount(target, anchor, true);
},
p: noop,
@ -162,7 +162,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);

@ -17,7 +17,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
nested._mount(target, anchor);
nested._mount(target, anchor, true);
},
p: noop,
@ -42,7 +42,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);

@ -99,8 +99,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -133,7 +133,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
nested._mount(target, anchor);
nested._mount(target, anchor, true);
},
p: noop,
@ -158,7 +158,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);

@ -17,7 +17,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
nested._mount(target, anchor);
nested._mount(target, anchor, true);
},
p: noop,
@ -42,7 +42,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);

@ -99,8 +99,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -147,7 +147,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -31,7 +31,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -115,8 +115,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -173,7 +173,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -41,7 +41,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -111,8 +111,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -167,7 +167,7 @@ class SvelteComponent extends HTMLElement {
this._fragment.c();
this._fragment.m(this.shadowRoot, null);
if (options.target) this._mount(options.target, options.anchor);
if (options.target) this._mount(options.target, options.anchor, true);
}
static get observedAttributes() {

@ -39,7 +39,7 @@ class SvelteComponent extends HTMLElement {
this._fragment.c();
this._fragment.m(this.shadowRoot, null);
if (options.target) this._mount(options.target, options.anchor);
if (options.target) this._mount(options.target, options.anchor, true);
}
static get observedAttributes() {

@ -129,8 +129,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -253,7 +253,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -107,7 +107,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -104,8 +104,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -161,7 +161,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
callAll(this._oncreate);
}

@ -41,7 +41,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
callAll(this._oncreate);
}

@ -137,8 +137,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var protoDev = {
@ -208,7 +208,7 @@ function SvelteComponent(options) {
if (options.target) {
if (options.hydrate) throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -54,7 +54,7 @@ function SvelteComponent(options) {
if (options.target) {
if (options.hydrate) throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -115,8 +115,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -175,7 +175,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -43,7 +43,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -119,8 +119,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -179,7 +179,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -43,7 +43,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -119,8 +119,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -177,7 +177,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -41,7 +41,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -131,8 +131,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -294,7 +294,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -146,7 +146,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -111,8 +111,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -177,7 +177,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -50,7 +50,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -111,8 +111,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -164,7 +164,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -36,7 +36,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -115,8 +115,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -225,7 +225,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -93,7 +93,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -115,8 +115,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -201,7 +201,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -69,7 +69,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -115,8 +115,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -173,7 +173,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -41,7 +41,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -115,8 +115,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -168,7 +168,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -36,7 +36,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -115,8 +115,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -168,7 +168,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -36,7 +36,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -115,8 +115,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -179,7 +179,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -47,7 +47,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -127,8 +127,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -189,7 +189,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -45,7 +45,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -123,8 +123,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -183,7 +183,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -43,7 +43,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -117,8 +117,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -166,7 +166,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -32,7 +32,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -127,8 +127,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -237,7 +237,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
callAll(this._beforecreate);
}

@ -93,7 +93,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
callAll(this._beforecreate);
}

@ -113,8 +113,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -152,9 +152,9 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
imported._mount(target, anchor);
imported._mount(target, anchor, true);
insertNode(text, target, anchor);
nonimported._mount(target, anchor);
nonimported._mount(target, anchor, true);
},
p: noop,
@ -184,7 +184,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);

@ -23,9 +23,9 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
imported._mount(target, anchor);
imported._mount(target, anchor, true);
insertNode(text, target, anchor);
nonimported._mount(target, anchor);
nonimported._mount(target, anchor, true);
},
p: noop,
@ -55,7 +55,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
this._lock = true;
callAll(this._beforecreate);

@ -99,8 +99,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -154,7 +154,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -38,7 +38,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -119,8 +119,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -171,7 +171,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -35,7 +35,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -99,8 +99,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -145,7 +145,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -29,7 +29,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -123,8 +123,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -389,7 +389,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -249,7 +249,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -119,8 +119,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -198,7 +198,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -62,7 +62,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
this._mount(options.target, options.anchor, true);
}
}

@ -72,6 +72,7 @@ describe("runtime", () => {
compileOptions.dev = config.dev;
compileOptions.store = !!config.store;
compileOptions.immutable = config.immutable;
compileOptions.skipIntroByDefault = config.skipIntroByDefault;
Object.keys(require.cache)
.filter(x => x.endsWith(".html"))
@ -134,7 +135,8 @@ describe("runtime", () => {
target,
hydrate,
data: config.data,
store: (config.store !== true && config.store)
store: (config.store !== true && config.store),
intro: config.intro
}, config.options || {});
const component = new SvelteComponent(options);

@ -1,11 +1,9 @@
export default {
test ( assert, component, target, window, raf ) {
const div = target.querySelector( 'div' );
assert.equal( div.foo, 0 );
test(assert, component, target, window, raf) {
const div = target.querySelector('div');
assert.equal(div.foo, 0);
raf.tick(50);
assert.equal( div.foo, 0.5 );
component.destroy();
assert.equal(div.foo, 0.5);
}
};
};

@ -3,7 +3,7 @@
<script>
export default {
transitions: {
foo: function ( node, params ) {
foo(node, params) {
return {
duration: 100,
tick: t => {

@ -0,0 +1,12 @@
export default {
skipIntroByDefault: true,
intro: true,
test(assert, component, target, window, raf) {
const div = target.querySelector('div');
assert.equal(div.foo, 0);
raf.tick(50);
assert.equal(div.foo, 0.5);
},
};

@ -0,0 +1,16 @@
<div transition:foo></div>
<script>
export default {
transitions: {
foo(node, params) {
return {
duration: 100,
tick: t => {
node.foo = t;
}
};
}
}
};
</script>

@ -0,0 +1,11 @@
export default {
skipIntroByDefault: true,
test(assert, component, target, window, raf) {
const div = target.querySelector('div');
assert.equal(div.foo, undefined);
raf.tick(50);
assert.equal(div.foo, undefined);
},
};

@ -0,0 +1,16 @@
<div transition:foo></div>
<script>
export default {
transitions: {
foo(node, params) {
return {
duration: 100,
tick: t => {
node.foo = t;
}
};
}
}
};
</script>
Loading…
Cancel
Save