@angular/core 18.1.0-next.1 → 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.mjs +1 -1
- 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/event_emitter.mjs +20 -11
- package/esm2022/src/hydration/event_replay.mjs +32 -14
- package/esm2022/src/linker/component_factory.mjs +1 -1
- package/esm2022/src/pending_tasks.mjs +15 -20
- package/esm2022/src/render3/after_render_hooks.mjs +67 -132
- 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/change_detection.mjs +27 -24
- package/esm2022/src/render3/instructions/let_declaration.mjs +39 -0
- package/esm2022/src/render3/jit/environment.mjs +4 -1
- package/esm2022/src/render3/reactive_lview_consumer.mjs +56 -3
- 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 +500 -424
- 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 +246 -32
- 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 +623 -0
- package/schematics/migrations/after-render-phase/bundle.js.map +7 -0
- package/schematics/migrations/invalid-two-way-bindings/bundle.js +265 -61
- package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +4 -4
- package/schematics/migrations.json +5 -0
- package/schematics/ng-generate/control-flow-migration/bundle.js +272 -61
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
- package/schematics/ng-generate/standalone-migration/bundle.js +320 -727
- 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,MA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C;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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A,0BAAwB,CAAC,CAAC,IAAI,KAAoB,CAAA,0BAAI,YAAY,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AAC/F;;AC5NA;;AAEG;;;;"}
|
package/fesm2022/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
|
*/
|
|
@@ -83,19 +83,106 @@ export declare interface AfterContentInit {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* Register
|
|
87
|
-
*
|
|
86
|
+
* Register callbacks to be invoked the next time the application finishes rendering, during the
|
|
87
|
+
* specified phases. The available phases are:
|
|
88
|
+
* - `earlyRead`
|
|
89
|
+
* Use this phase to **read** from the DOM before a subsequent `write` callback, for example to
|
|
90
|
+
* perform custom layout that the browser doesn't natively support. Prefer the `read` phase if
|
|
91
|
+
* reading can wait until after the write phase. **Never** write to the DOM in this phase.
|
|
92
|
+
* - `write`
|
|
93
|
+
* Use this phase to **write** to the DOM. **Never** read from the DOM in this phase.
|
|
94
|
+
* - `mixedReadWrite`
|
|
95
|
+
* Use this phase to read from and write to the DOM simultaneously. **Never** use this phase if
|
|
96
|
+
* it is possible to divide the work among the other phases instead.
|
|
97
|
+
* - `read`
|
|
98
|
+
* Use this phase to **read** from the DOM. **Never** write to the DOM in this phase.
|
|
88
99
|
*
|
|
89
100
|
* <div class="alert is-critical">
|
|
90
101
|
*
|
|
91
|
-
* You should
|
|
92
|
-
*
|
|
102
|
+
* You should prefer using the `read` and `write` phases over the `earlyRead` and `mixedReadWrite`
|
|
103
|
+
* phases when possible, to avoid performance degradation.
|
|
104
|
+
*
|
|
105
|
+
* </div>
|
|
106
|
+
*
|
|
107
|
+
* Note that:
|
|
108
|
+
* - Callbacks run in the following phase order *once, after the next render*:
|
|
109
|
+
* 1. `earlyRead`
|
|
110
|
+
* 2. `write`
|
|
111
|
+
* 3. `mixedReadWrite`
|
|
112
|
+
* 4. `read`
|
|
113
|
+
* - Callbacks in the same phase run in the order they are registered.
|
|
114
|
+
* - Callbacks run on browser platforms only, they will not run on the server.
|
|
115
|
+
*
|
|
116
|
+
* The first phase callback to run as part of this spec will receive no parameters. Each
|
|
117
|
+
* subsequent phase callback in this spec will receive the return value of the previously run
|
|
118
|
+
* phase callback as a parameter. This can be used to coordinate work across multiple phases.
|
|
119
|
+
*
|
|
120
|
+
* Angular is unable to verify or enforce that phases are used correctly, and instead
|
|
121
|
+
* relies on each developer to follow the guidelines documented for each value and
|
|
122
|
+
* carefully choose the appropriate one, refactoring their code if necessary. By doing
|
|
123
|
+
* so, Angular is better able to minimize the performance degradation associated with
|
|
124
|
+
* manual DOM access, ensuring the best experience for the end users of your application
|
|
125
|
+
* or library.
|
|
126
|
+
*
|
|
127
|
+
* <div class="alert is-important">
|
|
128
|
+
*
|
|
129
|
+
* Components are not guaranteed to be [hydrated](guide/hydration) before the callback runs.
|
|
130
|
+
* You must use caution when directly reading or writing the DOM and layout.
|
|
131
|
+
*
|
|
132
|
+
* </div>
|
|
133
|
+
*
|
|
134
|
+
* @param spec The callback functions to register
|
|
135
|
+
* @param options Options to control the behavior of the callback
|
|
136
|
+
*
|
|
137
|
+
* @usageNotes
|
|
138
|
+
*
|
|
139
|
+
* Use `afterNextRender` to read or write the DOM once,
|
|
140
|
+
* for example to initialize a non-Angular library.
|
|
141
|
+
*
|
|
142
|
+
* ### Example
|
|
143
|
+
* ```ts
|
|
144
|
+
* @Component({
|
|
145
|
+
* selector: 'my-chart-cmp',
|
|
146
|
+
* template: `<div #chart>{{ ... }}</div>`,
|
|
147
|
+
* })
|
|
148
|
+
* export class MyChartCmp {
|
|
149
|
+
* @ViewChild('chart') chartRef: ElementRef;
|
|
150
|
+
* chart: MyChart|null;
|
|
151
|
+
*
|
|
152
|
+
* constructor() {
|
|
153
|
+
* afterNextRender({
|
|
154
|
+
* write: () => {
|
|
155
|
+
* this.chart = new MyChart(this.chartRef.nativeElement);
|
|
156
|
+
* }
|
|
157
|
+
* });
|
|
158
|
+
* }
|
|
159
|
+
* }
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* @developerPreview
|
|
163
|
+
*/
|
|
164
|
+
export declare function afterNextRender<E = never, W = never, M = never>(spec: {
|
|
165
|
+
earlyRead?: () => E;
|
|
166
|
+
write?: (...args: ɵFirstAvailable<[E]>) => W;
|
|
167
|
+
mixedReadWrite?: (...args: ɵFirstAvailable<[W, E]>) => M;
|
|
168
|
+
read?: (...args: ɵFirstAvailable<[M, W, E]>) => void;
|
|
169
|
+
}, options?: Omit<AfterRenderOptions, 'phase'>): AfterRenderRef;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Register a callback to be invoked the next time the application finishes rendering, during the
|
|
173
|
+
* `mixedReadWrite` phase.
|
|
174
|
+
*
|
|
175
|
+
* <div class="alert is-critical">
|
|
176
|
+
*
|
|
177
|
+
* You should prefer specifying an explicit phase for the callback instead, or you risk significant
|
|
178
|
+
* performance degradation.
|
|
93
179
|
*
|
|
94
180
|
* </div>
|
|
95
181
|
*
|
|
96
182
|
* Note that the callback will run
|
|
97
183
|
* - in the order it was registered
|
|
98
184
|
* - on browser platforms only
|
|
185
|
+
* - during the `mixedReadWrite` phase
|
|
99
186
|
*
|
|
100
187
|
* <div class="alert is-important">
|
|
101
188
|
*
|
|
@@ -105,6 +192,7 @@ export declare interface AfterContentInit {
|
|
|
105
192
|
* </div>
|
|
106
193
|
*
|
|
107
194
|
* @param callback A callback function to register
|
|
195
|
+
* @param options Options to control the behavior of the callback
|
|
108
196
|
*
|
|
109
197
|
* @usageNotes
|
|
110
198
|
*
|
|
@@ -122,9 +210,11 @@ export declare interface AfterContentInit {
|
|
|
122
210
|
* chart: MyChart|null;
|
|
123
211
|
*
|
|
124
212
|
* constructor() {
|
|
125
|
-
* afterNextRender(
|
|
126
|
-
*
|
|
127
|
-
*
|
|
213
|
+
* afterNextRender({
|
|
214
|
+
* write: () => {
|
|
215
|
+
* this.chart = new MyChart(this.chartRef.nativeElement);
|
|
216
|
+
* }
|
|
217
|
+
* });
|
|
128
218
|
* }
|
|
129
219
|
* }
|
|
130
220
|
* ```
|
|
@@ -134,13 +224,97 @@ export declare interface AfterContentInit {
|
|
|
134
224
|
export declare function afterNextRender(callback: VoidFunction, options?: AfterRenderOptions): AfterRenderRef;
|
|
135
225
|
|
|
136
226
|
/**
|
|
137
|
-
* Register
|
|
138
|
-
*
|
|
227
|
+
* Register callbacks to be invoked each time the application finishes rendering, during the
|
|
228
|
+
* specified phases. The available phases are:
|
|
229
|
+
* - `earlyRead`
|
|
230
|
+
* Use this phase to **read** from the DOM before a subsequent `write` callback, for example to
|
|
231
|
+
* perform custom layout that the browser doesn't natively support. Prefer the `read` phase if
|
|
232
|
+
* reading can wait until after the write phase. **Never** write to the DOM in this phase.
|
|
233
|
+
* - `write`
|
|
234
|
+
* Use this phase to **write** to the DOM. **Never** read from the DOM in this phase.
|
|
235
|
+
* - `mixedReadWrite`
|
|
236
|
+
* Use this phase to read from and write to the DOM simultaneously. **Never** use this phase if
|
|
237
|
+
* it is possible to divide the work among the other phases instead.
|
|
238
|
+
* - `read`
|
|
239
|
+
* Use this phase to **read** from the DOM. **Never** write to the DOM in this phase.
|
|
139
240
|
*
|
|
140
241
|
* <div class="alert is-critical">
|
|
141
242
|
*
|
|
142
|
-
* You should
|
|
143
|
-
*
|
|
243
|
+
* You should prefer using the `read` and `write` phases over the `earlyRead` and `mixedReadWrite`
|
|
244
|
+
* phases when possible, to avoid performance degradation.
|
|
245
|
+
*
|
|
246
|
+
* </div>
|
|
247
|
+
*
|
|
248
|
+
* Note that:
|
|
249
|
+
* - Callbacks run in the following phase order *after each render*:
|
|
250
|
+
* 1. `earlyRead`
|
|
251
|
+
* 2. `write`
|
|
252
|
+
* 3. `mixedReadWrite`
|
|
253
|
+
* 4. `read`
|
|
254
|
+
* - Callbacks in the same phase run in the order they are registered.
|
|
255
|
+
* - Callbacks run on browser platforms only, they will not run on the server.
|
|
256
|
+
*
|
|
257
|
+
* The first phase callback to run as part of this spec will receive no parameters. Each
|
|
258
|
+
* subsequent phase callback in this spec will receive the return value of the previously run
|
|
259
|
+
* phase callback as a parameter. This can be used to coordinate work across multiple phases.
|
|
260
|
+
*
|
|
261
|
+
* Angular is unable to verify or enforce that phases are used correctly, and instead
|
|
262
|
+
* relies on each developer to follow the guidelines documented for each value and
|
|
263
|
+
* carefully choose the appropriate one, refactoring their code if necessary. By doing
|
|
264
|
+
* so, Angular is better able to minimize the performance degradation associated with
|
|
265
|
+
* manual DOM access, ensuring the best experience for the end users of your application
|
|
266
|
+
* or library.
|
|
267
|
+
*
|
|
268
|
+
* <div class="alert is-important">
|
|
269
|
+
*
|
|
270
|
+
* Components are not guaranteed to be [hydrated](guide/hydration) before the callback runs.
|
|
271
|
+
* You must use caution when directly reading or writing the DOM and layout.
|
|
272
|
+
*
|
|
273
|
+
* </div>
|
|
274
|
+
*
|
|
275
|
+
* @param spec The callback functions to register
|
|
276
|
+
* @param options Options to control the behavior of the callback
|
|
277
|
+
*
|
|
278
|
+
* @usageNotes
|
|
279
|
+
*
|
|
280
|
+
* Use `afterRender` to read or write the DOM after each render.
|
|
281
|
+
*
|
|
282
|
+
* ### Example
|
|
283
|
+
* ```ts
|
|
284
|
+
* @Component({
|
|
285
|
+
* selector: 'my-cmp',
|
|
286
|
+
* template: `<span #content>{{ ... }}</span>`,
|
|
287
|
+
* })
|
|
288
|
+
* export class MyComponent {
|
|
289
|
+
* @ViewChild('content') contentRef: ElementRef;
|
|
290
|
+
*
|
|
291
|
+
* constructor() {
|
|
292
|
+
* afterRender({
|
|
293
|
+
* read: () => {
|
|
294
|
+
* console.log('content height: ' + this.contentRef.nativeElement.scrollHeight);
|
|
295
|
+
* }
|
|
296
|
+
* });
|
|
297
|
+
* }
|
|
298
|
+
* }
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
301
|
+
* @developerPreview
|
|
302
|
+
*/
|
|
303
|
+
export declare function afterRender<E = never, W = never, M = never>(spec: {
|
|
304
|
+
earlyRead?: () => E;
|
|
305
|
+
write?: (...args: ɵFirstAvailable<[E]>) => W;
|
|
306
|
+
mixedReadWrite?: (...args: ɵFirstAvailable<[W, E]>) => M;
|
|
307
|
+
read?: (...args: ɵFirstAvailable<[M, W, E]>) => void;
|
|
308
|
+
}, options?: Omit<AfterRenderOptions, 'phase'>): AfterRenderRef;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Register a callback to be invoked each time the application finishes rendering, during the
|
|
312
|
+
* `mixedReadWrite` phase.
|
|
313
|
+
*
|
|
314
|
+
* <div class="alert is-critical">
|
|
315
|
+
*
|
|
316
|
+
* You should prefer specifying an explicit phase for the callback instead, or you risk significant
|
|
317
|
+
* performance degradation.
|
|
144
318
|
*
|
|
145
319
|
* </div>
|
|
146
320
|
*
|
|
@@ -148,6 +322,7 @@ export declare function afterNextRender(callback: VoidFunction, options?: AfterR
|
|
|
148
322
|
* - in the order it was registered
|
|
149
323
|
* - once per render
|
|
150
324
|
* - on browser platforms only
|
|
325
|
+
* - during the `mixedReadWrite` phase
|
|
151
326
|
*
|
|
152
327
|
* <div class="alert is-important">
|
|
153
328
|
*
|
|
@@ -157,6 +332,7 @@ export declare function afterNextRender(callback: VoidFunction, options?: AfterR
|
|
|
157
332
|
* </div>
|
|
158
333
|
*
|
|
159
334
|
* @param callback A callback function to register
|
|
335
|
+
* @param options Options to control the behavior of the callback
|
|
160
336
|
*
|
|
161
337
|
* @usageNotes
|
|
162
338
|
*
|
|
@@ -172,9 +348,11 @@ export declare function afterNextRender(callback: VoidFunction, options?: AfterR
|
|
|
172
348
|
* @ViewChild('content') contentRef: ElementRef;
|
|
173
349
|
*
|
|
174
350
|
* constructor() {
|
|
175
|
-
* afterRender(
|
|
176
|
-
*
|
|
177
|
-
*
|
|
351
|
+
* afterRender({
|
|
352
|
+
* read: () => {
|
|
353
|
+
* console.log('content height: ' + this.contentRef.nativeElement.scrollHeight);
|
|
354
|
+
* }
|
|
355
|
+
* });
|
|
178
356
|
* }
|
|
179
357
|
* }
|
|
180
358
|
* ```
|
|
@@ -204,6 +382,9 @@ export declare interface AfterRenderOptions {
|
|
|
204
382
|
* phase instead. See `AfterRenderPhase` for more information.
|
|
205
383
|
*
|
|
206
384
|
* </div>
|
|
385
|
+
*
|
|
386
|
+
* @deprecated Specify the phase for your callback to run in by passing a spec-object as the first
|
|
387
|
+
* parameter to `afterRender` or `afterNextRender` instead of a function.
|
|
207
388
|
*/
|
|
208
389
|
phase?: AfterRenderPhase;
|
|
209
390
|
}
|
|
@@ -226,14 +407,16 @@ export declare interface AfterRenderOptions {
|
|
|
226
407
|
* manual DOM access, ensuring the best experience for the end users of your application
|
|
227
408
|
* or library.
|
|
228
409
|
*
|
|
229
|
-
* @
|
|
410
|
+
* @deprecated Specify the phase for your callback to run in by passing a spec-object as the first
|
|
411
|
+
* parameter to `afterRender` or `afterNextRender` instead of a function.
|
|
230
412
|
*/
|
|
231
413
|
export declare enum AfterRenderPhase {
|
|
232
414
|
/**
|
|
233
415
|
* Use `AfterRenderPhase.EarlyRead` for callbacks that only need to **read** from the
|
|
234
416
|
* DOM before a subsequent `AfterRenderPhase.Write` callback, for example to perform
|
|
235
|
-
* custom layout that the browser doesn't natively support.
|
|
236
|
-
*
|
|
417
|
+
* custom layout that the browser doesn't natively support. Prefer the
|
|
418
|
+
* `AfterRenderPhase.EarlyRead` phase if reading can wait until after the write phase.
|
|
419
|
+
* **Never** write to the DOM in this phase.
|
|
237
420
|
*
|
|
238
421
|
* <div class="alert is-important">
|
|
239
422
|
*
|
|
@@ -245,25 +428,25 @@ export declare enum AfterRenderPhase {
|
|
|
245
428
|
EarlyRead = 0,
|
|
246
429
|
/**
|
|
247
430
|
* Use `AfterRenderPhase.Write` for callbacks that only **write** to the DOM. **Never**
|
|
248
|
-
*
|
|
431
|
+
* read from the DOM in this phase.
|
|
249
432
|
*/
|
|
250
433
|
Write = 1,
|
|
251
434
|
/**
|
|
252
435
|
* Use `AfterRenderPhase.MixedReadWrite` for callbacks that read from or write to the
|
|
253
|
-
* DOM, that haven't been refactored to use a different phase. **Never** use this phase
|
|
254
|
-
*
|
|
436
|
+
* DOM, that haven't been refactored to use a different phase. **Never** use this phase if
|
|
437
|
+
* it is possible to divide the work among the other phases instead.
|
|
255
438
|
*
|
|
256
439
|
* <div class="alert is-critical">
|
|
257
440
|
*
|
|
258
441
|
* Using this value can **significantly** degrade performance.
|
|
259
|
-
* Instead, prefer
|
|
442
|
+
* Instead, prefer dividing work into the appropriate phase callbacks.
|
|
260
443
|
*
|
|
261
444
|
* </div>
|
|
262
445
|
*/
|
|
263
446
|
MixedReadWrite = 2,
|
|
264
447
|
/**
|
|
265
448
|
* Use `AfterRenderPhase.Read` for callbacks that only **read** from the DOM. **Never**
|
|
266
|
-
*
|
|
449
|
+
* write to the DOM in this phase.
|
|
267
450
|
*/
|
|
268
451
|
Read = 3
|
|
269
452
|
}
|
|
@@ -1672,6 +1855,7 @@ declare abstract class ComponentFactory<C> {
|
|
|
1672
1855
|
propName: string;
|
|
1673
1856
|
templateName: string;
|
|
1674
1857
|
transform?: (value: any) => any;
|
|
1858
|
+
isSignal: boolean;
|
|
1675
1859
|
}[];
|
|
1676
1860
|
/**
|
|
1677
1861
|
* The outputs of the component.
|
|
@@ -1743,6 +1927,7 @@ export declare interface ComponentMirror<C> {
|
|
|
1743
1927
|
readonly propName: string;
|
|
1744
1928
|
readonly templateName: string;
|
|
1745
1929
|
readonly transform?: (value: any) => any;
|
|
1930
|
+
readonly isSignal: boolean;
|
|
1746
1931
|
}>;
|
|
1747
1932
|
/**
|
|
1748
1933
|
* The outputs of the component.
|
|
@@ -3964,8 +4149,8 @@ export declare class ExperimentalPendingTasks {
|
|
|
3964
4149
|
* @returns A cleanup function that removes a task when called.
|
|
3965
4150
|
*/
|
|
3966
4151
|
add(): () => void;
|
|
3967
|
-
|
|
3968
|
-
static ɵprov:
|
|
4152
|
+
/** @nocollapse */
|
|
4153
|
+
static ɵprov: unknown;
|
|
3969
4154
|
}
|
|
3970
4155
|
|
|
3971
4156
|
/**
|
|
@@ -6994,10 +7179,8 @@ export declare interface ModelOptions {
|
|
|
6994
7179
|
*
|
|
6995
7180
|
* @developerPreview
|
|
6996
7181
|
*/
|
|
6997
|
-
export declare interface ModelSignal<T> extends WritableSignal<T>, OutputRef<T> {
|
|
7182
|
+
export declare interface ModelSignal<T> extends WritableSignal<T>, InputSignal<T>, OutputRef<T> {
|
|
6998
7183
|
[SIGNAL]: InputSignalNode<T, T>;
|
|
6999
|
-
[ɵINPUT_SIGNAL_BRAND_READ_TYPE]: T;
|
|
7000
|
-
[ɵINPUT_SIGNAL_BRAND_WRITE_TYPE]: T;
|
|
7001
7184
|
}
|
|
7002
7185
|
|
|
7003
7186
|
/**
|
|
@@ -8675,7 +8858,6 @@ declare const REACTIVE_TEMPLATE_CONSUMER = 23;
|
|
|
8675
8858
|
|
|
8676
8859
|
declare interface ReactiveLViewConsumer extends ReactiveNode {
|
|
8677
8860
|
lView: LView | null;
|
|
8678
|
-
slot: typeof REACTIVE_TEMPLATE_CONSUMER;
|
|
8679
8861
|
}
|
|
8680
8862
|
|
|
8681
8863
|
/**
|
|
@@ -12624,6 +12806,12 @@ export declare const enum ɵExtraLocaleDataIndex {
|
|
|
12624
12806
|
*/
|
|
12625
12807
|
export declare function ɵfindLocaleData(locale: string): any;
|
|
12626
12808
|
|
|
12809
|
+
/**
|
|
12810
|
+
* An argument list containing the first non-never type in the given type array, or an empty
|
|
12811
|
+
* argument list if there are no non-never types in the type array.
|
|
12812
|
+
*/
|
|
12813
|
+
export declare type ɵFirstAvailable<T extends unknown[]> = T extends [infer H, ...infer R] ? [H] extends [never] ? ɵFirstAvailable<R> : [H] : [];
|
|
12814
|
+
|
|
12627
12815
|
/**
|
|
12628
12816
|
* Loops over queued module definitions, if a given module definition has all of its
|
|
12629
12817
|
* declarations resolved, it dequeues that module definition and sets the scope on
|
|
@@ -13184,8 +13372,8 @@ export declare class ɵPendingTasks implements OnDestroy {
|
|
|
13184
13372
|
add(): number;
|
|
13185
13373
|
remove(taskId: number): void;
|
|
13186
13374
|
ngOnDestroy(): void;
|
|
13187
|
-
|
|
13188
|
-
static ɵprov:
|
|
13375
|
+
/** @nocollapse */
|
|
13376
|
+
static ɵprov: unknown;
|
|
13189
13377
|
}
|
|
13190
13378
|
|
|
13191
13379
|
|
|
@@ -13381,6 +13569,7 @@ export declare class ɵRender3ComponentFactory<T> extends ComponentFactory<T> {
|
|
|
13381
13569
|
get inputs(): {
|
|
13382
13570
|
propName: string;
|
|
13383
13571
|
templateName: string;
|
|
13572
|
+
isSignal: boolean;
|
|
13384
13573
|
transform?: (value: any) => any;
|
|
13385
13574
|
}[];
|
|
13386
13575
|
get outputs(): {
|
|
@@ -13610,7 +13799,7 @@ export declare const enum ɵRuntimeErrorCode {
|
|
|
13610
13799
|
UNEXPECTED_ZONEJS_PRESENT_IN_ZONELESS_MODE = 914,
|
|
13611
13800
|
REQUIRED_INPUT_NO_VALUE = -950,
|
|
13612
13801
|
REQUIRED_QUERY_NO_VALUE = -951,
|
|
13613
|
-
REQUIRED_MODEL_NO_VALUE =
|
|
13802
|
+
REQUIRED_MODEL_NO_VALUE = 952,
|
|
13614
13803
|
OUTPUT_REF_DESTROYED = 953,
|
|
13615
13804
|
LOOP_TRACK_DUPLICATE_KEYS = -955,
|
|
13616
13805
|
LOOP_TRACK_RECREATE = -956,
|
|
@@ -14849,6 +15038,15 @@ export declare function ɵɵcontentQuerySignal<T>(directiveIndex: number, target
|
|
|
14849
15038
|
*/
|
|
14850
15039
|
export declare function ɵɵCopyDefinitionFeature(definition: ɵDirectiveDef<any> | ɵComponentDef<any>): void;
|
|
14851
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
|
+
|
|
14852
15050
|
/**
|
|
14853
15051
|
* Creates runtime data structures for defer blocks.
|
|
14854
15052
|
*
|
|
@@ -16527,6 +16725,15 @@ export declare function ɵɵqueryAdvance(indexOffset?: number): void;
|
|
|
16527
16725
|
*/
|
|
16528
16726
|
export declare function ɵɵqueryRefresh(queryList: QueryList<any>): boolean;
|
|
16529
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
|
+
|
|
16530
16737
|
/**
|
|
16531
16738
|
* Retrieves a local reference from the current contextViewData.
|
|
16532
16739
|
*
|
|
@@ -16780,6 +16987,13 @@ export declare function ɵɵsetNgModuleScope(type: any, scope: NgModuleScopeInfo
|
|
|
16780
16987
|
*/
|
|
16781
16988
|
export declare function ɵɵStandaloneFeature(definition: ɵComponentDef<unknown>): void;
|
|
16782
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
|
+
|
|
16783
16997
|
/**
|
|
16784
16998
|
* Update style bindings using an object literal on an element.
|
|
16785
16999
|
*
|
package/package.json
CHANGED