@angular/animations 14.0.1 → 14.0.4

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.1
2
+ * @license Angular v14.0.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -15,131 +15,129 @@ import { ɵRuntimeError, Injectable } from '@angular/core';
15
15
  * Use of this source code is governed by an MIT-style license that can be
16
16
  * found in the LICENSE file at https://angular.io/license
17
17
  */
18
- const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
19
18
  const LINE_START = '\n - ';
20
19
  function invalidTimingValue(exp) {
21
- return new ɵRuntimeError(3000 /* RuntimeErrorCode.INVALID_TIMING_VALUE */, NG_DEV_MODE$1 && `The provided timing value "${exp}" is invalid.`);
20
+ return new ɵRuntimeError(3000 /* RuntimeErrorCode.INVALID_TIMING_VALUE */, ngDevMode && `The provided timing value "${exp}" is invalid.`);
22
21
  }
23
22
  function negativeStepValue() {
24
- return new ɵRuntimeError(3100 /* RuntimeErrorCode.NEGATIVE_STEP_VALUE */, NG_DEV_MODE$1 && 'Duration values below 0 are not allowed for this animation step.');
23
+ return new ɵRuntimeError(3100 /* RuntimeErrorCode.NEGATIVE_STEP_VALUE */, ngDevMode && 'Duration values below 0 are not allowed for this animation step.');
25
24
  }
26
25
  function negativeDelayValue() {
27
- return new ɵRuntimeError(3101 /* RuntimeErrorCode.NEGATIVE_DELAY_VALUE */, NG_DEV_MODE$1 && 'Delay values below 0 are not allowed for this animation step.');
26
+ return new ɵRuntimeError(3101 /* RuntimeErrorCode.NEGATIVE_DELAY_VALUE */, ngDevMode && 'Delay values below 0 are not allowed for this animation step.');
28
27
  }
