@angular/animations 21.0.0-next.0 → 21.0.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,338 @@
1
+ /**
2
+ * @license Angular v21.0.0-next.10
3
+ * (c) 2010-2025 Google LLC. https://angular.dev/
4
+ * License: MIT
5
+ */
6
+
7
+ var AnimationMetadataType;
8
+ (function (AnimationMetadataType) {
9
+ AnimationMetadataType[AnimationMetadataType["State"] = 0] = "State";
10
+ AnimationMetadataType[AnimationMetadataType["Transition"] = 1] = "Transition";
11
+ AnimationMetadataType[AnimationMetadataType["Sequence"] = 2] = "Sequence";
12
+ AnimationMetadataType[AnimationMetadataType["Group"] = 3] = "Group";
13
+ AnimationMetadataType[AnimationMetadataType["Animate"] = 4] = "Animate";
14
+ AnimationMetadataType[AnimationMetadataType["Keyframes"] = 5] = "Keyframes";
15
+ AnimationMetadataType[AnimationMetadataType["Style"] = 6] = "Style";
16
+ AnimationMetadataType[AnimationMetadataType["Trigger"] = 7] = "Trigger";
17
+ AnimationMetadataType[AnimationMetadataType["Reference"] = 8] = "Reference";
18
+ AnimationMetadataType[AnimationMetadataType["AnimateChild"] = 9] = "AnimateChild";
19
+ AnimationMetadataType[AnimationMetadataType["AnimateRef"] = 10] = "AnimateRef";
20
+ AnimationMetadataType[AnimationMetadataType["Query"] = 11] = "Query";
21
+ AnimationMetadataType[AnimationMetadataType["Stagger"] = 12] = "Stagger";
22
+ })(AnimationMetadataType || (AnimationMetadataType = {}));
23
+ const AUTO_STYLE = '*';
24
+ function trigger(name, definitions) {
25
+ return {
26
+ type: AnimationMetadataType.Trigger,
27
+ name,
28
+ definitions,
29
+ options: {}
30
+ };
31
+ }
32
+ function animate(timings, styles = null) {
33
+ return {
34
+ type: AnimationMetadataType.Animate,
35
+ styles,
36
+ timings
37
+ };
38
+ }
39
+ function group(steps, options = null) {
40
+ return {
41
+ type: AnimationMetadataType.Group,
42
+ steps,
43
+ options
44
+ };
45
+ }
46
+ function sequence(steps, options = null) {
47
+ return {
48
+ type: AnimationMetadataType.Sequence,
49
+ steps,
50
+ options
51
+ };
52
+ }
53
+ function style(tokens) {
54
+ return {
55
+ type: AnimationMetadataType.Style,
56
+ styles: tokens,
57
+ offset: null
58
+ };
59
+ }
60
+ function state(name, styles, options) {
61
+ return {
62
+ type: AnimationMetadataType.State,
63
+ name,
64
+ styles,
65
+ options
66
+ };
67
+ }
68
+ function keyframes(steps) {
69
+ return {
70
+ type: AnimationMetadataType.Keyframes,
71
+ steps
72
+ };
73
+ }
74
+ function transition(stateChangeExpr, steps, options = null) {
75
+ return {
76
+ type: AnimationMetadataType.Transition,
77
+ expr: stateChangeExpr,
78
+ animation: steps,
79
+ options
80
+ };
81
+ }
82
+ function animation(steps, options = null) {
83
+ return {
84
+ type: AnimationMetadataType.Reference,
85
+ animation: steps,
86
+ options
87
+ };
88
+ }
89
+ function animateChild(options = null) {
90
+ return {
91
+ type: AnimationMetadataType.AnimateChild,
92
+ options
93
+ };
94
+ }
95
+ function useAnimation(animation, options = null) {
96
+ return {
97
+ type: AnimationMetadataType.AnimateRef,
98
+ animation,
99
+ options
100
+ };
101
+ }
102
+ function query(selector, animation, options = null) {
103
+ return {
104
+ type: AnimationMetadataType.Query,
105
+ selector,
106
+ animation,
107
+ options
108
+ };
109
+ }
110
+ function stagger(timings, animation) {
111
+ return {
112
+ type: AnimationMetadataType.Stagger,
113
+ timings,
114
+ animation
115
+ };
116
+ }
117
+
118
+ class NoopAnimationPlayer {
119
+ _onDoneFns = [];
120
+ _onStartFns = [];
121
+ _onDestroyFns = [];
122
+ _originalOnDoneFns = [];
123
+ _originalOnStartFns = [];
124
+ _started = false;
125
+ _destroyed = false;
126
+ _finished = false;
127
+ _position = 0;
128
+ parentPlayer = null;
129
+ totalTime;
130
+ constructor(duration = 0, delay = 0) {
131
+ this.totalTime = duration + delay;
132
+ }
133
+ _onFinish() {
134
+ if (!this._finished) {
135
+ this._finished = true;
136
+ this._onDoneFns.forEach(fn => fn());
137
+ this._onDoneFns = [];
138
+ }
139
+ }
140
+ onStart(fn) {
141
+ this._originalOnStartFns.push(fn);
142
+ this._onStartFns.push(fn);
143
+ }
144
+ onDone(fn) {
145
+ this._originalOnDoneFns.push(fn);
146
+ this._onDoneFns.push(fn);
147
+ }
148
+ onDestroy(fn) {
149
+ this._onDestroyFns.push(fn);
150
+ }
151
+ hasStarted() {
152
+ return this._started;
153
+ }
154
+ init() {}
155
+ play() {
156
+ if (!this.hasStarted()) {
157
+ this._onStart();
158
+ this.triggerMicrotask();
159
+ }
160
+ this._started = true;
161
+ }
162
+ triggerMicrotask() {
163
+ queueMicrotask(() => this._onFinish());
164
+ }
165
+ _onStart() {
166
+ this._onStartFns.forEach(fn => fn());
167
+ this._onStartFns = [];
168
+ }
169
+ pause() {}
170
+ restart() {}
171
+ finish() {
172
+ this._onFinish();
173
+ }
174
+ destroy() {
175
+ if (!this._destroyed) {
176
+ this._destroyed = true;
177
+ if (!this.hasStarted()) {
178
+ this._onStart();
179
+ }
180
+ this.finish();
181
+ this._onDestroyFns.forEach(fn => fn());
182
+ this._onDestroyFns = [];
183
+ }
184
+ }
185
+ reset() {
186
+ this._started = false;
187
+ this._finished = false;
188
+ this._onStartFns = this._originalOnStartFns;
189
+ this._onDoneFns = this._originalOnDoneFns;
190
+ }
191
+ setPosition(position) {
192
+ this._position = this.totalTime ? position * this.totalTime : 1;
193
+ }
194
+ getPosition() {
195
+ return this.totalTime ? this._position / this.totalTime : 1;
196
+ }
197
+ triggerCallback(phaseName) {
198
+ const methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
199
+ methods.forEach(fn => fn());
200
+ methods.length = 0;
201
+ }
202
+ }
203
+
204
+ class AnimationGroupPlayer {
205
+ _onDoneFns = [];
206
+ _onStartFns = [];
207
+ _finished = false;
208
+ _started = false;
209
+ _destroyed = false;
210
+ _onDestroyFns = [];
211
+ parentPlayer = null;
212
+ totalTime = 0;
213
+ players;
214
+ constructor(_players) {
215
+ this.players = _players;
216
+ let doneCount = 0;
217
+ let destroyCount = 0;
218
+ let startCount = 0;
219
+ const total = this.players.length;
220
+ if (total == 0) {
221
+ queueMicrotask(() => this._onFinish());
222
+ } else {
223
+ this.players.forEach(player => {
224
+ player.onDone(() => {
225
+ if (++doneCount == total) {
226
+ this._onFinish();
227
+ }
228
+ });
229
+ player.onDestroy(() => {
230
+ if (++destroyCount == total) {
231
+ this._onDestroy();
232
+ }
233
+ });
234
+ player.onStart(() => {
235
+ if (++startCount == total) {
236
+ this._onStart();
237
+ }
238
+ });
239
+ });
240
+ }
241
+ this.totalTime = this.players.reduce((time, player) => Math.max(time, player.totalTime), 0);
242
+ }
243
+ _onFinish() {
244
+ if (!this._finished) {
245
+ this._finished = true;
246
+ this._onDoneFns.forEach(fn => fn());
247
+ this._onDoneFns = [];
248
+ }
249
+ }
250
+ init() {
251
+ this.players.forEach(player => player.init());
252
+ }
253
+ onStart(fn) {
254
+ this._onStartFns.push(fn);
255
+ }
256
+ _onStart() {
257
+ if (!this.hasStarted()) {
258
+ this._started = true;
259
+ this._onStartFns.forEach(fn => fn());
260
+ this._onStartFns = [];
261
+ }
262
+ }
263
+ onDone(fn) {
264
+ this._onDoneFns.push(fn);
265
+ }
266
+ onDestroy(fn) {
267
+ this._onDestroyFns.push(fn);
268
+ }
269
+ hasStarted() {
270
+ return this._started;
271
+ }
272
+ play() {
273
+ if (!this.parentPlayer) {
274
+ this.init();
275
+ }
276
+ this._onStart();
277
+ this.players.forEach(player => player.play());
278
+ }
279
+ pause() {
280
+ this.players.forEach(player => player.pause());
281
+ }
282
+ restart() {
283
+ this.players.forEach(player => player.restart());
284
+ }
285
+ finish() {
286
+ this._onFinish();
287
+ this.players.forEach(player => player.finish());
288
+ }
289
+ destroy() {
290
+ this._onDestroy();
291
+ }
292
+ _onDestroy() {
293
+ if (!this._destroyed) {
294
+ this._destroyed = true;
295
+ this._onFinish();
296
+ this.players.forEach(player => player.destroy());
297
+ this._onDestroyFns.forEach(fn => fn());
298
+ this._onDestroyFns = [];
299
+ }
300
+ }
301
+ reset() {
302
+ this.players.forEach(player => player.reset());
303
+ this._destroyed = false;
304
+ this._finished = false;
305
+ this._started = false;
306
+ }
307
+ setPosition(p) {
308
+ const timeAtPosition = p * this.totalTime;
309
+ this.players.forEach(player => {
310
+ const position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1;
311
+ player.setPosition(position);
312
+ });
313
+ }
314
+ getPosition() {
315
+ const longestPlayer = this.players.reduce((longestSoFar, player) => {
316
+ const newPlayerIsLongest = longestSoFar === null || player.totalTime > longestSoFar.totalTime;
317
+ return newPlayerIsLongest ? player : longestSoFar;
318
+ }, null);
319
+ return longestPlayer != null ? longestPlayer.getPosition() : 0;
320
+ }
321
+ beforeDestroy() {
322
+ this.players.forEach(player => {
323
+ if (player.beforeDestroy) {
324
+ player.beforeDestroy();
325
+ }
326
+ });
327
+ }
328
+ triggerCallback(phaseName) {
329
+ const methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
330
+ methods.forEach(fn => fn());
331
+ methods.length = 0;
332
+ }
333
+ }
334
+
335
+ const ɵPRE_STYLE = '!';
336
+
337
+ export { AUTO_STYLE, AnimationGroupPlayer, AnimationMetadataType, NoopAnimationPlayer, animate, animateChild, animation, group, keyframes, query, sequence, stagger, state, style, transition, trigger, useAnimation, ɵPRE_STYLE };
338
+ //# sourceMappingURL=_private_export-chunk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_private_export-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/packages/animations/src/players/animation_group_player.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {AnimationPlayer} from './animation_player';\n\n/**\n * A programmatic controller for a group of reusable animations.\n * Used internally to control animations.\n *\n * @see {@link AnimationPlayer}\n * @see {@link animations/group group}\n *\n */\nexport class AnimationGroupPlayer implements AnimationPlayer {\n private _onDoneFns: Function[] = [];\n private _onStartFns: Function[] = [];\n private _finished = false;\n private _started = false;\n private _destroyed = false;\n private _onDestroyFns: Function[] = [];\n\n public parentPlayer: AnimationPlayer | null = null;\n public totalTime: number = 0;\n public readonly players: AnimationPlayer[];\n\n constructor(_players: AnimationPlayer[]) {\n this.players = _players;\n let doneCount = 0;\n let destroyCount = 0;\n let startCount = 0;\n const total = this.players.length;\n\n if (total == 0) {\n queueMicrotask(() => this._onFinish());\n } else {\n this.players.forEach((player) => {\n player.onDone(() => {\n if (++doneCount == total) {\n this._onFinish();\n }\n });\n player.onDestroy(() => {\n if (++destroyCount == total) {\n this._onDestroy();\n }\n });\n player.onStart(() => {\n if (++startCount == total) {\n this._onStart();\n }\n });\n });\n }\n\n this.totalTime = this.players.reduce((time, player) => Math.max(time, player.totalTime), 0);\n }\n\n private _onFinish() {\n if (!this._finished) {\n this._finished = true;\n this._onDoneFns.forEach((fn) => fn());\n this._onDoneFns = [];\n }\n }\n\n init(): void {\n this.players.forEach((player) => player.init());\n }\n\n onStart(fn: () => void): void {\n this._onStartFns.push(fn);\n }\n\n private _onStart() {\n if (!this.hasStarted()) {\n this._started = true;\n this._onStartFns.forEach((fn) => fn());\n this._onStartFns = [];\n }\n }\n\n onDone(fn: () => void): void {\n this._onDoneFns.push(fn);\n }\n\n onDestroy(fn: () => void): void {\n this._onDestroyFns.push(fn);\n }\n\n hasStarted() {\n return this._started;\n }\n\n play() {\n if (!this.parentPlayer) {\n this.init();\n }\n this._onStart();\n this.players.forEach((player) => player.play());\n }\n\n pause(): void {\n this.players.forEach((player) => player.pause());\n }\n\n restart(): void {\n this.players.forEach((player) => player.restart());\n }\n\n finish(): void {\n this._onFinish();\n this.players.forEach((player) => player.finish());\n }\n\n destroy(): void {\n this._onDestroy();\n }\n\n private _onDestroy() {\n if (!this._destroyed) {\n this._destroyed = true;\n this._onFinish();\n this.players.forEach((player) => player.destroy());\n this._onDestroyFns.forEach((fn) => fn());\n this._onDestroyFns = [];\n }\n }\n\n reset(): void {\n this.players.forEach((player) => player.reset());\n this._destroyed = false;\n this._finished = false;\n this._started = false;\n }\n\n setPosition(p: number): void {\n const timeAtPosition = p * this.totalTime;\n this.players.forEach((player) => {\n const position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1;\n player.setPosition(position);\n });\n }\n\n getPosition(): number {\n const longestPlayer = this.players.reduce(\n (longestSoFar: AnimationPlayer | null, player: AnimationPlayer) => {\n const newPlayerIsLongest =\n longestSoFar === null || player.totalTime > longestSoFar.totalTime;\n return newPlayerIsLongest ? player : longestSoFar;\n },\n null,\n );\n return longestPlayer != null ? longestPlayer.getPosition() : 0;\n }\n\n beforeDestroy(): void {\n this.players.forEach((player) => {\n if (player.beforeDestroy) {\n player.beforeDestroy();\n }\n });\n }\n\n /** @internal */\n triggerCallback(phaseName: string): void {\n const methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;\n methods.forEach((fn) => fn());\n methods.length = 0;\n }\n}\n"],"names":["_onDestroyFns","parentPlayer","totalTime","players","constructor","_players","doneCount","destroyCount","startCount","total","length","queueMicrotask","_onFinish","forEach","player","onDone","onDestroy","onStart","_onStart","reduce","time","Math","max","_finished","_onDoneFns","fn","init","push","hasStarted","_started","_onStartFns","play","pause","restart","finish","destroy","_onDestroy","_destroyed","reset","setPosition","p","timeAtPosition","position","min"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BkBA,aAAA,GAAA,EAAA;EAEhBC,YAAA,GAAA,IAAA;AACEC,EAAAA,SAAA,GAAY,CAAW;EACnB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