@angular/animations 21.0.0-next.1 → 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.
@@ -1,212 +1,203 @@
1
1
  /**
2
- * @license Angular v21.0.0-next.1
3
- * (c) 2010-2025 Google LLC. https://angular.io/
2
+ * @license Angular v21.0.0-next.10
3
+ * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { DOCUMENT } from '@angular/common';
8
7
  import * as i0 from '@angular/core';
9
- import { inject, Injectable, ANIMATION_MODULE_TYPE, ɵRuntimeError as _RuntimeError, Inject, ViewEncapsulation } from '@angular/core';
10
- import { sequence } from './private_export.mjs';
11
- export { AUTO_STYLE, AnimationMetadataType, NoopAnimationPlayer, animate, animateChild, animation, group, keyframes, query, stagger, state, style, transition, trigger, useAnimation, AnimationGroupPlayer as ɵAnimationGroupPlayer, ɵPRE_STYLE } from './private_export.mjs';
8
+ import { inject, Injectable, ANIMATION_MODULE_TYPE, ɵRuntimeError as _RuntimeError, DOCUMENT, Inject, ViewEncapsulation } from '@angular/core';
9
+ import { sequence } from './_private_export-chunk.mjs';
10
+ export { AUTO_STYLE, AnimationMetadataType, NoopAnimationPlayer, animate, animateChild, animation, group, keyframes, query, stagger, state, style, transition, trigger, useAnimation, AnimationGroupPlayer as ɵAnimationGroupPlayer, ɵPRE_STYLE } from './_private_export-chunk.mjs';
12
11
 
13
- /**
14
- * An injectable service that produces an animation sequence programmatically within an
15
- * Angular component or directive.
16
- * Provided by the `BrowserAnimationsModule` or `NoopAnimationsModule`.
17
- *
18
- * @usageNotes
19
- *
20
- * To use this service, add it to your component or directive as a dependency.
21
- * The service is instantiated along with your component.
22
- *
23
- * Apps do not typically need to create their own animation players, but if you
24
- * do need to, follow these steps:
25
- *
26
- * 1. Use the <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code> method
27
- * to create a programmatic animation. The method returns an `AnimationFactory` instance.
28
- *
29
- * 2. Use the factory object to create an `AnimationPlayer` and attach it to a DOM element.
30
- *
31
- * 3. Use the player object to control the animation programmatically.
32
- *
33
- * For example:
34
- *
35
- * ```ts
36
- * // import the service from BrowserAnimationsModule
37
- * import {AnimationBuilder} from '@angular/animations';
38
- * // require the service as a dependency
39
- * class MyCmp {
40
- * constructor(private _builder: AnimationBuilder) {}
41
- *
42
- * makeAnimation(element: any) {
43
- * // first define a reusable animation
44
- * const myAnimation = this._builder.build([
45
- * style({ width: 0 }),
46
- * animate(1000, style({ width: '100px' }))
47
- * ]);
48
- *
49
- * // use the returned factory object to create a player
50
- * const player = myAnimation.create(element);
51
- *
52
- * player.play();
53
- * }
54
- * }
55
- * ```
56
- *
57
- * @publicApi
58
- *
59
- * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23
60
- */
61
12
  class AnimationBuilder {
62
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: AnimationBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
63
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: AnimationBuilder, providedIn: 'root', useFactory: () => inject(BrowserAnimationBuilder) });
64
- }
65
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: AnimationBuilder, decorators: [{
66
- type: Injectable,
67
- args: [{ providedIn: 'root', useFactory: () => inject(BrowserAnimationBuilder) }]
68
- }] });
69
- /**
70
- * A factory object returned from the
71
- * <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code>
72
- * method.
73
- *
74
- * @publicApi
75
- *
76
- * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23
77
- */
78
- class AnimationFactory {
13
+ static ɵfac = i0.ɵɵngDeclareFactory({
14
+ minVersion: "12.0.0",
15
+ version: "21.0.0-next.10",
16
+ ngImport: i0,
17
+ type: AnimationBuilder,
18
+ deps: [],
19
+ target: i0.ɵɵFactoryTarget.Injectable
20
+ });
21
+ static ɵprov = i0.ɵɵngDeclareInjectable({
22
+ minVersion: "12.0.0",
23
+ version: "21.0.0-next.10",
24
+ ngImport: i0,
25
+ type: AnimationBuilder,
26
+ providedIn: 'root',
27
+ useFactory: () => inject(BrowserAnimationBuilder)
28
+ });
79
29
  }
