@angular/core 18.1.0-next.0 → 18.1.0-next.2

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 (48) hide show
  1. package/esm2022/primitives/event-dispatch/index.mjs +2 -1
  2. package/esm2022/primitives/event-dispatch/src/dispatcher.mjs +4 -3
  3. package/esm2022/primitives/event-dispatch/src/event_dispatcher.mjs +4 -6
  4. package/esm2022/primitives/event-dispatch/src/event_type.mjs +2 -2
  5. package/esm2022/primitives/signals/src/graph.mjs +6 -5
  6. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +2 -4
  7. package/esm2022/src/core.mjs +1 -1
  8. package/esm2022/src/core_private_export.mjs +2 -2
  9. package/esm2022/src/event_delegation_utils.mjs +68 -0
  10. package/esm2022/src/event_emitter.mjs +20 -11
  11. package/esm2022/src/hydration/annotate.mjs +18 -7
  12. package/esm2022/src/hydration/api.mjs +2 -2
  13. package/esm2022/src/hydration/event_replay.mjs +46 -69
  14. package/esm2022/src/hydration/tokens.mjs +6 -1
  15. package/esm2022/src/pending_tasks.mjs +15 -20
  16. package/esm2022/src/render3/after_render_hooks.mjs +67 -132
  17. package/esm2022/src/render3/component_ref.mjs +1 -1
  18. package/esm2022/src/render3/instructions/change_detection.mjs +27 -24
  19. package/esm2022/src/render3/instructions/listener.mjs +5 -5
  20. package/esm2022/src/render3/instructions/shared.mjs +3 -3
  21. package/esm2022/src/render3/reactive_lview_consumer.mjs +56 -3
  22. package/esm2022/src/version.mjs +1 -1
  23. package/esm2022/testing/src/logger.mjs +3 -3
  24. package/fesm2022/core.mjs +474 -432
  25. package/fesm2022/core.mjs.map +1 -1
  26. package/fesm2022/primitives/event-dispatch.mjs +9 -10
  27. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  28. package/fesm2022/primitives/signals.mjs +6 -5
  29. package/fesm2022/primitives/signals.mjs.map +1 -1
  30. package/fesm2022/rxjs-interop.mjs +1 -1
  31. package/fesm2022/testing.mjs +1 -1
  32. package/index.d.ts +218 -28
  33. package/package.json +2 -2
  34. package/primitives/event-dispatch/index.d.ts +66 -1
  35. package/primitives/signals/index.d.ts +1 -1
  36. package/rxjs-interop/index.d.ts +1 -1
  37. package/schematics/migrations/after-render-phase/bundle.js +602 -0
  38. package/schematics/migrations/after-render-phase/bundle.js.map +7 -0
  39. package/schematics/migrations/http-providers/bundle.js +10 -2
  40. package/schematics/migrations/http-providers/bundle.js.map +2 -2
  41. package/schematics/migrations/invalid-two-way-bindings/bundle.js +177 -8
  42. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +3 -3
  43. package/schematics/migrations.json +5 -0
  44. package/schematics/ng-generate/control-flow-migration/bundle.js +192 -16
  45. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  46. package/schematics/ng-generate/standalone-migration/bundle.js +9197 -9490
  47. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  48. package/testing/index.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.0
