upjs-rails 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 526b1e5275547fc68296dc02177ca6d51aa02a6a
4
- data.tar.gz: 092dbee2bbbb5e808cd4d7f95b277fee2e7ba453
3
+ metadata.gz: 6f7bdf608124ab028515e4a0147441dae647036d
4
+ data.tar.gz: 3aabd26b973e811f4dcc6e1218890252e5228995
5
5
  SHA512:
6
- metadata.gz: f07c452bc995b79dbea29f9c5db9ac1ace7e7494f7f653cda61560bb1ea885127488d6486b8b097bb28918540281f19f2e8219d2e2e57ba3cb30e4c9133b8af5
7
- data.tar.gz: 7fc42555b6fb3fdb66b26a13b6e59f30e824cc0b237a7a798be42b5185ef43558761e3fe5a38fdbbbb0b9a184f149099d3e15db55f19e9d92bb4d13dfe12193d
6
+ metadata.gz: 85b3c5e6216d204c72c820ee3364afc52b3369c68b6f040626ee294bac8be128f287aba1282d1cfb841ae452cebfc03e356c9e22e45cac96a873826d45ea28ed
7
+ data.tar.gz: 99fbade2c3a9f8777475d202c6737d575bc6d82a9f0f9f7b7ae1b4c172cd827904e7a0eff7ae46064c412af7b5697fe3c30697072fdbf4c2934854abde7d89eb
data/dist/up.js CHANGED
@@ -1329,7 +1329,9 @@ We need to work on this page:
1329
1329
  return _results;
1330
1330
  };
1331
1331
  findOldFragment = function(selector) {
1332
- return u.presence($(".up-popup " + selector)) || u.presence($(".up-modal " + selector)) || u.presence($(selector)) || u.error('Could not find selector %o in current body HTML', selector);
1332
+ var selectorWithExcludes;
1333
+ selectorWithExcludes = selector + ":not(.up-ghost, .up-destroying)";
1334
+ return u.presence($(".up-popup " + selectorWithExcludes)) || u.presence($(".up-modal " + selectorWithExcludes)) || u.presence($(selectorWithExcludes)) || u.error('Could not find selector %o in current body HTML', selector);
1333
1335
  };
1334
1336
  parseResponse = function(html) {
1335
1337
  var htmlElement;
@@ -1385,7 +1387,7 @@ We need to work on this page:
1385
1387
  $old[insertionMethod]($new.contents());
1386
1388
  u.copyAttributes($new, $old);
1387
1389
  elementsInserted($addedChildren, options);
1388
- return up.animate($new, transition);
1390
+ return up.animate($new, transition, options);
1389
1391
  } else {
1390
1392
  return destroy($old, {
1391
1393
  animation: function() {
@@ -1394,7 +1396,7 @@ We need to work on this page:
1394
1396
  if ($old.is('body') && transition !== 'none') {
1395
1397
  u.error('Cannot apply transitions to body-elements (%o)', transition);
1396
1398
  }
1397
- return up.morph($old, $new, transition);
1399
+ return up.morph($old, $new, transition, options);
1398
1400
  }
1399
1401
  });
1400
1402
  }
@@ -2015,6 +2017,7 @@ We need to work on this page:
2015
2017
  - Demo the built-in animations and transitions
2016
2018
  - Examples for defining your own animations and transitions
2017
2019
  - Explain ghosting
2020
+ - Explain how many elements accept arguments for animation.
2018
2021
 
2019
2022
 
2020
2023
  @class up.motion
@@ -2022,7 +2025,7 @@ We need to work on this page:
2022
2025
 
