@solidjs/signals 0.13.8 → 0.13.10
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 +230 -18
- package/dist/node.cjs +1337 -1148
- package/dist/prod.js +921 -738
- package/dist/types/boundaries.d.ts +27 -0
- package/dist/types/core/dev.d.ts +22 -0
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/index.d.ts +3 -3
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -103,13 +103,13 @@ 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.
|
|
107
|
-
markNode(t.
|
|
106
|
+
for (let t = e.h; t !== null; t = t.I) {
|
|
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.
|
|
112
|
-
markNode(e.
|
|
111
|
+
for (let e = t.h; e !== null; e = e.I) {
|
|
112
|
+
markNode(e.p, REACTIVE_CHECK);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -136,11 +136,53 @@ function adjustHeight(e, t) {
|
|
|
136
136
|
}
|
|
137
137
|
if (e.o !== n) {
|
|
138
138
|
e.o = n;
|
|
139
|
-
for (let n = e.
|
|
140
|
-
insertIntoHeapHeight(n.
|
|
139
|
+
for (let n = e.h; n !== null; n = n.I) {
|
|
140
|
+
insertIntoHeapHeight(n.p, t);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
+
const hooks = {};
|
|
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
186
|
const transitions = new Set();
|
|
145
187
|
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, R: 0 };
|
|
146
188
|
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, R: 0 };
|
|
@@ -155,22 +197,22 @@ function shouldReadStashedOptimisticValue(e) {
|
|
|
155
197
|
}
|
|
156
198
|
function runLaneEffects(e) {
|
|
157
199
|
for (const t of activeLanes) {
|
|
158
|
-
if (t.
|
|
159
|
-
const n = t.
|
|
200
|
+
if (t.W || t.H.size > 0) continue;
|
|
201
|
+
const n = t.F[e - 1];
|
|
160
202
|
if (n.length) {
|
|
161
|
-
t.
|
|
203
|
+
t.F[e - 1] = [];
|
|
162
204
|
runQueue(n, e);
|
|
163
205
|
}
|
|
164
206
|
}
|
|
165
207
|
}
|
|
166
208
|
function queueStashedOptimisticEffects(e) {
|
|
167
|
-
for (let t = e.
|
|
168
|
-
const e = t.
|
|
169
|
-
if (!e.
|
|
170
|
-
if (e.
|
|
171
|
-
if (!e
|
|
172
|
-
e
|
|
173
|
-
e.
|
|
209
|
+
for (let t = e.h; t !== null; t = t.I) {
|
|
210
|
+
const e = t.p;
|
|
211
|
+
if (!e.M) continue;
|
|
212
|
+
if (e.M === EFFECT_TRACKED) {
|
|
213
|
+
if (!e.$) {
|
|
214
|
+
e.$ = true;
|
|
215
|
+
e.j.enqueue(EFFECT_USER, e.K);
|
|
174
216
|
}
|
|
175
217
|
continue;
|
|
176
218
|
}
|
|
@@ -183,66 +225,66 @@ function setProjectionWriteActive(e) {
|
|
|
183
225
|
projectionWriteActive = e;
|
|
184
226
|
}
|
|
185
227
|
function mergeTransitionState(e, t) {
|
|
186
|
-
t
|
|
187
|
-
e.
|
|
228
|
+
t.Y = e;
|
|
229
|
+
e.Z.push(...t.Z);
|
|
188
230
|
for (const n of activeLanes) {
|
|
189
|
-
if (n.
|
|
231
|
+
if (n.B === t) n.B = e;
|
|
190
232
|
}
|
|
191
|
-
e.
|
|
192
|
-
for (const n of t.
|
|
193
|
-
for (const n of t.
|
|
194
|
-
if (!e.
|
|
233
|
+
e.q.push(...t.q);
|
|
234
|
+
for (const n of t.X) e.X.add(n);
|
|
235
|
+
for (const n of t.J) {
|
|
236
|
+
if (!e.J.includes(n)) e.J.push(n);
|
|
195
237
|
}
|
|
196
238
|
}
|
|
197
239
|
function resolveOptimisticNodes(e) {
|
|
198
240
|
for (let t = 0; t < e.length; t++) {
|
|
199
241
|
const n = e[t];
|
|
200
|
-
n.
|
|
201
|
-
if (n.
|
|
202
|
-
n.
|
|
203
|
-
n.
|
|
242
|
+
n.ee = undefined;
|
|
243
|
+
if (n.te !== NOT_PENDING) {
|
|
244
|
+
n.ne = n.te;
|
|
245
|
+
n.te = NOT_PENDING;
|
|
204
246
|
}
|
|
205
|
-
const i = n.
|
|
206
|
-
n.
|
|
207
|
-
if (i !== NOT_PENDING && n.
|
|
208
|
-
n.
|
|
247
|
+
const i = n.ie;
|
|
248
|
+
n.ie = NOT_PENDING;
|
|
249
|
+
if (i !== NOT_PENDING && n.ne !== i) insertSubs(n, true);
|
|
250
|
+
n.B = null;
|
|
209
251
|
}
|
|
210
252
|
e.length = 0;
|
|
211
253
|
}
|
|
212
254
|
function cleanupCompletedLanes(e) {
|
|
213
255
|
for (const t of activeLanes) {
|
|
214
|
-
const n = e ? t.
|
|
256
|
+
const n = e ? t.B === e : !t.B;
|
|
215
257
|
if (!n) continue;
|
|
216
|
-
if (!t.
|
|
217
|
-
if (t.
|
|
218
|
-
if (t.
|
|
219
|
-
}
|
|
220
|
-
if (t.
|
|
221
|
-
t.
|
|
222
|
-
t.
|
|
223
|
-
t.
|
|
258
|
+
if (!t.W) {
|
|
259
|
+
if (t.F[0].length) runQueue(t.F[0], EFFECT_RENDER);
|
|
260
|
+
if (t.F[1].length) runQueue(t.F[1], EFFECT_USER);
|
|
261
|
+
}
|
|
262
|
+
if (t.re.ee === t) t.re.ee = undefined;
|
|
263
|
+
t.H.clear();
|
|
264
|
+
t.F[0].length = 0;
|
|
265
|
+
t.F[1].length = 0;
|
|
224
266
|
activeLanes.delete(t);
|
|
225
|
-
signalLanes.delete(t.
|
|
267
|
+
signalLanes.delete(t.re);
|
|
226
268
|
}
|
|
227
269
|
}
|
|
228
270
|
function schedule() {
|
|
229
271
|
if (scheduled) return;
|
|
230
272
|
scheduled = true;
|
|
231
|
-
if (!globalQueue.
|
|
273
|
+
if (!globalQueue.se && !projectionWriteActive) queueMicrotask(flush);
|
|
232
274
|
}
|
|
233
275
|
class Queue {
|
|
234
276
|
i = null;
|
|
235
|
-
|
|
236
|
-
|
|
277
|
+
oe = [[], []];
|
|
278
|
+
ue = [];
|
|
237
279
|
created = clock;
|
|
238
280
|
addChild(e) {
|
|
239
|
-
this.
|
|
281
|
+
this.ue.push(e);
|
|
240
282
|
e.i = this;
|
|
241
283
|
}
|
|
242
284
|
removeChild(e) {
|
|
243
|
-
const t = this.
|
|
285
|
+
const t = this.ue.indexOf(e);
|
|
244
286
|
if (t >= 0) {
|
|
245
|
-
this.
|
|
287
|
+
this.ue.splice(t, 1);
|
|
246
288
|
e.i = null;
|
|
247
289
|
}
|
|
248
290
|
}
|
|
@@ -251,81 +293,81 @@ class Queue {
|
|
|
251
293
|
return false;
|
|
252
294
|
}
|
|
253
295
|
run(e) {
|
|
254
|
-
if (this.
|
|
255
|
-
const t = this.
|
|
256
|
-
this.
|
|
296
|
+
if (this.oe[e - 1].length) {
|
|
297
|
+
const t = this.oe[e - 1];
|
|
298
|
+
this.oe[e - 1] = [];
|
|
257
299
|
runQueue(t, e);
|
|
258
300
|
}
|
|
259
|
-
for (let t = 0; t < this.
|
|
301
|
+
for (let t = 0; t < this.ue.length; t++) this.ue[t].run?.(e);
|
|
260
302
|
}
|
|
261
303
|
enqueue(e, t) {
|
|
262
304
|
if (e) {
|
|
263
305
|
if (currentOptimisticLane) {
|
|
264
306
|
const n = findLane(currentOptimisticLane);
|
|
265
|
-
n.
|
|
307
|
+
n.F[e - 1].push(t);
|
|
266
308
|
} else {
|
|
267
|
-
this.
|
|
309
|
+
this.oe[e - 1].push(t);
|
|
268
310
|
}
|
|
269
311
|
}
|
|
270
312
|
schedule();
|
|
271
313
|
}
|
|
272
314
|
stashQueues(e) {
|
|
273
|
-
e.
|
|
274
|
-
e.
|
|
275
|
-
this.
|
|
276
|
-
for (let t = 0; t < this.
|
|
277
|
-
let n = this.
|
|
278
|
-
let i = e.
|
|
315
|
+
e.oe[0].push(...this.oe[0]);
|
|
316
|
+
e.oe[1].push(...this.oe[1]);
|
|
317
|
+
this.oe = [[], []];
|
|
318
|
+
for (let t = 0; t < this.ue.length; t++) {
|
|
319
|
+
let n = this.ue[t];
|
|
320
|
+
let i = e.ue[t];
|
|
279
321
|
if (!i) {
|
|
280
|
-
i = {
|
|
281
|
-
e.
|
|
322
|
+
i = { oe: [[], []], ue: [] };
|
|
323
|
+
e.ue[t] = i;
|
|
282
324
|
}
|
|
283
325
|
n.stashQueues(i);
|
|
284
326
|
}
|
|
285
327
|
}
|
|
286
328
|
restoreQueues(e) {
|
|
287
|
-
this.
|
|
288
|
-
this.
|
|
289
|
-
for (let t = 0; t < e.
|
|
290
|
-
const n = e.
|
|
291
|
-
let i = this.
|
|
329
|
+
this.oe[0].push(...e.oe[0]);
|
|
330
|
+
this.oe[1].push(...e.oe[1]);
|
|
331
|
+
for (let t = 0; t < e.ue.length; t++) {
|
|
332
|
+
const n = e.ue[t];
|
|
333
|
+
let i = this.ue[t];
|
|
292
334
|
if (i) i.restoreQueues(n);
|
|
293
335
|
}
|
|
294
336
|
}
|
|
295
337
|
}
|
|
296
338
|
class GlobalQueue extends Queue {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
static
|
|
302
|
-
static
|
|
303
|
-
static
|
|
339
|
+
se = false;
|
|
340
|
+
ce = [];
|
|
341
|
+
q = [];
|
|
342
|
+
X = new Set();
|
|
343
|
+
static ae;
|
|
344
|
+
static le;
|
|
345
|
+
static fe = null;
|
|
304
346
|
flush() {
|
|
305
|
-
if (this.
|
|
306
|
-
this.
|
|
347
|
+
if (this.se) return;
|
|
348
|
+
this.se = true;
|
|
307
349
|
try {
|
|
308
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
350
|
+
runHeap(dirtyQueue, GlobalQueue.ae);
|
|
309
351
|
if (activeTransition) {
|
|
310
352
|
const e = transitionComplete(activeTransition);
|
|
311
353
|
if (!e) {
|
|
312
354
|
const e = activeTransition;
|
|
313
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
314
|
-
this.
|
|
315
|
-
this.
|
|
316
|
-
this.
|
|
355
|
+
runHeap(zombieQueue, GlobalQueue.ae);
|
|
356
|
+
this.ce = [];
|
|
357
|
+
this.q = [];
|
|
358
|
+
this.X = new Set();
|
|
317
359
|
runLaneEffects(EFFECT_RENDER);
|
|
318
360
|
runLaneEffects(EFFECT_USER);
|
|
319
|
-
this.stashQueues(e.
|
|
361
|
+
this.stashQueues(e.Ee);
|
|
320
362
|
clock++;
|
|
321
363
|
scheduled = dirtyQueue.R >= dirtyQueue.P;
|
|
322
|
-
reassignPendingTransition(e.
|
|
364
|
+
reassignPendingTransition(e.ce);
|
|
323
365
|
activeTransition = null;
|
|
324
|
-
if (!e.
|
|
366
|
+
if (!e.Z.length && e.q.length) {
|
|
325
367
|
stashedOptimisticReads = new Set();
|
|
326
|
-
for (let t = 0; t < e.
|
|
327
|
-
const n = e.
|
|
328
|
-
if (n.L || n.
|
|
368
|
+
for (let t = 0; t < e.q.length; t++) {
|
|
369
|
+
const n = e.q[t];
|
|
370
|
+
if (n.L || n.de) continue;
|
|
329
371
|
stashedOptimisticReads.add(n);
|
|
330
372
|
queueStashedOptimisticEffects(n);
|
|
331
373
|
}
|
|
@@ -337,15 +379,15 @@ class GlobalQueue extends Queue {
|
|
|
337
379
|
}
|
|
338
380
|
return;
|
|
339
381
|
}
|
|
340
|
-
this.
|
|
341
|
-
this.restoreQueues(activeTransition.
|
|
382
|
+
this.ce !== activeTransition.ce && this.ce.push(...activeTransition.ce);
|
|
383
|
+
this.restoreQueues(activeTransition.Ee);
|
|
342
384
|
transitions.delete(activeTransition);
|
|
343
385
|
const t = activeTransition;
|
|
344
386
|
activeTransition = null;
|
|
345
|
-
reassignPendingTransition(this.
|
|
387
|
+
reassignPendingTransition(this.ce);
|
|
346
388
|
finalizePureQueue(t);
|
|
347
389
|
} else {
|
|
348
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
390
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.ae);
|
|
349
391
|
finalizePureQueue();
|
|
350
392
|
}
|
|
351
393
|
clock++;
|
|
@@ -354,18 +396,19 @@ class GlobalQueue extends Queue {
|
|
|
354
396
|
this.run(EFFECT_RENDER);
|
|
355
397
|
runLaneEffects(EFFECT_USER);
|
|
356
398
|
this.run(EFFECT_USER);
|
|
399
|
+
if (false);
|
|
357
400
|
} finally {
|
|
358
|
-
this.
|
|
401
|
+
this.se = false;
|
|
359
402
|
}
|
|
360
403
|
}
|
|
361
404
|
notify(e, t, n, i) {
|
|
362
405
|
if (t & STATUS_PENDING) {
|
|
363
406
|
if (n & STATUS_PENDING) {
|
|
364
|
-
const t = i !== undefined ? i : e.
|
|
407
|
+
const t = i !== undefined ? i : e.Te;
|
|
365
408
|
if (activeTransition && t) {
|
|
366
409
|
const e = t.source;
|
|
367
|
-
if (!activeTransition.
|
|
368
|
-
activeTransition.
|
|
410
|
+
if (!activeTransition.J.includes(e)) {
|
|
411
|
+
activeTransition.J.push(e);
|
|
369
412
|
schedule();
|
|
370
413
|
}
|
|
371
414
|
}
|
|
@@ -377,17 +420,17 @@ class GlobalQueue extends Queue {
|
|
|
377
420
|
initTransition(e) {
|
|
378
421
|
if (e) e = currentTransition(e);
|
|
379
422
|
if (e && e === activeTransition) return;
|
|
380
|
-
if (!e && activeTransition && activeTransition.
|
|
423
|
+
if (!e && activeTransition && activeTransition.Se === clock) return;
|
|
381
424
|
if (!activeTransition) {
|
|
382
425
|
activeTransition = e ?? {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
426
|
+
Se: clock,
|
|
427
|
+
ce: [],
|
|
428
|
+
J: [],
|
|
429
|
+
q: [],
|
|
430
|
+
X: new Set(),
|
|
431
|
+
Z: [],
|
|
432
|
+
Ee: { oe: [[], []], ue: [] },
|
|
433
|
+
Y: false
|
|
391
434
|
};
|
|
392
435
|
} else if (e) {
|
|
393
436
|
const t = activeTransition;
|
|
@@ -396,71 +439,71 @@ class GlobalQueue extends Queue {
|
|
|
396
439
|
activeTransition = e;
|
|
397
440
|
}
|
|
398
441
|
transitions.add(activeTransition);
|
|
399
|
-
activeTransition.
|
|
400
|
-
if (this.
|
|
401
|
-
for (let e = 0; e < this.
|
|
402
|
-
const t = this.
|
|
403
|
-
t.
|
|
404
|
-
activeTransition.
|
|
442
|
+
activeTransition.Se = clock;
|
|
443
|
+
if (this.ce !== activeTransition.ce) {
|
|
444
|
+
for (let e = 0; e < this.ce.length; e++) {
|
|
445
|
+
const t = this.ce[e];
|
|
446
|
+
t.B = activeTransition;
|
|
447
|
+
activeTransition.ce.push(t);
|
|
405
448
|
}
|
|
406
|
-
this.
|
|
449
|
+
this.ce = activeTransition.ce;
|
|
407
450
|
}
|
|
408
|
-
if (this.
|
|
409
|
-
for (let e = 0; e < this.
|
|
410
|
-
const t = this.
|
|
411
|
-
t.
|
|
412
|
-
activeTransition.
|
|
451
|
+
if (this.q !== activeTransition.q) {
|
|
452
|
+
for (let e = 0; e < this.q.length; e++) {
|
|
453
|
+
const t = this.q[e];
|
|
454
|
+
t.B = activeTransition;
|
|
455
|
+
activeTransition.q.push(t);
|
|
413
456
|
}
|
|
414
|
-
this.
|
|
457
|
+
this.q = activeTransition.q;
|
|
415
458
|
}
|
|
416
459
|
for (const e of activeLanes) {
|
|
417
|
-
if (!e.
|
|
460
|
+
if (!e.B) e.B = activeTransition;
|
|
418
461
|
}
|
|
419
|
-
if (this.
|
|
420
|
-
for (const e of this.
|
|
421
|
-
this.
|
|
462
|
+
if (this.X !== activeTransition.X) {
|
|
463
|
+
for (const e of this.X) activeTransition.X.add(e);
|
|
464
|
+
this.X = activeTransition.X;
|
|
422
465
|
}
|
|
423
466
|
}
|
|
424
467
|
}
|
|
425
468
|
function insertSubs(e, t = false) {
|
|
426
|
-
const n = e.
|
|
427
|
-
const i = e.
|
|
428
|
-
for (let r = e.
|
|
429
|
-
if (i && r.
|
|
430
|
-
r.
|
|
469
|
+
const n = e.ee || currentOptimisticLane;
|
|
470
|
+
const i = e.Re !== undefined;
|
|
471
|
+
for (let r = e.h; r !== null; r = r.I) {
|
|
472
|
+
if (i && r.p.Oe) {
|
|
473
|
+
r.p.O |= REACTIVE_SNAPSHOT_STALE;
|
|
431
474
|
continue;
|
|
432
475
|
}
|
|
433
476
|
if (t && n) {
|
|
434
|
-
r.
|
|
435
|
-
assignOrMergeLane(r.
|
|
477
|
+
r.p.O |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
478
|
+
assignOrMergeLane(r.p, n);
|
|
436
479
|
} else if (t) {
|
|
437
|
-
r.
|
|
438
|
-
r.
|
|
480
|
+
r.p.O |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
481
|
+
r.p.ee = undefined;
|
|
439
482
|
}
|
|
440
|
-
const e = r.
|
|
441
|
-
if (e.
|
|
442
|
-
if (!e
|
|
443
|
-
e
|
|
444
|
-
e.
|
|
483
|
+
const e = r.p;
|
|
484
|
+
if (e.M === EFFECT_TRACKED) {
|
|
485
|
+
if (!e.$) {
|
|
486
|
+
e.$ = true;
|
|
487
|
+
e.j.enqueue(EFFECT_USER, e.K);
|
|
445
488
|
}
|
|
446
489
|
continue;
|
|
447
490
|
}
|
|
448
|
-
const s = r.
|
|
449
|
-
if (s.P > r.
|
|
450
|
-
insertIntoHeap(r.
|
|
491
|
+
const s = r.p.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
492
|
+
if (s.P > r.p.o) s.P = r.p.o;
|
|
493
|
+
insertIntoHeap(r.p, s);
|
|
451
494
|
}
|
|
452
495
|
}
|
|
453
496
|
function commitPendingNodes() {
|
|
454
|
-
const e = globalQueue.
|
|
497
|
+
const e = globalQueue.ce;
|
|
455
498
|
for (let t = 0; t < e.length; t++) {
|
|
456
499
|
const n = e[t];
|
|
457
|
-
if (n.
|
|
458
|
-
n.
|
|
459
|
-
n.
|
|
460
|
-
if (n.
|
|
500
|
+
if (n.te !== NOT_PENDING) {
|
|
501
|
+
n.ne = n.te;
|
|
502
|
+
n.te = NOT_PENDING;
|
|
503
|
+
if (n.M && n.M !== EFFECT_TRACKED) n.$ = true;
|
|
461
504
|
}
|
|
462
|
-
if (!(n.
|
|
463
|
-
if (n.L) GlobalQueue.
|
|
505
|
+
if (!(n._e & STATUS_PENDING)) n._e &= ~STATUS_UNINITIALIZED;
|
|
506
|
+
if (n.L) GlobalQueue.le(n, false, true);
|
|
464
507
|
}
|
|
465
508
|
e.length = 0;
|
|
466
509
|
}
|
|
@@ -468,14 +511,14 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
468
511
|
const n = !t;
|
|
469
512
|
if (n) commitPendingNodes();
|
|
470
513
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
471
|
-
if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.
|
|
514
|
+
if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.ae);
|
|
472
515
|
if (n) {
|
|
473
516
|
commitPendingNodes();
|
|
474
|
-
resolveOptimisticNodes(e ? e.
|
|
475
|
-
const t = e ? e.
|
|
476
|
-
if (GlobalQueue.
|
|
517
|
+
resolveOptimisticNodes(e ? e.q : globalQueue.q);
|
|
518
|
+
const t = e ? e.X : globalQueue.X;
|
|
519
|
+
if (GlobalQueue.fe && t.size) {
|
|
477
520
|
for (const e of t) {
|
|
478
|
-
GlobalQueue.
|
|
521
|
+
GlobalQueue.fe(e);
|
|
479
522
|
}
|
|
480
523
|
t.clear();
|
|
481
524
|
schedule();
|
|
@@ -484,23 +527,23 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
484
527
|
}
|
|
485
528
|
}
|
|
486
529
|
function checkBoundaryChildren(e) {
|
|
487
|
-
for (const t of e.
|
|
530
|
+
for (const t of e.ue) {
|
|
488
531
|
t.checkSources?.();
|
|
489
532
|
checkBoundaryChildren(t);
|
|
490
533
|
}
|
|
491
534
|
}
|
|
492
535
|
function trackOptimisticStore(e) {
|
|
493
|
-
globalQueue.
|
|
536
|
+
globalQueue.X.add(e);
|
|
494
537
|
schedule();
|
|
495
538
|
}
|
|
496
539
|
function reassignPendingTransition(e) {
|
|
497
540
|
for (let t = 0; t < e.length; t++) {
|
|
498
|
-
e[t].
|
|
541
|
+
e[t].B = activeTransition;
|
|
499
542
|
}
|
|
500
543
|
}
|
|
501
544
|
const globalQueue = new GlobalQueue();
|
|
502
545
|
function flush() {
|
|
503
|
-
if (globalQueue.
|
|
546
|
+
if (globalQueue.se) {
|
|
504
547
|
return;
|
|
505
548
|
}
|
|
506
549
|
while (scheduled || activeTransition) {
|
|
@@ -511,36 +554,36 @@ function runQueue(e, t) {
|
|
|
511
554
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
512
555
|
}
|
|
513
556
|
function transitionComplete(e) {
|
|
514
|
-
if (e
|
|
515
|
-
if (e.
|
|
557
|
+
if (e.Y) return true;
|
|
558
|
+
if (e.Z.length) return false;
|
|
516
559
|
let t = true;
|
|
517
|
-
for (let n = 0; n < e.
|
|
518
|
-
const i = e.
|
|
519
|
-
if (i.
|
|
560
|
+
for (let n = 0; n < e.J.length; n++) {
|
|
561
|
+
const i = e.J[n];
|
|
562
|
+
if (i._e & STATUS_PENDING && i.Te?.source === i) {
|
|
520
563
|
t = false;
|
|
521
564
|
break;
|
|
522
565
|
}
|
|
523
566
|
}
|
|
524
567
|
if (t) {
|
|
525
|
-
for (let n = 0; n < e.
|
|
526
|
-
const i = e.
|
|
568
|
+
for (let n = 0; n < e.q.length; n++) {
|
|
569
|
+
const i = e.q[n];
|
|
527
570
|
if (
|
|
528
571
|
hasActiveOverride(i) &&
|
|
529
|
-
"
|
|
530
|
-
i.
|
|
531
|
-
i.
|
|
532
|
-
i.
|
|
572
|
+
"_e" in i &&
|
|
573
|
+
i._e & STATUS_PENDING &&
|
|
574
|
+
i.Te instanceof NotReadyError &&
|
|
575
|
+
i.Te.source !== i
|
|
533
576
|
) {
|
|
534
577
|
t = false;
|
|
535
578
|
break;
|
|
536
579
|
}
|
|
537
580
|
}
|
|
538
581
|
}
|
|
539
|
-
t && (e
|
|
582
|
+
t && (e.Y = true);
|
|
540
583
|
return t;
|
|
541
584
|
}
|
|
542
585
|
function currentTransition(e) {
|
|
543
|
-
while (e
|
|
586
|
+
while (e.Y && typeof e.Y === "object") e = e.Y;
|
|
544
587
|
return e;
|
|
545
588
|
}
|
|
546
589
|
function setActiveTransition(e) {
|
|
@@ -562,76 +605,76 @@ function getOrCreateLane(e) {
|
|
|
562
605
|
if (t) {
|
|
563
606
|
return findLane(t);
|
|
564
607
|
}
|
|
565
|
-
const n = e.
|
|
566
|
-
const i = n?.
|
|
567
|
-
t = {
|
|
608
|
+
const n = e.he;
|
|
609
|
+
const i = n?.ee ? findLane(n.ee) : null;
|
|
610
|
+
t = { re: e, H: new Set(), F: [[], []], W: null, B: activeTransition, Ie: i };
|
|
568
611
|
signalLanes.set(e, t);
|
|
569
612
|
activeLanes.add(t);
|
|
570
|
-
e.
|
|
613
|
+
e.pe = false;
|
|
571
614
|
return t;
|
|
572
615
|
}
|
|
573
616
|
function findLane(e) {
|
|
574
|
-
while (e.
|
|
617
|
+
while (e.W) e = e.W;
|
|
575
618
|
return e;
|
|
576
619
|
}
|
|
577
620
|
function mergeLanes(e, t) {
|
|
578
621
|
e = findLane(e);
|
|
579
622
|
t = findLane(t);
|
|
580
623
|
if (e === t) return e;
|
|
581
|
-
t.
|
|
582
|
-
for (const n of t.
|
|
583
|
-
e.
|
|
584
|
-
e.
|
|
624
|
+
t.W = e;
|
|
625
|
+
for (const n of t.H) e.H.add(n);
|
|
626
|
+
e.F[0].push(...t.F[0]);
|
|
627
|
+
e.F[1].push(...t.F[1]);
|
|
585
628
|
return e;
|
|
586
629
|
}
|
|
587
630
|
function resolveLane(e) {
|
|
588
|
-
const t = e.
|
|
631
|
+
const t = e.ee;
|
|
589
632
|
if (!t) return undefined;
|
|
590
633
|
const n = findLane(t);
|
|
591
634
|
if (activeLanes.has(n)) return n;
|
|
592
|
-
e.
|
|
635
|
+
e.ee = undefined;
|
|
593
636
|
return undefined;
|
|
594
637
|
}
|
|
595
638
|
function resolveTransition(e) {
|
|
596
|
-
return resolveLane(e)?.
|
|
639
|
+
return resolveLane(e)?.B ?? e.B;
|
|
597
640
|
}
|
|
598
641
|
function hasActiveOverride(e) {
|
|
599
|
-
return !!(e.
|
|
642
|
+
return !!(e.ie !== undefined && e.ie !== NOT_PENDING);
|
|
600
643
|
}
|
|
601
644
|
function assignOrMergeLane(e, t) {
|
|
602
645
|
const n = findLane(t);
|
|
603
|
-
const i = e.
|
|
646
|
+
const i = e.ee;
|
|
604
647
|
if (i) {
|
|
605
|
-
if (i.
|
|
606
|
-
e.
|
|
648
|
+
if (i.W) {
|
|
649
|
+
e.ee = t;
|
|
607
650
|
return;
|
|
608
651
|
}
|
|
609
652
|
const r = findLane(i);
|
|
610
653
|
if (activeLanes.has(r)) {
|
|
611
654
|
if (r !== n && !hasActiveOverride(e)) {
|
|
612
|
-
if (n.
|
|
613
|
-
e.
|
|
614
|
-
} else if (r.
|
|
655
|
+
if (n.Ie && findLane(n.Ie) === r) {
|
|
656
|
+
e.ee = t;
|
|
657
|
+
} else if (r.Ie && findLane(r.Ie) === n);
|
|
615
658
|
else mergeLanes(n, r);
|
|
616
659
|
}
|
|
617
660
|
return;
|
|
618
661
|
}
|
|
619
662
|
}
|
|
620
|
-
e.
|
|
663
|
+
e.ee = t;
|
|
621
664
|
}
|
|
622
665
|
function unlinkSubs(e) {
|
|
623
666
|
const t = e.m;
|
|
624
667
|
const n = e.D;
|
|
625
|
-
const i = e.
|
|
626
|
-
const r = e.
|
|
627
|
-
if (i !== null) i.
|
|
628
|
-
else t.
|
|
629
|
-
if (r !== null) r.
|
|
668
|
+
const i = e.I;
|
|
669
|
+
const r = e.Ae;
|
|
670
|
+
if (i !== null) i.Ae = r;
|
|
671
|
+
else t.ge = r;
|
|
672
|
+
if (r !== null) r.I = i;
|
|
630
673
|
else {
|
|
631
|
-
t.
|
|
674
|
+
t.h = i;
|
|
632
675
|
if (i === null) {
|
|
633
|
-
t.
|
|
634
|
-
t.L && !t.
|
|
676
|
+
t.Ne?.();
|
|
677
|
+
t.L && !t.Pe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
635
678
|
}
|
|
636
679
|
}
|
|
637
680
|
return n;
|
|
@@ -646,27 +689,27 @@ function unobserved(e) {
|
|
|
646
689
|
disposeChildren(e, true);
|
|
647
690
|
}
|
|
648
691
|
function link(e, t) {
|
|
649
|
-
const n = t.
|
|
692
|
+
const n = t.Ce;
|
|
650
693
|
if (n !== null && n.m === e) return;
|
|
651
694
|
let i = null;
|
|
652
695
|
const r = t.O & REACTIVE_RECOMPUTING_DEPS;
|
|
653
696
|
if (r) {
|
|
654
697
|
i = n !== null ? n.D : t.C;
|
|
655
698
|
if (i !== null && i.m === e) {
|
|
656
|
-
t.
|
|
699
|
+
t.Ce = i;
|
|
657
700
|
return;
|
|
658
701
|
}
|
|
659
702
|
}
|
|
660
|
-
const s = e.
|
|
661
|
-
if (s !== null && s.
|
|
662
|
-
const o = (t.
|
|
703
|
+
const s = e.ge;
|
|
704
|
+
if (s !== null && s.p === t && (!r || isValidLink(s, t))) return;
|
|
705
|
+
const o = (t.Ce = e.ge = { m: e, p: t, D: i, Ae: s, I: null });
|
|
663
706
|
if (n !== null) n.D = o;
|
|
664
707
|
else t.C = o;
|
|
665
|
-
if (s !== null) s.
|
|
666
|
-
else e.
|
|
708
|
+
if (s !== null) s.I = o;
|
|
709
|
+
else e.h = o;
|
|
667
710
|
}
|
|
668
711
|
function isValidLink(e, t) {
|
|
669
|
-
const n = t.
|
|
712
|
+
const n = t.Ce;
|
|
670
713
|
if (n !== null) {
|
|
671
714
|
let i = t.C;
|
|
672
715
|
do {
|
|
@@ -679,7 +722,7 @@ function isValidLink(e, t) {
|
|
|
679
722
|
}
|
|
680
723
|
const PENDING_OWNER = {};
|
|
681
724
|
function markDisposal(e) {
|
|
682
|
-
let t = e.
|
|
725
|
+
let t = e.U;
|
|
683
726
|
while (t) {
|
|
684
727
|
t.O |= REACTIVE_ZOMBIE;
|
|
685
728
|
if (t.O & REACTIVE_IN_HEAP) {
|
|
@@ -687,7 +730,7 @@ function markDisposal(e) {
|
|
|
687
730
|
insertIntoHeap(t, zombieQueue);
|
|
688
731
|
}
|
|
689
732
|
markDisposal(t);
|
|
690
|
-
t = t.
|
|
733
|
+
t = t.k;
|
|
691
734
|
}
|
|
692
735
|
}
|
|
693
736
|
function dispose(e) {
|
|
@@ -696,16 +739,16 @@ function dispose(e) {
|
|
|
696
739
|
t = unlinkSubs(t);
|
|
697
740
|
} while (t !== null);
|
|
698
741
|
e.C = null;
|
|
699
|
-
e.
|
|
742
|
+
e.Ce = null;
|
|
700
743
|
disposeChildren(e, true);
|
|
701
744
|
}
|
|
702
745
|
function disposeChildren(e, t = false, n) {
|
|
703
746
|
if (e.O & REACTIVE_DISPOSED) return;
|
|
704
747
|
if (t) e.O = REACTIVE_DISPOSED;
|
|
705
|
-
if (t && e.L) e.
|
|
706
|
-
let i = n ? e.
|
|
748
|
+
if (t && e.L) e.De = null;
|
|
749
|
+
let i = n ? e.ye : e.U;
|
|
707
750
|
while (i) {
|
|
708
|
-
const e = i.
|
|
751
|
+
const e = i.k;
|
|
709
752
|
if (i.C) {
|
|
710
753
|
const e = i;
|
|
711
754
|
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
@@ -714,21 +757,21 @@ function disposeChildren(e, t = false, n) {
|
|
|
714
757
|
t = unlinkSubs(t);
|
|
715
758
|
} while (t !== null);
|
|
716
759
|
e.C = null;
|
|
717
|
-
e.
|
|
760
|
+
e.Ce = null;
|
|
718
761
|
}
|
|
719
762
|
disposeChildren(i, true);
|
|
720
763
|
i = e;
|
|
721
764
|
}
|
|
722
765
|
if (n) {
|
|
723
|
-
e.
|
|
766
|
+
e.ye = null;
|
|
724
767
|
} else {
|
|
725
|
-
e.
|
|
726
|
-
e.
|
|
768
|
+
e.U = null;
|
|
769
|
+
e.ve = 0;
|
|
727
770
|
}
|
|
728
771
|
runDisposal(e, n);
|
|
729
772
|
}
|
|
730
773
|
function runDisposal(e, t) {
|
|
731
|
-
let n = t ? e.
|
|
774
|
+
let n = t ? e.me : e.we;
|
|
732
775
|
if (!n) return;
|
|
733
776
|
if (Array.isArray(n)) {
|
|
734
777
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -738,12 +781,12 @@ function runDisposal(e, t) {
|
|
|
738
781
|
} else {
|
|
739
782
|
n.call(n);
|
|
740
783
|
}
|
|
741
|
-
t ? (e.
|
|
784
|
+
t ? (e.me = null) : (e.we = null);
|
|
742
785
|
}
|
|
743
786
|
function childId(e, t) {
|
|
744
787
|
let n = e;
|
|
745
788
|
while (n.Ve && n.i) n = n.i;
|
|
746
|
-
if (n.id != null) return formatId(n.id, t ? n.
|
|
789
|
+
if (n.id != null) return formatId(n.id, t ? n.ve++ : n.ve);
|
|
747
790
|
throw new Error("Cannot get child id from owner without an id");
|
|
748
791
|
}
|
|
749
792
|
function getNextChildId(e) {
|
|
@@ -766,9 +809,9 @@ function getOwner() {
|
|
|
766
809
|
}
|
|
767
810
|
function cleanup(e) {
|
|
768
811
|
if (!context) return e;
|
|
769
|
-
if (!context.
|
|
770
|
-
else if (Array.isArray(context.
|
|
771
|
-
else context.
|
|
812
|
+
if (!context.we) context.we = e;
|
|
813
|
+
else if (Array.isArray(context.we)) context.we.push(e);
|
|
814
|
+
else context.we = [context.we, e];
|
|
772
815
|
return e;
|
|
773
816
|
}
|
|
774
817
|
function isDisposed(e) {
|
|
@@ -782,26 +825,26 @@ function createOwner(e) {
|
|
|
782
825
|
Ve: n || undefined,
|
|
783
826
|
t: true,
|
|
784
827
|
u: t?.t ? t.u : t,
|
|
785
|
-
|
|
786
|
-
|
|
828
|
+
U: null,
|
|
829
|
+
k: null,
|
|
830
|
+
we: null,
|
|
831
|
+
j: t?.j ?? globalQueue,
|
|
832
|
+
be: t?.be || defaultContext,
|
|
833
|
+
ve: 0,
|
|
787
834
|
me: null,
|
|
788
|
-
|
|
789
|
-
we: t?.we || defaultContext,
|
|
790
|
-
ye: 0,
|
|
791
|
-
ve: null,
|
|
792
|
-
De: null,
|
|
835
|
+
ye: null,
|
|
793
836
|
i: t,
|
|
794
837
|
dispose(e = true) {
|
|
795
838
|
disposeChildren(i, e);
|
|
796
839
|
}
|
|
797
840
|
};
|
|
798
841
|
if (t) {
|
|
799
|
-
const e = t.
|
|
842
|
+
const e = t.U;
|
|
800
843
|
if (e === null) {
|
|
801
|
-
t.
|
|
844
|
+
t.U = i;
|
|
802
845
|
} else {
|
|
803
|
-
i.
|
|
804
|
-
t.
|
|
846
|
+
i.k = e;
|
|
847
|
+
t.U = i;
|
|
805
848
|
}
|
|
806
849
|
}
|
|
807
850
|
return i;
|
|
@@ -811,57 +854,57 @@ function createRoot(e, t) {
|
|
|
811
854
|
return runWithOwner(n, () => e(n.dispose));
|
|
812
855
|
}
|
|
813
856
|
function addPendingSource(e, t) {
|
|
814
|
-
if (e.
|
|
815
|
-
if (!e.
|
|
816
|
-
e.
|
|
857
|
+
if (e.Le === t || e.Ue?.has(t)) return false;
|
|
858
|
+
if (!e.Le) {
|
|
859
|
+
e.Le = t;
|
|
817
860
|
return true;
|
|
818
861
|
}
|
|
819
|
-
if (!e.
|
|
820
|
-
e.
|
|
862
|
+
if (!e.Ue) {
|
|
863
|
+
e.Ue = new Set([e.Le, t]);
|
|
821
864
|
} else {
|
|
822
|
-
e.
|
|
865
|
+
e.Ue.add(t);
|
|
823
866
|
}
|
|
824
|
-
e.
|
|
867
|
+
e.Le = undefined;
|
|
825
868
|
return true;
|
|
826
869
|
}
|
|
827
870
|
function removePendingSource(e, t) {
|
|
828
|
-
if (e.
|
|
829
|
-
if (e.
|
|
830
|
-
e.
|
|
871
|
+
if (e.Le) {
|
|
872
|
+
if (e.Le !== t) return false;
|
|
873
|
+
e.Le = undefined;
|
|
831
874
|
return true;
|
|
832
875
|
}
|
|
833
|
-
if (!e.
|
|
834
|
-
if (e.
|
|
835
|
-
e.
|
|
836
|
-
e.
|
|
837
|
-
} else if (e.
|
|
838
|
-
e.
|
|
876
|
+
if (!e.Ue?.delete(t)) return false;
|
|
877
|
+
if (e.Ue.size === 1) {
|
|
878
|
+
e.Le = e.Ue.values().next().value;
|
|
879
|
+
e.Ue = undefined;
|
|
880
|
+
} else if (e.Ue.size === 0) {
|
|
881
|
+
e.Ue = undefined;
|
|
839
882
|
}
|
|
840
883
|
return true;
|
|
841
884
|
}
|
|
842
885
|
function clearPendingSources(e) {
|
|
843
|
-
e.be = undefined;
|
|
844
|
-
e.Le?.clear();
|
|
845
886
|
e.Le = undefined;
|
|
887
|
+
e.Ue?.clear();
|
|
888
|
+
e.Ue = undefined;
|
|
846
889
|
}
|
|
847
890
|
function setPendingError(e, t, n) {
|
|
848
891
|
if (!t) {
|
|
849
|
-
e.
|
|
892
|
+
e.Te = null;
|
|
850
893
|
return;
|
|
851
894
|
}
|
|
852
895
|
if (n instanceof NotReadyError && n.source === t) {
|
|
853
|
-
e.
|
|
896
|
+
e.Te = n;
|
|
854
897
|
return;
|
|
855
898
|
}
|
|
856
|
-
const i = e.
|
|
899
|
+
const i = e.Te;
|
|
857
900
|
if (!(i instanceof NotReadyError) || i.source !== t) {
|
|
858
|
-
e.
|
|
901
|
+
e.Te = new NotReadyError(t);
|
|
859
902
|
}
|
|
860
903
|
}
|
|
861
904
|
function forEachDependent(e, t) {
|
|
862
|
-
for (let n = e.
|
|
905
|
+
for (let n = e.h; n !== null; n = n.I) t(n.p);
|
|
863
906
|
for (let n = e.A; n !== null; n = n.N) {
|
|
864
|
-
for (let e = n.
|
|
907
|
+
for (let e = n.h; e !== null; e = e.I) t(e.p);
|
|
865
908
|
}
|
|
866
909
|
}
|
|
867
910
|
function settlePendingSource(e) {
|
|
@@ -870,21 +913,21 @@ function settlePendingSource(e) {
|
|
|
870
913
|
const settle = i => {
|
|
871
914
|
if (n.has(i) || !removePendingSource(i, e)) return;
|
|
872
915
|
n.add(i);
|
|
873
|
-
i.
|
|
874
|
-
const r = i.
|
|
916
|
+
i.Se = clock;
|
|
917
|
+
const r = i.Le ?? i.Ue?.values().next().value;
|
|
875
918
|
if (r) {
|
|
876
919
|
setPendingError(i, r);
|
|
877
920
|
updatePendingSignal(i);
|
|
878
921
|
} else {
|
|
879
|
-
i.
|
|
922
|
+
i._e &= ~STATUS_PENDING;
|
|
880
923
|
setPendingError(i);
|
|
881
924
|
updatePendingSignal(i);
|
|
882
|
-
if (i.
|
|
883
|
-
if (i.
|
|
925
|
+
if (i.ke) {
|
|
926
|
+
if (i.M === EFFECT_TRACKED) {
|
|
884
927
|
const e = i;
|
|
885
|
-
if (!e
|
|
886
|
-
e
|
|
887
|
-
e.
|
|
928
|
+
if (!e.$) {
|
|
929
|
+
e.$ = true;
|
|
930
|
+
e.j.enqueue(EFFECT_USER, e.K);
|
|
888
931
|
}
|
|
889
932
|
} else {
|
|
890
933
|
const e = i.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
@@ -893,7 +936,7 @@ function settlePendingSource(e) {
|
|
|
893
936
|
}
|
|
894
937
|
t = true;
|
|
895
938
|
}
|
|
896
|
-
i.
|
|
939
|
+
i.ke = false;
|
|
897
940
|
}
|
|
898
941
|
forEachDependent(i, settle);
|
|
899
942
|
};
|
|
@@ -905,38 +948,38 @@ function handleAsync(e, t, n) {
|
|
|
905
948
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
906
949
|
const s = !r && i && untrack(() => typeof t.then === "function");
|
|
907
950
|
if (!s && !r) {
|
|
908
|
-
e.
|
|
951
|
+
e.De = null;
|
|
909
952
|
return t;
|
|
910
953
|
}
|
|
911
|
-
e.
|
|
954
|
+
e.De = t;
|
|
912
955
|
let o;
|
|
913
956
|
const handleError = n => {
|
|
914
|
-
if (e.
|
|
957
|
+
if (e.De !== t) return;
|
|
915
958
|
globalQueue.initTransition(resolveTransition(e));
|
|
916
959
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
917
|
-
e.
|
|
960
|
+
e.Se = clock;
|
|
918
961
|
};
|
|
919
962
|
const asyncWrite = (i, r) => {
|
|
920
|
-
if (e.
|
|
963
|
+
if (e.De !== t) return;
|
|
921
964
|
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
922
965
|
globalQueue.initTransition(resolveTransition(e));
|
|
923
966
|
clearStatus(e);
|
|
924
967
|
const s = resolveLane(e);
|
|
925
|
-
if (s) s.
|
|
968
|
+
if (s) s.H.delete(e);
|
|
926
969
|
if (n) n(i);
|
|
927
|
-
else if (e.
|
|
928
|
-
if (e.
|
|
970
|
+
else if (e.ie !== undefined) {
|
|
971
|
+
if (e.ie !== undefined && e.ie !== NOT_PENDING) e.te = i;
|
|
929
972
|
else {
|
|
930
|
-
e.
|
|
973
|
+
e.ne = i;
|
|
931
974
|
insertSubs(e);
|
|
932
975
|
}
|
|
933
|
-
e.
|
|
976
|
+
e.Se = clock;
|
|
934
977
|
} else if (s) {
|
|
935
|
-
const t = e.
|
|
936
|
-
const n = e.
|
|
978
|
+
const t = e.ne;
|
|
979
|
+
const n = e.xe;
|
|
937
980
|
if (!n || !n(i, t)) {
|
|
938
|
-
e.
|
|
939
|
-
e.
|
|
981
|
+
e.ne = i;
|
|
982
|
+
e.Se = clock;
|
|
940
983
|
if (e.Ge) {
|
|
941
984
|
setSignal(e.Ge, i);
|
|
942
985
|
}
|
|
@@ -994,7 +1037,7 @@ function handleAsync(e, t, n) {
|
|
|
994
1037
|
s = n;
|
|
995
1038
|
u = true;
|
|
996
1039
|
if (n.done) r = true;
|
|
997
|
-
} else if (e.
|
|
1040
|
+
} else if (e.De !== t) {
|
|
998
1041
|
return;
|
|
999
1042
|
} else if (!n.done) asyncWrite(n.value, iterate);
|
|
1000
1043
|
else {
|
|
@@ -1004,7 +1047,7 @@ function handleAsync(e, t, n) {
|
|
|
1004
1047
|
}
|
|
1005
1048
|
},
|
|
1006
1049
|
n => {
|
|
1007
|
-
if (!c && e.
|
|
1050
|
+
if (!c && e.De === t) {
|
|
1008
1051
|
r = true;
|
|
1009
1052
|
handleError(n);
|
|
1010
1053
|
}
|
|
@@ -1028,28 +1071,28 @@ function handleAsync(e, t, n) {
|
|
|
1028
1071
|
}
|
|
1029
1072
|
function clearStatus(e, t = false) {
|
|
1030
1073
|
clearPendingSources(e);
|
|
1031
|
-
e.
|
|
1032
|
-
e.
|
|
1074
|
+
e.ke = false;
|
|
1075
|
+
e._e = t ? 0 : e._e & STATUS_UNINITIALIZED;
|
|
1033
1076
|
setPendingError(e);
|
|
1034
1077
|
updatePendingSignal(e);
|
|
1035
|
-
e.
|
|
1078
|
+
e.We?.();
|
|
1036
1079
|
}
|
|
1037
1080
|
function notifyStatus(e, t, n, i, r) {
|
|
1038
1081
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
1039
1082
|
n = new StatusError(e, n);
|
|
1040
1083
|
const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
1041
1084
|
const o = s === e;
|
|
1042
|
-
const u = t === STATUS_PENDING && e.
|
|
1085
|
+
const u = t === STATUS_PENDING && e.ie !== undefined && !o;
|
|
1043
1086
|
const c = u && hasActiveOverride(e);
|
|
1044
1087
|
if (!i) {
|
|
1045
1088
|
if (t === STATUS_PENDING && s) {
|
|
1046
1089
|
addPendingSource(e, s);
|
|
1047
|
-
e.
|
|
1090
|
+
e._e = STATUS_PENDING | (e._e & STATUS_UNINITIALIZED);
|
|
1048
1091
|
setPendingError(e, s, n);
|
|
1049
1092
|
} else {
|
|
1050
1093
|
clearPendingSources(e);
|
|
1051
|
-
e.
|
|
1052
|
-
e.
|
|
1094
|
+
e._e = t | (t !== STATUS_ERROR ? e._e & STATUS_UNINITIALIZED : 0);
|
|
1095
|
+
e.Te = n;
|
|
1053
1096
|
}
|
|
1054
1097
|
updatePendingSignal(e);
|
|
1055
1098
|
}
|
|
@@ -1057,26 +1100,26 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
1057
1100
|
assignOrMergeLane(e, r);
|
|
1058
1101
|
}
|
|
1059
1102
|
const a = i || c;
|
|
1060
|
-
const
|
|
1061
|
-
if (e.
|
|
1103
|
+
const l = i || u ? undefined : r;
|
|
1104
|
+
if (e.We) {
|
|
1062
1105
|
if (i && t === STATUS_PENDING) {
|
|
1063
1106
|
return;
|
|
1064
1107
|
}
|
|
1065
1108
|
if (a) {
|
|
1066
|
-
e.
|
|
1109
|
+
e.We(t, n);
|
|
1067
1110
|
} else {
|
|
1068
|
-
e.
|
|
1111
|
+
e.We();
|
|
1069
1112
|
}
|
|
1070
1113
|
return;
|
|
1071
1114
|
}
|
|
1072
1115
|
forEachDependent(e, e => {
|
|
1073
|
-
e.
|
|
1116
|
+
e.Se = clock;
|
|
1074
1117
|
if (
|
|
1075
|
-
(t === STATUS_PENDING && s && e.
|
|
1076
|
-
(t !== STATUS_PENDING && (e.
|
|
1118
|
+
(t === STATUS_PENDING && s && e.Le !== s && !e.Ue?.has(s)) ||
|
|
1119
|
+
(t !== STATUS_PENDING && (e.Te !== n || e.Le || e.Ue))
|
|
1077
1120
|
) {
|
|
1078
|
-
if (!a && !e.
|
|
1079
|
-
notifyStatus(e, t, n, a,
|
|
1121
|
+
if (!a && !e.B) globalQueue.ce.push(e);
|
|
1122
|
+
notifyStatus(e, t, n, a, l);
|
|
1080
1123
|
}
|
|
1081
1124
|
});
|
|
1082
1125
|
}
|
|
@@ -1103,8 +1146,8 @@ function enableExternalSource(e) {
|
|
|
1103
1146
|
externalSourceConfig = { factory: t, untrack: n };
|
|
1104
1147
|
}
|
|
1105
1148
|
}
|
|
1106
|
-
GlobalQueue.
|
|
1107
|
-
GlobalQueue.
|
|
1149
|
+
GlobalQueue.ae = recompute;
|
|
1150
|
+
GlobalQueue.le = disposeChildren;
|
|
1108
1151
|
let tracking = false;
|
|
1109
1152
|
let stale = false;
|
|
1110
1153
|
let refreshing = false;
|
|
@@ -1117,7 +1160,7 @@ let snapshotCaptureActive = false;
|
|
|
1117
1160
|
let snapshotSources = null;
|
|
1118
1161
|
function ownerInSnapshotScope(e) {
|
|
1119
1162
|
while (e) {
|
|
1120
|
-
if (e.
|
|
1163
|
+
if (e.He) return true;
|
|
1121
1164
|
e = e.i;
|
|
1122
1165
|
}
|
|
1123
1166
|
return false;
|
|
@@ -1127,23 +1170,23 @@ function setSnapshotCapture(e) {
|
|
|
1127
1170
|
if (e && !snapshotSources) snapshotSources = new Set();
|
|
1128
1171
|
}
|
|
1129
1172
|
function markSnapshotScope(e) {
|
|
1130
|
-
e.
|
|
1173
|
+
e.He = true;
|
|
1131
1174
|
}
|
|
1132
1175
|
function releaseSnapshotScope(e) {
|
|
1133
|
-
e.
|
|
1176
|
+
e.He = false;
|
|
1134
1177
|
releaseSubtree(e);
|
|
1135
1178
|
schedule();
|
|
1136
1179
|
}
|
|
1137
1180
|
function releaseSubtree(e) {
|
|
1138
|
-
let t = e.
|
|
1181
|
+
let t = e.U;
|
|
1139
1182
|
while (t) {
|
|
1140
|
-
if (t.
|
|
1141
|
-
t = t.
|
|
1183
|
+
if (t.He) {
|
|
1184
|
+
t = t.k;
|
|
1142
1185
|
continue;
|
|
1143
1186
|
}
|
|
1144
1187
|
if (t.L) {
|
|
1145
1188
|
const e = t;
|
|
1146
|
-
e.
|
|
1189
|
+
e.Oe = false;
|
|
1147
1190
|
if (e.O & REACTIVE_SNAPSHOT_STALE) {
|
|
1148
1191
|
e.O &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1149
1192
|
e.O |= REACTIVE_DIRTY;
|
|
@@ -1152,13 +1195,13 @@ function releaseSubtree(e) {
|
|
|
1152
1195
|
}
|
|
1153
1196
|
}
|
|
1154
1197
|
releaseSubtree(t);
|
|
1155
|
-
t = t.
|
|
1198
|
+
t = t.k;
|
|
1156
1199
|
}
|
|
1157
1200
|
}
|
|
1158
1201
|
function clearSnapshots() {
|
|
1159
1202
|
if (snapshotSources) {
|
|
1160
1203
|
for (const e of snapshotSources) {
|
|
1161
|
-
delete e.
|
|
1204
|
+
delete e.Re;
|
|
1162
1205
|
delete e[STORE_SNAPSHOT_PROPS];
|
|
1163
1206
|
}
|
|
1164
1207
|
snapshotSources = null;
|
|
@@ -1166,34 +1209,34 @@ function clearSnapshots() {
|
|
|
1166
1209
|
snapshotCaptureActive = false;
|
|
1167
1210
|
}
|
|
1168
1211
|
function recompute(e, t = false) {
|
|
1169
|
-
const n = e.
|
|
1212
|
+
const n = e.M;
|
|
1170
1213
|
if (!t) {
|
|
1171
|
-
if (e.
|
|
1172
|
-
globalQueue.initTransition(e.
|
|
1214
|
+
if (e.B && (!n || activeTransition) && activeTransition !== e.B)
|
|
1215
|
+
globalQueue.initTransition(e.B);
|
|
1173
1216
|
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1174
|
-
e.
|
|
1175
|
-
if (e.
|
|
1217
|
+
e.De = null;
|
|
1218
|
+
if (e.B || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1176
1219
|
else {
|
|
1177
1220
|
markDisposal(e);
|
|
1178
|
-
e.
|
|
1179
|
-
e.
|
|
1180
|
-
e.
|
|
1181
|
-
e.
|
|
1182
|
-
e.
|
|
1221
|
+
e.me = e.we;
|
|
1222
|
+
e.ye = e.U;
|
|
1223
|
+
e.we = null;
|
|
1224
|
+
e.U = null;
|
|
1225
|
+
e.ve = 0;
|
|
1183
1226
|
}
|
|
1184
1227
|
}
|
|
1185
1228
|
const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1186
|
-
const r = e.
|
|
1187
|
-
const s = !!(e.
|
|
1229
|
+
const r = e.ie !== undefined && e.ie !== NOT_PENDING;
|
|
1230
|
+
const s = !!(e._e & STATUS_PENDING);
|
|
1188
1231
|
const o = context;
|
|
1189
1232
|
context = e;
|
|
1190
|
-
e.
|
|
1233
|
+
e.Ce = null;
|
|
1191
1234
|
e.O = REACTIVE_RECOMPUTING_DEPS;
|
|
1192
|
-
e.
|
|
1193
|
-
let u = e.
|
|
1235
|
+
e.Se = clock;
|
|
1236
|
+
let u = e.te === NOT_PENDING ? e.ne : e.te;
|
|
1194
1237
|
let c = e.o;
|
|
1195
1238
|
let a = tracking;
|
|
1196
|
-
let
|
|
1239
|
+
let l = currentOptimisticLane;
|
|
1197
1240
|
tracking = true;
|
|
1198
1241
|
if (i) {
|
|
1199
1242
|
const t = resolveLane(e);
|
|
@@ -1204,33 +1247,33 @@ function recompute(e, t = false) {
|
|
|
1204
1247
|
clearStatus(e, t);
|
|
1205
1248
|
const n = resolveLane(e);
|
|
1206
1249
|
if (n) {
|
|
1207
|
-
n.
|
|
1208
|
-
updatePendingSignal(n.
|
|
1250
|
+
n.H.delete(e);
|
|
1251
|
+
updatePendingSignal(n.re);
|
|
1209
1252
|
}
|
|
1210
1253
|
} catch (t) {
|
|
1211
1254
|
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
1212
1255
|
const t = findLane(currentOptimisticLane);
|
|
1213
|
-
if (t.
|
|
1214
|
-
t.
|
|
1215
|
-
e.
|
|
1216
|
-
updatePendingSignal(t.
|
|
1256
|
+
if (t.re !== e) {
|
|
1257
|
+
t.H.add(e);
|
|
1258
|
+
e.ee = t;
|
|
1259
|
+
updatePendingSignal(t.re);
|
|
1217
1260
|
}
|
|
1218
1261
|
}
|
|
1219
|
-
if (t instanceof NotReadyError) e.
|
|
1262
|
+
if (t instanceof NotReadyError) e.ke = true;
|
|
1220
1263
|
notifyStatus(
|
|
1221
1264
|
e,
|
|
1222
1265
|
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
1223
1266
|
t,
|
|
1224
1267
|
undefined,
|
|
1225
|
-
t instanceof NotReadyError ? e.
|
|
1268
|
+
t instanceof NotReadyError ? e.ee : undefined
|
|
1226
1269
|
);
|
|
1227
1270
|
} finally {
|
|
1228
1271
|
tracking = a;
|
|
1229
1272
|
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1230
1273
|
context = o;
|
|
1231
1274
|
}
|
|
1232
|
-
if (!e.
|
|
1233
|
-
const o = e.
|
|
1275
|
+
if (!e.Te) {
|
|
1276
|
+
const o = e.Ce;
|
|
1234
1277
|
let a = o !== null ? o.D : e.C;
|
|
1235
1278
|
if (a !== null) {
|
|
1236
1279
|
do {
|
|
@@ -1239,30 +1282,30 @@ function recompute(e, t = false) {
|
|
|
1239
1282
|
if (o !== null) o.D = null;
|
|
1240
1283
|
else e.C = null;
|
|
1241
1284
|
}
|
|
1242
|
-
const
|
|
1243
|
-
const
|
|
1244
|
-
if (
|
|
1245
|
-
const o = r ? e.
|
|
1246
|
-
if (t || (n && activeTransition !== e.
|
|
1247
|
-
e.
|
|
1285
|
+
const l = r ? e.ie : e.te === NOT_PENDING ? e.ne : e.te;
|
|
1286
|
+
const f = !e.xe || !e.xe(l, u);
|
|
1287
|
+
if (f) {
|
|
1288
|
+
const o = r ? e.ie : undefined;
|
|
1289
|
+
if (t || (n && activeTransition !== e.B) || i) {
|
|
1290
|
+
e.ne = u;
|
|
1248
1291
|
if (r && i) {
|
|
1249
|
-
e.
|
|
1250
|
-
e.
|
|
1292
|
+
e.ie = u;
|
|
1293
|
+
e.te = u;
|
|
1251
1294
|
}
|
|
1252
|
-
} else e.
|
|
1253
|
-
if (r && !i && s && !e.
|
|
1254
|
-
if (!r || i || e.
|
|
1295
|
+
} else e.te = u;
|
|
1296
|
+
if (r && !i && s && !e.pe) e.ie = u;
|
|
1297
|
+
if (!r || i || e.ie !== o) insertSubs(e, i || r);
|
|
1255
1298
|
} else if (r) {
|
|
1256
|
-
e.
|
|
1299
|
+
e.te = u;
|
|
1257
1300
|
} else if (e.o != c) {
|
|
1258
|
-
for (let t = e.
|
|
1259
|
-
insertIntoHeapHeight(t.
|
|
1301
|
+
for (let t = e.h; t !== null; t = t.I) {
|
|
1302
|
+
insertIntoHeapHeight(t.p, t.p.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1260
1303
|
}
|
|
1261
1304
|
}
|
|
1262
1305
|
}
|
|
1263
|
-
currentOptimisticLane =
|
|
1264
|
-
(!t || e.
|
|
1265
|
-
e.
|
|
1306
|
+
currentOptimisticLane = l;
|
|
1307
|
+
(!t || e._e & STATUS_PENDING) && !e.B && !(activeTransition && r) && globalQueue.ce.push(e);
|
|
1308
|
+
e.B && n && activeTransition !== e.B && runInTransition(e.B, () => recompute(e));
|
|
1266
1309
|
}
|
|
1267
1310
|
function updateIfNecessary(e) {
|
|
1268
1311
|
if (e.O & REACTIVE_CHECK) {
|
|
@@ -1277,58 +1320,58 @@ function updateIfNecessary(e) {
|
|
|
1277
1320
|
}
|
|
1278
1321
|
}
|
|
1279
1322
|
}
|
|
1280
|
-
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.
|
|
1323
|
+
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.Te && e.Se < clock && !e.De)) {
|
|
1281
1324
|
recompute(e);
|
|
1282
1325
|
}
|
|
1283
|
-
e.O =
|
|
1326
|
+
e.O = e.O & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
|
|
1284
1327
|
}
|
|
1285
1328
|
function computed(e, t, n) {
|
|
1286
1329
|
const i = n?.transparent ?? false;
|
|
1287
1330
|
const r = {
|
|
1288
1331
|
id: n?.id ?? (i ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1289
1332
|
Ve: i || undefined,
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1333
|
+
xe: n?.equals != null ? n.equals : isEqual,
|
|
1334
|
+
de: !!n?.pureWrite,
|
|
1335
|
+
Ne: n?.unobserved,
|
|
1336
|
+
we: null,
|
|
1337
|
+
j: context?.j ?? globalQueue,
|
|
1338
|
+
be: context?.be ?? defaultContext,
|
|
1339
|
+
ve: 0,
|
|
1297
1340
|
L: e,
|
|
1298
|
-
|
|
1341
|
+
ne: t,
|
|
1299
1342
|
o: 0,
|
|
1300
1343
|
A: null,
|
|
1301
1344
|
S: undefined,
|
|
1302
1345
|
T: null,
|
|
1303
1346
|
C: null,
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
pe: null,
|
|
1307
|
-
i: context,
|
|
1347
|
+
Ce: null,
|
|
1348
|
+
h: null,
|
|
1308
1349
|
ge: null,
|
|
1309
|
-
|
|
1350
|
+
i: context,
|
|
1351
|
+
k: null,
|
|
1352
|
+
U: null,
|
|
1310
1353
|
O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1354
|
+
_e: STATUS_UNINITIALIZED,
|
|
1355
|
+
Se: clock,
|
|
1356
|
+
te: NOT_PENDING,
|
|
1357
|
+
me: null,
|
|
1358
|
+
ye: null,
|
|
1315
1359
|
De: null,
|
|
1316
|
-
|
|
1317
|
-
K: null
|
|
1360
|
+
B: null
|
|
1318
1361
|
};
|
|
1319
1362
|
r.T = r;
|
|
1320
1363
|
const s = context?.t ? context.u : context;
|
|
1321
1364
|
if (context) {
|
|
1322
|
-
const e = context.
|
|
1365
|
+
const e = context.U;
|
|
1323
1366
|
if (e === null) {
|
|
1324
|
-
context.
|
|
1367
|
+
context.U = r;
|
|
1325
1368
|
} else {
|
|
1326
|
-
r.
|
|
1327
|
-
context.
|
|
1369
|
+
r.k = e;
|
|
1370
|
+
context.U = r;
|
|
1328
1371
|
}
|
|
1329
1372
|
}
|
|
1330
1373
|
if (s) r.o = s.o + 1;
|
|
1331
|
-
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.
|
|
1374
|
+
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.Oe = true;
|
|
1332
1375
|
if (externalSourceConfig) {
|
|
1333
1376
|
const e = signal(undefined, { equals: false, pureWrite: true });
|
|
1334
1377
|
const t = externalSourceConfig.factory(r.L, () => {
|
|
@@ -1342,8 +1385,8 @@ function computed(e, t, n) {
|
|
|
1342
1385
|
}
|
|
1343
1386
|
!n?.lazy && recompute(r, true);
|
|
1344
1387
|
if (snapshotCaptureActive && !n?.lazy) {
|
|
1345
|
-
if (!(r.
|
|
1346
|
-
r.
|
|
1388
|
+
if (!(r._e & STATUS_PENDING)) {
|
|
1389
|
+
r.Re = r.ne === undefined ? NO_SNAPSHOT : r.ne;
|
|
1347
1390
|
snapshotSources.add(r);
|
|
1348
1391
|
}
|
|
1349
1392
|
}
|
|
@@ -1351,33 +1394,33 @@ function computed(e, t, n) {
|
|
|
1351
1394
|
}
|
|
1352
1395
|
function signal(e, t, n = null) {
|
|
1353
1396
|
const i = {
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1397
|
+
xe: t?.equals != null ? t.equals : isEqual,
|
|
1398
|
+
de: !!t?.pureWrite,
|
|
1399
|
+
Fe: !!t?.Fe,
|
|
1400
|
+
Ne: t?.unobserved,
|
|
1401
|
+
ne: e,
|
|
1402
|
+
h: null,
|
|
1403
|
+
ge: null,
|
|
1404
|
+
Se: clock,
|
|
1362
1405
|
V: n,
|
|
1363
1406
|
N: n?.A || null,
|
|
1364
|
-
|
|
1407
|
+
te: NOT_PENDING
|
|
1365
1408
|
};
|
|
1366
1409
|
n && (n.A = i);
|
|
1367
|
-
if (snapshotCaptureActive && !i.
|
|
1368
|
-
i.
|
|
1410
|
+
if (snapshotCaptureActive && !i.Fe && !((n?._e ?? 0) & STATUS_PENDING)) {
|
|
1411
|
+
i.Re = e === undefined ? NO_SNAPSHOT : e;
|
|
1369
1412
|
snapshotSources.add(i);
|
|
1370
1413
|
}
|
|
1371
1414
|
return i;
|
|
1372
1415
|
}
|
|
1373
1416
|
function optimisticSignal(e, t) {
|
|
1374
1417
|
const n = signal(e, t);
|
|
1375
|
-
n.
|
|
1418
|
+
n.ie = NOT_PENDING;
|
|
1376
1419
|
return n;
|
|
1377
1420
|
}
|
|
1378
1421
|
function optimisticComputed(e, t, n) {
|
|
1379
1422
|
const i = computed(e, t, n);
|
|
1380
|
-
i.
|
|
1423
|
+
i.ie = NOT_PENDING;
|
|
1381
1424
|
return i;
|
|
1382
1425
|
}
|
|
1383
1426
|
function isEqual(e, t) {
|
|
@@ -1399,7 +1442,7 @@ function read(e) {
|
|
|
1399
1442
|
const t = getLatestValueComputed(e);
|
|
1400
1443
|
const n = latestReadActive;
|
|
1401
1444
|
latestReadActive = false;
|
|
1402
|
-
const i = e.
|
|
1445
|
+
const i = e.ie !== undefined && e.ie !== NOT_PENDING ? e.ie : e.ne;
|
|
1403
1446
|
let r;
|
|
1404
1447
|
try {
|
|
1405
1448
|
r = read(t);
|
|
@@ -1409,11 +1452,11 @@ function read(e) {
|
|
|
1409
1452
|
} finally {
|
|
1410
1453
|
latestReadActive = n;
|
|
1411
1454
|
}
|
|
1412
|
-
if (t.
|
|
1413
|
-
if (stale && currentOptimisticLane && t.
|
|
1414
|
-
const e = findLane(t.
|
|
1455
|
+
if (t._e & STATUS_PENDING) return i;
|
|
1456
|
+
if (stale && currentOptimisticLane && t.ee) {
|
|
1457
|
+
const e = findLane(t.ee);
|
|
1415
1458
|
const n = findLane(currentOptimisticLane);
|
|
1416
|
-
if (e !== n && e.
|
|
1459
|
+
if (e !== n && e.H.size > 0) {
|
|
1417
1460
|
return i;
|
|
1418
1461
|
}
|
|
1419
1462
|
}
|
|
@@ -1423,8 +1466,8 @@ function read(e) {
|
|
|
1423
1466
|
const t = e.V;
|
|
1424
1467
|
const n = pendingCheckActive;
|
|
1425
1468
|
pendingCheckActive = false;
|
|
1426
|
-
if (t && e.
|
|
1427
|
-
if (e.
|
|
1469
|
+
if (t && e.ie !== undefined) {
|
|
1470
|
+
if (e.ie !== NOT_PENDING && (t.De || !!(t._e & STATUS_PENDING))) {
|
|
1428
1471
|
foundPending = true;
|
|
1429
1472
|
}
|
|
1430
1473
|
let n = context;
|
|
@@ -1437,7 +1480,7 @@ function read(e) {
|
|
|
1437
1480
|
if (t && read(getPendingSignal(t))) foundPending = true;
|
|
1438
1481
|
}
|
|
1439
1482
|
pendingCheckActive = n;
|
|
1440
|
-
return e.
|
|
1483
|
+
return e.ne;
|
|
1441
1484
|
}
|
|
1442
1485
|
let t = context;
|
|
1443
1486
|
if (t?.t) t = t.u;
|
|
@@ -1463,60 +1506,60 @@ function read(e) {
|
|
|
1463
1506
|
}
|
|
1464
1507
|
}
|
|
1465
1508
|
}
|
|
1466
|
-
if (n.
|
|
1467
|
-
if (t && !(stale && n.
|
|
1509
|
+
if (n._e & STATUS_PENDING) {
|
|
1510
|
+
if (t && !(stale && n.B && activeTransition !== n.B)) {
|
|
1468
1511
|
if (currentOptimisticLane) {
|
|
1469
|
-
const i = n.
|
|
1512
|
+
const i = n.ee;
|
|
1470
1513
|
const r = findLane(currentOptimisticLane);
|
|
1471
1514
|
if (i && findLane(i) === r && !hasActiveOverride(n)) {
|
|
1472
1515
|
if (!tracking && e !== t) link(e, t);
|
|
1473
|
-
throw n.
|
|
1516
|
+
throw n.Te;
|
|
1474
1517
|
}
|
|
1475
1518
|
} else {
|
|
1476
1519
|
if (!tracking && e !== t) link(e, t);
|
|
1477
|
-
throw n.
|
|
1520
|
+
throw n.Te;
|
|
1478
1521
|
}
|
|
1479
|
-
} else if (t && n !== e && n.
|
|
1522
|
+
} else if (t && n !== e && n._e & STATUS_UNINITIALIZED) {
|
|
1480
1523
|
if (!tracking && e !== t) link(e, t);
|
|
1481
|
-
throw n.
|
|
1482
|
-
} else if (!t && n.
|
|
1483
|
-
throw n.
|
|
1524
|
+
throw n.Te;
|
|
1525
|
+
} else if (!t && n._e & STATUS_UNINITIALIZED) {
|
|
1526
|
+
throw n.Te;
|
|
1484
1527
|
}
|
|
1485
1528
|
}
|
|
1486
|
-
if (e.L && e.
|
|
1487
|
-
if (e.
|
|
1488
|
-
recompute(e
|
|
1529
|
+
if (e.L && e._e & STATUS_ERROR) {
|
|
1530
|
+
if (e.Se < clock) {
|
|
1531
|
+
recompute(e);
|
|
1489
1532
|
return read(e);
|
|
1490
|
-
} else throw e.
|
|
1533
|
+
} else throw e.Te;
|
|
1491
1534
|
}
|
|
1492
|
-
if (snapshotCaptureActive && t && t.
|
|
1493
|
-
const n = e.
|
|
1535
|
+
if (snapshotCaptureActive && t && t.Oe) {
|
|
1536
|
+
const n = e.Re;
|
|
1494
1537
|
if (n !== undefined) {
|
|
1495
1538
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1496
|
-
const r = e.
|
|
1539
|
+
const r = e.te !== NOT_PENDING ? e.te : e.ne;
|
|
1497
1540
|
if (r !== i) t.O |= REACTIVE_SNAPSHOT_STALE;
|
|
1498
1541
|
return i;
|
|
1499
1542
|
}
|
|
1500
1543
|
}
|
|
1501
|
-
if (e.
|
|
1502
|
-
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.
|
|
1503
|
-
return e.
|
|
1544
|
+
if (e.ie !== undefined && e.ie !== NOT_PENDING) {
|
|
1545
|
+
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.ne;
|
|
1546
|
+
return e.ie;
|
|
1504
1547
|
}
|
|
1505
1548
|
return !t ||
|
|
1506
1549
|
(currentOptimisticLane !== null &&
|
|
1507
|
-
(e.
|
|
1508
|
-
e.
|
|
1509
|
-
(stale && e.
|
|
1510
|
-
? e.
|
|
1511
|
-
: e.
|
|
1550
|
+
(e.ie !== undefined || e.ee || (n === e && stale) || !!(n._e & STATUS_PENDING))) ||
|
|
1551
|
+
e.te === NOT_PENDING ||
|
|
1552
|
+
(stale && e.B && activeTransition !== e.B)
|
|
1553
|
+
? e.ne
|
|
1554
|
+
: e.te;
|
|
1512
1555
|
}
|
|
1513
1556
|
function setSignal(e, t) {
|
|
1514
|
-
if (e.
|
|
1515
|
-
const n = e.
|
|
1516
|
-
const i = e.
|
|
1517
|
-
const r = n ? (i ? e.
|
|
1557
|
+
if (e.B && activeTransition !== e.B) globalQueue.initTransition(e.B);
|
|
1558
|
+
const n = e.ie !== undefined && !projectionWriteActive;
|
|
1559
|
+
const i = e.ie !== undefined && e.ie !== NOT_PENDING;
|
|
1560
|
+
const r = n ? (i ? e.ie : e.ne) : e.te === NOT_PENDING ? e.ne : e.te;
|
|
1518
1561
|
if (typeof t === "function") t = t(r);
|
|
1519
|
-
const s = !e.
|
|
1562
|
+
const s = !e.xe || !e.xe(r, t) || !!(e._e & STATUS_UNINITIALIZED);
|
|
1520
1563
|
if (!s) {
|
|
1521
1564
|
if (n && i && e.L) {
|
|
1522
1565
|
insertSubs(e, true);
|
|
@@ -1525,25 +1568,25 @@ function setSignal(e, t) {
|
|
|
1525
1568
|
return t;
|
|
1526
1569
|
}
|
|
1527
1570
|
if (n) {
|
|
1528
|
-
const n = e.
|
|
1571
|
+
const n = e.ie === NOT_PENDING;
|
|
1529
1572
|
if (!n) globalQueue.initTransition(resolveTransition(e));
|
|
1530
1573
|
if (n) {
|
|
1531
|
-
e.
|
|
1532
|
-
globalQueue.
|
|
1574
|
+
e.te = e.ne;
|
|
1575
|
+
globalQueue.q.push(e);
|
|
1533
1576
|
}
|
|
1534
|
-
e.
|
|
1577
|
+
e.pe = true;
|
|
1535
1578
|
const i = getOrCreateLane(e);
|
|
1536
|
-
e.
|
|
1537
|
-
e.
|
|
1579
|
+
e.ee = i;
|
|
1580
|
+
e.ie = t;
|
|
1538
1581
|
} else {
|
|
1539
|
-
if (e.
|
|
1540
|
-
e.
|
|
1582
|
+
if (e.te === NOT_PENDING) globalQueue.ce.push(e);
|
|
1583
|
+
e.te = t;
|
|
1541
1584
|
}
|
|
1542
1585
|
updatePendingSignal(e);
|
|
1543
1586
|
if (e.Ge) {
|
|
1544
1587
|
setSignal(e.Ge, t);
|
|
1545
1588
|
}
|
|
1546
|
-
e.
|
|
1589
|
+
e.Se = clock;
|
|
1547
1590
|
insertSubs(e, n);
|
|
1548
1591
|
schedule();
|
|
1549
1592
|
return t;
|
|
@@ -1563,8 +1606,8 @@ function runWithOwner(e, t) {
|
|
|
1563
1606
|
function getPendingSignal(e) {
|
|
1564
1607
|
if (!e.Qe) {
|
|
1565
1608
|
e.Qe = optimisticSignal(false, { pureWrite: true });
|
|
1566
|
-
if (e.
|
|
1567
|
-
e.Qe.
|
|
1609
|
+
if (e.he) {
|
|
1610
|
+
e.Qe.he = e;
|
|
1568
1611
|
}
|
|
1569
1612
|
if (computePendingState(e)) setSignal(e.Qe, true);
|
|
1570
1613
|
}
|
|
@@ -1573,38 +1616,38 @@ function getPendingSignal(e) {
|
|
|
1573
1616
|
function computePendingState(e) {
|
|
1574
1617
|
const t = e;
|
|
1575
1618
|
const n = e.V;
|
|
1576
|
-
if (n && e.
|
|
1577
|
-
return !n.
|
|
1619
|
+
if (n && e.te !== NOT_PENDING) {
|
|
1620
|
+
return !n.De && !(n._e & STATUS_PENDING);
|
|
1578
1621
|
}
|
|
1579
|
-
if (e.
|
|
1580
|
-
if (t.
|
|
1581
|
-
if (e.
|
|
1582
|
-
const t = e.
|
|
1583
|
-
return !!(t && t.
|
|
1622
|
+
if (e.ie !== undefined && e.ie !== NOT_PENDING) {
|
|
1623
|
+
if (t._e & STATUS_PENDING && !(t._e & STATUS_UNINITIALIZED)) return true;
|
|
1624
|
+
if (e.he) {
|
|
1625
|
+
const t = e.ee ? findLane(e.ee) : null;
|
|
1626
|
+
return !!(t && t.H.size > 0);
|
|
1584
1627
|
}
|
|
1585
1628
|
return true;
|
|
1586
1629
|
}
|
|
1587
|
-
if (e.
|
|
1630
|
+
if (e.ie !== undefined && e.ie === NOT_PENDING && !e.he) {
|
|
1588
1631
|
return false;
|
|
1589
1632
|
}
|
|
1590
|
-
if (e.
|
|
1591
|
-
return !!(t.
|
|
1633
|
+
if (e.te !== NOT_PENDING && !(t._e & STATUS_UNINITIALIZED)) return true;
|
|
1634
|
+
return !!(t._e & STATUS_PENDING && !(t._e & STATUS_UNINITIALIZED));
|
|
1592
1635
|
}
|
|
1593
1636
|
function updatePendingSignal(e) {
|
|
1594
1637
|
if (e.Qe) {
|
|
1595
1638
|
const t = computePendingState(e);
|
|
1596
1639
|
const n = e.Qe;
|
|
1597
1640
|
setSignal(n, t);
|
|
1598
|
-
if (!t && n.
|
|
1641
|
+
if (!t && n.ee) {
|
|
1599
1642
|
const t = resolveLane(e);
|
|
1600
|
-
if (t && t.
|
|
1601
|
-
const e = findLane(n.
|
|
1643
|
+
if (t && t.H.size > 0) {
|
|
1644
|
+
const e = findLane(n.ee);
|
|
1602
1645
|
if (e !== t) {
|
|
1603
1646
|
mergeLanes(t, e);
|
|
1604
1647
|
}
|
|
1605
1648
|
}
|
|
1606
1649
|
signalLanes.delete(n);
|
|
1607
|
-
n.
|
|
1650
|
+
n.ee = undefined;
|
|
1608
1651
|
}
|
|
1609
1652
|
}
|
|
1610
1653
|
}
|
|
@@ -1617,7 +1660,7 @@ function getLatestValueComputed(e) {
|
|
|
1617
1660
|
const i = context;
|
|
1618
1661
|
context = null;
|
|
1619
1662
|
e.Ge = optimisticComputed(() => read(e));
|
|
1620
|
-
e.Ge.
|
|
1663
|
+
e.Ge.he = e;
|
|
1621
1664
|
context = i;
|
|
1622
1665
|
pendingCheckActive = n;
|
|
1623
1666
|
latestReadActive = t;
|
|
@@ -1683,7 +1726,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1683
1726
|
if (!t) {
|
|
1684
1727
|
throw new NoOwnerError();
|
|
1685
1728
|
}
|
|
1686
|
-
const n = hasContext(e, t) ? t.
|
|
1729
|
+
const n = hasContext(e, t) ? t.be[e.id] : e.defaultValue;
|
|
1687
1730
|
if (isUndefined(n)) {
|
|
1688
1731
|
throw new ContextNotFoundError();
|
|
1689
1732
|
}
|
|
@@ -1693,10 +1736,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1693
1736
|
if (!n) {
|
|
1694
1737
|
throw new NoOwnerError();
|
|
1695
1738
|
}
|
|
1696
|
-
n.
|
|
1739
|
+
n.be = { ...n.be, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1697
1740
|
}
|
|
1698
1741
|
function hasContext(e, t) {
|
|
1699
|
-
return !isUndefined(t?.
|
|
1742
|
+
return !isUndefined(t?.be[e.id]);
|
|
1700
1743
|
}
|
|
1701
1744
|
function isUndefined(e) {
|
|
1702
1745
|
return typeof e === "undefined";
|
|
@@ -1706,96 +1749,96 @@ function effect(e, t, n, i, r) {
|
|
|
1706
1749
|
const o = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
1707
1750
|
...r,
|
|
1708
1751
|
equals: () => {
|
|
1709
|
-
o
|
|
1710
|
-
if (s) o.
|
|
1752
|
+
o.$ = !o.Te;
|
|
1753
|
+
if (s) o.j.enqueue(o.M, runEffect.bind(o));
|
|
1711
1754
|
return false;
|
|
1712
1755
|
},
|
|
1713
1756
|
lazy: true
|
|
1714
1757
|
});
|
|
1715
|
-
o.
|
|
1716
|
-
o
|
|
1717
|
-
o
|
|
1718
|
-
o.
|
|
1719
|
-
o.
|
|
1720
|
-
o.
|
|
1721
|
-
const n = e !== undefined ? e : o.
|
|
1722
|
-
const i = t !== undefined ? t : o.
|
|
1758
|
+
o.Me = i;
|
|
1759
|
+
o.$e = t;
|
|
1760
|
+
o.je = n;
|
|
1761
|
+
o.Ke = undefined;
|
|
1762
|
+
o.M = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
1763
|
+
o.We = (e, t) => {
|
|
1764
|
+
const n = e !== undefined ? e : o._e;
|
|
1765
|
+
const i = t !== undefined ? t : o.Te;
|
|
1723
1766
|
if (n & STATUS_ERROR) {
|
|
1724
1767
|
let e = i;
|
|
1725
|
-
o.
|
|
1726
|
-
if (o.
|
|
1768
|
+
o.j.notify(o, STATUS_PENDING, 0);
|
|
1769
|
+
if (o.M === EFFECT_USER) {
|
|
1727
1770
|
try {
|
|
1728
|
-
return o
|
|
1729
|
-
? o
|
|
1730
|
-
o.
|
|
1731
|
-
o.
|
|
1771
|
+
return o.je
|
|
1772
|
+
? o.je(e, () => {
|
|
1773
|
+
o.Ke?.();
|
|
1774
|
+
o.Ke = undefined;
|
|
1732
1775
|
})
|
|
1733
1776
|
: console.error(e);
|
|
1734
1777
|
} catch (t) {
|
|
1735
1778
|
e = t;
|
|
1736
1779
|
}
|
|
1737
1780
|
}
|
|
1738
|
-
if (!o.
|
|
1739
|
-
} else if (o.
|
|
1740
|
-
o.
|
|
1781
|
+
if (!o.j.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1782
|
+
} else if (o.M === EFFECT_RENDER) {
|
|
1783
|
+
o.j.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
1741
1784
|
}
|
|
1742
1785
|
};
|
|
1743
1786
|
recompute(o, true);
|
|
1744
|
-
!r?.defer && (o.
|
|
1787
|
+
!r?.defer && (o.M === EFFECT_USER ? o.j.enqueue(o.M, runEffect.bind(o)) : runEffect.call(o));
|
|
1745
1788
|
s = true;
|
|
1746
|
-
cleanup(() => o.
|
|
1789
|
+
cleanup(() => o.Ke?.());
|
|
1747
1790
|
}
|
|
1748
1791
|
function runEffect() {
|
|
1749
|
-
if (!this
|
|
1750
|
-
this.
|
|
1751
|
-
this.
|
|
1792
|
+
if (!this.$ || this.O & REACTIVE_DISPOSED) return;
|
|
1793
|
+
this.Ke?.();
|
|
1794
|
+
this.Ke = undefined;
|
|
1752
1795
|
try {
|
|
1753
|
-
const e = this
|
|
1796
|
+
const e = this.$e(this.ne, this.Me);
|
|
1754
1797
|
if (false && e !== undefined && typeof e !== "function");
|
|
1755
|
-
this.
|
|
1798
|
+
this.Ke = e;
|
|
1756
1799
|
} catch (e) {
|
|
1757
|
-
this.
|
|
1758
|
-
this.
|
|
1759
|
-
if (!this.
|
|
1800
|
+
this.Te = new StatusError(this, e);
|
|
1801
|
+
this._e |= STATUS_ERROR;
|
|
1802
|
+
if (!this.j.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1760
1803
|
} finally {
|
|
1761
|
-
this.
|
|
1762
|
-
this
|
|
1804
|
+
this.Me = this.ne;
|
|
1805
|
+
this.$ = false;
|
|
1763
1806
|
}
|
|
1764
1807
|
}
|
|
1765
1808
|
function trackedEffect(e, t) {
|
|
1766
1809
|
const run = () => {
|
|
1767
|
-
if (!n
|
|
1810
|
+
if (!n.$ || n.O & REACTIVE_DISPOSED) return;
|
|
1768
1811
|
try {
|
|
1769
|
-
n
|
|
1812
|
+
n.$ = false;
|
|
1770
1813
|
recompute(n);
|
|
1771
1814
|
} finally {
|
|
1772
1815
|
}
|
|
1773
1816
|
};
|
|
1774
1817
|
const n = computed(
|
|
1775
1818
|
() => {
|
|
1776
|
-
n.
|
|
1777
|
-
n.
|
|
1819
|
+
n.Ke?.();
|
|
1820
|
+
n.Ke = undefined;
|
|
1778
1821
|
const t = staleValues(e);
|
|
1779
|
-
n.
|
|
1822
|
+
n.Ke = t;
|
|
1780
1823
|
},
|
|
1781
1824
|
undefined,
|
|
1782
1825
|
{ ...t, lazy: true }
|
|
1783
1826
|
);
|
|
1784
|
-
n.
|
|
1785
|
-
n.
|
|
1786
|
-
n
|
|
1787
|
-
n.
|
|
1788
|
-
n.
|
|
1789
|
-
const i = e !== undefined ? e : n.
|
|
1827
|
+
n.Ke = undefined;
|
|
1828
|
+
n.Ye = true;
|
|
1829
|
+
n.$ = true;
|
|
1830
|
+
n.M = EFFECT_TRACKED;
|
|
1831
|
+
n.We = (e, t) => {
|
|
1832
|
+
const i = e !== undefined ? e : n._e;
|
|
1790
1833
|
if (i & STATUS_ERROR) {
|
|
1791
|
-
n.
|
|
1792
|
-
const e = t !== undefined ? t : n.
|
|
1793
|
-
if (!n.
|
|
1834
|
+
n.j.notify(n, STATUS_PENDING, 0);
|
|
1835
|
+
const e = t !== undefined ? t : n.Te;
|
|
1836
|
+
if (!n.j.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1794
1837
|
}
|
|
1795
1838
|
};
|
|
1796
|
-
n.
|
|
1797
|
-
n.
|
|
1798
|
-
cleanup(() => n.
|
|
1839
|
+
n.K = run;
|
|
1840
|
+
n.j.enqueue(EFFECT_USER, run);
|
|
1841
|
+
cleanup(() => n.Ke?.());
|
|
1799
1842
|
}
|
|
1800
1843
|
function restoreTransition(e, t) {
|
|
1801
1844
|
globalQueue.initTransition(e);
|
|
@@ -1809,11 +1852,11 @@ function action(e) {
|
|
|
1809
1852
|
const r = e(...t);
|
|
1810
1853
|
globalQueue.initTransition();
|
|
1811
1854
|
let s = activeTransition;
|
|
1812
|
-
s.
|
|
1855
|
+
s.Z.push(r);
|
|
1813
1856
|
const done = (e, t) => {
|
|
1814
1857
|
s = currentTransition(s);
|
|
1815
|
-
const o = s.
|
|
1816
|
-
if (o >= 0) s.
|
|
1858
|
+
const o = s.Z.indexOf(r);
|
|
1859
|
+
if (o >= 0) s.Z.splice(o, 1);
|
|
1817
1860
|
setActiveTransition(s);
|
|
1818
1861
|
schedule();
|
|
1819
1862
|
t ? i(t) : n(e);
|
|
@@ -1908,12 +1951,16 @@ function resolve(e) {
|
|
|
1908
1951
|
});
|
|
1909
1952
|
}
|
|
1910
1953
|
function createOptimistic(e, t, n) {
|
|
1911
|
-
|
|
1954
|
+
if (typeof e === "function") {
|
|
1955
|
+
const i = optimisticComputed(e, t, n);
|
|
1956
|
+
return [accessor(i), setSignal.bind(null, i)];
|
|
1957
|
+
}
|
|
1958
|
+
const i = optimisticSignal(e, t);
|
|
1912
1959
|
return [accessor(i), setSignal.bind(null, i)];
|
|
1913
1960
|
}
|
|
1914
1961
|
function onSettled(e) {
|
|
1915
1962
|
const t = getOwner();
|
|
1916
|
-
t && !t.
|
|
1963
|
+
t && !t.Ye
|
|
1917
1964
|
? createTrackedEffect(() => untrack(e), undefined)
|
|
1918
1965
|
: globalQueue.enqueue(EFFECT_USER, () => {
|
|
1919
1966
|
const t = e();
|
|
@@ -1947,67 +1994,67 @@ function applyState(e, t, n) {
|
|
|
1947
1994
|
let t = false;
|
|
1948
1995
|
const c = getOverrideValue(r, s, u, "length", o);
|
|
1949
1996
|
if (e.length && c && e[0] && n(e[0]) != null) {
|
|
1950
|
-
let a,
|
|
1997
|
+
let a, l, f, E, d, T, S, R;
|
|
1951
1998
|
for (
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
((T = getOverrideValue(r, s, u,
|
|
1955
|
-
|
|
1999
|
+
f = 0, E = Math.min(c, e.length);
|
|
2000
|
+
f < E &&
|
|
2001
|
+
((T = getOverrideValue(r, s, u, f, o)) === e[f] || (T && e[f] && n(T) === n(e[f])));
|
|
2002
|
+
f++
|
|
1956
2003
|
) {
|
|
1957
|
-
applyState(e[
|
|
2004
|
+
applyState(e[f], wrap(T, i), n);
|
|
1958
2005
|
}
|
|
1959
2006
|
const O = new Array(e.length),
|
|
1960
2007
|
_ = new Map();
|
|
1961
2008
|
for (
|
|
1962
2009
|
E = c - 1, d = e.length - 1;
|
|
1963
|
-
E >=
|
|
1964
|
-
d >=
|
|
2010
|
+
E >= f &&
|
|
2011
|
+
d >= f &&
|
|
1965
2012
|
((T = getOverrideValue(r, s, u, E, o)) === e[d] || (T && e[d] && n(T) === n(e[d])));
|
|
1966
2013
|
E--, d--
|
|
1967
2014
|
) {
|
|
1968
2015
|
O[d] = T;
|
|
1969
2016
|
}
|
|
1970
|
-
if (
|
|
1971
|
-
for (
|
|
2017
|
+
if (f > d || f > E) {
|
|
2018
|
+
for (l = f; l <= d; l++) {
|
|
1972
2019
|
t = true;
|
|
1973
|
-
i[STORE_NODE][
|
|
2020
|
+
i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
|
|
1974
2021
|
}
|
|
1975
|
-
for (;
|
|
2022
|
+
for (; l < e.length; l++) {
|
|
1976
2023
|
t = true;
|
|
1977
|
-
const r = wrap(O[
|
|
1978
|
-
i[STORE_NODE][
|
|
1979
|
-
applyState(e[
|
|
2024
|
+
const r = wrap(O[l], i);
|
|
2025
|
+
i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], r);
|
|
2026
|
+
applyState(e[l], r, n);
|
|
1980
2027
|
}
|
|
1981
2028
|
t && i[STORE_NODE][$TRACK] && setSignal(i[STORE_NODE][$TRACK], void 0);
|
|
1982
2029
|
c !== e.length && i[STORE_NODE].length && setSignal(i[STORE_NODE].length, e.length);
|
|
1983
2030
|
return;
|
|
1984
2031
|
}
|
|
1985
2032
|
S = new Array(d + 1);
|
|
1986
|
-
for (
|
|
1987
|
-
T = e[
|
|
2033
|
+
for (l = d; l >= f; l--) {
|
|
2034
|
+
T = e[l];
|
|
1988
2035
|
R = T ? n(T) : T;
|
|
1989
2036
|
a = _.get(R);
|
|
1990
|
-
S[
|
|
1991
|
-
_.set(R,
|
|
2037
|
+
S[l] = a === undefined ? -1 : a;
|
|
2038
|
+
_.set(R, l);
|
|
1992
2039
|
}
|
|
1993
|
-
for (a =
|
|
2040
|
+
for (a = f; a <= E; a++) {
|
|
1994
2041
|
T = getOverrideValue(r, s, u, a, o);
|
|
1995
2042
|
R = T ? n(T) : T;
|
|
1996
|
-
|
|
1997
|
-
if (
|
|
1998
|
-
O[
|
|
1999
|
-
|
|
2000
|
-
_.set(R,
|
|
2043
|
+
l = _.get(R);
|
|
2044
|
+
if (l !== undefined && l !== -1) {
|
|
2045
|
+
O[l] = T;
|
|
2046
|
+
l = S[l];
|
|
2047
|
+
_.set(R, l);
|
|
2001
2048
|
}
|
|
2002
2049
|
}
|
|
2003
|
-
for (
|
|
2004
|
-
if (
|
|
2005
|
-
const t = wrap(O[
|
|
2006
|
-
i[STORE_NODE][
|
|
2007
|
-
applyState(e[
|
|
2008
|
-
} else i[STORE_NODE][
|
|
2050
|
+
for (l = f; l < e.length; l++) {
|
|
2051
|
+
if (l in O) {
|
|
2052
|
+
const t = wrap(O[l], i);
|
|
2053
|
+
i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], t);
|
|
2054
|
+
applyState(e[l], t, n);
|
|
2055
|
+
} else i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
|
|
2009
2056
|
}
|
|
2010
|
-
if (
|
|
2057
|
+
if (f < e.length) t = true;
|
|
2011
2058
|
} else if (e.length) {
|
|
2012
2059
|
for (let t = 0, c = e.length; t < c; t++) {
|
|
2013
2060
|
const c = getOverrideValue(r, s, u, t, o);
|
|
@@ -2026,15 +2073,15 @@ function applyState(e, t, n) {
|
|
|
2026
2073
|
if (u) {
|
|
2027
2074
|
const t = u[$TRACK];
|
|
2028
2075
|
const c = t ? getAllKeys(r, s, e) : Object.keys(u);
|
|
2029
|
-
for (let a = 0,
|
|
2030
|
-
const
|
|
2031
|
-
const
|
|
2032
|
-
const E = unwrap(getOverrideValue(r, s, u,
|
|
2033
|
-
let d = unwrap(e[
|
|
2076
|
+
for (let a = 0, l = c.length; a < l; a++) {
|
|
2077
|
+
const l = c[a];
|
|
2078
|
+
const f = u[l];
|
|
2079
|
+
const E = unwrap(getOverrideValue(r, s, u, l, o));
|
|
2080
|
+
let d = unwrap(e[l]);
|
|
2034
2081
|
if (E === d) continue;
|
|
2035
2082
|
if (!E || !isWrappable(E) || !isWrappable(d) || (n(E) != null && n(E) !== n(d))) {
|
|
2036
2083
|
t && setSignal(t, void 0);
|
|
2037
|
-
|
|
2084
|
+
f && setSignal(f, isWrappable(d) ? wrap(d, i) : d);
|
|
2038
2085
|
} else applyState(d, wrap(E, i), n);
|
|
2039
2086
|
}
|
|
2040
2087
|
}
|
|
@@ -2083,7 +2130,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2083
2130
|
let r;
|
|
2084
2131
|
const o = new Proxy(
|
|
2085
2132
|
s,
|
|
2086
|
-
createWriteTraps(() => !i || t.
|
|
2133
|
+
createWriteTraps(() => !i || t.De === r)
|
|
2087
2134
|
);
|
|
2088
2135
|
storeSetter(o, o => {
|
|
2089
2136
|
r = e(o);
|
|
@@ -2094,7 +2141,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2094
2141
|
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2095
2142
|
});
|
|
2096
2143
|
});
|
|
2097
|
-
i.
|
|
2144
|
+
i.Pe = true;
|
|
2098
2145
|
return { store: s, node: i };
|
|
2099
2146
|
}
|
|
2100
2147
|
function createProjection(e, t = {}, n) {
|
|
@@ -2215,11 +2262,11 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
|
2215
2262
|
i
|
|
2216
2263
|
);
|
|
2217
2264
|
if (s) {
|
|
2218
|
-
u.
|
|
2265
|
+
u.ie = NOT_PENDING;
|
|
2219
2266
|
}
|
|
2220
2267
|
if (o && t in o) {
|
|
2221
2268
|
const e = o[t];
|
|
2222
|
-
u.
|
|
2269
|
+
u.Re = e === undefined ? NO_SNAPSHOT : e;
|
|
2223
2270
|
snapshotSources?.add(u);
|
|
2224
2271
|
}
|
|
2225
2272
|
return (e[t] = u);
|
|
@@ -2276,11 +2323,11 @@ const storeTraps = {
|
|
|
2276
2323
|
if (writeOnly(n)) {
|
|
2277
2324
|
let n =
|
|
2278
2325
|
r && (o || !u)
|
|
2279
|
-
? r.
|
|
2280
|
-
? r.
|
|
2281
|
-
: r.
|
|
2282
|
-
? r.
|
|
2283
|
-
: r.
|
|
2326
|
+
? r.ie !== undefined && r.ie !== NOT_PENDING
|
|
2327
|
+
? r.ie
|
|
2328
|
+
: r.te !== NOT_PENDING
|
|
2329
|
+
? r.te
|
|
2330
|
+
: r.ne
|
|
2284
2331
|
: c[t];
|
|
2285
2332
|
n === $DELETED && (n = undefined);
|
|
2286
2333
|
if (!isWrappable(n)) return n;
|
|
@@ -2335,8 +2382,8 @@ const storeTraps = {
|
|
|
2335
2382
|
if (writeOnly(i)) {
|
|
2336
2383
|
if (e[STORE_OPTIMISTIC]) {
|
|
2337
2384
|
const t = e[STORE_FIREWALL];
|
|
2338
|
-
if (t?.
|
|
2339
|
-
globalQueue.initTransition(t.
|
|
2385
|
+
if (t?.B) {
|
|
2386
|
+
globalQueue.initTransition(t.B);
|
|
2340
2387
|
}
|
|
2341
2388
|
}
|
|
2342
2389
|
untrack(() => {
|
|
@@ -2345,7 +2392,7 @@ const storeTraps = {
|
|
|
2345
2392
|
if (
|
|
2346
2393
|
snapshotCaptureActive &&
|
|
2347
2394
|
typeof t !== "symbol" &&
|
|
2348
|
-
!((e[STORE_FIREWALL]?.
|
|
2395
|
+
!((e[STORE_FIREWALL]?._e ?? 0) & STATUS_PENDING)
|
|
2349
2396
|
) {
|
|
2350
2397
|
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2351
2398
|
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
@@ -2365,16 +2412,16 @@ const storeTraps = {
|
|
|
2365
2412
|
? e[STORE_OVERRIDE][t]
|
|
2366
2413
|
: s;
|
|
2367
2414
|
const a = n?.[$TARGET]?.[STORE_VALUE] ?? n;
|
|
2368
|
-
const
|
|
2369
|
-
const
|
|
2415
|
+
const l = Array.isArray(r) && t !== "length";
|
|
2416
|
+
const f = l ? parseInt(t) + 1 : 0;
|
|
2370
2417
|
const E =
|
|
2371
|
-
|
|
2418
|
+
l &&
|
|
2372
2419
|
(e[STORE_OPTIMISTIC_OVERRIDE] && "length" in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2373
2420
|
? e[STORE_OPTIMISTIC_OVERRIDE].length
|
|
2374
2421
|
: e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
|
|
2375
2422
|
? e[STORE_OVERRIDE].length
|
|
2376
2423
|
: r.length);
|
|
2377
|
-
const d =
|
|
2424
|
+
const d = l && f > E ? f : undefined;
|
|
2378
2425
|
if (c === a && d === undefined) return true;
|
|
2379
2426
|
if (a !== undefined && a === s && d === undefined) delete e[u]?.[t];
|
|
2380
2427
|
else {
|
|
@@ -2391,6 +2438,7 @@ const storeTraps = {
|
|
|
2391
2438
|
e !== undefined && S.length && setSignal(S.length, e);
|
|
2392
2439
|
}
|
|
2393
2440
|
S[$TRACK] && setSignal(S[$TRACK], undefined);
|
|
2441
|
+
if (false);
|
|
2394
2442
|
});
|
|
2395
2443
|
}
|
|
2396
2444
|
return true;
|
|
@@ -2485,7 +2533,7 @@ function createStore(e, t, n) {
|
|
|
2485
2533
|
return [r, e => storeSetter(r, e)];
|
|
2486
2534
|
}
|
|
2487
2535
|
function createOptimisticStore(e, t, n) {
|
|
2488
|
-
GlobalQueue.
|
|
2536
|
+
GlobalQueue.fe ||= clearOptimisticStore;
|
|
2489
2537
|
const i = typeof e === "function";
|
|
2490
2538
|
const r = (i ? t : e) ?? {};
|
|
2491
2539
|
const s = i ? e : undefined;
|
|
@@ -2502,7 +2550,7 @@ function clearOptimisticStore(e) {
|
|
|
2502
2550
|
if (i) {
|
|
2503
2551
|
for (const e of Reflect.ownKeys(n)) {
|
|
2504
2552
|
if (i[e]) {
|
|
2505
|
-
i[e].
|
|
2553
|
+
i[e].ee = undefined;
|
|
2506
2554
|
const n =
|
|
2507
2555
|
t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
|
|
2508
2556
|
const r = n === $DELETED ? undefined : n;
|
|
@@ -2510,7 +2558,7 @@ function clearOptimisticStore(e) {
|
|
|
2510
2558
|
}
|
|
2511
2559
|
}
|
|
2512
2560
|
if (i[$TRACK]) {
|
|
2513
|
-
i[$TRACK].
|
|
2561
|
+
i[$TRACK].ee = undefined;
|
|
2514
2562
|
setSignal(i[$TRACK], undefined);
|
|
2515
2563
|
}
|
|
2516
2564
|
}
|
|
@@ -2548,7 +2596,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2548
2596
|
let r;
|
|
2549
2597
|
const o = new Proxy(
|
|
2550
2598
|
s,
|
|
2551
|
-
createWriteTraps(() => !i || t.
|
|
2599
|
+
createWriteTraps(() => !i || t.De === r)
|
|
2552
2600
|
);
|
|
2553
2601
|
setProjectionWriteActive(true);
|
|
2554
2602
|
try {
|
|
@@ -2569,7 +2617,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2569
2617
|
setProjectionWriteActive(false);
|
|
2570
2618
|
}
|
|
2571
2619
|
});
|
|
2572
|
-
i.
|
|
2620
|
+
i.Pe = true;
|
|
2573
2621
|
}
|
|
2574
2622
|
return { store: s, node: i };
|
|
2575
2623
|
}
|
|
@@ -2656,29 +2704,29 @@ function snapshotImpl(e, t, n, i) {
|
|
|
2656
2704
|
}
|
|
2657
2705
|
if (s) {
|
|
2658
2706
|
const s = o?.length || e.length;
|
|
2659
|
-
for (let
|
|
2660
|
-
a = o &&
|
|
2707
|
+
for (let l = 0; l < s; l++) {
|
|
2708
|
+
a = o && l in o ? o[l] : e[l];
|
|
2661
2709
|
if (a === $DELETED) continue;
|
|
2662
2710
|
if (t && isWrappable(a)) wrap(a, r);
|
|
2663
2711
|
if ((c = snapshotImpl(a, t, n, i)) !== a || u) {
|
|
2664
2712
|
if (!u) n.set(e, (u = [...e]));
|
|
2665
|
-
u[
|
|
2713
|
+
u[l] = c;
|
|
2666
2714
|
}
|
|
2667
2715
|
}
|
|
2668
2716
|
} else {
|
|
2669
2717
|
const s = getKeys(e, o);
|
|
2670
|
-
for (let
|
|
2671
|
-
let
|
|
2672
|
-
const E = getPropertyDescriptor(e, o,
|
|
2718
|
+
for (let l = 0, f = s.length; l < f; l++) {
|
|
2719
|
+
let f = s[l];
|
|
2720
|
+
const E = getPropertyDescriptor(e, o, f);
|
|
2673
2721
|
if (E.get) continue;
|
|
2674
|
-
a = o &&
|
|
2722
|
+
a = o && f in o ? o[f] : e[f];
|
|
2675
2723
|
if (t && isWrappable(a)) wrap(a, r);
|
|
2676
|
-
if ((c = snapshotImpl(a, t, n, i)) !== e[
|
|
2724
|
+
if ((c = snapshotImpl(a, t, n, i)) !== e[f] || u) {
|
|
2677
2725
|
if (!u) {
|
|
2678
2726
|
u = Object.create(Object.getPrototypeOf(e));
|
|
2679
2727
|
Object.assign(u, e);
|
|
2680
2728
|
}
|
|
2681
|
-
u[
|
|
2729
|
+
u[f] = c;
|
|
2682
2730
|
}
|
|
2683
2731
|
}
|
|
2684
2732
|
}
|
|
@@ -2826,321 +2874,454 @@ function mapArray(e, t, n) {
|
|
|
2826
2874
|
const s = t;
|
|
2827
2875
|
return createMemo(
|
|
2828
2876
|
updateKeyedMap.bind({
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
Xe: [],
|
|
2877
|
+
Ze: createOwner(),
|
|
2878
|
+
Be: 0,
|
|
2879
|
+
qe: e,
|
|
2880
|
+
ze: [],
|
|
2881
|
+
Xe: s,
|
|
2835
2882
|
Je: [],
|
|
2836
|
-
et:
|
|
2837
|
-
tt: i
|
|
2838
|
-
nt:
|
|
2839
|
-
it:
|
|
2883
|
+
et: [],
|
|
2884
|
+
tt: i,
|
|
2885
|
+
nt: i || n?.keyed === false ? [] : undefined,
|
|
2886
|
+
it: r ? [] : undefined,
|
|
2887
|
+
rt: n?.fallback
|
|
2840
2888
|
})
|
|
2841
2889
|
);
|
|
2842
2890
|
}
|
|
2843
2891
|
const pureOptions = { pureWrite: true };
|
|
2844
2892
|
function updateKeyedMap() {
|
|
2845
|
-
const e = this.
|
|
2893
|
+
const e = this.qe() || [],
|
|
2846
2894
|
t = e.length;
|
|
2847
2895
|
e[$TRACK];
|
|
2848
|
-
runWithOwner(this.
|
|
2896
|
+
runWithOwner(this.Ze, () => {
|
|
2849
2897
|
let n,
|
|
2850
2898
|
i,
|
|
2851
|
-
r = this.
|
|
2899
|
+
r = this.nt
|
|
2852
2900
|
? () => {
|
|
2853
|
-
this.
|
|
2854
|
-
this.
|
|
2855
|
-
return this.
|
|
2901
|
+
this.nt[i] = signal(e[i], pureOptions);
|
|
2902
|
+
this.it && (this.it[i] = signal(i, pureOptions));
|
|
2903
|
+
return this.Xe(accessor(this.nt[i]), this.it ? accessor(this.it[i]) : undefined);
|
|
2856
2904
|
}
|
|
2857
|
-
: this.
|
|
2905
|
+
: this.it
|
|
2858
2906
|
? () => {
|
|
2859
2907
|
const t = e[i];
|
|
2860
|
-
this.
|
|
2861
|
-
return this.
|
|
2908
|
+
this.it[i] = signal(i, pureOptions);
|
|
2909
|
+
return this.Xe(() => t, accessor(this.it[i]));
|
|
2862
2910
|
}
|
|
2863
2911
|
: () => {
|
|
2864
2912
|
const t = e[i];
|
|
2865
|
-
return this.
|
|
2913
|
+
return this.Xe(() => t);
|
|
2866
2914
|
};
|
|
2867
2915
|
if (t === 0) {
|
|
2868
|
-
if (this.
|
|
2869
|
-
this.
|
|
2916
|
+
if (this.Be !== 0) {
|
|
2917
|
+
this.Ze.dispose(false);
|
|
2918
|
+
this.et = [];
|
|
2919
|
+
this.ze = [];
|
|
2870
2920
|
this.Je = [];
|
|
2871
|
-
this.
|
|
2872
|
-
this.Xe = [];
|
|
2873
|
-
this.Ze = 0;
|
|
2874
|
-
this.tt && (this.tt = []);
|
|
2921
|
+
this.Be = 0;
|
|
2875
2922
|
this.nt && (this.nt = []);
|
|
2923
|
+
this.it && (this.it = []);
|
|
2876
2924
|
}
|
|
2877
|
-
if (this.
|
|
2878
|
-
this.
|
|
2925
|
+
if (this.rt && !this.Je[0]) {
|
|
2926
|
+
this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.rt);
|
|
2879
2927
|
}
|
|
2880
|
-
} else if (this.
|
|
2881
|
-
if (this.
|
|
2882
|
-
this.
|
|
2928
|
+
} else if (this.Be === 0) {
|
|
2929
|
+
if (this.et[0]) this.et[0].dispose();
|
|
2930
|
+
this.Je = new Array(t);
|
|
2883
2931
|
for (i = 0; i < t; i++) {
|
|
2884
|
-
this.
|
|
2885
|
-
this.
|
|
2932
|
+
this.ze[i] = e[i];
|
|
2933
|
+
this.Je[i] = runWithOwner((this.et[i] = createOwner()), r);
|
|
2886
2934
|
}
|
|
2887
|
-
this.
|
|
2935
|
+
this.Be = t;
|
|
2888
2936
|
} else {
|
|
2889
2937
|
let s,
|
|
2890
2938
|
o,
|
|
2891
2939
|
u,
|
|
2892
2940
|
c,
|
|
2893
2941
|
a,
|
|
2894
|
-
f,
|
|
2895
2942
|
l,
|
|
2943
|
+
f,
|
|
2896
2944
|
E = new Array(t),
|
|
2897
2945
|
d = new Array(t),
|
|
2898
|
-
T = this.
|
|
2899
|
-
S = this.
|
|
2946
|
+
T = this.nt ? new Array(t) : undefined,
|
|
2947
|
+
S = this.it ? new Array(t) : undefined;
|
|
2900
2948
|
for (
|
|
2901
|
-
s = 0, o = Math.min(this.
|
|
2902
|
-
s < o && (this.
|
|
2949
|
+
s = 0, o = Math.min(this.Be, t);
|
|
2950
|
+
s < o && (this.ze[s] === e[s] || (this.nt && compare(this.tt, this.ze[s], e[s])));
|
|
2903
2951
|
s++
|
|
2904
2952
|
) {
|
|
2905
|
-
if (this.
|
|
2953
|
+
if (this.nt) setSignal(this.nt[s], e[s]);
|
|
2906
2954
|
}
|
|
2907
2955
|
for (
|
|
2908
|
-
o = this.
|
|
2956
|
+
o = this.Be - 1, u = t - 1;
|
|
2909
2957
|
o >= s &&
|
|
2910
2958
|
u >= s &&
|
|
2911
|
-
(this.
|
|
2959
|
+
(this.ze[o] === e[u] || (this.nt && compare(this.tt, this.ze[o], e[u])));
|
|
2912
2960
|
o--, u--
|
|
2913
2961
|
) {
|
|
2914
|
-
E[u] = this.
|
|
2915
|
-
d[u] = this.
|
|
2916
|
-
T && (T[u] = this.
|
|
2917
|
-
S && (S[u] = this.
|
|
2962
|
+
E[u] = this.Je[o];
|
|
2963
|
+
d[u] = this.et[o];
|
|
2964
|
+
T && (T[u] = this.nt[o]);
|
|
2965
|
+
S && (S[u] = this.it[o]);
|
|
2918
2966
|
}
|
|
2919
|
-
|
|
2920
|
-
|
|
2967
|
+
l = new Map();
|
|
2968
|
+
f = new Array(u + 1);
|
|
2921
2969
|
for (i = u; i >= s; i--) {
|
|
2922
2970
|
c = e[i];
|
|
2923
|
-
a = this.
|
|
2924
|
-
n =
|
|
2925
|
-
|
|
2926
|
-
|
|
2971
|
+
a = this.tt ? this.tt(c) : c;
|
|
2972
|
+
n = l.get(a);
|
|
2973
|
+
f[i] = n === undefined ? -1 : n;
|
|
2974
|
+
l.set(a, i);
|
|
2927
2975
|
}
|
|
2928
2976
|
for (n = s; n <= o; n++) {
|
|
2929
|
-
c = this.
|
|
2930
|
-
a = this.
|
|
2931
|
-
i =
|
|
2977
|
+
c = this.ze[n];
|
|
2978
|
+
a = this.tt ? this.tt(c) : c;
|
|
2979
|
+
i = l.get(a);
|
|
2932
2980
|
if (i !== undefined && i !== -1) {
|
|
2933
|
-
E[i] = this.
|
|
2934
|
-
d[i] = this.
|
|
2935
|
-
T && (T[i] = this.
|
|
2936
|
-
S && (S[i] = this.
|
|
2937
|
-
i =
|
|
2938
|
-
|
|
2939
|
-
} else this.
|
|
2981
|
+
E[i] = this.Je[n];
|
|
2982
|
+
d[i] = this.et[n];
|
|
2983
|
+
T && (T[i] = this.nt[n]);
|
|
2984
|
+
S && (S[i] = this.it[n]);
|
|
2985
|
+
i = f[i];
|
|
2986
|
+
l.set(a, i);
|
|
2987
|
+
} else this.et[n].dispose();
|
|
2940
2988
|
}
|
|
2941
2989
|
for (i = s; i < t; i++) {
|
|
2942
2990
|
if (i in E) {
|
|
2943
|
-
this.
|
|
2944
|
-
this.
|
|
2991
|
+
this.Je[i] = E[i];
|
|
2992
|
+
this.et[i] = d[i];
|
|
2945
2993
|
if (T) {
|
|
2946
|
-
this.
|
|
2947
|
-
setSignal(this.
|
|
2994
|
+
this.nt[i] = T[i];
|
|
2995
|
+
setSignal(this.nt[i], e[i]);
|
|
2948
2996
|
}
|
|
2949
2997
|
if (S) {
|
|
2950
|
-
this.
|
|
2951
|
-
setSignal(this.
|
|
2998
|
+
this.it[i] = S[i];
|
|
2999
|
+
setSignal(this.it[i], i);
|
|
2952
3000
|
}
|
|
2953
3001
|
} else {
|
|
2954
|
-
this.
|
|
3002
|
+
this.Je[i] = runWithOwner((this.et[i] = createOwner()), r);
|
|
2955
3003
|
}
|
|
2956
3004
|
}
|
|
2957
|
-
this.
|
|
2958
|
-
this.
|
|
3005
|
+
this.Je = this.Je.slice(0, (this.Be = t));
|
|
3006
|
+
this.ze = e.slice(0);
|
|
2959
3007
|
}
|
|
2960
3008
|
});
|
|
2961
|
-
return this.
|
|
3009
|
+
return this.Je;
|
|
2962
3010
|
}
|
|
2963
3011
|
function repeat(e, t, n) {
|
|
2964
3012
|
const i = t;
|
|
2965
3013
|
return updateRepeat.bind({
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
3014
|
+
Ze: createOwner(),
|
|
3015
|
+
Be: 0,
|
|
3016
|
+
st: 0,
|
|
3017
|
+
ot: e,
|
|
3018
|
+
Xe: i,
|
|
3019
|
+
et: [],
|
|
2971
3020
|
Je: [],
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
it: n?.fallback
|
|
3021
|
+
ut: n?.from,
|
|
3022
|
+
rt: n?.fallback
|
|
2975
3023
|
});
|
|
2976
3024
|
}
|
|
2977
3025
|
function updateRepeat() {
|
|
2978
|
-
const e = this.
|
|
2979
|
-
const t = this.
|
|
2980
|
-
runWithOwner(this.
|
|
3026
|
+
const e = this.ot();
|
|
3027
|
+
const t = this.ut?.() || 0;
|
|
3028
|
+
runWithOwner(this.Ze, () => {
|
|
2981
3029
|
if (e === 0) {
|
|
2982
|
-
if (this.
|
|
2983
|
-
this.
|
|
3030
|
+
if (this.Be !== 0) {
|
|
3031
|
+
this.Ze.dispose(false);
|
|
3032
|
+
this.et = [];
|
|
2984
3033
|
this.Je = [];
|
|
2985
|
-
this.
|
|
2986
|
-
this.Ze = 0;
|
|
3034
|
+
this.Be = 0;
|
|
2987
3035
|
}
|
|
2988
|
-
if (this.
|
|
2989
|
-
this.
|
|
3036
|
+
if (this.rt && !this.Je[0]) {
|
|
3037
|
+
this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.rt);
|
|
2990
3038
|
}
|
|
2991
3039
|
return;
|
|
2992
3040
|
}
|
|
2993
3041
|
const n = t + e;
|
|
2994
|
-
const i = this.
|
|
2995
|
-
if (this.
|
|
2996
|
-
for (let e = n; e < i; e++) this.
|
|
2997
|
-
if (this.
|
|
2998
|
-
let e = this.
|
|
2999
|
-
while (e < t && e < this.
|
|
3000
|
-
this.
|
|
3001
|
-
this.
|
|
3002
|
-
} else if (this.
|
|
3003
|
-
let n = i - this.
|
|
3004
|
-
let r = this.
|
|
3005
|
-
this.
|
|
3042
|
+
const i = this.st + this.Be;
|
|
3043
|
+
if (this.Be === 0 && this.et[0]) this.et[0].dispose();
|
|
3044
|
+
for (let e = n; e < i; e++) this.et[e - this.st].dispose();
|
|
3045
|
+
if (this.st < t) {
|
|
3046
|
+
let e = this.st;
|
|
3047
|
+
while (e < t && e < this.Be) this.et[e++].dispose();
|
|
3048
|
+
this.et.splice(0, t - this.st);
|
|
3049
|
+
this.Je.splice(0, t - this.st);
|
|
3050
|
+
} else if (this.st > t) {
|
|
3051
|
+
let n = i - this.st - 1;
|
|
3052
|
+
let r = this.st - t;
|
|
3053
|
+
this.et.length = this.Je.length = e;
|
|
3006
3054
|
while (n >= r) {
|
|
3055
|
+
this.et[n] = this.et[n - r];
|
|
3007
3056
|
this.Je[n] = this.Je[n - r];
|
|
3008
|
-
this.Xe[n] = this.Xe[n - r];
|
|
3009
3057
|
n--;
|
|
3010
3058
|
}
|
|
3011
3059
|
for (let e = 0; e < r; e++) {
|
|
3012
|
-
this.
|
|
3060
|
+
this.Je[e] = runWithOwner((this.et[e] = createOwner()), () => this.Xe(e + t));
|
|
3013
3061
|
}
|
|
3014
3062
|
}
|
|
3015
3063
|
for (let e = i; e < n; e++) {
|
|
3016
|
-
this.
|
|
3064
|
+
this.Je[e - t] = runWithOwner((this.et[e - t] = createOwner()), () => this.Xe(e));
|
|
3017
3065
|
}
|
|
3018
|
-
this.
|
|
3019
|
-
this.
|
|
3020
|
-
this.
|
|
3066
|
+
this.Je = this.Je.slice(0, e);
|
|
3067
|
+
this.st = t;
|
|
3068
|
+
this.Be = e;
|
|
3021
3069
|
});
|
|
3022
|
-
return this.
|
|
3070
|
+
return this.Je;
|
|
3023
3071
|
}
|
|
3024
3072
|
function compare(e, t, n) {
|
|
3025
3073
|
return e ? e(t) === e(n) : true;
|
|
3026
3074
|
}
|
|
3027
3075
|
function boundaryComputed(e, t) {
|
|
3028
3076
|
const n = computed(e, undefined, { lazy: true });
|
|
3029
|
-
n.
|
|
3030
|
-
const i = e !== undefined ? e : n.
|
|
3031
|
-
const r = t !== undefined ? t : n.
|
|
3032
|
-
n.
|
|
3033
|
-
n.
|
|
3077
|
+
n.We = (e, t) => {
|
|
3078
|
+
const i = e !== undefined ? e : n._e;
|
|
3079
|
+
const r = t !== undefined ? t : n.Te;
|
|
3080
|
+
n._e &= ~n.ct;
|
|
3081
|
+
n.j.notify(n, n.ct, i, r);
|
|
3034
3082
|
};
|
|
3035
|
-
n.
|
|
3036
|
-
n.
|
|
3083
|
+
n.ct = t;
|
|
3084
|
+
n.Pe = true;
|
|
3037
3085
|
recompute(n, true);
|
|
3038
3086
|
return n;
|
|
3039
3087
|
}
|
|
3040
3088
|
function createBoundChildren(e, t, n, i) {
|
|
3041
|
-
const r = e.
|
|
3042
|
-
r.addChild((e.
|
|
3043
|
-
cleanup(() => r.removeChild(e.
|
|
3089
|
+
const r = e.j;
|
|
3090
|
+
r.addChild((e.j = n));
|
|
3091
|
+
cleanup(() => r.removeChild(e.j));
|
|
3044
3092
|
return runWithOwner(e, () => {
|
|
3045
3093
|
const e = computed(t);
|
|
3046
3094
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
3047
3095
|
});
|
|
3048
3096
|
}
|
|
3049
3097
|
const ON_INIT = Symbol();
|
|
3098
|
+
const RevealControllerContext = createContext(null);
|
|
3099
|
+
let _revealUsed = false;
|
|
3100
|
+
const FALSE_ACCESSOR = () => false;
|
|
3101
|
+
function isRevealController(e) {
|
|
3102
|
+
return e instanceof RevealController;
|
|
3103
|
+
}
|
|
3104
|
+
function isSlotReady(e) {
|
|
3105
|
+
return isRevealController(e) ? e.isReady() : e.lt.size === 0 && !e.ft;
|
|
3106
|
+
}
|
|
3107
|
+
function setSlotState(e, t, n, i) {
|
|
3108
|
+
setSignal(e.Et, n);
|
|
3109
|
+
setSignal(e.dt, i);
|
|
3110
|
+
if (isRevealController(e)) {
|
|
3111
|
+
if (!n && e.Tt === t) e.Tt = undefined;
|
|
3112
|
+
return e.evaluate(n, i);
|
|
3113
|
+
}
|
|
3114
|
+
if (!n && e.St === t && e.Rt) e.St = undefined;
|
|
3115
|
+
}
|
|
3116
|
+
class RevealController {
|
|
3117
|
+
Ot;
|
|
3118
|
+
_t;
|
|
3119
|
+
ht = [];
|
|
3120
|
+
Tt;
|
|
3121
|
+
Et = signal(false, { pureWrite: true, Fe: true });
|
|
3122
|
+
dt = signal(false, { pureWrite: true, Fe: true });
|
|
3123
|
+
It = true;
|
|
3124
|
+
At = false;
|
|
3125
|
+
constructor(e, t) {
|
|
3126
|
+
this.Ot = e;
|
|
3127
|
+
this._t = t;
|
|
3128
|
+
}
|
|
3129
|
+
gt(e) {
|
|
3130
|
+
for (let t = 0; t < this.ht.length; t++) {
|
|
3131
|
+
const n = this.ht[t];
|
|
3132
|
+
if ((isRevealController(n) ? n.Tt : n.St) !== this) continue;
|
|
3133
|
+
if (e(n) === false) return false;
|
|
3134
|
+
}
|
|
3135
|
+
return true;
|
|
3136
|
+
}
|
|
3137
|
+
isReady() {
|
|
3138
|
+
return this.gt(isSlotReady);
|
|
3139
|
+
}
|
|
3140
|
+
register(e) {
|
|
3141
|
+
if (this.ht.includes(e)) return;
|
|
3142
|
+
this.ht.push(e);
|
|
3143
|
+
const t = !!untrack(this.Ot);
|
|
3144
|
+
setSignal(e.Et, true), setSignal(e.dt, t ? false : !!untrack(this._t));
|
|
3145
|
+
untrack(() => this.evaluate());
|
|
3146
|
+
}
|
|
3147
|
+
unregister(e) {
|
|
3148
|
+
const t = this.ht.indexOf(e);
|
|
3149
|
+
if (t >= 0) this.ht.splice(t, 1);
|
|
3150
|
+
untrack(() => this.evaluate());
|
|
3151
|
+
}
|
|
3152
|
+
evaluate(e, t) {
|
|
3153
|
+
if (this.At) return;
|
|
3154
|
+
this.At = true;
|
|
3155
|
+
const n = this.It;
|
|
3156
|
+
try {
|
|
3157
|
+
const n = e ?? read(this.Et),
|
|
3158
|
+
i = !!untrack(this._t),
|
|
3159
|
+
r = t ?? i;
|
|
3160
|
+
if (n && r) this.gt(e => setSlotState(e, this, true, true));
|
|
3161
|
+
else if (!!untrack(this.Ot)) {
|
|
3162
|
+
const e = this.isReady();
|
|
3163
|
+
this.gt(t => setSlotState(t, this, !e, false));
|
|
3164
|
+
} else {
|
|
3165
|
+
let e = false;
|
|
3166
|
+
this.gt(t => {
|
|
3167
|
+
if (e) return setSlotState(t, this, true, i);
|
|
3168
|
+
if (isSlotReady(t)) return setSlotState(t, this, false, false);
|
|
3169
|
+
e = true;
|
|
3170
|
+
setSlotState(t, this, true, false);
|
|
3171
|
+
});
|
|
3172
|
+
}
|
|
3173
|
+
} finally {
|
|
3174
|
+
this.It = this.isReady();
|
|
3175
|
+
this.At = false;
|
|
3176
|
+
}
|
|
3177
|
+
if (this.Tt && n !== this.It) this.Tt.evaluate();
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3050
3180
|
class CollectionQueue extends Queue {
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3181
|
+
Nt;
|
|
3182
|
+
lt = new Set();
|
|
3183
|
+
Pt;
|
|
3184
|
+
ft = true;
|
|
3185
|
+
Et = signal(false, { pureWrite: true, Fe: true });
|
|
3186
|
+
dt = signal(false, { pureWrite: true, Fe: true });
|
|
3187
|
+
St;
|
|
3188
|
+
Rt = false;
|
|
3189
|
+
Ct;
|
|
3190
|
+
Dt = ON_INIT;
|
|
3057
3191
|
constructor(e) {
|
|
3058
3192
|
super();
|
|
3059
|
-
this.
|
|
3193
|
+
this.Nt = e;
|
|
3060
3194
|
}
|
|
3061
3195
|
run(e) {
|
|
3062
|
-
if (!e || read(this.
|
|
3196
|
+
if (!e || (read(this.Et) && (!_revealUsed || read(this.dt)))) return;
|
|
3063
3197
|
return super.run(e);
|
|
3064
3198
|
}
|
|
3065
3199
|
notify(e, t, n, i) {
|
|
3066
|
-
if (!(t & this.
|
|
3067
|
-
if (this.
|
|
3200
|
+
if (!(t & this.Nt)) return super.notify(e, t, n, i);
|
|
3201
|
+
if (this.Rt && this.Ct) {
|
|
3068
3202
|
const e = untrack(() => {
|
|
3069
3203
|
try {
|
|
3070
|
-
return this.
|
|
3204
|
+
return this.Ct();
|
|
3071
3205
|
} catch {
|
|
3072
3206
|
return ON_INIT;
|
|
3073
3207
|
}
|
|
3074
3208
|
});
|
|
3075
|
-
if (e !== this.
|
|
3076
|
-
this.
|
|
3077
|
-
this.
|
|
3078
|
-
this.
|
|
3209
|
+
if (e !== this.Dt) {
|
|
3210
|
+
this.Dt = e;
|
|
3211
|
+
this.Rt = false;
|
|
3212
|
+
this.lt.clear();
|
|
3079
3213
|
}
|
|
3080
3214
|
}
|
|
3081
|
-
if (this.
|
|
3082
|
-
if (this.
|
|
3215
|
+
if (this.Nt & STATUS_PENDING && this.Rt) return super.notify(e, t, n, i);
|
|
3216
|
+
if (this.Nt & STATUS_PENDING && n & STATUS_ERROR) {
|
|
3083
3217
|
return super.notify(e, STATUS_ERROR, n, i);
|
|
3084
3218
|
}
|
|
3085
|
-
if (n & this.
|
|
3086
|
-
|
|
3219
|
+
if (n & this.Nt) {
|
|
3220
|
+
this.ft = true;
|
|
3221
|
+
const t = i?.source || e.Te?.source;
|
|
3087
3222
|
if (t) {
|
|
3088
|
-
const e = this.
|
|
3089
|
-
this.
|
|
3090
|
-
if (e) setSignal(this.
|
|
3223
|
+
const e = this.lt.size === 0;
|
|
3224
|
+
this.lt.add(t);
|
|
3225
|
+
if (e) setSignal(this.Et, true);
|
|
3091
3226
|
}
|
|
3092
3227
|
}
|
|
3093
|
-
t &= ~this.
|
|
3228
|
+
t &= ~this.Nt;
|
|
3094
3229
|
return t ? super.notify(e, t, n, i) : true;
|
|
3095
3230
|
}
|
|
3096
3231
|
checkSources() {
|
|
3097
|
-
for (const e of this.
|
|
3232
|
+
for (const e of this.lt) {
|
|
3098
3233
|
if (
|
|
3099
3234
|
e.O & REACTIVE_DISPOSED ||
|
|
3100
|
-
(!(e.
|
|
3235
|
+
(!(e._e & this.Nt) && !(this.Nt & STATUS_ERROR && e._e & STATUS_PENDING))
|
|
3101
3236
|
)
|
|
3102
|
-
this.
|
|
3237
|
+
this.lt.delete(e);
|
|
3103
3238
|
}
|
|
3104
|
-
if (!this.
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3239
|
+
if (!this.lt.size) {
|
|
3240
|
+
if (this.Nt & STATUS_PENDING && this.ft && !this.Rt && this.Pt) {
|
|
3241
|
+
this.ft = !!(this.Pt._e & this.Nt);
|
|
3242
|
+
} else {
|
|
3243
|
+
this.ft = false;
|
|
3244
|
+
}
|
|
3245
|
+
if (!this.ft) {
|
|
3246
|
+
setSignal(this.Et, false);
|
|
3247
|
+
if (this.Ct) {
|
|
3248
|
+
try {
|
|
3249
|
+
this.Dt = untrack(() => this.Ct());
|
|
3250
|
+
} catch {}
|
|
3251
|
+
}
|
|
3110
3252
|
}
|
|
3111
3253
|
}
|
|
3254
|
+
if (_revealUsed) this.St?.evaluate();
|
|
3112
3255
|
}
|
|
3113
3256
|
}
|
|
3114
3257
|
function createCollectionBoundary(e, t, n, i) {
|
|
3115
3258
|
const r = createOwner();
|
|
3259
|
+
if (_revealUsed) setContext(RevealControllerContext, null, r);
|
|
3116
3260
|
const s = new CollectionQueue(e);
|
|
3117
|
-
if (i) s.
|
|
3118
|
-
const o = createBoundChildren(r, t, s, e);
|
|
3119
|
-
|
|
3120
|
-
|
|
3261
|
+
if (i) s.Ct = i;
|
|
3262
|
+
const o = (s.Pt = createBoundChildren(r, t, s, e));
|
|
3263
|
+
untrack(() => {
|
|
3264
|
+
let t = false;
|
|
3265
|
+
try {
|
|
3266
|
+
read(o);
|
|
3267
|
+
} catch (e) {
|
|
3268
|
+
if (e instanceof NotReadyError) t = true;
|
|
3269
|
+
else throw e;
|
|
3270
|
+
}
|
|
3271
|
+
s.ft = t || !!(o._e & e) || o.Te instanceof NotReadyError;
|
|
3272
|
+
});
|
|
3273
|
+
const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
|
|
3274
|
+
if (u) {
|
|
3275
|
+
s.St = u;
|
|
3276
|
+
u.register(s);
|
|
3277
|
+
cleanup(() => u.unregister(s));
|
|
3278
|
+
}
|
|
3279
|
+
const c = computed(() => {
|
|
3280
|
+
if (!read(s.Et)) {
|
|
3121
3281
|
const e = read(o);
|
|
3122
|
-
if (!untrack(() => read(s.
|
|
3123
|
-
s.Et = true;
|
|
3124
|
-
return e;
|
|
3125
|
-
}
|
|
3282
|
+
if (!untrack(() => read(s.Et))) return (s.Rt = true), e;
|
|
3126
3283
|
}
|
|
3284
|
+
if (_revealUsed && read(s.dt)) return undefined;
|
|
3127
3285
|
return n(s);
|
|
3128
3286
|
});
|
|
3129
|
-
return accessor(
|
|
3287
|
+
return accessor(c);
|
|
3130
3288
|
}
|
|
3131
3289
|
function createLoadingBoundary(e, t, n) {
|
|
3132
3290
|
return createCollectionBoundary(STATUS_PENDING, e, () => t(), n?.on);
|
|
3133
3291
|
}
|
|
3134
3292
|
function createErrorBoundary(e, t) {
|
|
3135
3293
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
3136
|
-
let n = e.
|
|
3137
|
-
const i = n.
|
|
3294
|
+
let n = e.lt.values().next().value;
|
|
3295
|
+
const i = n.Te?.cause ?? n.Te;
|
|
3138
3296
|
return t(i, () => {
|
|
3139
|
-
for (const t of e.
|
|
3297
|
+
for (const t of e.lt) recompute(t);
|
|
3140
3298
|
schedule();
|
|
3141
3299
|
});
|
|
3142
3300
|
});
|
|
3143
3301
|
}
|
|
3302
|
+
function createRevealOrder(e, t) {
|
|
3303
|
+
_revealUsed = true;
|
|
3304
|
+
const n = createOwner();
|
|
3305
|
+
const i = getContext(RevealControllerContext);
|
|
3306
|
+
const r = t?.together || FALSE_ACCESSOR,
|
|
3307
|
+
s = t?.collapsed || FALSE_ACCESSOR;
|
|
3308
|
+
const o = new RevealController(r, s);
|
|
3309
|
+
setContext(RevealControllerContext, o, n);
|
|
3310
|
+
return runWithOwner(n, () => {
|
|
3311
|
+
const t = e();
|
|
3312
|
+
computed(() => {
|
|
3313
|
+
r();
|
|
3314
|
+
s();
|
|
3315
|
+
o.evaluate();
|
|
3316
|
+
});
|
|
3317
|
+
if (i) {
|
|
3318
|
+
o.Tt = i;
|
|
3319
|
+
i.register(o);
|
|
3320
|
+
cleanup(() => i.unregister(o));
|
|
3321
|
+
}
|
|
3322
|
+
return t;
|
|
3323
|
+
});
|
|
3324
|
+
}
|
|
3144
3325
|
function flatten(e, t) {
|
|
3145
3326
|
if (typeof e === "function" && !e.length) {
|
|
3146
3327
|
if (t?.doNotUnwrap) return e;
|
|
@@ -3196,6 +3377,7 @@ export {
|
|
|
3196
3377
|
$TARGET,
|
|
3197
3378
|
$TRACK,
|
|
3198
3379
|
ContextNotFoundError,
|
|
3380
|
+
DEV,
|
|
3199
3381
|
NoOwnerError,
|
|
3200
3382
|
NotReadyError,
|
|
3201
3383
|
SUPPORTS_PROXY,
|
|
@@ -3212,6 +3394,7 @@ export {
|
|
|
3212
3394
|
createProjection,
|
|
3213
3395
|
createReaction,
|
|
3214
3396
|
createRenderEffect,
|
|
3397
|
+
createRevealOrder,
|
|
3215
3398
|
createRoot,
|
|
3216
3399
|
createSignal,
|
|
3217
3400
|
createStore,
|