2
+ * @license Angular v18.1.0-next.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -264,8 +264,7 @@ function consumerDestroy(node) {
264
264
  */
265
265
  function producerAddLiveConsumer(node, consumer, indexOfThis) {
266
266
  assertProducerNode(node);
267
- assertConsumerNode(node);
268
- if (node.liveConsumerNode.length === 0) {
267
+ if (node.liveConsumerNode.length === 0 && isConsumerNode(node)) {
269
268
  // When going from 0 to 1 live consumers, we become a live consumer to our producers.
270
269
  for (let i = 0; i < node.producerNode.length; i++) {
271
270
  node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i);
@@ -279,11 +278,10 @@ function producerAddLiveConsumer(node, consumer, indexOfThis) {
279
278
  */
280
279
  function producerRemoveLiveConsumerAtIndex(node, idx) {
281
280
  assertProducerNode(node);
282
- assertConsumerNode(node);
283
281
  if (typeof ngDevMode !== 'undefined' && ngDevMode && idx >= node.liveConsumerNode.length) {
284
282
  throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`);
285
283
  }
286
- if (node.liveConsumerNode.length === 1) {
284
+ if (node.liveConsumerNode.length === 1 && isConsumerNode(node)) {
287
285
  // When removing the last live consumer, we will no longer be live. We need to remove
288
286
  // ourselves from our producers' tracking (which may cause consumer-producers to lose
289
287
  // liveness as well).
@@ -320,6 +318,9 @@ function assertProducerNode(node) {
320
318
  node.liveConsumerNode ??= [];
321
319
  node.liveConsumerIndexOfThis ??= [];
322
320
  }
321
+ function isConsumerNode(node) {
322
+ return node.producerNode !== undefined;
323
+ }
323
324
 
324
325
  /**
325
326
  * Create a computed signal which derives a reactive value from an expression.
@@ -1 +1 @@
1
- {"version":3,"file":"signals.mjs","sources":["../../../../../../../packages/core/primitives/signals/src/equality.ts","../../../../../../../packages/core/primitives/signals/src/graph.ts","../../../../../../../packages/core/primitives/signals/src/computed.ts","../../../../../../../packages/core/primitives/signals/src/errors.ts","../../../../../../../packages/core/primitives/signals/src/signal.ts","../../../../../../../packages/core/primitives/signals/src/watch.ts","../../../../../../../packages/core/primitives/signals/src/weak_ref.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * A comparison function which can determine if two values are equal.\n */\nexport type ValueEqualityFn<T> = (a: T, b: T) => boolean;\n\n/**\n * The default equality function used for `signal` and `computed`, which uses referential equality.\n */\nexport function defaultEquals<T>(a: T, b: T) {\n return Object.is(a, b);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * The currently active consumer `ReactiveNode`, if running code in a reactive context.\n *\n * Change this via `setActiveConsumer`.\n */\nlet activeConsumer: ReactiveNode | null = null;\nlet inNotificationPhase = false;\n\ntype Version = number & {__brand: 'Version'};\n\n/**\n * Global epoch counter. Incremented whenever a source signal is set.\n */\nlet epoch: Version = 1 as Version;\n\n/**\n * Symbol used to tell `Signal`s apart from other functions.\n *\n * This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.\n */\nexport const SIGNAL = /* @__PURE__ */ Symbol('SIGNAL');\n\nexport function setActiveConsumer(consumer: ReactiveNode | null): ReactiveNode | null {\n const prev = activeConsumer;\n activeConsumer = consumer;\n return prev;\n}\n\nexport function getActiveConsumer(): ReactiveNode | null {\n return activeConsumer;\n}\n\nexport function isInNotificationPhase(): boolean {\n return inNotificationPhase;\n}\n\nexport interface Reactive {\n [SIGNAL]: ReactiveNode;\n}\n\nexport function isReactive(value: unknown): value is Reactive {\n return (value as Partial<Reactive>)[SIGNAL] !== undefined;\n}\n\nexport const REACTIVE_NODE: ReactiveNode = {\n version: 0 as Version,\n lastCleanEpoch: 0 as Version,\n dirty: false,\n producerNode: undefined,\n producerLastReadVersion: undefined,\n producerIndexOfThis: undefined,\n nextProducerIndex: 0,\n liveConsumerNode: undefined,\n liveConsumerIndexOfThis: undefined,\n consumerAllowSignalWrites: false,\n consumerIsAlwaysLive: false,\n producerMustRecompute: () => false,\n producerRecomputeValue: () => {},\n consumerMarkedDirty: () => {},\n consumerOnSignalRead: () => {},\n};\n\n/**\n * A producer and/or consumer which participates in the reactive graph.\n *\n * Producer `ReactiveNode`s which are accessed when a consumer `ReactiveNode` is the\n * `activeConsumer` are tracked as dependencies of that consumer.\n *\n * Certain consumers are also tracked as \"live\" consumers and create edges in the other direction,\n * from producer to consumer. These edges are used to propagate change notifications when a\n * producer's value is updated.\n *\n * A `ReactiveNode` may be both a producer and consumer.\n */\nexport interface ReactiveNode {\n /**\n * Version of the value that this node produces.\n *\n * This is incremented whenever a new value is produced by this node which is not equal to the\n * previous value (by whatever definition of equality is in use).\n */\n version: Version;\n\n /**\n * Epoch at which this node is verified to be clean.\n *\n * This allows skipping of some polling operations in the case where no signals have been set\n * since this node was last read.\n */\n lastCleanEpoch: Version;\n\n /**\n * Whether this node (in its consumer capacity) is dirty.\n *\n * Only live consumers become dirty, when receiving a change notification from a dependency\n * producer.\n */\n dirty: boolean;\n\n /**\n * Producers which are dependencies of this consumer.\n *\n * Uses the same indices as the `producerLastReadVersion` and `producerIndexOfThis` arrays.\n */\n producerNode: ReactiveNode[] | undefined;\n\n /**\n * `Version` of the value last read by a given producer.\n *\n * Uses the same indices as the `producerNode` and `producerIndexOfThis` arrays.\n */\n producerLastReadVersion: Version[] | undefined;\n\n /**\n * Index of `this` (consumer) in each producer's `liveConsumers` array.\n *\n * This value is only meaningful if this node is live (`liveConsumers.length > 0`). Otherwise\n * these indices are stale.\n *\n * Uses the same indices as the `producerNode` and `producerLastReadVersion` arrays.\n */\n producerIndexOfThis: number[] | undefined;\n\n /**\n * Index into the producer arrays that the next dependency of this node as a consumer will use.\n *\n * This index is zeroed before this node as a consumer begins executing. When a producer is read,\n * it gets inserted into the producers arrays at this index. There may be an existing dependency\n * in this location which may or may not match the incoming producer, depending on whether the\n * same producers were read in the same order as the last computation.\n */\n nextProducerIndex: number;\n\n /**\n * Array of consumers of this producer that are \"live\" (they require push notifications).\n *\n * `liveConsumerNode.length` is effectively our reference count for this node.\n */\n liveConsumerNode: ReactiveNode[] | undefined;\n\n /**\n * Index of `this` (producer) in each consumer's `producerNode` array.\n *\n * Uses the same indices as the `liveConsumerNode` array.\n */\n liveConsumerIndexOfThis: number[] | undefined;\n\n /**\n * Whether writes to signals are allowed when this consumer is the `activeConsumer`.\n *\n * This is used to enforce guardrails such as preventing writes to writable signals in the\n * computation function of computed signals, which is supposed to be pure.\n */\n consumerAllowSignalWrites: boolean;\n\n readonly consumerIsAlwaysLive: boolean;\n\n /**\n * Tracks whether producers need to recompute their value independently of the reactive graph (for\n * example, if no initial value has been computed).\n */\n producerMustRecompute(node: unknown): boolean;\n producerRecomputeValue(node: unknown): void;\n consumerMarkedDirty(node: unknown): void;\n\n /**\n * Called when a signal is read within this consumer.\n */\n consumerOnSignalRead(node: unknown): void;\n}\n\ninterface ConsumerNode extends ReactiveNode {\n producerNode: NonNullable<ReactiveNode['producerNode']>;\n producerIndexOfThis: NonNullable<ReactiveNode['producerIndexOfThis']>;\n producerLastReadVersion: NonNullable<ReactiveNode['producerLastReadVersion']>;\n}\n\ninterface ProducerNode extends ReactiveNode {\n liveConsumerNode: NonNullable<ReactiveNode['liveConsumerNode']>;\n liveConsumerIndexOfThis: NonNullable<ReactiveNode['liveConsumerIndexOfThis']>;\n}\n\n/**\n * Called by implementations when a producer's signal is read.\n */\nexport function producerAccessed(node: ReactiveNode): void {\n if (inNotificationPhase) {\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode\n ? `Assertion error: signal read during notification phase`\n : '',\n );\n }\n\n if (activeConsumer === null) {\n // Accessed outside of a reactive context, so nothing to record.\n return;\n }\n\n activeConsumer.consumerOnSignalRead(node);\n\n // This producer is the `idx`th dependency of `activeConsumer`.\n const idx = activeConsumer.nextProducerIndex++;\n\n assertConsumerNode(activeConsumer);\n\n if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) {\n // There's been a change in producers since the last execution of `activeConsumer`.\n // `activeConsumer.producerNode[idx]` holds a stale dependency which will be be removed and\n // replaced with `this`.\n //\n // If `activeConsumer` isn't live, then this is a no-op, since we can replace the producer in\n // `activeConsumer.producerNode` directly. However, if `activeConsumer` is live, then we need\n // to remove it from the stale producer's `liveConsumer`s.\n if (consumerIsLive(activeConsumer)) {\n const staleProducer = activeConsumer.producerNode[idx];\n producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]);\n\n // At this point, the only record of `staleProducer` is the reference at\n // `activeConsumer.producerNode[idx]` which will be overwritten below.\n }\n }\n\n if (activeConsumer.producerNode[idx] !== node) {\n // We're a new dependency of the consumer (at `idx`).\n activeConsumer.producerNode[idx] = node;\n\n // If the active consumer is live, then add it as a live consumer. If not, then use 0 as a\n // placeholder value.\n activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer)\n ? producerAddLiveConsumer(node, activeConsumer, idx)\n : 0;\n }\n activeConsumer.producerLastReadVersion[idx] = node.version;\n}\n\n/**\n * Increment the global epoch counter.\n *\n * Called by source producers (that is, not computeds) whenever their values change.\n */\nexport function producerIncrementEpoch(): void {\n epoch++;\n}\n\n/**\n * Ensure this producer's `version` is up-to-date.\n */\nexport function producerUpdateValueVersion(node: ReactiveNode): void {\n if (consumerIsLive(node) && !node.dirty) {\n // A live consumer will be marked dirty by producers, so a clean state means that its version\n // is guaranteed to be up-to-date.\n return;\n }\n\n if (!node.dirty && node.lastCleanEpoch === epoch) {\n // Even non-live consumers can skip polling if they previously found themselves to be clean at\n // the current epoch, since their dependencies could not possibly have changed (such a change\n // would've increased the epoch).\n return;\n }\n\n if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {\n // None of our producers report a change since the last time they were read, so no\n // recomputation of our value is necessary, and we can consider ourselves clean.\n node.dirty = false;\n node.lastCleanEpoch = epoch;\n return;\n }\n\n node.producerRecomputeValue(node);\n\n // After recomputing the value, we're no longer dirty.\n node.dirty = false;\n node.lastCleanEpoch = epoch;\n}\n\n/**\n * Propagate a dirty notification to live consumers of this producer.\n */\nexport function producerNotifyConsumers(node: ReactiveNode): void {\n if (node.liveConsumerNode === undefined) {\n return;\n }\n\n // Prevent signal reads when we're updating the graph\n const prev = inNotificationPhase;\n inNotificationPhase = true;\n try {\n for (const consumer of node.liveConsumerNode) {\n if (!consumer.dirty) {\n consumerMarkDirty(consumer);\n }\n }\n } finally {\n inNotificationPhase = prev;\n }\n}\n\n/**\n * Whether this `ReactiveNode` in its producer capacity is currently allowed to initiate updates,\n * based on the current consumer context.\n */\nexport function producerUpdatesAllowed(): boolean {\n return activeConsumer?.consumerAllowSignalWrites !== false;\n}\n\nexport function consumerMarkDirty(node: ReactiveNode): void {\n node.dirty = true;\n producerNotifyConsumers(node);\n node.consumerMarkedDirty?.(node);\n}\n\n/**\n * Prepare this consumer to run a computation in its reactive context.\n *\n * Must be called by subclasses which represent reactive computations, before those computations\n * begin.\n */\nexport function consumerBeforeComputation(node: ReactiveNode | null): ReactiveNode | null {\n node && (node.nextProducerIndex = 0);\n return setActiveConsumer(node);\n}\n\n/**\n * Finalize this consumer's state after a reactive computation has run.\n *\n * Must be called by subclasses which represent reactive computations, after those computations\n * have finished.\n */\nexport function consumerAfterComputation(\n node: ReactiveNode | null,\n prevConsumer: ReactiveNode | null,\n): void {\n setActiveConsumer(prevConsumer);\n\n if (\n !node ||\n node.producerNode === undefined ||\n node.producerIndexOfThis === undefined ||\n node.producerLastReadVersion === undefined\n ) {\n return;\n }\n\n if (consumerIsLive(node)) {\n // For live consumers, we need to remove the producer -> consumer edge for any stale producers\n // which weren't dependencies after the recomputation.\n for (let i = node.nextProducerIndex; i < node.producerNode.length; i++) {\n producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);\n }\n }\n\n // Truncate the producer tracking arrays.\n // Perf note: this is essentially truncating the length to `node.nextProducerIndex`, but\n // benchmarking has shown that individual pop operations are faster.\n while (node.producerNode.length > node.nextProducerIndex) {\n node.producerNode.pop();\n node.producerLastReadVersion.pop();\n node.producerIndexOfThis.pop();\n }\n}\n\n/**\n * Determine whether this consumer has any dependencies which have changed since the last time\n * they were read.\n */\nexport function consumerPollProducersForChange(node: ReactiveNode): boolean {\n assertConsumerNode(node);\n\n // Poll producers for change.\n for (let i = 0; i < node.producerNode.length; i++) {\n const producer = node.producerNode[i];\n const seenVersion = node.producerLastReadVersion[i];\n\n // First check the versions. A mismatch means that the producer's value is known to have\n // changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n\n // The producer's version is the same as the last time we read it, but it might itself be\n // stale. Force the producer to recompute its version (calculating a new value if necessary).\n producerUpdateValueVersion(producer);\n\n // Now when we do this check, `producer.version` is guaranteed to be up to date, so if the\n // versions still match then it has not changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Disconnect this consumer from the graph.\n */\nexport function consumerDestroy(node: ReactiveNode): void {\n assertConsumerNode(node);\n if (consumerIsLive(node)) {\n // Drop all connections from the graph to this node.\n for (let i = 0; i < node.producerNode.length; i++) {\n producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);\n }\n }\n\n // Truncate all the arrays to drop all connection from this node to the graph.\n node.producerNode.length =\n node.producerLastReadVersion.length =\n node.producerIndexOfThis.length =\n 0;\n if (node.liveConsumerNode) {\n node.liveConsumerNode.length = node.liveConsumerIndexOfThis!.length = 0;\n }\n}\n\n/**\n * Add `consumer` as a live consumer of this node.\n *\n * Note that this operation is potentially transitive. If this node becomes live, then it becomes\n * a live consumer of all of its current producers.\n */\nfunction producerAddLiveConsumer(\n node: ReactiveNode,\n consumer: ReactiveNode,\n indexOfThis: number,\n): number {\n assertProducerNode(node);\n assertConsumerNode(node);\n if (node.liveConsumerNode.length === 0) {\n // When going from 0 to 1 live consumers, we become a live consumer to our producers.\n for (let i = 0; i < node.producerNode.length; i++) {\n node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i);\n }\n }\n node.liveConsumerIndexOfThis.push(indexOfThis);\n return node.liveConsumerNode.push(consumer) - 1;\n}\n\n/**\n * Remove the live consumer at `idx`.\n */\nfunction producerRemoveLiveConsumerAtIndex(node: ReactiveNode, idx: number): void {\n assertProducerNode(node);\n assertConsumerNode(node);\n\n if (typeof ngDevMode !== 'undefined' && ngDevMode && idx >= node.liveConsumerNode.length) {\n throw new Error(\n `Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`,\n );\n }\n\n if (node.liveConsumerNode.length === 1) {\n // When removing the last live consumer, we will no longer be live. We need to remove\n // ourselves from our producers' tracking (which may cause consumer-producers to lose\n // liveness as well).\n for (let i = 0; i < node.producerNode.length; i++) {\n producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);\n }\n }\n\n // Move the last value of `liveConsumers` into `idx`. Note that if there's only a single\n // live consumer, this is a no-op.\n const lastIdx = node.liveConsumerNode.length - 1;\n node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx];\n node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];\n\n // Truncate the array.\n node.liveConsumerNode.length--;\n node.liveConsumerIndexOfThis.length--;\n\n // If the index is still valid, then we need to fix the index pointer from the producer to this\n // consumer, and update it from `lastIdx` to `idx` (accounting for the move above).\n if (idx < node.liveConsumerNode.length) {\n const idxProducer = node.liveConsumerIndexOfThis[idx];\n const consumer = node.liveConsumerNode[idx];\n assertConsumerNode(consumer);\n consumer.producerIndexOfThis[idxProducer] = idx;\n }\n}\n\nfunction consumerIsLive(node: ReactiveNode): boolean {\n return node.consumerIsAlwaysLive || (node?.liveConsumerNode?.length ?? 0) > 0;\n}\n\nfunction assertConsumerNode(node: ReactiveNode): asserts node is ConsumerNode {\n node.producerNode ??= [];\n node.producerIndexOfThis ??= [];\n node.producerLastReadVersion ??= [];\n}\n\nfunction assertProducerNode(node: ReactiveNode): asserts node is ProducerNode {\n node.liveConsumerNode ??= [];\n node.liveConsumerIndexOfThis ??= [];\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n producerAccessed,\n producerUpdateValueVersion,\n REACTIVE_NODE,\n ReactiveNode,\n SIGNAL,\n} from './graph';\n\n/**\n * A computation, which derives a value from a declarative reactive expression.\n *\n * `Computed`s are both producers and consumers of reactivity.\n */\nexport interface ComputedNode<T> extends ReactiveNode {\n /**\n * Current value of the computation, or one of the sentinel values above (`UNSET`, `COMPUTING`,\n * `ERROR`).\n */\n value: T;\n\n /**\n * If `value` is `ERRORED`, the error caught from the last computation attempt which will\n * be re-thrown.\n */\n error: unknown;\n\n /**\n * The computation function which will produce a new value.\n */\n computation: () => T;\n\n equal: ValueEqualityFn<T>;\n}\n\nexport type ComputedGetter<T> = (() => T) & {\n [SIGNAL]: ComputedNode<T>;\n};\n\n/**\n * Create a computed signal which derives a reactive value from an expression.\n */\nexport function createComputed<T>(computation: () => T): ComputedGetter<T> {\n const node: ComputedNode<T> = Object.create(COMPUTED_NODE);\n node.computation = computation;\n\n const computed = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n\n // Record that someone looked at this signal.\n producerAccessed(node);\n\n if (node.value === ERRORED) {\n throw node.error;\n }\n\n return node.value;\n };\n (computed as ComputedGetter<T>)[SIGNAL] = node;\n return computed as unknown as ComputedGetter<T>;\n}\n\n/**\n * A dedicated symbol used before a computed value has been calculated for the first time.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nconst UNSET: any = /* @__PURE__ */ Symbol('UNSET');\n\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * is in progress. Used to detect cycles in computation chains.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nconst COMPUTING: any = /* @__PURE__ */ Symbol('COMPUTING');\n\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * failed. The thrown error is cached until the computation gets dirty again.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nconst ERRORED: any = /* @__PURE__ */ Symbol('ERRORED');\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst COMPUTED_NODE = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n\n producerMustRecompute(node: ComputedNode<unknown>): boolean {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n\n producerRecomputeValue(node: ComputedNode<unknown>): void {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error('Detected cycle in computations.');\n }\n\n const oldValue = node.value;\n node.value = COMPUTING;\n\n const prevConsumer = consumerBeforeComputation(node);\n let newValue: unknown;\n try {\n newValue = node.computation();\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n\n if (\n oldValue !== UNSET &&\n oldValue !== ERRORED &&\n newValue !== ERRORED &&\n node.equal(oldValue, newValue)\n ) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n\n node.value = newValue;\n node.version++;\n },\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nfunction defaultThrowError(): never {\n throw new Error();\n}\n\nlet throwInvalidWriteToSignalErrorFn = defaultThrowError;\n\nexport function throwInvalidWriteToSignalError() {\n throwInvalidWriteToSignalErrorFn();\n}\n\nexport function setThrowInvalidWriteToSignalError(fn: () => never): void {\n throwInvalidWriteToSignalErrorFn = fn;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {throwInvalidWriteToSignalError} from './errors';\nimport {\n producerAccessed,\n producerIncrementEpoch,\n producerNotifyConsumers,\n producerUpdatesAllowed,\n REACTIVE_NODE,\n ReactiveNode,\n SIGNAL,\n} from './graph';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * If set, called after `WritableSignal`s are updated.\n *\n * This hook can be used to achieve various effects, such as running effects synchronously as part\n * of setting a signal.\n */\nlet postSignalSetFn: (() => void) | null = null;\n\nexport interface SignalNode<T> extends ReactiveNode {\n value: T;\n equal: ValueEqualityFn<T>;\n}\n\nexport type SignalBaseGetter<T> = (() => T) & {readonly [SIGNAL]: unknown};\n\n// Note: Closure *requires* this to be an `interface` and not a type, which is why the\n// `SignalBaseGetter` type exists to provide the correct shape.\nexport interface SignalGetter<T> extends SignalBaseGetter<T> {\n readonly [SIGNAL]: SignalNode<T>;\n}\n\n/**\n * Create a `Signal` that can be set or updated directly.\n */\nexport function createSignal<T>(initialValue: T): SignalGetter<T> {\n const node: SignalNode<T> = Object.create(SIGNAL_NODE);\n node.value = initialValue;\n const getter = (() => {\n producerAccessed(node);\n return node.value;\n }) as SignalGetter<T>;\n (getter as any)[SIGNAL] = node;\n return getter;\n}\n\nexport function setPostSignalSetFn(fn: (() => void) | null): (() => void) | null {\n const prev = postSignalSetFn;\n postSignalSetFn = fn;\n return prev;\n}\n\nexport function signalGetFn<T>(this: SignalNode<T>): T {\n producerAccessed(this);\n return this.value;\n}\n\nexport function signalSetFn<T>(node: SignalNode<T>, newValue: T) {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError();\n }\n\n if (!node.equal(node.value, newValue)) {\n node.value = newValue;\n signalValueChanged(node);\n }\n}\n\nexport function signalUpdateFn<T>(node: SignalNode<T>, updater: (value: T) => T): void {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError();\n }\n\n signalSetFn(node, updater(node.value));\n}\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nexport const SIGNAL_NODE: SignalNode<unknown> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n equal: defaultEquals,\n value: undefined,\n };\n})();\n\nfunction signalValueChanged<T>(node: SignalNode<T>): void {\n node.version++;\n producerIncrementEpoch();\n producerNotifyConsumers(node);\n postSignalSetFn?.();\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n consumerDestroy,\n consumerMarkDirty,\n consumerPollProducersForChange,\n isInNotificationPhase,\n REACTIVE_NODE,\n ReactiveNode,\n SIGNAL,\n} from './graph';\n\n/**\n * A cleanup function that can be optionally registered from the watch logic. If registered, the\n * cleanup logic runs before the next watch execution.\n */\nexport type WatchCleanupFn = () => void;\n\n/**\n * A callback passed to the watch function that makes it possible to register cleanup logic.\n */\nexport type WatchCleanupRegisterFn = (cleanupFn: WatchCleanupFn) => void;\n\nexport interface Watch {\n notify(): void;\n\n /**\n * Execute the reactive expression in the context of this `Watch` consumer.\n *\n * Should be called by the user scheduling algorithm when the provided\n * `schedule` hook is called by `Watch`.\n */\n run(): void;\n\n cleanup(): void;\n\n /**\n * Destroy the watcher:\n * - disconnect it from the reactive graph;\n * - mark it as destroyed so subsequent run and notify operations are noop.\n */\n destroy(): void;\n\n [SIGNAL]: WatchNode;\n}\nexport interface WatchNode extends ReactiveNode {\n hasRun: boolean;\n fn: ((onCleanup: WatchCleanupRegisterFn) => void) | null;\n schedule: ((watch: Watch) => void) | null;\n cleanupFn: WatchCleanupFn;\n ref: Watch;\n}\n\nexport function createWatch(\n fn: (onCleanup: WatchCleanupRegisterFn) => void,\n schedule: (watch: Watch) => void,\n allowSignalWrites: boolean,\n): Watch {\n const node: WatchNode = Object.create(WATCH_NODE);\n if (allowSignalWrites) {\n node.consumerAllowSignalWrites = true;\n }\n\n node.fn = fn;\n node.schedule = schedule;\n\n const registerOnCleanup = (cleanupFn: WatchCleanupFn) => {\n node.cleanupFn = cleanupFn;\n };\n\n function isWatchNodeDestroyed(node: WatchNode) {\n return node.fn === null && node.schedule === null;\n }\n\n function destroyWatchNode(node: WatchNode) {\n if (!isWatchNodeDestroyed(node)) {\n consumerDestroy(node); // disconnect watcher from the reactive graph\n node.cleanupFn();\n\n // nullify references to the integration functions to mark node as destroyed\n node.fn = null;\n node.schedule = null;\n node.cleanupFn = NOOP_CLEANUP_FN;\n }\n }\n\n const run = () => {\n if (node.fn === null) {\n // trying to run a destroyed watch is noop\n return;\n }\n\n if (isInNotificationPhase()) {\n throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);\n }\n\n node.dirty = false;\n if (node.hasRun && !consumerPollProducersForChange(node)) {\n return;\n }\n node.hasRun = true;\n\n const prevConsumer = consumerBeforeComputation(node);\n try {\n node.cleanupFn();\n node.cleanupFn = NOOP_CLEANUP_FN;\n node.fn(registerOnCleanup);\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n };\n\n node.ref = {\n notify: () => consumerMarkDirty(node),\n run,\n cleanup: () => node.cleanupFn(),\n destroy: () => destroyWatchNode(node),\n [SIGNAL]: node,\n };\n\n return node.ref;\n}\n\nconst NOOP_CLEANUP_FN: WatchCleanupFn = () => {};\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst WATCH_NODE: Partial<WatchNode> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n consumerIsAlwaysLive: true,\n consumerAllowSignalWrites: false,\n consumerMarkedDirty: (node: WatchNode) => {\n if (node.schedule !== null) {\n node.schedule(node.ref);\n }\n },\n hasRun: false,\n cleanupFn: NOOP_CLEANUP_FN,\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport function setAlternateWeakRefImpl(impl: unknown) {\n // TODO: remove this function\n}\n"],"names":[],"mappings":";;;;;;AAaA;;AAEG;AACa,SAAA,aAAa,CAAI,CAAI,EAAE,CAAI,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,QAAA,mBAAmB,EAAE,CAAC,IAAe,KAAI;AACvC,YAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE;AAC1B,gBAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACzB;SACF;AACD,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,SAAS,EAAE,eAAe;KAC3B,CAAC;AACJ,CAAC,GAAG;;AC7IE,SAAU,uBAAuB,CAAC,IAAa,EAAA;;AAErD;;;;"}
1
+ {"version":3,"file":"signals.mjs","sources":["../../../../../../../packages/core/primitives/signals/src/equality.ts","../../../../../../../packages/core/primitives/signals/src/graph.ts","../../../../../../../packages/core/primitives/signals/src/computed.ts","../../../../../../../packages/core/primitives/signals/src/errors.ts","../../../../../../../packages/core/primitives/signals/src/signal.ts","../../../../../../../packages/core/primitives/signals/src/watch.ts","../../../../../../../packages/core/primitives/signals/src/weak_ref.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * A comparison function which can determine if two values are equal.\n */\nexport type ValueEqualityFn<T> = (a: T, b: T) => boolean;\n\n/**\n * The default equality function used for `signal` and `computed`, which uses referential equality.\n */\nexport function defaultEquals<T>(a: T, b: T) {\n return Object.is(a, b);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * The currently active consumer `ReactiveNode`, if running code in a reactive context.\n *\n * Change this via `setActiveConsumer`.\n */\nlet activeConsumer: ReactiveNode | null = null;\nlet inNotificationPhase = false;\n\ntype Version = number & {__brand: 'Version'};\n\n/**\n * Global epoch counter. Incremented whenever a source signal is set.\n */\nlet epoch: Version = 1 as Version;\n\n/**\n * Symbol used to tell `Signal`s apart from other functions.\n *\n * This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.\n */\nexport const SIGNAL = /* @__PURE__ */ Symbol('SIGNAL');\n\nexport function setActiveConsumer(consumer: ReactiveNode | null): ReactiveNode | null {\n const prev = activeConsumer;\n activeConsumer = consumer;\n return prev;\n}\n\nexport function getActiveConsumer(): ReactiveNode | null {\n return activeConsumer;\n}\n\nexport function isInNotificationPhase(): boolean {\n return inNotificationPhase;\n}\n\nexport interface Reactive {\n [SIGNAL]: ReactiveNode;\n}\n\nexport function isReactive(value: unknown): value is Reactive {\n return (value as Partial<Reactive>)[SIGNAL] !== undefined;\n}\n\nexport const REACTIVE_NODE: ReactiveNode = {\n version: 0 as Version,\n lastCleanEpoch: 0 as Version,\n dirty: false,\n producerNode: undefined,\n producerLastReadVersion: undefined,\n producerIndexOfThis: undefined,\n nextProducerIndex: 0,\n liveConsumerNode: undefined,\n liveConsumerIndexOfThis: undefined,\n consumerAllowSignalWrites: false,\n consumerIsAlwaysLive: false,\n producerMustRecompute: () => false,\n producerRecomputeValue: () => {},\n consumerMarkedDirty: () => {},\n consumerOnSignalRead: () => {},\n};\n\n/**\n * A producer and/or consumer which participates in the reactive graph.\n *\n * Producer `ReactiveNode`s which are accessed when a consumer `ReactiveNode` is the\n * `activeConsumer` are tracked as dependencies of that consumer.\n *\n * Certain consumers are also tracked as \"live\" consumers and create edges in the other direction,\n * from producer to consumer. These edges are used to propagate change notifications when a\n * producer's value is updated.\n *\n * A `ReactiveNode` may be both a producer and consumer.\n */\nexport interface ReactiveNode {\n /**\n * Version of the value that this node produces.\n *\n * This is incremented whenever a new value is produced by this node which is not equal to the\n * previous value (by whatever definition of equality is in use).\n */\n version: Version;\n\n /**\n * Epoch at which this node is verified to be clean.\n *\n * This allows skipping of some polling operations in the case where no signals have been set\n * since this node was last read.\n */\n lastCleanEpoch: Version;\n\n /**\n * Whether this node (in its consumer capacity) is dirty.\n *\n * Only live consumers become dirty, when receiving a change notification from a dependency\n * producer.\n */\n dirty: boolean;\n\n /**\n * Producers which are dependencies of this consumer.\n *\n * Uses the same indices as the `producerLastReadVersion` and `producerIndexOfThis` arrays.\n */\n producerNode: ReactiveNode[] | undefined;\n\n /**\n * `Version` of the value last read by a given producer.\n *\n * Uses the same indices as the `producerNode` and `producerIndexOfThis` arrays.\n */\n producerLastReadVersion: Version[] | undefined;\n\n /**\n * Index of `this` (consumer) in each producer's `liveConsumers` array.\n *\n * This value is only meaningful if this node is live (`liveConsumers.length > 0`). Otherwise\n * these indices are stale.\n *\n * Uses the same indices as the `producerNode` and `producerLastReadVersion` arrays.\n */\n producerIndexOfThis: number[] | undefined;\n\n /**\n * Index into the producer arrays that the next dependency of this node as a consumer will use.\n *\n * This index is zeroed before this node as a consumer begins executing. When a producer is read,\n * it gets inserted into the producers arrays at this index. There may be an existing dependency\n * in this location which may or may not match the incoming producer, depending on whether the\n * same producers were read in the same order as the last computation.\n */\n nextProducerIndex: number;\n\n /**\n * Array of consumers of this producer that are \"live\" (they require push notifications).\n *\n * `liveConsumerNode.length` is effectively our reference count for this node.\n */\n liveConsumerNode: ReactiveNode[] | undefined;\n\n /**\n * Index of `this` (producer) in each consumer's `producerNode` array.\n *\n * Uses the same indices as the `liveConsumerNode` array.\n */\n liveConsumerIndexOfThis: number[] | undefined;\n\n /**\n * Whether writes to signals are allowed when this consumer is the `activeConsumer`.\n *\n * This is used to enforce guardrails such as preventing writes to writable signals in the\n * computation function of computed signals, which is supposed to be pure.\n */\n consumerAllowSignalWrites: boolean;\n\n readonly consumerIsAlwaysLive: boolean;\n\n /**\n * Tracks whether producers need to recompute their value independently of the reactive graph (for\n * example, if no initial value has been computed).\n */\n producerMustRecompute(node: unknown): boolean;\n producerRecomputeValue(node: unknown): void;\n consumerMarkedDirty(node: unknown): void;\n\n /**\n * Called when a signal is read within this consumer.\n */\n consumerOnSignalRead(node: unknown): void;\n}\n\ninterface ConsumerNode extends ReactiveNode {\n producerNode: NonNullable<ReactiveNode['producerNode']>;\n producerIndexOfThis: NonNullable<ReactiveNode['producerIndexOfThis']>;\n producerLastReadVersion: NonNullable<ReactiveNode['producerLastReadVersion']>;\n}\n\ninterface ProducerNode extends ReactiveNode {\n liveConsumerNode: NonNullable<ReactiveNode['liveConsumerNode']>;\n liveConsumerIndexOfThis: NonNullable<ReactiveNode['liveConsumerIndexOfThis']>;\n}\n\n/**\n * Called by implementations when a producer's signal is read.\n */\nexport function producerAccessed(node: ReactiveNode): void {\n if (inNotificationPhase) {\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode\n ? `Assertion error: signal read during notification phase`\n : '',\n );\n }\n\n if (activeConsumer === null) {\n // Accessed outside of a reactive context, so nothing to record.\n return;\n }\n\n activeConsumer.consumerOnSignalRead(node);\n\n // This producer is the `idx`th dependency of `activeConsumer`.\n const idx = activeConsumer.nextProducerIndex++;\n\n assertConsumerNode(activeConsumer);\n\n if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) {\n // There's been a change in producers since the last execution of `activeConsumer`.\n // `activeConsumer.producerNode[idx]` holds a stale dependency which will be be removed and\n // replaced with `this`.\n //\n // If `activeConsumer` isn't live, then this is a no-op, since we can replace the producer in\n // `activeConsumer.producerNode` directly. However, if `activeConsumer` is live, then we need\n // to remove it from the stale producer's `liveConsumer`s.\n if (consumerIsLive(activeConsumer)) {\n const staleProducer = activeConsumer.producerNode[idx];\n producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]);\n\n // At this point, the only record of `staleProducer` is the reference at\n // `activeConsumer.producerNode[idx]` which will be overwritten below.\n }\n }\n\n if (activeConsumer.producerNode[idx] !== node) {\n // We're a new dependency of the consumer (at `idx`).\n activeConsumer.producerNode[idx] = node;\n\n // If the active consumer is live, then add it as a live consumer. If not, then use 0 as a\n // placeholder value.\n activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer)\n ? producerAddLiveConsumer(node, activeConsumer, idx)\n : 0;\n }\n activeConsumer.producerLastReadVersion[idx] = node.version;\n}\n\n/**\n * Increment the global epoch counter.\n *\n * Called by source producers (that is, not computeds) whenever their values change.\n */\nexport function producerIncrementEpoch(): void {\n epoch++;\n}\n\n/**\n * Ensure this producer's `version` is up-to-date.\n */\nexport function producerUpdateValueVersion(node: ReactiveNode): void {\n if (consumerIsLive(node) && !node.dirty) {\n // A live consumer will be marked dirty by producers, so a clean state means that its version\n // is guaranteed to be up-to-date.\n return;\n }\n\n if (!node.dirty && node.lastCleanEpoch === epoch) {\n // Even non-live consumers can skip polling if they previously found themselves to be clean at\n // the current epoch, since their dependencies could not possibly have changed (such a change\n // would've increased the epoch).\n return;\n }\n\n if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {\n // None of our producers report a change since the last time they were read, so no\n // recomputation of our value is necessary, and we can consider ourselves clean.\n node.dirty = false;\n node.lastCleanEpoch = epoch;\n return;\n }\n\n node.producerRecomputeValue(node);\n\n // After recomputing the value, we're no longer dirty.\n node.dirty = false;\n node.lastCleanEpoch = epoch;\n}\n\n/**\n * Propagate a dirty notification to live consumers of this producer.\n */\nexport function producerNotifyConsumers(node: ReactiveNode): void {\n if (node.liveConsumerNode === undefined) {\n return;\n }\n\n // Prevent signal reads when we're updating the graph\n const prev = inNotificationPhase;\n inNotificationPhase = true;\n try {\n for (const consumer of node.liveConsumerNode) {\n if (!consumer.dirty) {\n consumerMarkDirty(consumer);\n }\n }\n } finally {\n inNotificationPhase = prev;\n }\n}\n\n/**\n * Whether this `ReactiveNode` in its producer capacity is currently allowed to initiate updates,\n * based on the current consumer context.\n */\nexport function producerUpdatesAllowed(): boolean {\n return activeConsumer?.consumerAllowSignalWrites !== false;\n}\n\nexport function consumerMarkDirty(node: ReactiveNode): void {\n node.dirty = true;\n producerNotifyConsumers(node);\n node.consumerMarkedDirty?.(node);\n}\n\n/**\n * Prepare this consumer to run a computation in its reactive context.\n *\n * Must be called by subclasses which represent reactive computations, before those computations\n * begin.\n */\nexport function consumerBeforeComputation(node: ReactiveNode | null): ReactiveNode | null {\n node && (node.nextProducerIndex = 0);\n return setActiveConsumer(node);\n}\n\n/**\n * Finalize this consumer's state after a reactive computation has run.\n *\n * Must be called by subclasses which represent reactive computations, after those computations\n * have finished.\n */\nexport function consumerAfterComputation(\n node: ReactiveNode | null,\n prevConsumer: ReactiveNode | null,\n): void {\n setActiveConsumer(prevConsumer);\n\n if (\n !node ||\n node.producerNode === undefined ||\n node.producerIndexOfThis === undefined ||\n node.producerLastReadVersion === undefined\n ) {\n return;\n }\n\n if (consumerIsLive(node)) {\n // For live consumers, we need to remove the producer -> consumer edge for any stale producers\n // which weren't dependencies after the recomputation.\n for (let i = node.nextProducerIndex; i < node.producerNode.length; i++) {\n producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);\n }\n }\n\n // Truncate the producer tracking arrays.\n // Perf note: this is essentially truncating the length to `node.nextProducerIndex`, but\n // benchmarking has shown that individual pop operations are faster.\n while (node.producerNode.length > node.nextProducerIndex) {\n node.producerNode.pop();\n node.producerLastReadVersion.pop();\n node.producerIndexOfThis.pop();\n }\n}\n\n/**\n * Determine whether this consumer has any dependencies which have changed since the last time\n * they were read.\n */\nexport function consumerPollProducersForChange(node: ReactiveNode): boolean {\n assertConsumerNode(node);\n\n // Poll producers for change.\n for (let i = 0; i < node.producerNode.length; i++) {\n const producer = node.producerNode[i];\n const seenVersion = node.producerLastReadVersion[i];\n\n // First check the versions. A mismatch means that the producer's value is known to have\n // changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n\n // The producer's version is the same as the last time we read it, but it might itself be\n // stale. Force the producer to recompute its version (calculating a new value if necessary).\n producerUpdateValueVersion(producer);\n\n // Now when we do this check, `producer.version` is guaranteed to be up to date, so if the\n // versions still match then it has not changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Disconnect this consumer from the graph.\n */\nexport function consumerDestroy(node: ReactiveNode): void {\n assertConsumerNode(node);\n if (consumerIsLive(node)) {\n // Drop all connections from the graph to this node.\n for (let i = 0; i < node.producerNode.length; i++) {\n producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);\n }\n }\n\n // Truncate all the arrays to drop all connection from this node to the graph.\n node.producerNode.length =\n node.producerLastReadVersion.length =\n node.producerIndexOfThis.length =\n 0;\n if (node.liveConsumerNode) {\n node.liveConsumerNode.length = node.liveConsumerIndexOfThis!.length = 0;\n }\n}\n\n/**\n * Add `consumer` as a live consumer of this node.\n *\n * Note that this operation is potentially transitive. If this node becomes live, then it becomes\n * a live consumer of all of its current producers.\n */\nfunction producerAddLiveConsumer(\n node: ReactiveNode,\n consumer: ReactiveNode,\n indexOfThis: number,\n): number {\n assertProducerNode(node);\n if (node.liveConsumerNode.length === 0 && isConsumerNode(node)) {\n // When going from 0 to 1 live consumers, we become a live consumer to our producers.\n for (let i = 0; i < node.producerNode.length; i++) {\n node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i);\n }\n }\n node.liveConsumerIndexOfThis.push(indexOfThis);\n return node.liveConsumerNode.push(consumer) - 1;\n}\n\n/**\n * Remove the live consumer at `idx`.\n */\nfunction producerRemoveLiveConsumerAtIndex(node: ReactiveNode, idx: number): void {\n assertProducerNode(node);\n\n if (typeof ngDevMode !== 'undefined' && ngDevMode && idx >= node.liveConsumerNode.length) {\n throw new Error(\n `Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`,\n );\n }\n\n if (node.liveConsumerNode.length === 1 && isConsumerNode(node)) {\n // When removing the last live consumer, we will no longer be live. We need to remove\n // ourselves from our producers' tracking (which may cause consumer-producers to lose\n // liveness as well).\n for (let i = 0; i < node.producerNode.length; i++) {\n producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);\n }\n }\n\n // Move the last value of `liveConsumers` into `idx`. Note that if there's only a single\n // live consumer, this is a no-op.\n const lastIdx = node.liveConsumerNode.length - 1;\n node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx];\n node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];\n\n // Truncate the array.\n node.liveConsumerNode.length--;\n node.liveConsumerIndexOfThis.length--;\n\n // If the index is still valid, then we need to fix the index pointer from the producer to this\n // consumer, and update it from `lastIdx` to `idx` (accounting for the move above).\n if (idx < node.liveConsumerNode.length) {\n const idxProducer = node.liveConsumerIndexOfThis[idx];\n const consumer = node.liveConsumerNode[idx];\n assertConsumerNode(consumer);\n consumer.producerIndexOfThis[idxProducer] = idx;\n }\n}\n\nfunction consumerIsLive(node: ReactiveNode): boolean {\n return node.consumerIsAlwaysLive || (node?.liveConsumerNode?.length ?? 0) > 0;\n}\n\nfunction assertConsumerNode(node: ReactiveNode): asserts node is ConsumerNode {\n node.producerNode ??= [];\n node.producerIndexOfThis ??= [];\n node.producerLastReadVersion ??= [];\n}\n\nfunction assertProducerNode(node: ReactiveNode): asserts node is ProducerNode {\n node.liveConsumerNode ??= [];\n node.liveConsumerIndexOfThis ??= [];\n}\n\nfunction isConsumerNode(node: ReactiveNode): node is ConsumerNode {\n return node.producerNode !== undefined;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n producerAccessed,\n producerUpdateValueVersion,\n REACTIVE_NODE,\n ReactiveNode,\n SIGNAL,\n} from './graph';\n\n/**\n * A computation, which derives a value from a declarative reactive expression.\n *\n * `Computed`s are both producers and consumers of reactivity.\n */\nexport interface ComputedNode<T> extends ReactiveNode {\n /**\n * Current value of the computation, or one of the sentinel values above (`UNSET`, `COMPUTING`,\n * `ERROR`).\n */\n value: T;\n\n /**\n * If `value` is `ERRORED`, the error caught from the last computation attempt which will\n * be re-thrown.\n */\n error: unknown;\n\n /**\n * The computation function which will produce a new value.\n */\n computation: () => T;\n\n equal: ValueEqualityFn<T>;\n}\n\nexport type ComputedGetter<T> = (() => T) & {\n [SIGNAL]: ComputedNode<T>;\n};\n\n/**\n * Create a computed signal which derives a reactive value from an expression.\n */\nexport function createComputed<T>(computation: () => T): ComputedGetter<T> {\n const node: ComputedNode<T> = Object.create(COMPUTED_NODE);\n node.computation = computation;\n\n const computed = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n\n // Record that someone looked at this signal.\n producerAccessed(node);\n\n if (node.value === ERRORED) {\n throw node.error;\n }\n\n return node.value;\n };\n (computed as ComputedGetter<T>)[SIGNAL] = node;\n return computed as unknown as ComputedGetter<T>;\n}\n\n/**\n * A dedicated symbol used before a computed value has been calculated for the first time.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nconst UNSET: any = /* @__PURE__ */ Symbol('UNSET');\n\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * is in progress. Used to detect cycles in computation chains.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nconst COMPUTING: any = /* @__PURE__ */ Symbol('COMPUTING');\n\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * failed. The thrown error is cached until the computation gets dirty again.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nconst ERRORED: any = /* @__PURE__ */ Symbol('ERRORED');\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst COMPUTED_NODE = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n\n producerMustRecompute(node: ComputedNode<unknown>): boolean {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n\n producerRecomputeValue(node: ComputedNode<unknown>): void {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error('Detected cycle in computations.');\n }\n\n const oldValue = node.value;\n node.value = COMPUTING;\n\n const prevConsumer = consumerBeforeComputation(node);\n let newValue: unknown;\n try {\n newValue = node.computation();\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n\n if (\n oldValue !== UNSET &&\n oldValue !== ERRORED &&\n newValue !== ERRORED &&\n node.equal(oldValue, newValue)\n ) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n\n node.value = newValue;\n node.version++;\n },\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nfunction defaultThrowError(): never {\n throw new Error();\n}\n\nlet throwInvalidWriteToSignalErrorFn = defaultThrowError;\n\nexport function throwInvalidWriteToSignalError() {\n throwInvalidWriteToSignalErrorFn();\n}\n\nexport function setThrowInvalidWriteToSignalError(fn: () => never): void {\n throwInvalidWriteToSignalErrorFn = fn;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {throwInvalidWriteToSignalError} from './errors';\nimport {\n producerAccessed,\n producerIncrementEpoch,\n producerNotifyConsumers,\n producerUpdatesAllowed,\n REACTIVE_NODE,\n ReactiveNode,\n SIGNAL,\n} from './graph';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * If set, called after `WritableSignal`s are updated.\n *\n * This hook can be used to achieve various effects, such as running effects synchronously as part\n * of setting a signal.\n */\nlet postSignalSetFn: (() => void) | null = null;\n\nexport interface SignalNode<T> extends ReactiveNode {\n value: T;\n equal: ValueEqualityFn<T>;\n}\n\nexport type SignalBaseGetter<T> = (() => T) & {readonly [SIGNAL]: unknown};\n\n// Note: Closure *requires* this to be an `interface` and not a type, which is why the\n// `SignalBaseGetter` type exists to provide the correct shape.\nexport interface SignalGetter<T> extends SignalBaseGetter<T> {\n readonly [SIGNAL]: SignalNode<T>;\n}\n\n/**\n * Create a `Signal` that can be set or updated directly.\n */\nexport function createSignal<T>(initialValue: T): SignalGetter<T> {\n const node: SignalNode<T> = Object.create(SIGNAL_NODE);\n node.value = initialValue;\n const getter = (() => {\n producerAccessed(node);\n return node.value;\n }) as SignalGetter<T>;\n (getter as any)[SIGNAL] = node;\n return getter;\n}\n\nexport function setPostSignalSetFn(fn: (() => void) | null): (() => void) | null {\n const prev = postSignalSetFn;\n postSignalSetFn = fn;\n return prev;\n}\n\nexport function signalGetFn<T>(this: SignalNode<T>): T {\n producerAccessed(this);\n return this.value;\n}\n\nexport function signalSetFn<T>(node: SignalNode<T>, newValue: T) {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError();\n }\n\n if (!node.equal(node.value, newValue)) {\n node.value = newValue;\n signalValueChanged(node);\n }\n}\n\nexport function signalUpdateFn<T>(node: SignalNode<T>, updater: (value: T) => T): void {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError();\n }\n\n signalSetFn(node, updater(node.value));\n}\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nexport const SIGNAL_NODE: SignalNode<unknown> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n equal: defaultEquals,\n value: undefined,\n };\n})();\n\nfunction signalValueChanged<T>(node: SignalNode<T>): void {\n node.version++;\n producerIncrementEpoch();\n producerNotifyConsumers(node);\n postSignalSetFn?.();\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n consumerDestroy,\n consumerMarkDirty,\n consumerPollProducersForChange,\n isInNotificationPhase,\n REACTIVE_NODE,\n ReactiveNode,\n SIGNAL,\n} from './graph';\n\n/**\n * A cleanup function that can be optionally registered from the watch logic. If registered, the\n * cleanup logic runs before the next watch execution.\n */\nexport type WatchCleanupFn = () => void;\n\n/**\n * A callback passed to the watch function that makes it possible to register cleanup logic.\n */\nexport type WatchCleanupRegisterFn = (cleanupFn: WatchCleanupFn) => void;\n\nexport interface Watch {\n notify(): void;\n\n /**\n * Execute the reactive expression in the context of this `Watch` consumer.\n *\n * Should be called by the user scheduling algorithm when the provided\n * `schedule` hook is called by `Watch`.\n */\n run(): void;\n\n cleanup(): void;\n\n /**\n * Destroy the watcher:\n * - disconnect it from the reactive graph;\n * - mark it as destroyed so subsequent run and notify operations are noop.\n */\n destroy(): void;\n\n [SIGNAL]: WatchNode;\n}\nexport interface WatchNode extends ReactiveNode {\n hasRun: boolean;\n fn: ((onCleanup: WatchCleanupRegisterFn) => void) | null;\n schedule: ((watch: Watch) => void) | null;\n cleanupFn: WatchCleanupFn;\n ref: Watch;\n}\n\nexport function createWatch(\n fn: (onCleanup: WatchCleanupRegisterFn) => void,\n schedule: (watch: Watch) => void,\n allowSignalWrites: boolean,\n): Watch {\n const node: WatchNode = Object.create(WATCH_NODE);\n if (allowSignalWrites) {\n node.consumerAllowSignalWrites = true;\n }\n\n node.fn = fn;\n node.schedule = schedule;\n\n const registerOnCleanup = (cleanupFn: WatchCleanupFn) => {\n node.cleanupFn = cleanupFn;\n };\n\n function isWatchNodeDestroyed(node: WatchNode) {\n return node.fn === null && node.schedule === null;\n }\n\n function destroyWatchNode(node: WatchNode) {\n if (!isWatchNodeDestroyed(node)) {\n consumerDestroy(node); // disconnect watcher from the reactive graph\n node.cleanupFn();\n\n // nullify references to the integration functions to mark node as destroyed\n node.fn = null;\n node.schedule = null;\n node.cleanupFn = NOOP_CLEANUP_FN;\n }\n }\n\n const run = () => {\n if (node.fn === null) {\n // trying to run a destroyed watch is noop\n return;\n }\n\n if (isInNotificationPhase()) {\n throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);\n }\n\n node.dirty = false;\n if (node.hasRun && !consumerPollProducersForChange(node)) {\n return;\n }\n node.hasRun = true;\n\n const prevConsumer = consumerBeforeComputation(node);\n try {\n node.cleanupFn();\n node.cleanupFn = NOOP_CLEANUP_FN;\n node.fn(registerOnCleanup);\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n };\n\n node.ref = {\n notify: () => consumerMarkDirty(node),\n run,\n cleanup: () => node.cleanupFn(),\n destroy: () => destroyWatchNode(node),\n [SIGNAL]: node,\n };\n\n return node.ref;\n}\n\nconst NOOP_CLEANUP_FN: WatchCleanupFn = () => {};\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst WATCH_NODE: Partial<WatchNode> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n consumerIsAlwaysLive: true,\n consumerAllowSignalWrites: false,\n consumerMarkedDirty: (node: WatchNode) => {\n if (node.schedule !== null) {\n node.schedule(node.ref);\n }\n },\n hasRun: false,\n cleanupFn: NOOP_CLEANUP_FN,\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport function setAlternateWeakRefImpl(impl: unknown) {\n // TODO: remove this function\n}\n"],"names":[],"mappings":";;;;;;AAaA;;AAEG;AACa,SAAA,aAAa,CAAI,CAAI,EAAE,CAAI,EAAA;IACzC,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACzB;;ACNA;;;;AAIG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AAChC,QAAA,mBAAmB,EAAE,CAAC,IAAe,KAAI;AACvC,YAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE;AAC1B,gBAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACzB;SACF;AACD,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,SAAS,EAAE,eAAe;KAC3B,CAAC;AACJ,CAAC,GAAG;;AC7IE,SAAU,uBAAuB,CAAC,IAAa,EAAA;;AAErD;;;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.0
2
+ * @license Angular v18.1.0-next.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.0
2
+ * @license Angular v18.1.0-next.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.0
2
+ * @license Angular v18.1.0-next.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -83,19 +83,105 @@ export declare interface AfterContentInit {
83
83
  }
84
84
 
85
85
  /**
86
- * Register a callback to be invoked the next time the application
87
- * finishes rendering.
86
+ * Register callbacks to be invoked the next time the application finishes rendering, during the
87
+ * specified phases. The available phases are:
88
+ * - `earlyRead`
89
+ * Use this phase to **read** from the DOM before a subsequent `write` callback, for example to
90
+ * perform custom layout that the browser doesn't natively support. Prefer the `read` phase if
91
+ * reading can wait until after the write phase. **Never** write to the DOM in this phase.
92
+ * - `write`
93
+ * Use this phase to **write** to the DOM. **Never** read from the DOM in this phase.
94
+ * - `mixedReadWrite`
95
+ * Use this phase to read from and write to the DOM simultaneously. **Never** use this phase if
96
+ * it is possible to divide the work among the other phases instead.
97
+ * - `read`
98
+ * Use this phase to **read** from the DOM. **Never** write to the DOM in this phase.
88
99
  *
89
100
  * <div class="alert is-critical">
90
101
  *
91
- * You should always explicitly specify a non-default [phase](api/core/AfterRenderPhase), or you
92
- * risk significant performance degradation.
102
+ * You should prefer using the `read` and `write` phases over the `earlyRead` and `mixedReadWrite`
103
+ * phases when possible, to avoid performance degradation.
104
+ *
105
+ * </div>
106
+ *
107
+ * Note that:
108
+ * - Callbacks run in the following phase order *once, after the next render*:
109
+ * 1. `earlyRead`
110
+ * 2. `write`
111
+ * 3. `mixedReadWrite`
112
+ * 4. `read`
113
+ * - Callbacks in the same phase run in the order they are registered.
114
+ * - Callbacks run on browser platforms only, they will not run on the server.
115
+ *
116
+ * The first phase callback to run as part of this spec will receive no parameters. Each
117
+ * subsequent phase callback in this spec will receive the return value of the previously run
118
+ * phase callback as a parameter. This can be used to coordinate work across multiple phases.
119
+ *
120
+ * Angular is unable to verify or enforce that phases are used correctly, and instead
121
+ * relies on each developer to follow the guidelines documented for each value and
122
+ * carefully choose the appropriate one, refactoring their code if necessary. By doing
123
+ * so, Angular is better able to minimize the performance degradation associated with
124
+ * manual DOM access, ensuring the best experience for the end users of your application
125
+ * or library.
126
+ *
127
+ * <div class="alert is-important">
128
+ *
129
+ * Components are not guaranteed to be [hydrated](guide/hydration) before the callback runs.
130
+ * You must use caution when directly reading or writing the DOM and layout.
131
+ *
132
+ * </div>
133
+ *
134
+ * @param spec The callback functions to register
135
+ *
136
+ * @usageNotes
137
+ *
138
+ * Use `afterNextRender` to read or write the DOM once,
139
+ * for example to initialize a non-Angular library.
140
+ *
141
+ * ### Example
142
+ * ```ts
143
+ * @Component({
144
+ * selector: 'my-chart-cmp',
145
+ * template: `<div #chart>{{ ... }}</div>`,
146
+ * })
147
+ * export class MyChartCmp {
148
+ * @ViewChild('chart') chartRef: ElementRef;
149
+ * chart: MyChart|null;
150
+ *
151
+ * constructor() {
152
+ * afterNextRender({
153
+ * write: () => {
154
+ * this.chart = new MyChart(this.chartRef.nativeElement);
155
+ * }
156
+ * });
157
+ * }
158
+ * }
159
+ * ```
160
+ *
161
+ * @developerPreview
162
+ */
163
+ export declare function afterNextRender<E = never, W = never, M = never>(spec: {
164
+ earlyRead?: () => E;
165
+ write?: (...args: ɵFirstAvailable<[E]>) => W;
166
+ mixedReadWrite?: (...args: ɵFirstAvailable<[W, E]>) => M;
167
+ read?: (...args: ɵFirstAvailable<[M, W, E]>) => void;
168
+ }, opts?: Omit<AfterRenderOptions, 'phase'>): AfterRenderRef;
169
+
170
+ /**
171
+ * Register a callback to be invoked the next time the application finishes rendering, during the
172
+ * `mixedReadWrite` phase.
173
+ *
174
+ * <div class="alert is-critical">
175
+ *
176
+ * You should prefer specifying an explicit phase for the callback instead, or you risk significant
177
+ * performance degradation.
93
178
  *
94
179
  * </div>
95
180
  *
96
181
  * Note that the callback will run
97
182
  * - in the order it was registered
98
183
  * - on browser platforms only
184
+ * - during the `mixedReadWrite` phase
99
185
  *
100
186
  * <div class="alert is-important">
101
187
  *
@@ -122,9 +208,11 @@ export declare interface AfterContentInit {
122
208
  * chart: MyChart|null;
123
209
  *
124
210
  * constructor() {
125
- * afterNextRender(() => {
126
- * this.chart = new MyChart(this.chartRef.nativeElement);
127
- * }, {phase: AfterRenderPhase.Write});
211
+ * afterNextRender({
212
+ * write: () => {
213
+ * this.chart = new MyChart(this.chartRef.nativeElement);
214
+ * }
215
+ * });
128
216
  * }
129
217
  * }
130
218
  * ```
@@ -134,13 +222,96 @@ export declare interface AfterContentInit {
134
222
  export declare function afterNextRender(callback: VoidFunction, options?: AfterRenderOptions): AfterRenderRef;
135
223
 
136
224
  /**
137
- * Register a callback to be invoked each time the application
138
- * finishes rendering.
225
+ * Register callbacks to be invoked each time the application finishes rendering, during the
226
+ * specified phases. The available phases are:
227
+ * - `earlyRead`
228
+ * Use this phase to **read** from the DOM before a subsequent `write` callback, for example to
229
+ * perform custom layout that the browser doesn't natively support. Prefer the `read` phase if
230
+ * reading can wait until after the write phase. **Never** write to the DOM in this phase.
231
+ * - `write`
232
+ * Use this phase to **write** to the DOM. **Never** read from the DOM in this phase.
233
+ * - `mixedReadWrite`
234
+ * Use this phase to read from and write to the DOM simultaneously. **Never** use this phase if
235
+ * it is possible to divide the work among the other phases instead.
236
+ * - `read`
237
+ * Use this phase to **read** from the DOM. **Never** write to the DOM in this phase.
238
+ *
239
+ * <div class="alert is-critical">
240
+ *
241
+ * You should prefer using the `read` and `write` phases over the `earlyRead` and `mixedReadWrite`
242
+ * phases when possible, to avoid performance degradation.
243
+ *
244
+ * </div>
245
+ *
246
+ * Note that:
247
+ * - Callbacks run in the following phase order *after each render*:
248
+ * 1. `earlyRead`
249
+ * 2. `write`
250
+ * 3. `mixedReadWrite`
251
+ * 4. `read`
252
+ * - Callbacks in the same phase run in the order they are registered.
253
+ * - Callbacks run on browser platforms only, they will not run on the server.
254
+ *
255
+ * The first phase callback to run as part of this spec will receive no parameters. Each
256
+ * subsequent phase callback in this spec will receive the return value of the previously run
257
+ * phase callback as a parameter. This can be used to coordinate work across multiple phases.
258
+ *
259
+ * Angular is unable to verify or enforce that phases are used correctly, and instead
260
+ * relies on each developer to follow the guidelines documented for each value and
261
+ * carefully choose the appropriate one, refactoring their code if necessary. By doing
262
+ * so, Angular is better able to minimize the performance degradation associated with
263
+ * manual DOM access, ensuring the best experience for the end users of your application
264
+ * or library.
265
+ *
266
+ * <div class="alert is-important">
267
+ *
268
+ * Components are not guaranteed to be [hydrated](guide/hydration) before the callback runs.
269
+ * You must use caution when directly reading or writing the DOM and layout.
270
+ *
271
+ * </div>
272
+ *
273
+ * @param spec The callback functions to register
274
+ *
275
+ * @usageNotes
276
+ *
277
+ * Use `afterRender` to read or write the DOM after each render.
278
+ *
279
+ * ### Example
280
+ * ```ts
281
+ * @Component({
282
+ * selector: 'my-cmp',
283
+ * template: `<span #content>{{ ... }}</span>`,
284
+ * })
285
+ * export class MyComponent {
286
+ * @ViewChild('content') contentRef: ElementRef;
287
+ *
288
+ * constructor() {
289
+ * afterRender({
290
+ * read: () => {
291
+ * console.log('content height: ' + this.contentRef.nativeElement.scrollHeight);
292
+ * }
293
+ * });
294
+ * }
295
+ * }
296
+ * ```
297
+ *
298
+ * @developerPreview
299
+ */
300
+ export declare function afterRender<E = never, W = never, M = never>(spec: {
301
+ earlyRead?: () => E;
302
+ write?: (...args: ɵFirstAvailable<[E]>) => W;
303
+ mixedReadWrite?: (...args: ɵFirstAvailable<[W, E]>) => M;
304
+ read?: (...args: ɵFirstAvailable<[M, W, E]>) => void;
305
+ }, opts?: Omit<AfterRenderOptions, 'phase'>): AfterRenderRef;
306
+
307
+ /**
308
+ * Register a callback to be invoked each time the application finishes rendering, during the
309
+ * `mixedReadWrite` phase.
139
310
  *
140
311
  * <div class="alert is-critical">
141
312
  *
142
- * You should always explicitly specify a non-default [phase](api/core/AfterRenderPhase), or you
143
- * risk significant performance degradation.
313
+ * You should prefer specifying an explicit phase for the callback instead, or you risk significant
314
+ * performance degradation.
144
315
  *
145
316
  * </div>
146
317
  *
@@ -148,6 +319,7 @@ export declare function afterNextRender(callback: VoidFunction, options?: AfterR
148
319
  * - in the order it was registered
149
320
  * - once per render
150
321
  * - on browser platforms only
322
+ * - during the `mixedReadWrite` phase
151
323
  *
152
324
  * <div class="alert is-important">
153
325
  *
@@ -172,9 +344,11 @@ export declare function afterNextRender(callback: VoidFunction, options?: AfterR
172
344
  * @ViewChild('content') contentRef: ElementRef;
173
345
  *
174
346
  * constructor() {
175
- * afterRender(() => {
176
- * console.log('content height: ' + this.contentRef.nativeElement.scrollHeight);
177
- * }, {phase: AfterRenderPhase.Read});
347
+ * afterRender({
348
+ * read: () => {
349
+ * console.log('content height: ' + this.contentRef.nativeElement.scrollHeight);
350
+ * }
351
+ * });
178
352
  * }
179
353
  * }
180
354
  * ```
@@ -204,6 +378,9 @@ export declare interface AfterRenderOptions {
204
378
  * phase instead. See `AfterRenderPhase` for more information.
205
379
  *
206
380
  * </div>
381
+ *
382
+ * @deprecated Specify the phase for your callback to run in by passing a spec-object as the first
383
+ * parameter to `afterRender` or `afterNextRender` insetad of a function.
207
384
  */
208
385
  phase?: AfterRenderPhase;
209
386
  }
@@ -226,14 +403,16 @@ export declare interface AfterRenderOptions {
226
403
  * manual DOM access, ensuring the best experience for the end users of your application
227
404
  * or library.
228
405
  *
229
- * @developerPreview
406
+ * @deprecated Specify the phase for your callback to run in by passing a spec-object as the first
407
+ * parameter to `afterRender` or `afterNextRender` insetad of a function.
230
408
  */
231
409
  export declare enum AfterRenderPhase {
232
410
  /**
233
411
  * Use `AfterRenderPhase.EarlyRead` for callbacks that only need to **read** from the
234
412
  * DOM before a subsequent `AfterRenderPhase.Write` callback, for example to perform
235
- * custom layout that the browser doesn't natively support. **Never** use this phase
236
- * for callbacks that can write to the DOM or when `AfterRenderPhase.Read` is adequate.
413
+ * custom layout that the browser doesn't natively support. Prefer the
414
+ * `AfterRenderPhase.EarlyRead` phase if reading can wait until after the write phase.
415
+ * **Never** write to the DOM in this phase.
237
416
  *
238
417
  * <div class="alert is-important">
239
418
  *
@@ -245,25 +424,25 @@ export declare enum AfterRenderPhase {
245
424
  EarlyRead = 0,
246
425
  /**
247
426
  * Use `AfterRenderPhase.Write` for callbacks that only **write** to the DOM. **Never**
248
- * use this phase for callbacks that can read from the DOM.
427
+ * read from the DOM in this phase.
249
428
  */
250
429
  Write = 1,
251
430
  /**
252
431
  * Use `AfterRenderPhase.MixedReadWrite` for callbacks that read from or write to the
253
- * DOM, that haven't been refactored to use a different phase. **Never** use this phase
254
- * for callbacks that can use a different phase instead.
432
+ * DOM, that haven't been refactored to use a different phase. **Never** use this phase if
433
+ * it is possible to divide the work among the other phases instead.
255
434
  *
256
435
  * <div class="alert is-critical">
257
436
  *
258
437
  * Using this value can **significantly** degrade performance.
259
- * Instead, prefer refactoring into multiple callbacks using a more specific phase.
438
+ * Instead, prefer dividing work into the appropriate phase callbacks.
260
439
  *
261
440
  * </div>
262
441
  */
263
442
  MixedReadWrite = 2,
264
443
  /**
265
444
  * Use `AfterRenderPhase.Read` for callbacks that only **read** from the DOM. **Never**
266
- * use this phase for callbacks that can write to the DOM.
445
+ * write to the DOM in this phase.
267
446
  */
268
447
  Read = 3
269
448
  }
@@ -3964,8 +4143,8 @@ export declare class ExperimentalPendingTasks {
3964
4143
  * @returns A cleanup function that removes a task when called.
3965
4144
  */
3966
4145
  add(): () => void;
3967
- static ɵfac: i0.ɵɵFactoryDeclaration<ExperimentalPendingTasks, never>;
3968
- static ɵprov: i0.ɵɵInjectableDeclaration<ExperimentalPendingTasks>;
4146
+ /** @nocollapse */
4147
+ static ɵprov: unknown;
3969
4148
  }
3970
4149
 
3971
4150
  /**
@@ -8675,7 +8854,6 @@ declare const REACTIVE_TEMPLATE_CONSUMER = 23;
8675
8854
 
8676
8855
  declare interface ReactiveLViewConsumer extends ReactiveNode {
8677
8856
  lView: LView | null;
8678
- slot: typeof REACTIVE_TEMPLATE_CONSUMER;
8679
8857
  }
8680
8858
 
8681
8859
  /**
@@ -12624,6 +12802,12 @@ export declare const enum ɵExtraLocaleDataIndex {
12624
12802
  */
12625
12803
  export declare function ɵfindLocaleData(locale: string): any;
12626
12804
 
12805
+ /**
12806
+ * An argument list containing the first non-never type in the given type array, or an empty
12807
+ * argument list if there are no non-never types in the type array.
12808
+ */
12809
+ export declare type ɵFirstAvailable<T extends unknown[]> = T extends [infer H, ...infer R] ? [H] extends [never] ? ɵFirstAvailable<R> : [H] : [];
12810
+
12627
12811
  /**
12628
12812
  * Loops over queued module definitions, if a given module definition has all of its
12629
12813
  * declarations resolved, it dequeues that module definition and sets the scope on
@@ -13184,8 +13368,8 @@ export declare class ɵPendingTasks implements OnDestroy {
13184
13368
  add(): number;
13185
13369
  remove(taskId: number): void;
13186
13370
  ngOnDestroy(): void;
13187
- static ɵfac: i0.ɵɵFactoryDeclaration<ɵPendingTasks, never>;
13188
- static ɵprov: i0.ɵɵInjectableDeclaration<ɵPendingTasks>;
13371
+ /** @nocollapse */
13372
+ static ɵprov: unknown;
13189
13373
  }
13190
13374
 
13191
13375
 
@@ -13292,6 +13476,12 @@ export declare const enum ɵProfilerEvent {
13292
13476
  OutputEnd = 7
13293
13477
  }
13294
13478
 
13479
+ /**
13480
+ * Internal token used to verify that `provideZoneChangeDetection` is not used
13481
+ * with the bootstrapModule API.
13482
+ */
13483
+ export declare const ɵPROVIDED_NG_ZONE: InjectionToken<boolean>;
13484
+
13295
13485
  /**
13296
13486
  * An object that contains information about a provider that has been configured
13297
13487
  *