@solidjs/signals 2.0.0-rc.7 → 2.0.0-rc.8
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 +5243 -0
- package/dist/dev.attribution.js +2333 -0
- package/dist/dev.js +1229 -6834
- package/dist/observe/affects.js +127 -0
- package/dist/observe/attribution.js +1 -0
- package/dist/observe/boundaries.js +586 -0
- package/dist/observe/core/action.js +167 -0
- package/dist/observe/core/async.js +736 -0
- package/dist/observe/core/attribution-hooks.js +60 -0
- package/dist/observe/core/attribution.js +2318 -0
- package/dist/{types-cjs/core/constants.d.cts → observe/core/constants.js} +129 -73
- package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
- package/dist/observe/core/core.js +1289 -0
- package/dist/observe/core/dev.js +232 -0
- package/dist/observe/core/effect.js +179 -0
- package/dist/observe/core/error.js +80 -0
- package/dist/observe/core/external.js +98 -0
- package/dist/observe/core/graph.js +155 -0
- package/dist/observe/core/heap.js +147 -0
- package/dist/observe/core/invariants.js +43 -0
- package/dist/observe/core/lanes.js +168 -0
- package/dist/observe/core/optimistic.js +438 -0
- package/dist/observe/core/owner.js +308 -0
- package/dist/observe/core/scheduler.js +1190 -0
- package/dist/observe/core/verdict.js +551 -0
- package/dist/observe/index.js +55 -0
- package/dist/observe/map.js +482 -0
- package/dist/{types-cjs/signals.d.cts → observe/signals.js} +295 -317
- package/dist/observe/store/index.js +38 -0
- package/dist/observe/store/next/optimistic.js +651 -0
- package/dist/observe/store/next/projection.js +242 -0
- package/dist/observe/store/next/reconcile.js +373 -0
- package/dist/observe/store/next/store.js +2213 -0
- package/dist/observe/store/next/target.js +51 -0
- package/dist/observe/store/store.js +323 -0
- package/dist/observe/store/storePath.js +103 -0
- package/dist/observe/store/utils.js +210 -0
- package/dist/prod/attribution.js +32 -0
- package/dist/prod/core/action.js +52 -32
- package/dist/prod/core/async.js +171 -127
- package/dist/prod/core/constants.js +24 -1
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +434 -291
- package/dist/prod/core/effect.js +54 -34
- package/dist/prod/core/external.js +2 -2
- package/dist/prod/core/graph.js +32 -32
- package/dist/prod/core/heap.js +49 -44
- package/dist/prod/core/lanes.js +45 -38
- package/dist/prod/core/optimistic.js +207 -73
- package/dist/prod/core/owner.js +43 -39
- package/dist/prod/core/scheduler.js +319 -190
- package/dist/prod/core/verdict.js +67 -67
- package/dist/prod/index.js +9 -3
- package/dist/prod/map.js +292 -141
- package/dist/prod/signals.js +7 -10
- package/dist/prod/store/next/optimistic.js +140 -125
- package/dist/prod/store/next/projection.js +3 -3
- package/dist/prod/store/next/reconcile.js +87 -84
- package/dist/prod/store/next/store.js +524 -280
- package/dist/prod/store/next/target.js +32 -10
- package/dist/prod/store/store.js +12 -14
- package/dist/prod/store/utils.js +36 -27
- package/dist/types/attribution.d.ts +15 -0
- package/dist/types/attribution.prod.d.ts +13 -0
- package/dist/types/core/async.d.ts +1 -1
- package/dist/types/core/attribution-hooks.d.ts +119 -6
- package/dist/types/core/attribution.d.ts +208 -53
- package/dist/types/core/constants.d.ts +23 -0
- package/dist/types/core/core.d.ts +7 -0
- package/dist/types/core/dev.d.ts +124 -26
- package/dist/types/core/effect.d.ts +8 -1
- package/dist/types/core/index.d.ts +2 -1
- package/dist/types/core/lanes.d.ts +8 -1
- package/dist/types/core/scheduler.d.ts +60 -0
- package/dist/types/core/types.d.ts +29 -9
- package/dist/types/index.d.ts +9 -2
- package/dist/types/map.d.ts +2 -0
- package/dist/types/store/index.d.ts +1 -0
- package/dist/types/store/next/store.d.ts +5 -0
- package/dist/types/store/next/target.d.ts +36 -9
- package/dist/types/store/utils.d.ts +7 -0
- package/package.json +21 -17
- package/dist/node.cjs +0 -10541
- package/dist/node.dev.cjs +0 -13724
- 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 -23
- package/dist/types-cjs/core/attribution-hooks.d.cts +0 -127
- package/dist/types-cjs/core/attribution.d.cts +0 -495
- package/dist/types-cjs/core/core.d.cts +0 -185
- package/dist/types-cjs/core/dev.d.cts +0 -136
- package/dist/types-cjs/core/effect.d.cts +0 -30
- package/dist/types-cjs/core/error.d.cts +0 -56
- package/dist/types-cjs/core/external.d.cts +0 -15
- package/dist/types-cjs/core/graph.d.cts +0 -28
- package/dist/types-cjs/core/heap.d.cts +0 -24
- 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 -54
- 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 -236
- package/dist/types-cjs/core/types.d.cts +0 -204
- 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/store/index.d.cts +0 -18
- package/dist/types-cjs/store/next/optimistic.d.cts +0 -25
- package/dist/types-cjs/store/next/projection.d.cts +0 -8
- package/dist/types-cjs/store/next/reconcile.d.cts +0 -10
- package/dist/types-cjs/store/next/store.d.cts +0 -121
- package/dist/types-cjs/store/next/target.d.cts +0 -166
- package/dist/types-cjs/store/store.d.cts +0 -143
- package/dist/types-cjs/store/storePath.d.cts +0 -58
- package/dist/types-cjs/store/utils.d.cts +0 -74
|
@@ -1,495 +0,0 @@
|
|
|
1
|
-
import type { Computed } from "./types.cjs";
|
|
2
|
-
/**
|
|
3
|
-
* Dev-mode "why did this run" attribution.
|
|
4
|
-
*
|
|
5
|
-
* The runtime already knows the full dependency set of every scope; this
|
|
6
|
-
* module surfaces it. Every value commit stamps its node with a ChangeRecord
|
|
7
|
-
* (a write, an async landing, a refresh() invalidation, or a derived change
|
|
8
|
-
* whose `causes` chain back to root writes). When a computation re-executes,
|
|
9
|
-
* the deps whose stamp is newer than the node's last run are its causes, so
|
|
10
|
-
* each re-run can be explained as a chain down to the originating write:
|
|
11
|
-
*
|
|
12
|
-
* [why-run] effect "docTitle" ran (run 4)
|
|
13
|
-
* ← memo "userLabel" changed (#6)
|
|
14
|
-
* ← signal "notifications" write (#5) 2 → 3
|
|
15
|
-
*
|
|
16
|
-
* This module is the attribution ENGINE: all semantics live here, and it is
|
|
17
|
-
* decoupled from the core. `enable()` installs it into the core's narrow
|
|
18
|
-
* dev-only hook points (attribution-hooks.ts); core's only obligation is to
|
|
19
|
-
* call those hooks with true facts. Disabled cost is one null check per hook
|
|
20
|
-
* site; prod builds fold the sites out entirely. The same hook surface is the
|
|
21
|
-
* intended substrate for external consumers (devtools) — one mechanism, two
|
|
22
|
-
* front-ends.
|
|
23
|
-
*/
|
|
24
|
-
export type ChangeKind = "write" | "derived" | "async" | "refresh";
|
|
25
|
-
/**
|
|
26
|
-
* Provenance of a root change: the imperative frame that performed it.
|
|
27
|
-
*
|
|
28
|
-
* - `interaction` — a user event handler (the web runtime marks dispatch via
|
|
29
|
-
* `withInteraction`). `name` is the event type, `target` the element hit
|
|
30
|
-
* (`button#next "Next →"`), `at` the dispatch time on the `performance.now()`
|
|
31
|
-
* clock — the base every feedback-latency number is measured from.
|
|
32
|
-
* - `effect` — an effect callback (`name` = the effect's name; `run` = the
|
|
33
|
-
* compute run whose effect phase performed the write, when that run was
|
|
34
|
-
* recorded — so a write can be joined to the re-run that produced it).
|
|
35
|
-
* - `action` — a step of an `action()` generator (`name` = the generator's
|
|
36
|
-
* name, when it has one). Writes after an `await` (not a `yield`) run in a
|
|
37
|
-
* bare microtask and stamp `external` — the documented escape.
|
|
38
|
-
* - `async` — an async landing (`name` = the node whose flight landed).
|
|
39
|
-
* - `external` — none of the above: timers, sockets, promise callbacks, setup.
|
|
40
|
-
*
|
|
41
|
-
* `interaction` on a non-interaction frame is the user event the frame runs
|
|
42
|
-
* under — an action started by a click, an effect whose run was caused by a
|
|
43
|
-
* click's write, a landing whose flight a click started. It is what lets
|
|
44
|
-
* every downstream cost be keyed by the interaction that paid for it.
|
|
45
|
-
*/
|
|
46
|
-
export interface ChangeOrigin {
|
|
47
|
-
kind: "interaction" | "effect" | "action" | "async" | "external";
|
|
48
|
-
name?: string;
|
|
49
|
-
target?: string;
|
|
50
|
-
at?: number;
|
|
51
|
-
interaction?: ChangeOrigin;
|
|
52
|
-
/** `effect` only: the `RerunEvent.run` of the compute run this callback belongs to. */
|
|
53
|
-
run?: number;
|
|
54
|
-
}
|
|
55
|
-
/** A user interaction, as the web runtime describes it to `withInteraction`. */
|
|
56
|
-
export interface InteractionRef {
|
|
57
|
-
/** Event type — `click`, `keydown`, `input`… */
|
|
58
|
-
type: string;
|
|
59
|
-
/** The element hit, e.g. `button#next "Next →"`. */
|
|
60
|
-
target?: string;
|
|
61
|
-
/** Dispatch time on the `performance.now()` clock; defaults to now. */
|
|
62
|
-
at?: number;
|
|
63
|
-
}
|
|
64
|
-
export interface ChangeRecord {
|
|
65
|
-
/** Global monotonic change sequence — orders causes across the app. */
|
|
66
|
-
seq: number;
|
|
67
|
-
kind: ChangeKind;
|
|
68
|
-
name: string;
|
|
69
|
-
/** Short previews of the value transition (writes only). */
|
|
70
|
-
prev?: string;
|
|
71
|
-
value?: string;
|
|
72
|
-
/** First user frames of the triggering write's stack (opt-in). */
|
|
73
|
-
stack?: string[];
|
|
74
|
-
/** For derived changes: the upstream changes that produced this one. */
|
|
75
|
-
causes?: ChangeRecord[];
|
|
76
|
-
/** Root changes only: who performed the write. */
|
|
77
|
-
origin?: ChangeOrigin;
|
|
78
|
-
/** Root changes only: when the write was stamped (`performance.now()` clock). */
|
|
79
|
-
at?: number;
|
|
80
|
-
}
|
|
81
|
-
export interface RerunEvent {
|
|
82
|
-
/** Global monotonic run sequence. */
|
|
83
|
-
run: number;
|
|
84
|
-
/** How many times this node has re-run since attribution was enabled. */
|
|
85
|
-
nodeRuns: number;
|
|
86
|
-
nodeKind: "effect" | "memo";
|
|
87
|
-
nodeName: string;
|
|
88
|
-
node: Computed<any>;
|
|
89
|
-
/**
|
|
90
|
-
* The deps that changed since this node's previous run. Empty means the
|
|
91
|
-
* re-run was not triggered by a tracked value change (creation-adjacent
|
|
92
|
-
* pull, error retry, or a cause this prototype does not stamp yet).
|
|
93
|
-
*/
|
|
94
|
-
causes: ChangeRecord[];
|
|
95
|
-
/** Dependency count after this run. */
|
|
96
|
-
depCount: number;
|
|
97
|
-
/** Names of deps this run subscribed to that the previous run did not. */
|
|
98
|
-
depsAdded: string[];
|
|
99
|
-
/** Names of deps the previous run had that this run dropped. */
|
|
100
|
-
depsRemoved: string[];
|
|
101
|
-
/** Wall time of this run excluding nested recomputes (ms). */
|
|
102
|
-
selfMs: number;
|
|
103
|
-
/** Wall time of this run including nested recomputes (ms). */
|
|
104
|
-
totalMs: number;
|
|
105
|
-
/**
|
|
106
|
-
* Whether the run produced a changed value. A PLAIN memo run with
|
|
107
|
-
* `changed: false` was pure waste — the equality cutoff stopped it from
|
|
108
|
-
* notifying anyone. Effects run with `_equals: false` in core (their
|
|
109
|
-
* effect phase re-fires on every recompute), so the engine derives this
|
|
110
|
-
* fact itself: an effect run whose compute output is identical to the
|
|
111
|
-
* previous run's reports `changed: false` — the phase re-fired with the
|
|
112
|
-
* same input, pure waste. Side-effect-only computes (`undefined` output)
|
|
113
|
-
* are exempt: identity of `undefined` proves nothing about their work.
|
|
114
|
-
* Summed as `wastedMs` in costs() (plain, non-held runs only — see
|
|
115
|
-
* `phase`).
|
|
116
|
-
*/
|
|
117
|
-
changed: boolean;
|
|
118
|
-
/**
|
|
119
|
-
* Which posture this run executed under. "optimistic" = under an
|
|
120
|
-
* optimistic lane (overlay recompute); "held" = a hold was open or owns
|
|
121
|
-
* the node (the run may be replayed/settled later); "plain" = an ordinary
|
|
122
|
-
* committed run. Overlay runs are real work (they count toward time
|
|
123
|
-
* budgets) but are never blamed as waste, and costs() reports their time
|
|
124
|
-
* separately as `overlayMs`.
|
|
125
|
-
*/
|
|
126
|
-
phase: "plain" | "held" | "optimistic";
|
|
127
|
-
/**
|
|
128
|
-
* The changed value was parked in `_pendingValue` (held) rather than
|
|
129
|
-
* committed directly; its reveal happens on the hold's own schedule. Held
|
|
130
|
-
* runs are excluded from waste accounting.
|
|
131
|
-
*/
|
|
132
|
-
held: boolean;
|
|
133
|
-
/** The user interaction this run traces back to through its causes, if any. */
|
|
134
|
-
interaction?: ChangeOrigin;
|
|
135
|
-
}
|
|
136
|
-
export interface AttributionOptions {
|
|
137
|
-
/** Pretty-print each re-run to the console (default true). */
|
|
138
|
-
log?: boolean;
|
|
139
|
-
/** Capture the user stack frame of each write — slow (default false). */
|
|
140
|
-
stacks?: boolean;
|
|
141
|
-
/** Ring-buffer size for `history()` (default 200). */
|
|
142
|
-
historyLimit?: number;
|
|
143
|
-
/**
|
|
144
|
-
* Hot-scope warning: emit a diagnostic when one scope re-runs `count`
|
|
145
|
-
* times within `windowMs` (default 120 runs / 1000ms — deliberately above
|
|
146
|
-
* animation-frame cadence, so a legitimate rAF-driven scope at 60/s does
|
|
147
|
-
* not cry wolf). `false` disables.
|
|
148
|
-
*/
|
|
149
|
-
hotRuns?: {
|
|
150
|
-
count: number;
|
|
151
|
-
windowMs: number;
|
|
152
|
-
} | false;
|
|
153
|
-
/**
|
|
154
|
-
* Wide-scope warning: emit a diagnostic when a scope's dependency count
|
|
155
|
-
* reaches this (default 30) — the coarse-read / helper-leak signature.
|
|
156
|
-
* Re-warns only if the count then grows by another 50%. `false` disables.
|
|
157
|
-
*/
|
|
158
|
-
wideDeps?: number | false;
|
|
159
|
-
/**
|
|
160
|
-
* Time-budget warning: emit a diagnostic when one scope's summed self-time
|
|
161
|
-
* inside `windowMs` exceeds `budgetMs` (default 8ms / 1000ms — half a frame
|
|
162
|
-
* spent in one scope). Unlike `hotRuns` this catches the few-but-expensive
|
|
163
|
-
* scope that run counts miss. `false` disables.
|
|
164
|
-
*/
|
|
165
|
-
hotTime?: {
|
|
166
|
-
budgetMs: number;
|
|
167
|
-
windowMs: number;
|
|
168
|
-
} | false;
|
|
169
|
-
/**
|
|
170
|
-
* Unstable-output warning: emit a diagnostic when a memo commits a
|
|
171
|
-
* referentially-new but shallowly-equivalent plain object/array on this
|
|
172
|
-
* many consecutive runs (default 4). Such a memo's equality gate never
|
|
173
|
-
* closes — every subscriber re-runs on every upstream change — which makes
|
|
174
|
-
* it a fan-out amplifier that is otherwise only findable by profiling.
|
|
175
|
-
* `false` disables.
|
|
176
|
-
*/
|
|
177
|
-
unstableMemos?: number | false;
|
|
178
|
-
/**
|
|
179
|
-
* Written-fan-out warning: emit a diagnostic when a committed root
|
|
180
|
-
* invalidation (write, refresh, async landing) reaches a node with at
|
|
181
|
-
* least this many subscribers (default 250). Complements the always-on
|
|
182
|
-
* HUGE_FAN_OUT graph-size warning, specced against it deliberately:
|
|
183
|
-
* HUGE_FAN_OUT fires at LINK time from GRAPH_SIZE_WARN_AT (2000) up —
|
|
184
|
-
* static structure so large it warns even if never written — while this
|
|
185
|
-
* fires at WRITE time from a much lower bar, because fan-out only costs
|
|
186
|
-
* anything when the node actually changes. Once per node, re-warning only
|
|
187
|
-
* on 2x subscriber growth, so the two never spam the same node. `false`
|
|
188
|
-
* disables.
|
|
189
|
-
*/
|
|
190
|
-
wideWrites?: number | false;
|
|
191
|
-
/**
|
|
192
|
-
* Async-waterfall warning: emit a diagnostic when an async flight that
|
|
193
|
-
* could only start after an upstream flight resolved (its recompute's
|
|
194
|
-
* cause chain reaches the upstream's async landing, and its origin
|
|
195
|
-
* post-dates that landing) forms a sequential chain of 2+ flights, each
|
|
196
|
-
* of which took at least `minFlightMs` (default 50ms). The duration gate
|
|
197
|
-
* is one safety valve for what the graph cannot see: a settled
|
|
198
|
-
* preload/cache hit resolves fast and never warns. In-flight preloads are
|
|
199
|
-
* absolved by origin: `markFlight()` stamps (and first-seen identity)
|
|
200
|
-
* prove work predated the upstream landing — parallel, not sequential.
|
|
201
|
-
* Chains of 2 emit at `info` severity, structured channel only (a
|
|
202
|
-
* dependent fetch is sometimes intrinsic, and unmarked external preloads
|
|
203
|
-
* are invisible); 3+ escalate to `warn` with console output. `false`
|
|
204
|
-
* disables.
|
|
205
|
-
*/
|
|
206
|
-
waterfalls?: {
|
|
207
|
-
minFlightMs: number;
|
|
208
|
-
} | false;
|
|
209
|
-
/**
|
|
210
|
-
* Silent-hold warning: emit a diagnostic when a user's writes were held
|
|
211
|
-
* behind async work for at least `infoMs` (default 100ms — RAIL's "feels
|
|
212
|
-
* instant" ceiling) and the screen never acknowledged the wait — no
|
|
213
|
-
* `isPending()`/`latest()` reader downstream of the held writes or their
|
|
214
|
-
* blockers, no optimistic value, no `affects()` mark, and no lane effect
|
|
215
|
-
* painted while held. Below `warnMs`
|
|
216
|
-
* (default 200ms — the INP "good" ceiling) the event is advisory
|
|
217
|
-
* (structured channel only); at or above it the console gets the finding.
|
|
218
|
-
* The engine measures to the commit, not the paint, so every number is a
|
|
219
|
-
* floor on what the user saw; the thresholds sit at the strict end of the
|
|
220
|
-
* band on purpose. Holds that staged no root write (initial loads, bare
|
|
221
|
-
* `refresh()`) are never judged: nothing the user did went unanswered.
|
|
222
|
-
* `false` disables hold tracking altogether (`longHolds` included).
|
|
223
|
-
*/
|
|
224
|
-
holds?: {
|
|
225
|
-
infoMs: number;
|
|
226
|
-
warnMs: number;
|
|
227
|
-
} | false;
|
|
228
|
-
/**
|
|
229
|
-
* Long-hold warning: emit a diagnostic when a hold's quiescent tail — the
|
|
230
|
-
* time from the LAST write to join it until it committed — reached
|
|
231
|
-
* `infoMs` (default 500ms), `warn` from `warnMs` (default 1000ms, where
|
|
232
|
-
* RAIL says the user loses the thread). Measured from the last join so a
|
|
233
|
-
* hold that keeps taking input (typing) is judged by each wait, not by its
|
|
234
|
-
* lifetime. A hold this long is past what a stale screen should carry,
|
|
235
|
-
* acknowledged or not: the honest UI is a fallback, which a `Loading`
|
|
236
|
-
* boundary gives only when it has not revealed yet or its `on` prop
|
|
237
|
-
* changed. Reported as LONG_HOLD when the hold was acknowledged; a silent
|
|
238
|
-
* long hold stays one SILENT_HOLD with the boundary repair appended.
|
|
239
|
-
* `false` disables.
|
|
240
|
-
*/
|
|
241
|
-
longHolds?: {
|
|
242
|
-
infoMs: number;
|
|
243
|
-
warnMs: number;
|
|
244
|
-
} | false;
|
|
245
|
-
}
|
|
246
|
-
export interface ScopeCost {
|
|
247
|
-
name: string;
|
|
248
|
-
kind: "effect" | "memo";
|
|
249
|
-
runs: number;
|
|
250
|
-
selfMs: number;
|
|
251
|
-
/**
|
|
252
|
-
* Self-time of PLAIN, non-held runs that produced an unchanged value —
|
|
253
|
-
* the recoverable number. Overlay runs (optimistic/transition) are never
|
|
254
|
-
* counted here: an optimistic recompute landing back on the committed
|
|
255
|
-
* value is the mechanism working, not waste.
|
|
256
|
-
*/
|
|
257
|
-
wastedMs: number;
|
|
258
|
-
/** Self-time spent in optimistic/transition (overlay) runs. */
|
|
259
|
-
overlayMs: number;
|
|
260
|
-
}
|
|
261
|
-
export interface WriteCost {
|
|
262
|
-
/** Root cause name (a signal write, async landing, or refresh target). */
|
|
263
|
-
name: string;
|
|
264
|
-
/** Number of downstream re-runs this root triggered. */
|
|
265
|
-
runs: number;
|
|
266
|
-
/** Summed self-time of every downstream re-run it caused. */
|
|
267
|
-
downstreamMs: number;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Run `fn` as the handler of a user interaction: every root write it performs
|
|
271
|
-
* (and every action step or effect the write causes) carries the interaction
|
|
272
|
-
* as provenance. The web runtime wraps event dispatch in this; it is dev-only
|
|
273
|
-
* and safe to call with no engine enabled.
|
|
274
|
-
*/
|
|
275
|
-
export declare function withInteraction<T>(ref: InteractionRef, fn: () => T): T;
|
|
276
|
-
/** `click on button#next "Next →"`, `effect "syncTitle"`, `action "save"`, … */
|
|
277
|
-
export declare function formatOrigin(origin: ChangeOrigin): string;
|
|
278
|
-
export declare function formatRerun(event: RerunEvent): string;
|
|
279
|
-
export interface Attribution {
|
|
280
|
-
enable(opts?: AttributionOptions): void;
|
|
281
|
-
disable(): void;
|
|
282
|
-
subscribe(listener: (event: RerunEvent) => void): () => void;
|
|
283
|
-
history(): readonly RerunEvent[];
|
|
284
|
-
/** Re-run history for one node — pass a memo/effect accessor or raw node. */
|
|
285
|
-
why(target: unknown): RerunEvent[];
|
|
286
|
-
/** Current dependency names of one scope — the devtools subscription view. */
|
|
287
|
-
subscriptions(target: unknown): string[];
|
|
288
|
-
/**
|
|
289
|
-
* Aggregated cost tables since enable(): `scopes` ranked by self-time
|
|
290
|
-
* (with `wastedMs` = time spent on unchanged-value runs), `writes` ranked
|
|
291
|
-
* by total downstream re-run time each root write caused.
|
|
292
|
-
*/
|
|
293
|
-
costs(): {
|
|
294
|
-
scopes: ScopeCost[];
|
|
295
|
-
writes: WriteCost[];
|
|
296
|
-
};
|
|
297
|
-
/**
|
|
298
|
-
* Every graph-provable sequential flight chain observed since enable()
|
|
299
|
-
* (ring-buffered like history()). Facts, not verdicts: chains are recorded
|
|
300
|
-
* regardless of the duration gate — the ASYNC_WATERFALL diagnostic is the
|
|
301
|
-
* thresholded view of the same data.
|
|
302
|
-
*/
|
|
303
|
-
waterfalls(): readonly WaterfallRecord[];
|
|
304
|
-
/**
|
|
305
|
-
* Every settled transition hold that staged at least one root write since
|
|
306
|
-
* enable() (ring-buffered like history()). Facts, not verdicts: recorded
|
|
307
|
-
* regardless of duration or acknowledgment — the SILENT_HOLD diagnostic is
|
|
308
|
-
* the thresholded, unacknowledged subset.
|
|
309
|
-
*/
|
|
310
|
-
holds(): readonly HoldEvent[];
|
|
311
|
-
/**
|
|
312
|
-
* What the user waited on, folded from holds() and the interaction on each
|
|
313
|
-
* re-run: `sources` ranks async sources by the silent time writes spent
|
|
314
|
-
* held behind them (with which affordances answered, how often, and which
|
|
315
|
-
* interactions were held); `interactions` ranks user events by the total
|
|
316
|
-
* time they cost — re-run work caused (long-flush hazard) beside time held
|
|
317
|
-
* (silent-hold hazard). Facts at every duration; SILENT_HOLD is the
|
|
318
|
-
* thresholded verdict. Two more tables round out the picture: `flights`
|
|
319
|
-
* counts each async source's flights and how many were abandoned before
|
|
320
|
-
* landing (the re-ask storm), and `fallbacks` measures how long each
|
|
321
|
-
* loading boundary showed its fallback and how often that was a flash.
|
|
322
|
-
*/
|
|
323
|
-
feedback(): AttributionFeedbackTables;
|
|
324
|
-
/**
|
|
325
|
-
* Cooperative preload declaration: stamp a flight object (promise or async
|
|
326
|
-
* iterable) with its true kickoff time BEFORE the reactive graph sees it.
|
|
327
|
-
* A route preloader or query cache calls this on the promise it hands out
|
|
328
|
-
* (on the WRAPPER it mints, with the original kickoff time — wrapping
|
|
329
|
-
* defeats identity tracking otherwise); any dependent that later awaits it
|
|
330
|
-
* is then judged against the real start — work already in the air when its
|
|
331
|
-
* upstream landed is parallel, never a waterfall link. Callable while
|
|
332
|
-
* attribution is disabled (marks made at navigation time must survive a
|
|
333
|
-
* later enable()). Dev-only, like the whole DEV surface.
|
|
334
|
-
*/
|
|
335
|
-
markFlight(flight: object, startedAt?: number): void;
|
|
336
|
-
/**
|
|
337
|
-
* Run `fn` as a user interaction's handler: root writes inside stamp it as
|
|
338
|
-
* their origin, and actions/effects/flights it causes carry it. The web
|
|
339
|
-
* runtime wraps every event dispatch in this; custom renderers and test
|
|
340
|
-
* harnesses call it themselves. Callable while attribution is disabled.
|
|
341
|
-
*/
|
|
342
|
-
withInteraction: typeof withInteraction;
|
|
343
|
-
format: typeof formatRerun;
|
|
344
|
-
formatOrigin: typeof formatOrigin;
|
|
345
|
-
}
|
|
346
|
-
/** One landed flight: its node name, wall duration, and upstream chain. */
|
|
347
|
-
export interface FlightLink {
|
|
348
|
-
name: string;
|
|
349
|
-
ms: number;
|
|
350
|
-
}
|
|
351
|
-
export interface WaterfallRecord {
|
|
352
|
-
/** Sequential flights, oldest first, ending at the flight that landed. */
|
|
353
|
-
chain: FlightLink[];
|
|
354
|
-
/** Summed wall time of the chain — the serialized cost. */
|
|
355
|
-
sequentialMs: number;
|
|
356
|
-
}
|
|
357
|
-
export interface HeldWrite {
|
|
358
|
-
name: string;
|
|
359
|
-
prev?: string;
|
|
360
|
-
value?: string;
|
|
361
|
-
origin?: ChangeOrigin;
|
|
362
|
-
}
|
|
363
|
-
export interface HoldEvent {
|
|
364
|
-
/**
|
|
365
|
-
* Wall time the user waited: from the interaction that performed the held
|
|
366
|
-
* writes when one is known (`interaction.at`) or the first flush that
|
|
367
|
-
* parked them, whichever is earlier, to the commit.
|
|
368
|
-
*/
|
|
369
|
-
holdMs: number;
|
|
370
|
-
/**
|
|
371
|
-
* The quiescent tail: from the LAST held write to join (the user's final
|
|
372
|
-
* input) to the commit. Equal to `holdMs` for a single write; shorter when
|
|
373
|
-
* the hold kept taking input. The LONG_HOLD measure.
|
|
374
|
-
*/
|
|
375
|
-
tailMs: number;
|
|
376
|
-
/** The user interaction whose writes were held, when the stamp is known. */
|
|
377
|
-
interaction?: ChangeOrigin;
|
|
378
|
-
/** Flushes that ended with the hold still open. */
|
|
379
|
-
flushes: number;
|
|
380
|
-
/** Root signal writes staged behind the hold (the user's unanswered input). */
|
|
381
|
-
heldWrites: HeldWrite[];
|
|
382
|
-
/** Async nodes the hold waited on (union across its parked flushes). */
|
|
383
|
-
blockers: string[];
|
|
384
|
-
/**
|
|
385
|
-
* Feedback the graph provably rendered for this hold, as `"<kind>:<node>"`
|
|
386
|
-
* — `isPending:posts`, `latest:page`, `optimistic:todos`, `affects:list`.
|
|
387
|
-
* Empty and `paintedDuringHold === 0` is the SILENT_HOLD signature.
|
|
388
|
-
*/
|
|
389
|
-
acknowledgedBy: string[];
|
|
390
|
-
/**
|
|
391
|
-
* Effect callbacks that ran inside the hold's parked flushes. Mainline
|
|
392
|
-
* effects are stashed while a hold is open, so these are lane effects —
|
|
393
|
-
* readers of optimistic values and of `isPending()`/`latest()` companions,
|
|
394
|
-
* i.e. the screen changing in response to the hold. An unrelated effect
|
|
395
|
-
* cannot land here: it waits with everything else.
|
|
396
|
-
*/
|
|
397
|
-
paintedDuringHold: number;
|
|
398
|
-
/** The hold was opened (or joined) by an `action()`. */
|
|
399
|
-
action: boolean;
|
|
400
|
-
}
|
|
401
|
-
export interface FeedbackSource {
|
|
402
|
-
/** The async nodes the holds waited on; empty when an action alone kept them open. */
|
|
403
|
-
sources: string[];
|
|
404
|
-
holds: number;
|
|
405
|
-
/** Summed wait across the holds (ms). */
|
|
406
|
-
heldMs: number;
|
|
407
|
-
worstMs: number;
|
|
408
|
-
/** Holds with no acknowledgment at all — the SILENT_HOLD signature, at any duration. */
|
|
409
|
-
silent: number;
|
|
410
|
-
silentMs: number;
|
|
411
|
-
/** Holds whose only acknowledgment was a `latest()` shadow: the input showed, nothing said "loading". */
|
|
412
|
-
latestOnly: number;
|
|
413
|
-
/**
|
|
414
|
-
* Holds whose quiescent tail (last write to join → commit) reached
|
|
415
|
-
* `longHolds.infoMs`, acknowledged or not — the LONG_HOLD signature at the
|
|
416
|
-
* table level. The affordance is not the whole answer there: a fallback
|
|
417
|
-
* (`Loading` keyed with `on`), a preload, a cache, or a faster source is.
|
|
418
|
-
* `longMs` sums the tails.
|
|
419
|
-
*/
|
|
420
|
-
long: number;
|
|
421
|
-
longMs: number;
|
|
422
|
-
/** Which affordances answered, and in how many holds — ranked. */
|
|
423
|
-
acknowledgedBy: {
|
|
424
|
-
by: string;
|
|
425
|
-
holds: number;
|
|
426
|
-
}[];
|
|
427
|
-
/** Interactions whose writes were held here, ranked by holds. */
|
|
428
|
-
interactions: {
|
|
429
|
-
interaction: string;
|
|
430
|
-
holds: number;
|
|
431
|
-
}[];
|
|
432
|
-
/** Distinct root writes that were held. */
|
|
433
|
-
writes: string[];
|
|
434
|
-
/** Holds an action opened or joined. */
|
|
435
|
-
actions: number;
|
|
436
|
-
}
|
|
437
|
-
export interface FeedbackInteraction {
|
|
438
|
-
/** `click on button#next "Next →"` — type and target; repeated dispatches fold together. */
|
|
439
|
-
interaction: string;
|
|
440
|
-
/** Distinct dispatches seen (by dispatch time). */
|
|
441
|
-
dispatches: number;
|
|
442
|
-
/** Re-runs traced back to this interaction, and their summed self-time. */
|
|
443
|
-
runs: number;
|
|
444
|
-
selfMs: number;
|
|
445
|
-
/** The most re-run self-time a single dispatch caused — the long-flush hazard. */
|
|
446
|
-
worstDispatchMs: number;
|
|
447
|
-
/** Holds this interaction's writes waited in — the silent-hold hazard. */
|
|
448
|
-
holds: number;
|
|
449
|
-
heldMs: number;
|
|
450
|
-
silentMs: number;
|
|
451
|
-
worstHoldMs: number;
|
|
452
|
-
}
|
|
453
|
-
/** Per async source: how many flights it started, and how many it threw away. */
|
|
454
|
-
export interface FlightStats {
|
|
455
|
-
source: string;
|
|
456
|
-
/** Flights registered (a recompute that produced a new promise/iterable). */
|
|
457
|
-
flights: number;
|
|
458
|
-
/** Flights that landed (whether or not the value changed). */
|
|
459
|
-
landed: number;
|
|
460
|
-
/**
|
|
461
|
-
* Flights superseded by a newer one before landing — the search-as-you-type
|
|
462
|
-
* signature when large: every keystroke asked, most answers were discarded.
|
|
463
|
-
* A debounced/equality-gated derivation between input and fetch is the repair.
|
|
464
|
-
*/
|
|
465
|
-
abandoned: number;
|
|
466
|
-
/** Summed and worst wall time of landed flights (ms). */
|
|
467
|
-
landedMs: number;
|
|
468
|
-
worstMs: number;
|
|
469
|
-
}
|
|
470
|
-
/** Per loading boundary: how long, and how briefly, it showed its fallback. */
|
|
471
|
-
export interface FallbackStats {
|
|
472
|
-
/** The boundary's owner path (`<App> › <Feed>`), or `boundary` when unnamed. */
|
|
473
|
-
boundary: string;
|
|
474
|
-
/** Times the fallback was shown. */
|
|
475
|
-
shows: number;
|
|
476
|
-
/** Summed and worst fallback duration (ms) across completed shows. */
|
|
477
|
-
shownMs: number;
|
|
478
|
-
worstMs: number;
|
|
479
|
-
/**
|
|
480
|
-
* Shows shorter than the flash window (default 150ms): a spinner that
|
|
481
|
-
* appeared and vanished — the other end of the SILENT_HOLD spectrum, too
|
|
482
|
-
* much feedback for too little wait. A preload, a cache, or lifting the
|
|
483
|
-
* fetch above the boundary removes the flash.
|
|
484
|
-
*/
|
|
485
|
-
flashes: number;
|
|
486
|
-
}
|
|
487
|
-
export interface AttributionFeedbackTables {
|
|
488
|
-
sources: FeedbackSource[];
|
|
489
|
-
interactions: FeedbackInteraction[];
|
|
490
|
-
/** Async sources ranked by abandoned flights, then by flights. */
|
|
491
|
-
flights: FlightStats[];
|
|
492
|
-
/** Loading boundaries ranked by flashes, then by time shown. */
|
|
493
|
-
fallbacks: FallbackStats[];
|
|
494
|
-
}
|
|
495
|
-
export declare const attribution: Attribution;
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { type OptimisticLane } from "./lanes.cjs";
|
|
2
|
-
import type { Computed, FirewallSignal, NodeExtension, NodeOptions, Owner, Signal } from "./types.cjs";
|
|
3
|
-
export declare const PRIMITIVE_IN_FORBIDDEN_SCOPE_MESSAGE = "[PRIMITIVE_IN_FORBIDDEN_SCOPE] Cannot create reactive primitives inside createTrackedEffect or owner-backed onSettled";
|
|
4
|
-
export declare const REACTIVE_WRITE_IN_OWNED_SCOPE_SIGNAL_MESSAGE: string;
|
|
5
|
-
export declare const REACTIVE_WRITE_IN_OWNED_SCOPE_REFRESH_MESSAGE: string;
|
|
6
|
-
export declare let tracking: boolean;
|
|
7
|
-
/** @internal verdict-module glue */
|
|
8
|
-
export declare function setPendingCheckActive(v: boolean): void;
|
|
9
|
-
/** @internal verdict-module glue */
|
|
10
|
-
export declare function setLatestReadActive(v: boolean): void;
|
|
11
|
-
/** @internal verdict-module glue */
|
|
12
|
-
export declare function setContextInternal(v: Owner | null): void;
|
|
13
|
-
export declare let stale: boolean;
|
|
14
|
-
export declare let pendingCheckActive: boolean;
|
|
15
|
-
export declare let latestReadActive: boolean;
|
|
16
|
-
export declare let context: Owner | null;
|
|
17
|
-
export declare let currentOptimisticLane: OptimisticLane | null;
|
|
18
|
-
export declare let snapshotCaptureActive: boolean;
|
|
19
|
-
export declare let snapshotSources: Set<any> | null;
|
|
20
|
-
export declare function setSnapshotCapture(active: boolean): void;
|
|
21
|
-
export declare function markSnapshotScope(owner: Owner): void;
|
|
22
|
-
export declare function releaseSnapshotScope(owner: Owner): void;
|
|
23
|
-
export declare function clearSnapshots(): void;
|
|
24
|
-
export declare function recompute(el: Computed<any>, create?: boolean): void;
|
|
25
|
-
export declare function computed<T>(fn: (prev?: T) => T | PromiseLike<T> | AsyncIterable<T>): Computed<T>;
|
|
26
|
-
export declare function computed<T>(fn: (prev: T) => T | PromiseLike<T> | AsyncIterable<T>, options?: NodeOptions<T>): Computed<T>;
|
|
27
|
-
/** Lazily allocate a node's cold extension (ONE shape for signals and
|
|
28
|
-
* computeds — `_x` access stays monomorphic). Installers write through
|
|
29
|
-
* this; hot paths read `el._x?._field` gated by the _config presence bits.
|
|
30
|
-
* Never call ext() just to store a field's default. */
|
|
31
|
-
export declare function ext(el: {
|
|
32
|
-
_x: NodeExtension | null;
|
|
33
|
-
}): NodeExtension;
|
|
34
|
-
/**
|
|
35
|
-
* Build an Effect node with all effect-specific fields baked into a single object literal,
|
|
36
|
-
* so V8 sees the full hidden class shape at construction time. Effects always run in lazy
|
|
37
|
-
* mode (recompute is called explicitly by `effect()`), so we hardcode the lazy bits and skip
|
|
38
|
-
* the auto-dispose CONFIG bit (effect() previously cleared it post-construction).
|
|
39
|
-
*/
|
|
40
|
-
export declare function createEffectNode<T>(fn: (prev?: T) => T, effectFn: (val: T, prev: T | undefined) => void | (() => void), errorFn: ((err: unknown, cleanup: () => void) => void | (() => void)) | undefined, type: number, options: NodeOptions<T> | undefined): any;
|
|
41
|
-
/**
|
|
42
|
-
* The shared status notifier for effect nodes, installed once by effect.ts
|
|
43
|
-
* at module evaluation (`this`-dispatched — one function serves every
|
|
44
|
-
* effect, so nodes never store it). Boundary computeds keep their own
|
|
45
|
-
* per-node channel on `_x._notifyStatus`, which takes precedence.
|
|
46
|
-
*/
|
|
47
|
-
export declare let effectStatusNotify: ((this: any, status?: number, error?: any) => void) | null;
|
|
48
|
-
export declare function setEffectStatusNotify(fn: NonNullable<typeof effectStatusNotify>): void;
|
|
49
|
-
/** Resolve a node's status notifier: an own `_x` channel (boundaries) wins;
|
|
50
|
-
* effect nodes (`_type` — EFFECT_PURE is 0, and only effect literals carry
|
|
51
|
-
* the field) fall back to the shared notifier. Presence doubles as the
|
|
52
|
-
* "display consumer" membership test in the status walks, exactly as the
|
|
53
|
-
* per-node field did when every effect carried one. */
|
|
54
|
-
export declare function statusNotifierOf(el: any): ((this: any, status?: number, error?: any) => void) | undefined;
|
|
55
|
-
export declare function signal<T>(v: T, options?: NodeOptions<T>): Signal<T>;
|
|
56
|
-
export declare function signal<T>(v: T, options?: NodeOptions<T>, firewall?: Computed<any>): FirewallSignal<T>;
|
|
57
|
-
/** The shared slot-node unobserved handler — a live binding read directly by
|
|
58
|
-
* the sweep sites (no wrapper frame, no null check: a CONFIG_SLOT_NODE node
|
|
59
|
-
* existing implies the store module loaded and registered the hook). */
|
|
60
|
-
export declare let slotUnobservedHook: (node: Signal<any>) => void;
|
|
61
|
-
/** Install the shared slot-node unobserved handler (store module, once). */
|
|
62
|
-
export declare function setSlotUnobserved(fn: (node: Signal<any>) => void): void;
|
|
63
|
-
export declare function slotSignal<T>(v: T, equals: (a: T, b: T) => boolean, host: object, key: PropertyKey, acc: boolean, firewall?: Computed<unknown> | null): Signal<T>;
|
|
64
|
-
export declare function optimisticSignal<T>(v: T, options?: NodeOptions<T>): Signal<T>;
|
|
65
|
-
export declare function optimisticComputed<T>(fn: (prev?: T) => T | PromiseLike<T> | AsyncIterable<T>, options?: NodeOptions<T>): Computed<T>;
|
|
66
|
-
export declare function isEqual<T>(a: T, b: T): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* When set to a component name string, any reactive read that is not inside a nested tracking
|
|
69
|
-
* scope will log a dev-mode warning. Managed automatically by `untrack(fn, strictReadLabel)`.
|
|
70
|
-
*/
|
|
71
|
-
export declare let strictRead: string | false;
|
|
72
|
-
export declare function setStrictRead(v: string | false): string | false;
|
|
73
|
-
/**
|
|
74
|
-
* Runs `fn` outside of any reactive tracking — reads inside `fn` will not
|
|
75
|
-
* subscribe the current scope. Returns whatever `fn` returns.
|
|
76
|
-
*
|
|
77
|
-
* Use `untrack` inside a memo or effect when you need to read a signal once
|
|
78
|
-
* without making the surrounding computation depend on its future changes.
|
|
79
|
-
*
|
|
80
|
-
* Pass a `strictReadLabel` string to enable a dev-mode warning: any reactive
|
|
81
|
-
* read inside `fn` that isn't inside a nested tracking scope will log a
|
|
82
|
-
* warning naming the label.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```ts
|
|
86
|
-
* createEffect(
|
|
87
|
-
* () => trigger(), // tracks `trigger` only
|
|
88
|
-
* () => {
|
|
89
|
-
* const snapshot = untrack(() => state); // read once, untracked
|
|
90
|
-
* log(snapshot);
|
|
91
|
-
* }
|
|
92
|
-
* );
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
export declare function untrack<T>(fn: () => T, strictReadLabel?: string | false): T;
|
|
96
|
-
/**
|
|
97
|
-
* Bring a computed to a readable state: lazy/disposed nodes are (re)computed;
|
|
98
|
-
* an isPending() probe (`refresh`) additionally pulls the node fully up to
|
|
99
|
-
* date so its status flags reflect the current graph.
|
|
100
|
-
*/
|
|
101
|
-
export declare function prepareComputed(comp: Computed<unknown>, refresh: boolean): void;
|
|
102
|
-
/**
|
|
103
|
-
* Sentinel returned by readNodeFast when the plain-signal fast path does not
|
|
104
|
-
* apply and the caller must fall back to the full read().
|
|
105
|
-
*/
|
|
106
|
-
export declare const READ_SLOW: unique symbol;
|
|
107
|
-
/**
|
|
108
|
-
* read()'s plain-signal fast path as a standalone entry for hot callers
|
|
109
|
-
* (store traps). Safe to substitute for read() only because the bail
|
|
110
|
-
* conditions mirror read()'s prelude and fast-path guard exactly: the
|
|
111
|
-
* latestRead and pendingCheck windows run side-effectful hooks before the
|
|
112
|
-
* fast path, `_fn` nodes need prepareComputed, and firewall / override /
|
|
113
|
-
* snapshot / transition / lane / dev-strictRead state all take the full
|
|
114
|
-
* resolution. Anything slow returns READ_SLOW; the caller then calls read().
|
|
115
|
-
*/
|
|
116
|
-
/**
|
|
117
|
-
* Wake only authoritative-view readers (until() predicates) subscribed to `el`.
|
|
118
|
-
* The A17-silent ack paths — an authoritative arrival equal to the active
|
|
119
|
-
* override — use this so the predicate re-evaluates without re-firing
|
|
120
|
-
* ordinary subscribers whose visible (override) value did not change.
|
|
121
|
-
* Pay-for-use: reached through GlobalQueue._notifyAuthoritativeObservers,
|
|
122
|
-
* installed at first until() call — apps that never use until() shake it.
|
|
123
|
-
*/
|
|
124
|
-
export declare function notifyAuthoritativeObservers(el: Signal<any> | Computed<any>): void;
|
|
125
|
-
/** Installs the authoritative-reader wakeup hook. Idempotent; called by every
|
|
126
|
-
* creator of a CONFIG_AUTHORITATIVE_READ computation — until() and refresh() —
|
|
127
|
-
* before its first read (same late-binding contract as the optimistic engine;
|
|
128
|
-
* the gating bit is only ever set by such a read, so the `!` call sites are
|
|
129
|
-
* safe once every setter installs, #3303). */
|
|
130
|
-
export declare function installAuthoritativeRead(): void;
|
|
131
|
-
export declare function readNodeFast<T>(el: Signal<T>): T | typeof READ_SLOW;
|
|
132
|
-
export declare function read<T>(el: Signal<T> | Computed<T>): T;
|
|
133
|
-
/**
|
|
134
|
-
* Store-rewrite setter guard: the rewrite parks writes in a pending backing
|
|
135
|
-
* (no setSignal at write time), so the owned-scope write protection must
|
|
136
|
-
* fire at the setter entry instead. Mirrors setSignal's guard condition
|
|
137
|
-
* minus the node-specific exemptions (ownedWrite/firewall), which don't
|
|
138
|
-
* apply to plain store setters.
|
|
139
|
-
*/
|
|
140
|
-
export declare function devGuardStoreSetterWrite(): void;
|
|
141
|
-
export declare function setSignal<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)): T;
|
|
142
|
-
/**
|
|
143
|
-
* Suppresses automatic recomputation of `el` until the scheduler drains. Used
|
|
144
|
-
* when a manual write should win over dependency changes queued in the same
|
|
145
|
-
* tick. The MANUAL_WRITE flag is cleared by the pending-node drain; projection
|
|
146
|
-
* computeds don't commit values, but they still need the same end-of-tick
|
|
147
|
-
* cleanup point.
|
|
148
|
-
*/
|
|
149
|
-
export declare function suppressComputedRecompute(el: Computed<unknown>): void;
|
|
150
|
-
/**
|
|
151
|
-
* User-facing setter for the memo form of `createSignal(fn)`. Behaves like
|
|
152
|
-
* `setSignal`, but also cancels any pending recompute of the memo so the
|
|
153
|
-
* manual value wins over a value that would otherwise be produced by an
|
|
154
|
-
* upstream change in the same tick.
|
|
155
|
-
*/
|
|
156
|
-
export declare function setMemo<T>(el: Computed<T>, v: T | ((prev: T) => T)): T;
|
|
157
|
-
/**
|
|
158
|
-
* Executes `fn` with the given `owner` set as the current owner. Any reactive
|
|
159
|
-
* primitives (`createSignal`, `createMemo`, `createEffect`, `onCleanup`,
|
|
160
|
-
* `cleanup`, etc.) created inside `fn` are attached to that owner, so they
|
|
161
|
-
* are disposed when the owner is disposed.
|
|
162
|
-
*
|
|
163
|
-
* The classic pattern: capture the current owner with `getOwner()` inside a
|
|
164
|
-
* component, then re-enter it from a callback (event handler, async resolve,
|
|
165
|
-
* setTimeout) so disposables created in the callback get cleaned up with the
|
|
166
|
-
* component.
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* ```ts
|
|
170
|
-
* function delayed<T>(ms: number, fn: () => T) {
|
|
171
|
-
* const owner = getOwner();
|
|
172
|
-
* setTimeout(() => runWithOwner(owner, fn), ms);
|
|
173
|
-
* }
|
|
174
|
-
* ```
|
|
175
|
-
*/
|
|
176
|
-
export declare function runWithOwner<T>(owner: Owner | null, fn: () => T): T;
|
|
177
|
-
export declare function staleValues<T>(fn: () => T, set?: boolean): T;
|
|
178
|
-
/**
|
|
179
|
-
* Core marking half of `refresh()` (the public wrapper lives in signals.ts —
|
|
180
|
-
* it validates the target, marks through here, then builds the quiescence
|
|
181
|
-
* promise on the resolve()/until() effect machinery). Flags the node's next
|
|
182
|
-
* recompute as a quiet re-ask and schedules it; no-ops for non-derived or
|
|
183
|
-
* disposed targets and for same-tick manual writes.
|
|
184
|
-
*/
|
|
185
|
-
export declare function markRefresh(node: Computed<any>): void;
|