@angular/core 16.1.7 → 16.1.9

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 v16.1.7
2
+ * @license Angular v16.1.9
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.1.7
2
+ * @license Angular v16.1.9
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -7213,7 +7213,7 @@ function createElementNode(renderer, name, namespace) {
7213
7213
  * @param tView The `TView' of the `LView` from which elements should be added or removed
7214
7214
  * @param lView The view from which elements should be added or removed
7215
7215
  */
7216
- function removeViewFromContainer(tView, lView) {
7216
+ function removeViewFromDOM(tView, lView) {
7217
7217
  const renderer = lView[RENDERER];
7218
7218
  applyView(tView, lView, renderer, 2 /* WalkTNodeTreeAction.Detach */, null, null);
7219
7219
  lView[HOST] = null;
@@ -7233,7 +7233,7 @@ function removeViewFromContainer(tView, lView) {
7233
7233
  * @param parentNativeNode The parent `RElement` where it should be inserted into.
7234
7234
  * @param beforeNode The node before which elements should be added, if insert mode
7235
7235
  */
7236
- function addViewToContainer(tView, parentTNode, renderer, lView, parentNativeNode, beforeNode) {
7236
+ function addViewToDOM(tView, parentTNode, renderer, lView, parentNativeNode, beforeNode) {
7237
7237
  lView[HOST] = parentNativeNode;
7238
7238
  lView[T_HOST] = parentTNode;
7239
7239
  applyView(tView, lView, renderer, 1 /* WalkTNodeTreeAction.Insert */, parentNativeNode, beforeNode);
@@ -7244,7 +7244,7 @@ function addViewToContainer(tView, parentTNode, renderer, lView, parentNativeNod
7244
7244
  * @param tView The `TView' of the `LView` to be detached
7245
7245
  * @param lView the `LView` to be detached.
7246
7246
  */
7247
- function renderDetachView(tView, lView) {
7247
+ function detachViewFromDOM(tView, lView) {
7248
7248
  applyView(tView, lView, lView[RENDERER], 2 /* WalkTNodeTreeAction.Detach */, null, null);
7249
7249
  }
7250
7250
  /**
@@ -7406,7 +7406,7 @@ function detachView(lContainer, removeIndex) {
7406
7406
  lContainer[indexInContainer - 1][NEXT] = viewToDetach[NEXT];
7407
7407
  }
7408
7408
  const removedLView = removeFromArray(lContainer, CONTAINER_HEADER_OFFSET + removeIndex);
7409
- removeViewFromContainer(viewToDetach[TVIEW], viewToDetach);
7409
+ removeViewFromDOM(viewToDetach[TVIEW], viewToDetach);
7410
7410
  // notify query that a view has been removed
7411
7411
  const lQueries = removedLView[QUERIES];
7412
7412
  if (lQueries !== null) {
@@ -9448,12 +9448,12 @@ const CIRCULAR = {};
9448
9448
  /**
9449
9449
  * A lazily initialized NullInjector.
9450
9450
  */
9451
- let NULL_INJECTOR$1 = undefined;
9451
+ let NULL_INJECTOR = undefined;
9452
9452
  function getNullInjector() {
9453
- if (NULL_INJECTOR$1 === undefined) {
9454
- NULL_INJECTOR$1 = new NullInjector();
9453
+ if (NULL_INJECTOR === undefined) {
9454
+ NULL_INJECTOR = new NullInjector();
9455
9455
  }
9456
- return NULL_INJECTOR$1;
9456
+ return NULL_INJECTOR;
9457
9457
  }
9458
9458
  /**
9459
9459
  * An `Injector` that's part of the environment injector hierarchy, which exists outside of the
@@ -10493,7 +10493,7 @@ class Version {
10493
10493
  /**
10494
10494
  * @publicApi
10495
10495
  */
10496
- const VERSION = new Version('16.1.7');
10496
+ const VERSION = new Version('16.1.9');
10497
10497
 
10498
10498
  // This default value is when checking the hierarchy for a token.
10499
10499
  //
@@ -11018,8 +11018,6 @@ const Injectable = makeDecorator('Injectable', undefined, undefined, undefined,
11018
11018
 
11019
11019
  /**
11020
11020
  * Create a new `Injector` which is configured using a `defType` of `InjectorType<any>`s.
11021
- *
11022
- * @publicApi
11023
11021
  */
11024
11022
  function createInjector(defType, parent = null, additionalProviders = null, name) {
11025
11023
  const injector = createInjectorWithoutInjectorInstances(defType, parent, additionalProviders, name);
@@ -13268,7 +13266,7 @@ class ViewRef {
13268
13266
  }
13269
13267
  detachFromAppRef() {
13270
13268
  this._appRef = null;
13271
- renderDetachView(this._lView[TVIEW], this._lView);
13269
+ detachViewFromDOM(this._lView[TVIEW], this._lView);
13272
13270
  }
13273
13271
  attachToAppRef(appRef) {
13274
13272
  if (this._attachedToViewContainer) {
@@ -13528,12 +13526,6 @@ class ComponentRef extends ComponentRef$1 {
13528
13526
  this.hostView.onDestroy(callback);
13529
13527
  }
13530
13528
  }
13531
- // TODO: A hack to not pull in the NullInjector from @angular/core.
13532
- const NULL_INJECTOR = {
13533
- get: (token, notFoundValue) => {
13534
- throwProviderNotFoundError(token, 'NullInjector');
13535
- }
13536
- };
13537
13529
  /** Creates a TNode that can be used to instantiate a root component. */
13538
13530
  function createRootComponentTNode(lView, rNode) {
13539
13531
  const tView = lView[TVIEW];
@@ -23317,6 +23309,57 @@ class QueryList {
23317
23309
  }
23318
23310
  }
23319
23311
 
23312
+ function createAndRenderEmbeddedLView(declarationLView, templateTNode, context, options) {
23313
+ const embeddedTView = templateTNode.tView;
23314
+ ngDevMode && assertDefined(embeddedTView, 'TView must be defined for a template node.');
23315
+ ngDevMode && assertTNodeForLView(templateTNode, declarationLView);
23316
+ // Embedded views follow the change detection strategy of the view they're declared in.
23317
+ const isSignalView = declarationLView[FLAGS] & 4096 /* LViewFlags.SignalView */;
23318
+ const viewFlags = isSignalView ? 4096 /* LViewFlags.SignalView */ : 16 /* LViewFlags.CheckAlways */;
23319
+ const embeddedLView = createLView(declarationLView, embeddedTView, context, viewFlags, null, templateTNode, null, null, null, options?.injector ?? null, options?.hydrationInfo ?? null);
23320
+ const declarationLContainer = declarationLView[templateTNode.index];
23321
+ ngDevMode && assertLContainer(declarationLContainer);
23322
+ embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer;
23323
+ const declarationViewLQueries = declarationLView[QUERIES];
23324
+ if (declarationViewLQueries !== null) {
23325
+ embeddedLView[QUERIES] = declarationViewLQueries.createEmbeddedView(embeddedTView);
23326
+ }
23327
+ // execute creation mode of a view
23328
+ renderView(embeddedTView, embeddedLView, context);
23329
+ return embeddedLView;
23330
+ }
23331
+ function getLViewFromLContainer(lContainer, index) {
23332
+ const adjustedIndex = CONTAINER_HEADER_OFFSET + index;
23333
+ // avoid reading past the array boundaries
23334
+ if (adjustedIndex < lContainer.length) {
23335
+ const lView = lContainer[adjustedIndex];
23336
+ ngDevMode && assertLView(lView);
23337
+ return lView;
23338
+ }
23339
+ return undefined;
23340
+ }
23341
+ function addLViewToLContainer(lContainer, lView, index, addToDOM = true) {
23342
+ const tView = lView[TVIEW];
23343
+ // insert to the view tree so the new view can be change-detected
23344
+ insertView(tView, lView, lContainer, index);
23345
+ // insert to the view to the DOM tree
23346
+ if (addToDOM) {
23347
+ const beforeNode = getBeforeNodeForView(index, lContainer);
23348
+ const renderer = lView[RENDERER];
23349
+ const parentRNode = nativeParentNode(renderer, lContainer[NATIVE]);
23350
+ if (parentRNode !== null) {
23351
+ addViewToDOM(tView, lContainer[T_HOST], renderer, lView, parentRNode, beforeNode);
23352
+ }
23353
+ }
23354
+ }
23355
+ function removeLViewFromLContainer(lContainer, index) {
23356
+ const lView = detachView(lContainer, index);
23357
+ if (lView !== undefined) {
23358
+ destroyLView(lView[TVIEW], lView);
23359
+ }
23360
+ return lView;
23361
+ }
23362
+
23320
23363
  /**
23321
23364
  * Represents an embedded template that can be used to instantiate embedded views.
23322
23365
  * To instantiate embedded views based on a template, use the `ViewContainerRef`
@@ -23362,25 +23405,13 @@ const R3TemplateRef = class TemplateRef extends ViewEngineTemplateRef {
23362
23405
  return this._declarationTContainer.tView?.ssrId || null;
23363
23406
  }
23364
23407
  createEmbeddedView(context, injector) {
23365
- return this.createEmbeddedViewImpl(context, injector, null);
23408
+ return this.createEmbeddedViewImpl(context, injector);
23366
23409
  }
23367
23410
  /**
23368
23411
  * @internal
23369
23412
  */
23370
23413
  createEmbeddedViewImpl(context, injector, hydrationInfo) {
23371
- // Embedded views follow the change detection strategy of the view they're declared in.
23372
- const isSignalView = this._declarationLView[FLAGS] & 4096 /* LViewFlags.SignalView */;
23373
- const viewFlags = isSignalView ? 4096 /* LViewFlags.SignalView */ : 16 /* LViewFlags.CheckAlways */;
23374
- const embeddedTView = this._declarationTContainer.tView;
23375
- const embeddedLView = createLView(this._declarationLView, embeddedTView, context, viewFlags, null, embeddedTView.declTNode, null, null, null, injector || null, hydrationInfo || null);
23376
- const declarationLContainer = this._declarationLView[this._declarationTContainer.index];
23377
- ngDevMode && assertLContainer(declarationLContainer);
23378
- embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer;
23379
- const declarationViewLQueries = this._declarationLView[QUERIES];
23380
- if (declarationViewLQueries !== null) {
23381
- embeddedLView[QUERIES] = declarationViewLQueries.createEmbeddedView(embeddedTView);
23382
- }
23383
- renderView(embeddedTView, embeddedLView, context);
23414
+ const embeddedLView = createAndRenderEmbeddedLView(this._declarationLView, this._declarationTContainer, context, { injector, hydrationInfo });
23384
23415
  return new ViewRef(embeddedLView);
23385
23416
  }
23386
23417
  };
@@ -23763,16 +23794,7 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
23763
23794
  // Logical operation of adding `LView` to `LContainer`
23764
23795
  const adjustedIdx = this._adjustIndex(index);
23765
23796
  const lContainer = this._lContainer;
23766
- insertView(tView, lView, lContainer, adjustedIdx);
23767
- // Physical operation of adding the DOM nodes.
23768
- if (!skipDomInsertion) {
23769
- const beforeNode = getBeforeNodeForView(adjustedIdx, lContainer);
23770
- const renderer = lView[RENDERER];
23771
- const parentRNode = nativeParentNode(renderer, lContainer[NATIVE]);
23772
- if (parentRNode !== null) {
23773
- addViewToContainer(tView, lContainer[T_HOST], renderer, lView, parentRNode, beforeNode);
23774
- }
23775
- }
23797
+ addLViewToLContainer(lContainer, lView, adjustedIdx, !skipDomInsertion);
23776
23798
  viewRef.attachToViewContainerRef();
23777
23799
  addToArray(getOrCreateViewRefs(lContainer), adjustedIdx, viewRef);
23778
23800
  return viewRef;