2023
2026
  (function() {
2024
2027
  up.motion = (function() {
2025
- var GHOSTING_PROMISE_KEY, animate, animation, animations, assertIsDeferred, config, defaultAnimations, defaultTransitions, defaults, findAnimation, finish, finishGhosting, morph, none, reset, resolvableWhen, snapshot, transition, transitions, u, withGhosts;
2028
+ var GHOSTING_PROMISE_KEY, animate, animateOptions, animation, animations, assertIsDeferred, config, defaultAnimations, defaultTransitions, defaults, findAnimation, finish, finishGhosting, morph, none, reset, resolvableWhen, snapshot, transition, transitions, u, withGhosts;
2026
2029
  u = up.util;
2027
2030
  animations = {};
2028
2031
  defaultAnimations = {};
@@ -2045,31 +2048,69 @@ We need to work on this page:
2045
2048
  };
2046
2049
 
2047
2050
  /**
2048
- Animates an element.
2051
+ Applies the given animation to the given element:
2049
2052
 
2050
- If the element is already being animated, the previous animation
2051
- will instantly jump to its last frame before the new animation begins.
2053
+ up.animate('.warning', 'fade-in');
2054
+
2055
+ You can pass additional options:
2056
+
2057
+ up.animate('warning', '.fade-in', {
2058
+ delay: 1000,
2059
+ duration: 250,
2060
+ easing: 'linear'
2061
+ });
2062
+
2063
+ \#\#\#\# Named animations
2064
+
2065
+ The following animations are pre-defined:
2066
+
2067
+ | `fade-in` | Changes the element's opacity from 0% to 100% |
2068
+ | `fade-out` | Changes the element's opacity from 100% to 0% |
2069
+ | `move-to-top` | Moves the element upwards until it exits the screen at the top edge |
2070
+ | `move-from-top` | Moves the element downwards from beyond the top edge of the screen until it reaches its current position |
2071
+ | `move-to-bottom` | Moves the element downwards until it exits the screen at the bottom edge |
2072
+ | `move-from-bottom` | Moves the element upwards from beyond the bottom edge of the screen until it reaches its current position |
2073
+ | `move-to-left` | Moves the element leftwards until it exists the screen at the left edge |
2074
+ | `move-from-left` | Moves the element rightwards from beyond the left edge of the screen until it reaches its current position |
2075
+ | `move-to-right` | Moves the element rightwards until it exists the screen at the right edge |
2076
+ | `move-from-right` | Moves the element leftwards from beyond the right edge of the screen until it reaches its current position |
2077
+ | `none` | An animation that has no visible effect. Sounds useless at first, but can save you a lot of `if` statements. |
2078
+
2079
+ You can define additional named animations using [`up.animation`](#up.animation).
2052
2080
 
2053
- The following animations are pre-registered:
2081
+ \#\#\#\# Animating CSS properties directly
2054
2082
 
2055
- - `fade-in`
2056
- - `fade-out`
2057
- - `move-to-top`
2058
- - `move-from-top`
2059
- - `move-to-bottom`
2060
- - `move-from-bottom`
2061
- - `move-to-left`
2062
- - `move-from-left`
2063
- - `move-to-right`
2064
- - `move-from-right`
2065
- - `none`
2083
+ By passing an object instead of an animation name, you can animate
2084
+ the CSS properties of the given element:
2085
+
2086
+ var $warning = $('.warning');
2087
+ $warning.css({ opacity: 0 });
2088
+ up.animate($warning, { opacity: 1 });
2089
+
2090
+ \#\#\#\# Multiple animations on the same element
2091
+
2092
+ Up.js doesn't allow more than one concurrent animation on the same element.
2093
+
2094
+ If you attempt to animate an element that is already being animated,
2095
+ the previous animation will instantly jump to its last frame before
2096
+ the new animation begins.
2066
2097
 
2067
2098
  @method up.animate
2068
2099
  @param {Element|jQuery|String} elementOrSelector
2100
+ The element to animate.
2069
2101
  @param {String|Function|Object} animation
2070
- @param {Number} [options.duration]
2071
- @param {String} [options.easing]
2072
- @param {Number} [options.delay]
2102
+ Can either be:
2103
+ - The animation's name
2104
+ - A function performing the animation
2105
+ - An object of CSS attributes describing the last frame of the animation
2106
+ @param {Number} [opts.duration=300]
2107
+ The duration of the animation, in milliseconds.
2108
+ @param {Number} [opts.delay=0]
2109
+ The delay before the animation starts, in milliseconds.
2110
+ @param {String} [opts.easing='ease']
2111
+ The timing function that controls the animation's acceleration.
2112
+ See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
2113
+ for a list of pre-defined timing functions.
2073
2114
  @return {Promise}
2074
2115
  A promise for the animation's end.
2075
2116
  */
@@ -2077,7 +2118,7 @@ We need to work on this page:
2077
2118
  var $element;
2078
2119
  $element = $(elementOrSelector);
2079
2120
  finish($element);
2080
- options = u.options(options, config);
2121
+ options = animateOptions(options);
2081
2122
  if (u.isFunction(animation)) {
2082
2123
  return assertIsDeferred(animation($element, options), animation);
2083
2124
  } else if (u.isString(animation)) {
@@ -2088,12 +2129,33 @@ We need to work on this page:
2088
2129
  return u.error("Unknown animation type %o", animation);
2089
2130
  }
2090
2131
  };
2132
+
2133
+ /**
2134
+ Extracts animation-related options from the given options hash.
2135
+ If `$element` is given, also inspects the element for animation-related
2136
+ attributes like `up-easing` or `up-duration`.
2137
+
2138
+ @protected
2139
+ @method up.motion.animateOptions
2140
+ */
2141
+ animateOptions = function(allOptions, $element) {
2142
+ var options;
2143
+ if ($element == null) {
2144
+ $element = null;
2145
+ }
2146
+ allOptions = u.options(allOptions);
2147
+ options = {};
2148
+ options.easing = u.option(allOptions.easing, $element != null ? $element.attr('up-easing') : void 0, config.easing);
2149
+ options.duration = Number(u.option(allOptions.duration, $element != null ? $element.attr('up-duration') : void 0, config.duration));
2150
+ options.delay = Number(u.option(allOptions.delay, $element != null ? $element.attr('up-delay') : void 0, config.delay));
2151
+ return options;
2152
+ };
2091
2153
  findAnimation = function(name) {
2092
2154
  return animations[name] || u.error("Unknown animation %o", animation);
2093
2155
  };
2094
2156
  GHOSTING_PROMISE_KEY = 'up-ghosting-promise';
2095
2157
  withGhosts = function($old, $new, block) {
2096
- var $newGhost, $oldGhost, newCssMemo, promise;
2158
+ var $newGhost, $oldGhost, promise, showNew;
2097
2159
  $oldGhost = null;
2098
2160
  $newGhost = null;
2099
2161
  u.temporaryCss($new, {
@@ -2109,7 +2171,7 @@ We need to work on this page:
2109
2171
  $old.css({
2110
2172
  visibility: 'hidden'
2111
2173
  });
2112
- newCssMemo = u.temporaryCss($new, {
2174
+ showNew = u.temporaryCss($new, {
2113
2175
  display: 'none'
2114
2176
  });
2115
2177
  promise = block($oldGhost, $newGhost);
@@ -2123,7 +2185,7 @@ We need to work on this page:
2123
2185
  $old.css({
2124
2186
  display: 'none'
2125
2187
  });
2126
- return newCssMemo();
2188
+ return showNew();
2127
2189
  });
2128
2190
  return promise;
2129
2191
  };
@@ -2162,18 +2224,24 @@ We need to work on this page:
2162
2224
  };
2163
2225
 
2164
2226
  /**
2165
- Performs a transition between two elements.
2227
+ Performs an animated transition between two elements.
2228
+ Transitions are implement by performing two animations in parallel,
2229
+ causing one element to disappear and the other to appear.
2230
+
2231
+ \#\#\#\# Named transitions
2166
2232
 
2167
- The following transitions are pre-registered:
2233
+ The following transitions are pre-defined:
2168
2234
 
2169
- - `cross-fade`
2170
- - `move-up`
2171
- - `move-down`
2172
- - `move-left`
2173
- - `move-right`
2174
- - `none`
2235
+ | `cross-fade` | Fades out the first element. Simultaneously fades in the second element. |
2236
+ | `move-up` | Moves the first element upwards until it exits the screen at the top edge. Simultaneously moves the second element upwards from beyond the bottom edge of the screen until it reaches its current position. |
2237
+ | `move-down` | Moves the first element downwards until it exits the screen at the bottom edge. Simultaneously moves the second element downwards from beyond the top edge of the screen until it reaches its current position. |
2238
+ | `move-left` | Moves the first element leftwards until it exists the screen at the left edge. Simultaneously moves the second element leftwards from beyond the right edge of the screen until it reaches its current position. |
2239
+ | `move-right` | Moves the first element rightwards until it exists the screen at the right edge. Simultaneously moves the second element rightwards from beyond the left edge of the screen until it reaches its current position. |
2240
+ | `none` | A transition that has no visible effect. Sounds useless at first, but can save you a lot of `if` statements. |
2175
2241
 
2176
- You can also compose a transition from two animation names
2242
+ You can define additional named transitions using [`up.transition`](#up.transition).
2243
+
2244
+ You can also compose a transition from two [named animations](#named-animations).
2177
2245
  separated by a slash character (`/`):
2178
2246
 
2179
2247
  - `move-to-bottom/fade-in`
@@ -2183,16 +2251,21 @@ We need to work on this page:
2183
2251
  @param {Element|jQuery|String} source
2184
2252
  @param {Element|jQuery|String} target
2185
2253
  @param {Function|String} transitionOrName
2186
- @param {Number} [options.duration]
2187
- @param {String} [options.easing]
2188
- @param {Number} [options.delay]
2254
+ @param {Number} [opts.duration=300]
2255
+ The duration of the animation, in milliseconds.
2256
+ @param {Number} [opts.delay=0]
2257
+ The delay before the animation starts, in milliseconds.
2258
+ @param {String} [opts.easing='ease']
2259
+ The timing function that controls the transition's acceleration.
2260
+ See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
2261
+ for a list of pre-defined timing functions.
2189
2262
  @return {Promise}
2190
2263
  A promise for the transition's end.
2191
2264
  */
2192
2265
  morph = function(source, target, transitionOrName, options) {
2193
2266
  var $new, $old, animation, parts, transition;
2194
2267
  if (up.browser.canCssAnimation()) {
2195
- options = u.options(config);
2268
+ options = animateOptions(options);
2196
2269
  $old = $(source);
2197
2270
  $new = $(target);
2198
2271
  finish($old);
@@ -2234,6 +2307,29 @@ We need to work on this page:
2234
2307
  /**
2235
2308
  Defines a named animation.
2236
2309
 
2310
+ Here is the definition of the pre-defined `fade-in` animation:
2311
+
2312
+ animation('fade-in', ($ghost, options) ->
2313
+ $ghost.css(opacity: 0)
2314
+ animate($ghost, { opacity: 1 }, options)
2315
+ )
2316
+
2317
+ It is recommended that your definitions always end by calling
2318
+ calling [`up.animate`](#up.animate) with an object argument, passing along
2319
+ the `options` that were passed to you.
2320
+
2321
+ If you choose to *not* use `up.animate` and roll your own
2322
+ animation code instead, your code must honor the following contract:
2323
+
2324
+ 1. It must honor the passed options.
2325
+ 2. It must not remove the passed element from the DOM.
2326
+ 3. It returns a promise that is resolved when the animation ends
2327
+ 4. The returned promise responds to a `resolve()` function that
2328
+ instantly jumps to the last animation frame and resolves the promise.
2329
+
2330
+ Calling [`up.animate`](#up.animate) with an object argument
2331
+ will take care of all these points.
2332
+
2237
2333
  @method up.animation
2238
2334
  @param {String} name
2239
2335
  @param {Function} animation
@@ -2405,6 +2501,7 @@ We need to work on this page:
2405
2501
  return {
2406
2502
  morph: morph,
2407
2503
  animate: animate,
2504
+ animateOptions: animateOptions,
2408
2505
  finish: finish,
2409
2506
  transition: transition,
2410
2507
  animation: animation,
@@ -2690,7 +2787,16 @@ Your HTML could look like this:
2690
2787
  </article>
2691
2788
  ```
2692
2789
 
2693
- Slow, full page loads. White flash during loading.
2790
+ Using this document-oriented way of navigating between pages
2791
+ is not a good fit for modern applications, for a multitude of reasons:
2792
+
2793
+ - State changes caused by AJAX updates get lost during the page transition.
2794
+ - Unsaved form changes get lost during the page transition.
2795
+ - The Javascript VM is reset during the page transition.
2796
+ - If the page layout is composed from multiple srollable containers
2797
+ (e.g. a pane view), the scroll positions get lost during the page transition.
2798
+ - The user sees a "flash" as the browser loads and renders the new page,
2799
+ even if large portions of the old and new page are the same (navigation, layout, etc.).
2694
2800
 
2695
2801
 
2696
2802
  Smoother flow by updating fragments
@@ -2782,6 +2888,12 @@ Read on
2782
2888
  @param {Element|jQuery|String} [options.scroll]
2783
2889
  An element or selector that will be scrolled to the top in
2784
2890
  case the replaced element is not visible in the viewport.
2891
+ @param {Number} [opts.duration]
2892
+ The duration of the transition. See [`up.morph`](/up.motion#up.morph).
2893
+ @param {Number} [opts.delay]
2894
+ The delay before the transition starts. See [`up.morph`](/up.motion#up.morph).
2895
+ @param {String} [opts.easing]
2896
+ The timing function that controls the transition's acceleration. [`up.morph`](/up.motion#up.morph).
2785
2897
  */
2786
2898
  follow = function(link, options) {
2787
2899
  var $link, selector, url;
@@ -2792,6 +2904,7 @@ Read on
2792
2904
  options.transition = u.option(options.transition, $link.attr('up-transition'), $link.attr('up-animation'));
2793
2905
  options.history = u.option(options.history, $link.attr('up-history'));
2794
2906
  options.scroll = u.option(options.scroll, $link.attr('up-scroll'), 'body');
2907
+ options = u.merge(options, up.motion.animateOptions(options, $link));
2795
2908
  return up.replace(selector, url, options);
2796
2909
  };
2797
2910
  resolve = function(element) {
@@ -2809,7 +2922,40 @@ Read on
2809
2922
  Follows this link via AJAX and replaces a CSS selector in the current page
2810
2923
  with corresponding elements from a new page fetched from the server:
2811
2924
 
2812
- <a href="/users" up-target=".main">User list</a>
2925
+ <a href="/posts/5" up-target=".main">Read post</a>
2926
+
2927
+ \#\#\#\# Updating multiple fragments
2928
+
2929
+ You can update multiple fragments from a single request by separating
2930
+ separators with a comma (like in CSS). E.g. if opening a post should
2931
+ also update a bubble showing the number of unread posts, you might
2932
+ do this:
2933
+
2934
+ <a href="/posts/5" up-target=".main, .unread-count">Read post</a>
2935
+
2936
+ \#\#\#\# Appending or prepending instead of replacing
2937
+
2938
+ By default Up.js will replace the given selector with the same
2939
+ selector from a freshly fetched page. Instead of replacing you
2940
+ can *append* the loaded content to the existing content by using the
2941
+ `:after` pseudo selector. In the same fashion, you can use `:before`
2942
+ to indicate that you would like the *prepend* the loaded content.
2943
+
2944
+ A practical example would be a paginated list of items. Below the list is
2945
+ a button to load the next page. You can append to the existing list
2946
+ by using `:after` in the `up-target` selector like this:
2947
+
2948
+ <ul class="tasks">
2949
+ <li>Wash car</li>
2950
+ <li>Purchase supplies</li>
2951
+ <li>Fix tent</li>
2952
+ </ul>
2953
+
2954
+ <a href="/page/2" class="next-page" up-target=".tasks:after, .next-page">
2955
+ Load more tasks
2956
+ </a>
2957
+
2958
+ \#\#\#\# Following on mousedown
2813
2959
 
2814
2960
  By also adding an `up-instant` attribute, the page will be fetched
2815
2961
  on `mousedown` instead of `click`, making the interaction even faster:
@@ -2862,6 +3008,8 @@ Read on
2862
3008
 
2863
3009
  <a href="/users" up-follow>User list</a>
2864
3010
 
3011
+ \#\#\#\# Following on mousedown
3012
+
2865
3013
  By also adding an `up-instant` attribute, the page will be fetched
2866
3014
  on `mousedown` instead of `click`, making the interaction even faster:
2867
3015
 
@@ -2872,6 +3020,8 @@ Read on
2872
3020
  navigation actions this isn't needed. E.g. popular operation
2873
3021
  systems switch tabs on `mousedown`.
2874
3022
 
3023
+ \#\#\#\# Enlarging the click area
3024
+
2875
3025
  You can also apply `[up-follow]` to any element that contains a link
2876
3026
  in order to enlarge the link's click area:
2877
3027
 
@@ -2881,7 +3031,7 @@ Read on
2881
3031
  </div>
2882
3032
 
2883
3033
  In the example above, clicking anywhere within `.notification` element
2884
- would follow the `Close` link.
3034
+ would follow the *Close* link.
2885
3035
 
2886
3036
  @method [up-follow]
2887
3037
  @ujs
@@ -3004,22 +3154,42 @@ We need to work on this page:
3004
3154
  If the argument points to an element that is not a form,
3005
3155
  Up.js will search its ancestors for the closest form.
3006
3156
  @param {String} [options.url]
3157
+ The URL where to submit the form.
3158
+ Defaults to the form's `action` attribute, or to the current URL of the browser window.
3007
3159
  @param {String} [options.method]
3160
+ The HTTP method used for the form submission.
3161
+ Defaults to the form's `up-method`, `data-method` or `method` attribute, or to `'post'`
3162
+ if none of these attributes are given.
3008
3163
  @param {String} [options.target]
3164
+ The selector to update when the form submission succeeds.
3165
+ Defaults to the form's `up-target` attribute, or to `'body'`.
3009
3166
  @param {String} [options.failTarget]
3167
+ The selector to update when the form submission succeeds.
3168
+ Defaults to the form's `up-fail-target` attribute, or to an auto-generated
3169
+ selector that matches the form itself.
3010
3170
  @param {Boolean|String} [options.history=true]
3011
3171
  Successful form submissions will add a history entry and change the browser's
3012
3172
  location bar if the form either uses the `GET` method or the response redirected
3013
3173
  to another page (this requires the `upjs-rails` gem).
3014
3174
  If want to prevent history changes in any case, set this to `false`.
3015
3175
  If you pass a `String`, it is used as the URL for the browser history.
3016
- @param {String} [options.transition]
3017
- @param {String} [options.failTransition]
3176
+ @param {String} [options.transition='none']
3177
+ The transition to use when a successful form submission updates the `options.target` selector.
3178
+ Defaults to the form's `up-transition` attribute, or to `'none'`.
3179
+ @param {String} [options.failTransition='none']
3180
+ The transition to use when a failed form submission updates the `options.failTarget` selector.
3181
+ Defaults to the form's `up-fail-transition` attribute, or to `options.transition`, or to `'none'`.
3182
+ @param {Number} [opts.duration]
3183
+ The duration of the transition. See [`up.morph`](/up.motion#up.morph).
3184
+ @param {Number} [opts.delay]
3185
+ The delay before the transition starts. See [`up.morph`](/up.motion#up.morph).
3186
+ @param {String} [opts.easing]
3187
+ The timing function that controls the transition's acceleration. [`up.morph`](/up.motion#up.morph).
3018
3188
  @return {Promise}
3019
3189
  A promise for the AJAX response
3020
3190
  */
3021
3191
  submit = function(formOrSelector, options) {
3022
- var $form, failureSelector, failureTransition, historyOption, httpMethod, request, successSelector, successTransition, successUrl, url;
3192
+ var $form, animateOptions, failureSelector, failureTransition, historyOption, httpMethod, request, successSelector, successTransition, successUrl, url;
3023
3193
  $form = $(formOrSelector).closest('form');
3024
3194
  options = u.options(options);
3025
3195
  successSelector = u.option(options.target, $form.attr('up-target'), 'body');
@@ -3028,8 +3198,9 @@ We need to work on this page:
3028
3198
  });
3029
3199
  historyOption = u.option(options.history, $form.attr('up-history'), true);
3030
3200
  successTransition = u.option(options.transition, $form.attr('up-transition'));
3031
- failureTransition = u.option(options.failTransition, $form.attr('up-fail-transition'));
3201
+ failureTransition = u.option(options.failTransition, $form.attr('up-fail-transition'), successTransition);
3032
3202
  httpMethod = u.option(options.method, $form.attr('up-method'), $form.attr('data-method'), $form.attr('method'), 'post').toUpperCase();
3203
+ animateOptions = up.motion.animateOptions(options, $form);
3033
3204
  url = u.option(options.url, $form.attr('action'), up.browser.url());
3034
3205
  $form.addClass('up-active');
3035
3206
  if (!up.browser.canPushState() && !u.castsToFalse(historyOption)) {
@@ -3050,16 +3221,19 @@ We need to work on this page:
3050
3221
  return u.ajax(request).always(function() {
3051
3222
  return $form.removeClass('up-active');
3052
3223
  }).done(function(html, textStatus, xhr) {
3053
- return up.flow.implant(successSelector, html, {
3224
+ var successOptions;
3225
+ successOptions = u.merge(animateOptions, {
3054
3226
  history: successUrl(xhr),
3055
3227
  transition: successTransition
3056
3228
  });
3229
+ return up.flow.implant(successSelector, html, successOptions);
3057
3230
  }).fail(function(xhr, textStatus, errorThrown) {
3058
- var html;
3231
+ var failureOptions, html;
3059
3232
  html = xhr.responseText;
3060
- return up.flow.implant(failureSelector, html, {
3233
+ failureOptions = u.merge(animateOptions, {
3061
3234
  transition: failureTransition
3062
3235
  });
3236
+ return up.flow.implant(failureSelector, html, failureOptions);
3063
3237
  });
3064
3238
  };
3065
3239
 
@@ -3341,10 +3515,10 @@ We need to work on this page:
3341
3515
  $popup.hide();
3342
3516
  return $popup;
3343
3517
  };
3344
- updated = function($link, $popup, origin, animation) {
3518
+ updated = function($link, $popup, origin, animation, animateOptions) {
3345
3519
  $popup.show();
3346
3520
  position($link, $popup, origin);
3347
- return up.animate($popup, animation);
3521
+ return up.animate($popup, animation, animateOptions);
3348
3522
  };
3349
3523
 
3350
3524
  /**
@@ -3355,13 +3529,20 @@ We need to work on this page:
3355
3529
  @param {String} [options.url]
3356
3530
  @param {String} [options.origin='bottom-right']
3357
3531
  @param {String} [options.animation]
3532
+ The animation to use when opening the popup.
3533
+ @param {Number} [opts.duration]
3534
+ The duration of the animation. See [`up.animate`](/up.motion#up.animate).
3535
+ @param {Number} [opts.delay]
3536
+ The delay before the animation starts. See [`up.animate`](/up.motion#up.animate).
3537
+ @param {String} [opts.easing]
3538
+ The timing function that controls the animation's acceleration. [`up.animate`](/up.motion#up.animate).
3358
3539
  @param {Boolean} [options.sticky=false]
3359
3540
  If set to `true`, the popup remains
3360
3541
  open even if the page changes in the background.
3361
3542
  @param {Object} [options.history=false]
3362
3543
  */
3363
3544
  open = function(linkOrSelector, options) {
3364
- var $link, $popup, animation, history, origin, selector, sticky, url;
3545
+ var $link, $popup, animateOptions, animation, history, origin, selector, sticky, url;
3365
3546
  $link = $(linkOrSelector);
3366
3547
  options = u.options(options);
3367
3548
  url = u.option(options.url, $link.attr('href'));
@@ -3370,12 +3551,13 @@ We need to work on this page:
3370
3551
  animation = u.option(options.animation, $link.attr('up-animation'), config.openAnimation);
3371
3552
  sticky = u.option(options.sticky, $link.is('[up-sticky]'));
3372
3553
  history = up.browser.canPushState() ? u.option(options.history, $link.attr('up-history'), false) : false;
3554
+ animateOptions = up.motion.animateOptions(options, $link);
3373
3555
  close();
3374
3556
  $popup = createHiddenPopup($link, selector, sticky);
3375
3557
  return up.replace(selector, url, {
3376
3558
  history: history,
3377
3559
  insert: function() {
3378
- return updated($link, $popup, origin, animation);
3560
+ return updated($link, $popup, origin, animation, animateOptions);
3379
3561
  }
3380
3562
  });
3381
3563
  };
@@ -3590,9 +3772,9 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
3590
3772
  $modal.hide();
3591
3773
  return $modal;
3592
3774
  };
3593
- updated = function($modal, animation) {
3775
+ updated = function($modal, animation, animateOptions) {
3594
3776
  $modal.show();
3595
- return up.animate($modal, animation);
3777
+ return up.animate($modal, animation, animateOptions);
3596
3778
  };
3597
3779
 
3598
3780
  /**
@@ -3612,16 +3794,23 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
3612
3794
  @param {String} [options.url]
3613
3795
  @param {Number} [options.width]
3614
3796
  @param {Number} [options.height]
3615
- @param {String} [options.animation]
3616
3797
  @param {Boolean} [options.sticky=false]
3617
3798
  If set to `true`, the modal remains
3618
3799
  open even if the page changes in the background.
3619
3800
  @param {Object} [options.history=true]
3801
+ @param {String} [options.animation]
3802
+ The animation to use when opening the modal.
3803
+ @param {Number} [opts.duration]
3804
+ The duration of the animation. See [`up.animate`](/up.motion#up.animate).
3805
+ @param {Number} [opts.delay]
3806
+ The delay before the animation starts. See [`up.animate`](/up.motion#up.animate).
3807
+ @param {String} [opts.easing]
3808
+ The timing function that controls the animation's acceleration. [`up.animate`](/up.motion#up.animate).
3620
3809
  @return {Promise}
3621
3810
  A promise that will be resolved when the modal has finished loading.
3622
3811
  */
3623
3812
  open = function() {
3624
- var $link, $modal, animation, args, height, history, options, selector, sticky, url, width;
3813
+ var $link, $modal, animateOptions, animation, args, height, history, options, selector, sticky, url, width;
3625
3814
  args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
3626
3815
  if (u.isObject(args[0]) && !u.isElement(args[0]) && !u.isJQuery(args[0])) {
3627
3816
  $link = u.nullJquery();
@@ -3638,12 +3827,13 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
3638
3827
  animation = u.option(options.animation, $link.attr('up-animation'), config.openAnimation);
3639
3828
  sticky = u.option(options.sticky, $link.is('[up-sticky]'));
3640
3829
  history = up.browser.canPushState() ? u.option(options.history, $link.attr('up-history'), true) : false;
3830
+ animateOptions = up.motion.animateOptions(options, $link);
3641
3831
  close();
3642
3832
  $modal = createHiddenModal(selector, width, height, sticky);
3643
3833
  return up.replace(selector, url, {
3644
3834
  history: history,
3645
3835
  insert: function() {
3646
- return updated($modal, animation);
3836
+ return updated($modal, animation, animateOptions);
3647
3837
  }
3648
3838
  });
3649
3839
  };