@angular/core 20.2.0-next.2 → 20.2.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/api.d.d.ts +2 -2
  2. package/chrome_dev_tools_performance.d.d.ts +1 -1
  3. package/discovery.d.d.ts +2 -1
  4. package/event_dispatcher.d.d.ts +1 -1
  5. package/fesm2022/attribute.mjs +1 -1
  6. package/fesm2022/attribute.mjs.map +1 -1
  7. package/fesm2022/core.mjs +4 -4
  8. package/fesm2022/core.mjs.map +1 -1
  9. package/fesm2022/debug_node.mjs +34 -49
  10. package/fesm2022/debug_node.mjs.map +1 -1
  11. package/fesm2022/not_found.mjs +1 -1
  12. package/fesm2022/not_found.mjs.map +1 -1
  13. package/fesm2022/primitives/di.mjs +1 -1
  14. package/fesm2022/primitives/di.mjs.map +1 -1
  15. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  16. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  17. package/fesm2022/primitives/signals.mjs +1 -1
  18. package/fesm2022/primitives/signals.mjs.map +1 -1
  19. package/fesm2022/resource.mjs +12 -3
  20. package/fesm2022/resource.mjs.map +1 -1
  21. package/fesm2022/root_effect_scheduler.mjs +1 -1
  22. package/fesm2022/root_effect_scheduler.mjs.map +1 -1
  23. package/fesm2022/rxjs-interop.mjs +1 -1
  24. package/fesm2022/rxjs-interop.mjs.map +1 -1
  25. package/fesm2022/signal.mjs +154 -118
  26. package/fesm2022/signal.mjs.map +1 -1
  27. package/fesm2022/testing.mjs +19 -2
  28. package/fesm2022/testing.mjs.map +1 -1
  29. package/fesm2022/untracked.mjs +1 -1
  30. package/fesm2022/untracked.mjs.map +1 -1
  31. package/fesm2022/weak_ref.mjs +1 -1
  32. package/fesm2022/weak_ref.mjs.map +1 -1
  33. package/graph.d.d.ts +20 -33
  34. package/index.d.ts +13 -2
  35. package/package.json +2 -2
  36. package/primitives/di/index.d.ts +1 -1
  37. package/primitives/event-dispatch/index.d.ts +1 -1
  38. package/primitives/signals/index.d.ts +1 -1
  39. package/rxjs-interop/index.d.ts +1 -1
  40. package/schematics/bundles/{apply_import_manager-Bkosyy2x.cjs → apply_import_manager-C9H5B66Q.cjs} +3 -3
  41. package/schematics/bundles/{checker-Cfq29XaS.cjs → checker-DBomdQHo.cjs} +30 -9
  42. package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
  43. package/schematics/bundles/{compiler_host-CSrf1kFh.cjs → compiler_host-DTywrGR6.cjs} +2 -2
  44. package/schematics/bundles/control-flow-migration.cjs +3 -3
  45. package/schematics/bundles/document-core.cjs +5 -5
  46. package/schematics/bundles/imports-CIX-JgAN.cjs +1 -1
  47. package/schematics/bundles/{index-DYbdsCUu.cjs → index-DWQ8GMRM.cjs} +19 -23
  48. package/schematics/bundles/{index-DwmX8Ifa.cjs → index-DvIl8s8s.cjs} +4 -4
  49. package/schematics/bundles/inject-flags.cjs +5 -5
  50. package/schematics/bundles/inject-migration.cjs +3 -3
  51. package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
  52. package/schematics/bundles/{migrate_ts_type_references-C7NB9fZH.cjs → migrate_ts_type_references-BFb3oiAk.cjs} +5 -5
  53. package/schematics/bundles/ng_decorators-B5HCqr20.cjs +1 -1
  54. package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
  55. package/schematics/bundles/output-migration.cjs +6 -6
  56. package/schematics/bundles/{project_paths-5CoqAjNK.cjs → project_paths-Cuim0I7i.cjs} +3 -3
  57. package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +1 -1
  58. package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
  59. package/schematics/bundles/route-lazy-loading.cjs +3 -3
  60. package/schematics/bundles/self-closing-tags-migration.cjs +4 -4
  61. package/schematics/bundles/signal-input-migration.cjs +7 -7
  62. package/schematics/bundles/signal-queries-migration.cjs +7 -7
  63. package/schematics/bundles/signals.cjs +7 -7
  64. package/schematics/bundles/standalone-migration.cjs +4 -4
  65. package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
  66. package/schematics/bundles/test-bed-get.cjs +4 -4
  67. package/signal.d.d.ts +1 -1
  68. package/testing/index.d.ts +6 -1
  69. package/weak_ref.d.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.2.0-next.2
