@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.
Files changed (118) hide show
  1. package/dist/dev-shared.js +2056 -3773
  2. package/dist/dev.attribution.js +159 -91
  3. package/dist/dev.js +7263 -8384
  4. package/dist/observe/affects.js +125 -104
  5. package/dist/observe/boundaries.js +458 -665
  6. package/dist/observe/core/action.js +63 -66
  7. package/dist/observe/core/async.js +240 -383
  8. package/dist/observe/core/attribution-queries.js +1 -1
  9. package/dist/observe/core/attribution.js +271 -199
  10. package/dist/observe/core/constants.js +115 -178
  11. package/dist/observe/core/context.js +3 -3
  12. package/dist/observe/core/core.js +840 -1428
  13. package/dist/observe/core/dev.js +41 -18
  14. package/dist/observe/core/effect.js +75 -86
  15. package/dist/observe/core/external.js +5 -5
  16. package/dist/observe/core/graph.js +61 -70
  17. package/dist/observe/core/heap.js +75 -98
  18. package/dist/observe/core/invariants.js +1 -34
  19. package/dist/observe/core/lanes.js +704 -181
  20. package/dist/observe/core/owner.js +80 -101
  21. package/dist/observe/core/scheduler.js +708 -1351
  22. package/dist/observe/core/verdict.js +302 -621
  23. package/dist/observe/flatten.js +79 -0
  24. package/dist/observe/index.js +15 -13
  25. package/dist/observe/map.js +232 -235
  26. package/dist/observe/reveal.js +212 -0
  27. package/dist/observe/signals.js +133 -215
  28. package/dist/observe/store/affects.js +135 -0
  29. package/dist/observe/store/index.js +29 -24
  30. package/dist/observe/store/optimistic.js +538 -0
  31. package/dist/observe/store/projection.js +302 -0
  32. package/dist/observe/store/reconcile.js +257 -0
  33. package/dist/observe/store/store.js +1945 -277
  34. package/dist/observe/store/storePath.js +1 -1
  35. package/dist/{prod/store/next → observe/store}/target.js +17 -18
  36. package/dist/observe/store/types.js +73 -0
  37. package/dist/observe/store/utils.js +1 -13
  38. package/dist/prod/affects.js +127 -106
  39. package/dist/prod/boundaries.js +442 -654
  40. package/dist/prod/core/action.js +71 -74
  41. package/dist/prod/core/async.js +307 -442
  42. package/dist/prod/core/constants.js +112 -177
  43. package/dist/prod/core/context.js +3 -3
  44. package/dist/prod/core/core.js +852 -1448
  45. package/dist/prod/core/effect.js +88 -99
  46. package/dist/prod/core/external.js +5 -5
  47. package/dist/prod/core/graph.js +61 -70
  48. package/dist/prod/core/heap.js +75 -98
  49. package/dist/prod/core/invariants.js +1 -32
  50. package/dist/prod/core/lanes.js +666 -181
  51. package/dist/prod/core/owner.js +75 -96
  52. package/dist/prod/core/scheduler.js +677 -1332
  53. package/dist/prod/core/verdict.js +297 -621
  54. package/dist/prod/flatten.js +77 -0
  55. package/dist/prod/index.js +15 -13
  56. package/dist/prod/map.js +143 -146
  57. package/dist/prod/reveal.js +212 -0
  58. package/dist/prod/signals.js +144 -226
  59. package/dist/prod/store/affects.js +135 -0
  60. package/dist/prod/store/index.js +28 -19
  61. package/dist/prod/store/optimistic.js +533 -0
  62. package/dist/prod/store/projection.js +295 -0
  63. package/dist/prod/store/reconcile.js +257 -0
  64. package/dist/prod/store/store.js +1840 -272
  65. package/dist/prod/store/storePath.js +1 -1
  66. package/dist/{observe/store/next → prod/store}/target.js +13 -17
  67. package/dist/prod/store/types.js +73 -0
  68. package/dist/prod/store/utils.js +1 -11
  69. package/dist/types/affects.d.ts +11 -30
  70. package/dist/types/boundaries.d.ts +62 -176
  71. package/dist/types/carved.d.ts +1 -0
  72. package/dist/types/core/action.d.ts +5 -6
  73. package/dist/types/core/async.d.ts +10 -5
  74. package/dist/types/core/attribution-hooks.d.ts +48 -1
  75. package/dist/types/core/attribution.d.ts +29 -9
  76. package/dist/types/core/constants.d.ts +125 -171
  77. package/dist/types/core/core.d.ts +104 -264
  78. package/dist/types/core/dev.d.ts +60 -7
  79. package/dist/types/core/effect.d.ts +0 -7
  80. package/dist/types/core/graph.d.ts +7 -1
  81. package/dist/types/core/heap.d.ts +5 -7
  82. package/dist/types/core/index.d.ts +6 -6
  83. package/dist/types/core/invariants.d.ts +0 -29
  84. package/dist/types/core/lanes.d.ts +65 -87
  85. package/dist/types/core/owner.d.ts +3 -3
  86. package/dist/types/core/scheduler.d.ts +249 -331
  87. package/dist/types/core/types.d.ts +51 -85
  88. package/dist/types/core/verdict.d.ts +3 -0
  89. package/dist/types/flatten.d.ts +8 -0
  90. package/dist/types/index.d.ts +7 -5
  91. package/dist/types/reveal.d.ts +19 -0
  92. package/dist/types/signals.d.ts +53 -92
  93. package/dist/types/store/affects.d.ts +1 -0
  94. package/dist/types/store/index.d.ts +35 -15
  95. package/dist/types/store/optimistic.d.ts +23 -0
  96. package/dist/types/store/projection.d.ts +18 -0
  97. package/dist/types/store/reconcile.d.ts +3 -0
  98. package/dist/types/store/store.d.ts +165 -143
  99. package/dist/types/store/storePath.d.ts +1 -1
  100. package/dist/types/store/target.d.ts +151 -0
  101. package/dist/types/store/types.d.ts +84 -0
  102. package/package.json +1 -1
  103. package/dist/observe/core/optimistic.js +0 -669
  104. package/dist/observe/store/next/optimistic.js +0 -717
  105. package/dist/observe/store/next/projection.js +0 -266
  106. package/dist/observe/store/next/reconcile.js +0 -375
  107. package/dist/observe/store/next/store.js +0 -2480
  108. package/dist/prod/core/optimistic.js +0 -658
  109. package/dist/prod/store/next/optimistic.js +0 -710
  110. package/dist/prod/store/next/projection.js +0 -257
  111. package/dist/prod/store/next/reconcile.js +0 -373
  112. package/dist/prod/store/next/store.js +0 -2356
  113. package/dist/types/core/optimistic.d.ts +0 -6
  114. package/dist/types/store/next/optimistic.d.ts +0 -25
  115. package/dist/types/store/next/projection.d.ts +0 -27
  116. package/dist/types/store/next/reconcile.d.ts +0 -10
  117. package/dist/types/store/next/store.d.ts +0 -143
  118. package/dist/types/store/next/target.d.ts +0 -196
