@angular/core 13.2.1 → 13.2.2

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.2.1
2
+ * @license Angular v13.2.2
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/fesm2020/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.2.1
2
+ * @license Angular v13.2.2
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -21090,7 +21090,7 @@ class Version {
21090
21090
  /**
21091
21091
  * @publicApi
21092
21092
  */
21093
- const VERSION = new Version('13.2.1');
21093
+ const VERSION = new Version('13.2.2');
21094
21094
 
21095
21095
  /**
21096
21096
  * @license
@@ -26014,26 +26014,7 @@ class PlatformRef {
26014
26014
  this._destroyed = false;
26015
26015
  }
26016
26016
  /**
26017
- * Creates an instance of an `@NgModule` for the given platform for offline compilation.
26018
- *
26019
- * @usageNotes
26020
- *
26021
- * The following example creates the NgModule for a browser platform.
26022
- *
26023
- * ```typescript
26024
- * my_module.ts:
26025
- *
26026
- * @NgModule({
26027
- * imports: [BrowserModule]
26028
- * })
26029
- * class MyModule {}
26030
- *
26031
- * main.ts:
26032
- * import {MyModuleNgFactory} from './my_module.ngfactory';
26033
- * import {platformBrowser} from '@angular/platform-browser';
26034
- *
26035
- * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
26036
- * ```
26017
+ * Creates an instance of an `@NgModule` for the given platform.
26037
26018
  *
26038
26019
  * @deprecated Passing NgModule factories as the `PlatformRef.bootstrapModuleFactory` function
26039
26020
  * argument is deprecated. Use the `PlatformRef.bootstrapModule` API instead.
@@ -26087,7 +26068,7 @@ class PlatformRef {
26087
26068
  });
26088
26069
  }
26089
26070
  /**
26090
- * Creates an instance of an `@NgModule` for a given platform using the given runtime compiler.
26071
+ * Creates an instance of an `@NgModule` for a given platform.
26091
26072
  *
26092
26073
  * @usageNotes
26093
26074
  * ### Simple Example
@@ -26830,8 +26811,6 @@ var ng_module_factory_loader_impl = {};
26830
26811
  * Use of this source code is governed by an MIT-style license that can be
26831
26812
  * found in the LICENSE file at https://angular.io/license
26832
26813
  */
26833
- // TODO(alxhub): recombine the interfaces and implementations here and move the docs back onto the
26834
- // original classes.
26835
26814
  /**
26836
26815
  * @publicApi
26837
26816
  */
@@ -26847,43 +26826,88 @@ class DebugEventListener {
26847
26826
  function asNativeElements(debugEls) {
26848
26827
  return debugEls.map((el) => el.nativeElement);
26849
26828
  }
26850
- class DebugNode__POST_R3__ {
26829
+ /**
26830
+ * @publicApi
26831
+ */
26832
+ class DebugNode {
26851
26833
  constructor(nativeNode) {
26852
26834
  this.nativeNode = nativeNode;
26853
26835
  }
26836
+ /**
26837
+ * The `DebugElement` parent. Will be `null` if this is the root element.
26838
+ */
26854
26839
  get parent() {
26855
26840
  const parent = this.nativeNode.parentNode;
26856
- return parent ? new DebugElement__POST_R3__(parent) : null;
26841
+ return parent ? new DebugElement(parent) : null;
26857
26842
  }
26843
+ /**
26844
+ * The host dependency injector. For example, the root element's component instance injector.
26845
+ */
26858
26846
  get injector() {
26859
26847
  return getInjector(this.nativeNode);
26860
26848
  }
26849
+ /**
26850
+ * The element's own component instance, if it has one.
26851
+ */
26861
26852
  get componentInstance() {
26862
26853
  const nativeElement = this.nativeNode;
26863
26854
  return nativeElement &&
26864
26855
  (getComponent$1(nativeElement) || getOwningComponent(nativeElement));
26865
26856
  }
26857
+ /**
26858
+ * An object that provides parent context for this element. Often an ancestor component instance
26859
+ * that governs this element.
26860
+ *
26861
+ * When an element is repeated within *ngFor, the context is an `NgForOf` whose `$implicit`
26862
+ * property is the value of the row instance value. For example, the `hero` in `*ngFor="let hero
26863
+ * of heroes"`.
26864
+ */
26866
26865
  get context() {
26867
26866
  return getComponent$1(this.nativeNode) || getContext(this.nativeNode);
26868
26867
  }
26868
+ /**
26869
+ * The callbacks attached to the component's @Output properties and/or the element's event
26870
+ * properties.
26871
+ */
26869
26872
  get listeners() {
26870
26873
  return getListeners(this.nativeNode).filter(listener => listener.type === 'dom');
26871
26874
  }
26875
+ /**
26876
+ * Dictionary of objects associated with template local variables (e.g. #foo), keyed by the local
26877
+ * variable name.
26878
+ */
26872
26879
  get references() {
26873
26880
  return getLocalRefs(this.nativeNode);
26874
26881
  }
26882
+ /**
26883
+ * This component's injector lookup tokens. Includes the component itself plus the tokens that the
26884
+ * component lists in its providers metadata.
26885
+ */
26875
26886
  get providerTokens() {
26876
26887
  return getInjectionTokens(this.nativeNode);
26877
26888
  }
26878
26889
  }
26879
- class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
26890
+ /**
26891
+ * @publicApi
26892
+ *
26893
+ * @see [Component testing scenarios](guide/testing-components-scenarios)
26894
+ * @see [Basics of testing components](guide/testing-components-basics)
26895
+ * @see [Testing utility APIs](guide/testing-utility-apis)
26896
+ */
26897
+ class DebugElement extends DebugNode {
26880
26898
  constructor(nativeNode) {
26881
26899
  ngDevMode && assertDomNode(nativeNode);
26882
26900
  super(nativeNode);
26883
26901
  }
26902
+ /**
26903
+ * The underlying DOM element at the root of the component.
26904
+ */
26884
26905
  get nativeElement() {
26885
26906
  return this.nativeNode.nodeType == Node.ELEMENT_NODE ? this.nativeNode : null;
26886
26907
  }
26908
+ /**
26909
+ * The element tag name, if it is an element.
26910
+ */
26887
26911
  get name() {
26888
26912
  const context = getLContext(this.nativeNode);
26889
26913
  if (context !== null) {
@@ -26924,6 +26948,9 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
26924
26948
  collectPropertyBindings(properties, tNode, lView, tData);
26925
26949
  return properties;
26926
26950
  }
26951
+ /**
26952
+ * A map of attribute names to attribute values for an element.
26953
+ */
26927
26954
  get attributes() {
26928
26955
  const attributes = {};
26929
26956
  const element = this.nativeElement;
@@ -26972,12 +26999,29 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
26972
26999
  }
26973
27000
  return attributes;
26974
27001
  }
27002
+ /**
27003
+ * The inline styles of the DOM element.
27004
+ *
27005
+ * Will be `null` if there is no `style` property on the underlying DOM element.
27006
+ *
27007
+ * @see [ElementCSSInlineStyle](https://developer.mozilla.org/en-US/docs/Web/API/ElementCSSInlineStyle/style)
27008
+ */
26975
27009
  get styles() {
26976
27010
  if (this.nativeElement && this.nativeElement.style) {
26977
27011
  return this.nativeElement.style;
26978
27012
  }
26979
27013
  return {};
26980
27014
  }
27015
+ /**
27016
+ * A map containing the class names on the element as keys.
27017
+ *
27018
+ * This map is derived from the `className` property of the DOM element.
27019
+ *
27020
+ * Note: The values of this object will always be `true`. The class key will not appear in the KV
27021
+ * object if it does not exist on the element.
27022
+ *
27023
+ * @see [Element.className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className)
27024
+ */
26981
27025
  get classes() {
26982
27026
  const result = {};
26983
27027
  const element = this.nativeElement;
@@ -26987,15 +27031,23 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
26987
27031
  classes.forEach((value) => result[value] = true);
26988
27032
  return result;
26989
27033
  }
27034
+ /**
27035
+ * The `childNodes` of the DOM element as a `DebugNode` array.
27036
+ *
27037
+ * @see [Node.childNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes)
27038
+ */
26990
27039
  get childNodes() {
26991
27040
  const childNodes = this.nativeNode.childNodes;
26992
27041
  const children = [];
26993
27042
  for (let i = 0; i < childNodes.length; i++) {
26994
27043
  const element = childNodes[i];
26995
- children.push(getDebugNode__POST_R3__(element));
27044
+ children.push(getDebugNode(element));
26996
27045
  }
26997
27046
  return children;
26998
27047
  }
27048
+ /**
27049
+ * The immediate `DebugElement` children. Walk the tree by descending through `children`.
27050
+ */
26999
27051
  get children() {
27000
27052
  const nativeElement = this.nativeElement;
27001
27053
  if (!nativeElement)
@@ -27004,24 +27056,45 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
27004
27056
  const children = [];
27005
27057
  for (let i = 0; i < childNodes.length; i++) {
27006
27058
  const element = childNodes[i];
27007
- children.push(getDebugNode__POST_R3__(element));
27059
+ children.push(getDebugNode(element));
27008
27060
  }
27009
27061
  return children;
27010
27062
  }
27063
+ /**
27064
+ * @returns the first `DebugElement` that matches the predicate at any depth in the subtree.
27065
+ */
27011
27066
  query(predicate) {
27012
27067
  const results = this.queryAll(predicate);
27013
27068
  return results[0] || null;
27014
27069
  }
27070
+ /**
27071
+ * @returns All `DebugElement` matches for the predicate at any depth in the subtree.
27072
+ */
27015
27073
  queryAll(predicate) {
27016
27074
  const matches = [];
27017
- _queryAllR3(this, predicate, matches, true);
27075
+ _queryAll(this, predicate, matches, true);
27018
27076
  return matches;
27019
27077
  }
27078
+ /**
27079
+ * @returns All `DebugNode` matches for the predicate at any depth in the subtree.
27080
+ */
27020
27081
  queryAllNodes(predicate) {
27021
27082
  const matches = [];
27022
- _queryAllR3(this, predicate, matches, false);
27083
+ _queryAll(this, predicate, matches, false);
27023
27084
  return matches;
27024
27085
  }
27086
+ /**
27087
+ * Triggers the event by its name if there is a corresponding listener in the element's
27088
+ * `listeners` collection.
27089
+ *
27090
+ * If the event lacks a listener or there's some other problem, consider
27091
+ * calling `nativeElement.dispatchEvent(eventObject)`.
27092
+ *
27093
+ * @param eventName The name of the event to trigger
27094
+ * @param eventObj The _event object_ expected by the handler
27095
+ *
27096
+ * @see [Testing components scenarios](guide/testing-components-scenarios#trigger-event-handler)
27097
+ */
27025
27098
  triggerEventHandler(eventName, eventObj) {
27026
27099
  const node = this.nativeNode;
27027
27100
  const invokedListeners = [];
@@ -27080,11 +27153,11 @@ function isPrimitiveValue(value) {
27080
27153
  return typeof value === 'string' || typeof value === 'boolean' || typeof value === 'number' ||
27081
27154
  value === null;
27082
27155
  }
27083
- function _queryAllR3(parentElement, predicate, matches, elementsOnly) {
27156
+ function _queryAll(parentElement, predicate, matches, elementsOnly) {
27084
27157
  const context = getLContext(parentElement.nativeNode);
27085
27158
  if (context !== null) {
27086
27159
  const parentTNode = context.lView[TVIEW].data[context.nodeIndex];
27087
- _queryNodeChildrenR3(parentTNode, context.lView, predicate, matches, elementsOnly, parentElement.nativeNode);
27160
+ _queryNodeChildren(parentTNode, context.lView, predicate, matches, elementsOnly, parentElement.nativeNode);
27088
27161
  }
27089
27162
  else {
27090
27163
  // If the context is null, then `parentElement` was either created with Renderer2 or native DOM
@@ -27102,26 +27175,26 @@ function _queryAllR3(parentElement, predicate, matches, elementsOnly) {
27102
27175
  * @param elementsOnly whether only elements should be searched
27103
27176
  * @param rootNativeNode the root native node on which predicate should not be matched
27104
27177
  */
27105
- function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, rootNativeNode) {
27178
+ function _queryNodeChildren(tNode, lView, predicate, matches, elementsOnly, rootNativeNode) {
27106
27179
  ngDevMode && assertTNodeForLView(tNode, lView);
27107
27180
  const nativeNode = getNativeByTNodeOrNull(tNode, lView);
27108
27181
  // For each type of TNode, specific logic is executed.
27109
27182
  if (tNode.type & (3 /* AnyRNode */ | 8 /* ElementContainer */)) {
27110
27183
  // Case 1: the TNode is an element
27111
27184
  // The native node has to be checked.
27112
- _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
27185
+ _addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
27113
27186
  if (isComponentHost(tNode)) {
27114
27187
  // If the element is the host of a component, then all nodes in its view have to be processed.
27115
27188
  // Note: the component's content (tNode.child) will be processed from the insertion points.
27116
27189
  const componentView = getComponentLViewByIndex(tNode.index, lView);
27117
27190
  if (componentView && componentView[TVIEW].firstChild) {
27118
- _queryNodeChildrenR3(componentView[TVIEW].firstChild, componentView, predicate, matches, elementsOnly, rootNativeNode);
27191
+ _queryNodeChildren(componentView[TVIEW].firstChild, componentView, predicate, matches, elementsOnly, rootNativeNode);
27119
27192
  }
27120
27193
  }
27121
27194
  else {
27122
27195
  if (tNode.child) {
27123
27196
  // Otherwise, its children have to be processed.
27124
- _queryNodeChildrenR3(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
27197
+ _queryNodeChildren(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
27125
27198
  }
27126
27199
  // We also have to query the DOM directly in order to catch elements inserted through
27127
27200
  // Renderer2. Note that this is __not__ optimal, because we're walking similar trees multiple
@@ -27137,16 +27210,16 @@ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, ro
27137
27210
  // processed.
27138
27211
  const nodeOrContainer = lView[tNode.index];
27139
27212
  if (isLContainer(nodeOrContainer)) {
27140
- _queryNodeChildrenInContainerR3(nodeOrContainer, predicate, matches, elementsOnly, rootNativeNode);
27213
+ _queryNodeChildrenInContainer(nodeOrContainer, predicate, matches, elementsOnly, rootNativeNode);
27141
27214
  }
27142
27215
  }
27143
27216
  else if (tNode.type & 4 /* Container */) {
27144
27217
  // Case 2: the TNode is a container
27145
27218
  // The native node has to be checked.
27146
27219
  const lContainer = lView[tNode.index];
27147
- _addQueryMatchR3(lContainer[NATIVE], predicate, matches, elementsOnly, rootNativeNode);
27220
+ _addQueryMatch(lContainer[NATIVE], predicate, matches, elementsOnly, rootNativeNode);
27148
27221
  // Each view inside the container has to be processed.
27149
- _queryNodeChildrenInContainerR3(lContainer, predicate, matches, elementsOnly, rootNativeNode);
27222
+ _queryNodeChildrenInContainer(lContainer, predicate, matches, elementsOnly, rootNativeNode);
27150
27223
  }
27151
27224
  else if (tNode.type & 16 /* Projection */) {
27152
27225
  // Case 3: the TNode is a projection insertion point (i.e. a <ng-content>).
@@ -27156,18 +27229,18 @@ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, ro
27156
27229
  const head = componentHost.projection[tNode.projection];
27157
27230
  if (Array.isArray(head)) {
27158
27231
  for (let nativeNode of head) {
27159
- _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
27232
+ _addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
27160
27233
  }
27161
27234
  }
27162
27235
  else if (head) {
27163
27236
  const nextLView = componentView[PARENT];
27164
27237
  const nextTNode = nextLView[TVIEW].data[head.index];
27165
- _queryNodeChildrenR3(nextTNode, nextLView, predicate, matches, elementsOnly, rootNativeNode);
27238
+ _queryNodeChildren(nextTNode, nextLView, predicate, matches, elementsOnly, rootNativeNode);
27166
27239
  }
27167
27240
  }
27168
27241
  else if (tNode.child) {
27169
27242
  // Case 4: the TNode is a view.
27170
- _queryNodeChildrenR3(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
27243
+ _queryNodeChildren(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
27171
27244
  }
27172
27245
  // We don't want to go to the next sibling of the root node.
27173
27246
  if (rootNativeNode !== nativeNode) {
@@ -27175,7 +27248,7 @@ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, ro
27175
27248
  // link, depending on whether the current node has been projected.
27176
27249
  const nextTNode = (tNode.flags & 4 /* isProjected */) ? tNode.projectionNext : tNode.next;
27177
27250
  if (nextTNode) {
27178
- _queryNodeChildrenR3(nextTNode, lView, predicate, matches, elementsOnly, rootNativeNode);
27251
+ _queryNodeChildren(nextTNode, lView, predicate, matches, elementsOnly, rootNativeNode);
27179
27252
  }
27180
27253
  }
27181
27254
  }
@@ -27188,12 +27261,12 @@ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, ro
27188
27261
  * @param elementsOnly whether only elements should be searched
27189
27262
  * @param rootNativeNode the root native node on which predicate should not be matched
27190
27263
  */
27191
- function _queryNodeChildrenInContainerR3(lContainer, predicate, matches, elementsOnly, rootNativeNode) {
27264
+ function _queryNodeChildrenInContainer(lContainer, predicate, matches, elementsOnly, rootNativeNode) {
27192
27265
  for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
27193
27266
  const childView = lContainer[i];
27194
27267
  const firstChild = childView[TVIEW].firstChild;
27195
27268
  if (firstChild) {
27196
- _queryNodeChildrenR3(firstChild, childView, predicate, matches, elementsOnly, rootNativeNode);
27269
+ _queryNodeChildren(firstChild, childView, predicate, matches, elementsOnly, rootNativeNode);
27197
27270
  }
27198
27271
  }
27199
27272
  }
@@ -27206,7 +27279,7 @@ function _queryNodeChildrenInContainerR3(lContainer, predicate, matches, element
27206
27279
  * @param elementsOnly whether only elements should be searched
27207
27280
  * @param rootNativeNode the root native node on which predicate should not be matched
27208
27281
  */
27209
- function _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNativeNode) {
27282
+ function _addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode) {
27210
27283
  if (rootNativeNode !== nativeNode) {
27211
27284
  const debugNode = getDebugNode(nativeNode);
27212
27285
  if (!debugNode) {
@@ -27215,7 +27288,7 @@ function _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNati
27215
27288
  // Type of the "predicate and "matches" array are set based on the value of
27216
27289
  // the "elementsOnly" parameter. TypeScript is not able to properly infer these
27217
27290
  // types with generics, so we manually cast the parameters accordingly.
27218
- if (elementsOnly && debugNode instanceof DebugElement__POST_R3__ && predicate(debugNode) &&
27291
+ if (elementsOnly && (debugNode instanceof DebugElement) && predicate(debugNode) &&
27219
27292
  matches.indexOf(debugNode) === -1) {
27220
27293
  matches.push(debugNode);
27221
27294
  }
@@ -27240,7 +27313,7 @@ function _queryNativeNodeDescendants(parentNode, predicate, matches, elementsOnl
27240
27313
  const node = nodes[i];
27241
27314
  const debugNode = getDebugNode(node);
27242
27315
  if (debugNode) {
27243
- if (elementsOnly && debugNode instanceof DebugElement__POST_R3__ && predicate(debugNode) &&
27316
+ if (elementsOnly && (debugNode instanceof DebugElement) && predicate(debugNode) &&
27244
27317
  matches.indexOf(debugNode) === -1) {
27245
27318
  matches.push(debugNode);
27246
27319
  }
@@ -27281,25 +27354,24 @@ function collectPropertyBindings(properties, tNode, lView, tData) {
27281
27354
  // Need to keep the nodes in a global Map so that multiple angular apps are supported.
27282
27355
  const _nativeNodeToDebugNode = new Map();
27283
27356
  const NG_DEBUG_PROPERTY = '__ng_debug__';
27284
- function getDebugNode__POST_R3__(nativeNode) {
27357
+ /**
27358
+ * @publicApi
27359
+ */
27360
+ function getDebugNode(nativeNode) {
27285
27361
  if (nativeNode instanceof Node) {
27286
27362
  if (!(nativeNode.hasOwnProperty(NG_DEBUG_PROPERTY))) {
27287
27363
  nativeNode[NG_DEBUG_PROPERTY] = nativeNode.nodeType == Node.ELEMENT_NODE ?
27288
- new DebugElement__POST_R3__(nativeNode) :
27289
- new DebugNode__POST_R3__(nativeNode);
27364
+ new DebugElement(nativeNode) :
27365
+ new DebugNode(nativeNode);
27290
27366
  }
27291
27367
  return nativeNode[NG_DEBUG_PROPERTY];
27292
27368
  }
27293
27369
  return null;
27294
27370
  }
27295
- /**
27296
- * @publicApi
27297
- */
27298
- const getDebugNode = getDebugNode__POST_R3__;
27299
- function getDebugNodeR2__POST_R3__(_nativeNode) {
27371
+ // TODO: cleanup all references to this function and remove it.
27372
+ function getDebugNodeR2(_nativeNode) {
27300
27373
  return null;
27301
27374
  }
27302
- const getDebugNodeR2 = getDebugNodeR2__POST_R3__;
27303
27375
  function getAllDebugNodes() {
27304
27376
  return Array.from(_nativeNodeToDebugNode.values());
27305
27377
  }
@@ -27309,14 +27381,6 @@ function indexDebugNode(node) {
27309
27381
  function removeDebugNodeFromIndex(node) {
27310
27382
  _nativeNodeToDebugNode.delete(node.nativeNode);
27311
27383
  }
27312
- /**
27313
- * @publicApi
27314
- */
27315
- const DebugNode = DebugNode__POST_R3__;
27316
- /**
27317
- * @publicApi
27318
- */
27319
- const DebugElement = DebugElement__POST_R3__;
27320
27384
 
27321
27385
  /**
27322
27386
  * @license