Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/js/samples/transition-component-child/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
options: {
nestedTransitions: true
}
};
70 changes: 70 additions & 0 deletions test/js/samples/transition-component-child/expected.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/* generated by Svelte vX.Y.Z */
import { assign, createElement, detachNode, flush, init, insert, noop, proto, wrapTransition } from "svelte/shared.js";

function create_main_fragment(component, ctx) {
var div, div_transition, current;

return {
c() {
div = createElement("div");
div.textContent = "foo";
},

m(target, anchor, introing) {
insert(target, div, anchor);
current = true;
},

p: noop,

i(target, anchor) {
if (current) return;
if (component.root._intro) {
if (div_transition) div_transition.invalidate();

component.root._aftercreate.push(() => {
if (!div_transition) div_transition = wrapTransition(component, div, foo, {}, 1);
div_transition.run(1, null);
});
}
this.m(target, anchor);
},

o(outrocallback) {
if (!current) return;

if (!div_transition) div_transition = wrapTransition(component, div, foo, {}, 0);
div_transition.run(0, () => {
outrocallback();
div_transition = null;
});

current = false;
},

d(detach) {
if (detach) {
detachNode(div);
if (div_transition) div_transition.abort();
}
}
};
}

function SvelteComponent(options) {
init(this, options);
this._state = assign({}, options.data);
this._intro = true;

this._fragment = create_main_fragment(this, this._state);

if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);

flush(this);
}
}

assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
7 changes: 7 additions & 0 deletions test/js/samples/transition-component-child/input.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div transition:foo>foo</div>

<script>
export default {
transitions: { foo }
};
</script>
5 changes: 5 additions & 0 deletions test/js/samples/transition-component-parent/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
options: {
nestedTransitions: true
}
};
176 changes: 176 additions & 0 deletions test/js/samples/transition-component-parent/expected.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/* generated by Svelte vX.Y.Z */
import { assign, createComment, detachNode, flush, groupOutros, init, insert, proto } from "svelte/shared.js";

function create_main_fragment(component, ctx) {
var if_block_anchor, current;

var if_block = (ctx.x) && create_if_block(component, ctx);

return {
c() {
if (if_block) if_block.c();
if_block_anchor = createComment();
},

m(target, anchor) {
if (if_block) if_block.m(target, anchor, 1);
insert(target, if_block_anchor, anchor);
current = true;
},

p(changed, ctx) {
if (ctx.x) {
if (if_block) {
if_block.p(changed, ctx);
} else {
if_block = create_if_block(component, ctx);
if (if_block) if_block.c();
}

if_block.i(if_block_anchor.parentNode, if_block_anchor);
} else if (if_block) {
groupOutros();
if_block.o(function() {
if_block.d(1);
if_block = null;
});
}
},

i(target, anchor) {
if (current) return;

this.m(target, anchor);
},

o(outrocallback) {
if (!current) return;

if (if_block) if_block.o(outrocallback, 1);
else outrocallback();

current = false;
},

d(detach) {
if (if_block) if_block.d(detach);
if (detach) {
detachNode(if_block_anchor);
}
}
};
}

// (2:1) {#if y}
function create_if_block_1(component, ctx) {
var current;

var widget = new Widget({
root: component.root,
store: component.store
});

return {
c() {
widget._fragment.c();
},

m(target, anchor, local) {
widget._mount(target, anchor, local);
current = true;
},

i(target, anchor, local) {
if (current) return;

this.m(target, anchor, local);
},

o(outrocallback, local) {
if (!current) return;

if (widget) widget._fragment.o(outrocallback, local);
current = false;
},

d(detach) {
widget.destroy(detach);
}
};
}

// (1:0) {#if x}
function create_if_block(component, ctx) {
var if_block_anchor, current;

var if_block = (ctx.y) && create_if_block_1(component, ctx);

return {
c() {
if (if_block) if_block.c();
if_block_anchor = createComment();
},

m(target, anchor) {
if (if_block) if_block.m(target, anchor, 1);
insert(target, if_block_anchor, anchor);
current = true;
},

p(changed, ctx) {
if (ctx.y) {
if (!if_block) {
if_block = create_if_block_1(component, ctx);
if_block.c();
}
if_block.i(if_block_anchor.parentNode, if_block_anchor, 1);
} else if (if_block) {
groupOutros();
if_block.o(function() {
if_block.d(1);
if_block = null;
}, 1);
}
},

i(target, anchor) {
if (current) return;

this.m(target, anchor);
},

o(outrocallback) {
if (!current) return;

if (if_block) if_block.o(outrocallback, 1);
else outrocallback();

current = false;
},

d(detach) {
if (if_block) if_block.d(detach);
if (detach) {
detachNode(if_block_anchor);
}
}
};
}

function SvelteComponent(options) {
init(this, options);
this._state = assign({}, options.data);
this._intro = true;

this._fragment = create_main_fragment(this, this._state);

if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor, 1);

flush(this);
}
}

assign(SvelteComponent.prototype, proto);
export default SvelteComponent;
11 changes: 11 additions & 0 deletions test/js/samples/transition-component-parent/input.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{#if x}
{#if y}
<Widget/>
{/if}
{/if}

<script>
export default {
components: { Widget }
};
</script>
5 changes: 5 additions & 0 deletions test/js/samples/transition/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
options: {
nestedTransitions: true
}
};
Loading