@angular/animations 13.2.0-next.2 → 13.2.1
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/dsl/animation.mjs +1 -1
- package/esm2020/browser/src/dsl/animation_ast_builder.mjs +1 -1
- package/esm2020/browser/src/dsl/animation_timeline_builder.mjs +16 -5
- package/esm2020/browser/src/dsl/animation_transition_factory.mjs +1 -1
- package/esm2020/browser/src/dsl/animation_transition_instruction.mjs +1 -1
- package/esm2020/browser/src/dsl/animation_trigger.mjs +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/animation_engine_next.mjs +1 -1
- package/esm2020/browser/src/render/shared.mjs +4 -20
- package/esm2020/browser/src/render/timeline_animation_engine.mjs +1 -1
- package/esm2020/browser/src/render/transition_animation_engine.mjs +1 -1
- package/esm2020/browser/src/render/web_animations/web_animations_driver.mjs +3 -21
- package/esm2020/browser/src/util.mjs +1 -1
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/animations.mjs +1 -1
- package/fesm2015/browser/testing.mjs +1 -1
- package/fesm2015/browser.mjs +26 -482
- package/fesm2015/browser.mjs.map +1 -1
- package/fesm2020/animations.mjs +1 -1
- package/fesm2020/browser/testing.mjs +1 -1
- package/fesm2020/browser.mjs +26 -481
- 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/fesm2015/browser.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.2.
|
|
2
|
+
* @license Angular v13.2.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -148,27 +148,11 @@ if (_isNode || typeof Element !== 'undefined') {
|
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
_query = (element, selector, multi) => {
|
|
151
|
-
let results = [];
|
|
152
151
|
if (multi) {
|
|
153
|
-
|
|
154
|
-
// For element queries that return sufficiently large NodeList objects,
|
|
155
|
-
// using spread syntax to populate the results array causes a RangeError
|
|
156
|
-
// due to the call stack limit being reached. `Array.from` can not be used
|
|
157
|
-
// as well, since NodeList is not iterable in IE 11, see
|
|
158
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/NodeList
|
|
159
|
-
// More info is available in #38551.
|
|
160
|
-
const elems = element.querySelectorAll(selector);
|
|
161
|
-
for (let i = 0; i < elems.length; i++) {
|
|
162
|
-
results.push(elems[i]);
|
|
163
|
-
}
|
|
152
|
+
return Array.from(element.querySelectorAll(selector));
|
|
164
153
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (elm) {
|
|
168
|
-
results.push(elm);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return results;
|
|
154
|
+
const elem = element.querySelector(selector);
|
|
155
|
+
return elem ? [elem] : [];
|
|
172
156
|
};
|
|
173
157
|
}
|
|
174
158
|
function containsVendorPrefix(prop) {
|
|
@@ -241,9 +225,9 @@ class NoopAnimationDriver {
|
|
|
241
225
|
return new NoopAnimationPlayer(duration, delay);
|
|
242
226
|
}
|
|
243
227
|
}
|
|
244
|
-
NoopAnimationDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.
|
|
245
|
-
NoopAnimationDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.
|
|
246
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.
|
|
228
|
+
NoopAnimationDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
229
|
+
NoopAnimationDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: NoopAnimationDriver });
|
|
230
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: NoopAnimationDriver, decorators: [{
|
|
247
231
|
type: Injectable
|
|
248
232
|
}] });
|
|
249
233
|
/**
|
|
@@ -260,7 +244,7 @@ AnimationDriver.NOOP = ( /* @__PURE__ */new NoopAnimationDriver());
|
|
|
260
244
|
* Use of this source code is governed by an MIT-style license that can be
|
|
261
245
|
* found in the LICENSE file at https://angular.io/license
|
|
262
246
|
*/
|
|
263
|
-
const ONE_SECOND
|
|
247
|
+
const ONE_SECOND = 1000;
|
|
264
248
|
const SUBSTITUTION_EXPR_START = '{{';
|
|
265
249
|
const SUBSTITUTION_EXPR_END = '}}';
|
|
266
250
|
const ENTER_CLASSNAME = 'ng-enter';
|
|
@@ -280,7 +264,7 @@ function resolveTimingValue(value) {
|
|
|
280
264
|
function _convertTimeValueToMS(value, unit) {
|
|
281
265
|
switch (unit) {
|
|
282
266
|
case 's':
|
|
283
|
-
return value * ONE_SECOND
|
|
267
|
+
return value * ONE_SECOND;
|
|
284
268
|
default: // ms or something else
|
|
285
269
|
return value;
|
|
286
270
|
}
|
|
@@ -1263,10 +1247,21 @@ class AnimationTimelineBuilderVisitor {
|
|
|
1263
1247
|
visitDslNode(this, ast, context);
|
|
1264
1248
|
// this checks to see if an actual animation happened
|
|
1265
1249
|
const timelines = context.timelines.filter(timeline => timeline.containsAnimation());
|
|
1266
|
-
if (
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1250
|
+
if (Object.keys(finalStyles).length) {
|
|
1251
|
+
// note: we just want to apply the final styles for the rootElement, so we do not
|
|
1252
|
+
// just apply the styles to the last timeline but the last timeline which
|
|
1253
|
+
// element is the root one (basically `*`-styles are replaced with the actual
|
|
1254
|
+
// state style values only for the root element)
|
|
1255
|
+
let lastRootTimeline;
|
|
1256
|
+
for (let i = timelines.length - 1; i >= 0; i--) {
|
|
1257
|
+
const timeline = timelines[i];
|
|
1258
|
+
if (timeline.element === rootElement) {
|
|
1259
|
+
lastRootTimeline = timeline;
|
|
1260
|
+
break;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
if (lastRootTimeline && !lastRootTimeline.allowOnlyTimelineStyles()) {
|
|
1264
|
+
lastRootTimeline.setStyles([finalStyles], null, context.errors, options);
|
|
1270
1265
|
}
|
|
1271
1266
|
}
|
|
1272
1267
|
return timelines.length ? timelines.map(timeline => timeline.buildKeyframes()) :
|
|
@@ -3991,440 +3986,6 @@ function isNonAnimatableStyle(prop) {
|
|
|
3991
3986
|
return prop === 'display' || prop === 'position';
|
|
3992
3987
|
}
|
|
3993
3988
|
|
|
3994
|
-
/**
|
|
3995
|
-
* @license
|
|
3996
|
-
* Copyright Google LLC All Rights Reserved.
|
|
3997
|
-
*
|
|
3998
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
3999
|
-
* found in the LICENSE file at https://angular.io/license
|
|
4000
|
-
*/
|
|
4001
|
-
const ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;
|
|
4002
|
-
const ANIMATION_PROP = 'animation';
|
|
4003
|
-
const ANIMATIONEND_EVENT = 'animationend';
|
|
4004
|
-
const ONE_SECOND = 1000;
|
|
4005
|
-
class ElementAnimationStyleHandler {
|
|
4006
|
-
constructor(_element, _name, _duration, _delay, _easing, _fillMode, _onDoneFn) {
|
|
4007
|
-
this._element = _element;
|
|
4008
|
-
this._name = _name;
|
|
4009
|
-
this._duration = _duration;
|
|
4010
|
-
this._delay = _delay;
|
|
4011
|
-
this._easing = _easing;
|
|
4012
|
-
this._fillMode = _fillMode;
|
|
4013
|
-
this._onDoneFn = _onDoneFn;
|
|
4014
|
-
this._finished = false;
|
|
4015
|
-
this._destroyed = false;
|
|
4016
|
-
this._startTime = 0;
|
|
4017
|
-
this._position = 0;
|
|
4018
|
-
this._eventFn = (e) => this._handleCallback(e);
|
|
4019
|
-
}
|
|
4020
|
-
apply() {
|
|
4021
|
-
applyKeyframeAnimation(this._element, `${this._duration}ms ${this._easing} ${this._delay}ms 1 normal ${this._fillMode} ${this._name}`);
|
|
4022
|
-
addRemoveAnimationEvent(this._element, this._eventFn, false);
|
|
4023
|
-
this._startTime = Date.now();
|
|
4024
|
-
}
|
|
4025
|
-
pause() {
|
|
4026
|
-
playPauseAnimation(this._element, this._name, 'paused');
|
|
4027
|
-
}
|
|
4028
|
-
resume() {
|
|
4029
|
-
playPauseAnimation(this._element, this._name, 'running');
|
|
4030
|
-
}
|
|
4031
|
-
setPosition(position) {
|
|
4032
|
-
const index = findIndexForAnimation(this._element, this._name);
|
|
4033
|
-
this._position = position * this._duration;
|
|
4034
|
-
setAnimationStyle(this._element, 'Delay', `-${this._position}ms`, index);
|
|
4035
|
-
}
|
|
4036
|
-
getPosition() {
|
|
4037
|
-
return this._position;
|
|
4038
|
-
}
|
|
4039
|
-
_handleCallback(event) {
|
|
4040
|
-
const timestamp = event._ngTestManualTimestamp || Date.now();
|
|
4041
|
-
const elapsedTime = parseFloat(event.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)) * ONE_SECOND;
|
|
4042
|
-
if (event.animationName == this._name &&
|
|
4043
|
-
Math.max(timestamp - this._startTime, 0) >= this._delay && elapsedTime >= this._duration) {
|
|
4044
|
-
this.finish();
|
|
4045
|
-
}
|
|
4046
|
-
}
|
|
4047
|
-
finish() {
|
|
4048
|
-
if (this._finished)
|
|
4049
|
-
return;
|
|
4050
|
-
this._finished = true;
|
|
4051
|
-
this._onDoneFn();
|
|
4052
|
-
addRemoveAnimationEvent(this._element, this._eventFn, true);
|
|
4053
|
-
}
|
|
4054
|
-
destroy() {
|
|
4055
|
-
if (this._destroyed)
|
|
4056
|
-
return;
|
|
4057
|
-
this._destroyed = true;
|
|
4058
|
-
this.finish();
|
|
4059
|
-
removeKeyframeAnimation(this._element, this._name);
|
|
4060
|
-
}
|
|
4061
|
-
}
|
|
4062
|
-
function playPauseAnimation(element, name, status) {
|
|
4063
|
-
const index = findIndexForAnimation(element, name);
|
|
4064
|
-
setAnimationStyle(element, 'PlayState', status, index);
|
|
4065
|
-
}
|
|
4066
|
-
function applyKeyframeAnimation(element, value) {
|
|
4067
|
-
const anim = getAnimationStyle(element, '').trim();
|
|
4068
|
-
let index = 0;
|
|
4069
|
-
if (anim.length) {
|
|
4070
|
-
index = countChars(anim, ',') + 1;
|
|
4071
|
-
value = `${anim}, ${value}`;
|
|
4072
|
-
}
|
|
4073
|
-
setAnimationStyle(element, '', value);
|
|
4074
|
-
return index;
|
|
4075
|
-
}
|
|
4076
|
-
function removeKeyframeAnimation(element, name) {
|
|
4077
|
-
const anim = getAnimationStyle(element, '');
|
|
4078
|
-
const tokens = anim.split(',');
|
|
4079
|
-
const index = findMatchingTokenIndex(tokens, name);
|
|
4080
|
-
if (index >= 0) {
|
|
4081
|
-
tokens.splice(index, 1);
|
|
4082
|
-
const newValue = tokens.join(',');
|
|
4083
|
-
setAnimationStyle(element, '', newValue);
|
|
4084
|
-
}
|
|
4085
|
-
}
|
|
4086
|
-
function findIndexForAnimation(element, value) {
|
|
4087
|
-
const anim = getAnimationStyle(element, '');
|
|
4088
|
-
if (anim.indexOf(',') > 0) {
|
|
4089
|
-
const tokens = anim.split(',');
|
|
4090
|
-
return findMatchingTokenIndex(tokens, value);
|
|
4091
|
-
}
|
|
4092
|
-
return findMatchingTokenIndex([anim], value);
|
|
4093
|
-
}
|
|
4094
|
-
function findMatchingTokenIndex(tokens, searchToken) {
|
|
4095
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
4096
|
-
if (tokens[i].indexOf(searchToken) >= 0) {
|
|
4097
|
-
return i;
|
|
4098
|
-
}
|
|
4099
|
-
}
|
|
4100
|
-
return -1;
|
|
4101
|
-
}
|
|
4102
|
-
function addRemoveAnimationEvent(element, fn, doRemove) {
|
|
4103
|
-
doRemove ? element.removeEventListener(ANIMATIONEND_EVENT, fn) :
|
|
4104
|
-
element.addEventListener(ANIMATIONEND_EVENT, fn);
|
|
4105
|
-
}
|
|
4106
|
-
function setAnimationStyle(element, name, value, index) {
|
|
4107
|
-
const prop = ANIMATION_PROP + name;
|
|
4108
|
-
if (index != null) {
|
|
4109
|
-
const oldValue = element.style[prop];
|
|
4110
|
-
if (oldValue.length) {
|
|
4111
|
-
const tokens = oldValue.split(',');
|
|
4112
|
-
tokens[index] = value;
|
|
4113
|
-
value = tokens.join(',');
|
|
4114
|
-
}
|
|
4115
|
-
}
|
|
4116
|
-
element.style[prop] = value;
|
|
4117
|
-
}
|
|
4118
|
-
function getAnimationStyle(element, name) {
|
|
4119
|
-
return element.style[ANIMATION_PROP + name] || '';
|
|
4120
|
-
}
|
|
4121
|
-
function countChars(value, char) {
|
|
4122
|
-
let count = 0;
|
|
4123
|
-
for (let i = 0; i < value.length; i++) {
|
|
4124
|
-
const c = value.charAt(i);
|
|
4125
|
-
if (c === char)
|
|
4126
|
-
count++;
|
|
4127
|
-
}
|
|
4128
|
-
return count;
|
|
4129
|
-
}
|
|
4130
|
-
|
|
4131
|
-
const DEFAULT_FILL_MODE = 'forwards';
|
|
4132
|
-
const DEFAULT_EASING = 'linear';
|
|
4133
|
-
class CssKeyframesPlayer {
|
|
4134
|
-
constructor(element, keyframes, animationName, _duration, _delay, easing, _finalStyles, _specialStyles) {
|
|
4135
|
-
this.element = element;
|
|
4136
|
-
this.keyframes = keyframes;
|
|
4137
|
-
this.animationName = animationName;
|
|
4138
|
-
this._duration = _duration;
|
|
4139
|
-
this._delay = _delay;
|
|
4140
|
-
this._finalStyles = _finalStyles;
|
|
4141
|
-
this._specialStyles = _specialStyles;
|
|
4142
|
-
this._onDoneFns = [];
|
|
4143
|
-
this._onStartFns = [];
|
|
4144
|
-
this._onDestroyFns = [];
|
|
4145
|
-
this.currentSnapshot = {};
|
|
4146
|
-
this._state = 0;
|
|
4147
|
-
this.easing = easing || DEFAULT_EASING;
|
|
4148
|
-
this.totalTime = _duration + _delay;
|
|
4149
|
-
this._buildStyler();
|
|
4150
|
-
}
|
|
4151
|
-
onStart(fn) {
|
|
4152
|
-
this._onStartFns.push(fn);
|
|
4153
|
-
}
|
|
4154
|
-
onDone(fn) {
|
|
4155
|
-
this._onDoneFns.push(fn);
|
|
4156
|
-
}
|
|
4157
|
-
onDestroy(fn) {
|
|
4158
|
-
this._onDestroyFns.push(fn);
|
|
4159
|
-
}
|
|
4160
|
-
destroy() {
|
|
4161
|
-
this.init();
|
|
4162
|
-
if (this._state >= 4 /* DESTROYED */)
|
|
4163
|
-
return;
|
|
4164
|
-
this._state = 4 /* DESTROYED */;
|
|
4165
|
-
this._styler.destroy();
|
|
4166
|
-
this._flushStartFns();
|
|
4167
|
-
this._flushDoneFns();
|
|
4168
|
-
if (this._specialStyles) {
|
|
4169
|
-
this._specialStyles.destroy();
|
|
4170
|
-
}
|
|
4171
|
-
this._onDestroyFns.forEach(fn => fn());
|
|
4172
|
-
this._onDestroyFns = [];
|
|
4173
|
-
}
|
|
4174
|
-
_flushDoneFns() {
|
|
4175
|
-
this._onDoneFns.forEach(fn => fn());
|
|
4176
|
-
this._onDoneFns = [];
|
|
4177
|
-
}
|
|
4178
|
-
_flushStartFns() {
|
|
4179
|
-
this._onStartFns.forEach(fn => fn());
|
|
4180
|
-
this._onStartFns = [];
|
|
4181
|
-
}
|
|
4182
|
-
finish() {
|
|
4183
|
-
this.init();
|
|
4184
|
-
if (this._state >= 3 /* FINISHED */)
|
|
4185
|
-
return;
|
|
4186
|
-
this._state = 3 /* FINISHED */;
|
|
4187
|
-
this._styler.finish();
|
|
4188
|
-
this._flushStartFns();
|
|
4189
|
-
if (this._specialStyles) {
|
|
4190
|
-
this._specialStyles.finish();
|
|
4191
|
-
}
|
|
4192
|
-
this._flushDoneFns();
|
|
4193
|
-
}
|
|
4194
|
-
setPosition(value) {
|
|
4195
|
-
this._styler.setPosition(value);
|
|
4196
|
-
}
|
|
4197
|
-
getPosition() {
|
|
4198
|
-
return this._styler.getPosition();
|
|
4199
|
-
}
|
|
4200
|
-
hasStarted() {
|
|
4201
|
-
return this._state >= 2 /* STARTED */;
|
|
4202
|
-
}
|
|
4203
|
-
init() {
|
|
4204
|
-
if (this._state >= 1 /* INITIALIZED */)
|
|
4205
|
-
return;
|
|
4206
|
-
this._state = 1 /* INITIALIZED */;
|
|
4207
|
-
const elm = this.element;
|
|
4208
|
-
this._styler.apply();
|
|
4209
|
-
if (this._delay) {
|
|
4210
|
-
this._styler.pause();
|
|
4211
|
-
}
|
|
4212
|
-
}
|
|
4213
|
-
play() {
|
|
4214
|
-
this.init();
|
|
4215
|
-
if (!this.hasStarted()) {
|
|
4216
|
-
this._flushStartFns();
|
|
4217
|
-
this._state = 2 /* STARTED */;
|
|
4218
|
-
if (this._specialStyles) {
|
|
4219
|
-
this._specialStyles.start();
|
|
4220
|
-
}
|
|
4221
|
-
}
|
|
4222
|
-
this._styler.resume();
|
|
4223
|
-
}
|
|
4224
|
-
pause() {
|
|
4225
|
-
this.init();
|
|
4226
|
-
this._styler.pause();
|
|
4227
|
-
}
|
|
4228
|
-
restart() {
|
|
4229
|
-
this.reset();
|
|
4230
|
-
this.play();
|
|
4231
|
-
}
|
|
4232
|
-
reset() {
|
|
4233
|
-
this._state = 0 /* RESET */;
|
|
4234
|
-
this._styler.destroy();
|
|
4235
|
-
this._buildStyler();
|
|
4236
|
-
this._styler.apply();
|
|
4237
|
-
}
|
|
4238
|
-
_buildStyler() {
|
|
4239
|
-
this._styler = new ElementAnimationStyleHandler(this.element, this.animationName, this._duration, this._delay, this.easing, DEFAULT_FILL_MODE, () => this.finish());
|
|
4240
|
-
}
|
|
4241
|
-
/** @internal */
|
|
4242
|
-
triggerCallback(phaseName) {
|
|
4243
|
-
const methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
|
|
4244
|
-
methods.forEach(fn => fn());
|
|
4245
|
-
methods.length = 0;
|
|
4246
|
-
}
|
|
4247
|
-
beforeDestroy() {
|
|
4248
|
-
this.init();
|
|
4249
|
-
const styles = {};
|
|
4250
|
-
if (this.hasStarted()) {
|
|
4251
|
-
const finished = this._state >= 3 /* FINISHED */;
|
|
4252
|
-
Object.keys(this._finalStyles).forEach(prop => {
|
|
4253
|
-
if (prop != 'offset') {
|
|
4254
|
-
styles[prop] = finished ? this._finalStyles[prop] : computeStyle(this.element, prop);
|
|
4255
|
-
}
|
|
4256
|
-
});
|
|
4257
|
-
}
|
|
4258
|
-
this.currentSnapshot = styles;
|
|
4259
|
-
}
|
|
4260
|
-
}
|
|
4261
|
-
|
|
4262
|
-
/**
|
|
4263
|
-
* @license
|
|
4264
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4265
|
-
*
|
|
4266
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
4267
|
-
* found in the LICENSE file at https://angular.io/license
|
|
4268
|
-
*/
|
|
4269
|
-
class DirectStylePlayer extends NoopAnimationPlayer {
|
|
4270
|
-
constructor(element, styles) {
|
|
4271
|
-
super();
|
|
4272
|
-
this.element = element;
|
|
4273
|
-
this._startingStyles = {};
|
|
4274
|
-
this.__initialized = false;
|
|
4275
|
-
this._styles = hypenatePropsObject(styles);
|
|
4276
|
-
}
|
|
4277
|
-
init() {
|
|
4278
|
-
if (this.__initialized || !this._startingStyles)
|
|
4279
|
-
return;
|
|
4280
|
-
this.__initialized = true;
|
|
4281
|
-
Object.keys(this._styles).forEach(prop => {
|
|
4282
|
-
this._startingStyles[prop] = this.element.style[prop];
|
|
4283
|
-
});
|
|
4284
|
-
super.init();
|
|
4285
|
-
}
|
|
4286
|
-
play() {
|
|
4287
|
-
if (!this._startingStyles)
|
|
4288
|
-
return;
|
|
4289
|
-
this.init();
|
|
4290
|
-
Object.keys(this._styles)
|
|
4291
|
-
.forEach(prop => this.element.style.setProperty(prop, this._styles[prop]));
|
|
4292
|
-
super.play();
|
|
4293
|
-
}
|
|
4294
|
-
destroy() {
|
|
4295
|
-
if (!this._startingStyles)
|
|
4296
|
-
return;
|
|
4297
|
-
Object.keys(this._startingStyles).forEach(prop => {
|
|
4298
|
-
const value = this._startingStyles[prop];
|
|
4299
|
-
if (value) {
|
|
4300
|
-
this.element.style.setProperty(prop, value);
|
|
4301
|
-
}
|
|
4302
|
-
else {
|
|
4303
|
-
this.element.style.removeProperty(prop);
|
|
4304
|
-
}
|
|
4305
|
-
});
|
|
4306
|
-
this._startingStyles = null;
|
|
4307
|
-
super.destroy();
|
|
4308
|
-
}
|
|
4309
|
-
}
|
|
4310
|
-
|
|
4311
|
-
const KEYFRAMES_NAME_PREFIX = 'gen_css_kf_';
|
|
4312
|
-
const TAB_SPACE = ' ';
|
|
4313
|
-
class CssKeyframesDriver {
|
|
4314
|
-
constructor() {
|
|
4315
|
-
this._count = 0;
|
|
4316
|
-
}
|
|
4317
|
-
validateStyleProperty(prop) {
|
|
4318
|
-
return validateStyleProperty(prop);
|
|
4319
|
-
}
|
|
4320
|
-
matchesElement(_element, _selector) {
|
|
4321
|
-
// This method is deprecated and no longer in use so we return false.
|
|
4322
|
-
return false;
|
|
4323
|
-
}
|
|
4324
|
-
containsElement(elm1, elm2) {
|
|
4325
|
-
return containsElement(elm1, elm2);
|
|
4326
|
-
}
|
|
4327
|
-
query(element, selector, multi) {
|
|
4328
|
-
return invokeQuery(element, selector, multi);
|
|
4329
|
-
}
|
|
4330
|
-
computeStyle(element, prop, defaultValue) {
|
|
4331
|
-
return window.getComputedStyle(element)[prop];
|
|
4332
|
-
}
|
|
4333
|
-
buildKeyframeElement(element, name, keyframes) {
|
|
4334
|
-
keyframes = keyframes.map(kf => hypenatePropsObject(kf));
|
|
4335
|
-
let keyframeStr = `@keyframes ${name} {\n`;
|
|
4336
|
-
let tab = '';
|
|
4337
|
-
keyframes.forEach(kf => {
|
|
4338
|
-
tab = TAB_SPACE;
|
|
4339
|
-
const offset = parseFloat(kf['offset']);
|
|
4340
|
-
keyframeStr += `${tab}${offset * 100}% {\n`;
|
|
4341
|
-
tab += TAB_SPACE;
|
|
4342
|
-
Object.keys(kf).forEach(prop => {
|
|
4343
|
-
const value = kf[prop];
|
|
4344
|
-
switch (prop) {
|
|
4345
|
-
case 'offset':
|
|
4346
|
-
return;
|
|
4347
|
-
case 'easing':
|
|
4348
|
-
if (value) {
|
|
4349
|
-
keyframeStr += `${tab}animation-timing-function: ${value};\n`;
|
|
4350
|
-
}
|
|
4351
|
-
return;
|
|
4352
|
-
default:
|
|
4353
|
-
keyframeStr += `${tab}${prop}: ${value};\n`;
|
|
4354
|
-
return;
|
|
4355
|
-
}
|
|
4356
|
-
});
|
|
4357
|
-
keyframeStr += `${tab}}\n`;
|
|
4358
|
-
});
|
|
4359
|
-
keyframeStr += `}\n`;
|
|
4360
|
-
const kfElm = document.createElement('style');
|
|
4361
|
-
kfElm.textContent = keyframeStr;
|
|
4362
|
-
return kfElm;
|
|
4363
|
-
}
|
|
4364
|
-
animate(element, keyframes, duration, delay, easing, previousPlayers = [], scrubberAccessRequested) {
|
|
4365
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) && scrubberAccessRequested) {
|
|
4366
|
-
notifyFaultyScrubber();
|
|
4367
|
-
}
|
|
4368
|
-
const previousCssKeyframePlayers = previousPlayers.filter(player => player instanceof CssKeyframesPlayer);
|
|
4369
|
-
const previousStyles = {};
|
|
4370
|
-
if (allowPreviousPlayerStylesMerge(duration, delay)) {
|
|
4371
|
-
previousCssKeyframePlayers.forEach(player => {
|
|
4372
|
-
let styles = player.currentSnapshot;
|
|
4373
|
-
Object.keys(styles).forEach(prop => previousStyles[prop] = styles[prop]);
|
|
4374
|
-
});
|
|
4375
|
-
}
|
|
4376
|
-
keyframes = balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles);
|
|
4377
|
-
const finalStyles = flattenKeyframesIntoStyles(keyframes);
|
|
4378
|
-
// if there is no animation then there is no point in applying
|
|
4379
|
-
// styles and waiting for an event to get fired. This causes lag.
|
|
4380
|
-
// It's better to just directly apply the styles to the element
|
|
4381
|
-
// via the direct styling animation player.
|
|
4382
|
-
if (duration == 0) {
|
|
4383
|
-
return new DirectStylePlayer(element, finalStyles);
|
|
4384
|
-
}
|
|
4385
|
-
const animationName = `${KEYFRAMES_NAME_PREFIX}${this._count++}`;
|
|
4386
|
-
const kfElm = this.buildKeyframeElement(element, animationName, keyframes);
|
|
4387
|
-
const nodeToAppendKfElm = findNodeToAppendKeyframeElement(element);
|
|
4388
|
-
nodeToAppendKfElm.appendChild(kfElm);
|
|
4389
|
-
const specialStyles = packageNonAnimatableStyles(element, keyframes);
|
|
4390
|
-
const player = new CssKeyframesPlayer(element, keyframes, animationName, duration, delay, easing, finalStyles, specialStyles);
|
|
4391
|
-
player.onDestroy(() => removeElement(kfElm));
|
|
4392
|
-
return player;
|
|
4393
|
-
}
|
|
4394
|
-
}
|
|
4395
|
-
function findNodeToAppendKeyframeElement(element) {
|
|
4396
|
-
var _a;
|
|
4397
|
-
const rootNode = (_a = element.getRootNode) === null || _a === void 0 ? void 0 : _a.call(element);
|
|
4398
|
-
if (typeof ShadowRoot !== 'undefined' && rootNode instanceof ShadowRoot) {
|
|
4399
|
-
return rootNode;
|
|
4400
|
-
}
|
|
4401
|
-
return document.head;
|
|
4402
|
-
}
|
|
4403
|
-
function flattenKeyframesIntoStyles(keyframes) {
|
|
4404
|
-
let flatKeyframes = {};
|
|
4405
|
-
if (keyframes) {
|
|
4406
|
-
const kfs = Array.isArray(keyframes) ? keyframes : [keyframes];
|
|
4407
|
-
kfs.forEach(kf => {
|
|
4408
|
-
Object.keys(kf).forEach(prop => {
|
|
4409
|
-
if (prop == 'offset' || prop == 'easing')
|
|
4410
|
-
return;
|
|
4411
|
-
flatKeyframes[prop] = kf[prop];
|
|
4412
|
-
});
|
|
4413
|
-
});
|
|
4414
|
-
}
|
|
4415
|
-
return flatKeyframes;
|
|
4416
|
-
}
|
|
4417
|
-
function removeElement(node) {
|
|
4418
|
-
node.parentNode.removeChild(node);
|
|
4419
|
-
}
|
|
4420
|
-
let warningIssued = false;
|
|
4421
|
-
function notifyFaultyScrubber() {
|
|
4422
|
-
if (warningIssued)
|
|
4423
|
-
return;
|
|
4424
|
-
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.');
|
|
4425
|
-
warningIssued = true;
|
|
4426
|
-
}
|
|
4427
|
-
|
|
4428
3989
|
class WebAnimationsPlayer {
|
|
4429
3990
|
constructor(element, keyframes, options, _specialStyles) {
|
|
4430
3991
|
this.element = element;
|
|
@@ -4580,10 +4141,6 @@ class WebAnimationsPlayer {
|
|
|
4580
4141
|
}
|
|
4581
4142
|
|
|
4582
4143
|
class WebAnimationsDriver {
|
|
4583
|
-
constructor() {
|
|
4584
|
-
this._isNativeImpl = /\{\s*\[native\s+code\]\s*\}/.test(getElementAnimateFn().toString());
|
|
4585
|
-
this._cssKeyframesDriver = new CssKeyframesDriver();
|
|
4586
|
-
}
|
|
4587
4144
|
validateStyleProperty(prop) {
|
|
4588
4145
|
return validateStyleProperty(prop);
|
|
4589
4146
|
}
|
|
@@ -4600,14 +4157,7 @@ class WebAnimationsDriver {
|
|
|
4600
4157
|
computeStyle(element, prop, defaultValue) {
|
|
4601
4158
|
return window.getComputedStyle(element)[prop];
|
|
4602
4159
|
}
|
|
4603
|
-
|
|
4604
|
-
this._isNativeImpl = supported;
|
|
4605
|
-
}
|
|
4606
|
-
animate(element, keyframes, duration, delay, easing, previousPlayers = [], scrubberAccessRequested) {
|
|
4607
|
-
const useKeyframes = !scrubberAccessRequested && !this._isNativeImpl;
|
|
4608
|
-
if (useKeyframes) {
|
|
4609
|
-
return this._cssKeyframesDriver.animate(element, keyframes, duration, delay, easing, previousPlayers);
|
|
4610
|
-
}
|
|
4160
|
+
animate(element, keyframes, duration, delay, easing, previousPlayers = []) {
|
|
4611
4161
|
const fill = delay == 0 ? 'both' : 'forwards';
|
|
4612
4162
|
const playerOptions = { duration, delay, fill };
|
|
4613
4163
|
// we check for this to avoid having a null|undefined value be present
|
|
@@ -4629,12 +4179,6 @@ class WebAnimationsDriver {
|
|
|
4629
4179
|
return new WebAnimationsPlayer(element, keyframes, playerOptions, specialStyles);
|
|
4630
4180
|
}
|
|
4631
4181
|
}
|
|
4632
|
-
function supportsWebAnimations() {
|
|
4633
|
-
return typeof getElementAnimateFn() === 'function';
|
|
4634
|
-
}
|
|
4635
|
-
function getElementAnimateFn() {
|
|
4636
|
-
return (isBrowser() && Element.prototype['animate']) || {};
|
|
4637
|
-
}
|
|
4638
4182
|
|
|
4639
4183
|
/**
|
|
4640
4184
|
* @license
|
|
@@ -4672,5 +4216,5 @@ function getElementAnimateFn() {
|
|
|
4672
4216
|
* Generated bundle index. Do not edit.
|
|
4673
4217
|
*/
|
|
4674
4218
|
|
|
4675
|
-
export { AnimationDriver, Animation as ɵAnimation, AnimationEngine as ɵAnimationEngine, AnimationStyleNormalizer as ɵAnimationStyleNormalizer,
|
|
4219
|
+
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 };
|
|
4676
4220
|
//# sourceMappingURL=browser.mjs.map
|