@@ -1,22 +1,131 @@
1
1
  import { type Heap } from "./heap.js";
2
- import { activeLanes, assignOrMergeLane, findLane, type OptimisticLane } from "./lanes.js";
3
2
  import type { Computed, Signal } from "./types.js";
4
- export { activeLanes, assignOrMergeLane, findLane };
5
- export { getOrCreateLane, hasActiveOverride, mergeLanes, resolveLane } from "./lanes.js";
6
- export declare const transitions: Set<Transition>;
3
+ export interface Transaction {
4
+ /** Held staged nodes: committed at the landing. For a lane: its guesses
5
+ * and its work (their lane values in `_x._lane`), revealed at the seam. */
6
+ _nodes: Signal<any>[];
7
+ /** Stashed effect queues (render, user): run ahead of the landing flush's. */
8
+ _queues: [QueueCallback[], QueueCallback[]];
9
+ /** Render effects that read a held node as committed (A15's stale
10
+ * readers): re-derived after the landing. One entry per pass. */
11
+ _reruns: Computed<any>[];
12
+ /** Merged into another (overlap): resolve through it (`txOf`). */
13
+ _into: Transaction | null;
14
+ /** Lane: the transition it is a sub-frame of — it reads that world through
15
+ * and ends with it. */
16
+ _parent: Transaction | null;
17
+ /** A lane. Cleared when a blocked lane outlives its parent and continues
18
+ * as a transaction. */
19
+ _lane: boolean;
20
+ /** The lane the readers of this transaction's verdicts (`isPending`,
21
+ * `latest`) break out into — a guess the system supplies: "pending, until
22
+ * this lands", "the proposal is the value". Opened at the first such read,
23
+ * ends with the transaction. */
24
+ _verdict: Transaction | null;
25
+ /** Actions (action.ts) still running in it: held open — blocked — until
26
+ * every one has returned. Summed when transactions merge. */
27
+ _open: number;
28
+ /** An action ran in it (action.ts). Its body ending (`_open` back to 0)
29
+ * supersedes the guesses still in force whose own truth is not in flight
30
+ * (A18 body-end corollary, #3427; lanes.ts). */
31
+ _acted: boolean;
32
+ /** Lane: the lanes a frame derives from together with this one (a pass
33
+ * read two lanes' work — #3335): one reveal unit, each blocked while any
34
+ * is; shared array. Lifetimes stay their own (#2912). */
35
+ _links: Transaction[] | null;
36
+ /** Lane: it has revealed — its values are the screen (`display`,
37
+ * lanes.ts) and its passes stage for the next reveal. Set at the first
38
+ * seam it is not blocked; a verdict lane is born shown. */
39
+ _shown: boolean;
40
+ /** Lane: the last seam found it blocked (its own flight up). A frame
41
+ * leaf reading a held lane that has not shown is a stale reader of it
42
+ * (#3460); one reading a lane the seam has not judged yet is its work. */
43
+ _held: boolean;
44
+ /** `affects()` marks declared in it (affects.ts): released at the landing.
45
+ * Not nodes — a mark holds nothing (`blocked` never sees one). */
46
+ _marks: Signal<any>[] | null;
47
+ }
48
+ /** A transaction (listed here) or a lane (lanes.ts lists its own). */
49
+ export declare function newTransaction(lane: boolean, parent?: Transaction | null): Transaction;
50
+ /** The lane the running pass is work of; set at `recompute`'s head from the
51
+ * node, moved by a derivation's lane read, saved and restored around the
52
+ * pass. */
53
+ export declare let passLane: Transaction | null;
54
+ export declare function setPassLane(l: Transaction | null): void;
55
+ /** The transaction this flush parks into: set by the first join, merged
56
+ * with every further one. Consumed at the seam. A join outside a flush (a
57
+ * mount's pending observer, a write to a held node, an action opening)
58
+ * schedules the seam that consumes it: membership is the tick's — the same
59
+ * synchronous frame — and the next tick's writes are not this one's. */
60
+ export declare let flushTransaction: Transaction | null;
61
+ /** The transaction the passes running OUTSIDE a flush this tick derive from
62
+ * (a mainline mount, a mainline re-pass): the passes' own (A29, creation-
63
+ * time form — "the entry is the pass's alone"): their results are staged
64
+ * into it, and nothing else in the tick is — a write made after the mount
65
+ * is a mainline write, a render effect mounted beside it a stale reader.
66
+ * Inside a flush, or in a tick that already has its transaction (an
67
+ * action's body), the frame joins instead (`flushTransaction`) — except a
68
+ * first pass a loading boundary that has not shown content catches (`own`,
69
+ * A29's boundary exemption, #3540): it is the boundary's, not the tick's,
70
+ * and a flush that has joined nothing keeps it pass-scoped as outside one.
71
+ * Cleared by the flush the join schedules, and at the end of a flush that
72
+ * set it. */
73
+ export declare let passTx: Transaction | null;
74
+ export declare function joinPassTx(t: Transaction, own?: unknown): void;
75
+ /** The transaction holding a node (CONFIG_HELD set), resolved through
76
+ * merges; the path is compressed. */
77
+ export declare function txOf(n: Signal<any> | Computed<any>): Transaction;
78
+ /** `t` resolved through merges while it is still parked or open; null once
79
+ * it has landed. */
80
+ export declare function liveTx(t: Transaction): Transaction | null;
81
+ export declare function resolveTx(t: Transaction): Transaction;
82
+ /** The flush joins transaction `t` — or needs one of its own (`null`: a pass
83
+ * went pending with nothing held). Joining a second one merges it into the
84
+ * flush's: the work that touched both entangles them (A15). */
85
+ export declare function joinFuture(t: Transaction | null): void;
86
+ /** `t` merges into `f`: the work that touched both entangles them (A15).
87
+ * A lane never merges: it is a sub-frame, not a peer — its work is routed
88
+ * per pass (`passLane`). */
89
+ export declare function merge(t: Transaction, f: Transaction): void;
90
+ /** A15: a hold is a property of the async node — observed pending by a
91
+ * render reader. A transaction is blocked while a node it holds, in flight,
92
+ * has one: a pending render effect (the frame itself), or a pending held
93
+ * node a render effect reads. A stale reader served the committed value
94
+ * never went pending, but derives from the flight all the same (#3494) and
95
+ * is still linked to it; a memo between them is pending, and held, too — so
96
+ * one hop of `_subs` is the chain. Reads of the reader's LAST pass only (the
97
+ * link's generation is the pass's): a tail kept for A30 — the committed
98
+ * frame's dependency, awaiting the run that retires it — is not a read of
99
+ * the flight, and a reader that stopped reading releases it (O3, #3494).
100
+ * An errored pass (NotReady included) did not stop: it never got there, and
101
+ * its full list stands (A30) — the reads it did not reach still observe. A
102
+ * flight nobody renders holds nothing (A29). Only the nodes `t` still owns
103
+ * count: one a lane took over since is the lane's to wait on. A guess whose
104
+ * own truth is in flight blocks the lane's parent, not the lane — it stands
105
+ * in for the flight (A17: "visible until its own fetch settles"). */
106
+ export declare function blocked(t: Transaction): boolean;
107
+ /** Observe tier: the flights `t` waits on — its pending held sources a
108
+ * frame reader observes (`blockedBy`'s predicate, collected; the readers
109
+ * themselves are not sources). */
110
+ export declare function blockersOf(t: Transaction): Computed<any>[];
111
+ /** `t`'s own flights only — not its lanes': a flight the frame asked for
112
+ * (a refetch, a plain load) is authoritative; a lane's derivation flight is
113
+ * not (lanes.ts, the body-end corollary). A pending reader counts only if
114
+ * one of the sources it waits on is `t`'s (a render effect marked pending
115
+ * by a lane flight, never re-run, is the lane's wait, not the frame's). */
116
+ export declare function ownFlights(t: Transaction): boolean;
117
+ export declare function heldTrim(el: Computed<any>): void;
118
+ export declare function deferZombie(el: Computed<any>): void;
119
+ /** Put a staged node in a transaction: flagged, stamped, on its landing
120
+ * list. */
121
+ export declare function holdNode(n: Signal<any>, t: Transaction): void;
122
+ /** Put a node on a transaction's list, once: a node's `_transaction` is the
123
+ * transaction whose `_nodes` it is on (every site that sets one does the
124
+ * other), so a re-pass, a re-landing or a re-staging adds nothing. */
125
+ export declare function list(n: Signal<any>, t: Transaction): void;
7
126
  export declare const dirtyQueue: Heap;
