@angular/core 13.1.3 → 13.2.0-rc.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.3
2
+ * @license Angular v13.2.0-rc.0
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.1.3
2
+ * @license Angular v13.2.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -20869,6 +20869,9 @@ class ComponentRef$1 {
20869
20869
  * @see [Dynamic Components](guide/dynamic-component-loader)
20870
20870
  *
20871
20871
  * @publicApi
20872
+ *
20873
+ * @deprecated Angular no longer requires Component factories. Please use other APIs where
20874
+ * Component class can be used directly.
20872
20875
  */
20873
20876
  class ComponentFactory$1 {
20874
20877
  }
@@ -20905,6 +20908,9 @@ class _NullComponentFactoryResolver {
20905
20908
  * does **not** require resolving component factory: component class can be used directly.
20906
20909
  *
20907
20910
  * @publicApi
20911
+ *
20912
+ * @deprecated Angular no longer requires Component factories. Please use other APIs where
20913
+ * Component class can be used directly.
20908
20914
  */
20909
20915
  class ComponentFactoryResolver$1 {
20910
20916
  }
@@ -21069,7 +21075,7 @@ class Version {
21069
21075
  /**
21070
21076
  * @publicApi
21071
21077
  */
21072
- const VERSION = new Version('13.1.3');
21078
+ const VERSION = new Version('13.2.0-rc.0');
21073
21079
 
21074
21080
  /**
21075
21081
  * @license
@@ -21097,6 +21103,37 @@ const VERSION = new Version('13.1.3');
21097
21103
  // - mod2.injector.get(token, default)
21098
21104
  const NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
21099
21105
 
21106
+ /**
21107
+ * @license
21108
+ * Copyright Google LLC All Rights Reserved.
21109
+ *
21110
+ * Use of this source code is governed by an MIT-style license that can be
21111
+ * found in the LICENSE file at https://angular.io/license
21112
+ */
21113
+ /**
21114
+ * Injector that looks up a value using a specific injector, before falling back to the module
21115
+ * injector. Used primarily when creating components or embedded views dynamically.
21116
+ */
21117
+ class ChainedInjector {
21118
+ constructor(injector, parentInjector) {
21119
+ this.injector = injector;
21120
+ this.parentInjector = parentInjector;
21121
+ }
21122
+ get(token, notFoundValue, flags) {
21123
+ const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
21124
+ if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
21125
+ notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
21126
+ // Return the value from the root element injector when
21127
+ // - it provides it
21128
+ // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21129
+ // - the module injector should not be checked
21130
+ // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21131
+ return value;
21132
+ }
21133
+ return this.parentInjector.get(token, notFoundValue, flags);
21134
+ }
21135
+ }
21136
+
21100
21137
  /**
21101
21138
  * @license
21102
21139
  * Copyright Google LLC All Rights Reserved.
@@ -21482,23 +21519,6 @@ const SCHEDULER = new InjectionToken('SCHEDULER_TOKEN', {
21482
21519
  providedIn: 'root',
21483
21520
  factory: () => defaultScheduler,
21484
21521
  });
21485
- function createChainedInjector(rootViewInjector, moduleInjector) {
21486
- return {
21487
- get: (token, notFoundValue, flags) => {
21488
- const value = rootViewInjector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
21489
- if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
21490
- notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
21491
- // Return the value from the root element injector when
21492
- // - it provides it
21493
- // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21494
- // - the module injector should not be checked
21495
- // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
21496
- return value;
21497
- }
21498
- return moduleInjector.get(token, notFoundValue, flags);
21499
- }
21500
- };
21501
- }
21502
21522
  /**
21503
21523
  * Render3 implementation of {@link viewEngine_ComponentFactory}.
21504
21524
  */
@@ -21525,7 +21545,7 @@ class ComponentFactory extends ComponentFactory$1 {
21525
21545
  }
21526
21546
  create(injector, projectableNodes, rootSelectorOrNode, ngModule) {
21527
21547
  ngModule = ngModule || this.ngModule;
21528
- const rootViewInjector = ngModule ? createChainedInjector(injector, ngModule.injector) : injector;
21548
+ const rootViewInjector = ngModule ? new ChainedInjector(injector, ngModule.injector) : injector;
21529
21549
  const rendererFactory = rootViewInjector.get(RendererFactory2, domRendererFactory3);
21530
21550
  const sanitizer = rootViewInjector.get(Sanitizer, null);
21531
21551
  const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
@@ -22660,9 +22680,9 @@ const R3TemplateRef = class TemplateRef extends ViewEngineTemplateRef {
22660
22680
  this._declarationTContainer = _declarationTContainer;
22661
22681
  this.elementRef = elementRef;
22662
22682
  }
22663
- createEmbeddedView(context) {
22683
+ createEmbeddedView(context, injector) {
22664
22684
  const embeddedTView = this._declarationTContainer.tViews;
22665
- const embeddedLView = createLView(this._declarationLView, embeddedTView, context, 16 /* CheckAlways */, null, embeddedTView.declTNode, null, null, null, null);
22685
+ const embeddedLView = createLView(this._declarationLView, embeddedTView, context, 16 /* CheckAlways */, null, embeddedTView.declTNode, null, null, null, createEmbeddedViewInjector(injector, this._declarationLView[INJECTOR$1]));
22666
22686
  const declarationLContainer = this._declarationLView[this._declarationTContainer.index];
22667
22687
  ngDevMode && assertLContainer(declarationLContainer);
22668
22688
  embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer;
@@ -22674,6 +22694,14 @@ const R3TemplateRef = class TemplateRef extends ViewEngineTemplateRef {
22674
22694
  return new ViewRef$1(embeddedLView);
22675
22695
  }
22676
22696
  };
22697
+ function createEmbeddedViewInjector(embeddedViewInjector, declarationViewInjector) {
22698
+ if (!embeddedViewInjector) {
22699
+ return null;
22700
+ }
22701
+ return declarationViewInjector ?
22702
+ new ChainedInjector(embeddedViewInjector, declarationViewInjector) :
22703
+ embeddedViewInjector;
22704
+ }
22677
22705
  /**
22678
22706
  * Creates a TemplateRef given a node.
22679
22707
  *
@@ -22778,8 +22806,17 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
22778
22806
  get length() {
22779
22807
  return this._lContainer.length - CONTAINER_HEADER_OFFSET;
22780
22808
  }
22781
- createEmbeddedView(templateRef, context, index) {
22782
- const viewRef = templateRef.createEmbeddedView(context || {});
22809
+ createEmbeddedView(templateRef, context, indexOrOptions) {
22810
+ let index;
22811
+ let injector;
22812
+ if (typeof indexOrOptions === 'number') {
22813
+ index = indexOrOptions;
22814
+ }
22815
+ else if (indexOrOptions != null) {
22816
+ index = indexOrOptions.index;
22817
+ injector = indexOrOptions.injector;
22818
+ }
22819
+ const viewRef = templateRef.createEmbeddedView(context || {}, injector);
22783
22820
  this.insert(viewRef, index);
22784
22821
  return viewRef;
22785
22822
  }