@angular/core 17.1.2 → 17.1.3

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.
Files changed (36) hide show
  1. package/esm2022/src/application/application_ref.mjs +54 -16
  2. package/esm2022/src/authoring/input.mjs +1 -1
  3. package/esm2022/src/authoring/input_signal.mjs +1 -1
  4. package/esm2022/src/authoring/input_type_checking.mjs +1 -1
  5. package/esm2022/src/authoring.mjs +1 -1
  6. package/esm2022/src/defer/instructions.mjs +13 -6
  7. package/esm2022/src/render3/after_render_hooks.mjs +2 -6
  8. package/esm2022/src/render3/component_ref.mjs +1 -1
  9. package/esm2022/src/render3/definition.mjs +1 -1
  10. package/esm2022/src/render3/errors_di.mjs +2 -2
  11. package/esm2022/src/render3/i18n/i18n_locale_id.mjs +2 -2
  12. package/esm2022/src/render3/instructions/change_detection.mjs +6 -6
  13. package/esm2022/src/render3/instructions/write_to_directive_input.mjs +1 -1
  14. package/esm2022/src/render3/util/view_utils.mjs +3 -3
  15. package/esm2022/src/render3/view_ref.mjs +1 -1
  16. package/esm2022/src/util/stringify.mjs +2 -2
  17. package/esm2022/src/version.mjs +1 -1
  18. package/esm2022/testing/src/component_fixture.mjs +4 -4
  19. package/esm2022/testing/src/logger.mjs +3 -3
  20. package/fesm2022/core.mjs +438 -401
  21. package/fesm2022/core.mjs.map +1 -1
  22. package/fesm2022/primitives/signals.mjs +1 -1
  23. package/fesm2022/rxjs-interop.mjs +1 -1
  24. package/fesm2022/testing.mjs +4 -4
  25. package/fesm2022/testing.mjs.map +1 -1
  26. package/index.d.ts +49 -17
  27. package/package.json +1 -1
  28. package/primitives/signals/index.d.ts +1 -1
  29. package/rxjs-interop/index.d.ts +1 -1
  30. package/schematics/migrations/block-template-entities/bundle.js +27 -9
  31. package/schematics/migrations/block-template-entities/bundle.js.map +2 -2
  32. package/schematics/ng-generate/control-flow-migration/bundle.js +27 -9
  33. package/schematics/ng-generate/control-flow-migration/bundle.js.map +2 -2
  34. package/schematics/ng-generate/standalone-migration/bundle.js +176 -77
  35. package/schematics/ng-generate/standalone-migration/bundle.js.map +3 -3
  36. package/testing/index.d.ts +1 -1