8
- export declare const zombieQueue: Heap;
9
127
  export declare let clock: number;
10
- export declare let activeTransition: Transition | null;
11
- export declare let projectionWriteActive: boolean;
12
- /** > 0 while an action's generator body is on the stack (the synchronous
13
- * slice between yields). Maintained by action.ts around `it.next()`. */
14
- export declare let actionStepDepth: number;
15
- export declare function enterActionStep(): void;
16
- export declare function exitActionStep(): void;
17
128
  export declare let _hitUnhandledAsync: boolean;
18
- /** Slot hook's deferral: release this node when its carried state resolves. */
19
- export declare function deferSlotRelease(node: Signal<any>): void;
20
129
  /**
21
130
  * Consume the unhandled-async hit. Returns whether this is the first report
22
131
  * of the current enforcement window — the caller warns only then.
@@ -31,104 +140,28 @@ export declare function resetUnhandledAsync(): boolean;
31
140
  * @internal
32
141
  */
33
142
  export declare function enforceLoadingBoundary(enabled: boolean): void;
34
- export declare function setProjectionWriteActive(value: boolean): void;
35
143
  export declare function setTrackedQueueCallback(value: boolean): void;
144
+ /** Action bodies on the stack (action.ts): `flush()` is refused inside one —
145
+ * the body's writes are its transaction's and commit when it settles; a
146
+ * drain mid-step cannot reveal them, and dev says so. */
147
+ export declare let actionDepth: number;
148
+ export declare function enterAction(): void;
149
+ export declare function exitAction(): void;
150
+ /** Provenance (A18, #3331): the question being asked — an action's
151
+ * sequence while a slice of its body and the flush that carries it run, 0
152
+ * otherwise. A guess is stamped with it (lanes.ts; a mainline guess takes a
153
+ * fresh sequence: the newest intent), a flight with the question that
154
+ * started it (async.ts; mainline is always the current question). An
155
+ * answer from an older question than the guess it lands on is stale: held
156
+ * silently, it does not move the graph. */
157
+ export declare let question: number;
158
+ export declare function setQuestion(q: number): void;
159
+ export declare function nextQuestion(): number;
160
+ export declare const MAINLINE_QUESTION = 2147483647;
161
+ export declare let inEffectCallback: boolean;
36
162
  export declare function setEffectCallback(value: boolean): void;
