@solidjs/signals 2.0.0-rc.11 → 2.0.0-rc.14
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/dist/dev-shared.js +2056 -3773
- package/dist/dev.attribution.js +159 -91
- package/dist/dev.js +7263 -8384
- package/dist/observe/affects.js +125 -104
- package/dist/observe/boundaries.js +458 -665
- package/dist/observe/core/action.js +63 -66
- package/dist/observe/core/async.js +240 -383
- package/dist/observe/core/attribution-queries.js +1 -1
- package/dist/observe/core/attribution.js +271 -199
- package/dist/observe/core/constants.js +115 -178
- package/dist/observe/core/context.js +3 -3
- package/dist/observe/core/core.js +840 -1428
- package/dist/observe/core/dev.js +41 -18
- package/dist/observe/core/effect.js +75 -86
- package/dist/observe/core/external.js +5 -5
- package/dist/observe/core/graph.js +61 -70
- package/dist/observe/core/heap.js +75 -98
- package/dist/observe/core/invariants.js +1 -34
- package/dist/observe/core/lanes.js +704 -181
- package/dist/observe/core/owner.js +80 -101
- package/dist/observe/core/scheduler.js +708 -1351
- package/dist/observe/core/verdict.js +302 -621
- package/dist/observe/flatten.js +79 -0
- package/dist/observe/index.js +15 -13
- package/dist/observe/map.js +232 -235
- package/dist/observe/reveal.js +212 -0
- package/dist/observe/signals.js +133 -215
- package/dist/observe/store/affects.js +135 -0
- package/dist/observe/store/index.js +29 -24
- package/dist/observe/store/optimistic.js +538 -0
- package/dist/observe/store/projection.js +302 -0
- package/dist/observe/store/reconcile.js +257 -0
- package/dist/observe/store/store.js +1945 -277
- package/dist/observe/store/storePath.js +1 -1
- package/dist/{prod/store/next → observe/store}/target.js +17 -18
- package/dist/observe/store/types.js +73 -0
- package/dist/observe/store/utils.js +1 -13
- package/dist/prod/affects.js +127 -106
- package/dist/prod/boundaries.js +442 -654
- package/dist/prod/core/action.js +71 -74
- package/dist/prod/core/async.js +307 -442
- package/dist/prod/core/constants.js +112 -177
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +852 -1448
- package/dist/prod/core/effect.js +88 -99
- package/dist/prod/core/external.js +5 -5
- package/dist/prod/core/graph.js +61 -70
- package/dist/prod/core/heap.js +75 -98
- package/dist/prod/core/invariants.js +1 -32
- package/dist/prod/core/lanes.js +666 -181
- package/dist/prod/core/owner.js +75 -96
- package/dist/prod/core/scheduler.js +677 -1332
- package/dist/prod/core/verdict.js +297 -621
- package/dist/prod/flatten.js +77 -0
- package/dist/prod/index.js +15 -13
- package/dist/prod/map.js +143 -146
- package/dist/prod/reveal.js +212 -0
- package/dist/prod/signals.js +144 -226
- package/dist/prod/store/affects.js +135 -0
- package/dist/prod/store/index.js +28 -19
- package/dist/prod/store/optimistic.js +533 -0
- package/dist/prod/store/projection.js +295 -0
- package/dist/prod/store/reconcile.js +257 -0
- package/dist/prod/store/store.js +1840 -272
- package/dist/prod/store/storePath.js +1 -1
- package/dist/{observe/store/next → prod/store}/target.js +13 -17
- package/dist/prod/store/types.js +73 -0
- package/dist/prod/store/utils.js +1 -11
- package/dist/types/affects.d.ts +11 -30
- package/dist/types/boundaries.d.ts +62 -176
- package/dist/types/carved.d.ts +1 -0
- package/dist/types/core/action.d.ts +5 -6
- package/dist/types/core/async.d.ts +10 -5
- package/dist/types/core/attribution-hooks.d.ts +48 -1
- package/dist/types/core/attribution.d.ts +29 -9
- package/dist/types/core/constants.d.ts +125 -171
- package/dist/types/core/core.d.ts +104 -264
- package/dist/types/core/dev.d.ts +60 -7
- package/dist/types/core/effect.d.ts +0 -7
- package/dist/types/core/graph.d.ts +7 -1
- package/dist/types/core/heap.d.ts +5 -7
- package/dist/types/core/index.d.ts +6 -6
- package/dist/types/core/invariants.d.ts +0 -29
- package/dist/types/core/lanes.d.ts +65 -87
- package/dist/types/core/owner.d.ts +3 -3
- package/dist/types/core/scheduler.d.ts +249 -331
- package/dist/types/core/types.d.ts +51 -85
- package/dist/types/core/verdict.d.ts +3 -0
- package/dist/types/flatten.d.ts +8 -0
- package/dist/types/index.d.ts +7 -5
- package/dist/types/reveal.d.ts +19 -0
- package/dist/types/signals.d.ts +53 -92
- package/dist/types/store/affects.d.ts +1 -0
- package/dist/types/store/index.d.ts +35 -15
- package/dist/types/store/optimistic.d.ts +23 -0
- package/dist/types/store/projection.d.ts +18 -0
- package/dist/types/store/reconcile.d.ts +3 -0
- package/dist/types/store/store.d.ts +165 -143
- package/dist/types/store/storePath.d.ts +1 -1
- package/dist/types/store/target.d.ts +151 -0
- package/dist/types/store/types.d.ts +84 -0
- package/package.json +1 -1
- package/dist/observe/core/optimistic.js +0 -669
- package/dist/observe/store/next/optimistic.js +0 -717
- package/dist/observe/store/next/projection.js +0 -266
- package/dist/observe/store/next/reconcile.js +0 -375
- package/dist/observe/store/next/store.js +0 -2480
- package/dist/prod/core/optimistic.js +0 -658
- package/dist/prod/store/next/optimistic.js +0 -710
- package/dist/prod/store/next/projection.js +0 -257
- package/dist/prod/store/next/reconcile.js +0 -373
- package/dist/prod/store/next/store.js +0 -2356
- package/dist/types/core/optimistic.d.ts +0 -6
- package/dist/types/store/next/optimistic.d.ts +0 -25
- package/dist/types/store/next/projection.d.ts +0 -27
- package/dist/types/store/next/reconcile.d.ts +0 -10
- package/dist/types/store/next/store.d.ts +0 -143
- package/dist/types/store/next/target.d.ts +0 -196
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Transition } from "./scheduler.js";
|
|
3
|
-
import type { Computed, FirewallSignal, NodeExtension, NodeOptions, Owner, Signal } from "./types.js";
|
|
1
|
+
import type { Computed, NodeExtension, NodeOptions, Owner, Signal } from "./types.js";
|
|
4
2
|
export declare const PRIMITIVE_IN_FORBIDDEN_SCOPE_MESSAGE = "[PRIMITIVE_IN_FORBIDDEN_SCOPE] Cannot create reactive primitives inside createTrackedEffect or owner-backed onSettled";
|
|
3
|
+
export declare const PRIMITIVE_IN_EFFECT_CALLBACK_MESSAGE: string;
|
|
4
|
+
/** Dev: the effect phase (render and user effects, their cleanups) runs with
|
|
5
|
+
* no ambient owner, and a computation created there with none is outside
|
|
6
|
+
* every owner and every hold (maintainer, 2026-10-01: ownerless only —
|
|
7
|
+
* `runWithOwner` in a callback is deliberate, Portal and createReaction do
|
|
8
|
+
* it; a bare createRoot is the mistake). Computeds and roots; a signal
|
|
9
|
+
* created there is inert and harmless. Tracked effects and onSettled are
|
|
10
|
+
* children-forbidden and refuse through PRIMITIVE_IN_FORBIDDEN_SCOPE. */
|
|
11
|
+
export declare function assertNotInEffectCallback(): void;
|
|
5
12
|
export declare const REACTIVE_WRITE_IN_OWNED_SCOPE_SIGNAL_MESSAGE: string;
|
|
6
13
|
export declare const REACTIVE_WRITE_IN_OWNED_SCOPE_REFRESH_MESSAGE: string;
|
|
7
|
-
export declare const ASYNC_STORE_SETTER_MESSAGE: string;
|
|
8
14
|
export declare let tracking: boolean;
|
|
9
15
|
/** @internal verdict-module glue */
|
|
10
|
-
export declare function setPendingCheckActive(v: boolean): void;
|
|
11
|
-
/** @internal verdict-module glue */
|
|
12
|
-
export declare function setLatestReadActive(v: boolean): void;
|
|
13
|
-
/** @internal verdict-module glue */
|
|
14
16
|
export declare function setContextInternal(v: Owner | null): void;
|
|
15
17
|
export declare let stale: boolean;
|
|
16
|
-
export declare let pendingCheckActive: boolean;
|
|
17
|
-
export declare let latestReadActive: boolean;
|
|
18
18
|
export declare let context: Owner | null;
|
|
19
|
-
export declare let currentOptimisticLane: OptimisticLane | null;
|
|
20
|
-
/** Notify `node`'s subscribers on `lane`'s channel: they recompute as the
|
|
21
|
-
* lane's passes — a memo publishes a derived override (lanes stage, #3479),
|
|
22
|
-
* an effect runs from the lane's queue, at the park, ahead of the
|
|
23
|
-
* transaction — the display-ahead view. The write itself is already staged
|
|
24
|
-
* (setSignal) and commits with the frame; this walk shows it now. Used by a
|
|
25
|
-
* boundary re-armed from a lane pass (boundaries.ts `_swap`, #3540). */
|
|
26
|
-
export declare function notifyOnLane(node: Signal<any>, lane: OptimisticLane): void;
|
|
27
19
|
export declare let snapshotCaptureActive: boolean;
|
|
28
20
|
export declare let snapshotSources: Set<any> | null;
|
|
29
21
|
export declare function setSnapshotCapture(active: boolean): void;
|
|
@@ -50,41 +42,39 @@ export declare function createEffectNode<T>(fn: (prev?: T) => T, effectFn: (val:
|
|
|
50
42
|
/**
|
|
51
43
|
* The shared status notifier for effect nodes, installed once by effect.ts
|
|
52
44
|
* at module evaluation (`this`-dispatched — one function serves every
|
|
53
|
-
* effect, so nodes never store it).
|
|
54
|
-
*
|
|
45
|
+
* effect, so nodes never store it). CARVE 4: the boundaries' per-node
|
|
46
|
+
* channel (`_x._notifyStatus`) went with them; effects are the only
|
|
47
|
+
* display consumers.
|
|
55
48
|
*/
|
|
56
49
|
export declare let effectStatusNotify: ((this: any, status?: number, error?: any) => void) | null;
|
|
57
50
|
export declare function setEffectStatusNotify(fn: NonNullable<typeof effectStatusNotify>): void;
|
|
58
|
-
/** Resolve a node's status notifier:
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* per-node field did when every effect carried one. */
|
|
51
|
+
/** Resolve a node's status notifier: effect nodes (`_type` — EFFECT_PURE is
|
|
52
|
+
* 0, and only effect literals carry the field) get the shared notifier.
|
|
53
|
+
* Presence doubles as the "display consumer" membership test in the status
|
|
54
|
+
* walks, exactly as the per-node field did when every effect carried one. */
|
|
63
55
|
export declare function statusNotifierOf(el: any): ((this: any, status?: number, error?: any) => void) | undefined;
|
|
64
56
|
export declare function signal<T>(v: T, options?: NodeOptions<T>): Signal<T>;
|
|
65
|
-
export declare function signal<T>(v: T, options?: NodeOptions<T>, firewall?: Computed<any>): FirewallSignal<T>;
|
|
66
|
-
/** The shared slot-node unobserved handler — a live binding read directly by
|
|
67
|
-
* the sweep sites (no wrapper frame, no null check: a CONFIG_SLOT_NODE node
|
|
68
|
-
* existing implies the store module loaded and registered the hook). */
|
|
69
|
-
export declare let slotUnobservedHook: (node: Signal<any>) => void;
|
|
70
|
-
/** Install the shared slot-node unobserved handler (store module, once). */
|
|
71
|
-
export declare function setSlotUnobserved(fn: (node: Signal<any>) => void): void;
|
|
72
|
-
/** Release a firewall child the store no longer addresses (unobserved sweep
|
|
73
|
-
* dropped it from its target's cache): unlink it from the chain so the
|
|
74
|
-
* projection stops retaining it and its last value. The node keeps its own
|
|
75
|
-
* `_nextChild` so a walk that is mid-chain on it still terminates. It also
|
|
76
|
-
* leaves `_companionChildren` (#3503): the companions themselves are
|
|
77
|
-
* permanent on the node, but the node is unreachable through the store, so
|
|
78
|
-
* the set would only retain it and its last value. */
|
|
79
|
-
export declare function unlinkFirewallChild(node: Signal<any>): void;
|
|
80
|
-
export declare function slotSignal<T>(v: T, equals: (a: T, b: T) => boolean, host: object, key: PropertyKey, acc: boolean, firewall?: Computed<unknown> | null): Signal<T>;
|
|
81
|
-
export declare function optimisticSignal<T>(v: T, options?: NodeOptions<T>): Signal<T>;
|
|
82
|
-
export declare function optimisticComputed<T>(fn: (prev?: T) => T | PromiseLike<T> | AsyncIterable<T>, options?: NodeOptions<T>): Computed<T>;
|
|
83
57
|
export declare function isEqual<T>(a: T, b: T): boolean;
|
|
58
|
+
/** A store slot node (CONFIG_SLOT_NODE): the whole node in ONE literal — the
|
|
59
|
+
* target and key as back-refs in place of closures (`equals` is a method
|
|
60
|
+
* call, `this` the node; the unobserved sweep dispatches to one shared hook,
|
|
61
|
+
* graph.ts), the store's wrap cache (`px`/`pxv`: the proxy last served for
|
|
62
|
+
* this key and the raw it wrapped — one pointer compare replaces a WeakMap
|
|
63
|
+
* lookup per read) and the accessor verdict (`acc`) pre-shaped. No options
|
|
64
|
+
* object, no NodeExtension, no post-construction expandos. `ownedWrite` is
|
|
65
|
+
* baked in: the setter carries the owned-scope guard; node-level writes are
|
|
66
|
+
* the store's notification machinery. The observe literal adds the label
|
|
67
|
+
* slot (the store relabels it `store.<key>` when the engine is installed). */
|
|
68
|
+
export declare function slotSignal<T>(v: T, equals: (a: T, b: T) => boolean, host: object, key: PropertyKey, acc: boolean): Signal<T>;
|
|
84
69
|
/**
|
|
85
70
|
* When set to a component name string, any reactive read that is not inside a nested tracking
|
|
86
71
|
* scope will log a dev-mode warning. Managed automatically by `untrack(fn, strictReadLabel)`.
|
|
87
72
|
*/
|
|
73
|
+
/** The verdict windows' read (verdict.ts), installed while a `latest` or
|
|
74
|
+
* `isPending` window is open and null otherwise: `read` dispatches to it
|
|
75
|
+
* then, and a program that never imports them never has one. */
|
|
76
|
+
export declare let verdict: ((el: Signal<any> | Computed<any>, c: Computed<any> | null) => unknown) | null;
|
|
77
|
+
export declare function setVerdict(fn: typeof verdict): void;
|
|
88
78
|
export declare let strictRead: string | false;
|
|
89
79
|
/** Dev-only: explicit untrack() nesting, so deliberate post-await reads stay quiet. */
|
|
90
80
|
export declare let untrackDepth: number;
|
|
@@ -154,249 +144,99 @@ export declare let spectating: boolean;
|
|
|
154
144
|
export declare function spectate<T>(fn: () => T): T;
|
|
155
145
|
/**
|
|
156
146
|
* Bring a computed to a readable state: lazy/disposed nodes are (re)computed;
|
|
157
|
-
*
|
|
158
|
-
*
|
|
147
|
+
* `refresh` additionally pulls the node fully up to date so its status flags
|
|
148
|
+
* reflect the current graph.
|
|
159
149
|
*/
|
|
160
150
|
export declare function prepareComputed(comp: Computed<unknown>, refresh: boolean): void;
|
|
161
151
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
|
|
165
|
-
export declare const READ_SLOW: unique symbol;
|
|
166
|
-
/**
|
|
167
|
-
* read()'s plain-signal fast path as a standalone entry for hot callers
|
|
168
|
-
* (store traps). Safe to substitute for read() only because the bail
|
|
169
|
-
* conditions mirror read()'s prelude and fast-path guard exactly: the
|
|
170
|
-
* latestRead and pendingCheck windows run side-effectful hooks before the
|
|
171
|
-
* fast path, `_fn` nodes need prepareComputed, and firewall / override /
|
|
172
|
-
* snapshot / transition / lane / dev-strictRead state all take the full
|
|
173
|
-
* resolution. Anything slow returns READ_SLOW; the caller then calls read().
|
|
174
|
-
*/
|
|
175
|
-
/**
|
|
176
|
-
* Wake only authoritative-view readers (until() predicates) subscribed to `el`.
|
|
177
|
-
* The A17-silent ack paths — an authoritative arrival equal to the active
|
|
178
|
-
* override — use this so the predicate re-evaluates without re-firing
|
|
179
|
-
* ordinary subscribers whose visible (override) value did not change.
|
|
180
|
-
* Pay-for-use: reached through GlobalQueue._notifyAuthoritativeObservers,
|
|
181
|
-
* installed at first until() call — apps that never use until() shake it.
|
|
182
|
-
*/
|
|
183
|
-
export declare function notifyAuthoritativeObservers(el: Signal<any> | Computed<any>): void;
|
|
184
|
-
/** Installs the authoritative-reader wakeup hook. Idempotent; called by every
|
|
185
|
-
* creator of a CONFIG_AUTHORITATIVE_READ computation — until() and refresh() —
|
|
186
|
-
* before its first read (same late-binding contract as the optimistic engine;
|
|
187
|
-
* the gating bit is only ever set by such a read, so the `!` call sites are
|
|
188
|
-
* safe once every setter installs, #3303). */
|
|
189
|
-
export declare function installAuthoritativeRead(): void;
|
|
190
|
-
/**
|
|
191
|
-
* Stale-reader term of the value selections below: a render effect reading a
|
|
192
|
-
* node some OTHER live transaction has staged sees the committed value. The
|
|
193
|
-
* commit is silent — the staging walk was the notification — so a reader
|
|
194
|
-
* that linked AFTER that walk (an effect created during the hold, a store
|
|
195
|
-
* key first read under it) would show the old value past the reveal: record
|
|
196
|
-
* it for the transaction's commit replay (the `_gatedSubs` contract lanes
|
|
197
|
-
* already use). An effect the transaction itself computed re-derives at its
|
|
198
|
-
* commit on its own (parked run, or the contested re-derive, #3322) and is
|
|
199
|
-
* not recorded — replaying it too would publish the frame twice.
|
|
200
|
-
*
|
|
201
|
-
* Flight twin (the pending-branch carve-out): the reader is served the
|
|
202
|
-
* node's committed, pre-flight value and now observes that flight — A15:
|
|
203
|
-
* async work observed by a reader settles as one unit with the writes that
|
|
204
|
-
* asked it — so it joins the transaction's reporters for the node. The
|
|
205
|
-
* reporter the transaction recorded when the flight started may be gone (a
|
|
206
|
-
* keyed remount disposed it, #3374); a completion check that found no live
|
|
207
|
-
* reporter committed the writes ahead of the answer, tearing the new
|
|
208
|
-
* reader's frame (`Count: 1` beside `Details: 0`). Joins an entry the
|
|
209
|
-
* transaction already holds; a flight nobody had observed yet has none (the
|
|
210
|
-
* reader is its first observer — a conditional that just revealed it, #3458)
|
|
211
|
-
* and is notified up the reader's own queue chain under that transaction,
|
|
212
|
-
* the one sanctioned registration site (INV-3): a collecting boundary above
|
|
213
|
-
* the reader consumes it as it would any pending, an unboundaried reader
|
|
214
|
-
* opens the entry — and the transaction, judged complete on its other
|
|
215
|
-
* flights, revealed the inputs beside the reader's pre-flight value
|
|
216
|
-
* otherwise (`Count: 1 | A: 1` beside `B: 0`). A staged signal or a settled
|
|
217
|
-
* node registers nothing. Every reporter dies with its reader
|
|
218
|
-
* (reporterBlocksSource: the read linked it as a dep). The node's own entry
|
|
219
|
-
* is the only one that can matter: a chain's intermediate memo is re-pulled
|
|
220
|
-
* by the read (updateIfNecessary's retry) and enters the transaction, so the
|
|
221
|
-
* reader holds through the normal path; a node with its own flight that is
|
|
222
|
-
* also pending on an upstream re-ask blocks through that flight until it
|
|
223
|
-
* lands, and its landing re-runs the reader into the normal path.
|
|
224
|
-
*/
|
|
225
|
-
/** The replay half of the stale-of-foreign clause (A15 / A26): a stale reader
|
|
226
|
-
* served the committed value because `txn` holds what it read re-runs at
|
|
227
|
-
* txn's commit, when the value it was denied becomes the frame — unless its
|
|
228
|
-
* own last value already came from that transaction. One registration for
|
|
229
|
-
* the node path (heldFromStale) and the store's backing paths, which have
|
|
230
|
-
* no node to carry the hold (heldFromReader, the adoption hold view). */
|
|
231
|
-
export declare function recordStaleReplay(txn: Transition, c: Computed<any>): void;
|
|
232
|
-
/**
|
|
233
|
-
* The ownership relation (DESIGN-CONSOLIDATION §6, ruled 2026-09-17): is
|
|
234
|
-
* `hold` part of the running pass's world? A plain reader's world is the
|
|
235
|
-
* transaction it runs under, through merges. A lane reader's world is its
|
|
236
|
-
* lane AND the transition that owns the lane — the one asymmetry between a
|
|
237
|
-
* lane and a separate transaction (a lane sees what lands from its parent as
|
|
238
|
-
* its own; a separate transaction would wait for the parent to settle) —
|
|
239
|
-
* see `ownsLane` in lanes.ts, built on this. One relation for the
|
|
240
|
-
* stale-of-foreign clause (heldFromStale), the lane arm (readsHeldCommitted)
|
|
241
|
-
* and the store's backing holds (foreignHold); `serve` has no lane arm of
|
|
242
|
-
* its own, the lane's extra visibility lives here.
|
|
243
|
-
*/
|
|
244
|
-
export declare function ownsHold(hold: Transition): boolean;
|
|
245
|
-
export declare function enterStagedRead(el: Signal<any> | Computed<any> | null, t?: Transition | null | undefined): void;
|
|
246
|
-
/**
|
|
247
|
-
* Rule 1 (value selection), the full arm: does this reader see a STAGED
|
|
248
|
-
* node's COMMITTED value? One implementation of the rule the fast paths
|
|
249
|
-
* (readNodeFast, read's fast block) carry as their trivial ternary and that
|
|
250
|
-
* every slow site — read's tail, the store's backing selection, the lane and
|
|
251
|
-
* verdict arms — used to restate by hand (docs/DESIGN-CONSOLIDATION.md, move 3b). In order:
|
|
152
|
+
* Rule 1 (value selection): does this reader see a STAGED node's COMMITTED
|
|
153
|
+
* value? One implementation of the rule the fast paths (read's fast block)
|
|
154
|
+
* carry as their trivial ternary. In order:
|
|
252
155
|
* - no reader at all (an untracked read) — the committed frame;
|
|
253
|
-
* - a reader under an optimistic lane the engine says reads committed
|
|
254
|
-
* (laneReadsCommitted: another lane's hold, #3460);
|
|
255
156
|
* - nothing staged;
|
|
256
157
|
* - a children-forbidden reader (createTrackedEffect / onSettled: the frame,
|
|
257
|
-
* never the graph — A32)
|
|
258
|
-
*
|
|
259
|
-
* committed, no entanglement (heldFromStale registers the replay; a node
|
|
260
|
-
* born held has no committed frame to fall back to, `noCommitted`);
|
|
261
|
-
* - HELD truth (#3164, CONFIG_HELD_TRUTH) read by a LANE pass: staged
|
|
262
|
-
* confirming truth — fold-staged onto an armed family, or entangle-stolen
|
|
263
|
-
* by an awaited until() — is masked from lane passes only, owning
|
|
264
|
-
* transaction or not. A lane applies its frame display-ahead at the park,
|
|
265
|
-
* so a lane pass served the truth would paint the confirmation beside the
|
|
266
|
-
* optimism it confirms (`saving=true` beside the saved row — the #3164
|
|
267
|
-
* tear); it keeps committed and is re-run by the reveal's post-revert
|
|
268
|
-
* wake. Every other deriving reader falls through to A29 below: the truth
|
|
269
|
-
* is a staged value like any other, and the pass that derives from it is
|
|
270
|
-
* held with it — including the retaining transaction's own passes, which
|
|
271
|
-
* a superseded override already hands the truth (#3568: masking them
|
|
272
|
-
* composed the landed `length` with rows still masked to committed).
|
|
273
|
-
* latest() and authoritative readers (until()'s predicate) tunnel
|
|
274
|
-
* through — the tunnel that keeps the hold deadlock-free.
|
|
275
|
-
* False means the reader derives from the staged value and enters its
|
|
276
|
-
* transaction (enterStagedRead, A29).
|
|
158
|
+
* never the graph — A32).
|
|
159
|
+
* False means the reader derives from the staged value.
|
|
277
160
|
*/
|
|
278
|
-
export declare function readerSeesCommitted(el: Signal<any> | Computed<any>, c: Computed<any> | null
|
|
279
|
-
/** A28 — set when a node is staged (queuePendingNode)
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
161
|
+
export declare function readerSeesCommitted(el: Signal<any> | Computed<any>, c: Computed<any> | null): boolean;
|
|
162
|
+
/** A28 — set when a node is staged (queuePendingNode) OUTSIDE a flush;
|
|
163
|
+
* cleared when the next flush begins. The read sites test this one module
|
|
164
|
+
* boolean instead of `globalQueue._running`: inside a flush it is false and
|
|
165
|
+
* the A28 arm costs nothing; outside, only a tick with unflushed writes pays
|
|
166
|
+
* the staged-node check. */
|
|
284
167
|
export declare let unflushedStaged: boolean;
|
|
285
168
|
export declare function markUnflushedStaged(): void;
|
|
286
|
-
/** A28 — a write becomes visible at flush. Outside a flush, a node holding
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
|
|
299
|
-
* signal, the latest() shadow: the system's own writes, made at the source's
|
|
300
|
-
* write to mirror it, installing eagerly — A28, A8). */
|
|
301
|
-
export declare function unflushedValue(el: Signal<any> | Computed<any>, committed?: any): unknown;
|
|
302
|
-
/** A28 (5): an optimistic write becomes the ACTIVE override at the flush that
|
|
303
|
-
* carries it. `_overrideTime` is stamped with `clock` at the write and `clock`
|
|
304
|
-
* advances after every flush, so "this tick, outside a flush" is unflushed. */
|
|
305
|
-
export declare function unflushedOverride(el: Signal<any> | Computed<any>): boolean;
|
|
306
|
-
/** Active optimistic override on an armed node (an armed slot idles at
|
|
307
|
-
* NOT_PENDING; undefined = unarmed plain node). The writer's own channels —
|
|
308
|
-
* the draft, `in`/keys inside the setter — compose on this regardless of
|
|
309
|
-
* flush state. */
|
|
310
|
-
export declare function hasActiveOverride(el: Signal<any> | Computed<any>): boolean;
|
|
311
|
-
/** The override a READER sees: installed, and carried by a flush (A28 (5) —
|
|
312
|
-
* an optimistic write is a write; until its flush no reader sees it). One
|
|
313
|
-
* implementation for read()'s override arm, the verdict channels
|
|
314
|
-
* (latestRead, computePendingState) and the store's selection
|
|
315
|
-
* (docs/DESIGN-CONSOLIDATION.md, move 3b). */
|
|
316
|
-
export declare function visibleOverride(el: Signal<any> | Computed<any>): boolean;
|
|
169
|
+
/** A28 — a write becomes visible at flush. Outside a flush, a node holding a
|
|
170
|
+
* staged value was written since the last flush: staging commits at flush
|
|
171
|
+
* end, so nothing else leaves a node in this state. Inside a flush the rule
|
|
172
|
+
* does not apply (A28 (4): promoted within the round). The value an
|
|
173
|
+
* unflushed node serves is its committed value, or NOT_PENDING when nothing
|
|
174
|
+
* is unflushed. Exempt: promoted writes (A28 (4): a write issued inside a
|
|
175
|
+
* recompute is promoted at that recompute's end — boundary and loading
|
|
176
|
+
* machinery, signals declared for in-computation writes). */
|
|
177
|
+
export declare function unflushedValue(el: Signal<any> | Computed<any>): unknown;
|
|
178
|
+
/** A28: a held node rewritten outside a flush keeps the staging the last
|
|
179
|
+
* flush left (`_flushed`) until the flush that carries the rewrite — the
|
|
180
|
+
* stash is stamped with the clock, which that flush advances. */
|
|
181
|
+
export declare function stashFlushed(el: Signal<any> | Computed<any>): void;
|
|
317
182
|
/** A derivation served the committed value because of an unflushed write
|
|
318
183
|
* (A28) must run again in the flush that carries it — the late-linker case
|
|
319
184
|
* (#3337's reason to defer the walk): it linked after the write walked. */
|
|
320
185
|
export declare function markLateLinker(c: Computed<any>): true;
|
|
321
|
-
/** Companion-bearing nodes written outside a flush (setSignal); the flush
|
|
322
|
-
* that carries their writes re-syncs their companions (A28). */
|
|
323
|
-
export declare const unflushedCompanions: Array<Signal<any> | Computed<any>>;
|
|
324
186
|
export declare function resyncUnflushedCompanions(): void;
|
|
325
|
-
|
|
187
|
+
/** A tracked read's pull of a computed: bring it current when the flush has
|
|
188
|
+
* reached its height (or the reader is a fresh-pull waiter), and sit the
|
|
189
|
+
* reader above it. */
|
|
190
|
+
export declare function pullComputed(owner: Computed<any>, c: Computed<any>): void;
|
|
326
191
|
export declare function read<T>(el: Signal<T> | Computed<T>): T;
|
|
327
192
|
/**
|
|
328
193
|
* Rule 1, the one slow implementation (DESIGN-CONSOLIDATION move 3b, step
|
|
329
194
|
* 6c): the value a reader `c` (null = untracked, no pass) is served from
|
|
330
|
-
* `el
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
* served for one). Called by read()'s slow tail and by the store's untracked
|
|
334
|
-
* node path (nodeValue); the fast paths (readNodeFast, read's fast block)
|
|
335
|
-
* keep their trivial ternary by design (perf, see the doc). Arms, in order:
|
|
336
|
-
* - the override (A17), routed through the engine for a tracked reader under
|
|
337
|
-
* a lane or a supersession (A18), an authoritative reader marked instead;
|
|
338
|
-
* - the lane entanglement gate (committed, recorded for replay);
|
|
339
|
-
* - a node born held has nothing for an untracked reader (A19 exception 1);
|
|
195
|
+
* `el`. Called by read()'s slow tail; the fast path (read's fast block) keeps
|
|
196
|
+
* its trivial ternary by design (perf, see the doc). Arms, in order:
|
|
197
|
+
* - a node born staged has nothing for an untracked reader (A19 exception 1);
|
|
340
198
|
* - an unflushed write serves committed and re-runs the reader in the
|
|
341
199
|
* carrying flush (A28);
|
|
342
|
-
* - readerSeesCommitted, else the staged value
|
|
343
|
-
*/
|
|
344
|
-
export declare function serve(el: Signal<any> | Computed<any>, c: Computed<any> | null, owner: Signal<any> | Computed<any>, committed: unknown): unknown;
|
|
345
|
-
/**
|
|
346
|
-
* Store-rewrite setter guard: the rewrite parks writes in a pending backing
|
|
347
|
-
* (no setSignal at write time), so the owned-scope write protection must
|
|
348
|
-
* fire at the setter entry instead. Exactly setSignal's guard condition
|
|
349
|
-
* minus the node-specific exemptions (ownedWrite/firewall), which don't
|
|
350
|
-
* apply to plain store setters. Roots are NOT exempt (#3500): a root body is
|
|
351
|
-
* tree construction — every dev component body, every context Provider, the
|
|
352
|
-
* top of `render()`, and the whole SSR pass run directly under one — and a
|
|
353
|
-
* write there re-runs what already read the old value (or on the server,
|
|
354
|
-
* can't). Same rule as setSignal, which never exempted roots.
|
|
200
|
+
* - readerSeesCommitted, else the staged value.
|
|
355
201
|
*/
|
|
356
|
-
export declare function
|
|
357
|
-
/**
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
* the
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
|
|
366
|
-
|
|
202
|
+
export declare function serve(el: Signal<any> | Computed<any>, c: Computed<any> | null): unknown;
|
|
203
|
+
/** A pass read a staging of this flush: it derives from what the flush may
|
|
204
|
+
* yet hold (REACTIVE_STAGED_READ — the seam decides). Lane work too (plan sec. 28, a
|
|
205
|
+
* lane sees the screen plus its own guesses): the staging is the screen if
|
|
206
|
+
* the frame commits — one pass, the common case — and a held write if it
|
|
207
|
+
* parks, which the seam repairs (`stagedReaders`): the pass re-derives on
|
|
208
|
+
* the committed world and its lane's runs wait that round, so the held
|
|
209
|
+
* write never shows through the lane. A verdict lane's work likewise: the
|
|
210
|
+
* lane holds verdicts, not the frame's other stagings (#3851) — except a
|
|
211
|
+
* verdict reader, which answered for itself (the lane seam, lanes.ts). Not
|
|
212
|
+
* a read of a node born staged: it has no committed value to re-derive on,
|
|
213
|
+
* and a re-run would read the same staging and re-queue every round. */
|
|
214
|
+
export declare function stagedRead(c: Computed<any>, el?: Signal<any> | Computed<any>): void;
|
|
215
|
+
/** A10 for a staged node: a verdict reader (the pass entered a window) that
|
|
216
|
+
* also reads a frame's proposal plainly sees the screen — `[latest(q), q()]`
|
|
217
|
+
* is `[b, a]` — once the frame has a transaction, and re-derives when it
|
|
218
|
+
* lands: at this very seam if nothing holds it (the stale run is void,
|
|
219
|
+
* #3322 — one run, on the committed world), or with the hold. Before any
|
|
220
|
+
* transaction the answer is the seam's and the reader watches it
|
|
221
|
+
* (verdict.ts). A node born into the future has no screen: its staging is
|
|
222
|
+
* its only value (A29). */
|
|
223
|
+
export declare function stagedScreen(c: Computed<any>): boolean;
|
|
224
|
+
export declare function ownedScopeWriteMessage(owner: Owner): string;
|
|
225
|
+
/** A28 (4) — written inside a recompute that runs OUTSIDE a flush (a
|
|
226
|
+
* creation-time compute): promoted at that pass's end, visible to the rest of
|
|
227
|
+
* the block. Cold: only contextual writes reach here. */
|
|
228
|
+
export declare function notePromotedWrite(el: Signal<any> | Computed<any>): void;
|
|
367
229
|
export declare function setSignal<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)): T;
|
|
368
230
|
/**
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
*
|
|
378
|
-
* proposal (the mask, on the node or — a store leaf — its firewall)? #2692's
|
|
379
|
-
* "manual write wins" is a rule for one synchronous frame; across a hold the
|
|
380
|
-
* held pass result is nobody's proposal, and a user setter reaching it
|
|
381
|
-
* composes on the committed frame it was written against and becomes `prev`
|
|
382
|
-
* for the transaction's re-derivation (rederiveHeld) instead of replacing it.
|
|
383
|
-
* Writes made under the holding transaction masked the node and keep
|
|
384
|
-
* A34(1)'s last-write-wins. Only the user setters ask; an async landing or a
|
|
385
|
-
* companion writing a stamped node is the transaction's own work. */
|
|
386
|
-
export declare function heldDerivation(el: Signal<any> | Computed<any>): boolean;
|
|
387
|
-
/** The held-derivation write's second half: the node re-derives under its
|
|
388
|
-
* hold with the written staging as the pass's `prev`. Nothing is masked. The
|
|
389
|
-
* write took the A34 join (setSignal), which scheduled the flush that drains
|
|
390
|
-
* this; recompute re-enters the stamp. */
|
|
391
|
-
export declare function rederiveHeld(el: Computed<unknown>): void;
|
|
392
|
-
/**
|
|
393
|
-
* User-facing setter for the memo form of `createSignal(fn)`. Behaves like
|
|
394
|
-
* `setSignal`, but also cancels any pending recompute of the memo so the
|
|
395
|
-
* manual value wins over a value that would otherwise be produced by an
|
|
396
|
-
* upstream change in the same tick. Across a hold the write is not a
|
|
397
|
-
* proposal: a memo another transaction holds as a pass result composes on the
|
|
398
|
-
* committed value and re-derives under the hold with the write as `prev`
|
|
399
|
-
* (A34 amendment, #3612; heldDerivation).
|
|
231
|
+
* User-facing setter for the memo form of `createSignal(fn)`. A write applies
|
|
232
|
+
* first, then derivations re-run (A34 as amended 2026-10-01, rule B; core
|
|
233
|
+
* R31): the write stages like any other, and a source change — in this flush
|
|
234
|
+
* or a later one, under a hold or on mainline — re-derives with the staged
|
|
235
|
+
* write as `prev`. The write never refuses the re-run (the frame-scoped mask
|
|
236
|
+
* of #3733/#3740 and #2692's "write wins the tick" before it are gone; call
|
|
237
|
+
* order inside a flush was never observable) and on its own never causes one.
|
|
238
|
+
* REACTIVE_MANUAL_WRITE only marks the staging as a user proposal — the A34
|
|
239
|
+
* (1)/(3) discriminator — until a pass re-derives it or the commit lands it.
|
|
400
240
|
*/
|
|
401
241
|
export declare function setMemo<T>(el: Computed<T>, v: T | ((prev: T) => T)): T;
|
|
402
242
|
/**
|
|
@@ -425,6 +265,6 @@ export declare function staleValues<T>(fn: () => T, set?: boolean): T;
|
|
|
425
265
|
* it validates the target, marks through here, then builds the quiescence
|
|
426
266
|
* promise on the resolve()/until() effect machinery). Flags the node's next
|
|
427
267
|
* recompute as a quiet re-ask and schedules it; no-ops for non-derived or
|
|
428
|
-
* disposed targets
|
|
268
|
+
* disposed targets.
|
|
429
269
|
*/
|
|
430
270
|
export declare function markRefresh(node: Computed<any>): void;
|
package/dist/types/core/dev.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface DevHooks {
|
|
|
14
14
|
* `warn`/`error` as failures unless they opt in to `info`.
|
|
15
15
|
*/
|
|
16
16
|
export type DiagnosticSeverity = "info" | "warn" | "error";
|
|
17
|
-
export type DiagnosticCode = "STRICT_READ_UNTRACKED" | "PENDING_ASYNC_UNTRACKED_READ" | "PENDING_ASYNC_FORBIDDEN_SCOPE" | "REACTIVE_WRITE_IN_OWNED_SCOPE" | "ASYNC_STORE_SETTER" | "ACTION_CALLED_IN_OWNED_SCOPE" | "RUN_WITH_DISPOSED_OWNER" | "NO_OWNER_CLEANUP" | "CLEANUP_IN_FORBIDDEN_SCOPE" | "SETTLED_CLEANUP_UNOWNED" | "SETTLE_WALK_UNINITIALIZED_SOURCE" | "FLUSH_IN_EFFECT_CALLBACK" | "PRIMITIVE_IN_FORBIDDEN_SCOPE" | "NO_OWNER_EFFECT" | "NO_OWNER_BOUNDARY" | "ASYNC_OUTSIDE_LOADING_BOUNDARY" | "LOADING_ON_OUTSIDE_HOLD" | "INVALID_REFRESH_TARGET" | "INVALID_AFFECTS_TARGET" | "MISSING_EFFECT_FN" | "SYNC_NODE_RECEIVED_ASYNC" | "UNTRACKED_READ_AFTER_AWAIT" | "REACTIVITY_HALTED" | "INVARIANT_VIOLATION" | "HUGE_FAN_OUT" | "HUGE_FAN_IN" | "GRAPH_GROWTH" | "HOT_SCOPE_RERUNS" | "HOT_SCOPE_TIME" | "WIDE_SCOPE_DEPS" | "UNSTABLE_MEMO_OUTPUT" | "WASTED_RECOMPUTE" | "ASYNC_WATERFALL" | "HOT_SCOPE_FANOUT" | "SILENT_HOLD" | "LONG_HOLD" | "UNTRACKED_ASYNC_HANDLER" | "ABANDONED_FLIGHTS" | "FALLBACK_FLASH" | "STACKED_HOLDS" | "OPTIMISTIC_REVERTED" | "EFFECT_WRITES_OWN_SOURCE" | "EFFECT_RELAY_TEAR" | "IMMUTABLE_UPDATE_IN_STORE" | "UNSTABLE_LIST_IDENTITY" | "SSR_RENDER_ERROR_CONTAINED" | "SSR_SUBTREE_ABANDONED" | "SSR_STREAM_ABANDONED" | "SSR_CLIENT_CONTENT_MASKED" | "LATE_HEADER_WRITE" | "SERVER_ERROR_SANITIZED" | "SSR_BOUNDARY_WATERFALL" | "SSR_UNDECLARED_LIVE_SOURCE" | "SERVER_WRITE" | "REVEAL_IN_RENDER_TO_STRING" | "LAZY_ASSET_UNMAPPED" | "PRELOAD_DESCRIPTOR_INVALID" | "HEAD_TAG_INVALID" | "UNRECOGNIZED_INSERT_VALUE" | "UNSCOPED_HOLE_ALLOCATED_IDS" | "
|
|
17
|
+
export type DiagnosticCode = "STRICT_READ_UNTRACKED" | "PENDING_ASYNC_UNTRACKED_READ" | "PENDING_ASYNC_FORBIDDEN_SCOPE" | "REACTIVE_WRITE_IN_OWNED_SCOPE" | "ASYNC_STORE_SETTER" | "ACTION_CALLED_IN_OWNED_SCOPE" | "RUN_WITH_DISPOSED_OWNER" | "NO_OWNER_CLEANUP" | "CLEANUP_IN_FORBIDDEN_SCOPE" | "SETTLED_CLEANUP_UNOWNED" | "SETTLE_WALK_UNINITIALIZED_SOURCE" | "FLUSH_IN_EFFECT_CALLBACK" | "PRIMITIVE_IN_FORBIDDEN_SCOPE" | "PRIMITIVE_IN_EFFECT_CALLBACK" | "NO_OWNER_EFFECT" | "NO_OWNER_BOUNDARY" | "ASYNC_OUTSIDE_LOADING_BOUNDARY" | "LOADING_ON_OUTSIDE_HOLD" | "INVALID_REFRESH_TARGET" | "INVALID_AFFECTS_TARGET" | "MISSING_EFFECT_FN" | "SYNC_NODE_RECEIVED_ASYNC" | "UNTRACKED_READ_AFTER_AWAIT" | "REACTIVITY_HALTED" | "INVARIANT_VIOLATION" | "HUGE_FAN_OUT" | "HUGE_FAN_IN" | "GRAPH_GROWTH" | "HOT_SCOPE_RERUNS" | "HOT_SCOPE_TIME" | "WIDE_SCOPE_DEPS" | "UNSTABLE_MEMO_OUTPUT" | "WASTED_RECOMPUTE" | "ASYNC_WATERFALL" | "HOT_SCOPE_FANOUT" | "SILENT_HOLD" | "LONG_HOLD" | "UNTRACKED_ASYNC_HANDLER" | "ABANDONED_FLIGHTS" | "FALLBACK_FLASH" | "STACKED_HOLDS" | "OPTIMISTIC_REVERTED" | "EFFECT_WRITES_OWN_SOURCE" | "EFFECT_RELAY_TEAR" | "IMMUTABLE_UPDATE_IN_STORE" | "UNSTABLE_LIST_IDENTITY" | "SSR_RENDER_ERROR_CONTAINED" | "SSR_SUBTREE_ABANDONED" | "SSR_STREAM_ABANDONED" | "SSR_CLIENT_CONTENT_MASKED" | "LATE_HEADER_WRITE" | "SERVER_ERROR_SANITIZED" | "SSR_BOUNDARY_WATERFALL" | "SSR_UNDECLARED_LIVE_SOURCE" | "SERVER_WRITE" | "REVEAL_IN_RENDER_TO_STRING" | "LAZY_ASSET_UNMAPPED" | "PRELOAD_DESCRIPTOR_INVALID" | "HEAD_TAG_INVALID" | "UNRECOGNIZED_INSERT_VALUE" | "UNSCOPED_HOLE_ALLOCATED_IDS" | "LOWERCASE_EVENT_ATTRIBUTE" | "BINDING_SLOT_POSITION" | "FRAME_MARKER_CORRUPTED" | "DYNAMIC_ASYNC_COMPONENT";
|
|
18
18
|
export type DiagnosticKind = "strict-read" | "async" | "write" | "lifecycle" | "owner" | "error" | "perf" | "graph"
|
|
19
19
|
/** Perceived responsiveness: the runtime behaved correctly but the user saw no feedback. */
|
|
20
20
|
| "responsiveness"
|
|
@@ -22,7 +22,7 @@ export type DiagnosticKind = "strict-read" | "async" | "write" | "lifecycle" | "
|
|
|
22
22
|
| "ssr"
|
|
23
23
|
/** The response head: `<head>` tags, preload descriptors, HTTP headers. */
|
|
24
24
|
| "head"
|
|
25
|
-
/** The renderer's insert
|
|
25
|
+
/** The renderer's insert and attribute positions: a value it has no rendering for, or one it renders other than intended. */
|
|
26
26
|
| "render";
|
|
27
27
|
/** First warning when a change reaches (or a pass tracks) this many edges. */
|
|
28
28
|
export declare const GRAPH_SIZE_WARN_AT = 2000;
|
|
@@ -210,6 +210,24 @@ export type RecordLive<K extends RecordType> = RecordTypes[K] extends {
|
|
|
210
210
|
live: infer L;
|
|
211
211
|
} ? L : never;
|
|
212
212
|
export type RecordListener<K extends RecordType> = (event: RecordEvent<K>, live: RecordLive<K>) => void;
|
|
213
|
+
/**
|
|
214
|
+
* What a `Records.subscribe` asks of the emitter beyond the record itself.
|
|
215
|
+
*/
|
|
216
|
+
export interface RecordSubscribeOptions {
|
|
217
|
+
/**
|
|
218
|
+
* Ask for the record's BODIES: the live handles that cost the emitter
|
|
219
|
+
* something per record to take, and are taken only while a listener of
|
|
220
|
+
* the type has asked — so a consumer that reads ids, statuses and
|
|
221
|
+
* timings (an APM adapter, the performance tracks) never pays for what a
|
|
222
|
+
* body viewer (devtools' network panel) reads. Accepted for any type, the
|
|
223
|
+
* channel being generic; meaningful today for `"call"`, whose
|
|
224
|
+
* `live.request` (a reconstruction of the dispatched request) and
|
|
225
|
+
* `live.response` (an unread clone, a transient double-buffer of the
|
|
226
|
+
* payload) are taken only under it — without it, the transport's own
|
|
227
|
+
* objects. An emitter asks with `observed(type, "bodies")`.
|
|
228
|
+
*/
|
|
229
|
+
bodies?: boolean;
|
|
230
|
+
}
|
|
213
231
|
/**
|
|
214
232
|
* The records channel — `OBSERVE.records`, on either platform: one place a
|
|
215
233
|
* consumer (an APM adapter's `init()`, devtools, the diagnostics harness)
|
|
@@ -235,14 +253,28 @@ export interface Records {
|
|
|
235
253
|
* Deliver `type` records as they complete; returns the unsubscribe. The
|
|
236
254
|
* subscription is the channel's, not any emitter's: it outlives the
|
|
237
255
|
* attribution engine's `enable()`/`disable()` cycles and is dropped only
|
|
238
|
-
* by its own unsubscribe.
|
|
256
|
+
* by its own unsubscribe. `options` asks the emitter for more than the
|
|
257
|
+
* record — see `RecordSubscribeOptions`. One entry per listener function:
|
|
258
|
+
* its options are read at its first subscription to the type, a repeat
|
|
259
|
+
* subscription of the same function changes nothing, and either disposer
|
|
260
|
+
* removes it. What an emitter takes is decided once per record from the
|
|
261
|
+
* union of the type's subscribers, so a listener without `bodies` that
|
|
262
|
+
* shares a call with one that asked receives the same `live` — the clone.
|
|
239
263
|
*/
|
|
240
|
-
subscribe<K extends RecordType>(type: K, listener: RecordListener<K
|
|
264
|
+
subscribe<K extends RecordType>(type: K, listener: RecordListener<K>, options?: RecordSubscribeOptions): () => void;
|
|
241
265
|
/**
|
|
242
266
|
* Whether anything is subscribed to `type` — an emitter's pre-check, so
|
|
243
267
|
* a record nobody will hear costs nothing to not build (no clock read).
|
|
244
268
|
*/
|
|
245
269
|
observed(type: RecordType): boolean;
|
|
270
|
+
/**
|
|
271
|
+
* Whether a listener of `type` asked for its bodies
|
|
272
|
+
* (`subscribe(type, listener, { bodies: true })`) — the emitter's
|
|
273
|
+
* pre-check for the live handles that cost something per record to take.
|
|
274
|
+
* `false` while every listener of the type is a plain one, and once the
|
|
275
|
+
* last body-wanting one unsubscribed.
|
|
276
|
+
*/
|
|
277
|
+
observed(type: RecordType, facet: "bodies"): boolean;
|
|
246
278
|
/**
|
|
247
279
|
* Delivers a completed record to `type`'s listeners, synchronously: how a
|
|
248
280
|
* runtime publishes. Snapshot semantics without a snapshot — the listener
|
|
@@ -299,11 +331,32 @@ export interface Observe {
|
|
|
299
331
|
* and stores created under it are excluded subjects wherever their writes
|
|
300
332
|
* come from (a click handler, an adapter callback), so writes need no
|
|
301
333
|
* `runWithOwner` — and must not use one: a write under an owner is a write
|
|
302
|
-
* in an owned scope (REACTIVE_WRITE_IN_OWNED_SCOPE).
|
|
303
|
-
* owner
|
|
334
|
+
* in an owned scope (REACTIVE_WRITE_IN_OWNED_SCOPE). One mark per owner:
|
|
335
|
+
* a later `exclude` or `include` on the same owner replaces it, and
|
|
336
|
+
* `include` re-admits a subtree beneath it.
|
|
304
337
|
*/
|
|
305
338
|
exclude(owner: Owner): void;
|
|
306
|
-
/**
|
|
339
|
+
/**
|
|
340
|
+
* Marks `owner`'s subtree as the app's again, beneath an excluded owner.
|
|
341
|
+
* The verdict for a subject is the NEAREST marked ancestor's (the subject
|
|
342
|
+
* itself included): an `include` under an `exclude` re-admits that
|
|
343
|
+
* subtree, an `exclude` under an `include` excludes it again, and the
|
|
344
|
+
* markers nest to any depth. For an observer that WRAPS the app it
|
|
345
|
+
* watches — a toolbar rendering `<DevToolbar><App/></DevToolbar>` — so
|
|
346
|
+
* the toolbar's own root is excluded and the app's root, created under
|
|
347
|
+
* it, is included back. Mark the root as it is created, as with
|
|
348
|
+
* `exclude`: the attribution engine caches each node's verdict the first
|
|
349
|
+
* time it asks and keeps it for the node's life, so a mark set after a
|
|
350
|
+
* node was judged does not reach it. Alone — with no excluded ancestor —
|
|
351
|
+
* an included owner is what it already was. One mark per owner: a later
|
|
352
|
+
* `exclude` or `include` on the same owner replaces it.
|
|
353
|
+
*/
|
|
354
|
+
include(owner: Owner): void;
|
|
355
|
+
/**
|
|
356
|
+
* Whether `subject` sits under an excluded owner (itself included) — the
|
|
357
|
+
* nearest marked ancestor on its owner chain answers, with the one mark
|
|
358
|
+
* (the latest `exclude`/`include`) that owner carries.
|
|
359
|
+
*/
|
|
307
360
|
isExcluded(subject: DiagnosticSubject | null | undefined): boolean;
|
|
308
361
|
/**
|
|
309
362
|
* Root-first names of the owners enclosing `subject` (inclusive when the
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type Transition } from "./scheduler.js";
|
|
2
1
|
import type { Computed, NodeOptions, Owner } from "./types.js";
|
|
3
2
|
export interface Effect<T> extends Computed<T>, Owner {
|
|
4
3
|
_effectFn: (val: T, prev: T | undefined) => void | (() => void);
|
|
@@ -7,12 +6,6 @@ export interface Effect<T> extends Computed<T>, Owner {
|
|
|
7
6
|
_prevValue: T | undefined;
|
|
8
7
|
_type: number;
|
|
9
8
|
_boundRunEffect?: (type: number) => void;
|
|
10
|
-
/** The transaction whose staged view produced `_value` (null = committed
|
|
11
|
-
* view). Effects have one value slot and do not entangle transactions, so
|
|
12
|
-
* a second transaction recomputing the same effect overwrites a value the
|
|
13
|
-
* first one still owes a run for; see the contested-effect arm of recompute
|
|
14
|
-
* (#3322). */
|
|
15
|
-
_valueTransition: Transition | null;
|
|
16
9
|
}
|
|
17
10
|
/**
|
|
18
11
|
* Effects are the leaf nodes of our reactive graph. When their sources change, they are
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { Computed, Link, Signal } from "./types.js";
|
|
2
|
+
/** The store's shared slot-node release handler (store/store.ts installs it
|
|
3
|
+
* once) — a live binding read directly by the sweep site: no wrapper frame,
|
|
4
|
+
* no null check (a CONFIG_SLOT_NODE node existing implies the store module
|
|
5
|
+
* loaded and registered it). */
|
|
6
|
+
export declare let slotUnobservedHook: (node: Signal<any>) => void;
|
|
7
|
+
export declare function setSlotUnobserved(fn: (node: Signal<any>) => void): void;
|
|
2
8
|
export declare function unlinkSubs(link: Link): Link | null;
|
|
3
9
|
export declare function trimStaleDeps(el: Computed<any>): void;
|
|
4
10
|
export declare function clearDeps(el: Computed<unknown>): void;
|
|
@@ -25,4 +31,4 @@ export declare function unobserved(el: Computed<unknown>): void;
|
|
|
25
31
|
*/
|
|
26
32
|
export declare const dormantNodes: Set<Computed<unknown>>;
|
|
27
33
|
export declare function sweepDormant(): void;
|
|
28
|
-
export declare function link(dep: Signal<any> | Computed<any>, sub: Computed<any
|
|
34
|
+
export declare function link(dep: Signal<any> | Computed<any>, sub: Computed<any>): void;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { Computed } from "./types.js";
|
|
2
|
-
/** The queue a node belongs to, picked from its own zombie flag. */
|
|
3
|
-
export declare function queueFor(n: Computed<any>): Heap;
|
|
4
2
|
/**
|
|
5
|
-
* Schedule one subscriber to re-run on the next flush: inserted into
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
3
|
+
* Schedule one subscriber to re-run on the next flush: inserted into the
|
|
4
|
+
* dirty heap with the `_min` cursor pulled down. Tracked effects ride the
|
|
5
|
+
* heap too — the heap visit is their (empty) compute phase, which hands the
|
|
6
|
+
* callback to the user queue once the pass has committed (see
|
|
7
|
+
* GlobalQueue._update, #3291).
|
|
10
8
|
*/
|
|
11
9
|
export declare function enqueueSub(node: Computed<any>): void;
|
|
12
10
|
export interface Heap {
|