2
+ * @license Angular v20.2.0-next.3
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"rxjs-interop.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/take_until_destroyed.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/output_from_observable.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/output_to_observable.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/to_observable.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/to_signal.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/pending_until_event.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/rx_resource.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.dev/license\n */\n\nimport {assertInInjectionContext, DestroyRef, inject} from '../../src/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\n * context](guide/di/dependency-injection-context). Otherwise, the current `DestroyRef` is injected.\n *\n * @publicApi 19.0\n */\nexport function takeUntilDestroyed<T>(destroyRef?: DestroyRef): MonoTypeOperatorFunction<T> {\n if (!destroyRef) {\n ngDevMode && assertInInjectionContext(takeUntilDestroyed);\n destroyRef = inject(DestroyRef);\n }\n\n const destroyed$ = new Observable<void>((subscriber) => {\n if (destroyRef.destroyed) {\n subscriber.next();\n return;\n }\n const unregisterFn = destroyRef.onDestroy(subscriber.next.bind(subscriber));\n return unregisterFn;\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.dev/license\n */\n\nimport {\n assertInInjectionContext,\n DestroyRef,\n inject,\n OutputOptions,\n OutputRef,\n OutputRefSubscription,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n} from '../../src/core';\nimport {Observable} from 'rxjs';\n\nimport {takeUntilDestroyed} from './take_until_destroyed';\n\n/**\n * Implementation of `OutputRef` that emits values from\n * an RxJS observable source.\n *\n * @internal\n */\nclass OutputFromObservableRef<T> implements OutputRef<T> {\n private destroyed = false;\n\n destroyRef = inject(DestroyRef);\n\n constructor(private source: Observable<T>) {\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n });\n }\n\n subscribe(callbackFn: (value: T) => void): OutputRefSubscription {\n if (this.destroyed) {\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.OUTPUT_REF_DESTROYED,\n ngDevMode &&\n 'Unexpected subscription to destroyed `OutputRef`. ' +\n 'The owning directive/component is destroyed.',\n );\n }\n\n // Stop yielding more values when the directive/component is already destroyed.\n const subscription = this.source.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({\n next: (value) => callbackFn(value),\n });\n\n return {\n unsubscribe: () => subscription.unsubscribe(),\n };\n }\n}\n\n/**\n * Declares an Angular output that is using an RxJS observable as a source\n * for events dispatched to parent subscribers.\n *\n * The behavior for an observable as source is defined as followed:\n * 1. New values are forwarded to the Angular output (next notifications).\n * 2. Errors notifications are not handled by Angular. You need to handle these manually.\n * For example by using `catchError`.\n * 3. Completion notifications stop the output from emitting new values.\n *\n * @usageNotes\n * Initialize an output in your directive by declaring a\n * class field and initializing it with the `outputFromObservable()` function.\n *\n * ```ts\n * @Directive({..})\n * export class MyDir {\n * nameChange$ = <some-observable>;\n * nameChange = outputFromObservable(this.nameChange$);\n * }\n * ```\n *\n * @publicApi 19.0\n */\nexport function outputFromObservable<T>(\n observable: Observable<T>,\n opts?: OutputOptions,\n): OutputRef<T> {\n ngDevMode && assertInInjectionContext(outputFromObservable);\n return new OutputFromObservableRef<T>(observable);\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.dev/license\n */\n\nimport {OutputRef, ɵgetOutputDestroyRef} from '../../src/core';\nimport {Observable} from 'rxjs';\n\n/**\n * Converts an Angular output declared via `output()` or `outputFromObservable()`\n * to an observable.\n *\n * You can subscribe to the output via `Observable.subscribe` then.\n *\n * @publicApi 19.0\n */\nexport function outputToObservable<T>(ref: OutputRef<T>): Observable<T> {\n const destroyRef = ɵgetOutputDestroyRef(ref);\n\n return new Observable<T>((observer) => {\n // Complete the observable upon directive/component destroy.\n // Note: May be `undefined` if an `EventEmitter` is declared outside\n // of an injection context.\n const unregisterOnDestroy = destroyRef?.onDestroy(() => observer.complete());\n\n const subscription = ref.subscribe((v) => observer.next(v));\n return () => {\n subscription.unsubscribe();\n unregisterOnDestroy?.();\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.dev/license\n */\n\nimport {\n assertInInjectionContext,\n DestroyRef,\n effect,\n inject,\n Injector,\n Signal,\n untracked,\n} from '../../src/core';\nimport {Observable, ReplaySubject} from 'rxjs';\n\n/**\n * Options for `toObservable`.\n *\n * @publicApi 20.0\n */\nexport interface ToObservableOptions {\n /**\n * The `Injector` to use when creating the underlying `effect` which watches the signal.\n *\n * If this isn't specified, the current [injection context](guide/di/dependency-injection-context)\n * 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 unless an injector is provided via options.\n *\n * @publicApi 20.0\n */\nexport function toObservable<T>(source: Signal<T>, options?: ToObservableOptions): Observable<T> {\n if (ngDevMode && !options?.injector) {\n assertInInjectionContext(toObservable);\n }\n const injector = options?.injector ?? inject(Injector);\n const subject = new ReplaySubject<T>(1);\n\n const watcher = effect(\n () => {\n let value: T;\n try {\n value = source();\n } catch (err) {\n untracked(() => subject.error(err));\n return;\n }\n untracked(() => subject.next(value));\n },\n {injector, manualCleanup: true},\n );\n\n injector.get(DestroyRef).onDestroy(() => {\n watcher.destroy();\n subject.complete();\n });\n\n return subject.asObservable();\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.dev/license\n */\n\nimport {\n assertInInjectionContext,\n assertNotInReactiveContext,\n computed,\n DestroyRef,\n inject,\n Injector,\n signal,\n Signal,\n WritableSignal,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n} from '../../src/core';\nimport {ValueEqualityFn} from '../../primitives/signals';\nimport {Observable, Subscribable} from 'rxjs';\n\n/**\n * Options for `toSignal`.\n *\n * @publicApi 20.0\n */\nexport interface ToSignalOptions<T> {\n /**\n * Initial value for the signal produced by `toSignal`.\n *\n * This will be the value of the signal until the observable emits its first value.\n */\n initialValue?: unknown;\n\n /**\n * Whether to require that the observable emits synchronously when `toSignal` subscribes.\n *\n * If this is `true`, `toSignal` will assert that the observable produces a value immediately upon\n * subscription. Setting this option removes the need to either deal with `undefined` in the\n * signal type or provide an `initialValue`, at the cost of a runtime error if this requirement is\n * not met.\n */\n requireSync?: boolean;\n\n /**\n * `Injector` which will provide the `DestroyRef` used to clean up the Observable subscription.\n *\n * If this is not provided, a `DestroyRef` will be retrieved from the current [injection\n * context](guide/di/dependency-injection-context), unless manual cleanup is requested.\n */\n injector?: Injector;\n\n /**\n * Whether the subscription should be automatically cleaned up (via `DestroyRef`) when\n * `toSignal`'s creation context is destroyed.\n *\n * If manual cleanup is enabled, then `DestroyRef` is not used, and the subscription will persist\n * until the `Observable` itself completes.\n */\n manualCleanup?: boolean;\n\n /**\n * A comparison function which defines equality for values emitted by the observable.\n *\n * Equality comparisons are executed against the initial value if one is provided.\n */\n equal?: ValueEqualityFn<T>;\n}\n\n// Base case: no options -> `undefined` in the result type.\nexport function toSignal<T>(source: Observable<T> | Subscribable<T>): Signal<T | undefined>;\n// Options with `undefined` initial value and no `requiredSync` -> `undefined`.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T | undefined>> & {\n initialValue?: undefined;\n requireSync?: false;\n },\n): Signal<T | undefined>;\n// Options with `null` initial value -> `null`.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T | null>> & {initialValue?: null; requireSync?: false},\n): Signal<T | null>;\n// Options with `undefined` initial value and `requiredSync` -> strict result type.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T>> & {initialValue?: undefined; requireSync: true},\n): Signal<T>;\n// Options with a more specific initial value type.\nexport function toSignal<T, const U extends T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T | U>> & {initialValue: U; requireSync?: false},\n): Signal<T | U>;\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 * With `requireSync` set to `true`, `toSignal` will assert that the `Observable` produces a value\n * immediately upon subscription. No `initialValue` is needed in this case, and the returned signal\n * does not include an `undefined` type.\n *\n * By default, the subscription will be automatically cleaned up when the current [injection\n * context](guide/di/dependency-injection-context) is destroyed. For example, when `toSignal` is\n * called during the construction of a component, the subscription will be cleaned up when the\n * component is destroyed. If an injection context is not available, an explicit `Injector` can be\n * passed instead.\n *\n * If the subscription should persist until the `Observable` itself completes, the `manualCleanup`\n * option can be specified instead, which disables the automatic subscription teardown. No injection\n * context is needed in this configuration as well.\n */\nexport function toSignal<T, U = undefined>(\n source: Observable<T> | Subscribable<T>,\n options?: ToSignalOptions<T | U> & {initialValue?: U},\n): Signal<T | U> {\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n assertNotInReactiveContext(\n toSignal,\n 'Invoking `toSignal` causes new subscriptions every time. ' +\n 'Consider moving `toSignal` outside of the reactive context and read the signal value where needed.',\n );\n\n const requiresCleanup = !options?.manualCleanup;\n\n if (ngDevMode && requiresCleanup && !options?.injector) {\n assertInInjectionContext(toSignal);\n }\n\n const cleanupRef = requiresCleanup\n ? (options?.injector?.get(DestroyRef) ?? inject(DestroyRef))\n : null;\n\n const equal = makeToSignalEqual(options?.equal);\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}, {equal});\n } else {\n // If an initial value was passed, use it. Otherwise, use `undefined` as the initial value.\n state = signal<State<T | U>>(\n {kind: StateKind.Value, value: options?.initialValue as U},\n {equal},\n );\n }\n\n let destroyUnregisterFn: (() => void) | undefined;\n\n // Note: This code cannot run inside a reactive context (see assertion above). If we'd support\n // this, we would subscribe to the observable outside of the current reactive context, avoiding\n // that side-effect signal reads/writes are attribute to the current consumer. The current\n // consumer only needs to be notified when the `state` signal changes through the observable\n // subscription. Additional context (related to async pipe):\n // https://github.com/angular/angular/pull/50522.\n const sub = source.subscribe({\n next: (value) => state.set({kind: StateKind.Value, value}),\n error: (error) => {\n state.set({kind: StateKind.Error, error});\n destroyUnregisterFn?.();\n },\n complete: () => {\n destroyUnregisterFn?.();\n },\n // Completion of the Observable is meaningless to the signal. Signals don't have a concept of\n // \"complete\".\n });\n\n if (options?.requireSync && state().kind === StateKind.NoValue) {\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.REQUIRE_SYNC_WITHOUT_SYNC_EMIT,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n '`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.',\n );\n }\n\n // Unsubscribe when the current context is destroyed, if requested.\n destroyUnregisterFn = cleanupRef?.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 () => {\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 throw new ɵRuntimeError(\n ɵRuntimeErrorCode.REQUIRE_SYNC_WITHOUT_SYNC_EMIT,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n '`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.',\n );\n }\n },\n {equal: options?.equal},\n );\n}\n\nfunction makeToSignalEqual<T>(\n userEquality: ValueEqualityFn<T> = Object.is,\n): ValueEqualityFn<State<T>> {\n return (a, b) =>\n a.kind === StateKind.Value && b.kind === StateKind.Value && userEquality(a.value, b.value);\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.dev/license\n */\n\nimport {assertInInjectionContext, PendingTasks, inject, Injector} from '../../src/core';\nimport {MonoTypeOperatorFunction, Observable} from 'rxjs';\n\n/**\n * Operator which makes the application unstable until the observable emits, completes, errors, or is unsubscribed.\n *\n * Use this operator in observables whose subscriptions are important for rendering and should be included in SSR serialization.\n *\n * @param injector The `Injector` to use during creation. If this is not provided, the current injection context will be used instead (via `inject`).\n *\n * @developerPreview 20.0\n */\nexport function pendingUntilEvent<T>(injector?: Injector): MonoTypeOperatorFunction<T> {\n if (injector === undefined) {\n ngDevMode && assertInInjectionContext(pendingUntilEvent);\n injector = inject(Injector);\n }\n const taskService = injector.get(PendingTasks);\n\n return (sourceObservable) => {\n return new Observable<T>((originalSubscriber) => {\n // create a new task on subscription\n const removeTask = taskService.add();\n\n let cleanedUp = false;\n function cleanupTask() {\n if (cleanedUp) {\n return;\n }\n\n removeTask();\n cleanedUp = true;\n }\n\n const innerSubscription = sourceObservable.subscribe({\n next: (v) => {\n originalSubscriber.next(v);\n cleanupTask();\n },\n complete: () => {\n originalSubscriber.complete();\n cleanupTask();\n },\n error: (e) => {\n originalSubscriber.error(e);\n cleanupTask();\n },\n });\n innerSubscription.add(() => {\n originalSubscriber.unsubscribe();\n cleanupTask();\n });\n return innerSubscription;\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.dev/license\n */\n\nimport {\n assertInInjectionContext,\n resource,\n ResourceLoaderParams,\n ResourceRef,\n Signal,\n signal,\n BaseResourceOptions,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n ResourceStreamItem,\n} from '../../src/core';\nimport {Observable, Subscription} from 'rxjs';\nimport {encapsulateResourceError} from '../../src/resource/resource';\n\n/**\n * Like `ResourceOptions` but uses an RxJS-based `loader`.\n *\n * @experimental\n */\nexport interface RxResourceOptions<T, R> extends BaseResourceOptions<T, R> {\n stream: (params: ResourceLoaderParams<R>) => Observable<T>;\n}\n\n/**\n * Like `resource` but uses an RxJS based `loader` which maps the request to an `Observable` of the\n * resource's value.\n *\n * @experimental\n */\nexport function rxResource<T, R>(\n opts: RxResourceOptions<T, R> & {defaultValue: NoInfer<T>},\n): ResourceRef<T>;\n\n/**\n * Like `resource` but uses an RxJS based `loader` which maps the request to an `Observable` of the\n * resource's value.\n *\n * @experimental\n */\nexport function rxResource<T, R>(opts: RxResourceOptions<T, R>): ResourceRef<T | undefined>;\nexport function rxResource<T, R>(opts: RxResourceOptions<T, R>): ResourceRef<T | undefined> {\n if (ngDevMode && !opts?.injector) {\n assertInInjectionContext(rxResource);\n }\n return resource<T, R>({\n ...opts,\n loader: undefined,\n stream: (params) => {\n let sub: Subscription;\n\n // Track the abort listener so it can be removed if the Observable completes (as a memory\n // optimization).\n const onAbort = () => sub.unsubscribe();\n params.abortSignal.addEventListener('abort', onAbort);\n\n // Start off stream as undefined.\n const stream = signal<ResourceStreamItem<T>>({value: undefined as T});\n let resolve: ((value: Signal<ResourceStreamItem<T>>) => void) | undefined;\n const promise = new Promise<Signal<ResourceStreamItem<T>>>((r) => (resolve = r));\n\n function send(value: ResourceStreamItem<T>): void {\n stream.set(value);\n resolve?.(stream);\n resolve = undefined;\n }\n\n // TODO(alxhub): remove after g3 updated to rename loader -> stream\n const streamFn = opts.stream ?? (opts as {loader?: RxResourceOptions<T, R>['stream']}).loader;\n if (streamFn === undefined) {\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.MUST_PROVIDE_STREAM_OPTION,\n ngDevMode && `Must provide \\`stream\\` option.`,\n );\n }\n\n sub = streamFn(params).subscribe({\n next: (value) => send({value}),\n error: (error: unknown) => {\n send({error: encapsulateResourceError(error)});\n params.abortSignal.removeEventListener('abort', onAbort);\n },\n complete: () => {\n if (resolve) {\n send({\n error: new ɵRuntimeError(\n ɵRuntimeErrorCode.RESOURCE_COMPLETED_BEFORE_PRODUCING_VALUE,\n ngDevMode && 'Resource completed before producing a value',\n ),\n });\n }\n params.abortSignal.removeEventListener('abort', onAbort);\n },\n });\n\n return promise;\n },\n });\n}\n"],"names":["ɵRuntimeError","ɵgetOutputDestroyRef"],"mappings":";;;;;;;;;;;;;;;;AAYA;;;;;;;;;AASG;AACG,SAAU,kBAAkB,CAAI,UAAuB,EAAA;IAC3D,IAAI,CAAC,UAAU,EAAE;AACf,QAAA,SAAS,IAAI,wBAAwB,CAAC,kBAAkB,CAAC;AACzD,QAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;;IAGjC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAO,CAAC,UAAU,KAAI;AACrD,QAAA,IAAI,UAAU,CAAC,SAAS,EAAE;YACxB,UAAU,CAAC,IAAI,EAAE;YACjB;;AAEF,QAAA,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC3E,QAAA,OAAO,YAAY;AACrB,KAAC,CAAC;IAEF,OAAO,CAAI,MAAqB,KAAI;QAClC,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AAC3C,KAAC;AACH;;AClBA;;;;;AAKG;AACH,MAAM,uBAAuB,CAAA;AAKP,IAAA,MAAA;IAJZ,SAAS,GAAG,KAAK;AAEzB,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAE/B,IAAA,WAAA,CAAoB,MAAqB,EAAA;QAArB,IAAM,CAAA,MAAA,GAAN,MAAM;AACxB,QAAA,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,MAAK;AAC7B,YAAA,IAAI,CAAC,SAAS,GAAG,IAAI;AACvB,SAAC,CAAC;;AAGJ,IAAA,SAAS,CAAC,UAA8B,EAAA;AACtC,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,MAAM,IAAIA,YAAa,CAAA,GAAA,+CAErB,SAAS;gBACP,oDAAoD;AAClD,oBAAA,8CAA8C,CACnD;;;AAIH,Q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AAa,CAAA,GAAA,qDAErB,SAAS,IAAI,CAAA,+BAAA,CAAiC,CAC/C;;AAGH,YAAA,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC;gBAC/B,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,EAAC,KAAK,EAAC,CAAC;AAC9B,gBAAA,KAAK,EAAE,CAAC,KAAc,KAAI;oBACxB,IAAI,CAAC,EAAC,KAAK,EAAE,wBAAwB,CAAC,KAAK,CAAC,EAAC,CAAC;oBAC9C,MAAM,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC;iBACzD;gBACD,QAAQ,EAAE,MAAK;oBACb,IAAI,OAAO,EAAE;AACX,wBAAA,IAAI,CAAC;AACH,4BAAA,KAAK,EAAE,IAAIA,YAAa,wEAEtB,SAAS,IAAI,6CAA6C,CAC3D;AACF,yBAAA,CAAC;;oBAEJ,MAAM,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC;iBACzD;AACF,aAAA,CAAC;AAEF,YAAA,OAAO,OAAO;SACf;AACF,KAAA,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"rxjs-interop.mjs","sources":["../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/take_until_destroyed.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/output_from_observable.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/output_to_observable.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/to_observable.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/to_signal.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/pending_until_event.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/core/rxjs-interop/src/rx_resource.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.dev/license\n */\n\nimport {assertInInjectionContext, DestroyRef, inject} from '../../src/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\n * context](guide/di/dependency-injection-context). Otherwise, the current `DestroyRef` is injected.\n *\n * @publicApi 19.0\n */\nexport function takeUntilDestroyed<T>(destroyRef?: DestroyRef): MonoTypeOperatorFunction<T> {\n if (!destroyRef) {\n ngDevMode && assertInInjectionContext(takeUntilDestroyed);\n destroyRef = inject(DestroyRef);\n }\n\n const destroyed$ = new Observable<void>((subscriber) => {\n if (destroyRef.destroyed) {\n subscriber.next();\n return;\n }\n const unregisterFn = destroyRef.onDestroy(subscriber.next.bind(subscriber));\n return unregisterFn;\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.dev/license\n */\n\nimport {\n assertInInjectionContext,\n DestroyRef,\n inject,\n OutputOptions,\n OutputRef,\n OutputRefSubscription,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n} from '../../src/core';\nimport {Observable} from 'rxjs';\n\nimport {takeUntilDestroyed} from './take_until_destroyed';\n\n/**\n * Implementation of `OutputRef` that emits values from\n * an RxJS observable source.\n *\n * @internal\n */\nclass OutputFromObservableRef<T> implements OutputRef<T> {\n private destroyed = false;\n\n destroyRef = inject(DestroyRef);\n\n constructor(private source: Observable<T>) {\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n });\n }\n\n subscribe(callbackFn: (value: T) => void): OutputRefSubscription {\n if (this.destroyed) {\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.OUTPUT_REF_DESTROYED,\n ngDevMode &&\n 'Unexpected subscription to destroyed `OutputRef`. ' +\n 'The owning directive/component is destroyed.',\n );\n }\n\n // Stop yielding more values when the directive/component is already destroyed.\n const subscription = this.source.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({\n next: (value) => callbackFn(value),\n });\n\n return {\n unsubscribe: () => subscription.unsubscribe(),\n };\n }\n}\n\n/**\n * Declares an Angular output that is using an RxJS observable as a source\n * for events dispatched to parent subscribers.\n *\n * The behavior for an observable as source is defined as followed:\n * 1. New values are forwarded to the Angular output (next notifications).\n * 2. Errors notifications are not handled by Angular. You need to handle these manually.\n * For example by using `catchError`.\n * 3. Completion notifications stop the output from emitting new values.\n *\n * @usageNotes\n * Initialize an output in your directive by declaring a\n * class field and initializing it with the `outputFromObservable()` function.\n *\n * ```ts\n * @Directive({..})\n * export class MyDir {\n * nameChange$ = <some-observable>;\n * nameChange = outputFromObservable(this.nameChange$);\n * }\n * ```\n *\n * @publicApi 19.0\n */\nexport function outputFromObservable<T>(\n observable: Observable<T>,\n opts?: OutputOptions,\n): OutputRef<T> {\n ngDevMode && assertInInjectionContext(outputFromObservable);\n return new OutputFromObservableRef<T>(observable);\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.dev/license\n */\n\nimport {OutputRef, ɵgetOutputDestroyRef} from '../../src/core';\nimport {Observable} from 'rxjs';\n\n/**\n * Converts an Angular output declared via `output()` or `outputFromObservable()`\n * to an observable.\n *\n * You can subscribe to the output via `Observable.subscribe` then.\n *\n * @publicApi 19.0\n */\nexport function outputToObservable<T>(ref: OutputRef<T>): Observable<T> {\n const destroyRef = ɵgetOutputDestroyRef(ref);\n\n return new Observable<T>((observer) => {\n // Complete the observable upon directive/component destroy.\n // Note: May be `undefined` if an `EventEmitter` is declared outside\n // of an injection context.\n const unregisterOnDestroy = destroyRef?.onDestroy(() => observer.complete());\n\n const subscription = ref.subscribe((v) => observer.next(v));\n return () => {\n subscription.unsubscribe();\n unregisterOnDestroy?.();\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.dev/license\n */\n\nimport {\n assertInInjectionContext,\n DestroyRef,\n effect,\n inject,\n Injector,\n Signal,\n untracked,\n} from '../../src/core';\nimport {Observable, ReplaySubject} from 'rxjs';\n\n/**\n * Options for `toObservable`.\n *\n * @publicApi 20.0\n */\nexport interface ToObservableOptions {\n /**\n * The `Injector` to use when creating the underlying `effect` which watches the signal.\n *\n * If this isn't specified, the current [injection context](guide/di/dependency-injection-context)\n * 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 unless an injector is provided via options.\n *\n * @publicApi 20.0\n */\nexport function toObservable<T>(source: Signal<T>, options?: ToObservableOptions): Observable<T> {\n if (ngDevMode && !options?.injector) {\n assertInInjectionContext(toObservable);\n }\n const injector = options?.injector ?? inject(Injector);\n const subject = new ReplaySubject<T>(1);\n\n const watcher = effect(\n () => {\n let value: T;\n try {\n value = source();\n } catch (err) {\n untracked(() => subject.error(err));\n return;\n }\n untracked(() => subject.next(value));\n },\n {injector, manualCleanup: true},\n );\n\n injector.get(DestroyRef).onDestroy(() => {\n watcher.destroy();\n subject.complete();\n });\n\n return subject.asObservable();\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.dev/license\n */\n\nimport {\n assertInInjectionContext,\n assertNotInReactiveContext,\n computed,\n DestroyRef,\n inject,\n Injector,\n signal,\n Signal,\n WritableSignal,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n} from '../../src/core';\nimport {ValueEqualityFn} from '../../primitives/signals';\nimport {Observable, Subscribable} from 'rxjs';\n\n/**\n * Options for `toSignal`.\n *\n * @publicApi 20.0\n */\nexport interface ToSignalOptions<T> {\n /**\n * Initial value for the signal produced by `toSignal`.\n *\n * This will be the value of the signal until the observable emits its first value.\n */\n initialValue?: unknown;\n\n /**\n * Whether to require that the observable emits synchronously when `toSignal` subscribes.\n *\n * If this is `true`, `toSignal` will assert that the observable produces a value immediately upon\n * subscription. Setting this option removes the need to either deal with `undefined` in the\n * signal type or provide an `initialValue`, at the cost of a runtime error if this requirement is\n * not met.\n */\n requireSync?: boolean;\n\n /**\n * `Injector` which will provide the `DestroyRef` used to clean up the Observable subscription.\n *\n * If this is not provided, a `DestroyRef` will be retrieved from the current [injection\n * context](guide/di/dependency-injection-context), unless manual cleanup is requested.\n */\n injector?: Injector;\n\n /**\n * Whether the subscription should be automatically cleaned up (via `DestroyRef`) when\n * `toSignal`'s creation context is destroyed.\n *\n * If manual cleanup is enabled, then `DestroyRef` is not used, and the subscription will persist\n * until the `Observable` itself completes.\n */\n manualCleanup?: boolean;\n\n /**\n * A comparison function which defines equality for values emitted by the observable.\n *\n * Equality comparisons are executed against the initial value if one is provided.\n */\n equal?: ValueEqualityFn<T>;\n}\n\n// Base case: no options -> `undefined` in the result type.\nexport function toSignal<T>(source: Observable<T> | Subscribable<T>): Signal<T | undefined>;\n// Options with `undefined` initial value and no `requiredSync` -> `undefined`.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T | undefined>> & {\n initialValue?: undefined;\n requireSync?: false;\n },\n): Signal<T | undefined>;\n// Options with `null` initial value -> `null`.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T | null>> & {initialValue?: null; requireSync?: false},\n): Signal<T | null>;\n// Options with `undefined` initial value and `requiredSync` -> strict result type.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T>> & {initialValue?: undefined; requireSync: true},\n): Signal<T>;\n// Options with a more specific initial value type.\nexport function toSignal<T, const U extends T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T | U>> & {initialValue: U; requireSync?: false},\n): Signal<T | U>;\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 * With `requireSync` set to `true`, `toSignal` will assert that the `Observable` produces a value\n * immediately upon subscription. No `initialValue` is needed in this case, and the returned signal\n * does not include an `undefined` type.\n *\n * By default, the subscription will be automatically cleaned up when the current [injection\n * context](guide/di/dependency-injection-context) is destroyed. For example, when `toSignal` is\n * called during the construction of a component, the subscription will be cleaned up when the\n * component is destroyed. If an injection context is not available, an explicit `Injector` can be\n * passed instead.\n *\n * If the subscription should persist until the `Observable` itself completes, the `manualCleanup`\n * option can be specified instead, which disables the automatic subscription teardown. No injection\n * context is needed in this configuration as well.\n */\nexport function toSignal<T, U = undefined>(\n source: Observable<T> | Subscribable<T>,\n options?: ToSignalOptions<T | U> & {initialValue?: U},\n): Signal<T | U> {\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n assertNotInReactiveContext(\n toSignal,\n 'Invoking `toSignal` causes new subscriptions every time. ' +\n 'Consider moving `toSignal` outside of the reactive context and read the signal value where needed.',\n );\n\n const requiresCleanup = !options?.manualCleanup;\n\n if (ngDevMode && requiresCleanup && !options?.injector) {\n assertInInjectionContext(toSignal);\n }\n\n const cleanupRef = requiresCleanup\n ? (options?.injector?.get(DestroyRef) ?? inject(DestroyRef))\n : null;\n\n const equal = makeToSignalEqual(options?.equal);\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}, {equal});\n } else {\n // If an initial value was passed, use it. Otherwise, use `undefined` as the initial value.\n state = signal<State<T | U>>(\n {kind: StateKind.Value, value: options?.initialValue as U},\n {equal},\n );\n }\n\n let destroyUnregisterFn: (() => void) | undefined;\n\n // Note: This code cannot run inside a reactive context (see assertion above). If we'd support\n // this, we would subscribe to the observable outside of the current reactive context, avoiding\n // that side-effect signal reads/writes are attribute to the current consumer. The current\n // consumer only needs to be notified when the `state` signal changes through the observable\n // subscription. Additional context (related to async pipe):\n // https://github.com/angular/angular/pull/50522.\n const sub = source.subscribe({\n next: (value) => state.set({kind: StateKind.Value, value}),\n error: (error) => {\n state.set({kind: StateKind.Error, error});\n destroyUnregisterFn?.();\n },\n complete: () => {\n destroyUnregisterFn?.();\n },\n // Completion of the Observable is meaningless to the signal. Signals don't have a concept of\n // \"complete\".\n });\n\n if (options?.requireSync && state().kind === StateKind.NoValue) {\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.REQUIRE_SYNC_WITHOUT_SYNC_EMIT,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n '`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.',\n );\n }\n\n // Unsubscribe when the current context is destroyed, if requested.\n destroyUnregisterFn = cleanupRef?.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 () => {\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 throw new ɵRuntimeError(\n ɵRuntimeErrorCode.REQUIRE_SYNC_WITHOUT_SYNC_EMIT,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n '`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.',\n );\n }\n },\n {equal: options?.equal},\n );\n}\n\nfunction makeToSignalEqual<T>(\n userEquality: ValueEqualityFn<T> = Object.is,\n): ValueEqualityFn<State<T>> {\n return (a, b) =>\n a.kind === StateKind.Value && b.kind === StateKind.Value && userEquality(a.value, b.value);\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.dev/license\n */\n\nimport {assertInInjectionContext, PendingTasks, inject, Injector} from '../../src/core';\nimport {MonoTypeOperatorFunction, Observable} from 'rxjs';\n\n/**\n * Operator which makes the application unstable until the observable emits, completes, errors, or is unsubscribed.\n *\n * Use this operator in observables whose subscriptions are important for rendering and should be included in SSR serialization.\n *\n * @param injector The `Injector` to use during creation. If this is not provided, the current injection context will be used instead (via `inject`).\n *\n * @developerPreview 20.0\n */\nexport function pendingUntilEvent<T>(injector?: Injector): MonoTypeOperatorFunction<T> {\n if (injector === undefined) {\n ngDevMode && assertInInjectionContext(pendingUntilEvent);\n injector = inject(Injector);\n }\n const taskService = injector.get(PendingTasks);\n\n return (sourceObservable) => {\n return new Observable<T>((originalSubscriber) => {\n // create a new task on subscription\n const removeTask = taskService.add();\n\n let cleanedUp = false;\n function cleanupTask() {\n if (cleanedUp) {\n return;\n }\n\n removeTask();\n cleanedUp = true;\n }\n\n const innerSubscription = sourceObservable.subscribe({\n next: (v) => {\n originalSubscriber.next(v);\n cleanupTask();\n },\n complete: () => {\n originalSubscriber.complete();\n cleanupTask();\n },\n error: (e) => {\n originalSubscriber.error(e);\n cleanupTask();\n },\n });\n innerSubscription.add(() => {\n originalSubscriber.unsubscribe();\n cleanupTask();\n });\n return innerSubscription;\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.dev/license\n */\n\nimport {\n assertInInjectionContext,\n resource,\n ResourceLoaderParams,\n ResourceRef,\n Signal,\n signal,\n BaseResourceOptions,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n ResourceStreamItem,\n} from '../../src/core';\nimport {Observable, Subscription} from 'rxjs';\nimport {encapsulateResourceError} from '../../src/resource/resource';\n\n/**\n * Like `ResourceOptions` but uses an RxJS-based `loader`.\n *\n * @experimental\n */\nexport interface RxResourceOptions<T, R> extends BaseResourceOptions<T, R> {\n stream: (params: ResourceLoaderParams<R>) => Observable<T>;\n}\n\n/**\n * Like `resource` but uses an RxJS based `loader` which maps the request to an `Observable` of the\n * resource's value.\n *\n * @experimental\n */\nexport function rxResource<T, R>(\n opts: RxResourceOptions<T, R> & {defaultValue: NoInfer<T>},\n): ResourceRef<T>;\n\n/**\n * Like `resource` but uses an RxJS based `loader` which maps the request to an `Observable` of the\n * resource's value.\n *\n * @experimental\n */\nexport function rxResource<T, R>(opts: RxResourceOptions<T, R>): ResourceRef<T | undefined>;\nexport function rxResource<T, R>(opts: RxResourceOptions<T, R>): ResourceRef<T | undefined> {\n if (ngDevMode && !opts?.injector) {\n assertInInjectionContext(rxResource);\n }\n return resource<T, R>({\n ...opts,\n loader: undefined,\n stream: (params) => {\n let sub: Subscription;\n\n // Track the abort listener so it can be removed if the Observable completes (as a memory\n // optimization).\n const onAbort = () => sub.unsubscribe();\n params.abortSignal.addEventListener('abort', onAbort);\n\n // Start off stream as undefined.\n const stream = signal<ResourceStreamItem<T>>({value: undefined as T});\n let resolve: ((value: Signal<ResourceStreamItem<T>>) => void) | undefined;\n const promise = new Promise<Signal<ResourceStreamItem<T>>>((r) => (resolve = r));\n\n function send(value: ResourceStreamItem<T>): void {\n stream.set(value);\n resolve?.(stream);\n resolve = undefined;\n }\n\n // TODO(alxhub): remove after g3 updated to rename loader -> stream\n const streamFn = opts.stream ?? (opts as {loader?: RxResourceOptions<T, R>['stream']}).loader;\n if (streamFn === undefined) {\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.MUST_PROVIDE_STREAM_OPTION,\n ngDevMode && `Must provide \\`stream\\` option.`,\n );\n }\n\n sub = streamFn(params).subscribe({\n next: (value) => send({value}),\n error: (error: unknown) => {\n send({error: encapsulateResourceError(error)});\n params.abortSignal.removeEventListener('abort', onAbort);\n },\n complete: () => {\n if (resolve) {\n send({\n error: new ɵRuntimeError(\n ɵRuntimeErrorCode.RESOURCE_COMPLETED_BEFORE_PRODUCING_VALUE,\n ngDevMode && 'Resource completed before producing a value',\n ),\n });\n }\n params.abortSignal.removeEventListener('abort', onAbort);\n },\n });\n\n return promise;\n },\n });\n}\n"],"names":["ɵRuntimeError","ɵgetOutputDestroyRef"],"mappings":";;;;;;;;;;;;;;;;AAYA;;;;;;;;;AASG;AACG,SAAU,kBAAkB,CAAI,UAAuB,EAAA;IAC3D,IAAI,CAAC,UAAU,EAAE;AACf,QAAA,SAAS,IAAI,wBAAwB,CAAC,kBAAkB,CAAC;AACzD,QAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;;IAGjC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAO,CAAC,UAAU,KAAI;AACrD,QAAA,IAAI,UAAU,CAAC,SAAS,EAAE;YACxB,UAAU,CAAC,IAAI,EAAE;YACjB;;AAEF,QAAA,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC3E,QAAA,OAAO,YAAY;AACrB,KAAC,CAAC;IAEF,OAAO,CAAI,MAAqB,KAAI;QAClC,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AAC3C,KAAC;AACH;;AClBA;;;;;AAKG;AACH,MAAM,uBAAuB,CAAA;AAKP,IAAA,MAAA;IAJZ,SAAS,GAAG,KAAK;AAEzB,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAE/B,IA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-50,12 +50,11 @@ const REACTIVE_NODE = {
50
50
  version: 0,
51
51
  lastCleanEpoch: 0,
52
52
  dirty: false,
53
- producerNode: undefined,
54
- producerLastReadVersion: undefined,
55
- producerIndexOfThis: undefined,
56
- nextProducerIndex: 0,
57
- liveConsumerNode: undefined,
58
- liveConsumerIndexOfThis: undefined,
53
+ producers: undefined,
54
+ producersTail: undefined,
55
+ consumers: undefined,
56
+ consumersTail: undefined,
57
+ recomputing: false,
59
58
  consumerAllowSignalWrites: false,
60
59
  consumerIsAlwaysLive: false,
61
60
  kind: 'unknown',
@@ -78,34 +77,61 @@ function producerAccessed(node) {
78
77
  return;
79
78
  }
80
79
  activeConsumer.consumerOnSignalRead(node);
81
- // This producer is the `idx`th dependency of `activeConsumer`.
82
- const idx = activeConsumer.nextProducerIndex++;
83
- assertConsumerNode(activeConsumer);
84
- if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) {
85
- // There's been a change in producers since the last execution of `activeConsumer`.
86
- // `activeConsumer.producerNode[idx]` holds a stale dependency which will be be removed and
87
- // replaced with `this`.
88
- //
89
- // If `activeConsumer` isn't live, then this is a no-op, since we can replace the producer in
90
- // `activeConsumer.producerNode` directly. However, if `activeConsumer` is live, then we need
91
- // to remove it from the stale producer's `liveConsumer`s.
92
- if (consumerIsLive(activeConsumer)) {
93
- const staleProducer = activeConsumer.producerNode[idx];
94
- producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]);
95
- // At this point, the only record of `staleProducer` is the reference at
96
- // `activeConsumer.producerNode[idx]` which will be overwritten below.
80
+ const prevProducerLink = activeConsumer.producersTail;
81
+ // If the last producer we accessed is the same as the current one, we can skip adding a new
82
+ // link
83
+ if (prevProducerLink !== undefined && prevProducerLink.producer === node) {
84
+ return;
85
+ }
86
+ let nextProducerLink = undefined;
87
+ const isRecomputing = activeConsumer.recomputing;
88
+ if (isRecomputing) {
89
+ // If we're incrementally rebuilding the producers list, we want to check if the next producer
90
+ // in the list is the same as the one we're trying to add.
91
+ // If the previous producer is defined, then the next producer is just the one that follows it.
92
+ // Otherwise, we should check the head of the producers list (the first node that we accessed the last time this consumer was run).
93
+ nextProducerLink =
94
+ prevProducerLink !== undefined ? prevProducerLink.nextProducer : activeConsumer.producers;
95
+ if (nextProducerLink !== undefined && nextProducerLink.producer === node) {
96
+ // If the next producer is the same as the one we're trying to add, we can just update the
97
+ // last read version, update the tail of the producers list of this rerun, and return.
98
+ activeConsumer.producersTail = nextProducerLink;
99
+ nextProducerLink.lastReadVersion = node.version;
100
+ return;
97
101
  }
98
102
  }
