@angular/core 17.0.0-next.7 → 17.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/primitives/signals/index.mjs +15 -0
- package/esm2022/primitives/signals/src/computed.mjs +92 -0
- package/esm2022/primitives/signals/src/equality.mjs +14 -0
- package/esm2022/primitives/signals/src/errors.mjs +18 -0
- package/esm2022/primitives/signals/src/graph.mjs +291 -0
- package/esm2022/primitives/signals/src/signal.mjs +78 -0
- package/esm2022/primitives/signals/src/watch.mjs +82 -0
- package/esm2022/primitives/signals/src/weak_ref.mjs +11 -0
- package/esm2022/rxjs-interop/src/to_signal.mjs +45 -14
- package/esm2022/src/application_init.mjs +50 -2
- package/esm2022/src/application_ref.mjs +8 -2
- package/esm2022/src/application_tokens.mjs +16 -1
- package/esm2022/src/core_private_export.mjs +7 -6
- package/esm2022/src/core_reactivity_export_internal.mjs +6 -2
- package/esm2022/src/core_render3_private_export.mjs +3 -3
- package/esm2022/src/debug/debug_node.mjs +5 -9
- package/esm2022/src/defer/cleanup.mjs +70 -0
- package/esm2022/src/defer/discovery.mjs +47 -0
- package/esm2022/src/defer/dom_triggers.mjs +256 -0
- package/esm2022/src/defer/idle_scheduler.mjs +109 -0
- package/esm2022/src/defer/instructions.mjs +641 -0
- package/esm2022/src/defer/interfaces.mjs +79 -0
- package/esm2022/src/defer/timer_scheduler.mjs +192 -0
- package/esm2022/src/defer/utils.mjs +134 -0
- package/esm2022/src/errors.mjs +1 -1
- package/esm2022/src/hydration/api.mjs +1 -2
- package/esm2022/src/hydration/utils.mjs +2 -2
- package/esm2022/src/image_performance_warning.mjs +154 -0
- package/esm2022/src/linker/compiler.mjs +1 -1
- package/esm2022/src/metadata/directives.mjs +1 -1
- package/esm2022/src/render/api.mjs +1 -1
- package/esm2022/src/render3/after_render_hooks.mjs +35 -1
- package/esm2022/src/render3/assert.mjs +16 -1
- package/esm2022/src/render3/component_ref.mjs +12 -3
- package/esm2022/src/render3/debug/framework_injector_profiler.mjs +33 -4
- package/esm2022/src/render3/debug/injector_profiler.mjs +1 -1
- package/esm2022/src/render3/debug/set_debug_info.mjs +20 -0
- package/esm2022/src/render3/definition.mjs +2 -1
- package/esm2022/src/render3/deps_tracker/api.mjs +1 -1
- package/esm2022/src/render3/deps_tracker/deps_tracker.mjs +13 -2
- package/esm2022/src/render3/features/host_directives_feature.mjs +3 -8
- package/esm2022/src/render3/hooks.mjs +5 -5
- package/esm2022/src/render3/index.mjs +4 -2
- package/esm2022/src/render3/instructions/all.mjs +2 -2
- package/esm2022/src/render3/instructions/change_detection.mjs +31 -14
- package/esm2022/src/render3/instructions/control_flow.mjs +42 -23
- package/esm2022/src/render3/instructions/shared.mjs +5 -4
- package/esm2022/src/render3/interfaces/container.mjs +5 -7
- package/esm2022/src/render3/interfaces/definition.mjs +2 -4
- package/esm2022/src/render3/interfaces/i18n.mjs +1 -4
- package/esm2022/src/render3/interfaces/injector.mjs +1 -4
- package/esm2022/src/render3/interfaces/node.mjs +1 -4
- package/esm2022/src/render3/interfaces/projection.mjs +2 -4
- package/esm2022/src/render3/interfaces/query.mjs +2 -4
- package/esm2022/src/render3/interfaces/renderer.mjs +2 -4
- package/esm2022/src/render3/interfaces/renderer_dom.mjs +2 -4
- package/esm2022/src/render3/interfaces/view.mjs +5 -7
- package/esm2022/src/render3/jit/environment.mjs +3 -1
- package/esm2022/src/render3/list_reconciliation.mjs +58 -34
- package/esm2022/src/render3/node_manipulation.mjs +4 -6
- package/esm2022/src/render3/reactive_lview_consumer.mjs +3 -8
- package/esm2022/src/render3/reactivity/api.mjs +15 -0
- package/esm2022/src/render3/reactivity/asserts.mjs +26 -0
- package/esm2022/src/render3/reactivity/computed.mjs +19 -0
- package/esm2022/src/render3/reactivity/effect.mjs +7 -6
- package/esm2022/src/render3/reactivity/signal.mjs +32 -0
- package/esm2022/src/render3/reactivity/untracked.mjs +24 -0
- package/esm2022/src/render3/util/injector_discovery_utils.mjs +43 -14
- package/esm2022/src/render3/util/stringify_utils.mjs +28 -1
- package/esm2022/src/render3/util/view_utils.mjs +41 -25
- package/esm2022/src/render3/view_ref.mjs +3 -2
- package/esm2022/src/util/stringify.mjs +16 -1
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/logger.mjs +3 -3
- package/fesm2022/core.mjs +2881 -2270
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +539 -0
- package/fesm2022/primitives/signals.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +45 -14
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +1 -1
- package/index.d.ts +204 -168
- package/package.json +7 -1
- package/primitives/signals/index.d.ts +281 -0
- package/rxjs-interop/index.d.ts +15 -101
- package/schematics/collection.json +12 -2
- package/schematics/migrations/block-template-entities/bundle.js +551 -197
- package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
- package/schematics/migrations/compiler-options/bundle.js +582 -0
- package/schematics/migrations/compiler-options/bundle.js.map +7 -0
- package/schematics/migrations/transfer-state/bundle.js +592 -0
- package/schematics/migrations/transfer-state/bundle.js.map +7 -0
- package/schematics/migrations.json +10 -0
- package/schematics/ng-generate/control-flow-migration/bundle.js +24309 -0
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +7 -0
- package/schematics/ng-generate/control-flow-migration/schema.json +7 -0
- package/schematics/ng-generate/standalone-migration/bundle.js +1496 -924
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
- package/esm2022/src/render3/instructions/defer.mjs +0 -1091
- package/esm2022/src/render3/instructions/defer_events.mjs +0 -164
- package/esm2022/src/render3/interfaces/defer.mjs +0 -72
- package/esm2022/src/signals/index.mjs +0 -16
- package/esm2022/src/signals/src/api.mjs +0 -39
- package/esm2022/src/signals/src/computed.mjs +0 -95
- package/esm2022/src/signals/src/errors.mjs +0 -18
- package/esm2022/src/signals/src/graph.mjs +0 -280
- package/esm2022/src/signals/src/signal.mjs +0 -92
- package/esm2022/src/signals/src/untracked.mjs +0 -26
- package/esm2022/src/signals/src/watch.mjs +0 -81
- package/esm2022/src/signals/src/weak_ref.mjs +0 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/core",
|
|
3
|
-
"version": "17.0.0-
|
|
3
|
+
"version": "17.0.0-rc.0",
|
|
4
4
|
"description": "Angular - the core framework",
|
|
5
5
|
"author": "angular",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,6 +20,12 @@
|
|
|
20
20
|
"esm": "./esm2022/core.mjs",
|
|
21
21
|
"default": "./fesm2022/core.mjs"
|
|
22
22
|
},
|
|
23
|
+
"./primitives/signals": {
|
|
24
|
+
"types": "./primitives/signals/index.d.ts",
|
|
25
|
+
"esm2022": "./esm2022/primitives/signals/index.mjs",
|
|
26
|
+
"esm": "./esm2022/primitives/signals/index.mjs",
|
|
27
|
+
"default": "./fesm2022/primitives/signals.mjs"
|
|
28
|
+
},
|
|
23
29
|
"./rxjs-interop": {
|
|
24
30
|
"types": "./rxjs-interop/index.d.ts",
|
|
25
31
|
"esm2022": "./esm2022/rxjs-interop/rxjs-interop.mjs",
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Angular v17.0.0-rc.0
|
|
3
|
+
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
|
+
* License: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
declare type ComputedGetter<T> = (() => T) & {
|
|
9
|
+
[SIGNAL]: ComputedNode<T>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A computation, which derives a value from a declarative reactive expression.
|
|
14
|
+
*
|
|
15
|
+
* `Computed`s are both producers and consumers of reactivity.
|
|
16
|
+
*/
|
|
17
|
+
declare interface ComputedNode<T> extends ReactiveNode {
|
|
18
|
+
/**
|
|
19
|
+
* Current value of the computation, or one of the sentinel values above (`UNSET`, `COMPUTING`,
|
|
20
|
+
* `ERROR`).
|
|
21
|
+
*/
|
|
22
|
+
value: T;
|
|
23
|
+
/**
|
|
24
|
+
* If `value` is `ERRORED`, the error caught from the last computation attempt which will
|
|
25
|
+
* be re-thrown.
|
|
26
|
+
*/
|
|
27
|
+
error: unknown;
|
|
28
|
+
/**
|
|
29
|
+
* The computation function which will produce a new value.
|
|
30
|
+
*/
|
|
31
|
+
computation: () => T;
|
|
32
|
+
equal: ValueEqualityFn<T>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Finalize this consumer's state after a reactive computation has run.
|
|
37
|
+
*
|
|
38
|
+
* Must be called by subclasses which represent reactive computations, after those computations
|
|
39
|
+
* have finished.
|
|
40
|
+
*/
|
|
41
|
+
export declare function consumerAfterComputation(node: ReactiveNode | null, prevConsumer: ReactiveNode | null): void;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Prepare this consumer to run a computation in its reactive context.
|
|
45
|
+
*
|
|
46
|
+
* Must be called by subclasses which represent reactive computations, before those computations
|
|
47
|
+
* begin.
|
|
48
|
+
*/
|
|
49
|
+
export declare function consumerBeforeComputation(node: ReactiveNode | null): ReactiveNode | null;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Disconnect this consumer from the graph.
|
|
53
|
+
*/
|
|
54
|
+
export declare function consumerDestroy(node: ReactiveNode): void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Create a computed signal which derives a reactive value from an expression.
|
|
58
|
+
*/
|
|
59
|
+
export declare function createComputed<T>(computation: () => T): ComputedGetter<T>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Create a `Signal` that can be set or updated directly.
|
|
63
|
+
*/
|
|
64
|
+
export declare function createSignal<T>(initialValue: T): SignalGetter<T>;
|
|
65
|
+
|
|
66
|
+
export declare function createWatch(fn: (onCleanup: WatchCleanupRegisterFn) => void, schedule: (watch: Watch) => void, allowSignalWrites: boolean): Watch;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The default equality function used for `signal` and `computed`, which uses referential equality.
|
|
70
|
+
*/
|
|
71
|
+
export declare function defaultEquals<T>(a: T, b: T): boolean;
|
|
72
|
+
|
|
73
|
+
export declare function getActiveConsumer(): ReactiveNode | null;
|
|
74
|
+
|
|
75
|
+
export declare function isInNotificationPhase(): boolean;
|
|
76
|
+
|
|
77
|
+
export declare function isReactive(value: unknown): value is Reactive;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Called by implementations when a producer's signal is read.
|
|
81
|
+
*/
|
|
82
|
+
export declare function producerAccessed(node: ReactiveNode): void;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Propagate a dirty notification to live consumers of this producer.
|
|
86
|
+
*/
|
|
87
|
+
export declare function producerNotifyConsumers(node: ReactiveNode): void;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Whether this `ReactiveNode` in its producer capacity is currently allowed to initiate updates,
|
|
91
|
+
* based on the current consumer context.
|
|
92
|
+
*/
|
|
93
|
+
export declare function producerUpdatesAllowed(): boolean;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Ensure this producer's `version` is up-to-date.
|
|
97
|
+
*/
|
|
98
|
+
export declare function producerUpdateValueVersion(node: ReactiveNode): void;
|
|
99
|
+
|
|
100
|
+
export declare interface Reactive {
|
|
101
|
+
[SIGNAL]: ReactiveNode;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export declare const REACTIVE_NODE: ReactiveNode;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* A producer and/or consumer which participates in the reactive graph.
|
|
108
|
+
*
|
|
109
|
+
* Producer `ReactiveNode`s which are accessed when a consumer `ReactiveNode` is the
|
|
110
|
+
* `activeConsumer` are tracked as dependencies of that consumer.
|
|
111
|
+
*
|
|
112
|
+
* Certain consumers are also tracked as "live" consumers and create edges in the other direction,
|
|
113
|
+
* from producer to consumer. These edges are used to propagate change notifications when a
|
|
114
|
+
* producer's value is updated.
|
|
115
|
+
*
|
|
116
|
+
* A `ReactiveNode` may be both a producer and consumer.
|
|
117
|
+
*/
|
|
118
|
+
export declare interface ReactiveNode {
|
|
119
|
+
/**
|
|
120
|
+
* Version of the value that this node produces.
|
|
121
|
+
*
|
|
122
|
+
* This is incremented whenever a new value is produced by this node which is not equal to the
|
|
123
|
+
* previous value (by whatever definition of equality is in use).
|
|
124
|
+
*/
|
|
125
|
+
version: Version;
|
|
126
|
+
/**
|
|
127
|
+
* Whether this node (in its consumer capacity) is dirty.
|
|
128
|
+
*
|
|
129
|
+
* Only live consumers become dirty, when receiving a change notification from a dependency
|
|
130
|
+
* producer.
|
|
131
|
+
*/
|
|
132
|
+
dirty: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Producers which are dependencies of this consumer.
|
|
135
|
+
*
|
|
136
|
+
* Uses the same indices as the `producerLastReadVersion` and `producerIndexOfThis` arrays.
|
|
137
|
+
*/
|
|
138
|
+
producerNode: ReactiveNode[] | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* `Version` of the value last read by a given producer.
|
|
141
|
+
*
|
|
142
|
+
* Uses the same indices as the `producerNode` and `producerIndexOfThis` arrays.
|
|
143
|
+
*/
|
|
144
|
+
producerLastReadVersion: Version[] | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Index of `this` (consumer) in each producer's `liveConsumers` array.
|
|
147
|
+
*
|
|
148
|
+
* This value is only meaningful if this node is live (`liveConsumers.length > 0`). Otherwise
|
|
149
|
+
* these indices are stale.
|
|
150
|
+
*
|
|
151
|
+
* Uses the same indices as the `producerNode` and `producerLastReadVersion` arrays.
|
|
152
|
+
*/
|
|
153
|
+
producerIndexOfThis: number[] | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Index into the producer arrays that the next dependency of this node as a consumer will use.
|
|
156
|
+
*
|
|
157
|
+
* This index is zeroed before this node as a consumer begins executing. When a producer is read,
|
|
158
|
+
* it gets inserted into the producers arrays at this index. There may be an existing dependency
|
|
159
|
+
* in this location which may or may not match the incoming producer, depending on whether the
|
|
160
|
+
* same producers were read in the same order as the last computation.
|
|
161
|
+
*/
|
|
162
|
+
nextProducerIndex: number;
|
|
163
|
+
/**
|
|
164
|
+
* Array of consumers of this producer that are "live" (they require push notifications).
|
|
165
|
+
*
|
|
166
|
+
* `liveConsumerNode.length` is effectively our reference count for this node.
|
|
167
|
+
*/
|
|
168
|
+
liveConsumerNode: ReactiveNode[] | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Index of `this` (producer) in each consumer's `producerNode` array.
|
|
171
|
+
*
|
|
172
|
+
* Uses the same indices as the `liveConsumerNode` array.
|
|
173
|
+
*/
|
|
174
|
+
liveConsumerIndexOfThis: number[] | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* Whether writes to signals are allowed when this consumer is the `activeConsumer`.
|
|
177
|
+
*
|
|
178
|
+
* This is used to enforce guardrails such as preventing writes to writable signals in the
|
|
179
|
+
* computation function of computed signals, which is supposed to be pure.
|
|
180
|
+
*/
|
|
181
|
+
consumerAllowSignalWrites: boolean;
|
|
182
|
+
readonly consumerIsAlwaysLive: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Tracks whether producers need to recompute their value independently of the reactive graph (for
|
|
185
|
+
* example, if no initial value has been computed).
|
|
186
|
+
*/
|
|
187
|
+
producerMustRecompute(node: unknown): boolean;
|
|
188
|
+
producerRecomputeValue(node: unknown): void;
|
|
189
|
+
consumerMarkedDirty(node: unknown): void;
|
|
190
|
+
/**
|
|
191
|
+
* Called when a signal is read within this consumer.
|
|
192
|
+
*/
|
|
193
|
+
consumerOnSignalRead(node: unknown): void;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export declare function setActiveConsumer(consumer: ReactiveNode | null): ReactiveNode | null;
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
export declare function setAlternateWeakRefImpl(impl: unknown): void;
|
|
200
|
+
|
|
201
|
+
export declare function setPostSignalSetFn(fn: (() => void) | null): (() => void) | null;
|
|
202
|
+
|
|
203
|
+
export declare function setThrowInvalidWriteToSignalError(fn: () => never): void;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Symbol used to tell `Signal`s apart from other functions.
|
|
207
|
+
*
|
|
208
|
+
* This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.
|
|
209
|
+
*/
|
|
210
|
+
export declare const SIGNAL: unique symbol;
|
|
211
|
+
|
|
212
|
+
declare type SignalBaseGetter<T> = (() => T) & {
|
|
213
|
+
readonly [SIGNAL]: unknown;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export declare interface SignalGetter<T> extends SignalBaseGetter<T> {
|
|
217
|
+
readonly [SIGNAL]: SignalNode<T>;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export declare function signalMutateFn<T>(node: SignalNode<T>, mutator: (value: T) => void): void;
|
|
221
|
+
|
|
222
|
+
export declare interface SignalNode<T> extends ReactiveNode {
|
|
223
|
+
value: T;
|
|
224
|
+
equal: ValueEqualityFn<T>;
|
|
225
|
+
readonly [SIGNAL]: SignalNode<T>;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export declare function signalSetFn<T>(node: SignalNode<T>, newValue: T): void;
|
|
229
|
+
|
|
230
|
+
export declare function signalUpdateFn<T>(node: SignalNode<T>, updater: (value: T) => T): void;
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* A comparison function which can determine if two values are equal.
|
|
235
|
+
*/
|
|
236
|
+
export declare type ValueEqualityFn<T> = (a: T, b: T) => boolean;
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
declare type Version = number & {
|
|
240
|
+
__brand: 'Version';
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export declare interface Watch {
|
|
244
|
+
notify(): void;
|
|
245
|
+
/**
|
|
246
|
+
* Execute the reactive expression in the context of this `Watch` consumer.
|
|
247
|
+
*
|
|
248
|
+
* Should be called by the user scheduling algorithm when the provided
|
|
249
|
+
* `schedule` hook is called by `Watch`.
|
|
250
|
+
*/
|
|
251
|
+
run(): void;
|
|
252
|
+
cleanup(): void;
|
|
253
|
+
/**
|
|
254
|
+
* Destroy the watcher:
|
|
255
|
+
* - disconnect it from the reactive graph;
|
|
256
|
+
* - mark it as destroyed so subsequent run and notify operations are noop.
|
|
257
|
+
*/
|
|
258
|
+
destroy(): void;
|
|
259
|
+
[SIGNAL]: WatchNode;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* A cleanup function that can be optionally registered from the watch logic. If registered, the
|
|
264
|
+
* cleanup logic runs before the next watch execution.
|
|
265
|
+
*/
|
|
266
|
+
export declare type WatchCleanupFn = () => void;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* A callback passed to the watch function that makes it possible to register cleanup logic.
|
|
270
|
+
*/
|
|
271
|
+
export declare type WatchCleanupRegisterFn = (cleanupFn: WatchCleanupFn) => void;
|
|
272
|
+
|
|
273
|
+
declare interface WatchNode extends ReactiveNode {
|
|
274
|
+
hasRun: boolean;
|
|
275
|
+
fn: ((onCleanup: WatchCleanupRegisterFn) => void) | null;
|
|
276
|
+
schedule: ((watch: Watch) => void) | null;
|
|
277
|
+
cleanupFn: WatchCleanupFn;
|
|
278
|
+
ref: Watch;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export { }
|
package/rxjs-interop/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.0.0-
|
|
2
|
+
* @license Angular v17.0.0-rc.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -50,126 +50,40 @@ export declare interface ToObservableOptions {
|
|
|
50
50
|
injector?: Injector;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
* Get the current value of an `Observable` as a reactive `Signal`.
|
|
55
|
-
*
|
|
56
|
-
* `toSignal` returns a `Signal` which provides synchronous reactive access to values produced
|
|
57
|
-
* by the given `Observable`, by subscribing to that `Observable`. The returned `Signal` will always
|
|
58
|
-
* have the most recent value emitted by the subscription, and will throw an error if the
|
|
59
|
-
* `Observable` errors.
|
|
60
|
-
*
|
|
61
|
-
* Before the `Observable` emits its first value, the `Signal` will return `undefined`. To avoid
|
|
62
|
-
* this, either an `initialValue` can be passed or the `requireSync` option enabled.
|
|
63
|
-
*
|
|
64
|
-
* By default, the subscription will be automatically cleaned up when the current [injection
|
|
65
|
-
* context](guide/dependency-injection-context) is destroyed. For example, when `toObservable` is
|
|
66
|
-
* called during the construction of a component, the subscription will be cleaned up when the
|
|
67
|
-
* component is destroyed. If an [injection context](/guide/dependency-injection-context) is not
|
|
68
|
-
* available, an explicit `Injector` can be passed instead.
|
|
69
|
-
*
|
|
70
|
-
* If the subscription should persist until the `Observable` itself completes, the `manualCleanup`
|
|
71
|
-
* option can be specified instead, which disables the automatic subscription teardown. No injection
|
|
72
|
-
* context is needed in this configuration as well.
|
|
73
|
-
*/
|
|
74
53
|
export declare function toSignal<T>(source: Observable<T> | Subscribable<T>): Signal<T | undefined>;
|
|
75
54
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
* `toSignal` returns a `Signal` which provides synchronous reactive access to values produced
|
|
80
|
-
* by the given `Observable`, by subscribing to that `Observable`. The returned `Signal` will always
|
|
81
|
-
* have the most recent value emitted by the subscription, and will throw an error if the
|
|
82
|
-
* `Observable` errors.
|
|
83
|
-
*
|
|
84
|
-
* Before the `Observable` emits its first value, the `Signal` will return the configured
|
|
85
|
-
* `initialValue`, or `undefined` if no `initialValue` is provided. If the `Observable` is
|
|
86
|
-
* guaranteed to emit synchronously, then the `requireSync` option can be passed instead.
|
|
87
|
-
*
|
|
88
|
-
* By default, the subscription will be automatically cleaned up when the current [injection
|
|
89
|
-
* context](/guide/dependency-injection-context) is destroyed. For example, when `toObservable` is
|
|
90
|
-
* called during the construction of a component, the subscription will be cleaned up when the
|
|
91
|
-
* component is destroyed. If an injection context is not available, an explicit `Injector` can be
|
|
92
|
-
* passed instead.
|
|
93
|
-
*
|
|
94
|
-
* If the subscription should persist until the `Observable` itself completes, the `manualCleanup`
|
|
95
|
-
* option can be specified instead, which disables the automatic subscription teardown. No injection
|
|
96
|
-
* context is needed in this configuration as well.
|
|
97
|
-
*
|
|
98
|
-
* @developerPreview
|
|
99
|
-
*/
|
|
100
|
-
export declare function toSignal<T>(source: Observable<T> | Subscribable<T>, options?: ToSignalOptions<undefined> & {
|
|
55
|
+
export declare function toSignal<T>(source: Observable<T> | Subscribable<T>, options: ToSignalOptions & {
|
|
56
|
+
initialValue?: undefined;
|
|
101
57
|
requireSync?: false;
|
|
102
58
|
}): Signal<T | undefined>;
|
|
103
59
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
*
|
|
107
|
-
* `toSignal` returns a `Signal` which provides synchronous reactive access to values produced
|
|
108
|
-
* by the given `Observable`, by subscribing to that `Observable`. The returned `Signal` will always
|
|
109
|
-
* have the most recent value emitted by the subscription, and will throw an error if the
|
|
110
|
-
* `Observable` errors.
|
|
111
|
-
*
|
|
112
|
-
* Before the `Observable` emits its first value, the `Signal` will return the configured
|
|
113
|
-
* `initialValue`. If the `Observable` is guaranteed to emit synchronously, then the `requireSync`
|
|
114
|
-
* option can be passed instead.
|
|
115
|
-
*
|
|
116
|
-
* By default, the subscription will be automatically cleaned up when the current [injection
|
|
117
|
-
* context](guide/dependency-injection-context) is destroyed. For example, when `toObservable` is
|
|
118
|
-
* called during the construction of a component, the subscription will be cleaned up when the
|
|
119
|
-
* component is destroyed. If an [injection context](/guide/dependency-injection-context) is not
|
|
120
|
-
* available, an explicit `Injector` can be passed instead.
|
|
121
|
-
*
|
|
122
|
-
* If the subscription should persist until the `Observable` itself completes, the `manualCleanup`
|
|
123
|
-
* option can be specified instead, which disables the automatic subscription teardown. No injection
|
|
124
|
-
* context is needed in this configuration as well.
|
|
125
|
-
*
|
|
126
|
-
* @developerPreview
|
|
127
|
-
*/
|
|
128
|
-
export declare function toSignal<T, U extends T | null | undefined>(source: Observable<T> | Subscribable<T>, options: ToSignalOptions<U> & {
|
|
129
|
-
initialValue: U;
|
|
60
|
+
export declare function toSignal<T>(source: Observable<T> | Subscribable<T>, options: ToSignalOptions & {
|
|
61
|
+
initialValue?: null;
|
|
130
62
|
requireSync?: false;
|
|
131
|
-
}): Signal<T |
|
|
63
|
+
}): Signal<T | null>;
|
|
132
64
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
*
|
|
136
|
-
* `toSignal` returns a `Signal` which provides synchronous reactive access to values produced
|
|
137
|
-
* by the given `Observable`, by subscribing to that `Observable`. The returned `Signal` will always
|
|
138
|
-
* have the most recent value emitted by the subscription, and will throw an error if the
|
|
139
|
-
* `Observable` errors.
|
|
140
|
-
*
|
|
141
|
-
* With `requireSync` set to `true`, `toSignal` will assert that the `Observable` produces a value
|
|
142
|
-
* immediately upon subscription. No `initialValue` is needed in this case, and the returned signal
|
|
143
|
-
* does not include an `undefined` type.
|
|
144
|
-
*
|
|
145
|
-
* By default, the subscription will be automatically cleaned up when the current [injection
|
|
146
|
-
* context](/guide/dependency-injection-context) is destroyed. For example, when `toObservable` is
|
|
147
|
-
* called during the construction of a component, the subscription will be cleaned up when the
|
|
148
|
-
* component is destroyed. If an injection context is not available, an explicit `Injector` can be
|
|
149
|
-
* passed instead.
|
|
150
|
-
*
|
|
151
|
-
* If the subscription should persist until the `Observable` itself completes, the `manualCleanup`
|
|
152
|
-
* option can be specified instead, which disables the automatic subscription teardown. No injection
|
|
153
|
-
* context is needed in this configuration as well.
|
|
154
|
-
*
|
|
155
|
-
* @developerPreview
|
|
156
|
-
*/
|
|
157
|
-
export declare function toSignal<T>(source: Observable<T> | Subscribable<T>, options: ToSignalOptions<undefined> & {
|
|
65
|
+
export declare function toSignal<T>(source: Observable<T> | Subscribable<T>, options: ToSignalOptions & {
|
|
66
|
+
initialValue?: undefined;
|
|
158
67
|
requireSync: true;
|
|
159
68
|
}): Signal<T>;
|
|
160
69
|
|
|
70
|
+
export declare function toSignal<T, const U extends T>(source: Observable<T> | Subscribable<T>, options: ToSignalOptions & {
|
|
71
|
+
initialValue: U;
|
|
72
|
+
requireSync?: false;
|
|
73
|
+
}): Signal<T | U>;
|
|
74
|
+
|
|
161
75
|
/**
|
|
162
76
|
* Options for `toSignal`.
|
|
163
77
|
*
|
|
164
78
|
* @publicApi
|
|
165
79
|
*/
|
|
166
|
-
export declare interface ToSignalOptions
|
|
80
|
+
export declare interface ToSignalOptions {
|
|
167
81
|
/**
|
|
168
82
|
* Initial value for the signal produced by `toSignal`.
|
|
169
83
|
*
|
|
170
84
|
* This will be the value of the signal until the observable emits its first value.
|
|
171
85
|
*/
|
|
172
|
-
initialValue?:
|
|
86
|
+
initialValue?: unknown;
|
|
173
87
|
/**
|
|
174
88
|
* Whether to require that the observable emits synchronously when `toSignal` subscribes.
|
|
175
89
|
*
|
|
@@ -4,7 +4,17 @@
|
|
|
4
4
|
"description": "Converts the entire application or a part of it to standalone",
|
|
5
5
|
"factory": "./ng-generate/standalone-migration/bundle",
|
|
6
6
|
"schema": "./ng-generate/standalone-migration/schema.json",
|
|
7
|
-
"aliases": [
|
|
7
|
+
"aliases": [
|
|
8
|
+
"standalone"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"control-flow-migration": {
|
|
12
|
+
"description": "Converts the entire application to block control flow syntax",
|
|
13
|
+
"factory": "./ng-generate/control-flow-migration/bundle",
|
|
14
|
+
"schema": "./ng-generate/control-flow-migration/schema.json",
|
|
15
|
+
"aliases": [
|
|
16
|
+
"control-flow"
|
|
17
|
+
]
|
|
8
18
|
}
|
|
9
19
|
}
|
|
10
|
-
}
|
|
20
|
+
}
|