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

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 (57) hide show
  1. package/esm2022/primitives/event-dispatch/src/eventcontract.mjs +2 -2
  2. package/esm2022/rxjs-interop/src/to_signal.mjs +7 -3
  3. package/esm2022/src/authoring/model/model_signal.mjs +2 -3
  4. package/esm2022/src/change_detection/change_detector_ref.mjs +3 -2
  5. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +2 -2
  6. package/esm2022/src/core_render3_private_export.mjs +2 -2
  7. package/esm2022/src/defer/instructions.mjs +3 -11
  8. package/esm2022/src/di/host_tag_name_token.mjs +4 -1
  9. package/esm2022/src/errors.mjs +1 -1
  10. package/esm2022/src/event_delegation_utils.mjs +3 -2
  11. package/esm2022/src/hydration/annotate.mjs +27 -16
  12. package/esm2022/src/hydration/error_handling.mjs +3 -1
  13. package/esm2022/src/hydration/event_replay.mjs +34 -15
  14. package/esm2022/src/hydration/i18n.mjs +102 -18
  15. package/esm2022/src/hydration/node_lookup_utils.mjs +12 -6
  16. package/esm2022/src/linker/component_factory.mjs +1 -1
  17. package/esm2022/src/render3/after_render_hooks.mjs +2 -2
  18. package/esm2022/src/render3/chained_injector.mjs +34 -0
  19. package/esm2022/src/render3/collect_native_nodes.mjs +6 -1
  20. package/esm2022/src/render3/component.mjs +1 -1
  21. package/esm2022/src/render3/component_ref.mjs +23 -35
  22. package/esm2022/src/render3/index.mjs +2 -2
  23. package/esm2022/src/render3/instructions/all.mjs +2 -1
  24. package/esm2022/src/render3/instructions/i18n_icu_container_visitor.mjs +61 -51
  25. package/esm2022/src/render3/instructions/let_declaration.mjs +62 -0
  26. package/esm2022/src/render3/instructions/projection.mjs +14 -11
  27. package/esm2022/src/render3/instructions/shared.mjs +1 -1
  28. package/esm2022/src/render3/interfaces/node.mjs +2 -1
  29. package/esm2022/src/render3/jit/environment.mjs +4 -1
  30. package/esm2022/src/render3/node_assert.mjs +9 -8
  31. package/esm2022/src/render3/node_manipulation.mjs +10 -3
  32. package/esm2022/src/render3/util/injector_discovery_utils.mjs +14 -5
  33. package/esm2022/src/render3/util/injector_utils.mjs +10 -1
  34. package/esm2022/src/version.mjs +1 -1
  35. package/esm2022/testing/src/logger.mjs +3 -3
  36. package/fesm2022/core.mjs +440 -210
  37. package/fesm2022/core.mjs.map +1 -1
  38. package/fesm2022/primitives/event-dispatch.mjs +2 -2
  39. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  40. package/fesm2022/primitives/signals.mjs +1 -1
  41. package/fesm2022/rxjs-interop.mjs +7 -3
  42. package/fesm2022/rxjs-interop.mjs.map +1 -1
  43. package/fesm2022/testing.mjs +1 -1
  44. package/index.d.ts +45 -9
  45. package/package.json +1 -1
  46. package/primitives/event-dispatch/index.d.ts +2 -2
  47. package/primitives/signals/index.d.ts +1 -1
  48. package/rxjs-interop/index.d.ts +13 -6
  49. package/schematics/migrations/after-render-phase/bundle.js +52 -31
  50. package/schematics/migrations/after-render-phase/bundle.js.map +2 -2
  51. package/schematics/migrations/invalid-two-way-bindings/bundle.js +272 -65
  52. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +4 -4
  53. package/schematics/ng-generate/control-flow-migration/bundle.js +279 -65
  54. package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
  55. package/schematics/ng-generate/standalone-migration/bundle.js +288 -84
  56. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  57. package/testing/index.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.2