37
163
  export type QueueCallback = (type: number) => void;
38
- type QueueStub = {
39
- _queues: [QueueCallback[], QueueCallback[]];
40
- _children: QueueStub[];
41
- };
42
- type OptimisticNode = Signal<any> | Computed<any>;
43
- export interface Transition {
44
- _time: number;
45
- _asyncReporters: Map<Computed<any>, Set<Computed<any>>>;
46
- _pendingNodes: Signal<any>[];
47
- _optimisticNodes: OptimisticNode[];
48
- _affectsNodes: OptimisticNode[];
49
- _optimisticStores: Set<any>;
50
- _actions: Array<Generator<any, any, any> | AsyncGenerator<any, any, any>>;
51
- /** An action ran in this transaction (#3427, set by action()): once
52
- * `_actions` drains, its bodies are OVER — as opposed to a transaction that
53
- * never had one, whose bare optimistic writes live until it settles. */
54
- _acted?: boolean;
55
- _queueStash: QueueStub;
56
- _done: boolean | Transition;
57
- _gatedSubs: Set<Computed<any>>;
58
- /** Effects whose single value slot was written under this transaction AND
59
- * another live one (#3322). Re-dirtied at commit, ahead of the effect
60
- * phase, so the run publishes a value derived from the committed world
61
- * rather than whichever transaction's staged view wrote last. */
62
- _contested: Computed<any>[] | null;
63
- }
64
- /**
65
- * Flip-entanglement (#3164 follow-up): `until()` is a declaration of
66
- * relatedness — the predicate names the condition that confirms the awaiting
67
- * transaction. When the predicate settles truthy, every live foreign
68
- * transition whose staged write it read IS the confirming event by the
69
- * user's own definition, so it merges into the awaiting transaction and
70
- * reveals at the joint settle — the cross-primitive twin of the family fold
71
- * (a landing on an optimism-carrying family joins the retaining
72
- * transaction). Non-flipping updates never pass through here: falsy
73
- * evaluations don't entangle, so unrelated traffic on the watched sources
74
- * reveals freely on its own schedule.
75
- *
76
- * Runs inside the predicate's compute (pure phase) — the confirming
77
- * transition's stamps are still live and its commit decision hasn't run, so
78
- * the merge lands before any reveal. Only the tree-shaken graphs that call
79
- * `until()` retain this.
80
- */
81
- export declare function entangleConfirmingTransitions(obs: Computed<any>, target: Transition): void;
82
164
  export declare function schedule(): void;
83
- /** Arm the microtask `schedule()` withheld under projectionWriteActive. The
84
- * projection draft calls this after a write made outside its run with no
85
- * flight up (proj R37): nothing else will drain, and leaving `scheduled`
86
- * armed with no microtask strands the whole scheduler — every later
87
- * `schedule()` early-returns — until something calls `flush()` by hand.
88
- * (`withheld` was set in the same synchronous slice as this call, so the
89
- * syncDepth/_running gates it passed still hold; a stale mark left by a
90
- * landing's own flush arms at worst one no-op drain.) */
91
- export declare function scheduleWithheld(): void;
92
- /**
93
- * Parked transactions whose reporter set changed without a write. A
94
- * transaction completes when nothing live reports a flight it waits on, but
95
- * the flush only judges the ACTIVE transaction: a parked one is re-entered by
96
- * a stamped node's landing or an action's resume. A reporter that stops
97
- * counting for another reason — its loading boundary flipped to the fallback
98
- * (#3375), or it was disposed by ambient work (#3372) — is neither: the
99
- * pruning in `reporterBlocksSource` would drop it at the next check, but no
100
- * check comes, and the writes held with it stay staged. Such sites record the
101
- * transaction here (deduped: one idle pass per transaction, however many
102
- * reporters changed); the flush re-enters it on an otherwise idle pass, so
103
- * the re-evaluation adopts no unrelated ambient work.
104
- */
105
- export declare const wokenTransitions: Transition[];
106
- /** Wake every parked transaction — for a site that knows a reporter stopped
107
- * counting but not whose (a boundary reset). */
108
- export declare function wakeParked(): void;
109
- /** A boundary that can be re-armed (boundaries.ts `CollectionQueue._rearm`). */
110
- export interface Rearmable {
111
- _rearm(): void;
112
- }
113
- /**
114
- * Boundaries whose `on` dependencies notified this flush (#3540; a Set:
115
- * many notifications, one re-arm). The notification arrives inside a pass,
116
- * at the height of the `on` reads — before the readers the write put in
117
- * flight are registered — so the re-arm waits for the heap and runs before
118
- * the verdict (GlobalQueue.run → drainRearms), still under the write's
119
- * transaction: the release is seen by the verdict that follows, and the
120
- * staged fallback swap lands with the write's frame.
121
- */
122
- export declare const pendingRearms: Set<Rearmable>;
123
- export declare function queueRearm(boundary: Rearmable): void;
124
- /** Transactions a mainline tick has PROPOSED against (A34, #3494): a write to a
125
- * node one of them holds — the same value or another — is a second proposal
126
- * on a contested node, and the tick reveals with the hold ("both are
127
- * suggesting a value; if one finished before the other that would be odd").
128
- * Entered at the next flush's start, where the ambient batch is adopted;
129
- * never from the write itself, which left `activeTransition` set across the
130
- * caller's block and made creation after the write the transaction's (A29). */
131
- export declare const batchJoins: Transition[];
132
165
  /**
133
166
  * Permanently halts the reactive system. Called when a user error escapes
134
167
  * every boundary — app state is undefined at that point, so scheduling stops
@@ -148,188 +181,130 @@ export declare function resetErrorHalt(): void;
148
181
  export interface IQueue {
149
182
  enqueue(type: number, fn: QueueCallback): void;
150
183
  run(type: number): boolean | void;
151
- addChild(child: IQueue): void;
152
- removeChild(child: IQueue): void;
153
- created: number;
154
184
  notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
155
- stashQueues(stub: QueueStub): void;
156
- restoreQueues(stub: QueueStub): void;
157
- _parent: IQueue | null;
158
- /** Loading/error boundary queues (boundaries.ts): the status dimension the
159
- * queue consumes, and whether it currently shows content (initialized) or
160
- * its fallback (collecting). Read by `reporterBlocksSource`. */
161
- _collectionType?: number;
162
- _initialized?: boolean;
163
185
  }
