@ethlete/core 4.29.9 → 4.30.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ethlete/core
2
2
 
3
+ ## 4.30.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`0f5452d`](https://github.com/ethlete-io/ethdk/commit/0f5452d559063458aa83aa4dea2eb15b59117b4e) Thanks [@TomTomB](https://github.com/TomTomB)! - Add `et-animation-enter-done` and `et-animation-leave-done` classes to animated lifecycle directive to allow styling of elements after enter/leave animations complete.
8
+
3
9
  ## 4.29.9
4
10
 
5
11
  ### Patch Changes
@@ -3624,9 +3624,11 @@ const ANIMATION_CLASSES = {
3624
3624
  enterFrom: 'et-animation-enter-from',
3625
3625
  enterActive: 'et-animation-enter-active',
3626
3626
  enterTo: 'et-animation-enter-to',
3627
+ enterDone: 'et-animation-enter-done',
3627
3628
  leaveFrom: 'et-animation-leave-from',
3628
3629
  leaveActive: 'et-animation-leave-active',
3629
3630
  leaveTo: 'et-animation-leave-to',
3631
+ leaveDone: 'et-animation-leave-done',
3630
3632
  };
3631
3633
  class AnimatedLifecycleDirective {
3632
3634
  get state() {
@@ -3657,13 +3659,14 @@ class AnimatedLifecycleDirective {
3657
3659
  ngAfterViewInit() {
3658
3660
  this._isConstructed = true;
3659
3661
  }
3660
- enter(config) {
3662
+ enter() {
3661
3663
  if (this.state === 'entering')
3662
3664
  return;
3663
3665
  if ((this.state === 'init' && !this._isConstructed) || this.skipNextEnter()) {
3664
3666
  // Force the state to entered so that the element is not animated when it is first rendered.
3665
3667
  this._forceState('entered');
3666
3668
  this.skipNextEnter.set(false);
3669
+ this._classList.add(ANIMATION_CLASSES.enterDone);
3667
3670
  return;
3668
3671
  }
3669
3672
  if (this.state === 'leaving') {
@@ -3672,14 +3675,13 @@ class AnimatedLifecycleDirective {
3672
3675
  this._classList.remove(ANIMATION_CLASSES.leaveTo);
3673
3676
  }
3674
3677
  this._state$.next('entering');
3675
- if (!config?.onlyTransition) {
3676
- this._classList.add(ANIMATION_CLASSES.enterFrom);
3677
- }
3678
+ this._classList.remove(ANIMATION_CLASSES.leaveDone);
3679
+ this._classList.add(ANIMATION_CLASSES.enterFrom);
3678
3680
  forceReflow();
3679
3681
  this._classList.add(ANIMATION_CLASSES.enterActive);
3680
3682
  fromNextFrame()
3681
3683
  .pipe(tap(() => {
3682
- if (!config?.onlyTransition && this.state === 'entering') {
3684
+ if (this.state === 'entering') {
3683
3685
  this._classList.remove(ANIMATION_CLASSES.enterFrom);
3684
3686
  this._classList.add(ANIMATION_CLASSES.enterTo);
3685
3687
  }
@@ -3687,34 +3689,30 @@ class AnimatedLifecycleDirective {
3687
3689
  if (this.state !== 'entering')
3688
3690
  return;
3689
3691
  this._state$.next('entered');
3690
- this._classList.remove(ANIMATION_CLASSES.enterActive);
3691
- if (!config?.onlyTransition) {
3692
- this._classList.remove(ANIMATION_CLASSES.enterTo);
3693
- }
3692
+ this._classList.remove(ANIMATION_CLASSES.enterActive, ANIMATION_CLASSES.enterTo);
3693
+ this._classList.add(ANIMATION_CLASSES.enterDone);
3694
3694
  }), takeUntil(this._destroy$), take(1))
3695
3695
  .subscribe();
3696
3696
  }
3697
- leave(config) {
3697
+ leave() {
3698
3698
  if (this.state === 'leaving')
3699
3699
  return;
3700
3700
  if (this.state === 'init') {
3701
3701
  this._state$.next('left');
3702
+ this._classList.add(ANIMATION_CLASSES.leaveDone);
3702
3703
  return;
3703
3704
  }
3704
3705
  if (this.state === 'entering') {
3705
- this._classList.remove(ANIMATION_CLASSES.enterFrom);
3706
- this._classList.remove(ANIMATION_CLASSES.enterActive);
3707
- this._classList.remove(ANIMATION_CLASSES.enterTo);
3706
+ this._classList.remove(ANIMATION_CLASSES.enterFrom, ANIMATION_CLASSES.enterActive, ANIMATION_CLASSES.enterTo);
3708
3707
  }
3709
3708
  this._state$.next('leaving');
3710
- if (!config?.onlyTransition) {
3711
- this._classList.add(ANIMATION_CLASSES.leaveFrom);
3712
- }
3709
+ this._classList.remove(ANIMATION_CLASSES.enterDone);
3710
+ this._classList.add(ANIMATION_CLASSES.leaveFrom);
3713
3711
  forceReflow();
3714
3712
  this._classList.add(ANIMATION_CLASSES.leaveActive);
3715
3713
  fromNextFrame()
3716
3714
  .pipe(tap(() => {
3717
- if (!config?.onlyTransition && this.state === 'leaving') {
3715
+ if (this.state === 'leaving') {
3718
3716
  this._classList.remove(ANIMATION_CLASSES.leaveFrom);
3719
3717
  this._classList.add(ANIMATION_CLASSES.leaveTo);
3720
3718
  }
@@ -3722,10 +3720,8 @@ class AnimatedLifecycleDirective {
3722
3720
  if (this.state !== 'leaving')
3723
3721
  return;
3724
3722
  this._state$.next('left');
3725
- this._classList.remove(ANIMATION_CLASSES.leaveActive);
3726
- if (!config?.onlyTransition) {
3727
- this._classList.remove(ANIMATION_CLASSES.leaveTo);
3728
- }
3723
+ this._classList.remove(ANIMATION_CLASSES.leaveActive, ANIMATION_CLASSES.leaveTo);
3724
+ this._classList.add(ANIMATION_CLASSES.leaveDone);
3729
3725
  }), takeUntil(this._destroy$), take(1))
3730
3726
  .subscribe();
3731
3727
  }