2
+ * @license Angular v18.1.0-next.4
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.2
2
+ * @license Angular v18.1.0-next.4
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -175,16 +175,17 @@ function toSignal(source, options) {
175
175
  const cleanupRef = requiresCleanup
176
176
  ? options?.injector?.get(DestroyRef) ?? inject(DestroyRef)
177
177
  : null;
178
+ const equal = makeToSignalEquals(options?.equals);
178
179
  // Note: T is the Observable value type, and U is the initial value type. They don't have to be
179
180
  // the same - the returned signal gives values of type `T`.
180
181
  let state;
181
182
  if (options?.requireSync) {
182
183
  // Initially the signal is in a `NoValue` state.
183
- state = signal({ kind: 0 /* StateKind.NoValue */ });
184
+ state = signal({ kind: 0 /* StateKind.NoValue */ }, { equal });
184
185
  }
185
186
  else {
186
187
  // If an initial value was passed, use it. Otherwise, use `undefined` as the initial value.
187
- state = signal({ kind: 1 /* StateKind.Value */, value: options?.initialValue });
188
+ state = signal({ kind: 1 /* StateKind.Value */, value: options?.initialValue }, { equal });
188
189
  }
189
190
  // Note: This code cannot run inside a reactive context (see assertion above). If we'd support
190
191
  // this, we would subscribe to the observable outside of the current reactive context, avoiding
@@ -226,6 +227,9 @@ function toSignal(source, options) {
226
227
  }
227
228
  });
228
229
  }
230
+ function makeToSignalEquals(userEquality = Object.is) {
231
+ return (a, b) => a.kind === 1 /* StateKind.Value */ && b.kind === 1 /* StateKind.Value */ && userEquality(a.value, b.value);
232
+ }
229
233
 