29
28
  function invalidStyleParams(varName) {
30
- return new ɵRuntimeError(3001 /* RuntimeErrorCode.INVALID_STYLE_PARAMS */, NG_DEV_MODE$1 &&
29
+ return new ɵRuntimeError(3001 /* RuntimeErrorCode.INVALID_STYLE_PARAMS */, ngDevMode &&
31
30
  `Unable to resolve the local animation param ${varName} in the given list of values`);
32
31
  }
33
32
  function invalidParamValue(varName) {
34
- return new ɵRuntimeError(3003 /* RuntimeErrorCode.INVALID_PARAM_VALUE */, NG_DEV_MODE$1 && `Please provide a value for the animation param ${varName}`);
33
+ return new ɵRuntimeError(3003 /* RuntimeErrorCode.INVALID_PARAM_VALUE */, ngDevMode && `Please provide a value for the animation param ${varName}`);
35
34
  }
36
35
  function invalidNodeType(nodeType) {
37
- return new ɵRuntimeError(3004 /* RuntimeErrorCode.INVALID_NODE_TYPE */, NG_DEV_MODE$1 && `Unable to resolve animation metadata node #${nodeType}`);
36
+ return new ɵRuntimeError(3004 /* RuntimeErrorCode.INVALID_NODE_TYPE */, ngDevMode && `Unable to resolve animation metadata node #${nodeType}`);
38
37
  }
39
38
  function invalidCssUnitValue(userProvidedProperty, value) {
40
- return new ɵRuntimeError(3005 /* RuntimeErrorCode.INVALID_CSS_UNIT_VALUE */, NG_DEV_MODE$1 && `Please provide a CSS unit value for ${userProvidedProperty}:${value}`);
39
+ return new ɵRuntimeError(3005 /* RuntimeErrorCode.INVALID_CSS_UNIT_VALUE */, ngDevMode && `Please provide a CSS unit value for ${userProvidedProperty}:${value}`);
41
40
  }
42
41
  function invalidTrigger() {
43
- return new ɵRuntimeError(3006 /* RuntimeErrorCode.INVALID_TRIGGER */, NG_DEV_MODE$1 &&
42
+ return new ɵRuntimeError(3006 /* RuntimeErrorCode.INVALID_TRIGGER */, ngDevMode &&
44
43
  'animation triggers cannot be prefixed with an `@` sign (e.g. trigger(\'@foo\', [...]))');
45
44
  }
46
45
  function invalidDefinition() {
47
- return new ɵRuntimeError(3007 /* RuntimeErrorCode.INVALID_DEFINITION */, NG_DEV_MODE$1 && 'only state() and transition() definitions can sit inside of a trigger()');
46
+ return new ɵRuntimeError(3007 /* RuntimeErrorCode.INVALID_DEFINITION */, ngDevMode && 'only state() and transition() definitions can sit inside of a trigger()');
48
47
  }
49
48
  function invalidState(metadataName, missingSubs) {
50
- return new ɵRuntimeError(3008 /* RuntimeErrorCode.INVALID_STATE */, NG_DEV_MODE$1 &&
49
+ return new ɵRuntimeError(3008 /* RuntimeErrorCode.INVALID_STATE */, ngDevMode &&
51
50
  `state("${metadataName}", ...) must define default values for all the following style substitutions: ${missingSubs.join(', ')}`);
52
51
  }
53
52
  function invalidStyleValue(value) {
54
- return new ɵRuntimeError(3002 /* RuntimeErrorCode.INVALID_STYLE_VALUE */, NG_DEV_MODE$1 && `The provided style string value ${value} is not allowed.`);
53
+ return new ɵRuntimeError(3002 /* RuntimeErrorCode.INVALID_STYLE_VALUE */, ngDevMode && `The provided style string value ${value} is not allowed.`);
55
54
  }
56
55
  function invalidProperty(prop) {
57
- return new ɵRuntimeError(3009 /* RuntimeErrorCode.INVALID_PROPERTY */, NG_DEV_MODE$1 &&
56
+ return new ɵRuntimeError(3009 /* RuntimeErrorCode.INVALID_PROPERTY */, ngDevMode &&
58
57
  `The provided animation property "${prop}" is not a supported CSS property for animations`);
59
58
  }
60
59
  function invalidParallelAnimation(prop, firstStart, firstEnd, secondStart, secondEnd) {
61
- return new ɵRuntimeError(3010 /* RuntimeErrorCode.INVALID_PARALLEL_ANIMATION */, NG_DEV_MODE$1 &&
60
+ return new ɵRuntimeError(3010 /* RuntimeErrorCode.INVALID_PARALLEL_ANIMATION */, ngDevMode &&
62
61
  `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
62
  }
64
63
  function invalidKeyframes() {
65
- return new ɵRuntimeError(3011 /* RuntimeErrorCode.INVALID_KEYFRAMES */, NG_DEV_MODE$1 && `keyframes() must be placed inside of a call to animate()`);
64
+ return new ɵRuntimeError(3011 /* RuntimeErrorCode.INVALID_KEYFRAMES */, ngDevMode && `keyframes() must be placed inside of a call to animate()`);
66
65
  }
67
66
  function invalidOffset() {
68
- return new ɵRuntimeError(3012 /* RuntimeErrorCode.INVALID_OFFSET */, NG_DEV_MODE$1 && `Please ensure that all keyframe offsets are between 0 and 1`);
67
+ return new ɵRuntimeError(3012 /* RuntimeErrorCode.INVALID_OFFSET */, ngDevMode && `Please ensure that all keyframe offsets are between 0 and 1`);
69
68
  }
70
69
  function keyframeOffsetsOutOfOrder() {
71
- return new ɵRuntimeError(3200 /* RuntimeErrorCode.KEYFRAME_OFFSETS_OUT_OF_ORDER */, NG_DEV_MODE$1 && `Please ensure that all keyframe offsets are in order`);
70
+ return new ɵRuntimeError(3200 /* RuntimeErrorCode.KEYFRAME_OFFSETS_OUT_OF_ORDER */, ngDevMode && `Please ensure that all keyframe offsets are in order`);
72
71
  }
73
72
  function keyframesMissingOffsets() {
74
- return new ɵRuntimeError(3202 /* RuntimeErrorCode.KEYFRAMES_MISSING_OFFSETS */, NG_DEV_MODE$1 && `Not all style() steps within the declared keyframes() contain offsets`);
73
+ return new ɵRuntimeError(3202 /* RuntimeErrorCode.KEYFRAMES_MISSING_OFFSETS */, ngDevMode && `Not all style() steps within the declared keyframes() contain offsets`);
75
74
  }
76
75
  function invalidStagger() {
77
- return new ɵRuntimeError(3013 /* RuntimeErrorCode.INVALID_STAGGER */, NG_DEV_MODE$1 && `stagger() can only be used inside of query()`);
76
+ return new ɵRuntimeError(3013 /* RuntimeErrorCode.INVALID_STAGGER */, ngDevMode && `stagger() can only be used inside of query()`);
78
77
  }
79
78
  function invalidQuery(selector) {
80
- return new ɵRuntimeError(3014 /* RuntimeErrorCode.INVALID_QUERY */, NG_DEV_MODE$1 &&
79
+ return new ɵRuntimeError(3014 /* RuntimeErrorCode.INVALID_QUERY */, ngDevMode &&
81
80
  `\`query("${selector}")\` returned zero elements. (Use \`query("${selector}", { optional: true })\` if you wish to allow this.)`);
82
81
  }
83
82
  function invalidExpression(expr) {
84
- return new ɵRuntimeError(3015 /* RuntimeErrorCode.INVALID_EXPRESSION */, NG_DEV_MODE$1 && `The provided transition expression "${expr}" is not supported`);
83
+ return new ɵRuntimeError(3015 /* RuntimeErrorCode.INVALID_EXPRESSION */, ngDevMode && `The provided transition expression "${expr}" is not supported`);
85
84
  }
86
85
  function invalidTransitionAlias(alias) {
87
- return new ɵRuntimeError(3016 /* RuntimeErrorCode.INVALID_TRANSITION_ALIAS */, NG_DEV_MODE$1 && `The transition alias value "${alias}" is not supported`);
86
+ return new ɵRuntimeError(3016 /* RuntimeErrorCode.INVALID_TRANSITION_ALIAS */, ngDevMode && `The transition alias value "${alias}" is not supported`);
88
87
  }
89
88
  function validationFailed(errors) {
90
- return new ɵRuntimeError(3500 /* RuntimeErrorCode.VALIDATION_FAILED */, NG_DEV_MODE$1 && `animation validation failed:\n${errors.map(err => err.message).join('\n')}`);
89
+ return new ɵRuntimeError(3500 /* RuntimeErrorCode.VALIDATION_FAILED */, ngDevMode && `animation validation failed:\n${errors.map(err => err.message).join('\n')}`);
91
90
  }
92
91
  function buildingFailed(errors) {
93
- return new ɵRuntimeError(3501 /* RuntimeErrorCode.BUILDING_FAILED */, NG_DEV_MODE$1 && `animation building failed:\n${errors.map(err => err.message).join('\n')}`);
92
+ return new ɵRuntimeError(3501 /* RuntimeErrorCode.BUILDING_FAILED */, ngDevMode && `animation building failed:\n${errors.map(err => err.message).join('\n')}`);
94
93
  }
95
94
  function triggerBuildFailed(name, errors) {
96
- return new ɵRuntimeError(3404 /* RuntimeErrorCode.TRIGGER_BUILD_FAILED */, NG_DEV_MODE$1 &&
95
+ return new ɵRuntimeError(3404 /* RuntimeErrorCode.TRIGGER_BUILD_FAILED */, ngDevMode &&
97
96
  `The animation trigger "${name}" has failed to build due to the following errors:\n - ${errors.map(err => err.message).join('\n - ')}`);
98
97
  }
99
98
  function animationFailed(errors) {
100
- return new ɵRuntimeError(3502 /* RuntimeErrorCode.ANIMATION_FAILED */, NG_DEV_MODE$1 &&
99
+ return new ɵRuntimeError(3502 /* RuntimeErrorCode.ANIMATION_FAILED */, ngDevMode &&
101
100
  `Unable to animate due to the following errors:${LINE_START}${errors.map(err => err.message).join(LINE_START)}`);
102
101
  }
103
102
  function registerFailed(errors) {
104
- return new ɵRuntimeError(3503 /* RuntimeErrorCode.REGISTRATION_FAILED */, NG_DEV_MODE$1 &&
103
+ return new ɵRuntimeError(3503 /* RuntimeErrorCode.REGISTRATION_FAILED */, ngDevMode &&
105
104
  `Unable to build the animation due to the following errors: ${errors.map(err => err.message).join('\n')}`);
106
105
  }
107
106
  function missingOrDestroyedAnimation() {
108
- return new ɵRuntimeError(3300 /* RuntimeErrorCode.MISSING_OR_DESTROYED_ANIMATION */, NG_DEV_MODE$1 && 'The requested animation doesn\'t exist or has already been destroyed');
107
+ return new ɵRuntimeError(3300 /* RuntimeErrorCode.MISSING_OR_DESTROYED_ANIMATION */, ngDevMode && 'The requested animation doesn\'t exist or has already been destroyed');
109
108
  }
110
109
  function createAnimationFailed(errors) {
111
- return new ɵRuntimeError(3504 /* RuntimeErrorCode.CREATE_ANIMATION_FAILED */, NG_DEV_MODE$1 &&
110
+ return new ɵRuntimeError(3504 /* RuntimeErrorCode.CREATE_ANIMATION_FAILED */, ngDevMode &&
112
111
  `Unable to create the animation due to the following errors:${errors.map(err => err.message).join('\n')}`);
113
112
  }
114
113
  function missingPlayer(id) {
115
- return new ɵRuntimeError(3301 /* RuntimeErrorCode.MISSING_PLAYER */, NG_DEV_MODE$1 && `Unable to find the timeline player referenced by ${id}`);
114
+ return new ɵRuntimeError(3301 /* RuntimeErrorCode.MISSING_PLAYER */, ngDevMode && `Unable to find the timeline player referenced by ${id}`);
116
115
  }
117
116
  function missingTrigger(phase, name) {
118
- return new ɵRuntimeError(3302 /* RuntimeErrorCode.MISSING_TRIGGER */, NG_DEV_MODE$1 &&
117
+ return new ɵRuntimeError(3302 /* RuntimeErrorCode.MISSING_TRIGGER */, ngDevMode &&
119
118
  `Unable to listen on the animation trigger event "${phase}" because the animation trigger "${name}" doesn\'t exist!`);
120
119
  }
121
120
  function missingEvent(name) {
122
- return new ɵRuntimeError(3303 /* RuntimeErrorCode.MISSING_EVENT */, NG_DEV_MODE$1 &&
121
+ return new ɵRuntimeError(3303 /* RuntimeErrorCode.MISSING_EVENT */, ngDevMode &&
123
122
  `Unable to listen on the animation trigger "${name}" because the provided event is undefined!`);
124
123
  }
125
124
  function unsupportedTriggerEvent(phase, name) {
126
- return new ɵRuntimeError(3400 /* RuntimeErrorCode.UNSUPPORTED_TRIGGER_EVENT */, NG_DEV_MODE$1 &&
125
+ return new ɵRuntimeError(3400 /* RuntimeErrorCode.UNSUPPORTED_TRIGGER_EVENT */, ngDevMode &&
127
126
  `The provided animation trigger event "${phase}" for the animation trigger "${name}" is not supported!`);
128
127
  }
129
128
  function unregisteredTrigger(name) {
130
- return new ɵRuntimeError(3401 /* RuntimeErrorCode.UNREGISTERED_TRIGGER */, NG_DEV_MODE$1 && `The provided animation trigger "${name}" has not been registered!`);
129
+ return new ɵRuntimeError(3401 /* RuntimeErrorCode.UNREGISTERED_TRIGGER */, ngDevMode && `The provided animation trigger "${name}" has not been registered!`);
131
130
  }
132
131
  function triggerTransitionsFailed(errors) {
133
- return new ɵRuntimeError(3402 /* RuntimeErrorCode.TRIGGER_TRANSITIONS_FAILED */, NG_DEV_MODE$1 &&
132
+ return new ɵRuntimeError(3402 /* RuntimeErrorCode.TRIGGER_TRANSITIONS_FAILED */, ngDevMode &&
134
133
  `Unable to process animations due to the following failed trigger transitions\n ${errors.map(err => err.message).join('\n')}`);
135
134
  }
136
135
  function triggerParsingFailed(name, errors) {
137
- return new ɵRuntimeError(3403 /* RuntimeErrorCode.TRIGGER_PARSING_FAILED */, NG_DEV_MODE$1 &&
136
+ return new ɵRuntimeError(3403 /* RuntimeErrorCode.TRIGGER_PARSING_FAILED */, ngDevMode &&
138
137
  `Animation parsing for the ${name} trigger have failed:${LINE_START}${errors.map(err => err.message).join(LINE_START)}`);
139
138
  }
140
139
  function transitionFailed(name, errors) {
141
- return new ɵRuntimeError(3505 /* RuntimeErrorCode.TRANSITION_FAILED */, NG_DEV_MODE$1 &&
142
- `@${name} has failed due to:\n ${errors.map(err => err.message).join('\n- ')}`);
140
+ return new ɵRuntimeError(3505 /* RuntimeErrorCode.TRANSITION_FAILED */, ngDevMode && `@${name} has failed due to:\n ${errors.map(err => err.message).join('\n- ')}`);
143
141
  }
144
142
 
145
143
  /**
@@ -580,9 +578,9 @@ class NoopAnimationDriver {
580
578
  return new NoopAnimationPlayer(duration, delay);
581
579
  }
582
580
  }
583
- NoopAnimationDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
584
- NoopAnimationDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: NoopAnimationDriver });
585
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: NoopAnimationDriver, decorators: [{
581
+ NoopAnimationDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
582
+ NoopAnimationDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoopAnimationDriver });
583
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoopAnimationDriver, decorators: [{
586
584
  type: Injectable
587
585
  }] });
588
586
  /**
@@ -2971,10 +2969,13 @@ class AnimationTransitionNamespace {
2971
2969
  }
2972
2970
  _signalRemovalForInnerTriggers(rootElement, context) {
2973
2971
  const elements = this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true);
2972
+ const shadowElements = rootElement.shadowRoot ?
2973
+ this._engine.driver.query(rootElement.shadowRoot, NG_TRIGGER_SELECTOR, true) :
2974
+ [];
2974
2975
  // emulate a leave animation for all inner nodes within this node.
2975
2976
  // If there are no animations found for any of the nodes then clear the cache
2976
2977
  // for the element.
2977
- elements.forEach(elm => {
2978
+ [...elements, ...shadowElements].forEach(elm => {
2978
2979
  // this means that an inner remove() operation has already kicked off
2979
2980
  // the animation on this element...
2980
2981
  if (elm[REMOVAL_FLAG])
@@ -3049,7 +3050,9 @@ class AnimationTransitionNamespace {
3049
3050
  }
3050
3051
  removeNode(element, context) {
3051
3052
  const engine = this._engine;
3052
- if (element.childElementCount) {
3053
+ const elementHasChildren = !!element.childElementCount;
3054
+ const elementHasShadowChildren = !!(element.shadowRoot && element.shadowRoot.childElementCount);
3055
+ if (elementHasChildren || elementHasShadowChildren) {
3053
3056
  this._signalRemovalForInnerTriggers(element, context);
3054
3057
  }
3055
3058
  // this means that a * => VOID animation was detected and kicked off
@@ -4440,6 +4443,11 @@ class WebAnimationsPlayer {
4440
4443
  this._finished = false;
4441
4444
  this._started = false;
4442
4445
  this._destroyed = false;
4446
+ // the following original fns are persistent copies of the _onStartFns and _onDoneFns
4447
+ // and are used to reset the fns to their original values upon reset()
4448
+ // (since the _onStartFns and _onDoneFns get deleted after they are called)
4449
+ this._originalOnDoneFns = [];
4450
+ this._originalOnStartFns = [];
4443
4451
  this.time = 0;
4444
4452
  this.parentPlayer = null;
4445
4453
  this.currentSnapshot = new Map();
@@ -4491,9 +4499,11 @@ class WebAnimationsPlayer {
4491
4499
  return element['animate'](this._convertKeyframesToObject(keyframes), options);
4492
4500
  }
4493
4501
  onStart(fn) {
4502
+ this._originalOnStartFns.push(fn);
4494
4503
  this._onStartFns.push(fn);
4495
4504
  }
4496
4505
  onDone(fn) {
4506
+ this._originalOnDoneFns.push(fn);
4497
4507
  this._onDoneFns.push(fn);
4498
4508
  }
4499
4509
  onDestroy(fn) {
@@ -4528,6 +4538,8 @@ class WebAnimationsPlayer {
4528
4538
  this._destroyed = false;
4529
4539
  this._finished = false;
4530
4540
  this._started = false;
4541
+ this._onStartFns = this._originalOnStartFns;
4542
+ this._onDoneFns = this._originalOnDoneFns;
4531
4543
  }
4532
4544
  _resetDomPlayerState() {
4533
4545
  if (this.domPlayer) {