164
- export declare class Queue implements IQueue {
165
- _parent: IQueue | null;
186
+ export declare class GlobalQueue implements IQueue {
166
187
  _queues: [QueueCallback[], QueueCallback[]];
167
- _children: IQueue[];
168
- _ranAt: number;
169
- created: number;
170
- addChild(child: IQueue): void;
171
- removeChild(child: IQueue): void;
172
- notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
173
- run(type: number): void;
174
- enqueue(type: number, fn: QueueCallback): void;
175
- stashQueues(stub: QueueStub): void;
176
- restoreQueues(stub: QueueStub): void;
177
- }
178
- export declare class GlobalQueue extends Queue {
179
188
  _running: boolean;
180
- _batch: Transition;
181
189
  static _update: (el: Computed<unknown>) => void;
182
- static _dispose: (el: Computed<unknown>, self: boolean, zombie: boolean) => void;
190
+ static _dispose: (el: Computed<unknown>, self: boolean, zombie?: boolean) => void;
183
191
  static _runEffect: (el: Computed<unknown>) => void;
184
- static _clearOptimisticStores: ((stores: Set<any>, completing: Transition | null) => void) | null;
185
- static _releaseAffectsScope: ((node: OptimisticNode) => void) | null;
186
- static _releaseAffectsMarks: ((nodes: OptimisticNode[]) => void) | null;
187
- static _markAffects: ((node: OptimisticNode) => void) | null;
188
- static _releaseAffectsMark: ((node: OptimisticNode) => void) | null;
189
- static _wireExternalSource: ((self: Computed<any>) => void) | null;
190
- static _externalUntrack: (<T>(fn: () => T) => T) | null;
191
- static _syncCompanions: (<T>(el: Signal<T> | Computed<T>, value: T) => void) | null;
192
- static _updatePendingSignal: ((el: OptimisticNode) => void) | null;
193
- static _updateChildCompanions: ((el: Computed<any>) => void) | null;
194
- static _snapCompanions: ((el: OptimisticNode) => void) | null;
195
- static _latestRead: (<T>(el: Signal<T> | Computed<T>) => T) | null;
196
- static _pendingCheck: ((el: OptimisticNode, c: Computed<any> | null, owner: OptimisticNode, firewall: Computed<any> | null) => void) | null;
197
- static _recordFresh: ((el: OptimisticNode, value: any) => void) | null;
198
- static _applyReask: ((el: Computed<any>, hadReask: boolean) => boolean) | null;
199
- static _repollVerdicts: ((el: Computed<any>, snap?: boolean) => void) | null;
200
- static _witnessAffects: ((node: OptimisticNode) => void) | null;
201
- static _wakeSuppressedProbes: ((transition: Transition) => void) | null;
202
- static _optimisticWrite: (<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)) => T) | null;
203
- static _resolveOptimistic: ((nodes: OptimisticNode[]) => void) | null;
204
- static _transitionBlocked: ((transition: Transition) => boolean) | null;
205
- static _cleanupLanes: ((completingTransition: Transition | null) => void) | null;
206
- static _runLaneEffects: ((type: number) => void) | null;
207
- /** Patch-channel optimistic drain (next/patch.ts): optimistic emissions
208
- * apply at lane-effect timing — visible in flight, unlike the regular
209
- * effect queues an action stashes. Injected; null when unused. */
210
- static _drainPatchOptimistic: (() => void) | null;
211
- static _gatedRead: ((el: Signal<any>, owner: OptimisticNode, c: Computed<any>) => boolean) | null;
212
- static _laneSuspends: ((owner: OptimisticNode) => boolean) | null;
213
- /** Is the node routed through a LIVE lane (`resolveLane`)? read()'s reveal
214
- * carve-out asks before showing a foreign-held pending node's committed
215
- * value: a lane-derived flight's inputs are already revealed through the
216
- * lane (#3334). Gated on CONFIG_HAS_LANE, which only the engine sets. */
217
- static _laneLive: ((el: Computed<any>) => boolean) | null;
218
- static _laneReadsCommitted: ((el: OptimisticNode, owner: OptimisticNode, c: Computed<any>) => boolean) | null;
219
- static _recomputeLane: ((el: Computed<any>, own: boolean) => OptimisticLane | null | false) | null;
220
- static _laneAsyncPending: ((el: Computed<any>) => void) | null;
221
- /** Authoritative-view reader wakeup: installed by until() and refresh() before
222
- * their first read. Call sites are gated by CONFIG_AUTHORITATIVE_OBSERVED, which
223
- * only such a reader's carve-out read can set, so `!` invocations are safe once
224
- * the gate holds (#3303). */
225
- static _notifyAuthoritativeObservers: ((el: Signal<any> | Computed<any>) => void) | null;
226
- static _laneAsyncSettled: ((el: Computed<any>) => void) | null;
227
- /** A18 supersession (#3331): own-source truth `value` landed under an active
228
- * override. The engine decides whether the graph re-derives — the value
229
- * differs from the override and is not a stale (older-action) answer (mark
230
- * the node, demote its lane cascade, notify), or returns to it after an
231
- * earlier differing arrival (clear the mark, notify) — and owns the
232
- * authoritative-observer wake for a silent confirm. Installed with the
233
- * optimistic engine; only reachable on a node that has an override. */
234
- static _supersedeOverride: ((el: Signal<any> | Computed<any>, value: unknown) => void) | null;
235
- /** The flush's pre-verdict step (#3427): once the transaction's action
236
- * bodies have all ended and nothing authoritative is left in flight, the
237
- * engine supersedes every override still in force with the truth it
238
- * reverts to, so the graph re-derives from it now, as the transaction's
239
- * held work, instead of after the flights the overrides fed have landed.
240
- * True when it superseded something: the caller re-runs the heap ahead of
241
- * the verdict. The engine owns every gate (acted, actions drained, has
242
- * overrides, no store edits, no authoritative flight); null without it. */
243
- static _endOptimism: ((transition: Transition) => boolean) | null;
244
- /** read()'s value for a TRACKED reader of a superseded node (#3331): the
245
- * staged truth, unless the reader is a stale (render) reader of another
246
- * transaction — then the displayed override, as it keeps a foreign
247
- * transaction's committed value over its staged write. */
248
- /** A tracked read of an active override: the lane outside-view rule
249
- * (#3460) and the A18 supersession selection (#3331) — see optimistic.ts. */
250
- static _overrideRead: ((el: Computed<any>, c: Computed<any>) => unknown) | null;
251
- /** A lane pass's publish for a memo (#3479, lanes stage): the speculative
252
- * result becomes a DERIVED override, `_value` stays committed — see
253
- * optimistic.ts laneOverride. Set with the engine, which a lane implies. */
254
- static _laneOverride: ((el: Computed<any>, value: unknown, lane: OptimisticLane) => void) | null;
255
- /** Verdict-layer recompute in progress (companion creation, latest()/
256
- * isPending() pulls): never born held — see core.ts enterStagedRead. */
257
- static _verdictPull: boolean;
258
- /** setSignal's authoritative (projection-write) landing on an override-
259
- * covered node (#3331 store twin): stage the truth for its transaction's
260
- * commit whatever its relation to the committed value — a landing equal to
261
- * committed still differs from the override — then _supersedeOverride
262
- * decides. Installed with the optimistic engine; only reachable on a node
263
- * that has an override — or, from `mapArray` once a lane pass has run over
264
- * the map, on a per-slot signal (never CONFIG_OPTIMISTIC): the slot arm
265
- * publishes a lane pass's write as the slot's derived override, lands a
266
- * plain pass's write over one, and is the plain `setSignal` otherwise (F1,
267
- * see optimistic.ts landOnOverride). */
268
- static _landOnOverride: (<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)) => T) | null;
269
- static _trackOptimisticStore: ((store: any) => void) | null;
192
+ static _wireExternalSource: ((self: Computed<any>) => void) | undefined;
193
+ static _externalUntrack: (<T>(fn: () => T) => T) | undefined;
194
+ static _laneRead: ((c: Computed<any> | null, el: Signal<any> | Computed<any>) => unknown) | undefined;
195
+ static _laneStage: ((el: Computed<any>, l: Transaction, create: boolean, errored: boolean | Computed<any>) => boolean) | undefined;
196
+ static _laneOutcome: ((el: Computed<any>, value: unknown, errored: boolean) => boolean) | undefined;
197
+ static _laneWrite: (<T>(el: Signal<T> | Computed<T>, v: T) => T) | undefined;
198
+ static _applyGuesses: ((parent: Transaction | null) => void) | undefined;
199
+ /** A slot node's truth is in flight (its family's derive — store/store.ts). */
200
+ static _slotFlight: ((n: Signal<any>) => boolean) | undefined;
201
+ /** The value a slot node's guess covered: its committed value — a chained
202
+ * link's refreshed from the inner store, whose commits it never learned
203
+ * while the guess served the reads (store/store.ts, §7b). */
204
+ static _slotCovered: ((n: Signal<any>) => unknown) | undefined;
205
+ /** `affects()` on a store (store/affects.ts ↔ affects.ts): the nodes a
206
+ * declaration marks; a carrier's scope released with its last mark; a
207
+ * bare registration (birth inheritance); a witnessed mark on an untracked
208
+ * probe (verdict.ts). */
209
+ static _storeMarks: ((t: any, key: PropertyKey | undefined) => Signal<any>[]) | undefined;
210
+ static _releaseMarkScope: ((carrier: Signal<any> | Computed<any>) => void) | undefined;
211
+ static _mark: ((node: Signal<any> | Computed<any>) => void) | undefined;
212
+ static _witnessMark: (() => void) | undefined;
213
+ /** An older question's truth was held beneath a guess (lanes.ts
214
+ * `laneWrite`): the store re-bases an arrangement guess over it
215
+ * (store/optimistic.ts). */
216
+ static _laneRebase: ((el: Signal<any>, truth: unknown) => void) | undefined;
217
+ static _laneSeams: ((leaks: Computed<any>[] | null) => void) | undefined;
218
+ static _laneCorrections: (() => boolean) | undefined;
219
+ static _endLanes: ((u: Transaction) => void) | undefined;
220
+ static _lanesBlocked: ((t: Transaction) => boolean) | undefined;
221
+ static _verdictLane: ((t: Transaction) => Transaction) | undefined;
222
+ static _observeFlight: ((c: Computed<any>, el: Computed<any>) => boolean) | undefined;
223
+ static _laneGuesses: ((t: Transaction) => Signal<any>[]) | undefined;
224
+ /** Store (store/store.ts): fold the pending backings whose container
225
+ * nodes this flush committed — the owned-raw model's one mutation point. */
226
+ static _storeCommit: (() => void) | undefined;
227
+ /** The flush parked into `t`: the store materializes and holds the
228
+ * container node of every staging that had none (store/store.ts — a
229
+ * staging needs the node as its home only when something can read the
230
+ * frame through it; a hold can). */
231
+ static _storePark: ((t: Transaction) => void) | undefined;
232
+ static _marked: ((el: Signal<any> | Computed<any>) => boolean) | undefined;
233
+ static _releaseMarks: ((nodes: Signal<any>[]) => void) | undefined;
234
+ static _releaseAmbientMarks: ((parked: Transaction | null) => void) | undefined;
235
+ static _catch: ((node: Computed<any>, flags: number, error: unknown) => boolean) | undefined;
236
+ static _fresh: ((node: Computed<any>) => unknown) | undefined;
237
+ static _hidden: ((r: Computed<any>) => boolean) | undefined;
238
+ static _boundarySeam: (() => void) | undefined;
239
+ static _heldRun: ((node: Computed<any>) => boolean) | undefined;
270
240
  flush(): void;
