@angular/animations 20.3.6 → 20.3.7

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,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.3.6
2
+ * @license Angular v20.3.7
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.3.6
2
+ * @license Angular v20.3.7
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.3.6
2
+ * @license Angular v20.3.7
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -203,7 +203,7 @@ declare class WebAnimationsPlayer implements AnimationPlayer {
203
203
  private _finalKeyframe?;
204
204
  private _originalOnDoneFns;
205
205
  private _originalOnStartFns;
206
- readonly domPlayer: Animation;
206
+ domPlayer: Animation | null;
207
207
  time: number;
208
208
  parentPlayer: AnimationPlayer | null;
209
209
  currentSnapshot: _StyleDataMap;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.3.6
2
+ * @license Angular v20.3.7
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.3.6
2
+ * @license Angular v20.3.7
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -58,10 +58,10 @@ export { AUTO_STYLE, AnimationMetadataType, NoopAnimationPlayer, animate, animat
58
58
  * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23
59
59
  */
60
60
  class AnimationBuilder {
61
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: AnimationBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
62
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: AnimationBuilder, providedIn: 'root', useFactory: () => inject(BrowserAnimationBuilder) });
61
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: AnimationBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
62
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: AnimationBuilder, providedIn: 'root', useFactory: () => inject(BrowserAnimationBuilder) });
63
63
  }
64
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: AnimationBuilder, decorators: [{
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: AnimationBuilder, decorators: [{
65
65
  type: Injectable,
66
66
  args: [{ providedIn: 'root', useFactory: () => inject(BrowserAnimationBuilder) }]
67
67
  }] });
@@ -103,10 +103,10 @@ class BrowserAnimationBuilder extends AnimationBuilder {
103
103
  issueAnimationCommand(this._renderer, null, id, 'register', [entry]);
104
104
  return new BrowserAnimationFactory(id, this._renderer);
105
105
  }
106
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: BrowserAnimationBuilder, deps: [{ token: i0.RendererFactory2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
107
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: BrowserAnimationBuilder, providedIn: 'root' });
106
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: BrowserAnimationBuilder, deps: [{ token: i0.RendererFactory2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
107
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: BrowserAnimationBuilder, providedIn: 'root' });
108
108
  }
109
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: BrowserAnimationBuilder, decorators: [{
109
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: BrowserAnimationBuilder, decorators: [{
110
110
  type: Injectable,
111
111
  args: [{ providedIn: 'root' }]
112
112
  }], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: Document, decorators: [{
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.3.6
2
+ * @license Angular v20.3.7
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.3.6
2
+ * @license Angular v20.3.7
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -55,10 +55,10 @@ class NoopAnimationDriver {
55
55
  animate(element, keyframes, duration, delay, easing, previousPlayers = [], scrubberAccessRequested) {
56
56
  return new NoopAnimationPlayer(duration, delay);
57
57
  }
58
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
59
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: NoopAnimationDriver });
58
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
59
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: NoopAnimationDriver });
60
60
  }
61
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.6", ngImport: i0, type: NoopAnimationDriver, decorators: [{
61
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: NoopAnimationDriver, decorators: [{
62
62
  type: Injectable
63
63
  }] });
64
64
  /**
@@ -3639,8 +3639,7 @@ class WebAnimationsPlayer {
3639
3639
  // (since the _onStartFns and _onDoneFns get deleted after they are called)
3640
3640
  _originalOnDoneFns = [];
3641
3641
  _originalOnStartFns = [];
3642
- // using non-null assertion because it's re(set) by init();
3643
- domPlayer;
3642
+ domPlayer = null;
3644
3643
  time = 0;
3645
3644
  parentPlayer = null;
3646
3645
  currentSnapshot = new Map();
@@ -3661,25 +3660,32 @@ class WebAnimationsPlayer {
3661
3660
  }
3662
3661
  }
3663
3662
  init() {
3664
- this._buildPlayer();
3663
+ if (!this._buildPlayer()) {
3664
+ return;
3665
+ }
3665
3666
  this._preparePlayerBeforeStart();
3666
3667
  }
3667
3668
  _buildPlayer() {
3668
3669
  if (this._initialized)
3669
- return;
3670
+ return this.domPlayer;
3670
3671
  this._initialized = true;
3671
3672
  const keyframes = this.keyframes;
3672
- // @ts-expect-error overwriting a readonly property
3673
- this.domPlayer = this._triggerWebAnimation(this.element, keyframes, this.options);
3673
+ const animation = this._triggerWebAnimation(this.element, keyframes, this.options);
3674
+ if (!animation) {
3675
+ this._onFinish();
3676
+ return null;
3677
+ }
3678
+ this.domPlayer = animation;
3674
3679
  this._finalKeyframe = keyframes.length ? keyframes[keyframes.length - 1] : new Map();
3675
3680
  const onFinish = () => this._onFinish();
3676
- this.domPlayer.addEventListener('finish', onFinish);
3681
+ animation.addEventListener('finish', onFinish);
3677
3682
  this.onDestroy(() => {
3678
3683
  // We must remove the `finish` event listener once an animation has completed all its
3679
3684
  // iterations. This action is necessary to prevent a memory leak since the listener captures
3680
3685
  // `this`, creating a closure that prevents `this` from being garbage collected.
3681
- this.domPlayer.removeEventListener('finish', onFinish);
3686
+ animation.removeEventListener('finish', onFinish);
3682
3687
  });
3688
+ return animation;
3683
3689
  }
3684
3690
  _preparePlayerBeforeStart() {
3685
3691
  // this is required so that the player doesn't start to animate right away
@@ -3687,7 +3693,7 @@ class WebAnimationsPlayer {
3687
3693
  this._resetDomPlayerState();
3688
3694
  }
3689
3695
  else {
3690
- this.domPlayer.pause();
3696
+ this.domPlayer?.pause();
3691
3697
  }
3692
3698
  }
3693
3699
  _convertKeyframesToObject(keyframes) {
@@ -3699,7 +3705,15 @@ class WebAnimationsPlayer {
3699
3705
  }
3700
3706
  /** @internal */
