@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/node.cjs
CHANGED
|
@@ -156,64 +156,71 @@ function getOrCreateLane(e) {
|
|
|
156
156
|
if (t) {
|
|
157
157
|
return findLane(t);
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
const n = e.T;
|
|
160
|
+
const r = n?.M ? findLane(n.M) : null;
|
|
161
|
+
t = { t: e, q: new Set(), F: [[], []], V: null, B: x, D: r };
|
|
160
162
|
C.set(e, t);
|
|
161
163
|
k.add(t);
|
|
162
|
-
e.
|
|
164
|
+
e.G = e.K || 0;
|
|
163
165
|
return t;
|
|
164
166
|
}
|
|
165
167
|
function findLane(e) {
|
|
166
|
-
while (e.
|
|
168
|
+
while (e.V) e = e.V;
|
|
167
169
|
return e;
|
|
168
170
|
}
|
|
169
171
|
function mergeLanes(e, t) {
|
|
170
172
|
e = findLane(e);
|
|
171
173
|
t = findLane(t);
|
|
172
174
|
if (e === t) return e;
|
|
173
|
-
t.
|
|
174
|
-
for (const n of t.
|
|
175
|
-
e.
|
|
176
|
-
e.
|
|
175
|
+
t.V = e;
|
|
176
|
+
for (const n of t.q) e.q.add(n);
|
|
177
|
+
e.F[0].push(...t.F[0]);
|
|
178
|
+
e.F[1].push(...t.F[1]);
|
|
177
179
|
return e;
|
|
178
180
|
}
|
|
179
181
|
function clearLaneEntry(e) {
|
|
180
182
|
C.delete(e);
|
|
181
183
|
}
|
|
182
184
|
function resolveLane(e) {
|
|
183
|
-
const t = e.
|
|
185
|
+
const t = e.M;
|
|
184
186
|
if (!t) return undefined;
|
|
185
187
|
const n = findLane(t);
|
|
186
188
|
if (k.has(n)) return n;
|
|
187
|
-
e.
|
|
189
|
+
e.M = undefined;
|
|
188
190
|
return undefined;
|
|
189
191
|
}
|
|
190
192
|
function hasActiveOverride(e) {
|
|
191
|
-
return !!(e.
|
|
193
|
+
return !!(e.U && e.J !== y);
|
|
192
194
|
}
|
|
193
195
|
function assignOrMergeLane(e, t) {
|
|
194
196
|
const n = findLane(t);
|
|
195
|
-
const r = e.
|
|
197
|
+
const r = e.M;
|
|
196
198
|
if (r) {
|
|
197
|
-
if (r.
|
|
198
|
-
e.
|
|
199
|
+
if (r.V) {
|
|
200
|
+
e.M = t;
|
|
199
201
|
return;
|
|
200
202
|
}
|
|
201
203
|
const i = findLane(r);
|
|
202
204
|
if (k.has(i)) {
|
|
203
205
|
if (i !== n && !hasActiveOverride(e)) {
|
|
204
|
-
|
|
206
|
+
if (n.D && findLane(n.D) === i) {
|
|
207
|
+
e.M = t;
|
|
208
|
+
} else if (i.D && findLane(i.D) === n);
|
|
209
|
+
else {
|
|
210
|
+
mergeLanes(n, i);
|
|
211
|
+
}
|
|
205
212
|
}
|
|
206
213
|
return;
|
|
207
214
|
}
|
|
208
215
|
}
|
|
209
|
-
e.
|
|
216
|
+
e.M = t;
|
|
210
217
|
}
|
|
211
218
|
function runLaneEffects(e) {
|
|
212
219
|
for (const t of k) {
|
|
213
|
-
if (t.
|
|
214
|
-
const n = t.
|
|
220
|
+
if (t.V || t.q.size > 0) continue;
|
|
221
|
+
const n = t.F[e - 1];
|
|
215
222
|
if (n.length) {
|
|
216
|
-
t.
|
|
223
|
+
t.F[e - 1] = [];
|
|
217
224
|
runQueue(n, e);
|
|
218
225
|
}
|
|
219
226
|
}
|
|
@@ -224,21 +231,21 @@ function setProjectionWriteActive(e) {
|
|
|
224
231
|
function schedule() {
|
|
225
232
|
if (v) return;
|
|
226
233
|
v = true;
|
|
227
|
-
if (!E.
|
|
234
|
+
if (!E.X) queueMicrotask(flush);
|
|
228
235
|
}
|
|
229
236
|
class Queue {
|
|
230
237
|
o = null;
|
|
231
|
-
|
|
232
|
-
|
|
238
|
+
Y = [[], []];
|
|
239
|
+
Z = [];
|
|
233
240
|
created = O;
|
|
234
241
|
addChild(e) {
|
|
235
|
-
this.
|
|
242
|
+
this.Z.push(e);
|
|
236
243
|
e.o = this;
|
|
237
244
|
}
|
|
238
245
|
removeChild(e) {
|
|
239
|
-
const t = this.
|
|
246
|
+
const t = this.Z.indexOf(e);
|
|
240
247
|
if (t >= 0) {
|
|
241
|
-
this.
|
|
248
|
+
this.Z.splice(t, 1);
|
|
242
249
|
e.o = null;
|
|
243
250
|
}
|
|
244
251
|
}
|
|
@@ -247,88 +254,88 @@ class Queue {
|
|
|
247
254
|
return false;
|
|
248
255
|
}
|
|
249
256
|
run(e) {
|
|
250
|
-
if (this.
|
|
251
|
-
const t = this.
|
|
252
|
-
this.
|
|
257
|
+
if (this.Y[e - 1].length) {
|
|
258
|
+
const t = this.Y[e - 1];
|
|
259
|
+
this.Y[e - 1] = [];
|
|
253
260
|
runQueue(t, e);
|
|
254
261
|
}
|
|
255
|
-
for (let t = 0; t < this.
|
|
262
|
+
for (let t = 0; t < this.Z.length; t++) this.Z[t].run?.(e);
|
|
256
263
|
}
|
|
257
264
|
enqueue(e, t) {
|
|
258
265
|
if (e) {
|
|
259
266
|
if (A) {
|
|
260
267
|
const n = findLane(A);
|
|
261
|
-
n.
|
|
268
|
+
n.F[e - 1].push(t);
|
|
262
269
|
} else {
|
|
263
|
-
this.
|
|
270
|
+
this.Y[e - 1].push(t);
|
|
264
271
|
}
|
|
265
272
|
}
|
|
266
273
|
schedule();
|
|
267
274
|
}
|
|
268
275
|
stashQueues(e) {
|
|
269
|
-
e.
|
|
270
|
-
e.
|
|
271
|
-
this.
|
|
272
|
-
for (let t = 0; t < this.
|
|
273
|
-
let n = this.
|
|
274
|
-
let r = e.
|
|
276
|
+
e.Y[0].push(...this.Y[0]);
|
|
277
|
+
e.Y[1].push(...this.Y[1]);
|
|
278
|
+
this.Y = [[], []];
|
|
279
|
+
for (let t = 0; t < this.Z.length; t++) {
|
|
280
|
+
let n = this.Z[t];
|
|
281
|
+
let r = e.Z[t];
|
|
275
282
|
if (!r) {
|
|
276
|
-
r = {
|
|
277
|
-
e.
|
|
283
|
+
r = { Y: [[], []], Z: [] };
|
|
284
|
+
e.Z[t] = r;
|
|
278
285
|
}
|
|
279
286
|
n.stashQueues(r);
|
|
280
287
|
}
|
|
281
288
|
}
|
|
282
289
|
restoreQueues(e) {
|
|
283
|
-
this.
|
|
284
|
-
this.
|
|
285
|
-
for (let t = 0; t < e.
|
|
286
|
-
const n = e.
|
|
287
|
-
let r = this.
|
|
290
|
+
this.Y[0].push(...e.Y[0]);
|
|
291
|
+
this.Y[1].push(...e.Y[1]);
|
|
292
|
+
for (let t = 0; t < e.Z.length; t++) {
|
|
293
|
+
const n = e.Z[t];
|
|
294
|
+
let r = this.Z[t];
|
|
288
295
|
if (r) r.restoreQueues(n);
|
|
289
296
|
}
|
|
290
297
|
}
|
|
291
298
|
}
|
|
292
299
|
class GlobalQueue extends Queue {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
static
|
|
298
|
-
static
|
|
299
|
-
static
|
|
300
|
+
X = false;
|
|
301
|
+
$ = [];
|
|
302
|
+
ee = [];
|
|
303
|
+
te = new Set();
|
|
304
|
+
static ne;
|
|
305
|
+
static re;
|
|
306
|
+
static ie = null;
|
|
300
307
|
flush() {
|
|
301
|
-
if (this.
|
|
302
|
-
this.
|
|
308
|
+
if (this.X) return;
|
|
309
|
+
this.X = true;
|
|
303
310
|
try {
|
|
304
|
-
runHeap(_, GlobalQueue.
|
|
311
|
+
runHeap(_, GlobalQueue.ne);
|
|
305
312
|
if (x) {
|
|
306
313
|
const e = transitionComplete(x);
|
|
307
314
|
if (!e) {
|
|
308
315
|
let e = x;
|
|
309
|
-
runHeap(b, GlobalQueue.
|
|
310
|
-
this
|
|
311
|
-
this.
|
|
312
|
-
this
|
|
316
|
+
runHeap(b, GlobalQueue.ne);
|
|
317
|
+
this.$ = [];
|
|
318
|
+
this.ee = [];
|
|
319
|
+
this.te = new Set();
|
|
313
320
|
runLaneEffects(d);
|
|
314
321
|
runLaneEffects(p);
|
|
315
|
-
this.stashQueues(x.
|
|
322
|
+
this.stashQueues(x.se);
|
|
316
323
|
O++;
|
|
317
324
|
v = _.m >= _.j;
|
|
318
|
-
reassignPendingTransition(x
|
|
325
|
+
reassignPendingTransition(x.$);
|
|
319
326
|
x = null;
|
|
320
327
|
finalizePureQueue(null, true);
|
|
321
328
|
return;
|
|
322
329
|
}
|
|
323
|
-
this
|
|
324
|
-
this.restoreQueues(x.
|
|
330
|
+
this.$ !== x.$ && this.$.push(...x.$);
|
|
331
|
+
this.restoreQueues(x.se);
|
|
325
332
|
m.delete(x);
|
|
326
333
|
const t = x;
|
|
327
334
|
x = null;
|
|
328
|
-
reassignPendingTransition(this
|
|
335
|
+
reassignPendingTransition(this.$);
|
|
329
336
|
finalizePureQueue(t);
|
|
330
337
|
} else {
|
|
331
|
-
if (m.size) runHeap(b, GlobalQueue.
|
|
338
|
+
if (m.size) runHeap(b, GlobalQueue.ne);
|
|
332
339
|
finalizePureQueue();
|
|
333
340
|
}
|
|
334
341
|
O++;
|
|
@@ -338,15 +345,15 @@ class GlobalQueue extends Queue {
|
|
|
338
345
|
runLaneEffects(p);
|
|
339
346
|
this.run(p);
|
|
340
347
|
} finally {
|
|
341
|
-
this.
|
|
348
|
+
this.X = false;
|
|
342
349
|
}
|
|
343
350
|
}
|
|
344
351
|
notify(e, t, n, r) {
|
|
345
352
|
if (t & l) {
|
|
346
353
|
if (n & l) {
|
|
347
|
-
const t = r !== undefined ? r : e.
|
|
348
|
-
if (x && t && !x.
|
|
349
|
-
x.
|
|
354
|
+
const t = r !== undefined ? r : e.oe;
|
|
355
|
+
if (x && t && !x.ue.includes(t.t)) {
|
|
356
|
+
x.ue.push(t.t);
|
|
350
357
|
schedule();
|
|
351
358
|
}
|
|
352
359
|
}
|
|
@@ -357,68 +364,68 @@ class GlobalQueue extends Queue {
|
|
|
357
364
|
initTransition(e) {
|
|
358
365
|
if (e) e = currentTransition(e);
|
|
359
366
|
if (e && e === x) return;
|
|
360
|
-
if (!e && x && x.
|
|
367
|
+
if (!e && x && x.fe === O) return;
|
|
361
368
|
if (!x) {
|
|
362
369
|
x = e ?? {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
se: [],
|
|
366
|
-
Z: [],
|
|
367
|
-
$: new Set(),
|
|
370
|
+
fe: O,
|
|
371
|
+
$: [],
|
|
368
372
|
ue: [],
|
|
369
|
-
|
|
370
|
-
|
|
373
|
+
ee: [],
|
|
374
|
+
te: new Set(),
|
|
375
|
+
le: [],
|
|
376
|
+
se: { Y: [[], []], Z: [] },
|
|
377
|
+
ce: false
|
|
371
378
|
};
|
|
372
379
|
} else if (e) {
|
|
373
380
|
const t = x;
|
|
374
|
-
t.
|
|
375
|
-
e.
|
|
381
|
+
t.ce = e;
|
|
382
|
+
e.le.push(...t.le);
|
|
376
383
|
for (const n of k) {
|
|
377
|
-
if (n.
|
|
384
|
+
if (n.B === t) n.B = e;
|
|
378
385
|
}
|
|
379
|
-
e.
|
|
380
|
-
for (const n of t
|
|
381
|
-
e
|
|
386
|
+
e.ee.push(...t.ee);
|
|
387
|
+
for (const n of t.te) {
|
|
388
|
+
e.te.add(n);
|
|
382
389
|
}
|
|
383
390
|
m.delete(t);
|
|
384
391
|
x = e;
|
|
385
392
|
}
|
|
386
393
|
m.add(x);
|
|
387
|
-
x.
|
|
388
|
-
for (let e = 0; e < this
|
|
389
|
-
const t = this
|
|
390
|
-
t.
|
|
391
|
-
x
|
|
392
|
-
}
|
|
393
|
-
this.Y = x.Y;
|
|
394
|
-
for (let e = 0; e < this.Z.length; e++) {
|
|
395
|
-
const t = this.Z[e];
|
|
396
|
-
t.F = x;
|
|
397
|
-
x.Z.push(t);
|
|
398
|
-
}
|
|
399
|
-
this.Z = x.Z;
|
|
400
|
-
for (const e of k) {
|
|
401
|
-
if (!e.F) e.F = x;
|
|
394
|
+
x.fe = O;
|
|
395
|
+
for (let e = 0; e < this.$.length; e++) {
|
|
396
|
+
const t = this.$[e];
|
|
397
|
+
t.B = x;
|
|
398
|
+
x.$.push(t);
|
|
402
399
|
}
|
|
403
|
-
for (const e of this.$) x.$.add(e);
|
|
404
400
|
this.$ = x.$;
|
|
401
|
+
for (let e = 0; e < this.ee.length; e++) {
|
|
402
|
+
const t = this.ee[e];
|
|
403
|
+
t.B = x;
|
|
404
|
+
x.ee.push(t);
|
|
405
|
+
}
|
|
406
|
+
this.ee = x.ee;
|
|
407
|
+
for (const e of k) {
|
|
408
|
+
if (!e.B) e.B = x;
|
|
409
|
+
}
|
|
410
|
+
for (const e of this.te) x.te.add(e);
|
|
411
|
+
this.te = x.te;
|
|
405
412
|
}
|
|
406
413
|
}
|
|
407
414
|
function insertSubs(e, t = false) {
|
|
408
|
-
const n = e.
|
|
415
|
+
const n = e.M || A;
|
|
409
416
|
for (let r = e.P; r !== null; r = r.C) {
|
|
410
417
|
if (t && n) {
|
|
411
418
|
r.k._ |= f;
|
|
412
419
|
assignOrMergeLane(r.k, n);
|
|
413
420
|
} else if (t) {
|
|
414
421
|
r.k._ |= f;
|
|
415
|
-
r.k.
|
|
422
|
+
r.k.M = undefined;
|
|
416
423
|
}
|
|
417
424
|
const e = r.k;
|
|
418
|
-
if (e.
|
|
419
|
-
if (!e.
|
|
420
|
-
e.
|
|
421
|
-
e.
|
|
425
|
+
if (e.ae === h) {
|
|
426
|
+
if (!e.de) {
|
|
427
|
+
e.de = true;
|
|
428
|
+
e.pe.enqueue(p, e.he);
|
|
422
429
|
}
|
|
423
430
|
continue;
|
|
424
431
|
}
|
|
@@ -430,70 +437,70 @@ function insertSubs(e, t = false) {
|
|
|
430
437
|
function finalizePureQueue(e = null, t = false) {
|
|
431
438
|
let n = !t;
|
|
432
439
|
if (!t) checkBoundaryChildren(E);
|
|
433
|
-
if (_.m >= _.j) runHeap(_, GlobalQueue.
|
|
440
|
+
if (_.m >= _.j) runHeap(_, GlobalQueue.ne);
|
|
434
441
|
if (n) {
|
|
435
|
-
const t = E
|
|
442
|
+
const t = E.$;
|
|
436
443
|
for (let e = 0; e < t.length; e++) {
|
|
437
444
|
const n = t[e];
|
|
438
|
-
if (n.
|
|
439
|
-
n.
|
|
440
|
-
n.
|
|
441
|
-
if (n.
|
|
445
|
+
if (n.J !== y) {
|
|
446
|
+
n.ye = n.J;
|
|
447
|
+
n.J = y;
|
|
448
|
+
if (n.ae && n.ae !== h) n.de = true;
|
|
442
449
|
}
|
|
443
|
-
n.
|
|
444
|
-
if (n.R) GlobalQueue.
|
|
450
|
+
n.ge &= ~a;
|
|
451
|
+
if (n.R) GlobalQueue.re(n, false, true);
|
|
445
452
|
}
|
|
446
453
|
t.length = 0;
|
|
447
|
-
const n = e ? e.
|
|
454
|
+
const n = e ? e.ee : E.ee;
|
|
448
455
|
for (let e = 0; e < n.length; e++) {
|
|
449
456
|
const t = n[e];
|
|
450
|
-
const r = t.
|
|
451
|
-
t.
|
|
452
|
-
if (r !== y && t.
|
|
453
|
-
t.
|
|
457
|
+
const r = t.J;
|
|
458
|
+
t.M = undefined;
|
|
459
|
+
if (r !== y && t.ye !== r) {
|
|
460
|
+
t.ye = r;
|
|
454
461
|
insertSubs(t, true);
|
|
455
462
|
}
|
|
456
|
-
t.
|
|
457
|
-
t.
|
|
463
|
+
t.J = y;
|
|
464
|
+
t.B = null;
|
|
458
465
|
}
|
|
459
466
|
n.length = 0;
|
|
460
|
-
const r = e ? e
|
|
461
|
-
if (GlobalQueue.
|
|
467
|
+
const r = e ? e.te : E.te;
|
|
468
|
+
if (GlobalQueue.ie && r.size) {
|
|
462
469
|
for (const e of r) {
|
|
463
|
-
GlobalQueue.
|
|
470
|
+
GlobalQueue.ie(e);
|
|
464
471
|
}
|
|
465
472
|
r.clear();
|
|
466
473
|
schedule();
|
|
467
474
|
}
|
|
468
475
|
for (const t of k) {
|
|
469
|
-
const n = e ? t.
|
|
476
|
+
const n = e ? t.B === e : !t.B;
|
|
470
477
|
if (!n) continue;
|
|
471
|
-
if (!t.
|
|
472
|
-
if (t.
|
|
473
|
-
if (t.
|
|
474
|
-
}
|
|
475
|
-
if (t.t.
|
|
476
|
-
t.
|
|
477
|
-
t.
|
|
478
|
-
t.
|
|
478
|
+
if (!t.V) {
|
|
479
|
+
if (t.F[0].length) runQueue(t.F[0], d);
|
|
480
|
+
if (t.F[1].length) runQueue(t.F[1], p);
|
|
481
|
+
}
|
|
482
|
+
if (t.t.M === t) t.t.M = undefined;
|
|
483
|
+
t.q.clear();
|
|
484
|
+
t.F[0].length = 0;
|
|
485
|
+
t.F[1].length = 0;
|
|
479
486
|
k.delete(t);
|
|
480
487
|
C.delete(t.t);
|
|
481
488
|
}
|
|
482
489
|
}
|
|
483
490
|
}
|
|
484
491
|
function checkBoundaryChildren(e) {
|
|
485
|
-
for (const t of e.
|
|
492
|
+
for (const t of e.Z) {
|
|
486
493
|
t.checkSources?.();
|
|
487
494
|
checkBoundaryChildren(t);
|
|
488
495
|
}
|
|
489
496
|
}
|
|
490
497
|
function trackOptimisticStore(e) {
|
|
491
|
-
E
|
|
498
|
+
E.te.add(e);
|
|
492
499
|
schedule();
|
|
493
500
|
}
|
|
494
501
|
function reassignPendingTransition(e) {
|
|
495
502
|
for (let t = 0; t < e.length; t++) {
|
|
496
|
-
e[t].
|
|
503
|
+
e[t].B = x;
|
|
497
504
|
}
|
|
498
505
|
}
|
|
499
506
|
const E = new GlobalQueue();
|
|
@@ -506,20 +513,21 @@ function runQueue(e, t) {
|
|
|
506
513
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
507
514
|
}
|
|
508
515
|
function transitionComplete(e) {
|
|
509
|
-
if (e.
|
|
510
|
-
if (e.
|
|
516
|
+
if (e.ce) return true;
|
|
517
|
+
if (e.le.length) return false;
|
|
511
518
|
let t = true;
|
|
512
|
-
for (let n = 0; n < e.
|
|
513
|
-
|
|
519
|
+
for (let n = 0; n < e.ue.length; n++) {
|
|
520
|
+
const r = e.ue[n];
|
|
521
|
+
if (r.ge & l && r.oe?.t === r) {
|
|
514
522
|
t = false;
|
|
515
523
|
break;
|
|
516
524
|
}
|
|
517
525
|
}
|
|
518
|
-
t && (e.
|
|
526
|
+
t && (e.ce = true);
|
|
519
527
|
return t;
|
|
520
528
|
}
|
|
521
529
|
function currentTransition(e) {
|
|
522
|
-
while (e.
|
|
530
|
+
while (e.ce && typeof e.ce === "object") e = e.ce;
|
|
523
531
|
return e;
|
|
524
532
|
}
|
|
525
533
|
function runInTransition(e, t) {
|
|
@@ -543,11 +551,11 @@ function action(e) {
|
|
|
543
551
|
const i = e(...t);
|
|
544
552
|
E.initTransition();
|
|
545
553
|
let s = x;
|
|
546
|
-
s.
|
|
554
|
+
s.le.push(i);
|
|
547
555
|
const done = (e, t) => {
|
|
548
556
|
s = currentTransition(s);
|
|
549
|
-
const o = s.
|
|
550
|
-
if (o >= 0) s.
|
|
557
|
+
const o = s.le.indexOf(i);
|
|
558
|
+
if (o >= 0) s.le.splice(o, 1);
|
|
551
559
|
x = s;
|
|
552
560
|
schedule();
|
|
553
561
|
t ? r(t) : n(e);
|
|
@@ -575,8 +583,8 @@ function action(e) {
|
|
|
575
583
|
step();
|
|
576
584
|
});
|
|
577
585
|
}
|
|
578
|
-
GlobalQueue.
|
|
579
|
-
GlobalQueue.
|
|
586
|
+
GlobalQueue.ne = recompute;
|
|
587
|
+
GlobalQueue.re = disposeChildren;
|
|
580
588
|
let W = false;
|
|
581
589
|
let j = false;
|
|
582
590
|
let N = false;
|
|
@@ -585,28 +593,28 @@ let Q = false;
|
|
|
585
593
|
let I = false;
|
|
586
594
|
let H = null;
|
|
587
595
|
function recompute(t, n = false) {
|
|
588
|
-
const i = t.
|
|
596
|
+
const i = t.ae;
|
|
589
597
|
if (!n) {
|
|
590
|
-
if (t.
|
|
598
|
+
if (t.B && (!i || x) && x !== t.B) E.initTransition(t.B);
|
|
591
599
|
deleteFromHeap(t, t._ & o ? b : _);
|
|
592
|
-
if (t.
|
|
600
|
+
if (t.B || i === h) disposeChildren(t);
|
|
593
601
|
else {
|
|
594
602
|
markDisposal(t);
|
|
595
|
-
t.ye = t.ge;
|
|
596
603
|
t.we = t.Se;
|
|
597
|
-
t.
|
|
604
|
+
t.me = t._e;
|
|
598
605
|
t.Se = null;
|
|
606
|
+
t._e = null;
|
|
599
607
|
}
|
|
600
608
|
}
|
|
601
609
|
const s = !!(t._ & f);
|
|
602
610
|
const u = hasActiveOverride(t);
|
|
603
|
-
const a = !!(t.
|
|
611
|
+
const a = !!(t.ge & l);
|
|
604
612
|
const d = H;
|
|
605
613
|
H = t;
|
|
606
|
-
t.
|
|
614
|
+
t.be = null;
|
|
607
615
|
t._ = r;
|
|
608
|
-
t.
|
|
609
|
-
let p = t.
|
|
616
|
+
t.fe = O;
|
|
617
|
+
let p = t.J === y ? t.ye : t.J;
|
|
610
618
|
let g = t.u;
|
|
611
619
|
let w = W;
|
|
612
620
|
let S = A;
|
|
@@ -619,13 +627,17 @@ function recompute(t, n = false) {
|
|
|
619
627
|
p = handleAsync(t, t.R(p));
|
|
620
628
|
clearStatus(t);
|
|
621
629
|
const e = resolveLane(t);
|
|
622
|
-
if (e)
|
|
630
|
+
if (e) {
|
|
631
|
+
e.q.delete(t);
|
|
632
|
+
updatePendingSignal(e.t);
|
|
633
|
+
}
|
|
623
634
|
} catch (e) {
|
|
624
635
|
if (e instanceof NotReadyError && A) {
|
|
625
636
|
const e = findLane(A);
|
|
626
637
|
if (e.t !== t) {
|
|
627
|
-
e.
|
|
628
|
-
t.
|
|
638
|
+
e.q.add(t);
|
|
639
|
+
t.M = e;
|
|
640
|
+
updatePendingSignal(e.t);
|
|
629
641
|
}
|
|
630
642
|
}
|
|
631
643
|
notifyStatus(
|
|
@@ -633,15 +645,15 @@ function recompute(t, n = false) {
|
|
|
633
645
|
e instanceof NotReadyError ? l : c,
|
|
634
646
|
e,
|
|
635
647
|
undefined,
|
|
636
|
-
e instanceof NotReadyError ? t.
|
|
648
|
+
e instanceof NotReadyError ? t.M : undefined
|
|
637
649
|
);
|
|
638
650
|
} finally {
|
|
639
651
|
W = w;
|
|
640
652
|
t._ = e;
|
|
641
653
|
H = d;
|
|
642
654
|
}
|
|
643
|
-
if (!t.
|
|
644
|
-
const e = t.
|
|
655
|
+
if (!t.oe) {
|
|
656
|
+
const e = t.be;
|
|
645
657
|
let r = e !== null ? e.L : t.N;
|
|
646
658
|
if (r !== null) {
|
|
647
659
|
do {
|
|
@@ -650,22 +662,22 @@ function recompute(t, n = false) {
|
|
|
650
662
|
if (e !== null) e.L = null;
|
|
651
663
|
else t.N = null;
|
|
652
664
|
}
|
|
653
|
-
const f = u ? t.
|
|
654
|
-
const l = !t.
|
|
665
|
+
const f = u ? t.ye : t.J === y ? t.ye : t.J;
|
|
666
|
+
const l = !t.Oe || !t.Oe(f, p);
|
|
655
667
|
if (l) {
|
|
656
|
-
const e = u ? t.
|
|
657
|
-
if (n || (i && x !== t.
|
|
658
|
-
else t.
|
|
668
|
+
const e = u ? t.ye : undefined;
|
|
669
|
+
if (n || (i && x !== t.B) || s) t.ye = p;
|
|
670
|
+
else t.J = p;
|
|
659
671
|
if (u && !s && a) {
|
|
660
|
-
const e = t.
|
|
661
|
-
const n = t.
|
|
662
|
-
if (e <= n) t.
|
|
672
|
+
const e = t.K || 0;
|
|
673
|
+
const n = t.G || 0;
|
|
674
|
+
if (e <= n) t.ye = p;
|
|
663
675
|
}
|
|
664
|
-
if (!u || s || t.
|
|
676
|
+
if (!u || s || t.ye !== e) {
|
|
665
677
|
insertSubs(t, s || u);
|
|
666
678
|
}
|
|
667
679
|
} else if (u) {
|
|
668
|
-
t.
|
|
680
|
+
t.J = p;
|
|
669
681
|
} else if (t.u != g) {
|
|
670
682
|
for (let e = t.P; e !== null; e = e.C) {
|
|
671
683
|
insertIntoHeapHeight(e.k, e.k._ & o ? b : _);
|
|
@@ -673,49 +685,49 @@ function recompute(t, n = false) {
|
|
|
673
685
|
}
|
|
674
686
|
}
|
|
675
687
|
setCurrentOptimisticLane(S);
|
|
676
|
-
(!n || t.
|
|
677
|
-
t.
|
|
688
|
+
(!n || t.ge & l) && !t.B && !(x && t.U) && E.$.push(t);
|
|
689
|
+
t.B && i && x !== t.B && runInTransition(t.B, () => recompute(t));
|
|
678
690
|
}
|
|
679
691
|
function handleAsync(e, t, r) {
|
|
680
692
|
const i = typeof t === "object" && t !== null;
|
|
681
693
|
const s = i && untrack(() => t[Symbol.asyncIterator]);
|
|
682
694
|
const o = !s && i && untrack(() => typeof t.then === "function");
|
|
683
695
|
if (!o && !s) {
|
|
684
|
-
e.
|
|
696
|
+
e.xe = null;
|
|
685
697
|
return t;
|
|
686
698
|
}
|
|
687
|
-
e.
|
|
699
|
+
e.xe = t;
|
|
688
700
|
let u;
|
|
689
701
|
const handleError = n => {
|
|
690
|
-
if (e.
|
|
691
|
-
E.initTransition(e.
|
|
702
|
+
if (e.xe !== t) return;
|
|
703
|
+
E.initTransition(e.B);
|
|
692
704
|
notifyStatus(e, n instanceof NotReadyError ? l : c, n);
|
|
693
|
-
e.
|
|
705
|
+
e.fe = O;
|
|
694
706
|
};
|
|
695
707
|
const asyncWrite = (i, s) => {
|
|
696
|
-
if (e.
|
|
708
|
+
if (e.xe !== t) return;
|
|
697
709
|
if (e._ & (n | f)) return;
|
|
698
|
-
E.initTransition(e.
|
|
710
|
+
E.initTransition(e.B);
|
|
699
711
|
clearStatus(e);
|
|
700
712
|
const o = resolveLane(e);
|
|
701
|
-
if (o) o.
|
|
713
|
+
if (o) o.q.delete(e);
|
|
702
714
|
if (r) r(i);
|
|
703
|
-
else if (e.
|
|
704
|
-
const t = e.
|
|
705
|
-
if (e.R) e.
|
|
715
|
+
else if (e.U) {
|
|
716
|
+
const t = e.J !== y;
|
|
717
|
+
if (e.R) e.J = i;
|
|
706
718
|
if (!t) {
|
|
707
|
-
e.
|
|
719
|
+
e.ye = i;
|
|
708
720
|
insertSubs(e);
|
|
709
721
|
}
|
|
710
|
-
e.
|
|
722
|
+
e.fe = O;
|
|
711
723
|
} else if (o) {
|
|
712
|
-
const t = e.
|
|
713
|
-
const n = e.
|
|
724
|
+
const t = e.ye;
|
|
725
|
+
const n = e.Oe;
|
|
714
726
|
if (!n || !n(i, t)) {
|
|
715
|
-
e.
|
|
716
|
-
e.
|
|
717
|
-
if (e.
|
|
718
|
-
setSignal(e.
|
|
727
|
+
e.ye = i;
|
|
728
|
+
e.fe = O;
|
|
729
|
+
if (e.ve) {
|
|
730
|
+
setSignal(e.ve, i);
|
|
719
731
|
}
|
|
720
732
|
insertSubs(e, true);
|
|
721
733
|
}
|
|
@@ -742,7 +754,7 @@ function handleAsync(e, t, r) {
|
|
|
742
754
|
);
|
|
743
755
|
r = false;
|
|
744
756
|
if (!n) {
|
|
745
|
-
E.initTransition(e.
|
|
757
|
+
E.initTransition(e.B);
|
|
746
758
|
throw new NotReadyError(H);
|
|
747
759
|
}
|
|
748
760
|
}
|
|
@@ -774,27 +786,27 @@ function handleAsync(e, t, r) {
|
|
|
774
786
|
};
|
|
775
787
|
const i = iterate();
|
|
776
788
|
if (!r && !i) {
|
|
777
|
-
E.initTransition(e.
|
|
789
|
+
E.initTransition(e.B);
|
|
778
790
|
throw new NotReadyError(H);
|
|
779
791
|
}
|
|
780
792
|
}
|
|
781
793
|
return u;
|
|
782
794
|
}
|
|
783
795
|
function clearStatus(e) {
|
|
784
|
-
e.
|
|
785
|
-
e.
|
|
796
|
+
e.ge = e.ge & a;
|
|
797
|
+
e.oe = null;
|
|
786
798
|
updatePendingSignal(e);
|
|
787
|
-
e.
|
|
799
|
+
e.Pe?.();
|
|
788
800
|
}
|
|
789
801
|
function notifyStatus(e, t, n, r, i) {
|
|
790
802
|
if (t === c && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
791
803
|
n = new StatusError(e, n);
|
|
792
804
|
const s = n instanceof NotReadyError && n.t === e;
|
|
793
|
-
const o = t === l && e.
|
|
805
|
+
const o = t === l && e.U && !s;
|
|
794
806
|
const u = o && hasActiveOverride(e);
|
|
795
807
|
if (!r) {
|
|
796
|
-
e.
|
|
797
|
-
e.
|
|
808
|
+
e.ge = t | (t !== c ? e.ge & a : 0);
|
|
809
|
+
e.oe = n;
|
|
798
810
|
updatePendingSignal(e);
|
|
799
811
|
}
|
|
800
812
|
if (i && !r) {
|
|
@@ -802,32 +814,32 @@ function notifyStatus(e, t, n, r, i) {
|
|
|
802
814
|
}
|
|
803
815
|
if (u && x && n instanceof NotReadyError) {
|
|
804
816
|
const e = n.t;
|
|
805
|
-
if (!x.
|
|
806
|
-
x.
|
|
817
|
+
if (!x.ue.includes(e)) {
|
|
818
|
+
x.ue.push(e);
|
|
807
819
|
}
|
|
808
820
|
}
|
|
809
821
|
const f = r || u;
|
|
810
822
|
const d = r || o ? undefined : i;
|
|
811
|
-
if (e.
|
|
823
|
+
if (e.Pe) {
|
|
812
824
|
if (f) {
|
|
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 r = e.P; r !== null; r = r.C) {
|
|
820
|
-
r.k.
|
|
821
|
-
if (r.k.
|
|
822
|
-
!r.k.
|
|
832
|
+
r.k.fe = O;
|
|
833
|
+
if (r.k.oe !== n) {
|
|
834
|
+
!r.k.B && E.$.push(r.k);
|
|
823
835
|
notifyStatus(r.k, t, n, f, d);
|
|
824
836
|
}
|
|
825
837
|
}
|
|
826
838
|
for (let r = e.A; r !== null; r = r.W) {
|
|
827
839
|
for (let e = r.P; e !== null; e = e.C) {
|
|
828
|
-
e.k.
|
|
829
|
-
if (e.k.
|
|
830
|
-
!e.k.
|
|
840
|
+
e.k.fe = O;
|
|
841
|
+
if (e.k.oe !== n) {
|
|
842
|
+
!e.k.B && E.$.push(e.k);
|
|
831
843
|
notifyStatus(e.k, t, n, f, d);
|
|
832
844
|
}
|
|
833
845
|
}
|
|
@@ -846,7 +858,7 @@ function updateIfNecessary(r) {
|
|
|
846
858
|
}
|
|
847
859
|
}
|
|
848
860
|
}
|
|
849
|
-
if (r._ & (n | f) || (r.
|
|
861
|
+
if (r._ & (n | f) || (r.oe && r.fe < O)) {
|
|
850
862
|
recompute(r);
|
|
851
863
|
}
|
|
852
864
|
r._ = e;
|
|
@@ -855,15 +867,15 @@ function unlinkSubs(e) {
|
|
|
855
867
|
const t = e.I;
|
|
856
868
|
const n = e.L;
|
|
857
869
|
const r = e.C;
|
|
858
|
-
const i = e.
|
|
859
|
-
if (r !== null) r.
|
|
860
|
-
else t.
|
|
870
|
+
const i = e.Ce;
|
|
871
|
+
if (r !== null) r.Ce = i;
|
|
872
|
+
else t.ke = i;
|
|
861
873
|
if (i !== null) i.C = r;
|
|
862
874
|
else {
|
|
863
875
|
t.P = r;
|
|
864
876
|
if (r === null) {
|
|
865
|
-
t.
|
|
866
|
-
t.R && !t.
|
|
877
|
+
t.Ae?.();
|
|
878
|
+
t.R && !t.Ee && 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.be;
|
|
882
894
|
if (n !== null && n.I === e) return;
|
|
883
895
|
let i = null;
|
|
884
896
|
const s = t._ & r;
|
|
885
897
|
if (s) {
|
|
886
898
|
i = n !== null ? n.L : t.N;
|
|
887
899
|
if (i !== null && i.I === e) {
|
|
888
|
-
t.
|
|
900
|
+
t.be = i;
|
|
889
901
|
return;
|
|
890
902
|
}
|
|
891
903
|
}
|
|
892
|
-
const o = e.
|
|
904
|
+
const o = e.ke;
|
|
893
905
|
if (o !== null && o.k === t && (!s || isValidLink(o, t))) return;
|
|
894
|
-
const u = (t.
|
|
906
|
+
const u = (t.be = e.ke = { I: e, k: t, L: i, Ce: o, C: null });
|
|
895
907
|
if (n !== null) n.L = u;
|
|
896
908
|
else t.N = u;
|
|
897
909
|
if (o !== null) o.C = u;
|
|
898
910
|
else e.P = u;
|
|
899
911
|
}
|
|
900
912
|
function isValidLink(e, t) {
|
|
901
|
-
const n = t.
|
|
913
|
+
const n = t.be;
|
|
902
914
|
if (n !== null) {
|
|
903
915
|
let r = t.N;
|
|
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._e;
|
|
914
926
|
while (t) {
|
|
915
927
|
t._ |= o;
|
|
916
928
|
if (t._ & i) {
|
|
@@ -918,7 +930,7 @@ function markDisposal(e) {
|
|
|
918
930
|
insertIntoHeap(t, b);
|
|
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.N = null;
|
|
930
|
-
e.
|
|
942
|
+
e.be = null;
|
|
931
943
|
disposeChildren(e, true);
|
|
932
944
|
}
|
|
933
945
|
function disposeChildren(e, t = false, n) {
|
|
934
946
|
if (e._ & u) return;
|
|
935
947
|
if (t) e._ = u;
|
|
936
|
-
let r = n ? e.
|
|
948
|
+
let r = n ? e.me : e._e;
|
|
937
949
|
while (r) {
|
|
938
|
-
const e = r.
|
|
950
|
+
const e = r.We;
|
|
939
951
|
if (r.N) {
|
|
940
952
|
const e = r;
|
|
941
953
|
deleteFromHeap(e, e._ & o ? b : _);
|
|
@@ -944,21 +956,21 @@ function disposeChildren(e, t = false, n) {
|
|
|
944
956
|
t = unlinkSubs(t);
|
|
945
957
|
} while (t !== null);
|
|
946
958
|
e.N = null;
|
|
947
|
-
e.
|
|
959
|
+
e.be = null;
|
|
948
960
|
}
|
|
949
961
|
disposeChildren(r, true);
|
|
950
962
|
r = e;
|
|
951
963
|
}
|
|
952
964
|
if (n) {
|
|
953
|
-
e.
|
|
965
|
+
e.me = null;
|
|
954
966
|
} else {
|
|
955
|
-
e.
|
|
956
|
-
e.
|
|
967
|
+
e._e = 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.we : e.Se;
|
|
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.we = null) : (e.Se = 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.je++);
|
|
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(t, n, r) {
|
|
983
995
|
const i = {
|
|
984
996
|
id: r?.id ?? (H?.id != null ? getNextChildId(H) : undefined),
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
997
|
+
Oe: r?.equals != null ? r.equals : isEqual,
|
|
998
|
+
Ne: !!r?.pureWrite,
|
|
999
|
+
Ae: r?.unobserved,
|
|
1000
|
+
Se: null,
|
|
1001
|
+
pe: H?.pe ?? E,
|
|
1002
|
+
Le: H?.Le ?? w,
|
|
1003
|
+
je: 0,
|
|
992
1004
|
R: t,
|
|
993
|
-
|
|
1005
|
+
ye: n,
|
|
994
1006
|
u: 0,
|
|
995
1007
|
A: null,
|
|
996
1008
|
S: undefined,
|
|
997
1009
|
h: null,
|
|
998
1010
|
N: null,
|
|
999
|
-
|
|
1011
|
+
be: null,
|
|
1000
1012
|
P: null,
|
|
1001
|
-
|
|
1013
|
+
ke: null,
|
|
1002
1014
|
o: H,
|
|
1003
|
-
|
|
1004
|
-
|
|
1015
|
+
We: null,
|
|
1016
|
+
_e: null,
|
|
1005
1017
|
_: e,
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
ye: null,
|
|
1018
|
+
ge: a,
|
|
1019
|
+
fe: O,
|
|
1020
|
+
J: y,
|
|
1010
1021
|
we: null,
|
|
1011
|
-
|
|
1012
|
-
|
|
1022
|
+
me: null,
|
|
1023
|
+
xe: null,
|
|
1024
|
+
B: null
|
|
1013
1025
|
};
|
|
1014
1026
|
i.h = i;
|
|
1015
1027
|
const s = H?.i ? H.l : H;
|
|
1016
1028
|
if (H) {
|
|
1017
|
-
const e = H.
|
|
1029
|
+
const e = H._e;
|
|
1018
1030
|
if (e === null) {
|
|
1019
|
-
H.
|
|
1031
|
+
H._e = i;
|
|
1020
1032
|
} else {
|
|
1021
|
-
i.
|
|
1022
|
-
H.
|
|
1033
|
+
i.We = e;
|
|
1034
|
+
H._e = i;
|
|
1023
1035
|
}
|
|
1024
1036
|
}
|
|
1025
1037
|
if (s) i.u = s.u + 1;
|
|
@@ -1028,69 +1040,84 @@ function computed(t, n, r) {
|
|
|
1028
1040
|
}
|
|
1029
1041
|
function signal(e, t, n = null) {
|
|
1030
1042
|
const r = {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1043
|
+
Oe: t?.equals != null ? t.equals : isEqual,
|
|
1044
|
+
Ne: !!t?.pureWrite,
|
|
1045
|
+
Ae: t?.unobserved,
|
|
1046
|
+
ye: e,
|
|
1035
1047
|
P: null,
|
|
1036
|
-
|
|
1037
|
-
|
|
1048
|
+
ke: null,
|
|
1049
|
+
fe: O,
|
|
1038
1050
|
H: n,
|
|
1039
1051
|
W: n?.A || null,
|
|
1040
|
-
|
|
1052
|
+
J: y
|
|
1041
1053
|
};
|
|
1042
1054
|
n && (n.A = r);
|
|
1043
1055
|
return r;
|
|
1044
1056
|
}
|
|
1045
1057
|
function optimisticSignal(e, t) {
|
|
1046
1058
|
const n = signal(e, t);
|
|
1047
|
-
n.
|
|
1059
|
+
n.U = true;
|
|
1048
1060
|
return n;
|
|
1049
1061
|
}
|
|
1050
1062
|
function optimisticComputed(e, t, n) {
|
|
1051
1063
|
const r = computed(e, t, n);
|
|
1052
|
-
r.
|
|
1064
|
+
r.U = true;
|
|
1053
1065
|
return r;
|
|
1054
1066
|
}
|
|
1055
1067
|
function getPendingSignal(e) {
|
|
1056
|
-
if (!e.
|
|
1057
|
-
e.
|
|
1058
|
-
if (
|
|
1068
|
+
if (!e.Qe) {
|
|
1069
|
+
e.Qe = optimisticSignal(false, { pureWrite: true });
|
|
1070
|
+
if (e.T) {
|
|
1071
|
+
e.Qe.T = e;
|
|
1072
|
+
}
|
|
1073
|
+
if (computePendingState(e)) setSignal(e.Qe, true);
|
|
1059
1074
|
}
|
|
1060
|
-
return e.
|
|
1075
|
+
return e.Qe;
|
|
1061
1076
|
}
|
|
1062
1077
|
function computePendingState(e) {
|
|
1063
1078
|
const t = e;
|
|
1064
|
-
if (e.
|
|
1065
|
-
|
|
1079
|
+
if (e.U && e.J !== y) {
|
|
1080
|
+
if (t.ge & l && !(t.ge & a)) return true;
|
|
1081
|
+
if (e.T) {
|
|
1082
|
+
const t = e.M ? findLane(e.M) : null;
|
|
1083
|
+
return !!(t && t.q.size > 0);
|
|
1084
|
+
}
|
|
1085
|
+
return true;
|
|
1086
|
+
}
|
|
1087
|
+
if (e.J !== y && !(t.ge & a)) return true;
|
|
1088
|
+
return !!(t.ge & l && !(t.ge & a));
|
|
1066
1089
|
}
|
|
1067
1090
|
function getPendingValueComputed(e) {
|
|
1068
|
-
if (!e.
|
|
1091
|
+
if (!e.ve) {
|
|
1069
1092
|
const t = I;
|
|
1070
1093
|
I = false;
|
|
1071
|
-
const n =
|
|
1094
|
+
const n = L;
|
|
1095
|
+
L = false;
|
|
1096
|
+
const r = H;
|
|
1072
1097
|
H = null;
|
|
1073
|
-
e.
|
|
1074
|
-
|
|
1098
|
+
e.ve = optimisticComputed(() => read(e));
|
|
1099
|
+
e.ve.T = e;
|
|
1100
|
+
H = r;
|
|
1101
|
+
L = n;
|
|
1075
1102
|
I = t;
|
|
1076
1103
|
}
|
|
1077
|
-
return e.
|
|
1104
|
+
return e.ve;
|
|
1078
1105
|
}
|
|
1079
1106
|
function updatePendingSignal(e) {
|
|
1080
|
-
if (e.
|
|
1107
|
+
if (e.Qe) {
|
|
1081
1108
|
const t = computePendingState(e);
|
|
1082
|
-
const n = e.
|
|
1109
|
+
const n = e.Qe;
|
|
1083
1110
|
setSignal(n, t);
|
|
1084
|
-
if (!t && n.
|
|
1111
|
+
if (!t && n.M) {
|
|
1085
1112
|
const t = resolveLane(e);
|
|
1086
|
-
if (t && t.
|
|
1087
|
-
const e = findLane(n.
|
|
1113
|
+
if (t && t.q.size > 0) {
|
|
1114
|
+
const e = findLane(n.M);
|
|
1088
1115
|
if (e !== t) {
|
|
1089
1116
|
mergeLanes(t, e);
|
|
1090
1117
|
}
|
|
1091
1118
|
}
|
|
1092
1119
|
clearLaneEntry(n);
|
|
1093
|
-
n.
|
|
1120
|
+
n.M = 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 (I) {
|
|
1138
|
+
const t = getPendingValueComputed(e);
|
|
1139
|
+
const n = I;
|
|
1140
|
+
I = false;
|
|
1141
|
+
const r = read(t);
|
|
1142
|
+
I = n;
|
|
1143
|
+
if (t.ge & l) return e.ye;
|
|
1144
|
+
if (j && A && t.M) {
|
|
1145
|
+
const n = findLane(t.M);
|
|
1146
|
+
const r = findLane(A);
|
|
1147
|
+
if (n !== r && n.q.size > 0) {
|
|
1148
|
+
return e.ye;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
return r;
|
|
1152
|
+
}
|
|
1110
1153
|
if (L) {
|
|
1111
1154
|
const t = e.H || e;
|
|
1112
1155
|
const n = getPendingSignal(t);
|
|
@@ -1116,16 +1159,7 @@ function read(e) {
|
|
|
1116
1159
|
Q = true;
|
|
1117
1160
|
}
|
|
1118
1161
|
L = r;
|
|
1119
|
-
return e.
|
|
1120
|
-
}
|
|
1121
|
-
if (I) {
|
|
1122
|
-
const t = getPendingValueComputed(e);
|
|
1123
|
-
const n = I;
|
|
1124
|
-
I = false;
|
|
1125
|
-
const r = read(t);
|
|
1126
|
-
I = n;
|
|
1127
|
-
if (t.he & l) return e.pe;
|
|
1128
|
-
return r;
|
|
1162
|
+
return e.ye;
|
|
1129
1163
|
}
|
|
1130
1164
|
let t = H;
|
|
1131
1165
|
if (t?.i) t = t.l;
|
|
@@ -1148,64 +1182,64 @@ function read(e) {
|
|
|
1148
1182
|
}
|
|
1149
1183
|
}
|
|
1150
1184
|
const n = e.H || e;
|
|
1151
|
-
if (t && n.
|
|
1185
|
+
if (t && n.ge & l && !(j && n.B && x !== n.B)) {
|
|
1152
1186
|
if (A) {
|
|
1153
|
-
const r = n.
|
|
1187
|
+
const r = n.M;
|
|
1154
1188
|
const i = findLane(A);
|
|
1155
1189
|
if (r && findLane(r) === i && !hasActiveOverride(n)) {
|
|
1156
1190
|
if (!W) link(e, t);
|
|
1157
|
-
throw n.
|
|
1191
|
+
throw n.oe;
|
|
1158
1192
|
}
|
|
1159
1193
|
} else {
|
|
1160
1194
|
if (!W) link(e, t);
|
|
1161
|
-
throw n.
|
|
1195
|
+
throw n.oe;
|
|
1162
1196
|
}
|
|
1163
1197
|
}
|
|
1164
|
-
if (e.R && e.
|
|
1165
|
-
if (e.
|
|
1198
|
+
if (e.R && e.ge & c) {
|
|
1199
|
+
if (e.fe < O) {
|
|
1166
1200
|
recompute(e, true);
|
|
1167
1201
|
return read(e);
|
|
1168
|
-
} else throw e.
|
|
1202
|
+
} else throw e.oe;
|
|
1169
1203
|
}
|
|
1170
|
-
return !t || A !== null || e.
|
|
1204
|
+
return !t || A !== null || e.J === y || (j && e.B && x !== e.B) ? e.ye : e.J;
|
|
1171
1205
|
}
|
|
1172
1206
|
function setSignal(e, t) {
|
|
1173
|
-
if (e.
|
|
1174
|
-
const n = e.
|
|
1175
|
-
const r = n ? e.
|
|
1207
|
+
if (e.B && x !== e.B) E.initTransition(e.B);
|
|
1208
|
+
const n = e.U && !P;
|
|
1209
|
+
const r = n ? e.ye : e.J === y ? e.ye : e.J;
|
|
1176
1210
|
if (typeof t === "function") t = t(r);
|
|
1177
|
-
const i = !e.
|
|
1211
|
+
const i = !e.Oe || !e.Oe(r, t);
|
|
1178
1212
|
if (!i) {
|
|
1179
|
-
if (n && e.
|
|
1213
|
+
if (n && e.J !== y && e.R) {
|
|
1180
1214
|
insertSubs(e, true);
|
|
1181
1215
|
schedule();
|
|
1182
1216
|
}
|
|
1183
1217
|
return t;
|
|
1184
1218
|
}
|
|
1185
1219
|
if (n) {
|
|
1186
|
-
const n = E.
|
|
1187
|
-
if (e.
|
|
1188
|
-
E.initTransition(e.
|
|
1220
|
+
const n = E.ee.includes(e);
|
|
1221
|
+
if (e.B && n) {
|
|
1222
|
+
E.initTransition(e.B);
|
|
1189
1223
|
}
|
|
1190
|
-
if (e.
|
|
1191
|
-
e.
|
|
1224
|
+
if (e.J === y) {
|
|
1225
|
+
e.J = e.ye;
|
|
1192
1226
|
}
|
|
1193
1227
|
if (!n) {
|
|
1194
|
-
E.
|
|
1228
|
+
E.ee.push(e);
|
|
1195
1229
|
}
|
|
1196
|
-
e.
|
|
1230
|
+
e.K = (e.K || 0) + 1;
|
|
1197
1231
|
const r = getOrCreateLane(e);
|
|
1198
|
-
e.
|
|
1199
|
-
e.
|
|
1232
|
+
e.M = r;
|
|
1233
|
+
e.ye = t;
|
|
1200
1234
|
} else {
|
|
1201
|
-
if (e.
|
|
1202
|
-
e.
|
|
1235
|
+
if (e.J === y) E.$.push(e);
|
|
1236
|
+
e.J = t;
|
|
1203
1237
|
}
|
|
1204
1238
|
updatePendingSignal(e);
|
|
1205
|
-
if (e.
|
|
1206
|
-
setSignal(e.
|
|
1239
|
+
if (e.ve) {
|
|
1240
|
+
setSignal(e.ve, t);
|
|
1207
1241
|
}
|
|
1208
|
-
e.
|
|
1242
|
+
e.fe = O;
|
|
1209
1243
|
insertSubs(e, n);
|
|
1210
1244
|
schedule();
|
|
1211
1245
|
return t;
|
|
@@ -1220,9 +1254,9 @@ function getOwner() {
|
|
|
1220
1254
|
}
|
|
1221
1255
|
function onCleanup(e) {
|
|
1222
1256
|
if (!H) return e;
|
|
1223
|
-
if (!H.
|
|
1224
|
-
else if (Array.isArray(H.
|
|
1225
|
-
else H.
|
|
1257
|
+
if (!H.Se) H.Se = e;
|
|
1258
|
+
else if (Array.isArray(H.Se)) H.Se.push(e);
|
|
1259
|
+
else H.Se = [H.Se, e];
|
|
1226
1260
|
return e;
|
|
1227
1261
|
}
|
|
1228
1262
|
function createOwner(e) {
|
|
@@ -1231,26 +1265,26 @@ function createOwner(e) {
|
|
|
1231
1265
|
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
1232
1266
|
i: true,
|
|
1233
1267
|
l: t?.i ? t.l : t,
|
|
1268
|
+
_e: null,
|
|
1269
|
+
We: null,
|
|
1234
1270
|
Se: null,
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
je: t?.je || w,
|
|
1239
|
-
Ee: 0,
|
|
1240
|
-
ye: null,
|
|
1271
|
+
pe: t?.pe ?? E,
|
|
1272
|
+
Le: t?.Le || w,
|
|
1273
|
+
je: 0,
|
|
1241
1274
|
we: null,
|
|
1275
|
+
me: null,
|
|
1242
1276
|
o: t,
|
|
1243
1277
|
dispose(e = true) {
|
|
1244
1278
|
disposeChildren(n, e);
|
|
1245
1279
|
}
|
|
1246
1280
|
};
|
|
1247
1281
|
if (t) {
|
|
1248
|
-
const e = t.
|
|
1282
|
+
const e = t._e;
|
|
1249
1283
|
if (e === null) {
|
|
1250
|
-
t.
|
|
1284
|
+
t._e = n;
|
|
1251
1285
|
} else {
|
|
1252
|
-
n.
|
|
1253
|
-
t.
|
|
1286
|
+
n.We = e;
|
|
1287
|
+
t._e = n;
|
|
1254
1288
|
}
|
|
1255
1289
|
}
|
|
1256
1290
|
return n;
|
|
@@ -1330,7 +1364,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1330
1364
|
if (!t) {
|
|
1331
1365
|
throw new NoOwnerError();
|
|
1332
1366
|
}
|
|
1333
|
-
const n = hasContext(e, t) ? t.
|
|
1367
|
+
const n = hasContext(e, t) ? t.Le[e.id] : e.defaultValue;
|
|
1334
1368
|
if (isUndefined(n)) {
|
|
1335
1369
|
throw new ContextNotFoundError();
|
|
1336
1370
|
}
|
|
@@ -1340,10 +1374,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1340
1374
|
if (!n) {
|
|
1341
1375
|
throw new NoOwnerError();
|
|
1342
1376
|
}
|
|
1343
|
-
n.
|
|
1377
|
+
n.Le = { ...n.Le, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1344
1378
|
}
|
|
1345
1379
|
function hasContext(e, t) {
|
|
1346
|
-
return !isUndefined(t?.
|
|
1380
|
+
return !isUndefined(t?.Le[e.id]);
|
|
1347
1381
|
}
|
|
1348
1382
|
function isUndefined(e) {
|
|
1349
1383
|
return typeof e === "undefined";
|
|
@@ -1353,80 +1387,80 @@ function effect(e, t, n, r, i) {
|
|
|
1353
1387
|
const o = computed(i?.render ? t => staleValues(() => e(t)) : e, r, {
|
|
1354
1388
|
...i,
|
|
1355
1389
|
equals: () => {
|
|
1356
|
-
o.
|
|
1357
|
-
if (s) o.
|
|
1390
|
+
o.de = !o.oe;
|
|
1391
|
+
if (s) o.pe.enqueue(o.ae, runEffect.bind(o));
|
|
1358
1392
|
return false;
|
|
1359
1393
|
},
|
|
1360
1394
|
lazy: true
|
|
1361
1395
|
});
|
|
1362
|
-
o.
|
|
1363
|
-
o.
|
|
1364
|
-
o.
|
|
1365
|
-
o.
|
|
1366
|
-
o.
|
|
1367
|
-
o.
|
|
1368
|
-
const n = e !== undefined ? e : o.
|
|
1369
|
-
const r = t !== undefined ? t : o.
|
|
1396
|
+
o.Ie = r;
|
|
1397
|
+
o.He = t;
|
|
1398
|
+
o.Re = n;
|
|
1399
|
+
o.Te = undefined;
|
|
1400
|
+
o.ae = i?.render ? d : p;
|
|
1401
|
+
o.Pe = (e, t) => {
|
|
1402
|
+
const n = e !== undefined ? e : o.ge;
|
|
1403
|
+
const r = t !== undefined ? t : o.oe;
|
|
1370
1404
|
if (n & c) {
|
|
1371
1405
|
let e = r;
|
|
1372
|
-
o.
|
|
1373
|
-
if (o.
|
|
1406
|
+
o.pe.notify(o, l, 0);
|
|
1407
|
+
if (o.ae === p) {
|
|
1374
1408
|
try {
|
|
1375
|
-
return o.
|
|
1376
|
-
? o.
|
|
1377
|
-
o.
|
|
1378
|
-
o.
|
|
1409
|
+
return o.Re
|
|
1410
|
+
? o.Re(e, () => {
|
|
1411
|
+
o.Te?.();
|
|
1412
|
+
o.Te = undefined;
|
|
1379
1413
|
})
|
|
1380
1414
|
: console.error(e);
|
|
1381
1415
|
} catch (t) {
|
|
1382
1416
|
e = t;
|
|
1383
1417
|
}
|
|
1384
1418
|
}
|
|
1385
|
-
if (!o.
|
|
1386
|
-
} else if (o.
|
|
1419
|
+
if (!o.pe.notify(o, c, c)) throw e;
|
|
1420
|
+
} else if (o.ae === d) o.pe.notify(o, l | c, n, r);
|
|
1387
1421
|
};
|
|
1388
1422
|
recompute(o, true);
|
|
1389
|
-
!i?.defer && (o.
|
|
1423
|
+
!i?.defer && (o.ae === p ? o.pe.enqueue(o.ae, runEffect.bind(o)) : runEffect.call(o));
|
|
1390
1424
|
s = true;
|
|
1391
|
-
onCleanup(() => o.
|
|
1425
|
+
onCleanup(() => o.Te?.());
|
|
1392
1426
|
}
|
|
1393
1427
|
function runEffect() {
|
|
1394
|
-
if (!this.
|
|
1395
|
-
this.
|
|
1396
|
-
this.
|
|
1428
|
+
if (!this.de || this._ & u) return;
|
|
1429
|
+
this.Te?.();
|
|
1430
|
+
this.Te = undefined;
|
|
1397
1431
|
try {
|
|
1398
|
-
this.
|
|
1432
|
+
this.Te = this.He(this.ye, this.Ie);
|
|
1399
1433
|
} catch (e) {
|
|
1400
|
-
if (!this.
|
|
1434
|
+
if (!this.pe.notify(this, c, c)) throw e;
|
|
1401
1435
|
} finally {
|
|
1402
|
-
this.
|
|
1403
|
-
this.
|
|
1436
|
+
this.Ie = this.ye;
|
|
1437
|
+
this.de = false;
|
|
1404
1438
|
}
|
|
1405
1439
|
}
|
|
1406
1440
|
function trackedEffect(e, t) {
|
|
1407
1441
|
const run = () => {
|
|
1408
|
-
if (!n.
|
|
1409
|
-
n.
|
|
1442
|
+
if (!n.de || n._ & u) return;
|
|
1443
|
+
n.de = false;
|
|
1410
1444
|
recompute(n);
|
|
1411
1445
|
};
|
|
1412
1446
|
const n = computed(
|
|
1413
1447
|
() => {
|
|
1414
1448
|
try {
|
|
1415
|
-
n.
|
|
1416
|
-
n.
|
|
1417
|
-
n.
|
|
1449
|
+
n.Te?.();
|
|
1450
|
+
n.Te = undefined;
|
|
1451
|
+
n.Te = staleValues(e) || undefined;
|
|
1418
1452
|
} finally {
|
|
1419
1453
|
}
|
|
1420
1454
|
},
|
|
1421
1455
|
undefined,
|
|
1422
1456
|
{ ...t, lazy: true, pureWrite: true }
|
|
1423
1457
|
);
|
|
1424
|
-
n.
|
|
1425
|
-
n.
|
|
1426
|
-
n.
|
|
1427
|
-
n.
|
|
1428
|
-
n.
|
|
1429
|
-
onCleanup(() => n.
|
|
1458
|
+
n.Te = undefined;
|
|
1459
|
+
n.de = true;
|
|
1460
|
+
n.ae = h;
|
|
1461
|
+
n.he = run;
|
|
1462
|
+
n.pe.enqueue(p, run);
|
|
1463
|
+
onCleanup(() => n.Te?.());
|
|
1430
1464
|
}
|
|
1431
1465
|
function createSignal(e, t, n) {
|
|
1432
1466
|
if (typeof e === "function") {
|
|
@@ -1658,7 +1692,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1658
1692
|
i !== r && i !== undefined && reconcile(i, n?.key || "id", n?.all)(s);
|
|
1659
1693
|
});
|
|
1660
1694
|
});
|
|
1661
|
-
r.
|
|
1695
|
+
r.Ee = true;
|
|
1662
1696
|
return { store: s, node: r };
|
|
1663
1697
|
}
|
|
1664
1698
|
function createProjection(e, t = {}, n) {
|
|
@@ -1758,7 +1792,7 @@ function getNode(e, t, n, r, i = isEqual, s) {
|
|
|
1758
1792
|
},
|
|
1759
1793
|
r
|
|
1760
1794
|
);
|
|
1761
|
-
if (s) o.
|
|
1795
|
+
if (s) o.U = true;
|
|
1762
1796
|
return (e[t] = o);
|
|
1763
1797
|
}
|
|
1764
1798
|
function trackSelf(e, t = M) {
|
|
@@ -1804,7 +1838,7 @@ const re = {
|
|
|
1804
1838
|
if (e && e.get) return e.get.call(n);
|
|
1805
1839
|
}
|
|
1806
1840
|
if (writeOnly(n)) {
|
|
1807
|
-
let n = i && (o || !u) ? (i.
|
|
1841
|
+
let n = i && (o || !u) ? (i.J !== y ? (i.U ? i.ye : i.J) : i.ye) : f[t];
|
|
1808
1842
|
n === B && (n = undefined);
|
|
1809
1843
|
if (!isWrappable(n)) return n;
|
|
1810
1844
|
const r = wrap(n, e);
|
|
@@ -1836,8 +1870,8 @@ const re = {
|
|
|
1836
1870
|
if (writeOnly(r)) {
|
|
1837
1871
|
if (e[$]) {
|
|
1838
1872
|
const t = e[Z];
|
|
1839
|
-
if (t?.
|
|
1840
|
-
E.initTransition(t.
|
|
1873
|
+
if (t?.B) {
|
|
1874
|
+
E.initTransition(t.B);
|
|
1841
1875
|
}
|
|
1842
1876
|
}
|
|
1843
1877
|
untrack(() => {
|
|
@@ -2011,7 +2045,7 @@ function deep(e) {
|
|
|
2011
2045
|
return e[q];
|
|
2012
2046
|
}
|
|
2013
2047
|
function createOptimisticStore(e, t, n) {
|
|
2014
|
-
GlobalQueue.
|
|
2048
|
+
GlobalQueue.ie ||= clearOptimisticStore;
|
|
2015
2049
|
const r = typeof e === "function";
|
|
2016
2050
|
const i = (r ? t : e) ?? {};
|
|
2017
2051
|
const s = r ? e : undefined;
|
|
@@ -2028,14 +2062,14 @@ function clearOptimisticStore(e) {
|
|
|
2028
2062
|
if (r) {
|
|
2029
2063
|
for (const e of Reflect.ownKeys(n)) {
|
|
2030
2064
|
if (r[e]) {
|
|
2031
|
-
r[e].
|
|
2065
|
+
r[e].M = undefined;
|
|
2032
2066
|
const n = t[K] && e in t[K] ? t[K][e] : t[G][e];
|
|
2033
2067
|
const i = n === B ? undefined : n;
|
|
2034
2068
|
setSignal(r[e], isWrappable(i) ? wrap(i, t) : i);
|
|
2035
2069
|
}
|
|
2036
2070
|
}
|
|
2037
2071
|
if (r[M]) {
|
|
2038
|
-
r[M].
|
|
2072
|
+
r[M].M = undefined;
|
|
2039
2073
|
setSignal(r[M], undefined);
|
|
2040
2074
|
}
|
|
2041
2075
|
}
|
|
@@ -2086,7 +2120,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2086
2120
|
setProjectionWriteActive(false);
|
|
2087
2121
|
}
|
|
2088
2122
|
});
|
|
2089
|
-
r.
|
|
2123
|
+
r.Ee = true;
|
|
2090
2124
|
}
|
|
2091
2125
|
return { store: s, node: r };
|
|
2092
2126
|
}
|
|
@@ -2267,68 +2301,68 @@ function mapArray(e, t, n) {
|
|
|
2267
2301
|
const r = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2268
2302
|
return createMemo(
|
|
2269
2303
|
updateKeyedMap.bind({
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
qe: [],
|
|
2274
|
-
Fe: t,
|
|
2304
|
+
Me: createOwner(),
|
|
2305
|
+
qe: 0,
|
|
2306
|
+
Fe: e,
|
|
2275
2307
|
Ve: [],
|
|
2276
|
-
Be:
|
|
2277
|
-
De:
|
|
2278
|
-
Ge:
|
|
2279
|
-
Ke:
|
|
2280
|
-
ze: n?.
|
|
2308
|
+
Be: t,
|
|
2309
|
+
De: [],
|
|
2310
|
+
Ge: [],
|
|
2311
|
+
Ke: r,
|
|
2312
|
+
ze: r || n?.keyed === false ? [] : undefined,
|
|
2313
|
+
Ue: t.length > 1 ? [] : undefined,
|
|
2314
|
+
Je: n?.fallback
|
|
2281
2315
|
})
|
|
2282
2316
|
);
|
|
2283
2317
|
}
|
|
2284
2318
|
const oe = { pureWrite: true };
|
|
2285
2319
|
function updateKeyedMap() {
|
|
2286
|
-
const e = this.
|
|
2320
|
+
const e = this.Fe() || [],
|
|
2287
2321
|
t = e.length;
|
|
2288
2322
|
e[M];
|
|
2289
|
-
runWithOwner(this.
|
|
2323
|
+
runWithOwner(this.Me, () => {
|
|
2290
2324
|
let n,
|
|
2291
2325
|
r,
|
|
2292
|
-
i = this.
|
|
2326
|
+
i = this.ze
|
|
2293
2327
|
? () => {
|
|
2294
|
-
this.
|
|
2295
|
-
this.
|
|
2296
|
-
return this.
|
|
2297
|
-
read.bind(null, this.
|
|
2298
|
-
this.
|
|
2328
|
+
this.ze[r] = signal(e[r], oe);
|
|
2329
|
+
this.Ue && (this.Ue[r] = signal(r, oe));
|
|
2330
|
+
return this.Be(
|
|
2331
|
+
read.bind(null, this.ze[r]),
|
|
2332
|
+
this.Ue ? read.bind(null, this.Ue[r]) : undefined
|
|
2299
2333
|
);
|
|
2300
2334
|
}
|
|
2301
|
-
: this.
|
|
2335
|
+
: this.Ue
|
|
2302
2336
|
? () => {
|
|
2303
2337
|
const t = e[r];
|
|
2304
|
-
this.
|
|
2305
|
-
return this.
|
|
2338
|
+
this.Ue[r] = signal(r, oe);
|
|
2339
|
+
return this.Be(() => t, read.bind(null, this.Ue[r]));
|
|
2306
2340
|
}
|
|
2307
2341
|
: () => {
|
|
2308
2342
|
const t = e[r];
|
|
2309
|
-
return this.
|
|
2343
|
+
return this.Be(() => t);
|
|
2310
2344
|
};
|
|
2311
2345
|
if (t === 0) {
|
|
2312
|
-
if (this.
|
|
2313
|
-
this.
|
|
2314
|
-
this.
|
|
2315
|
-
this.qe = [];
|
|
2346
|
+
if (this.qe !== 0) {
|
|
2347
|
+
this.Me.dispose(false);
|
|
2348
|
+
this.Ge = [];
|
|
2316
2349
|
this.Ve = [];
|
|
2317
|
-
this.
|
|
2318
|
-
this.
|
|
2319
|
-
this.
|
|
2350
|
+
this.De = [];
|
|
2351
|
+
this.qe = 0;
|
|
2352
|
+
this.ze && (this.ze = []);
|
|
2353
|
+
this.Ue && (this.Ue = []);
|
|
2320
2354
|
}
|
|
2321
|
-
if (this.
|
|
2322
|
-
this.
|
|
2355
|
+
if (this.Je && !this.De[0]) {
|
|
2356
|
+
this.De[0] = runWithOwner((this.Ge[0] = createOwner()), this.Je);
|
|
2323
2357
|
}
|
|
2324
|
-
} else if (this.
|
|
2325
|
-
if (this.
|
|
2326
|
-
this.
|
|
2358
|
+
} else if (this.qe === 0) {
|
|
2359
|
+
if (this.Ge[0]) this.Ge[0].dispose();
|
|
2360
|
+
this.De = new Array(t);
|
|
2327
2361
|
for (r = 0; r < t; r++) {
|
|
2328
|
-
this.
|
|
2329
|
-
this.
|
|
2362
|
+
this.Ve[r] = e[r];
|
|
2363
|
+
this.De[r] = runWithOwner((this.Ge[r] = createOwner()), i);
|
|
2330
2364
|
}
|
|
2331
|
-
this.
|
|
2365
|
+
this.qe = t;
|
|
2332
2366
|
} else {
|
|
2333
2367
|
let s,
|
|
2334
2368
|
o,
|
|
@@ -2339,217 +2373,217 @@ function updateKeyedMap() {
|
|
|
2339
2373
|
a,
|
|
2340
2374
|
d = new Array(t),
|
|
2341
2375
|
p = new Array(t),
|
|
2342
|
-
h = this.
|
|
2343
|
-
y = this.
|
|
2376
|
+
h = this.ze ? new Array(t) : undefined,
|
|
2377
|
+
y = this.Ue ? new Array(t) : undefined;
|
|
2344
2378
|
for (
|
|
2345
|
-
s = 0, o = Math.min(this.
|
|
2346
|
-
s < o && (this.
|
|
2379
|
+
s = 0, o = Math.min(this.qe, t);
|
|
2380
|
+
s < o && (this.Ve[s] === e[s] || (this.ze && compare(this.Ke, this.Ve[s], e[s])));
|
|
2347
2381
|
s++
|
|
2348
2382
|
) {
|
|
2349
|
-
if (this.
|
|
2383
|
+
if (this.ze) setSignal(this.ze[s], e[s]);
|
|
2350
2384
|
}
|
|
2351
2385
|
for (
|
|
2352
|
-
o = this.
|
|
2386
|
+
o = this.qe - 1, u = t - 1;
|
|
2353
2387
|
o >= s &&
|
|
2354
2388
|
u >= s &&
|
|
2355
|
-
(this.
|
|
2389
|
+
(this.Ve[o] === e[u] || (this.ze && compare(this.Ke, this.Ve[o], e[u])));
|
|
2356
2390
|
o--, u--
|
|
2357
2391
|
) {
|
|
2358
|
-
d[u] = this.
|
|
2359
|
-
p[u] = this.
|
|
2360
|
-
h && (h[u] = this.
|
|
2361
|
-
y && (y[u] = this.
|
|
2392
|
+
d[u] = this.De[o];
|
|
2393
|
+
p[u] = this.Ge[o];
|
|
2394
|
+
h && (h[u] = this.ze[o]);
|
|
2395
|
+
y && (y[u] = this.Ue[o]);
|
|
2362
2396
|
}
|
|
2363
2397
|
c = new Map();
|
|
2364
2398
|
a = new Array(u + 1);
|
|
2365
2399
|
for (r = u; r >= s; r--) {
|
|
2366
2400
|
f = e[r];
|
|
2367
|
-
l = this.
|
|
2401
|
+
l = this.Ke ? this.Ke(f) : f;
|
|
2368
2402
|
n = c.get(l);
|
|
2369
2403
|
a[r] = n === undefined ? -1 : n;
|
|
2370
2404
|
c.set(l, r);
|
|
2371
2405
|
}
|
|
2372
2406
|
for (n = s; n <= o; n++) {
|
|
2373
|
-
f = this.
|
|
2374
|
-
l = this.
|
|
2407
|
+
f = this.Ve[n];
|
|
2408
|
+
l = this.Ke ? this.Ke(f) : f;
|
|
2375
2409
|
r = c.get(l);
|
|
2376
2410
|
if (r !== undefined && r !== -1) {
|
|
2377
|
-
d[r] = this.
|
|
2378
|
-
p[r] = this.
|
|
2379
|
-
h && (h[r] = this.
|
|
2380
|
-
y && (y[r] = this.
|
|
2411
|
+
d[r] = this.De[n];
|
|
2412
|
+
p[r] = this.Ge[n];
|
|
2413
|
+
h && (h[r] = this.ze[n]);
|
|
2414
|
+
y && (y[r] = this.Ue[n]);
|
|
2381
2415
|
r = a[r];
|
|
2382
2416
|
c.set(l, r);
|
|
2383
|
-
} else this.
|
|
2417
|
+
} else this.Ge[n].dispose();
|
|
2384
2418
|
}
|
|
2385
2419
|
for (r = s; r < t; r++) {
|
|
2386
2420
|
if (r in d) {
|
|
2387
|
-
this.
|
|
2388
|
-
this.
|
|
2421
|
+
this.De[r] = d[r];
|
|
2422
|
+
this.Ge[r] = p[r];
|
|
2389
2423
|
if (h) {
|
|
2390
|
-
this.
|
|
2391
|
-
setSignal(this.
|
|
2424
|
+
this.ze[r] = h[r];
|
|
2425
|
+
setSignal(this.ze[r], e[r]);
|
|
2392
2426
|
}
|
|
2393
2427
|
if (y) {
|
|
2394
|
-
this.
|
|
2395
|
-
setSignal(this.
|
|
2428
|
+
this.Ue[r] = y[r];
|
|
2429
|
+
setSignal(this.Ue[r], r);
|
|
2396
2430
|
}
|
|
2397
2431
|
} else {
|
|
2398
|
-
this.
|
|
2432
|
+
this.De[r] = runWithOwner((this.Ge[r] = createOwner()), i);
|
|
2399
2433
|
}
|
|
2400
2434
|
}
|
|
2401
|
-
this.
|
|
2402
|
-
this.
|
|
2435
|
+
this.De = this.De.slice(0, (this.qe = t));
|
|
2436
|
+
this.Ve = e.slice(0);
|
|
2403
2437
|
}
|
|
2404
2438
|
});
|
|
2405
|
-
return this.
|
|
2439
|
+
return this.De;
|
|
2406
2440
|
}
|
|
2407
2441
|
function repeat(e, t, n) {
|
|
2408
2442
|
return updateRepeat.bind({
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2443
|
+
Me: createOwner(),
|
|
2444
|
+
qe: 0,
|
|
2445
|
+
Xe: 0,
|
|
2446
|
+
Ye: e,
|
|
2447
|
+
Be: t,
|
|
2448
|
+
Ge: [],
|
|
2449
|
+
De: [],
|
|
2450
|
+
Ze: n?.from,
|
|
2451
|
+
Je: n?.fallback
|
|
2418
2452
|
});
|
|
2419
2453
|
}
|
|
2420
2454
|
function updateRepeat() {
|
|
2421
|
-
const e = this.
|
|
2422
|
-
const t = this.
|
|
2423
|
-
runWithOwner(this.
|
|
2455
|
+
const e = this.Ye();
|
|
2456
|
+
const t = this.Ze?.() || 0;
|
|
2457
|
+
runWithOwner(this.Me, () => {
|
|
2424
2458
|
if (e === 0) {
|
|
2425
|
-
if (this.
|
|
2426
|
-
this.
|
|
2427
|
-
this.
|
|
2428
|
-
this.
|
|
2429
|
-
this.
|
|
2459
|
+
if (this.qe !== 0) {
|
|
2460
|
+
this.Me.dispose(false);
|
|
2461
|
+
this.Ge = [];
|
|
2462
|
+
this.De = [];
|
|
2463
|
+
this.qe = 0;
|
|
2430
2464
|
}
|
|
2431
|
-
if (this.
|
|
2432
|
-
this.
|
|
2465
|
+
if (this.Je && !this.De[0]) {
|
|
2466
|
+
this.De[0] = runWithOwner((this.Ge[0] = createOwner()), this.Je);
|
|
2433
2467
|
}
|
|
2434
2468
|
return;
|
|
2435
2469
|
}
|
|
2436
2470
|
const n = t + e;
|
|
2437
|
-
const r = this.
|
|
2438
|
-
if (this.
|
|
2439
|
-
for (let e = n; e < r; e++) this.
|
|
2440
|
-
if (this.
|
|
2441
|
-
let e = this.
|
|
2442
|
-
while (e < t && e < this.
|
|
2443
|
-
this.
|
|
2444
|
-
this.
|
|
2445
|
-
} else if (this.
|
|
2446
|
-
let n = r - this.
|
|
2447
|
-
let i = this.
|
|
2448
|
-
this.
|
|
2471
|
+
const r = this.Xe + this.qe;
|
|
2472
|
+
if (this.qe === 0 && this.Ge[0]) this.Ge[0].dispose();
|
|
2473
|
+
for (let e = n; e < r; e++) this.Ge[e - this.Xe].dispose();
|
|
2474
|
+
if (this.Xe < t) {
|
|
2475
|
+
let e = this.Xe;
|
|
2476
|
+
while (e < t && e < this.qe) this.Ge[e++].dispose();
|
|
2477
|
+
this.Ge.splice(0, t - this.Xe);
|
|
2478
|
+
this.De.splice(0, t - this.Xe);
|
|
2479
|
+
} else if (this.Xe > t) {
|
|
2480
|
+
let n = r - this.Xe - 1;
|
|
2481
|
+
let i = this.Xe - t;
|
|
2482
|
+
this.Ge.length = this.De.length = e;
|
|
2449
2483
|
while (n >= i) {
|
|
2450
|
-
this.
|
|
2451
|
-
this.
|
|
2484
|
+
this.Ge[n] = this.Ge[n - i];
|
|
2485
|
+
this.De[n] = this.De[n - i];
|
|
2452
2486
|
n--;
|
|
2453
2487
|
}
|
|
2454
2488
|
for (let e = 0; e < i; e++) {
|
|
2455
|
-
this.
|
|
2489
|
+
this.De[e] = runWithOwner((this.Ge[e] = createOwner()), () => this.Be(e + t));
|
|
2456
2490
|
}
|
|
2457
2491
|
}
|
|
2458
2492
|
for (let e = r; e < n; e++) {
|
|
2459
|
-
this.
|
|
2493
|
+
this.De[e - t] = runWithOwner((this.Ge[e - t] = createOwner()), () => this.Be(e));
|
|
2460
2494
|
}
|
|
2461
|
-
this.
|
|
2462
|
-
this.
|
|
2463
|
-
this.
|
|
2495
|
+
this.De = this.De.slice(0, e);
|
|
2496
|
+
this.Xe = t;
|
|
2497
|
+
this.qe = e;
|
|
2464
2498
|
});
|
|
2465
|
-
return this.
|
|
2499
|
+
return this.De;
|
|
2466
2500
|
}
|
|
2467
2501
|
function compare(e, t, n) {
|
|
2468
2502
|
return e ? e(t) === e(n) : true;
|
|
2469
2503
|
}
|
|
2470
2504
|
function boundaryComputed(e, t) {
|
|
2471
2505
|
const n = computed(e, undefined, { lazy: true });
|
|
2472
|
-
n.
|
|
2473
|
-
const r = e !== undefined ? e : n.
|
|
2474
|
-
const i = t !== undefined ? t : n.
|
|
2475
|
-
n.
|
|
2476
|
-
n.
|
|
2506
|
+
n.Pe = (e, t) => {
|
|
2507
|
+
const r = e !== undefined ? e : n.ge;
|
|
2508
|
+
const i = t !== undefined ? t : n.oe;
|
|
2509
|
+
n.ge &= ~n.$e;
|
|
2510
|
+
n.pe.notify(n, n.$e, r, i);
|
|
2477
2511
|
};
|
|
2478
|
-
n
|
|
2479
|
-
n.
|
|
2512
|
+
n.$e = t;
|
|
2513
|
+
n.Ee = true;
|
|
2480
2514
|
recompute(n, true);
|
|
2481
2515
|
return n;
|
|
2482
2516
|
}
|
|
2483
2517
|
function createBoundChildren(e, t, n, r) {
|
|
2484
|
-
const i = e.
|
|
2485
|
-
i.addChild((e.
|
|
2486
|
-
onCleanup(() => i.removeChild(e.
|
|
2518
|
+
const i = e.pe;
|
|
2519
|
+
i.addChild((e.pe = n));
|
|
2520
|
+
onCleanup(() => i.removeChild(e.pe));
|
|
2487
2521
|
return runWithOwner(e, () => {
|
|
2488
2522
|
const e = computed(t);
|
|
2489
2523
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), r);
|
|
2490
2524
|
});
|
|
2491
2525
|
}
|
|
2492
2526
|
class ConditionalQueue extends Queue {
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2527
|
+
et;
|
|
2528
|
+
tt = new Set();
|
|
2529
|
+
$ = new Set();
|
|
2496
2530
|
constructor(e) {
|
|
2497
2531
|
super();
|
|
2498
|
-
this.
|
|
2532
|
+
this.et = e;
|
|
2499
2533
|
}
|
|
2500
2534
|
run(e) {
|
|
2501
|
-
if (!e || read(this.
|
|
2535
|
+
if (!e || read(this.et)) return;
|
|
2502
2536
|
return super.run(e);
|
|
2503
2537
|
}
|
|
2504
2538
|
notify(e, t, n, r) {
|
|
2505
|
-
if (read(this.
|
|
2539
|
+
if (read(this.et)) {
|
|
2506
2540
|
if (t & l) {
|
|
2507
2541
|
if (n & l) {
|
|
2508
|
-
this
|
|
2542
|
+
this.$.add(e);
|
|
2509
2543
|
t &= ~l;
|
|
2510
|
-
} else if (this
|
|
2544
|
+
} else if (this.$.delete(e)) t &= ~l;
|
|
2511
2545
|
}
|
|
2512
2546
|
if (t & c) {
|
|
2513
2547
|
if (n & c) {
|
|
2514
|
-
this
|
|
2548
|
+
this.tt.add(e);
|
|
2515
2549
|
t &= ~c;
|
|
2516
|
-
} else if (this
|
|
2550
|
+
} else if (this.tt.delete(e)) t &= ~c;
|
|
2517
2551
|
}
|
|
2518
2552
|
}
|
|
2519
|
-
return t ? super.notify(e, t, n, r ?? e.
|
|
2553
|
+
return t ? super.notify(e, t, n, r ?? e.oe) : true;
|
|
2520
2554
|
}
|
|
2521
2555
|
}
|
|
2522
2556
|
class CollectionQueue extends Queue {
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2557
|
+
nt;
|
|
2558
|
+
rt = new Set();
|
|
2559
|
+
et = signal(false, { pureWrite: true });
|
|
2560
|
+
it = false;
|
|
2527
2561
|
constructor(e) {
|
|
2528
2562
|
super();
|
|
2529
|
-
this.
|
|
2563
|
+
this.nt = e;
|
|
2530
2564
|
}
|
|
2531
2565
|
run(e) {
|
|
2532
|
-
if (!e || read(this.
|
|
2566
|
+
if (!e || read(this.et)) return;
|
|
2533
2567
|
return super.run(e);
|
|
2534
2568
|
}
|
|
2535
2569
|
notify(e, t, n, r) {
|
|
2536
|
-
if (!(t & this.
|
|
2537
|
-
if (n & this.
|
|
2538
|
-
const t = r?.t || e.
|
|
2570
|
+
if (!(t & this.nt) || (this.nt & l && this.it)) return super.notify(e, t, n, r);
|
|
2571
|
+
if (n & this.nt) {
|
|
2572
|
+
const t = r?.t || e.oe?.t;
|
|
2539
2573
|
if (t) {
|
|
2540
|
-
const e = this.
|
|
2541
|
-
this.
|
|
2542
|
-
if (e) setSignal(this.
|
|
2574
|
+
const e = this.rt.size === 0;
|
|
2575
|
+
this.rt.add(t);
|
|
2576
|
+
if (e) setSignal(this.et, true);
|
|
2543
2577
|
}
|
|
2544
2578
|
}
|
|
2545
|
-
t &= ~this.
|
|
2579
|
+
t &= ~this.nt;
|
|
2546
2580
|
return t ? super.notify(e, t, n, r) : true;
|
|
2547
2581
|
}
|
|
2548
2582
|
checkSources() {
|
|
2549
|
-
for (const e of this.
|
|
2550
|
-
if (!(e.
|
|
2583
|
+
for (const e of this.rt) {
|
|
2584
|
+
if (!(e.ge & this.nt)) this.rt.delete(e);
|
|
2551
2585
|
}
|
|
2552
|
-
if (!this.
|
|
2586
|
+
if (!this.rt.size) setSignal(this.et, false);
|
|
2553
2587
|
}
|
|
2554
2588
|
}
|
|
2555
2589
|
var ue;
|
|
@@ -2562,26 +2596,26 @@ function createBoundary(e, t) {
|
|
|
2562
2596
|
const r = new ConditionalQueue(computed(() => t() === ue.HIDDEN));
|
|
2563
2597
|
const i = createBoundChildren(n, e, r, 0);
|
|
2564
2598
|
computed(() => {
|
|
2565
|
-
const e = read(r.
|
|
2566
|
-
i
|
|
2599
|
+
const e = read(r.et);
|
|
2600
|
+
i.$e = e ? c | l : 0;
|
|
2567
2601
|
if (!e) {
|
|
2568
|
-
r
|
|
2569
|
-
r
|
|
2570
|
-
r
|
|
2571
|
-
r
|
|
2602
|
+
r.$.forEach(e => r.notify(e, l, l, e.oe));
|
|
2603
|
+
r.tt.forEach(e => r.notify(e, c, c, e.oe));
|
|
2604
|
+
r.$.clear();
|
|
2605
|
+
r.tt.clear();
|
|
2572
2606
|
}
|
|
2573
2607
|
});
|
|
2574
|
-
return () => (read(r.
|
|
2608
|
+
return () => (read(r.et) ? undefined : read(i));
|
|
2575
2609
|
}
|
|
2576
2610
|
function createCollectionBoundary(e, t, n) {
|
|
2577
2611
|
const r = createOwner();
|
|
2578
2612
|
const i = new CollectionQueue(e);
|
|
2579
2613
|
const s = createBoundChildren(r, t, i, e);
|
|
2580
2614
|
const o = computed(() => {
|
|
2581
|
-
if (!read(i.
|
|
2615
|
+
if (!read(i.et)) {
|
|
2582
2616
|
const e = read(s);
|
|
2583
|
-
if (!untrack(() => read(i.
|
|
2584
|
-
i.
|
|
2617
|
+
if (!untrack(() => read(i.et))) {
|
|
2618
|
+
i.it = true;
|
|
2585
2619
|
return e;
|
|
2586
2620
|
}
|
|
2587
2621
|
}
|
|
@@ -2594,10 +2628,10 @@ function createLoadBoundary(e, t) {
|
|
|
2594
2628
|
}
|
|
2595
2629
|
function createErrorBoundary(e, t) {
|
|
2596
2630
|
return createCollectionBoundary(c, e, e => {
|
|
2597
|
-
let n = e.
|
|
2598
|
-
const r = n.
|
|
2631
|
+
let n = e.rt.values().next().value;
|
|
2632
|
+
const r = n.oe?.cause ?? n.oe;
|
|
2599
2633
|
return t(r, () => {
|
|
2600
|
-
for (const t of e.
|
|
2634
|
+
for (const t of e.rt) recompute(t);
|
|
2601
2635
|
schedule();
|
|
2602
2636
|
});
|
|
2603
2637
|
});
|