Merge pull request #1453 from sveltejs/deferred-transitions

Deferred transitions
pull/1781/head
Rich Harris 7 years ago committed by GitHub
commit 6d00f2bf15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -228,7 +228,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, ${options.skipIntroByDefault ? `options.intro` : 'true'});
if (options.target) this._mount(options.target, options.anchor);
` : deindent`
if (options.target) {
${compiler.options.hydratable
@ -241,7 +241,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, ${options.skipIntroByDefault ? `options.intro` : 'true'});
this._mount(options.target, options.anchor);
${(compiler.hasComponents || target.hasComplexBindings || hasInitHooks || target.hasIntroTransitions) && deindent`
${compiler.hasComponents && `this._lock = true;`}

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

@ -699,7 +699,7 @@ export default class Element extends Node {
const fn = `%transitions-${intro.name}`;
block.builders.intro.addBlock(deindent`
block.builders.intro.addConditional(`#component._intro`, deindent`
if (${name}) ${name}.invalidate();
#component.root._aftercreate.push(() => {
@ -709,6 +709,7 @@ export default class Element extends Node {
`);
block.builders.outro.addBlock(deindent`
if (!${name}) ${name} = @wrapTransition(#component, ${this.var}, ${fn}, ${snippet}, false);
${name}.run(0, () => {
#outrocallback();
${name} = null;
@ -733,7 +734,7 @@ export default class Element extends Node {
`);
}
block.builders.intro.addBlock(deindent`
block.builders.intro.addConditional(`#component._intro`, deindent`
#component.root._aftercreate.push(() => {
${introName} = @wrapTransition(#component, ${this.var}, ${fn}, ${snippet}, true);
${introName}.run(1);

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

@ -27,19 +27,12 @@ export function hash(str) {
}
export function wrapTransition(component, node, fn, params, intro) {
const obj = fn(node, params);
const duration = obj.duration || 300;
const ease = obj.easing || linear;
let obj = fn(node, params);
let duration;
let ease;
let cssText;
if (intro) {
if (obj.css && obj.delay) {
cssText = node.style.cssText;
node.style.cssText += obj.css(0, 1);
}
if (obj.tick) obj.tick(0, 1);
}
let initialised = false;
return {
t: intro ? 0 : 1,
@ -48,12 +41,36 @@ export function wrapTransition(component, node, fn, params, intro) {
pending: null,
run(b, callback) {
if (typeof obj === 'function') {
transitionManager.wait().then(() => {
obj = obj();
this._run(b, callback);
});
} else {
this._run(b, callback);
}
},
_run(b, callback) {
duration = obj.duration || 300;
ease = obj.easing || linear;
const program = {
start: window.performance.now() + (obj.delay || 0),
b,
callback: callback || noop
};
if (intro && !initialised) {
if (obj.css && obj.delay) {
cssText = node.style.cssText;
node.style.cssText += obj.css(0, 1);
}
if (obj.tick) obj.tick(0, 1);
initialised = true;
}
if (!b) {
program.group = transitionManager.outros;
transitionManager.outros.remaining += 1;
@ -154,6 +171,7 @@ export var transitionManager = {
bound: null,
stylesheet: null,
activeRules: {},
promise: null,
add(transition) {
this.transitions.push(transition);
@ -223,5 +241,16 @@ export var transitionManager = {
remaining: 0,
callbacks: []
};
},
wait() {
if (!transitionManager.promise) {
transitionManager.promise = Promise.resolve();
transitionManager.promise.then(() => {
transitionManager.promise = null;
});
}
return transitionManager.promise;
}
};

@ -32,7 +32,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
}
}
@ -150,8 +150,8 @@ function _set(newState) {
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -38,7 +38,7 @@ class Main extends HTMLElement {
this._fragment.c();
this._fragment.m(this.shadowRoot, null);
if (options.target) this._mount(options.target, options.anchor, true);
if (options.target) this._mount(options.target, options.anchor);
}
static get observedAttributes() {
@ -171,8 +171,8 @@ function _set(newState) {
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -35,7 +35,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, true);
this._mount(options.target, options.anchor);
}
}
@ -154,8 +154,8 @@ function _set(newState) {
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -15,7 +15,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
widget._mount(target, anchor, true);
widget._mount(target, anchor);
},
p: noop,
@ -41,7 +41,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);
@ -157,8 +157,8 @@ function _set(newState) {
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -32,7 +32,7 @@ function Widget(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
}
}
@ -150,8 +150,8 @@ function _set(newState) {
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -15,7 +15,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
widget._mount(target, anchor, true);
widget._mount(target, anchor);
},
p: noop,
@ -41,7 +41,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);
@ -157,8 +157,8 @@ function _set(newState) {
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -32,7 +32,7 @@ function Widget(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
}
}
@ -150,8 +150,8 @@ function _set(newState) {
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -15,7 +15,7 @@ function create_main_fragment(component, ctx) {
},
m(target, anchor) {
widget._mount(target, anchor, true);
widget._mount(target, anchor);
},
p: noop,
@ -41,7 +41,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);
@ -157,8 +157,8 @@ function _set(newState) {
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -32,7 +32,7 @@ function Widget(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
}
}
@ -150,8 +150,8 @@ function _set(newState) {
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -47,7 +47,7 @@ var Main = (function(answer) { "use strict";
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
}
}
@ -171,8 +171,8 @@ var Main = (function(answer) { "use strict";
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -32,7 +32,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
}
}
@ -150,8 +150,8 @@ function _set(newState) {
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -32,7 +32,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
}
}
@ -150,8 +150,8 @@ function _set(newState) {
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
function _differs(a, b) {

@ -42,7 +42,7 @@ function Main(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
}
}
@ -170,8 +170,8 @@ function _set(newState) {
}
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[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, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var proto = {
@ -180,7 +180,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
}
}

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

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

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

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

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

@ -99,8 +99,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[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, true);
nested._mount(target, anchor);
},
p: noop,
@ -159,7 +159,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

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

@ -103,8 +103,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[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, true);
nested._mount(target, anchor);
},
p: noop,
@ -163,7 +163,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

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

@ -103,8 +103,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[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, true);
nested._mount(target, anchor);
},
p: noop,
@ -163,7 +163,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

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

@ -99,8 +99,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[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, true);
nested._mount(target, anchor);
},
p: noop,
@ -159,7 +159,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

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

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

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

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

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

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

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

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

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

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

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

@ -137,8 +137,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}
var protoDev = {
@ -209,7 +209,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, true);
this._mount(options.target, options.anchor);
}
}

@ -55,7 +55,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, true);
this._mount(options.target, options.anchor);
}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -113,8 +113,8 @@ function callAll(fns) {
while (fns && fns.length) fns.shift()();
}
function _mount(target, anchor, intro) {
this._fragment[intro && this._fragment.i ? 'i' : 'm'](target, anchor || null);
function _mount(target, anchor) {
this._fragment[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, true);
imported._mount(target, anchor);
insertNode(text, target, anchor);
nonimported._mount(target, anchor, true);
nonimported._mount(target, anchor);
},
p: noop,
@ -185,7 +185,7 @@ function SvelteComponent(options) {
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, true);
this._mount(options.target, options.anchor);
this._lock = true;
callAll(this._beforecreate);

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

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

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

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

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

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

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

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

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

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

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

@ -0,0 +1,15 @@
export default {
skipIntroByDefault: true,
test(assert, component, target, window, raf) {
component.set({ visible: true });
return Promise.resolve().then(() => {
const div = target.querySelector('div');
assert.equal(div.foo, 0);
raf.tick(50);
assert.equal(div.foo, 0.5);
});
},
};

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