@angular/animations 13.2.2 → 13.2.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/animations.d.ts +10 -2
- package/browser/browser.d.ts +7 -7
- package/browser/testing/testing.d.ts +1 -1
- package/esm2020/browser/src/dsl/animation.mjs +4 -5
- package/esm2020/browser/src/dsl/animation_ast_builder.mjs +13 -14
- package/esm2020/browser/src/dsl/animation_timeline_builder.mjs +3 -2
- package/esm2020/browser/src/dsl/animation_transition_expr.mjs +4 -3
- package/esm2020/browser/src/dsl/animation_transition_factory.mjs +1 -1
- package/esm2020/browser/src/dsl/animation_transition_instruction.mjs +1 -1
- package/esm2020/browser/src/dsl/animation_trigger.mjs +1 -1
- package/esm2020/browser/src/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/render/animation_driver.mjs +3 -3
- package/esm2020/browser/src/render/animation_engine_next.mjs +3 -2
- package/esm2020/browser/src/render/shared.mjs +3 -3
- package/esm2020/browser/src/render/timeline_animation_engine.mjs +6 -5
- package/esm2020/browser/src/render/transition_animation_engine.mjs +8 -8
- package/esm2020/browser/src/util.mjs +9 -8
- 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 +1 -1
- package/fesm2015/browser.mjs +175 -47
- 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 +1 -1
- package/fesm2020/browser.mjs +175 -47
- package/fesm2020/browser.mjs.map +1 -1
- package/package.json +2 -2
package/fesm2020/browser.mjs
CHANGED
|
@@ -1,12 +1,146 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.2.
|
|
2
|
+
* @license Angular v13.2.3
|
|
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 = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
|
19
|
+
const LINE_START = '\n - ';
|
|
20
|
+
function invalidTimingValue(exp) {
|
|
21
|
+
return new ɵRuntimeError(3000 /* INVALID_TIMING_VALUE */, NG_DEV_MODE && `The provided timing value "${exp}" is invalid.`);
|
|
22
|
+
}
|
|
23
|
+
function negativeStepValue() {
|
|
24
|
+
return new ɵRuntimeError(3100 /* NEGATIVE_STEP_VALUE */, NG_DEV_MODE && '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 && '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 &&
|
|
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 && `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 && `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 && `Please provide a CSS unit value for ${userProvidedProperty}:${value}`);
|
|
41
|
+
}
|
|
42
|
+
function invalidTrigger() {
|
|
43
|
+
return new ɵRuntimeError(3006 /* INVALID_TRIGGER */, NG_DEV_MODE &&
|
|
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 && '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 &&
|
|
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 && `The provided style string value ${value} is not allowed.`);
|
|
55
|
+
}
|
|
56
|
+
function invalidProperty(prop) {
|
|
57
|
+
return new ɵRuntimeError(3009 /* INVALID_PROPERTY */, NG_DEV_MODE &&
|
|
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 &&
|
|
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 && `keyframes() must be placed inside of a call to animate()`);
|
|
66
|
+
}
|
|
67
|
+
function invalidOffset() {
|
|
68
|
+
return new ɵRuntimeError(3012 /* INVALID_OFFSET */, NG_DEV_MODE && `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 && `Please ensure that all keyframe offsets are in order`);
|
|
72
|
+
}
|
|
73
|
+
function keyframesMissingOffsets() {
|
|
74
|
+
return new ɵRuntimeError(3202 /* KEYFRAMES_MISSING_OFFSETS */, NG_DEV_MODE && `Not all style() steps within the declared keyframes() contain offsets`);
|
|
75
|
+
}
|
|
76
|
+
function invalidStagger() {
|
|
77
|
+
return new ɵRuntimeError(3013 /* INVALID_STAGGER */, NG_DEV_MODE && `stagger() can only be used inside of query()`);
|
|
78
|
+
}
|
|
79
|
+
function invalidQuery(selector) {
|
|
80
|
+
return new ɵRuntimeError(3014 /* INVALID_QUERY */, NG_DEV_MODE &&
|
|
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 && `The provided transition expression "${expr}" is not supported`);
|
|
85
|
+
}
|
|
86
|
+
function invalidTransitionAlias(alias) {
|
|
87
|
+
return new ɵRuntimeError(3016 /* INVALID_TRANSITION_ALIAS */, NG_DEV_MODE && `The transition alias value "${alias}" is not supported`);
|
|
88
|
+
}
|
|
89
|
+
function validationFailed(errors) {
|
|
90
|
+
return new ɵRuntimeError(3500 /* VALIDATION_FAILED */, NG_DEV_MODE && `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 && `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 &&
|
|
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 &&
|
|
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 &&
|
|
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 && '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 &&
|
|
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 && `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 &&
|
|
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 &&
|
|
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 &&
|
|
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 && `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 &&
|
|
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 &&
|
|
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 &&
|
|
142
|
+
`@${name} has failed due to:\n ${errors.map(err => err.message).join('\n- ')}`);
|
|
143
|
+
}
|
|
10
144
|
|
|
11
145
|
/**
|
|
12
146
|
* @license
|
|
@@ -72,8 +206,7 @@ function normalizeKeyframes(driver, normalizer, element, keyframes, preStyles =
|
|
|
72
206
|
previousOffset = offset;
|
|
73
207
|
});
|
|
74
208
|
if (errors.length) {
|
|
75
|
-
|
|
76
|
-
throw new Error(`Unable to animate due to the following errors:${LINE_START}${errors.join(LINE_START)}`);
|
|
209
|
+
throw animationFailed(errors);
|
|
77
210
|
}
|
|
78
211
|
return normalizedKeyframes;
|
|
79
212
|
}
|
|
@@ -225,9 +358,9 @@ class NoopAnimationDriver {
|
|
|
225
358
|
return new NoopAnimationPlayer(duration, delay);
|
|
226
359
|
}
|
|
227
360
|
}
|
|
228
|
-
NoopAnimationDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.
|
|
229
|
-
NoopAnimationDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.
|
|
230
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.
|
|
361
|
+
NoopAnimationDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
362
|
+
NoopAnimationDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: NoopAnimationDriver });
|
|
363
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: NoopAnimationDriver, decorators: [{
|
|
231
364
|
type: Injectable
|
|
232
365
|
}] });
|
|
233
366
|
/**
|
|
@@ -282,7 +415,7 @@ function parseTimeExpression(exp, errors, allowNegativeValues) {
|
|
|
282
415
|
if (typeof exp === 'string') {
|
|
283
416
|
const matches = exp.match(regex);
|
|
284
417
|
if (matches === null) {
|
|
285
|
-
errors.push(
|
|
418
|
+
errors.push(invalidTimingValue(exp));
|
|
286
419
|
return { duration: 0, delay: 0, easing: '' };
|
|
287
420
|
}
|
|
288
421
|
duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);
|
|
@@ -302,15 +435,15 @@ function parseTimeExpression(exp, errors, allowNegativeValues) {
|
|
|
302
435
|
let containsErrors = false;
|
|
303
436
|
let startIndex = errors.length;
|
|
304
437
|
if (duration < 0) {
|
|
305
|
-
errors.push(
|
|
438
|
+
errors.push(negativeStepValue());
|
|
306
439
|
containsErrors = true;
|
|
307
440
|
}
|
|
308
441
|
if (delay < 0) {
|
|
309
|
-
errors.push(
|
|
442
|
+
errors.push(negativeDelayValue());
|
|
310
443
|
containsErrors = true;
|
|
311
444
|
}
|
|
312
445
|
if (containsErrors) {
|
|
313
|
-
errors.splice(startIndex, 0,
|
|
446
|
+
errors.splice(startIndex, 0, invalidTimingValue(exp));
|
|
314
447
|
}
|
|
315
448
|
}
|
|
316
449
|
return { duration, delay, easing };
|
|
@@ -416,7 +549,7 @@ function validateStyleParams(value, options, errors) {
|
|
|
416
549
|
if (matches.length) {
|
|
417
550
|
matches.forEach(varName => {
|
|
418
551
|
if (!params.hasOwnProperty(varName)) {
|
|
419
|
-
errors.push(
|
|
552
|
+
errors.push(invalidStyleParams(varName));
|
|
420
553
|
}
|
|
421
554
|
});
|
|
422
555
|
}
|
|
@@ -439,7 +572,7 @@ function interpolateParams(value, params, errors) {
|
|
|
439
572
|
let localVal = params[varName];
|
|
440
573
|
// this means that the value was never overridden by the data passed in by the user
|
|
441
574
|
if (!params.hasOwnProperty(varName)) {
|
|
442
|
-
errors.push(
|
|
575
|
+
errors.push(invalidParamValue(varName));
|
|
443
576
|
localVal = '';
|
|
444
577
|
}
|
|
445
578
|
return localVal.toString();
|
|
@@ -518,7 +651,7 @@ function visitDslNode(visitor, node, context) {
|
|
|
518
651
|
case 12 /* Stagger */:
|
|
519
652
|
return visitor.visitStagger(node, context);
|
|
520
653
|
default:
|
|
521
|
-
throw
|
|
654
|
+
throw invalidNodeType(node.type);
|
|
522
655
|
}
|
|
523
656
|
}
|
|
524
657
|
function computeStyle(element, prop) {
|
|
@@ -554,7 +687,7 @@ function parseInnerTransitionStr(eventStr, expressions, errors) {
|
|
|
554
687
|
}
|
|
555
688
|
const match = eventStr.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/);
|
|
556
689
|
if (match == null || match.length < 4) {
|
|
557
|
-
errors.push(
|
|
690
|
+
errors.push(invalidExpression(eventStr));
|
|
558
691
|
return expressions;
|
|
559
692
|
}
|
|
560
693
|
const fromState = match[1];
|
|
@@ -577,7 +710,7 @@ function parseAnimationAlias(alias, errors) {
|
|
|
577
710
|
case ':decrement':
|
|
578
711
|
return (fromState, toState) => parseFloat(toState) < parseFloat(fromState);
|
|
579
712
|
default:
|
|
580
|
-
errors.push(
|
|
713
|
+
errors.push(invalidTransitionAlias(alias));
|
|
581
714
|
return '* => *';
|
|
582
715
|
}
|
|
583
716
|
}
|
|
@@ -673,7 +806,7 @@ class AnimationAstBuilderVisitor {
|
|
|
673
806
|
const states = [];
|
|
674
807
|
const transitions = [];
|
|
675
808
|
if (metadata.name.charAt(0) == '@') {
|
|
676
|
-
context.errors.push(
|
|
809
|
+
context.errors.push(invalidTrigger());
|
|
677
810
|
}
|
|
678
811
|
metadata.definitions.forEach(def => {
|
|
679
812
|
this._resetContextStyleTimingState(context);
|
|
@@ -693,7 +826,7 @@ class AnimationAstBuilderVisitor {
|
|
|
693
826
|
transitions.push(transition);
|
|
694
827
|
}
|
|
695
828
|
else {
|
|
696
|
-
context.errors.push(
|
|
829
|
+
context.errors.push(invalidDefinition());
|
|
697
830
|
}
|
|
698
831
|
});
|
|
699
832
|
return {
|
|
@@ -726,8 +859,7 @@ class AnimationAstBuilderVisitor {
|
|
|
726
859
|
});
|
|
727
860
|
if (missingSubs.size) {
|
|
728
861
|
const missingSubsArr = iteratorToArray(missingSubs.values());
|
|
729
|
-
context.errors.push(
|
|
730
|
-
.name}", ...) must define default values for all the following style substitutions: ${missingSubsArr.join(', ')}`);
|
|
862
|
+
context.errors.push(invalidState(metadata.name, missingSubsArr));
|
|
731
863
|
}
|
|
732
864
|
}
|
|
733
865
|
return {
|
|
@@ -820,7 +952,7 @@ class AnimationAstBuilderVisitor {
|
|
|
820
952
|
styles.push(styleTuple);
|
|
821
953
|
}
|
|
822
954
|
else {
|
|
823
|
-
context.errors.push(
|
|
955
|
+
context.errors.push(invalidStyleValue(styleTuple));
|
|
824
956
|
}
|
|
825
957
|
}
|
|
826
958
|
else {
|
|
@@ -873,7 +1005,7 @@ class AnimationAstBuilderVisitor {
|
|
|
873
1005
|
return;
|
|
874
1006
|
Object.keys(tuple).forEach(prop => {
|
|
875
1007
|
if (!this._driver.validateStyleProperty(prop)) {
|
|
876
|
-
context.errors.push(
|
|
1008
|
+
context.errors.push(invalidProperty(prop));
|
|
877
1009
|
return;
|
|
878
1010
|
}
|
|
879
1011
|
const collectedStyles = context.collectedStyles[context.currentQuerySelector];
|
|
@@ -882,8 +1014,7 @@ class AnimationAstBuilderVisitor {
|
|
|
882
1014
|
if (collectedEntry) {
|
|
883
1015
|
if (startTime != endTime && startTime >= collectedEntry.startTime &&
|
|
884
1016
|
endTime <= collectedEntry.endTime) {
|
|
885
|
-
context.errors.push(
|
|
886
|
-
.endTime}ms" is also being animated in a parallel animation between the times of "${startTime}ms" and "${endTime}ms"`);
|
|
1017
|
+
context.errors.push(invalidParallelAnimation(prop, collectedEntry.startTime, collectedEntry.endTime, startTime, endTime));
|
|
887
1018
|
updateCollectedStyle = false;
|
|
888
1019
|
}
|
|
889
1020
|
// we always choose the smaller start time value since we
|
|
@@ -903,7 +1034,7 @@ class AnimationAstBuilderVisitor {
|
|
|
903
1034
|
visitKeyframes(metadata, context) {
|
|
904
1035
|
const ast = { type: 5 /* Keyframes */, styles: [], options: null };
|
|
905
1036
|
if (!context.currentAnimateTimings) {
|
|
906
|
-
context.errors.push(
|
|
1037
|
+
context.errors.push(invalidKeyframes());
|
|
907
1038
|
return ast;
|
|
908
1039
|
}
|
|
909
1040
|
const MAX_KEYFRAME_OFFSET = 1;
|
|
@@ -927,15 +1058,15 @@ class AnimationAstBuilderVisitor {
|
|
|
927
1058
|
return style;
|
|
928
1059
|
});
|
|
929
1060
|
if (keyframesOutOfRange) {
|
|
930
|
-
context.errors.push(
|
|
1061
|
+
context.errors.push(invalidOffset());
|
|
931
1062
|
}
|
|
932
1063
|
if (offsetsOutOfOrder) {
|
|
933
|
-
context.errors.push(
|
|
1064
|
+
context.errors.push(keyframeOffsetsOutOfOrder());
|
|
934
1065
|
}
|
|
935
1066
|
const length = metadata.steps.length;
|
|
936
1067
|
let generatedOffset = 0;
|
|
937
1068
|
if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) {
|
|
938
|
-
context.errors.push(
|
|
1069
|
+
context.errors.push(keyframesMissingOffsets());
|
|
939
1070
|
}
|
|
940
1071
|
else if (totalKeyframesWithOffsets == 0) {
|
|
941
1072
|
generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1);
|
|
@@ -1001,7 +1132,7 @@ class AnimationAstBuilderVisitor {
|
|
|
1001
1132
|
}
|
|
1002
1133
|
visitStagger(metadata, context) {
|
|
1003
1134
|
if (!context.currentQuery) {
|
|
1004
|
-
context.errors.push(
|
|
1135
|
+
context.errors.push(invalidStagger());
|
|
1005
1136
|
}
|
|
1006
1137
|
const timings = metadata.timings === 'full' ?
|
|
1007
1138
|
{ duration: 0, delay: 0, easing: 'full' } :
|
|
@@ -1624,7 +1755,7 @@ class AnimationTimelineContext {
|
|
|
1624
1755
|
results.push(...elements);
|
|
1625
1756
|
}
|
|
1626
1757
|
if (!optional && results.length == 0) {
|
|
1627
|
-
errors.push(
|
|
1758
|
+
errors.push(invalidQuery(originalSelector));
|
|
1628
1759
|
}
|
|
1629
1760
|
return results;
|
|
1630
1761
|
}
|
|
@@ -1912,8 +2043,7 @@ class Animation {
|
|
|
1912
2043
|
const errors = [];
|
|
1913
2044
|
const ast = buildAnimationAst(_driver, input, errors);
|
|
1914
2045
|
if (errors.length) {
|
|
1915
|
-
|
|
1916
|
-
throw new Error(errorMessage);
|
|
2046
|
+
throw validationFailed(errors);
|
|
1917
2047
|
}
|
|
1918
2048
|
this._animationAst = ast;
|
|
1919
2049
|
}
|
|
@@ -1926,8 +2056,7 @@ class Animation {
|
|
|
1926
2056
|
subInstructions = subInstructions || new ElementInstructionMap();
|
|
1927
2057
|
const result = buildAnimationTimelines(this._driver, element, this._animationAst, ENTER_CLASSNAME, LEAVE_CLASSNAME, start, dest, options, subInstructions, errors);
|
|
1928
2058
|
if (errors.length) {
|
|
1929
|
-
|
|
1930
|
-
throw new Error(errorMessage);
|
|
2059
|
+
throw buildingFailed(errors);
|
|
1931
2060
|
}
|
|
1932
2061
|
return result;
|
|
1933
2062
|
}
|
|
@@ -1978,7 +2107,7 @@ class WebAnimationsStyleNormalizer extends AnimationStyleNormalizer {
|
|
|
1978
2107
|
else {
|
|
1979
2108
|
const valAndSuffixMatch = value.match(/^[+-]?[\d\.]+([a-z]*)$/);
|
|
1980
2109
|
if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) {
|
|
1981
|
-
errors.push(
|
|
2110
|
+
errors.push(invalidCssUnitValue(userProvidedProperty, value));
|
|
1982
2111
|
}
|
|
1983
2112
|
}
|
|
1984
2113
|
}
|
|
@@ -2177,7 +2306,7 @@ class TimelineAnimationEngine {
|
|
|
2177
2306
|
const errors = [];
|
|
2178
2307
|
const ast = buildAnimationAst(this._driver, metadata, errors);
|
|
2179
2308
|
if (errors.length) {
|
|
2180
|
-
throw
|
|
2309
|
+
throw registerFailed(errors);
|
|
2181
2310
|
}
|
|
2182
2311
|
else {
|
|
2183
2312
|
this._animations[id] = ast;
|
|
@@ -2201,11 +2330,11 @@ class TimelineAnimationEngine {
|
|
|
2201
2330
|
});
|
|
2202
2331
|
}
|
|
2203
2332
|
else {
|
|
2204
|
-
errors.push(
|
|
2333
|
+
errors.push(missingOrDestroyedAnimation());
|
|
2205
2334
|
instructions = [];
|
|
2206
2335
|
}
|
|
2207
2336
|
if (errors.length) {
|
|
2208
|
-
throw
|
|
2337
|
+
throw createAnimationFailed(errors);
|
|
2209
2338
|
}
|
|
2210
2339
|
autoStylesMap.forEach((styles, element) => {
|
|
2211
2340
|
Object.keys(styles).forEach(prop => {
|
|
@@ -2234,7 +2363,7 @@ class TimelineAnimationEngine {
|
|
|
2234
2363
|
_getPlayer(id) {
|
|
2235
2364
|
const player = this._playersById[id];
|
|
2236
2365
|
if (!player) {
|
|
2237
|
-
throw
|
|
2366
|
+
throw missingPlayer(id);
|
|
2238
2367
|
}
|
|
2239
2368
|
return player;
|
|
2240
2369
|
}
|
|
@@ -2362,13 +2491,13 @@ class AnimationTransitionNamespace {
|
|
|
2362
2491
|
}
|
|
2363
2492
|
listen(element, name, phase, callback) {
|
|
2364
2493
|
if (!this._triggers.hasOwnProperty(name)) {
|
|
2365
|
-
throw
|
|
2494
|
+
throw missingTrigger(phase, name);
|
|
2366
2495
|
}
|
|
2367
2496
|
if (phase == null || phase.length == 0) {
|
|
2368
|
-
throw
|
|
2497
|
+
throw missingEvent(name);
|
|
2369
2498
|
}
|
|
2370
2499
|
if (!isTriggerEventValid(phase)) {
|
|
2371
|
-
throw
|
|
2500
|
+
throw unsupportedTriggerEvent(phase, name);
|
|
2372
2501
|
}
|
|
2373
2502
|
const listeners = getOrSetAsInMap(this._elementListeners, element, []);
|
|
2374
2503
|
const data = { name, phase, callback };
|
|
@@ -2407,7 +2536,7 @@ class AnimationTransitionNamespace {
|
|
|
2407
2536
|
_getTrigger(name) {
|
|
2408
2537
|
const trigger = this._triggers[name];
|
|
2409
2538
|
if (!trigger) {
|
|
2410
|
-
throw
|
|
2539
|
+
throw unregisteredTrigger(name);
|
|
2411
2540
|
}
|
|
2412
2541
|
return trigger;
|
|
2413
2542
|
}
|
|
@@ -3047,7 +3176,7 @@ class TransitionAnimationEngine {
|
|
|
3047
3176
|
}
|
|
3048
3177
|
}
|
|
3049
3178
|
reportError(errors) {
|
|
3050
|
-
throw
|
|
3179
|
+
throw triggerTransitionsFailed(errors);
|
|
3051
3180
|
}
|
|
3052
3181
|
_flushAnimations(cleanupFns, microtaskId) {
|
|
3053
3182
|
const subTimelines = new ElementInstructionMap();
|
|
@@ -3209,8 +3338,7 @@ class TransitionAnimationEngine {
|
|
|
3209
3338
|
if (erroneousTransitions.length) {
|
|
3210
3339
|
const errors = [];
|
|
3211
3340
|
erroneousTransitions.forEach(instruction => {
|
|
3212
|
-
errors.push(
|
|
3213
|
-
instruction.errors.forEach(error => errors.push(`- ${error}\n`));
|
|
3341
|
+
errors.push(transitionFailed(instruction.triggerName, instruction.errors));
|
|
3214
3342
|
});
|
|
3215
3343
|
allPlayers.forEach(player => player.destroy());
|
|
3216
3344
|
this.reportError(errors);
|
|
@@ -3825,7 +3953,7 @@ class AnimationEngine {
|
|
|
3825
3953
|
const errors = [];
|
|
3826
3954
|
const ast = buildAnimationAst(this._driver, metadata, errors);
|
|
3827
3955
|
if (errors.length) {
|
|
3828
|
-
throw
|
|
3956
|
+
throw triggerBuildFailed(name, errors);
|
|
3829
3957
|
}
|
|
3830
3958
|
trigger = buildTrigger(name, ast, this._normalizer);
|
|
3831
3959
|
this._triggerCache[cacheKey] = trigger;
|