@angular/core 11.2.10 → 11.2.14

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 v11.2.10
2
+ * @license Angular v11.2.14
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -7722,11 +7722,25 @@
7722
7722
  var toCall = destroyHooks[i + 1];
7723
7723
  if (Array.isArray(toCall)) {
7724
7724
  for (var j = 0; j < toCall.length; j += 2) {
7725
- toCall[j + 1].call(context[toCall[j]]);
7725
+ var callContext = context[toCall[j]];
7726
+ var hook = toCall[j + 1];
7727
+ profiler(4 /* LifecycleHookStart */, callContext, hook);
7728
+ try {
7729
+ hook.call(callContext);
7730
+ }
7731
+ finally {
7732
+ profiler(5 /* LifecycleHookEnd */, callContext, hook);
7733
+ }
7726
7734
  }
7727
7735
  }
7728
7736
  else {
7729
- toCall.call(context);
7737
+ profiler(4 /* LifecycleHookStart */, context, toCall);
7738
+ try {
7739
+ toCall.call(context);
7740
+ }
7741
+ finally {
7742
+ profiler(5 /* LifecycleHookEnd */, context, toCall);
7743
+ }
7730
7744
  }
7731
7745
  }
7732
7746
  }
@@ -20702,7 +20716,7 @@
20702
20716
  var hasBinding = text.match(BINDING_REGEXP);
20703
20717
  var tNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, hasBinding ? null : text, false);
20704
20718
  if (hasBinding) {
20705
- generateBindingUpdateOpCodes(updateOpCodes, text, tNode.index);
20719
+ generateBindingUpdateOpCodes(updateOpCodes, text, tNode.index, null, 0, null);
20706
20720
  }
20707
20721
  }
20708
20722
  /**
@@ -20730,7 +20744,9 @@
20730
20744
  }
20731
20745
  // i18n attributes that hit this code path are guaranteed to have bindings, because
20732
20746
  // the compiler treats static i18n attributes as regular attribute bindings.
20733
- generateBindingUpdateOpCodes(updateOpCodes, message, previousElementIndex, attrName);
20747
+ // Since this may not be the first i18n attribute on this element we need to pass in how
20748
+ // many previous bindings there have already been.
20749
+ generateBindingUpdateOpCodes(updateOpCodes, message, previousElementIndex, attrName, countBindings(updateOpCodes), null);
20734
20750
  }
20735
20751
  }
20736
20752
  tView.data[index] = updateOpCodes;
@@ -20744,9 +20760,10 @@
20744
20760
  * @param destinationNode Index of the destination node which will receive the binding.
20745
20761
  * @param attrName Name of the attribute, if the string belongs to an attribute.
20746
20762
  * @param sanitizeFn Sanitization function used to sanitize the string after update, if necessary.
20763
+ * @param bindingStart The lView index of the next expression that can be bound via an opCode.
20764
+ * @returns The mask value for these bindings
20747
20765
  */