99
- if (activeConsumer.producerNode[idx] !== node) {
100
- // We're a new dependency of the consumer (at `idx`).
101
- activeConsumer.producerNode[idx] = node;
102
- // If the active consumer is live, then add it as a live consumer. If not, then use 0 as a
103
- // placeholder value.
104
- activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer)
105
- ? producerAddLiveConsumer(node, activeConsumer, idx)
106
- : 0;
103
+ const prevConsumerLink = node.consumersTail;
104
+ // If the producer we're accessing already has a link to this consumer, we can skip adding a new
105
+ // link. This can short circuit the creation of a new link in the case where the consumer reads alternating ReeactiveNodes
106
+ if (prevConsumerLink !== undefined &&
107
+ prevConsumerLink.consumer === activeConsumer &&
108
+ // However, we have to make sure that the link we've discovered isn't from a node that is incrementally rebuilding its producer list
109
+ (!isRecomputing || isValidLink(prevConsumerLink, activeConsumer))) {
110
+ // If we found an existing link to the consumer we can just return.
111
+ return;
112
+ }
113
+ // If we got here, it means that we need to create a new link between the producer and the consumer.
114
+ const isLive = consumerIsLive(activeConsumer);
115
+ const newLink = {
116
+ producer: node,
117
+ consumer: activeConsumer,
118
+ // instead of eagerly destroying the previous link, we delay until we've finished recomputing
119
+ // the producers list, so that we can destroy all of the old links at once.
120
+ nextProducer: nextProducerLink,
121
+ prevConsumer: prevConsumerLink,
122
+ lastReadVersion: node.version,
123
+ nextConsumer: undefined,
124
+ };
125
+ activeConsumer.producersTail = newLink;
126
+ if (prevProducerLink !== undefined) {
127
+ prevProducerLink.nextProducer = newLink;
128
+ }
129
+ else {
130
+ activeConsumer.producers = newLink;
131
+ }
132
+ if (isLive) {
133
+ producerAddLiveConsumer(node, newLink);
107
134
  }
