@angular/animations 6.0.3 → 6.0.7

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.
Files changed (91) hide show
  1. package/browser/browser.metadata.json +1 -1
  2. package/browser/src/dsl/animation_transition_factory.d.ts +1 -1
  3. package/browser/src/render/animation_engine_next.d.ts +2 -1
  4. package/browser/src/render/shared.d.ts +2 -0
  5. package/browser/src/render/timeline_animation_engine.d.ts +2 -1
  6. package/browser/src/render/transition_animation_engine.d.ts +3 -3
  7. package/browser/testing.d.ts +0 -5
  8. package/browser/testing.metadata.json +1 -1
  9. package/browser.d.ts +0 -5
  10. package/browser.metadata.json +1 -1
  11. package/bundles/animations-browser-testing.umd.js +28 -10
  12. package/bundles/animations-browser-testing.umd.js.map +1 -1
  13. package/bundles/animations-browser-testing.umd.min.js +16 -2
  14. package/bundles/animations-browser-testing.umd.min.js.map +1 -1
  15. package/bundles/animations-browser.umd.js +200 -83
  16. package/bundles/animations-browser.umd.js.map +1 -1
  17. package/bundles/animations-browser.umd.min.js +55 -6
  18. package/bundles/animations-browser.umd.min.js.map +1 -1
  19. package/bundles/animations.umd.js +470 -577
  20. package/bundles/animations.umd.js.map +1 -1
  21. package/bundles/animations.umd.min.js +9 -2
  22. package/bundles/animations.umd.min.js.map +1 -1
  23. package/esm2015/animations.externs.js +1 -1
  24. package/esm2015/browser/browser.externs.js +3 -3
  25. package/esm2015/browser/src/dsl/animation_transition_factory.js +4 -3
  26. package/esm2015/browser/src/render/animation_driver.js +1 -12
  27. package/esm2015/browser/src/render/animation_engine_next.js +8 -4
  28. package/esm2015/browser/src/render/shared.js +18 -3
  29. package/esm2015/browser/src/render/timeline_animation_engine.js +6 -2
  30. package/esm2015/browser/src/render/transition_animation_engine.js +23 -19
  31. package/esm2015/browser/src/render/web_animations/web_animations_driver.js +3 -3
  32. package/esm2015/browser/src/util.js +57 -1
  33. package/esm2015/src/animation_metadata.js +626 -659
  34. package/esm2015/src/version.js +1 -1
  35. package/esm5/browser/index.js +5 -1
  36. package/esm5/browser/public_api.js +6 -1
  37. package/esm5/browser/src/browser.js +6 -1
  38. package/esm5/browser/src/dsl/animation.js +1 -1
  39. package/esm5/browser/src/dsl/animation_ast_builder.js +11 -4
  40. package/esm5/browser/src/dsl/animation_timeline_builder.js +27 -21
  41. package/esm5/browser/src/dsl/animation_timeline_instruction.js +1 -1
  42. package/esm5/browser/src/dsl/animation_transition_expr.js +1 -1
  43. package/esm5/browser/src/dsl/animation_transition_factory.js +3 -3
  44. package/esm5/browser/src/dsl/animation_transition_instruction.js +1 -1
  45. package/esm5/browser/src/dsl/animation_trigger.js +2 -8
  46. package/esm5/browser/src/dsl/element_instruction_map.js +1 -1
  47. package/esm5/browser/src/dsl/style_normalization/animation_style_normalizer.js +3 -15
  48. package/esm5/browser/src/dsl/style_normalization/web_animations_style_normalizer.js +8 -1
  49. package/esm5/browser/src/private_export.js +8 -1
  50. package/esm5/browser/src/render/animation_driver.js +8 -3
  51. package/esm5/browser/src/render/animation_engine_next.js +5 -4
  52. package/esm5/browser/src/render/css_keyframes/css_keyframes_driver.js +1 -1
  53. package/esm5/browser/src/render/css_keyframes/css_keyframes_player.js +2 -4
  54. package/esm5/browser/src/render/css_keyframes/direct_style_player.js +8 -1
  55. package/esm5/browser/src/render/css_keyframes/element_animation_style_handler.js +1 -1
  56. package/esm5/browser/src/render/shared.js +19 -3
  57. package/esm5/browser/src/render/timeline_animation_engine.js +10 -2
  58. package/esm5/browser/src/render/transition_animation_engine.js +36 -39
  59. package/esm5/browser/src/render/web_animations/dom_animation.js +1 -1
  60. package/esm5/browser/src/render/web_animations/web_animations_driver.js +3 -3
  61. package/esm5/browser/src/render/web_animations/web_animations_player.js +3 -7
  62. package/esm5/browser/src/util.js +51 -3
  63. package/esm5/browser/testing/index.js +5 -1
  64. package/esm5/browser/testing/public_api.js +6 -1
  65. package/esm5/browser/testing/src/mock_animation_driver.js +12 -17
  66. package/esm5/browser/testing/src/testing.js +8 -1
  67. package/esm5/index.js +5 -1
  68. package/esm5/public_api.js +6 -1
  69. package/esm5/src/animation_builder.js +3 -93
  70. package/esm5/src/animation_event.js +1 -1
  71. package/esm5/src/animation_metadata.js +439 -568
  72. package/esm5/src/animations.js +6 -1
  73. package/esm5/src/players/animation_group_player.js +2 -4
  74. package/esm5/src/players/animation_player.js +11 -14
  75. package/esm5/src/private_export.js +8 -1
  76. package/esm5/src/util.js +1 -1
  77. package/esm5/src/version.js +3 -23
  78. package/fesm2015/animations.js +446 -631
  79. package/fesm2015/animations.js.map +1 -1
  80. package/fesm2015/browser/testing.js +1 -1
  81. package/fesm2015/browser/testing.js.map +1 -1
  82. package/fesm2015/browser.js +104 -29
  83. package/fesm2015/browser.js.map +1 -1
  84. package/fesm5/animations.js +470 -577
  85. package/fesm5/animations.js.map +1 -1
  86. package/fesm5/browser/testing.js +28 -10
  87. package/fesm5/browser/testing.js.map +1 -1
  88. package/fesm5/browser.js +200 -83
  89. package/fesm5/browser.js.map +1 -1
  90. package/package.json +3 -3
  91. package/src/animation_metadata.d.ts +673 -650
