@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.
Files changed (117) hide show
  1. package/dist/dev-shared.js +5243 -0
  2. package/dist/dev.attribution.js +2333 -0
  3. package/dist/dev.js +1229 -6834
  4. package/dist/observe/affects.js +127 -0
  5. package/dist/observe/attribution.js +1 -0
  6. package/dist/observe/boundaries.js +586 -0
  7. package/dist/observe/core/action.js +167 -0
  8. package/dist/observe/core/async.js +736 -0
  9. package/dist/observe/core/attribution-hooks.js +60 -0
  10. package/dist/observe/core/attribution.js +2318 -0
  11. package/dist/{types-cjs/core/constants.d.cts → observe/core/constants.js} +129 -73
  12. package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
  13. package/dist/observe/core/core.js +1289 -0
  14. package/dist/observe/core/dev.js +232 -0
  15. package/dist/observe/core/effect.js +179 -0
  16. package/dist/observe/core/error.js +80 -0
  17. package/dist/observe/core/external.js +98 -0
  18. package/dist/observe/core/graph.js +155 -0
  19. package/dist/observe/core/heap.js +147 -0
  20. package/dist/observe/core/invariants.js +43 -0
  21. package/dist/observe/core/lanes.js +168 -0
  22. package/dist/observe/core/optimistic.js +438 -0
  23. package/dist/observe/core/owner.js +308 -0
  24. package/dist/observe/core/scheduler.js +1190 -0
  25. package/dist/observe/core/verdict.js +551 -0
  26. package/dist/observe/index.js +55 -0
  27. package/dist/observe/map.js +482 -0
  28. package/dist/{types-cjs/signals.d.cts → observe/signals.js} +295 -317
  29. package/dist/observe/store/index.js +38 -0
  30. package/dist/observe/store/next/optimistic.js +651 -0
  31. package/dist/observe/store/next/projection.js +242 -0
  32. package/dist/observe/store/next/reconcile.js +373 -0
  33. package/dist/observe/store/next/store.js +2213 -0
  34. package/dist/observe/store/next/target.js +51 -0
  35. package/dist/observe/store/store.js +323 -0
  36. package/dist/observe/store/storePath.js +103 -0
  37. package/dist/observe/store/utils.js +210 -0
  38. package/dist/prod/attribution.js +32 -0
  39. package/dist/prod/core/action.js +52 -32
  40. package/dist/prod/core/async.js +171 -127
  41. package/dist/prod/core/constants.js +24 -1
  42. package/dist/prod/core/context.js +3 -3
  43. package/dist/prod/core/core.js +434 -291
  44. package/dist/prod/core/effect.js +54 -34
  45. package/dist/prod/core/external.js +2 -2
  46. package/dist/prod/core/graph.js +32 -32
  47. package/dist/prod/core/heap.js +49 -44
  48. package/dist/prod/core/lanes.js +45 -38
  49. package/dist/prod/core/optimistic.js +207 -73
  50. package/dist/prod/core/owner.js +43 -39
  51. package/dist/prod/core/scheduler.js +319 -190
  52. package/dist/prod/core/verdict.js +67 -67
  53. package/dist/prod/index.js +9 -3
  54. package/dist/prod/map.js +292 -141
  55. package/dist/prod/signals.js +7 -10
  56. package/dist/prod/store/next/optimistic.js +140 -125
  57. package/dist/prod/store/next/projection.js +3 -3
  58. package/dist/prod/store/next/reconcile.js +87 -84
  59. package/dist/prod/store/next/store.js +524 -280
  60. package/dist/prod/store/next/target.js +32 -10
  61. package/dist/prod/store/store.js +12 -14
  62. package/dist/prod/store/utils.js +36 -27
  63. package/dist/types/attribution.d.ts +15 -0
  64. package/dist/types/attribution.prod.d.ts +13 -0
  65. package/dist/types/core/async.d.ts +1 -1
  66. package/dist/types/core/attribution-hooks.d.ts +119 -6
  67. package/dist/types/core/attribution.d.ts +208 -53
  68. package/dist/types/core/constants.d.ts +23 -0
  69. package/dist/types/core/core.d.ts +7 -0
  70. package/dist/types/core/dev.d.ts +124 -26
  71. package/dist/types/core/effect.d.ts +8 -1
  72. package/dist/types/core/index.d.ts +2 -1
  73. package/dist/types/core/lanes.d.ts +8 -1
  74. package/dist/types/core/scheduler.d.ts +60 -0
  75. package/dist/types/core/types.d.ts +29 -9
  76. package/dist/types/index.d.ts +9 -2
  77. package/dist/types/map.d.ts +2 -0
  78. package/dist/types/store/index.d.ts +1 -0
  79. package/dist/types/store/next/store.d.ts +5 -0
  80. package/dist/types/store/next/target.d.ts +36 -9
  81. package/dist/types/store/utils.d.ts +7 -0
  82. package/package.json +21 -17
  83. package/dist/node.cjs +0 -10541
  84. package/dist/node.dev.cjs +0 -13724
  85. package/dist/types-cjs/affects.d.cts +0 -47
  86. package/dist/types-cjs/boundaries.d.cts +0 -175
  87. package/dist/types-cjs/core/action.d.cts +0 -64
  88. package/dist/types-cjs/core/async.d.cts +0 -23
  89. package/dist/types-cjs/core/attribution-hooks.d.cts +0 -127
  90. package/dist/types-cjs/core/attribution.d.cts +0 -495
  91. package/dist/types-cjs/core/core.d.cts +0 -185
  92. package/dist/types-cjs/core/dev.d.cts +0 -136
  93. package/dist/types-cjs/core/effect.d.cts +0 -30
  94. package/dist/types-cjs/core/error.d.cts +0 -56
  95. package/dist/types-cjs/core/external.d.cts +0 -15
  96. package/dist/types-cjs/core/graph.d.cts +0 -28
  97. package/dist/types-cjs/core/heap.d.cts +0 -24
  98. package/dist/types-cjs/core/index.d.cts +0 -13
  99. package/dist/types-cjs/core/invariants.d.cts +0 -59
  100. package/dist/types-cjs/core/lanes.d.cts +0 -54
  101. package/dist/types-cjs/core/optimistic.d.cts +0 -6
  102. package/dist/types-cjs/core/owner.d.cts +0 -124
  103. package/dist/types-cjs/core/scheduler.d.cts +0 -236
  104. package/dist/types-cjs/core/types.d.cts +0 -204
  105. package/dist/types-cjs/core/verdict.d.cts +0 -2
  106. package/dist/types-cjs/index.d.cts +0 -10
  107. package/dist/types-cjs/map.d.cts +0 -69
  108. package/dist/types-cjs/package.json +0 -3
  109. package/dist/types-cjs/store/index.d.cts +0 -18
  110. package/dist/types-cjs/store/next/optimistic.d.cts +0 -25
  111. package/dist/types-cjs/store/next/projection.d.cts +0 -8
  112. package/dist/types-cjs/store/next/reconcile.d.cts +0 -10
  113. package/dist/types-cjs/store/next/store.d.cts +0 -121
  114. package/dist/types-cjs/store/next/target.d.cts +0 -166
  115. package/dist/types-cjs/store/store.d.cts +0 -143
  116. package/dist/types-cjs/store/storePath.d.cts +0 -58
  117. package/dist/types-cjs/store/utils.d.cts +0 -74
