@angular/core 16.0.3 → 16.0.5

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.
package/fesm2022/core.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v16.0.3
2
+ * @license Angular v16.0.5
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { Subject, Subscription, Observable, merge as merge$1 } from 'rxjs';
8
- import { share, first } from 'rxjs/operators';
7
+ import { Subject, Subscription, BehaviorSubject, Observable, merge as merge$1, of } from 'rxjs';
8
+ import { share, switchMap, distinctUntilChanged, first } from 'rxjs/operators';
9
9
 
10
10
  function getClosureSafeProperty(objWithPropertyToExtract) {
11
11
  for (let key in objWithPropertyToExtract) {
@@ -10068,7 +10068,7 @@ class Version {
10068
10068
  /**
10069
10069
  * @publicApi
10070
10070
  */
10071
- const VERSION = new Version('16.0.3');
10071
+ const VERSION = new Version('16.0.5');
10072
10072
 
10073
10073
  // This default value is when checking the hierarchy for a token.
10074
10074
  //
@@ -24839,7 +24839,7 @@ function getStandaloneDefFunctions(type, imports) {
24839
24839
  // Standalone components are always able to self-reference, so include the component's own
24840
24840
  // definition in its `directiveDefs`.
24841
24841
  cachedDirectiveDefs = [getComponentDef(type)];
24842
- const seen = new Set();
24842
+ const seen = new Set([type]);
24843
24843
  for (const rawDep of imports) {
24844
24844
  ngDevMode && verifyStandaloneImport(rawDep, type);
24845
24845
  const dep = resolveForwardRef(rawDep);
@@ -25606,6 +25606,45 @@ var MissingTranslationStrategy;
25606
25606
  MissingTranslationStrategy[MissingTranslationStrategy["Ignore"] = 2] = "Ignore";
25607
25607
  })(MissingTranslationStrategy || (MissingTranslationStrategy = {}));
25608
25608
 
25609
+ /**
25610
+ * *Internal* service that keeps track of pending tasks happening in the system
25611
+ * during the initial rendering. No tasks are tracked after an initial
25612
+ * rendering.
25613
+ *
25614
+ * This information is needed to make sure that the serialization on the server
25615
+ * is delayed until all tasks in the queue (such as an initial navigation or a
25616
+ * pending HTTP request) are completed.
25617
+ */
25618
+ class InitialRenderPendingTasks {
25619
+ constructor() {
25620
+ this.taskId = 0;
25621
+ this.pendingTasks = new Set();
25622
+ this.hasPendingTasks = new BehaviorSubject(false);
25623
+ }
25624
+ add() {
25625
+ this.hasPendingTasks.next(true);
25626
+ const taskId = this.taskId++;
25627
+ this.pendingTasks.add(taskId);
25628
+ return taskId;
25629
+ }
25630
+ remove(taskId) {
25631
+ this.pendingTasks.delete(taskId);
25632
+ if (this.pendingTasks.size === 0) {
25633
+ this.hasPendingTasks.next(false);
25634
+ }
25635
+ }
25636
+ ngOnDestroy() {
25637
+ this.pendingTasks.clear();
25638
+ this.hasPendingTasks.next(false);
25639
+ }
25640
+ static { this.ɵfac = function InitialRenderPendingTasks_Factory(t) { return new (t || InitialRenderPendingTasks)(); }; }
25641
+ static { this.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: InitialRenderPendingTasks, factory: InitialRenderPendingTasks.ɵfac, providedIn: 'root' }); }
25642
+ }
25643
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(InitialRenderPendingTasks, [{
25644
+ type: Injectable,
25645
+ args: [{ providedIn: 'root' }]
25646
+ }], null, null); })();
25647
+
25609
25648
  /**
25610
25649
  * Combination of NgModuleFactory and ComponentFactories.
25611
25650
  *
@@ -27165,6 +27204,7 @@ class ApplicationRef {
27165
27204
  /** @internal */
27166
27205
  this._views = [];
27167
27206
  this.internalErrorHandler = inject(INTERNAL_APPLICATION_ERROR_HANDLER);
27207
+ this.zoneIsStable = inject(ZONE_IS_STABLE_OBSERVABLE);
27168
27208
  /**
27169
27209
  * Get a list of component types registered to this application.
27170
27210
  * This list is populated even before the component is created.
@@ -27177,7 +27217,8 @@ class ApplicationRef {
27177
27217
  /**
27178
27218
  * Returns an Observable that indicates when the application is stable or unstable.
27179
27219
  */
27180
- this.isStable = inject(ZONE_IS_STABLE_OBSERVABLE);
27220
+ this.isStable = inject(InitialRenderPendingTasks)
27221
+ .hasPendingTasks.pipe(switchMap(hasPendingTasks => hasPendingTasks ? of(false) : this.zoneIsStable), distinctUntilChanged(), share());
27181
27222
  this._injector = inject(EnvironmentInjector);
