@@ -21,7 +21,7 @@ import {
21
21
managed_effect ,
22
22
managed_pre_effect ,
23
23
mark_subtree_inert ,
24
- schedule_task ,
24
+ schedule_microtask ,
25
25
untrack
26
26
} from './runtime.js' ;
27
27
import { raf } from './timing.js' ;
@@ -357,11 +357,15 @@ function create_transition(dom, init, direction, effect) {
357
357
cancelled = false ;
358
358
create_animation ( ) ;
359
359
}
360
- dispatch_event ( dom , 'introstart' ) ;
361
- if ( needs_reverse ) {
362
- /** @type {Animation | TickAnimation } */ ( animation ) . reverse ( ) ;
360
+ if ( animation === null ) {
361
+ transition . x ( ) ;
362
+ } else {
363
+ dispatch_event ( dom , 'introstart' ) ;
364
+ if ( needs_reverse ) {
365
+ /** @type {Animation | TickAnimation } */ ( animation ) . reverse ( ) ;
366
+ }
367
+ /** @type {Animation | TickAnimation } */ ( animation ) . play ( ) ;
363
368
}
364
- /** @type {Animation | TickAnimation } */ ( animation ) . play ( ) ;
365
369
} ,
366
370
// out
367
371
o ( ) {
@@ -371,11 +375,15 @@ function create_transition(dom, init, direction, effect) {
371
375
cancelled = false ;
372
376
create_animation ( ) ;
373
377
}
374
- dispatch_event ( dom , 'outrostart' ) ;
375
- if ( needs_reverse ) {
376
- /** @type {Animation | TickAnimation } */ ( animation ) . reverse ( ) ;
378
+ if ( animation === null ) {
379
+ transition . x ( ) ;
377
380
} else {
378
- /** @type {Animation | TickAnimation } */ ( animation ) . play ( ) ;
381
+ dispatch_event ( dom , 'outrostart' ) ;
382
+ if ( needs_reverse ) {
383
+ /** @type {Animation | TickAnimation } */ ( animation ) . reverse ( ) ;
384
+ } else {
385
+ /** @type {Animation | TickAnimation } */ ( animation ) . play ( ) ;
386
+ }
379
387
}
380
388
} ,
381
389
// cancel
@@ -424,7 +432,6 @@ function is_transition_block(block) {
424
432
export function bind_transition ( dom , get_transition_fn , props_fn , direction , global ) {
425
433
const transition_effect = /** @type {import('./types.js').EffectSignal } */ ( current_effect ) ;
426
434
const block = current_block ;
427
- const is_key_animation = direction === 'key' ;
428
435
429
436
let can_show_intro_on_mount = true ;
430
437
let can_apply_lazy_transitions = false ;
@@ -472,7 +479,7 @@ export function bind_transition(dom, get_transition_fn, props_fn, direction, glo
472
479
const init = ( from ) =>
473
480
untrack ( ( ) => {
474
481
const props = props_fn === null ? { } : props_fn ( ) ;
475
- return is_key_animation
482
+ return direction === 'key'
476
483
? /** @type {import('./types.js').AnimateFn<any> } */ ( transition_fn ) (
477
484
dom ,
478
485
{ from : /** @type {DOMRect } */ ( from ) , to : dom . getBoundingClientRect ( ) } ,
@@ -489,17 +496,13 @@ export function bind_transition(dom, get_transition_fn, props_fn, direction, glo
489
496
const show_intro = ! can_show_intro_on_mount && ( is_intro || direction === 'both' ) ;
490
497
491
498
if ( show_intro ) {
492
- transition . p = transition . i ( ) || null ;
499
+ transition . p = transition . i ( ) ;
493
500
}
494
501
495
502
const effect = managed_pre_effect ( ( ) => {
496
503
destroy_signal ( effect ) ;
497
504
dom . inert = false ;
498
505
499
- if ( transition . p === null && ! is_key_animation ) {
500
- return ;
501
- }
502
-
503
506
if ( show_intro ) {
504
507
transition . in ( ) ;
505
508
}
@@ -679,7 +682,7 @@ function each_item_animate(block, transitions, index, index_is_reactive) {
679
682
transition . c ( ) ;
680
683
}
681
684
}
682
- queueMicrotask ( ( ) => {
685
+ schedule_microtask ( ( ) => {
683
686
trigger_transitions ( transitions , 'key' , from ) ;
684
687
} ) ;
685
688
}
0 commit comments