Skip to content

Commit 54bb1f4

Browse files
tivacdummdidumm
authored andcommitted
breaking: send in/out to transition fn (#8318)
Instead of "both", which doesn't make sense at that point.
1 parent b95ae0e commit 54bb1f4

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/runtime/internal/transitions.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,10 @@ export function create_bidirectional_transition(node: Element & ElementCSSInline
376376
run(b: INTRO | OUTRO) {
377377
if (is_function(config)) {
378378
wait().then(() => {
379+
const opts: TransitionOptions = { direction: b ? 'in' : 'out' };
380+
379381
// @ts-ignore
380-
config = config(options);
382+
config = config(opts);
381383
go(b);
382384
});
383385
} else {

test/runtime/samples/transition-js-deferred-option-direction/_config.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ export default {
44

55
const div_in = target.querySelector('#in');
66
const div_out = target.querySelector('#out');
7-
const div_both = target.querySelector('#both');
7+
const div_bothin = target.querySelector('#both-in');
8+
const div_bothout = target.querySelector('#both-out');
89

9-
assert.equal(div_in.initial, 'in');
10-
assert.equal(div_out.initial, 'out');
11-
assert.equal(div_both.initial, 'both');
10+
assert.equal(div_in.directions, 'in,in');
11+
assert.equal(div_out.directions, 'out');
12+
assert.equal(div_bothin.directions, 'both');
13+
assert.equal(div_bothout.directions, 'both');
1214

1315
return Promise.resolve().then(() => {
14-
assert.equal(div_in.later, 'in');
15-
assert.equal(div_out.later, 'out');
16-
assert.equal(div_both.later, 'both');
16+
assert.equal(div_in.directions, 'in,in');
17+
assert.equal(div_out.directions, 'out,out');
18+
assert.equal(div_bothin.directions, 'both,in');
19+
assert.equal(div_bothout.directions, 'both,out');
1720
});
1821
}
1922
};

test/runtime/samples/transition-js-deferred-option-direction/main.svelte

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
export let visible;
33
44
function foo(node, _params, options) {
5-
node.initial = options.direction;
5+
node.directions = options.direction;
66
77
return (opts) => {
8-
node.later = opts.direction;
8+
node.directions += "," + opts.direction;
99
1010
return {
1111
duration: 10
@@ -15,10 +15,11 @@
1515
</script>
1616

1717
{#if visible}
18-
<div id="both" transition:foo></div>
19-
<div id="in" in:foo></div>
18+
<div id="both-in" transition:foo />
19+
<div id="in" in:foo />
2020
{/if}
2121

2222
{#if !visible}
23-
<div id="out" out:foo></div>
23+
<div id="out" out:foo />
24+
<div id="both-out" transition:foo={{ duration: 500 }} />
2425
{/if}

0 commit comments

Comments
 (0)