PolymerElements / paper-dialog

A Material Design dialog
https://www.webcomponents.org/element/PolymerElements/paper-dialog
63 stars 41 forks source link

Removing Deprecated Neon-Animation Dependency #160

Open homerjonathan opened 6 years ago

homerjonathan commented 6 years ago

Another removal of Neon-Animation Dependency.

Copying much of the code design from paper-tooltip this one was much easier. I have had a look and cannot see any timer configurations so I think that this should not be much of a break fix for most users.

I have also solved an issue when the animation selected is not known.

    _isSetAnimationValid: function () {
      // If CSS Class does not have animation-name considered not be an animation
      var style = window.getComputedStyle(this);
      return (style.getPropertyValue("animation-name") === "none")
    }

This seems the least processor intensive way to find out if the animation exists. If animation does not exist it is simply ignored. Whereas if you call an animation that does not exist the event on animation end is not fired leaving the dialog unable to open or close.

homerjonathan commented 6 years ago

Any updates on this PR?

I have started to work on iron-dropdown and want to know if I am going in the right direction.

homerjonathan commented 6 years ago

All changes seem reasonable. However I am in the UK.....we are now in sleep mode! ;-)

valdrinkoshi commented 6 years ago

SG, thanks for looking into this again @homerjonathan :)

Ps: I played with the styles a bit, they could be reduced to half by sharing setup, e.g.

:host {
  animation-duration: 500ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

:host(.fade-in-animation) {
  animation-name: fadeInAnimation;
}

@keyframes fadeInAnimation {
  from {
    opacity: 0;
  }
}

:host(.fade-out-animation) {
  animation-name: fadeOutAnimation;
}

@keyframes fadeOutAnimation {
  to {
    opacity: 0;
  }
}

:host(.scale-up-animation) {
  animation-name: scaleUpAnimation;
}

@keyframes scaleUpAnimation {
  from {
    transform: scale(0.0);
  }
}

:host(.scale-down-animation) {
  animation-name: scaleDownAnimation;
}

@keyframes scaleDownAnimation {
  to {
    transform: scale(0.0);
  }
}