108
- activeConsumer.producerLastReadVersion[idx] = node.version;
109
135
  }
110
136
  /**
111
137
  * Increment the global epoch counter.
@@ -144,14 +170,15 @@ function producerUpdateValueVersion(node) {
144
170
  * Propagate a dirty notification to live consumers of this producer.
145
171
  */
146
172
  function producerNotifyConsumers(node) {
147
- if (node.liveConsumerNode === undefined) {
173
+ if (node.consumers === undefined) {
148
174
  return;
149
175
  }
150
176
  // Prevent signal reads when we're updating the graph
151
177
  const prev = inNotificationPhase;
152
178
  inNotificationPhase = true;
153
179
  try {
154
- for (const consumer of node.liveConsumerNode) {
180
+ for (let link = node.consumers; link !== undefined; link = link.nextConsumer) {
181
+ const consumer = link.consumer;
155
182
  if (!consumer.dirty) {
156
183
  consumerMarkDirty(consumer);
157
184
  }
@@ -184,7 +211,10 @@ function producerMarkClean(node) {
184
211
  * begin.
185
212
  */
186
213
  function consumerBeforeComputation(node) {
187
- node && (node.nextProducerIndex = 0);
214
+ if (node) {
215
+ node.producersTail = undefined;
216
+ node.recomputing = true;
217
+ }
188
218
  return setActiveConsumer(node);
189
219
  }
190
220
  /**
@@ -195,26 +225,28 @@ function consumerBeforeComputation(node) {
195
225
  */
196
226
  function consumerAfterComputation(node, prevConsumer) {
197
227
  setActiveConsumer(prevConsumer);
198
- if (!node ||
199
- node.producerNode === undefined ||
200
- node.producerIndexOfThis === undefined ||
201
- node.producerLastReadVersion === undefined) {
228
+ if (!node) {
202
229
  return;
203
230
  }
204
- if (consumerIsLive(node)) {
205
- // For live consumers, we need to remove the producer -> consumer edge for any stale producers
206
- // which weren't dependencies after the recomputation.
207
- for (let i = node.nextProducerIndex; i < node.producerNode.length; i++) {
208
- producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
231
+ node.recomputing = false;
232
+ // We've finished incrementally rebuilding the producers list, now if there are any producers
233
+ // that are after producersTail, they are stale and should be removed.
234
+ const producersTail = node.producersTail;
235
+ let toRemove = producersTail !== undefined ? producersTail.nextProducer : node.producers;
236
+ if (toRemove !== undefined) {
237
+ if (consumerIsLive(node)) {
238
+ // For each stale link, we first unlink it from the producers list of consumers
239
+ do {
240
+ toRemove = producerRemoveLiveConsumerLink(toRemove);
241
+ } while (toRemove !== undefined);
242
+ }
243
+ // Now, we can truncate the producers list to remove all stale links.
244
+ if (producersTail !== undefined) {
245
+ producersTail.nextProducer = undefined;
246
+ }
247
+ else {
248
+ node.producers = undefined;
209
249
  }
210
- }
211
- // Truncate the producer tracking arrays.
212
- // Perf note: this is essentially truncating the length to `node.nextProducerIndex`, but
213
- // benchmarking has shown that individual pop operations are faster.
214
- while (node.producerNode.length > node.nextProducerIndex) {
215
- node.producerNode.pop();
216
- node.producerLastReadVersion.pop();
217
- node.producerIndexOfThis.pop();
218
250
  }
219
251
  }
220
252
  /**
@@ -222,11 +254,10 @@ function consumerAfterComputation(node, prevConsumer) {
222
254
  * they were read.
223
255
  */
224
256
  function consumerPollProducersForChange(node) {
225
- assertConsumerNode(node);
226
257
  // Poll producers for change.
227
- for (let i = 0; i < node.producerNode.length; i++) {
228
- const producer = node.producerNode[i];
229
- const seenVersion = node.producerLastReadVersion[i];
258
+ for (let link = node.producers; link !== undefined; link = link.nextProducer) {
259
+ const producer = link.producer;
260
+ const seenVersion = link.lastReadVersion;
230
261
  // First check the versions. A mismatch means that the producer's value is known to have
231
262
  // changed since the last time we read it.
232
263
  if (seenVersion !== producer.version) {
@@ -247,21 +278,18 @@ function consumerPollProducersForChange(node) {
247
278
  * Disconnect this consumer from the graph.
248
279
  */
249
280
  function consumerDestroy(node) {
250
- assertConsumerNode(node);
251
281
  if (consumerIsLive(node)) {
252
282
  // Drop all connections from the graph to this node.
253
- for (let i = 0; i < node.producerNode.length; i++) {
254
- producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
283
+ let link = node.producers;
284
+ while (link !== undefined) {
285
+ link = producerRemoveLiveConsumerLink(link);
255
286
  }
256
287
  }
257
- // Truncate all the arrays to drop all connection from this node to the graph.
258
- node.producerNode.length =
259
- node.producerLastReadVersion.length =
260
- node.producerIndexOfThis.length =
261
- 0;
262
- if (node.liveConsumerNode) {
263
- node.liveConsumerNode.length = node.liveConsumerIndexOfThis.length = 0;
264
- }
288
+ // Truncate all the linked lists to drop all connection from this node to the graph.
289
+ node.producers = undefined;
290
+ node.producersTail = undefined;
291
+ node.consumers = undefined;
292
+ node.consumersTail = undefined;
265
293
  }
266
294
  /**
267
295
  * Add `consumer` as a live consumer of this node.
@@ -269,64 +297,54 @@ function consumerDestroy(node) {
269
297
  * Note that this operation is potentially transitive. If this node becomes live, then it becomes
270
298
  * a live consumer of all of its current producers.
271
299
  */
272
- function producerAddLiveConsumer(node, consumer, indexOfThis) {
273
- assertProducerNode(node);
274
- if (node.liveConsumerNode.length === 0 && isConsumerNode(node)) {
275
- // When going from 0 to 1 live consumers, we become a live consumer to our producers.
276
- for (let i = 0; i < node.producerNode.length; i++) {
277
- node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i);
300
+ function producerAddLiveConsumer(node, link) {
301
+ const consumersTail = node.consumersTail;
302
+ const wasLive = consumerIsLive(node);
303
+ if (consumersTail !== undefined) {
304
+ link.nextConsumer = consumersTail.nextConsumer;
305
+ consumersTail.nextConsumer = link;
306
+ }
307
+ else {
308
+ link.nextConsumer = undefined;
309
+ node.consumers = link;
310
+ }
311
+ link.prevConsumer = consumersTail;
312
+ node.consumersTail = link;
313
+ if (!wasLive) {
314
+ for (let link = node.producers; link !== undefined; link = link.nextProducer) {
315
+ producerAddLiveConsumer(link.producer, link);
278
316
  }
279
317
  }
280
- node.liveConsumerIndexOfThis.push(indexOfThis);
281
- return node.liveConsumerNode.push(consumer) - 1;
282
318
  }
283
- /**
284
- * Remove the live consumer at `idx`.
285
- */
286
- function producerRemoveLiveConsumerAtIndex(node, idx) {
287
- assertProducerNode(node);
288
- if (typeof ngDevMode !== 'undefined' && ngDevMode && idx >= node.liveConsumerNode.length) {
289
- throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`);
290
- }
291
- if (node.liveConsumerNode.length === 1 && isConsumerNode(node)) {
292
- // When removing the last live consumer, we will no longer be live. We need to remove
293
- // ourselves from our producers' tracking (which may cause consumer-producers to lose
294
- // liveness as well).
295
- for (let i = 0; i < node.producerNode.length; i++) {
296
- producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
297
- }
319
+ function producerRemoveLiveConsumerLink(link) {
320
+ const producer = link.producer;
321
+ const nextProducer = link.nextProducer;
322
+ const nextConsumer = link.nextConsumer;
323
+ const prevConsumer = link.prevConsumer;
324
+ link.nextConsumer = undefined;
325
+ link.prevConsumer = undefined;
326
+ if (nextConsumer !== undefined) {
327
+ nextConsumer.prevConsumer = prevConsumer;
328
+ }
329
+ else {
330
+ producer.consumersTail = prevConsumer;
298
331
  }
299
- // Move the last value of `liveConsumers` into `idx`. Note that if there's only a single
300
- // live consumer, this is a no-op.
301
- const lastIdx = node.liveConsumerNode.length - 1;
302
- node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx];
303
- node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];
304
- // Truncate the array.
305
- node.liveConsumerNode.length--;
306
- node.liveConsumerIndexOfThis.length--;
307
- // If the index is still valid, then we need to fix the index pointer from the producer to this
308
- // consumer, and update it from `lastIdx` to `idx` (accounting for the move above).
309
- if (idx < node.liveConsumerNode.length) {
310
- const idxProducer = node.liveConsumerIndexOfThis[idx];
311
- const consumer = node.liveConsumerNode[idx];
312
- assertConsumerNode(consumer);
313
- consumer.producerIndexOfThis[idxProducer] = idx;
332
+ if (prevConsumer !== undefined) {
333
+ prevConsumer.nextConsumer = nextConsumer;
314
334
  }
335
+ else {
336
+ producer.consumers = nextConsumer;
337
+ if (!consumerIsLive(producer)) {
338
+ let producerLink = producer.producers;
339
+ while (producerLink !== undefined) {
340
+ producerLink = producerRemoveLiveConsumerLink(producerLink);
341
+ }
342
+ }
343
+ }
344
+ return nextProducer;
315
345
  }
316
346
  function consumerIsLive(node) {
317
- return node.consumerIsAlwaysLive || (node?.liveConsumerNode?.length ?? 0) > 0;
318
- }
319
- function assertConsumerNode(node) {
320
- node.producerNode ??= [];
321
- node.producerIndexOfThis ??= [];
322
- node.producerLastReadVersion ??= [];
323
- }
324
- function assertProducerNode(node) {
325
- node.liveConsumerNode ??= [];
326
- node.liveConsumerIndexOfThis ??= [];
327
- }
328
- function isConsumerNode(node) {
329
- return node.producerNode !== undefined;
347
+ return node.consumerIsAlwaysLive || node.consumers !== undefined;
330
348
  }
331
349
  function runPostProducerCreatedFn(node) {
332
350
  postProducerCreatedFn?.(node);
@@ -336,6 +354,24 @@ function setPostProducerCreatedFn(fn) {
336
354
  postProducerCreatedFn = fn;
337
355
  return prev;
338
356
  }
357
+ // While a ReactiveNode is recomputing, it may not have destroyed previous links
358
+ // This allows us to check if a given link will be destroyed by a reactivenode if it were to finish running immediately without accesing any more producers
359
+ function isValidLink(checkLink, consumer) {
360
+ const producersTail = consumer.producersTail;
361
+ if (producersTail !== undefined) {
362
+ let link = consumer.producers;
363
+ do {
364
+ if (link === checkLink) {
365
+ return true;
366
+ }
367
+ if (link === producersTail) {
368
+ break;
369
+ }
370
+ link = link.nextProducer;
371
+ } while (link !== undefined);
372
+ }
373
+ return false;
374
+ }
339
375
 
340
376
  /**
341
377
  * Create a computed signal which derives a reactive value from an expression.