27182
27223
  }
27183
27224
  /**
@@ -29791,69 +29832,6 @@ function isDisconnectedNode(tNode, lView) {
29791
29832
  !unwrapRNode(lView[tNode.index]).isConnected;
29792
29833
  }
29793
29834
 
29794
- /**
29795
- * *Internal* service that keeps track of pending tasks happening in the system
29796
- * during the initial rendering. No tasks are tracked after an initial
29797
- * rendering.
29798
- *
29799
- * This information is needed to make sure that the serialization on the server
29800
- * is delayed until all tasks in the queue (such as an initial navigation or a
29801
- * pending HTTP request) are completed.
29802
- */
29803
- class InitialRenderPendingTasks {
29804
- get whenAllTasksComplete() {
29805
- if (this.collection.size === 0) {
29806
- this.complete();
29807
- }
29808
- return this.promise;
29809
- }
29810
- constructor() {
29811
- this.taskId = 0;
29812
- this.collection = new Set();
29813
- this.ngZone = inject(NgZone);
29814
- this.completed = false;
29815
- // Run outside of the Angular zone to avoid triggering
29816
- // extra change detection cycles.
29817
- this.ngZone.runOutsideAngular(() => {
29818
- this.promise = new Promise((resolve) => {
29819
- this.resolve = resolve;
29820
- });
29821
- });
29822
- }
29823
- add() {
29824
- if (this.completed) {
29825
- // Indicates that the task was added after
29826
- // the task queue completion, so it's a noop.
29827
- return -1;
29828
- }
29829
- const taskId = this.taskId++;
29830
- this.collection.add(taskId);
29831
- return taskId;
29832
- }
29833
- remove(taskId) {
29834
- if (this.completed)
29835
- return;
29836
- this.collection.delete(taskId);
29837
- if (this.collection.size === 0) {
29838
- this.complete();
29839
- }
29840
- }
29841
- ngOnDestroy() {
29842
- this.complete();
29843
- this.collection.clear();
29844
- }
29845
- complete() {
29846
- this.completed = true;
29847
- this.resolve();
29848
- }
29849
- static { this.ɵfac = function InitialRenderPendingTasks_Factory(t) { return new (t || InitialRenderPendingTasks)(); }; }
29850
- static { this.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: InitialRenderPendingTasks, factory: InitialRenderPendingTasks.ɵfac, providedIn: 'root' }); }
29851
- }
29852
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(InitialRenderPendingTasks, [{
29853
- type: Injectable,
29854
- args: [{ providedIn: 'root' }]
29855
- }], function () { return []; }, null); })();
29856
-
29857
29835
  /**
29858
29836
  * Indicates whether the hydration-related code was added,
29859
29837
  * prevents adding it multiple times.
@@ -29912,7 +29890,7 @@ function printHydrationStats(injector) {
29912
29890
  /**
29913
29891
  * Returns a Promise that is resolved when an application becomes stable.
29914
29892
  */
29915
- function whenStable(appRef, pendingTasks, injector) {
29893
+ function whenStable(appRef, injector) {
29916
29894
  const isStablePromise = appRef.isStable.pipe(first((isStable) => isStable)).toPromise();
29917
29895
  if (typeof ngDevMode !== 'undefined' && ngDevMode) {
29918
29896
  const timeoutTime = APPLICATION_IS_STABLE_TIMEOUT;
@@ -29926,8 +29904,7 @@ function whenStable(appRef, pendingTasks, injector) {
29926
29904
  });
29927
29905
  isStablePromise.finally(() => clearTimeout(timeoutId));
29928
29906
  }
29929
- const pendingTasksPromise = pendingTasks.whenAllTasksComplete;
29930
- return Promise.allSettled([isStablePromise, pendingTasksPromise]);
29907
+ return isStablePromise.then(() => { });
29931
29908
  }
29932
29909
  /**
29933
29910
  * Returns a set of providers required to setup hydration support
@@ -29996,10 +29973,9 @@ function withDomHydration() {
29996
29973
  useFactory: () => {
29997
29974
  if (isBrowser() && inject(IS_HYDRATION_DOM_REUSE_ENABLED)) {
29998
29975
  const appRef = inject(ApplicationRef);
29999
- const pendingTasks = inject(InitialRenderPendingTasks);
30000
29976
  const injector = inject(Injector);
30001
29977
  return () => {
30002
- whenStable(appRef, pendingTasks, injector).then(() => {
29978
+ whenStable(appRef, injector).then(() => {
30003
29979
  // Wait until an app becomes stable and cleanup all views that
30004
29980
  // were not claimed during the application bootstrap process.
30005
29981
  // The timing is similar to when we start the serialization process