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