@angular/animations 7.2.7 → 7.2.11
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/browser.d.ts +1 -0
- package/browser/browser.metadata.json +1 -1
- package/browser/src/render/css_keyframes/css_keyframes_player.d.ts +3 -1
- package/browser/src/render/special_cased_styles.d.ts +42 -0
- package/browser/src/render/web_animations/web_animations_player.d.ts +3 -1
- package/browser/src/util.d.ts +3 -1
- package/browser/testing.d.ts +1 -1
- package/browser.d.ts +1 -1
- 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 +140 -7
- package/bundles/animations-browser.umd.js.map +1 -1
- package/bundles/animations-browser.umd.min.js +14 -7
- package/bundles/animations-browser.umd.min.js.map +1 -1
- package/bundles/animations.umd.js +1 -1
- package/bundles/animations.umd.min.js +1 -1
- package/bundles/animations.umd.min.js.map +1 -1
- package/esm2015/browser/browser.js +2 -1
- package/esm2015/browser/src/render/css_keyframes/css_keyframes_driver.js +6 -3
- package/esm2015/browser/src/render/css_keyframes/css_keyframes_player.js +18 -4
- package/esm2015/browser/src/render/special_cased_styles.js +177 -0
- package/esm2015/browser/src/render/web_animations/web_animations_driver.js +5 -2
- package/esm2015/browser/src/render/web_animations/web_animations_player.js +18 -2
- package/esm2015/browser/src/util.js +6 -2
- package/esm2015/src/version.js +1 -1
- package/esm5/browser/browser.js +2 -1
- package/esm5/browser/src/render/css_keyframes/css_keyframes_driver.js +5 -3
- package/esm5/browser/src/render/css_keyframes/css_keyframes_player.js +12 -3
- package/esm5/browser/src/render/special_cased_styles.js +109 -0
- package/esm5/browser/src/render/web_animations/web_animations_driver.js +4 -2
- package/esm5/browser/src/render/web_animations/web_animations_player.js +12 -2
- package/esm5/browser/src/util.js +5 -2
- package/esm5/src/version.js +1 -1
- package/fesm2015/animations.js +1 -1
- package/fesm2015/browser/testing.js +1 -1
- package/fesm2015/browser.js +171 -8
- package/fesm2015/browser.js.map +1 -1
- package/fesm5/animations.js +1 -1
- package/fesm5/browser/testing.js +1 -1
- package/fesm5/browser.js +140 -8
- package/fesm5/browser.js.map +1 -1
- package/package.json +2 -2
package/fesm5/animations.js
CHANGED
package/fesm5/browser/testing.js
CHANGED
package/fesm5/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v7.2.
|
|
2
|
+
* @license Angular v7.2.11
|
|
3
3
|
* (c) 2010-2019 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -369,10 +369,13 @@ function writeStyleAttribute(element) {
|
|
|
369
369
|
}
|
|
370
370
|
element.setAttribute('style', styleAttrValue);
|
|
371
371
|
}
|
|
372
|
-
function setStyles(element, styles) {
|
|
372
|
+
function setStyles(element, styles, formerStyles) {
|
|
373
373
|
if (element['style']) {
|
|
374
374
|
Object.keys(styles).forEach(function (prop) {
|
|
375
375
|
var camelProp = dashCaseToCamelCase(prop);
|
|
376
|
+
if (formerStyles && !formerStyles.hasOwnProperty(prop)) {
|
|
377
|
+
formerStyles[prop] = element.style[camelProp];
|
|
378
|
+
}
|
|
376
379
|
element.style[camelProp] = styles[prop];
|
|
377
380
|
});
|
|
378
381
|
// On the server set the 'style' attribute since it's not automatically reflected.
|
|
@@ -3862,6 +3865,113 @@ var AnimationEngine = /** @class */ (function () {
|
|
|
3862
3865
|
return AnimationEngine;
|
|
3863
3866
|
}());
|
|
3864
3867
|
|
|
3868
|
+
/**
|
|
3869
|
+
* @license
|
|
3870
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
3871
|
+
*
|
|
3872
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
3873
|
+
* found in the LICENSE file at https://angular.io/license
|
|
3874
|
+
*/
|
|
3875
|
+
/**
|
|
3876
|
+
* Returns an instance of `SpecialCasedStyles` if and when any special (non animateable) styles are
|
|
3877
|
+
* detected.
|
|
3878
|
+
*
|
|
3879
|
+
* In CSS there exist properties that cannot be animated within a keyframe animation
|
|
3880
|
+
* (whether it be via CSS keyframes or web-animations) and the animation implementation
|
|
3881
|
+
* will ignore them. This function is designed to detect those special cased styles and
|
|
3882
|
+
* return a container that will be executed at the start and end of the animation.
|
|
3883
|
+
*
|
|
3884
|
+
* @returns an instance of `SpecialCasedStyles` if any special styles are detected otherwise `null`
|
|
3885
|
+
*/
|
|
3886
|
+
function packageNonAnimatableStyles(element, styles) {
|
|
3887
|
+
var startStyles = null;
|
|
3888
|
+
var endStyles = null;
|
|
3889
|
+
if (Array.isArray(styles) && styles.length) {
|
|
3890
|
+
startStyles = filterNonAnimatableStyles(styles[0]);
|
|
3891
|
+
if (styles.length > 1) {
|
|
3892
|
+
endStyles = filterNonAnimatableStyles(styles[styles.length - 1]);
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
else if (styles) {
|
|
3896
|
+
startStyles = filterNonAnimatableStyles(styles);
|
|
3897
|
+
}
|
|
3898
|
+
return (startStyles || endStyles) ? new SpecialCasedStyles(element, startStyles, endStyles) :
|
|
3899
|
+
null;
|
|
3900
|
+
}
|
|
3901
|
+
/**
|
|
3902
|
+
* Designed to be executed during a keyframe-based animation to apply any special-cased styles.
|
|
3903
|
+
*
|
|
3904
|
+
* When started (when the `start()` method is run) then the provided `startStyles`
|
|
3905
|
+
* will be applied. When finished (when the `finish()` method is called) the
|
|
3906
|
+
* `endStyles` will be applied as well any any starting styles. Finally when
|
|
3907
|
+
* `destroy()` is called then all styles will be removed.
|
|
3908
|
+
*/
|
|
3909
|
+
var SpecialCasedStyles = /** @class */ (function () {
|
|
3910
|
+
function SpecialCasedStyles(_element, _startStyles, _endStyles) {
|
|
3911
|
+
this._element = _element;
|
|
3912
|
+
this._startStyles = _startStyles;
|
|
3913
|
+
this._endStyles = _endStyles;
|
|
3914
|
+
this._state = 0 /* Pending */;
|
|
3915
|
+
var initialStyles = SpecialCasedStyles.initialStylesByElement.get(_element);
|
|
3916
|
+
if (!initialStyles) {
|
|
3917
|
+
SpecialCasedStyles.initialStylesByElement.set(_element, initialStyles = {});
|
|
3918
|
+
}
|
|
3919
|
+
this._initialStyles = initialStyles;
|
|
3920
|
+
}
|
|
3921
|
+
SpecialCasedStyles.prototype.start = function () {
|
|
3922
|
+
if (this._state < 1 /* Started */) {
|
|
3923
|
+
if (this._startStyles) {
|
|
3924
|
+
setStyles(this._element, this._startStyles, this._initialStyles);
|
|
3925
|
+
}
|
|
3926
|
+
this._state = 1 /* Started */;
|
|
3927
|
+
}
|
|
3928
|
+
};
|
|
3929
|
+
SpecialCasedStyles.prototype.finish = function () {
|
|
3930
|
+
this.start();
|
|
3931
|
+
if (this._state < 2 /* Finished */) {
|
|
3932
|
+
setStyles(this._element, this._initialStyles);
|
|
3933
|
+
if (this._endStyles) {
|
|
3934
|
+
setStyles(this._element, this._endStyles);
|
|
3935
|
+
this._endStyles = null;
|
|
3936
|
+
}
|
|
3937
|
+
this._state = 1 /* Started */;
|
|
3938
|
+
}
|
|
3939
|
+
};
|
|
3940
|
+
SpecialCasedStyles.prototype.destroy = function () {
|
|
3941
|
+
this.finish();
|
|
3942
|
+
if (this._state < 3 /* Destroyed */) {
|
|
3943
|
+
SpecialCasedStyles.initialStylesByElement.delete(this._element);
|
|
3944
|
+
if (this._startStyles) {
|
|
3945
|
+
eraseStyles(this._element, this._startStyles);
|
|
3946
|
+
this._endStyles = null;
|
|
3947
|
+
}
|
|
3948
|
+
if (this._endStyles) {
|
|
3949
|
+
eraseStyles(this._element, this._endStyles);
|
|
3950
|
+
this._endStyles = null;
|
|
3951
|
+
}
|
|
3952
|
+
setStyles(this._element, this._initialStyles);
|
|
3953
|
+
this._state = 3 /* Destroyed */;
|
|
3954
|
+
}
|
|
3955
|
+
};
|
|
3956
|
+
SpecialCasedStyles.initialStylesByElement = new WeakMap();
|
|
3957
|
+
return SpecialCasedStyles;
|
|
3958
|
+
}());
|
|
3959
|
+
function filterNonAnimatableStyles(styles) {
|
|
3960
|
+
var result = null;
|
|
3961
|
+
var props = Object.keys(styles);
|
|
3962
|
+
for (var i = 0; i < props.length; i++) {
|
|
3963
|
+
var prop = props[i];
|
|
3964
|
+
if (isNonAnimatableStyle(prop)) {
|
|
3965
|
+
result = result || {};
|
|
3966
|
+
result[prop] = styles[prop];
|
|
3967
|
+
}
|
|
3968
|
+
}
|
|
3969
|
+
return result;
|
|
3970
|
+
}
|
|
3971
|
+
function isNonAnimatableStyle(prop) {
|
|
3972
|
+
return prop === 'display' || prop === 'position';
|
|
3973
|
+
}
|
|
3974
|
+
|
|
3865
3975
|
/**
|
|
3866
3976
|
* @license
|
|
3867
3977
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -3998,13 +4108,14 @@ function countChars(value, char) {
|
|
|
3998
4108
|
var DEFAULT_FILL_MODE = 'forwards';
|
|
3999
4109
|
var DEFAULT_EASING = 'linear';
|
|
4000
4110
|
var CssKeyframesPlayer = /** @class */ (function () {
|
|
4001
|
-
function CssKeyframesPlayer(element, keyframes, animationName, _duration, _delay, easing, _finalStyles) {
|
|
4111
|
+
function CssKeyframesPlayer(element, keyframes, animationName, _duration, _delay, easing, _finalStyles, _specialStyles) {
|
|
4002
4112
|
this.element = element;
|
|
4003
4113
|
this.keyframes = keyframes;
|
|
4004
4114
|
this.animationName = animationName;
|
|
4005
4115
|
this._duration = _duration;
|
|
4006
4116
|
this._delay = _delay;
|
|
4007
4117
|
this._finalStyles = _finalStyles;
|
|
4118
|
+
this._specialStyles = _specialStyles;
|
|
4008
4119
|
this._onDoneFns = [];
|
|
4009
4120
|
this._onStartFns = [];
|
|
4010
4121
|
this._onDestroyFns = [];
|
|
@@ -4026,6 +4137,9 @@ var CssKeyframesPlayer = /** @class */ (function () {
|
|
|
4026
4137
|
this._styler.destroy();
|
|
4027
4138
|
this._flushStartFns();
|
|
4028
4139
|
this._flushDoneFns();
|
|
4140
|
+
if (this._specialStyles) {
|
|
4141
|
+
this._specialStyles.destroy();
|
|
4142
|
+
}
|
|
4029
4143
|
this._onDestroyFns.forEach(function (fn) { return fn(); });
|
|
4030
4144
|
this._onDestroyFns = [];
|
|
4031
4145
|
};
|
|
@@ -4044,6 +4158,9 @@ var CssKeyframesPlayer = /** @class */ (function () {
|
|
|
4044
4158
|
this._state = 3 /* FINISHED */;
|
|
4045
4159
|
this._styler.finish();
|
|
4046
4160
|
this._flushStartFns();
|
|
4161
|
+
if (this._specialStyles) {
|
|
4162
|
+
this._specialStyles.finish();
|
|
4163
|
+
}
|
|
4047
4164
|
this._flushDoneFns();
|
|
4048
4165
|
};
|
|
4049
4166
|
CssKeyframesPlayer.prototype.setPosition = function (value) { this._styler.setPosition(value); };
|
|
@@ -4064,6 +4181,9 @@ var CssKeyframesPlayer = /** @class */ (function () {
|
|
|
4064
4181
|
if (!this.hasStarted()) {
|
|
4065
4182
|
this._flushStartFns();
|
|
4066
4183
|
this._state = 2 /* STARTED */;
|
|
4184
|
+
if (this._specialStyles) {
|
|
4185
|
+
this._specialStyles.start();
|
|
4186
|
+
}
|
|
4067
4187
|
}
|
|
4068
4188
|
this._styler.resume();
|
|
4069
4189
|
};
|
|
@@ -4180,7 +4300,7 @@ var CssKeyframesDriver = /** @class */ (function () {
|
|
|
4180
4300
|
var tab = '';
|
|
4181
4301
|
keyframes.forEach(function (kf) {
|
|
4182
4302
|
tab = TAB_SPACE;
|
|
4183
|
-
var offset = parseFloat(kf
|
|
4303
|
+
var offset = parseFloat(kf['offset']);
|
|
4184
4304
|
keyframeStr += "" + tab + offset * 100 + "% {\n";
|
|
4185
4305
|
tab += TAB_SPACE;
|
|
4186
4306
|
Object.keys(kf).forEach(function (prop) {
|
|
@@ -4230,7 +4350,8 @@ var CssKeyframesDriver = /** @class */ (function () {
|
|
|
4230
4350
|
var animationName = "" + KEYFRAMES_NAME_PREFIX + this._count++;
|
|
4231
4351
|
var kfElm = this.buildKeyframeElement(element, animationName, keyframes);
|
|
4232
4352
|
document.querySelector('head').appendChild(kfElm);
|
|
4233
|
-
var
|
|
4353
|
+
var specialStyles = packageNonAnimatableStyles(element, keyframes);
|
|
4354
|
+
var player = new CssKeyframesPlayer(element, keyframes, animationName, duration, delay, easing, finalStyles, specialStyles);
|
|
4234
4355
|
player.onDestroy(function () { return removeElement(kfElm); });
|
|
4235
4356
|
return player;
|
|
4236
4357
|
};
|
|
@@ -4261,10 +4382,11 @@ function removeElement(node) {
|
|
|
4261
4382
|
}
|
|
4262
4383
|
|
|
4263
4384
|
var WebAnimationsPlayer = /** @class */ (function () {
|
|
4264
|
-
function WebAnimationsPlayer(element, keyframes, options) {
|
|
4385
|
+
function WebAnimationsPlayer(element, keyframes, options, _specialStyles) {
|
|
4265
4386
|
this.element = element;
|
|
4266
4387
|
this.keyframes = keyframes;
|
|
4267
4388
|
this.options = options;
|
|
4389
|
+
this._specialStyles = _specialStyles;
|
|
4268
4390
|
this._onDoneFns = [];
|
|
4269
4391
|
this._onStartFns = [];
|
|
4270
4392
|
this._onDestroyFns = [];
|
|
@@ -4325,6 +4447,9 @@ var WebAnimationsPlayer = /** @class */ (function () {
|
|
|
4325
4447
|
this._onStartFns.forEach(function (fn) { return fn(); });
|
|
4326
4448
|
this._onStartFns = [];
|
|
4327
4449
|
this._started = true;
|
|
4450
|
+
if (this._specialStyles) {
|
|
4451
|
+
this._specialStyles.start();
|
|
4452
|
+
}
|
|
4328
4453
|
}
|
|
4329
4454
|
this.domPlayer.play();
|
|
4330
4455
|
};
|
|
@@ -4334,6 +4459,9 @@ var WebAnimationsPlayer = /** @class */ (function () {
|
|
|
4334
4459
|
};
|
|
4335
4460
|
WebAnimationsPlayer.prototype.finish = function () {
|
|
4336
4461
|
this.init();
|
|
4462
|
+
if (this._specialStyles) {
|
|
4463
|
+
this._specialStyles.finish();
|
|
4464
|
+
}
|
|
4337
4465
|
this._onFinish();
|
|
4338
4466
|
this.domPlayer.finish();
|
|
4339
4467
|
};
|
|
@@ -4358,6 +4486,9 @@ var WebAnimationsPlayer = /** @class */ (function () {
|
|
|
4358
4486
|
this._destroyed = true;
|
|
4359
4487
|
this._resetDomPlayerState();
|
|
4360
4488
|
this._onFinish();
|
|
4489
|
+
if (this._specialStyles) {
|
|
4490
|
+
this._specialStyles.destroy();
|
|
4491
|
+
}
|
|
4361
4492
|
this._onDestroyFns.forEach(function (fn) { return fn(); });
|
|
4362
4493
|
this._onDestroyFns = [];
|
|
4363
4494
|
}
|
|
@@ -4431,7 +4562,8 @@ var WebAnimationsDriver = /** @class */ (function () {
|
|
|
4431
4562
|
}
|
|
4432
4563
|
keyframes = keyframes.map(function (styles) { return copyStyles(styles, false); });
|
|
4433
4564
|
keyframes = balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles);
|
|
4434
|
-
|
|
4565
|
+
var specialStyles = packageNonAnimatableStyles(element, keyframes);
|
|
4566
|
+
return new WebAnimationsPlayer(element, keyframes, playerOptions, specialStyles);
|
|
4435
4567
|
};
|
|
4436
4568
|
return WebAnimationsDriver;
|
|
4437
4569
|
}());
|
|
@@ -4478,5 +4610,5 @@ function getElementAnimateFn() {
|
|
|
4478
4610
|
* Generated bundle index. Do not edit.
|
|
4479
4611
|
*/
|
|
4480
4612
|
|
|
4481
|
-
export { AnimationDriver, AnimationDriver as ɵAnimationDriver, Animation as ɵAnimation, AnimationStyleNormalizer as ɵAnimationStyleNormalizer, NoopAnimationStyleNormalizer as ɵNoopAnimationStyleNormalizer, WebAnimationsStyleNormalizer as ɵWebAnimationsStyleNormalizer, NoopAnimationDriver as ɵNoopAnimationDriver, AnimationEngine as ɵAnimationEngine, CssKeyframesDriver as ɵCssKeyframesDriver, CssKeyframesPlayer as ɵCssKeyframesPlayer, containsElement as ɵcontainsElement, invokeQuery as ɵinvokeQuery, matchesElement as ɵmatchesElement, validateStyleProperty as ɵvalidateStyleProperty, WebAnimationsDriver as ɵWebAnimationsDriver, supportsWebAnimations as ɵsupportsWebAnimations, WebAnimationsPlayer as ɵWebAnimationsPlayer, allowPreviousPlayerStylesMerge as ɵallowPreviousPlayerStylesMerge };
|
|
4613
|
+
export { SpecialCasedStyles as ɵangular_packages_animations_browser_browser_a, AnimationDriver, AnimationDriver as ɵAnimationDriver, Animation as ɵAnimation, AnimationStyleNormalizer as ɵAnimationStyleNormalizer, NoopAnimationStyleNormalizer as ɵNoopAnimationStyleNormalizer, WebAnimationsStyleNormalizer as ɵWebAnimationsStyleNormalizer, NoopAnimationDriver as ɵNoopAnimationDriver, AnimationEngine as ɵAnimationEngine, CssKeyframesDriver as ɵCssKeyframesDriver, CssKeyframesPlayer as ɵCssKeyframesPlayer, containsElement as ɵcontainsElement, invokeQuery as ɵinvokeQuery, matchesElement as ɵmatchesElement, validateStyleProperty as ɵvalidateStyleProperty, WebAnimationsDriver as ɵWebAnimationsDriver, supportsWebAnimations as ɵsupportsWebAnimations, WebAnimationsPlayer as ɵWebAnimationsPlayer, allowPreviousPlayerStylesMerge as ɵallowPreviousPlayerStylesMerge };
|
|
4482
4614
|
//# sourceMappingURL=browser.js.map
|