@angular/animations 13.1.0-next.0 → 13.1.0

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 v13.1.0-next.0
2
+ * @license Angular v13.1.0
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -126,7 +126,6 @@ function parseTimelineCommand(command) {
126
126
  return [id, action];
127
127
  }
128
128
  let _contains = (elm1, elm2) => false;
129
- let _matches = (element, selector) => false;
130
129
  let _query = (element, selector, multi) => {
131
130
  return [];
132
131
  };
@@ -148,22 +147,6 @@ if (_isNode || typeof Element !== 'undefined') {
148
147
  return false;
149
148
  };
150
149
  }
151
- _matches = (() => {
152
- if (_isNode || Element.prototype.matches) {
153
- return (element, selector) => element.matches(selector);
154
- }
155
- else {
156
- const proto = Element.prototype;
157
- const fn = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector ||
158
- proto.oMatchesSelector || proto.webkitMatchesSelector;
159
- if (fn) {
160
- return (element, selector) => fn.apply(element, [selector]);
161
- }
162
- else {
163
- return _matches;
164
- }
165
- }
166
- })();
167
150
  _query = (element, selector, multi) => {
168
151
  let results = [];
169
152
  if (multi) {
@@ -216,7 +199,6 @@ function getBodyNode() {
216
199
  }
217
200
  return null;
218
201
  }
219
- const matchesElement = _matches;
220
202
  const containsElement = _contains;
221
203
  const invokeQuery = _query;
222
204
  function hypenatePropsObject(object) {
@@ -242,8 +224,9 @@ class NoopAnimationDriver {
242
224
  validateStyleProperty(prop) {
243
225
  return validateStyleProperty(prop);
244
226
  }
245
- matchesElement(element, selector) {
246
- return matchesElement(element, selector);
227
+ matchesElement(_element, _selector) {
228
+ // This method is deprecated and no longer in use so we return false.
229
+ return false;
247
230
  }
248
231
  containsElement(elm1, elm2) {
249
232
  return containsElement(elm1, elm2);
@@ -258,9 +241,9 @@ class NoopAnimationDriver {
258
241
  return new NoopAnimationPlayer(duration, delay);
259
242
  }
260
243
  }
261
- NoopAnimationDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
262
- NoopAnimationDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: NoopAnimationDriver });
263
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0-next.0", ngImport: i0, type: NoopAnimationDriver, decorators: [{
244
+ NoopAnimationDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
245
+ NoopAnimationDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: NoopAnimationDriver });
246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: NoopAnimationDriver, decorators: [{
264
247
  type: Injectable
265
248
  }] });
266
249
  /**
@@ -1054,7 +1037,8 @@ function normalizeSelector(selector) {
1054
1037
  if (hasAmpersand) {
1055
1038
  selector = selector.replace(SELF_TOKEN_REGEX, '');
1056
1039
  }
1057
- // the :enter and :leave selectors are filled in at runtime during timeline building
1040
+ // Note: the :enter and :leave aren't normalized here since those
1041
+ // selectors are filled in at runtime during timeline building
1058
1042
  selector = selector.replace(/@\*/g, NG_TRIGGER_SELECTOR)
1059
1043
  .replace(/@\w+/g, match => NG_TRIGGER_SELECTOR + '-' + match.substr(1))
1060
1044
  .replace(/:animating/g, NG_ANIMATING_SELECTOR);
@@ -1229,14 +1213,14 @@ const LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g');
1229
1213
  * [TimelineBuilder]
1230
1214
  * This class is responsible for tracking the styles and building a series of keyframe objects for a
1231
1215
  * timeline between a start and end time. The builder starts off with an initial timeline and each
1232
- * time the AST comes across a `group()`, `keyframes()` or a combination of the two wihtin a
1216
+ * time the AST comes across a `group()`, `keyframes()` or a combination of the two within a
1233
1217
  * `sequence()` then it will generate a sub timeline for each step as well as a new one after
1234
1218
  * they are complete.
1235
1219
  *
1236
1220
  * As the AST is traversed, the timing state on each of the timelines will be incremented. If a sub
1237
1221
  * timeline was created (based on one of the cases above) then the parent timeline will attempt to
1238
1222
  * merge the styles used within the sub timelines into itself (only with group() this will happen).
1239
- * This happens with a merge operation (much like how the merge works in mergesort) and it will only
1223
+ * This happens with a merge operation (much like how the merge works in mergeSort) and it will only
1240
1224
  * copy the most recently used styles from the sub timelines into the parent timeline. This ensures
1241
1225
  * that if the styles are used later on in another phase of the animation then they will be the most
1242
1226
  * up-to-date values.
@@ -1261,7 +1245,7 @@ const LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g');
1261
1245
  * from all previous keyframes up until where it is first used. For the timeline keyframe generation