30
+ i0.ɵɵngDeclareClassMetadata({
31
+ minVersion: "12.0.0",
32
+ version: "21.0.0-next.10",
33
+ ngImport: i0,
34
+ type: AnimationBuilder,
35
+ decorators: [{
36
+ type: Injectable,
37
+ args: [{
38
+ providedIn: 'root',
39
+ useFactory: () => inject(BrowserAnimationBuilder)
40
+ }]
41
+ }]
42
+ });
43
+ class AnimationFactory {}
80
44
  class BrowserAnimationBuilder extends AnimationBuilder {
81
- animationModuleType = inject(ANIMATION_MODULE_TYPE, { optional: true });
82
- _nextAnimationId = 0;
83
- _renderer;
84
- constructor(rootRenderer, doc) {
85
- super();
86
- const typeData = {
87
- id: '0',
88
- encapsulation: ViewEncapsulation.None,
89
- styles: [],
90
- data: { animation: [] },
91
- };
92
- this._renderer = rootRenderer.createRenderer(doc.body, typeData);
93
- if (this.animationModuleType === null && !isAnimationRenderer(this._renderer)) {
94
- // We only support AnimationRenderer & DynamicDelegationRenderer for this AnimationBuilder
95
- throw new _RuntimeError(3600 /* RuntimeErrorCode.BROWSER_ANIMATION_BUILDER_INJECTED_WITHOUT_ANIMATIONS */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
96
- 'Angular detected that the `AnimationBuilder` was injected, but animation support was not enabled. ' +
97
- 'Please make sure that you enable animations in your application by calling `provideAnimations()` or `provideAnimationsAsync()` function.');
98
- }
99
- }
100
- build(animation) {
101
- const id = this._nextAnimationId;
102
- this._nextAnimationId++;
103
- const entry = Array.isArray(animation) ? sequence(animation) : animation;
104
- issueAnimationCommand(this._renderer, null, id, 'register', [entry]);
105
- return new BrowserAnimationFactory(id, this._renderer);
106
- }
107
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: BrowserAnimationBuilder, deps: [{ token: i0.RendererFactory2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
108
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: BrowserAnimationBuilder, providedIn: 'root' });
45
+ animationModuleType = inject(ANIMATION_MODULE_TYPE, {
46
+ optional: true
47
+ });
48
+ _nextAnimationId = 0;
49
+ _renderer;
50
+ constructor(rootRenderer, doc) {
51
+ super();
52
+ const typeData = {
53
+ id: '0',
54
+ encapsulation: ViewEncapsulation.None,
55
+ styles: [],
56
+ data: {
57
+ animation: []
58
+ }
59
+ };
60
+ this._renderer = rootRenderer.createRenderer(doc.body, typeData);
61
+ if (this.animationModuleType === null && !isAnimationRenderer(this._renderer)) {
62
+ throw new _RuntimeError(3600, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Angular detected that the `AnimationBuilder` was injected, but animation support was not enabled. ' + 'Please make sure that you enable animations in your application by calling `provideAnimations()` or `provideAnimationsAsync()` function.');
63
+ }
64
+ }
65
+ build(animation) {
66
+ const id = this._nextAnimationId;
67
+ this._nextAnimationId++;
68
+ const entry = Array.isArray(animation) ? sequence(animation) : animation;
69
+ issueAnimationCommand(this._renderer, null, id, 'register', [entry]);
70
+ return new BrowserAnimationFactory(id, this._renderer);
71
+ }
72
+ static ɵfac = i0.ɵɵngDeclareFactory({
73
+ minVersion: "12.0.0",
74
+ version: "21.0.0-next.10",
75
+ ngImport: i0,
76
+ type: BrowserAnimationBuilder,
77
+ deps: [{
78
+ token: i0.RendererFactory2
79
+ }, {
80
+ token: DOCUMENT
81
+ }],
82
+ target: i0.ɵɵFactoryTarget.Injectable
83
+ });
84
+ static ɵprov = i0.ɵɵngDeclareInjectable({
85
+ minVersion: "12.0.0",
86
+ version: "21.0.0-next.10",
87
+ ngImport: i0,
88
+ type: BrowserAnimationBuilder,
89
+ providedIn: 'root'
90
+ });
109
91
  }
110
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: BrowserAnimationBuilder, decorators: [{
111
- type: Injectable,
112
- args: [{ providedIn: 'root' }]
113
- }], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: Document, decorators: [{
114
- type: Inject,
115
- args: [DOCUMENT]
116
- }] }] });
92
+ i0.ɵɵngDeclareClassMetadata({
93
+ minVersion: "12.0.0",
94
+ version: "21.0.0-next.10",
95
+ ngImport: i0,
96
+ type: BrowserAnimationBuilder,
97
+ decorators: [{
98
+ type: Injectable,
99
+ args: [{
100
+ providedIn: 'root'
101
+ }]
102
+ }],
103
+ ctorParameters: () => [{
104
+ type: i0.RendererFactory2
105
+ }, {
106
+ type: Document,
107
+ decorators: [{
108
+ type: Inject,
109
+ args: [DOCUMENT]
110
+ }]
111
+ }]
112
+ });
117
113
  class BrowserAnimationFactory extends AnimationFactory {
118
- _id;
119
- _renderer;
120
- constructor(_id, _renderer) {
121
- super();
122
- this._id = _id;
123
- this._renderer = _renderer;
124
- }
125
- create(element, options) {
126
- return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);
127
- }
114
+ _id;
115
+ _renderer;
116
+ constructor(_id, _renderer) {
117
+ super();
118
+ this._id = _id;
119
+ this._renderer = _renderer;
120
+ }
121
+ create(element, options) {
122
+ return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);
123
+ }
128
124
  }