3701
3707
  _triggerWebAnimation(element, keyframes, options) {
3702
- return element.animate(this._convertKeyframesToObject(keyframes), options);
3708
+ const keyframesObject = this._convertKeyframesToObject(keyframes);
3709
+ // Account for `Element.animate` throwing an exception (Firefox) or returning null (Chromium) in certain
3710
+ // conditions. See https://github.com/angular/angular/issues/64486
3711
+ try {
3712
+ return element.animate(keyframesObject, options);
3713
+ }
3714
+ catch {
3715
+ return null;
3716
+ }
3703
3717
  }
3704
3718
  onStart(fn) {
3705
3719
  this._originalOnStartFns.push(fn);
@@ -3713,7 +3727,10 @@ class WebAnimationsPlayer {
3713
3727
  this._onDestroyFns.push(fn);
3714
3728
  }
3715
3729
  play() {
3716
- this._buildPlayer();
3730
+ const player = this._buildPlayer();
3731
+ if (!player) {
3732
+ return;
3733
+ }
3717
3734
  if (!this.hasStarted()) {
3718
3735
  this._onStartFns.forEach((fn) => fn());
3719
3736
  this._onStartFns = [];
@@ -3722,14 +3739,16 @@ class WebAnimationsPlayer {
3722
3739
  this._specialStyles.start();
3723
3740
  }
3724
3741
  }
3725
- this.domPlayer.play();
3742
+ player.play();
3726
3743
  }
3727
3744
  pause() {
3728
3745
  this.init();
3729
- this.domPlayer.pause();
3746
+ this.domPlayer?.pause();
3730
3747
  }
3731
3748
  finish() {
3732
3749
  this.init();
3750
+ if (!this.domPlayer)
3751
+ return;
3733
3752
  if (this._specialStyles) {
3734
3753
  this._specialStyles.finish();
3735
3754
  }
@@ -3745,9 +3764,7 @@ class WebAnimationsPlayer {
3745
3764
  this._onDoneFns = this._originalOnDoneFns;
3746
3765
  }
3747
3766
  _resetDomPlayerState() {
3748
- if (this.domPlayer) {
3749
- this.domPlayer.cancel();
3750
- }
3767
+ this.domPlayer?.cancel();
3751
3768
  }
3752
3769
  restart() {
3753
3770
  this.reset();
@@ -3769,12 +3786,17 @@ class WebAnimationsPlayer {
3769
3786
  }
3770
3787
  }
3771
3788
  setPosition(p) {
3772
- if (this.domPlayer === undefined) {
3789
+ if (!this.domPlayer) {
3773
3790
  this.init();
3774
3791
  }
3775
- this.domPlayer.currentTime = p * this.time;
3792
+ if (this.domPlayer) {
3793
+ this.domPlayer.currentTime = p * this.time;
3794
+ }
3776
3795
  }
3777
3796
  getPosition() {
3797
+ if (!this.domPlayer) {
3798
+ return this._initialized ? 1 : 0;
3799
+ }
3778
3800
  // tsc is complaining with TS2362 without the conversion to number
3779
3801
  return +(this.domPlayer.currentTime ?? 0) / this.time;
3780
3802
  }
@@ -3954,7 +3976,7 @@ class BaseAnimationRenderer {
3954
3976
  // Elements using the new `animate.leave` API require synchronous removal and should
3955
3977
  // skip the rest of the legacy animation behaviors.
3956
3978
  if (requireSynchronousElementRemoval) {
3957
- this.delegate.removeChild(parent, oldChild, isHostElement);
3979
+ this.delegate.removeChild(parent, oldChild, isHostElement, requireSynchronousElementRemoval);
3958
3980
  return;
3959
3981
  }
3960
3982
  // Prior to the changes in #57203, this method wasn't being called at all by `core` if the child