@solidjs/signals 2.0.0-rc.14 → 2.0.0-rc.15
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 +248 -189
- package/dist/dev.attribution.js +124 -41
- package/dist/dev.js +553 -322
- package/dist/observe/affects.js +34 -31
- package/dist/observe/boundaries.js +166 -132
- package/dist/observe/core/async.js +90 -83
- package/dist/observe/core/attribution-queries.js +1 -1
- package/dist/observe/core/attribution.js +281 -197
- package/dist/observe/core/constants.js +7 -2
- package/dist/observe/core/context.js +3 -3
- package/dist/observe/core/core.js +277 -245
- package/dist/observe/core/dev.js +3 -3
- package/dist/observe/core/effect.js +21 -21
- package/dist/observe/core/external.js +2 -2
- package/dist/observe/core/graph.js +25 -25
- package/dist/observe/core/heap.js +9 -9
- package/dist/observe/core/lanes.js +206 -160
- package/dist/observe/core/owner.js +27 -27
- package/dist/observe/core/scheduler.js +92 -86
- package/dist/observe/core/verdict.js +66 -54
- package/dist/observe/map.js +35 -35
- package/dist/observe/reveal.js +24 -24
- package/dist/observe/signals.js +38 -28
- package/dist/observe/store/affects.js +75 -68
- package/dist/observe/store/hooks.js +13 -0
- package/dist/observe/store/index.js +0 -2
- package/dist/observe/store/optimistic.js +67 -34
- package/dist/observe/store/projection.js +37 -31
- package/dist/observe/store/reconcile.js +32 -30
- package/dist/observe/store/store.js +128 -85
- package/dist/prod/affects.js +34 -31
- package/dist/prod/boundaries.js +143 -109
- package/dist/prod/core/async.js +64 -67
- package/dist/prod/core/constants.js +7 -2
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +302 -270
- package/dist/prod/core/effect.js +38 -38
- package/dist/prod/core/external.js +4 -4
- package/dist/prod/core/graph.js +27 -27
- package/dist/prod/core/heap.js +30 -30
- package/dist/prod/core/lanes.js +257 -211
- package/dist/prod/core/owner.js +39 -39
- package/dist/prod/core/scheduler.js +125 -119
- package/dist/prod/core/verdict.js +70 -58
- package/dist/prod/map.js +73 -73
- package/dist/prod/reveal.js +38 -38
- package/dist/prod/signals.js +30 -20
- package/dist/prod/store/affects.js +75 -68
- package/dist/prod/store/hooks.js +13 -0
- package/dist/prod/store/index.js +0 -2
- package/dist/prod/store/optimistic.js +114 -81
- package/dist/prod/store/projection.js +30 -24
- package/dist/prod/store/reconcile.js +32 -30
- package/dist/prod/store/store.js +136 -93
- package/dist/types/boundaries.d.ts +4 -0
- package/dist/types/core/attribution.d.ts +6 -2
- package/dist/types/core/constants.d.ts +5 -0
- package/dist/types/core/core.d.ts +33 -3
- package/dist/types/core/lanes.d.ts +10 -0
- package/dist/types/core/scheduler.d.ts +12 -6
- package/dist/types/core/types.d.ts +0 -6
- package/dist/types/store/affects.d.ts +11 -0
- package/dist/types/store/hooks.d.ts +48 -0
- package/dist/types/store/index.d.ts +0 -1
- package/dist/types/store/store.d.ts +3 -38
- package/package.json +1 -1
package/dist/observe/affects.js
CHANGED
|
@@ -6,7 +6,9 @@ import "./core/dev.js";
|
|
|
6
6
|
|
|
7
7
|
import { enqueueSub } from "./core/heap.js";
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { schedule, resolveTx, flushTransaction, GlobalQueue } from "./core/scheduler.js";
|
|
10
|
+
|
|
11
|
+
import { storeMarks, installStoreAffects, releaseMarkScope } from "./store/affects.js";
|
|
10
12
|
|
|
11
13
|
import { $TARGET } from "./store/types.js";
|
|
12
14
|
|
|
@@ -38,12 +40,12 @@ let active = 0;
|
|
|
38
40
|
/** The verdict readers downstream of `node` — through derivations, stopping
|
|
39
41
|
* at effects — re-derive: the mark's one notification (a probe's answer
|
|
40
42
|
* changed with no value notifying anyone). */ function repoll(e, t = new Set) {
|
|
41
|
-
for (let
|
|
42
|
-
const e =
|
|
43
|
+
for (let r = e.t; r !== null; r = r.o) {
|
|
44
|
+
const e = r.l;
|
|
43
45
|
if (t.has(e)) continue;
|
|
44
46
|
t.add(e);
|
|
45
|
-
if (e.
|
|
46
|
-
if (!e.
|
|
47
|
+
if (e.i & CONFIG_VERDICT) enqueueSub(e);
|
|
48
|
+
if (!e.u) repoll(e, t);
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
|
|
@@ -53,13 +55,13 @@ let active = 0;
|
|
|
53
55
|
* (a direct mark on one still reads pending). Mid-recompute, only the
|
|
54
56
|
* validated prefix of the dependency list is this pass's. */ function marked(e, t) {
|
|
55
57
|
if (e.m !== null && e.m.T !== 0) return true;
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
+
const r = e;
|
|
59
|
+
if (r.S & STATUS_ERROR || t.has(e)) return false;
|
|
58
60
|
t.add(e);
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
+
const n = r.R & REACTIVE_RECOMPUTING_DEPS ? r.p : undefined;
|
|
62
|
+
if (n !== null) for (let e = r.G ?? null; e !== null; e = e._) {
|
|
61
63
|
if (marked(e.I, t)) return true;
|
|
62
|
-
if (e ===
|
|
64
|
+
if (e === n) break;
|
|
63
65
|
}
|
|
64
66
|
return false;
|
|
65
67
|
}
|
|
@@ -67,13 +69,13 @@ let active = 0;
|
|
|
67
69
|
/** Releases one scope's marks (a landed transaction's, the ambient list at
|
|
68
70
|
* the seam): a node whose last mark drops re-derives its verdict readers. */ function release(e) {
|
|
69
71
|
for (let t = 0; t < e.length; t++) {
|
|
70
|
-
const
|
|
72
|
+
const r = e[t];
|
|
71
73
|
active--;
|
|
72
|
-
if (--
|
|
73
|
-
repoll(
|
|
74
|
+
if (--r.m.T === 0) {
|
|
75
|
+
repoll(r);
|
|
74
76
|
// A store mark's carrier: its scope (and the marks the nodes born in
|
|
75
77
|
// its window inherited) goes with it.
|
|
76
|
-
|
|
78
|
+
releaseMarkScope(r);
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
e.length = 0;
|
|
@@ -84,8 +86,8 @@ let active = 0;
|
|
|
84
86
|
mark(e);
|
|
85
87
|
const t = flushTransaction;
|
|
86
88
|
if (t === null) ambient.push(e); else {
|
|
87
|
-
const
|
|
88
|
-
(
|
|
89
|
+
const r = resolveTx(t);
|
|
90
|
+
(r.T ??= []).push(e);
|
|
89
91
|
}
|
|
90
92
|
repoll(e);
|
|
91
93
|
}
|
|
@@ -98,28 +100,29 @@ function mark(e) {
|
|
|
98
100
|
function affects(e, t) {
|
|
99
101
|
// A store (the store half, store/affects.ts): the slot's leaf, or the
|
|
100
102
|
// record's carrier and every live node under it.
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
103
|
-
|
|
103
|
+
const r = e?.[$TARGET];
|
|
104
|
+
if (r !== undefined) {
|
|
105
|
+
installStoreAffects();
|
|
106
|
+
const e = storeMarks(r, t);
|
|
104
107
|
for (let t = 0; t < e.length; t++) register(e[t]);
|
|
105
108
|
schedule();
|
|
106
109
|
return;
|
|
107
110
|
}
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
111
|
+
const n = e?.[$REFRESH];
|
|
112
|
+
if (!n) {
|
|
110
113
|
return;
|
|
111
114
|
}
|
|
112
|
-
register(
|
|
115
|
+
register(n);
|
|
113
116
|
schedule();
|
|
114
117
|
}
|
|
115
118
|
|
|
116
|
-
GlobalQueue.
|
|
119
|
+
GlobalQueue.N = e => active !== 0 && marked(e, new Set);
|
|
117
120
|
|
|
118
|
-
GlobalQueue.
|
|
121
|
+
GlobalQueue.O = mark;
|
|
119
122
|
|
|
120
|
-
GlobalQueue.
|
|
123
|
+
GlobalQueue.k = release;
|
|
121
124
|
|
|
122
|
-
GlobalQueue.
|
|
125
|
+
GlobalQueue.A = e => {
|
|
123
126
|
if (ambient.length === 0) return;
|
|
124
127
|
// The flush parked: the declaration's window is the frame's — the marks
|
|
125
128
|
// are its transaction's ("nothing async below ⇒ no window").
|
|
@@ -134,17 +137,17 @@ GlobalQueue.D = e => {
|
|
|
134
137
|
// the window is the flight's; the mark stays to the seam after the
|
|
135
138
|
// landing. The rest release: verdict-only, nothing to show.
|
|
136
139
|
let t = 0;
|
|
137
|
-
const
|
|
140
|
+
const r = [];
|
|
138
141
|
for (let e = 0; e < ambient.length; e++) {
|
|
139
|
-
const
|
|
140
|
-
if (inFlight(
|
|
142
|
+
const n = ambient[e];
|
|
143
|
+
if (inFlight(n)) ambient[t++] = n; else r.push(n);
|
|
141
144
|
}
|
|
142
145
|
ambient.length = t;
|
|
143
|
-
if (
|
|
146
|
+
if (r.length !== 0) release(r);
|
|
144
147
|
};
|
|
145
148
|
|
|
146
149
|
function inFlight(e) {
|
|
147
|
-
return (e.
|
|
150
|
+
return (e.S & STATUS_PENDING) !== 0 || (e.i & CONFIG_SLOT_NODE) !== 0 && GlobalQueue.C?.(e) === true;
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
export { affects };
|