@solidjs/signals 2.0.0-rc.14 → 2.0.0-rc.16
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 +882 -405
- package/dist/dev.attribution.js +172 -66
- package/dist/dev.js +1529 -745
- package/dist/observe/affects-marks.js +86 -0
- package/dist/observe/affects.js +32 -80
- package/dist/observe/boundaries.js +202 -166
- package/dist/observe/core/async.js +192 -141
- package/dist/observe/core/attribution-queries.js +1 -1
- package/dist/observe/core/attribution.js +315 -214
- package/dist/observe/core/constants.js +23 -4
- package/dist/observe/core/context.js +3 -3
- package/dist/observe/core/core.js +532 -360
- package/dist/observe/core/dev.js +63 -35
- package/dist/observe/core/effect.js +47 -47
- package/dist/observe/core/error.js +5 -3
- package/dist/observe/core/external.js +5 -6
- package/dist/observe/core/graph.js +56 -42
- package/dist/observe/core/heap.js +33 -33
- package/dist/observe/core/identities.js +62 -0
- package/dist/observe/core/lanes.js +242 -229
- package/dist/observe/core/owner.js +62 -50
- package/dist/observe/core/scheduler.js +322 -168
- package/dist/observe/core/truth.js +45 -0
- package/dist/observe/core/verdict.js +114 -64
- package/dist/observe/deferred.js +184 -0
- package/dist/observe/index.js +7 -1
- package/dist/observe/map.js +339 -254
- package/dist/observe/reveal.js +77 -77
- package/dist/observe/signals.js +54 -33
- package/dist/observe/store/affects.js +76 -69
- package/dist/observe/store/edges.js +39 -0
- package/dist/observe/store/hooks.js +13 -0
- package/dist/observe/store/index.js +0 -2
- package/dist/observe/store/optimistic.js +82 -44
- package/dist/observe/store/projection.js +83 -64
- package/dist/observe/store/reconcile.js +32 -30
- package/dist/observe/store/store.js +219 -123
- package/dist/prod/affects-marks.js +86 -0
- package/dist/prod/affects.js +33 -79
- package/dist/prod/boundaries.js +185 -149
- package/dist/prod/core/async.js +176 -135
- package/dist/prod/core/constants.js +23 -4
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +521 -353
- package/dist/prod/core/effect.js +66 -66
- package/dist/prod/core/error.js +5 -3
- package/dist/prod/core/external.js +5 -6
- package/dist/prod/core/graph.js +56 -42
- package/dist/prod/core/heap.js +38 -38
- package/dist/prod/core/identities.js +62 -0
- package/dist/prod/core/lanes.js +237 -224
- package/dist/prod/core/owner.js +62 -51
- package/dist/prod/core/scheduler.js +312 -158
- package/dist/prod/core/truth.js +45 -0
- package/dist/prod/core/verdict.js +113 -63
- package/dist/prod/deferred.js +182 -0
- package/dist/prod/index.js +7 -1
- package/dist/prod/map.js +366 -281
- package/dist/prod/reveal.js +77 -77
- package/dist/prod/signals.js +59 -38
- package/dist/prod/store/affects.js +76 -69
- package/dist/prod/store/edges.js +39 -0
- package/dist/prod/store/hooks.js +13 -0
- package/dist/prod/store/index.js +0 -2
- package/dist/prod/store/optimistic.js +121 -84
- package/dist/prod/store/projection.js +46 -34
- package/dist/prod/store/reconcile.js +32 -30
- package/dist/prod/store/store.js +205 -116
- package/dist/types/affects-marks.d.ts +14 -0
- package/dist/types/boundaries.d.ts +5 -1
- package/dist/types/core/async.d.ts +10 -0
- package/dist/types/core/attribution.d.ts +6 -2
- package/dist/types/core/constants.d.ts +18 -1
- package/dist/types/core/core.d.ts +77 -5
- package/dist/types/core/dev.d.ts +43 -13
- package/dist/types/core/graph.d.ts +11 -0
- package/dist/types/core/identities.d.ts +17 -0
- package/dist/types/core/index.d.ts +2 -1
- package/dist/types/core/lanes.d.ts +2 -4
- package/dist/types/core/owner.d.ts +5 -3
- package/dist/types/core/scheduler.d.ts +59 -34
- package/dist/types/core/truth.d.ts +16 -0
- package/dist/types/core/types.d.ts +21 -6
- package/dist/types/core/verdict.d.ts +32 -0
- package/dist/types/deferred.d.ts +28 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/map.d.ts +2 -2
- package/dist/types/signals.d.ts +28 -7
- package/dist/types/store/affects.d.ts +11 -0
- package/dist/types/store/edges.d.ts +9 -0
- package/dist/types/store/hooks.d.ts +48 -0
- package/dist/types/store/index.d.ts +10 -4
- package/dist/types/store/optimistic.d.ts +3 -2
- package/dist/types/store/projection.d.ts +4 -3
- package/dist/types/store/store.d.ts +4 -39
- package/dist/types/store/target.d.ts +16 -8
- package/dist/types/store/types.d.ts +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Computed, Signal } from "./core/types.js";
|
|
2
|
+
export type Marked = Signal<any> | Computed<any>;
|
|
3
|
+
/** The verdict readers downstream of `node` — through derivations, stopping
|
|
4
|
+
* at effects — re-derive: the mark's one notification (a probe's answer
|
|
5
|
+
* changed with no value notifying anyone). Truth readers (`until`, the
|
|
6
|
+
* `refresh` waiter) too, which a lagging flight parked (deferred.ts) — but
|
|
7
|
+
* not through a derived store, whose leaves change only once its derive
|
|
8
|
+
* re-runs: they re-derive at that write. */
|
|
9
|
+
export declare function repoll(node: Marked, seen?: Set<Computed<any>>, readers?: number): void;
|
|
10
|
+
/** One mark on `node`. The declarer repolls once its bookkeeping is done. */
|
|
11
|
+
export declare function mark(node: Marked): void;
|
|
12
|
+
/** Drops one mark from `node`: true when it was the last — the node's
|
|
13
|
+
* verdict readers have re-derived. */
|
|
14
|
+
export declare function unmark(node: Marked): boolean;
|
|
@@ -27,7 +27,7 @@ interface Boundary {
|
|
|
27
27
|
* whatever holds the frame; no LOADING_ON_OUTSIDE_HOLD report. */
|
|
28
28
|
_ahead?: boolean;
|
|
29
29
|
/** The output's last pass chose the fallback: readers under it are off
|
|
30
|
-
* screen (`
|
|
30
|
+
* screen (`hiddenBy`). */
|
|
31
31
|
_fallback: boolean;
|
|
32
32
|
/** User effects whose run came due behind the fallback: re-queued at the
|
|
33
33
|
* reveal (`heldRun`). */
|
|
@@ -40,6 +40,10 @@ interface Boundary {
|
|
|
40
40
|
_collapsed: boolean;
|
|
41
41
|
_error: Signal<unknown> | null;
|
|
42
42
|
_show: (b: Boundary) => unknown;
|
|
43
|
+
/** The fallback's own computed, in its own scope like `Show`'s function
|
|
44
|
+
* child: instantiated once per show and kept across the output's
|
|
45
|
+
* re-derives while it shows (#3991). */
|
|
46
|
+
_fb: Computed<unknown> | null;
|
|
43
47
|
}
|
|
44
48
|
/** Context key: the reveal controller a Loading boundary created here is a
|
|
45
49
|
* slot of (reveal.ts); a boundary clears it for its content — only direct
|
|
@@ -11,7 +11,17 @@ export declare function addPendingSource(el: Computed<any>, source: Computed<any
|
|
|
11
11
|
export declare function parkLoadingWindow(el: Computed<any>, e: NotReadyError): void;
|
|
12
12
|
export declare function setPendingError(el: Computed<any>, source?: Computed<any>, error?: any): void;
|
|
13
13
|
export declare function forEachDependent(el: Computed<any>, fn: (node: Computed<any>, link: Link) => void): void;
|
|
14
|
+
export declare function releaseIfSettledUnobserved(node: Computed<any>): void;
|
|
14
15
|
export declare function releaseSettledDependents(el: Computed<any>): void;
|
|
16
|
+
/** D-41: an error a pass of a held node found is an answer of
|
|
17
|
+
* that frame — it ends the wait like a value and shows when a value would.
|
|
18
|
+
* Staged like one: `_pendingValue` carries it (CONFIG_STAGED_ERROR), readers
|
|
19
|
+
* in the hold derive from it (`serve` throws it), and the commit publishes
|
|
20
|
+
* it through the ordinary error path (`commitPendingNode` → `notifyStatus`),
|
|
21
|
+
* dependents included. Not for a lane pass, nor a node with no shown value
|
|
22
|
+
* (born held — its error has no frame to wait behind): those publish now,
|
|
23
|
+
* as before. Returns whether the error was staged. */
|
|
24
|
+
export declare function stageError(el: Computed<any>, error: any, inPass?: boolean): boolean;
|
|
15
25
|
export declare function settleErroredDependents(el: Computed<any>, error: any): void;
|
|
16
26
|
export declare function settlePendingSource(el: Computed<any>, source?: Computed<any>): void;
|
|
17
27
|
export declare function isThenable<T>(value: T | PromiseLike<T>): value is PromiseLike<T>;
|
|
@@ -502,9 +502,13 @@ export interface AttributionOptions {
|
|
|
502
502
|
/**
|
|
503
503
|
* Graph-growth warning: emit GRAPH_GROWTH when the live owner count at the
|
|
504
504
|
* settle of the same route has climbed on `visits` consecutive visits
|
|
505
|
-
* (default 3) to `ratio` or more of the first (default 1.25)
|
|
505
|
+
* (default 3) to `ratio` or more of the first (default 1.25), and so has
|
|
506
|
+
* the part of it that outlived each of those navigations — a root or a
|
|
506
507
|
* subscription each visit leaves behind, the leak class a heap snapshot
|
|
507
|
-
* finds
|
|
508
|
+
* finds, not content a visit owns and leaving disposes. The count is a walk
|
|
509
|
+
* when a navigation opens and at its settle, never per node. Navigations
|
|
510
|
+
* that stay on a route pattern continue its visit and are not compared.
|
|
511
|
+
* `false` disables.
|
|
508
512
|
*/
|
|
509
513
|
graphGrowth?: {
|
|
510
514
|
visits: number;
|
|
@@ -87,6 +87,11 @@ export declare const CONFIG_STAGED: number;
|
|
|
87
87
|
* parking flush they see the committed value and hold nothing, and are
|
|
88
88
|
* re-derived at the landing. Set at the park seam on every staged node. */
|
|
89
89
|
export declare const CONFIG_HELD: number;
|
|
90
|
+
/** A member of the uncommitted frame a held pass built (ruling A): set at
|
|
91
|
+
* the park seam on every computed under a staged node (`holdFrame`). Never
|
|
92
|
+
* shown, it has no screen: its reads are its transaction's, whichever flush
|
|
93
|
+
* runs it (`bornInto`, #4010). Cleared by its commit. */
|
|
94
|
+
export declare const CONFIG_HELD_FRAME: number;
|
|
90
95
|
/** A15's reveal corollary (#3305): a commit published this flight's inputs
|
|
91
96
|
* beneath it — the node was pending, nothing staged, when it committed — so
|
|
92
97
|
* its committed value is torn against the visible frame. A render effect
|
|
@@ -111,6 +116,9 @@ export declare const CONFIG_SLOT_NODE: number;
|
|
|
111
116
|
* leaf twin of REACTIVE_MANUAL_WRITE). Set by the user setter, cleared by
|
|
112
117
|
* the derive's own write to the key. */
|
|
113
118
|
export declare const CONFIG_MANUAL_WRITE: number;
|
|
119
|
+
/** D-41: the staged value in `_pendingValue` is an error — an
|
|
120
|
+
* answer of the held frame, published at its landing like a value. */
|
|
121
|
+
export declare const CONFIG_STAGED_ERROR: number;
|
|
114
122
|
/** Lanes — the node carries a written guess (`optimisticWrite`): its own
|
|
115
123
|
* source recomputing it, or a plain write landing on it, is the truth
|
|
116
124
|
* (`supersede`). A lane's derived staging is not. */
|
|
@@ -119,7 +127,9 @@ export declare const CONFIG_GUESS: number;
|
|
|
119
127
|
* pending is a question for its next pass — the verdict changed — so the
|
|
120
128
|
* propagation re-derives it instead of marking it pending (as a kept-tail
|
|
121
129
|
* link does, A30). Set at the window, never cleared: a reader that stopped
|
|
122
|
-
* asking re-derives once and goes pending through its own read.
|
|
130
|
+
* asking re-derives once and goes pending through its own read. The same
|
|
131
|
+
* bit as REACTIVE_PROBED: a pass's probe (or a read of a verdict memo,
|
|
132
|
+
* core.ts `read`) carries into the config at its end without a shift. */
|
|
123
133
|
export declare const CONFIG_VERDICT: number;
|
|
124
134
|
/** A dependency's status is a question for this node's pass, not a fact
|
|
125
135
|
* about its current one: the propagation re-derives it instead of marking
|
|
@@ -128,6 +138,10 @@ export declare const CONFIG_VERDICT: number;
|
|
|
128
138
|
* promise over an expression (`resolve`/`until`, signals.ts: the pass reads
|
|
129
139
|
* the error and rejects, or re-asks a pending source). */
|
|
130
140
|
export declare const CONFIG_REDERIVE: number;
|
|
141
|
+
/** An answered `createDeferred` node (deferred.ts): held because a
|
|
142
|
+
* downstream hold staged its landing, its re-pass is a lagging question,
|
|
143
|
+
* not an answer, and joins no transaction (D-40). */
|
|
144
|
+
export declare const CONFIG_LAGS: number;
|
|
131
145
|
/** The reader wants the truth, not the lane's guess (`until`, signals.ts):
|
|
132
146
|
* a read of displayed optimism serves the base the guess covers, makes the
|
|
133
147
|
* pass no lane's, and the truth landing wakes it even when it confirms the
|
|
@@ -175,6 +189,9 @@ export declare const STATUS_NONE = 0;
|
|
|
175
189
|
export declare const STATUS_PENDING: number;
|
|
176
190
|
export declare const STATUS_ERROR: number;
|
|
177
191
|
export declare const STATUS_UNINITIALIZED: number;
|
|
192
|
+
/** `catchHook`'s answer when the catcher is a boundary re-armed by
|
|
193
|
+
* `on` (truthy, as any catch): what it collects is its own, not the hold's. */
|
|
194
|
+
export declare const CAUGHT_REARMED = 2;
|
|
178
195
|
export declare const EFFECT_PURE = 0;
|
|
179
196
|
export declare const EFFECT_RENDER = 1;
|
|
180
197
|
export declare const EFFECT_USER = 2;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Transaction } from "./scheduler.js";
|
|
1
2
|
import type { Computed, NodeExtension, NodeOptions, Owner, Signal } from "./types.js";
|
|
2
3
|
export declare const PRIMITIVE_IN_FORBIDDEN_SCOPE_MESSAGE = "[PRIMITIVE_IN_FORBIDDEN_SCOPE] Cannot create reactive primitives inside createTrackedEffect or owner-backed onSettled";
|
|
3
4
|
export declare const PRIMITIVE_IN_EFFECT_CALLBACK_MESSAGE: string;
|
|
@@ -32,6 +33,24 @@ export declare function computed<T>(fn: (prev: T) => T | PromiseLike<T> | AsyncI
|
|
|
32
33
|
export declare function ext(el: {
|
|
33
34
|
_x: NodeExtension | null;
|
|
34
35
|
}): NodeExtension;
|
|
36
|
+
/** A tracked read of a held node (the reader derives from its transaction's
|
|
37
|
+
* world): the reading pass is marked as having read it (born-held decision
|
|
38
|
+
* in `recompute`), and the flush joins the node's transaction — unless the
|
|
39
|
+
* reader is a render effect. A render effect is the frame, not a derivation
|
|
40
|
+
* (rule 3): in that transaction's own flush, or born into it (uninitialized,
|
|
41
|
+
* A29), it reads the staged value and holds nothing of its own; otherwise it
|
|
42
|
+
* reads the committed value instead (`frameRead`). A node born into the
|
|
43
|
+
* future has no committed value: every reader joins it. A first pass is
|
|
44
|
+
* something not ready under a loading boundary that has not shown content:
|
|
45
|
+
* the boundary collects it and shows its fallback, and the pass is the
|
|
46
|
+
* boundary's, not the tick's (A29's boundary exemption, #3540). */
|
|
47
|
+
export declare function joinPass(c: Computed<any>, el: Signal<any> | Computed<any>): void;
|
|
48
|
+
/** A node born into transaction `t`: held by it and never committed (A29,
|
|
49
|
+
* ruling A) — uninitialized (born held), or a member of the frame one of its
|
|
50
|
+
* held passes built (CONFIG_HELD_FRAME). Its branch exists only in `t`: it
|
|
51
|
+
* has no screen to read, so it reads `t`'s values, whichever flush runs it,
|
|
52
|
+
* and keeps staging (#4010). */
|
|
53
|
+
export declare function bornInto(c: Computed<any>, t: Transaction): unknown;
|
|
35
54
|
/**
|
|
36
55
|
* Build an Effect node with all effect-specific fields baked into a single object literal,
|
|
37
56
|
* so V8 sees the full hidden class shape at construction time. Effects always run in lazy
|
|
@@ -64,7 +83,8 @@ export declare function isEqual<T>(a: T, b: T): boolean;
|
|
|
64
83
|
* object, no NodeExtension, no post-construction expandos. `ownedWrite` is
|
|
65
84
|
* baked in: the setter carries the owned-scope guard; node-level writes are
|
|
66
85
|
* the store's notification machinery. The observe literal adds the label
|
|
67
|
-
*
|
|
86
|
+
* and location slots (the store relabels `store.<key>` and stamps the
|
|
87
|
+
* store's `loc` when the engine is installed). */
|
|
68
88
|
export declare function slotSignal<T>(v: T, equals: (a: T, b: T) => boolean, host: object, key: PropertyKey, acc: boolean): Signal<T>;
|
|
69
89
|
/**
|
|
70
90
|
* When set to a component name string, any reactive read that is not inside a nested tracking
|
|
@@ -91,7 +111,11 @@ export declare function enterCallback(): void;
|
|
|
91
111
|
export declare function exitCallback(): void;
|
|
92
112
|
/**
|
|
93
113
|
* Dev-only: > 0 while owner teardown runs cleanups (`_disposal` entries and
|
|
94
|
-
* effect-returned cleanups — owner.ts), for the same reason.
|
|
114
|
+
* effect-returned cleanups — owner.ts), for the same reason. The owned-scope
|
|
115
|
+
* write guard (setSignal, markRefresh, the store setter) stands down here
|
|
116
|
+
* too: a cleanup is teardown, not part of whichever computation is disposing
|
|
117
|
+
* its owner (a list pass removing a row, a branch switching away), so its
|
|
118
|
+
* writes are imperative like an effect callback's (#4165). Kept apart from
|
|
95
119
|
* `callbackDepth` because its sites cannot use try/finally (the frame would
|
|
96
120
|
* survive into prod): a throwing cleanup leaves it raised, and dev.ts resets
|
|
97
121
|
* it on the next microtask, which teardown — synchronous — never spans.
|
|
@@ -108,6 +132,16 @@ export declare function setStrictRead(v: string | false): string | false;
|
|
|
108
132
|
* Use `untrack` inside a memo or effect when you need to read a signal once
|
|
109
133
|
* without making the surrounding computation depend on its future changes.
|
|
110
134
|
*
|
|
135
|
+
* `untrack` stops dependency tracking, not async settlement. Reading an
|
|
136
|
+
* uninitialized async source still suspends the owning computation; it runs
|
|
137
|
+
* again when that source first resolves. Afterward, the untracked read is a
|
|
138
|
+
* snapshot and does not subscribe the computation to later changes.
|
|
139
|
+
*
|
|
140
|
+
* If the first read must return immediately, give the async source a
|
|
141
|
+
* `loadingValue` before reading it with `untrack`. `isPending` and `latest`
|
|
142
|
+
* inspect updates to an existing value; neither supplies a missing initial
|
|
143
|
+
* value.
|
|
144
|
+
*
|
|
111
145
|
* Pass a `strictReadLabel` string to enable a dev-mode warning: any reactive
|
|
112
146
|
* read inside `fn` that isn't inside a nested tracking scope will log a
|
|
113
147
|
* warning naming the label.
|
|
@@ -121,6 +155,9 @@ export declare function setStrictRead(v: string | false): string | false;
|
|
|
121
155
|
* log(snapshot);
|
|
122
156
|
* }
|
|
123
157
|
* );
|
|
158
|
+
*
|
|
159
|
+
* const color = createMemo<string>(() => fetchColor(), { loadingValue: "gray" });
|
|
160
|
+
* const initialColor = untrack(color); // "gray" while the fetch is unresolved
|
|
124
161
|
* ```
|
|
125
162
|
*/
|
|
126
163
|
export declare function untrack<T>(fn: () => T, strictReadLabel?: string | false): T;
|
|
@@ -209,8 +246,9 @@ export declare function serve(el: Signal<any> | Computed<any>, c: Computed<any>
|
|
|
209
246
|
* write never shows through the lane. A verdict lane's work likewise: the
|
|
210
247
|
* lane holds verdicts, not the frame's other stagings (#3851) — except a
|
|
211
248
|
* 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
|
|
213
|
-
* and a re-run would read the same staging and re-queue every
|
|
249
|
+
* a read of a node born staged at all: it has no committed value to
|
|
250
|
+
* re-derive on, and a re-run would read the same staging and re-queue every
|
|
251
|
+
* round (#3969: nor does it make a later lane read a re-derive, `enterLane`). */
|
|
214
252
|
export declare function stagedRead(c: Computed<any>, el?: Signal<any> | Computed<any>): void;
|
|
215
253
|
/** A10 for a staged node: a verdict reader (the pass entered a window) that
|
|
216
254
|
* also reads a frame's proposal plainly sees the screen — `[latest(q), q()]`
|
|
@@ -219,13 +257,47 @@ export declare function stagedRead(c: Computed<any>, el?: Signal<any> | Computed
|
|
|
219
257
|
* #3322 — one run, on the committed world), or with the hold. Before any
|
|
220
258
|
* transaction the answer is the seam's and the reader watches it
|
|
221
259
|
* (verdict.ts). A node born into the future has no screen: its staging is
|
|
222
|
-
* its only value (A29).
|
|
260
|
+
* its only value (A29). Nor has a reader born into the flush's transaction
|
|
261
|
+
* (`bornInto`, #4010): its branch exists only there. */
|
|
223
262
|
export declare function stagedScreen(c: Computed<any>): boolean;
|
|
224
263
|
export declare function ownedScopeWriteMessage(owner: Owner): string;
|
|
225
264
|
/** A28 (4) — written inside a recompute that runs OUTSIDE a flush (a
|
|
226
265
|
* creation-time compute): promoted at that pass's end, visible to the rest of
|
|
227
266
|
* the block. Cold: only contextual writes reach here. */
|
|
228
267
|
export declare function notePromotedWrite(el: Signal<any> | Computed<any>): void;
|
|
268
|
+
/** Cold half of setSignal's snapshot arm (see there), shared with a store
|
|
269
|
+
* container's structural notify: first write during capture to a plain
|
|
270
|
+
* signal without a live snapshot records the pre-write value. Only plain
|
|
271
|
+
* user signals qualify. Computeds reach setSignal from an
|
|
272
|
+
* async landing (asyncWrite), and a value arriving from async during the pass
|
|
273
|
+
* REVEALS — the creation-time arm skips pending computeds for the same
|
|
274
|
+
* reason. Firewall leaves belong to a projection whose compute is the tree's
|
|
275
|
+
* own work, captured (or deliberately not) at creation. */
|
|
276
|
+
export declare function captureWriteSnapshot<T>(el: Signal<T> | Computed<T>, current: T): void;
|
|
277
|
+
/**
|
|
278
|
+
* A callback run before every signal or store write lands, while set, with
|
|
279
|
+
* the written signal or the store proxy whose setter runs. The
|
|
280
|
+
* server-components client sets it while slot occurrences are left
|
|
281
|
+
* unmounted after hydration (deferred hydration): a write may be one an
|
|
282
|
+
* unmounted component would have observed, so the client mounts what is
|
|
283
|
+
* left before the write applies, and clears the hook. `null` otherwise.
|
|
284
|
+
*/
|
|
285
|
+
export declare let writeHook: ((node?: object) => void) | null;
|
|
286
|
+
/** @internal */
|
|
287
|
+
export declare function setWriteHook(hook: ((node?: object) => void) | null): void;
|
|
288
|
+
/**
|
|
289
|
+
* `el`'s comparator verdict (`_equals`), the one guarded call for recompute,
|
|
290
|
+
* setSignal (user setters and async landings) and the seam's
|
|
291
|
+
* staged-equals-committed check.
|
|
292
|
+
* - A comparator that read an unresolved async source has not shown the
|
|
293
|
+
* values equal (#4111): falsy, a change, whose readers suspend in their own
|
|
294
|
+
* tracked context.
|
|
295
|
+
* - Any other throw is an error of `el`'s computation (A3, #2837): routed
|
|
296
|
+
* through the status path so error boundaries contain it, instead of
|
|
297
|
+
* unwinding a flush or a setter; answered "same" so nothing commits.
|
|
298
|
+
* @internal
|
|
299
|
+
*/
|
|
300
|
+
export declare function isSame(el: Signal<any>, a: unknown, b: unknown): unknown;
|
|
229
301
|
export declare function setSignal<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)): T;
|
|
230
302
|
/**
|
|
231
303
|
* User-facing setter for the memo form of `createSignal(fn)`. A write applies
|
package/dist/types/core/dev.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export interface DevHooks {
|
|
|
6
6
|
onGraph?: (value: any, owner: Owner | null) => void;
|
|
7
7
|
onUpdate?: () => void;
|
|
8
8
|
onStoreNodeUpdate?: (state: any, property: PropertyKey, value: any, prev: any) => void;
|
|
9
|
+
/** @internal Every node read (the frames client's identity-drift check; `setReadWatch`). */
|
|
10
|
+
onRead?: (node: object) => void;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* `info` is the advisory tier: a structural fact worth surfacing that is not
|
|
@@ -14,7 +16,7 @@ export interface DevHooks {
|
|
|
14
16
|
* `warn`/`error` as failures unless they opt in to `info`.
|
|
15
17
|
*/
|
|
16
18
|
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" | "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" | "
|
|
19
|
+
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" | "SSR_LIVE_HOLE_LATCHED" | "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" | "FRAME_MARKER_CORRUPTED" | "DYNAMIC_ASYNC_COMPONENT";
|
|
18
20
|
export type DiagnosticKind = "strict-read" | "async" | "write" | "lifecycle" | "owner" | "error" | "perf" | "graph"
|
|
19
21
|
/** Perceived responsiveness: the runtime behaved correctly but the user saw no feedback. */
|
|
20
22
|
| "responsiveness"
|
|
@@ -46,6 +48,15 @@ export interface DiagnosticEvent {
|
|
|
46
48
|
* is usually the finding itself).
|
|
47
49
|
*/
|
|
48
50
|
ownerPath?: string[];
|
|
51
|
+
/**
|
|
52
|
+
* Source location of the innermost located node enclosing the subject
|
|
53
|
+
* (`file:line:col`, root-relative — the compiler's `sourceNames`
|
|
54
|
+
* `locations` kind): the subject's own `loc`, else the nearest owner's up
|
|
55
|
+
* the chain (a component root carries its JSX site). Absent when nothing
|
|
56
|
+
* on the chain was compiled with locations. A host event that sets it
|
|
57
|
+
* keeps it.
|
|
58
|
+
*/
|
|
59
|
+
loc?: string;
|
|
49
60
|
data?: Record<string, unknown>;
|
|
50
61
|
}
|
|
51
62
|
/**
|
|
@@ -117,6 +128,21 @@ export interface AttributionSlot {
|
|
|
117
128
|
* navigation it ran for by the identity of the object, not by time.
|
|
118
129
|
*/
|
|
119
130
|
currentOrigin(): ChangeOrigin | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Stamps a flight (a promise or async iterable a computation will await)
|
|
133
|
+
* with when its work really started, before anything reads it. A route
|
|
134
|
+
* preloader, query cache or `lazy()` calls this on what it hands out (on
|
|
135
|
+
* the wrapper it mints, with the original kickoff time), so a reader that
|
|
136
|
+
* meets it later is judged against the real start: work already running
|
|
137
|
+
* when the previous wait landed is parallel, not a waterfall link. The
|
|
138
|
+
* client engine's `ASYNC_WATERFALL` and the server's
|
|
139
|
+
* `SSR_BOUNDARY_WATERFALL` both read these stamps. Earliest wins. Works
|
|
140
|
+
* with no engine installed. `startedAt` is on the `performance.now()`
|
|
141
|
+
* clock and defaults to now.
|
|
142
|
+
*/
|
|
143
|
+
markFlight(flight: object, startedAt?: number): void;
|
|
144
|
+
/** The earliest start `markFlight` declared for `flight`, if any. */
|
|
145
|
+
flightOrigin(flight: object): number | undefined;
|
|
120
146
|
}
|
|
121
147
|
/**
|
|
122
148
|
* The records delivered on `OBSERVE.records`, by type — each entry
|
|
@@ -386,12 +412,14 @@ export interface Dev {
|
|
|
386
412
|
/** Console face of an emitted event — see `reportDiagnostic`. */
|
|
387
413
|
report(entry: DiagnosticEvent): void;
|
|
388
414
|
/**
|
|
389
|
-
* The
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
* the
|
|
393
|
-
*
|
|
394
|
-
*
|
|
415
|
+
* The URL of `code`'s page in the docs — what the finding means and how
|
|
416
|
+
* to fix it, one page per code
|
|
417
|
+
* (`https://v2.solidjs.com/reference/solid-js/diagnostics/<slug>`, slug =
|
|
418
|
+
* the code lowercased with `-` for `_`). The one place the URL is built:
|
|
419
|
+
* the console footer prints it and the performance tracks' Insights link
|
|
420
|
+
* (`learnMoreUrl`) reads it, so both name the same page. Dev-tier: it is
|
|
421
|
+
* guidance for a developer, and a URL string on a retained object is a
|
|
422
|
+
* cost every observe build would pay.
|
|
395
423
|
*/
|
|
396
424
|
guideUrl(code: DiagnosticCode): string;
|
|
397
425
|
}
|
|
@@ -439,17 +467,19 @@ export declare function ownerPath(subject: DiagnosticSubject | null | undefined)
|
|
|
439
467
|
* default (right for the synchronous rule checks — they fire inside the
|
|
440
468
|
* scope that misbehaved); pass the node for scheduler-time findings whose
|
|
441
469
|
* ambient context is the flush, or `null` for events that have no location
|
|
442
|
-
* by nature. An `ownerPath` already on the event wins over the
|
|
443
|
-
* (hosts whose owners are not signals' owners compute their
|
|
444
|
-
* output is a separate, dev-tier step — see `reportDiagnostic`.
|
|
470
|
+
* by nature. An `ownerPath` (or `loc`) already on the event wins over the
|
|
471
|
+
* subject walk (hosts whose owners are not signals' owners compute their
|
|
472
|
+
* own). Console output is a separate, dev-tier step — see `reportDiagnostic`.
|
|
445
473
|
*/
|
|
446
474
|
export declare function emitDiagnostic(event: Omit<DiagnosticEvent, "sequence">, subject?: DiagnosticSubject | null | undefined): DiagnosticEvent;
|
|
447
475
|
/**
|
|
448
476
|
* The console face of a diagnostic — ONE entry per finding: the message, the
|
|
449
477
|
* owner path (`in <App> › <TodoRow> › effect`) so a human can locate it, the
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
478
|
+
* source location (`at src/App.tsx:18:3` — see `locationLine`) when a node on
|
|
479
|
+
* the chain was compiled with one, the once-per-code footer as trailing
|
|
480
|
+
* lines, and — when the subject is a binding effect the rendering runtime
|
|
481
|
+
* tagged — the element it writes, as a second console argument (hover
|
|
482
|
+
* highlights it, click jumps to Elements).
|
|
453
483
|
* Severity picks the console method. Call sites report the entry
|
|
454
484
|
* `emitDiagnostic` returned so the structured and console channels never
|
|
455
485
|
* disagree. Dev-tier: in an observe build this is a no-op, so wiring paths
|
|
@@ -8,6 +8,17 @@ export declare function setSlotUnobserved(fn: (node: Signal<any>) => void): void
|
|
|
8
8
|
export declare function unlinkSubs(link: Link): Link | null;
|
|
9
9
|
export declare function trimStaleDeps(el: Computed<any>): void;
|
|
10
10
|
export declare function clearDeps(el: Computed<unknown>): void;
|
|
11
|
+
/**
|
|
12
|
+
* Last-one-out releases held back while a pass tears down the frame of an
|
|
13
|
+
* earlier pass that never committed (#4142). The pass is about to rebuild
|
|
14
|
+
* the same children, which read the same lazy nodes again. Released on the
|
|
15
|
+
* spot, a lazy async memo whose only reader was the old frame's child memo
|
|
16
|
+
* was torn down, re-ran on the new child's read, went pending, and the cycle
|
|
17
|
+
* repeated forever. `recompute` collects them around that teardown and
|
|
18
|
+
* releases what is still unobserved when the pass ends.
|
|
19
|
+
*/
|
|
20
|
+
export declare let deferredReleases: Computed<any>[] | null;
|
|
21
|
+
export declare const deferReleases: (list: Computed<any>[] | null) => Computed<any>[] | null;
|
|
11
22
|
export declare function unobserved(el: Computed<unknown>): void;
|
|
12
23
|
/**
|
|
13
24
|
* Deferred dormancy for never-observed auto-dispose computeds (#3078).
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @internal The identity of a plain signal named while identities were on. */
|
|
2
|
+
export declare function signalName(node: object | undefined): string | undefined;
|
|
3
|
+
/** @internal Name plain signals from now on (`on`), or stop. */
|
|
4
|
+
export declare function setSignalIdentities(on: boolean): void;
|
|
5
|
+
/**
|
|
6
|
+
* @internal Called with every plain signal `createSignal` makes, and every
|
|
7
|
+
* plain store root `createStore` makes, while set (the namer above). Never
|
|
8
|
+
* set unless `setSignalIdentities` is imported, so a bundle without it keeps
|
|
9
|
+
* only a null check.
|
|
10
|
+
*/
|
|
11
|
+
export declare let signalHook: ((node: object) => void) | null;
|
|
12
|
+
/**
|
|
13
|
+
* @internal Dev only: `watch` is called with every node read while set (the
|
|
14
|
+
* dev hook `onRead`) — the frames client's identity-drift check watches the
|
|
15
|
+
* named signals a deferred occurrence reads as it mounts. A no-op in prod.
|
|
16
|
+
*/
|
|
17
|
+
export declare function setReadWatch(watch: ((node: object) => void) | null): void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { ContextNotFoundError, NoOwnerError, NotReadyError, TimeoutError } from "./error.js";
|
|
2
2
|
export { isPending, latest } from "./verdict.js";
|
|
3
3
|
export { action } from "./action.js";
|
|
4
|
-
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, setMemo, markRefresh, staleValues, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots } from "./core.js";
|
|
4
|
+
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, setWriteHook, setMemo, markRefresh, staleValues, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots } from "./core.js";
|
|
5
5
|
export { enableExternalSource, _resetExternalSourceConfig, type ExternalSourceFactory, type ExternalSource, type ExternalSourceConfig } from "./external.js";
|
|
6
6
|
export { createOwner, createRoot, dispose, getNextChildId, getObserver, getOwner, isDisposed, cleanup, peekNextChildId } from "./owner.js";
|
|
7
|
+
export { setSignalIdentities, signalName, signalHook, setReadWatch } from "./identities.js";
|
|
7
8
|
export { createContext, getContext, setContext, type Context, type ContextRecord } from "./context.js";
|
|
8
9
|
export { handleAsync } from "./async.js";
|
|
9
10
|
export type { Computed, Disposable, Link, Owner, Root, Signal, NodeOptions } from "./types.js";
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
import { laneValueOf } from "./truth.js";
|
|
1
2
|
import { type Transaction } from "./scheduler.js";
|
|
2
3
|
import type { Computed, Signal } from "./types.js";
|
|
3
|
-
|
|
4
|
-
* staging a shown lane holds for its next reveal, else its slot; the
|
|
5
|
-
* committed value while it has none (its first lane pass in flight). */
|
|
6
|
-
export declare function laneValueOf(el: Signal<any> | Computed<any>): unknown;
|
|
4
|
+
export { laneValueOf };
|
|
7
5
|
/** What the screen shows for a lane's node: the lane's value once the lane
|
|
8
6
|
* has revealed, the committed truth before. */
|
|
9
7
|
export declare function display(el: Signal<any> | Computed<any>): unknown;
|
|
@@ -63,9 +63,11 @@ export declare function getOwner(): Owner | null;
|
|
|
63
63
|
/**
|
|
64
64
|
* Low-level: registers `fn` as a disposal callback on the current owner.
|
|
65
65
|
* Most code should use `onCleanup()` from `solid-js`, which adds dev-mode
|
|
66
|
-
* checks. `cleanup()` is the unchecked primitive used by internals
|
|
66
|
+
* checks. `cleanup()` is the unchecked primitive used by internals; `owner`
|
|
67
|
+
* (internal) targets a specific owner's disposal list instead of the ambient
|
|
68
|
+
* one.
|
|
67
69
|
*/
|
|
68
|
-
export declare function cleanup(fn: Disposable): Disposable;
|
|
70
|
+
export declare function cleanup(fn: Disposable, owner?: Owner | null): Disposable;
|
|
69
71
|
/**
|
|
70
72
|
* Returns `true` if the owner has been disposed. Pair with a captured owner
|
|
71
73
|
* to bail out of late callbacks whose surrounding component already
|
|
@@ -128,7 +130,7 @@ export declare function createOwner(options?: {
|
|
|
128
130
|
* const detached = runWithOwner(null, () => createRoot(d => d));
|
|
129
131
|
* ```
|
|
130
132
|
*
|
|
131
|
-
* @description https://
|
|
133
|
+
* @description https://v2.solidjs.com/reference/solid-js/advanced/owner-introspection/create-root
|
|
132
134
|
*/
|
|
133
135
|
export declare function createRoot<T>(init: ((dispose: () => void) => T) | (() => T), options?: {
|
|
134
136
|
id?: string;
|
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
import { type Heap } from "./heap.js";
|
|
2
|
-
import type { Computed, Signal } from "./types.js";
|
|
2
|
+
import type { Computed, Owner, Signal } from "./types.js";
|
|
3
|
+
export declare let laneReadHook: ((c: Computed<any> | null, el: Signal<any> | Computed<any>) => unknown) | null;
|
|
4
|
+
export declare let laneStageHook: ((el: Computed<any>, l: Transaction, create: boolean, errored: boolean | Computed<any>) => boolean) | null;
|
|
5
|
+
export declare let laneOutcomeHook: ((el: Computed<any>, value: unknown, errored: boolean) => boolean) | null;
|
|
6
|
+
export declare let laneWriteHook: (<T>(el: Signal<T> | Computed<T>, v: T) => T) | null;
|
|
7
|
+
export declare let applyGuessesHook: ((parent: Transaction | null) => void) | null;
|
|
8
|
+
export declare let laneSeamsHook: ((leaks: Computed<any>[] | null) => void) | null;
|
|
9
|
+
export declare let laneCorrectionsHook: (() => boolean) | null;
|
|
10
|
+
export declare let endLanesHook: ((u: Transaction) => void) | null;
|
|
11
|
+
export declare let lanesBlockedHook: ((t: Transaction) => boolean) | null;
|
|
12
|
+
export declare function installLaneHooks(read: NonNullable<typeof laneReadHook>, stage: NonNullable<typeof laneStageHook>, outcome: NonNullable<typeof laneOutcomeHook>, write: NonNullable<typeof laneWriteHook>, applyGuesses: NonNullable<typeof applyGuessesHook>, seams: NonNullable<typeof laneSeamsHook>, corrections: NonNullable<typeof laneCorrectionsHook>, end: NonNullable<typeof endLanesHook>, blocked: NonNullable<typeof lanesBlockedHook>): void;
|
|
13
|
+
export declare let catchHook: ((node: Computed<any>, flags: number, error: unknown) => unknown) | null;
|
|
14
|
+
export declare let freshHook: ((node: Computed<any>, held?: unknown) => unknown) | null;
|
|
15
|
+
export declare let hiddenHook: ((r: Computed<any>) => unknown) | null;
|
|
16
|
+
export declare let boundarySeamHook: (() => void) | null;
|
|
17
|
+
export declare let heldRunHook: ((node: Computed<any>) => boolean) | null;
|
|
18
|
+
export declare function installBoundaryHooks(caught: NonNullable<typeof catchHook>, fresh: NonNullable<typeof freshHook>, hidden: NonNullable<typeof hiddenHook>, seam: NonNullable<typeof boundarySeamHook>, heldRun: NonNullable<typeof heldRunHook>): void;
|
|
19
|
+
/** Store (store/store.ts): `park` — the flush parked into `t`: the store
|
|
20
|
+
* materializes and holds the container node of every staging that had none
|
|
21
|
+
* (a staging needs the node as its home only when something can read the
|
|
22
|
+
* frame through it; a hold can); `commit` — fold the pending backings whose
|
|
23
|
+
* container nodes this flush committed (the owned-raw model's one mutation
|
|
24
|
+
* point). */
|
|
25
|
+
export declare let storeParkHook: ((t: Transaction) => void) | null;
|
|
26
|
+
export declare let storeCommitHook: (() => void) | null;
|
|
27
|
+
export declare function installStoreHooks(park: NonNullable<typeof storeParkHook>, commit: NonNullable<typeof storeCommitHook>): void;
|
|
28
|
+
/** `affects()` marks (affects.ts): the releases at a landing and at the seam
|
|
29
|
+
* (ambient marks). */
|
|
30
|
+
export declare let releaseMarksHook: ((nodes: Signal<any>[]) => void) | null;
|
|
31
|
+
export declare let releaseAmbientMarksHook: ((parked: Transaction | null) => void) | null;
|
|
32
|
+
export declare function installMarkHooks(release: NonNullable<typeof releaseMarksHook>, releaseAmbient: NonNullable<typeof releaseAmbientMarksHook>): void;
|
|
33
|
+
/** Verdicts (verdict.ts). */
|
|
34
|
+
export declare let observeFlightHook: ((c: Computed<any>, el: Computed<any>) => boolean) | null;
|
|
35
|
+
export declare function installVerdictHooks(observeFlight: NonNullable<typeof observeFlightHook>): void;
|
|
36
|
+
/** External-source bridge (wired by enableExternalSource(); undefined while
|
|
37
|
+
* no config is active — including after _resetExternalSourceConfig()). */
|
|
38
|
+
export declare let wireExternalSourceHook: ((self: Computed<any>) => void) | undefined;
|
|
39
|
+
export declare let externalUntrackHook: (<T>(fn: () => T) => T) | undefined;
|
|
40
|
+
export declare function setExternalHooks(wire: typeof wireExternalSourceHook, untrack: typeof externalUntrackHook): void;
|
|
3
41
|
export interface Transaction {
|
|
4
42
|
/** Held staged nodes: committed at the landing. For a lane: its guesses
|
|
5
43
|
* and its work (their lane values in `_x._lane`), revealed at the seam. */
|
|
@@ -123,6 +161,11 @@ export declare function holdNode(n: Signal<any>, t: Transaction): void;
|
|
|
123
161
|
* transaction whose `_nodes` it is on (every site that sets one does the
|
|
124
162
|
* other), so a re-pass, a re-landing or a re-staging adds nothing. */
|
|
125
163
|
export declare function list(n: Signal<any>, t: Transaction): void;
|
|
164
|
+
/** The nodes under `owner` a transaction other than `t` holds (boundaries.ts:
|
|
165
|
+
* what an earlier hold staged under a re-armed boundary). */
|
|
166
|
+
export declare function heldUnder(owner: Owner, t: Transaction | null, fn: (n: Computed<any>) => void): void;
|
|
167
|
+
/** `n` leaves the hold it was staged in: its next pass publishes mainline. */
|
|
168
|
+
export declare function unhold(n: Signal<any>): void;
|
|
126
169
|
export declare const dirtyQueue: Heap;
|
|
127
170
|
export declare let clock: number;
|
|
128
171
|
export declare let _hitUnhandledAsync: boolean;
|
|
@@ -189,54 +232,36 @@ export declare class GlobalQueue implements IQueue {
|
|
|
189
232
|
static _update: (el: Computed<unknown>) => void;
|
|
190
233
|
static _dispose: (el: Computed<unknown>, self: boolean, zombie?: boolean) => void;
|
|
191
234
|
static _runEffect: (el: Computed<unknown>) => void;
|
|
192
|
-
static _wireExternalSource: ((self: Computed<any>) => void) | undefined;
|
|
193
|
-
static _externalUntrack: (<T>(fn: () => T) => T) | undefined;
|
|
194
|
-
static _laneRead: ((c: Computed<any> | null, el: Signal<any> | Computed<any>) => unknown) | undefined;
|
|
195
|
-
static _laneStage: ((el: Computed<any>, l: Transaction, create: boolean, errored: boolean | Computed<any>) => boolean) | undefined;
|
|
196
|
-
static _laneOutcome: ((el: Computed<any>, value: unknown, errored: boolean) => boolean) | undefined;
|
|
197
|
-
static _laneWrite: (<T>(el: Signal<T> | Computed<T>, v: T) => T) | undefined;
|
|
198
|
-
static _applyGuesses: ((parent: Transaction | null) => void) | undefined;
|
|
199
235
|
/** A slot node's truth is in flight (its family's derive — store/store.ts). */
|
|
200
236
|
static _slotFlight: ((n: Signal<any>) => boolean) | undefined;
|
|
201
237
|
/** The value a slot node's guess covered: its committed value — a chained
|
|
202
238
|
* link's refreshed from the inner store, whose commits it never learned
|
|
203
239
|
* while the guess served the reads (store/store.ts, §7b). */
|
|
204
240
|
static _slotCovered: ((n: Signal<any>) => unknown) | undefined;
|
|
205
|
-
/**
|
|
206
|
-
*
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
static
|
|
241
|
+
/** The store's row judgment for a guessed slot (optimistic.ts): the truth
|
|
242
|
+
* is the guess's echo when reconcile would write nothing into it. */
|
|
243
|
+
static _echoes: ((guess: unknown, truth: unknown) => boolean) | undefined;
|
|
244
|
+
/** Truth readers (lanes.ts `truthRead`/`truthConfirmed`), installed by the
|
|
245
|
+
* first `until`/`refresh` (signals.ts `watch`). */
|
|
246
|
+
static _truth: ((el: any) => unknown) | undefined;
|
|
247
|
+
static _confirmed: ((l: Transaction) => void) | undefined;
|
|
248
|
+
/** `affects()` on a store (store/affects.ts): a store's node for a key
|
|
249
|
+
* (store/store.ts `getNode`); a bare registration (birth inheritance); a
|
|
250
|
+
* witnessed mark on an untracked probe (verdict.ts). */
|
|
251
|
+
static _storeNode: ((t: any, key: PropertyKey) => Signal<any>) | undefined;
|
|
252
|
+
static _storeWrappable: ((v: unknown) => boolean) | undefined;
|
|
211
253
|
static _mark: ((node: Signal<any> | Computed<any>) => void) | undefined;
|
|
212
254
|
static _witnessMark: (() => void) | undefined;
|
|
213
255
|
/** An older question's truth was held beneath a guess (lanes.ts
|
|
214
256
|
* `laneWrite`): the store re-bases an arrangement guess over it
|
|
215
257
|
* (store/optimistic.ts). */
|
|
216
258
|
static _laneRebase: ((el: Signal<any>, truth: unknown) => void) | undefined;
|
|
217
|
-
static _laneSeams: ((leaks: Computed<any>[] | null) => void) | undefined;
|
|
218
|
-
static _laneCorrections: (() => boolean) | undefined;
|
|
219
|
-
static _endLanes: ((u: Transaction) => void) | undefined;
|
|
220
|
-
static _lanesBlocked: ((t: Transaction) => boolean) | undefined;
|
|
221
259
|
static _verdictLane: ((t: Transaction) => Transaction) | undefined;
|
|
222
|
-
static _observeFlight: ((c: Computed<any>, el: Computed<any>) => boolean) | undefined;
|
|
223
260
|
static _laneGuesses: ((t: Transaction) => Signal<any>[]) | undefined;
|
|
224
|
-
/**
|
|
225
|
-
*
|
|
226
|
-
static
|
|
227
|
-
/** The flush parked into `t`: the store materializes and holds the
|
|
228
|
-
* container node of every staging that had none (store/store.ts — a
|
|
229
|
-
* staging needs the node as its home only when something can read the
|
|
230
|
-
* frame through it; a hold can). */
|
|
231
|
-
static _storePark: ((t: Transaction) => void) | undefined;
|
|
261
|
+
/** `createDeferred` (deferred.ts): a deferred node with a flight up that
|
|
262
|
+
* `c` derives from, if any — a truth reader waits on it. */
|
|
263
|
+
static _lagging: ((c: Computed<any>) => Computed<any> | undefined) | undefined;
|
|
232
264
|
static _marked: ((el: Signal<any> | Computed<any>) => boolean) | undefined;
|
|
233
|
-
static _releaseMarks: ((nodes: Signal<any>[]) => void) | undefined;
|
|
234
|
-
static _releaseAmbientMarks: ((parked: Transaction | null) => void) | undefined;
|
|
235
|
-
static _catch: ((node: Computed<any>, flags: number, error: unknown) => boolean) | undefined;
|
|
236
|
-
static _fresh: ((node: Computed<any>) => unknown) | undefined;
|
|
237
|
-
static _hidden: ((r: Computed<any>) => boolean) | undefined;
|
|
238
|
-
static _boundarySeam: (() => void) | undefined;
|
|
239
|
-
static _heldRun: ((node: Computed<any>) => boolean) | undefined;
|
|
240
265
|
flush(): void;
|
|
241
266
|
/** L2 — the seam: end of the pure phase. Commit this flush's staged nodes,
|
|
242
267
|
* or park them with the transaction the flush joined; then land every
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Transaction } from "./scheduler.js";
|
|
2
|
+
import type { Computed, Signal } from "./types.js";
|
|
3
|
+
/** A lane node's current value: its guess, or the latest it derived — the
|
|
4
|
+
* staging a shown lane holds for its next reveal, else its slot; the
|
|
5
|
+
* committed value while it has none (its first lane pass in flight). */
|
|
6
|
+
export declare function laneValueOf(el: Signal<any> | Computed<any>): unknown;
|
|
7
|
+
/** Truth readers (`until`, `refresh`; CONFIG_AUTHORITATIVE) — pay-for-use:
|
|
8
|
+
* the first one installs these on GlobalQueue (signals.ts `watch`).
|
|
9
|
+
*
|
|
10
|
+
* A truth reader's read of a lane node: the lane's value when it is the
|
|
11
|
+
* truth (#3943), else the truth staged beneath a guess, else the committed
|
|
12
|
+
* value. */
|
|
13
|
+
export declare function truthRead(el: Signal<any> | Computed<any>): unknown;
|
|
14
|
+
/** A guess confirmed: its lane's truth readers re-read — of the lane's
|
|
15
|
+
* derivations too, which may be the truth now (#3943). */
|
|
16
|
+
export declare function truthConfirmed(l: Transaction): void;
|