@solidjs/signals 0.9.0 → 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 +23 -19
- package/dist/node.cjs +189 -186
- package/dist/prod.js +91 -88
- 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
|
}
|
|
@@ -323,17 +326,17 @@ let j = false;
|
|
|
323
326
|
let A = null;
|
|
324
327
|
function notifySubs(e) {
|
|
325
328
|
for (let t = e.O; t !== null; t = t.C) {
|
|
326
|
-
const e = t.N.S & o ?
|
|
329
|
+
const e = t.N.S & o ? b : _;
|
|
327
330
|
if (e.A > t.N.o) e.A = t.N.o;
|
|
328
331
|
insertIntoHeap(t.N, e);
|
|
329
332
|
}
|
|
330
333
|
}
|
|
331
334
|
function recompute(t, n = false) {
|
|
332
|
-
const i = t.
|
|
335
|
+
const i = t.L && t.K != m;
|
|
333
336
|
if (!n) {
|
|
334
|
-
if (t.
|
|
335
|
-
deleteFromHeap(t, t.S & o ?
|
|
336
|
-
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);
|
|
337
340
|
else {
|
|
338
341
|
markDisposal(t);
|
|
339
342
|
t.ee = t.te;
|
|
@@ -346,11 +349,11 @@ function recompute(t, n = false) {
|
|
|
346
349
|
A = t;
|
|
347
350
|
t.ie = null;
|
|
348
351
|
t.S = r;
|
|
349
|
-
t.se =
|
|
350
|
-
let u = t.
|
|
352
|
+
t.se = S;
|
|
353
|
+
let u = t.G === p ? t.U : t.G;
|
|
351
354
|
let d = t.o;
|
|
352
355
|
let h = t.$;
|
|
353
|
-
let y = t.
|
|
356
|
+
let y = t.T;
|
|
354
357
|
let g = C;
|
|
355
358
|
setStatusFlags(t, l | (h & a));
|
|
356
359
|
C = true;
|
|
@@ -369,36 +372,36 @@ function recompute(t, n = false) {
|
|
|
369
372
|
A = s;
|
|
370
373
|
if (!(t.$ & f)) {
|
|
371
374
|
const e = t.ie;
|
|
372
|
-
let n = e !== null ? e.
|
|
375
|
+
let n = e !== null ? e.W : t.P;
|
|
373
376
|
if (n !== null) {
|
|
374
377
|
do {
|
|
375
378
|
n = unlinkSubs(n);
|
|
376
379
|
} while (n !== null);
|
|
377
|
-
if (e !== null) e.
|
|
378
|
-
else t.
|
|
380
|
+
if (e !== null) e.W = null;
|
|
381
|
+
else t.P = null;
|
|
379
382
|
}
|
|
380
383
|
}
|
|
381
|
-
const w = !t.oe || !t.oe(t.
|
|
382
|
-
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;
|
|
383
386
|
t.le?.(x, h);
|
|
384
387
|
if (w || x) {
|
|
385
388
|
if (w) {
|
|
386
|
-
if (n || t.ue || i) t.
|
|
387
|
-
else t.
|
|
388
|
-
if (t.
|
|
389
|
+
if (n || t.ue || i) t.U = u;
|
|
390
|
+
else t.G = u;
|
|
391
|
+
if (t.X) t.X.G = u;
|
|
389
392
|
}
|
|
390
393
|
for (let e = t.O; e !== null; e = e.C) {
|
|
391
|
-
const n = e.N.S & o ?
|
|
394
|
+
const n = e.N.S & o ? b : _;
|
|
392
395
|
if (e.N.o < t.o && n.A > e.N.o) n.A = e.N.o;
|
|
393
396
|
insertIntoHeap(e.N, n);
|
|
394
397
|
}
|
|
395
398
|
} else if (t.o != d) {
|
|
396
399
|
for (let e = t.O; e !== null; e = e.C) {
|
|
397
|
-
insertIntoHeapHeight(e.N, e.N.S & o ?
|
|
400
|
+
insertIntoHeapHeight(e.N, e.N.S & o ? b : _);
|
|
398
401
|
}
|
|
399
402
|
}
|
|
400
|
-
if ((!n || t.$ & f) && !t.ue && !t.
|
|
401
|
-
if (t.
|
|
403
|
+
if ((!n || t.$ & f) && !t.ue && !t.K) O.M.push(t);
|
|
404
|
+
if (t.K && i) runInTransition(t, recompute);
|
|
402
405
|
}
|
|
403
406
|
function handleAsync(e, t, n) {
|
|
404
407
|
const r = typeof t === "object" && t !== null;
|
|
@@ -419,7 +422,7 @@ function handleAsync(e, t, n) {
|
|
|
419
422
|
if (e.fe !== t) return;
|
|
420
423
|
O.initTransition(e);
|
|
421
424
|
setStatusFlags(e, c, n);
|
|
422
|
-
e.se =
|
|
425
|
+
e.se = S;
|
|
423
426
|
notifySubs(e);
|
|
424
427
|
schedule();
|
|
425
428
|
flush();
|
|
@@ -437,7 +440,7 @@ function handleAsync(e, t, n) {
|
|
|
437
440
|
if (e.fe !== t) return;
|
|
438
441
|
O.initTransition(e);
|
|
439
442
|
setStatusFlags(e, c, n);
|
|
440
|
-
e.se =
|
|
443
|
+
e.se = S;
|
|
441
444
|
notifySubs(e);
|
|
442
445
|
schedule();
|
|
443
446
|
flush();
|
|
@@ -449,7 +452,7 @@ function handleAsync(e, t, n) {
|
|
|
449
452
|
}
|
|
450
453
|
function updateIfNecessary(r) {
|
|
451
454
|
if (r.S & t) {
|
|
452
|
-
for (let e = r.
|
|
455
|
+
for (let e = r.P; e; e = e.W) {
|
|
453
456
|
const t = e.H;
|
|
454
457
|
const i = t.I || t;
|
|
455
458
|
if (i.F) {
|
|
@@ -467,7 +470,7 @@ function updateIfNecessary(r) {
|
|
|
467
470
|
}
|
|
468
471
|
function unlinkSubs(e) {
|
|
469
472
|
const t = e.H;
|
|
470
|
-
const n = e.
|
|
473
|
+
const n = e.W;
|
|
471
474
|
const r = e.C;
|
|
472
475
|
const i = e.ce;
|
|
473
476
|
if (r !== null) r.ce = i;
|
|
@@ -483,12 +486,12 @@ function unlinkSubs(e) {
|
|
|
483
486
|
return n;
|
|
484
487
|
}
|
|
485
488
|
function unobserved(e) {
|
|
486
|
-
deleteFromHeap(e, e.S & o ?
|
|
487
|
-
let t = e.
|
|
489
|
+
deleteFromHeap(e, e.S & o ? b : _);
|
|
490
|
+
let t = e.P;
|
|
488
491
|
while (t !== null) {
|
|
489
492
|
t = unlinkSubs(t);
|
|
490
493
|
}
|
|
491
|
-
e.
|
|
494
|
+
e.P = null;
|
|
492
495
|
disposeChildren(e, true);
|
|
493
496
|
}
|
|
494
497
|
function link(e, t) {
|
|
@@ -497,7 +500,7 @@ function link(e, t) {
|
|
|
497
500
|
let i = null;
|
|
498
501
|
const s = t.S & r;
|
|
499
502
|
if (s) {
|
|
500
|
-
i = n !== null ? n.
|
|
503
|
+
i = n !== null ? n.W : t.P;
|
|
501
504
|
if (i !== null && i.H === e) {
|
|
502
505
|
t.ie = i;
|
|
503
506
|
return;
|
|
@@ -505,27 +508,27 @@ function link(e, t) {
|
|
|
505
508
|
}
|
|
506
509
|
const o = e.ae;
|
|
507
510
|
if (o !== null && o.N === t && (!s || isValidLink(o, t))) return;
|
|
508
|
-
const u = (t.ie = e.ae = { H: e, N: t,
|
|
509
|
-
if (n !== null) n.
|
|
510
|
-
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;
|
|
511
514
|
if (o !== null) o.C = u;
|
|
512
515
|
else e.O = u;
|
|
513
516
|
}
|
|
514
517
|
function isValidLink(e, t) {
|
|
515
518
|
const n = t.ie;
|
|
516
519
|
if (n !== null) {
|
|
517
|
-
let r = t.
|
|
520
|
+
let r = t.P;
|
|
518
521
|
do {
|
|
519
522
|
if (r === e) return true;
|
|
520
523
|
if (r === n) break;
|
|
521
|
-
r = r.
|
|
524
|
+
r = r.W;
|
|
522
525
|
} while (r !== null);
|
|
523
526
|
}
|
|
524
527
|
return false;
|
|
525
528
|
}
|
|
526
529
|
function setStatusFlags(e, t, n = null) {
|
|
527
530
|
e.$ = t;
|
|
528
|
-
e.
|
|
531
|
+
e.T = n;
|
|
529
532
|
}
|
|
530
533
|
function markDisposal(e) {
|
|
531
534
|
let t = e.re;
|
|
@@ -533,18 +536,18 @@ function markDisposal(e) {
|
|
|
533
536
|
t.S |= o;
|
|
534
537
|
if (t.S & i) {
|
|
535
538
|
deleteFromHeap(t, _);
|
|
536
|
-
insertIntoHeap(t,
|
|
539
|
+
insertIntoHeap(t, b);
|
|
537
540
|
}
|
|
538
541
|
markDisposal(t);
|
|
539
542
|
t = t.pe;
|
|
540
543
|
}
|
|
541
544
|
}
|
|
542
545
|
function dispose(e) {
|
|
543
|
-
let t = e.
|
|
546
|
+
let t = e.P || null;
|
|
544
547
|
do {
|
|
545
548
|
t = unlinkSubs(t);
|
|
546
549
|
} while (t !== null);
|
|
547
|
-
e.
|
|
550
|
+
e.P = null;
|
|
548
551
|
e.ie = null;
|
|
549
552
|
disposeChildren(e, true);
|
|
550
553
|
}
|
|
@@ -554,14 +557,14 @@ function disposeChildren(e, t = false, n) {
|
|
|
554
557
|
let r = n ? e.ne : e.re;
|
|
555
558
|
while (r) {
|
|
556
559
|
const e = r.pe;
|
|
557
|
-
if (r.
|
|
560
|
+
if (r.P) {
|
|
558
561
|
const e = r;
|
|
559
|
-
deleteFromHeap(e, e.S & o ?
|
|
560
|
-
let t = e.
|
|
562
|
+
deleteFromHeap(e, e.S & o ? b : _);
|
|
563
|
+
let t = e.P;
|
|
561
564
|
do {
|
|
562
565
|
t = unlinkSubs(t);
|
|
563
566
|
} while (t !== null);
|
|
564
|
-
e.
|
|
567
|
+
e.P = null;
|
|
565
568
|
e.ie = null;
|
|
566
569
|
}
|
|
567
570
|
disposeChildren(r, true);
|
|
@@ -608,12 +611,12 @@ function computed(t, n, r) {
|
|
|
608
611
|
_e: A?._e ?? g,
|
|
609
612
|
ye: 0,
|
|
610
613
|
F: t,
|
|
611
|
-
|
|
614
|
+
U: n,
|
|
612
615
|
o: 0,
|
|
613
616
|
k: null,
|
|
614
617
|
p: undefined,
|
|
615
618
|
h: null,
|
|
616
|
-
|
|
619
|
+
P: null,
|
|
617
620
|
ie: null,
|
|
618
621
|
O: null,
|
|
619
622
|
ae: null,
|
|
@@ -622,14 +625,14 @@ function computed(t, n, r) {
|
|
|
622
625
|
re: null,
|
|
623
626
|
S: e,
|
|
624
627
|
$: a,
|
|
625
|
-
se:
|
|
626
|
-
|
|
628
|
+
se: S,
|
|
629
|
+
G: p,
|
|
627
630
|
ee: null,
|
|
628
631
|
ne: null,
|
|
629
632
|
fe: null,
|
|
630
|
-
|
|
633
|
+
K: null
|
|
631
634
|
};
|
|
632
|
-
if (r?.
|
|
635
|
+
if (r?.be) Object.assign(i, r.be);
|
|
633
636
|
i.h = i;
|
|
634
637
|
const s = A?.t ? A.u : A;
|
|
635
638
|
if (A) {
|
|
@@ -651,14 +654,14 @@ function signal(e, t, n = null) {
|
|
|
651
654
|
oe: t?.equals != null ? t.equals : isEqual,
|
|
652
655
|
ge: !!t?.pureWrite,
|
|
653
656
|
de: t?.unobserved,
|
|
654
|
-
|
|
657
|
+
U: e,
|
|
655
658
|
O: null,
|
|
656
659
|
ae: null,
|
|
657
660
|
$: l,
|
|
658
|
-
se:
|
|
661
|
+
se: S,
|
|
659
662
|
I: n,
|
|
660
663
|
j: n?.k || null,
|
|
661
|
-
|
|
664
|
+
G: p
|
|
662
665
|
};
|
|
663
666
|
n && (n.k = r);
|
|
664
667
|
return r;
|
|
@@ -685,9 +688,9 @@ function read(e) {
|
|
|
685
688
|
const n = e.I || e;
|
|
686
689
|
if (n.F) {
|
|
687
690
|
const r = e.S & o;
|
|
688
|
-
if (n.o >= (r ?
|
|
691
|
+
if (n.o >= (r ? b.A : _.A)) {
|
|
689
692
|
markNode(t);
|
|
690
|
-
markHeap(r ?
|
|
693
|
+
markHeap(r ? b : _);
|
|
691
694
|
updateIfNecessary(n);
|
|
692
695
|
}
|
|
693
696
|
const i = n.o;
|
|
@@ -697,61 +700,61 @@ function read(e) {
|
|
|
697
700
|
}
|
|
698
701
|
}
|
|
699
702
|
if (k) {
|
|
700
|
-
if (!e.
|
|
701
|
-
e.
|
|
702
|
-
e.
|
|
703
|
-
e.
|
|
703
|
+
if (!e.Z) {
|
|
704
|
+
e.Z = signal(false);
|
|
705
|
+
e.Z.ue = true;
|
|
706
|
+
e.Z.Y = t => setSignal(e.Z, t);
|
|
704
707
|
}
|
|
705
708
|
const t = k;
|
|
706
709
|
k = null;
|
|
707
|
-
t.
|
|
710
|
+
t.U = read(e.Z) || t.U;
|
|
708
711
|
k = t;
|
|
709
712
|
}
|
|
710
713
|
if (N) {
|
|
711
|
-
if (!e.
|
|
712
|
-
e.
|
|
713
|
-
e.
|
|
714
|
-
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);
|
|
715
718
|
}
|
|
716
719
|
N = false;
|
|
717
720
|
try {
|
|
718
|
-
return read(e.
|
|
721
|
+
return read(e.X);
|
|
719
722
|
} finally {
|
|
720
723
|
N = true;
|
|
721
724
|
}
|
|
722
725
|
}
|
|
723
726
|
if (e.$ & f && !k) {
|
|
724
|
-
if ((t && !v) || e.$ & a) throw e.
|
|
727
|
+
if ((t && !v) || e.$ & a) throw e.T;
|
|
725
728
|
else if (t && v) {
|
|
726
|
-
setStatusFlags(t, t.$ | 1, e.
|
|
729
|
+
setStatusFlags(t, t.$ | 1, e.T);
|
|
727
730
|
}
|
|
728
731
|
}
|
|
729
732
|
if (e.$ & c) {
|
|
730
|
-
if (e.se <
|
|
733
|
+
if (e.se < S) {
|
|
731
734
|
recompute(e, true);
|
|
732
735
|
return read(e);
|
|
733
736
|
} else {
|
|
734
|
-
throw e.
|
|
737
|
+
throw e.T;
|
|
735
738
|
}
|
|
736
739
|
}
|
|
737
|
-
return !t || e.ue || e.
|
|
740
|
+
return !t || e.ue || e.G === p || (v && !k && e.K && m !== e.K) ? e.U : e.G;
|
|
738
741
|
}
|
|
739
742
|
function setSignal(e, t) {
|
|
740
743
|
if (typeof t === "function") {
|
|
741
|
-
t = t(e.
|
|
744
|
+
t = t(e.G === p ? e.U : e.G);
|
|
742
745
|
}
|
|
743
|
-
const n = !e.oe || !e.oe(e.
|
|
746
|
+
const n = !e.oe || !e.oe(e.G === p || e.ue ? e.U : e.G, t);
|
|
744
747
|
if (!n && !e.$) return t;
|
|
745
748
|
if (n) {
|
|
746
|
-
if (e.ue) e.
|
|
749
|
+
if (e.ue) e.U = t;
|
|
747
750
|
else {
|
|
748
|
-
if (e.
|
|
749
|
-
e.
|
|
751
|
+
if (e.G === p) O.M.push(e);
|
|
752
|
+
e.G = t;
|
|
750
753
|
}
|
|
751
|
-
if (e.
|
|
754
|
+
if (e.X) e.X.G = t;
|
|
752
755
|
}
|
|
753
756
|
setStatusFlags(e, l);
|
|
754
|
-
e.se =
|
|
757
|
+
e.se = S;
|
|
755
758
|
notifySubs(e);
|
|
756
759
|
schedule();
|
|
757
760
|
return t;
|
|
@@ -837,10 +840,10 @@ function pending(e) {
|
|
|
837
840
|
}
|
|
838
841
|
function isPending(e) {
|
|
839
842
|
const t = k;
|
|
840
|
-
k = {
|
|
843
|
+
k = { U: false };
|
|
841
844
|
try {
|
|
842
845
|
staleValues(e);
|
|
843
|
-
return k.
|
|
846
|
+
return k.U;
|
|
844
847
|
} catch (e) {
|
|
845
848
|
if (!(e instanceof NotReadyError)) return false;
|
|
846
849
|
throw e;
|
|
@@ -893,23 +896,23 @@ function effect(e, t, n, r, i) {
|
|
|
893
896
|
let s = false;
|
|
894
897
|
const o = computed(e, r, {
|
|
895
898
|
...i,
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
+
be: {
|
|
900
|
+
J: true,
|
|
901
|
+
Se: r,
|
|
899
902
|
me: t,
|
|
900
903
|
xe: n,
|
|
901
904
|
Oe: undefined,
|
|
902
|
-
|
|
905
|
+
L: i?.render ? d : h,
|
|
903
906
|
le(e, t) {
|
|
904
907
|
if (s) {
|
|
905
908
|
const n = this.$ && this.$ === t && e;
|
|
906
|
-
this.
|
|
907
|
-
if (this.
|
|
909
|
+
this.J = !(this.$ & c) && !(this.$ & f & ~t) && !n;
|
|
910
|
+
if (this.J) this.we.enqueue(this.L, runEffect.bind(this));
|
|
908
911
|
}
|
|
909
912
|
if (this.$ & c) {
|
|
910
|
-
let e = this.
|
|
913
|
+
let e = this.T;
|
|
911
914
|
this.we.notify(this, f, 0);
|
|
912
|
-
if (this.
|
|
915
|
+
if (this.L === h) {
|
|
913
916
|
try {
|
|
914
917
|
return this.xe
|
|
915
918
|
? this.xe(e, () => {
|
|
@@ -922,30 +925,30 @@ function effect(e, t, n, r, i) {
|
|
|
922
925
|
}
|
|
923
926
|
}
|
|
924
927
|
if (!this.we.notify(this, c, c)) throw e;
|
|
925
|
-
} else if (this.
|
|
928
|
+
} else if (this.L === d) {
|
|
926
929
|
this.we.notify(this, f | c, this.$);
|
|
927
930
|
}
|
|
928
931
|
}
|
|
929
932
|
}
|
|
930
933
|
});
|
|
931
934
|
s = true;
|
|
932
|
-
if (o.
|
|
935
|
+
if (o.L === d) o.F = t => staleValues(() => e(t));
|
|
933
936
|
!i?.defer &&
|
|
934
937
|
!(o.$ & (c | f)) &&
|
|
935
|
-
(o.
|
|
938
|
+
(o.L === h ? o.we.enqueue(o.L, runEffect.bind(o)) : runEffect.call(o));
|
|
936
939
|
onCleanup(() => o.Oe?.());
|
|
937
940
|
}
|
|
938
941
|
function runEffect() {
|
|
939
|
-
if (!this.
|
|
942
|
+
if (!this.J || this.S & u) return;
|
|
940
943
|
this.Oe?.();
|
|
941
944
|
this.Oe = undefined;
|
|
942
945
|
try {
|
|
943
|
-
this.Oe = this.me(this.
|
|
946
|
+
this.Oe = this.me(this.U, this.Se);
|
|
944
947
|
} catch (e) {
|
|
945
948
|
if (!this.we.notify(this, c, c)) throw e;
|
|
946
949
|
} finally {
|
|
947
|
-
this.
|
|
948
|
-
this.
|
|
950
|
+
this.Se = this.U;
|
|
951
|
+
this.J = false;
|
|
949
952
|
}
|
|
950
953
|
}
|
|
951
954
|
function createSignal(e, t, n) {
|
|
@@ -1017,7 +1020,7 @@ function onSettled(e) {
|
|
|
1017
1020
|
});
|
|
1018
1021
|
}
|
|
1019
1022
|
function unwrap(e) {
|
|
1020
|
-
return e?.[
|
|
1023
|
+
return e?.[W]?.[V] ?? e;
|
|
1021
1024
|
}
|
|
1022
1025
|
function getOverrideValue(e, t, n, r) {
|
|
1023
1026
|
return n && r in n ? read(n[r]) : t && r in t ? t[r] : e[r];
|
|
@@ -1028,13 +1031,13 @@ function getAllKeys(e, t, n) {
|
|
|
1028
1031
|
return Array.from(new Set([...r, ...i]));
|
|
1029
1032
|
}
|
|
1030
1033
|
function applyState(e, t, n, r) {
|
|
1031
|
-
const i = t?.[
|
|
1034
|
+
const i = t?.[W];
|
|
1032
1035
|
if (!i) return;
|
|
1033
1036
|
const s = i[Q];
|
|
1034
1037
|
const o = i[R];
|
|
1035
1038
|
let u = i[V];
|
|
1036
1039
|
if (e === s && !o) return;
|
|
1037
|
-
(i[D] ||
|
|
1040
|
+
(i[D] || T).set(e, i[H]);
|
|
1038
1041
|
i[Q] = e;
|
|
1039
1042
|
i[R] = undefined;
|
|
1040
1043
|
if (Array.isArray(s)) {
|
|
@@ -1152,8 +1155,8 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1152
1155
|
const i = new WeakMap();
|
|
1153
1156
|
const wrapProjection = e => {
|
|
1154
1157
|
if (i.has(e)) return i.get(e);
|
|
1155
|
-
if (e[
|
|
1156
|
-
const t = createStoreProxy(e,
|
|
1158
|
+
if (e[W]?.[M] === wrapProjection) return e;
|
|
1159
|
+
const t = createStoreProxy(e, G, {
|
|
1157
1160
|
[M]: wrapProjection,
|
|
1158
1161
|
[D]: i,
|
|
1159
1162
|
[B]() {
|
|
@@ -1179,8 +1182,8 @@ function createProjection(e, t = {}, n) {
|
|
|
1179
1182
|
return createProjectionInternal(e, t, n).store;
|
|
1180
1183
|
}
|
|
1181
1184
|
const E = Symbol(0),
|
|
1182
|
-
W = Symbol(0),
|
|
1183
1185
|
P = Symbol(0),
|
|
1186
|
+
W = Symbol(0),
|
|
1184
1187
|
H = Symbol(0),
|
|
1185
1188
|
I = Symbol(0);
|
|
1186
1189
|
const F = new WeakMap();
|
|
@@ -1191,7 +1194,7 @@ const Q = "v",
|
|
|
1191
1194
|
M = "w",
|
|
1192
1195
|
D = "l",
|
|
1193
1196
|
B = "f";
|
|
1194
|
-
function createStoreProxy(e, t =
|
|
1197
|
+
function createStoreProxy(e, t = G, n) {
|
|
1195
1198
|
let r;
|
|
1196
1199
|
if (Array.isArray(e)) {
|
|
1197
1200
|
r = [];
|
|
@@ -1200,11 +1203,11 @@ function createStoreProxy(e, t = T, n) {
|
|
|
1200
1203
|
n && Object.assign(r, n);
|
|
1201
1204
|
return (r[H] = new Proxy(r, t));
|
|
1202
1205
|
}
|
|
1203
|
-
const
|
|
1206
|
+
const T = new WeakMap();
|
|
1204
1207
|
function wrap(e, t) {
|
|
1205
1208
|
if (t?.[M]) return t[M](e, t);
|
|
1206
|
-
let n = e[H] ||
|
|
1207
|
-
if (!n)
|
|
1209
|
+
let n = e[H] || T.get(e);
|
|
1210
|
+
if (!n) T.set(e, (n = createStoreProxy(e)));
|
|
1208
1211
|
return n;
|
|
1209
1212
|
}
|
|
1210
1213
|
function isWrappable(e) {
|
|
@@ -1250,30 +1253,30 @@ function getPropertyDescriptor(e, t, n) {
|
|
|
1250
1253
|
}
|
|
1251
1254
|
return Reflect.getOwnPropertyDescriptor(r, n);
|
|
1252
1255
|
}
|
|
1253
|
-
let
|
|
1254
|
-
const
|
|
1256
|
+
let K = null;
|
|
1257
|
+
const G = {
|
|
1255
1258
|
get(e, t, n) {
|
|
1256
|
-
if (t ===
|
|
1259
|
+
if (t === W) return e;
|
|
1257
1260
|
if (t === H) return n;
|
|
1258
|
-
if (t === E || t ===
|
|
1261
|
+
if (t === E || t === P) {
|
|
1259
1262
|
trackSelf(e, t);
|
|
1260
1263
|
return n;
|
|
1261
1264
|
}
|
|
1262
1265
|
const r = getNodes(e, V);
|
|
1263
1266
|
const i = r[t];
|
|
1264
1267
|
const s = e[R] && t in e[R];
|
|
1265
|
-
const o = !!e[Q][
|
|
1268
|
+
const o = !!e[Q][W];
|
|
1266
1269
|
const u = s ? e[R] : e[Q];
|
|
1267
1270
|
if (!i) {
|
|
1268
1271
|
const e = Object.getOwnPropertyDescriptor(u, t);
|
|
1269
1272
|
if (e && e.get) return e.get.call(n);
|
|
1270
1273
|
}
|
|
1271
|
-
if (
|
|
1272
|
-
let n = i && (s || !o) ? (i.
|
|
1274
|
+
if (K?.has(n)) {
|
|
1275
|
+
let n = i && (s || !o) ? (i.G !== p ? i.G : i.U) : u[t];
|
|
1273
1276
|
n === I && (n = undefined);
|
|
1274
1277
|
if (!isWrappable(n)) return n;
|
|
1275
1278
|
const r = wrap(n, e);
|
|
1276
|
-
|
|
1279
|
+
K.add(r);
|
|
1277
1280
|
return r;
|
|
1278
1281
|
}
|
|
1279
1282
|
let l = i ? (s || !o ? read(r[t]) : (read(r[t]), u[t])) : u[t];
|
|
@@ -1298,12 +1301,12 @@ const T = {
|
|
|
1298
1301
|
},
|
|
1299
1302
|
set(e, t, n) {
|
|
1300
1303
|
const r = e[H];
|
|
1301
|
-
if (
|
|
1304
|
+
if (K?.has(e[H])) {
|
|
1302
1305
|
untrack(() => {
|
|
1303
1306
|
const i = e[Q];
|
|
1304
1307
|
const s = i[t];
|
|
1305
1308
|
const o = e[R] && t in e[R] ? e[R][t] : s;
|
|
1306
|
-
const u = n?.[
|
|
1309
|
+
const u = n?.[W]?.[Q] ?? n;
|
|
1307
1310
|
if (o === u) return true;
|
|
1308
1311
|
const l = e[R]?.length || i.length;
|
|
1309
1312
|
if (u !== undefined && u === s) delete e[R][t];
|
|
@@ -1313,7 +1316,7 @@ const T = {
|
|
|
1313
1316
|
const e = F.get(o);
|
|
1314
1317
|
e && (e instanceof Set ? e.delete(r) : F.delete(o));
|
|
1315
1318
|
}
|
|
1316
|
-
if (recursivelyNotify(r,
|
|
1319
|
+
if (recursivelyNotify(r, T) && f) recursivelyAddParent(u, r);
|
|
1317
1320
|
e[q]?.[t] && setSignal(e[q][t], true);
|
|
1318
1321
|
const c = getNodes(e, V);
|
|
1319
1322
|
c[t] && setSignal(c[t], () => (f ? wrap(u, e) : u));
|
|
@@ -1327,7 +1330,7 @@ const T = {
|
|
|
1327
1330
|
return true;
|
|
1328
1331
|
},
|
|
1329
1332
|
deleteProperty(e, t) {
|
|
1330
|
-
if (
|
|
1333
|
+
if (K?.has(e[H]) && e[R]?.[t] !== I) {
|
|
1331
1334
|
untrack(() => {
|
|
1332
1335
|
const n = e[R] && t in e[R] ? e[R][t] : e[Q][t];
|
|
1333
1336
|
if (t in e[Q]) {
|
|
@@ -1360,9 +1363,9 @@ const T = {
|
|
|
1360
1363
|
}
|
|
1361
1364
|
};
|
|
1362
1365
|
function storeSetter(e, t) {
|
|
1363
|
-
const n =
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
+
const n = K;
|
|
1367
|
+
K = new Set();
|
|
1368
|
+
K.add(e);
|
|
1366
1369
|
try {
|
|
1367
1370
|
const n = t(e);
|
|
1368
1371
|
if (n !== e && n !== undefined) {
|
|
@@ -1378,8 +1381,8 @@ function storeSetter(e, t) {
|
|
|
1378
1381
|
}
|
|
1379
1382
|
}
|
|
1380
1383
|
} finally {
|
|
1381
|
-
|
|
1382
|
-
|
|
1384
|
+
K.clear();
|
|
1385
|
+
K = n;
|
|
1383
1386
|
}
|
|
1384
1387
|
}
|
|
1385
1388
|
function createStore(e, t, n) {
|
|
@@ -1388,10 +1391,10 @@ function createStore(e, t, n) {
|
|
|
1388
1391
|
return [i, e => storeSetter(i, e)];
|
|
1389
1392
|
}
|
|
1390
1393
|
function recursivelyNotify(e, t) {
|
|
1391
|
-
let n = e[
|
|
1394
|
+
let n = e[W] || t?.get(e)?.[W];
|
|
1392
1395
|
let r = false;
|
|
1393
1396
|
if (n) {
|
|
1394
|
-
const e = getNodes(n, V)[
|
|
1397
|
+
const e = getNodes(n, V)[P];
|
|
1395
1398
|
if (e) {
|
|
1396
1399
|
setSignal(e, undefined);
|
|
1397
1400
|
r = true;
|
|
@@ -1407,7 +1410,7 @@ function recursivelyNotify(e, t) {
|
|
|
1407
1410
|
}
|
|
1408
1411
|
function recursivelyAddParent(e, t) {
|
|
1409
1412
|
let n;
|
|
1410
|
-
const r = e[
|
|
1413
|
+
const r = e[W];
|
|
1411
1414
|
if (r) {
|
|
1412
1415
|
n = r[R];
|
|
1413
1416
|
e = r[Q];
|
|
@@ -1438,7 +1441,7 @@ function recursivelyAddParent(e, t) {
|
|
|
1438
1441
|
}
|
|
1439
1442
|
function deep(e) {
|
|
1440
1443
|
recursivelyAddParent(e);
|
|
1441
|
-
return e[
|
|
1444
|
+
return e[P];
|
|
1442
1445
|
}
|
|
1443
1446
|
function createOptimisticStore(e, t, n) {
|
|
1444
1447
|
return [];
|
|
@@ -1448,12 +1451,12 @@ function snapshot(e, t, n) {
|
|
|
1448
1451
|
if (!isWrappable(e)) return e;
|
|
1449
1452
|
if (t && t.has(e)) return t.get(e);
|
|
1450
1453
|
if (!t) t = new Map();
|
|
1451
|
-
if ((r = e[
|
|
1454
|
+
if ((r = e[W] || n?.get(e)?.[W])) {
|
|
1452
1455
|
s = r[R];
|
|
1453
1456
|
i = Array.isArray(r[Q]);
|
|
1454
1457
|
t.set(e, s ? (o = i ? [] : Object.create(Object.getPrototypeOf(r[Q]))) : r[Q]);
|
|
1455
1458
|
e = r[Q];
|
|
1456
|
-
n =
|
|
1459
|
+
n = T;
|
|
1457
1460
|
} else {
|
|
1458
1461
|
i = Array.isArray(e);
|
|
1459
1462
|
t.set(e, e);
|
|
@@ -1627,8 +1630,8 @@ function mapArray(e, t, n) {
|
|
|
1627
1630
|
je: t,
|
|
1628
1631
|
Ae: [],
|
|
1629
1632
|
Ee: [],
|
|
1630
|
-
|
|
1631
|
-
|
|
1633
|
+
Pe: r,
|
|
1634
|
+
We: r || n?.keyed === false ? [] : undefined,
|
|
1632
1635
|
He: t.length > 1 ? [] : undefined,
|
|
1633
1636
|
Ie: n?.fallback
|
|
1634
1637
|
})
|
|
@@ -1642,12 +1645,12 @@ function updateKeyedMap() {
|
|
|
1642
1645
|
runWithOwner(this.Ce, () => {
|
|
1643
1646
|
let n,
|
|
1644
1647
|
r,
|
|
1645
|
-
i = this.
|
|
1648
|
+
i = this.We
|
|
1646
1649
|
? () => {
|
|
1647
|
-
this.
|
|
1650
|
+
this.We[r] = signal(e[r], z);
|
|
1648
1651
|
this.He && (this.He[r] = signal(r, z));
|
|
1649
1652
|
return this.je(
|
|
1650
|
-
read.bind(null, this.
|
|
1653
|
+
read.bind(null, this.We[r]),
|
|
1651
1654
|
this.He ? read.bind(null, this.He[r]) : undefined
|
|
1652
1655
|
);
|
|
1653
1656
|
}
|
|
@@ -1668,7 +1671,7 @@ function updateKeyedMap() {
|
|
|
1668
1671
|
this.ke = [];
|
|
1669
1672
|
this.Ae = [];
|
|
1670
1673
|
this.ve = 0;
|
|
1671
|
-
this.
|
|
1674
|
+
this.We && (this.We = []);
|
|
1672
1675
|
this.He && (this.He = []);
|
|
1673
1676
|
}
|
|
1674
1677
|
if (this.Ie && !this.Ae[0]) {
|
|
@@ -1692,44 +1695,44 @@ function updateKeyedMap() {
|
|
|
1692
1695
|
a,
|
|
1693
1696
|
d = new Array(t),
|
|
1694
1697
|
h = new Array(t),
|
|
1695
|
-
p = this.
|
|
1698
|
+
p = this.We ? new Array(t) : undefined,
|
|
1696
1699
|
y = this.He ? new Array(t) : undefined;
|
|
1697
1700
|
for (
|
|
1698
1701
|
s = 0, o = Math.min(this.ve, t);
|
|
1699
|
-
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])));
|
|
1700
1703
|
s++
|
|
1701
1704
|
) {
|
|
1702
|
-
if (this.
|
|
1705
|
+
if (this.We) setSignal(this.We[s], e[s]);
|
|
1703
1706
|
}
|
|
1704
1707
|
for (
|
|
1705
1708
|
o = this.ve - 1, u = t - 1;
|
|
1706
1709
|
o >= s &&
|
|
1707
1710
|
u >= s &&
|
|
1708
|
-
(this.ke[o] === e[u] || (this.
|
|
1711
|
+
(this.ke[o] === e[u] || (this.We && compare(this.Pe, this.ke[o], e[u])));
|
|
1709
1712
|
o--, u--
|
|
1710
1713
|
) {
|
|
1711
1714
|
d[u] = this.Ae[o];
|
|
1712
1715
|
h[u] = this.Ee[o];
|
|
1713
|
-
p && (p[u] = this.
|
|
1716
|
+
p && (p[u] = this.We[o]);
|
|
1714
1717
|
y && (y[u] = this.He[o]);
|
|
1715
1718
|
}
|
|
1716
1719
|
c = new Map();
|
|
1717
1720
|
a = new Array(u + 1);
|
|
1718
1721
|
for (r = u; r >= s; r--) {
|
|
1719
1722
|
l = e[r];
|
|
1720
|
-
f = this.
|
|
1723
|
+
f = this.Pe ? this.Pe(l) : l;
|
|
1721
1724
|
n = c.get(f);
|
|
1722
1725
|
a[r] = n === undefined ? -1 : n;
|
|
1723
1726
|
c.set(f, r);
|
|
1724
1727
|
}
|
|
1725
1728
|
for (n = s; n <= o; n++) {
|
|
1726
1729
|
l = this.ke[n];
|
|
1727
|
-
f = this.
|
|
1730
|
+
f = this.Pe ? this.Pe(l) : l;
|
|
1728
1731
|
r = c.get(f);
|
|
1729
1732
|
if (r !== undefined && r !== -1) {
|
|
1730
1733
|
d[r] = this.Ae[n];
|
|
1731
1734
|
h[r] = this.Ee[n];
|
|
1732
|
-
p && (p[r] = this.
|
|
1735
|
+
p && (p[r] = this.We[n]);
|
|
1733
1736
|
y && (y[r] = this.He[n]);
|
|
1734
1737
|
r = a[r];
|
|
1735
1738
|
c.set(f, r);
|
|
@@ -1740,8 +1743,8 @@ function updateKeyedMap() {
|
|
|
1740
1743
|
this.Ae[r] = d[r];
|
|
1741
1744
|
this.Ee[r] = h[r];
|
|
1742
1745
|
if (p) {
|
|
1743
|
-
this.
|
|
1744
|
-
setSignal(this.
|
|
1746
|
+
this.We[r] = p[r];
|
|
1747
|
+
setSignal(this.We[r], e[r]);
|
|
1745
1748
|
}
|
|
1746
1749
|
if (y) {
|
|
1747
1750
|
this.He[r] = y[r];
|
|
@@ -1822,7 +1825,7 @@ function compare(e, t, n) {
|
|
|
1822
1825
|
}
|
|
1823
1826
|
function boundaryComputed(e, t) {
|
|
1824
1827
|
const n = computed(e, undefined, {
|
|
1825
|
-
|
|
1828
|
+
be: {
|
|
1826
1829
|
le() {
|
|
1827
1830
|
let e = this.$;
|
|
1828
1831
|
this.$ &= ~this.Ve;
|
|
@@ -1943,21 +1946,21 @@ function createLoadBoundary(e, t) {
|
|
|
1943
1946
|
}
|
|
1944
1947
|
function collectErrorSources(e, t) {
|
|
1945
1948
|
let n = true;
|
|
1946
|
-
let r = e.
|
|
1949
|
+
let r = e.P;
|
|
1947
1950
|
while (r !== null) {
|
|
1948
1951
|
const e = r.H;
|
|
1949
|
-
if (e.
|
|
1952
|
+
if (e.P && e.$ & c) {
|
|
1950
1953
|
n = false;
|
|
1951
1954
|
collectErrorSources(e, t);
|
|
1952
1955
|
}
|
|
1953
|
-
r = r.
|
|
1956
|
+
r = r.W;
|
|
1954
1957
|
}
|
|
1955
1958
|
n && t.push(e);
|
|
1956
1959
|
}
|
|
1957
1960
|
function createErrorBoundary(e, t) {
|
|
1958
1961
|
return createCollectionBoundary(c, e, e => {
|
|
1959
1962
|
let n = e.Ee.values().next().value;
|
|
1960
|
-
return t(n.
|
|
1963
|
+
return t(n.T, () => {
|
|
1961
1964
|
const t = [];
|
|
1962
1965
|
for (const n of e.Ee) collectErrorSources(n, t);
|
|
1963
1966
|
for (const e of t) recompute(e);
|
|
@@ -2015,7 +2018,7 @@ function flattenArray(e, t = [], n) {
|
|
|
2015
2018
|
return i;
|
|
2016
2019
|
}
|
|
2017
2020
|
exports.$PROXY = H;
|
|
2018
|
-
exports.$TARGET =
|
|
2021
|
+
exports.$TARGET = W;
|
|
2019
2022
|
exports.$TRACK = E;
|
|
2020
2023
|
exports.ContextNotFoundError = ContextNotFoundError;
|
|
2021
2024
|
exports.NoOwnerError = NoOwnerError;
|