@angular/core 16.0.0-next.5 → 16.0.0-next.6

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 (53) hide show
  1. package/esm2022/rxjs-interop/index.mjs +9 -0
  2. package/esm2022/rxjs-interop/public_api.mjs +15 -0
  3. package/esm2022/rxjs-interop/rxjs-interop.mjs +5 -0
  4. package/esm2022/rxjs-interop/src/from_observable.mjs +46 -0
  5. package/esm2022/rxjs-interop/src/from_signal.mjs +36 -0
  6. package/esm2022/rxjs-interop/src/index.mjs +11 -0
  7. package/esm2022/rxjs-interop/src/take_until_destroyed.mjs +33 -0
  8. package/esm2022/src/application_ref.mjs +78 -17
  9. package/esm2022/src/core.mjs +2 -2
  10. package/esm2022/src/core_private_export.mjs +2 -2
  11. package/esm2022/src/core_reactivity_export_internal.mjs +1 -1
  12. package/esm2022/src/errors.mjs +3 -2
  13. package/esm2022/src/hydration/api.mjs +35 -2
  14. package/esm2022/src/hydration/cleanup.mjs +11 -19
  15. package/esm2022/src/linker/component_factory.mjs +1 -1
  16. package/esm2022/src/linker/template_ref.mjs +2 -2
  17. package/esm2022/src/linker/view_container_ref.mjs +2 -2
  18. package/esm2022/src/linker/view_ref.mjs +2 -2
  19. package/esm2022/src/render3/component_ref.mjs +13 -6
  20. package/esm2022/src/render3/instructions/element.mjs +2 -1
  21. package/esm2022/src/render3/instructions/element_container.mjs +1 -2
  22. package/esm2022/src/render3/instructions/shared.mjs +13 -10
  23. package/esm2022/src/render3/interfaces/view.mjs +16 -17
  24. package/esm2022/src/render3/ng_module_ref.mjs +9 -7
  25. package/esm2022/src/render3/reactive_lview_consumer.mjs +2 -1
  26. package/esm2022/src/render3/reactivity/effect.mjs +55 -45
  27. package/esm2022/src/sanitization/sanitization.mjs +3 -3
  28. package/esm2022/src/signals/index.mjs +2 -1
  29. package/esm2022/src/signals/src/api.mjs +1 -2
  30. package/esm2022/src/signals/src/computed.mjs +2 -1
  31. package/esm2022/src/signals/src/errors.mjs +18 -0
  32. package/esm2022/src/signals/src/graph.mjs +32 -8
  33. package/esm2022/src/signals/src/signal.mjs +12 -1
  34. package/esm2022/src/signals/src/watch.mjs +3 -2
  35. package/esm2022/src/util/ng_dev_mode.mjs +2 -1
  36. package/esm2022/src/version.mjs +1 -1
  37. package/esm2022/testing/src/logger.mjs +3 -3
  38. package/esm2022/testing/src/ng_zone_mock.mjs +3 -3
  39. package/esm2022/testing/src/test_bed_compiler.mjs +3 -4
  40. package/fesm2022/core.mjs +1077 -926
  41. package/fesm2022/core.mjs.map +1 -1
  42. package/fesm2022/rxjs-interop.mjs +104 -0
  43. package/fesm2022/rxjs-interop.mjs.map +1 -0
  44. package/fesm2022/testing.mjs +524 -69
  45. package/fesm2022/testing.mjs.map +1 -1
  46. package/index.d.ts +142 -41
  47. package/package.json +7 -1
  48. package/rxjs-interop/index.d.ts +95 -0
  49. package/schematics/migrations/guard-and-resolve-interfaces/bundle.js +13 -13
  50. package/schematics/migrations/remove-module-id/bundle.js +14 -14
  51. package/schematics/ng-generate/standalone-migration/bundle.js +319 -319
  52. package/schematics/ng-generate/standalone-migration/bundle.js.map +1 -1
  53. package/testing/index.d.ts +1 -1
package/fesm2022/core.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.5
2
+ * @license Angular v16.0.0-next.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import { Subject, Subscription, Observable, merge as merge$1 } from 'rxjs';
8
- import { first, share } from 'rxjs/operators';
8
+ import { share, first } from 'rxjs/operators';
9
9
 
