@angular/core 18.1.0-next.2 → 18.1.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.
- package/esm2022/rxjs-interop/src/to_signal.mjs +7 -3
- package/esm2022/src/authoring/model/model_signal.mjs +2 -3
- package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +2 -2
- package/esm2022/src/core_render3_private_export.mjs +2 -2
- package/esm2022/src/defer/instructions.mjs +2 -10
- package/esm2022/src/errors.mjs +1 -1
- package/esm2022/src/hydration/event_replay.mjs +32 -14
- package/esm2022/src/linker/component_factory.mjs +1 -1
- package/esm2022/src/render3/after_render_hooks.mjs +2 -2
- package/esm2022/src/render3/chained_injector.mjs +34 -0
- package/esm2022/src/render3/component.mjs +1 -1
- package/esm2022/src/render3/component_ref.mjs +23 -35
- package/esm2022/src/render3/index.mjs +2 -2
- package/esm2022/src/render3/instructions/all.mjs +2 -1
- package/esm2022/src/render3/instructions/let_declaration.mjs +39 -0
- package/esm2022/src/render3/jit/environment.mjs +4 -1
- package/esm2022/src/render3/util/injector_discovery_utils.mjs +14 -5
- package/esm2022/src/render3/util/injector_utils.mjs +10 -1
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/logger.mjs +3 -3
- package/fesm2022/core.mjs +160 -79
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs +7 -3
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +1 -1
- package/index.d.ts +39 -9
- package/package.json +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +13 -6
- package/schematics/migrations/after-render-phase/bundle.js +64 -43
- package/schematics/migrations/after-render-phase/bundle.js.map +2 -2
- package/schematics/migrations/http-providers/bundle.js +15 -15
- package/schematics/migrations/invalid-two-way-bindings/bundle.js +422 -218
- package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +4 -4
- package/schematics/ng-generate/control-flow-migration/bundle.js +437 -226
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
- package/schematics/ng-generate/standalone-migration/bundle.js +711 -505
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v18.1.0-next.
|
|
2
|
+
* @license Angular v18.1.0-next.3
|
|
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;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,C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AAM,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,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m2022/testing.mjs
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v18.1.0-next.
|
|
2
|
+
* @license Angular v18.1.0-next.3
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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`
|
|
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`
|
|
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
|
/**
|
|
@@ -13565,6 +13569,7 @@ export declare class ɵRender3ComponentFactory<T> extends ComponentFactory<T> {
|
|
|
13565
13569
|
get inputs(): {
|
|
13566
13570
|
propName: string;
|
|
13567
13571
|
templateName: string;
|
|
13572
|
+
isSignal: boolean;
|
|
13568
13573
|
transform?: (value: any) => any;
|
|
13569
13574
|
}[];
|
|
13570
13575
|
get outputs(): {
|
|
@@ -13794,7 +13799,7 @@ export declare const enum ɵRuntimeErrorCode {
|
|
|
13794
13799
|
UNEXPECTED_ZONEJS_PRESENT_IN_ZONELESS_MODE = 914,
|
|
13795
13800
|
REQUIRED_INPUT_NO_VALUE = -950,
|
|
13796
13801
|
REQUIRED_QUERY_NO_VALUE = -951,
|
|
13797
|
-
REQUIRED_MODEL_NO_VALUE =
|
|
13802
|
+
REQUIRED_MODEL_NO_VALUE = 952,
|
|
13798
13803
|
OUTPUT_REF_DESTROYED = 953,
|
|
13799
13804
|
LOOP_TRACK_DUPLICATE_KEYS = -955,
|
|
13800
13805
|
LOOP_TRACK_RECREATE = -956,
|
|
@@ -15033,6 +15038,15 @@ export declare function ɵɵcontentQuerySignal<T>(directiveIndex: number, target
|
|
|
15033
15038
|
*/
|
|
15034
15039
|
export declare function ɵɵCopyDefinitionFeature(definition: ɵDirectiveDef<any> | ɵComponentDef<any>): void;
|
|
15035
15040
|
|
|
15041
|
+
/**
|
|
15042
|
+
* Declares an `@let` at a specific data slot.
|
|
15043
|
+
*
|
|
15044
|
+
* @param index Index at which to declare the `@let`.
|
|
15045
|
+
*
|
|
15046
|
+
* @codeGenApi
|
|
15047
|
+
*/
|
|
15048
|
+
export declare function ɵɵdeclareLet(index: number): typeof ɵɵdeclareLet;
|
|
15049
|
+
|
|
15036
15050
|
/**
|
|
15037
15051
|
* Creates runtime data structures for defer blocks.
|
|
15038
15052
|
*
|
|
@@ -16711,6 +16725,15 @@ export declare function ɵɵqueryAdvance(indexOffset?: number): void;
|
|
|
16711
16725
|
*/
|
|
16712
16726
|
export declare function ɵɵqueryRefresh(queryList: QueryList<any>): boolean;
|
|
16713
16727
|
|
|
16728
|
+
/**
|
|
16729
|
+
* Retrieves the value of a `@let` declaration defined within the same view.
|
|
16730
|
+
*
|
|
16731
|
+
* @param index Index of the declaration within the view.
|
|
16732
|
+
*
|
|
16733
|
+
* @codeGenApi
|
|
16734
|
+
*/
|
|
16735
|
+
export declare function ɵɵreadContextLet<T>(index: number): T;
|
|
16736
|
+
|
|
16714
16737
|
/**
|
|
16715
16738
|
* Retrieves a local reference from the current contextViewData.
|
|
16716
16739
|
*
|
|
@@ -16964,6 +16987,13 @@ export declare function ɵɵsetNgModuleScope(type: any, scope: NgModuleScopeInfo
|
|
|
16964
16987
|
*/
|
|
16965
16988
|
export declare function ɵɵStandaloneFeature(definition: ɵComponentDef<unknown>): void;
|
|
16966
16989
|
|
|
16990
|
+
/**
|
|
16991
|
+
* Instruction that stores the value of a `@let` declaration on the current view.
|
|
16992
|
+
*
|
|
16993
|
+
* @codeGenApi
|
|
16994
|
+
*/
|
|
16995
|
+
export declare function ɵɵstoreLet<T>(value: T): T;
|
|
16996
|
+
|
|
16967
16997
|
/**
|
|
16968
16998
|
* Update style bindings using an object literal on an element.
|
|
16969
16999
|
*
|
package/package.json
CHANGED
package/rxjs-interop/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v18.1.0-next.
|
|
2
|
+
* @license Angular v18.1.0-next.3
|
|
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 { }
|
|
@@ -60,7 +60,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
// bazel-out/
|
|
63
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/after-render-phase/index.mjs
|
|
64
64
|
var after_render_phase_exports = {};
|
|
65
65
|
__export(after_render_phase_exports, {
|
|
66
66
|
default: () => after_render_phase_default
|
|
@@ -69,7 +69,7 @@ module.exports = __toCommonJS(after_render_phase_exports);
|
|
|
69
69
|
var import_schematics = require("@angular-devkit/schematics");
|
|
70
70
|
var import_path3 = require("path");
|
|
71
71
|
|
|
72
|
-
// bazel-out/
|
|
72
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs
|
|
73
73
|
var import_core = require("@angular-devkit/core");
|
|
74
74
|
function getProjectTsConfigPaths(tree) {
|
|
75
75
|
return __async(this, null, function* () {
|
|
@@ -149,11 +149,11 @@ function getWorkspace(tree) {
|
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
// bazel-out/
|
|
152
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
|
|
153
153
|
var import_path = require("path");
|
|
154
154
|
var import_typescript2 = __toESM(require("typescript"), 1);
|
|
155
155
|
|
|
156
|
-
// bazel-out/
|
|
156
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
|
|
157
157
|
var path = __toESM(require("path"), 1);
|
|
158
158
|
var import_typescript = __toESM(require("typescript"), 1);
|
|
159
159
|
function parseTsconfigFile(tsconfigPath, basePath) {
|
|
@@ -170,7 +170,7 @@ function parseTsconfigFile(tsconfigPath, basePath) {
|
|
|
170
170
|
return import_typescript.default.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
// bazel-out/
|
|
173
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
|
|
174
174
|
function createMigrationProgram(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles) {
|
|
175
175
|
const { rootNames, options, host } = createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles);
|
|
176
176
|
return import_typescript2.default.createProgram(rootNames, options, host);
|
|
@@ -203,13 +203,13 @@ function canMigrateFile(basePath, sourceFile, program) {
|
|
|
203
203
|
return !(0, import_path.relative)(basePath, sourceFile.fileName).startsWith("..");
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
// bazel-out/
|
|
206
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/after-render-phase/migration.mjs
|
|
207
207
|
var import_typescript6 = __toESM(require("typescript"), 1);
|
|
208
208
|
|
|
209
|
-
// bazel-out/
|
|
209
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
|
|
210
210
|
var import_typescript4 = __toESM(require("typescript"), 1);
|
|
211
211
|
|
|
212
|
-
// bazel-out/
|
|
212
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/import_manager.mjs
|
|
213
213
|
var import_path2 = require("path");
|
|
214
214
|
var import_typescript3 = __toESM(require("typescript"), 1);
|
|
215
215
|
var ImportManager = class {
|
|
@@ -393,7 +393,7 @@ ${text}`;
|
|
|
393
393
|
}
|
|
394
394
|
};
|
|
395
395
|
|
|
396
|
-
// bazel-out/
|
|
396
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
|
|
397
397
|
var ChangeTracker = class {
|
|
398
398
|
constructor(_printer, _importRemapper) {
|
|
399
399
|
__publicField(this, "_printer");
|
|
@@ -456,7 +456,7 @@ function normalizePath(path2) {
|
|
|
456
456
|
return path2.replace(/\\/g, "/");
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
// bazel-out/
|
|
459
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/imports.mjs
|
|
460
460
|
var import_typescript5 = __toESM(require("typescript"), 1);
|
|
461
461
|
function getImportOfIdentifier(typeChecker, node) {
|
|
462
462
|
const symbol = typeChecker.getSymbolAtLocation(node);
|
|
@@ -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;
|
|
@@ -507,48 +520,56 @@ function findImportSpecifier(nodes, specifierName) {
|
|
|
507
520
|
});
|
|
508
521
|
}
|
|
509
522
|
|
|
510
|
-
// bazel-out/
|
|
523
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/after-render-phase/migration.mjs
|
|
511
524
|
var CORE = "@angular/core";
|
|
512
525
|
var AFTER_RENDER_PHASE_ENUM = "AfterRenderPhase";
|
|
513
526
|
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
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
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);
|
|
@@ -556,7 +577,7 @@ function migrateFile(sourceFile, typeChecker, rewriteFn) {
|
|
|
556
577
|
}
|
|
557
578
|
}
|
|
558
579
|
|
|
559
|
-
// bazel-out/
|
|
580
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/after-render-phase/index.mjs
|
|
560
581
|
function after_render_phase_default() {
|
|
561
582
|
return (tree) => __async(this, null, function* () {
|
|
562
583
|
const { buildPaths, testPaths } = yield getProjectTsConfigPaths(tree);
|