@angular/animations 14.0.0-next.1 → 14.0.0-next.12
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 +10 -2
- package/browser/browser.d.ts +17 -7
- package/browser/testing/testing.d.ts +3 -1
- package/esm2020/browser/src/dsl/animation.mjs +10 -6
- package/esm2020/browser/src/dsl/animation_ast_builder.mjs +46 -25
- package/esm2020/browser/src/dsl/animation_timeline_builder.mjs +8 -4
- package/esm2020/browser/src/dsl/animation_transition_expr.mjs +4 -3
- package/esm2020/browser/src/dsl/animation_transition_factory.mjs +14 -2
- 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/dsl/style_normalization/animation_style_normalizer.mjs +1 -1
- package/esm2020/browser/src/dsl/style_normalization/web_animations_style_normalizer.mjs +3 -2
- package/esm2020/browser/src/error_helpers.mjs +135 -0
- package/esm2020/browser/src/errors.mjs +9 -0
- package/esm2020/browser/src/private_export.mjs +2 -2
- package/esm2020/browser/src/render/animation_driver.mjs +8 -5
- package/esm2020/browser/src/render/animation_engine_next.mjs +9 -3
- package/esm2020/browser/src/render/shared.mjs +22 -7
- package/esm2020/browser/src/render/timeline_animation_engine.mjs +12 -6
- package/esm2020/browser/src/render/transition_animation_engine.mjs +28 -16
- package/esm2020/browser/src/render/web_animations/animatable_props_set.mjs +214 -0
- package/esm2020/browser/src/render/web_animations/web_animations_driver.mjs +19 -4
- package/esm2020/browser/src/util.mjs +11 -10
- package/esm2020/browser/src/warning_helpers.mjs +38 -0
- package/esm2020/browser/testing/src/mock_animation_driver.mjs +11 -2
- package/esm2020/src/animation_metadata.mjs +10 -2
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/animations.mjs +10 -2
- package/fesm2015/animations.mjs.map +1 -1
- package/fesm2015/browser/testing.mjs +847 -3
- package/fesm2015/browser/testing.mjs.map +1 -1
- package/fesm2015/browser.mjs +552 -79
- package/fesm2015/browser.mjs.map +1 -1
- package/fesm2020/animations.mjs +10 -2
- package/fesm2020/animations.mjs.map +1 -1
- package/fesm2020/browser/testing.mjs +847 -3
- package/fesm2020/browser/testing.mjs.map +1 -1
- package/fesm2020/browser.mjs +551 -79
- package/fesm2020/browser.mjs.map +1 -1
- package/package.json +3 -3
package/fesm2020/browser.mjs
CHANGED
|
@@ -1,12 +1,360 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-next.
|
|
2
|
+
* @license Angular v14.0.0-next.12
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { ɵAnimationGroupPlayer, NoopAnimationPlayer, AUTO_STYLE, ɵPRE_STYLE, sequence, style } from '@angular/animations';
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
|
-
import { Injectable } from '@angular/core';
|
|
9
|
+
import { ɵRuntimeError, Injectable } from '@angular/core';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @license
|
|
13
|
+
* Copyright Google LLC All Rights Reserved.
|
|
14
|
+
*
|
|
15
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
16
|
+
* found in the LICENSE file at https://angular.io/license
|
|
17
|
+
*/
|
|
18
|
+
const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
19
|
+
const LINE_START = '\n - ';
|
|
20
|
+
function invalidTimingValue(exp) {
|
|
21
|
+
return new ɵRuntimeError(3000 /* INVALID_TIMING_VALUE */, NG_DEV_MODE$1 && `The provided timing value "${exp}" is invalid.`);
|
|
22
|
+
}
|
|
23
|
+
function negativeStepValue() {
|
|
24
|
+
return new ɵRuntimeError(3100 /* NEGATIVE_STEP_VALUE */, NG_DEV_MODE$1 && 'Duration values below 0 are not allowed for this animation step.');
|
|
25
|
+
}
|
|
26
|
+
function negativeDelayValue() {
|
|
27
|
+
return new ɵRuntimeError(3101 /* NEGATIVE_DELAY_VALUE */, NG_DEV_MODE$1 && 'Delay values below 0 are not allowed for this animation step.');
|
|
28
|
+
}
|
|
29
|
+
function invalidStyleParams(varName) {
|
|
30
|
+
return new ɵRuntimeError(3001 /* INVALID_STYLE_PARAMS */, NG_DEV_MODE$1 &&
|
|
31
|
+
`Unable to resolve the local animation param ${varName} in the given list of values`);
|
|
32
|
+
}
|
|
33
|
+
function invalidParamValue(varName) {
|
|
34
|
+
return new ɵRuntimeError(3003 /* INVALID_PARAM_VALUE */, NG_DEV_MODE$1 && `Please provide a value for the animation param ${varName}`);
|
|
35
|
+
}
|
|
36
|
+
function invalidNodeType(nodeType) {
|
|
37
|
+
return new ɵRuntimeError(3004 /* INVALID_NODE_TYPE */, NG_DEV_MODE$1 && `Unable to resolve animation metadata node #${nodeType}`);
|
|
38
|
+
}
|
|
39
|
+
function invalidCssUnitValue(userProvidedProperty, value) {
|
|
40
|
+
return new ɵRuntimeError(3005 /* INVALID_CSS_UNIT_VALUE */, NG_DEV_MODE$1 && `Please provide a CSS unit value for ${userProvidedProperty}:${value}`);
|
|
41
|
+
}
|
|
42
|
+
function invalidTrigger() {
|
|
43
|
+
return new ɵRuntimeError(3006 /* INVALID_TRIGGER */, NG_DEV_MODE$1 &&
|
|
44
|
+
'animation triggers cannot be prefixed with an `@` sign (e.g. trigger(\'@foo\', [...]))');
|
|
45
|
+
}
|
|
46
|
+
function invalidDefinition() {
|
|
47
|
+
return new ɵRuntimeError(3007 /* INVALID_DEFINITION */, NG_DEV_MODE$1 && 'only state() and transition() definitions can sit inside of a trigger()');
|
|
48
|
+
}
|
|
49
|
+
function invalidState(metadataName, missingSubs) {
|
|
50
|
+
return new ɵRuntimeError(3008 /* INVALID_STATE */, NG_DEV_MODE$1 &&
|
|
51
|
+
`state("${metadataName}", ...) must define default values for all the following style substitutions: ${missingSubs.join(', ')}`);
|
|
52
|
+
}
|
|
53
|
+
function invalidStyleValue(value) {
|
|
54
|
+
return new ɵRuntimeError(3002 /* INVALID_STYLE_VALUE */, NG_DEV_MODE$1 && `The provided style string value ${value} is not allowed.`);
|
|
55
|
+
}
|
|
56
|
+
function invalidProperty(prop) {
|
|
57
|
+
return new ɵRuntimeError(3009 /* INVALID_PROPERTY */, NG_DEV_MODE$1 &&
|
|
58
|
+
`The provided animation property "${prop}" is not a supported CSS property for animations`);
|
|
59
|
+
}
|
|
60
|
+
function invalidParallelAnimation(prop, firstStart, firstEnd, secondStart, secondEnd) {
|
|
61
|
+
return new ɵRuntimeError(3010 /* INVALID_PARALLEL_ANIMATION */, NG_DEV_MODE$1 &&
|
|
62
|
+
`The CSS property "${prop}" that exists between the times of "${firstStart}ms" and "${firstEnd}ms" is also being animated in a parallel animation between the times of "${secondStart}ms" and "${secondEnd}ms"`);
|
|
63
|
+
}
|
|
64
|
+
function invalidKeyframes() {
|
|
65
|
+
return new ɵRuntimeError(3011 /* INVALID_KEYFRAMES */, NG_DEV_MODE$1 && `keyframes() must be placed inside of a call to animate()`);
|
|
66
|
+
}
|
|
67
|
+
function invalidOffset() {
|
|
68
|
+
return new ɵRuntimeError(3012 /* INVALID_OFFSET */, NG_DEV_MODE$1 && `Please ensure that all keyframe offsets are between 0 and 1`);
|
|
69
|
+
}
|
|
70
|
+
function keyframeOffsetsOutOfOrder() {
|
|
71
|
+
return new ɵRuntimeError(3200 /* KEYFRAME_OFFSETS_OUT_OF_ORDER */, NG_DEV_MODE$1 && `Please ensure that all keyframe offsets are in order`);
|
|
72
|
+
}
|
|
73
|
+
function keyframesMissingOffsets() {
|
|
74
|
+
return new ɵRuntimeError(3202 /* KEYFRAMES_MISSING_OFFSETS */, NG_DEV_MODE$1 && `Not all style() steps within the declared keyframes() contain offsets`);
|
|
75
|
+
}
|
|
76
|
+
function invalidStagger() {
|
|
77
|
+
return new ɵRuntimeError(3013 /* INVALID_STAGGER */, NG_DEV_MODE$1 && `stagger() can only be used inside of query()`);
|
|
78
|
+
}
|
|
79
|
+
function invalidQuery(selector) {
|
|
80
|
+
return new ɵRuntimeError(3014 /* INVALID_QUERY */, NG_DEV_MODE$1 &&
|
|
81
|
+
`\`query("${selector}")\` returned zero elements. (Use \`query("${selector}", { optional: true })\` if you wish to allow this.)`);
|
|
82
|
+
}
|
|
83
|
+
function invalidExpression(expr) {
|
|
84
|
+
return new ɵRuntimeError(3015 /* INVALID_EXPRESSION */, NG_DEV_MODE$1 && `The provided transition expression "${expr}" is not supported`);
|
|
85
|
+
}
|
|
86
|
+
function invalidTransitionAlias(alias) {
|
|
87
|
+
return new ɵRuntimeError(3016 /* INVALID_TRANSITION_ALIAS */, NG_DEV_MODE$1 && `The transition alias value "${alias}" is not supported`);
|
|
88
|
+
}
|
|
89
|
+
function validationFailed(errors) {
|
|
90
|
+
return new ɵRuntimeError(3500 /* VALIDATION_FAILED */, NG_DEV_MODE$1 && `animation validation failed:\n${errors.map(err => err.message).join('\n')}`);
|
|
91
|
+
}
|
|
92
|
+
function buildingFailed(errors) {
|
|
93
|
+
return new ɵRuntimeError(3501 /* BUILDING_FAILED */, NG_DEV_MODE$1 && `animation building failed:\n${errors.map(err => err.message).join('\n')}`);
|
|
94
|
+
}
|
|
95
|
+
function triggerBuildFailed(name, errors) {
|
|
96
|
+
return new ɵRuntimeError(3404 /* TRIGGER_BUILD_FAILED */, NG_DEV_MODE$1 &&
|
|
97
|
+
`The animation trigger "${name}" has failed to build due to the following errors:\n - ${errors.map(err => err.message).join('\n - ')}`);
|
|
98
|
+
}
|
|
99
|
+
function animationFailed(errors) {
|
|
100
|
+
return new ɵRuntimeError(3502 /* ANIMATION_FAILED */, NG_DEV_MODE$1 &&
|
|
101
|
+
`Unable to animate due to the following errors:${LINE_START}${errors.map(err => err.message).join(LINE_START)}`);
|
|
102
|
+
}
|
|
103
|
+
function registerFailed(errors) {
|
|
104
|
+
return new ɵRuntimeError(3503 /* REGISTRATION_FAILED */, NG_DEV_MODE$1 &&
|
|
105
|
+
`Unable to build the animation due to the following errors: ${errors.map(err => err.message).join('\n')}`);
|
|
106
|
+
}
|
|
107
|
+
function missingOrDestroyedAnimation() {
|
|
108
|
+
return new ɵRuntimeError(3300 /* MISSING_OR_DESTROYED_ANIMATION */, NG_DEV_MODE$1 && 'The requested animation doesn\'t exist or has already been destroyed');
|
|
109
|
+
}
|
|
110
|
+
function createAnimationFailed(errors) {
|
|
111
|
+
return new ɵRuntimeError(3504 /* CREATE_ANIMATION_FAILED */, NG_DEV_MODE$1 &&
|
|
112
|
+
`Unable to create the animation due to the following errors:${errors.map(err => err.message).join('\n')}`);
|
|
113
|
+
}
|
|
114
|
+
function missingPlayer(id) {
|
|
115
|
+
return new ɵRuntimeError(3301 /* MISSING_PLAYER */, NG_DEV_MODE$1 && `Unable to find the timeline player referenced by ${id}`);
|
|
116
|
+
}
|
|
117
|
+
function missingTrigger(phase, name) {
|
|
118
|
+
return new ɵRuntimeError(3302 /* MISSING_TRIGGER */, NG_DEV_MODE$1 &&
|
|
119
|
+
`Unable to listen on the animation trigger event "${phase}" because the animation trigger "${name}" doesn\'t exist!`);
|
|
120
|
+
}
|
|
121
|
+
function missingEvent(name) {
|
|
122
|
+
return new ɵRuntimeError(3303 /* MISSING_EVENT */, NG_DEV_MODE$1 &&
|
|
123
|
+
`Unable to listen on the animation trigger "${name}" because the provided event is undefined!`);
|
|
124
|
+
}
|
|
125
|
+
function unsupportedTriggerEvent(phase, name) {
|
|
126
|
+
return new ɵRuntimeError(3400 /* UNSUPPORTED_TRIGGER_EVENT */, NG_DEV_MODE$1 &&
|
|
127
|
+
`The provided animation trigger event "${phase}" for the animation trigger "${name}" is not supported!`);
|
|
128
|
+
}
|
|
129
|
+
function unregisteredTrigger(name) {
|
|
130
|
+
return new ɵRuntimeError(3401 /* UNREGISTERED_TRIGGER */, NG_DEV_MODE$1 && `The provided animation trigger "${name}" has not been registered!`);
|
|
131
|
+
}
|
|
132
|
+
function triggerTransitionsFailed(errors) {
|
|
133
|
+
return new ɵRuntimeError(3402 /* TRIGGER_TRANSITIONS_FAILED */, NG_DEV_MODE$1 &&
|
|
134
|
+
`Unable to process animations due to the following failed trigger transitions\n ${errors.map(err => err.message).join('\n')}`);
|
|
135
|
+
}
|
|
136
|
+
function triggerParsingFailed(name, errors) {
|
|
137
|
+
return new ɵRuntimeError(3403 /* TRIGGER_PARSING_FAILED */, NG_DEV_MODE$1 &&
|
|
138
|
+
`Animation parsing for the ${name} trigger have failed:${LINE_START}${errors.map(err => err.message).join(LINE_START)}`);
|
|
139
|
+
}
|
|
140
|
+
function transitionFailed(name, errors) {
|
|
141
|
+
return new ɵRuntimeError(3505 /* TRANSITION_FAILED */, NG_DEV_MODE$1 &&
|
|
142
|
+
`@${name} has failed due to:\n ${errors.map(err => err.message).join('\n- ')}`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @license
|
|
147
|
+
* Copyright Google LLC All Rights Reserved.
|
|
148
|
+
*
|
|
149
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
150
|
+
* found in the LICENSE file at https://angular.io/license
|
|
151
|
+
*/
|
|
152
|
+
/**
|
|
153
|
+
* Set of all animatable CSS properties
|
|
154
|
+
*
|
|
155
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties
|
|
156
|
+
*/
|
|
157
|
+
const ANIMATABLE_PROP_SET = new Set([
|
|
158
|
+
'-moz-outline-radius',
|
|
159
|
+
'-moz-outline-radius-bottomleft',
|
|
160
|
+
'-moz-outline-radius-bottomright',
|
|
161
|
+
'-moz-outline-radius-topleft',
|
|
162
|
+
'-moz-outline-radius-topright',
|
|
163
|
+
'-ms-grid-columns',
|
|
164
|
+
'-ms-grid-rows',
|
|
165
|
+
'-webkit-line-clamp',
|
|
166
|
+
'-webkit-text-fill-color',
|
|
167
|
+
'-webkit-text-stroke',
|
|
168
|
+
'-webkit-text-stroke-color',
|
|
169
|
+
'accent-color',
|
|
170
|
+
'all',
|
|
171
|
+
'backdrop-filter',
|
|
172
|
+
'background',
|
|
173
|
+
'background-color',
|
|
174
|
+
'background-position',
|
|
175
|
+
'background-size',
|
|
176
|
+
'block-size',
|
|
177
|
+
'border',
|
|
178
|
+
'border-block-end',
|
|
179
|
+
'border-block-end-color',
|
|
180
|
+
'border-block-end-width',
|
|
181
|
+
'border-block-start',
|
|
182
|
+
'border-block-start-color',
|
|
183
|
+
'border-block-start-width',
|
|
184
|
+
'border-bottom',
|
|
185
|
+
'border-bottom-color',
|
|
186
|
+
'border-bottom-left-radius',
|
|
187
|
+
'border-bottom-right-radius',
|
|
188
|
+
'border-bottom-width',
|
|
189
|
+
'border-color',
|
|
190
|
+
'border-end-end-radius',
|
|
191
|
+
'border-end-start-radius',
|
|
192
|
+
'border-image-outset',
|
|
193
|
+
'border-image-slice',
|
|
194
|
+
'border-image-width',
|
|
195
|
+
'border-inline-end',
|
|
196
|
+
'border-inline-end-color',
|
|
197
|
+
'border-inline-end-width',
|
|
198
|
+
'border-inline-start',
|
|
199
|
+
'border-inline-start-color',
|
|
200
|
+
'border-inline-start-width',
|
|
201
|
+
'border-left',
|
|
202
|
+
'border-left-color',
|
|
203
|
+
'border-left-width',
|
|
204
|
+
'border-radius',
|
|
205
|
+
'border-right',
|
|
206
|
+
'border-right-color',
|
|
207
|
+
'border-right-width',
|
|
208
|
+
'border-start-end-radius',
|
|
209
|
+
'border-start-start-radius',
|
|
210
|
+
'border-top',
|
|
211
|
+
'border-top-color',
|
|
212
|
+
'border-top-left-radius',
|
|
213
|
+
'border-top-right-radius',
|
|
214
|
+
'border-top-width',
|
|
215
|
+
'border-width',
|
|
216
|
+
'bottom',
|
|
217
|
+
'box-shadow',
|
|
218
|
+
'caret-color',
|
|
219
|
+
'clip',
|
|
220
|
+
'clip-path',
|
|
221
|
+
'color',
|
|
222
|
+
'column-count',
|
|
223
|
+
'column-gap',
|
|
224
|
+
'column-rule',
|
|
225
|
+
'column-rule-color',
|
|
226
|
+
'column-rule-width',
|
|
227
|
+
'column-width',
|
|
228
|
+
'columns',
|
|
229
|
+
'filter',
|
|
230
|
+
'flex',
|
|
231
|
+
'flex-basis',
|
|
232
|
+
'flex-grow',
|
|
233
|
+
'flex-shrink',
|
|
234
|
+
'font',
|
|
235
|
+
'font-size',
|
|
236
|
+
'font-size-adjust',
|
|
237
|
+
'font-stretch',
|
|
238
|
+
'font-variation-settings',
|
|
239
|
+
'font-weight',
|
|
240
|
+
'gap',
|
|
241
|
+
'grid-column-gap',
|
|
242
|
+
'grid-gap',
|
|
243
|
+
'grid-row-gap',
|
|
244
|
+
'grid-template-columns',
|
|
245
|
+
'grid-template-rows',
|
|
246
|
+
'height',
|
|
247
|
+
'inline-size',
|
|
248
|
+
'input-security',
|
|
249
|
+
'inset',
|
|
250
|
+
'inset-block',
|
|
251
|
+
'inset-block-end',
|
|
252
|
+
'inset-block-start',
|
|
253
|
+
'inset-inline',
|
|
254
|
+
'inset-inline-end',
|
|
255
|
+
'inset-inline-start',
|
|
256
|
+
'left',
|
|
257
|
+
'letter-spacing',
|
|
258
|
+
'line-clamp',
|
|
259
|
+
'line-height',
|
|
260
|
+
'margin',
|
|
261
|
+
'margin-block-end',
|
|
262
|
+
'margin-block-start',
|
|
263
|
+
'margin-bottom',
|
|
264
|
+
'margin-inline-end',
|
|
265
|
+
'margin-inline-start',
|
|
266
|
+
'margin-left',
|
|
267
|
+
'margin-right',
|
|
268
|
+
'margin-top',
|
|
269
|
+
'mask',
|
|
270
|
+
'mask-border',
|
|
271
|
+
'mask-position',
|
|
272
|
+
'mask-size',
|
|
273
|
+
'max-block-size',
|
|
274
|
+
'max-height',
|
|
275
|
+
'max-inline-size',
|
|
276
|
+
'max-lines',
|
|
277
|
+
'max-width',
|
|
278
|
+
'min-block-size',
|
|
279
|
+
'min-height',
|
|
280
|
+
'min-inline-size',
|
|
281
|
+
'min-width',
|
|
282
|
+
'object-position',
|
|
283
|
+
'offset',
|
|
284
|
+
'offset-anchor',
|
|
285
|
+
'offset-distance',
|
|
286
|
+
'offset-path',
|
|
287
|
+
'offset-position',
|
|
288
|
+
'offset-rotate',
|
|
289
|
+
'opacity',
|
|
290
|
+
'order',
|
|
291
|
+
'outline',
|
|
292
|
+
'outline-color',
|
|
293
|
+
'outline-offset',
|
|
294
|
+
'outline-width',
|
|
295
|
+
'padding',
|
|
296
|
+
'padding-block-end',
|
|
297
|
+
'padding-block-start',
|
|
298
|
+
'padding-bottom',
|
|
299
|
+
'padding-inline-end',
|
|
300
|
+
'padding-inline-start',
|
|
301
|
+
'padding-left',
|
|
302
|
+
'padding-right',
|
|
303
|
+
'padding-top',
|
|
304
|
+
'perspective',
|
|
305
|
+
'perspective-origin',
|
|
306
|
+
'right',
|
|
307
|
+
'rotate',
|
|
308
|
+
'row-gap',
|
|
309
|
+
'scale',
|
|
310
|
+
'scroll-margin',
|
|
311
|
+
'scroll-margin-block',
|
|
312
|
+
'scroll-margin-block-end',
|
|
313
|
+
'scroll-margin-block-start',
|
|
314
|
+
'scroll-margin-bottom',
|
|
315
|
+
'scroll-margin-inline',
|
|
316
|
+
'scroll-margin-inline-end',
|
|
317
|
+
'scroll-margin-inline-start',
|
|
318
|
+
'scroll-margin-left',
|
|
319
|
+
'scroll-margin-right',
|
|
320
|
+
'scroll-margin-top',
|
|
321
|
+
'scroll-padding',
|
|
322
|
+
'scroll-padding-block',
|
|
323
|
+
'scroll-padding-block-end',
|
|
324
|
+
'scroll-padding-block-start',
|
|
325
|
+
'scroll-padding-bottom',
|
|
326
|
+
'scroll-padding-inline',
|
|
327
|
+
'scroll-padding-inline-end',
|
|
328
|
+
'scroll-padding-inline-start',
|
|
329
|
+
'scroll-padding-left',
|
|
330
|
+
'scroll-padding-right',
|
|
331
|
+
'scroll-padding-top',
|
|
332
|
+
'scroll-snap-coordinate',
|
|
333
|
+
'scroll-snap-destination',
|
|
334
|
+
'scrollbar-color',
|
|
335
|
+
'shape-image-threshold',
|
|
336
|
+
'shape-margin',
|
|
337
|
+
'shape-outside',
|
|
338
|
+
'tab-size',
|
|
339
|
+
'text-decoration',
|
|
340
|
+
'text-decoration-color',
|
|
341
|
+
'text-decoration-thickness',
|
|
342
|
+
'text-emphasis',
|
|
343
|
+
'text-emphasis-color',
|
|
344
|
+
'text-indent',
|
|
345
|
+
'text-shadow',
|
|
346
|
+
'text-underline-offset',
|
|
347
|
+
'top',
|
|
348
|
+
'transform',
|
|
349
|
+
'transform-origin',
|
|
350
|
+
'translate',
|
|
351
|
+
'vertical-align',
|
|
352
|
+
'visibility',
|
|
353
|
+
'width',
|
|
354
|
+
'word-spacing',
|
|
355
|
+
'z-index',
|
|
356
|
+
'zoom',
|
|
357
|
+
]);
|
|
10
358
|
|
|
11
359
|
/**
|
|
12
360
|
* @license
|
|
@@ -72,8 +420,7 @@ function normalizeKeyframes$1(driver, normalizer, element, keyframes, preStyles
|
|
|
72
420
|
previousOffset = offset;
|
|
73
421
|
});
|
|
74
422
|
if (errors.length) {
|
|
75
|
-
|
|
76
|
-
throw new Error(`Unable to animate due to the following errors:${LINE_START}${errors.join(LINE_START)}`);
|
|
423
|
+
throw animationFailed(errors);
|
|
77
424
|
}
|
|
78
425
|
return normalizedKeyframes;
|
|
79
426
|
}
|
|
@@ -113,13 +460,21 @@ function getOrSetDefaultValue(map, key, defaultValue) {
|
|
|
113
460
|
function parseTimelineCommand(command) {
|
|
114
461
|
const separatorPos = command.indexOf(':');
|
|
115
462
|
const id = command.substring(1, separatorPos);
|
|
116
|
-
const action = command.
|
|
463
|
+
const action = command.slice(separatorPos + 1);
|
|
117
464
|
return [id, action];
|
|
118
465
|
}
|
|
119
466
|
let _contains = (elm1, elm2) => false;
|
|
120
467
|
let _query = (element, selector, multi) => {
|
|
121
468
|
return [];
|
|
122
469
|
};
|
|
470
|
+
let _documentElement = null;
|
|
471
|
+
function getParentElement(element) {
|
|
472
|
+
const parent = element.parentNode || element.host; // consider host to support shadow DOM
|
|
473
|
+
if (parent === _documentElement) {
|
|
474
|
+
return null;
|
|
475
|
+
}
|
|
476
|
+
return parent;
|
|
477
|
+
}
|
|
123
478
|
// Define utility methods for browsers and platform-server(domino) where Element
|
|
124
479
|
// and utility methods exist.
|
|
125
480
|
const _isNode = isNode();
|
|
@@ -128,12 +483,15 @@ if (_isNode || typeof Element !== 'undefined') {
|
|
|
128
483
|
_contains = (elm1, elm2) => elm1.contains(elm2);
|
|
129
484
|
}
|
|
130
485
|
else {
|
|
486
|
+
// Read the document element in an IIFE that's been marked pure to avoid a top-level property
|
|
487
|
+
// read that may prevent tree-shaking.
|
|
488
|
+
_documentElement = /* @__PURE__ */ (() => document.documentElement)();
|
|
131
489
|
_contains = (elm1, elm2) => {
|
|
132
|
-
while (elm2
|
|
490
|
+
while (elm2) {
|
|
133
491
|
if (elm2 === elm1) {
|
|
134
492
|
return true;
|
|
135
493
|
}
|
|
136
|
-
elm2 = elm2
|
|
494
|
+
elm2 = getParentElement(elm2);
|
|
137
495
|
}
|
|
138
496
|
return false;
|
|
139
497
|
};
|
|
@@ -162,12 +520,15 @@ function validateStyleProperty(prop) {
|
|
|
162
520
|
if (_CACHED_BODY.style && !containsVendorPrefix(prop)) {
|
|
163
521
|
result = prop in _CACHED_BODY.style;
|
|
164
522
|
if (!result && _IS_WEBKIT) {
|
|
165
|
-
const camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.
|
|
523
|
+
const camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.slice(1);
|
|
166
524
|
result = camelProp in _CACHED_BODY.style;
|
|
167
525
|
}
|
|
168
526
|
}
|
|
169
527
|
return result;
|
|
170
528
|
}
|
|
529
|
+
function validateWebAnimatableStyleProperty(prop) {
|
|
530
|
+
return ANIMATABLE_PROP_SET.has(prop);
|
|
531
|
+
}
|
|
171
532
|
function getBodyNode() {
|
|
172
533
|
if (typeof document != 'undefined') {
|
|
173
534
|
return document.body;
|
|
@@ -206,6 +567,9 @@ class NoopAnimationDriver {
|
|
|
206
567
|
containsElement(elm1, elm2) {
|
|
207
568
|
return containsElement(elm1, elm2);
|
|
208
569
|
}
|
|
570
|
+
getParentElement(element) {
|
|
571
|
+
return getParentElement(element);
|
|
572
|
+
}
|
|
209
573
|
query(element, selector, multi) {
|
|
210
574
|
return invokeQuery(element, selector, multi);
|
|
211
575
|
}
|
|
@@ -216,9 +580,9 @@ class NoopAnimationDriver {
|
|
|
216
580
|
return new NoopAnimationPlayer(duration, delay);
|
|
217
581
|
}
|
|
218
582
|
}
|
|
219
|
-
NoopAnimationDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
220
|
-
NoopAnimationDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
221
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.
|
|
583
|
+
NoopAnimationDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.12", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
584
|
+
NoopAnimationDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-next.12", ngImport: i0, type: NoopAnimationDriver });
|
|
585
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.12", ngImport: i0, type: NoopAnimationDriver, decorators: [{
|
|
222
586
|
type: Injectable
|
|
223
587
|
}] });
|
|
224
588
|
/**
|
|
@@ -273,7 +637,7 @@ function parseTimeExpression(exp, errors, allowNegativeValues) {
|
|
|
273
637
|
if (typeof exp === 'string') {
|
|
274
638
|
const matches = exp.match(regex);
|
|
275
639
|
if (matches === null) {
|
|
276
|
-
errors.push(
|
|
640
|
+
errors.push(invalidTimingValue(exp));
|
|
277
641
|
return { duration: 0, delay: 0, easing: '' };
|
|
278
642
|
}
|
|
279
643
|
duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);
|
|
@@ -293,15 +657,15 @@ function parseTimeExpression(exp, errors, allowNegativeValues) {
|
|
|
293
657
|
let containsErrors = false;
|
|
294
658
|
let startIndex = errors.length;
|
|
295
659
|
if (duration < 0) {
|
|
296
|
-
errors.push(
|
|
660
|
+
errors.push(negativeStepValue());
|
|
297
661
|
containsErrors = true;
|
|
298
662
|
}
|
|
299
663
|
if (delay < 0) {
|
|
300
|
-
errors.push(
|
|
664
|
+
errors.push(negativeDelayValue());
|
|
301
665
|
containsErrors = true;
|
|
302
666
|
}
|
|
303
667
|
if (containsErrors) {
|
|
304
|
-
errors.splice(startIndex, 0,
|
|
668
|
+
errors.splice(startIndex, 0, invalidTimingValue(exp));
|
|
305
669
|
}
|
|
306
670
|
}
|
|
307
671
|
return { duration, delay, easing };
|
|
@@ -421,7 +785,7 @@ function validateStyleParams(value, options, errors) {
|
|
|
421
785
|
if (matches.length) {
|
|
422
786
|
matches.forEach(varName => {
|
|
423
787
|
if (!params.hasOwnProperty(varName)) {
|
|
424
|
-
errors.push(
|
|
788
|
+
errors.push(invalidStyleParams(varName));
|
|
425
789
|
}
|
|
426
790
|
});
|
|
427
791
|
}
|
|
@@ -443,8 +807,8 @@ function interpolateParams(value, params, errors) {
|
|
|
443
807
|
const str = original.replace(PARAM_REGEX, (_, varName) => {
|
|
444
808
|
let localVal = params[varName];
|
|
445
809
|
// this means that the value was never overridden by the data passed in by the user
|
|
446
|
-
if (
|
|
447
|
-
errors.push(
|
|
810
|
+
if (localVal == null) {
|
|
811
|
+
errors.push(invalidParamValue(varName));
|
|
448
812
|
localVal = '';
|
|
449
813
|
}
|
|
450
814
|
return localVal.toString();
|
|
@@ -519,13 +883,51 @@ function visitDslNode(visitor, node, context) {
|
|
|
519
883
|
case 12 /* Stagger */:
|
|
520
884
|
return visitor.visitStagger(node, context);
|
|
521
885
|
default:
|
|
522
|
-
throw
|
|
886
|
+
throw invalidNodeType(node.type);
|
|
523
887
|
}
|
|
524
888
|
}
|
|
525
889
|
function computeStyle(element, prop) {
|
|
526
890
|
return window.getComputedStyle(element)[prop];
|
|
527
891
|
}
|
|
528
892
|
|
|
893
|
+
/**
|
|
894
|
+
* @license
|
|
895
|
+
* Copyright Google LLC All Rights Reserved.
|
|
896
|
+
*
|
|
897
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
898
|
+
* found in the LICENSE file at https://angular.io/license
|
|
899
|
+
*/
|
|
900
|
+
const NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
901
|
+
function createListOfWarnings(warnings) {
|
|
902
|
+
const LINE_START = '\n - ';
|
|
903
|
+
return `${LINE_START}${warnings.filter(Boolean).map(warning => warning).join(LINE_START)}`;
|
|
904
|
+
}
|
|
905
|
+
function warnValidation(warnings) {
|
|
906
|
+
NG_DEV_MODE && console.warn(`animation validation warnings:${createListOfWarnings(warnings)}`);
|
|
907
|
+
}
|
|
908
|
+
function warnTriggerBuild(name, warnings) {
|
|
909
|
+
NG_DEV_MODE &&
|
|
910
|
+
console.warn(`The animation trigger "${name}" has built with the following warnings:${createListOfWarnings(warnings)}`);
|
|
911
|
+
}
|
|
912
|
+
function warnRegister(warnings) {
|
|
913
|
+
NG_DEV_MODE &&
|
|
914
|
+
console.warn(`Animation built with the following warnings:${createListOfWarnings(warnings)}`);
|
|
915
|
+
}
|
|
916
|
+
function triggerParsingWarnings(name, warnings) {
|
|
917
|
+
NG_DEV_MODE &&
|
|
918
|
+
console.warn(`Animation parsing for the ${name} trigger presents the following warnings:${createListOfWarnings(warnings)}`);
|
|
919
|
+
}
|
|
920
|
+
function pushUnrecognizedPropertiesWarning(warnings, props) {
|
|
921
|
+
if (props.length) {
|
|
922
|
+
warnings.push(`The following provided properties are not recognized: ${props.join(', ')}`);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
function pushNonAnimatablePropertiesWarning(warnings, props) {
|
|
926
|
+
if (props.length) {
|
|
927
|
+
warnings.push(`The following provided properties are not animatable: ${props.join(', ')}\n (see: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties)`);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
|
|
529
931
|
/**
|
|
530
932
|
* @license
|
|
531
933
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -555,7 +957,7 @@ function parseInnerTransitionStr(eventStr, expressions, errors) {
|
|
|
555
957
|
}
|
|
556
958
|
const match = eventStr.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/);
|
|
557
959
|
if (match == null || match.length < 4) {
|
|
558
|
-
errors.push(
|
|
960
|
+
errors.push(invalidExpression(eventStr));
|
|
559
961
|
return expressions;
|
|
560
962
|
}
|
|
561
963
|
const fromState = match[1];
|
|
@@ -578,7 +980,7 @@ function parseAnimationAlias(alias, errors) {
|
|
|
578
980
|
case ':decrement':
|
|
579
981
|
return (fromState, toState) => parseFloat(toState) < parseFloat(fromState);
|
|
580
982
|
default:
|
|
581
|
-
errors.push(
|
|
983
|
+
errors.push(invalidTransitionAlias(alias));
|
|
582
984
|
return '* => *';
|
|
583
985
|
}
|
|
584
986
|
}
|
|
@@ -649,18 +1051,27 @@ const SELF_TOKEN_REGEX = new RegExp(`\s*${SELF_TOKEN}\s*,?`, 'g');
|
|
|
649
1051
|
*
|
|
650
1052
|
* Otherwise an error will be thrown.
|
|
651
1053
|
*/
|
|
652
|
-
function buildAnimationAst(driver, metadata, errors) {
|
|
653
|
-
return new AnimationAstBuilderVisitor(driver).build(metadata, errors);
|
|
1054
|
+
function buildAnimationAst(driver, metadata, errors, warnings) {
|
|
1055
|
+
return new AnimationAstBuilderVisitor(driver).build(metadata, errors, warnings);
|
|
654
1056
|
}
|
|
655
1057
|
const ROOT_SELECTOR = '';
|
|
656
1058
|
class AnimationAstBuilderVisitor {
|
|
657
1059
|
constructor(_driver) {
|
|
658
1060
|
this._driver = _driver;
|
|
659
1061
|
}
|
|
660
|
-
build(metadata, errors) {
|
|
1062
|
+
build(metadata, errors, warnings) {
|
|
661
1063
|
const context = new AnimationAstBuilderContext(errors);
|
|
662
1064
|
this._resetContextStyleTimingState(context);
|
|
663
|
-
|
|
1065
|
+
const ast = visitDslNode(this, normalizeAnimationEntry(metadata), context);
|
|
1066
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
1067
|
+
if (context.unsupportedCSSPropertiesFound.size) {
|
|
1068
|
+
pushUnrecognizedPropertiesWarning(warnings, [...context.unsupportedCSSPropertiesFound.keys()]);
|
|
1069
|
+
}
|
|
1070
|
+
if (context.nonAnimatableCSSPropertiesFound.size) {
|
|
1071
|
+
pushNonAnimatablePropertiesWarning(warnings, [...context.nonAnimatableCSSPropertiesFound.keys()]);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
return ast;
|
|
664
1075
|
}
|
|
665
1076
|
_resetContextStyleTimingState(context) {
|
|
666
1077
|
context.currentQuerySelector = ROOT_SELECTOR;
|
|
@@ -674,7 +1085,7 @@ class AnimationAstBuilderVisitor {
|
|
|
674
1085
|
const states = [];
|
|
675
1086
|
const transitions = [];
|
|
676
1087
|
if (metadata.name.charAt(0) == '@') {
|
|
677
|
-
context.errors.push(
|
|
1088
|
+
context.errors.push(invalidTrigger());
|
|
678
1089
|
}
|
|
679
1090
|
metadata.definitions.forEach(def => {
|
|
680
1091
|
this._resetContextStyleTimingState(context);
|
|
@@ -694,7 +1105,7 @@ class AnimationAstBuilderVisitor {
|
|
|
694
1105
|
transitions.push(transition);
|
|
695
1106
|
}
|
|
696
1107
|
else {
|
|
697
|
-
context.errors.push(
|
|
1108
|
+
context.errors.push(invalidDefinition());
|
|
698
1109
|
}
|
|
699
1110
|
});
|
|
700
1111
|
return {
|
|
@@ -726,8 +1137,7 @@ class AnimationAstBuilderVisitor {
|
|
|
726
1137
|
});
|
|
727
1138
|
if (missingSubs.size) {
|
|
728
1139
|
const missingSubsArr = iteratorToArray(missingSubs.values());
|
|
729
|
-
context.errors.push(
|
|
730
|
-
.name}", ...) must define default values for all the following style substitutions: ${missingSubsArr.join(', ')}`);
|
|
1140
|
+
context.errors.push(invalidState(metadata.name, missingSubsArr));
|
|
731
1141
|
}
|
|
732
1142
|
}
|
|
733
1143
|
return {
|
|
@@ -820,7 +1230,7 @@ class AnimationAstBuilderVisitor {
|
|
|
820
1230
|
styles.push(styleTuple);
|
|
821
1231
|
}
|
|
822
1232
|
else {
|
|
823
|
-
context.errors.push(
|
|
1233
|
+
context.errors.push(invalidStyleValue(styleTuple));
|
|
824
1234
|
}
|
|
825
1235
|
}
|
|
826
1236
|
else {
|
|
@@ -865,9 +1275,20 @@ class AnimationAstBuilderVisitor {
|
|
|
865
1275
|
if (typeof tuple === 'string')
|
|
866
1276
|
return;
|
|
867
1277
|
tuple.forEach((value, prop) => {
|
|
868
|
-
if (
|
|
869
|
-
|
|
870
|
-
|
|
1278
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
1279
|
+
if (!this._driver.validateStyleProperty(prop)) {
|
|
1280
|
+
tuple.delete(prop);
|
|
1281
|
+
context.unsupportedCSSPropertiesFound.add(prop);
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
if (this._driver.validateAnimatableStyleProperty) {
|
|
1285
|
+
if (!this._driver.validateAnimatableStyleProperty(prop)) {
|
|
1286
|
+
context.nonAnimatableCSSPropertiesFound.add(prop);
|
|
1287
|
+
// note: non animatable properties are not removed for the tuple just in case they are
|
|
1288
|
+
// categorized as non animatable but can actually be animated
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
871
1292
|
}
|
|
872
1293
|
// This is guaranteed to have a defined Map at this querySelector location making it
|
|
873
1294
|
// safe to add the assertion here. It is set as a default empty map in prior methods.
|
|
@@ -877,8 +1298,7 @@ class AnimationAstBuilderVisitor {
|
|
|
877
1298
|
if (collectedEntry) {
|
|
878
1299
|
if (startTime != endTime && startTime >= collectedEntry.startTime &&
|
|
879
1300
|
endTime <= collectedEntry.endTime) {
|
|
880
|
-
context.errors.push(
|
|
881
|
-
.endTime}ms" is also being animated in a parallel animation between the times of "${startTime}ms" and "${endTime}ms"`);
|
|
1301
|
+
context.errors.push(invalidParallelAnimation(prop, collectedEntry.startTime, collectedEntry.endTime, startTime, endTime));
|
|
882
1302
|
updateCollectedStyle = false;
|
|
883
1303
|
}
|
|
884
1304
|
// we always choose the smaller start time value since we
|
|
@@ -898,7 +1318,7 @@ class AnimationAstBuilderVisitor {
|
|
|
898
1318
|
visitKeyframes(metadata, context) {
|
|
899
1319
|
const ast = { type: 5 /* Keyframes */, styles: [], options: null };
|
|
900
1320
|
if (!context.currentAnimateTimings) {
|
|
901
|
-
context.errors.push(
|
|
1321
|
+
context.errors.push(invalidKeyframes());
|
|
902
1322
|
return ast;
|
|
903
1323
|
}
|
|
904
1324
|
const MAX_KEYFRAME_OFFSET = 1;
|
|
@@ -922,15 +1342,15 @@ class AnimationAstBuilderVisitor {
|
|
|
922
1342
|
return style;
|
|
923
1343
|
});
|
|
924
1344
|
if (keyframesOutOfRange) {
|
|
925
|
-
context.errors.push(
|
|
1345
|
+
context.errors.push(invalidOffset());
|
|
926
1346
|
}
|
|
927
1347
|
if (offsetsOutOfOrder) {
|
|
928
|
-
context.errors.push(
|
|
1348
|
+
context.errors.push(keyframeOffsetsOutOfOrder());
|
|
929
1349
|
}
|
|
930
1350
|
const length = metadata.steps.length;
|
|
931
1351
|
let generatedOffset = 0;
|
|
932
1352
|
if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) {
|
|
933
|
-
context.errors.push(
|
|
1353
|
+
context.errors.push(keyframesMissingOffsets());
|
|
934
1354
|
}
|
|
935
1355
|
else if (totalKeyframesWithOffsets == 0) {
|
|
936
1356
|
generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1);
|
|
@@ -996,7 +1416,7 @@ class AnimationAstBuilderVisitor {
|
|
|
996
1416
|
}
|
|
997
1417
|
visitStagger(metadata, context) {
|
|
998
1418
|
if (!context.currentQuery) {
|
|
999
|
-
context.errors.push(
|
|
1419
|
+
context.errors.push(invalidStagger());
|
|
1000
1420
|
}
|
|
1001
1421
|
const timings = metadata.timings === 'full' ?
|
|
1002
1422
|
{ duration: 0, delay: 0, easing: 'full' } :
|
|
@@ -1017,7 +1437,7 @@ function normalizeSelector(selector) {
|
|
|
1017
1437
|
// Note: the :enter and :leave aren't normalized here since those
|
|
1018
1438
|
// selectors are filled in at runtime during timeline building
|
|
1019
1439
|
selector = selector.replace(/@\*/g, NG_TRIGGER_SELECTOR)
|
|
1020
|
-
.replace(/@\w+/g, match => NG_TRIGGER_SELECTOR + '-' + match.
|
|
1440
|
+
.replace(/@\w+/g, match => NG_TRIGGER_SELECTOR + '-' + match.slice(1))
|
|
1021
1441
|
.replace(/:animating/g, NG_ANIMATING_SELECTOR);
|
|
1022
1442
|
return [selector, hasAmpersand];
|
|
1023
1443
|
}
|
|
@@ -1036,6 +1456,8 @@ class AnimationAstBuilderContext {
|
|
|
1036
1456
|
this.currentTime = 0;
|
|
1037
1457
|
this.collectedStyles = new Map();
|
|
1038
1458
|
this.options = null;
|
|
1459
|
+
this.unsupportedCSSPropertiesFound = new Set();
|
|
1460
|
+
this.nonAnimatableCSSPropertiesFound = new Set();
|
|
1039
1461
|
}
|
|
1040
1462
|
}
|
|
1041
1463
|
function consumeOffset(styles) {
|
|
@@ -1059,11 +1481,10 @@ function consumeOffset(styles) {
|
|
|
1059
1481
|
return offset;
|
|
1060
1482
|
}
|
|
1061
1483
|
function constructTimingAst(value, errors) {
|
|
1062
|
-
let timings = null;
|
|
1063
1484
|
if (value.hasOwnProperty('duration')) {
|
|
1064
|
-
|
|
1485
|
+
return value;
|
|
1065
1486
|
}
|
|
1066
|
-
|
|
1487
|
+
if (typeof value == 'number') {
|
|
1067
1488
|
const duration = resolveTiming(value, errors).duration;
|
|
1068
1489
|
return makeTimingAst(duration, 0, '');
|
|
1069
1490
|
}
|
|
@@ -1075,7 +1496,7 @@ function constructTimingAst(value, errors) {
|
|
|
1075
1496
|
ast.strValue = strValue;
|
|
1076
1497
|
return ast;
|
|
1077
1498
|
}
|
|
1078
|
-
timings =
|
|
1499
|
+
const timings = resolveTiming(strValue, errors);
|
|
1079
1500
|
return makeTimingAst(timings.duration, timings.delay, timings.easing);
|
|
1080
1501
|
}
|
|
1081
1502
|
function normalizeAnimationOptions(options) {
|
|
@@ -1230,6 +1651,8 @@ class AnimationTimelineBuilderVisitor {
|
|
|
1230
1651
|
subInstructions = subInstructions || new ElementInstructionMap();
|
|
1231
1652
|
const context = new AnimationTimelineContext(driver, rootElement, subInstructions, enterClassName, leaveClassName, errors, []);
|
|
1232
1653
|
context.options = options;
|
|
1654
|
+
const delay = options.delay ? resolveTimingValue(options.delay) : 0;
|
|
1655
|
+
context.currentTimeline.delayNextStep(delay);
|
|
1233
1656
|
context.currentTimeline.setStyles([startingStyles], null, context.errors, options);
|
|
1234
1657
|
visitDslNode(this, ast, context);
|
|
1235
1658
|
// this checks to see if an actual animation happened
|
|
@@ -1251,8 +1674,9 @@ class AnimationTimelineBuilderVisitor {
|
|
|
1251
1674
|
lastRootTimeline.setStyles([finalStyles], null, context.errors, options);
|
|
1252
1675
|
}
|
|
1253
1676
|
}
|
|
1254
|
-
return timelines.length ?
|
|
1255
|
-
|
|
1677
|
+
return timelines.length ?
|
|
1678
|
+
timelines.map(timeline => timeline.buildKeyframes()) :
|
|
1679
|
+
[createTimelineInstruction(rootElement, [], [], [], 0, delay, '', false)];
|
|
1256
1680
|
}
|
|
1257
1681
|
visitTrigger(ast, context) {
|
|
1258
1682
|
// these values are not visited in this AST
|
|
@@ -1611,7 +2035,7 @@ class AnimationTimelineContext {
|
|
|
1611
2035
|
results.push(...elements);
|
|
1612
2036
|
}
|
|
1613
2037
|
if (!optional && results.length == 0) {
|
|
1614
|
-
errors.push(
|
|
2038
|
+
errors.push(invalidQuery(originalSelector));
|
|
1615
2039
|
}
|
|
1616
2040
|
return results;
|
|
1617
2041
|
}
|
|
@@ -1889,10 +2313,13 @@ class Animation {
|
|
|
1889
2313
|
constructor(_driver, input) {
|
|
1890
2314
|
this._driver = _driver;
|
|
1891
2315
|
const errors = [];
|
|
1892
|
-
const
|
|
2316
|
+
const warnings = [];
|
|
2317
|
+
const ast = buildAnimationAst(_driver, input, errors, warnings);
|
|
1893
2318
|
if (errors.length) {
|
|
1894
|
-
|
|
1895
|
-
|
|
2319
|
+
throw validationFailed(errors);
|
|
2320
|
+
}
|
|
2321
|
+
if (warnings.length) {
|
|
2322
|
+
warnValidation(warnings);
|
|
1896
2323
|
}
|
|
1897
2324
|
this._animationAst = ast;
|
|
1898
2325
|
}
|
|
@@ -1905,8 +2332,7 @@ class Animation {
|
|
|
1905
2332
|
subInstructions = subInstructions || new ElementInstructionMap();
|
|
1906
2333
|
const result = buildAnimationTimelines(this._driver, element, this._animationAst, ENTER_CLASSNAME, LEAVE_CLASSNAME, start, dest, options, subInstructions, errors);
|
|
1907
2334
|
if (errors.length) {
|
|
1908
|
-
|
|
1909
|
-
throw new Error(errorMessage);
|
|
2335
|
+
throw buildingFailed(errors);
|
|
1910
2336
|
}
|
|
1911
2337
|
return result;
|
|
1912
2338
|
}
|
|
@@ -1988,7 +2414,7 @@ class WebAnimationsStyleNormalizer extends AnimationStyleNormalizer {
|
|
|
1988
2414
|
else {
|
|
1989
2415
|
const valAndSuffixMatch = value.match(/^[+-]?[\d\.]+([a-z]*)$/);
|
|
1990
2416
|
if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) {
|
|
1991
|
-
errors.push(
|
|
2417
|
+
errors.push(invalidCssUnitValue(userProvidedProperty, value));
|
|
1992
2418
|
}
|
|
1993
2419
|
}
|
|
1994
2420
|
}
|
|
@@ -2050,7 +2476,10 @@ class AnimationTransitionFactory {
|
|
|
2050
2476
|
const preStyleMap = new Map();
|
|
2051
2477
|
const postStyleMap = new Map();
|
|
2052
2478
|
const isRemoval = nextState === 'void';
|
|
2053
|
-
const animationOptions = {
|
|
2479
|
+
const animationOptions = {
|
|
2480
|
+
params: applyParamDefaults(nextAnimationParams, transitionAnimationParams),
|
|
2481
|
+
delay: this.ast.options?.delay,
|
|
2482
|
+
};
|
|
2054
2483
|
const timelines = skipAstBuild ?
|
|
2055
2484
|
[] :
|
|
2056
2485
|
buildAnimationTimelines(driver, element, this.ast.animation, enterClassName, leaveClassName, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors);
|
|
@@ -2078,6 +2507,15 @@ class AnimationTransitionFactory {
|
|
|
2078
2507
|
function oneOrMoreTransitionsMatch(matchFns, currentState, nextState, element, params) {
|
|
2079
2508
|
return matchFns.some(fn => fn(currentState, nextState, element, params));
|
|
2080
2509
|
}
|
|
2510
|
+
function applyParamDefaults(userParams, defaults) {
|
|
2511
|
+
const result = copyObj(defaults);
|
|
2512
|
+
for (const key in userParams) {
|
|
2513
|
+
if (userParams.hasOwnProperty(key) && userParams[key] != null) {
|
|
2514
|
+
result[key] = userParams[key];
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
return result;
|
|
2518
|
+
}
|
|
2081
2519
|
class AnimationStateStyles {
|
|
2082
2520
|
constructor(styles, defaultParams, normalizer) {
|
|
2083
2521
|
this.styles = styles;
|
|
@@ -2184,11 +2622,15 @@ class TimelineAnimationEngine {
|
|
|
2184
2622
|
}
|
|
2185
2623
|
register(id, metadata) {
|
|
2186
2624
|
const errors = [];
|
|
2187
|
-
const
|
|
2625
|
+
const warnings = [];
|
|
2626
|
+
const ast = buildAnimationAst(this._driver, metadata, errors, warnings);
|
|
2188
2627
|
if (errors.length) {
|
|
2189
|
-
throw
|
|
2628
|
+
throw registerFailed(errors);
|
|
2190
2629
|
}
|
|
2191
2630
|
else {
|
|
2631
|
+
if (warnings.length) {
|
|
2632
|
+
warnRegister(warnings);
|
|
2633
|
+
}
|
|
2192
2634
|
this._animations.set(id, ast);
|
|
2193
2635
|
}
|
|
2194
2636
|
}
|
|
@@ -2210,11 +2652,11 @@ class TimelineAnimationEngine {
|
|
|
2210
2652
|
});
|
|
2211
2653
|
}
|
|
2212
2654
|
else {
|
|
2213
|
-
errors.push(
|
|
2655
|
+
errors.push(missingOrDestroyedAnimation());
|
|
2214
2656
|
instructions = [];
|
|
2215
2657
|
}
|
|
2216
2658
|
if (errors.length) {
|
|
2217
|
-
throw
|
|
2659
|
+
throw createAnimationFailed(errors);
|
|
2218
2660
|
}
|
|
2219
2661
|
autoStylesMap.forEach((styles, element) => {
|
|
2220
2662
|
styles.forEach((_, prop) => {
|
|
@@ -2243,7 +2685,7 @@ class TimelineAnimationEngine {
|
|
|
2243
2685
|
_getPlayer(id) {
|
|
2244
2686
|
const player = this._playersById.get(id);
|
|
2245
2687
|
if (!player) {
|
|
2246
|
-
throw
|
|
2688
|
+
throw missingPlayer(id);
|
|
2247
2689
|
}
|
|
2248
2690
|
return player;
|
|
2249
2691
|
}
|
|
@@ -2371,13 +2813,13 @@ class AnimationTransitionNamespace {
|
|
|
2371
2813
|
}
|
|
2372
2814
|
listen(element, name, phase, callback) {
|
|
2373
2815
|
if (!this._triggers.has(name)) {
|
|
2374
|
-
throw
|
|
2816
|
+
throw missingTrigger(phase, name);
|
|
2375
2817
|
}
|
|
2376
2818
|
if (phase == null || phase.length == 0) {
|
|
2377
|
-
throw
|
|
2819
|
+
throw missingEvent(name);
|
|
2378
2820
|
}
|
|
2379
2821
|
if (!isTriggerEventValid(phase)) {
|
|
2380
|
-
throw
|
|
2822
|
+
throw unsupportedTriggerEvent(phase, name);
|
|
2381
2823
|
}
|
|
2382
2824
|
const listeners = getOrSetDefaultValue(this._elementListeners, element, []);
|
|
2383
2825
|
const data = { name, phase, callback };
|
|
@@ -2416,7 +2858,7 @@ class AnimationTransitionNamespace {
|
|
|
2416
2858
|
_getTrigger(name) {
|
|
2417
2859
|
const trigger = this._triggers.get(name);
|
|
2418
2860
|
if (!trigger) {
|
|
2419
|
-
throw
|
|
2861
|
+
throw unregisteredTrigger(name);
|
|
2420
2862
|
}
|
|
2421
2863
|
return trigger;
|
|
2422
2864
|
}
|
|
@@ -2770,25 +3212,37 @@ class TransitionAnimationEngine {
|
|
|
2770
3212
|
return this._namespaceLookup[namespaceId] = ns;
|
|
2771
3213
|
}
|
|
2772
3214
|
_balanceNamespaceList(ns, hostElement) {
|
|
2773
|
-
const
|
|
3215
|
+
const namespaceList = this._namespaceList;
|
|
3216
|
+
const namespacesByHostElement = this.namespacesByHostElement;
|
|
3217
|
+
const limit = namespaceList.length - 1;
|
|
2774
3218
|
if (limit >= 0) {
|
|
2775
3219
|
let found = false;
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
3220
|
+
// Find the closest ancestor with an existing namespace so we can then insert `ns` after it,
|
|
3221
|
+
// establishing a top-down ordering of namespaces in `this._namespaceList`.
|
|
3222
|
+
let ancestor = this.driver.getParentElement(hostElement);
|
|
3223
|
+
while (ancestor) {
|
|
3224
|
+
const ancestorNs = namespacesByHostElement.get(ancestor);
|
|
3225
|
+
if (ancestorNs) {
|
|
3226
|
+
// An animation namespace has been registered for this ancestor, so we insert `ns`
|
|
3227
|
+
// right after it to establish top-down ordering of animation namespaces.
|
|
3228
|
+
const index = namespaceList.indexOf(ancestorNs);
|
|
3229
|
+
namespaceList.splice(index + 1, 0, ns);
|
|
2780
3230
|
found = true;
|
|
2781
3231
|
break;
|
|
2782
3232
|
}
|
|
3233
|
+
ancestor = this.driver.getParentElement(ancestor);
|
|
2783
3234
|
}
|
|
2784
3235
|
if (!found) {
|
|
2785
|
-
|
|
3236
|
+
// No namespace exists that is an ancestor of `ns`, so `ns` is inserted at the front to
|
|
3237
|
+
// ensure that any existing descendants are ordered after `ns`, retaining the desired
|
|
3238
|
+
// top-down ordering.
|
|
3239
|
+
namespaceList.unshift(ns);
|
|
2786
3240
|
}
|
|
2787
3241
|
}
|
|
2788
3242
|
else {
|
|
2789
|
-
|
|
3243
|
+
namespaceList.push(ns);
|
|
2790
3244
|
}
|
|
2791
|
-
|
|
3245
|
+
namespacesByHostElement.set(hostElement, ns);
|
|
2792
3246
|
return ns;
|
|
2793
3247
|
}
|
|
2794
3248
|
register(namespaceId, hostElement) {
|
|
@@ -3052,7 +3506,7 @@ class TransitionAnimationEngine {
|
|
|
3052
3506
|
}
|
|
3053
3507
|
}
|
|
3054
3508
|
reportError(errors) {
|
|
3055
|
-
throw
|
|
3509
|
+
throw triggerTransitionsFailed(errors);
|
|
3056
3510
|
}
|
|
3057
3511
|
_flushAnimations(cleanupFns, microtaskId) {
|
|
3058
3512
|
const subTimelines = new ElementInstructionMap();
|
|
@@ -3214,8 +3668,7 @@ class TransitionAnimationEngine {
|
|
|
3214
3668
|
if (erroneousTransitions.length) {
|
|
3215
3669
|
const errors = [];
|
|
3216
3670
|
erroneousTransitions.forEach(instruction => {
|
|
3217
|
-
errors.push(
|
|
3218
|
-
instruction.errors.forEach(error => errors.push(`- ${error}\n`));
|
|
3671
|
+
errors.push(transitionFailed(instruction.triggerName, instruction.errors));
|
|
3219
3672
|
});
|
|
3220
3673
|
allPlayers.forEach(player => player.destroy());
|
|
3221
3674
|
this.reportError(errors);
|
|
@@ -3814,9 +4267,13 @@ class AnimationEngine {
|
|
|
3814
4267
|
let trigger = this._triggerCache[cacheKey];
|
|
3815
4268
|
if (!trigger) {
|
|
3816
4269
|
const errors = [];
|
|
3817
|
-
const
|
|
4270
|
+
const warnings = [];
|
|
4271
|
+
const ast = buildAnimationAst(this._driver, metadata, errors, warnings);
|
|
3818
4272
|
if (errors.length) {
|
|
3819
|
-
throw
|
|
4273
|
+
throw triggerBuildFailed(name, errors);
|
|
4274
|
+
}
|
|
4275
|
+
if (warnings.length) {
|
|
4276
|
+
warnTriggerBuild(name, warnings);
|
|
3820
4277
|
}
|
|
3821
4278
|
trigger = buildTrigger(name, ast, this._normalizer);
|
|
3822
4279
|
this._triggerCache[cacheKey] = trigger;
|
|
@@ -4128,7 +4585,19 @@ class WebAnimationsPlayer {
|
|
|
4128
4585
|
|
|
4129
4586
|
class WebAnimationsDriver {
|
|
4130
4587
|
validateStyleProperty(prop) {
|
|
4131
|
-
|
|
4588
|
+
// Perform actual validation in dev mode only, in prod mode this check is a noop.
|
|
4589
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
4590
|
+
return validateStyleProperty(prop);
|
|
4591
|
+
}
|
|
4592
|
+
return true;
|
|
4593
|
+
}
|
|
4594
|
+
validateAnimatableStyleProperty(prop) {
|
|
4595
|
+
// Perform actual validation in dev mode only, in prod mode this check is a noop.
|
|
4596
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
4597
|
+
const cssProp = camelCaseToDashCase(prop);
|
|
4598
|
+
return validateWebAnimatableStyleProperty(cssProp);
|
|
4599
|
+
}
|
|
4600
|
+
return true;
|
|
4132
4601
|
}
|
|
4133
4602
|
matchesElement(_element, _selector) {
|
|
4134
4603
|
// This method is deprecated and no longer in use so we return false.
|
|
@@ -4137,6 +4606,9 @@ class WebAnimationsDriver {
|
|
|
4137
4606
|
containsElement(elm1, elm2) {
|
|
4138
4607
|
return containsElement(elm1, elm2);
|
|
4139
4608
|
}
|
|
4609
|
+
getParentElement(element) {
|
|
4610
|
+
return getParentElement(element);
|
|
4611
|
+
}
|
|
4140
4612
|
query(element, selector, multi) {
|
|
4141
4613
|
return invokeQuery(element, selector, multi);
|
|
4142
4614
|
}
|
|
@@ -4201,5 +4673,5 @@ class WebAnimationsDriver {
|
|
|
4201
4673
|
* Generated bundle index. Do not edit.
|
|
4202
4674
|
*/
|
|
4203
4675
|
|
|
4204
|
-
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, normalizeKeyframes as ɵnormalizeKeyframes, validateStyleProperty as ɵvalidateStyleProperty };
|
|
4676
|
+
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, getParentElement as ɵgetParentElement, invokeQuery as ɵinvokeQuery, normalizeKeyframes as ɵnormalizeKeyframes, validateStyleProperty as ɵvalidateStyleProperty };
|
|
4205
4677
|
//# sourceMappingURL=browser.mjs.map
|