1262
1246
  * to properly fill in the style it will place the previous value (the value from the parent
1263
1247
  * timeline) or a default value of `*` into the backFill object. Given that each of the keyframe
1264
- * styles are objects that prototypically inhert from the backFill object, this means that if a
1248
+ * styles are objects that prototypically inherits from the backFill object, this means that if a
1265
1249
  * value is added into the backFill then it will automatically propagate any missing values to all
1266
1250
  * keyframes. Therefore the missing `height` value will be properly filled into the already
1267
1251
  * processed keyframes.
@@ -1366,7 +1350,7 @@ class AnimationTimelineBuilderVisitor {
1366
1350
  }
1367
1351
  if (ast.steps.length) {
1368
1352
  ast.steps.forEach(s => visitDslNode(this, s, ctx));
1369
- // this is here just incase the inner steps only contain or end with a style() call
1353
+ // this is here just in case the inner steps only contain or end with a style() call
1370
1354
  ctx.currentTimeline.applyStylesToKeyframe();
1371
1355
  // this means that some animation function within the sequence
1372
1356
  // ended up creating a sub timeline (which means the current
@@ -1642,7 +1626,7 @@ class AnimationTimelineContext {
1642
1626
  if (includeSelf) {
1643
1627
  results.push(this.element);
1644
1628
  }
1645
- if (selector.length > 0) { // if :self is only used then the selector is empty
1629
+ if (selector.length > 0) { // only if :self is used then the selector can be empty
1646
1630
  selector = selector.replace(ENTER_TOKEN_REGEX, '.' + this._enterClassName);
1647
1631
  selector = selector.replace(LEAVE_TOKEN_REGEX, '.' + this._leaveClassName);
1648
1632
  const multi = limit != 1;
@@ -1887,7 +1871,7 @@ class SubTimelineBuilder extends TimelineBuilder {
1887
1871
  When the keyframe is stretched then it means that the delay before the animation
1888
1872
  starts is gone. Instead the first keyframe is placed at the start of the animation
1889
1873
  and it is then copied to where it starts when the original delay is over. This basically
1890
- means nothing animates during that delay, but the styles are still renderered. For this
1874
+ means nothing animates during that delay, but the styles are still rendered. For this
1891
1875
  to work the original offset values that exist in the original keyframes must be "warped"
1892
1876
  so that they can take the new keyframe + delay into account.
1893
1877
 
@@ -2491,7 +2475,7 @@ class AnimationTransitionNamespace {
2491
2475
  // only remove the player if it is queued on the EXACT same trigger/namespace
2492
2476
  // we only also deal with queued players here because if the animation has
2493
2477
  // started then we want to keep the player alive until the flush happens
2494
- // (which is where the previousPlayers are passed into the new palyer)
2478
+ // (which is where the previousPlayers are passed into the new player)
2495
2479
  if (player.namespaceId == this.id && player.triggerName == triggerName && player.queued) {
2496
2480
  player.destroy();
2497
2481
  }
@@ -2781,7 +2765,7 @@ class TransitionAnimationEngine {
2781
2765
  // been inserted so that we know exactly where to place it in
2782
2766
  // the namespace list
2783
2767
  this.newHostElements.set(hostElement, ns);
2784
- // given that this host element is apart of the animation code, it
2768
+ // given that this host element is a part of the animation code, it
2785
2769
  // may or may not be inserted by a parent node that is of an
2786
2770
  // animation renderer type. If this happens then we can still have
2787
2771
  // access to this item when we query for :enter nodes. If the parent
@@ -2846,8 +2830,8 @@ class TransitionAnimationEngine {
2846
2830
  // normally there should only be one namespace per element, however
2847
2831
  // if @triggers are placed on both the component element and then
2848
2832
  // its host element (within the component code) then there will be
2849
- // two namespaces returned. We use a set here to simply the dedupe
2850
- // of namespaces incase there are multiple triggers both the elm and host
2833
+ // two namespaces returned. We use a set here to simply deduplicate
2834
+ // the namespaces in case (for the reason described above) there are multiple triggers
2851
2835
  const namespaces = new Set();
2852
2836
  const elementStates = this.statesByElement.get(element);
2853
2837
  if (elementStates) {
@@ -3011,7 +2995,7 @@ class TransitionAnimationEngine {
3011
2995
  }
3012
2996
  this._onRemovalComplete(element, details.setForRemoval);
3013
2997
  }
3014
- if (this.driver.matchesElement(element, DISABLED_SELECTOR)) {
2998
+ if (element.classList?.contains(DISABLED_CLASSNAME)) {
3015
2999
  this.markElementAsDisabled(element, false);
3016
3000
  }
3017
3001
  this.driver.query(element, DISABLED_SELECTOR, true).forEach(node => {
@@ -3162,29 +3146,30 @@ class TransitionAnimationEngine {
3162
3146
  erroneousTransitions.push(instruction);
3163
3147
  return;
3164
3148
  }
3165
- // even though the element may not be apart of the DOM, it may
3166
- // still be added at a later point (due to the mechanics of content
3149
+ // even though the element may not be in the DOM, it may still
3150
+ // be added at a later point (due to the mechanics of content
3167
3151
  // projection and/or dynamic component insertion) therefore it's
3168
- // important we still style the element.
3152
+ // important to still style the element.
3169
3153
  if (nodeIsOrphaned) {
3170
3154
  player.onStart(() => eraseStyles(element, instruction.fromStyles));
3171
3155
  player.onDestroy(() => setStyles(element, instruction.toStyles));
3172
3156
  skippedPlayers.push(player);
3173
3157
  return;
3174
3158
  }
3175
- // if a unmatched transition is queued to go then it SHOULD NOT render
3176
- // an animation and cancel the previously running animations.
3159
+ // if an unmatched transition is queued and ready to go
3160
+ // then it SHOULD NOT render an animation and cancel the
3161
+ // previously running animations.
3177
3162
  if (entry.isFallbackTransition) {
3178
3163
  player.onStart(() => eraseStyles(element, instruction.fromStyles));
3179
3164
  player.onDestroy(() => setStyles(element, instruction.toStyles));
3180
3165
  skippedPlayers.push(player);
3181
3166
  return;
3182
3167
  }
3183
- // this means that if a parent animation uses this animation as a sub trigger
3184
- // then it will instruct the timeline builder to not add a player delay, but
3185
- // instead stretch the first keyframe gap up until the animation starts. The
3186
- // reason this is important is to prevent extra initialization styles from being
3187
- // required by the user in the animation.
3168
+ // this means that if a parent animation uses this animation as a sub-trigger
3169
+ // then it will instruct the timeline builder not to add a player delay, but
3170
+ // instead stretch the first keyframe gap until the animation starts. This is
3171
+ // important in order to prevent extra initialization styles from being
3172
+ // required by the user for the animation.
3188
3173
  instruction.timelines.forEach(tl => tl.stretchStartingKeyframe = true);
3189
3174
  subTimelines.append(element, instruction.timelines);
3190
3175
  const tuple = { instruction, player, element };
@@ -3220,10 +3205,10 @@ class TransitionAnimationEngine {
3220
3205
  this.reportError(errors);
3221
3206
  }
3222
3207
  const allPreviousPlayersMap = new Map();
3223
- // this map works to tell which element in the DOM tree is contained by
3224
- // which animation. Further down below this map will get populated once
3225
- // the players are built and in doing so it can efficiently figure out
3226
- // if a sub player is skipped due to a parent player having priority.
3208
+ // this map tells us which element in the DOM tree is contained by
3209
+ // which animation. Further down this map will get populated once
3210
+ // the players are built and in doing so we can use it to efficiently
3211
+ // figure out if a sub player is skipped due to a parent player having priority.
3227
3212
  const animationElementMap = new Map();
3228
3213
  queuedInstructions.forEach(entry => {
3229
3214
  const element = entry.element;
@@ -3240,13 +3225,13 @@ class TransitionAnimationEngine {
3240
3225
  prevPlayer.destroy();
3241
3226
  });
3242
3227
  });
3243
- // this is a special case for nodes that will be removed (either by)
3228
+ // this is a special case for nodes that will be removed either by
3244
3229
  // having their own leave animations or by being queried in a container
3245
3230
  // that will be removed once a parent animation is complete. The idea
3246
3231
  // here is that * styles must be identical to ! styles because of
3247
3232
  // backwards compatibility (* is also filled in by default in many places).
3248
- // Otherwise * styles will return an empty value or auto since the element
3249
- // that is being getComputedStyle'd will not be visible (since * = destination)
3233
+ // Otherwise * styles will return an empty value or "auto" since the element
3234
+ // passed to getComputedStyle will not be visible (since * === destination)
3250
3235
  const replaceNodes = allLeaveNodes.filter(node => {
3251
3236
  return replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements);
3252
3237
  });
@@ -3328,9 +3313,9 @@ class TransitionAnimationEngine {
3328
3313
  }
3329
3314
  }
3330
3315
  });
3331
- // find all of the sub players' corresponding inner animation player
3316
+ // find all of the sub players' corresponding inner animation players
3332
3317
  subPlayers.forEach(player => {
3333
- // even if any players are not found for a sub animation then it
3318
+ // even if no players are found for a sub animation it
3334
3319
  // will still complete itself after the next tick since it's Noop
3335
3320
  const playersForElement = skippedPlayersMap.get(player.element);
3336
3321
  if (playersForElement && playersForElement.length) {
@@ -3758,38 +3743,11 @@ function buildRootMap(roots, nodes) {
3758
3743
  });
3759
3744
  return rootMap;
3760
3745
  }
3761
- const CLASSES_CACHE_KEY = '$$classes';
3762
- function containsClass(element, className) {
3763
- if (element.classList) {
3764
- return element.classList.contains(className);
3765
- }
3766
- else {
3767
- const classes = element[CLASSES_CACHE_KEY];
3768
- return classes && classes[className];
3769
- }
3770
- }
3771
3746
  function addClass(element, className) {
3772
- if (element.classList) {
3773
- element.classList.add(className);
3774
- }
3775
- else {
3776
- let classes = element[CLASSES_CACHE_KEY];
3777
- if (!classes) {
3778
- classes = element[CLASSES_CACHE_KEY] = {};
3779
- }
3780
- classes[className] = true;
3781
- }
3747
+ element.classList?.add(className);
3782
3748
  }
3783
3749
  function removeClass(element, className) {
3784
- if (element.classList) {
3785
- element.classList.remove(className);
3786
- }
3787
- else {
3788
- let classes = element[CLASSES_CACHE_KEY];
3789
- if (classes) {
3790
- delete classes[className];
3791
- }
3792
- }
3750
+ element.classList?.remove(className);
3793
3751
  }
3794
3752
  function removeNodesAfterAnimationDone(engine, element, players) {
3795
3753
  optimizeGroupPlayer(players).onDone(() => engine.processLeaveNode(element));
@@ -4340,8 +4298,9 @@ class CssKeyframesDriver {
4340
4298
  validateStyleProperty(prop) {
4341
4299
  return validateStyleProperty(prop);
4342
4300
  }
4343
- matchesElement(element, selector) {
4344
- return matchesElement(element, selector);
4301
+ matchesElement(_element, _selector) {
4302
+ // This method is deprecated and no longer in use so we return false.
4303
+ return false;
4345
4304
  }
4346
4305
  containsElement(elm1, elm2) {
4347
4306
  return containsElement(elm1, elm2);
@@ -4605,8 +4564,9 @@ class WebAnimationsDriver {
4605
4564
  validateStyleProperty(prop) {
4606
4565
  return validateStyleProperty(prop);
4607
4566
  }
4608
- matchesElement(element, selector) {
4609
- return matchesElement(element, selector);
4567
+ matchesElement(_element, _selector) {
4568
+ // This method is deprecated and no longer in use so we return false.
4569
+ return false;
4610
4570
  }
4611
4571
  containsElement(elm1, elm2) {
4612
4572
  return containsElement(elm1, elm2);
@@ -4689,5 +4649,5 @@ function getElementAnimateFn() {
4689
4649
  * Generated bundle index. Do not edit.
4690
4650
  */
4691
4651
 
4692
- export { AnimationDriver, Animation as ɵAnimation, AnimationEngine as ɵAnimationEngine, AnimationStyleNormalizer as ɵAnimationStyleNormalizer, CssKeyframesDriver as ɵCssKeyframesDriver, CssKeyframesPlayer as ɵCssKeyframesPlayer, NoopAnimationDriver as ɵNoopAnimationDriver, NoopAnimationStyleNormalizer as ɵNoopAnimationStyleNormalizer, WebAnimationsDriver as ɵWebAnimationsDriver, WebAnimationsPlayer as ɵWebAnimationsPlayer, WebAnimationsStyleNormalizer as ɵWebAnimationsStyleNormalizer, allowPreviousPlayerStylesMerge as ɵallowPreviousPlayerStylesMerge, containsElement as ɵcontainsElement, invokeQuery as ɵinvokeQuery, matchesElement as ɵmatchesElement, supportsWebAnimations as ɵsupportsWebAnimations, validateStyleProperty as ɵvalidateStyleProperty };
4652
+ export { AnimationDriver, Animation as ɵAnimation, AnimationEngine as ɵAnimationEngine, AnimationStyleNormalizer as ɵAnimationStyleNormalizer, CssKeyframesDriver as ɵCssKeyframesDriver, CssKeyframesPlayer as ɵCssKeyframesPlayer, NoopAnimationDriver as ɵNoopAnimationDriver, NoopAnimationStyleNormalizer as ɵNoopAnimationStyleNormalizer, WebAnimationsDriver as ɵWebAnimationsDriver, WebAnimationsPlayer as ɵWebAnimationsPlayer, WebAnimationsStyleNormalizer as ɵWebAnimationsStyleNormalizer, allowPreviousPlayerStylesMerge as ɵallowPreviousPlayerStylesMerge, containsElement as ɵcontainsElement, invokeQuery as ɵinvokeQuery, supportsWebAnimations as ɵsupportsWebAnimations, validateStyleProperty as ɵvalidateStyleProperty };
4693
4653
  //# sourceMappingURL=browser.mjs.map