@solidjs/signals 2.0.0-rc.13 → 2.0.0-rc.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev-shared.js +2000 -3768
- package/dist/dev.attribution.js +132 -79
- package/dist/dev.js +7226 -8488
- package/dist/observe/affects.js +125 -104
- package/dist/observe/boundaries.js +458 -665
- package/dist/observe/core/action.js +63 -66
- package/dist/observe/core/async.js +240 -383
- package/dist/observe/core/attribution-queries.js +1 -1
- package/dist/observe/core/attribution.js +240 -183
- package/dist/observe/core/constants.js +115 -187
- package/dist/observe/core/context.js +3 -3
- package/dist/observe/core/core.js +840 -1438
- package/dist/observe/core/dev.js +3 -3
- package/dist/observe/core/effect.js +75 -86
- package/dist/observe/core/external.js +5 -5
- package/dist/observe/core/graph.js +61 -70
- package/dist/observe/core/heap.js +75 -98
- package/dist/observe/core/invariants.js +1 -34
- package/dist/observe/core/lanes.js +704 -181
- package/dist/observe/core/owner.js +80 -101
- package/dist/observe/core/scheduler.js +708 -1351
- package/dist/observe/core/verdict.js +302 -621
- package/dist/observe/flatten.js +79 -0
- package/dist/observe/index.js +15 -13
- package/dist/observe/map.js +232 -235
- package/dist/observe/reveal.js +212 -0
- package/dist/observe/signals.js +133 -215
- package/dist/observe/store/affects.js +135 -0
- package/dist/observe/store/index.js +29 -24
- package/dist/observe/store/optimistic.js +538 -0
- package/dist/observe/store/projection.js +302 -0
- package/dist/observe/store/reconcile.js +257 -0
- package/dist/observe/store/store.js +1945 -277
- package/dist/observe/store/storePath.js +1 -1
- package/dist/{prod/store/next → observe/store}/target.js +17 -18
- package/dist/observe/store/types.js +73 -0
- package/dist/observe/store/utils.js +1 -13
- package/dist/prod/affects.js +127 -106
- package/dist/prod/boundaries.js +442 -654
- package/dist/prod/core/action.js +71 -74
- package/dist/prod/core/async.js +307 -442
- package/dist/prod/core/constants.js +112 -186
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +852 -1458
- package/dist/prod/core/effect.js +88 -99
- package/dist/prod/core/external.js +5 -5
- package/dist/prod/core/graph.js +61 -70
- package/dist/prod/core/heap.js +75 -98
- package/dist/prod/core/invariants.js +1 -32
- package/dist/prod/core/lanes.js +666 -181
- package/dist/prod/core/owner.js +75 -96
- package/dist/prod/core/scheduler.js +677 -1332
- package/dist/prod/core/verdict.js +297 -621
- package/dist/prod/flatten.js +77 -0
- package/dist/prod/index.js +15 -13
- package/dist/prod/map.js +143 -146
- package/dist/prod/reveal.js +212 -0
- package/dist/prod/signals.js +144 -226
- package/dist/prod/store/affects.js +135 -0
- package/dist/prod/store/index.js +28 -19
- package/dist/prod/store/optimistic.js +533 -0
- package/dist/prod/store/projection.js +295 -0
- package/dist/prod/store/reconcile.js +257 -0
- package/dist/prod/store/store.js +1840 -272
- package/dist/prod/store/storePath.js +1 -1
- package/dist/{observe/store/next → prod/store}/target.js +13 -17
- package/dist/prod/store/types.js +73 -0
- package/dist/prod/store/utils.js +1 -11
- package/dist/types/affects.d.ts +11 -30
- package/dist/types/boundaries.d.ts +62 -176
- package/dist/types/carved.d.ts +1 -0
- package/dist/types/core/action.d.ts +5 -6
- package/dist/types/core/async.d.ts +10 -5
- package/dist/types/core/attribution-hooks.d.ts +20 -1
- package/dist/types/core/attribution.d.ts +20 -9
- package/dist/types/core/constants.d.ts +125 -180
- package/dist/types/core/core.d.ts +104 -264
- package/dist/types/core/dev.d.ts +2 -2
- package/dist/types/core/effect.d.ts +0 -7
- package/dist/types/core/graph.d.ts +7 -1
- package/dist/types/core/heap.d.ts +5 -7
- package/dist/types/core/index.d.ts +5 -5
- package/dist/types/core/invariants.d.ts +0 -29
- package/dist/types/core/lanes.d.ts +65 -87
- package/dist/types/core/owner.d.ts +3 -3
- package/dist/types/core/scheduler.d.ts +249 -331
- package/dist/types/core/types.d.ts +51 -85
- package/dist/types/core/verdict.d.ts +3 -0
- package/dist/types/flatten.d.ts +8 -0
- package/dist/types/index.d.ts +6 -4
- package/dist/types/reveal.d.ts +19 -0
- package/dist/types/signals.d.ts +35 -91
- package/dist/types/store/affects.d.ts +1 -0
- package/dist/types/store/index.d.ts +35 -15
- package/dist/types/store/optimistic.d.ts +23 -0
- package/dist/types/store/projection.d.ts +18 -0
- package/dist/types/store/reconcile.d.ts +3 -0
- package/dist/types/store/store.d.ts +165 -143
- package/dist/types/store/storePath.d.ts +1 -1
- package/dist/types/store/target.d.ts +151 -0
- package/dist/types/store/types.d.ts +84 -0
- package/package.json +1 -1
- package/dist/observe/core/optimistic.js +0 -669
- package/dist/observe/store/next/optimistic.js +0 -717
- package/dist/observe/store/next/projection.js +0 -266
- package/dist/observe/store/next/reconcile.js +0 -375
- package/dist/observe/store/next/store.js +0 -2608
- package/dist/prod/core/optimistic.js +0 -658
- package/dist/prod/store/next/optimistic.js +0 -710
- package/dist/prod/store/next/projection.js +0 -257
- package/dist/prod/store/next/reconcile.js +0 -373
- package/dist/prod/store/next/store.js +0 -2484
- package/dist/types/core/optimistic.d.ts +0 -6
- package/dist/types/store/next/optimistic.d.ts +0 -25
- package/dist/types/store/next/projection.d.ts +0 -27
- package/dist/types/store/next/reconcile.d.ts +0 -10
- package/dist/types/store/next/store.d.ts +0 -145
- package/dist/types/store/next/target.d.ts +0 -196
package/dist/observe/affects.js
CHANGED
|
@@ -1,129 +1,150 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $REFRESH, CONFIG_VERDICT, STATUS_PENDING, CONFIG_SLOT_NODE, STATUS_ERROR, REACTIVE_RECOMPUTING_DEPS } from "./core/constants.js";
|
|
2
2
|
|
|
3
|
-
import { ext
|
|
4
|
-
|
|
5
|
-
import { $REFRESH, STATUS_PENDING } from "./core/constants.js";
|
|
3
|
+
import { ext } from "./core/core.js";
|
|
6
4
|
|
|
7
5
|
import "./core/dev.js";
|
|
8
6
|
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import { GlobalQueue,
|
|
12
|
-
|
|
13
|
-
import "./
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
import { enqueueSub } from "./core/heap.js";
|
|
8
|
+
|
|
9
|
+
import { GlobalQueue, schedule, resolveTx, flushTransaction } from "./core/scheduler.js";
|
|
10
|
+
|
|
11
|
+
import { $TARGET } from "./store/types.js";
|
|
12
|
+
|
|
13
|
+
// `affects()` — the declaration verb of the pending model (A24 (4), ruled
|
|
14
|
+
// 2026-07-13; the #2893 audit corollaries; rebuilt on L2 2026-10-02 as ruled:
|
|
15
|
+
// transaction-inert).
|
|
16
|
+
// A mark is a declared in-flight change: the marked node — and everything
|
|
17
|
+
// derived from it — reads pending (`isPending` → true) from the declaration
|
|
18
|
+
// until the surrounding transaction lands (an ambient mark, declared outside
|
|
19
|
+
// one, releases at the next seam). The marked values stay readable: no reader
|
|
20
|
+
// suspends on a mark, a mark holds nothing and entangles nothing — it is not
|
|
21
|
+
// a node of its transaction (`blocked` never sees it), and a reader of marked
|
|
22
|
+
// data joins nothing through it. A mark is never a re-ask, so a declared
|
|
23
|
+
// reload's own `refresh()` cannot silence it; a real error outranks it.
|
|
24
|
+
// Representation: a count on the marked node (`_x._marks`), listed with its
|
|
25
|
+
// scope (the transaction's `_marks`, or the ambient list). Coverage of the
|
|
26
|
+
// derivations is pull-derived at probe time — `isPending`'s read walks the
|
|
27
|
+
// probed node's dependencies for a marked one (verdict.ts → `_marked`) — so
|
|
28
|
+
// nothing is stored downstream and a mid-window recompute strands nothing.
|
|
29
|
+
// The push half is the verdict readers' re-derivation at registration and at
|
|
30
|
+
// release (`repoll`): the only notification a mark makes.
|
|
31
|
+
// Installed on `GlobalQueue` when imported: a program that never declares a
|
|
32
|
+
// mark carries none of this.
|
|
33
|
+
/** Live marks, every scope — the gate on the probe's walk. */
|
|
34
|
+
let active = 0;
|
|
35
|
+
|
|
36
|
+
/** Marks declared outside a transaction: released at the next seam. */ const ambient = [];
|
|
37
|
+
|
|
38
|
+
/** The verdict readers downstream of `node` — through derivations, stopping
|
|
39
|
+
* at effects — re-derive: the mark's one notification (a probe's answer
|
|
40
|
+
* changed with no value notifying anyone). */ function repoll(e, t = new Set) {
|
|
41
|
+
for (let n = e.t; n !== null; n = n.l) {
|
|
42
|
+
const e = n.o;
|
|
43
|
+
if (t.has(e)) continue;
|
|
44
|
+
t.add(e);
|
|
45
|
+
if (e.u & CONFIG_VERDICT) enqueueSub(e);
|
|
46
|
+
if (!e.i) repoll(e, t);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
20
49
|
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
50
|
+
/** A node is covered by a live mark iff it carries one, or derives — through
|
|
51
|
+
* its current dependencies — from one that does. A real error outranks an
|
|
52
|
+
* inherited mark (A24 (c)): coverage does not flow through an errored node
|
|
53
|
+
* (a direct mark on one still reads pending). Mid-recompute, only the
|
|
54
|
+
* validated prefix of the dependency list is this pass's. */ function marked(e, t) {
|
|
55
|
+
if (e.m !== null && e.m.T !== 0) return true;
|
|
56
|
+
const n = e;
|
|
57
|
+
if (n.G & STATUS_ERROR || t.has(e)) return false;
|
|
58
|
+
t.add(e);
|
|
59
|
+
const r = n.R & REACTIVE_RECOMPUTING_DEPS ? n.S : undefined;
|
|
60
|
+
if (r !== null) for (let e = n._ ?? null; e !== null; e = e.p) {
|
|
61
|
+
if (marked(e.I, t)) return true;
|
|
62
|
+
if (e === r) break;
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
31
65
|
}
|
|
32
66
|
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* no visual change.
|
|
44
|
-
*/ function notifyMarkBoundaries(e) {
|
|
45
|
-
if (!e.u && !e.o?.i) return;
|
|
46
|
-
const r = new NotReadyError(e);
|
|
47
|
-
r.l = true;
|
|
48
|
-
const t = new Set;
|
|
49
|
-
const visit = e => {
|
|
50
|
-
if (t.has(e)) return;
|
|
51
|
-
t.add(e);
|
|
52
|
-
// Display consumers (render effects, boundary computeds) act on the
|
|
53
|
-
// notification; descent stops there, exactly like the status rails.
|
|
54
|
-
const o = statusNotifierOf(e);
|
|
55
|
-
if (o) {
|
|
56
|
-
o.call(e, STATUS_PENDING, r);
|
|
57
|
-
return;
|
|
67
|
+
/** Releases one scope's marks (a landed transaction's, the ambient list at
|
|
68
|
+
* the seam): a node whose last mark drops re-derives its verdict readers. */ function release(e) {
|
|
69
|
+
for (let t = 0; t < e.length; t++) {
|
|
70
|
+
const n = e[t];
|
|
71
|
+
active--;
|
|
72
|
+
if (--n.m.T === 0) {
|
|
73
|
+
repoll(n);
|
|
74
|
+
// A store mark's carrier: its scope (and the marks the nodes born in
|
|
75
|
+
// its window inherited) goes with it.
|
|
76
|
+
GlobalQueue.N?.(n);
|
|
58
77
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
forEachDependent(e, visit);
|
|
78
|
+
}
|
|
79
|
+
e.length = 0;
|
|
62
80
|
}
|
|
63
81
|
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
markAffects(e);
|
|
74
|
-
globalQueue.m.A.push(e);
|
|
75
|
-
// Companions only exist once the verdict layer (isPending/latest) loaded;
|
|
76
|
-
// without them there is no materialized verdict to poke.
|
|
77
|
-
GlobalQueue.k !== null && GlobalQueue.k(e);
|
|
78
|
-
notifyMarkBoundaries(e);
|
|
79
|
-
schedule();
|
|
82
|
+
/** One registration: a count on the node, listed with the scope — the
|
|
83
|
+
* flush's transaction, or the ambient list (released at the seam). */ function register(e) {
|
|
84
|
+
mark(e);
|
|
85
|
+
const t = flushTransaction;
|
|
86
|
+
if (t === null) ambient.push(e); else {
|
|
87
|
+
const n = resolveTx(t);
|
|
88
|
+
(n.T ??= []).push(e);
|
|
89
|
+
}
|
|
90
|
+
repoll(e);
|
|
80
91
|
}
|
|
81
92
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
* transition-scoped — release runs inside queue finalization, where a
|
|
86
|
-
* setSignal would open a fresh override window that nothing settles).
|
|
87
|
-
*/ function releaseAffectsMark(e) {
|
|
88
|
-
shiftAffectsMarks(-1);
|
|
89
|
-
e.o.t--;
|
|
90
|
-
if (!e.o.t) {
|
|
91
|
-
GlobalQueue.k !== null && GlobalQueue.k(e, true);
|
|
92
|
-
GlobalQueue.p?.(e);
|
|
93
|
-
}
|
|
93
|
+
function mark(e) {
|
|
94
|
+
ext(e).T++;
|
|
95
|
+
active++;
|
|
94
96
|
}
|
|
95
97
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
function affects(e, t) {
|
|
99
|
+
// A store (the store half, store/affects.ts): the slot's leaf, or the
|
|
100
|
+
// record's carrier and every live node under it.
|
|
101
|
+
const n = e?.[$TARGET];
|
|
102
|
+
if (n !== undefined) {
|
|
103
|
+
const e = GlobalQueue.O(n, t);
|
|
104
|
+
for (let t = 0; t < e.length; t++) register(e[t]);
|
|
105
|
+
schedule();
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const r = e?.[$REFRESH];
|
|
109
|
+
if (!r) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
register(r);
|
|
113
|
+
schedule();
|
|
102
114
|
}
|
|
103
115
|
|
|
104
|
-
|
|
105
|
-
// lives with the feature so graphs that never declare a mark never ship it.
|
|
106
|
-
// Each call site is gated by state only this module creates (a non-empty
|
|
107
|
-
// `_affectsNodes` batch, a live scope in the store's `affectsScopes`), so the
|
|
108
|
-
// hooks are installed before the first time any of them can fire.
|
|
109
|
-
GlobalQueue.G = releaseAffectsMarks;
|
|
116
|
+
GlobalQueue.C = e => active !== 0 && marked(e, new Set);
|
|
110
117
|
|
|
111
|
-
GlobalQueue.
|
|
118
|
+
GlobalQueue.h = mark;
|
|
112
119
|
|
|
113
|
-
GlobalQueue.
|
|
120
|
+
GlobalQueue.A = release;
|
|
114
121
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
GlobalQueue.D = e => {
|
|
123
|
+
if (ambient.length === 0) return;
|
|
124
|
+
// The flush parked: the declaration's window is the frame's — the marks
|
|
125
|
+
// are its transaction's ("nothing async below ⇒ no window").
|
|
126
|
+
if (e !== null) {
|
|
127
|
+
const t = e.T ??= [];
|
|
128
|
+
for (let e = 0; e < ambient.length; e++) t.push(ambient[e]);
|
|
129
|
+
ambient.length = 0;
|
|
120
130
|
return;
|
|
121
131
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
132
|
+
// Nothing parked, but a marked node's own flight is up (a declared
|
|
133
|
+
// reload's quiet re-ask — the node's, or a store leaf's family derive):
|
|
134
|
+
// the window is the flight's; the mark stays to the seam after the
|
|
135
|
+
// landing. The rest release: verdict-only, nothing to show.
|
|
136
|
+
let t = 0;
|
|
137
|
+
const n = [];
|
|
138
|
+
for (let e = 0; e < ambient.length; e++) {
|
|
139
|
+
const r = ambient[e];
|
|
140
|
+
if (inFlight(r)) ambient[t++] = r; else n.push(r);
|
|
126
141
|
}
|
|
142
|
+
ambient.length = t;
|
|
143
|
+
if (n.length !== 0) release(n);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
function inFlight(e) {
|
|
147
|
+
return (e.G & STATUS_PENDING) !== 0 || (e.u & CONFIG_SLOT_NODE) !== 0 && GlobalQueue.F?.(e) === true;
|
|
127
148
|
}
|
|
128
149
|
|
|
129
150
|
export { affects };
|