241
+ /** L2 — the seam: end of the pure phase. Commit this flush's staged nodes,
242
+ * or park them with the transaction the flush joined; then land every
243
+ * transaction no frame is waiting on. The landing flush is an ordinary
244
+ * flush: the settle walk (async.ts) re-ran the parked readers in its pure
245
+ * phase, and here no flight the transaction holds has a frame deriving
246
+ * from it (`blocked`). */
247
+ settle(): void;
248
+ run(type: number): void;
249
+ enqueue(type: number, fn: QueueCallback, lane?: Transaction | null): void;
250
+ /** Status reaching the root: pending is absorbed (the root mount defers —
251
+ * dev records it for the ASYNC_OUTSIDE_LOADING_BOUNDARY FYI); an error is
252
+ * unhandled (`false` → the caller halts).
253
+ *
254
+ * L2: this is where a transaction is registered. Pending that reaches an
255
+ * observer (a render effect: the frame) is a frame that cannot show — the
256
+ * flush parks, and the transaction waits on the flight while a frame
257
+ * derives from it (`blocked`). Pending nobody observes holds nothing: a
258
+ * memo in flight that no frame reads is not a frame waiting. (Base: the
259
+ * queue's `_asyncReporters`, INV-3's one registration site.)
260
+ *
261
+ * A boundary between the observer and the root (boundaries.ts) is asked
262
+ * first: a fallback catches what is not ready under it, and the root
263
+ * never hears of it. */
271
264
  notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