129
125
  class RendererAnimationPlayer {
130
- id;
131
- element;
132
- _renderer;
133
- parentPlayer = null;
134
- _started = false;
135
- constructor(id, element, options, _renderer) {
136
- this.id = id;
137
- this.element = element;
138
- this._renderer = _renderer;
139
- this._command('create', options);
140
- }
141
- _listen(eventName, callback) {
142
- return this._renderer.listen(this.element, `@@${this.id}:${eventName}`, callback);
143
- }
144
- _command(command, ...args) {
145
- issueAnimationCommand(this._renderer, this.element, this.id, command, args);
146
- }
147
- onDone(fn) {
148
- this._listen('done', fn);
149
- }
150
- onStart(fn) {
151
- this._listen('start', fn);
152
- }
153
- onDestroy(fn) {
154
- this._listen('destroy', fn);
155
- }
156
- init() {
157
- this._command('init');
158
- }
159
- hasStarted() {
160
- return this._started;
161
- }
162
- play() {
163
- this._command('play');
164
- this._started = true;
165
- }
166
- pause() {
167
- this._command('pause');
168
- }
169
- restart() {
170
- this._command('restart');
171
- }
172
- finish() {
173
- this._command('finish');
174
- }
175
- destroy() {
176
- this._command('destroy');
177
- }
178
- reset() {
179
- this._command('reset');
180
- this._started = false;
181
- }
182
- setPosition(p) {
183
- this._command('setPosition', p);
184
- }
185
- getPosition() {
186
- return unwrapAnimationRenderer(this._renderer)?.engine?.players[this.id]?.getPosition() ?? 0;
187
- }
188
- totalTime = 0;
126
+ id;
127
+ element;
128
+ _renderer;
129
+ parentPlayer = null;
130
+ _started = false;
131
+ constructor(id, element, options, _renderer) {
132
+ this.id = id;
133
+ this.element = element;
134
+ this._renderer = _renderer;
135
+ this._command('create', options);
136
+ }
137
+ _listen(eventName, callback) {
138
+ return this._renderer.listen(this.element, `@@${this.id}:${eventName}`, callback);
139
+ }
140
+ _command(command, ...args) {
141
+ issueAnimationCommand(this._renderer, this.element, this.id, command, args);
142
+ }
143
+ onDone(fn) {
144
+ this._listen('done', fn);
145
+ }
146
+ onStart(fn) {
147
+ this._listen('start', fn);
148
+ }
149
+ onDestroy(fn) {
150
+ this._listen('destroy', fn);
151
+ }
152
+ init() {
153
+ this._command('init');
154
+ }
155
+ hasStarted() {
156
+ return this._started;
157
+ }
158
+ play() {
159
+ this._command('play');
160
+ this._started = true;
161
+ }
162
+ pause() {
163
+ this._command('pause');
164
+ }
165
+ restart() {
166
+ this._command('restart');
167
+ }
168
+ finish() {
169
+ this._command('finish');
170
+ }
171
+ destroy() {
172
+ this._command('destroy');
173
+ }
174
+ reset() {
175
+ this._command('reset');
176
+ this._started = false;
177
+ }
178
+ setPosition(p) {
179
+ this._command('setPosition', p);
180
+ }
181
+ getPosition() {
182
+ return unwrapAnimationRenderer(this._renderer)?.engine?.players[this.id]?.getPosition() ?? 0;
183
+ }
184
+ totalTime = 0;
189
185
  }
190
186
  function issueAnimationCommand(renderer, element, id, command, args) {
191
- renderer.setProperty(element, `@@${id}:${command}`, args);
187
+ renderer.setProperty(element, `@@${id}:${command}`, args);
192
188
  }
193
- /**
194
- * The following 2 methods cannot reference their correct types (AnimationRenderer &
195
- * DynamicDelegationRenderer) since this would introduce a import cycle.
196
- */
197
189
  function unwrapAnimationRenderer(renderer) {
198
- const type = renderer.ɵtype;
199
- if (type === 0 /* AnimationRendererType.Regular */) {
200
- return renderer;
201
- }
202
- else if (type === 1 /* AnimationRendererType.Delegated */) {
203
- return renderer.animationRenderer;
204
- }
205
- return null;
190
+ const type = renderer.ɵtype;
191
+ if (type === 0) {
192
+ return renderer;
193
+ } else if (type === 1) {
194
+ return renderer.animationRenderer;
195
+ }
196
+ return null;
206
197
  }
207
198
  function isAnimationRenderer(renderer) {
208
- const type = renderer.ɵtype;
209
- return type === 0 /* AnimationRendererType.Regular */ || type === 1 /* AnimationRendererType.Delegated */;
199
+ const type = renderer.ɵtype;
200
+ return type === 0 || type === 1;
210
201
  }
211
202
 
212
203
  export { AnimationBuilder, AnimationFactory, sequence, BrowserAnimationBuilder as ɵBrowserAnimationBuilder };
