@solidjs/signals 0.9.8 → 0.9.10
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.js +442 -184
- package/dist/node.cjs +1198 -959
- package/dist/prod.js +1000 -767
- package/dist/types/boundaries.d.ts +3 -2
- package/dist/types/core/core.d.ts +4 -2
- package/dist/types/core/error.d.ts +6 -2
- package/dist/types/core/scheduler.d.ts +67 -16
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
class NotReadyError extends Error {
|
|
2
|
-
|
|
2
|
+
t;
|
|
3
3
|
constructor(e) {
|
|
4
4
|
super();
|
|
5
|
-
this.
|
|
5
|
+
this.t = e;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
class StatusError extends Error {
|
|
9
|
+
t;
|
|
10
|
+
constructor(e, t) {
|
|
11
|
+
super(t instanceof Error ? t.message : String(t), { cause: t });
|
|
12
|
+
this.t = e;
|
|
6
13
|
}
|
|
7
14
|
}
|
|
8
15
|
class NoOwnerError extends Error {
|
|
@@ -24,7 +31,6 @@ const REACTIVE_IN_HEAP_HEIGHT = 1 << 4;
|
|
|
24
31
|
const REACTIVE_ZOMBIE = 1 << 5;
|
|
25
32
|
const REACTIVE_DISPOSED = 1 << 6;
|
|
26
33
|
const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
|
|
27
|
-
const STATUS_NONE = 0;
|
|
28
34
|
const STATUS_PENDING = 1 << 0;
|
|
29
35
|
const STATUS_ERROR = 1 << 1;
|
|
30
36
|
const STATUS_UNINITIALIZED = 1 << 2;
|
|
@@ -36,111 +42,187 @@ const SUPPORTS_PROXY = typeof Proxy === "function";
|
|
|
36
42
|
const defaultContext = {};
|
|
37
43
|
const $REFRESH = Symbol("refresh");
|
|
38
44
|
function actualInsertIntoHeap(e, t) {
|
|
39
|
-
const n = (e.i
|
|
40
|
-
if (n >= e.
|
|
41
|
-
const i = e.
|
|
42
|
-
const r = t.
|
|
43
|
-
if (r === undefined) t.
|
|
45
|
+
const n = (e.o?.i ? e.o.l?.u : e.o?.u) ?? -1;
|
|
46
|
+
if (n >= e.u) e.u = n + 1;
|
|
47
|
+
const i = e.u;
|
|
48
|
+
const r = t.T[i];
|
|
49
|
+
if (r === undefined) t.T[i] = e;
|
|
44
50
|
else {
|
|
45
|
-
const t = r.
|
|
46
|
-
t.
|
|
47
|
-
e.
|
|
48
|
-
r.
|
|
51
|
+
const t = r.R;
|
|
52
|
+
t.O = e;
|
|
53
|
+
e.R = t;
|
|
54
|
+
r.R = e;
|
|
49
55
|
}
|
|
50
|
-
if (i > t.
|
|
56
|
+
if (i > t.S) t.S = i;
|
|
51
57
|
}
|
|
52
58
|
function insertIntoHeap(e, t) {
|
|
53
|
-
let n = e.
|
|
59
|
+
let n = e._;
|
|
54
60
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
|
|
55
61
|
if (n & REACTIVE_CHECK) {
|
|
56
|
-
e.
|
|
57
|
-
} else e.
|
|
62
|
+
e._ = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
63
|
+
} else e._ = n | REACTIVE_IN_HEAP;
|
|
58
64
|
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
59
65
|
}
|
|
60
66
|
function insertIntoHeapHeight(e, t) {
|
|
61
|
-
let n = e.
|
|
67
|
+
let n = e._;
|
|
62
68
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
|
|
63
|
-
e.
|
|
69
|
+
e._ = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
64
70
|
actualInsertIntoHeap(e, t);
|
|
65
71
|
}
|
|
66
72
|
function deleteFromHeap(e, t) {
|
|
67
|
-
const n = e.
|
|
73
|
+
const n = e._;
|
|
68
74
|
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
69
|
-
e.
|
|
70
|
-
const i = e.
|
|
71
|
-
if (e.
|
|
75
|
+
e._ = n & -25;
|
|
76
|
+
const i = e.u;
|
|
77
|
+
if (e.R === e) t.T[i] = undefined;
|
|
72
78
|
else {
|
|
73
|
-
const n = e.
|
|
74
|
-
const r = t.
|
|
79
|
+
const n = e.O;
|
|
80
|
+
const r = t.T[i];
|
|
75
81
|
const o = n ?? r;
|
|
76
|
-
if (e === r) t.
|
|
77
|
-
else e.
|
|
78
|
-
o.
|
|
82
|
+
if (e === r) t.T[i] = n;
|
|
83
|
+
else e.R.O = n;
|
|
84
|
+
o.R = e.R;
|
|
79
85
|
}
|
|
80
|
-
e.
|
|
81
|
-
e.
|
|
86
|
+
e.R = e;
|
|
87
|
+
e.O = undefined;
|
|
82
88
|
}
|
|
83
89
|
function markHeap(e) {
|
|
84
|
-
if (e.
|
|
85
|
-
e.
|
|
86
|
-
for (let t = 0; t <= e.
|
|
87
|
-
for (let n = e.
|
|
88
|
-
if (n.
|
|
90
|
+
if (e.I) return;
|
|
91
|
+
e.I = true;
|
|
92
|
+
for (let t = 0; t <= e.S; t++) {
|
|
93
|
+
for (let n = e.T[t]; n !== undefined; n = n.O) {
|
|
94
|
+
if (n._ & REACTIVE_IN_HEAP) markNode(n);
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
}
|
|
92
98
|
function markNode(e, t = REACTIVE_DIRTY) {
|
|
93
|
-
const n = e.
|
|
99
|
+
const n = e._;
|
|
94
100
|
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
95
|
-
e.
|
|
96
|
-
for (let t = e.p; t !== null; t = t.
|
|
97
|
-
markNode(t.
|
|
98
|
-
}
|
|
99
|
-
if (e.
|
|
100
|
-
for (let t = e.
|
|
101
|
-
for (let e = t.p; e !== null; e = e.
|
|
102
|
-
markNode(e.
|
|
101
|
+
e._ = (n & -4) | t;
|
|
102
|
+
for (let t = e.p; t !== null; t = t.h) {
|
|
103
|
+
markNode(t.A, REACTIVE_CHECK);
|
|
104
|
+
}
|
|
105
|
+
if (e.N !== null) {
|
|
106
|
+
for (let t = e.N; t !== null; t = t.P) {
|
|
107
|
+
for (let e = t.p; e !== null; e = e.h) {
|
|
108
|
+
markNode(e.A, REACTIVE_CHECK);
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
113
|
function runHeap(e, t) {
|
|
108
|
-
e.
|
|
109
|
-
for (e.
|
|
110
|
-
let n = e.
|
|
114
|
+
e.I = false;
|
|
115
|
+
for (e.C = 0; e.C <= e.S; e.C++) {
|
|
116
|
+
let n = e.T[e.C];
|
|
111
117
|
while (n !== undefined) {
|
|
112
|
-
if (n.
|
|
118
|
+
if (n._ & REACTIVE_IN_HEAP) t(n);
|
|
113
119
|
else adjustHeight(n, e);
|
|
114
|
-
n = e.
|
|
120
|
+
n = e.T[e.C];
|
|
115
121
|
}
|
|
116
122
|
}
|
|
117
|
-
e.
|
|
123
|
+
e.S = 0;
|
|
118
124
|
}
|
|
119
125
|
function adjustHeight(e, t) {
|
|
120
126
|
deleteFromHeap(e, t);
|
|
121
|
-
let n = e.
|
|
122
|
-
for (let t = e.
|
|
127
|
+
let n = e.u;
|
|
128
|
+
for (let t = e.D; t; t = t.m) {
|
|
123
129
|
const e = t.V;
|
|
124
|
-
const i = e.
|
|
125
|
-
if (i.U && i.
|
|
130
|
+
const i = e.L || e;
|
|
131
|
+
if (i.U && i.u >= n) n = i.u + 1;
|
|
126
132
|
}
|
|
127
|
-
if (e.
|
|
128
|
-
e.
|
|
129
|
-
for (let n = e.p; n !== null; n = n.
|
|
130
|
-
insertIntoHeapHeight(n.
|
|
133
|
+
if (e.u !== n) {
|
|
134
|
+
e.u = n;
|
|
135
|
+
for (let n = e.p; n !== null; n = n.h) {
|
|
136
|
+
insertIntoHeapHeight(n.A, t);
|
|
131
137
|
}
|
|
132
138
|
}
|
|
133
139
|
}
|
|
134
140
|
const transitions = new Set();
|
|
135
|
-
const dirtyQueue = {
|
|
136
|
-
const zombieQueue = {
|
|
141
|
+
const dirtyQueue = { T: new Array(2e3).fill(undefined), I: false, C: 0, S: 0 };
|
|
142
|
+
const zombieQueue = { T: new Array(2e3).fill(undefined), I: false, C: 0, S: 0 };
|
|
137
143
|
let clock = 0;
|
|
138
144
|
let activeTransition = null;
|
|
139
145
|
let scheduled = false;
|
|
140
|
-
let optimisticReadActive = false;
|
|
141
146
|
let projectionWriteActive = false;
|
|
142
|
-
|
|
143
|
-
|
|
147
|
+
const signalLanes = new WeakMap();
|
|
148
|
+
const activeLanes = new Set();
|
|
149
|
+
let currentOptimisticLane = null;
|
|
150
|
+
function setCurrentOptimisticLane(e) {
|
|
151
|
+
currentOptimisticLane = e;
|
|
152
|
+
}
|
|
153
|
+
function getOrCreateLane(e) {
|
|
154
|
+
let t = signalLanes.get(e);
|
|
155
|
+
if (t) {
|
|
156
|
+
return findLane(t);
|
|
157
|
+
}
|
|
158
|
+
const n = e.k;
|
|
159
|
+
const i = n?.W ? findLane(n.W) : null;
|
|
160
|
+
t = { t: e, G: new Set(), M: [[], []], F: null, $: activeTransition, H: i };
|
|
161
|
+
signalLanes.set(e, t);
|
|
162
|
+
activeLanes.add(t);
|
|
163
|
+
e.j = e.K || 0;
|
|
164
|
+
return t;
|
|
165
|
+
}
|
|
166
|
+
function findLane(e) {
|
|
167
|
+
while (e.F) e = e.F;
|
|
168
|
+
return e;
|
|
169
|
+
}
|
|
170
|
+
function mergeLanes(e, t) {
|
|
171
|
+
e = findLane(e);
|
|
172
|
+
t = findLane(t);
|
|
173
|
+
if (e === t) return e;
|
|
174
|
+
t.F = e;
|
|
175
|
+
for (const n of t.G) e.G.add(n);
|
|
176
|
+
e.M[0].push(...t.M[0]);
|
|
177
|
+
e.M[1].push(...t.M[1]);
|
|
178
|
+
return e;
|
|
179
|
+
}
|
|
180
|
+
function clearLaneEntry(e) {
|
|
181
|
+
signalLanes.delete(e);
|
|
182
|
+
}
|
|
183
|
+
function resolveLane(e) {
|
|
184
|
+
const t = e.W;
|
|
185
|
+
if (!t) return undefined;
|
|
186
|
+
const n = findLane(t);
|
|
187
|
+
if (activeLanes.has(n)) return n;
|
|
188
|
+
e.W = undefined;
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
function hasActiveOverride(e) {
|
|
192
|
+
return !!(e.Y && e.B !== NOT_PENDING);
|
|
193
|
+
}
|
|
194
|
+
function assignOrMergeLane(e, t) {
|
|
195
|
+
const n = findLane(t);
|
|
196
|
+
const i = e.W;
|
|
197
|
+
if (i) {
|
|
198
|
+
if (i.F) {
|
|
199
|
+
e.W = t;
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const r = findLane(i);
|
|
203
|
+
if (activeLanes.has(r)) {
|
|
204
|
+
if (r !== n && !hasActiveOverride(e)) {
|
|
205
|
+
if (n.H && findLane(n.H) === r) {
|
|
206
|
+
e.W = t;
|
|
207
|
+
} else if (r.H && findLane(r.H) === n);
|
|
208
|
+
else {
|
|
209
|
+
mergeLanes(n, r);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
e.W = t;
|
|
216
|
+
}
|
|
217
|
+
function runLaneEffects(e) {
|
|
218
|
+
for (const t of activeLanes) {
|
|
219
|
+
if (t.F || t.G.size > 0) continue;
|
|
220
|
+
const n = t.M[e - 1];
|
|
221
|
+
if (n.length) {
|
|
222
|
+
t.M[e - 1] = [];
|
|
223
|
+
runQueue(n, e);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
144
226
|
}
|
|
145
227
|
function setProjectionWriteActive(e) {
|
|
146
228
|
projectionWriteActive = e;
|
|
@@ -148,133 +230,129 @@ function setProjectionWriteActive(e) {
|
|
|
148
230
|
function schedule() {
|
|
149
231
|
if (scheduled) return;
|
|
150
232
|
scheduled = true;
|
|
151
|
-
if (!globalQueue.
|
|
233
|
+
if (!globalQueue.X) queueMicrotask(flush);
|
|
152
234
|
}
|
|
153
235
|
class Queue {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
M = [];
|
|
236
|
+
o = null;
|
|
237
|
+
q = [[], []];
|
|
238
|
+
Z = [];
|
|
158
239
|
created = clock;
|
|
159
240
|
addChild(e) {
|
|
160
|
-
this.
|
|
161
|
-
e.
|
|
241
|
+
this.Z.push(e);
|
|
242
|
+
e.o = this;
|
|
162
243
|
}
|
|
163
244
|
removeChild(e) {
|
|
164
|
-
const t = this.
|
|
245
|
+
const t = this.Z.indexOf(e);
|
|
165
246
|
if (t >= 0) {
|
|
166
|
-
this.
|
|
167
|
-
e.
|
|
247
|
+
this.Z.splice(t, 1);
|
|
248
|
+
e.o = null;
|
|
168
249
|
}
|
|
169
250
|
}
|
|
170
|
-
notify(e, t, n) {
|
|
171
|
-
if (this.
|
|
251
|
+
notify(e, t, n, i) {
|
|
252
|
+
if (this.o) return this.o.notify(e, t, n, i);
|
|
172
253
|
return false;
|
|
173
254
|
}
|
|
174
|
-
$(e, t, n) {
|
|
175
|
-
if (t[e - 1].length) {
|
|
176
|
-
const n = t[e - 1];
|
|
177
|
-
t[e - 1] = [];
|
|
178
|
-
runQueue(n, e);
|
|
179
|
-
}
|
|
180
|
-
for (let t = 0; t < this.M.length; t++) {
|
|
181
|
-
this.M[t][n]?.(e);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
255
|
run(e) {
|
|
185
|
-
this
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
256
|
+
if (this.q[e - 1].length) {
|
|
257
|
+
const t = this.q[e - 1];
|
|
258
|
+
this.q[e - 1] = [];
|
|
259
|
+
runQueue(t, e);
|
|
260
|
+
}
|
|
261
|
+
for (let t = 0; t < this.Z.length; t++) this.Z[t].run?.(e);
|
|
189
262
|
}
|
|
190
263
|
enqueue(e, t) {
|
|
191
264
|
if (e) {
|
|
192
|
-
|
|
193
|
-
|
|
265
|
+
if (currentOptimisticLane) {
|
|
266
|
+
const n = findLane(currentOptimisticLane);
|
|
267
|
+
n.M[e - 1].push(t);
|
|
268
|
+
} else {
|
|
269
|
+
this.q[e - 1].push(t);
|
|
270
|
+
}
|
|
194
271
|
}
|
|
195
272
|
schedule();
|
|
196
273
|
}
|
|
197
274
|
stashQueues(e) {
|
|
198
|
-
e.
|
|
199
|
-
e.
|
|
200
|
-
this.
|
|
201
|
-
for (let t = 0; t < this.
|
|
202
|
-
let n = this.
|
|
203
|
-
let i = e.
|
|
275
|
+
e.q[0].push(...this.q[0]);
|
|
276
|
+
e.q[1].push(...this.q[1]);
|
|
277
|
+
this.q = [[], []];
|
|
278
|
+
for (let t = 0; t < this.Z.length; t++) {
|
|
279
|
+
let n = this.Z[t];
|
|
280
|
+
let i = e.Z[t];
|
|
204
281
|
if (!i) {
|
|
205
|
-
i = {
|
|
206
|
-
e.
|
|
282
|
+
i = { q: [[], []], Z: [] };
|
|
283
|
+
e.Z[t] = i;
|
|
207
284
|
}
|
|
208
285
|
n.stashQueues(i);
|
|
209
286
|
}
|
|
210
287
|
}
|
|
211
288
|
restoreQueues(e) {
|
|
212
|
-
this.
|
|
213
|
-
this.
|
|
214
|
-
for (let t = 0; t < e.
|
|
215
|
-
const n = e.
|
|
216
|
-
let i = this.
|
|
289
|
+
this.q[0].push(...e.q[0]);
|
|
290
|
+
this.q[1].push(...e.q[1]);
|
|
291
|
+
for (let t = 0; t < e.Z.length; t++) {
|
|
292
|
+
const n = e.Z[t];
|
|
293
|
+
let i = this.Z[t];
|
|
217
294
|
if (i) i.restoreQueues(n);
|
|
218
295
|
}
|
|
219
296
|
}
|
|
220
297
|
}
|
|
221
298
|
class GlobalQueue extends Queue {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
static
|
|
227
|
-
static
|
|
228
|
-
static
|
|
299
|
+
X = false;
|
|
300
|
+
J = [];
|
|
301
|
+
ee = [];
|
|
302
|
+
te = new Set();
|
|
303
|
+
static ne;
|
|
304
|
+
static ie;
|
|
305
|
+
static re = null;
|
|
229
306
|
flush() {
|
|
230
|
-
if (this.
|
|
231
|
-
this.
|
|
307
|
+
if (this.X) return;
|
|
308
|
+
this.X = true;
|
|
232
309
|
try {
|
|
233
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
310
|
+
runHeap(dirtyQueue, GlobalQueue.ne);
|
|
234
311
|
if (activeTransition) {
|
|
235
312
|
const e = transitionComplete(activeTransition);
|
|
236
313
|
if (!e) {
|
|
237
314
|
let e = activeTransition;
|
|
238
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
239
|
-
this.
|
|
240
|
-
this.
|
|
241
|
-
this.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
this.stashQueues(activeTransition.
|
|
315
|
+
runHeap(zombieQueue, GlobalQueue.ne);
|
|
316
|
+
this.J = [];
|
|
317
|
+
this.ee = [];
|
|
318
|
+
this.te = new Set();
|
|
319
|
+
runLaneEffects(EFFECT_RENDER);
|
|
320
|
+
runLaneEffects(EFFECT_USER);
|
|
321
|
+
this.stashQueues(activeTransition.oe);
|
|
245
322
|
clock++;
|
|
246
|
-
scheduled =
|
|
247
|
-
|
|
323
|
+
scheduled = dirtyQueue.S >= dirtyQueue.C;
|
|
324
|
+
reassignPendingTransition(activeTransition.J);
|
|
248
325
|
activeTransition = null;
|
|
249
326
|
finalizePureQueue(null, true);
|
|
250
327
|
return;
|
|
251
328
|
}
|
|
252
|
-
this.
|
|
253
|
-
this.restoreQueues(activeTransition.
|
|
329
|
+
this.J !== activeTransition.J && this.J.push(...activeTransition.J);
|
|
330
|
+
this.restoreQueues(activeTransition.oe);
|
|
254
331
|
transitions.delete(activeTransition);
|
|
255
332
|
const t = activeTransition;
|
|
256
333
|
activeTransition = null;
|
|
257
|
-
|
|
334
|
+
reassignPendingTransition(this.J);
|
|
258
335
|
finalizePureQueue(t);
|
|
259
336
|
} else {
|
|
260
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
337
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.ne);
|
|
261
338
|
finalizePureQueue();
|
|
262
339
|
}
|
|
263
340
|
clock++;
|
|
264
|
-
scheduled = dirtyQueue.
|
|
265
|
-
|
|
341
|
+
scheduled = dirtyQueue.S >= dirtyQueue.C;
|
|
342
|
+
runLaneEffects(EFFECT_RENDER);
|
|
266
343
|
this.run(EFFECT_RENDER);
|
|
267
|
-
|
|
344
|
+
runLaneEffects(EFFECT_USER);
|
|
268
345
|
this.run(EFFECT_USER);
|
|
269
346
|
} finally {
|
|
270
|
-
this.
|
|
347
|
+
this.X = false;
|
|
271
348
|
}
|
|
272
349
|
}
|
|
273
|
-
notify(e, t, n) {
|
|
350
|
+
notify(e, t, n, i) {
|
|
274
351
|
if (t & STATUS_PENDING) {
|
|
275
352
|
if (n & STATUS_PENDING) {
|
|
276
|
-
|
|
277
|
-
|
|
353
|
+
const t = i !== undefined ? i : e.se;
|
|
354
|
+
if (activeTransition && t && !activeTransition.ue.includes(t.t)) {
|
|
355
|
+
activeTransition.ue.push(t.t);
|
|
278
356
|
schedule();
|
|
279
357
|
}
|
|
280
358
|
}
|
|
@@ -285,106 +363,143 @@ class GlobalQueue extends Queue {
|
|
|
285
363
|
initTransition(e) {
|
|
286
364
|
if (e) e = currentTransition(e);
|
|
287
365
|
if (e && e === activeTransition) return;
|
|
288
|
-
if (!e && activeTransition && activeTransition.
|
|
366
|
+
if (!e && activeTransition && activeTransition.ce === clock) return;
|
|
289
367
|
if (!activeTransition) {
|
|
290
368
|
activeTransition = e ?? {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
369
|
+
ce: clock,
|
|
370
|
+
J: [],
|
|
371
|
+
ue: [],
|
|
372
|
+
ee: [],
|
|
373
|
+
te: new Set(),
|
|
374
|
+
le: [],
|
|
375
|
+
oe: { q: [[], []], Z: [] },
|
|
376
|
+
ae: false
|
|
299
377
|
};
|
|
300
378
|
} else if (e) {
|
|
301
|
-
|
|
302
|
-
e
|
|
303
|
-
|
|
379
|
+
const t = activeTransition;
|
|
380
|
+
t.ae = e;
|
|
381
|
+
e.le.push(...t.le);
|
|
382
|
+
for (const n of activeLanes) {
|
|
383
|
+
if (n.$ === t) n.$ = e;
|
|
384
|
+
}
|
|
385
|
+
e.ee.push(...t.ee);
|
|
386
|
+
for (const n of t.te) {
|
|
387
|
+
e.te.add(n);
|
|
388
|
+
}
|
|
389
|
+
transitions.delete(t);
|
|
304
390
|
activeTransition = e;
|
|
305
391
|
}
|
|
306
392
|
transitions.add(activeTransition);
|
|
307
|
-
activeTransition.
|
|
308
|
-
for (let e = 0; e < this.
|
|
309
|
-
const t = this.
|
|
310
|
-
t
|
|
311
|
-
activeTransition.
|
|
393
|
+
activeTransition.ce = clock;
|
|
394
|
+
for (let e = 0; e < this.J.length; e++) {
|
|
395
|
+
const t = this.J[e];
|
|
396
|
+
t.$ = activeTransition;
|
|
397
|
+
activeTransition.J.push(t);
|
|
312
398
|
}
|
|
313
|
-
this.
|
|
314
|
-
for (let e = 0; e < this.
|
|
315
|
-
const t = this.
|
|
316
|
-
t
|
|
317
|
-
activeTransition.
|
|
399
|
+
this.J = activeTransition.J;
|
|
400
|
+
for (let e = 0; e < this.ee.length; e++) {
|
|
401
|
+
const t = this.ee[e];
|
|
402
|
+
t.$ = activeTransition;
|
|
403
|
+
activeTransition.ee.push(t);
|
|
318
404
|
}
|
|
319
|
-
this.
|
|
320
|
-
for (const e of
|
|
321
|
-
|
|
405
|
+
this.ee = activeTransition.ee;
|
|
406
|
+
for (const e of activeLanes) {
|
|
407
|
+
if (!e.$) e.$ = activeTransition;
|
|
322
408
|
}
|
|
323
|
-
this.
|
|
409
|
+
for (const e of this.te) activeTransition.te.add(e);
|
|
410
|
+
this.te = activeTransition.te;
|
|
324
411
|
}
|
|
325
412
|
}
|
|
326
413
|
function insertSubs(e, t = false) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
414
|
+
const n = e.W || currentOptimisticLane;
|
|
415
|
+
for (let i = e.p; i !== null; i = i.h) {
|
|
416
|
+
if (t && n) {
|
|
417
|
+
i.A._ |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
418
|
+
assignOrMergeLane(i.A, n);
|
|
419
|
+
} else if (t) {
|
|
420
|
+
i.A._ |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
421
|
+
i.A.W = undefined;
|
|
422
|
+
}
|
|
423
|
+
const e = i.A;
|
|
424
|
+
if (e.fe === EFFECT_TRACKED) {
|
|
425
|
+
if (!e.Ee) {
|
|
426
|
+
e.Ee = true;
|
|
427
|
+
e.Te.enqueue(EFFECT_USER, e.de);
|
|
334
428
|
}
|
|
335
429
|
continue;
|
|
336
430
|
}
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
339
|
-
insertIntoHeap(
|
|
431
|
+
const r = i.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
432
|
+
if (r.C > i.A.u) r.C = i.A.u;
|
|
433
|
+
insertIntoHeap(i.A, r);
|
|
340
434
|
}
|
|
341
435
|
}
|
|
342
436
|
function finalizePureQueue(e = null, t = false) {
|
|
343
437
|
let n = !t;
|
|
344
|
-
if (
|
|
345
|
-
|
|
346
|
-
}
|
|
438
|
+
if (!t) checkBoundaryChildren(globalQueue);
|
|
439
|
+
if (dirtyQueue.S >= dirtyQueue.C) runHeap(dirtyQueue, GlobalQueue.ne);
|
|
347
440
|
if (n) {
|
|
348
|
-
const t = globalQueue.
|
|
441
|
+
const t = globalQueue.J;
|
|
349
442
|
for (let e = 0; e < t.length; e++) {
|
|
350
443
|
const n = t[e];
|
|
351
|
-
if (n.
|
|
352
|
-
n.
|
|
353
|
-
n.
|
|
354
|
-
if (n.
|
|
444
|
+
if (n.B !== NOT_PENDING) {
|
|
445
|
+
n.Re = n.B;
|
|
446
|
+
n.B = NOT_PENDING;
|
|
447
|
+
if (n.fe && n.fe !== EFFECT_TRACKED) n.Ee = true;
|
|
355
448
|
}
|
|
356
|
-
|
|
449
|
+
n.Oe &= ~STATUS_UNINITIALIZED;
|
|
450
|
+
if (n.U) GlobalQueue.ie(n, false, true);
|
|
357
451
|
}
|
|
358
452
|
t.length = 0;
|
|
359
|
-
const n = e ? e.
|
|
453
|
+
const n = e ? e.ee : globalQueue.ee;
|
|
360
454
|
for (let e = 0; e < n.length; e++) {
|
|
361
455
|
const t = n[e];
|
|
362
|
-
const i = t.
|
|
363
|
-
|
|
364
|
-
|
|
456
|
+
const i = t.B;
|
|
457
|
+
t.W = undefined;
|
|
458
|
+
if (i !== NOT_PENDING && t.Re !== i) {
|
|
459
|
+
t.Re = i;
|
|
365
460
|
insertSubs(t, true);
|
|
366
461
|
}
|
|
367
|
-
t.
|
|
368
|
-
t
|
|
462
|
+
t.B = NOT_PENDING;
|
|
463
|
+
t.$ = null;
|
|
369
464
|
}
|
|
370
465
|
n.length = 0;
|
|
371
|
-
const i = e ? e.
|
|
372
|
-
if (GlobalQueue.
|
|
466
|
+
const i = e ? e.te : globalQueue.te;
|
|
467
|
+
if (GlobalQueue.re && i.size) {
|
|
373
468
|
for (const e of i) {
|
|
374
|
-
GlobalQueue.
|
|
469
|
+
GlobalQueue.re(e);
|
|
375
470
|
}
|
|
376
471
|
i.clear();
|
|
377
472
|
schedule();
|
|
378
473
|
}
|
|
474
|
+
for (const t of activeLanes) {
|
|
475
|
+
const n = e ? t.$ === e : !t.$;
|
|
476
|
+
if (!n) continue;
|
|
477
|
+
if (!t.F) {
|
|
478
|
+
if (t.M[0].length) runQueue(t.M[0], EFFECT_RENDER);
|
|
479
|
+
if (t.M[1].length) runQueue(t.M[1], EFFECT_USER);
|
|
480
|
+
}
|
|
481
|
+
if (t.t.W === t) t.t.W = undefined;
|
|
482
|
+
t.G.clear();
|
|
483
|
+
t.M[0].length = 0;
|
|
484
|
+
t.M[1].length = 0;
|
|
485
|
+
activeLanes.delete(t);
|
|
486
|
+
signalLanes.delete(t.t);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
function checkBoundaryChildren(e) {
|
|
491
|
+
for (const t of e.Z) {
|
|
492
|
+
t.checkSources?.();
|
|
493
|
+
checkBoundaryChildren(t);
|
|
379
494
|
}
|
|
380
495
|
}
|
|
381
496
|
function trackOptimisticStore(e) {
|
|
382
|
-
globalQueue.
|
|
497
|
+
globalQueue.te.add(e);
|
|
383
498
|
schedule();
|
|
384
499
|
}
|
|
385
|
-
function
|
|
500
|
+
function reassignPendingTransition(e) {
|
|
386
501
|
for (let t = 0; t < e.length; t++) {
|
|
387
|
-
e[t]
|
|
502
|
+
e[t].$ = activeTransition;
|
|
388
503
|
}
|
|
389
504
|
}
|
|
390
505
|
const globalQueue = new GlobalQueue();
|
|
@@ -397,20 +512,21 @@ function runQueue(e, t) {
|
|
|
397
512
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
398
513
|
}
|
|
399
514
|
function transitionComplete(e) {
|
|
400
|
-
if (e.
|
|
401
|
-
if (e.
|
|
515
|
+
if (e.ae) return true;
|
|
516
|
+
if (e.le.length) return false;
|
|
402
517
|
let t = true;
|
|
403
|
-
for (let n = 0; n < e.
|
|
404
|
-
|
|
518
|
+
for (let n = 0; n < e.ue.length; n++) {
|
|
519
|
+
const i = e.ue[n];
|
|
520
|
+
if (i.Oe & STATUS_PENDING && i.se?.t === i) {
|
|
405
521
|
t = false;
|
|
406
522
|
break;
|
|
407
523
|
}
|
|
408
524
|
}
|
|
409
|
-
t && (e.
|
|
525
|
+
t && (e.ae = true);
|
|
410
526
|
return t;
|
|
411
527
|
}
|
|
412
528
|
function currentTransition(e) {
|
|
413
|
-
while (e.
|
|
529
|
+
while (e.ae && typeof e.ae === "object") e = e.ae;
|
|
414
530
|
return e;
|
|
415
531
|
}
|
|
416
532
|
function runInTransition(e, t) {
|
|
@@ -434,11 +550,11 @@ function action(e) {
|
|
|
434
550
|
const r = e(...t);
|
|
435
551
|
globalQueue.initTransition();
|
|
436
552
|
let o = activeTransition;
|
|
437
|
-
o.
|
|
553
|
+
o.le.push(r);
|
|
438
554
|
const done = (e, t) => {
|
|
439
555
|
o = currentTransition(o);
|
|
440
|
-
const s = o.
|
|
441
|
-
if (s >= 0) o.
|
|
556
|
+
const s = o.le.indexOf(r);
|
|
557
|
+
if (s >= 0) o.le.splice(s, 1);
|
|
442
558
|
activeTransition = o;
|
|
443
559
|
schedule();
|
|
444
560
|
t ? i(t) : n(e);
|
|
@@ -466,8 +582,8 @@ function action(e) {
|
|
|
466
582
|
step();
|
|
467
583
|
});
|
|
468
584
|
}
|
|
469
|
-
GlobalQueue.
|
|
470
|
-
GlobalQueue.
|
|
585
|
+
GlobalQueue.ne = recompute;
|
|
586
|
+
GlobalQueue.ie = disposeChildren;
|
|
471
587
|
let tracking = false;
|
|
472
588
|
let stale = false;
|
|
473
589
|
let refreshing = false;
|
|
@@ -476,105 +592,149 @@ let foundPending = false;
|
|
|
476
592
|
let pendingReadActive = false;
|
|
477
593
|
let context = null;
|
|
478
594
|
function recompute(e, t = false) {
|
|
479
|
-
const n = e.
|
|
595
|
+
const n = e.fe;
|
|
480
596
|
if (!t) {
|
|
481
|
-
if (e
|
|
482
|
-
globalQueue.initTransition(e
|
|
483
|
-
deleteFromHeap(e, e.
|
|
484
|
-
if (e
|
|
597
|
+
if (e.$ && (!n || activeTransition) && activeTransition !== e.$)
|
|
598
|
+
globalQueue.initTransition(e.$);
|
|
599
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
600
|
+
if (e.$ || n === EFFECT_TRACKED) disposeChildren(e);
|
|
485
601
|
else {
|
|
486
602
|
markDisposal(e);
|
|
487
|
-
e.
|
|
488
|
-
e.
|
|
489
|
-
e.
|
|
490
|
-
e.
|
|
603
|
+
e.Se = e._e;
|
|
604
|
+
e.Ie = e.pe;
|
|
605
|
+
e._e = null;
|
|
606
|
+
e.pe = null;
|
|
491
607
|
}
|
|
492
608
|
}
|
|
493
|
-
const i = !!(e.
|
|
494
|
-
const r = e
|
|
495
|
-
const o =
|
|
609
|
+
const i = !!(e._ & REACTIVE_OPTIMISTIC_DIRTY);
|
|
610
|
+
const r = hasActiveOverride(e);
|
|
611
|
+
const o = !!(e.Oe & STATUS_PENDING);
|
|
612
|
+
const s = context;
|
|
496
613
|
context = e;
|
|
497
|
-
e.
|
|
498
|
-
e.
|
|
499
|
-
e.
|
|
500
|
-
let
|
|
501
|
-
let
|
|
614
|
+
e.he = null;
|
|
615
|
+
e._ = REACTIVE_RECOMPUTING_DEPS;
|
|
616
|
+
e.ce = clock;
|
|
617
|
+
let u = e.B === NOT_PENDING ? e.Re : e.B;
|
|
618
|
+
let c = e.u;
|
|
502
619
|
let l = tracking;
|
|
503
|
-
let
|
|
620
|
+
let a = currentOptimisticLane;
|
|
504
621
|
tracking = true;
|
|
505
|
-
if (i)
|
|
622
|
+
if (i) {
|
|
623
|
+
const t = resolveLane(e);
|
|
624
|
+
if (t) setCurrentOptimisticLane(t);
|
|
625
|
+
}
|
|
506
626
|
try {
|
|
507
|
-
|
|
627
|
+
u = handleAsync(e, e.U(u));
|
|
508
628
|
clearStatus(e);
|
|
629
|
+
const t = resolveLane(e);
|
|
630
|
+
if (t) {
|
|
631
|
+
t.G.delete(e);
|
|
632
|
+
updatePendingSignal(t.t);
|
|
633
|
+
}
|
|
509
634
|
} catch (t) {
|
|
510
|
-
if (t instanceof NotReadyError) {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
635
|
+
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
636
|
+
const t = findLane(currentOptimisticLane);
|
|
637
|
+
if (t.t !== e) {
|
|
638
|
+
t.G.add(e);
|
|
639
|
+
e.W = t;
|
|
640
|
+
updatePendingSignal(t.t);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
notifyStatus(
|
|
644
|
+
e,
|
|
645
|
+
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
646
|
+
t,
|
|
647
|
+
undefined,
|
|
648
|
+
t instanceof NotReadyError ? e.W : undefined
|
|
649
|
+
);
|
|
514
650
|
} finally {
|
|
515
651
|
tracking = l;
|
|
516
|
-
e.
|
|
517
|
-
context =
|
|
652
|
+
e._ = REACTIVE_NONE;
|
|
653
|
+
context = s;
|
|
518
654
|
}
|
|
519
|
-
if (!e.
|
|
520
|
-
const
|
|
521
|
-
let l =
|
|
655
|
+
if (!e.se) {
|
|
656
|
+
const s = e.he;
|
|
657
|
+
let l = s !== null ? s.m : e.D;
|
|
522
658
|
if (l !== null) {
|
|
523
659
|
do {
|
|
524
660
|
l = unlinkSubs(l);
|
|
525
661
|
} while (l !== null);
|
|
526
|
-
if (
|
|
527
|
-
else e.
|
|
528
|
-
}
|
|
529
|
-
const
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
662
|
+
if (s !== null) s.m = null;
|
|
663
|
+
else e.D = null;
|
|
664
|
+
}
|
|
665
|
+
const a = r ? e.Re : e.B === NOT_PENDING ? e.Re : e.B;
|
|
666
|
+
const f = !e.Ae || !e.Ae(a, u);
|
|
667
|
+
if (f) {
|
|
668
|
+
const s = r ? e.Re : undefined;
|
|
669
|
+
if (t || (n && activeTransition !== e.$) || i) e.Re = u;
|
|
670
|
+
else e.B = u;
|
|
671
|
+
if (r && !i && o) {
|
|
672
|
+
const t = e.K || 0;
|
|
673
|
+
const n = e.j || 0;
|
|
674
|
+
if (t <= n) e.Re = u;
|
|
675
|
+
}
|
|
676
|
+
if (!r || i || e.Re !== s) {
|
|
677
|
+
insertSubs(e, i || r);
|
|
678
|
+
}
|
|
679
|
+
} else if (r) {
|
|
680
|
+
e.B = u;
|
|
681
|
+
} else if (e.u != c) {
|
|
682
|
+
for (let t = e.p; t !== null; t = t.h) {
|
|
683
|
+
insertIntoHeapHeight(t.A, t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
537
684
|
}
|
|
538
685
|
}
|
|
539
686
|
}
|
|
540
|
-
|
|
541
|
-
(!t || e.
|
|
542
|
-
e
|
|
687
|
+
setCurrentOptimisticLane(a);
|
|
688
|
+
(!t || e.Oe & STATUS_PENDING) && !e.$ && !(activeTransition && e.Y) && globalQueue.J.push(e);
|
|
689
|
+
e.$ && n && activeTransition !== e.$ && runInTransition(e.$, () => recompute(e));
|
|
543
690
|
}
|
|
544
691
|
function handleAsync(e, t, n) {
|
|
545
692
|
const i = typeof t === "object" && t !== null;
|
|
546
693
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
547
694
|
const o = !r && i && untrack(() => typeof t.then === "function");
|
|
548
695
|
if (!o && !r) {
|
|
549
|
-
e.
|
|
696
|
+
e.ge = null;
|
|
550
697
|
return t;
|
|
551
698
|
}
|
|
552
|
-
e.
|
|
699
|
+
e.ge = t;
|
|
553
700
|
let s;
|
|
554
701
|
const handleError = n => {
|
|
555
|
-
if (e.
|
|
556
|
-
globalQueue.initTransition(e
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
notifyStatus(e, STATUS_PENDING, n);
|
|
560
|
-
} else notifyStatus(e, STATUS_ERROR, n);
|
|
561
|
-
e.ae = clock;
|
|
702
|
+
if (e.ge !== t) return;
|
|
703
|
+
globalQueue.initTransition(e.$);
|
|
704
|
+
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
705
|
+
e.ce = clock;
|
|
562
706
|
};
|
|
563
707
|
const asyncWrite = (i, r) => {
|
|
564
|
-
if (e.
|
|
565
|
-
|
|
708
|
+
if (e.ge !== t) return;
|
|
709
|
+
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
710
|
+
globalQueue.initTransition(e.$);
|
|
566
711
|
clearStatus(e);
|
|
712
|
+
const o = resolveLane(e);
|
|
713
|
+
if (o) o.G.delete(e);
|
|
567
714
|
if (n) n(i);
|
|
568
|
-
else if (e.
|
|
569
|
-
const t = e.
|
|
570
|
-
if (e.U) e.
|
|
715
|
+
else if (e.Y) {
|
|
716
|
+
const t = e.B !== NOT_PENDING;
|
|
717
|
+
if (e.U) e.B = i;
|
|
571
718
|
if (!t) {
|
|
572
|
-
e.
|
|
719
|
+
e.Re = i;
|
|
573
720
|
insertSubs(e);
|
|
574
721
|
}
|
|
575
|
-
e.
|
|
576
|
-
|
|
577
|
-
|
|
722
|
+
e.ce = clock;
|
|
723
|
+
} else if (o) {
|
|
724
|
+
const t = e.Re;
|
|
725
|
+
const n = e.Ae;
|
|
726
|
+
if (!n || !n(i, t)) {
|
|
727
|
+
e.Re = i;
|
|
728
|
+
e.ce = clock;
|
|
729
|
+
if (e.Ne) {
|
|
730
|
+
setSignal(e.Ne, i);
|
|
731
|
+
}
|
|
732
|
+
insertSubs(e, true);
|
|
733
|
+
}
|
|
734
|
+
} else {
|
|
735
|
+
setSignal(e, () => i);
|
|
736
|
+
}
|
|
737
|
+
schedule();
|
|
578
738
|
flush();
|
|
579
739
|
r?.();
|
|
580
740
|
};
|
|
@@ -594,7 +754,7 @@ function handleAsync(e, t, n) {
|
|
|
594
754
|
);
|
|
595
755
|
i = false;
|
|
596
756
|
if (!n) {
|
|
597
|
-
globalQueue.initTransition(e
|
|
757
|
+
globalQueue.initTransition(e.$);
|
|
598
758
|
throw new NotReadyError(context);
|
|
599
759
|
}
|
|
600
760
|
}
|
|
@@ -626,177 +786,191 @@ function handleAsync(e, t, n) {
|
|
|
626
786
|
};
|
|
627
787
|
const r = iterate();
|
|
628
788
|
if (!i && !r) {
|
|
629
|
-
globalQueue.initTransition(e
|
|
789
|
+
globalQueue.initTransition(e.$);
|
|
630
790
|
throw new NotReadyError(context);
|
|
631
791
|
}
|
|
632
792
|
}
|
|
633
793
|
return s;
|
|
634
794
|
}
|
|
635
795
|
function clearStatus(e) {
|
|
636
|
-
e.
|
|
637
|
-
e.
|
|
796
|
+
e.Oe = e.Oe & STATUS_UNINITIALIZED;
|
|
797
|
+
e.se = null;
|
|
638
798
|
updatePendingSignal(e);
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
799
|
+
e.Pe?.();
|
|
800
|
+
}
|
|
801
|
+
function notifyStatus(e, t, n, i, r) {
|
|
802
|
+
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
803
|
+
n = new StatusError(e, n);
|
|
804
|
+
const o = n instanceof NotReadyError && n.t === e;
|
|
805
|
+
const s = t === STATUS_PENDING && e.Y && !o;
|
|
806
|
+
const u = s && hasActiveOverride(e);
|
|
807
|
+
if (!i) {
|
|
808
|
+
e.Oe = t | (t !== STATUS_ERROR ? e.Oe & STATUS_UNINITIALIZED : 0);
|
|
809
|
+
e.se = n;
|
|
810
|
+
updatePendingSignal(e);
|
|
811
|
+
}
|
|
812
|
+
if (r && !i) {
|
|
813
|
+
assignOrMergeLane(e, r);
|
|
814
|
+
}
|
|
815
|
+
if (u && activeTransition && n instanceof NotReadyError) {
|
|
816
|
+
const e = n.t;
|
|
817
|
+
if (!activeTransition.ue.includes(e)) {
|
|
818
|
+
activeTransition.ue.push(e);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
const c = i || u;
|
|
822
|
+
const l = i || s ? undefined : r;
|
|
823
|
+
if (e.Pe) {
|
|
824
|
+
if (c) {
|
|
825
|
+
e.Pe(t, n);
|
|
826
|
+
} else {
|
|
827
|
+
e.Pe();
|
|
648
828
|
}
|
|
649
|
-
|
|
829
|
+
return;
|
|
650
830
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
if (e.Te) return e.Te();
|
|
657
|
-
for (let i = e.p; i !== null; i = i.I) {
|
|
658
|
-
i.h.ae = clock;
|
|
659
|
-
if (i.h.B !== n) {
|
|
660
|
-
!i.h.X && globalQueue.L.push(i.h);
|
|
661
|
-
notifyStatus(i.h, t, n);
|
|
831
|
+
for (let i = e.p; i !== null; i = i.h) {
|
|
832
|
+
i.A.ce = clock;
|
|
833
|
+
if (i.A.se !== n) {
|
|
834
|
+
!i.A.$ && globalQueue.J.push(i.A);
|
|
835
|
+
notifyStatus(i.A, t, n, c, l);
|
|
662
836
|
}
|
|
663
837
|
}
|
|
664
|
-
for (let i = e.
|
|
665
|
-
for (let e = i.p; e !== null; e = e.
|
|
666
|
-
e.
|
|
667
|
-
if (e.
|
|
668
|
-
!e.
|
|
669
|
-
notifyStatus(e.
|
|
838
|
+
for (let i = e.N; i !== null; i = i.P) {
|
|
839
|
+
for (let e = i.p; e !== null; e = e.h) {
|
|
840
|
+
e.A.ce = clock;
|
|
841
|
+
if (e.A.se !== n) {
|
|
842
|
+
!e.A.$ && globalQueue.J.push(e.A);
|
|
843
|
+
notifyStatus(e.A, t, n, c, l);
|
|
670
844
|
}
|
|
671
845
|
}
|
|
672
846
|
}
|
|
673
847
|
}
|
|
674
848
|
function updateIfNecessary(e) {
|
|
675
|
-
if (e.
|
|
676
|
-
for (let t = e.
|
|
849
|
+
if (e._ & REACTIVE_CHECK) {
|
|
850
|
+
for (let t = e.D; t; t = t.m) {
|
|
677
851
|
const n = t.V;
|
|
678
|
-
const i = n.
|
|
852
|
+
const i = n.L || n;
|
|
679
853
|
if (i.U) {
|
|
680
854
|
updateIfNecessary(i);
|
|
681
855
|
}
|
|
682
|
-
if (e.
|
|
856
|
+
if (e._ & REACTIVE_DIRTY) {
|
|
683
857
|
break;
|
|
684
858
|
}
|
|
685
859
|
}
|
|
686
860
|
}
|
|
687
|
-
if (e.
|
|
861
|
+
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.se && e.ce < clock)) {
|
|
688
862
|
recompute(e);
|
|
689
863
|
}
|
|
690
|
-
e.
|
|
864
|
+
e._ = REACTIVE_NONE;
|
|
691
865
|
}
|
|
692
866
|
function unlinkSubs(e) {
|
|
693
867
|
const t = e.V;
|
|
694
|
-
const n = e.
|
|
695
|
-
const i = e.
|
|
696
|
-
const r = e.
|
|
697
|
-
if (i !== null) i.
|
|
698
|
-
else t.
|
|
699
|
-
if (r !== null) r.
|
|
868
|
+
const n = e.m;
|
|
869
|
+
const i = e.h;
|
|
870
|
+
const r = e.Ce;
|
|
871
|
+
if (i !== null) i.Ce = r;
|
|
872
|
+
else t.ye = r;
|
|
873
|
+
if (r !== null) r.h = i;
|
|
700
874
|
else {
|
|
701
875
|
t.p = i;
|
|
702
876
|
if (i === null) {
|
|
703
|
-
t.
|
|
704
|
-
t.U && !t.
|
|
877
|
+
t.De?.();
|
|
878
|
+
t.U && !t.ve && unobserved(t);
|
|
705
879
|
}
|
|
706
880
|
}
|
|
707
881
|
return n;
|
|
708
882
|
}
|
|
709
883
|
function unobserved(e) {
|
|
710
|
-
deleteFromHeap(e, e.
|
|
711
|
-
let t = e.
|
|
884
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
885
|
+
let t = e.D;
|
|
712
886
|
while (t !== null) {
|
|
713
887
|
t = unlinkSubs(t);
|
|
714
888
|
}
|
|
715
|
-
e.
|
|
889
|
+
e.D = null;
|
|
716
890
|
disposeChildren(e, true);
|
|
717
891
|
}
|
|
718
892
|
function link(e, t) {
|
|
719
|
-
const n = t.
|
|
893
|
+
const n = t.he;
|
|
720
894
|
if (n !== null && n.V === e) return;
|
|
721
895
|
let i = null;
|
|
722
|
-
const r = t.
|
|
896
|
+
const r = t._ & REACTIVE_RECOMPUTING_DEPS;
|
|
723
897
|
if (r) {
|
|
724
|
-
i = n !== null ? n.
|
|
898
|
+
i = n !== null ? n.m : t.D;
|
|
725
899
|
if (i !== null && i.V === e) {
|
|
726
|
-
t.
|
|
900
|
+
t.he = i;
|
|
727
901
|
return;
|
|
728
902
|
}
|
|
729
903
|
}
|
|
730
|
-
const o = e.
|
|
731
|
-
if (o !== null && o.
|
|
732
|
-
const s = (t.
|
|
733
|
-
if (n !== null) n.
|
|
734
|
-
else t.
|
|
735
|
-
if (o !== null) o.
|
|
904
|
+
const o = e.ye;
|
|
905
|
+
if (o !== null && o.A === t && (!r || isValidLink(o, t))) return;
|
|
906
|
+
const s = (t.he = e.ye = { V: e, A: t, m: i, Ce: o, h: null });
|
|
907
|
+
if (n !== null) n.m = s;
|
|
908
|
+
else t.D = s;
|
|
909
|
+
if (o !== null) o.h = s;
|
|
736
910
|
else e.p = s;
|
|
737
911
|
}
|
|
738
912
|
function isValidLink(e, t) {
|
|
739
|
-
const n = t.
|
|
913
|
+
const n = t.he;
|
|
740
914
|
if (n !== null) {
|
|
741
|
-
let i = t.
|
|
915
|
+
let i = t.D;
|
|
742
916
|
do {
|
|
743
917
|
if (i === e) return true;
|
|
744
918
|
if (i === n) break;
|
|
745
|
-
i = i.
|
|
919
|
+
i = i.m;
|
|
746
920
|
} while (i !== null);
|
|
747
921
|
}
|
|
748
922
|
return false;
|
|
749
923
|
}
|
|
750
924
|
function markDisposal(e) {
|
|
751
|
-
let t = e.
|
|
925
|
+
let t = e.pe;
|
|
752
926
|
while (t) {
|
|
753
|
-
t.
|
|
754
|
-
if (t.
|
|
927
|
+
t._ |= REACTIVE_ZOMBIE;
|
|
928
|
+
if (t._ & REACTIVE_IN_HEAP) {
|
|
755
929
|
deleteFromHeap(t, dirtyQueue);
|
|
756
930
|
insertIntoHeap(t, zombieQueue);
|
|
757
931
|
}
|
|
758
932
|
markDisposal(t);
|
|
759
|
-
t = t.
|
|
933
|
+
t = t.we;
|
|
760
934
|
}
|
|
761
935
|
}
|
|
762
936
|
function dispose(e) {
|
|
763
|
-
let t = e.
|
|
937
|
+
let t = e.D || null;
|
|
764
938
|
do {
|
|
765
939
|
t = unlinkSubs(t);
|
|
766
940
|
} while (t !== null);
|
|
767
|
-
e.
|
|
768
|
-
e.
|
|
941
|
+
e.D = null;
|
|
942
|
+
e.he = null;
|
|
769
943
|
disposeChildren(e, true);
|
|
770
944
|
}
|
|
771
945
|
function disposeChildren(e, t = false, n) {
|
|
772
|
-
if (e.
|
|
773
|
-
if (t) e.
|
|
774
|
-
let i = n ? e.
|
|
946
|
+
if (e._ & REACTIVE_DISPOSED) return;
|
|
947
|
+
if (t) e._ = REACTIVE_DISPOSED;
|
|
948
|
+
let i = n ? e.Ie : e.pe;
|
|
775
949
|
while (i) {
|
|
776
|
-
const e = i.
|
|
777
|
-
if (i.
|
|
950
|
+
const e = i.we;
|
|
951
|
+
if (i.D) {
|
|
778
952
|
const e = i;
|
|
779
|
-
deleteFromHeap(e, e.
|
|
780
|
-
let t = e.
|
|
953
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
954
|
+
let t = e.D;
|
|
781
955
|
do {
|
|
782
956
|
t = unlinkSubs(t);
|
|
783
957
|
} while (t !== null);
|
|
784
|
-
e.
|
|
785
|
-
e.
|
|
958
|
+
e.D = null;
|
|
959
|
+
e.he = null;
|
|
786
960
|
}
|
|
787
961
|
disposeChildren(i, true);
|
|
788
962
|
i = e;
|
|
789
963
|
}
|
|
790
964
|
if (n) {
|
|
791
|
-
e.
|
|
965
|
+
e.Ie = null;
|
|
792
966
|
} else {
|
|
793
|
-
e.
|
|
794
|
-
e.
|
|
967
|
+
e.pe = null;
|
|
968
|
+
e.we = null;
|
|
795
969
|
}
|
|
796
970
|
runDisposal(e, n);
|
|
797
971
|
}
|
|
798
972
|
function runDisposal(e, t) {
|
|
799
|
-
let n = t ? e.
|
|
973
|
+
let n = t ? e.Se : e._e;
|
|
800
974
|
if (!n) return;
|
|
801
975
|
if (Array.isArray(n)) {
|
|
802
976
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -806,10 +980,10 @@ function runDisposal(e, t) {
|
|
|
806
980
|
} else {
|
|
807
981
|
n.call(n);
|
|
808
982
|
}
|
|
809
|
-
t ? (e.
|
|
983
|
+
t ? (e.Se = null) : (e._e = null);
|
|
810
984
|
}
|
|
811
985
|
function getNextChildId(e) {
|
|
812
|
-
if (e.id != null) return formatId(e.id, e.
|
|
986
|
+
if (e.id != null) return formatId(e.id, e.be++);
|
|
813
987
|
throw new Error("Cannot get child id from owner without an id");
|
|
814
988
|
}
|
|
815
989
|
function formatId(e, t) {
|
|
@@ -820,102 +994,132 @@ function formatId(e, t) {
|
|
|
820
994
|
function computed(e, t, n) {
|
|
821
995
|
const i = {
|
|
822
996
|
id: n?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
997
|
+
Ae: n?.equals != null ? n.equals : isEqual,
|
|
998
|
+
me: !!n?.pureWrite,
|
|
999
|
+
De: n?.unobserved,
|
|
1000
|
+
_e: null,
|
|
1001
|
+
Te: context?.Te ?? globalQueue,
|
|
1002
|
+
Ve: context?.Ve ?? defaultContext,
|
|
1003
|
+
be: 0,
|
|
830
1004
|
U: e,
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
1005
|
+
Re: t,
|
|
1006
|
+
u: 0,
|
|
1007
|
+
N: null,
|
|
1008
|
+
O: undefined,
|
|
1009
|
+
R: null,
|
|
1010
|
+
D: null,
|
|
1011
|
+
he: null,
|
|
838
1012
|
p: null,
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
1013
|
+
ye: null,
|
|
1014
|
+
o: context,
|
|
1015
|
+
we: null,
|
|
1016
|
+
pe: null,
|
|
1017
|
+
_: REACTIVE_NONE,
|
|
1018
|
+
Oe: STATUS_UNINITIALIZED,
|
|
1019
|
+
ce: clock,
|
|
1020
|
+
B: NOT_PENDING,
|
|
1021
|
+
Se: null,
|
|
1022
|
+
Ie: null,
|
|
1023
|
+
ge: null,
|
|
1024
|
+
$: null
|
|
851
1025
|
};
|
|
852
|
-
i.
|
|
853
|
-
const r = context?.
|
|
1026
|
+
i.R = i;
|
|
1027
|
+
const r = context?.i ? context.l : context;
|
|
854
1028
|
if (context) {
|
|
855
|
-
const e = context.
|
|
1029
|
+
const e = context.pe;
|
|
856
1030
|
if (e === null) {
|
|
857
|
-
context.
|
|
1031
|
+
context.pe = i;
|
|
858
1032
|
} else {
|
|
859
|
-
i.
|
|
860
|
-
context.
|
|
1033
|
+
i.we = e;
|
|
1034
|
+
context.pe = i;
|
|
861
1035
|
}
|
|
862
1036
|
}
|
|
863
|
-
if (r) i.
|
|
1037
|
+
if (r) i.u = r.u + 1;
|
|
864
1038
|
!n?.lazy && recompute(i, true);
|
|
865
1039
|
return i;
|
|
866
1040
|
}
|
|
867
1041
|
function signal(e, t, n = null) {
|
|
868
1042
|
const i = {
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
1043
|
+
Ae: t?.equals != null ? t.equals : isEqual,
|
|
1044
|
+
me: !!t?.pureWrite,
|
|
1045
|
+
De: t?.unobserved,
|
|
1046
|
+
Re: e,
|
|
873
1047
|
p: null,
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
P: n?.
|
|
878
|
-
|
|
1048
|
+
ye: null,
|
|
1049
|
+
ce: clock,
|
|
1050
|
+
L: n,
|
|
1051
|
+
P: n?.N || null,
|
|
1052
|
+
B: NOT_PENDING
|
|
879
1053
|
};
|
|
880
|
-
n && (n.
|
|
1054
|
+
n && (n.N = i);
|
|
881
1055
|
return i;
|
|
882
1056
|
}
|
|
883
1057
|
function optimisticSignal(e, t) {
|
|
884
1058
|
const n = signal(e, t);
|
|
885
|
-
n.
|
|
1059
|
+
n.Y = true;
|
|
886
1060
|
return n;
|
|
887
1061
|
}
|
|
888
1062
|
function optimisticComputed(e, t, n) {
|
|
889
1063
|
const i = computed(e, t, n);
|
|
890
|
-
i.
|
|
1064
|
+
i.Y = true;
|
|
891
1065
|
return i;
|
|
892
1066
|
}
|
|
893
1067
|
function getPendingSignal(e) {
|
|
894
|
-
if (!e.
|
|
895
|
-
e.
|
|
896
|
-
if (
|
|
1068
|
+
if (!e.Le) {
|
|
1069
|
+
e.Le = optimisticSignal(false, { pureWrite: true });
|
|
1070
|
+
if (e.k) {
|
|
1071
|
+
e.Le.k = e;
|
|
1072
|
+
}
|
|
1073
|
+
if (computePendingState(e)) setSignal(e.Le, true);
|
|
897
1074
|
}
|
|
898
|
-
return e.
|
|
1075
|
+
return e.Le;
|
|
899
1076
|
}
|
|
900
1077
|
function computePendingState(e) {
|
|
901
|
-
if (e.te !== NOT_PENDING) return true;
|
|
902
1078
|
const t = e;
|
|
903
|
-
|
|
1079
|
+
if (e.Y && e.B !== NOT_PENDING) {
|
|
1080
|
+
if (t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
|
|
1081
|
+
if (e.k) {
|
|
1082
|
+
const t = e.W ? findLane(e.W) : null;
|
|
1083
|
+
return !!(t && t.G.size > 0);
|
|
1084
|
+
}
|
|
1085
|
+
return true;
|
|
1086
|
+
}
|
|
1087
|
+
if (e.B !== NOT_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
|
|
1088
|
+
return !!(t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED));
|
|
904
1089
|
}
|
|
905
1090
|
function getPendingValueComputed(e) {
|
|
906
|
-
if (!e.
|
|
1091
|
+
if (!e.Ne) {
|
|
907
1092
|
const t = pendingReadActive;
|
|
908
1093
|
pendingReadActive = false;
|
|
909
|
-
const n =
|
|
1094
|
+
const n = pendingCheckActive;
|
|
1095
|
+
pendingCheckActive = false;
|
|
1096
|
+
const i = context;
|
|
910
1097
|
context = null;
|
|
911
|
-
e.
|
|
912
|
-
|
|
1098
|
+
e.Ne = optimisticComputed(() => read(e));
|
|
1099
|
+
e.Ne.k = e;
|
|
1100
|
+
context = i;
|
|
1101
|
+
pendingCheckActive = n;
|
|
913
1102
|
pendingReadActive = t;
|
|
914
1103
|
}
|
|
915
|
-
return e.
|
|
1104
|
+
return e.Ne;
|
|
916
1105
|
}
|
|
917
1106
|
function updatePendingSignal(e) {
|
|
918
|
-
if (e.
|
|
1107
|
+
if (e.Le) {
|
|
1108
|
+
const t = computePendingState(e);
|
|
1109
|
+
const n = e.Le;
|
|
1110
|
+
setSignal(n, t);
|
|
1111
|
+
if (!t && n.W) {
|
|
1112
|
+
const t = resolveLane(e);
|
|
1113
|
+
if (t && t.G.size > 0) {
|
|
1114
|
+
const e = findLane(n.W);
|
|
1115
|
+
if (e !== t) {
|
|
1116
|
+
mergeLanes(t, e);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
clearLaneEntry(n);
|
|
1120
|
+
n.W = undefined;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
919
1123
|
}
|
|
920
1124
|
function isEqual(e, t) {
|
|
921
1125
|
return e === t;
|
|
@@ -930,8 +1134,24 @@ function untrack(e) {
|
|
|
930
1134
|
}
|
|
931
1135
|
}
|
|
932
1136
|
function read(e) {
|
|
1137
|
+
if (pendingReadActive) {
|
|
1138
|
+
const t = getPendingValueComputed(e);
|
|
1139
|
+
const n = pendingReadActive;
|
|
1140
|
+
pendingReadActive = false;
|
|
1141
|
+
const i = read(t);
|
|
1142
|
+
pendingReadActive = n;
|
|
1143
|
+
if (t.Oe & STATUS_PENDING) return e.Re;
|
|
1144
|
+
if (stale && currentOptimisticLane && t.W) {
|
|
1145
|
+
const n = findLane(t.W);
|
|
1146
|
+
const i = findLane(currentOptimisticLane);
|
|
1147
|
+
if (n !== i && n.G.size > 0) {
|
|
1148
|
+
return e.Re;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
return i;
|
|
1152
|
+
}
|
|
933
1153
|
if (pendingCheckActive) {
|
|
934
|
-
const t = e.
|
|
1154
|
+
const t = e.L || e;
|
|
935
1155
|
const n = getPendingSignal(t);
|
|
936
1156
|
const i = pendingCheckActive;
|
|
937
1157
|
pendingCheckActive = false;
|
|
@@ -939,86 +1159,92 @@ function read(e) {
|
|
|
939
1159
|
foundPending = true;
|
|
940
1160
|
}
|
|
941
1161
|
pendingCheckActive = i;
|
|
942
|
-
return e.
|
|
943
|
-
}
|
|
944
|
-
if (pendingReadActive) {
|
|
945
|
-
const t = getPendingValueComputed(e);
|
|
946
|
-
const n = pendingReadActive;
|
|
947
|
-
pendingReadActive = false;
|
|
948
|
-
const i = read(t);
|
|
949
|
-
pendingReadActive = n;
|
|
950
|
-
if (t.ie & STATUS_PENDING) return e.ne;
|
|
951
|
-
return i;
|
|
1162
|
+
return e.Re;
|
|
952
1163
|
}
|
|
953
1164
|
let t = context;
|
|
954
|
-
if (t?.
|
|
1165
|
+
if (t?.i) t = t.l;
|
|
955
1166
|
if (refreshing && e.U) recompute(e);
|
|
956
1167
|
if (t && tracking) {
|
|
957
|
-
if (e.U && e.
|
|
1168
|
+
if (e.U && e._ & REACTIVE_DISPOSED) recompute(e);
|
|
958
1169
|
link(e, t);
|
|
959
|
-
const n = e.
|
|
1170
|
+
const n = e.L || e;
|
|
960
1171
|
if (n.U) {
|
|
961
|
-
const i = e.
|
|
962
|
-
if (n.
|
|
1172
|
+
const i = e._ & REACTIVE_ZOMBIE;
|
|
1173
|
+
if (n.u >= (i ? zombieQueue.C : dirtyQueue.C)) {
|
|
963
1174
|
markNode(t);
|
|
964
1175
|
markHeap(i ? zombieQueue : dirtyQueue);
|
|
965
1176
|
updateIfNecessary(n);
|
|
966
1177
|
}
|
|
967
|
-
const r = n.
|
|
968
|
-
if (r >= t.
|
|
969
|
-
t.
|
|
1178
|
+
const r = n.u;
|
|
1179
|
+
if (r >= t.u && e.o !== t) {
|
|
1180
|
+
t.u = r + 1;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
const n = e.L || e;
|
|
1185
|
+
if (t && n.Oe & STATUS_PENDING && !(stale && n.$ && activeTransition !== n.$)) {
|
|
1186
|
+
if (currentOptimisticLane) {
|
|
1187
|
+
const i = n.W;
|
|
1188
|
+
const r = findLane(currentOptimisticLane);
|
|
1189
|
+
if (i && findLane(i) === r && !hasActiveOverride(n)) {
|
|
1190
|
+
if (!tracking) link(e, t);
|
|
1191
|
+
throw n.se;
|
|
970
1192
|
}
|
|
1193
|
+
} else {
|
|
1194
|
+
if (!tracking) link(e, t);
|
|
1195
|
+
throw n.se;
|
|
971
1196
|
}
|
|
972
1197
|
}
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
t &&
|
|
976
|
-
!optimisticReadActive &&
|
|
977
|
-
n.ie & STATUS_PENDING &&
|
|
978
|
-
!(stale && n.X && activeTransition !== n.X)
|
|
979
|
-
)
|
|
980
|
-
throw n.B;
|
|
981
|
-
if (e.U && e.ie & STATUS_ERROR) {
|
|
982
|
-
if (e.ae < clock) {
|
|
1198
|
+
if (e.U && e.Oe & STATUS_ERROR) {
|
|
1199
|
+
if (e.ce < clock) {
|
|
983
1200
|
recompute(e, true);
|
|
984
1201
|
return read(e);
|
|
985
|
-
} else throw e.
|
|
1202
|
+
} else throw e.se;
|
|
986
1203
|
}
|
|
987
1204
|
return !t ||
|
|
988
|
-
|
|
989
|
-
e.
|
|
990
|
-
(stale && e
|
|
991
|
-
? e.
|
|
992
|
-
: e.
|
|
1205
|
+
currentOptimisticLane !== null ||
|
|
1206
|
+
e.B === NOT_PENDING ||
|
|
1207
|
+
(stale && e.$ && activeTransition !== e.$)
|
|
1208
|
+
? e.Re
|
|
1209
|
+
: e.B;
|
|
993
1210
|
}
|
|
994
1211
|
function setSignal(e, t) {
|
|
995
|
-
if (e
|
|
996
|
-
const n = e.
|
|
997
|
-
const i = n ? e.
|
|
1212
|
+
if (e.$ && activeTransition !== e.$) globalQueue.initTransition(e.$);
|
|
1213
|
+
const n = e.Y && !projectionWriteActive;
|
|
1214
|
+
const i = n ? e.Re : e.B === NOT_PENDING ? e.Re : e.B;
|
|
998
1215
|
if (typeof t === "function") t = t(i);
|
|
999
|
-
const r = !e.
|
|
1000
|
-
if (!r)
|
|
1216
|
+
const r = !e.Ae || !e.Ae(i, t);
|
|
1217
|
+
if (!r) {
|
|
1218
|
+
if (n && e.B !== NOT_PENDING && e.U) {
|
|
1219
|
+
insertSubs(e, true);
|
|
1220
|
+
schedule();
|
|
1221
|
+
}
|
|
1222
|
+
return t;
|
|
1223
|
+
}
|
|
1001
1224
|
if (n) {
|
|
1002
|
-
const n = globalQueue.
|
|
1003
|
-
if (e
|
|
1004
|
-
globalQueue.initTransition(e
|
|
1225
|
+
const n = globalQueue.ee.includes(e);
|
|
1226
|
+
if (e.$ && n) {
|
|
1227
|
+
globalQueue.initTransition(e.$);
|
|
1005
1228
|
}
|
|
1006
|
-
if (e.
|
|
1007
|
-
e.
|
|
1229
|
+
if (e.B === NOT_PENDING) {
|
|
1230
|
+
e.B = e.Re;
|
|
1008
1231
|
}
|
|
1009
1232
|
if (!n) {
|
|
1010
|
-
globalQueue.
|
|
1233
|
+
globalQueue.ee.push(e);
|
|
1011
1234
|
}
|
|
1012
|
-
e.
|
|
1235
|
+
e.K = (e.K || 0) + 1;
|
|
1236
|
+
const i = getOrCreateLane(e);
|
|
1237
|
+
e.W = i;
|
|
1238
|
+
e.Re = t;
|
|
1013
1239
|
} else {
|
|
1014
|
-
if (e.
|
|
1015
|
-
e.
|
|
1240
|
+
if (e.B === NOT_PENDING) globalQueue.J.push(e);
|
|
1241
|
+
e.B = t;
|
|
1016
1242
|
}
|
|
1017
1243
|
updatePendingSignal(e);
|
|
1018
|
-
if (e.
|
|
1019
|
-
setSignal(e.
|
|
1244
|
+
if (e.Ne) {
|
|
1245
|
+
setSignal(e.Ne, t);
|
|
1020
1246
|
}
|
|
1021
|
-
e.
|
|
1247
|
+
e.ce = clock;
|
|
1022
1248
|
insertSubs(e, n);
|
|
1023
1249
|
schedule();
|
|
1024
1250
|
return t;
|
|
@@ -1033,37 +1259,37 @@ function getOwner() {
|
|
|
1033
1259
|
}
|
|
1034
1260
|
function onCleanup(e) {
|
|
1035
1261
|
if (!context) return e;
|
|
1036
|
-
if (!context.
|
|
1037
|
-
else if (Array.isArray(context.
|
|
1038
|
-
else context.
|
|
1262
|
+
if (!context._e) context._e = e;
|
|
1263
|
+
else if (Array.isArray(context._e)) context._e.push(e);
|
|
1264
|
+
else context._e = [context._e, e];
|
|
1039
1265
|
return e;
|
|
1040
1266
|
}
|
|
1041
1267
|
function createOwner(e) {
|
|
1042
1268
|
const t = context;
|
|
1043
1269
|
const n = {
|
|
1044
1270
|
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1271
|
+
i: true,
|
|
1272
|
+
l: t?.i ? t.l : t,
|
|
1273
|
+
pe: null,
|
|
1274
|
+
we: null,
|
|
1048
1275
|
_e: null,
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
i: t,
|
|
1276
|
+
Te: t?.Te ?? globalQueue,
|
|
1277
|
+
Ve: t?.Ve || defaultContext,
|
|
1278
|
+
be: 0,
|
|
1279
|
+
Se: null,
|
|
1280
|
+
Ie: null,
|
|
1281
|
+
o: t,
|
|
1056
1282
|
dispose(e = true) {
|
|
1057
1283
|
disposeChildren(n, e);
|
|
1058
1284
|
}
|
|
1059
1285
|
};
|
|
1060
1286
|
if (t) {
|
|
1061
|
-
const e = t.
|
|
1287
|
+
const e = t.pe;
|
|
1062
1288
|
if (e === null) {
|
|
1063
|
-
t.
|
|
1289
|
+
t.pe = n;
|
|
1064
1290
|
} else {
|
|
1065
|
-
n.
|
|
1066
|
-
t.
|
|
1291
|
+
n.we = e;
|
|
1292
|
+
t.pe = n;
|
|
1067
1293
|
}
|
|
1068
1294
|
}
|
|
1069
1295
|
return n;
|
|
@@ -1110,6 +1336,8 @@ function isPending(e) {
|
|
|
1110
1336
|
try {
|
|
1111
1337
|
e();
|
|
1112
1338
|
return foundPending;
|
|
1339
|
+
} catch {
|
|
1340
|
+
return foundPending;
|
|
1113
1341
|
} finally {
|
|
1114
1342
|
pendingCheckActive = t;
|
|
1115
1343
|
foundPending = n;
|
|
@@ -1141,7 +1369,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1141
1369
|
if (!t) {
|
|
1142
1370
|
throw new NoOwnerError();
|
|
1143
1371
|
}
|
|
1144
|
-
const n = hasContext(e, t) ? t.
|
|
1372
|
+
const n = hasContext(e, t) ? t.Ve[e.id] : e.defaultValue;
|
|
1145
1373
|
if (isUndefined(n)) {
|
|
1146
1374
|
throw new ContextNotFoundError();
|
|
1147
1375
|
}
|
|
@@ -1151,10 +1379,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1151
1379
|
if (!n) {
|
|
1152
1380
|
throw new NoOwnerError();
|
|
1153
1381
|
}
|
|
1154
|
-
n.
|
|
1382
|
+
n.Ve = { ...n.Ve, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1155
1383
|
}
|
|
1156
1384
|
function hasContext(e, t) {
|
|
1157
|
-
return !isUndefined(t?.
|
|
1385
|
+
return !isUndefined(t?.Ve[e.id]);
|
|
1158
1386
|
}
|
|
1159
1387
|
function isUndefined(e) {
|
|
1160
1388
|
return typeof e === "undefined";
|
|
@@ -1164,78 +1392,80 @@ function effect(e, t, n, i, r) {
|
|
|
1164
1392
|
const s = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
1165
1393
|
...r,
|
|
1166
1394
|
equals: () => {
|
|
1167
|
-
s.
|
|
1168
|
-
if (o) s.
|
|
1395
|
+
s.Ee = !s.se;
|
|
1396
|
+
if (o) s.Te.enqueue(s.fe, runEffect.bind(s));
|
|
1169
1397
|
return false;
|
|
1170
1398
|
},
|
|
1171
1399
|
lazy: true
|
|
1172
1400
|
});
|
|
1173
|
-
s.
|
|
1174
|
-
s.
|
|
1175
|
-
s.
|
|
1176
|
-
s.
|
|
1177
|
-
s.
|
|
1178
|
-
s.
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1401
|
+
s.Ue = i;
|
|
1402
|
+
s.ke = t;
|
|
1403
|
+
s.We = n;
|
|
1404
|
+
s.Qe = undefined;
|
|
1405
|
+
s.fe = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
1406
|
+
s.Pe = (e, t) => {
|
|
1407
|
+
const n = e !== undefined ? e : s.Oe;
|
|
1408
|
+
const i = t !== undefined ? t : s.se;
|
|
1409
|
+
if (n & STATUS_ERROR) {
|
|
1410
|
+
let e = i;
|
|
1411
|
+
s.Te.notify(s, STATUS_PENDING, 0);
|
|
1412
|
+
if (s.fe === EFFECT_USER) {
|
|
1183
1413
|
try {
|
|
1184
|
-
return s.
|
|
1185
|
-
? s.
|
|
1186
|
-
s.
|
|
1187
|
-
s.
|
|
1414
|
+
return s.We
|
|
1415
|
+
? s.We(e, () => {
|
|
1416
|
+
s.Qe?.();
|
|
1417
|
+
s.Qe = undefined;
|
|
1188
1418
|
})
|
|
1189
1419
|
: console.error(e);
|
|
1190
1420
|
} catch (t) {
|
|
1191
1421
|
e = t;
|
|
1192
1422
|
}
|
|
1193
1423
|
}
|
|
1194
|
-
if (!s.
|
|
1195
|
-
} else if (s.
|
|
1424
|
+
if (!s.Te.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1425
|
+
} else if (s.fe === EFFECT_RENDER) s.Te.notify(s, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
1196
1426
|
};
|
|
1197
1427
|
recompute(s, true);
|
|
1198
|
-
!r?.defer && (s.
|
|
1428
|
+
!r?.defer && (s.fe === EFFECT_USER ? s.Te.enqueue(s.fe, runEffect.bind(s)) : runEffect.call(s));
|
|
1199
1429
|
o = true;
|
|
1200
|
-
onCleanup(() => s.
|
|
1430
|
+
onCleanup(() => s.Qe?.());
|
|
1201
1431
|
}
|
|
1202
1432
|
function runEffect() {
|
|
1203
|
-
if (!this.
|
|
1204
|
-
this.
|
|
1205
|
-
this.
|
|
1433
|
+
if (!this.Ee || this._ & REACTIVE_DISPOSED) return;
|
|
1434
|
+
this.Qe?.();
|
|
1435
|
+
this.Qe = undefined;
|
|
1206
1436
|
try {
|
|
1207
|
-
this.
|
|
1437
|
+
this.Qe = this.ke(this.Re, this.Ue);
|
|
1208
1438
|
} catch (e) {
|
|
1209
|
-
if (!this.
|
|
1439
|
+
if (!this.Te.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1210
1440
|
} finally {
|
|
1211
|
-
this.
|
|
1212
|
-
this.
|
|
1441
|
+
this.Ue = this.Re;
|
|
1442
|
+
this.Ee = false;
|
|
1213
1443
|
}
|
|
1214
1444
|
}
|
|
1215
1445
|
function trackedEffect(e, t) {
|
|
1216
1446
|
const run = () => {
|
|
1217
|
-
if (!n.
|
|
1218
|
-
n.
|
|
1447
|
+
if (!n.Ee || n._ & REACTIVE_DISPOSED) return;
|
|
1448
|
+
n.Ee = false;
|
|
1219
1449
|
recompute(n);
|
|
1220
1450
|
};
|
|
1221
1451
|
const n = computed(
|
|
1222
1452
|
() => {
|
|
1223
1453
|
try {
|
|
1224
|
-
n.
|
|
1225
|
-
n.
|
|
1226
|
-
n.
|
|
1454
|
+
n.Qe?.();
|
|
1455
|
+
n.Qe = undefined;
|
|
1456
|
+
n.Qe = staleValues(e) || undefined;
|
|
1227
1457
|
} finally {
|
|
1228
1458
|
}
|
|
1229
1459
|
},
|
|
1230
1460
|
undefined,
|
|
1231
1461
|
{ ...t, lazy: true, pureWrite: true }
|
|
1232
1462
|
);
|
|
1233
|
-
n.
|
|
1234
|
-
n.
|
|
1235
|
-
n.
|
|
1236
|
-
n.
|
|
1237
|
-
n.
|
|
1238
|
-
onCleanup(() => n.
|
|
1463
|
+
n.Qe = undefined;
|
|
1464
|
+
n.Ee = true;
|
|
1465
|
+
n.fe = EFFECT_TRACKED;
|
|
1466
|
+
n.de = run;
|
|
1467
|
+
n.Te.enqueue(EFFECT_USER, run);
|
|
1468
|
+
onCleanup(() => n.Qe?.());
|
|
1239
1469
|
}
|
|
1240
1470
|
function createSignal(e, t, n) {
|
|
1241
1471
|
if (typeof e === "function") {
|
|
@@ -1328,26 +1558,26 @@ function applyState(e, t, n, i) {
|
|
|
1328
1558
|
r[STORE_OVERRIDE] = undefined;
|
|
1329
1559
|
if (Array.isArray(o)) {
|
|
1330
1560
|
let t = false;
|
|
1331
|
-
const
|
|
1332
|
-
if (e.length &&
|
|
1333
|
-
let
|
|
1561
|
+
const c = getOverrideValue(o, s, u, "length");
|
|
1562
|
+
if (e.length && c && e[0] && n(e[0]) != null) {
|
|
1563
|
+
let l, a, f, E, T, d, R, O;
|
|
1334
1564
|
for (
|
|
1335
|
-
f = 0, E = Math.min(
|
|
1336
|
-
f < E && ((
|
|
1565
|
+
f = 0, E = Math.min(c, e.length);
|
|
1566
|
+
f < E && ((d = getOverrideValue(o, s, u, f)) === e[f] || (d && e[f] && n(d) === n(e[f])));
|
|
1337
1567
|
f++
|
|
1338
1568
|
) {
|
|
1339
|
-
applyState(e[f], wrap(
|
|
1569
|
+
applyState(e[f], wrap(d, r), n, i);
|
|
1340
1570
|
}
|
|
1341
1571
|
const S = new Array(e.length),
|
|
1342
1572
|
_ = new Map();
|
|
1343
1573
|
for (
|
|
1344
|
-
E =
|
|
1574
|
+
E = c - 1, T = e.length - 1;
|
|
1345
1575
|
E >= f &&
|
|
1346
1576
|
T >= f &&
|
|
1347
|
-
((
|
|
1577
|
+
((d = getOverrideValue(o, s, u, E)) === e[T] || (d && e[T] && n(d) === n(e[T])));
|
|
1348
1578
|
E--, T--
|
|
1349
1579
|
) {
|
|
1350
|
-
S[T] =
|
|
1580
|
+
S[T] = d;
|
|
1351
1581
|
}
|
|
1352
1582
|
if (f > T || f > E) {
|
|
1353
1583
|
for (a = f; a <= T; a++) {
|
|
@@ -1361,24 +1591,24 @@ function applyState(e, t, n, i) {
|
|
|
1361
1591
|
applyState(e[a], o, n, i);
|
|
1362
1592
|
}
|
|
1363
1593
|
t && r[STORE_NODE][$TRACK] && setSignal(r[STORE_NODE][$TRACK], void 0);
|
|
1364
|
-
|
|
1594
|
+
c !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
|
|
1365
1595
|
return;
|
|
1366
1596
|
}
|
|
1367
|
-
|
|
1597
|
+
R = new Array(T + 1);
|
|
1368
1598
|
for (a = T; a >= f; a--) {
|
|
1369
|
-
|
|
1370
|
-
O =
|
|
1371
|
-
|
|
1372
|
-
|
|
1599
|
+
d = e[a];
|
|
1600
|
+
O = d ? n(d) : d;
|
|
1601
|
+
l = _.get(O);
|
|
1602
|
+
R[a] = l === undefined ? -1 : l;
|
|
1373
1603
|
_.set(O, a);
|
|
1374
1604
|
}
|
|
1375
|
-
for (
|
|
1376
|
-
|
|
1377
|
-
O =
|
|
1605
|
+
for (l = f; l <= E; l++) {
|
|
1606
|
+
d = getOverrideValue(o, s, u, l);
|
|
1607
|
+
O = d ? n(d) : d;
|
|
1378
1608
|
a = _.get(O);
|
|
1379
1609
|
if (a !== undefined && a !== -1) {
|
|
1380
|
-
S[a] =
|
|
1381
|
-
a =
|
|
1610
|
+
S[a] = d;
|
|
1611
|
+
a = R[a];
|
|
1382
1612
|
_.set(O, a);
|
|
1383
1613
|
}
|
|
1384
1614
|
}
|
|
@@ -1391,14 +1621,14 @@ function applyState(e, t, n, i) {
|
|
|
1391
1621
|
}
|
|
1392
1622
|
if (f < e.length) t = true;
|
|
1393
1623
|
} else if (e.length) {
|
|
1394
|
-
for (let t = 0,
|
|
1395
|
-
const
|
|
1396
|
-
isWrappable(
|
|
1397
|
-
? applyState(e[t], wrap(
|
|
1624
|
+
for (let t = 0, c = e.length; t < c; t++) {
|
|
1625
|
+
const c = getOverrideValue(o, s, u, t);
|
|
1626
|
+
isWrappable(c)
|
|
1627
|
+
? applyState(e[t], wrap(c, r), n, i)
|
|
1398
1628
|
: r[STORE_NODE][t] && setSignal(r[STORE_NODE][t], e[t]);
|
|
1399
1629
|
}
|
|
1400
1630
|
}
|
|
1401
|
-
if (
|
|
1631
|
+
if (c !== e.length) {
|
|
1402
1632
|
t = true;
|
|
1403
1633
|
r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
|
|
1404
1634
|
}
|
|
@@ -1407,9 +1637,9 @@ function applyState(e, t, n, i) {
|
|
|
1407
1637
|
}
|
|
1408
1638
|
if (u) {
|
|
1409
1639
|
const t = u[$TRACK];
|
|
1410
|
-
const
|
|
1411
|
-
for (let
|
|
1412
|
-
const a = l
|
|
1640
|
+
const c = t || i ? getAllKeys(o, s, e) : Object.keys(u);
|
|
1641
|
+
for (let l = 0, a = c.length; l < a; l++) {
|
|
1642
|
+
const a = c[l];
|
|
1413
1643
|
const f = u[a];
|
|
1414
1644
|
const E = unwrap(getOverrideValue(o, s, u, a));
|
|
1415
1645
|
let T = unwrap(e[a]);
|
|
@@ -1469,7 +1699,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1469
1699
|
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(o);
|
|
1470
1700
|
});
|
|
1471
1701
|
});
|
|
1472
|
-
i.
|
|
1702
|
+
i.ve = true;
|
|
1473
1703
|
return { store: o, node: i };
|
|
1474
1704
|
}
|
|
1475
1705
|
function createProjection(e, t = {}, n) {
|
|
@@ -1569,7 +1799,7 @@ function getNode(e, t, n, i, r = isEqual, o) {
|
|
|
1569
1799
|
},
|
|
1570
1800
|
i
|
|
1571
1801
|
);
|
|
1572
|
-
if (o) s.
|
|
1802
|
+
if (o) s.Y = true;
|
|
1573
1803
|
return (e[t] = s);
|
|
1574
1804
|
}
|
|
1575
1805
|
function trackSelf(e, t = $TRACK) {
|
|
@@ -1612,39 +1842,39 @@ const storeTraps = {
|
|
|
1612
1842
|
const o = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
|
|
1613
1843
|
const s = o || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
|
|
1614
1844
|
const u = !!e[STORE_VALUE][$TARGET];
|
|
1615
|
-
const
|
|
1845
|
+
const c = o
|
|
1616
1846
|
? e[STORE_OPTIMISTIC_OVERRIDE]
|
|
1617
1847
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
1618
1848
|
? e[STORE_OVERRIDE]
|
|
1619
1849
|
: e[STORE_VALUE];
|
|
1620
1850
|
if (!r) {
|
|
1621
|
-
const e = Object.getOwnPropertyDescriptor(
|
|
1851
|
+
const e = Object.getOwnPropertyDescriptor(c, t);
|
|
1622
1852
|
if (e && e.get) return e.get.call(n);
|
|
1623
1853
|
}
|
|
1624
1854
|
if (writeOnly(n)) {
|
|
1625
|
-
let n = r && (s || !u) ? (r.
|
|
1855
|
+
let n = r && (s || !u) ? (r.B !== NOT_PENDING ? (r.Y ? r.Re : r.B) : r.Re) : c[t];
|
|
1626
1856
|
n === $DELETED && (n = undefined);
|
|
1627
1857
|
if (!isWrappable(n)) return n;
|
|
1628
1858
|
const i = wrap(n, e);
|
|
1629
1859
|
Writing?.add(i);
|
|
1630
1860
|
return i;
|
|
1631
1861
|
}
|
|
1632
|
-
let
|
|
1633
|
-
|
|
1862
|
+
let l = r ? (s || !u ? read(i[t]) : (read(i[t]), c[t])) : c[t];
|
|
1863
|
+
l === $DELETED && (l = undefined);
|
|
1634
1864
|
if (!r) {
|
|
1635
|
-
if (!s && typeof
|
|
1865
|
+
if (!s && typeof l === "function" && !c.hasOwnProperty(t)) {
|
|
1636
1866
|
let t;
|
|
1637
1867
|
return !Array.isArray(e[STORE_VALUE]) &&
|
|
1638
1868
|
(t = Object.getPrototypeOf(e[STORE_VALUE])) &&
|
|
1639
1869
|
t !== Object.prototype
|
|
1640
|
-
?
|
|
1641
|
-
:
|
|
1870
|
+
? l.bind(c)
|
|
1871
|
+
: l;
|
|
1642
1872
|
} else if (getObserver()) {
|
|
1643
1873
|
return read(
|
|
1644
1874
|
getNode(
|
|
1645
1875
|
i,
|
|
1646
1876
|
t,
|
|
1647
|
-
isWrappable(
|
|
1877
|
+
isWrappable(l) ? wrap(l, e) : l,
|
|
1648
1878
|
e[STORE_FIREWALL],
|
|
1649
1879
|
isEqual,
|
|
1650
1880
|
e[STORE_OPTIMISTIC]
|
|
@@ -1652,7 +1882,7 @@ const storeTraps = {
|
|
|
1652
1882
|
);
|
|
1653
1883
|
}
|
|
1654
1884
|
}
|
|
1655
|
-
return isWrappable(
|
|
1885
|
+
return isWrappable(l) ? wrap(l, e) : l;
|
|
1656
1886
|
},
|
|
1657
1887
|
has(e, t) {
|
|
1658
1888
|
if (t === $PROXY || t === $TRACK || t === "__proto__") return true;
|
|
@@ -1671,8 +1901,8 @@ const storeTraps = {
|
|
|
1671
1901
|
if (writeOnly(i)) {
|
|
1672
1902
|
if (e[STORE_OPTIMISTIC]) {
|
|
1673
1903
|
const t = e[STORE_FIREWALL];
|
|
1674
|
-
if (t
|
|
1675
|
-
globalQueue.initTransition(t
|
|
1904
|
+
if (t?.$) {
|
|
1905
|
+
globalQueue.initTransition(t.$);
|
|
1676
1906
|
}
|
|
1677
1907
|
}
|
|
1678
1908
|
untrack(() => {
|
|
@@ -1681,29 +1911,29 @@ const storeTraps = {
|
|
|
1681
1911
|
const s = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
1682
1912
|
const u = s ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
1683
1913
|
if (s) trackOptimisticStore(i);
|
|
1684
|
-
const
|
|
1914
|
+
const c =
|
|
1685
1915
|
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
1686
1916
|
? e[STORE_OPTIMISTIC_OVERRIDE][t]
|
|
1687
1917
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
1688
1918
|
? e[STORE_OVERRIDE][t]
|
|
1689
1919
|
: o;
|
|
1690
|
-
const
|
|
1691
|
-
if (
|
|
1920
|
+
const l = n?.[$TARGET]?.[STORE_VALUE] ?? n;
|
|
1921
|
+
if (c === l) return true;
|
|
1692
1922
|
const a = e[STORE_OPTIMISTIC_OVERRIDE]?.length || e[STORE_OVERRIDE]?.length || r.length;
|
|
1693
|
-
if (
|
|
1694
|
-
else (e[u] || (e[u] = Object.create(null)))[t] =
|
|
1695
|
-
const f = isWrappable(
|
|
1696
|
-
if (isWrappable(
|
|
1697
|
-
const e = PARENTS.get(
|
|
1698
|
-
e && (e instanceof Set ? e.delete(i) : PARENTS.delete(
|
|
1923
|
+
if (l !== undefined && l === o) delete e[u][t];
|
|
1924
|
+
else (e[u] || (e[u] = Object.create(null)))[t] = l;
|
|
1925
|
+
const f = isWrappable(l);
|
|
1926
|
+
if (isWrappable(c)) {
|
|
1927
|
+
const e = PARENTS.get(c);
|
|
1928
|
+
e && (e instanceof Set ? e.delete(i) : PARENTS.delete(c));
|
|
1699
1929
|
}
|
|
1700
|
-
if (recursivelyNotify(i, storeLookup) && f) recursivelyAddParent(
|
|
1930
|
+
if (recursivelyNotify(i, storeLookup) && f) recursivelyAddParent(l, i);
|
|
1701
1931
|
e[STORE_HAS]?.[t] && setSignal(e[STORE_HAS][t], true);
|
|
1702
1932
|
const E = getNodes(e, STORE_NODE);
|
|
1703
|
-
E[t] && setSignal(E[t], () => (f ? wrap(
|
|
1933
|
+
E[t] && setSignal(E[t], () => (f ? wrap(l, e) : l));
|
|
1704
1934
|
if (Array.isArray(r)) {
|
|
1705
1935
|
if (t === "length") {
|
|
1706
|
-
E.length && setSignal(E.length,
|
|
1936
|
+
E.length && setSignal(E.length, l);
|
|
1707
1937
|
} else {
|
|
1708
1938
|
const e = parseInt(t) + 1;
|
|
1709
1939
|
if (e > a) E.length && setSignal(E.length, e);
|
|
@@ -1861,7 +2091,7 @@ function deep(e) {
|
|
|
1861
2091
|
return e[$DEEP];
|
|
1862
2092
|
}
|
|
1863
2093
|
function createOptimisticStore(e, t, n) {
|
|
1864
|
-
GlobalQueue.
|
|
2094
|
+
GlobalQueue.re ||= clearOptimisticStore;
|
|
1865
2095
|
const i = typeof e === "function";
|
|
1866
2096
|
const r = (i ? t : e) ?? {};
|
|
1867
2097
|
const o = i ? e : undefined;
|
|
@@ -1873,16 +2103,25 @@ function clearOptimisticStore(e) {
|
|
|
1873
2103
|
if (!t || !t[STORE_OPTIMISTIC_OVERRIDE]) return;
|
|
1874
2104
|
const n = t[STORE_OPTIMISTIC_OVERRIDE];
|
|
1875
2105
|
const i = t[STORE_NODE];
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
2106
|
+
setProjectionWriteActive(true);
|
|
2107
|
+
try {
|
|
2108
|
+
if (i) {
|
|
2109
|
+
for (const e of Reflect.ownKeys(n)) {
|
|
2110
|
+
if (i[e]) {
|
|
2111
|
+
i[e].W = undefined;
|
|
2112
|
+
const n =
|
|
2113
|
+
t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
|
|
2114
|
+
const r = n === $DELETED ? undefined : n;
|
|
2115
|
+
setSignal(i[e], isWrappable(r) ? wrap(r, t) : r);
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
if (i[$TRACK]) {
|
|
2119
|
+
i[$TRACK].W = undefined;
|
|
2120
|
+
setSignal(i[$TRACK], undefined);
|
|
1883
2121
|
}
|
|
1884
2122
|
}
|
|
1885
|
-
|
|
2123
|
+
} finally {
|
|
2124
|
+
setProjectionWriteActive(false);
|
|
1886
2125
|
}
|
|
1887
2126
|
delete t[STORE_OPTIMISTIC_OVERRIDE];
|
|
1888
2127
|
}
|
|
@@ -1928,12 +2167,12 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
1928
2167
|
setProjectionWriteActive(false);
|
|
1929
2168
|
}
|
|
1930
2169
|
});
|
|
1931
|
-
i.
|
|
2170
|
+
i.ve = true;
|
|
1932
2171
|
}
|
|
1933
2172
|
return { store: o, node: i };
|
|
1934
2173
|
}
|
|
1935
2174
|
function snapshot(e, t, n) {
|
|
1936
|
-
let i, r, o, s, u,
|
|
2175
|
+
let i, r, o, s, u, c;
|
|
1937
2176
|
if (!isWrappable(e)) return e;
|
|
1938
2177
|
if (t && t.has(e)) return t.get(e);
|
|
1939
2178
|
if (!t) t = new Map();
|
|
@@ -1953,26 +2192,26 @@ function snapshot(e, t, n) {
|
|
|
1953
2192
|
if (r) {
|
|
1954
2193
|
const i = o?.length || e.length;
|
|
1955
2194
|
for (let r = 0; r < i; r++) {
|
|
1956
|
-
|
|
1957
|
-
if (
|
|
1958
|
-
if ((u = snapshot(
|
|
2195
|
+
c = o && r in o ? o[r] : e[r];
|
|
2196
|
+
if (c === $DELETED) continue;
|
|
2197
|
+
if ((u = snapshot(c, t, n)) !== c || s) {
|
|
1959
2198
|
if (!s) t.set(e, (s = [...e]));
|
|
1960
2199
|
s[r] = u;
|
|
1961
2200
|
}
|
|
1962
2201
|
}
|
|
1963
2202
|
} else {
|
|
1964
2203
|
const i = getKeys(e, o);
|
|
1965
|
-
for (let r = 0,
|
|
1966
|
-
let
|
|
1967
|
-
const a = getPropertyDescriptor(e, o,
|
|
2204
|
+
for (let r = 0, l = i.length; r < l; r++) {
|
|
2205
|
+
let l = i[r];
|
|
2206
|
+
const a = getPropertyDescriptor(e, o, l);
|
|
1968
2207
|
if (a.get) continue;
|
|
1969
|
-
|
|
1970
|
-
if ((u = snapshot(
|
|
2208
|
+
c = o && l in o ? o[l] : e[l];
|
|
2209
|
+
if ((u = snapshot(c, t, n)) !== e[l] || s) {
|
|
1971
2210
|
if (!s) {
|
|
1972
2211
|
s = Object.create(Object.getPrototypeOf(e));
|
|
1973
2212
|
Object.assign(s, e);
|
|
1974
2213
|
}
|
|
1975
|
-
s[
|
|
2214
|
+
s[l] = u;
|
|
1976
2215
|
}
|
|
1977
2216
|
}
|
|
1978
2217
|
}
|
|
@@ -2112,281 +2351,289 @@ function mapArray(e, t, n) {
|
|
|
2112
2351
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2113
2352
|
return createMemo(
|
|
2114
2353
|
updateKeyedMap.bind({
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2354
|
+
xe: createOwner(),
|
|
2355
|
+
Ge: 0,
|
|
2356
|
+
Me: e,
|
|
2357
|
+
Fe: [],
|
|
2358
|
+
$e: t,
|
|
2359
|
+
He: [],
|
|
2360
|
+
je: [],
|
|
2361
|
+
Ke: i,
|
|
2362
|
+
Ye: i || n?.keyed === false ? [] : undefined,
|
|
2363
|
+
Be: t.length > 1 ? [] : undefined,
|
|
2364
|
+
Xe: n?.fallback
|
|
2126
2365
|
})
|
|
2127
2366
|
);
|
|
2128
2367
|
}
|
|
2129
2368
|
const pureOptions = { pureWrite: true };
|
|
2130
2369
|
function updateKeyedMap() {
|
|
2131
|
-
const e = this.
|
|
2370
|
+
const e = this.Me() || [],
|
|
2132
2371
|
t = e.length;
|
|
2133
2372
|
e[$TRACK];
|
|
2134
|
-
runWithOwner(this.
|
|
2373
|
+
runWithOwner(this.xe, () => {
|
|
2135
2374
|
let n,
|
|
2136
2375
|
i,
|
|
2137
|
-
r = this.
|
|
2376
|
+
r = this.Ye
|
|
2138
2377
|
? () => {
|
|
2139
|
-
this.
|
|
2140
|
-
this.
|
|
2141
|
-
return this
|
|
2142
|
-
read.bind(null, this.
|
|
2143
|
-
this.
|
|
2378
|
+
this.Ye[i] = signal(e[i], pureOptions);
|
|
2379
|
+
this.Be && (this.Be[i] = signal(i, pureOptions));
|
|
2380
|
+
return this.$e(
|
|
2381
|
+
read.bind(null, this.Ye[i]),
|
|
2382
|
+
this.Be ? read.bind(null, this.Be[i]) : undefined
|
|
2144
2383
|
);
|
|
2145
2384
|
}
|
|
2146
|
-
: this.
|
|
2385
|
+
: this.Be
|
|
2147
2386
|
? () => {
|
|
2148
2387
|
const t = e[i];
|
|
2149
|
-
this.
|
|
2150
|
-
return this
|
|
2388
|
+
this.Be[i] = signal(i, pureOptions);
|
|
2389
|
+
return this.$e(() => t, read.bind(null, this.Be[i]));
|
|
2151
2390
|
}
|
|
2152
2391
|
: () => {
|
|
2153
2392
|
const t = e[i];
|
|
2154
|
-
return this
|
|
2393
|
+
return this.$e(() => t);
|
|
2155
2394
|
};
|
|
2156
2395
|
if (t === 0) {
|
|
2157
|
-
if (this.
|
|
2158
|
-
this.
|
|
2159
|
-
this.
|
|
2160
|
-
this.
|
|
2161
|
-
this.
|
|
2162
|
-
this.
|
|
2163
|
-
this.
|
|
2164
|
-
this.
|
|
2165
|
-
}
|
|
2166
|
-
if (this.
|
|
2167
|
-
this.
|
|
2168
|
-
}
|
|
2169
|
-
} else if (this.
|
|
2170
|
-
if (this.
|
|
2171
|
-
this.
|
|
2396
|
+
if (this.Ge !== 0) {
|
|
2397
|
+
this.xe.dispose(false);
|
|
2398
|
+
this.je = [];
|
|
2399
|
+
this.Fe = [];
|
|
2400
|
+
this.He = [];
|
|
2401
|
+
this.Ge = 0;
|
|
2402
|
+
this.Ye && (this.Ye = []);
|
|
2403
|
+
this.Be && (this.Be = []);
|
|
2404
|
+
}
|
|
2405
|
+
if (this.Xe && !this.He[0]) {
|
|
2406
|
+
this.He[0] = runWithOwner((this.je[0] = createOwner()), this.Xe);
|
|
2407
|
+
}
|
|
2408
|
+
} else if (this.Ge === 0) {
|
|
2409
|
+
if (this.je[0]) this.je[0].dispose();
|
|
2410
|
+
this.He = new Array(t);
|
|
2172
2411
|
for (i = 0; i < t; i++) {
|
|
2173
|
-
this.
|
|
2174
|
-
this.
|
|
2412
|
+
this.Fe[i] = e[i];
|
|
2413
|
+
this.He[i] = runWithOwner((this.je[i] = createOwner()), r);
|
|
2175
2414
|
}
|
|
2176
|
-
this.
|
|
2415
|
+
this.Ge = t;
|
|
2177
2416
|
} else {
|
|
2178
2417
|
let o,
|
|
2179
2418
|
s,
|
|
2180
2419
|
u,
|
|
2181
|
-
l,
|
|
2182
2420
|
c,
|
|
2421
|
+
l,
|
|
2183
2422
|
a,
|
|
2184
2423
|
f,
|
|
2185
2424
|
E = new Array(t),
|
|
2186
2425
|
T = new Array(t),
|
|
2187
|
-
|
|
2188
|
-
|
|
2426
|
+
d = this.Ye ? new Array(t) : undefined,
|
|
2427
|
+
R = this.Be ? new Array(t) : undefined;
|
|
2189
2428
|
for (
|
|
2190
|
-
o = 0, s = Math.min(this.
|
|
2191
|
-
o < s && (this.
|
|
2429
|
+
o = 0, s = Math.min(this.Ge, t);
|
|
2430
|
+
o < s && (this.Fe[o] === e[o] || (this.Ye && compare(this.Ke, this.Fe[o], e[o])));
|
|
2192
2431
|
o++
|
|
2193
2432
|
) {
|
|
2194
|
-
if (this.
|
|
2433
|
+
if (this.Ye) setSignal(this.Ye[o], e[o]);
|
|
2195
2434
|
}
|
|
2196
2435
|
for (
|
|
2197
|
-
s = this.
|
|
2436
|
+
s = this.Ge - 1, u = t - 1;
|
|
2198
2437
|
s >= o &&
|
|
2199
2438
|
u >= o &&
|
|
2200
|
-
(this.
|
|
2439
|
+
(this.Fe[s] === e[u] || (this.Ye && compare(this.Ke, this.Fe[s], e[u])));
|
|
2201
2440
|
s--, u--
|
|
2202
2441
|
) {
|
|
2203
|
-
E[u] = this.
|
|
2204
|
-
T[u] = this.
|
|
2205
|
-
|
|
2206
|
-
|
|
2442
|
+
E[u] = this.He[s];
|
|
2443
|
+
T[u] = this.je[s];
|
|
2444
|
+
d && (d[u] = this.Ye[s]);
|
|
2445
|
+
R && (R[u] = this.Be[s]);
|
|
2207
2446
|
}
|
|
2208
2447
|
a = new Map();
|
|
2209
2448
|
f = new Array(u + 1);
|
|
2210
2449
|
for (i = u; i >= o; i--) {
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
n = a.get(
|
|
2450
|
+
c = e[i];
|
|
2451
|
+
l = this.Ke ? this.Ke(c) : c;
|
|
2452
|
+
n = a.get(l);
|
|
2214
2453
|
f[i] = n === undefined ? -1 : n;
|
|
2215
|
-
a.set(
|
|
2454
|
+
a.set(l, i);
|
|
2216
2455
|
}
|
|
2217
2456
|
for (n = o; n <= s; n++) {
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
i = a.get(
|
|
2457
|
+
c = this.Fe[n];
|
|
2458
|
+
l = this.Ke ? this.Ke(c) : c;
|
|
2459
|
+
i = a.get(l);
|
|
2221
2460
|
if (i !== undefined && i !== -1) {
|
|
2222
|
-
E[i] = this.
|
|
2223
|
-
T[i] = this.
|
|
2224
|
-
|
|
2225
|
-
|
|
2461
|
+
E[i] = this.He[n];
|
|
2462
|
+
T[i] = this.je[n];
|
|
2463
|
+
d && (d[i] = this.Ye[n]);
|
|
2464
|
+
R && (R[i] = this.Be[n]);
|
|
2226
2465
|
i = f[i];
|
|
2227
|
-
a.set(
|
|
2228
|
-
} else this.
|
|
2466
|
+
a.set(l, i);
|
|
2467
|
+
} else this.je[n].dispose();
|
|
2229
2468
|
}
|
|
2230
2469
|
for (i = o; i < t; i++) {
|
|
2231
2470
|
if (i in E) {
|
|
2232
|
-
this.
|
|
2233
|
-
this.
|
|
2234
|
-
if (R) {
|
|
2235
|
-
this.We[i] = R[i];
|
|
2236
|
-
setSignal(this.We[i], e[i]);
|
|
2237
|
-
}
|
|
2471
|
+
this.He[i] = E[i];
|
|
2472
|
+
this.je[i] = T[i];
|
|
2238
2473
|
if (d) {
|
|
2239
|
-
this.
|
|
2240
|
-
setSignal(this.
|
|
2474
|
+
this.Ye[i] = d[i];
|
|
2475
|
+
setSignal(this.Ye[i], e[i]);
|
|
2476
|
+
}
|
|
2477
|
+
if (R) {
|
|
2478
|
+
this.Be[i] = R[i];
|
|
2479
|
+
setSignal(this.Be[i], i);
|
|
2241
2480
|
}
|
|
2242
2481
|
} else {
|
|
2243
|
-
this.
|
|
2482
|
+
this.He[i] = runWithOwner((this.je[i] = createOwner()), r);
|
|
2244
2483
|
}
|
|
2245
2484
|
}
|
|
2246
|
-
this.
|
|
2247
|
-
this.
|
|
2485
|
+
this.He = this.He.slice(0, (this.Ge = t));
|
|
2486
|
+
this.Fe = e.slice(0);
|
|
2248
2487
|
}
|
|
2249
2488
|
});
|
|
2250
|
-
return this.
|
|
2489
|
+
return this.He;
|
|
2251
2490
|
}
|
|
2252
2491
|
function repeat(e, t, n) {
|
|
2253
2492
|
return updateRepeat.bind({
|
|
2254
|
-
|
|
2255
|
-
we: 0,
|
|
2493
|
+
xe: createOwner(),
|
|
2256
2494
|
Ge: 0,
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2495
|
+
qe: 0,
|
|
2496
|
+
ze: e,
|
|
2497
|
+
$e: t,
|
|
2498
|
+
je: [],
|
|
2499
|
+
He: [],
|
|
2500
|
+
Ze: n?.from,
|
|
2501
|
+
Xe: n?.fallback
|
|
2263
2502
|
});
|
|
2264
2503
|
}
|
|
2265
2504
|
function updateRepeat() {
|
|
2266
|
-
const e = this.
|
|
2267
|
-
const t = this
|
|
2268
|
-
runWithOwner(this.
|
|
2505
|
+
const e = this.ze();
|
|
2506
|
+
const t = this.Ze?.() || 0;
|
|
2507
|
+
runWithOwner(this.xe, () => {
|
|
2269
2508
|
if (e === 0) {
|
|
2270
|
-
if (this.
|
|
2271
|
-
this.
|
|
2272
|
-
this.
|
|
2273
|
-
this.
|
|
2274
|
-
this.
|
|
2509
|
+
if (this.Ge !== 0) {
|
|
2510
|
+
this.xe.dispose(false);
|
|
2511
|
+
this.je = [];
|
|
2512
|
+
this.He = [];
|
|
2513
|
+
this.Ge = 0;
|
|
2275
2514
|
}
|
|
2276
|
-
if (this.
|
|
2277
|
-
this.
|
|
2515
|
+
if (this.Xe && !this.He[0]) {
|
|
2516
|
+
this.He[0] = runWithOwner((this.je[0] = createOwner()), this.Xe);
|
|
2278
2517
|
}
|
|
2279
2518
|
return;
|
|
2280
2519
|
}
|
|
2281
2520
|
const n = t + e;
|
|
2282
|
-
const i = this.
|
|
2283
|
-
if (this.
|
|
2284
|
-
for (let e = n; e < i; e++) this.
|
|
2285
|
-
if (this.
|
|
2286
|
-
let e = this.
|
|
2287
|
-
while (e < t && e < this.
|
|
2288
|
-
this.
|
|
2289
|
-
this.
|
|
2290
|
-
} else if (this.
|
|
2291
|
-
let n = i - this.
|
|
2292
|
-
let r = this.
|
|
2293
|
-
this.
|
|
2521
|
+
const i = this.qe + this.Ge;
|
|
2522
|
+
if (this.Ge === 0 && this.je[0]) this.je[0].dispose();
|
|
2523
|
+
for (let e = n; e < i; e++) this.je[e - this.qe].dispose();
|
|
2524
|
+
if (this.qe < t) {
|
|
2525
|
+
let e = this.qe;
|
|
2526
|
+
while (e < t && e < this.Ge) this.je[e++].dispose();
|
|
2527
|
+
this.je.splice(0, t - this.qe);
|
|
2528
|
+
this.He.splice(0, t - this.qe);
|
|
2529
|
+
} else if (this.qe > t) {
|
|
2530
|
+
let n = i - this.qe - 1;
|
|
2531
|
+
let r = this.qe - t;
|
|
2532
|
+
this.je.length = this.He.length = e;
|
|
2294
2533
|
while (n >= r) {
|
|
2295
|
-
this.
|
|
2296
|
-
this.
|
|
2534
|
+
this.je[n] = this.je[n - r];
|
|
2535
|
+
this.He[n] = this.He[n - r];
|
|
2297
2536
|
n--;
|
|
2298
2537
|
}
|
|
2299
2538
|
for (let e = 0; e < r; e++) {
|
|
2300
|
-
this.
|
|
2539
|
+
this.He[e] = runWithOwner((this.je[e] = createOwner()), () => this.$e(e + t));
|
|
2301
2540
|
}
|
|
2302
2541
|
}
|
|
2303
2542
|
for (let e = i; e < n; e++) {
|
|
2304
|
-
this.
|
|
2543
|
+
this.He[e - t] = runWithOwner((this.je[e - t] = createOwner()), () => this.$e(e));
|
|
2305
2544
|
}
|
|
2306
|
-
this.
|
|
2307
|
-
this.
|
|
2308
|
-
this.
|
|
2545
|
+
this.He = this.He.slice(0, e);
|
|
2546
|
+
this.qe = t;
|
|
2547
|
+
this.Ge = e;
|
|
2309
2548
|
});
|
|
2310
|
-
return this.
|
|
2549
|
+
return this.He;
|
|
2311
2550
|
}
|
|
2312
2551
|
function compare(e, t, n) {
|
|
2313
2552
|
return e ? e(t) === e(n) : true;
|
|
2314
2553
|
}
|
|
2315
2554
|
function boundaryComputed(e, t) {
|
|
2316
2555
|
const n = computed(e, undefined, { lazy: true });
|
|
2317
|
-
n.
|
|
2318
|
-
const
|
|
2319
|
-
|
|
2320
|
-
n.
|
|
2556
|
+
n.Pe = (e, t) => {
|
|
2557
|
+
const i = e !== undefined ? e : n.Oe;
|
|
2558
|
+
const r = t !== undefined ? t : n.se;
|
|
2559
|
+
n.Oe &= ~n.Je;
|
|
2560
|
+
n.Te.notify(n, n.Je, i, r);
|
|
2321
2561
|
};
|
|
2322
|
-
n.
|
|
2323
|
-
n.
|
|
2562
|
+
n.Je = t;
|
|
2563
|
+
n.ve = true;
|
|
2324
2564
|
recompute(n, true);
|
|
2325
2565
|
return n;
|
|
2326
2566
|
}
|
|
2327
2567
|
function createBoundChildren(e, t, n, i) {
|
|
2328
|
-
const r = e.
|
|
2329
|
-
r.addChild((e.
|
|
2330
|
-
onCleanup(() => r.removeChild(e.
|
|
2568
|
+
const r = e.Te;
|
|
2569
|
+
r.addChild((e.Te = n));
|
|
2570
|
+
onCleanup(() => r.removeChild(e.Te));
|
|
2331
2571
|
return runWithOwner(e, () => {
|
|
2332
2572
|
const e = computed(t);
|
|
2333
2573
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
2334
2574
|
});
|
|
2335
2575
|
}
|
|
2336
2576
|
class ConditionalQueue extends Queue {
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2577
|
+
et;
|
|
2578
|
+
tt = new Set();
|
|
2579
|
+
J = new Set();
|
|
2340
2580
|
constructor(e) {
|
|
2341
2581
|
super();
|
|
2342
|
-
this.
|
|
2582
|
+
this.et = e;
|
|
2343
2583
|
}
|
|
2344
2584
|
run(e) {
|
|
2345
|
-
if (!e || read(this.
|
|
2585
|
+
if (!e || read(this.et)) return;
|
|
2346
2586
|
return super.run(e);
|
|
2347
2587
|
}
|
|
2348
|
-
notify(e, t, n) {
|
|
2349
|
-
if (read(this.
|
|
2588
|
+
notify(e, t, n, i) {
|
|
2589
|
+
if (read(this.et)) {
|
|
2350
2590
|
if (t & STATUS_PENDING) {
|
|
2351
2591
|
if (n & STATUS_PENDING) {
|
|
2352
|
-
this.
|
|
2592
|
+
this.J.add(e);
|
|
2353
2593
|
t &= ~STATUS_PENDING;
|
|
2354
|
-
} else if (this.
|
|
2594
|
+
} else if (this.J.delete(e)) t &= ~STATUS_PENDING;
|
|
2355
2595
|
}
|
|
2356
2596
|
if (t & STATUS_ERROR) {
|
|
2357
2597
|
if (n & STATUS_ERROR) {
|
|
2358
|
-
this.
|
|
2598
|
+
this.tt.add(e);
|
|
2359
2599
|
t &= ~STATUS_ERROR;
|
|
2360
|
-
} else if (this.
|
|
2600
|
+
} else if (this.tt.delete(e)) t &= ~STATUS_ERROR;
|
|
2361
2601
|
}
|
|
2362
2602
|
}
|
|
2363
|
-
return t ? super.notify(e, t, n) : true;
|
|
2603
|
+
return t ? super.notify(e, t, n, i ?? e.se) : true;
|
|
2364
2604
|
}
|
|
2365
2605
|
}
|
|
2366
2606
|
class CollectionQueue extends Queue {
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2607
|
+
nt;
|
|
2608
|
+
it = new Set();
|
|
2609
|
+
et = signal(false, { pureWrite: true });
|
|
2610
|
+
rt = false;
|
|
2371
2611
|
constructor(e) {
|
|
2372
2612
|
super();
|
|
2373
|
-
this.
|
|
2613
|
+
this.nt = e;
|
|
2374
2614
|
}
|
|
2375
2615
|
run(e) {
|
|
2376
|
-
if (!e || read(this.
|
|
2616
|
+
if (!e || read(this.et)) return;
|
|
2377
2617
|
return super.run(e);
|
|
2378
2618
|
}
|
|
2379
|
-
notify(e, t, n) {
|
|
2380
|
-
if (!(t & this.
|
|
2381
|
-
if (n & this.
|
|
2382
|
-
|
|
2383
|
-
if (
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2619
|
+
notify(e, t, n, i) {
|
|
2620
|
+
if (!(t & this.nt) || (this.nt & STATUS_PENDING && this.rt)) return super.notify(e, t, n, i);
|
|
2621
|
+
if (n & this.nt) {
|
|
2622
|
+
const t = i?.t || e.se?.t;
|
|
2623
|
+
if (t) {
|
|
2624
|
+
const e = this.it.size === 0;
|
|
2625
|
+
this.it.add(t);
|
|
2626
|
+
if (e) setSignal(this.et, true);
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
t &= ~this.nt;
|
|
2630
|
+
return t ? super.notify(e, t, n, i) : true;
|
|
2631
|
+
}
|
|
2632
|
+
checkSources() {
|
|
2633
|
+
for (const e of this.it) {
|
|
2634
|
+
if (!(e.Oe & this.nt)) this.it.delete(e);
|
|
2387
2635
|
}
|
|
2388
|
-
|
|
2389
|
-
return t ? super.notify(e, t, n) : true;
|
|
2636
|
+
if (!this.it.size) setSignal(this.et, false);
|
|
2390
2637
|
}
|
|
2391
2638
|
}
|
|
2392
2639
|
var BoundaryMode;
|
|
@@ -2399,26 +2646,26 @@ function createBoundary(e, t) {
|
|
|
2399
2646
|
const i = new ConditionalQueue(computed(() => t() === BoundaryMode.HIDDEN));
|
|
2400
2647
|
const r = createBoundChildren(n, e, i, 0);
|
|
2401
2648
|
computed(() => {
|
|
2402
|
-
const e = read(i.
|
|
2403
|
-
r.
|
|
2649
|
+
const e = read(i.et);
|
|
2650
|
+
r.Je = e ? STATUS_ERROR | STATUS_PENDING : 0;
|
|
2404
2651
|
if (!e) {
|
|
2405
|
-
i.
|
|
2406
|
-
i.
|
|
2407
|
-
i.
|
|
2408
|
-
i.
|
|
2652
|
+
i.J.forEach(e => i.notify(e, STATUS_PENDING, STATUS_PENDING, e.se));
|
|
2653
|
+
i.tt.forEach(e => i.notify(e, STATUS_ERROR, STATUS_ERROR, e.se));
|
|
2654
|
+
i.J.clear();
|
|
2655
|
+
i.tt.clear();
|
|
2409
2656
|
}
|
|
2410
2657
|
});
|
|
2411
|
-
return () => (read(i.
|
|
2658
|
+
return () => (read(i.et) ? undefined : read(r));
|
|
2412
2659
|
}
|
|
2413
2660
|
function createCollectionBoundary(e, t, n) {
|
|
2414
2661
|
const i = createOwner();
|
|
2415
2662
|
const r = new CollectionQueue(e);
|
|
2416
2663
|
const o = createBoundChildren(i, t, r, e);
|
|
2417
2664
|
const s = computed(() => {
|
|
2418
|
-
if (!read(r.
|
|
2665
|
+
if (!read(r.et)) {
|
|
2419
2666
|
const e = read(o);
|
|
2420
|
-
if (!untrack(() => read(r.
|
|
2421
|
-
r.
|
|
2667
|
+
if (!untrack(() => read(r.et))) {
|
|
2668
|
+
r.rt = true;
|
|
2422
2669
|
return e;
|
|
2423
2670
|
}
|
|
2424
2671
|
}
|
|
@@ -2429,26 +2676,12 @@ function createCollectionBoundary(e, t, n) {
|
|
|
2429
2676
|
function createLoadBoundary(e, t) {
|
|
2430
2677
|
return createCollectionBoundary(STATUS_PENDING, e, () => t());
|
|
2431
2678
|
}
|
|
2432
|
-
function collectErrorSources(e, t) {
|
|
2433
|
-
let n = true;
|
|
2434
|
-
let i = e.C;
|
|
2435
|
-
while (i !== null) {
|
|
2436
|
-
const e = i.V;
|
|
2437
|
-
if (e.C && e.ie & STATUS_ERROR) {
|
|
2438
|
-
n = false;
|
|
2439
|
-
collectErrorSources(e, t);
|
|
2440
|
-
}
|
|
2441
|
-
i = i.D;
|
|
2442
|
-
}
|
|
2443
|
-
n && t.push(e);
|
|
2444
|
-
}
|
|
2445
2679
|
function createErrorBoundary(e, t) {
|
|
2446
2680
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2447
|
-
let n = e.
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
for (const
|
|
2451
|
-
for (const e of t) recompute(e);
|
|
2681
|
+
let n = e.it.values().next().value;
|
|
2682
|
+
const i = n.se?.cause ?? n.se;
|
|
2683
|
+
return t(i, () => {
|
|
2684
|
+
for (const t of e.it) recompute(t);
|
|
2452
2685
|
schedule();
|
|
2453
2686
|
});
|
|
2454
2687
|
});
|