@angular/core 16.0.0-next.7 → 16.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/esm2022/rxjs-interop/src/index.mjs +3 -3
  2. package/esm2022/rxjs-interop/src/to_observable.mjs +39 -0
  3. package/esm2022/rxjs-interop/src/to_signal.mjs +52 -0
  4. package/esm2022/src/application_ref.mjs +3 -3
  5. package/esm2022/src/application_tokens.mjs +11 -1
  6. package/esm2022/src/core_private_export.mjs +2 -1
  7. package/esm2022/src/errors.mjs +1 -1
  8. package/esm2022/src/hydration/annotate.mjs +42 -33
  9. package/esm2022/src/hydration/api.mjs +47 -19
  10. package/esm2022/src/hydration/error_handling.mjs +1 -17
  11. package/esm2022/src/initial_render_pending_tasks.mjs +10 -10
  12. package/esm2022/src/render3/component_ref.mjs +3 -3
  13. package/esm2022/src/render3/di.mjs +3 -3
  14. package/esm2022/src/render3/hooks.mjs +3 -3
  15. package/esm2022/src/render3/instructions/i18n.mjs +14 -2
  16. package/esm2022/src/render3/instructions/mark_view_dirty.mjs +1 -1
  17. package/esm2022/src/render3/instructions/shared.mjs +14 -14
  18. package/esm2022/src/render3/interfaces/type_checks.mjs +1 -1
  19. package/esm2022/src/render3/interfaces/view.mjs +1 -1
  20. package/esm2022/src/render3/node_manipulation.mjs +9 -9
  21. package/esm2022/src/render3/reactivity/effect.mjs +1 -1
  22. package/esm2022/src/render3/util/discovery_utils.mjs +1 -1
  23. package/esm2022/src/render3/util/view_traversal_utils.mjs +1 -1
  24. package/esm2022/src/render3/util/view_utils.mjs +2 -2
  25. package/esm2022/src/render3/view_ref.mjs +4 -4
  26. package/esm2022/src/signals/src/watch.mjs +6 -2
  27. package/esm2022/src/version.mjs +1 -1
  28. package/esm2022/testing/src/logger.mjs +3 -3
  29. package/esm2022/testing/src/ng_zone_mock.mjs +3 -3
  30. package/fesm2022/core.mjs +156 -113
  31. package/fesm2022/core.mjs.map +1 -1
  32. package/fesm2022/rxjs-interop.mjs +704 -56
  33. package/fesm2022/rxjs-interop.mjs.map +1 -1
  34. package/fesm2022/testing.mjs +67 -57
  35. package/fesm2022/testing.mjs.map +1 -1
  36. package/index.d.ts +32 -15
  37. package/package.json +2 -2
  38. package/rxjs-interop/index.d.ts +53 -46
  39. package/schematics/migrations/guard-and-resolve-interfaces/bundle.js +13 -13
  40. package/schematics/migrations/remove-module-id/bundle.js +14 -14
  41. package/schematics/ng-generate/standalone-migration/bundle.js +2938 -1229
  42. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  43. package/testing/index.d.ts +1 -1
  44. package/esm2022/rxjs-interop/src/from_observable.mjs +0 -46
  45. package/esm2022/rxjs-interop/src/from_signal.mjs +0 -36