@@ -1 +1 @@
1
- {"version":3,"file":"animations.mjs","sources":["../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/packages/animations/src/animation_builder.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 */\nimport {DOCUMENT} from '@angular/common';\nimport {\n ANIMATION_MODULE_TYPE,\n Inject,\n inject,\n Injectable,\n Renderer2,\n RendererFactory2,\n RendererType2,\n ViewEncapsulation,\n ɵAnimationRendererType as AnimationRendererType,\n ɵRuntimeError as RuntimeError,\n} from '@angular/core';\n\nimport {AnimationMetadata, AnimationOptions, sequence} from './animation_metadata';\nimport {RuntimeErrorCode} from './errors';\nimport {AnimationPlayer} from './players/animation_player';\n\n/**\n * An injectable service that produces an animation sequence programmatically within an\n * Angular component or directive.\n * Provided by the `BrowserAnimationsModule` or `NoopAnimationsModule`.\n *\n * @usageNotes\n *\n * To use this service, add it to your component or directive as a dependency.\n * The service is instantiated along with your component.\n *\n * Apps do not typically need to create their own animation players, but if you\n * do need to, follow these steps:\n *\n * 1. Use the <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code> method\n * to create a programmatic animation. The method returns an `AnimationFactory` instance.\n *\n * 2. Use the factory object to create an `AnimationPlayer` and attach it to a DOM element.\n *\n * 3. Use the player object to control the animation programmatically.\n *\n * For example:\n *\n * ```ts\n * // import the service from BrowserAnimationsModule\n * import {AnimationBuilder} from '@angular/animations';\n * // require the service as a dependency\n * class MyCmp {\n * constructor(private _builder: AnimationBuilder) {}\n *\n * makeAnimation(element: any) {\n * // first define a reusable animation\n * const myAnimation = this._builder.build([\n * style({ width: 0 }),\n * animate(1000, style({ width: '100px' }))\n * ]);\n *\n * // use the returned factory object to create a player\n * const player = myAnimation.create(element);\n *\n * player.play();\n * }\n * }\n * ```\n *\n * @publicApi\n *\n * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23\n */\n@Injectable({providedIn: 'root', useFactory: () => inject(BrowserAnimationBuilder)})\nexport abstract class AnimationBuilder {\n /**\n * Builds a factory for producing a defined animation.\n * @param animation A reusable animation definition.\n * @returns A factory object that can create a player for the defined animation.\n * @see {@link animate}\n */\n abstract build(animation: AnimationMetadata | AnimationMetadata[]): AnimationFactory;\n}\n\n/**\n * A factory object returned from the\n * <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code>\n * method.\n *\n * @publicApi\n *\n * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23\n */\nexport abstract class AnimationFactory {\n /**\n * Creates an `AnimationPlayer` instance for the reusable animation defined by\n * the <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code>\n * method that created this factory and attaches the new player a DOM element.\n *\n * @param element The DOM element to which to attach the player.\n * @param options A set of options that can include a time delay and\n * additional developer-defined parameters.\n */\n abstract create(element: any, options?: AnimationOptions): AnimationPlayer;\n}\n\n@Injectable({providedIn: 'root'})\nexport class BrowserAnimationBuilder extends AnimationBuilder {\n private animationModuleType = inject(ANIMATION_MODULE_TYPE, {optional: true});\n private _nextAnimationId = 0;\n private _renderer: Renderer2;\n\n constructor(rootRenderer: RendererFactory2, @Inject(DOCUMENT) doc: Document) {\n super();\n const typeData: RendererType2 = {\n id: '0',\n encapsulation: ViewEncapsulation.None,\n styles: [],\n data: {animation: []},\n };\n this._renderer = rootRenderer.createRenderer(doc.body, typeData);\n\n if (this.animationModuleType === null && !isAnimationRenderer(this._renderer)) {\n // We only support AnimationRenderer & DynamicDelegationRenderer for this AnimationBuilder\n\n throw new RuntimeError(\n RuntimeErrorCode.BROWSER_ANIMATION_BUILDER_INJECTED_WITHOUT_ANIMATIONS,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n 'Angular detected that the `AnimationBuilder` was injected, but animation support was not enabled. ' +\n 'Please make sure that you enable animations in your application by calling `provideAnimations()` or `provideAnimationsAsync()` function.',\n );\n }\n }\n\n override build(animation: AnimationMetadata | AnimationMetadata[]): AnimationFactory {\n const id = this._nextAnimationId;\n this._nextAnimationId++;\n const entry = Array.isArray(animation) ? sequence(animation) : animation;\n issueAnimationCommand(this._renderer, null, id, 'register', [entry]);\n return new BrowserAnimationFactory(id, this._renderer);\n }\n}\n\nclass BrowserAnimationFactory extends AnimationFactory {\n constructor(\n private _id: number,\n private _renderer: Renderer2,\n ) {\n super();\n }\n\n override create(element: any, options?: AnimationOptions): AnimationPlayer {\n return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);\n }\n}\n\nclass RendererAnimationPlayer implements AnimationPlayer {\n public parentPlayer: AnimationPlayer | null = null;\n private _started = false;\n\n constructor(\n public id: number,\n public element: any,\n options: AnimationOptions,\n private _renderer: Renderer2,\n ) {\n this._command('create', options);\n }\n\n private _listen(eventName: string, callback: (event: any) => any): () => void {\n return this._renderer.listen(this.element, `@@${this.id}:${eventName}`, callback);\n }\n\n private _command(command: string, ...args: any[]): void {\n issueAnimationCommand(this._renderer, this.element, this.id, command, args);\n }\n\n onDone(fn: () => void): void {\n this._listen('done', fn);\n }\n\n onStart(fn: () => void): void {\n this._listen('start', fn);\n }\n\n onDestroy(fn: () => void): void {\n this._listen('destroy', fn);\n }\n\n init(): void {\n this._command('init');\n }\n\n hasStarted(): boolean {\n return this._started;\n }\n\n play(): void {\n this._command('play');\n this._started = true;\n }\n\n pause(): void {\n this._command('pause');\n }\n\n restart(): void {\n this._command('restart');\n }\n\n finish(): void {\n this._command('finish');\n }\n\n destroy(): void {\n this._command('destroy');\n }\n\n reset(): void {\n this._command('reset');\n this._started = false;\n }\n\n setPosition(p: number): void {\n this._command('setPosition', p);\n }\n\n getPosition(): number {\n return unwrapAnimationRenderer(this._renderer)?.engine?.players[this.id]?.getPosition() ?? 0;\n }\n\n public totalTime = 0;\n}\n\nfunction issueAnimationCommand(\n renderer: Renderer2,\n element: any,\n id: number,\n command: string,\n args: any[],\n): void {\n renderer.setProperty(element, `@@${id}:${command}`, args);\n}\n\n/**\n * The following 2 methods cannot reference their correct types (AnimationRenderer &\n * DynamicDelegationRenderer) since this would introduce a import cycle.\n */\n\nfunction unwrapAnimationRenderer(\n renderer: Renderer2,\n): {engine: {players: AnimationPlayer[]}} | null {\n const type = (renderer as unknown as {ɵtype: AnimationRendererType}).ɵtype;\n if (type === AnimationRendererType.Regular) {\n return renderer as any;\n } else if (type === AnimationRendererType.Delegated) {\n return (renderer as any).animationRenderer;\n }\n\n return null;\n}\n\nfunction isAnimationRenderer(renderer: Renderer2): boolean {\n const type = (renderer as unknown as {ɵtype: AnimationRendererType}).ɵtype;\n return type === AnimationRendererType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AEnB,IAAA,MAAM,IAAI,GAAI,QAAsD,CAAC,KAAK;IAC1E,IAAI,IAAI,KAAkC,CAAA,sCAAE;AAC1C,QAAA,OAAO,QAAe;;SACjB,IAAI,IAAI,KAAoC,CAAA,wCAAE;QACnD,OAAQ,QAAgB,CAAC,iBAAiB;;AAG5C,IAAA,OAAO,IAAI;AACb;AAEA,SAAS,mBAAmB,CAAC,QAAmB,EAAA;AAC9C,IAAA,MAAM,IAAI,GAAI,QAAsD,CAAC,KAAK;AAC1E,IAAA,OAAO,IAAI,KAAA,CAAA,wCAAsC,IAAI;AACvD;;;;"}
1
+ {"version":3,"file":"animations.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/packages/animations/src/animation_builder.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 */\nimport {\n ANIMATION_MODULE_TYPE,\n DOCUMENT,\n Inject,\n inject,\n Injectable,\n Renderer2,\n RendererFactory2,\n RendererType2,\n ViewEncapsulation,\n ɵAnimationRendererType as AnimationRendererType,\n ɵRuntimeError as RuntimeError,\n} from '@angular/core';\n\nimport {AnimationMetadata, AnimationOptions, sequence} from './animation_metadata';\nimport {RuntimeErrorCode} from './errors';\nimport {AnimationPlayer} from './players/animation_player';\n\n/**\n * An injectable service that produces an animation sequence programmatically within an\n * Angular component or directive.\n * Provided by the `BrowserAnimationsModule` or `NoopAnimationsModule`.\n *\n * @usageNotes\n *\n * To use this service, add it to your component or directive as a dependency.\n * The service is instantiated along with your component.\n *\n * Apps do not typically need to create their own animation players, but if you\n * do need to, follow these steps:\n *\n * 1. Use the <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code> method\n * to create a programmatic animation. The method returns an `AnimationFactory` instance.\n *\n * 2. Use the factory object to create an `AnimationPlayer` and attach it to a DOM element.\n *\n * 3. Use the player object to control the animation programmatically.\n *\n * For example:\n *\n * ```ts\n * // import the service from BrowserAnimationsModule\n * import {AnimationBuilder} from '@angular/animations';\n * // require the service as a dependency\n * class MyCmp {\n * constructor(private _builder: AnimationBuilder) {}\n *\n * makeAnimation(element: any) {\n * // first define a reusable animation\n * const myAnimation = this._builder.build([\n * style({ width: 0 }),\n * animate(1000, style({ width: '100px' }))\n * ]);\n *\n * // use the returned factory object to create a player\n * const player = myAnimation.create(element);\n *\n * player.play();\n * }\n * }\n * ```\n *\n * @publicApi\n *\n * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23\n */\n@Injectable({providedIn: 'root', useFactory: () => inject(BrowserAnimationBuilder)})\nexport abstract class AnimationBuilder {\n /**\n * Builds a factory for producing a defined animation.\n * @param animation A reusable animation definition.\n * @returns A factory object that can create a player for the defined animation.\n * @see {@link animate}\n */\n abstract build(animation: AnimationMetadata | AnimationMetadata[]): AnimationFactory;\n}\n\n/**\n * A factory object returned from the\n * <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code>\n * method.\n *\n * @publicApi\n *\n * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23\n */\nexport abstract class AnimationFactory {\n /**\n * Creates an `AnimationPlayer` instance for the reusable animation defined by\n * the <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code>\n * method that created this factory and attaches the new player a DOM element.\n *\n * @param element The DOM element to which to attach the player.\n * @param options A set of options that can include a time delay and\n * additional developer-defined parameters.\n */\n abstract create(element: any, options?: AnimationOptions): AnimationPlayer;\n}\n\n@Injectable({providedIn: 'root'})\nexport class BrowserAnimationBuilder extends AnimationBuilder {\n private animationModuleType = inject(ANIMATION_MODULE_TYPE, {optional: true});\n private _nextAnimationId = 0;\n private _renderer: Renderer2;\n\n constructor(rootRenderer: RendererFactory2, @Inject(DOCUMENT) doc: Document) {\n super();\n const typeData: RendererType2 = {\n id: '0',\n encapsulation: ViewEncapsulation.None,\n styles: [],\n data: {animation: []},\n };\n this._renderer = rootRenderer.createRenderer(doc.body, typeData);\n\n if (this.animationModuleType === null && !isAnimationRenderer(this._renderer)) {\n // We only support AnimationRenderer & DynamicDelegationRenderer for this AnimationBuilder\n\n throw new RuntimeError(\n RuntimeErrorCode.BROWSER_ANIMATION_BUILDER_INJECTED_WITHOUT_ANIMATIONS,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n 'Angular detected that the `AnimationBuilder` was injected, but animation support was not enabled. ' +\n 'Please make sure that you enable animations in your application by calling `provideAnimations()` or `provideAnimationsAsync()` function.',\n );\n }\n }\n\n override build(animation: AnimationMetadata | AnimationMetadata[]): AnimationFactory {\n const id = this._nextAnimationId;\n this._nextAnimationId++;\n const entry = Array.isArray(animation) ? sequence(animation) : animation;\n issueAnimationCommand(this._renderer, null, id, 'register', [entry]);\n return new BrowserAnimationFactory(id, this._renderer);\n }\n}\n\nclass BrowserAnimationFactory extends AnimationFactory {\n constructor(\n private _id: number,\n private _renderer: Renderer2,\n ) {\n super();\n }\n\n override create(element: any, options?: AnimationOptions): AnimationPlayer {\n return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);\n }\n}\n\nclass RendererAnimationPlayer implements AnimationPlayer {\n public parentPlayer: AnimationPlayer | null = null;\n private _started = false;\n\n constructor(\n public id: number,\n public element: any,\n options: AnimationOptions,\n private _renderer: Renderer2,\n ) {\n this._command('create', options);\n }\n\n private _listen(eventName: string, callback: (event: any) => any): () => void {\n return this._renderer.listen(this.element, `@@${this.id}:${eventName}`, callback);\n }\n\n private _command(command: string, ...args: any[]): void {\n issueAnimationCommand(this._renderer, this.element, this.id, command, args);\n }\n\n onDone(fn: () => void): void {\n this._listen('done', fn);\n }\n\n onStart(fn: () => void): void {\n this._listen('start', fn);\n }\n\n onDestroy(fn: () => void): void {\n this._listen('destroy', fn);\n }\n\n init(): void {\n this._command('init');\n }\n\n hasStarted(): boolean {\n return this._started;\n }\n\n play(): void {\n this._command('play');\n this._started = true;\n }\n\n pause(): void {\n this._command('pause');\n }\n\n restart(): void {\n this._command('restart');\n }\n\n finish(): void {\n this._command('finish');\n }\n\n destroy(): void {\n this._command('destroy');\n }\n\n reset(): void {\n this._command('reset');\n this._started = false;\n }\n\n setPosition(p: number): void {\n this._command('setPosition', p);\n }\n\n getPosition(): number {\n return unwrapAnimationRenderer(this._renderer)?.engine?.players[this.id]?.getPosition() ?? 0;\n }\n\n public totalTime = 0;\n}\n\nfunction issueAnimationCommand(\n renderer: Renderer2,\n element: any,\n id: number,\n command: string,\n args: any[],\n): void {\n renderer.setProperty(element, `@@${id}:${command}`, args);\n}\n\n/**\n * The following 2 methods cannot reference their correct types (AnimationRenderer &\n * DynamicDelegationRenderer) since this would introduce a import cycle.\n */\n\nfunction unwrapAnimationRenderer(\n renderer: Renderer2,\n): {engine: {players: AnimationPlayer[]}} | null {\n const type = (renderer as unknown as {ɵtype: AnimationRendererType}).ɵtype;\n if (type === AnimationRendererType.Regular) {\n return renderer as any;\n } else if (type === AnimationRendererType.Delegated) {\n return (renderer as any).animationRenderer;\n }\n\n return null;\n}\n\nfunction isAnimationRenderer(renderer: Renderer2): boolean {\n const type = (renderer as unknown as {ɵtype: AnimationRendererType}).ɵtype;\n return type === AnimationRendererType.Regular || type === AnimationRendererType.Delegated;\n}\n"],"names":["id","encapsulation","ViewEncapsulation","None","styles","data","animation","_renderer","rootRenderer","createRenderer","doc","body","typeData","animationModuleType","isAnimationRenderer","RuntimeError","ngDevMode","build","_nextAnimationId","Array","isArray","sequence","entry","BrowserAnimationFactory","ɵfac","i0","ɵɵngDeclareFactory","minVersion","version","ngImport","type","BrowserAnimationBuilder","deps","token","RendererFactory2","DOCUMENT","target","ɵɵFactoryTarget","Injectable","ɵprov","ɵɵngDeclareInjectable","providedIn","decorators","args","ctorParameters","Document","create","element","options","RendererAnimationPlayer","_id","_started","constructor","_command","_listen","eventName","callback","listen","command","issueAnimationCommand","fn","init","hasStarted","play","restart","finish"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgHc,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AAGE,IAAA,OAAA,IACF,CAEMjD,SACJ,CAAAkD,MAAc,CAChB,IAAA,CAAAV,OAAA,EAAA,CAAA,EAAA,EAAA,IAAA,CAAA/C,EAAA,CAAA,CAAA,EAAAuD,SAAA,CAAA,CAAA,EAAAC,QAAA,CAAA;;UAFMH,CAAAK,OAAA,EAAAf,GAAAA,IAAA,EAAA;IAENgB,qBAAA,CAAA,IAAA,CAAApD,SAAA,EAAAwC,IAAAA,CAAAA,OAAA,OAAA/C,EAAA,EAAA0D,OAAA,EAAAf,IAAA,CAAA;;;AAOE,IAAA,IAAK,CAAAW,OAAA,CAAiB,MAAA,EAAAM,EAAA,CAAA;;;AAKtB,IAAA,IAAa,CAAAN,QAAkB,OAAA,EAAAM,EAAA,CAAA;;;QAKjC,CAAAN,OAAA,CAAA,SAAA,EAAAM,EAAA,CAAA;;AAGDC,EAAAA,IAAAA,GAAA;AASC,IAAA,IAAA,CAAAR,QAAoB,CAAA,MAAA,CAAA;;AAGtBS,EAAAA,UAAAA,GAAA;;;AAKSC,EAAAA,IAAAA,GAAA;AAIH,IAAA,IAAA,CAAAV,QAAA,CAAA,MAAA,CAAA;IACF,IAAA,CAAAF,eAAsB;;;AAGxB,IAAA,IAAA,CAAAE,QAAA,CAAA,OAAA,CAAA;AAEA;AAGOW,EAAAA,OAAAA,GAAA;IACP,IAAA,CAAAX,QAAc,CAAsD,SAAC,CAAA;;AAEvEY,EAAAA,MAAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * @license Angular v21.0.0-next.10
3
+ * (c) 2010-2025 Google LLC. https://angular.dev/
4
+ * License: MIT
5
+ */
6
+
7
+ import { validateStyleProperty, camelCaseToDashCase, validateWebAnimatableStyleProperty, containsElement, getParentElement, invokeQuery, normalizeKeyframes$1 as normalizeKeyframes, allowPreviousPlayerStylesMerge } from './_util-chunk.mjs';
8
+ import { NoopAnimationPlayer, AUTO_STYLE } from './_private_export-chunk.mjs';
9
+ import '@angular/core';
10
+
11
+ class MockAnimationDriver {
12
+ static log = [];
13
+ validateStyleProperty(prop) {
14
+ return validateStyleProperty(prop);
15
+ }
16
+ validateAnimatableStyleProperty(prop) {
17
+ const cssProp = camelCaseToDashCase(prop);
18
+ return validateWebAnimatableStyleProperty(cssProp);
19
+ }
20
+ containsElement(elm1, elm2) {
21
+ return containsElement(elm1, elm2);
22
+ }
23
+ getParentElement(element) {
24
+ return getParentElement(element);
25
+ }
26
+ query(element, selector, multi) {
27
+ return invokeQuery(element, selector, multi);
28
+ }
29
+ computeStyle(element, prop, defaultValue) {
30
+ return defaultValue || '';
31
+ }
32
+ animate(element, keyframes, duration, delay, easing, previousPlayers = []) {
33
+ const player = new MockAnimationPlayer(element, keyframes, duration, delay, easing, previousPlayers);
34
+ MockAnimationDriver.log.push(player);
35
+ return player;
36
+ }
37
+ }
38
+ class MockAnimationPlayer extends NoopAnimationPlayer {
39
+ element;
40
+ keyframes;
41
+ duration;
42
+ delay;
43
+ easing;
44
+ previousPlayers;
45
+ __finished = false;
46
+ __started = false;
47
+ previousStyles = new Map();
48
+ _onInitFns = [];
49
+ currentSnapshot = new Map();
50
+ _keyframes = [];
51
+ constructor(element, keyframes, duration, delay, easing, previousPlayers) {
52
+ super(duration, delay);
53
+ this.element = element;
54
+ this.keyframes = keyframes;
55
+ this.duration = duration;
56
+ this.delay = delay;
57
+ this.easing = easing;
58
+ this.previousPlayers = previousPlayers;
59
+ this._keyframes = normalizeKeyframes(keyframes);
60
+ if (allowPreviousPlayerStylesMerge(duration, delay)) {
61
+ previousPlayers.forEach(player => {
62
+ if (player instanceof MockAnimationPlayer) {
63
+ const styles = player.currentSnapshot;
64
+ styles.forEach((val, prop) => this.previousStyles.set(prop, val));
65
+ }
66
+ });
67
+ }
68
+ }
69
+ onInit(fn) {
70
+ this._onInitFns.push(fn);
71
+ }
72
+ init() {
73
+ super.init();
74
+ this._onInitFns.forEach(fn => fn());
75
+ this._onInitFns = [];
76
+ }
77
+ reset() {
78
+ super.reset();
79
+ this.__started = false;
80
+ }
81
+ finish() {
82
+ super.finish();
83
+ this.__finished = true;
84
+ }
85
+ destroy() {
86
+ super.destroy();
87
+ this.__finished = true;
88
+ }
89
+ triggerMicrotask() {}
90
+ play() {
91
+ super.play();
92
+ this.__started = true;
93
+ }
94
+ hasStarted() {
95
+ return this.__started;
96
+ }
97
+ beforeDestroy() {
98
+ const captures = new Map();
99
+ this.previousStyles.forEach((val, prop) => captures.set(prop, val));
100
+ if (this.hasStarted()) {
101
+ this._keyframes.forEach(kf => {
102
+ for (let [prop, val] of kf) {
103
+ if (prop !== 'offset') {
104
+ captures.set(prop, this.__finished ? val : AUTO_STYLE);
105
+ }
106
+ }
107
+ });
108
+ }
109
+ this.currentSnapshot = captures;
110
+ }
111
+ }
112
+
113
+ export { MockAnimationDriver, MockAnimationPlayer };
114
+ //# sourceMappingURL=browser-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-testing.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/packages/animations/browser/testing/src/mock_animation_driver.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 */\nimport {\n AnimationPlayer,\n AUTO_STYLE,\n NoopAnimationPlayer,\n ɵStyleDataMap,\n} from '../../../src/animations';\nimport {\n AnimationDriver,\n ɵallowPreviousPlayerStylesMerge as allowPreviousPlayerStylesMerge,\n ɵcamelCaseToDashCase,\n ɵcontainsElement as containsElement,\n ɵgetParentElement as getParentElement,\n ɵinvokeQuery as invokeQuery,\n ɵnormalizeKeyframes as normalizeKeyframes,\n ɵvalidateStyleProperty as validateStyleProperty,\n ɵvalidateWebAnimatableStyleProperty,\n} from '../../../browser';\n\n/**\n * @publicApi\n *\n * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23\n */\nexport class MockAnimationDriver implements AnimationDriver {\n static log: AnimationPlayer[] = [];\n\n validateStyleProperty(prop: string): boolean {\n return validateStyleProperty(prop);\n }\n\n validateAnimatableStyleProperty(prop: string): boolean {\n const cssProp = ɵcamelCaseToDashCase(prop);\n return ɵvalidateWebAnimatableStyleProperty(cssProp);\n }\n\n containsElement(elm1: any, elm2: any): boolean {\n return containsElement(elm1, elm2);\n }\n\n getParentElement(element: unknown): unknown {\n return getParentElement(element);\n }\n\n query(element: any, selector: string, multi: boolean): any[] {\n return invokeQuery(element, selector, multi);\n }\n\n computeStyle(element: any, prop: string, defaultValue?: string): string {\n return defaultValue || '';\n }\n\n animate(\n element: any,\n keyframes: Array<ɵStyleDataMap>,\n duration: number,\n delay: number,\n easing: string,\n previousPlayers: any[] = [],\n ): MockAnimationPlayer {\n const player = new MockAnimationPlayer(\n element,\n keyframes,\n duration,\n delay,\n easing,\n previousPlayers,\n );\n MockAnimationDriver.log.push(<AnimationPlayer>player);\n return player;\n }\n}\n\n/**\n * @publicApi\n *\n * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23\n */\nexport class MockAnimationPlayer extends NoopAnimationPlayer {\n private __finished = false;\n private __started = false;\n public previousStyles: ɵStyleDataMap = new Map();\n private _onInitFns: (() => any)[] = [];\n public currentSnapshot: ɵStyleDataMap = new Map();\n private _keyframes: Array<ɵStyleDataMap> = [];\n\n constructor(\n public element: any,\n public keyframes: Array<ɵStyleDataMap>,\n public duration: number,\n public delay: number,\n public easing: string,\n public previousPlayers: any[],\n ) {\n super(duration, delay);\n\n this._keyframes = normalizeKeyframes(keyframes);\n\n if (allowPreviousPlayerStylesMerge(duration, delay)) {\n previousPlayers.forEach((player) => {\n if (player instanceof MockAnimationPlayer) {\n const styles = player.currentSnapshot;\n styles.forEach((val, prop) => this.previousStyles.set(prop, val));\n }\n });\n }\n }\n\n /** @internal */\n onInit(fn: () => any) {\n this._onInitFns.push(fn);\n }\n\n /** @internal */\n override init() {\n super.init();\n this._onInitFns.forEach((fn) => fn());\n this._onInitFns = [];\n }\n\n override reset() {\n super.reset();\n this.__started = false;\n }\n\n override finish(): void {\n super.finish();\n this.__finished = true;\n }\n\n override destroy(): void {\n super.destroy();\n this.__finished = true;\n }\n\n /** @internal */\n triggerMicrotask() {}\n\n override play(): void {\n super.play();\n this.__started = true;\n }\n\n override hasStarted() {\n return this.__started;\n }\n\n beforeDestroy() {\n const captures: ɵStyleDataMap = new Map();\n\n this.previousStyles.forEach((val, prop) => captures.set(prop, val));\n\n if (this.hasStarted()) {\n // when assembling the captured styles, it's important that\n // we build the keyframe styles in the following order:\n // {other styles within keyframes, ... previousStyles }\n this._keyframes.forEach((kf) => {\n for (let [prop, val] of kf) {\n if (prop !== 'offset') {\n captures.set(prop, this.__finished ? val : AUTO_STYLE);\n }\n }\n });\n }\n\n this.currentSnapshot = captures;\n }\n}\n"],"names":["MockAnimationDriver","validateStyleProperty","prop","cssProp","ɵcamelCaseToDashCase","ɵvalidateWebAnimatableStyleProperty","containsElement","elm1","elm2","getParentElement","element","query","selector","multi","invokeQuery","computeStyle","defaultValue","animate","keyframes","duration","delay","easing","previousPlayers","player","MockAnimationPlayer","log","push","__started","previousStyles","Map","_onInitFns","currentSnapshot","_keyframes","constructor","normalizeKeyframes","allowPreviousPlayerStylesMerge","forEach","styles","val","set","fn","init"],"mappings":";;;;;;;;;;MAiCEA,mBACE,CAAA;AAIA,EAAA;AAgBFC,EAAAA,qBAAAA,CAAAC,IAAA,EAAA;;;;AAYE,IAAA,MAAAC,OAAA,GAAAC,mBAAA,CAAAF,IAAA,CAAA;IAQA,OAAAG,kCAAwB,CAAAF,OAAA,CAAA;AACxB;;AAIJ,IAAA,OAAAG,eAAA,CAAAC,IAAA,EAAAC,IAAA,CAAA;;;IAIG,OAAAC,gBAAA,CAAAC,OAAA,CAAA;;AAUQC,EAAAA,KAAAA,CAAAD,OAAA,EAAAE,QAAA,EAAAC,KAAA,EAAA;AAEA,IAAA,OAAAC,WAAA,CAA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