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