230
234
  /**
231
235
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"rxjs-interop.mjs","sources":["../../../../../../packages/core/rxjs-interop/src/take_until_destroyed.ts","../../../../../../packages/core/rxjs-interop/src/output_from_observable.ts","../../../../../../packages/core/rxjs-interop/src/output_to_observable.ts","../../../../../../packages/core/rxjs-interop/src/to_observable.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\n * context](guide/di/dependency-injection-context). Otherwise, the 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 const unregisterFn = destroyRef!.onDestroy(observer.next.bind(observer));\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.io/license\n */\n\nimport {\n assertInInjectionContext,\n DestroyRef,\n inject,\n OutputOptions,\n OutputRef,\n OutputRefSubscription,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n} from '@angular/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 * @developerPreview\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.io/license\n */\n\nimport {OutputRef, ɵgetOutputDestroyRef} from '@angular/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 * @developerPreview\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 destroyRef?.onDestroy(() => observer.complete());\n\n const subscription = ref.subscribe((v) => observer.next(v));\n return () => subscription.unsubscribe();\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 {\n assertInInjectionContext,\n DestroyRef,\n effect,\n inject,\n Injector,\n Signal,\n untracked,\n} from '@angular/core';\nimport {Observable, ReplaySubject} from 'rxjs';\n\n/**\n * Options for `toObservable`.\n *\n * @developerPreview\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 * @developerPreview\n */\nexport function toObservable<T>(source: Signal<T>, options?: ToObservableOptions): Observable<T> {\n !options?.injector && assertInInjectionContext(toObservable);\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.io/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 '@angular/core';\nimport {Observable, Subscribable} from 'rxjs';\n\n/**\n * Options for `toSignal`.\n *\n * @publicApi\n */\nexport interface ToSignalOptions {\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 * Whether `toSignal` should throw errors from the Observable error channel back to RxJS, where\n * they'll be processed as uncaught exceptions.\n *\n * In practice, this means that the signal returned by `toSignal` will keep returning the last\n * good value forever, as Observables which error produce no further values. This option emulates\n * the behavior of the `async` pipe.\n */\n rejectErrors?: boolean;\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: ToSignalOptions & {initialValue?: undefined; requireSync?: false},\n): Signal<T | undefined>;\n// Options with `null` initial value -> `null`.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: ToSignalOptions & {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: ToSignalOptions & {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: ToSignalOptions & {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 *\n * @developerPreview\n */\nexport function toSignal<T, U = undefined>(\n source: Observable<T> | Subscribable<T>,\n options?: ToSignalOptions & {initialValue?: U},\n): Signal<T | U> {\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 requiresCleanup && !options?.injector && assertInInjectionContext(toSignal);\n const cleanupRef = requiresCleanup\n ? options?.injector?.get(DestroyRef) ?? inject(DestroyRef)\n : null;\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 // 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 if (options?.rejectErrors) {\n // Kick the error back to RxJS. It will be caught and rethrown in a macrotask, which causes\n // the error to end up as an uncaught exception.\n throw error;\n }\n state.set({kind: StateKind.Error, error});\n },\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 && 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\n // Unsubscribe when the current context is destroyed, if requested.\n 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 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}\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":[],"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;KACjC;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,CAAA,wBAAmB,KAAK,EAAC,CAAC;AAC1D,QAAA,KAAK,EAAE,CAAC,KAAK,KAAI;AACf,YAAA,IAAI,OAAO,EAAE,YAAY,EAAE;;;AAGzB,gBAAA,MAAM,KAAK,CAAC;aACb;YACD,KAAK,CAAC,GAAG,CAAC,EAAC,IAAI,2BAAmB,KAAK,EAAC,CAAC,CAAC;SAC3C;;;AAGF,KAAA,CAAC,CAAC;AAEH,IAAA,IAAI,SAAS,IAAI,OAAO,EAAE,WAAW,IAAI,KAAK,EAAE,CAAC,IAAI,KAAsB,CAAA,0BAAE;AAC3E,QAAA,MAAM,IAAI,aAAa,CAErB,GAAA,yDAAA,qFAAqF,CACtF,CAAC;KACH;;AAGD,IAAA,UAAU,EAAE,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;;;IAIjD,OAAO,QAAQ,CAAC,MAAK;AACnB,QAAA,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;AACxB,QAAA,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,aAAa,CAErB,GAAA,yDAAA,qFAAqF,CACtF,CAAC;SACL;AACH,KAAC,CAAC,CAAC;AACL;;ACrMA;;AAEG;;;;"}
1
+ {"version":3,"file":"rxjs-interop.mjs","sources":["../../../../../../packages/core/rxjs-interop/src/take_until_destroyed.ts","../../../../../../packages/core/rxjs-interop/src/output_from_observable.ts","../../../../../../packages/core/rxjs-interop/src/output_to_observable.ts","../../../../../../packages/core/rxjs-interop/src/to_observable.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\n * context](guide/di/dependency-injection-context). Otherwise, the 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 const unregisterFn = destroyRef!.onDestroy(observer.next.bind(observer));\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.io/license\n */\n\nimport {\n assertInInjectionContext,\n DestroyRef,\n inject,\n OutputOptions,\n OutputRef,\n OutputRefSubscription,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n} from '@angular/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 * @developerPreview\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.io/license\n */\n\nimport {OutputRef, ɵgetOutputDestroyRef} from '@angular/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 * @developerPreview\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 destroyRef?.onDestroy(() => observer.complete());\n\n const subscription = ref.subscribe((v) => observer.next(v));\n return () => subscription.unsubscribe();\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 {\n assertInInjectionContext,\n DestroyRef,\n effect,\n inject,\n Injector,\n Signal,\n untracked,\n} from '@angular/core';\nimport {Observable, ReplaySubject} from 'rxjs';\n\n/**\n * Options for `toObservable`.\n *\n * @developerPreview\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 * @developerPreview\n */\nexport function toObservable<T>(source: Signal<T>, options?: ToObservableOptions): Observable<T> {\n !options?.injector && assertInInjectionContext(toObservable);\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.io/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 '@angular/core';\nimport {ValueEqualityFn} from '@angular/core/primitives/signals';\nimport {Observable, Subscribable} from 'rxjs';\n\n/**\n * Options for `toSignal`.\n *\n * @publicApi\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 * Whether `toSignal` should throw errors from the Observable error channel back to RxJS, where\n * they'll be processed as uncaught exceptions.\n *\n * In practice, this means that the signal returned by `toSignal` will keep returning the last\n * good value forever, as Observables which error produce no further values. This option emulates\n * the behavior of the `async` pipe.\n */\n rejectErrors?: 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 equals?: 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 *\n * @developerPreview\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 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 requiresCleanup && !options?.injector && assertInInjectionContext(toSignal);\n const cleanupRef = requiresCleanup\n ? options?.injector?.get(DestroyRef) ?? inject(DestroyRef)\n : null;\n\n const equal = makeToSignalEquals(options?.equals);\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 // 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 if (options?.rejectErrors) {\n // Kick the error back to RxJS. It will be caught and rethrown in a macrotask, which causes\n // the error to end up as an uncaught exception.\n throw error;\n }\n state.set({kind: StateKind.Error, error});\n },\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 && 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\n // Unsubscribe when the current context is destroyed, if requested.\n 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 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}\n\nfunction makeToSignalEquals<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 * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"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;KACjC;IAED,MAAM,UAAU,GAAG,IAAI,UAAU,CAAO,CAAC,QAAQ,KAAI;AACnD,QAAA,MAAM,YAAY,GAAG,UAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AACzE,QAAA,OAAO,YAAY,CAAC;AACtB,KAAC,CAAC,CAAC;IAEH,OAAO,CAAI,MAAqB,KAAI;QAClC,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;AAC5C,KAAC,CAAC;AACJ;;ACdA;;;;;AAKG;AACH,MAAM,uBAAuB,CAAA;AAK3B,IAAA,WAAA,CAAoB,MAAqB,EAAA;QAArB,IAAM,CAAA,MAAA,GAAN,MAAM,CAAe;QAJjC,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;AAE1B,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAG9B,QAAA,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,MAAK;AAC7B,YAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;AACxB,SAAC,CAAC,CAAC;KACJ;AAED,IAA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ACxB,QAAA,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,aAAa,CAErB,GAAA,yDAAA,qFAAqF,CACtF,CAAC;SACL;AACH,KAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,kBAAkB,CACzB,YAAmC,GAAA,MAAM,CAAC,EAAE,EAAA;IAE5C,OAAO,CAAC,CAAC,EAAE,CAAC,KACV,CAAC,CAAC,IAAI,KAAA,CAAA,0BAAwB,CAAC,CAAC,IAAI,KAAoB,CAAA,0BAAI,YAAY,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AAC/F;;AC5NA;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.2
2
+ * @license Angular v18.1.0-next.4
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.2
2
+ * @license Angular v18.1.0-next.4
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -132,6 +132,7 @@ export declare interface AfterContentInit {
132
132
  * </div>
133
133
  *
134
134
  * @param spec The callback functions to register
135
+ * @param options Options to control the behavior of the callback
135
136
  *
136
137
  * @usageNotes
137
138
  *
@@ -165,7 +166,7 @@ export declare function afterNextRender<E = never, W = never, M = never>(spec: {
165
166
  write?: (...args: ɵFirstAvailable<[E]>) => W;
166
167
  mixedReadWrite?: (...args: ɵFirstAvailable<[W, E]>) => M;
167
168
  read?: (...args: ɵFirstAvailable<[M, W, E]>) => void;
168
- }, opts?: Omit<AfterRenderOptions, 'phase'>): AfterRenderRef;
169
+ }, options?: Omit<AfterRenderOptions, 'phase'>): AfterRenderRef;
169
170
 
170
171
  /**
171
172
  * Register a callback to be invoked the next time the application finishes rendering, during the
@@ -191,6 +192,7 @@ export declare function afterNextRender<E = never, W = never, M = never>(spec: {
191
192
  * </div>
192
193
  *
193
194
  * @param callback A callback function to register
195
+ * @param options Options to control the behavior of the callback
194
196
  *
195
197
  * @usageNotes
196
198
  *
@@ -271,6 +273,7 @@ export declare function afterNextRender(callback: VoidFunction, options?: AfterR
271
273
  * </div>
272
274
  *
273
275
  * @param spec The callback functions to register
276
+ * @param options Options to control the behavior of the callback
274
277
  *
275
278
  * @usageNotes
276
279
  *
@@ -302,7 +305,7 @@ export declare function afterRender<E = never, W = never, M = never>(spec: {
302
305
  write?: (...args: ɵFirstAvailable<[E]>) => W;
303
306
  mixedReadWrite?: (...args: ɵFirstAvailable<[W, E]>) => M;
304
307
  read?: (...args: ɵFirstAvailable<[M, W, E]>) => void;
305
- }, opts?: Omit<AfterRenderOptions, 'phase'>): AfterRenderRef;
308
+ }, options?: Omit<AfterRenderOptions, 'phase'>): AfterRenderRef;
306
309
 
307
310
  /**
308
311
  * Register a callback to be invoked each time the application finishes rendering, during the
@@ -329,6 +332,7 @@ export declare function afterRender<E = never, W = never, M = never>(spec: {
329
332
  * </div>
330
333
  *
331
334
  * @param callback A callback function to register
335
+ * @param options Options to control the behavior of the callback
332
336
  *
333
337
  * @usageNotes
334
338
  *
@@ -380,7 +384,7 @@ export declare interface AfterRenderOptions {
380
384
  * </div>
381
385
  *
382
386
  * @deprecated Specify the phase for your callback to run in by passing a spec-object as the first
383
- * parameter to `afterRender` or `afterNextRender` insetad of a function.
387
+ * parameter to `afterRender` or `afterNextRender` instead of a function.
384
388
  */
385
389
  phase?: AfterRenderPhase;
386
390
  }
@@ -404,7 +408,7 @@ export declare interface AfterRenderOptions {
404
408
  * or library.
405
409
  *
406
410
  * @deprecated Specify the phase for your callback to run in by passing a spec-object as the first
407
- * parameter to `afterRender` or `afterNextRender` insetad of a function.
411
+ * parameter to `afterRender` or `afterNextRender` instead of a function.
408
412
  */
409
413
  export declare enum AfterRenderPhase {
410
414
  /**
@@ -1851,6 +1855,7 @@ declare abstract class ComponentFactory<C> {
1851
1855
  propName: string;
1852
1856
  templateName: string;
1853
1857
  transform?: (value: any) => any;
1858
+ isSignal: boolean;
1854
1859
  }[];
1855
1860
  /**
1856
1861
  * The outputs of the component.
@@ -1922,6 +1927,7 @@ export declare interface ComponentMirror<C> {
1922
1927
  readonly propName: string;
1923
1928
  readonly templateName: string;
1924
1929
  readonly transform?: (value: any) => any;
1930
+ readonly isSignal: boolean;
1925
1931
  }>;
1926
1932
  /**
1927
1933
  * The outputs of the component.
@@ -7173,10 +7179,8 @@ export declare interface ModelOptions {
7173
7179
  *
7174
7180
  * @developerPreview
7175
7181
  */
7176
- export declare interface ModelSignal<T> extends WritableSignal<T>, OutputRef<T> {
7182
+ export declare interface ModelSignal<T> extends WritableSignal<T>, InputSignal<T>, OutputRef<T> {
7177
7183
  [SIGNAL]: InputSignalNode<T, T>;
7178
- [ɵINPUT_SIGNAL_BRAND_READ_TYPE]: T;
7179
- [ɵINPUT_SIGNAL_BRAND_WRITE_TYPE]: T;
7180
7184
  }
7181
7185
 
7182
7186
  /**
@@ -10587,6 +10591,10 @@ declare const enum TNodeType {
10587
10591
  * existing `TNode` (rather than create a new one) and just update the missing information.
10588
10592
  */
10589
10593
  Placeholder = 64,
10594
+ /**
10595
+ * The TNode contains information about a `@let` declaration.
10596
+ */
10597
+ LetDeclaration = 128,
10590
10598
  AnyRNode = 3,// Text | Element
10591
10599
  AnyContainer = 12
10592
10600
  }
@@ -13565,6 +13573,7 @@ export declare class ɵRender3ComponentFactory<T> extends ComponentFactory<T> {
13565
13573
  get inputs(): {
13566
13574
  propName: string;
13567
13575
  templateName: string;
13576
+ isSignal: boolean;
13568
13577
  transform?: (value: any) => any;
13569
13578
  }[];
13570
13579
  get outputs(): {
@@ -13753,6 +13762,7 @@ export declare const enum ɵRuntimeErrorCode {
13753
13762
  HOST_DIRECTIVE_UNDEFINED_BINDING = 311,
13754
13763
  HOST_DIRECTIVE_CONFLICTING_ALIAS = 312,
13755
13764
  MULTIPLE_MATCHING_PIPES = 313,
13765
+ UNINITIALIZED_LET_ACCESS = 314,
13756
13766
  MULTIPLE_PLATFORMS = 400,
13757
13767
  PLATFORM_NOT_FOUND = 401,
13758
13768
  MISSING_REQUIRED_INJECTABLE_IN_BOOTSTRAP = 402,
@@ -13794,7 +13804,7 @@ export declare const enum ɵRuntimeErrorCode {
13794
13804
  UNEXPECTED_ZONEJS_PRESENT_IN_ZONELESS_MODE = 914,
13795
13805
  REQUIRED_INPUT_NO_VALUE = -950,
13796
13806
  REQUIRED_QUERY_NO_VALUE = -951,
13797
- REQUIRED_MODEL_NO_VALUE = -952,
13807
+ REQUIRED_MODEL_NO_VALUE = 952,
13798
13808
  OUTPUT_REF_DESTROYED = 953,
13799
13809
  LOOP_TRACK_DUPLICATE_KEYS = -955,
13800
13810
  LOOP_TRACK_RECREATE = -956,
@@ -15033,6 +15043,15 @@ export declare function ɵɵcontentQuerySignal<T>(directiveIndex: number, target
15033
15043
  */
15034
15044
  export declare function ɵɵCopyDefinitionFeature(definition: ɵDirectiveDef<any> | ɵComponentDef<any>): void;
15035
15045
 
15046
+ /**
15047
+ * Declares an `@let` at a specific data slot. Returns itself to allow chaining.
15048
+ *
15049
+ * @param index Index at which to declare the `@let`.
15050
+ *
15051
+ * @codeGenApi
15052
+ */
15053
+ export declare function ɵɵdeclareLet(index: number): typeof ɵɵdeclareLet;
15054
+
15036
15055
  /**
15037
15056
  * Creates runtime data structures for defer blocks.
15038
15057
  *
@@ -16711,6 +16730,15 @@ export declare function ɵɵqueryAdvance(indexOffset?: number): void;
16711
16730
  */
16712
16731
  export declare function ɵɵqueryRefresh(queryList: QueryList<any>): boolean;
16713
16732
 
16733
+ /**
16734
+ * Retrieves the value of a `@let` declaration defined in a parent view.
16735
+ *
16736
+ * @param index Index of the declaration within the view.
16737
+ *
16738
+ * @codeGenApi
16739
+ */
16740
+ export declare function ɵɵreadContextLet<T>(index: number): T;
16741
+
16714
16742
  /**
16715
16743
  * Retrieves a local reference from the current contextViewData.
16716
16744
  *
@@ -16964,6 +16992,14 @@ export declare function ɵɵsetNgModuleScope(type: any, scope: NgModuleScopeInfo
16964
16992
  */
16965
16993
  export declare function ɵɵStandaloneFeature(definition: ɵComponentDef<unknown>): void;
16966
16994
 
16995
+ /**
16996
+ * Instruction that stores the value of a `@let` declaration on the current view.
16997
+ * Returns the value to allow usage inside variable initializers.
16998
+ *
16999
+ * @codeGenApi
17000
+ */
17001
+ export declare function ɵɵstoreLet<T>(value: T): T;
17002
+
16967
17003
  /**
16968
17004
  * Update style bindings using an object literal on an element.
16969
17005
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "18.1.0-next.2",
3
+ "version": "18.1.0-next.4",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.2
2
+ * @license Angular v18.1.0-next.4
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -142,7 +142,7 @@ export declare class EventContract implements UnrenamedEventContract {
142
142
  /** Whether to add an a11y click listener. */
143
143
  private addA11yClickListener;
144
144
  ecaacs?: (updateEventInfoForA11yClick: typeof a11yClickLib.updateEventInfoForA11yClick, preventDefaultForA11yClick: typeof a11yClickLib.preventDefaultForA11yClick, populateClickOnlyAction: typeof a11yClickLib.populateClickOnlyAction) => void;
145
- constructor(containerManager: EventContractContainerManager, useActionResolver?: boolean);
145
+ constructor(containerManager: EventContractContainerManager, useActionResolver: false);
146
146
  private handleEvent;
147
147
  /**
148
148
  * Handle an `EventInfo`.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.2
2
+ * @license Angular v18.1.0-next.4
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.2
2
+ * @license Angular v18.1.0-next.4
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -13,6 +13,7 @@ import { OutputOptions } from '@angular/core';
13
13
  import { OutputRef } from '@angular/core';
14
14
  import { Signal } from '@angular/core';
15
15
  import { Subscribable } from 'rxjs';
16
+ import { ValueEqualityFn } from '@angular/core/primitives/signals';
16
17
 
17
18
  /**
18
19
  * Declares an Angular output that is using an RxJS observable as a source
@@ -90,22 +91,22 @@ export declare interface ToObservableOptions {
90
91
 
91
92
  export declare function toSignal<T>(source: Observable<T> | Subscribable<T>): Signal<T | undefined>;
92
93
 
93
- export declare function toSignal<T>(source: Observable<T> | Subscribable<T>, options: ToSignalOptions & {
94
+ export declare function toSignal<T>(source: Observable<T> | Subscribable<T>, options: NoInfer<ToSignalOptions<T | undefined>> & {
94
95
  initialValue?: undefined;
95
96
  requireSync?: false;
96
97
  }): Signal<T | undefined>;
97
98
 
98
- export declare function toSignal<T>(source: Observable<T> | Subscribable<T>, options: ToSignalOptions & {
99
+ export declare function toSignal<T>(source: Observable<T> | Subscribable<T>, options: NoInfer<ToSignalOptions<T | null>> & {
99
100
  initialValue?: null;
100
101
  requireSync?: false;
101
102
  }): Signal<T | null>;
102
103
 
103
- export declare function toSignal<T>(source: Observable<T> | Subscribable<T>, options: ToSignalOptions & {
104
+ export declare function toSignal<T>(source: Observable<T> | Subscribable<T>, options: NoInfer<ToSignalOptions<T>> & {
104
105
  initialValue?: undefined;
105
106
  requireSync: true;
106
107
  }): Signal<T>;
107
108
 
108
- export declare function toSignal<T, const U extends T>(source: Observable<T> | Subscribable<T>, options: ToSignalOptions & {
109
+ export declare function toSignal<T, const U extends T>(source: Observable<T> | Subscribable<T>, options: NoInfer<ToSignalOptions<T | U>> & {
109
110
  initialValue: U;
110
111
  requireSync?: false;
111
112
  }): Signal<T | U>;
@@ -115,7 +116,7 @@ export declare function toSignal<T, const U extends T>(source: Observable<T> | S
115
116
  *
116
117
  * @publicApi
117
118
  */
118
- export declare interface ToSignalOptions {
119
+ export declare interface ToSignalOptions<T> {
119
120
  /**
120
121
  * Initial value for the signal produced by `toSignal`.
121
122
  *
@@ -155,6 +156,12 @@ export declare interface ToSignalOptions {
155
156
  * the behavior of the `async` pipe.
156
157
  */
157
158
  rejectErrors?: boolean;
159
+ /**
160
+ * A comparison function which defines equality for values emitted by the observable.
161
+ *
162
+ * Equality comparisons are executed against the initial value if one is provided.
163
+ */
164
+ equals?: ValueEqualityFn<T>;
158
165
  }
159
166
 
160
167
  export { }
@@ -500,6 +500,19 @@ function getImportSpecifiers(sourceFile, moduleName, specifierNames) {
500
500
  }
501
501
  return matches;
502
502
  }
503
+ function getNamedImports(sourceFile, moduleName) {
504
+ var _a;
505
+ for (const node of sourceFile.statements) {
506
+ if (import_typescript5.default.isImportDeclaration(node) && import_typescript5.default.isStringLiteral(node.moduleSpecifier)) {
507
+ const isMatch = typeof moduleName === "string" ? node.moduleSpecifier.text === moduleName : moduleName.test(node.moduleSpecifier.text);
508
+ const namedBindings = (_a = node.importClause) == null ? void 0 : _a.namedBindings;
509
+ if (isMatch && namedBindings && import_typescript5.default.isNamedImports(namedBindings)) {
510
+ return namedBindings;
511
+ }
512
+ }
513
+ }
514
+ return null;
515
+ }
503
516
  function findImportSpecifier(nodes, specifierName) {
504
517
  return nodes.find((element) => {
505
518
  const { name, propertyName } = element;
@@ -514,41 +527,49 @@ var AFTER_RENDER_FNS = /* @__PURE__ */ new Set(["afterRender", "afterNextRender"
514
527
  function migrateFile(sourceFile, typeChecker, rewriteFn) {
515
528
  var _a;
516
529
  const changeTracker = new ChangeTracker(import_typescript6.default.createPrinter());
530
+ const coreImports = getNamedImports(sourceFile, CORE);
531
+ if (!coreImports) {
532
+ return;
533
+ }
517
534
  const phaseEnum = getImportSpecifier(sourceFile, CORE, AFTER_RENDER_PHASE_ENUM);
518
- if (phaseEnum) {
519
- changeTracker.removeNode(phaseEnum);
520
- import_typescript6.default.forEachChild(sourceFile, function visit(node) {
521
- var _a2;
522
- import_typescript6.default.forEachChild(node, visit);
523
- if (import_typescript6.default.isCallExpression(node) && import_typescript6.default.isIdentifier(node.expression) && AFTER_RENDER_FNS.has(((_a2 = getImportOfIdentifier(typeChecker, node.expression)) == null ? void 0 : _a2.name) || "")) {
524
- let phase;
525
- const [callback, options] = node.arguments;
526
- if (import_typescript6.default.isObjectLiteralExpression(options)) {
527
- const phaseProp = options.properties.find((p) => {
528
- var _a3;
529
- return ((_a3 = p.name) == null ? void 0 : _a3.getText()) === "phase";
530
- });
531
- if (phaseProp && import_typescript6.default.isPropertyAssignment(phaseProp) && import_typescript6.default.isPropertyAccessExpression(phaseProp.initializer) && phaseProp.initializer.expression.getText() === AFTER_RENDER_PHASE_ENUM) {
532
- phaseProp.initializer.expression;
533
- phase = phaseProp.initializer.name.getText();
534
- if (options.properties.length === 1) {
535
- changeTracker.removeNode(options);
536
- } else {
537
- const newOptions = import_typescript6.default.factory.createObjectLiteralExpression(options.properties.filter((p) => p !== phaseProp));
538
- changeTracker.replaceNode(options, newOptions);
539
- }
535
+ if (!phaseEnum) {
536
+ return;
537
+ }
538
+ const newCoreImports = import_typescript6.default.factory.updateNamedImports(coreImports, [
539
+ ...coreImports.elements.filter((current) => phaseEnum !== current)
540
+ ]);
541
+ changeTracker.replaceNode(coreImports, newCoreImports);
542
+ import_typescript6.default.forEachChild(sourceFile, function visit(node) {
543
+ var _a2;
544
+ import_typescript6.default.forEachChild(node, visit);
545
+ if (import_typescript6.default.isCallExpression(node) && import_typescript6.default.isIdentifier(node.expression) && AFTER_RENDER_FNS.has(((_a2 = getImportOfIdentifier(typeChecker, node.expression)) == null ? void 0 : _a2.name) || "")) {
546
+ let phase;
547
+ const [callback, options] = node.arguments;
548
+ if (import_typescript6.default.isObjectLiteralExpression(options)) {
549
+ const phaseProp = options.properties.find((p) => {
550
+ var _a3;
551
+ return ((_a3 = p.name) == null ? void 0 : _a3.getText()) === "phase";
552
+ });
553
+ if (phaseProp && import_typescript6.default.isPropertyAssignment(phaseProp) && import_typescript6.default.isPropertyAccessExpression(phaseProp.initializer) && phaseProp.initializer.expression.getText() === AFTER_RENDER_PHASE_ENUM) {
554
+ phaseProp.initializer.expression;
555
+ phase = phaseProp.initializer.name.getText();
556
+ if (options.properties.length === 1) {
557
+ changeTracker.removeNode(options);
558
+ } else {
559
+ const newOptions = import_typescript6.default.factory.createObjectLiteralExpression(options.properties.filter((p) => p !== phaseProp));
560
+ changeTracker.replaceNode(options, newOptions);
540
561
  }
541
562
  }
542
- if (phase) {
543
- phase = phase.substring(0, 1).toLocaleLowerCase() + phase.substring(1);
544
- const spec = import_typescript6.default.factory.createObjectLiteralExpression([
545
- import_typescript6.default.factory.createPropertyAssignment(import_typescript6.default.factory.createIdentifier(phase), callback)
546
- ]);
547
- changeTracker.replaceNode(callback, spec);
548
- }
549
563
  }
550
- });
551
- }
564
+ if (phase) {
565
+ phase = phase.substring(0, 1).toLocaleLowerCase() + phase.substring(1);
566
+ const spec = import_typescript6.default.factory.createObjectLiteralExpression([
567
+ import_typescript6.default.factory.createPropertyAssignment(import_typescript6.default.factory.createIdentifier(phase), callback)
568
+ ]);
569
+ changeTracker.replaceNode(callback, spec);
570
+ }
571
+ }
572
+ });
552
573
  for (const changesInFile of changeTracker.recordChanges().values()) {
553
574
  for (const change of changesInFile) {
554
575
  rewriteFn(change.start, (_a = change.removeLength) != null ? _a : 0, change.text);