@solidjs/signals 0.9.9 → 0.9.11
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 +48 -13
- package/dist/node.cjs +568 -536
- package/dist/prod.js +587 -555
- package/dist/types/core/core.d.ts +1 -0
- package/dist/types/core/scheduler.d.ts +1 -0
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -102,8 +102,8 @@ function markNode(e, t = REACTIVE_DIRTY) {
|
|
|
102
102
|
for (let t = e.p; t !== null; t = t.h) {
|
|
103
103
|
markNode(t.A, REACTIVE_CHECK);
|
|
104
104
|
}
|
|
105
|
-
if (e.
|
|
106
|
-
for (let t = e.
|
|
105
|
+
if (e.N !== null) {
|
|
106
|
+
for (let t = e.N; t !== null; t = t.P) {
|
|
107
107
|
for (let e = t.p; e !== null; e = e.h) {
|
|
108
108
|
markNode(e.A, REACTIVE_CHECK);
|
|
109
109
|
}
|
|
@@ -112,12 +112,12 @@ function markNode(e, t = REACTIVE_DIRTY) {
|
|
|
112
112
|
}
|
|
113
113
|
function runHeap(e, t) {
|
|
114
114
|
e.I = false;
|
|
115
|
-
for (e.
|
|
116
|
-
let n = e.T[e.
|
|
115
|
+
for (e.C = 0; e.C <= e.S; e.C++) {
|
|
116
|
+
let n = e.T[e.C];
|
|
117
117
|
while (n !== undefined) {
|
|
118
118
|
if (n._ & REACTIVE_IN_HEAP) t(n);
|
|
119
119
|
else adjustHeight(n, e);
|
|
120
|
-
n = e.T[e.
|
|
120
|
+
n = e.T[e.C];
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
e.S = 0;
|
|
@@ -138,8 +138,8 @@ function adjustHeight(e, t) {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
const transitions = new Set();
|
|
141
|
-
const dirtyQueue = { T: new Array(2e3).fill(undefined), I: false,
|
|
142
|
-
const zombieQueue = { T: new Array(2e3).fill(undefined), I: false,
|
|
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 };
|
|
143
143
|
let clock = 0;
|
|
144
144
|
let activeTransition = null;
|
|
145
145
|
let scheduled = false;
|
|
@@ -155,64 +155,69 @@ function getOrCreateLane(e) {
|
|
|
155
155
|
if (t) {
|
|
156
156
|
return findLane(t);
|
|
157
157
|
}
|
|
158
|
-
|
|
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 };
|
|
159
161
|
signalLanes.set(e, t);
|
|
160
162
|
activeLanes.add(t);
|
|
161
|
-
e.
|
|
163
|
+
e.j = e.K || 0;
|
|
162
164
|
return t;
|
|
163
165
|
}
|
|
164
166
|
function findLane(e) {
|
|
165
|
-
while (e.
|
|
167
|
+
while (e.F) e = e.F;
|
|
166
168
|
return e;
|
|
167
169
|
}
|
|
168
170
|
function mergeLanes(e, t) {
|
|
169
171
|
e = findLane(e);
|
|
170
172
|
t = findLane(t);
|
|
171
173
|
if (e === t) return e;
|
|
172
|
-
t.
|
|
173
|
-
for (const n of t.
|
|
174
|
-
e.
|
|
175
|
-
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]);
|
|
176
178
|
return e;
|
|
177
179
|
}
|
|
178
180
|
function clearLaneEntry(e) {
|
|
179
181
|
signalLanes.delete(e);
|
|
180
182
|
}
|
|
181
183
|
function resolveLane(e) {
|
|
182
|
-
const t = e.
|
|
184
|
+
const t = e.W;
|
|
183
185
|
if (!t) return undefined;
|
|
184
186
|
const n = findLane(t);
|
|
185
187
|
if (activeLanes.has(n)) return n;
|
|
186
|
-
e.
|
|
188
|
+
e.W = undefined;
|
|
187
189
|
return undefined;
|
|
188
190
|
}
|
|
189
191
|
function hasActiveOverride(e) {
|
|
190
|
-
return !!(e.
|
|
192
|
+
return !!(e.Y && e.B !== NOT_PENDING);
|
|
191
193
|
}
|
|
192
194
|
function assignOrMergeLane(e, t) {
|
|
193
195
|
const n = findLane(t);
|
|
194
|
-
const i = e.
|
|
196
|
+
const i = e.W;
|
|
195
197
|
if (i) {
|
|
196
|
-
if (i.
|
|
197
|
-
e.
|
|
198
|
+
if (i.F) {
|
|
199
|
+
e.W = t;
|
|
198
200
|
return;
|
|
199
201
|
}
|
|
200
202
|
const r = findLane(i);
|
|
201
203
|
if (activeLanes.has(r)) {
|
|
202
204
|
if (r !== n && !hasActiveOverride(e)) {
|
|
203
|
-
|
|
205
|
+
if (n.H && findLane(n.H) === r) {
|
|
206
|
+
e.W = t;
|
|
207
|
+
} else if (r.H && findLane(r.H) === n);
|
|
208
|
+
else mergeLanes(n, r);
|
|
204
209
|
}
|
|
205
210
|
return;
|
|
206
211
|
}
|
|
207
212
|
}
|
|
208
|
-
e.
|
|
213
|
+
e.W = t;
|
|
209
214
|
}
|
|
210
215
|
function runLaneEffects(e) {
|
|
211
216
|
for (const t of activeLanes) {
|
|
212
|
-
if (t.
|
|
213
|
-
const n = t.
|
|
217
|
+
if (t.F || t.G.size > 0) continue;
|
|
218
|
+
const n = t.M[e - 1];
|
|
214
219
|
if (n.length) {
|
|
215
|
-
t.
|
|
220
|
+
t.M[e - 1] = [];
|
|
216
221
|
runQueue(n, e);
|
|
217
222
|
}
|
|
218
223
|
}
|
|
@@ -223,21 +228,21 @@ function setProjectionWriteActive(e) {
|
|
|
223
228
|
function schedule() {
|
|
224
229
|
if (scheduled) return;
|
|
225
230
|
scheduled = true;
|
|
226
|
-
if (!globalQueue.
|
|
231
|
+
if (!globalQueue.X) queueMicrotask(flush);
|
|
227
232
|
}
|
|
228
233
|
class Queue {
|
|
229
234
|
o = null;
|
|
230
|
-
|
|
231
|
-
|
|
235
|
+
q = [[], []];
|
|
236
|
+
Z = [];
|
|
232
237
|
created = clock;
|
|
233
238
|
addChild(e) {
|
|
234
|
-
this.
|
|
239
|
+
this.Z.push(e);
|
|
235
240
|
e.o = this;
|
|
236
241
|
}
|
|
237
242
|
removeChild(e) {
|
|
238
|
-
const t = this.
|
|
243
|
+
const t = this.Z.indexOf(e);
|
|
239
244
|
if (t >= 0) {
|
|
240
|
-
this.
|
|
245
|
+
this.Z.splice(t, 1);
|
|
241
246
|
e.o = null;
|
|
242
247
|
}
|
|
243
248
|
}
|
|
@@ -246,106 +251,106 @@ class Queue {
|
|
|
246
251
|
return false;
|
|
247
252
|
}
|
|
248
253
|
run(e) {
|
|
249
|
-
if (this.
|
|
250
|
-
const t = this.
|
|
251
|
-
this.
|
|
254
|
+
if (this.q[e - 1].length) {
|
|
255
|
+
const t = this.q[e - 1];
|
|
256
|
+
this.q[e - 1] = [];
|
|
252
257
|
runQueue(t, e);
|
|
253
258
|
}
|
|
254
|
-
for (let t = 0; t < this.
|
|
259
|
+
for (let t = 0; t < this.Z.length; t++) this.Z[t].run?.(e);
|
|
255
260
|
}
|
|
256
261
|
enqueue(e, t) {
|
|
257
262
|
if (e) {
|
|
258
263
|
if (currentOptimisticLane) {
|
|
259
264
|
const n = findLane(currentOptimisticLane);
|
|
260
|
-
n.
|
|
265
|
+
n.M[e - 1].push(t);
|
|
261
266
|
} else {
|
|
262
|
-
this.
|
|
267
|
+
this.q[e - 1].push(t);
|
|
263
268
|
}
|
|
264
269
|
}
|
|
265
270
|
schedule();
|
|
266
271
|
}
|
|
267
272
|
stashQueues(e) {
|
|
268
|
-
e.
|
|
269
|
-
e.
|
|
270
|
-
this.
|
|
271
|
-
for (let t = 0; t < this.
|
|
272
|
-
let n = this.
|
|
273
|
-
let i = e.
|
|
273
|
+
e.q[0].push(...this.q[0]);
|
|
274
|
+
e.q[1].push(...this.q[1]);
|
|
275
|
+
this.q = [[], []];
|
|
276
|
+
for (let t = 0; t < this.Z.length; t++) {
|
|
277
|
+
let n = this.Z[t];
|
|
278
|
+
let i = e.Z[t];
|
|
274
279
|
if (!i) {
|
|
275
|
-
i = {
|
|
276
|
-
e.
|
|
280
|
+
i = { q: [[], []], Z: [] };
|
|
281
|
+
e.Z[t] = i;
|
|
277
282
|
}
|
|
278
283
|
n.stashQueues(i);
|
|
279
284
|
}
|
|
280
285
|
}
|
|
281
286
|
restoreQueues(e) {
|
|
282
|
-
this.
|
|
283
|
-
this.
|
|
284
|
-
for (let t = 0; t < e.
|
|
285
|
-
const n = e.
|
|
286
|
-
let i = this.
|
|
287
|
+
this.q[0].push(...e.q[0]);
|
|
288
|
+
this.q[1].push(...e.q[1]);
|
|
289
|
+
for (let t = 0; t < e.Z.length; t++) {
|
|
290
|
+
const n = e.Z[t];
|
|
291
|
+
let i = this.Z[t];
|
|
287
292
|
if (i) i.restoreQueues(n);
|
|
288
293
|
}
|
|
289
294
|
}
|
|
290
295
|
}
|
|
291
296
|
class GlobalQueue extends Queue {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
static
|
|
297
|
-
static
|
|
298
|
-
static
|
|
297
|
+
X = false;
|
|
298
|
+
J = [];
|
|
299
|
+
ee = [];
|
|
300
|
+
te = new Set();
|
|
301
|
+
static ne;
|
|
302
|
+
static ie;
|
|
303
|
+
static re = null;
|
|
299
304
|
flush() {
|
|
300
|
-
if (this.
|
|
301
|
-
this.
|
|
305
|
+
if (this.X) return;
|
|
306
|
+
this.X = true;
|
|
302
307
|
try {
|
|
303
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
308
|
+
runHeap(dirtyQueue, GlobalQueue.ne);
|
|
304
309
|
if (activeTransition) {
|
|
305
310
|
const e = transitionComplete(activeTransition);
|
|
306
311
|
if (!e) {
|
|
307
312
|
let e = activeTransition;
|
|
308
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
309
|
-
this.
|
|
310
|
-
this.
|
|
311
|
-
this.
|
|
313
|
+
runHeap(zombieQueue, GlobalQueue.ne);
|
|
314
|
+
this.J = [];
|
|
315
|
+
this.ee = [];
|
|
316
|
+
this.te = new Set();
|
|
312
317
|
runLaneEffects(EFFECT_RENDER);
|
|
313
318
|
runLaneEffects(EFFECT_USER);
|
|
314
|
-
this.stashQueues(activeTransition.
|
|
319
|
+
this.stashQueues(activeTransition.oe);
|
|
315
320
|
clock++;
|
|
316
|
-
scheduled = dirtyQueue.S >= dirtyQueue.
|
|
317
|
-
reassignPendingTransition(activeTransition.
|
|
321
|
+
scheduled = dirtyQueue.S >= dirtyQueue.C;
|
|
322
|
+
reassignPendingTransition(activeTransition.J);
|
|
318
323
|
activeTransition = null;
|
|
319
324
|
finalizePureQueue(null, true);
|
|
320
325
|
return;
|
|
321
326
|
}
|
|
322
|
-
this.
|
|
323
|
-
this.restoreQueues(activeTransition.
|
|
327
|
+
this.J !== activeTransition.J && this.J.push(...activeTransition.J);
|
|
328
|
+
this.restoreQueues(activeTransition.oe);
|
|
324
329
|
transitions.delete(activeTransition);
|
|
325
330
|
const t = activeTransition;
|
|
326
331
|
activeTransition = null;
|
|
327
|
-
reassignPendingTransition(this.
|
|
332
|
+
reassignPendingTransition(this.J);
|
|
328
333
|
finalizePureQueue(t);
|
|
329
334
|
} else {
|
|
330
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
335
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.ne);
|
|
331
336
|
finalizePureQueue();
|
|
332
337
|
}
|
|
333
338
|
clock++;
|
|
334
|
-
scheduled = dirtyQueue.S >= dirtyQueue.
|
|
339
|
+
scheduled = dirtyQueue.S >= dirtyQueue.C;
|
|
335
340
|
runLaneEffects(EFFECT_RENDER);
|
|
336
341
|
this.run(EFFECT_RENDER);
|
|
337
342
|
runLaneEffects(EFFECT_USER);
|
|
338
343
|
this.run(EFFECT_USER);
|
|
339
344
|
} finally {
|
|
340
|
-
this.
|
|
345
|
+
this.X = false;
|
|
341
346
|
}
|
|
342
347
|
}
|
|
343
348
|
notify(e, t, n, i) {
|
|
344
349
|
if (t & STATUS_PENDING) {
|
|
345
350
|
if (n & STATUS_PENDING) {
|
|
346
|
-
const t = i !== undefined ? i : e.
|
|
347
|
-
if (activeTransition && t && !activeTransition.
|
|
348
|
-
activeTransition.
|
|
351
|
+
const t = i !== undefined ? i : e.se;
|
|
352
|
+
if (activeTransition && t && !activeTransition.ue.includes(t.t)) {
|
|
353
|
+
activeTransition.ue.push(t.t);
|
|
349
354
|
schedule();
|
|
350
355
|
}
|
|
351
356
|
}
|
|
@@ -356,143 +361,143 @@ class GlobalQueue extends Queue {
|
|
|
356
361
|
initTransition(e) {
|
|
357
362
|
if (e) e = currentTransition(e);
|
|
358
363
|
if (e && e === activeTransition) return;
|
|
359
|
-
if (!e && activeTransition && activeTransition.
|
|
364
|
+
if (!e && activeTransition && activeTransition.ce === clock) return;
|
|
360
365
|
if (!activeTransition) {
|
|
361
366
|
activeTransition = e ?? {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
oe: [],
|
|
365
|
-
Z: [],
|
|
366
|
-
J: new Set(),
|
|
367
|
+
ce: clock,
|
|
368
|
+
J: [],
|
|
367
369
|
ue: [],
|
|
368
|
-
|
|
369
|
-
|
|
370
|
+
ee: [],
|
|
371
|
+
te: new Set(),
|
|
372
|
+
le: [],
|
|
373
|
+
oe: { q: [[], []], Z: [] },
|
|
374
|
+
ae: false
|
|
370
375
|
};
|
|
371
376
|
} else if (e) {
|
|
372
377
|
const t = activeTransition;
|
|
373
|
-
t.
|
|
374
|
-
e.
|
|
378
|
+
t.ae = e;
|
|
379
|
+
e.le.push(...t.le);
|
|
375
380
|
for (const n of activeLanes) {
|
|
376
|
-
if (n
|
|
381
|
+
if (n.$ === t) n.$ = e;
|
|
377
382
|
}
|
|
378
|
-
e.
|
|
379
|
-
for (const n of t.
|
|
380
|
-
e.
|
|
383
|
+
e.ee.push(...t.ee);
|
|
384
|
+
for (const n of t.te) {
|
|
385
|
+
e.te.add(n);
|
|
381
386
|
}
|
|
382
387
|
transitions.delete(t);
|
|
383
388
|
activeTransition = e;
|
|
384
389
|
}
|
|
385
390
|
transitions.add(activeTransition);
|
|
386
|
-
activeTransition.
|
|
387
|
-
for (let e = 0; e < this.
|
|
388
|
-
const t = this.
|
|
389
|
-
t
|
|
390
|
-
activeTransition.
|
|
391
|
-
}
|
|
392
|
-
this.q = activeTransition.q;
|
|
393
|
-
for (let e = 0; e < this.Z.length; e++) {
|
|
394
|
-
const t = this.Z[e];
|
|
395
|
-
t.M = activeTransition;
|
|
396
|
-
activeTransition.Z.push(t);
|
|
397
|
-
}
|
|
398
|
-
this.Z = activeTransition.Z;
|
|
399
|
-
for (const e of activeLanes) {
|
|
400
|
-
if (!e.M) e.M = activeTransition;
|
|
391
|
+
activeTransition.ce = clock;
|
|
392
|
+
for (let e = 0; e < this.J.length; e++) {
|
|
393
|
+
const t = this.J[e];
|
|
394
|
+
t.$ = activeTransition;
|
|
395
|
+
activeTransition.J.push(t);
|
|
401
396
|
}
|
|
402
|
-
for (const e of this.J) activeTransition.J.add(e);
|
|
403
397
|
this.J = activeTransition.J;
|
|
398
|
+
for (let e = 0; e < this.ee.length; e++) {
|
|
399
|
+
const t = this.ee[e];
|
|
400
|
+
t.$ = activeTransition;
|
|
401
|
+
activeTransition.ee.push(t);
|
|
402
|
+
}
|
|
403
|
+
this.ee = activeTransition.ee;
|
|
404
|
+
for (const e of activeLanes) {
|
|
405
|
+
if (!e.$) e.$ = activeTransition;
|
|
406
|
+
}
|
|
407
|
+
for (const e of this.te) activeTransition.te.add(e);
|
|
408
|
+
this.te = activeTransition.te;
|
|
404
409
|
}
|
|
405
410
|
}
|
|
406
411
|
function insertSubs(e, t = false) {
|
|
407
|
-
const n = e.
|
|
412
|
+
const n = e.W || currentOptimisticLane;
|
|
408
413
|
for (let i = e.p; i !== null; i = i.h) {
|
|
409
414
|
if (t && n) {
|
|
410
415
|
i.A._ |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
411
416
|
assignOrMergeLane(i.A, n);
|
|
412
417
|
} else if (t) {
|
|
413
418
|
i.A._ |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
414
|
-
i.A.
|
|
419
|
+
i.A.W = undefined;
|
|
415
420
|
}
|
|
416
421
|
const e = i.A;
|
|
417
|
-
if (e.
|
|
418
|
-
if (!e.
|
|
419
|
-
e.
|
|
420
|
-
e.
|
|
422
|
+
if (e.fe === EFFECT_TRACKED) {
|
|
423
|
+
if (!e.Ee) {
|
|
424
|
+
e.Ee = true;
|
|
425
|
+
e.Te.enqueue(EFFECT_USER, e.de);
|
|
421
426
|
}
|
|
422
427
|
continue;
|
|
423
428
|
}
|
|
424
429
|
const r = i.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
425
|
-
if (r.
|
|
430
|
+
if (r.C > i.A.u) r.C = i.A.u;
|
|
426
431
|
insertIntoHeap(i.A, r);
|
|
427
432
|
}
|
|
428
433
|
}
|
|
429
434
|
function finalizePureQueue(e = null, t = false) {
|
|
430
435
|
let n = !t;
|
|
431
436
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
432
|
-
if (dirtyQueue.S >= dirtyQueue.
|
|
437
|
+
if (dirtyQueue.S >= dirtyQueue.C) runHeap(dirtyQueue, GlobalQueue.ne);
|
|
433
438
|
if (n) {
|
|
434
|
-
const t = globalQueue.
|
|
439
|
+
const t = globalQueue.J;
|
|
435
440
|
for (let e = 0; e < t.length; e++) {
|
|
436
441
|
const n = t[e];
|
|
437
|
-
if (n.
|
|
438
|
-
n.
|
|
439
|
-
n.
|
|
440
|
-
if (n.
|
|
442
|
+
if (n.B !== NOT_PENDING) {
|
|
443
|
+
n.Re = n.B;
|
|
444
|
+
n.B = NOT_PENDING;
|
|
445
|
+
if (n.fe && n.fe !== EFFECT_TRACKED) n.Ee = true;
|
|
441
446
|
}
|
|
442
|
-
n.
|
|
443
|
-
if (n.U) GlobalQueue.
|
|
447
|
+
n.Oe &= ~STATUS_UNINITIALIZED;
|
|
448
|
+
if (n.U) GlobalQueue.ie(n, false, true);
|
|
444
449
|
}
|
|
445
450
|
t.length = 0;
|
|
446
|
-
const n = e ? e.
|
|
451
|
+
const n = e ? e.ee : globalQueue.ee;
|
|
447
452
|
for (let e = 0; e < n.length; e++) {
|
|
448
453
|
const t = n[e];
|
|
449
|
-
const i = t.
|
|
450
|
-
t.
|
|
451
|
-
if (i !== NOT_PENDING && t.
|
|
452
|
-
t.
|
|
454
|
+
const i = t.B;
|
|
455
|
+
t.W = undefined;
|
|
456
|
+
if (i !== NOT_PENDING && t.Re !== i) {
|
|
457
|
+
t.Re = i;
|
|
453
458
|
insertSubs(t, true);
|
|
454
459
|
}
|
|
455
|
-
t.
|
|
456
|
-
t
|
|
460
|
+
t.B = NOT_PENDING;
|
|
461
|
+
t.$ = null;
|
|
457
462
|
}
|
|
458
463
|
n.length = 0;
|
|
459
|
-
const i = e ? e.
|
|
460
|
-
if (GlobalQueue.
|
|
464
|
+
const i = e ? e.te : globalQueue.te;
|
|
465
|
+
if (GlobalQueue.re && i.size) {
|
|
461
466
|
for (const e of i) {
|
|
462
|
-
GlobalQueue.
|
|
467
|
+
GlobalQueue.re(e);
|
|
463
468
|
}
|
|
464
469
|
i.clear();
|
|
465
470
|
schedule();
|
|
466
471
|
}
|
|
467
472
|
for (const t of activeLanes) {
|
|
468
|
-
const n = e ? t
|
|
473
|
+
const n = e ? t.$ === e : !t.$;
|
|
469
474
|
if (!n) continue;
|
|
470
|
-
if (!t.
|
|
471
|
-
if (t.
|
|
472
|
-
if (t.
|
|
473
|
-
}
|
|
474
|
-
if (t.t.
|
|
475
|
-
t.
|
|
476
|
-
t.
|
|
477
|
-
t.
|
|
475
|
+
if (!t.F) {
|
|
476
|
+
if (t.M[0].length) runQueue(t.M[0], EFFECT_RENDER);
|
|
477
|
+
if (t.M[1].length) runQueue(t.M[1], EFFECT_USER);
|
|
478
|
+
}
|
|
479
|
+
if (t.t.W === t) t.t.W = undefined;
|
|
480
|
+
t.G.clear();
|
|
481
|
+
t.M[0].length = 0;
|
|
482
|
+
t.M[1].length = 0;
|
|
478
483
|
activeLanes.delete(t);
|
|
479
484
|
signalLanes.delete(t.t);
|
|
480
485
|
}
|
|
481
486
|
}
|
|
482
487
|
}
|
|
483
488
|
function checkBoundaryChildren(e) {
|
|
484
|
-
for (const t of e.
|
|
489
|
+
for (const t of e.Z) {
|
|
485
490
|
t.checkSources?.();
|
|
486
491
|
checkBoundaryChildren(t);
|
|
487
492
|
}
|
|
488
493
|
}
|
|
489
494
|
function trackOptimisticStore(e) {
|
|
490
|
-
globalQueue.
|
|
495
|
+
globalQueue.te.add(e);
|
|
491
496
|
schedule();
|
|
492
497
|
}
|
|
493
498
|
function reassignPendingTransition(e) {
|
|
494
499
|
for (let t = 0; t < e.length; t++) {
|
|
495
|
-
e[t]
|
|
500
|
+
e[t].$ = activeTransition;
|
|
496
501
|
}
|
|
497
502
|
}
|
|
498
503
|
const globalQueue = new GlobalQueue();
|
|
@@ -505,20 +510,21 @@ function runQueue(e, t) {
|
|
|
505
510
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
506
511
|
}
|
|
507
512
|
function transitionComplete(e) {
|
|
508
|
-
if (e.
|
|
509
|
-
if (e.
|
|
513
|
+
if (e.ae) return true;
|
|
514
|
+
if (e.le.length) return false;
|
|
510
515
|
let t = true;
|
|
511
|
-
for (let n = 0; n < e.
|
|
512
|
-
|
|
516
|
+
for (let n = 0; n < e.ue.length; n++) {
|
|
517
|
+
const i = e.ue[n];
|
|
518
|
+
if (i.Oe & STATUS_PENDING && i.se?.t === i) {
|
|
513
519
|
t = false;
|
|
514
520
|
break;
|
|
515
521
|
}
|
|
516
522
|
}
|
|
517
|
-
t && (e.
|
|
523
|
+
t && (e.ae = true);
|
|
518
524
|
return t;
|
|
519
525
|
}
|
|
520
526
|
function currentTransition(e) {
|
|
521
|
-
while (e.
|
|
527
|
+
while (e.ae && typeof e.ae === "object") e = e.ae;
|
|
522
528
|
return e;
|
|
523
529
|
}
|
|
524
530
|
function runInTransition(e, t) {
|
|
@@ -542,11 +548,11 @@ function action(e) {
|
|
|
542
548
|
const r = e(...t);
|
|
543
549
|
globalQueue.initTransition();
|
|
544
550
|
let o = activeTransition;
|
|
545
|
-
o.
|
|
551
|
+
o.le.push(r);
|
|
546
552
|
const done = (e, t) => {
|
|
547
553
|
o = currentTransition(o);
|
|
548
|
-
const s = o.
|
|
549
|
-
if (s >= 0) o.
|
|
554
|
+
const s = o.le.indexOf(r);
|
|
555
|
+
if (s >= 0) o.le.splice(s, 1);
|
|
550
556
|
activeTransition = o;
|
|
551
557
|
schedule();
|
|
552
558
|
t ? i(t) : n(e);
|
|
@@ -574,8 +580,8 @@ function action(e) {
|
|
|
574
580
|
step();
|
|
575
581
|
});
|
|
576
582
|
}
|
|
577
|
-
GlobalQueue.
|
|
578
|
-
GlobalQueue.
|
|
583
|
+
GlobalQueue.ne = recompute;
|
|
584
|
+
GlobalQueue.ie = disposeChildren;
|
|
579
585
|
let tracking = false;
|
|
580
586
|
let stale = false;
|
|
581
587
|
let refreshing = false;
|
|
@@ -584,29 +590,29 @@ let foundPending = false;
|
|
|
584
590
|
let pendingReadActive = false;
|
|
585
591
|
let context = null;
|
|
586
592
|
function recompute(e, t = false) {
|
|
587
|
-
const n = e.
|
|
593
|
+
const n = e.fe;
|
|
588
594
|
if (!t) {
|
|
589
|
-
if (e
|
|
590
|
-
globalQueue.initTransition(e
|
|
595
|
+
if (e.$ && (!n || activeTransition) && activeTransition !== e.$)
|
|
596
|
+
globalQueue.initTransition(e.$);
|
|
591
597
|
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
592
|
-
if (e
|
|
598
|
+
if (e.$ || n === EFFECT_TRACKED) disposeChildren(e);
|
|
593
599
|
else {
|
|
594
600
|
markDisposal(e);
|
|
595
|
-
e.Re = e.Oe;
|
|
596
601
|
e.Se = e._e;
|
|
597
|
-
e.
|
|
602
|
+
e.Ie = e.pe;
|
|
598
603
|
e._e = null;
|
|
604
|
+
e.pe = null;
|
|
599
605
|
}
|
|
600
606
|
}
|
|
601
607
|
const i = !!(e._ & REACTIVE_OPTIMISTIC_DIRTY);
|
|
602
608
|
const r = hasActiveOverride(e);
|
|
603
|
-
const o = !!(e.
|
|
609
|
+
const o = !!(e.Oe & STATUS_PENDING);
|
|
604
610
|
const s = context;
|
|
605
611
|
context = e;
|
|
606
|
-
e.
|
|
612
|
+
e.he = null;
|
|
607
613
|
e._ = REACTIVE_RECOMPUTING_DEPS;
|
|
608
|
-
e.
|
|
609
|
-
let u = e.
|
|
614
|
+
e.ce = clock;
|
|
615
|
+
let u = e.B === NOT_PENDING ? e.Re : e.B;
|
|
610
616
|
let c = e.u;
|
|
611
617
|
let l = tracking;
|
|
612
618
|
let a = currentOptimisticLane;
|
|
@@ -619,13 +625,17 @@ function recompute(e, t = false) {
|
|
|
619
625
|
u = handleAsync(e, e.U(u));
|
|
620
626
|
clearStatus(e);
|
|
621
627
|
const t = resolveLane(e);
|
|
622
|
-
if (t)
|
|
628
|
+
if (t) {
|
|
629
|
+
t.G.delete(e);
|
|
630
|
+
updatePendingSignal(t.t);
|
|
631
|
+
}
|
|
623
632
|
} catch (t) {
|
|
624
633
|
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
625
634
|
const t = findLane(currentOptimisticLane);
|
|
626
635
|
if (t.t !== e) {
|
|
627
|
-
t.
|
|
628
|
-
e.
|
|
636
|
+
t.G.add(e);
|
|
637
|
+
e.W = t;
|
|
638
|
+
updatePendingSignal(t.t);
|
|
629
639
|
}
|
|
630
640
|
}
|
|
631
641
|
notifyStatus(
|
|
@@ -633,15 +643,15 @@ function recompute(e, t = false) {
|
|
|
633
643
|
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
634
644
|
t,
|
|
635
645
|
undefined,
|
|
636
|
-
t instanceof NotReadyError ? e.
|
|
646
|
+
t instanceof NotReadyError ? e.W : undefined
|
|
637
647
|
);
|
|
638
648
|
} finally {
|
|
639
649
|
tracking = l;
|
|
640
650
|
e._ = REACTIVE_NONE;
|
|
641
651
|
context = s;
|
|
642
652
|
}
|
|
643
|
-
if (!e.
|
|
644
|
-
const s = e.
|
|
653
|
+
if (!e.se) {
|
|
654
|
+
const s = e.he;
|
|
645
655
|
let l = s !== null ? s.m : e.D;
|
|
646
656
|
if (l !== null) {
|
|
647
657
|
do {
|
|
@@ -650,22 +660,22 @@ function recompute(e, t = false) {
|
|
|
650
660
|
if (s !== null) s.m = null;
|
|
651
661
|
else e.D = null;
|
|
652
662
|
}
|
|
653
|
-
const a = r ? e.
|
|
654
|
-
const f = !e.
|
|
663
|
+
const a = r ? e.Re : e.B === NOT_PENDING ? e.Re : e.B;
|
|
664
|
+
const f = !e.Ae || !e.Ae(a, u);
|
|
655
665
|
if (f) {
|
|
656
|
-
const s = r ? e.
|
|
657
|
-
if (t || (n && activeTransition !== e
|
|
658
|
-
else e.
|
|
666
|
+
const s = r ? e.Re : undefined;
|
|
667
|
+
if (t || (n && activeTransition !== e.$) || i) e.Re = u;
|
|
668
|
+
else e.B = u;
|
|
659
669
|
if (r && !i && o) {
|
|
660
|
-
const t = e
|
|
661
|
-
const n = e.
|
|
662
|
-
if (t <= n) e.
|
|
670
|
+
const t = e.K || 0;
|
|
671
|
+
const n = e.j || 0;
|
|
672
|
+
if (t <= n) e.Re = u;
|
|
663
673
|
}
|
|
664
|
-
if (!r || i || e.
|
|
674
|
+
if (!r || i || e.Re !== s) {
|
|
665
675
|
insertSubs(e, i || r);
|
|
666
676
|
}
|
|
667
677
|
} else if (r) {
|
|
668
|
-
e.
|
|
678
|
+
e.B = u;
|
|
669
679
|
} else if (e.u != c) {
|
|
670
680
|
for (let t = e.p; t !== null; t = t.h) {
|
|
671
681
|
insertIntoHeapHeight(t.A, t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
@@ -673,49 +683,49 @@ function recompute(e, t = false) {
|
|
|
673
683
|
}
|
|
674
684
|
}
|
|
675
685
|
setCurrentOptimisticLane(a);
|
|
676
|
-
(!t || e.
|
|
677
|
-
e
|
|
686
|
+
(!t || e.Oe & STATUS_PENDING) && !e.$ && !(activeTransition && e.Y) && globalQueue.J.push(e);
|
|
687
|
+
e.$ && n && activeTransition !== e.$ && runInTransition(e.$, () => recompute(e));
|
|
678
688
|
}
|
|
679
689
|
function handleAsync(e, t, n) {
|
|
680
690
|
const i = typeof t === "object" && t !== null;
|
|
681
691
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
682
692
|
const o = !r && i && untrack(() => typeof t.then === "function");
|
|
683
693
|
if (!o && !r) {
|
|
684
|
-
e.
|
|
694
|
+
e.ge = null;
|
|
685
695
|
return t;
|
|
686
696
|
}
|
|
687
|
-
e.
|
|
697
|
+
e.ge = t;
|
|
688
698
|
let s;
|
|
689
699
|
const handleError = n => {
|
|
690
|
-
if (e.
|
|
691
|
-
globalQueue.initTransition(e
|
|
700
|
+
if (e.ge !== t) return;
|
|
701
|
+
globalQueue.initTransition(e.$);
|
|
692
702
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
693
|
-
e.
|
|
703
|
+
e.ce = clock;
|
|
694
704
|
};
|
|
695
705
|
const asyncWrite = (i, r) => {
|
|
696
|
-
if (e.
|
|
706
|
+
if (e.ge !== t) return;
|
|
697
707
|
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
698
|
-
globalQueue.initTransition(e
|
|
708
|
+
globalQueue.initTransition(e.$);
|
|
699
709
|
clearStatus(e);
|
|
700
710
|
const o = resolveLane(e);
|
|
701
|
-
if (o) o.
|
|
711
|
+
if (o) o.G.delete(e);
|
|
702
712
|
if (n) n(i);
|
|
703
|
-
else if (e.
|
|
704
|
-
const t = e.
|
|
705
|
-
if (e.U) e.
|
|
713
|
+
else if (e.Y) {
|
|
714
|
+
const t = e.B !== NOT_PENDING;
|
|
715
|
+
if (e.U) e.B = i;
|
|
706
716
|
if (!t) {
|
|
707
|
-
e.
|
|
717
|
+
e.Re = i;
|
|
708
718
|
insertSubs(e);
|
|
709
719
|
}
|
|
710
|
-
e.
|
|
720
|
+
e.ce = clock;
|
|
711
721
|
} else if (o) {
|
|
712
|
-
const t = e.
|
|
713
|
-
const n = e.
|
|
722
|
+
const t = e.Re;
|
|
723
|
+
const n = e.Ae;
|
|
714
724
|
if (!n || !n(i, t)) {
|
|
715
|
-
e.
|
|
716
|
-
e.
|
|
717
|
-
if (e.
|
|
718
|
-
setSignal(e.
|
|
725
|
+
e.Re = i;
|
|
726
|
+
e.ce = clock;
|
|
727
|
+
if (e.Ne) {
|
|
728
|
+
setSignal(e.Ne, i);
|
|
719
729
|
}
|
|
720
730
|
insertSubs(e, true);
|
|
721
731
|
}
|
|
@@ -742,7 +752,7 @@ function handleAsync(e, t, n) {
|
|
|
742
752
|
);
|
|
743
753
|
i = false;
|
|
744
754
|
if (!n) {
|
|
745
|
-
globalQueue.initTransition(e
|
|
755
|
+
globalQueue.initTransition(e.$);
|
|
746
756
|
throw new NotReadyError(context);
|
|
747
757
|
}
|
|
748
758
|
}
|
|
@@ -774,27 +784,27 @@ function handleAsync(e, t, n) {
|
|
|
774
784
|
};
|
|
775
785
|
const r = iterate();
|
|
776
786
|
if (!i && !r) {
|
|
777
|
-
globalQueue.initTransition(e
|
|
787
|
+
globalQueue.initTransition(e.$);
|
|
778
788
|
throw new NotReadyError(context);
|
|
779
789
|
}
|
|
780
790
|
}
|
|
781
791
|
return s;
|
|
782
792
|
}
|
|
783
793
|
function clearStatus(e) {
|
|
784
|
-
e.
|
|
785
|
-
e.
|
|
794
|
+
e.Oe = e.Oe & STATUS_UNINITIALIZED;
|
|
795
|
+
e.se = null;
|
|
786
796
|
updatePendingSignal(e);
|
|
787
|
-
e.
|
|
797
|
+
e.Pe?.();
|
|
788
798
|
}
|
|
789
799
|
function notifyStatus(e, t, n, i, r) {
|
|
790
800
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
791
801
|
n = new StatusError(e, n);
|
|
792
802
|
const o = n instanceof NotReadyError && n.t === e;
|
|
793
|
-
const s = t === STATUS_PENDING && e.
|
|
803
|
+
const s = t === STATUS_PENDING && e.Y && !o;
|
|
794
804
|
const u = s && hasActiveOverride(e);
|
|
795
805
|
if (!i) {
|
|
796
|
-
e.
|
|
797
|
-
e.
|
|
806
|
+
e.Oe = t | (t !== STATUS_ERROR ? e.Oe & STATUS_UNINITIALIZED : 0);
|
|
807
|
+
e.se = n;
|
|
798
808
|
updatePendingSignal(e);
|
|
799
809
|
}
|
|
800
810
|
if (r && !i) {
|
|
@@ -802,32 +812,32 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
802
812
|
}
|
|
803
813
|
if (u && activeTransition && n instanceof NotReadyError) {
|
|
804
814
|
const e = n.t;
|
|
805
|
-
if (!activeTransition.
|
|
806
|
-
activeTransition.
|
|
815
|
+
if (!activeTransition.ue.includes(e)) {
|
|
816
|
+
activeTransition.ue.push(e);
|
|
807
817
|
}
|
|
808
818
|
}
|
|
809
819
|
const c = i || u;
|
|
810
820
|
const l = i || s ? undefined : r;
|
|
811
|
-
if (e.
|
|
821
|
+
if (e.Pe) {
|
|
812
822
|
if (c) {
|
|
813
|
-
e.
|
|
823
|
+
e.Pe(t, n);
|
|
814
824
|
} else {
|
|
815
|
-
e.
|
|
825
|
+
e.Pe();
|
|
816
826
|
}
|
|
817
827
|
return;
|
|
818
828
|
}
|
|
819
829
|
for (let i = e.p; i !== null; i = i.h) {
|
|
820
|
-
i.A.
|
|
821
|
-
if (i.A.
|
|
822
|
-
!i.A
|
|
830
|
+
i.A.ce = clock;
|
|
831
|
+
if (i.A.se !== n) {
|
|
832
|
+
!i.A.$ && globalQueue.J.push(i.A);
|
|
823
833
|
notifyStatus(i.A, t, n, c, l);
|
|
824
834
|
}
|
|
825
835
|
}
|
|
826
|
-
for (let i = e.
|
|
836
|
+
for (let i = e.N; i !== null; i = i.P) {
|
|
827
837
|
for (let e = i.p; e !== null; e = e.h) {
|
|
828
|
-
e.A.
|
|
829
|
-
if (e.A.
|
|
830
|
-
!e.A
|
|
838
|
+
e.A.ce = clock;
|
|
839
|
+
if (e.A.se !== n) {
|
|
840
|
+
!e.A.$ && globalQueue.J.push(e.A);
|
|
831
841
|
notifyStatus(e.A, t, n, c, l);
|
|
832
842
|
}
|
|
833
843
|
}
|
|
@@ -846,7 +856,7 @@ function updateIfNecessary(e) {
|
|
|
846
856
|
}
|
|
847
857
|
}
|
|
848
858
|
}
|
|
849
|
-
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.
|
|
859
|
+
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.se && e.ce < clock)) {
|
|
850
860
|
recompute(e);
|
|
851
861
|
}
|
|
852
862
|
e._ = REACTIVE_NONE;
|
|
@@ -855,15 +865,15 @@ function unlinkSubs(e) {
|
|
|
855
865
|
const t = e.V;
|
|
856
866
|
const n = e.m;
|
|
857
867
|
const i = e.h;
|
|
858
|
-
const r = e.
|
|
859
|
-
if (i !== null) i.
|
|
860
|
-
else t.
|
|
868
|
+
const r = e.Ce;
|
|
869
|
+
if (i !== null) i.Ce = r;
|
|
870
|
+
else t.ye = r;
|
|
861
871
|
if (r !== null) r.h = i;
|
|
862
872
|
else {
|
|
863
873
|
t.p = i;
|
|
864
874
|
if (i === null) {
|
|
865
|
-
t.
|
|
866
|
-
t.U && !t.
|
|
875
|
+
t.De?.();
|
|
876
|
+
t.U && !t.ve && unobserved(t);
|
|
867
877
|
}
|
|
868
878
|
}
|
|
869
879
|
return n;
|
|
@@ -878,27 +888,27 @@ function unobserved(e) {
|
|
|
878
888
|
disposeChildren(e, true);
|
|
879
889
|
}
|
|
880
890
|
function link(e, t) {
|
|
881
|
-
const n = t.
|
|
891
|
+
const n = t.he;
|
|
882
892
|
if (n !== null && n.V === e) return;
|
|
883
893
|
let i = null;
|
|
884
894
|
const r = t._ & REACTIVE_RECOMPUTING_DEPS;
|
|
885
895
|
if (r) {
|
|
886
896
|
i = n !== null ? n.m : t.D;
|
|
887
897
|
if (i !== null && i.V === e) {
|
|
888
|
-
t.
|
|
898
|
+
t.he = i;
|
|
889
899
|
return;
|
|
890
900
|
}
|
|
891
901
|
}
|
|
892
|
-
const o = e.
|
|
902
|
+
const o = e.ye;
|
|
893
903
|
if (o !== null && o.A === t && (!r || isValidLink(o, t))) return;
|
|
894
|
-
const s = (t.
|
|
904
|
+
const s = (t.he = e.ye = { V: e, A: t, m: i, Ce: o, h: null });
|
|
895
905
|
if (n !== null) n.m = s;
|
|
896
906
|
else t.D = s;
|
|
897
907
|
if (o !== null) o.h = s;
|
|
898
908
|
else e.p = s;
|
|
899
909
|
}
|
|
900
910
|
function isValidLink(e, t) {
|
|
901
|
-
const n = t.
|
|
911
|
+
const n = t.he;
|
|
902
912
|
if (n !== null) {
|
|
903
913
|
let i = t.D;
|
|
904
914
|
do {
|
|
@@ -910,7 +920,7 @@ function isValidLink(e, t) {
|
|
|
910
920
|
return false;
|
|
911
921
|
}
|
|
912
922
|
function markDisposal(e) {
|
|
913
|
-
let t = e.
|
|
923
|
+
let t = e.pe;
|
|
914
924
|
while (t) {
|
|
915
925
|
t._ |= REACTIVE_ZOMBIE;
|
|
916
926
|
if (t._ & REACTIVE_IN_HEAP) {
|
|
@@ -918,7 +928,7 @@ function markDisposal(e) {
|
|
|
918
928
|
insertIntoHeap(t, zombieQueue);
|
|
919
929
|
}
|
|
920
930
|
markDisposal(t);
|
|
921
|
-
t = t.
|
|
931
|
+
t = t.we;
|
|
922
932
|
}
|
|
923
933
|
}
|
|
924
934
|
function dispose(e) {
|
|
@@ -927,15 +937,15 @@ function dispose(e) {
|
|
|
927
937
|
t = unlinkSubs(t);
|
|
928
938
|
} while (t !== null);
|
|
929
939
|
e.D = null;
|
|
930
|
-
e.
|
|
940
|
+
e.he = null;
|
|
931
941
|
disposeChildren(e, true);
|
|
932
942
|
}
|
|
933
943
|
function disposeChildren(e, t = false, n) {
|
|
934
944
|
if (e._ & REACTIVE_DISPOSED) return;
|
|
935
945
|
if (t) e._ = REACTIVE_DISPOSED;
|
|
936
|
-
let i = n ? e.
|
|
946
|
+
let i = n ? e.Ie : e.pe;
|
|
937
947
|
while (i) {
|
|
938
|
-
const e = i.
|
|
948
|
+
const e = i.we;
|
|
939
949
|
if (i.D) {
|
|
940
950
|
const e = i;
|
|
941
951
|
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
@@ -944,21 +954,21 @@ function disposeChildren(e, t = false, n) {
|
|
|
944
954
|
t = unlinkSubs(t);
|
|
945
955
|
} while (t !== null);
|
|
946
956
|
e.D = null;
|
|
947
|
-
e.
|
|
957
|
+
e.he = null;
|
|
948
958
|
}
|
|
949
959
|
disposeChildren(i, true);
|
|
950
960
|
i = e;
|
|
951
961
|
}
|
|
952
962
|
if (n) {
|
|
953
|
-
e.
|
|
963
|
+
e.Ie = null;
|
|
954
964
|
} else {
|
|
955
|
-
e.
|
|
956
|
-
e.
|
|
965
|
+
e.pe = null;
|
|
966
|
+
e.we = null;
|
|
957
967
|
}
|
|
958
968
|
runDisposal(e, n);
|
|
959
969
|
}
|
|
960
970
|
function runDisposal(e, t) {
|
|
961
|
-
let n = t ? e.
|
|
971
|
+
let n = t ? e.Se : e._e;
|
|
962
972
|
if (!n) return;
|
|
963
973
|
if (Array.isArray(n)) {
|
|
964
974
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -968,10 +978,10 @@ function runDisposal(e, t) {
|
|
|
968
978
|
} else {
|
|
969
979
|
n.call(n);
|
|
970
980
|
}
|
|
971
|
-
t ? (e.
|
|
981
|
+
t ? (e.Se = null) : (e._e = null);
|
|
972
982
|
}
|
|
973
983
|
function getNextChildId(e) {
|
|
974
|
-
if (e.id != null) return formatId(e.id, e.
|
|
984
|
+
if (e.id != null) return formatId(e.id, e.be++);
|
|
975
985
|
throw new Error("Cannot get child id from owner without an id");
|
|
976
986
|
}
|
|
977
987
|
function formatId(e, t) {
|
|
@@ -982,44 +992,44 @@ function formatId(e, t) {
|
|
|
982
992
|
function computed(e, t, n) {
|
|
983
993
|
const i = {
|
|
984
994
|
id: n?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
995
|
+
Ae: n?.equals != null ? n.equals : isEqual,
|
|
996
|
+
me: !!n?.pureWrite,
|
|
997
|
+
De: n?.unobserved,
|
|
998
|
+
_e: null,
|
|
999
|
+
Te: context?.Te ?? globalQueue,
|
|
1000
|
+
Ve: context?.Ve ?? defaultContext,
|
|
1001
|
+
be: 0,
|
|
992
1002
|
U: e,
|
|
993
|
-
|
|
1003
|
+
Re: t,
|
|
994
1004
|
u: 0,
|
|
995
|
-
|
|
1005
|
+
N: null,
|
|
996
1006
|
O: undefined,
|
|
997
1007
|
R: null,
|
|
998
1008
|
D: null,
|
|
999
|
-
|
|
1009
|
+
he: null,
|
|
1000
1010
|
p: null,
|
|
1001
|
-
|
|
1011
|
+
ye: null,
|
|
1002
1012
|
o: context,
|
|
1003
|
-
|
|
1004
|
-
|
|
1013
|
+
we: null,
|
|
1014
|
+
pe: null,
|
|
1005
1015
|
_: REACTIVE_NONE,
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
Re: null,
|
|
1016
|
+
Oe: STATUS_UNINITIALIZED,
|
|
1017
|
+
ce: clock,
|
|
1018
|
+
B: NOT_PENDING,
|
|
1010
1019
|
Se: null,
|
|
1011
|
-
|
|
1012
|
-
|
|
1020
|
+
Ie: null,
|
|
1021
|
+
ge: null,
|
|
1022
|
+
$: null
|
|
1013
1023
|
};
|
|
1014
1024
|
i.R = i;
|
|
1015
1025
|
const r = context?.i ? context.l : context;
|
|
1016
1026
|
if (context) {
|
|
1017
|
-
const e = context.
|
|
1027
|
+
const e = context.pe;
|
|
1018
1028
|
if (e === null) {
|
|
1019
|
-
context.
|
|
1029
|
+
context.pe = i;
|
|
1020
1030
|
} else {
|
|
1021
|
-
i.
|
|
1022
|
-
context.
|
|
1031
|
+
i.we = e;
|
|
1032
|
+
context.pe = i;
|
|
1023
1033
|
}
|
|
1024
1034
|
}
|
|
1025
1035
|
if (r) i.u = r.u + 1;
|
|
@@ -1028,69 +1038,84 @@ function computed(e, t, n) {
|
|
|
1028
1038
|
}
|
|
1029
1039
|
function signal(e, t, n = null) {
|
|
1030
1040
|
const i = {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1041
|
+
Ae: t?.equals != null ? t.equals : isEqual,
|
|
1042
|
+
me: !!t?.pureWrite,
|
|
1043
|
+
De: t?.unobserved,
|
|
1044
|
+
Re: e,
|
|
1035
1045
|
p: null,
|
|
1036
|
-
|
|
1037
|
-
|
|
1046
|
+
ye: null,
|
|
1047
|
+
ce: clock,
|
|
1038
1048
|
L: n,
|
|
1039
|
-
|
|
1040
|
-
|
|
1049
|
+
P: n?.N || null,
|
|
1050
|
+
B: NOT_PENDING
|
|
1041
1051
|
};
|
|
1042
|
-
n && (n.
|
|
1052
|
+
n && (n.N = i);
|
|
1043
1053
|
return i;
|
|
1044
1054
|
}
|
|
1045
1055
|
function optimisticSignal(e, t) {
|
|
1046
1056
|
const n = signal(e, t);
|
|
1047
|
-
n.
|
|
1057
|
+
n.Y = true;
|
|
1048
1058
|
return n;
|
|
1049
1059
|
}
|
|
1050
1060
|
function optimisticComputed(e, t, n) {
|
|
1051
1061
|
const i = computed(e, t, n);
|
|
1052
|
-
i.
|
|
1062
|
+
i.Y = true;
|
|
1053
1063
|
return i;
|
|
1054
1064
|
}
|
|
1055
1065
|
function getPendingSignal(e) {
|
|
1056
|
-
if (!e.
|
|
1057
|
-
e.
|
|
1058
|
-
if (
|
|
1066
|
+
if (!e.Le) {
|
|
1067
|
+
e.Le = optimisticSignal(false, { pureWrite: true });
|
|
1068
|
+
if (e.k) {
|
|
1069
|
+
e.Le.k = e;
|
|
1070
|
+
}
|
|
1071
|
+
if (computePendingState(e)) setSignal(e.Le, true);
|
|
1059
1072
|
}
|
|
1060
|
-
return e.
|
|
1073
|
+
return e.Le;
|
|
1061
1074
|
}
|
|
1062
1075
|
function computePendingState(e) {
|
|
1063
1076
|
const t = e;
|
|
1064
|
-
if (e.
|
|
1065
|
-
|
|
1077
|
+
if (e.Y && e.B !== NOT_PENDING) {
|
|
1078
|
+
if (t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
|
|
1079
|
+
if (e.k) {
|
|
1080
|
+
const t = e.W ? findLane(e.W) : null;
|
|
1081
|
+
return !!(t && t.G.size > 0);
|
|
1082
|
+
}
|
|
1083
|
+
return true;
|
|
1084
|
+
}
|
|
1085
|
+
if (e.B !== NOT_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
|
|
1086
|
+
return !!(t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED));
|
|
1066
1087
|
}
|
|
1067
1088
|
function getPendingValueComputed(e) {
|
|
1068
|
-
if (!e.
|
|
1089
|
+
if (!e.Ne) {
|
|
1069
1090
|
const t = pendingReadActive;
|
|
1070
1091
|
pendingReadActive = false;
|
|
1071
|
-
const n =
|
|
1092
|
+
const n = pendingCheckActive;
|
|
1093
|
+
pendingCheckActive = false;
|
|
1094
|
+
const i = context;
|
|
1072
1095
|
context = null;
|
|
1073
|
-
e.
|
|
1074
|
-
|
|
1096
|
+
e.Ne = optimisticComputed(() => read(e));
|
|
1097
|
+
e.Ne.k = e;
|
|
1098
|
+
context = i;
|
|
1099
|
+
pendingCheckActive = n;
|
|
1075
1100
|
pendingReadActive = t;
|
|
1076
1101
|
}
|
|
1077
|
-
return e.
|
|
1102
|
+
return e.Ne;
|
|
1078
1103
|
}
|
|
1079
1104
|
function updatePendingSignal(e) {
|
|
1080
|
-
if (e.
|
|
1105
|
+
if (e.Le) {
|
|
1081
1106
|
const t = computePendingState(e);
|
|
1082
|
-
const n = e.
|
|
1107
|
+
const n = e.Le;
|
|
1083
1108
|
setSignal(n, t);
|
|
1084
|
-
if (!t && n.
|
|
1109
|
+
if (!t && n.W) {
|
|
1085
1110
|
const t = resolveLane(e);
|
|
1086
|
-
if (t && t.
|
|
1087
|
-
const e = findLane(n.
|
|
1111
|
+
if (t && t.G.size > 0) {
|
|
1112
|
+
const e = findLane(n.W);
|
|
1088
1113
|
if (e !== t) {
|
|
1089
1114
|
mergeLanes(t, e);
|
|
1090
1115
|
}
|
|
1091
1116
|
}
|
|
1092
1117
|
clearLaneEntry(n);
|
|
1093
|
-
n.
|
|
1118
|
+
n.W = undefined;
|
|
1094
1119
|
}
|
|
1095
1120
|
}
|
|
1096
1121
|
}
|
|
@@ -1107,6 +1132,22 @@ function untrack(e) {
|
|
|
1107
1132
|
}
|
|
1108
1133
|
}
|
|
1109
1134
|
function read(e) {
|
|
1135
|
+
if (pendingReadActive) {
|
|
1136
|
+
const t = getPendingValueComputed(e);
|
|
1137
|
+
const n = pendingReadActive;
|
|
1138
|
+
pendingReadActive = false;
|
|
1139
|
+
const i = read(t);
|
|
1140
|
+
pendingReadActive = n;
|
|
1141
|
+
if (t.Oe & STATUS_PENDING) return e.Re;
|
|
1142
|
+
if (stale && currentOptimisticLane && t.W) {
|
|
1143
|
+
const n = findLane(t.W);
|
|
1144
|
+
const i = findLane(currentOptimisticLane);
|
|
1145
|
+
if (n !== i && n.G.size > 0) {
|
|
1146
|
+
return e.Re;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
return i;
|
|
1150
|
+
}
|
|
1110
1151
|
if (pendingCheckActive) {
|
|
1111
1152
|
const t = e.L || e;
|
|
1112
1153
|
const n = getPendingSignal(t);
|
|
@@ -1116,16 +1157,7 @@ function read(e) {
|
|
|
1116
1157
|
foundPending = true;
|
|
1117
1158
|
}
|
|
1118
1159
|
pendingCheckActive = i;
|
|
1119
|
-
return e.
|
|
1120
|
-
}
|
|
1121
|
-
if (pendingReadActive) {
|
|
1122
|
-
const t = getPendingValueComputed(e);
|
|
1123
|
-
const n = pendingReadActive;
|
|
1124
|
-
pendingReadActive = false;
|
|
1125
|
-
const i = read(t);
|
|
1126
|
-
pendingReadActive = n;
|
|
1127
|
-
if (t.de & STATUS_PENDING) return e.Te;
|
|
1128
|
-
return i;
|
|
1160
|
+
return e.Re;
|
|
1129
1161
|
}
|
|
1130
1162
|
let t = context;
|
|
1131
1163
|
if (t?.i) t = t.l;
|
|
@@ -1136,7 +1168,7 @@ function read(e) {
|
|
|
1136
1168
|
const n = e.L || e;
|
|
1137
1169
|
if (n.U) {
|
|
1138
1170
|
const i = e._ & REACTIVE_ZOMBIE;
|
|
1139
|
-
if (n.u >= (i ? zombieQueue.
|
|
1171
|
+
if (n.u >= (i ? zombieQueue.C : dirtyQueue.C)) {
|
|
1140
1172
|
markNode(t);
|
|
1141
1173
|
markHeap(i ? zombieQueue : dirtyQueue);
|
|
1142
1174
|
updateIfNecessary(n);
|
|
@@ -1148,69 +1180,69 @@ function read(e) {
|
|
|
1148
1180
|
}
|
|
1149
1181
|
}
|
|
1150
1182
|
const n = e.L || e;
|
|
1151
|
-
if (t && n.
|
|
1183
|
+
if (t && n.Oe & STATUS_PENDING && !(stale && n.$ && activeTransition !== n.$)) {
|
|
1152
1184
|
if (currentOptimisticLane) {
|
|
1153
|
-
const i = n.
|
|
1185
|
+
const i = n.W;
|
|
1154
1186
|
const r = findLane(currentOptimisticLane);
|
|
1155
1187
|
if (i && findLane(i) === r && !hasActiveOverride(n)) {
|
|
1156
1188
|
if (!tracking) link(e, t);
|
|
1157
|
-
throw n.
|
|
1189
|
+
throw n.se;
|
|
1158
1190
|
}
|
|
1159
1191
|
} else {
|
|
1160
1192
|
if (!tracking) link(e, t);
|
|
1161
|
-
throw n.
|
|
1193
|
+
throw n.se;
|
|
1162
1194
|
}
|
|
1163
1195
|
}
|
|
1164
|
-
if (e.U && e.
|
|
1165
|
-
if (e.
|
|
1196
|
+
if (e.U && e.Oe & STATUS_ERROR) {
|
|
1197
|
+
if (e.ce < clock) {
|
|
1166
1198
|
recompute(e, true);
|
|
1167
1199
|
return read(e);
|
|
1168
|
-
} else throw e.
|
|
1200
|
+
} else throw e.se;
|
|
1169
1201
|
}
|
|
1170
1202
|
return !t ||
|
|
1171
1203
|
currentOptimisticLane !== null ||
|
|
1172
|
-
e.
|
|
1173
|
-
(stale && e
|
|
1174
|
-
? e.
|
|
1175
|
-
: e.
|
|
1204
|
+
e.B === NOT_PENDING ||
|
|
1205
|
+
(stale && e.$ && activeTransition !== e.$)
|
|
1206
|
+
? e.Re
|
|
1207
|
+
: e.B;
|
|
1176
1208
|
}
|
|
1177
1209
|
function setSignal(e, t) {
|
|
1178
|
-
if (e
|
|
1179
|
-
const n = e.
|
|
1180
|
-
const i = n ? e.
|
|
1210
|
+
if (e.$ && activeTransition !== e.$) globalQueue.initTransition(e.$);
|
|
1211
|
+
const n = e.Y && !projectionWriteActive;
|
|
1212
|
+
const i = n ? e.Re : e.B === NOT_PENDING ? e.Re : e.B;
|
|
1181
1213
|
if (typeof t === "function") t = t(i);
|
|
1182
|
-
const r = !e.
|
|
1214
|
+
const r = !e.Ae || !e.Ae(i, t);
|
|
1183
1215
|
if (!r) {
|
|
1184
|
-
if (n && e.
|
|
1216
|
+
if (n && e.B !== NOT_PENDING && e.U) {
|
|
1185
1217
|
insertSubs(e, true);
|
|
1186
1218
|
schedule();
|
|
1187
1219
|
}
|
|
1188
1220
|
return t;
|
|
1189
1221
|
}
|
|
1190
1222
|
if (n) {
|
|
1191
|
-
const n = globalQueue.
|
|
1192
|
-
if (e
|
|
1193
|
-
globalQueue.initTransition(e
|
|
1223
|
+
const n = globalQueue.ee.includes(e);
|
|
1224
|
+
if (e.$ && n) {
|
|
1225
|
+
globalQueue.initTransition(e.$);
|
|
1194
1226
|
}
|
|
1195
|
-
if (e.
|
|
1196
|
-
e.
|
|
1227
|
+
if (e.B === NOT_PENDING) {
|
|
1228
|
+
e.B = e.Re;
|
|
1197
1229
|
}
|
|
1198
1230
|
if (!n) {
|
|
1199
|
-
globalQueue.
|
|
1231
|
+
globalQueue.ee.push(e);
|
|
1200
1232
|
}
|
|
1201
|
-
e
|
|
1233
|
+
e.K = (e.K || 0) + 1;
|
|
1202
1234
|
const i = getOrCreateLane(e);
|
|
1203
|
-
e.
|
|
1204
|
-
e.
|
|
1235
|
+
e.W = i;
|
|
1236
|
+
e.Re = t;
|
|
1205
1237
|
} else {
|
|
1206
|
-
if (e.
|
|
1207
|
-
e.
|
|
1238
|
+
if (e.B === NOT_PENDING) globalQueue.J.push(e);
|
|
1239
|
+
e.B = t;
|
|
1208
1240
|
}
|
|
1209
1241
|
updatePendingSignal(e);
|
|
1210
|
-
if (e.
|
|
1211
|
-
setSignal(e.
|
|
1242
|
+
if (e.Ne) {
|
|
1243
|
+
setSignal(e.Ne, t);
|
|
1212
1244
|
}
|
|
1213
|
-
e.
|
|
1245
|
+
e.ce = clock;
|
|
1214
1246
|
insertSubs(e, n);
|
|
1215
1247
|
schedule();
|
|
1216
1248
|
return t;
|
|
@@ -1225,9 +1257,9 @@ function getOwner() {
|
|
|
1225
1257
|
}
|
|
1226
1258
|
function onCleanup(e) {
|
|
1227
1259
|
if (!context) return e;
|
|
1228
|
-
if (!context.
|
|
1229
|
-
else if (Array.isArray(context.
|
|
1230
|
-
else context.
|
|
1260
|
+
if (!context._e) context._e = e;
|
|
1261
|
+
else if (Array.isArray(context._e)) context._e.push(e);
|
|
1262
|
+
else context._e = [context._e, e];
|
|
1231
1263
|
return e;
|
|
1232
1264
|
}
|
|
1233
1265
|
function createOwner(e) {
|
|
@@ -1236,26 +1268,26 @@ function createOwner(e) {
|
|
|
1236
1268
|
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
1237
1269
|
i: true,
|
|
1238
1270
|
l: t?.i ? t.l : t,
|
|
1271
|
+
pe: null,
|
|
1272
|
+
we: null,
|
|
1239
1273
|
_e: null,
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
be: t?.be || defaultContext,
|
|
1244
|
-
ve: 0,
|
|
1245
|
-
Re: null,
|
|
1274
|
+
Te: t?.Te ?? globalQueue,
|
|
1275
|
+
Ve: t?.Ve || defaultContext,
|
|
1276
|
+
be: 0,
|
|
1246
1277
|
Se: null,
|
|
1278
|
+
Ie: null,
|
|
1247
1279
|
o: t,
|
|
1248
1280
|
dispose(e = true) {
|
|
1249
1281
|
disposeChildren(n, e);
|
|
1250
1282
|
}
|
|
1251
1283
|
};
|
|
1252
1284
|
if (t) {
|
|
1253
|
-
const e = t.
|
|
1285
|
+
const e = t.pe;
|
|
1254
1286
|
if (e === null) {
|
|
1255
|
-
t.
|
|
1287
|
+
t.pe = n;
|
|
1256
1288
|
} else {
|
|
1257
|
-
n.
|
|
1258
|
-
t.
|
|
1289
|
+
n.we = e;
|
|
1290
|
+
t.pe = n;
|
|
1259
1291
|
}
|
|
1260
1292
|
}
|
|
1261
1293
|
return n;
|
|
@@ -1335,7 +1367,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1335
1367
|
if (!t) {
|
|
1336
1368
|
throw new NoOwnerError();
|
|
1337
1369
|
}
|
|
1338
|
-
const n = hasContext(e, t) ? t.
|
|
1370
|
+
const n = hasContext(e, t) ? t.Ve[e.id] : e.defaultValue;
|
|
1339
1371
|
if (isUndefined(n)) {
|
|
1340
1372
|
throw new ContextNotFoundError();
|
|
1341
1373
|
}
|
|
@@ -1345,10 +1377,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1345
1377
|
if (!n) {
|
|
1346
1378
|
throw new NoOwnerError();
|
|
1347
1379
|
}
|
|
1348
|
-
n.
|
|
1380
|
+
n.Ve = { ...n.Ve, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1349
1381
|
}
|
|
1350
1382
|
function hasContext(e, t) {
|
|
1351
|
-
return !isUndefined(t?.
|
|
1383
|
+
return !isUndefined(t?.Ve[e.id]);
|
|
1352
1384
|
}
|
|
1353
1385
|
function isUndefined(e) {
|
|
1354
1386
|
return typeof e === "undefined";
|
|
@@ -1358,80 +1390,80 @@ function effect(e, t, n, i, r) {
|
|
|
1358
1390
|
const s = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
1359
1391
|
...r,
|
|
1360
1392
|
equals: () => {
|
|
1361
|
-
s.
|
|
1362
|
-
if (o) s.
|
|
1393
|
+
s.Ee = !s.se;
|
|
1394
|
+
if (o) s.Te.enqueue(s.fe, runEffect.bind(s));
|
|
1363
1395
|
return false;
|
|
1364
1396
|
},
|
|
1365
1397
|
lazy: true
|
|
1366
1398
|
});
|
|
1367
|
-
s.
|
|
1368
|
-
s.
|
|
1369
|
-
s.
|
|
1370
|
-
s.
|
|
1371
|
-
s.
|
|
1372
|
-
s.
|
|
1373
|
-
const n = e !== undefined ? e : s.
|
|
1374
|
-
const i = t !== undefined ? t : s.
|
|
1399
|
+
s.Ue = i;
|
|
1400
|
+
s.ke = t;
|
|
1401
|
+
s.We = n;
|
|
1402
|
+
s.Qe = undefined;
|
|
1403
|
+
s.fe = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
1404
|
+
s.Pe = (e, t) => {
|
|
1405
|
+
const n = e !== undefined ? e : s.Oe;
|
|
1406
|
+
const i = t !== undefined ? t : s.se;
|
|
1375
1407
|
if (n & STATUS_ERROR) {
|
|
1376
1408
|
let e = i;
|
|
1377
|
-
s.
|
|
1378
|
-
if (s.
|
|
1409
|
+
s.Te.notify(s, STATUS_PENDING, 0);
|
|
1410
|
+
if (s.fe === EFFECT_USER) {
|
|
1379
1411
|
try {
|
|
1380
|
-
return s.
|
|
1381
|
-
? s.
|
|
1382
|
-
s.
|
|
1383
|
-
s.
|
|
1412
|
+
return s.We
|
|
1413
|
+
? s.We(e, () => {
|
|
1414
|
+
s.Qe?.();
|
|
1415
|
+
s.Qe = undefined;
|
|
1384
1416
|
})
|
|
1385
1417
|
: console.error(e);
|
|
1386
1418
|
} catch (t) {
|
|
1387
1419
|
e = t;
|
|
1388
1420
|
}
|
|
1389
1421
|
}
|
|
1390
|
-
if (!s.
|
|
1391
|
-
} else if (s.
|
|
1422
|
+
if (!s.Te.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1423
|
+
} else if (s.fe === EFFECT_RENDER) s.Te.notify(s, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
1392
1424
|
};
|
|
1393
1425
|
recompute(s, true);
|
|
1394
|
-
!r?.defer && (s.
|
|
1426
|
+
!r?.defer && (s.fe === EFFECT_USER ? s.Te.enqueue(s.fe, runEffect.bind(s)) : runEffect.call(s));
|
|
1395
1427
|
o = true;
|
|
1396
|
-
onCleanup(() => s.
|
|
1428
|
+
onCleanup(() => s.Qe?.());
|
|
1397
1429
|
}
|
|
1398
1430
|
function runEffect() {
|
|
1399
|
-
if (!this.
|
|
1400
|
-
this.
|
|
1401
|
-
this.
|
|
1431
|
+
if (!this.Ee || this._ & REACTIVE_DISPOSED) return;
|
|
1432
|
+
this.Qe?.();
|
|
1433
|
+
this.Qe = undefined;
|
|
1402
1434
|
try {
|
|
1403
|
-
this.
|
|
1435
|
+
this.Qe = this.ke(this.Re, this.Ue);
|
|
1404
1436
|
} catch (e) {
|
|
1405
|
-
if (!this.
|
|
1437
|
+
if (!this.Te.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1406
1438
|
} finally {
|
|
1407
|
-
this.
|
|
1408
|
-
this.
|
|
1439
|
+
this.Ue = this.Re;
|
|
1440
|
+
this.Ee = false;
|
|
1409
1441
|
}
|
|
1410
1442
|
}
|
|
1411
1443
|
function trackedEffect(e, t) {
|
|
1412
1444
|
const run = () => {
|
|
1413
|
-
if (!n.
|
|
1414
|
-
n.
|
|
1445
|
+
if (!n.Ee || n._ & REACTIVE_DISPOSED) return;
|
|
1446
|
+
n.Ee = false;
|
|
1415
1447
|
recompute(n);
|
|
1416
1448
|
};
|
|
1417
1449
|
const n = computed(
|
|
1418
1450
|
() => {
|
|
1419
1451
|
try {
|
|
1420
|
-
n.
|
|
1421
|
-
n.
|
|
1422
|
-
n.
|
|
1452
|
+
n.Qe?.();
|
|
1453
|
+
n.Qe = undefined;
|
|
1454
|
+
n.Qe = staleValues(e) || undefined;
|
|
1423
1455
|
} finally {
|
|
1424
1456
|
}
|
|
1425
1457
|
},
|
|
1426
1458
|
undefined,
|
|
1427
1459
|
{ ...t, lazy: true, pureWrite: true }
|
|
1428
1460
|
);
|
|
1429
|
-
n.
|
|
1430
|
-
n.
|
|
1431
|
-
n.
|
|
1432
|
-
n.
|
|
1433
|
-
n.
|
|
1434
|
-
onCleanup(() => n.
|
|
1461
|
+
n.Qe = undefined;
|
|
1462
|
+
n.Ee = true;
|
|
1463
|
+
n.fe = EFFECT_TRACKED;
|
|
1464
|
+
n.de = run;
|
|
1465
|
+
n.Te.enqueue(EFFECT_USER, run);
|
|
1466
|
+
onCleanup(() => n.Qe?.());
|
|
1435
1467
|
}
|
|
1436
1468
|
function createSignal(e, t, n) {
|
|
1437
1469
|
if (typeof e === "function") {
|
|
@@ -1610,7 +1642,7 @@ function applyState(e, t, n, i) {
|
|
|
1610
1642
|
const E = unwrap(getOverrideValue(o, s, u, a));
|
|
1611
1643
|
let T = unwrap(e[a]);
|
|
1612
1644
|
if (E === T) continue;
|
|
1613
|
-
if (!E || !isWrappable(E) || (n(E) != null && n(E) !== n(T))) {
|
|
1645
|
+
if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
|
|
1614
1646
|
t && setSignal(t, void 0);
|
|
1615
1647
|
f && setSignal(f, isWrappable(T) ? wrap(T, r) : T);
|
|
1616
1648
|
} else applyState(T, wrap(E, r), n, i);
|
|
@@ -1665,7 +1697,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1665
1697
|
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(o);
|
|
1666
1698
|
});
|
|
1667
1699
|
});
|
|
1668
|
-
i.
|
|
1700
|
+
i.ve = true;
|
|
1669
1701
|
return { store: o, node: i };
|
|
1670
1702
|
}
|
|
1671
1703
|
function createProjection(e, t = {}, n) {
|
|
@@ -1765,7 +1797,7 @@ function getNode(e, t, n, i, r = isEqual, o) {
|
|
|
1765
1797
|
},
|
|
1766
1798
|
i
|
|
1767
1799
|
);
|
|
1768
|
-
if (o) s.
|
|
1800
|
+
if (o) s.Y = true;
|
|
1769
1801
|
return (e[t] = s);
|
|
1770
1802
|
}
|
|
1771
1803
|
function trackSelf(e, t = $TRACK) {
|
|
@@ -1818,7 +1850,7 @@ const storeTraps = {
|
|
|
1818
1850
|
if (e && e.get) return e.get.call(n);
|
|
1819
1851
|
}
|
|
1820
1852
|
if (writeOnly(n)) {
|
|
1821
|
-
let n = r && (s || !u) ? (r.
|
|
1853
|
+
let n = r && (s || !u) ? (r.B !== NOT_PENDING ? (r.Y ? r.Re : r.B) : r.Re) : c[t];
|
|
1822
1854
|
n === $DELETED && (n = undefined);
|
|
1823
1855
|
if (!isWrappable(n)) return n;
|
|
1824
1856
|
const i = wrap(n, e);
|
|
@@ -1867,8 +1899,8 @@ const storeTraps = {
|
|
|
1867
1899
|
if (writeOnly(i)) {
|
|
1868
1900
|
if (e[STORE_OPTIMISTIC]) {
|
|
1869
1901
|
const t = e[STORE_FIREWALL];
|
|
1870
|
-
if (t
|
|
1871
|
-
globalQueue.initTransition(t
|
|
1902
|
+
if (t?.$) {
|
|
1903
|
+
globalQueue.initTransition(t.$);
|
|
1872
1904
|
}
|
|
1873
1905
|
}
|
|
1874
1906
|
untrack(() => {
|
|
@@ -2057,7 +2089,7 @@ function deep(e) {
|
|
|
2057
2089
|
return e[$DEEP];
|
|
2058
2090
|
}
|
|
2059
2091
|
function createOptimisticStore(e, t, n) {
|
|
2060
|
-
GlobalQueue.
|
|
2092
|
+
GlobalQueue.re ||= clearOptimisticStore;
|
|
2061
2093
|
const i = typeof e === "function";
|
|
2062
2094
|
const r = (i ? t : e) ?? {};
|
|
2063
2095
|
const o = i ? e : undefined;
|
|
@@ -2074,7 +2106,7 @@ function clearOptimisticStore(e) {
|
|
|
2074
2106
|
if (i) {
|
|
2075
2107
|
for (const e of Reflect.ownKeys(n)) {
|
|
2076
2108
|
if (i[e]) {
|
|
2077
|
-
i[e].
|
|
2109
|
+
i[e].W = undefined;
|
|
2078
2110
|
const n =
|
|
2079
2111
|
t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
|
|
2080
2112
|
const r = n === $DELETED ? undefined : n;
|
|
@@ -2082,7 +2114,7 @@ function clearOptimisticStore(e) {
|
|
|
2082
2114
|
}
|
|
2083
2115
|
}
|
|
2084
2116
|
if (i[$TRACK]) {
|
|
2085
|
-
i[$TRACK].
|
|
2117
|
+
i[$TRACK].W = undefined;
|
|
2086
2118
|
setSignal(i[$TRACK], undefined);
|
|
2087
2119
|
}
|
|
2088
2120
|
}
|
|
@@ -2133,7 +2165,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2133
2165
|
setProjectionWriteActive(false);
|
|
2134
2166
|
}
|
|
2135
2167
|
});
|
|
2136
|
-
i.
|
|
2168
|
+
i.ve = true;
|
|
2137
2169
|
}
|
|
2138
2170
|
return { store: o, node: i };
|
|
2139
2171
|
}
|
|
@@ -2317,68 +2349,68 @@ function mapArray(e, t, n) {
|
|
|
2317
2349
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2318
2350
|
return createMemo(
|
|
2319
2351
|
updateKeyedMap.bind({
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
Ge: [],
|
|
2324
|
-
Me: t,
|
|
2352
|
+
xe: createOwner(),
|
|
2353
|
+
Ge: 0,
|
|
2354
|
+
Me: e,
|
|
2325
2355
|
Fe: [],
|
|
2326
|
-
$e:
|
|
2327
|
-
He:
|
|
2328
|
-
je:
|
|
2329
|
-
Ke:
|
|
2330
|
-
Ye: n?.
|
|
2356
|
+
$e: t,
|
|
2357
|
+
He: [],
|
|
2358
|
+
je: [],
|
|
2359
|
+
Ke: i,
|
|
2360
|
+
Ye: i || n?.keyed === false ? [] : undefined,
|
|
2361
|
+
Be: t.length > 1 ? [] : undefined,
|
|
2362
|
+
Xe: n?.fallback
|
|
2331
2363
|
})
|
|
2332
2364
|
);
|
|
2333
2365
|
}
|
|
2334
2366
|
const pureOptions = { pureWrite: true };
|
|
2335
2367
|
function updateKeyedMap() {
|
|
2336
|
-
const e = this.
|
|
2368
|
+
const e = this.Me() || [],
|
|
2337
2369
|
t = e.length;
|
|
2338
2370
|
e[$TRACK];
|
|
2339
|
-
runWithOwner(this.
|
|
2371
|
+
runWithOwner(this.xe, () => {
|
|
2340
2372
|
let n,
|
|
2341
2373
|
i,
|
|
2342
|
-
r = this.
|
|
2374
|
+
r = this.Ye
|
|
2343
2375
|
? () => {
|
|
2344
|
-
this.
|
|
2345
|
-
this.
|
|
2346
|
-
return this
|
|
2347
|
-
read.bind(null, this.
|
|
2348
|
-
this.
|
|
2376
|
+
this.Ye[i] = signal(e[i], pureOptions);
|
|
2377
|
+
this.Be && (this.Be[i] = signal(i, pureOptions));
|
|
2378
|
+
return this.$e(
|
|
2379
|
+
read.bind(null, this.Ye[i]),
|
|
2380
|
+
this.Be ? read.bind(null, this.Be[i]) : undefined
|
|
2349
2381
|
);
|
|
2350
2382
|
}
|
|
2351
|
-
: this.
|
|
2383
|
+
: this.Be
|
|
2352
2384
|
? () => {
|
|
2353
2385
|
const t = e[i];
|
|
2354
|
-
this.
|
|
2355
|
-
return this
|
|
2386
|
+
this.Be[i] = signal(i, pureOptions);
|
|
2387
|
+
return this.$e(() => t, read.bind(null, this.Be[i]));
|
|
2356
2388
|
}
|
|
2357
2389
|
: () => {
|
|
2358
2390
|
const t = e[i];
|
|
2359
|
-
return this
|
|
2391
|
+
return this.$e(() => t);
|
|
2360
2392
|
};
|
|
2361
2393
|
if (t === 0) {
|
|
2362
|
-
if (this.
|
|
2363
|
-
this.
|
|
2364
|
-
this
|
|
2365
|
-
this.Ge = [];
|
|
2394
|
+
if (this.Ge !== 0) {
|
|
2395
|
+
this.xe.dispose(false);
|
|
2396
|
+
this.je = [];
|
|
2366
2397
|
this.Fe = [];
|
|
2367
|
-
this.
|
|
2368
|
-
this.
|
|
2369
|
-
this.
|
|
2398
|
+
this.He = [];
|
|
2399
|
+
this.Ge = 0;
|
|
2400
|
+
this.Ye && (this.Ye = []);
|
|
2401
|
+
this.Be && (this.Be = []);
|
|
2370
2402
|
}
|
|
2371
|
-
if (this.
|
|
2372
|
-
this.
|
|
2403
|
+
if (this.Xe && !this.He[0]) {
|
|
2404
|
+
this.He[0] = runWithOwner((this.je[0] = createOwner()), this.Xe);
|
|
2373
2405
|
}
|
|
2374
|
-
} else if (this.
|
|
2375
|
-
if (this
|
|
2376
|
-
this.
|
|
2406
|
+
} else if (this.Ge === 0) {
|
|
2407
|
+
if (this.je[0]) this.je[0].dispose();
|
|
2408
|
+
this.He = new Array(t);
|
|
2377
2409
|
for (i = 0; i < t; i++) {
|
|
2378
|
-
this.
|
|
2379
|
-
this.
|
|
2410
|
+
this.Fe[i] = e[i];
|
|
2411
|
+
this.He[i] = runWithOwner((this.je[i] = createOwner()), r);
|
|
2380
2412
|
}
|
|
2381
|
-
this.
|
|
2413
|
+
this.Ge = t;
|
|
2382
2414
|
} else {
|
|
2383
2415
|
let o,
|
|
2384
2416
|
s,
|
|
@@ -2389,217 +2421,217 @@ function updateKeyedMap() {
|
|
|
2389
2421
|
f,
|
|
2390
2422
|
E = new Array(t),
|
|
2391
2423
|
T = new Array(t),
|
|
2392
|
-
d = this.
|
|
2393
|
-
R = this.
|
|
2424
|
+
d = this.Ye ? new Array(t) : undefined,
|
|
2425
|
+
R = this.Be ? new Array(t) : undefined;
|
|
2394
2426
|
for (
|
|
2395
|
-
o = 0, s = Math.min(this.
|
|
2396
|
-
o < s && (this.
|
|
2427
|
+
o = 0, s = Math.min(this.Ge, t);
|
|
2428
|
+
o < s && (this.Fe[o] === e[o] || (this.Ye && compare(this.Ke, this.Fe[o], e[o])));
|
|
2397
2429
|
o++
|
|
2398
2430
|
) {
|
|
2399
|
-
if (this.
|
|
2431
|
+
if (this.Ye) setSignal(this.Ye[o], e[o]);
|
|
2400
2432
|
}
|
|
2401
2433
|
for (
|
|
2402
|
-
s = this.
|
|
2434
|
+
s = this.Ge - 1, u = t - 1;
|
|
2403
2435
|
s >= o &&
|
|
2404
2436
|
u >= o &&
|
|
2405
|
-
(this.
|
|
2437
|
+
(this.Fe[s] === e[u] || (this.Ye && compare(this.Ke, this.Fe[s], e[u])));
|
|
2406
2438
|
s--, u--
|
|
2407
2439
|
) {
|
|
2408
|
-
E[u] = this.
|
|
2409
|
-
T[u] = this
|
|
2410
|
-
d && (d[u] = this.
|
|
2411
|
-
R && (R[u] = this.
|
|
2440
|
+
E[u] = this.He[s];
|
|
2441
|
+
T[u] = this.je[s];
|
|
2442
|
+
d && (d[u] = this.Ye[s]);
|
|
2443
|
+
R && (R[u] = this.Be[s]);
|
|
2412
2444
|
}
|
|
2413
2445
|
a = new Map();
|
|
2414
2446
|
f = new Array(u + 1);
|
|
2415
2447
|
for (i = u; i >= o; i--) {
|
|
2416
2448
|
c = e[i];
|
|
2417
|
-
l = this.
|
|
2449
|
+
l = this.Ke ? this.Ke(c) : c;
|
|
2418
2450
|
n = a.get(l);
|
|
2419
2451
|
f[i] = n === undefined ? -1 : n;
|
|
2420
2452
|
a.set(l, i);
|
|
2421
2453
|
}
|
|
2422
2454
|
for (n = o; n <= s; n++) {
|
|
2423
|
-
c = this.
|
|
2424
|
-
l = this.
|
|
2455
|
+
c = this.Fe[n];
|
|
2456
|
+
l = this.Ke ? this.Ke(c) : c;
|
|
2425
2457
|
i = a.get(l);
|
|
2426
2458
|
if (i !== undefined && i !== -1) {
|
|
2427
|
-
E[i] = this.
|
|
2428
|
-
T[i] = this
|
|
2429
|
-
d && (d[i] = this.
|
|
2430
|
-
R && (R[i] = this.
|
|
2459
|
+
E[i] = this.He[n];
|
|
2460
|
+
T[i] = this.je[n];
|
|
2461
|
+
d && (d[i] = this.Ye[n]);
|
|
2462
|
+
R && (R[i] = this.Be[n]);
|
|
2431
2463
|
i = f[i];
|
|
2432
2464
|
a.set(l, i);
|
|
2433
|
-
} else this
|
|
2465
|
+
} else this.je[n].dispose();
|
|
2434
2466
|
}
|
|
2435
2467
|
for (i = o; i < t; i++) {
|
|
2436
2468
|
if (i in E) {
|
|
2437
|
-
this.
|
|
2438
|
-
this
|
|
2469
|
+
this.He[i] = E[i];
|
|
2470
|
+
this.je[i] = T[i];
|
|
2439
2471
|
if (d) {
|
|
2440
|
-
this.
|
|
2441
|
-
setSignal(this.
|
|
2472
|
+
this.Ye[i] = d[i];
|
|
2473
|
+
setSignal(this.Ye[i], e[i]);
|
|
2442
2474
|
}
|
|
2443
2475
|
if (R) {
|
|
2444
|
-
this.
|
|
2445
|
-
setSignal(this.
|
|
2476
|
+
this.Be[i] = R[i];
|
|
2477
|
+
setSignal(this.Be[i], i);
|
|
2446
2478
|
}
|
|
2447
2479
|
} else {
|
|
2448
|
-
this.
|
|
2480
|
+
this.He[i] = runWithOwner((this.je[i] = createOwner()), r);
|
|
2449
2481
|
}
|
|
2450
2482
|
}
|
|
2451
|
-
this.
|
|
2452
|
-
this.
|
|
2483
|
+
this.He = this.He.slice(0, (this.Ge = t));
|
|
2484
|
+
this.Fe = e.slice(0);
|
|
2453
2485
|
}
|
|
2454
2486
|
});
|
|
2455
|
-
return this.
|
|
2487
|
+
return this.He;
|
|
2456
2488
|
}
|
|
2457
2489
|
function repeat(e, t, n) {
|
|
2458
2490
|
return updateRepeat.bind({
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2491
|
+
xe: createOwner(),
|
|
2492
|
+
Ge: 0,
|
|
2493
|
+
qe: 0,
|
|
2494
|
+
ze: e,
|
|
2495
|
+
$e: t,
|
|
2496
|
+
je: [],
|
|
2497
|
+
He: [],
|
|
2498
|
+
Ze: n?.from,
|
|
2499
|
+
Xe: n?.fallback
|
|
2468
2500
|
});
|
|
2469
2501
|
}
|
|
2470
2502
|
function updateRepeat() {
|
|
2471
|
-
const e = this.
|
|
2472
|
-
const t = this.
|
|
2473
|
-
runWithOwner(this.
|
|
2503
|
+
const e = this.ze();
|
|
2504
|
+
const t = this.Ze?.() || 0;
|
|
2505
|
+
runWithOwner(this.xe, () => {
|
|
2474
2506
|
if (e === 0) {
|
|
2475
|
-
if (this.
|
|
2476
|
-
this.
|
|
2477
|
-
this
|
|
2478
|
-
this.
|
|
2479
|
-
this.
|
|
2507
|
+
if (this.Ge !== 0) {
|
|
2508
|
+
this.xe.dispose(false);
|
|
2509
|
+
this.je = [];
|
|
2510
|
+
this.He = [];
|
|
2511
|
+
this.Ge = 0;
|
|
2480
2512
|
}
|
|
2481
|
-
if (this.
|
|
2482
|
-
this.
|
|
2513
|
+
if (this.Xe && !this.He[0]) {
|
|
2514
|
+
this.He[0] = runWithOwner((this.je[0] = createOwner()), this.Xe);
|
|
2483
2515
|
}
|
|
2484
2516
|
return;
|
|
2485
2517
|
}
|
|
2486
2518
|
const n = t + e;
|
|
2487
|
-
const i = this.
|
|
2488
|
-
if (this.
|
|
2489
|
-
for (let e = n; e < i; e++) this
|
|
2490
|
-
if (this.
|
|
2491
|
-
let e = this.
|
|
2492
|
-
while (e < t && e < this.
|
|
2493
|
-
this
|
|
2494
|
-
this.
|
|
2495
|
-
} else if (this.
|
|
2496
|
-
let n = i - this.
|
|
2497
|
-
let r = this.
|
|
2498
|
-
this
|
|
2519
|
+
const i = this.qe + this.Ge;
|
|
2520
|
+
if (this.Ge === 0 && this.je[0]) this.je[0].dispose();
|
|
2521
|
+
for (let e = n; e < i; e++) this.je[e - this.qe].dispose();
|
|
2522
|
+
if (this.qe < t) {
|
|
2523
|
+
let e = this.qe;
|
|
2524
|
+
while (e < t && e < this.Ge) this.je[e++].dispose();
|
|
2525
|
+
this.je.splice(0, t - this.qe);
|
|
2526
|
+
this.He.splice(0, t - this.qe);
|
|
2527
|
+
} else if (this.qe > t) {
|
|
2528
|
+
let n = i - this.qe - 1;
|
|
2529
|
+
let r = this.qe - t;
|
|
2530
|
+
this.je.length = this.He.length = e;
|
|
2499
2531
|
while (n >= r) {
|
|
2500
|
-
this
|
|
2501
|
-
this.
|
|
2532
|
+
this.je[n] = this.je[n - r];
|
|
2533
|
+
this.He[n] = this.He[n - r];
|
|
2502
2534
|
n--;
|
|
2503
2535
|
}
|
|
2504
2536
|
for (let e = 0; e < r; e++) {
|
|
2505
|
-
this.
|
|
2537
|
+
this.He[e] = runWithOwner((this.je[e] = createOwner()), () => this.$e(e + t));
|
|
2506
2538
|
}
|
|
2507
2539
|
}
|
|
2508
2540
|
for (let e = i; e < n; e++) {
|
|
2509
|
-
this.
|
|
2541
|
+
this.He[e - t] = runWithOwner((this.je[e - t] = createOwner()), () => this.$e(e));
|
|
2510
2542
|
}
|
|
2511
|
-
this.
|
|
2512
|
-
this.
|
|
2513
|
-
this.
|
|
2543
|
+
this.He = this.He.slice(0, e);
|
|
2544
|
+
this.qe = t;
|
|
2545
|
+
this.Ge = e;
|
|
2514
2546
|
});
|
|
2515
|
-
return this.
|
|
2547
|
+
return this.He;
|
|
2516
2548
|
}
|
|
2517
2549
|
function compare(e, t, n) {
|
|
2518
2550
|
return e ? e(t) === e(n) : true;
|
|
2519
2551
|
}
|
|
2520
2552
|
function boundaryComputed(e, t) {
|
|
2521
2553
|
const n = computed(e, undefined, { lazy: true });
|
|
2522
|
-
n.
|
|
2523
|
-
const i = e !== undefined ? e : n.
|
|
2524
|
-
const r = t !== undefined ? t : n.
|
|
2525
|
-
n.
|
|
2526
|
-
n.
|
|
2554
|
+
n.Pe = (e, t) => {
|
|
2555
|
+
const i = e !== undefined ? e : n.Oe;
|
|
2556
|
+
const r = t !== undefined ? t : n.se;
|
|
2557
|
+
n.Oe &= ~n.Je;
|
|
2558
|
+
n.Te.notify(n, n.Je, i, r);
|
|
2527
2559
|
};
|
|
2528
|
-
n.
|
|
2529
|
-
n.
|
|
2560
|
+
n.Je = t;
|
|
2561
|
+
n.ve = true;
|
|
2530
2562
|
recompute(n, true);
|
|
2531
2563
|
return n;
|
|
2532
2564
|
}
|
|
2533
2565
|
function createBoundChildren(e, t, n, i) {
|
|
2534
|
-
const r = e.
|
|
2535
|
-
r.addChild((e.
|
|
2536
|
-
onCleanup(() => r.removeChild(e.
|
|
2566
|
+
const r = e.Te;
|
|
2567
|
+
r.addChild((e.Te = n));
|
|
2568
|
+
onCleanup(() => r.removeChild(e.Te));
|
|
2537
2569
|
return runWithOwner(e, () => {
|
|
2538
2570
|
const e = computed(t);
|
|
2539
2571
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
2540
2572
|
});
|
|
2541
2573
|
}
|
|
2542
2574
|
class ConditionalQueue extends Queue {
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2575
|
+
et;
|
|
2576
|
+
tt = new Set();
|
|
2577
|
+
J = new Set();
|
|
2546
2578
|
constructor(e) {
|
|
2547
2579
|
super();
|
|
2548
|
-
this.
|
|
2580
|
+
this.et = e;
|
|
2549
2581
|
}
|
|
2550
2582
|
run(e) {
|
|
2551
|
-
if (!e || read(this.
|
|
2583
|
+
if (!e || read(this.et)) return;
|
|
2552
2584
|
return super.run(e);
|
|
2553
2585
|
}
|
|
2554
2586
|
notify(e, t, n, i) {
|
|
2555
|
-
if (read(this.
|
|
2587
|
+
if (read(this.et)) {
|
|
2556
2588
|
if (t & STATUS_PENDING) {
|
|
2557
2589
|
if (n & STATUS_PENDING) {
|
|
2558
|
-
this.
|
|
2590
|
+
this.J.add(e);
|
|
2559
2591
|
t &= ~STATUS_PENDING;
|
|
2560
|
-
} else if (this.
|
|
2592
|
+
} else if (this.J.delete(e)) t &= ~STATUS_PENDING;
|
|
2561
2593
|
}
|
|
2562
2594
|
if (t & STATUS_ERROR) {
|
|
2563
2595
|
if (n & STATUS_ERROR) {
|
|
2564
|
-
this.
|
|
2596
|
+
this.tt.add(e);
|
|
2565
2597
|
t &= ~STATUS_ERROR;
|
|
2566
|
-
} else if (this.
|
|
2598
|
+
} else if (this.tt.delete(e)) t &= ~STATUS_ERROR;
|
|
2567
2599
|
}
|
|
2568
2600
|
}
|
|
2569
|
-
return t ? super.notify(e, t, n, i ?? e.
|
|
2601
|
+
return t ? super.notify(e, t, n, i ?? e.se) : true;
|
|
2570
2602
|
}
|
|
2571
2603
|
}
|
|
2572
2604
|
class CollectionQueue extends Queue {
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2605
|
+
nt;
|
|
2606
|
+
it = new Set();
|
|
2607
|
+
et = signal(false, { pureWrite: true });
|
|
2608
|
+
rt = false;
|
|
2577
2609
|
constructor(e) {
|
|
2578
2610
|
super();
|
|
2579
|
-
this.
|
|
2611
|
+
this.nt = e;
|
|
2580
2612
|
}
|
|
2581
2613
|
run(e) {
|
|
2582
|
-
if (!e || read(this.
|
|
2614
|
+
if (!e || read(this.et)) return;
|
|
2583
2615
|
return super.run(e);
|
|
2584
2616
|
}
|
|
2585
2617
|
notify(e, t, n, i) {
|
|
2586
|
-
if (!(t & this.
|
|
2587
|
-
if (n & this.
|
|
2588
|
-
const t = i?.t || e.
|
|
2618
|
+
if (!(t & this.nt) || (this.nt & STATUS_PENDING && this.rt)) return super.notify(e, t, n, i);
|
|
2619
|
+
if (n & this.nt) {
|
|
2620
|
+
const t = i?.t || e.se?.t;
|
|
2589
2621
|
if (t) {
|
|
2590
|
-
const e = this.
|
|
2591
|
-
this.
|
|
2592
|
-
if (e) setSignal(this.
|
|
2622
|
+
const e = this.it.size === 0;
|
|
2623
|
+
this.it.add(t);
|
|
2624
|
+
if (e) setSignal(this.et, true);
|
|
2593
2625
|
}
|
|
2594
2626
|
}
|
|
2595
|
-
t &= ~this.
|
|
2627
|
+
t &= ~this.nt;
|
|
2596
2628
|
return t ? super.notify(e, t, n, i) : true;
|
|
2597
2629
|
}
|
|
2598
2630
|
checkSources() {
|
|
2599
|
-
for (const e of this.
|
|
2600
|
-
if (!(e.
|
|
2631
|
+
for (const e of this.it) {
|
|
2632
|
+
if (!(e.Oe & this.nt)) this.it.delete(e);
|
|
2601
2633
|
}
|
|
2602
|
-
if (!this.
|
|
2634
|
+
if (!this.it.size) setSignal(this.et, false);
|
|
2603
2635
|
}
|
|
2604
2636
|
}
|
|
2605
2637
|
var BoundaryMode;
|
|
@@ -2612,26 +2644,26 @@ function createBoundary(e, t) {
|
|
|
2612
2644
|
const i = new ConditionalQueue(computed(() => t() === BoundaryMode.HIDDEN));
|
|
2613
2645
|
const r = createBoundChildren(n, e, i, 0);
|
|
2614
2646
|
computed(() => {
|
|
2615
|
-
const e = read(i.
|
|
2616
|
-
r.
|
|
2647
|
+
const e = read(i.et);
|
|
2648
|
+
r.Je = e ? STATUS_ERROR | STATUS_PENDING : 0;
|
|
2617
2649
|
if (!e) {
|
|
2618
|
-
i.
|
|
2619
|
-
i.
|
|
2620
|
-
i.
|
|
2621
|
-
i.
|
|
2650
|
+
i.J.forEach(e => i.notify(e, STATUS_PENDING, STATUS_PENDING, e.se));
|
|
2651
|
+
i.tt.forEach(e => i.notify(e, STATUS_ERROR, STATUS_ERROR, e.se));
|
|
2652
|
+
i.J.clear();
|
|
2653
|
+
i.tt.clear();
|
|
2622
2654
|
}
|
|
2623
2655
|
});
|
|
2624
|
-
return () => (read(i.
|
|
2656
|
+
return () => (read(i.et) ? undefined : read(r));
|
|
2625
2657
|
}
|
|
2626
2658
|
function createCollectionBoundary(e, t, n) {
|
|
2627
2659
|
const i = createOwner();
|
|
2628
2660
|
const r = new CollectionQueue(e);
|
|
2629
2661
|
const o = createBoundChildren(i, t, r, e);
|
|
2630
2662
|
const s = computed(() => {
|
|
2631
|
-
if (!read(r.
|
|
2663
|
+
if (!read(r.et)) {
|
|
2632
2664
|
const e = read(o);
|
|
2633
|
-
if (!untrack(() => read(r.
|
|
2634
|
-
r.
|
|
2665
|
+
if (!untrack(() => read(r.et))) {
|
|
2666
|
+
r.rt = true;
|
|
2635
2667
|
return e;
|
|
2636
2668
|
}
|
|
2637
2669
|
}
|
|
@@ -2644,10 +2676,10 @@ function createLoadBoundary(e, t) {
|
|
|
2644
2676
|
}
|
|
2645
2677
|
function createErrorBoundary(e, t) {
|
|
2646
2678
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2647
|
-
let n = e.
|
|
2648
|
-
const i = n.
|
|
2679
|
+
let n = e.it.values().next().value;
|
|
2680
|
+
const i = n.se?.cause ?? n.se;
|
|
2649
2681
|
return t(i, () => {
|
|
2650
|
-
for (const t of e.
|
|
2682
|
+
for (const t of e.it) recompute(t);
|
|
2651
2683
|
schedule();
|
|
2652
2684
|
});
|
|
2653
2685
|
});
|