package/fesm5/browser.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v6.0.3
2
+ * @license Angular v6.0.7
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -8,6 +8,19 @@ import { AUTO_STYLE, NoopAnimationPlayer, sequence, style, ɵAnimationGroupPlaye
8
8
  import { Injectable } from '@angular/core';
9
9
  import { __assign, __extends, __read, __spread, __values } from 'tslib';
10
10
 
11
+ /**
12
+ * @license
13
+ * Copyright Google Inc. All Rights Reserved.
14
+ *
15
+ * Use of this source code is governed by an MIT-style license that can be
16
+ * found in the LICENSE file at https://angular.io/license
17
+ */
18
+ function isBrowser() {
19
+ return (typeof window !== 'undefined' && typeof window.document !== 'undefined');
20
+ }
21
+ function isNode() {
22
+ return (typeof process !== 'undefined');
23
+ }
11
24
  function optimizeGroupPlayer(players) {
12
25
  switch (players.length) {
13
26
  case 0:
@@ -118,10 +131,13 @@ var _matches = function (element, selector) {
118
131
  var _query = function (element, selector, multi) {
119
132
  return [];
120
133
  };
121
- if (typeof Element != 'undefined') {
134
+ // Define utility methods for browsers and platform-server(domino) where Element
135
+ // and utility methods exist.
136
+ var _isNode = isNode();
137
+ if (_isNode || typeof Element !== 'undefined') {
122
138
  // this is well supported in all browsers
123
139
  _contains = function (elm1, elm2) { return elm1.contains(elm2); };
124
- if (Element.prototype.matches) {
140
+ if (_isNode || Element.prototype.matches) {
125
141
  _matches = function (element, selector) { return element.matches(selector); };
126
142
  }
127
143
  else {
@@ -186,6 +202,13 @@ function hypenatePropsObject(object) {
186
202
  return newObj;
187
203
  }
188
204
 
205
+ /**
206
+ * @license
207
+ * Copyright Google Inc. All Rights Reserved.
208
+ *
209
+ * Use of this source code is governed by an MIT-style license that can be
210
+ * found in the LICENSE file at https://angular.io/license
211
+ */
189
212
  /**
190
213
  * @experimental
191
214
  */
@@ -210,8 +233,6 @@ var NoopAnimationDriver = /** @class */ (function () {
210
233
  NoopAnimationDriver.decorators = [
211
234
  { type: Injectable }
212
235
  ];
213
- /** @nocollapse */
214
- NoopAnimationDriver.ctorParameters = function () { return []; };
215
236
  return NoopAnimationDriver;
216
237
  }());
217
238
  /**
@@ -224,6 +245,13 @@ var AnimationDriver = /** @class */ (function () {
224
245
  return AnimationDriver;
225
246
  }());
226
247
 
248
+ /**
249
+ * @license
250
+ * Copyright Google Inc. All Rights Reserved.
251
+ *
252
+ * Use of this source code is governed by an MIT-style license that can be
253
+ * found in the LICENSE file at https://angular.io/license
254
+ */
227
255
  var ONE_SECOND = 1000;
228
256
  var SUBSTITUTION_EXPR_START = '{{';
229
257
  var SUBSTITUTION_EXPR_END = '}}';
@@ -247,8 +275,7 @@ function _convertTimeValueToMS(value, unit) {
247
275
  switch (unit) {
248
276
  case 's':
249
277
  return value * ONE_SECOND;
250
- default:
251
- // ms or something else
278
+ default:// ms or something else
252
279
  return value;
253
280
  }
254
281
  }
@@ -328,12 +355,46 @@ function copyStyles(styles, readPrototype, destination) {
328
355
  }
329
356
  return destination;
330
357
  }
358
+ function getStyleAttributeString(element, key, value) {
359
+ // Return the key-value pair string to be added to the style attribute for the
360
+ // given CSS style key.
361
+ if (value) {
362
+ return key + ':' + value + ';';
363
+ }
364
+ else {
365
+ return '';
366
+ }
367
+ }
368
+ function writeStyleAttribute(element) {
369
+ // Read the style property of the element and manually reflect it to the
370
+ // style attribute. This is needed because Domino on platform-server doesn't
371
+ // understand the full set of allowed CSS properties and doesn't reflect some
372
+ // of them automatically.
373
+ var styleAttrValue = '';
374
+ for (var i = 0; i < element.style.length; i++) {
375
+ var key = element.style.item(i);
376
+ styleAttrValue += getStyleAttributeString(element, key, element.style.getPropertyValue(key));
377
+ }
378
+ for (var key in element.style) {
379
+ // Skip internal Domino properties that don't need to be reflected.
380
+ if (!element.style.hasOwnProperty(key) || key.startsWith('_')) {
381
+ continue;
382
+ }
383
+ var dashKey = camelCaseToDashCase(key);
384
+ styleAttrValue += getStyleAttributeString(element, dashKey, element.style[key]);
385
+ }
386
+ element.setAttribute('style', styleAttrValue);
387
+ }
331
388
  function setStyles(element, styles) {
332
389
  if (element['style']) {
333
390
  Object.keys(styles).forEach(function (prop) {
334
391
  var camelProp = dashCaseToCamelCase(prop);
335
392
  element.style[camelProp] = styles[prop];
336
393
  });
394
+ // On the server set the 'style' attribute since it's not automatically reflected.
395
+ if (isNode()) {
396
+ writeStyleAttribute(element);
397
+ }
337
398
  }
338
399
  }
339
400
  function eraseStyles(element, styles) {
@@ -342,6 +403,10 @@ function eraseStyles(element, styles) {
342
403
  var camelProp = dashCaseToCamelCase(prop);
343
404
  element.style[camelProp] = '';
344
405
  });
406
+ // On the server set the 'style' attribute since it's not automatically reflected.
407
+ if (isNode()) {
408
+ writeStyleAttribute(element);
409
+ }
345
410
  }
346
411
  }
347
412
  function normalizeAnimationEntry(steps) {
@@ -410,6 +475,9 @@ function dashCaseToCamelCase(input) {
410
475
  return m[1].toUpperCase();
411
476
  });
412
477
  }
478
+ function camelCaseToDashCase(input) {
479
+ return input.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
480
+ }
413
481
  function allowPreviousPlayerStylesMerge(duration, delay) {
414
482
  return duration === 0 || delay === 0;
415
483
  }
@@ -553,6 +621,13 @@ function makeLambdaFromStates(lhs, rhs) {
553
621
  };
554
622
  }
555
623
 
624
+ /**
625
+ * @license
626
+ * Copyright Google Inc. All Rights Reserved.
627
+ *
628
+ * Use of this source code is governed by an MIT-style license that can be
629
+ * found in the LICENSE file at https://angular.io/license
630
+ */
556
631
  var SELF_TOKEN = ':self';
557
632
  var SELF_TOKEN_REGEX = new RegExp("s*" + SELF_TOKEN + "s*,?", 'g');
558
633
  /*
@@ -883,7 +958,7 @@ var AnimationAstBuilderVisitor = /** @class */ (function () {
883
958
  }
884
959
  var limit = length - 1;
885
960
  var currentTime = context.currentTime;
886
- var currentAnimateTimings = (context.currentAnimateTimings);
961
+ var currentAnimateTimings = context.currentAnimateTimings;
887
962
  var animateDuration = currentAnimateTimings.duration;
888
963
  keyframes.forEach(function (kf, i) {
889
964
  var offset = generatedOffset > 0 ? (i == limit ? 1 : (generatedOffset * i)) : offsets[i];
@@ -918,7 +993,7 @@ var AnimationAstBuilderVisitor = /** @class */ (function () {
918
993
  };
919
994
  };
920
995
  AnimationAstBuilderVisitor.prototype.visitQuery = function (metadata, context) {
921
- var parentSelector = (context.currentQuerySelector);
996
+ var parentSelector = context.currentQuerySelector;
922
997
  var options = (metadata.options || {});
923
998
  context.queryCount++;
924
999
  context.currentQuery = metadata;
@@ -1029,7 +1104,7 @@ function normalizeAnimationOptions(options) {
1029
1104
  if (options) {
1030
1105
  options = copyObj(options);
1031
1106
  if (options['params']) {
1032
- options['params'] = (normalizeParams(options['params']));
1107
+ options['params'] = normalizeParams(options['params']);
1033
1108
  }
1034
1109
  }
1035
1110
  else {
@@ -1082,6 +1157,13 @@ var ElementInstructionMap = /** @class */ (function () {
1082
1157
  return ElementInstructionMap;
1083
1158
  }());
1084
1159
 
1160
+ /**
1161
+ * @license
1162
+ * Copyright Google Inc. All Rights Reserved.
1163
+ *
1164
+ * Use of this source code is governed by an MIT-style license that can be
1165
+ * found in the LICENSE file at https://angular.io/license
1166
+ */
1085
1167
  var ONE_FRAME_IN_MILLISECONDS = 1;
1086
1168
  var ENTER_TOKEN = ':enter';
1087
1169
  var ENTER_TOKEN_REGEX = new RegExp(ENTER_TOKEN, 'g');
@@ -1331,7 +1413,7 @@ var AnimationTimelineBuilderVisitor = /** @class */ (function () {
1331
1413
  };
1332
1414
  AnimationTimelineBuilderVisitor.prototype.visitStyle = function (ast, context) {
1333
1415
  var timeline = context.currentTimeline;
1334
- var timings = (context.currentAnimateTimings);
1416
+ var timings = context.currentAnimateTimings;
1335
1417
  // this is a special case for when a style() call
1336
1418
  // directly follows an animate() call (but not inside of an animate() call)
1337
1419
  if (!timings && timeline.getCurrentStyleProperties().length) {
@@ -1347,7 +1429,7 @@ var AnimationTimelineBuilderVisitor = /** @class */ (function () {
1347
1429
  context.previousNode = ast;
1348
1430
  };
1349
1431
  AnimationTimelineBuilderVisitor.prototype.visitKeyframes = function (ast, context) {
1350
- var currentAnimateTimings = (context.currentAnimateTimings);
1432
+ var currentAnimateTimings = context.currentAnimateTimings;
1351
1433
  var startTime = (context.currentTimeline).duration;
1352
1434
  var duration = currentAnimateTimings.duration;
1353
1435
  var innerContext = context.createSubContext();
@@ -1410,7 +1492,7 @@ var AnimationTimelineBuilderVisitor = /** @class */ (function () {
1410
1492
  context.previousNode = ast;
1411
1493
  };
1412
1494
  AnimationTimelineBuilderVisitor.prototype.visitStagger = function (ast, context) {
1413
- var parentContext = (context.parentContext);
1495
+ var parentContext = context.parentContext;
1414
1496
  var tl = context.currentTimeline;
1415
1497
  var timings = ast.timings;
1416
1498
  var duration = Math.abs(timings.duration);
@@ -1482,7 +1564,7 @@ var AnimationTimelineContext = /** @class */ (function () {
1482
1564
  }
1483
1565
  var newParams = newOptions.params;
1484
1566
  if (newParams) {
1485
- var paramsToUpdate_1 = (optionsToUpdate.params);
1567
+ var paramsToUpdate_1 = optionsToUpdate.params;
1486
1568
  if (!paramsToUpdate_1) {
1487
1569
  paramsToUpdate_1 = this.options.params = {};
1488
1570
  }
@@ -1549,7 +1631,6 @@ var AnimationTimelineContext = /** @class */ (function () {
1549
1631
  results.push(this.element);
1550
1632
  }
1551
1633
  if (selector.length > 0) {
1552
- // if :self is only used then the selector is empty
1553
1634
  selector = selector.replace(ENTER_TOKEN_REGEX, '.' + this._enterClassName);
1554
1635
  selector = selector.replace(LEAVE_TOKEN_REGEX, '.' + this._leaveClassName);
1555
1636
  var multi = limit != 1;
@@ -1585,7 +1666,7 @@ var TimelineBuilder = /** @class */ (function () {
1585
1666
  this._elementTimelineStylesLookup = new Map();
1586
1667
  }
1587
1668
  this._localTimelineStyles = Object.create(this._backFill, {});
1588
- this._globalTimelineStyles = (this._elementTimelineStylesLookup.get(element));
1669
+ this._globalTimelineStyles = this._elementTimelineStylesLookup.get(element);
1589
1670
  if (!this._globalTimelineStyles) {
1590
1671
  this._globalTimelineStyles = this._localTimelineStyles;
1591
1672
  this._elementTimelineStylesLookup.set(element, this._localTimelineStyles);
@@ -1632,7 +1713,7 @@ var TimelineBuilder = /** @class */ (function () {
1632
1713
  if (this._currentKeyframe) {
1633
1714
  this._previousKeyframe = this._currentKeyframe;
1634
1715
  }
1635
- this._currentKeyframe = (this._keyframes.get(this.duration));
1716
+ this._currentKeyframe = this._keyframes.get(this.duration);
1636
1717
  if (!this._currentKeyframe) {
1637
1718
  this._currentKeyframe = Object.create(this._backFill, {});
1638
1719
  this._keyframes.set(this.duration, this._currentKeyframe);
@@ -1801,19 +1882,19 @@ var SubTimelineBuilder = /** @class */ (function (_super) {
1801
1882
  oldFirstKeyframe['offset'] = roundOffset(startingGap);
1802
1883
  newKeyframes.push(oldFirstKeyframe);
1803
1884
  /*
1804
- When the keyframe is stretched then it means that the delay before the animation
1805
- starts is gone. Instead the first keyframe is placed at the start of the animation
1806
- and it is then copied to where it starts when the original delay is over. This basically
1807
- means nothing animates during that delay, but the styles are still renderered. For this
1808
- to work the original offset values that exist in the original keyframes must be "warped"
1809
- so that they can take the new keyframe + delay into account.
1810
-
1811
- delay=1000, duration=1000, keyframes = 0 .5 1
1812
-
1813
- turns into
1814
-
1815
- delay=0, duration=2000, keyframes = 0 .33 .66 1
1816
- */
1885
+ When the keyframe is stretched then it means that the delay before the animation
1886
+ starts is gone. Instead the first keyframe is placed at the start of the animation
1887
+ and it is then copied to where it starts when the original delay is over. This basically
1888
+ means nothing animates during that delay, but the styles are still renderered. For this
1889
+ to work the original offset values that exist in the original keyframes must be "warped"
1890
+ so that they can take the new keyframe + delay into account.
1891
+
1892
+ delay=1000, duration=1000, keyframes = 0 .5 1
1893
+
1894
+ turns into
1895
+
1896
+ delay=0, duration=2000, keyframes = 0 .33 .66 1
1897
+ */
1817
1898
  // offsets between 1 ... n -1 are all warped by the keyframe stretch
1818
1899
  var limit = keyframes.length - 1;
1819
1900
  for (var i = 1; i <= limit; i++) {
@@ -1909,6 +1990,13 @@ var NoopAnimationStyleNormalizer = /** @class */ (function () {
1909
1990
  return NoopAnimationStyleNormalizer;
1910
1991
  }());
1911
1992
 
1993
+ /**
1994
+ * @license
1995
+ * Copyright Google Inc. All Rights Reserved.
1996
+ *
1997
+ * Use of this source code is governed by an MIT-style license that can be
1998
+ * found in the LICENSE file at https://angular.io/license
1999
+ */
1912
2000
  var WebAnimationsStyleNormalizer = /** @class */ (function (_super) {
1913
2001
  __extends(WebAnimationsStyleNormalizer, _super);
1914
2002
  function WebAnimationsStyleNormalizer() {
@@ -1978,7 +2066,7 @@ var AnimationTransitionFactory = /** @class */ (function () {
1978
2066
  var backupStyles = backupStateStyler ? backupStateStyler.buildStyles(params, errors) : {};
1979
2067
  return stateStyler ? stateStyler.buildStyles(params, errors) : backupStyles;
1980
2068
  };
1981
- AnimationTransitionFactory.prototype.build = function (driver, element, currentState, nextState, enterClassName, leaveClassName, currentOptions, nextOptions, subInstructions) {
2069
+ AnimationTransitionFactory.prototype.build = function (driver, element, currentState, nextState, enterClassName, leaveClassName, currentOptions, nextOptions, subInstructions, skipAstBuild) {
1982
2070
  var errors = [];
1983
2071
  var transitionAnimationParams = this.ast.options && this.ast.options.params || EMPTY_OBJECT;
1984
2072
  var currentAnimationParams = currentOptions && currentOptions.params || EMPTY_OBJECT;
@@ -1990,7 +2078,7 @@ var AnimationTransitionFactory = /** @class */ (function () {
1990
2078
  var postStyleMap = new Map();
1991
2079
  var isRemoval = nextState === 'void';
1992
2080
  var animationOptions = { params: __assign({}, transitionAnimationParams, nextAnimationParams) };
1993
- var timelines = buildAnimationTimelines(driver, element, this.ast.animation, enterClassName, leaveClassName, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors);
2081
+ var timelines = skipAstBuild ? [] : buildAnimationTimelines(driver, element, this.ast.animation, enterClassName, leaveClassName, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors);
1994
2082
  var totalTime = 0;
1995
2083
  timelines.forEach(function (tl) { totalTime = Math.max(tl.duration + tl.delay, totalTime); });
1996
2084
  if (errors.length) {
@@ -2110,9 +2198,17 @@ function balanceProperties(obj, key1, key2) {
2110
2198
  }
2111
2199
  }
2112
2200
 
2201
+ /**
2202
+ * @license
2203
+ * Copyright Google Inc. All Rights Reserved.
2204
+ *
2205
+ * Use of this source code is governed by an MIT-style license that can be
2206
+ * found in the LICENSE file at https://angular.io/license
2207
+ */
2113
2208
  var EMPTY_INSTRUCTION_MAP = new ElementInstructionMap();
2114
2209
  var TimelineAnimationEngine = /** @class */ (function () {
2115
- function TimelineAnimationEngine(_driver, _normalizer) {
2210
+ function TimelineAnimationEngine(bodyNode, _driver, _normalizer) {
2211
+ this.bodyNode = bodyNode;
2116
2212
  this._driver = _driver;
2117
2213
  this._normalizer = _normalizer;
2118
2214
  this._animations = {};
@@ -2231,6 +2327,13 @@ var TimelineAnimationEngine = /** @class */ (function () {
2231
2327
  return TimelineAnimationEngine;
2232
2328
  }());
2233
2329
 
2330
+ /**
2331
+ * @license
2332
+ * Copyright Google Inc. All Rights Reserved.
2333
+ *
2334
+ * Use of this source code is governed by an MIT-style license that can be
2335
+ * found in the LICENSE file at https://angular.io/license
2336
+ */
2234
2337
  var QUEUED_CLASSNAME = 'ng-animate-queued';
2235
2338
  var QUEUED_SELECTOR = '.ng-animate-queued';
2236
2339
  var DISABLED_CLASSNAME = 'ng-animate-disabled';
@@ -2280,7 +2383,7 @@ var StateValue = /** @class */ (function () {
2280
2383
  StateValue.prototype.absorbOptions = function (options) {
2281
2384
  var newParams = options.params;
2282
2385
  if (newParams) {
2283
- var oldParams_1 = (this.options.params);
2386
+ var oldParams_1 = this.options.params;
2284
2387
  Object.keys(newParams).forEach(function (prop) {
2285
2388
  if (oldParams_1[prop] == null) {
2286
2389
  oldParams_1[prop] = newParams[prop];
@@ -2292,7 +2395,6 @@ var StateValue = /** @class */ (function () {
2292
2395
  }());
2293
2396
  var VOID_VALUE = 'void';
2294
2397
  var DEFAULT_STATE_VALUE = new StateValue(VOID_VALUE);
2295
- var DELETED_STATE_VALUE = new StateValue('DELETED');
2296
2398
  var AnimationTransitionNamespace = /** @class */ (function () {
2297
2399
  function AnimationTransitionNamespace(id, hostElement, _engine) {
2298
2400
  this.id = id;
@@ -2326,9 +2428,6 @@ var AnimationTransitionNamespace = /** @class */ (function () {
2326
2428
  triggersWithStates[name] = DEFAULT_STATE_VALUE;
2327
2429
  }
2328
2430
  return function () {
2329
- // the event listener is removed AFTER the flush has occurred such
2330
- // that leave animations callbacks can fire (otherwise if the node
2331
- // is removed in between then the listeners would be deregistered)
2332
2431
  // the event listener is removed AFTER the flush has occurred such
2333
2432
  // that leave animations callbacks can fire (otherwise if the node
2334
2433
  // is removed in between then the listeners would be deregistered)
@@ -2381,9 +2480,6 @@ var AnimationTransitionNamespace = /** @class */ (function () {
2381
2480
  if (!fromState) {
2382
2481
  fromState = DEFAULT_STATE_VALUE;
2383
2482
  }
2384
- else if (fromState === DELETED_STATE_VALUE) {
2385
- return player;
2386
- }
2387
2483
  var isRemoval = toState.value === VOID_VALUE;
2388
2484
  // normally this isn't reached by here, however, if an object expression
2389
2485
  // is passed in then it may be a new object each time. Comparing the value
@@ -2525,7 +2621,7 @@ var AnimationTransitionNamespace = /** @class */ (function () {
2525
2621
  visitedTriggers_1.add(triggerName);
2526
2622
  var trigger = _this._triggers[triggerName];
2527
2623
  var transition = trigger.fallbackTransition;
2528
- var elementStates = (_this._engine.statesByElement.get(element));
2624
+ var elementStates = _this._engine.statesByElement.get(element);
2529
2625
  var fromState = elementStates[triggerName] || DEFAULT_STATE_VALUE;
2530
2626
  var toState = new StateValue(VOID_VALUE);
2531
2627
  var player = new TransitionAnimationPlayer(_this.id, triggerName, element);
@@ -2649,7 +2745,8 @@ var AnimationTransitionNamespace = /** @class */ (function () {
2649
2745
  return AnimationTransitionNamespace;
2650
2746
  }());
2651
2747
  var TransitionAnimationEngine = /** @class */ (function () {
2652
- function TransitionAnimationEngine(driver, _normalizer) {
2748
+ function TransitionAnimationEngine(bodyNode, driver, _normalizer) {
2749
+ this.bodyNode = bodyNode;
2653
2750
  this.driver = driver;
2654
2751
  this._normalizer = _normalizer;
2655
2752
  this.players = [];
@@ -2671,9 +2768,7 @@ var TransitionAnimationEngine = /** @class */ (function () {
2671
2768
  this.onRemovalComplete = function (element, context) { };
2672
2769
  }
2673
2770
  /** @internal */
2674
- /** @internal */
2675
- TransitionAnimationEngine.prototype._onRemovalComplete = /** @internal */
2676
- function (element, context) { this.onRemovalComplete(element, context); };
2771
+ TransitionAnimationEngine.prototype._onRemovalComplete = function (element, context) { this.onRemovalComplete(element, context); };
2677
2772
  Object.defineProperty(TransitionAnimationEngine.prototype, "queuedPlayers", {
2678
2773
  get: function () {
2679
2774
  var players = [];
@@ -2865,8 +2960,8 @@ var TransitionAnimationEngine = /** @class */ (function () {
2865
2960
  }
2866
2961
  return function () { };
2867
2962
  };
2868
- TransitionAnimationEngine.prototype._buildInstruction = function (entry, subTimelines, enterClassName, leaveClassName) {
2869
- return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, enterClassName, leaveClassName, entry.fromState.options, entry.toState.options, subTimelines);
2963
+ TransitionAnimationEngine.prototype._buildInstruction = function (entry, subTimelines, enterClassName, leaveClassName, skipBuildAst) {
2964
+ return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, enterClassName, leaveClassName, entry.fromState.options, entry.toState.options, subTimelines, skipBuildAst);
2870
2965
  };
2871
2966
  TransitionAnimationEngine.prototype.destroyInnerAnimations = function (containerElement) {
2872
2967
  var _this = this;
@@ -2892,10 +2987,6 @@ var TransitionAnimationEngine = /** @class */ (function () {
2892
2987
  }
2893
2988
  });
2894
2989
  }
2895
- var stateMap = this.statesByElement.get(element);
2896
- if (stateMap) {
2897
- Object.keys(stateMap).forEach(function (triggerName) { return stateMap[triggerName] = DELETED_STATE_VALUE; });
2898
- }
2899
2990
  };
2900
2991
  TransitionAnimationEngine.prototype.finishActiveQueriedAnimationOnElement = function (element) {
2901
2992
  var players = this.playersByQueriedElement.get(element);
@@ -3007,7 +3098,7 @@ var TransitionAnimationEngine = /** @class */ (function () {
3007
3098
  disabledElementsSet.add(nodesThatAreDisabled[i_1]);
3008
3099
  }
3009
3100
  });
3010
- var bodyNode = getBodyNode();
3101
+ var bodyNode = this.bodyNode;
3011
3102
  var allTriggerElements = Array.from(this.statesByElement.keys());
3012
3103
  var enterNodeMap = buildRootMap(allTriggerElements, this.collectedEnterElements);
3013
3104
  // this must occur before the instructions are built below such that
@@ -3046,11 +3137,11 @@ var TransitionAnimationEngine = /** @class */ (function () {
3046
3137
  });
3047
3138
  cleanupFns.push(function () {
3048
3139
  enterNodeMap.forEach(function (nodes, root) {
3049
- var className = (enterNodeMapIds.get(root));
3140
+ var className = enterNodeMapIds.get(root);
3050
3141
  nodes.forEach(function (node) { return removeClass(node, className); });
3051
3142
  });
3052
3143
  leaveNodeMap.forEach(function (nodes, root) {
3053
- var className = (leaveNodeMapIds.get(root));
3144
+ var className = leaveNodeMapIds.get(root);
3054
3145
  nodes.forEach(function (node) { return removeClass(node, className); });
3055
3146
  });
3056
3147
  allLeaveNodes.forEach(function (element) { _this.processLeaveNode(element); });
@@ -3071,17 +3162,24 @@ var TransitionAnimationEngine = /** @class */ (function () {
3071
3162
  return;
3072
3163
  }
3073
3164
  }
3074
- if (!bodyNode || !_this.driver.containsElement(bodyNode, element)) {
3075
- player.destroy();
3076
- return;
3077
- }
3078
- var leaveClassName = (leaveNodeMapIds.get(element));
3079
- var enterClassName = (enterNodeMapIds.get(element));
3080
- var instruction = (_this._buildInstruction(entry, subTimelines, enterClassName, leaveClassName));
3165
+ var nodeIsOrphaned = !bodyNode || !_this.driver.containsElement(bodyNode, element);
3166
+ var leaveClassName = leaveNodeMapIds.get(element);
3167
+ var enterClassName = enterNodeMapIds.get(element);
3168
+ var instruction = _this._buildInstruction(entry, subTimelines, enterClassName, leaveClassName, nodeIsOrphaned);
3081
3169
  if (instruction.errors && instruction.errors.length) {
3082
3170
  erroneousTransitions.push(instruction);
3083
3171
  return;
3084
3172
  }
3173
+ // even though the element may not be apart of the DOM, it may
3174
+ // still be added at a later point (due to the mechanics of content
3175
+ // projection and/or dynamic component insertion) therefore it's
3176
+ // important we still style the element.
3177
+ if (nodeIsOrphaned) {
3178
+ player.onStart(function () { return eraseStyles(element, instruction.fromStyles); });
3179
+ player.onDestroy(function () { return setStyles(element, instruction.toStyles); });
3180
+ skippedPlayers.push(player);
3181
+ return;
3182
+ }
3085
3183
  // if a unmatched transition is queued to go then it SHOULD NOT render
3086
3184
  // an animation and cancel the previously running animations.
3087
3185
  if (entry.isFallbackTransition) {
@@ -3103,7 +3201,7 @@ var TransitionAnimationEngine = /** @class */ (function () {
3103
3201
  instruction.preStyleProps.forEach(function (stringMap, element) {
3104
3202
  var props = Object.keys(stringMap);
3105
3203
  if (props.length) {
3106
- var setVal_1 = (allPreStyleElements.get(element));
3204
+ var setVal_1 = allPreStyleElements.get(element);
3107
3205
  if (!setVal_1) {
3108
3206
  allPreStyleElements.set(element, setVal_1 = new Set());
3109
3207
  }
@@ -3112,7 +3210,7 @@ var TransitionAnimationEngine = /** @class */ (function () {
3112
3210
  });
3113
3211
  instruction.postStyleProps.forEach(function (stringMap, element) {
3114
3212
  var props = Object.keys(stringMap);
3115
- var setVal = (allPostStyleElements.get(element));
3213
+ var setVal = allPostStyleElements.get(element);
3116
3214
  if (!setVal) {
3117
3215
  allPostStyleElements.set(element, setVal = new Set());
3118
3216
  }
@@ -3541,9 +3639,7 @@ var TransitionAnimationPlayer = /** @class */ (function () {
3541
3639
  };
3542
3640
  TransitionAnimationPlayer.prototype.getPosition = function () { return this.queued ? 0 : this._player.getPosition(); };
3543
3641
  /* @internal */
3544
- /* @internal */
3545
- TransitionAnimationPlayer.prototype.triggerCallback = /* @internal */
3546
- function (phaseName) {
3642
+ TransitionAnimationPlayer.prototype.triggerCallback = function (phaseName) {
3547
3643
  var p = this._player;
3548
3644
  if (p.triggerCallback) {
3549
3645
  p.triggerCallback(phaseName);
@@ -3645,15 +3741,12 @@ function buildRootMap(roots, nodes) {
3645
3741
  return root;
3646
3742
  var parent = node.parentNode;
3647
3743
  if (rootMap.has(parent)) {
3648
- // ngIf inside @trigger
3649
3744
  root = parent;
3650
3745
  }
3651
3746
  else if (nodeSet.has(parent)) {
3652
- // ngIf inside ngIf
3653
3747
  root = NULL_NODE;
3654
3748
  }
3655
3749
  else {
3656
- // recurse upwards
3657
3750
  root = getRoot(parent);
3658
3751
  }
3659
3752
  localRootMap.set(node, root);
@@ -3738,14 +3831,15 @@ function replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElemen
3738
3831
  }
3739
3832
 
3740
3833
  var AnimationEngine = /** @class */ (function () {
3741
- function AnimationEngine(_driver, normalizer) {
3834
+ function AnimationEngine(bodyNode, _driver, normalizer) {
3742
3835
  var _this = this;
3836
+ this.bodyNode = bodyNode;
3743
3837
  this._driver = _driver;
3744
3838
  this._triggerCache = {};
3745
3839
  // this method is designed to be overridden by the code that uses this engine
3746
3840
  this.onRemovalComplete = function (element, context) { };
3747
- this._transitionEngine = new TransitionAnimationEngine(_driver, normalizer);
3748
- this._timelineEngine = new TimelineAnimationEngine(_driver, normalizer);
3841
+ this._transitionEngine = new TransitionAnimationEngine(bodyNode, _driver, normalizer);
3842
+ this._timelineEngine = new TimelineAnimationEngine(bodyNode, _driver, normalizer);
3749
3843
  this._transitionEngine.onRemovalComplete = function (element, context) {
3750
3844
  return _this.onRemovalComplete(element, context);
3751
3845
  };
@@ -4043,9 +4137,7 @@ var CssKeyframesPlayer = /** @class */ (function () {
4043
4137
  this._styler = new ElementAnimationStyleHandler(this.element, this.animationName, this._duration, this._delay, this.easing, DEFAULT_FILL_MODE, function () { return _this.finish(); });
4044
4138
  };
4045
4139
  /* @internal */
4046
- /* @internal */
4047
- CssKeyframesPlayer.prototype.triggerCallback = /* @internal */
4048
- function (phaseName) {
4140
+ CssKeyframesPlayer.prototype.triggerCallback = function (phaseName) {
4049
4141
  var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
4050
4142
  methods.forEach(function (fn) { return fn(); });
4051
4143
  methods.length = 0;
@@ -4067,6 +4159,13 @@ var CssKeyframesPlayer = /** @class */ (function () {
4067
4159
  return CssKeyframesPlayer;
4068
4160
  }());
4069
4161
 
4162
+ /**
4163
+ * @license
4164
+ * Copyright Google Inc. All Rights Reserved.
4165
+ *
4166
+ * Use of this source code is governed by an MIT-style license that can be
4167
+ * found in the LICENSE file at https://angular.io/license
4168
+ */
4070
4169
  var DirectStylePlayer = /** @class */ (function (_super) {
4071
4170
  __extends(DirectStylePlayer, _super);
4072
4171
  function DirectStylePlayer(element, styles) {
@@ -4271,9 +4370,7 @@ var WebAnimationsPlayer = /** @class */ (function () {
4271
4370
  }
4272
4371
  };
4273
4372
  /** @internal */
4274
- /** @internal */
4275
- WebAnimationsPlayer.prototype._triggerWebAnimation = /** @internal */
4276
- function (element, keyframes, options) {
4373
+ WebAnimationsPlayer.prototype._triggerWebAnimation = function (element, keyframes, options) {
4277
4374
  // jscompiler doesn't seem to know animate is a native property because it's not fully
4278
4375
  // supported yet across common browsers (we polyfill it for Edge/Safari) [CL #143630929]
4279
4376
  return element['animate'](keyframes, options);
@@ -4345,9 +4442,7 @@ var WebAnimationsPlayer = /** @class */ (function () {
4345
4442
  this.currentSnapshot = styles;
4346
4443
  };
4347
4444
  /* @internal */
4348
- /* @internal */
4349
- WebAnimationsPlayer.prototype.triggerCallback = /* @internal */
4350
- function (phaseName) {
4445
+ WebAnimationsPlayer.prototype.triggerCallback = function (phaseName) {
4351
4446
  var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
4352
4447
  methods.forEach(function (fn) { return fn(); });
4353
4448
  methods.length = 0;
@@ -4403,7 +4498,7 @@ function supportsWebAnimations() {
4403
4498
  return typeof getElementAnimateFn() === 'function';
4404
4499
  }
4405
4500
  function getElementAnimateFn() {
4406
- return (typeof Element !== 'undefined' && Element.prototype['animate']) || {};
4501
+ return (isBrowser() && Element.prototype['animate']) || {};
4407
4502
  }
4408
4503
 
4409
4504
  /**
@@ -4421,6 +4516,24 @@ function getElementAnimateFn() {
4421
4516
  * Use of this source code is governed by an MIT-style license that can be
4422
4517
  * found in the LICENSE file at https://angular.io/license
4423
4518
  */
4519
+ /**
4520
+ * @module
4521
+ * @description
4522
+ * Entry point for all animation APIs of the animation browser package.
4523
+ */
4524
+
4525
+ /**
4526
+ * @license
4527
+ * Copyright Google Inc. All Rights Reserved.
4528
+ *
4529
+ * Use of this source code is governed by an MIT-style license that can be
4530
+ * found in the LICENSE file at https://angular.io/license
4531
+ */
4532
+ /**
4533
+ * @module
4534
+ * @description
4535
+ * Entry point for all public APIs of this package.
4536
+ */
4424
4537
 
4425
4538
  /**
4426
4539
  * @license
@@ -4429,6 +4542,10 @@ function getElementAnimateFn() {
4429
4542
  * Use of this source code is governed by an MIT-style license that can be
4430
4543
  * found in the LICENSE file at https://angular.io/license
4431
4544
  */
4545
+ // This file is not used to build this module. It is only used during editing
4546
+ // by the TypeScript language service and during build for verifcation. `ngc`
4547
+ // replaces this file with production index.ts when it rewrites private symbol
4548
+ // names.
4432
4549
 
4433
4550
  /**
4434
4551
  * Generated bundle index. Do not edit.