@angular/core 16.1.8 → 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.8
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.8
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) {
@@ -10493,7 +10493,7 @@ class Version {
10493
10493
  /**
10494
10494
  * @publicApi
10495
10495
  */
10496
- const VERSION = new Version('16.1.8');
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
  //
@@ -13266,7 +13266,7 @@ class ViewRef {
13266
13266
  }
13267
13267
  detachFromAppRef() {
13268
13268
  this._appRef = null;
13269
- renderDetachView(this._lView[TVIEW], this._lView);
13269
+ detachViewFromDOM(this._lView[TVIEW], this._lView);
13270
13270
  }
13271
13271
  attachToAppRef(appRef) {
13272
13272
  if (this._attachedToViewContainer) {
@@ -23309,6 +23309,57 @@ class QueryList {
23309
23309
  }
23310
23310
  }
23311
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
+
23312
23363
  /**
23313
23364
  * Represents an embedded template that can be used to instantiate embedded views.
23314
23365
  * To instantiate embedded views based on a template, use the `ViewContainerRef`
@@ -23354,25 +23405,13 @@ const R3TemplateRef = class TemplateRef extends ViewEngineTemplateRef {
23354
23405
  return this._declarationTContainer.tView?.ssrId || null;
23355
23406
  }
23356
23407
  createEmbeddedView(context, injector) {
23357
- return this.createEmbeddedViewImpl(context, injector, null);
23408
+ return this.createEmbeddedViewImpl(context, injector);
23358
23409
  }
23359
23410
  /**
23360
23411
  * @internal
23361
23412
  */
23362
23413
  createEmbeddedViewImpl(context, injector, hydrationInfo) {
23363
- // Embedded views follow the change detection strategy of the view they're declared in.
23364
- const isSignalView = this._declarationLView[FLAGS] & 4096 /* LViewFlags.SignalView */;
23365
- const viewFlags = isSignalView ? 4096 /* LViewFlags.SignalView */ : 16 /* LViewFlags.CheckAlways */;
23366
- const embeddedTView = this._declarationTContainer.tView;
23367
- const embeddedLView = createLView(this._declarationLView, embeddedTView, context, viewFlags, null, embeddedTView.declTNode, null, null, null, injector || null, hydrationInfo || null);
23368
- const declarationLContainer = this._declarationLView[this._declarationTContainer.index];
23369
- ngDevMode && assertLContainer(declarationLContainer);
23370
- embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer;
23371
- const declarationViewLQueries = this._declarationLView[QUERIES];
23372
- if (declarationViewLQueries !== null) {
23373
- embeddedLView[QUERIES] = declarationViewLQueries.createEmbeddedView(embeddedTView);
23374
- }
23375
- renderView(embeddedTView, embeddedLView, context);
23414
+ const embeddedLView = createAndRenderEmbeddedLView(this._declarationLView, this._declarationTContainer, context, { injector, hydrationInfo });
23376
23415
  return new ViewRef(embeddedLView);
23377
23416
  }
23378
23417
  };
@@ -23755,16 +23794,7 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
23755
23794
  // Logical operation of adding `LView` to `LContainer`
23756
23795
  const adjustedIdx = this._adjustIndex(index);
23757
23796
  const lContainer = this._lContainer;
23758
- insertView(tView, lView, lContainer, adjustedIdx);
23759
- // Physical operation of adding the DOM nodes.
23760
- if (!skipDomInsertion) {
23761
- const beforeNode = getBeforeNodeForView(adjustedIdx, lContainer);
23762
- const renderer = lView[RENDERER];
23763
- const parentRNode = nativeParentNode(renderer, lContainer[NATIVE]);
23764
- if (parentRNode !== null) {
23765
- addViewToContainer(tView, lContainer[T_HOST], renderer, lView, parentRNode, beforeNode);
23766
- }
23767
- }
23797
+ addLViewToLContainer(lContainer, lView, adjustedIdx, !skipDomInsertion);
23768
23798
  viewRef.attachToViewContainerRef();
23769
23799
  addToArray(getOrCreateViewRefs(lContainer), adjustedIdx, viewRef);
23770
23800
  return viewRef;