@@ -52,51 +52,38 @@ const MAX_ANIMATION_TIMEOUT_DEFAULT = 4000;
5252 */
5353export type AnimationFunction = ( event : AnimationCallbackEvent ) => void ;
5454
55- export type AnimationEventFunction = (
56- el : Element ,
57- value : AnimationFunction ,
58- ) => AnimationRemoveFunction ;
59- export type AnimationClassFunction = (
60- el : Element ,
61- value : Set < string > | null ,
62- resolvers : Function [ ] | undefined ,
63- ) => AnimationRemoveFunction ;
64- export type AnimationRemoveFunction = ( removeFn : VoidFunction ) => void ;
65-
66- export interface AnimationDetails {
67- classes : Set < string > | null ;
68- classFns ?: Function [ ] ;
69- animateFn : AnimationRemoveFunction ;
70- isEventBinding : boolean ;
71- }
55+ export type RunEnterAnimationFn = VoidFunction ;
56+ export type RunLeaveAnimationFn = ( ) => { promise : Promise < void > ; resolve : VoidFunction } ;
7257
7358export interface LongestAnimation {
7459 animationName : string | undefined ;
7560 propertyName : string | undefined ;
7661 duration : number ;
7762}
7863
79- export interface NodeAnimations {
80- animateFns : Function [ ] ;
64+ export interface EnterNodeAnimations {
65+ animateFns : RunEnterAnimationFn [ ] ;
66+ resolvers ?: VoidFunction [ ] ;
67+ }
68+ export interface LeaveNodeAnimations {
69+ animateFns : RunLeaveAnimationFn [ ] ;
8170 resolvers ?: VoidFunction [ ] ;
8271}
8372
8473export interface AnimationLViewData {
8574 // Enter animations that apply to nodes in this view
86- enter ?: Map < number , NodeAnimations > ;
75+ enter ?: Map < number , EnterNodeAnimations > ;
8776
8877 // Leave animations that apply to nodes in this view
89- leave ?: Map < number , NodeAnimations > ;
78+ leave ?: Map < number , LeaveNodeAnimations > ;
9079
9180 // Leave animations that apply to nodes in this view
9281 // We chose to use unknown instead of PromiseSettledResult<void> to avoid requiring the type
9382 running ?: Promise < unknown > ;
9483
95- // Skip leave animations
96- // This flag is solely used when move operations occur. DOM Node move
97- // operations occur in lists, like `@for` loops, and use the same code
98- // path during move that detaching or removing does. So to prevent
99- // unexpected disappearing of moving nodes, we use this flag to skip
100- // the animations in that case.
101- skipLeaveAnimations ?: boolean ;
84+ // Animation functions that have been queued for this view when the view is detached.
85+ // This is used to later remove them from the global animation queue if the view
86+ // is attached before the animation queue runs. This is used in cases where views are
87+ // moved or swapped during list reconciliation.
88+ detachFnQueue ?: VoidFunction [ ] ;
10289}
0 commit comments