@solidjs/signals 0.9.2 → 0.9.3
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 +135 -50
- package/dist/node.cjs +509 -426
- package/dist/prod.js +130 -45
- 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;
|
|
@@ -79,8 +80,8 @@ function deleteFromHeap(e, t) {
|
|
|
79
80
|
e.p = undefined;
|
|
80
81
|
}
|
|
81
82
|
function markHeap(e) {
|
|
82
|
-
if (e.
|
|
83
|
-
e.
|
|
83
|
+
if (e.O) return;
|
|
84
|
+
e.O = true;
|
|
84
85
|
for (let t = 0; t <= e._; t++) {
|
|
85
86
|
for (let n = e.l[t]; n !== undefined; n = n.p) {
|
|
86
87
|
if (n.S & i) markNode(n);
|
|
@@ -91,25 +92,25 @@ function markNode(e, r = n) {
|
|
|
91
92
|
const i = e.S;
|
|
92
93
|
if ((i & (t | n)) >= r) return;
|
|
93
94
|
e.S = (i & -4) | r;
|
|
94
|
-
for (let n = e.
|
|
95
|
+
for (let n = e.m; n !== null; n = n.C) {
|
|
95
96
|
markNode(n.N, t);
|
|
96
97
|
}
|
|
97
98
|
if (e.k !== null) {
|
|
98
99
|
for (let n = e.k; n !== null; n = n.j) {
|
|
99
|
-
for (let e = n.
|
|
100
|
+
for (let e = n.m; e !== null; e = e.C) {
|
|
100
101
|
markNode(e.N, t);
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
function runHeap(e, t) {
|
|
106
|
-
e.
|
|
107
|
-
for (e.
|
|
108
|
-
let n = e.l[e.
|
|
107
|
+
e.O = false;
|
|
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,29 +118,29 @@ 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;
|
|
124
125
|
}
|
|
125
126
|
if (e.o !== n) {
|
|
126
127
|
e.o = n;
|
|
127
|
-
for (let n = e.
|
|
128
|
+
for (let n = e.m; n !== null; n = n.C) {
|
|
128
129
|
insertIntoHeapHeight(n.N, t);
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
|
-
const
|
|
133
|
-
let
|
|
134
|
-
const
|
|
135
|
-
const
|
|
133
|
+
const _ = new Set();
|
|
134
|
+
let S = false;
|
|
135
|
+
const b = { l: new Array(2e3).fill(undefined), O: false, P: 0, _: 0 };
|
|
136
|
+
const O = { l: new Array(2e3).fill(undefined), O: false, P: 0, _: 0 };
|
|
136
137
|
let m = 0;
|
|
137
|
-
let
|
|
138
|
-
let
|
|
138
|
+
let x = null;
|
|
139
|
+
let C = false;
|
|
139
140
|
function schedule() {
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
-
if (!
|
|
141
|
+
if (C) return;
|
|
142
|
+
C = true;
|
|
143
|
+
if (!v.R) Promise.resolve().then(() => queueMicrotask(flush));
|
|
143
144
|
}
|
|
144
145
|
class Queue {
|
|
145
146
|
i = null;
|
|
@@ -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(O, GlobalQueue.D);
|
|
217
218
|
this.M = [];
|
|
218
|
-
this.stashQueues(
|
|
219
|
+
this.stashQueues(x.queueStash);
|
|
219
220
|
m++;
|
|
220
|
-
|
|
221
|
-
runTransitionPending(
|
|
222
|
-
|
|
221
|
+
C = 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(O, GlobalQueue.D);
|
|
232
234
|
runOptimistic();
|
|
233
235
|
m++;
|
|
234
|
-
|
|
236
|
+
C = 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
|
-
|
|
256
|
+
if (x && x.time === m) return;
|
|
257
|
+
if (!x) {
|
|
258
|
+
x = e?.G ?? {
|
|
257
259
|
time: m,
|
|
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 = m;
|
|
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
|
-
for (let t = e.
|
|
283
|
-
const e = t.N.S & o ?
|
|
284
|
-
if (e.
|
|
285
|
+
for (let t = e.m; t !== null; t = t.C) {
|
|
286
|
+
const e = t.N.S & o ? O : 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 =
|
|
291
|
-
|
|
293
|
+
const n = v.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,13 +301,13 @@ function runOptimistic(e = null) {
|
|
|
298
301
|
r.G = e;
|
|
299
302
|
notifySubs(r);
|
|
300
303
|
}
|
|
301
|
-
|
|
302
|
-
if (
|
|
304
|
+
v.T = [];
|
|
305
|
+
if (b._ >= b.P) {
|
|
303
306
|
t = true;
|
|
304
|
-
runHeap(
|
|
307
|
+
runHeap(b, GlobalQueue.D);
|
|
305
308
|
}
|
|
306
|
-
|
|
307
|
-
t && runPending(
|
|
309
|
+
S = false;
|
|
310
|
+
t && runPending(v.M);
|
|
308
311
|
}
|
|
309
312
|
function runPending(e) {
|
|
310
313
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -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,14 +325,14 @@ 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
|
-
const
|
|
332
|
+
const v = new GlobalQueue();
|
|
330
333
|
function flush() {
|
|
331
|
-
while (
|
|
332
|
-
|
|
334
|
+
while (C) {
|
|
335
|
+
v.flush();
|
|
333
336
|
}
|
|
334
337
|
}
|
|
335
338
|
function runQueue(e, t) {
|
|
@@ -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
|
+
v.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) v.initTransition(t);
|
|
401
|
+
deleteFromHeap(t, t.S & o ? O : b);
|
|
369
402
|
if (t.G) disposeChildren(t);
|
|
370
403
|
else {
|
|
371
404
|
markDisposal(t);
|
|
@@ -375,8 +408,8 @@ 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
415
|
t.se = m;
|
|
@@ -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
|
-
for (let e = t.
|
|
426
|
-
insertIntoHeapHeight(e.N, e.N.S & o ?
|
|
458
|
+
for (let e = t.m; e !== null; e = e.C) {
|
|
459
|
+
insertIntoHeapHeight(e.N, e.N.S & o ? O : b);
|
|
427
460
|
}
|
|
428
461
|
}
|
|
429
|
-
t.oe && !
|
|
430
|
-
(!n || t.$ & f) && !t.G &&
|
|
431
|
-
t.G && i && runInTransition(t, recompute);
|
|
462
|
+
t.oe && !S && v.T.push(t);
|
|
463
|
+
(!n || t.$ & f) && !t.G && v.M.push(t);
|
|
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;
|
|
@@ -442,12 +475,12 @@ function handleAsync(e, t, n) {
|
|
|
442
475
|
if (i) {
|
|
443
476
|
t.then(r => {
|
|
444
477
|
if (e.ce !== t) return;
|
|
445
|
-
|
|
478
|
+
v.initTransition(e);
|
|
446
479
|
n?.(r) ?? setSignal(e, () => r);
|
|
447
480
|
flush();
|
|
448
481
|
}).catch(n => {
|
|
449
482
|
if (e.ce !== t) return;
|
|
450
|
-
|
|
483
|
+
v.initTransition(e);
|
|
451
484
|
setStatusFlags(e, c, n);
|
|
452
485
|
e.se = m;
|
|
453
486
|
notifySubs(e);
|
|
@@ -459,13 +492,13 @@ function handleAsync(e, t, n) {
|
|
|
459
492
|
try {
|
|
460
493
|
for await (let r of t) {
|
|
461
494
|
if (e.ce !== t) return;
|
|
462
|
-
|
|
495
|
+
v.initTransition(e);
|
|
463
496
|
n?.(r) ?? setSignal(e, () => r);
|
|
464
497
|
flush();
|
|
465
498
|
}
|
|
466
499
|
} catch (n) {
|
|
467
500
|
if (e.ce !== t) return;
|
|
468
|
-
|
|
501
|
+
v.initTransition(e);
|
|
469
502
|
setStatusFlags(e, c, n);
|
|
470
503
|
e.se = m;
|
|
471
504
|
notifySubs(e);
|
|
@@ -474,12 +507,12 @@ function handleAsync(e, t, n) {
|
|
|
474
507
|
}
|
|
475
508
|
})();
|
|
476
509
|
}
|
|
477
|
-
|
|
478
|
-
throw new NotReadyError(
|
|
510
|
+
v.initTransition(e);
|
|
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,14 +530,14 @@ 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;
|
|
504
537
|
else t.de = i;
|
|
505
538
|
if (i !== null) i.C = r;
|
|
506
539
|
else {
|
|
507
|
-
t.
|
|
540
|
+
t.m = r;
|
|
508
541
|
if (r === null) {
|
|
509
542
|
t.he?.();
|
|
510
543
|
t.H && !t.pe && unobserved(t);
|
|
@@ -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 ? O : 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
|
-
else e.
|
|
575
|
+
else e.m = 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, O);
|
|
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 ? O : 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 ?? v,
|
|
671
|
+
Se: A?.Se ?? g,
|
|
639
672
|
ge: 0,
|
|
640
673
|
H: t,
|
|
641
674
|
L: n,
|
|
@@ -643,11 +676,11 @@ 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
|
+
m: null,
|
|
649
682
|
de: null,
|
|
650
|
-
i:
|
|
683
|
+
i: A,
|
|
651
684
|
ye: null,
|
|
652
685
|
re: null,
|
|
653
686
|
S: e,
|
|
@@ -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,12 +710,12 @@ 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,
|
|
684
717
|
L: e,
|
|
685
|
-
|
|
718
|
+
m: null,
|
|
686
719
|
de: null,
|
|
687
720
|
$: l,
|
|
688
721
|
se: m,
|
|
@@ -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 ? O.P : b.P)) {
|
|
719
752
|
markNode(t);
|
|
720
|
-
markHeap(r ?
|
|
753
|
+
markHeap(r ? O : b);
|
|
721
754
|
updateIfNecessary(n);
|
|
722
755
|
}
|
|
723
756
|
const i = n.o;
|
|
@@ -727,32 +760,33 @@ 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;
|
|
750
772
|
}
|
|
751
773
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
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);
|
|
780
|
+
}
|
|
781
|
+
const e = P;
|
|
782
|
+
P = null;
|
|
783
|
+
e.L = read(n.Y) || e.L;
|
|
784
|
+
P = e;
|
|
785
|
+
}
|
|
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) {
|
|
@@ -763,37 +797,37 @@ function read(e) {
|
|
|
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;
|
|
776
810
|
else {
|
|
777
|
-
if (e.U === p)
|
|
811
|
+
if (e.U === p) v.M.push(e);
|
|
778
812
|
e.U = t;
|
|
779
813
|
}
|
|
780
814
|
if (e.fe) setSignal(e.fe, t);
|
|
781
815
|
}
|
|
782
816
|
setStatusFlags(e, l);
|
|
783
817
|
e.se = m;
|
|
784
|
-
e.oe && !
|
|
818
|
+
e.oe && !S ? v.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,
|
|
@@ -812,7 +846,7 @@ function createOwner(e) {
|
|
|
812
846
|
ye: null,
|
|
813
847
|
te: null,
|
|
814
848
|
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
815
|
-
_e: t?._e ??
|
|
849
|
+
_e: t?._e ?? v,
|
|
816
850
|
Se: t?.Se || g,
|
|
817
851
|
ge: 0,
|
|
818
852
|
ee: null,
|
|
@@ -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 };
|
|
@@ -924,8 +962,8 @@ function effect(e, t, n, r, i) {
|
|
|
924
962
|
...i,
|
|
925
963
|
be: {
|
|
926
964
|
X: true,
|
|
927
|
-
|
|
928
|
-
|
|
965
|
+
Oe: r,
|
|
966
|
+
me: t,
|
|
929
967
|
xe: n,
|
|
930
968
|
Ce: undefined,
|
|
931
969
|
J: i?.render ? d : h,
|
|
@@ -969,11 +1007,11 @@ function runEffect() {
|
|
|
969
1007
|
this.Ce?.();
|
|
970
1008
|
this.Ce = undefined;
|
|
971
1009
|
try {
|
|
972
|
-
this.Ce = this.
|
|
1010
|
+
this.Ce = this.me(this.L, this.Oe);
|
|
973
1011
|
} catch (e) {
|
|
974
1012
|
if (!this._e.notify(this, c, c)) throw e;
|
|
975
1013
|
} finally {
|
|
976
|
-
this.
|
|
1014
|
+
this.Oe = this.L;
|
|
977
1015
|
this.X = false;
|
|
978
1016
|
}
|
|
979
1017
|
}
|
|
@@ -1063,16 +1101,16 @@ function onSettled(e) {
|
|
|
1063
1101
|
let t;
|
|
1064
1102
|
const n = getOwner();
|
|
1065
1103
|
if (n) onCleanup(() => t?.());
|
|
1066
|
-
|
|
1104
|
+
v.enqueue(h, () => {
|
|
1067
1105
|
t = e();
|
|
1068
1106
|
!n && t?.();
|
|
1069
1107
|
});
|
|
1070
1108
|
}
|
|
1071
1109
|
function unwrap(e) {
|
|
1072
|
-
return e?.[
|
|
1110
|
+
return e?.[H]?.[T] ?? e;
|
|
1073
1111
|
}
|
|
1074
1112
|
function getOverrideValue(e, t, n, r) {
|
|
1075
|
-
return
|
|
1113
|
+
return t && r in t ? t[r] : e[r];
|
|
1076
1114
|
}
|
|
1077
1115
|
function getAllKeys(e, t, n) {
|
|
1078
1116
|
const r = getKeys(e, t);
|
|
@@ -1080,15 +1118,15 @@ function getAllKeys(e, t, n) {
|
|
|
1080
1118
|
return Array.from(new Set([...r, ...i]));
|
|
1081
1119
|
}
|
|
1082
1120
|
function applyState(e, t, n, r) {
|
|
1083
|
-
const i = t?.[
|
|
1121
|
+
const i = t?.[H];
|
|
1084
1122
|
if (!i) return;
|
|
1085
|
-
const s = i[
|
|
1086
|
-
const o = i[
|
|
1087
|
-
let u = i[
|
|
1123
|
+
const s = i[q];
|
|
1124
|
+
const o = i[M];
|
|
1125
|
+
let u = i[T];
|
|
1088
1126
|
if (e === s && !o) return;
|
|
1089
|
-
(i[
|
|
1090
|
-
i[
|
|
1091
|
-
i[
|
|
1127
|
+
(i[K] || U).set(e, i[Q]);
|
|
1128
|
+
i[q] = e;
|
|
1129
|
+
i[M] = undefined;
|
|
1092
1130
|
if (Array.isArray(s)) {
|
|
1093
1131
|
let t = false;
|
|
1094
1132
|
const l = getOverrideValue(s, o, u, "length");
|
|
@@ -1115,16 +1153,16 @@ function applyState(e, t, n, r) {
|
|
|
1115
1153
|
if (a > h || a > d) {
|
|
1116
1154
|
for (c = a; c <= h; c++) {
|
|
1117
1155
|
t = true;
|
|
1118
|
-
i[
|
|
1156
|
+
i[T][c] && setSignal(i[T][c], wrap(e[c], i));
|
|
1119
1157
|
}
|
|
1120
1158
|
for (; c < e.length; c++) {
|
|
1121
1159
|
t = true;
|
|
1122
1160
|
const s = wrap(w[c], i);
|
|
1123
|
-
i[
|
|
1161
|
+
i[T][c] && setSignal(i[T][c], s);
|
|
1124
1162
|
applyState(e[c], s, n, r);
|
|
1125
1163
|
}
|
|
1126
|
-
t && i[
|
|
1127
|
-
l !== e.length && i[
|
|
1164
|
+
t && i[T][I] && setSignal(i[T][I], void 0);
|
|
1165
|
+
l !== e.length && i[T].length && setSignal(i[T].length, e.length);
|
|
1128
1166
|
return;
|
|
1129
1167
|
}
|
|
1130
1168
|
y = new Array(h + 1);
|
|
@@ -1148,26 +1186,26 @@ function applyState(e, t, n, r) {
|
|
|
1148
1186
|
for (c = a; c < e.length; c++) {
|
|
1149
1187
|
if (c in w) {
|
|
1150
1188
|
const t = wrap(w[c], i);
|
|
1151
|
-
i[
|
|
1189
|
+
i[T][c] && setSignal(i[T][c], t);
|
|
1152
1190
|
applyState(e[c], t, n, r);
|
|
1153
|
-
} else i[
|
|
1191
|
+
} else i[T][c] && setSignal(i[T][c], wrap(e[c], i));
|
|
1154
1192
|
}
|
|
1155
1193
|
if (a < e.length) t = true;
|
|
1156
|
-
} else if (
|
|
1194
|
+
} else if (e.length) {
|
|
1157
1195
|
for (let t = 0, l = e.length; t < l; t++) {
|
|
1158
1196
|
const l = getOverrideValue(s, o, u, t);
|
|
1159
|
-
isWrappable(l)
|
|
1197
|
+
isWrappable(l) ? applyState(e[t], wrap(l, i), n, r) : i[T][t] && setSignal(i[T][t], e[t]);
|
|
1160
1198
|
}
|
|
1161
1199
|
}
|
|
1162
1200
|
if (l !== e.length) {
|
|
1163
1201
|
t = true;
|
|
1164
|
-
i[
|
|
1202
|
+
i[T].length && setSignal(i[T].length, e.length);
|
|
1165
1203
|
}
|
|
1166
|
-
t && i[
|
|
1204
|
+
t && i[T][I] && setSignal(i[T][I], void 0);
|
|
1167
1205
|
return;
|
|
1168
1206
|
}
|
|
1169
1207
|
if (u) {
|
|
1170
|
-
const t = u[
|
|
1208
|
+
const t = u[I];
|
|
1171
1209
|
const l = t || r ? getAllKeys(s, o, e) : Object.keys(u);
|
|
1172
1210
|
for (let f = 0, c = l.length; f < c; f++) {
|
|
1173
1211
|
const c = l[f];
|
|
@@ -1181,7 +1219,7 @@ function applyState(e, t, n, r) {
|
|
|
1181
1219
|
} else applyState(h, wrap(d, i), n, r);
|
|
1182
1220
|
}
|
|
1183
1221
|
}
|
|
1184
|
-
if ((u = i[
|
|
1222
|
+
if ((u = i[D])) {
|
|
1185
1223
|
const t = Object.keys(u);
|
|
1186
1224
|
for (let n = 0, r = t.length; n < r; n++) {
|
|
1187
1225
|
const r = t[n];
|
|
@@ -1202,66 +1240,109 @@ function reconcile(e, t, n = false) {
|
|
|
1202
1240
|
function createProjectionInternal(e, t = {}, n) {
|
|
1203
1241
|
let r;
|
|
1204
1242
|
const i = new WeakMap();
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
[B]: i,
|
|
1211
|
-
[T]() {
|
|
1243
|
+
const wrapper = e => {
|
|
1244
|
+
e[B] = wrapProjection;
|
|
1245
|
+
e[K] = i;
|
|
1246
|
+
Object.defineProperty(e, G, {
|
|
1247
|
+
get() {
|
|
1212
1248
|
return r;
|
|
1213
|
-
}
|
|
1249
|
+
},
|
|
1250
|
+
configurable: true
|
|
1214
1251
|
});
|
|
1252
|
+
};
|
|
1253
|
+
const wrapProjection = e => {
|
|
1254
|
+
if (i.has(e)) return i.get(e);
|
|
1255
|
+
if (e[H]?.[B] === wrapProjection) return e;
|
|
1256
|
+
const t = createStoreProxy(e, J, wrapper);
|
|
1215
1257
|
i.set(e, t);
|
|
1216
1258
|
return t;
|
|
1217
1259
|
};
|
|
1218
1260
|
const s = wrapProjection(t);
|
|
1219
1261
|
r = computed(() => {
|
|
1220
1262
|
const t = r || getOwner();
|
|
1221
|
-
storeSetter(s,
|
|
1222
|
-
const
|
|
1223
|
-
e !==
|
|
1263
|
+
storeSetter(new Proxy(s, E), i => {
|
|
1264
|
+
const o = handleAsync(t, e(i), e => {
|
|
1265
|
+
e !== s && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
|
|
1266
|
+
setSignal(r, undefined);
|
|
1224
1267
|
});
|
|
1225
|
-
|
|
1268
|
+
o !== s && o !== undefined && reconcile(o, n?.key || "id", n?.all)(s);
|
|
1226
1269
|
});
|
|
1227
1270
|
});
|
|
1271
|
+
r.pe = true;
|
|
1228
1272
|
return { store: s, node: r };
|
|
1229
1273
|
}
|
|
1230
1274
|
function createProjection(e, t = {}, n) {
|
|
1231
1275
|
return createProjectionInternal(e, t, n).store;
|
|
1232
1276
|
}
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1235
|
-
|
|
1277
|
+
const E = {
|
|
1278
|
+
get(e, t) {
|
|
1279
|
+
let n;
|
|
1280
|
+
setWriteOverride(true);
|
|
1281
|
+
try {
|
|
1282
|
+
n = e[t];
|
|
1283
|
+
} finally {
|
|
1284
|
+
setWriteOverride(false);
|
|
1285
|
+
}
|
|
1286
|
+
return typeof n === "object" && n !== null ? new Proxy(n, E) : n;
|
|
1287
|
+
},
|
|
1288
|
+
set(e, t, n) {
|
|
1289
|
+
setWriteOverride(true);
|
|
1290
|
+
try {
|
|
1291
|
+
e[t] = n;
|
|
1292
|
+
} finally {
|
|
1293
|
+
setWriteOverride(false);
|
|
1294
|
+
}
|
|
1295
|
+
return true;
|
|
1296
|
+
},
|
|
1297
|
+
deleteProperty(e, t) {
|
|
1298
|
+
setWriteOverride(true);
|
|
1299
|
+
try {
|
|
1300
|
+
delete e[t];
|
|
1301
|
+
} finally {
|
|
1302
|
+
setWriteOverride(false);
|
|
1303
|
+
}
|
|
1304
|
+
return true;
|
|
1305
|
+
}
|
|
1306
|
+
};
|
|
1307
|
+
const I = Symbol(0),
|
|
1236
1308
|
F = Symbol(0),
|
|
1237
|
-
H = Symbol(0)
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
M = "
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1309
|
+
H = Symbol(0),
|
|
1310
|
+
Q = Symbol(0),
|
|
1311
|
+
R = Symbol(0);
|
|
1312
|
+
const V = new WeakMap();
|
|
1313
|
+
const q = "v",
|
|
1314
|
+
M = "o",
|
|
1315
|
+
T = "n",
|
|
1316
|
+
D = "h",
|
|
1317
|
+
B = "w",
|
|
1318
|
+
K = "l",
|
|
1319
|
+
G = "f";
|
|
1320
|
+
function createStoreProxy(e, t = J, n) {
|
|
1247
1321
|
let r;
|
|
1248
1322
|
if (Array.isArray(e)) {
|
|
1249
1323
|
r = [];
|
|
1250
1324
|
r.v = e;
|
|
1251
1325
|
} else r = { v: e };
|
|
1252
|
-
n &&
|
|
1253
|
-
return (r[
|
|
1326
|
+
n && n(r);
|
|
1327
|
+
return (r[Q] = new Proxy(r, t));
|
|
1254
1328
|
}
|
|
1255
|
-
const
|
|
1329
|
+
const U = new WeakMap();
|
|
1256
1330
|
function wrap(e, t) {
|
|
1257
|
-
if (t?.[
|
|
1258
|
-
let n = e[
|
|
1259
|
-
if (!n)
|
|
1331
|
+
if (t?.[B]) return t[B](e, t);
|
|
1332
|
+
let n = e[Q] || U.get(e);
|
|
1333
|
+
if (!n) U.set(e, (n = createStoreProxy(e)));
|
|
1260
1334
|
return n;
|
|
1261
1335
|
}
|
|
1262
1336
|
function isWrappable(e) {
|
|
1263
1337
|
return e != null && typeof e === "object" && !Object.isFrozen(e);
|
|
1264
1338
|
}
|
|
1339
|
+
let L = false;
|
|
1340
|
+
function setWriteOverride(e) {
|
|
1341
|
+
L = e;
|
|
1342
|
+
}
|
|
1343
|
+
function writeOnly(e) {
|
|
1344
|
+
return L || !!z?.has(e);
|
|
1345
|
+
}
|
|
1265
1346
|
function getNodes(e, t) {
|
|
1266
1347
|
let n = e[t];
|
|
1267
1348
|
if (!n) e[t] = n = Object.create(null);
|
|
@@ -1280,8 +1361,8 @@ function getNode(e, t, n, r, i = isEqual) {
|
|
|
1280
1361
|
r
|
|
1281
1362
|
));
|
|
1282
1363
|
}
|
|
1283
|
-
function trackSelf(e, t =
|
|
1284
|
-
getObserver() && read(getNode(getNodes(e,
|
|
1364
|
+
function trackSelf(e, t = I) {
|
|
1365
|
+
getObserver() && read(getNode(getNodes(e, T), t, undefined, e[G], false));
|
|
1285
1366
|
}
|
|
1286
1367
|
function getKeys(e, t, n = true) {
|
|
1287
1368
|
const r = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
|
|
@@ -1289,7 +1370,7 @@ function getKeys(e, t, n = true) {
|
|
|
1289
1370
|
const i = new Set(r);
|
|
1290
1371
|
const s = Reflect.ownKeys(t);
|
|
1291
1372
|
for (const e of s) {
|
|
1292
|
-
if (t[e] !==
|
|
1373
|
+
if (t[e] !== R) i.add(e);
|
|
1293
1374
|
else i.delete(e);
|
|
1294
1375
|
}
|
|
1295
1376
|
return Array.from(i);
|
|
@@ -1297,124 +1378,125 @@ function getKeys(e, t, n = true) {
|
|
|
1297
1378
|
function getPropertyDescriptor(e, t, n) {
|
|
1298
1379
|
let r = e;
|
|
1299
1380
|
if (t && n in t) {
|
|
1300
|
-
if (r[n] ===
|
|
1381
|
+
if (r[n] === R) return void 0;
|
|
1301
1382
|
if (!(n in r)) r = t;
|
|
1302
1383
|
}
|
|
1303
1384
|
return Reflect.getOwnPropertyDescriptor(r, n);
|
|
1304
1385
|
}
|
|
1305
|
-
let
|
|
1306
|
-
const
|
|
1386
|
+
let z = null;
|
|
1387
|
+
const J = {
|
|
1307
1388
|
get(e, t, n) {
|
|
1308
|
-
if (t ===
|
|
1309
|
-
if (t ===
|
|
1310
|
-
if (t ===
|
|
1389
|
+
if (t === H) return e;
|
|
1390
|
+
if (t === Q) return n;
|
|
1391
|
+
if (t === w) return e[G];
|
|
1392
|
+
if (t === I || t === F) {
|
|
1311
1393
|
trackSelf(e, t);
|
|
1312
1394
|
return n;
|
|
1313
1395
|
}
|
|
1314
|
-
const r = getNodes(e,
|
|
1396
|
+
const r = getNodes(e, T);
|
|
1315
1397
|
const i = r[t];
|
|
1316
|
-
const s = e[
|
|
1317
|
-
const o = !!e[
|
|
1318
|
-
const u = s ? e[
|
|
1398
|
+
const s = e[M] && t in e[M];
|
|
1399
|
+
const o = !!e[q][H];
|
|
1400
|
+
const u = s ? e[M] : e[q];
|
|
1319
1401
|
if (!i) {
|
|
1320
1402
|
const e = Object.getOwnPropertyDescriptor(u, t);
|
|
1321
1403
|
if (e && e.get) return e.get.call(n);
|
|
1322
1404
|
}
|
|
1323
|
-
if (
|
|
1405
|
+
if (writeOnly(n)) {
|
|
1324
1406
|
let n = i && (s || !o) ? (i.U !== p ? i.U : i.L) : u[t];
|
|
1325
|
-
n ===
|
|
1407
|
+
n === R && (n = undefined);
|
|
1326
1408
|
if (!isWrappable(n)) return n;
|
|
1327
1409
|
const r = wrap(n, e);
|
|
1328
|
-
|
|
1410
|
+
z?.add(r);
|
|
1329
1411
|
return r;
|
|
1330
1412
|
}
|
|
1331
1413
|
let l = i ? (s || !o ? read(r[t]) : (read(r[t]), u[t])) : u[t];
|
|
1332
|
-
l ===
|
|
1414
|
+
l === R && (l = undefined);
|
|
1333
1415
|
if (!i) {
|
|
1334
1416
|
if (!s && typeof l === "function" && !u.hasOwnProperty(t)) {
|
|
1335
1417
|
let t;
|
|
1336
|
-
return !Array.isArray(e[
|
|
1418
|
+
return !Array.isArray(e[q]) && (t = Object.getPrototypeOf(e[q])) && t !== Object.prototype
|
|
1337
1419
|
? l.bind(u)
|
|
1338
1420
|
: l;
|
|
1339
1421
|
} else if (getObserver()) {
|
|
1340
|
-
return read(getNode(r, t, isWrappable(l) ? wrap(l, e) : l, e[
|
|
1422
|
+
return read(getNode(r, t, isWrappable(l) ? wrap(l, e) : l, e[G]));
|
|
1341
1423
|
}
|
|
1342
1424
|
}
|
|
1343
1425
|
return isWrappable(l) ? wrap(l, e) : l;
|
|
1344
1426
|
},
|
|
1345
1427
|
has(e, t) {
|
|
1346
|
-
if (t ===
|
|
1347
|
-
const n = e[
|
|
1348
|
-
getObserver() && read(getNode(getNodes(e,
|
|
1428
|
+
if (t === Q || t === I || t === "__proto__") return true;
|
|
1429
|
+
const n = e[M] && t in e[M] ? e[M][t] !== R : t in e[q];
|
|
1430
|
+
getObserver() && read(getNode(getNodes(e, D), t, n, e[G]));
|
|
1349
1431
|
return n;
|
|
1350
1432
|
},
|
|
1351
1433
|
set(e, t, n) {
|
|
1352
|
-
const r = e[
|
|
1353
|
-
if (
|
|
1434
|
+
const r = e[Q];
|
|
1435
|
+
if (writeOnly(r)) {
|
|
1354
1436
|
untrack(() => {
|
|
1355
|
-
const i = e[
|
|
1437
|
+
const i = e[q];
|
|
1356
1438
|
const s = i[t];
|
|
1357
|
-
const o = e[
|
|
1358
|
-
const u = n?.[
|
|
1439
|
+
const o = e[M] && t in e[M] ? e[M][t] : s;
|
|
1440
|
+
const u = n?.[H]?.[q] ?? n;
|
|
1359
1441
|
if (o === u) return true;
|
|
1360
|
-
const l = e[
|
|
1361
|
-
if (u !== undefined && u === s) delete e[
|
|
1362
|
-
else (e[
|
|
1442
|
+
const l = e[M]?.length || i.length;
|
|
1443
|
+
if (u !== undefined && u === s) delete e[M][t];
|
|
1444
|
+
else (e[M] || (e[M] = Object.create(null)))[t] = u;
|
|
1363
1445
|
const f = isWrappable(u);
|
|
1364
1446
|
if (isWrappable(o)) {
|
|
1365
|
-
const e =
|
|
1366
|
-
e && (e instanceof Set ? e.delete(r) :
|
|
1447
|
+
const e = V.get(o);
|
|
1448
|
+
e && (e instanceof Set ? e.delete(r) : V.delete(o));
|
|
1367
1449
|
}
|
|
1368
|
-
if (recursivelyNotify(r,
|
|
1369
|
-
e[
|
|
1370
|
-
const c = getNodes(e,
|
|
1450
|
+
if (recursivelyNotify(r, U) && f) recursivelyAddParent(u, r);
|
|
1451
|
+
e[D]?.[t] && setSignal(e[D][t], true);
|
|
1452
|
+
const c = getNodes(e, T);
|
|
1371
1453
|
c[t] && setSignal(c[t], () => (f ? wrap(u, e) : u));
|
|
1372
1454
|
if (Array.isArray(i)) {
|
|
1373
1455
|
const e = parseInt(t) + 1;
|
|
1374
1456
|
if (e > l) c.length && setSignal(c.length, e);
|
|
1375
1457
|
}
|
|
1376
|
-
c[
|
|
1458
|
+
c[I] && setSignal(c[I], undefined);
|
|
1377
1459
|
});
|
|
1378
1460
|
}
|
|
1379
1461
|
return true;
|
|
1380
1462
|
},
|
|
1381
1463
|
deleteProperty(e, t) {
|
|
1382
|
-
if (
|
|
1464
|
+
if (writeOnly(e[Q]) && e[M]?.[t] !== R) {
|
|
1383
1465
|
untrack(() => {
|
|
1384
|
-
const n = e[
|
|
1385
|
-
if (t in e[
|
|
1386
|
-
(e[
|
|
1387
|
-
} else if (e[
|
|
1388
|
-
delete e[
|
|
1466
|
+
const n = e[M] && t in e[M] ? e[M][t] : e[q][t];
|
|
1467
|
+
if (t in e[q]) {
|
|
1468
|
+
(e[M] || (e[M] = Object.create(null)))[t] = R;
|
|
1469
|
+
} else if (e[M] && t in e[M]) {
|
|
1470
|
+
delete e[M][t];
|
|
1389
1471
|
} else return true;
|
|
1390
1472
|
if (isWrappable(n)) {
|
|
1391
|
-
const t =
|
|
1392
|
-
t && (t instanceof Set ? t.delete(e) :
|
|
1473
|
+
const t = V.get(n);
|
|
1474
|
+
t && (t instanceof Set ? t.delete(e) : V.delete(n));
|
|
1393
1475
|
}
|
|
1394
|
-
if (e[
|
|
1395
|
-
const r = getNodes(e,
|
|
1476
|
+
if (e[D]?.[t]) setSignal(e[D][t], false);
|
|
1477
|
+
const r = getNodes(e, T);
|
|
1396
1478
|
r[t] && setSignal(r[t], undefined);
|
|
1397
|
-
r[
|
|
1479
|
+
r[I] && setSignal(r[I], undefined);
|
|
1398
1480
|
});
|
|
1399
1481
|
}
|
|
1400
1482
|
return true;
|
|
1401
1483
|
},
|
|
1402
1484
|
ownKeys(e) {
|
|
1403
1485
|
trackSelf(e);
|
|
1404
|
-
return getKeys(e[
|
|
1486
|
+
return getKeys(e[q], e[M], false);
|
|
1405
1487
|
},
|
|
1406
1488
|
getOwnPropertyDescriptor(e, t) {
|
|
1407
|
-
if (t ===
|
|
1408
|
-
return getPropertyDescriptor(e[
|
|
1489
|
+
if (t === Q) return { value: e[Q], writable: true, configurable: true };
|
|
1490
|
+
return getPropertyDescriptor(e[q], e[M], t);
|
|
1409
1491
|
},
|
|
1410
1492
|
getPrototypeOf(e) {
|
|
1411
|
-
return Object.getPrototypeOf(e[
|
|
1493
|
+
return Object.getPrototypeOf(e[q]);
|
|
1412
1494
|
}
|
|
1413
1495
|
};
|
|
1414
1496
|
function storeSetter(e, t) {
|
|
1415
|
-
const n =
|
|
1416
|
-
|
|
1417
|
-
|
|
1497
|
+
const n = z;
|
|
1498
|
+
z = new Set();
|
|
1499
|
+
z.add(e);
|
|
1418
1500
|
try {
|
|
1419
1501
|
const n = t(e);
|
|
1420
1502
|
if (n !== e && n !== undefined) {
|
|
@@ -1430,8 +1512,8 @@ function storeSetter(e, t) {
|
|
|
1430
1512
|
}
|
|
1431
1513
|
}
|
|
1432
1514
|
} finally {
|
|
1433
|
-
|
|
1434
|
-
|
|
1515
|
+
z.clear();
|
|
1516
|
+
z = n;
|
|
1435
1517
|
}
|
|
1436
1518
|
}
|
|
1437
1519
|
function createStore(e, t, n) {
|
|
@@ -1440,17 +1522,17 @@ function createStore(e, t, n) {
|
|
|
1440
1522
|
return [i, e => storeSetter(i, e)];
|
|
1441
1523
|
}
|
|
1442
1524
|
function recursivelyNotify(e, t) {
|
|
1443
|
-
let n = e[
|
|
1525
|
+
let n = e[H] || t?.get(e)?.[H];
|
|
1444
1526
|
let r = false;
|
|
1445
1527
|
if (n) {
|
|
1446
|
-
const e = getNodes(n,
|
|
1528
|
+
const e = getNodes(n, T)[F];
|
|
1447
1529
|
if (e) {
|
|
1448
1530
|
setSignal(e, undefined);
|
|
1449
1531
|
r = true;
|
|
1450
1532
|
}
|
|
1451
|
-
t = n[
|
|
1533
|
+
t = n[K] || t;
|
|
1452
1534
|
}
|
|
1453
|
-
const i =
|
|
1535
|
+
const i = V.get(n?.[q] || e);
|
|
1454
1536
|
if (!i) return r;
|
|
1455
1537
|
if (i instanceof Set) {
|
|
1456
1538
|
for (let e of i) r = recursivelyNotify(e, t) || r;
|
|
@@ -1459,16 +1541,16 @@ function recursivelyNotify(e, t) {
|
|
|
1459
1541
|
}
|
|
1460
1542
|
function recursivelyAddParent(e, t) {
|
|
1461
1543
|
let n;
|
|
1462
|
-
const r = e[
|
|
1544
|
+
const r = e[H];
|
|
1463
1545
|
if (r) {
|
|
1464
|
-
n = r[
|
|
1465
|
-
e = r[
|
|
1546
|
+
n = r[M];
|
|
1547
|
+
e = r[q];
|
|
1466
1548
|
}
|
|
1467
1549
|
if (t) {
|
|
1468
|
-
let n =
|
|
1469
|
-
if (!n)
|
|
1550
|
+
let n = V.get(e);
|
|
1551
|
+
if (!n) V.set(e, t);
|
|
1470
1552
|
else if (n !== t) {
|
|
1471
|
-
if (!(n instanceof Set))
|
|
1553
|
+
if (!(n instanceof Set)) V.set(e, (n = new Set([n])));
|
|
1472
1554
|
else if (n.has(t)) return;
|
|
1473
1555
|
n.add(t);
|
|
1474
1556
|
} else return;
|
|
@@ -1490,7 +1572,7 @@ function recursivelyAddParent(e, t) {
|
|
|
1490
1572
|
}
|
|
1491
1573
|
function deep(e) {
|
|
1492
1574
|
recursivelyAddParent(e);
|
|
1493
|
-
return e[
|
|
1575
|
+
return e[F];
|
|
1494
1576
|
}
|
|
1495
1577
|
function createOptimisticStore(e, t, n) {
|
|
1496
1578
|
return [];
|
|
@@ -1500,12 +1582,12 @@ function snapshot(e, t, n) {
|
|
|
1500
1582
|
if (!isWrappable(e)) return e;
|
|
1501
1583
|
if (t && t.has(e)) return t.get(e);
|
|
1502
1584
|
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 =
|
|
1585
|
+
if ((r = e[H] || n?.get(e)?.[H])) {
|
|
1586
|
+
s = r[M];
|
|
1587
|
+
i = Array.isArray(r[q]);
|
|
1588
|
+
t.set(e, s ? (o = i ? [] : Object.create(Object.getPrototypeOf(r[q]))) : r[q]);
|
|
1589
|
+
e = r[q];
|
|
1590
|
+
n = U;
|
|
1509
1591
|
} else {
|
|
1510
1592
|
i = Array.isArray(e);
|
|
1511
1593
|
t.set(e, e);
|
|
@@ -1514,7 +1596,7 @@ function snapshot(e, t, n) {
|
|
|
1514
1596
|
const r = s?.length || e.length;
|
|
1515
1597
|
for (let i = 0; i < r; i++) {
|
|
1516
1598
|
l = s && i in s ? s[i] : e[i];
|
|
1517
|
-
if (l ===
|
|
1599
|
+
if (l === R) continue;
|
|
1518
1600
|
if ((u = snapshot(l, t, n)) !== l || o) {
|
|
1519
1601
|
if (!o) t.set(e, (o = [...e]));
|
|
1520
1602
|
o[i] = u;
|
|
@@ -1541,13 +1623,13 @@ function snapshot(e, t, n) {
|
|
|
1541
1623
|
function trueFn() {
|
|
1542
1624
|
return true;
|
|
1543
1625
|
}
|
|
1544
|
-
const
|
|
1626
|
+
const X = {
|
|
1545
1627
|
get(e, t, n) {
|
|
1546
|
-
if (t ===
|
|
1628
|
+
if (t === Q) return n;
|
|
1547
1629
|
return e.get(t);
|
|
1548
1630
|
},
|
|
1549
1631
|
has(e, t) {
|
|
1550
|
-
if (t ===
|
|
1632
|
+
if (t === Q) return true;
|
|
1551
1633
|
return e.has(t);
|
|
1552
1634
|
},
|
|
1553
1635
|
set: trueFn,
|
|
@@ -1570,15 +1652,15 @@ const L = {
|
|
|
1570
1652
|
function resolveSource(e) {
|
|
1571
1653
|
return !(e = typeof e === "function" ? e() : e) ? {} : e;
|
|
1572
1654
|
}
|
|
1573
|
-
const
|
|
1655
|
+
const Y = Symbol(0);
|
|
1574
1656
|
function merge(...e) {
|
|
1575
1657
|
if (e.length === 1 && typeof e[0] !== "function") return e[0];
|
|
1576
1658
|
let t = false;
|
|
1577
1659
|
const n = [];
|
|
1578
1660
|
for (let r = 0; r < e.length; r++) {
|
|
1579
1661
|
const i = e[r];
|
|
1580
|
-
t = t || (!!i &&
|
|
1581
|
-
const s = !!i && i[
|
|
1662
|
+
t = t || (!!i && Q in i);
|
|
1663
|
+
const s = !!i && i[Y];
|
|
1582
1664
|
if (s) n.push(...s);
|
|
1583
1665
|
else n.push(typeof i === "function" ? ((t = true), createMemo(i)) : i);
|
|
1584
1666
|
}
|
|
@@ -1586,7 +1668,7 @@ function merge(...e) {
|
|
|
1586
1668
|
return new Proxy(
|
|
1587
1669
|
{
|
|
1588
1670
|
get(e) {
|
|
1589
|
-
if (e ===
|
|
1671
|
+
if (e === Y) return n;
|
|
1590
1672
|
for (let t = n.length - 1; t >= 0; t--) {
|
|
1591
1673
|
const r = resolveSource(n[t]);
|
|
1592
1674
|
if (e in r) return r[e];
|
|
@@ -1604,7 +1686,7 @@ function merge(...e) {
|
|
|
1604
1686
|
return [...new Set(e)];
|
|
1605
1687
|
}
|
|
1606
1688
|
},
|
|
1607
|
-
|
|
1689
|
+
X
|
|
1608
1690
|
);
|
|
1609
1691
|
}
|
|
1610
1692
|
const r = Object.create(null);
|
|
@@ -1636,12 +1718,12 @@ function merge(...e) {
|
|
|
1636
1718
|
if (n.get) Object.defineProperty(o, t, n);
|
|
1637
1719
|
else o[t] = n.value;
|
|
1638
1720
|
}
|
|
1639
|
-
o[
|
|
1721
|
+
o[Y] = n;
|
|
1640
1722
|
return o;
|
|
1641
1723
|
}
|
|
1642
1724
|
function omit(e, ...t) {
|
|
1643
1725
|
const n = new Set(t);
|
|
1644
|
-
if (y &&
|
|
1726
|
+
if (y && Q in e) {
|
|
1645
1727
|
return new Proxy(
|
|
1646
1728
|
{
|
|
1647
1729
|
get(t) {
|
|
@@ -1654,7 +1736,7 @@ function omit(e, ...t) {
|
|
|
1654
1736
|
return Object.keys(e).filter(e => !n.has(e));
|
|
1655
1737
|
}
|
|
1656
1738
|
},
|
|
1657
|
-
|
|
1739
|
+
X
|
|
1658
1740
|
);
|
|
1659
1741
|
}
|
|
1660
1742
|
const r = {};
|
|
@@ -1672,33 +1754,33 @@ function mapArray(e, t, n) {
|
|
|
1672
1754
|
const r = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
1673
1755
|
return createMemo(
|
|
1674
1756
|
updateKeyedMap.bind({
|
|
1675
|
-
|
|
1676
|
-
|
|
1757
|
+
ve: createOwner(),
|
|
1758
|
+
Ne: 0,
|
|
1677
1759
|
ke: e,
|
|
1678
1760
|
je: [],
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1761
|
+
Pe: t,
|
|
1762
|
+
We: [],
|
|
1763
|
+
Ae: [],
|
|
1764
|
+
Ee: r,
|
|
1683
1765
|
Ie: r || n?.keyed === false ? [] : undefined,
|
|
1684
1766
|
Fe: t.length > 1 ? [] : undefined,
|
|
1685
1767
|
He: n?.fallback
|
|
1686
1768
|
})
|
|
1687
1769
|
);
|
|
1688
1770
|
}
|
|
1689
|
-
const
|
|
1771
|
+
const Z = { pureWrite: true };
|
|
1690
1772
|
function updateKeyedMap() {
|
|
1691
1773
|
const e = this.ke() || [],
|
|
1692
1774
|
t = e.length;
|
|
1693
|
-
e[
|
|
1694
|
-
runWithOwner(this.
|
|
1775
|
+
e[I];
|
|
1776
|
+
runWithOwner(this.ve, () => {
|
|
1695
1777
|
let n,
|
|
1696
1778
|
r,
|
|
1697
1779
|
i = this.Ie
|
|
1698
1780
|
? () => {
|
|
1699
|
-
this.Ie[r] = signal(e[r],
|
|
1700
|
-
this.Fe && (this.Fe[r] = signal(r,
|
|
1701
|
-
return this.
|
|
1781
|
+
this.Ie[r] = signal(e[r], Z);
|
|
1782
|
+
this.Fe && (this.Fe[r] = signal(r, Z));
|
|
1783
|
+
return this.Pe(
|
|
1702
1784
|
read.bind(null, this.Ie[r]),
|
|
1703
1785
|
this.Fe ? read.bind(null, this.Fe[r]) : undefined
|
|
1704
1786
|
);
|
|
@@ -1706,34 +1788,34 @@ function updateKeyedMap() {
|
|
|
1706
1788
|
: this.Fe
|
|
1707
1789
|
? () => {
|
|
1708
1790
|
const t = e[r];
|
|
1709
|
-
this.Fe[r] = signal(r,
|
|
1710
|
-
return this.
|
|
1791
|
+
this.Fe[r] = signal(r, Z);
|
|
1792
|
+
return this.Pe(() => t, read.bind(null, this.Fe[r]));
|
|
1711
1793
|
}
|
|
1712
1794
|
: () => {
|
|
1713
1795
|
const t = e[r];
|
|
1714
|
-
return this.
|
|
1796
|
+
return this.Pe(() => t);
|
|
1715
1797
|
};
|
|
1716
1798
|
if (t === 0) {
|
|
1717
|
-
if (this.
|
|
1718
|
-
this.
|
|
1719
|
-
this.
|
|
1799
|
+
if (this.Ne !== 0) {
|
|
1800
|
+
this.ve.dispose(false);
|
|
1801
|
+
this.Ae = [];
|
|
1720
1802
|
this.je = [];
|
|
1721
|
-
this.
|
|
1722
|
-
this.
|
|
1803
|
+
this.We = [];
|
|
1804
|
+
this.Ne = 0;
|
|
1723
1805
|
this.Ie && (this.Ie = []);
|
|
1724
1806
|
this.Fe && (this.Fe = []);
|
|
1725
1807
|
}
|
|
1726
|
-
if (this.He && !this.
|
|
1727
|
-
this.
|
|
1808
|
+
if (this.He && !this.We[0]) {
|
|
1809
|
+
this.We[0] = runWithOwner((this.Ae[0] = createOwner()), this.He);
|
|
1728
1810
|
}
|
|
1729
|
-
} else if (this.
|
|
1730
|
-
if (this.
|
|
1731
|
-
this.
|
|
1811
|
+
} else if (this.Ne === 0) {
|
|
1812
|
+
if (this.Ae[0]) this.Ae[0].dispose();
|
|
1813
|
+
this.We = new Array(t);
|
|
1732
1814
|
for (r = 0; r < t; r++) {
|
|
1733
1815
|
this.je[r] = e[r];
|
|
1734
|
-
this.
|
|
1816
|
+
this.We[r] = runWithOwner((this.Ae[r] = createOwner()), i);
|
|
1735
1817
|
}
|
|
1736
|
-
this.
|
|
1818
|
+
this.Ne = t;
|
|
1737
1819
|
} else {
|
|
1738
1820
|
let s,
|
|
1739
1821
|
o,
|
|
@@ -1747,21 +1829,21 @@ function updateKeyedMap() {
|
|
|
1747
1829
|
p = this.Ie ? new Array(t) : undefined,
|
|
1748
1830
|
y = this.Fe ? new Array(t) : undefined;
|
|
1749
1831
|
for (
|
|
1750
|
-
s = 0, o = Math.min(this.
|
|
1751
|
-
s < o && (this.je[s] === e[s] || (this.Ie && compare(this.
|
|
1832
|
+
s = 0, o = Math.min(this.Ne, t);
|
|
1833
|
+
s < o && (this.je[s] === e[s] || (this.Ie && compare(this.Ee, this.je[s], e[s])));
|
|
1752
1834
|
s++
|
|
1753
1835
|
) {
|
|
1754
1836
|
if (this.Ie) setSignal(this.Ie[s], e[s]);
|
|
1755
1837
|
}
|
|
1756
1838
|
for (
|
|
1757
|
-
o = this.
|
|
1839
|
+
o = this.Ne - 1, u = t - 1;
|
|
1758
1840
|
o >= s &&
|
|
1759
1841
|
u >= s &&
|
|
1760
|
-
(this.je[o] === e[u] || (this.Ie && compare(this.
|
|
1842
|
+
(this.je[o] === e[u] || (this.Ie && compare(this.Ee, this.je[o], e[u])));
|
|
1761
1843
|
o--, u--
|
|
1762
1844
|
) {
|
|
1763
|
-
d[u] = this.
|
|
1764
|
-
h[u] = this.
|
|
1845
|
+
d[u] = this.We[o];
|
|
1846
|
+
h[u] = this.Ae[o];
|
|
1765
1847
|
p && (p[u] = this.Ie[o]);
|
|
1766
1848
|
y && (y[u] = this.Fe[o]);
|
|
1767
1849
|
}
|
|
@@ -1769,28 +1851,28 @@ function updateKeyedMap() {
|
|
|
1769
1851
|
a = new Array(u + 1);
|
|
1770
1852
|
for (r = u; r >= s; r--) {
|
|
1771
1853
|
l = e[r];
|
|
1772
|
-
f = this.
|
|
1854
|
+
f = this.Ee ? this.Ee(l) : l;
|
|
1773
1855
|
n = c.get(f);
|
|
1774
1856
|
a[r] = n === undefined ? -1 : n;
|
|
1775
1857
|
c.set(f, r);
|
|
1776
1858
|
}
|
|
1777
1859
|
for (n = s; n <= o; n++) {
|
|
1778
1860
|
l = this.je[n];
|
|
1779
|
-
f = this.
|
|
1861
|
+
f = this.Ee ? this.Ee(l) : l;
|
|
1780
1862
|
r = c.get(f);
|
|
1781
1863
|
if (r !== undefined && r !== -1) {
|
|
1782
|
-
d[r] = this.
|
|
1783
|
-
h[r] = this.
|
|
1864
|
+
d[r] = this.We[n];
|
|
1865
|
+
h[r] = this.Ae[n];
|
|
1784
1866
|
p && (p[r] = this.Ie[n]);
|
|
1785
1867
|
y && (y[r] = this.Fe[n]);
|
|
1786
1868
|
r = a[r];
|
|
1787
1869
|
c.set(f, r);
|
|
1788
|
-
} else this.
|
|
1870
|
+
} else this.Ae[n].dispose();
|
|
1789
1871
|
}
|
|
1790
1872
|
for (r = s; r < t; r++) {
|
|
1791
1873
|
if (r in d) {
|
|
1792
|
-
this.
|
|
1793
|
-
this.
|
|
1874
|
+
this.We[r] = d[r];
|
|
1875
|
+
this.Ae[r] = h[r];
|
|
1794
1876
|
if (p) {
|
|
1795
1877
|
this.Ie[r] = p[r];
|
|
1796
1878
|
setSignal(this.Ie[r], e[r]);
|
|
@@ -1800,24 +1882,24 @@ function updateKeyedMap() {
|
|
|
1800
1882
|
setSignal(this.Fe[r], r);
|
|
1801
1883
|
}
|
|
1802
1884
|
} else {
|
|
1803
|
-
this.
|
|
1885
|
+
this.We[r] = runWithOwner((this.Ae[r] = createOwner()), i);
|
|
1804
1886
|
}
|
|
1805
1887
|
}
|
|
1806
|
-
this.
|
|
1888
|
+
this.We = this.We.slice(0, (this.Ne = t));
|
|
1807
1889
|
this.je = e.slice(0);
|
|
1808
1890
|
}
|
|
1809
1891
|
});
|
|
1810
|
-
return this.
|
|
1892
|
+
return this.We;
|
|
1811
1893
|
}
|
|
1812
1894
|
function repeat(e, t, n) {
|
|
1813
1895
|
return updateRepeat.bind({
|
|
1814
|
-
|
|
1815
|
-
|
|
1896
|
+
ve: createOwner(),
|
|
1897
|
+
Ne: 0,
|
|
1816
1898
|
Qe: 0,
|
|
1817
1899
|
Re: e,
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1900
|
+
Pe: t,
|
|
1901
|
+
Ae: [],
|
|
1902
|
+
We: [],
|
|
1821
1903
|
Ve: n?.from,
|
|
1822
1904
|
He: n?.fallback
|
|
1823
1905
|
});
|
|
@@ -1825,49 +1907,49 @@ function repeat(e, t, n) {
|
|
|
1825
1907
|
function updateRepeat() {
|
|
1826
1908
|
const e = this.Re();
|
|
1827
1909
|
const t = this.Ve?.() || 0;
|
|
1828
|
-
runWithOwner(this.
|
|
1910
|
+
runWithOwner(this.ve, () => {
|
|
1829
1911
|
if (e === 0) {
|
|
1830
|
-
if (this.
|
|
1831
|
-
this.
|
|
1832
|
-
this.
|
|
1833
|
-
this.
|
|
1834
|
-
this.
|
|
1912
|
+
if (this.Ne !== 0) {
|
|
1913
|
+
this.ve.dispose(false);
|
|
1914
|
+
this.Ae = [];
|
|
1915
|
+
this.We = [];
|
|
1916
|
+
this.Ne = 0;
|
|
1835
1917
|
}
|
|
1836
|
-
if (this.He && !this.
|
|
1837
|
-
this.
|
|
1918
|
+
if (this.He && !this.We[0]) {
|
|
1919
|
+
this.We[0] = runWithOwner((this.Ae[0] = createOwner()), this.He);
|
|
1838
1920
|
}
|
|
1839
1921
|
return;
|
|
1840
1922
|
}
|
|
1841
1923
|
const n = t + e;
|
|
1842
|
-
const r = this.Qe + this.
|
|
1843
|
-
if (this.
|
|
1844
|
-
for (let e = n; e < r; e++) this.
|
|
1924
|
+
const r = this.Qe + this.Ne;
|
|
1925
|
+
if (this.Ne === 0 && this.Ae[0]) this.Ae[0].dispose();
|
|
1926
|
+
for (let e = n; e < r; e++) this.Ae[e - this.Qe].dispose();
|
|
1845
1927
|
if (this.Qe < t) {
|
|
1846
1928
|
let e = this.Qe;
|
|
1847
|
-
while (e < t && e < this.
|
|
1848
|
-
this.
|
|
1849
|
-
this.
|
|
1929
|
+
while (e < t && e < this.Ne) this.Ae[e++].dispose();
|
|
1930
|
+
this.Ae.splice(0, t - this.Qe);
|
|
1931
|
+
this.We.splice(0, t - this.Qe);
|
|
1850
1932
|
} else if (this.Qe > t) {
|
|
1851
1933
|
let n = r - this.Qe - 1;
|
|
1852
1934
|
let i = this.Qe - t;
|
|
1853
|
-
this.
|
|
1935
|
+
this.Ae.length = this.We.length = e;
|
|
1854
1936
|
while (n >= i) {
|
|
1855
|
-
this.
|
|
1856
|
-
this.
|
|
1937
|
+
this.Ae[n] = this.Ae[n - i];
|
|
1938
|
+
this.We[n] = this.We[n - i];
|
|
1857
1939
|
n--;
|
|
1858
1940
|
}
|
|
1859
1941
|
for (let e = 0; e < i; e++) {
|
|
1860
|
-
this.
|
|
1942
|
+
this.We[e] = runWithOwner((this.Ae[e] = createOwner()), () => this.Pe(e + t));
|
|
1861
1943
|
}
|
|
1862
1944
|
}
|
|
1863
1945
|
for (let e = r; e < n; e++) {
|
|
1864
|
-
this.
|
|
1946
|
+
this.We[e - t] = runWithOwner((this.Ae[e - t] = createOwner()), () => this.Pe(e));
|
|
1865
1947
|
}
|
|
1866
|
-
this.
|
|
1948
|
+
this.We = this.We.slice(0, e);
|
|
1867
1949
|
this.Qe = t;
|
|
1868
|
-
this.
|
|
1950
|
+
this.Ne = e;
|
|
1869
1951
|
});
|
|
1870
|
-
return this.
|
|
1952
|
+
return this.We;
|
|
1871
1953
|
}
|
|
1872
1954
|
function compare(e, t, n) {
|
|
1873
1955
|
return e ? e(t) === e(n) : true;
|
|
@@ -1901,7 +1983,7 @@ function createBoundChildren(e, t, n, r) {
|
|
|
1901
1983
|
}
|
|
1902
1984
|
class ConditionalQueue extends Queue {
|
|
1903
1985
|
Me;
|
|
1904
|
-
|
|
1986
|
+
Te = new Set();
|
|
1905
1987
|
M = new Set();
|
|
1906
1988
|
constructor(e) {
|
|
1907
1989
|
super();
|
|
@@ -1921,57 +2003,57 @@ class ConditionalQueue extends Queue {
|
|
|
1921
2003
|
}
|
|
1922
2004
|
if (t & c) {
|
|
1923
2005
|
if (n & c) {
|
|
1924
|
-
this.
|
|
2006
|
+
this.Te.add(e);
|
|
1925
2007
|
t &= ~c;
|
|
1926
|
-
} else if (this.
|
|
2008
|
+
} else if (this.Te.delete(e)) t &= ~c;
|
|
1927
2009
|
}
|
|
1928
2010
|
}
|
|
1929
2011
|
return t ? super.notify(e, t, n) : true;
|
|
1930
2012
|
}
|
|
1931
2013
|
}
|
|
1932
2014
|
class CollectionQueue extends Queue {
|
|
1933
|
-
|
|
1934
|
-
|
|
2015
|
+
De;
|
|
2016
|
+
Ae = new Set();
|
|
1935
2017
|
Me = signal(false, { pureWrite: true });
|
|
1936
|
-
|
|
2018
|
+
Be = false;
|
|
1937
2019
|
constructor(e) {
|
|
1938
2020
|
super();
|
|
1939
|
-
this.
|
|
2021
|
+
this.De = e;
|
|
1940
2022
|
}
|
|
1941
2023
|
run(e) {
|
|
1942
2024
|
if (!e || read(this.Me)) return;
|
|
1943
2025
|
return super.run(e);
|
|
1944
2026
|
}
|
|
1945
2027
|
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.
|
|
2028
|
+
if (!(t & this.De) || (this.De & f && this.Be)) return super.notify(e, t, n);
|
|
2029
|
+
if (n & this.De) {
|
|
2030
|
+
this.Ae.add(e);
|
|
2031
|
+
if (this.Ae.size === 1) setSignal(this.Me, true);
|
|
2032
|
+
} else if (this.Ae.size > 0) {
|
|
2033
|
+
this.Ae.delete(e);
|
|
2034
|
+
if (this.Ae.size === 0) setSignal(this.Me, false);
|
|
2035
|
+
}
|
|
2036
|
+
t &= ~this.De;
|
|
1955
2037
|
return t ? super.notify(e, t, n) : true;
|
|
1956
2038
|
}
|
|
1957
2039
|
}
|
|
1958
|
-
var
|
|
2040
|
+
var $;
|
|
1959
2041
|
(function (e) {
|
|
1960
2042
|
e["VISIBLE"] = "visible";
|
|
1961
2043
|
e["HIDDEN"] = "hidden";
|
|
1962
|
-
})(
|
|
2044
|
+
})($ || ($ = {}));
|
|
1963
2045
|
function createBoundary(e, t) {
|
|
1964
2046
|
const n = createOwner();
|
|
1965
|
-
const r = new ConditionalQueue(computed(() => t() ===
|
|
2047
|
+
const r = new ConditionalQueue(computed(() => t() === $.HIDDEN));
|
|
1966
2048
|
const i = createBoundChildren(n, e, r, 0);
|
|
1967
2049
|
computed(() => {
|
|
1968
2050
|
const e = read(r.Me);
|
|
1969
2051
|
i.qe = e ? c | f : 0;
|
|
1970
2052
|
if (!e) {
|
|
1971
2053
|
r.M.forEach(e => r.notify(e, f, f));
|
|
1972
|
-
r.
|
|
2054
|
+
r.Te.forEach(e => r.notify(e, c, c));
|
|
1973
2055
|
r.M.clear();
|
|
1974
|
-
r.
|
|
2056
|
+
r.Te.clear();
|
|
1975
2057
|
}
|
|
1976
2058
|
});
|
|
1977
2059
|
return () => (read(r.Me) ? undefined : read(i));
|
|
@@ -1983,7 +2065,7 @@ function createCollectionBoundary(e, t, n) {
|
|
|
1983
2065
|
const o = computed(() => {
|
|
1984
2066
|
if (!read(i.Me)) {
|
|
1985
2067
|
const e = read(s);
|
|
1986
|
-
if (!untrack(() => read(i.Me))) i.
|
|
2068
|
+
if (!untrack(() => read(i.Me))) i.Be = true;
|
|
1987
2069
|
return e;
|
|
1988
2070
|
}
|
|
1989
2071
|
return n(i);
|
|
@@ -1995,23 +2077,23 @@ function createLoadBoundary(e, t) {
|
|
|
1995
2077
|
}
|
|
1996
2078
|
function collectErrorSources(e, t) {
|
|
1997
2079
|
let n = true;
|
|
1998
|
-
let r = e.
|
|
2080
|
+
let r = e.W;
|
|
1999
2081
|
while (r !== null) {
|
|
2000
2082
|
const e = r.I;
|
|
2001
|
-
if (e.
|
|
2083
|
+
if (e.W && e.$ & c) {
|
|
2002
2084
|
n = false;
|
|
2003
2085
|
collectErrorSources(e, t);
|
|
2004
2086
|
}
|
|
2005
|
-
r = r.
|
|
2087
|
+
r = r.A;
|
|
2006
2088
|
}
|
|
2007
2089
|
n && t.push(e);
|
|
2008
2090
|
}
|
|
2009
2091
|
function createErrorBoundary(e, t) {
|
|
2010
2092
|
return createCollectionBoundary(c, e, e => {
|
|
2011
|
-
let n = e.
|
|
2093
|
+
let n = e.Ae.values().next().value;
|
|
2012
2094
|
return t(n.K, () => {
|
|
2013
2095
|
const t = [];
|
|
2014
|
-
for (const n of e.
|
|
2096
|
+
for (const n of e.Ae) collectErrorSources(n, t);
|
|
2015
2097
|
for (const e of t) recompute(e);
|
|
2016
2098
|
schedule();
|
|
2017
2099
|
});
|
|
@@ -2066,13 +2148,14 @@ function flattenArray(e, t = [], n) {
|
|
|
2066
2148
|
if (r) throw r;
|
|
2067
2149
|
return i;
|
|
2068
2150
|
}
|
|
2069
|
-
exports.$PROXY =
|
|
2070
|
-
exports.$TARGET =
|
|
2071
|
-
exports.$TRACK =
|
|
2151
|
+
exports.$PROXY = Q;
|
|
2152
|
+
exports.$TARGET = H;
|
|
2153
|
+
exports.$TRACK = I;
|
|
2072
2154
|
exports.ContextNotFoundError = ContextNotFoundError;
|
|
2073
2155
|
exports.NoOwnerError = NoOwnerError;
|
|
2074
2156
|
exports.NotReadyError = NotReadyError;
|
|
2075
2157
|
exports.SUPPORTS_PROXY = y;
|
|
2158
|
+
exports.action = action;
|
|
2076
2159
|
exports.createBoundary = createBoundary;
|
|
2077
2160
|
exports.createContext = createContext;
|
|
2078
2161
|
exports.createEffect = createEffect;
|