10
10
  function getClosureSafeProperty(objWithPropertyToExtract) {
11
11
  for (let key in objWithPropertyToExtract) {
@@ -138,7 +138,8 @@ const XSS_SECURITY_URL = 'https://g.co/ng/security#xss';
138
138
  *
139
139
  * Note: the `message` argument contains a descriptive error message as a string in development
140
140
  * mode (when the `ngDevMode` is defined). In production mode (after tree-shaking pass), the
141
- * `message` argument becomes `false`, thus we account for it in the typings and the runtime logic.
141
+ * `message` argument becomes `false`, thus we account for it in the typings and the runtime
142
+ * logic.
142
143
  */
143
144
  class RuntimeError extends Error {
144
145
  constructor(code, message) {
@@ -559,6 +560,7 @@ function ngDevModeResetPerfCounters() {
559
560
  hydratedComponents: 0,
560
561
  dehydratedViewsRemoved: 0,
561
562
  dehydratedViewsCleanupRuns: 0,
563
+ componentsSkippedHydration: 0,
562
564
  };
563
565
  // Make sure to refer to ngDevMode as ['ngDevMode'] for closure.
564
566
  const allowNgDevModeTrue = locationString.indexOf('ngDevMode=false') === -1;
@@ -1959,23 +1961,22 @@ const T_HOST = 6;
1959
1961
  const CLEANUP = 7;
1960
1962
  const CONTEXT = 8;
1961
1963
  const INJECTOR$1 = 9;
1962
- const RENDERER_FACTORY = 10;
1964
+ const ENVIRONMENT = 10;
1963
1965
  const RENDERER = 11;
1964
- const SANITIZER = 12;
1965
- const CHILD_HEAD = 13;
1966
- const CHILD_TAIL = 14;
1966
+ const CHILD_HEAD = 12;
1967
+ const CHILD_TAIL = 13;
1967
1968
  // FIXME(misko): Investigate if the three declarations aren't all same thing.
1968
- const DECLARATION_VIEW = 15;
1969
- const DECLARATION_COMPONENT_VIEW = 16;
1970
- const DECLARATION_LCONTAINER = 17;
1971
- const PREORDER_HOOK_FLAGS = 18;
1972
- const QUERIES = 19;
1973
- const ID = 20;
1974
- const EMBEDDED_VIEW_INJECTOR = 21;
1975
- const ON_DESTROY_HOOKS = 22;
1976
- const HYDRATION = 23;
1977
- const REACTIVE_TEMPLATE_CONSUMER = 24;
1978
- const REACTIVE_HOST_BINDING_CONSUMER = 25;
1969
+ const DECLARATION_VIEW = 14;
1970
+ const DECLARATION_COMPONENT_VIEW = 15;
1971
+ const DECLARATION_LCONTAINER = 16;
1972
+ const PREORDER_HOOK_FLAGS = 17;
1973
+ const QUERIES = 18;
1974
+ const ID = 19;
1975
+ const EMBEDDED_VIEW_INJECTOR = 20;
1976
+ const ON_DESTROY_HOOKS = 21;
1977
+ const HYDRATION = 22;
1978
+ const REACTIVE_TEMPLATE_CONSUMER = 23;
1979
+ const REACTIVE_HOST_BINDING_CONSUMER = 24;
1979
1980
  /**
1980
1981
  * Size of LView's header. Necessary to adjust for it when setting slots.
1981
1982
  *
@@ -1983,7 +1984,7 @@ const REACTIVE_HOST_BINDING_CONSUMER = 25;
1983
1984
  * instruction index into `LView` index. All other indexes should be in the `LView` index space and
1984
1985
  * there should be no need to refer to `HEADER_OFFSET` anywhere else.
1985
1986
  */
1986
- const HEADER_OFFSET = 26;
1987
+ const HEADER_OFFSET = 25;
1987
1988
  // Note: This hack is necessary so we don't erroneously get a circular dependency
1988
1989
  // failure based on types.
1989
1990
  const unusedValueExportToPlacateAjd$4 = 1;
@@ -7959,7 +7960,7 @@ function validateAgainstEventAttributes(name) {
7959
7960
  }
7960
7961
  function getSanitizer() {
7961
7962
  const lView = getLView();
7962
- return lView && lView[SANITIZER];
7963
+ return lView && lView[ENVIRONMENT].sanitizer;
7963
7964
  }
7964
7965
 
7965
7966
  /**
@@ -9390,7 +9391,7 @@ class Version {
9390
9391
  /**
9391
9392
  * @publicApi
9392
9393
  */
9393
- const VERSION = new Version('16.0.0-next.5');
9394
+ const VERSION = new Version('16.0.0-next.6');
9394
9395
 
9395
9396
  // This default value is when checking the hierarchy for a token.
9396
9397
  //
@@ -9677,6 +9678,10 @@ let _nextReactiveId = 0;
9677
9678
  * consumer).
9678
9679
  */
9679
9680
  let activeConsumer = null;
9681
+ /**
9682
+ * Whether the graph is currently propagating change notifications.
9683
+ */
9684
+ let inNotificationPhase = false;
9680
9685
  function setActiveConsumer(consumer) {
9681
9686
  const prev = activeConsumer;
9682
9687
  activeConsumer = consumer;
@@ -9767,20 +9772,33 @@ class ReactiveNode {
9767
9772
  * Notify all consumers of this producer that its value may have changed.
9768
9773
  */
9769
9774
  producerMayHaveChanged() {
9770
- for (const [consumerId, edge] of this.consumers) {
9771
- const consumer = edge.consumerNode.deref();
9772
- if (consumer === undefined || consumer.trackingVersion !== edge.atTrackingVersion) {
9773
- this.consumers.delete(consumerId);
9774
- consumer?.producers.delete(this.id);
9775
- continue;
9775
+ // Prevent signal reads when we're updating the graph
9776
+ const prev = inNotificationPhase;
9777
+ inNotificationPhase = true;
9778
+ try {
9779
+ for (const [consumerId, edge] of this.consumers) {
9780
+ const consumer = edge.consumerNode.deref();
9781
+ if (consumer === undefined || consumer.trackingVersion !== edge.atTrackingVersion) {
9782
+ this.consumers.delete(consumerId);
9783
+ consumer?.producers.delete(this.id);
9784
+ continue;
9785
+ }
9786
+ consumer.onConsumerDependencyMayHaveChanged();
9776
9787
  }
9777
- consumer.onConsumerDependencyMayHaveChanged();
9788
+ }
9789
+ finally {
9790
+ inNotificationPhase = prev;
9778
9791
  }
9779
9792
  }
9780
9793
  /**
9781
9794
  * Mark that this producer node has been accessed in the current reactive context.
9782
9795
  */
9783
9796
  producerAccessed() {
9797
+ if (inNotificationPhase) {
9798
+ throw new Error(typeof ngDevMode !== 'undefined' && ngDevMode ?
9799
+ `Assertion error: signal read during notification phase` :
9800
+ '');
9801
+ }
9784
9802
  if (activeConsumer === null) {
9785
9803
  return;
9786
9804
  }
@@ -9807,6 +9825,13 @@ class ReactiveNode {
9807
9825
  get hasProducers() {
9808
9826
  return this.producers.size > 0;
9809
9827
  }
9828
+ /**
9829
+ * Whether this `ReactiveNode` in its producer capacity is currently allowed to initiate updates,
9830
+ * based on the current consumer context.
9831
+ */
9832
+ get producerUpdatesAllowed() {
9833
+ return activeConsumer?.consumerAllowSignalWrites !== false;
9834
+ }
9810
9835
  /**
9811
9836
  * Checks if a `Producer` has a current value which is different than the value
9812
9837
  * last seen at a specific version by a `Consumer` which recorded a dependency on
@@ -9854,6 +9879,7 @@ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
9854
9879
  class ReactiveLViewConsumer extends ReactiveNode {
9855
9880
  constructor() {
9856
9881
  super(...arguments);
9882
+ this.consumerAllowSignalWrites = false;
9857
9883
  this._lView = null;
9858
9884
  }
9859
9885
  set lView(lView) {
@@ -11077,7 +11103,7 @@ function renderChildComponents(hostLView, components) {
11077
11103
  renderComponent(hostLView, components[i]);
11078
11104
  }
11079
11105
  }
11080
- function createLView(parentLView, tView, context, flags, host, tHostNode, rendererFactory, renderer, sanitizer, injector, embeddedViewInjector, hydrationInfo) {
11106
+ function createLView(parentLView, tView, context, flags, host, tHostNode, environment, renderer, injector, embeddedViewInjector, hydrationInfo) {
11081
11107
  const lView = tView.blueprint.slice();
11082
11108
  lView[HOST] = host;
11083
11109
  lView[FLAGS] = flags | 4 /* LViewFlags.CreationMode */ | 64 /* LViewFlags.Attached */ | 8 /* LViewFlags.FirstLViewPass */;
@@ -11089,11 +11115,10 @@ function createLView(parentLView, tView, context, flags, host, tHostNode, render
11089
11115
  ngDevMode && tView.declTNode && parentLView && assertTNodeForLView(tView.declTNode, parentLView);
11090
11116
  lView[PARENT] = lView[DECLARATION_VIEW] = parentLView;
11091
11117
  lView[CONTEXT] = context;
11092
- lView[RENDERER_FACTORY] = (rendererFactory || parentLView && parentLView[RENDERER_FACTORY]);
11093
- ngDevMode && assertDefined(lView[RENDERER_FACTORY], 'RendererFactory is required');
11118
+ lView[ENVIRONMENT] = (environment || parentLView && parentLView[ENVIRONMENT]);
11119
+ ngDevMode && assertDefined(lView[ENVIRONMENT], 'LViewEnvironment is required');
11094
11120
  lView[RENDERER] = (renderer || parentLView && parentLView[RENDERER]);
11095
11121
  ngDevMode && assertDefined(lView[RENDERER], 'Renderer is required');
11096
- lView[SANITIZER] = sanitizer || parentLView && parentLView[SANITIZER] || null;
11097
11122
  lView[INJECTOR$1] = injector || parentLView && parentLView[INJECTOR$1] || null;
11098
11123
  lView[T_HOST] = tHostNode;
11099
11124
  lView[ID] = getUniqueLViewId();
@@ -11272,10 +11297,11 @@ function refreshView(tView, lView, templateFn, context) {
11272
11297
  const flags = lView[FLAGS];
11273
11298
  if ((flags & 128 /* LViewFlags.Destroyed */) === 128 /* LViewFlags.Destroyed */)
11274
11299
  return;
11275
- enterView(lView);
11276
11300
  // Check no changes mode is a dev only mode used to verify that bindings have not changed
11277
11301
  // since they were assigned. We do not want to execute lifecycle hooks in that mode.
11278
11302
  const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode();
11303
+ !isInCheckNoChangesPass && lView[ENVIRONMENT].effectManager?.flush();
11304
+ enterView(lView);
11279
11305
  try {
11280
11306
  resetPreOrderHookFlags(lView);
11281
11307
  setBindingIndex(tView.bindingStartIndex);
@@ -12191,8 +12217,8 @@ function addComponentLogic(lView, hostTNode, def) {
12191
12217
  const tView = getOrCreateComponentTView(def);
12192
12218
  // Only component views should be added to the view tree directly. Embedded views are
12193
12219
  // accessed through their containers because they may be removed / re-added later.
12194
- const rendererFactory = lView[RENDERER_FACTORY];
12195
- const componentView = addToViewTree(lView, createLView(lView, tView, null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, native, hostTNode, rendererFactory, rendererFactory.createRenderer(native, def), null, null, null, null));
12220
+ const rendererFactory = lView[ENVIRONMENT].rendererFactory;
12221
+ const componentView = addToViewTree(lView, createLView(lView, tView, null, def.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, native, hostTNode, null, rendererFactory.createRenderer(native, def), null, null, null));
12196
12222
  // Component view will always be created before any injected LContainers,
12197
12223
  // so this is a regular element, wrap it with the component view
12198
12224
  lView[hostTNode.index] = componentView;
@@ -12506,7 +12532,7 @@ function addToViewTree(lView, lViewOrLContainer) {
12506
12532
  //// Change detection
12507
12533
  ///////////////////////////////
12508
12534
  function detectChangesInternal(tView, lView, context, notifyErrorHandler = true) {
12509
- const rendererFactory = lView[RENDERER_FACTORY];
12535
+ const rendererFactory = lView[ENVIRONMENT].rendererFactory;
12510
12536
  // Check no changes mode is a dev only mode used to verify that bindings have not changed
12511
12537
  // since they were assigned. We do not want to invoke renderer factory functions in that mode
12512
12538
  // to avoid any possible side-effects.
@@ -12525,6 +12551,9 @@ function detectChangesInternal(tView, lView, context, notifyErrorHandler = true)
12525
12551
  finally {
12526
12552
  if (!checkNoChangesMode && rendererFactory.end)
12527
12553
  rendererFactory.end();
12554
+ // One final flush of the effects queue to catch any effects created in `ngAfterViewInit` or
12555
+ // other post-order hooks.
12556
+ !checkNoChangesMode && lView[ENVIRONMENT].effectManager?.flush();
12528
12557
  }
12529
12558
  }
12530
12559
  function checkNoChangesInternal(tView, lView, context, notifyErrorHandler = true) {
@@ -12648,244 +12677,671 @@ function textBindingInternal(lView, index, value) {
12648
12677
  }
12649
12678
 
12650
12679
  /**
12651
- * Compute the static styling (class/style) from `TAttributes`.
12652
- *
12653
- * This function should be called during `firstCreatePass` only.
12680
+ * `DestroyRef` lets you set callbacks to run for any cleanup or destruction behavior.
12681
+ * The scope of this destruction depends on where `DestroyRef` is injected. If `DestroyRef`
12682
+ * is injected in a component or directive, the callbacks run when that component or
12683
+ * directive is destroyed. Otherwise the callbacks run when a corresponding injector is destroyed.
12654
12684
  *
12655
- * @param tNode The `TNode` into which the styling information should be loaded.
12656
- * @param attrs `TAttributes` containing the styling information.
12657
- * @param writeToHost Where should the resulting static styles be written?
12658
- * - `false` Write to `TNode.stylesWithoutHost` / `TNode.classesWithoutHost`
12659
- * - `true` Write to `TNode.styles` / `TNode.classes`
12685
+ * @publicApi
12660
12686
  */
12661
- function computeStaticStyling(tNode, attrs, writeToHost) {
12662
- ngDevMode &&
12663
- assertFirstCreatePass(getTView(), 'Expecting to be called in first template pass only');
12664
- let styles = writeToHost ? tNode.styles : null;
12665
- let classes = writeToHost ? tNode.classes : null;
12666
- let mode = 0;
12667
- if (attrs !== null) {
12668
- for (let i = 0; i < attrs.length; i++) {
12669
- const value = attrs[i];
12670
- if (typeof value === 'number') {
12671
- mode = value;
12672
- }
12673
- else if (mode == 1 /* AttributeMarker.Classes */) {
12674
- classes = concatStringsWithSpace(classes, value);
12675
- }
12676
- else if (mode == 2 /* AttributeMarker.Styles */) {
12677
- const style = value;
12678
- const styleValue = attrs[++i];
12679
- styles = concatStringsWithSpace(styles, style + ': ' + styleValue + ';');
12680
- }
12681
- }
12682
- }
12683
- writeToHost ? tNode.styles = styles : tNode.stylesWithoutHost = styles;
12684
- writeToHost ? tNode.classes = classes : tNode.classesWithoutHost = classes;
12685
- }
12686
-
12687
- function collectNativeNodes(tView, lView, tNode, result, isProjection = false) {
12688
- while (tNode !== null) {
12689
- ngDevMode &&
12690
- assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */ | 12 /* TNodeType.AnyContainer */ | 16 /* TNodeType.Projection */ | 32 /* TNodeType.Icu */);
12691
- const lNode = lView[tNode.index];
12692
- if (lNode !== null) {
12693
- result.push(unwrapRNode(lNode));
12694
- }
12695
- // A given lNode can represent either a native node or a LContainer (when it is a host of a
12696
- // ViewContainerRef). When we find a LContainer we need to descend into it to collect root nodes
12697
- // from the views in this container.
12698
- if (isLContainer(lNode)) {
12699
- for (let i = CONTAINER_HEADER_OFFSET; i < lNode.length; i++) {
12700
- const lViewInAContainer = lNode[i];
12701
- const lViewFirstChildTNode = lViewInAContainer[TVIEW].firstChild;
12702
- if (lViewFirstChildTNode !== null) {
12703
- collectNativeNodes(lViewInAContainer[TVIEW], lViewInAContainer, lViewFirstChildTNode, result);
12704
- }
12705
- }
12706
- }
12707
- const tNodeType = tNode.type;
12708
- if (tNodeType & 8 /* TNodeType.ElementContainer */) {
12709
- collectNativeNodes(tView, lView, tNode.child, result);
12710
- }
12711
- else if (tNodeType & 32 /* TNodeType.Icu */) {
12712
- const nextRNode = icuContainerIterate(tNode, lView);
12713
- let rNode;
12714
- while (rNode = nextRNode()) {
12715
- result.push(rNode);
12716
- }
12717
- }
12718
- else if (tNodeType & 16 /* TNodeType.Projection */) {
12719
- const nodesInSlot = getProjectionNodes(lView, tNode);
12720
- if (Array.isArray(nodesInSlot)) {
12721
- result.push(...nodesInSlot);
12722
- }
12723
- else {
12724
- const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]);
12725
- ngDevMode && assertParentView(parentView);
12726
- collectNativeNodes(parentView[TVIEW], parentView, nodesInSlot, result, true);
12727
- }
12728
- }
12729
- tNode = isProjection ? tNode.projectionNext : tNode.next;
12730
- }
12731
- return result;
12732
- }
12733
-
12734
- class ViewRef$1 {
12735
- get rootNodes() {
12736
- const lView = this._lView;
12737
- const tView = lView[TVIEW];
12738
- return collectNativeNodes(tView, lView, tView.firstChild, []);
12739
- }
12740
- constructor(
12687
+ class DestroyRef {
12741
12688
  /**
12742
- * This represents `LView` associated with the component when ViewRef is a ChangeDetectorRef.
12743
- *
12744
- * When ViewRef is created for a dynamic component, this also represents the `LView` for the
12745
- * component.
12746
- *
12747
- * For a "regular" ViewRef created for an embedded view, this is the `LView` for the embedded
12748
- * view.
12749
- *
12750
12689
  * @internal
12690
+ * @nocollapse
12751
12691
  */
12752
- _lView,
12692
+ static { this.__NG_ELEMENT_ID__ = injectDestroyRef; }
12753
12693
  /**
12754
- * This represents the `LView` associated with the point where `ChangeDetectorRef` was
12755
- * requested.
12756
- *
12757
- * This may be different from `_lView` if the `_cdRefInjectingView` is an embedded view.
12694
+ * @internal
12695
+ * @nocollapse
12758
12696
  */
12759
- _cdRefInjectingView) {
12697
+ static { this.__NG_ENV_ID__ = (injector) => injector; }
12698
+ }
12699
+ class NodeInjectorDestroyRef extends DestroyRef {
12700
+ constructor(_lView) {
12701
+ super();
12760
12702
  this._lView = _lView;
12761
- this._cdRefInjectingView = _cdRefInjectingView;
12762
- this._appRef = null;
12763
- this._attachedToViewContainer = false;
12764
- }
12765
- get context() {
12766
- return this._lView[CONTEXT];
12767
- }
12768
- set context(value) {
12769
- this._lView[CONTEXT] = value;
12770
- }
12771
- get destroyed() {
12772
- return (this._lView[FLAGS] & 128 /* LViewFlags.Destroyed */) === 128 /* LViewFlags.Destroyed */;
12773
- }
12774
- destroy() {
12775
- if (this._appRef) {
12776
- this._appRef.detachView(this);
12777
- }
12778
- else if (this._attachedToViewContainer) {
12779
- const parent = this._lView[PARENT];
12780
- if (isLContainer(parent)) {
12781
- const viewRefs = parent[VIEW_REFS];
12782
- const index = viewRefs ? viewRefs.indexOf(this) : -1;
12783
- if (index > -1) {
12784
- ngDevMode &&
12785
- assertEqual(index, parent.indexOf(this._lView) - CONTAINER_HEADER_OFFSET, 'An attached view should be in the same position within its container as its ViewRef in the VIEW_REFS array.');
12786
- detachView(parent, index);
12787
- removeFromArray(viewRefs, index);
12788
- }
12789
- }
12790
- this._attachedToViewContainer = false;
12791
- }
12792
- destroyLView(this._lView[TVIEW], this._lView);
12793
12703
  }
12794
12704
  onDestroy(callback) {
12795
12705
  storeLViewOnDestroy(this._lView, callback);
12706
+ return () => removeLViewOnDestroy(this._lView, callback);
12796
12707
  }
12797
- /**
12798
- * Marks a view and all of its ancestors dirty.
12799
- *
12800
- * This can be used to ensure an {@link ChangeDetectionStrategy#OnPush OnPush} component is
12801
- * checked when it needs to be re-rendered but the two normal triggers haven't marked it
12802
- * dirty (i.e. inputs haven't changed and events haven't fired in the view).
12803
- *
12804
- * <!-- TODO: Add a link to a chapter on OnPush components -->
12805
- *
12806
- * @usageNotes
12807
- * ### Example
12808
- *
12809
- * ```typescript
12810
- * @Component({
12811
- * selector: 'app-root',
12812
- * template: `Number of ticks: {{numberOfTicks}}`
12813
- * changeDetection: ChangeDetectionStrategy.OnPush,
12814
- * })
12815
- * class AppComponent {
12816
- * numberOfTicks = 0;
12817
- *
12818
- * constructor(private ref: ChangeDetectorRef) {
12819
- * setInterval(() => {
12820
- * this.numberOfTicks++;
12821
- * // the following is required, otherwise the view will not be updated
12822
- * this.ref.markForCheck();
12823
- * }, 1000);
12824
- * }
12825
- * }
12826
- * ```
12827
- */
12828
- markForCheck() {
12829
- markViewDirty(this._cdRefInjectingView || this._lView);
12830
- }
12831
- /**
12832
- * Detaches the view from the change detection tree.
12833
- *
12834
- * Detached views will not be checked during change detection runs until they are
12835
- * re-attached, even if they are dirty. `detach` can be used in combination with
12836
- * {@link ChangeDetectorRef#detectChanges detectChanges} to implement local change
12837
- * detection checks.
12838
- *
12839
- * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
12840
- * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
12841
- *
12842
- * @usageNotes
12843
- * ### Example
12844
- *
12845
- * The following example defines a component with a large list of readonly data.
12846
- * Imagine the data changes constantly, many times per second. For performance reasons,
12847
- * we want to check and update the list every five seconds. We can do that by detaching
12848
- * the component's change detector and doing a local check every five seconds.
12849
- *
12850
- * ```typescript
12851
- * class DataProvider {
12852
- * // in a real application the returned data will be different every time
12853
- * get data() {
12854
- * return [1,2,3,4,5];
12855
- * }
12856
- * }
12857
- *
12858
- * @Component({
12859
- * selector: 'giant-list',
12860
- * template: `
12861
- * <li *ngFor="let d of dataProvider.data">Data {{d}}</li>
12862
- * `,
12863
- * })
12864
- * class GiantList {
12865
- * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {
12866
- * ref.detach();
12867
- * setInterval(() => {
12868
- * this.ref.detectChanges();
12869
- * }, 5000);
12870
- * }
12871
- * }
12872
- *
12873
- * @Component({
12874
- * selector: 'app',
12875
- * providers: [DataProvider],
12876
- * template: `
12877
- * <giant-list><giant-list>
12878
- * `,
12879
- * })
12880
- * class App {
12881
- * }
12882
- * ```
12883
- */
12884
- detach() {
12885
- this._lView[FLAGS] &= ~64 /* LViewFlags.Attached */;
12886
- }
12887
- /**
12888
- * Re-attaches a view to the change detection tree.
12708
+ }
12709
+ function injectDestroyRef() {
12710
+ return new NodeInjectorDestroyRef(getLView());
12711
+ }
12712
+
12713
+ /**
12714
+ * Symbol used to tell `Signal`s apart from other functions.
12715
+ *
12716
+ * This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.
12717
+ */
12718
+ const SIGNAL = Symbol('SIGNAL');
12719
+ /**
12720
+ * Checks if the given `value` function is a reactive `Signal`.
12721
+ */
12722
+ function isSignal(value) {
12723
+ return value[SIGNAL] !== undefined;
12724
+ }
12725
+ /**
12726
+ * Converts `fn` into a marked signal function (where `isSignal(fn)` will be `true`), and
12727
+ * potentially add some set of extra properties (passed as an object record `extraApi`).
12728
+ */
12729
+ function createSignalFromFunction(node, fn, extraApi = {}) {
12730
+ fn[SIGNAL] = node;
12731
+ // Copy properties from `extraApi` to `fn` to complete the desired API of the `Signal`.
12732
+ return Object.assign(fn, extraApi);
12733
+ }
12734
+ /**
12735
+ * The default equality function used for `signal` and `computed`, which treats objects and arrays
12736
+ * as never equal, and all other primitive values using identity semantics.
12737
+ *
12738
+ * This allows signals to hold non-primitive values (arrays, objects, other collections) and still
12739
+ * propagate change notification upon explicit mutation without identity change.
12740
+ *
12741
+ * @developerPreview
12742
+ */
12743
+ function defaultEquals(a, b) {
12744
+ // `Object.is` compares two values using identity semantics which is desired behavior for
12745
+ // primitive values. If `Object.is` determines two values to be equal we need to make sure that
12746
+ // those don't represent objects (we want to make sure that 2 objects are always considered
12747
+ // "unequal"). The null check is needed for the special case of JavaScript reporting null values
12748
+ // as objects (`typeof null === 'object'`).
12749
+ return (a === null || typeof a !== 'object') && Object.is(a, b);
12750
+ }
12751
+
12752
+ /**
12753
+ * Create a computed `Signal` which derives a reactive value from an expression.
12754
+ *
12755
+ * @developerPreview
12756
+ */
12757
+ function computed(computation, options) {
12758
+ const node = new ComputedImpl(computation, options?.equal ?? defaultEquals);
12759
+ // Casting here is required for g3, as TS inference behavior is slightly different between our
12760
+ // version/options and g3's.
12761
+ return createSignalFromFunction(node, node.signal.bind(node));
12762
+ }
12763
+ /**
12764
+ * A dedicated symbol used before a computed value has been calculated for the first time.
12765
+ * Explicitly typed as `any` so we can use it as signal's value.
12766
+ */
12767
+ const UNSET = Symbol('UNSET');
12768
+ /**
12769
+ * A dedicated symbol used in place of a computed signal value to indicate that a given computation
12770
+ * is in progress. Used to detect cycles in computation chains.
12771
+ * Explicitly typed as `any` so we can use it as signal's value.
12772
+ */
12773
+ const COMPUTING = Symbol('COMPUTING');
12774
+ /**
12775
+ * A dedicated symbol used in place of a computed signal value to indicate that a given computation
12776
+ * failed. The thrown error is cached until the computation gets dirty again.
12777
+ * Explicitly typed as `any` so we can use it as signal's value.
12778
+ */
12779
+ const ERRORED = Symbol('ERRORED');
12780
+ /**
12781
+ * A computation, which derives a value from a declarative reactive expression.
12782
+ *
12783
+ * `Computed`s are both producers and consumers of reactivity.
12784
+ */
12785
+ class ComputedImpl extends ReactiveNode {
12786
+ constructor(computation, equal) {
12787
+ super();
12788
+ this.computation = computation;
12789
+ this.equal = equal;
12790
+ /**
12791
+ * Current value of the computation.
12792
+ *
12793
+ * This can also be one of the special values `UNSET`, `COMPUTING`, or `ERRORED`.
12794
+ */
12795
+ this.value = UNSET;
12796
+ /**
12797
+ * If `value` is `ERRORED`, the error caught from the last computation attempt which will
12798
+ * be re-thrown.
12799
+ */
12800
+ this.error = null;
12801
+ /**
12802
+ * Flag indicating that the computation is currently stale, meaning that one of the
12803
+ * dependencies has notified of a potential change.
12804
+ *
12805
+ * It's possible that no dependency has _actually_ changed, in which case the `stale`
12806
+ * state can be resolved without recomputing the value.
12807
+ */
12808
+ this.stale = true;
12809
+ this.consumerAllowSignalWrites = false;
12810
+ }
12811
+ onConsumerDependencyMayHaveChanged() {
12812
+ if (this.stale) {
12813
+ // We've already notified consumers that this value has potentially changed.
12814
+ return;
12815
+ }
12816
+ // Record that the currently cached value may be stale.
12817
+ this.stale = true;
12818
+ // Notify any consumers about the potential change.
12819
+ this.producerMayHaveChanged();
12820
+ }
12821
+ onProducerUpdateValueVersion() {
12822
+ if (!this.stale) {
12823
+ // The current value and its version are already up to date.
12824
+ return;
12825
+ }
12826
+ // The current value is stale. Check whether we need to produce a new one.
12827
+ if (this.value !== UNSET && this.value !== COMPUTING &&
12828
+ !this.consumerPollProducersForChange()) {
12829
+ // Even though we were previously notified of a potential dependency update, all of
12830
+ // our dependencies report that they have not actually changed in value, so we can
12831
+ // resolve the stale state without needing to recompute the current value.
12832
+ this.stale = false;
12833
+ return;
12834
+ }
12835
+ // The current value is stale, and needs to be recomputed. It still may not change -
12836
+ // that depends on whether the newly computed value is equal to the old.
12837
+ this.recomputeValue();
12838
+ }
12839
+ recomputeValue() {
12840
+ if (this.value === COMPUTING) {
12841
+ // Our computation somehow led to a cyclic read of itself.
12842
+ throw new Error('Detected cycle in computations.');
12843
+ }
12844
+ const oldValue = this.value;
12845
+ this.value = COMPUTING;
12846
+ // As we're re-running the computation, update our dependent tracking version number.
12847
+ this.trackingVersion++;
12848
+ const prevConsumer = setActiveConsumer(this);
12849
+ let newValue;
12850
+ try {
12851
+ newValue = this.computation();
12852
+ }
12853
+ catch (err) {
12854
+ newValue = ERRORED;
12855
+ this.error = err;
12856
+ }
12857
+ finally {
12858
+ setActiveConsumer(prevConsumer);
12859
+ }
12860
+ this.stale = false;
12861
+ if (oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED &&
12862
+ this.equal(oldValue, newValue)) {
12863
+ // No change to `valueVersion` - old and new values are
12864
+ // semantically equivalent.
12865
+ this.value = oldValue;
12866
+ return;
12867
+ }
12868
+ this.value = newValue;
12869
+ this.valueVersion++;
12870
+ }
12871
+ signal() {
12872
+ // Check if the value needs updating before returning it.
12873
+ this.onProducerUpdateValueVersion();
12874
+ // Record that someone looked at this signal.
12875
+ this.producerAccessed();
12876
+ if (this.value === ERRORED) {
12877
+ throw this.error;
12878
+ }
12879
+ return this.value;
12880
+ }
12881
+ }
12882
+
12883
+ function defaultThrowError() {
12884
+ throw new Error();
12885
+ }
12886
+ let throwInvalidWriteToSignalErrorFn = defaultThrowError;
12887
+ function throwInvalidWriteToSignalError() {
12888
+ throwInvalidWriteToSignalErrorFn();
12889
+ }
12890
+ function setThrowInvalidWriteToSignalError(fn) {
12891
+ throwInvalidWriteToSignalErrorFn = fn;
12892
+ }
12893
+
12894
+ class WritableSignalImpl extends ReactiveNode {
12895
+ constructor(value, equal) {
12896
+ super();
12897
+ this.value = value;
12898
+ this.equal = equal;
12899
+ this.consumerAllowSignalWrites = false;
12900
+ }
12901
+ onConsumerDependencyMayHaveChanged() {
12902
+ // This never happens for writable signals as they're not consumers.
12903
+ }
12904
+ onProducerUpdateValueVersion() {
12905
+ // Writable signal value versions are always up to date.
12906
+ }
12907
+ /**
12908
+ * Directly update the value of the signal to a new value, which may or may not be
12909
+ * equal to the previous.
12910
+ *
12911
+ * In the event that `newValue` is semantically equal to the current value, `set` is
12912
+ * a no-op.
12913
+ */
12914
+ set(newValue) {
12915
+ if (!this.producerUpdatesAllowed) {
12916
+ throwInvalidWriteToSignalError();
12917
+ }
12918
+ if (!this.equal(this.value, newValue)) {
12919
+ this.value = newValue;
12920
+ this.valueVersion++;
12921
+ this.producerMayHaveChanged();
12922
+ }
12923
+ }
12924
+ /**
12925
+ * Derive a new value for the signal from its current value using the `updater` function.
12926
+ *
12927
+ * This is equivalent to calling `set` on the result of running `updater` on the current
12928
+ * value.
12929
+ */
12930
+ update(updater) {
12931
+ if (!this.producerUpdatesAllowed) {
12932
+ throwInvalidWriteToSignalError();
12933
+ }
12934
+ this.set(updater(this.value));
12935
+ }
12936
+ /**
12937
+ * Calls `mutator` on the current value and assumes that it has been mutated.
12938
+ */
12939
+ mutate(mutator) {
12940
+ if (!this.producerUpdatesAllowed) {
12941
+ throwInvalidWriteToSignalError();
12942
+ }
12943
+ // Mutate bypasses equality checks as it's by definition changing the value.
12944
+ mutator(this.value);
12945
+ this.valueVersion++;
12946
+ this.producerMayHaveChanged();
12947
+ }
12948
+ signal() {
12949
+ this.producerAccessed();
12950
+ return this.value;
12951
+ }
12952
+ }
12953
+ /**
12954
+ * Create a `Signal` that can be set or updated directly.
12955
+ *
12956
+ * @developerPreview
12957
+ */
12958
+ function signal(initialValue, options) {
12959
+ const signalNode = new WritableSignalImpl(initialValue, options?.equal ?? defaultEquals);
12960
+ // Casting here is required for g3, as TS inference behavior is slightly different between our
12961
+ // version/options and g3's.
12962
+ const signalFn = createSignalFromFunction(signalNode, signalNode.signal.bind(signalNode), {
12963
+ set: signalNode.set.bind(signalNode),
12964
+ update: signalNode.update.bind(signalNode),
12965
+ mutate: signalNode.mutate.bind(signalNode),
12966
+ });
12967
+ return signalFn;
12968
+ }
12969
+
12970
+ /**
12971
+ * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function
12972
+ * can, optionally, return a value.
12973
+ *
12974
+ * @developerPreview
12975
+ */
12976
+ function untracked(nonReactiveReadsFn) {
12977
+ const prevConsumer = setActiveConsumer(null);
12978
+ // We are not trying to catch any particular errors here, just making sure that the consumers
12979
+ // stack is restored in case of errors.
12980
+ try {
12981
+ return nonReactiveReadsFn();
12982
+ }
12983
+ finally {
12984
+ setActiveConsumer(prevConsumer);
12985
+ }
12986
+ }
12987
+
12988
+ const NOOP_CLEANUP_FN = () => { };
12989
+ /**
12990
+ * Watches a reactive expression and allows it to be scheduled to re-run
12991
+ * when any dependencies notify of a change.
12992
+ *
12993
+ * `Watch` doesn't run reactive expressions itself, but relies on a consumer-
12994
+ * provided scheduling operation to coordinate calling `Watch.run()`.
12995
+ */
12996
+ class Watch extends ReactiveNode {
12997
+ constructor(watch, schedule, allowSignalWrites) {
12998
+ super();
12999
+ this.watch = watch;
13000
+ this.schedule = schedule;
13001
+ this.dirty = false;
13002
+ this.cleanupFn = NOOP_CLEANUP_FN;
13003
+ this.consumerAllowSignalWrites = allowSignalWrites;
13004
+ }
13005
+ notify() {
13006
+ if (!this.dirty) {
13007
+ this.schedule(this);
13008
+ }
13009
+ this.dirty = true;
13010
+ }
13011
+ onConsumerDependencyMayHaveChanged() {
13012
+ this.notify();
13013
+ }
13014
+ onProducerUpdateValueVersion() {
13015
+ // Watches are not producers.
13016
+ }
13017
+ /**
13018
+ * Execute the reactive expression in the context of this `Watch` consumer.
13019
+ *
13020
+ * Should be called by the user scheduling algorithm when the provided
13021
+ * `schedule` hook is called by `Watch`.
13022
+ */
13023
+ run() {
13024
+ this.dirty = false;
13025
+ if (this.trackingVersion !== 0 && !this.consumerPollProducersForChange()) {
13026
+ return;
13027
+ }
13028
+ const prevConsumer = setActiveConsumer(this);
13029
+ this.trackingVersion++;
13030
+ try {
13031
+ this.cleanupFn();
13032
+ this.cleanupFn = this.watch() ?? NOOP_CLEANUP_FN;
13033
+ }
13034
+ finally {
13035
+ setActiveConsumer(prevConsumer);
13036
+ }
13037
+ }
13038
+ cleanup() {
13039
+ this.cleanupFn();
13040
+ }
13041
+ }
13042
+
13043
+ /**
13044
+ * Tracks all effects registered within a given application and runs them via `flush`.
13045
+ */
13046
+ class EffectManager {
13047
+ constructor() {
13048
+ this.all = new Set();
13049
+ this.queue = new Map();
13050
+ }
13051
+ create(effectFn, destroyRef, allowSignalWrites) {
13052
+ const zone = Zone.current;
13053
+ const watch = new Watch(effectFn, (watch) => {
13054
+ if (!this.all.has(watch)) {
13055
+ return;
13056
+ }
13057
+ this.queue.set(watch, zone);
13058
+ }, allowSignalWrites);
13059
+ this.all.add(watch);
13060
+ // Effects start dirty.
13061
+ watch.notify();
13062
+ let unregisterOnDestroy;
13063
+ const destroy = () => {
13064
+ watch.cleanup();
13065
+ unregisterOnDestroy?.();
13066
+ this.all.delete(watch);
13067
+ this.queue.delete(watch);
13068
+ };
13069
+ unregisterOnDestroy = destroyRef?.onDestroy(destroy);
13070
+ return {
13071
+ destroy,
13072
+ };
13073
+ }
13074
+ flush() {
13075
+ if (this.queue.size === 0) {
13076
+ return;
13077
+ }
13078
+ for (const [watch, zone] of this.queue) {
13079
+ this.queue.delete(watch);
13080
+ zone.run(() => watch.run());
13081
+ }
13082
+ }
13083
+ get isQueueEmpty() {
13084
+ return this.queue.size === 0;
13085
+ }
13086
+ /** @nocollapse */
13087
+ static { this.ɵprov = ɵɵdefineInjectable({
13088
+ token: EffectManager,
13089
+ providedIn: 'root',
13090
+ factory: () => new EffectManager(),
13091
+ }); }
13092
+ }
13093
+ /**
13094
+ * Create a global `Effect` for the given reactive function.
13095
+ *
13096
+ * @developerPreview
13097
+ */
13098
+ function effect(effectFn, options) {
13099
+ !options?.injector && assertInInjectionContext(effect);
13100
+ const injector = options?.injector ?? inject(Injector);
13101
+ const effectManager = injector.get(EffectManager);
13102
+ const destroyRef = options?.manualCleanup !== true ? injector.get(DestroyRef) : null;
13103
+ return effectManager.create(effectFn, destroyRef, !!options?.allowSignalWrites);
13104
+ }
13105
+
13106
+ /**
13107
+ * Compute the static styling (class/style) from `TAttributes`.
13108
+ *
13109
+ * This function should be called during `firstCreatePass` only.
13110
+ *
13111
+ * @param tNode The `TNode` into which the styling information should be loaded.
13112
+ * @param attrs `TAttributes` containing the styling information.
13113
+ * @param writeToHost Where should the resulting static styles be written?
13114
+ * - `false` Write to `TNode.stylesWithoutHost` / `TNode.classesWithoutHost`
13115
+ * - `true` Write to `TNode.styles` / `TNode.classes`
13116
+ */
13117
+ function computeStaticStyling(tNode, attrs, writeToHost) {
13118
+ ngDevMode &&
13119
+ assertFirstCreatePass(getTView(), 'Expecting to be called in first template pass only');
13120
+ let styles = writeToHost ? tNode.styles : null;
13121
+ let classes = writeToHost ? tNode.classes : null;
13122
+ let mode = 0;
13123
+ if (attrs !== null) {
13124
+ for (let i = 0; i < attrs.length; i++) {
13125
+ const value = attrs[i];
13126
+ if (typeof value === 'number') {
13127
+ mode = value;
13128
+ }
13129
+ else if (mode == 1 /* AttributeMarker.Classes */) {
13130
+ classes = concatStringsWithSpace(classes, value);
13131
+ }
13132
+ else if (mode == 2 /* AttributeMarker.Styles */) {
13133
+ const style = value;
13134
+ const styleValue = attrs[++i];
13135
+ styles = concatStringsWithSpace(styles, style + ': ' + styleValue + ';');
13136
+ }
13137
+ }
13138
+ }
13139
+ writeToHost ? tNode.styles = styles : tNode.stylesWithoutHost = styles;
13140
+ writeToHost ? tNode.classes = classes : tNode.classesWithoutHost = classes;
13141
+ }
13142
+
13143
+ function collectNativeNodes(tView, lView, tNode, result, isProjection = false) {
13144
+ while (tNode !== null) {
13145
+ ngDevMode &&
13146
+ assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */ | 12 /* TNodeType.AnyContainer */ | 16 /* TNodeType.Projection */ | 32 /* TNodeType.Icu */);
13147
+ const lNode = lView[tNode.index];
13148
+ if (lNode !== null) {
13149
+ result.push(unwrapRNode(lNode));
13150
+ }
13151
+ // A given lNode can represent either a native node or a LContainer (when it is a host of a
13152
+ // ViewContainerRef). When we find a LContainer we need to descend into it to collect root nodes
13153
+ // from the views in this container.
13154
+ if (isLContainer(lNode)) {
13155
+ for (let i = CONTAINER_HEADER_OFFSET; i < lNode.length; i++) {
13156
+ const lViewInAContainer = lNode[i];
13157
+ const lViewFirstChildTNode = lViewInAContainer[TVIEW].firstChild;
13158
+ if (lViewFirstChildTNode !== null) {
13159
+ collectNativeNodes(lViewInAContainer[TVIEW], lViewInAContainer, lViewFirstChildTNode, result);
13160
+ }
13161
+ }
13162
+ }
13163
+ const tNodeType = tNode.type;
13164
+ if (tNodeType & 8 /* TNodeType.ElementContainer */) {
13165
+ collectNativeNodes(tView, lView, tNode.child, result);
13166
+ }
13167
+ else if (tNodeType & 32 /* TNodeType.Icu */) {
13168
+ const nextRNode = icuContainerIterate(tNode, lView);
13169
+ let rNode;
13170
+ while (rNode = nextRNode()) {
13171
+ result.push(rNode);
13172
+ }
13173
+ }
13174
+ else if (tNodeType & 16 /* TNodeType.Projection */) {
13175
+ const nodesInSlot = getProjectionNodes(lView, tNode);
13176
+ if (Array.isArray(nodesInSlot)) {
13177
+ result.push(...nodesInSlot);
13178
+ }
13179
+ else {
13180
+ const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]);
13181
+ ngDevMode && assertParentView(parentView);
13182
+ collectNativeNodes(parentView[TVIEW], parentView, nodesInSlot, result, true);
13183
+ }
13184
+ }
13185
+ tNode = isProjection ? tNode.projectionNext : tNode.next;
13186
+ }
13187
+ return result;
13188
+ }
13189
+
13190
+ class ViewRef$1 {
13191
+ get rootNodes() {
13192
+ const lView = this._lView;
13193
+ const tView = lView[TVIEW];
13194
+ return collectNativeNodes(tView, lView, tView.firstChild, []);
13195
+ }
13196
+ constructor(
13197
+ /**
13198
+ * This represents `LView` associated with the component when ViewRef is a ChangeDetectorRef.
13199
+ *
13200
+ * When ViewRef is created for a dynamic component, this also represents the `LView` for the
13201
+ * component.
13202
+ *
13203
+ * For a "regular" ViewRef created for an embedded view, this is the `LView` for the embedded
13204
+ * view.
13205
+ *
13206
+ * @internal
13207
+ */
13208
+ _lView,
13209
+ /**
13210
+ * This represents the `LView` associated with the point where `ChangeDetectorRef` was
13211
+ * requested.
13212
+ *
13213
+ * This may be different from `_lView` if the `_cdRefInjectingView` is an embedded view.
13214
+ */
13215
+ _cdRefInjectingView) {
13216
+ this._lView = _lView;
13217
+ this._cdRefInjectingView = _cdRefInjectingView;
13218
+ this._appRef = null;
13219
+ this._attachedToViewContainer = false;
13220
+ }
13221
+ get context() {
13222
+ return this._lView[CONTEXT];
13223
+ }
13224
+ set context(value) {
13225
+ this._lView[CONTEXT] = value;
13226
+ }
13227
+ get destroyed() {
13228
+ return (this._lView[FLAGS] & 128 /* LViewFlags.Destroyed */) === 128 /* LViewFlags.Destroyed */;
13229
+ }
13230
+ destroy() {
13231
+ if (this._appRef) {
13232
+ this._appRef.detachView(this);
13233
+ }
13234
+ else if (this._attachedToViewContainer) {
13235
+ const parent = this._lView[PARENT];
13236
+ if (isLContainer(parent)) {
13237
+ const viewRefs = parent[VIEW_REFS];
13238
+ const index = viewRefs ? viewRefs.indexOf(this) : -1;
13239
+ if (index > -1) {
13240
+ ngDevMode &&
13241
+ assertEqual(index, parent.indexOf(this._lView) - CONTAINER_HEADER_OFFSET, 'An attached view should be in the same position within its container as its ViewRef in the VIEW_REFS array.');
13242
+ detachView(parent, index);
13243
+ removeFromArray(viewRefs, index);
13244
+ }
13245
+ }
13246
+ this._attachedToViewContainer = false;
13247
+ }
13248
+ destroyLView(this._lView[TVIEW], this._lView);
13249
+ }
13250
+ onDestroy(callback) {
13251
+ storeLViewOnDestroy(this._lView, callback);
13252
+ }
13253
+ /**
13254
+ * Marks a view and all of its ancestors dirty.
13255
+ *
13256
+ * This can be used to ensure an {@link ChangeDetectionStrategy#OnPush OnPush} component is
13257
+ * checked when it needs to be re-rendered but the two normal triggers haven't marked it
13258
+ * dirty (i.e. inputs haven't changed and events haven't fired in the view).
13259
+ *
13260
+ * <!-- TODO: Add a link to a chapter on OnPush components -->
13261
+ *
13262
+ * @usageNotes
13263
+ * ### Example
13264
+ *
13265
+ * ```typescript
13266
+ * @Component({
13267
+ * selector: 'app-root',
13268
+ * template: `Number of ticks: {{numberOfTicks}}`
13269
+ * changeDetection: ChangeDetectionStrategy.OnPush,
13270
+ * })
13271
+ * class AppComponent {
13272
+ * numberOfTicks = 0;
13273
+ *
13274
+ * constructor(private ref: ChangeDetectorRef) {
13275
+ * setInterval(() => {
13276
+ * this.numberOfTicks++;
13277
+ * // the following is required, otherwise the view will not be updated
13278
+ * this.ref.markForCheck();
13279
+ * }, 1000);
13280
+ * }
13281
+ * }
13282
+ * ```
13283
+ */
13284
+ markForCheck() {
13285
+ markViewDirty(this._cdRefInjectingView || this._lView);
13286
+ }
13287
+ /**
13288
+ * Detaches the view from the change detection tree.
13289
+ *
13290
+ * Detached views will not be checked during change detection runs until they are
13291
+ * re-attached, even if they are dirty. `detach` can be used in combination with
13292
+ * {@link ChangeDetectorRef#detectChanges detectChanges} to implement local change
13293
+ * detection checks.
13294
+ *
13295
+ * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
13296
+ * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
13297
+ *
13298
+ * @usageNotes
13299
+ * ### Example
13300
+ *
13301
+ * The following example defines a component with a large list of readonly data.
13302
+ * Imagine the data changes constantly, many times per second. For performance reasons,
13303
+ * we want to check and update the list every five seconds. We can do that by detaching
13304
+ * the component's change detector and doing a local check every five seconds.
13305
+ *
13306
+ * ```typescript
13307
+ * class DataProvider {
13308
+ * // in a real application the returned data will be different every time
13309
+ * get data() {
13310
+ * return [1,2,3,4,5];
13311
+ * }
13312
+ * }
13313
+ *
13314
+ * @Component({
13315
+ * selector: 'giant-list',
13316
+ * template: `
13317
+ * <li *ngFor="let d of dataProvider.data">Data {{d}}</li>
13318
+ * `,
13319
+ * })
13320
+ * class GiantList {
13321
+ * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {
13322
+ * ref.detach();
13323
+ * setInterval(() => {
13324
+ * this.ref.detectChanges();
13325
+ * }, 5000);
13326
+ * }
13327
+ * }
13328
+ *
13329
+ * @Component({
13330
+ * selector: 'app',
13331
+ * providers: [DataProvider],
13332
+ * template: `
13333
+ * <giant-list><giant-list>
13334
+ * `,
13335
+ * })
13336
+ * class App {
13337
+ * }
13338
+ * ```
13339
+ */
13340
+ detach() {
13341
+ this._lView[FLAGS] &= ~64 /* LViewFlags.Attached */;
13342
+ }
13343
+ /**
13344
+ * Re-attaches a view to the change detection tree.
12889
13345
  *
12890
13346
  * This can be used to re-attach views that were previously detached from the tree
12891
13347
  * using {@link ChangeDetectorRef#detach detach}. Views are attached to the tree by default.
@@ -13114,6 +13570,12 @@ class ComponentFactory extends ComponentFactory$1 {
13114
13570
  'Make sure that any injector used to create this component has a correct parent.');
13115
13571
  }
13116
13572
  const sanitizer = rootViewInjector.get(Sanitizer, null);
13573
+ const effectManager = rootViewInjector.get(EffectManager, null);
13574
+ const environment = {
13575
+ rendererFactory,
13576
+ sanitizer,
13577
+ effectManager,
13578
+ };
13117
13579
  const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
13118
13580
  // Determine a tag name used for creating host elements when this component is created
13119
13581
  // dynamically. Default to 'div' if this component did not specify any tag name in its selector.
@@ -13125,7 +13587,7 @@ class ComponentFactory extends ComponentFactory$1 {
13125
13587
  16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
13126
13588
  // Create the root view. Uses empty TView and ContentTemplate.
13127
13589
  const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null, null);
13128
- const rootLView = createLView(null, rootTView, null, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector, null, null);
13590
+ const rootLView = createLView(null, rootTView, null, rootFlags, null, null, environment, hostRenderer, rootViewInjector, null, null);
13129
13591
  // rootView is the parent when bootstrapping
13130
13592
  // TODO(misko): it looks like we are entering view here but we don't really need to as
13131
13593
  // `renderView` does that. However as the code is written it is needed because
@@ -13148,7 +13610,7 @@ class ComponentFactory extends ComponentFactory$1 {
13148
13610
  rootDirectives = [rootComponentDef];
13149
13611
  }
13150
13612
  const hostTNode = createRootComponentTNode(rootLView, hostRNode);
13151
- const componentView = createRootComponentView(hostTNode, hostRNode, rootComponentDef, rootDirectives, rootLView, rendererFactory, hostRenderer);
13613
+ const componentView = createRootComponentView(hostTNode, hostRNode, rootComponentDef, rootDirectives, rootLView, environment, hostRenderer);
13152
13614
  tElementNode = getTNode(rootTView, HEADER_OFFSET);
13153
13615
  // TODO(crisbeto): in practice `hostRNode` should always be defined, but there are some tests
13154
13616
  // where the renderer is mocked out and `undefined` is returned. We should update the tests so
@@ -13254,7 +13716,7 @@ function createRootComponentTNode(lView, rNode) {
13254
13716
  *
13255
13717
  * @returns Component view created
13256
13718
  */
13257
- function createRootComponentView(tNode, hostRNode, rootComponentDef, rootDirectives, rootView, rendererFactory, hostRenderer, sanitizer) {
13719
+ function createRootComponentView(tNode, hostRNode, rootComponentDef, rootDirectives, rootView, environment, hostRenderer) {
13258
13720
  const tView = rootView[TVIEW];
13259
13721
  applyRootComponentStyling(rootDirectives, tNode, hostRNode, hostRenderer);
13260
13722
  // Hydration info is on the host element and needs to be retreived
@@ -13263,8 +13725,8 @@ function createRootComponentView(tNode, hostRNode, rootComponentDef, rootDirecti
13263
13725
  if (hostRNode !== null) {
13264
13726
  hydrationInfo = retrieveHydrationInfo(hostRNode, rootView[INJECTOR$1]);
13265
13727
  }
13266
- const viewRenderer = rendererFactory.createRenderer(hostRNode, rootComponentDef);
13267
- const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, rootComponentDef.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[tNode.index], tNode, rendererFactory, viewRenderer, sanitizer || null, null, null, hydrationInfo);
13728
+ const viewRenderer = environment.rendererFactory.createRenderer(hostRNode, rootComponentDef);
13729
+ const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, rootComponentDef.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[tNode.index], tNode, environment, viewRenderer, null, null, hydrationInfo);
13268
13730
  if (tView.firstCreatePass) {
13269
13731
  markAsComponentHost(tView, tNode, rootDirectives.length - 1);
13270
13732
  }
@@ -15473,6 +15935,7 @@ function locateOrCreateElementNodeImpl(tView, lView, tNode, renderer, name, inde
15473
15935
  // Since this isn't hydratable, we need to empty the node
15474
15936
  // so there's no duplicate content after render
15475
15937
  clearElementContents(native);
15938
+ ngDevMode && ngDevMode.componentsSkippedHydration++;
15476
15939
  }
15477
15940
  else if (ngDevMode) {
15478
15941
  // If this is not a component host, throw an error.
@@ -15529,7 +15992,6 @@ function ɵɵelementContainerStart(index, attrsIndex, localRefsIndex) {
15529
15992
  elementContainerStartFirstCreatePass(adjustedIndex, tView, lView, attrsIndex, localRefsIndex) :
15530
15993
  tView.data[adjustedIndex];
15531
15994
  setCurrentTNode(tNode, true);
15532
- ngDevMode && ngDevMode.rendererCreateComment++;
15533
15995
  const comment = _locateOrCreateElementContainerNode(tView, lView, tNode, index);
15534
15996
  lView[adjustedIndex] = comment;
15535
15997
  if (wasLastNodeCreated()) {
@@ -21717,17 +22179,19 @@ function createNgModuleRefWithProviders(moduleType, parentInjector, additionalPr
21717
22179
  return new NgModuleRef(moduleType, parentInjector, additionalProviders);
21718
22180
  }
21719
22181
  class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
21720
- constructor(providers, parent, source) {
22182
+ constructor(config) {
21721
22183
  super();
21722
22184
  this.componentFactoryResolver = new ComponentFactoryResolver(this);
21723
22185
  this.instance = null;
21724
22186
  const injector = new R3Injector([
21725
- ...providers,
22187
+ ...config.providers,
21726
22188
  { provide: NgModuleRef$1, useValue: this },
21727
22189
  { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver },
21728
- ], parent || getNullInjector(), source, new Set(['environment']));
22190
+ ], config.parent || getNullInjector(), config.debugName, new Set(['environment']));
21729
22191
  this.injector = injector;
21730
- injector.resolveInjectorInitializers();
22192
+ if (config.runEnvironmentInitializers) {
22193
+ injector.resolveInjectorInitializers();
22194
+ }
21731
22195
  }
21732
22196
  destroy() {
21733
22197
  this.injector.destroy();
@@ -21750,7 +22214,7 @@ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
21750
22214
  * @publicApi
21751
22215
  */
21752
22216
  function createEnvironmentInjector(providers, parent, debugName = null) {
21753
- const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
22217
+ const adapter = new EnvironmentNgModuleRefAdapter({ providers, parent, debugName, runEnvironmentInitializers: true });
21754
22218
  return adapter.injector;
21755
22219
  }
21756
22220
 
@@ -23018,7 +23482,7 @@ const R3TemplateRef = class TemplateRef extends ViewEngineTemplateRef {
23018
23482
  */
23019
23483
  createEmbeddedViewImpl(context, injector, hydrationInfo) {
23020
23484
  const embeddedTView = this._declarationTContainer.tView;
23021
- const embeddedLView = createLView(this._declarationLView, embeddedTView, context, 16 /* LViewFlags.CheckAlways */, null, embeddedTView.declTNode, null, null, null, null, injector || null, hydrationInfo || null);
23485
+ const embeddedLView = createLView(this._declarationLView, embeddedTView, context, 16 /* LViewFlags.CheckAlways */, null, embeddedTView.declTNode, null, null, null, injector || null, hydrationInfo || null);
23022
23486
  const declarationLContainer = this._declarationLView[this._declarationTContainer.index];
23023
23487
  ngDevMode && assertLContainer(declarationLContainer);
23024
23488
  embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer;
@@ -23120,24 +23584,17 @@ function cleanupLView(lView) {
23120
23584
  * Walks over all views registered within the ApplicationRef and removes
23121
23585
  * all dehydrated views from all `LContainer`s along the way.
23122
23586
  */
23123
- function cleanupDehydratedViews(appRef, pendingTasks) {
23124
- // Wait once an app becomes stable and cleanup all views that
23125
- // were not claimed during the application bootstrap process.
23126
- // The timing is similar to when we kick off serialization on the server.
23127
- const isStablePromise = appRef.isStable.pipe(first((isStable) => isStable)).toPromise();
23128
- const pendingTasksPromise = pendingTasks.whenAllTasksComplete;
23129
- return Promise.allSettled([isStablePromise, pendingTasksPromise]).then(() => {
23130
- const viewRefs = appRef._views;
23131
- for (const viewRef of viewRefs) {
23132
- const lView = getComponentLViewForHydration(viewRef);
23133
- // An `lView` might be `null` if a `ViewRef` represents
23134
- // an embedded view (not a component view).
23135
- if (lView !== null && lView[HOST] !== null) {
23136
- cleanupLView(lView);
23137
- ngDevMode && ngDevMode.dehydratedViewsCleanupRuns++;
23138
- }
23587
+ function cleanupDehydratedViews(appRef) {
23588
+ const viewRefs = appRef._views;
23589
+ for (const viewRef of viewRefs) {
23590
+ const lView = getComponentLViewForHydration(viewRef);
23591
+ // An `lView` might be `null` if a `ViewRef` represents
23592
+ // an embedded view (not a component view).
23593
+ if (lView !== null && lView[HOST] !== null) {
23594
+ cleanupLView(lView);
23595
+ ngDevMode && ngDevMode.dehydratedViewsCleanupRuns++;
23139
23596
  }
23140
- });
23597
+ }
23141
23598
  }
23142
23599
 
23143
23600
  /**
@@ -23221,7 +23678,7 @@ function findMatchingDehydratedView(lContainer, template) {
23221
23678
  * (created by instantiating a `TemplateRef` with the `createEmbeddedView()` method).
23222
23679
  *
23223
23680
  * A view container instance can contain other view containers,
23224
- * creating a [view hierarchy](guide/glossary#view-tree).
23681
+ * creating a [view hierarchy](guide/glossary#view-hierarchy).
23225
23682
  *
23226
23683
  * @see `ComponentRef`
23227
23684
  * @see `EmbeddedViewRef`
@@ -26748,6 +27205,16 @@ function compileNgModuleFactory(injector, options, moduleType) {
26748
27205
  function publishDefaultGlobalUtils() {
26749
27206
  ngDevMode && publishDefaultGlobalUtils$1();
26750
27207
  }
27208
+ /**
27209
+ * Sets the error for an invalid write to a signal to be an Angular `RuntimeError`.
27210
+ */
27211
+ function publishSignalConfiguration() {
27212
+ setThrowInvalidWriteToSignalError(() => {
27213
+ throw new RuntimeError(600 /* RuntimeErrorCode.SIGNAL_WRITE_FROM_ILLEGAL_CONTEXT */, ngDevMode &&
27214
+ 'Writing to signals is not allowed in a `computed` or an `effect` by default. ' +
27215
+ 'Use `allowSignalWrites` in the `CreateEffectOptions` to enable this inside effects.');
27216
+ });
27217
+ }
26751
27218
  function isBoundToModule(cf) {
26752
27219
  return cf.isBoundToModule;
26753
27220
  }
@@ -26774,6 +27241,7 @@ function createPlatform(injector) {
26774
27241
  'There can be only one platform. Destroy the previous one to create a new one.');
26775
27242
  }
26776
27243
  publishDefaultGlobalUtils();
27244
+ publishSignalConfiguration();
26777
27245
  _platformInjector = injector;
26778
27246
  const platform = injector.get(PlatformRef);
26779
27247
  runPlatformInitializers(injector);
@@ -26817,15 +27285,24 @@ function internalCreateApplication(config) {
26817
27285
  assertStandaloneComponentType(rootComponent);
26818
27286
  }
26819
27287
  const platformInjector = createOrReusePlatformInjector(platformProviders);
26820
- const ngZone = getNgZone('zone.js', getNgZoneOptions());
27288
+ // Create root application injector based on a set of providers configured at the platform
27289
+ // bootstrap level as well as providers passed to the bootstrap call by a user.
27290
+ const allAppProviders = [
27291
+ provideZoneChangeDetection(),
27292
+ ...(appProviders || []),
27293
+ ];
27294
+ const adapter = new EnvironmentNgModuleRefAdapter({
27295
+ providers: allAppProviders,
27296
+ parent: platformInjector,
27297
+ debugName: (typeof ngDevMode === 'undefined' || ngDevMode) ? 'Environment Injector' : '',
27298
+ // We skip environment initializers because we need to run them inside the NgZone, which happens
27299
+ // after we get the NgZone instance from the Injector.
27300
+ runEnvironmentInitializers: false,
27301
+ });
27302
+ const envInjector = adapter.injector;
27303
+ const ngZone = envInjector.get(NgZone);
26821
27304
  return ngZone.run(() => {
26822
- // Create root application injector based on a set of providers configured at the platform
26823
- // bootstrap level as well as providers passed to the bootstrap call by a user.
26824
- const allAppProviders = [
26825
- provideNgZoneChangeDetection(ngZone),
26826
- ...(appProviders || []),
26827
- ];
26828
- const envInjector = createEnvironmentInjector(allAppProviders, platformInjector, 'Environment Injector');
27305
+ envInjector.resolveInjectorInitializers();
26829
27306
  const exceptionHandler = envInjector.get(ErrorHandler, null);
26830
27307
  if ((typeof ngDevMode === 'undefined' || ngDevMode) && !exceptionHandler) {
26831
27308
  throw new RuntimeError(402 /* RuntimeErrorCode.MISSING_REQUIRED_INJECTABLE_IN_BOOTSTRAP */, 'No `ErrorHandler` found in the Dependency Injection tree.');
@@ -26969,13 +27446,20 @@ class PlatformRef {
26969
27446
  // as instantiating the module creates some providers eagerly.
26970
27447
  // So we create a mini parent injector that just contains the new NgZone and
26971
27448
  // pass that as parent to the NgModuleFactory.
26972
- const ngZone = getNgZone(options?.ngZone, getNgZoneOptions(options));
27449
+ const ngZone = getNgZone(options?.ngZone, getNgZoneOptions({
27450
+ eventCoalescing: options?.ngZoneEventCoalescing,
27451
+ runCoalescing: options?.ngZoneRunCoalescing
27452
+ }));
26973
27453
  // Note: Create ngZoneInjector within ngZone.run so that all of the instantiated services are
26974
27454
  // created within the Angular zone
26975
27455
  // Do not try to replace ngZone.run with ApplicationRef#run because ApplicationRef would then be
26976
27456
  // created outside of the Angular zone.
26977
27457
  return ngZone.run(() => {
26978
- const moduleRef = createNgModuleRefWithProviders(moduleFactory.moduleType, this.injector, provideNgZoneChangeDetection(ngZone));
27458
+ const moduleRef = createNgModuleRefWithProviders(moduleFactory.moduleType, this.injector, internalProvideZoneChangeDetection(() => ngZone));
27459
+ if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
27460
+ moduleRef.injector.get(PROVIDED_NG_ZONE, null) !== null) {
27461
+ throw new RuntimeError(207 /* RuntimeErrorCode.PROVIDER_IN_WRONG_CONTEXT */, '`bootstrapModule` does not support `provideZoneChangeDetection`. Use `BootstrapOptions` instead.');
27462
+ }
26979
27463
  const exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
26980
27464
  if ((typeof ngDevMode === 'undefined' || ngDevMode) && exceptionHandler === null) {
26981
27465
  throw new RuntimeError(402 /* RuntimeErrorCode.MISSING_REQUIRED_INJECTABLE_IN_BOOTSTRAP */, 'No ErrorHandler. Is platform module (BrowserModule) included?');
@@ -27090,8 +27574,8 @@ class PlatformRef {
27090
27574
  function getNgZoneOptions(options) {
27091
27575
  return {
27092
27576
  enableLongStackTrace: typeof ngDevMode === 'undefined' ? false : !!ngDevMode,
27093
- shouldCoalesceEventChangeDetection: options?.ngZoneEventCoalescing ?? false,
27094
- shouldCoalesceRunChangeDetection: options?.ngZoneRunCoalescing ?? false,
27577
+ shouldCoalesceEventChangeDetection: options?.eventCoalescing ?? false,
27578
+ shouldCoalesceRunChangeDetection: options?.runCoalescing ?? false,
27095
27579
  };
27096
27580
  }
27097
27581
  function getNgZone(ngZoneToUse = 'zone.js', options) {
@@ -27527,9 +28011,14 @@ class NgZoneChangeDetectionScheduler {
27527
28011
  type: Injectable,
27528
28012
  args: [{ providedIn: 'root' }]
27529
28013
  }], null, null); })();
27530
- function provideNgZoneChangeDetection(ngZone) {
28014
+ /**
28015
+ * Internal token used to verify that `provideZoneChangeDetection` is not used
28016
+ * with the bootstrapModule API.
28017
+ */
28018
+ const PROVIDED_NG_ZONE = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'provideZoneChangeDetection token' : '');
28019
+ function internalProvideZoneChangeDetection(ngZoneFactory) {
27531
28020
  return [
27532
- { provide: NgZone, useValue: ngZone },
28021
+ { provide: NgZone, useFactory: ngZoneFactory },
27533
28022
  {
27534
28023
  provide: ENVIRONMENT_INITIALIZER,
27535
28024
  multi: true,
@@ -27547,6 +28036,34 @@ function provideNgZoneChangeDetection(ngZone) {
27547
28036
  { provide: ZONE_IS_STABLE_OBSERVABLE, useFactory: isStableFactory },
27548
28037
  ];
27549
28038
  }
28039
+ /**
28040
+ * Provides `NgZone`-based change detection for the application bootstrapped using
28041
+ * `bootstrapApplication`.
28042
+ *
28043
+ * `NgZone` is already provided in applications by default. This provider allows you to configure
28044
+ * options like `eventCoalescing` in the `NgZone`.
28045
+ * This provider is not available for `platformBrowser().bootstrapModule`, which uses
28046
+ * `BootstrapOptions` instead.
28047
+ *
28048
+ * @usageNotes
28049
+ * ```typescript=
28050
+ * bootstrapApplication(MyApp, {providers: [
28051
+ * provideZoneChangeDetection({eventCoalescing: true}),
28052
+ * ]});
28053
+ * ```
28054
+ *
28055
+ * @publicApi
28056
+ * @see bootstrapApplication
28057
+ * @see NgZoneOptions
28058
+ */
28059
+ function provideZoneChangeDetection(options) {
28060
+ const zoneProviders = internalProvideZoneChangeDetection(() => new NgZone(getNgZoneOptions(options)));
28061
+ return makeEnvironmentProviders([
28062
+ (typeof ngDevMode === 'undefined' || ngDevMode) ? { provide: PROVIDED_NG_ZONE, useValue: true } :
28063
+ [],
28064
+ zoneProviders,
28065
+ ]);
28066
+ }
27550
28067
 
27551
28068
  /**
27552
28069
  * Returns whether Angular is in development mode.
@@ -27569,56 +28086,22 @@ function isDevMode() {
27569
28086
  * unidirectional data flow).
27570
28087
  *
27571
28088
  * Using this method is discouraged as the Angular CLI will set production mode when using the
27572
- * `optimization` option.
27573
- * @see {@link cli/build ng build}
27574
- *
27575
- * @publicApi
27576
- */
27577
- function enableProdMode() {
27578
- // The below check is there so when ngDevMode is set via terser
27579
- // `global['ngDevMode'] = false;` is also dropped.
27580
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
27581
- _global['ngDevMode'] = false;
27582
- }
27583
- }
27584
-
27585
- // Public API for Zone
27586
-
27587
- // Public API for render
27588
-
27589
- /**
27590
- * `DestroyRef` lets you set callbacks to run for any cleanup or destruction behavior.
27591
- * The scope of this destruction depends on where `DestroyRef` is injected. If `DestroyRef`
27592
- * is injected in a component or directive, the callbacks run when that component or
27593
- * directive is destroyed. Otherwise the callbacks run when a corresponding injector is destroyed.
27594
- *
27595
- * @publicApi
27596
- */
27597
- class DestroyRef {
27598
- /**
27599
- * @internal
27600
- * @nocollapse
27601
- */
27602
- static { this.__NG_ELEMENT_ID__ = injectDestroyRef; }
27603
- /**
27604
- * @internal
27605
- * @nocollapse
27606
- */
27607
- static { this.__NG_ENV_ID__ = (injector) => injector; }
27608
- }
27609
- class NodeInjectorDestroyRef extends DestroyRef {
27610
- constructor(_lView) {
27611
- super();
27612
- this._lView = _lView;
27613
- }
27614
- onDestroy(callback) {
27615
- storeLViewOnDestroy(this._lView, callback);
27616
- return () => removeLViewOnDestroy(this._lView, callback);
28089
+ * `optimization` option.
28090
+ * @see {@link cli/build ng build}
28091
+ *
28092
+ * @publicApi
28093
+ */
28094
+ function enableProdMode() {
28095
+ // The below check is there so when ngDevMode is set via terser
28096
+ // `global['ngDevMode'] = false;` is also dropped.
28097
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
28098
+ _global['ngDevMode'] = false;
27617
28099
  }
27618
28100
  }
27619
- function injectDestroyRef() {
27620
- return new NodeInjectorDestroyRef(getLView());
27621
- }
28101
+
28102
+ // Public API for Zone
28103
+
28104
+ // Public API for render
27622
28105
 
27623
28106
  /**
27624
28107
  * Returns the NgModuleFactory with the given id (specified using [@NgModule.id
@@ -27740,7 +28223,7 @@ class ViewRef extends ChangeDetectorRef {
27740
28223
  }
27741
28224
  /**
27742
28225
  * Represents an Angular [view](guide/glossary#view) in a view container.
27743
- * An [embedded view](guide/glossary#view-tree) can be referenced from a component
28226
+ * An [embedded view](guide/glossary#view-hierarchy) can be referenced from a component
27744
28227
  * other than the hosting component whose template defines it, or it can be defined
27745
28228
  * independently by a `TemplateRef`.
27746
28229
  *
@@ -29787,560 +30270,283 @@ function serializeLView(lView, context) {
29787
30270
  if (tNode.projectionNext && tNode.projectionNext !== tNode.next &&
29788
30271
  !isInSkipHydrationBlock(tNode.projectionNext)) {
29789
30272
  // Check if projection next is not the same as next, in which case
29790
- // the node would not be found at creation time at runtime and we
29791
- // need to provide a location for that node.
29792
- appendSerializedNodePath(ngh, tNode.projectionNext, lView);
29793
- }
29794
- }
29795
- }
29796
- }
29797
- return ngh;
29798
- }
29799
- /**
29800
- * Physically adds the `ngh` attribute and serialized data to the host element.
29801
- *
29802
- * @param element The Host element to be annotated
29803
- * @param lView The associated LView
29804
- * @param context The hydration context
29805
- */
29806
- function annotateHostElementForHydration(element, lView, context) {
29807
- const ngh = serializeLView(lView, context);
29808
- const index = context.serializedViewCollection.add(ngh);
29809
- const renderer = lView[RENDERER];
29810
- renderer.setAttribute(element, NGH_ATTR_NAME, index.toString());
29811
- }
29812
- /**
29813
- * Physically inserts the comment nodes to ensure empty text nodes and adjacent
29814
- * text node separators are preserved after server serialization of the DOM.
29815
- * These get swapped back for empty text nodes or separators once hydration happens
29816
- * on the client.
29817
- *
29818
- * @param corruptedTextNodes The Map of text nodes to be replaced with comments
29819
- * @param doc The document
29820
- */
29821
- function insertCorruptedTextNodeMarkers(corruptedTextNodes, doc) {
29822
- for (const [textNode, marker] of corruptedTextNodes) {
29823
- textNode.after(doc.createComment(marker));
29824
- }
29825
- }
29826
- /**
29827
- * Detects whether a given TNode represents a node that
29828
- * is being content projected.
29829
- */
29830
- function isContentProjectedNode(tNode) {
29831
- let currentTNode = tNode;
29832
- while (currentTNode != null) {
29833
- // If we come across a component host node in parent nodes -
29834
- // this TNode is in the content projection section.
29835
- if (isComponentHost(currentTNode)) {
29836
- return true;
29837
- }
29838
- currentTNode = currentTNode.parent;
29839
- }
29840
- return false;
29841
- }
29842
- /**
29843
- * Check whether a given node exists, but is disconnected from the DOM.
29844
- *
29845
- * Note: we leverage the fact that we have this information available in the DOM emulation
29846
- * layer (in Domino) for now. Longer-term solution should not rely on the DOM emulation and
29847
- * only use internal data structures and state to compute this information.
29848
- */
29849
- function isDisconnectedNode(tNode, lView) {
29850
- return !(tNode.type & 16 /* TNodeType.Projection */) && !!lView[tNode.index] &&
29851
- !unwrapRNode(lView[tNode.index]).isConnected;
29852
- }
29853
-
29854
- /**
29855
- * *Internal* service that keeps track of pending tasks happening in the system
29856
- * during the initial rendering. No tasks are tracked after an initial
29857
- * rendering.
29858
- *
29859
- * This information is needed to make sure that the serialization on the server
29860
- * is delayed until all tasks in the queue (such as an initial navigation or a
29861
- * pending HTTP request) are completed.
29862
- */
29863
- class InitialRenderPendingTasks {
29864
- get whenAllTasksComplete() {
29865
- if (this.collection.size > 0) {
29866
- return this.promise;
29867
- }
29868
- return Promise.resolve().then(() => {
29869
- this.completed = true;
29870
- });
29871
- }
29872
- constructor() {
29873
- this.taskId = 0;
29874
- this.collection = new Set();
29875
- this.ngZone = inject(NgZone);
29876
- this.completed = false;
29877
- // Run outside of the Angular zone to avoid triggering
29878
- // extra change detection cycles.
29879
- this.ngZone.runOutsideAngular(() => {
29880
- this.promise = new Promise((resolve) => {
29881
- this.resolve = resolve;
29882
- });
29883
- });
29884
- }
29885
- add() {
29886
- if (this.completed) {
29887
- // Indicates that the task was added after
29888
- // the task queue completion, so it's a noop.
29889
- return -1;
29890
- }
29891
- const taskId = this.taskId++;
29892
- this.collection.add(taskId);
29893
- return taskId;
29894
- }
29895
- remove(taskId) {
29896
- if (this.completed)
29897
- return;
29898
- this.collection.delete(taskId);
29899
- if (this.collection.size === 0) {
29900
- // We've removed the last task, resolve the promise.
29901
- this.completed = true;
29902
- this.resolve();
29903
- }
29904
- }
29905
- ngOnDestroy() {
29906
- this.completed = true;
29907
- this.collection.clear();
29908
- }
29909
- static { this.ɵfac = function InitialRenderPendingTasks_Factory(t) { return new (t || InitialRenderPendingTasks)(); }; }
29910
- static { this.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: InitialRenderPendingTasks, factory: InitialRenderPendingTasks.ɵfac, providedIn: 'root' }); }
29911
- }
29912
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(InitialRenderPendingTasks, [{
29913
- type: Injectable,
29914
- args: [{ providedIn: 'root' }]
29915
- }], function () { return []; }, null); })();
29916
-
29917
- /**
29918
- * Indicates whether the hydration-related code was added,
29919
- * prevents adding it multiple times.
29920
- */
29921
- let isHydrationSupportEnabled = false;
29922
- /**
29923
- * Brings the necessary hydration code in tree-shakable manner.
29924
- * The code is only present when the `provideHydrationSupport` is
29925
- * invoked. Otherwise, this code is tree-shaken away during the
29926
- * build optimization step.
29927
- *
29928
- * This technique allows us to swap implementations of methods so
29929
- * tree shaking works appropriately when hydration is disabled or
29930
- * enabled. It brings in the appropriate version of the method that
29931
- * supports hydration only when enabled.
29932
- */
29933
- function enableHydrationRuntimeSupport() {
29934
- if (!isHydrationSupportEnabled) {
29935
- isHydrationSupportEnabled = true;
29936
- enableRetrieveHydrationInfoImpl();
29937
- enableLocateOrCreateElementNodeImpl();
29938
- enableLocateOrCreateTextNodeImpl();
29939
- enableLocateOrCreateElementContainerNodeImpl();
29940
- enableLocateOrCreateContainerAnchorImpl();
29941
- enableLocateOrCreateContainerRefImpl();
29942
- enableFindMatchingDehydratedViewImpl();
29943
- enableApplyRootElementTransformImpl();
29944
- }
29945
- }
29946
- /**
29947
- * Detects whether the code is invoked in a browser.
29948
- * Later on, this check should be replaced with a tree-shakable
29949
- * flag (e.g. `!isServer`).
29950
- */
29951
- function isBrowser() {
29952
- return inject(PLATFORM_ID) === 'browser';
29953
- }
29954
- /**
29955
- * Returns a set of providers required to setup hydration support
29956
- * for an application that is server side rendered.
29957
- *
29958
- * ## NgModule-based bootstrap
29959
- *
29960
- * You can add the function call to the root AppModule of an application:
29961
- * ```
29962
- * import {provideHydrationSupport} from '@angular/core';
29963
- *
29964
- * @NgModule({
29965
- * providers: [
29966
- * // ... other providers ...
29967
- * provideHydrationSupport()
29968
- * ],
29969
- * declarations: [AppComponent],
29970
- * bootstrap: [AppComponent]
29971
- * })
29972
- * class AppModule {}
29973
- * ```
29974
- *
29975
- * ## Standalone-based bootstrap
29976
- *
29977
- * Add the function to the `bootstrapApplication` call:
29978
- * ```
29979
- * import {provideHydrationSupport} from '@angular/core';
29980
- *
29981
- * bootstrapApplication(RootComponent, {
29982
- * providers: [
29983
- * // ... other providers ...
29984
- * provideHydrationSupport()
29985
- * ]
29986
- * });
29987
- * ```
29988
- *
29989
- * The function sets up an internal flag that would be recognized during
29990
- * the server side rendering time as well, so there is no need to
29991
- * configure or change anything in NgUniversal to enable the feature.
29992
- *
29993
- * @publicApi
29994
- * @developerPreview
29995
- */
29996
- function provideHydrationSupport() {
29997
- return makeEnvironmentProviders([
29998
- {
29999
- provide: ENVIRONMENT_INITIALIZER,
30000
- useValue: () => {
30001
- // Since this function is used across both server and client,
30002
- // make sure that the runtime code is only added when invoked
30003
- // on the client. Moving forward, the `isBrowser` check should
30004
- // be replaced with a tree-shakable alternative (e.g. `isServer`
30005
- // flag).
30006
- if (isBrowser()) {
30007
- enableHydrationRuntimeSupport();
30008
- }
30009
- },
30010
- multi: true,
30011
- },
30012
- {
30013
- provide: IS_HYDRATION_FEATURE_ENABLED,
30014
- useValue: true,
30015
- },
30016
- {
30017
- provide: PRESERVE_HOST_CONTENT,
30018
- // Preserve host element content only in a browser
30019
- // environment. On a server, an application is rendered
30020
- // from scratch, so the host content needs to be empty.
30021
- useFactory: () => isBrowser(),
30022
- },
30023
- {
30024
- provide: APP_BOOTSTRAP_LISTENER,
30025
- useFactory: () => {
30026
- if (isBrowser()) {
30027
- const appRef = inject(ApplicationRef);
30028
- const pendingTasks = inject(InitialRenderPendingTasks);
30029
- return () => cleanupDehydratedViews(appRef, pendingTasks);
30273
+ // the node would not be found at creation time at runtime and we
30274
+ // need to provide a location for that node.
30275
+ appendSerializedNodePath(ngh, tNode.projectionNext, lView);
30030
30276
  }
30031
- return () => { }; // noop
30032
- },
30033
- multi: true,
30277
+ }
30034
30278
  }
30035
- ]);
30279
+ }
30280
+ return ngh;
30036
30281
  }
30037
-
30038
30282
  /**
30039
- * Symbol used to tell `Signal`s apart from other functions.
30283
+ * Physically adds the `ngh` attribute and serialized data to the host element.
30040
30284
  *
30041
- * This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.
30042
- */
30043
- const SIGNAL = Symbol('SIGNAL');
30044
- /**
30045
- * Checks if the given `value` function is a reactive `Signal`.
30285
+ * @param element The Host element to be annotated
30286
+ * @param lView The associated LView
30287
+ * @param context The hydration context
30046
30288
  */
30047
- function isSignal(value) {
30048
- return value[SIGNAL] !== undefined;
30289
+ function annotateHostElementForHydration(element, lView, context) {
30290
+ const ngh = serializeLView(lView, context);
30291
+ const index = context.serializedViewCollection.add(ngh);
30292
+ const renderer = lView[RENDERER];
30293
+ renderer.setAttribute(element, NGH_ATTR_NAME, index.toString());
30049
30294
  }
30050
30295
  /**
30051
- * Converts `fn` into a marked signal function (where `isSignal(fn)` will be `true`), and
30052
- * potentially add some set of extra properties (passed as an object record `extraApi`).
30296
+ * Physically inserts the comment nodes to ensure empty text nodes and adjacent
30297
+ * text node separators are preserved after server serialization of the DOM.
30298
+ * These get swapped back for empty text nodes or separators once hydration happens
30299
+ * on the client.
30300
+ *
30301
+ * @param corruptedTextNodes The Map of text nodes to be replaced with comments
30302
+ * @param doc The document
30053
30303
  */
30054
- function createSignalFromFunction(node, fn, extraApi = {}) {
30055
- fn[SIGNAL] = node;
30056
- // Copy properties from `extraApi` to `fn` to complete the desired API of the `Signal`.
30057
- return Object.assign(fn, extraApi);
30304
+ function insertCorruptedTextNodeMarkers(corruptedTextNodes, doc) {
30305
+ for (const [textNode, marker] of corruptedTextNodes) {
30306
+ textNode.after(doc.createComment(marker));
30307
+ }
30058
30308
  }
30059
30309
  /**
30060
- * The default equality function used for `signal` and `computed`, which treats objects and arrays
30061
- * as never equal, and all other primitive values using identity semantics.
30062
- *
30063
- * This allows signals to hold non-primitive values (arrays, objects, other collections) and still
30064
- * propagate change notification upon explicit mutation without identity change.
30065
- *
30066
- * @developerPreview
30310
+ * Detects whether a given TNode represents a node that
30311
+ * is being content projected.
30067
30312
  */
30068
- function defaultEquals(a, b) {
30069
- // `Object.is` compares two values using identity semantics which is desired behavior for
30070
- // primitive values. If `Object.is` determines two values to be equal we need to make sure that
30071
- // those don't represent objects (we want to make sure that 2 objects are always considered
30072
- // "unequal"). The null check is needed for the special case of JavaScript reporting null values
30073
- // as objects (`typeof null === 'object'`).
30074
- return (a === null || typeof a !== 'object') && Object.is(a, b);
30313
+ function isContentProjectedNode(tNode) {
30314
+ let currentTNode = tNode;
30315
+ while (currentTNode != null) {
30316
+ // If we come across a component host node in parent nodes -
30317
+ // this TNode is in the content projection section.
30318
+ if (isComponentHost(currentTNode)) {
30319
+ return true;
30320
+ }
30321
+ currentTNode = currentTNode.parent;
30322
+ }
30323
+ return false;
30075
30324
  }
30076
- // clang-format on
30077
-
30078
30325
  /**
30079
- * Create a computed `Signal` which derives a reactive value from an expression.
30326
+ * Check whether a given node exists, but is disconnected from the DOM.
30080
30327
  *
30081
- * @developerPreview
30328
+ * Note: we leverage the fact that we have this information available in the DOM emulation
30329
+ * layer (in Domino) for now. Longer-term solution should not rely on the DOM emulation and
30330
+ * only use internal data structures and state to compute this information.
30082
30331
  */
30083
- function computed(computation, options) {
30084
- const node = new ComputedImpl(computation, options?.equal ?? defaultEquals);
30085
- // Casting here is required for g3, as TS inference behavior is slightly different between our
30086
- // version/options and g3's.
30087
- return createSignalFromFunction(node, node.signal.bind(node));
30332
+ function isDisconnectedNode(tNode, lView) {
30333
+ return !(tNode.type & 16 /* TNodeType.Projection */) && !!lView[tNode.index] &&
30334
+ !unwrapRNode(lView[tNode.index]).isConnected;
30088
30335
  }
30336
+
30089
30337
  /**
30090
- * A dedicated symbol used before a computed value has been calculated for the first time.
30091
- * Explicitly typed as `any` so we can use it as signal's value.
30092
- */
30093
- const UNSET = Symbol('UNSET');
30094
- /**
30095
- * A dedicated symbol used in place of a computed signal value to indicate that a given computation
30096
- * is in progress. Used to detect cycles in computation chains.
30097
- * Explicitly typed as `any` so we can use it as signal's value.
30098
- */
30099
- const COMPUTING = Symbol('COMPUTING');
30100
- /**
30101
- * A dedicated symbol used in place of a computed signal value to indicate that a given computation
30102
- * failed. The thrown error is cached until the computation gets dirty again.
30103
- * Explicitly typed as `any` so we can use it as signal's value.
30104
- */
30105
- const ERRORED = Symbol('ERRORED');
30106
- /**
30107
- * A computation, which derives a value from a declarative reactive expression.
30338
+ * *Internal* service that keeps track of pending tasks happening in the system
30339
+ * during the initial rendering. No tasks are tracked after an initial
30340
+ * rendering.
30108
30341
  *
30109
- * `Computed`s are both producers and consumers of reactivity.
30342
+ * This information is needed to make sure that the serialization on the server
30343
+ * is delayed until all tasks in the queue (such as an initial navigation or a
30344
+ * pending HTTP request) are completed.
30110
30345
  */
30111
- class ComputedImpl extends ReactiveNode {
30112
- constructor(computation, equal) {
30113
- super();
30114
- this.computation = computation;
30115
- this.equal = equal;
30116
- /**
30117
- * Current value of the computation.
30118
- *
30119
- * This can also be one of the special values `UNSET`, `COMPUTING`, or `ERRORED`.
30120
- */
30121
- this.value = UNSET;
30122
- /**
30123
- * If `value` is `ERRORED`, the error caught from the last computation attempt which will
30124
- * be re-thrown.
30125
- */
30126
- this.error = null;
30127
- /**
30128
- * Flag indicating that the computation is currently stale, meaning that one of the
30129
- * dependencies has notified of a potential change.
30130
- *
30131
- * It's possible that no dependency has _actually_ changed, in which case the `stale`
30132
- * state can be resolved without recomputing the value.
30133
- */
30134
- this.stale = true;
30135
- }
30136
- onConsumerDependencyMayHaveChanged() {
30137
- if (this.stale) {
30138
- // We've already notified consumers that this value has potentially changed.
30139
- return;
30140
- }
30141
- // Record that the currently cached value may be stale.
30142
- this.stale = true;
30143
- // Notify any consumers about the potential change.
30144
- this.producerMayHaveChanged();
30145
- }
30146
- onProducerUpdateValueVersion() {
30147
- if (!this.stale) {
30148
- // The current value and its version are already up to date.
30149
- return;
30150
- }
30151
- // The current value is stale. Check whether we need to produce a new one.
30152
- if (this.value !== UNSET && this.value !== COMPUTING &&
30153
- !this.consumerPollProducersForChange()) {
30154
- // Even though we were previously notified of a potential dependency update, all of
30155
- // our dependencies report that they have not actually changed in value, so we can
30156
- // resolve the stale state without needing to recompute the current value.
30157
- this.stale = false;
30158
- return;
30159
- }
30160
- // The current value is stale, and needs to be recomputed. It still may not change -
30161
- // that depends on whether the newly computed value is equal to the old.
30162
- this.recomputeValue();
30163
- }
30164
- recomputeValue() {
30165
- if (this.value === COMPUTING) {
30166
- // Our computation somehow led to a cyclic read of itself.
30167
- throw new Error('Detected cycle in computations.');
30168
- }
30169
- const oldValue = this.value;
30170
- this.value = COMPUTING;
30171
- // As we're re-running the computation, update our dependent tracking version number.
30172
- this.trackingVersion++;
30173
- const prevConsumer = setActiveConsumer(this);
30174
- let newValue;
30175
- try {
30176
- newValue = this.computation();
30177
- }
30178
- catch (err) {
30179
- newValue = ERRORED;
30180
- this.error = err;
30181
- }
30182
- finally {
30183
- setActiveConsumer(prevConsumer);
30184
- }
30185
- this.stale = false;
30186
- if (oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED &&
30187
- this.equal(oldValue, newValue)) {
30188
- // No change to `valueVersion` - old and new values are
30189
- // semantically equivalent.
30190
- this.value = oldValue;
30191
- return;
30192
- }
30193
- this.value = newValue;
30194
- this.valueVersion++;
30195
- }
30196
- signal() {
30197
- // Check if the value needs updating before returning it.
30198
- this.onProducerUpdateValueVersion();
30199
- // Record that someone looked at this signal.
30200
- this.producerAccessed();
30201
- if (this.value === ERRORED) {
30202
- throw this.error;
30346
+ class InitialRenderPendingTasks {
30347
+ get whenAllTasksComplete() {
30348
+ if (this.collection.size > 0) {
30349
+ return this.promise;
30203
30350
  }
30204
- return this.value;
30205
- }
30206
- }
30207
-
30208
- class WritableSignalImpl extends ReactiveNode {
30209
- constructor(value, equal) {
30210
- super();
30211
- this.value = value;
30212
- this.equal = equal;
30213
- }
30214
- onConsumerDependencyMayHaveChanged() {
30215
- // This never happens for writable signals as they're not consumers.
30351
+ return Promise.resolve().then(() => {
30352
+ this.completed = true;
30353
+ });
30216
30354
  }
30217
- onProducerUpdateValueVersion() {
30218
- // Writable signal value versions are always up to date.
30355
+ constructor() {
30356
+ this.taskId = 0;
30357
+ this.collection = new Set();
30358
+ this.ngZone = inject(NgZone);
30359
+ this.completed = false;
30360
+ // Run outside of the Angular zone to avoid triggering
30361
+ // extra change detection cycles.
30362
+ this.ngZone.runOutsideAngular(() => {
30363
+ this.promise = new Promise((resolve) => {
30364
+ this.resolve = resolve;
30365
+ });
30366
+ });
30219
30367
  }
30220
- /**
30221
- * Directly update the value of the signal to a new value, which may or may not be
30222
- * equal to the previous.
30223
- *
30224
- * In the event that `newValue` is semantically equal to the current value, `set` is
30225
- * a no-op.
30226
- */
30227
- set(newValue) {
30228
- if (!this.equal(this.value, newValue)) {
30229
- this.value = newValue;
30230
- this.valueVersion++;
30231
- this.producerMayHaveChanged();
30368
+ add() {
30369
+ if (this.completed) {
30370
+ // Indicates that the task was added after
30371
+ // the task queue completion, so it's a noop.
30372
+ return -1;
30232
30373
  }
30374
+ const taskId = this.taskId++;
30375
+ this.collection.add(taskId);
30376
+ return taskId;
30233
30377
  }
30234
- /**
30235
- * Derive a new value for the signal from its current value using the `updater` function.
30236
- *
30237
- * This is equivalent to calling `set` on the result of running `updater` on the current
30238
- * value.
30239
- */
30240
- update(updater) {
30241
- this.set(updater(this.value));
30242
- }
30243
- /**
30244
- * Calls `mutator` on the current value and assumes that it has been mutated.
30245
- */
30246
- mutate(mutator) {
30247
- // Mutate bypasses equality checks as it's by definition changing the value.
30248
- mutator(this.value);
30249
- this.valueVersion++;
30250
- this.producerMayHaveChanged();
30378
+ remove(taskId) {
30379
+ if (this.completed)
30380
+ return;
30381
+ this.collection.delete(taskId);
30382
+ if (this.collection.size === 0) {
30383
+ // We've removed the last task, resolve the promise.
30384
+ this.completed = true;
30385
+ this.resolve();
30386
+ }
30251
30387
  }
30252
- signal() {
30253
- this.producerAccessed();
30254
- return this.value;
30388
+ ngOnDestroy() {
30389
+ this.completed = true;
30390
+ this.collection.clear();
30255
30391
  }
30392
+ static { this.ɵfac = function InitialRenderPendingTasks_Factory(t) { return new (t || InitialRenderPendingTasks)(); }; }
30393
+ static { this.ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: InitialRenderPendingTasks, factory: InitialRenderPendingTasks.ɵfac, providedIn: 'root' }); }
30256
30394
  }
30395
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(InitialRenderPendingTasks, [{
30396
+ type: Injectable,
30397
+ args: [{ providedIn: 'root' }]
30398
+ }], function () { return []; }, null); })();
30399
+
30257
30400
  /**
30258
- * Create a `Signal` that can be set or updated directly.
30259
- *
30260
- * @developerPreview
30401
+ * Indicates whether the hydration-related code was added,
30402
+ * prevents adding it multiple times.
30261
30403
  */
30262
- function signal(initialValue, options) {
30263
- const signalNode = new WritableSignalImpl(initialValue, options?.equal ?? defaultEquals);
30264
- // Casting here is required for g3, as TS inference behavior is slightly different between our
30265
- // version/options and g3's.
30266
- const signalFn = createSignalFromFunction(signalNode, signalNode.signal.bind(signalNode), {
30267
- set: signalNode.set.bind(signalNode),
30268
- update: signalNode.update.bind(signalNode),
30269
- mutate: signalNode.mutate.bind(signalNode),
30270
- });
30271
- return signalFn;
30272
- }
30273
-
30404
+ let isHydrationSupportEnabled = false;
30274
30405
  /**
30275
- * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function
30276
- * can, optionally, return a value.
30406
+ * Brings the necessary hydration code in tree-shakable manner.
30407
+ * The code is only present when the `provideHydrationSupport` is
30408
+ * invoked. Otherwise, this code is tree-shaken away during the
30409
+ * build optimization step.
30277
30410
  *
30278
- * @developerPreview
30411
+ * This technique allows us to swap implementations of methods so
30412
+ * tree shaking works appropriately when hydration is disabled or
30413
+ * enabled. It brings in the appropriate version of the method that
30414
+ * supports hydration only when enabled.
30279
30415
  */
30280
- function untracked(nonReactiveReadsFn) {
30281
- const prevConsumer = setActiveConsumer(null);
30282
- // We are not trying to catch any particular errors here, just making sure that the consumers
30283
- // stack is restored in case of errors.
30284
- try {
30285
- return nonReactiveReadsFn();
30286
- }
30287
- finally {
30288
- setActiveConsumer(prevConsumer);
30416
+ function enableHydrationRuntimeSupport() {
30417
+ if (!isHydrationSupportEnabled) {
30418
+ isHydrationSupportEnabled = true;
30419
+ enableRetrieveHydrationInfoImpl();
30420
+ enableLocateOrCreateElementNodeImpl();
30421
+ enableLocateOrCreateTextNodeImpl();
30422
+ enableLocateOrCreateElementContainerNodeImpl();
30423
+ enableLocateOrCreateContainerAnchorImpl();
30424
+ enableLocateOrCreateContainerRefImpl();
30425
+ enableFindMatchingDehydratedViewImpl();
30426
+ enableApplyRootElementTransformImpl();
30289
30427
  }
30290
30428
  }
30291
-
30292
- const NOOP_CLEANUP_FN = () => { };
30293
30429
  /**
30294
- * Watches a reactive expression and allows it to be scheduled to re-run
30295
- * when any dependencies notify of a change.
30430
+ * Detects whether the code is invoked in a browser.
30431
+ * Later on, this check should be replaced with a tree-shakable
30432
+ * flag (e.g. `!isServer`).
30433
+ */
30434
+ function isBrowser() {
30435
+ return inject(PLATFORM_ID) === 'browser';
30436
+ }
30437
+ /**
30438
+ * Outputs a message with hydration stats into a console.
30439
+ */
30440
+ function printHydrationStats(console) {
30441
+ const message = `Angular hydrated ${ngDevMode.hydratedComponents} component(s) ` +
30442
+ `and ${ngDevMode.hydratedNodes} node(s), ` +
30443
+ `${ngDevMode.componentsSkippedHydration} component(s) were skipped. ` +
30444
+ `Learn more at https://angular.io/guides/hydration.`;
30445
+ // tslint:disable-next-line:no-console
30446
+ console.log(message);
30447
+ }
30448
+ /**
30449
+ * Returns a Promise that is resolved when an application becomes stable.
30450
+ */
30451
+ function whenStable(appRef, pendingTasks) {
30452
+ const isStablePromise = appRef.isStable.pipe(first((isStable) => isStable)).toPromise();
30453
+ const pendingTasksPromise = pendingTasks.whenAllTasksComplete;
30454
+ return Promise.allSettled([isStablePromise, pendingTasksPromise]);
30455
+ }
30456
+ /**
30457
+ * Returns a set of providers required to setup hydration support
30458
+ * for an application that is server side rendered.
30296
30459
  *
30297
- * `Watch` doesn't run reactive expressions itself, but relies on a consumer-
30298
- * provided scheduling operation to coordinate calling `Watch.run()`.
30460
+ * ## NgModule-based bootstrap
30461
+ *
30462
+ * You can add the function call to the root AppModule of an application:
30463
+ * ```
30464
+ * import {provideHydrationSupport} from '@angular/core';
30465
+ *
30466
+ * @NgModule({
30467
+ * providers: [
30468
+ * // ... other providers ...
30469
+ * provideHydrationSupport()
30470
+ * ],
30471
+ * declarations: [AppComponent],
30472
+ * bootstrap: [AppComponent]
30473
+ * })
30474
+ * class AppModule {}
30475
+ * ```
30476
+ *
30477
+ * ## Standalone-based bootstrap
30478
+ *
30479
+ * Add the function to the `bootstrapApplication` call:
30480
+ * ```
30481
+ * import {provideHydrationSupport} from '@angular/core';
30482
+ *
30483
+ * bootstrapApplication(RootComponent, {
30484
+ * providers: [
30485
+ * // ... other providers ...
30486
+ * provideHydrationSupport()
30487
+ * ]
30488
+ * });
30489
+ * ```
30490
+ *
30491
+ * The function sets up an internal flag that would be recognized during
30492
+ * the server side rendering time as well, so there is no need to
30493
+ * configure or change anything in NgUniversal to enable the feature.
30494
+ *
30495
+ * @publicApi
30496
+ * @developerPreview
30299
30497
  */
30300
- class Watch extends ReactiveNode {
30301
- constructor(watch, schedule) {
30302
- super();
30303
- this.watch = watch;
30304
- this.schedule = schedule;
30305
- this.dirty = false;
30306
- this.cleanupFn = NOOP_CLEANUP_FN;
30307
- }
30308
- notify() {
30309
- if (!this.dirty) {
30310
- this.schedule(this);
30311
- }
30312
- this.dirty = true;
30313
- }
30314
- onConsumerDependencyMayHaveChanged() {
30315
- this.notify();
30316
- }
30317
- onProducerUpdateValueVersion() {
30318
- // Watches are not producers.
30319
- }
30320
- /**
30321
- * Execute the reactive expression in the context of this `Watch` consumer.
30322
- *
30323
- * Should be called by the user scheduling algorithm when the provided
30324
- * `schedule` hook is called by `Watch`.
30325
- */
30326
- run() {
30327
- this.dirty = false;
30328
- if (this.trackingVersion !== 0 && !this.consumerPollProducersForChange()) {
30329
- return;
30330
- }
30331
- const prevConsumer = setActiveConsumer(this);
30332
- this.trackingVersion++;
30333
- try {
30334
- this.cleanupFn();
30335
- this.cleanupFn = this.watch() ?? NOOP_CLEANUP_FN;
30336
- }
30337
- finally {
30338
- setActiveConsumer(prevConsumer);
30498
+ function provideHydrationSupport() {
30499
+ return makeEnvironmentProviders([
30500
+ {
30501
+ provide: ENVIRONMENT_INITIALIZER,
30502
+ useValue: () => {
30503
+ // Since this function is used across both server and client,
30504
+ // make sure that the runtime code is only added when invoked
30505
+ // on the client. Moving forward, the `isBrowser` check should
30506
+ // be replaced with a tree-shakable alternative (e.g. `isServer`
30507
+ // flag).
30508
+ if (isBrowser()) {
30509
+ enableHydrationRuntimeSupport();
30510
+ }
30511
+ },
30512
+ multi: true,
30513
+ },
30514
+ {
30515
+ provide: IS_HYDRATION_FEATURE_ENABLED,
30516
+ useValue: true,
30517
+ },
30518
+ {
30519
+ provide: PRESERVE_HOST_CONTENT,
30520
+ // Preserve host element content only in a browser
30521
+ // environment. On a server, an application is rendered
30522
+ // from scratch, so the host content needs to be empty.
30523
+ useFactory: () => isBrowser(),
30524
+ },
30525
+ {
30526
+ provide: APP_BOOTSTRAP_LISTENER,
30527
+ useFactory: () => {
30528
+ if (isBrowser()) {
30529
+ const appRef = inject(ApplicationRef);
30530
+ const pendingTasks = inject(InitialRenderPendingTasks);
30531
+ const console = inject(Console);
30532
+ return () => {
30533
+ whenStable(appRef, pendingTasks).then(() => {
30534
+ // Wait until an app becomes stable and cleanup all views that
30535
+ // were not claimed during the application bootstrap process.
30536
+ // The timing is similar to when we start the serialization process
30537
+ // on the server.
30538
+ cleanupDehydratedViews(appRef);
30539
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
30540
+ printHydrationStats(console);
30541
+ }
30542
+ });
30543
+ };
30544
+ }
30545
+ return () => { }; // noop
30546
+ },
30547
+ multi: true,
30339
30548
  }
30340
- }
30341
- cleanup() {
30342
- this.cleanupFn();
30343
- }
30549
+ ]);
30344
30550
  }
30345
30551
 
30346
30552
  /** Coerces a value (typically a string) to a boolean. */
@@ -30441,61 +30647,6 @@ function ɵɵngDeclarePipe(decl) {
30441
30647
  // clang-format off
30442
30648
  // clang-format on
30443
30649
 
30444
- const globalWatches = new Set();
30445
- const queuedWatches = new Map();
30446
- let watchQueuePromise = null;
30447
- /**
30448
- * Create a global `Effect` for the given reactive function.
30449
- *
30450
- * @developerPreview
30451
- */
30452
- function effect(effectFn, options) {
30453
- !options?.injector && assertInInjectionContext(effect);
30454
- const zone = Zone.current;
30455
- const watch = new Watch(effectFn, (watch) => queueWatch(watch, zone));
30456
- const injector = options?.injector ?? inject(Injector);
30457
- const destroyRef = options?.manualCleanup !== true ? injector.get(DestroyRef) : null;
30458
- globalWatches.add(watch);
30459
- // Effects start dirty.
30460
- watch.notify();
30461
- let unregisterOnDestroy;
30462
- const destroy = () => {
30463
- watch.cleanup();
30464
- unregisterOnDestroy?.();
30465
- queuedWatches.delete(watch);
30466
- globalWatches.delete(watch);
30467
- };
30468
- unregisterOnDestroy = destroyRef?.onDestroy(destroy);
30469
- return {
30470
- destroy,
30471
- };
30472
- }
30473
- function queueWatch(watch, zone) {
30474
- if (queuedWatches.has(watch) || !globalWatches.has(watch)) {
30475
- return;
30476
- }
30477
- queuedWatches.set(watch, zone);
30478
- if (watchQueuePromise === null) {
30479
- Promise.resolve().then(runWatchQueue);
30480
- let resolveFn;
30481
- const promise = new Promise((resolve) => {
30482
- resolveFn = resolve;
30483
- });
30484
- watchQueuePromise = {
30485
- promise,
30486
- resolveFn,
30487
- };
30488
- }
30489
- }
30490
- function runWatchQueue() {
30491
- for (const [watch, zone] of queuedWatches) {
30492
- queuedWatches.delete(watch);
30493
- zone.run(() => watch.run());
30494
- }
30495
- watchQueuePromise.resolveFn();
30496
- watchQueuePromise = null;
30497
- }
30498
-
30499
30650
  // clang-format off
30500
30651
  // clang-format on
30501
30652
 
@@ -30682,5 +30833,5 @@ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
30682
30833
  * Generated bundle index. Do not edit.
30683
30834
  */
30684
30835
 
30685
- export { ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CSP_NONCE, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, DestroyRef, Directive, ENVIRONMENT_INITIALIZER, ElementRef, EmbeddedViewRef, EnvironmentInjector, ErrorHandler, EventEmitter, Host, HostBinding, HostListener, INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, NgProbeToken, NgZone, Optional, Output, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, Pipe, PlatformRef, Query, QueryList, ReflectiveInjector, ReflectiveKey, Renderer2, RendererFactory2, RendererStyleFlags2, ResolvedReflectiveFactory, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, TransferState, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation$1 as ViewEncapsulation, ViewRef, asNativeElements, assertInInjectionContext, assertPlatform, computed, createComponent, createEnvironmentInjector, createNgModule, createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, effect, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, importProvidersFrom, inject, isDevMode, isSignal, isStandalone, makeEnvironmentProviders, makeStateKey, mergeApplicationConfig, platformCore, reflectComponentType, resolveForwardRef, runInInjectionContext, setTestabilityGetter, signal, untracked, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, ComponentFactory$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, IS_HYDRATION_FEATURE_ENABLED as ɵIS_HYDRATION_FEATURE_ENABLED, InitialRenderPendingTasks as ɵInitialRenderPendingTasks, LContext as ɵLContext, LifecycleHooksFeature as ɵLifecycleHooksFeature, LocaleDataIndex as ɵLocaleDataIndex, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, ViewRef$1 as ɵViewRef, XSS_SECURITY_URL as ɵXSS_SECURITY_URL, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, annotateForHydration as ɵannotateForHydration, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, coerceToBoolean as ɵcoerceToBoolean, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory as ɵcompileNgModuleFactory, compilePipe as ɵcompilePipe, convertToBitFlags as ɵconvertToBitFlags, createInjector as ɵcreateInjector, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, detectChanges as ɵdetectChanges, devModeEqual as ɵdevModeEqual, escapeTransferStateContent as ɵescapeTransferStateContent, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, formatRuntimeError as ɵformatRuntimeError, getDebugNode as ɵgetDebugNode, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getSanitizationBypassType as ɵgetSanitizationBypassType, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, _global as ɵglobal, injectChangeDetectorRef as ɵinjectChangeDetectorRef, internalCreateApplication as ɵinternalCreateApplication, isBoundToModule as ɵisBoundToModule, isEnvironmentProviders as ɵisEnvironmentProviders, isInjectable as ɵisInjectable, isNgModule as ɵisNgModule, isPromise as ɵisPromise, isSubscribable as ɵisSubscribable, makeDecorator as ɵmakeDecorator, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, provideHydrationSupport as ɵprovideHydrationSupport, provideNgZoneChangeDetection as ɵprovideNgZoneChangeDetection, publishDefaultGlobalUtils$1 as ɵpublishDefaultGlobalUtils, publishGlobalUtil as ɵpublishGlobalUtil, registerLocaleData as ɵregisterLocaleData, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, setAlternateWeakRefImpl as ɵsetAlternateWeakRefImpl, setClassMetadata as ɵsetClassMetadata, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setLocaleId as ɵsetLocaleId, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, store as ɵstore, stringify as ɵstringify, transitiveScopesFor as ɵtransitiveScopesFor, unescapeTransferStateContent as ɵunescapeTransferStateContent, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, ɵɵCopyDefinitionFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵHostDirectivesFeature, ɵɵInheritDefinitionFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵStandaloneFeature, ɵɵadvance, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcontentQuery, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryRefresh, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵresetView, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵvalidateIframeAttribute, ɵɵviewQuery };
30836
+ export { ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CSP_NONCE, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, DestroyRef, Directive, ENVIRONMENT_INITIALIZER, ElementRef, EmbeddedViewRef, EnvironmentInjector, ErrorHandler, EventEmitter, Host, HostBinding, HostListener, INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, NgProbeToken, NgZone, Optional, Output, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, Pipe, PlatformRef, Query, QueryList, ReflectiveInjector, ReflectiveKey, Renderer2, RendererFactory2, RendererStyleFlags2, ResolvedReflectiveFactory, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, TransferState, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation$1 as ViewEncapsulation, ViewRef, asNativeElements, assertInInjectionContext, assertPlatform, computed, createComponent, createEnvironmentInjector, createNgModule, createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, effect, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, importProvidersFrom, inject, isDevMode, isSignal, isStandalone, makeEnvironmentProviders, makeStateKey, mergeApplicationConfig, platformCore, provideZoneChangeDetection, reflectComponentType, resolveForwardRef, runInInjectionContext, setTestabilityGetter, signal, untracked, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, ComponentFactory$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, IS_HYDRATION_FEATURE_ENABLED as ɵIS_HYDRATION_FEATURE_ENABLED, InitialRenderPendingTasks as ɵInitialRenderPendingTasks, LContext as ɵLContext, LifecycleHooksFeature as ɵLifecycleHooksFeature, LocaleDataIndex as ɵLocaleDataIndex, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, ViewRef$1 as ɵViewRef, XSS_SECURITY_URL as ɵXSS_SECURITY_URL, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, annotateForHydration as ɵannotateForHydration, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, coerceToBoolean as ɵcoerceToBoolean, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory as ɵcompileNgModuleFactory, compilePipe as ɵcompilePipe, convertToBitFlags as ɵconvertToBitFlags, createInjector as ɵcreateInjector, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, detectChanges as ɵdetectChanges, devModeEqual as ɵdevModeEqual, escapeTransferStateContent as ɵescapeTransferStateContent, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, formatRuntimeError as ɵformatRuntimeError, getDebugNode as ɵgetDebugNode, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getSanitizationBypassType as ɵgetSanitizationBypassType, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, _global as ɵglobal, injectChangeDetectorRef as ɵinjectChangeDetectorRef, internalCreateApplication as ɵinternalCreateApplication, isBoundToModule as ɵisBoundToModule, isEnvironmentProviders as ɵisEnvironmentProviders, isInjectable as ɵisInjectable, isNgModule as ɵisNgModule, isPromise as ɵisPromise, isSubscribable as ɵisSubscribable, makeDecorator as ɵmakeDecorator, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, provideHydrationSupport as ɵprovideHydrationSupport, publishDefaultGlobalUtils$1 as ɵpublishDefaultGlobalUtils, publishGlobalUtil as ɵpublishGlobalUtil, registerLocaleData as ɵregisterLocaleData, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, setAlternateWeakRefImpl as ɵsetAlternateWeakRefImpl, setClassMetadata as ɵsetClassMetadata, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setLocaleId as ɵsetLocaleId, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, store as ɵstore, stringify as ɵstringify, transitiveScopesFor as ɵtransitiveScopesFor, unescapeTransferStateContent as ɵunescapeTransferStateContent, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, ɵɵCopyDefinitionFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵHostDirectivesFeature, ɵɵInheritDefinitionFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵStandaloneFeature, ɵɵadvance, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcontentQuery, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryRefresh, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵresetView, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵvalidateIframeAttribute, ɵɵviewQuery };
30686
30837
  //# sourceMappingURL=core.mjs.map