@solidjs/signals 0.9.2 → 0.9.4
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 +142 -59
- package/dist/node.cjs +511 -430
- package/dist/prod.js +185 -102
- package/dist/types/core/constants.d.ts +1 -0
- package/dist/types/core/core.d.ts +4 -2
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/scheduler.d.ts +5 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/store/projection.d.ts +8 -3
- package/dist/types/store/store.d.ts +10 -6
- package/package.json +3 -3
package/dist/node.cjs
CHANGED
|
@@ -33,6 +33,7 @@ const h = 2;
|
|
|
33
33
|
const p = {};
|
|
34
34
|
const y = typeof Proxy === "function";
|
|
35
35
|
const g = {};
|
|
36
|
+
const w = Symbol("refresh");
|
|
36
37
|
function actualInsertIntoHeap(e, t) {
|
|
37
38
|
const n = (e.i?.t ? e.i.u?.o : e.i?.o) ?? -1;
|
|
38
39
|
if (n >= e.o) e.o = n + 1;
|
|
@@ -104,12 +105,12 @@ function markNode(e, r = n) {
|
|
|
104
105
|
}
|
|
105
106
|
function runHeap(e, t) {
|
|
106
107
|
e.m = false;
|
|
107
|
-
for (e.
|
|
108
|
-
let n = e.l[e.
|
|
108
|
+
for (e.P = 0; e.P <= e._; e.P++) {
|
|
109
|
+
let n = e.l[e.P];
|
|
109
110
|
while (n !== undefined) {
|
|
110
111
|
if (n.S & i) t(n);
|
|
111
112
|
else adjustHeight(n, e);
|
|
112
|
-
n = e.l[e.
|
|
113
|
+
n = e.l[e.P];
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
116
|
e._ = 0;
|
|
@@ -117,7 +118,7 @@ function runHeap(e, t) {
|
|
|
117
118
|
function adjustHeight(e, t) {
|
|
118
119
|
deleteFromHeap(e, t);
|
|
119
120
|
let n = e.o;
|
|
120
|
-
for (let t = e.
|
|
121
|
+
for (let t = e.W; t; t = t.A) {
|
|
121
122
|
const e = t.I;
|
|
122
123
|
const r = e.F || e;
|
|
123
124
|
if (r.H && r.o >= n) n = r.o + 1;
|
|
@@ -129,23 +130,23 @@ function adjustHeight(e, t) {
|
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
|
-
const
|
|
133
|
-
let
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
let
|
|
137
|
-
let
|
|
138
|
-
let
|
|
133
|
+
const _ = new Set();
|
|
134
|
+
let S = false;
|
|
135
|
+
const b = { l: new Array(2e3).fill(undefined), m: false, P: 0, _: 0 };
|
|
136
|
+
const m = { l: new Array(2e3).fill(undefined), m: false, P: 0, _: 0 };
|
|
137
|
+
let O = 0;
|
|
138
|
+
let x = null;
|
|
139
|
+
let v = false;
|
|
139
140
|
function schedule() {
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
-
if (!C.R) queueMicrotask(flush);
|
|
141
|
+
if (v) return;
|
|
142
|
+
v = true;
|
|
143
|
+
if (!C.R) Promise.resolve().then(() => queueMicrotask(flush));
|
|
143
144
|
}
|
|
144
145
|
class Queue {
|
|
145
146
|
i = null;
|
|
146
147
|
V = [[], []];
|
|
147
148
|
q = [];
|
|
148
|
-
created =
|
|
149
|
+
created = O;
|
|
149
150
|
addChild(e) {
|
|
150
151
|
this.q.push(e);
|
|
151
152
|
e.i = this;
|
|
@@ -202,36 +203,37 @@ class Queue {
|
|
|
202
203
|
class GlobalQueue extends Queue {
|
|
203
204
|
R = false;
|
|
204
205
|
M = [];
|
|
205
|
-
|
|
206
|
+
T = [];
|
|
207
|
+
static D;
|
|
206
208
|
static B;
|
|
207
|
-
static T;
|
|
208
209
|
flush() {
|
|
209
210
|
if (this.R) return;
|
|
210
211
|
this.R = true;
|
|
211
212
|
try {
|
|
212
|
-
runHeap(
|
|
213
|
-
if (
|
|
214
|
-
if (!transitionComplete(
|
|
215
|
-
let e =
|
|
216
|
-
runHeap(
|
|
213
|
+
runHeap(b, GlobalQueue.D);
|
|
214
|
+
if (x) {
|
|
215
|
+
if (!transitionComplete(x)) {
|
|
216
|
+
let e = x;
|
|
217
|
+
runHeap(m, GlobalQueue.D);
|
|
217
218
|
this.M = [];
|
|
218
|
-
this.stashQueues(
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
runTransitionPending(
|
|
222
|
-
|
|
219
|
+
this.stashQueues(x.queueStash);
|
|
220
|
+
O++;
|
|
221
|
+
v = false;
|
|
222
|
+
runTransitionPending(x.pendingNodes, true);
|
|
223
|
+
x = null;
|
|
223
224
|
runOptimistic(e);
|
|
224
225
|
return;
|
|
225
226
|
}
|
|
226
|
-
this.M.push(...
|
|
227
|
-
this.
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
this.M.push(...x.pendingNodes);
|
|
228
|
+
this.T !== x.optimisticNodes && this.T.push(...x.optimisticNodes);
|
|
229
|
+
this.restoreQueues(x.queueStash);
|
|
230
|
+
_.delete(x);
|
|
231
|
+
x = null;
|
|
230
232
|
runTransitionPending(this.M, false);
|
|
231
|
-
} else if (
|
|
233
|
+
} else if (_.size) runHeap(m, GlobalQueue.D);
|
|
232
234
|
runOptimistic();
|
|
233
|
-
|
|
234
|
-
|
|
235
|
+
O++;
|
|
236
|
+
v = false;
|
|
235
237
|
this.run(d);
|
|
236
238
|
this.run(h);
|
|
237
239
|
} finally {
|
|
@@ -241,8 +243,8 @@ class GlobalQueue extends Queue {
|
|
|
241
243
|
notify(e, t, n) {
|
|
242
244
|
if (t & f) {
|
|
243
245
|
if (n & f) {
|
|
244
|
-
if (
|
|
245
|
-
|
|
246
|
+
if (x && !x.asyncNodes.includes(e.K.cause)) {
|
|
247
|
+
x.asyncNodes.push(e.K.cause);
|
|
246
248
|
schedule();
|
|
247
249
|
}
|
|
248
250
|
}
|
|
@@ -251,44 +253,45 @@ class GlobalQueue extends Queue {
|
|
|
251
253
|
return false;
|
|
252
254
|
}
|
|
253
255
|
initTransition(e) {
|
|
254
|
-
if (
|
|
255
|
-
if (!
|
|
256
|
-
|
|
257
|
-
time:
|
|
256
|
+
if (x && x.time === O) return;
|
|
257
|
+
if (!x) {
|
|
258
|
+
x = e?.G ?? {
|
|
259
|
+
time: O,
|
|
258
260
|
pendingNodes: [],
|
|
259
261
|
asyncNodes: [],
|
|
260
262
|
optimisticNodes: [],
|
|
263
|
+
actions: [],
|
|
261
264
|
queueStash: { V: [[], []], q: [] },
|
|
262
265
|
done: false
|
|
263
266
|
};
|
|
264
267
|
}
|
|
265
|
-
|
|
266
|
-
|
|
268
|
+
_.add(x);
|
|
269
|
+
x.time = O;
|
|
267
270
|
for (let e = 0; e < this.M.length; e++) {
|
|
268
271
|
const t = this.M[e];
|
|
269
|
-
t.G =
|
|
270
|
-
|
|
272
|
+
t.G = x;
|
|
273
|
+
x.pendingNodes.push(t);
|
|
271
274
|
}
|
|
272
|
-
for (let e = 0; e < this.
|
|
273
|
-
const t = this.
|
|
274
|
-
t.G =
|
|
275
|
-
|
|
275
|
+
for (let e = 0; e < this.T.length; e++) {
|
|
276
|
+
const t = this.T[e];
|
|
277
|
+
t.G = x;
|
|
278
|
+
x.optimisticNodes.push(t);
|
|
276
279
|
}
|
|
277
|
-
this.M =
|
|
278
|
-
this.
|
|
280
|
+
this.M = x.pendingNodes;
|
|
281
|
+
this.T = x.optimisticNodes;
|
|
279
282
|
}
|
|
280
283
|
}
|
|
281
284
|
function notifySubs(e) {
|
|
282
285
|
for (let t = e.O; t !== null; t = t.C) {
|
|
283
|
-
const e = t.N.S & o ?
|
|
284
|
-
if (e.
|
|
286
|
+
const e = t.N.S & o ? m : b;
|
|
287
|
+
if (e.P > t.N.o) e.P = t.N.o;
|
|
285
288
|
insertIntoHeap(t.N, e);
|
|
286
289
|
}
|
|
287
290
|
}
|
|
288
291
|
function runOptimistic(e = null) {
|
|
289
292
|
let t = !e;
|
|
290
|
-
const n = C.
|
|
291
|
-
|
|
293
|
+
const n = C.T;
|
|
294
|
+
S = true;
|
|
292
295
|
for (let t = 0; t < n.length; t++) {
|
|
293
296
|
const r = n[t];
|
|
294
297
|
if (!e && (!r.G || r.G.done) && r.U !== p) {
|
|
@@ -298,12 +301,12 @@ function runOptimistic(e = null) {
|
|
|
298
301
|
r.G = e;
|
|
299
302
|
notifySubs(r);
|
|
300
303
|
}
|
|
301
|
-
C.
|
|
302
|
-
if (
|
|
304
|
+
C.T = [];
|
|
305
|
+
if (b._ >= b.P) {
|
|
303
306
|
t = true;
|
|
304
|
-
runHeap(
|
|
307
|
+
runHeap(b, GlobalQueue.D);
|
|
305
308
|
}
|
|
306
|
-
|
|
309
|
+
S = false;
|
|
307
310
|
t && runPending(C.M);
|
|
308
311
|
}
|
|
309
312
|
function runPending(e) {
|
|
@@ -314,7 +317,7 @@ function runPending(e) {
|
|
|
314
317
|
n.U = p;
|
|
315
318
|
if (n.J) n.X = true;
|
|
316
319
|
}
|
|
317
|
-
if (n.H) GlobalQueue.
|
|
320
|
+
if (n.H) GlobalQueue.B(n, false, true);
|
|
318
321
|
}
|
|
319
322
|
e.length = 0;
|
|
320
323
|
}
|
|
@@ -322,13 +325,13 @@ function runTransitionPending(e, t) {
|
|
|
322
325
|
const n = e.slice();
|
|
323
326
|
for (let e = 0; e < n.length; e++) {
|
|
324
327
|
const r = n[e];
|
|
325
|
-
r.G =
|
|
328
|
+
r.G = x;
|
|
326
329
|
if (r.Y) r.Y.Z(t);
|
|
327
330
|
}
|
|
328
331
|
}
|
|
329
332
|
const C = new GlobalQueue();
|
|
330
333
|
function flush() {
|
|
331
|
-
while (
|
|
334
|
+
while (v) {
|
|
332
335
|
C.flush();
|
|
333
336
|
}
|
|
334
337
|
}
|
|
@@ -337,6 +340,7 @@ function runQueue(e, t) {
|
|
|
337
340
|
}
|
|
338
341
|
function transitionComplete(e) {
|
|
339
342
|
if (e.done) return true;
|
|
343
|
+
if (e.actions.length) return false;
|
|
340
344
|
let t = true;
|
|
341
345
|
for (let n = 0; n < e.asyncNodes.length; n++) {
|
|
342
346
|
if (e.asyncNodes[n].$ & f) {
|
|
@@ -348,24 +352,53 @@ function transitionComplete(e) {
|
|
|
348
352
|
return t;
|
|
349
353
|
}
|
|
350
354
|
function runInTransition(e, t) {
|
|
351
|
-
const n =
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
+
const n = x;
|
|
356
|
+
try {
|
|
357
|
+
x = e;
|
|
358
|
+
return t();
|
|
359
|
+
} finally {
|
|
360
|
+
x = n;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
function action(e) {
|
|
364
|
+
return (...t) => {
|
|
365
|
+
const n = e(...t);
|
|
366
|
+
C.initTransition();
|
|
367
|
+
let r = x;
|
|
368
|
+
r.actions.push(n);
|
|
369
|
+
const step = e => {
|
|
370
|
+
let t = n.next(e);
|
|
371
|
+
if (t instanceof Promise) return t.then(process);
|
|
372
|
+
process(t);
|
|
373
|
+
};
|
|
374
|
+
const process = e => {
|
|
375
|
+
if (e.done) {
|
|
376
|
+
r.actions.splice(r.actions.indexOf(n), 1);
|
|
377
|
+
x = r;
|
|
378
|
+
schedule();
|
|
379
|
+
flush();
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
const t = e.value;
|
|
383
|
+
if (t instanceof Promise) return t.then(step);
|
|
384
|
+
runInTransition(r, () => step(t));
|
|
385
|
+
};
|
|
386
|
+
runInTransition(r, () => step());
|
|
387
|
+
};
|
|
355
388
|
}
|
|
356
|
-
GlobalQueue.
|
|
357
|
-
GlobalQueue.
|
|
389
|
+
GlobalQueue.D = recompute;
|
|
390
|
+
GlobalQueue.B = disposeChildren;
|
|
358
391
|
let N = false;
|
|
359
|
-
let v = false;
|
|
360
392
|
let k = false;
|
|
361
|
-
let j =
|
|
362
|
-
let
|
|
363
|
-
let
|
|
393
|
+
let j = false;
|
|
394
|
+
let P = null;
|
|
395
|
+
let W = false;
|
|
396
|
+
let A = null;
|
|
364
397
|
function recompute(t, n = false) {
|
|
365
|
-
const i = t.J && t.G !=
|
|
398
|
+
const i = t.J && t.G != x;
|
|
366
399
|
if (!n) {
|
|
367
|
-
if (t.G &&
|
|
368
|
-
deleteFromHeap(t, t.S & o ?
|
|
400
|
+
if (t.G && x !== t.G && !i) C.initTransition(t);
|
|
401
|
+
deleteFromHeap(t, t.S & o ? m : b);
|
|
369
402
|
if (t.G) disposeChildren(t);
|
|
370
403
|
else {
|
|
371
404
|
markDisposal(t);
|
|
@@ -375,11 +408,11 @@ function recompute(t, n = false) {
|
|
|
375
408
|
t.re = null;
|
|
376
409
|
}
|
|
377
410
|
}
|
|
378
|
-
const s =
|
|
379
|
-
|
|
411
|
+
const s = A;
|
|
412
|
+
A = t;
|
|
380
413
|
t.ie = null;
|
|
381
414
|
t.S = r;
|
|
382
|
-
t.se =
|
|
415
|
+
t.se = O;
|
|
383
416
|
let u = t.U === p || (t.oe && t.G) ? t.L : t.U;
|
|
384
417
|
let d = t.o;
|
|
385
418
|
let h = t.$;
|
|
@@ -399,36 +432,36 @@ function recompute(t, n = false) {
|
|
|
399
432
|
N = g;
|
|
400
433
|
}
|
|
401
434
|
t.S = e;
|
|
402
|
-
|
|
435
|
+
A = s;
|
|
403
436
|
if (!(t.$ & f)) {
|
|
404
437
|
const e = t.ie;
|
|
405
|
-
let n = e !== null ? e.
|
|
438
|
+
let n = e !== null ? e.A : t.W;
|
|
406
439
|
if (n !== null) {
|
|
407
440
|
do {
|
|
408
441
|
n = unlinkSubs(n);
|
|
409
442
|
} while (n !== null);
|
|
410
|
-
if (e !== null) e.
|
|
411
|
-
else t.
|
|
443
|
+
if (e !== null) e.A = null;
|
|
444
|
+
else t.W = null;
|
|
412
445
|
}
|
|
413
446
|
}
|
|
414
|
-
const w = !t.ue || !t.ue(t.U === p || t.oe || i ? t.L : t.U, u);
|
|
415
|
-
const
|
|
416
|
-
t.le?.(
|
|
417
|
-
if (w ||
|
|
447
|
+
const w = !t.ue || !t.ue(t.U === p || (t.oe && t.G) || i ? t.L : t.U, u);
|
|
448
|
+
const _ = t.$ !== h || t.K !== y;
|
|
449
|
+
t.le?.(_, h);
|
|
450
|
+
if (w || _) {
|
|
418
451
|
if (w) {
|
|
419
452
|
if (n || t.oe || i) t.L = u;
|
|
420
453
|
else t.U = u;
|
|
421
454
|
if (t.fe) setSignal(t.fe, u);
|
|
422
455
|
}
|
|
423
|
-
(!t.oe ||
|
|
456
|
+
(!t.oe || S) && notifySubs(t);
|
|
424
457
|
} else if (t.o != d) {
|
|
425
458
|
for (let e = t.O; e !== null; e = e.C) {
|
|
426
|
-
insertIntoHeapHeight(e.N, e.N.S & o ?
|
|
459
|
+
insertIntoHeapHeight(e.N, e.N.S & o ? m : b);
|
|
427
460
|
}
|
|
428
461
|
}
|
|
429
|
-
t.oe && !
|
|
462
|
+
t.oe && !S && C.T.push(t);
|
|
430
463
|
(!n || t.$ & f) && !t.G && C.M.push(t);
|
|
431
|
-
t.G && i && runInTransition(t, recompute);
|
|
464
|
+
t.G && i && runInTransition(t.G, () => recompute(t));
|
|
432
465
|
}
|
|
433
466
|
function handleAsync(e, t, n) {
|
|
434
467
|
const r = typeof t === "object" && t !== null;
|
|
@@ -449,7 +482,7 @@ function handleAsync(e, t, n) {
|
|
|
449
482
|
if (e.ce !== t) return;
|
|
450
483
|
C.initTransition(e);
|
|
451
484
|
setStatusFlags(e, c, n);
|
|
452
|
-
e.se =
|
|
485
|
+
e.se = O;
|
|
453
486
|
notifySubs(e);
|
|
454
487
|
schedule();
|
|
455
488
|
flush();
|
|
@@ -467,7 +500,7 @@ function handleAsync(e, t, n) {
|
|
|
467
500
|
if (e.ce !== t) return;
|
|
468
501
|
C.initTransition(e);
|
|
469
502
|
setStatusFlags(e, c, n);
|
|
470
|
-
e.se =
|
|
503
|
+
e.se = O;
|
|
471
504
|
notifySubs(e);
|
|
472
505
|
schedule();
|
|
473
506
|
flush();
|
|
@@ -475,11 +508,11 @@ function handleAsync(e, t, n) {
|
|
|
475
508
|
})();
|
|
476
509
|
}
|
|
477
510
|
C.initTransition(e);
|
|
478
|
-
throw new NotReadyError(
|
|
511
|
+
throw new NotReadyError(A);
|
|
479
512
|
}
|
|
480
513
|
function updateIfNecessary(r) {
|
|
481
514
|
if (r.S & t) {
|
|
482
|
-
for (let e = r.
|
|
515
|
+
for (let e = r.W; e; e = e.A) {
|
|
483
516
|
const t = e.I;
|
|
484
517
|
const i = t.F || t;
|
|
485
518
|
if (i.H) {
|
|
@@ -497,7 +530,7 @@ function updateIfNecessary(r) {
|
|
|
497
530
|
}
|
|
498
531
|
function unlinkSubs(e) {
|
|
499
532
|
const t = e.I;
|
|
500
|
-
const n = e.
|
|
533
|
+
const n = e.A;
|
|
501
534
|
const r = e.C;
|
|
502
535
|
const i = e.ae;
|
|
503
536
|
if (r !== null) r.ae = i;
|
|
@@ -513,12 +546,12 @@ function unlinkSubs(e) {
|
|
|
513
546
|
return n;
|
|
514
547
|
}
|
|
515
548
|
function unobserved(e) {
|
|
516
|
-
deleteFromHeap(e, e.S & o ?
|
|
517
|
-
let t = e.
|
|
549
|
+
deleteFromHeap(e, e.S & o ? m : b);
|
|
550
|
+
let t = e.W;
|
|
518
551
|
while (t !== null) {
|
|
519
552
|
t = unlinkSubs(t);
|
|
520
553
|
}
|
|
521
|
-
e.
|
|
554
|
+
e.W = null;
|
|
522
555
|
disposeChildren(e, true);
|
|
523
556
|
}
|
|
524
557
|
function link(e, t) {
|
|
@@ -527,7 +560,7 @@ function link(e, t) {
|
|
|
527
560
|
let i = null;
|
|
528
561
|
const s = t.S & r;
|
|
529
562
|
if (s) {
|
|
530
|
-
i = n !== null ? n.
|
|
563
|
+
i = n !== null ? n.A : t.W;
|
|
531
564
|
if (i !== null && i.I === e) {
|
|
532
565
|
t.ie = i;
|
|
533
566
|
return;
|
|
@@ -535,20 +568,20 @@ function link(e, t) {
|
|
|
535
568
|
}
|
|
536
569
|
const o = e.de;
|
|
537
570
|
if (o !== null && o.N === t && (!s || isValidLink(o, t))) return;
|
|
538
|
-
const u = (t.ie = e.de = { I: e, N: t,
|
|
539
|
-
if (n !== null) n.
|
|
540
|
-
else t.
|
|
571
|
+
const u = (t.ie = e.de = { I: e, N: t, A: i, ae: o, C: null });
|
|
572
|
+
if (n !== null) n.A = u;
|
|
573
|
+
else t.W = u;
|
|
541
574
|
if (o !== null) o.C = u;
|
|
542
575
|
else e.O = u;
|
|
543
576
|
}
|
|
544
577
|
function isValidLink(e, t) {
|
|
545
578
|
const n = t.ie;
|
|
546
579
|
if (n !== null) {
|
|
547
|
-
let r = t.
|
|
580
|
+
let r = t.W;
|
|
548
581
|
do {
|
|
549
582
|
if (r === e) return true;
|
|
550
583
|
if (r === n) break;
|
|
551
|
-
r = r.
|
|
584
|
+
r = r.A;
|
|
552
585
|
} while (r !== null);
|
|
553
586
|
}
|
|
554
587
|
return false;
|
|
@@ -562,19 +595,19 @@ function markDisposal(e) {
|
|
|
562
595
|
while (t) {
|
|
563
596
|
t.S |= o;
|
|
564
597
|
if (t.S & i) {
|
|
565
|
-
deleteFromHeap(t,
|
|
566
|
-
insertIntoHeap(t,
|
|
598
|
+
deleteFromHeap(t, b);
|
|
599
|
+
insertIntoHeap(t, m);
|
|
567
600
|
}
|
|
568
601
|
markDisposal(t);
|
|
569
602
|
t = t.ye;
|
|
570
603
|
}
|
|
571
604
|
}
|
|
572
605
|
function dispose(e) {
|
|
573
|
-
let t = e.
|
|
606
|
+
let t = e.W || null;
|
|
574
607
|
do {
|
|
575
608
|
t = unlinkSubs(t);
|
|
576
609
|
} while (t !== null);
|
|
577
|
-
e.
|
|
610
|
+
e.W = null;
|
|
578
611
|
e.ie = null;
|
|
579
612
|
disposeChildren(e, true);
|
|
580
613
|
}
|
|
@@ -584,14 +617,14 @@ function disposeChildren(e, t = false, n) {
|
|
|
584
617
|
let r = n ? e.ne : e.re;
|
|
585
618
|
while (r) {
|
|
586
619
|
const e = r.ye;
|
|
587
|
-
if (r.
|
|
620
|
+
if (r.W) {
|
|
588
621
|
const e = r;
|
|
589
|
-
deleteFromHeap(e, e.S & o ?
|
|
590
|
-
let t = e.
|
|
622
|
+
deleteFromHeap(e, e.S & o ? m : b);
|
|
623
|
+
let t = e.W;
|
|
591
624
|
do {
|
|
592
625
|
t = unlinkSubs(t);
|
|
593
626
|
} while (t !== null);
|
|
594
|
-
e.
|
|
627
|
+
e.W = null;
|
|
595
628
|
e.ie = null;
|
|
596
629
|
}
|
|
597
630
|
disposeChildren(r, true);
|
|
@@ -629,13 +662,13 @@ function formatId(e, t) {
|
|
|
629
662
|
}
|
|
630
663
|
function computed(t, n, r) {
|
|
631
664
|
const i = {
|
|
632
|
-
id: r?.id ?? (
|
|
665
|
+
id: r?.id ?? (A?.id != null ? getNextChildId(A) : undefined),
|
|
633
666
|
ue: r?.equals != null ? r.equals : isEqual,
|
|
634
667
|
we: !!r?.pureWrite,
|
|
635
668
|
he: r?.unobserved,
|
|
636
669
|
te: null,
|
|
637
|
-
_e:
|
|
638
|
-
Se:
|
|
670
|
+
_e: A?._e ?? C,
|
|
671
|
+
Se: A?.Se ?? g,
|
|
639
672
|
ge: 0,
|
|
640
673
|
H: t,
|
|
641
674
|
L: n,
|
|
@@ -643,16 +676,16 @@ function computed(t, n, r) {
|
|
|
643
676
|
k: null,
|
|
644
677
|
p: undefined,
|
|
645
678
|
h: null,
|
|
646
|
-
|
|
679
|
+
W: null,
|
|
647
680
|
ie: null,
|
|
648
681
|
O: null,
|
|
649
682
|
de: null,
|
|
650
|
-
i:
|
|
683
|
+
i: A,
|
|
651
684
|
ye: null,
|
|
652
685
|
re: null,
|
|
653
686
|
S: e,
|
|
654
687
|
$: a,
|
|
655
|
-
se:
|
|
688
|
+
se: O,
|
|
656
689
|
U: p,
|
|
657
690
|
ee: null,
|
|
658
691
|
ne: null,
|
|
@@ -661,14 +694,14 @@ function computed(t, n, r) {
|
|
|
661
694
|
};
|
|
662
695
|
if (r?.be) Object.assign(i, r.be);
|
|
663
696
|
i.h = i;
|
|
664
|
-
const s =
|
|
665
|
-
if (
|
|
666
|
-
const e =
|
|
697
|
+
const s = A?.t ? A.u : A;
|
|
698
|
+
if (A) {
|
|
699
|
+
const e = A.re;
|
|
667
700
|
if (e === null) {
|
|
668
|
-
|
|
701
|
+
A.re = i;
|
|
669
702
|
} else {
|
|
670
703
|
i.ye = e;
|
|
671
|
-
|
|
704
|
+
A.re = i;
|
|
672
705
|
}
|
|
673
706
|
}
|
|
674
707
|
if (s) i.o = s.o + 1;
|
|
@@ -677,7 +710,7 @@ function computed(t, n, r) {
|
|
|
677
710
|
}
|
|
678
711
|
function signal(e, t, n = null) {
|
|
679
712
|
const r = {
|
|
680
|
-
id: t?.id ?? (
|
|
713
|
+
id: t?.id ?? (A?.id != null ? getNextChildId(A) : undefined),
|
|
681
714
|
ue: t?.equals != null ? t.equals : isEqual,
|
|
682
715
|
we: !!t?.pureWrite,
|
|
683
716
|
he: t?.unobserved,
|
|
@@ -685,7 +718,7 @@ function signal(e, t, n = null) {
|
|
|
685
718
|
O: null,
|
|
686
719
|
de: null,
|
|
687
720
|
$: l,
|
|
688
|
-
se:
|
|
721
|
+
se: O,
|
|
689
722
|
F: n,
|
|
690
723
|
j: n?.k || null,
|
|
691
724
|
U: p
|
|
@@ -706,18 +739,18 @@ function untrack(e) {
|
|
|
706
739
|
}
|
|
707
740
|
}
|
|
708
741
|
function read(e) {
|
|
709
|
-
let t =
|
|
742
|
+
let t = A;
|
|
710
743
|
if (t?.t) t = t.u;
|
|
711
|
-
if (
|
|
712
|
-
if (t && N && !
|
|
744
|
+
if (W && e.H) recompute(e);
|
|
745
|
+
if (t && N && !P && !j) {
|
|
713
746
|
if (e.H && e.S & u) recompute(e);
|
|
714
747
|
link(e, t);
|
|
715
748
|
const n = e.F || e;
|
|
716
749
|
if (n.H) {
|
|
717
750
|
const r = e.S & o;
|
|
718
|
-
if (n.o >= (r ?
|
|
751
|
+
if (n.o >= (r ? m.P : b.P)) {
|
|
719
752
|
markNode(t);
|
|
720
|
-
markHeap(r ?
|
|
753
|
+
markHeap(r ? m : b);
|
|
721
754
|
updateIfNecessary(n);
|
|
722
755
|
}
|
|
723
756
|
const i = n.o;
|
|
@@ -727,49 +760,50 @@ function read(e) {
|
|
|
727
760
|
}
|
|
728
761
|
}
|
|
729
762
|
if (j) {
|
|
730
|
-
if (!e.Y) {
|
|
731
|
-
e.Y = signal(false);
|
|
732
|
-
e.Y.oe = true;
|
|
733
|
-
e.Y.Z = t => setSignal(e.Y, t);
|
|
734
|
-
}
|
|
735
|
-
const t = j;
|
|
736
|
-
j = null;
|
|
737
|
-
t.L = read(e.Y) || t.L;
|
|
738
|
-
j = t;
|
|
739
|
-
}
|
|
740
|
-
if (k) {
|
|
741
763
|
if (!e.fe) {
|
|
742
764
|
e.fe = signal(e.L);
|
|
743
765
|
e.fe.oe = true;
|
|
744
766
|
}
|
|
745
|
-
|
|
767
|
+
j = false;
|
|
746
768
|
try {
|
|
747
769
|
return read(e.fe);
|
|
748
770
|
} finally {
|
|
749
|
-
|
|
771
|
+
j = true;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
const n = e.F || e;
|
|
775
|
+
if (P) {
|
|
776
|
+
if (!n.Y) {
|
|
777
|
+
n.Y = signal(false);
|
|
778
|
+
n.Y.oe = true;
|
|
779
|
+
n.Y.Z = e => setSignal(n.Y, e);
|
|
750
780
|
}
|
|
781
|
+
const e = P;
|
|
782
|
+
P = null;
|
|
783
|
+
e.L = read(n.Y) || e.L;
|
|
784
|
+
P = e;
|
|
751
785
|
}
|
|
752
|
-
if (
|
|
753
|
-
if ((t && !
|
|
754
|
-
else if (t &&
|
|
755
|
-
setStatusFlags(t, t.$ |
|
|
786
|
+
if (!P && n.$ & f) {
|
|
787
|
+
if ((t && !k) || n.$ & a || e.F) throw n.K;
|
|
788
|
+
else if (t && k) {
|
|
789
|
+
setStatusFlags(t, t.$ | f, n.K);
|
|
756
790
|
}
|
|
757
791
|
}
|
|
758
792
|
if (e.$ & c) {
|
|
759
|
-
if (e.se <
|
|
793
|
+
if (e.se < O) {
|
|
760
794
|
recompute(e, true);
|
|
761
795
|
return read(e);
|
|
762
796
|
} else {
|
|
763
797
|
throw e.K;
|
|
764
798
|
}
|
|
765
799
|
}
|
|
766
|
-
return !t || e.oe || e.U === p || (
|
|
800
|
+
return !t || e.oe || e.U === p || (k && !P && (t.oe || (e.G && x !== e.G))) ? e.L : e.U;
|
|
767
801
|
}
|
|
768
802
|
function setSignal(e, t) {
|
|
769
803
|
if (typeof t === "function") {
|
|
770
804
|
t = t(e.U === p || (e.oe && e.G) ? e.L : e.U);
|
|
771
805
|
}
|
|
772
|
-
const n = !e.ue || !e.ue(e.U === p || e.oe ? e.L : e.U, t);
|
|
806
|
+
const n = !e.ue || !e.ue(e.U === p || (e.oe && e.G) ? e.L : e.U, t);
|
|
773
807
|
if (!n && !e.$) return t;
|
|
774
808
|
if (n) {
|
|
775
809
|
if (e.oe) e.L = t;
|
|
@@ -780,20 +814,20 @@ function setSignal(e, t) {
|
|
|
780
814
|
if (e.fe) setSignal(e.fe, t);
|
|
781
815
|
}
|
|
782
816
|
setStatusFlags(e, l);
|
|
783
|
-
e.se =
|
|
784
|
-
e.oe && !
|
|
817
|
+
e.se = O;
|
|
818
|
+
e.oe && !S ? C.T.push(e) : notifySubs(e);
|
|
785
819
|
schedule();
|
|
786
820
|
return t;
|
|
787
821
|
}
|
|
788
822
|
function getObserver() {
|
|
789
|
-
return N ?
|
|
823
|
+
return N ? A : null;
|
|
790
824
|
}
|
|
791
825
|
function getOwner() {
|
|
792
|
-
return
|
|
826
|
+
return A;
|
|
793
827
|
}
|
|
794
828
|
function onCleanup(e) {
|
|
795
|
-
if (!
|
|
796
|
-
const t =
|
|
829
|
+
if (!A) return e;
|
|
830
|
+
const t = A;
|
|
797
831
|
if (!t.te) {
|
|
798
832
|
t.te = e;
|
|
799
833
|
} else if (Array.isArray(t.te)) {
|
|
@@ -804,7 +838,7 @@ function onCleanup(e) {
|
|
|
804
838
|
return e;
|
|
805
839
|
}
|
|
806
840
|
function createOwner(e) {
|
|
807
|
-
const t =
|
|
841
|
+
const t = A;
|
|
808
842
|
const n = {
|
|
809
843
|
t: true,
|
|
810
844
|
u: t?.t ? t.u : t,
|
|
@@ -838,52 +872,56 @@ function createRoot(e, t) {
|
|
|
838
872
|
return runWithOwner(n, () => e(n.dispose));
|
|
839
873
|
}
|
|
840
874
|
function runWithOwner(e, t) {
|
|
841
|
-
const n =
|
|
842
|
-
|
|
875
|
+
const n = A;
|
|
876
|
+
A = e;
|
|
843
877
|
try {
|
|
844
878
|
return t();
|
|
845
879
|
} finally {
|
|
846
|
-
|
|
880
|
+
A = n;
|
|
847
881
|
}
|
|
848
882
|
}
|
|
849
883
|
function staleValues(e, t = true) {
|
|
850
|
-
const n =
|
|
851
|
-
|
|
884
|
+
const n = k;
|
|
885
|
+
k = t;
|
|
852
886
|
try {
|
|
853
887
|
return e();
|
|
854
888
|
} finally {
|
|
855
|
-
|
|
889
|
+
k = n;
|
|
856
890
|
}
|
|
857
891
|
}
|
|
858
892
|
function pending(e) {
|
|
859
|
-
const t =
|
|
860
|
-
|
|
893
|
+
const t = j;
|
|
894
|
+
j = true;
|
|
861
895
|
try {
|
|
862
896
|
return staleValues(e, false);
|
|
863
897
|
} finally {
|
|
864
|
-
|
|
898
|
+
j = t;
|
|
865
899
|
}
|
|
866
900
|
}
|
|
867
901
|
function isPending(e) {
|
|
868
|
-
const t =
|
|
869
|
-
|
|
902
|
+
const t = P;
|
|
903
|
+
P = { L: false };
|
|
870
904
|
try {
|
|
871
905
|
staleValues(e);
|
|
872
|
-
return
|
|
906
|
+
return P.L;
|
|
873
907
|
} catch (e) {
|
|
874
908
|
if (!(e instanceof NotReadyError)) return false;
|
|
875
909
|
throw e;
|
|
876
910
|
} finally {
|
|
877
|
-
|
|
911
|
+
P = t;
|
|
878
912
|
}
|
|
879
913
|
}
|
|
880
914
|
function refresh(e) {
|
|
881
|
-
let t =
|
|
882
|
-
|
|
915
|
+
let t = W;
|
|
916
|
+
W = true;
|
|
883
917
|
try {
|
|
918
|
+
if (typeof e !== "function") {
|
|
919
|
+
recompute(e[w]);
|
|
920
|
+
return e;
|
|
921
|
+
}
|
|
884
922
|
return untrack(e);
|
|
885
923
|
} finally {
|
|
886
|
-
|
|
924
|
+
W = t;
|
|
887
925
|
if (!t) {
|
|
888
926
|
schedule();
|
|
889
927
|
flush();
|
|
@@ -891,7 +929,7 @@ function refresh(e) {
|
|
|
891
929
|
}
|
|
892
930
|
}
|
|
893
931
|
function isRefreshing() {
|
|
894
|
-
return
|
|
932
|
+
return W;
|
|
895
933
|
}
|
|
896
934
|
function createContext(e, t) {
|
|
897
935
|
return { id: Symbol(t), defaultValue: e };
|
|
@@ -927,7 +965,7 @@ function effect(e, t, n, r, i) {
|
|
|
927
965
|
me: r,
|
|
928
966
|
Oe: t,
|
|
929
967
|
xe: n,
|
|
930
|
-
|
|
968
|
+
ve: undefined,
|
|
931
969
|
J: i?.render ? d : h,
|
|
932
970
|
le(e, t) {
|
|
933
971
|
if (s) {
|
|
@@ -942,8 +980,8 @@ function effect(e, t, n, r, i) {
|
|
|
942
980
|
try {
|
|
943
981
|
return this.xe
|
|
944
982
|
? this.xe(e, () => {
|
|
945
|
-
this.
|
|
946
|
-
this.
|
|
983
|
+
this.ve?.();
|
|
984
|
+
this.ve = undefined;
|
|
947
985
|
})
|
|
948
986
|
: console.error(e);
|
|
949
987
|
} catch (t) {
|
|
@@ -962,14 +1000,14 @@ function effect(e, t, n, r, i) {
|
|
|
962
1000
|
!i?.defer &&
|
|
963
1001
|
!(o.$ & (c | f)) &&
|
|
964
1002
|
(o.J === h ? o._e.enqueue(o.J, runEffect.bind(o)) : runEffect.call(o));
|
|
965
|
-
onCleanup(() => o.
|
|
1003
|
+
onCleanup(() => o.ve?.());
|
|
966
1004
|
}
|
|
967
1005
|
function runEffect() {
|
|
968
1006
|
if (!this.X || this.S & u) return;
|
|
969
|
-
this.
|
|
970
|
-
this.
|
|
1007
|
+
this.ve?.();
|
|
1008
|
+
this.ve = undefined;
|
|
971
1009
|
try {
|
|
972
|
-
this.
|
|
1010
|
+
this.ve = this.Oe(this.L, this.me);
|
|
973
1011
|
} catch (e) {
|
|
974
1012
|
if (!this._e.notify(this, c, c)) throw e;
|
|
975
1013
|
} finally {
|
|
@@ -982,10 +1020,8 @@ function createSignal(e, t, n) {
|
|
|
982
1020
|
const r = computed(e, t, n);
|
|
983
1021
|
return [read.bind(null, r), setSignal.bind(null, r)];
|
|
984
1022
|
}
|
|
985
|
-
const r =
|
|
986
|
-
|
|
987
|
-
const s = signal(e, i ? { id: getNextChildId(r), ...t } : t);
|
|
988
|
-
return [read.bind(null, s), setSignal.bind(null, s)];
|
|
1023
|
+
const r = signal(e, t);
|
|
1024
|
+
return [read.bind(null, r), setSignal.bind(null, r)];
|
|
989
1025
|
}
|
|
990
1026
|
function createMemo(e, t, n) {
|
|
991
1027
|
let r = computed(e, t, n);
|
|
@@ -1037,8 +1073,10 @@ function createOptimistic(e, t, n) {
|
|
|
1037
1073
|
if (typeof e === "function") {
|
|
1038
1074
|
const r = computed(
|
|
1039
1075
|
t => {
|
|
1040
|
-
|
|
1041
|
-
|
|
1076
|
+
const n = getOwner();
|
|
1077
|
+
const r = e(t);
|
|
1078
|
+
if (n.$ & a) return r;
|
|
1079
|
+
n.U = r;
|
|
1042
1080
|
return t;
|
|
1043
1081
|
},
|
|
1044
1082
|
t,
|
|
@@ -1047,15 +1085,13 @@ function createOptimistic(e, t, n) {
|
|
|
1047
1085
|
r.oe = true;
|
|
1048
1086
|
return [read.bind(null, r), setSignal.bind(null, r)];
|
|
1049
1087
|
}
|
|
1050
|
-
const r =
|
|
1051
|
-
|
|
1052
|
-
const s = signal(e, i ? { id: getNextChildId(r), ...t } : t);
|
|
1053
|
-
s.oe = true;
|
|
1088
|
+
const r = signal(e, t);
|
|
1089
|
+
r.oe = true;
|
|
1054
1090
|
return [
|
|
1055
|
-
read.bind(null,
|
|
1091
|
+
read.bind(null, r),
|
|
1056
1092
|
t => {
|
|
1057
|
-
|
|
1058
|
-
return setSignal(
|
|
1093
|
+
r.U = e;
|
|
1094
|
+
return setSignal(r, t);
|
|
1059
1095
|
}
|
|
1060
1096
|
];
|
|
1061
1097
|
}
|
|
@@ -1069,10 +1105,10 @@ function onSettled(e) {
|
|
|
1069
1105
|
});
|
|
1070
1106
|
}
|
|
1071
1107
|
function unwrap(e) {
|
|
1072
|
-
return e?.[
|
|
1108
|
+
return e?.[H]?.[T] ?? e;
|
|
1073
1109
|
}
|
|
1074
1110
|
function getOverrideValue(e, t, n, r) {
|
|
1075
|
-
return
|
|
1111
|
+
return t && r in t ? t[r] : e[r];
|
|
1076
1112
|
}
|
|
1077
1113
|
function getAllKeys(e, t, n) {
|
|
1078
1114
|
const r = getKeys(e, t);
|
|
@@ -1080,15 +1116,15 @@ function getAllKeys(e, t, n) {
|
|
|
1080
1116
|
return Array.from(new Set([...r, ...i]));
|
|
1081
1117
|
}
|
|
1082
1118
|
function applyState(e, t, n, r) {
|
|
1083
|
-
const i = t?.[
|
|
1119
|
+
const i = t?.[H];
|
|
1084
1120
|
if (!i) return;
|
|
1085
|
-
const s = i[
|
|
1086
|
-
const o = i[
|
|
1087
|
-
let u = i[
|
|
1121
|
+
const s = i[q];
|
|
1122
|
+
const o = i[M];
|
|
1123
|
+
let u = i[T];
|
|
1088
1124
|
if (e === s && !o) return;
|
|
1089
|
-
(i[
|
|
1090
|
-
i[
|
|
1091
|
-
i[
|
|
1125
|
+
(i[K] || U).set(e, i[Q]);
|
|
1126
|
+
i[q] = e;
|
|
1127
|
+
i[M] = undefined;
|
|
1092
1128
|
if (Array.isArray(s)) {
|
|
1093
1129
|
let t = false;
|
|
1094
1130
|
const l = getOverrideValue(s, o, u, "length");
|
|
@@ -1115,16 +1151,16 @@ function applyState(e, t, n, r) {
|
|
|
1115
1151
|
if (a > h || a > d) {
|
|
1116
1152
|
for (c = a; c <= h; c++) {
|
|
1117
1153
|
t = true;
|
|
1118
|
-
i[
|
|
1154
|
+
i[T][c] && setSignal(i[T][c], wrap(e[c], i));
|
|
1119
1155
|
}
|
|
1120
1156
|
for (; c < e.length; c++) {
|
|
1121
1157
|
t = true;
|
|
1122
1158
|
const s = wrap(w[c], i);
|
|
1123
|
-
i[
|
|
1159
|
+
i[T][c] && setSignal(i[T][c], s);
|
|
1124
1160
|
applyState(e[c], s, n, r);
|
|
1125
1161
|
}
|
|
1126
|
-
t && i[
|
|
1127
|
-
l !== e.length && i[
|
|
1162
|
+
t && i[T][I] && setSignal(i[T][I], void 0);
|
|
1163
|
+
l !== e.length && i[T].length && setSignal(i[T].length, e.length);
|
|
1128
1164
|
return;
|
|
1129
1165
|
}
|
|
1130
1166
|
y = new Array(h + 1);
|
|
@@ -1148,26 +1184,26 @@ function applyState(e, t, n, r) {
|
|
|
1148
1184
|
for (c = a; c < e.length; c++) {
|
|
1149
1185
|
if (c in w) {
|
|
1150
1186
|
const t = wrap(w[c], i);
|
|
1151
|
-
i[
|
|
1187
|
+
i[T][c] && setSignal(i[T][c], t);
|
|
1152
1188
|
applyState(e[c], t, n, r);
|
|
1153
|
-
} else i[
|
|
1189
|
+
} else i[T][c] && setSignal(i[T][c], wrap(e[c], i));
|
|
1154
1190
|
}
|
|
1155
1191
|
if (a < e.length) t = true;
|
|
1156
|
-
} else if (
|
|
1192
|
+
} else if (e.length) {
|
|
1157
1193
|
for (let t = 0, l = e.length; t < l; t++) {
|
|
1158
1194
|
const l = getOverrideValue(s, o, u, t);
|
|
1159
|
-
isWrappable(l)
|
|
1195
|
+
isWrappable(l) ? applyState(e[t], wrap(l, i), n, r) : i[T][t] && setSignal(i[T][t], e[t]);
|
|
1160
1196
|
}
|
|
1161
1197
|
}
|
|
1162
1198
|
if (l !== e.length) {
|
|
1163
1199
|
t = true;
|
|
1164
|
-
i[
|
|
1200
|
+
i[T].length && setSignal(i[T].length, e.length);
|
|
1165
1201
|
}
|
|
1166
|
-
t && i[
|
|
1202
|
+
t && i[T][I] && setSignal(i[T][I], void 0);
|
|
1167
1203
|
return;
|
|
1168
1204
|
}
|
|
1169
1205
|
if (u) {
|
|
1170
|
-
const t = u[
|
|
1206
|
+
const t = u[I];
|
|
1171
1207
|
const l = t || r ? getAllKeys(s, o, e) : Object.keys(u);
|
|
1172
1208
|
for (let f = 0, c = l.length; f < c; f++) {
|
|
1173
1209
|
const c = l[f];
|
|
@@ -1181,7 +1217,7 @@ function applyState(e, t, n, r) {
|
|
|
1181
1217
|
} else applyState(h, wrap(d, i), n, r);
|
|
1182
1218
|
}
|
|
1183
1219
|
}
|
|
1184
|
-
if ((u = i[
|
|
1220
|
+
if ((u = i[D])) {
|
|
1185
1221
|
const t = Object.keys(u);
|
|
1186
1222
|
for (let n = 0, r = t.length; n < r; n++) {
|
|
1187
1223
|
const r = t[n];
|
|
@@ -1202,66 +1238,109 @@ function reconcile(e, t, n = false) {
|
|
|
1202
1238
|
function createProjectionInternal(e, t = {}, n) {
|
|
1203
1239
|
let r;
|
|
1204
1240
|
const i = new WeakMap();
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
[B]: i,
|
|
1211
|
-
[T]() {
|
|
1241
|
+
const wrapper = e => {
|
|
1242
|
+
e[B] = wrapProjection;
|
|
1243
|
+
e[K] = i;
|
|
1244
|
+
Object.defineProperty(e, G, {
|
|
1245
|
+
get() {
|
|
1212
1246
|
return r;
|
|
1213
|
-
}
|
|
1247
|
+
},
|
|
1248
|
+
configurable: true
|
|
1214
1249
|
});
|
|
1250
|
+
};
|
|
1251
|
+
const wrapProjection = e => {
|
|
1252
|
+
if (i.has(e)) return i.get(e);
|
|
1253
|
+
if (e[H]?.[B] === wrapProjection) return e;
|
|
1254
|
+
const t = createStoreProxy(e, J, wrapper);
|
|
1215
1255
|
i.set(e, t);
|
|
1216
1256
|
return t;
|
|
1217
1257
|
};
|
|
1218
1258
|
const s = wrapProjection(t);
|
|
1219
1259
|
r = computed(() => {
|
|
1220
|
-
const t =
|
|
1221
|
-
storeSetter(s, r => {
|
|
1260
|
+
const t = getOwner();
|
|
1261
|
+
storeSetter(new Proxy(s, E), r => {
|
|
1222
1262
|
const i = handleAsync(t, e(r), e => {
|
|
1223
|
-
e !==
|
|
1263
|
+
e !== s && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
|
|
1264
|
+
setSignal(t, undefined);
|
|
1224
1265
|
});
|
|
1225
|
-
i !==
|
|
1266
|
+
i !== s && i !== undefined && reconcile(i, n?.key || "id", n?.all)(s);
|
|
1226
1267
|
});
|
|
1227
1268
|
});
|
|
1269
|
+
r.pe = true;
|
|
1228
1270
|
return { store: s, node: r };
|
|
1229
1271
|
}
|
|
1230
1272
|
function createProjection(e, t = {}, n) {
|
|
1231
1273
|
return createProjectionInternal(e, t, n).store;
|
|
1232
1274
|
}
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1235
|
-
|
|
1275
|
+
const E = {
|
|
1276
|
+
get(e, t) {
|
|
1277
|
+
let n;
|
|
1278
|
+
setWriteOverride(true);
|
|
1279
|
+
try {
|
|
1280
|
+
n = e[t];
|
|
1281
|
+
} finally {
|
|
1282
|
+
setWriteOverride(false);
|
|
1283
|
+
}
|
|
1284
|
+
return typeof n === "object" && n !== null ? new Proxy(n, E) : n;
|
|
1285
|
+
},
|
|
1286
|
+
set(e, t, n) {
|
|
1287
|
+
setWriteOverride(true);
|
|
1288
|
+
try {
|
|
1289
|
+
e[t] = n;
|
|
1290
|
+
} finally {
|
|
1291
|
+
setWriteOverride(false);
|
|
1292
|
+
}
|
|
1293
|
+
return true;
|
|
1294
|
+
},
|
|
1295
|
+
deleteProperty(e, t) {
|
|
1296
|
+
setWriteOverride(true);
|
|
1297
|
+
try {
|
|
1298
|
+
delete e[t];
|
|
1299
|
+
} finally {
|
|
1300
|
+
setWriteOverride(false);
|
|
1301
|
+
}
|
|
1302
|
+
return true;
|
|
1303
|
+
}
|
|
1304
|
+
};
|
|
1305
|
+
const I = Symbol(0),
|
|
1236
1306
|
F = Symbol(0),
|
|
1237
|
-
H = Symbol(0)
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
M = "
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1307
|
+
H = Symbol(0),
|
|
1308
|
+
Q = Symbol(0),
|
|
1309
|
+
R = Symbol(0);
|
|
1310
|
+
const V = new WeakMap();
|
|
1311
|
+
const q = "v",
|
|
1312
|
+
M = "o",
|
|
1313
|
+
T = "n",
|
|
1314
|
+
D = "h",
|
|
1315
|
+
B = "w",
|
|
1316
|
+
K = "l",
|
|
1317
|
+
G = "f";
|
|
1318
|
+
function createStoreProxy(e, t = J, n) {
|
|
1247
1319
|
let r;
|
|
1248
1320
|
if (Array.isArray(e)) {
|
|
1249
1321
|
r = [];
|
|
1250
1322
|
r.v = e;
|
|
1251
1323
|
} else r = { v: e };
|
|
1252
|
-
n &&
|
|
1253
|
-
return (r[
|
|
1324
|
+
n && n(r);
|
|
1325
|
+
return (r[Q] = new Proxy(r, t));
|
|
1254
1326
|
}
|
|
1255
|
-
const
|
|
1327
|
+
const U = new WeakMap();
|
|
1256
1328
|
function wrap(e, t) {
|
|
1257
|
-
if (t?.[
|
|
1258
|
-
let n = e[
|
|
1259
|
-
if (!n)
|
|
1329
|
+
if (t?.[B]) return t[B](e, t);
|
|
1330
|
+
let n = e[Q] || U.get(e);
|
|
1331
|
+
if (!n) U.set(e, (n = createStoreProxy(e)));
|
|
1260
1332
|
return n;
|
|
1261
1333
|
}
|
|
1262
1334
|
function isWrappable(e) {
|
|
1263
1335
|
return e != null && typeof e === "object" && !Object.isFrozen(e);
|
|
1264
1336
|
}
|
|
1337
|
+
let L = false;
|
|
1338
|
+
function setWriteOverride(e) {
|
|
1339
|
+
L = e;
|
|
1340
|
+
}
|
|
1341
|
+
function writeOnly(e) {
|
|
1342
|
+
return L || !!z?.has(e);
|
|
1343
|
+
}
|
|
1265
1344
|
function getNodes(e, t) {
|
|
1266
1345
|
let n = e[t];
|
|
1267
1346
|
if (!n) e[t] = n = Object.create(null);
|
|
@@ -1280,8 +1359,8 @@ function getNode(e, t, n, r, i = isEqual) {
|
|
|
1280
1359
|
r
|
|
1281
1360
|
));
|
|
1282
1361
|
}
|
|
1283
|
-
function trackSelf(e, t =
|
|
1284
|
-
getObserver() && read(getNode(getNodes(e,
|
|
1362
|
+
function trackSelf(e, t = I) {
|
|
1363
|
+
getObserver() && read(getNode(getNodes(e, T), t, undefined, e[G], false));
|
|
1285
1364
|
}
|
|
1286
1365
|
function getKeys(e, t, n = true) {
|
|
1287
1366
|
const r = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
|
|
@@ -1289,7 +1368,7 @@ function getKeys(e, t, n = true) {
|
|
|
1289
1368
|
const i = new Set(r);
|
|
1290
1369
|
const s = Reflect.ownKeys(t);
|
|
1291
1370
|
for (const e of s) {
|
|
1292
|
-
if (t[e] !==
|
|
1371
|
+
if (t[e] !== R) i.add(e);
|
|
1293
1372
|
else i.delete(e);
|
|
1294
1373
|
}
|
|
1295
1374
|
return Array.from(i);
|
|
@@ -1297,124 +1376,125 @@ function getKeys(e, t, n = true) {
|
|
|
1297
1376
|
function getPropertyDescriptor(e, t, n) {
|
|
1298
1377
|
let r = e;
|
|
1299
1378
|
if (t && n in t) {
|
|
1300
|
-
if (r[n] ===
|
|
1379
|
+
if (r[n] === R) return void 0;
|
|
1301
1380
|
if (!(n in r)) r = t;
|
|
1302
1381
|
}
|
|
1303
1382
|
return Reflect.getOwnPropertyDescriptor(r, n);
|
|
1304
1383
|
}
|
|
1305
|
-
let
|
|
1306
|
-
const
|
|
1384
|
+
let z = null;
|
|
1385
|
+
const J = {
|
|
1307
1386
|
get(e, t, n) {
|
|
1308
|
-
if (t ===
|
|
1309
|
-
if (t ===
|
|
1310
|
-
if (t ===
|
|
1387
|
+
if (t === H) return e;
|
|
1388
|
+
if (t === Q) return n;
|
|
1389
|
+
if (t === w) return e[G];
|
|
1390
|
+
if (t === I || t === F) {
|
|
1311
1391
|
trackSelf(e, t);
|
|
1312
1392
|
return n;
|
|
1313
1393
|
}
|
|
1314
|
-
const r = getNodes(e,
|
|
1394
|
+
const r = getNodes(e, T);
|
|
1315
1395
|
const i = r[t];
|
|
1316
|
-
const s = e[
|
|
1317
|
-
const o = !!e[
|
|
1318
|
-
const u = s ? e[
|
|
1396
|
+
const s = e[M] && t in e[M];
|
|
1397
|
+
const o = !!e[q][H];
|
|
1398
|
+
const u = s ? e[M] : e[q];
|
|
1319
1399
|
if (!i) {
|
|
1320
1400
|
const e = Object.getOwnPropertyDescriptor(u, t);
|
|
1321
1401
|
if (e && e.get) return e.get.call(n);
|
|
1322
1402
|
}
|
|
1323
|
-
if (
|
|
1403
|
+
if (writeOnly(n)) {
|
|
1324
1404
|
let n = i && (s || !o) ? (i.U !== p ? i.U : i.L) : u[t];
|
|
1325
|
-
n ===
|
|
1405
|
+
n === R && (n = undefined);
|
|
1326
1406
|
if (!isWrappable(n)) return n;
|
|
1327
1407
|
const r = wrap(n, e);
|
|
1328
|
-
|
|
1408
|
+
z?.add(r);
|
|
1329
1409
|
return r;
|
|
1330
1410
|
}
|
|
1331
1411
|
let l = i ? (s || !o ? read(r[t]) : (read(r[t]), u[t])) : u[t];
|
|
1332
|
-
l ===
|
|
1412
|
+
l === R && (l = undefined);
|
|
1333
1413
|
if (!i) {
|
|
1334
1414
|
if (!s && typeof l === "function" && !u.hasOwnProperty(t)) {
|
|
1335
1415
|
let t;
|
|
1336
|
-
return !Array.isArray(e[
|
|
1416
|
+
return !Array.isArray(e[q]) && (t = Object.getPrototypeOf(e[q])) && t !== Object.prototype
|
|
1337
1417
|
? l.bind(u)
|
|
1338
1418
|
: l;
|
|
1339
1419
|
} else if (getObserver()) {
|
|
1340
|
-
return read(getNode(r, t, isWrappable(l) ? wrap(l, e) : l, e[
|
|
1420
|
+
return read(getNode(r, t, isWrappable(l) ? wrap(l, e) : l, e[G]));
|
|
1341
1421
|
}
|
|
1342
1422
|
}
|
|
1343
1423
|
return isWrappable(l) ? wrap(l, e) : l;
|
|
1344
1424
|
},
|
|
1345
1425
|
has(e, t) {
|
|
1346
|
-
if (t ===
|
|
1347
|
-
const n = e[
|
|
1348
|
-
getObserver() && read(getNode(getNodes(e,
|
|
1426
|
+
if (t === Q || t === I || t === "__proto__") return true;
|
|
1427
|
+
const n = e[M] && t in e[M] ? e[M][t] !== R : t in e[q];
|
|
1428
|
+
getObserver() && read(getNode(getNodes(e, D), t, n, e[G]));
|
|
1349
1429
|
return n;
|
|
1350
1430
|
},
|
|
1351
1431
|
set(e, t, n) {
|
|
1352
|
-
const r = e[
|
|
1353
|
-
if (
|
|
1432
|
+
const r = e[Q];
|
|
1433
|
+
if (writeOnly(r)) {
|
|
1354
1434
|
untrack(() => {
|
|
1355
|
-
const i = e[
|
|
1435
|
+
const i = e[q];
|
|
1356
1436
|
const s = i[t];
|
|
1357
|
-
const o = e[
|
|
1358
|
-
const u = n?.[
|
|
1437
|
+
const o = e[M] && t in e[M] ? e[M][t] : s;
|
|
1438
|
+
const u = n?.[H]?.[q] ?? n;
|
|
1359
1439
|
if (o === u) return true;
|
|
1360
|
-
const l = e[
|
|
1361
|
-
if (u !== undefined && u === s) delete e[
|
|
1362
|
-
else (e[
|
|
1440
|
+
const l = e[M]?.length || i.length;
|
|
1441
|
+
if (u !== undefined && u === s) delete e[M][t];
|
|
1442
|
+
else (e[M] || (e[M] = Object.create(null)))[t] = u;
|
|
1363
1443
|
const f = isWrappable(u);
|
|
1364
1444
|
if (isWrappable(o)) {
|
|
1365
|
-
const e =
|
|
1366
|
-
e && (e instanceof Set ? e.delete(r) :
|
|
1445
|
+
const e = V.get(o);
|
|
1446
|
+
e && (e instanceof Set ? e.delete(r) : V.delete(o));
|
|
1367
1447
|
}
|
|
1368
|
-
if (recursivelyNotify(r,
|
|
1369
|
-
e[
|
|
1370
|
-
const c = getNodes(e,
|
|
1448
|
+
if (recursivelyNotify(r, U) && f) recursivelyAddParent(u, r);
|
|
1449
|
+
e[D]?.[t] && setSignal(e[D][t], true);
|
|
1450
|
+
const c = getNodes(e, T);
|
|
1371
1451
|
c[t] && setSignal(c[t], () => (f ? wrap(u, e) : u));
|
|
1372
1452
|
if (Array.isArray(i)) {
|
|
1373
1453
|
const e = parseInt(t) + 1;
|
|
1374
1454
|
if (e > l) c.length && setSignal(c.length, e);
|
|
1375
1455
|
}
|
|
1376
|
-
c[
|
|
1456
|
+
c[I] && setSignal(c[I], undefined);
|
|
1377
1457
|
});
|
|
1378
1458
|
}
|
|
1379
1459
|
return true;
|
|
1380
1460
|
},
|
|
1381
1461
|
deleteProperty(e, t) {
|
|
1382
|
-
if (
|
|
1462
|
+
if (writeOnly(e[Q]) && e[M]?.[t] !== R) {
|
|
1383
1463
|
untrack(() => {
|
|
1384
|
-
const n = e[
|
|
1385
|
-
if (t in e[
|
|
1386
|
-
(e[
|
|
1387
|
-
} else if (e[
|
|
1388
|
-
delete e[
|
|
1464
|
+
const n = e[M] && t in e[M] ? e[M][t] : e[q][t];
|
|
1465
|
+
if (t in e[q]) {
|
|
1466
|
+
(e[M] || (e[M] = Object.create(null)))[t] = R;
|
|
1467
|
+
} else if (e[M] && t in e[M]) {
|
|
1468
|
+
delete e[M][t];
|
|
1389
1469
|
} else return true;
|
|
1390
1470
|
if (isWrappable(n)) {
|
|
1391
|
-
const t =
|
|
1392
|
-
t && (t instanceof Set ? t.delete(e) :
|
|
1471
|
+
const t = V.get(n);
|
|
1472
|
+
t && (t instanceof Set ? t.delete(e) : V.delete(n));
|
|
1393
1473
|
}
|
|
1394
|
-
if (e[
|
|
1395
|
-
const r = getNodes(e,
|
|
1474
|
+
if (e[D]?.[t]) setSignal(e[D][t], false);
|
|
1475
|
+
const r = getNodes(e, T);
|
|
1396
1476
|
r[t] && setSignal(r[t], undefined);
|
|
1397
|
-
r[
|
|
1477
|
+
r[I] && setSignal(r[I], undefined);
|
|
1398
1478
|
});
|
|
1399
1479
|
}
|
|
1400
1480
|
return true;
|
|
1401
1481
|
},
|
|
1402
1482
|
ownKeys(e) {
|
|
1403
1483
|
trackSelf(e);
|
|
1404
|
-
return getKeys(e[
|
|
1484
|
+
return getKeys(e[q], e[M], false);
|
|
1405
1485
|
},
|
|
1406
1486
|
getOwnPropertyDescriptor(e, t) {
|
|
1407
|
-
if (t ===
|
|
1408
|
-
return getPropertyDescriptor(e[
|
|
1487
|
+
if (t === Q) return { value: e[Q], writable: true, configurable: true };
|
|
1488
|
+
return getPropertyDescriptor(e[q], e[M], t);
|
|
1409
1489
|
},
|
|
1410
1490
|
getPrototypeOf(e) {
|
|
1411
|
-
return Object.getPrototypeOf(e[
|
|
1491
|
+
return Object.getPrototypeOf(e[q]);
|
|
1412
1492
|
}
|
|
1413
1493
|
};
|
|
1414
1494
|
function storeSetter(e, t) {
|
|
1415
|
-
const n =
|
|
1416
|
-
|
|
1417
|
-
|
|
1495
|
+
const n = z;
|
|
1496
|
+
z = new Set();
|
|
1497
|
+
z.add(e);
|
|
1418
1498
|
try {
|
|
1419
1499
|
const n = t(e);
|
|
1420
1500
|
if (n !== e && n !== undefined) {
|
|
@@ -1430,8 +1510,8 @@ function storeSetter(e, t) {
|
|
|
1430
1510
|
}
|
|
1431
1511
|
}
|
|
1432
1512
|
} finally {
|
|
1433
|
-
|
|
1434
|
-
|
|
1513
|
+
z.clear();
|
|
1514
|
+
z = n;
|
|
1435
1515
|
}
|
|
1436
1516
|
}
|
|
1437
1517
|
function createStore(e, t, n) {
|
|
@@ -1440,17 +1520,17 @@ function createStore(e, t, n) {
|
|
|
1440
1520
|
return [i, e => storeSetter(i, e)];
|
|
1441
1521
|
}
|
|
1442
1522
|
function recursivelyNotify(e, t) {
|
|
1443
|
-
let n = e[
|
|
1523
|
+
let n = e[H] || t?.get(e)?.[H];
|
|
1444
1524
|
let r = false;
|
|
1445
1525
|
if (n) {
|
|
1446
|
-
const e = getNodes(n,
|
|
1526
|
+
const e = getNodes(n, T)[F];
|
|
1447
1527
|
if (e) {
|
|
1448
1528
|
setSignal(e, undefined);
|
|
1449
1529
|
r = true;
|
|
1450
1530
|
}
|
|
1451
|
-
t = n[
|
|
1531
|
+
t = n[K] || t;
|
|
1452
1532
|
}
|
|
1453
|
-
const i =
|
|
1533
|
+
const i = V.get(n?.[q] || e);
|
|
1454
1534
|
if (!i) return r;
|
|
1455
1535
|
if (i instanceof Set) {
|
|
1456
1536
|
for (let e of i) r = recursivelyNotify(e, t) || r;
|
|
@@ -1459,16 +1539,16 @@ function recursivelyNotify(e, t) {
|
|
|
1459
1539
|
}
|
|
1460
1540
|
function recursivelyAddParent(e, t) {
|
|
1461
1541
|
let n;
|
|
1462
|
-
const r = e[
|
|
1542
|
+
const r = e[H];
|
|
1463
1543
|
if (r) {
|
|
1464
|
-
n = r[
|
|
1465
|
-
e = r[
|
|
1544
|
+
n = r[M];
|
|
1545
|
+
e = r[q];
|
|
1466
1546
|
}
|
|
1467
1547
|
if (t) {
|
|
1468
|
-
let n =
|
|
1469
|
-
if (!n)
|
|
1548
|
+
let n = V.get(e);
|
|
1549
|
+
if (!n) V.set(e, t);
|
|
1470
1550
|
else if (n !== t) {
|
|
1471
|
-
if (!(n instanceof Set))
|
|
1551
|
+
if (!(n instanceof Set)) V.set(e, (n = new Set([n])));
|
|
1472
1552
|
else if (n.has(t)) return;
|
|
1473
1553
|
n.add(t);
|
|
1474
1554
|
} else return;
|
|
@@ -1490,7 +1570,7 @@ function recursivelyAddParent(e, t) {
|
|
|
1490
1570
|
}
|
|
1491
1571
|
function deep(e) {
|
|
1492
1572
|
recursivelyAddParent(e);
|
|
1493
|
-
return e[
|
|
1573
|
+
return e[F];
|
|
1494
1574
|
}
|
|
1495
1575
|
function createOptimisticStore(e, t, n) {
|
|
1496
1576
|
return [];
|
|
@@ -1500,12 +1580,12 @@ function snapshot(e, t, n) {
|
|
|
1500
1580
|
if (!isWrappable(e)) return e;
|
|
1501
1581
|
if (t && t.has(e)) return t.get(e);
|
|
1502
1582
|
if (!t) t = new Map();
|
|
1503
|
-
if ((r = e[
|
|
1504
|
-
s = r[
|
|
1505
|
-
i = Array.isArray(r[
|
|
1506
|
-
t.set(e, s ? (o = i ? [] : Object.create(Object.getPrototypeOf(r[
|
|
1507
|
-
e = r[
|
|
1508
|
-
n =
|
|
1583
|
+
if ((r = e[H] || n?.get(e)?.[H])) {
|
|
1584
|
+
s = r[M];
|
|
1585
|
+
i = Array.isArray(r[q]);
|
|
1586
|
+
t.set(e, s ? (o = i ? [] : Object.create(Object.getPrototypeOf(r[q]))) : r[q]);
|
|
1587
|
+
e = r[q];
|
|
1588
|
+
n = U;
|
|
1509
1589
|
} else {
|
|
1510
1590
|
i = Array.isArray(e);
|
|
1511
1591
|
t.set(e, e);
|
|
@@ -1514,7 +1594,7 @@ function snapshot(e, t, n) {
|
|
|
1514
1594
|
const r = s?.length || e.length;
|
|
1515
1595
|
for (let i = 0; i < r; i++) {
|
|
1516
1596
|
l = s && i in s ? s[i] : e[i];
|
|
1517
|
-
if (l ===
|
|
1597
|
+
if (l === R) continue;
|
|
1518
1598
|
if ((u = snapshot(l, t, n)) !== l || o) {
|
|
1519
1599
|
if (!o) t.set(e, (o = [...e]));
|
|
1520
1600
|
o[i] = u;
|
|
@@ -1541,13 +1621,13 @@ function snapshot(e, t, n) {
|
|
|
1541
1621
|
function trueFn() {
|
|
1542
1622
|
return true;
|
|
1543
1623
|
}
|
|
1544
|
-
const
|
|
1624
|
+
const X = {
|
|
1545
1625
|
get(e, t, n) {
|
|
1546
|
-
if (t ===
|
|
1626
|
+
if (t === Q) return n;
|
|
1547
1627
|
return e.get(t);
|
|
1548
1628
|
},
|
|
1549
1629
|
has(e, t) {
|
|
1550
|
-
if (t ===
|
|
1630
|
+
if (t === Q) return true;
|
|
1551
1631
|
return e.has(t);
|
|
1552
1632
|
},
|
|
1553
1633
|
set: trueFn,
|
|
@@ -1570,15 +1650,15 @@ const L = {
|
|
|
1570
1650
|
function resolveSource(e) {
|
|
1571
1651
|
return !(e = typeof e === "function" ? e() : e) ? {} : e;
|
|
1572
1652
|
}
|
|
1573
|
-
const
|
|
1653
|
+
const Y = Symbol(0);
|
|
1574
1654
|
function merge(...e) {
|
|
1575
1655
|
if (e.length === 1 && typeof e[0] !== "function") return e[0];
|
|
1576
1656
|
let t = false;
|
|
1577
1657
|
const n = [];
|
|
1578
1658
|
for (let r = 0; r < e.length; r++) {
|
|
1579
1659
|
const i = e[r];
|
|
1580
|
-
t = t || (!!i &&
|
|
1581
|
-
const s = !!i && i[
|
|
1660
|
+
t = t || (!!i && Q in i);
|
|
1661
|
+
const s = !!i && i[Y];
|
|
1582
1662
|
if (s) n.push(...s);
|
|
1583
1663
|
else n.push(typeof i === "function" ? ((t = true), createMemo(i)) : i);
|
|
1584
1664
|
}
|
|
@@ -1586,7 +1666,7 @@ function merge(...e) {
|
|
|
1586
1666
|
return new Proxy(
|
|
1587
1667
|
{
|
|
1588
1668
|
get(e) {
|
|
1589
|
-
if (e ===
|
|
1669
|
+
if (e === Y) return n;
|
|
1590
1670
|
for (let t = n.length - 1; t >= 0; t--) {
|
|
1591
1671
|
const r = resolveSource(n[t]);
|
|
1592
1672
|
if (e in r) return r[e];
|
|
@@ -1604,7 +1684,7 @@ function merge(...e) {
|
|
|
1604
1684
|
return [...new Set(e)];
|
|
1605
1685
|
}
|
|
1606
1686
|
},
|
|
1607
|
-
|
|
1687
|
+
X
|
|
1608
1688
|
);
|
|
1609
1689
|
}
|
|
1610
1690
|
const r = Object.create(null);
|
|
@@ -1636,12 +1716,12 @@ function merge(...e) {
|
|
|
1636
1716
|
if (n.get) Object.defineProperty(o, t, n);
|
|
1637
1717
|
else o[t] = n.value;
|
|
1638
1718
|
}
|
|
1639
|
-
o[
|
|
1719
|
+
o[Y] = n;
|
|
1640
1720
|
return o;
|
|
1641
1721
|
}
|
|
1642
1722
|
function omit(e, ...t) {
|
|
1643
1723
|
const n = new Set(t);
|
|
1644
|
-
if (y &&
|
|
1724
|
+
if (y && Q in e) {
|
|
1645
1725
|
return new Proxy(
|
|
1646
1726
|
{
|
|
1647
1727
|
get(t) {
|
|
@@ -1654,7 +1734,7 @@ function omit(e, ...t) {
|
|
|
1654
1734
|
return Object.keys(e).filter(e => !n.has(e));
|
|
1655
1735
|
}
|
|
1656
1736
|
},
|
|
1657
|
-
|
|
1737
|
+
X
|
|
1658
1738
|
);
|
|
1659
1739
|
}
|
|
1660
1740
|
const r = {};
|
|
@@ -1672,33 +1752,33 @@ function mapArray(e, t, n) {
|
|
|
1672
1752
|
const r = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
1673
1753
|
return createMemo(
|
|
1674
1754
|
updateKeyedMap.bind({
|
|
1675
|
-
|
|
1676
|
-
|
|
1755
|
+
Ce: createOwner(),
|
|
1756
|
+
Ne: 0,
|
|
1677
1757
|
ke: e,
|
|
1678
1758
|
je: [],
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1759
|
+
Pe: t,
|
|
1760
|
+
We: [],
|
|
1761
|
+
Ae: [],
|
|
1762
|
+
Ee: r,
|
|
1683
1763
|
Ie: r || n?.keyed === false ? [] : undefined,
|
|
1684
1764
|
Fe: t.length > 1 ? [] : undefined,
|
|
1685
1765
|
He: n?.fallback
|
|
1686
1766
|
})
|
|
1687
1767
|
);
|
|
1688
1768
|
}
|
|
1689
|
-
const
|
|
1769
|
+
const Z = { pureWrite: true };
|
|
1690
1770
|
function updateKeyedMap() {
|
|
1691
1771
|
const e = this.ke() || [],
|
|
1692
1772
|
t = e.length;
|
|
1693
|
-
e[
|
|
1694
|
-
runWithOwner(this.
|
|
1773
|
+
e[I];
|
|
1774
|
+
runWithOwner(this.Ce, () => {
|
|
1695
1775
|
let n,
|
|
1696
1776
|
r,
|
|
1697
1777
|
i = this.Ie
|
|
1698
1778
|
? () => {
|
|
1699
|
-
this.Ie[r] = signal(e[r],
|
|
1700
|
-
this.Fe && (this.Fe[r] = signal(r,
|
|
1701
|
-
return this.
|
|
1779
|
+
this.Ie[r] = signal(e[r], Z);
|
|
1780
|
+
this.Fe && (this.Fe[r] = signal(r, Z));
|
|
1781
|
+
return this.Pe(
|
|
1702
1782
|
read.bind(null, this.Ie[r]),
|
|
1703
1783
|
this.Fe ? read.bind(null, this.Fe[r]) : undefined
|
|
1704
1784
|
);
|
|
@@ -1706,34 +1786,34 @@ function updateKeyedMap() {
|
|
|
1706
1786
|
: this.Fe
|
|
1707
1787
|
? () => {
|
|
1708
1788
|
const t = e[r];
|
|
1709
|
-
this.Fe[r] = signal(r,
|
|
1710
|
-
return this.
|
|
1789
|
+
this.Fe[r] = signal(r, Z);
|
|
1790
|
+
return this.Pe(() => t, read.bind(null, this.Fe[r]));
|
|
1711
1791
|
}
|
|
1712
1792
|
: () => {
|
|
1713
1793
|
const t = e[r];
|
|
1714
|
-
return this.
|
|
1794
|
+
return this.Pe(() => t);
|
|
1715
1795
|
};
|
|
1716
1796
|
if (t === 0) {
|
|
1717
|
-
if (this.
|
|
1718
|
-
this.
|
|
1719
|
-
this.
|
|
1797
|
+
if (this.Ne !== 0) {
|
|
1798
|
+
this.Ce.dispose(false);
|
|
1799
|
+
this.Ae = [];
|
|
1720
1800
|
this.je = [];
|
|
1721
|
-
this.
|
|
1722
|
-
this.
|
|
1801
|
+
this.We = [];
|
|
1802
|
+
this.Ne = 0;
|
|
1723
1803
|
this.Ie && (this.Ie = []);
|
|
1724
1804
|
this.Fe && (this.Fe = []);
|
|
1725
1805
|
}
|
|
1726
|
-
if (this.He && !this.
|
|
1727
|
-
this.
|
|
1806
|
+
if (this.He && !this.We[0]) {
|
|
1807
|
+
this.We[0] = runWithOwner((this.Ae[0] = createOwner()), this.He);
|
|
1728
1808
|
}
|
|
1729
|
-
} else if (this.
|
|
1730
|
-
if (this.
|
|
1731
|
-
this.
|
|
1809
|
+
} else if (this.Ne === 0) {
|
|
1810
|
+
if (this.Ae[0]) this.Ae[0].dispose();
|
|
1811
|
+
this.We = new Array(t);
|
|
1732
1812
|
for (r = 0; r < t; r++) {
|
|
1733
1813
|
this.je[r] = e[r];
|
|
1734
|
-
this.
|
|
1814
|
+
this.We[r] = runWithOwner((this.Ae[r] = createOwner()), i);
|
|
1735
1815
|
}
|
|
1736
|
-
this.
|
|
1816
|
+
this.Ne = t;
|
|
1737
1817
|
} else {
|
|
1738
1818
|
let s,
|
|
1739
1819
|
o,
|
|
@@ -1747,21 +1827,21 @@ function updateKeyedMap() {
|
|
|
1747
1827
|
p = this.Ie ? new Array(t) : undefined,
|
|
1748
1828
|
y = this.Fe ? new Array(t) : undefined;
|
|
1749
1829
|
for (
|
|
1750
|
-
s = 0, o = Math.min(this.
|
|
1751
|
-
s < o && (this.je[s] === e[s] || (this.Ie && compare(this.
|
|
1830
|
+
s = 0, o = Math.min(this.Ne, t);
|
|
1831
|
+
s < o && (this.je[s] === e[s] || (this.Ie && compare(this.Ee, this.je[s], e[s])));
|
|
1752
1832
|
s++
|
|
1753
1833
|
) {
|
|
1754
1834
|
if (this.Ie) setSignal(this.Ie[s], e[s]);
|
|
1755
1835
|
}
|
|
1756
1836
|
for (
|
|
1757
|
-
o = this.
|
|
1837
|
+
o = this.Ne - 1, u = t - 1;
|
|
1758
1838
|
o >= s &&
|
|
1759
1839
|
u >= s &&
|
|
1760
|
-
(this.je[o] === e[u] || (this.Ie && compare(this.
|
|
1840
|
+
(this.je[o] === e[u] || (this.Ie && compare(this.Ee, this.je[o], e[u])));
|
|
1761
1841
|
o--, u--
|
|
1762
1842
|
) {
|
|
1763
|
-
d[u] = this.
|
|
1764
|
-
h[u] = this.
|
|
1843
|
+
d[u] = this.We[o];
|
|
1844
|
+
h[u] = this.Ae[o];
|
|
1765
1845
|
p && (p[u] = this.Ie[o]);
|
|
1766
1846
|
y && (y[u] = this.Fe[o]);
|
|
1767
1847
|
}
|
|
@@ -1769,28 +1849,28 @@ function updateKeyedMap() {
|
|
|
1769
1849
|
a = new Array(u + 1);
|
|
1770
1850
|
for (r = u; r >= s; r--) {
|
|
1771
1851
|
l = e[r];
|
|
1772
|
-
f = this.
|
|
1852
|
+
f = this.Ee ? this.Ee(l) : l;
|
|
1773
1853
|
n = c.get(f);
|
|
1774
1854
|
a[r] = n === undefined ? -1 : n;
|
|
1775
1855
|
c.set(f, r);
|
|
1776
1856
|
}
|
|
1777
1857
|
for (n = s; n <= o; n++) {
|
|
1778
1858
|
l = this.je[n];
|
|
1779
|
-
f = this.
|
|
1859
|
+
f = this.Ee ? this.Ee(l) : l;
|
|
1780
1860
|
r = c.get(f);
|
|
1781
1861
|
if (r !== undefined && r !== -1) {
|
|
1782
|
-
d[r] = this.
|
|
1783
|
-
h[r] = this.
|
|
1862
|
+
d[r] = this.We[n];
|
|
1863
|
+
h[r] = this.Ae[n];
|
|
1784
1864
|
p && (p[r] = this.Ie[n]);
|
|
1785
1865
|
y && (y[r] = this.Fe[n]);
|
|
1786
1866
|
r = a[r];
|
|
1787
1867
|
c.set(f, r);
|
|
1788
|
-
} else this.
|
|
1868
|
+
} else this.Ae[n].dispose();
|
|
1789
1869
|
}
|
|
1790
1870
|
for (r = s; r < t; r++) {
|
|
1791
1871
|
if (r in d) {
|
|
1792
|
-
this.
|
|
1793
|
-
this.
|
|
1872
|
+
this.We[r] = d[r];
|
|
1873
|
+
this.Ae[r] = h[r];
|
|
1794
1874
|
if (p) {
|
|
1795
1875
|
this.Ie[r] = p[r];
|
|
1796
1876
|
setSignal(this.Ie[r], e[r]);
|
|
@@ -1800,24 +1880,24 @@ function updateKeyedMap() {
|
|
|
1800
1880
|
setSignal(this.Fe[r], r);
|
|
1801
1881
|
}
|
|
1802
1882
|
} else {
|
|
1803
|
-
this.
|
|
1883
|
+
this.We[r] = runWithOwner((this.Ae[r] = createOwner()), i);
|
|
1804
1884
|
}
|
|
1805
1885
|
}
|
|
1806
|
-
this.
|
|
1886
|
+
this.We = this.We.slice(0, (this.Ne = t));
|
|
1807
1887
|
this.je = e.slice(0);
|
|
1808
1888
|
}
|
|
1809
1889
|
});
|
|
1810
|
-
return this.
|
|
1890
|
+
return this.We;
|
|
1811
1891
|
}
|
|
1812
1892
|
function repeat(e, t, n) {
|
|
1813
1893
|
return updateRepeat.bind({
|
|
1814
|
-
|
|
1815
|
-
|
|
1894
|
+
Ce: createOwner(),
|
|
1895
|
+
Ne: 0,
|
|
1816
1896
|
Qe: 0,
|
|
1817
1897
|
Re: e,
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1898
|
+
Pe: t,
|
|
1899
|
+
Ae: [],
|
|
1900
|
+
We: [],
|
|
1821
1901
|
Ve: n?.from,
|
|
1822
1902
|
He: n?.fallback
|
|
1823
1903
|
});
|
|
@@ -1825,49 +1905,49 @@ function repeat(e, t, n) {
|
|
|
1825
1905
|
function updateRepeat() {
|
|
1826
1906
|
const e = this.Re();
|
|
1827
1907
|
const t = this.Ve?.() || 0;
|
|
1828
|
-
runWithOwner(this.
|
|
1908
|
+
runWithOwner(this.Ce, () => {
|
|
1829
1909
|
if (e === 0) {
|
|
1830
|
-
if (this.
|
|
1831
|
-
this.
|
|
1832
|
-
this.
|
|
1833
|
-
this.
|
|
1834
|
-
this.
|
|
1910
|
+
if (this.Ne !== 0) {
|
|
1911
|
+
this.Ce.dispose(false);
|
|
1912
|
+
this.Ae = [];
|
|
1913
|
+
this.We = [];
|
|
1914
|
+
this.Ne = 0;
|
|
1835
1915
|
}
|
|
1836
|
-
if (this.He && !this.
|
|
1837
|
-
this.
|
|
1916
|
+
if (this.He && !this.We[0]) {
|
|
1917
|
+
this.We[0] = runWithOwner((this.Ae[0] = createOwner()), this.He);
|
|
1838
1918
|
}
|
|
1839
1919
|
return;
|
|
1840
1920
|
}
|
|
1841
1921
|
const n = t + e;
|
|
1842
|
-
const r = this.Qe + this.
|
|
1843
|
-
if (this.
|
|
1844
|
-
for (let e = n; e < r; e++) this.
|
|
1922
|
+
const r = this.Qe + this.Ne;
|
|
1923
|
+
if (this.Ne === 0 && this.Ae[0]) this.Ae[0].dispose();
|
|
1924
|
+
for (let e = n; e < r; e++) this.Ae[e - this.Qe].dispose();
|
|
1845
1925
|
if (this.Qe < t) {
|
|
1846
1926
|
let e = this.Qe;
|
|
1847
|
-
while (e < t && e < this.
|
|
1848
|
-
this.
|
|
1849
|
-
this.
|
|
1927
|
+
while (e < t && e < this.Ne) this.Ae[e++].dispose();
|
|
1928
|
+
this.Ae.splice(0, t - this.Qe);
|
|
1929
|
+
this.We.splice(0, t - this.Qe);
|
|
1850
1930
|
} else if (this.Qe > t) {
|
|
1851
1931
|
let n = r - this.Qe - 1;
|
|
1852
1932
|
let i = this.Qe - t;
|
|
1853
|
-
this.
|
|
1933
|
+
this.Ae.length = this.We.length = e;
|
|
1854
1934
|
while (n >= i) {
|
|
1855
|
-
this.
|
|
1856
|
-
this.
|
|
1935
|
+
this.Ae[n] = this.Ae[n - i];
|
|
1936
|
+
this.We[n] = this.We[n - i];
|
|
1857
1937
|
n--;
|
|
1858
1938
|
}
|
|
1859
1939
|
for (let e = 0; e < i; e++) {
|
|
1860
|
-
this.
|
|
1940
|
+
this.We[e] = runWithOwner((this.Ae[e] = createOwner()), () => this.Pe(e + t));
|
|
1861
1941
|
}
|
|
1862
1942
|
}
|
|
1863
1943
|
for (let e = r; e < n; e++) {
|
|
1864
|
-
this.
|
|
1944
|
+
this.We[e - t] = runWithOwner((this.Ae[e - t] = createOwner()), () => this.Pe(e));
|
|
1865
1945
|
}
|
|
1866
|
-
this.
|
|
1946
|
+
this.We = this.We.slice(0, e);
|
|
1867
1947
|
this.Qe = t;
|
|
1868
|
-
this.
|
|
1948
|
+
this.Ne = e;
|
|
1869
1949
|
});
|
|
1870
|
-
return this.
|
|
1950
|
+
return this.We;
|
|
1871
1951
|
}
|
|
1872
1952
|
function compare(e, t, n) {
|
|
1873
1953
|
return e ? e(t) === e(n) : true;
|
|
@@ -1901,7 +1981,7 @@ function createBoundChildren(e, t, n, r) {
|
|
|
1901
1981
|
}
|
|
1902
1982
|
class ConditionalQueue extends Queue {
|
|
1903
1983
|
Me;
|
|
1904
|
-
|
|
1984
|
+
Te = new Set();
|
|
1905
1985
|
M = new Set();
|
|
1906
1986
|
constructor(e) {
|
|
1907
1987
|
super();
|
|
@@ -1921,57 +2001,57 @@ class ConditionalQueue extends Queue {
|
|
|
1921
2001
|
}
|
|
1922
2002
|
if (t & c) {
|
|
1923
2003
|
if (n & c) {
|
|
1924
|
-
this.
|
|
2004
|
+
this.Te.add(e);
|
|
1925
2005
|
t &= ~c;
|
|
1926
|
-
} else if (this.
|
|
2006
|
+
} else if (this.Te.delete(e)) t &= ~c;
|
|
1927
2007
|
}
|
|
1928
2008
|
}
|
|
1929
2009
|
return t ? super.notify(e, t, n) : true;
|
|
1930
2010
|
}
|
|
1931
2011
|
}
|
|
1932
2012
|
class CollectionQueue extends Queue {
|
|
1933
|
-
|
|
1934
|
-
|
|
2013
|
+
De;
|
|
2014
|
+
Ae = new Set();
|
|
1935
2015
|
Me = signal(false, { pureWrite: true });
|
|
1936
|
-
|
|
2016
|
+
Be = false;
|
|
1937
2017
|
constructor(e) {
|
|
1938
2018
|
super();
|
|
1939
|
-
this.
|
|
2019
|
+
this.De = e;
|
|
1940
2020
|
}
|
|
1941
2021
|
run(e) {
|
|
1942
2022
|
if (!e || read(this.Me)) return;
|
|
1943
2023
|
return super.run(e);
|
|
1944
2024
|
}
|
|
1945
2025
|
notify(e, t, n) {
|
|
1946
|
-
if (!(t & this.
|
|
1947
|
-
if (n & this.
|
|
1948
|
-
this.
|
|
1949
|
-
if (this.
|
|
1950
|
-
} else if (this.
|
|
1951
|
-
this.
|
|
1952
|
-
if (this.
|
|
1953
|
-
}
|
|
1954
|
-
t &= ~this.
|
|
2026
|
+
if (!(t & this.De) || (this.De & f && this.Be)) return super.notify(e, t, n);
|
|
2027
|
+
if (n & this.De) {
|
|
2028
|
+
this.Ae.add(e);
|
|
2029
|
+
if (this.Ae.size === 1) setSignal(this.Me, true);
|
|
2030
|
+
} else if (this.Ae.size > 0) {
|
|
2031
|
+
this.Ae.delete(e);
|
|
2032
|
+
if (this.Ae.size === 0) setSignal(this.Me, false);
|
|
2033
|
+
}
|
|
2034
|
+
t &= ~this.De;
|
|
1955
2035
|
return t ? super.notify(e, t, n) : true;
|
|
1956
2036
|
}
|
|
1957
2037
|
}
|
|
1958
|
-
var
|
|
2038
|
+
var $;
|
|
1959
2039
|
(function (e) {
|
|
1960
2040
|
e["VISIBLE"] = "visible";
|
|
1961
2041
|
e["HIDDEN"] = "hidden";
|
|
1962
|
-
})(
|
|
2042
|
+
})($ || ($ = {}));
|
|
1963
2043
|
function createBoundary(e, t) {
|
|
1964
2044
|
const n = createOwner();
|
|
1965
|
-
const r = new ConditionalQueue(computed(() => t() ===
|
|
2045
|
+
const r = new ConditionalQueue(computed(() => t() === $.HIDDEN));
|
|
1966
2046
|
const i = createBoundChildren(n, e, r, 0);
|
|
1967
2047
|
computed(() => {
|
|
1968
2048
|
const e = read(r.Me);
|
|
1969
2049
|
i.qe = e ? c | f : 0;
|
|
1970
2050
|
if (!e) {
|
|
1971
2051
|
r.M.forEach(e => r.notify(e, f, f));
|
|
1972
|
-
r.
|
|
2052
|
+
r.Te.forEach(e => r.notify(e, c, c));
|
|
1973
2053
|
r.M.clear();
|
|
1974
|
-
r.
|
|
2054
|
+
r.Te.clear();
|
|
1975
2055
|
}
|
|
1976
2056
|
});
|
|
1977
2057
|
return () => (read(r.Me) ? undefined : read(i));
|
|
@@ -1983,7 +2063,7 @@ function createCollectionBoundary(e, t, n) {
|
|
|
1983
2063
|
const o = computed(() => {
|
|
1984
2064
|
if (!read(i.Me)) {
|
|
1985
2065
|
const e = read(s);
|
|
1986
|
-
if (!untrack(() => read(i.Me))) i.
|
|
2066
|
+
if (!untrack(() => read(i.Me))) i.Be = true;
|
|
1987
2067
|
return e;
|
|
1988
2068
|
}
|
|
1989
2069
|
return n(i);
|
|
@@ -1995,23 +2075,23 @@ function createLoadBoundary(e, t) {
|
|
|
1995
2075
|
}
|
|
1996
2076
|
function collectErrorSources(e, t) {
|
|
1997
2077
|
let n = true;
|
|
1998
|
-
let r = e.
|
|
2078
|
+
let r = e.W;
|
|
1999
2079
|
while (r !== null) {
|
|
2000
2080
|
const e = r.I;
|
|
2001
|
-
if (e.
|
|
2081
|
+
if (e.W && e.$ & c) {
|
|
2002
2082
|
n = false;
|
|
2003
2083
|
collectErrorSources(e, t);
|
|
2004
2084
|
}
|
|
2005
|
-
r = r.
|
|
2085
|
+
r = r.A;
|
|
2006
2086
|
}
|
|
2007
2087
|
n && t.push(e);
|
|
2008
2088
|
}
|
|
2009
2089
|
function createErrorBoundary(e, t) {
|
|
2010
2090
|
return createCollectionBoundary(c, e, e => {
|
|
2011
|
-
let n = e.
|
|
2091
|
+
let n = e.Ae.values().next().value;
|
|
2012
2092
|
return t(n.K, () => {
|
|
2013
2093
|
const t = [];
|
|
2014
|
-
for (const n of e.
|
|
2094
|
+
for (const n of e.Ae) collectErrorSources(n, t);
|
|
2015
2095
|
for (const e of t) recompute(e);
|
|
2016
2096
|
schedule();
|
|
2017
2097
|
});
|
|
@@ -2066,13 +2146,14 @@ function flattenArray(e, t = [], n) {
|
|
|
2066
2146
|
if (r) throw r;
|
|
2067
2147
|
return i;
|
|
2068
2148
|
}
|
|
2069
|
-
exports.$PROXY =
|
|
2070
|
-
exports.$TARGET =
|
|
2071
|
-
exports.$TRACK =
|
|
2149
|
+
exports.$PROXY = Q;
|
|
2150
|
+
exports.$TARGET = H;
|
|
2151
|
+
exports.$TRACK = I;
|
|
2072
2152
|
exports.ContextNotFoundError = ContextNotFoundError;
|
|
2073
2153
|
exports.NoOwnerError = NoOwnerError;
|
|
2074
2154
|
exports.NotReadyError = NotReadyError;
|
|
2075
2155
|
exports.SUPPORTS_PROXY = y;
|
|
2156
|
+
exports.action = action;
|
|
2076
2157
|
exports.createBoundary = createBoundary;
|
|
2077
2158
|
exports.createContext = createContext;
|
|
2078
2159
|
exports.createEffect = createEffect;
|