@solidjs/signals 2.0.0-rc.11 → 2.0.0-rc.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev-shared.js +2056 -3773
- package/dist/dev.attribution.js +159 -91
- package/dist/dev.js +7263 -8384
- package/dist/observe/affects.js +125 -104
- package/dist/observe/boundaries.js +458 -665
- package/dist/observe/core/action.js +63 -66
- package/dist/observe/core/async.js +240 -383
- package/dist/observe/core/attribution-queries.js +1 -1
- package/dist/observe/core/attribution.js +271 -199
- package/dist/observe/core/constants.js +115 -178
- package/dist/observe/core/context.js +3 -3
- package/dist/observe/core/core.js +840 -1428
- package/dist/observe/core/dev.js +41 -18
- package/dist/observe/core/effect.js +75 -86
- package/dist/observe/core/external.js +5 -5
- package/dist/observe/core/graph.js +61 -70
- package/dist/observe/core/heap.js +75 -98
- package/dist/observe/core/invariants.js +1 -34
- package/dist/observe/core/lanes.js +704 -181
- package/dist/observe/core/owner.js +80 -101
- package/dist/observe/core/scheduler.js +708 -1351
- package/dist/observe/core/verdict.js +302 -621
- package/dist/observe/flatten.js +79 -0
- package/dist/observe/index.js +15 -13
- package/dist/observe/map.js +232 -235
- package/dist/observe/reveal.js +212 -0
- package/dist/observe/signals.js +133 -215
- package/dist/observe/store/affects.js +135 -0
- package/dist/observe/store/index.js +29 -24
- package/dist/observe/store/optimistic.js +538 -0
- package/dist/observe/store/projection.js +302 -0
- package/dist/observe/store/reconcile.js +257 -0
- package/dist/observe/store/store.js +1945 -277
- package/dist/observe/store/storePath.js +1 -1
- package/dist/{prod/store/next → observe/store}/target.js +17 -18
- package/dist/observe/store/types.js +73 -0
- package/dist/observe/store/utils.js +1 -13
- package/dist/prod/affects.js +127 -106
- package/dist/prod/boundaries.js +442 -654
- package/dist/prod/core/action.js +71 -74
- package/dist/prod/core/async.js +307 -442
- package/dist/prod/core/constants.js +112 -177
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +852 -1448
- package/dist/prod/core/effect.js +88 -99
- package/dist/prod/core/external.js +5 -5
- package/dist/prod/core/graph.js +61 -70
- package/dist/prod/core/heap.js +75 -98
- package/dist/prod/core/invariants.js +1 -32
- package/dist/prod/core/lanes.js +666 -181
- package/dist/prod/core/owner.js +75 -96
- package/dist/prod/core/scheduler.js +677 -1332
- package/dist/prod/core/verdict.js +297 -621
- package/dist/prod/flatten.js +77 -0
- package/dist/prod/index.js +15 -13
- package/dist/prod/map.js +143 -146
- package/dist/prod/reveal.js +212 -0
- package/dist/prod/signals.js +144 -226
- package/dist/prod/store/affects.js +135 -0
- package/dist/prod/store/index.js +28 -19
- package/dist/prod/store/optimistic.js +533 -0
- package/dist/prod/store/projection.js +295 -0
- package/dist/prod/store/reconcile.js +257 -0
- package/dist/prod/store/store.js +1840 -272
- package/dist/prod/store/storePath.js +1 -1
- package/dist/{observe/store/next → prod/store}/target.js +13 -17
- package/dist/prod/store/types.js +73 -0
- package/dist/prod/store/utils.js +1 -11
- package/dist/types/affects.d.ts +11 -30
- package/dist/types/boundaries.d.ts +62 -176
- package/dist/types/carved.d.ts +1 -0
- package/dist/types/core/action.d.ts +5 -6
- package/dist/types/core/async.d.ts +10 -5
- package/dist/types/core/attribution-hooks.d.ts +48 -1
- package/dist/types/core/attribution.d.ts +29 -9
- package/dist/types/core/constants.d.ts +125 -171
- package/dist/types/core/core.d.ts +104 -264
- package/dist/types/core/dev.d.ts +60 -7
- package/dist/types/core/effect.d.ts +0 -7
- package/dist/types/core/graph.d.ts +7 -1
- package/dist/types/core/heap.d.ts +5 -7
- package/dist/types/core/index.d.ts +6 -6
- package/dist/types/core/invariants.d.ts +0 -29
- package/dist/types/core/lanes.d.ts +65 -87
- package/dist/types/core/owner.d.ts +3 -3
- package/dist/types/core/scheduler.d.ts +249 -331
- package/dist/types/core/types.d.ts +51 -85
- package/dist/types/core/verdict.d.ts +3 -0
- package/dist/types/flatten.d.ts +8 -0
- package/dist/types/index.d.ts +7 -5
- package/dist/types/reveal.d.ts +19 -0
- package/dist/types/signals.d.ts +53 -92
- package/dist/types/store/affects.d.ts +1 -0
- package/dist/types/store/index.d.ts +35 -15
- package/dist/types/store/optimistic.d.ts +23 -0
- package/dist/types/store/projection.d.ts +18 -0
- package/dist/types/store/reconcile.d.ts +3 -0
- package/dist/types/store/store.d.ts +165 -143
- package/dist/types/store/storePath.d.ts +1 -1
- package/dist/types/store/target.d.ts +151 -0
- package/dist/types/store/types.d.ts +84 -0
- package/package.json +1 -1
- package/dist/observe/core/optimistic.js +0 -669
- package/dist/observe/store/next/optimistic.js +0 -717
- package/dist/observe/store/next/projection.js +0 -266
- package/dist/observe/store/next/reconcile.js +0 -375
- package/dist/observe/store/next/store.js +0 -2480
- package/dist/prod/core/optimistic.js +0 -658
- package/dist/prod/store/next/optimistic.js +0 -710
- package/dist/prod/store/next/projection.js +0 -257
- package/dist/prod/store/next/reconcile.js +0 -373
- package/dist/prod/store/next/store.js +0 -2356
- package/dist/types/core/optimistic.d.ts +0 -6
- package/dist/types/store/next/optimistic.d.ts +0 -25
- package/dist/types/store/next/projection.d.ts +0 -27
- package/dist/types/store/next/reconcile.d.ts +0 -10
- package/dist/types/store/next/store.d.ts +0 -143
- package/dist/types/store/next/target.d.ts +0 -196
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export { ContextNotFoundError, NoOwnerError, NotReadyError, TimeoutError } from "./error.js";
|
|
2
|
-
export {
|
|
2
|
+
export { isPending, latest } from "./verdict.js";
|
|
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";
|
|
3
5
|
export { enableExternalSource, _resetExternalSourceConfig, type ExternalSourceFactory, type ExternalSource, type ExternalSourceConfig } from "./external.js";
|
|
4
6
|
export { createOwner, createRoot, dispose, getNextChildId, getObserver, getOwner, isDisposed, cleanup, peekNextChildId } from "./owner.js";
|
|
5
7
|
export { createContext, getContext, setContext, type Context, type ContextRecord } from "./context.js";
|
|
6
8
|
export { handleAsync } from "./async.js";
|
|
7
|
-
export {
|
|
8
|
-
export type { Computed, Disposable, FirewallSignal, Link, Owner, Root, Signal, NodeOptions } from "./types.js";
|
|
9
|
+
export type { Computed, Disposable, Link, Owner, Root, Signal, NodeOptions } from "./types.js";
|
|
9
10
|
export { effect, trackedEffect, type Effect, type TrackedEffect } from "./effect.js";
|
|
10
|
-
export {
|
|
11
|
-
export { flush, Queue, GlobalQueue, enforceLoadingBoundary, resetErrorHalt, type IQueue, type QueueCallback } from "./scheduler.js";
|
|
11
|
+
export { flush, GlobalQueue, enforceLoadingBoundary, resetErrorHalt, type IQueue, type QueueCallback } from "./scheduler.js";
|
|
12
12
|
export type { InteractionRef, NavigationRef } from "./attribution-hooks.js";
|
|
13
13
|
export { ROOT_ERROR_HOOK } from "./scheduler.js";
|
|
14
14
|
export { configureClientErrors, type ClientErrorContext, type ClientErrorHook, type ClientErrorsConfig } from "./error-hooks.js";
|
|
15
|
-
export { DEV, OBSERVE, setConsoleFooter, type AttributionSlot, type Dev, type Observe, type ServerObserve, type Records, type RecordTypes, type HostRecordTypes, type RecordType, type RecordEvent, type RecordLive, type RecordListener, type DevHooks, type DiagnosticCapture, type DiagnosticCode, type DiagnosticEvent, type DiagnosticKind, type DiagnosticListener, type Diagnostics, type DiagnosticSeverity, type DiagnosticSubject } from "./dev.js";
|
|
15
|
+
export { DEV, OBSERVE, setConsoleFooter, type AttributionSlot, type Dev, type Observe, type ServerObserve, type Records, type RecordTypes, type HostRecordTypes, type RecordType, type RecordEvent, type RecordLive, type RecordListener, type RecordSubscribeOptions, type DevHooks, type DiagnosticCapture, type DiagnosticCode, type DiagnosticEvent, type DiagnosticKind, type DiagnosticListener, type Diagnostics, type DiagnosticSeverity, type DiagnosticSubject } from "./dev.js";
|
|
16
16
|
export * from "./constants.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { OptimisticLane } from "./lanes.js";
|
|
2
1
|
import type { Computed, Signal } from "./types.js";
|
|
3
2
|
/**
|
|
4
3
|
* Test-mode invariant checks for the async/transition/lane machinery.
|
|
@@ -17,20 +16,7 @@ import type { Computed, Signal } from "./types.js";
|
|
|
17
16
|
* defines `__TEST__: false`.
|
|
18
17
|
*/
|
|
19
18
|
type AnyNode = Signal<any> | Computed<any>;
|
|
20
|
-
/** Wired by core.ts at module init to avoid import cycles. */
|
|
21
|
-
export declare const InvariantHooks: {
|
|
22
|
-
pendingProbeActive: (() => boolean) | null;
|
|
23
|
-
/** Fresh oracle for what an isPending companion SHOULD read right now. */
|
|
24
|
-
computePendingState: ((node: AnyNode) => boolean) | null;
|
|
25
|
-
};
|
|
26
19
|
export declare function devTrackHeldPending(node: AnyNode): void;
|
|
27
|
-
export declare function devTrackCompanionOwner(node: AnyNode): void;
|
|
28
|
-
/** #3503: a firewall child the store released (unobserved sweep) leaves the
|
|
29
|
-
* registry with it — the runtime drops it from `_companionChildren` so the
|
|
30
|
-
* projection stops retaining it; the test-only set must not either. */
|
|
31
|
-
export declare function devUntrackCompanionOwner(node: AnyNode): void;
|
|
32
|
-
export declare function devTrackOptimistic(node: AnyNode): void;
|
|
33
|
-
export declare function devTrackAffects(node: AnyNode): void;
|
|
34
20
|
/**
|
|
35
21
|
* Open/close the sanctioned registration window. Call sites are `__DEV__`
|
|
36
22
|
* guarded (no prod cost); the code inside the window must not throw.
|
|
@@ -38,21 +24,6 @@ export declare function devTrackAffects(node: AnyNode): void;
|
|
|
38
24
|
export declare function beginAsyncReporterWrites(): void;
|
|
39
25
|
export declare function endAsyncReporterWrites(): void;
|
|
40
26
|
export declare function createAsyncReporters(): Map<Computed<any>, Set<Computed<any>>>;
|
|
41
|
-
/**
|
|
42
|
-
* INV-2: a node with an *active* override must be registered for reversion in
|
|
43
|
-
* the queue's or a transition's `_optimisticNodes`. An unregistered active
|
|
44
|
-
* override would survive transition completion forever. Runs at the end of
|
|
45
|
-
* every flush (not just quiescence — the invariant holds mid-transition).
|
|
46
|
-
* (There is no revert-target requirement: authoritative values commit
|
|
47
|
-
* silently into `_value` under the override mask — A17 — so reverting is
|
|
48
|
-
* just dropping the override.)
|
|
49
|
-
*/
|
|
50
|
-
export declare function devCheckActiveOverrides(isRegisteredForRevert: (node: AnyNode) => boolean): void;
|
|
51
|
-
/** INV-1: an isPending() probe must never leak past its own call. */
|
|
52
|
-
export declare function devCheckFlushStart(): void;
|
|
53
|
-
/** INV-5: a merged lane's work moved to its root on merge and must stay empty. */
|
|
54
|
-
export declare function devCheckMergedLaneEmpty(lane: OptimisticLane): void;
|
|
55
|
-
export declare function devCensusCompanions(isQueuedForCommit?: (node: AnyNode) => boolean): void;
|
|
56
27
|
/**
|
|
57
28
|
* Quiescence checks. Run only when the system is fully drained: nothing
|
|
58
29
|
* scheduled, no active/stashed transitions, no live lanes. At that point no
|
|
@@ -1,88 +1,66 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { hasActiveOverride };
|
|
3
|
-
import { type QueueCallback, type Transition } from "./scheduler.js";
|
|
1
|
+
import { type Transaction } from "./scheduler.js";
|
|
4
2
|
import type { Computed, Signal } from "./types.js";
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export declare
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* (#3334)
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
|
|
69
|
-
export declare function readsHeldCommitted(owner: Computed<any>, c: Computed<any>): boolean;
|
|
70
|
-
/** The ownership relation for a lane hold (core `ownsHold`, §6 ruling 2): the
|
|
71
|
-
* running pass owns `lane`'s hold if it runs under the transition that owns
|
|
72
|
-
* the lane (the node's, resolved through override ownership and merges) or
|
|
73
|
-
* inside the lane itself. */
|
|
74
|
-
export declare function ownsLane(lane: OptimisticLane, owner: Computed<any>): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Merge two lanes when their dependency graphs overlap.
|
|
77
|
-
*/
|
|
78
|
-
export declare function mergeLanes(lane1: OptimisticLane, lane2: OptimisticLane): OptimisticLane;
|
|
79
|
-
/**
|
|
80
|
-
* Resolve a node's lane: follow union-find chain, verify active, clear if stale.
|
|
81
|
-
*/
|
|
82
|
-
export declare function resolveLane(el: Signal<any> | Computed<any>): OptimisticLane | undefined;
|
|
83
|
-
export declare function resolveTransition(el: Signal<any> | Computed<any>): Transition | null | undefined;
|
|
84
|
-
/**
|
|
85
|
-
* Assign or merge a lane onto a node. At convergence points (node already has
|
|
86
|
-
* a different active lane), merge unless the node has an active override.
|
|
87
|
-
*/
|
|
88
|
-
export declare function assignOrMergeLane(el: Signal<any> | Computed<any>, sourceLane: OptimisticLane): void;
|
|
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
|
+
/** What the screen shows for a lane's node: the lane's value once the lane
|
|
8
|
+
* has revealed, the committed truth before. */
|
|
9
|
+
export declare function display(el: Signal<any> | Computed<any>): unknown;
|
|
10
|
+
/** What the writer sees of a node: an unflushed guess to it, else the
|
|
11
|
+
* lane's value or the committed one — what an optimistic updater composes
|
|
12
|
+
* on (a store setter's draft too, store/optimistic.ts). */
|
|
13
|
+
export declare function guessedValueOf<T>(n: Signal<T> | Computed<T>): T;
|
|
14
|
+
/** The unflushed guess to `n`, else NOT_PENDING. */
|
|
15
|
+
export declare function pendingGuessOf(n: Signal<any> | Computed<any>): unknown;
|
|
16
|
+
export declare function optimisticWrite<T>(n: Signal<T> | Computed<T>, v: T | ((prev: T) => T)): T;
|
|
17
|
+
/** The running pass read lane `l`'s work as a derivation: it is `l`'s — or,
|
|
18
|
+
* already another lane's, the frame it computes derives from both guesses
|
|
19
|
+
* and cannot show one without the other (#3335, A15 for lanes): the two
|
|
20
|
+
* lanes are linked — one reveal unit, each blocked while any is — while
|
|
21
|
+
* their lifetimes stay their own (#2912: a guess reverts with its own
|
|
22
|
+
* action, not with the one it shares a reader with). A nested lane reading
|
|
23
|
+
* through an ancestor's guess stays its own (the screen plus its own
|
|
24
|
+
* guesses). */
|
|
25
|
+
export declare function enterLane(l: Transaction, c: Computed<any>): void;
|
|
26
|
+
/** Verdicts (maintainer, 2026-10-01): `isPending` and `latest` are
|
|
27
|
+
* optimistic state the system supplies — a verdict is a guess ("pending,
|
|
28
|
+
* until this lands"; "the proposal is the value") decided at the seam like
|
|
29
|
+
* a user's, and its readers break out of the hold the same way: work of a
|
|
30
|
+
* lane under the holder, shown now, re-derived at the landing, ending with
|
|
31
|
+
* it. Judged at the seam like any lane: blocked while a verdict reader's
|
|
32
|
+
* own derivation is in flight (lane rule 3), shown otherwise. */
|
|
33
|
+
export declare function verdictLane(t: Transaction): Transaction;
|
|
34
|
+
/** A lane pass's node (core.ts `recompute`, before its staging; a pending
|
|
35
|
+
* propagation under a lane pass, async.ts): listed, carrying the lane's
|
|
36
|
+
* value from now (a derivation of a guess — its readers become lane work).
|
|
37
|
+
* Entering the lane supersedes a frame staging the node carried: this
|
|
38
|
+
* pass's answer replaces it, and the frame's hold on it is over. An
|
|
39
|
+
* effect's value slot is private (no lane value). A pass in a lane's seat
|
|
40
|
+
* that read none of the lane's world has left it (false): its result is the
|
|
41
|
+
* frame's — a derivation whose branch no longer reaches the guess — and no
|
|
42
|
+
* hold the lane took over from a transaction stays on it (#3698: lane work
|
|
43
|
+
* never makes its node transaction work; a born-held effect's hold went to
|
|
44
|
+
* the lane). A pass interrupted before it got there (pending, errored) did
|
|
45
|
+
* not leave (A30: it never got there). A first pass under a lane is the
|
|
46
|
+
* lane's (ruling A); a guess is written, not derived — it never leaves this
|
|
47
|
+
* way. `errored`: the pass has no answer — or, a lane pass's pending
|
|
48
|
+
* propagation (async.ts `propagateStatus`), the node gone pending. */
|
|
49
|
+
export declare function laneStage(el: Computed<any>, l: Transaction, create: boolean, errored: boolean | Computed<any>): boolean;
|
|
50
|
+
export declare function supersede(n: Signal<any> | Computed<any>, value: unknown, changed: boolean): void;
|
|
51
|
+
/** Lanes. A lane's node is read by its reader's kind: an authoritative
|
|
52
|
+
* reader (`until`) sees the truth — staged beneath a guess, else committed
|
|
53
|
+
* — and is no lane's; an untracked read sees the lane's latest value (A17:
|
|
54
|
+
* "direct read shows optimistic"; A28); a children-forbidden reader sees
|
|
55
|
+
* the frame (A32). A render effect in the frame's seat reading a lane the
|
|
56
|
+
* seam found blocked, or a member whose own flight is up (held or not — the
|
|
57
|
+
* lane-membership ruling, 2026-10-05), sees the screen, re-derived at the
|
|
58
|
+
* reveal (#3460's stale reader) — or, the node a
|
|
59
|
+
* flight that has never shown (nothing to show), waits on it: its own frame
|
|
60
|
+
* holds (A15, #3334), not the lane's parent. Any other tracked reader is
|
|
61
|
+
* the lane's work from this read — a derivation; a leaf reading a lane that
|
|
62
|
+
* has shown, or one the seam has not judged yet (its run waits on the
|
|
63
|
+
* verdict: released if the lane shows, held if it blocks) — and sees the
|
|
64
|
+
* lane's latest. NOT_PENDING falls through: lane work's read of a pending
|
|
65
|
+
* member throws like any. */
|
|
66
|
+
export declare function laneRead(c: Computed<any> | null, el: Signal<any> | Computed<any>): unknown;
|
|
@@ -67,9 +67,9 @@ export declare function getOwner(): Owner | null;
|
|
|
67
67
|
*/
|
|
68
68
|
export declare function cleanup(fn: Disposable): Disposable;
|
|
69
69
|
/**
|
|
70
|
-
* Returns `true` if the owner has been disposed
|
|
71
|
-
*
|
|
72
|
-
*
|
|
70
|
+
* Returns `true` if the owner has been disposed. Pair with a captured owner
|
|
71
|
+
* to bail out of late callbacks whose surrounding component already
|
|
72
|
+
* unmounted.
|
|
73
73
|
*
|
|
74
74
|
* @example
|
|
75
75
|
* ```ts
|