@angular/animations 16.0.0-next.4 → 16.0.0-next.5

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.
Files changed (70) hide show
  1. package/browser/index.d.ts +1 -1
  2. package/browser/testing/index.d.ts +1 -1
  3. package/esm2022/browser/src/render/animation_driver.mjs +52 -0
  4. package/{esm2020 → esm2022}/browser/src/render/special_cased_styles.mjs +2 -2
  5. package/esm2022/browser/src/warning_helpers.mjs +33 -0
  6. package/esm2022/browser/testing/src/mock_animation_driver.mjs +123 -0
  7. package/{esm2020 → esm2022}/src/version.mjs +1 -1
  8. package/{fesm2015 → fesm2022}/animations.mjs +1 -1
  9. package/{fesm2020 → fesm2022}/browser/testing.mjs +2 -2
  10. package/{fesm2020 → fesm2022}/browser/testing.mjs.map +1 -1
  11. package/{fesm2020 → fesm2022}/browser.mjs +11 -11
  12. package/fesm2022/browser.mjs.map +1 -0
  13. package/index.d.ts +1 -1
  14. package/package.json +12 -22
  15. package/esm2020/browser/src/render/animation_driver.mjs +0 -52
  16. package/esm2020/browser/src/warning_helpers.mjs +0 -33
  17. package/esm2020/browser/testing/src/mock_animation_driver.mjs +0 -123
  18. package/fesm2015/animations.mjs.map +0 -1
  19. package/fesm2015/browser/testing.mjs +0 -941
  20. package/fesm2015/browser/testing.mjs.map +0 -1
  21. package/fesm2015/browser.mjs +0 -4626
  22. package/fesm2015/browser.mjs.map +0 -1
  23. package/fesm2020/animations.mjs +0 -1179
  24. package/fesm2020/browser.mjs.map +0 -1
  25. /package/{esm2020 → esm2022}/animations.mjs +0 -0
  26. /package/{esm2020 → esm2022}/browser/browser.mjs +0 -0
  27. /package/{esm2020 → esm2022}/browser/index.mjs +0 -0
  28. /package/{esm2020 → esm2022}/browser/public_api.mjs +0 -0
  29. /package/{esm2020 → esm2022}/browser/src/browser.mjs +0 -0
  30. /package/{esm2020 → esm2022}/browser/src/dsl/animation.mjs +0 -0
  31. /package/{esm2020 → esm2022}/browser/src/dsl/animation_ast.mjs +0 -0
  32. /package/{esm2020 → esm2022}/browser/src/dsl/animation_ast_builder.mjs +0 -0
  33. /package/{esm2020 → esm2022}/browser/src/dsl/animation_dsl_visitor.mjs +0 -0
  34. /package/{esm2020 → esm2022}/browser/src/dsl/animation_timeline_builder.mjs +0 -0
  35. /package/{esm2020 → esm2022}/browser/src/dsl/animation_timeline_instruction.mjs +0 -0
  36. /package/{esm2020 → esm2022}/browser/src/dsl/animation_transition_expr.mjs +0 -0
  37. /package/{esm2020 → esm2022}/browser/src/dsl/animation_transition_factory.mjs +0 -0
  38. /package/{esm2020 → esm2022}/browser/src/dsl/animation_transition_instruction.mjs +0 -0
  39. /package/{esm2020 → esm2022}/browser/src/dsl/animation_trigger.mjs +0 -0
  40. /package/{esm2020 → esm2022}/browser/src/dsl/element_instruction_map.mjs +0 -0
  41. /package/{esm2020 → esm2022}/browser/src/dsl/style_normalization/animation_style_normalizer.mjs +0 -0
  42. /package/{esm2020 → esm2022}/browser/src/dsl/style_normalization/web_animations_style_normalizer.mjs +0 -0
  43. /package/{esm2020 → esm2022}/browser/src/error_helpers.mjs +0 -0
  44. /package/{esm2020 → esm2022}/browser/src/errors.mjs +0 -0
  45. /package/{esm2020 → esm2022}/browser/src/private_export.mjs +0 -0
  46. /package/{esm2020 → esm2022}/browser/src/render/animation_engine_instruction.mjs +0 -0
  47. /package/{esm2020 → esm2022}/browser/src/render/animation_engine_next.mjs +0 -0
  48. /package/{esm2020 → esm2022}/browser/src/render/shared.mjs +0 -0
  49. /package/{esm2020 → esm2022}/browser/src/render/timeline_animation_engine.mjs +0 -0
  50. /package/{esm2020 → esm2022}/browser/src/render/transition_animation_engine.mjs +0 -0
  51. /package/{esm2020 → esm2022}/browser/src/render/web_animations/animatable_props_set.mjs +0 -0
  52. /package/{esm2020 → esm2022}/browser/src/render/web_animations/dom_animation.mjs +0 -0
  53. /package/{esm2020 → esm2022}/browser/src/render/web_animations/web_animations_driver.mjs +0 -0
  54. /package/{esm2020 → esm2022}/browser/src/render/web_animations/web_animations_player.mjs +0 -0
  55. /package/{esm2020 → esm2022}/browser/src/util.mjs +0 -0
  56. /package/{esm2020 → esm2022}/browser/testing/index.mjs +0 -0
  57. /package/{esm2020 → esm2022}/browser/testing/public_api.mjs +0 -0
  58. /package/{esm2020 → esm2022}/browser/testing/src/testing.mjs +0 -0
  59. /package/{esm2020 → esm2022}/browser/testing/testing.mjs +0 -0
  60. /package/{esm2020 → esm2022}/index.mjs +0 -0
  61. /package/{esm2020 → esm2022}/public_api.mjs +0 -0
  62. /package/{esm2020 → esm2022}/src/animation_builder.mjs +0 -0
  63. /package/{esm2020 → esm2022}/src/animation_event.mjs +0 -0
  64. /package/{esm2020 → esm2022}/src/animation_metadata.mjs +0 -0
  65. /package/{esm2020 → esm2022}/src/animations.mjs +0 -0
  66. /package/{esm2020 → esm2022}/src/players/animation_group_player.mjs +0 -0
  67. /package/{esm2020 → esm2022}/src/players/animation_player.mjs +0 -0
  68. /package/{esm2020 → esm2022}/src/private_export.mjs +0 -0
  69. /package/{esm2020 → esm2022}/src/util.mjs +0 -0
  70. /package/{fesm2020 → fesm2022}/animations.mjs.map +0 -0
