-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Expand file tree
/
Copy pathinterfaces.ts
More file actions
104 lines (91 loc) Β· 3.49 KB
/
Copy pathinterfaces.ts
File metadata and controls
104 lines (91 loc) Β· 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {InjectionToken} from '../di/injection_token';
/**
* A [DI token](api/core/InjectionToken) that enables or disables all enter and leave animations.
*/
export const ANIMATIONS_DISABLED = new InjectionToken<boolean>(
typeof ngDevMode !== 'undefined' && ngDevMode ? 'AnimationsDisabled' : '',
{
factory: () => false,
},
);
/**
* The event type for when `animate.enter` and `animate.leave` are used with function
* callbacks.
*
* @see [Animating your applications with animate.enter and animate.leave](guide/animations)
*
* @publicApi 20.2
*/
export type AnimationCallbackEvent = {target: Element; animationComplete: VoidFunction};
/**
* A [DI token](api/core/InjectionToken) that configures the maximum animation timeout
* before element removal. The default value mirrors from Chrome's cross document
* navigation view transition timeout. It's intended to prevent people from accidentally
* forgetting to call the removal function in their callback. Also serves as a delay
* for when stylesheets are pruned.
*
* @publicApi 20.2
* @see [Animating your applications with animate.enter and animate.leave](guide/animations)
*/
export const MAX_ANIMATION_TIMEOUT = new InjectionToken<number>(
typeof ngDevMode !== 'undefined' && ngDevMode ? 'MaxAnimationTimeout' : '',
{
factory: () => MAX_ANIMATION_TIMEOUT_DEFAULT,
},
);
const MAX_ANIMATION_TIMEOUT_DEFAULT = 4000;
/**
* The function type for `animate.enter` and `animate.leave` when they are used with
* function callbacks.
*
* @publicApi 20.2
*
* @see [Animating your applications with animate.enter and animate.leave](guide/animations)
*/
export type AnimationFunction = (event: AnimationCallbackEvent) => void;
export type RunEnterAnimationFn = VoidFunction;
export type RunLeaveAnimationFn = () => {promise: Promise<void>; resolve: VoidFunction};
export interface LongestAnimation {
animationName: string | undefined;
propertyName: string | undefined;
duration: number;
}
export interface EnterNodeAnimations {
animateFns: RunEnterAnimationFn[];
resolvers?: VoidFunction[];
}
export interface LeaveNodeAnimations {
animateFns: RunLeaveAnimationFn[];
resolvers?: VoidFunction[];
}
export interface AnimationLViewData {
// Enter animations that apply to nodes in this view
enter?: Map<number, EnterNodeAnimations>;
// Leave animations that apply to nodes in this view
leave?: Map<number, LeaveNodeAnimations>;
// Leave animations that apply to nodes in this view
// We chose to use unknown instead of PromiseSettledResult<void> to avoid requiring the type
running?: Promise<unknown>;
// Animation functions that have been queued for this view when the view is detached.
// This is used to later remove them from the global animation queue if the view
// is attached before the animation queue runs. This is used in cases where views are
// moved or swapped during list reconciliation.
detachedLeaveAnimationFns?: VoidFunction[];
}
/**
* Represents the class, class list, or a function returning the class or class list
* bound to an animate instruction.
*/
export type AnimationClassValue =
string | string[] | (() => AnimationClassValue) | undefined | null;
/**
* Function that returns the class or class list bound to the animate instruction
*/
export type AnimationClassBindingFn = () => AnimationClassValue;