@angular/animations 17.0.0-next.1 → 17.0.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/index.d.ts +6 -12
- package/browser/testing/index.d.ts +1 -1
- package/esm2022/browser/src/dsl/animation_ast_builder.mjs +2 -2
- package/esm2022/browser/src/dsl/style_normalization/animation_style_normalizer.mjs +1 -7
- package/esm2022/browser/src/private_export.mjs +3 -3
- package/esm2022/browser/src/render/animation_driver.mjs +4 -7
- package/esm2022/browser/src/render/animation_engine_next.mjs +4 -5
- package/esm2022/browser/src/render/transition_animation_engine.mjs +6 -6
- package/esm2022/browser/testing/src/mock_animation_driver.mjs +4 -6
- package/esm2022/src/version.mjs +1 -1
- package/fesm2022/animations.mjs +1 -1
- package/fesm2022/browser/testing.mjs +5 -741
- package/fesm2022/browser/testing.mjs.map +1 -1
- package/fesm2022/browser.mjs +9 -19
- package/fesm2022/browser.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,747 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.0.0-next.
|
|
2
|
+
* @license Angular v17.0.0-next.3
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { ɵvalidateStyleProperty, ɵcontainsElement, ɵgetParentElement, ɵinvokeQuery, ɵnormalizeKeyframes, ɵallowPreviousPlayerStylesMerge } from '@angular/animations/browser';
|
|
9
|
-
import { ɵRuntimeError } from '@angular/core';
|
|
10
|
-
|
|
11
|
-
const LINE_START = '\n - ';
|
|
12
|
-
function invalidTimingValue(exp) {
|
|
13
|
-
return new ɵRuntimeError(3000 /* RuntimeErrorCode.INVALID_TIMING_VALUE */, ngDevMode && `The provided timing value "${exp}" is invalid.`);
|
|
14
|
-
}
|
|
15
|
-
function negativeStepValue() {
|
|
16
|
-
return new ɵRuntimeError(3100 /* RuntimeErrorCode.NEGATIVE_STEP_VALUE */, ngDevMode && 'Duration values below 0 are not allowed for this animation step.');
|
|
17
|
-
}
|
|
18
|
-
function negativeDelayValue() {
|
|
19
|
-
return new ɵRuntimeError(3101 /* RuntimeErrorCode.NEGATIVE_DELAY_VALUE */, ngDevMode && 'Delay values below 0 are not allowed for this animation step.');
|
|
20
|
-
}
|
|
21
|
-
function invalidStyleParams(varName) {
|
|
22
|
-
return new ɵRuntimeError(3001 /* RuntimeErrorCode.INVALID_STYLE_PARAMS */, ngDevMode &&
|
|
23
|
-
`Unable to resolve the local animation param ${varName} in the given list of values`);
|
|
24
|
-
}
|
|
25
|
-
function invalidParamValue(varName) {
|
|
26
|
-
return new ɵRuntimeError(3003 /* RuntimeErrorCode.INVALID_PARAM_VALUE */, ngDevMode && `Please provide a value for the animation param ${varName}`);
|
|
27
|
-
}
|
|
28
|
-
function invalidNodeType(nodeType) {
|
|
29
|
-
return new ɵRuntimeError(3004 /* RuntimeErrorCode.INVALID_NODE_TYPE */, ngDevMode && `Unable to resolve animation metadata node #${nodeType}`);
|
|
30
|
-
}
|
|
31
|
-
function invalidCssUnitValue(userProvidedProperty, value) {
|
|
32
|
-
return new ɵRuntimeError(3005 /* RuntimeErrorCode.INVALID_CSS_UNIT_VALUE */, ngDevMode && `Please provide a CSS unit value for ${userProvidedProperty}:${value}`);
|
|
33
|
-
}
|
|
34
|
-
function invalidTrigger() {
|
|
35
|
-
return new ɵRuntimeError(3006 /* RuntimeErrorCode.INVALID_TRIGGER */, ngDevMode &&
|
|
36
|
-
'animation triggers cannot be prefixed with an `@` sign (e.g. trigger(\'@foo\', [...]))');
|
|
37
|
-
}
|
|
38
|
-
function invalidDefinition() {
|
|
39
|
-
return new ɵRuntimeError(3007 /* RuntimeErrorCode.INVALID_DEFINITION */, ngDevMode && 'only state() and transition() definitions can sit inside of a trigger()');
|
|
40
|
-
}
|
|
41
|
-
function invalidState(metadataName, missingSubs) {
|
|
42
|
-
return new ɵRuntimeError(3008 /* RuntimeErrorCode.INVALID_STATE */, ngDevMode &&
|
|
43
|
-
`state("${metadataName}", ...) must define default values for all the following style substitutions: ${missingSubs.join(', ')}`);
|
|
44
|
-
}
|
|
45
|
-
function invalidStyleValue(value) {
|
|
46
|
-
return new ɵRuntimeError(3002 /* RuntimeErrorCode.INVALID_STYLE_VALUE */, ngDevMode && `The provided style string value ${value} is not allowed.`);
|
|
47
|
-
}
|
|
48
|
-
function invalidProperty(prop) {
|
|
49
|
-
return new ɵRuntimeError(3009 /* RuntimeErrorCode.INVALID_PROPERTY */, ngDevMode &&
|
|
50
|
-
`The provided animation property "${prop}" is not a supported CSS property for animations`);
|
|
51
|
-
}
|
|
52
|
-
function invalidParallelAnimation(prop, firstStart, firstEnd, secondStart, secondEnd) {
|
|
53
|
-
return new ɵRuntimeError(3010 /* RuntimeErrorCode.INVALID_PARALLEL_ANIMATION */, ngDevMode &&
|
|
54
|
-
`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"`);
|
|
55
|
-
}
|
|
56
|
-
function invalidKeyframes() {
|
|
57
|
-
return new ɵRuntimeError(3011 /* RuntimeErrorCode.INVALID_KEYFRAMES */, ngDevMode && `keyframes() must be placed inside of a call to animate()`);
|
|
58
|
-
}
|
|
59
|
-
function invalidOffset() {
|
|
60
|
-
return new ɵRuntimeError(3012 /* RuntimeErrorCode.INVALID_OFFSET */, ngDevMode && `Please ensure that all keyframe offsets are between 0 and 1`);
|
|
61
|
-
}
|
|
62
|
-
function keyframeOffsetsOutOfOrder() {
|
|
63
|
-
return new ɵRuntimeError(3200 /* RuntimeErrorCode.KEYFRAME_OFFSETS_OUT_OF_ORDER */, ngDevMode && `Please ensure that all keyframe offsets are in order`);
|
|
64
|
-
}
|
|
65
|
-
function keyframesMissingOffsets() {
|
|
66
|
-
return new ɵRuntimeError(3202 /* RuntimeErrorCode.KEYFRAMES_MISSING_OFFSETS */, ngDevMode && `Not all style() steps within the declared keyframes() contain offsets`);
|
|
67
|
-
}
|
|
68
|
-
function invalidStagger() {
|
|
69
|
-
return new ɵRuntimeError(3013 /* RuntimeErrorCode.INVALID_STAGGER */, ngDevMode && `stagger() can only be used inside of query()`);
|
|
70
|
-
}
|
|
71
|
-
function invalidQuery(selector) {
|
|
72
|
-
return new ɵRuntimeError(3014 /* RuntimeErrorCode.INVALID_QUERY */, ngDevMode &&
|
|
73
|
-
`\`query("${selector}")\` returned zero elements. (Use \`query("${selector}", { optional: true })\` if you wish to allow this.)`);
|
|
74
|
-
}
|
|
75
|
-
function invalidExpression(expr) {
|
|
76
|
-
return new ɵRuntimeError(3015 /* RuntimeErrorCode.INVALID_EXPRESSION */, ngDevMode && `The provided transition expression "${expr}" is not supported`);
|
|
77
|
-
}
|
|
78
|
-
function invalidTransitionAlias(alias) {
|
|
79
|
-
return new ɵRuntimeError(3016 /* RuntimeErrorCode.INVALID_TRANSITION_ALIAS */, ngDevMode && `The transition alias value "${alias}" is not supported`);
|
|
80
|
-
}
|
|
81
|
-
function validationFailed(errors) {
|
|
82
|
-
return new ɵRuntimeError(3500 /* RuntimeErrorCode.VALIDATION_FAILED */, ngDevMode && `animation validation failed:\n${errors.map(err => err.message).join('\n')}`);
|
|
83
|
-
}
|
|
84
|
-
function buildingFailed(errors) {
|
|
85
|
-
return new ɵRuntimeError(3501 /* RuntimeErrorCode.BUILDING_FAILED */, ngDevMode && `animation building failed:\n${errors.map(err => err.message).join('\n')}`);
|
|
86
|
-
}
|
|
87
|
-
function triggerBuildFailed(name, errors) {
|
|
88
|
-
return new ɵRuntimeError(3404 /* RuntimeErrorCode.TRIGGER_BUILD_FAILED */, ngDevMode &&
|
|
89
|
-
`The animation trigger "${name}" has failed to build due to the following errors:\n - ${errors.map(err => err.message).join('\n - ')}`);
|
|
90
|
-
}
|
|
91
|
-
function animationFailed(errors) {
|
|
92
|
-
return new ɵRuntimeError(3502 /* RuntimeErrorCode.ANIMATION_FAILED */, ngDevMode &&
|
|
93
|
-
`Unable to animate due to the following errors:${LINE_START}${errors.map(err => err.message).join(LINE_START)}`);
|
|
94
|
-
}
|
|
95
|
-
function registerFailed(errors) {
|
|
96
|
-
return new ɵRuntimeError(3503 /* RuntimeErrorCode.REGISTRATION_FAILED */, ngDevMode &&
|
|
97
|
-
`Unable to build the animation due to the following errors: ${errors.map(err => err.message).join('\n')}`);
|
|
98
|
-
}
|
|
99
|
-
function missingOrDestroyedAnimation() {
|
|
100
|
-
return new ɵRuntimeError(3300 /* RuntimeErrorCode.MISSING_OR_DESTROYED_ANIMATION */, ngDevMode && 'The requested animation doesn\'t exist or has already been destroyed');
|
|
101
|
-
}
|
|
102
|
-
function createAnimationFailed(errors) {
|
|
103
|
-
return new ɵRuntimeError(3504 /* RuntimeErrorCode.CREATE_ANIMATION_FAILED */, ngDevMode &&
|
|
104
|
-
`Unable to create the animation due to the following errors:${errors.map(err => err.message).join('\n')}`);
|
|
105
|
-
}
|
|
106
|
-
function missingPlayer(id) {
|
|
107
|
-
return new ɵRuntimeError(3301 /* RuntimeErrorCode.MISSING_PLAYER */, ngDevMode && `Unable to find the timeline player referenced by ${id}`);
|
|
108
|
-
}
|
|
109
|
-
function missingTrigger(phase, name) {
|
|
110
|
-
return new ɵRuntimeError(3302 /* RuntimeErrorCode.MISSING_TRIGGER */, ngDevMode &&
|
|
111
|
-
`Unable to listen on the animation trigger event "${phase}" because the animation trigger "${name}" doesn\'t exist!`);
|
|
112
|
-
}
|
|
113
|
-
function missingEvent(name) {
|
|
114
|
-
return new ɵRuntimeError(3303 /* RuntimeErrorCode.MISSING_EVENT */, ngDevMode &&
|
|
115
|
-
`Unable to listen on the animation trigger "${name}" because the provided event is undefined!`);
|
|
116
|
-
}
|
|
117
|
-
function unsupportedTriggerEvent(phase, name) {
|
|
118
|
-
return new ɵRuntimeError(3400 /* RuntimeErrorCode.UNSUPPORTED_TRIGGER_EVENT */, ngDevMode &&
|
|
119
|
-
`The provided animation trigger event "${phase}" for the animation trigger "${name}" is not supported!`);
|
|
120
|
-
}
|
|
121
|
-
function unregisteredTrigger(name) {
|
|
122
|
-
return new ɵRuntimeError(3401 /* RuntimeErrorCode.UNREGISTERED_TRIGGER */, ngDevMode && `The provided animation trigger "${name}" has not been registered!`);
|
|
123
|
-
}
|
|
124
|
-
function triggerTransitionsFailed(errors) {
|
|
125
|
-
return new ɵRuntimeError(3402 /* RuntimeErrorCode.TRIGGER_TRANSITIONS_FAILED */, ngDevMode &&
|
|
126
|
-
`Unable to process animations due to the following failed trigger transitions\n ${errors.map(err => err.message).join('\n')}`);
|
|
127
|
-
}
|
|
128
|
-
function triggerParsingFailed(name, errors) {
|
|
129
|
-
return new ɵRuntimeError(3403 /* RuntimeErrorCode.TRIGGER_PARSING_FAILED */, ngDevMode &&
|
|
130
|
-
`Animation parsing for the ${name} trigger have failed:${LINE_START}${errors.map(err => err.message).join(LINE_START)}`);
|
|
131
|
-
}
|
|
132
|
-
function transitionFailed(name, errors) {
|
|
133
|
-
return new ɵRuntimeError(3505 /* RuntimeErrorCode.TRANSITION_FAILED */, ngDevMode && `@${name} has failed due to:\n ${errors.map(err => err.message).join('\n- ')}`);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Set of all animatable CSS properties
|
|
138
|
-
*
|
|
139
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties
|
|
140
|
-
*/
|
|
141
|
-
const ANIMATABLE_PROP_SET = new Set([
|
|
142
|
-
'-moz-outline-radius',
|
|
143
|
-
'-moz-outline-radius-bottomleft',
|
|
144
|
-
'-moz-outline-radius-bottomright',
|
|
145
|
-
'-moz-outline-radius-topleft',
|
|
146
|
-
'-moz-outline-radius-topright',
|
|
147
|
-
'-ms-grid-columns',
|
|
148
|
-
'-ms-grid-rows',
|
|
149
|
-
'-webkit-line-clamp',
|
|
150
|
-
'-webkit-text-fill-color',
|
|
151
|
-
'-webkit-text-stroke',
|
|
152
|
-
'-webkit-text-stroke-color',
|
|
153
|
-
'accent-color',
|
|
154
|
-
'all',
|
|
155
|
-
'backdrop-filter',
|
|
156
|
-
'background',
|
|
157
|
-
'background-color',
|
|
158
|
-
'background-position',
|
|
159
|
-
'background-size',
|
|
160
|
-
'block-size',
|
|
161
|
-
'border',
|
|
162
|
-
'border-block-end',
|
|
163
|
-
'border-block-end-color',
|
|
164
|
-
'border-block-end-width',
|
|
165
|
-
'border-block-start',
|
|
166
|
-
'border-block-start-color',
|
|
167
|
-
'border-block-start-width',
|
|
168
|
-
'border-bottom',
|
|
169
|
-
'border-bottom-color',
|
|
170
|
-
'border-bottom-left-radius',
|
|
171
|
-
'border-bottom-right-radius',
|
|
172
|
-
'border-bottom-width',
|
|
173
|
-
'border-color',
|
|
174
|
-
'border-end-end-radius',
|
|
175
|
-
'border-end-start-radius',
|
|
176
|
-
'border-image-outset',
|
|
177
|
-
'border-image-slice',
|
|
178
|
-
'border-image-width',
|
|
179
|
-
'border-inline-end',
|
|
180
|
-
'border-inline-end-color',
|
|
181
|
-
'border-inline-end-width',
|
|
182
|
-
'border-inline-start',
|
|
183
|
-
'border-inline-start-color',
|
|
184
|
-
'border-inline-start-width',
|
|
185
|
-
'border-left',
|
|
186
|
-
'border-left-color',
|
|
187
|
-
'border-left-width',
|
|
188
|
-
'border-radius',
|
|
189
|
-
'border-right',
|
|
190
|
-
'border-right-color',
|
|
191
|
-
'border-right-width',
|
|
192
|
-
'border-start-end-radius',
|
|
193
|
-
'border-start-start-radius',
|
|
194
|
-
'border-top',
|
|
195
|
-
'border-top-color',
|
|
196
|
-
'border-top-left-radius',
|
|
197
|
-
'border-top-right-radius',
|
|
198
|
-
'border-top-width',
|
|
199
|
-
'border-width',
|
|
200
|
-
'bottom',
|
|
201
|
-
'box-shadow',
|
|
202
|
-
'caret-color',
|
|
203
|
-
'clip',
|
|
204
|
-
'clip-path',
|
|
205
|
-
'color',
|
|
206
|
-
'column-count',
|
|
207
|
-
'column-gap',
|
|
208
|
-
'column-rule',
|
|
209
|
-
'column-rule-color',
|
|
210
|
-
'column-rule-width',
|
|
211
|
-
'column-width',
|
|
212
|
-
'columns',
|
|
213
|
-
'filter',
|
|
214
|
-
'flex',
|
|
215
|
-
'flex-basis',
|
|
216
|
-
'flex-grow',
|
|
217
|
-
'flex-shrink',
|
|
218
|
-
'font',
|
|
219
|
-
'font-size',
|
|
220
|
-
'font-size-adjust',
|
|
221
|
-
'font-stretch',
|
|
222
|
-
'font-variation-settings',
|
|
223
|
-
'font-weight',
|
|
224
|
-
'gap',
|
|
225
|
-
'grid-column-gap',
|
|
226
|
-
'grid-gap',
|
|
227
|
-
'grid-row-gap',
|
|
228
|
-
'grid-template-columns',
|
|
229
|
-
'grid-template-rows',
|
|
230
|
-
'height',
|
|
231
|
-
'inline-size',
|
|
232
|
-
'input-security',
|
|
233
|
-
'inset',
|
|
234
|
-
'inset-block',
|
|
235
|
-
'inset-block-end',
|
|
236
|
-
'inset-block-start',
|
|
237
|
-
'inset-inline',
|
|
238
|
-
'inset-inline-end',
|
|
239
|
-
'inset-inline-start',
|
|
240
|
-
'left',
|
|
241
|
-
'letter-spacing',
|
|
242
|
-
'line-clamp',
|
|
243
|
-
'line-height',
|
|
244
|
-
'margin',
|
|
245
|
-
'margin-block-end',
|
|
246
|
-
'margin-block-start',
|
|
247
|
-
'margin-bottom',
|
|
248
|
-
'margin-inline-end',
|
|
249
|
-
'margin-inline-start',
|
|
250
|
-
'margin-left',
|
|
251
|
-
'margin-right',
|
|
252
|
-
'margin-top',
|
|
253
|
-
'mask',
|
|
254
|
-
'mask-border',
|
|
255
|
-
'mask-position',
|
|
256
|
-
'mask-size',
|
|
257
|
-
'max-block-size',
|
|
258
|
-
'max-height',
|
|
259
|
-
'max-inline-size',
|
|
260
|
-
'max-lines',
|
|
261
|
-
'max-width',
|
|
262
|
-
'min-block-size',
|
|
263
|
-
'min-height',
|
|
264
|
-
'min-inline-size',
|
|
265
|
-
'min-width',
|
|
266
|
-
'object-position',
|
|
267
|
-
'offset',
|
|
268
|
-
'offset-anchor',
|
|
269
|
-
'offset-distance',
|
|
270
|
-
'offset-path',
|
|
271
|
-
'offset-position',
|
|
272
|
-
'offset-rotate',
|
|
273
|
-
'opacity',
|
|
274
|
-
'order',
|
|
275
|
-
'outline',
|
|
276
|
-
'outline-color',
|
|
277
|
-
'outline-offset',
|
|
278
|
-
'outline-width',
|
|
279
|
-
'padding',
|
|
280
|
-
'padding-block-end',
|
|
281
|
-
'padding-block-start',
|
|
282
|
-
'padding-bottom',
|
|
283
|
-
'padding-inline-end',
|
|
284
|
-
'padding-inline-start',
|
|
285
|
-
'padding-left',
|
|
286
|
-
'padding-right',
|
|
287
|
-
'padding-top',
|
|
288
|
-
'perspective',
|
|
289
|
-
'perspective-origin',
|
|
290
|
-
'right',
|
|
291
|
-
'rotate',
|
|
292
|
-
'row-gap',
|
|
293
|
-
'scale',
|
|
294
|
-
'scroll-margin',
|
|
295
|
-
'scroll-margin-block',
|
|
296
|
-
'scroll-margin-block-end',
|
|
297
|
-
'scroll-margin-block-start',
|
|
298
|
-
'scroll-margin-bottom',
|
|
299
|
-
'scroll-margin-inline',
|
|
300
|
-
'scroll-margin-inline-end',
|
|
301
|
-
'scroll-margin-inline-start',
|
|
302
|
-
'scroll-margin-left',
|
|
303
|
-
'scroll-margin-right',
|
|
304
|
-
'scroll-margin-top',
|
|
305
|
-
'scroll-padding',
|
|
306
|
-
'scroll-padding-block',
|
|
307
|
-
'scroll-padding-block-end',
|
|
308
|
-
'scroll-padding-block-start',
|
|
309
|
-
'scroll-padding-bottom',
|
|
310
|
-
'scroll-padding-inline',
|
|
311
|
-
'scroll-padding-inline-end',
|
|
312
|
-
'scroll-padding-inline-start',
|
|
313
|
-
'scroll-padding-left',
|
|
314
|
-
'scroll-padding-right',
|
|
315
|
-
'scroll-padding-top',
|
|
316
|
-
'scroll-snap-coordinate',
|
|
317
|
-
'scroll-snap-destination',
|
|
318
|
-
'scrollbar-color',
|
|
319
|
-
'shape-image-threshold',
|
|
320
|
-
'shape-margin',
|
|
321
|
-
'shape-outside',
|
|
322
|
-
'tab-size',
|
|
323
|
-
'text-decoration',
|
|
324
|
-
'text-decoration-color',
|
|
325
|
-
'text-decoration-thickness',
|
|
326
|
-
'text-emphasis',
|
|
327
|
-
'text-emphasis-color',
|
|
328
|
-
'text-indent',
|
|
329
|
-
'text-shadow',
|
|
330
|
-
'text-underline-offset',
|
|
331
|
-
'top',
|
|
332
|
-
'transform',
|
|
333
|
-
'transform-origin',
|
|
334
|
-
'translate',
|
|
335
|
-
'vertical-align',
|
|
336
|
-
'visibility',
|
|
337
|
-
'width',
|
|
338
|
-
'word-spacing',
|
|
339
|
-
'z-index',
|
|
340
|
-
'zoom',
|
|
341
|
-
]);
|
|
342
|
-
|
|
343
|
-
function optimizeGroupPlayer(players) {
|
|
344
|
-
switch (players.length) {
|
|
345
|
-
case 0:
|
|
346
|
-
return new NoopAnimationPlayer();
|
|
347
|
-
case 1:
|
|
348
|
-
return players[0];
|
|
349
|
-
default:
|
|
350
|
-
return new ɵAnimationGroupPlayer(players);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
function normalizeKeyframes$1(normalizer, keyframes, preStyles = new Map(), postStyles = new Map()) {
|
|
354
|
-
const errors = [];
|
|
355
|
-
const normalizedKeyframes = [];
|
|
356
|
-
let previousOffset = -1;
|
|
357
|
-
let previousKeyframe = null;
|
|
358
|
-
keyframes.forEach(kf => {
|
|
359
|
-
const offset = kf.get('offset');
|
|
360
|
-
const isSameOffset = offset == previousOffset;
|
|
361
|
-
const normalizedKeyframe = (isSameOffset && previousKeyframe) || new Map();
|
|
362
|
-
kf.forEach((val, prop) => {
|
|
363
|
-
let normalizedProp = prop;
|
|
364
|
-
let normalizedValue = val;
|
|
365
|
-
if (prop !== 'offset') {
|
|
366
|
-
normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors);
|
|
367
|
-
switch (normalizedValue) {
|
|
368
|
-
case ɵPRE_STYLE:
|
|
369
|
-
normalizedValue = preStyles.get(prop);
|
|
370
|
-
break;
|
|
371
|
-
case AUTO_STYLE:
|
|
372
|
-
normalizedValue = postStyles.get(prop);
|
|
373
|
-
break;
|
|
374
|
-
default:
|
|
375
|
-
normalizedValue =
|
|
376
|
-
normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors);
|
|
377
|
-
break;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
normalizedKeyframe.set(normalizedProp, normalizedValue);
|
|
381
|
-
});
|
|
382
|
-
if (!isSameOffset) {
|
|
383
|
-
normalizedKeyframes.push(normalizedKeyframe);
|
|
384
|
-
}
|
|
385
|
-
previousKeyframe = normalizedKeyframe;
|
|
386
|
-
previousOffset = offset;
|
|
387
|
-
});
|
|
388
|
-
if (errors.length) {
|
|
389
|
-
throw animationFailed(errors);
|
|
390
|
-
}
|
|
391
|
-
return normalizedKeyframes;
|
|
392
|
-
}
|
|
393
|
-
function listenOnPlayer(player, eventName, event, callback) {
|
|
394
|
-
switch (eventName) {
|
|
395
|
-
case 'start':
|
|
396
|
-
player.onStart(() => callback(event && copyAnimationEvent(event, 'start', player)));
|
|
397
|
-
break;
|
|
398
|
-
case 'done':
|
|
399
|
-
player.onDone(() => callback(event && copyAnimationEvent(event, 'done', player)));
|
|
400
|
-
break;
|
|
401
|
-
case 'destroy':
|
|
402
|
-
player.onDestroy(() => callback(event && copyAnimationEvent(event, 'destroy', player)));
|
|
403
|
-
break;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
function copyAnimationEvent(e, phaseName, player) {
|
|
407
|
-
const totalTime = player.totalTime;
|
|
408
|
-
const disabled = player.disabled ? true : false;
|
|
409
|
-
const event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime, disabled);
|
|
410
|
-
const data = e['_data'];
|
|
411
|
-
if (data != null) {
|
|
412
|
-
event['_data'] = data;
|
|
413
|
-
}
|
|
414
|
-
return event;
|
|
415
|
-
}
|
|
416
|
-
function makeAnimationEvent(element, triggerName, fromState, toState, phaseName = '', totalTime = 0, disabled) {
|
|
417
|
-
return { element, triggerName, fromState, toState, phaseName, totalTime, disabled: !!disabled };
|
|
418
|
-
}
|
|
419
|
-
function getOrSetDefaultValue(map, key, defaultValue) {
|
|
420
|
-
let value = map.get(key);
|
|
421
|
-
if (!value) {
|
|
422
|
-
map.set(key, value = defaultValue);
|
|
423
|
-
}
|
|
424
|
-
return value;
|
|
425
|
-
}
|
|
426
|
-
function parseTimelineCommand(command) {
|
|
427
|
-
const separatorPos = command.indexOf(':');
|
|
428
|
-
const id = command.substring(1, separatorPos);
|
|
429
|
-
const action = command.slice(separatorPos + 1);
|
|
430
|
-
return [id, action];
|
|
431
|
-
}
|
|
432
|
-
const documentElement =
|
|
433
|
-
/* @__PURE__ */ (() => typeof document === 'undefined' ? null : document.documentElement)();
|
|
434
|
-
function getParentElement(element) {
|
|
435
|
-
const parent = element.parentNode || element.host || null; // consider host to support shadow DOM
|
|
436
|
-
if (parent === documentElement) {
|
|
437
|
-
return null;
|
|
438
|
-
}
|
|
439
|
-
return parent;
|
|
440
|
-
}
|
|
441
|
-
function containsVendorPrefix(prop) {
|
|
442
|
-
// Webkit is the only real popular vendor prefix nowadays
|
|
443
|
-
// cc: http://shouldiprefix.com/
|
|
444
|
-
return prop.substring(1, 6) == 'ebkit'; // webkit or Webkit
|
|
445
|
-
}
|
|
446
|
-
let _CACHED_BODY = null;
|
|
447
|
-
let _IS_WEBKIT = false;
|
|
448
|
-
function validateStyleProperty(prop) {
|
|
449
|
-
if (!_CACHED_BODY) {
|
|
450
|
-
_CACHED_BODY = getBodyNode() || {};
|
|
451
|
-
_IS_WEBKIT = _CACHED_BODY.style ? ('WebkitAppearance' in _CACHED_BODY.style) : false;
|
|
452
|
-
}
|
|
453
|
-
let result = true;
|
|
454
|
-
if (_CACHED_BODY.style && !containsVendorPrefix(prop)) {
|
|
455
|
-
result = prop in _CACHED_BODY.style;
|
|
456
|
-
if (!result && _IS_WEBKIT) {
|
|
457
|
-
const camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.slice(1);
|
|
458
|
-
result = camelProp in _CACHED_BODY.style;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
return result;
|
|
462
|
-
}
|
|
463
|
-
function validateWebAnimatableStyleProperty(prop) {
|
|
464
|
-
return ANIMATABLE_PROP_SET.has(prop);
|
|
465
|
-
}
|
|
466
|
-
function getBodyNode() {
|
|
467
|
-
if (typeof document != 'undefined') {
|
|
468
|
-
return document.body;
|
|
469
|
-
}
|
|
470
|
-
return null;
|
|
471
|
-
}
|
|
472
|
-
function containsElement(elm1, elm2) {
|
|
473
|
-
while (elm2) {
|
|
474
|
-
if (elm2 === elm1) {
|
|
475
|
-
return true;
|
|
476
|
-
}
|
|
477
|
-
elm2 = getParentElement(elm2);
|
|
478
|
-
}
|
|
479
|
-
return false;
|
|
480
|
-
}
|
|
481
|
-
function invokeQuery(element, selector, multi) {
|
|
482
|
-
if (multi) {
|
|
483
|
-
return Array.from(element.querySelectorAll(selector));
|
|
484
|
-
}
|
|
485
|
-
const elem = element.querySelector(selector);
|
|
486
|
-
return elem ? [elem] : [];
|
|
487
|
-
}
|
|
488
|
-
function hypenatePropsKeys(original) {
|
|
489
|
-
const newMap = new Map();
|
|
490
|
-
original.forEach((val, prop) => {
|
|
491
|
-
const newProp = prop.replace(/([a-z])([A-Z])/g, '$1-$2');
|
|
492
|
-
newMap.set(newProp, val);
|
|
493
|
-
});
|
|
494
|
-
return newMap;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
const ONE_SECOND = 1000;
|
|
498
|
-
const SUBSTITUTION_EXPR_START = '{{';
|
|
499
|
-
const SUBSTITUTION_EXPR_END = '}}';
|
|
500
|
-
const ENTER_CLASSNAME = 'ng-enter';
|
|
501
|
-
const LEAVE_CLASSNAME = 'ng-leave';
|
|
502
|
-
const NG_TRIGGER_CLASSNAME = 'ng-trigger';
|
|
503
|
-
const NG_TRIGGER_SELECTOR = '.ng-trigger';
|
|
504
|
-
const NG_ANIMATING_CLASSNAME = 'ng-animating';
|
|
505
|
-
const NG_ANIMATING_SELECTOR = '.ng-animating';
|
|
506
|
-
function resolveTimingValue(value) {
|
|
507
|
-
if (typeof value == 'number')
|
|
508
|
-
return value;
|
|
509
|
-
const matches = value.match(/^(-?[\.\d]+)(m?s)/);
|
|
510
|
-
if (!matches || matches.length < 2)
|
|
511
|
-
return 0;
|
|
512
|
-
return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);
|
|
513
|
-
}
|
|
514
|
-
function _convertTimeValueToMS(value, unit) {
|
|
515
|
-
switch (unit) {
|
|
516
|
-
case 's':
|
|
517
|
-
return value * ONE_SECOND;
|
|
518
|
-
default: // ms or something else
|
|
519
|
-
return value;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
function resolveTiming(timings, errors, allowNegativeValues) {
|
|
523
|
-
return timings.hasOwnProperty('duration') ?
|
|
524
|
-
timings :
|
|
525
|
-
parseTimeExpression(timings, errors, allowNegativeValues);
|
|
526
|
-
}
|
|
527
|
-
function parseTimeExpression(exp, errors, allowNegativeValues) {
|
|
528
|
-
const regex = /^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i;
|
|
529
|
-
let duration;
|
|
530
|
-
let delay = 0;
|
|
531
|
-
let easing = '';
|
|
532
|
-
if (typeof exp === 'string') {
|
|
533
|
-
const matches = exp.match(regex);
|
|
534
|
-
if (matches === null) {
|
|
535
|
-
errors.push(invalidTimingValue(exp));
|
|
536
|
-
return { duration: 0, delay: 0, easing: '' };
|
|
537
|
-
}
|
|
538
|
-
duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);
|
|
539
|
-
const delayMatch = matches[3];
|
|
540
|
-
if (delayMatch != null) {
|
|
541
|
-
delay = _convertTimeValueToMS(parseFloat(delayMatch), matches[4]);
|
|
542
|
-
}
|
|
543
|
-
const easingVal = matches[5];
|
|
544
|
-
if (easingVal) {
|
|
545
|
-
easing = easingVal;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
else {
|
|
549
|
-
duration = exp;
|
|
550
|
-
}
|
|
551
|
-
if (!allowNegativeValues) {
|
|
552
|
-
let containsErrors = false;
|
|
553
|
-
let startIndex = errors.length;
|
|
554
|
-
if (duration < 0) {
|
|
555
|
-
errors.push(negativeStepValue());
|
|
556
|
-
containsErrors = true;
|
|
557
|
-
}
|
|
558
|
-
if (delay < 0) {
|
|
559
|
-
errors.push(negativeDelayValue());
|
|
560
|
-
containsErrors = true;
|
|
561
|
-
}
|
|
562
|
-
if (containsErrors) {
|
|
563
|
-
errors.splice(startIndex, 0, invalidTimingValue(exp));
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
return { duration, delay, easing };
|
|
567
|
-
}
|
|
568
|
-
function copyObj(obj, destination = {}) {
|
|
569
|
-
Object.keys(obj).forEach(prop => {
|
|
570
|
-
destination[prop] = obj[prop];
|
|
571
|
-
});
|
|
572
|
-
return destination;
|
|
573
|
-
}
|
|
574
|
-
function convertToMap(obj) {
|
|
575
|
-
const styleMap = new Map();
|
|
576
|
-
Object.keys(obj).forEach(prop => {
|
|
577
|
-
const val = obj[prop];
|
|
578
|
-
styleMap.set(prop, val);
|
|
579
|
-
});
|
|
580
|
-
return styleMap;
|
|
581
|
-
}
|
|
582
|
-
function normalizeKeyframes(keyframes) {
|
|
583
|
-
if (!keyframes.length) {
|
|
584
|
-
return [];
|
|
585
|
-
}
|
|
586
|
-
if (keyframes[0] instanceof Map) {
|
|
587
|
-
return keyframes;
|
|
588
|
-
}
|
|
589
|
-
return keyframes.map(kf => convertToMap(kf));
|
|
590
|
-
}
|
|
591
|
-
function normalizeStyles(styles) {
|
|
592
|
-
const normalizedStyles = new Map();
|
|
593
|
-
if (Array.isArray(styles)) {
|
|
594
|
-
styles.forEach(data => copyStyles(data, normalizedStyles));
|
|
595
|
-
}
|
|
596
|
-
else {
|
|
597
|
-
copyStyles(styles, normalizedStyles);
|
|
598
|
-
}
|
|
599
|
-
return normalizedStyles;
|
|
600
|
-
}
|
|
601
|
-
function copyStyles(styles, destination = new Map(), backfill) {
|
|
602
|
-
if (backfill) {
|
|
603
|
-
for (let [prop, val] of backfill) {
|
|
604
|
-
destination.set(prop, val);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
for (let [prop, val] of styles) {
|
|
608
|
-
destination.set(prop, val);
|
|
609
|
-
}
|
|
610
|
-
return destination;
|
|
611
|
-
}
|
|
612
|
-
function setStyles(element, styles, formerStyles) {
|
|
613
|
-
styles.forEach((val, prop) => {
|
|
614
|
-
const camelProp = dashCaseToCamelCase(prop);
|
|
615
|
-
if (formerStyles && !formerStyles.has(prop)) {
|
|
616
|
-
formerStyles.set(prop, element.style[camelProp]);
|
|
617
|
-
}
|
|
618
|
-
element.style[camelProp] = val;
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
function eraseStyles(element, styles) {
|
|
622
|
-
styles.forEach((_, prop) => {
|
|
623
|
-
const camelProp = dashCaseToCamelCase(prop);
|
|
624
|
-
element.style[camelProp] = '';
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
function normalizeAnimationEntry(steps) {
|
|
628
|
-
if (Array.isArray(steps)) {
|
|
629
|
-
if (steps.length == 1)
|
|
630
|
-
return steps[0];
|
|
631
|
-
return sequence(steps);
|
|
632
|
-
}
|
|
633
|
-
return steps;
|
|
634
|
-
}
|
|
635
|
-
function validateStyleParams(value, options, errors) {
|
|
636
|
-
const params = options.params || {};
|
|
637
|
-
const matches = extractStyleParams(value);
|
|
638
|
-
if (matches.length) {
|
|
639
|
-
matches.forEach(varName => {
|
|
640
|
-
if (!params.hasOwnProperty(varName)) {
|
|
641
|
-
errors.push(invalidStyleParams(varName));
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
const PARAM_REGEX = new RegExp(`${SUBSTITUTION_EXPR_START}\\s*(.+?)\\s*${SUBSTITUTION_EXPR_END}`, 'g');
|
|
647
|
-
function extractStyleParams(value) {
|
|
648
|
-
let params = [];
|
|
649
|
-
if (typeof value === 'string') {
|
|
650
|
-
let match;
|
|
651
|
-
while (match = PARAM_REGEX.exec(value)) {
|
|
652
|
-
params.push(match[1]);
|
|
653
|
-
}
|
|
654
|
-
PARAM_REGEX.lastIndex = 0;
|
|
655
|
-
}
|
|
656
|
-
return params;
|
|
657
|
-
}
|
|
658
|
-
function interpolateParams(value, params, errors) {
|
|
659
|
-
const original = value.toString();
|
|
660
|
-
const str = original.replace(PARAM_REGEX, (_, varName) => {
|
|
661
|
-
let localVal = params[varName];
|
|
662
|
-
// this means that the value was never overridden by the data passed in by the user
|
|
663
|
-
if (localVal == null) {
|
|
664
|
-
errors.push(invalidParamValue(varName));
|
|
665
|
-
localVal = '';
|
|
666
|
-
}
|
|
667
|
-
return localVal.toString();
|
|
668
|
-
});
|
|
669
|
-
// we do this to assert that numeric values stay as they are
|
|
670
|
-
return str == original ? value : str;
|
|
671
|
-
}
|
|
672
|
-
function iteratorToArray(iterator) {
|
|
673
|
-
const arr = [];
|
|
674
|
-
let item = iterator.next();
|
|
675
|
-
while (!item.done) {
|
|
676
|
-
arr.push(item.value);
|
|
677
|
-
item = iterator.next();
|
|
678
|
-
}
|
|
679
|
-
return arr;
|
|
680
|
-
}
|
|
681
|
-
const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
|
|
682
|
-
function dashCaseToCamelCase(input) {
|
|
683
|
-
return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
|
|
684
|
-
}
|
|
685
|
-
function camelCaseToDashCase(input) {
|
|
686
|
-
return input.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
687
|
-
}
|
|
688
|
-
function allowPreviousPlayerStylesMerge(duration, delay) {
|
|
689
|
-
return duration === 0 || delay === 0;
|
|
690
|
-
}
|
|
691
|
-
function balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles) {
|
|
692
|
-
if (previousStyles.size && keyframes.length) {
|
|
693
|
-
let startingKeyframe = keyframes[0];
|
|
694
|
-
let missingStyleProps = [];
|
|
695
|
-
previousStyles.forEach((val, prop) => {
|
|
696
|
-
if (!startingKeyframe.has(prop)) {
|
|
697
|
-
missingStyleProps.push(prop);
|
|
698
|
-
}
|
|
699
|
-
startingKeyframe.set(prop, val);
|
|
700
|
-
});
|
|
701
|
-
if (missingStyleProps.length) {
|
|
702
|
-
for (let i = 1; i < keyframes.length; i++) {
|
|
703
|
-
let kf = keyframes[i];
|
|
704
|
-
missingStyleProps.forEach(prop => kf.set(prop, computeStyle(element, prop)));
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
return keyframes;
|
|
709
|
-
}
|
|
710
|
-
function visitDslNode(visitor, node, context) {
|
|
711
|
-
switch (node.type) {
|
|
712
|
-
case 7 /* AnimationMetadataType.Trigger */:
|
|
713
|
-
return visitor.visitTrigger(node, context);
|
|
714
|
-
case 0 /* AnimationMetadataType.State */:
|
|
715
|
-
return visitor.visitState(node, context);
|
|
716
|
-
case 1 /* AnimationMetadataType.Transition */:
|
|
717
|
-
return visitor.visitTransition(node, context);
|
|
718
|
-
case 2 /* AnimationMetadataType.Sequence */:
|
|
719
|
-
return visitor.visitSequence(node, context);
|
|
720
|
-
case 3 /* AnimationMetadataType.Group */:
|
|
721
|
-
return visitor.visitGroup(node, context);
|
|
722
|
-
case 4 /* AnimationMetadataType.Animate */:
|
|
723
|
-
return visitor.visitAnimate(node, context);
|
|
724
|
-
case 5 /* AnimationMetadataType.Keyframes */:
|
|
725
|
-
return visitor.visitKeyframes(node, context);
|
|
726
|
-
case 6 /* AnimationMetadataType.Style */:
|
|
727
|
-
return visitor.visitStyle(node, context);
|
|
728
|
-
case 8 /* AnimationMetadataType.Reference */:
|
|
729
|
-
return visitor.visitReference(node, context);
|
|
730
|
-
case 9 /* AnimationMetadataType.AnimateChild */:
|
|
731
|
-
return visitor.visitAnimateChild(node, context);
|
|
732
|
-
case 10 /* AnimationMetadataType.AnimateRef */:
|
|
733
|
-
return visitor.visitAnimateRef(node, context);
|
|
734
|
-
case 11 /* AnimationMetadataType.Query */:
|
|
735
|
-
return visitor.visitQuery(node, context);
|
|
736
|
-
case 12 /* AnimationMetadataType.Stagger */:
|
|
737
|
-
return visitor.visitStagger(node, context);
|
|
738
|
-
default:
|
|
739
|
-
throw invalidNodeType(node.type);
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
function computeStyle(element, prop) {
|
|
743
|
-
return window.getComputedStyle(element)[prop];
|
|
744
|
-
}
|
|
7
|
+
import { NoopAnimationPlayer, AUTO_STYLE } from '@angular/animations';
|
|
8
|
+
import { ɵvalidateStyleProperty, ɵcamelCaseToDashCase, ɵvalidateWebAnimatableStyleProperty, ɵcontainsElement, ɵgetParentElement, ɵinvokeQuery, ɵnormalizeKeyframes, ɵallowPreviousPlayerStylesMerge } from '@angular/animations/browser';
|
|
745
9
|
|
|
746
10
|
/**
|
|
747
11
|
* @publicApi
|
|
@@ -752,8 +16,8 @@ class MockAnimationDriver {
|
|
|
752
16
|
return ɵvalidateStyleProperty(prop);
|
|
753
17
|
}
|
|
754
18
|
validateAnimatableStyleProperty(prop) {
|
|
755
|
-
const cssProp =
|
|
756
|
-
return
|
|
19
|
+
const cssProp = ɵcamelCaseToDashCase(prop);
|
|
20
|
+
return ɵvalidateWebAnimatableStyleProperty(cssProp);
|
|
757
21
|
}
|
|
758
22
|
matchesElement(_element, _selector) {
|
|
759
23
|
return false;
|