@solidjs/signals 0.13.11 → 0.13.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +225 -50
- package/dist/node.cjs +1061 -1086
- package/dist/prod.js +709 -728
- package/dist/types/core/dev.d.ts +26 -0
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/scheduler.d.ts +1 -1
- package/dist/types/index.d.ts +4 -2
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -141,48 +141,7 @@ function adjustHeight(e, t) {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const
|
|
145
|
-
const DEV = {
|
|
146
|
-
hooks: hooks,
|
|
147
|
-
getChildren: getChildren,
|
|
148
|
-
getSignals: getSignals,
|
|
149
|
-
getParent: getParent,
|
|
150
|
-
getSources: getSources,
|
|
151
|
-
getObservers: getObservers
|
|
152
|
-
};
|
|
153
|
-
function getChildren(e) {
|
|
154
|
-
const t = [];
|
|
155
|
-
let n = e.U;
|
|
156
|
-
while (n) {
|
|
157
|
-
t.push(n);
|
|
158
|
-
n = n.k;
|
|
159
|
-
}
|
|
160
|
-
return t;
|
|
161
|
-
}
|
|
162
|
-
function getSignals(e) {
|
|
163
|
-
return e.G ? [...e.G] : [];
|
|
164
|
-
}
|
|
165
|
-
function getParent(e) {
|
|
166
|
-
return e.i;
|
|
167
|
-
}
|
|
168
|
-
function getSources(e) {
|
|
169
|
-
const t = [];
|
|
170
|
-
let n = e.C;
|
|
171
|
-
while (n) {
|
|
172
|
-
t.push(n.m);
|
|
173
|
-
n = n.D;
|
|
174
|
-
}
|
|
175
|
-
return t;
|
|
176
|
-
}
|
|
177
|
-
function getObservers(e) {
|
|
178
|
-
const t = [];
|
|
179
|
-
let n = e.h;
|
|
180
|
-
while (n) {
|
|
181
|
-
t.push(n.p);
|
|
182
|
-
n = n.I;
|
|
183
|
-
}
|
|
184
|
-
return t;
|
|
185
|
-
}
|
|
144
|
+
const DEV$1 = undefined;
|
|
186
145
|
const transitions = new Set();
|
|
187
146
|
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, R: 0 };
|
|
188
147
|
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, R: 0 };
|
|
@@ -197,10 +156,10 @@ function shouldReadStashedOptimisticValue(e) {
|
|
|
197
156
|
}
|
|
198
157
|
function runLaneEffects(e) {
|
|
199
158
|
for (const t of activeLanes) {
|
|
200
|
-
if (t.
|
|
201
|
-
const n = t.
|
|
159
|
+
if (t.U || t.k.size > 0) continue;
|
|
160
|
+
const n = t.G[e - 1];
|
|
202
161
|
if (n.length) {
|
|
203
|
-
t.
|
|
162
|
+
t.G[e - 1] = [];
|
|
204
163
|
runQueue(n, e);
|
|
205
164
|
}
|
|
206
165
|
}
|
|
@@ -208,11 +167,11 @@ function runLaneEffects(e) {
|
|
|
208
167
|
function queueStashedOptimisticEffects(e) {
|
|
209
168
|
for (let t = e.h; t !== null; t = t.I) {
|
|
210
169
|
const e = t.p;
|
|
211
|
-
if (!e.
|
|
212
|
-
if (e.
|
|
213
|
-
if (!e
|
|
214
|
-
e
|
|
215
|
-
e.
|
|
170
|
+
if (!e.W) continue;
|
|
171
|
+
if (e.W === EFFECT_TRACKED) {
|
|
172
|
+
if (!e.H) {
|
|
173
|
+
e.H = true;
|
|
174
|
+
e.F.enqueue(EFFECT_USER, e.M);
|
|
216
175
|
}
|
|
217
176
|
continue;
|
|
218
177
|
}
|
|
@@ -225,66 +184,66 @@ function setProjectionWriteActive(e) {
|
|
|
225
184
|
projectionWriteActive = e;
|
|
226
185
|
}
|
|
227
186
|
function mergeTransitionState(e, t) {
|
|
228
|
-
t
|
|
229
|
-
e.
|
|
230
|
-
for (const n of activeLanes)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
187
|
+
t.$ = e;
|
|
188
|
+
e.j.push(...t.j);
|
|
189
|
+
for (const n of activeLanes) if (n.K === t) n.K = e;
|
|
190
|
+
e.Y.push(...t.Y);
|
|
191
|
+
for (const n of t.B) e.B.add(n);
|
|
192
|
+
for (const [n, i] of t.Z) {
|
|
193
|
+
let t = e.Z.get(n);
|
|
194
|
+
if (!t) e.Z.set(n, (t = new Set()));
|
|
195
|
+
for (const e of i) t.add(e);
|
|
237
196
|
}
|
|
238
197
|
}
|
|
239
198
|
function resolveOptimisticNodes(e) {
|
|
240
199
|
for (let t = 0; t < e.length; t++) {
|
|
241
200
|
const n = e[t];
|
|
242
|
-
n.
|
|
243
|
-
if (n.
|
|
244
|
-
n.
|
|
245
|
-
n.
|
|
201
|
+
n.q = undefined;
|
|
202
|
+
if (n.X !== NOT_PENDING) {
|
|
203
|
+
n.J = n.X;
|
|
204
|
+
n.X = NOT_PENDING;
|
|
246
205
|
}
|
|
247
|
-
const i = n.
|
|
248
|
-
n.
|
|
249
|
-
if (i !== NOT_PENDING && n.
|
|
250
|
-
n.
|
|
206
|
+
const i = n.ee;
|
|
207
|
+
n.ee = NOT_PENDING;
|
|
208
|
+
if (i !== NOT_PENDING && n.J !== i) insertSubs(n, true);
|
|
209
|
+
n.K = null;
|
|
251
210
|
}
|
|
252
211
|
e.length = 0;
|
|
253
212
|
}
|
|
254
213
|
function cleanupCompletedLanes(e) {
|
|
255
214
|
for (const t of activeLanes) {
|
|
256
|
-
const n = e ? t.
|
|
215
|
+
const n = e ? t.K === e : !t.K;
|
|
257
216
|
if (!n) continue;
|
|
258
|
-
if (!t.
|
|
259
|
-
if (t.
|
|
260
|
-
if (t.
|
|
261
|
-
}
|
|
262
|
-
if (t.
|
|
263
|
-
t.
|
|
264
|
-
t.
|
|
265
|
-
t.
|
|
217
|
+
if (!t.U) {
|
|
218
|
+
if (t.G[0].length) runQueue(t.G[0], EFFECT_RENDER);
|
|
219
|
+
if (t.G[1].length) runQueue(t.G[1], EFFECT_USER);
|
|
220
|
+
}
|
|
221
|
+
if (t.te.q === t) t.te.q = undefined;
|
|
222
|
+
t.k.clear();
|
|
223
|
+
t.G[0].length = 0;
|
|
224
|
+
t.G[1].length = 0;
|
|
266
225
|
activeLanes.delete(t);
|
|
267
|
-
signalLanes.delete(t.
|
|
226
|
+
signalLanes.delete(t.te);
|
|
268
227
|
}
|
|
269
228
|
}
|
|
270
229
|
function schedule() {
|
|
271
230
|
if (scheduled) return;
|
|
272
231
|
scheduled = true;
|
|
273
|
-
if (!globalQueue.
|
|
232
|
+
if (!globalQueue.ne && !projectionWriteActive) queueMicrotask(flush);
|
|
274
233
|
}
|
|
275
234
|
class Queue {
|
|
276
235
|
i = null;
|
|
277
|
-
|
|
278
|
-
|
|
236
|
+
ie = [[], []];
|
|
237
|
+
re = [];
|
|
279
238
|
created = clock;
|
|
280
239
|
addChild(e) {
|
|
281
|
-
this.
|
|
240
|
+
this.re.push(e);
|
|
282
241
|
e.i = this;
|
|
283
242
|
}
|
|
284
243
|
removeChild(e) {
|
|
285
|
-
const t = this.
|
|
244
|
+
const t = this.re.indexOf(e);
|
|
286
245
|
if (t >= 0) {
|
|
287
|
-
this.
|
|
246
|
+
this.re.splice(t, 1);
|
|
288
247
|
e.i = null;
|
|
289
248
|
}
|
|
290
249
|
}
|
|
@@ -293,81 +252,81 @@ class Queue {
|
|
|
293
252
|
return false;
|
|
294
253
|
}
|
|
295
254
|
run(e) {
|
|
296
|
-
if (this.
|
|
297
|
-
const t = this.
|
|
298
|
-
this.
|
|
255
|
+
if (this.ie[e - 1].length) {
|
|
256
|
+
const t = this.ie[e - 1];
|
|
257
|
+
this.ie[e - 1] = [];
|
|
299
258
|
runQueue(t, e);
|
|
300
259
|
}
|
|
301
|
-
for (let t = 0; t < this.
|
|
260
|
+
for (let t = 0; t < this.re.length; t++) this.re[t].run?.(e);
|
|
302
261
|
}
|
|
303
262
|
enqueue(e, t) {
|
|
304
263
|
if (e) {
|
|
305
264
|
if (currentOptimisticLane) {
|
|
306
265
|
const n = findLane(currentOptimisticLane);
|
|
307
|
-
n.
|
|
266
|
+
n.G[e - 1].push(t);
|
|
308
267
|
} else {
|
|
309
|
-
this.
|
|
268
|
+
this.ie[e - 1].push(t);
|
|
310
269
|
}
|
|
311
270
|
}
|
|
312
271
|
schedule();
|
|
313
272
|
}
|
|
314
273
|
stashQueues(e) {
|
|
315
|
-
e.
|
|
316
|
-
e.
|
|
317
|
-
this.
|
|
318
|
-
for (let t = 0; t < this.
|
|
319
|
-
let n = this.
|
|
320
|
-
let i = e.
|
|
274
|
+
e.ie[0].push(...this.ie[0]);
|
|
275
|
+
e.ie[1].push(...this.ie[1]);
|
|
276
|
+
this.ie = [[], []];
|
|
277
|
+
for (let t = 0; t < this.re.length; t++) {
|
|
278
|
+
let n = this.re[t];
|
|
279
|
+
let i = e.re[t];
|
|
321
280
|
if (!i) {
|
|
322
|
-
i = {
|
|
323
|
-
e.
|
|
281
|
+
i = { ie: [[], []], re: [] };
|
|
282
|
+
e.re[t] = i;
|
|
324
283
|
}
|
|
325
284
|
n.stashQueues(i);
|
|
326
285
|
}
|
|
327
286
|
}
|
|
328
287
|
restoreQueues(e) {
|
|
329
|
-
this.
|
|
330
|
-
this.
|
|
331
|
-
for (let t = 0; t < e.
|
|
332
|
-
const n = e.
|
|
333
|
-
let i = this.
|
|
288
|
+
this.ie[0].push(...e.ie[0]);
|
|
289
|
+
this.ie[1].push(...e.ie[1]);
|
|
290
|
+
for (let t = 0; t < e.re.length; t++) {
|
|
291
|
+
const n = e.re[t];
|
|
292
|
+
let i = this.re[t];
|
|
334
293
|
if (i) i.restoreQueues(n);
|
|
335
294
|
}
|
|
336
295
|
}
|
|
337
296
|
}
|
|
338
297
|
class GlobalQueue extends Queue {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
static
|
|
344
|
-
static
|
|
345
|
-
static
|
|
298
|
+
ne = false;
|
|
299
|
+
se = [];
|
|
300
|
+
Y = [];
|
|
301
|
+
B = new Set();
|
|
302
|
+
static oe;
|
|
303
|
+
static ue;
|
|
304
|
+
static ce = null;
|
|
346
305
|
flush() {
|
|
347
|
-
if (this.
|
|
348
|
-
this.
|
|
306
|
+
if (this.ne) return;
|
|
307
|
+
this.ne = true;
|
|
349
308
|
try {
|
|
350
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
309
|
+
runHeap(dirtyQueue, GlobalQueue.oe);
|
|
351
310
|
if (activeTransition) {
|
|
352
311
|
const e = transitionComplete(activeTransition);
|
|
353
312
|
if (!e) {
|
|
354
313
|
const e = activeTransition;
|
|
355
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
356
|
-
this.
|
|
357
|
-
this.
|
|
358
|
-
this.
|
|
314
|
+
runHeap(zombieQueue, GlobalQueue.oe);
|
|
315
|
+
this.se = [];
|
|
316
|
+
this.Y = [];
|
|
317
|
+
this.B = new Set();
|
|
359
318
|
runLaneEffects(EFFECT_RENDER);
|
|
360
319
|
runLaneEffects(EFFECT_USER);
|
|
361
|
-
this.stashQueues(e.
|
|
320
|
+
this.stashQueues(e.ae);
|
|
362
321
|
clock++;
|
|
363
322
|
scheduled = dirtyQueue.R >= dirtyQueue.P;
|
|
364
|
-
reassignPendingTransition(e.
|
|
323
|
+
reassignPendingTransition(e.se);
|
|
365
324
|
activeTransition = null;
|
|
366
|
-
if (!e.
|
|
325
|
+
if (!e.j.length && e.Y.length) {
|
|
367
326
|
stashedOptimisticReads = new Set();
|
|
368
|
-
for (let t = 0; t < e.
|
|
369
|
-
const n = e.
|
|
370
|
-
if (n.L || n.
|
|
327
|
+
for (let t = 0; t < e.Y.length; t++) {
|
|
328
|
+
const n = e.Y[t];
|
|
329
|
+
if (n.L || n.le) continue;
|
|
371
330
|
stashedOptimisticReads.add(n);
|
|
372
331
|
queueStashedOptimisticEffects(n);
|
|
373
332
|
}
|
|
@@ -379,15 +338,15 @@ class GlobalQueue extends Queue {
|
|
|
379
338
|
}
|
|
380
339
|
return;
|
|
381
340
|
}
|
|
382
|
-
this.
|
|
383
|
-
this.restoreQueues(activeTransition.
|
|
341
|
+
this.se !== activeTransition.se && this.se.push(...activeTransition.se);
|
|
342
|
+
this.restoreQueues(activeTransition.ae);
|
|
384
343
|
transitions.delete(activeTransition);
|
|
385
344
|
const t = activeTransition;
|
|
386
345
|
activeTransition = null;
|
|
387
|
-
reassignPendingTransition(this.
|
|
346
|
+
reassignPendingTransition(this.se);
|
|
388
347
|
finalizePureQueue(t);
|
|
389
348
|
} else {
|
|
390
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
349
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.oe);
|
|
391
350
|
finalizePureQueue();
|
|
392
351
|
}
|
|
393
352
|
clock++;
|
|
@@ -398,19 +357,20 @@ class GlobalQueue extends Queue {
|
|
|
398
357
|
this.run(EFFECT_USER);
|
|
399
358
|
if (false);
|
|
400
359
|
} finally {
|
|
401
|
-
this.
|
|
360
|
+
this.ne = false;
|
|
402
361
|
}
|
|
403
362
|
}
|
|
404
363
|
notify(e, t, n, i) {
|
|
405
364
|
if (t & STATUS_PENDING) {
|
|
406
365
|
if (n & STATUS_PENDING) {
|
|
407
|
-
const t = i !== undefined ? i : e.
|
|
366
|
+
const t = i !== undefined ? i : e.fe;
|
|
408
367
|
if (activeTransition && t) {
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
368
|
+
const n = t.source;
|
|
369
|
+
let i = activeTransition.Z.get(n);
|
|
370
|
+
if (!i) activeTransition.Z.set(n, (i = new Set()));
|
|
371
|
+
const r = i.size;
|
|
372
|
+
i.add(e);
|
|
373
|
+
if (i.size !== r) schedule();
|
|
414
374
|
}
|
|
415
375
|
}
|
|
416
376
|
return true;
|
|
@@ -420,17 +380,17 @@ class GlobalQueue extends Queue {
|
|
|
420
380
|
initTransition(e) {
|
|
421
381
|
if (e) e = currentTransition(e);
|
|
422
382
|
if (e && e === activeTransition) return;
|
|
423
|
-
if (!e && activeTransition && activeTransition.
|
|
383
|
+
if (!e && activeTransition && activeTransition.Ee === clock) return;
|
|
424
384
|
if (!activeTransition) {
|
|
425
385
|
activeTransition = e ?? {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
386
|
+
Ee: clock,
|
|
387
|
+
se: [],
|
|
388
|
+
Z: new Map(),
|
|
389
|
+
Y: [],
|
|
390
|
+
B: new Set(),
|
|
391
|
+
j: [],
|
|
392
|
+
ae: { ie: [[], []], re: [] },
|
|
393
|
+
$: false
|
|
434
394
|
};
|
|
435
395
|
} else if (e) {
|
|
436
396
|
const t = activeTransition;
|
|
@@ -439,37 +399,37 @@ class GlobalQueue extends Queue {
|
|
|
439
399
|
activeTransition = e;
|
|
440
400
|
}
|
|
441
401
|
transitions.add(activeTransition);
|
|
442
|
-
activeTransition.
|
|
443
|
-
if (this.
|
|
444
|
-
for (let e = 0; e < this.
|
|
445
|
-
const t = this.
|
|
446
|
-
t.
|
|
447
|
-
activeTransition.
|
|
402
|
+
activeTransition.Ee = clock;
|
|
403
|
+
if (this.se !== activeTransition.se) {
|
|
404
|
+
for (let e = 0; e < this.se.length; e++) {
|
|
405
|
+
const t = this.se[e];
|
|
406
|
+
t.K = activeTransition;
|
|
407
|
+
activeTransition.se.push(t);
|
|
448
408
|
}
|
|
449
|
-
this.
|
|
409
|
+
this.se = activeTransition.se;
|
|
450
410
|
}
|
|
451
|
-
if (this.
|
|
452
|
-
for (let e = 0; e < this.
|
|
453
|
-
const t = this.
|
|
454
|
-
t.
|
|
455
|
-
activeTransition.
|
|
411
|
+
if (this.Y !== activeTransition.Y) {
|
|
412
|
+
for (let e = 0; e < this.Y.length; e++) {
|
|
413
|
+
const t = this.Y[e];
|
|
414
|
+
t.K = activeTransition;
|
|
415
|
+
activeTransition.Y.push(t);
|
|
456
416
|
}
|
|
457
|
-
this.
|
|
417
|
+
this.Y = activeTransition.Y;
|
|
458
418
|
}
|
|
459
419
|
for (const e of activeLanes) {
|
|
460
|
-
if (!e.
|
|
420
|
+
if (!e.K) e.K = activeTransition;
|
|
461
421
|
}
|
|
462
|
-
if (this.
|
|
463
|
-
for (const e of this.
|
|
464
|
-
this.
|
|
422
|
+
if (this.B !== activeTransition.B) {
|
|
423
|
+
for (const e of this.B) activeTransition.B.add(e);
|
|
424
|
+
this.B = activeTransition.B;
|
|
465
425
|
}
|
|
466
426
|
}
|
|
467
427
|
}
|
|
468
428
|
function insertSubs(e, t = false) {
|
|
469
|
-
const n = e.
|
|
470
|
-
const i = e.
|
|
429
|
+
const n = e.q || currentOptimisticLane;
|
|
430
|
+
const i = e.de !== undefined;
|
|
471
431
|
for (let r = e.h; r !== null; r = r.I) {
|
|
472
|
-
if (i && r.p.
|
|
432
|
+
if (i && r.p.Te) {
|
|
473
433
|
r.p.O |= REACTIVE_SNAPSHOT_STALE;
|
|
474
434
|
continue;
|
|
475
435
|
}
|
|
@@ -478,13 +438,13 @@ function insertSubs(e, t = false) {
|
|
|
478
438
|
assignOrMergeLane(r.p, n);
|
|
479
439
|
} else if (t) {
|
|
480
440
|
r.p.O |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
481
|
-
r.p.
|
|
441
|
+
r.p.q = undefined;
|
|
482
442
|
}
|
|
483
443
|
const e = r.p;
|
|
484
|
-
if (e.
|
|
485
|
-
if (!e
|
|
486
|
-
e
|
|
487
|
-
e.
|
|
444
|
+
if (e.W === EFFECT_TRACKED) {
|
|
445
|
+
if (!e.H) {
|
|
446
|
+
e.H = true;
|
|
447
|
+
e.F.enqueue(EFFECT_USER, e.M);
|
|
488
448
|
}
|
|
489
449
|
continue;
|
|
490
450
|
}
|
|
@@ -494,16 +454,16 @@ function insertSubs(e, t = false) {
|
|
|
494
454
|
}
|
|
495
455
|
}
|
|
496
456
|
function commitPendingNodes() {
|
|
497
|
-
const e = globalQueue.
|
|
457
|
+
const e = globalQueue.se;
|
|
498
458
|
for (let t = 0; t < e.length; t++) {
|
|
499
459
|
const n = e[t];
|
|
500
|
-
if (n.
|
|
501
|
-
n.
|
|
502
|
-
n.
|
|
503
|
-
if (n.
|
|
460
|
+
if (n.X !== NOT_PENDING) {
|
|
461
|
+
n.J = n.X;
|
|
462
|
+
n.X = NOT_PENDING;
|
|
463
|
+
if (n.W && n.W !== EFFECT_TRACKED) n.H = true;
|
|
504
464
|
}
|
|
505
|
-
if (!(n.
|
|
506
|
-
if (n.L) GlobalQueue.
|
|
465
|
+
if (!(n.Se & STATUS_PENDING)) n.Se &= ~STATUS_UNINITIALIZED;
|
|
466
|
+
if (n.L) GlobalQueue.ue(n, false, true);
|
|
507
467
|
}
|
|
508
468
|
e.length = 0;
|
|
509
469
|
}
|
|
@@ -511,14 +471,14 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
511
471
|
const n = !t;
|
|
512
472
|
if (n) commitPendingNodes();
|
|
513
473
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
514
|
-
if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.
|
|
474
|
+
if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.oe);
|
|
515
475
|
if (n) {
|
|
516
476
|
commitPendingNodes();
|
|
517
|
-
resolveOptimisticNodes(e ? e.
|
|
518
|
-
const t = e ? e.
|
|
519
|
-
if (GlobalQueue.
|
|
477
|
+
resolveOptimisticNodes(e ? e.Y : globalQueue.Y);
|
|
478
|
+
const t = e ? e.B : globalQueue.B;
|
|
479
|
+
if (GlobalQueue.ce && t.size) {
|
|
520
480
|
for (const e of t) {
|
|
521
|
-
GlobalQueue.
|
|
481
|
+
GlobalQueue.ce(e);
|
|
522
482
|
}
|
|
523
483
|
t.clear();
|
|
524
484
|
schedule();
|
|
@@ -527,23 +487,23 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
527
487
|
}
|
|
528
488
|
}
|
|
529
489
|
function checkBoundaryChildren(e) {
|
|
530
|
-
for (const t of e.
|
|
490
|
+
for (const t of e.re) {
|
|
531
491
|
t.checkSources?.();
|
|
532
492
|
checkBoundaryChildren(t);
|
|
533
493
|
}
|
|
534
494
|
}
|
|
535
495
|
function trackOptimisticStore(e) {
|
|
536
|
-
globalQueue.
|
|
496
|
+
globalQueue.B.add(e);
|
|
537
497
|
schedule();
|
|
538
498
|
}
|
|
539
499
|
function reassignPendingTransition(e) {
|
|
540
500
|
for (let t = 0; t < e.length; t++) {
|
|
541
|
-
e[t].
|
|
501
|
+
e[t].K = activeTransition;
|
|
542
502
|
}
|
|
543
503
|
}
|
|
544
504
|
const globalQueue = new GlobalQueue();
|
|
545
505
|
function flush() {
|
|
546
|
-
if (globalQueue.
|
|
506
|
+
if (globalQueue.ne) {
|
|
547
507
|
return;
|
|
548
508
|
}
|
|
549
509
|
while (scheduled || activeTransition) {
|
|
@@ -553,37 +513,57 @@ function flush() {
|
|
|
553
513
|
function runQueue(e, t) {
|
|
554
514
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
555
515
|
}
|
|
516
|
+
function reporterBlocksSource(e, t) {
|
|
517
|
+
if (e.O & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
|
|
518
|
+
if (e.Re === t || e.Oe?.has(t)) return true;
|
|
519
|
+
for (let n = e.C; n; n = n.D) {
|
|
520
|
+
let e = n.m;
|
|
521
|
+
while (e) {
|
|
522
|
+
if (e === t || e.V === t) return true;
|
|
523
|
+
e = e._e;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return !!(e.Se & STATUS_PENDING && e.fe instanceof NotReadyError && e.fe.source === t);
|
|
527
|
+
}
|
|
556
528
|
function transitionComplete(e) {
|
|
557
|
-
if (e
|
|
558
|
-
if (e.
|
|
529
|
+
if (e.$) return true;
|
|
530
|
+
if (e.j.length) return false;
|
|
559
531
|
let t = true;
|
|
560
|
-
for (
|
|
561
|
-
|
|
562
|
-
|
|
532
|
+
for (const [n, i] of e.Z) {
|
|
533
|
+
let r = false;
|
|
534
|
+
for (const e of i) {
|
|
535
|
+
if (reporterBlocksSource(e, n)) {
|
|
536
|
+
r = true;
|
|
537
|
+
break;
|
|
538
|
+
}
|
|
539
|
+
i.delete(e);
|
|
540
|
+
}
|
|
541
|
+
if (!r) e.Z.delete(n);
|
|
542
|
+
else if (n.Se & STATUS_PENDING && n.fe?.source === n) {
|
|
563
543
|
t = false;
|
|
564
544
|
break;
|
|
565
545
|
}
|
|
566
546
|
}
|
|
567
547
|
if (t) {
|
|
568
|
-
for (let n = 0; n < e.
|
|
569
|
-
const i = e.
|
|
548
|
+
for (let n = 0; n < e.Y.length; n++) {
|
|
549
|
+
const i = e.Y[n];
|
|
570
550
|
if (
|
|
571
551
|
hasActiveOverride(i) &&
|
|
572
|
-
"
|
|
573
|
-
i.
|
|
574
|
-
i.
|
|
575
|
-
i.
|
|
552
|
+
"Se" in i &&
|
|
553
|
+
i.Se & STATUS_PENDING &&
|
|
554
|
+
i.fe instanceof NotReadyError &&
|
|
555
|
+
i.fe.source !== i
|
|
576
556
|
) {
|
|
577
557
|
t = false;
|
|
578
558
|
break;
|
|
579
559
|
}
|
|
580
560
|
}
|
|
581
561
|
}
|
|
582
|
-
t && (e
|
|
562
|
+
t && (e.$ = true);
|
|
583
563
|
return t;
|
|
584
564
|
}
|
|
585
565
|
function currentTransition(e) {
|
|
586
|
-
while (e
|
|
566
|
+
while (e.$ && typeof e.$ === "object") e = e.$;
|
|
587
567
|
return e;
|
|
588
568
|
}
|
|
589
569
|
function setActiveTransition(e) {
|
|
@@ -605,76 +585,76 @@ function getOrCreateLane(e) {
|
|
|
605
585
|
if (t) {
|
|
606
586
|
return findLane(t);
|
|
607
587
|
}
|
|
608
|
-
const n = e.
|
|
609
|
-
const i = n?.
|
|
610
|
-
t = {
|
|
588
|
+
const n = e._e;
|
|
589
|
+
const i = n?.q ? findLane(n.q) : null;
|
|
590
|
+
t = { te: e, k: new Set(), G: [[], []], U: null, K: activeTransition, he: i };
|
|
611
591
|
signalLanes.set(e, t);
|
|
612
592
|
activeLanes.add(t);
|
|
613
|
-
e.
|
|
593
|
+
e.Ie = false;
|
|
614
594
|
return t;
|
|
615
595
|
}
|
|
616
596
|
function findLane(e) {
|
|
617
|
-
while (e.
|
|
597
|
+
while (e.U) e = e.U;
|
|
618
598
|
return e;
|
|
619
599
|
}
|
|
620
600
|
function mergeLanes(e, t) {
|
|
621
601
|
e = findLane(e);
|
|
622
602
|
t = findLane(t);
|
|
623
603
|
if (e === t) return e;
|
|
624
|
-
t.
|
|
625
|
-
for (const n of t.
|
|
626
|
-
e.
|
|
627
|
-
e.
|
|
604
|
+
t.U = e;
|
|
605
|
+
for (const n of t.k) e.k.add(n);
|
|
606
|
+
e.G[0].push(...t.G[0]);
|
|
607
|
+
e.G[1].push(...t.G[1]);
|
|
628
608
|
return e;
|
|
629
609
|
}
|
|
630
610
|
function resolveLane(e) {
|
|
631
|
-
const t = e.
|
|
611
|
+
const t = e.q;
|
|
632
612
|
if (!t) return undefined;
|
|
633
613
|
const n = findLane(t);
|
|
634
614
|
if (activeLanes.has(n)) return n;
|
|
635
|
-
e.
|
|
615
|
+
e.q = undefined;
|
|
636
616
|
return undefined;
|
|
637
617
|
}
|
|
638
618
|
function resolveTransition(e) {
|
|
639
|
-
return resolveLane(e)?.
|
|
619
|
+
return resolveLane(e)?.K ?? e.K;
|
|
640
620
|
}
|
|
641
621
|
function hasActiveOverride(e) {
|
|
642
|
-
return !!(e.
|
|
622
|
+
return !!(e.ee !== undefined && e.ee !== NOT_PENDING);
|
|
643
623
|
}
|
|
644
624
|
function assignOrMergeLane(e, t) {
|
|
645
625
|
const n = findLane(t);
|
|
646
|
-
const i = e.
|
|
626
|
+
const i = e.q;
|
|
647
627
|
if (i) {
|
|
648
|
-
if (i.
|
|
649
|
-
e.
|
|
628
|
+
if (i.U) {
|
|
629
|
+
e.q = t;
|
|
650
630
|
return;
|
|
651
631
|
}
|
|
652
632
|
const r = findLane(i);
|
|
653
633
|
if (activeLanes.has(r)) {
|
|
654
634
|
if (r !== n && !hasActiveOverride(e)) {
|
|
655
|
-
if (n.
|
|
656
|
-
e.
|
|
657
|
-
} else if (r.
|
|
635
|
+
if (n.he && findLane(n.he) === r) {
|
|
636
|
+
e.q = t;
|
|
637
|
+
} else if (r.he && findLane(r.he) === n);
|
|
658
638
|
else mergeLanes(n, r);
|
|
659
639
|
}
|
|
660
640
|
return;
|
|
661
641
|
}
|
|
662
642
|
}
|
|
663
|
-
e.
|
|
643
|
+
e.q = t;
|
|
664
644
|
}
|
|
665
645
|
function unlinkSubs(e) {
|
|
666
646
|
const t = e.m;
|
|
667
647
|
const n = e.D;
|
|
668
648
|
const i = e.I;
|
|
669
|
-
const r = e.
|
|
670
|
-
if (i !== null) i.
|
|
671
|
-
else t.
|
|
649
|
+
const r = e.pe;
|
|
650
|
+
if (i !== null) i.pe = r;
|
|
651
|
+
else t.Ae = r;
|
|
672
652
|
if (r !== null) r.I = i;
|
|
673
653
|
else {
|
|
674
654
|
t.h = i;
|
|
675
655
|
if (i === null) {
|
|
676
656
|
t.Ne?.();
|
|
677
|
-
t.L && !t.
|
|
657
|
+
t.L && !t.ge && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
678
658
|
}
|
|
679
659
|
}
|
|
680
660
|
return n;
|
|
@@ -689,27 +669,27 @@ function unobserved(e) {
|
|
|
689
669
|
disposeChildren(e, true);
|
|
690
670
|
}
|
|
691
671
|
function link(e, t) {
|
|
692
|
-
const n = t.
|
|
672
|
+
const n = t.Pe;
|
|
693
673
|
if (n !== null && n.m === e) return;
|
|
694
674
|
let i = null;
|
|
695
675
|
const r = t.O & REACTIVE_RECOMPUTING_DEPS;
|
|
696
676
|
if (r) {
|
|
697
677
|
i = n !== null ? n.D : t.C;
|
|
698
678
|
if (i !== null && i.m === e) {
|
|
699
|
-
t.
|
|
679
|
+
t.Pe = i;
|
|
700
680
|
return;
|
|
701
681
|
}
|
|
702
682
|
}
|
|
703
|
-
const s = e.
|
|
683
|
+
const s = e.Ae;
|
|
704
684
|
if (s !== null && s.p === t && (!r || isValidLink(s, t))) return;
|
|
705
|
-
const o = (t.
|
|
685
|
+
const o = (t.Pe = e.Ae = { m: e, p: t, D: i, pe: s, I: null });
|
|
706
686
|
if (n !== null) n.D = o;
|
|
707
687
|
else t.C = o;
|
|
708
688
|
if (s !== null) s.I = o;
|
|
709
689
|
else e.h = o;
|
|
710
690
|
}
|
|
711
691
|
function isValidLink(e, t) {
|
|
712
|
-
const n = t.
|
|
692
|
+
const n = t.Pe;
|
|
713
693
|
if (n !== null) {
|
|
714
694
|
let i = t.C;
|
|
715
695
|
do {
|
|
@@ -722,7 +702,7 @@ function isValidLink(e, t) {
|
|
|
722
702
|
}
|
|
723
703
|
const PENDING_OWNER = {};
|
|
724
704
|
function markDisposal(e) {
|
|
725
|
-
let t = e.
|
|
705
|
+
let t = e.Ce;
|
|
726
706
|
while (t) {
|
|
727
707
|
t.O |= REACTIVE_ZOMBIE;
|
|
728
708
|
if (t.O & REACTIVE_IN_HEAP) {
|
|
@@ -730,7 +710,7 @@ function markDisposal(e) {
|
|
|
730
710
|
insertIntoHeap(t, zombieQueue);
|
|
731
711
|
}
|
|
732
712
|
markDisposal(t);
|
|
733
|
-
t = t.
|
|
713
|
+
t = t.De;
|
|
734
714
|
}
|
|
735
715
|
}
|
|
736
716
|
function dispose(e) {
|
|
@@ -739,16 +719,16 @@ function dispose(e) {
|
|
|
739
719
|
t = unlinkSubs(t);
|
|
740
720
|
} while (t !== null);
|
|
741
721
|
e.C = null;
|
|
742
|
-
e.
|
|
722
|
+
e.Pe = null;
|
|
743
723
|
disposeChildren(e, true);
|
|
744
724
|
}
|
|
745
725
|
function disposeChildren(e, t = false, n) {
|
|
746
726
|
if (e.O & REACTIVE_DISPOSED) return;
|
|
747
727
|
if (t) e.O = REACTIVE_DISPOSED;
|
|
748
|
-
if (t && e.L) e.
|
|
749
|
-
let i = n ? e.
|
|
728
|
+
if (t && e.L) e.ye = null;
|
|
729
|
+
let i = n ? e.ve : e.Ce;
|
|
750
730
|
while (i) {
|
|
751
|
-
const e = i.
|
|
731
|
+
const e = i.De;
|
|
752
732
|
if (i.C) {
|
|
753
733
|
const e = i;
|
|
754
734
|
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
@@ -757,21 +737,21 @@ function disposeChildren(e, t = false, n) {
|
|
|
757
737
|
t = unlinkSubs(t);
|
|
758
738
|
} while (t !== null);
|
|
759
739
|
e.C = null;
|
|
760
|
-
e.
|
|
740
|
+
e.Pe = null;
|
|
761
741
|
}
|
|
762
742
|
disposeChildren(i, true);
|
|
763
743
|
i = e;
|
|
764
744
|
}
|
|
765
745
|
if (n) {
|
|
766
|
-
e.
|
|
746
|
+
e.ve = null;
|
|
767
747
|
} else {
|
|
768
|
-
e.
|
|
769
|
-
e.
|
|
748
|
+
e.Ce = null;
|
|
749
|
+
e.me = 0;
|
|
770
750
|
}
|
|
771
751
|
runDisposal(e, n);
|
|
772
752
|
}
|
|
773
753
|
function runDisposal(e, t) {
|
|
774
|
-
let n = t ? e.
|
|
754
|
+
let n = t ? e.we : e.Ve;
|
|
775
755
|
if (!n) return;
|
|
776
756
|
if (Array.isArray(n)) {
|
|
777
757
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -781,12 +761,12 @@ function runDisposal(e, t) {
|
|
|
781
761
|
} else {
|
|
782
762
|
n.call(n);
|
|
783
763
|
}
|
|
784
|
-
t ? (e.
|
|
764
|
+
t ? (e.we = null) : (e.Ve = null);
|
|
785
765
|
}
|
|
786
766
|
function childId(e, t) {
|
|
787
767
|
let n = e;
|
|
788
|
-
while (n.
|
|
789
|
-
if (n.id != null) return formatId(n.id, t ? n.
|
|
768
|
+
while (n.be && n.i) n = n.i;
|
|
769
|
+
if (n.id != null) return formatId(n.id, t ? n.me++ : n.me);
|
|
790
770
|
throw new Error("Cannot get child id from owner without an id");
|
|
791
771
|
}
|
|
792
772
|
function getNextChildId(e) {
|
|
@@ -809,9 +789,9 @@ function getOwner() {
|
|
|
809
789
|
}
|
|
810
790
|
function cleanup(e) {
|
|
811
791
|
if (!context) return e;
|
|
812
|
-
if (!context.
|
|
813
|
-
else if (Array.isArray(context.
|
|
814
|
-
else context.
|
|
792
|
+
if (!context.Ve) context.Ve = e;
|
|
793
|
+
else if (Array.isArray(context.Ve)) context.Ve.push(e);
|
|
794
|
+
else context.Ve = [context.Ve, e];
|
|
815
795
|
return e;
|
|
816
796
|
}
|
|
817
797
|
function isDisposed(e) {
|
|
@@ -822,29 +802,29 @@ function createOwner(e) {
|
|
|
822
802
|
const n = e?.transparent ?? false;
|
|
823
803
|
const i = {
|
|
824
804
|
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
825
|
-
|
|
805
|
+
be: n || undefined,
|
|
826
806
|
t: true,
|
|
827
807
|
u: t?.t ? t.u : t,
|
|
828
|
-
|
|
829
|
-
|
|
808
|
+
Ce: null,
|
|
809
|
+
De: null,
|
|
810
|
+
Ve: null,
|
|
811
|
+
F: t?.F ?? globalQueue,
|
|
812
|
+
Le: t?.Le || defaultContext,
|
|
813
|
+
me: 0,
|
|
830
814
|
we: null,
|
|
831
|
-
|
|
832
|
-
be: t?.be || defaultContext,
|
|
833
|
-
ve: 0,
|
|
834
|
-
me: null,
|
|
835
|
-
ye: null,
|
|
815
|
+
ve: null,
|
|
836
816
|
i: t,
|
|
837
817
|
dispose(e = true) {
|
|
838
818
|
disposeChildren(i, e);
|
|
839
819
|
}
|
|
840
820
|
};
|
|
841
821
|
if (t) {
|
|
842
|
-
const e = t.
|
|
822
|
+
const e = t.Ce;
|
|
843
823
|
if (e === null) {
|
|
844
|
-
t.
|
|
824
|
+
t.Ce = i;
|
|
845
825
|
} else {
|
|
846
|
-
i.
|
|
847
|
-
t.
|
|
826
|
+
i.De = e;
|
|
827
|
+
t.Ce = i;
|
|
848
828
|
}
|
|
849
829
|
}
|
|
850
830
|
return i;
|
|
@@ -854,51 +834,51 @@ function createRoot(e, t) {
|
|
|
854
834
|
return runWithOwner(n, () => e(n.dispose));
|
|
855
835
|
}
|
|
856
836
|
function addPendingSource(e, t) {
|
|
857
|
-
if (e.
|
|
858
|
-
if (!e.
|
|
859
|
-
e.
|
|
837
|
+
if (e.Re === t || e.Oe?.has(t)) return false;
|
|
838
|
+
if (!e.Re) {
|
|
839
|
+
e.Re = t;
|
|
860
840
|
return true;
|
|
861
841
|
}
|
|
862
|
-
if (!e.
|
|
863
|
-
e.
|
|
842
|
+
if (!e.Oe) {
|
|
843
|
+
e.Oe = new Set([e.Re, t]);
|
|
864
844
|
} else {
|
|
865
|
-
e.
|
|
845
|
+
e.Oe.add(t);
|
|
866
846
|
}
|
|
867
|
-
e.
|
|
847
|
+
e.Re = undefined;
|
|
868
848
|
return true;
|
|
869
849
|
}
|
|
870
850
|
function removePendingSource(e, t) {
|
|
871
|
-
if (e.
|
|
872
|
-
if (e.
|
|
873
|
-
e.
|
|
851
|
+
if (e.Re) {
|
|
852
|
+
if (e.Re !== t) return false;
|
|
853
|
+
e.Re = undefined;
|
|
874
854
|
return true;
|
|
875
855
|
}
|
|
876
|
-
if (!e.
|
|
877
|
-
if (e.
|
|
878
|
-
e.
|
|
879
|
-
e.
|
|
880
|
-
} else if (e.
|
|
881
|
-
e.
|
|
856
|
+
if (!e.Oe?.delete(t)) return false;
|
|
857
|
+
if (e.Oe.size === 1) {
|
|
858
|
+
e.Re = e.Oe.values().next().value;
|
|
859
|
+
e.Oe = undefined;
|
|
860
|
+
} else if (e.Oe.size === 0) {
|
|
861
|
+
e.Oe = undefined;
|
|
882
862
|
}
|
|
883
863
|
return true;
|
|
884
864
|
}
|
|
885
865
|
function clearPendingSources(e) {
|
|
886
|
-
e.
|
|
887
|
-
e.
|
|
888
|
-
e.
|
|
866
|
+
e.Re = undefined;
|
|
867
|
+
e.Oe?.clear();
|
|
868
|
+
e.Oe = undefined;
|
|
889
869
|
}
|
|
890
870
|
function setPendingError(e, t, n) {
|
|
891
871
|
if (!t) {
|
|
892
|
-
e.
|
|
872
|
+
e.fe = null;
|
|
893
873
|
return;
|
|
894
874
|
}
|
|
895
875
|
if (n instanceof NotReadyError && n.source === t) {
|
|
896
|
-
e.
|
|
876
|
+
e.fe = n;
|
|
897
877
|
return;
|
|
898
878
|
}
|
|
899
|
-
const i = e.
|
|
879
|
+
const i = e.fe;
|
|
900
880
|
if (!(i instanceof NotReadyError) || i.source !== t) {
|
|
901
|
-
e.
|
|
881
|
+
e.fe = new NotReadyError(t);
|
|
902
882
|
}
|
|
903
883
|
}
|
|
904
884
|
function forEachDependent(e, t) {
|
|
@@ -913,21 +893,21 @@ function settlePendingSource(e) {
|
|
|
913
893
|
const settle = i => {
|
|
914
894
|
if (n.has(i) || !removePendingSource(i, e)) return;
|
|
915
895
|
n.add(i);
|
|
916
|
-
i.
|
|
917
|
-
const r = i.
|
|
896
|
+
i.Ee = clock;
|
|
897
|
+
const r = i.Re ?? i.Oe?.values().next().value;
|
|
918
898
|
if (r) {
|
|
919
899
|
setPendingError(i, r);
|
|
920
900
|
updatePendingSignal(i);
|
|
921
901
|
} else {
|
|
922
|
-
i.
|
|
902
|
+
i.Se &= ~STATUS_PENDING;
|
|
923
903
|
setPendingError(i);
|
|
924
904
|
updatePendingSignal(i);
|
|
925
|
-
if (i.
|
|
926
|
-
if (i.
|
|
905
|
+
if (i.Ue) {
|
|
906
|
+
if (i.W === EFFECT_TRACKED) {
|
|
927
907
|
const e = i;
|
|
928
|
-
if (!e
|
|
929
|
-
e
|
|
930
|
-
e.
|
|
908
|
+
if (!e.H) {
|
|
909
|
+
e.H = true;
|
|
910
|
+
e.F.enqueue(EFFECT_USER, e.M);
|
|
931
911
|
}
|
|
932
912
|
} else {
|
|
933
913
|
const e = i.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
@@ -936,7 +916,7 @@ function settlePendingSource(e) {
|
|
|
936
916
|
}
|
|
937
917
|
t = true;
|
|
938
918
|
}
|
|
939
|
-
i.
|
|
919
|
+
i.Ue = false;
|
|
940
920
|
}
|
|
941
921
|
forEachDependent(i, settle);
|
|
942
922
|
};
|
|
@@ -948,40 +928,40 @@ function handleAsync(e, t, n) {
|
|
|
948
928
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
949
929
|
const s = !r && i && untrack(() => typeof t.then === "function");
|
|
950
930
|
if (!s && !r) {
|
|
951
|
-
e.
|
|
931
|
+
e.ye = null;
|
|
952
932
|
return t;
|
|
953
933
|
}
|
|
954
|
-
e.
|
|
934
|
+
e.ye = t;
|
|
955
935
|
let o;
|
|
956
936
|
const handleError = n => {
|
|
957
|
-
if (e.
|
|
937
|
+
if (e.ye !== t) return;
|
|
958
938
|
globalQueue.initTransition(resolveTransition(e));
|
|
959
939
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
960
|
-
e.
|
|
940
|
+
e.Ee = clock;
|
|
961
941
|
};
|
|
962
942
|
const asyncWrite = (i, r) => {
|
|
963
|
-
if (e.
|
|
943
|
+
if (e.ye !== t) return;
|
|
964
944
|
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
965
945
|
globalQueue.initTransition(resolveTransition(e));
|
|
966
946
|
clearStatus(e);
|
|
967
947
|
const s = resolveLane(e);
|
|
968
|
-
if (s) s.
|
|
948
|
+
if (s) s.k.delete(e);
|
|
969
949
|
if (n) n(i);
|
|
970
|
-
else if (e.
|
|
971
|
-
if (e.
|
|
950
|
+
else if (e.ee !== undefined) {
|
|
951
|
+
if (e.ee !== undefined && e.ee !== NOT_PENDING) e.X = i;
|
|
972
952
|
else {
|
|
973
|
-
e.
|
|
953
|
+
e.J = i;
|
|
974
954
|
insertSubs(e);
|
|
975
955
|
}
|
|
976
|
-
e.
|
|
956
|
+
e.Ee = clock;
|
|
977
957
|
} else if (s) {
|
|
978
|
-
const t = e.
|
|
979
|
-
const n = e.
|
|
958
|
+
const t = e.J;
|
|
959
|
+
const n = e.ke;
|
|
980
960
|
if (!n || !n(i, t)) {
|
|
981
|
-
e.
|
|
982
|
-
e.
|
|
983
|
-
if (e.
|
|
984
|
-
setSignal(e.
|
|
961
|
+
e.J = i;
|
|
962
|
+
e.Ee = clock;
|
|
963
|
+
if (e.xe) {
|
|
964
|
+
setSignal(e.xe, i);
|
|
985
965
|
}
|
|
986
966
|
insertSubs(e, true);
|
|
987
967
|
}
|
|
@@ -1037,7 +1017,7 @@ function handleAsync(e, t, n) {
|
|
|
1037
1017
|
s = n;
|
|
1038
1018
|
u = true;
|
|
1039
1019
|
if (n.done) r = true;
|
|
1040
|
-
} else if (e.
|
|
1020
|
+
} else if (e.ye !== t) {
|
|
1041
1021
|
return;
|
|
1042
1022
|
} else if (!n.done) asyncWrite(n.value, iterate);
|
|
1043
1023
|
else {
|
|
@@ -1047,7 +1027,7 @@ function handleAsync(e, t, n) {
|
|
|
1047
1027
|
}
|
|
1048
1028
|
},
|
|
1049
1029
|
n => {
|
|
1050
|
-
if (!c && e.
|
|
1030
|
+
if (!c && e.ye === t) {
|
|
1051
1031
|
r = true;
|
|
1052
1032
|
handleError(n);
|
|
1053
1033
|
}
|
|
@@ -1071,28 +1051,28 @@ function handleAsync(e, t, n) {
|
|
|
1071
1051
|
}
|
|
1072
1052
|
function clearStatus(e, t = false) {
|
|
1073
1053
|
clearPendingSources(e);
|
|
1074
|
-
e.
|
|
1075
|
-
e.
|
|
1054
|
+
e.Ue = false;
|
|
1055
|
+
e.Se = t ? 0 : e.Se & STATUS_UNINITIALIZED;
|
|
1076
1056
|
setPendingError(e);
|
|
1077
1057
|
updatePendingSignal(e);
|
|
1078
|
-
e.
|
|
1058
|
+
e.Ge?.();
|
|
1079
1059
|
}
|
|
1080
1060
|
function notifyStatus(e, t, n, i, r) {
|
|
1081
1061
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
1082
1062
|
n = new StatusError(e, n);
|
|
1083
1063
|
const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
1084
1064
|
const o = s === e;
|
|
1085
|
-
const u = t === STATUS_PENDING && e.
|
|
1065
|
+
const u = t === STATUS_PENDING && e.ee !== undefined && !o;
|
|
1086
1066
|
const c = u && hasActiveOverride(e);
|
|
1087
1067
|
if (!i) {
|
|
1088
1068
|
if (t === STATUS_PENDING && s) {
|
|
1089
1069
|
addPendingSource(e, s);
|
|
1090
|
-
e.
|
|
1070
|
+
e.Se = STATUS_PENDING | (e.Se & STATUS_UNINITIALIZED);
|
|
1091
1071
|
setPendingError(e, s, n);
|
|
1092
1072
|
} else {
|
|
1093
1073
|
clearPendingSources(e);
|
|
1094
|
-
e.
|
|
1095
|
-
e.
|
|
1074
|
+
e.Se = t | (t !== STATUS_ERROR ? e.Se & STATUS_UNINITIALIZED : 0);
|
|
1075
|
+
e.fe = n;
|
|
1096
1076
|
}
|
|
1097
1077
|
updatePendingSignal(e);
|
|
1098
1078
|
}
|
|
@@ -1101,24 +1081,24 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
1101
1081
|
}
|
|
1102
1082
|
const a = i || c;
|
|
1103
1083
|
const l = i || u ? undefined : r;
|
|
1104
|
-
if (e.
|
|
1084
|
+
if (e.Ge) {
|
|
1105
1085
|
if (i && t === STATUS_PENDING) {
|
|
1106
1086
|
return;
|
|
1107
1087
|
}
|
|
1108
1088
|
if (a) {
|
|
1109
|
-
e.
|
|
1089
|
+
e.Ge(t, n);
|
|
1110
1090
|
} else {
|
|
1111
|
-
e.
|
|
1091
|
+
e.Ge();
|
|
1112
1092
|
}
|
|
1113
1093
|
return;
|
|
1114
1094
|
}
|
|
1115
1095
|
forEachDependent(e, e => {
|
|
1116
|
-
e.
|
|
1096
|
+
e.Ee = clock;
|
|
1117
1097
|
if (
|
|
1118
|
-
(t === STATUS_PENDING && s && e.
|
|
1119
|
-
(t !== STATUS_PENDING && (e.
|
|
1098
|
+
(t === STATUS_PENDING && s && e.Re !== s && !e.Oe?.has(s)) ||
|
|
1099
|
+
(t !== STATUS_PENDING && (e.fe !== n || e.Re || e.Oe))
|
|
1120
1100
|
) {
|
|
1121
|
-
if (!a && !e.
|
|
1101
|
+
if (!a && !e.K) globalQueue.se.push(e);
|
|
1122
1102
|
notifyStatus(e, t, n, a, l);
|
|
1123
1103
|
}
|
|
1124
1104
|
});
|
|
@@ -1146,8 +1126,8 @@ function enableExternalSource(e) {
|
|
|
1146
1126
|
externalSourceConfig = { factory: t, untrack: n };
|
|
1147
1127
|
}
|
|
1148
1128
|
}
|
|
1149
|
-
GlobalQueue.
|
|
1150
|
-
GlobalQueue.
|
|
1129
|
+
GlobalQueue.oe = recompute;
|
|
1130
|
+
GlobalQueue.ue = disposeChildren;
|
|
1151
1131
|
let tracking = false;
|
|
1152
1132
|
let stale = false;
|
|
1153
1133
|
let refreshing = false;
|
|
@@ -1160,7 +1140,7 @@ let snapshotCaptureActive = false;
|
|
|
1160
1140
|
let snapshotSources = null;
|
|
1161
1141
|
function ownerInSnapshotScope(e) {
|
|
1162
1142
|
while (e) {
|
|
1163
|
-
if (e.
|
|
1143
|
+
if (e.We) return true;
|
|
1164
1144
|
e = e.i;
|
|
1165
1145
|
}
|
|
1166
1146
|
return false;
|
|
@@ -1170,23 +1150,23 @@ function setSnapshotCapture(e) {
|
|
|
1170
1150
|
if (e && !snapshotSources) snapshotSources = new Set();
|
|
1171
1151
|
}
|
|
1172
1152
|
function markSnapshotScope(e) {
|
|
1173
|
-
e.
|
|
1153
|
+
e.We = true;
|
|
1174
1154
|
}
|
|
1175
1155
|
function releaseSnapshotScope(e) {
|
|
1176
|
-
e.
|
|
1156
|
+
e.We = false;
|
|
1177
1157
|
releaseSubtree(e);
|
|
1178
1158
|
schedule();
|
|
1179
1159
|
}
|
|
1180
1160
|
function releaseSubtree(e) {
|
|
1181
|
-
let t = e.
|
|
1161
|
+
let t = e.Ce;
|
|
1182
1162
|
while (t) {
|
|
1183
|
-
if (t.
|
|
1184
|
-
t = t.
|
|
1163
|
+
if (t.We) {
|
|
1164
|
+
t = t.De;
|
|
1185
1165
|
continue;
|
|
1186
1166
|
}
|
|
1187
1167
|
if (t.L) {
|
|
1188
1168
|
const e = t;
|
|
1189
|
-
e.
|
|
1169
|
+
e.Te = false;
|
|
1190
1170
|
if (e.O & REACTIVE_SNAPSHOT_STALE) {
|
|
1191
1171
|
e.O &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1192
1172
|
e.O |= REACTIVE_DIRTY;
|
|
@@ -1195,13 +1175,13 @@ function releaseSubtree(e) {
|
|
|
1195
1175
|
}
|
|
1196
1176
|
}
|
|
1197
1177
|
releaseSubtree(t);
|
|
1198
|
-
t = t.
|
|
1178
|
+
t = t.De;
|
|
1199
1179
|
}
|
|
1200
1180
|
}
|
|
1201
1181
|
function clearSnapshots() {
|
|
1202
1182
|
if (snapshotSources) {
|
|
1203
1183
|
for (const e of snapshotSources) {
|
|
1204
|
-
delete e.
|
|
1184
|
+
delete e.de;
|
|
1205
1185
|
delete e[STORE_SNAPSHOT_PROPS];
|
|
1206
1186
|
}
|
|
1207
1187
|
snapshotSources = null;
|
|
@@ -1209,31 +1189,31 @@ function clearSnapshots() {
|
|
|
1209
1189
|
snapshotCaptureActive = false;
|
|
1210
1190
|
}
|
|
1211
1191
|
function recompute(e, t = false) {
|
|
1212
|
-
const n = e.
|
|
1192
|
+
const n = e.W;
|
|
1213
1193
|
if (!t) {
|
|
1214
|
-
if (e.
|
|
1215
|
-
globalQueue.initTransition(e.
|
|
1194
|
+
if (e.K && (!n || activeTransition) && activeTransition !== e.K)
|
|
1195
|
+
globalQueue.initTransition(e.K);
|
|
1216
1196
|
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1217
|
-
e.
|
|
1218
|
-
if (e.
|
|
1197
|
+
e.ye = null;
|
|
1198
|
+
if (e.K || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1219
1199
|
else {
|
|
1220
1200
|
markDisposal(e);
|
|
1221
|
-
e.
|
|
1222
|
-
e.
|
|
1223
|
-
e.
|
|
1224
|
-
e.
|
|
1225
|
-
e.
|
|
1201
|
+
e.we = e.Ve;
|
|
1202
|
+
e.ve = e.Ce;
|
|
1203
|
+
e.Ve = null;
|
|
1204
|
+
e.Ce = null;
|
|
1205
|
+
e.me = 0;
|
|
1226
1206
|
}
|
|
1227
1207
|
}
|
|
1228
1208
|
const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1229
|
-
const r = e.
|
|
1230
|
-
const s = !!(e.
|
|
1209
|
+
const r = e.ee !== undefined && e.ee !== NOT_PENDING;
|
|
1210
|
+
const s = !!(e.Se & STATUS_PENDING);
|
|
1231
1211
|
const o = context;
|
|
1232
1212
|
context = e;
|
|
1233
|
-
e.
|
|
1213
|
+
e.Pe = null;
|
|
1234
1214
|
e.O = REACTIVE_RECOMPUTING_DEPS;
|
|
1235
|
-
e.
|
|
1236
|
-
let u = e.
|
|
1215
|
+
e.Ee = clock;
|
|
1216
|
+
let u = e.X === NOT_PENDING ? e.J : e.X;
|
|
1237
1217
|
let c = e.o;
|
|
1238
1218
|
let a = tracking;
|
|
1239
1219
|
let l = currentOptimisticLane;
|
|
@@ -1247,33 +1227,33 @@ function recompute(e, t = false) {
|
|
|
1247
1227
|
clearStatus(e, t);
|
|
1248
1228
|
const n = resolveLane(e);
|
|
1249
1229
|
if (n) {
|
|
1250
|
-
n.
|
|
1251
|
-
updatePendingSignal(n.
|
|
1230
|
+
n.k.delete(e);
|
|
1231
|
+
updatePendingSignal(n.te);
|
|
1252
1232
|
}
|
|
1253
1233
|
} catch (t) {
|
|
1254
1234
|
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
1255
1235
|
const t = findLane(currentOptimisticLane);
|
|
1256
|
-
if (t.
|
|
1257
|
-
t.
|
|
1258
|
-
e.
|
|
1259
|
-
updatePendingSignal(t.
|
|
1236
|
+
if (t.te !== e) {
|
|
1237
|
+
t.k.add(e);
|
|
1238
|
+
e.q = t;
|
|
1239
|
+
updatePendingSignal(t.te);
|
|
1260
1240
|
}
|
|
1261
1241
|
}
|
|
1262
|
-
if (t instanceof NotReadyError) e.
|
|
1242
|
+
if (t instanceof NotReadyError) e.Ue = true;
|
|
1263
1243
|
notifyStatus(
|
|
1264
1244
|
e,
|
|
1265
1245
|
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
1266
1246
|
t,
|
|
1267
1247
|
undefined,
|
|
1268
|
-
t instanceof NotReadyError ? e.
|
|
1248
|
+
t instanceof NotReadyError ? e.q : undefined
|
|
1269
1249
|
);
|
|
1270
1250
|
} finally {
|
|
1271
1251
|
tracking = a;
|
|
1272
1252
|
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1273
1253
|
context = o;
|
|
1274
1254
|
}
|
|
1275
|
-
if (!e.
|
|
1276
|
-
const o = e.
|
|
1255
|
+
if (!e.fe) {
|
|
1256
|
+
const o = e.Pe;
|
|
1277
1257
|
let a = o !== null ? o.D : e.C;
|
|
1278
1258
|
if (a !== null) {
|
|
1279
1259
|
do {
|
|
@@ -1282,21 +1262,21 @@ function recompute(e, t = false) {
|
|
|
1282
1262
|
if (o !== null) o.D = null;
|
|
1283
1263
|
else e.C = null;
|
|
1284
1264
|
}
|
|
1285
|
-
const l = r ? e.
|
|
1286
|
-
const f = !e.
|
|
1265
|
+
const l = r ? e.ee : e.X === NOT_PENDING ? e.J : e.X;
|
|
1266
|
+
const f = !e.ke || !e.ke(l, u);
|
|
1287
1267
|
if (f) {
|
|
1288
|
-
const o = r ? e.
|
|
1289
|
-
if (t || (n && activeTransition !== e.
|
|
1290
|
-
e.
|
|
1268
|
+
const o = r ? e.ee : undefined;
|
|
1269
|
+
if (t || (n && activeTransition !== e.K) || i) {
|
|
1270
|
+
e.J = u;
|
|
1291
1271
|
if (r && i) {
|
|
1292
|
-
e.
|
|
1293
|
-
e.
|
|
1272
|
+
e.ee = u;
|
|
1273
|
+
e.X = u;
|
|
1294
1274
|
}
|
|
1295
|
-
} else e.
|
|
1296
|
-
if (r && !i && s && !e.
|
|
1297
|
-
if (!r || i || e.
|
|
1275
|
+
} else e.X = u;
|
|
1276
|
+
if (r && !i && s && !e.Ie) e.ee = u;
|
|
1277
|
+
if (!r || i || e.ee !== o) insertSubs(e, i || r);
|
|
1298
1278
|
} else if (r) {
|
|
1299
|
-
e.
|
|
1279
|
+
e.X = u;
|
|
1300
1280
|
} else if (e.o != c) {
|
|
1301
1281
|
for (let t = e.h; t !== null; t = t.I) {
|
|
1302
1282
|
insertIntoHeapHeight(t.p, t.p.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
@@ -1304,8 +1284,8 @@ function recompute(e, t = false) {
|
|
|
1304
1284
|
}
|
|
1305
1285
|
}
|
|
1306
1286
|
currentOptimisticLane = l;
|
|
1307
|
-
(!t || e.
|
|
1308
|
-
e.
|
|
1287
|
+
(!t || e.Se & STATUS_PENDING) && !e.K && !(activeTransition && r) && globalQueue.se.push(e);
|
|
1288
|
+
e.K && n && activeTransition !== e.K && runInTransition(e.K, () => recompute(e));
|
|
1309
1289
|
}
|
|
1310
1290
|
function updateIfNecessary(e) {
|
|
1311
1291
|
if (e.O & REACTIVE_CHECK) {
|
|
@@ -1320,7 +1300,7 @@ function updateIfNecessary(e) {
|
|
|
1320
1300
|
}
|
|
1321
1301
|
}
|
|
1322
1302
|
}
|
|
1323
|
-
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.
|
|
1303
|
+
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.fe && e.Ee < clock && !e.ye)) {
|
|
1324
1304
|
recompute(e);
|
|
1325
1305
|
}
|
|
1326
1306
|
e.O = e.O & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
|
|
@@ -1329,49 +1309,49 @@ function computed(e, t, n) {
|
|
|
1329
1309
|
const i = n?.transparent ?? false;
|
|
1330
1310
|
const r = {
|
|
1331
1311
|
id: n?.id ?? (i ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1312
|
+
be: i || undefined,
|
|
1313
|
+
ke: n?.equals != null ? n.equals : isEqual,
|
|
1314
|
+
le: !!n?.pureWrite,
|
|
1335
1315
|
Ne: n?.unobserved,
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1316
|
+
Ve: null,
|
|
1317
|
+
F: context?.F ?? globalQueue,
|
|
1318
|
+
Le: context?.Le ?? defaultContext,
|
|
1319
|
+
me: 0,
|
|
1340
1320
|
L: e,
|
|
1341
|
-
|
|
1321
|
+
J: t,
|
|
1342
1322
|
o: 0,
|
|
1343
1323
|
A: null,
|
|
1344
1324
|
S: undefined,
|
|
1345
1325
|
T: null,
|
|
1346
1326
|
C: null,
|
|
1347
|
-
|
|
1327
|
+
Pe: null,
|
|
1348
1328
|
h: null,
|
|
1349
|
-
|
|
1329
|
+
Ae: null,
|
|
1350
1330
|
i: context,
|
|
1351
|
-
|
|
1352
|
-
|
|
1331
|
+
De: null,
|
|
1332
|
+
Ce: null,
|
|
1353
1333
|
O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1334
|
+
Se: STATUS_UNINITIALIZED,
|
|
1335
|
+
Ee: clock,
|
|
1336
|
+
X: NOT_PENDING,
|
|
1337
|
+
we: null,
|
|
1338
|
+
ve: null,
|
|
1358
1339
|
ye: null,
|
|
1359
|
-
|
|
1360
|
-
B: null
|
|
1340
|
+
K: null
|
|
1361
1341
|
};
|
|
1362
1342
|
r.T = r;
|
|
1363
1343
|
const s = context?.t ? context.u : context;
|
|
1364
1344
|
if (context) {
|
|
1365
|
-
const e = context.
|
|
1345
|
+
const e = context.Ce;
|
|
1366
1346
|
if (e === null) {
|
|
1367
|
-
context.
|
|
1347
|
+
context.Ce = r;
|
|
1368
1348
|
} else {
|
|
1369
|
-
r.
|
|
1370
|
-
context.
|
|
1349
|
+
r.De = e;
|
|
1350
|
+
context.Ce = r;
|
|
1371
1351
|
}
|
|
1372
1352
|
}
|
|
1373
1353
|
if (s) r.o = s.o + 1;
|
|
1374
|
-
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.
|
|
1354
|
+
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.Te = true;
|
|
1375
1355
|
if (externalSourceConfig) {
|
|
1376
1356
|
const e = signal(undefined, { equals: false, pureWrite: true });
|
|
1377
1357
|
const t = externalSourceConfig.factory(r.L, () => {
|
|
@@ -1385,8 +1365,8 @@ function computed(e, t, n) {
|
|
|
1385
1365
|
}
|
|
1386
1366
|
!n?.lazy && recompute(r, true);
|
|
1387
1367
|
if (snapshotCaptureActive && !n?.lazy) {
|
|
1388
|
-
if (!(r.
|
|
1389
|
-
r.
|
|
1368
|
+
if (!(r.Se & STATUS_PENDING)) {
|
|
1369
|
+
r.de = r.J === undefined ? NO_SNAPSHOT : r.J;
|
|
1390
1370
|
snapshotSources.add(r);
|
|
1391
1371
|
}
|
|
1392
1372
|
}
|
|
@@ -1394,33 +1374,33 @@ function computed(e, t, n) {
|
|
|
1394
1374
|
}
|
|
1395
1375
|
function signal(e, t, n = null) {
|
|
1396
1376
|
const i = {
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1377
|
+
ke: t?.equals != null ? t.equals : isEqual,
|
|
1378
|
+
le: !!t?.pureWrite,
|
|
1379
|
+
He: !!t?.He,
|
|
1400
1380
|
Ne: t?.unobserved,
|
|
1401
|
-
|
|
1381
|
+
J: e,
|
|
1402
1382
|
h: null,
|
|
1403
|
-
|
|
1404
|
-
|
|
1383
|
+
Ae: null,
|
|
1384
|
+
Ee: clock,
|
|
1405
1385
|
V: n,
|
|
1406
1386
|
N: n?.A || null,
|
|
1407
|
-
|
|
1387
|
+
X: NOT_PENDING
|
|
1408
1388
|
};
|
|
1409
1389
|
n && (n.A = i);
|
|
1410
|
-
if (snapshotCaptureActive && !i.
|
|
1411
|
-
i.
|
|
1390
|
+
if (snapshotCaptureActive && !i.He && !((n?.Se ?? 0) & STATUS_PENDING)) {
|
|
1391
|
+
i.de = e === undefined ? NO_SNAPSHOT : e;
|
|
1412
1392
|
snapshotSources.add(i);
|
|
1413
1393
|
}
|
|
1414
1394
|
return i;
|
|
1415
1395
|
}
|
|
1416
1396
|
function optimisticSignal(e, t) {
|
|
1417
1397
|
const n = signal(e, t);
|
|
1418
|
-
n.
|
|
1398
|
+
n.ee = NOT_PENDING;
|
|
1419
1399
|
return n;
|
|
1420
1400
|
}
|
|
1421
1401
|
function optimisticComputed(e, t, n) {
|
|
1422
1402
|
const i = computed(e, t, n);
|
|
1423
|
-
i.
|
|
1403
|
+
i.ee = NOT_PENDING;
|
|
1424
1404
|
return i;
|
|
1425
1405
|
}
|
|
1426
1406
|
function isEqual(e, t) {
|
|
@@ -1442,7 +1422,7 @@ function read(e) {
|
|
|
1442
1422
|
const t = getLatestValueComputed(e);
|
|
1443
1423
|
const n = latestReadActive;
|
|
1444
1424
|
latestReadActive = false;
|
|
1445
|
-
const i = e.
|
|
1425
|
+
const i = e.ee !== undefined && e.ee !== NOT_PENDING ? e.ee : e.J;
|
|
1446
1426
|
let r;
|
|
1447
1427
|
try {
|
|
1448
1428
|
r = read(t);
|
|
@@ -1452,11 +1432,11 @@ function read(e) {
|
|
|
1452
1432
|
} finally {
|
|
1453
1433
|
latestReadActive = n;
|
|
1454
1434
|
}
|
|
1455
|
-
if (t.
|
|
1456
|
-
if (stale && currentOptimisticLane && t.
|
|
1457
|
-
const e = findLane(t.
|
|
1435
|
+
if (t.Se & STATUS_PENDING) return i;
|
|
1436
|
+
if (stale && currentOptimisticLane && t.q) {
|
|
1437
|
+
const e = findLane(t.q);
|
|
1458
1438
|
const n = findLane(currentOptimisticLane);
|
|
1459
|
-
if (e !== n && e.
|
|
1439
|
+
if (e !== n && e.k.size > 0) {
|
|
1460
1440
|
return i;
|
|
1461
1441
|
}
|
|
1462
1442
|
}
|
|
@@ -1466,8 +1446,8 @@ function read(e) {
|
|
|
1466
1446
|
const t = e.V;
|
|
1467
1447
|
const n = pendingCheckActive;
|
|
1468
1448
|
pendingCheckActive = false;
|
|
1469
|
-
if (t && e.
|
|
1470
|
-
if (e.
|
|
1449
|
+
if (t && e.ee !== undefined) {
|
|
1450
|
+
if (e.ee !== NOT_PENDING && (t.ye || !!(t.Se & STATUS_PENDING))) {
|
|
1471
1451
|
foundPending = true;
|
|
1472
1452
|
}
|
|
1473
1453
|
let n = context;
|
|
@@ -1480,7 +1460,7 @@ function read(e) {
|
|
|
1480
1460
|
if (t && read(getPendingSignal(t))) foundPending = true;
|
|
1481
1461
|
}
|
|
1482
1462
|
pendingCheckActive = n;
|
|
1483
|
-
return e.
|
|
1463
|
+
return e.J;
|
|
1484
1464
|
}
|
|
1485
1465
|
let t = context;
|
|
1486
1466
|
if (t?.t) t = t.u;
|
|
@@ -1506,60 +1486,60 @@ function read(e) {
|
|
|
1506
1486
|
}
|
|
1507
1487
|
}
|
|
1508
1488
|
}
|
|
1509
|
-
if (n.
|
|
1510
|
-
if (t && !(stale && n.
|
|
1489
|
+
if (n.Se & STATUS_PENDING) {
|
|
1490
|
+
if (t && !(stale && n.K && activeTransition !== n.K)) {
|
|
1511
1491
|
if (currentOptimisticLane) {
|
|
1512
|
-
const i = n.
|
|
1492
|
+
const i = n.q;
|
|
1513
1493
|
const r = findLane(currentOptimisticLane);
|
|
1514
1494
|
if (i && findLane(i) === r && !hasActiveOverride(n)) {
|
|
1515
1495
|
if (!tracking && e !== t) link(e, t);
|
|
1516
|
-
throw n.
|
|
1496
|
+
throw n.fe;
|
|
1517
1497
|
}
|
|
1518
1498
|
} else {
|
|
1519
1499
|
if (!tracking && e !== t) link(e, t);
|
|
1520
|
-
throw n.
|
|
1500
|
+
throw n.fe;
|
|
1521
1501
|
}
|
|
1522
|
-
} else if (t && n !== e && n.
|
|
1502
|
+
} else if (t && n !== e && n.Se & STATUS_UNINITIALIZED) {
|
|
1523
1503
|
if (!tracking && e !== t) link(e, t);
|
|
1524
|
-
throw n.
|
|
1525
|
-
} else if (!t && n.
|
|
1526
|
-
throw n.
|
|
1504
|
+
throw n.fe;
|
|
1505
|
+
} else if (!t && n.Se & STATUS_UNINITIALIZED) {
|
|
1506
|
+
throw n.fe;
|
|
1527
1507
|
}
|
|
1528
1508
|
}
|
|
1529
|
-
if (e.L && e.
|
|
1530
|
-
if (e.
|
|
1509
|
+
if (e.L && e.Se & STATUS_ERROR) {
|
|
1510
|
+
if (e.Ee < clock) {
|
|
1531
1511
|
recompute(e);
|
|
1532
1512
|
return read(e);
|
|
1533
|
-
} else throw e.
|
|
1513
|
+
} else throw e.fe;
|
|
1534
1514
|
}
|
|
1535
|
-
if (snapshotCaptureActive && t && t.
|
|
1536
|
-
const n = e.
|
|
1515
|
+
if (snapshotCaptureActive && t && t.Te) {
|
|
1516
|
+
const n = e.de;
|
|
1537
1517
|
if (n !== undefined) {
|
|
1538
1518
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1539
|
-
const r = e.
|
|
1519
|
+
const r = e.X !== NOT_PENDING ? e.X : e.J;
|
|
1540
1520
|
if (r !== i) t.O |= REACTIVE_SNAPSHOT_STALE;
|
|
1541
1521
|
return i;
|
|
1542
1522
|
}
|
|
1543
1523
|
}
|
|
1544
|
-
if (e.
|
|
1545
|
-
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.
|
|
1546
|
-
return e.
|
|
1524
|
+
if (e.ee !== undefined && e.ee !== NOT_PENDING) {
|
|
1525
|
+
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.J;
|
|
1526
|
+
return e.ee;
|
|
1547
1527
|
}
|
|
1548
1528
|
return !t ||
|
|
1549
1529
|
(currentOptimisticLane !== null &&
|
|
1550
|
-
(e.
|
|
1551
|
-
e.
|
|
1552
|
-
(stale && e.
|
|
1553
|
-
? e.
|
|
1554
|
-
: e.
|
|
1530
|
+
(e.ee !== undefined || e.q || (n === e && stale) || !!(n.Se & STATUS_PENDING))) ||
|
|
1531
|
+
e.X === NOT_PENDING ||
|
|
1532
|
+
(stale && e.K && activeTransition !== e.K)
|
|
1533
|
+
? e.J
|
|
1534
|
+
: e.X;
|
|
1555
1535
|
}
|
|
1556
1536
|
function setSignal(e, t) {
|
|
1557
|
-
if (e.
|
|
1558
|
-
const n = e.
|
|
1559
|
-
const i = e.
|
|
1560
|
-
const r = n ? (i ? e.
|
|
1537
|
+
if (e.K && activeTransition !== e.K) globalQueue.initTransition(e.K);
|
|
1538
|
+
const n = e.ee !== undefined && !projectionWriteActive;
|
|
1539
|
+
const i = e.ee !== undefined && e.ee !== NOT_PENDING;
|
|
1540
|
+
const r = n ? (i ? e.ee : e.J) : e.X === NOT_PENDING ? e.J : e.X;
|
|
1561
1541
|
if (typeof t === "function") t = t(r);
|
|
1562
|
-
const s = !e.
|
|
1542
|
+
const s = !e.ke || !e.ke(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
|
|
1563
1543
|
if (!s) {
|
|
1564
1544
|
if (n && i && e.L) {
|
|
1565
1545
|
insertSubs(e, true);
|
|
@@ -1568,25 +1548,25 @@ function setSignal(e, t) {
|
|
|
1568
1548
|
return t;
|
|
1569
1549
|
}
|
|
1570
1550
|
if (n) {
|
|
1571
|
-
const n = e.
|
|
1551
|
+
const n = e.ee === NOT_PENDING;
|
|
1572
1552
|
if (!n) globalQueue.initTransition(resolveTransition(e));
|
|
1573
1553
|
if (n) {
|
|
1574
|
-
e.
|
|
1575
|
-
globalQueue.
|
|
1554
|
+
e.X = e.J;
|
|
1555
|
+
globalQueue.Y.push(e);
|
|
1576
1556
|
}
|
|
1577
|
-
e.
|
|
1557
|
+
e.Ie = true;
|
|
1578
1558
|
const i = getOrCreateLane(e);
|
|
1579
|
-
e.
|
|
1580
|
-
e.
|
|
1559
|
+
e.q = i;
|
|
1560
|
+
e.ee = t;
|
|
1581
1561
|
} else {
|
|
1582
|
-
if (e.
|
|
1583
|
-
e.
|
|
1562
|
+
if (e.X === NOT_PENDING) globalQueue.se.push(e);
|
|
1563
|
+
e.X = t;
|
|
1584
1564
|
}
|
|
1585
1565
|
updatePendingSignal(e);
|
|
1586
|
-
if (e.
|
|
1587
|
-
setSignal(e.
|
|
1566
|
+
if (e.xe) {
|
|
1567
|
+
setSignal(e.xe, t);
|
|
1588
1568
|
}
|
|
1589
|
-
e.
|
|
1569
|
+
e.Ee = clock;
|
|
1590
1570
|
insertSubs(e, n);
|
|
1591
1571
|
schedule();
|
|
1592
1572
|
return t;
|
|
@@ -1604,68 +1584,68 @@ function runWithOwner(e, t) {
|
|
|
1604
1584
|
}
|
|
1605
1585
|
}
|
|
1606
1586
|
function getPendingSignal(e) {
|
|
1607
|
-
if (!e.
|
|
1608
|
-
e.
|
|
1609
|
-
if (e.
|
|
1610
|
-
e.
|
|
1587
|
+
if (!e.Fe) {
|
|
1588
|
+
e.Fe = optimisticSignal(false, { pureWrite: true });
|
|
1589
|
+
if (e._e) {
|
|
1590
|
+
e.Fe._e = e;
|
|
1611
1591
|
}
|
|
1612
|
-
if (computePendingState(e)) setSignal(e.
|
|
1592
|
+
if (computePendingState(e)) setSignal(e.Fe, true);
|
|
1613
1593
|
}
|
|
1614
|
-
return e.
|
|
1594
|
+
return e.Fe;
|
|
1615
1595
|
}
|
|
1616
1596
|
function computePendingState(e) {
|
|
1617
1597
|
const t = e;
|
|
1618
1598
|
const n = e.V;
|
|
1619
|
-
if (n && e.
|
|
1620
|
-
return !n.
|
|
1599
|
+
if (n && e.X !== NOT_PENDING) {
|
|
1600
|
+
return !n.ye && !(n.Se & STATUS_PENDING);
|
|
1621
1601
|
}
|
|
1622
|
-
if (e.
|
|
1623
|
-
if (t.
|
|
1624
|
-
if (e.
|
|
1625
|
-
const t = e.
|
|
1626
|
-
return !!(t && t.
|
|
1602
|
+
if (e.ee !== undefined && e.ee !== NOT_PENDING) {
|
|
1603
|
+
if (t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
|
|
1604
|
+
if (e._e) {
|
|
1605
|
+
const t = e.q ? findLane(e.q) : null;
|
|
1606
|
+
return !!(t && t.k.size > 0);
|
|
1627
1607
|
}
|
|
1628
1608
|
return true;
|
|
1629
1609
|
}
|
|
1630
|
-
if (e.
|
|
1610
|
+
if (e.ee !== undefined && e.ee === NOT_PENDING && !e._e) {
|
|
1631
1611
|
return false;
|
|
1632
1612
|
}
|
|
1633
|
-
if (e.
|
|
1634
|
-
return !!(t.
|
|
1613
|
+
if (e.X !== NOT_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
|
|
1614
|
+
return !!(t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED));
|
|
1635
1615
|
}
|
|
1636
1616
|
function updatePendingSignal(e) {
|
|
1637
|
-
if (e.
|
|
1617
|
+
if (e.Fe) {
|
|
1638
1618
|
const t = computePendingState(e);
|
|
1639
|
-
const n = e.
|
|
1619
|
+
const n = e.Fe;
|
|
1640
1620
|
setSignal(n, t);
|
|
1641
|
-
if (!t && n.
|
|
1621
|
+
if (!t && n.q) {
|
|
1642
1622
|
const t = resolveLane(e);
|
|
1643
|
-
if (t && t.
|
|
1644
|
-
const e = findLane(n.
|
|
1623
|
+
if (t && t.k.size > 0) {
|
|
1624
|
+
const e = findLane(n.q);
|
|
1645
1625
|
if (e !== t) {
|
|
1646
1626
|
mergeLanes(t, e);
|
|
1647
1627
|
}
|
|
1648
1628
|
}
|
|
1649
1629
|
signalLanes.delete(n);
|
|
1650
|
-
n.
|
|
1630
|
+
n.q = undefined;
|
|
1651
1631
|
}
|
|
1652
1632
|
}
|
|
1653
1633
|
}
|
|
1654
1634
|
function getLatestValueComputed(e) {
|
|
1655
|
-
if (!e.
|
|
1635
|
+
if (!e.xe) {
|
|
1656
1636
|
const t = latestReadActive;
|
|
1657
1637
|
latestReadActive = false;
|
|
1658
1638
|
const n = pendingCheckActive;
|
|
1659
1639
|
pendingCheckActive = false;
|
|
1660
1640
|
const i = context;
|
|
1661
1641
|
context = null;
|
|
1662
|
-
e.
|
|
1663
|
-
e.
|
|
1642
|
+
e.xe = optimisticComputed(() => read(e));
|
|
1643
|
+
e.xe._e = e;
|
|
1664
1644
|
context = i;
|
|
1665
1645
|
pendingCheckActive = n;
|
|
1666
1646
|
latestReadActive = t;
|
|
1667
1647
|
}
|
|
1668
|
-
return e.
|
|
1648
|
+
return e.xe;
|
|
1669
1649
|
}
|
|
1670
1650
|
function staleValues(e, t = true) {
|
|
1671
1651
|
const n = stale;
|
|
@@ -1726,7 +1706,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1726
1706
|
if (!t) {
|
|
1727
1707
|
throw new NoOwnerError();
|
|
1728
1708
|
}
|
|
1729
|
-
const n = hasContext(e, t) ? t.
|
|
1709
|
+
const n = hasContext(e, t) ? t.Le[e.id] : e.defaultValue;
|
|
1730
1710
|
if (isUndefined(n)) {
|
|
1731
1711
|
throw new ContextNotFoundError();
|
|
1732
1712
|
}
|
|
@@ -1736,10 +1716,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1736
1716
|
if (!n) {
|
|
1737
1717
|
throw new NoOwnerError();
|
|
1738
1718
|
}
|
|
1739
|
-
n.
|
|
1719
|
+
n.Le = { ...n.Le, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1740
1720
|
}
|
|
1741
1721
|
function hasContext(e, t) {
|
|
1742
|
-
return !isUndefined(t?.
|
|
1722
|
+
return !isUndefined(t?.Le[e.id]);
|
|
1743
1723
|
}
|
|
1744
1724
|
function isUndefined(e) {
|
|
1745
1725
|
return typeof e === "undefined";
|
|
@@ -1749,96 +1729,96 @@ function effect(e, t, n, i, r) {
|
|
|
1749
1729
|
const o = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
1750
1730
|
...r,
|
|
1751
1731
|
equals: () => {
|
|
1752
|
-
o
|
|
1753
|
-
if (s) o.
|
|
1732
|
+
o.H = !o.fe;
|
|
1733
|
+
if (s) o.F.enqueue(o.W, runEffect.bind(o));
|
|
1754
1734
|
return false;
|
|
1755
1735
|
},
|
|
1756
1736
|
lazy: true
|
|
1757
1737
|
});
|
|
1758
|
-
o.
|
|
1759
|
-
o
|
|
1760
|
-
o
|
|
1761
|
-
o.
|
|
1762
|
-
o.
|
|
1763
|
-
o.
|
|
1764
|
-
const n = e !== undefined ? e : o.
|
|
1765
|
-
const i = t !== undefined ? t : o.
|
|
1738
|
+
o.Qe = i;
|
|
1739
|
+
o.Me = t;
|
|
1740
|
+
o.$e = n;
|
|
1741
|
+
o.je = undefined;
|
|
1742
|
+
o.W = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
1743
|
+
o.Ge = (e, t) => {
|
|
1744
|
+
const n = e !== undefined ? e : o.Se;
|
|
1745
|
+
const i = t !== undefined ? t : o.fe;
|
|
1766
1746
|
if (n & STATUS_ERROR) {
|
|
1767
1747
|
let e = i;
|
|
1768
|
-
o.
|
|
1769
|
-
if (o.
|
|
1748
|
+
o.F.notify(o, STATUS_PENDING, 0);
|
|
1749
|
+
if (o.W === EFFECT_USER) {
|
|
1770
1750
|
try {
|
|
1771
|
-
return o
|
|
1772
|
-
? o
|
|
1773
|
-
o.
|
|
1774
|
-
o.
|
|
1751
|
+
return o.$e
|
|
1752
|
+
? o.$e(e, () => {
|
|
1753
|
+
o.je?.();
|
|
1754
|
+
o.je = undefined;
|
|
1775
1755
|
})
|
|
1776
1756
|
: console.error(e);
|
|
1777
1757
|
} catch (t) {
|
|
1778
1758
|
e = t;
|
|
1779
1759
|
}
|
|
1780
1760
|
}
|
|
1781
|
-
if (!o.
|
|
1782
|
-
} else if (o.
|
|
1783
|
-
o.
|
|
1761
|
+
if (!o.F.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1762
|
+
} else if (o.W === EFFECT_RENDER) {
|
|
1763
|
+
o.F.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
1784
1764
|
}
|
|
1785
1765
|
};
|
|
1786
1766
|
recompute(o, true);
|
|
1787
|
-
!r?.defer && (o.
|
|
1767
|
+
!r?.defer && (o.W === EFFECT_USER ? o.F.enqueue(o.W, runEffect.bind(o)) : runEffect.call(o));
|
|
1788
1768
|
s = true;
|
|
1789
|
-
cleanup(() => o.
|
|
1769
|
+
cleanup(() => o.je?.());
|
|
1790
1770
|
}
|
|
1791
1771
|
function runEffect() {
|
|
1792
|
-
if (!this
|
|
1793
|
-
this.
|
|
1794
|
-
this.
|
|
1772
|
+
if (!this.H || this.O & REACTIVE_DISPOSED) return;
|
|
1773
|
+
this.je?.();
|
|
1774
|
+
this.je = undefined;
|
|
1795
1775
|
try {
|
|
1796
|
-
const e = this
|
|
1776
|
+
const e = this.Me(this.J, this.Qe);
|
|
1797
1777
|
if (false && e !== undefined && typeof e !== "function");
|
|
1798
|
-
this.
|
|
1778
|
+
this.je = e;
|
|
1799
1779
|
} catch (e) {
|
|
1800
|
-
this.
|
|
1801
|
-
this.
|
|
1802
|
-
if (!this.
|
|
1780
|
+
this.fe = new StatusError(this, e);
|
|
1781
|
+
this.Se |= STATUS_ERROR;
|
|
1782
|
+
if (!this.F.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1803
1783
|
} finally {
|
|
1804
|
-
this.
|
|
1805
|
-
this
|
|
1784
|
+
this.Qe = this.J;
|
|
1785
|
+
this.H = false;
|
|
1806
1786
|
}
|
|
1807
1787
|
}
|
|
1808
1788
|
function trackedEffect(e, t) {
|
|
1809
1789
|
const run = () => {
|
|
1810
|
-
if (!n
|
|
1790
|
+
if (!n.H || n.O & REACTIVE_DISPOSED) return;
|
|
1811
1791
|
try {
|
|
1812
|
-
n
|
|
1792
|
+
n.H = false;
|
|
1813
1793
|
recompute(n);
|
|
1814
1794
|
} finally {
|
|
1815
1795
|
}
|
|
1816
1796
|
};
|
|
1817
1797
|
const n = computed(
|
|
1818
1798
|
() => {
|
|
1819
|
-
n.
|
|
1820
|
-
n.
|
|
1799
|
+
n.je?.();
|
|
1800
|
+
n.je = undefined;
|
|
1821
1801
|
const t = staleValues(e);
|
|
1822
|
-
n.
|
|
1802
|
+
n.je = t;
|
|
1823
1803
|
},
|
|
1824
1804
|
undefined,
|
|
1825
1805
|
{ ...t, lazy: true }
|
|
1826
1806
|
);
|
|
1827
|
-
n.
|
|
1828
|
-
n.
|
|
1829
|
-
n
|
|
1830
|
-
n.
|
|
1831
|
-
n.
|
|
1832
|
-
const i = e !== undefined ? e : n.
|
|
1807
|
+
n.je = undefined;
|
|
1808
|
+
n.Ke = true;
|
|
1809
|
+
n.H = true;
|
|
1810
|
+
n.W = EFFECT_TRACKED;
|
|
1811
|
+
n.Ge = (e, t) => {
|
|
1812
|
+
const i = e !== undefined ? e : n.Se;
|
|
1833
1813
|
if (i & STATUS_ERROR) {
|
|
1834
|
-
n.
|
|
1835
|
-
const e = t !== undefined ? t : n.
|
|
1836
|
-
if (!n.
|
|
1814
|
+
n.F.notify(n, STATUS_PENDING, 0);
|
|
1815
|
+
const e = t !== undefined ? t : n.fe;
|
|
1816
|
+
if (!n.F.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1837
1817
|
}
|
|
1838
1818
|
};
|
|
1839
|
-
n.
|
|
1840
|
-
n.
|
|
1841
|
-
cleanup(() => n.
|
|
1819
|
+
n.M = run;
|
|
1820
|
+
n.F.enqueue(EFFECT_USER, run);
|
|
1821
|
+
cleanup(() => n.je?.());
|
|
1842
1822
|
}
|
|
1843
1823
|
function restoreTransition(e, t) {
|
|
1844
1824
|
globalQueue.initTransition(e);
|
|
@@ -1852,11 +1832,11 @@ function action(e) {
|
|
|
1852
1832
|
const r = e(...t);
|
|
1853
1833
|
globalQueue.initTransition();
|
|
1854
1834
|
let s = activeTransition;
|
|
1855
|
-
s.
|
|
1835
|
+
s.j.push(r);
|
|
1856
1836
|
const done = (e, t) => {
|
|
1857
1837
|
s = currentTransition(s);
|
|
1858
|
-
const o = s.
|
|
1859
|
-
if (o >= 0) s.
|
|
1838
|
+
const o = s.j.indexOf(r);
|
|
1839
|
+
if (o >= 0) s.j.splice(o, 1);
|
|
1860
1840
|
setActiveTransition(s);
|
|
1861
1841
|
schedule();
|
|
1862
1842
|
t ? i(t) : n(e);
|
|
@@ -1960,7 +1940,7 @@ function createOptimistic(e, t, n) {
|
|
|
1960
1940
|
}
|
|
1961
1941
|
function onSettled(e) {
|
|
1962
1942
|
const t = getOwner();
|
|
1963
|
-
t && !t.
|
|
1943
|
+
t && !t.Ke
|
|
1964
1944
|
? createTrackedEffect(() => untrack(e), undefined)
|
|
1965
1945
|
: globalQueue.enqueue(EFFECT_USER, () => {
|
|
1966
1946
|
const t = e();
|
|
@@ -2130,7 +2110,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2130
2110
|
let r;
|
|
2131
2111
|
const o = new Proxy(
|
|
2132
2112
|
s,
|
|
2133
|
-
createWriteTraps(() => !i || t.
|
|
2113
|
+
createWriteTraps(() => !i || t.ye === r)
|
|
2134
2114
|
);
|
|
2135
2115
|
storeSetter(o, o => {
|
|
2136
2116
|
r = e(o);
|
|
@@ -2141,7 +2121,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2141
2121
|
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2142
2122
|
});
|
|
2143
2123
|
});
|
|
2144
|
-
i.
|
|
2124
|
+
i.ge = true;
|
|
2145
2125
|
return { store: s, node: i };
|
|
2146
2126
|
}
|
|
2147
2127
|
function createProjection(e, t = {}, n) {
|
|
@@ -2262,11 +2242,11 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
|
2262
2242
|
i
|
|
2263
2243
|
);
|
|
2264
2244
|
if (s) {
|
|
2265
|
-
u.
|
|
2245
|
+
u.ee = NOT_PENDING;
|
|
2266
2246
|
}
|
|
2267
2247
|
if (o && t in o) {
|
|
2268
2248
|
const e = o[t];
|
|
2269
|
-
u.
|
|
2249
|
+
u.de = e === undefined ? NO_SNAPSHOT : e;
|
|
2270
2250
|
snapshotSources?.add(u);
|
|
2271
2251
|
}
|
|
2272
2252
|
return (e[t] = u);
|
|
@@ -2323,11 +2303,11 @@ const storeTraps = {
|
|
|
2323
2303
|
if (writeOnly(n)) {
|
|
2324
2304
|
let n =
|
|
2325
2305
|
r && (o || !u)
|
|
2326
|
-
? r.
|
|
2327
|
-
? r.
|
|
2328
|
-
: r.
|
|
2329
|
-
? r.
|
|
2330
|
-
: r.
|
|
2306
|
+
? r.ee !== undefined && r.ee !== NOT_PENDING
|
|
2307
|
+
? r.ee
|
|
2308
|
+
: r.X !== NOT_PENDING
|
|
2309
|
+
? r.X
|
|
2310
|
+
: r.J
|
|
2331
2311
|
: c[t];
|
|
2332
2312
|
n === $DELETED && (n = undefined);
|
|
2333
2313
|
if (!isWrappable(n)) return n;
|
|
@@ -2382,8 +2362,8 @@ const storeTraps = {
|
|
|
2382
2362
|
if (writeOnly(i)) {
|
|
2383
2363
|
if (e[STORE_OPTIMISTIC]) {
|
|
2384
2364
|
const t = e[STORE_FIREWALL];
|
|
2385
|
-
if (t?.
|
|
2386
|
-
globalQueue.initTransition(t.
|
|
2365
|
+
if (t?.K) {
|
|
2366
|
+
globalQueue.initTransition(t.K);
|
|
2387
2367
|
}
|
|
2388
2368
|
}
|
|
2389
2369
|
untrack(() => {
|
|
@@ -2392,7 +2372,7 @@ const storeTraps = {
|
|
|
2392
2372
|
if (
|
|
2393
2373
|
snapshotCaptureActive &&
|
|
2394
2374
|
typeof t !== "symbol" &&
|
|
2395
|
-
!((e[STORE_FIREWALL]?.
|
|
2375
|
+
!((e[STORE_FIREWALL]?.Se ?? 0) & STATUS_PENDING)
|
|
2396
2376
|
) {
|
|
2397
2377
|
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2398
2378
|
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
@@ -2533,7 +2513,7 @@ function createStore(e, t, n) {
|
|
|
2533
2513
|
return [r, e => storeSetter(r, e)];
|
|
2534
2514
|
}
|
|
2535
2515
|
function createOptimisticStore(e, t, n) {
|
|
2536
|
-
GlobalQueue.
|
|
2516
|
+
GlobalQueue.ce ||= clearOptimisticStore;
|
|
2537
2517
|
const i = typeof e === "function";
|
|
2538
2518
|
const r = (i ? t : e) ?? {};
|
|
2539
2519
|
const s = i ? e : undefined;
|
|
@@ -2550,7 +2530,7 @@ function clearOptimisticStore(e) {
|
|
|
2550
2530
|
if (i) {
|
|
2551
2531
|
for (const e of Reflect.ownKeys(n)) {
|
|
2552
2532
|
if (i[e]) {
|
|
2553
|
-
i[e].
|
|
2533
|
+
i[e].q = undefined;
|
|
2554
2534
|
const n =
|
|
2555
2535
|
t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
|
|
2556
2536
|
const r = n === $DELETED ? undefined : n;
|
|
@@ -2558,7 +2538,7 @@ function clearOptimisticStore(e) {
|
|
|
2558
2538
|
}
|
|
2559
2539
|
}
|
|
2560
2540
|
if (i[$TRACK]) {
|
|
2561
|
-
i[$TRACK].
|
|
2541
|
+
i[$TRACK].q = undefined;
|
|
2562
2542
|
setSignal(i[$TRACK], undefined);
|
|
2563
2543
|
}
|
|
2564
2544
|
}
|
|
@@ -2596,7 +2576,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2596
2576
|
let r;
|
|
2597
2577
|
const o = new Proxy(
|
|
2598
2578
|
s,
|
|
2599
|
-
createWriteTraps(() => !i || t.
|
|
2579
|
+
createWriteTraps(() => !i || t.ye === r)
|
|
2600
2580
|
);
|
|
2601
2581
|
setProjectionWriteActive(true);
|
|
2602
2582
|
try {
|
|
@@ -2617,7 +2597,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2617
2597
|
setProjectionWriteActive(false);
|
|
2618
2598
|
}
|
|
2619
2599
|
});
|
|
2620
|
-
i.
|
|
2600
|
+
i.ge = true;
|
|
2621
2601
|
}
|
|
2622
2602
|
return { store: s, node: i };
|
|
2623
2603
|
}
|
|
@@ -2874,63 +2854,63 @@ function mapArray(e, t, n) {
|
|
|
2874
2854
|
const s = t;
|
|
2875
2855
|
return createMemo(
|
|
2876
2856
|
updateKeyedMap.bind({
|
|
2877
|
-
|
|
2857
|
+
Ye: createOwner(),
|
|
2878
2858
|
Be: 0,
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2859
|
+
Ze: e,
|
|
2860
|
+
qe: [],
|
|
2861
|
+
ze: s,
|
|
2862
|
+
Xe: [],
|
|
2882
2863
|
Je: [],
|
|
2883
|
-
et:
|
|
2884
|
-
tt: i,
|
|
2885
|
-
nt:
|
|
2886
|
-
it:
|
|
2887
|
-
rt: n?.fallback
|
|
2864
|
+
et: i,
|
|
2865
|
+
tt: i || n?.keyed === false ? [] : undefined,
|
|
2866
|
+
nt: r ? [] : undefined,
|
|
2867
|
+
it: n?.fallback
|
|
2888
2868
|
})
|
|
2889
2869
|
);
|
|
2890
2870
|
}
|
|
2891
2871
|
const pureOptions = { pureWrite: true };
|
|
2892
2872
|
function updateKeyedMap() {
|
|
2893
|
-
const e = this.
|
|
2873
|
+
const e = this.Ze() || [],
|
|
2894
2874
|
t = e.length;
|
|
2895
2875
|
e[$TRACK];
|
|
2896
|
-
runWithOwner(this.
|
|
2876
|
+
runWithOwner(this.Ye, () => {
|
|
2897
2877
|
let n,
|
|
2898
2878
|
i,
|
|
2899
|
-
r = this.
|
|
2879
|
+
r = this.tt
|
|
2900
2880
|
? () => {
|
|
2901
|
-
this.
|
|
2902
|
-
this.
|
|
2903
|
-
return this.
|
|
2881
|
+
this.tt[i] = signal(e[i], pureOptions);
|
|
2882
|
+
this.nt && (this.nt[i] = signal(i, pureOptions));
|
|
2883
|
+
return this.ze(accessor(this.tt[i]), this.nt ? accessor(this.nt[i]) : undefined);
|
|
2904
2884
|
}
|
|
2905
|
-
: this.
|
|
2885
|
+
: this.nt
|
|
2906
2886
|
? () => {
|
|
2907
2887
|
const t = e[i];
|
|
2908
|
-
this.
|
|
2909
|
-
return this.
|
|
2888
|
+
this.nt[i] = signal(i, pureOptions);
|
|
2889
|
+
return this.ze(() => t, accessor(this.nt[i]));
|
|
2910
2890
|
}
|
|
2911
2891
|
: () => {
|
|
2912
2892
|
const t = e[i];
|
|
2913
|
-
return this.
|
|
2893
|
+
return this.ze(() => t);
|
|
2914
2894
|
};
|
|
2915
2895
|
if (t === 0) {
|
|
2916
2896
|
if (this.Be !== 0) {
|
|
2917
|
-
this.
|
|
2918
|
-
this.et = [];
|
|
2919
|
-
this.ze = [];
|
|
2897
|
+
this.Ye.dispose(false);
|
|
2920
2898
|
this.Je = [];
|
|
2899
|
+
this.qe = [];
|
|
2900
|
+
this.Xe = [];
|
|
2921
2901
|
this.Be = 0;
|
|
2902
|
+
this.tt && (this.tt = []);
|
|
2922
2903
|
this.nt && (this.nt = []);
|
|
2923
|
-
this.it && (this.it = []);
|
|
2924
2904
|
}
|
|
2925
|
-
if (this.
|
|
2926
|
-
this.
|
|
2905
|
+
if (this.it && !this.Xe[0]) {
|
|
2906
|
+
this.Xe[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
|
|
2927
2907
|
}
|
|
2928
2908
|
} else if (this.Be === 0) {
|
|
2929
|
-
if (this.
|
|
2930
|
-
this.
|
|
2909
|
+
if (this.Je[0]) this.Je[0].dispose();
|
|
2910
|
+
this.Xe = new Array(t);
|
|
2931
2911
|
for (i = 0; i < t; i++) {
|
|
2932
|
-
this.
|
|
2933
|
-
this.
|
|
2912
|
+
this.qe[i] = e[i];
|
|
2913
|
+
this.Xe[i] = runWithOwner((this.Je[i] = createOwner()), r);
|
|
2934
2914
|
}
|
|
2935
2915
|
this.Be = t;
|
|
2936
2916
|
} else {
|
|
@@ -2943,152 +2923,152 @@ function updateKeyedMap() {
|
|
|
2943
2923
|
f,
|
|
2944
2924
|
E = new Array(t),
|
|
2945
2925
|
d = new Array(t),
|
|
2946
|
-
T = this.
|
|
2947
|
-
S = this.
|
|
2926
|
+
T = this.tt ? new Array(t) : undefined,
|
|
2927
|
+
S = this.nt ? new Array(t) : undefined;
|
|
2948
2928
|
for (
|
|
2949
2929
|
s = 0, o = Math.min(this.Be, t);
|
|
2950
|
-
s < o && (this.
|
|
2930
|
+
s < o && (this.qe[s] === e[s] || (this.tt && compare(this.et, this.qe[s], e[s])));
|
|
2951
2931
|
s++
|
|
2952
2932
|
) {
|
|
2953
|
-
if (this.
|
|
2933
|
+
if (this.tt) setSignal(this.tt[s], e[s]);
|
|
2954
2934
|
}
|
|
2955
2935
|
for (
|
|
2956
2936
|
o = this.Be - 1, u = t - 1;
|
|
2957
2937
|
o >= s &&
|
|
2958
2938
|
u >= s &&
|
|
2959
|
-
(this.
|
|
2939
|
+
(this.qe[o] === e[u] || (this.tt && compare(this.et, this.qe[o], e[u])));
|
|
2960
2940
|
o--, u--
|
|
2961
2941
|
) {
|
|
2962
|
-
E[u] = this.
|
|
2963
|
-
d[u] = this.
|
|
2964
|
-
T && (T[u] = this.
|
|
2965
|
-
S && (S[u] = this.
|
|
2942
|
+
E[u] = this.Xe[o];
|
|
2943
|
+
d[u] = this.Je[o];
|
|
2944
|
+
T && (T[u] = this.tt[o]);
|
|
2945
|
+
S && (S[u] = this.nt[o]);
|
|
2966
2946
|
}
|
|
2967
2947
|
l = new Map();
|
|
2968
2948
|
f = new Array(u + 1);
|
|
2969
2949
|
for (i = u; i >= s; i--) {
|
|
2970
2950
|
c = e[i];
|
|
2971
|
-
a = this.
|
|
2951
|
+
a = this.et ? this.et(c) : c;
|
|
2972
2952
|
n = l.get(a);
|
|
2973
2953
|
f[i] = n === undefined ? -1 : n;
|
|
2974
2954
|
l.set(a, i);
|
|
2975
2955
|
}
|
|
2976
2956
|
for (n = s; n <= o; n++) {
|
|
2977
|
-
c = this.
|
|
2978
|
-
a = this.
|
|
2957
|
+
c = this.qe[n];
|
|
2958
|
+
a = this.et ? this.et(c) : c;
|
|
2979
2959
|
i = l.get(a);
|
|
2980
2960
|
if (i !== undefined && i !== -1) {
|
|
2981
|
-
E[i] = this.
|
|
2982
|
-
d[i] = this.
|
|
2983
|
-
T && (T[i] = this.
|
|
2984
|
-
S && (S[i] = this.
|
|
2961
|
+
E[i] = this.Xe[n];
|
|
2962
|
+
d[i] = this.Je[n];
|
|
2963
|
+
T && (T[i] = this.tt[n]);
|
|
2964
|
+
S && (S[i] = this.nt[n]);
|
|
2985
2965
|
i = f[i];
|
|
2986
2966
|
l.set(a, i);
|
|
2987
|
-
} else this.
|
|
2967
|
+
} else this.Je[n].dispose();
|
|
2988
2968
|
}
|
|
2989
2969
|
for (i = s; i < t; i++) {
|
|
2990
2970
|
if (i in E) {
|
|
2991
|
-
this.
|
|
2992
|
-
this.
|
|
2971
|
+
this.Xe[i] = E[i];
|
|
2972
|
+
this.Je[i] = d[i];
|
|
2993
2973
|
if (T) {
|
|
2994
|
-
this.
|
|
2995
|
-
setSignal(this.
|
|
2974
|
+
this.tt[i] = T[i];
|
|
2975
|
+
setSignal(this.tt[i], e[i]);
|
|
2996
2976
|
}
|
|
2997
2977
|
if (S) {
|
|
2998
|
-
this.
|
|
2999
|
-
setSignal(this.
|
|
2978
|
+
this.nt[i] = S[i];
|
|
2979
|
+
setSignal(this.nt[i], i);
|
|
3000
2980
|
}
|
|
3001
2981
|
} else {
|
|
3002
|
-
this.
|
|
2982
|
+
this.Xe[i] = runWithOwner((this.Je[i] = createOwner()), r);
|
|
3003
2983
|
}
|
|
3004
2984
|
}
|
|
3005
|
-
this.
|
|
3006
|
-
this.
|
|
2985
|
+
this.Xe = this.Xe.slice(0, (this.Be = t));
|
|
2986
|
+
this.qe = e.slice(0);
|
|
3007
2987
|
}
|
|
3008
2988
|
});
|
|
3009
|
-
return this.
|
|
2989
|
+
return this.Xe;
|
|
3010
2990
|
}
|
|
3011
2991
|
function repeat(e, t, n) {
|
|
3012
2992
|
const i = t;
|
|
3013
2993
|
return updateRepeat.bind({
|
|
3014
|
-
|
|
2994
|
+
Ye: createOwner(),
|
|
3015
2995
|
Be: 0,
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
et: [],
|
|
2996
|
+
rt: 0,
|
|
2997
|
+
st: e,
|
|
2998
|
+
ze: i,
|
|
3020
2999
|
Je: [],
|
|
3021
|
-
|
|
3022
|
-
|
|
3000
|
+
Xe: [],
|
|
3001
|
+
ot: n?.from,
|
|
3002
|
+
it: n?.fallback
|
|
3023
3003
|
});
|
|
3024
3004
|
}
|
|
3025
3005
|
function updateRepeat() {
|
|
3026
|
-
const e = this.
|
|
3027
|
-
const t = this.
|
|
3028
|
-
runWithOwner(this.
|
|
3006
|
+
const e = this.st();
|
|
3007
|
+
const t = this.ot?.() || 0;
|
|
3008
|
+
runWithOwner(this.Ye, () => {
|
|
3029
3009
|
if (e === 0) {
|
|
3030
3010
|
if (this.Be !== 0) {
|
|
3031
|
-
this.
|
|
3032
|
-
this.et = [];
|
|
3011
|
+
this.Ye.dispose(false);
|
|
3033
3012
|
this.Je = [];
|
|
3013
|
+
this.Xe = [];
|
|
3034
3014
|
this.Be = 0;
|
|
3035
3015
|
}
|
|
3036
|
-
if (this.
|
|
3037
|
-
this.
|
|
3016
|
+
if (this.it && !this.Xe[0]) {
|
|
3017
|
+
this.Xe[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
|
|
3038
3018
|
}
|
|
3039
3019
|
return;
|
|
3040
3020
|
}
|
|
3041
3021
|
const n = t + e;
|
|
3042
|
-
const i = this.
|
|
3043
|
-
if (this.Be === 0 && this.
|
|
3044
|
-
for (let e = n; e < i; e++) this.
|
|
3045
|
-
if (this.
|
|
3046
|
-
let e = this.
|
|
3047
|
-
while (e < t && e < this.Be) this.
|
|
3048
|
-
this.
|
|
3049
|
-
this.
|
|
3050
|
-
} else if (this.
|
|
3051
|
-
let n = i - this.
|
|
3052
|
-
let r = this.
|
|
3053
|
-
this.
|
|
3022
|
+
const i = this.rt + this.Be;
|
|
3023
|
+
if (this.Be === 0 && this.Je[0]) this.Je[0].dispose();
|
|
3024
|
+
for (let e = n; e < i; e++) this.Je[e - this.rt].dispose();
|
|
3025
|
+
if (this.rt < t) {
|
|
3026
|
+
let e = this.rt;
|
|
3027
|
+
while (e < t && e < this.Be) this.Je[e++].dispose();
|
|
3028
|
+
this.Je.splice(0, t - this.rt);
|
|
3029
|
+
this.Xe.splice(0, t - this.rt);
|
|
3030
|
+
} else if (this.rt > t) {
|
|
3031
|
+
let n = i - this.rt - 1;
|
|
3032
|
+
let r = this.rt - t;
|
|
3033
|
+
this.Je.length = this.Xe.length = e;
|
|
3054
3034
|
while (n >= r) {
|
|
3055
|
-
this.et[n] = this.et[n - r];
|
|
3056
3035
|
this.Je[n] = this.Je[n - r];
|
|
3036
|
+
this.Xe[n] = this.Xe[n - r];
|
|
3057
3037
|
n--;
|
|
3058
3038
|
}
|
|
3059
3039
|
for (let e = 0; e < r; e++) {
|
|
3060
|
-
this.
|
|
3040
|
+
this.Xe[e] = runWithOwner((this.Je[e] = createOwner()), () => this.ze(e + t));
|
|
3061
3041
|
}
|
|
3062
3042
|
}
|
|
3063
3043
|
for (let e = i; e < n; e++) {
|
|
3064
|
-
this.
|
|
3044
|
+
this.Xe[e - t] = runWithOwner((this.Je[e - t] = createOwner()), () => this.ze(e));
|
|
3065
3045
|
}
|
|
3066
|
-
this.
|
|
3067
|
-
this.
|
|
3046
|
+
this.Xe = this.Xe.slice(0, e);
|
|
3047
|
+
this.rt = t;
|
|
3068
3048
|
this.Be = e;
|
|
3069
3049
|
});
|
|
3070
|
-
return this.
|
|
3050
|
+
return this.Xe;
|
|
3071
3051
|
}
|
|
3072
3052
|
function compare(e, t, n) {
|
|
3073
3053
|
return e ? e(t) === e(n) : true;
|
|
3074
3054
|
}
|
|
3075
3055
|
function boundaryComputed(e, t) {
|
|
3076
3056
|
const n = computed(e, undefined, { lazy: true });
|
|
3077
|
-
n.
|
|
3078
|
-
const i = e !== undefined ? e : n.
|
|
3079
|
-
const r = t !== undefined ? t : n.
|
|
3080
|
-
n.
|
|
3081
|
-
n.
|
|
3057
|
+
n.Ge = (e, t) => {
|
|
3058
|
+
const i = e !== undefined ? e : n.Se;
|
|
3059
|
+
const r = t !== undefined ? t : n.fe;
|
|
3060
|
+
n.Se &= ~n.ut;
|
|
3061
|
+
n.F.notify(n, n.ut, i, r);
|
|
3082
3062
|
};
|
|
3083
|
-
n.
|
|
3084
|
-
n.
|
|
3063
|
+
n.ut = t;
|
|
3064
|
+
n.ge = true;
|
|
3085
3065
|
recompute(n, true);
|
|
3086
3066
|
return n;
|
|
3087
3067
|
}
|
|
3088
3068
|
function createBoundChildren(e, t, n, i) {
|
|
3089
|
-
const r = e.
|
|
3090
|
-
r.addChild((e.
|
|
3091
|
-
cleanup(() => r.removeChild(e.
|
|
3069
|
+
const r = e.F;
|
|
3070
|
+
r.addChild((e.F = n));
|
|
3071
|
+
cleanup(() => r.removeChild(e.F));
|
|
3092
3072
|
return runWithOwner(e, () => {
|
|
3093
3073
|
const e = computed(t);
|
|
3094
3074
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
@@ -3102,68 +3082,68 @@ function isRevealController(e) {
|
|
|
3102
3082
|
return e instanceof RevealController;
|
|
3103
3083
|
}
|
|
3104
3084
|
function isSlotReady(e) {
|
|
3105
|
-
return isRevealController(e) ? e.isReady() : e.
|
|
3085
|
+
return isRevealController(e) ? e.isReady() : e.ct.size === 0 && !e.lt;
|
|
3106
3086
|
}
|
|
3107
3087
|
function setSlotState(e, t, n, i) {
|
|
3108
|
-
setSignal(e.
|
|
3109
|
-
setSignal(e.
|
|
3088
|
+
setSignal(e.ft, n);
|
|
3089
|
+
setSignal(e.Et, i);
|
|
3110
3090
|
if (isRevealController(e)) {
|
|
3111
|
-
if (!n && e.
|
|
3091
|
+
if (!n && e.dt === t) e.dt = undefined;
|
|
3112
3092
|
return e.evaluate(n, i);
|
|
3113
3093
|
}
|
|
3114
|
-
if (!n && e.
|
|
3094
|
+
if (!n && e.Tt === t && e.St) e.Tt = undefined;
|
|
3115
3095
|
}
|
|
3116
3096
|
class RevealController {
|
|
3097
|
+
Rt;
|
|
3117
3098
|
Ot;
|
|
3118
|
-
_t;
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
Et = signal(false, { pureWrite: true,
|
|
3122
|
-
|
|
3123
|
-
It =
|
|
3124
|
-
At = false;
|
|
3099
|
+
_t = [];
|
|
3100
|
+
dt;
|
|
3101
|
+
ft = signal(false, { pureWrite: true, He: true });
|
|
3102
|
+
Et = signal(false, { pureWrite: true, He: true });
|
|
3103
|
+
ht = true;
|
|
3104
|
+
It = false;
|
|
3125
3105
|
constructor(e, t) {
|
|
3126
|
-
this.
|
|
3127
|
-
this.
|
|
3106
|
+
this.Rt = e;
|
|
3107
|
+
this.Ot = t;
|
|
3128
3108
|
}
|
|
3129
|
-
|
|
3130
|
-
for (let t = 0; t < this.
|
|
3131
|
-
const n = this.
|
|
3132
|
-
if ((isRevealController(n) ? n.
|
|
3109
|
+
At(e) {
|
|
3110
|
+
for (let t = 0; t < this._t.length; t++) {
|
|
3111
|
+
const n = this._t[t];
|
|
3112
|
+
if ((isRevealController(n) ? n.dt : n.Tt) !== this) continue;
|
|
3133
3113
|
if (e(n) === false) return false;
|
|
3134
3114
|
}
|
|
3135
3115
|
return true;
|
|
3136
3116
|
}
|
|
3137
3117
|
isReady() {
|
|
3138
|
-
return this.
|
|
3118
|
+
return this.At(isSlotReady);
|
|
3139
3119
|
}
|
|
3140
3120
|
register(e) {
|
|
3141
|
-
if (this.
|
|
3142
|
-
this.
|
|
3143
|
-
const t = !!untrack(this.
|
|
3144
|
-
setSignal(e.
|
|
3121
|
+
if (this._t.includes(e)) return;
|
|
3122
|
+
this._t.push(e);
|
|
3123
|
+
const t = !!untrack(this.Rt);
|
|
3124
|
+
setSignal(e.ft, true), setSignal(e.Et, t ? false : !!untrack(this.Ot));
|
|
3145
3125
|
untrack(() => this.evaluate());
|
|
3146
3126
|
}
|
|
3147
3127
|
unregister(e) {
|
|
3148
|
-
const t = this.
|
|
3149
|
-
if (t >= 0) this.
|
|
3128
|
+
const t = this._t.indexOf(e);
|
|
3129
|
+
if (t >= 0) this._t.splice(t, 1);
|
|
3150
3130
|
untrack(() => this.evaluate());
|
|
3151
3131
|
}
|
|
3152
3132
|
evaluate(e, t) {
|
|
3153
|
-
if (this.
|
|
3154
|
-
this.
|
|
3155
|
-
const n = this.
|
|
3133
|
+
if (this.It) return;
|
|
3134
|
+
this.It = true;
|
|
3135
|
+
const n = this.ht;
|
|
3156
3136
|
try {
|
|
3157
|
-
const n = e ?? read(this.
|
|
3158
|
-
i = !!untrack(this.
|
|
3137
|
+
const n = e ?? read(this.ft),
|
|
3138
|
+
i = !!untrack(this.Ot),
|
|
3159
3139
|
r = t ?? i;
|
|
3160
|
-
if (n && r) this.
|
|
3161
|
-
else if (!!untrack(this.
|
|
3140
|
+
if (n && r) this.At(e => setSlotState(e, this, true, true));
|
|
3141
|
+
else if (!!untrack(this.Rt)) {
|
|
3162
3142
|
const e = this.isReady();
|
|
3163
|
-
this.
|
|
3143
|
+
this.At(t => setSlotState(t, this, !e, false));
|
|
3164
3144
|
} else {
|
|
3165
3145
|
let e = false;
|
|
3166
|
-
this.
|
|
3146
|
+
this.At(t => {
|
|
3167
3147
|
if (e) return setSlotState(t, this, true, i);
|
|
3168
3148
|
if (isSlotReady(t)) return setSlotState(t, this, false, false);
|
|
3169
3149
|
e = true;
|
|
@@ -3171,95 +3151,95 @@ class RevealController {
|
|
|
3171
3151
|
});
|
|
3172
3152
|
}
|
|
3173
3153
|
} finally {
|
|
3174
|
-
this.
|
|
3175
|
-
this.
|
|
3154
|
+
this.ht = this.isReady();
|
|
3155
|
+
this.It = false;
|
|
3176
3156
|
}
|
|
3177
|
-
if (this.
|
|
3157
|
+
if (this.dt && n !== this.ht) this.dt.evaluate();
|
|
3178
3158
|
}
|
|
3179
3159
|
}
|
|
3180
3160
|
class CollectionQueue extends Queue {
|
|
3181
3161
|
Nt;
|
|
3182
|
-
|
|
3162
|
+
ct = new Set();
|
|
3163
|
+
gt;
|
|
3164
|
+
lt = true;
|
|
3165
|
+
ft = signal(false, { pureWrite: true, He: true });
|
|
3166
|
+
Et = signal(false, { pureWrite: true, He: true });
|
|
3167
|
+
Tt;
|
|
3168
|
+
St = false;
|
|
3183
3169
|
Pt;
|
|
3184
|
-
|
|
3185
|
-
Et = signal(false, { pureWrite: true, Fe: true });
|
|
3186
|
-
dt = signal(false, { pureWrite: true, Fe: true });
|
|
3187
|
-
St;
|
|
3188
|
-
Rt = false;
|
|
3189
|
-
Ct;
|
|
3190
|
-
Dt = ON_INIT;
|
|
3170
|
+
Ct = ON_INIT;
|
|
3191
3171
|
constructor(e) {
|
|
3192
3172
|
super();
|
|
3193
3173
|
this.Nt = e;
|
|
3194
3174
|
}
|
|
3195
3175
|
run(e) {
|
|
3196
|
-
if (!e || (read(this.
|
|
3176
|
+
if (!e || (read(this.ft) && (!_revealUsed || read(this.Et)))) return;
|
|
3197
3177
|
return super.run(e);
|
|
3198
3178
|
}
|
|
3199
3179
|
notify(e, t, n, i) {
|
|
3200
3180
|
if (!(t & this.Nt)) return super.notify(e, t, n, i);
|
|
3201
|
-
if (this.
|
|
3181
|
+
if (this.St && this.Pt) {
|
|
3202
3182
|
const e = untrack(() => {
|
|
3203
3183
|
try {
|
|
3204
|
-
return this.
|
|
3184
|
+
return this.Pt();
|
|
3205
3185
|
} catch {
|
|
3206
3186
|
return ON_INIT;
|
|
3207
3187
|
}
|
|
3208
3188
|
});
|
|
3209
|
-
if (e !== this.
|
|
3210
|
-
this.
|
|
3211
|
-
this.
|
|
3212
|
-
this.
|
|
3189
|
+
if (e !== this.Ct) {
|
|
3190
|
+
this.Ct = e;
|
|
3191
|
+
this.St = false;
|
|
3192
|
+
this.ct.clear();
|
|
3213
3193
|
}
|
|
3214
3194
|
}
|
|
3215
|
-
if (this.Nt & STATUS_PENDING && this.
|
|
3195
|
+
if (this.Nt & STATUS_PENDING && this.St) return super.notify(e, t, n, i);
|
|
3216
3196
|
if (this.Nt & STATUS_PENDING && n & STATUS_ERROR) {
|
|
3217
3197
|
return super.notify(e, STATUS_ERROR, n, i);
|
|
3218
3198
|
}
|
|
3219
3199
|
if (n & this.Nt) {
|
|
3220
|
-
this.
|
|
3221
|
-
const t = i?.source || e.
|
|
3200
|
+
this.lt = true;
|
|
3201
|
+
const t = i?.source || e.fe?.source;
|
|
3222
3202
|
if (t) {
|
|
3223
|
-
const e = this.
|
|
3224
|
-
this.
|
|
3225
|
-
if (e) setSignal(this.
|
|
3203
|
+
const e = this.ct.size === 0;
|
|
3204
|
+
this.ct.add(t);
|
|
3205
|
+
if (e) setSignal(this.ft, true);
|
|
3226
3206
|
}
|
|
3227
3207
|
}
|
|
3228
3208
|
t &= ~this.Nt;
|
|
3229
3209
|
return t ? super.notify(e, t, n, i) : true;
|
|
3230
3210
|
}
|
|
3231
3211
|
checkSources() {
|
|
3232
|
-
for (const e of this.
|
|
3212
|
+
for (const e of this.ct) {
|
|
3233
3213
|
if (
|
|
3234
3214
|
e.O & REACTIVE_DISPOSED ||
|
|
3235
|
-
(!(e.
|
|
3215
|
+
(!(e.Se & this.Nt) && !(this.Nt & STATUS_ERROR && e.Se & STATUS_PENDING))
|
|
3236
3216
|
)
|
|
3237
|
-
this.
|
|
3217
|
+
this.ct.delete(e);
|
|
3238
3218
|
}
|
|
3239
|
-
if (!this.
|
|
3240
|
-
if (this.Nt & STATUS_PENDING && this.
|
|
3241
|
-
this.
|
|
3219
|
+
if (!this.ct.size) {
|
|
3220
|
+
if (this.Nt & STATUS_PENDING && this.lt && !this.St && this.gt) {
|
|
3221
|
+
this.lt = !!(this.gt.Se & this.Nt);
|
|
3242
3222
|
} else {
|
|
3243
|
-
this.
|
|
3223
|
+
this.lt = false;
|
|
3244
3224
|
}
|
|
3245
|
-
if (!this.
|
|
3246
|
-
setSignal(this.
|
|
3247
|
-
if (this.
|
|
3225
|
+
if (!this.lt) {
|
|
3226
|
+
setSignal(this.ft, false);
|
|
3227
|
+
if (this.Pt) {
|
|
3248
3228
|
try {
|
|
3249
|
-
this.
|
|
3229
|
+
this.Ct = untrack(() => this.Pt());
|
|
3250
3230
|
} catch {}
|
|
3251
3231
|
}
|
|
3252
3232
|
}
|
|
3253
3233
|
}
|
|
3254
|
-
if (_revealUsed) this.
|
|
3234
|
+
if (_revealUsed) this.Tt?.evaluate();
|
|
3255
3235
|
}
|
|
3256
3236
|
}
|
|
3257
3237
|
function createCollectionBoundary(e, t, n, i) {
|
|
3258
3238
|
const r = createOwner();
|
|
3259
3239
|
if (_revealUsed) setContext(RevealControllerContext, null, r);
|
|
3260
3240
|
const s = new CollectionQueue(e);
|
|
3261
|
-
if (i) s.
|
|
3262
|
-
const o = (s.
|
|
3241
|
+
if (i) s.Pt = i;
|
|
3242
|
+
const o = (s.gt = createBoundChildren(r, t, s, e));
|
|
3263
3243
|
untrack(() => {
|
|
3264
3244
|
let t = false;
|
|
3265
3245
|
try {
|
|
@@ -3268,20 +3248,20 @@ function createCollectionBoundary(e, t, n, i) {
|
|
|
3268
3248
|
if (e instanceof NotReadyError) t = true;
|
|
3269
3249
|
else throw e;
|
|
3270
3250
|
}
|
|
3271
|
-
s.
|
|
3251
|
+
s.lt = t || !!(o.Se & e) || o.fe instanceof NotReadyError;
|
|
3272
3252
|
});
|
|
3273
3253
|
const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
|
|
3274
3254
|
if (u) {
|
|
3275
|
-
s.
|
|
3255
|
+
s.Tt = u;
|
|
3276
3256
|
u.register(s);
|
|
3277
3257
|
cleanup(() => u.unregister(s));
|
|
3278
3258
|
}
|
|
3279
3259
|
const c = computed(() => {
|
|
3280
|
-
if (!read(s.
|
|
3260
|
+
if (!read(s.ft)) {
|
|
3281
3261
|
const e = read(o);
|
|
3282
|
-
if (!untrack(() => read(s.
|
|
3262
|
+
if (!untrack(() => read(s.ft))) return (s.St = true), e;
|
|
3283
3263
|
}
|
|
3284
|
-
if (_revealUsed && read(s.
|
|
3264
|
+
if (_revealUsed && read(s.Et)) return undefined;
|
|
3285
3265
|
return n(s);
|
|
3286
3266
|
});
|
|
3287
3267
|
return accessor(c);
|
|
@@ -3291,10 +3271,10 @@ function createLoadingBoundary(e, t, n) {
|
|
|
3291
3271
|
}
|
|
3292
3272
|
function createErrorBoundary(e, t) {
|
|
3293
3273
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
3294
|
-
let n = e.
|
|
3295
|
-
const i = n.
|
|
3274
|
+
let n = e.ct.values().next().value;
|
|
3275
|
+
const i = n.fe?.cause ?? n.fe;
|
|
3296
3276
|
return t(i, () => {
|
|
3297
|
-
for (const t of e.
|
|
3277
|
+
for (const t of e.ct) recompute(t);
|
|
3298
3278
|
schedule();
|
|
3299
3279
|
});
|
|
3300
3280
|
});
|
|
@@ -3315,7 +3295,7 @@ function createRevealOrder(e, t) {
|
|
|
3315
3295
|
o.evaluate();
|
|
3316
3296
|
});
|
|
3317
3297
|
if (i) {
|
|
3318
|
-
o.
|
|
3298
|
+
o.dt = i;
|
|
3319
3299
|
i.register(o);
|
|
3320
3300
|
cleanup(() => i.unregister(o));
|
|
3321
3301
|
}
|
|
@@ -3371,6 +3351,7 @@ function flattenArray(e, t = [], n) {
|
|
|
3371
3351
|
if (i) throw i;
|
|
3372
3352
|
return r;
|
|
3373
3353
|
}
|
|
3354
|
+
const DEV = undefined;
|
|
3374
3355
|
export {
|
|
3375
3356
|
$PROXY,
|
|
3376
3357
|
$REFRESH,
|