272
- initTransition(transition?: Transition | null): void;
273
265
  }
266
+ /** A15's stale readers: a frame whose LAST pass read a held node as
267
+ * committed re-derives on the landed world — next round, after the commits.
268
+ * One re-derived since (any later pass cleared the bit: in the transaction,
269
+ * or without the held read) owes nothing. A run this transaction stashed
270
+ * for it is void (#3322: an effect has one value slot, and the stale pass
271
+ * overwrote the value that run was for) — the re-derivation's run replaces
272
+ * it. */
273
+ export declare function reruns(u: Transaction): void;
274
+ /** The held runs join this flush's effect phase after its own runs (the
275
+ * landing's re-passes, in height order): the frame's effects run as one
276
+ * pass would have queued them — a shell re-derived at the landing before a
277
+ * boundary swap held since the write (#3540's log order). */
278
+ export declare function releaseQueues(u: Transaction): void;
279
+ /** Passes that read a staging of this flush as the screen — lane work
280
+ * (core.ts `stagedRead`), a verdict reader before the frame's verdict
281
+ * (verdict.ts): if the frame parks they read a held write — re-derived next
282
+ * round (lanes.ts; a lane's runs wait that round). */
283
+ export declare const stagedReaders: Computed<any>[];
284
+ /** A15's stale reader: `c` was served the committed value of a node `t`
285
+ * holds (a render effect, a verdict reader, lane work) and is re-derived
286
+ * after `t`'s landing (`_reruns`). Once per pass. */
287
+ export declare function staleReader(c: Computed<any>, t: Transaction): void;
274
288
  export declare function queuePendingNode(node: Signal<any>): void;
275
- export declare let reaskArmed: boolean;
276
289
  /** §12d: bumped by every recompute and every new subscriber edge. A node's
277
290
  * staged-rewrite skip is sound only while NOTHING recomputed or linked since
278
291
  * its last notify — a mid-batch pull can clean a marked subscriber, and a
279
292
  * skipped re-write would leave it stale. */
280
293
  export declare let notifyEpoch: number;
281
294
  export declare function bumpNotifyEpoch(): void;
282
- export declare function armReaskClear(): void;
283
- /** Provenance of the work currently running (A18 supersession, #3331): the
284
- * invocation sequence of the action whose ambient window this is — set by
285
- * action() for each slice; the flush that ends the window clears it — or,
286
- * inside an async landing, the sequence captured when that flight was
287
- * registered (asyncWrite sets it for the landing's synchronous propagation,
288
- * so a sync recompute downstream of the landing — an optimistic wrapper over
289
- * the async source — derives under the flight's provenance, and flights it
290
- * registers inherit it). 0 is mainline: no action, always the current
291
- * question. An override stamps this at its write (`_overrideStamp`); an
292
- * answer whose flight an OLDER action issued is a stale question the user
293
- * has since changed — it holds silently to commit instead of superseding. A
294
- * slow source must not leak back in over a newer intent. Transactions merge,
295
- * so the transition object cannot say WHICH action asked; this can. */
296
- export declare let origin: number;
297
- export declare function setOrigin(seq: number): number;
298
- export declare function insertSubs(node: Signal<any> | Computed<any>, optimistic?: boolean): void;
299
- export declare let storeCommitHook: (() => void) | null;
300
- export declare function setStoreCommitHook(fn: () => void): void;
301
- /** Patch-channel release hook (next/patch.ts): transition-stamped patch
302
- * emissions are released when THEIR batch commits. Transitions never
303
- * abort: failed actions still commit (only optimistic overrides revert),
304
- * and merged-away transitions hand their stash to the survivor
305
- * (mergeTransitionState) — every stash drains exactly once. Injected like
306
- * storeCommitHook to stay tree-shakeable. */
307
- export declare let patchCommitHook: ((batch: Transition) => void) | null;
308
- export declare function setPatchCommitHook(fn: (batch: Transition) => void): void;
309
- /** Unchanged passes with a stale dependency tail, waiting on this flush's
310
- * verdict (A30, #3469). A pass that changed nothing replaced nothing either —
311
- * and cannot know at its own tail whether the flush that ran it will park:
312
- * parked, its inputs are held and the committed frame still derives from the
313
- * tail (`b() ? b() : a()` computed `1` from the held `b`, equal to the `1` it
314
- * had from `a` — with `a` trimmed, the mainline `a = 2` never reached it).
315
- * Trimmed when the flush commits; dropped with a park, the tail stays linked
316
- * until a committing pass trims it (one spurious recompute at most). */
317
- export declare const heldTrims: Computed<any>[];
318
- export declare function finalizePureQueue(completingTransition?: Transition | null, incomplete?: boolean): void;
319
- /**
320
- * Count of live `affects()` registrations across the system (including
321
- * store-scope inherited marks). Gates the read-path mark check in `read()` so
322
- * graphs that never use the feature pay one integer compare.
323
- */
324
- export declare let activeAffectsMarks: number;
325
- /**
326
- * Counter mutation seam for the mark engine in affects.ts: an imported `let`
327
- * binding is read-only, and the read-path gate above must stay a plain module
328
- * variable so `read()` pays one integer compare, not a function call.
329
- *
330
- * @internal
331
- */
332
- export declare function shiftAffectsMarks(delta: 1 | -1): void;
295
+ export declare function insertSubs(node: Signal<any> | Computed<any>): void;
296
+ /** Lane work re-staged (lanes.ts; `recompute`): the lane's members among
297
+ * its subscribers re-derive as the lane's work (REACTIVE_LANE_DIRTY), their
298
+ * runs held with it — not as stale readers republishing the committed view
299
+ * (#3460). After `insertSubs`. A render effect on no lane is marked too:
300
+ * inert for its pass (`recompute` seats a lane only from its own `_x`), it
301
+ * is a live write if the effect becomes a zombie later this flush — an
302
+ * on-screen reader whose removal an adopted write stages follows the lane
303
+ * (the lane-membership ruling, 2026-10-05; `_update`). */
304
+ export declare function laneDirty(node: Signal<any> | Computed<any>, l: Transaction): void;
305
+ /** One lane, or two of one link group (#3335): one reveal unit. */
306
+ export declare function sameLane(a: Transaction, b: Transaction): boolean;
307
+ export declare function commitPendingNode(n: Signal<any>): void;
333
308
  export declare const globalQueue: GlobalQueue;
