@solidjs/signals 2.0.0-rc.2 → 2.0.0-rc.20
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 +6505 -0
- package/dist/dev.attribution.js +3484 -0
- package/dist/dev.js +10227 -9508
- package/dist/observe/affects-marks.js +86 -0
- package/dist/observe/affects.js +112 -0
- package/dist/observe/attribution.js +7 -0
- package/dist/observe/boundaries.js +696 -0
- package/dist/observe/core/action.js +182 -0
- package/dist/observe/core/async.js +824 -0
- package/dist/observe/core/attribution-costs.js +66 -0
- package/dist/observe/core/attribution-feedback.js +280 -0
- package/dist/observe/core/attribution-hooks.js +83 -0
- package/dist/observe/core/attribution-queries.js +43 -0
- package/dist/observe/core/attribution.js +3079 -0
- package/dist/observe/core/constants.js +269 -0
- package/dist/observe/core/context.js +63 -0
- package/dist/observe/core/copies.js +10 -0
- package/dist/observe/core/core.js +1707 -0
- package/dist/observe/core/dev.js +394 -0
- package/dist/observe/core/effect.js +193 -0
- package/dist/observe/core/error-hooks.js +71 -0
- package/dist/observe/core/error.js +82 -0
- package/dist/observe/core/external.js +97 -0
- package/dist/observe/core/graph.js +162 -0
- package/dist/observe/core/heap.js +124 -0
- package/dist/observe/core/identities.js +62 -0
- package/dist/observe/core/invariants.js +12 -0
- package/dist/observe/core/lanes.js +972 -0
- package/dist/observe/core/owner.js +371 -0
- package/dist/observe/core/scheduler.js +1157 -0
- package/dist/observe/core/truth.js +47 -0
- package/dist/observe/core/verdict.js +470 -0
- package/dist/observe/deferred.js +186 -0
- package/dist/observe/flatten.js +79 -0
- package/dist/observe/from.js +248 -0
- package/dist/observe/index.js +71 -0
- package/dist/observe/map.js +593 -0
- package/dist/observe/reveal.js +212 -0
- package/dist/observe/signals.js +717 -0
- package/dist/observe/store/affects.js +142 -0
- package/dist/observe/store/edges.js +39 -0
- package/dist/observe/store/hooks.js +16 -0
- package/dist/observe/store/index.js +47 -0
- package/dist/observe/store/optimistic.js +713 -0
- package/dist/observe/store/projection.js +345 -0
- package/dist/observe/store/reconcile.js +281 -0
- package/dist/observe/store/store.js +2127 -0
- package/dist/observe/store/storePath.js +103 -0
- package/dist/observe/store/target.js +46 -0
- package/dist/observe/store/types.js +83 -0
- package/dist/observe/store/utils.js +1063 -0
- package/dist/prod/affects-marks.js +86 -0
- package/dist/prod/affects.js +98 -112
- package/dist/prod/attribution.js +45 -0
- package/dist/prod/boundaries.js +578 -468
- package/dist/prod/core/action.js +92 -59
- package/dist/prod/core/async.js +522 -336
- package/dist/prod/core/attribution-hooks.js +3 -0
- package/dist/prod/core/constants.js +168 -44
- package/dist/prod/core/context.js +12 -16
- package/dist/prod/core/copies.js +10 -0
- package/dist/prod/core/core.js +1345 -627
- package/dist/prod/core/dev.js +123 -1
- package/dist/prod/core/effect.js +113 -80
- package/dist/prod/core/error-hooks.js +71 -0
- package/dist/prod/core/error.js +18 -4
- package/dist/prod/core/external.js +6 -7
- package/dist/prod/core/graph.js +119 -72
- package/dist/prod/core/heap.js +85 -109
- package/dist/prod/core/identities.js +62 -0
- package/dist/prod/core/invariants.js +1 -32
- package/dist/prod/core/lanes.js +931 -132
- package/dist/prod/core/owner.js +192 -129
- package/dist/prod/core/scheduler.js +948 -642
- package/dist/prod/core/truth.js +47 -0
- package/dist/prod/core/verdict.js +409 -420
- package/dist/prod/deferred.js +184 -0
- package/dist/prod/flatten.js +77 -0
- package/dist/prod/from.js +248 -0
- package/dist/prod/index.js +40 -16
- package/dist/prod/map.js +481 -211
- package/dist/prod/reveal.js +212 -0
- package/dist/prod/signals.js +401 -84
- package/dist/prod/store/affects.js +142 -0
- package/dist/prod/store/edges.js +39 -0
- package/dist/prod/store/hooks.js +16 -0
- package/dist/prod/store/index.js +27 -18
- package/dist/prod/store/optimistic.js +707 -0
- package/dist/prod/store/projection.js +331 -0
- package/dist/prod/store/reconcile.js +281 -0
- package/dist/prod/store/store.js +1952 -267
- package/dist/prod/store/storePath.js +1 -1
- package/dist/prod/store/target.js +43 -0
- package/dist/prod/store/types.js +83 -0
- package/dist/prod/store/utils.js +997 -138
- package/dist/types/affects-marks.d.ts +14 -0
- package/dist/types/affects.d.ts +12 -30
- package/dist/types/attribution.d.ts +19 -0
- package/dist/types/attribution.prod.d.ts +22 -0
- package/dist/types/boundaries.d.ts +99 -124
- package/dist/types/carved.d.ts +1 -0
- package/dist/types/core/action.d.ts +23 -9
- package/dist/types/core/async.d.ts +34 -6
- package/dist/types/core/attribution-costs.d.ts +35 -0
- package/dist/types/core/attribution-feedback.d.ts +133 -0
- package/dist/types/core/attribution-hooks.d.ts +307 -8
- package/dist/types/core/attribution-queries.d.ts +24 -0
- package/dist/types/core/attribution.d.ts +802 -72
- package/dist/types/core/constants.d.ts +195 -38
- package/dist/types/core/copies.d.ts +54 -0
- package/dist/types/core/core.d.ts +295 -65
- package/dist/types/core/dev.d.ts +509 -22
- package/dist/types/core/effect.d.ts +1 -1
- package/dist/types/core/error-hooks.d.ts +71 -0
- package/dist/types/core/error.d.ts +18 -1
- package/dist/types/core/graph.d.ts +40 -1
- package/dist/types/core/heap.d.ts +5 -5
- package/dist/types/core/identities.d.ts +17 -0
- package/dist/types/core/index.d.ts +11 -7
- package/dist/types/core/invariants.d.ts +1 -26
- package/dist/types/core/lanes.d.ts +74 -43
- package/dist/types/core/owner.d.ts +27 -9
- package/dist/types/core/scheduler.d.ts +353 -102
- package/dist/types/core/truth.d.ts +18 -0
- package/dist/types/core/types.d.ts +97 -71
- package/dist/types/core/verdict.d.ts +35 -0
- package/dist/types/deferred.d.ts +28 -0
- package/dist/types/flatten.d.ts +8 -0
- package/dist/types/from.d.ts +47 -0
- package/dist/types/index.d.ts +33 -7
- package/dist/types/map.d.ts +4 -2
- package/dist/types/reveal.d.ts +19 -0
- package/dist/types/signals.d.ts +196 -45
- package/dist/types/store/affects.d.ts +12 -0
- package/dist/types/store/edges.d.ts +9 -0
- package/dist/types/store/hooks.d.ts +62 -0
- package/dist/types/store/index.d.ts +42 -15
- package/dist/types/store/optimistic.d.ts +24 -45
- package/dist/types/store/projection.d.ts +17 -68
- package/dist/types/store/reconcile.d.ts +3 -46
- package/dist/types/store/store.d.ts +133 -136
- package/dist/types/store/storePath.d.ts +1 -1
- package/dist/types/store/target.d.ts +166 -0
- package/dist/types/store/types.d.ts +105 -0
- package/dist/types/store/utils.d.ts +188 -0
- package/package.json +31 -26
- package/dist/node.cjs +0 -8745
- package/dist/prod/core/optimistic.js +0 -265
- package/dist/prod/store/next/optimistic.js +0 -385
- package/dist/prod/store/next/projection.js +0 -172
- package/dist/prod/store/next/reconcile.js +0 -331
- package/dist/prod/store/next/store.js +0 -1499
- package/dist/prod/store/next/target.js +0 -20
- package/dist/types/core/optimistic.d.ts +0 -6
- package/dist/types/store/next/optimistic.d.ts +0 -20
- package/dist/types/store/next/projection.d.ts +0 -8
- package/dist/types/store/next/reconcile.d.ts +0 -3
- package/dist/types/store/next/store.d.ts +0 -77
- package/dist/types/store/next/target.d.ts +0 -117
- package/dist/types-cjs/affects.d.cts +0 -47
- package/dist/types-cjs/boundaries.d.cts +0 -175
- package/dist/types-cjs/core/action.d.cts +0 -64
- package/dist/types-cjs/core/async.d.cts +0 -21
- package/dist/types-cjs/core/attribution-hooks.d.cts +0 -52
- package/dist/types-cjs/core/attribution.d.cts +0 -186
- package/dist/types-cjs/core/constants.d.cts +0 -97
- package/dist/types-cjs/core/context.d.cts +0 -36
- package/dist/types-cjs/core/core.d.cts +0 -163
- package/dist/types-cjs/core/dev.d.cts +0 -81
- package/dist/types-cjs/core/effect.d.cts +0 -30
- package/dist/types-cjs/core/error.d.cts +0 -47
- package/dist/types-cjs/core/external.d.cts +0 -15
- package/dist/types-cjs/core/graph.d.cts +0 -6
- package/dist/types-cjs/core/heap.d.cts +0 -22
- package/dist/types-cjs/core/index.d.cts +0 -13
- package/dist/types-cjs/core/invariants.d.cts +0 -59
- package/dist/types-cjs/core/lanes.d.cts +0 -44
- package/dist/types-cjs/core/optimistic.d.cts +0 -6
- package/dist/types-cjs/core/owner.d.cts +0 -124
- package/dist/types-cjs/core/scheduler.d.cts +0 -180
- package/dist/types-cjs/core/types.d.cts +0 -192
- package/dist/types-cjs/core/verdict.d.cts +0 -2
- package/dist/types-cjs/index.d.cts +0 -10
- package/dist/types-cjs/map.d.cts +0 -69
- package/dist/types-cjs/package.json +0 -3
- package/dist/types-cjs/signals.d.cts +0 -624
- package/dist/types-cjs/store/index.d.cts +0 -19
- package/dist/types-cjs/store/next/optimistic.d.cts +0 -20
- package/dist/types-cjs/store/next/projection.d.cts +0 -8
- package/dist/types-cjs/store/next/reconcile.d.cts +0 -3
- package/dist/types-cjs/store/next/store.d.cts +0 -77
- package/dist/types-cjs/store/next/target.d.cts +0 -117
- package/dist/types-cjs/store/optimistic.d.cts +0 -45
- package/dist/types-cjs/store/projection.d.cts +0 -70
- package/dist/types-cjs/store/reconcile.d.cts +0 -46
- package/dist/types-cjs/store/store.d.cts +0 -138
- package/dist/types-cjs/store/storePath.d.cts +0 -58
- package/dist/types-cjs/store/utils.d.cts +0 -74
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { NOT_PENDING } from "./constants.js";
|
|
2
|
-
import type {
|
|
3
|
-
import type { IQueue, Transition } from "./scheduler.js";
|
|
2
|
+
import type { Transaction } from "./scheduler.js";
|
|
4
3
|
export interface Disposable {
|
|
5
4
|
(): void;
|
|
6
5
|
}
|
|
@@ -17,16 +16,38 @@ export interface Link {
|
|
|
17
16
|
* scanning the dep list to answer membership (see `link()`).
|
|
18
17
|
*/
|
|
19
18
|
_gen: number;
|
|
20
|
-
_pendingObserver?: boolean;
|
|
21
19
|
}
|
|
22
20
|
export interface NodeOptions<T> {
|
|
23
21
|
id?: string;
|
|
24
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;
|
|
25
30
|
transparent?: boolean;
|
|
26
31
|
equals?: ((prev: T, next: T) => boolean) | false;
|
|
27
32
|
ownedWrite?: boolean;
|
|
28
33
|
/** Exclude this signal from snapshot capture (internal — not part of public API) */
|
|
29
34
|
_noSnapshot?: boolean;
|
|
35
|
+
/** Extra CONFIG_* bits OR'd into the node's config at creation (internal —
|
|
36
|
+
* not part of public API). Used by refresh() for CONFIG_FRESH_READ,
|
|
37
|
+
* keeping the per-flag option arms out of the core creation path. */
|
|
38
|
+
_extraConfig?: number;
|
|
39
|
+
/** Observe tiers: framework plumbing — no name, no owner-path segment, no
|
|
40
|
+
* attribution records of its own; its children stay observed (internal —
|
|
41
|
+
* not part of public API; see CONFIG_PLUMBING). */
|
|
42
|
+
_plumbing?: boolean;
|
|
43
|
+
/** Observe tiers: a framework scope wide by construction — exempt from
|
|
44
|
+
* WIDE_SCOPE_DEPS, never from HUGE_FAN_IN (internal — not part of public
|
|
45
|
+
* API; see CONFIG_WIDE). */
|
|
46
|
+
_wide?: boolean;
|
|
47
|
+
/** Observe tiers: a framework async node that supersedes its own flights by
|
|
48
|
+
* design — exempt from ABANDONED_FLIGHTS (internal — not part of public
|
|
49
|
+
* API; see CONFIG_SUPERSEDES). */
|
|
50
|
+
_supersedes?: boolean;
|
|
30
51
|
unobserved?: () => void;
|
|
31
52
|
lazy?: boolean;
|
|
32
53
|
sync?: boolean;
|
|
@@ -53,67 +74,78 @@ export interface NodeOptions<T> {
|
|
|
53
74
|
* hot-path gates — a bit says "consult _x", never the reverse.
|
|
54
75
|
*/
|
|
55
76
|
export interface NodeExtension {
|
|
56
|
-
_overrideValue: unknown | typeof NOT_PENDING;
|
|
57
|
-
/**
|
|
58
|
-
* The transaction that owns the active override (stamped at optimistic
|
|
59
|
-
* write, cleared at settle). Ownership must live on the node: a lane's
|
|
60
|
-
* _transition is a scheduling affinity that a shared subscriber can merge
|
|
61
|
-
* across transactions (#2912) — following it would let one action's settle
|
|
62
|
-
* revert another action's live override. Node-level sibling of the store
|
|
63
|
-
* layer's STORE_OPTIMISTIC_OWNERS stamps (#2899). `null` = ambient write.
|
|
64
|
-
*/
|
|
65
|
-
_overrideOwner: Transition | null | undefined;
|
|
66
|
-
_optimisticLane: OptimisticLane | undefined;
|
|
67
|
-
_pendingSignal: Signal<boolean> | undefined;
|
|
68
|
-
_latestValueComputed: Computed<any> | undefined;
|
|
69
|
-
_parentSource: Signal<any> | Computed<any> | undefined;
|
|
70
|
-
/**
|
|
71
|
-
* Live `affects()` marks on this node (refcount). Non-zero is declared
|
|
72
|
-
* motion — see affects(); the count is the mark's only graph state.
|
|
73
|
-
*/
|
|
74
|
-
_affectsCount: number;
|
|
75
77
|
_inFlight: PromiseLike<any> | AsyncIterable<any> | null;
|
|
78
|
+
/** Cancellation for the CURRENT iterator flight (#3122): closes the
|
|
79
|
+
* iterator (`it.return()`), idempotent. Fired at the sites that release
|
|
80
|
+
* `_inFlight` so a superseded stream stops at supersede time. Null for
|
|
81
|
+
* plain promise flights (no cancellation hook exists). */
|
|
82
|
+
_flightTeardown: (() => void) | null;
|
|
76
83
|
_error: unknown;
|
|
77
84
|
_blocked: boolean | undefined;
|
|
78
85
|
_pendingSources: Set<Computed<any>> | undefined;
|
|
79
|
-
_notifyStatus: ((status?: number, error?: any) => void) | undefined;
|
|
80
|
-
/** Question-scoped re-ask classification of the current pending window
|
|
81
|
-
* (see the former Computed._x?._reask doc): set by recompute from
|
|
82
|
-
* REACTIVE_REASK, cleared on landing; meaningless while not pending. */
|
|
83
|
-
_reask: boolean;
|
|
84
|
-
_child: FirewallSignal<any> | null;
|
|
85
86
|
_unobserved: (() => void) | undefined;
|
|
86
87
|
_snapshotValue: any;
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* these. */
|
|
91
|
-
_pendingDisposal: Disposable | Disposable[] | null;
|
|
88
|
+
/** L2 — the previous pass's frame, parked for this node's commit: its child
|
|
89
|
+
* chain and `_disposal` list, still reacting until the commit disposes
|
|
90
|
+
* them (or the owner's death does). */
|
|
92
91
|
_pendingFirstChild: Owner | null;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
*
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
_pendingDisposal: Disposable | Disposable[] | null;
|
|
93
|
+
/** L2 — the transaction holding this node while CONFIG_HELD is set
|
|
94
|
+
* (`holdNode`); resolved through merges by `txOf`. */
|
|
95
|
+
_transaction: Transaction | null;
|
|
96
|
+
/** The node's current flight re-asks the same question (a `refresh()`,
|
|
97
|
+
* A19 exc. 2 / A24): verdict-quiet — `isPending` reads false for it —
|
|
98
|
+
* through its landing until the commit. */
|
|
99
|
+
_reask: boolean;
|
|
100
|
+
/** A28: the staging the last flush left on a held node, kept across an
|
|
101
|
+
* unflushed rewrite — what `latest()` and a tracked reader see until the
|
|
102
|
+
* flush that carries the rewrite; valid while `_flushedAt` is the current
|
|
103
|
+
* clock (that flush advances it). */
|
|
104
|
+
_flushed: unknown;
|
|
105
|
+
_flushedAt: number;
|
|
106
|
+
/** Provenance (A18, #3331): the question this node's guess or latest
|
|
107
|
+
* flight answers (`scheduler.question`); 0 when unstamped. */
|
|
108
|
+
_q: number;
|
|
109
|
+
/** Lanes (plan sec. 28) — the lane's value for this node while CONFIG_OVERRIDE is
|
|
110
|
+
* set: a written guess, or a lane pass's derivation. `NOT_PENDING` when
|
|
111
|
+
* none. The screen shows it once the lane has revealed (`_shown`); a
|
|
112
|
+
* direct read sees it throughout; the committed truth stays `_value`. */
|
|
113
|
+
_lane: unknown;
|
|
114
|
+
/** `affects()` marks live on this node (affects.ts): declared in-flight
|
|
115
|
+
* changes — `isPending` reads true for it and its derivations while any
|
|
116
|
+
* is live. A count, never a hold. */
|
|
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;
|
|
123
|
+
/** R5: the frame pass's flight of a `latest()`/`isPending()` reader the
|
|
124
|
+
* seam re-derived in the verdict lane (lanes.ts `laneSeams`) — the
|
|
125
|
+
* frame's answer to the question it asked, which the transaction's
|
|
126
|
+
* landing adopts instead of asking it again (lanes.ts `adoptParked`, F-9). Cleared
|
|
127
|
+
* by any later pass. */
|
|
128
|
+
_parked?: PromiseLike<any>;
|
|
99
129
|
}
|
|
100
130
|
export interface RawSignal<T> {
|
|
101
131
|
_subs: Link | null;
|
|
102
132
|
_subsTail: Link | null;
|
|
133
|
+
_value: T;
|
|
103
134
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
135
|
+
* Observe-tier label (`name` option, or the node kind: `signal`,
|
|
136
|
+
* `computed`, `effect`…). A slot in the observe/dev literals — never a
|
|
137
|
+
* post-construction write — and absent from the prod literals entirely.
|
|
106
138
|
*/
|
|
107
|
-
_subCount?: number;
|
|
108
|
-
_value: T;
|
|
109
139
|
_name?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Observe-tier: the owner in scope when a user-facing signal was created
|
|
142
|
+
* (`registerGraph`), so diagnostics about the signal get an owner path.
|
|
143
|
+
* A slot in the observe/dev `signal()` literal; absent from prod.
|
|
144
|
+
*/
|
|
145
|
+
_owner?: Owner | null;
|
|
110
146
|
_equals: false | ((a: T, b: T) => boolean);
|
|
111
147
|
_config: number;
|
|
112
148
|
_time: number;
|
|
113
|
-
/** IN CORE, not the extension (stage-3 §12c): consulted on EVERY write
|
|
114
|
-
* (setSignal's transition-init check) and on recompute scheduling — the
|
|
115
|
-
* per-write extension chase measurably taxed propagation chains. */
|
|
116
|
-
_transition: Transition | null;
|
|
117
149
|
/** Notify-epoch stamp of the last subscriber walk (§12d). A re-write to an
|
|
118
150
|
* already-staged node whose stamp still equals the global epoch skips the
|
|
119
151
|
* whole walk — marking is idempotent, and the epoch bumps on every
|
|
@@ -123,14 +155,12 @@ export interface RawSignal<T> {
|
|
|
123
155
|
/** Cold extension — see NodeExtension. */
|
|
124
156
|
_x: NodeExtension | null;
|
|
125
157
|
}
|
|
126
|
-
export
|
|
127
|
-
_firewall: Computed<any>;
|
|
128
|
-
_nextChild: FirewallSignal<unknown> | null;
|
|
129
|
-
}
|
|
130
|
-
export type Signal<T> = RawSignal<T> | FirewallSignal<T>;
|
|
158
|
+
export type Signal<T> = RawSignal<T>;
|
|
131
159
|
export interface Owner {
|
|
132
160
|
id?: string;
|
|
133
161
|
_config: number;
|
|
162
|
+
/** Lifecycle flags (REACTIVE_*); roots carry only REACTIVE_DISPOSED. */
|
|
163
|
+
_flags: number;
|
|
134
164
|
_snapshotScope?: boolean;
|
|
135
165
|
/** Effect-returned cleanup; managed across reruns, invoked at true disposal */
|
|
136
166
|
_cleanup?: () => void;
|
|
@@ -138,21 +168,28 @@ export interface Owner {
|
|
|
138
168
|
_parent: Owner | null;
|
|
139
169
|
_context: Record<symbol | string, unknown>;
|
|
140
170
|
_childCount: number;
|
|
141
|
-
_queue: IQueue;
|
|
142
171
|
_firstChild: Owner | null;
|
|
143
172
|
_nextSibling: Owner | null;
|
|
144
173
|
_prevSibling: Owner | null;
|
|
145
|
-
/** Cold extension — see NodeExtension
|
|
174
|
+
/** Cold extension — see NodeExtension. */
|
|
146
175
|
_x: NodeExtension | null;
|
|
176
|
+
/**
|
|
177
|
+
* Observe-tier label: the `name` option, the node kind (`computed`,
|
|
178
|
+
* `effect`…), or the component label the rendering layer writes on a root
|
|
179
|
+
* (`<App>`). A slot in the observe/dev literals; absent from prod.
|
|
180
|
+
*/
|
|
181
|
+
_name?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Observe-tier source location (`file:line:col`): the `loc` option, or
|
|
184
|
+
* the JSX site the rendering layer writes on a component root. A slot
|
|
185
|
+
* beside `_name`; absent from prod. Reserved from property mangling, like
|
|
186
|
+
* `_name`, because solid-js writes it and the core's diagnostics read it.
|
|
187
|
+
*/
|
|
188
|
+
_loc?: string;
|
|
147
189
|
}
|
|
148
190
|
export interface Computed<T> extends RawSignal<T>, Owner {
|
|
149
191
|
_deps: Link | null;
|
|
150
192
|
_depsTail: Link | null;
|
|
151
|
-
/**
|
|
152
|
-
* DEV-only live source count. Maintained by `link`/`unlinkSubs` for
|
|
153
|
-
* graph-size diagnostics; undefined in production.
|
|
154
|
-
*/
|
|
155
|
-
_depCount?: number;
|
|
156
193
|
/** Recompute-pass counter; bumped when dep revalidation starts. */
|
|
157
194
|
_depGen: number;
|
|
158
195
|
_flags: number;
|
|
@@ -161,22 +198,11 @@ export interface Computed<T> extends RawSignal<T>, Owner {
|
|
|
161
198
|
_nextHeap: Computed<any> | undefined;
|
|
162
199
|
_prevHeap: Computed<any>;
|
|
163
200
|
_fn: (prev?: T) => T;
|
|
164
|
-
/**
|
|
165
|
-
* Clock tick at which REACTIVE_MANUAL_WRITE was last applied
|
|
166
|
-
* (`suppressComputedRecompute`). Lets `refresh()` distinguish a same-tick
|
|
167
|
-
* manual write (which wins over the refresh, #2692) from a mask carried
|
|
168
|
-
* across ticks by a transaction (which an explicit refresh lifts, #3026).
|
|
169
|
-
* Only meaningful while REACTIVE_MANUAL_WRITE is set.
|
|
170
|
-
*/
|
|
171
|
-
_manualWriteTime?: number;
|
|
172
201
|
/**
|
|
173
202
|
* True while a `loadingValue` node's first real answer hasn't landed: the
|
|
174
203
|
* node was born committed (commit #0 = the loading value) and `handleAsync`
|
|
175
204
|
* serves that committed value instead of throwing NotReadyError, so first
|
|
176
|
-
* flights never suspend readers
|
|
177
|
-
* The window is verdict-quiet: `isPending` stays false, because commit #0
|
|
178
|
-
* answers the question by declaration (first-load affordances belong to
|
|
179
|
-
* the value channel). Cleared by the first value landing on any path (sync
|
|
205
|
+
* flights never suspend readers or trip boundaries. Cleared by the first value landing on any path (sync
|
|
180
206
|
* return, sync-resolved promise, first iterator yield, async settle); a
|
|
181
207
|
* real error leaves it set — errors answer reads but don't enter the value
|
|
182
208
|
* lineage, so a retry serves the loading value again. Once cleared, normal
|
|
@@ -1,2 +1,37 @@
|
|
|
1
|
+
/** The windows. `read` dispatches to `verdictValue` while one is open; each
|
|
2
|
+
* restores the dispatch it found — none inside a memo's pass a window
|
|
3
|
+
* pulled (`verdictValue`). */
|
|
1
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
|
+
*/
|
|
2
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>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves nested accessors and arrays in a children tree to their rendered
|
|
3
|
+
* values. See the `children()` helper in solid-js for the memoized form.
|
|
4
|
+
*/
|
|
5
|
+
export declare function flatten(children: any, options?: {
|
|
6
|
+
skipNonRendered?: boolean;
|
|
7
|
+
doNotUnwrap?: boolean;
|
|
8
|
+
}): any;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** The observer a `subscribe` call receives. */
|
|
2
|
+
type FromObserver<T> = {
|
|
3
|
+
next(value: T): void;
|
|
4
|
+
error(err: unknown): void;
|
|
5
|
+
complete(): void;
|
|
6
|
+
};
|
|
7
|
+
type Teardown = (() => void) | {
|
|
8
|
+
unsubscribe(): void;
|
|
9
|
+
} | void;
|
|
10
|
+
/**
|
|
11
|
+
* Anything `from` accepts: a subscribe function
|
|
12
|
+
* (`(next, error, complete) => unsubscribe`), an object with
|
|
13
|
+
* `subscribe(observer)` (RxJS and TC39 Observables, including
|
|
14
|
+
* `Symbol.observable` / `"@@observable"` interop), or an AsyncIterable.
|
|
15
|
+
*/
|
|
16
|
+
export type FromSource<T> = ((next: (value: T) => void, error: (err: unknown) => void, complete: () => void) => Teardown) | {
|
|
17
|
+
subscribe(observer: FromObserver<T>): Teardown;
|
|
18
|
+
} | AsyncIterable<T>;
|
|
19
|
+
/**
|
|
20
|
+
* Converts a callback subscription, an Observable or an AsyncIterable into an
|
|
21
|
+
* AsyncIterable for a Solid computation. A subscription keeps only the latest
|
|
22
|
+
* value, and a value the source emits during `subscribe` is served without a
|
|
23
|
+
* loading frame; an AsyncIterable streams every value through.
|
|
24
|
+
*
|
|
25
|
+
* The source closes on supersede — the owning computation re-running — and
|
|
26
|
+
* on owner disposal. Inside an async generator memo that holds for a
|
|
27
|
+
* `for await` that starts before the first `await`; one that starts after it
|
|
28
|
+
* has no owner to bind to, so its source closes only when the loop ends.
|
|
29
|
+
* Prefer returning `from(...)` from its own memo, with awaited inputs read
|
|
30
|
+
* from upstream memos and transforms done in a downstream memo.
|
|
31
|
+
*
|
|
32
|
+
* Iterate the result with `for await` or return it from a computation: its
|
|
33
|
+
* `next()` returns an already-buffered value as a bare result, not a promise.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const position = createMemo(() =>
|
|
38
|
+
* from<Position>((next, error) => {
|
|
39
|
+
* const id = navigator.geolocation.watchPosition(next, error);
|
|
40
|
+
* return () => navigator.geolocation.clearWatch(id);
|
|
41
|
+
* })
|
|
42
|
+
* );
|
|
43
|
+
* const ticks = createMemo(() => from(interval$(rate())));
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function from<T>(source: FromSource<T>): AsyncIterable<T>;
|
|
47
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,36 @@
|
|
|
1
|
-
export { $REFRESH, ContextNotFoundError, NoOwnerError, NotReadyError,
|
|
2
|
-
|
|
1
|
+
export { $REFRESH, action, ContextNotFoundError, NoOwnerError, NotReadyError, TimeoutError, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, isDisposed, getObserver, isEqual, untrack, isPending, latest, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, enforceLoadingBoundary, enableExternalSource, resetErrorHalt, configureClientErrors, ROOT_ERROR_HOOK } from "./core/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @internal The dev console footer seam — registered by `solid-js`, which
|
|
4
|
+
* owns the repair skill the footer points at. Not part of `DEV`; a no-op
|
|
5
|
+
* outside dev builds.
|
|
6
|
+
*/
|
|
7
|
+
export { setConsoleFooter } from "./core/index.js";
|
|
8
|
+
/** @internal The flush round counter (scheduler.ts): hydration's served pass tells its own round from a later one. */
|
|
9
|
+
export { clock } from "./core/index.js";
|
|
10
|
+
/** @internal Dev duplicate-copy check: solid-js marks components and context reads. */
|
|
11
|
+
export { runAsSolidCopy, checkForeignOwnerless } from "./core/copies.js";
|
|
12
|
+
/** @internal The pre-write hook (`setWriteHook` in core/core.ts); the server-components client's deferred hydration. */
|
|
13
|
+
/** @internal Plain-signal identities and the dev read watch (dependency edges; the server-components client). */
|
|
14
|
+
export { setWriteHook, setSignalIdentities, setReadWatch, signalName } from "./core/index.js";
|
|
15
|
+
/** @internal Store dependency edges: the name a store proxy's writes go by (the server-components client). */
|
|
16
|
+
export { storeName } from "./store/edges.js";
|
|
17
|
+
import { type Dev, type Observe } from "./core/index.js";
|
|
18
|
+
/**
|
|
19
|
+
* Observe tier (diagnostics channel, attribution hook slot + interaction
|
|
20
|
+
* frame): dev and observe builds. The attribution engine itself is the
|
|
21
|
+
* `@solidjs/signals/attribution` entry.
|
|
22
|
+
*/
|
|
23
|
+
export declare const OBSERVE: Observe | undefined;
|
|
24
|
+
/** Dev tier (devtools hooks, graph traversal, console reporting): dev builds only. */
|
|
3
25
|
export declare const DEV: Dev | undefined;
|
|
4
|
-
export type { Owner, Context, ContextRecord, IQueue, ExternalSourceFactory, ExternalSource, ExternalSourceConfig, Refreshable, Dev, DevHooks, DiagnosticCapture, DiagnosticCode, DiagnosticEvent, DiagnosticKind, Diagnostics, DiagnosticSeverity } from "./core/index.js";
|
|
5
|
-
export { createSignal, createMemo, createEffect, createRenderEffect, createTrackedEffect, createReaction,
|
|
6
|
-
export type { Accessor, SourceAccessor, Setter, Signal, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, SignalOptions, MemoOptions, NoInfer } from "./signals.js";
|
|
7
|
-
export { affects } from "./affects.js";
|
|
26
|
+
export type { Owner, Context, ContextRecord, IQueue, ExternalSourceFactory, ExternalSource, ExternalSourceConfig, Refreshable, AttributionSlot, ClientErrorContext, ClientErrorHook, ClientErrorsConfig, InteractionRef, NavigationRef, Dev, Observe, ServerObserve, Records, RecordTypes, HostRecordTypes, RecordType, RecordEvent, RecordLive, RecordListener, RecordSubscribeOptions, DevHooks, DiagnosticCapture, DiagnosticCode, DiagnosticEvent, DiagnosticKind, DiagnosticListener, Diagnostics, DiagnosticSeverity, DiagnosticSubject } from "./core/index.js";
|
|
27
|
+
export { createSignal, createOptimistic, createMemo, createEffect, createRenderEffect, createTrackedEffect, createReaction, refresh, resolve, until, onSettled, onFlush, onCleanup } from "./signals.js";
|
|
28
|
+
export type { Truthy, UntilOptions, Accessor, SourceAccessor, Setter, Signal, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, SignalOptions, MemoOptions, NoInfer } from "./signals.js";
|
|
8
29
|
export { mapArray, repeat, type Maybe } from "./map.js";
|
|
9
30
|
export * from "./store/index.js";
|
|
10
|
-
export {
|
|
31
|
+
export { affects } from "./affects.js";
|
|
32
|
+
export { createDeferred } from "./deferred.js";
|
|
33
|
+
export { from, type FromSource } from "./from.js";
|
|
34
|
+
export { flatten } from "./flatten.js";
|
|
35
|
+
export { createLoadingBoundary, createErrorBoundary } from "./boundaries.js";
|
|
36
|
+
export { createRevealOrder, type RevealOrder } from "./reveal.js";
|
package/dist/types/map.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export type Maybe<T> = T | void | null | undefined | false;
|
|
|
30
30
|
* );
|
|
31
31
|
* ```
|
|
32
32
|
*
|
|
33
|
-
* @description https://
|
|
33
|
+
* @description https://v2.solidjs.com/reference/solid-js/advanced/jsx-component-primitives/map-array
|
|
34
34
|
*/
|
|
35
35
|
export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Item, index: Accessor<number>) => MappedItem, options?: {
|
|
36
36
|
keyed?: true;
|
|
@@ -47,6 +47,8 @@ export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly
|
|
|
47
47
|
fallback?: Accessor<any>;
|
|
48
48
|
name?: string;
|
|
49
49
|
}): Accessor<MappedItem[]>;
|
|
50
|
+
/** @internal */
|
|
51
|
+
export declare function __smallMoveHits(): number;
|
|
50
52
|
/**
|
|
51
53
|
* Reactively renders a callback `count` times, reusing previously-rendered
|
|
52
54
|
* entries when only the count changes. Underlying helper for `<Repeat>`.
|
|
@@ -60,7 +62,7 @@ export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly
|
|
|
60
62
|
* const view = repeat(count, i => `Item ${i}`, { fallback: () => "empty" });
|
|
61
63
|
* ```
|
|
62
64
|
*
|
|
63
|
-
* @description https://
|
|
65
|
+
* @description https://v2.solidjs.com/reference/solid-js/advanced/jsx-component-primitives/repeat
|
|
64
66
|
*/
|
|
65
67
|
export declare function repeat(count: Accessor<number>, map: (index: number) => any, options?: {
|
|
66
68
|
from?: Accessor<number | undefined>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type RevealOrder = "sequential" | "together" | "natural";
|
|
2
|
+
type OrderAccessor = () => RevealOrder;
|
|
3
|
+
type BoolAccessor = () => boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Lower-level primitive behind `<Reveal>`: coordinates the order in which the
|
|
6
|
+
* Loading boundaries created directly inside `fn` reveal their content.
|
|
7
|
+
*
|
|
8
|
+
* @param fn the subtree; the Loading boundaries it creates directly are the
|
|
9
|
+
* group's slots, a nested `createRevealOrder` a composite slot
|
|
10
|
+
* @param options `order` — `"sequential"` (default: front to back, the
|
|
11
|
+
* first unready slot showing its fallback), `"together"` (all at once),
|
|
12
|
+
* `"natural"` (each on its own); `collapsed` — in a sequential group, the
|
|
13
|
+
* slots behind the frontier render nothing instead of their fallbacks
|
|
14
|
+
*/
|
|
15
|
+
export declare function createRevealOrder<T>(fn: () => T, options?: {
|
|
16
|
+
order?: OrderAccessor;
|
|
17
|
+
collapsed?: BoolAccessor;
|
|
18
|
+
}): T;
|
|
19
|
+
export {};
|