@solidjs/signals 2.0.0-rc.15 → 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 +785 -367
- package/dist/dev.attribution.js +75 -52
- package/dist/dev.js +1120 -567
- package/dist/observe/affects-marks.js +86 -0
- package/dist/observe/affects.js +22 -73
- package/dist/observe/boundaries.js +191 -189
- package/dist/observe/core/async.js +175 -131
- package/dist/observe/core/attribution-queries.js +1 -1
- package/dist/observe/core/attribution.js +176 -159
- package/dist/observe/core/constants.js +17 -3
- package/dist/observe/core/context.js +3 -3
- package/dist/observe/core/core.js +503 -363
- package/dist/observe/core/dev.js +66 -38
- package/dist/observe/core/effect.js +48 -48
- package/dist/observe/core/error.js +5 -3
- package/dist/observe/core/external.js +5 -6
- package/dist/observe/core/graph.js +57 -43
- package/dist/observe/core/heap.js +33 -33
- package/dist/observe/core/identities.js +62 -0
- package/dist/observe/core/lanes.js +226 -259
- package/dist/observe/core/owner.js +62 -50
- package/dist/observe/core/scheduler.js +319 -171
- package/dist/observe/core/truth.js +45 -0
- package/dist/observe/core/verdict.js +88 -50
- package/dist/observe/deferred.js +184 -0
- package/dist/observe/index.js +7 -1
- package/dist/observe/map.js +345 -260
- package/dist/observe/reveal.js +76 -76
- package/dist/observe/signals.js +41 -30
- package/dist/observe/store/affects.js +6 -6
- package/dist/observe/store/edges.js +39 -0
- package/dist/observe/store/optimistic.js +41 -36
- package/dist/observe/store/projection.js +68 -55
- package/dist/observe/store/store.js +157 -104
- package/dist/prod/affects-marks.js +86 -0
- package/dist/prod/affects.js +23 -72
- package/dist/prod/boundaries.js +155 -153
- package/dist/prod/core/async.js +171 -127
- package/dist/prod/core/constants.js +17 -3
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +478 -342
- package/dist/prod/core/effect.js +68 -68
- package/dist/prod/core/error.js +5 -3
- package/dist/prod/core/external.js +5 -6
- package/dist/prod/core/graph.js +57 -43
- package/dist/prod/core/heap.js +38 -38
- package/dist/prod/core/identities.js +62 -0
- package/dist/prod/core/lanes.js +217 -250
- package/dist/prod/core/owner.js +62 -51
- package/dist/prod/core/scheduler.js +310 -162
- package/dist/prod/core/truth.js +45 -0
- package/dist/prod/core/verdict.js +87 -49
- package/dist/prod/deferred.js +182 -0
- package/dist/prod/index.js +7 -1
- package/dist/prod/map.js +360 -275
- package/dist/prod/reveal.js +76 -76
- package/dist/prod/signals.js +41 -30
- package/dist/prod/store/affects.js +6 -6
- package/dist/prod/store/edges.js +39 -0
- package/dist/prod/store/optimistic.js +37 -33
- package/dist/prod/store/projection.js +25 -19
- package/dist/prod/store/store.js +142 -96
- package/dist/types/affects-marks.d.ts +14 -0
- package/dist/types/boundaries.d.ts +1 -1
- package/dist/types/core/async.d.ts +10 -0
- package/dist/types/core/constants.d.ts +13 -1
- package/dist/types/core/core.d.ts +44 -2
- 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 -14
- package/dist/types/core/owner.d.ts +5 -3
- package/dist/types/core/scheduler.d.ts +47 -28
- package/dist/types/core/truth.d.ts +16 -0
- package/dist/types/core/types.d.ts +21 -0
- 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/edges.d.ts +9 -0
- package/dist/types/store/index.d.ts +10 -3
- 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 +1 -1
- package/dist/types/store/target.d.ts +16 -8
- package/dist/types/store/types.d.ts +14 -0
- package/package.json +1 -1
|
@@ -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`). */
|
|
@@ -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>;
|
|
@@ -116,6 +116,9 @@ export declare const CONFIG_SLOT_NODE: number;
|
|
|
116
116
|
* leaf twin of REACTIVE_MANUAL_WRITE). Set by the user setter, cleared by
|
|
117
117
|
* the derive's own write to the key. */
|
|
118
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;
|
|
119
122
|
/** Lanes — the node carries a written guess (`optimisticWrite`): its own
|
|
120
123
|
* source recomputing it, or a plain write landing on it, is the truth
|
|
121
124
|
* (`supersede`). A lane's derived staging is not. */
|
|
@@ -124,7 +127,9 @@ export declare const CONFIG_GUESS: number;
|
|
|
124
127
|
* pending is a question for its next pass — the verdict changed — so the
|
|
125
128
|
* propagation re-derives it instead of marking it pending (as a kept-tail
|
|
126
129
|
* link does, A30). Set at the window, never cleared: a reader that stopped
|
|
127
|
-
* 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. */
|
|
128
133
|
export declare const CONFIG_VERDICT: number;
|
|
129
134
|
/** A dependency's status is a question for this node's pass, not a fact
|
|
130
135
|
* about its current one: the propagation re-derives it instead of marking
|
|
@@ -133,6 +138,10 @@ export declare const CONFIG_VERDICT: number;
|
|
|
133
138
|
* promise over an expression (`resolve`/`until`, signals.ts: the pass reads
|
|
134
139
|
* the error and rejects, or re-asks a pending source). */
|
|
135
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;
|
|
136
145
|
/** The reader wants the truth, not the lane's guess (`until`, signals.ts):
|
|
137
146
|
* a read of displayed optimism serves the base the guess covers, makes the
|
|
138
147
|
* pass no lane's, and the truth landing wakes it even when it confirms the
|
|
@@ -180,6 +189,9 @@ export declare const STATUS_NONE = 0;
|
|
|
180
189
|
export declare const STATUS_PENDING: number;
|
|
181
190
|
export declare const STATUS_ERROR: number;
|
|
182
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;
|
|
183
195
|
export declare const EFFECT_PURE = 0;
|
|
184
196
|
export declare const EFFECT_RENDER = 1;
|
|
185
197
|
export declare const EFFECT_USER = 2;
|
|
@@ -83,7 +83,8 @@ export declare function isEqual<T>(a: T, b: T): boolean;
|
|
|
83
83
|
* object, no NodeExtension, no post-construction expandos. `ownedWrite` is
|
|
84
84
|
* baked in: the setter carries the owned-scope guard; node-level writes are
|
|
85
85
|
* the store's notification machinery. The observe literal adds the label
|
|
86
|
-
*
|
|
86
|
+
* and location slots (the store relabels `store.<key>` and stamps the
|
|
87
|
+
* store's `loc` when the engine is installed). */
|
|
87
88
|
export declare function slotSignal<T>(v: T, equals: (a: T, b: T) => boolean, host: object, key: PropertyKey, acc: boolean): Signal<T>;
|
|
88
89
|
/**
|
|
89
90
|
* When set to a component name string, any reactive read that is not inside a nested tracking
|
|
@@ -110,7 +111,11 @@ export declare function enterCallback(): void;
|
|
|
110
111
|
export declare function exitCallback(): void;
|
|
111
112
|
/**
|
|
112
113
|
* Dev-only: > 0 while owner teardown runs cleanups (`_disposal` entries and
|
|
113
|
-
* 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
|
|
114
119
|
* `callbackDepth` because its sites cannot use try/finally (the frame would
|
|
115
120
|
* survive into prod): a throwing cleanup leaves it raised, and dev.ts resets
|
|
116
121
|
* it on the next microtask, which teardown — synchronous — never spans.
|
|
@@ -127,6 +132,16 @@ export declare function setStrictRead(v: string | false): string | false;
|
|
|
127
132
|
* Use `untrack` inside a memo or effect when you need to read a signal once
|
|
128
133
|
* without making the surrounding computation depend on its future changes.
|
|
129
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
|
+
*
|
|
130
145
|
* Pass a `strictReadLabel` string to enable a dev-mode warning: any reactive
|
|
131
146
|
* read inside `fn` that isn't inside a nested tracking scope will log a
|
|
132
147
|
* warning naming the label.
|
|
@@ -140,6 +155,9 @@ export declare function setStrictRead(v: string | false): string | false;
|
|
|
140
155
|
* log(snapshot);
|
|
141
156
|
* }
|
|
142
157
|
* );
|
|
158
|
+
*
|
|
159
|
+
* const color = createMemo<string>(() => fetchColor(), { loadingValue: "gray" });
|
|
160
|
+
* const initialColor = untrack(color); // "gray" while the fetch is unresolved
|
|
143
161
|
* ```
|
|
144
162
|
*/
|
|
145
163
|
export declare function untrack<T>(fn: () => T, strictReadLabel?: string | false): T;
|
|
@@ -256,6 +274,30 @@ export declare function notePromotedWrite(el: Signal<any> | Computed<any>): void
|
|
|
256
274
|
* reason. Firewall leaves belong to a projection whose compute is the tree's
|
|
257
275
|
* own work, captured (or deliberately not) at creation. */
|
|
258
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;
|
|
259
301
|
export declare function setSignal<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)): T;
|
|
260
302
|
/**
|
|
261
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;
|
|
@@ -48,16 +46,6 @@ export declare function verdictLane(t: Transaction): Transaction;
|
|
|
48
46
|
* propagation (async.ts `propagateStatus`), the node gone pending. */
|
|
49
47
|
export declare function laneStage(el: Computed<any>, l: Transaction, create: boolean, errored: boolean | Computed<any>): boolean;
|
|
50
48
|
export declare function supersede(n: Signal<any> | Computed<any>, value: unknown, changed: boolean): void;
|
|
51
|
-
/** Truth readers (`until`, `refresh`; CONFIG_AUTHORITATIVE) — pay-for-use:
|
|
52
|
-
* the first one installs these on GlobalQueue (signals.ts `watch`).
|
|
53
|
-
*
|
|
54
|
-
* A truth reader's read of a lane node: the lane's value when it is the
|
|
55
|
-
* truth (#3943), else the truth staged beneath a guess, else the committed
|
|
56
|
-
* value. */
|
|
57
|
-
export declare function truthRead(el: Signal<any> | Computed<any>): unknown;
|
|
58
|
-
/** A guess confirmed: its lane's truth readers re-read — of the lane's
|
|
59
|
-
* derivations too, which may be the truth now (#3943). */
|
|
60
|
-
export declare function truthConfirmed(l: Transaction): void;
|
|
61
49
|
/** Lanes. A lane's node is read by its reader's kind: an authoritative
|
|
62
50
|
* reader (`until`) sees the truth — staged beneath a guess, else committed
|
|
63
51
|
* — and is no lane's; an untracked read sees the lane's latest value (A17:
|
|
@@ -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,13 +232,6 @@ 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
|
|
@@ -220,29 +256,12 @@ export declare class GlobalQueue implements IQueue {
|
|
|
220
256
|
* `laneWrite`): the store re-bases an arrangement guess over it
|
|
221
257
|
* (store/optimistic.ts). */
|
|
222
258
|
static _laneRebase: ((el: Signal<any>, truth: unknown) => void) | undefined;
|
|
223
|
-
static _laneSeams: ((leaks: Computed<any>[] | null) => void) | undefined;
|
|
224
|
-
static _laneCorrections: (() => boolean) | undefined;
|
|
225
|
-
static _endLanes: ((u: Transaction) => void) | undefined;
|
|
226
|
-
static _lanesBlocked: ((t: Transaction) => boolean) | undefined;
|
|
227
259
|
static _verdictLane: ((t: Transaction) => Transaction) | undefined;
|
|
228
|
-
static _observeFlight: ((c: Computed<any>, el: Computed<any>) => boolean) | undefined;
|
|
229
260
|
static _laneGuesses: ((t: Transaction) => Signal<any>[]) | undefined;
|
|
230
|
-
/**
|
|
231
|
-
*
|
|
232
|
-
static
|
|
233
|
-
/** The flush parked into `t`: the store materializes and holds the
|
|
234
|
-
* container node of every staging that had none (store/store.ts — a
|
|
235
|
-
* staging needs the node as its home only when something can read the
|
|
236
|
-
* frame through it; a hold can). */
|
|
237
|
-
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;
|
|
238
264
|
static _marked: ((el: Signal<any> | Computed<any>) => boolean) | undefined;
|
|
239
|
-
static _releaseMarks: ((nodes: Signal<any>[]) => void) | undefined;
|
|
240
|
-
static _releaseAmbientMarks: ((parked: Transaction | null) => void) | undefined;
|
|
241
|
-
static _catch: ((node: Computed<any>, flags: number, error: unknown) => boolean) | undefined;
|
|
242
|
-
static _fresh: ((node: Computed<any>) => unknown) | undefined;
|
|
243
|
-
static _hidden: ((r: Computed<any>) => boolean) | undefined;
|
|
244
|
-
static _boundarySeam: (() => void) | undefined;
|
|
245
|
-
static _heldRun: ((node: Computed<any>) => boolean) | undefined;
|
|
246
265
|
flush(): void;
|
|
247
266
|
/** L2 — the seam: end of the pure phase. Commit this flush's staged nodes,
|
|
248
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;
|
|
@@ -20,6 +20,13 @@ export interface Link {
|
|
|
20
20
|
export interface NodeOptions<T> {
|
|
21
21
|
id?: string;
|
|
22
22
|
name?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Source location (`file:line:col`, root-relative) written by the
|
|
25
|
+
* compiler's `sourceNames` `locations` kind; dev and observe builds keep it
|
|
26
|
+
* for console reports and diagnostic events, production ignores it. Not
|
|
27
|
+
* meant to be written by hand.
|
|
28
|
+
*/
|
|
29
|
+
loc?: string;
|
|
23
30
|
transparent?: boolean;
|
|
24
31
|
equals?: ((prev: T, next: T) => boolean) | false;
|
|
25
32
|
ownedWrite?: boolean;
|
|
@@ -108,6 +115,11 @@ export interface NodeExtension {
|
|
|
108
115
|
* changes — `isPending` reads true for it and its derivations while any
|
|
109
116
|
* is live. A count, never a hold. */
|
|
110
117
|
_marks: number;
|
|
118
|
+
/** D-41: the error a node showed when a re-ask made it pending — still
|
|
119
|
+
* the display (D-39) until a new answer commits: an untracked read throws
|
|
120
|
+
* it, `isPending` reads a staged answer as a change over it, and a
|
|
121
|
+
* recovery equal to the last good value is still a new answer. */
|
|
122
|
+
_shownError: unknown;
|
|
111
123
|
}
|
|
112
124
|
export interface RawSignal<T> {
|
|
113
125
|
_subs: Link | null;
|
|
@@ -141,6 +153,8 @@ export type Signal<T> = RawSignal<T>;
|
|
|
141
153
|
export interface Owner {
|
|
142
154
|
id?: string;
|
|
143
155
|
_config: number;
|
|
156
|
+
/** Lifecycle flags (REACTIVE_*); roots carry only REACTIVE_DISPOSED. */
|
|
157
|
+
_flags: number;
|
|
144
158
|
_snapshotScope?: boolean;
|
|
145
159
|
/** Effect-returned cleanup; managed across reruns, invoked at true disposal */
|
|
146
160
|
_cleanup?: () => void;
|
|
@@ -159,6 +173,13 @@ export interface Owner {
|
|
|
159
173
|
* (`<App>`). A slot in the observe/dev literals; absent from prod.
|
|
160
174
|
*/
|
|
161
175
|
_name?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Observe-tier source location (`file:line:col`): the `loc` option, or
|
|
178
|
+
* the JSX site the rendering layer writes on a component root. A slot
|
|
179
|
+
* beside `_name`; absent from prod. Reserved from property mangling, like
|
|
180
|
+
* `_name`, because solid-js writes it and the core's diagnostics read it.
|
|
181
|
+
*/
|
|
182
|
+
_loc?: string;
|
|
162
183
|
}
|
|
163
184
|
export interface Computed<T> extends RawSignal<T>, Owner {
|
|
164
185
|
_deps: Link | null;
|
|
@@ -2,4 +2,36 @@
|
|
|
2
2
|
* restores the dispatch it found — none inside a memo's pass a window
|
|
3
3
|
* pulled (`verdictValue`). */
|
|
4
4
|
export declare function latest<T>(fn: () => T): T;
|
|
5
|
+
/**
|
|
6
|
+
* Reports whether what `fn` reads is still waiting on an update. Read the
|
|
7
|
+
* values in question inside `fn`: the probe answers `true` while any of
|
|
8
|
+
* them depends on a change that is in flight — a write or an async source
|
|
9
|
+
* that has started producing a new value whose result has not landed yet —
|
|
10
|
+
* and `false` once the latest value is the one on screen. The answer is
|
|
11
|
+
* tracked like any read, so a memo or effect that calls `isPending` re-runs
|
|
12
|
+
* when it flips.
|
|
13
|
+
*
|
|
14
|
+
* A read that has no value yet is loading, not pending: inside `fn` it
|
|
15
|
+
* follows the surrounding `Loading` path like any other read, and the probe
|
|
16
|
+
* reports only updates to a value that already exists. A bare `refresh()`
|
|
17
|
+
* does not flip `isPending`; pair it with `affects()` to make the re-ask
|
|
18
|
+
* visible.
|
|
19
|
+
*
|
|
20
|
+
* @param fn expression to probe; read the values in question inside it
|
|
21
|
+
*
|
|
22
|
+
* @returns `true` while a read inside `fn` depends on a change that has not committed yet
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const [query, setQuery] = createSignal("");
|
|
27
|
+
* const results = createMemo(() => searchProducts(query()));
|
|
28
|
+
* const stale = createMemo(() => isPending(results));
|
|
29
|
+
*
|
|
30
|
+
* setQuery("shoes");
|
|
31
|
+
* // stale() is true until the new results land, while results() keeps
|
|
32
|
+
* // serving the previous list — dim it instead of showing a spinner.
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @description https://v2.solidjs.com/reference/solid-js/reactivity/is-pending
|
|
36
|
+
*/
|
|
5
37
|
export declare function isPending(fn: () => any): boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type MemoOptions, type SourceAccessor } from "./signals.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates an async memo that may lag, but never leads. Before its first
|
|
4
|
+
* answer it is an ordinary async memo: readers suspend to the nearest
|
|
5
|
+
* `<Loading>`. After it, a refetch holds nothing: readers keep the last
|
|
6
|
+
* committed value until the new one lands, and the rest of the screen moves
|
|
7
|
+
* on without it. `isPending` reports the refetch, on the node and on what
|
|
8
|
+
* derives from it. Use it for independent widgets (dashboards, feeds,
|
|
9
|
+
* search results) where the previous answer with a "refreshing" indicator is
|
|
10
|
+
* better than waiting with everything else.
|
|
11
|
+
*
|
|
12
|
+
* - It never shows a value ahead of a held change: a refetch that read a
|
|
13
|
+
* held value lands with that hold.
|
|
14
|
+
* - A rejected refetch errors like any memo; the stale value never masks it.
|
|
15
|
+
* - `refresh(d)` is a quiet re-ask, and `await refresh(d)` and `until`
|
|
16
|
+
* wait for the landing rather than the stale value.
|
|
17
|
+
* - Combine with `loadingValue` for a node that never suspends at all.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const rows = createDeferred(() => fetchRows(store.period));
|
|
22
|
+
*
|
|
23
|
+
* <section class={{ stale: isPending(() => rows()) }}>
|
|
24
|
+
* <For each={rows()}>{row => <Row row={row} />}</For>
|
|
25
|
+
* </section>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function createDeferred<T>(fn: (prev?: T) => T | PromiseLike<T> | AsyncIterable<T>, options?: MemoOptions<T>): SourceAccessor<T>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ export { $REFRESH, action, ContextNotFoundError, NoOwnerError, NotReadyError, Ti
|
|
|
5
5
|
* outside dev builds.
|
|
6
6
|
*/
|
|
7
7
|
export { setConsoleFooter } from "./core/index.js";
|
|
8
|
+
/** @internal The pre-write hook (`setWriteHook` in core/core.ts); the server-components client's deferred hydration. */
|
|
9
|
+
/** @internal Plain-signal identities and the dev read watch (dependency edges; the server-components client). */
|
|
10
|
+
export { setWriteHook, setSignalIdentities, setReadWatch, signalName } from "./core/index.js";
|
|
11
|
+
/** @internal Store dependency edges: the name a store proxy's writes go by (the server-components client). */
|
|
12
|
+
export { storeName } from "./store/edges.js";
|
|
8
13
|
import { type Dev, type Observe } from "./core/index.js";
|
|
9
14
|
/**
|
|
10
15
|
* Observe tier (diagnostics channel, attribution hook slot + interaction
|
|
@@ -20,6 +25,7 @@ export type { Truthy, UntilOptions, Accessor, SourceAccessor, Setter, Signal, Co
|
|
|
20
25
|
export { mapArray, repeat, type Maybe } from "./map.js";
|
|
21
26
|
export * from "./store/index.js";
|
|
22
27
|
export { affects } from "./affects.js";
|
|
28
|
+
export { createDeferred } from "./deferred.js";
|
|
23
29
|
export { flatten } from "./flatten.js";
|
|
24
30
|
export { createLoadingBoundary, createErrorBoundary } from "./boundaries.js";
|
|
25
31
|
export { createRevealOrder, type RevealOrder } from "./reveal.js";
|