package/fesm2022/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.1.2
2
+ * @license Angular v17.1.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -205,7 +205,7 @@ function concatStringsWithSpace(before, after) {
205
205
  *
206
206
  * @param string
207
207
  * @param maxLength of the output string
208
- * @returns elispsed string with ... in the middle
208
+ * @returns ellipsed string with ... in the middle
209
209
  */
210
210
  function truncateMiddle(str, maxLength = 100) {
211
211
  if (!str || maxLength < 1 || str.length <= maxLength)
@@ -369,7 +369,7 @@ function stringifyTypeFromDebugInfo(debugInfo) {
369
369
  /** Called when directives inject each other (creating a circular dependency) */
370
370
  function throwCyclicDependencyError(token, path) {
371
371
  const depPath = path ? `. Dependency path: ${path.join(' > ')} > ${token}` : '';
372
- throw new RuntimeError(-200 /* RuntimeErrorCode.CYCLIC_DI_DEPENDENCY */, `Circular dependency in DI detected for ${token}${depPath}`);
372
+ throw new RuntimeError(-200 /* RuntimeErrorCode.CYCLIC_DI_DEPENDENCY */, ngDevMode ? `Circular dependency in DI detected for ${token}${depPath}` : token);
373
373
  }
374
374
  function throwMixedMultiProviderError() {
375
375
  throw new Error(`Cannot mix multi providers and regular providers`);
@@ -2791,8 +2791,8 @@ function walkUpViews(nestingLevel, currentView) {
2791
2791
  return currentView;
2792
2792
  }
2793
2793
  function requiresRefreshOrTraversal(lView) {
2794
- return lView[FLAGS] & (1024 /* LViewFlags.RefreshView */ | 8192 /* LViewFlags.HasChildViewsToRefresh */) ||
2795
- lView[REACTIVE_TEMPLATE_CONSUMER]?.dirty;
2794
+ return !!(lView[FLAGS] & (1024 /* LViewFlags.RefreshView */ | 8192 /* LViewFlags.HasChildViewsToRefresh */) ||
2795
+ lView[REACTIVE_TEMPLATE_CONSUMER]?.dirty);
2796
2796
  }
2797
2797
  /**
2798
2798
  * Updates the `HasChildViewsToRefresh` flag on the parents of the `LView` as well as the
@@ -13450,7 +13450,7 @@ function textBindingInternal(lView, index, value) {
13450
13450
  * The maximum number of times the change detection traversal will rerun before throwing an error.
13451
13451
  */
13452
13452
  const MAXIMUM_REFRESH_RERUNS = 100;
13453
- function detectChangesInternal(lView, notifyErrorHandler = true) {
13453
+ function detectChangesInternal(lView, notifyErrorHandler = true, mode = 0 /* ChangeDetectionMode.Global */) {
13454
13454
  const environment = lView[ENVIRONMENT];
13455
13455
  const rendererFactory = environment.rendererFactory;
13456
13456
  // Check no changes mode is a dev only mode used to verify that bindings have not changed
@@ -13461,7 +13461,7 @@ function detectChangesInternal(lView, notifyErrorHandler = true) {
13461
13461
  rendererFactory.begin?.();
13462
13462
  }
13463
13463
  try {
13464
- detectChangesInViewWhileDirty(lView);
13464
+ detectChangesInViewWhileDirty(lView, mode);
13465
13465
  }
13466
13466
  catch (error) {
13467
13467
  if (notifyErrorHandler) {
@@ -13478,8 +13478,8 @@ function detectChangesInternal(lView, notifyErrorHandler = true) {
13478
13478
  }
13479
13479
  }
13480
13480
  }
13481
- function detectChangesInViewWhileDirty(lView) {
13482
- detectChangesInView(lView, 0 /* ChangeDetectionMode.Global */);
13481
+ function detectChangesInViewWhileDirty(lView, mode) {
13482
+ detectChangesInView(lView, mode);
13483
13483
  let retries = 0;
13484
13484
  // If after running change detection, this view still needs to be refreshed or there are
13485
13485
  // descendants views that need to be refreshed due to re-dirtying during the change detection
@@ -15209,11 +15209,9 @@ class AfterRenderCallbackHandlerImpl {
15209
15209
  this.deferredCallbacks.delete(callback);
15210
15210
  }
15211
15211
  execute() {
15212
- let callbacksExecuted = false;
15213
15212
  this.executingCallbacks = true;
15214
15213
  for (const bucket of Object.values(this.buckets)) {
15215
15214
  for (const callback of bucket) {
15216
- callbacksExecuted = true;
15217
15215
  callback.invoke();
15218
15216
  }
15219
15217
  }
@@ -15222,7 +15220,6 @@ class AfterRenderCallbackHandlerImpl {
15222
15220
  this.buckets[callback.phase].add(callback);
15223
15221
  }
15224
15222
  this.deferredCallbacks.clear();
15225
- return callbacksExecuted;
15226
15223
  }
15227
15224
  destroy() {
15228
15225
  for (const bucket of Object.values(this.buckets)) {
@@ -15254,8 +15251,7 @@ class AfterRenderEventManager {
15254
15251
  for (const callback of callbacks) {
15255
15252
  callback();
15256
15253
  }
15257
- const handlerCallbacksExecuted = this.handler?.execute();
15258
- return !!handlerCallbacksExecuted || callbacks.length > 0;
15254
+ this.handler?.execute();
15259
15255
  }
15260
15256
  ngOnDestroy() {
15261
15257
  this.handler?.destroy();
@@ -15768,7 +15764,7 @@ function createRootComponent(componentView, rootComponentDef, rootDirectives, ho
15768
15764
  function setRootNodeAttributes(hostRenderer, componentDef, hostRNode, rootSelectorOrNode) {
15769
15765
  if (rootSelectorOrNode) {
15770
15766
  // The placeholder will be replaced with the actual version at build time.
15771
- setUpAttributes(hostRenderer, hostRNode, ['ng-version', '17.1.2']);
15767
+ setUpAttributes(hostRenderer, hostRNode, ['ng-version', '17.1.3']);
15772
15768
  }
15773
15769
  else {
15774
15770
  // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
@@ -17604,6 +17600,288 @@ function enableLocateOrCreateContainerRefImpl() {
17604
17600
  _populateDehydratedViewsInLContainer = populateDehydratedViewsInLContainerImpl;
17605
17601
  }
17606
17602
 
17603
+ /**
17604
+ * The name of a field that Angular monkey-patches onto a component
17605
+ * class to store a function that loads defer-loadable dependencies
17606
+ * and applies metadata to a class.
17607
+ */
17608
+ const ASYNC_COMPONENT_METADATA_FN = '__ngAsyncComponentMetadataFn__';
17609
+ /**
17610
+ * If a given component has unresolved async metadata - returns a reference
17611
+ * to a function that applies component metadata after resolving defer-loadable
17612
+ * dependencies. Otherwise - this function returns `null`.
17613
+ */
17614
+ function getAsyncClassMetadataFn(type) {
17615
+ const componentClass = type; // cast to `any`, so that we can read a monkey-patched field
17616
+ return componentClass[ASYNC_COMPONENT_METADATA_FN] ?? null;
17617
+ }
17618
+ /**
17619
+ * Handles the process of applying metadata info to a component class in case
17620
+ * component template has defer blocks (thus some dependencies became deferrable).
17621
+ *
17622
+ * @param type Component class where metadata should be added
17623
+ * @param dependencyLoaderFn Function that loads dependencies
17624
+ * @param metadataSetterFn Function that forms a scope in which the `setClassMetadata` is invoked
17625
+ */
17626
+ function setClassMetadataAsync(type, dependencyLoaderFn, metadataSetterFn) {
17627
+ const componentClass = type; // cast to `any`, so that we can monkey-patch it
17628
+ componentClass[ASYNC_COMPONENT_METADATA_FN] = () => Promise.all(dependencyLoaderFn()).then(dependencies => {
17629
+ metadataSetterFn(...dependencies);
17630
+ // Metadata is now set, reset field value to indicate that this component
17631
+ // can by used/compiled synchronously.
17632
+ componentClass[ASYNC_COMPONENT_METADATA_FN] = null;
17633
+ return dependencies;
17634
+ });
17635
+ return componentClass[ASYNC_COMPONENT_METADATA_FN];
17636
+ }
17637
+ /**
17638
+ * Adds decorator, constructor, and property metadata to a given type via static metadata fields
17639
+ * on the type.
17640
+ *
17641
+ * These metadata fields can later be read with Angular's `ReflectionCapabilities` API.
17642
+ *
17643
+ * Calls to `setClassMetadata` can be guarded by ngDevMode, resulting in the metadata assignments
17644
+ * being tree-shaken away during production builds.
17645
+ */
17646
+ function setClassMetadata(type, decorators, ctorParameters, propDecorators) {
17647
+ return noSideEffects(() => {
17648
+ const clazz = type;
17649
+ if (decorators !== null) {
17650
+ if (clazz.hasOwnProperty('decorators') && clazz.decorators !== undefined) {
17651
+ clazz.decorators.push(...decorators);
17652
+ }
17653
+ else {
17654
+ clazz.decorators = decorators;
17655
+ }
17656
+ }
17657
+ if (ctorParameters !== null) {
17658
+ // Rather than merging, clobber the existing parameters. If other projects exist which
17659
+ // use tsickle-style annotations and reflect over them in the same way, this could
17660
+ // cause issues, but that is vanishingly unlikely.
17661
+ clazz.ctorParameters = ctorParameters;
17662
+ }
17663
+ if (propDecorators !== null) {
17664
+ // The property decorator objects are merged as it is possible different fields have
17665
+ // different decorator types. Decorators on individual fields are not merged, as it's
17666
+ // also incredibly unlikely that a field will be decorated both with an Angular
17667
+ // decorator and a non-Angular decorator that's also been downleveled.
17668
+ if (clazz.hasOwnProperty('propDecorators') && clazz.propDecorators !== undefined) {
17669
+ clazz.propDecorators = { ...clazz.propDecorators, ...propDecorators };
17670
+ }
17671
+ else {
17672
+ clazz.propDecorators = propDecorators;
17673
+ }
17674
+ }
17675
+ });
17676
+ }
17677
+
17678
+ /**
17679
+ * Represents an instance of an `NgModule` created by an `NgModuleFactory`.
17680
+ * Provides access to the `NgModule` instance and related objects.
17681
+ *
17682
+ * @publicApi
17683
+ */
17684
+ class NgModuleRef$1 {
17685
+ }
17686
+ /**
17687
+ * @publicApi
17688
+ *
17689
+ * @deprecated
17690
+ * This class was mostly used as a part of ViewEngine-based JIT API and is no longer needed in Ivy
17691
+ * JIT mode. See [JIT API changes due to ViewEngine deprecation](guide/deprecations#jit-api-changes)
17692
+ * for additional context. Angular provides APIs that accept NgModule classes directly (such as
17693
+ * [PlatformRef.bootstrapModule](api/core/PlatformRef#bootstrapModule) and
17694
+ * [createNgModule](api/core/createNgModule)), consider switching to those APIs instead of
17695
+ * using factory-based ones.
17696
+ */
17697
+ class NgModuleFactory$1 {
17698
+ }
17699
+
17700
+ /**
17701
+ * Returns a new NgModuleRef instance based on the NgModule class and parent injector provided.
17702
+ *
17703
+ * @param ngModule NgModule class.
17704
+ * @param parentInjector Optional injector instance to use as a parent for the module injector. If
17705
+ * not provided, `NullInjector` will be used instead.
17706
+ * @returns NgModuleRef that represents an NgModule instance.
17707
+ *
17708
+ * @publicApi
17709
+ */
17710
+ function createNgModule(ngModule, parentInjector) {
17711
+ return new NgModuleRef(ngModule, parentInjector ?? null, []);
17712
+ }
17713
+ /**
17714
+ * The `createNgModule` function alias for backwards-compatibility.
17715
+ * Please avoid using it directly and use `createNgModule` instead.
17716
+ *
17717
+ * @deprecated Use `createNgModule` instead.
17718
+ */
17719
+ const createNgModuleRef = createNgModule;
17720
+ class NgModuleRef extends NgModuleRef$1 {
17721
+ constructor(ngModuleType, _parent, additionalProviders) {
17722
+ super();
17723
+ this._parent = _parent;
17724
+ // tslint:disable-next-line:require-internal-with-underscore
17725
+ this._bootstrapComponents = [];
17726
+ this.destroyCbs = [];
17727
+ // When bootstrapping a module we have a dependency graph that looks like this:
17728
+ // ApplicationRef -> ComponentFactoryResolver -> NgModuleRef. The problem is that if the
17729
+ // module being resolved tries to inject the ComponentFactoryResolver, it'll create a
17730
+ // circular dependency which will result in a runtime error, because the injector doesn't
17731
+ // exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
17732
+ // and providing it, rather than letting the injector resolve it.
17733
+ this.componentFactoryResolver = new ComponentFactoryResolver(this);
17734
+ const ngModuleDef = getNgModuleDef(ngModuleType);
17735
+ ngDevMode &&
17736
+ assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
17737
+ this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
17738
+ this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
17739
+ { provide: NgModuleRef$1, useValue: this }, {
17740
+ provide: ComponentFactoryResolver$1,
17741
+ useValue: this.componentFactoryResolver
17742
+ },
17743
+ ...additionalProviders
17744
+ ], stringify(ngModuleType), new Set(['environment']));
17745
+ // We need to resolve the injector types separately from the injector creation, because
17746
+ // the module might be trying to use this ref in its constructor for DI which will cause a
17747
+ // circular error that will eventually error out, because the injector isn't created yet.
17748
+ this._r3Injector.resolveInjectorInitializers();
17749
+ this.instance = this._r3Injector.get(ngModuleType);
17750
+ }
17751
+ get injector() {
17752
+ return this._r3Injector;
17753
+ }
17754
+ destroy() {
17755
+ ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
17756
+ const injector = this._r3Injector;
17757
+ !injector.destroyed && injector.destroy();
17758
+ this.destroyCbs.forEach(fn => fn());
17759
+ this.destroyCbs = null;
17760
+ }
17761
+ onDestroy(callback) {
17762
+ ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
17763
+ this.destroyCbs.push(callback);
17764
+ }
17765
+ }
17766
+ class NgModuleFactory extends NgModuleFactory$1 {
17767
+ constructor(moduleType) {
17768
+ super();
17769
+ this.moduleType = moduleType;
17770
+ }
17771
+ create(parentInjector) {
17772
+ return new NgModuleRef(this.moduleType, parentInjector, []);
17773
+ }
17774
+ }
17775
+ function createNgModuleRefWithProviders(moduleType, parentInjector, additionalProviders) {
17776
+ return new NgModuleRef(moduleType, parentInjector, additionalProviders);
17777
+ }
17778
+ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
17779
+ constructor(config) {
17780
+ super();
17781
+ this.componentFactoryResolver = new ComponentFactoryResolver(this);
17782
+ this.instance = null;
17783
+ const injector = new R3Injector([
17784
+ ...config.providers,
17785
+ { provide: NgModuleRef$1, useValue: this },
17786
+ { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver },
17787
+ ], config.parent || getNullInjector(), config.debugName, new Set(['environment']));
17788
+ this.injector = injector;
17789
+ if (config.runEnvironmentInitializers) {
17790
+ injector.resolveInjectorInitializers();
17791
+ }
17792
+ }
17793
+ destroy() {
17794
+ this.injector.destroy();
17795
+ }
17796
+ onDestroy(callback) {
17797
+ this.injector.onDestroy(callback);
17798
+ }
17799
+ }
17800
+ /**
17801
+ * Create a new environment injector.
17802
+ *
17803
+ * Learn more about environment injectors in
17804
+ * [this guide](guide/standalone-components#environment-injectors).
17805
+ *
17806
+ * @param providers An array of providers.
17807
+ * @param parent A parent environment injector.
17808
+ * @param debugName An optional name for this injector instance, which will be used in error
17809
+ * messages.
17810
+ *
17811
+ * @publicApi
17812
+ */
17813
+ function createEnvironmentInjector(providers, parent, debugName = null) {
17814
+ const adapter = new EnvironmentNgModuleRefAdapter({ providers, parent, debugName, runEnvironmentInitializers: true });
17815
+ return adapter.injector;
17816
+ }
17817
+
17818
+ /*
17819
+ * This file exists to support compilation of @angular/core in Ivy mode.
17820
+ *
17821
+ * When the Angular compiler processes a compilation unit, it normally writes imports to
17822
+ * @angular/core. When compiling the core package itself this strategy isn't usable. Instead, the
17823
+ * compiler writes imports to this file.
17824
+ *
17825
+ * Only a subset of such imports are supported - core is not allowed to declare components or pipes.
17826
+ * A check in ngtsc's `R3SymbolsImportRewriter` validates this condition. The rewriter is only used
17827
+ * when compiling @angular/core and is responsible for translating an external name (prefixed with
17828
+ * ɵ) to the internal symbol name as exported below.
17829
+ *
17830
+ * The below symbols are used for @Injectable and @NgModule compilation.
17831
+ */
17832
+ /**
17833
+ * The existence of this constant (in this particular file) informs the Angular compiler that the
17834
+ * current program is actually @angular/core, which needs to be compiled specially.
17835
+ */
17836
+ const ITS_JUST_ANGULAR = true;
17837
+
17838
+ /**
17839
+ * *Internal* service that keeps track of pending tasks happening in the system.
17840
+ *
17841
+ * This information is needed to make sure that the serialization on the server
17842
+ * is delayed until all tasks in the queue (such as an initial navigation or a
17843
+ * pending HTTP request) are completed.
17844
+ *
17845
+ * Pending tasks continue to contribute to the stableness of `ApplicationRef`
17846
+ * throughout the lifetime of the application.
17847
+ */
17848
+ class PendingTasks {
17849
+ constructor() {
17850
+ this.taskId = 0;
17851
+ this.pendingTasks = new Set();
17852
+ this.hasPendingTasks = new BehaviorSubject(false);
17853
+ }
17854
+ get _hasPendingTasks() {
17855
+ return this.hasPendingTasks.value;
17856
+ }
17857
+ add() {
17858
+ if (!this._hasPendingTasks) {
17859
+ this.hasPendingTasks.next(true);
17860
+ }
17861
+ const taskId = this.taskId++;
17862
+ this.pendingTasks.add(taskId);
17863
+ return taskId;
17864
+ }
17865
+ remove(taskId) {
17866
+ this.pendingTasks.delete(taskId);
17867
+ if (this.pendingTasks.size === 0 && this._hasPendingTasks) {
17868
+ this.hasPendingTasks.next(false);
17869
+ }
17870
+ }
17871
+ ngOnDestroy() {
17872
+ this.pendingTasks.clear();
17873
+ if (this._hasPendingTasks) {
17874
+ this.hasPendingTasks.next(false);
17875
+ }
17876
+ }
17877
+ static { this.ɵfac = function PendingTasks_Factory(t) { return new (t || PendingTasks)(); }; }
17878
+ static { this.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: PendingTasks, factory: PendingTasks.ɵfac, providedIn: 'root' }); }
17879
+ }
17880
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PendingTasks, [{
17881
+ type: Injectable,
17882
+ args: [{ providedIn: 'root' }]
17883
+ }], null, null); })();
17884
+
17607
17885
  // TODO(misko): consider inlining
17608
17886
  /** Updates binding and returns the value. */
17609
17887
  function updateBinding(lView, bindingIndex, value) {
@@ -18939,14 +19217,14 @@ function applyDeferBlockState(newState, lDetails, lContainer, tNode, hostLView)
18939
19217
  lDetails[DEFER_BLOCK_STATE] = newState;
18940
19218
  const hostTView = hostLView[TVIEW];
18941
19219
  const adjustedIndex = stateTmplIndex + HEADER_OFFSET;
18942
- const tNode = getTNode(hostTView, adjustedIndex);
19220
+ const activeBlockTNode = getTNode(hostTView, adjustedIndex);
18943
19221
  // There is only 1 view that can be present in an LContainer that
18944
19222
  // represents a defer block, so always refer to the first one.
18945
19223
  const viewIndex = 0;
18946
19224
  removeLViewFromLContainer(lContainer, viewIndex);
18947
- const dehydratedView = findMatchingDehydratedView(lContainer, tNode.tView.ssrId);
18948
- const embeddedLView = createAndRenderEmbeddedLView(hostLView, tNode, null, { dehydratedView });
18949
- addLViewToLContainer(lContainer, embeddedLView, viewIndex, shouldAddViewToDom(tNode, dehydratedView));
19225
+ const dehydratedView = findMatchingDehydratedView(lContainer, activeBlockTNode.tView.ssrId);
19226
+ const embeddedLView = createAndRenderEmbeddedLView(hostLView, activeBlockTNode, null, { dehydratedView });
19227
+ addLViewToLContainer(lContainer, embeddedLView, viewIndex, shouldAddViewToDom(activeBlockTNode, dehydratedView));
18950
19228
  markViewDirty(embeddedLView);
18951
19229
  }
18952
19230
  }
@@ -19061,6 +19339,9 @@ function triggerResourceLoading(tDetails, lView, tNode) {
19061
19339
  dependenciesFn = deferDependencyInterceptor.intercept(dependenciesFn);
19062
19340
  }
19063
19341
  }
19342
+ // Indicate that an application is not stable and has a pending task.
19343
+ const pendingTasks = injector.get(PendingTasks);
19344
+ const taskId = pendingTasks.add();
19064
19345
  // The `dependenciesFn` might be `null` when all dependencies within
19065
19346
  // a given defer block were eagerly referenced elsewhere in a file,
19066
19347
  // thus no dynamic `import()`s were produced.
@@ -19068,6 +19349,7 @@ function triggerResourceLoading(tDetails, lView, tNode) {
19068
19349
  tDetails.loadingPromise = Promise.resolve().then(() => {
19069
19350
  tDetails.loadingPromise = null;
19070
19351
  tDetails.loadingState = DeferDependenciesLoadingState.COMPLETE;
19352
+ pendingTasks.remove(taskId);
19071
19353
  });
19072
19354
  return;
19073
19355
  }
@@ -19095,8 +19377,10 @@ function triggerResourceLoading(tDetails, lView, tNode) {
19095
19377
  break;
19096
19378
  }
19097
19379
  }
19098
- // Loading is completed, we no longer need this Promise.
19380
+ // Loading is completed, we no longer need the loading Promise
19381
+ // and a pending task should also be removed.
19099
19382
  tDetails.loadingPromise = null;
19383
+ pendingTasks.remove(taskId);
19100
19384
  if (failed) {
19101
19385
  tDetails.loadingState = DeferDependenciesLoadingState.FAILED;
19102
19386
  if (tDetails.errorTmplIndex === null) {
@@ -22759,7 +23043,7 @@ let LOCALE_ID$1 = DEFAULT_LOCALE_ID;
22759
23043
  * @param localeId
22760
23044
  */
22761
23045
  function setLocaleId(localeId) {
22762
- assertDefined(localeId, `Expected localeId to be defined`);
23046
+ ngDevMode && assertDefined(localeId, `Expected localeId to be defined`);
22763
23047
  if (typeof localeId === 'string') {
22764
23048
  LOCALE_ID$1 = localeId.toLowerCase().replace(/_/g, '-');
22765
23049
  }
@@ -27316,237 +27600,97 @@ function indexOf(item, arr, begin, end) {
27316
27600
  */
27317
27601
  function multiProvidersFactoryResolver(_, tData, lData, tNode) {
27318
27602
  return multiResolve(this.multi, []);
27319
- }
27320
- /**
27321
- * Use this with `multi` `viewProviders`.
27322
- *
27323
- * This factory knows how to concatenate itself with the existing `multi` `providers`.
27324
- */
27325
- function multiViewProvidersFactoryResolver(_, tData, lView, tNode) {
27326
- const factories = this.multi;
27327
- let result;
27328
- if (this.providerFactory) {
27329
- const componentCount = this.providerFactory.componentProviders;
27330
- const multiProviders = getNodeInjectable(lView, lView[TVIEW], this.providerFactory.index, tNode);
27331
- // Copy the section of the array which contains `multi` `providers` from the component
27332
- result = multiProviders.slice(0, componentCount);
27333
- // Insert the `viewProvider` instances.
27334
- multiResolve(factories, result);
27335
- // Copy the section of the array which contains `multi` `providers` from other directives
27336
- for (let i = componentCount; i < multiProviders.length; i++) {
27337
- result.push(multiProviders[i]);
27338
- }
27339
- }
27340
- else {
27341
- result = [];
27342
- // Insert the `viewProvider` instances.
27343
- multiResolve(factories, result);
27344
- }
27345
- return result;
27346
- }
27347
- /**
27348
- * Maps an array of factories into an array of values.
27349
- */
27350
- function multiResolve(factories, result) {
27351
- for (let i = 0; i < factories.length; i++) {
27352
- const factory = factories[i];
27353
- result.push(factory());
27354
- }
27355
- return result;
27356
- }
27357
- /**
27358
- * Creates a multi factory.
27359
- */
27360
- function multiFactory(factoryFn, index, isViewProvider, isComponent, f) {
27361
- const factory = new NodeInjectorFactory(factoryFn, isViewProvider, ɵɵdirectiveInject);
27362
- factory.multi = [];
27363
- factory.index = index;
27364
- factory.componentProviders = 0;
27365
- multiFactoryAdd(factory, f, isComponent && !isViewProvider);
27366
- return factory;
27367
- }
27368
-
27369
- /**
27370
- * This feature resolves the providers of a directive (or component),
27371
- * and publish them into the DI system, making it visible to others for injection.
27372
- *
27373
- * For example:
27374
- * ```ts
27375
- * class ComponentWithProviders {
27376
- * constructor(private greeter: GreeterDE) {}
27377
- *
27378
- * static ɵcmp = defineComponent({
27379
- * type: ComponentWithProviders,
27380
- * selectors: [['component-with-providers']],
27381
- * factory: () => new ComponentWithProviders(directiveInject(GreeterDE as any)),
27382
- * decls: 1,
27383
- * vars: 1,
27384
- * template: function(fs: RenderFlags, ctx: ComponentWithProviders) {
27385
- * if (fs & RenderFlags.Create) {
27386
- * ɵɵtext(0);
27387
- * }
27388
- * if (fs & RenderFlags.Update) {
27389
- * ɵɵtextInterpolate(ctx.greeter.greet());
27390
- * }
27391
- * },
27392
- * features: [ɵɵProvidersFeature([GreeterDE])]
27393
- * });
27394
- * }
27395
- * ```
27396
- *
27397
- * @param definition
27398
- *
27399
- * @codeGenApi
27400
- */
27401
- function ɵɵProvidersFeature(providers, viewProviders = []) {
27402
- return (definition) => {
27403
- definition.providersResolver =
27404
- (def, processProvidersFn) => {
27405
- return providersResolver(def, //
27406
- processProvidersFn ? processProvidersFn(providers) : providers, //
27407
- viewProviders);
27408
- };
27409
- };
27410
- }
27411
-
27412
- /**
27413
- * Represents an instance of an `NgModule` created by an `NgModuleFactory`.
27414
- * Provides access to the `NgModule` instance and related objects.
27415
- *
27416
- * @publicApi
27417
- */
27418
- class NgModuleRef$1 {
27419
- }
27420
- /**
27421
- * @publicApi
27422
- *
27423
- * @deprecated
27424
- * This class was mostly used as a part of ViewEngine-based JIT API and is no longer needed in Ivy
27425
- * JIT mode. See [JIT API changes due to ViewEngine deprecation](guide/deprecations#jit-api-changes)
27426
- * for additional context. Angular provides APIs that accept NgModule classes directly (such as
27427
- * [PlatformRef.bootstrapModule](api/core/PlatformRef#bootstrapModule) and
27428
- * [createNgModule](api/core/createNgModule)), consider switching to those APIs instead of
27429
- * using factory-based ones.
27430
- */
27431
- class NgModuleFactory$1 {
27432
- }
27433
-
27434
- /**
27435
- * Returns a new NgModuleRef instance based on the NgModule class and parent injector provided.
27436
- *
27437
- * @param ngModule NgModule class.
27438
- * @param parentInjector Optional injector instance to use as a parent for the module injector. If
27439
- * not provided, `NullInjector` will be used instead.
27440
- * @returns NgModuleRef that represents an NgModule instance.
27441
- *
27442
- * @publicApi
27443
- */
27444
- function createNgModule(ngModule, parentInjector) {
27445
- return new NgModuleRef(ngModule, parentInjector ?? null, []);
27446
- }
27447
- /**
27448
- * The `createNgModule` function alias for backwards-compatibility.
27449
- * Please avoid using it directly and use `createNgModule` instead.
27450
- *
27451
- * @deprecated Use `createNgModule` instead.
27452
- */
27453
- const createNgModuleRef = createNgModule;
27454
- class NgModuleRef extends NgModuleRef$1 {
27455
- constructor(ngModuleType, _parent, additionalProviders) {
27456
- super();
27457
- this._parent = _parent;
27458
- // tslint:disable-next-line:require-internal-with-underscore
27459
- this._bootstrapComponents = [];
27460
- this.destroyCbs = [];
27461
- // When bootstrapping a module we have a dependency graph that looks like this:
27462
- // ApplicationRef -> ComponentFactoryResolver -> NgModuleRef. The problem is that if the
27463
- // module being resolved tries to inject the ComponentFactoryResolver, it'll create a
27464
- // circular dependency which will result in a runtime error, because the injector doesn't
27465
- // exist yet. We work around the issue by creating the ComponentFactoryResolver ourselves
27466
- // and providing it, rather than letting the injector resolve it.
27467
- this.componentFactoryResolver = new ComponentFactoryResolver(this);
27468
- const ngModuleDef = getNgModuleDef(ngModuleType);
27469
- ngDevMode &&
27470
- assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
27471
- this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
27472
- this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
27473
- { provide: NgModuleRef$1, useValue: this }, {
27474
- provide: ComponentFactoryResolver$1,
27475
- useValue: this.componentFactoryResolver
27476
- },
27477
- ...additionalProviders
27478
- ], stringify(ngModuleType), new Set(['environment']));
27479
- // We need to resolve the injector types separately from the injector creation, because
27480
- // the module might be trying to use this ref in its constructor for DI which will cause a
27481
- // circular error that will eventually error out, because the injector isn't created yet.
27482
- this._r3Injector.resolveInjectorInitializers();
27483
- this.instance = this._r3Injector.get(ngModuleType);
27484
- }
27485
- get injector() {
27486
- return this._r3Injector;
27487
- }
27488
- destroy() {
27489
- ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
27490
- const injector = this._r3Injector;
27491
- !injector.destroyed && injector.destroy();
27492
- this.destroyCbs.forEach(fn => fn());
27493
- this.destroyCbs = null;
27494
- }
27495
- onDestroy(callback) {
27496
- ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
27497
- this.destroyCbs.push(callback);
27498
- }
27499
- }
27500
- class NgModuleFactory extends NgModuleFactory$1 {
27501
- constructor(moduleType) {
27502
- super();
27503
- this.moduleType = moduleType;
27504
- }
27505
- create(parentInjector) {
27506
- return new NgModuleRef(this.moduleType, parentInjector, []);
27507
- }
27508
- }
27509
- function createNgModuleRefWithProviders(moduleType, parentInjector, additionalProviders) {
27510
- return new NgModuleRef(moduleType, parentInjector, additionalProviders);
27511
- }
27512
- class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
27513
- constructor(config) {
27514
- super();
27515
- this.componentFactoryResolver = new ComponentFactoryResolver(this);
27516
- this.instance = null;
27517
- const injector = new R3Injector([
27518
- ...config.providers,
27519
- { provide: NgModuleRef$1, useValue: this },
27520
- { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver },
27521
- ], config.parent || getNullInjector(), config.debugName, new Set(['environment']));
27522
- this.injector = injector;
27523
- if (config.runEnvironmentInitializers) {
27524
- injector.resolveInjectorInitializers();
27603
+ }
27604
+ /**
27605
+ * Use this with `multi` `viewProviders`.
27606
+ *
27607
+ * This factory knows how to concatenate itself with the existing `multi` `providers`.
27608
+ */
27609
+ function multiViewProvidersFactoryResolver(_, tData, lView, tNode) {
27610
+ const factories = this.multi;
27611
+ let result;
27612
+ if (this.providerFactory) {
27613
+ const componentCount = this.providerFactory.componentProviders;
27614
+ const multiProviders = getNodeInjectable(lView, lView[TVIEW], this.providerFactory.index, tNode);
27615
+ // Copy the section of the array which contains `multi` `providers` from the component
27616
+ result = multiProviders.slice(0, componentCount);
27617
+ // Insert the `viewProvider` instances.
27618
+ multiResolve(factories, result);
27619
+ // Copy the section of the array which contains `multi` `providers` from other directives
27620
+ for (let i = componentCount; i < multiProviders.length; i++) {
27621
+ result.push(multiProviders[i]);
27525
27622
  }
27526
27623
  }
27527
- destroy() {
27528
- this.injector.destroy();
27624
+ else {
27625
+ result = [];
27626
+ // Insert the `viewProvider` instances.
27627
+ multiResolve(factories, result);
27529
27628
  }
27530
- onDestroy(callback) {
27531
- this.injector.onDestroy(callback);
27629
+ return result;
27630
+ }
27631
+ /**
27632
+ * Maps an array of factories into an array of values.
27633
+ */
27634
+ function multiResolve(factories, result) {
27635
+ for (let i = 0; i < factories.length; i++) {
27636
+ const factory = factories[i];
27637
+ result.push(factory());
27532
27638
  }
27639
+ return result;
27533
27640
  }
27534
27641
  /**
27535
- * Create a new environment injector.
27642
+ * Creates a multi factory.
27643
+ */
27644
+ function multiFactory(factoryFn, index, isViewProvider, isComponent, f) {
27645
+ const factory = new NodeInjectorFactory(factoryFn, isViewProvider, ɵɵdirectiveInject);
27646
+ factory.multi = [];
27647
+ factory.index = index;
27648
+ factory.componentProviders = 0;
27649
+ multiFactoryAdd(factory, f, isComponent && !isViewProvider);
27650
+ return factory;
27651
+ }
27652
+
27653
+ /**
27654
+ * This feature resolves the providers of a directive (or component),
27655
+ * and publish them into the DI system, making it visible to others for injection.
27536
27656
  *
27537
- * Learn more about environment injectors in
27538
- * [this guide](guide/standalone-components#environment-injectors).
27657
+ * For example:
27658
+ * ```ts
27659
+ * class ComponentWithProviders {
27660
+ * constructor(private greeter: GreeterDE) {}
27539
27661
  *
27540
- * @param providers An array of providers.
27541
- * @param parent A parent environment injector.
27542
- * @param debugName An optional name for this injector instance, which will be used in error
27543
- * messages.
27662
+ * static ɵcmp = defineComponent({
27663
+ * type: ComponentWithProviders,
27664
+ * selectors: [['component-with-providers']],
27665
+ * factory: () => new ComponentWithProviders(directiveInject(GreeterDE as any)),
27666
+ * decls: 1,
27667
+ * vars: 1,
27668
+ * template: function(fs: RenderFlags, ctx: ComponentWithProviders) {
27669
+ * if (fs & RenderFlags.Create) {
27670
+ * ɵɵtext(0);
27671
+ * }
27672
+ * if (fs & RenderFlags.Update) {
27673
+ * ɵɵtextInterpolate(ctx.greeter.greet());
27674
+ * }
27675
+ * },
27676
+ * features: [ɵɵProvidersFeature([GreeterDE])]
27677
+ * });
27678
+ * }
27679
+ * ```
27544
27680
  *
27545
- * @publicApi
27681
+ * @param definition
27682
+ *
27683
+ * @codeGenApi
27546
27684
  */
27547
- function createEnvironmentInjector(providers, parent, debugName = null) {
27548
- const adapter = new EnvironmentNgModuleRefAdapter({ providers, parent, debugName, runEnvironmentInitializers: true });
27549
- return adapter.injector;
27685
+ function ɵɵProvidersFeature(providers, viewProviders = []) {
27686
+ return (definition) => {
27687
+ definition.providersResolver =
27688
+ (def, processProvidersFn) => {
27689
+ return providersResolver(def, //
27690
+ processProvidersFn ? processProvidersFn(providers) : providers, //
27691
+ viewProviders);
27692
+ };
27693
+ };
27550
27694
  }
27551
27695
 
27552
27696
  /**
@@ -28071,81 +28215,6 @@ function extractInputDebugMetadata(inputs) {
28071
28215
  return res;
28072
28216
  }
28073
28217
 
28074
- /**
28075
- * The name of a field that Angular monkey-patches onto a component
28076
- * class to store a function that loads defer-loadable dependencies
28077
- * and applies metadata to a class.
28078
- */
28079
- const ASYNC_COMPONENT_METADATA_FN = '__ngAsyncComponentMetadataFn__';
28080
- /**
28081
- * If a given component has unresolved async metadata - returns a reference
28082
- * to a function that applies component metadata after resolving defer-loadable
28083
- * dependencies. Otherwise - this function returns `null`.
28084
- */
28085
- function getAsyncClassMetadataFn(type) {
28086
- const componentClass = type; // cast to `any`, so that we can read a monkey-patched field
28087
- return componentClass[ASYNC_COMPONENT_METADATA_FN] ?? null;
28088
- }
28089
- /**
28090
- * Handles the process of applying metadata info to a component class in case
28091
- * component template has defer blocks (thus some dependencies became deferrable).
28092
- *
28093
- * @param type Component class where metadata should be added
28094
- * @param dependencyLoaderFn Function that loads dependencies
28095
- * @param metadataSetterFn Function that forms a scope in which the `setClassMetadata` is invoked
28096
- */
28097
- function setClassMetadataAsync(type, dependencyLoaderFn, metadataSetterFn) {
28098
- const componentClass = type; // cast to `any`, so that we can monkey-patch it
28099
- componentClass[ASYNC_COMPONENT_METADATA_FN] = () => Promise.all(dependencyLoaderFn()).then(dependencies => {
28100
- metadataSetterFn(...dependencies);
28101
- // Metadata is now set, reset field value to indicate that this component
28102
- // can by used/compiled synchronously.
28103
- componentClass[ASYNC_COMPONENT_METADATA_FN] = null;
28104
- return dependencies;
28105
- });
28106
- return componentClass[ASYNC_COMPONENT_METADATA_FN];
28107
- }
28108
- /**
28109
- * Adds decorator, constructor, and property metadata to a given type via static metadata fields
28110
- * on the type.
28111
- *
28112
- * These metadata fields can later be read with Angular's `ReflectionCapabilities` API.
28113
- *
28114
- * Calls to `setClassMetadata` can be guarded by ngDevMode, resulting in the metadata assignments
28115
- * being tree-shaken away during production builds.
28116
- */
28117
- function setClassMetadata(type, decorators, ctorParameters, propDecorators) {
28118
- return noSideEffects(() => {
28119
- const clazz = type;
28120
- if (decorators !== null) {
28121
- if (clazz.hasOwnProperty('decorators') && clazz.decorators !== undefined) {
28122
- clazz.decorators.push(...decorators);
28123
- }
28124
- else {
28125
- clazz.decorators = decorators;
28126
- }
28127
- }
28128
- if (ctorParameters !== null) {
28129
- // Rather than merging, clobber the existing parameters. If other projects exist which
28130
- // use tsickle-style annotations and reflect over them in the same way, this could
28131
- // cause issues, but that is vanishingly unlikely.
28132
- clazz.ctorParameters = ctorParameters;
28133
- }
28134
- if (propDecorators !== null) {
28135
- // The property decorator objects are merged as it is possible different fields have
28136
- // different decorator types. Decorators on individual fields are not merged, as it's
28137
- // also incredibly unlikely that a field will be decorated both with an Angular
28138
- // decorator and a non-Angular decorator that's also been downleveled.
28139
- if (clazz.hasOwnProperty('propDecorators') && clazz.propDecorators !== undefined) {
28140
- clazz.propDecorators = { ...clazz.propDecorators, ...propDecorators };
28141
- }
28142
- else {
28143
- clazz.propDecorators = propDecorators;
28144
- }
28145
- }
28146
- });
28147
- }
28148
-
28149
28218
  /**
28150
28219
  * Bindings for pure functions are stored after regular bindings.
28151
28220
  *
@@ -30108,27 +30177,7 @@ class Version {
30108
30177
  /**
30109
30178
  * @publicApi
30110
30179
  */
30111
- const VERSION = new Version('17.1.2');
30112
-
30113
- /*
30114
- * This file exists to support compilation of @angular/core in Ivy mode.
30115
- *
30116
- * When the Angular compiler processes a compilation unit, it normally writes imports to
30117
- * @angular/core. When compiling the core package itself this strategy isn't usable. Instead, the
30118
- * compiler writes imports to this file.
30119
- *
30120
- * Only a subset of such imports are supported - core is not allowed to declare components or pipes.
30121
- * A check in ngtsc's `R3SymbolsImportRewriter` validates this condition. The rewriter is only used
30122
- * when compiling @angular/core and is responsible for translating an external name (prefixed with
30123
- * ɵ) to the internal symbol name as exported below.
30124
- *
30125
- * The below symbols are used for @Injectable and @NgModule compilation.
30126
- */
30127
- /**
30128
- * The existence of this constant (in this particular file) informs the Angular compiler that the
30129
- * current program is actually @angular/core, which needs to be compiled specially.
30130
- */
30131
- const ITS_JUST_ANGULAR = true;
30180
+ const VERSION = new Version('17.1.3');
30132
30181
 
30133
30182
  class Console {
30134
30183
  log(message) {
@@ -30254,53 +30303,6 @@ const COMPILER_OPTIONS = new InjectionToken(ngDevMode ? 'compilerOptions' : '');
30254
30303
  class CompilerFactory {
30255
30304
  }
30256
30305
 
30257
- /**
30258
- * *Internal* service that keeps track of pending tasks happening in the system.
30259
- *
30260
- * This information is needed to make sure that the serialization on the server
30261
- * is delayed until all tasks in the queue (such as an initial navigation or a
30262
- * pending HTTP request) are completed.
30263
- *
30264
- * Pending tasks continue to contribute to the stableness of `ApplicationRef`
30265
- * throughout the lifetime of the application.
30266
- */
30267
- class PendingTasks {
30268
- constructor() {
30269
- this.taskId = 0;
30270
- this.pendingTasks = new Set();
30271
- this.hasPendingTasks = new BehaviorSubject(false);
30272
- }
30273
- get _hasPendingTasks() {
30274
- return this.hasPendingTasks.value;
30275
- }
30276
- add() {
30277
- if (!this._hasPendingTasks) {
30278
- this.hasPendingTasks.next(true);
30279
- }
30280
- const taskId = this.taskId++;
30281
- this.pendingTasks.add(taskId);
30282
- return taskId;
30283
- }
30284
- remove(taskId) {
30285
- this.pendingTasks.delete(taskId);
30286
- if (this.pendingTasks.size === 0 && this._hasPendingTasks) {
30287
- this.hasPendingTasks.next(false);
30288
- }
30289
- }
30290
- ngOnDestroy() {
30291
- this.pendingTasks.clear();
30292
- if (this._hasPendingTasks) {
30293
- this.hasPendingTasks.next(false);
30294
- }
30295
- }
30296
- static { this.ɵfac = function PendingTasks_Factory(t) { return new (t || PendingTasks)(); }; }
30297
- static { this.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: PendingTasks, factory: PendingTasks.ɵfac, providedIn: 'root' }); }
30298
- }
30299
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PendingTasks, [{
30300
- type: Injectable,
30301
- args: [{ providedIn: 'root' }]
30302
- }], null, null); })();
30303
-
30304
30306
  /**
30305
30307
  * These are the data structures that our framework injector profiler will fill with data in order
30306
30308
  * to support DI debugging APIs.
@@ -31956,10 +31958,8 @@ class ApplicationRef {
31956
31958
  }
31957
31959
  try {
31958
31960
  this._runningTick = true;
31959
- for (let view of this._views) {
31960
- view.detectChanges();
31961
- }
31962
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
31961
+ this.detectChangesInAttachedViews();
31962
+ if ((typeof ngDevMode === 'undefined' || ngDevMode)) {
31963
31963
  for (let view of this._views) {
31964
31964
  view.checkNoChanges();
31965
31965
  }
@@ -31970,21 +31970,52 @@ class ApplicationRef {
31970
31970
  this.internalErrorHandler(e);
31971
31971
  }
31972
31972
  finally {
31973
- // Catch any `ExpressionChanged...` errors and report them to error handler like above
31974
- try {
31975
- const callbacksExecuted = this.afterRenderEffectManager.execute();
31976
- if ((typeof ngDevMode === 'undefined' || ngDevMode) && callbacksExecuted) {
31977
- for (let view of this._views) {
31978
- view.checkNoChanges();
31979
- }
31980
- }
31981
- }
31982
- catch (e) {
31983
- this.internalErrorHandler(e);
31984
- }
31985
31973
  this._runningTick = false;
31986
31974
  }
31987
31975
  }
31976
+ detectChangesInAttachedViews() {
31977
+ let runs = 0;
31978
+ do {
31979
+ if (runs === MAXIMUM_REFRESH_RERUNS) {
31980
+ throw new RuntimeError(103 /* RuntimeErrorCode.INFINITE_CHANGE_DETECTION */, ngDevMode &&
31981
+ 'Changes in afterRender or afterNextRender hooks caused infinite change detection while refresh views.');
31982
+ }
31983
+ const isFirstPass = runs === 0;
31984
+ for (let { _lView, notifyErrorHandler } of this._views) {
31985
+ // When re-checking, only check views which actually need it.
31986
+ if (!isFirstPass && !shouldRecheckView(_lView)) {
31987
+ continue;
31988
+ }
31989
+ this.detectChangesInView(_lView, notifyErrorHandler, isFirstPass);
31990
+ }
31991
+ this.afterRenderEffectManager.execute();
31992
+ runs++;
31993
+ } while (this._views.some(({ _lView }) => shouldRecheckView(_lView)));
31994
+ }
31995
+ detectChangesInView(lView, notifyErrorHandler, isFirstPass) {
31996
+ let mode;
31997
+ if (isFirstPass) {
31998
+ // The first pass is always in Global mode, which includes `CheckAlways` views.
31999
+ mode = 0 /* ChangeDetectionMode.Global */;
32000
+ // Add `RefreshView` flag to ensure this view is refreshed if not already dirty.
32001
+ // `RefreshView` flag is used intentionally over `Dirty` because it gets cleared before
32002
+ // executing any of the actual refresh code while the `Dirty` flag doesn't get cleared
32003
+ // until the end of the refresh. Using `RefreshView` prevents creating a potential
32004
+ // difference in the state of the LViewFlags during template execution.
32005
+ lView[FLAGS] |= 1024 /* LViewFlags.RefreshView */;
32006
+ }
32007
+ else if (lView[FLAGS] & 64 /* LViewFlags.Dirty */) {
32008
+ // The root view has been explicitly marked for check, so check it in Global mode.
32009
+ mode = 0 /* ChangeDetectionMode.Global */;
32010
+ }
32011
+ else {
32012
+ // The view has not been marked for check, but contains a view marked for refresh
32013
+ // (likely via a signal). Start this change detection in Targeted mode to skip the root
32014
+ // view and check just the view(s) that need refreshed.
32015
+ mode = 1 /* ChangeDetectionMode.Targeted */;
32016
+ }
32017
+ detectChangesInternal(lView, notifyErrorHandler, mode);
32018
+ }
31988
32019
  /**
31989
32020
  * Attaches a view so that it will be dirty checked.
31990
32021
  * The view will be automatically detached when it is destroyed.
@@ -32115,6 +32146,12 @@ function whenStable(applicationRef) {
32115
32146
  applicationRef.onDestroy(() => whenStableStore?.delete(applicationRef));
32116
32147
  return whenStablePromise;
32117
32148
  }
32149
+ function shouldRecheckView(view) {
32150
+ return requiresRefreshOrTraversal(view);
32151
+ // TODO(atscott): We need to support rechecking views marked dirty again in afterRender hooks
32152
+ // in order to support the transition to zoneless. b/308152025
32153
+ /* || !!(view[FLAGS] & LViewFlags.Dirty); */
32154
+ }
32118
32155
 
32119
32156
  class NgZoneChangeDetectionScheduler {
32120
32157
  constructor() {