@@ -1 +1 @@
1
- {"version":3,"file":"rxjs-interop.mjs","sources":["../../../../../../packages/core/rxjs-interop/src/from_observable.ts","../../../../../../packages/core/rxjs-interop/src/from_signal.ts","../../../../../../packages/core/rxjs-interop/src/take_until_destroyed.ts","../../../../../../packages/core/rxjs-interop/rxjs-interop.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\nimport {assertInInjectionContext, computed, DestroyRef, inject, signal, Signal, WritableSignal} from '@angular/core';\nimport {Observable} from 'rxjs';\n\n/**\n * Get the current value of an `Observable` as a reactive `Signal`.\n *\n * `fromObservable` returns a `Signal` which provides synchronous reactive access to values produced\n * by the given `Observable`, by subscribing to that `Observable`. The returned `Signal` will always\n * have the most recent value emitted by the subscription, and will throw an error if the\n * `Observable` errors.\n *\n * The subscription will last for the lifetime of the current injection context. That is, if\n * `fromObservable` is called from a component context, the subscription will be cleaned up when the\n * component is destroyed. When called outside of a component, the current `EnvironmentInjector`'s\n * lifetime will be used (which is typically the lifetime of the application itself).\n *\n * If the `Observable` does not produce a value before the `Signal` is read, the `Signal` will throw\n * an error. To avoid this, use a synchronous `Observable` (potentially created with the `startWith`\n * operator) or pass an initial value to `fromObservable` as the second argument.\n *\n * `fromObservable` must be called in an injection context.\n */\nexport function fromObservable<T>(source: Observable<T>): Signal<T>;\n\n/**\n * Get the current value of an `Observable` as a reactive `Signal`.\n *\n * `fromObservable` returns a `Signal` which provides synchronous reactive access to values produced\n * by the given `Observable`, by subscribing to that `Observable`. The returned `Signal` will always\n * have the most recent value emitted by the subscription, and will throw an error if the\n * `Observable` errors.\n *\n * The subscription will last for the lifetime of the current injection context. That is, if\n * `fromObservable` is called from a component context, the subscription will be cleaned up when the\n * component is destroyed. When called outside of a component, the current `EnvironmentInjector`'s\n * lifetime will be used (which is typically the lifetime of the application itself).\n *\n * Before the `Observable` emits its first value, the `Signal` will return the configured\n * `initialValue`. If the `Observable` is known to produce a value before the `Signal` will be read,\n * `initialValue` does not need to be passed.\n *\n * `fromObservable` must be called in an injection context.\n *\n * @developerPreview\n */\nexport function fromObservable<T, U extends T|null|undefined>(\n // fromObservable(Observable<Animal>) -> Signal<Cat>\n source: Observable<T>, initialValue: U): Signal<T|U>;\nexport function fromObservable<T, U = never>(source: Observable<T>, initialValue?: U): Signal<T|U> {\n assertInInjectionContext(fromObservable);\n\n // Note: T is the Observable value type, and U is the initial value type. They don't have to be\n // the same - the returned signal gives values of type `T`.\n let state: WritableSignal<State<T|U>>;\n if (initialValue === undefined && arguments.length !== 2) {\n // No initial value was passed, so initially the signal is in a `NoValue` state and will throw\n // if accessed.\n state = signal({kind: StateKind.NoValue});\n } else {\n // An initial value was passed, so use it.\n state = signal<State<T|U>>({kind: StateKind.Value, value: initialValue!});\n }\n\n const sub = source.subscribe({\n next: value => state.set({kind: StateKind.Value, value}),\n error: error => state.set({kind: StateKind.Error, error}),\n // Completion of the Observable is meaningless to the signal. Signals don't have a concept of\n // \"complete\".\n });\n\n // Unsubscribe when the current context is destroyed.\n inject(DestroyRef).onDestroy(sub.unsubscribe.bind(sub));\n\n // The actual returned signal is a `computed` of the `State` signal, which maps the various states\n // to either values or errors.\n return computed(() => {\n const current = state();\n switch (current.kind) {\n case StateKind.Value:\n return current.value;\n case StateKind.Error:\n throw current.error;\n case StateKind.NoValue:\n // TODO(alxhub): use a RuntimeError when we finalize the error semantics\n throw new Error(`fromObservable() signal read before the Observable emitted`);\n }\n });\n}\n\nconst enum StateKind {\n NoValue,\n Value,\n Error,\n}\n\ninterface NoValueState {\n kind: StateKind.NoValue;\n}\n\ninterface ValueState<T> {\n kind: StateKind.Value;\n value: T;\n}\n\ninterface ErrorState {\n kind: StateKind.Error;\n error: unknown;\n}\n\ntype State<T> = NoValueState|ValueState<T>|ErrorState;\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 {assertInInjectionContext, effect, inject, Injector, Signal} from '@angular/core';\nimport {Observable} from 'rxjs';\n\n/**\n * Options for `fromSignal`.\n *\n * @developerPreview\n */\nexport interface FromSignalOptions {\n /**\n * The `Injector` to use when creating the effect.\n *\n * If this isn't specified, the current injection context will be used.\n */\n injector?: Injector;\n}\n\n/**\n * Exposes the value of an Angular `Signal` as an RxJS `Observable`.\n *\n * The signal's value will be propagated into the `Observable`'s subscribers using an `effect`.\n *\n * `fromSignal` must be called in an injection context.\n *\n * @developerPreview\n */\nexport function fromSignal<T>(\n source: Signal<T>,\n options?: FromSignalOptions,\n ): Observable<T> {\n !options?.injector && assertInInjectionContext(fromSignal);\n const injector = options?.injector ?? inject(Injector);\n\n // Creating a new `Observable` allows the creation of the effect to be lazy. This allows for all\n // references to `source` to be dropped if the `Observable` is fully unsubscribed and thrown away.\n return new Observable(observer => {\n const watcher = effect(() => {\n try {\n observer.next(source());\n } catch (err) {\n observer.error(err);\n }\n }, {injector, manualCleanup: true});\n return () => watcher.destroy();\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\nimport {assertInInjectionContext, DestroyRef, inject} from '@angular/core';\nimport {MonoTypeOperatorFunction, Observable} from 'rxjs';\nimport {takeUntil} from 'rxjs/operators';\n\n/**\n * Operator which completes the Observable when the calling context (component, directive, service,\n * etc) is destroyed.\n *\n * @param destroyRef optionally, the `DestroyRef` representing the current context. This can be\n * passed explicitly to use `takeUntilDestroyed` outside of an injection context. Otherwise, the\n * current `DestroyRef` is injected.\n *\n * @developerPreview\n */\nexport function takeUntilDestroyed<T>(destroyRef?: DestroyRef): MonoTypeOperatorFunction<T> {\n if (!destroyRef) {\n assertInInjectionContext(takeUntilDestroyed);\n destroyRef = inject(DestroyRef);\n }\n\n const destroyed$ = new Observable<void>(observer => {\n destroyRef!.onDestroy(observer.next.bind(observer));\n });\n\n return <T>(source: Observable<T>) => {\n return source.pipe(takeUntil(destroyed$));\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAwDgB,SAAA,cAAc,CAAe,MAAqB,EAAE,YAAgB,EAAA;IAClF,wBAAwB,CAAC,cAAc,CAAC,CAAC;;;AAIzC,IAAA,IAAI,KAAiC,CAAC;IACtC,IAAI,YAAY,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;;;QAGxD,KAAK,GAAG,MAAM,CAAC,EAAC,IAAI,EAAmB,CAAA,0BAAC,CAAC,CAAC;AAC3C,KAAA;AAAM,SAAA;;AAEL,QAAA,KAAK,GAAG,MAAM,CAAa,EAAC,IAAI,EAAA,CAAA,wBAAmB,KAAK,EAAE,YAAa,EAAC,CAAC,CAAC;AAC3E,KAAA;AAED,IAAA,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC;AAC3B,QAAA,IAAI,EAAE,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC,EAAC,IAAI,EAAA,CAAA,wBAAmB,KAAK,EAAC,CAAC;AACxD,QAAA,KAAK,EAAE,KAAK,IAAI,KAA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AC,CAAC;AACL;;ACzCA;;;;;;;;;AASG;AACG,SAAU,kBAAkB,CAAI,UAAuB,EAAA;IAC3D,IAAI,CAAC,UAAU,EAAE;QACf,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;AAC7C,QAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AACjC,KAAA;AAED,IAAA,MAAM,UAAU,GAAG,IAAI,UAAU,CAAO,QAAQ,IAAG;AACjD,QAAA,UAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtD,KAAC,CAAC,CAAC;IAEH,OAAO,CAAI,MAAqB,KAAI;QAClC,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;AAC5C,KAAC,CAAC;AACJ;;ACnCA;;AAEG;;;;"}
1
+ {"version":3,"file":"rxjs-interop.mjs","sources":["../../../../../../packages/core/rxjs-interop/src/take_until_destroyed.ts","../../../../../../packages/core/rxjs-interop/src/to_observable.ts","../../../../../../packages/core/src/signals/src/api.ts","../../../../../../packages/core/src/util/global.ts","../../../../../../packages/core/src/util/ng_dev_mode.ts","../../../../../../packages/core/src/signals/src/weak_ref.ts","../../../../../../packages/core/src/signals/src/graph.ts","../../../../../../packages/core/src/signals/src/computed.ts","../../../../../../packages/core/src/signals/src/errors.ts","../../../../../../packages/core/src/signals/src/signal.ts","../../../../../../packages/core/src/signals/src/untracked.ts","../../../../../../packages/core/src/signals/src/watch.ts","../../../../../../packages/core/rxjs-interop/src/to_signal.ts","../../../../../../packages/core/rxjs-interop/rxjs-interop.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\nimport {assertInInjectionContext, DestroyRef, inject} from '@angular/core';\nimport {MonoTypeOperatorFunction, Observable} from 'rxjs';\nimport {takeUntil} from 'rxjs/operators';\n\n/**\n * Operator which completes the Observable when the calling context (component, directive, service,\n * etc) is destroyed.\n *\n * @param destroyRef optionally, the `DestroyRef` representing the current context. This can be\n * passed explicitly to use `takeUntilDestroyed` outside of an injection context. Otherwise, the\n * current `DestroyRef` is injected.\n *\n * @developerPreview\n */\nexport function takeUntilDestroyed<T>(destroyRef?: DestroyRef): MonoTypeOperatorFunction<T> {\n if (!destroyRef) {\n assertInInjectionContext(takeUntilDestroyed);\n destroyRef = inject(DestroyRef);\n }\n\n const destroyed$ = new Observable<void>(observer => {\n destroyRef!.onDestroy(observer.next.bind(observer));\n });\n\n return <T>(source: Observable<T>) => {\n return source.pipe(takeUntil(destroyed$));\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\nimport {assertInInjectionContext, effect, inject, Injector, Signal} from '@angular/core';\nimport {Observable} from 'rxjs';\n\n/**\n * Options for `toObservable`.\n *\n * @developerPreview\n */\nexport interface toObservableOptions {\n /**\n * The `Injector` to use when creating the effect.\n *\n * If this isn't specified, the current injection context will be used.\n */\n injector?: Injector;\n}\n\n/**\n * Exposes the value of an Angular `Signal` as an RxJS `Observable`.\n *\n * The signal's value will be propagated into the `Observable`'s subscribers using an `effect`.\n *\n * `toObservable` must be called in an injection context.\n *\n * @developerPreview\n */\nexport function toObservable<T>(\n source: Signal<T>,\n options?: toObservableOptions,\n ): Observable<T> {\n !options?.injector && assertInInjectionContext(toObservable);\n const injector = options?.injector ?? inject(Injector);\n\n // Creating a new `Observable` allows the creation of the effect to be lazy. This allows for all\n // references to `source` to be dropped if the `Observable` is fully unsubscribed and thrown away.\n return new Observable(observer => {\n const watcher = effect(() => {\n let value: T;\n try {\n value = source();\n } catch (err) {\n observer.error(err);\n return;\n }\n observer.next(value);\n }, {injector, manualCleanup: true, allowSignalWrites: true});\n return () => watcher.destroy();\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\nimport {ReactiveNode} from './graph';\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 */\nconst SIGNAL = Symbol('SIGNAL');\n\n/**\n * A reactive value which notifies consumers of any changes.\n *\n * Signals are functions which returns their current value. To access the current value of a signal,\n * call it.\n *\n * Ordinary values can be turned into `Signal`s with the `signal` function.\n *\n * @developerPreview\n */\nexport type Signal<T> = (() => T)&{\n [SIGNAL]: unknown;\n};\n\n/**\n * Checks if the given `value` function is a reactive `Signal`.\n */\nexport function isSignal(value: Function): value is Signal<unknown> {\n return (value as Signal<unknown>)[SIGNAL] !== undefined;\n}\n\n/**\n * Converts `fn` into a marked signal function (where `isSignal(fn)` will be `true`).\n *\n * @param fn A zero-argument function which will be converted into a `Signal`.\n */\nexport function createSignalFromFunction<T>(node: ReactiveNode, fn: () => T): Signal<T>;\n\n/**\n * Converts `fn` into a marked signal function (where `isSignal(fn)` will be `true`), and\n * potentially add some set of extra properties (passed as an object record `extraApi`).\n *\n * @param fn A zero-argument function which will be converted into a `Signal`.\n * @param extraApi An object whose properties will be copied onto `fn` in order to create a specific\n * desired interface for the `Signal`.\n */\nexport function createSignalFromFunction<T, U extends Record<string, unknown>>(\n node: ReactiveNode, fn: () => T, extraApi: U): Signal<T>&U;\n\n/**\n * Converts `fn` into a marked signal function (where `isSignal(fn)` will be `true`), and\n * potentially add some set of extra properties (passed as an object record `extraApi`).\n */\nexport function createSignalFromFunction<T, U extends Record<string, unknown> = {}>(\n node: ReactiveNode, fn: () => T, extraApi: U = ({} as U)): Signal<T>&U {\n (fn as any)[SIGNAL] = node;\n // Copy properties from `extraApi` to `fn` to complete the desired API of the `Signal`.\n return Object.assign(fn, extraApi) as (Signal<T>& U);\n}\n\n/**\n * A comparison function which can determine if two values are equal.\n *\n * @developerPreview\n */\nexport type ValueEqualityFn<T> = (a: T, b: T) => boolean;\n\n/**\n * The default equality function used for `signal` and `computed`, which treats objects and arrays\n * as never equal, and all other primitive values using identity semantics.\n *\n * This allows signals to hold non-primitive values (arrays, objects, other collections) and still\n * propagate change notification upon explicit mutation without identity change.\n *\n * @developerPreview\n */\nexport function defaultEquals<T>(a: T, b: T) {\n // `Object.is` compares two values using identity semantics which is desired behavior for\n // primitive values. If `Object.is` determines two values to be equal we need to make sure that\n // those don't represent objects (we want to make sure that 2 objects are always considered\n // \"unequal\"). The null check is needed for the special case of JavaScript reporting null values\n // as objects (`typeof null === 'object'`).\n return (a === null || typeof a !== 'object') && 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// TODO(jteplitz602): Load WorkerGlobalScope from lib.webworker.d.ts file #3492\ndeclare var WorkerGlobalScope: any;\n// CommonJS / Node have global context exposed as \"global\" variable.\n// We don't want to include the whole node.d.ts this this compilation unit so we'll just fake\n// the global \"global\" var for now.\ndeclare var global: any;\n\n// Always use __globalThis if available, which is the spec-defined global variable across all\n// environments, then fallback to __global first, because in Node tests both __global and\n// __window may be defined and _global should be __global in that case. Note: Typeof/Instanceof\n// checks are considered side-effects in Terser. We explicitly mark this as side-effect free:\n// https://github.com/terser/terser/issues/250.\nconst _global: any = (/* @__PURE__ */ (\n () => (typeof globalThis !== 'undefined' && globalThis) ||\n (typeof global !== 'undefined' && global) || (typeof window !== 'undefined' && window) ||\n (typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&\n self instanceof WorkerGlobalScope && self))());\n\n/**\n * Attention: whenever providing a new value, be sure to add an\n * entry into the corresponding `....externs.js` file,\n * so that closure won't use that global for its purposes.\n */\nexport {_global as global};\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 {global} from './global';\n\ndeclare global {\n /**\n * Values of ngDevMode\n * Depending on the current state of the application, ngDevMode may have one of several values.\n *\n * For convenience, the “truthy” value which enables dev mode is also an object which contains\n * Angular’s performance counters. This is not necessary, but cuts down on boilerplate for the\n * perf counters.\n *\n * ngDevMode may also be set to false. This can happen in one of a few ways:\n * - The user explicitly sets `window.ngDevMode = false` somewhere in their app.\n * - The user calls `enableProdMode()`.\n * - The URL contains a `ngDevMode=false` text.\n * Finally, ngDevMode may not have been defined at all.\n */\n const ngDevMode: null|NgDevModePerfCounters;\n\n interface NgDevModePerfCounters {\n namedConstructors: boolean;\n firstCreatePass: number;\n tNode: number;\n tView: number;\n rendererCreateTextNode: number;\n rendererSetText: number;\n rendererCreateElement: number;\n rendererAddEventListener: number;\n rendererSetAttribute: number;\n rendererRemoveAttribute: number;\n rendererSetProperty: number;\n rendererSetClassName: number;\n rendererAddClass: number;\n rendererRemoveClass: number;\n rendererSetStyle: number;\n rendererRemoveStyle: number;\n rendererDestroy: number;\n rendererDestroyNode: number;\n rendererMoveNode: number;\n rendererRemoveNode: number;\n rendererAppendChild: number;\n rendererInsertBefore: number;\n rendererCreateComment: number;\n hydratedNodes: number;\n hydratedComponents: number;\n dehydratedViewsRemoved: number;\n dehydratedViewsCleanupRuns: number;\n componentsSkippedHydration: number;\n }\n}\n\nexport function ngDevModeResetPerfCounters(): NgDevModePerfCounters {\n const locationString = typeof location !== 'undefined' ? location.toString() : '';\n const newCounters: NgDevModePerfCounters = {\n namedConstructors: locationString.indexOf('ngDevMode=namedConstructors') != -1,\n firstCreatePass: 0,\n tNode: 0,\n tView: 0,\n rendererCreateTextNode: 0,\n rendererSetText: 0,\n rendererCreateElement: 0,\n rendererAddEventListener: 0,\n rendererSetAttribute: 0,\n rendererRemoveAttribute: 0,\n rendererSetProperty: 0,\n rendererSetClassName: 0,\n rendererAddClass: 0,\n rendererRemoveClass: 0,\n rendererSetStyle: 0,\n rendererRemoveStyle: 0,\n rendererDestroy: 0,\n rendererDestroyNode: 0,\n rendererMoveNode: 0,\n rendererRemoveNode: 0,\n rendererAppendChild: 0,\n rendererInsertBefore: 0,\n rendererCreateComment: 0,\n hydratedNodes: 0,\n hydratedComponents: 0,\n dehydratedViewsRemoved: 0,\n dehydratedViewsCleanupRuns: 0,\n componentsSkippedHydration: 0,\n };\n\n // Make sure to refer to ngDevMode as ['ngDevMode'] for closure.\n const allowNgDevModeTrue = locationString.indexOf('ngDevMode=false') === -1;\n global['ngDevMode'] = allowNgDevModeTrue && newCounters;\n return newCounters;\n}\n\n/**\n * This function checks to see if the `ngDevMode` has been set. If yes,\n * then we honor it, otherwise we default to dev mode with additional checks.\n *\n * The idea is that unless we are doing production build where we explicitly\n * set `ngDevMode == false` we should be helping the developer by providing\n * as much early warning and errors as possible.\n *\n * `ɵɵdefineComponent` is guaranteed to have been called before any component template functions\n * (and thus Ivy instructions), so a single initialization there is sufficient to ensure ngDevMode\n * is defined for the entire instruction set.\n *\n * When checking `ngDevMode` on toplevel, always init it before referencing it\n * (e.g. `((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode())`), otherwise you can\n * get a `ReferenceError` like in https://github.com/angular/angular/issues/31595.\n *\n * Details on possible values for `ngDevMode` can be found on its docstring.\n *\n * NOTE:\n * - changes to the `ngDevMode` name must be synced with `compiler-cli/src/tooling.ts`.\n */\nexport function initNgDevMode(): boolean {\n // The below checks are to ensure that calling `initNgDevMode` multiple times does not\n // reset the counters.\n // If the `ngDevMode` is not an object, then it means we have not created the perf counters\n // yet.\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (typeof ngDevMode !== 'object') {\n ngDevModeResetPerfCounters();\n }\n return typeof ngDevMode !== 'undefined' && !!ngDevMode;\n }\n return false;\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.\nimport '../../util/ng_dev_mode';\n\nimport {global} from '../../util/global';\n\n/**\n * A `WeakRef`-compatible reference that fakes the API with a strong reference\n * internally.\n */\nclass LeakyRef<T>/* implements WeakRef<T> */ {\n constructor(private readonly ref: T) {}\n\n deref(): T|undefined {\n return this.ref;\n }\n}\n\n// `WeakRef` is not always defined in every TS environment where Angular is compiled. Instead,\n// read it off of the global context if available.\n// tslint:disable-next-line: no-toplevel-property-access\nlet WeakRefImpl: WeakRefCtor|undefined = global['WeakRef'] ?? LeakyRef;\n\nexport interface WeakRef<T extends object> {\n deref(): T|undefined;\n}\n\nexport function newWeakRef<T extends object>(value: T): WeakRef<T> {\n if (typeof ngDevMode !== 'undefined' && ngDevMode && WeakRefImpl === undefined) {\n throw new Error(`Angular requires a browser which supports the 'WeakRef' API`);\n }\n return new WeakRefImpl!(value);\n}\n\nexport interface WeakRefCtor {\n new<T extends object>(value: T): WeakRef<T>;\n}\n\nexport function setAlternateWeakRefImpl(impl: WeakRefCtor) {\n // no-op since the alternate impl is included by default by the framework. Remove once internal\n // migration is complete.\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.\nimport '../../util/ng_dev_mode';\n\nimport {throwInvalidWriteToSignalError} from './errors';\nimport {newWeakRef, WeakRef} from './weak_ref';\n\n/**\n * Counter tracking the next `ProducerId` or `ConsumerId`.\n */\nlet _nextReactiveId: number = 0;\n\n/**\n * Tracks the currently active reactive consumer (or `null` if there is no active\n * consumer).\n */\nlet activeConsumer: ReactiveNode|null = null;\n\n/**\n * Whether the graph is currently propagating change notifications.\n */\nlet inNotificationPhase = false;\n\nexport function setActiveConsumer(consumer: ReactiveNode|null): ReactiveNode|null {\n const prev = activeConsumer;\n activeConsumer = consumer;\n return prev;\n}\n\n/**\n * A bidirectional edge in the dependency graph of `ReactiveNode`s.\n */\ninterface ReactiveEdge {\n /**\n * Weakly held reference to the consumer side of this edge.\n */\n readonly producerNode: WeakRef<ReactiveNode>;\n\n /**\n * Weakly held reference to the producer side of this edge.\n */\n readonly consumerNode: WeakRef<ReactiveNode>;\n /**\n * `trackingVersion` of the consumer at which this dependency edge was last observed.\n *\n * If this doesn't match the consumer's current `trackingVersion`, then this dependency record\n * is stale, and needs to be cleaned up.\n */\n atTrackingVersion: number;\n\n /**\n * `valueVersion` of the producer at the time this dependency was last accessed.\n */\n seenValueVersion: number;\n}\n\n/**\n * A node in the reactive graph.\n *\n * Nodes can be producers of reactive values, consumers of other reactive values, or both.\n *\n * Producers are nodes that produce values, and can be depended upon by consumer nodes.\n *\n * Producers expose a monotonic `valueVersion` counter, and are responsible for incrementing this\n * version when their value semantically changes. Some producers may produce their values lazily and\n * thus at times need to be polled for potential updates to their value (and by extension their\n * `valueVersion`). This is accomplished via the `onProducerUpdateValueVersion` method for\n * implemented by producers, which should perform whatever calculations are necessary to ensure\n * `valueVersion` is up to date.\n *\n * Consumers are nodes that depend on the values of producers and are notified when those values\n * might have changed.\n *\n * Consumers do not wrap the reads they consume themselves, but rather can be set as the active\n * reader via `setActiveConsumer`. Reads of producers that happen while a consumer is active will\n * result in those producers being added as dependencies of that consumer node.\n *\n * The set of dependencies of a consumer is dynamic. Implementers expose a monotonically increasing\n * `trackingVersion` counter, which increments whenever the consumer is about to re-run any reactive\n * reads it needs and establish a new set of dependencies as a result.\n *\n * Producers store the last `trackingVersion` they've seen from `Consumer`s which have read them.\n * This allows a producer to identify whether its record of the dependency is current or stale, by\n * comparing the consumer's `trackingVersion` to the version at which the dependency was\n * last observed.\n */\nexport abstract class ReactiveNode {\n private readonly id = _nextReactiveId++;\n\n /**\n * A cached weak reference to this node, which will be used in `ReactiveEdge`s.\n */\n private readonly ref = newWeakRef(this);\n\n /**\n * Edges to producers on which this node depends (in its consumer capacity).\n */\n private readonly producers = new Map<number, ReactiveEdge>();\n\n /**\n * Edges to consumers on which this node depends (in its producer capacity).\n */\n private readonly consumers = new Map<number, ReactiveEdge>();\n\n /**\n * Monotonically increasing counter representing a version of this `Consumer`'s\n * dependencies.\n */\n protected trackingVersion = 0;\n\n /**\n * Monotonically increasing counter which increases when the value of this `Producer`\n * semantically changes.\n */\n protected valueVersion = 0;\n\n /**\n * Whether signal writes should be allowed while this `ReactiveNode` is the current consumer.\n */\n protected abstract readonly consumerAllowSignalWrites: boolean;\n\n /**\n * Called for consumers whenever one of their dependencies notifies that it might have a new\n * value.\n */\n protected abstract onConsumerDependencyMayHaveChanged(): void;\n\n /**\n * Called for producers when a dependent consumer is checking if the producer's value has actually\n * changed.\n */\n protected abstract onProducerUpdateValueVersion(): void;\n\n /**\n * Polls dependencies of a consumer to determine if they have actually changed.\n *\n * If this returns `false`, then even though the consumer may have previously been notified of a\n * change, the values of its dependencies have not actually changed and the consumer should not\n * rerun any reactions.\n */\n protected consumerPollProducersForChange(): boolean {\n for (const [producerId, edge] of this.producers) {\n const producer = edge.producerNode.deref();\n\n if (producer === undefined || edge.atTrackingVersion !== this.trackingVersion) {\n // This dependency edge is stale, so remove it.\n this.producers.delete(producerId);\n producer?.consumers.delete(this.id);\n continue;\n }\n\n if (producer.producerPollStatus(edge.seenValueVersion)) {\n // One of the dependencies reports a real value change.\n return true;\n }\n }\n\n // No dependency reported a real value change, so the `Consumer` has also not been\n // impacted.\n return false;\n }\n\n /**\n * Notify all consumers of this producer that its value may have changed.\n */\n protected producerMayHaveChanged(): void {\n // Prevent signal reads when we're updating the graph\n const prev = inNotificationPhase;\n inNotificationPhase = true;\n try {\n for (const [consumerId, edge] of this.consumers) {\n const consumer = edge.consumerNode.deref();\n if (consumer === undefined || consumer.trackingVersion !== edge.atTrackingVersion) {\n this.consumers.delete(consumerId);\n consumer?.producers.delete(this.id);\n continue;\n }\n\n consumer.onConsumerDependencyMayHaveChanged();\n }\n } finally {\n inNotificationPhase = prev;\n }\n }\n\n /**\n * Mark that this producer node has been accessed in the current reactive context.\n */\n protected producerAccessed(): 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 if (activeConsumer === null) {\n return;\n }\n\n // Either create or update the dependency `Edge` in both directions.\n let edge = activeConsumer.producers.get(this.id);\n if (edge === undefined) {\n edge = {\n consumerNode: activeConsumer.ref,\n producerNode: this.ref,\n seenValueVersion: this.valueVersion,\n atTrackingVersion: activeConsumer.trackingVersion,\n };\n activeConsumer.producers.set(this.id, edge);\n this.consumers.set(activeConsumer.id, edge);\n } else {\n edge.seenValueVersion = this.valueVersion;\n edge.atTrackingVersion = activeConsumer.trackingVersion;\n }\n }\n\n /**\n * Whether this consumer currently has any producers registered.\n */\n protected get hasProducers(): boolean {\n return this.producers.size > 0;\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 */\n protected get producerUpdatesAllowed(): boolean {\n return activeConsumer?.consumerAllowSignalWrites !== false;\n }\n\n /**\n * Checks if a `Producer` has a current value which is different than the value\n * last seen at a specific version by a `Consumer` which recorded a dependency on\n * this `Producer`.\n */\n private producerPollStatus(lastSeenValueVersion: number): boolean {\n // `producer.valueVersion` may be stale, but a mismatch still means that the value\n // last seen by the `Consumer` is also stale.\n if (this.valueVersion !== lastSeenValueVersion) {\n return true;\n }\n\n // Trigger the `Producer` to update its `valueVersion` if necessary.\n this.onProducerUpdateValueVersion();\n\n // At this point, we can trust `producer.valueVersion`.\n return this.valueVersion !== lastSeenValueVersion;\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\nimport {createSignalFromFunction, defaultEquals, Signal, ValueEqualityFn} from './api';\nimport {ReactiveNode, setActiveConsumer} from './graph';\n\n/**\n * Options passed to the `computed` creation function.\n *\n * @developerPreview\n */\nexport interface CreateComputedOptions<T> {\n /**\n * A comparison function which defines equality for computed values.\n */\n equal?: ValueEqualityFn<T>;\n}\n\n\n/**\n * Create a computed `Signal` which derives a reactive value from an expression.\n *\n * @developerPreview\n */\nexport function computed<T>(computation: () => T, options?: CreateComputedOptions<T>): Signal<T> {\n const node = new ComputedImpl(computation, options?.equal ?? defaultEquals);\n\n // Casting here is required for g3, as TS inference behavior is slightly different between our\n // version/options and g3's.\n return createSignalFromFunction(node, node.signal.bind(node)) as unknown as Signal<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 = 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 = 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 = Symbol('ERRORED');\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 */\nclass ComputedImpl<T> extends ReactiveNode {\n constructor(private computation: () => T, private equal: (oldValue: T, newValue: T) => boolean) {\n super();\n }\n /**\n * Current value of the computation.\n *\n * This can also be one of the special values `UNSET`, `COMPUTING`, or `ERRORED`.\n */\n private value: T = UNSET;\n\n /**\n * If `value` is `ERRORED`, the error caught from the last computation attempt which will\n * be re-thrown.\n */\n private error: unknown = null;\n\n /**\n * Flag indicating that the computation is currently stale, meaning that one of the\n * dependencies has notified of a potential change.\n *\n * It's possible that no dependency has _actually_ changed, in which case the `stale`\n * state can be resolved without recomputing the value.\n */\n private stale = true;\n\n protected override readonly consumerAllowSignalWrites = false;\n\n protected override onConsumerDependencyMayHaveChanged(): void {\n if (this.stale) {\n // We've already notified consumers that this value has potentially changed.\n return;\n }\n\n // Record that the currently cached value may be stale.\n this.stale = true;\n\n // Notify any consumers about the potential change.\n this.producerMayHaveChanged();\n }\n\n protected override onProducerUpdateValueVersion(): void {\n if (!this.stale) {\n // The current value and its version are already up to date.\n return;\n }\n\n // The current value is stale. Check whether we need to produce a new one.\n\n if (this.value !== UNSET && this.value !== COMPUTING &&\n !this.consumerPollProducersForChange()) {\n // Even though we were previously notified of a potential dependency update, all of\n // our dependencies report that they have not actually changed in value, so we can\n // resolve the stale state without needing to recompute the current value.\n this.stale = false;\n return;\n }\n\n // The current value is stale, and needs to be recomputed. It still may not change -\n // that depends on whether the newly computed value is equal to the old.\n this.recomputeValue();\n }\n\n private recomputeValue(): void {\n if (this.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 = this.value;\n this.value = COMPUTING;\n\n // As we're re-running the computation, update our dependent tracking version number.\n this.trackingVersion++;\n const prevConsumer = setActiveConsumer(this);\n let newValue: T;\n try {\n newValue = this.computation();\n } catch (err) {\n newValue = ERRORED;\n this.error = err;\n } finally {\n setActiveConsumer(prevConsumer);\n }\n\n this.stale = false;\n\n if (oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED &&\n this.equal(oldValue, newValue)) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n this.value = oldValue;\n return;\n }\n\n this.value = newValue;\n this.valueVersion++;\n }\n\n signal(): T {\n // Check if the value needs updating before returning it.\n this.onProducerUpdateValueVersion();\n\n // Record that someone looked at this signal.\n this.producerAccessed();\n\n if (this.value === ERRORED) {\n throw this.error;\n }\n\n return this.value;\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 {createSignalFromFunction, defaultEquals, Signal, ValueEqualityFn} from './api';\nimport {throwInvalidWriteToSignalError} from './errors';\nimport {ReactiveNode} from './graph';\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\n/**\n * A `Signal` with a value that can be mutated via a setter interface.\n *\n * @developerPreview\n */\nexport interface WritableSignal<T> extends Signal<T> {\n /**\n * Directly set the signal to a new value, and notify any dependents.\n */\n set(value: T): void;\n\n /**\n * Update the value of the signal based on its current value, and\n * notify any dependents.\n */\n update(updateFn: (value: T) => T): void;\n\n /**\n * Update the current value by mutating it in-place, and\n * notify any dependents.\n */\n mutate(mutatorFn: (value: T) => void): void;\n}\n\nclass WritableSignalImpl<T> extends ReactiveNode {\n protected override readonly consumerAllowSignalWrites = false;\n\n constructor(private value: T, private equal: ValueEqualityFn<T>) {\n super();\n }\n\n protected override onConsumerDependencyMayHaveChanged(): void {\n // This never happens for writable signals as they're not consumers.\n }\n\n protected override onProducerUpdateValueVersion(): void {\n // Writable signal value versions are always up to date.\n }\n\n /**\n * Directly update the value of the signal to a new value, which may or may not be\n * equal to the previous.\n *\n * In the event that `newValue` is semantically equal to the current value, `set` is\n * a no-op.\n */\n set(newValue: T): void {\n if (!this.producerUpdatesAllowed) {\n throwInvalidWriteToSignalError();\n }\n if (!this.equal(this.value, newValue)) {\n this.value = newValue;\n this.valueVersion++;\n this.producerMayHaveChanged();\n\n postSignalSetFn?.();\n }\n }\n\n /**\n * Derive a new value for the signal from its current value using the `updater` function.\n *\n * This is equivalent to calling `set` on the result of running `updater` on the current\n * value.\n */\n update(updater: (value: T) => T): void {\n if (!this.producerUpdatesAllowed) {\n throwInvalidWriteToSignalError();\n }\n this.set(updater(this.value));\n }\n\n /**\n * Calls `mutator` on the current value and assumes that it has been mutated.\n */\n mutate(mutator: (value: T) => void): void {\n if (!this.producerUpdatesAllowed) {\n throwInvalidWriteToSignalError();\n }\n // Mutate bypasses equality checks as it's by definition changing the value.\n mutator(this.value);\n this.valueVersion++;\n this.producerMayHaveChanged();\n\n postSignalSetFn?.();\n }\n\n signal(): T {\n this.producerAccessed();\n return this.value;\n }\n}\n\n/**\n * Options passed to the `signal` creation function.\n *\n * @developerPreview\n */\nexport interface CreateSignalOptions<T> {\n /**\n * A comparison function which defines equality for signal values.\n */\n equal?: ValueEqualityFn<T>;\n}\n\n/**\n * Create a `Signal` that can be set or updated directly.\n *\n * @developerPreview\n */\nexport function signal<T>(initialValue: T, options?: CreateSignalOptions<T>): WritableSignal<T> {\n const signalNode = new WritableSignalImpl(initialValue, options?.equal ?? defaultEquals);\n\n // Casting here is required for g3, as TS inference behavior is slightly different between our\n // version/options and g3's.\n const signalFn = createSignalFromFunction(signalNode, signalNode.signal.bind(signalNode), {\n set: signalNode.set.bind(signalNode),\n update: signalNode.update.bind(signalNode),\n mutate: signalNode.mutate.bind(signalNode),\n }) as unknown as WritableSignal<T>;\n return signalFn;\n}\n\nexport function setPostSignalSetFn(fn: (() => void)|null): (() => void)|null {\n const prev = postSignalSetFn;\n postSignalSetFn = fn;\n return prev;\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 {setActiveConsumer} from './graph';\n\n/**\n * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function\n * can, optionally, return a value.\n *\n * @developerPreview\n */\nexport function untracked<T>(nonReactiveReadsFn: () => T): T {\n const prevConsumer = setActiveConsumer(null);\n // We are not trying to catch any particular errors here, just making sure that the consumers\n // stack is restored in case of errors.\n try {\n return nonReactiveReadsFn();\n } finally {\n setActiveConsumer(prevConsumer);\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\nimport {ReactiveNode, setActiveConsumer} 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\nconst NOOP_CLEANUP_FN: WatchCleanupFn = () => {};\n\n/**\n * Watches a reactive expression and allows it to be scheduled to re-run\n * when any dependencies notify of a change.\n *\n * `Watch` doesn't run reactive expressions itself, but relies on a consumer-\n * provided scheduling operation to coordinate calling `Watch.run()`.\n */\nexport class Watch extends ReactiveNode {\n protected override readonly consumerAllowSignalWrites: boolean;\n private dirty = false;\n private cleanupFn = NOOP_CLEANUP_FN;\n private registerOnCleanup =\n (cleanupFn: WatchCleanupFn) => {\n this.cleanupFn = cleanupFn;\n }\n\n constructor(\n private watch: (onCleanup: WatchCleanupRegisterFn) => void,\n private schedule: (watch: Watch) => void, allowSignalWrites: boolean) {\n super();\n this.consumerAllowSignalWrites = allowSignalWrites;\n }\n\n notify(): void {\n if (!this.dirty) {\n this.schedule(this);\n }\n this.dirty = true;\n }\n\n protected override onConsumerDependencyMayHaveChanged(): void {\n this.notify();\n }\n\n protected override onProducerUpdateValueVersion(): void {\n // Watches are not producers.\n }\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 this.dirty = false;\n if (this.trackingVersion !== 0 && !this.consumerPollProducersForChange()) {\n return;\n }\n\n const prevConsumer = setActiveConsumer(this);\n this.trackingVersion++;\n try {\n this.cleanupFn();\n this.cleanupFn = NOOP_CLEANUP_FN;\n this.watch(this.registerOnCleanup);\n } finally {\n setActiveConsumer(prevConsumer);\n }\n }\n\n cleanup() {\n this.cleanupFn();\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\nimport {assertInInjectionContext, computed, DestroyRef, inject, signal, Signal, WritableSignal} from '@angular/core';\nimport {RuntimeError, RuntimeErrorCode} from '@angular/core/src/errors';\nimport {Observable} from 'rxjs';\n\nimport {untracked} from '../../src/signals';\n\n/**\n * Get the current value of an `Observable` as a reactive `Signal`.\n *\n * `toSignal` returns a `Signal` which provides synchronous reactive access to values produced\n * by the given `Observable`, by subscribing to that `Observable`. The returned `Signal` will always\n * have the most recent value emitted by the subscription, and will throw an error if the\n * `Observable` errors.\n *\n * The subscription will last for the lifetime of the current injection context. That is, if\n * `toSignal` is called from a component context, the subscription will be cleaned up when the\n * component is destroyed. When called outside of a component, the current `EnvironmentInjector`'s\n * lifetime will be used (which is typically the lifetime of the application itself).\n *\n * If the `Observable` does not produce a value before the `Signal` is read, the `Signal` will throw\n * an error. To avoid this, use a synchronous `Observable` (potentially created with the `startWith`\n * operator) or pass an initial value to `toSignal` as the second argument.\n *\n * `toSignal` must be called in an injection context.\n */\nexport function toSignal<T>(source: Observable<T>): Signal<T|undefined>;\n\n/**\n * Get the current value of an `Observable` as a reactive `Signal`.\n *\n * `toSignal` returns a `Signal` which provides synchronous reactive access to values produced\n * by the given `Observable`, by subscribing to that `Observable`. The returned `Signal` will always\n * have the most recent value emitted by the subscription, and will throw an error if the\n * `Observable` errors.\n *\n * The subscription will last for the lifetime of the current injection context. That is, if\n * `toSignal` is called from a component context, the subscription will be cleaned up when the\n * component is destroyed. When called outside of a component, the current `EnvironmentInjector`'s\n * lifetime will be used (which is typically the lifetime of the application itself).\n *\n * Before the `Observable` emits its first value, the `Signal` will return the configured\n * `initialValue`. If the `Observable` is known to produce a value before the `Signal` will be read,\n * `initialValue` does not need to be passed.\n *\n * `toSignal` must be called in an injection context.\n *\n * @developerPreview\n */\nexport function toSignal<T, U extends T|null|undefined>(\n // toSignal(Observable<Animal>, {initialValue: null}) -> Signal<Animal|null>\n source: Observable<T>, options: {initialValue: U, requireSync?: false}): Signal<T|U>;\nexport function toSignal<T>(\n // toSignal(Observable<Animal>, {requireSync: true}) -> Signal<Animal>\n source: Observable<T>, options: {requireSync: true}): Signal<T>;\n// toSignal(Observable<Animal>) -> Signal<Animal|undefined>\nexport function toSignal<T, U = undefined>(\n source: Observable<T>, options?: {initialValue?: U, requireSync?: boolean}): Signal<T|U> {\n assertInInjectionContext(toSignal);\n\n // Note: T is the Observable value type, and U is the initial value type. They don't have to be\n // the same - the returned signal gives values of type `T`.\n let state: WritableSignal<State<T|U>>;\n if (options?.requireSync) {\n // Initially the signal is in a `NoValue` state.\n state = signal({kind: StateKind.NoValue});\n } else {\n // If an initial value was passed, use it. Otherwise, use `undefined` as the initial value.\n state = signal<State<T|U>>({kind: StateKind.Value, value: options?.initialValue as U});\n }\n\n const sub = source.subscribe({\n next: value => state.set({kind: StateKind.Value, value}),\n error: error => state.set({kind: StateKind.Error, error}),\n // Completion of the Observable is meaningless to the signal. Signals don't have a concept of\n // \"complete\".\n });\n\n if (ngDevMode && options?.requireSync && untracked(state).kind === StateKind.NoValue) {\n throw new RuntimeError(\n RuntimeErrorCode.REQUIRE_SYNC_WITHOUT_SYNC_EMIT,\n '`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.');\n }\n\n // Unsubscribe when the current context is destroyed.\n inject(DestroyRef).onDestroy(sub.unsubscribe.bind(sub));\n\n // The actual returned signal is a `computed` of the `State` signal, which maps the various states\n // to either values or errors.\n return computed(() => {\n const current = state();\n switch (current.kind) {\n case StateKind.Value:\n return current.value;\n case StateKind.Error:\n throw current.error;\n case StateKind.NoValue:\n // This shouldn't really happen because the error is thrown on creation.\n // TODO(alxhub): use a RuntimeError when we finalize the error semantics\n throw new RuntimeError(\n RuntimeErrorCode.REQUIRE_SYNC_WITHOUT_SYNC_EMIT,\n '`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.');\n }\n });\n}\n\nconst enum StateKind {\n NoValue,\n Value,\n Error,\n}\n\ninterface NoValueState {\n kind: StateKind.NoValue;\n}\n\ninterface ValueState<T> {\n kind: StateKind.Value;\n value: T;\n}\n\ninterface ErrorState {\n kind: StateKind.Error;\n error: unknown;\n}\n\ntype State<T> = NoValueState|ValueState<T>|ErrorState;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["global","signal","computed"],"mappings":";;;;;;;;;;;AAYA;;;;;;;;;AASG;AACG,SAAU,kBAAkB,CAAI,UAAuB,EAAA;IAC3D,IAAI,CAAC,UAAU,EAAE;QACf,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;AAC7C,QAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AACjC,KAAA;AAED,IAAA,MAAM,UAAU,GAAG,IAAI,UAAU,CAAO,QAAQ,IAAG;AACjD,QAAA,UAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtD,KAAC,CAAC,CAAC;IAEH,OAAO,CAAI,MAAqB,KAAI;QAClC,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;AAC5C,KAAC,CAAC;AACJ;;ACVA;;;;;;;;AAQG;AACa,SAAA,YAAY,CACxB,MAAiB,EACjB,OAA6B,EAAA;IAE/B,CAAC,OAAO,EAAE,QAAQ,IAAI,wBAAwB,CAAC,YAAY,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC;;;AAIvD,IAAA,OAAO,IAAI,UAAU,CAAC,QAAQ,IAAG;AAC/B,QAAA,MAAM,OAAO,GAAG,MAAM,CAAC,MAAK;AAC1B,YAAA,IAAI,KAAQ,CAAC;YACb,IAAI;gBACF,KAAK,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IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;;;IAIxD,OAAOC,UAAQ,CAAC,MAAK;AACnB,QAAA,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;QACxB,QAAQ,OAAO,CAAC,IAAI;AAClB,YAAA,KAAA,CAAA;gBACE,OAAO,OAAO,CAAC,KAAK,CAAC;AACvB,YAAA,KAAA,CAAA;gBACE,MAAM,OAAO,CAAC,KAAK,CAAC;AACtB,YAAA,KAAA,CAAA;;;AAGE,gBAAA,MAAM,IAAI,YAAY,CAElB,GAAA,wDAAA,qFAAqF,CAAC,CAAC;AAC9F,SAAA;AACH,KAAC,CAAC,CAAC;AACL;;AC/GA;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.7
2
+ * @license Angular v16.0.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -3319,7 +3319,7 @@ function isComponentDef(def) {
3319
3319
  return !!def.template;
3320
3320
  }
3321
3321
  function isRootView(target) {
3322
- return (target[FLAGS] & 256 /* LViewFlags.IsRoot */) !== 0;
3322
+ return (target[FLAGS] & 512 /* LViewFlags.IsRoot */) !== 0;
3323
3323
  }
3324
3324
  function isProjectionTNode(tNode) {
3325
3325
  return (tNode.type & 16 /* TNodeType.Projection */) === 16 /* TNodeType.Projection */;
@@ -3954,6 +3954,9 @@ class Watch extends ReactiveNode {
3954
3954
  this.schedule = schedule;
3955
3955
  this.dirty = false;
3956
3956
  this.cleanupFn = NOOP_CLEANUP_FN;
3957
+ this.registerOnCleanup = (cleanupFn) => {
3958
+ this.cleanupFn = cleanupFn;
3959
+ };
3957
3960
  this.consumerAllowSignalWrites = allowSignalWrites;
3958
3961
  }
3959
3962
  notify() {
@@ -3983,7 +3986,8 @@ class Watch extends ReactiveNode {
3983
3986
  this.trackingVersion++;
3984
3987
  try {
3985
3988
  this.cleanupFn();
3986
- this.cleanupFn = this.watch() ?? NOOP_CLEANUP_FN;
3989
+ this.cleanupFn = NOOP_CLEANUP_FN;
3990
+ this.watch(this.registerOnCleanup);
3987
3991
  }
3988
3992
  finally {
3989
3993
  setActiveConsumer(prevConsumer);
@@ -4244,7 +4248,7 @@ function isCreationMode(view) {
4244
4248
  * into a container. For that, you'll want `viewAttachedToContainer` below.
4245
4249
  */
4246
4250
  function viewAttachedToChangeDetector(view) {
4247
- return (view[FLAGS] & 64 /* LViewFlags.Attached */) === 64 /* LViewFlags.Attached */;
4251
+ return (view[FLAGS] & 128 /* LViewFlags.Attached */) === 128 /* LViewFlags.Attached */;
4248
4252
  }
4249
4253
  /** Returns a boolean for whether the view is attached to a container. */
4250
4254
  function viewAttachedToContainer(view) {
@@ -4984,7 +4988,7 @@ function incrementInitPhaseFlags(lView, initPhase) {
4984
4988
  assertNotEqual(initPhase, 3 /* InitPhaseState.InitPhaseCompleted */, 'Init hooks phase should not be incremented after all init hooks have been run.');
4985
4989
  let flags = lView[FLAGS];
4986
4990
  if ((flags & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {
4987
- flags &= 2047 /* LViewFlags.IndexWithinInitPhaseReset */;
4991
+ flags &= 4095 /* LViewFlags.IndexWithinInitPhaseReset */;
4988
4992
  flags += 1 /* LViewFlags.InitPhaseStateIncrementer */;
4989
4993
  lView[FLAGS] = flags;
4990
4994
  }
@@ -5065,12 +5069,12 @@ function callHook(currentView, initPhase, arr, i) {
5065
5069
  const directiveIndex = isInitHook ? -arr[i] : arr[i];
5066
5070
  const directive = currentView[directiveIndex];
5067
5071
  if (isInitHook) {
5068
- const indexWithintInitPhase = currentView[FLAGS] >> 11 /* LViewFlags.IndexWithinInitPhaseShift */;
5072
+ const indexWithintInitPhase = currentView[FLAGS] >> 12 /* LViewFlags.IndexWithinInitPhaseShift */;
5069
5073
  // The init phase state must be always checked here as it may have been recursively updated.
5070
5074
  if (indexWithintInitPhase <
5071
5075
  (currentView[PREORDER_HOOK_FLAGS] >> 16 /* PreOrderHookFlags.NumberOfInitHooksCalledShift */) &&
5072
5076
  (currentView[FLAGS] & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {
5073
- currentView[FLAGS] += 2048 /* LViewFlags.IndexWithinInitPhaseIncrementer */;
5077
+ currentView[FLAGS] += 4096 /* LViewFlags.IndexWithinInitPhaseIncrementer */;
5074
5078
  callHookInternal(directive, hook);
5075
5079
  }
5076
5080
  }
@@ -5660,7 +5664,7 @@ function getOrCreateInjectable(tNode, lView, token, flags = InjectFlags.Default,
5660
5664
  if (tNode !== null) {
5661
5665
  // If the view or any of its ancestors have an embedded
5662
5666
  // view injector, we have to look it up there first.
5663
- if (lView[FLAGS] & 1024 /* LViewFlags.HasEmbeddedViewInjector */) {
5667
+ if (lView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */) {
5664
5668
  const embeddedInjectorValue = lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, NOT_FOUND);
5665
5669
  if (embeddedInjectorValue !== NOT_FOUND) {
5666
5670
  return embeddedInjectorValue;
@@ -6003,8 +6007,8 @@ function lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, notFoundVa
6003
6007
  // hierarchy when resolving the value is to walk it node-by-node while attempting to resolve
6004
6008
  // the token at each level.
6005
6009
  while (currentTNode !== null && currentLView !== null &&
6006
- (currentLView[FLAGS] & 1024 /* LViewFlags.HasEmbeddedViewInjector */) &&
6007
- !(currentLView[FLAGS] & 256 /* LViewFlags.IsRoot */)) {
6010
+ (currentLView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */) &&
6011
+ !(currentLView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {
6008
6012
  ngDevMode && assertTNodeForLView(currentTNode, currentLView);
6009
6013
  // Note that this lookup on the node injector is using the `Self` flag, because
6010
6014
  // we don't want the node injector to look at any parent injectors since we
@@ -6967,7 +6971,7 @@ function getLViewParent(lView) {
6967
6971
  function getRootView(componentOrLView) {
6968
6972
  ngDevMode && assertDefined(componentOrLView, 'component');
6969
6973
  let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView);
6970
- while (lView && !(lView[FLAGS] & 256 /* LViewFlags.IsRoot */)) {
6974
+ while (lView && !(lView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {
6971
6975
  lView = getLViewParent(lView);
6972
6976
  }
6973
6977
  ngDevMode && assertLView(lView);
@@ -7213,7 +7217,7 @@ function insertView(tView, lView, lContainer, index) {
7213
7217
  lQueries.insertView(tView);
7214
7218
  }
7215
7219
  // Sets the attached flag
7216
- lView[FLAGS] |= 64 /* LViewFlags.Attached */;
7220
+ lView[FLAGS] |= 128 /* LViewFlags.Attached */;
7217
7221
  }
7218
7222
  /**
7219
7223
  * Track views created from the declaration container (TemplateRef) and inserted into a
@@ -7253,8 +7257,8 @@ function detachMovedView(declarationContainer, lView) {
7253
7257
  // If the view was marked for refresh but then detached before it was checked (where the flag
7254
7258
  // would be cleared and the counter decremented), we need to decrement the view counter here
7255
7259
  // instead.
7256
- if (lView[FLAGS] & 512 /* LViewFlags.RefreshTransplantedView */) {
7257
- lView[FLAGS] &= ~512 /* LViewFlags.RefreshTransplantedView */;
7260
+ if (lView[FLAGS] & 1024 /* LViewFlags.RefreshTransplantedView */) {
7261
+ lView[FLAGS] &= ~1024 /* LViewFlags.RefreshTransplantedView */;
7258
7262
  updateTransplantedViewCount(insertionLContainer, -1);
7259
7263
  }
7260
7264
  movedViews.splice(declarationViewIndex, 1);
@@ -7292,7 +7296,7 @@ function detachView(lContainer, removeIndex) {
7292
7296
  viewToDetach[PARENT] = null;
7293
7297
  viewToDetach[NEXT] = null;
7294
7298
  // Unsets the attached flag
7295
- viewToDetach[FLAGS] &= ~64 /* LViewFlags.Attached */;
7299
+ viewToDetach[FLAGS] &= ~128 /* LViewFlags.Attached */;
7296
7300
  }
7297
7301
  return viewToDetach;
7298
7302
  }
@@ -7304,7 +7308,7 @@ function detachView(lContainer, removeIndex) {
7304
7308
  * @param lView The view to be destroyed.
7305
7309
  */
7306
7310
  function destroyLView(tView, lView) {
7307
- if (!(lView[FLAGS] & 128 /* LViewFlags.Destroyed */)) {
7311
+ if (!(lView[FLAGS] & 256 /* LViewFlags.Destroyed */)) {
7308
7312
  const renderer = lView[RENDERER];
7309
7313
  lView[REACTIVE_TEMPLATE_CONSUMER]?.destroy();
7310
7314
  lView[REACTIVE_HOST_BINDING_CONSUMER]?.destroy();
@@ -7323,16 +7327,16 @@ function destroyLView(tView, lView) {
7323
7327
  * @param lView The LView to clean up
7324
7328
  */
7325
7329
  function cleanUpView(tView, lView) {
7326
- if (!(lView[FLAGS] & 128 /* LViewFlags.Destroyed */)) {
7330
+ if (!(lView[FLAGS] & 256 /* LViewFlags.Destroyed */)) {
7327
7331
  // Usually the Attached flag is removed when the view is detached from its parent, however
7328
7332
  // if it's a root view, the flag won't be unset hence why we're also removing on destroy.
7329
- lView[FLAGS] &= ~64 /* LViewFlags.Attached */;
7333
+ lView[FLAGS] &= ~128 /* LViewFlags.Attached */;
7330
7334
  // Mark the LView as destroyed *before* executing the onDestroy hooks. An onDestroy hook
7331
7335
  // runs arbitrary user code, which could include its own `viewRef.destroy()` (or similar). If
7332
7336
  // We don't flag the view as destroyed before the hooks, this could lead to an infinite loop.
7333
7337
  // This also aligns with the ViewEngine behavior. It also means that the onDestroy hook is
7334
7338
  // really more of an "afterDestroy" hook if you think about it.
7335
- lView[FLAGS] |= 128 /* LViewFlags.Destroyed */;
7339
+ lView[FLAGS] |= 256 /* LViewFlags.Destroyed */;
7336
7340
  executeOnDestroys(tView, lView);
7337
7341
  processCleanups(tView, lView);
7338
7342
  // For component views only, the local renderer is destroyed at clean up time.
@@ -9797,6 +9801,16 @@ const CSP_NONCE = new InjectionToken('CSP nonce', {
9797
9801
  return getDocument().body.querySelector('[ngCspNonce]')?.getAttribute('ngCspNonce') || null;
9798
9802
  },
9799
9803
  });
9804
+ /**
9805
+ * Internal token to collect all SSR-related features enabled for this application.
9806
+ *
9807
+ * Note: the token is in `core` to let other packages register features (the `core`
9808
+ * package is imported in other packages).
9809
+ */
9810
+ const ENABLED_SSR_FEATURES = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'ENABLED_SSR_FEATURES' : '', {
9811
+ providedIn: 'root',
9812
+ factory: () => new Set(),
9813
+ });
9800
9814
 
9801
9815
  function escapeTransferStateContent(text) {
9802
9816
  const escapedText = {
@@ -10350,7 +10364,7 @@ class Version {
10350
10364
  /**
10351
10365
  * @publicApi
10352
10366
  */
10353
- const VERSION = new Version('16.0.0-next.7');
10367
+ const VERSION = new Version('16.0.0-rc.0');
10354
10368
 
10355
10369
  // This default value is when checking the hierarchy for a token.
10356
10370
  //
@@ -10384,7 +10398,7 @@ const NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
10384
10398
  */
10385
10399
  function markViewDirty(lView) {
10386
10400
  while (lView) {
10387
- lView[FLAGS] |= 32 /* LViewFlags.Dirty */;
10401
+ lView[FLAGS] |= 64 /* LViewFlags.Dirty */;
10388
10402
  const parent = getLViewParent(lView);
10389
10403
  // Stop traversing up as soon as you find a root view that wasn't attached to any container
10390
10404
  if (isRootView(lView) && !parent) {
@@ -11088,10 +11102,10 @@ function renderChildComponents(hostLView, components) {
11088
11102
  function createLView(parentLView, tView, context, flags, host, tHostNode, environment, renderer, injector, embeddedViewInjector, hydrationInfo) {
11089
11103
  const lView = tView.blueprint.slice();
11090
11104
  lView[HOST] = host;
11091
- lView[FLAGS] = flags | 4 /* LViewFlags.CreationMode */ | 64 /* LViewFlags.Attached */ | 8 /* LViewFlags.FirstLViewPass */;
11105
+ lView[FLAGS] = flags | 4 /* LViewFlags.CreationMode */ | 128 /* LViewFlags.Attached */ | 8 /* LViewFlags.FirstLViewPass */;
11092
11106
  if (embeddedViewInjector !== null ||
11093
- (parentLView && (parentLView[FLAGS] & 1024 /* LViewFlags.HasEmbeddedViewInjector */))) {
11094
- lView[FLAGS] |= 1024 /* LViewFlags.HasEmbeddedViewInjector */;
11107
+ (parentLView && (parentLView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */))) {
11108
+ lView[FLAGS] |= 2048 /* LViewFlags.HasEmbeddedViewInjector */;
11095
11109
  }
11096
11110
  resetPreOrderHookFlags(lView);
11097
11111
  ngDevMode && tView.declTNode && parentLView && assertTNodeForLView(tView.declTNode, parentLView);
@@ -11277,7 +11291,7 @@ function renderView(tView, lView, context) {
11277
11291
  function refreshView(tView, lView, templateFn, context) {
11278
11292
  ngDevMode && assertEqual(isCreationMode(lView), false, 'Should be run in update mode');
11279
11293
  const flags = lView[FLAGS];
11280
- if ((flags & 128 /* LViewFlags.Destroyed */) === 128 /* LViewFlags.Destroyed */)
11294
+ if ((flags & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */)
11281
11295
  return;
11282
11296
  // Check no changes mode is a dev only mode used to verify that bindings have not changed
11283
11297
  // since they were assigned. We do not want to execute lifecycle hooks in that mode.
@@ -11380,10 +11394,10 @@ function refreshView(tView, lView, templateFn, context) {
11380
11394
  // no changes cycle, the component would be not be dirty for the next update pass. This would
11381
11395
  // be different in production mode where the component dirty state is not reset.
11382
11396
  if (!isInCheckNoChangesPass) {
11383
- lView[FLAGS] &= ~(32 /* LViewFlags.Dirty */ | 8 /* LViewFlags.FirstLViewPass */);
11397
+ lView[FLAGS] &= ~(64 /* LViewFlags.Dirty */ | 8 /* LViewFlags.FirstLViewPass */);
11384
11398
  }
11385
- if (lView[FLAGS] & 512 /* LViewFlags.RefreshTransplantedView */) {
11386
- lView[FLAGS] &= ~512 /* LViewFlags.RefreshTransplantedView */;
11399
+ if (lView[FLAGS] & 1024 /* LViewFlags.RefreshTransplantedView */) {
11400
+ lView[FLAGS] &= ~1024 /* LViewFlags.RefreshTransplantedView */;
11387
11401
  updateTransplantedViewCount(lView[PARENT], -1);
11388
11402
  }
11389
11403
  }
@@ -11835,7 +11849,7 @@ function markDirtyIfOnPush(lView, viewIndex) {
11835
11849
  ngDevMode && assertLView(lView);
11836
11850
  const childComponentLView = getComponentLViewByIndex(viewIndex, lView);
11837
11851
  if (!(childComponentLView[FLAGS] & 16 /* LViewFlags.CheckAlways */)) {
11838
- childComponentLView[FLAGS] |= 32 /* LViewFlags.Dirty */;
11852
+ childComponentLView[FLAGS] |= 64 /* LViewFlags.Dirty */;
11839
11853
  }
11840
11854
  }
11841
11855
  function setNgReflectProperty(lView, element, type, attrName, value) {
@@ -12208,7 +12222,7 @@ function addComponentLogic(lView, hostTNode, def) {
12208
12222
  // Only component views should be added to the view tree directly. Embedded views are
12209
12223
  // accessed through their containers because they may be removed / re-added later.
12210
12224
  const rendererFactory = lView[ENVIRONMENT].rendererFactory;
12211
- 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));
12225
+ const componentView = addToViewTree(lView, createLView(lView, tView, null, def.onPush ? 64 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, native, hostTNode, null, rendererFactory.createRenderer(native, def), null, null, null));
12212
12226
  // Component view will always be created before any injected LContainers,
12213
12227
  // so this is a regular element, wrap it with the component view
12214
12228
  lView[hostTNode.index] = componentView;
@@ -12381,14 +12395,14 @@ function markTransplantedViewsForRefresh(lView) {
12381
12395
  ngDevMode && assertLContainer(insertionLContainer);
12382
12396
  // We don't want to increment the counter if the moved LView was already marked for
12383
12397
  // refresh.
12384
- if ((movedLView[FLAGS] & 512 /* LViewFlags.RefreshTransplantedView */) === 0) {
12398
+ if ((movedLView[FLAGS] & 1024 /* LViewFlags.RefreshTransplantedView */) === 0) {
12385
12399
  updateTransplantedViewCount(insertionLContainer, 1);
12386
12400
  }
12387
12401
  // Note, it is possible that the `movedViews` is tracking views that are transplanted *and*
12388
12402
  // those that aren't (declaration component === insertion component). In the latter case,
12389
12403
  // it's fine to add the flag, as we will clear it immediately in
12390
12404
  // `refreshEmbeddedViews` for the view currently being refreshed.
12391
- movedLView[FLAGS] |= 512 /* LViewFlags.RefreshTransplantedView */;
12405
+ movedLView[FLAGS] |= 1024 /* LViewFlags.RefreshTransplantedView */;
12392
12406
  }
12393
12407
  }
12394
12408
  }
@@ -12404,7 +12418,7 @@ function refreshComponent(hostLView, componentHostIdx) {
12404
12418
  // Only attached components that are CheckAlways or OnPush and dirty should be refreshed
12405
12419
  if (viewAttachedToChangeDetector(componentView)) {
12406
12420
  const tView = componentView[TVIEW];
12407
- if (componentView[FLAGS] & (16 /* LViewFlags.CheckAlways */ | 32 /* LViewFlags.Dirty */)) {
12421
+ if (componentView[FLAGS] & (16 /* LViewFlags.CheckAlways */ | 64 /* LViewFlags.Dirty */)) {
12408
12422
  refreshView(tView, componentView, tView.template, componentView[CONTEXT]);
12409
12423
  }
12410
12424
  else if (componentView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
@@ -12424,7 +12438,7 @@ function refreshContainsDirtyView(lView) {
12424
12438
  for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
12425
12439
  const embeddedLView = lContainer[i];
12426
12440
  if (viewAttachedToChangeDetector(embeddedLView)) {
12427
- if (embeddedLView[FLAGS] & 512 /* LViewFlags.RefreshTransplantedView */) {
12441
+ if (embeddedLView[FLAGS] & 1024 /* LViewFlags.RefreshTransplantedView */) {
12428
12442
  const embeddedTView = embeddedLView[TVIEW];
12429
12443
  ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
12430
12444
  refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
@@ -12885,7 +12899,7 @@ class ViewRef {
12885
12899
  this._lView[CONTEXT] = value;
12886
12900
  }
12887
12901
  get destroyed() {
12888
- return (this._lView[FLAGS] & 128 /* LViewFlags.Destroyed */) === 128 /* LViewFlags.Destroyed */;
12902
+ return (this._lView[FLAGS] & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */;
12889
12903
  }
12890
12904
  destroy() {
12891
12905
  if (this._appRef) {
@@ -12998,7 +13012,7 @@ class ViewRef {
12998
13012
  * ```
12999
13013
  */
13000
13014
  detach() {
13001
- this._lView[FLAGS] &= ~64 /* LViewFlags.Attached */;
13015
+ this._lView[FLAGS] &= ~128 /* LViewFlags.Attached */;
13002
13016
  }
13003
13017
  /**
13004
13018
  * Re-attaches a view to the change detection tree.
@@ -13057,7 +13071,7 @@ class ViewRef {
13057
13071
  * ```
13058
13072
  */
13059
13073
  reattach() {
13060
- this._lView[FLAGS] |= 64 /* LViewFlags.Attached */;
13074
+ this._lView[FLAGS] |= 128 /* LViewFlags.Attached */;
13061
13075
  }
13062
13076
  /**
13063
13077
  * Checks the view and its children.
@@ -13243,8 +13257,8 @@ class ComponentFactory extends ComponentFactory$1 {
13243
13257
  const hostRNode = rootSelectorOrNode ?
13244
13258
  locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation, rootViewInjector) :
13245
13259
  createElementNode(hostRenderer, elementName, getNamespace(elementName));
13246
- const rootFlags = this.componentDef.onPush ? 32 /* LViewFlags.Dirty */ | 256 /* LViewFlags.IsRoot */ :
13247
- 16 /* LViewFlags.CheckAlways */ | 256 /* LViewFlags.IsRoot */;
13260
+ const rootFlags = this.componentDef.onPush ? 64 /* LViewFlags.Dirty */ | 512 /* LViewFlags.IsRoot */ :
13261
+ 16 /* LViewFlags.CheckAlways */ | 512 /* LViewFlags.IsRoot */;
13248
13262
  // Create the root view. Uses empty TView and ContentTemplate.
13249
13263
  const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null, null);
13250
13264
  const rootLView = createLView(null, rootTView, null, rootFlags, null, null, environment, hostRenderer, rootViewInjector, null, null);
@@ -13387,7 +13401,7 @@ function createRootComponentView(tNode, hostRNode, rootComponentDef, rootDirecti
13387
13401
  hydrationInfo = retrieveHydrationInfo(hostRNode, rootView[INJECTOR$1]);
13388
13402
  }
13389
13403
  const viewRenderer = environment.rendererFactory.createRenderer(hostRNode, rootComponentDef);
13390
- const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, rootComponentDef.onPush ? 32 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[tNode.index], tNode, environment, viewRenderer, null, null, hydrationInfo);
13404
+ const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, rootComponentDef.onPush ? 64 /* LViewFlags.Dirty */ : 16 /* LViewFlags.CheckAlways */, rootView[tNode.index], tNode, environment, viewRenderer, null, null, hydrationInfo);
13391
13405
  if (tView.firstCreatePass) {
13392
13406
  markAsComponentHost(tView, tNode, rootDirectives.length - 1);
13393
13407
  }
@@ -14677,22 +14691,6 @@ function invalidSkipHydrationHost(rNode) {
14677
14691
  const message = header + actual + footer;
14678
14692
  return new RuntimeError(-504 /* RuntimeErrorCode.INVALID_SKIP_HYDRATION_HOST */, message);
14679
14693
  }
14680
- /**
14681
- * Builds the hydration error message in the case that a user is attempting to enable
14682
- * hydration on internationalized nodes, which is not yet supported.
14683
- *
14684
- * @param rNode the HTML Element
14685
- * @returns an error
14686
- */
14687
- function notYetSupportedI18nBlockError(rNode) {
14688
- const header = 'Hydration for nodes marked with `i18n` is not yet supported. ' +
14689
- 'You can opt-out a component that uses `i18n` in a template using ' +
14690
- 'the `ngSkipHydration` attribute or fall back to the previous ' +
14691
- 'hydration logic (which re-creates the application structure).\n\n';
14692
- const actual = `${describeDomFromNode(rNode)}\n\n`;
14693
- const message = header + actual;
14694
- return new RuntimeError(518 /* RuntimeErrorCode.HYDRATION_I18N_NOT_YET_SUPPORTED */, message);
14695
- }
14696
14694
  // Stringification methods
14697
14695
  /**
14698
14696
  * Stringifies a given TNode's attributes
@@ -21281,6 +21279,18 @@ function ɵɵi18nStart(index, messageIndex, subTemplateIndex = -1) {
21281
21279
  if (tView.firstCreatePass) {
21282
21280
  i18nStartFirstCreatePass(tView, parentTNode === null ? 0 : parentTNode.index, lView, adjustedIndex, message, subTemplateIndex);
21283
21281
  }
21282
+ // Set a flag that this LView has i18n blocks.
21283
+ // The flag is later used to determine whether this component should
21284
+ // be hydrated (currently hydration is not supported for i18n blocks).
21285
+ if (tView.type === 2 /* TViewType.Embedded */) {
21286
+ // Annotate host component's LView (not embedded view's LView),
21287
+ // since hydration can be skipped on per-component basis only.
21288
+ const componentLView = lView[DECLARATION_COMPONENT_VIEW];
21289
+ componentLView[FLAGS] |= 32 /* LViewFlags.HasI18n */;
21290
+ }
21291
+ else {
21292
+ lView[FLAGS] |= 32 /* LViewFlags.HasI18n */;
21293
+ }
21284
21294
  const tI18n = tView.data[adjustedIndex];
21285
21295
  const sameViewParentTNode = parentTNode === lView[T_HOST] ? null : parentTNode;
21286
21296
  const parentRNode = getClosestRElement(tView, sameViewParentTNode, lView);
@@ -21978,7 +21988,7 @@ function getOwningComponent(elementOrDir) {
21978
21988
  while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {
21979
21989
  lView = parent;
21980
21990
  }
21981
- return lView[FLAGS] & 256 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
21991
+ return lView[FLAGS] & 512 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
21982
21992
  }
21983
21993
  /**
21984
21994
  * Retrieves all root components associated with a DOM element, directive or component instance.