rails-angularjs 1.4.0.pre.rc.2 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/rails-angularjs/version.rb +1 -1
  4. data/vendor/assets/javascripts/angular-animate.js +179 -42
  5. data/vendor/assets/javascripts/angular-animate.min.js +47 -45
  6. data/vendor/assets/javascripts/angular-animate.min.js.map +3 -3
  7. data/vendor/assets/javascripts/angular-aria.js +1 -1
  8. data/vendor/assets/javascripts/angular-aria.min.js +1 -1
  9. data/vendor/assets/javascripts/angular-cookies.js +1 -1
  10. data/vendor/assets/javascripts/angular-cookies.min.js +1 -1
  11. data/vendor/assets/javascripts/angular-loader.js +2 -2
  12. data/vendor/assets/javascripts/angular-loader.min.js +3 -3
  13. data/vendor/assets/javascripts/angular-loader.min.js.map +1 -1
  14. data/vendor/assets/javascripts/angular-message-format.js +1 -1
  15. data/vendor/assets/javascripts/angular-message-format.min.js +1 -1
  16. data/vendor/assets/javascripts/angular-messages.js +1 -1
  17. data/vendor/assets/javascripts/angular-messages.min.js +1 -1
  18. data/vendor/assets/javascripts/angular-mocks.js +1 -1
  19. data/vendor/assets/javascripts/angular-resource.js +1 -1
  20. data/vendor/assets/javascripts/angular-resource.min.js +1 -1
  21. data/vendor/assets/javascripts/angular-route.js +1 -1
  22. data/vendor/assets/javascripts/angular-route.min.js +1 -1
  23. data/vendor/assets/javascripts/angular-sanitize.js +1 -1
  24. data/vendor/assets/javascripts/angular-sanitize.min.js +1 -1
  25. data/vendor/assets/javascripts/angular-scenario.js +125 -37
  26. data/vendor/assets/javascripts/angular-touch.js +1 -1
  27. data/vendor/assets/javascripts/angular-touch.min.js +1 -1
  28. data/vendor/assets/javascripts/angular.js +125 -37
  29. data/vendor/assets/javascripts/angular.min.js +265 -265
  30. data/vendor/assets/javascripts/angular.min.js.map +2 -2
  31. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d57850baa07cd13a77506133306a45165c337d4
4
- data.tar.gz: b5d975f52861b19464fa0d3c272cd6d29c9dcb2c
3
+ metadata.gz: c000bd9c282d3537d402975917d0aea01a858456
4
+ data.tar.gz: 7fd7afeb43650ce543870d5c81940da21728521e
5
5
  SHA512:
6
- metadata.gz: 71260b61344fa7e60220822dacecd03f7d56b7312fab92489ddc1f4c70a3066aeb78ac346f2601abce2ffc2833a50bf9bde2e60b829a19b7229eb6aad560cfd7
7
- data.tar.gz: dbbc4bf85c8829dcea9d5bc327a51590973d23f8665363db280af055fd664271a103a2cae64ccad4dec09b0995be00108129aa48bd64b941d4b4acb9e8c00dee
6
+ metadata.gz: 81783b8b112b61803b11da43292a4df999423e8d92773ce653a82a66632f54cfb01a7ebad25a1e2728b1022d6878ecece9913332b42413812b428def70e550f1
7
+ data.tar.gz: b66f1e10d01be8954adaa727207642c273bfcf428a48caba87c7934f6bf52f4a7d4de5d129bbfffdf1c1ddacf6abfb3d0fa6e0b4b6f5e6926a0c227c5349a0bd
data/README.md CHANGED
@@ -23,4 +23,4 @@ For minified version just add .min to file name:
23
23
 
24
24
  ## Versioning
25
25
 
26
- Current AngularJS version: 1.4.0-rc.1
26
+ Current AngularJS version: 1.4.0
@@ -1,3 +1,3 @@
1
1
  module RailsAngularJS
