@angular/animations 7.2.0-beta.0 → 7.2.0
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.
- package/browser/testing.d.ts +5 -0
- package/browser.d.ts +5 -0
- package/bundles/animations-browser-testing.umd.js +1 -1
- package/bundles/animations-browser-testing.umd.js.map +1 -1
- package/bundles/animations-browser-testing.umd.min.js +1 -1
- package/bundles/animations-browser-testing.umd.min.js.map +1 -1
- package/bundles/animations-browser.umd.js +3 -3
- package/bundles/animations-browser.umd.js.map +1 -1
- package/bundles/animations-browser.umd.min.js +4 -4
- package/bundles/animations-browser.umd.min.js.map +1 -1
- package/bundles/animations.umd.js +3 -3
- package/bundles/animations.umd.js.map +1 -1
- package/bundles/animations.umd.min.js +1 -1
- package/bundles/animations.umd.min.js.map +1 -1
- package/esm2015/animations.externs.js +19 -17
- package/esm2015/animations.js +1 -2
- package/esm2015/browser/browser.externs.js +28 -20
- package/esm2015/browser/browser.js +1 -2
- package/esm2015/browser/index.js +2 -3
- package/esm2015/browser/public_api.js +2 -3
- package/esm2015/browser/src/browser.js +7 -3
- package/esm2015/browser/src/dsl/animation.js +14 -7
- package/esm2015/browser/src/dsl/animation_ast.js +194 -112
- package/esm2015/browser/src/dsl/animation_ast_builder.js +78 -33
- package/esm2015/browser/src/dsl/animation_dsl_visitor.js +82 -29
- package/esm2015/browser/src/dsl/animation_timeline_builder.js +200 -36
- package/esm2015/browser/src/dsl/animation_timeline_instruction.js +24 -23
- package/esm2015/browser/src/dsl/animation_transition_expr.js +12 -8
- package/esm2015/browser/src/dsl/animation_transition_factory.js +19 -8
- package/esm2015/browser/src/dsl/animation_transition_instruction.js +30 -29
- package/esm2015/browser/src/dsl/animation_trigger.js +2 -3
- package/esm2015/browser/src/dsl/element_instruction_map.js +6 -4
- package/esm2015/browser/src/dsl/style_normalization/animation_style_normalizer.js +3 -4
- package/esm2015/browser/src/dsl/style_normalization/web_animations_style_normalizer.js +9 -3
- package/esm2015/browser/src/private_export.js +9 -3
- package/esm2015/browser/src/render/animation_driver.js +9 -3
- package/esm2015/browser/src/render/animation_engine_instruction.js +7 -6
- package/esm2015/browser/src/render/animation_engine_next.js +27 -12
- package/esm2015/browser/src/render/css_keyframes/css_keyframes_driver.js +20 -11
- package/esm2015/browser/src/render/css_keyframes/css_keyframes_player.js +42 -13
- package/esm2015/browser/src/render/css_keyframes/direct_style_player.js +23 -8
- package/esm2015/browser/src/render/css_keyframes/element_animation_style_handler.js +54 -17
- package/esm2015/browser/src/render/shared.js +21 -13
- package/esm2015/browser/src/render/timeline_animation_engine.js +31 -10
- package/esm2015/browser/src/render/transition_animation_engine.js +210 -89
- package/esm2015/browser/src/render/web_animations/dom_animation.js +2 -3
- package/esm2015/browser/src/render/web_animations/web_animations_driver.js +13 -8
- package/esm2015/browser/src/render/web_animations/web_animations_player.js +50 -17
- package/esm2015/browser/src/util.js +22 -12
- package/esm2015/browser/testing/index.js +2 -3
- package/esm2015/browser/testing/public_api.js +2 -3
- package/esm2015/browser/testing/src/mock_animation_driver.js +25 -7
- package/esm2015/browser/testing/src/testing.js +9 -3
- package/esm2015/browser/testing/testing.js +1 -2
- package/esm2015/index.js +2 -3
- package/esm2015/public_api.js +2 -3
- package/esm2015/src/animation_builder.js +2 -3
- package/esm2015/src/animation_event.js +40 -39
- package/esm2015/src/animation_metadata.js +236 -211
- package/esm2015/src/animations.js +7 -3
- package/esm2015/src/players/animation_group_player.js +29 -9
- package/esm2015/src/players/animation_player.js +137 -112
- package/esm2015/src/private_export.js +9 -3
- package/esm2015/src/util.js +2 -3
- package/esm2015/src/version.js +3 -4
- package/esm5/animations.js +1 -2
- package/esm5/browser/browser.js +1 -2
- package/esm5/browser/index.js +1 -2
- package/esm5/browser/public_api.js +1 -2
- package/esm5/browser/src/browser.js +1 -2
- package/esm5/browser/src/dsl/animation.js +1 -2
- package/esm5/browser/src/dsl/animation_ast.js +1 -2
- package/esm5/browser/src/dsl/animation_ast_builder.js +1 -2
- package/esm5/browser/src/dsl/animation_dsl_visitor.js +1 -2
- package/esm5/browser/src/dsl/animation_timeline_builder.js +1 -2
- package/esm5/browser/src/dsl/animation_timeline_instruction.js +1 -2
- package/esm5/browser/src/dsl/animation_transition_expr.js +1 -2
- package/esm5/browser/src/dsl/animation_transition_factory.js +1 -2
- package/esm5/browser/src/dsl/animation_transition_instruction.js +1 -2
- package/esm5/browser/src/dsl/animation_trigger.js +1 -2
- package/esm5/browser/src/dsl/element_instruction_map.js +1 -2
- package/esm5/browser/src/dsl/style_normalization/animation_style_normalizer.js +1 -2
- package/esm5/browser/src/dsl/style_normalization/web_animations_style_normalizer.js +1 -2
- package/esm5/browser/src/private_export.js +1 -2
- package/esm5/browser/src/render/animation_driver.js +1 -2
- package/esm5/browser/src/render/animation_engine_instruction.js +1 -2
- package/esm5/browser/src/render/animation_engine_next.js +1 -2
- package/esm5/browser/src/render/css_keyframes/css_keyframes_driver.js +1 -2
- package/esm5/browser/src/render/css_keyframes/css_keyframes_player.js +1 -2
- package/esm5/browser/src/render/css_keyframes/direct_style_player.js +1 -2
- package/esm5/browser/src/render/css_keyframes/element_animation_style_handler.js +1 -2
- package/esm5/browser/src/render/shared.js +1 -2
- package/esm5/browser/src/render/timeline_animation_engine.js +1 -2
- package/esm5/browser/src/render/transition_animation_engine.js +2 -3
- package/esm5/browser/src/render/web_animations/dom_animation.js +1 -2
- package/esm5/browser/src/render/web_animations/web_animations_driver.js +1 -2
- package/esm5/browser/src/render/web_animations/web_animations_player.js +1 -2
- package/esm5/browser/src/util.js +2 -3
- package/esm5/browser/testing/index.js +1 -2
- package/esm5/browser/testing/public_api.js +1 -2
- package/esm5/browser/testing/src/mock_animation_driver.js +1 -2
- package/esm5/browser/testing/src/testing.js +1 -2
- package/esm5/browser/testing/testing.js +1 -2
- package/esm5/index.js +1 -2
- package/esm5/public_api.js +1 -2
- package/esm5/src/animation_builder.js +1 -2
- package/esm5/src/animation_event.js +1 -2
- package/esm5/src/animation_metadata.js +3 -4
- package/esm5/src/animations.js +1 -2
- package/esm5/src/players/animation_group_player.js +1 -2
- package/esm5/src/players/animation_player.js +1 -2
- package/esm5/src/private_export.js +1 -2
- package/esm5/src/util.js +1 -2
- package/esm5/src/version.js +2 -3
- package/fesm2015/animations.js +23 -20
- package/fesm2015/animations.js.map +1 -1
- package/fesm2015/browser/testing.js +10 -7
- package/fesm2015/browser/testing.js.map +1 -1
- package/fesm2015/browser.js +407 -160
- package/fesm2015/browser.js.map +1 -1
- package/fesm5/animations.js +3 -3
- package/fesm5/animations.js.map +1 -1
- package/fesm5/browser/testing.js +2 -2
- package/fesm5/browser/testing.js.map +1 -1
- package/fesm5/browser.js +3 -3
- package/fesm5/browser.js.map +1 -1
- package/package.json +2 -2
- package/src/animation_metadata.d.ts +2 -2
package/fesm2015/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v7.2.0
|
|
2
|
+
* @license Angular v7.2.0
|
|
3
3
|
* (c) 2010-2018 Google, Inc. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -9,7 +9,7 @@ import { Injectable } from '@angular/core';
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @fileoverview added by tsickle
|
|
12
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
12
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
15
|
* @return {?}
|
|
@@ -57,7 +57,7 @@ function normalizeKeyframes(driver, normalizer, element, keyframes, preStyles =
|
|
|
57
57
|
let previousKeyframe = null;
|
|
58
58
|
keyframes.forEach(kf => {
|
|
59
59
|
/** @type {?} */
|
|
60
|
-
const offset = /** @type {?} */ (kf['offset']);
|
|
60
|
+
const offset = (/** @type {?} */ (kf['offset']));
|
|
61
61
|
/** @type {?} */
|
|
62
62
|
const isSameOffset = offset == previousOffset;
|
|
63
63
|
/** @type {?} */
|
|
@@ -127,13 +127,13 @@ function copyAnimationEvent(e, phaseName, player) {
|
|
|
127
127
|
/** @type {?} */
|
|
128
128
|
const totalTime = player.totalTime;
|
|
129
129
|
/** @type {?} */
|
|
130
|
-
const disabled = (/** @type {?} */ (player)).disabled ? true : false;
|
|
130
|
+
const disabled = ((/** @type {?} */ (player))).disabled ? true : false;
|
|
131
131
|
/** @type {?} */
|
|
132
132
|
const event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime, disabled);
|
|
133
133
|
/** @type {?} */
|
|
134
|
-
const data = (/** @type {?} */ (e))['_data'];
|
|
134
|
+
const data = ((/** @type {?} */ (e)))['_data'];
|
|
135
135
|
if (data != null) {
|
|
136
|
-
(/** @type {?} */ (event))['_data'] = data;
|
|
136
|
+
((/** @type {?} */ (event)))['_data'] = data;
|
|
137
137
|
}
|
|
138
138
|
return event;
|
|
139
139
|
}
|
|
@@ -194,17 +194,19 @@ let _matches = (element, selector) => false;
|
|
|
194
194
|
let _query = (element, selector, multi) => {
|
|
195
195
|
return [];
|
|
196
196
|
};
|
|
197
|
+
// Define utility methods for browsers and platform-server(domino) where Element
|
|
198
|
+
// and utility methods exist.
|
|
197
199
|
/** @type {?} */
|
|
198
200
|
const _isNode = isNode();
|
|
199
201
|
if (_isNode || typeof Element !== 'undefined') {
|
|
200
202
|
// this is well supported in all browsers
|
|
201
|
-
_contains = (elm1, elm2) => { return /** @type {?} */ (elm1.contains(elm2)); };
|
|
203
|
+
_contains = (elm1, elm2) => { return (/** @type {?} */ (elm1.contains(elm2))); };
|
|
202
204
|
if (_isNode || Element.prototype.matches) {
|
|
203
205
|
_matches = (element, selector) => element.matches(selector);
|
|
204
206
|
}
|
|
205
207
|
else {
|
|
206
208
|
/** @type {?} */
|
|
207
|
-
const proto = /** @type {?} */ (Element.prototype);
|
|
209
|
+
const proto = (/** @type {?} */ (Element.prototype));
|
|
208
210
|
/** @type {?} */
|
|
209
211
|
const fn = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector ||
|
|
210
212
|
proto.oMatchesSelector || proto.webkitMatchesSelector;
|
|
@@ -248,16 +250,16 @@ let _IS_WEBKIT = false;
|
|
|
248
250
|
function validateStyleProperty(prop) {
|
|
249
251
|
if (!_CACHED_BODY) {
|
|
250
252
|
_CACHED_BODY = getBodyNode() || {};
|
|
251
|
-
_IS_WEBKIT = /** @type {?} */ (
|
|
253
|
+
_IS_WEBKIT = (/** @type {?} */ (_CACHED_BODY)).style ? ('WebkitAppearance' in (/** @type {?} */ (_CACHED_BODY)).style) : false;
|
|
252
254
|
}
|
|
253
255
|
/** @type {?} */
|
|
254
256
|
let result = true;
|
|
255
|
-
if (/** @type {?} */ (
|
|
256
|
-
result = prop in /** @type {?} */ (
|
|
257
|
+
if ((/** @type {?} */ (_CACHED_BODY)).style && !containsVendorPrefix(prop)) {
|
|
258
|
+
result = prop in (/** @type {?} */ (_CACHED_BODY)).style;
|
|
257
259
|
if (!result && _IS_WEBKIT) {
|
|
258
260
|
/** @type {?} */
|
|
259
261
|
const camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.substr(1);
|
|
260
|
-
result = camelProp in /** @type {?} */ (
|
|
262
|
+
result = camelProp in (/** @type {?} */ (_CACHED_BODY)).style;
|
|
261
263
|
}
|
|
262
264
|
}
|
|
263
265
|
return result;
|
|
@@ -294,7 +296,7 @@ function hypenatePropsObject(object) {
|
|
|
294
296
|
|
|
295
297
|
/**
|
|
296
298
|
* @fileoverview added by tsickle
|
|
297
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
299
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
298
300
|
*/
|
|
299
301
|
/**
|
|
300
302
|
* \@publicApi
|
|
@@ -364,7 +366,7 @@ AnimationDriver.NOOP = new NoopAnimationDriver();
|
|
|
364
366
|
|
|
365
367
|
/**
|
|
366
368
|
* @fileoverview added by tsickle
|
|
367
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
369
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
368
370
|
*/
|
|
369
371
|
/** @type {?} */
|
|
370
372
|
const ONE_SECOND = 1000;
|
|
@@ -392,7 +394,7 @@ function resolveTimingValue(value) {
|
|
|
392
394
|
if (typeof value == 'number')
|
|
393
395
|
return value;
|
|
394
396
|
/** @type {?} */
|
|
395
|
-
const matches = (/** @type {?} */ (value)).match(/^(-?[\.\d]+)(m?s)/);
|
|
397
|
+
const matches = ((/** @type {?} */ (value))).match(/^(-?[\.\d]+)(m?s)/);
|
|
396
398
|
if (!matches || matches.length < 2)
|
|
397
399
|
return 0;
|
|
398
400
|
return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);
|
|
@@ -407,7 +409,6 @@ function _convertTimeValueToMS(value, unit) {
|
|
|
407
409
|
case 's':
|
|
408
410
|
return value * ONE_SECOND;
|
|
409
411
|
default: // ms or something else
|
|
410
|
-
// ms or something else
|
|
411
412
|
return value;
|
|
412
413
|
}
|
|
413
414
|
}
|
|
@@ -418,8 +419,9 @@ function _convertTimeValueToMS(value, unit) {
|
|
|
418
419
|
* @return {?}
|
|
419
420
|
*/
|
|
420
421
|
function resolveTiming(timings, errors, allowNegativeValues) {
|
|
421
|
-
return timings.hasOwnProperty('duration') ?
|
|
422
|
-
|
|
422
|
+
return timings.hasOwnProperty('duration') ?
|
|
423
|
+
(/** @type {?} */ (timings)) :
|
|
424
|
+
parseTimeExpression((/** @type {?} */ (timings)), errors, allowNegativeValues);
|
|
423
425
|
}
|
|
424
426
|
/**
|
|
425
427
|
* @param {?} exp
|
|
@@ -447,7 +449,7 @@ function parseTimeExpression(exp, errors, allowNegativeValues) {
|
|
|
447
449
|
/** @type {?} */
|
|
448
450
|
const delayMatch = matches[3];
|
|
449
451
|
if (delayMatch != null) {
|
|
450
|
-
delay = _convertTimeValueToMS(
|
|
452
|
+
delay = _convertTimeValueToMS(parseFloat(delayMatch), matches[4]);
|
|
451
453
|
}
|
|
452
454
|
/** @type {?} */
|
|
453
455
|
const easingVal = matches[5];
|
|
@@ -456,7 +458,7 @@ function parseTimeExpression(exp, errors, allowNegativeValues) {
|
|
|
456
458
|
}
|
|
457
459
|
}
|
|
458
460
|
else {
|
|
459
|
-
duration = /** @type {?} */ (exp);
|
|
461
|
+
duration = (/** @type {?} */ (exp));
|
|
460
462
|
}
|
|
461
463
|
if (!allowNegativeValues) {
|
|
462
464
|
/** @type {?} */
|
|
@@ -542,6 +544,10 @@ function getStyleAttributeString(element, key, value) {
|
|
|
542
544
|
* @return {?}
|
|
543
545
|
*/
|
|
544
546
|
function writeStyleAttribute(element) {
|
|
547
|
+
// Read the style property of the element and manually reflect it to the
|
|
548
|
+
// style attribute. This is needed because Domino on platform-server doesn't
|
|
549
|
+
// understand the full set of allowed CSS properties and doesn't reflect some
|
|
550
|
+
// of them automatically.
|
|
545
551
|
/** @type {?} */
|
|
546
552
|
let styleAttrValue = '';
|
|
547
553
|
for (let i = 0; i < element.style.length; i++) {
|
|
@@ -606,7 +612,7 @@ function normalizeAnimationEntry(steps) {
|
|
|
606
612
|
return steps[0];
|
|
607
613
|
return sequence(steps);
|
|
608
614
|
}
|
|
609
|
-
return /** @type {?} */ (steps);
|
|
615
|
+
return (/** @type {?} */ (steps));
|
|
610
616
|
}
|
|
611
617
|
/**
|
|
612
618
|
* @param {?} value
|
|
@@ -642,7 +648,7 @@ function extractStyleParams(value) {
|
|
|
642
648
|
/** @type {?} */
|
|
643
649
|
let match;
|
|
644
650
|
while (match = PARAM_REGEX.exec(val)) {
|
|
645
|
-
params.push(/** @type {?} */ (match[1]));
|
|
651
|
+
params.push((/** @type {?} */ (match[1])));
|
|
646
652
|
}
|
|
647
653
|
PARAM_REGEX.lastIndex = 0;
|
|
648
654
|
}
|
|
@@ -785,20 +791,21 @@ function visitDslNode(visitor, node, context) {
|
|
|
785
791
|
* @return {?}
|
|
786
792
|
*/
|
|
787
793
|
function computeStyle(element, prop) {
|
|
788
|
-
return (/** @type {?} */ (window.getComputedStyle(element)))[prop];
|
|
794
|
+
return ((/** @type {?} */ (window.getComputedStyle(element))))[prop];
|
|
789
795
|
}
|
|
790
796
|
|
|
791
797
|
/**
|
|
792
798
|
* @fileoverview added by tsickle
|
|
793
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
799
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
794
800
|
*/
|
|
795
|
-
/**
|
|
801
|
+
/**
|
|
796
802
|
* @license
|
|
797
803
|
* Copyright Google Inc. All Rights Reserved.
|
|
798
804
|
*
|
|
799
805
|
* Use of this source code is governed by an MIT-style license that can be
|
|
800
806
|
* found in the LICENSE file at https://angular.io/license
|
|
801
|
-
|
|
807
|
+
* @type {?}
|
|
808
|
+
*/
|
|
802
809
|
const ANY_STATE = '*';
|
|
803
810
|
/**
|
|
804
811
|
* @param {?} transitionValue
|
|
@@ -809,12 +816,12 @@ function parseTransitionExpr(transitionValue, errors) {
|
|
|
809
816
|
/** @type {?} */
|
|
810
817
|
const expressions = [];
|
|
811
818
|
if (typeof transitionValue == 'string') {
|
|
812
|
-
(/** @type {?} */ (transitionValue))
|
|
819
|
+
((/** @type {?} */ (transitionValue)))
|
|
813
820
|
.split(/\s*,\s*/)
|
|
814
821
|
.forEach(str => parseInnerTransitionStr(str, expressions, errors));
|
|
815
822
|
}
|
|
816
823
|
else {
|
|
817
|
-
expressions.push(/** @type {?} */ (transitionValue));
|
|
824
|
+
expressions.push((/** @type {?} */ (transitionValue)));
|
|
818
825
|
}
|
|
819
826
|
return expressions;
|
|
820
827
|
}
|
|
@@ -832,7 +839,7 @@ function parseInnerTransitionStr(eventStr, expressions, errors) {
|
|
|
832
839
|
expressions.push(result);
|
|
833
840
|
return;
|
|
834
841
|
}
|
|
835
|
-
eventStr = /** @type {?} */ (result);
|
|
842
|
+
eventStr = (/** @type {?} */ (result));
|
|
836
843
|
}
|
|
837
844
|
/** @type {?} */
|
|
838
845
|
const match = eventStr.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/);
|
|
@@ -873,6 +880,10 @@ function parseAnimationAlias(alias, errors) {
|
|
|
873
880
|
return '* => *';
|
|
874
881
|
}
|
|
875
882
|
}
|
|
883
|
+
// DO NOT REFACTOR ... keep the follow set instantiations
|
|
884
|
+
// with the values intact (closure compiler for some reason
|
|
885
|
+
// removes follow-up lines that add the values outside of
|
|
886
|
+
// the constructor...
|
|
876
887
|
/** @type {?} */
|
|
877
888
|
const TRUE_BOOLEAN_VALUES = new Set(['true', '1']);
|
|
878
889
|
/** @type {?} */
|
|
@@ -904,12 +915,48 @@ function makeLambdaFromStates(lhs, rhs) {
|
|
|
904
915
|
|
|
905
916
|
/**
|
|
906
917
|
* @fileoverview added by tsickle
|
|
907
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
918
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
908
919
|
*/
|
|
909
920
|
/** @type {?} */
|
|
910
921
|
const SELF_TOKEN = ':self';
|
|
911
922
|
/** @type {?} */
|
|
912
923
|
const SELF_TOKEN_REGEX = new RegExp(`\s*${SELF_TOKEN}\s*,?`, 'g');
|
|
924
|
+
/*
|
|
925
|
+
* [Validation]
|
|
926
|
+
* The visitor code below will traverse the animation AST generated by the animation verb functions
|
|
927
|
+
* (the output is a tree of objects) and attempt to perform a series of validations on the data. The
|
|
928
|
+
* following corner-cases will be validated:
|
|
929
|
+
*
|
|
930
|
+
* 1. Overlap of animations
|
|
931
|
+
* Given that a CSS property cannot be animated in more than one place at the same time, it's
|
|
932
|
+
* important that this behaviour is detected and validated. The way in which this occurs is that
|
|
933
|
+
* each time a style property is examined, a string-map containing the property will be updated with
|
|
934
|
+
* the start and end times for when the property is used within an animation step.
|
|
935
|
+
*
|
|
936
|
+
* If there are two or more parallel animations that are currently running (these are invoked by the
|
|
937
|
+
* group()) on the same element then the validator will throw an error. Since the start/end timing
|
|
938
|
+
* values are collected for each property then if the current animation step is animating the same
|
|
939
|
+
* property and its timing values fall anywhere into the window of time that the property is
|
|
940
|
+
* currently being animated within then this is what causes an error.
|
|
941
|
+
*
|
|
942
|
+
* 2. Timing values
|
|
943
|
+
* The validator will validate to see if a timing value of `duration delay easing` or
|
|
944
|
+
* `durationNumber` is valid or not.
|
|
945
|
+
*
|
|
946
|
+
* (note that upon validation the code below will replace the timing data with an object containing
|
|
947
|
+
* {duration,delay,easing}.
|
|
948
|
+
*
|
|
949
|
+
* 3. Offset Validation
|
|
950
|
+
* Each of the style() calls are allowed to have an offset value when placed inside of keyframes().
|
|
951
|
+
* Offsets within keyframes() are considered valid when:
|
|
952
|
+
*
|
|
953
|
+
* - No offsets are used at all
|
|
954
|
+
* - Each style() entry contains an offset value
|
|
955
|
+
* - Each offset is between 0 and 1
|
|
956
|
+
* - Each offset is greater to or equal than the previous one
|
|
957
|
+
*
|
|
958
|
+
* Otherwise an error will be thrown.
|
|
959
|
+
*/
|
|
913
960
|
/**
|
|
914
961
|
* @param {?} driver
|
|
915
962
|
* @param {?} metadata
|
|
@@ -937,9 +984,10 @@ class AnimationAstBuilderVisitor {
|
|
|
937
984
|
/** @type {?} */
|
|
938
985
|
const context = new AnimationAstBuilderContext(errors);
|
|
939
986
|
this._resetContextStyleTimingState(context);
|
|
940
|
-
return /** @type {?} */ (visitDslNode(this, normalizeAnimationEntry(metadata), context));
|
|
987
|
+
return (/** @type {?} */ (visitDslNode(this, normalizeAnimationEntry(metadata), context)));
|
|
941
988
|
}
|
|
942
989
|
/**
|
|
990
|
+
* @private
|
|
943
991
|
* @param {?} context
|
|
944
992
|
* @return {?}
|
|
945
993
|
*/
|
|
@@ -970,7 +1018,7 @@ class AnimationAstBuilderVisitor {
|
|
|
970
1018
|
this._resetContextStyleTimingState(context);
|
|
971
1019
|
if (def.type == 0 /* State */) {
|
|
972
1020
|
/** @type {?} */
|
|
973
|
-
const stateDef = /** @type {?} */ (def);
|
|
1021
|
+
const stateDef = (/** @type {?} */ (def));
|
|
974
1022
|
/** @type {?} */
|
|
975
1023
|
const name = stateDef.name;
|
|
976
1024
|
name.toString().split(/\s*,\s*/).forEach(n => {
|
|
@@ -981,7 +1029,7 @@ class AnimationAstBuilderVisitor {
|
|
|
981
1029
|
}
|
|
982
1030
|
else if (def.type == 1 /* Transition */) {
|
|
983
1031
|
/** @type {?} */
|
|
984
|
-
const transition = this.visitTransition(/** @type {?} */ (def), context);
|
|
1032
|
+
const transition = this.visitTransition((/** @type {?} */ (def)), context);
|
|
985
1033
|
queryCount += transition.queryCount;
|
|
986
1034
|
depCount += transition.depCount;
|
|
987
1035
|
transitions.push(transition);
|
|
@@ -1014,7 +1062,7 @@ class AnimationAstBuilderVisitor {
|
|
|
1014
1062
|
styleAst.styles.forEach(value => {
|
|
1015
1063
|
if (isObject(value)) {
|
|
1016
1064
|
/** @type {?} */
|
|
1017
|
-
const stylesObj = /** @type {?} */ (value);
|
|
1065
|
+
const stylesObj = (/** @type {?} */ (value));
|
|
1018
1066
|
Object.keys(stylesObj).forEach(prop => {
|
|
1019
1067
|
extractStyleParams(stylesObj[prop]).forEach(sub => {
|
|
1020
1068
|
if (!params.hasOwnProperty(sub)) {
|
|
@@ -1109,11 +1157,11 @@ class AnimationAstBuilderVisitor {
|
|
|
1109
1157
|
/** @type {?} */
|
|
1110
1158
|
let styleMetadata = metadata.styles ? metadata.styles : style({});
|
|
1111
1159
|
if (styleMetadata.type == 5 /* Keyframes */) {
|
|
1112
|
-
styleAst = this.visitKeyframes(/** @type {?} */ (styleMetadata), context);
|
|
1160
|
+
styleAst = this.visitKeyframes((/** @type {?} */ (styleMetadata)), context);
|
|
1113
1161
|
}
|
|
1114
1162
|
else {
|
|
1115
1163
|
/** @type {?} */
|
|
1116
|
-
let styleMetadata = /** @type {?} */ (metadata.styles);
|
|
1164
|
+
let styleMetadata = (/** @type {?} */ (metadata.styles));
|
|
1117
1165
|
/** @type {?} */
|
|
1118
1166
|
let isEmpty = false;
|
|
1119
1167
|
if (!styleMetadata) {
|
|
@@ -1151,6 +1199,7 @@ class AnimationAstBuilderVisitor {
|
|
|
1151
1199
|
return ast;
|
|
1152
1200
|
}
|
|
1153
1201
|
/**
|
|
1202
|
+
* @private
|
|
1154
1203
|
* @param {?} metadata
|
|
1155
1204
|
* @param {?} context
|
|
1156
1205
|
* @return {?}
|
|
@@ -1159,17 +1208,17 @@ class AnimationAstBuilderVisitor {
|
|
|
1159
1208
|
/** @type {?} */
|
|
1160
1209
|
const styles = [];
|
|
1161
1210
|
if (Array.isArray(metadata.styles)) {
|
|
1162
|
-
(/** @type {?} */ (metadata.styles)).forEach(styleTuple => {
|
|
1211
|
+
((/** @type {?} */ (metadata.styles))).forEach(styleTuple => {
|
|
1163
1212
|
if (typeof styleTuple == 'string') {
|
|
1164
1213
|
if (styleTuple == AUTO_STYLE) {
|
|
1165
|
-
styles.push(/** @type {?} */ (styleTuple));
|
|
1214
|
+
styles.push((/** @type {?} */ (styleTuple)));
|
|
1166
1215
|
}
|
|
1167
1216
|
else {
|
|
1168
1217
|
context.errors.push(`The provided style string value ${styleTuple} is not allowed.`);
|
|
1169
1218
|
}
|
|
1170
1219
|
}
|
|
1171
1220
|
else {
|
|
1172
|
-
styles.push(/** @type {?} */ (styleTuple));
|
|
1221
|
+
styles.push((/** @type {?} */ (styleTuple)));
|
|
1173
1222
|
}
|
|
1174
1223
|
});
|
|
1175
1224
|
}
|
|
@@ -1183,11 +1232,11 @@ class AnimationAstBuilderVisitor {
|
|
|
1183
1232
|
styles.forEach(styleData => {
|
|
1184
1233
|
if (isObject(styleData)) {
|
|
1185
1234
|
/** @type {?} */
|
|
1186
|
-
const styleMap = /** @type {?} */ (styleData);
|
|
1235
|
+
const styleMap = (/** @type {?} */ (styleData));
|
|
1187
1236
|
/** @type {?} */
|
|
1188
1237
|
const easing = styleMap['easing'];
|
|
1189
1238
|
if (easing) {
|
|
1190
|
-
collectedEasing = /** @type {?} */ (easing);
|
|
1239
|
+
collectedEasing = (/** @type {?} */ (easing));
|
|
1191
1240
|
delete styleMap['easing'];
|
|
1192
1241
|
}
|
|
1193
1242
|
if (!containsDynamicStyles) {
|
|
@@ -1211,6 +1260,7 @@ class AnimationAstBuilderVisitor {
|
|
|
1211
1260
|
};
|
|
1212
1261
|
}
|
|
1213
1262
|
/**
|
|
1263
|
+
* @private
|
|
1214
1264
|
* @param {?} ast
|
|
1215
1265
|
* @param {?} context
|
|
1216
1266
|
* @return {?}
|
|
@@ -1234,7 +1284,7 @@ class AnimationAstBuilderVisitor {
|
|
|
1234
1284
|
return;
|
|
1235
1285
|
}
|
|
1236
1286
|
/** @type {?} */
|
|
1237
|
-
const collectedStyles = context.collectedStyles[/** @type {?} */ (
|
|
1287
|
+
const collectedStyles = context.collectedStyles[(/** @type {?} */ (context.currentQuerySelector))];
|
|
1238
1288
|
/** @type {?} */
|
|
1239
1289
|
const collectedEntry = collectedStyles[prop];
|
|
1240
1290
|
/** @type {?} */
|
|
@@ -1322,7 +1372,7 @@ class AnimationAstBuilderVisitor {
|
|
|
1322
1372
|
/** @type {?} */
|
|
1323
1373
|
const currentTime = context.currentTime;
|
|
1324
1374
|
/** @type {?} */
|
|
1325
|
-
const currentAnimateTimings = /** @type {?} */ (
|
|
1375
|
+
const currentAnimateTimings = (/** @type {?} */ (context.currentAnimateTimings));
|
|
1326
1376
|
/** @type {?} */
|
|
1327
1377
|
const animateDuration = currentAnimateTimings.duration;
|
|
1328
1378
|
keyframes.forEach((kf, i) => {
|
|
@@ -1381,9 +1431,9 @@ class AnimationAstBuilderVisitor {
|
|
|
1381
1431
|
*/
|
|
1382
1432
|
visitQuery(metadata, context) {
|
|
1383
1433
|
/** @type {?} */
|
|
1384
|
-
const parentSelector = /** @type {?} */ (
|
|
1434
|
+
const parentSelector = (/** @type {?} */ (context.currentQuerySelector));
|
|
1385
1435
|
/** @type {?} */
|
|
1386
|
-
const options = /** @type {?} */ ((metadata.options || {}));
|
|
1436
|
+
const options = (/** @type {?} */ ((metadata.options || {})));
|
|
1387
1437
|
context.queryCount++;
|
|
1388
1438
|
context.currentQuery = metadata;
|
|
1389
1439
|
const [selector, includeSelf] = normalizeSelector(metadata.selector);
|
|
@@ -1476,16 +1526,16 @@ function consumeOffset(styles) {
|
|
|
1476
1526
|
styles.forEach(styleTuple => {
|
|
1477
1527
|
if (isObject(styleTuple) && styleTuple.hasOwnProperty('offset')) {
|
|
1478
1528
|
/** @type {?} */
|
|
1479
|
-
const obj = /** @type {?} */ (styleTuple);
|
|
1480
|
-
offset = parseFloat(/** @type {?} */ (obj['offset']));
|
|
1529
|
+
const obj = (/** @type {?} */ (styleTuple));
|
|
1530
|
+
offset = parseFloat((/** @type {?} */ (obj['offset'])));
|
|
1481
1531
|
delete obj['offset'];
|
|
1482
1532
|
}
|
|
1483
1533
|
});
|
|
1484
1534
|
}
|
|
1485
1535
|
else if (isObject(styles) && styles.hasOwnProperty('offset')) {
|
|
1486
1536
|
/** @type {?} */
|
|
1487
|
-
const obj = /** @type {?} */ (styles);
|
|
1488
|
-
offset = parseFloat(/** @type {?} */ (obj['offset']));
|
|
1537
|
+
const obj = (/** @type {?} */ (styles));
|
|
1538
|
+
offset = parseFloat((/** @type {?} */ (obj['offset'])));
|
|
1489
1539
|
delete obj['offset'];
|
|
1490
1540
|
}
|
|
1491
1541
|
return offset;
|
|
@@ -1506,23 +1556,23 @@ function constructTimingAst(value, errors) {
|
|
|
1506
1556
|
/** @type {?} */
|
|
1507
1557
|
let timings = null;
|
|
1508
1558
|
if (value.hasOwnProperty('duration')) {
|
|
1509
|
-
timings = /** @type {?} */ (value);
|
|
1559
|
+
timings = (/** @type {?} */ (value));
|
|
1510
1560
|
}
|
|
1511
1561
|
else if (typeof value == 'number') {
|
|
1512
1562
|
/** @type {?} */
|
|
1513
|
-
const duration = resolveTiming(/** @type {?} */ (value), errors).duration;
|
|
1514
|
-
return makeTimingAst(/** @type {?} */ (duration), 0, '');
|
|
1563
|
+
const duration = resolveTiming((/** @type {?} */ (value)), errors).duration;
|
|
1564
|
+
return makeTimingAst((/** @type {?} */ (duration)), 0, '');
|
|
1515
1565
|
}
|
|
1516
1566
|
/** @type {?} */
|
|
1517
|
-
const strValue = /** @type {?} */ (value);
|
|
1567
|
+
const strValue = (/** @type {?} */ (value));
|
|
1518
1568
|
/** @type {?} */
|
|
1519
1569
|
const isDynamic = strValue.split(/\s+/).some(v => v.charAt(0) == '{' && v.charAt(1) == '{');
|
|
1520
1570
|
if (isDynamic) {
|
|
1521
1571
|
/** @type {?} */
|
|
1522
|
-
const ast = /** @type {?} */ (makeTimingAst(0, 0, ''));
|
|
1572
|
+
const ast = (/** @type {?} */ (makeTimingAst(0, 0, '')));
|
|
1523
1573
|
ast.dynamic = true;
|
|
1524
1574
|
ast.strValue = strValue;
|
|
1525
|
-
return /** @type {?} */ (ast);
|
|
1575
|
+
return (/** @type {?} */ (ast));
|
|
1526
1576
|
}
|
|
1527
1577
|
timings = timings || resolveTiming(strValue, errors);
|
|
1528
1578
|
return makeTimingAst(timings.duration, timings.delay, timings.easing);
|
|
@@ -1535,7 +1585,7 @@ function normalizeAnimationOptions(options) {
|
|
|
1535
1585
|
if (options) {
|
|
1536
1586
|
options = copyObj(options);
|
|
1537
1587
|
if (options['params']) {
|
|
1538
|
-
options['params'] = /** @type {?} */ (
|
|
1588
|
+
options['params'] = (/** @type {?} */ (normalizeParams(options['params'])));
|
|
1539
1589
|
}
|
|
1540
1590
|
}
|
|
1541
1591
|
else {
|
|
@@ -1555,7 +1605,7 @@ function makeTimingAst(duration, delay, easing) {
|
|
|
1555
1605
|
|
|
1556
1606
|
/**
|
|
1557
1607
|
* @fileoverview added by tsickle
|
|
1558
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1608
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1559
1609
|
*/
|
|
1560
1610
|
/**
|
|
1561
1611
|
* @param {?} element
|
|
@@ -1583,7 +1633,7 @@ function createTimelineInstruction(element, keyframes, preStyleProps, postStyleP
|
|
|
1583
1633
|
|
|
1584
1634
|
/**
|
|
1585
1635
|
* @fileoverview added by tsickle
|
|
1586
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1636
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1587
1637
|
*/
|
|
1588
1638
|
class ElementInstructionMap {
|
|
1589
1639
|
constructor() {
|
|
@@ -1630,7 +1680,7 @@ class ElementInstructionMap {
|
|
|
1630
1680
|
|
|
1631
1681
|
/**
|
|
1632
1682
|
* @fileoverview added by tsickle
|
|
1633
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1683
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1634
1684
|
*/
|
|
1635
1685
|
/** @type {?} */
|
|
1636
1686
|
const ONE_FRAME_IN_MILLISECONDS = 1;
|
|
@@ -1642,6 +1692,90 @@ const ENTER_TOKEN_REGEX = new RegExp(ENTER_TOKEN, 'g');
|
|
|
1642
1692
|
const LEAVE_TOKEN = ':leave';
|
|
1643
1693
|
/** @type {?} */
|
|
1644
1694
|
const LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g');
|
|
1695
|
+
/*
|
|
1696
|
+
* The code within this file aims to generate web-animations-compatible keyframes from Angular's
|
|
1697
|
+
* animation DSL code.
|
|
1698
|
+
*
|
|
1699
|
+
* The code below will be converted from:
|
|
1700
|
+
*
|
|
1701
|
+
* ```
|
|
1702
|
+
* sequence([
|
|
1703
|
+
* style({ opacity: 0 }),
|
|
1704
|
+
* animate(1000, style({ opacity: 0 }))
|
|
1705
|
+
* ])
|
|
1706
|
+
* ```
|
|
1707
|
+
*
|
|
1708
|
+
* To:
|
|
1709
|
+
* ```
|
|
1710
|
+
* keyframes = [{ opacity: 0, offset: 0 }, { opacity: 1, offset: 1 }]
|
|
1711
|
+
* duration = 1000
|
|
1712
|
+
* delay = 0
|
|
1713
|
+
* easing = ''
|
|
1714
|
+
* ```
|
|
1715
|
+
*
|
|
1716
|
+
* For this operation to cover the combination of animation verbs (style, animate, group, etc...) a
|
|
1717
|
+
* combination of prototypical inheritance, AST traversal and merge-sort-like algorithms are used.
|
|
1718
|
+
*
|
|
1719
|
+
* [AST Traversal]
|
|
1720
|
+
* Each of the animation verbs, when executed, will return an string-map object representing what
|
|
1721
|
+
* type of action it is (style, animate, group, etc...) and the data associated with it. This means
|
|
1722
|
+
* that when functional composition mix of these functions is evaluated (like in the example above)
|
|
1723
|
+
* then it will end up producing a tree of objects representing the animation itself.
|
|
1724
|
+
*
|
|
1725
|
+
* When this animation object tree is processed by the visitor code below it will visit each of the
|
|
1726
|
+
* verb statements within the visitor. And during each visit it will build the context of the
|
|
1727
|
+
* animation keyframes by interacting with the `TimelineBuilder`.
|
|
1728
|
+
*
|
|
1729
|
+
* [TimelineBuilder]
|
|
1730
|
+
* This class is responsible for tracking the styles and building a series of keyframe objects for a
|
|
1731
|
+
* timeline between a start and end time. The builder starts off with an initial timeline and each
|
|
1732
|
+
* time the AST comes across a `group()`, `keyframes()` or a combination of the two wihtin a
|
|
1733
|
+
* `sequence()` then it will generate a sub timeline for each step as well as a new one after
|
|
1734
|
+
* they are complete.
|
|
1735
|
+
*
|
|
1736
|
+
* As the AST is traversed, the timing state on each of the timelines will be incremented. If a sub
|
|
1737
|
+
* timeline was created (based on one of the cases above) then the parent timeline will attempt to
|
|
1738
|
+
* merge the styles used within the sub timelines into itself (only with group() this will happen).
|
|
1739
|
+
* This happens with a merge operation (much like how the merge works in mergesort) and it will only
|
|
1740
|
+
* copy the most recently used styles from the sub timelines into the parent timeline. This ensures
|
|
1741
|
+
* that if the styles are used later on in another phase of the animation then they will be the most
|
|
1742
|
+
* up-to-date values.
|
|
1743
|
+
*
|
|
1744
|
+
* [How Missing Styles Are Updated]
|
|
1745
|
+
* Each timeline has a `backFill` property which is responsible for filling in new styles into
|
|
1746
|
+
* already processed keyframes if a new style shows up later within the animation sequence.
|
|
1747
|
+
*
|
|
1748
|
+
* ```
|
|
1749
|
+
* sequence([
|
|
1750
|
+
* style({ width: 0 }),
|
|
1751
|
+
* animate(1000, style({ width: 100 })),
|
|
1752
|
+
* animate(1000, style({ width: 200 })),
|
|
1753
|
+
* animate(1000, style({ width: 300 }))
|
|
1754
|
+
* animate(1000, style({ width: 400, height: 400 })) // notice how `height` doesn't exist anywhere
|
|
1755
|
+
* else
|
|
1756
|
+
* ])
|
|
1757
|
+
* ```
|
|
1758
|
+
*
|
|
1759
|
+
* What is happening here is that the `height` value is added later in the sequence, but is missing
|
|
1760
|
+
* from all previous animation steps. Therefore when a keyframe is created it would also be missing
|
|
1761
|
+
* from all previous keyframes up until where it is first used. For the timeline keyframe generation
|
|
1762
|
+
* to properly fill in the style it will place the previous value (the value from the parent
|
|
1763
|
+
* timeline) or a default value of `*` into the backFill object. Given that each of the keyframe
|
|
1764
|
+
* styles are objects that prototypically inhert from the backFill object, this means that if a
|
|
1765
|
+
* value is added into the backFill then it will automatically propagate any missing values to all
|
|
1766
|
+
* keyframes. Therefore the missing `height` value will be properly filled into the already
|
|
1767
|
+
* processed keyframes.
|
|
1768
|
+
*
|
|
1769
|
+
* When a sub-timeline is created it will have its own backFill property. This is done so that
|
|
1770
|
+
* styles present within the sub-timeline do not accidentally seep into the previous/future timeline
|
|
1771
|
+
* keyframes
|
|
1772
|
+
*
|
|
1773
|
+
* (For prototypically-inherited contents to be detected a `for(i in obj)` loop must be used.)
|
|
1774
|
+
*
|
|
1775
|
+
* [Validation]
|
|
1776
|
+
* The code in this file is not responsible for validation. That functionality happens with within
|
|
1777
|
+
* the `AnimationValidatorVisitor` code.
|
|
1778
|
+
*/
|
|
1645
1779
|
/**
|
|
1646
1780
|
* @param {?} driver
|
|
1647
1781
|
* @param {?} rootElement
|
|
@@ -1679,6 +1813,7 @@ class AnimationTimelineBuilderVisitor {
|
|
|
1679
1813
|
context.options = options;
|
|
1680
1814
|
context.currentTimeline.setStyles([startingStyles], null, context.errors, options);
|
|
1681
1815
|
visitDslNode(this, ast, context);
|
|
1816
|
+
// this checks to see if an actual animation happened
|
|
1682
1817
|
/** @type {?} */
|
|
1683
1818
|
const timelines = context.timelines.filter(timeline => timeline.containsAnimation());
|
|
1684
1819
|
if (timelines.length && Object.keys(finalStyles).length) {
|
|
@@ -1729,7 +1864,7 @@ class AnimationTimelineBuilderVisitor {
|
|
|
1729
1864
|
/** @type {?} */
|
|
1730
1865
|
const startTime = context.currentTimeline.currentTime;
|
|
1731
1866
|
/** @type {?} */
|
|
1732
|
-
const endTime = this._visitSubInstructions(elementInstructions, innerContext, /** @type {?} */ (innerContext.options));
|
|
1867
|
+
const endTime = this._visitSubInstructions(elementInstructions, innerContext, (/** @type {?} */ (innerContext.options)));
|
|
1733
1868
|
if (startTime != endTime) {
|
|
1734
1869
|
// we do this on the upper context because we created a sub context for
|
|
1735
1870
|
// the sub child animations
|
|
@@ -1752,6 +1887,7 @@ class AnimationTimelineBuilderVisitor {
|
|
|
1752
1887
|
context.previousNode = ast;
|
|
1753
1888
|
}
|
|
1754
1889
|
/**
|
|
1890
|
+
* @private
|
|
1755
1891
|
* @param {?} instructions
|
|
1756
1892
|
* @param {?} context
|
|
1757
1893
|
* @param {?} options
|
|
@@ -1762,6 +1898,8 @@ class AnimationTimelineBuilderVisitor {
|
|
|
1762
1898
|
const startTime = context.currentTimeline.currentTime;
|
|
1763
1899
|
/** @type {?} */
|
|
1764
1900
|
let furthestTime = startTime;
|
|
1901
|
+
// this is a special-case for when a user wants to skip a sub
|
|
1902
|
+
// animation from being fired entirely.
|
|
1765
1903
|
/** @type {?} */
|
|
1766
1904
|
const duration = options.duration != null ? resolveTimingValue(options.duration) : null;
|
|
1767
1905
|
/** @type {?} */
|
|
@@ -1854,14 +1992,15 @@ class AnimationTimelineBuilderVisitor {
|
|
|
1854
1992
|
context.previousNode = ast;
|
|
1855
1993
|
}
|
|
1856
1994
|
/**
|
|
1995
|
+
* @private
|
|
1857
1996
|
* @param {?} ast
|
|
1858
1997
|
* @param {?} context
|
|
1859
1998
|
* @return {?}
|
|
1860
1999
|
*/
|
|
1861
2000
|
_visitTiming(ast, context) {
|
|
1862
|
-
if ((/** @type {?} */ (ast)).dynamic) {
|
|
2001
|
+
if (((/** @type {?} */ (ast))).dynamic) {
|
|
1863
2002
|
/** @type {?} */
|
|
1864
|
-
const strValue = (/** @type {?} */ (ast)).strValue;
|
|
2003
|
+
const strValue = ((/** @type {?} */ (ast))).strValue;
|
|
1865
2004
|
/** @type {?} */
|
|
1866
2005
|
const timingValue = context.params ? interpolateParams(strValue, context.params, context.errors) : strValue;
|
|
1867
2006
|
return resolveTiming(timingValue, context.errors);
|
|
@@ -1891,7 +2030,7 @@ class AnimationTimelineBuilderVisitor {
|
|
|
1891
2030
|
}
|
|
1892
2031
|
else {
|
|
1893
2032
|
context.incrementTime(timings.duration);
|
|
1894
|
-
this.visitStyle(/** @type {?} */ (style$$1), context);
|
|
2033
|
+
this.visitStyle((/** @type {?} */ (style$$1)), context);
|
|
1895
2034
|
timeline.applyStylesToKeyframe();
|
|
1896
2035
|
}
|
|
1897
2036
|
context.currentAnimateTimings = null;
|
|
@@ -1906,7 +2045,7 @@ class AnimationTimelineBuilderVisitor {
|
|
|
1906
2045
|
/** @type {?} */
|
|
1907
2046
|
const timeline = context.currentTimeline;
|
|
1908
2047
|
/** @type {?} */
|
|
1909
|
-
const timings = /** @type {?} */ (
|
|
2048
|
+
const timings = (/** @type {?} */ (context.currentAnimateTimings));
|
|
1910
2049
|
// this is a special case for when a style() call
|
|
1911
2050
|
// directly follows an animate() call (but not inside of an animate() call)
|
|
1912
2051
|
if (!timings && timeline.getCurrentStyleProperties().length) {
|
|
@@ -1929,9 +2068,9 @@ class AnimationTimelineBuilderVisitor {
|
|
|
1929
2068
|
*/
|
|
1930
2069
|
visitKeyframes(ast, context) {
|
|
1931
2070
|
/** @type {?} */
|
|
1932
|
-
const currentAnimateTimings = /** @type {?} */ (
|
|
2071
|
+
const currentAnimateTimings = (/** @type {?} */ (context.currentAnimateTimings));
|
|
1933
2072
|
/** @type {?} */
|
|
1934
|
-
const startTime = (/** @type {?} */ (
|
|
2073
|
+
const startTime = ((/** @type {?} */ (context.currentTimeline))).duration;
|
|
1935
2074
|
/** @type {?} */
|
|
1936
2075
|
const duration = currentAnimateTimings.duration;
|
|
1937
2076
|
/** @type {?} */
|
|
@@ -1960,10 +2099,12 @@ class AnimationTimelineBuilderVisitor {
|
|
|
1960
2099
|
* @return {?}
|
|
1961
2100
|
*/
|
|
1962
2101
|
visitQuery(ast, context) {
|
|
2102
|
+
// in the event that the first step before this is a style step we need
|
|
2103
|
+
// to ensure the styles are applied before the children are animated
|
|
1963
2104
|
/** @type {?} */
|
|
1964
2105
|
const startTime = context.currentTimeline.currentTime;
|
|
1965
2106
|
/** @type {?} */
|
|
1966
|
-
const options = /** @type {?} */ ((ast.options || {}));
|
|
2107
|
+
const options = (/** @type {?} */ ((ast.options || {})));
|
|
1967
2108
|
/** @type {?} */
|
|
1968
2109
|
const delay = options.delay ? resolveTimingValue(options.delay) : 0;
|
|
1969
2110
|
if (delay && (context.previousNode.type === 6 /* Style */ ||
|
|
@@ -2013,7 +2154,7 @@ class AnimationTimelineBuilderVisitor {
|
|
|
2013
2154
|
*/
|
|
2014
2155
|
visitStagger(ast, context) {
|
|
2015
2156
|
/** @type {?} */
|
|
2016
|
-
const parentContext = /** @type {?} */ (
|
|
2157
|
+
const parentContext = (/** @type {?} */ (context.parentContext));
|
|
2017
2158
|
/** @type {?} */
|
|
2018
2159
|
const tl = context.currentTimeline;
|
|
2019
2160
|
/** @type {?} */
|
|
@@ -2052,7 +2193,7 @@ class AnimationTimelineBuilderVisitor {
|
|
|
2052
2193
|
}
|
|
2053
2194
|
}
|
|
2054
2195
|
/** @type {?} */
|
|
2055
|
-
const DEFAULT_NOOP_PREVIOUS_NODE = /** @type {?} */ ({});
|
|
2196
|
+
const DEFAULT_NOOP_PREVIOUS_NODE = (/** @type {?} */ ({}));
|
|
2056
2197
|
class AnimationTimelineContext {
|
|
2057
2198
|
/**
|
|
2058
2199
|
* @param {?} _driver
|
|
@@ -2096,12 +2237,12 @@ class AnimationTimelineContext {
|
|
|
2096
2237
|
if (!options)
|
|
2097
2238
|
return;
|
|
2098
2239
|
/** @type {?} */
|
|
2099
|
-
const newOptions = /** @type {?} */ (options);
|
|
2240
|
+
const newOptions = (/** @type {?} */ (options));
|
|
2100
2241
|
/** @type {?} */
|
|
2101
2242
|
let optionsToUpdate = this.options;
|
|
2102
2243
|
// NOTE: this will get patched up when other animation methods support duration overrides
|
|
2103
2244
|
if (newOptions.duration != null) {
|
|
2104
|
-
(/** @type {?} */ (optionsToUpdate)).duration = resolveTimingValue(newOptions.duration);
|
|
2245
|
+
((/** @type {?} */ (optionsToUpdate))).duration = resolveTimingValue(newOptions.duration);
|
|
2105
2246
|
}
|
|
2106
2247
|
if (newOptions.delay != null) {
|
|
2107
2248
|
optionsToUpdate.delay = resolveTimingValue(newOptions.delay);
|
|
@@ -2110,7 +2251,7 @@ class AnimationTimelineContext {
|
|
|
2110
2251
|
const newParams = newOptions.params;
|
|
2111
2252
|
if (newParams) {
|
|
2112
2253
|
/** @type {?} */
|
|
2113
|
-
let paramsToUpdate = /** @type {?} */ (
|
|
2254
|
+
let paramsToUpdate = (/** @type {?} */ (optionsToUpdate.params));
|
|
2114
2255
|
if (!paramsToUpdate) {
|
|
2115
2256
|
paramsToUpdate = this.options.params = {};
|
|
2116
2257
|
}
|
|
@@ -2122,6 +2263,7 @@ class AnimationTimelineContext {
|
|
|
2122
2263
|
}
|
|
2123
2264
|
}
|
|
2124
2265
|
/**
|
|
2266
|
+
* @private
|
|
2125
2267
|
* @return {?}
|
|
2126
2268
|
*/
|
|
2127
2269
|
_copyOptions() {
|
|
@@ -2220,7 +2362,6 @@ class AnimationTimelineContext {
|
|
|
2220
2362
|
results.push(this.element);
|
|
2221
2363
|
}
|
|
2222
2364
|
if (selector.length > 0) { // if :self is only used then the selector is empty
|
|
2223
|
-
// if :self is only used then the selector is empty
|
|
2224
2365
|
selector = selector.replace(ENTER_TOKEN_REGEX, '.' + this._enterClassName);
|
|
2225
2366
|
selector = selector.replace(LEAVE_TOKEN_REGEX, '.' + this._leaveClassName);
|
|
2226
2367
|
/** @type {?} */
|
|
@@ -2263,7 +2404,7 @@ class TimelineBuilder {
|
|
|
2263
2404
|
this._elementTimelineStylesLookup = new Map();
|
|
2264
2405
|
}
|
|
2265
2406
|
this._localTimelineStyles = Object.create(this._backFill, {});
|
|
2266
|
-
this._globalTimelineStyles = /** @type {?} */ (
|
|
2407
|
+
this._globalTimelineStyles = (/** @type {?} */ (this._elementTimelineStylesLookup.get(element)));
|
|
2267
2408
|
if (!this._globalTimelineStyles) {
|
|
2268
2409
|
this._globalTimelineStyles = this._localTimelineStyles;
|
|
2269
2410
|
this._elementTimelineStylesLookup.set(element, this._localTimelineStyles);
|
|
@@ -2296,6 +2437,10 @@ class TimelineBuilder {
|
|
|
2296
2437
|
* @return {?}
|
|
2297
2438
|
*/
|
|
2298
2439
|
delayNextStep(delay) {
|
|
2440
|
+
// in the event that a style() step is placed right before a stagger()
|
|
2441
|
+
// and that style() step is the very first style() value in the animation
|
|
2442
|
+
// then we need to make a copy of the keyframe [0, copy, 1] so that the delay
|
|
2443
|
+
// properly applies the style() values to work with the stagger...
|
|
2299
2444
|
/** @type {?} */
|
|
2300
2445
|
const hasPreStyleStep = this._keyframes.size == 1 && Object.keys(this._pendingStyles).length;
|
|
2301
2446
|
if (this.duration || hasPreStyleStep) {
|
|
@@ -2318,13 +2463,14 @@ class TimelineBuilder {
|
|
|
2318
2463
|
return new TimelineBuilder(this._driver, element, currentTime || this.currentTime, this._elementTimelineStylesLookup);
|
|
2319
2464
|
}
|
|
2320
2465
|
/**
|
|
2466
|
+
* @private
|
|
2321
2467
|
* @return {?}
|
|
2322
2468
|
*/
|
|
2323
2469
|
_loadKeyframe() {
|
|
2324
2470
|
if (this._currentKeyframe) {
|
|
2325
2471
|
this._previousKeyframe = this._currentKeyframe;
|
|
2326
2472
|
}
|
|
2327
|
-
this._currentKeyframe = /** @type {?} */ (
|
|
2473
|
+
this._currentKeyframe = (/** @type {?} */ (this._keyframes.get(this.duration)));
|
|
2328
2474
|
if (!this._currentKeyframe) {
|
|
2329
2475
|
this._currentKeyframe = Object.create(this._backFill, {});
|
|
2330
2476
|
this._keyframes.set(this.duration, this._currentKeyframe);
|
|
@@ -2347,6 +2493,7 @@ class TimelineBuilder {
|
|
|
2347
2493
|
this._loadKeyframe();
|
|
2348
2494
|
}
|
|
2349
2495
|
/**
|
|
2496
|
+
* @private
|
|
2350
2497
|
* @param {?} prop
|
|
2351
2498
|
* @param {?} value
|
|
2352
2499
|
* @return {?}
|
|
@@ -2555,6 +2702,7 @@ class SubTimelineBuilder extends TimelineBuilder {
|
|
|
2555
2702
|
const totalTime = duration + delay;
|
|
2556
2703
|
/** @type {?} */
|
|
2557
2704
|
const startingGap = delay / totalTime;
|
|
2705
|
+
// the original starting keyframe now starts once the delay is done
|
|
2558
2706
|
/** @type {?} */
|
|
2559
2707
|
const newFirstKeyframe = copyStyles(keyframes[0], false);
|
|
2560
2708
|
newFirstKeyframe['offset'] = 0;
|
|
@@ -2563,13 +2711,28 @@ class SubTimelineBuilder extends TimelineBuilder {
|
|
|
2563
2711
|
const oldFirstKeyframe = copyStyles(keyframes[0], false);
|
|
2564
2712
|
oldFirstKeyframe['offset'] = roundOffset(startingGap);
|
|
2565
2713
|
newKeyframes.push(oldFirstKeyframe);
|
|
2714
|
+
/*
|
|
2715
|
+
When the keyframe is stretched then it means that the delay before the animation
|
|
2716
|
+
starts is gone. Instead the first keyframe is placed at the start of the animation
|
|
2717
|
+
and it is then copied to where it starts when the original delay is over. This basically
|
|
2718
|
+
means nothing animates during that delay, but the styles are still renderered. For this
|
|
2719
|
+
to work the original offset values that exist in the original keyframes must be "warped"
|
|
2720
|
+
so that they can take the new keyframe + delay into account.
|
|
2721
|
+
|
|
2722
|
+
delay=1000, duration=1000, keyframes = 0 .5 1
|
|
2723
|
+
|
|
2724
|
+
turns into
|
|
2725
|
+
|
|
2726
|
+
delay=0, duration=2000, keyframes = 0 .33 .66 1
|
|
2727
|
+
*/
|
|
2728
|
+
// offsets between 1 ... n -1 are all warped by the keyframe stretch
|
|
2566
2729
|
/** @type {?} */
|
|
2567
2730
|
const limit = keyframes.length - 1;
|
|
2568
2731
|
for (let i = 1; i <= limit; i++) {
|
|
2569
2732
|
/** @type {?} */
|
|
2570
2733
|
let kf = copyStyles(keyframes[i], false);
|
|
2571
2734
|
/** @type {?} */
|
|
2572
|
-
const oldOffset = /** @type {?} */ (kf['offset']);
|
|
2735
|
+
const oldOffset = (/** @type {?} */ (kf['offset']));
|
|
2573
2736
|
/** @type {?} */
|
|
2574
2737
|
const timeAtKeyframe = delay + oldOffset * duration;
|
|
2575
2738
|
kf['offset'] = roundOffset(timeAtKeyframe / totalTime);
|
|
@@ -2610,7 +2773,7 @@ function flattenStyles(input, allStyles) {
|
|
|
2610
2773
|
allProperties.forEach(prop => { styles[prop] = AUTO_STYLE; });
|
|
2611
2774
|
}
|
|
2612
2775
|
else {
|
|
2613
|
-
copyStyles(/** @type {?} */ (token), false, styles);
|
|
2776
|
+
copyStyles((/** @type {?} */ (token)), false, styles);
|
|
2614
2777
|
}
|
|
2615
2778
|
});
|
|
2616
2779
|
return styles;
|
|
@@ -2618,7 +2781,7 @@ function flattenStyles(input, allStyles) {
|
|
|
2618
2781
|
|
|
2619
2782
|
/**
|
|
2620
2783
|
* @fileoverview added by tsickle
|
|
2621
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
2784
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2622
2785
|
*/
|
|
2623
2786
|
class Animation {
|
|
2624
2787
|
/**
|
|
@@ -2648,9 +2811,11 @@ class Animation {
|
|
|
2648
2811
|
*/
|
|
2649
2812
|
buildTimelines(element, startingStyles, destinationStyles, options, subInstructions) {
|
|
2650
2813
|
/** @type {?} */
|
|
2651
|
-
const start = Array.isArray(startingStyles) ? normalizeStyles(startingStyles) :
|
|
2814
|
+
const start = Array.isArray(startingStyles) ? normalizeStyles(startingStyles) :
|
|
2815
|
+
(/** @type {?} */ (startingStyles));
|
|
2652
2816
|
/** @type {?} */
|
|
2653
|
-
const dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) :
|
|
2817
|
+
const dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) :
|
|
2818
|
+
(/** @type {?} */ (destinationStyles));
|
|
2654
2819
|
/** @type {?} */
|
|
2655
2820
|
const errors = [];
|
|
2656
2821
|
subInstructions = subInstructions || new ElementInstructionMap();
|
|
@@ -2667,7 +2832,7 @@ class Animation {
|
|
|
2667
2832
|
|
|
2668
2833
|
/**
|
|
2669
2834
|
* @fileoverview added by tsickle
|
|
2670
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
2835
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2671
2836
|
*/
|
|
2672
2837
|
/**
|
|
2673
2838
|
* @license
|
|
@@ -2700,13 +2865,13 @@ class NoopAnimationStyleNormalizer {
|
|
|
2700
2865
|
* @return {?}
|
|
2701
2866
|
*/
|
|
2702
2867
|
normalizeStyleValue(userProvidedProperty, normalizedProperty, value, errors) {
|
|
2703
|
-
return /** @type {?} */ (value);
|
|
2868
|
+
return (/** @type {?} */ (value));
|
|
2704
2869
|
}
|
|
2705
2870
|
}
|
|
2706
2871
|
|
|
2707
2872
|
/**
|
|
2708
2873
|
* @fileoverview added by tsickle
|
|
2709
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
2874
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2710
2875
|
*/
|
|
2711
2876
|
class WebAnimationsStyleNormalizer extends AnimationStyleNormalizer {
|
|
2712
2877
|
/**
|
|
@@ -2760,7 +2925,7 @@ function makeBooleanMap(keys) {
|
|
|
2760
2925
|
|
|
2761
2926
|
/**
|
|
2762
2927
|
* @fileoverview added by tsickle
|
|
2763
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
2928
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2764
2929
|
*/
|
|
2765
2930
|
/**
|
|
2766
2931
|
* @param {?} element
|
|
@@ -2799,7 +2964,7 @@ function createTransitionInstruction(element, triggerName, fromState, toState, i
|
|
|
2799
2964
|
|
|
2800
2965
|
/**
|
|
2801
2966
|
* @fileoverview added by tsickle
|
|
2802
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
2967
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2803
2968
|
*/
|
|
2804
2969
|
/** @type {?} */
|
|
2805
2970
|
const EMPTY_OBJECT = {};
|
|
@@ -2941,7 +3106,7 @@ class AnimationStateStyles {
|
|
|
2941
3106
|
this.styles.styles.forEach(value => {
|
|
2942
3107
|
if (typeof value !== 'string') {
|
|
2943
3108
|
/** @type {?} */
|
|
2944
|
-
const styleObj = /** @type {?} */ (value);
|
|
3109
|
+
const styleObj = (/** @type {?} */ (value));
|
|
2945
3110
|
Object.keys(styleObj).forEach(prop => {
|
|
2946
3111
|
/** @type {?} */
|
|
2947
3112
|
let val = styleObj[prop];
|
|
@@ -2958,7 +3123,7 @@ class AnimationStateStyles {
|
|
|
2958
3123
|
|
|
2959
3124
|
/**
|
|
2960
3125
|
* @fileoverview added by tsickle
|
|
2961
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
3126
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2962
3127
|
*/
|
|
2963
3128
|
/**
|
|
2964
3129
|
* \@publicApi
|
|
@@ -3060,7 +3225,7 @@ function balanceProperties(obj, key1, key2) {
|
|
|
3060
3225
|
|
|
3061
3226
|
/**
|
|
3062
3227
|
* @fileoverview added by tsickle
|
|
3063
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
3228
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3064
3229
|
*/
|
|
3065
3230
|
/** @type {?} */
|
|
3066
3231
|
const EMPTY_INSTRUCTION_MAP = new ElementInstructionMap();
|
|
@@ -3096,6 +3261,7 @@ class TimelineAnimationEngine {
|
|
|
3096
3261
|
}
|
|
3097
3262
|
}
|
|
3098
3263
|
/**
|
|
3264
|
+
* @private
|
|
3099
3265
|
* @param {?} i
|
|
3100
3266
|
* @param {?} preStyles
|
|
3101
3267
|
* @param {?=} postStyles
|
|
@@ -3170,6 +3336,7 @@ class TimelineAnimationEngine {
|
|
|
3170
3336
|
}
|
|
3171
3337
|
}
|
|
3172
3338
|
/**
|
|
3339
|
+
* @private
|
|
3173
3340
|
* @param {?} id
|
|
3174
3341
|
* @return {?}
|
|
3175
3342
|
*/
|
|
@@ -3189,6 +3356,7 @@ class TimelineAnimationEngine {
|
|
|
3189
3356
|
* @return {?}
|
|
3190
3357
|
*/
|
|
3191
3358
|
listen(id, element, eventName, callback) {
|
|
3359
|
+
// triggerName, fromState, toState are all ignored for timeline animations
|
|
3192
3360
|
/** @type {?} */
|
|
3193
3361
|
const baseEvent = makeAnimationEvent(element, '', '', '');
|
|
3194
3362
|
listenOnPlayer(this._getPlayer(id), eventName, baseEvent, callback);
|
|
@@ -3203,12 +3371,12 @@ class TimelineAnimationEngine {
|
|
|
3203
3371
|
*/
|
|
3204
3372
|
command(id, element, command, args) {
|
|
3205
3373
|
if (command == 'register') {
|
|
3206
|
-
this.register(id, /** @type {?} */ (args[0]));
|
|
3374
|
+
this.register(id, (/** @type {?} */ (args[0])));
|
|
3207
3375
|
return;
|
|
3208
3376
|
}
|
|
3209
3377
|
if (command == 'create') {
|
|
3210
3378
|
/** @type {?} */
|
|
3211
|
-
const options = /** @type {?} */ ((args[0] || {}));
|
|
3379
|
+
const options = (/** @type {?} */ ((args[0] || {})));
|
|
3212
3380
|
this.create(id, element, options);
|
|
3213
3381
|
return;
|
|
3214
3382
|
}
|
|
@@ -3234,7 +3402,7 @@ class TimelineAnimationEngine {
|
|
|
3234
3402
|
player.init();
|
|
3235
3403
|
break;
|
|
3236
3404
|
case 'setPosition':
|
|
3237
|
-
player.setPosition(parseFloat(/** @type {?} */ (args[0])));
|
|
3405
|
+
player.setPosition(parseFloat((/** @type {?} */ (args[0]))));
|
|
3238
3406
|
break;
|
|
3239
3407
|
case 'destroy':
|
|
3240
3408
|
this.destroy(id);
|
|
@@ -3245,7 +3413,7 @@ class TimelineAnimationEngine {
|
|
|
3245
3413
|
|
|
3246
3414
|
/**
|
|
3247
3415
|
* @fileoverview added by tsickle
|
|
3248
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
3416
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3249
3417
|
*/
|
|
3250
3418
|
/** @type {?} */
|
|
3251
3419
|
const QUEUED_CLASSNAME = 'ng-animate-queued';
|
|
@@ -3293,9 +3461,9 @@ class StateValue {
|
|
|
3293
3461
|
this.value = normalizeTriggerValue(value);
|
|
3294
3462
|
if (isObj) {
|
|
3295
3463
|
/** @type {?} */
|
|
3296
|
-
const options = copyObj(/** @type {?} */ (input));
|
|
3464
|
+
const options = copyObj((/** @type {?} */ (input)));
|
|
3297
3465
|
delete options['value'];
|
|
3298
|
-
this.options = /** @type {?} */ (options);
|
|
3466
|
+
this.options = (/** @type {?} */ (options));
|
|
3299
3467
|
}
|
|
3300
3468
|
else {
|
|
3301
3469
|
this.options = {};
|
|
@@ -3307,7 +3475,7 @@ class StateValue {
|
|
|
3307
3475
|
/**
|
|
3308
3476
|
* @return {?}
|
|
3309
3477
|
*/
|
|
3310
|
-
get params() { return /** @type {?} */ (this.options.params); }
|
|
3478
|
+
get params() { return (/** @type {?} */ (this.options.params)); }
|
|
3311
3479
|
/**
|
|
3312
3480
|
* @param {?} options
|
|
3313
3481
|
* @return {?}
|
|
@@ -3317,7 +3485,7 @@ class StateValue {
|
|
|
3317
3485
|
const newParams = options.params;
|
|
3318
3486
|
if (newParams) {
|
|
3319
3487
|
/** @type {?} */
|
|
3320
|
-
const oldParams = /** @type {?} */ (
|
|
3488
|
+
const oldParams = (/** @type {?} */ (this.options.params));
|
|
3321
3489
|
Object.keys(newParams).forEach(prop => {
|
|
3322
3490
|
if (oldParams[prop] == null) {
|
|
3323
3491
|
oldParams[prop] = newParams[prop];
|
|
@@ -3408,6 +3576,7 @@ class AnimationTransitionNamespace {
|
|
|
3408
3576
|
}
|
|
3409
3577
|
}
|
|
3410
3578
|
/**
|
|
3579
|
+
* @private
|
|
3411
3580
|
* @param {?} name
|
|
3412
3581
|
* @return {?}
|
|
3413
3582
|
*/
|
|
@@ -3554,6 +3723,7 @@ class AnimationTransitionNamespace {
|
|
|
3554
3723
|
}
|
|
3555
3724
|
}
|
|
3556
3725
|
/**
|
|
3726
|
+
* @private
|
|
3557
3727
|
* @param {?} rootElement
|
|
3558
3728
|
* @param {?} context
|
|
3559
3729
|
* @param {?=} animate
|
|
@@ -3633,7 +3803,7 @@ class AnimationTransitionNamespace {
|
|
|
3633
3803
|
/** @type {?} */
|
|
3634
3804
|
const transition = trigger.fallbackTransition;
|
|
3635
3805
|
/** @type {?} */
|
|
3636
|
-
const elementStates = /** @type {?} */ (
|
|
3806
|
+
const elementStates = (/** @type {?} */ (this._engine.statesByElement.get(element)));
|
|
3637
3807
|
/** @type {?} */
|
|
3638
3808
|
const fromState = elementStates[triggerName] || DEFAULT_STATE_VALUE;
|
|
3639
3809
|
/** @type {?} */
|
|
@@ -3667,6 +3837,8 @@ class AnimationTransitionNamespace {
|
|
|
3667
3837
|
// this means that a * => VOID animation was detected and kicked off
|
|
3668
3838
|
if (this.triggerLeaveAnimation(element, context, true))
|
|
3669
3839
|
return;
|
|
3840
|
+
// find the player that is animating and make sure that the
|
|
3841
|
+
// removal is delayed until that player has completed
|
|
3670
3842
|
/** @type {?} */
|
|
3671
3843
|
let containsPotentialParentTransition = false;
|
|
3672
3844
|
if (engine.totalAnimations) {
|
|
@@ -3737,7 +3909,7 @@ class AnimationTransitionNamespace {
|
|
|
3737
3909
|
if (listener.name == entry.triggerName) {
|
|
3738
3910
|
/** @type {?} */
|
|
3739
3911
|
const baseEvent = makeAnimationEvent(element, entry.triggerName, entry.fromState.value, entry.toState.value);
|
|
3740
|
-
(/** @type {?} */ (baseEvent))['_data'] = microtaskId;
|
|
3912
|
+
((/** @type {?} */ (baseEvent)))['_data'] = microtaskId;
|
|
3741
3913
|
listenOnPlayer(entry.player, listener.phase, baseEvent, listener.callback);
|
|
3742
3914
|
}
|
|
3743
3915
|
});
|
|
@@ -3755,6 +3927,8 @@ class AnimationTransitionNamespace {
|
|
|
3755
3927
|
});
|
|
3756
3928
|
this._queue = [];
|
|
3757
3929
|
return instructions.sort((a, b) => {
|
|
3930
|
+
// if depCount == 0 them move to front
|
|
3931
|
+
// otherwise if a contains b then move back
|
|
3758
3932
|
/** @type {?} */
|
|
3759
3933
|
const d0 = a.transition.ast.depCount;
|
|
3760
3934
|
/** @type {?} */
|
|
@@ -3812,6 +3986,7 @@ class TransitionAnimationEngine {
|
|
|
3812
3986
|
this.namespacesByHostElement = new Map();
|
|
3813
3987
|
this.collectedEnterElements = [];
|
|
3814
3988
|
this.collectedLeaveElements = [];
|
|
3989
|
+
// this method is designed to be overridden by the code that uses this engine
|
|
3815
3990
|
this.onRemovalComplete = (element, context) => { };
|
|
3816
3991
|
}
|
|
3817
3992
|
/**
|
|
@@ -3862,6 +4037,7 @@ class TransitionAnimationEngine {
|
|
|
3862
4037
|
return this._namespaceLookup[namespaceId] = ns;
|
|
3863
4038
|
}
|
|
3864
4039
|
/**
|
|
4040
|
+
* @private
|
|
3865
4041
|
* @param {?} ns
|
|
3866
4042
|
* @param {?} hostElement
|
|
3867
4043
|
* @return {?}
|
|
@@ -3939,6 +4115,7 @@ class TransitionAnimationEngine {
|
|
|
3939
4115
|
this.afterFlushAnimationsDone(() => ns.destroy(context));
|
|
3940
4116
|
}
|
|
3941
4117
|
/**
|
|
4118
|
+
* @private
|
|
3942
4119
|
* @param {?} id
|
|
3943
4120
|
* @return {?}
|
|
3944
4121
|
*/
|
|
@@ -3948,6 +4125,11 @@ class TransitionAnimationEngine {
|
|
|
3948
4125
|
* @return {?}
|
|
3949
4126
|
*/
|
|
3950
4127
|
fetchNamespacesByElement(element) {
|
|
4128
|
+
// normally there should only be one namespace per element, however
|
|
4129
|
+
// if @triggers are placed on both the component element and then
|
|
4130
|
+
// its host element (within the component code) then there will be
|
|
4131
|
+
// two namespaces returned. We use a set here to simply the dedupe
|
|
4132
|
+
// of namespaces incase there are multiple triggers both the elm and host
|
|
3951
4133
|
/** @type {?} */
|
|
3952
4134
|
const namespaces = new Set();
|
|
3953
4135
|
/** @type {?} */
|
|
@@ -3997,8 +4179,10 @@ class TransitionAnimationEngine {
|
|
|
3997
4179
|
insertNode(namespaceId, element, parent, insertBefore) {
|
|
3998
4180
|
if (!isElementNode(element))
|
|
3999
4181
|
return;
|
|
4182
|
+
// special case for when an element is removed and reinserted (move operation)
|
|
4183
|
+
// when this occurs we do not want to use the element for deletion later
|
|
4000
4184
|
/** @type {?} */
|
|
4001
|
-
const details = /** @type {?} */ (element[REMOVAL_FLAG]);
|
|
4185
|
+
const details = (/** @type {?} */ (element[REMOVAL_FLAG]));
|
|
4002
4186
|
if (details && details.setForRemoval) {
|
|
4003
4187
|
details.setForRemoval = false;
|
|
4004
4188
|
details.setForMove = true;
|
|
@@ -4101,6 +4285,7 @@ class TransitionAnimationEngine {
|
|
|
4101
4285
|
return () => { };
|
|
4102
4286
|
}
|
|
4103
4287
|
/**
|
|
4288
|
+
* @private
|
|
4104
4289
|
* @param {?} entry
|
|
4105
4290
|
* @param {?} subTimelines
|
|
4106
4291
|
* @param {?} enterClassName
|
|
@@ -4175,7 +4360,7 @@ class TransitionAnimationEngine {
|
|
|
4175
4360
|
*/
|
|
4176
4361
|
processLeaveNode(element) {
|
|
4177
4362
|
/** @type {?} */
|
|
4178
|
-
const details = /** @type {?} */ (element[REMOVAL_FLAG]);
|
|
4363
|
+
const details = (/** @type {?} */ (element[REMOVAL_FLAG]));
|
|
4179
4364
|
if (details && details.setForRemoval) {
|
|
4180
4365
|
// this will prevent it from removing it twice
|
|
4181
4366
|
element[REMOVAL_FLAG] = NULL_REMOVAL_STATE;
|
|
@@ -4193,7 +4378,7 @@ class TransitionAnimationEngine {
|
|
|
4193
4378
|
this.markElementAsDisabled(element, false);
|
|
4194
4379
|
}
|
|
4195
4380
|
this.driver.query(element, DISABLED_SELECTOR, true).forEach(node => {
|
|
4196
|
-
this.markElementAsDisabled(
|
|
4381
|
+
this.markElementAsDisabled(node, false);
|
|
4197
4382
|
});
|
|
4198
4383
|
}
|
|
4199
4384
|
/**
|
|
@@ -4240,6 +4425,9 @@ class TransitionAnimationEngine {
|
|
|
4240
4425
|
this._flushFns.forEach(fn => fn());
|
|
4241
4426
|
this._flushFns = [];
|
|
4242
4427
|
if (this._whenQuietFns.length) {
|
|
4428
|
+
// we move these over to a variable so that
|
|
4429
|
+
// if any new callbacks are registered in another
|
|
4430
|
+
// flush they do not populate the existing set
|
|
4243
4431
|
/** @type {?} */
|
|
4244
4432
|
const quietFns = this._whenQuietFns;
|
|
4245
4433
|
this._whenQuietFns = [];
|
|
@@ -4259,6 +4447,7 @@ class TransitionAnimationEngine {
|
|
|
4259
4447
|
throw new Error(`Unable to process animations due to the following failed trigger transitions\n ${errors.join('\n')}`);
|
|
4260
4448
|
}
|
|
4261
4449
|
/**
|
|
4450
|
+
* @private
|
|
4262
4451
|
* @param {?} cleanupFns
|
|
4263
4452
|
* @param {?} microtaskId
|
|
4264
4453
|
* @return {?}
|
|
@@ -4294,6 +4483,9 @@ class TransitionAnimationEngine {
|
|
|
4294
4483
|
const allTriggerElements = Array.from(this.statesByElement.keys());
|
|
4295
4484
|
/** @type {?} */
|
|
4296
4485
|
const enterNodeMap = buildRootMap(allTriggerElements, this.collectedEnterElements);
|
|
4486
|
+
// this must occur before the instructions are built below such that
|
|
4487
|
+
// the :enter queries match the elements (since the timeline queries
|
|
4488
|
+
// are fired during instruction building).
|
|
4297
4489
|
/** @type {?} */
|
|
4298
4490
|
const enterNodeMapIds = new Map();
|
|
4299
4491
|
/** @type {?} */
|
|
@@ -4314,7 +4506,7 @@ class TransitionAnimationEngine {
|
|
|
4314
4506
|
/** @type {?} */
|
|
4315
4507
|
const element = this.collectedLeaveElements[i];
|
|
4316
4508
|
/** @type {?} */
|
|
4317
|
-
const details = /** @type {?} */ (element[REMOVAL_FLAG]);
|
|
4509
|
+
const details = (/** @type {?} */ (element[REMOVAL_FLAG]));
|
|
4318
4510
|
if (details && details.setForRemoval) {
|
|
4319
4511
|
allLeaveNodes.push(element);
|
|
4320
4512
|
mergedLeaveNodes.add(element);
|
|
@@ -4339,12 +4531,12 @@ class TransitionAnimationEngine {
|
|
|
4339
4531
|
cleanupFns.push(() => {
|
|
4340
4532
|
enterNodeMap.forEach((nodes, root) => {
|
|
4341
4533
|
/** @type {?} */
|
|
4342
|
-
const className = /** @type {?} */ (
|
|
4534
|
+
const className = (/** @type {?} */ (enterNodeMapIds.get(root)));
|
|
4343
4535
|
nodes.forEach(node => removeClass(node, className));
|
|
4344
4536
|
});
|
|
4345
4537
|
leaveNodeMap.forEach((nodes, root) => {
|
|
4346
4538
|
/** @type {?} */
|
|
4347
|
-
const className = /** @type {?} */ (
|
|
4539
|
+
const className = (/** @type {?} */ (leaveNodeMapIds.get(root)));
|
|
4348
4540
|
nodes.forEach(node => removeClass(node, className));
|
|
4349
4541
|
});
|
|
4350
4542
|
allLeaveNodes.forEach(element => { this.processLeaveNode(element); });
|
|
@@ -4364,7 +4556,7 @@ class TransitionAnimationEngine {
|
|
|
4364
4556
|
allPlayers.push(player);
|
|
4365
4557
|
if (this.collectedEnterElements.length) {
|
|
4366
4558
|
/** @type {?} */
|
|
4367
|
-
const details = /** @type {?} */ (element[REMOVAL_FLAG]);
|
|
4559
|
+
const details = (/** @type {?} */ (element[REMOVAL_FLAG]));
|
|
4368
4560
|
// move animations are currently not supported...
|
|
4369
4561
|
if (details && details.setForMove) {
|
|
4370
4562
|
player.destroy();
|
|
@@ -4374,11 +4566,11 @@ class TransitionAnimationEngine {
|
|
|
4374
4566
|
/** @type {?} */
|
|
4375
4567
|
const nodeIsOrphaned = !bodyNode || !this.driver.containsElement(bodyNode, element);
|
|
4376
4568
|
/** @type {?} */
|
|
4377
|
-
const leaveClassName = /** @type {?} */ (
|
|
4569
|
+
const leaveClassName = (/** @type {?} */ (leaveNodeMapIds.get(element)));
|
|
4378
4570
|
/** @type {?} */
|
|
4379
|
-
const enterClassName = /** @type {?} */ (
|
|
4571
|
+
const enterClassName = (/** @type {?} */ (enterNodeMapIds.get(element)));
|
|
4380
4572
|
/** @type {?} */
|
|
4381
|
-
const instruction = /** @type {?} */ (
|
|
4573
|
+
const instruction = (/** @type {?} */ (this._buildInstruction(entry, subTimelines, enterClassName, leaveClassName, nodeIsOrphaned)));
|
|
4382
4574
|
if (instruction.errors && instruction.errors.length) {
|
|
4383
4575
|
erroneousTransitions.push(instruction);
|
|
4384
4576
|
return;
|
|
@@ -4417,7 +4609,7 @@ class TransitionAnimationEngine {
|
|
|
4417
4609
|
const props = Object.keys(stringMap);
|
|
4418
4610
|
if (props.length) {
|
|
4419
4611
|
/** @type {?} */
|
|
4420
|
-
let setVal = /** @type {?} */ (
|
|
4612
|
+
let setVal = (/** @type {?} */ (allPreStyleElements.get(element)));
|
|
4421
4613
|
if (!setVal) {
|
|
4422
4614
|
allPreStyleElements.set(element, setVal = new Set());
|
|
4423
4615
|
}
|
|
@@ -4428,7 +4620,7 @@ class TransitionAnimationEngine {
|
|
|
4428
4620
|
/** @type {?} */
|
|
4429
4621
|
const props = Object.keys(stringMap);
|
|
4430
4622
|
/** @type {?} */
|
|
4431
|
-
let setVal = /** @type {?} */ (
|
|
4623
|
+
let setVal = (/** @type {?} */ (allPostStyleElements.get(element)));
|
|
4432
4624
|
if (!setVal) {
|
|
4433
4625
|
allPostStyleElements.set(element, setVal = new Set());
|
|
4434
4626
|
}
|
|
@@ -4440,14 +4632,18 @@ class TransitionAnimationEngine {
|
|
|
4440
4632
|
/** @type {?} */
|
|
4441
4633
|
const errors = [];
|
|
4442
4634
|
erroneousTransitions.forEach(instruction => {
|
|
4443
|
-
errors.push(`@${instruction.triggerName} has failed due to:\n`);
|
|
4444
|
-
((instruction.errors)).forEach(error => errors.push(`- ${error}\n`));
|
|
4635
|
+
errors.push(`@${instruction.triggerName} has failed due to:\n`);
|
|
4636
|
+
(/** @type {?} */ (instruction.errors)).forEach(error => errors.push(`- ${error}\n`));
|
|
4445
4637
|
});
|
|
4446
4638
|
allPlayers.forEach(player => player.destroy());
|
|
4447
4639
|
this.reportError(errors);
|
|
4448
4640
|
}
|
|
4449
4641
|
/** @type {?} */
|
|
4450
4642
|
const allPreviousPlayersMap = new Map();
|
|
4643
|
+
// this map works to tell which element in the DOM tree is contained by
|
|
4644
|
+
// which animation. Further down below this map will get populated once
|
|
4645
|
+
// the players are built and in doing so it can efficiently figure out
|
|
4646
|
+
// if a sub player is skipped due to a parent player having priority.
|
|
4451
4647
|
/** @type {?} */
|
|
4452
4648
|
const animationElementMap = new Map();
|
|
4453
4649
|
queuedInstructions.forEach(entry => {
|
|
@@ -4468,10 +4664,18 @@ class TransitionAnimationEngine {
|
|
|
4468
4664
|
prevPlayer.destroy();
|
|
4469
4665
|
});
|
|
4470
4666
|
});
|
|
4667
|
+
// this is a special case for nodes that will be removed (either by)
|
|
4668
|
+
// having their own leave animations or by being queried in a container
|
|
4669
|
+
// that will be removed once a parent animation is complete. The idea
|
|
4670
|
+
// here is that * styles must be identical to ! styles because of
|
|
4671
|
+
// backwards compatibility (* is also filled in by default in many places).
|
|
4672
|
+
// Otherwise * styles will return an empty value or auto since the element
|
|
4673
|
+
// that is being getComputedStyle'd will not be visible (since * = destination)
|
|
4471
4674
|
/** @type {?} */
|
|
4472
4675
|
const replaceNodes = allLeaveNodes.filter(node => {
|
|
4473
4676
|
return replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements);
|
|
4474
4677
|
});
|
|
4678
|
+
// POST STAGE: fill the * styles
|
|
4475
4679
|
/** @type {?} */
|
|
4476
4680
|
const postStylesMap = new Map();
|
|
4477
4681
|
/** @type {?} */
|
|
@@ -4481,6 +4685,7 @@ class TransitionAnimationEngine {
|
|
|
4481
4685
|
replaceNodes.push(node);
|
|
4482
4686
|
}
|
|
4483
4687
|
});
|
|
4688
|
+
// PRE STAGE: fill the ! styles
|
|
4484
4689
|
/** @type {?} */
|
|
4485
4690
|
const preStylesMap = new Map();
|
|
4486
4691
|
enterNodeMap.forEach((nodes, root) => {
|
|
@@ -4491,7 +4696,7 @@ class TransitionAnimationEngine {
|
|
|
4491
4696
|
const post = postStylesMap.get(node);
|
|
4492
4697
|
/** @type {?} */
|
|
4493
4698
|
const pre = preStylesMap.get(node);
|
|
4494
|
-
postStylesMap.set(node, /** @type {?} */ (Object.assign({}, post, pre)));
|
|
4699
|
+
postStylesMap.set(node, (/** @type {?} */ (Object.assign({}, post, pre))));
|
|
4495
4700
|
});
|
|
4496
4701
|
/** @type {?} */
|
|
4497
4702
|
const rootPlayers = [];
|
|
@@ -4511,6 +4716,12 @@ class TransitionAnimationEngine {
|
|
|
4511
4716
|
skippedPlayers.push(player);
|
|
4512
4717
|
return;
|
|
4513
4718
|
}
|
|
4719
|
+
// this will flow up the DOM and query the map to figure out
|
|
4720
|
+
// if a parent animation has priority over it. In the situation
|
|
4721
|
+
// that a parent is detected then it will cancel the loop. If
|
|
4722
|
+
// nothing is detected, or it takes a few hops to find a parent,
|
|
4723
|
+
// then it will fill in the missing nodes and signal them as having
|
|
4724
|
+
// a detected parent (or a NO_PARENT value via a special constant).
|
|
4514
4725
|
/** @type {?} */
|
|
4515
4726
|
let parentWithAnimation = NO_PARENT_ANIMATION_ELEMENT_DETECTED;
|
|
4516
4727
|
if (animationElementMap.size > 1) {
|
|
@@ -4558,6 +4769,8 @@ class TransitionAnimationEngine {
|
|
|
4558
4769
|
});
|
|
4559
4770
|
// find all of the sub players' corresponding inner animation player
|
|
4560
4771
|
subPlayers.forEach(player => {
|
|
4772
|
+
// even if any players are not found for a sub animation then it
|
|
4773
|
+
// will still complete itself after the next tick since it's Noop
|
|
4561
4774
|
/** @type {?} */
|
|
4562
4775
|
const playersForElement = skippedPlayersMap.get(player.element);
|
|
4563
4776
|
if (playersForElement && playersForElement.length) {
|
|
@@ -4584,7 +4797,7 @@ class TransitionAnimationEngine {
|
|
|
4584
4797
|
/** @type {?} */
|
|
4585
4798
|
const element = allLeaveNodes[i];
|
|
4586
4799
|
/** @type {?} */
|
|
4587
|
-
const details = /** @type {?} */ (element[REMOVAL_FLAG]);
|
|
4800
|
+
const details = (/** @type {?} */ (element[REMOVAL_FLAG]));
|
|
4588
4801
|
removeClass(element, LEAVE_CLASSNAME);
|
|
4589
4802
|
// this means the element has a removal animation that is being
|
|
4590
4803
|
// taken care of and therefore the inner elements will hang around
|
|
@@ -4644,7 +4857,7 @@ class TransitionAnimationEngine {
|
|
|
4644
4857
|
/** @type {?} */
|
|
4645
4858
|
let containsData = false;
|
|
4646
4859
|
/** @type {?} */
|
|
4647
|
-
const details = /** @type {?} */ (element[REMOVAL_FLAG]);
|
|
4860
|
+
const details = (/** @type {?} */ (element[REMOVAL_FLAG]));
|
|
4648
4861
|
if (details && details.setForRemoval)
|
|
4649
4862
|
containsData = true;
|
|
4650
4863
|
if (this.playersByElement.has(element))
|
|
@@ -4666,6 +4879,7 @@ class TransitionAnimationEngine {
|
|
|
4666
4879
|
*/
|
|
4667
4880
|
afterFlushAnimationsDone(callback) { this._whenQuietFns.push(callback); }
|
|
4668
4881
|
/**
|
|
4882
|
+
* @private
|
|
4669
4883
|
* @param {?} element
|
|
4670
4884
|
* @param {?} isQueriedElement
|
|
4671
4885
|
* @param {?=} namespaceId
|
|
@@ -4710,6 +4924,7 @@ class TransitionAnimationEngine {
|
|
|
4710
4924
|
return players;
|
|
4711
4925
|
}
|
|
4712
4926
|
/**
|
|
4927
|
+
* @private
|
|
4713
4928
|
* @param {?} namespaceId
|
|
4714
4929
|
* @param {?} instruction
|
|
4715
4930
|
* @param {?} allPreviousPlayersMap
|
|
@@ -4720,6 +4935,8 @@ class TransitionAnimationEngine {
|
|
|
4720
4935
|
const triggerName = instruction.triggerName;
|
|
4721
4936
|
/** @type {?} */
|
|
4722
4937
|
const rootElement = instruction.element;
|
|
4938
|
+
// when a removal animation occurs, ALL previous players are collected
|
|
4939
|
+
// and destroyed (even if they are outside of the current namespace)
|
|
4723
4940
|
/** @type {?} */
|
|
4724
4941
|
const targetNameSpaceId = instruction.isRemovalTransition ? undefined : namespaceId;
|
|
4725
4942
|
/** @type {?} */
|
|
@@ -4735,7 +4952,7 @@ class TransitionAnimationEngine {
|
|
|
4735
4952
|
const previousPlayers = this._getPreviousPlayers(element, isQueriedElement, targetNameSpaceId, targetTriggerName, instruction.toState);
|
|
4736
4953
|
previousPlayers.forEach(player => {
|
|
4737
4954
|
/** @type {?} */
|
|
4738
|
-
const realPlayer = /** @type {?} */ (player.getRealPlayer());
|
|
4955
|
+
const realPlayer = (/** @type {?} */ (player.getRealPlayer()));
|
|
4739
4956
|
if (realPlayer.beforeDestroy) {
|
|
4740
4957
|
realPlayer.beforeDestroy();
|
|
4741
4958
|
}
|
|
@@ -4748,6 +4965,7 @@ class TransitionAnimationEngine {
|
|
|
4748
4965
|
eraseStyles(rootElement, instruction.fromStyles);
|
|
4749
4966
|
}
|
|
4750
4967
|
/**
|
|
4968
|
+
* @private
|
|
4751
4969
|
* @param {?} namespaceId
|
|
4752
4970
|
* @param {?} instruction
|
|
4753
4971
|
* @param {?} allPreviousPlayersMap
|
|
@@ -4761,6 +4979,8 @@ class TransitionAnimationEngine {
|
|
|
4761
4979
|
const triggerName = instruction.triggerName;
|
|
4762
4980
|
/** @type {?} */
|
|
4763
4981
|
const rootElement = instruction.element;
|
|
4982
|
+
// we first run this so that the previous animation player
|
|
4983
|
+
// data can be passed into the successive animation players
|
|
4764
4984
|
/** @type {?} */
|
|
4765
4985
|
const allQueriedPlayers = [];
|
|
4766
4986
|
/** @type {?} */
|
|
@@ -4772,6 +4992,7 @@ class TransitionAnimationEngine {
|
|
|
4772
4992
|
/** @type {?} */
|
|
4773
4993
|
const element = timelineInstruction.element;
|
|
4774
4994
|
allConsumedElements.add(element);
|
|
4995
|
+
// FIXME (matsko): make sure to-be-removed animations are removed properly
|
|
4775
4996
|
/** @type {?} */
|
|
4776
4997
|
const details = element[REMOVAL_FLAG];
|
|
4777
4998
|
if (details && details.removedBeforeQueried)
|
|
@@ -4782,8 +5003,12 @@ class TransitionAnimationEngine {
|
|
|
4782
5003
|
const previousPlayers = flattenGroupPlayers((allPreviousPlayersMap.get(element) || EMPTY_PLAYER_ARRAY)
|
|
4783
5004
|
.map(p => p.getRealPlayer()))
|
|
4784
5005
|
.filter(p => {
|
|
5006
|
+
// the `element` is not apart of the AnimationPlayer definition, but
|
|
5007
|
+
// Mock/WebAnimations
|
|
5008
|
+
// use the element within their implementation. This will be added in Angular5 to
|
|
5009
|
+
// AnimationPlayer
|
|
4785
5010
|
/** @type {?} */
|
|
4786
|
-
const pp = /** @type {?} */ (p);
|
|
5011
|
+
const pp = (/** @type {?} */ (p));
|
|
4787
5012
|
return pp.element ? pp.element === element : false;
|
|
4788
5013
|
});
|
|
4789
5014
|
/** @type {?} */
|
|
@@ -4824,6 +5049,7 @@ class TransitionAnimationEngine {
|
|
|
4824
5049
|
return player;
|
|
4825
5050
|
}
|
|
4826
5051
|
/**
|
|
5052
|
+
* @private
|
|
4827
5053
|
* @param {?} instruction
|
|
4828
5054
|
* @param {?} keyframes
|
|
4829
5055
|
* @param {?} previousPlayers
|
|
@@ -4871,7 +5097,7 @@ class TransitionAnimationPlayer {
|
|
|
4871
5097
|
this._queuedCallbacks = {};
|
|
4872
5098
|
this._containsRealPlayer = true;
|
|
4873
5099
|
this.overrideTotalTime(player.totalTime);
|
|
4874
|
-
(/** @type {?} */ (this)).queued = false;
|
|
5100
|
+
((/** @type {?} */ (this))).queued = false;
|
|
4875
5101
|
}
|
|
4876
5102
|
/**
|
|
4877
5103
|
* @return {?}
|
|
@@ -4881,21 +5107,22 @@ class TransitionAnimationPlayer {
|
|
|
4881
5107
|
* @param {?} totalTime
|
|
4882
5108
|
* @return {?}
|
|
4883
5109
|
*/
|
|
4884
|
-
overrideTotalTime(totalTime) { (/** @type {?} */ (this)).totalTime = totalTime; }
|
|
5110
|
+
overrideTotalTime(totalTime) { ((/** @type {?} */ (this))).totalTime = totalTime; }
|
|
4885
5111
|
/**
|
|
4886
5112
|
* @param {?} player
|
|
4887
5113
|
* @return {?}
|
|
4888
5114
|
*/
|
|
4889
5115
|
syncPlayerEvents(player) {
|
|
4890
5116
|
/** @type {?} */
|
|
4891
|
-
const p = /** @type {?} */ (this._player);
|
|
5117
|
+
const p = (/** @type {?} */ (this._player));
|
|
4892
5118
|
if (p.triggerCallback) {
|
|
4893
|
-
player.onStart(() => /** @type {?} */ (
|
|
5119
|
+
player.onStart(() => (/** @type {?} */ (p.triggerCallback))('start'));
|
|
4894
5120
|
}
|
|
4895
5121
|
player.onDone(() => this.finish());
|
|
4896
5122
|
player.onDestroy(() => this.destroy());
|
|
4897
5123
|
}
|
|
4898
5124
|
/**
|
|
5125
|
+
* @private
|
|
4899
5126
|
* @param {?} name
|
|
4900
5127
|
* @param {?} callback
|
|
4901
5128
|
* @return {?}
|
|
@@ -4961,7 +5188,7 @@ class TransitionAnimationPlayer {
|
|
|
4961
5188
|
* @return {?}
|
|
4962
5189
|
*/
|
|
4963
5190
|
destroy() {
|
|
4964
|
-
(/** @type {?} */ (this)).destroyed = true;
|
|
5191
|
+
((/** @type {?} */ (this))).destroyed = true;
|
|
4965
5192
|
this._player.destroy();
|
|
4966
5193
|
}
|
|
4967
5194
|
/**
|
|
@@ -4988,7 +5215,7 @@ class TransitionAnimationPlayer {
|
|
|
4988
5215
|
*/
|
|
4989
5216
|
triggerCallback(phaseName) {
|
|
4990
5217
|
/** @type {?} */
|
|
4991
|
-
const p = /** @type {?} */ (this._player);
|
|
5218
|
+
const p = (/** @type {?} */ (this._player));
|
|
4992
5219
|
if (p.triggerCallback) {
|
|
4993
5220
|
p.triggerCallback(phaseName);
|
|
4994
5221
|
}
|
|
@@ -5095,11 +5322,23 @@ function cloakAndComputeStyles(valuesMap, driver, elements, elementPropsMap, def
|
|
|
5095
5322
|
});
|
|
5096
5323
|
valuesMap.set(element, styles);
|
|
5097
5324
|
});
|
|
5325
|
+
// we use a index variable here since Set.forEach(a, i) does not return
|
|
5326
|
+
// an index value for the closure (but instead just the value)
|
|
5098
5327
|
/** @type {?} */
|
|
5099
5328
|
let i = 0;
|
|
5100
5329
|
elements.forEach(element => cloakElement(element, cloakVals[i++]));
|
|
5101
5330
|
return failedElements;
|
|
5102
5331
|
}
|
|
5332
|
+
/*
|
|
5333
|
+
Since the Angular renderer code will return a collection of inserted
|
|
5334
|
+
nodes in all areas of a DOM tree, it's up to this algorithm to figure
|
|
5335
|
+
out which nodes are roots for each animation @trigger.
|
|
5336
|
+
|
|
5337
|
+
By placing each inserted node into a Set and traversing upwards, it
|
|
5338
|
+
is possible to find the @trigger elements and well any direct *star
|
|
5339
|
+
insertion nodes, if a @trigger root is found then the enter element
|
|
5340
|
+
is placed into the Map[@trigger] spot.
|
|
5341
|
+
*/
|
|
5103
5342
|
/**
|
|
5104
5343
|
* @param {?} roots
|
|
5105
5344
|
* @param {?} nodes
|
|
@@ -5131,15 +5370,12 @@ function buildRootMap(roots, nodes) {
|
|
|
5131
5370
|
/** @type {?} */
|
|
5132
5371
|
const parent = node.parentNode;
|
|
5133
5372
|
if (rootMap.has(parent)) { // ngIf inside @trigger
|
|
5134
|
-
// ngIf inside @trigger
|
|
5135
5373
|
root = parent;
|
|
5136
5374
|
}
|
|
5137
5375
|
else if (nodeSet.has(parent)) { // ngIf inside ngIf
|
|
5138
|
-
// ngIf inside ngIf
|
|
5139
5376
|
root = NULL_NODE;
|
|
5140
5377
|
}
|
|
5141
5378
|
else { // recurse upwards
|
|
5142
|
-
// recurse upwards
|
|
5143
5379
|
root = getRoot(parent);
|
|
5144
5380
|
}
|
|
5145
5381
|
localRootMap.set(node, root);
|
|
@@ -5149,7 +5385,7 @@ function buildRootMap(roots, nodes) {
|
|
|
5149
5385
|
/** @type {?} */
|
|
5150
5386
|
const root = getRoot(node);
|
|
5151
5387
|
if (root !== NULL_NODE) {
|
|
5152
|
-
/** @type {?} */ (
|
|
5388
|
+
(/** @type {?} */ (rootMap.get(root))).push(node);
|
|
5153
5389
|
}
|
|
5154
5390
|
});
|
|
5155
5391
|
return rootMap;
|
|
@@ -5223,7 +5459,7 @@ function _flattenGroupPlayersRecur(players, finalPlayers) {
|
|
|
5223
5459
|
_flattenGroupPlayersRecur(player.players, finalPlayers);
|
|
5224
5460
|
}
|
|
5225
5461
|
else {
|
|
5226
|
-
finalPlayers.push(/** @type {?} */ (player));
|
|
5462
|
+
finalPlayers.push((/** @type {?} */ (player)));
|
|
5227
5463
|
}
|
|
5228
5464
|
}
|
|
5229
5465
|
}
|
|
@@ -5261,7 +5497,7 @@ function replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElemen
|
|
|
5261
5497
|
/** @type {?} */
|
|
5262
5498
|
let preEntry = allPreStyleElements.get(element);
|
|
5263
5499
|
if (preEntry) {
|
|
5264
|
-
postEntry.forEach(data => /** @type {?} */ (
|
|
5500
|
+
postEntry.forEach(data => (/** @type {?} */ (preEntry)).add(data));
|
|
5265
5501
|
}
|
|
5266
5502
|
else {
|
|
5267
5503
|
allPreStyleElements.set(element, postEntry);
|
|
@@ -5272,7 +5508,7 @@ function replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElemen
|
|
|
5272
5508
|
|
|
5273
5509
|
/**
|
|
5274
5510
|
* @fileoverview added by tsickle
|
|
5275
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
5511
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5276
5512
|
*/
|
|
5277
5513
|
class AnimationEngine {
|
|
5278
5514
|
/**
|
|
@@ -5284,6 +5520,7 @@ class AnimationEngine {
|
|
|
5284
5520
|
this.bodyNode = bodyNode;
|
|
5285
5521
|
this._driver = _driver;
|
|
5286
5522
|
this._triggerCache = {};
|
|
5523
|
+
// this method is designed to be overridden by the code that uses this engine
|
|
5287
5524
|
this.onRemovalComplete = (element, context) => { };
|
|
5288
5525
|
this._transitionEngine = new TransitionAnimationEngine(bodyNode, _driver, normalizer);
|
|
5289
5526
|
this._timelineEngine = new TimelineAnimationEngine(bodyNode, _driver, normalizer);
|
|
@@ -5306,7 +5543,7 @@ class AnimationEngine {
|
|
|
5306
5543
|
/** @type {?} */
|
|
5307
5544
|
const errors = [];
|
|
5308
5545
|
/** @type {?} */
|
|
5309
|
-
const ast = /** @type {?} */ (buildAnimationAst(this._driver, /** @type {?} */ (metadata), errors));
|
|
5546
|
+
const ast = (/** @type {?} */ (buildAnimationAst(this._driver, (/** @type {?} */ (metadata)), errors)));
|
|
5310
5547
|
if (errors.length) {
|
|
5311
5548
|
throw new Error(`The animation trigger "${name}" has failed to build due to the following errors:\n - ${errors.join("\n - ")}`);
|
|
5312
5549
|
}
|
|
@@ -5369,7 +5606,7 @@ class AnimationEngine {
|
|
|
5369
5606
|
if (property.charAt(0) == '@') {
|
|
5370
5607
|
const [id, action] = parseTimelineCommand(property);
|
|
5371
5608
|
/** @type {?} */
|
|
5372
|
-
const args = /** @type {?} */ (value);
|
|
5609
|
+
const args = (/** @type {?} */ (value));
|
|
5373
5610
|
this._timelineEngine.command(id, element, action, args);
|
|
5374
5611
|
}
|
|
5375
5612
|
else {
|
|
@@ -5401,8 +5638,8 @@ class AnimationEngine {
|
|
|
5401
5638
|
* @return {?}
|
|
5402
5639
|
*/
|
|
5403
5640
|
get players() {
|
|
5404
|
-
return (/** @type {?} */ (this._transitionEngine.players))
|
|
5405
|
-
.concat(/** @type {?} */ (this._timelineEngine.players));
|
|
5641
|
+
return ((/** @type {?} */ (this._transitionEngine.players)))
|
|
5642
|
+
.concat((/** @type {?} */ (this._timelineEngine.players)));
|
|
5406
5643
|
}
|
|
5407
5644
|
/**
|
|
5408
5645
|
* @return {?}
|
|
@@ -5412,15 +5649,16 @@ class AnimationEngine {
|
|
|
5412
5649
|
|
|
5413
5650
|
/**
|
|
5414
5651
|
* @fileoverview added by tsickle
|
|
5415
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
5652
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5416
5653
|
*/
|
|
5417
|
-
/**
|
|
5654
|
+
/**
|
|
5418
5655
|
* @license
|
|
5419
5656
|
* Copyright Google Inc. All Rights Reserved.
|
|
5420
5657
|
*
|
|
5421
5658
|
* Use of this source code is governed by an MIT-style license that can be
|
|
5422
5659
|
* found in the LICENSE file at https://angular.io/license
|
|
5423
|
-
|
|
5660
|
+
* @type {?}
|
|
5661
|
+
*/
|
|
5424
5662
|
const ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;
|
|
5425
5663
|
/** @type {?} */
|
|
5426
5664
|
const ANIMATION_PROP = 'animation';
|
|
@@ -5483,6 +5721,7 @@ class ElementAnimationStyleHandler {
|
|
|
5483
5721
|
*/
|
|
5484
5722
|
getPosition() { return this._position; }
|
|
5485
5723
|
/**
|
|
5724
|
+
* @private
|
|
5486
5725
|
* @param {?} event
|
|
5487
5726
|
* @return {?}
|
|
5488
5727
|
*/
|
|
@@ -5651,7 +5890,7 @@ function countChars(value, char) {
|
|
|
5651
5890
|
|
|
5652
5891
|
/**
|
|
5653
5892
|
* @fileoverview added by tsickle
|
|
5654
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
5893
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5655
5894
|
*/
|
|
5656
5895
|
/** @type {?} */
|
|
5657
5896
|
const DEFAULT_FILL_MODE = 'forwards';
|
|
@@ -5714,6 +5953,7 @@ class CssKeyframesPlayer {
|
|
|
5714
5953
|
this._onDestroyFns = [];
|
|
5715
5954
|
}
|
|
5716
5955
|
/**
|
|
5956
|
+
* @private
|
|
5717
5957
|
* @return {?}
|
|
5718
5958
|
*/
|
|
5719
5959
|
_flushDoneFns() {
|
|
@@ -5721,6 +5961,7 @@ class CssKeyframesPlayer {
|
|
|
5721
5961
|
this._onDoneFns = [];
|
|
5722
5962
|
}
|
|
5723
5963
|
/**
|
|
5964
|
+
* @private
|
|
5724
5965
|
* @return {?}
|
|
5725
5966
|
*/
|
|
5726
5967
|
_flushStartFns() {
|
|
@@ -5800,6 +6041,7 @@ class CssKeyframesPlayer {
|
|
|
5800
6041
|
this._styler.apply();
|
|
5801
6042
|
}
|
|
5802
6043
|
/**
|
|
6044
|
+
* @private
|
|
5803
6045
|
* @return {?}
|
|
5804
6046
|
*/
|
|
5805
6047
|
_buildStyler() {
|
|
@@ -5838,7 +6080,7 @@ class CssKeyframesPlayer {
|
|
|
5838
6080
|
|
|
5839
6081
|
/**
|
|
5840
6082
|
* @fileoverview added by tsickle
|
|
5841
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
6083
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5842
6084
|
*/
|
|
5843
6085
|
class DirectStylePlayer extends NoopAnimationPlayer {
|
|
5844
6086
|
/**
|
|
@@ -5860,7 +6102,7 @@ class DirectStylePlayer extends NoopAnimationPlayer {
|
|
|
5860
6102
|
return;
|
|
5861
6103
|
this.__initialized = true;
|
|
5862
6104
|
Object.keys(this._styles).forEach(prop => {
|
|
5863
|
-
/** @type {?} */ (
|
|
6105
|
+
(/** @type {?} */ (this._startingStyles))[prop] = this.element.style[prop];
|
|
5864
6106
|
});
|
|
5865
6107
|
super.init();
|
|
5866
6108
|
}
|
|
@@ -5883,7 +6125,7 @@ class DirectStylePlayer extends NoopAnimationPlayer {
|
|
|
5883
6125
|
return;
|
|
5884
6126
|
Object.keys(this._startingStyles).forEach(prop => {
|
|
5885
6127
|
/** @type {?} */
|
|
5886
|
-
const value = /** @type {?} */ (
|
|
6128
|
+
const value = (/** @type {?} */ (this._startingStyles))[prop];
|
|
5887
6129
|
if (value) {
|
|
5888
6130
|
this.element.style.setProperty(prop, value);
|
|
5889
6131
|
}
|
|
@@ -5898,7 +6140,7 @@ class DirectStylePlayer extends NoopAnimationPlayer {
|
|
|
5898
6140
|
|
|
5899
6141
|
/**
|
|
5900
6142
|
* @fileoverview added by tsickle
|
|
5901
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
6143
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5902
6144
|
*/
|
|
5903
6145
|
/** @type {?} */
|
|
5904
6146
|
const KEYFRAMES_NAME_PREFIX = 'gen_css_kf_';
|
|
@@ -5945,7 +6187,7 @@ class CssKeyframesDriver {
|
|
|
5945
6187
|
* @return {?}
|
|
5946
6188
|
*/
|
|
5947
6189
|
computeStyle(element, prop, defaultValue) {
|
|
5948
|
-
return /** @type {?} */ ((/** @type {?} */ (window.getComputedStyle(element)))[prop]);
|
|
6190
|
+
return (/** @type {?} */ (((/** @type {?} */ (window.getComputedStyle(element))))[prop]));
|
|
5949
6191
|
}
|
|
5950
6192
|
/**
|
|
5951
6193
|
* @param {?} element
|
|
@@ -5962,7 +6204,7 @@ class CssKeyframesDriver {
|
|
|
5962
6204
|
keyframes.forEach(kf => {
|
|
5963
6205
|
tab = TAB_SPACE;
|
|
5964
6206
|
/** @type {?} */
|
|
5965
|
-
const offset = parseFloat(kf
|
|
6207
|
+
const offset = parseFloat(kf.offset);
|
|
5966
6208
|
keyframeStr += `${tab}${offset * 100}% {\n`;
|
|
5967
6209
|
tab += TAB_SPACE;
|
|
5968
6210
|
Object.keys(kf).forEach(prop => {
|
|
@@ -6004,7 +6246,7 @@ class CssKeyframesDriver {
|
|
|
6004
6246
|
this._notifyFaultyScrubber();
|
|
6005
6247
|
}
|
|
6006
6248
|
/** @type {?} */
|
|
6007
|
-
const previousCssKeyframePlayers = /** @type {?} */ (previousPlayers.filter(player => player instanceof CssKeyframesPlayer));
|
|
6249
|
+
const previousCssKeyframePlayers = (/** @type {?} */ (previousPlayers.filter(player => player instanceof CssKeyframesPlayer)));
|
|
6008
6250
|
/** @type {?} */
|
|
6009
6251
|
const previousStyles = {};
|
|
6010
6252
|
if (allowPreviousPlayerStylesMerge(duration, delay)) {
|
|
@@ -6027,14 +6269,15 @@ class CssKeyframesDriver {
|
|
|
6027
6269
|
/** @type {?} */
|
|
6028
6270
|
const animationName = `${KEYFRAMES_NAME_PREFIX}${this._count++}`;
|
|
6029
6271
|
/** @type {?} */
|
|
6030
|
-
const kfElm = this.buildKeyframeElement(element, animationName, keyframes);
|
|
6031
|
-
((document.querySelector('head'))).appendChild(kfElm);
|
|
6272
|
+
const kfElm = this.buildKeyframeElement(element, animationName, keyframes);
|
|
6273
|
+
(/** @type {?} */ (document.querySelector('head'))).appendChild(kfElm);
|
|
6032
6274
|
/** @type {?} */
|
|
6033
6275
|
const player = new CssKeyframesPlayer(element, keyframes, animationName, duration, delay, easing, finalStyles);
|
|
6034
6276
|
player.onDestroy(() => removeElement(kfElm));
|
|
6035
6277
|
return player;
|
|
6036
6278
|
}
|
|
6037
6279
|
/**
|
|
6280
|
+
* @private
|
|
6038
6281
|
* @return {?}
|
|
6039
6282
|
*/
|
|
6040
6283
|
_notifyFaultyScrubber() {
|
|
@@ -6074,7 +6317,7 @@ function removeElement(node) {
|
|
|
6074
6317
|
|
|
6075
6318
|
/**
|
|
6076
6319
|
* @fileoverview added by tsickle
|
|
6077
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
6320
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6078
6321
|
*/
|
|
6079
6322
|
class WebAnimationsPlayer {
|
|
6080
6323
|
/**
|
|
@@ -6096,11 +6339,12 @@ class WebAnimationsPlayer {
|
|
|
6096
6339
|
this.time = 0;
|
|
6097
6340
|
this.parentPlayer = null;
|
|
6098
6341
|
this.currentSnapshot = {};
|
|
6099
|
-
this._duration = /** @type {?} */ (options['duration']);
|
|
6100
|
-
this._delay = /** @type {?} */ (options['delay']) || 0;
|
|
6342
|
+
this._duration = (/** @type {?} */ (options['duration']));
|
|
6343
|
+
this._delay = (/** @type {?} */ (options['delay'])) || 0;
|
|
6101
6344
|
this.time = this._duration + this._delay;
|
|
6102
6345
|
}
|
|
6103
6346
|
/**
|
|
6347
|
+
* @private
|
|
6104
6348
|
* @return {?}
|
|
6105
6349
|
*/
|
|
6106
6350
|
_onFinish() {
|
|
@@ -6118,6 +6362,7 @@ class WebAnimationsPlayer {
|
|
|
6118
6362
|
this._preparePlayerBeforeStart();
|
|
6119
6363
|
}
|
|
6120
6364
|
/**
|
|
6365
|
+
* @private
|
|
6121
6366
|
* @return {?}
|
|
6122
6367
|
*/
|
|
6123
6368
|
_buildPlayer() {
|
|
@@ -6126,12 +6371,13 @@ class WebAnimationsPlayer {
|
|
|
6126
6371
|
this._initialized = true;
|
|
6127
6372
|
/** @type {?} */
|
|
6128
6373
|
const keyframes = this.keyframes;
|
|
6129
|
-
(/** @type {?} */ (this)).domPlayer =
|
|
6374
|
+
((/** @type {?} */ (this))).domPlayer =
|
|
6130
6375
|
this._triggerWebAnimation(this.element, keyframes, this.options);
|
|
6131
6376
|
this._finalKeyframe = keyframes.length ? keyframes[keyframes.length - 1] : {};
|
|
6132
6377
|
this.domPlayer.addEventListener('finish', () => this._onFinish());
|
|
6133
6378
|
}
|
|
6134
6379
|
/**
|
|
6380
|
+
* @private
|
|
6135
6381
|
* @return {?}
|
|
6136
6382
|
*/
|
|
6137
6383
|
_preparePlayerBeforeStart() {
|
|
@@ -6153,7 +6399,7 @@ class WebAnimationsPlayer {
|
|
|
6153
6399
|
_triggerWebAnimation(element, keyframes, options) {
|
|
6154
6400
|
// jscompiler doesn't seem to know animate is a native property because it's not fully
|
|
6155
6401
|
// supported yet across common browsers (we polyfill it for Edge/Safari) [CL #143630929]
|
|
6156
|
-
return /** @type {?} */ (element['animate'](keyframes, options));
|
|
6402
|
+
return (/** @type {?} */ (element['animate'](keyframes, options)));
|
|
6157
6403
|
}
|
|
6158
6404
|
/**
|
|
6159
6405
|
* @param {?} fn
|
|
@@ -6207,6 +6453,7 @@ class WebAnimationsPlayer {
|
|
|
6207
6453
|
this._started = false;
|
|
6208
6454
|
}
|
|
6209
6455
|
/**
|
|
6456
|
+
* @private
|
|
6210
6457
|
* @return {?}
|
|
6211
6458
|
*/
|
|
6212
6459
|
_resetDomPlayerState() {
|
|
@@ -6281,7 +6528,7 @@ class WebAnimationsPlayer {
|
|
|
6281
6528
|
|
|
6282
6529
|
/**
|
|
6283
6530
|
* @fileoverview added by tsickle
|
|
6284
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
6531
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6285
6532
|
*/
|
|
6286
6533
|
class WebAnimationsDriver {
|
|
6287
6534
|
constructor() {
|
|
@@ -6323,7 +6570,7 @@ class WebAnimationsDriver {
|
|
|
6323
6570
|
* @return {?}
|
|
6324
6571
|
*/
|
|
6325
6572
|
computeStyle(element, prop, defaultValue) {
|
|
6326
|
-
return /** @type {?} */ ((/** @type {?} */ (window.getComputedStyle(element)))[prop]);
|
|
6573
|
+
return (/** @type {?} */ (((/** @type {?} */ (window.getComputedStyle(element))))[prop]));
|
|
6327
6574
|
}
|
|
6328
6575
|
/**
|
|
6329
6576
|
* @param {?} supported
|
|
@@ -6358,7 +6605,7 @@ class WebAnimationsDriver {
|
|
|
6358
6605
|
/** @type {?} */
|
|
6359
6606
|
const previousStyles = {};
|
|
6360
6607
|
/** @type {?} */
|
|
6361
|
-
const previousWebAnimationPlayers = /** @type {?} */ (previousPlayers.filter(player => player instanceof WebAnimationsPlayer));
|
|
6608
|
+
const previousWebAnimationPlayers = (/** @type {?} */ (previousPlayers.filter(player => player instanceof WebAnimationsPlayer)));
|
|
6362
6609
|
if (allowPreviousPlayerStylesMerge(duration, delay)) {
|
|
6363
6610
|
previousWebAnimationPlayers.forEach(player => {
|
|
6364
6611
|
/** @type {?} */
|
|
@@ -6381,27 +6628,27 @@ function supportsWebAnimations() {
|
|
|
6381
6628
|
* @return {?}
|
|
6382
6629
|
*/
|
|
6383
6630
|
function getElementAnimateFn() {
|
|
6384
|
-
return (isBrowser() && (/** @type {?} */ (Element)).prototype['animate']) || {};
|
|
6631
|
+
return (isBrowser() && ((/** @type {?} */ (Element))).prototype['animate']) || {};
|
|
6385
6632
|
}
|
|
6386
6633
|
|
|
6387
6634
|
/**
|
|
6388
6635
|
* @fileoverview added by tsickle
|
|
6389
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
6636
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6390
6637
|
*/
|
|
6391
6638
|
|
|
6392
6639
|
/**
|
|
6393
6640
|
* @fileoverview added by tsickle
|
|
6394
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
6641
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6395
6642
|
*/
|
|
6396
6643
|
|
|
6397
6644
|
/**
|
|
6398
6645
|
* @fileoverview added by tsickle
|
|
6399
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
6646
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6400
6647
|
*/
|
|
6401
6648
|
|
|
6402
6649
|
/**
|
|
6403
6650
|
* @fileoverview added by tsickle
|
|
6404
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
6651
|
+
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6405
6652
|
*/
|
|
6406
6653
|
|
|
6407
6654
|
/**
|