@solidjs/signals 2.0.0-beta.16 → 2.0.0-beta.18
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/README.md +4 -3
- package/dist/dev.js +421 -106
- package/dist/node.cjs +1908 -1642
- package/dist/prod.js +1719 -1454
- package/dist/types/affects.d.ts +47 -0
- package/dist/types/boundaries.d.ts +2 -2
- package/dist/types/core/async.d.ts +39 -2
- package/dist/types/core/constants.d.ts +8 -0
- package/dist/types/core/core.d.ts +9 -0
- package/dist/types/core/dev.d.ts +1 -1
- package/dist/types/core/error.d.ts +2 -0
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/invariants.d.ts +10 -0
- package/dist/types/core/scheduler.d.ts +43 -0
- package/dist/types/core/types.d.ts +22 -5
- package/dist/types/index.d.ts +1 -0
- package/dist/types/store/store.d.ts +32 -14
- package/dist/types-cjs/affects.d.cts +47 -0
- package/dist/types-cjs/boundaries.d.cts +2 -2
- package/dist/types-cjs/core/async.d.cts +39 -2
- package/dist/types-cjs/core/constants.d.cts +8 -0
- package/dist/types-cjs/core/core.d.cts +9 -0
- package/dist/types-cjs/core/dev.d.cts +1 -1
- package/dist/types-cjs/core/error.d.cts +2 -0
- package/dist/types-cjs/core/index.d.cts +1 -1
- package/dist/types-cjs/core/invariants.d.cts +10 -0
- package/dist/types-cjs/core/scheduler.d.cts +43 -0
- package/dist/types-cjs/core/types.d.cts +22 -5
- package/dist/types-cjs/index.d.cts +1 -0
- package/dist/types-cjs/store/store.d.cts +32 -14
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -12,6 +12,9 @@ class StatusError extends Error {
|
|
|
12
12
|
this.source = e;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
function unwrapStatusError(e) {
|
|
16
|
+
return e instanceof StatusError ? e.cause : e;
|
|
17
|
+
}
|
|
15
18
|
class NoOwnerError extends Error {
|
|
16
19
|
constructor() {
|
|
17
20
|
super("");
|
|
@@ -34,6 +37,7 @@ const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
|
|
|
34
37
|
const REACTIVE_SNAPSHOT_STALE = 1 << 8;
|
|
35
38
|
const REACTIVE_LAZY = 1 << 9;
|
|
36
39
|
const REACTIVE_MANUAL_WRITE = 1 << 10;
|
|
40
|
+
const REACTIVE_REASK = 1 << 11;
|
|
37
41
|
const CONFIG_OWNED_WRITE = 1 << 0;
|
|
38
42
|
const CONFIG_NO_SNAPSHOT = 1 << 1;
|
|
39
43
|
const CONFIG_TRANSPARENT = 1 << 2;
|
|
@@ -110,7 +114,7 @@ function resolveTransition(e) {
|
|
|
110
114
|
return resolveLane(e)?.T ?? e.T;
|
|
111
115
|
}
|
|
112
116
|
function hasActiveOverride(e) {
|
|
113
|
-
return !!(e.
|
|
117
|
+
return !!(e.p !== undefined && e.p !== NOT_PENDING);
|
|
114
118
|
}
|
|
115
119
|
function assignOrMergeLane(e, t) {
|
|
116
120
|
const n = findLane(t);
|
|
@@ -134,8 +138,8 @@ function assignOrMergeLane(e, t) {
|
|
|
134
138
|
e.i = t;
|
|
135
139
|
}
|
|
136
140
|
const transitions = new Set();
|
|
137
|
-
const dirtyQueue = {
|
|
138
|
-
const zombieQueue = {
|
|
141
|
+
const dirtyQueue = { O: new Array(2e3).fill(undefined), R: false, I: 0, A: 0 };
|
|
142
|
+
const zombieQueue = { O: new Array(2e3).fill(undefined), R: false, I: 0, A: 0 };
|
|
139
143
|
let clock = 0;
|
|
140
144
|
let activeTransition = null;
|
|
141
145
|
let scheduled = false;
|
|
@@ -152,23 +156,25 @@ function canUseSimpleSyncFlush(e) {
|
|
|
152
156
|
return (
|
|
153
157
|
transitions.size === 0 &&
|
|
154
158
|
activeLanes.size === 0 &&
|
|
155
|
-
e.
|
|
159
|
+
e.h.length === 0 &&
|
|
156
160
|
e.N.length === 0 &&
|
|
157
|
-
e.C.
|
|
161
|
+
e.C.length === 0 &&
|
|
162
|
+
e.P.size === 0 &&
|
|
158
163
|
transientStoreNodes.size === 0
|
|
159
164
|
);
|
|
160
165
|
}
|
|
161
166
|
function sweepTransientStoreNodes() {
|
|
162
167
|
if (transientStoreNodes.size === 0) return;
|
|
163
168
|
for (const e of transientStoreNodes) {
|
|
164
|
-
if (e.
|
|
169
|
+
if (e.D !== null) {
|
|
165
170
|
transientStoreNodes.delete(e);
|
|
166
171
|
continue;
|
|
167
172
|
}
|
|
168
|
-
if (e.
|
|
169
|
-
if (e.
|
|
173
|
+
if (e.m !== NOT_PENDING) continue;
|
|
174
|
+
if (e.p !== undefined && e.p !== NOT_PENDING) continue;
|
|
175
|
+
if (e.L) continue;
|
|
170
176
|
transientStoreNodes.delete(e);
|
|
171
|
-
e.
|
|
177
|
+
e.V?.();
|
|
172
178
|
}
|
|
173
179
|
}
|
|
174
180
|
function enforceLoadingBoundary(e) {}
|
|
@@ -186,18 +192,18 @@ function runLaneEffects(e) {
|
|
|
186
192
|
}
|
|
187
193
|
}
|
|
188
194
|
function queueStashedOptimisticEffects(e) {
|
|
189
|
-
for (let t = e.
|
|
190
|
-
const e = t.
|
|
191
|
-
if (!e.
|
|
192
|
-
if (e.
|
|
193
|
-
if (!e.
|
|
194
|
-
e.
|
|
195
|
-
e.
|
|
195
|
+
for (let t = e.D; t !== null; t = t.U) {
|
|
196
|
+
const e = t.k;
|
|
197
|
+
if (!e.G) continue;
|
|
198
|
+
if (e.G === EFFECT_TRACKED) {
|
|
199
|
+
if (!e.F) {
|
|
200
|
+
e.F = true;
|
|
201
|
+
e.W.enqueue(EFFECT_USER, e.M);
|
|
196
202
|
}
|
|
197
203
|
continue;
|
|
198
204
|
}
|
|
199
|
-
const n = e.
|
|
200
|
-
if (n.I > e
|
|
205
|
+
const n = e.H & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
206
|
+
if (n.I > e.$) n.I = e.$;
|
|
201
207
|
insertIntoHeap(e, n);
|
|
202
208
|
}
|
|
203
209
|
}
|
|
@@ -205,34 +211,38 @@ function setProjectionWriteActive(e) {
|
|
|
205
211
|
projectionWriteActive = e;
|
|
206
212
|
}
|
|
207
213
|
function mergeTransitionState(e, t) {
|
|
208
|
-
t.
|
|
209
|
-
e.
|
|
214
|
+
t.j = e;
|
|
215
|
+
e.K.push(...t.K);
|
|
210
216
|
for (const n of activeLanes) if (n.T === t) n.T = e;
|
|
211
217
|
e.N.push(...t.N);
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
218
|
+
if (t.C.length) {
|
|
219
|
+
e.C.push(...t.C);
|
|
220
|
+
t.C.length = 0;
|
|
221
|
+
}
|
|
222
|
+
for (const n of t.P) e.P.add(n);
|
|
223
|
+
for (const [n, i] of t.Y) {
|
|
224
|
+
let t = e.Y.get(n);
|
|
225
|
+
if (!t) e.Y.set(n, (t = new Set()));
|
|
216
226
|
for (const e of i) t.add(e);
|
|
217
227
|
}
|
|
218
|
-
for (const n of t.
|
|
228
|
+
for (const n of t.Z) e.Z.add(n);
|
|
219
229
|
}
|
|
220
230
|
function resolveOptimisticNodes(e) {
|
|
221
231
|
const t = e.length;
|
|
222
232
|
for (let n = 0; n < t; n++) {
|
|
223
233
|
const t = e[n];
|
|
224
234
|
t.i = undefined;
|
|
225
|
-
if (!(t.
|
|
226
|
-
const i = t.
|
|
227
|
-
t.
|
|
228
|
-
if (i !== NOT_PENDING && t.
|
|
235
|
+
if (!(t.q & STATUS_PENDING)) t.q &= ~STATUS_UNINITIALIZED;
|
|
236
|
+
const i = t.p;
|
|
237
|
+
t.p = NOT_PENDING;
|
|
238
|
+
if (i !== NOT_PENDING && t.B !== i) insertSubs(t, true);
|
|
229
239
|
t.T = null;
|
|
230
240
|
}
|
|
231
241
|
for (let n = 0; n < t; n++) {
|
|
232
242
|
const t = e[n];
|
|
233
|
-
if (t.
|
|
243
|
+
if (t.X || t.J) snapCompanionsToState(t);
|
|
234
244
|
const i = t.t;
|
|
235
|
-
if (i && (i.
|
|
245
|
+
if (i && (i.X === t || i.J === t)) snapCompanionsToState(i);
|
|
236
246
|
}
|
|
237
247
|
e.splice(0, t);
|
|
238
248
|
}
|
|
@@ -259,7 +269,7 @@ function schedule() {
|
|
|
259
269
|
}
|
|
260
270
|
if (scheduled) return;
|
|
261
271
|
scheduled = true;
|
|
262
|
-
if (!syncDepth && !globalQueue.
|
|
272
|
+
if (!syncDepth && !globalQueue.ee && !projectionWriteActive) queueMicrotask(flush);
|
|
263
273
|
}
|
|
264
274
|
function haltReactivity() {
|
|
265
275
|
if (halted) return;
|
|
@@ -277,32 +287,32 @@ function resetErrorHalt() {
|
|
|
277
287
|
haltNotified = false;
|
|
278
288
|
}
|
|
279
289
|
class Queue {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
290
|
+
te = null;
|
|
291
|
+
ne = [[], []];
|
|
292
|
+
h = [];
|
|
283
293
|
created = clock;
|
|
284
294
|
addChild(e) {
|
|
285
|
-
this.
|
|
286
|
-
e.
|
|
295
|
+
this.h.push(e);
|
|
296
|
+
e.te = this;
|
|
287
297
|
}
|
|
288
298
|
removeChild(e) {
|
|
289
|
-
const t = this.
|
|
299
|
+
const t = this.h.indexOf(e);
|
|
290
300
|
if (t >= 0) {
|
|
291
|
-
this.
|
|
292
|
-
e.
|
|
301
|
+
this.h.splice(t, 1);
|
|
302
|
+
e.te = null;
|
|
293
303
|
}
|
|
294
304
|
}
|
|
295
305
|
notify(e, t, n, i) {
|
|
296
|
-
if (this.
|
|
306
|
+
if (this.te) return this.te.notify(e, t, n, i);
|
|
297
307
|
return false;
|
|
298
308
|
}
|
|
299
309
|
run(e) {
|
|
300
|
-
if (this.
|
|
301
|
-
const t = this.
|
|
302
|
-
this.
|
|
310
|
+
if (this.ne[e - 1].length) {
|
|
311
|
+
const t = this.ne[e - 1];
|
|
312
|
+
this.ne[e - 1] = [];
|
|
303
313
|
runQueue(t, e);
|
|
304
314
|
}
|
|
305
|
-
for (let t = 0; t < this.
|
|
315
|
+
for (let t = 0; t < this.h.length; t++) this.h[t].run?.(e);
|
|
306
316
|
}
|
|
307
317
|
enqueue(e, t) {
|
|
308
318
|
if (e) {
|
|
@@ -310,72 +320,77 @@ class Queue {
|
|
|
310
320
|
const n = findLane(currentOptimisticLane);
|
|
311
321
|
n.l[e - 1].push(t);
|
|
312
322
|
} else {
|
|
313
|
-
this.
|
|
323
|
+
this.ne[e - 1].push(t);
|
|
314
324
|
}
|
|
315
325
|
}
|
|
316
326
|
schedule();
|
|
317
327
|
}
|
|
318
328
|
stashQueues(e) {
|
|
319
|
-
e.
|
|
320
|
-
e.
|
|
321
|
-
this.
|
|
322
|
-
for (let t = 0; t < this.
|
|
323
|
-
let n = this.
|
|
324
|
-
let i = e.
|
|
329
|
+
e.ne[0].push(...this.ne[0]);
|
|
330
|
+
e.ne[1].push(...this.ne[1]);
|
|
331
|
+
this.ne = [[], []];
|
|
332
|
+
for (let t = 0; t < this.h.length; t++) {
|
|
333
|
+
let n = this.h[t];
|
|
334
|
+
let i = e.h[t];
|
|
325
335
|
if (!i) {
|
|
326
|
-
i = {
|
|
327
|
-
e.
|
|
336
|
+
i = { ne: [[], []], h: [] };
|
|
337
|
+
e.h[t] = i;
|
|
328
338
|
}
|
|
329
339
|
n.stashQueues(i);
|
|
330
340
|
}
|
|
331
341
|
}
|
|
332
342
|
restoreQueues(e) {
|
|
333
|
-
this.
|
|
334
|
-
this.
|
|
335
|
-
for (let t = 0; t < e.
|
|
336
|
-
const n = e.
|
|
337
|
-
let i = this.
|
|
343
|
+
this.ne[0].push(...e.ne[0]);
|
|
344
|
+
this.ne[1].push(...e.ne[1]);
|
|
345
|
+
for (let t = 0; t < e.h.length; t++) {
|
|
346
|
+
const n = e.h[t];
|
|
347
|
+
let i = this.h[t];
|
|
338
348
|
if (i) i.restoreQueues(n);
|
|
339
349
|
}
|
|
340
350
|
}
|
|
341
351
|
}
|
|
342
352
|
class GlobalQueue extends Queue {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
353
|
+
ee = false;
|
|
354
|
+
ie = null;
|
|
355
|
+
re = [];
|
|
346
356
|
N = [];
|
|
347
|
-
C =
|
|
348
|
-
|
|
349
|
-
static
|
|
357
|
+
C = [];
|
|
358
|
+
P = new Set();
|
|
359
|
+
static se;
|
|
350
360
|
static oe;
|
|
351
|
-
static
|
|
361
|
+
static ue;
|
|
362
|
+
static ce = null;
|
|
363
|
+
static ae = null;
|
|
364
|
+
static le = null;
|
|
365
|
+
static fe = null;
|
|
352
366
|
flush() {
|
|
353
|
-
if (this.
|
|
354
|
-
this.
|
|
367
|
+
if (this.ee) return;
|
|
368
|
+
this.ee = true;
|
|
355
369
|
try {
|
|
356
370
|
if (false);
|
|
357
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
371
|
+
runHeap(dirtyQueue, GlobalQueue.se);
|
|
358
372
|
if (activeTransition) {
|
|
359
373
|
const e = transitionComplete(activeTransition);
|
|
360
374
|
if (!e) {
|
|
361
375
|
const e = activeTransition;
|
|
362
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
363
|
-
this.
|
|
364
|
-
this.
|
|
376
|
+
runHeap(zombieQueue, GlobalQueue.se);
|
|
377
|
+
this.ie = null;
|
|
378
|
+
this.re = [];
|
|
365
379
|
this.N = [];
|
|
366
|
-
this.C =
|
|
380
|
+
this.C = [];
|
|
381
|
+
this.P = new Set();
|
|
367
382
|
runLaneEffects(EFFECT_RENDER);
|
|
368
383
|
runLaneEffects(EFFECT_USER);
|
|
369
|
-
this.stashQueues(e.
|
|
384
|
+
this.stashQueues(e.Ee);
|
|
370
385
|
clock++;
|
|
371
|
-
scheduled = dirtyQueue.
|
|
372
|
-
reassignPendingTransition(e.
|
|
386
|
+
scheduled = dirtyQueue.A >= dirtyQueue.I;
|
|
387
|
+
reassignPendingTransition(e.re);
|
|
373
388
|
activeTransition = null;
|
|
374
|
-
if (!e.
|
|
389
|
+
if (!e.K.length && !e.Y.size && e.N.length) {
|
|
375
390
|
stashedOptimisticReads = new Set();
|
|
376
391
|
for (let t = 0; t < e.N.length; t++) {
|
|
377
392
|
const n = e.N[t];
|
|
378
|
-
if (n.
|
|
393
|
+
if (n.de || n.Se & CONFIG_OWNED_WRITE) continue;
|
|
379
394
|
stashedOptimisticReads.add(n);
|
|
380
395
|
queueStashedOptimisticEffects(n);
|
|
381
396
|
}
|
|
@@ -387,27 +402,27 @@ class GlobalQueue extends Queue {
|
|
|
387
402
|
}
|
|
388
403
|
return;
|
|
389
404
|
}
|
|
390
|
-
this.
|
|
391
|
-
this.restoreQueues(activeTransition.
|
|
405
|
+
this.re !== activeTransition.re && this.re.push(...activeTransition.re);
|
|
406
|
+
this.restoreQueues(activeTransition.Ee);
|
|
392
407
|
transitions.delete(activeTransition);
|
|
393
408
|
const t = activeTransition;
|
|
394
409
|
activeTransition = null;
|
|
395
|
-
reassignPendingTransition(this.
|
|
410
|
+
reassignPendingTransition(this.re);
|
|
396
411
|
finalizePureQueue(t);
|
|
397
412
|
} else {
|
|
398
413
|
if (canUseSimpleSyncFlush(this)) {
|
|
399
414
|
commitPendingNodes();
|
|
400
|
-
if (dirtyQueue.
|
|
401
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
415
|
+
if (dirtyQueue.A >= dirtyQueue.I) {
|
|
416
|
+
runHeap(dirtyQueue, GlobalQueue.se);
|
|
402
417
|
commitPendingNodes();
|
|
403
418
|
}
|
|
404
419
|
} else {
|
|
405
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
420
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.se);
|
|
406
421
|
finalizePureQueue();
|
|
407
422
|
}
|
|
408
423
|
}
|
|
409
424
|
clock++;
|
|
410
|
-
scheduled = dirtyQueue.
|
|
425
|
+
scheduled = dirtyQueue.A >= dirtyQueue.I;
|
|
411
426
|
activeLanes.size && runLaneEffects(EFFECT_RENDER);
|
|
412
427
|
this.run(EFFECT_RENDER);
|
|
413
428
|
activeLanes.size && runLaneEffects(EFFECT_USER);
|
|
@@ -422,17 +437,17 @@ class GlobalQueue extends Queue {
|
|
|
422
437
|
);
|
|
423
438
|
if (false);
|
|
424
439
|
} finally {
|
|
425
|
-
this.
|
|
440
|
+
this.ee = false;
|
|
426
441
|
}
|
|
427
442
|
}
|
|
428
443
|
notify(e, t, n, i) {
|
|
429
444
|
if (t & STATUS_PENDING) {
|
|
430
445
|
if (n & STATUS_PENDING) {
|
|
431
|
-
const t = i !== undefined ? i : e.
|
|
446
|
+
const t = i !== undefined ? i : e.Te;
|
|
432
447
|
if (activeTransition && t) {
|
|
433
448
|
const n = t.source;
|
|
434
|
-
let i = activeTransition
|
|
435
|
-
if (!i) activeTransition
|
|
449
|
+
let i = activeTransition.Y.get(n);
|
|
450
|
+
if (!i) activeTransition.Y.set(n, (i = new Set()));
|
|
436
451
|
const r = i.size;
|
|
437
452
|
i.add(e);
|
|
438
453
|
if (i.size !== r) schedule();
|
|
@@ -445,18 +460,19 @@ class GlobalQueue extends Queue {
|
|
|
445
460
|
initTransition(e) {
|
|
446
461
|
if (e) e = currentTransition(e);
|
|
447
462
|
if (e && e === activeTransition) return;
|
|
448
|
-
if (!e && activeTransition && activeTransition.
|
|
463
|
+
if (!e && activeTransition && activeTransition._e === clock) return;
|
|
449
464
|
if (!activeTransition) {
|
|
450
465
|
activeTransition = e ?? {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
466
|
+
_e: clock,
|
|
467
|
+
re: [],
|
|
468
|
+
Y: new Map(),
|
|
454
469
|
N: [],
|
|
455
|
-
C:
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
470
|
+
C: [],
|
|
471
|
+
P: new Set(),
|
|
472
|
+
K: [],
|
|
473
|
+
Ee: { ne: [[], []], h: [] },
|
|
474
|
+
j: false,
|
|
475
|
+
Z: new Set()
|
|
460
476
|
};
|
|
461
477
|
} else if (e) {
|
|
462
478
|
const t = activeTransition;
|
|
@@ -465,19 +481,19 @@ class GlobalQueue extends Queue {
|
|
|
465
481
|
activeTransition = e;
|
|
466
482
|
}
|
|
467
483
|
transitions.add(activeTransition);
|
|
468
|
-
activeTransition.
|
|
469
|
-
if (this.
|
|
470
|
-
this.
|
|
471
|
-
activeTransition.
|
|
472
|
-
this.
|
|
473
|
-
}
|
|
474
|
-
if (this.
|
|
475
|
-
for (let e = 0; e < this.
|
|
476
|
-
const t = this.
|
|
484
|
+
activeTransition._e = clock;
|
|
485
|
+
if (this.ie !== null) {
|
|
486
|
+
this.ie.T = activeTransition;
|
|
487
|
+
activeTransition.re.push(this.ie);
|
|
488
|
+
this.ie = null;
|
|
489
|
+
}
|
|
490
|
+
if (this.re !== activeTransition.re) {
|
|
491
|
+
for (let e = 0; e < this.re.length; e++) {
|
|
492
|
+
const t = this.re[e];
|
|
477
493
|
t.T = activeTransition;
|
|
478
|
-
activeTransition.
|
|
494
|
+
activeTransition.re.push(t);
|
|
479
495
|
}
|
|
480
|
-
this.
|
|
496
|
+
this.re = activeTransition.re;
|
|
481
497
|
}
|
|
482
498
|
if (this.N !== activeTransition.N) {
|
|
483
499
|
for (let e = 0; e < this.N.length; e++) {
|
|
@@ -487,84 +503,94 @@ class GlobalQueue extends Queue {
|
|
|
487
503
|
}
|
|
488
504
|
this.N = activeTransition.N;
|
|
489
505
|
}
|
|
506
|
+
if (this.C !== activeTransition.C) {
|
|
507
|
+
activeTransition.C.push(...this.C);
|
|
508
|
+
this.C = activeTransition.C;
|
|
509
|
+
}
|
|
490
510
|
for (const e of activeLanes) {
|
|
491
511
|
if (!e.T) e.T = activeTransition;
|
|
492
512
|
}
|
|
493
|
-
if (this.
|
|
494
|
-
for (const e of this.
|
|
495
|
-
this.
|
|
513
|
+
if (this.P !== activeTransition.P) {
|
|
514
|
+
for (const e of this.P) activeTransition.P.add(e);
|
|
515
|
+
this.P = activeTransition.P;
|
|
496
516
|
}
|
|
497
517
|
}
|
|
498
518
|
}
|
|
499
519
|
function queuePendingNode(e) {
|
|
500
520
|
if (activeTransition) {
|
|
501
|
-
globalQueue.
|
|
521
|
+
globalQueue.re.push(e);
|
|
502
522
|
return;
|
|
503
523
|
}
|
|
504
|
-
if (globalQueue.
|
|
505
|
-
globalQueue.
|
|
524
|
+
if (globalQueue.ie === null && globalQueue.re.length === 0) {
|
|
525
|
+
globalQueue.ie = e;
|
|
506
526
|
return;
|
|
507
527
|
}
|
|
508
|
-
if (globalQueue.
|
|
509
|
-
globalQueue.
|
|
510
|
-
globalQueue.
|
|
528
|
+
if (globalQueue.ie !== null) {
|
|
529
|
+
globalQueue.re.push(globalQueue.ie);
|
|
530
|
+
globalQueue.ie = null;
|
|
511
531
|
}
|
|
512
|
-
globalQueue.
|
|
532
|
+
globalQueue.re.push(e);
|
|
533
|
+
}
|
|
534
|
+
let reaskArmed = false;
|
|
535
|
+
function armReaskClear() {
|
|
536
|
+
reaskArmed = true;
|
|
513
537
|
}
|
|
514
538
|
function insertSubs(e, t = false) {
|
|
515
539
|
const n = e.i || currentOptimisticLane;
|
|
516
|
-
const i = e.
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
540
|
+
const i = e.pe !== undefined;
|
|
541
|
+
const r = reaskArmed;
|
|
542
|
+
for (let s = e.D; s !== null; s = s.U) {
|
|
543
|
+
if (r) s.k.H &= ~REACTIVE_REASK;
|
|
544
|
+
if (i && s.k.Se & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
545
|
+
s.k.H |= REACTIVE_SNAPSHOT_STALE;
|
|
520
546
|
continue;
|
|
521
547
|
}
|
|
522
548
|
if (t && n) {
|
|
523
|
-
|
|
524
|
-
assignOrMergeLane(
|
|
549
|
+
s.k.H |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
550
|
+
assignOrMergeLane(s.k, n);
|
|
525
551
|
} else if (t) {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
const e =
|
|
530
|
-
if (e.
|
|
531
|
-
if (!e.
|
|
532
|
-
e.
|
|
533
|
-
e.
|
|
552
|
+
s.k.H |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
553
|
+
s.k.i = undefined;
|
|
554
|
+
}
|
|
555
|
+
const e = s.k;
|
|
556
|
+
if (e.G === EFFECT_TRACKED) {
|
|
557
|
+
if (!e.F) {
|
|
558
|
+
e.F = true;
|
|
559
|
+
e.W.enqueue(EFFECT_USER, e.M);
|
|
534
560
|
}
|
|
535
561
|
continue;
|
|
536
562
|
}
|
|
537
|
-
const o =
|
|
538
|
-
if (o.I >
|
|
539
|
-
insertIntoHeap(
|
|
563
|
+
const o = s.k.H & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
564
|
+
if (o.I > s.k.$) o.I = s.k.$;
|
|
565
|
+
insertIntoHeap(s.k, o);
|
|
540
566
|
}
|
|
541
567
|
}
|
|
542
568
|
function commitPendingNode(e) {
|
|
543
569
|
const t = e;
|
|
544
|
-
if (!t.
|
|
545
|
-
if (e.
|
|
546
|
-
e.
|
|
547
|
-
e.
|
|
570
|
+
if (!t.de) {
|
|
571
|
+
if (e.m !== NOT_PENDING) {
|
|
572
|
+
e.B = e.m;
|
|
573
|
+
e.m = NOT_PENDING;
|
|
548
574
|
}
|
|
549
|
-
if (e.
|
|
575
|
+
if (e.X || e.J) snapCompanionsToState(e);
|
|
550
576
|
return;
|
|
551
577
|
}
|
|
552
|
-
if (e.
|
|
553
|
-
e.
|
|
554
|
-
e.
|
|
555
|
-
if (e.
|
|
578
|
+
if (e.m !== NOT_PENDING) {
|
|
579
|
+
e.B = e.m;
|
|
580
|
+
e.m = NOT_PENDING;
|
|
581
|
+
if (e.G && e.G !== EFFECT_TRACKED) e.F = true;
|
|
556
582
|
}
|
|
557
|
-
t.
|
|
558
|
-
if (!(t.
|
|
559
|
-
if (t.
|
|
560
|
-
if (e.
|
|
583
|
+
t.H &= ~REACTIVE_MANUAL_WRITE;
|
|
584
|
+
if (!(t.q & STATUS_PENDING)) t.q &= ~STATUS_UNINITIALIZED;
|
|
585
|
+
if (t.Oe !== null || t.Re !== null) GlobalQueue.oe(t, false, true);
|
|
586
|
+
if (e.X || e.J) snapCompanionsToState(e);
|
|
561
587
|
}
|
|
562
588
|
function commitPendingNodes() {
|
|
563
|
-
if (globalQueue.
|
|
564
|
-
commitPendingNode(globalQueue.
|
|
565
|
-
globalQueue.
|
|
589
|
+
if (globalQueue.ie !== null) {
|
|
590
|
+
commitPendingNode(globalQueue.ie);
|
|
591
|
+
globalQueue.ie = null;
|
|
566
592
|
}
|
|
567
|
-
const e = globalQueue.
|
|
593
|
+
const e = globalQueue.re;
|
|
568
594
|
for (let t = 0; t < e.length; t++) {
|
|
569
595
|
commitPendingNode(e[t]);
|
|
570
596
|
}
|
|
@@ -573,32 +599,33 @@ function commitPendingNodes() {
|
|
|
573
599
|
function finalizePureQueue(e = null, t = false) {
|
|
574
600
|
const n = !t;
|
|
575
601
|
if (n) commitPendingNodes();
|
|
576
|
-
if (!t && globalQueue.
|
|
577
|
-
const i = dirtyQueue.
|
|
578
|
-
if (i) runHeap(dirtyQueue, GlobalQueue.
|
|
602
|
+
if (!t && globalQueue.h.length) checkBoundaryChildren(globalQueue);
|
|
603
|
+
const i = dirtyQueue.A >= dirtyQueue.I;
|
|
604
|
+
if (i) runHeap(dirtyQueue, GlobalQueue.se);
|
|
579
605
|
if (n) {
|
|
580
606
|
if (i) commitPendingNodes();
|
|
581
607
|
resolveOptimisticNodes(e ? e.N : globalQueue.N);
|
|
582
|
-
if (e && e.
|
|
583
|
-
for (const t of e.
|
|
584
|
-
if (t.
|
|
585
|
-
if (t.
|
|
586
|
-
if (!t.
|
|
587
|
-
t.
|
|
588
|
-
t.
|
|
608
|
+
if (e && e.Z.size) {
|
|
609
|
+
for (const t of e.Z) {
|
|
610
|
+
if (t.H & REACTIVE_DISPOSED) continue;
|
|
611
|
+
if (t.G === EFFECT_TRACKED) {
|
|
612
|
+
if (!t.F) {
|
|
613
|
+
t.F = true;
|
|
614
|
+
t.W.enqueue(EFFECT_USER, t.M);
|
|
589
615
|
}
|
|
590
616
|
continue;
|
|
591
617
|
}
|
|
592
|
-
const e = t.
|
|
593
|
-
if (e.I > t
|
|
618
|
+
const e = t.H & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
619
|
+
if (e.I > t.$) e.I = t.$;
|
|
594
620
|
insertIntoHeap(t, e);
|
|
595
621
|
}
|
|
596
|
-
e.
|
|
622
|
+
e.Z.clear();
|
|
597
623
|
}
|
|
598
|
-
|
|
599
|
-
|
|
624
|
+
releaseAffectsMarks(e ? e.C : globalQueue.C);
|
|
625
|
+
const t = e ? e.P : globalQueue.P;
|
|
626
|
+
if (GlobalQueue.ce && t.size) {
|
|
600
627
|
for (const e of t) {
|
|
601
|
-
GlobalQueue.
|
|
628
|
+
GlobalQueue.ce(e);
|
|
602
629
|
}
|
|
603
630
|
t.clear();
|
|
604
631
|
schedule();
|
|
@@ -608,15 +635,41 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
608
635
|
}
|
|
609
636
|
}
|
|
610
637
|
function checkBoundaryChildren(e) {
|
|
611
|
-
for (const t of e.
|
|
638
|
+
for (const t of e.h) {
|
|
612
639
|
t.checkSources?.();
|
|
613
640
|
checkBoundaryChildren(t);
|
|
614
641
|
}
|
|
615
642
|
}
|
|
616
643
|
function trackOptimisticStore(e) {
|
|
617
|
-
globalQueue.
|
|
644
|
+
globalQueue.P.add(e);
|
|
645
|
+
schedule();
|
|
646
|
+
}
|
|
647
|
+
let activeAffectsMarks = 0;
|
|
648
|
+
function markAffects(e) {
|
|
649
|
+
e.L = (e.L || 0) + 1;
|
|
650
|
+
activeAffectsMarks++;
|
|
651
|
+
if (e.L === 1) updatePendingSignal(e);
|
|
652
|
+
}
|
|
653
|
+
function registerAffectsMark(e) {
|
|
654
|
+
markAffects(e);
|
|
655
|
+
globalQueue.C.push(e);
|
|
656
|
+
GlobalQueue.le?.(e);
|
|
618
657
|
schedule();
|
|
619
658
|
}
|
|
659
|
+
function releaseAffectsMark(e) {
|
|
660
|
+
activeAffectsMarks--;
|
|
661
|
+
e.L--;
|
|
662
|
+
if (!e.L) {
|
|
663
|
+
GlobalQueue.fe?.(e);
|
|
664
|
+
snapCompanionsToState(e);
|
|
665
|
+
GlobalQueue.ae?.(e);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
function releaseAffectsMarks(e) {
|
|
669
|
+
if (!e.length) return;
|
|
670
|
+
for (let t = 0; t < e.length; t++) releaseAffectsMark(e[t]);
|
|
671
|
+
e.length = 0;
|
|
672
|
+
}
|
|
620
673
|
function reassignPendingTransition(e) {
|
|
621
674
|
for (let t = 0; t < e.length; t++) {
|
|
622
675
|
e[t].T = activeTransition;
|
|
@@ -636,7 +689,7 @@ function flush(e) {
|
|
|
636
689
|
}
|
|
637
690
|
}
|
|
638
691
|
}
|
|
639
|
-
if (globalQueue.
|
|
692
|
+
if (globalQueue.ee) {
|
|
640
693
|
return;
|
|
641
694
|
}
|
|
642
695
|
if (halted) return;
|
|
@@ -648,22 +701,22 @@ function runQueue(e, t) {
|
|
|
648
701
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
649
702
|
}
|
|
650
703
|
function reporterBlocksSource(e, t) {
|
|
651
|
-
if (e.
|
|
652
|
-
if (e.
|
|
653
|
-
for (let n = e.
|
|
654
|
-
let e = n.
|
|
704
|
+
if (e.H & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
|
|
705
|
+
if (e.Ie === t || e.Ae?.has(t)) return true;
|
|
706
|
+
for (let n = e.he; n; n = n.Ne) {
|
|
707
|
+
let e = n.Ce;
|
|
655
708
|
while (e) {
|
|
656
|
-
if (e === t || e.
|
|
709
|
+
if (e === t || e.ye === t) return true;
|
|
657
710
|
e = e.t;
|
|
658
711
|
}
|
|
659
712
|
}
|
|
660
|
-
return !!(e.
|
|
713
|
+
return !!(e.q & STATUS_PENDING && e.Te instanceof NotReadyError && e.Te.source === t);
|
|
661
714
|
}
|
|
662
715
|
function transitionComplete(e) {
|
|
663
|
-
if (e.
|
|
664
|
-
if (e.
|
|
716
|
+
if (e.j) return true;
|
|
717
|
+
if (e.K.length) return false;
|
|
665
718
|
let t = true;
|
|
666
|
-
for (const [n, i] of e
|
|
719
|
+
for (const [n, i] of e.Y) {
|
|
667
720
|
let r = false;
|
|
668
721
|
for (const e of i) {
|
|
669
722
|
if (reporterBlocksSource(e, n)) {
|
|
@@ -672,8 +725,8 @@ function transitionComplete(e) {
|
|
|
672
725
|
}
|
|
673
726
|
i.delete(e);
|
|
674
727
|
}
|
|
675
|
-
if (!r) e
|
|
676
|
-
else if (n.
|
|
728
|
+
if (!r) e.Y.delete(n);
|
|
729
|
+
else if (n.q & STATUS_PENDING && n.Te?.source === n) {
|
|
677
730
|
t = false;
|
|
678
731
|
break;
|
|
679
732
|
}
|
|
@@ -683,20 +736,21 @@ function transitionComplete(e) {
|
|
|
683
736
|
const i = e.N[n];
|
|
684
737
|
if (
|
|
685
738
|
hasActiveOverride(i) &&
|
|
686
|
-
"
|
|
687
|
-
i.
|
|
688
|
-
i.
|
|
739
|
+
"q" in i &&
|
|
740
|
+
i.q & STATUS_PENDING &&
|
|
741
|
+
i.Te instanceof NotReadyError &&
|
|
742
|
+
!i.Te.source?.ge
|
|
689
743
|
) {
|
|
690
744
|
t = false;
|
|
691
745
|
break;
|
|
692
746
|
}
|
|
693
747
|
}
|
|
694
748
|
}
|
|
695
|
-
t && (e.
|
|
749
|
+
t && (e.j = true);
|
|
696
750
|
return t;
|
|
697
751
|
}
|
|
698
752
|
function currentTransition(e) {
|
|
699
|
-
while (e.
|
|
753
|
+
while (e.j && typeof e.j === "object") e = e.j;
|
|
700
754
|
return e;
|
|
701
755
|
}
|
|
702
756
|
function setActiveTransition(e) {
|
|
@@ -712,177 +766,177 @@ function runInTransition(e, t) {
|
|
|
712
766
|
}
|
|
713
767
|
}
|
|
714
768
|
function actualInsertIntoHeap(e, t) {
|
|
715
|
-
const n = (e.
|
|
716
|
-
if (n >= e
|
|
717
|
-
const i = e
|
|
718
|
-
const r = t.
|
|
719
|
-
if (r === undefined) t.
|
|
769
|
+
const n = (e.te?.Pe ? e.te.De?.$ : e.te?.$) ?? -1;
|
|
770
|
+
if (n >= e.$) e.$ = n + 1;
|
|
771
|
+
const i = e.$;
|
|
772
|
+
const r = t.O[i];
|
|
773
|
+
if (r === undefined) t.O[i] = e;
|
|
720
774
|
else {
|
|
721
|
-
const t = r.
|
|
722
|
-
t.
|
|
723
|
-
e.
|
|
724
|
-
r.
|
|
775
|
+
const t = r.be;
|
|
776
|
+
t.me = e;
|
|
777
|
+
e.be = t;
|
|
778
|
+
r.be = e;
|
|
725
779
|
}
|
|
726
|
-
if (i > t.
|
|
780
|
+
if (i > t.A) t.A = i;
|
|
727
781
|
}
|
|
728
782
|
function insertIntoHeap(e, t) {
|
|
729
|
-
let n = e.
|
|
783
|
+
let n = e.H;
|
|
730
784
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_MANUAL_WRITE)) return;
|
|
731
785
|
if (n & REACTIVE_CHECK) {
|
|
732
|
-
e.
|
|
733
|
-
} else e.
|
|
786
|
+
e.H = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
787
|
+
} else e.H = n | REACTIVE_IN_HEAP;
|
|
734
788
|
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
735
789
|
}
|
|
736
790
|
function insertIntoHeapHeight(e, t) {
|
|
737
|
-
let n = e.
|
|
791
|
+
let n = e.H;
|
|
738
792
|
if (
|
|
739
793
|
n &
|
|
740
794
|
(REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT | REACTIVE_MANUAL_WRITE)
|
|
741
795
|
)
|
|
742
796
|
return;
|
|
743
|
-
e.
|
|
797
|
+
e.H = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
744
798
|
actualInsertIntoHeap(e, t);
|
|
745
799
|
}
|
|
746
800
|
function deleteFromHeap(e, t) {
|
|
747
|
-
const n = e.
|
|
801
|
+
const n = e.H;
|
|
748
802
|
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
749
|
-
e.
|
|
750
|
-
const i = e
|
|
751
|
-
if (e.
|
|
803
|
+
e.H = n & -25;
|
|
804
|
+
const i = e.$;
|
|
805
|
+
if (e.be === e) t.O[i] = undefined;
|
|
752
806
|
else {
|
|
753
|
-
const n = e.
|
|
754
|
-
const r = t.
|
|
755
|
-
const
|
|
756
|
-
if (e === r) t.
|
|
757
|
-
else e.
|
|
758
|
-
|
|
807
|
+
const n = e.me;
|
|
808
|
+
const r = t.O[i];
|
|
809
|
+
const s = n ?? r;
|
|
810
|
+
if (e === r) t.O[i] = n;
|
|
811
|
+
else e.be.me = n;
|
|
812
|
+
s.be = e.be;
|
|
759
813
|
}
|
|
760
|
-
e.
|
|
761
|
-
e.
|
|
814
|
+
e.be = e;
|
|
815
|
+
e.me = undefined;
|
|
762
816
|
}
|
|
763
817
|
function markHeap(e) {
|
|
764
818
|
if (e.R) return;
|
|
765
819
|
e.R = true;
|
|
766
|
-
for (let t = 0; t <= e.
|
|
767
|
-
for (let n = e.
|
|
768
|
-
if (n.
|
|
820
|
+
for (let t = 0; t <= e.A; t++) {
|
|
821
|
+
for (let n = e.O[t]; n !== undefined; n = n.me) {
|
|
822
|
+
if (n.H & REACTIVE_IN_HEAP) markNode(n);
|
|
769
823
|
}
|
|
770
824
|
}
|
|
771
825
|
}
|
|
772
826
|
function markNode(e, t = REACTIVE_DIRTY) {
|
|
773
|
-
const n = e.
|
|
827
|
+
const n = e.H;
|
|
774
828
|
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
775
|
-
e.
|
|
776
|
-
for (let t = e.
|
|
777
|
-
markNode(t.
|
|
778
|
-
}
|
|
779
|
-
if (e.
|
|
780
|
-
for (let t = e.
|
|
781
|
-
for (let e = t.
|
|
782
|
-
markNode(e.
|
|
829
|
+
e.H = (n & -4) | t;
|
|
830
|
+
for (let t = e.D; t !== null; t = t.U) {
|
|
831
|
+
markNode(t.k, REACTIVE_CHECK);
|
|
832
|
+
}
|
|
833
|
+
if (e.ve !== null) {
|
|
834
|
+
for (let t = e.ve; t !== null; t = t.we) {
|
|
835
|
+
for (let e = t.D; e !== null; e = e.U) {
|
|
836
|
+
markNode(e.k, REACTIVE_CHECK);
|
|
783
837
|
}
|
|
784
838
|
}
|
|
785
839
|
}
|
|
786
840
|
}
|
|
787
841
|
function runHeap(e, t) {
|
|
788
842
|
e.R = false;
|
|
789
|
-
for (e.I = 0; e.I <= e.
|
|
790
|
-
let n = e.
|
|
843
|
+
for (e.I = 0; e.I <= e.A; e.I++) {
|
|
844
|
+
let n = e.O[e.I];
|
|
791
845
|
while (n !== undefined) {
|
|
792
|
-
if (n.
|
|
846
|
+
if (n.H & REACTIVE_IN_HEAP) t(n);
|
|
793
847
|
else adjustHeight(n, e);
|
|
794
|
-
n = e.
|
|
848
|
+
n = e.O[e.I];
|
|
795
849
|
}
|
|
796
850
|
}
|
|
797
|
-
e.
|
|
851
|
+
e.A = 0;
|
|
798
852
|
}
|
|
799
853
|
function adjustHeight(e, t) {
|
|
800
854
|
deleteFromHeap(e, t);
|
|
801
|
-
let n = e
|
|
802
|
-
for (let t = e.
|
|
803
|
-
const e = t.
|
|
804
|
-
const i = e.
|
|
805
|
-
if (i.
|
|
855
|
+
let n = e.$;
|
|
856
|
+
for (let t = e.he; t; t = t.Ne) {
|
|
857
|
+
const e = t.Ce;
|
|
858
|
+
const i = e.ye || e;
|
|
859
|
+
if (i.de && i.$ >= n) n = i.$ + 1;
|
|
806
860
|
}
|
|
807
|
-
if (e
|
|
808
|
-
e
|
|
809
|
-
for (let t = e.
|
|
810
|
-
insertIntoHeapHeight(t.
|
|
861
|
+
if (e.$ !== n) {
|
|
862
|
+
e.$ = n;
|
|
863
|
+
for (let t = e.D; t !== null; t = t.U) {
|
|
864
|
+
insertIntoHeapHeight(t.k, t.k.H & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
811
865
|
}
|
|
812
866
|
}
|
|
813
867
|
}
|
|
814
868
|
const PENDING_OWNER = {};
|
|
815
869
|
function markDisposal(e) {
|
|
816
|
-
let t = e.
|
|
870
|
+
let t = e.Le;
|
|
817
871
|
while (t) {
|
|
818
|
-
const e = t.
|
|
819
|
-
t.
|
|
872
|
+
const e = t.H;
|
|
873
|
+
t.H = e | REACTIVE_ZOMBIE;
|
|
820
874
|
if (e & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT)) {
|
|
821
875
|
deleteFromHeap(t, e & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
822
876
|
if (e & REACTIVE_IN_HEAP) insertIntoHeap(t, zombieQueue);
|
|
823
877
|
else insertIntoHeapHeight(t, zombieQueue);
|
|
824
878
|
}
|
|
825
879
|
markDisposal(t);
|
|
826
|
-
t = t.
|
|
880
|
+
t = t.Ve;
|
|
827
881
|
}
|
|
828
882
|
}
|
|
829
883
|
function dispose(e) {
|
|
830
|
-
let t = e.
|
|
884
|
+
let t = e.he;
|
|
831
885
|
while (t !== null) {
|
|
832
886
|
t = unlinkSubs(t);
|
|
833
887
|
}
|
|
834
|
-
e.
|
|
835
|
-
e.
|
|
888
|
+
e.he = null;
|
|
889
|
+
e.Ue = null;
|
|
836
890
|
disposeChildren(e, true);
|
|
837
891
|
}
|
|
838
892
|
function disposeChildren(e, t = false, n) {
|
|
839
|
-
const i = e.
|
|
893
|
+
const i = e.H;
|
|
840
894
|
if (i & REACTIVE_DISPOSED) return;
|
|
841
895
|
if (t) {
|
|
842
|
-
e.
|
|
896
|
+
e.H = i | REACTIVE_DISPOSED;
|
|
843
897
|
const t = e;
|
|
844
|
-
if (t.
|
|
898
|
+
if (t.X || t.J) snapCompanionsToState(t);
|
|
845
899
|
}
|
|
846
|
-
if (t && e.
|
|
847
|
-
let r = n ? e.
|
|
900
|
+
if (t && e.de) e.ke = null;
|
|
901
|
+
let r = n ? e.Oe : e.Le;
|
|
848
902
|
while (r) {
|
|
849
|
-
const e = r.
|
|
850
|
-
if (r.
|
|
903
|
+
const e = r.Ve;
|
|
904
|
+
if (r.he) {
|
|
851
905
|
const e = r;
|
|
852
|
-
deleteFromHeap(e, e.
|
|
853
|
-
let t = e.
|
|
906
|
+
deleteFromHeap(e, e.H & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
907
|
+
let t = e.he;
|
|
854
908
|
do {
|
|
855
909
|
t = unlinkSubs(t);
|
|
856
910
|
} while (t !== null);
|
|
857
|
-
e.
|
|
858
|
-
e.
|
|
911
|
+
e.he = null;
|
|
912
|
+
e.Ue = null;
|
|
859
913
|
}
|
|
860
914
|
disposeChildren(r, true);
|
|
861
915
|
r = e;
|
|
862
916
|
}
|
|
863
917
|
if (n) {
|
|
864
|
-
e.
|
|
918
|
+
e.Oe = null;
|
|
865
919
|
} else {
|
|
866
|
-
e.
|
|
867
|
-
e.
|
|
920
|
+
e.Le = null;
|
|
921
|
+
e.Ge = 0;
|
|
868
922
|
}
|
|
869
|
-
if (t && !n && !(i & REACTIVE_ZOMBIE) && e.
|
|
870
|
-
const t = e.
|
|
871
|
-
const n = e.
|
|
872
|
-
if (t !== null) t.
|
|
873
|
-
else e.
|
|
874
|
-
if (n !== null) n.
|
|
875
|
-
e.
|
|
923
|
+
if (t && !n && !(i & REACTIVE_ZOMBIE) && e.te !== null && !(e.te.H & REACTIVE_DISPOSED)) {
|
|
924
|
+
const t = e.Fe;
|
|
925
|
+
const n = e.Ve;
|
|
926
|
+
if (t !== null) t.Ve = n;
|
|
927
|
+
else e.te.Le = n;
|
|
928
|
+
if (n !== null) n.Fe = t;
|
|
929
|
+
e.Fe = null;
|
|
876
930
|
}
|
|
877
931
|
runDisposal(e, n);
|
|
878
|
-
if (t && e.
|
|
879
|
-
const t = e.
|
|
880
|
-
e.
|
|
932
|
+
if (t && e.We) {
|
|
933
|
+
const t = e.We;
|
|
934
|
+
e.We = undefined;
|
|
881
935
|
t();
|
|
882
936
|
}
|
|
883
937
|
}
|
|
884
938
|
function runDisposal(e, t) {
|
|
885
|
-
let n = t ? e.
|
|
939
|
+
let n = t ? e.Re : e.Me;
|
|
886
940
|
if (!n) return;
|
|
887
941
|
if (Array.isArray(n)) {
|
|
888
942
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -892,12 +946,12 @@ function runDisposal(e, t) {
|
|
|
892
946
|
} else {
|
|
893
947
|
n.call(n);
|
|
894
948
|
}
|
|
895
|
-
t ? (e.
|
|
949
|
+
t ? (e.Re = null) : (e.Me = null);
|
|
896
950
|
}
|
|
897
951
|
function childId(e, t) {
|
|
898
952
|
let n = e;
|
|
899
|
-
while (n.
|
|
900
|
-
if (n.id != null) return formatId(n.id, t ? n.
|
|
953
|
+
while (n.Se & CONFIG_TRANSPARENT && n.te) n = n.te;
|
|
954
|
+
if (n.id != null) return formatId(n.id, t ? n.Ge++ : n.Ge);
|
|
901
955
|
throw new Error("Cannot get child id from owner without an id");
|
|
902
956
|
}
|
|
903
957
|
function getNextChildId(e) {
|
|
@@ -920,13 +974,13 @@ function getOwner() {
|
|
|
920
974
|
}
|
|
921
975
|
function cleanup(e) {
|
|
922
976
|
if (!context) return e;
|
|
923
|
-
if (!context.
|
|
924
|
-
else if (Array.isArray(context.
|
|
925
|
-
else context.
|
|
977
|
+
if (!context.Me) context.Me = e;
|
|
978
|
+
else if (Array.isArray(context.Me)) context.Me.push(e);
|
|
979
|
+
else context.Me = [context.Me, e];
|
|
926
980
|
return e;
|
|
927
981
|
}
|
|
928
982
|
function isDisposed(e) {
|
|
929
|
-
return !!(e.
|
|
983
|
+
return !!(e.H & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
|
|
930
984
|
}
|
|
931
985
|
function disposeRootSelf(e = true) {
|
|
932
986
|
disposeChildren(this, e);
|
|
@@ -936,29 +990,29 @@ function createOwner(e) {
|
|
|
936
990
|
const n = e?.transparent ?? false;
|
|
937
991
|
const i = {
|
|
938
992
|
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
993
|
+
Se: n ? CONFIG_TRANSPARENT : 0,
|
|
994
|
+
Pe: true,
|
|
995
|
+
De: t?.Pe ? t.De : t,
|
|
996
|
+
Le: null,
|
|
997
|
+
Ve: null,
|
|
998
|
+
Fe: null,
|
|
999
|
+
Me: null,
|
|
1000
|
+
W: t?.W ?? globalQueue,
|
|
1001
|
+
He: t?.He || defaultContext,
|
|
1002
|
+
Ge: 0,
|
|
1003
|
+
Re: null,
|
|
1004
|
+
Oe: null,
|
|
1005
|
+
te: t,
|
|
952
1006
|
dispose: disposeRootSelf
|
|
953
1007
|
};
|
|
954
1008
|
if (t) {
|
|
955
|
-
const e = t.
|
|
1009
|
+
const e = t.Le;
|
|
956
1010
|
if (e === null) {
|
|
957
|
-
t.
|
|
1011
|
+
t.Le = i;
|
|
958
1012
|
} else {
|
|
959
|
-
i.
|
|
960
|
-
e.
|
|
961
|
-
t.
|
|
1013
|
+
i.Ve = e;
|
|
1014
|
+
e.Fe = i;
|
|
1015
|
+
t.Le = i;
|
|
962
1016
|
}
|
|
963
1017
|
}
|
|
964
1018
|
return i;
|
|
@@ -968,164 +1022,165 @@ function createRoot(e, t) {
|
|
|
968
1022
|
return runWithOwner(n, () => e(() => n.dispose()));
|
|
969
1023
|
}
|
|
970
1024
|
function unlinkSubs(e) {
|
|
971
|
-
const t = e.
|
|
972
|
-
const n = e.
|
|
973
|
-
const i = e.
|
|
974
|
-
const r = e.
|
|
975
|
-
if (i !== null) i.
|
|
976
|
-
else t.
|
|
977
|
-
if (r !== null) r.
|
|
1025
|
+
const t = e.Ce;
|
|
1026
|
+
const n = e.Ne;
|
|
1027
|
+
const i = e.U;
|
|
1028
|
+
const r = e.Qe;
|
|
1029
|
+
if (i !== null) i.Qe = r;
|
|
1030
|
+
else t.xe = r;
|
|
1031
|
+
if (r !== null) r.U = i;
|
|
978
1032
|
else {
|
|
979
|
-
t.
|
|
1033
|
+
t.D = i;
|
|
980
1034
|
if (i === null) {
|
|
981
|
-
t.
|
|
1035
|
+
t.V?.();
|
|
982
1036
|
const e = t;
|
|
983
|
-
e.
|
|
1037
|
+
e.de && e.Se & CONFIG_AUTO_DISPOSE && !(e.H & REACTIVE_ZOMBIE) && unobserved(e);
|
|
984
1038
|
}
|
|
985
1039
|
}
|
|
986
1040
|
return n;
|
|
987
1041
|
}
|
|
988
1042
|
function trimStaleDeps(e) {
|
|
989
|
-
const t = e.
|
|
990
|
-
let n = t !== null ? t.
|
|
1043
|
+
const t = e.Ue;
|
|
1044
|
+
let n = t !== null ? t.Ne : e.he;
|
|
991
1045
|
if (n !== null) {
|
|
992
1046
|
do {
|
|
993
1047
|
n = unlinkSubs(n);
|
|
994
1048
|
} while (n !== null);
|
|
995
|
-
if (t !== null) t.
|
|
996
|
-
else e.
|
|
1049
|
+
if (t !== null) t.Ne = null;
|
|
1050
|
+
else e.he = null;
|
|
997
1051
|
}
|
|
998
1052
|
}
|
|
999
1053
|
function unobserved(e) {
|
|
1000
|
-
deleteFromHeap(e, e.
|
|
1001
|
-
let t = e.
|
|
1054
|
+
deleteFromHeap(e, e.H & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1055
|
+
let t = e.he;
|
|
1002
1056
|
while (t !== null) {
|
|
1003
1057
|
t = unlinkSubs(t);
|
|
1004
1058
|
}
|
|
1005
|
-
e.
|
|
1006
|
-
e.
|
|
1059
|
+
e.he = null;
|
|
1060
|
+
e.Ue = null;
|
|
1007
1061
|
disposeChildren(e, true);
|
|
1008
1062
|
}
|
|
1009
1063
|
function link(e, t, n = false) {
|
|
1010
|
-
const i = t.
|
|
1011
|
-
if (i !== null && i.
|
|
1012
|
-
i
|
|
1064
|
+
const i = t.Ue;
|
|
1065
|
+
if (i !== null && i.Ce === e) {
|
|
1066
|
+
i.$e = n;
|
|
1013
1067
|
return;
|
|
1014
1068
|
}
|
|
1015
1069
|
let r = null;
|
|
1016
|
-
const
|
|
1017
|
-
if (
|
|
1018
|
-
r = i !== null ? i.
|
|
1019
|
-
if (r !== null && r.
|
|
1020
|
-
r.
|
|
1021
|
-
t.
|
|
1022
|
-
r
|
|
1070
|
+
const s = t.H & REACTIVE_RECOMPUTING_DEPS;
|
|
1071
|
+
if (s) {
|
|
1072
|
+
r = i !== null ? i.Ne : t.he;
|
|
1073
|
+
if (r !== null && r.Ce === e) {
|
|
1074
|
+
r.je = t.Ke;
|
|
1075
|
+
t.Ue = r;
|
|
1076
|
+
r.$e = n;
|
|
1023
1077
|
return;
|
|
1024
1078
|
}
|
|
1025
1079
|
}
|
|
1026
|
-
const
|
|
1027
|
-
if (
|
|
1028
|
-
|
|
1080
|
+
const o = e.xe;
|
|
1081
|
+
if (o !== null && o.k === t && (!s || o.je === t.Ke)) {
|
|
1082
|
+
o.$e = n;
|
|
1029
1083
|
return;
|
|
1030
1084
|
}
|
|
1031
|
-
const u = (t.
|
|
1032
|
-
if (i !== null) i.
|
|
1033
|
-
else t.
|
|
1034
|
-
if (
|
|
1035
|
-
else e.
|
|
1085
|
+
const u = (t.Ue = e.xe = { Ce: e, k: t, Ne: r, Qe: o, U: null, je: t.Ke, $e: n });
|
|
1086
|
+
if (i !== null) i.Ne = u;
|
|
1087
|
+
else t.he = u;
|
|
1088
|
+
if (o !== null) o.U = u;
|
|
1089
|
+
else e.D = u;
|
|
1036
1090
|
}
|
|
1037
1091
|
function addPendingSource(e, t) {
|
|
1038
|
-
if (e.
|
|
1039
|
-
if (!e.
|
|
1040
|
-
e.
|
|
1092
|
+
if (e.Ie === t || e.Ae?.has(t)) return false;
|
|
1093
|
+
if (!e.Ie) {
|
|
1094
|
+
e.Ie = t;
|
|
1041
1095
|
return true;
|
|
1042
1096
|
}
|
|
1043
|
-
if (!e.
|
|
1044
|
-
e.
|
|
1097
|
+
if (!e.Ae) {
|
|
1098
|
+
e.Ae = new Set([e.Ie, t]);
|
|
1045
1099
|
} else {
|
|
1046
|
-
e.
|
|
1100
|
+
e.Ae.add(t);
|
|
1047
1101
|
}
|
|
1048
|
-
e.
|
|
1102
|
+
e.Ie = undefined;
|
|
1049
1103
|
return true;
|
|
1050
1104
|
}
|
|
1051
1105
|
function removePendingSource(e, t) {
|
|
1052
|
-
if (e.
|
|
1053
|
-
if (e.
|
|
1054
|
-
e.
|
|
1106
|
+
if (e.Ie) {
|
|
1107
|
+
if (e.Ie !== t) return false;
|
|
1108
|
+
e.Ie = undefined;
|
|
1055
1109
|
return true;
|
|
1056
1110
|
}
|
|
1057
|
-
if (!e.
|
|
1058
|
-
if (e.
|
|
1059
|
-
e.
|
|
1060
|
-
e.
|
|
1061
|
-
} else if (e.
|
|
1062
|
-
e.
|
|
1111
|
+
if (!e.Ae?.delete(t)) return false;
|
|
1112
|
+
if (e.Ae.size === 1) {
|
|
1113
|
+
e.Ie = e.Ae.values().next().value;
|
|
1114
|
+
e.Ae = undefined;
|
|
1115
|
+
} else if (e.Ae.size === 0) {
|
|
1116
|
+
e.Ae = undefined;
|
|
1063
1117
|
}
|
|
1064
1118
|
return true;
|
|
1065
1119
|
}
|
|
1066
1120
|
function clearPendingSources(e) {
|
|
1067
|
-
e.
|
|
1068
|
-
e.
|
|
1069
|
-
e.
|
|
1121
|
+
e.Ie = undefined;
|
|
1122
|
+
e.Ae?.clear();
|
|
1123
|
+
e.Ae = undefined;
|
|
1070
1124
|
}
|
|
1071
1125
|
function setPendingError(e, t, n) {
|
|
1072
1126
|
if (!t) {
|
|
1073
|
-
e.
|
|
1127
|
+
e.Te = null;
|
|
1074
1128
|
return;
|
|
1075
1129
|
}
|
|
1076
1130
|
if (n instanceof NotReadyError && n.source === t) {
|
|
1077
|
-
e.
|
|
1131
|
+
e.Te = n;
|
|
1078
1132
|
return;
|
|
1079
1133
|
}
|
|
1080
|
-
const i = e.
|
|
1134
|
+
const i = e.Te;
|
|
1081
1135
|
if (!(i instanceof NotReadyError) || i.source !== t) {
|
|
1082
|
-
e.
|
|
1136
|
+
e.Te = new NotReadyError(t);
|
|
1083
1137
|
}
|
|
1084
1138
|
}
|
|
1085
1139
|
function forEachDependent(e, t) {
|
|
1086
|
-
for (let n = e.
|
|
1087
|
-
for (let n = e.
|
|
1088
|
-
for (let e = n.
|
|
1140
|
+
for (let n = e.D; n !== null; n = n.U) t(n.k, n);
|
|
1141
|
+
for (let n = e.ve ?? null; n !== null; n = n.we) {
|
|
1142
|
+
for (let e = n.D; e !== null; e = e.U) t(e.k, e);
|
|
1089
1143
|
}
|
|
1090
1144
|
}
|
|
1091
1145
|
function enqueueForRerun(e) {
|
|
1092
|
-
if (e.
|
|
1146
|
+
if (e.G === EFFECT_TRACKED) {
|
|
1093
1147
|
const t = e;
|
|
1094
|
-
if (!t.
|
|
1095
|
-
t.
|
|
1096
|
-
t.
|
|
1148
|
+
if (!t.F) {
|
|
1149
|
+
t.F = true;
|
|
1150
|
+
t.W.enqueue(EFFECT_USER, t.M);
|
|
1097
1151
|
}
|
|
1098
1152
|
} else {
|
|
1099
|
-
const t = e.
|
|
1100
|
-
if (t.I > e
|
|
1153
|
+
const t = e.H & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
1154
|
+
if (t.I > e.$) t.I = e.$;
|
|
1101
1155
|
insertIntoHeap(e, t);
|
|
1102
1156
|
}
|
|
1103
1157
|
}
|
|
1104
|
-
function settlePendingSource(e) {
|
|
1105
|
-
let
|
|
1106
|
-
const
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1158
|
+
function settlePendingSource(e, t = e, n = false) {
|
|
1159
|
+
let i = false;
|
|
1160
|
+
const r = new Set();
|
|
1161
|
+
const s = n ? snapCompanionsToState : updatePendingSignal;
|
|
1162
|
+
const settle = e => {
|
|
1163
|
+
if (r.has(e) || !removePendingSource(e, t)) return;
|
|
1164
|
+
r.add(e);
|
|
1165
|
+
e._e = clock;
|
|
1166
|
+
const n = e.Ie ?? e.Ae?.values().next().value;
|
|
1167
|
+
if (n) {
|
|
1168
|
+
setPendingError(e, n);
|
|
1169
|
+
s(e);
|
|
1115
1170
|
} else {
|
|
1116
|
-
|
|
1117
|
-
setPendingError(
|
|
1118
|
-
|
|
1119
|
-
if (
|
|
1120
|
-
enqueueForRerun(
|
|
1121
|
-
|
|
1171
|
+
e.q &= ~STATUS_PENDING;
|
|
1172
|
+
setPendingError(e);
|
|
1173
|
+
s(e);
|
|
1174
|
+
if (e.Ye) {
|
|
1175
|
+
enqueueForRerun(e);
|
|
1176
|
+
i = true;
|
|
1122
1177
|
}
|
|
1123
|
-
|
|
1178
|
+
e.Ye = false;
|
|
1124
1179
|
}
|
|
1125
|
-
forEachDependent(
|
|
1180
|
+
forEachDependent(e, settle);
|
|
1126
1181
|
};
|
|
1127
1182
|
forEachDependent(e, settle);
|
|
1128
|
-
if (
|
|
1183
|
+
if (i) schedule();
|
|
1129
1184
|
}
|
|
1130
1185
|
function isThenable(e) {
|
|
1131
1186
|
return e != null && typeof e === "object" && typeof e.then === "function";
|
|
@@ -1140,43 +1195,43 @@ function handleAsync(e, t, n) {
|
|
|
1140
1195
|
});
|
|
1141
1196
|
}
|
|
1142
1197
|
if (!r && !i) {
|
|
1143
|
-
e.
|
|
1198
|
+
e.ke = null;
|
|
1144
1199
|
return t;
|
|
1145
1200
|
}
|
|
1146
|
-
e.
|
|
1147
|
-
let
|
|
1201
|
+
e.ke = t;
|
|
1202
|
+
let s;
|
|
1148
1203
|
const handleError = n => {
|
|
1149
|
-
if (e.
|
|
1204
|
+
if (e.ke !== t) return;
|
|
1150
1205
|
globalQueue.initTransition(resolveTransition(e));
|
|
1151
1206
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
1152
|
-
e.
|
|
1207
|
+
e._e = clock;
|
|
1153
1208
|
};
|
|
1154
1209
|
const asyncWrite = (i, r) => {
|
|
1155
|
-
if (e.
|
|
1156
|
-
if (e.
|
|
1210
|
+
if (e.ke !== t) return;
|
|
1211
|
+
if (e.H & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
1157
1212
|
globalQueue.initTransition(resolveTransition(e));
|
|
1158
|
-
const
|
|
1213
|
+
const s = !!(e.q & STATUS_UNINITIALIZED);
|
|
1159
1214
|
trimStaleDeps(e);
|
|
1160
1215
|
clearStatus(e);
|
|
1161
|
-
const
|
|
1162
|
-
if (
|
|
1216
|
+
const o = resolveLane(e);
|
|
1217
|
+
if (o) o.u.delete(e);
|
|
1163
1218
|
if (n) {
|
|
1164
1219
|
n(i);
|
|
1165
|
-
if (
|
|
1166
|
-
} else if (e.
|
|
1167
|
-
if (e.
|
|
1168
|
-
e.
|
|
1220
|
+
if (s) clearStatus(e, true);
|
|
1221
|
+
} else if (e.p !== undefined) {
|
|
1222
|
+
if (e.m === NOT_PENDING) queuePendingNode(e);
|
|
1223
|
+
e.m = i;
|
|
1169
1224
|
syncCompanions(e, i);
|
|
1170
1225
|
if (!hasActiveOverride(e)) insertSubs(e);
|
|
1171
|
-
e.
|
|
1172
|
-
} else if (
|
|
1173
|
-
const t = e.
|
|
1174
|
-
const n = e.
|
|
1175
|
-
const r = e.
|
|
1226
|
+
e._e = clock;
|
|
1227
|
+
} else if (o) {
|
|
1228
|
+
const t = e.G;
|
|
1229
|
+
const n = e.B;
|
|
1230
|
+
const r = e.Ze;
|
|
1176
1231
|
try {
|
|
1177
|
-
if ((!t &&
|
|
1178
|
-
e.
|
|
1179
|
-
e.
|
|
1232
|
+
if ((!t && s) || !r || !r(i, n)) {
|
|
1233
|
+
e.B = i;
|
|
1234
|
+
e._e = clock;
|
|
1180
1235
|
syncCompanions(e, i);
|
|
1181
1236
|
insertSubs(e, true);
|
|
1182
1237
|
}
|
|
@@ -1199,22 +1254,22 @@ function handleAsync(e, t, n) {
|
|
|
1199
1254
|
let n = false,
|
|
1200
1255
|
i = false,
|
|
1201
1256
|
r,
|
|
1202
|
-
|
|
1257
|
+
o = true;
|
|
1203
1258
|
t.then(
|
|
1204
1259
|
e => {
|
|
1205
|
-
if (
|
|
1206
|
-
|
|
1260
|
+
if (o) {
|
|
1261
|
+
s = e;
|
|
1207
1262
|
n = true;
|
|
1208
1263
|
} else asyncWrite(e);
|
|
1209
1264
|
},
|
|
1210
1265
|
e => {
|
|
1211
|
-
if (
|
|
1266
|
+
if (o) {
|
|
1212
1267
|
r = e;
|
|
1213
1268
|
i = true;
|
|
1214
1269
|
} else handleError(e);
|
|
1215
1270
|
}
|
|
1216
1271
|
);
|
|
1217
|
-
|
|
1272
|
+
o = false;
|
|
1218
1273
|
if (i) {
|
|
1219
1274
|
handleError(r);
|
|
1220
1275
|
throw r;
|
|
@@ -1227,6 +1282,7 @@ function handleAsync(e, t, n) {
|
|
|
1227
1282
|
const n = t[Symbol.asyncIterator]();
|
|
1228
1283
|
let i = false;
|
|
1229
1284
|
let r = false;
|
|
1285
|
+
let o = true;
|
|
1230
1286
|
cleanup(() => {
|
|
1231
1287
|
if (r) return;
|
|
1232
1288
|
r = true;
|
|
@@ -1236,108 +1292,169 @@ function handleAsync(e, t, n) {
|
|
|
1236
1292
|
} catch {}
|
|
1237
1293
|
});
|
|
1238
1294
|
const iterate = () => {
|
|
1239
|
-
let
|
|
1240
|
-
|
|
1241
|
-
|
|
1295
|
+
let u,
|
|
1296
|
+
c,
|
|
1297
|
+
a = false,
|
|
1298
|
+
l = false,
|
|
1299
|
+
f = true;
|
|
1242
1300
|
n.next().then(
|
|
1243
1301
|
n => {
|
|
1244
|
-
if (
|
|
1245
|
-
|
|
1246
|
-
|
|
1302
|
+
if (f) {
|
|
1303
|
+
u = n;
|
|
1304
|
+
a = true;
|
|
1247
1305
|
if (n.done) r = true;
|
|
1248
|
-
} else if (e.
|
|
1306
|
+
} else if (e.ke !== t) {
|
|
1249
1307
|
return;
|
|
1250
|
-
} else if (!n.done)
|
|
1251
|
-
|
|
1308
|
+
} else if (!n.done) {
|
|
1309
|
+
i = true;
|
|
1310
|
+
asyncWrite(n.value, iterate);
|
|
1311
|
+
} else {
|
|
1252
1312
|
r = true;
|
|
1253
|
-
|
|
1254
|
-
|
|
1313
|
+
if (i) {
|
|
1314
|
+
schedule();
|
|
1315
|
+
flush();
|
|
1316
|
+
} else {
|
|
1317
|
+
asyncWrite(undefined);
|
|
1318
|
+
}
|
|
1255
1319
|
}
|
|
1256
1320
|
},
|
|
1257
1321
|
n => {
|
|
1258
|
-
if (
|
|
1322
|
+
if (f) {
|
|
1323
|
+
c = n;
|
|
1324
|
+
l = true;
|
|
1325
|
+
} else if (e.ke === t) {
|
|
1259
1326
|
r = true;
|
|
1260
1327
|
handleError(n);
|
|
1261
1328
|
}
|
|
1262
1329
|
}
|
|
1263
1330
|
);
|
|
1264
|
-
|
|
1265
|
-
if (
|
|
1266
|
-
|
|
1331
|
+
f = false;
|
|
1332
|
+
if (l) {
|
|
1333
|
+
r = true;
|
|
1334
|
+
handleError(c);
|
|
1335
|
+
if (o) throw c;
|
|
1336
|
+
return true;
|
|
1337
|
+
}
|
|
1338
|
+
if (a && !u.done) {
|
|
1339
|
+
s = u.value;
|
|
1267
1340
|
i = true;
|
|
1268
1341
|
return iterate();
|
|
1269
1342
|
}
|
|
1270
|
-
return
|
|
1343
|
+
return a && u.done;
|
|
1271
1344
|
};
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1345
|
+
const u = iterate();
|
|
1346
|
+
o = false;
|
|
1347
|
+
if (!i && !u) {
|
|
1274
1348
|
globalQueue.initTransition(resolveTransition(e));
|
|
1275
1349
|
throw new NotReadyError(context);
|
|
1276
1350
|
}
|
|
1277
1351
|
}
|
|
1278
|
-
return
|
|
1352
|
+
return s;
|
|
1279
1353
|
}
|
|
1280
1354
|
function clearStatus(e, t = false) {
|
|
1281
|
-
if (e.
|
|
1282
|
-
if (e.
|
|
1283
|
-
e.
|
|
1284
|
-
|
|
1285
|
-
if (e.
|
|
1286
|
-
if (e.
|
|
1287
|
-
if (e.
|
|
1355
|
+
if (e.Ie || e.Ae) clearPendingSources(e);
|
|
1356
|
+
if (e.Ye) e.Ye = false;
|
|
1357
|
+
e.qe = false;
|
|
1358
|
+
e.q = t ? 0 : e.q & STATUS_UNINITIALIZED;
|
|
1359
|
+
if (e.Te) setPendingError(e);
|
|
1360
|
+
if (e.X || e.J) updatePendingSignal(e);
|
|
1361
|
+
if (e.ve) updateChildCompanions(e);
|
|
1362
|
+
if (e.Be) e.Be();
|
|
1288
1363
|
}
|
|
1289
1364
|
function notifyStatus(e, t, n, i, r) {
|
|
1290
1365
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
1291
1366
|
n = new StatusError(e, n);
|
|
1292
|
-
const
|
|
1293
|
-
const
|
|
1294
|
-
const u = t === STATUS_PENDING && e.
|
|
1367
|
+
const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
1368
|
+
const o = s === e;
|
|
1369
|
+
const u = t === STATUS_PENDING && e.p !== undefined && !o;
|
|
1295
1370
|
const c = u && hasActiveOverride(e);
|
|
1296
1371
|
if (!i) {
|
|
1297
|
-
if (t === STATUS_PENDING &&
|
|
1298
|
-
addPendingSource(e,
|
|
1299
|
-
e.
|
|
1300
|
-
setPendingError(e,
|
|
1372
|
+
if (t === STATUS_PENDING && s) {
|
|
1373
|
+
addPendingSource(e, s);
|
|
1374
|
+
e.q = STATUS_PENDING | (e.q & STATUS_UNINITIALIZED);
|
|
1375
|
+
setPendingError(e, s, n);
|
|
1301
1376
|
} else {
|
|
1302
1377
|
clearPendingSources(e);
|
|
1303
|
-
e.
|
|
1304
|
-
e.
|
|
1378
|
+
e.q = t | (t !== STATUS_ERROR ? e.q & STATUS_UNINITIALIZED : 0);
|
|
1379
|
+
e.Te = n;
|
|
1305
1380
|
}
|
|
1306
1381
|
updatePendingSignal(e);
|
|
1307
|
-
if (e.
|
|
1382
|
+
if (e.ve) updateChildCompanions(e);
|
|
1308
1383
|
}
|
|
1309
1384
|
if (r && !i) {
|
|
1310
1385
|
assignOrMergeLane(e, r);
|
|
1311
1386
|
}
|
|
1312
|
-
const
|
|
1313
|
-
const
|
|
1314
|
-
if (e.
|
|
1387
|
+
const a = i || c;
|
|
1388
|
+
const l = i || u ? undefined : r;
|
|
1389
|
+
if (e.Be) {
|
|
1315
1390
|
if (i && t === STATUS_PENDING) {
|
|
1316
1391
|
return;
|
|
1317
1392
|
}
|
|
1318
|
-
if (
|
|
1319
|
-
e.
|
|
1393
|
+
if (a) {
|
|
1394
|
+
e.Be(t, n);
|
|
1320
1395
|
} else {
|
|
1321
|
-
e.
|
|
1396
|
+
e.Be();
|
|
1322
1397
|
}
|
|
1323
1398
|
return;
|
|
1324
1399
|
}
|
|
1325
1400
|
forEachDependent(e, (e, i) => {
|
|
1326
|
-
e.
|
|
1401
|
+
e._e = clock;
|
|
1327
1402
|
if (
|
|
1328
|
-
(t === STATUS_PENDING &&
|
|
1329
|
-
(t !== STATUS_PENDING && (e.
|
|
1403
|
+
(t === STATUS_PENDING && s && e.Ie !== s && !e.Ae?.has(s)) ||
|
|
1404
|
+
(t !== STATUS_PENDING && (e.Te !== n || e.Ie || e.Ae))
|
|
1330
1405
|
) {
|
|
1331
|
-
if (i
|
|
1406
|
+
if (i.$e && t !== STATUS_PENDING && !(n instanceof NotReadyError)) {
|
|
1332
1407
|
enqueueForRerun(e);
|
|
1333
1408
|
schedule();
|
|
1334
1409
|
return;
|
|
1335
1410
|
}
|
|
1336
|
-
if (!
|
|
1337
|
-
notifyStatus(e, t, n,
|
|
1411
|
+
if (!a && !e.T) queuePendingNode(e);
|
|
1412
|
+
notifyStatus(e, t, n, a, l);
|
|
1338
1413
|
}
|
|
1339
1414
|
});
|
|
1340
1415
|
}
|
|
1416
|
+
function getAffectsSentinel(e) {
|
|
1417
|
+
return (e.ze ??= {
|
|
1418
|
+
Xe: undefined,
|
|
1419
|
+
ge: e,
|
|
1420
|
+
H: 0,
|
|
1421
|
+
q: 0,
|
|
1422
|
+
qe: false,
|
|
1423
|
+
Te: undefined,
|
|
1424
|
+
D: null,
|
|
1425
|
+
he: null
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
function propagateAffectsMark(e) {
|
|
1429
|
+
if (!e.D && !e.ve) return;
|
|
1430
|
+
const t = getAffectsSentinel(e);
|
|
1431
|
+
const n = new NotReadyError(t);
|
|
1432
|
+
forEachDependent(e, e => {
|
|
1433
|
+
if (e.Ie !== t && !e.Ae?.has(t)) {
|
|
1434
|
+
if (!e.T) queuePendingNode(e);
|
|
1435
|
+
notifyStatus(e, STATUS_PENDING, n);
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
function applyAffectsReads(e, t) {
|
|
1440
|
+
let n = false;
|
|
1441
|
+
for (let i = 0; i < t.length; i++) {
|
|
1442
|
+
const r = t[i];
|
|
1443
|
+
if (!r.L) continue;
|
|
1444
|
+
const s = getAffectsSentinel(r);
|
|
1445
|
+
if (addPendingSource(e, s)) {
|
|
1446
|
+
e.q |= STATUS_PENDING;
|
|
1447
|
+
setPendingError(e, s);
|
|
1448
|
+
n = true;
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
if (n) updatePendingSignal(e);
|
|
1452
|
+
}
|
|
1453
|
+
GlobalQueue.le = propagateAffectsMark;
|
|
1454
|
+
GlobalQueue.fe = e => {
|
|
1455
|
+
const t = e.ze;
|
|
1456
|
+
if (t) settlePendingSource(e, t, true);
|
|
1457
|
+
};
|
|
1341
1458
|
let externalSourceConfig = null;
|
|
1342
1459
|
function enableExternalSource(e) {
|
|
1343
1460
|
const { factory: t, untrack: n = e => e() } = e;
|
|
@@ -1346,11 +1463,11 @@ function enableExternalSource(e) {
|
|
|
1346
1463
|
externalSourceConfig = {
|
|
1347
1464
|
factory: (n, i) => {
|
|
1348
1465
|
const r = e(n, i);
|
|
1349
|
-
const
|
|
1466
|
+
const s = t(e => r.track(e), i);
|
|
1350
1467
|
return {
|
|
1351
|
-
track: e =>
|
|
1468
|
+
track: e => s.track(e),
|
|
1352
1469
|
dispose() {
|
|
1353
|
-
|
|
1470
|
+
s.dispose();
|
|
1354
1471
|
r.dispose();
|
|
1355
1472
|
}
|
|
1356
1473
|
};
|
|
@@ -1361,8 +1478,8 @@ function enableExternalSource(e) {
|
|
|
1361
1478
|
externalSourceConfig = { factory: t, untrack: n };
|
|
1362
1479
|
}
|
|
1363
1480
|
}
|
|
1364
|
-
GlobalQueue.
|
|
1365
|
-
GlobalQueue.
|
|
1481
|
+
GlobalQueue.se = recompute;
|
|
1482
|
+
GlobalQueue.oe = disposeChildren;
|
|
1366
1483
|
let tracking = false;
|
|
1367
1484
|
let stale = false;
|
|
1368
1485
|
let pendingCheckActive = false;
|
|
@@ -1370,12 +1487,13 @@ let latestReadActive = false;
|
|
|
1370
1487
|
let context = null;
|
|
1371
1488
|
let currentOptimisticLane = null;
|
|
1372
1489
|
let pendingProbe = null;
|
|
1490
|
+
let affectsReads = null;
|
|
1373
1491
|
let snapshotCaptureActive = false;
|
|
1374
1492
|
let snapshotSources = null;
|
|
1375
1493
|
function ownerInSnapshotScope(e) {
|
|
1376
1494
|
while (e) {
|
|
1377
|
-
if (e.
|
|
1378
|
-
e = e.
|
|
1495
|
+
if (e.Je) return true;
|
|
1496
|
+
e = e.te;
|
|
1379
1497
|
}
|
|
1380
1498
|
return false;
|
|
1381
1499
|
}
|
|
@@ -1384,38 +1502,38 @@ function setSnapshotCapture(e) {
|
|
|
1384
1502
|
if (e && !snapshotSources) snapshotSources = new Set();
|
|
1385
1503
|
}
|
|
1386
1504
|
function markSnapshotScope(e) {
|
|
1387
|
-
e.
|
|
1505
|
+
e.Je = true;
|
|
1388
1506
|
}
|
|
1389
1507
|
function releaseSnapshotScope(e) {
|
|
1390
|
-
e.
|
|
1508
|
+
e.Je = false;
|
|
1391
1509
|
releaseSubtree(e);
|
|
1392
1510
|
schedule();
|
|
1393
1511
|
}
|
|
1394
1512
|
function releaseSubtree(e) {
|
|
1395
|
-
let t = e.
|
|
1513
|
+
let t = e.Le;
|
|
1396
1514
|
while (t) {
|
|
1397
|
-
if (t.
|
|
1398
|
-
t = t.
|
|
1515
|
+
if (t.Je) {
|
|
1516
|
+
t = t.Ve;
|
|
1399
1517
|
continue;
|
|
1400
1518
|
}
|
|
1401
|
-
if (t.
|
|
1519
|
+
if (t.de) {
|
|
1402
1520
|
const e = t;
|
|
1403
|
-
e.
|
|
1404
|
-
if (e.
|
|
1405
|
-
e.
|
|
1406
|
-
e.
|
|
1407
|
-
if (dirtyQueue.I > e
|
|
1521
|
+
e.Se &= ~CONFIG_IN_SNAPSHOT_SCOPE;
|
|
1522
|
+
if (e.H & REACTIVE_SNAPSHOT_STALE) {
|
|
1523
|
+
e.H &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1524
|
+
e.H |= REACTIVE_DIRTY;
|
|
1525
|
+
if (dirtyQueue.I > e.$) dirtyQueue.I = e.$;
|
|
1408
1526
|
insertIntoHeap(e, dirtyQueue);
|
|
1409
1527
|
}
|
|
1410
1528
|
}
|
|
1411
1529
|
releaseSubtree(t);
|
|
1412
|
-
t = t.
|
|
1530
|
+
t = t.Ve;
|
|
1413
1531
|
}
|
|
1414
1532
|
}
|
|
1415
1533
|
function clearSnapshots() {
|
|
1416
1534
|
if (snapshotSources) {
|
|
1417
1535
|
for (const e of snapshotSources) {
|
|
1418
|
-
delete e.
|
|
1536
|
+
delete e.pe;
|
|
1419
1537
|
delete e[STORE_SNAPSHOT_PROPS];
|
|
1420
1538
|
}
|
|
1421
1539
|
snapshotSources = null;
|
|
@@ -1423,69 +1541,73 @@ function clearSnapshots() {
|
|
|
1423
1541
|
snapshotCaptureActive = false;
|
|
1424
1542
|
}
|
|
1425
1543
|
function recompute(e, t = false) {
|
|
1426
|
-
const n = e.
|
|
1544
|
+
const n = e.G;
|
|
1427
1545
|
if (!t) {
|
|
1428
1546
|
if (e.T && (!n || activeTransition) && activeTransition !== e.T)
|
|
1429
1547
|
globalQueue.initTransition(e.T);
|
|
1430
|
-
deleteFromHeap(e, e.
|
|
1431
|
-
e.
|
|
1548
|
+
deleteFromHeap(e, e.H & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1549
|
+
e.ke = null;
|
|
1432
1550
|
if (e.T || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1433
|
-
else if (e.
|
|
1551
|
+
else if (e.Le !== null || e.Me !== null) {
|
|
1434
1552
|
markDisposal(e);
|
|
1435
|
-
e.
|
|
1436
|
-
e.
|
|
1437
|
-
e.
|
|
1438
|
-
e.
|
|
1439
|
-
e.
|
|
1553
|
+
e.Re = e.Me;
|
|
1554
|
+
e.Oe = e.Le;
|
|
1555
|
+
e.Me = null;
|
|
1556
|
+
e.Le = null;
|
|
1557
|
+
e.Ge = 0;
|
|
1440
1558
|
} else;
|
|
1441
1559
|
}
|
|
1442
|
-
let i = !!(e.
|
|
1443
|
-
const r = e.
|
|
1444
|
-
!!(e.
|
|
1445
|
-
const o = !!(e.
|
|
1446
|
-
const
|
|
1560
|
+
let i = !!(e.H & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1561
|
+
const r = e.p !== undefined && e.p !== NOT_PENDING;
|
|
1562
|
+
const s = !!(e.q & STATUS_PENDING);
|
|
1563
|
+
const o = !!(e.q & STATUS_UNINITIALIZED);
|
|
1564
|
+
const u = !!(e.H & REACTIVE_REASK) && !(s && !e.qe);
|
|
1565
|
+
const c = context;
|
|
1447
1566
|
context = e;
|
|
1448
|
-
e.
|
|
1449
|
-
e.
|
|
1450
|
-
e.
|
|
1451
|
-
e.
|
|
1452
|
-
let
|
|
1453
|
-
let
|
|
1454
|
-
let
|
|
1455
|
-
|
|
1567
|
+
e.Ue = null;
|
|
1568
|
+
e.Ke++;
|
|
1569
|
+
e.H = REACTIVE_RECOMPUTING_DEPS;
|
|
1570
|
+
e._e = clock;
|
|
1571
|
+
let a = e.m === NOT_PENDING ? e.B : e.m;
|
|
1572
|
+
let l = e.$;
|
|
1573
|
+
let f = tracking;
|
|
1574
|
+
const E = affectsReads;
|
|
1575
|
+
affectsReads = null;
|
|
1576
|
+
let d = null;
|
|
1577
|
+
let S = currentOptimisticLane;
|
|
1456
1578
|
tracking = true;
|
|
1457
1579
|
if (i) {
|
|
1458
1580
|
const t = resolveLane(e);
|
|
1459
1581
|
if (t) currentOptimisticLane = t;
|
|
1460
1582
|
} else if (activeTransition && !t && activeTransition.N.length) {
|
|
1461
|
-
for (let t = e.
|
|
1462
|
-
const n = t.
|
|
1463
|
-
if (n.
|
|
1583
|
+
for (let t = e.he; t; t = t.Ne) {
|
|
1584
|
+
const n = t.Ce;
|
|
1585
|
+
if (n.H & REACTIVE_OPTIMISTIC_DIRTY) {
|
|
1464
1586
|
const t = resolveLane(n);
|
|
1465
1587
|
if (t) {
|
|
1466
1588
|
i = true;
|
|
1467
1589
|
currentOptimisticLane = t;
|
|
1468
|
-
e.
|
|
1590
|
+
e.H |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
1469
1591
|
assignOrMergeLane(e, t);
|
|
1470
1592
|
break;
|
|
1471
1593
|
}
|
|
1472
1594
|
}
|
|
1473
1595
|
}
|
|
1474
1596
|
}
|
|
1475
|
-
const
|
|
1476
|
-
const
|
|
1477
|
-
if (
|
|
1597
|
+
const T = n && n !== EFFECT_USER;
|
|
1598
|
+
const _ = stale;
|
|
1599
|
+
if (T) stale = true;
|
|
1478
1600
|
try {
|
|
1479
|
-
if (!false && e.
|
|
1480
|
-
|
|
1481
|
-
e.
|
|
1601
|
+
if (!false && e.Se & CONFIG_SYNC) {
|
|
1602
|
+
a = e.de(a);
|
|
1603
|
+
e.ke = null;
|
|
1482
1604
|
} else {
|
|
1483
|
-
const t = e.
|
|
1484
|
-
const n = e.
|
|
1605
|
+
const t = e.ke;
|
|
1606
|
+
const n = e.de(a);
|
|
1485
1607
|
const i = typeof n === "object" && n !== null;
|
|
1486
|
-
const r = e.
|
|
1487
|
-
|
|
1488
|
-
if (!r && !i) e.
|
|
1608
|
+
const r = e.ke !== t;
|
|
1609
|
+
a = r || !i ? n : handleAsync(e, n);
|
|
1610
|
+
if (!r && !i) e.ke = null;
|
|
1489
1611
|
}
|
|
1490
1612
|
clearStatus(e, t);
|
|
1491
1613
|
if (e.i) {
|
|
@@ -1504,7 +1626,12 @@ function recompute(e, t = false) {
|
|
|
1504
1626
|
updatePendingSignal(t.o);
|
|
1505
1627
|
}
|
|
1506
1628
|
}
|
|
1507
|
-
|
|
1629
|
+
let n = false;
|
|
1630
|
+
if (t instanceof NotReadyError) {
|
|
1631
|
+
e.Ye = true;
|
|
1632
|
+
n = s && e.qe !== u;
|
|
1633
|
+
e.qe = u;
|
|
1634
|
+
}
|
|
1508
1635
|
notifyStatus(
|
|
1509
1636
|
e,
|
|
1510
1637
|
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
@@ -1512,230 +1639,236 @@ function recompute(e, t = false) {
|
|
|
1512
1639
|
undefined,
|
|
1513
1640
|
t instanceof NotReadyError ? e.i : undefined
|
|
1514
1641
|
);
|
|
1642
|
+
if (n) repollDownstreamVerdicts(e);
|
|
1515
1643
|
} finally {
|
|
1516
|
-
tracking =
|
|
1517
|
-
if (
|
|
1518
|
-
e.
|
|
1519
|
-
context =
|
|
1644
|
+
tracking = f;
|
|
1645
|
+
if (T) stale = _;
|
|
1646
|
+
e.H = REACTIVE_NONE | (t ? e.H & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1647
|
+
context = c;
|
|
1648
|
+
d = affectsReads;
|
|
1649
|
+
affectsReads = E;
|
|
1520
1650
|
}
|
|
1521
|
-
if (!e.
|
|
1651
|
+
if (!e.Te) {
|
|
1522
1652
|
trimStaleDeps(e);
|
|
1523
|
-
const s = r ? e.
|
|
1524
|
-
let
|
|
1653
|
+
const s = r ? e.p : e.m === NOT_PENDING ? e.B : e.m;
|
|
1654
|
+
let u = false;
|
|
1525
1655
|
try {
|
|
1526
|
-
|
|
1656
|
+
u = (!n && o) || !e.Ze || !e.Ze(s, a);
|
|
1527
1657
|
} catch (t) {
|
|
1528
1658
|
notifyStatus(e, STATUS_ERROR, t);
|
|
1529
1659
|
}
|
|
1530
|
-
if (n &&
|
|
1531
|
-
e.
|
|
1532
|
-
if (!t) e.
|
|
1660
|
+
if (n && u) {
|
|
1661
|
+
e.F = !e.Te;
|
|
1662
|
+
if (!t) e.W.enqueue(n, (e.et ??= GlobalQueue.ue.bind(null, e)));
|
|
1533
1663
|
}
|
|
1534
|
-
if (e.
|
|
1535
|
-
else if (
|
|
1536
|
-
const
|
|
1664
|
+
if (e.Te);
|
|
1665
|
+
else if (u) {
|
|
1666
|
+
const s = r ? e.p : undefined;
|
|
1537
1667
|
if (t || (n && activeTransition !== e.T) || i) {
|
|
1538
|
-
e.
|
|
1668
|
+
e.B = a;
|
|
1539
1669
|
if (r && i) {
|
|
1540
|
-
e.
|
|
1541
|
-
e.
|
|
1670
|
+
e.p = a;
|
|
1671
|
+
e.m = NOT_PENDING;
|
|
1542
1672
|
}
|
|
1543
1673
|
} else {
|
|
1544
|
-
e.
|
|
1545
|
-
if (activeTransition || e.T) syncCompanions(e,
|
|
1674
|
+
e.m = a;
|
|
1675
|
+
if (activeTransition || e.T) syncCompanions(e, a);
|
|
1546
1676
|
}
|
|
1547
|
-
if (!r || i || e.
|
|
1677
|
+
if (!r || i || e.p !== s) insertSubs(e, i || r);
|
|
1548
1678
|
} else if (r) {
|
|
1549
|
-
if (e.
|
|
1550
|
-
e.
|
|
1551
|
-
} else if (e
|
|
1552
|
-
for (let t = e.
|
|
1553
|
-
insertIntoHeapHeight(t.
|
|
1679
|
+
if (e.m === NOT_PENDING) queuePendingNode(e);
|
|
1680
|
+
e.m = a;
|
|
1681
|
+
} else if (e.$ != l) {
|
|
1682
|
+
for (let t = e.D; t !== null; t = t.U) {
|
|
1683
|
+
insertIntoHeapHeight(t.k, t.k.H & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1554
1684
|
}
|
|
1555
1685
|
}
|
|
1556
1686
|
}
|
|
1557
|
-
currentOptimisticLane =
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
e.
|
|
1561
|
-
e.
|
|
1562
|
-
|
|
1563
|
-
|
|
1687
|
+
currentOptimisticLane = S;
|
|
1688
|
+
if (d) applyAffectsReads(e, d);
|
|
1689
|
+
const p =
|
|
1690
|
+
e.m !== NOT_PENDING ||
|
|
1691
|
+
e.Oe !== null ||
|
|
1692
|
+
e.Re !== null ||
|
|
1693
|
+
!!(e.q & (STATUS_PENDING | STATUS_UNINITIALIZED));
|
|
1694
|
+
p && (!t || e.q & STATUS_PENDING) && (!e.T || r) && queuePendingNode(e);
|
|
1564
1695
|
e.T && n && activeTransition !== e.T && runInTransition(e.T, () => recompute(e));
|
|
1565
1696
|
}
|
|
1566
1697
|
function updateIfNecessary(e) {
|
|
1567
|
-
if (e.
|
|
1568
|
-
for (let t = e.
|
|
1569
|
-
const n = t.
|
|
1570
|
-
const i = n.
|
|
1571
|
-
if (i.
|
|
1698
|
+
if (e.H & REACTIVE_CHECK) {
|
|
1699
|
+
for (let t = e.he; t; t = t.Ne) {
|
|
1700
|
+
const n = t.Ce;
|
|
1701
|
+
const i = n.ye || n;
|
|
1702
|
+
if (i.de) {
|
|
1572
1703
|
updateIfNecessary(i);
|
|
1573
1704
|
}
|
|
1574
|
-
if (e.
|
|
1705
|
+
if (e.H & REACTIVE_DIRTY) {
|
|
1575
1706
|
break;
|
|
1576
1707
|
}
|
|
1577
1708
|
}
|
|
1578
1709
|
}
|
|
1579
|
-
if (e.
|
|
1710
|
+
if (e.H & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.Te && e._e < clock && !e.ke)) {
|
|
1580
1711
|
recompute(e);
|
|
1581
1712
|
}
|
|
1582
|
-
e.
|
|
1713
|
+
e.H = e.H & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
|
|
1583
1714
|
}
|
|
1584
1715
|
function computed(e, t) {
|
|
1585
1716
|
const n = t?.transparent ?? false;
|
|
1586
1717
|
const i = {
|
|
1587
1718
|
id: t?.id ?? (n ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1588
|
-
|
|
1719
|
+
Se:
|
|
1589
1720
|
(n ? CONFIG_TRANSPARENT : 0) |
|
|
1590
1721
|
(t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
|
|
1591
1722
|
(!context || t?.lazy ? CONFIG_AUTO_DISPOSE : 0) |
|
|
1592
1723
|
(t?.sync ? CONFIG_SYNC : 0) |
|
|
1593
|
-
(t?.
|
|
1724
|
+
(t?.tt ? CONFIG_NO_SNAPSHOT : 0) |
|
|
1594
1725
|
(snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
|
|
1595
|
-
|
|
1596
|
-
|
|
1726
|
+
Ze: t?.equals != null ? t.equals : isEqual,
|
|
1727
|
+
V: t?.unobserved,
|
|
1728
|
+
Me: null,
|
|
1729
|
+
W: context?.W ?? globalQueue,
|
|
1730
|
+
He: context?.He ?? defaultContext,
|
|
1731
|
+
Ge: 0,
|
|
1732
|
+
de: e,
|
|
1733
|
+
B: undefined,
|
|
1734
|
+
$: 0,
|
|
1735
|
+
ve: null,
|
|
1736
|
+
me: undefined,
|
|
1737
|
+
be: null,
|
|
1738
|
+
he: null,
|
|
1597
1739
|
Ue: null,
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
H: 0,
|
|
1604
|
-
ye: null,
|
|
1605
|
-
Ce: undefined,
|
|
1606
|
-
Ne: null,
|
|
1607
|
-
Oe: null,
|
|
1608
|
-
me: null,
|
|
1609
|
-
He: 0,
|
|
1610
|
-
P: null,
|
|
1740
|
+
Ke: 0,
|
|
1741
|
+
D: null,
|
|
1742
|
+
xe: null,
|
|
1743
|
+
te: context,
|
|
1744
|
+
Ve: null,
|
|
1611
1745
|
Fe: null,
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
be: null,
|
|
1623
|
-
T: null
|
|
1746
|
+
Le: null,
|
|
1747
|
+
H: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1748
|
+
q: STATUS_UNINITIALIZED,
|
|
1749
|
+
_e: clock,
|
|
1750
|
+
m: NOT_PENDING,
|
|
1751
|
+
Re: null,
|
|
1752
|
+
Oe: null,
|
|
1753
|
+
ke: null,
|
|
1754
|
+
T: null,
|
|
1755
|
+
qe: false
|
|
1624
1756
|
};
|
|
1625
1757
|
setupComputedNode(i, t);
|
|
1626
1758
|
return i;
|
|
1627
1759
|
}
|
|
1628
|
-
function createEffectNode(e, t, n, i, r,
|
|
1629
|
-
const
|
|
1760
|
+
function createEffectNode(e, t, n, i, r, s) {
|
|
1761
|
+
const o = s?.transparent ?? false;
|
|
1630
1762
|
const u = {
|
|
1631
|
-
id:
|
|
1632
|
-
|
|
1633
|
-
(
|
|
1634
|
-
(
|
|
1635
|
-
(
|
|
1763
|
+
id: s?.id ?? (o ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1764
|
+
Se:
|
|
1765
|
+
(o ? CONFIG_TRANSPARENT : 0) |
|
|
1766
|
+
(s?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
|
|
1767
|
+
(s?.sync ? CONFIG_SYNC : 0) |
|
|
1636
1768
|
(snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
|
|
1637
|
-
|
|
1638
|
-
|
|
1769
|
+
Ze: false,
|
|
1770
|
+
V: s?.unobserved,
|
|
1771
|
+
Me: null,
|
|
1772
|
+
W: context?.W ?? globalQueue,
|
|
1773
|
+
He: context?.He ?? defaultContext,
|
|
1774
|
+
Ge: 0,
|
|
1775
|
+
de: e,
|
|
1776
|
+
B: undefined,
|
|
1777
|
+
$: 0,
|
|
1778
|
+
ve: null,
|
|
1779
|
+
me: undefined,
|
|
1780
|
+
be: null,
|
|
1781
|
+
he: null,
|
|
1639
1782
|
Ue: null,
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
H: 0,
|
|
1646
|
-
ye: null,
|
|
1647
|
-
Ce: undefined,
|
|
1648
|
-
Ne: null,
|
|
1649
|
-
Oe: null,
|
|
1650
|
-
me: null,
|
|
1651
|
-
He: 0,
|
|
1652
|
-
P: null,
|
|
1783
|
+
Ke: 0,
|
|
1784
|
+
D: null,
|
|
1785
|
+
xe: null,
|
|
1786
|
+
te: context,
|
|
1787
|
+
Ve: null,
|
|
1653
1788
|
Fe: null,
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
Se: null,
|
|
1663
|
-
de: null,
|
|
1664
|
-
be: null,
|
|
1789
|
+
Le: null,
|
|
1790
|
+
H: REACTIVE_LAZY,
|
|
1791
|
+
q: STATUS_UNINITIALIZED,
|
|
1792
|
+
_e: clock,
|
|
1793
|
+
m: NOT_PENDING,
|
|
1794
|
+
Re: null,
|
|
1795
|
+
Oe: null,
|
|
1796
|
+
ke: null,
|
|
1665
1797
|
T: null,
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1798
|
+
qe: false,
|
|
1799
|
+
F: false,
|
|
1800
|
+
nt: undefined,
|
|
1801
|
+
it: t,
|
|
1802
|
+
rt: n,
|
|
1803
|
+
We: undefined,
|
|
1804
|
+
G: i,
|
|
1805
|
+
Be: r
|
|
1673
1806
|
};
|
|
1674
1807
|
setupComputedNode(u, lazyOptions);
|
|
1675
1808
|
return u;
|
|
1676
1809
|
}
|
|
1677
1810
|
const lazyOptions = { lazy: true };
|
|
1678
1811
|
function setupComputedNode(e, t) {
|
|
1679
|
-
e.
|
|
1680
|
-
const n = context?.
|
|
1812
|
+
e.be = e;
|
|
1813
|
+
const n = context?.Pe ? context.De : context;
|
|
1681
1814
|
if (context) {
|
|
1682
|
-
const t = context.
|
|
1815
|
+
const t = context.Le;
|
|
1683
1816
|
if (t === null) {
|
|
1684
|
-
context.
|
|
1817
|
+
context.Le = e;
|
|
1685
1818
|
} else {
|
|
1686
|
-
e.
|
|
1687
|
-
t.
|
|
1688
|
-
context.
|
|
1819
|
+
e.Ve = t;
|
|
1820
|
+
t.Fe = e;
|
|
1821
|
+
context.Le = e;
|
|
1689
1822
|
}
|
|
1690
1823
|
}
|
|
1691
|
-
if (n) e
|
|
1824
|
+
if (n) e.$ = n.$ + 1;
|
|
1692
1825
|
if (externalSourceConfig) {
|
|
1693
1826
|
const t = signal(undefined, { equals: false, ownedWrite: true });
|
|
1694
|
-
const n = externalSourceConfig.factory(e.
|
|
1827
|
+
const n = externalSourceConfig.factory(e.de, () => {
|
|
1695
1828
|
setSignal(t, undefined);
|
|
1696
1829
|
});
|
|
1697
1830
|
cleanup(() => n.dispose());
|
|
1698
|
-
e.
|
|
1831
|
+
e.de = e => {
|
|
1699
1832
|
read(t);
|
|
1700
1833
|
return n.track(e);
|
|
1701
1834
|
};
|
|
1702
1835
|
}
|
|
1703
1836
|
!t?.lazy && recompute(e, true);
|
|
1704
1837
|
if (snapshotCaptureActive && !t?.lazy) {
|
|
1705
|
-
if (!(e.
|
|
1706
|
-
e.
|
|
1838
|
+
if (!(e.q & STATUS_PENDING) && !(e.Se & CONFIG_NO_SNAPSHOT)) {
|
|
1839
|
+
e.pe = e.B === undefined ? NO_SNAPSHOT : e.B;
|
|
1707
1840
|
snapshotSources.add(e);
|
|
1708
1841
|
}
|
|
1709
1842
|
}
|
|
1710
1843
|
}
|
|
1711
1844
|
function signal(e, t, n = null) {
|
|
1712
1845
|
const i = {
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1846
|
+
Ze: t?.equals != null ? t.equals : isEqual,
|
|
1847
|
+
Se: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.tt ? CONFIG_NO_SNAPSHOT : 0),
|
|
1848
|
+
V: t?.unobserved,
|
|
1849
|
+
B: e,
|
|
1850
|
+
D: null,
|
|
1851
|
+
xe: null,
|
|
1852
|
+
_e: clock,
|
|
1853
|
+
ye: n,
|
|
1854
|
+
we: n?.ve || null,
|
|
1855
|
+
m: NOT_PENDING
|
|
1723
1856
|
};
|
|
1724
|
-
n && (n.
|
|
1725
|
-
if (snapshotCaptureActive && !(i.
|
|
1726
|
-
i.
|
|
1857
|
+
n && (n.ve = i);
|
|
1858
|
+
if (snapshotCaptureActive && !(i.Se & CONFIG_NO_SNAPSHOT) && !((n?.q ?? 0) & STATUS_PENDING)) {
|
|
1859
|
+
i.pe = e === undefined ? NO_SNAPSHOT : e;
|
|
1727
1860
|
snapshotSources.add(i);
|
|
1728
1861
|
}
|
|
1729
1862
|
return i;
|
|
1730
1863
|
}
|
|
1731
1864
|
function optimisticSignal(e, t) {
|
|
1732
1865
|
const n = signal(e, t);
|
|
1733
|
-
n.
|
|
1866
|
+
n.p = NOT_PENDING;
|
|
1734
1867
|
return n;
|
|
1735
1868
|
}
|
|
1736
1869
|
function optimisticComputed(e, t) {
|
|
1737
1870
|
const n = computed(e, t);
|
|
1738
|
-
n.
|
|
1871
|
+
n.p = NOT_PENDING;
|
|
1739
1872
|
return n;
|
|
1740
1873
|
}
|
|
1741
1874
|
function isEqual(e, t) {
|
|
@@ -1753,10 +1886,10 @@ function untrack(e, t) {
|
|
|
1753
1886
|
}
|
|
1754
1887
|
}
|
|
1755
1888
|
function prepareComputed(e, t) {
|
|
1756
|
-
if (e.
|
|
1757
|
-
e.
|
|
1889
|
+
if (e.H & REACTIVE_LAZY) {
|
|
1890
|
+
e.H &= ~REACTIVE_LAZY;
|
|
1758
1891
|
recompute(e, true);
|
|
1759
|
-
} else if (e.
|
|
1892
|
+
} else if (e.H & REACTIVE_DISPOSED) {
|
|
1760
1893
|
recompute(e, true);
|
|
1761
1894
|
} else if (t) {
|
|
1762
1895
|
updateIfNecessary(e);
|
|
@@ -1767,17 +1900,17 @@ function read(e) {
|
|
|
1767
1900
|
const t = getLatestValueComputed(e);
|
|
1768
1901
|
const n = latestReadActive;
|
|
1769
1902
|
latestReadActive = false;
|
|
1770
|
-
const i = e.
|
|
1903
|
+
const i = e.p !== undefined && e.p !== NOT_PENDING ? e.p : e.B;
|
|
1771
1904
|
let r;
|
|
1772
1905
|
try {
|
|
1773
1906
|
r = read(t);
|
|
1774
1907
|
} catch (t) {
|
|
1775
|
-
if (t instanceof NotReadyError && (!context || !(e.
|
|
1908
|
+
if (t instanceof NotReadyError && (!context || !(e.q & STATUS_UNINITIALIZED))) return i;
|
|
1776
1909
|
throw t;
|
|
1777
1910
|
} finally {
|
|
1778
1911
|
latestReadActive = n;
|
|
1779
1912
|
}
|
|
1780
|
-
if (t.
|
|
1913
|
+
if (t.q & STATUS_PENDING) return i;
|
|
1781
1914
|
if (stale && currentOptimisticLane && t.i) {
|
|
1782
1915
|
const e = findLane(t.i);
|
|
1783
1916
|
const n = findLane(currentOptimisticLane);
|
|
@@ -1788,133 +1921,137 @@ function read(e) {
|
|
|
1788
1921
|
return r;
|
|
1789
1922
|
}
|
|
1790
1923
|
let t = context;
|
|
1791
|
-
if (t?.
|
|
1924
|
+
if (t?.Pe) t = t.De;
|
|
1792
1925
|
const n = e;
|
|
1793
|
-
const i = e.
|
|
1926
|
+
const i = e.ye;
|
|
1794
1927
|
const r = i || e;
|
|
1795
1928
|
if (pendingCheckActive) {
|
|
1796
1929
|
pendingCheckActive = false;
|
|
1797
|
-
if (typeof n.
|
|
1798
|
-
if (t && r.
|
|
1930
|
+
if (typeof n.de === "function") prepareComputed(e, true);
|
|
1931
|
+
if (t && r.q & STATUS_PENDING && r.q & STATUS_UNINITIALIZED) {
|
|
1799
1932
|
if (tracking && e !== t) link(e, t);
|
|
1800
1933
|
pendingCheckActive = true;
|
|
1801
|
-
throw r.
|
|
1934
|
+
throw r.Te;
|
|
1802
1935
|
}
|
|
1803
1936
|
collectPendingSources(e);
|
|
1804
1937
|
if (i) collectPendingSources(i);
|
|
1805
1938
|
pendingCheckActive = true;
|
|
1806
|
-
} else if (typeof n.
|
|
1939
|
+
} else if (typeof n.de === "function") {
|
|
1807
1940
|
prepareComputed(e, false);
|
|
1808
1941
|
}
|
|
1809
1942
|
if (
|
|
1810
|
-
!n.
|
|
1943
|
+
!n.de &&
|
|
1811
1944
|
r === e &&
|
|
1812
|
-
e.
|
|
1813
|
-
e.
|
|
1945
|
+
e.p === undefined &&
|
|
1946
|
+
e.pe === undefined &&
|
|
1814
1947
|
activeTransition === null &&
|
|
1815
1948
|
currentOptimisticLane === null &&
|
|
1816
1949
|
!snapshotCaptureActive &&
|
|
1817
1950
|
true
|
|
1818
1951
|
) {
|
|
1819
|
-
if (t && tracking)
|
|
1820
|
-
|
|
1952
|
+
if (t && tracking) {
|
|
1953
|
+
link(e, t);
|
|
1954
|
+
if (activeAffectsMarks !== 0 && e.L && !pendingCheckActive) (affectsReads ??= []).push(e);
|
|
1955
|
+
}
|
|
1956
|
+
return !t || e.m === NOT_PENDING ? e.B : e.m;
|
|
1821
1957
|
}
|
|
1822
1958
|
if (t && tracking) {
|
|
1823
1959
|
link(e, t, pendingCheckActive);
|
|
1824
|
-
if (
|
|
1825
|
-
|
|
1826
|
-
|
|
1960
|
+
if (activeAffectsMarks !== 0 && e.L && !pendingCheckActive) (affectsReads ??= []).push(e);
|
|
1961
|
+
if (r.de) {
|
|
1962
|
+
const n = e.H & REACTIVE_ZOMBIE;
|
|
1963
|
+
if (r.$ >= (n ? zombieQueue.I : dirtyQueue.I)) {
|
|
1827
1964
|
markNode(t);
|
|
1828
1965
|
markHeap(n ? zombieQueue : dirtyQueue);
|
|
1829
1966
|
updateIfNecessary(r);
|
|
1830
1967
|
}
|
|
1831
|
-
const i = r
|
|
1832
|
-
if (i >= t
|
|
1833
|
-
t
|
|
1968
|
+
const i = r.$;
|
|
1969
|
+
if (i >= t.$ && e.te !== t) {
|
|
1970
|
+
t.$ = i + 1;
|
|
1834
1971
|
}
|
|
1835
1972
|
}
|
|
1836
1973
|
}
|
|
1837
|
-
if (r.
|
|
1974
|
+
if (r.q & STATUS_PENDING) {
|
|
1838
1975
|
if (t && !(stale && r.T && activeTransition !== r.T)) {
|
|
1839
1976
|
if (currentOptimisticLane) {
|
|
1840
1977
|
const n = r.i;
|
|
1841
1978
|
const i = findLane(currentOptimisticLane);
|
|
1842
1979
|
if (n && findLane(n) === i && !hasActiveOverride(r)) {
|
|
1843
1980
|
if (!tracking && e !== t) link(e, t);
|
|
1844
|
-
throw r.
|
|
1981
|
+
throw r.Te;
|
|
1845
1982
|
}
|
|
1846
1983
|
} else {
|
|
1847
1984
|
if (!tracking && e !== t) link(e, t);
|
|
1848
|
-
throw r.
|
|
1985
|
+
throw r.Te;
|
|
1849
1986
|
}
|
|
1850
|
-
} else if (t && r !== e && r.
|
|
1987
|
+
} else if (t && r !== e && r.q & STATUS_UNINITIALIZED) {
|
|
1851
1988
|
if (!tracking && e !== t) link(e, t);
|
|
1852
|
-
throw r.
|
|
1853
|
-
} else if (!t && r.
|
|
1854
|
-
throw r.
|
|
1989
|
+
throw r.Te;
|
|
1990
|
+
} else if (!t && r.q & STATUS_UNINITIALIZED) {
|
|
1991
|
+
throw r.Te;
|
|
1855
1992
|
}
|
|
1856
1993
|
}
|
|
1857
|
-
if (e.
|
|
1858
|
-
if (tracking && !pendingCheckActive && e.
|
|
1994
|
+
if (e.de && e.q & STATUS_ERROR) {
|
|
1995
|
+
if (tracking && !pendingCheckActive && e._e < clock) {
|
|
1859
1996
|
recompute(e);
|
|
1860
1997
|
return read(e);
|
|
1861
|
-
} else throw e.
|
|
1998
|
+
} else throw e.Te;
|
|
1862
1999
|
}
|
|
1863
|
-
if (snapshotCaptureActive && t && t.
|
|
1864
|
-
const n = e.
|
|
2000
|
+
if (snapshotCaptureActive && t && t.Se & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
2001
|
+
const n = e.pe;
|
|
1865
2002
|
if (n !== undefined) {
|
|
1866
2003
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1867
|
-
const r = e.
|
|
1868
|
-
if (r !== i) t.
|
|
2004
|
+
const r = e.m !== NOT_PENDING ? e.m : e.B;
|
|
2005
|
+
if (r !== i) t.H |= REACTIVE_SNAPSHOT_STALE;
|
|
1869
2006
|
return i;
|
|
1870
2007
|
}
|
|
1871
2008
|
}
|
|
1872
|
-
if (e.
|
|
1873
|
-
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.
|
|
1874
|
-
return e.
|
|
2009
|
+
if (e.p !== undefined && e.p !== NOT_PENDING) {
|
|
2010
|
+
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.B;
|
|
2011
|
+
return e.p;
|
|
1875
2012
|
}
|
|
1876
2013
|
if (
|
|
1877
2014
|
activeTransition !== null &&
|
|
1878
2015
|
currentOptimisticLane !== null &&
|
|
1879
2016
|
!latestReadActive &&
|
|
1880
|
-
e.
|
|
1881
|
-
(r === e || !!(r.
|
|
1882
|
-
!e.
|
|
2017
|
+
e.m !== NOT_PENDING &&
|
|
2018
|
+
(r === e || !!(r.H & REACTIVE_MANUAL_WRITE)) &&
|
|
2019
|
+
!e.de &&
|
|
1883
2020
|
t
|
|
1884
2021
|
) {
|
|
1885
|
-
activeTransition.
|
|
1886
|
-
return e.
|
|
2022
|
+
activeTransition.Z.add(t);
|
|
2023
|
+
return e.B;
|
|
1887
2024
|
}
|
|
1888
|
-
const
|
|
2025
|
+
const s =
|
|
1889
2026
|
!t ||
|
|
1890
2027
|
(currentOptimisticLane !== null &&
|
|
1891
|
-
(e.
|
|
1892
|
-
e.
|
|
2028
|
+
(e.p !== undefined || e.i || (r === e && stale && t.t !== e) || !!(r.q & STATUS_PENDING))) ||
|
|
2029
|
+
e.m === NOT_PENDING ||
|
|
1893
2030
|
(stale && e.T && activeTransition !== e.T)
|
|
1894
|
-
? e.
|
|
1895
|
-
: e.
|
|
1896
|
-
if (pendingCheckActive && pendingProbe !== null && e.
|
|
2031
|
+
? e.B
|
|
2032
|
+
: e.m;
|
|
2033
|
+
if (pendingCheckActive && pendingProbe !== null && e.m !== NOT_PENDING && s === e.m)
|
|
1897
2034
|
pendingProbe.freshReads.add(e);
|
|
1898
2035
|
if (
|
|
1899
2036
|
!t &&
|
|
1900
2037
|
r === e &&
|
|
1901
|
-
typeof n.
|
|
1902
|
-
e.
|
|
1903
|
-
!(r.
|
|
1904
|
-
!e.
|
|
2038
|
+
typeof n.de === "function" &&
|
|
2039
|
+
e.Se & CONFIG_AUTO_DISPOSE &&
|
|
2040
|
+
!(r.q & STATUS_PENDING) &&
|
|
2041
|
+
!e.D
|
|
1905
2042
|
) {
|
|
1906
2043
|
unobserved(e);
|
|
1907
2044
|
}
|
|
1908
|
-
return
|
|
2045
|
+
return s;
|
|
1909
2046
|
}
|
|
1910
2047
|
function setSignal(e, t) {
|
|
1911
2048
|
if (e.T && activeTransition !== e.T) globalQueue.initTransition(e.T);
|
|
1912
|
-
const n = e.
|
|
1913
|
-
const i = e.
|
|
1914
|
-
const r = n ? (i ? e.
|
|
2049
|
+
const n = e.p !== undefined && !projectionWriteActive;
|
|
2050
|
+
const i = e.p !== undefined && e.p !== NOT_PENDING;
|
|
2051
|
+
const r = n ? (i ? e.p : e.B) : e.m === NOT_PENDING ? e.B : e.m;
|
|
1915
2052
|
if (typeof t === "function") t = t(r);
|
|
1916
|
-
const
|
|
1917
|
-
if (!
|
|
2053
|
+
const s = !!(e.q & STATUS_UNINITIALIZED) || !e.Ze || !e.Ze(r, t);
|
|
2054
|
+
if (!s) {
|
|
1918
2055
|
if (n && i) {
|
|
1919
2056
|
const t = resolveTransition(e);
|
|
1920
2057
|
if (t && activeTransition !== t) globalQueue.initTransition(t);
|
|
@@ -1922,29 +2059,29 @@ function setSignal(e, t) {
|
|
|
1922
2059
|
return t;
|
|
1923
2060
|
}
|
|
1924
2061
|
if (n) {
|
|
1925
|
-
const n = e.
|
|
2062
|
+
const n = e.p === NOT_PENDING;
|
|
1926
2063
|
if (!n) globalQueue.initTransition(resolveTransition(e));
|
|
1927
2064
|
if (n) globalQueue.N.push(e);
|
|
1928
2065
|
const i = getOrCreateLane(e);
|
|
1929
2066
|
e.i = i;
|
|
1930
|
-
e.
|
|
2067
|
+
e.p = t;
|
|
1931
2068
|
} else {
|
|
1932
|
-
if (e.
|
|
1933
|
-
e.
|
|
2069
|
+
if (e.m === NOT_PENDING) queuePendingNode(e);
|
|
2070
|
+
e.m = t;
|
|
1934
2071
|
}
|
|
1935
2072
|
syncCompanions(e, t);
|
|
1936
|
-
e.
|
|
2073
|
+
e._e = clock;
|
|
1937
2074
|
insertSubs(e, n);
|
|
1938
2075
|
schedule();
|
|
1939
2076
|
return t;
|
|
1940
2077
|
}
|
|
1941
2078
|
function suppressComputedRecompute(e) {
|
|
1942
|
-
deleteFromHeap(e, e.
|
|
1943
|
-
if (!(e.
|
|
2079
|
+
deleteFromHeap(e, e.H & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
2080
|
+
if (!(e.H & REACTIVE_MANUAL_WRITE) && e.m === NOT_PENDING) {
|
|
1944
2081
|
queuePendingNode(e);
|
|
1945
2082
|
schedule();
|
|
1946
2083
|
}
|
|
1947
|
-
e.
|
|
2084
|
+
e.H = (e.H & -4) | REACTIVE_MANUAL_WRITE;
|
|
1948
2085
|
}
|
|
1949
2086
|
function setMemo(e, t) {
|
|
1950
2087
|
const n = setSignal(e, t);
|
|
@@ -1964,75 +2101,107 @@ function runWithOwner(e, t) {
|
|
|
1964
2101
|
}
|
|
1965
2102
|
}
|
|
1966
2103
|
function getPendingSignal(e) {
|
|
1967
|
-
if (!e.
|
|
1968
|
-
e.
|
|
1969
|
-
e.
|
|
1970
|
-
if (computePendingState(e)) setSignal(e.
|
|
2104
|
+
if (!e.X) {
|
|
2105
|
+
e.X = optimisticSignal(false, { ownedWrite: true });
|
|
2106
|
+
e.X.t = e;
|
|
2107
|
+
if (computePendingState(e)) setSignal(e.X, true);
|
|
1971
2108
|
}
|
|
1972
|
-
return e.
|
|
2109
|
+
return e.X;
|
|
1973
2110
|
}
|
|
1974
2111
|
function collectPendingSources(e) {
|
|
1975
2112
|
if (!pendingProbe) return;
|
|
1976
2113
|
pendingProbe.sources.add(e);
|
|
1977
|
-
const t = e.
|
|
2114
|
+
const t = e.ye || e;
|
|
1978
2115
|
if (t !== e) pendingProbe.sources.add(t);
|
|
1979
2116
|
}
|
|
2117
|
+
function witnessAffects(e) {
|
|
2118
|
+
pendingProbe?.sources.add(e);
|
|
2119
|
+
}
|
|
2120
|
+
function quietPending(e) {
|
|
2121
|
+
if (e.Ae) {
|
|
2122
|
+
for (const t of e.Ae) if (!t.qe) return false;
|
|
2123
|
+
return true;
|
|
2124
|
+
}
|
|
2125
|
+
if (e.Ie) return e.Ie.qe;
|
|
2126
|
+
return e.qe;
|
|
2127
|
+
}
|
|
2128
|
+
function newQuestionInFlight(e) {
|
|
2129
|
+
return !!(e.q & STATUS_PENDING) && !(e.q & STATUS_UNINITIALIZED) && !quietPending(e);
|
|
2130
|
+
}
|
|
1980
2131
|
function computePendingState(e) {
|
|
1981
2132
|
const t = e;
|
|
1982
|
-
if (t.
|
|
1983
|
-
|
|
1984
|
-
|
|
2133
|
+
if (t.H & REACTIVE_DISPOSED) return false;
|
|
2134
|
+
if (e.L) return true;
|
|
2135
|
+
const n = e.ye;
|
|
1985
2136
|
if (e.t) {
|
|
1986
2137
|
const t = e.t;
|
|
1987
|
-
if (
|
|
1988
|
-
const n = t.
|
|
1989
|
-
|
|
1990
|
-
|
|
2138
|
+
if (t.L) return true;
|
|
2139
|
+
const n = t.ye || t;
|
|
2140
|
+
return newQuestionInFlight(n);
|
|
2141
|
+
}
|
|
2142
|
+
if (n && e.m !== NOT_PENDING && !hasActiveOverride(e)) {
|
|
2143
|
+
return (
|
|
2144
|
+
!!(n.H & REACTIVE_MANUAL_WRITE) ||
|
|
2145
|
+
(!n.ke && !(n.q & STATUS_PENDING)) ||
|
|
2146
|
+
(!!(n.q & STATUS_PENDING) && quietPending(n))
|
|
2147
|
+
);
|
|
1991
2148
|
}
|
|
1992
|
-
if (
|
|
1993
|
-
|
|
1994
|
-
return
|
|
2149
|
+
if (e.m !== NOT_PENDING && !(t.q & STATUS_UNINITIALIZED)) {
|
|
2150
|
+
if (hasActiveOverride(e)) return !e.Ze || !e.Ze(e.m, e.p);
|
|
2151
|
+
return true;
|
|
1995
2152
|
}
|
|
1996
|
-
|
|
1997
|
-
return !!(t.Y & STATUS_PENDING && !(t.Y & STATUS_UNINITIALIZED));
|
|
2153
|
+
return newQuestionInFlight(t);
|
|
1998
2154
|
}
|
|
1999
2155
|
function syncCompanions(e, t) {
|
|
2000
|
-
if (e.
|
|
2001
|
-
if (e.
|
|
2156
|
+
if (e.X) updatePendingSignal(e);
|
|
2157
|
+
if (e.J) setSignal(e.J, t);
|
|
2002
2158
|
}
|
|
2003
2159
|
function updatePendingSignal(e) {
|
|
2004
|
-
if (e.
|
|
2005
|
-
setSignal(e.
|
|
2160
|
+
if (e.X) {
|
|
2161
|
+
setSignal(e.X, computePendingState(e));
|
|
2006
2162
|
}
|
|
2007
|
-
if (e.
|
|
2163
|
+
if (e.J) updatePendingSignal(e.J);
|
|
2008
2164
|
}
|
|
2009
2165
|
function updateChildCompanions(e) {
|
|
2010
|
-
for (let t = e.
|
|
2011
|
-
if (t.
|
|
2166
|
+
for (let t = e.ve; t !== null; t = t.we) {
|
|
2167
|
+
if (t.X || t.J) updatePendingSignal(t);
|
|
2012
2168
|
}
|
|
2013
2169
|
}
|
|
2170
|
+
function repollDownstreamVerdicts(e) {
|
|
2171
|
+
const t = new Set();
|
|
2172
|
+
const visit = e => {
|
|
2173
|
+
if (t.has(e)) return;
|
|
2174
|
+
t.add(e);
|
|
2175
|
+
if (e.X || e.J) updatePendingSignal(e);
|
|
2176
|
+
for (let t = e.D; t !== null; t = t.U) visit(t.k);
|
|
2177
|
+
for (let t = e.ve ?? null; t !== null; t = t.we) {
|
|
2178
|
+
visit(t);
|
|
2179
|
+
}
|
|
2180
|
+
};
|
|
2181
|
+
visit(e);
|
|
2182
|
+
}
|
|
2014
2183
|
function snapCompanionsToState(e) {
|
|
2015
|
-
const t = e.
|
|
2016
|
-
if (t && (t.
|
|
2184
|
+
const t = e.X;
|
|
2185
|
+
if (t && (t.p === undefined || t.p === NOT_PENDING)) {
|
|
2017
2186
|
const n = computePendingState(e);
|
|
2018
|
-
if (t.
|
|
2019
|
-
t.
|
|
2020
|
-
t.
|
|
2021
|
-
t.
|
|
2187
|
+
if (t.B !== n || t.m !== NOT_PENDING) {
|
|
2188
|
+
t.B = n;
|
|
2189
|
+
t.m = NOT_PENDING;
|
|
2190
|
+
t._e = clock;
|
|
2022
2191
|
insertSubs(t);
|
|
2023
2192
|
schedule();
|
|
2024
2193
|
}
|
|
2025
2194
|
}
|
|
2026
|
-
const n = e.
|
|
2027
|
-
if (n && !(n.
|
|
2195
|
+
const n = e.J;
|
|
2196
|
+
if (n && !(n.H & REACTIVE_DISPOSED)) {
|
|
2028
2197
|
if (
|
|
2029
|
-
(n.
|
|
2030
|
-
n.
|
|
2031
|
-
!Object.is(n.
|
|
2032
|
-
!(n.
|
|
2198
|
+
(n.p === undefined || n.p === NOT_PENDING) &&
|
|
2199
|
+
n.m === NOT_PENDING &&
|
|
2200
|
+
!Object.is(n.B, e.B) &&
|
|
2201
|
+
!(n.H & (REACTIVE_DIRTY | REACTIVE_CHECK))
|
|
2033
2202
|
) {
|
|
2034
|
-
n.
|
|
2035
|
-
insertIntoHeap(n, n.
|
|
2203
|
+
n.H |= REACTIVE_DIRTY;
|
|
2204
|
+
insertIntoHeap(n, n.H & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
2036
2205
|
insertSubs(n);
|
|
2037
2206
|
schedule();
|
|
2038
2207
|
}
|
|
@@ -2040,20 +2209,20 @@ function snapCompanionsToState(e) {
|
|
|
2040
2209
|
}
|
|
2041
2210
|
}
|
|
2042
2211
|
function getLatestValueComputed(e) {
|
|
2043
|
-
if (!e.
|
|
2212
|
+
if (!e.J) {
|
|
2044
2213
|
const t = latestReadActive;
|
|
2045
2214
|
latestReadActive = false;
|
|
2046
2215
|
const n = pendingCheckActive;
|
|
2047
2216
|
pendingCheckActive = false;
|
|
2048
2217
|
const i = context;
|
|
2049
2218
|
context = null;
|
|
2050
|
-
e.
|
|
2051
|
-
e.
|
|
2219
|
+
e.J = optimisticComputed(() => read(e));
|
|
2220
|
+
e.J.t = e;
|
|
2052
2221
|
context = i;
|
|
2053
2222
|
pendingCheckActive = n;
|
|
2054
2223
|
latestReadActive = t;
|
|
2055
2224
|
}
|
|
2056
|
-
return e.
|
|
2225
|
+
return e.J;
|
|
2057
2226
|
}
|
|
2058
2227
|
function staleValues(e, t = true) {
|
|
2059
2228
|
const n = stale;
|
|
@@ -2095,8 +2264,9 @@ function isPending(e) {
|
|
|
2095
2264
|
} catch (e) {
|
|
2096
2265
|
collectPending();
|
|
2097
2266
|
if (e instanceof NotReadyError) {
|
|
2098
|
-
|
|
2099
|
-
if (
|
|
2267
|
+
const t = !!(e.source?.q & STATUS_UNINITIALIZED);
|
|
2268
|
+
if (i.found && !t) return true;
|
|
2269
|
+
if (context && t) throw e;
|
|
2100
2270
|
}
|
|
2101
2271
|
return i.found;
|
|
2102
2272
|
} finally {
|
|
@@ -2109,9 +2279,13 @@ function refresh(e) {
|
|
|
2109
2279
|
if (!t) {
|
|
2110
2280
|
return;
|
|
2111
2281
|
}
|
|
2112
|
-
if (typeof t.
|
|
2113
|
-
|
|
2114
|
-
|
|
2282
|
+
if (typeof t.de === "function" && !(t.H & (REACTIVE_DISPOSED | REACTIVE_MANUAL_WRITE))) {
|
|
2283
|
+
if (!(t.H & (REACTIVE_DIRTY | REACTIVE_CHECK | REACTIVE_IN_HEAP))) {
|
|
2284
|
+
t.H |= REACTIVE_REASK;
|
|
2285
|
+
armReaskClear();
|
|
2286
|
+
}
|
|
2287
|
+
t.H = (t.H & ~REACTIVE_CHECK) | REACTIVE_DIRTY;
|
|
2288
|
+
insertIntoHeap(t, t.H & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
2115
2289
|
schedule();
|
|
2116
2290
|
}
|
|
2117
2291
|
}
|
|
@@ -2122,7 +2296,7 @@ function getContext(e, t = getOwner()) {
|
|
|
2122
2296
|
if (!t) {
|
|
2123
2297
|
throw new NoOwnerError();
|
|
2124
2298
|
}
|
|
2125
|
-
const n = hasContext(e, t) ? t.
|
|
2299
|
+
const n = hasContext(e, t) ? t.He[e.id] : e.defaultValue;
|
|
2126
2300
|
if (isUndefined(n)) {
|
|
2127
2301
|
throw new ContextNotFoundError();
|
|
2128
2302
|
}
|
|
@@ -2132,119 +2306,119 @@ function setContext(e, t, n = getOwner()) {
|
|
|
2132
2306
|
if (!n) {
|
|
2133
2307
|
throw new NoOwnerError();
|
|
2134
2308
|
}
|
|
2135
|
-
n.
|
|
2309
|
+
n.He = { ...n.He, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
2136
2310
|
}
|
|
2137
2311
|
function hasContext(e, t) {
|
|
2138
|
-
return !isUndefined(t?.
|
|
2312
|
+
return !isUndefined(t?.He[e.id]);
|
|
2139
2313
|
}
|
|
2140
2314
|
function isUndefined(e) {
|
|
2141
2315
|
return typeof e === "undefined";
|
|
2142
2316
|
}
|
|
2143
2317
|
function effect(e, t, n, i) {
|
|
2144
2318
|
const r = !!i?.user;
|
|
2145
|
-
const
|
|
2146
|
-
recompute(
|
|
2319
|
+
const s = createEffectNode(e, t, n, r ? EFFECT_USER : EFFECT_RENDER, notifyEffectStatus, i);
|
|
2320
|
+
recompute(s, true);
|
|
2147
2321
|
!i?.defer &&
|
|
2148
|
-
(
|
|
2322
|
+
(s.G === EFFECT_USER || i?.schedule ? s.W.enqueue(s.G, runEffect.bind(null, s)) : runEffect(s));
|
|
2149
2323
|
}
|
|
2150
2324
|
function notifyEffectStatus(e, t) {
|
|
2151
|
-
const n = e !== undefined ? e : this.
|
|
2152
|
-
const i = t !== undefined ? t : this.
|
|
2325
|
+
const n = e !== undefined ? e : this.q;
|
|
2326
|
+
const i = t !== undefined ? t : this.Te;
|
|
2153
2327
|
if (n & STATUS_ERROR) {
|
|
2154
|
-
this.
|
|
2155
|
-
if (this.
|
|
2156
|
-
if (this.
|
|
2157
|
-
this.
|
|
2158
|
-
this.
|
|
2328
|
+
this.W.notify(this, STATUS_PENDING, 0);
|
|
2329
|
+
if (this.G === EFFECT_USER) {
|
|
2330
|
+
if (this.q & STATUS_ERROR) {
|
|
2331
|
+
this.F = true;
|
|
2332
|
+
this.W.enqueue(this.G, (this.et ??= runEffect.bind(null, this)));
|
|
2159
2333
|
}
|
|
2160
2334
|
return;
|
|
2161
2335
|
}
|
|
2162
|
-
if (!this.
|
|
2336
|
+
if (!this.W.notify(this, STATUS_ERROR, STATUS_ERROR)) {
|
|
2163
2337
|
haltReactivity();
|
|
2164
2338
|
throw i;
|
|
2165
2339
|
}
|
|
2166
|
-
} else if (this.
|
|
2167
|
-
this.
|
|
2340
|
+
} else if (this.G === EFFECT_RENDER) {
|
|
2341
|
+
this.W.notify(this, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
2168
2342
|
}
|
|
2169
2343
|
}
|
|
2170
2344
|
function runEffect(e) {
|
|
2171
|
-
if (!e.
|
|
2172
|
-
if (e.
|
|
2173
|
-
const t =
|
|
2174
|
-
e.
|
|
2175
|
-
e.
|
|
2345
|
+
if (!e.F || e.H & REACTIVE_DISPOSED) return;
|
|
2346
|
+
if (e.q & STATUS_ERROR && e.G === EFFECT_USER) {
|
|
2347
|
+
const t = unwrapStatusError(e.Te);
|
|
2348
|
+
e.nt = e.B;
|
|
2349
|
+
e.F = false;
|
|
2176
2350
|
try {
|
|
2177
|
-
e.
|
|
2178
|
-
? e.
|
|
2179
|
-
const t = e.
|
|
2180
|
-
e.
|
|
2351
|
+
e.rt
|
|
2352
|
+
? e.rt(t, () => {
|
|
2353
|
+
const t = e.We;
|
|
2354
|
+
e.We = undefined;
|
|
2181
2355
|
t?.();
|
|
2182
2356
|
})
|
|
2183
2357
|
: console.error(t);
|
|
2184
2358
|
} catch (t) {
|
|
2185
|
-
if (!e.
|
|
2359
|
+
if (!e.W.notify(e, STATUS_ERROR, STATUS_ERROR)) {
|
|
2186
2360
|
haltReactivity();
|
|
2187
2361
|
throw t;
|
|
2188
2362
|
}
|
|
2189
2363
|
}
|
|
2190
2364
|
return;
|
|
2191
2365
|
}
|
|
2192
|
-
const t = e.
|
|
2193
|
-
e.
|
|
2366
|
+
const t = e.We;
|
|
2367
|
+
e.We = undefined;
|
|
2194
2368
|
try {
|
|
2195
2369
|
t?.();
|
|
2196
|
-
const n = e.
|
|
2370
|
+
const n = e.it(e.B, e.nt);
|
|
2197
2371
|
if (false && n !== undefined && typeof n !== "function");
|
|
2198
|
-
e.
|
|
2372
|
+
e.We = n;
|
|
2199
2373
|
} catch (t) {
|
|
2200
|
-
e.
|
|
2201
|
-
e.
|
|
2202
|
-
if (!e.
|
|
2374
|
+
e.Te = new StatusError(e, t);
|
|
2375
|
+
e.q |= STATUS_ERROR;
|
|
2376
|
+
if (!e.W.notify(e, STATUS_ERROR, STATUS_ERROR)) {
|
|
2203
2377
|
haltReactivity();
|
|
2204
2378
|
throw t;
|
|
2205
2379
|
}
|
|
2206
2380
|
} finally {
|
|
2207
|
-
e.
|
|
2208
|
-
e.
|
|
2381
|
+
e.nt = e.B;
|
|
2382
|
+
e.F = false;
|
|
2209
2383
|
}
|
|
2210
2384
|
}
|
|
2211
|
-
GlobalQueue.
|
|
2385
|
+
GlobalQueue.ue = runEffect;
|
|
2212
2386
|
function trackedEffect(e, t) {
|
|
2213
2387
|
const run = () => {
|
|
2214
|
-
if (!n.
|
|
2388
|
+
if (!n.F || n.H & REACTIVE_DISPOSED) return;
|
|
2215
2389
|
try {
|
|
2216
|
-
n.
|
|
2390
|
+
n.F = false;
|
|
2217
2391
|
recompute(n);
|
|
2218
2392
|
} finally {
|
|
2219
2393
|
}
|
|
2220
2394
|
};
|
|
2221
2395
|
const n = computed(
|
|
2222
2396
|
() => {
|
|
2223
|
-
const t = n.
|
|
2224
|
-
n.
|
|
2397
|
+
const t = n.We;
|
|
2398
|
+
n.We = undefined;
|
|
2225
2399
|
t?.();
|
|
2226
2400
|
const i = staleValues(e);
|
|
2227
|
-
n.
|
|
2401
|
+
n.We = i;
|
|
2228
2402
|
},
|
|
2229
2403
|
{ ...t, lazy: true }
|
|
2230
2404
|
);
|
|
2231
|
-
n.
|
|
2232
|
-
n.
|
|
2233
|
-
n.
|
|
2234
|
-
n.
|
|
2235
|
-
n.
|
|
2236
|
-
const i = e !== undefined ? e : n.
|
|
2405
|
+
n.We = undefined;
|
|
2406
|
+
n.Se = (n.Se & ~CONFIG_AUTO_DISPOSE) | CONFIG_CHILDREN_FORBIDDEN;
|
|
2407
|
+
n.F = true;
|
|
2408
|
+
n.G = EFFECT_TRACKED;
|
|
2409
|
+
n.Be = (e, t) => {
|
|
2410
|
+
const i = e !== undefined ? e : n.q;
|
|
2237
2411
|
if (i & STATUS_ERROR) {
|
|
2238
|
-
n.
|
|
2239
|
-
const e = t !== undefined ? t : n.
|
|
2240
|
-
if (!n.
|
|
2412
|
+
n.W.notify(n, STATUS_PENDING, 0);
|
|
2413
|
+
const e = t !== undefined ? t : n.Te;
|
|
2414
|
+
if (!n.W.notify(n, STATUS_ERROR, STATUS_ERROR)) {
|
|
2241
2415
|
haltReactivity();
|
|
2242
2416
|
throw e;
|
|
2243
2417
|
}
|
|
2244
2418
|
}
|
|
2245
2419
|
};
|
|
2246
|
-
n.
|
|
2247
|
-
n.
|
|
2420
|
+
n.M = run;
|
|
2421
|
+
n.W.enqueue(EFFECT_USER, run);
|
|
2248
2422
|
}
|
|
2249
2423
|
function restoreTransition(e, t) {
|
|
2250
2424
|
globalQueue.initTransition(e);
|
|
@@ -2257,34 +2431,34 @@ function action(e) {
|
|
|
2257
2431
|
new Promise((n, i) => {
|
|
2258
2432
|
const r = e(...t);
|
|
2259
2433
|
globalQueue.initTransition();
|
|
2260
|
-
let
|
|
2261
|
-
|
|
2262
|
-
const done = (e, t) => {
|
|
2263
|
-
|
|
2264
|
-
const
|
|
2265
|
-
if (
|
|
2266
|
-
setActiveTransition(
|
|
2434
|
+
let s = activeTransition;
|
|
2435
|
+
s.K.push(r);
|
|
2436
|
+
const done = (e, t, o = false) => {
|
|
2437
|
+
s = currentTransition(s);
|
|
2438
|
+
const u = s.K.indexOf(r);
|
|
2439
|
+
if (u >= 0) s.K.splice(u, 1);
|
|
2440
|
+
setActiveTransition(s);
|
|
2267
2441
|
schedule();
|
|
2268
|
-
|
|
2442
|
+
o ? i(t) : n(e);
|
|
2269
2443
|
};
|
|
2270
2444
|
const step = (e, t) => {
|
|
2271
2445
|
let n;
|
|
2272
2446
|
try {
|
|
2273
2447
|
n = t ? r.throw(e) : r.next(e);
|
|
2274
2448
|
} catch (e) {
|
|
2275
|
-
return done(undefined, e);
|
|
2449
|
+
return done(undefined, e, true);
|
|
2276
2450
|
}
|
|
2277
|
-
if (isThenable(n)) return void n.then(run, e => done(undefined, e));
|
|
2451
|
+
if (isThenable(n)) return void n.then(run, e => done(undefined, e, true));
|
|
2278
2452
|
run(n);
|
|
2279
2453
|
};
|
|
2280
2454
|
const run = e => {
|
|
2281
2455
|
if (e.done) return done(e.value);
|
|
2282
2456
|
if (isThenable(e.value))
|
|
2283
2457
|
return void e.value.then(
|
|
2284
|
-
e => restoreTransition(
|
|
2285
|
-
e => restoreTransition(
|
|
2458
|
+
e => restoreTransition(s, () => step(e)),
|
|
2459
|
+
e => restoreTransition(s, () => step(e, true))
|
|
2286
2460
|
);
|
|
2287
|
-
restoreTransition(
|
|
2461
|
+
restoreTransition(s, () => step(e.value));
|
|
2288
2462
|
};
|
|
2289
2463
|
step();
|
|
2290
2464
|
});
|
|
@@ -2300,7 +2474,7 @@ function accessor(e) {
|
|
|
2300
2474
|
function createSignal(e, t) {
|
|
2301
2475
|
if (typeof e === "function") {
|
|
2302
2476
|
const n = computed(e, t);
|
|
2303
|
-
n.
|
|
2477
|
+
n.Se &= ~CONFIG_AUTO_DISPOSE;
|
|
2304
2478
|
return [accessor(n), setMemo.bind(null, n)];
|
|
2305
2479
|
}
|
|
2306
2480
|
const n = signal(e, t);
|
|
@@ -2322,11 +2496,17 @@ function createReaction(e, t) {
|
|
|
2322
2496
|
let n = undefined;
|
|
2323
2497
|
cleanup(() => n?.());
|
|
2324
2498
|
const i = getOwner();
|
|
2325
|
-
|
|
2499
|
+
let r;
|
|
2500
|
+
return s => {
|
|
2501
|
+
if (r) {
|
|
2502
|
+
dispose(r);
|
|
2503
|
+
r = undefined;
|
|
2504
|
+
}
|
|
2326
2505
|
runWithOwner(i, () => {
|
|
2327
2506
|
effect(
|
|
2328
|
-
() => (
|
|
2507
|
+
() => (s(), (r = getOwner())),
|
|
2329
2508
|
t => {
|
|
2509
|
+
r = undefined;
|
|
2330
2510
|
n?.();
|
|
2331
2511
|
const i = (e.effect || e)?.();
|
|
2332
2512
|
if (false && i !== undefined && typeof i !== "function");
|
|
@@ -2360,7 +2540,7 @@ function resolve(e) {
|
|
|
2360
2540
|
function createOptimistic(e, t) {
|
|
2361
2541
|
if (typeof e === "function") {
|
|
2362
2542
|
const n = optimisticComputed(e, t);
|
|
2363
|
-
n.
|
|
2543
|
+
n.Se &= ~CONFIG_AUTO_DISPOSE;
|
|
2364
2544
|
return [accessor(n), setSignal.bind(null, n)];
|
|
2365
2545
|
}
|
|
2366
2546
|
const n = optimisticSignal(e, t);
|
|
@@ -2368,7 +2548,7 @@ function createOptimistic(e, t) {
|
|
|
2368
2548
|
}
|
|
2369
2549
|
function onSettled(e) {
|
|
2370
2550
|
const t = getOwner();
|
|
2371
|
-
t && !(t.
|
|
2551
|
+
t && !(t.Se & CONFIG_CHILDREN_FORBIDDEN)
|
|
2372
2552
|
? createTrackedEffect(() => untrack(e), undefined)
|
|
2373
2553
|
: globalQueue.enqueue(EFFECT_USER, () => {
|
|
2374
2554
|
e();
|
|
@@ -2400,11 +2580,11 @@ function addEnumSymbols(e, t, n) {
|
|
|
2400
2580
|
function getAllKeys(e, t, n) {
|
|
2401
2581
|
const i = getKeys(e, t);
|
|
2402
2582
|
const r = Object.keys(n);
|
|
2403
|
-
const
|
|
2583
|
+
const s = e[$TARGET]
|
|
2404
2584
|
? untrack(() => Object.getOwnPropertySymbols(e))
|
|
2405
2585
|
: Object.getOwnPropertySymbols(e);
|
|
2406
|
-
const
|
|
2407
|
-
if (
|
|
2586
|
+
const o = Object.getOwnPropertySymbols(n);
|
|
2587
|
+
if (s.length === 0 && o.length === 0) {
|
|
2408
2588
|
if (i.length === r.length) {
|
|
2409
2589
|
let e = true;
|
|
2410
2590
|
for (let t = 0; t < i.length; t++) {
|
|
@@ -2420,14 +2600,14 @@ function getAllKeys(e, t, n) {
|
|
|
2420
2600
|
return Array.from(e);
|
|
2421
2601
|
}
|
|
2422
2602
|
const u = new Set(i);
|
|
2423
|
-
addEnumSymbols(e,
|
|
2603
|
+
addEnumSymbols(e, s, u);
|
|
2424
2604
|
if (t) {
|
|
2425
2605
|
for (const e of Reflect.ownKeys(t)) {
|
|
2426
2606
|
t[e] === $DELETED ? u.delete(e) : u.add(e);
|
|
2427
2607
|
}
|
|
2428
2608
|
}
|
|
2429
2609
|
for (let e = 0; e < r.length; e++) u.add(r[e]);
|
|
2430
|
-
addEnumSymbols(n,
|
|
2610
|
+
addEnumSymbols(n, o, u);
|
|
2431
2611
|
return Array.from(u);
|
|
2432
2612
|
}
|
|
2433
2613
|
function wrapValue(e, t) {
|
|
@@ -2458,9 +2638,9 @@ function syncArrayNodeMembership(e, t) {
|
|
|
2458
2638
|
}
|
|
2459
2639
|
function applyArrayItem(e, t, n, i, r) {
|
|
2460
2640
|
if (isWrappable(e) && isWrappable(t)) {
|
|
2461
|
-
const
|
|
2462
|
-
i && setSignal(i,
|
|
2463
|
-
applyState(e,
|
|
2641
|
+
const s = wrap(t, n);
|
|
2642
|
+
i && setSignal(i, s);
|
|
2643
|
+
applyState(e, s, r);
|
|
2464
2644
|
} else i && setSignal(i, wrapValue(e, n));
|
|
2465
2645
|
}
|
|
2466
2646
|
function applyState(e, t, n) {
|
|
@@ -2480,45 +2660,45 @@ function applyStateFast(e, t, n) {
|
|
|
2480
2660
|
(t[STORE_LOOKUP] || storeLookup).set(e, t[$PROXY]);
|
|
2481
2661
|
t[STORE_VALUE] = e;
|
|
2482
2662
|
if (Array.isArray(i)) {
|
|
2483
|
-
let
|
|
2484
|
-
const
|
|
2485
|
-
if (e.length &&
|
|
2486
|
-
let u, c,
|
|
2487
|
-
for (
|
|
2488
|
-
isWrappable(E) && isWrappable(e[
|
|
2663
|
+
let s = false;
|
|
2664
|
+
const o = i.length;
|
|
2665
|
+
if (e.length && o && isWrappable(e[0]) && n(e[0]) != null) {
|
|
2666
|
+
let u, c, a, l, f, E, d, S;
|
|
2667
|
+
for (a = 0, l = Math.min(o, e.length); a < l && keyedMatch((E = i[a]), e[a], n); a++) {
|
|
2668
|
+
isWrappable(E) && isWrappable(e[a]) && applyState(e[a], wrap(E, t), n);
|
|
2489
2669
|
}
|
|
2490
2670
|
const T = new Array(e.length),
|
|
2491
2671
|
_ = new Map();
|
|
2492
2672
|
for (
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2673
|
+
l = o - 1, f = e.length - 1;
|
|
2674
|
+
l >= a && f >= a && keyedMatch((E = i[l]), e[f], n);
|
|
2675
|
+
l--, f--
|
|
2496
2676
|
) {
|
|
2497
2677
|
T[f] = E;
|
|
2498
2678
|
}
|
|
2499
|
-
if (
|
|
2500
|
-
for (c =
|
|
2501
|
-
|
|
2679
|
+
if (a > f || a > l) {
|
|
2680
|
+
for (c = a; c <= f; c++) {
|
|
2681
|
+
s = true;
|
|
2502
2682
|
r?.[c] && setSignal(r[c], wrapValue(e[c], t));
|
|
2503
2683
|
}
|
|
2504
2684
|
for (; c < e.length; c++) {
|
|
2505
|
-
|
|
2685
|
+
s = true;
|
|
2506
2686
|
applyArrayItem(e[c], T[c], t, r?.[c], n);
|
|
2507
2687
|
}
|
|
2508
2688
|
syncArrayNodeMembership(t, e);
|
|
2509
|
-
(
|
|
2510
|
-
|
|
2689
|
+
(s || o !== e.length) && notifySelf(t);
|
|
2690
|
+
o !== e.length && r?.length && setSignal(r.length, e.length);
|
|
2511
2691
|
return;
|
|
2512
2692
|
}
|
|
2513
2693
|
d = new Array(f + 1);
|
|
2514
|
-
for (c = f; c >=
|
|
2694
|
+
for (c = f; c >= a; c--) {
|
|
2515
2695
|
E = e[c];
|
|
2516
2696
|
S = itemKey(E, n);
|
|
2517
2697
|
u = _.get(S);
|
|
2518
2698
|
d[c] = u === undefined ? -1 : u;
|
|
2519
2699
|
_.set(S, c);
|
|
2520
2700
|
}
|
|
2521
|
-
for (u =
|
|
2701
|
+
for (u = a; u <= l; u++) {
|
|
2522
2702
|
E = i[u];
|
|
2523
2703
|
S = itemKey(E, n);
|
|
2524
2704
|
c = _.get(S);
|
|
@@ -2528,155 +2708,155 @@ function applyStateFast(e, t, n) {
|
|
|
2528
2708
|
_.set(S, c);
|
|
2529
2709
|
}
|
|
2530
2710
|
}
|
|
2531
|
-
for (c =
|
|
2711
|
+
for (c = a; c < e.length; c++) {
|
|
2532
2712
|
if (c in T) {
|
|
2533
2713
|
applyArrayItem(e[c], T[c], t, r?.[c], n);
|
|
2534
2714
|
} else r?.[c] && setSignal(r[c], wrapValue(e[c], t));
|
|
2535
2715
|
}
|
|
2536
|
-
if (
|
|
2716
|
+
if (a < e.length) s = true;
|
|
2537
2717
|
} else if (e.length) {
|
|
2538
|
-
for (let
|
|
2539
|
-
const u = i[
|
|
2540
|
-
if (isWrappable(u) && isWrappable(e[
|
|
2718
|
+
for (let o = 0, u = e.length; o < u; o++) {
|
|
2719
|
+
const u = i[o];
|
|
2720
|
+
if (isWrappable(u) && isWrappable(e[o])) applyState(e[o], wrap(u, t), n);
|
|
2541
2721
|
else {
|
|
2542
|
-
if (u !== e[
|
|
2543
|
-
r?.[
|
|
2722
|
+
if (u !== e[o]) s = true;
|
|
2723
|
+
r?.[o] && setSignal(r[o], wrapValue(e[o], t));
|
|
2544
2724
|
}
|
|
2545
2725
|
}
|
|
2546
2726
|
}
|
|
2547
2727
|
syncArrayNodeMembership(t, e);
|
|
2548
|
-
if (
|
|
2549
|
-
|
|
2728
|
+
if (o !== e.length) {
|
|
2729
|
+
s = true;
|
|
2550
2730
|
r?.length && setSignal(r.length, e.length);
|
|
2551
2731
|
}
|
|
2552
|
-
|
|
2732
|
+
s && notifySelf(t);
|
|
2553
2733
|
return;
|
|
2554
2734
|
}
|
|
2555
|
-
let
|
|
2556
|
-
if (
|
|
2557
|
-
const r =
|
|
2558
|
-
const
|
|
2559
|
-
for (let u = 0, c =
|
|
2560
|
-
const c =
|
|
2561
|
-
const
|
|
2562
|
-
const
|
|
2735
|
+
let s = t[STORE_NODE];
|
|
2736
|
+
if (s) {
|
|
2737
|
+
const r = s[$TRACK];
|
|
2738
|
+
const o = r ? getAllKeys(i, undefined, e) : nodeKeys(s);
|
|
2739
|
+
for (let u = 0, c = o.length; u < c; u++) {
|
|
2740
|
+
const c = o[u];
|
|
2741
|
+
const a = s[c];
|
|
2742
|
+
const l = unwrap(i[c]);
|
|
2563
2743
|
let f = unwrap(e[c]);
|
|
2564
|
-
if (
|
|
2744
|
+
if (l === f) continue;
|
|
2565
2745
|
if (
|
|
2566
|
-
!
|
|
2567
|
-
!isWrappable(
|
|
2746
|
+
!l ||
|
|
2747
|
+
!isWrappable(l) ||
|
|
2568
2748
|
!isWrappable(f) ||
|
|
2569
|
-
Array.isArray(
|
|
2570
|
-
(n(
|
|
2749
|
+
Array.isArray(l) !== Array.isArray(f) ||
|
|
2750
|
+
(n(l) != null && n(l) !== n(f))
|
|
2571
2751
|
) {
|
|
2572
2752
|
r && setSignal(r, void 0);
|
|
2573
|
-
|
|
2574
|
-
} else applyState(f, wrap(
|
|
2753
|
+
a && setSignal(a, isWrappable(f) ? wrap(f, t) : f);
|
|
2754
|
+
} else applyState(f, wrap(l, t), n);
|
|
2575
2755
|
}
|
|
2576
2756
|
}
|
|
2577
|
-
if ((
|
|
2578
|
-
const t = nodeKeys(
|
|
2757
|
+
if ((s = t[STORE_HAS])) {
|
|
2758
|
+
const t = nodeKeys(s);
|
|
2579
2759
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
2580
2760
|
const i = t[n];
|
|
2581
|
-
setSignal(
|
|
2761
|
+
setSignal(s[i], i in e);
|
|
2582
2762
|
}
|
|
2583
2763
|
}
|
|
2584
2764
|
}
|
|
2585
2765
|
function applyStateSlow(e, t, n) {
|
|
2586
2766
|
const i = t[STORE_VALUE];
|
|
2587
2767
|
const r = t[STORE_OVERRIDE];
|
|
2588
|
-
const
|
|
2589
|
-
let
|
|
2768
|
+
const s = t[STORE_OPTIMISTIC_OVERRIDE];
|
|
2769
|
+
let o = t[STORE_NODE];
|
|
2590
2770
|
(t[STORE_LOOKUP] || storeLookup).set(e, t[$PROXY]);
|
|
2591
2771
|
t[STORE_VALUE] = e;
|
|
2592
2772
|
t[STORE_OVERRIDE] = undefined;
|
|
2593
2773
|
if (Array.isArray(i)) {
|
|
2594
2774
|
let u = false;
|
|
2595
|
-
const c = getOverrideValue(i, r, "length",
|
|
2775
|
+
const c = getOverrideValue(i, r, "length", s);
|
|
2596
2776
|
if (e.length && c && isWrappable(e[0]) && n(e[0]) != null) {
|
|
2597
|
-
let
|
|
2777
|
+
let a, l, f, E, d, S, T, _;
|
|
2598
2778
|
for (
|
|
2599
2779
|
f = 0, E = Math.min(c, e.length);
|
|
2600
|
-
f < E && keyedMatch((S = getOverrideValue(i, r, f,
|
|
2780
|
+
f < E && keyedMatch((S = getOverrideValue(i, r, f, s)), e[f], n);
|
|
2601
2781
|
f++
|
|
2602
2782
|
) {
|
|
2603
2783
|
isWrappable(S) && isWrappable(e[f]) && applyState(e[f], wrap(S, t), n);
|
|
2604
2784
|
}
|
|
2605
|
-
const
|
|
2606
|
-
|
|
2785
|
+
const p = new Array(e.length),
|
|
2786
|
+
O = new Map();
|
|
2607
2787
|
for (
|
|
2608
2788
|
E = c - 1, d = e.length - 1;
|
|
2609
|
-
E >= f && d >= f && keyedMatch((S = getOverrideValue(i, r, E,
|
|
2789
|
+
E >= f && d >= f && keyedMatch((S = getOverrideValue(i, r, E, s)), e[d], n);
|
|
2610
2790
|
E--, d--
|
|
2611
2791
|
) {
|
|
2612
|
-
|
|
2792
|
+
p[d] = S;
|
|
2613
2793
|
}
|
|
2614
2794
|
if (f > d || f > E) {
|
|
2615
|
-
for (
|
|
2795
|
+
for (l = f; l <= d; l++) {
|
|
2616
2796
|
u = true;
|
|
2617
|
-
|
|
2797
|
+
o?.[l] && setSignal(o[l], wrapValue(e[l], t));
|
|
2618
2798
|
}
|
|
2619
|
-
for (;
|
|
2799
|
+
for (; l < e.length; l++) {
|
|
2620
2800
|
u = true;
|
|
2621
|
-
applyArrayItem(e[
|
|
2801
|
+
applyArrayItem(e[l], p[l], t, o?.[l], n);
|
|
2622
2802
|
}
|
|
2623
2803
|
const i = e.length;
|
|
2624
2804
|
syncArrayNodeMembership(t, e);
|
|
2625
2805
|
(u || c !== i) && notifySelf(t);
|
|
2626
|
-
c !== i &&
|
|
2806
|
+
c !== i && o?.length && setSignal(o.length, i);
|
|
2627
2807
|
return;
|
|
2628
2808
|
}
|
|
2629
2809
|
T = new Array(d + 1);
|
|
2630
|
-
for (
|
|
2631
|
-
S = e[
|
|
2810
|
+
for (l = d; l >= f; l--) {
|
|
2811
|
+
S = e[l];
|
|
2632
2812
|
_ = itemKey(S, n);
|
|
2633
|
-
|
|
2634
|
-
T[
|
|
2635
|
-
|
|
2813
|
+
a = O.get(_);
|
|
2814
|
+
T[l] = a === undefined ? -1 : a;
|
|
2815
|
+
O.set(_, l);
|
|
2636
2816
|
}
|
|
2637
|
-
for (
|
|
2638
|
-
S = getOverrideValue(i, r,
|
|
2817
|
+
for (a = f; a <= E; a++) {
|
|
2818
|
+
S = getOverrideValue(i, r, a, s);
|
|
2639
2819
|
_ = itemKey(S, n);
|
|
2640
|
-
|
|
2641
|
-
if (
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2820
|
+
l = O.get(_);
|
|
2821
|
+
if (l !== undefined && l !== -1) {
|
|
2822
|
+
p[l] = S;
|
|
2823
|
+
l = T[l];
|
|
2824
|
+
O.set(_, l);
|
|
2645
2825
|
}
|
|
2646
2826
|
}
|
|
2647
|
-
for (
|
|
2648
|
-
if (
|
|
2649
|
-
applyArrayItem(e[
|
|
2650
|
-
} else
|
|
2827
|
+
for (l = f; l < e.length; l++) {
|
|
2828
|
+
if (l in p) {
|
|
2829
|
+
applyArrayItem(e[l], p[l], t, o?.[l], n);
|
|
2830
|
+
} else o?.[l] && setSignal(o[l], wrapValue(e[l], t));
|
|
2651
2831
|
}
|
|
2652
2832
|
if (f < e.length) u = true;
|
|
2653
2833
|
} else if (e.length) {
|
|
2654
|
-
for (let c = 0,
|
|
2655
|
-
const
|
|
2656
|
-
if (isWrappable(
|
|
2834
|
+
for (let c = 0, a = e.length; c < a; c++) {
|
|
2835
|
+
const a = getOverrideValue(i, r, c, s);
|
|
2836
|
+
if (isWrappable(a) && isWrappable(e[c])) applyState(e[c], wrap(a, t), n);
|
|
2657
2837
|
else {
|
|
2658
|
-
if (
|
|
2659
|
-
|
|
2838
|
+
if (a !== e[c]) u = true;
|
|
2839
|
+
o?.[c] && setSignal(o[c], wrapValue(e[c], t));
|
|
2660
2840
|
}
|
|
2661
2841
|
}
|
|
2662
2842
|
}
|
|
2663
|
-
const
|
|
2843
|
+
const a = e.length;
|
|
2664
2844
|
syncArrayNodeMembership(t, e);
|
|
2665
|
-
if (c !==
|
|
2845
|
+
if (c !== a) {
|
|
2666
2846
|
u = true;
|
|
2667
|
-
|
|
2847
|
+
o?.length && setSignal(o.length, a);
|
|
2668
2848
|
}
|
|
2669
2849
|
u && notifySelf(t);
|
|
2670
2850
|
return;
|
|
2671
2851
|
}
|
|
2672
|
-
if (
|
|
2673
|
-
const u =
|
|
2674
|
-
const c = u ? getAllKeys(i, r, e) : nodeKeys(
|
|
2675
|
-
for (let
|
|
2676
|
-
const
|
|
2677
|
-
const f =
|
|
2678
|
-
const E = unwrap(getOverrideValue(i, r,
|
|
2679
|
-
let d = unwrap(e[
|
|
2852
|
+
if (o) {
|
|
2853
|
+
const u = o[$TRACK];
|
|
2854
|
+
const c = u ? getAllKeys(i, r, e) : nodeKeys(o);
|
|
2855
|
+
for (let a = 0, l = c.length; a < l; a++) {
|
|
2856
|
+
const l = c[a];
|
|
2857
|
+
const f = o[l];
|
|
2858
|
+
const E = unwrap(getOverrideValue(i, r, l, s));
|
|
2859
|
+
let d = unwrap(e[l]);
|
|
2680
2860
|
if (E === d) continue;
|
|
2681
2861
|
if (
|
|
2682
2862
|
!E ||
|
|
@@ -2690,11 +2870,11 @@ function applyStateSlow(e, t, n) {
|
|
|
2690
2870
|
} else applyState(d, wrap(E, t), n);
|
|
2691
2871
|
}
|
|
2692
2872
|
}
|
|
2693
|
-
if ((
|
|
2694
|
-
const t = nodeKeys(
|
|
2873
|
+
if ((o = t[STORE_HAS])) {
|
|
2874
|
+
const t = nodeKeys(o);
|
|
2695
2875
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
2696
2876
|
const i = t[n];
|
|
2697
|
-
setSignal(
|
|
2877
|
+
setSignal(o[i], i in e);
|
|
2698
2878
|
}
|
|
2699
2879
|
}
|
|
2700
2880
|
}
|
|
@@ -2728,36 +2908,36 @@ function createProjectionInternal(e, t, n) {
|
|
|
2728
2908
|
r.set(e, t);
|
|
2729
2909
|
return t;
|
|
2730
2910
|
};
|
|
2731
|
-
const
|
|
2911
|
+
const s = wrapProjection(t);
|
|
2732
2912
|
i = computed(() => {
|
|
2733
2913
|
if (!i) i = getOwner();
|
|
2734
|
-
runProjectionComputed(
|
|
2914
|
+
runProjectionComputed(s, e, n?.key || "id");
|
|
2735
2915
|
}, undefined);
|
|
2736
|
-
i.
|
|
2737
|
-
return { store:
|
|
2916
|
+
i.Se &= ~CONFIG_AUTO_DISPOSE;
|
|
2917
|
+
return { store: s, node: i };
|
|
2738
2918
|
}
|
|
2739
2919
|
function createProjection(e, t, n) {
|
|
2740
2920
|
return createProjectionInternal(e, t, n).store;
|
|
2741
2921
|
}
|
|
2742
2922
|
function runProjectionComputed(e, t, n, i, r) {
|
|
2743
|
-
const
|
|
2744
|
-
let
|
|
2923
|
+
const s = getOwner();
|
|
2924
|
+
let o = false;
|
|
2745
2925
|
let u;
|
|
2746
2926
|
const c = new Proxy(
|
|
2747
2927
|
e,
|
|
2748
|
-
createWriteTraps(() => !
|
|
2928
|
+
createWriteTraps(() => !o || s.ke === u, r)
|
|
2749
2929
|
);
|
|
2750
2930
|
storeSetter(c, r => {
|
|
2751
2931
|
u = t(r);
|
|
2752
|
-
|
|
2932
|
+
o = true;
|
|
2753
2933
|
const commit = t => {
|
|
2754
2934
|
if (t === r || t === undefined) return;
|
|
2755
2935
|
const write = () => storeSetter(e, reconcile(t, n));
|
|
2756
2936
|
i ? i(write) : write();
|
|
2757
2937
|
};
|
|
2758
|
-
commit(handleAsync(
|
|
2938
|
+
commit(handleAsync(s, u, commit));
|
|
2759
2939
|
});
|
|
2760
|
-
return
|
|
2940
|
+
return s;
|
|
2761
2941
|
}
|
|
2762
2942
|
function createWriteTraps(e, t) {
|
|
2763
2943
|
const n = {
|
|
@@ -2818,7 +2998,8 @@ function createWriteTraps(e, t) {
|
|
|
2818
2998
|
const $TRACK = Symbol(0),
|
|
2819
2999
|
$TARGET = Symbol(0),
|
|
2820
3000
|
$PROXY = Symbol(0),
|
|
2821
|
-
$DELETED = Symbol(0)
|
|
3001
|
+
$DELETED = Symbol(0),
|
|
3002
|
+
$AFFECTS = Symbol(0);
|
|
2822
3003
|
const STORE_VALUE = "v",
|
|
2823
3004
|
STORE_OVERRIDE = "o",
|
|
2824
3005
|
STORE_OPTIMISTIC_OVERRIDE = "x",
|
|
@@ -2828,8 +3009,7 @@ const STORE_VALUE = "v",
|
|
|
2828
3009
|
STORE_WRAP = "w",
|
|
2829
3010
|
STORE_LOOKUP = "l",
|
|
2830
3011
|
STORE_FIREWALL = "f",
|
|
2831
|
-
STORE_OPTIMISTIC = "p"
|
|
2832
|
-
STORE_MASKED = "m";
|
|
3012
|
+
STORE_OPTIMISTIC = "p";
|
|
2833
3013
|
const STORE_SELF_PENDING = Symbol(0);
|
|
2834
3014
|
function createStoreProxy(e, t = storeTraps, n) {
|
|
2835
3015
|
let i;
|
|
@@ -2873,17 +3053,17 @@ function unwrapStoreValue(e, t, n) {
|
|
|
2873
3053
|
if (!r) return i[STORE_VALUE];
|
|
2874
3054
|
if (!t) t = new Map();
|
|
2875
3055
|
if (t.has(e)) return t.get(e);
|
|
2876
|
-
const
|
|
2877
|
-
const
|
|
2878
|
-
const u =
|
|
3056
|
+
const s = i[STORE_VALUE];
|
|
3057
|
+
const o = Array.isArray(s);
|
|
3058
|
+
const u = o ? [] : Object.create(Object.getPrototypeOf(s));
|
|
2879
3059
|
t.set(e, u);
|
|
2880
3060
|
n = i[STORE_LOOKUP] ?? storeLookup;
|
|
2881
|
-
for (const e of getKeys(
|
|
2882
|
-
if (
|
|
2883
|
-
const i = e in r ? r[e] :
|
|
3061
|
+
for (const e of getKeys(s, r)) {
|
|
3062
|
+
if (o && e === "length") continue;
|
|
3063
|
+
const i = e in r ? r[e] : s[e];
|
|
2884
3064
|
if (i !== $DELETED) u[e] = unwrapStoreValue(i, t, n);
|
|
2885
3065
|
}
|
|
2886
|
-
if (
|
|
3066
|
+
if (o) u.length = r.length ?? s.length;
|
|
2887
3067
|
return u;
|
|
2888
3068
|
}
|
|
2889
3069
|
function isPrototypePollutionKey$1(e) {
|
|
@@ -2900,7 +3080,7 @@ function getOverlayLayer(e, t) {
|
|
|
2900
3080
|
return undefined;
|
|
2901
3081
|
}
|
|
2902
3082
|
function visibleNodeValue(e) {
|
|
2903
|
-
return e.
|
|
3083
|
+
return e.p !== undefined && e.p !== NOT_PENDING ? e.p : e.m !== NOT_PENDING ? e.m : e.B;
|
|
2904
3084
|
}
|
|
2905
3085
|
function hasOwnStoreProperty(e, t) {
|
|
2906
3086
|
const n = getOverlayLayer(e, t);
|
|
@@ -2921,52 +3101,146 @@ function getNodes(e, t) {
|
|
|
2921
3101
|
if (!n) e[t] = n = Object.create(null);
|
|
2922
3102
|
return n;
|
|
2923
3103
|
}
|
|
2924
|
-
function getNode(e, t, n, i, r = isEqual,
|
|
2925
|
-
if (
|
|
2926
|
-
const
|
|
2927
|
-
|
|
3104
|
+
function getNode(e, t, n, i, r = isEqual, s) {
|
|
3105
|
+
if (t[n]) return t[n];
|
|
3106
|
+
const o = signal(
|
|
3107
|
+
i,
|
|
2928
3108
|
{
|
|
2929
3109
|
equals: r,
|
|
2930
3110
|
unobserved() {
|
|
2931
|
-
if (
|
|
2932
|
-
delete
|
|
2933
|
-
if (
|
|
2934
|
-
|
|
3111
|
+
if (t[n] === o) {
|
|
3112
|
+
delete t[n];
|
|
3113
|
+
if (
|
|
3114
|
+
typeof n === "symbol" &&
|
|
3115
|
+
n !== $TRACK &&
|
|
3116
|
+
n !== $AFFECTS &&
|
|
3117
|
+
symbolKeyedRecords.has(t)
|
|
3118
|
+
) {
|
|
3119
|
+
const e = Object.getOwnPropertySymbols(t);
|
|
2935
3120
|
let n = false;
|
|
2936
|
-
for (let
|
|
2937
|
-
if (t[
|
|
3121
|
+
for (let t = 0, i = e.length; t < i; t++) {
|
|
3122
|
+
if (e[t] !== $TRACK && e[t] !== $AFFECTS) {
|
|
2938
3123
|
n = true;
|
|
2939
3124
|
break;
|
|
2940
3125
|
}
|
|
2941
3126
|
}
|
|
2942
|
-
if (!n) symbolKeyedRecords.delete(
|
|
3127
|
+
if (!n) symbolKeyedRecords.delete(t);
|
|
2943
3128
|
}
|
|
2944
3129
|
}
|
|
2945
3130
|
}
|
|
2946
3131
|
},
|
|
2947
|
-
|
|
3132
|
+
e[STORE_FIREWALL]
|
|
2948
3133
|
);
|
|
2949
|
-
if (
|
|
2950
|
-
|
|
3134
|
+
if (e[STORE_OPTIMISTIC]) {
|
|
3135
|
+
o.p = NOT_PENDING;
|
|
3136
|
+
}
|
|
3137
|
+
if (s && n in s) {
|
|
3138
|
+
const e = s[n];
|
|
3139
|
+
o.pe = e === undefined ? NO_SNAPSHOT : e;
|
|
3140
|
+
snapshotSources?.add(o);
|
|
3141
|
+
}
|
|
3142
|
+
if (typeof n === "symbol" && n !== $TRACK && n !== $AFFECTS) symbolKeyedRecords.add(t);
|
|
3143
|
+
if (n !== $AFFECTS && affectsScopes.size) inheritAffectsMarks(o, e[STORE_VALUE]);
|
|
3144
|
+
return (t[n] = o);
|
|
3145
|
+
}
|
|
3146
|
+
function inheritAffectsMarks(e, t) {
|
|
3147
|
+
for (const [n, i] of affectsScopes) {
|
|
3148
|
+
if (n.L && i.scope.has(t)) {
|
|
3149
|
+
markAffects(e);
|
|
3150
|
+
i.inherited.push(e);
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3154
|
+
const affectsScopes = new Map();
|
|
3155
|
+
function walkAffectsScope(e, t, n, i, r) {
|
|
3156
|
+
if (!isWrappable(e)) return;
|
|
3157
|
+
const s = e[$TARGET] || (i ?? storeLookup).get(e)?.[$TARGET];
|
|
3158
|
+
const o = s ? s[STORE_VALUE] : e;
|
|
3159
|
+
if (r.has(o)) return;
|
|
3160
|
+
r.add(o);
|
|
3161
|
+
t.scope.add(o);
|
|
3162
|
+
let u;
|
|
3163
|
+
if (s) {
|
|
3164
|
+
collectRecordNodes(s[STORE_NODE], n);
|
|
3165
|
+
collectRecordNodes(s[STORE_HAS], n);
|
|
3166
|
+
u = mergedOverlay(s);
|
|
3167
|
+
i = s[STORE_LOOKUP] ?? i;
|
|
2951
3168
|
}
|
|
2952
|
-
if (
|
|
2953
|
-
const e =
|
|
2954
|
-
|
|
2955
|
-
|
|
3169
|
+
if (Array.isArray(o)) {
|
|
3170
|
+
const e = u?.length ?? o.length;
|
|
3171
|
+
for (let s = 0; s < e; s++) {
|
|
3172
|
+
const e = u && s in u ? u[s] : o[s];
|
|
3173
|
+
if (e !== $DELETED) walkAffectsScope(e, t, n, i, r);
|
|
3174
|
+
}
|
|
3175
|
+
} else {
|
|
3176
|
+
const e = getKeys(o, u);
|
|
3177
|
+
for (let s = 0, c = e.length; s < c; s++) {
|
|
3178
|
+
const c = getPropertyDescriptor(o, u, e[s]);
|
|
3179
|
+
if (!c || c.get) continue;
|
|
3180
|
+
walkAffectsScope(c.value, t, n, i, r);
|
|
3181
|
+
}
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
function collectRecordNodes(e, t) {
|
|
3185
|
+
if (!e) return;
|
|
3186
|
+
for (const n of Object.keys(e)) t.push(e[n]);
|
|
3187
|
+
const n = Object.getOwnPropertySymbols(e);
|
|
3188
|
+
for (let i = 0, r = n.length; i < r; i++) {
|
|
3189
|
+
if (n[i] !== $AFFECTS) t.push(e[n[i]]);
|
|
3190
|
+
}
|
|
3191
|
+
}
|
|
3192
|
+
function witnessAffectsMark(e) {
|
|
3193
|
+
const t = e[STORE_NODE]?.[$AFFECTS];
|
|
3194
|
+
if (t?.L) witnessAffects(t);
|
|
3195
|
+
if (affectsScopes.size) {
|
|
3196
|
+
const n = e[STORE_VALUE];
|
|
3197
|
+
for (const [e, i] of affectsScopes) {
|
|
3198
|
+
if (e !== t && e.L && i.scope.has(n)) witnessAffects(e);
|
|
3199
|
+
}
|
|
2956
3200
|
}
|
|
2957
|
-
|
|
2958
|
-
|
|
3201
|
+
}
|
|
3202
|
+
function getStoreAffectsNodes(e, t) {
|
|
3203
|
+
const n = getNodes(e, STORE_NODE);
|
|
3204
|
+
if (t === undefined) {
|
|
3205
|
+
const t = getNode(e, n, $AFFECTS, undefined, false);
|
|
3206
|
+
GlobalQueue.ae ||= e => {
|
|
3207
|
+
const t = affectsScopes.get(e);
|
|
3208
|
+
if (!t) return;
|
|
3209
|
+
affectsScopes.delete(e);
|
|
3210
|
+
for (let e = 0; e < t.inherited.length; e++) releaseAffectsMark(t.inherited[e]);
|
|
3211
|
+
};
|
|
3212
|
+
let i = affectsScopes.get(t);
|
|
3213
|
+
if (!i) affectsScopes.set(t, (i = { scope: new Set(), inherited: [] }));
|
|
3214
|
+
const r = [t];
|
|
3215
|
+
walkAffectsScope(e[$PROXY], i, r, e[STORE_LOOKUP], new Set());
|
|
3216
|
+
return r;
|
|
3217
|
+
}
|
|
3218
|
+
if (n[t]) return [n[t]];
|
|
3219
|
+
const i = getOverlayLayer(e, t);
|
|
3220
|
+
const r = i ? i[t] : e[STORE_VALUE][t];
|
|
3221
|
+
const s = r === $DELETED ? undefined : r;
|
|
3222
|
+
return [upsertStoreNode(e, n, t, s, e[STORE_SNAPSHOT_PROPS])];
|
|
2959
3223
|
}
|
|
2960
3224
|
function trackSelf(e, t = $TRACK) {
|
|
2961
|
-
getObserver()
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
3225
|
+
if (!getObserver()) return;
|
|
3226
|
+
read(getNode(e, getNodes(e, STORE_NODE), t, undefined, false));
|
|
3227
|
+
if (
|
|
3228
|
+
t === $TRACK &&
|
|
3229
|
+
!e[STORE_OVERRIDE] &&
|
|
3230
|
+
!e[STORE_OPTIMISTIC_OVERRIDE] &&
|
|
3231
|
+
e[STORE_VALUE][$TARGET]
|
|
3232
|
+
)
|
|
3233
|
+
e[STORE_VALUE][$TRACK];
|
|
2965
3234
|
}
|
|
2966
3235
|
function notifySelf(e) {
|
|
2967
3236
|
const t = e[STORE_NODE]?.[$TRACK];
|
|
2968
3237
|
t && setSignal(t, e[STORE_OPTIMISTIC] && !projectionWriteActive ? STORE_SELF_PENDING : undefined);
|
|
2969
3238
|
}
|
|
3239
|
+
function mergedOverlay(e) {
|
|
3240
|
+
const t = e[STORE_OVERRIDE];
|
|
3241
|
+
const n = e[STORE_OPTIMISTIC_OVERRIDE];
|
|
3242
|
+
return t && n ? { ...t, ...n } : (n ?? t);
|
|
3243
|
+
}
|
|
2970
3244
|
function getKeys(e, t, n = true) {
|
|
2971
3245
|
const i = e[$TARGET]
|
|
2972
3246
|
? untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)))
|
|
@@ -2975,8 +3249,8 @@ function getKeys(e, t, n = true) {
|
|
|
2975
3249
|
: Reflect.ownKeys(e);
|
|
2976
3250
|
if (!t) return i;
|
|
2977
3251
|
const r = new Set(i);
|
|
2978
|
-
const
|
|
2979
|
-
for (const e of
|
|
3252
|
+
const s = Reflect.ownKeys(t);
|
|
3253
|
+
for (const e of s) {
|
|
2980
3254
|
if (t[e] !== $DELETED) r.add(e);
|
|
2981
3255
|
else r.delete(e);
|
|
2982
3256
|
}
|
|
@@ -2995,17 +3269,6 @@ function getPropertyDescriptor(e, t, n) {
|
|
|
2995
3269
|
}
|
|
2996
3270
|
return Reflect.getOwnPropertyDescriptor(e, n);
|
|
2997
3271
|
}
|
|
2998
|
-
function maskStoreTarget(e, t) {
|
|
2999
|
-
const n = e[STORE_FIREWALL];
|
|
3000
|
-
if (!n) return;
|
|
3001
|
-
if (!!e[STORE_MASKED] === t) return;
|
|
3002
|
-
e[STORE_MASKED] = t;
|
|
3003
|
-
const i = (n.qe = (n.qe || 0) + (t ? 1 : -1));
|
|
3004
|
-
if ((t && i === 1) || (!t && i === 0)) {
|
|
3005
|
-
updatePendingSignal(n);
|
|
3006
|
-
updateChildCompanions(n);
|
|
3007
|
-
}
|
|
3008
|
-
}
|
|
3009
3272
|
function prepareStoreWrite(e, t, n) {
|
|
3010
3273
|
if (e[STORE_OPTIMISTIC]) {
|
|
3011
3274
|
const t = e[STORE_FIREWALL];
|
|
@@ -3018,7 +3281,7 @@ function prepareStoreWrite(e, t, n) {
|
|
|
3018
3281
|
if (
|
|
3019
3282
|
snapshotCaptureActive &&
|
|
3020
3283
|
typeof n !== "symbol" &&
|
|
3021
|
-
!((e[STORE_FIREWALL]?.
|
|
3284
|
+
!((e[STORE_FIREWALL]?.q ?? 0) & STATUS_PENDING)
|
|
3022
3285
|
) {
|
|
3023
3286
|
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
3024
3287
|
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
@@ -3028,51 +3291,50 @@ function prepareStoreWrite(e, t, n) {
|
|
|
3028
3291
|
e[STORE_SNAPSHOT_PROPS][n] = r;
|
|
3029
3292
|
}
|
|
3030
3293
|
}
|
|
3031
|
-
const
|
|
3032
|
-
const
|
|
3033
|
-
return { base: r, overrideKey:
|
|
3294
|
+
const s = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
3295
|
+
const o = s ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
3296
|
+
return { base: r, overrideKey: o, state: i };
|
|
3034
3297
|
}
|
|
3035
3298
|
function armOptimisticStoreWrite(e, t) {
|
|
3036
3299
|
if (e[STORE_OPTIMISTIC] && !projectionWriteActive) {
|
|
3037
3300
|
trackOptimisticStore(t);
|
|
3038
|
-
maskStoreTarget(e, true);
|
|
3039
3301
|
}
|
|
3040
3302
|
}
|
|
3041
3303
|
function upsertStoreNode(e, t, n, i, r) {
|
|
3042
3304
|
if (t[n]) return t[n];
|
|
3043
|
-
const
|
|
3044
|
-
const
|
|
3045
|
-
registerTransientStoreNode(
|
|
3046
|
-
return
|
|
3305
|
+
const s = isWrappable(i) ? wrap(i, e) : i;
|
|
3306
|
+
const o = getNode(e, t, n, s, isEqual, r);
|
|
3307
|
+
registerTransientStoreNode(o);
|
|
3308
|
+
return o;
|
|
3047
3309
|
}
|
|
3048
|
-
function notifyStoreProperty(e, t, n, i, r,
|
|
3049
|
-
const
|
|
3310
|
+
function notifyStoreProperty(e, t, n, i, r, s) {
|
|
3311
|
+
const o = projectionWriteActive || e[STORE_OPTIMISTIC];
|
|
3050
3312
|
const u = n !== "delete";
|
|
3051
3313
|
const c = e[STORE_HAS]?.[t];
|
|
3052
3314
|
if (c) {
|
|
3053
3315
|
setSignal(c, u);
|
|
3054
|
-
} else if (!
|
|
3055
|
-
const n = upsertStoreNode(e, getNodes(e, STORE_HAS), t,
|
|
3316
|
+
} else if (!o && n !== "invalidate" && s !== u) {
|
|
3317
|
+
const n = upsertStoreNode(e, getNodes(e, STORE_HAS), t, s);
|
|
3056
3318
|
setSignal(n, u);
|
|
3057
3319
|
}
|
|
3058
|
-
const
|
|
3320
|
+
const a = getNodes(e, STORE_NODE);
|
|
3059
3321
|
if (n === "set") {
|
|
3060
|
-
if (
|
|
3061
|
-
setSignal(
|
|
3062
|
-
} else if (!
|
|
3063
|
-
const n = upsertStoreNode(e,
|
|
3322
|
+
if (a[t]) {
|
|
3323
|
+
setSignal(a[t], () => (isWrappable(i) ? wrap(i, e) : i));
|
|
3324
|
+
} else if (!o) {
|
|
3325
|
+
const n = upsertStoreNode(e, a, t, r, e[STORE_SNAPSHOT_PROPS]);
|
|
3064
3326
|
setSignal(n, () => (isWrappable(i) ? wrap(i, e) : i));
|
|
3065
3327
|
}
|
|
3066
3328
|
} else if (n === "invalidate") {
|
|
3067
|
-
if (
|
|
3068
|
-
setSignal(
|
|
3069
|
-
delete
|
|
3329
|
+
if (a[t]) {
|
|
3330
|
+
setSignal(a[t], {});
|
|
3331
|
+
delete a[t];
|
|
3070
3332
|
}
|
|
3071
3333
|
} else {
|
|
3072
|
-
if (
|
|
3073
|
-
setSignal(
|
|
3074
|
-
} else if (!
|
|
3075
|
-
const n = upsertStoreNode(e,
|
|
3334
|
+
if (a[t]) {
|
|
3335
|
+
setSignal(a[t], undefined);
|
|
3336
|
+
} else if (!o) {
|
|
3337
|
+
const n = upsertStoreNode(e, a, t, r, e[STORE_SNAPSHOT_PROPS]);
|
|
3076
3338
|
setSignal(n, undefined);
|
|
3077
3339
|
}
|
|
3078
3340
|
}
|
|
@@ -3084,73 +3346,66 @@ const storeTraps = {
|
|
|
3084
3346
|
if (t === $TARGET) return e;
|
|
3085
3347
|
if (t === $PROXY) return n;
|
|
3086
3348
|
if (t === $REFRESH) return e[STORE_FIREWALL];
|
|
3349
|
+
if (pendingCheckActive) witnessAffectsMark(e);
|
|
3087
3350
|
if (t === $TRACK) {
|
|
3088
3351
|
trackSelf(e);
|
|
3089
3352
|
return n;
|
|
3090
3353
|
}
|
|
3091
3354
|
const i = getObserver() === e[STORE_FIREWALL];
|
|
3092
3355
|
const r = getNodes(e, STORE_NODE);
|
|
3093
|
-
const
|
|
3094
|
-
const
|
|
3356
|
+
const s = i ? undefined : r[t];
|
|
3357
|
+
const o = e[STORE_VALUE];
|
|
3095
3358
|
if (
|
|
3096
|
-
!
|
|
3359
|
+
!s &&
|
|
3097
3360
|
!e[STORE_OVERRIDE] &&
|
|
3098
3361
|
!e[STORE_OPTIMISTIC_OVERRIDE] &&
|
|
3099
3362
|
!e[STORE_CUSTOM_PROTO] &&
|
|
3100
3363
|
!e[STORE_OPTIMISTIC] &&
|
|
3101
3364
|
!e[STORE_SNAPSHOT_PROPS] &&
|
|
3102
|
-
!
|
|
3103
|
-
!(t in
|
|
3365
|
+
!o[$TARGET] &&
|
|
3366
|
+
!(t in o) &&
|
|
3104
3367
|
getObserver() &&
|
|
3105
3368
|
!i &&
|
|
3106
3369
|
!writeOnly(n)
|
|
3107
3370
|
) {
|
|
3108
|
-
return read(getNode(r, t, undefined
|
|
3371
|
+
return read(getNode(e, r, t, undefined));
|
|
3109
3372
|
}
|
|
3110
3373
|
const u = getOverlayLayer(e, t);
|
|
3111
3374
|
const c = !!u;
|
|
3112
|
-
const
|
|
3113
|
-
const
|
|
3114
|
-
if (!
|
|
3115
|
-
const i = Object.getOwnPropertyDescriptor(
|
|
3375
|
+
const a = !!e[STORE_VALUE][$TARGET];
|
|
3376
|
+
const l = u ?? e[STORE_VALUE];
|
|
3377
|
+
if (!s) {
|
|
3378
|
+
const i = Object.getOwnPropertyDescriptor(l, t);
|
|
3116
3379
|
if (i && i.get) return i.get.call(n);
|
|
3117
3380
|
if (!i && !c && e[STORE_CUSTOM_PROTO]) {
|
|
3118
|
-
const e = unwrapStoreValue(
|
|
3381
|
+
const e = unwrapStoreValue(l);
|
|
3119
3382
|
if (hasInheritedAccessor(e, t)) {
|
|
3120
|
-
return Reflect.get(
|
|
3383
|
+
return Reflect.get(l, t, n);
|
|
3121
3384
|
}
|
|
3122
3385
|
}
|
|
3123
3386
|
}
|
|
3124
3387
|
if (writeOnly(n)) {
|
|
3125
3388
|
if (isPrototypePollutionKey$1(t) && !hasOwnStoreProperty(e, t)) return undefined;
|
|
3126
|
-
let n =
|
|
3389
|
+
let n = s && (c || !a) ? visibleNodeValue(s) : l[t];
|
|
3127
3390
|
n === $DELETED && (n = undefined);
|
|
3128
3391
|
if (!isWrappable(n)) return n;
|
|
3129
3392
|
const i = wrap(n, e);
|
|
3130
3393
|
Writing?.add(i);
|
|
3131
3394
|
return i;
|
|
3132
3395
|
}
|
|
3133
|
-
let f =
|
|
3396
|
+
let f = s ? (c || !a ? read(r[t]) : (read(r[t]), l[t])) : l[t];
|
|
3134
3397
|
f === $DELETED && (f = undefined);
|
|
3135
|
-
if (!
|
|
3136
|
-
if (!c && typeof f === "function" && !Object.prototype.hasOwnProperty.call(
|
|
3398
|
+
if (!s) {
|
|
3399
|
+
if (!c && typeof f === "function" && !Object.prototype.hasOwnProperty.call(l, t)) {
|
|
3137
3400
|
let t;
|
|
3138
3401
|
return !Array.isArray(e[STORE_VALUE]) &&
|
|
3139
3402
|
(t = Object.getPrototypeOf(e[STORE_VALUE])) &&
|
|
3140
3403
|
t !== Object.prototype
|
|
3141
|
-
? f.bind(
|
|
3404
|
+
? f.bind(l)
|
|
3142
3405
|
: f;
|
|
3143
3406
|
} else if (getObserver() && !i) {
|
|
3144
3407
|
return read(
|
|
3145
|
-
getNode(
|
|
3146
|
-
r,
|
|
3147
|
-
t,
|
|
3148
|
-
isWrappable(f) ? wrap(f, e) : f,
|
|
3149
|
-
e[STORE_FIREWALL],
|
|
3150
|
-
isEqual,
|
|
3151
|
-
e[STORE_OPTIMISTIC],
|
|
3152
|
-
e[STORE_SNAPSHOT_PROPS]
|
|
3153
|
-
)
|
|
3408
|
+
getNode(e, r, t, isWrappable(f) ? wrap(f, e) : f, isEqual, e[STORE_SNAPSHOT_PROPS])
|
|
3154
3409
|
);
|
|
3155
3410
|
}
|
|
3156
3411
|
}
|
|
@@ -3158,13 +3413,14 @@ const storeTraps = {
|
|
|
3158
3413
|
},
|
|
3159
3414
|
has(e, t) {
|
|
3160
3415
|
if (t === $PROXY || t === $TRACK || t === "__proto__") return true;
|
|
3416
|
+
if (pendingCheckActive) witnessAffectsMark(e);
|
|
3161
3417
|
const n = getOverlayLayer(e, t);
|
|
3162
3418
|
const i = n ? n[t] !== $DELETED : t in e[STORE_VALUE];
|
|
3163
3419
|
if (writeOnly(e[$PROXY]) || getObserver() === e[STORE_FIREWALL]) return i;
|
|
3164
3420
|
const r = getNodes(e, STORE_HAS);
|
|
3165
3421
|
if (r[t]) return read(r[t]);
|
|
3166
3422
|
if (getObserver()) {
|
|
3167
|
-
return read(getNode(r, t, i
|
|
3423
|
+
return read(getNode(e, r, t, i));
|
|
3168
3424
|
}
|
|
3169
3425
|
return i;
|
|
3170
3426
|
},
|
|
@@ -3173,47 +3429,49 @@ const storeTraps = {
|
|
|
3173
3429
|
const i = e[$PROXY];
|
|
3174
3430
|
if (writeOnly(i)) {
|
|
3175
3431
|
untrack(() => {
|
|
3176
|
-
const { base: r, overrideKey:
|
|
3432
|
+
const { base: r, overrideKey: s, state: o } = prepareStoreWrite(e, i, t);
|
|
3177
3433
|
const u = getOverlayLayer(e, t);
|
|
3178
3434
|
const c = u ? u[t] : r;
|
|
3179
|
-
const
|
|
3180
|
-
const
|
|
3181
|
-
const f =
|
|
3182
|
-
const E =
|
|
3183
|
-
|
|
3184
|
-
const
|
|
3185
|
-
|
|
3435
|
+
const a = u ? u[t] !== $DELETED : t in e[STORE_VALUE];
|
|
3436
|
+
const l = unwrapStoreValue(n);
|
|
3437
|
+
const f = typeof t === "string" ? Number(t) : -1;
|
|
3438
|
+
const E =
|
|
3439
|
+
Array.isArray(o) && Number.isInteger(f) && f >= 0 && f < 4294967295 && String(f) === t;
|
|
3440
|
+
const d = E ? f + 1 : 0;
|
|
3441
|
+
const S = E && (getOverlayLayer(e, "length") ?? o).length;
|
|
3442
|
+
const T = E && d > S ? d : undefined;
|
|
3443
|
+
if (c === l && T === undefined) return true;
|
|
3186
3444
|
armOptimisticStoreWrite(e, i);
|
|
3187
|
-
if (
|
|
3445
|
+
if (l !== undefined && l === r && T === undefined) delete e[s]?.[t];
|
|
3188
3446
|
else {
|
|
3189
|
-
const n = e[
|
|
3190
|
-
n[t] =
|
|
3191
|
-
if (
|
|
3447
|
+
const n = e[s] || (e[s] = Object.create(null));
|
|
3448
|
+
n[t] = l;
|
|
3449
|
+
if (T !== undefined) n.length = T;
|
|
3192
3450
|
}
|
|
3193
|
-
notifyStoreProperty(e, t, "set",
|
|
3451
|
+
notifyStoreProperty(e, t, "set", l, c, a);
|
|
3194
3452
|
if (
|
|
3195
|
-
Array.isArray(
|
|
3453
|
+
Array.isArray(o) &&
|
|
3196
3454
|
t === "length" &&
|
|
3197
|
-
typeof
|
|
3455
|
+
typeof l === "number" &&
|
|
3198
3456
|
typeof c === "number" &&
|
|
3199
|
-
|
|
3457
|
+
l < c
|
|
3200
3458
|
) {
|
|
3201
|
-
const t = e[
|
|
3202
|
-
for (let n =
|
|
3459
|
+
const t = e[s] || (e[s] = Object.create(null));
|
|
3460
|
+
for (let n = l; n < c; n++) {
|
|
3203
3461
|
if (t[n] === $DELETED) continue;
|
|
3204
|
-
const i = n in t ? t[n] :
|
|
3205
|
-
if (!(n in t) && !(n in
|
|
3462
|
+
const i = n in t ? t[n] : o[n];
|
|
3463
|
+
if (!(n in t) && !(n in o)) continue;
|
|
3206
3464
|
t[n] = $DELETED;
|
|
3207
3465
|
notifyStoreProperty(e, n, "delete", undefined, i, true);
|
|
3208
3466
|
}
|
|
3209
3467
|
}
|
|
3210
|
-
if (Array.isArray(
|
|
3468
|
+
if (Array.isArray(o) && t !== "length" && T !== undefined) {
|
|
3211
3469
|
const t = getNodes(e, STORE_NODE);
|
|
3212
3470
|
if (t.length) {
|
|
3213
|
-
setSignal(t.length,
|
|
3471
|
+
setSignal(t.length, T);
|
|
3214
3472
|
} else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
|
|
3215
|
-
const n = upsertStoreNode(e, t, "length",
|
|
3216
|
-
setSignal(n,
|
|
3473
|
+
const n = upsertStoreNode(e, t, "length", S, e[STORE_SNAPSHOT_PROPS]);
|
|
3474
|
+
setSignal(n, T);
|
|
3217
3475
|
}
|
|
3218
3476
|
}
|
|
3219
3477
|
if (false);
|
|
@@ -3226,10 +3484,10 @@ const storeTraps = {
|
|
|
3226
3484
|
const i = e[$PROXY];
|
|
3227
3485
|
if (writeOnly(i)) {
|
|
3228
3486
|
untrack(() => {
|
|
3229
|
-
const { base: r, overrideKey:
|
|
3487
|
+
const { base: r, overrideKey: s } = prepareStoreWrite(e, i, t);
|
|
3230
3488
|
armOptimisticStoreWrite(e, i);
|
|
3231
|
-
const
|
|
3232
|
-
Object.defineProperty(e[
|
|
3489
|
+
const o = "value" in n ? { ...n, value: unwrapStoreValue(n.value) } : n;
|
|
3490
|
+
Object.defineProperty(e[s] || (e[s] = Object.create(null)), t, o);
|
|
3233
3491
|
notifyStoreProperty(e, t, "invalidate");
|
|
3234
3492
|
if (false);
|
|
3235
3493
|
});
|
|
@@ -3245,7 +3503,7 @@ const storeTraps = {
|
|
|
3245
3503
|
const n = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
3246
3504
|
const i = n ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
3247
3505
|
const r = getOverlayLayer(e, t);
|
|
3248
|
-
const
|
|
3506
|
+
const s = r ? r[t] : e[STORE_VALUE][t];
|
|
3249
3507
|
if (t in e[STORE_VALUE] || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE])) {
|
|
3250
3508
|
armOptimisticStoreWrite(e, e[$PROXY]);
|
|
3251
3509
|
(e[i] || (e[i] = Object.create(null)))[t] = $DELETED;
|
|
@@ -3253,12 +3511,13 @@ const storeTraps = {
|
|
|
3253
3511
|
armOptimisticStoreWrite(e, e[$PROXY]);
|
|
3254
3512
|
delete e[i][t];
|
|
3255
3513
|
} else return true;
|
|
3256
|
-
notifyStoreProperty(e, t, "delete", undefined,
|
|
3514
|
+
notifyStoreProperty(e, t, "delete", undefined, s, true);
|
|
3257
3515
|
});
|
|
3258
3516
|
}
|
|
3259
3517
|
return true;
|
|
3260
3518
|
},
|
|
3261
3519
|
ownKeys(e) {
|
|
3520
|
+
if (pendingCheckActive) witnessAffectsMark(e);
|
|
3262
3521
|
if (getObserver() !== e[STORE_FIREWALL]) trackSelf(e);
|
|
3263
3522
|
let t = getKeys(e[STORE_VALUE], e[STORE_OVERRIDE], false);
|
|
3264
3523
|
if (e[STORE_OPTIMISTIC_OVERRIDE]) {
|
|
@@ -3337,25 +3596,35 @@ function createStore(e, t, n) {
|
|
|
3337
3596
|
: e => storeSetter(r, e)
|
|
3338
3597
|
];
|
|
3339
3598
|
}
|
|
3599
|
+
function affects(e, t) {
|
|
3600
|
+
const n = e?.[$TARGET];
|
|
3601
|
+
if (n) {
|
|
3602
|
+
const e = getStoreAffectsNodes(n, t);
|
|
3603
|
+
for (let t = 0; t < e.length; t++) registerAffectsMark(e[t]);
|
|
3604
|
+
return;
|
|
3605
|
+
}
|
|
3606
|
+
const i = e?.[$REFRESH];
|
|
3607
|
+
if (i) {
|
|
3608
|
+
registerAffectsMark(i);
|
|
3609
|
+
return;
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3340
3612
|
function createOptimisticStore(e, t, n) {
|
|
3341
|
-
GlobalQueue.
|
|
3613
|
+
GlobalQueue.ce ||= clearOptimisticStore;
|
|
3342
3614
|
const i = typeof e === "function";
|
|
3343
3615
|
const r = i ? t : e;
|
|
3344
|
-
const
|
|
3345
|
-
const { store:
|
|
3346
|
-
return [
|
|
3616
|
+
const s = i ? e : undefined;
|
|
3617
|
+
const { store: o } = createOptimisticProjectionInternal(s, r, n);
|
|
3618
|
+
return [o, e => storeSetter(o, e)];
|
|
3347
3619
|
}
|
|
3348
3620
|
function clearOptimisticStore(e) {
|
|
3349
3621
|
const t = e[$TARGET];
|
|
3350
|
-
if (!t) return;
|
|
3351
|
-
maskStoreTarget(t, false);
|
|
3352
|
-
if (!t[STORE_OPTIMISTIC_OVERRIDE]) return;
|
|
3622
|
+
if (!t?.[STORE_OPTIMISTIC_OVERRIDE]) return;
|
|
3353
3623
|
clearOptimisticOverride(t);
|
|
3354
3624
|
}
|
|
3355
3625
|
function clearOptimisticOverride(e) {
|
|
3356
3626
|
const t = e[STORE_OPTIMISTIC_OVERRIDE];
|
|
3357
3627
|
if (!t) return;
|
|
3358
|
-
maskStoreTarget(e, false);
|
|
3359
3628
|
const n = e[STORE_NODE];
|
|
3360
3629
|
delete e[STORE_OPTIMISTIC_OVERRIDE];
|
|
3361
3630
|
const i = projectionWriteActive;
|
|
@@ -3367,14 +3636,14 @@ function clearOptimisticOverride(e) {
|
|
|
3367
3636
|
const t = n[i];
|
|
3368
3637
|
t.i = undefined;
|
|
3369
3638
|
const r = getOverlayLayer(e, i);
|
|
3370
|
-
const
|
|
3371
|
-
const
|
|
3372
|
-
const u = isWrappable(
|
|
3639
|
+
const s = r ? r[i] : e[STORE_VALUE][i];
|
|
3640
|
+
const o = s === $DELETED ? undefined : s;
|
|
3641
|
+
const u = isWrappable(o) ? wrap(o, e) : o;
|
|
3373
3642
|
const c = visibleNodeValue(t);
|
|
3374
|
-
t.
|
|
3375
|
-
t.
|
|
3376
|
-
t.
|
|
3377
|
-
if (!t.
|
|
3643
|
+
t.p = NOT_PENDING;
|
|
3644
|
+
t.m = NOT_PENDING;
|
|
3645
|
+
t.B = u;
|
|
3646
|
+
if (!t.Ze || !t.Ze(c, u)) {
|
|
3378
3647
|
insertSubs(t, true);
|
|
3379
3648
|
schedule();
|
|
3380
3649
|
}
|
|
@@ -3410,10 +3679,10 @@ function createOptimisticProjectionInternal(e, t, n) {
|
|
|
3410
3679
|
r.set(e, t);
|
|
3411
3680
|
return t;
|
|
3412
3681
|
};
|
|
3413
|
-
const
|
|
3682
|
+
const s = wrapProjection(t);
|
|
3414
3683
|
if (e) {
|
|
3415
3684
|
const clearProjectionOverride = () => {
|
|
3416
|
-
const e =
|
|
3685
|
+
const e = s[$TARGET];
|
|
3417
3686
|
if (e?.[STORE_OPTIMISTIC_OVERRIDE]) clearOptimisticOverride(e);
|
|
3418
3687
|
};
|
|
3419
3688
|
const wrapCommit = e => {
|
|
@@ -3429,14 +3698,14 @@ function createOptimisticProjectionInternal(e, t, n) {
|
|
|
3429
3698
|
i = computed(() => {
|
|
3430
3699
|
setProjectionWriteActive(true);
|
|
3431
3700
|
try {
|
|
3432
|
-
runProjectionComputed(
|
|
3701
|
+
runProjectionComputed(s, e, n?.key || "id", wrapCommit, clearProjectionOverride);
|
|
3433
3702
|
} finally {
|
|
3434
3703
|
setProjectionWriteActive(false);
|
|
3435
3704
|
}
|
|
3436
3705
|
}, undefined);
|
|
3437
|
-
i.
|
|
3706
|
+
i.Se &= ~CONFIG_AUTO_DISPOSE;
|
|
3438
3707
|
}
|
|
3439
|
-
return { store:
|
|
3708
|
+
return { store: s, node: i };
|
|
3440
3709
|
}
|
|
3441
3710
|
const DELETE = Symbol(0);
|
|
3442
3711
|
function isPrototypePollutionKey(e) {
|
|
@@ -3447,9 +3716,9 @@ function updatePath(e, t, n = 0) {
|
|
|
3447
3716
|
r = e;
|
|
3448
3717
|
if (n < t.length - 1) {
|
|
3449
3718
|
i = t[n];
|
|
3450
|
-
const
|
|
3451
|
-
const
|
|
3452
|
-
if (
|
|
3719
|
+
const s = typeof i;
|
|
3720
|
+
const o = Array.isArray(e);
|
|
3721
|
+
if (s === "string" && isPrototypePollutionKey(i)) return;
|
|
3453
3722
|
if (Array.isArray(i)) {
|
|
3454
3723
|
for (let r = 0; r < i.length; r++) {
|
|
3455
3724
|
t[n] = i[r];
|
|
@@ -3457,7 +3726,7 @@ function updatePath(e, t, n = 0) {
|
|
|
3457
3726
|
}
|
|
3458
3727
|
t[n] = i;
|
|
3459
3728
|
return;
|
|
3460
|
-
} else if (
|
|
3729
|
+
} else if (o && s === "function") {
|
|
3461
3730
|
for (let r = 0; r < e.length; r++) {
|
|
3462
3731
|
if (i(e[r], r)) {
|
|
3463
3732
|
t[n] = r;
|
|
@@ -3466,9 +3735,9 @@ function updatePath(e, t, n = 0) {
|
|
|
3466
3735
|
}
|
|
3467
3736
|
t[n] = i;
|
|
3468
3737
|
return;
|
|
3469
|
-
} else if (
|
|
3470
|
-
const { from: r = 0, to:
|
|
3471
|
-
for (let i = r; i <=
|
|
3738
|
+
} else if (o && s === "object") {
|
|
3739
|
+
const { from: r = 0, to: s = e.length - 1, by: o = 1 } = i;
|
|
3740
|
+
for (let i = r; i <= s; i += o) {
|
|
3472
3741
|
t[n] = i;
|
|
3473
3742
|
updatePath(e, t, n);
|
|
3474
3743
|
}
|
|
@@ -3480,26 +3749,26 @@ function updatePath(e, t, n = 0) {
|
|
|
3480
3749
|
}
|
|
3481
3750
|
r = e[i];
|
|
3482
3751
|
}
|
|
3483
|
-
let
|
|
3484
|
-
if (typeof
|
|
3485
|
-
|
|
3486
|
-
if (
|
|
3752
|
+
let s = t[t.length - 1];
|
|
3753
|
+
if (typeof s === "function") {
|
|
3754
|
+
s = s(r);
|
|
3755
|
+
if (s === r) return;
|
|
3487
3756
|
}
|
|
3488
|
-
if (i === undefined &&
|
|
3489
|
-
if (
|
|
3757
|
+
if (i === undefined && s == undefined) return;
|
|
3758
|
+
if (s === DELETE) {
|
|
3490
3759
|
delete e[i];
|
|
3491
|
-
} else if (i === undefined || (isWrappable(r) && isWrappable(
|
|
3760
|
+
} else if (i === undefined || (isWrappable(r) && isWrappable(s) && !Array.isArray(s))) {
|
|
3492
3761
|
const t = i !== undefined ? e[i] : e;
|
|
3493
|
-
const n = ownEnumerableKeys(
|
|
3762
|
+
const n = ownEnumerableKeys(s);
|
|
3494
3763
|
for (let e = 0; e < n.length; e++) {
|
|
3495
3764
|
const i = n[e];
|
|
3496
3765
|
if (typeof i === "string" && isPrototypePollutionKey(i)) continue;
|
|
3497
|
-
const r = Object.getOwnPropertyDescriptor(
|
|
3766
|
+
const r = Object.getOwnPropertyDescriptor(s, i);
|
|
3498
3767
|
if (r.get || r.set) Object.defineProperty(t, i, r);
|
|
3499
3768
|
else t[i] = r.value;
|
|
3500
3769
|
}
|
|
3501
3770
|
} else {
|
|
3502
|
-
e[i] =
|
|
3771
|
+
e[i] = s;
|
|
3503
3772
|
}
|
|
3504
3773
|
}
|
|
3505
3774
|
const storePath = Object.assign(
|
|
@@ -3510,67 +3779,65 @@ const storePath = Object.assign(
|
|
|
3510
3779
|
},
|
|
3511
3780
|
{ DELETE: DELETE }
|
|
3512
3781
|
);
|
|
3513
|
-
function mergedOverlay(e) {
|
|
3514
|
-
const t = e[STORE_OVERRIDE];
|
|
3515
|
-
const n = e[STORE_OPTIMISTIC_OVERRIDE];
|
|
3516
|
-
return t && n ? { ...t, ...n } : (n ?? t);
|
|
3517
|
-
}
|
|
3518
3782
|
function snapshotImpl(e, t, n, i) {
|
|
3519
|
-
let r,
|
|
3783
|
+
let r, s, o, u, c, a;
|
|
3520
3784
|
if (!isWrappable(e)) return e;
|
|
3521
3785
|
if (n && n.has(e)) return n.get(e);
|
|
3522
3786
|
if (!n) n = new Map();
|
|
3523
3787
|
if ((r = e[$TARGET] || i?.get(e)?.[$TARGET])) {
|
|
3524
|
-
if (t)
|
|
3525
|
-
|
|
3526
|
-
|
|
3788
|
+
if (t) {
|
|
3789
|
+
trackSelf(r, $TRACK);
|
|
3790
|
+
if (pendingCheckActive) witnessAffectsMark(r);
|
|
3791
|
+
}
|
|
3792
|
+
o = mergedOverlay(r);
|
|
3793
|
+
s = Array.isArray(r[STORE_VALUE]);
|
|
3527
3794
|
n.set(
|
|
3528
3795
|
e,
|
|
3529
|
-
|
|
3796
|
+
o ? (u = s ? [] : Object.create(Object.getPrototypeOf(r[STORE_VALUE]))) : r[STORE_VALUE]
|
|
3530
3797
|
);
|
|
3531
3798
|
e = r[STORE_VALUE];
|
|
3532
3799
|
i = r[STORE_LOOKUP] ?? storeLookup;
|
|
3533
3800
|
} else {
|
|
3534
|
-
|
|
3801
|
+
s = Array.isArray(e);
|
|
3535
3802
|
n.set(e, e);
|
|
3536
3803
|
}
|
|
3537
|
-
if (
|
|
3538
|
-
const
|
|
3539
|
-
for (let
|
|
3540
|
-
|
|
3541
|
-
if (
|
|
3542
|
-
if (t && isWrappable(
|
|
3543
|
-
if ((c = snapshotImpl(
|
|
3804
|
+
if (s) {
|
|
3805
|
+
const s = o?.length ?? e.length;
|
|
3806
|
+
for (let l = 0; l < s; l++) {
|
|
3807
|
+
a = o && l in o ? o[l] : e[l];
|
|
3808
|
+
if (a === $DELETED) continue;
|
|
3809
|
+
if (t && isWrappable(a)) wrap(a, r);
|
|
3810
|
+
if ((c = snapshotImpl(a, t, n, i)) !== a || u) {
|
|
3544
3811
|
if (!u) n.set(e, (u = [...e]));
|
|
3545
|
-
u[
|
|
3812
|
+
u[l] = c;
|
|
3546
3813
|
}
|
|
3547
3814
|
}
|
|
3548
|
-
if (u) u.length =
|
|
3549
|
-
} else if (!
|
|
3550
|
-
const
|
|
3551
|
-
for (let
|
|
3552
|
-
const
|
|
3553
|
-
const f = Object.getOwnPropertyDescriptor(e,
|
|
3815
|
+
if (u) u.length = s;
|
|
3816
|
+
} else if (!o) {
|
|
3817
|
+
const s = getKeys(e, undefined);
|
|
3818
|
+
for (let o = 0, l = s.length; o < l; o++) {
|
|
3819
|
+
const l = s[o];
|
|
3820
|
+
const f = Object.getOwnPropertyDescriptor(e, l);
|
|
3554
3821
|
if (f.get) continue;
|
|
3555
|
-
|
|
3556
|
-
if (t && isWrappable(
|
|
3557
|
-
if ((c = snapshotImpl(
|
|
3822
|
+
a = f.value;
|
|
3823
|
+
if (t && isWrappable(a)) wrap(a, r);
|
|
3824
|
+
if ((c = snapshotImpl(a, t, n, i)) !== a || u) {
|
|
3558
3825
|
if (!u) {
|
|
3559
3826
|
u = Object.create(Object.getPrototypeOf(e));
|
|
3560
3827
|
Object.assign(u, e);
|
|
3561
3828
|
}
|
|
3562
|
-
u[
|
|
3829
|
+
u[l] = c;
|
|
3563
3830
|
}
|
|
3564
3831
|
}
|
|
3565
3832
|
} else {
|
|
3566
|
-
const
|
|
3567
|
-
for (let
|
|
3568
|
-
let f =
|
|
3569
|
-
const E = getPropertyDescriptor(e,
|
|
3833
|
+
const s = getKeys(e, o);
|
|
3834
|
+
for (let l = 0, f = s.length; l < f; l++) {
|
|
3835
|
+
let f = s[l];
|
|
3836
|
+
const E = getPropertyDescriptor(e, o, f);
|
|
3570
3837
|
if (E.get) continue;
|
|
3571
|
-
|
|
3572
|
-
if (t && isWrappable(
|
|
3573
|
-
if ((c = snapshotImpl(
|
|
3838
|
+
a = f in o ? o[f] : e[f];
|
|
3839
|
+
if (t && isWrappable(a)) wrap(a, r);
|
|
3840
|
+
if ((c = snapshotImpl(a, t, n, i)) !== e[f] || u) {
|
|
3574
3841
|
if (!u) {
|
|
3575
3842
|
u = Object.create(Object.getPrototypeOf(e));
|
|
3576
3843
|
Object.assign(u, e);
|
|
@@ -3627,9 +3894,9 @@ function merge(...e) {
|
|
|
3627
3894
|
for (let i = 0; i < e.length; i++) {
|
|
3628
3895
|
const r = e[i];
|
|
3629
3896
|
t = t || (!!r && $PROXY in r);
|
|
3630
|
-
const
|
|
3631
|
-
if (
|
|
3632
|
-
for (let e = 0; e <
|
|
3897
|
+
const s = !!r && r[$SOURCES];
|
|
3898
|
+
if (s) {
|
|
3899
|
+
for (let e = 0; e < s.length; e++) n.push(s[e]);
|
|
3633
3900
|
} else n.push(typeof r === "function" ? ((t = true), createMemo(r)) : r);
|
|
3634
3901
|
}
|
|
3635
3902
|
if (SUPPORTS_PROXY && t) {
|
|
@@ -3662,35 +3929,35 @@ function merge(...e) {
|
|
|
3662
3929
|
}
|
|
3663
3930
|
const i = Object.create(null);
|
|
3664
3931
|
let r = false;
|
|
3665
|
-
let
|
|
3666
|
-
for (let e =
|
|
3932
|
+
let s = n.length - 1;
|
|
3933
|
+
for (let e = s; e >= 0; e--) {
|
|
3667
3934
|
const t = n[e];
|
|
3668
3935
|
if (!t) {
|
|
3669
|
-
e ===
|
|
3936
|
+
e === s && s--;
|
|
3670
3937
|
continue;
|
|
3671
3938
|
}
|
|
3672
|
-
const
|
|
3673
|
-
for (let n =
|
|
3674
|
-
const u =
|
|
3939
|
+
const o = Object.getOwnPropertyNames(t);
|
|
3940
|
+
for (let n = o.length - 1; n >= 0; n--) {
|
|
3941
|
+
const u = o[n];
|
|
3675
3942
|
if (u === "__proto__" || u === "constructor") continue;
|
|
3676
3943
|
if (!i[u]) {
|
|
3677
|
-
r = r || e !==
|
|
3944
|
+
r = r || e !== s;
|
|
3678
3945
|
const n = Object.getOwnPropertyDescriptor(t, u);
|
|
3679
3946
|
i[u] = n.get ? { enumerable: true, configurable: true, get: n.get.bind(t) } : n;
|
|
3680
3947
|
}
|
|
3681
3948
|
}
|
|
3682
3949
|
}
|
|
3683
|
-
if (!r) return n[
|
|
3684
|
-
const
|
|
3950
|
+
if (!r) return n[s];
|
|
3951
|
+
const o = {};
|
|
3685
3952
|
const u = Object.keys(i);
|
|
3686
3953
|
for (let e = u.length - 1; e >= 0; e--) {
|
|
3687
3954
|
const t = u[e],
|
|
3688
3955
|
n = i[t];
|
|
3689
|
-
if (n.get) Object.defineProperty(
|
|
3690
|
-
else
|
|
3956
|
+
if (n.get) Object.defineProperty(o, t, n);
|
|
3957
|
+
else o[t] = n.value;
|
|
3691
3958
|
}
|
|
3692
|
-
|
|
3693
|
-
return
|
|
3959
|
+
o[$SOURCES] = n;
|
|
3960
|
+
return o;
|
|
3694
3961
|
}
|
|
3695
3962
|
function omit(e, ...t) {
|
|
3696
3963
|
if (SUPPORTS_PROXY && $PROXY in e) {
|
|
@@ -3712,12 +3979,12 @@ function omit(e, ...t) {
|
|
|
3712
3979
|
const n = {};
|
|
3713
3980
|
const i = Object.getOwnPropertyNames(e);
|
|
3714
3981
|
const r = t.length > 4 && i.length > t.length ? new Set(t) : undefined;
|
|
3715
|
-
for (const
|
|
3716
|
-
if (r ? !r.has(
|
|
3717
|
-
const t = Object.getOwnPropertyDescriptor(e,
|
|
3982
|
+
for (const s of i) {
|
|
3983
|
+
if (r ? !r.has(s) : !t.includes(s)) {
|
|
3984
|
+
const t = Object.getOwnPropertyDescriptor(e, s);
|
|
3718
3985
|
!t.get && !t.set && t.enumerable && t.writable && t.configurable
|
|
3719
|
-
? (n[
|
|
3720
|
-
: Object.defineProperty(n,
|
|
3986
|
+
? (n[s] = t.value)
|
|
3987
|
+
: Object.defineProperty(n, s, t);
|
|
3721
3988
|
}
|
|
3722
3989
|
}
|
|
3723
3990
|
return n;
|
|
@@ -3725,252 +3992,252 @@ function omit(e, ...t) {
|
|
|
3725
3992
|
function mapArray(e, t, n) {
|
|
3726
3993
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
3727
3994
|
const r = t.length > 1;
|
|
3728
|
-
const
|
|
3729
|
-
const
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3995
|
+
const s = t;
|
|
3996
|
+
const o = {
|
|
3997
|
+
st: createOwner(),
|
|
3998
|
+
ot: 0,
|
|
3999
|
+
ut: e,
|
|
4000
|
+
ct: [],
|
|
4001
|
+
lt: s,
|
|
4002
|
+
ft: [],
|
|
4003
|
+
Et: [],
|
|
4004
|
+
dt: i,
|
|
4005
|
+
St: i || n?.keyed === false ? [] : undefined,
|
|
4006
|
+
Tt: r && n?.keyed !== false ? [] : undefined,
|
|
4007
|
+
_t: n?.keyed === false,
|
|
4008
|
+
Ot: n?.fallback
|
|
3742
4009
|
};
|
|
3743
|
-
const u = computed(updateKeyedMap.bind(
|
|
3744
|
-
|
|
3745
|
-
u.
|
|
4010
|
+
const u = computed(updateKeyedMap.bind(o));
|
|
4011
|
+
o.st.De = u;
|
|
4012
|
+
u.Se &= ~CONFIG_AUTO_DISPOSE;
|
|
3746
4013
|
return accessor(u);
|
|
3747
4014
|
}
|
|
3748
4015
|
const pureOptions = { ownedWrite: true };
|
|
3749
4016
|
function updateKeyedMap() {
|
|
3750
|
-
const e = this.
|
|
4017
|
+
const e = this.ut() || [],
|
|
3751
4018
|
t = e.length;
|
|
3752
4019
|
e[$TRACK];
|
|
3753
|
-
runWithOwner(this.
|
|
4020
|
+
runWithOwner(this.st, () => {
|
|
3754
4021
|
let n,
|
|
3755
4022
|
i,
|
|
3756
|
-
r = this.
|
|
3757
|
-
? this.
|
|
4023
|
+
r = this.St
|
|
4024
|
+
? this._t
|
|
3758
4025
|
? () => {
|
|
3759
|
-
this.
|
|
3760
|
-
return this.
|
|
4026
|
+
this.St[i] = signal(e[i], pureOptions);
|
|
4027
|
+
return this.lt(accessor(this.St[i]), i);
|
|
3761
4028
|
}
|
|
3762
4029
|
: () => {
|
|
3763
|
-
this.
|
|
3764
|
-
this.
|
|
3765
|
-
return this.
|
|
4030
|
+
this.St[i] = signal(e[i], pureOptions);
|
|
4031
|
+
this.Tt && (this.Tt[i] = signal(i, pureOptions));
|
|
4032
|
+
return this.lt(accessor(this.St[i]), this.Tt ? accessor(this.Tt[i]) : undefined);
|
|
3766
4033
|
}
|
|
3767
|
-
: this.
|
|
4034
|
+
: this.Tt
|
|
3768
4035
|
? () => {
|
|
3769
4036
|
const t = e[i];
|
|
3770
|
-
this.
|
|
3771
|
-
return this.
|
|
4037
|
+
this.Tt[i] = signal(i, pureOptions);
|
|
4038
|
+
return this.lt(t, accessor(this.Tt[i]));
|
|
3772
4039
|
}
|
|
3773
4040
|
: () => {
|
|
3774
4041
|
const t = e[i];
|
|
3775
|
-
return this.
|
|
4042
|
+
return this.lt(t);
|
|
3776
4043
|
};
|
|
3777
4044
|
if (t === 0) {
|
|
3778
|
-
if (this.
|
|
3779
|
-
this.
|
|
3780
|
-
this.
|
|
3781
|
-
this.
|
|
3782
|
-
this.
|
|
3783
|
-
this.
|
|
3784
|
-
this.
|
|
3785
|
-
this.
|
|
4045
|
+
if (this.ot !== 0) {
|
|
4046
|
+
this.st.dispose(false);
|
|
4047
|
+
this.Et = [];
|
|
4048
|
+
this.ct = [];
|
|
4049
|
+
this.ft = [];
|
|
4050
|
+
this.ot = 0;
|
|
4051
|
+
this.St && (this.St = []);
|
|
4052
|
+
this.Tt && (this.Tt = []);
|
|
3786
4053
|
}
|
|
3787
|
-
if (this.
|
|
3788
|
-
this.
|
|
4054
|
+
if (this.Ot && !this.ft[0]) {
|
|
4055
|
+
this.ft[0] = runWithOwner((this.Et[0] = createOwner()), this.Ot);
|
|
3789
4056
|
}
|
|
3790
|
-
} else if (this.
|
|
3791
|
-
if (this.
|
|
3792
|
-
this.
|
|
4057
|
+
} else if (this.ot === 0) {
|
|
4058
|
+
if (this.Et[0]) this.Et[0].dispose();
|
|
4059
|
+
this.ft = new Array(t);
|
|
3793
4060
|
for (i = 0; i < t; i++) {
|
|
3794
|
-
this.
|
|
3795
|
-
this.
|
|
4061
|
+
this.ct[i] = e[i];
|
|
4062
|
+
this.ft[i] = runWithOwner((this.Et[i] = createOwner()), r);
|
|
3796
4063
|
}
|
|
3797
|
-
this.
|
|
4064
|
+
this.ot = t;
|
|
3798
4065
|
} else {
|
|
3799
|
-
let
|
|
3800
|
-
|
|
4066
|
+
let s,
|
|
4067
|
+
o,
|
|
3801
4068
|
u,
|
|
3802
4069
|
c,
|
|
3803
|
-
l,
|
|
3804
4070
|
a,
|
|
4071
|
+
l,
|
|
3805
4072
|
f,
|
|
3806
4073
|
E = new Array(t),
|
|
3807
4074
|
d = new Array(t),
|
|
3808
|
-
S = this.
|
|
3809
|
-
T = this.
|
|
4075
|
+
S = this.St ? new Array(t) : undefined,
|
|
4076
|
+
T = this.Tt ? new Array(t) : undefined;
|
|
3810
4077
|
for (
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
4078
|
+
s = 0, o = Math.min(this.ot, t);
|
|
4079
|
+
s < o && (this.ct[s] === e[s] || (this.St && compare(this.dt, this.ct[s], e[s])));
|
|
4080
|
+
s++
|
|
3814
4081
|
) {
|
|
3815
|
-
if (this.
|
|
4082
|
+
if (this.St) setSignal(this.St[s], e[s]);
|
|
3816
4083
|
}
|
|
3817
4084
|
for (
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
u >=
|
|
3821
|
-
(this.
|
|
3822
|
-
|
|
4085
|
+
o = this.ot - 1, u = t - 1;
|
|
4086
|
+
o >= s &&
|
|
4087
|
+
u >= s &&
|
|
4088
|
+
(this.ct[o] === e[u] || (this.St && compare(this.dt, this.ct[o], e[u])));
|
|
4089
|
+
o--, u--
|
|
3823
4090
|
) {
|
|
3824
|
-
E[u] = this.
|
|
3825
|
-
d[u] = this.
|
|
3826
|
-
S && (S[u] = this.
|
|
3827
|
-
T && (T[u] = this.
|
|
4091
|
+
E[u] = this.ft[o];
|
|
4092
|
+
d[u] = this.Et[o];
|
|
4093
|
+
S && (S[u] = this.St[o]);
|
|
4094
|
+
T && (T[u] = this.Tt[o]);
|
|
3828
4095
|
}
|
|
3829
|
-
|
|
4096
|
+
l = new Map();
|
|
3830
4097
|
f = new Array(u + 1);
|
|
3831
|
-
for (i = u; i >=
|
|
4098
|
+
for (i = u; i >= s; i--) {
|
|
3832
4099
|
c = e[i];
|
|
3833
|
-
|
|
3834
|
-
n =
|
|
4100
|
+
a = this.dt ? this.dt(c) : c;
|
|
4101
|
+
n = l.get(a);
|
|
3835
4102
|
f[i] = n === undefined ? -1 : n;
|
|
3836
|
-
|
|
4103
|
+
l.set(a, i);
|
|
3837
4104
|
}
|
|
3838
|
-
for (n =
|
|
3839
|
-
c = this.
|
|
3840
|
-
|
|
3841
|
-
i =
|
|
4105
|
+
for (n = s; n <= o; n++) {
|
|
4106
|
+
c = this.ct[n];
|
|
4107
|
+
a = this.dt ? this.dt(c) : c;
|
|
4108
|
+
i = l.get(a);
|
|
3842
4109
|
if (i !== undefined && i !== -1) {
|
|
3843
|
-
E[i] = this.
|
|
3844
|
-
d[i] = this.
|
|
3845
|
-
S && (S[i] = this.
|
|
3846
|
-
T && (T[i] = this.
|
|
4110
|
+
E[i] = this.ft[n];
|
|
4111
|
+
d[i] = this.Et[n];
|
|
4112
|
+
S && (S[i] = this.St[n]);
|
|
4113
|
+
T && (T[i] = this.Tt[n]);
|
|
3847
4114
|
i = f[i];
|
|
3848
|
-
|
|
3849
|
-
} else this.
|
|
4115
|
+
l.set(a, i);
|
|
4116
|
+
} else this.Et[n].dispose();
|
|
3850
4117
|
}
|
|
3851
|
-
for (i =
|
|
4118
|
+
for (i = s; i < t; i++) {
|
|
3852
4119
|
if (i in E) {
|
|
3853
|
-
this.
|
|
3854
|
-
this.
|
|
4120
|
+
this.ft[i] = E[i];
|
|
4121
|
+
this.Et[i] = d[i];
|
|
3855
4122
|
if (S) {
|
|
3856
|
-
this.
|
|
3857
|
-
setSignal(this.
|
|
4123
|
+
this.St[i] = S[i];
|
|
4124
|
+
setSignal(this.St[i], e[i]);
|
|
3858
4125
|
}
|
|
3859
4126
|
if (T) {
|
|
3860
|
-
this.
|
|
3861
|
-
setSignal(this.
|
|
4127
|
+
this.Tt[i] = T[i];
|
|
4128
|
+
setSignal(this.Tt[i], i);
|
|
3862
4129
|
}
|
|
3863
4130
|
} else {
|
|
3864
|
-
this.
|
|
4131
|
+
this.ft[i] = runWithOwner((this.Et[i] = createOwner()), r);
|
|
3865
4132
|
}
|
|
3866
4133
|
}
|
|
3867
|
-
this.
|
|
3868
|
-
this.
|
|
4134
|
+
this.ft = this.ft.slice(0, (this.ot = t));
|
|
4135
|
+
this.ct = e.slice(0);
|
|
3869
4136
|
}
|
|
3870
4137
|
});
|
|
3871
|
-
return this.
|
|
4138
|
+
return this.ft;
|
|
3872
4139
|
}
|
|
3873
4140
|
function repeat(e, t, n) {
|
|
3874
4141
|
const i = t;
|
|
3875
4142
|
const r = computed(
|
|
3876
4143
|
updateRepeat.bind({
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
4144
|
+
st: createOwner(),
|
|
4145
|
+
ot: 0,
|
|
4146
|
+
Rt: 0,
|
|
4147
|
+
It: e,
|
|
4148
|
+
lt: i,
|
|
4149
|
+
Et: [],
|
|
4150
|
+
ft: [],
|
|
4151
|
+
At: n?.from,
|
|
4152
|
+
Ot: n?.fallback
|
|
3886
4153
|
})
|
|
3887
4154
|
);
|
|
3888
|
-
r.
|
|
4155
|
+
r.Se &= ~CONFIG_AUTO_DISPOSE;
|
|
3889
4156
|
return accessor(r);
|
|
3890
4157
|
}
|
|
3891
4158
|
function updateRepeat() {
|
|
3892
|
-
const e = this.
|
|
3893
|
-
const t = this.
|
|
3894
|
-
runWithOwner(this.
|
|
4159
|
+
const e = this.It();
|
|
4160
|
+
const t = this.At?.() || 0;
|
|
4161
|
+
runWithOwner(this.st, () => {
|
|
3895
4162
|
if (e === 0) {
|
|
3896
|
-
if (this.
|
|
3897
|
-
this.
|
|
3898
|
-
this.
|
|
3899
|
-
this.
|
|
3900
|
-
this.
|
|
3901
|
-
this.
|
|
4163
|
+
if (this.ot !== 0) {
|
|
4164
|
+
this.st.dispose(false);
|
|
4165
|
+
this.Et = [];
|
|
4166
|
+
this.ft = [];
|
|
4167
|
+
this.ot = 0;
|
|
4168
|
+
this.Rt = 0;
|
|
3902
4169
|
}
|
|
3903
|
-
if (this.
|
|
3904
|
-
this.
|
|
4170
|
+
if (this.Ot && !this.ft[0]) {
|
|
4171
|
+
this.ft[0] = runWithOwner((this.Et[0] = createOwner()), this.Ot);
|
|
3905
4172
|
}
|
|
3906
4173
|
return;
|
|
3907
4174
|
}
|
|
3908
4175
|
const n = t + e;
|
|
3909
|
-
const i = this.
|
|
3910
|
-
if (this.
|
|
3911
|
-
if (t >= i || n <= this.
|
|
3912
|
-
for (let e = 0; e < this.
|
|
3913
|
-
this.
|
|
3914
|
-
this.
|
|
4176
|
+
const i = this.Rt + this.ot;
|
|
4177
|
+
if (this.ot === 0 && this.Et[0]) this.Et[0].dispose();
|
|
4178
|
+
if (t >= i || n <= this.Rt) {
|
|
4179
|
+
for (let e = 0; e < this.ot; e++) this.Et[e].dispose();
|
|
4180
|
+
this.Et = new Array(e);
|
|
4181
|
+
this.ft = new Array(e);
|
|
3915
4182
|
for (let n = 0; n < e; n++)
|
|
3916
|
-
this.
|
|
3917
|
-
this.
|
|
3918
|
-
this.
|
|
4183
|
+
this.ft[n] = runWithOwner((this.Et[n] = createOwner()), () => this.lt(t + n));
|
|
4184
|
+
this.Rt = t;
|
|
4185
|
+
this.ot = e;
|
|
3919
4186
|
return;
|
|
3920
4187
|
}
|
|
3921
|
-
for (let e = n; e < i; e++) this.
|
|
3922
|
-
if (this.
|
|
3923
|
-
const e = t - this.
|
|
3924
|
-
for (let t = 0; t < e && t < this.
|
|
3925
|
-
this.
|
|
3926
|
-
this.
|
|
3927
|
-
} else if (this.
|
|
3928
|
-
let n = i - this.
|
|
3929
|
-
let r = this.
|
|
3930
|
-
this.
|
|
4188
|
+
for (let e = n; e < i; e++) this.Et[e - this.Rt].dispose();
|
|
4189
|
+
if (this.Rt < t) {
|
|
4190
|
+
const e = t - this.Rt;
|
|
4191
|
+
for (let t = 0; t < e && t < this.ot; t++) this.Et[t].dispose();
|
|
4192
|
+
this.Et.splice(0, e);
|
|
4193
|
+
this.ft.splice(0, e);
|
|
4194
|
+
} else if (this.Rt > t) {
|
|
4195
|
+
let n = i - this.Rt - 1;
|
|
4196
|
+
let r = this.Rt - t;
|
|
4197
|
+
this.Et.length = this.ft.length = e;
|
|
3931
4198
|
while (n >= r) {
|
|
3932
|
-
this.
|
|
3933
|
-
this.
|
|
4199
|
+
this.Et[n] = this.Et[n - r];
|
|
4200
|
+
this.ft[n] = this.ft[n - r];
|
|
3934
4201
|
n--;
|
|
3935
4202
|
}
|
|
3936
4203
|
for (let e = 0; e < r; e++) {
|
|
3937
|
-
this.
|
|
4204
|
+
this.ft[e] = runWithOwner((this.Et[e] = createOwner()), () => this.lt(e + t));
|
|
3938
4205
|
}
|
|
3939
4206
|
}
|
|
3940
4207
|
for (let e = i; e < n; e++) {
|
|
3941
|
-
this.
|
|
4208
|
+
this.ft[e - t] = runWithOwner((this.Et[e - t] = createOwner()), () => this.lt(e));
|
|
3942
4209
|
}
|
|
3943
|
-
this.
|
|
3944
|
-
this.
|
|
3945
|
-
this.
|
|
4210
|
+
this.ft = this.ft.slice(0, e);
|
|
4211
|
+
this.Rt = t;
|
|
4212
|
+
this.ot = e;
|
|
3946
4213
|
});
|
|
3947
|
-
return this.
|
|
4214
|
+
return this.ft;
|
|
3948
4215
|
}
|
|
3949
4216
|
function compare(e, t, n) {
|
|
3950
4217
|
return e ? e(t) === e(n) : true;
|
|
3951
4218
|
}
|
|
3952
4219
|
function boundaryComputed(e, t) {
|
|
3953
4220
|
const n = computed(e, { lazy: true });
|
|
3954
|
-
n.
|
|
3955
|
-
const i = e !== undefined ? e : n.
|
|
3956
|
-
const r = t !== undefined ? t : n.
|
|
3957
|
-
n.
|
|
3958
|
-
n.
|
|
3959
|
-
const
|
|
3960
|
-
if (
|
|
3961
|
-
n.
|
|
3962
|
-
if (n.
|
|
4221
|
+
n.Be = (e, t) => {
|
|
4222
|
+
const i = e !== undefined ? e : n.q;
|
|
4223
|
+
const r = t !== undefined ? t : n.Te;
|
|
4224
|
+
n.q &= ~n.ht;
|
|
4225
|
+
n.W.notify(n, STATUS_PENDING | STATUS_ERROR, i, r);
|
|
4226
|
+
const s = i & ~n.ht & (STATUS_PENDING | STATUS_ERROR);
|
|
4227
|
+
if (s) {
|
|
4228
|
+
n.q &= ~s;
|
|
4229
|
+
if (n.Te === r && !(n.q & (STATUS_PENDING | STATUS_ERROR))) n.Te = undefined;
|
|
3963
4230
|
}
|
|
3964
4231
|
};
|
|
3965
|
-
n.
|
|
3966
|
-
n.
|
|
4232
|
+
n.ht = t;
|
|
4233
|
+
n.Se &= ~CONFIG_AUTO_DISPOSE;
|
|
3967
4234
|
recompute(n, true);
|
|
3968
4235
|
return n;
|
|
3969
4236
|
}
|
|
3970
4237
|
function createBoundChildren(e, t, n, i) {
|
|
3971
|
-
const r = e.
|
|
3972
|
-
r.addChild((e.
|
|
3973
|
-
cleanup(() => r.removeChild(e.
|
|
4238
|
+
const r = e.W;
|
|
4239
|
+
r.addChild((e.W = n));
|
|
4240
|
+
cleanup(() => r.removeChild(e.W));
|
|
3974
4241
|
return runWithOwner(e, () => {
|
|
3975
4242
|
const e = computed(t);
|
|
3976
4243
|
return boundaryComputed(() => flatten(read(e)), i);
|
|
@@ -3985,52 +4252,52 @@ function isRevealController(e) {
|
|
|
3985
4252
|
return e instanceof RevealController;
|
|
3986
4253
|
}
|
|
3987
4254
|
function isSlotReady(e) {
|
|
3988
|
-
return isRevealController(e) ? e.isReady() : e.
|
|
4255
|
+
return isRevealController(e) ? e.isReady() : e.Nt.size === 0 && !e.Ct;
|
|
3989
4256
|
}
|
|
3990
4257
|
function isSlotMinimallyReady(e) {
|
|
3991
4258
|
return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
|
|
3992
4259
|
}
|
|
3993
4260
|
function setSlotState(e, t, n, i) {
|
|
3994
|
-
setSignal(e.
|
|
3995
|
-
setSignal(e.
|
|
4261
|
+
setSignal(e.yt, n);
|
|
4262
|
+
setSignal(e.gt, i);
|
|
3996
4263
|
if (isRevealController(e)) {
|
|
3997
|
-
if (!n && e.
|
|
4264
|
+
if (!n && e.Pt === t) e.Pt = undefined;
|
|
3998
4265
|
return e.evaluate(n, i);
|
|
3999
4266
|
}
|
|
4000
|
-
if (!n && e.
|
|
4267
|
+
if (!n && e.Dt === t && e.bt) e.Dt = undefined;
|
|
4001
4268
|
}
|
|
4002
4269
|
class RevealController {
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4270
|
+
vt;
|
|
4271
|
+
wt;
|
|
4272
|
+
Lt = [];
|
|
4273
|
+
Pt;
|
|
4274
|
+
yt = signal(false, { ownedWrite: true, tt: true });
|
|
4275
|
+
gt = signal(false, { ownedWrite: true, tt: true });
|
|
4276
|
+
Vt = true;
|
|
4277
|
+
Ut = true;
|
|
4278
|
+
kt = false;
|
|
4012
4279
|
constructor(e, t) {
|
|
4013
|
-
this.
|
|
4014
|
-
this.
|
|
4280
|
+
this.vt = e;
|
|
4281
|
+
this.wt = t;
|
|
4015
4282
|
}
|
|
4016
|
-
|
|
4017
|
-
for (let t = 0; t < this.
|
|
4018
|
-
const n = this.
|
|
4019
|
-
if ((isRevealController(n) ? n.
|
|
4283
|
+
Gt(e) {
|
|
4284
|
+
for (let t = 0; t < this.Lt.length; t++) {
|
|
4285
|
+
const n = this.Lt[t];
|
|
4286
|
+
if ((isRevealController(n) ? n.Pt : n.Dt) !== this) continue;
|
|
4020
4287
|
if (e(n) === false) return false;
|
|
4021
4288
|
}
|
|
4022
4289
|
return true;
|
|
4023
4290
|
}
|
|
4024
4291
|
isReady() {
|
|
4025
|
-
return this.
|
|
4292
|
+
return this.Gt(isSlotReady);
|
|
4026
4293
|
}
|
|
4027
4294
|
isMinimallyReady() {
|
|
4028
|
-
const e = untrack(this.
|
|
4029
|
-
if (e === "together") return this.
|
|
4295
|
+
const e = untrack(this.vt);
|
|
4296
|
+
if (e === "together") return this.Gt(isSlotMinimallyReady);
|
|
4030
4297
|
if (e === "natural") {
|
|
4031
4298
|
let e = false;
|
|
4032
4299
|
let t = false;
|
|
4033
|
-
this.
|
|
4300
|
+
this.Gt(n => {
|
|
4034
4301
|
e = true;
|
|
4035
4302
|
if (isSlotMinimallyReady(n)) {
|
|
4036
4303
|
t = true;
|
|
@@ -4040,58 +4307,58 @@ class RevealController {
|
|
|
4040
4307
|
return !e || t;
|
|
4041
4308
|
}
|
|
4042
4309
|
let t = true;
|
|
4043
|
-
this.
|
|
4310
|
+
this.Gt(e => {
|
|
4044
4311
|
t = isSlotMinimallyReady(e);
|
|
4045
4312
|
return false;
|
|
4046
4313
|
});
|
|
4047
4314
|
return t;
|
|
4048
4315
|
}
|
|
4049
4316
|
register(e) {
|
|
4050
|
-
if (this.
|
|
4051
|
-
this.
|
|
4052
|
-
const t = untrack(this.
|
|
4053
|
-
(setSignal(e.
|
|
4317
|
+
if (this.Lt.includes(e)) return;
|
|
4318
|
+
this.Lt.push(e);
|
|
4319
|
+
const t = untrack(this.vt);
|
|
4320
|
+
(setSignal(e.yt, true), setSignal(e.gt, t === "sequential" ? !!untrack(this.wt) : false));
|
|
4054
4321
|
untrack(() => this.evaluate());
|
|
4055
4322
|
}
|
|
4056
4323
|
unregister(e) {
|
|
4057
|
-
const t = this.
|
|
4058
|
-
if (t >= 0) this.
|
|
4324
|
+
const t = this.Lt.indexOf(e);
|
|
4325
|
+
if (t >= 0) this.Lt.splice(t, 1);
|
|
4059
4326
|
untrack(() => this.evaluate());
|
|
4060
4327
|
}
|
|
4061
4328
|
evaluate(e, t) {
|
|
4062
|
-
if (this.
|
|
4063
|
-
this.
|
|
4064
|
-
const n = this.
|
|
4065
|
-
const i = this.
|
|
4329
|
+
if (this.kt) return;
|
|
4330
|
+
this.kt = true;
|
|
4331
|
+
const n = this.Vt;
|
|
4332
|
+
const i = this.Ut;
|
|
4066
4333
|
try {
|
|
4067
|
-
const n = e ?? read(this.
|
|
4068
|
-
i = untrack(this.
|
|
4069
|
-
r = i === "sequential" && !!untrack(this.
|
|
4070
|
-
|
|
4334
|
+
const n = e ?? read(this.yt),
|
|
4335
|
+
i = untrack(this.vt),
|
|
4336
|
+
r = i === "sequential" && !!untrack(this.wt),
|
|
4337
|
+
s = t ?? r;
|
|
4071
4338
|
if (n) {
|
|
4072
|
-
this.
|
|
4339
|
+
this.Gt(e => setSlotState(e, this, true, s));
|
|
4073
4340
|
} else if (i === "natural") {
|
|
4074
|
-
this.
|
|
4341
|
+
this.Gt(e => {
|
|
4075
4342
|
if (isRevealController(e)) {
|
|
4076
|
-
setSignal(e.
|
|
4077
|
-
setSignal(e.
|
|
4343
|
+
setSignal(e.gt, false);
|
|
4344
|
+
setSignal(e.yt, false);
|
|
4078
4345
|
e.evaluate(false, false);
|
|
4079
4346
|
} else {
|
|
4080
4347
|
setSlotState(e, this, !isSlotReady(e), false);
|
|
4081
4348
|
}
|
|
4082
4349
|
});
|
|
4083
4350
|
} else if (i === "together") {
|
|
4084
|
-
const e = this.
|
|
4085
|
-
this.
|
|
4351
|
+
const e = this.Gt(isSlotMinimallyReady);
|
|
4352
|
+
this.Gt(t => setSlotState(t, this, !e, false));
|
|
4086
4353
|
} else {
|
|
4087
4354
|
let e = false;
|
|
4088
|
-
this.
|
|
4355
|
+
this.Gt(t => {
|
|
4089
4356
|
if (e) return setSlotState(t, this, true, r);
|
|
4090
4357
|
if (isSlotReady(t)) return setSlotState(t, this, false, false);
|
|
4091
4358
|
e = true;
|
|
4092
4359
|
if (isRevealController(t)) {
|
|
4093
|
-
setSignal(t.
|
|
4094
|
-
setSignal(t.
|
|
4360
|
+
setSignal(t.gt, false);
|
|
4361
|
+
setSignal(t.yt, false);
|
|
4095
4362
|
t.evaluate(false, false);
|
|
4096
4363
|
} else {
|
|
4097
4364
|
setSlotState(t, this, true, false);
|
|
@@ -4099,128 +4366,125 @@ class RevealController {
|
|
|
4099
4366
|
});
|
|
4100
4367
|
}
|
|
4101
4368
|
} finally {
|
|
4102
|
-
this.
|
|
4103
|
-
this.
|
|
4104
|
-
this.
|
|
4369
|
+
this.Vt = this.isReady();
|
|
4370
|
+
this.Ut = this.isMinimallyReady();
|
|
4371
|
+
this.kt = false;
|
|
4105
4372
|
}
|
|
4106
|
-
if (this.
|
|
4373
|
+
if (this.Pt && (n !== this.Vt || i !== this.Ut)) this.Pt.evaluate();
|
|
4107
4374
|
}
|
|
4108
4375
|
}
|
|
4109
4376
|
class CollectionQueue extends Queue {
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4377
|
+
Ft;
|
|
4378
|
+
Nt = new Set();
|
|
4379
|
+
Wt;
|
|
4380
|
+
Ct = true;
|
|
4381
|
+
yt = signal(false, { ownedWrite: true, tt: true });
|
|
4382
|
+
Te;
|
|
4383
|
+
gt = signal(false, { ownedWrite: true, tt: true });
|
|
4384
|
+
Dt;
|
|
4385
|
+
bt = false;
|
|
4386
|
+
Mt;
|
|
4387
|
+
Ht = ON_INIT;
|
|
4121
4388
|
constructor(e) {
|
|
4122
4389
|
super();
|
|
4123
|
-
this.
|
|
4390
|
+
this.Ft = e;
|
|
4124
4391
|
}
|
|
4125
4392
|
run(e) {
|
|
4126
|
-
if (!e || (read(this.
|
|
4393
|
+
if (!e || (read(this.yt) && (!_revealUsed || read(this.gt)))) return;
|
|
4127
4394
|
return super.run(e);
|
|
4128
4395
|
}
|
|
4129
4396
|
notify(e, t, n, i) {
|
|
4130
|
-
if (!(t & this.
|
|
4131
|
-
if (this.
|
|
4397
|
+
if (!(t & this.Ft)) return super.notify(e, t, n, i);
|
|
4398
|
+
if (this.bt && this.Mt) {
|
|
4132
4399
|
const e = untrack(() => {
|
|
4133
4400
|
try {
|
|
4134
|
-
return this.
|
|
4401
|
+
return this.Mt();
|
|
4135
4402
|
} catch {
|
|
4136
4403
|
return ON_INIT;
|
|
4137
4404
|
}
|
|
4138
4405
|
});
|
|
4139
|
-
if (e !== this.
|
|
4140
|
-
this.
|
|
4141
|
-
this.
|
|
4142
|
-
this.
|
|
4406
|
+
if (e !== this.Ht) {
|
|
4407
|
+
this.Ht = e;
|
|
4408
|
+
this.bt = false;
|
|
4409
|
+
this.Nt.clear();
|
|
4143
4410
|
}
|
|
4144
4411
|
}
|
|
4145
|
-
if (this.
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
if (n & this.bt) {
|
|
4150
|
-
this.Tt = true;
|
|
4151
|
-
const t = i?.source || e.ae?.source;
|
|
4412
|
+
if (this.Ft & STATUS_PENDING && this.bt) return super.notify(e, t, n, i);
|
|
4413
|
+
if (n & this.Ft) {
|
|
4414
|
+
this.Ct = true;
|
|
4415
|
+
const t = i?.source || e.Te?.source;
|
|
4152
4416
|
if (t) {
|
|
4153
|
-
const e = this.
|
|
4154
|
-
this.
|
|
4155
|
-
if (e) setSignal(this.
|
|
4156
|
-
if (this.
|
|
4157
|
-
setSignal(this.
|
|
4417
|
+
const e = this.Nt.size === 0;
|
|
4418
|
+
this.Nt.add(t);
|
|
4419
|
+
if (e) setSignal(this.yt, true);
|
|
4420
|
+
if (this.Ft & STATUS_ERROR) {
|
|
4421
|
+
setSignal(this.Te, unwrapStatusError(t.Te));
|
|
4158
4422
|
}
|
|
4159
4423
|
}
|
|
4160
4424
|
}
|
|
4161
|
-
t &= ~this.
|
|
4425
|
+
t &= ~this.Ft;
|
|
4162
4426
|
return t ? super.notify(e, t, n, i) : true;
|
|
4163
4427
|
}
|
|
4164
4428
|
checkSources() {
|
|
4165
|
-
for (const e of this.
|
|
4429
|
+
for (const e of this.Nt) {
|
|
4166
4430
|
if (
|
|
4167
|
-
e.
|
|
4168
|
-
(!(e.
|
|
4431
|
+
e.H & REACTIVE_DISPOSED ||
|
|
4432
|
+
(!(e.q & this.Ft) && !(this.Ft & STATUS_ERROR && e.q & STATUS_PENDING))
|
|
4169
4433
|
)
|
|
4170
|
-
this.
|
|
4434
|
+
this.Nt.delete(e);
|
|
4171
4435
|
}
|
|
4172
|
-
if (!this.
|
|
4173
|
-
if (this.
|
|
4174
|
-
this.
|
|
4436
|
+
if (!this.Nt.size) {
|
|
4437
|
+
if (this.Ft & STATUS_PENDING && this.Ct && !this.bt && this.Wt) {
|
|
4438
|
+
this.Ct = !!(this.Wt.q & this.Ft);
|
|
4175
4439
|
} else {
|
|
4176
|
-
this.
|
|
4440
|
+
this.Ct = false;
|
|
4177
4441
|
}
|
|
4178
|
-
if (!this.
|
|
4179
|
-
setSignal(this.
|
|
4180
|
-
if (this.
|
|
4442
|
+
if (!this.Ct) {
|
|
4443
|
+
setSignal(this.yt, false);
|
|
4444
|
+
if (this.Mt) {
|
|
4181
4445
|
try {
|
|
4182
|
-
this.
|
|
4446
|
+
this.Ht = untrack(() => this.Mt());
|
|
4183
4447
|
} catch {}
|
|
4184
4448
|
}
|
|
4185
4449
|
}
|
|
4186
4450
|
}
|
|
4187
|
-
if (_revealUsed) this.
|
|
4451
|
+
if (_revealUsed) this.Dt?.evaluate();
|
|
4188
4452
|
}
|
|
4189
4453
|
}
|
|
4190
4454
|
function createCollectionBoundary(e, t, n, i) {
|
|
4191
4455
|
const r = createOwner();
|
|
4192
4456
|
if (_revealUsed) setContext(RevealControllerContext, null, r);
|
|
4193
|
-
const
|
|
4194
|
-
if (e === STATUS_ERROR)
|
|
4195
|
-
if (i)
|
|
4196
|
-
const
|
|
4457
|
+
const s = new CollectionQueue(e);
|
|
4458
|
+
if (e === STATUS_ERROR) s.Te = signal(undefined, { ownedWrite: true, tt: true });
|
|
4459
|
+
if (i) s.Mt = i;
|
|
4460
|
+
const o = (s.Wt = createBoundChildren(r, t, s, e));
|
|
4197
4461
|
untrack(() => {
|
|
4198
4462
|
let t = false;
|
|
4199
4463
|
try {
|
|
4200
|
-
read(
|
|
4464
|
+
read(o);
|
|
4201
4465
|
} catch (e) {
|
|
4202
4466
|
if (e instanceof NotReadyError) t = true;
|
|
4203
4467
|
else throw e;
|
|
4204
4468
|
}
|
|
4205
|
-
|
|
4469
|
+
s.Ct = t || !!(o.q & e) || o.Te instanceof NotReadyError;
|
|
4206
4470
|
});
|
|
4207
4471
|
const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
|
|
4208
4472
|
if (u) {
|
|
4209
|
-
|
|
4210
|
-
u.register(
|
|
4211
|
-
cleanup(() => u.unregister(
|
|
4473
|
+
s.Dt = u;
|
|
4474
|
+
u.register(s);
|
|
4475
|
+
cleanup(() => u.unregister(s));
|
|
4212
4476
|
}
|
|
4213
4477
|
return accessor(
|
|
4214
4478
|
computed(
|
|
4215
4479
|
() => {
|
|
4216
|
-
if (!read(
|
|
4217
|
-
const e = read(
|
|
4218
|
-
if (!untrack(() => read(
|
|
4480
|
+
if (!read(s.yt)) {
|
|
4481
|
+
const e = read(o);
|
|
4482
|
+
if (!untrack(() => read(s.yt))) return ((s.bt = true), e);
|
|
4219
4483
|
}
|
|
4220
|
-
if (_revealUsed && read(
|
|
4221
|
-
return n(
|
|
4484
|
+
if (_revealUsed && read(s.gt)) return undefined;
|
|
4485
|
+
return n(s);
|
|
4222
4486
|
},
|
|
4223
|
-
{
|
|
4487
|
+
{ tt: true }
|
|
4224
4488
|
)
|
|
4225
4489
|
);
|
|
4226
4490
|
}
|
|
@@ -4229,8 +4493,8 @@ function createLoadingBoundary(e, t, n) {
|
|
|
4229
4493
|
}
|
|
4230
4494
|
function createErrorBoundary(e, t) {
|
|
4231
4495
|
return createCollectionBoundary(STATUS_ERROR, e, e =>
|
|
4232
|
-
t(accessor(e.
|
|
4233
|
-
for (const t of e.
|
|
4496
|
+
t(accessor(e.Te), () => {
|
|
4497
|
+
for (const t of e.Nt) recompute(t);
|
|
4234
4498
|
schedule();
|
|
4235
4499
|
})
|
|
4236
4500
|
);
|
|
@@ -4240,20 +4504,20 @@ function createRevealOrder(e, t) {
|
|
|
4240
4504
|
const n = createOwner();
|
|
4241
4505
|
const i = getContext(RevealControllerContext);
|
|
4242
4506
|
const r = t?.order || SEQUENTIAL_ACCESSOR,
|
|
4243
|
-
|
|
4244
|
-
const
|
|
4245
|
-
setContext(RevealControllerContext,
|
|
4507
|
+
s = t?.collapsed || FALSE_ACCESSOR;
|
|
4508
|
+
const o = new RevealController(r, s);
|
|
4509
|
+
setContext(RevealControllerContext, o, n);
|
|
4246
4510
|
return runWithOwner(n, () => {
|
|
4247
4511
|
const t = e();
|
|
4248
4512
|
computed(() => {
|
|
4249
4513
|
r();
|
|
4250
|
-
|
|
4251
|
-
|
|
4514
|
+
s();
|
|
4515
|
+
o.evaluate();
|
|
4252
4516
|
});
|
|
4253
4517
|
if (i) {
|
|
4254
|
-
|
|
4255
|
-
i.register(
|
|
4256
|
-
cleanup(() => i.unregister(
|
|
4518
|
+
o.Pt = i;
|
|
4519
|
+
i.register(o);
|
|
4520
|
+
cleanup(() => i.unregister(o));
|
|
4257
4521
|
}
|
|
4258
4522
|
return t;
|
|
4259
4523
|
});
|
|
@@ -4282,9 +4546,9 @@ function flatten(e, t) {
|
|
|
4282
4546
|
function flattenArray(e, t = [], n) {
|
|
4283
4547
|
let i = null;
|
|
4284
4548
|
let r = false;
|
|
4285
|
-
for (let
|
|
4549
|
+
for (let s = 0; s < e.length; s++) {
|
|
4286
4550
|
try {
|
|
4287
|
-
let i = e[
|
|
4551
|
+
let i = e[s];
|
|
4288
4552
|
if (typeof i === "function" && !i.length) {
|
|
4289
4553
|
if (n?.doNotUnwrap) {
|
|
4290
4554
|
t.push(i);
|
|
@@ -4319,6 +4583,7 @@ export {
|
|
|
4319
4583
|
NotReadyError,
|
|
4320
4584
|
SUPPORTS_PROXY,
|
|
4321
4585
|
action,
|
|
4586
|
+
affects,
|
|
4322
4587
|
clearSnapshots,
|
|
4323
4588
|
createContext,
|
|
4324
4589
|
createEffect,
|