334
309
  /**
335
310
  * Synchronously processes the pending reactive queue, or runs `fn` in a synchronous
@@ -364,60 +339,3 @@ export declare const globalQueue: GlobalQueue;
364
339
  */
365
340
  export declare function flush(): void;
366
341
  export declare function flush<T>(fn: () => T): T;
367
- /** Does `reporter` still hold the transaction waiting on `source` — live,
368
- * routed to no collecting loading boundary, and deriving from the source in
369
- * its current pass? The verdict's per-reporter test (sourceObserved), also
370
- * a boundary re-arm's (boundaries.ts `_rearm` runs before the verdict prunes
371
- * registrations that stopped counting). */
372
- export declare function reporterBlocksSource(reporter: Computed<any>, source: Computed<any>, verdict?: Transition): boolean;
373
- /**
374
- * Does a live reporter of `transition` still observe `source` pending? Dead
375
- * reporters (disposed, behind a fallback, no longer reading the source) are
376
- * pruned as they are found, and the source's entry with them. Shared by the
377
- * settle verdict and the lane's hold check (`waitingTransition`): a live
378
- * action parks its transaction without a verdict, so this prune is the only
379
- * one an optimistic lane whose last async reader unmounted mid-action ever
380
- * gets — without it the lane held on the dead reporter's registration until
381
- * the flight it no longer observed landed (#3426).
382
- */
383
- export declare function sourceObserved(transition: Transition, source: Computed<any>, verdict?: Transition): boolean;
384
- /** A fresh, unentered transaction (#3146): the optimistic store's truth
385
- * flight DECLARES an owned transaction instead of relying on whatever the
386
- * ambient adoption machinery stamped on its firewall. Activate it with
387
- * initTransition; it is a plain batch until then. */
388
- export declare function createTransition(): Transition;
389
- export declare function currentTransition(transition: Transition): Transition;
390
- /**
391
- * The live transition blocked on `source` — the one whose render reader
392
- * observed it pending (INV-3 records the observation in whichever transaction
393
- * was active when the reader was notified). The observation is a fact about
394
- * the node, so a hold check must not assume it was recorded in the transaction
395
- * it happens to hold — lanes merge across transactions (#2912), and a merged
396
- * root's transaction knows nothing of the async its members' transactions
397
- * observed (#3335). Null when nobody is waiting — a registration whose every
398
- * reporter has since died is nobody (#3426).
399
- */
400
- export declare function waitingTransition(source: Computed<any>): Transition | null;
401
- /** A landing enters EVERY parked transaction still waiting on `source`, folding
402
- * them into the active one (A15: each reveal that discovered the flight
403
- * completes at its landing). The fold used to happen as the waiters' stamped
404
- * readers recomputed under the landing — recompute re-entering an effect's
405
- * stamp — which also folded in writes those readers merely shared a hole
406
- * with (#3407); effects no longer re-enter, so the landing folds explicitly.
407
- * Live iteration is safe: a merge deletes the outgoing (active) entry and
408
- * re-adds the visited one. */
409
- export declare function enterWaiting(source: Computed<any>): void;
410
- export declare function setActiveTransition(transition: Transition | null): void;
411
- export declare function runInTransition<T>(transition: Transition, fn: () => T): T;
412
- /** Run `fn` with `transition` as BOTH the ambient transaction and the
413
- * registration batch, restoring both after. runInTransition alone is not
414
- * enough for code that WRITES on behalf of a transaction from inside someone
415
- * else's window (optimistic replay re-arming a still-open action's edits
416
- * during a landing commit, #3123): registrations route through the queue's
417
- * batch pointer, and a bare activeTransition swap leaves them in the ambient
418
- * batch — a plain batch "completes" at the next flush and reverts optimistic
419
- * registrations that were supposed to live with the transaction.
420
- * initTransition is the wrong tool here: it MERGES the currently ambient
421
- * transaction into the target, entangling whatever the interrupted window
422
- * belonged to. */
423
- export declare function runAsTransitionBatch<T>(transition: Transition, fn: () => T): T;