20748
- function generateBindingUpdateOpCodes(updateOpCodes, str, destinationNode, attrName, sanitizeFn) {
20749
- if (sanitizeFn === void 0) { sanitizeFn = null; }
20766
+ function generateBindingUpdateOpCodes(updateOpCodes, str, destinationNode, attrName, bindingStart, sanitizeFn) {
20750
20767
  ngDevMode &&
20751
20768
  assertGreaterThanOrEqual(destinationNode, HEADER_OFFSET, 'Index must be in absolute LView offset');
20752
20769
  var maskIndex = updateOpCodes.length; // Location of mask
@@ -20762,7 +20779,7 @@
20762
20779
  var textValue = textParts[j];
20763
20780
  if (j & 1) {
20764
20781
  // Odd indexes are bindings
20765
- var bindingIndex = parseInt(textValue, 10);
20782
+ var bindingIndex = bindingStart + parseInt(textValue, 10);
20766
20783
  updateOpCodes.push(-1 - bindingIndex);
20767
20784
  mask = mask | toMaskBit(bindingIndex);
20768
20785
  }
@@ -20780,6 +20797,28 @@
20780
20797
  updateOpCodes[sizeIndex] = updateOpCodes.length - startIndex;
20781
20798
  return mask;
20782
20799
  }
20800
+ /**
20801
+ * Count the number of bindings in the given `opCodes`.
20802
+ *
20803
+ * It could be possible to speed this up, by passing the number of bindings found back from
20804
+ * `generateBindingUpdateOpCodes()` to `i18nAttributesFirstPass()` but this would then require more
20805
+ * complexity in the code and/or transient objects to be created.
20806
+ *
20807
+ * Since this function is only called once when the template is instantiated, is trivial in the
20808
+ * first instance (since `opCodes` will be an empty array), and it is not common for elements to
20809
+ * contain multiple i18n bound attributes, it seems like this is a reasonable compromise.
20810
+ */
20811
+ function countBindings(opCodes) {
20812
+ var count = 0;
20813
+ for (var i = 0; i < opCodes.length; i++) {
20814
+ var opCode = opCodes[i];
20815
+ // Bindings are negative numbers.
20816
+ if (typeof opCode === 'number' && opCode < 0) {
20817
+ count++;
20818
+ }
20819
+ }
20820
+ return count;
20821
+ }
20783
20822
  /**
20784
20823
  * Convert binding index to mask bit.
20785
20824
  *
@@ -21031,13 +21070,13 @@
21031
21070
  if (hasBinding_1) {
21032
21071
  if (VALID_ATTRS.hasOwnProperty(lowerAttrName)) {
21033
21072
  if (URI_ATTRS[lowerAttrName]) {
21034
- generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, _sanitizeUrl);
21073
+ generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, _sanitizeUrl);
21035
21074
  }
21036
21075
  else if (SRCSET_ATTRS[lowerAttrName]) {
21037
- generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, sanitizeSrcset);
21076
+ generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, sanitizeSrcset);
21038
21077
  }
21039
21078
  else {
21040
- generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name);
21079
+ generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, null);
21041
21080
  }
21042
21081
  }
21043
21082
  else {
@@ -21063,7 +21102,8 @@
21063
21102
  addCreateNodeAndAppend(create, null, hasBinding ? '' : value, parentIdx, newIndex);
21064
21103
  addRemoveNode(remove, newIndex, depth);
21065
21104
  if (hasBinding) {
21066
- bindingMask = generateBindingUpdateOpCodes(update, value, newIndex) | bindingMask;
21105
+ bindingMask =
21106
+ generateBindingUpdateOpCodes(update, value, newIndex, null, 0, null) | bindingMask;
21067
21107
  }
21068
21108
  break;
21069
21109
  case Node.COMMENT_NODE:
@@ -21983,7 +22023,7 @@
21983
22023
  /**
21984
22024
  * @publicApi
21985
22025
  */
21986
- var VERSION = new Version('11.2.10');
22026
+ var VERSION = new Version('11.2.14');
21987
22027
 
21988
22028
  /**
21989
22029
  * @license
@@ -23195,9 +23235,6 @@
23195
23235
  /**
23196
23236
  * Marks a view and all of its ancestors dirty.
23197
23237
  *
23198
- * It also triggers change detection by calling `scheduleTick` internally, which coalesces
23199
- * multiple `markForCheck` calls to into one change detection run.
23200
- *
23201
23238
  * This can be used to ensure an {@link ChangeDetectionStrategy#OnPush OnPush} component is
23202
23239
  * checked when it needs to be re-rendered but the two normal triggers haven't marked it
23203
23240
  * dirty (i.e. inputs haven't changed and events haven't fired in the view).
@@ -27829,11 +27866,11 @@
27829
27866
  * NgModule the component belongs to. We keep the list of compiled components here so that the
27830
27867
  * TestBed can reset it later.
27831
27868
  */
27832
- var ownerNgModule = new Map();
27833
- var verifiedNgModule = new Map();
27869
+ var ownerNgModule = new WeakMap();
27870
+ var verifiedNgModule = new WeakMap();
27834
27871
  function resetCompiledComponents() {
27835
- ownerNgModule = new Map();
27836
- verifiedNgModule = new Map();
27872
+ ownerNgModule = new WeakMap();
27873
+ verifiedNgModule = new WeakMap();
27837
27874
  moduleQueue.length = 0;
27838
27875
  }
27839
27876
  /**
@@ -33959,6 +33996,7 @@
33959
33996
  exports.ɵRender3ComponentFactory = ComponentFactory$1;
33960
33997
  exports.ɵRender3ComponentRef = ComponentRef$1;
33961
33998
  exports.ɵRender3NgModuleRef = NgModuleRef$1;
33999
+ exports.ɵRuntimeError = RuntimeError;
33962
34000
  exports.ɵSWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__ = SWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__;
33963
34001
  exports.ɵSWITCH_COMPILE_COMPONENT__POST_R3__ = SWITCH_COMPILE_COMPONENT__POST_R3__;
33964
34002
  exports.ɵSWITCH_COMPILE_DIRECTIVE__POST_R3__ = SWITCH_COMPILE_DIRECTIVE__POST_R3__;