@solidjs/signals 0.8.7 → 0.9.1
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 +101 -92
- package/dist/node.cjs +452 -446
- package/dist/prod.js +233 -227
- package/dist/types/core/core.d.ts +6 -8
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/signals.d.ts +1 -19
- package/dist/types/store/projection.d.ts +2 -2
- package/dist/types/store/store.d.ts +1 -1
- package/package.json +1 -1
package/dist/node.cjs
CHANGED
|
@@ -117,7 +117,7 @@ function runHeap(e, t) {
|
|
|
117
117
|
function adjustHeight(e, t) {
|
|
118
118
|
deleteFromHeap(e, t);
|
|
119
119
|
let n = e.o;
|
|
120
|
-
for (let t = e.
|
|
120
|
+
for (let t = e.P; t; t = t.W) {
|
|
121
121
|
const e = t.H;
|
|
122
122
|
const r = e.I || e;
|
|
123
123
|
if (r.F && r.o >= n) n = r.o + 1;
|
|
@@ -131,8 +131,8 @@ function adjustHeight(e, t) {
|
|
|
131
131
|
}
|
|
132
132
|
const w = new Set();
|
|
133
133
|
const _ = { l: new Array(2e3).fill(undefined), m: false, A: 0, _: 0 };
|
|
134
|
-
const
|
|
135
|
-
let
|
|
134
|
+
const b = { l: new Array(2e3).fill(undefined), m: false, A: 0, _: 0 };
|
|
135
|
+
let S = 0;
|
|
136
136
|
let m = null;
|
|
137
137
|
let x = false;
|
|
138
138
|
function schedule() {
|
|
@@ -144,7 +144,7 @@ class Queue {
|
|
|
144
144
|
i = null;
|
|
145
145
|
V = [[], []];
|
|
146
146
|
q = [];
|
|
147
|
-
created =
|
|
147
|
+
created = S;
|
|
148
148
|
addChild(e) {
|
|
149
149
|
this.q.push(e);
|
|
150
150
|
e.i = this;
|
|
@@ -210,12 +210,12 @@ class GlobalQueue extends Queue {
|
|
|
210
210
|
runHeap(_, GlobalQueue.D);
|
|
211
211
|
if (m) {
|
|
212
212
|
if (!transitionComplete(m)) {
|
|
213
|
-
runHeap(
|
|
213
|
+
runHeap(b, GlobalQueue.D);
|
|
214
214
|
this.M = [];
|
|
215
215
|
this.stashQueues(m.queueStash);
|
|
216
|
-
|
|
216
|
+
S++;
|
|
217
217
|
x = false;
|
|
218
|
-
|
|
218
|
+
runTransitionPending(m.pendingNodes, true);
|
|
219
219
|
m = null;
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
@@ -223,19 +223,15 @@ class GlobalQueue extends Queue {
|
|
|
223
223
|
this.restoreQueues(m.queueStash);
|
|
224
224
|
w.delete(m);
|
|
225
225
|
m = null;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (t.T) t.U = true;
|
|
234
|
-
}
|
|
235
|
-
if (t.F) GlobalQueue.B(t, false, true);
|
|
226
|
+
runTransitionPending(this.M, false);
|
|
227
|
+
_._ >= _.A && runHeap(_, GlobalQueue.D);
|
|
228
|
+
} else if (w.size) runHeap(b, GlobalQueue.D);
|
|
229
|
+
runPending(this.M);
|
|
230
|
+
while (_._ >= _.A) {
|
|
231
|
+
runHeap(_, GlobalQueue.D);
|
|
232
|
+
runPending(this.M);
|
|
236
233
|
}
|
|
237
|
-
|
|
238
|
-
b++;
|
|
234
|
+
S++;
|
|
239
235
|
x = false;
|
|
240
236
|
this.run(d);
|
|
241
237
|
this.run(h);
|
|
@@ -246,8 +242,8 @@ class GlobalQueue extends Queue {
|
|
|
246
242
|
notify(e, t, n) {
|
|
247
243
|
if (t & f) {
|
|
248
244
|
if (n & f) {
|
|
249
|
-
if (m && !m.asyncNodes.includes(e.
|
|
250
|
-
m.asyncNodes.push(e.
|
|
245
|
+
if (m && !m.asyncNodes.includes(e.T.cause)) {
|
|
246
|
+
m.asyncNodes.push(e.T.cause);
|
|
251
247
|
schedule();
|
|
252
248
|
}
|
|
253
249
|
}
|
|
@@ -256,37 +252,44 @@ class GlobalQueue extends Queue {
|
|
|
256
252
|
return false;
|
|
257
253
|
}
|
|
258
254
|
initTransition(e) {
|
|
259
|
-
if (m && m.time ===
|
|
255
|
+
if (m && m.time === S) return;
|
|
260
256
|
if (!m) {
|
|
261
|
-
m = e.
|
|
257
|
+
m = e.K ?? { time: S, pendingNodes: [], asyncNodes: [], queueStash: { V: [[], []], q: [] } };
|
|
262
258
|
}
|
|
263
259
|
w.add(m);
|
|
264
|
-
m.time =
|
|
260
|
+
m.time = S;
|
|
265
261
|
for (let e = 0; e < this.M.length; e++) {
|
|
266
262
|
const t = this.M[e];
|
|
267
|
-
t.
|
|
263
|
+
t.K = m;
|
|
268
264
|
m.pendingNodes.push(t);
|
|
269
265
|
}
|
|
270
266
|
this.M = m.pendingNodes;
|
|
271
267
|
}
|
|
272
268
|
}
|
|
273
|
-
function runPending(e
|
|
274
|
-
let
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
i.X.Y(t);
|
|
281
|
-
n = true;
|
|
269
|
+
function runPending(e) {
|
|
270
|
+
for (let t = 0; t < e.length; t++) {
|
|
271
|
+
const n = e[t];
|
|
272
|
+
if (n.G !== p) {
|
|
273
|
+
n.U = n.G;
|
|
274
|
+
n.G = p;
|
|
275
|
+
if (n.L) n.J = true;
|
|
282
276
|
}
|
|
283
|
-
if (
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
277
|
+
if (n.X && n.X.G !== p) n.X.Y(n.X.G);
|
|
278
|
+
if (n.F) GlobalQueue.B(n, false, true);
|
|
279
|
+
}
|
|
280
|
+
e.length = 0;
|
|
281
|
+
}
|
|
282
|
+
function runTransitionPending(e, t) {
|
|
283
|
+
const n = e.slice();
|
|
284
|
+
for (let e = 0; e < n.length; e++) {
|
|
285
|
+
const r = n[e];
|
|
286
|
+
r.K = m;
|
|
287
|
+
if (r.Z) r.Z.Y(t);
|
|
288
|
+
if (r.X && r.X.G !== p) {
|
|
289
|
+
r.X.Y(r.X.G);
|
|
290
|
+
r.X.G = p;
|
|
287
291
|
}
|
|
288
292
|
}
|
|
289
|
-
return n;
|
|
290
293
|
}
|
|
291
294
|
const O = new GlobalQueue();
|
|
292
295
|
function flush() {
|
|
@@ -309,7 +312,7 @@ function transitionComplete(e) {
|
|
|
309
312
|
}
|
|
310
313
|
function runInTransition(e, t) {
|
|
311
314
|
const n = m;
|
|
312
|
-
m = e.
|
|
315
|
+
m = e.K;
|
|
313
316
|
t(e);
|
|
314
317
|
m = n;
|
|
315
318
|
}
|
|
@@ -319,20 +322,21 @@ let C = false;
|
|
|
319
322
|
let v = false;
|
|
320
323
|
let N = false;
|
|
321
324
|
let k = null;
|
|
322
|
-
let
|
|
325
|
+
let j = false;
|
|
326
|
+
let A = null;
|
|
323
327
|
function notifySubs(e) {
|
|
324
328
|
for (let t = e.O; t !== null; t = t.C) {
|
|
325
|
-
const e = t.N.S & o ?
|
|
329
|
+
const e = t.N.S & o ? b : _;
|
|
326
330
|
if (e.A > t.N.o) e.A = t.N.o;
|
|
327
331
|
insertIntoHeap(t.N, e);
|
|
328
332
|
}
|
|
329
333
|
}
|
|
330
334
|
function recompute(t, n = false) {
|
|
331
|
-
const i = t.
|
|
335
|
+
const i = t.L && t.K != m;
|
|
332
336
|
if (!n) {
|
|
333
|
-
if (t.
|
|
334
|
-
deleteFromHeap(t, t.S & o ?
|
|
335
|
-
if (t.
|
|
337
|
+
if (t.K && m !== t.K && !i) O.initTransition(t);
|
|
338
|
+
deleteFromHeap(t, t.S & o ? b : _);
|
|
339
|
+
if (t.K) disposeChildren(t);
|
|
336
340
|
else {
|
|
337
341
|
markDisposal(t);
|
|
338
342
|
t.ee = t.te;
|
|
@@ -341,20 +345,20 @@ function recompute(t, n = false) {
|
|
|
341
345
|
t.re = null;
|
|
342
346
|
}
|
|
343
347
|
}
|
|
344
|
-
const s =
|
|
345
|
-
|
|
348
|
+
const s = A;
|
|
349
|
+
A = t;
|
|
346
350
|
t.ie = null;
|
|
347
351
|
t.S = r;
|
|
348
|
-
t.se =
|
|
349
|
-
let u = t.
|
|
352
|
+
t.se = S;
|
|
353
|
+
let u = t.G === p ? t.U : t.G;
|
|
350
354
|
let d = t.o;
|
|
351
355
|
let h = t.$;
|
|
352
|
-
let y = t.
|
|
356
|
+
let y = t.T;
|
|
353
357
|
let g = C;
|
|
354
358
|
setStatusFlags(t, l | (h & a));
|
|
355
359
|
C = true;
|
|
356
360
|
try {
|
|
357
|
-
u = t.F(u);
|
|
361
|
+
u = handleAsync(t, t.F(u));
|
|
358
362
|
t.$ &= ~a;
|
|
359
363
|
} catch (e) {
|
|
360
364
|
if (e instanceof NotReadyError) {
|
|
@@ -365,43 +369,90 @@ function recompute(t, n = false) {
|
|
|
365
369
|
C = g;
|
|
366
370
|
}
|
|
367
371
|
t.S = e;
|
|
368
|
-
|
|
372
|
+
A = s;
|
|
369
373
|
if (!(t.$ & f)) {
|
|
370
374
|
const e = t.ie;
|
|
371
|
-
let n = e !== null ? e.
|
|
375
|
+
let n = e !== null ? e.W : t.P;
|
|
372
376
|
if (n !== null) {
|
|
373
377
|
do {
|
|
374
378
|
n = unlinkSubs(n);
|
|
375
379
|
} while (n !== null);
|
|
376
|
-
if (e !== null) e.
|
|
377
|
-
else t.
|
|
380
|
+
if (e !== null) e.W = null;
|
|
381
|
+
else t.P = null;
|
|
378
382
|
}
|
|
379
383
|
}
|
|
380
|
-
const w = !t.oe || !t.oe(t.
|
|
381
|
-
const x = t.$ !== h || t.
|
|
384
|
+
const w = !t.oe || !t.oe(t.G === p || t.ue || i ? t.U : t.G, u);
|
|
385
|
+
const x = t.$ !== h || t.T !== y;
|
|
382
386
|
t.le?.(x, h);
|
|
383
387
|
if (w || x) {
|
|
384
388
|
if (w) {
|
|
385
|
-
if (n || t.ue || i) t.
|
|
386
|
-
else t.
|
|
387
|
-
if (t.
|
|
389
|
+
if (n || t.ue || i) t.U = u;
|
|
390
|
+
else t.G = u;
|
|
391
|
+
if (t.X) t.X.G = u;
|
|
388
392
|
}
|
|
389
393
|
for (let e = t.O; e !== null; e = e.C) {
|
|
390
|
-
const n = e.N.S & o ?
|
|
394
|
+
const n = e.N.S & o ? b : _;
|
|
391
395
|
if (e.N.o < t.o && n.A > e.N.o) n.A = e.N.o;
|
|
392
396
|
insertIntoHeap(e.N, n);
|
|
393
397
|
}
|
|
394
398
|
} else if (t.o != d) {
|
|
395
399
|
for (let e = t.O; e !== null; e = e.C) {
|
|
396
|
-
insertIntoHeapHeight(e.N, e.N.S & o ?
|
|
400
|
+
insertIntoHeapHeight(e.N, e.N.S & o ? b : _);
|
|
397
401
|
}
|
|
398
402
|
}
|
|
399
|
-
if ((!n || t.$ & f) && !t.ue && !t.
|
|
400
|
-
if (t.
|
|
403
|
+
if ((!n || t.$ & f) && !t.ue && !t.K) O.M.push(t);
|
|
404
|
+
if (t.K && i) runInTransition(t, recompute);
|
|
405
|
+
}
|
|
406
|
+
function handleAsync(e, t, n) {
|
|
407
|
+
const r = typeof t === "object" && t !== null;
|
|
408
|
+
const i = r && t instanceof Promise;
|
|
409
|
+
const s = r && untrack(() => t[Symbol.asyncIterator]);
|
|
410
|
+
if (!i && !s) {
|
|
411
|
+
e.fe = null;
|
|
412
|
+
return t;
|
|
413
|
+
}
|
|
414
|
+
e.fe = t;
|
|
415
|
+
if (i) {
|
|
416
|
+
t.then(r => {
|
|
417
|
+
if (e.fe !== t) return;
|
|
418
|
+
O.initTransition(e);
|
|
419
|
+
n?.(r) ?? setSignal(e, () => r);
|
|
420
|
+
flush();
|
|
421
|
+
}).catch(n => {
|
|
422
|
+
if (e.fe !== t) return;
|
|
423
|
+
O.initTransition(e);
|
|
424
|
+
setStatusFlags(e, c, n);
|
|
425
|
+
e.se = S;
|
|
426
|
+
notifySubs(e);
|
|
427
|
+
schedule();
|
|
428
|
+
flush();
|
|
429
|
+
});
|
|
430
|
+
} else {
|
|
431
|
+
(async () => {
|
|
432
|
+
try {
|
|
433
|
+
for await (let r of t) {
|
|
434
|
+
if (e.fe !== t) return;
|
|
435
|
+
O.initTransition(e);
|
|
436
|
+
n?.(r) ?? setSignal(e, () => r);
|
|
437
|
+
flush();
|
|
438
|
+
}
|
|
439
|
+
} catch (n) {
|
|
440
|
+
if (e.fe !== t) return;
|
|
441
|
+
O.initTransition(e);
|
|
442
|
+
setStatusFlags(e, c, n);
|
|
443
|
+
e.se = S;
|
|
444
|
+
notifySubs(e);
|
|
445
|
+
schedule();
|
|
446
|
+
flush();
|
|
447
|
+
}
|
|
448
|
+
})();
|
|
449
|
+
}
|
|
450
|
+
O.initTransition(e);
|
|
451
|
+
throw new NotReadyError(A);
|
|
401
452
|
}
|
|
402
453
|
function updateIfNecessary(r) {
|
|
403
454
|
if (r.S & t) {
|
|
404
|
-
for (let e = r.
|
|
455
|
+
for (let e = r.P; e; e = e.W) {
|
|
405
456
|
const t = e.H;
|
|
406
457
|
const i = t.I || t;
|
|
407
458
|
if (i.F) {
|
|
@@ -419,28 +470,28 @@ function updateIfNecessary(r) {
|
|
|
419
470
|
}
|
|
420
471
|
function unlinkSubs(e) {
|
|
421
472
|
const t = e.H;
|
|
422
|
-
const n = e.
|
|
473
|
+
const n = e.W;
|
|
423
474
|
const r = e.C;
|
|
424
|
-
const i = e.
|
|
425
|
-
if (r !== null) r.
|
|
426
|
-
else t.
|
|
475
|
+
const i = e.ce;
|
|
476
|
+
if (r !== null) r.ce = i;
|
|
477
|
+
else t.ae = i;
|
|
427
478
|
if (i !== null) i.C = r;
|
|
428
479
|
else {
|
|
429
480
|
t.O = r;
|
|
430
481
|
if (r === null) {
|
|
431
|
-
t.
|
|
432
|
-
t.F && !t.
|
|
482
|
+
t.de?.();
|
|
483
|
+
t.F && !t.he && unobserved(t);
|
|
433
484
|
}
|
|
434
485
|
}
|
|
435
486
|
return n;
|
|
436
487
|
}
|
|
437
488
|
function unobserved(e) {
|
|
438
|
-
deleteFromHeap(e, e.S & o ?
|
|
439
|
-
let t = e.
|
|
489
|
+
deleteFromHeap(e, e.S & o ? b : _);
|
|
490
|
+
let t = e.P;
|
|
440
491
|
while (t !== null) {
|
|
441
492
|
t = unlinkSubs(t);
|
|
442
493
|
}
|
|
443
|
-
e.
|
|
494
|
+
e.P = null;
|
|
444
495
|
disposeChildren(e, true);
|
|
445
496
|
}
|
|
446
497
|
function link(e, t) {
|
|
@@ -449,35 +500,35 @@ function link(e, t) {
|
|
|
449
500
|
let i = null;
|
|
450
501
|
const s = t.S & r;
|
|
451
502
|
if (s) {
|
|
452
|
-
i = n !== null ? n.
|
|
503
|
+
i = n !== null ? n.W : t.P;
|
|
453
504
|
if (i !== null && i.H === e) {
|
|
454
505
|
t.ie = i;
|
|
455
506
|
return;
|
|
456
507
|
}
|
|
457
508
|
}
|
|
458
|
-
const o = e.
|
|
509
|
+
const o = e.ae;
|
|
459
510
|
if (o !== null && o.N === t && (!s || isValidLink(o, t))) return;
|
|
460
|
-
const u = (t.ie = e.
|
|
461
|
-
if (n !== null) n.
|
|
462
|
-
else t.
|
|
511
|
+
const u = (t.ie = e.ae = { H: e, N: t, W: i, ce: o, C: null });
|
|
512
|
+
if (n !== null) n.W = u;
|
|
513
|
+
else t.P = u;
|
|
463
514
|
if (o !== null) o.C = u;
|
|
464
515
|
else e.O = u;
|
|
465
516
|
}
|
|
466
517
|
function isValidLink(e, t) {
|
|
467
518
|
const n = t.ie;
|
|
468
519
|
if (n !== null) {
|
|
469
|
-
let r = t.
|
|
520
|
+
let r = t.P;
|
|
470
521
|
do {
|
|
471
522
|
if (r === e) return true;
|
|
472
523
|
if (r === n) break;
|
|
473
|
-
r = r.
|
|
524
|
+
r = r.W;
|
|
474
525
|
} while (r !== null);
|
|
475
526
|
}
|
|
476
527
|
return false;
|
|
477
528
|
}
|
|
478
529
|
function setStatusFlags(e, t, n = null) {
|
|
479
530
|
e.$ = t;
|
|
480
|
-
e.
|
|
531
|
+
e.T = n;
|
|
481
532
|
}
|
|
482
533
|
function markDisposal(e) {
|
|
483
534
|
let t = e.re;
|
|
@@ -485,18 +536,18 @@ function markDisposal(e) {
|
|
|
485
536
|
t.S |= o;
|
|
486
537
|
if (t.S & i) {
|
|
487
538
|
deleteFromHeap(t, _);
|
|
488
|
-
insertIntoHeap(t,
|
|
539
|
+
insertIntoHeap(t, b);
|
|
489
540
|
}
|
|
490
541
|
markDisposal(t);
|
|
491
|
-
t = t.
|
|
542
|
+
t = t.pe;
|
|
492
543
|
}
|
|
493
544
|
}
|
|
494
545
|
function dispose(e) {
|
|
495
|
-
let t = e.
|
|
546
|
+
let t = e.P || null;
|
|
496
547
|
do {
|
|
497
548
|
t = unlinkSubs(t);
|
|
498
549
|
} while (t !== null);
|
|
499
|
-
e.
|
|
550
|
+
e.P = null;
|
|
500
551
|
e.ie = null;
|
|
501
552
|
disposeChildren(e, true);
|
|
502
553
|
}
|
|
@@ -505,15 +556,15 @@ function disposeChildren(e, t = false, n) {
|
|
|
505
556
|
if (t) e.S = u;
|
|
506
557
|
let r = n ? e.ne : e.re;
|
|
507
558
|
while (r) {
|
|
508
|
-
const e = r.
|
|
509
|
-
if (r.
|
|
559
|
+
const e = r.pe;
|
|
560
|
+
if (r.P) {
|
|
510
561
|
const e = r;
|
|
511
|
-
deleteFromHeap(e, e.S & o ?
|
|
512
|
-
let t = e.
|
|
562
|
+
deleteFromHeap(e, e.S & o ? b : _);
|
|
563
|
+
let t = e.P;
|
|
513
564
|
do {
|
|
514
565
|
t = unlinkSubs(t);
|
|
515
566
|
} while (t !== null);
|
|
516
|
-
e.
|
|
567
|
+
e.P = null;
|
|
517
568
|
e.ie = null;
|
|
518
569
|
}
|
|
519
570
|
disposeChildren(r, true);
|
|
@@ -523,7 +574,7 @@ function disposeChildren(e, t = false, n) {
|
|
|
523
574
|
e.ne = null;
|
|
524
575
|
} else {
|
|
525
576
|
e.re = null;
|
|
526
|
-
e.
|
|
577
|
+
e.pe = null;
|
|
527
578
|
}
|
|
528
579
|
runDisposal(e, n);
|
|
529
580
|
}
|
|
@@ -541,7 +592,7 @@ function runDisposal(e, t) {
|
|
|
541
592
|
t ? (e.ee = null) : (e.te = null);
|
|
542
593
|
}
|
|
543
594
|
function getNextChildId(e) {
|
|
544
|
-
if (e.id != null) return formatId(e.id, e.
|
|
595
|
+
if (e.id != null) return formatId(e.id, e.ye++);
|
|
545
596
|
throw new Error("Cannot get child id from owner without an id");
|
|
546
597
|
}
|
|
547
598
|
function formatId(e, t) {
|
|
@@ -551,124 +602,66 @@ function formatId(e, t) {
|
|
|
551
602
|
}
|
|
552
603
|
function computed(t, n, r) {
|
|
553
604
|
const i = {
|
|
554
|
-
id: r?.id ?? (
|
|
605
|
+
id: r?.id ?? (A?.id != null ? getNextChildId(A) : undefined),
|
|
555
606
|
oe: r?.equals != null ? r.equals : isEqual,
|
|
556
|
-
|
|
557
|
-
|
|
607
|
+
ge: !!r?.pureWrite,
|
|
608
|
+
de: r?.unobserved,
|
|
558
609
|
te: null,
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
610
|
+
we: A?.we ?? O,
|
|
611
|
+
_e: A?._e ?? g,
|
|
612
|
+
ye: 0,
|
|
562
613
|
F: t,
|
|
563
|
-
|
|
614
|
+
U: n,
|
|
564
615
|
o: 0,
|
|
565
616
|
k: null,
|
|
566
617
|
p: undefined,
|
|
567
618
|
h: null,
|
|
568
|
-
|
|
619
|
+
P: null,
|
|
569
620
|
ie: null,
|
|
570
621
|
O: null,
|
|
571
|
-
|
|
572
|
-
i:
|
|
573
|
-
|
|
622
|
+
ae: null,
|
|
623
|
+
i: A,
|
|
624
|
+
pe: null,
|
|
574
625
|
re: null,
|
|
575
626
|
S: e,
|
|
576
627
|
$: a,
|
|
577
|
-
se:
|
|
578
|
-
|
|
628
|
+
se: S,
|
|
629
|
+
G: p,
|
|
579
630
|
ee: null,
|
|
580
631
|
ne: null,
|
|
581
|
-
|
|
632
|
+
fe: null,
|
|
633
|
+
K: null
|
|
582
634
|
};
|
|
583
|
-
if (r?.
|
|
635
|
+
if (r?.be) Object.assign(i, r.be);
|
|
584
636
|
i.h = i;
|
|
585
|
-
const s =
|
|
586
|
-
if (
|
|
587
|
-
const e =
|
|
637
|
+
const s = A?.t ? A.u : A;
|
|
638
|
+
if (A) {
|
|
639
|
+
const e = A.re;
|
|
588
640
|
if (e === null) {
|
|
589
|
-
|
|
641
|
+
A.re = i;
|
|
590
642
|
} else {
|
|
591
|
-
i.
|
|
592
|
-
|
|
643
|
+
i.pe = e;
|
|
644
|
+
A.re = i;
|
|
593
645
|
}
|
|
594
646
|
}
|
|
595
647
|
if (s) i.o = s.o + 1;
|
|
596
648
|
recompute(i, true);
|
|
597
649
|
return i;
|
|
598
650
|
}
|
|
599
|
-
function asyncComputed(e, t, n) {
|
|
600
|
-
let r = undefined;
|
|
601
|
-
let i = false;
|
|
602
|
-
const fn = t => {
|
|
603
|
-
const n = e(t, i);
|
|
604
|
-
i = false;
|
|
605
|
-
r = n;
|
|
606
|
-
const o = n instanceof Promise;
|
|
607
|
-
const u = n[Symbol.asyncIterator];
|
|
608
|
-
if (!o && !u) {
|
|
609
|
-
return n;
|
|
610
|
-
}
|
|
611
|
-
if (o) {
|
|
612
|
-
n.then(e => {
|
|
613
|
-
if (r !== n) return;
|
|
614
|
-
O.initTransition(s);
|
|
615
|
-
setSignal(s, () => e);
|
|
616
|
-
flush();
|
|
617
|
-
}).catch(e => {
|
|
618
|
-
if (r !== n) return;
|
|
619
|
-
O.initTransition(s);
|
|
620
|
-
setStatusFlags(s, c, e);
|
|
621
|
-
s.se = b;
|
|
622
|
-
notifySubs(s);
|
|
623
|
-
schedule();
|
|
624
|
-
flush();
|
|
625
|
-
});
|
|
626
|
-
} else {
|
|
627
|
-
(async () => {
|
|
628
|
-
try {
|
|
629
|
-
for await (let e of n) {
|
|
630
|
-
if (r !== n) return;
|
|
631
|
-
O.initTransition(s);
|
|
632
|
-
setSignal(s, () => e);
|
|
633
|
-
flush();
|
|
634
|
-
}
|
|
635
|
-
} catch (e) {
|
|
636
|
-
if (r !== n) return;
|
|
637
|
-
O.initTransition(s);
|
|
638
|
-
setStatusFlags(s, c, e);
|
|
639
|
-
s.se = b;
|
|
640
|
-
notifySubs(s);
|
|
641
|
-
schedule();
|
|
642
|
-
flush();
|
|
643
|
-
}
|
|
644
|
-
})();
|
|
645
|
-
}
|
|
646
|
-
O.initTransition(E);
|
|
647
|
-
throw new NotReadyError(E);
|
|
648
|
-
};
|
|
649
|
-
const s = computed(fn, t, n);
|
|
650
|
-
s.Se = () => {
|
|
651
|
-
i = true;
|
|
652
|
-
recompute(s);
|
|
653
|
-
schedule();
|
|
654
|
-
flush();
|
|
655
|
-
};
|
|
656
|
-
return s;
|
|
657
|
-
}
|
|
658
651
|
function signal(e, t, n = null) {
|
|
659
652
|
const r = {
|
|
660
|
-
id: t?.id ?? (
|
|
653
|
+
id: t?.id ?? (A?.id != null ? getNextChildId(A) : undefined),
|
|
661
654
|
oe: t?.equals != null ? t.equals : isEqual,
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
655
|
+
ge: !!t?.pureWrite,
|
|
656
|
+
de: t?.unobserved,
|
|
657
|
+
U: e,
|
|
665
658
|
O: null,
|
|
666
|
-
|
|
659
|
+
ae: null,
|
|
667
660
|
$: l,
|
|
668
|
-
se:
|
|
661
|
+
se: S,
|
|
669
662
|
I: n,
|
|
670
663
|
j: n?.k || null,
|
|
671
|
-
|
|
664
|
+
G: p
|
|
672
665
|
};
|
|
673
666
|
n && (n.k = r);
|
|
674
667
|
return r;
|
|
@@ -686,17 +679,18 @@ function untrack(e) {
|
|
|
686
679
|
}
|
|
687
680
|
}
|
|
688
681
|
function read(e) {
|
|
689
|
-
let t =
|
|
682
|
+
let t = A;
|
|
690
683
|
if (t?.t) t = t.u;
|
|
684
|
+
if (j && e.F) recompute(e);
|
|
691
685
|
if (t && C && !k && !N) {
|
|
692
686
|
if (e.F && e.S & u) recompute(e);
|
|
693
687
|
link(e, t);
|
|
694
688
|
const n = e.I || e;
|
|
695
689
|
if (n.F) {
|
|
696
690
|
const r = e.S & o;
|
|
697
|
-
if (n.o >= (r ?
|
|
691
|
+
if (n.o >= (r ? b.A : _.A)) {
|
|
698
692
|
markNode(t);
|
|
699
|
-
markHeap(r ?
|
|
693
|
+
markHeap(r ? b : _);
|
|
700
694
|
updateIfNecessary(n);
|
|
701
695
|
}
|
|
702
696
|
const i = n.o;
|
|
@@ -706,74 +700,74 @@ function read(e) {
|
|
|
706
700
|
}
|
|
707
701
|
}
|
|
708
702
|
if (k) {
|
|
709
|
-
if (!e.
|
|
710
|
-
e.
|
|
711
|
-
e.
|
|
712
|
-
e.
|
|
703
|
+
if (!e.Z) {
|
|
704
|
+
e.Z = signal(false);
|
|
705
|
+
e.Z.ue = true;
|
|
706
|
+
e.Z.Y = t => setSignal(e.Z, t);
|
|
713
707
|
}
|
|
714
708
|
const t = k;
|
|
715
709
|
k = null;
|
|
716
|
-
t.
|
|
710
|
+
t.U = read(e.Z) || t.U;
|
|
717
711
|
k = t;
|
|
718
712
|
}
|
|
719
713
|
if (N) {
|
|
720
|
-
if (!e.
|
|
721
|
-
e.
|
|
722
|
-
e.
|
|
723
|
-
e.
|
|
714
|
+
if (!e.X) {
|
|
715
|
+
e.X = signal(e.U);
|
|
716
|
+
e.X.ue = true;
|
|
717
|
+
e.X.Y = t => setSignal(e.X, t);
|
|
724
718
|
}
|
|
725
719
|
N = false;
|
|
726
720
|
try {
|
|
727
|
-
return read(e.
|
|
721
|
+
return read(e.X);
|
|
728
722
|
} finally {
|
|
729
723
|
N = true;
|
|
730
724
|
}
|
|
731
725
|
}
|
|
732
726
|
if (e.$ & f && !k) {
|
|
733
|
-
if ((t && !v) || e.$ & a) throw e.
|
|
727
|
+
if ((t && !v) || e.$ & a) throw e.T;
|
|
734
728
|
else if (t && v) {
|
|
735
|
-
setStatusFlags(t, t.$ | 1, e.
|
|
729
|
+
setStatusFlags(t, t.$ | 1, e.T);
|
|
736
730
|
}
|
|
737
731
|
}
|
|
738
732
|
if (e.$ & c) {
|
|
739
|
-
if (e.se <
|
|
733
|
+
if (e.se < S) {
|
|
740
734
|
recompute(e, true);
|
|
741
735
|
return read(e);
|
|
742
736
|
} else {
|
|
743
|
-
throw e.
|
|
737
|
+
throw e.T;
|
|
744
738
|
}
|
|
745
739
|
}
|
|
746
|
-
return !t || e.ue || e.
|
|
740
|
+
return !t || e.ue || e.G === p || (v && !k && e.K && m !== e.K) ? e.U : e.G;
|
|
747
741
|
}
|
|
748
742
|
function setSignal(e, t) {
|
|
749
743
|
if (typeof t === "function") {
|
|
750
|
-
t = t(e.
|
|
744
|
+
t = t(e.G === p ? e.U : e.G);
|
|
751
745
|
}
|
|
752
|
-
const n = !e.oe || !e.oe(e.
|
|
746
|
+
const n = !e.oe || !e.oe(e.G === p || e.ue ? e.U : e.G, t);
|
|
753
747
|
if (!n && !e.$) return t;
|
|
754
748
|
if (n) {
|
|
755
|
-
if (e.ue) e.
|
|
749
|
+
if (e.ue) e.U = t;
|
|
756
750
|
else {
|
|
757
|
-
if (e.
|
|
758
|
-
e.
|
|
751
|
+
if (e.G === p) O.M.push(e);
|
|
752
|
+
e.G = t;
|
|
759
753
|
}
|
|
760
|
-
if (e.
|
|
754
|
+
if (e.X) e.X.G = t;
|
|
761
755
|
}
|
|
762
756
|
setStatusFlags(e, l);
|
|
763
|
-
e.se =
|
|
757
|
+
e.se = S;
|
|
764
758
|
notifySubs(e);
|
|
765
759
|
schedule();
|
|
766
760
|
return t;
|
|
767
761
|
}
|
|
768
762
|
function getObserver() {
|
|
769
|
-
return C ?
|
|
763
|
+
return C ? A : null;
|
|
770
764
|
}
|
|
771
765
|
function getOwner() {
|
|
772
|
-
return
|
|
766
|
+
return A;
|
|
773
767
|
}
|
|
774
768
|
function onCleanup(e) {
|
|
775
|
-
if (!
|
|
776
|
-
const t =
|
|
769
|
+
if (!A) return e;
|
|
770
|
+
const t = A;
|
|
777
771
|
if (!t.te) {
|
|
778
772
|
t.te = e;
|
|
779
773
|
} else if (Array.isArray(t.te)) {
|
|
@@ -784,17 +778,17 @@ function onCleanup(e) {
|
|
|
784
778
|
return e;
|
|
785
779
|
}
|
|
786
780
|
function createOwner(e) {
|
|
787
|
-
const t =
|
|
781
|
+
const t = A;
|
|
788
782
|
const n = {
|
|
789
783
|
t: true,
|
|
790
784
|
u: t?.t ? t.u : t,
|
|
791
785
|
re: null,
|
|
792
|
-
|
|
786
|
+
pe: null,
|
|
793
787
|
te: null,
|
|
794
788
|
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
789
|
+
we: t?.we ?? O,
|
|
790
|
+
_e: t?._e || g,
|
|
791
|
+
ye: 0,
|
|
798
792
|
ee: null,
|
|
799
793
|
ne: null,
|
|
800
794
|
i: t,
|
|
@@ -807,7 +801,7 @@ function createOwner(e) {
|
|
|
807
801
|
if (e === null) {
|
|
808
802
|
t.re = n;
|
|
809
803
|
} else {
|
|
810
|
-
n.
|
|
804
|
+
n.pe = e;
|
|
811
805
|
t.re = n;
|
|
812
806
|
}
|
|
813
807
|
}
|
|
@@ -818,12 +812,12 @@ function createRoot(e, t) {
|
|
|
818
812
|
return runWithOwner(n, () => e(n.dispose));
|
|
819
813
|
}
|
|
820
814
|
function runWithOwner(e, t) {
|
|
821
|
-
const n =
|
|
822
|
-
|
|
815
|
+
const n = A;
|
|
816
|
+
A = e;
|
|
823
817
|
try {
|
|
824
818
|
return t();
|
|
825
819
|
} finally {
|
|
826
|
-
|
|
820
|
+
A = n;
|
|
827
821
|
}
|
|
828
822
|
}
|
|
829
823
|
function staleValues(e, t = true) {
|
|
@@ -846,10 +840,10 @@ function pending(e) {
|
|
|
846
840
|
}
|
|
847
841
|
function isPending(e) {
|
|
848
842
|
const t = k;
|
|
849
|
-
k = {
|
|
843
|
+
k = { U: false };
|
|
850
844
|
try {
|
|
851
845
|
staleValues(e);
|
|
852
|
-
return k.
|
|
846
|
+
return k.U;
|
|
853
847
|
} catch (e) {
|
|
854
848
|
if (!(e instanceof NotReadyError)) return false;
|
|
855
849
|
throw e;
|
|
@@ -857,6 +851,22 @@ function isPending(e) {
|
|
|
857
851
|
k = t;
|
|
858
852
|
}
|
|
859
853
|
}
|
|
854
|
+
function refresh(e) {
|
|
855
|
+
let t = j;
|
|
856
|
+
j = true;
|
|
857
|
+
try {
|
|
858
|
+
return untrack(e);
|
|
859
|
+
} finally {
|
|
860
|
+
j = t;
|
|
861
|
+
if (!t) {
|
|
862
|
+
schedule();
|
|
863
|
+
flush();
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
function isRefreshing() {
|
|
868
|
+
return j;
|
|
869
|
+
}
|
|
860
870
|
function createContext(e, t) {
|
|
861
871
|
return { id: Symbol(t), defaultValue: e };
|
|
862
872
|
}
|
|
@@ -864,7 +874,7 @@ function getContext(e, t = getOwner()) {
|
|
|
864
874
|
if (!t) {
|
|
865
875
|
throw new NoOwnerError();
|
|
866
876
|
}
|
|
867
|
-
const n = hasContext(e, t) ? t.
|
|
877
|
+
const n = hasContext(e, t) ? t._e[e.id] : e.defaultValue;
|
|
868
878
|
if (isUndefined(n)) {
|
|
869
879
|
throw new ContextNotFoundError();
|
|
870
880
|
}
|
|
@@ -874,10 +884,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
874
884
|
if (!n) {
|
|
875
885
|
throw new NoOwnerError();
|
|
876
886
|
}
|
|
877
|
-
n.
|
|
887
|
+
n._e = { ...n._e, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
878
888
|
}
|
|
879
889
|
function hasContext(e, t) {
|
|
880
|
-
return !isUndefined(t?.
|
|
890
|
+
return !isUndefined(t?._e[e.id]);
|
|
881
891
|
}
|
|
882
892
|
function isUndefined(e) {
|
|
883
893
|
return typeof e === "undefined";
|
|
@@ -886,23 +896,23 @@ function effect(e, t, n, r, i) {
|
|
|
886
896
|
let s = false;
|
|
887
897
|
const o = computed(e, r, {
|
|
888
898
|
...i,
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
899
|
+
be: {
|
|
900
|
+
J: true,
|
|
901
|
+
Se: r,
|
|
892
902
|
me: t,
|
|
893
903
|
xe: n,
|
|
894
904
|
Oe: undefined,
|
|
895
|
-
|
|
905
|
+
L: i?.render ? d : h,
|
|
896
906
|
le(e, t) {
|
|
897
907
|
if (s) {
|
|
898
908
|
const n = this.$ && this.$ === t && e;
|
|
899
|
-
this.
|
|
900
|
-
if (this.
|
|
909
|
+
this.J = !(this.$ & c) && !(this.$ & f & ~t) && !n;
|
|
910
|
+
if (this.J) this.we.enqueue(this.L, runEffect.bind(this));
|
|
901
911
|
}
|
|
902
912
|
if (this.$ & c) {
|
|
903
|
-
let e = this.
|
|
904
|
-
this.
|
|
905
|
-
if (this.
|
|
913
|
+
let e = this.T;
|
|
914
|
+
this.we.notify(this, f, 0);
|
|
915
|
+
if (this.L === h) {
|
|
906
916
|
try {
|
|
907
917
|
return this.xe
|
|
908
918
|
? this.xe(e, () => {
|
|
@@ -914,31 +924,31 @@ function effect(e, t, n, r, i) {
|
|
|
914
924
|
e = t;
|
|
915
925
|
}
|
|
916
926
|
}
|
|
917
|
-
if (!this.
|
|
918
|
-
} else if (this.
|
|
919
|
-
this.
|
|
927
|
+
if (!this.we.notify(this, c, c)) throw e;
|
|
928
|
+
} else if (this.L === d) {
|
|
929
|
+
this.we.notify(this, f | c, this.$);
|
|
920
930
|
}
|
|
921
931
|
}
|
|
922
932
|
}
|
|
923
933
|
});
|
|
924
934
|
s = true;
|
|
925
|
-
if (o.
|
|
935
|
+
if (o.L === d) o.F = t => staleValues(() => e(t));
|
|
926
936
|
!i?.defer &&
|
|
927
937
|
!(o.$ & (c | f)) &&
|
|
928
|
-
(o.
|
|
938
|
+
(o.L === h ? o.we.enqueue(o.L, runEffect.bind(o)) : runEffect.call(o));
|
|
929
939
|
onCleanup(() => o.Oe?.());
|
|
930
940
|
}
|
|
931
941
|
function runEffect() {
|
|
932
|
-
if (!this.
|
|
942
|
+
if (!this.J || this.S & u) return;
|
|
933
943
|
this.Oe?.();
|
|
934
944
|
this.Oe = undefined;
|
|
935
945
|
try {
|
|
936
|
-
this.Oe = this.me(this.
|
|
946
|
+
this.Oe = this.me(this.U, this.Se);
|
|
937
947
|
} catch (e) {
|
|
938
|
-
if (!this.
|
|
948
|
+
if (!this.we.notify(this, c, c)) throw e;
|
|
939
949
|
} finally {
|
|
940
|
-
this.
|
|
941
|
-
this.
|
|
950
|
+
this.Se = this.U;
|
|
951
|
+
this.J = false;
|
|
942
952
|
}
|
|
943
953
|
}
|
|
944
954
|
function createSignal(e, t, n) {
|
|
@@ -955,12 +965,6 @@ function createMemo(e, t, n) {
|
|
|
955
965
|
let r = computed(e, t, n);
|
|
956
966
|
return read.bind(null, r);
|
|
957
967
|
}
|
|
958
|
-
function createAsync(e, t, n) {
|
|
959
|
-
const r = asyncComputed(e, t, n);
|
|
960
|
-
const i = read.bind(null, r);
|
|
961
|
-
i.refresh = r.Se;
|
|
962
|
-
return i;
|
|
963
|
-
}
|
|
964
968
|
function createEffect(e, t, n, r) {
|
|
965
969
|
void effect(e, t.effect || t, t.error, n, r);
|
|
966
970
|
}
|
|
@@ -1016,7 +1020,7 @@ function onSettled(e) {
|
|
|
1016
1020
|
});
|
|
1017
1021
|
}
|
|
1018
1022
|
function unwrap(e) {
|
|
1019
|
-
return e?.[W]?.[
|
|
1023
|
+
return e?.[W]?.[V] ?? e;
|
|
1020
1024
|
}
|
|
1021
1025
|
function getOverrideValue(e, t, n, r) {
|
|
1022
1026
|
return n && r in n ? read(n[r]) : t && r in t ? t[r] : e[r];
|
|
@@ -1029,13 +1033,13 @@ function getAllKeys(e, t, n) {
|
|
|
1029
1033
|
function applyState(e, t, n, r) {
|
|
1030
1034
|
const i = t?.[W];
|
|
1031
1035
|
if (!i) return;
|
|
1032
|
-
const s = i[
|
|
1033
|
-
const o = i[
|
|
1034
|
-
let u = i[
|
|
1036
|
+
const s = i[Q];
|
|
1037
|
+
const o = i[R];
|
|
1038
|
+
let u = i[V];
|
|
1035
1039
|
if (e === s && !o) return;
|
|
1036
|
-
(i[
|
|
1037
|
-
i[
|
|
1038
|
-
i[
|
|
1040
|
+
(i[D] || T).set(e, i[H]);
|
|
1041
|
+
i[Q] = e;
|
|
1042
|
+
i[R] = undefined;
|
|
1039
1043
|
if (Array.isArray(s)) {
|
|
1040
1044
|
let t = false;
|
|
1041
1045
|
const l = getOverrideValue(s, o, u, "length");
|
|
@@ -1062,16 +1066,16 @@ function applyState(e, t, n, r) {
|
|
|
1062
1066
|
if (a > h || a > d) {
|
|
1063
1067
|
for (c = a; c <= h; c++) {
|
|
1064
1068
|
t = true;
|
|
1065
|
-
i[
|
|
1069
|
+
i[V][c] && setSignal(i[V][c], wrap(e[c], i));
|
|
1066
1070
|
}
|
|
1067
1071
|
for (; c < e.length; c++) {
|
|
1068
1072
|
t = true;
|
|
1069
1073
|
const s = wrap(w[c], i);
|
|
1070
|
-
i[
|
|
1074
|
+
i[V][c] && setSignal(i[V][c], s);
|
|
1071
1075
|
applyState(e[c], s, n, r);
|
|
1072
1076
|
}
|
|
1073
|
-
t && i[
|
|
1074
|
-
l !== e.length && i[
|
|
1077
|
+
t && i[V][E] && setSignal(i[V][E], void 0);
|
|
1078
|
+
l !== e.length && i[V].length && setSignal(i[V].length, e.length);
|
|
1075
1079
|
return;
|
|
1076
1080
|
}
|
|
1077
1081
|
y = new Array(h + 1);
|
|
@@ -1095,9 +1099,9 @@ function applyState(e, t, n, r) {
|
|
|
1095
1099
|
for (c = a; c < e.length; c++) {
|
|
1096
1100
|
if (c in w) {
|
|
1097
1101
|
const t = wrap(w[c], i);
|
|
1098
|
-
i[
|
|
1102
|
+
i[V][c] && setSignal(i[V][c], t);
|
|
1099
1103
|
applyState(e[c], t, n, r);
|
|
1100
|
-
} else i[
|
|
1104
|
+
} else i[V][c] && setSignal(i[V][c], wrap(e[c], i));
|
|
1101
1105
|
}
|
|
1102
1106
|
if (a < e.length) t = true;
|
|
1103
1107
|
} else if (l && e.length) {
|
|
@@ -1108,13 +1112,13 @@ function applyState(e, t, n, r) {
|
|
|
1108
1112
|
}
|
|
1109
1113
|
if (l !== e.length) {
|
|
1110
1114
|
t = true;
|
|
1111
|
-
i[
|
|
1115
|
+
i[V].length && setSignal(i[V].length, e.length);
|
|
1112
1116
|
}
|
|
1113
|
-
t && i[
|
|
1117
|
+
t && i[V][E] && setSignal(i[V][E], void 0);
|
|
1114
1118
|
return;
|
|
1115
1119
|
}
|
|
1116
1120
|
if (u) {
|
|
1117
|
-
const t = u[
|
|
1121
|
+
const t = u[E];
|
|
1118
1122
|
const l = t || r ? getAllKeys(s, o, e) : Object.keys(u);
|
|
1119
1123
|
for (let f = 0, c = l.length; f < c; f++) {
|
|
1120
1124
|
const c = l[f];
|
|
@@ -1128,7 +1132,7 @@ function applyState(e, t, n, r) {
|
|
|
1128
1132
|
} else applyState(h, wrap(d, i), n, r);
|
|
1129
1133
|
}
|
|
1130
1134
|
}
|
|
1131
|
-
if ((u = i[
|
|
1135
|
+
if ((u = i[q])) {
|
|
1132
1136
|
const t = Object.keys(u);
|
|
1133
1137
|
for (let n = 0, r = t.length; n < r; n++) {
|
|
1134
1138
|
const r = t[n];
|
|
@@ -1151,11 +1155,11 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1151
1155
|
const i = new WeakMap();
|
|
1152
1156
|
const wrapProjection = e => {
|
|
1153
1157
|
if (i.has(e)) return i.get(e);
|
|
1154
|
-
if (e[W]?.[
|
|
1158
|
+
if (e[W]?.[M] === wrapProjection) return e;
|
|
1155
1159
|
const t = createStoreProxy(e, G, {
|
|
1156
|
-
[
|
|
1157
|
-
[
|
|
1158
|
-
[
|
|
1160
|
+
[M]: wrapProjection,
|
|
1161
|
+
[D]: i,
|
|
1162
|
+
[B]() {
|
|
1159
1163
|
return r;
|
|
1160
1164
|
}
|
|
1161
1165
|
});
|
|
@@ -1164,11 +1168,12 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1164
1168
|
};
|
|
1165
1169
|
const s = wrapProjection(t);
|
|
1166
1170
|
r = computed(() => {
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
reconcile(
|
|
1171
|
-
}
|
|
1171
|
+
const t = r || getOwner();
|
|
1172
|
+
storeSetter(s, r => {
|
|
1173
|
+
const i = handleAsync(t, e(r), e => {
|
|
1174
|
+
e !== r && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
|
|
1175
|
+
});
|
|
1176
|
+
i !== r && i !== undefined && reconcile(i, n?.key || "id", n?.all)(r);
|
|
1172
1177
|
});
|
|
1173
1178
|
});
|
|
1174
1179
|
return { store: s, node: r };
|
|
@@ -1176,19 +1181,19 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1176
1181
|
function createProjection(e, t = {}, n) {
|
|
1177
1182
|
return createProjectionInternal(e, t, n).store;
|
|
1178
1183
|
}
|
|
1179
|
-
const
|
|
1180
|
-
A = Symbol(0),
|
|
1181
|
-
W = Symbol(0),
|
|
1184
|
+
const E = Symbol(0),
|
|
1182
1185
|
P = Symbol(0),
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1186
|
+
W = Symbol(0),
|
|
1187
|
+
H = Symbol(0),
|
|
1188
|
+
I = Symbol(0);
|
|
1189
|
+
const F = new WeakMap();
|
|
1190
|
+
const Q = "v",
|
|
1191
|
+
R = "o",
|
|
1192
|
+
V = "n",
|
|
1193
|
+
q = "h",
|
|
1194
|
+
M = "w",
|
|
1195
|
+
D = "l",
|
|
1196
|
+
B = "f";
|
|
1192
1197
|
function createStoreProxy(e, t = G, n) {
|
|
1193
1198
|
let r;
|
|
1194
1199
|
if (Array.isArray(e)) {
|
|
@@ -1196,13 +1201,13 @@ function createStoreProxy(e, t = G, n) {
|
|
|
1196
1201
|
r.v = e;
|
|
1197
1202
|
} else r = { v: e };
|
|
1198
1203
|
n && Object.assign(r, n);
|
|
1199
|
-
return (r[
|
|
1204
|
+
return (r[H] = new Proxy(r, t));
|
|
1200
1205
|
}
|
|
1201
|
-
const
|
|
1206
|
+
const T = new WeakMap();
|
|
1202
1207
|
function wrap(e, t) {
|
|
1203
|
-
if (t?.[
|
|
1204
|
-
let n = e[
|
|
1205
|
-
if (!n)
|
|
1208
|
+
if (t?.[M]) return t[M](e, t);
|
|
1209
|
+
let n = e[H] || T.get(e);
|
|
1210
|
+
if (!n) T.set(e, (n = createStoreProxy(e)));
|
|
1206
1211
|
return n;
|
|
1207
1212
|
}
|
|
1208
1213
|
function isWrappable(e) {
|
|
@@ -1226,8 +1231,8 @@ function getNode(e, t, n, r, i = isEqual) {
|
|
|
1226
1231
|
r
|
|
1227
1232
|
));
|
|
1228
1233
|
}
|
|
1229
|
-
function trackSelf(e, t =
|
|
1230
|
-
getObserver() && read(getNode(getNodes(e,
|
|
1234
|
+
function trackSelf(e, t = E) {
|
|
1235
|
+
getObserver() && read(getNode(getNodes(e, V), t, undefined, e[B]?.(), false));
|
|
1231
1236
|
}
|
|
1232
1237
|
function getKeys(e, t, n = true) {
|
|
1233
1238
|
const r = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
|
|
@@ -1235,7 +1240,7 @@ function getKeys(e, t, n = true) {
|
|
|
1235
1240
|
const i = new Set(r);
|
|
1236
1241
|
const s = Reflect.ownKeys(t);
|
|
1237
1242
|
for (const e of s) {
|
|
1238
|
-
if (t[e] !==
|
|
1243
|
+
if (t[e] !== I) i.add(e);
|
|
1239
1244
|
else i.delete(e);
|
|
1240
1245
|
}
|
|
1241
1246
|
return Array.from(i);
|
|
@@ -1243,7 +1248,7 @@ function getKeys(e, t, n = true) {
|
|
|
1243
1248
|
function getPropertyDescriptor(e, t, n) {
|
|
1244
1249
|
let r = e;
|
|
1245
1250
|
if (t && n in t) {
|
|
1246
|
-
if (r[n] ===
|
|
1251
|
+
if (r[n] === I) return void 0;
|
|
1247
1252
|
if (!(n in r)) r = t;
|
|
1248
1253
|
}
|
|
1249
1254
|
return Reflect.getOwnPropertyDescriptor(r, n);
|
|
@@ -1252,109 +1257,109 @@ let K = null;
|
|
|
1252
1257
|
const G = {
|
|
1253
1258
|
get(e, t, n) {
|
|
1254
1259
|
if (t === W) return e;
|
|
1255
|
-
if (t ===
|
|
1256
|
-
if (t ===
|
|
1260
|
+
if (t === H) return n;
|
|
1261
|
+
if (t === E || t === P) {
|
|
1257
1262
|
trackSelf(e, t);
|
|
1258
1263
|
return n;
|
|
1259
1264
|
}
|
|
1260
|
-
const r = getNodes(e,
|
|
1265
|
+
const r = getNodes(e, V);
|
|
1261
1266
|
const i = r[t];
|
|
1262
|
-
const s = e[
|
|
1263
|
-
const o = !!e[
|
|
1264
|
-
const u = s ? e[
|
|
1267
|
+
const s = e[R] && t in e[R];
|
|
1268
|
+
const o = !!e[Q][W];
|
|
1269
|
+
const u = s ? e[R] : e[Q];
|
|
1265
1270
|
if (!i) {
|
|
1266
1271
|
const e = Object.getOwnPropertyDescriptor(u, t);
|
|
1267
1272
|
if (e && e.get) return e.get.call(n);
|
|
1268
1273
|
}
|
|
1269
1274
|
if (K?.has(n)) {
|
|
1270
|
-
let n = i && (s || !o) ? (i.
|
|
1271
|
-
n ===
|
|
1275
|
+
let n = i && (s || !o) ? (i.G !== p ? i.G : i.U) : u[t];
|
|
1276
|
+
n === I && (n = undefined);
|
|
1272
1277
|
if (!isWrappable(n)) return n;
|
|
1273
1278
|
const r = wrap(n, e);
|
|
1274
1279
|
K.add(r);
|
|
1275
1280
|
return r;
|
|
1276
1281
|
}
|
|
1277
1282
|
let l = i ? (s || !o ? read(r[t]) : (read(r[t]), u[t])) : u[t];
|
|
1278
|
-
l ===
|
|
1283
|
+
l === I && (l = undefined);
|
|
1279
1284
|
if (!i) {
|
|
1280
1285
|
if (!s && typeof l === "function" && !u.hasOwnProperty(t)) {
|
|
1281
1286
|
let t;
|
|
1282
|
-
return !Array.isArray(e[
|
|
1287
|
+
return !Array.isArray(e[Q]) && (t = Object.getPrototypeOf(e[Q])) && t !== Object.prototype
|
|
1283
1288
|
? l.bind(u)
|
|
1284
1289
|
: l;
|
|
1285
1290
|
} else if (getObserver()) {
|
|
1286
|
-
return read(getNode(r, t, isWrappable(l) ? wrap(l, e) : l, e[
|
|
1291
|
+
return read(getNode(r, t, isWrappable(l) ? wrap(l, e) : l, e[B]?.()));
|
|
1287
1292
|
}
|
|
1288
1293
|
}
|
|
1289
1294
|
return isWrappable(l) ? wrap(l, e) : l;
|
|
1290
1295
|
},
|
|
1291
1296
|
has(e, t) {
|
|
1292
|
-
if (t ===
|
|
1293
|
-
const n = e[
|
|
1294
|
-
getObserver() && read(getNode(getNodes(e,
|
|
1297
|
+
if (t === H || t === E || t === "__proto__") return true;
|
|
1298
|
+
const n = e[R] && t in e[R] ? e[R][t] !== I : t in e[Q];
|
|
1299
|
+
getObserver() && read(getNode(getNodes(e, q), t, n, e[B]?.()));
|
|
1295
1300
|
return n;
|
|
1296
1301
|
},
|
|
1297
1302
|
set(e, t, n) {
|
|
1298
|
-
const r = e[
|
|
1299
|
-
if (K?.has(e[
|
|
1303
|
+
const r = e[H];
|
|
1304
|
+
if (K?.has(e[H])) {
|
|
1300
1305
|
untrack(() => {
|
|
1301
|
-
const i = e[
|
|
1306
|
+
const i = e[Q];
|
|
1302
1307
|
const s = i[t];
|
|
1303
|
-
const o = e[
|
|
1304
|
-
const u = n?.[W]?.[
|
|
1308
|
+
const o = e[R] && t in e[R] ? e[R][t] : s;
|
|
1309
|
+
const u = n?.[W]?.[Q] ?? n;
|
|
1305
1310
|
if (o === u) return true;
|
|
1306
|
-
const l = e[
|
|
1307
|
-
if (u !== undefined && u === s) delete e[
|
|
1308
|
-
else (e[
|
|
1311
|
+
const l = e[R]?.length || i.length;
|
|
1312
|
+
if (u !== undefined && u === s) delete e[R][t];
|
|
1313
|
+
else (e[R] || (e[R] = Object.create(null)))[t] = u;
|
|
1309
1314
|
const f = isWrappable(u);
|
|
1310
1315
|
if (isWrappable(o)) {
|
|
1311
|
-
const e =
|
|
1312
|
-
e && (e instanceof Set ? e.delete(r) :
|
|
1316
|
+
const e = F.get(o);
|
|
1317
|
+
e && (e instanceof Set ? e.delete(r) : F.delete(o));
|
|
1313
1318
|
}
|
|
1314
|
-
if (recursivelyNotify(r,
|
|
1315
|
-
e[
|
|
1316
|
-
const c = getNodes(e,
|
|
1319
|
+
if (recursivelyNotify(r, T) && f) recursivelyAddParent(u, r);
|
|
1320
|
+
e[q]?.[t] && setSignal(e[q][t], true);
|
|
1321
|
+
const c = getNodes(e, V);
|
|
1317
1322
|
c[t] && setSignal(c[t], () => (f ? wrap(u, e) : u));
|
|
1318
1323
|
if (Array.isArray(i)) {
|
|
1319
1324
|
const e = parseInt(t) + 1;
|
|
1320
1325
|
if (e > l) c.length && setSignal(c.length, e);
|
|
1321
1326
|
}
|
|
1322
|
-
c[
|
|
1327
|
+
c[E] && setSignal(c[E], undefined);
|
|
1323
1328
|
});
|
|
1324
1329
|
}
|
|
1325
1330
|
return true;
|
|
1326
1331
|
},
|
|
1327
1332
|
deleteProperty(e, t) {
|
|
1328
|
-
if (K?.has(e[
|
|
1333
|
+
if (K?.has(e[H]) && e[R]?.[t] !== I) {
|
|
1329
1334
|
untrack(() => {
|
|
1330
|
-
const n = e[
|
|
1331
|
-
if (t in e[
|
|
1332
|
-
(e[
|
|
1333
|
-
} else if (e[
|
|
1334
|
-
delete e[
|
|
1335
|
+
const n = e[R] && t in e[R] ? e[R][t] : e[Q][t];
|
|
1336
|
+
if (t in e[Q]) {
|
|
1337
|
+
(e[R] || (e[R] = Object.create(null)))[t] = I;
|
|
1338
|
+
} else if (e[R] && t in e[R]) {
|
|
1339
|
+
delete e[R][t];
|
|
1335
1340
|
} else return true;
|
|
1336
1341
|
if (isWrappable(n)) {
|
|
1337
|
-
const t =
|
|
1338
|
-
t && (t instanceof Set ? t.delete(e) :
|
|
1342
|
+
const t = F.get(n);
|
|
1343
|
+
t && (t instanceof Set ? t.delete(e) : F.delete(n));
|
|
1339
1344
|
}
|
|
1340
|
-
if (e[
|
|
1341
|
-
const r = getNodes(e,
|
|
1345
|
+
if (e[q]?.[t]) setSignal(e[q][t], false);
|
|
1346
|
+
const r = getNodes(e, V);
|
|
1342
1347
|
r[t] && setSignal(r[t], undefined);
|
|
1343
|
-
r[
|
|
1348
|
+
r[E] && setSignal(r[E], undefined);
|
|
1344
1349
|
});
|
|
1345
1350
|
}
|
|
1346
1351
|
return true;
|
|
1347
1352
|
},
|
|
1348
1353
|
ownKeys(e) {
|
|
1349
1354
|
trackSelf(e);
|
|
1350
|
-
return getKeys(e[
|
|
1355
|
+
return getKeys(e[Q], e[R], false);
|
|
1351
1356
|
},
|
|
1352
1357
|
getOwnPropertyDescriptor(e, t) {
|
|
1353
|
-
if (t ===
|
|
1354
|
-
return getPropertyDescriptor(e[
|
|
1358
|
+
if (t === H) return { value: e[H], writable: true, configurable: true };
|
|
1359
|
+
return getPropertyDescriptor(e[Q], e[R], t);
|
|
1355
1360
|
},
|
|
1356
1361
|
getPrototypeOf(e) {
|
|
1357
|
-
return Object.getPrototypeOf(e[
|
|
1362
|
+
return Object.getPrototypeOf(e[Q]);
|
|
1358
1363
|
}
|
|
1359
1364
|
};
|
|
1360
1365
|
function storeSetter(e, t) {
|
|
@@ -1389,14 +1394,14 @@ function recursivelyNotify(e, t) {
|
|
|
1389
1394
|
let n = e[W] || t?.get(e)?.[W];
|
|
1390
1395
|
let r = false;
|
|
1391
1396
|
if (n) {
|
|
1392
|
-
const e = getNodes(n,
|
|
1397
|
+
const e = getNodes(n, V)[P];
|
|
1393
1398
|
if (e) {
|
|
1394
1399
|
setSignal(e, undefined);
|
|
1395
1400
|
r = true;
|
|
1396
1401
|
}
|
|
1397
|
-
t = n[
|
|
1402
|
+
t = n[D] || t;
|
|
1398
1403
|
}
|
|
1399
|
-
const i =
|
|
1404
|
+
const i = F.get(n?.[Q] || e);
|
|
1400
1405
|
if (!i) return r;
|
|
1401
1406
|
if (i instanceof Set) {
|
|
1402
1407
|
for (let e of i) r = recursivelyNotify(e, t) || r;
|
|
@@ -1407,14 +1412,14 @@ function recursivelyAddParent(e, t) {
|
|
|
1407
1412
|
let n;
|
|
1408
1413
|
const r = e[W];
|
|
1409
1414
|
if (r) {
|
|
1410
|
-
n = r[
|
|
1411
|
-
e = r[
|
|
1415
|
+
n = r[R];
|
|
1416
|
+
e = r[Q];
|
|
1412
1417
|
}
|
|
1413
1418
|
if (t) {
|
|
1414
|
-
let n =
|
|
1415
|
-
if (!n)
|
|
1419
|
+
let n = F.get(e);
|
|
1420
|
+
if (!n) F.set(e, t);
|
|
1416
1421
|
else if (n !== t) {
|
|
1417
|
-
if (!(n instanceof Set))
|
|
1422
|
+
if (!(n instanceof Set)) F.set(e, (n = new Set([n])));
|
|
1418
1423
|
else if (n.has(t)) return;
|
|
1419
1424
|
n.add(t);
|
|
1420
1425
|
} else return;
|
|
@@ -1436,7 +1441,7 @@ function recursivelyAddParent(e, t) {
|
|
|
1436
1441
|
}
|
|
1437
1442
|
function deep(e) {
|
|
1438
1443
|
recursivelyAddParent(e);
|
|
1439
|
-
return e[
|
|
1444
|
+
return e[P];
|
|
1440
1445
|
}
|
|
1441
1446
|
function createOptimisticStore(e, t, n) {
|
|
1442
1447
|
return [];
|
|
@@ -1447,11 +1452,11 @@ function snapshot(e, t, n) {
|
|
|
1447
1452
|
if (t && t.has(e)) return t.get(e);
|
|
1448
1453
|
if (!t) t = new Map();
|
|
1449
1454
|
if ((r = e[W] || n?.get(e)?.[W])) {
|
|
1450
|
-
s = r[
|
|
1451
|
-
i = Array.isArray(r[
|
|
1452
|
-
t.set(e, s ? (o = i ? [] : Object.create(Object.getPrototypeOf(r[
|
|
1453
|
-
e = r[
|
|
1454
|
-
n =
|
|
1455
|
+
s = r[R];
|
|
1456
|
+
i = Array.isArray(r[Q]);
|
|
1457
|
+
t.set(e, s ? (o = i ? [] : Object.create(Object.getPrototypeOf(r[Q]))) : r[Q]);
|
|
1458
|
+
e = r[Q];
|
|
1459
|
+
n = T;
|
|
1455
1460
|
} else {
|
|
1456
1461
|
i = Array.isArray(e);
|
|
1457
1462
|
t.set(e, e);
|
|
@@ -1460,7 +1465,7 @@ function snapshot(e, t, n) {
|
|
|
1460
1465
|
const r = s?.length || e.length;
|
|
1461
1466
|
for (let i = 0; i < r; i++) {
|
|
1462
1467
|
l = s && i in s ? s[i] : e[i];
|
|
1463
|
-
if (l ===
|
|
1468
|
+
if (l === I) continue;
|
|
1464
1469
|
if ((u = snapshot(l, t, n)) !== l || o) {
|
|
1465
1470
|
if (!o) t.set(e, (o = [...e]));
|
|
1466
1471
|
o[i] = u;
|
|
@@ -1487,13 +1492,13 @@ function snapshot(e, t, n) {
|
|
|
1487
1492
|
function trueFn() {
|
|
1488
1493
|
return true;
|
|
1489
1494
|
}
|
|
1490
|
-
const
|
|
1495
|
+
const U = {
|
|
1491
1496
|
get(e, t, n) {
|
|
1492
|
-
if (t ===
|
|
1497
|
+
if (t === H) return n;
|
|
1493
1498
|
return e.get(t);
|
|
1494
1499
|
},
|
|
1495
1500
|
has(e, t) {
|
|
1496
|
-
if (t ===
|
|
1501
|
+
if (t === H) return true;
|
|
1497
1502
|
return e.has(t);
|
|
1498
1503
|
},
|
|
1499
1504
|
set: trueFn,
|
|
@@ -1516,15 +1521,15 @@ const T = {
|
|
|
1516
1521
|
function resolveSource(e) {
|
|
1517
1522
|
return !(e = typeof e === "function" ? e() : e) ? {} : e;
|
|
1518
1523
|
}
|
|
1519
|
-
const
|
|
1524
|
+
const L = Symbol(0);
|
|
1520
1525
|
function merge(...e) {
|
|
1521
1526
|
if (e.length === 1 && typeof e[0] !== "function") return e[0];
|
|
1522
1527
|
let t = false;
|
|
1523
1528
|
const n = [];
|
|
1524
1529
|
for (let r = 0; r < e.length; r++) {
|
|
1525
1530
|
const i = e[r];
|
|
1526
|
-
t = t || (!!i &&
|
|
1527
|
-
const s = !!i && i[
|
|
1531
|
+
t = t || (!!i && H in i);
|
|
1532
|
+
const s = !!i && i[L];
|
|
1528
1533
|
if (s) n.push(...s);
|
|
1529
1534
|
else n.push(typeof i === "function" ? ((t = true), createMemo(i)) : i);
|
|
1530
1535
|
}
|
|
@@ -1532,7 +1537,7 @@ function merge(...e) {
|
|
|
1532
1537
|
return new Proxy(
|
|
1533
1538
|
{
|
|
1534
1539
|
get(e) {
|
|
1535
|
-
if (e ===
|
|
1540
|
+
if (e === L) return n;
|
|
1536
1541
|
for (let t = n.length - 1; t >= 0; t--) {
|
|
1537
1542
|
const r = resolveSource(n[t]);
|
|
1538
1543
|
if (e in r) return r[e];
|
|
@@ -1550,7 +1555,7 @@ function merge(...e) {
|
|
|
1550
1555
|
return [...new Set(e)];
|
|
1551
1556
|
}
|
|
1552
1557
|
},
|
|
1553
|
-
|
|
1558
|
+
U
|
|
1554
1559
|
);
|
|
1555
1560
|
}
|
|
1556
1561
|
const r = Object.create(null);
|
|
@@ -1582,12 +1587,12 @@ function merge(...e) {
|
|
|
1582
1587
|
if (n.get) Object.defineProperty(o, t, n);
|
|
1583
1588
|
else o[t] = n.value;
|
|
1584
1589
|
}
|
|
1585
|
-
o[
|
|
1590
|
+
o[L] = n;
|
|
1586
1591
|
return o;
|
|
1587
1592
|
}
|
|
1588
1593
|
function omit(e, ...t) {
|
|
1589
1594
|
const n = new Set(t);
|
|
1590
|
-
if (y &&
|
|
1595
|
+
if (y && H in e) {
|
|
1591
1596
|
return new Proxy(
|
|
1592
1597
|
{
|
|
1593
1598
|
get(t) {
|
|
@@ -1600,7 +1605,7 @@ function omit(e, ...t) {
|
|
|
1600
1605
|
return Object.keys(e).filter(e => !n.has(e));
|
|
1601
1606
|
}
|
|
1602
1607
|
},
|
|
1603
|
-
|
|
1608
|
+
U
|
|
1604
1609
|
);
|
|
1605
1610
|
}
|
|
1606
1611
|
const r = {};
|
|
@@ -1622,62 +1627,62 @@ function mapArray(e, t, n) {
|
|
|
1622
1627
|
ve: 0,
|
|
1623
1628
|
Ne: e,
|
|
1624
1629
|
ke: [],
|
|
1625
|
-
|
|
1626
|
-
je: [],
|
|
1630
|
+
je: t,
|
|
1627
1631
|
Ae: [],
|
|
1628
|
-
|
|
1629
|
-
Pe: r
|
|
1632
|
+
Ee: [],
|
|
1633
|
+
Pe: r,
|
|
1634
|
+
We: r || n?.keyed === false ? [] : undefined,
|
|
1630
1635
|
He: t.length > 1 ? [] : undefined,
|
|
1631
1636
|
Ie: n?.fallback
|
|
1632
1637
|
})
|
|
1633
1638
|
);
|
|
1634
1639
|
}
|
|
1635
|
-
const
|
|
1640
|
+
const z = { pureWrite: true };
|
|
1636
1641
|
function updateKeyedMap() {
|
|
1637
1642
|
const e = this.Ne() || [],
|
|
1638
1643
|
t = e.length;
|
|
1639
|
-
e[
|
|
1644
|
+
e[E];
|
|
1640
1645
|
runWithOwner(this.Ce, () => {
|
|
1641
1646
|
let n,
|
|
1642
1647
|
r,
|
|
1643
|
-
i = this.
|
|
1648
|
+
i = this.We
|
|
1644
1649
|
? () => {
|
|
1645
|
-
this.
|
|
1646
|
-
this.He && (this.He[r] = signal(r,
|
|
1647
|
-
return this.
|
|
1648
|
-
read.bind(null, this.
|
|
1650
|
+
this.We[r] = signal(e[r], z);
|
|
1651
|
+
this.He && (this.He[r] = signal(r, z));
|
|
1652
|
+
return this.je(
|
|
1653
|
+
read.bind(null, this.We[r]),
|
|
1649
1654
|
this.He ? read.bind(null, this.He[r]) : undefined
|
|
1650
1655
|
);
|
|
1651
1656
|
}
|
|
1652
1657
|
: this.He
|
|
1653
1658
|
? () => {
|
|
1654
1659
|
const t = e[r];
|
|
1655
|
-
this.He[r] = signal(r,
|
|
1656
|
-
return this.
|
|
1660
|
+
this.He[r] = signal(r, z);
|
|
1661
|
+
return this.je(() => t, read.bind(null, this.He[r]));
|
|
1657
1662
|
}
|
|
1658
1663
|
: () => {
|
|
1659
1664
|
const t = e[r];
|
|
1660
|
-
return this.
|
|
1665
|
+
return this.je(() => t);
|
|
1661
1666
|
};
|
|
1662
1667
|
if (t === 0) {
|
|
1663
1668
|
if (this.ve !== 0) {
|
|
1664
1669
|
this.Ce.dispose(false);
|
|
1665
|
-
this.
|
|
1670
|
+
this.Ee = [];
|
|
1666
1671
|
this.ke = [];
|
|
1667
|
-
this.
|
|
1672
|
+
this.Ae = [];
|
|
1668
1673
|
this.ve = 0;
|
|
1669
|
-
this.
|
|
1674
|
+
this.We && (this.We = []);
|
|
1670
1675
|
this.He && (this.He = []);
|
|
1671
1676
|
}
|
|
1672
|
-
if (this.Ie && !this.
|
|
1673
|
-
this.
|
|
1677
|
+
if (this.Ie && !this.Ae[0]) {
|
|
1678
|
+
this.Ae[0] = runWithOwner((this.Ee[0] = createOwner()), this.Ie);
|
|
1674
1679
|
}
|
|
1675
1680
|
} else if (this.ve === 0) {
|
|
1676
|
-
if (this.
|
|
1677
|
-
this.
|
|
1681
|
+
if (this.Ee[0]) this.Ee[0].dispose();
|
|
1682
|
+
this.Ae = new Array(t);
|
|
1678
1683
|
for (r = 0; r < t; r++) {
|
|
1679
1684
|
this.ke[r] = e[r];
|
|
1680
|
-
this.
|
|
1685
|
+
this.Ae[r] = runWithOwner((this.Ee[r] = createOwner()), i);
|
|
1681
1686
|
}
|
|
1682
1687
|
this.ve = t;
|
|
1683
1688
|
} else {
|
|
@@ -1690,70 +1695,70 @@ function updateKeyedMap() {
|
|
|
1690
1695
|
a,
|
|
1691
1696
|
d = new Array(t),
|
|
1692
1697
|
h = new Array(t),
|
|
1693
|
-
p = this.
|
|
1698
|
+
p = this.We ? new Array(t) : undefined,
|
|
1694
1699
|
y = this.He ? new Array(t) : undefined;
|
|
1695
1700
|
for (
|
|
1696
1701
|
s = 0, o = Math.min(this.ve, t);
|
|
1697
|
-
s < o && (this.ke[s] === e[s] || (this.
|
|
1702
|
+
s < o && (this.ke[s] === e[s] || (this.We && compare(this.Pe, this.ke[s], e[s])));
|
|
1698
1703
|
s++
|
|
1699
1704
|
) {
|
|
1700
|
-
if (this.
|
|
1705
|
+
if (this.We) setSignal(this.We[s], e[s]);
|
|
1701
1706
|
}
|
|
1702
1707
|
for (
|
|
1703
1708
|
o = this.ve - 1, u = t - 1;
|
|
1704
1709
|
o >= s &&
|
|
1705
1710
|
u >= s &&
|
|
1706
|
-
(this.ke[o] === e[u] || (this.
|
|
1711
|
+
(this.ke[o] === e[u] || (this.We && compare(this.Pe, this.ke[o], e[u])));
|
|
1707
1712
|
o--, u--
|
|
1708
1713
|
) {
|
|
1709
|
-
d[u] = this.
|
|
1710
|
-
h[u] = this.
|
|
1711
|
-
p && (p[u] = this.
|
|
1714
|
+
d[u] = this.Ae[o];
|
|
1715
|
+
h[u] = this.Ee[o];
|
|
1716
|
+
p && (p[u] = this.We[o]);
|
|
1712
1717
|
y && (y[u] = this.He[o]);
|
|
1713
1718
|
}
|
|
1714
1719
|
c = new Map();
|
|
1715
1720
|
a = new Array(u + 1);
|
|
1716
1721
|
for (r = u; r >= s; r--) {
|
|
1717
1722
|
l = e[r];
|
|
1718
|
-
f = this.
|
|
1723
|
+
f = this.Pe ? this.Pe(l) : l;
|
|
1719
1724
|
n = c.get(f);
|
|
1720
1725
|
a[r] = n === undefined ? -1 : n;
|
|
1721
1726
|
c.set(f, r);
|
|
1722
1727
|
}
|
|
1723
1728
|
for (n = s; n <= o; n++) {
|
|
1724
1729
|
l = this.ke[n];
|
|
1725
|
-
f = this.
|
|
1730
|
+
f = this.Pe ? this.Pe(l) : l;
|
|
1726
1731
|
r = c.get(f);
|
|
1727
1732
|
if (r !== undefined && r !== -1) {
|
|
1728
|
-
d[r] = this.
|
|
1729
|
-
h[r] = this.
|
|
1730
|
-
p && (p[r] = this.
|
|
1733
|
+
d[r] = this.Ae[n];
|
|
1734
|
+
h[r] = this.Ee[n];
|
|
1735
|
+
p && (p[r] = this.We[n]);
|
|
1731
1736
|
y && (y[r] = this.He[n]);
|
|
1732
1737
|
r = a[r];
|
|
1733
1738
|
c.set(f, r);
|
|
1734
|
-
} else this.
|
|
1739
|
+
} else this.Ee[n].dispose();
|
|
1735
1740
|
}
|
|
1736
1741
|
for (r = s; r < t; r++) {
|
|
1737
1742
|
if (r in d) {
|
|
1738
|
-
this.
|
|
1739
|
-
this.
|
|
1743
|
+
this.Ae[r] = d[r];
|
|
1744
|
+
this.Ee[r] = h[r];
|
|
1740
1745
|
if (p) {
|
|
1741
|
-
this.
|
|
1742
|
-
setSignal(this.
|
|
1746
|
+
this.We[r] = p[r];
|
|
1747
|
+
setSignal(this.We[r], e[r]);
|
|
1743
1748
|
}
|
|
1744
1749
|
if (y) {
|
|
1745
1750
|
this.He[r] = y[r];
|
|
1746
1751
|
setSignal(this.He[r], r);
|
|
1747
1752
|
}
|
|
1748
1753
|
} else {
|
|
1749
|
-
this.
|
|
1754
|
+
this.Ae[r] = runWithOwner((this.Ee[r] = createOwner()), i);
|
|
1750
1755
|
}
|
|
1751
1756
|
}
|
|
1752
|
-
this.
|
|
1757
|
+
this.Ae = this.Ae.slice(0, (this.ve = t));
|
|
1753
1758
|
this.ke = e.slice(0);
|
|
1754
1759
|
}
|
|
1755
1760
|
});
|
|
1756
|
-
return this.
|
|
1761
|
+
return this.Ae;
|
|
1757
1762
|
}
|
|
1758
1763
|
function repeat(e, t, n) {
|
|
1759
1764
|
return updateRepeat.bind({
|
|
@@ -1761,9 +1766,9 @@ function repeat(e, t, n) {
|
|
|
1761
1766
|
ve: 0,
|
|
1762
1767
|
Fe: 0,
|
|
1763
1768
|
Qe: e,
|
|
1764
|
-
|
|
1769
|
+
je: t,
|
|
1770
|
+
Ee: [],
|
|
1765
1771
|
Ae: [],
|
|
1766
|
-
je: [],
|
|
1767
1772
|
Re: n?.from,
|
|
1768
1773
|
Ie: n?.fallback
|
|
1769
1774
|
});
|
|
@@ -1775,71 +1780,71 @@ function updateRepeat() {
|
|
|
1775
1780
|
if (e === 0) {
|
|
1776
1781
|
if (this.ve !== 0) {
|
|
1777
1782
|
this.Ce.dispose(false);
|
|
1783
|
+
this.Ee = [];
|
|
1778
1784
|
this.Ae = [];
|
|
1779
|
-
this.je = [];
|
|
1780
1785
|
this.ve = 0;
|
|
1781
1786
|
}
|
|
1782
|
-
if (this.Ie && !this.
|
|
1783
|
-
this.
|
|
1787
|
+
if (this.Ie && !this.Ae[0]) {
|
|
1788
|
+
this.Ae[0] = runWithOwner((this.Ee[0] = createOwner()), this.Ie);
|
|
1784
1789
|
}
|
|
1785
1790
|
return;
|
|
1786
1791
|
}
|
|
1787
1792
|
const n = t + e;
|
|
1788
1793
|
const r = this.Fe + this.ve;
|
|
1789
|
-
if (this.ve === 0 && this.
|
|
1790
|
-
for (let e = n; e < r; e++) this.
|
|
1794
|
+
if (this.ve === 0 && this.Ee[0]) this.Ee[0].dispose();
|
|
1795
|
+
for (let e = n; e < r; e++) this.Ee[e - this.Fe].dispose();
|
|
1791
1796
|
if (this.Fe < t) {
|
|
1792
1797
|
let e = this.Fe;
|
|
1793
|
-
while (e < t && e < this.ve) this.
|
|
1798
|
+
while (e < t && e < this.ve) this.Ee[e++].dispose();
|
|
1799
|
+
this.Ee.splice(0, t - this.Fe);
|
|
1794
1800
|
this.Ae.splice(0, t - this.Fe);
|
|
1795
|
-
this.je.splice(0, t - this.Fe);
|
|
1796
1801
|
} else if (this.Fe > t) {
|
|
1797
1802
|
let n = r - this.Fe - 1;
|
|
1798
1803
|
let i = this.Fe - t;
|
|
1799
|
-
this.
|
|
1804
|
+
this.Ee.length = this.Ae.length = e;
|
|
1800
1805
|
while (n >= i) {
|
|
1806
|
+
this.Ee[n] = this.Ee[n - i];
|
|
1801
1807
|
this.Ae[n] = this.Ae[n - i];
|
|
1802
|
-
this.je[n] = this.je[n - i];
|
|
1803
1808
|
n--;
|
|
1804
1809
|
}
|
|
1805
1810
|
for (let e = 0; e < i; e++) {
|
|
1806
|
-
this.
|
|
1811
|
+
this.Ae[e] = runWithOwner((this.Ee[e] = createOwner()), () => this.je(e + t));
|
|
1807
1812
|
}
|
|
1808
1813
|
}
|
|
1809
1814
|
for (let e = r; e < n; e++) {
|
|
1810
|
-
this.
|
|
1815
|
+
this.Ae[e - t] = runWithOwner((this.Ee[e - t] = createOwner()), () => this.je(e));
|
|
1811
1816
|
}
|
|
1812
|
-
this.
|
|
1817
|
+
this.Ae = this.Ae.slice(0, e);
|
|
1813
1818
|
this.Fe = t;
|
|
1814
1819
|
this.ve = e;
|
|
1815
1820
|
});
|
|
1816
|
-
return this.
|
|
1821
|
+
return this.Ae;
|
|
1817
1822
|
}
|
|
1818
1823
|
function compare(e, t, n) {
|
|
1819
1824
|
return e ? e(t) === e(n) : true;
|
|
1820
1825
|
}
|
|
1821
1826
|
function boundaryComputed(e, t) {
|
|
1822
1827
|
const n = computed(e, undefined, {
|
|
1823
|
-
|
|
1828
|
+
be: {
|
|
1824
1829
|
le() {
|
|
1825
1830
|
let e = this.$;
|
|
1826
1831
|
this.$ &= ~this.Ve;
|
|
1827
1832
|
if (this.Ve & f && !(this.$ & a)) {
|
|
1828
1833
|
e &= ~f;
|
|
1829
1834
|
}
|
|
1830
|
-
this.
|
|
1835
|
+
this.we.notify(this, this.Ve, e);
|
|
1831
1836
|
},
|
|
1832
1837
|
Ve: t
|
|
1833
1838
|
}
|
|
1834
1839
|
});
|
|
1835
1840
|
n.Ve = t;
|
|
1836
|
-
n.
|
|
1841
|
+
n.he = true;
|
|
1837
1842
|
return n;
|
|
1838
1843
|
}
|
|
1839
1844
|
function createBoundChildren(e, t, n, r) {
|
|
1840
|
-
const i = e.
|
|
1841
|
-
i.addChild((e.
|
|
1842
|
-
onCleanup(() => i.removeChild(e.
|
|
1845
|
+
const i = e.we;
|
|
1846
|
+
i.addChild((e.we = n));
|
|
1847
|
+
onCleanup(() => i.removeChild(e.we));
|
|
1843
1848
|
return runWithOwner(e, () => {
|
|
1844
1849
|
const e = computed(t);
|
|
1845
1850
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), r);
|
|
@@ -1877,7 +1882,7 @@ class ConditionalQueue extends Queue {
|
|
|
1877
1882
|
}
|
|
1878
1883
|
class CollectionQueue extends Queue {
|
|
1879
1884
|
De;
|
|
1880
|
-
|
|
1885
|
+
Ee = new Set();
|
|
1881
1886
|
qe = signal(false, { pureWrite: true });
|
|
1882
1887
|
Be = false;
|
|
1883
1888
|
constructor(e) {
|
|
@@ -1891,24 +1896,24 @@ class CollectionQueue extends Queue {
|
|
|
1891
1896
|
notify(e, t, n) {
|
|
1892
1897
|
if (!(t & this.De) || (this.De & f && this.Be)) return super.notify(e, t, n);
|
|
1893
1898
|
if (n & this.De) {
|
|
1894
|
-
this.
|
|
1895
|
-
if (this.
|
|
1896
|
-
} else if (this.
|
|
1897
|
-
this.
|
|
1898
|
-
if (this.
|
|
1899
|
+
this.Ee.add(e);
|
|
1900
|
+
if (this.Ee.size === 1) setSignal(this.qe, true);
|
|
1901
|
+
} else if (this.Ee.size > 0) {
|
|
1902
|
+
this.Ee.delete(e);
|
|
1903
|
+
if (this.Ee.size === 0) setSignal(this.qe, false);
|
|
1899
1904
|
}
|
|
1900
1905
|
t &= ~this.De;
|
|
1901
1906
|
return t ? super.notify(e, t, n) : true;
|
|
1902
1907
|
}
|
|
1903
1908
|
}
|
|
1904
|
-
var
|
|
1909
|
+
var J;
|
|
1905
1910
|
(function (e) {
|
|
1906
1911
|
e["VISIBLE"] = "visible";
|
|
1907
1912
|
e["HIDDEN"] = "hidden";
|
|
1908
|
-
})(
|
|
1913
|
+
})(J || (J = {}));
|
|
1909
1914
|
function createBoundary(e, t) {
|
|
1910
1915
|
const n = createOwner();
|
|
1911
|
-
const r = new ConditionalQueue(computed(() => t() ===
|
|
1916
|
+
const r = new ConditionalQueue(computed(() => t() === J.HIDDEN));
|
|
1912
1917
|
const i = createBoundChildren(n, e, r, 0);
|
|
1913
1918
|
computed(() => {
|
|
1914
1919
|
const e = read(r.qe);
|
|
@@ -1941,23 +1946,23 @@ function createLoadBoundary(e, t) {
|
|
|
1941
1946
|
}
|
|
1942
1947
|
function collectErrorSources(e, t) {
|
|
1943
1948
|
let n = true;
|
|
1944
|
-
let r = e.
|
|
1949
|
+
let r = e.P;
|
|
1945
1950
|
while (r !== null) {
|
|
1946
1951
|
const e = r.H;
|
|
1947
|
-
if (e.
|
|
1952
|
+
if (e.P && e.$ & c) {
|
|
1948
1953
|
n = false;
|
|
1949
1954
|
collectErrorSources(e, t);
|
|
1950
1955
|
}
|
|
1951
|
-
r = r.
|
|
1956
|
+
r = r.W;
|
|
1952
1957
|
}
|
|
1953
1958
|
n && t.push(e);
|
|
1954
1959
|
}
|
|
1955
1960
|
function createErrorBoundary(e, t) {
|
|
1956
1961
|
return createCollectionBoundary(c, e, e => {
|
|
1957
|
-
let n = e.
|
|
1958
|
-
return t(n.
|
|
1962
|
+
let n = e.Ee.values().next().value;
|
|
1963
|
+
return t(n.T, () => {
|
|
1959
1964
|
const t = [];
|
|
1960
|
-
for (const n of e.
|
|
1965
|
+
for (const n of e.Ee) collectErrorSources(n, t);
|
|
1961
1966
|
for (const e of t) recompute(e);
|
|
1962
1967
|
schedule();
|
|
1963
1968
|
});
|
|
@@ -2012,14 +2017,13 @@ function flattenArray(e, t = [], n) {
|
|
|
2012
2017
|
if (r) throw r;
|
|
2013
2018
|
return i;
|
|
2014
2019
|
}
|
|
2015
|
-
exports.$PROXY =
|
|
2020
|
+
exports.$PROXY = H;
|
|
2016
2021
|
exports.$TARGET = W;
|
|
2017
|
-
exports.$TRACK =
|
|
2022
|
+
exports.$TRACK = E;
|
|
2018
2023
|
exports.ContextNotFoundError = ContextNotFoundError;
|
|
2019
2024
|
exports.NoOwnerError = NoOwnerError;
|
|
2020
2025
|
exports.NotReadyError = NotReadyError;
|
|
2021
2026
|
exports.SUPPORTS_PROXY = y;
|
|
2022
|
-
exports.createAsync = createAsync;
|
|
2023
2027
|
exports.createBoundary = createBoundary;
|
|
2024
2028
|
exports.createContext = createContext;
|
|
2025
2029
|
exports.createEffect = createEffect;
|
|
@@ -2044,6 +2048,7 @@ exports.getObserver = getObserver;
|
|
|
2044
2048
|
exports.getOwner = getOwner;
|
|
2045
2049
|
exports.isEqual = isEqual;
|
|
2046
2050
|
exports.isPending = isPending;
|
|
2051
|
+
exports.isRefreshing = isRefreshing;
|
|
2047
2052
|
exports.isWrappable = isWrappable;
|
|
2048
2053
|
exports.mapArray = mapArray;
|
|
2049
2054
|
exports.merge = merge;
|
|
@@ -2052,6 +2057,7 @@ exports.onCleanup = onCleanup;
|
|
|
2052
2057
|
exports.onSettled = onSettled;
|
|
2053
2058
|
exports.pending = pending;
|
|
2054
2059
|
exports.reconcile = reconcile;
|
|
2060
|
+
exports.refresh = refresh;
|
|
2055
2061
|
exports.repeat = repeat;
|
|
2056
2062
|
exports.resolve = resolve;
|
|
2057
2063
|
exports.runWithOwner = runWithOwner;
|