@solidjs/signals 0.13.11 → 0.13.13
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 +323 -91
- package/dist/node.cjs +1150 -1139
- package/dist/prod.js +827 -810
- 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
|
@@ -103,12 +103,12 @@ function markNode(e, t = REACTIVE_DIRTY) {
|
|
|
103
103
|
const n = e.O;
|
|
104
104
|
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
105
105
|
e.O = (n & -4) | t;
|
|
106
|
-
for (let t = e.
|
|
106
|
+
for (let t = e.I; t !== null; t = t.h) {
|
|
107
107
|
markNode(t.p, REACTIVE_CHECK);
|
|
108
108
|
}
|
|
109
109
|
if (e.A !== null) {
|
|
110
110
|
for (let t = e.A; t !== null; t = t.N) {
|
|
111
|
-
for (let e = t.
|
|
111
|
+
for (let e = t.I; e !== null; e = e.h) {
|
|
112
112
|
markNode(e.p, REACTIVE_CHECK);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -136,53 +136,12 @@ function adjustHeight(e, t) {
|
|
|
136
136
|
}
|
|
137
137
|
if (e.o !== n) {
|
|
138
138
|
e.o = n;
|
|
139
|
-
for (let n = e.
|
|
139
|
+
for (let n = e.I; n !== null; n = n.h) {
|
|
140
140
|
insertIntoHeapHeight(n.p, 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,22 +156,22 @@ 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
|
}
|
|
207
166
|
}
|
|
208
167
|
function queueStashedOptimisticEffects(e) {
|
|
209
|
-
for (let t = e.
|
|
168
|
+
for (let t = e.I; t !== null; t = t.h) {
|
|
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.j = e;
|
|
188
|
+
e.$.push(...t.$);
|
|
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.Z) e.Z.add(n);
|
|
192
|
+
for (const [n, i] of t.B) {
|
|
193
|
+
let t = e.B.get(n);
|
|
194
|
+
if (!t) e.B.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
|
+
Z = 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.Z = 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.$.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.B.get(n);
|
|
370
|
+
if (!i) activeTransition.B.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
|
+
B: new Map(),
|
|
389
|
+
Y: [],
|
|
390
|
+
Z: new Set(),
|
|
391
|
+
$: [],
|
|
392
|
+
ae: { ie: [[], []], re: [] },
|
|
393
|
+
j: 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.Z !== activeTransition.Z) {
|
|
423
|
+
for (const e of this.Z) activeTransition.Z.add(e);
|
|
424
|
+
this.Z = activeTransition.Z;
|
|
465
425
|
}
|
|
466
426
|
}
|
|
467
427
|
}
|
|
468
428
|
function insertSubs(e, t = false) {
|
|
469
|
-
const n = e.
|
|
470
|
-
const i = e.
|
|
471
|
-
for (let r = e.
|
|
472
|
-
if (i && r.p.
|
|
429
|
+
const n = e.q || currentOptimisticLane;
|
|
430
|
+
const i = e.de !== undefined;
|
|
431
|
+
for (let r = e.I; r !== null; r = r.h) {
|
|
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.Z : globalQueue.Z;
|
|
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.Z.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.j) return true;
|
|
530
|
+
if (e.$.length) return false;
|
|
559
531
|
let t = true;
|
|
560
|
-
for (
|
|
561
|
-
|
|
562
|
-
|
|
532
|
+
for (const [n, i] of e.B) {
|
|
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.B.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.j = true);
|
|
583
563
|
return t;
|
|
584
564
|
}
|
|
585
565
|
function currentTransition(e) {
|
|
586
|
-
while (e.
|
|
566
|
+
while (e.j && typeof e.j === "object") e = e.j;
|
|
587
567
|
return e;
|
|
588
568
|
}
|
|
589
569
|
function setActiveTransition(e) {
|
|
@@ -605,73 +585,73 @@ 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, Ie: i };
|
|
611
591
|
signalLanes.set(e, t);
|
|
612
592
|
activeLanes.add(t);
|
|
613
|
-
e.
|
|
593
|
+
e.he = 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
635
|
if (n.Ie && findLane(n.Ie) === r) {
|
|
656
|
-
e.
|
|
636
|
+
e.q = t;
|
|
657
637
|
} else if (r.Ie && findLane(r.Ie) === 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
|
-
const i = e.
|
|
669
|
-
const r = e.
|
|
670
|
-
if (i !== null) i.
|
|
671
|
-
else t.
|
|
672
|
-
if (r !== null) r.
|
|
648
|
+
const i = e.h;
|
|
649
|
+
const r = e.pe;
|
|
650
|
+
if (i !== null) i.pe = r;
|
|
651
|
+
else t.Ae = r;
|
|
652
|
+
if (r !== null) r.h = i;
|
|
673
653
|
else {
|
|
674
|
-
t.
|
|
654
|
+
t.I = i;
|
|
675
655
|
if (i === null) {
|
|
676
656
|
t.Ne?.();
|
|
677
657
|
t.L && !t.Pe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
@@ -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.ge;
|
|
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.ge = 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.ge = e.Ae = { m: e, p: t, D: i, pe: s, h: null });
|
|
706
686
|
if (n !== null) n.D = o;
|
|
707
687
|
else t.C = o;
|
|
708
|
-
if (s !== null) s.
|
|
709
|
-
else e.
|
|
688
|
+
if (s !== null) s.h = o;
|
|
689
|
+
else e.I = o;
|
|
710
690
|
}
|
|
711
691
|
function isValidLink(e, t) {
|
|
712
|
-
const n = t.
|
|
692
|
+
const n = t.ge;
|
|
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.ge = 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.ge = 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,57 +834,57 @@ 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) {
|
|
905
|
-
for (let n = e.
|
|
885
|
+
for (let n = e.I; n !== null; n = n.h) t(n.p);
|
|
906
886
|
for (let n = e.A; n !== null; n = n.N) {
|
|
907
|
-
for (let e = n.
|
|
887
|
+
for (let e = n.I; e !== null; e = e.h) t(e.p);
|
|
908
888
|
}
|
|
909
889
|
}
|
|
910
890
|
function settlePendingSource(e) {
|
|
@@ -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,42 @@ 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));
|
|
946
|
+
const s = !!(e.Se & STATUS_UNINITIALIZED);
|
|
966
947
|
clearStatus(e);
|
|
967
|
-
const
|
|
968
|
-
if (
|
|
948
|
+
const o = resolveLane(e);
|
|
949
|
+
if (o) o.k.delete(e);
|
|
969
950
|
if (n) n(i);
|
|
970
|
-
else if (e.
|
|
971
|
-
if (e.
|
|
951
|
+
else if (e.ee !== undefined) {
|
|
952
|
+
if (e.ee !== undefined && e.ee !== NOT_PENDING) e.X = i;
|
|
972
953
|
else {
|
|
973
|
-
e.
|
|
954
|
+
e.J = i;
|
|
974
955
|
insertSubs(e);
|
|
975
956
|
}
|
|
976
|
-
e.
|
|
977
|
-
} else if (
|
|
978
|
-
const t = e.
|
|
979
|
-
const n = e.
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
e.
|
|
983
|
-
|
|
984
|
-
|
|
957
|
+
e.Ee = clock;
|
|
958
|
+
} else if (o) {
|
|
959
|
+
const t = e.W;
|
|
960
|
+
const n = e.J;
|
|
961
|
+
const r = e.ke;
|
|
962
|
+
if ((!t && s) || !r || !r(i, n)) {
|
|
963
|
+
e.J = i;
|
|
964
|
+
e.Ee = clock;
|
|
965
|
+
if (e.xe) {
|
|
966
|
+
setSignal(e.xe, i);
|
|
985
967
|
}
|
|
986
968
|
insertSubs(e, true);
|
|
987
969
|
}
|
|
@@ -1037,7 +1019,7 @@ function handleAsync(e, t, n) {
|
|
|
1037
1019
|
s = n;
|
|
1038
1020
|
u = true;
|
|
1039
1021
|
if (n.done) r = true;
|
|
1040
|
-
} else if (e.
|
|
1022
|
+
} else if (e.ye !== t) {
|
|
1041
1023
|
return;
|
|
1042
1024
|
} else if (!n.done) asyncWrite(n.value, iterate);
|
|
1043
1025
|
else {
|
|
@@ -1047,7 +1029,7 @@ function handleAsync(e, t, n) {
|
|
|
1047
1029
|
}
|
|
1048
1030
|
},
|
|
1049
1031
|
n => {
|
|
1050
|
-
if (!c && e.
|
|
1032
|
+
if (!c && e.ye === t) {
|
|
1051
1033
|
r = true;
|
|
1052
1034
|
handleError(n);
|
|
1053
1035
|
}
|
|
@@ -1071,28 +1053,28 @@ function handleAsync(e, t, n) {
|
|
|
1071
1053
|
}
|
|
1072
1054
|
function clearStatus(e, t = false) {
|
|
1073
1055
|
clearPendingSources(e);
|
|
1074
|
-
e.
|
|
1075
|
-
e.
|
|
1056
|
+
e.Ue = false;
|
|
1057
|
+
e.Se = t ? 0 : e.Se & STATUS_UNINITIALIZED;
|
|
1076
1058
|
setPendingError(e);
|
|
1077
1059
|
updatePendingSignal(e);
|
|
1078
|
-
e.
|
|
1060
|
+
e.Ge?.();
|
|
1079
1061
|
}
|
|
1080
1062
|
function notifyStatus(e, t, n, i, r) {
|
|
1081
1063
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
1082
1064
|
n = new StatusError(e, n);
|
|
1083
1065
|
const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
1084
1066
|
const o = s === e;
|
|
1085
|
-
const u = t === STATUS_PENDING && e.
|
|
1067
|
+
const u = t === STATUS_PENDING && e.ee !== undefined && !o;
|
|
1086
1068
|
const c = u && hasActiveOverride(e);
|
|
1087
1069
|
if (!i) {
|
|
1088
1070
|
if (t === STATUS_PENDING && s) {
|
|
1089
1071
|
addPendingSource(e, s);
|
|
1090
|
-
e.
|
|
1072
|
+
e.Se = STATUS_PENDING | (e.Se & STATUS_UNINITIALIZED);
|
|
1091
1073
|
setPendingError(e, s, n);
|
|
1092
1074
|
} else {
|
|
1093
1075
|
clearPendingSources(e);
|
|
1094
|
-
e.
|
|
1095
|
-
e.
|
|
1076
|
+
e.Se = t | (t !== STATUS_ERROR ? e.Se & STATUS_UNINITIALIZED : 0);
|
|
1077
|
+
e.fe = n;
|
|
1096
1078
|
}
|
|
1097
1079
|
updatePendingSignal(e);
|
|
1098
1080
|
}
|
|
@@ -1101,24 +1083,24 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
1101
1083
|
}
|
|
1102
1084
|
const a = i || c;
|
|
1103
1085
|
const l = i || u ? undefined : r;
|
|
1104
|
-
if (e.
|
|
1086
|
+
if (e.Ge) {
|
|
1105
1087
|
if (i && t === STATUS_PENDING) {
|
|
1106
1088
|
return;
|
|
1107
1089
|
}
|
|
1108
1090
|
if (a) {
|
|
1109
|
-
e.
|
|
1091
|
+
e.Ge(t, n);
|
|
1110
1092
|
} else {
|
|
1111
|
-
e.
|
|
1093
|
+
e.Ge();
|
|
1112
1094
|
}
|
|
1113
1095
|
return;
|
|
1114
1096
|
}
|
|
1115
1097
|
forEachDependent(e, e => {
|
|
1116
|
-
e.
|
|
1098
|
+
e.Ee = clock;
|
|
1117
1099
|
if (
|
|
1118
|
-
(t === STATUS_PENDING && s && e.
|
|
1119
|
-
(t !== STATUS_PENDING && (e.
|
|
1100
|
+
(t === STATUS_PENDING && s && e.Re !== s && !e.Oe?.has(s)) ||
|
|
1101
|
+
(t !== STATUS_PENDING && (e.fe !== n || e.Re || e.Oe))
|
|
1120
1102
|
) {
|
|
1121
|
-
if (!a && !e.
|
|
1103
|
+
if (!a && !e.K) globalQueue.se.push(e);
|
|
1122
1104
|
notifyStatus(e, t, n, a, l);
|
|
1123
1105
|
}
|
|
1124
1106
|
});
|
|
@@ -1146,8 +1128,8 @@ function enableExternalSource(e) {
|
|
|
1146
1128
|
externalSourceConfig = { factory: t, untrack: n };
|
|
1147
1129
|
}
|
|
1148
1130
|
}
|
|
1149
|
-
GlobalQueue.
|
|
1150
|
-
GlobalQueue.
|
|
1131
|
+
GlobalQueue.oe = recompute;
|
|
1132
|
+
GlobalQueue.ue = disposeChildren;
|
|
1151
1133
|
let tracking = false;
|
|
1152
1134
|
let stale = false;
|
|
1153
1135
|
let refreshing = false;
|
|
@@ -1160,7 +1142,7 @@ let snapshotCaptureActive = false;
|
|
|
1160
1142
|
let snapshotSources = null;
|
|
1161
1143
|
function ownerInSnapshotScope(e) {
|
|
1162
1144
|
while (e) {
|
|
1163
|
-
if (e.
|
|
1145
|
+
if (e.We) return true;
|
|
1164
1146
|
e = e.i;
|
|
1165
1147
|
}
|
|
1166
1148
|
return false;
|
|
@@ -1170,23 +1152,23 @@ function setSnapshotCapture(e) {
|
|
|
1170
1152
|
if (e && !snapshotSources) snapshotSources = new Set();
|
|
1171
1153
|
}
|
|
1172
1154
|
function markSnapshotScope(e) {
|
|
1173
|
-
e.
|
|
1155
|
+
e.We = true;
|
|
1174
1156
|
}
|
|
1175
1157
|
function releaseSnapshotScope(e) {
|
|
1176
|
-
e.
|
|
1158
|
+
e.We = false;
|
|
1177
1159
|
releaseSubtree(e);
|
|
1178
1160
|
schedule();
|
|
1179
1161
|
}
|
|
1180
1162
|
function releaseSubtree(e) {
|
|
1181
|
-
let t = e.
|
|
1163
|
+
let t = e.Ce;
|
|
1182
1164
|
while (t) {
|
|
1183
|
-
if (t.
|
|
1184
|
-
t = t.
|
|
1165
|
+
if (t.We) {
|
|
1166
|
+
t = t.De;
|
|
1185
1167
|
continue;
|
|
1186
1168
|
}
|
|
1187
1169
|
if (t.L) {
|
|
1188
1170
|
const e = t;
|
|
1189
|
-
e.
|
|
1171
|
+
e.Te = false;
|
|
1190
1172
|
if (e.O & REACTIVE_SNAPSHOT_STALE) {
|
|
1191
1173
|
e.O &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1192
1174
|
e.O |= REACTIVE_DIRTY;
|
|
@@ -1195,13 +1177,13 @@ function releaseSubtree(e) {
|
|
|
1195
1177
|
}
|
|
1196
1178
|
}
|
|
1197
1179
|
releaseSubtree(t);
|
|
1198
|
-
t = t.
|
|
1180
|
+
t = t.De;
|
|
1199
1181
|
}
|
|
1200
1182
|
}
|
|
1201
1183
|
function clearSnapshots() {
|
|
1202
1184
|
if (snapshotSources) {
|
|
1203
1185
|
for (const e of snapshotSources) {
|
|
1204
|
-
delete e.
|
|
1186
|
+
delete e.de;
|
|
1205
1187
|
delete e[STORE_SNAPSHOT_PROPS];
|
|
1206
1188
|
}
|
|
1207
1189
|
snapshotSources = null;
|
|
@@ -1209,103 +1191,104 @@ function clearSnapshots() {
|
|
|
1209
1191
|
snapshotCaptureActive = false;
|
|
1210
1192
|
}
|
|
1211
1193
|
function recompute(e, t = false) {
|
|
1212
|
-
const n = e.
|
|
1194
|
+
const n = e.W;
|
|
1213
1195
|
if (!t) {
|
|
1214
|
-
if (e.
|
|
1215
|
-
globalQueue.initTransition(e.
|
|
1196
|
+
if (e.K && (!n || activeTransition) && activeTransition !== e.K)
|
|
1197
|
+
globalQueue.initTransition(e.K);
|
|
1216
1198
|
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1217
|
-
e.
|
|
1218
|
-
if (e.
|
|
1199
|
+
e.ye = null;
|
|
1200
|
+
if (e.K || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1219
1201
|
else {
|
|
1220
1202
|
markDisposal(e);
|
|
1221
|
-
e.
|
|
1222
|
-
e.
|
|
1223
|
-
e.
|
|
1224
|
-
e.
|
|
1225
|
-
e.
|
|
1203
|
+
e.we = e.Ve;
|
|
1204
|
+
e.ve = e.Ce;
|
|
1205
|
+
e.Ve = null;
|
|
1206
|
+
e.Ce = null;
|
|
1207
|
+
e.me = 0;
|
|
1226
1208
|
}
|
|
1227
1209
|
}
|
|
1228
1210
|
const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1229
|
-
const r = e.
|
|
1230
|
-
const s = !!(e.
|
|
1231
|
-
const o =
|
|
1211
|
+
const r = e.ee !== undefined && e.ee !== NOT_PENDING;
|
|
1212
|
+
const s = !!(e.Se & STATUS_PENDING);
|
|
1213
|
+
const o = !!(e.Se & STATUS_UNINITIALIZED);
|
|
1214
|
+
const u = context;
|
|
1232
1215
|
context = e;
|
|
1233
|
-
e.
|
|
1216
|
+
e.ge = null;
|
|
1234
1217
|
e.O = REACTIVE_RECOMPUTING_DEPS;
|
|
1235
|
-
e.
|
|
1236
|
-
let
|
|
1237
|
-
let
|
|
1238
|
-
let
|
|
1239
|
-
let
|
|
1218
|
+
e.Ee = clock;
|
|
1219
|
+
let c = e.X === NOT_PENDING ? e.J : e.X;
|
|
1220
|
+
let a = e.o;
|
|
1221
|
+
let l = tracking;
|
|
1222
|
+
let f = currentOptimisticLane;
|
|
1240
1223
|
tracking = true;
|
|
1241
1224
|
if (i) {
|
|
1242
1225
|
const t = resolveLane(e);
|
|
1243
1226
|
if (t) currentOptimisticLane = t;
|
|
1244
1227
|
}
|
|
1245
1228
|
try {
|
|
1246
|
-
|
|
1229
|
+
c = handleAsync(e, e.L(c));
|
|
1247
1230
|
clearStatus(e, t);
|
|
1248
1231
|
const n = resolveLane(e);
|
|
1249
1232
|
if (n) {
|
|
1250
|
-
n.
|
|
1251
|
-
updatePendingSignal(n.
|
|
1233
|
+
n.k.delete(e);
|
|
1234
|
+
updatePendingSignal(n.te);
|
|
1252
1235
|
}
|
|
1253
1236
|
} catch (t) {
|
|
1254
1237
|
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
1255
1238
|
const t = findLane(currentOptimisticLane);
|
|
1256
|
-
if (t.
|
|
1257
|
-
t.
|
|
1258
|
-
e.
|
|
1259
|
-
updatePendingSignal(t.
|
|
1239
|
+
if (t.te !== e) {
|
|
1240
|
+
t.k.add(e);
|
|
1241
|
+
e.q = t;
|
|
1242
|
+
updatePendingSignal(t.te);
|
|
1260
1243
|
}
|
|
1261
1244
|
}
|
|
1262
|
-
if (t instanceof NotReadyError) e.
|
|
1245
|
+
if (t instanceof NotReadyError) e.Ue = true;
|
|
1263
1246
|
notifyStatus(
|
|
1264
1247
|
e,
|
|
1265
1248
|
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
1266
1249
|
t,
|
|
1267
1250
|
undefined,
|
|
1268
|
-
t instanceof NotReadyError ? e.
|
|
1251
|
+
t instanceof NotReadyError ? e.q : undefined
|
|
1269
1252
|
);
|
|
1270
1253
|
} finally {
|
|
1271
|
-
tracking =
|
|
1254
|
+
tracking = l;
|
|
1272
1255
|
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1273
|
-
context =
|
|
1256
|
+
context = u;
|
|
1274
1257
|
}
|
|
1275
|
-
if (!e.
|
|
1276
|
-
const
|
|
1277
|
-
let
|
|
1278
|
-
if (
|
|
1258
|
+
if (!e.fe) {
|
|
1259
|
+
const u = e.ge;
|
|
1260
|
+
let l = u !== null ? u.D : e.C;
|
|
1261
|
+
if (l !== null) {
|
|
1279
1262
|
do {
|
|
1280
|
-
|
|
1281
|
-
} while (
|
|
1282
|
-
if (
|
|
1263
|
+
l = unlinkSubs(l);
|
|
1264
|
+
} while (l !== null);
|
|
1265
|
+
if (u !== null) u.D = null;
|
|
1283
1266
|
else e.C = null;
|
|
1284
1267
|
}
|
|
1285
|
-
const
|
|
1286
|
-
const
|
|
1287
|
-
if (
|
|
1288
|
-
const o = r ? e.
|
|
1289
|
-
if (t || (n && activeTransition !== e.
|
|
1290
|
-
e.
|
|
1268
|
+
const f = r ? e.ee : e.X === NOT_PENDING ? e.J : e.X;
|
|
1269
|
+
const E = (!n && o) || !e.ke || !e.ke(f, c);
|
|
1270
|
+
if (E) {
|
|
1271
|
+
const o = r ? e.ee : undefined;
|
|
1272
|
+
if (t || (n && activeTransition !== e.K) || i) {
|
|
1273
|
+
e.J = c;
|
|
1291
1274
|
if (r && i) {
|
|
1292
|
-
e.
|
|
1293
|
-
e.
|
|
1275
|
+
e.ee = c;
|
|
1276
|
+
e.X = c;
|
|
1294
1277
|
}
|
|
1295
|
-
} else e.
|
|
1296
|
-
if (r && !i && s && !e.
|
|
1297
|
-
if (!r || i || e.
|
|
1278
|
+
} else e.X = c;
|
|
1279
|
+
if (r && !i && s && !e.he) e.ee = c;
|
|
1280
|
+
if (!r || i || e.ee !== o) insertSubs(e, i || r);
|
|
1298
1281
|
} else if (r) {
|
|
1299
|
-
e.
|
|
1300
|
-
} else if (e.o !=
|
|
1301
|
-
for (let t = e.
|
|
1282
|
+
e.X = c;
|
|
1283
|
+
} else if (e.o != a) {
|
|
1284
|
+
for (let t = e.I; t !== null; t = t.h) {
|
|
1302
1285
|
insertIntoHeapHeight(t.p, t.p.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1303
1286
|
}
|
|
1304
1287
|
}
|
|
1305
1288
|
}
|
|
1306
|
-
currentOptimisticLane =
|
|
1307
|
-
(!t || e.
|
|
1308
|
-
e.
|
|
1289
|
+
currentOptimisticLane = f;
|
|
1290
|
+
(!t || e.Se & STATUS_PENDING) && !e.K && !(activeTransition && r) && globalQueue.se.push(e);
|
|
1291
|
+
e.K && n && activeTransition !== e.K && runInTransition(e.K, () => recompute(e));
|
|
1309
1292
|
}
|
|
1310
1293
|
function updateIfNecessary(e) {
|
|
1311
1294
|
if (e.O & REACTIVE_CHECK) {
|
|
@@ -1320,7 +1303,7 @@ function updateIfNecessary(e) {
|
|
|
1320
1303
|
}
|
|
1321
1304
|
}
|
|
1322
1305
|
}
|
|
1323
|
-
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.
|
|
1306
|
+
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.fe && e.Ee < clock && !e.ye)) {
|
|
1324
1307
|
recompute(e);
|
|
1325
1308
|
}
|
|
1326
1309
|
e.O = e.O & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
|
|
@@ -1329,49 +1312,49 @@ function computed(e, t, n) {
|
|
|
1329
1312
|
const i = n?.transparent ?? false;
|
|
1330
1313
|
const r = {
|
|
1331
1314
|
id: n?.id ?? (i ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1315
|
+
be: i || undefined,
|
|
1316
|
+
ke: n?.equals != null ? n.equals : isEqual,
|
|
1317
|
+
le: !!n?.pureWrite,
|
|
1335
1318
|
Ne: n?.unobserved,
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1319
|
+
Ve: null,
|
|
1320
|
+
F: context?.F ?? globalQueue,
|
|
1321
|
+
Le: context?.Le ?? defaultContext,
|
|
1322
|
+
me: 0,
|
|
1340
1323
|
L: e,
|
|
1341
|
-
|
|
1324
|
+
J: t,
|
|
1342
1325
|
o: 0,
|
|
1343
1326
|
A: null,
|
|
1344
1327
|
S: undefined,
|
|
1345
1328
|
T: null,
|
|
1346
1329
|
C: null,
|
|
1347
|
-
Ce: null,
|
|
1348
|
-
h: null,
|
|
1349
1330
|
ge: null,
|
|
1331
|
+
I: null,
|
|
1332
|
+
Ae: null,
|
|
1350
1333
|
i: context,
|
|
1351
|
-
|
|
1352
|
-
|
|
1334
|
+
De: null,
|
|
1335
|
+
Ce: null,
|
|
1353
1336
|
O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1337
|
+
Se: STATUS_UNINITIALIZED,
|
|
1338
|
+
Ee: clock,
|
|
1339
|
+
X: NOT_PENDING,
|
|
1340
|
+
we: null,
|
|
1341
|
+
ve: null,
|
|
1358
1342
|
ye: null,
|
|
1359
|
-
|
|
1360
|
-
B: null
|
|
1343
|
+
K: null
|
|
1361
1344
|
};
|
|
1362
1345
|
r.T = r;
|
|
1363
1346
|
const s = context?.t ? context.u : context;
|
|
1364
1347
|
if (context) {
|
|
1365
|
-
const e = context.
|
|
1348
|
+
const e = context.Ce;
|
|
1366
1349
|
if (e === null) {
|
|
1367
|
-
context.
|
|
1350
|
+
context.Ce = r;
|
|
1368
1351
|
} else {
|
|
1369
|
-
r.
|
|
1370
|
-
context.
|
|
1352
|
+
r.De = e;
|
|
1353
|
+
context.Ce = r;
|
|
1371
1354
|
}
|
|
1372
1355
|
}
|
|
1373
1356
|
if (s) r.o = s.o + 1;
|
|
1374
|
-
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.
|
|
1357
|
+
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.Te = true;
|
|
1375
1358
|
if (externalSourceConfig) {
|
|
1376
1359
|
const e = signal(undefined, { equals: false, pureWrite: true });
|
|
1377
1360
|
const t = externalSourceConfig.factory(r.L, () => {
|
|
@@ -1385,8 +1368,8 @@ function computed(e, t, n) {
|
|
|
1385
1368
|
}
|
|
1386
1369
|
!n?.lazy && recompute(r, true);
|
|
1387
1370
|
if (snapshotCaptureActive && !n?.lazy) {
|
|
1388
|
-
if (!(r.
|
|
1389
|
-
r.
|
|
1371
|
+
if (!(r.Se & STATUS_PENDING)) {
|
|
1372
|
+
r.de = r.J === undefined ? NO_SNAPSHOT : r.J;
|
|
1390
1373
|
snapshotSources.add(r);
|
|
1391
1374
|
}
|
|
1392
1375
|
}
|
|
@@ -1394,33 +1377,33 @@ function computed(e, t, n) {
|
|
|
1394
1377
|
}
|
|
1395
1378
|
function signal(e, t, n = null) {
|
|
1396
1379
|
const i = {
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1380
|
+
ke: t?.equals != null ? t.equals : isEqual,
|
|
1381
|
+
le: !!t?.pureWrite,
|
|
1382
|
+
He: !!t?.He,
|
|
1400
1383
|
Ne: t?.unobserved,
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1384
|
+
J: e,
|
|
1385
|
+
I: null,
|
|
1386
|
+
Ae: null,
|
|
1387
|
+
Ee: clock,
|
|
1405
1388
|
V: n,
|
|
1406
1389
|
N: n?.A || null,
|
|
1407
|
-
|
|
1390
|
+
X: NOT_PENDING
|
|
1408
1391
|
};
|
|
1409
1392
|
n && (n.A = i);
|
|
1410
|
-
if (snapshotCaptureActive && !i.
|
|
1411
|
-
i.
|
|
1393
|
+
if (snapshotCaptureActive && !i.He && !((n?.Se ?? 0) & STATUS_PENDING)) {
|
|
1394
|
+
i.de = e === undefined ? NO_SNAPSHOT : e;
|
|
1412
1395
|
snapshotSources.add(i);
|
|
1413
1396
|
}
|
|
1414
1397
|
return i;
|
|
1415
1398
|
}
|
|
1416
1399
|
function optimisticSignal(e, t) {
|
|
1417
1400
|
const n = signal(e, t);
|
|
1418
|
-
n.
|
|
1401
|
+
n.ee = NOT_PENDING;
|
|
1419
1402
|
return n;
|
|
1420
1403
|
}
|
|
1421
1404
|
function optimisticComputed(e, t, n) {
|
|
1422
1405
|
const i = computed(e, t, n);
|
|
1423
|
-
i.
|
|
1406
|
+
i.ee = NOT_PENDING;
|
|
1424
1407
|
return i;
|
|
1425
1408
|
}
|
|
1426
1409
|
function isEqual(e, t) {
|
|
@@ -1442,7 +1425,7 @@ function read(e) {
|
|
|
1442
1425
|
const t = getLatestValueComputed(e);
|
|
1443
1426
|
const n = latestReadActive;
|
|
1444
1427
|
latestReadActive = false;
|
|
1445
|
-
const i = e.
|
|
1428
|
+
const i = e.ee !== undefined && e.ee !== NOT_PENDING ? e.ee : e.J;
|
|
1446
1429
|
let r;
|
|
1447
1430
|
try {
|
|
1448
1431
|
r = read(t);
|
|
@@ -1452,11 +1435,11 @@ function read(e) {
|
|
|
1452
1435
|
} finally {
|
|
1453
1436
|
latestReadActive = n;
|
|
1454
1437
|
}
|
|
1455
|
-
if (t.
|
|
1456
|
-
if (stale && currentOptimisticLane && t.
|
|
1457
|
-
const e = findLane(t.
|
|
1438
|
+
if (t.Se & STATUS_PENDING) return i;
|
|
1439
|
+
if (stale && currentOptimisticLane && t.q) {
|
|
1440
|
+
const e = findLane(t.q);
|
|
1458
1441
|
const n = findLane(currentOptimisticLane);
|
|
1459
|
-
if (e !== n && e.
|
|
1442
|
+
if (e !== n && e.k.size > 0) {
|
|
1460
1443
|
return i;
|
|
1461
1444
|
}
|
|
1462
1445
|
}
|
|
@@ -1466,8 +1449,8 @@ function read(e) {
|
|
|
1466
1449
|
const t = e.V;
|
|
1467
1450
|
const n = pendingCheckActive;
|
|
1468
1451
|
pendingCheckActive = false;
|
|
1469
|
-
if (t && e.
|
|
1470
|
-
if (e.
|
|
1452
|
+
if (t && e.ee !== undefined) {
|
|
1453
|
+
if (e.ee !== NOT_PENDING && (t.ye || !!(t.Se & STATUS_PENDING))) {
|
|
1471
1454
|
foundPending = true;
|
|
1472
1455
|
}
|
|
1473
1456
|
let n = context;
|
|
@@ -1480,7 +1463,7 @@ function read(e) {
|
|
|
1480
1463
|
if (t && read(getPendingSignal(t))) foundPending = true;
|
|
1481
1464
|
}
|
|
1482
1465
|
pendingCheckActive = n;
|
|
1483
|
-
return e.
|
|
1466
|
+
return e.J;
|
|
1484
1467
|
}
|
|
1485
1468
|
let t = context;
|
|
1486
1469
|
if (t?.t) t = t.u;
|
|
@@ -1506,60 +1489,60 @@ function read(e) {
|
|
|
1506
1489
|
}
|
|
1507
1490
|
}
|
|
1508
1491
|
}
|
|
1509
|
-
if (n.
|
|
1510
|
-
if (t && !(stale && n.
|
|
1492
|
+
if (n.Se & STATUS_PENDING) {
|
|
1493
|
+
if (t && !(stale && n.K && activeTransition !== n.K)) {
|
|
1511
1494
|
if (currentOptimisticLane) {
|
|
1512
|
-
const i = n.
|
|
1495
|
+
const i = n.q;
|
|
1513
1496
|
const r = findLane(currentOptimisticLane);
|
|
1514
1497
|
if (i && findLane(i) === r && !hasActiveOverride(n)) {
|
|
1515
1498
|
if (!tracking && e !== t) link(e, t);
|
|
1516
|
-
throw n.
|
|
1499
|
+
throw n.fe;
|
|
1517
1500
|
}
|
|
1518
1501
|
} else {
|
|
1519
1502
|
if (!tracking && e !== t) link(e, t);
|
|
1520
|
-
throw n.
|
|
1503
|
+
throw n.fe;
|
|
1521
1504
|
}
|
|
1522
|
-
} else if (t && n !== e && n.
|
|
1505
|
+
} else if (t && n !== e && n.Se & STATUS_UNINITIALIZED) {
|
|
1523
1506
|
if (!tracking && e !== t) link(e, t);
|
|
1524
|
-
throw n.
|
|
1525
|
-
} else if (!t && n.
|
|
1526
|
-
throw n.
|
|
1507
|
+
throw n.fe;
|
|
1508
|
+
} else if (!t && n.Se & STATUS_UNINITIALIZED) {
|
|
1509
|
+
throw n.fe;
|
|
1527
1510
|
}
|
|
1528
1511
|
}
|
|
1529
|
-
if (e.L && e.
|
|
1530
|
-
if (e.
|
|
1512
|
+
if (e.L && e.Se & STATUS_ERROR) {
|
|
1513
|
+
if (e.Ee < clock) {
|
|
1531
1514
|
recompute(e);
|
|
1532
1515
|
return read(e);
|
|
1533
|
-
} else throw e.
|
|
1516
|
+
} else throw e.fe;
|
|
1534
1517
|
}
|
|
1535
|
-
if (snapshotCaptureActive && t && t.
|
|
1536
|
-
const n = e.
|
|
1518
|
+
if (snapshotCaptureActive && t && t.Te) {
|
|
1519
|
+
const n = e.de;
|
|
1537
1520
|
if (n !== undefined) {
|
|
1538
1521
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1539
|
-
const r = e.
|
|
1522
|
+
const r = e.X !== NOT_PENDING ? e.X : e.J;
|
|
1540
1523
|
if (r !== i) t.O |= REACTIVE_SNAPSHOT_STALE;
|
|
1541
1524
|
return i;
|
|
1542
1525
|
}
|
|
1543
1526
|
}
|
|
1544
|
-
if (e.
|
|
1545
|
-
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.
|
|
1546
|
-
return e.
|
|
1527
|
+
if (e.ee !== undefined && e.ee !== NOT_PENDING) {
|
|
1528
|
+
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.J;
|
|
1529
|
+
return e.ee;
|
|
1547
1530
|
}
|
|
1548
1531
|
return !t ||
|
|
1549
1532
|
(currentOptimisticLane !== null &&
|
|
1550
|
-
(e.
|
|
1551
|
-
e.
|
|
1552
|
-
(stale && e.
|
|
1553
|
-
? e.
|
|
1554
|
-
: e.
|
|
1533
|
+
(e.ee !== undefined || e.q || (n === e && stale) || !!(n.Se & STATUS_PENDING))) ||
|
|
1534
|
+
e.X === NOT_PENDING ||
|
|
1535
|
+
(stale && e.K && activeTransition !== e.K)
|
|
1536
|
+
? e.J
|
|
1537
|
+
: e.X;
|
|
1555
1538
|
}
|
|
1556
1539
|
function setSignal(e, t) {
|
|
1557
|
-
if (e.
|
|
1558
|
-
const n = e.
|
|
1559
|
-
const i = e.
|
|
1560
|
-
const r = n ? (i ? e.
|
|
1540
|
+
if (e.K && activeTransition !== e.K) globalQueue.initTransition(e.K);
|
|
1541
|
+
const n = e.ee !== undefined && !projectionWriteActive;
|
|
1542
|
+
const i = e.ee !== undefined && e.ee !== NOT_PENDING;
|
|
1543
|
+
const r = n ? (i ? e.ee : e.J) : e.X === NOT_PENDING ? e.J : e.X;
|
|
1561
1544
|
if (typeof t === "function") t = t(r);
|
|
1562
|
-
const s = !e.
|
|
1545
|
+
const s = !e.ke || !e.ke(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
|
|
1563
1546
|
if (!s) {
|
|
1564
1547
|
if (n && i && e.L) {
|
|
1565
1548
|
insertSubs(e, true);
|
|
@@ -1568,25 +1551,25 @@ function setSignal(e, t) {
|
|
|
1568
1551
|
return t;
|
|
1569
1552
|
}
|
|
1570
1553
|
if (n) {
|
|
1571
|
-
const n = e.
|
|
1554
|
+
const n = e.ee === NOT_PENDING;
|
|
1572
1555
|
if (!n) globalQueue.initTransition(resolveTransition(e));
|
|
1573
1556
|
if (n) {
|
|
1574
|
-
e.
|
|
1575
|
-
globalQueue.
|
|
1557
|
+
e.X = e.J;
|
|
1558
|
+
globalQueue.Y.push(e);
|
|
1576
1559
|
}
|
|
1577
|
-
e.
|
|
1560
|
+
e.he = true;
|
|
1578
1561
|
const i = getOrCreateLane(e);
|
|
1579
|
-
e.
|
|
1580
|
-
e.
|
|
1562
|
+
e.q = i;
|
|
1563
|
+
e.ee = t;
|
|
1581
1564
|
} else {
|
|
1582
|
-
if (e.
|
|
1583
|
-
e.
|
|
1565
|
+
if (e.X === NOT_PENDING) globalQueue.se.push(e);
|
|
1566
|
+
e.X = t;
|
|
1584
1567
|
}
|
|
1585
1568
|
updatePendingSignal(e);
|
|
1586
|
-
if (e.
|
|
1587
|
-
setSignal(e.
|
|
1569
|
+
if (e.xe) {
|
|
1570
|
+
setSignal(e.xe, t);
|
|
1588
1571
|
}
|
|
1589
|
-
e.
|
|
1572
|
+
e.Ee = clock;
|
|
1590
1573
|
insertSubs(e, n);
|
|
1591
1574
|
schedule();
|
|
1592
1575
|
return t;
|
|
@@ -1604,68 +1587,68 @@ function runWithOwner(e, t) {
|
|
|
1604
1587
|
}
|
|
1605
1588
|
}
|
|
1606
1589
|
function getPendingSignal(e) {
|
|
1607
|
-
if (!e.
|
|
1608
|
-
e.
|
|
1609
|
-
if (e.
|
|
1610
|
-
e.
|
|
1590
|
+
if (!e.Fe) {
|
|
1591
|
+
e.Fe = optimisticSignal(false, { pureWrite: true });
|
|
1592
|
+
if (e._e) {
|
|
1593
|
+
e.Fe._e = e;
|
|
1611
1594
|
}
|
|
1612
|
-
if (computePendingState(e)) setSignal(e.
|
|
1595
|
+
if (computePendingState(e)) setSignal(e.Fe, true);
|
|
1613
1596
|
}
|
|
1614
|
-
return e.
|
|
1597
|
+
return e.Fe;
|
|
1615
1598
|
}
|
|
1616
1599
|
function computePendingState(e) {
|
|
1617
1600
|
const t = e;
|
|
1618
1601
|
const n = e.V;
|
|
1619
|
-
if (n && e.
|
|
1620
|
-
return !n.
|
|
1602
|
+
if (n && e.X !== NOT_PENDING) {
|
|
1603
|
+
return !n.ye && !(n.Se & STATUS_PENDING);
|
|
1621
1604
|
}
|
|
1622
|
-
if (e.
|
|
1623
|
-
if (t.
|
|
1624
|
-
if (e.
|
|
1625
|
-
const t = e.
|
|
1626
|
-
return !!(t && t.
|
|
1605
|
+
if (e.ee !== undefined && e.ee !== NOT_PENDING) {
|
|
1606
|
+
if (t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
|
|
1607
|
+
if (e._e) {
|
|
1608
|
+
const t = e.q ? findLane(e.q) : null;
|
|
1609
|
+
return !!(t && t.k.size > 0);
|
|
1627
1610
|
}
|
|
1628
1611
|
return true;
|
|
1629
1612
|
}
|
|
1630
|
-
if (e.
|
|
1613
|
+
if (e.ee !== undefined && e.ee === NOT_PENDING && !e._e) {
|
|
1631
1614
|
return false;
|
|
1632
1615
|
}
|
|
1633
|
-
if (e.
|
|
1634
|
-
return !!(t.
|
|
1616
|
+
if (e.X !== NOT_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
|
|
1617
|
+
return !!(t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED));
|
|
1635
1618
|
}
|
|
1636
1619
|
function updatePendingSignal(e) {
|
|
1637
|
-
if (e.
|
|
1620
|
+
if (e.Fe) {
|
|
1638
1621
|
const t = computePendingState(e);
|
|
1639
|
-
const n = e.
|
|
1622
|
+
const n = e.Fe;
|
|
1640
1623
|
setSignal(n, t);
|
|
1641
|
-
if (!t && n.
|
|
1624
|
+
if (!t && n.q) {
|
|
1642
1625
|
const t = resolveLane(e);
|
|
1643
|
-
if (t && t.
|
|
1644
|
-
const e = findLane(n.
|
|
1626
|
+
if (t && t.k.size > 0) {
|
|
1627
|
+
const e = findLane(n.q);
|
|
1645
1628
|
if (e !== t) {
|
|
1646
1629
|
mergeLanes(t, e);
|
|
1647
1630
|
}
|
|
1648
1631
|
}
|
|
1649
1632
|
signalLanes.delete(n);
|
|
1650
|
-
n.
|
|
1633
|
+
n.q = undefined;
|
|
1651
1634
|
}
|
|
1652
1635
|
}
|
|
1653
1636
|
}
|
|
1654
1637
|
function getLatestValueComputed(e) {
|
|
1655
|
-
if (!e.
|
|
1638
|
+
if (!e.xe) {
|
|
1656
1639
|
const t = latestReadActive;
|
|
1657
1640
|
latestReadActive = false;
|
|
1658
1641
|
const n = pendingCheckActive;
|
|
1659
1642
|
pendingCheckActive = false;
|
|
1660
1643
|
const i = context;
|
|
1661
1644
|
context = null;
|
|
1662
|
-
e.
|
|
1663
|
-
e.
|
|
1645
|
+
e.xe = optimisticComputed(() => read(e));
|
|
1646
|
+
e.xe._e = e;
|
|
1664
1647
|
context = i;
|
|
1665
1648
|
pendingCheckActive = n;
|
|
1666
1649
|
latestReadActive = t;
|
|
1667
1650
|
}
|
|
1668
|
-
return e.
|
|
1651
|
+
return e.xe;
|
|
1669
1652
|
}
|
|
1670
1653
|
function staleValues(e, t = true) {
|
|
1671
1654
|
const n = stale;
|
|
@@ -1726,7 +1709,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1726
1709
|
if (!t) {
|
|
1727
1710
|
throw new NoOwnerError();
|
|
1728
1711
|
}
|
|
1729
|
-
const n = hasContext(e, t) ? t.
|
|
1712
|
+
const n = hasContext(e, t) ? t.Le[e.id] : e.defaultValue;
|
|
1730
1713
|
if (isUndefined(n)) {
|
|
1731
1714
|
throw new ContextNotFoundError();
|
|
1732
1715
|
}
|
|
@@ -1736,10 +1719,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1736
1719
|
if (!n) {
|
|
1737
1720
|
throw new NoOwnerError();
|
|
1738
1721
|
}
|
|
1739
|
-
n.
|
|
1722
|
+
n.Le = { ...n.Le, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1740
1723
|
}
|
|
1741
1724
|
function hasContext(e, t) {
|
|
1742
|
-
return !isUndefined(t?.
|
|
1725
|
+
return !isUndefined(t?.Le[e.id]);
|
|
1743
1726
|
}
|
|
1744
1727
|
function isUndefined(e) {
|
|
1745
1728
|
return typeof e === "undefined";
|
|
@@ -1749,96 +1732,96 @@ function effect(e, t, n, i, r) {
|
|
|
1749
1732
|
const o = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
1750
1733
|
...r,
|
|
1751
1734
|
equals: () => {
|
|
1752
|
-
o
|
|
1753
|
-
if (s) o.
|
|
1735
|
+
o.H = !o.fe;
|
|
1736
|
+
if (s) o.F.enqueue(o.W, runEffect.bind(o));
|
|
1754
1737
|
return false;
|
|
1755
1738
|
},
|
|
1756
1739
|
lazy: true
|
|
1757
1740
|
});
|
|
1758
|
-
o.
|
|
1759
|
-
o
|
|
1741
|
+
o.Qe = i;
|
|
1742
|
+
o.Me = t;
|
|
1760
1743
|
o.je = n;
|
|
1761
|
-
o
|
|
1762
|
-
o.
|
|
1763
|
-
o.
|
|
1764
|
-
const n = e !== undefined ? e : o.
|
|
1765
|
-
const i = t !== undefined ? t : o.
|
|
1744
|
+
o.$e = undefined;
|
|
1745
|
+
o.W = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
1746
|
+
o.Ge = (e, t) => {
|
|
1747
|
+
const n = e !== undefined ? e : o.Se;
|
|
1748
|
+
const i = t !== undefined ? t : o.fe;
|
|
1766
1749
|
if (n & STATUS_ERROR) {
|
|
1767
1750
|
let e = i;
|
|
1768
|
-
o.
|
|
1769
|
-
if (o.
|
|
1751
|
+
o.F.notify(o, STATUS_PENDING, 0);
|
|
1752
|
+
if (o.W === EFFECT_USER) {
|
|
1770
1753
|
try {
|
|
1771
1754
|
return o.je
|
|
1772
1755
|
? o.je(e, () => {
|
|
1773
|
-
o
|
|
1774
|
-
o
|
|
1756
|
+
o.$e?.();
|
|
1757
|
+
o.$e = undefined;
|
|
1775
1758
|
})
|
|
1776
1759
|
: console.error(e);
|
|
1777
1760
|
} catch (t) {
|
|
1778
1761
|
e = t;
|
|
1779
1762
|
}
|
|
1780
1763
|
}
|
|
1781
|
-
if (!o.
|
|
1782
|
-
} else if (o.
|
|
1783
|
-
o.
|
|
1764
|
+
if (!o.F.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1765
|
+
} else if (o.W === EFFECT_RENDER) {
|
|
1766
|
+
o.F.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
1784
1767
|
}
|
|
1785
1768
|
};
|
|
1786
1769
|
recompute(o, true);
|
|
1787
|
-
!r?.defer && (o.
|
|
1770
|
+
!r?.defer && (o.W === EFFECT_USER ? o.F.enqueue(o.W, runEffect.bind(o)) : runEffect.call(o));
|
|
1788
1771
|
s = true;
|
|
1789
|
-
cleanup(() => o
|
|
1772
|
+
cleanup(() => o.$e?.());
|
|
1790
1773
|
}
|
|
1791
1774
|
function runEffect() {
|
|
1792
|
-
if (!this
|
|
1793
|
-
this
|
|
1794
|
-
this
|
|
1775
|
+
if (!this.H || this.O & REACTIVE_DISPOSED) return;
|
|
1776
|
+
this.$e?.();
|
|
1777
|
+
this.$e = undefined;
|
|
1795
1778
|
try {
|
|
1796
|
-
const e = this
|
|
1779
|
+
const e = this.Me(this.J, this.Qe);
|
|
1797
1780
|
if (false && e !== undefined && typeof e !== "function");
|
|
1798
|
-
this
|
|
1781
|
+
this.$e = e;
|
|
1799
1782
|
} catch (e) {
|
|
1800
|
-
this.
|
|
1801
|
-
this.
|
|
1802
|
-
if (!this.
|
|
1783
|
+
this.fe = new StatusError(this, e);
|
|
1784
|
+
this.Se |= STATUS_ERROR;
|
|
1785
|
+
if (!this.F.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1803
1786
|
} finally {
|
|
1804
|
-
this.
|
|
1805
|
-
this
|
|
1787
|
+
this.Qe = this.J;
|
|
1788
|
+
this.H = false;
|
|
1806
1789
|
}
|
|
1807
1790
|
}
|
|
1808
1791
|
function trackedEffect(e, t) {
|
|
1809
1792
|
const run = () => {
|
|
1810
|
-
if (!n
|
|
1793
|
+
if (!n.H || n.O & REACTIVE_DISPOSED) return;
|
|
1811
1794
|
try {
|
|
1812
|
-
n
|
|
1795
|
+
n.H = false;
|
|
1813
1796
|
recompute(n);
|
|
1814
1797
|
} finally {
|
|
1815
1798
|
}
|
|
1816
1799
|
};
|
|
1817
1800
|
const n = computed(
|
|
1818
1801
|
() => {
|
|
1819
|
-
n
|
|
1820
|
-
n
|
|
1802
|
+
n.$e?.();
|
|
1803
|
+
n.$e = undefined;
|
|
1821
1804
|
const t = staleValues(e);
|
|
1822
|
-
n
|
|
1805
|
+
n.$e = t;
|
|
1823
1806
|
},
|
|
1824
1807
|
undefined,
|
|
1825
1808
|
{ ...t, lazy: true }
|
|
1826
1809
|
);
|
|
1827
|
-
n
|
|
1828
|
-
n.
|
|
1829
|
-
n
|
|
1830
|
-
n.
|
|
1831
|
-
n.
|
|
1832
|
-
const i = e !== undefined ? e : n.
|
|
1810
|
+
n.$e = undefined;
|
|
1811
|
+
n.Ke = true;
|
|
1812
|
+
n.H = true;
|
|
1813
|
+
n.W = EFFECT_TRACKED;
|
|
1814
|
+
n.Ge = (e, t) => {
|
|
1815
|
+
const i = e !== undefined ? e : n.Se;
|
|
1833
1816
|
if (i & STATUS_ERROR) {
|
|
1834
|
-
n.
|
|
1835
|
-
const e = t !== undefined ? t : n.
|
|
1836
|
-
if (!n.
|
|
1817
|
+
n.F.notify(n, STATUS_PENDING, 0);
|
|
1818
|
+
const e = t !== undefined ? t : n.fe;
|
|
1819
|
+
if (!n.F.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1837
1820
|
}
|
|
1838
1821
|
};
|
|
1839
|
-
n.
|
|
1840
|
-
n.
|
|
1841
|
-
cleanup(() => n
|
|
1822
|
+
n.M = run;
|
|
1823
|
+
n.F.enqueue(EFFECT_USER, run);
|
|
1824
|
+
cleanup(() => n.$e?.());
|
|
1842
1825
|
}
|
|
1843
1826
|
function restoreTransition(e, t) {
|
|
1844
1827
|
globalQueue.initTransition(e);
|
|
@@ -1852,11 +1835,11 @@ function action(e) {
|
|
|
1852
1835
|
const r = e(...t);
|
|
1853
1836
|
globalQueue.initTransition();
|
|
1854
1837
|
let s = activeTransition;
|
|
1855
|
-
s
|
|
1838
|
+
s.$.push(r);
|
|
1856
1839
|
const done = (e, t) => {
|
|
1857
1840
|
s = currentTransition(s);
|
|
1858
|
-
const o = s
|
|
1859
|
-
if (o >= 0) s
|
|
1841
|
+
const o = s.$.indexOf(r);
|
|
1842
|
+
if (o >= 0) s.$.splice(o, 1);
|
|
1860
1843
|
setActiveTransition(s);
|
|
1861
1844
|
schedule();
|
|
1862
1845
|
t ? i(t) : n(e);
|
|
@@ -1960,7 +1943,7 @@ function createOptimistic(e, t, n) {
|
|
|
1960
1943
|
}
|
|
1961
1944
|
function onSettled(e) {
|
|
1962
1945
|
const t = getOwner();
|
|
1963
|
-
t && !t.
|
|
1946
|
+
t && !t.Ke
|
|
1964
1947
|
? createTrackedEffect(() => untrack(e), undefined)
|
|
1965
1948
|
: globalQueue.enqueue(EFFECT_USER, () => {
|
|
1966
1949
|
const t = e();
|
|
@@ -2130,7 +2113,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2130
2113
|
let r;
|
|
2131
2114
|
const o = new Proxy(
|
|
2132
2115
|
s,
|
|
2133
|
-
createWriteTraps(() => !i || t.
|
|
2116
|
+
createWriteTraps(() => !i || t.ye === r)
|
|
2134
2117
|
);
|
|
2135
2118
|
storeSetter(o, o => {
|
|
2136
2119
|
r = e(o);
|
|
@@ -2262,11 +2245,11 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
|
2262
2245
|
i
|
|
2263
2246
|
);
|
|
2264
2247
|
if (s) {
|
|
2265
|
-
u.
|
|
2248
|
+
u.ee = NOT_PENDING;
|
|
2266
2249
|
}
|
|
2267
2250
|
if (o && t in o) {
|
|
2268
2251
|
const e = o[t];
|
|
2269
|
-
u.
|
|
2252
|
+
u.de = e === undefined ? NO_SNAPSHOT : e;
|
|
2270
2253
|
snapshotSources?.add(u);
|
|
2271
2254
|
}
|
|
2272
2255
|
return (e[t] = u);
|
|
@@ -2289,12 +2272,54 @@ function getKeys(e, t, n = true) {
|
|
|
2289
2272
|
return Array.from(r);
|
|
2290
2273
|
}
|
|
2291
2274
|
function getPropertyDescriptor(e, t, n) {
|
|
2292
|
-
let i = e;
|
|
2293
2275
|
if (t && n in t) {
|
|
2294
|
-
if (
|
|
2295
|
-
|
|
2276
|
+
if (t[n] === $DELETED) return void 0;
|
|
2277
|
+
const i = Reflect.getOwnPropertyDescriptor(t, n);
|
|
2278
|
+
if (i?.get || i?.set || !(n in e)) return i;
|
|
2279
|
+
}
|
|
2280
|
+
return Reflect.getOwnPropertyDescriptor(e, n);
|
|
2281
|
+
}
|
|
2282
|
+
function prepareStoreWrite(e, t, n) {
|
|
2283
|
+
if (e[STORE_OPTIMISTIC]) {
|
|
2284
|
+
const t = e[STORE_FIREWALL];
|
|
2285
|
+
if (t?.K) {
|
|
2286
|
+
globalQueue.initTransition(t.K);
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
const i = e[STORE_VALUE];
|
|
2290
|
+
const r = i[n];
|
|
2291
|
+
if (
|
|
2292
|
+
snapshotCaptureActive &&
|
|
2293
|
+
typeof n !== "symbol" &&
|
|
2294
|
+
!((e[STORE_FIREWALL]?.Se ?? 0) & STATUS_PENDING)
|
|
2295
|
+
) {
|
|
2296
|
+
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2297
|
+
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
2298
|
+
snapshotSources?.add(e);
|
|
2299
|
+
}
|
|
2300
|
+
if (!(n in e[STORE_SNAPSHOT_PROPS])) {
|
|
2301
|
+
e[STORE_SNAPSHOT_PROPS][n] = r;
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
const s = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
2305
|
+
const o = s ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
2306
|
+
if (s) trackOptimisticStore(t);
|
|
2307
|
+
return { base: r, overrideKey: o, state: i };
|
|
2308
|
+
}
|
|
2309
|
+
function notifyStoreProperty(e, t, n, i) {
|
|
2310
|
+
if (e[STORE_HAS]?.[t]) setSignal(e[STORE_HAS][t], n !== "delete");
|
|
2311
|
+
const r = getNodes(e, STORE_NODE);
|
|
2312
|
+
if (n === "set") {
|
|
2313
|
+
r[t] && setSignal(r[t], () => (isWrappable(i) ? wrap(i, e) : i));
|
|
2314
|
+
} else if (n === "invalidate") {
|
|
2315
|
+
if (r[t]) {
|
|
2316
|
+
setSignal(r[t], {});
|
|
2317
|
+
delete r[t];
|
|
2318
|
+
}
|
|
2319
|
+
} else {
|
|
2320
|
+
r[t] && setSignal(r[t], undefined);
|
|
2296
2321
|
}
|
|
2297
|
-
|
|
2322
|
+
r[$TRACK] && setSignal(r[$TRACK], undefined);
|
|
2298
2323
|
}
|
|
2299
2324
|
let Writing = null;
|
|
2300
2325
|
const storeTraps = {
|
|
@@ -2323,11 +2348,11 @@ const storeTraps = {
|
|
|
2323
2348
|
if (writeOnly(n)) {
|
|
2324
2349
|
let n =
|
|
2325
2350
|
r && (o || !u)
|
|
2326
|
-
? r.
|
|
2327
|
-
? r.
|
|
2328
|
-
: r.
|
|
2329
|
-
? r.
|
|
2330
|
-
: r.
|
|
2351
|
+
? r.ee !== undefined && r.ee !== NOT_PENDING
|
|
2352
|
+
? r.ee
|
|
2353
|
+
: r.X !== NOT_PENDING
|
|
2354
|
+
? r.X
|
|
2355
|
+
: r.J
|
|
2331
2356
|
: c[t];
|
|
2332
2357
|
n === $DELETED && (n = undefined);
|
|
2333
2358
|
if (!isWrappable(n)) return n;
|
|
@@ -2380,64 +2405,51 @@ const storeTraps = {
|
|
|
2380
2405
|
set(e, t, n) {
|
|
2381
2406
|
const i = e[$PROXY];
|
|
2382
2407
|
if (writeOnly(i)) {
|
|
2383
|
-
if (e[STORE_OPTIMISTIC]) {
|
|
2384
|
-
const t = e[STORE_FIREWALL];
|
|
2385
|
-
if (t?.B) {
|
|
2386
|
-
globalQueue.initTransition(t.B);
|
|
2387
|
-
}
|
|
2388
|
-
}
|
|
2389
2408
|
untrack(() => {
|
|
2390
|
-
const r = e
|
|
2391
|
-
const
|
|
2392
|
-
if (
|
|
2393
|
-
snapshotCaptureActive &&
|
|
2394
|
-
typeof t !== "symbol" &&
|
|
2395
|
-
!((e[STORE_FIREWALL]?._e ?? 0) & STATUS_PENDING)
|
|
2396
|
-
) {
|
|
2397
|
-
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2398
|
-
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
2399
|
-
snapshotSources?.add(e);
|
|
2400
|
-
}
|
|
2401
|
-
if (!(t in e[STORE_SNAPSHOT_PROPS])) {
|
|
2402
|
-
e[STORE_SNAPSHOT_PROPS][t] = s;
|
|
2403
|
-
}
|
|
2404
|
-
}
|
|
2405
|
-
const o = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
2406
|
-
const u = o ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
2407
|
-
if (o) trackOptimisticStore(i);
|
|
2408
|
-
const c =
|
|
2409
|
+
const { base: r, overrideKey: s, state: o } = prepareStoreWrite(e, i, t);
|
|
2410
|
+
const u =
|
|
2409
2411
|
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2410
2412
|
? e[STORE_OPTIMISTIC_OVERRIDE][t]
|
|
2411
2413
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2412
2414
|
? e[STORE_OVERRIDE][t]
|
|
2413
|
-
:
|
|
2414
|
-
const
|
|
2415
|
-
const
|
|
2416
|
-
const
|
|
2417
|
-
const
|
|
2418
|
-
|
|
2415
|
+
: r;
|
|
2416
|
+
const c = n?.[$TARGET]?.[STORE_VALUE] ?? n;
|
|
2417
|
+
const a = Array.isArray(o) && t !== "length";
|
|
2418
|
+
const l = a ? parseInt(t) + 1 : 0;
|
|
2419
|
+
const f =
|
|
2420
|
+
a &&
|
|
2419
2421
|
(e[STORE_OPTIMISTIC_OVERRIDE] && "length" in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2420
2422
|
? e[STORE_OPTIMISTIC_OVERRIDE].length
|
|
2421
2423
|
: e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
|
|
2422
2424
|
? e[STORE_OVERRIDE].length
|
|
2423
|
-
:
|
|
2424
|
-
const
|
|
2425
|
-
if (
|
|
2426
|
-
if (
|
|
2425
|
+
: o.length);
|
|
2426
|
+
const E = a && l > f ? l : undefined;
|
|
2427
|
+
if (u === c && E === undefined) return true;
|
|
2428
|
+
if (c !== undefined && c === r && E === undefined) delete e[s]?.[t];
|
|
2427
2429
|
else {
|
|
2428
|
-
const n = e[
|
|
2429
|
-
n[t] =
|
|
2430
|
-
if (
|
|
2430
|
+
const n = e[s] || (e[s] = Object.create(null));
|
|
2431
|
+
n[t] = c;
|
|
2432
|
+
if (E !== undefined) n.length = E;
|
|
2431
2433
|
}
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
const e = t === "length" ? a : d;
|
|
2438
|
-
e !== undefined && S.length && setSignal(S.length, e);
|
|
2434
|
+
notifyStoreProperty(e, t, "set", c);
|
|
2435
|
+
if (Array.isArray(o)) {
|
|
2436
|
+
const n = getNodes(e, STORE_NODE);
|
|
2437
|
+
const i = t === "length" ? c : E;
|
|
2438
|
+
i !== undefined && n.length && setSignal(n.length, i);
|
|
2439
2439
|
}
|
|
2440
|
-
|
|
2440
|
+
if (false);
|
|
2441
|
+
});
|
|
2442
|
+
}
|
|
2443
|
+
return true;
|
|
2444
|
+
},
|
|
2445
|
+
defineProperty(e, t, n) {
|
|
2446
|
+
const i = e[$PROXY];
|
|
2447
|
+
if (writeOnly(i)) {
|
|
2448
|
+
untrack(() => {
|
|
2449
|
+
const { base: r, overrideKey: s } = prepareStoreWrite(e, i, t);
|
|
2450
|
+
const o = "value" in n ? { ...n, value: n.value?.[$TARGET]?.[STORE_VALUE] ?? n.value } : n;
|
|
2451
|
+
Object.defineProperty(e[s] || (e[s] = Object.create(null)), t, o);
|
|
2452
|
+
notifyStoreProperty(e, t, "invalidate");
|
|
2441
2453
|
if (false);
|
|
2442
2454
|
});
|
|
2443
2455
|
}
|
|
@@ -2462,10 +2474,7 @@ const storeTraps = {
|
|
|
2462
2474
|
} else if (e[i] && t in e[i]) {
|
|
2463
2475
|
delete e[i][t];
|
|
2464
2476
|
} else return true;
|
|
2465
|
-
|
|
2466
|
-
const s = getNodes(e, STORE_NODE);
|
|
2467
|
-
s[t] && setSignal(s[t], undefined);
|
|
2468
|
-
s[$TRACK] && setSignal(s[$TRACK], undefined);
|
|
2477
|
+
notifyStoreProperty(e, t, "delete");
|
|
2469
2478
|
});
|
|
2470
2479
|
}
|
|
2471
2480
|
return true;
|
|
@@ -2487,9 +2496,11 @@ const storeTraps = {
|
|
|
2487
2496
|
if (t === $PROXY) return { value: e[$PROXY], writable: true, configurable: true };
|
|
2488
2497
|
if (e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]) {
|
|
2489
2498
|
if (e[STORE_OPTIMISTIC_OVERRIDE][t] === $DELETED) return undefined;
|
|
2490
|
-
const n =
|
|
2491
|
-
if (n)
|
|
2492
|
-
|
|
2499
|
+
const n = Reflect.getOwnPropertyDescriptor(e[STORE_OPTIMISTIC_OVERRIDE], t);
|
|
2500
|
+
if (n?.get || n?.set || !(t in e[STORE_VALUE])) return n;
|
|
2501
|
+
const i = getPropertyDescriptor(e[STORE_VALUE], e[STORE_OVERRIDE], t);
|
|
2502
|
+
if (i) {
|
|
2503
|
+
return { ...i, value: e[STORE_OPTIMISTIC_OVERRIDE][t] };
|
|
2493
2504
|
}
|
|
2494
2505
|
return {
|
|
2495
2506
|
value: e[STORE_OPTIMISTIC_OVERRIDE][t],
|
|
@@ -2533,7 +2544,7 @@ function createStore(e, t, n) {
|
|
|
2533
2544
|
return [r, e => storeSetter(r, e)];
|
|
2534
2545
|
}
|
|
2535
2546
|
function createOptimisticStore(e, t, n) {
|
|
2536
|
-
GlobalQueue.
|
|
2547
|
+
GlobalQueue.ce ||= clearOptimisticStore;
|
|
2537
2548
|
const i = typeof e === "function";
|
|
2538
2549
|
const r = (i ? t : e) ?? {};
|
|
2539
2550
|
const s = i ? e : undefined;
|
|
@@ -2550,7 +2561,7 @@ function clearOptimisticStore(e) {
|
|
|
2550
2561
|
if (i) {
|
|
2551
2562
|
for (const e of Reflect.ownKeys(n)) {
|
|
2552
2563
|
if (i[e]) {
|
|
2553
|
-
i[e].
|
|
2564
|
+
i[e].q = undefined;
|
|
2554
2565
|
const n =
|
|
2555
2566
|
t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
|
|
2556
2567
|
const r = n === $DELETED ? undefined : n;
|
|
@@ -2558,7 +2569,7 @@ function clearOptimisticStore(e) {
|
|
|
2558
2569
|
}
|
|
2559
2570
|
}
|
|
2560
2571
|
if (i[$TRACK]) {
|
|
2561
|
-
i[$TRACK].
|
|
2572
|
+
i[$TRACK].q = undefined;
|
|
2562
2573
|
setSignal(i[$TRACK], undefined);
|
|
2563
2574
|
}
|
|
2564
2575
|
}
|
|
@@ -2596,7 +2607,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2596
2607
|
let r;
|
|
2597
2608
|
const o = new Proxy(
|
|
2598
2609
|
s,
|
|
2599
|
-
createWriteTraps(() => !i || t.
|
|
2610
|
+
createWriteTraps(() => !i || t.ye === r)
|
|
2600
2611
|
);
|
|
2601
2612
|
setProjectionWriteActive(true);
|
|
2602
2613
|
try {
|
|
@@ -2670,7 +2681,12 @@ function updatePath(e, t, n = 0) {
|
|
|
2670
2681
|
} else if (i === undefined || (isWrappable(r) && isWrappable(s) && !Array.isArray(s))) {
|
|
2671
2682
|
const t = i !== undefined ? e[i] : e;
|
|
2672
2683
|
const n = Object.keys(s);
|
|
2673
|
-
for (let e = 0; e < n.length; e++)
|
|
2684
|
+
for (let e = 0; e < n.length; e++) {
|
|
2685
|
+
const i = n[e];
|
|
2686
|
+
const r = Object.getOwnPropertyDescriptor(s, i);
|
|
2687
|
+
if (r.get || r.set) Object.defineProperty(t, i, r);
|
|
2688
|
+
else t[i] = r.value;
|
|
2689
|
+
}
|
|
2674
2690
|
} else {
|
|
2675
2691
|
e[i] = s;
|
|
2676
2692
|
}
|
|
@@ -2874,65 +2890,65 @@ function mapArray(e, t, n) {
|
|
|
2874
2890
|
const s = t;
|
|
2875
2891
|
return createMemo(
|
|
2876
2892
|
updateKeyedMap.bind({
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2893
|
+
Ye: createOwner(),
|
|
2894
|
+
Ze: 0,
|
|
2895
|
+
Be: e,
|
|
2896
|
+
qe: [],
|
|
2881
2897
|
Xe: s,
|
|
2898
|
+
ze: [],
|
|
2882
2899
|
Je: [],
|
|
2883
|
-
et:
|
|
2884
|
-
tt: i,
|
|
2885
|
-
nt:
|
|
2886
|
-
it:
|
|
2887
|
-
rt: n?.fallback
|
|
2900
|
+
et: i,
|
|
2901
|
+
tt: i || n?.keyed === false ? [] : undefined,
|
|
2902
|
+
nt: r ? [] : undefined,
|
|
2903
|
+
it: n?.fallback
|
|
2888
2904
|
})
|
|
2889
2905
|
);
|
|
2890
2906
|
}
|
|
2891
2907
|
const pureOptions = { pureWrite: true };
|
|
2892
2908
|
function updateKeyedMap() {
|
|
2893
|
-
const e = this.
|
|
2909
|
+
const e = this.Be() || [],
|
|
2894
2910
|
t = e.length;
|
|
2895
2911
|
e[$TRACK];
|
|
2896
|
-
runWithOwner(this.
|
|
2912
|
+
runWithOwner(this.Ye, () => {
|
|
2897
2913
|
let n,
|
|
2898
2914
|
i,
|
|
2899
|
-
r = this.
|
|
2915
|
+
r = this.tt
|
|
2900
2916
|
? () => {
|
|
2901
|
-
this.
|
|
2902
|
-
this.
|
|
2903
|
-
return this.Xe(accessor(this.
|
|
2917
|
+
this.tt[i] = signal(e[i], pureOptions);
|
|
2918
|
+
this.nt && (this.nt[i] = signal(i, pureOptions));
|
|
2919
|
+
return this.Xe(accessor(this.tt[i]), this.nt ? accessor(this.nt[i]) : undefined);
|
|
2904
2920
|
}
|
|
2905
|
-
: this.
|
|
2921
|
+
: this.nt
|
|
2906
2922
|
? () => {
|
|
2907
2923
|
const t = e[i];
|
|
2908
|
-
this.
|
|
2909
|
-
return this.Xe(() => t, accessor(this.
|
|
2924
|
+
this.nt[i] = signal(i, pureOptions);
|
|
2925
|
+
return this.Xe(() => t, accessor(this.nt[i]));
|
|
2910
2926
|
}
|
|
2911
2927
|
: () => {
|
|
2912
2928
|
const t = e[i];
|
|
2913
2929
|
return this.Xe(() => t);
|
|
2914
2930
|
};
|
|
2915
2931
|
if (t === 0) {
|
|
2916
|
-
if (this.
|
|
2917
|
-
this.
|
|
2918
|
-
this.et = [];
|
|
2919
|
-
this.ze = [];
|
|
2932
|
+
if (this.Ze !== 0) {
|
|
2933
|
+
this.Ye.dispose(false);
|
|
2920
2934
|
this.Je = [];
|
|
2921
|
-
this.
|
|
2935
|
+
this.qe = [];
|
|
2936
|
+
this.ze = [];
|
|
2937
|
+
this.Ze = 0;
|
|
2938
|
+
this.tt && (this.tt = []);
|
|
2922
2939
|
this.nt && (this.nt = []);
|
|
2923
|
-
this.it && (this.it = []);
|
|
2924
2940
|
}
|
|
2925
|
-
if (this.
|
|
2926
|
-
this.
|
|
2941
|
+
if (this.it && !this.ze[0]) {
|
|
2942
|
+
this.ze[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
|
|
2927
2943
|
}
|
|
2928
|
-
} else if (this.
|
|
2929
|
-
if (this.
|
|
2930
|
-
this.
|
|
2944
|
+
} else if (this.Ze === 0) {
|
|
2945
|
+
if (this.Je[0]) this.Je[0].dispose();
|
|
2946
|
+
this.ze = new Array(t);
|
|
2931
2947
|
for (i = 0; i < t; i++) {
|
|
2932
|
-
this.
|
|
2933
|
-
this.
|
|
2948
|
+
this.qe[i] = e[i];
|
|
2949
|
+
this.ze[i] = runWithOwner((this.Je[i] = createOwner()), r);
|
|
2934
2950
|
}
|
|
2935
|
-
this.
|
|
2951
|
+
this.Ze = t;
|
|
2936
2952
|
} else {
|
|
2937
2953
|
let s,
|
|
2938
2954
|
o,
|
|
@@ -2943,152 +2959,152 @@ function updateKeyedMap() {
|
|
|
2943
2959
|
f,
|
|
2944
2960
|
E = new Array(t),
|
|
2945
2961
|
d = new Array(t),
|
|
2946
|
-
T = this.
|
|
2947
|
-
S = this.
|
|
2962
|
+
T = this.tt ? new Array(t) : undefined,
|
|
2963
|
+
S = this.nt ? new Array(t) : undefined;
|
|
2948
2964
|
for (
|
|
2949
|
-
s = 0, o = Math.min(this.
|
|
2950
|
-
s < o && (this.
|
|
2965
|
+
s = 0, o = Math.min(this.Ze, t);
|
|
2966
|
+
s < o && (this.qe[s] === e[s] || (this.tt && compare(this.et, this.qe[s], e[s])));
|
|
2951
2967
|
s++
|
|
2952
2968
|
) {
|
|
2953
|
-
if (this.
|
|
2969
|
+
if (this.tt) setSignal(this.tt[s], e[s]);
|
|
2954
2970
|
}
|
|
2955
2971
|
for (
|
|
2956
|
-
o = this.
|
|
2972
|
+
o = this.Ze - 1, u = t - 1;
|
|
2957
2973
|
o >= s &&
|
|
2958
2974
|
u >= s &&
|
|
2959
|
-
(this.
|
|
2975
|
+
(this.qe[o] === e[u] || (this.tt && compare(this.et, this.qe[o], e[u])));
|
|
2960
2976
|
o--, u--
|
|
2961
2977
|
) {
|
|
2962
|
-
E[u] = this.
|
|
2963
|
-
d[u] = this.
|
|
2964
|
-
T && (T[u] = this.
|
|
2965
|
-
S && (S[u] = this.
|
|
2978
|
+
E[u] = this.ze[o];
|
|
2979
|
+
d[u] = this.Je[o];
|
|
2980
|
+
T && (T[u] = this.tt[o]);
|
|
2981
|
+
S && (S[u] = this.nt[o]);
|
|
2966
2982
|
}
|
|
2967
2983
|
l = new Map();
|
|
2968
2984
|
f = new Array(u + 1);
|
|
2969
2985
|
for (i = u; i >= s; i--) {
|
|
2970
2986
|
c = e[i];
|
|
2971
|
-
a = this.
|
|
2987
|
+
a = this.et ? this.et(c) : c;
|
|
2972
2988
|
n = l.get(a);
|
|
2973
2989
|
f[i] = n === undefined ? -1 : n;
|
|
2974
2990
|
l.set(a, i);
|
|
2975
2991
|
}
|
|
2976
2992
|
for (n = s; n <= o; n++) {
|
|
2977
|
-
c = this.
|
|
2978
|
-
a = this.
|
|
2993
|
+
c = this.qe[n];
|
|
2994
|
+
a = this.et ? this.et(c) : c;
|
|
2979
2995
|
i = l.get(a);
|
|
2980
2996
|
if (i !== undefined && i !== -1) {
|
|
2981
|
-
E[i] = this.
|
|
2982
|
-
d[i] = this.
|
|
2983
|
-
T && (T[i] = this.
|
|
2984
|
-
S && (S[i] = this.
|
|
2997
|
+
E[i] = this.ze[n];
|
|
2998
|
+
d[i] = this.Je[n];
|
|
2999
|
+
T && (T[i] = this.tt[n]);
|
|
3000
|
+
S && (S[i] = this.nt[n]);
|
|
2985
3001
|
i = f[i];
|
|
2986
3002
|
l.set(a, i);
|
|
2987
|
-
} else this.
|
|
3003
|
+
} else this.Je[n].dispose();
|
|
2988
3004
|
}
|
|
2989
3005
|
for (i = s; i < t; i++) {
|
|
2990
3006
|
if (i in E) {
|
|
2991
|
-
this.
|
|
2992
|
-
this.
|
|
3007
|
+
this.ze[i] = E[i];
|
|
3008
|
+
this.Je[i] = d[i];
|
|
2993
3009
|
if (T) {
|
|
2994
|
-
this.
|
|
2995
|
-
setSignal(this.
|
|
3010
|
+
this.tt[i] = T[i];
|
|
3011
|
+
setSignal(this.tt[i], e[i]);
|
|
2996
3012
|
}
|
|
2997
3013
|
if (S) {
|
|
2998
|
-
this.
|
|
2999
|
-
setSignal(this.
|
|
3014
|
+
this.nt[i] = S[i];
|
|
3015
|
+
setSignal(this.nt[i], i);
|
|
3000
3016
|
}
|
|
3001
3017
|
} else {
|
|
3002
|
-
this.
|
|
3018
|
+
this.ze[i] = runWithOwner((this.Je[i] = createOwner()), r);
|
|
3003
3019
|
}
|
|
3004
3020
|
}
|
|
3005
|
-
this.
|
|
3006
|
-
this.
|
|
3021
|
+
this.ze = this.ze.slice(0, (this.Ze = t));
|
|
3022
|
+
this.qe = e.slice(0);
|
|
3007
3023
|
}
|
|
3008
3024
|
});
|
|
3009
|
-
return this.
|
|
3025
|
+
return this.ze;
|
|
3010
3026
|
}
|
|
3011
3027
|
function repeat(e, t, n) {
|
|
3012
3028
|
const i = t;
|
|
3013
3029
|
return updateRepeat.bind({
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3030
|
+
Ye: createOwner(),
|
|
3031
|
+
Ze: 0,
|
|
3032
|
+
rt: 0,
|
|
3033
|
+
st: e,
|
|
3018
3034
|
Xe: i,
|
|
3019
|
-
et: [],
|
|
3020
3035
|
Je: [],
|
|
3021
|
-
|
|
3022
|
-
|
|
3036
|
+
ze: [],
|
|
3037
|
+
ot: n?.from,
|
|
3038
|
+
it: n?.fallback
|
|
3023
3039
|
});
|
|
3024
3040
|
}
|
|
3025
3041
|
function updateRepeat() {
|
|
3026
|
-
const e = this.
|
|
3027
|
-
const t = this.
|
|
3028
|
-
runWithOwner(this.
|
|
3042
|
+
const e = this.st();
|
|
3043
|
+
const t = this.ot?.() || 0;
|
|
3044
|
+
runWithOwner(this.Ye, () => {
|
|
3029
3045
|
if (e === 0) {
|
|
3030
|
-
if (this.
|
|
3031
|
-
this.
|
|
3032
|
-
this.et = [];
|
|
3046
|
+
if (this.Ze !== 0) {
|
|
3047
|
+
this.Ye.dispose(false);
|
|
3033
3048
|
this.Je = [];
|
|
3034
|
-
this.
|
|
3049
|
+
this.ze = [];
|
|
3050
|
+
this.Ze = 0;
|
|
3035
3051
|
}
|
|
3036
|
-
if (this.
|
|
3037
|
-
this.
|
|
3052
|
+
if (this.it && !this.ze[0]) {
|
|
3053
|
+
this.ze[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
|
|
3038
3054
|
}
|
|
3039
3055
|
return;
|
|
3040
3056
|
}
|
|
3041
3057
|
const n = t + e;
|
|
3042
|
-
const i = this.
|
|
3043
|
-
if (this.
|
|
3044
|
-
for (let e = n; e < i; e++) this.
|
|
3045
|
-
if (this.
|
|
3046
|
-
let e = this.
|
|
3047
|
-
while (e < t && e < this.
|
|
3048
|
-
this.
|
|
3049
|
-
this.
|
|
3050
|
-
} else if (this.
|
|
3051
|
-
let n = i - this.
|
|
3052
|
-
let r = this.
|
|
3053
|
-
this.
|
|
3058
|
+
const i = this.rt + this.Ze;
|
|
3059
|
+
if (this.Ze === 0 && this.Je[0]) this.Je[0].dispose();
|
|
3060
|
+
for (let e = n; e < i; e++) this.Je[e - this.rt].dispose();
|
|
3061
|
+
if (this.rt < t) {
|
|
3062
|
+
let e = this.rt;
|
|
3063
|
+
while (e < t && e < this.Ze) this.Je[e++].dispose();
|
|
3064
|
+
this.Je.splice(0, t - this.rt);
|
|
3065
|
+
this.ze.splice(0, t - this.rt);
|
|
3066
|
+
} else if (this.rt > t) {
|
|
3067
|
+
let n = i - this.rt - 1;
|
|
3068
|
+
let r = this.rt - t;
|
|
3069
|
+
this.Je.length = this.ze.length = e;
|
|
3054
3070
|
while (n >= r) {
|
|
3055
|
-
this.et[n] = this.et[n - r];
|
|
3056
3071
|
this.Je[n] = this.Je[n - r];
|
|
3072
|
+
this.ze[n] = this.ze[n - r];
|
|
3057
3073
|
n--;
|
|
3058
3074
|
}
|
|
3059
3075
|
for (let e = 0; e < r; e++) {
|
|
3060
|
-
this.
|
|
3076
|
+
this.ze[e] = runWithOwner((this.Je[e] = createOwner()), () => this.Xe(e + t));
|
|
3061
3077
|
}
|
|
3062
3078
|
}
|
|
3063
3079
|
for (let e = i; e < n; e++) {
|
|
3064
|
-
this.
|
|
3080
|
+
this.ze[e - t] = runWithOwner((this.Je[e - t] = createOwner()), () => this.Xe(e));
|
|
3065
3081
|
}
|
|
3066
|
-
this.
|
|
3067
|
-
this.
|
|
3068
|
-
this.
|
|
3082
|
+
this.ze = this.ze.slice(0, e);
|
|
3083
|
+
this.rt = t;
|
|
3084
|
+
this.Ze = e;
|
|
3069
3085
|
});
|
|
3070
|
-
return this.
|
|
3086
|
+
return this.ze;
|
|
3071
3087
|
}
|
|
3072
3088
|
function compare(e, t, n) {
|
|
3073
3089
|
return e ? e(t) === e(n) : true;
|
|
3074
3090
|
}
|
|
3075
3091
|
function boundaryComputed(e, t) {
|
|
3076
3092
|
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.
|
|
3093
|
+
n.Ge = (e, t) => {
|
|
3094
|
+
const i = e !== undefined ? e : n.Se;
|
|
3095
|
+
const r = t !== undefined ? t : n.fe;
|
|
3096
|
+
n.Se &= ~n.ut;
|
|
3097
|
+
n.F.notify(n, n.ut, i, r);
|
|
3082
3098
|
};
|
|
3083
|
-
n.
|
|
3099
|
+
n.ut = t;
|
|
3084
3100
|
n.Pe = true;
|
|
3085
3101
|
recompute(n, true);
|
|
3086
3102
|
return n;
|
|
3087
3103
|
}
|
|
3088
3104
|
function createBoundChildren(e, t, n, i) {
|
|
3089
|
-
const r = e.
|
|
3090
|
-
r.addChild((e.
|
|
3091
|
-
cleanup(() => r.removeChild(e.
|
|
3105
|
+
const r = e.F;
|
|
3106
|
+
r.addChild((e.F = n));
|
|
3107
|
+
cleanup(() => r.removeChild(e.F));
|
|
3092
3108
|
return runWithOwner(e, () => {
|
|
3093
3109
|
const e = computed(t);
|
|
3094
3110
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
@@ -3102,68 +3118,68 @@ function isRevealController(e) {
|
|
|
3102
3118
|
return e instanceof RevealController;
|
|
3103
3119
|
}
|
|
3104
3120
|
function isSlotReady(e) {
|
|
3105
|
-
return isRevealController(e) ? e.isReady() : e.
|
|
3121
|
+
return isRevealController(e) ? e.isReady() : e.ct.size === 0 && !e.lt;
|
|
3106
3122
|
}
|
|
3107
3123
|
function setSlotState(e, t, n, i) {
|
|
3108
|
-
setSignal(e.
|
|
3109
|
-
setSignal(e.
|
|
3124
|
+
setSignal(e.ft, n);
|
|
3125
|
+
setSignal(e.Et, i);
|
|
3110
3126
|
if (isRevealController(e)) {
|
|
3111
|
-
if (!n && e.
|
|
3127
|
+
if (!n && e.dt === t) e.dt = undefined;
|
|
3112
3128
|
return e.evaluate(n, i);
|
|
3113
3129
|
}
|
|
3114
|
-
if (!n && e.
|
|
3130
|
+
if (!n && e.Tt === t && e.St) e.Tt = undefined;
|
|
3115
3131
|
}
|
|
3116
3132
|
class RevealController {
|
|
3133
|
+
Rt;
|
|
3117
3134
|
Ot;
|
|
3118
|
-
_t;
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
Et = signal(false, { pureWrite: true,
|
|
3122
|
-
dt = signal(false, { pureWrite: true, Fe: true });
|
|
3135
|
+
_t = [];
|
|
3136
|
+
dt;
|
|
3137
|
+
ft = signal(false, { pureWrite: true, He: true });
|
|
3138
|
+
Et = signal(false, { pureWrite: true, He: true });
|
|
3123
3139
|
It = true;
|
|
3124
|
-
|
|
3140
|
+
ht = false;
|
|
3125
3141
|
constructor(e, t) {
|
|
3126
|
-
this.
|
|
3127
|
-
this.
|
|
3142
|
+
this.Rt = e;
|
|
3143
|
+
this.Ot = t;
|
|
3128
3144
|
}
|
|
3129
|
-
|
|
3130
|
-
for (let t = 0; t < this.
|
|
3131
|
-
const n = this.
|
|
3132
|
-
if ((isRevealController(n) ? n.
|
|
3145
|
+
At(e) {
|
|
3146
|
+
for (let t = 0; t < this._t.length; t++) {
|
|
3147
|
+
const n = this._t[t];
|
|
3148
|
+
if ((isRevealController(n) ? n.dt : n.Tt) !== this) continue;
|
|
3133
3149
|
if (e(n) === false) return false;
|
|
3134
3150
|
}
|
|
3135
3151
|
return true;
|
|
3136
3152
|
}
|
|
3137
3153
|
isReady() {
|
|
3138
|
-
return this.
|
|
3154
|
+
return this.At(isSlotReady);
|
|
3139
3155
|
}
|
|
3140
3156
|
register(e) {
|
|
3141
|
-
if (this.
|
|
3142
|
-
this.
|
|
3143
|
-
const t = !!untrack(this.
|
|
3144
|
-
setSignal(e.
|
|
3157
|
+
if (this._t.includes(e)) return;
|
|
3158
|
+
this._t.push(e);
|
|
3159
|
+
const t = !!untrack(this.Rt);
|
|
3160
|
+
setSignal(e.ft, true), setSignal(e.Et, t ? false : !!untrack(this.Ot));
|
|
3145
3161
|
untrack(() => this.evaluate());
|
|
3146
3162
|
}
|
|
3147
3163
|
unregister(e) {
|
|
3148
|
-
const t = this.
|
|
3149
|
-
if (t >= 0) this.
|
|
3164
|
+
const t = this._t.indexOf(e);
|
|
3165
|
+
if (t >= 0) this._t.splice(t, 1);
|
|
3150
3166
|
untrack(() => this.evaluate());
|
|
3151
3167
|
}
|
|
3152
3168
|
evaluate(e, t) {
|
|
3153
|
-
if (this.
|
|
3154
|
-
this.
|
|
3169
|
+
if (this.ht) return;
|
|
3170
|
+
this.ht = true;
|
|
3155
3171
|
const n = this.It;
|
|
3156
3172
|
try {
|
|
3157
|
-
const n = e ?? read(this.
|
|
3158
|
-
i = !!untrack(this.
|
|
3173
|
+
const n = e ?? read(this.ft),
|
|
3174
|
+
i = !!untrack(this.Ot),
|
|
3159
3175
|
r = t ?? i;
|
|
3160
|
-
if (n && r) this.
|
|
3161
|
-
else if (!!untrack(this.
|
|
3176
|
+
if (n && r) this.At(e => setSlotState(e, this, true, true));
|
|
3177
|
+
else if (!!untrack(this.Rt)) {
|
|
3162
3178
|
const e = this.isReady();
|
|
3163
|
-
this.
|
|
3179
|
+
this.At(t => setSlotState(t, this, !e, false));
|
|
3164
3180
|
} else {
|
|
3165
3181
|
let e = false;
|
|
3166
|
-
this.
|
|
3182
|
+
this.At(t => {
|
|
3167
3183
|
if (e) return setSlotState(t, this, true, i);
|
|
3168
3184
|
if (isSlotReady(t)) return setSlotState(t, this, false, false);
|
|
3169
3185
|
e = true;
|
|
@@ -3172,93 +3188,93 @@ class RevealController {
|
|
|
3172
3188
|
}
|
|
3173
3189
|
} finally {
|
|
3174
3190
|
this.It = this.isReady();
|
|
3175
|
-
this.
|
|
3191
|
+
this.ht = false;
|
|
3176
3192
|
}
|
|
3177
|
-
if (this.
|
|
3193
|
+
if (this.dt && n !== this.It) this.dt.evaluate();
|
|
3178
3194
|
}
|
|
3179
3195
|
}
|
|
3180
3196
|
class CollectionQueue extends Queue {
|
|
3181
3197
|
Nt;
|
|
3182
|
-
|
|
3198
|
+
ct = new Set();
|
|
3183
3199
|
Pt;
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3200
|
+
lt = true;
|
|
3201
|
+
ft = signal(false, { pureWrite: true, He: true });
|
|
3202
|
+
Et = signal(false, { pureWrite: true, He: true });
|
|
3203
|
+
Tt;
|
|
3204
|
+
St = false;
|
|
3205
|
+
gt;
|
|
3206
|
+
Ct = ON_INIT;
|
|
3191
3207
|
constructor(e) {
|
|
3192
3208
|
super();
|
|
3193
3209
|
this.Nt = e;
|
|
3194
3210
|
}
|
|
3195
3211
|
run(e) {
|
|
3196
|
-
if (!e || (read(this.
|
|
3212
|
+
if (!e || (read(this.ft) && (!_revealUsed || read(this.Et)))) return;
|
|
3197
3213
|
return super.run(e);
|
|
3198
3214
|
}
|
|
3199
3215
|
notify(e, t, n, i) {
|
|
3200
3216
|
if (!(t & this.Nt)) return super.notify(e, t, n, i);
|
|
3201
|
-
if (this.
|
|
3217
|
+
if (this.St && this.gt) {
|
|
3202
3218
|
const e = untrack(() => {
|
|
3203
3219
|
try {
|
|
3204
|
-
return this.
|
|
3220
|
+
return this.gt();
|
|
3205
3221
|
} catch {
|
|
3206
3222
|
return ON_INIT;
|
|
3207
3223
|
}
|
|
3208
3224
|
});
|
|
3209
|
-
if (e !== this.
|
|
3210
|
-
this.
|
|
3211
|
-
this.
|
|
3212
|
-
this.
|
|
3225
|
+
if (e !== this.Ct) {
|
|
3226
|
+
this.Ct = e;
|
|
3227
|
+
this.St = false;
|
|
3228
|
+
this.ct.clear();
|
|
3213
3229
|
}
|
|
3214
3230
|
}
|
|
3215
|
-
if (this.Nt & STATUS_PENDING && this.
|
|
3231
|
+
if (this.Nt & STATUS_PENDING && this.St) return super.notify(e, t, n, i);
|
|
3216
3232
|
if (this.Nt & STATUS_PENDING && n & STATUS_ERROR) {
|
|
3217
3233
|
return super.notify(e, STATUS_ERROR, n, i);
|
|
3218
3234
|
}
|
|
3219
3235
|
if (n & this.Nt) {
|
|
3220
|
-
this.
|
|
3221
|
-
const t = i?.source || e.
|
|
3236
|
+
this.lt = true;
|
|
3237
|
+
const t = i?.source || e.fe?.source;
|
|
3222
3238
|
if (t) {
|
|
3223
|
-
const e = this.
|
|
3224
|
-
this.
|
|
3225
|
-
if (e) setSignal(this.
|
|
3239
|
+
const e = this.ct.size === 0;
|
|
3240
|
+
this.ct.add(t);
|
|
3241
|
+
if (e) setSignal(this.ft, true);
|
|
3226
3242
|
}
|
|
3227
3243
|
}
|
|
3228
3244
|
t &= ~this.Nt;
|
|
3229
3245
|
return t ? super.notify(e, t, n, i) : true;
|
|
3230
3246
|
}
|
|
3231
3247
|
checkSources() {
|
|
3232
|
-
for (const e of this.
|
|
3248
|
+
for (const e of this.ct) {
|
|
3233
3249
|
if (
|
|
3234
3250
|
e.O & REACTIVE_DISPOSED ||
|
|
3235
|
-
(!(e.
|
|
3251
|
+
(!(e.Se & this.Nt) && !(this.Nt & STATUS_ERROR && e.Se & STATUS_PENDING))
|
|
3236
3252
|
)
|
|
3237
|
-
this.
|
|
3253
|
+
this.ct.delete(e);
|
|
3238
3254
|
}
|
|
3239
|
-
if (!this.
|
|
3240
|
-
if (this.Nt & STATUS_PENDING && this.
|
|
3241
|
-
this.
|
|
3255
|
+
if (!this.ct.size) {
|
|
3256
|
+
if (this.Nt & STATUS_PENDING && this.lt && !this.St && this.Pt) {
|
|
3257
|
+
this.lt = !!(this.Pt.Se & this.Nt);
|
|
3242
3258
|
} else {
|
|
3243
|
-
this.
|
|
3259
|
+
this.lt = false;
|
|
3244
3260
|
}
|
|
3245
|
-
if (!this.
|
|
3246
|
-
setSignal(this.
|
|
3247
|
-
if (this.
|
|
3261
|
+
if (!this.lt) {
|
|
3262
|
+
setSignal(this.ft, false);
|
|
3263
|
+
if (this.gt) {
|
|
3248
3264
|
try {
|
|
3249
|
-
this.
|
|
3265
|
+
this.Ct = untrack(() => this.gt());
|
|
3250
3266
|
} catch {}
|
|
3251
3267
|
}
|
|
3252
3268
|
}
|
|
3253
3269
|
}
|
|
3254
|
-
if (_revealUsed) this.
|
|
3270
|
+
if (_revealUsed) this.Tt?.evaluate();
|
|
3255
3271
|
}
|
|
3256
3272
|
}
|
|
3257
3273
|
function createCollectionBoundary(e, t, n, i) {
|
|
3258
3274
|
const r = createOwner();
|
|
3259
3275
|
if (_revealUsed) setContext(RevealControllerContext, null, r);
|
|
3260
3276
|
const s = new CollectionQueue(e);
|
|
3261
|
-
if (i) s.
|
|
3277
|
+
if (i) s.gt = i;
|
|
3262
3278
|
const o = (s.Pt = createBoundChildren(r, t, s, e));
|
|
3263
3279
|
untrack(() => {
|
|
3264
3280
|
let t = false;
|
|
@@ -3268,20 +3284,20 @@ function createCollectionBoundary(e, t, n, i) {
|
|
|
3268
3284
|
if (e instanceof NotReadyError) t = true;
|
|
3269
3285
|
else throw e;
|
|
3270
3286
|
}
|
|
3271
|
-
s.
|
|
3287
|
+
s.lt = t || !!(o.Se & e) || o.fe instanceof NotReadyError;
|
|
3272
3288
|
});
|
|
3273
3289
|
const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
|
|
3274
3290
|
if (u) {
|
|
3275
|
-
s.
|
|
3291
|
+
s.Tt = u;
|
|
3276
3292
|
u.register(s);
|
|
3277
3293
|
cleanup(() => u.unregister(s));
|
|
3278
3294
|
}
|
|
3279
3295
|
const c = computed(() => {
|
|
3280
|
-
if (!read(s.
|
|
3296
|
+
if (!read(s.ft)) {
|
|
3281
3297
|
const e = read(o);
|
|
3282
|
-
if (!untrack(() => read(s.
|
|
3298
|
+
if (!untrack(() => read(s.ft))) return (s.St = true), e;
|
|
3283
3299
|
}
|
|
3284
|
-
if (_revealUsed && read(s.
|
|
3300
|
+
if (_revealUsed && read(s.Et)) return undefined;
|
|
3285
3301
|
return n(s);
|
|
3286
3302
|
});
|
|
3287
3303
|
return accessor(c);
|
|
@@ -3291,10 +3307,10 @@ function createLoadingBoundary(e, t, n) {
|
|
|
3291
3307
|
}
|
|
3292
3308
|
function createErrorBoundary(e, t) {
|
|
3293
3309
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
3294
|
-
let n = e.
|
|
3295
|
-
const i = n.
|
|
3310
|
+
let n = e.ct.values().next().value;
|
|
3311
|
+
const i = n.fe?.cause ?? n.fe;
|
|
3296
3312
|
return t(i, () => {
|
|
3297
|
-
for (const t of e.
|
|
3313
|
+
for (const t of e.ct) recompute(t);
|
|
3298
3314
|
schedule();
|
|
3299
3315
|
});
|
|
3300
3316
|
});
|
|
@@ -3315,7 +3331,7 @@ function createRevealOrder(e, t) {
|
|
|
3315
3331
|
o.evaluate();
|
|
3316
3332
|
});
|
|
3317
3333
|
if (i) {
|
|
3318
|
-
o.
|
|
3334
|
+
o.dt = i;
|
|
3319
3335
|
i.register(o);
|
|
3320
3336
|
cleanup(() => i.unregister(o));
|
|
3321
3337
|
}
|
|
@@ -3371,6 +3387,7 @@ function flattenArray(e, t = [], n) {
|
|
|
3371
3387
|
if (i) throw i;
|
|
3372
3388
|
return r;
|
|
3373
3389
|
}
|
|
3390
|
+
const DEV = undefined;
|
|
3374
3391
|
export {
|
|
3375
3392
|
$PROXY,
|
|
3376
3393
|
$REFRESH,
|