foundation / motion-ui

πŸ’Ž The powerful Sass library for creating CSS transitions and animations
https://zurb.com/playground/motion-ui
MIT License
1.15k stars 175 forks source link

πŸš€ Β Release v2.0.0 #113

Closed ncoden closed 6 years ago

ncoden commented 6 years ago

Motion UI v2.0.0

We're happy to release Motion UI 2.0 with a better support of macOS Safari, API improvements, some bug fixes and various maintanance stuff. Warning: this release includes breaking changes, please read the migration notes below before upgrading.

πŸš€ Forward/backward defaults for transitions & effects

We changed the default direction of all transition and effect mixins so it depends on the in or out state. Calling the same mixin with in and out states now results in the same animation playing forward and backward.

⚠️ Breaking changes

We changed the effects and transitions API the following way:

How to migrate

For the hinge, slide, spin, zoom effect functions and mui-fade, mui-hinge, mui-slide, mui-spin, mui-zoom transition mixins: if $state: out is used and no direction parameters are given, manually pass the "forward" parameters to keep them playing forward.

// Before
@include mui-fade($state: out);
// After
@include mui-fade($state: out, $from: 0, $to: 1);

For the slide effect function: if no $direction is given, manually pass $direction: up to keep the effect sliding to top instead of the new default left/right.

// Before
$effect: slide();
// After
$effect: slide($direction: up);

For the mui-zoom transition mixin: if no $from or $to are given, manually pass $from: 1.5 and $to: 1 to keep the previous behavior.

// Before
@include mui-zoom();
// After
@include mui-zoom($from: 1.5, $to: 1);

πŸš€ New pausing behavior for mui-queue for Safari support

With the previous mui-series behavior, the serie was paused until the .is-animating class was added. Unfortately, the implementation behind this did not work on all macOS Safari versions and was even breaking the whole animation. In order to fully support macOS Safari, we changed the mui-series paused behavior and introduced .is-paused.

⚠️ Breaking changes

When .is-animating is removed from .mui-series, the queue is now reset instead of paused. Setting .is-animating back will start the queue from its begining.

From now you can:

How to migrate

If you need an animation to pause midway, add .is-paused instead of removing .is-animating. For example in jQuery:

// Before
function play($elem) {
  $elem.addClass('is-animating');
}
function pause($elem) {
  $elem.removeClass('is-animating');
}

// After
function play($elem) {
  $elem.addClass('is-animating').removeClass('is-paused');
}
function pause($elem) {
  $elem.addClass('is-paused');
}
function reset($elem) {
  $elem.removeClass('is-animating is-paused');
}

As a side-effect of this, standard animation names are not supported anymore as mui-series queue names. Make sure you use unique names for your mui-series queues.

// Before
@include mui-series {
  .shake          { @include mui-queue(3s, 0s, shake); }
  .spin           { @include mui-queue(3s, 0s, spin); }
}

// After
@include mui-series {
  .my-serie-shake { @include mui-queue(3s, 0s, shake); }
  .my-serie-spin  { @include mui-queue(3s, 0s, spin); }
}

πŸ› Safer animation keyframe names for CSS

Fixes a bug when using decimal values for the zoom effect and transition arguments would generate an invalid CSS Keyframes name and break the animation.

We changed the way we validate arguments and generate keyframes in such a way that they will always have a valid CSS name for all effects, transitions and arguments passed in.

πŸ› Improved support for new Sass first-hand functions alongside function name strings

In order to improve modular namespacing, Sass 4 will only accepts first-class functions as argument for call() so functions will be called in their own context. This allow developers to make their Sass packages more modular while still being able to call functions given by the user. As a first step, Sass 3.5 added get-function() to get a first-hand function from its name and throw a warning if a function name string is passed to call(). Developers are now encouraged to use get-function(), but this would make their package incompatible to older Sass versions.

We added a set of helpers to support both first-hand function and function name strings in all our functions and mixins in all Sass versions. If you are using Motion UI with Sass >= 3.5, we recommend you to use pass your functions to Motion UI with get-function(...). Otherwise, we may not be able to find them as their were defined in a context we not may have access to.

For more informations, see Making Function Calls Across Sass Versions and Making sense out of Sass 3.5 first-class functions.

πŸ“¦ jQuery is now a peerDependency

We think that like for most browser packages, you will want to only have one jQuery version installed and to choose its version by yourself. For this reason, jQuery cannot be considered as an internal dependency (like implementation detail) and should be exposed to you as a peerDependency.

We did not include jQuery in the Motion UI JavaScript library before. If you use it, you should already have jQuery imported so Motion UI will work the same way as before.

Note for npm users: you may now have a warning message asking you to install the jquery npm package if you did not have it already. Please do so with a jQuery version that we support: jquery@>=2.2.0.

πŸ“„ All changes

πŸ‘©β€πŸ’» Contributors

Thank you to the amazing people who contributed to this release:

Release Checklist

ncoden commented 6 years ago

Poke @DanielRuf @SassNinja

ncoden commented 6 years ago

Poke @gakimball @kball @DanielRuf. Could you review this ? Thanks !

DanielRuf commented 6 years ago

breaking change

breaking changes

values as defauls

values as defaults

standard animations names are not supported anymore as mui-series queues names

standard animation names are not supported anymore as mui-series queue names

keyframes names for CSS

keyframe names for CSS

Fixes a bug when using decimals values

Fixes a bug when using decimal values

arguments and generate keyframe in such

arguments and generate keyframes in such

as an internal dependency (like implementation detail)and should

as an internal dependency (like implementation detail) and should

We did not included jQuery in the Motion UI Javascript library before.

We did not include jQuery in the Motion UI JavaScript library before.

Rest is good πŸ‘

ncoden commented 6 years ago

@DanielRuf Fixed. Thank you!

ncoden commented 6 years ago

Poke @gakimball. Are you ok with this release ?

gakimball commented 6 years ago

Looks good to me, great work! πŸ‘Œ

rediris commented 6 years ago

Are we ready to merge this?

ncoden commented 6 years ago

@rediris Almost. I still need to merge https://github.com/zurb/motion-ui/pull/117. We introduced an incompatibility with Sass < 3.5 at #100.

rediris commented 6 years ago

@ncoden sounds good. Sorry I didn't account for that!

ncoden commented 6 years ago

Sorry I didn't account for that!

Don't worry.

I merged the latest changes (#117), updated the documentation and the changelog (see above). I think everything is ready πŸŽ‰