@@ -1,941 +0,0 @@
1
- /**
2
- * @license Angular v16.0.0-next.4
3
- * (c) 2010-2022 Google LLC. https://angular.io/
4
- * License: MIT
5
- */
6
-
7
- import { ɵAnimationGroupPlayer, NoopAnimationPlayer, AUTO_STYLE, ɵPRE_STYLE, sequence } from '@angular/animations';
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 isBrowser() {
344
- return (typeof window !== 'undefined' && typeof window.document !== 'undefined');
345
- }
346
- function isNode() {
347
- // Checking only for `process` isn't enough to identify whether or not we're in a Node
348
- // environment, because Webpack by default will polyfill the `process`. While we can discern
349
- // that Webpack polyfilled it by looking at `process.browser`, it's very Webpack-specific and
350
- // might not be future-proof. Instead we look at the stringified version of `process` which
351
- // is `[object process]` in Node and `[object Object]` when polyfilled.
352
- return typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
353
- }
354
- function optimizeGroupPlayer(players) {
355
- switch (players.length) {
356
- case 0:
357
- return new NoopAnimationPlayer();
358
- case 1:
359
- return players[0];
360
- default:
361
- return new ɵAnimationGroupPlayer(players);
362
- }
363
- }
364
- function normalizeKeyframes$1(driver, normalizer, element, keyframes, preStyles = new Map(), postStyles = new Map()) {
365
- const errors = [];
366
- const normalizedKeyframes = [];
367
- let previousOffset = -1;
368
- let previousKeyframe = null;
369
- keyframes.forEach(kf => {
370
- const offset = kf.get('offset');
371
- const isSameOffset = offset == previousOffset;
372
- const normalizedKeyframe = (isSameOffset && previousKeyframe) || new Map();
373
- kf.forEach((val, prop) => {
374
- let normalizedProp = prop;
375
- let normalizedValue = val;
376
- if (prop !== 'offset') {
377
- normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors);
378
- switch (normalizedValue) {
379
- case ɵPRE_STYLE:
380
- normalizedValue = preStyles.get(prop);
381
- break;
382
- case AUTO_STYLE:
383
- normalizedValue = postStyles.get(prop);
384
- break;
385
- default:
386
- normalizedValue =
387
- normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors);
388
- break;
389
- }
390
- }
391
- normalizedKeyframe.set(normalizedProp, normalizedValue);
392
- });
393
- if (!isSameOffset) {
394
- normalizedKeyframes.push(normalizedKeyframe);
395
- }
396
- previousKeyframe = normalizedKeyframe;
397
- previousOffset = offset;
398
- });
399
- if (errors.length) {
400
- throw animationFailed(errors);
401
- }
402
- return normalizedKeyframes;
403
- }
404
- function listenOnPlayer(player, eventName, event, callback) {
405
- switch (eventName) {
406
- case 'start':
407
- player.onStart(() => callback(event && copyAnimationEvent(event, 'start', player)));
408
- break;
409
- case 'done':
410
- player.onDone(() => callback(event && copyAnimationEvent(event, 'done', player)));
411
- break;
412
- case 'destroy':
413
- player.onDestroy(() => callback(event && copyAnimationEvent(event, 'destroy', player)));
414
- break;
415
- }
416
- }
417
- function copyAnimationEvent(e, phaseName, player) {
418
- const totalTime = player.totalTime;
419
- const disabled = player.disabled ? true : false;
420
- const event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime, disabled);
421
- const data = e['_data'];
422
- if (data != null) {
423
- event['_data'] = data;
424
- }
425
- return event;
426
- }
427
- function makeAnimationEvent(element, triggerName, fromState, toState, phaseName = '', totalTime = 0, disabled) {
428
- return { element, triggerName, fromState, toState, phaseName, totalTime, disabled: !!disabled };
429
- }
430
- function getOrSetDefaultValue(map, key, defaultValue) {
431
- let value = map.get(key);
432
- if (!value) {
433
- map.set(key, value = defaultValue);
434
- }
435
- return value;
436
- }
437
- function parseTimelineCommand(command) {
438
- const separatorPos = command.indexOf(':');
439
- const id = command.substring(1, separatorPos);
440
- const action = command.slice(separatorPos + 1);
441
- return [id, action];
442
- }
443
- let _contains = (elm1, elm2) => false;
444
- let _query = (element, selector, multi) => {
445
- return [];
446
- };
447
- let _documentElement = null;
448
- function getParentElement(element) {
449
- const parent = element.parentNode || element.host; // consider host to support shadow DOM
450
- if (parent === _documentElement) {
451
- return null;
452
- }
453
- return parent;
454
- }
455
- // Define utility methods for browsers and platform-server(domino) where Element
456
- // and utility methods exist.
457
- const _isNode = isNode();
458
- if (_isNode || typeof Element !== 'undefined') {
459
- if (!isBrowser()) {
460
- _contains = (elm1, elm2) => elm1.contains(elm2);
461
- }
462
- else {
463
- // Read the document element in an IIFE that's been marked pure to avoid a top-level property
464
- // read that may prevent tree-shaking.
465
- _documentElement = /* @__PURE__ */ (() => document.documentElement)();
466
- _contains = (elm1, elm2) => {
467
- while (elm2) {
468
- if (elm2 === elm1) {
469
- return true;
470
- }
471
- elm2 = getParentElement(elm2);
472
- }
473
- return false;
474
- };
475
- }
476
- _query = (element, selector, multi) => {
477
- if (multi) {
478
- return Array.from(element.querySelectorAll(selector));
479
- }
480
- const elem = element.querySelector(selector);
481
- return elem ? [elem] : [];
482
- };
483
- }
484
- function containsVendorPrefix(prop) {
485
- // Webkit is the only real popular vendor prefix nowadays
486
- // cc: http://shouldiprefix.com/
487
- return prop.substring(1, 6) == 'ebkit'; // webkit or Webkit
488
- }
489
- let _CACHED_BODY = null;
490
- let _IS_WEBKIT = false;
491
- function validateStyleProperty(prop) {
492
- if (!_CACHED_BODY) {
493
- _CACHED_BODY = getBodyNode() || {};
494
- _IS_WEBKIT = _CACHED_BODY.style ? ('WebkitAppearance' in _CACHED_BODY.style) : false;
495
- }
496
- let result = true;
497
- if (_CACHED_BODY.style && !containsVendorPrefix(prop)) {
498
- result = prop in _CACHED_BODY.style;
499
- if (!result && _IS_WEBKIT) {
500
- const camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.slice(1);
501
- result = camelProp in _CACHED_BODY.style;
502
- }
503
- }
504
- return result;
505
- }
506
- function validateWebAnimatableStyleProperty(prop) {
507
- return ANIMATABLE_PROP_SET.has(prop);
508
- }
509
- function getBodyNode() {
510
- if (typeof document != 'undefined') {
511
- return document.body;
512
- }
513
- return null;
514
- }
515
- const containsElement = _contains;
516
- const invokeQuery = _query;
517
- function hypenatePropsKeys(original) {
518
- const newMap = new Map();
519
- original.forEach((val, prop) => {
520
- const newProp = prop.replace(/([a-z])([A-Z])/g, '$1-$2');
521
- newMap.set(newProp, val);
522
- });
523
- return newMap;
524
- }
525
-
526
- const ONE_SECOND = 1000;
527
- const SUBSTITUTION_EXPR_START = '{{';
528
- const SUBSTITUTION_EXPR_END = '}}';
529
- const ENTER_CLASSNAME = 'ng-enter';
530
- const LEAVE_CLASSNAME = 'ng-leave';
531
- const NG_TRIGGER_CLASSNAME = 'ng-trigger';
532
- const NG_TRIGGER_SELECTOR = '.ng-trigger';
533
- const NG_ANIMATING_CLASSNAME = 'ng-animating';
534
- const NG_ANIMATING_SELECTOR = '.ng-animating';
535
- function resolveTimingValue(value) {
536
- if (typeof value == 'number')
537
- return value;
538
- const matches = value.match(/^(-?[\.\d]+)(m?s)/);
539
- if (!matches || matches.length < 2)
540
- return 0;
541
- return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);
542
- }
543
- function _convertTimeValueToMS(value, unit) {
544
- switch (unit) {
545
- case 's':
546
- return value * ONE_SECOND;
547
- default: // ms or something else
548
- return value;
549
- }
550
- }
551
- function resolveTiming(timings, errors, allowNegativeValues) {
552
- return timings.hasOwnProperty('duration') ?
553
- timings :
554
- parseTimeExpression(timings, errors, allowNegativeValues);
555
- }
556
- function parseTimeExpression(exp, errors, allowNegativeValues) {
557
- const regex = /^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i;
558
- let duration;
559
- let delay = 0;
560
- let easing = '';
561
- if (typeof exp === 'string') {
562
- const matches = exp.match(regex);
563
- if (matches === null) {
564
- errors.push(invalidTimingValue(exp));
565
- return { duration: 0, delay: 0, easing: '' };
566
- }
567
- duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);
568
- const delayMatch = matches[3];
569
- if (delayMatch != null) {
570
- delay = _convertTimeValueToMS(parseFloat(delayMatch), matches[4]);
571
- }
572
- const easingVal = matches[5];
573
- if (easingVal) {
574
- easing = easingVal;
575
- }
576
- }
577
- else {
578
- duration = exp;
579
- }
580
- if (!allowNegativeValues) {
581
- let containsErrors = false;
582
- let startIndex = errors.length;
583
- if (duration < 0) {
584
- errors.push(negativeStepValue());
585
- containsErrors = true;
586
- }
587
- if (delay < 0) {
588
- errors.push(negativeDelayValue());
589
- containsErrors = true;
590
- }
591
- if (containsErrors) {
592
- errors.splice(startIndex, 0, invalidTimingValue(exp));
593
- }
594
- }
595
- return { duration, delay, easing };
596
- }
597
- function copyObj(obj, destination = {}) {
598
- Object.keys(obj).forEach(prop => {
599
- destination[prop] = obj[prop];
600
- });
601
- return destination;
602
- }
603
- function convertToMap(obj) {
604
- const styleMap = new Map();
605
- Object.keys(obj).forEach(prop => {
606
- const val = obj[prop];
607
- styleMap.set(prop, val);
608
- });
609
- return styleMap;
610
- }
611
- function normalizeKeyframes(keyframes) {
612
- if (!keyframes.length) {
613
- return [];
614
- }
615
- if (keyframes[0] instanceof Map) {
616
- return keyframes;
617
- }
618
- return keyframes.map(kf => convertToMap(kf));
619
- }
620
- function normalizeStyles(styles) {
621
- const normalizedStyles = new Map();
622
- if (Array.isArray(styles)) {
623
- styles.forEach(data => copyStyles(data, normalizedStyles));
624
- }
625
- else {
626
- copyStyles(styles, normalizedStyles);
627
- }
628
- return normalizedStyles;
629
- }
630
- function copyStyles(styles, destination = new Map(), backfill) {
631
- if (backfill) {
632
- for (let [prop, val] of backfill) {
633
- destination.set(prop, val);
634
- }
635
- }
636
- for (let [prop, val] of styles) {
637
- destination.set(prop, val);
638
- }
639
- return destination;
640
- }
641
- function getStyleAttributeString(element, key, value) {
642
- // Return the key-value pair string to be added to the style attribute for the
643
- // given CSS style key.
644
- if (value) {
645
- return key + ':' + value + ';';
646
- }
647
- else {
648
- return '';
649
- }
650
- }
651
- function writeStyleAttribute(element) {
652
- // Read the style property of the element and manually reflect it to the
653
- // style attribute. This is needed because Domino on platform-server doesn't
654
- // understand the full set of allowed CSS properties and doesn't reflect some
655
- // of them automatically.
656
- let styleAttrValue = '';
657
- for (let i = 0; i < element.style.length; i++) {
658
- const key = element.style.item(i);
659
- styleAttrValue += getStyleAttributeString(element, key, element.style.getPropertyValue(key));
660
- }
661
- for (const key in element.style) {
662
- // Skip internal Domino properties that don't need to be reflected.
663
- if (!element.style.hasOwnProperty(key) || key.startsWith('_')) {
664
- continue;
665
- }
666
- const dashKey = camelCaseToDashCase(key);
667
- styleAttrValue += getStyleAttributeString(element, dashKey, element.style[key]);
668
- }
669
- element.setAttribute('style', styleAttrValue);
670
- }
671
- function setStyles(element, styles, formerStyles) {
672
- if (element['style']) {
673
- styles.forEach((val, prop) => {
674
- const camelProp = dashCaseToCamelCase(prop);
675
- if (formerStyles && !formerStyles.has(prop)) {
676
- formerStyles.set(prop, element.style[camelProp]);
677
- }
678
- element.style[camelProp] = val;
679
- });
680
- // On the server set the 'style' attribute since it's not automatically reflected.
681
- if (isNode()) {
682
- writeStyleAttribute(element);
683
- }
684
- }
685
- }
686
- function eraseStyles(element, styles) {
687
- if (element['style']) {
688
- styles.forEach((_, prop) => {
689
- const camelProp = dashCaseToCamelCase(prop);
690
- element.style[camelProp] = '';
691
- });
692
- // On the server set the 'style' attribute since it's not automatically reflected.
693
- if (isNode()) {
694
- writeStyleAttribute(element);
695
- }
696
- }
697
- }
698
- function normalizeAnimationEntry(steps) {
699
- if (Array.isArray(steps)) {
700
- if (steps.length == 1)
701
- return steps[0];
702
- return sequence(steps);
703
- }
704
- return steps;
705
- }
706
- function validateStyleParams(value, options, errors) {
707
- const params = options.params || {};
708
- const matches = extractStyleParams(value);
709
- if (matches.length) {
710
- matches.forEach(varName => {
711
- if (!params.hasOwnProperty(varName)) {
712
- errors.push(invalidStyleParams(varName));
713
- }
714
- });
715
- }
716
- }
717
- const PARAM_REGEX = new RegExp(`${SUBSTITUTION_EXPR_START}\\s*(.+?)\\s*${SUBSTITUTION_EXPR_END}`, 'g');
718
- function extractStyleParams(value) {
719
- let params = [];
720
- if (typeof value === 'string') {
721
- let match;
722
- while (match = PARAM_REGEX.exec(value)) {
723
- params.push(match[1]);
724
- }
725
- PARAM_REGEX.lastIndex = 0;
726
- }
727
- return params;
728
- }
729
- function interpolateParams(value, params, errors) {
730
- const original = value.toString();
731
- const str = original.replace(PARAM_REGEX, (_, varName) => {
732
- let localVal = params[varName];
733
- // this means that the value was never overridden by the data passed in by the user
734
- if (localVal == null) {
735
- errors.push(invalidParamValue(varName));
736
- localVal = '';
737
- }
738
- return localVal.toString();
739
- });
740
- // we do this to assert that numeric values stay as they are
741
- return str == original ? value : str;
742
- }
743
- function iteratorToArray(iterator) {
744
- const arr = [];
745
- let item = iterator.next();
746
- while (!item.done) {
747
- arr.push(item.value);
748
- item = iterator.next();
749
- }
750
- return arr;
751
- }
752
- const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
753
- function dashCaseToCamelCase(input) {
754
- return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
755
- }
756
- function camelCaseToDashCase(input) {
757
- return input.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
758
- }
759
- function allowPreviousPlayerStylesMerge(duration, delay) {
760
- return duration === 0 || delay === 0;
761
- }
762
- function balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles) {
763
- if (previousStyles.size && keyframes.length) {
764
- let startingKeyframe = keyframes[0];
765
- let missingStyleProps = [];
766
- previousStyles.forEach((val, prop) => {
767
- if (!startingKeyframe.has(prop)) {
768
- missingStyleProps.push(prop);
769
- }
770
- startingKeyframe.set(prop, val);
771
- });
772
- if (missingStyleProps.length) {
773
- for (let i = 1; i < keyframes.length; i++) {
774
- let kf = keyframes[i];
775
- missingStyleProps.forEach(prop => kf.set(prop, computeStyle(element, prop)));
776
- }
777
- }
778
- }
779
- return keyframes;
780
- }
781
- function visitDslNode(visitor, node, context) {
782
- switch (node.type) {
783
- case 7 /* AnimationMetadataType.Trigger */:
784
- return visitor.visitTrigger(node, context);
785
- case 0 /* AnimationMetadataType.State */:
786
- return visitor.visitState(node, context);
787
- case 1 /* AnimationMetadataType.Transition */:
788
- return visitor.visitTransition(node, context);
789
- case 2 /* AnimationMetadataType.Sequence */:
790
- return visitor.visitSequence(node, context);
791
- case 3 /* AnimationMetadataType.Group */:
792
- return visitor.visitGroup(node, context);
793
- case 4 /* AnimationMetadataType.Animate */:
794
- return visitor.visitAnimate(node, context);
795
- case 5 /* AnimationMetadataType.Keyframes */:
796
- return visitor.visitKeyframes(node, context);
797
- case 6 /* AnimationMetadataType.Style */:
798
- return visitor.visitStyle(node, context);
799
- case 8 /* AnimationMetadataType.Reference */:
800
- return visitor.visitReference(node, context);
801
- case 9 /* AnimationMetadataType.AnimateChild */:
802
- return visitor.visitAnimateChild(node, context);
803
- case 10 /* AnimationMetadataType.AnimateRef */:
804
- return visitor.visitAnimateRef(node, context);
805
- case 11 /* AnimationMetadataType.Query */:
806
- return visitor.visitQuery(node, context);
807
- case 12 /* AnimationMetadataType.Stagger */:
808
- return visitor.visitStagger(node, context);
809
- default:
810
- throw invalidNodeType(node.type);
811
- }
812
- }
813
- function computeStyle(element, prop) {
814
- return window.getComputedStyle(element)[prop];
815
- }
816
-
817
- /**
818
- * @publicApi
819
- */
820
- class MockAnimationDriver {
821
- validateStyleProperty(prop) {
822
- return ɵvalidateStyleProperty(prop);
823
- }
824
- validateAnimatableStyleProperty(prop) {
825
- const cssProp = camelCaseToDashCase(prop);
826
- return validateWebAnimatableStyleProperty(cssProp);
827
- }
828
- matchesElement(_element, _selector) {
829
- return false;
830
- }
831
- containsElement(elm1, elm2) {
832
- return ɵcontainsElement(elm1, elm2);
833
- }
834
- getParentElement(element) {
835
- return ɵgetParentElement(element);
836
- }
837
- query(element, selector, multi) {
838
- return ɵinvokeQuery(element, selector, multi);
839
- }
840
- computeStyle(element, prop, defaultValue) {
841
- return defaultValue || '';
842
- }
843
- animate(element, keyframes, duration, delay, easing, previousPlayers = []) {
844
- const player = new MockAnimationPlayer(element, keyframes, duration, delay, easing, previousPlayers);
845
- MockAnimationDriver.log.push(player);
846
- return player;
847
- }
848
- }
849
- MockAnimationDriver.log = [];
850
- /**
851
- * @publicApi
852
- */
853
- class MockAnimationPlayer extends NoopAnimationPlayer {
854
- constructor(element, keyframes, duration, delay, easing, previousPlayers) {
855
- super(duration, delay);
856
- this.element = element;
857
- this.keyframes = keyframes;
858
- this.duration = duration;
859
- this.delay = delay;
860
- this.easing = easing;
861
- this.previousPlayers = previousPlayers;
862
- this.__finished = false;
863
- this.__started = false;
864
- this.previousStyles = new Map();
865
- this._onInitFns = [];
866
- this.currentSnapshot = new Map();
867
- this._keyframes = [];
868
- this._keyframes = ɵnormalizeKeyframes(keyframes);
869
- if (ɵallowPreviousPlayerStylesMerge(duration, delay)) {
870
- previousPlayers.forEach(player => {
871
- if (player instanceof MockAnimationPlayer) {
872
- const styles = player.currentSnapshot;
873
- styles.forEach((val, prop) => this.previousStyles.set(prop, val));
874
- }
875
- });
876
- }
877
- }
878
- /* @internal */
879
- onInit(fn) {
880
- this._onInitFns.push(fn);
881
- }
882
- /* @internal */
883
- init() {
884
- super.init();
885
- this._onInitFns.forEach(fn => fn());
886
- this._onInitFns = [];
887
- }
888
- reset() {
889
- super.reset();
890
- this.__started = false;
891
- }
892
- finish() {
893
- super.finish();
894
- this.__finished = true;
895
- }
896
- destroy() {
897
- super.destroy();
898
- this.__finished = true;
899
- }
900
- /* @internal */
901
- triggerMicrotask() { }
902
- play() {
903
- super.play();
904
- this.__started = true;
905
- }
906
- hasStarted() {
907
- return this.__started;
908
- }
909
- beforeDestroy() {
910
- const captures = new Map();
911
- this.previousStyles.forEach((val, prop) => captures.set(prop, val));
912
- if (this.hasStarted()) {
913
- // when assembling the captured styles, it's important that
914
- // we build the keyframe styles in the following order:
915
- // {other styles within keyframes, ... previousStyles }
916
- this._keyframes.forEach(kf => {
917
- for (let [prop, val] of kf) {
918
- if (prop !== 'offset') {
919
- captures.set(prop, this.__finished ? val : AUTO_STYLE);
920
- }
921
- }
922
- });
923
- }
924
- this.currentSnapshot = captures;
925
- }
926
- }
927
-
928
- /**
929
- * @module
930
- * @description
931
- * Entry point for all public APIs of this package.
932
- */
933
-
934
- // This file is not used to build this module. It is only used during editing
935
-
936
- /**
937
- * Generated bundle index. Do not edit.
938
- */
939
-
940
- export { MockAnimationDriver, MockAnimationPlayer };
941
- //# sourceMappingURL=testing.mjs.map