@angular/animations 13.2.0-rc.0 → 13.2.2
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/animations.d.ts +1 -1
- package/browser/browser.d.ts +2 -65
- package/browser/testing/testing.d.ts +1 -1
- package/esm2020/browser/src/private_export.mjs +2 -4
- package/esm2020/browser/src/render/animation_driver.mjs +3 -3
- package/esm2020/browser/src/render/web_animations/web_animations_driver.mjs +3 -21
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/animations.mjs +1 -1
- package/fesm2015/browser/testing.mjs +1 -1
- package/fesm2015/browser.mjs +8 -459
- package/fesm2015/browser.mjs.map +1 -1
- package/fesm2020/animations.mjs +1 -1
- package/fesm2020/browser/testing.mjs +1 -1
- package/fesm2020/browser.mjs +8 -458
- package/fesm2020/browser.mjs.map +1 -1
- package/package.json +2 -2
- package/esm2020/browser/src/render/css_keyframes/css_keyframes_driver.mjs +0 -121
- package/esm2020/browser/src/render/css_keyframes/css_keyframes_player.mjs +0 -133
- package/esm2020/browser/src/render/css_keyframes/direct_style_player.mjs +0 -51
- package/esm2020/browser/src/render/css_keyframes/element_animation_style_handler.mjs +0 -137
package/fesm2020/animations.mjs
CHANGED
package/fesm2020/browser.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.2.
|
|
2
|
+
* @license Angular v13.2.2
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -225,9 +225,9 @@ class NoopAnimationDriver {
|
|
|
225
225
|
return new NoopAnimationPlayer(duration, delay);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
NoopAnimationDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.
|
|
229
|
-
NoopAnimationDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.
|
|
230
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.
|
|
228
|
+
NoopAnimationDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
229
|
+
NoopAnimationDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NoopAnimationDriver });
|
|
230
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NoopAnimationDriver, decorators: [{
|
|
231
231
|
type: Injectable
|
|
232
232
|
}] });
|
|
233
233
|
/**
|
|
@@ -244,7 +244,7 @@ AnimationDriver.NOOP = ( /* @__PURE__ */new NoopAnimationDriver());
|
|
|
244
244
|
* Use of this source code is governed by an MIT-style license that can be
|
|
245
245
|
* found in the LICENSE file at https://angular.io/license
|
|
246
246
|
*/
|
|
247
|
-
const ONE_SECOND
|
|
247
|
+
const ONE_SECOND = 1000;
|
|
248
248
|
const SUBSTITUTION_EXPR_START = '{{';
|
|
249
249
|
const SUBSTITUTION_EXPR_END = '}}';
|
|
250
250
|
const ENTER_CLASSNAME = 'ng-enter';
|
|
@@ -264,7 +264,7 @@ function resolveTimingValue(value) {
|
|
|
264
264
|
function _convertTimeValueToMS(value, unit) {
|
|
265
265
|
switch (unit) {
|
|
266
266
|
case 's':
|
|
267
|
-
return value * ONE_SECOND
|
|
267
|
+
return value * ONE_SECOND;
|
|
268
268
|
default: // ms or something else
|
|
269
269
|
return value;
|
|
270
270
|
}
|
|
@@ -3983,439 +3983,6 @@ function isNonAnimatableStyle(prop) {
|
|
|
3983
3983
|
return prop === 'display' || prop === 'position';
|
|
3984
3984
|
}
|
|
3985
3985
|
|
|
3986
|
-
/**
|
|
3987
|
-
* @license
|
|
3988
|
-
* Copyright Google LLC All Rights Reserved.
|
|
3989
|
-
*
|
|
3990
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
3991
|
-
* found in the LICENSE file at https://angular.io/license
|
|
3992
|
-
*/
|
|
3993
|
-
const ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;
|
|
3994
|
-
const ANIMATION_PROP = 'animation';
|
|
3995
|
-
const ANIMATIONEND_EVENT = 'animationend';
|
|
3996
|
-
const ONE_SECOND = 1000;
|
|
3997
|
-
class ElementAnimationStyleHandler {
|
|
3998
|
-
constructor(_element, _name, _duration, _delay, _easing, _fillMode, _onDoneFn) {
|
|
3999
|
-
this._element = _element;
|
|
4000
|
-
this._name = _name;
|
|
4001
|
-
this._duration = _duration;
|
|
4002
|
-
this._delay = _delay;
|
|
4003
|
-
this._easing = _easing;
|
|
4004
|
-
this._fillMode = _fillMode;
|
|
4005
|
-
this._onDoneFn = _onDoneFn;
|
|
4006
|
-
this._finished = false;
|
|
4007
|
-
this._destroyed = false;
|
|
4008
|
-
this._startTime = 0;
|
|
4009
|
-
this._position = 0;
|
|
4010
|
-
this._eventFn = (e) => this._handleCallback(e);
|
|
4011
|
-
}
|
|
4012
|
-
apply() {
|
|
4013
|
-
applyKeyframeAnimation(this._element, `${this._duration}ms ${this._easing} ${this._delay}ms 1 normal ${this._fillMode} ${this._name}`);
|
|
4014
|
-
addRemoveAnimationEvent(this._element, this._eventFn, false);
|
|
4015
|
-
this._startTime = Date.now();
|
|
4016
|
-
}
|
|
4017
|
-
pause() {
|
|
4018
|
-
playPauseAnimation(this._element, this._name, 'paused');
|
|
4019
|
-
}
|
|
4020
|
-
resume() {
|
|
4021
|
-
playPauseAnimation(this._element, this._name, 'running');
|
|
4022
|
-
}
|
|
4023
|
-
setPosition(position) {
|
|
4024
|
-
const index = findIndexForAnimation(this._element, this._name);
|
|
4025
|
-
this._position = position * this._duration;
|
|
4026
|
-
setAnimationStyle(this._element, 'Delay', `-${this._position}ms`, index);
|
|
4027
|
-
}
|
|
4028
|
-
getPosition() {
|
|
4029
|
-
return this._position;
|
|
4030
|
-
}
|
|
4031
|
-
_handleCallback(event) {
|
|
4032
|
-
const timestamp = event._ngTestManualTimestamp || Date.now();
|
|
4033
|
-
const elapsedTime = parseFloat(event.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)) * ONE_SECOND;
|
|
4034
|
-
if (event.animationName == this._name &&
|
|
4035
|
-
Math.max(timestamp - this._startTime, 0) >= this._delay && elapsedTime >= this._duration) {
|
|
4036
|
-
this.finish();
|
|
4037
|
-
}
|
|
4038
|
-
}
|
|
4039
|
-
finish() {
|
|
4040
|
-
if (this._finished)
|
|
4041
|
-
return;
|
|
4042
|
-
this._finished = true;
|
|
4043
|
-
this._onDoneFn();
|
|
4044
|
-
addRemoveAnimationEvent(this._element, this._eventFn, true);
|
|
4045
|
-
}
|
|
4046
|
-
destroy() {
|
|
4047
|
-
if (this._destroyed)
|
|
4048
|
-
return;
|
|
4049
|
-
this._destroyed = true;
|
|
4050
|
-
this.finish();
|
|
4051
|
-
removeKeyframeAnimation(this._element, this._name);
|
|
4052
|
-
}
|
|
4053
|
-
}
|
|
4054
|
-
function playPauseAnimation(element, name, status) {
|
|
4055
|
-
const index = findIndexForAnimation(element, name);
|
|
4056
|
-
setAnimationStyle(element, 'PlayState', status, index);
|
|
4057
|
-
}
|
|
4058
|
-
function applyKeyframeAnimation(element, value) {
|
|
4059
|
-
const anim = getAnimationStyle(element, '').trim();
|
|
4060
|
-
let index = 0;
|
|
4061
|
-
if (anim.length) {
|
|
4062
|
-
index = countChars(anim, ',') + 1;
|
|
4063
|
-
value = `${anim}, ${value}`;
|
|
4064
|
-
}
|
|
4065
|
-
setAnimationStyle(element, '', value);
|
|
4066
|
-
return index;
|
|
4067
|
-
}
|
|
4068
|
-
function removeKeyframeAnimation(element, name) {
|
|
4069
|
-
const anim = getAnimationStyle(element, '');
|
|
4070
|
-
const tokens = anim.split(',');
|
|
4071
|
-
const index = findMatchingTokenIndex(tokens, name);
|
|
4072
|
-
if (index >= 0) {
|
|
4073
|
-
tokens.splice(index, 1);
|
|
4074
|
-
const newValue = tokens.join(',');
|
|
4075
|
-
setAnimationStyle(element, '', newValue);
|
|
4076
|
-
}
|
|
4077
|
-
}
|
|
4078
|
-
function findIndexForAnimation(element, value) {
|
|
4079
|
-
const anim = getAnimationStyle(element, '');
|
|
4080
|
-
if (anim.indexOf(',') > 0) {
|
|
4081
|
-
const tokens = anim.split(',');
|
|
4082
|
-
return findMatchingTokenIndex(tokens, value);
|
|
4083
|
-
}
|
|
4084
|
-
return findMatchingTokenIndex([anim], value);
|
|
4085
|
-
}
|
|
4086
|
-
function findMatchingTokenIndex(tokens, searchToken) {
|
|
4087
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
4088
|
-
if (tokens[i].indexOf(searchToken) >= 0) {
|
|
4089
|
-
return i;
|
|
4090
|
-
}
|
|
4091
|
-
}
|
|
4092
|
-
return -1;
|
|
4093
|
-
}
|
|
4094
|
-
function addRemoveAnimationEvent(element, fn, doRemove) {
|
|
4095
|
-
doRemove ? element.removeEventListener(ANIMATIONEND_EVENT, fn) :
|
|
4096
|
-
element.addEventListener(ANIMATIONEND_EVENT, fn);
|
|
4097
|
-
}
|
|
4098
|
-
function setAnimationStyle(element, name, value, index) {
|
|
4099
|
-
const prop = ANIMATION_PROP + name;
|
|
4100
|
-
if (index != null) {
|
|
4101
|
-
const oldValue = element.style[prop];
|
|
4102
|
-
if (oldValue.length) {
|
|
4103
|
-
const tokens = oldValue.split(',');
|
|
4104
|
-
tokens[index] = value;
|
|
4105
|
-
value = tokens.join(',');
|
|
4106
|
-
}
|
|
4107
|
-
}
|
|
4108
|
-
element.style[prop] = value;
|
|
4109
|
-
}
|
|
4110
|
-
function getAnimationStyle(element, name) {
|
|
4111
|
-
return element.style[ANIMATION_PROP + name] || '';
|
|
4112
|
-
}
|
|
4113
|
-
function countChars(value, char) {
|
|
4114
|
-
let count = 0;
|
|
4115
|
-
for (let i = 0; i < value.length; i++) {
|
|
4116
|
-
const c = value.charAt(i);
|
|
4117
|
-
if (c === char)
|
|
4118
|
-
count++;
|
|
4119
|
-
}
|
|
4120
|
-
return count;
|
|
4121
|
-
}
|
|
4122
|
-
|
|
4123
|
-
const DEFAULT_FILL_MODE = 'forwards';
|
|
4124
|
-
const DEFAULT_EASING = 'linear';
|
|
4125
|
-
class CssKeyframesPlayer {
|
|
4126
|
-
constructor(element, keyframes, animationName, _duration, _delay, easing, _finalStyles, _specialStyles) {
|
|
4127
|
-
this.element = element;
|
|
4128
|
-
this.keyframes = keyframes;
|
|
4129
|
-
this.animationName = animationName;
|
|
4130
|
-
this._duration = _duration;
|
|
4131
|
-
this._delay = _delay;
|
|
4132
|
-
this._finalStyles = _finalStyles;
|
|
4133
|
-
this._specialStyles = _specialStyles;
|
|
4134
|
-
this._onDoneFns = [];
|
|
4135
|
-
this._onStartFns = [];
|
|
4136
|
-
this._onDestroyFns = [];
|
|
4137
|
-
this.currentSnapshot = {};
|
|
4138
|
-
this._state = 0;
|
|
4139
|
-
this.easing = easing || DEFAULT_EASING;
|
|
4140
|
-
this.totalTime = _duration + _delay;
|
|
4141
|
-
this._buildStyler();
|
|
4142
|
-
}
|
|
4143
|
-
onStart(fn) {
|
|
4144
|
-
this._onStartFns.push(fn);
|
|
4145
|
-
}
|
|
4146
|
-
onDone(fn) {
|
|
4147
|
-
this._onDoneFns.push(fn);
|
|
4148
|
-
}
|
|
4149
|
-
onDestroy(fn) {
|
|
4150
|
-
this._onDestroyFns.push(fn);
|
|
4151
|
-
}
|
|
4152
|
-
destroy() {
|
|
4153
|
-
this.init();
|
|
4154
|
-
if (this._state >= 4 /* DESTROYED */)
|
|
4155
|
-
return;
|
|
4156
|
-
this._state = 4 /* DESTROYED */;
|
|
4157
|
-
this._styler.destroy();
|
|
4158
|
-
this._flushStartFns();
|
|
4159
|
-
this._flushDoneFns();
|
|
4160
|
-
if (this._specialStyles) {
|
|
4161
|
-
this._specialStyles.destroy();
|
|
4162
|
-
}
|
|
4163
|
-
this._onDestroyFns.forEach(fn => fn());
|
|
4164
|
-
this._onDestroyFns = [];
|
|
4165
|
-
}
|
|
4166
|
-
_flushDoneFns() {
|
|
4167
|
-
this._onDoneFns.forEach(fn => fn());
|
|
4168
|
-
this._onDoneFns = [];
|
|
4169
|
-
}
|
|
4170
|
-
_flushStartFns() {
|
|
4171
|
-
this._onStartFns.forEach(fn => fn());
|
|
4172
|
-
this._onStartFns = [];
|
|
4173
|
-
}
|
|
4174
|
-
finish() {
|
|
4175
|
-
this.init();
|
|
4176
|
-
if (this._state >= 3 /* FINISHED */)
|
|
4177
|
-
return;
|
|
4178
|
-
this._state = 3 /* FINISHED */;
|
|
4179
|
-
this._styler.finish();
|
|
4180
|
-
this._flushStartFns();
|
|
4181
|
-
if (this._specialStyles) {
|
|
4182
|
-
this._specialStyles.finish();
|
|
4183
|
-
}
|
|
4184
|
-
this._flushDoneFns();
|
|
4185
|
-
}
|
|
4186
|
-
setPosition(value) {
|
|
4187
|
-
this._styler.setPosition(value);
|
|
4188
|
-
}
|
|
4189
|
-
getPosition() {
|
|
4190
|
-
return this._styler.getPosition();
|
|
4191
|
-
}
|
|
4192
|
-
hasStarted() {
|
|
4193
|
-
return this._state >= 2 /* STARTED */;
|
|
4194
|
-
}
|
|
4195
|
-
init() {
|
|
4196
|
-
if (this._state >= 1 /* INITIALIZED */)
|
|
4197
|
-
return;
|
|
4198
|
-
this._state = 1 /* INITIALIZED */;
|
|
4199
|
-
const elm = this.element;
|
|
4200
|
-
this._styler.apply();
|
|
4201
|
-
if (this._delay) {
|
|
4202
|
-
this._styler.pause();
|
|
4203
|
-
}
|
|
4204
|
-
}
|
|
4205
|
-
play() {
|
|
4206
|
-
this.init();
|
|
4207
|
-
if (!this.hasStarted()) {
|
|
4208
|
-
this._flushStartFns();
|
|
4209
|
-
this._state = 2 /* STARTED */;
|
|
4210
|
-
if (this._specialStyles) {
|
|
4211
|
-
this._specialStyles.start();
|
|
4212
|
-
}
|
|
4213
|
-
}
|
|
4214
|
-
this._styler.resume();
|
|
4215
|
-
}
|
|
4216
|
-
pause() {
|
|
4217
|
-
this.init();
|
|
4218
|
-
this._styler.pause();
|
|
4219
|
-
}
|
|
4220
|
-
restart() {
|
|
4221
|
-
this.reset();
|
|
4222
|
-
this.play();
|
|
4223
|
-
}
|
|
4224
|
-
reset() {
|
|
4225
|
-
this._state = 0 /* RESET */;
|
|
4226
|
-
this._styler.destroy();
|
|
4227
|
-
this._buildStyler();
|
|
4228
|
-
this._styler.apply();
|
|
4229
|
-
}
|
|
4230
|
-
_buildStyler() {
|
|
4231
|
-
this._styler = new ElementAnimationStyleHandler(this.element, this.animationName, this._duration, this._delay, this.easing, DEFAULT_FILL_MODE, () => this.finish());
|
|
4232
|
-
}
|
|
4233
|
-
/** @internal */
|
|
4234
|
-
triggerCallback(phaseName) {
|
|
4235
|
-
const methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
|
|
4236
|
-
methods.forEach(fn => fn());
|
|
4237
|
-
methods.length = 0;
|
|
4238
|
-
}
|
|
4239
|
-
beforeDestroy() {
|
|
4240
|
-
this.init();
|
|
4241
|
-
const styles = {};
|
|
4242
|
-
if (this.hasStarted()) {
|
|
4243
|
-
const finished = this._state >= 3 /* FINISHED */;
|
|
4244
|
-
Object.keys(this._finalStyles).forEach(prop => {
|
|
4245
|
-
if (prop != 'offset') {
|
|
4246
|
-
styles[prop] = finished ? this._finalStyles[prop] : computeStyle(this.element, prop);
|
|
4247
|
-
}
|
|
4248
|
-
});
|
|
4249
|
-
}
|
|
4250
|
-
this.currentSnapshot = styles;
|
|
4251
|
-
}
|
|
4252
|
-
}
|
|
4253
|
-
|
|
4254
|
-
/**
|
|
4255
|
-
* @license
|
|
4256
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4257
|
-
*
|
|
4258
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
4259
|
-
* found in the LICENSE file at https://angular.io/license
|
|
4260
|
-
*/
|
|
4261
|
-
class DirectStylePlayer extends NoopAnimationPlayer {
|
|
4262
|
-
constructor(element, styles) {
|
|
4263
|
-
super();
|
|
4264
|
-
this.element = element;
|
|
4265
|
-
this._startingStyles = {};
|
|
4266
|
-
this.__initialized = false;
|
|
4267
|
-
this._styles = hypenatePropsObject(styles);
|
|
4268
|
-
}
|
|
4269
|
-
init() {
|
|
4270
|
-
if (this.__initialized || !this._startingStyles)
|
|
4271
|
-
return;
|
|
4272
|
-
this.__initialized = true;
|
|
4273
|
-
Object.keys(this._styles).forEach(prop => {
|
|
4274
|
-
this._startingStyles[prop] = this.element.style[prop];
|
|
4275
|
-
});
|
|
4276
|
-
super.init();
|
|
4277
|
-
}
|
|
4278
|
-
play() {
|
|
4279
|
-
if (!this._startingStyles)
|
|
4280
|
-
return;
|
|
4281
|
-
this.init();
|
|
4282
|
-
Object.keys(this._styles)
|
|
4283
|
-
.forEach(prop => this.element.style.setProperty(prop, this._styles[prop]));
|
|
4284
|
-
super.play();
|
|
4285
|
-
}
|
|
4286
|
-
destroy() {
|
|
4287
|
-
if (!this._startingStyles)
|
|
4288
|
-
return;
|
|
4289
|
-
Object.keys(this._startingStyles).forEach(prop => {
|
|
4290
|
-
const value = this._startingStyles[prop];
|
|
4291
|
-
if (value) {
|
|
4292
|
-
this.element.style.setProperty(prop, value);
|
|
4293
|
-
}
|
|
4294
|
-
else {
|
|
4295
|
-
this.element.style.removeProperty(prop);
|
|
4296
|
-
}
|
|
4297
|
-
});
|
|
4298
|
-
this._startingStyles = null;
|
|
4299
|
-
super.destroy();
|
|
4300
|
-
}
|
|
4301
|
-
}
|
|
4302
|
-
|
|
4303
|
-
const KEYFRAMES_NAME_PREFIX = 'gen_css_kf_';
|
|
4304
|
-
const TAB_SPACE = ' ';
|
|
4305
|
-
class CssKeyframesDriver {
|
|
4306
|
-
constructor() {
|
|
4307
|
-
this._count = 0;
|
|
4308
|
-
}
|
|
4309
|
-
validateStyleProperty(prop) {
|
|
4310
|
-
return validateStyleProperty(prop);
|
|
4311
|
-
}
|
|
4312
|
-
matchesElement(_element, _selector) {
|
|
4313
|
-
// This method is deprecated and no longer in use so we return false.
|
|
4314
|
-
return false;
|
|
4315
|
-
}
|
|
4316
|
-
containsElement(elm1, elm2) {
|
|
4317
|
-
return containsElement(elm1, elm2);
|
|
4318
|
-
}
|
|
4319
|
-
query(element, selector, multi) {
|
|
4320
|
-
return invokeQuery(element, selector, multi);
|
|
4321
|
-
}
|
|
4322
|
-
computeStyle(element, prop, defaultValue) {
|
|
4323
|
-
return window.getComputedStyle(element)[prop];
|
|
4324
|
-
}
|
|
4325
|
-
buildKeyframeElement(element, name, keyframes) {
|
|
4326
|
-
keyframes = keyframes.map(kf => hypenatePropsObject(kf));
|
|
4327
|
-
let keyframeStr = `@keyframes ${name} {\n`;
|
|
4328
|
-
let tab = '';
|
|
4329
|
-
keyframes.forEach(kf => {
|
|
4330
|
-
tab = TAB_SPACE;
|
|
4331
|
-
const offset = parseFloat(kf['offset']);
|
|
4332
|
-
keyframeStr += `${tab}${offset * 100}% {\n`;
|
|
4333
|
-
tab += TAB_SPACE;
|
|
4334
|
-
Object.keys(kf).forEach(prop => {
|
|
4335
|
-
const value = kf[prop];
|
|
4336
|
-
switch (prop) {
|
|
4337
|
-
case 'offset':
|
|
4338
|
-
return;
|
|
4339
|
-
case 'easing':
|
|
4340
|
-
if (value) {
|
|
4341
|
-
keyframeStr += `${tab}animation-timing-function: ${value};\n`;
|
|
4342
|
-
}
|
|
4343
|
-
return;
|
|
4344
|
-
default:
|
|
4345
|
-
keyframeStr += `${tab}${prop}: ${value};\n`;
|
|
4346
|
-
return;
|
|
4347
|
-
}
|
|
4348
|
-
});
|
|
4349
|
-
keyframeStr += `${tab}}\n`;
|
|
4350
|
-
});
|
|
4351
|
-
keyframeStr += `}\n`;
|
|
4352
|
-
const kfElm = document.createElement('style');
|
|
4353
|
-
kfElm.textContent = keyframeStr;
|
|
4354
|
-
return kfElm;
|
|
4355
|
-
}
|
|
4356
|
-
animate(element, keyframes, duration, delay, easing, previousPlayers = [], scrubberAccessRequested) {
|
|
4357
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) && scrubberAccessRequested) {
|
|
4358
|
-
notifyFaultyScrubber();
|
|
4359
|
-
}
|
|
4360
|
-
const previousCssKeyframePlayers = previousPlayers.filter(player => player instanceof CssKeyframesPlayer);
|
|
4361
|
-
const previousStyles = {};
|
|
4362
|
-
if (allowPreviousPlayerStylesMerge(duration, delay)) {
|
|
4363
|
-
previousCssKeyframePlayers.forEach(player => {
|
|
4364
|
-
let styles = player.currentSnapshot;
|
|
4365
|
-
Object.keys(styles).forEach(prop => previousStyles[prop] = styles[prop]);
|
|
4366
|
-
});
|
|
4367
|
-
}
|
|
4368
|
-
keyframes = balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles);
|
|
4369
|
-
const finalStyles = flattenKeyframesIntoStyles(keyframes);
|
|
4370
|
-
// if there is no animation then there is no point in applying
|
|
4371
|
-
// styles and waiting for an event to get fired. This causes lag.
|
|
4372
|
-
// It's better to just directly apply the styles to the element
|
|
4373
|
-
// via the direct styling animation player.
|
|
4374
|
-
if (duration == 0) {
|
|
4375
|
-
return new DirectStylePlayer(element, finalStyles);
|
|
4376
|
-
}
|
|
4377
|
-
const animationName = `${KEYFRAMES_NAME_PREFIX}${this._count++}`;
|
|
4378
|
-
const kfElm = this.buildKeyframeElement(element, animationName, keyframes);
|
|
4379
|
-
const nodeToAppendKfElm = findNodeToAppendKeyframeElement(element);
|
|
4380
|
-
nodeToAppendKfElm.appendChild(kfElm);
|
|
4381
|
-
const specialStyles = packageNonAnimatableStyles(element, keyframes);
|
|
4382
|
-
const player = new CssKeyframesPlayer(element, keyframes, animationName, duration, delay, easing, finalStyles, specialStyles);
|
|
4383
|
-
player.onDestroy(() => removeElement(kfElm));
|
|
4384
|
-
return player;
|
|
4385
|
-
}
|
|
4386
|
-
}
|
|
4387
|
-
function findNodeToAppendKeyframeElement(element) {
|
|
4388
|
-
const rootNode = element.getRootNode?.();
|
|
4389
|
-
if (typeof ShadowRoot !== 'undefined' && rootNode instanceof ShadowRoot) {
|
|
4390
|
-
return rootNode;
|
|
4391
|
-
}
|
|
4392
|
-
return document.head;
|
|
4393
|
-
}
|
|
4394
|
-
function flattenKeyframesIntoStyles(keyframes) {
|
|
4395
|
-
let flatKeyframes = {};
|
|
4396
|
-
if (keyframes) {
|
|
4397
|
-
const kfs = Array.isArray(keyframes) ? keyframes : [keyframes];
|
|
4398
|
-
kfs.forEach(kf => {
|
|
4399
|
-
Object.keys(kf).forEach(prop => {
|
|
4400
|
-
if (prop == 'offset' || prop == 'easing')
|
|
4401
|
-
return;
|
|
4402
|
-
flatKeyframes[prop] = kf[prop];
|
|
4403
|
-
});
|
|
4404
|
-
});
|
|
4405
|
-
}
|
|
4406
|
-
return flatKeyframes;
|
|
4407
|
-
}
|
|
4408
|
-
function removeElement(node) {
|
|
4409
|
-
node.parentNode.removeChild(node);
|
|
4410
|
-
}
|
|
4411
|
-
let warningIssued = false;
|
|
4412
|
-
function notifyFaultyScrubber() {
|
|
4413
|
-
if (warningIssued)
|
|
4414
|
-
return;
|
|
4415
|
-
console.warn('@angular/animations: please load the web-animations.js polyfill to allow programmatic access...\n', ' visit https://bit.ly/IWukam to learn more about using the web-animation-js polyfill.');
|
|
4416
|
-
warningIssued = true;
|
|
4417
|
-
}
|
|
4418
|
-
|
|
4419
3986
|
class WebAnimationsPlayer {
|
|
4420
3987
|
constructor(element, keyframes, options, _specialStyles) {
|
|
4421
3988
|
this.element = element;
|
|
@@ -4571,10 +4138,6 @@ class WebAnimationsPlayer {
|
|
|
4571
4138
|
}
|
|
4572
4139
|
|
|
4573
4140
|
class WebAnimationsDriver {
|
|
4574
|
-
constructor() {
|
|
4575
|
-
this._isNativeImpl = /\{\s*\[native\s+code\]\s*\}/.test(getElementAnimateFn().toString());
|
|
4576
|
-
this._cssKeyframesDriver = new CssKeyframesDriver();
|
|
4577
|
-
}
|
|
4578
4141
|
validateStyleProperty(prop) {
|
|
4579
4142
|
return validateStyleProperty(prop);
|
|
4580
4143
|
}
|
|
@@ -4591,14 +4154,7 @@ class WebAnimationsDriver {
|
|
|
4591
4154
|
computeStyle(element, prop, defaultValue) {
|
|
4592
4155
|
return window.getComputedStyle(element)[prop];
|
|
4593
4156
|
}
|
|
4594
|
-
|
|
4595
|
-
this._isNativeImpl = supported;
|
|
4596
|
-
}
|
|
4597
|
-
animate(element, keyframes, duration, delay, easing, previousPlayers = [], scrubberAccessRequested) {
|
|
4598
|
-
const useKeyframes = !scrubberAccessRequested && !this._isNativeImpl;
|
|
4599
|
-
if (useKeyframes) {
|
|
4600
|
-
return this._cssKeyframesDriver.animate(element, keyframes, duration, delay, easing, previousPlayers);
|
|
4601
|
-
}
|
|
4157
|
+
animate(element, keyframes, duration, delay, easing, previousPlayers = []) {
|
|
4602
4158
|
const fill = delay == 0 ? 'both' : 'forwards';
|
|
4603
4159
|
const playerOptions = { duration, delay, fill };
|
|
4604
4160
|
// we check for this to avoid having a null|undefined value be present
|
|
@@ -4620,12 +4176,6 @@ class WebAnimationsDriver {
|
|
|
4620
4176
|
return new WebAnimationsPlayer(element, keyframes, playerOptions, specialStyles);
|
|
4621
4177
|
}
|
|
4622
4178
|
}
|
|
4623
|
-
function supportsWebAnimations() {
|
|
4624
|
-
return typeof getElementAnimateFn() === 'function';
|
|
4625
|
-
}
|
|
4626
|
-
function getElementAnimateFn() {
|
|
4627
|
-
return (isBrowser() && Element.prototype['animate']) || {};
|
|
4628
|
-
}
|
|
4629
4179
|
|
|
4630
4180
|
/**
|
|
4631
4181
|
* @license
|
|
@@ -4663,5 +4213,5 @@ function getElementAnimateFn() {
|
|
|
4663
4213
|
* Generated bundle index. Do not edit.
|
|
4664
4214
|
*/
|
|
4665
4215
|
|
|
4666
|
-
export { AnimationDriver, Animation as ɵAnimation, AnimationEngine as ɵAnimationEngine, AnimationStyleNormalizer as ɵAnimationStyleNormalizer,
|
|
4216
|
+
export { AnimationDriver, Animation as ɵAnimation, AnimationEngine as ɵAnimationEngine, AnimationStyleNormalizer as ɵAnimationStyleNormalizer, NoopAnimationDriver as ɵNoopAnimationDriver, NoopAnimationStyleNormalizer as ɵNoopAnimationStyleNormalizer, WebAnimationsDriver as ɵWebAnimationsDriver, WebAnimationsPlayer as ɵWebAnimationsPlayer, WebAnimationsStyleNormalizer as ɵWebAnimationsStyleNormalizer, allowPreviousPlayerStylesMerge as ɵallowPreviousPlayerStylesMerge, containsElement as ɵcontainsElement, invokeQuery as ɵinvokeQuery, validateStyleProperty as ɵvalidateStyleProperty };
|
|
4667
4217
|
//# sourceMappingURL=browser.mjs.map
|