@angular/animations 4.2.0 → 4.2.4

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v4.2.0
2
+ * @license Angular v4.2.4
3
3
  * (c) 2010-2017 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -434,12 +434,6 @@ function dashCaseToCamelCase(input) {
434
434
  return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
435
435
  }
436
436
 
437
- /**
438
- * @license
439
- * Copyright Google Inc. All Rights Reserved.
440
- *
441
- * Use of this source code is governed by an MIT-style license that can be
442
- * found in the LICENSE file at https://angular.io/license
443
437
  /**
444
438
  * @license
445
439
  * Copyright Google Inc. All Rights Reserved.
@@ -3574,16 +3568,19 @@ class TransitionAnimationEngine {
3574
3568
  // the :enter queries match the elements (since the timeline queries
3575
3569
  // are fired during instruction building).
3576
3570
  const /** @type {?} */ bodyNode = getBodyNode();
3577
- const /** @type {?} */ allEnterNodes = this.collectedEnterElements;
3578
- const /** @type {?} */ enterNodes = allEnterNodes.length ? collectEnterElements(this.driver, allEnterNodes) : [];
3579
- const /** @type {?} */ leaveNodes = [];
3571
+ const /** @type {?} */ allEnterNodes = this.collectedEnterElements.length ?
3572
+ collectEnterElements(this.driver, this.collectedEnterElements) :
3573
+ [];
3574
+ const /** @type {?} */ allLeaveNodes = [];
3575
+ const /** @type {?} */ leaveNodesWithoutAnimations = [];
3580
3576
  for (let /** @type {?} */ i = 0; i < this.collectedLeaveElements.length; i++) {
3581
3577
  const /** @type {?} */ element = this.collectedLeaveElements[i];
3582
- if (isElementNode(element)) {
3583
- const /** @type {?} */ details = (element[REMOVAL_FLAG]);
3584
- if (details && details.setForRemoval) {
3585
- addClass(element, LEAVE_CLASSNAME);
3586
- leaveNodes.push(element);
3578
+ const /** @type {?} */ details = (element[REMOVAL_FLAG]);
3579
+ if (details && details.setForRemoval) {
3580
+ addClass(element, LEAVE_CLASSNAME);
3581
+ allLeaveNodes.push(element);
3582
+ if (!details.hasAnimation) {
3583
+ leaveNodesWithoutAnimations.push(element);
3587
3584
  }
3588
3585
  }
3589
3586
  }
@@ -3637,6 +3634,15 @@ class TransitionAnimationEngine {
3637
3634
  });
3638
3635
  });
3639
3636
  }
3637
+ // these can only be detected here since we have a map of all the elements
3638
+ // that have animations attached to them...
3639
+ const /** @type {?} */ enterNodesWithoutAnimations = [];
3640
+ for (let /** @type {?} */ i = 0; i < allEnterNodes.length; i++) {
3641
+ const /** @type {?} */ element = allEnterNodes[i];
3642
+ if (!subTimelines.has(element)) {
3643
+ enterNodesWithoutAnimations.push(element);
3644
+ }
3645
+ }
3640
3646
  const /** @type {?} */ allPreviousPlayersMap = new Map();
3641
3647
  let /** @type {?} */ sortedParentElements = [];
