@angular/core 20.0.0-next.3 → 20.0.0-next.5
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/api.d-mxcXqDpA.d.ts +297 -0
- package/discovery.d-CyYpOJ7j.d.ts +7393 -0
- package/event_dispatcher.d-PWnbqZDx.d.ts +346 -0
- package/fesm2022/attribute-B17mgaqe.mjs +24 -0
- package/fesm2022/attribute-B17mgaqe.mjs.map +1 -0
- package/fesm2022/core.mjs +579 -36730
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/debug_node-xKpCIZm-.mjs +32070 -0
- package/fesm2022/debug_node-xKpCIZm-.mjs.map +1 -0
- package/fesm2022/primitives/di.mjs +2 -2
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +2 -16
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +5 -609
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/resource-BPpYEDic.mjs +621 -0
- package/fesm2022/resource-BPpYEDic.mjs.map +1 -0
- package/fesm2022/root_effect_scheduler-D0_b1cf_.mjs +3816 -0
- package/fesm2022/root_effect_scheduler-D0_b1cf_.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +91 -7
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/signal-DhRAAi7R.mjs +522 -0
- package/fesm2022/signal-DhRAAi7R.mjs.map +1 -0
- package/fesm2022/testing.mjs +105 -103
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/untracked-DaaW3JJm.mjs +117 -0
- package/fesm2022/untracked-DaaW3JJm.mjs.map +1 -0
- package/fesm2022/weak_ref-DrMdAIDh.mjs +1 -1
- package/graph.d-StYigYp1.d.ts +195 -0
- package/index.d.ts +2616 -10854
- package/ng_i18n_closure_mode.d-DLxSUiDr.d.ts +832 -0
- package/package.json +3 -3
- package/primitives/di/index.d.ts +3 -2
- package/primitives/event-dispatch/index.d.ts +5 -340
- package/primitives/signals/index.d.ts +7 -209
- package/rxjs-interop/index.d.ts +16 -4
- package/schematics/bundles/{apply_import_manager-BXQEjo09.js → apply_import_manager-C-ysxahq.js} +3 -3
- package/schematics/bundles/{compiler_host-Bk3repE2.js → change_tracker-0Ktek5Xl.js} +3 -121
- package/schematics/bundles/checker-DqUKCGda.js +17702 -0
- package/schematics/bundles/cleanup-unused-imports.js +6 -5
- package/schematics/bundles/{checker-BHb19MHt.js → compiler-CuoiHqkc.js} +578 -18086
- package/schematics/bundles/compiler_host-CAfDJO3W.js +129 -0
- package/schematics/bundles/control-flow-migration.js +59 -50
- package/schematics/bundles/document-core.js +96 -0
- package/schematics/bundles/imports-CIX-JgAN.js +1 -1
- package/schematics/bundles/{index-BL9kAIe5.js → index-CwFQSYXZ.js} +30 -29
- package/schematics/bundles/{index-I8VbxQcO.js → index-WFXCe5Q0.js} +527 -524
- package/schematics/bundles/inject-flags.js +6 -5
- package/schematics/bundles/inject-migration.js +29 -10
- package/schematics/bundles/leading_space-D9nQ8UQC.js +1 -1
- package/schematics/bundles/{migrate_ts_type_references-KlOTWeDl.js → migrate_ts_type_references-BNuHufqZ.js} +6 -5
- package/schematics/bundles/ng_decorators-DznZ5jMl.js +1 -1
- package/schematics/bundles/nodes-B16H9JUd.js +1 -1
- package/schematics/bundles/output-migration.js +15 -10
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.js +1 -1
- package/schematics/bundles/property_name-BBwFuqMe.js +1 -1
- package/schematics/bundles/route-lazy-loading.js +7 -5
- package/schematics/bundles/{run_in_devkit-C0JPtK2u.js → run_in_devkit-CmHxABFr.js} +4 -3
- package/schematics/bundles/self-closing-tags-migration.js +10 -9
- package/schematics/bundles/signal-input-migration.js +8 -7
- package/schematics/bundles/signal-queries-migration.js +27 -14
- package/schematics/bundles/signals.js +8 -7
- package/schematics/bundles/standalone-migration.js +11 -9
- package/schematics/bundles/symbol-VPWguRxr.js +1 -1
- package/schematics/bundles/test-bed-get.js +5 -4
- package/schematics/collection.json +0 -6
- package/schematics/migrations.json +11 -0
- package/signal.d-BeaTIeOE.d.ts +31 -0
- package/testing/index.d.ts +13 -9
- package/weak_ref.d-ttyj86RV.d.ts +1 -1
- package/navigation_types.d-u4EOrrdZ.d.ts +0 -121
- package/schematics/ng-generate/control-flow-migration/schema.json +0 -20
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Angular v20.0.0-next.5
|
|
3
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
|
+
* License: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { S as SIGNAL, n as producerUpdateValueVersion, z as signalSetFn, l as producerMarkClean, A as signalUpdateFn, p as producerAccessed, E as ERRORED, g as defaultEquals, U as UNSET, R as REACTIVE_NODE, C as COMPUTING, d as consumerBeforeComputation, e as consumerAfterComputation, r as runPostProducerCreatedFn, q as setActiveConsumer } from './signal-DhRAAi7R.mjs';
|
|
8
|
+
|
|
9
|
+
function createLinkedSignal(sourceFn, computationFn, equalityFn) {
|
|
10
|
+
const node = Object.create(LINKED_SIGNAL_NODE);
|
|
11
|
+
node.source = sourceFn;
|
|
12
|
+
node.computation = computationFn;
|
|
13
|
+
if (equalityFn != undefined) {
|
|
14
|
+
node.equal = equalityFn;
|
|
15
|
+
}
|
|
16
|
+
const linkedSignalGetter = () => {
|
|
17
|
+
// Check if the value needs updating before returning it.
|
|
18
|
+
producerUpdateValueVersion(node);
|
|
19
|
+
// Record that someone looked at this signal.
|
|
20
|
+
producerAccessed(node);
|
|
21
|
+
if (node.value === ERRORED) {
|
|
22
|
+
throw node.error;
|
|
23
|
+
}
|
|
24
|
+
return node.value;
|
|
25
|
+
};
|
|
26
|
+
const getter = linkedSignalGetter;
|
|
27
|
+
getter[SIGNAL] = node;
|
|
28
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
29
|
+
const debugName = node.debugName ? ' (' + node.debugName + ')' : '';
|
|
30
|
+
getter.toString = () => `[LinkedSignal${debugName}: ${node.value}]`;
|
|
31
|
+
}
|
|
32
|
+
runPostProducerCreatedFn(node);
|
|
33
|
+
return getter;
|
|
34
|
+
}
|
|
35
|
+
function linkedSignalSetFn(node, newValue) {
|
|
36
|
+
producerUpdateValueVersion(node);
|
|
37
|
+
signalSetFn(node, newValue);
|
|
38
|
+
producerMarkClean(node);
|
|
39
|
+
}
|
|
40
|
+
function linkedSignalUpdateFn(node, updater) {
|
|
41
|
+
producerUpdateValueVersion(node);
|
|
42
|
+
signalUpdateFn(node, updater);
|
|
43
|
+
producerMarkClean(node);
|
|
44
|
+
}
|
|
45
|
+
// Note: Using an IIFE here to ensure that the spread assignment is not considered
|
|
46
|
+
// a side-effect, ending up preserving `LINKED_SIGNAL_NODE` and `REACTIVE_NODE`.
|
|
47
|
+
// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.
|
|
48
|
+
const LINKED_SIGNAL_NODE = /* @__PURE__ */ (() => {
|
|
49
|
+
return {
|
|
50
|
+
...REACTIVE_NODE,
|
|
51
|
+
value: UNSET,
|
|
52
|
+
dirty: true,
|
|
53
|
+
error: null,
|
|
54
|
+
equal: defaultEquals,
|
|
55
|
+
kind: 'linkedSignal',
|
|
56
|
+
producerMustRecompute(node) {
|
|
57
|
+
// Force a recomputation if there's no current value, or if the current value is in the
|
|
58
|
+
// process of being calculated (which should throw an error).
|
|
59
|
+
return node.value === UNSET || node.value === COMPUTING;
|
|
60
|
+
},
|
|
61
|
+
producerRecomputeValue(node) {
|
|
62
|
+
if (node.value === COMPUTING) {
|
|
63
|
+
// Our computation somehow led to a cyclic read of itself.
|
|
64
|
+
throw new Error('Detected cycle in computations.');
|
|
65
|
+
}
|
|
66
|
+
const oldValue = node.value;
|
|
67
|
+
node.value = COMPUTING;
|
|
68
|
+
const prevConsumer = consumerBeforeComputation(node);
|
|
69
|
+
let newValue;
|
|
70
|
+
try {
|
|
71
|
+
const newSourceValue = node.source();
|
|
72
|
+
const prev = oldValue === UNSET || oldValue === ERRORED
|
|
73
|
+
? undefined
|
|
74
|
+
: {
|
|
75
|
+
source: node.sourceValue,
|
|
76
|
+
value: oldValue,
|
|
77
|
+
};
|
|
78
|
+
newValue = node.computation(newSourceValue, prev);
|
|
79
|
+
node.sourceValue = newSourceValue;
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
newValue = ERRORED;
|
|
83
|
+
node.error = err;
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
consumerAfterComputation(node, prevConsumer);
|
|
87
|
+
}
|
|
88
|
+
if (oldValue !== UNSET && newValue !== ERRORED && node.equal(oldValue, newValue)) {
|
|
89
|
+
// No change to `valueVersion` - old and new values are
|
|
90
|
+
// semantically equivalent.
|
|
91
|
+
node.value = oldValue;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
node.value = newValue;
|
|
95
|
+
node.version++;
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
})();
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function
|
|
102
|
+
* can, optionally, return a value.
|
|
103
|
+
*/
|
|
104
|
+
function untracked(nonReactiveReadsFn) {
|
|
105
|
+
const prevConsumer = setActiveConsumer(null);
|
|
106
|
+
// We are not trying to catch any particular errors here, just making sure that the consumers
|
|
107
|
+
// stack is restored in case of errors.
|
|
108
|
+
try {
|
|
109
|
+
return nonReactiveReadsFn();
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
setActiveConsumer(prevConsumer);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export { linkedSignalUpdateFn as a, createLinkedSignal as c, linkedSignalSetFn as l, untracked as u };
|
|
117
|
+
//# sourceMappingURL=untracked-DaaW3JJm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"untracked-DaaW3JJm.mjs","sources":["../../../../../../packages/core/primitives/signals/src/linked_signal.ts","../../../../../../packages/core/primitives/signals/src/untracked.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {COMPUTING, ERRORED, UNSET} from './computed';\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n producerAccessed,\n producerMarkClean,\n producerUpdateValueVersion,\n REACTIVE_NODE,\n ReactiveNode,\n runPostProducerCreatedFn,\n SIGNAL,\n} from './graph';\nimport {signalSetFn, signalUpdateFn} from './signal';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\nexport type ComputationFn<S, D> = (source: S, previous?: {source: S; value: D}) => D;\n\nexport interface LinkedSignalNode<S, D> extends ReactiveNode {\n /**\n * Value of the source signal that was used to derive the computed value.\n */\n sourceValue: S;\n\n /**\n * Current state value, or one of the sentinel values (`UNSET`, `COMPUTING`,\n * `ERROR`).\n */\n value: D;\n\n /**\n * If `value` is `ERRORED`, the error caught from the last computation attempt which will\n * be re-thrown.\n */\n error: unknown;\n\n /**\n * The source function represents reactive dependency based on which the linked state is reset.\n */\n source: () => S;\n\n /**\n * The computation function which will produce a new value based on the source and, optionally - previous values.\n */\n computation: ComputationFn<S, D>;\n\n equal: ValueEqualityFn<D>;\n}\n\nexport type LinkedSignalGetter<S, D> = (() => D) & {\n [SIGNAL]: LinkedSignalNode<S, D>;\n};\n\nexport function createLinkedSignal<S, D>(\n sourceFn: () => S,\n computationFn: ComputationFn<S, D>,\n equalityFn?: ValueEqualityFn<D>,\n): LinkedSignalGetter<S, D> {\n const node: LinkedSignalNode<S, D> = Object.create(LINKED_SIGNAL_NODE);\n\n node.source = sourceFn;\n node.computation = computationFn;\n if (equalityFn != undefined) {\n node.equal = equalityFn;\n }\n\n const linkedSignalGetter = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n\n // Record that someone looked at this signal.\n producerAccessed(node);\n\n if (node.value === ERRORED) {\n throw node.error;\n }\n\n return node.value;\n };\n\n const getter = linkedSignalGetter as LinkedSignalGetter<S, D>;\n getter[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n const debugName = node.debugName ? ' (' + node.debugName + ')' : '';\n getter.toString = () => `[LinkedSignal${debugName}: ${node.value}]`;\n }\n\n runPostProducerCreatedFn(node);\n\n return getter;\n}\n\nexport function linkedSignalSetFn<S, D>(node: LinkedSignalNode<S, D>, newValue: D) {\n producerUpdateValueVersion(node);\n signalSetFn(node, newValue);\n producerMarkClean(node);\n}\n\nexport function linkedSignalUpdateFn<S, D>(\n node: LinkedSignalNode<S, D>,\n updater: (value: D) => D,\n): void {\n producerUpdateValueVersion(node);\n signalUpdateFn(node, updater);\n producerMarkClean(node);\n}\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `LINKED_SIGNAL_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nexport const LINKED_SIGNAL_NODE = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n kind: 'linkedSignal',\n\n producerMustRecompute(node: LinkedSignalNode<unknown, unknown>): boolean {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n\n producerRecomputeValue(node: LinkedSignalNode<unknown, unknown>): void {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error('Detected cycle in computations.');\n }\n\n const oldValue = node.value;\n node.value = COMPUTING;\n\n const prevConsumer = consumerBeforeComputation(node);\n let newValue: unknown;\n try {\n const newSourceValue = node.source();\n const prev =\n oldValue === UNSET || oldValue === ERRORED\n ? undefined\n : {\n source: node.sourceValue,\n value: oldValue,\n };\n newValue = node.computation(newSourceValue, prev);\n node.sourceValue = newSourceValue;\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n\n if (oldValue !== UNSET && newValue !== ERRORED && node.equal(oldValue, newValue)) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n\n node.value = newValue;\n node.version++;\n },\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {setActiveConsumer} from './graph';\n\n/**\n * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function\n * can, optionally, return a value.\n */\nexport function untracked<T>(nonReactiveReadsFn: () => T): T {\n const prevConsumer = setActiveConsumer(null);\n // We are not trying to catch any particular errors here, just making sure that the consumers\n // stack is restored in case of errors.\n try {\n return nonReactiveReadsFn();\n } finally {\n setActiveConsumer(prevConsumer);\n }\n}\n"],"names":[],"mappings":";;;;;;;;SAgEgB,kBAAkB,CAChC,QAAiB,EACjB,aAAkC,EAClC,UAA+B,EAAA;IAE/B,MAAM,IAAI,GAA2B,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC;AAEtE,IAAA,IAAI,CAAC,MAAM,GAAG,QAAQ;AACtB,IAAA,IAAI,CAAC,WAAW,GAAG,aAAa;AAChC,IAAA,IAAI,UAAU,IAAI,SAAS,EAAE;AAC3B,QAAA,IAAI,CAAC,KAAK,GAAG,UAAU;;IAGzB,MAAM,kBAAkB,GAAG,MAAK;;QAE9B,0BAA0B,CAAC,IAAI,CAAC;;QAGhC,gBAAgB,CAAC,IAAI,CAAC;AAEtB,QAAA,IAAI,IAAI,CAAC,KAAK,KAAK,OAAO,EAAE;YAC1B,MAAM,IAAI,CAAC,KAAK;;QAGlB,OAAO,IAAI,CAAC,KAAK;AACnB,KAAC;IAED,MAAM,M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,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Angular v20.0.0-next.5
|
|
3
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
|
+
* License: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A comparison function which can determine if two values are equal.
|
|
9
|
+
*/
|
|
10
|
+
type ValueEqualityFn<T> = (a: T, b: T) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The default equality function used for `signal` and `computed`, which uses referential equality.
|
|
13
|
+
*/
|
|
14
|
+
declare function defaultEquals<T>(a: T, b: T): boolean;
|
|
15
|
+
|
|
16
|
+
type Version = number & {
|
|
17
|
+
__brand: 'Version';
|
|
18
|
+
};
|
|
19
|
+
type ReactiveHookFn = (node: ReactiveNode) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Symbol used to tell `Signal`s apart from other functions.
|
|
22
|
+
*
|
|
23
|
+
* This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.
|
|
24
|
+
*/
|
|
25
|
+
declare const SIGNAL: unique symbol;
|
|
26
|
+
declare function setActiveConsumer(consumer: ReactiveNode | null): ReactiveNode | null;
|
|
27
|
+
declare function getActiveConsumer(): ReactiveNode | null;
|
|
28
|
+
declare function isInNotificationPhase(): boolean;
|
|
29
|
+
interface Reactive {
|
|
30
|
+
[SIGNAL]: ReactiveNode;
|
|
31
|
+
}
|
|
32
|
+
declare function isReactive(value: unknown): value is Reactive;
|
|
33
|
+
declare const REACTIVE_NODE: ReactiveNode;
|
|
34
|
+
/**
|
|
35
|
+
* A producer and/or consumer which participates in the reactive graph.
|
|
36
|
+
*
|
|
37
|
+
* Producer `ReactiveNode`s which are accessed when a consumer `ReactiveNode` is the
|
|
38
|
+
* `activeConsumer` are tracked as dependencies of that consumer.
|
|
39
|
+
*
|
|
40
|
+
* Certain consumers are also tracked as "live" consumers and create edges in the other direction,
|
|
41
|
+
* from producer to consumer. These edges are used to propagate change notifications when a
|
|
42
|
+
* producer's value is updated.
|
|
43
|
+
*
|
|
44
|
+
* A `ReactiveNode` may be both a producer and consumer.
|
|
45
|
+
*/
|
|
46
|
+
interface ReactiveNode {
|
|
47
|
+
/**
|
|
48
|
+
* Version of the value that this node produces.
|
|
49
|
+
*
|
|
50
|
+
* This is incremented whenever a new value is produced by this node which is not equal to the
|
|
51
|
+
* previous value (by whatever definition of equality is in use).
|
|
52
|
+
*/
|
|
53
|
+
version: Version;
|
|
54
|
+
/**
|
|
55
|
+
* Epoch at which this node is verified to be clean.
|
|
56
|
+
*
|
|
57
|
+
* This allows skipping of some polling operations in the case where no signals have been set
|
|
58
|
+
* since this node was last read.
|
|
59
|
+
*/
|
|
60
|
+
lastCleanEpoch: Version;
|
|
61
|
+
/**
|
|
62
|
+
* Whether this node (in its consumer capacity) is dirty.
|
|
63
|
+
*
|
|
64
|
+
* Only live consumers become dirty, when receiving a change notification from a dependency
|
|
65
|
+
* producer.
|
|
66
|
+
*/
|
|
67
|
+
dirty: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Producers which are dependencies of this consumer.
|
|
70
|
+
*
|
|
71
|
+
* Uses the same indices as the `producerLastReadVersion` and `producerIndexOfThis` arrays.
|
|
72
|
+
*/
|
|
73
|
+
producerNode: ReactiveNode[] | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* `Version` of the value last read by a given producer.
|
|
76
|
+
*
|
|
77
|
+
* Uses the same indices as the `producerNode` and `producerIndexOfThis` arrays.
|
|
78
|
+
*/
|
|
79
|
+
producerLastReadVersion: Version[] | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Index of `this` (consumer) in each producer's `liveConsumers` array.
|
|
82
|
+
*
|
|
83
|
+
* This value is only meaningful if this node is live (`liveConsumers.length > 0`). Otherwise
|
|
84
|
+
* these indices are stale.
|
|
85
|
+
*
|
|
86
|
+
* Uses the same indices as the `producerNode` and `producerLastReadVersion` arrays.
|
|
87
|
+
*/
|
|
88
|
+
producerIndexOfThis: number[] | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Index into the producer arrays that the next dependency of this node as a consumer will use.
|
|
91
|
+
*
|
|
92
|
+
* This index is zeroed before this node as a consumer begins executing. When a producer is read,
|
|
93
|
+
* it gets inserted into the producers arrays at this index. There may be an existing dependency
|
|
94
|
+
* in this location which may or may not match the incoming producer, depending on whether the
|
|
95
|
+
* same producers were read in the same order as the last computation.
|
|
96
|
+
*/
|
|
97
|
+
nextProducerIndex: number;
|
|
98
|
+
/**
|
|
99
|
+
* Array of consumers of this producer that are "live" (they require push notifications).
|
|
100
|
+
*
|
|
101
|
+
* `liveConsumerNode.length` is effectively our reference count for this node.
|
|
102
|
+
*/
|
|
103
|
+
liveConsumerNode: ReactiveNode[] | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Index of `this` (producer) in each consumer's `producerNode` array.
|
|
106
|
+
*
|
|
107
|
+
* Uses the same indices as the `liveConsumerNode` array.
|
|
108
|
+
*/
|
|
109
|
+
liveConsumerIndexOfThis: number[] | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Whether writes to signals are allowed when this consumer is the `activeConsumer`.
|
|
112
|
+
*
|
|
113
|
+
* This is used to enforce guardrails such as preventing writes to writable signals in the
|
|
114
|
+
* computation function of computed signals, which is supposed to be pure.
|
|
115
|
+
*/
|
|
116
|
+
consumerAllowSignalWrites: boolean;
|
|
117
|
+
readonly consumerIsAlwaysLive: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Tracks whether producers need to recompute their value independently of the reactive graph (for
|
|
120
|
+
* example, if no initial value has been computed).
|
|
121
|
+
*/
|
|
122
|
+
producerMustRecompute(node: unknown): boolean;
|
|
123
|
+
producerRecomputeValue(node: unknown): void;
|
|
124
|
+
consumerMarkedDirty(node: unknown): void;
|
|
125
|
+
/**
|
|
126
|
+
* Called when a signal is read within this consumer.
|
|
127
|
+
*/
|
|
128
|
+
consumerOnSignalRead(node: unknown): void;
|
|
129
|
+
/**
|
|
130
|
+
* A debug name for the reactive node. Used in Angular DevTools to identify the node.
|
|
131
|
+
*/
|
|
132
|
+
debugName?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Kind of node. Example: 'signal', 'computed', 'input', 'effect'.
|
|
135
|
+
*
|
|
136
|
+
* ReactiveNode has this as 'unknown' by default, but derived node types should override this to
|
|
137
|
+
* make available the kind of signal that particular instance of a ReactiveNode represents.
|
|
138
|
+
*
|
|
139
|
+
* Used in Angular DevTools to identify the kind of signal.
|
|
140
|
+
*/
|
|
141
|
+
kind: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Called by implementations when a producer's signal is read.
|
|
145
|
+
*/
|
|
146
|
+
declare function producerAccessed(node: ReactiveNode): void;
|
|
147
|
+
/**
|
|
148
|
+
* Increment the global epoch counter.
|
|
149
|
+
*
|
|
150
|
+
* Called by source producers (that is, not computeds) whenever their values change.
|
|
151
|
+
*/
|
|
152
|
+
declare function producerIncrementEpoch(): void;
|
|
153
|
+
/**
|
|
154
|
+
* Ensure this producer's `version` is up-to-date.
|
|
155
|
+
*/
|
|
156
|
+
declare function producerUpdateValueVersion(node: ReactiveNode): void;
|
|
157
|
+
/**
|
|
158
|
+
* Propagate a dirty notification to live consumers of this producer.
|
|
159
|
+
*/
|
|
160
|
+
declare function producerNotifyConsumers(node: ReactiveNode): void;
|
|
161
|
+
/**
|
|
162
|
+
* Whether this `ReactiveNode` in its producer capacity is currently allowed to initiate updates,
|
|
163
|
+
* based on the current consumer context.
|
|
164
|
+
*/
|
|
165
|
+
declare function producerUpdatesAllowed(): boolean;
|
|
166
|
+
declare function consumerMarkDirty(node: ReactiveNode): void;
|
|
167
|
+
declare function producerMarkClean(node: ReactiveNode): void;
|
|
168
|
+
/**
|
|
169
|
+
* Prepare this consumer to run a computation in its reactive context.
|
|
170
|
+
*
|
|
171
|
+
* Must be called by subclasses which represent reactive computations, before those computations
|
|
172
|
+
* begin.
|
|
173
|
+
*/
|
|
174
|
+
declare function consumerBeforeComputation(node: ReactiveNode | null): ReactiveNode | null;
|
|
175
|
+
/**
|
|
176
|
+
* Finalize this consumer's state after a reactive computation has run.
|
|
177
|
+
*
|
|
178
|
+
* Must be called by subclasses which represent reactive computations, after those computations
|
|
179
|
+
* have finished.
|
|
180
|
+
*/
|
|
181
|
+
declare function consumerAfterComputation(node: ReactiveNode | null, prevConsumer: ReactiveNode | null): void;
|
|
182
|
+
/**
|
|
183
|
+
* Determine whether this consumer has any dependencies which have changed since the last time
|
|
184
|
+
* they were read.
|
|
185
|
+
*/
|
|
186
|
+
declare function consumerPollProducersForChange(node: ReactiveNode): boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Disconnect this consumer from the graph.
|
|
189
|
+
*/
|
|
190
|
+
declare function consumerDestroy(node: ReactiveNode): void;
|
|
191
|
+
declare function runPostProducerCreatedFn(node: ReactiveNode): void;
|
|
192
|
+
declare function setPostProducerCreatedFn(fn: ReactiveHookFn | null): ReactiveHookFn | null;
|
|
193
|
+
|
|
194
|
+
export { SIGNAL as S, REACTIVE_NODE as b, defaultEquals as d, consumerAfterComputation as e, consumerBeforeComputation as f, consumerDestroy as g, consumerMarkDirty as h, consumerPollProducersForChange as i, getActiveConsumer as j, isInNotificationPhase as k, isReactive as l, producerIncrementEpoch as m, producerMarkClean as n, producerNotifyConsumers as o, producerAccessed as p, producerUpdateValueVersion as q, producerUpdatesAllowed as r, runPostProducerCreatedFn as s, setActiveConsumer as t, setPostProducerCreatedFn as u };
|
|
195
|
+
export type { ReactiveNode as R, ValueEqualityFn as V, ReactiveHookFn as a, Reactive as c };
|