2
- VERSION = "1.4.0-rc.2"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.4.0-rc.2
2
+ * @license AngularJS v1.4.0
3
3
  * (c) 2010-2015 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -256,6 +256,64 @@ function getDomNode(element) {
256
256
  return (element instanceof angular.element) ? element[0] : element;
257
257
  }
258
258
 
259
+ var $$rAFSchedulerFactory = ['$$rAF', function($$rAF) {
260
+ var tickQueue = [];
261
+ var cancelFn;
262
+
263
+ function scheduler(tasks) {
264
+ // we make a copy since RAFScheduler mutates the state
265
+ // of the passed in array variable and this would be difficult
266
+ // to track down on the outside code
267
+ tickQueue.push([].concat(tasks));
268
+ nextTick();
269
+ }
270
+
271
+ /* waitUntilQuiet does two things:
272
+ * 1. It will run the FINAL `fn` value only when an uncancelled RAF has passed through
273
+ * 2. It will delay the next wave of tasks from running until the quiet `fn` has run.
274
+ *
275
+ * The motivation here is that animation code can request more time from the scheduler
276
+ * before the next wave runs. This allows for certain DOM properties such as classes to
277
+ * be resolved in time for the next animation to run.
278
+ */
279
+ scheduler.waitUntilQuiet = function(fn) {
280
+ if (cancelFn) cancelFn();
281
+
282
+ cancelFn = $$rAF(function() {
283
+ cancelFn = null;
284
+ fn();
285
+ nextTick();
286
+ });
287
+ };
288
+
289
+ return scheduler;
290
+
291
+ function nextTick() {
292
+ if (!tickQueue.length) return;
293
+
294
+ var updatedQueue = [];
295
+ for (var i = 0; i < tickQueue.length; i++) {
296
+ var innerQueue = tickQueue[i];
297
+ runNextTask(innerQueue);
298
+ if (innerQueue.length) {
299
+ updatedQueue.push(innerQueue);
300
+ }
301
+ }
302
+ tickQueue = updatedQueue;
303
+
304
+ if (!cancelFn) {
305
+ $$rAF(function() {
306
+ if (!cancelFn) nextTick();
307
+ });
308
+ }
309
+ }
310
+
311
+ function runNextTask(tasks) {
312
+ var nextTask = tasks.shift();
313
+ nextTask();
314
+ }
315
+ }];
316
+
259
317
  var $$AnimateChildrenDirective = [function() {
260
318
  return function(scope, element, attrs) {
261
319
  var val = attrs.ngAnimateChildren;
@@ -662,9 +720,9 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
662
720
  var gcsStaggerLookup = createLocalCacheLookup();
663
721
 
664
722
  this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout',
665
- '$document', '$sniffer', '$$rAF',
723
+ '$document', '$sniffer', '$$rAFScheduler',
666
724
  function($window, $$jqLite, $$AnimateRunner, $timeout,
667
- $document, $sniffer, $$rAF) {
725
+ $document, $sniffer, $$rAFScheduler) {
668
726
 
669
727
  var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
670
728
 
@@ -722,15 +780,10 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
722
780
  }
723
781
 
724
782
  var bod = getDomNode($document).body;
725
- var cancelLastRAFRequest;
726
783
  var rafWaitQueue = [];
727
784
  function waitUntilQuiet(callback) {
728
- if (cancelLastRAFRequest) {
729
- cancelLastRAFRequest(); //cancels the request
730
- }
731
785
  rafWaitQueue.push(callback);
732
- cancelLastRAFRequest = $$rAF(function() {
733
- cancelLastRAFRequest = null;
786
+ $$rAFScheduler.waitUntilQuiet(function() {
734
787
  gcsLookup.flush();
735
788
  gcsStaggerLookup.flush();
736
789
 
@@ -935,7 +988,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
935
988
  // we need to recalculate the delay value since we used a pre-emptive negative
936
989
  // delay value and the delay value is required for the final event checking. This
937
990
  // property will ensure that this will happen after the RAF phase has passed.
938
- if (timings.transitionDuration > 0) {
991
+ if (options.duration == null && timings.transitionDuration > 0) {
939
992
  flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst;
940
993
  }
941
994
 
@@ -1452,18 +1505,20 @@ var $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationPro
1452
1505
  var element = animationDetails.element;
1453
1506
  var options = animationDetails.options || {};
1454
1507
 
1455
- options.structural = animationDetails.structural;
1456
-
1457
- // structural animations ensure that the CSS classes are always applied
1458
- // before the detection starts.
1459
- options.applyClassesEarly = options.structural;
1460
-
1461
- // we special case the leave animation since we want to ensure that
1462
- // the element is removed as soon as the animation is over. Otherwise
1463
- // a flicker might appear or the element may not be removed at all
1464
- options.event = animationDetails.event;
1465
- if (options.event === 'leave' && animationDetails.domOperation) {
1466
- options.onDone = animationDetails.domOperation;
1508
+ if (animationDetails.structural) {
1509
+ // structural animations ensure that the CSS classes are always applied
1510
+ // before the detection starts.
1511
+ options.structural = options.applyClassesEarly = true;
1512
+
1513
+ // we special case the leave animation since we want to ensure that
1514
+ // the element is removed as soon as the animation is over. Otherwise
1515
+ // a flicker might appear or the element may not be removed at all
1516
+ options.event = animationDetails.event;
1517
+ if (options.event === 'leave') {
1518
+ options.onDone = options.domOperation;
1519
+ }
1520
+ } else {
1521
+ options.event = null;
1467
1522
  }
1468
1523
 
1469
1524
  var animator = $animateCss(element, options);
@@ -1855,6 +1910,14 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
1855
1910
  return currentAnimation.state === RUNNING_STATE && newAnimation.structural;
1856
1911
  });
1857
1912
 
1913
+ rules.cancel.push(function(element, newAnimation, currentAnimation) {
1914
+ var nO = newAnimation.options;
1915
+ var cO = currentAnimation.options;
1916
+
1917
+ // if the exact same CSS class is added/removed then it's safe to cancel it
1918
+ return (nO.addClass && nO.addClass === cO.removeClass) || (nO.removeClass && nO.removeClass === cO.addClass);
1919
+ });
1920
+
1858
1921
  this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$HashMap',
1859
1922
  '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite',
1860
1923
  function($$rAF, $rootScope, $rootElement, $document, $$HashMap,
@@ -2089,6 +2152,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
2089
2152
  structural: isStructural,
2090
2153
  element: element,
2091
2154
  event: event,
2155
+ close: close,
2092
2156
  options: options,
2093
2157
  runner: runner
2094
2158
  };
@@ -2108,8 +2172,17 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
2108
2172
  var cancelAnimationFlag = isAllowed('cancel', element, newAnimation, existingAnimation);
2109
2173
  if (cancelAnimationFlag) {
2110
2174
  if (existingAnimation.state === RUNNING_STATE) {
2175
+ // this will end the animation right away and it is safe
2176
+ // to do so since the animation is already running and the
2177
+ // runner callback code will run in async
2111
2178
  existingAnimation.runner.end();
2179
+ } else if (existingAnimation.structural) {
2180
+ // this means that the animation is queued into a digest, but
2181
+ // hasn't started yet. Therefore it is safe to run the close
2182
+ // method which will call the runner methods in async.
2183
+ existingAnimation.close();
2112
2184
  } else {
2185
+ // this will merge the existing animation options into this new follow-up animation
2113
2186
  mergeAnimationOptions(element, newAnimation.options, existingAnimation.options);
2114
2187
  }
2115
2188
  } else {
@@ -2145,10 +2218,13 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
2145
2218
 
2146
2219
  if (!isValidAnimation) {
2147
2220
  close();
2221
+ clearElementAnimationState(element);
2148
2222
  return runner;
2149
2223
  }
2150
2224
 
2151
- closeParentClassBasedAnimations(parent);
2225
+ if (isStructural) {
2226
+ closeParentClassBasedAnimations(parent);
2227
+ }
2152
2228
 
2153
2229
  // the counter keeps track of cancelled animations
2154
2230
  var counter = (existingAnimation.counter || 0) + 1;
@@ -2191,6 +2267,13 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
2191
2267
  runner.end();
2192
2268
  }
2193
2269
 
2270
+ // in the event that the element animation was not cancelled or a follow-up animation
2271
+ // isn't allowed to animate from here then we need to clear the state of the element
2272
+ // so that any future animations won't read the expired animation data.
2273
+ if (!isValidAnimation) {
2274
+ clearElementAnimationState(element);
2275
+ }
2276
+
2194
2277
  return;
2195
2278
  }
2196
2279
 
@@ -2200,7 +2283,9 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
2200
2283
  ? 'setClass'
2201
2284
  : animationDetails.event;
2202
2285
 
2203
- closeParentClassBasedAnimations(parentElement);
2286
+ if (animationDetails.structural) {
2287
+ closeParentClassBasedAnimations(parentElement);
2288
+ }
2204
2289
 
2205
2290
  markElementAnimationState(element, RUNNING_STATE);
2206
2291
  var realRunner = $$animation(element, event, animationDetails.options);
@@ -2542,12 +2627,16 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
2542
2627
  return element.data(RUNNER_STORAGE_KEY);
2543
2628
  }
2544
2629
 
2545
- this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner',
2546
- function($$jqLite, $rootScope, $injector, $$AnimateRunner) {
2630
+ this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$rAFScheduler',
2631
+ function($$jqLite, $rootScope, $injector, $$AnimateRunner, $$rAFScheduler) {
2547
2632
 
2548
2633
  var animationQueue = [];
2549
2634
  var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
2550
2635
 
2636
+ var totalPendingClassBasedAnimations = 0;
2637
+ var totalActiveClassBasedAnimations = 0;
2638
+ var classBasedAnimationsQueue = [];
2639
+
2551
2640
  // TODO(matsko): document the signature in a better way
2552
2641
  return function(element, event, options) {
2553
2642
  options = prepareAnimationOptions(options);
@@ -2576,12 +2665,19 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
2576
2665
  options.tempClasses = null;
2577
2666
  }
2578
2667
 
2668
+ var classBasedIndex;
2669
+ if (!isStructural) {
2670
+ classBasedIndex = totalPendingClassBasedAnimations;
2671
+ totalPendingClassBasedAnimations += 1;
2672
+ }
2673
+
2579
2674
  animationQueue.push({
2580
2675
  // this data is used by the postDigest code and passed into
2581
2676
  // the driver step function
2582
2677
  element: element,
2583
2678
  classes: classes,
2584
2679
  event: event,
2680
+ classBasedIndex: classBasedIndex,
2585
2681
  structural: isStructural,
2586
2682
  options: options,
2587
2683
  beforeStart: beforeStart,
@@ -2596,6 +2692,10 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
2596
2692
  if (animationQueue.length > 1) return runner;
2597
2693
 
2598
2694
  $rootScope.$$postDigest(function() {
2695
+ totalActiveClassBasedAnimations = totalPendingClassBasedAnimations;
2696
+ totalPendingClassBasedAnimations = 0;
2697
+ classBasedAnimationsQueue.length = 0;
2698
+
2599
2699
  var animations = [];
2600
2700
  forEach(animationQueue, function(entry) {
2601
2701
  // the element was destroyed early on which removed the runner
@@ -2610,23 +2710,58 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
2610
2710
  animationQueue.length = 0;
2611
2711
 
2612
2712
  forEach(groupAnimations(animations), function(animationEntry) {
2613
- // it's important that we apply the `ng-animate` CSS class and the
2614
- // temporary classes before we do any driver invoking since these
2615
- // CSS classes may be required for proper CSS detection.
2616
- animationEntry.beforeStart();
2617
-
2618
- var operation = invokeFirstDriver(animationEntry);
2619
- var triggerAnimationStart = operation && operation.start; /// TODO(matsko): only recognize operation.start()
2620
-
2621
- var closeFn = animationEntry.close;
2622
- if (!triggerAnimationStart) {
2623
- closeFn();
2713
+ if (animationEntry.structural) {
2714
+ triggerAnimationStart();
2624
2715
  } else {
2625
- var animationRunner = triggerAnimationStart();
2626
- animationRunner.done(function(status) {
2627
- closeFn(!status);
2716
+ classBasedAnimationsQueue.push({
2717
+ node: getDomNode(animationEntry.element),
2718
+ fn: triggerAnimationStart
2628
2719
  });
2629
- updateAnimationRunners(animationEntry, animationRunner);
2720
+
2721
+ if (animationEntry.classBasedIndex === totalActiveClassBasedAnimations - 1) {
2722
+ // we need to sort each of the animations in order of parent to child
2723
+ // relationships. This ensures that the child classes are applied at the
2724
+ // right time.
2725
+ classBasedAnimationsQueue = classBasedAnimationsQueue.sort(function(a,b) {
2726
+ return b.node.contains(a.node);
2727
+ }).map(function(entry) {
2728
+ return entry.fn;
2729
+ });
2730
+
2731
+ $$rAFScheduler(classBasedAnimationsQueue);
2732
+ }
2733
+ }
2734
+
2735
+ function triggerAnimationStart() {
2736
+ // it's important that we apply the `ng-animate` CSS class and the
2737
+ // temporary classes before we do any driver invoking since these
2738
+ // CSS classes may be required for proper CSS detection.
2739
+ animationEntry.beforeStart();
2740
+
2741
+ var startAnimationFn, closeFn = animationEntry.close;
2742
+
2743
+ // in the event that the element was removed before the digest runs or
2744
+ // during the RAF sequencing then we should not trigger the animation.
2745
+ var targetElement = animationEntry.anchors
2746
+ ? (animationEntry.from.element || animationEntry.to.element)
2747
+ : animationEntry.element;
2748
+
2749
+ if (getRunner(targetElement)) {
2750
+ var operation = invokeFirstDriver(animationEntry);
2751
+ if (operation) {
2752
+ startAnimationFn = operation.start;
2753
+ }
2754
+ }
2755
+
2756
+ if (!startAnimationFn) {
2757
+ closeFn();
2758
+ } else {
2759
+ var animationRunner = startAnimationFn();
2760
+ animationRunner.done(function(status) {
2761
+ closeFn(!status);
2762
+ });
2763
+ updateAnimationRunners(animationEntry, animationRunner);
2764
+ }
2630
2765
  }
2631
2766
  });
2632
2767
  });
@@ -2698,7 +2833,7 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
2698
2833
  var lookupKey = from.animationID.toString();
2699
2834
  if (!anchorGroups[lookupKey]) {
2700
2835
  var group = anchorGroups[lookupKey] = {
2701
- // TODO(matsko): double-check this code
2836
+ structural: true,
2702
2837
  beforeStart: function() {
2703
2838
  fromAnimation.beforeStart();
2704
2839
  toAnimation.beforeStart();
@@ -2816,6 +2951,7 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
2816
2951
  /* global angularAnimateModule: true,
2817
2952
 
2818
2953
  $$rAFMutexFactory,
2954
+ $$rAFSchedulerFactory,
2819
2955
  $$AnimateChildrenDirective,
2820
2956
  $$AnimateRunnerFactory,
2821
2957
  $$AnimateQueueProvider,
@@ -3555,6 +3691,7 @@ angular.module('ngAnimate', [])
3555
3691
  .directive('ngAnimateChildren', $$AnimateChildrenDirective)
3556
3692
 
3557
3693
  .factory('$$rAFMutex', $$rAFMutexFactory)
3694
+ .factory('$$rAFScheduler', $$rAFSchedulerFactory)
3558
3695
 
3559
3696
  .factory('$$AnimateRunner', $$AnimateRunnerFactory)
3560
3697