3642
3648
  queuedInstructions.forEach(entry => {
@@ -3654,10 +3660,10 @@ class TransitionAnimationEngine {
3654
3660
  allPreviousPlayersMap.forEach(players => players.forEach(player => player.destroy()));
3655
3661
  // PRE STAGE: fill the ! styles
3656
3662
  const /** @type {?} */ preStylesMap = allPreStyleElements.size ?
3657
- cloakAndComputeStyles(this.driver, enterNodes, allPreStyleElements, ɵPRE_STYLE) :
3663
+ cloakAndComputeStyles(this.driver, enterNodesWithoutAnimations, allPreStyleElements, ɵPRE_STYLE) :
3658
3664
  new Map();
3659
3665
  // POST STAGE: fill the * styles
3660
- const /** @type {?} */ postStylesMap = cloakAndComputeStyles(this.driver, leaveNodes, allPostStyleElements, AUTO_STYLE);
3666
+ const /** @type {?} */ postStylesMap = cloakAndComputeStyles(this.driver, leaveNodesWithoutAnimations, allPostStyleElements, AUTO_STYLE);
3661
3667
  const /** @type {?} */ rootPlayers = [];
3662
3668
  const /** @type {?} */ subPlayers = [];
3663
3669
  queuedInstructions.forEach(entry => {
@@ -3715,8 +3721,8 @@ class TransitionAnimationEngine {
3715
3721
  // run through all of the queued removals and see if they
3716
3722
  // were picked up by a query. If not then perform the removal
3717
3723
  // operation right away unless a parent animation is ongoing.
3718
- for (let /** @type {?} */ i = 0; i < leaveNodes.length; i++) {
3719
- const /** @type {?} */ element = leaveNodes[i];
3724
+ for (let /** @type {?} */ i = 0; i < allLeaveNodes.length; i++) {
3725
+ const /** @type {?} */ element = allLeaveNodes[i];
3720
3726
  const /** @type {?} */ players = queriedElements.get(element);
3721
3727
  if (players) {
3722
3728
  removeNodesAfterAnimationDone(this, element, players);
@@ -3737,7 +3743,7 @@ class TransitionAnimationEngine {
3737
3743
  });
3738
3744
  player.play();
3739
3745
  });
3740
- enterNodes.forEach(element => removeClass(element, ENTER_CLASSNAME));
3746
+ allEnterNodes.forEach(element => removeClass(element, ENTER_CLASSNAME));
3741
3747
  return rootPlayers;
3742
3748
  }
3743
3749
  /**
@@ -4092,7 +4098,7 @@ function normalizeTriggerValue(value) {
4092
4098
  case 'boolean':
4093
4099
  return value ? '1' : '0';
4094
4100
  default:
4095
- return value ? value.toString() : null;
4101
+ return value != null ? value.toString() : null;
4096
4102
  }
4097
4103
  }
4098
4104
  /**
@@ -4131,27 +4137,51 @@ function filterNodeClasses(driver, rootElement, selector) {
4131
4137
  return rootElements;
4132
4138
  let /** @type {?} */ cursor = rootElement;
4133
4139
  let /** @type {?} */ nextCursor = {};
4140
+ let /** @type {?} */ potentialCursorStack = [];
4134
4141
  do {
4135
- nextCursor = driver.query(cursor, selector, false)[0];
4142
+ // 1. query from root
4143
+ nextCursor = cursor ? driver.query(cursor, selector, false)[0] : null;
4144
+ // this is used to avoid the extra matchesElement call when we
4145
+ // know that the element does match based it on being queried
4146
+ let /** @type {?} */ justQueried = !!nextCursor;
4136
4147
  if (!nextCursor) {
4137
- cursor = cursor.parentElement;
4138
- if (!cursor)
4139
- break;
4140
- nextCursor = cursor = cursor.nextElementSibling;
4148
+ const /** @type {?} */ nextPotentialCursor = potentialCursorStack.pop();
4149
+ if (nextPotentialCursor) {
4150
+ // 1a)
4151
+ nextCursor = nextPotentialCursor;
4152
+ }
4153
+ else {
4154
+ cursor = cursor.parentElement;
4155
+ // 1b)
4156
+ if (!cursor)
4157
+ break;
4158
+ // 1c)
4159
+ nextCursor = cursor = cursor.nextElementSibling;
4160
+ continue;
4161
+ }
4141
4162
  }
4142
- else {
4143
- while (nextCursor && driver.matchesElement(nextCursor, selector)) {
4144
- rootElements.push(nextCursor);
4145
- nextCursor = nextCursor.nextElementSibling;
4146
- if (nextCursor) {
4147
- cursor = nextCursor;
4148
- }
4149
- else {
4150
- cursor = cursor.parentElement;
4151
- if (!cursor)
4152
- break;
4153
- nextCursor = cursor = cursor.nextElementSibling;
4154
- }
4163
+ // 2. visit the next node
4164
+ while (nextCursor) {
4165
+ const /** @type {?} */ matches = justQueried || driver.matchesElement(nextCursor, selector);
4166
+ justQueried = false;
4167
+ const /** @type {?} */ nextPotentialCursor = nextCursor.nextElementSibling;
4168
+ // 2a)
4169
+ if (!matches) {
4170
+ potentialCursorStack.push(nextPotentialCursor);
4171
+ cursor = nextCursor;
4172
+ break;
4173
+ }
4174
+ // 2b)
4175
+ rootElements.push(nextCursor);
4176
+ nextCursor = nextPotentialCursor;
4177
+ if (nextCursor) {
4178
+ cursor = nextCursor;
4179
+ }
4180
+ else {
4181
+ cursor = cursor.parentElement;
4182
+ if (!cursor)
4183
+ break;
4184
+ nextCursor = cursor = cursor.nextElementSibling;
4155
4185
  }
4156
4186
  }
4157
4187
  } while (nextCursor && nextCursor !== rootElement);