@@ -1,236 +0,0 @@
1
- import { type Heap } from "./heap.cjs";
2
- import { activeLanes, assignOrMergeLane, findLane, type OptimisticLane } from "./lanes.cjs";
3
- import type { Computed, Signal } from "./types.cjs";
4
- export { activeLanes, assignOrMergeLane, findLane };
5
- export { getOrCreateLane, hasActiveOverride, mergeLanes, resolveLane } from "./lanes.cjs";
6
- export declare const dirtyQueue: Heap;
7
- export declare const zombieQueue: Heap;
8
- export declare let clock: number;
9
- export declare let activeTransition: Transition | null;
10
- export declare let projectionWriteActive: boolean;
11
- export declare let _hitUnhandledAsync: boolean;
12
- /**
13
- * Consume the unhandled-async hit. Returns whether this is the first report
14
- * of the current enforcement window — the caller warns only then.
15
- */
16
- export declare function resetUnhandledAsync(): boolean;
17
- /**
18
- * Toggles the dev-mode "must be inside a `<Loading>` boundary" enforcement
19
- * window. Only `render()` calls this — wrapping the initial mount so that a
20
- * top-level uncaught async read surfaces the diagnostic. Not part of the
21
- * user-facing API.
22
- *
23
- * @internal
24
- */
25
- export declare function enforceLoadingBoundary(enabled: boolean): void;
26
- export declare function setProjectionWriteActive(value: boolean): void;
27
- export declare function setTrackedQueueCallback(value: boolean): void;
28
- export declare function setEffectCallback(value: boolean): void;
29
- export type QueueCallback = (type: number) => void;
30
- type QueueStub = {
31
- _queues: [QueueCallback[], QueueCallback[]];
32
- _children: QueueStub[];
33
- };
34
- type OptimisticNode = Signal<any> | Computed<any>;
35
- export interface Transition {
36
- _time: number;
37
- _asyncReporters: Map<Computed<any>, Set<Computed<any>>>;
38
- _pendingNodes: Signal<any>[];
39
- _optimisticNodes: OptimisticNode[];
40
- _affectsNodes: OptimisticNode[];
41
- _optimisticStores: Set<any>;
42
- _actions: Array<Generator<any, any, any> | AsyncGenerator<any, any, any>>;
43
- _queueStash: QueueStub;
44
- _done: boolean | Transition;
45
- _gatedSubs: Set<Computed<any>>;
46
- }
47
- /**
48
- * Flip-entanglement (#3164 follow-up): `until()` is a declaration of
49
- * relatedness — the predicate names the condition that confirms the awaiting
50
- * transaction. When the predicate settles truthy, every live foreign
51
- * transition whose staged write it read IS the confirming event by the
52
- * user's own definition, so it merges into the awaiting transaction and
53
- * reveals at the joint settle — the cross-primitive twin of the family fold
54
- * (a landing on an optimism-carrying family joins the retaining
55
- * transaction). Non-flipping updates never pass through here: falsy
56
- * evaluations don't entangle, so unrelated traffic on the watched sources
57
- * reveals freely on its own schedule.
58
- *
59
- * Runs inside the predicate's compute (pure phase) — the confirming
60
- * transition's stamps are still live and its commit decision hasn't run, so
61
- * the merge lands before any reveal. Only the tree-shaken graphs that call
62
- * `until()` retain this.
63
- */
64
- export declare function entangleConfirmingTransitions(obs: Computed<any>, target: Transition): void;
65
- export declare function schedule(): void;
66
- /**
67
- * Permanently halts the reactive system. Called when a user error escapes
68
- * every boundary — app state is undefined at that point, so scheduling stops
69
- * entirely rather than limping along with a half-applied update.
70
- */
71
- export declare function haltReactivity(cause?: unknown): void;
72
- /** @internal Test/dev-reload hook. Revives scheduling after a halt. */
73
- export declare function resetErrorHalt(): void;
74
- export interface IQueue {
75
- enqueue(type: number, fn: QueueCallback): void;
76
- run(type: number): boolean | void;
77
- addChild(child: IQueue): void;
78
- removeChild(child: IQueue): void;
79
- created: number;
80
- notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
81
- stashQueues(stub: QueueStub): void;
82
- restoreQueues(stub: QueueStub): void;
83
- _parent: IQueue | null;
84
- }
85
- export declare class Queue implements IQueue {
86
- _parent: IQueue | null;
87
- _queues: [QueueCallback[], QueueCallback[]];
88
- _children: IQueue[];
89
- _ranAt: number;
90
- created: number;
91
- addChild(child: IQueue): void;
92
- removeChild(child: IQueue): void;
93
- notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
94
- run(type: number): void;
95
- enqueue(type: number, fn: QueueCallback): void;
96
- stashQueues(stub: QueueStub): void;
97
- restoreQueues(stub: QueueStub): void;
98
- }
99
- export declare class GlobalQueue extends Queue {
100
- _running: boolean;
101
- _batch: Transition;
102
- static _update: (el: Computed<unknown>) => void;
103
- static _dispose: (el: Computed<unknown>, self: boolean, zombie: boolean) => void;
104
- static _runEffect: (el: Computed<unknown>) => void;
105
- static _clearOptimisticStores: ((stores: Set<any>, completing: Transition | null) => void) | null;
106
- static _releaseAffectsScope: ((node: OptimisticNode) => void) | null;
107
- static _releaseAffectsMarks: ((nodes: OptimisticNode[]) => void) | null;
108
- static _markAffects: ((node: OptimisticNode) => void) | null;
109
- static _releaseAffectsMark: ((node: OptimisticNode) => void) | null;
110
- static _wireExternalSource: ((self: Computed<any>) => void) | null;
111
- static _externalUntrack: (<T>(fn: () => T) => T) | null;
112
- static _syncCompanions: (<T>(el: Signal<T> | Computed<T>, value: T) => void) | null;
113
- static _updatePendingSignal: ((el: OptimisticNode) => void) | null;
114
- static _updateChildCompanions: ((el: Computed<any>) => void) | null;
115
- static _snapCompanions: ((el: OptimisticNode) => void) | null;
116
- static _latestRead: (<T>(el: Signal<T> | Computed<T>) => T) | null;
117
- static _pendingCheck: ((el: OptimisticNode, c: Computed<any> | null, owner: OptimisticNode, firewall: Computed<any> | null) => void) | null;
118
- static _recordFresh: ((el: OptimisticNode, value: any) => void) | null;
119
- static _applyReask: ((el: Computed<any>, hadReask: boolean) => boolean) | null;
120
- static _repollVerdicts: ((el: Computed<any>, snap?: boolean) => void) | null;
121
- static _witnessAffects: ((node: OptimisticNode) => void) | null;
122
- static _wakeSuppressedProbes: ((transition: Transition) => void) | null;
123
- static _optimisticWrite: (<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)) => T) | null;
124
- static _resolveOptimistic: ((nodes: OptimisticNode[]) => void) | null;
125
- static _transitionBlocked: ((transition: Transition) => boolean) | null;
126
- static _cleanupLanes: ((completingTransition: Transition | null) => void) | null;
127
- static _runLaneEffects: ((type: number) => void) | null;
128
- /** Patch-channel optimistic drain (next/patch.ts): optimistic emissions
129
- * apply at lane-effect timing — visible in flight, unlike the regular
130
- * effect queues an action stashes. Injected; null when unused. */
131
- static _drainPatchOptimistic: (() => void) | null;
132
- static _gatedRead: ((el: Signal<any>, owner: OptimisticNode, c: Computed<any>) => boolean) | null;
133
- static _laneSuspends: ((owner: OptimisticNode) => boolean) | null;
134
- static _laneReadsCommitted: ((el: OptimisticNode, owner: OptimisticNode, c: Computed<any>) => boolean) | null;
135
- static _recomputeLane: ((el: Computed<any>, own: boolean) => OptimisticLane | null | false) | null;
136
- static _laneAsyncPending: ((el: Computed<any>) => void) | null;
137
- /** Authoritative-view reader wakeup: installed by until() and refresh() before
138
- * their first read. Call sites are gated by CONFIG_AUTHORITATIVE_OBSERVED, which
139
- * only such a reader's carve-out read can set, so `!` invocations are safe once
140
- * the gate holds (#3303). */
141
- static _notifyAuthoritativeObservers: ((el: Signal<any> | Computed<any>) => void) | null;
142
- static _laneAsyncSettled: ((el: Computed<any>) => void) | null;
143
- static _trackOptimisticStore: ((store: any) => void) | null;
144
- flush(): void;
145
- notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
146
- initTransition(transition?: Transition | null): void;
147
- }
148
- export declare function queuePendingNode(node: Signal<any>): void;
149
- export declare let reaskArmed: boolean;
150
- /** §12d: bumped by every recompute and every new subscriber edge. A node's
151
- * staged-rewrite skip is sound only while NOTHING recomputed or linked since
152
- * its last notify — a mid-batch pull can clean a marked subscriber, and a
153
- * skipped re-write would leave it stale. */
154
- export declare let notifyEpoch: number;
155
- export declare function bumpNotifyEpoch(): void;
156
- export declare function armReaskClear(): void;
157
- export declare function insertSubs(node: Signal<any> | Computed<any>, optimistic?: boolean): void;
158
- export declare let storeCommitHook: (() => void) | null;
159
- export declare function setStoreCommitHook(fn: () => void): void;
160
- /** Patch-channel release hook (next/patch.ts): transition-stamped patch
161
- * emissions are released when THEIR batch commits. Transitions never
162
- * abort: failed actions still commit (only optimistic overrides revert),
163
- * and merged-away transitions hand their stash to the survivor
164
- * (mergeTransitionState) — every stash drains exactly once. Injected like
165
- * storeCommitHook to stay tree-shakeable. */
166
- export declare let patchCommitHook: ((batch: Transition) => void) | null;
167
- export declare function setPatchCommitHook(fn: (batch: Transition) => void): void;
168
- export declare function finalizePureQueue(completingTransition?: Transition | null, incomplete?: boolean): void;
169
- /**
170
- * Count of live `affects()` registrations across the system (including
171
- * store-scope inherited marks). Gates the read-path mark check in `read()` so
172
- * graphs that never use the feature pay one integer compare.
173
- */
174
- export declare let activeAffectsMarks: number;
175
- /**
176
- * Counter mutation seam for the mark engine in affects.ts: an imported `let`
177
- * binding is read-only, and the read-path gate above must stay a plain module
178
- * variable so `read()` pays one integer compare, not a function call.
179
- *
180
- * @internal
181
- */
182
- export declare function shiftAffectsMarks(delta: 1 | -1): void;
183
- export declare const globalQueue: GlobalQueue;
184
- /**
185
- * Synchronously processes the pending reactive queue, or runs `fn` in a synchronous
186
- * flush scope before draining the queue.
187
- *
188
- * Reactive updates are normally batched onto the microtask queue, so multiple
189
- * writes in a row collapse into a single update pass. Call `flush()` when you
190
- * need to *observe* the result of those writes synchronously — most commonly
191
- * in tests, but also at the boundary of imperative integration code. Pass a
192
- * callback when the writes themselves should bypass microtask scheduling and
193
- * drain synchronously when the callback returns.
194
- *
195
- * @example
196
- * ```ts
197
- * const [count, setCount] = createSignal(0);
198
- * const doubled = createMemo(() => count() * 2);
199
- *
200
- * setCount(5);
201
- * flush();
202
- * expect(doubled()).toBe(10);
203
- *
204
- * flush(() => setCount(6));
205
- * expect(doubled()).toBe(12);
206
- *
207
- * // Nested flushes drain at each level:
208
- * flush(() => {
209
- * setCount(7);
210
- * flush(() => setCount(8)); // inner drain — effects fire here
211
- * // outer continues with up-to-date state
212
- * });
213
- * ```
214
- */
215
- export declare function flush(): void;
216
- export declare function flush<T>(fn: () => T): T;
217
- /** A fresh, unentered transaction (#3146): the optimistic store's truth
218
- * flight DECLARES an owned transaction instead of relying on whatever the
219
- * ambient adoption machinery stamped on its firewall. Activate it with
220
- * initTransition; it is a plain batch until then. */
221
- export declare function createTransition(): Transition;
222
- export declare function currentTransition(transition: Transition): Transition;
223
- export declare function setActiveTransition(transition: Transition | null): void;
224
- export declare function runInTransition<T>(transition: Transition, fn: () => T): T;
225
- /** Run `fn` with `transition` as BOTH the ambient transaction and the
226
- * registration batch, restoring both after. runInTransition alone is not
227
- * enough for code that WRITES on behalf of a transaction from inside someone
228
- * else's window (optimistic replay re-arming a still-open action's edits
229
- * during a landing commit, #3123): registrations route through the queue's
230
- * batch pointer, and a bare activeTransition swap leaves them in the ambient
231
- * batch — a plain batch "completes" at the next flush and reverts optimistic
232
- * registrations that were supposed to live with the transaction.
233
- * initTransition is the wrong tool here: it MERGES the currently ambient
234
- * transaction into the target, entangling whatever the interrupted window
235
- * belonged to. */
236
- export declare function runAsTransitionBatch<T>(transition: Transition, fn: () => T): T;
@@ -1,204 +0,0 @@
1
- import type { NOT_PENDING } from "./constants.cjs";
2
- import type { OptimisticLane } from "./lanes.cjs";
3
- import type { IQueue, Transition } from "./scheduler.cjs";
4
- export interface Disposable {
5
- (): void;
6
- }
7
- export interface Link {
8
- _dep: Signal<unknown> | Computed<unknown>;
9
- _sub: Computed<unknown>;
10
- _nextDep: Link | null;
11
- _prevSub: Link | null;
12
- _nextSub: Link | null;
13
- /**
14
- * `_sub._depGen` at the time this link was created or last revalidated
15
- * in-order. A link stamped with the subscriber's current pass generation is
16
- * inside the validated `[deps.._depsTail]` prefix — an O(1) replacement for
17
- * scanning the dep list to answer membership (see `link()`).
18
- */
19
- _gen: number;
20
- _pendingObserver?: boolean;
21
- }
22
- export interface NodeOptions<T> {
23
- id?: string;
24
- name?: string;
25
- transparent?: boolean;
26
- equals?: ((prev: T, next: T) => boolean) | false;
27
- ownedWrite?: boolean;
28
- /** Exclude this signal from snapshot capture (internal — not part of public API) */
29
- _noSnapshot?: boolean;
30
- /** Extra CONFIG_* bits OR'd into the node's config at creation (internal —
31
- * not part of public API). Used by resolve()/until() for
32
- * CONFIG_DIRECT_COMMIT / CONFIG_AUTHORITATIVE_READ, keeping the per-flag
33
- * option arms out of the core creation path. */
34
- _extraConfig?: number;
35
- unobserved?: () => void;
36
- lazy?: boolean;
37
- sync?: boolean;
38
- /**
39
- * Commit #0. When present (checked with `in`, so an explicit `undefined`
40
- * counts), the node is born committed with this value instead of
41
- * STATUS_UNINITIALIZED: reads serve it everywhere, nothing suspends to
42
- * Loading boundaries, transitions are never held, and the window is
43
- * verdict-quiet (`isPending` stays false — commit #0 answers the question
44
- * by declaration; first-load affordances live in the value itself). After
45
- * the first real answer lands, normal refetch/pending semantics apply.
46
- */
47
- loadingValue?: T;
48
- }
49
- /**
50
- * Cold node extension (stage-3 §12): optional machinery that most nodes
51
- * never touch lives one hop away so the CORE node literal stays under V8's
52
- * in-object property boundary (~39 fields measured: past it, every literal
53
- * allocation spills to an out-of-object backing store and creation cost
54
- * roughly quadruples — the create0to1 cliff). Allocated lazily by `ext()`
55
- * on first installer write; ONE shape shared by signals and computeds so
56
- * `_x` access stays monomorphic. Presence bits on `_config`
57
- * (CONFIG_OPTIMISTIC / HAS_COMPANIONS / HAS_LANE / HAS_SNAPSHOT) remain the
58
- * hot-path gates — a bit says "consult _x", never the reverse.
59
- */
60
- export interface NodeExtension {
61
- _overrideValue: unknown | typeof NOT_PENDING;
62
- /**
63
- * The transaction that owns the active override (stamped at optimistic
64
- * write, cleared at settle). Ownership must live on the node: a lane's
65
- * _transition is a scheduling affinity that a shared subscriber can merge
66
- * across transactions (#2912) — following it would let one action's settle
67
- * revert another action's live override. Node-level sibling of the store
68
- * layer's STORE_OPTIMISTIC_OWNERS stamps (#2899). `null` = ambient write.
69
- */
70
- _overrideOwner: Transition | null | undefined;
71
- _optimisticLane: OptimisticLane | undefined;
72
- _pendingSignal: Signal<boolean> | undefined;
73
- _latestValueComputed: Computed<any> | undefined;
74
- _parentSource: Signal<any> | Computed<any> | undefined;
75
- /**
76
- * Live `affects()` marks on this node (refcount). Non-zero is declared
77
- * motion — see affects(); the count is the mark's only graph state.
78
- */
79
- _affectsCount: number;
80
- _inFlight: PromiseLike<any> | AsyncIterable<any> | null;
81
- /** Cancellation for the CURRENT iterator flight (#3122): closes the
82
- * iterator (`it.return()`), idempotent. Fired at the sites that release
83
- * `_inFlight` so a superseded stream stops at supersede time — its owner
84
- * cleanup registration may ride the zombie-disposal channel, which a held
85
- * transition defers until the SUPERSEDING flight settles. Null for plain
86
- * promise flights (no cancellation hook exists). */
87
- _flightTeardown: (() => void) | null;
88
- _error: unknown;
89
- _blocked: boolean | undefined;
90
- _pendingSources: Set<Computed<any>> | undefined;
91
- _notifyStatus: ((status?: number, error?: any) => void) | undefined;
92
- /** Question-scoped re-ask classification of the current pending window
93
- * (see the former Computed._x?._reask doc): set by recompute from
94
- * REACTIVE_REASK, cleared on landing; meaningless while not pending. */
95
- _reask: boolean;
96
- _child: FirewallSignal<any> | null;
97
- _unobserved: (() => void) | undefined;
98
- _snapshotValue: any;
99
- /** Zombie staging (staged disposal): a recompute of an owner that HAS
100
- * children/disposal parks them here until the flush commits (or a
101
- * transition reverts). Childless nodes — the common case — never write
102
- * these. */
103
- _pendingDisposal: Disposable | Disposable[] | null;
104
- _pendingFirstChild: Owner | null;
105
- /** #3038: the firewall children that actually carry isPending()/latest()
106
- * companions. The post-recompute companion snap iterates THIS set —
107
- * O(companions asked for) — never the full `_child` chain (one entry per
108
- * materialized leaf). Populated at companion creation; entries live as
109
- * long as their companions (which are permanent once created). */
110
- _companionChildren: Set<FirewallSignal<any>> | undefined;
111
- }
112
- export interface RawSignal<T> {
113
- _subs: Link | null;
114
- _subsTail: Link | null;
115
- /**
116
- * DEV-only live subscriber count. Maintained by `link`/`unlinkSubs` for
117
- * graph-size diagnostics; undefined in production.
118
- */
119
- _subCount?: number;
120
- _value: T;
121
- _name?: string;
122
- _equals: false | ((a: T, b: T) => boolean);
123
- _config: number;
124
- _time: number;
125
- /** IN CORE, not the extension (stage-3 §12c): consulted on EVERY write
126
- * (setSignal's transition-init check) and on recompute scheduling — the
127
- * per-write extension chase measurably taxed propagation chains. */
128
- _transition: Transition | null;
129
- /** Notify-epoch stamp of the last subscriber walk (§12d). A re-write to an
130
- * already-staged node whose stamp still equals the global epoch skips the
131
- * whole walk — marking is idempotent, and the epoch bumps on every
132
- * recompute and new subscriber edge (either can invalidate the skip). */
133
- _notifiedAt: number;
134
- _pendingValue: T | typeof NOT_PENDING;
135
- /** Cold extension — see NodeExtension. */
136
- _x: NodeExtension | null;
137
- }
138
- export interface FirewallSignal<T> extends RawSignal<T> {
139
- _firewall: Computed<any>;
140
- _nextChild: FirewallSignal<unknown> | null;
141
- }
142
- export type Signal<T> = RawSignal<T> | FirewallSignal<T>;
143
- export interface Owner {
144
- id?: string;
145
- _config: number;
146
- _snapshotScope?: boolean;
147
- /** Effect-returned cleanup; managed across reruns, invoked at true disposal */
148
- _cleanup?: () => void;
149
- _disposal: Disposable | Disposable[] | null;
150
- _parent: Owner | null;
151
- _context: Record<symbol | string, unknown>;
152
- _childCount: number;
153
- _queue: IQueue;
154
- _firstChild: Owner | null;
155
- _nextSibling: Owner | null;
156
- _prevSibling: Owner | null;
157
- /** Cold extension — see NodeExtension (owners use the zombie-pair slots). */
158
- _x: NodeExtension | null;
159
- }
160
- export interface Computed<T> extends RawSignal<T>, Owner {
161
- _deps: Link | null;
162
- _depsTail: Link | null;
163
- /**
164
- * DEV-only live source count. Maintained by `link`/`unlinkSubs` for
165
- * graph-size diagnostics; undefined in production.
166
- */
167
- _depCount?: number;
168
- /** Recompute-pass counter; bumped when dep revalidation starts. */
169
- _depGen: number;
170
- _flags: number;
171
- _statusFlags: number;
172
- _height: number;
173
- _nextHeap: Computed<any> | undefined;
174
- _prevHeap: Computed<any>;
175
- _fn: (prev?: T) => T;
176
- /**
177
- * Clock tick at which REACTIVE_MANUAL_WRITE was last applied
178
- * (`suppressComputedRecompute`). Lets `refresh()` distinguish a same-tick
179
- * manual write (which wins over the refresh, #2692) from a mask carried
180
- * across ticks by a transaction (which an explicit refresh lifts, #3026).
181
- * Only meaningful while REACTIVE_MANUAL_WRITE is set.
182
- */
183
- _manualWriteTime?: number;
184
- /**
185
- * True while a `loadingValue` node's first real answer hasn't landed: the
186
- * node was born committed (commit #0 = the loading value) and `handleAsync`
187
- * serves that committed value instead of throwing NotReadyError, so first
188
- * flights never suspend readers, trip boundaries, or hold transitions.
189
- * The window is verdict-quiet: `isPending` stays false, because commit #0
190
- * answers the question by declaration (first-load affordances belong to
191
- * the value channel). Cleared by the first value landing on any path (sync
192
- * return, sync-resolved promise, first iterator yield, async settle); a
193
- * real error leaves it set — errors answer reads but don't enter the value
194
- * lineage, so a retry serves the loading value again. Once cleared, normal
195
- * pending/refetch semantics apply forever. (Stays in CORE: written
196
- * unconditionally by recompute and every commit.)
197
- */
198
- _loading: boolean;
199
- }
200
- export interface Root extends Owner {
201
- _root: true;
202
- _parentComputed: Computed<any> | null;
203
- dispose(self?: boolean): void;
204
- }
@@ -1,2 +0,0 @@
1
- export declare function latest<T>(fn: () => T): T;
2
- export declare function isPending(fn: () => any): boolean;
@@ -1,10 +0,0 @@
1
- export { $REFRESH, ContextNotFoundError, NoOwnerError, NotReadyError, TimeoutError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, isDisposed, getObserver, isEqual, untrack, isPending, latest, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, enforceLoadingBoundary, enableExternalSource, resetErrorHalt } from "./core/index.cjs";
2
- import { type Dev } from "./core/index.cjs";
3
- export declare const DEV: Dev | undefined;
4
- export type { Owner, Context, ContextRecord, IQueue, ExternalSourceFactory, ExternalSource, ExternalSourceConfig, Refreshable, Dev, DevHooks, DiagnosticCapture, DiagnosticCode, DiagnosticEvent, DiagnosticKind, Diagnostics, DiagnosticSeverity } from "./core/index.cjs";
5
- export { createSignal, createMemo, createEffect, createRenderEffect, createTrackedEffect, createReaction, createOptimistic, refresh, resolve, until, onSettled, onCleanup } from "./signals.cjs";
6
- export type { Truthy, UntilOptions, Accessor, SourceAccessor, Setter, Signal, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, SignalOptions, MemoOptions, NoInfer } from "./signals.cjs";
7
- export { affects } from "./affects.cjs";
8
- export { mapArray, repeat, type Maybe } from "./map.cjs";
9
- export * from "./store/index.cjs";
10
- export { createLoadingBoundary, createErrorBoundary, createRevealOrder, flatten, type RevealOrder } from "./boundaries.cjs";
@@ -1,69 +0,0 @@
1
- import { type Accessor } from "./signals.cjs";
2
- export type Maybe<T> = T | void | null | undefined | false;
3
- /**
4
- * Reactively maps an array, reusing the previously-mapped value for unchanged
5
- * items.
6
- *
7
- * The callback shape follows the keying mode:
8
- * - default / `keyed: true` receives `(item, index)` where `item` is the raw
9
- * row value and `index` is an accessor.
10
- * - `keyed: false` receives `(item, index)` where `item` is an accessor and
11
- * `index` is a stable number.
12
- * - `keyed: item => key` receives accessors for both arguments.
13
- *
14
- * This is the underlying helper that powers `<For>`. App code should use
15
- * `<For>` directly; reach for `mapArray` when implementing custom list
16
- * components.
17
- *
18
- * - `options.keyed` — `true` (default for primitives) compares by identity;
19
- * `false` falls back to index-only mapping; pass a function `(item) => key`
20
- * for stable identity by extracted key.
21
- * - `options.fallback` — accessor returning a value to show when the input is
22
- * empty.
23
- *
24
- * @example
25
- * ```ts
26
- * const view = mapArray(
27
- * items,
28
- * (item, index) => `${index()}: ${item.label}`,
29
- * { fallback: () => "no items" }
30
- * );
31
- * ```
32
- *
33
- * @description https://docs.solidjs.com/reference/reactive-utilities/map-array
34
- */
35
- export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Item, index: Accessor<number>) => MappedItem, options?: {
36
- keyed?: true;
37
- fallback?: Accessor<any>;
38
- name?: string;
39
- }): Accessor<MappedItem[]>;
40
- export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Accessor<Item>, index: number) => MappedItem, options: {
41
- keyed: false;
42
- fallback?: Accessor<any>;
43
- name?: string;
44
- }): Accessor<MappedItem[]>;
45
- export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Accessor<Item>, index: Accessor<number>) => MappedItem, options: {
46
- keyed: (item: Item) => any;
47
- fallback?: Accessor<any>;
48
- name?: string;
49
- }): Accessor<MappedItem[]>;
50
- /**
51
- * Reactively renders a callback `count` times, reusing previously-rendered
52
- * entries when only the count changes. Underlying helper for `<Repeat>`.
53
- *
54
- * - `options.from` — start index (default `0`); useful for offset/windowed
55
- * rendering.
56
- * - `options.fallback` — accessor returning a value to show when count is `0`.
57
- *
58
- * @example
59
- * ```ts
60
- * const view = repeat(count, i => `Item ${i}`, { fallback: () => "empty" });
61
- * ```
62
- *
63
- * @description https://docs.solidjs.com/reference/reactive-utilities/repeat
64
- */
65
- export declare function repeat(count: Accessor<number>, map: (index: number) => any, options?: {
66
- from?: Accessor<number | undefined>;
67
- fallback?: Accessor<any>;
68
- name?: string;
69
- }): Accessor<any[]>;
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,18 +0,0 @@
1
- export type { Store, StoreReturn, ProjectionStoreReturn, StoreSetter, StoreNode, StoreOptions, ProjectionOptions, NotWrappable, SolidStore } from "./store.cjs";
2
- export type { Merge, Omit } from "./utils.cjs";
3
- export { isWrappable, $TRACK, $PROXY, $TARGET } from "./store.cjs";
4
- import type { NoFn, ProjectionOptions, Store, StoreOptions, StoreSetter } from "./store.cjs";
5
- import type { Refreshable } from "../core/index.cjs";
6
- export { createProjectionNext as createProjection } from "./next/projection.cjs";
7
- export { storeIsShallow, storeHasFamily, storeHasOptimisticFamily } from "./next/store.cjs";
8
- export { createOptimisticStoreNext as createOptimisticStore } from "./next/optimistic.cjs";
9
- /** Public createStore: plain form `(initialValue, options?)` and derived writable
10
- * form `(fn, seed, options?)`. */
11
- export declare function createStore<T extends object = {}>(initialValue: NoFn<T> | Store<NoFn<T>>, options?: StoreOptions): [get: Store<T>, set: StoreSetter<T>];
12
- export declare function createStore<T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, seed: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): [get: Refreshable<Store<T>>, set: StoreSetter<T>];
13
- export declare function reconcile<T extends U, U>(value: T, key?: string | ((item: NonNullable<any>) => any) | null): (state: U) => T;
14
- export declare function snapshot<T>(value: T): T;
15
- export declare function deep<T>(value: T): T;
16
- export { storePath } from "./storePath.cjs";
17
- export type { PathSetter, Part, StorePathRange, ArrayFilterFn, CustomPartial } from "./storePath.cjs";
18
- export { merge, omit } from "./utils.cjs";
@@ -1,25 +0,0 @@
1
- import { type Refreshable } from "../../core/index.cjs";
2
- import { type Transition } from "../../core/scheduler.cjs";
3
- import { type NoFn, type ProjectionOptions, type Store, type StoreOptions, type StoreSetter } from "../store.cjs";
4
- import type { StoreNextTarget } from "./target.cjs";
5
- /** #3164 fold: a stamped truth is HELD (masked from ordinary readers until
6
- * the reveal) only while its transition is live AND retaining optimism —
7
- * overrides are what make partial-coverage composition a tear. A plain
8
- * async transition carries no overrides, so downstream computes must see
9
- * staged values to converge (normal speculation). Resolves merges first:
10
- * merge unions optimistic nodes/stores into the target. */
11
- export declare function transitionHoldsOptimism(transition: Transition): boolean;
12
- export declare function createOptimisticStoreNext<T extends object = {}>(initialValue: NoFn<T> | Store<NoFn<T>>, options?: StoreOptions): [get: Store<T>, set: StoreSetter<T>];
13
- export declare function createOptimisticStoreNext<T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, seed: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): [get: Refreshable<Store<T>>, set: StoreSetter<T>];
14
- /** Diff the draft against the current OPTIMISTIC VIEW (committed + active
15
- * overrides — the same view the draft was seeded from) and emit engine writes
16
- * for exactly the changed keys. Visible-view diffing keeps no-op writes from
17
- * entangling lanes (RUL-10 / opt R38). */
18
- export declare function notifyOptimisticWrites(t: StoreNextTarget, pb: Record<PropertyKey, any>): void;
19
- /** Optimistic-view composition for snapshot/deep (O1: snapshot is the CURRENT
20
- * view, lane values included; a fresh copy per call during pending windows —
21
- * RUL-12). Returns `src` untouched when no override is active on `t`.
22
- * Authoritative-view reads (until()'s predicate) skip composition entirely:
23
- * the predicate observes authoritative truth, never the caller's tentative
24
- * overlay. (Write-side emission callers never run under such a compute.) */
25
- export declare function optimisticView(t: StoreNextTarget, src: Record<PropertyKey, any>): Record<PropertyKey, any>;
@@ -1,8 +0,0 @@
1
- import { type Computed, type Refreshable } from "../../core/index.cjs";
2
- import { type NoFn, type ProjectionOptions, type Store } from "../store.cjs";
3
- export declare function createProjectionNext<T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, seed: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): Refreshable<Store<T>>;
4
- /** Derived writable store (legacy parity): a projection whose public setter
5
- * masks the recompute for the tick (core R31 — the manual write wins over a
6
- * same-flush dependency change). */
7
- export declare function createStoreDerivedNext<T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, seed: Partial<T> | Store<NoFn<T>>, options?: ProjectionOptions): [Refreshable<Store<T>>, (f: (draft: T) => T | void) => void];
8
- export declare function runProjectionComputedNext<T extends object>(wrappedStore: Store<T>, fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, key: string | ((item: NonNullable<any>) => any) | null, wrapCommit?: (write: () => void, value: T) => void, aroundDraftWrite?: (op: () => void) => void): Computed<void | T>;
@@ -1,10 +0,0 @@
1
- type KeyFn = (item: any) => any;
2
- export declare function reconcileNextState(value: any, state: any, key: string | KeyFn | null | undefined, replace?: boolean): void;
3
- /** Setter-channel row ops (the fold site calls this for array targets with
4
- * ops consumers): structural mutation through the setter — push/splice/index
5
- /** Key equality for EVERY key comparison in this module (re-audit 2, P1-5):
6
- * SameValueZero, matching the adoption window's Map-based matcher — NaN keys
7
- * are equal to themselves, so aligned NaN rows stay aligned in the prefix
8
- * walk instead of forever misaligning. */
9
- export declare function sameKey(a: any, b: any): boolean;
10
- export {};