@solidjs/signals 0.13.13 → 2.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/dist/dev.js +312 -174
- package/dist/node.cjs +1068 -953
- package/dist/prod.js +744 -619
- package/dist/types/boundaries.d.ts +44 -3
- package/dist/types/core/core.d.ts +2 -2
- package/dist/types/core/effect.d.ts +3 -2
- package/dist/types/core/graph.d.ts +1 -0
- package/dist/types/core/scheduler.d.ts +1 -0
- package/dist/types/core/types.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/signals.d.ts +34 -26
- package/dist/types/store/optimistic.d.ts +3 -3
- package/dist/types/store/projection.d.ts +19 -5
- package/dist/types/store/store.d.ts +4 -4
- package/dist/types-cjs/boundaries.d.cts +93 -0
- package/dist/types-cjs/core/action.d.cts +1 -0
- package/dist/types-cjs/core/async.d.cts +6 -0
- package/dist/types-cjs/core/constants.d.cts +25 -0
- package/dist/types-cjs/core/context.d.cts +28 -0
- package/dist/types-cjs/core/core.d.cts +54 -0
- package/dist/types-cjs/core/dev.d.cts +49 -0
- package/dist/types-cjs/core/effect.d.cts +31 -0
- package/dist/types-cjs/core/error.d.cts +14 -0
- package/dist/types-cjs/core/external.d.cts +26 -0
- package/dist/types-cjs/core/graph.d.cts +4 -0
- package/dist/types-cjs/core/heap.d.cts +14 -0
- package/dist/types-cjs/core/index.d.cts +12 -0
- package/dist/types-cjs/core/lanes.d.cts +54 -0
- package/dist/types-cjs/core/owner.d.cts +26 -0
- package/dist/types-cjs/core/scheduler.d.cts +82 -0
- package/dist/types-cjs/core/types.d.cts +86 -0
- package/dist/types-cjs/index.d.cts +9 -0
- package/dist/types-cjs/map.d.cts +24 -0
- package/dist/types-cjs/package.json +3 -0
- package/dist/types-cjs/signals.d.cts +200 -0
- package/dist/types-cjs/store/index.d.cts +9 -0
- package/dist/types-cjs/store/optimistic.d.cts +19 -0
- package/dist/types-cjs/store/projection.d.cts +40 -0
- package/dist/types-cjs/store/reconcile.d.cts +1 -0
- package/dist/types-cjs/store/store.d.cts +68 -0
- package/dist/types-cjs/store/storePath.d.cts +30 -0
- package/dist/types-cjs/store/utils.d.cts +43 -0
- package/package.json +31 -24
package/dist/prod.js
CHANGED
|
@@ -150,16 +150,33 @@ let activeTransition = null;
|
|
|
150
150
|
let scheduled = false;
|
|
151
151
|
let projectionWriteActive = false;
|
|
152
152
|
let stashedOptimisticReads = null;
|
|
153
|
+
const transientStoreNodes = new Set();
|
|
154
|
+
function registerTransientStoreNode(e) {
|
|
155
|
+
transientStoreNodes.add(e);
|
|
156
|
+
}
|
|
157
|
+
function sweepTransientStoreNodes() {
|
|
158
|
+
if (transientStoreNodes.size === 0) return;
|
|
159
|
+
for (const e of transientStoreNodes) {
|
|
160
|
+
if (e.I !== null) {
|
|
161
|
+
transientStoreNodes.delete(e);
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (e.U !== NOT_PENDING) continue;
|
|
165
|
+
if (e.k !== undefined && e.k !== NOT_PENDING) continue;
|
|
166
|
+
transientStoreNodes.delete(e);
|
|
167
|
+
e.G?.();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
153
170
|
function enforceLoadingBoundary(e) {}
|
|
154
171
|
function shouldReadStashedOptimisticValue(e) {
|
|
155
172
|
return !!stashedOptimisticReads?.has(e);
|
|
156
173
|
}
|
|
157
174
|
function runLaneEffects(e) {
|
|
158
175
|
for (const t of activeLanes) {
|
|
159
|
-
if (t.
|
|
160
|
-
const n = t.
|
|
176
|
+
if (t.W || t.H.size > 0) continue;
|
|
177
|
+
const n = t.M[e - 1];
|
|
161
178
|
if (n.length) {
|
|
162
|
-
t.
|
|
179
|
+
t.M[e - 1] = [];
|
|
163
180
|
runQueue(n, e);
|
|
164
181
|
}
|
|
165
182
|
}
|
|
@@ -167,11 +184,11 @@ function runLaneEffects(e) {
|
|
|
167
184
|
function queueStashedOptimisticEffects(e) {
|
|
168
185
|
for (let t = e.I; t !== null; t = t.h) {
|
|
169
186
|
const e = t.p;
|
|
170
|
-
if (!e.
|
|
171
|
-
if (e.
|
|
172
|
-
if (!e.
|
|
173
|
-
e.
|
|
174
|
-
e
|
|
187
|
+
if (!e.F) continue;
|
|
188
|
+
if (e.F === EFFECT_TRACKED) {
|
|
189
|
+
if (!e.j) {
|
|
190
|
+
e.j = true;
|
|
191
|
+
e.$.enqueue(EFFECT_USER, e.K);
|
|
175
192
|
}
|
|
176
193
|
continue;
|
|
177
194
|
}
|
|
@@ -184,66 +201,66 @@ function setProjectionWriteActive(e) {
|
|
|
184
201
|
projectionWriteActive = e;
|
|
185
202
|
}
|
|
186
203
|
function mergeTransitionState(e, t) {
|
|
187
|
-
t.
|
|
188
|
-
e
|
|
189
|
-
for (const n of activeLanes) if (n.
|
|
190
|
-
e.
|
|
191
|
-
for (const n of t.
|
|
192
|
-
for (const [n, i] of t.
|
|
193
|
-
let t = e.
|
|
194
|
-
if (!t) e.
|
|
204
|
+
t.Y = e;
|
|
205
|
+
e.Z.push(...t.Z);
|
|
206
|
+
for (const n of activeLanes) if (n.B === t) n.B = e;
|
|
207
|
+
e.q.push(...t.q);
|
|
208
|
+
for (const n of t.X) e.X.add(n);
|
|
209
|
+
for (const [n, i] of t.J) {
|
|
210
|
+
let t = e.J.get(n);
|
|
211
|
+
if (!t) e.J.set(n, (t = new Set()));
|
|
195
212
|
for (const e of i) t.add(e);
|
|
196
213
|
}
|
|
197
214
|
}
|
|
198
215
|
function resolveOptimisticNodes(e) {
|
|
199
216
|
for (let t = 0; t < e.length; t++) {
|
|
200
217
|
const n = e[t];
|
|
201
|
-
n.
|
|
202
|
-
if (n.
|
|
203
|
-
n.
|
|
204
|
-
n.
|
|
218
|
+
n.ee = undefined;
|
|
219
|
+
if (n.U !== NOT_PENDING) {
|
|
220
|
+
n.te = n.U;
|
|
221
|
+
n.U = NOT_PENDING;
|
|
205
222
|
}
|
|
206
|
-
const i = n.
|
|
207
|
-
n.
|
|
208
|
-
if (i !== NOT_PENDING && n.
|
|
209
|
-
n.
|
|
223
|
+
const i = n.k;
|
|
224
|
+
n.k = NOT_PENDING;
|
|
225
|
+
if (i !== NOT_PENDING && n.te !== i) insertSubs(n, true);
|
|
226
|
+
n.B = null;
|
|
210
227
|
}
|
|
211
228
|
e.length = 0;
|
|
212
229
|
}
|
|
213
230
|
function cleanupCompletedLanes(e) {
|
|
214
231
|
for (const t of activeLanes) {
|
|
215
|
-
const n = e ? t.
|
|
232
|
+
const n = e ? t.B === e : !t.B;
|
|
216
233
|
if (!n) continue;
|
|
217
|
-
if (!t.
|
|
218
|
-
if (t.
|
|
219
|
-
if (t.
|
|
220
|
-
}
|
|
221
|
-
if (t.
|
|
222
|
-
t.
|
|
223
|
-
t.
|
|
224
|
-
t.
|
|
234
|
+
if (!t.W) {
|
|
235
|
+
if (t.M[0].length) runQueue(t.M[0], EFFECT_RENDER);
|
|
236
|
+
if (t.M[1].length) runQueue(t.M[1], EFFECT_USER);
|
|
237
|
+
}
|
|
238
|
+
if (t.ne.ee === t) t.ne.ee = undefined;
|
|
239
|
+
t.H.clear();
|
|
240
|
+
t.M[0].length = 0;
|
|
241
|
+
t.M[1].length = 0;
|
|
225
242
|
activeLanes.delete(t);
|
|
226
|
-
signalLanes.delete(t.
|
|
243
|
+
signalLanes.delete(t.ne);
|
|
227
244
|
}
|
|
228
245
|
}
|
|
229
246
|
function schedule() {
|
|
230
247
|
if (scheduled) return;
|
|
231
248
|
scheduled = true;
|
|
232
|
-
if (!globalQueue.
|
|
249
|
+
if (!globalQueue.ie && !projectionWriteActive) queueMicrotask(flush);
|
|
233
250
|
}
|
|
234
251
|
class Queue {
|
|
235
252
|
i = null;
|
|
236
|
-
|
|
237
|
-
|
|
253
|
+
re = [[], []];
|
|
254
|
+
se = [];
|
|
238
255
|
created = clock;
|
|
239
256
|
addChild(e) {
|
|
240
|
-
this.
|
|
257
|
+
this.se.push(e);
|
|
241
258
|
e.i = this;
|
|
242
259
|
}
|
|
243
260
|
removeChild(e) {
|
|
244
|
-
const t = this.
|
|
261
|
+
const t = this.se.indexOf(e);
|
|
245
262
|
if (t >= 0) {
|
|
246
|
-
this.
|
|
263
|
+
this.se.splice(t, 1);
|
|
247
264
|
e.i = null;
|
|
248
265
|
}
|
|
249
266
|
}
|
|
@@ -252,81 +269,81 @@ class Queue {
|
|
|
252
269
|
return false;
|
|
253
270
|
}
|
|
254
271
|
run(e) {
|
|
255
|
-
if (this.
|
|
256
|
-
const t = this.
|
|
257
|
-
this.
|
|
272
|
+
if (this.re[e - 1].length) {
|
|
273
|
+
const t = this.re[e - 1];
|
|
274
|
+
this.re[e - 1] = [];
|
|
258
275
|
runQueue(t, e);
|
|
259
276
|
}
|
|
260
|
-
for (let t = 0; t < this.
|
|
277
|
+
for (let t = 0; t < this.se.length; t++) this.se[t].run?.(e);
|
|
261
278
|
}
|
|
262
279
|
enqueue(e, t) {
|
|
263
280
|
if (e) {
|
|
264
281
|
if (currentOptimisticLane) {
|
|
265
282
|
const n = findLane(currentOptimisticLane);
|
|
266
|
-
n.
|
|
283
|
+
n.M[e - 1].push(t);
|
|
267
284
|
} else {
|
|
268
|
-
this.
|
|
285
|
+
this.re[e - 1].push(t);
|
|
269
286
|
}
|
|
270
287
|
}
|
|
271
288
|
schedule();
|
|
272
289
|
}
|
|
273
290
|
stashQueues(e) {
|
|
274
|
-
e.
|
|
275
|
-
e.
|
|
276
|
-
this.
|
|
277
|
-
for (let t = 0; t < this.
|
|
278
|
-
let n = this.
|
|
279
|
-
let i = e.
|
|
291
|
+
e.re[0].push(...this.re[0]);
|
|
292
|
+
e.re[1].push(...this.re[1]);
|
|
293
|
+
this.re = [[], []];
|
|
294
|
+
for (let t = 0; t < this.se.length; t++) {
|
|
295
|
+
let n = this.se[t];
|
|
296
|
+
let i = e.se[t];
|
|
280
297
|
if (!i) {
|
|
281
|
-
i = {
|
|
282
|
-
e.
|
|
298
|
+
i = { re: [[], []], se: [] };
|
|
299
|
+
e.se[t] = i;
|
|
283
300
|
}
|
|
284
301
|
n.stashQueues(i);
|
|
285
302
|
}
|
|
286
303
|
}
|
|
287
304
|
restoreQueues(e) {
|
|
288
|
-
this.
|
|
289
|
-
this.
|
|
290
|
-
for (let t = 0; t < e.
|
|
291
|
-
const n = e.
|
|
292
|
-
let i = this.
|
|
305
|
+
this.re[0].push(...e.re[0]);
|
|
306
|
+
this.re[1].push(...e.re[1]);
|
|
307
|
+
for (let t = 0; t < e.se.length; t++) {
|
|
308
|
+
const n = e.se[t];
|
|
309
|
+
let i = this.se[t];
|
|
293
310
|
if (i) i.restoreQueues(n);
|
|
294
311
|
}
|
|
295
312
|
}
|
|
296
313
|
}
|
|
297
314
|
class GlobalQueue extends Queue {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
static oe;
|
|
315
|
+
ie = false;
|
|
316
|
+
oe = [];
|
|
317
|
+
q = [];
|
|
318
|
+
X = new Set();
|
|
303
319
|
static ue;
|
|
304
|
-
static ce
|
|
320
|
+
static ce;
|
|
321
|
+
static ae = null;
|
|
305
322
|
flush() {
|
|
306
|
-
if (this.
|
|
307
|
-
this.
|
|
323
|
+
if (this.ie) return;
|
|
324
|
+
this.ie = true;
|
|
308
325
|
try {
|
|
309
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
326
|
+
runHeap(dirtyQueue, GlobalQueue.ue);
|
|
310
327
|
if (activeTransition) {
|
|
311
328
|
const e = transitionComplete(activeTransition);
|
|
312
329
|
if (!e) {
|
|
313
330
|
const e = activeTransition;
|
|
314
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
315
|
-
this.
|
|
316
|
-
this.
|
|
317
|
-
this.
|
|
331
|
+
runHeap(zombieQueue, GlobalQueue.ue);
|
|
332
|
+
this.oe = [];
|
|
333
|
+
this.q = [];
|
|
334
|
+
this.X = new Set();
|
|
318
335
|
runLaneEffects(EFFECT_RENDER);
|
|
319
336
|
runLaneEffects(EFFECT_USER);
|
|
320
|
-
this.stashQueues(e.
|
|
337
|
+
this.stashQueues(e.le);
|
|
321
338
|
clock++;
|
|
322
339
|
scheduled = dirtyQueue.R >= dirtyQueue.P;
|
|
323
|
-
reassignPendingTransition(e.
|
|
340
|
+
reassignPendingTransition(e.oe);
|
|
324
341
|
activeTransition = null;
|
|
325
|
-
if (!e
|
|
342
|
+
if (!e.Z.length && e.q.length) {
|
|
326
343
|
stashedOptimisticReads = new Set();
|
|
327
|
-
for (let t = 0; t < e.
|
|
328
|
-
const n = e.
|
|
329
|
-
if (n.L || n.
|
|
344
|
+
for (let t = 0; t < e.q.length; t++) {
|
|
345
|
+
const n = e.q[t];
|
|
346
|
+
if (n.L || n.fe) continue;
|
|
330
347
|
stashedOptimisticReads.add(n);
|
|
331
348
|
queueStashedOptimisticEffects(n);
|
|
332
349
|
}
|
|
@@ -338,15 +355,15 @@ class GlobalQueue extends Queue {
|
|
|
338
355
|
}
|
|
339
356
|
return;
|
|
340
357
|
}
|
|
341
|
-
this.
|
|
342
|
-
this.restoreQueues(activeTransition.
|
|
358
|
+
this.oe !== activeTransition.oe && this.oe.push(...activeTransition.oe);
|
|
359
|
+
this.restoreQueues(activeTransition.le);
|
|
343
360
|
transitions.delete(activeTransition);
|
|
344
361
|
const t = activeTransition;
|
|
345
362
|
activeTransition = null;
|
|
346
|
-
reassignPendingTransition(this.
|
|
363
|
+
reassignPendingTransition(this.oe);
|
|
347
364
|
finalizePureQueue(t);
|
|
348
365
|
} else {
|
|
349
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
366
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.ue);
|
|
350
367
|
finalizePureQueue();
|
|
351
368
|
}
|
|
352
369
|
clock++;
|
|
@@ -357,17 +374,17 @@ class GlobalQueue extends Queue {
|
|
|
357
374
|
this.run(EFFECT_USER);
|
|
358
375
|
if (false);
|
|
359
376
|
} finally {
|
|
360
|
-
this.
|
|
377
|
+
this.ie = false;
|
|
361
378
|
}
|
|
362
379
|
}
|
|
363
380
|
notify(e, t, n, i) {
|
|
364
381
|
if (t & STATUS_PENDING) {
|
|
365
382
|
if (n & STATUS_PENDING) {
|
|
366
|
-
const t = i !== undefined ? i : e.
|
|
383
|
+
const t = i !== undefined ? i : e.Ee;
|
|
367
384
|
if (activeTransition && t) {
|
|
368
385
|
const n = t.source;
|
|
369
|
-
let i = activeTransition.
|
|
370
|
-
if (!i) activeTransition.
|
|
386
|
+
let i = activeTransition.J.get(n);
|
|
387
|
+
if (!i) activeTransition.J.set(n, (i = new Set()));
|
|
371
388
|
const r = i.size;
|
|
372
389
|
i.add(e);
|
|
373
390
|
if (i.size !== r) schedule();
|
|
@@ -380,17 +397,17 @@ class GlobalQueue extends Queue {
|
|
|
380
397
|
initTransition(e) {
|
|
381
398
|
if (e) e = currentTransition(e);
|
|
382
399
|
if (e && e === activeTransition) return;
|
|
383
|
-
if (!e && activeTransition && activeTransition.
|
|
400
|
+
if (!e && activeTransition && activeTransition.de === clock) return;
|
|
384
401
|
if (!activeTransition) {
|
|
385
402
|
activeTransition = e ?? {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
403
|
+
de: clock,
|
|
404
|
+
oe: [],
|
|
405
|
+
J: new Map(),
|
|
406
|
+
q: [],
|
|
407
|
+
X: new Set(),
|
|
408
|
+
Z: [],
|
|
409
|
+
le: { re: [[], []], se: [] },
|
|
410
|
+
Y: false
|
|
394
411
|
};
|
|
395
412
|
} else if (e) {
|
|
396
413
|
const t = activeTransition;
|
|
@@ -399,37 +416,37 @@ class GlobalQueue extends Queue {
|
|
|
399
416
|
activeTransition = e;
|
|
400
417
|
}
|
|
401
418
|
transitions.add(activeTransition);
|
|
402
|
-
activeTransition.
|
|
403
|
-
if (this.
|
|
404
|
-
for (let e = 0; e < this.
|
|
405
|
-
const t = this.
|
|
406
|
-
t.
|
|
407
|
-
activeTransition.
|
|
419
|
+
activeTransition.de = clock;
|
|
420
|
+
if (this.oe !== activeTransition.oe) {
|
|
421
|
+
for (let e = 0; e < this.oe.length; e++) {
|
|
422
|
+
const t = this.oe[e];
|
|
423
|
+
t.B = activeTransition;
|
|
424
|
+
activeTransition.oe.push(t);
|
|
408
425
|
}
|
|
409
|
-
this.
|
|
426
|
+
this.oe = activeTransition.oe;
|
|
410
427
|
}
|
|
411
|
-
if (this.
|
|
412
|
-
for (let e = 0; e < this.
|
|
413
|
-
const t = this.
|
|
414
|
-
t.
|
|
415
|
-
activeTransition.
|
|
428
|
+
if (this.q !== activeTransition.q) {
|
|
429
|
+
for (let e = 0; e < this.q.length; e++) {
|
|
430
|
+
const t = this.q[e];
|
|
431
|
+
t.B = activeTransition;
|
|
432
|
+
activeTransition.q.push(t);
|
|
416
433
|
}
|
|
417
|
-
this.
|
|
434
|
+
this.q = activeTransition.q;
|
|
418
435
|
}
|
|
419
436
|
for (const e of activeLanes) {
|
|
420
|
-
if (!e.
|
|
437
|
+
if (!e.B) e.B = activeTransition;
|
|
421
438
|
}
|
|
422
|
-
if (this.
|
|
423
|
-
for (const e of this.
|
|
424
|
-
this.
|
|
439
|
+
if (this.X !== activeTransition.X) {
|
|
440
|
+
for (const e of this.X) activeTransition.X.add(e);
|
|
441
|
+
this.X = activeTransition.X;
|
|
425
442
|
}
|
|
426
443
|
}
|
|
427
444
|
}
|
|
428
445
|
function insertSubs(e, t = false) {
|
|
429
|
-
const n = e.
|
|
430
|
-
const i = e.
|
|
446
|
+
const n = e.ee || currentOptimisticLane;
|
|
447
|
+
const i = e.Te !== undefined;
|
|
431
448
|
for (let r = e.I; r !== null; r = r.h) {
|
|
432
|
-
if (i && r.p.
|
|
449
|
+
if (i && r.p.Se) {
|
|
433
450
|
r.p.O |= REACTIVE_SNAPSHOT_STALE;
|
|
434
451
|
continue;
|
|
435
452
|
}
|
|
@@ -438,13 +455,13 @@ function insertSubs(e, t = false) {
|
|
|
438
455
|
assignOrMergeLane(r.p, n);
|
|
439
456
|
} else if (t) {
|
|
440
457
|
r.p.O |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
441
|
-
r.p.
|
|
458
|
+
r.p.ee = undefined;
|
|
442
459
|
}
|
|
443
460
|
const e = r.p;
|
|
444
|
-
if (e.
|
|
445
|
-
if (!e.
|
|
446
|
-
e.
|
|
447
|
-
e
|
|
461
|
+
if (e.F === EFFECT_TRACKED) {
|
|
462
|
+
if (!e.j) {
|
|
463
|
+
e.j = true;
|
|
464
|
+
e.$.enqueue(EFFECT_USER, e.K);
|
|
448
465
|
}
|
|
449
466
|
continue;
|
|
450
467
|
}
|
|
@@ -454,16 +471,16 @@ function insertSubs(e, t = false) {
|
|
|
454
471
|
}
|
|
455
472
|
}
|
|
456
473
|
function commitPendingNodes() {
|
|
457
|
-
const e = globalQueue.
|
|
474
|
+
const e = globalQueue.oe;
|
|
458
475
|
for (let t = 0; t < e.length; t++) {
|
|
459
476
|
const n = e[t];
|
|
460
|
-
if (n.
|
|
461
|
-
n.
|
|
462
|
-
n.
|
|
463
|
-
if (n.
|
|
477
|
+
if (n.U !== NOT_PENDING) {
|
|
478
|
+
n.te = n.U;
|
|
479
|
+
n.U = NOT_PENDING;
|
|
480
|
+
if (n.F && n.F !== EFFECT_TRACKED) n.j = true;
|
|
464
481
|
}
|
|
465
|
-
if (!(n.
|
|
466
|
-
if (n.L) GlobalQueue.
|
|
482
|
+
if (!(n.Re & STATUS_PENDING)) n.Re &= ~STATUS_UNINITIALIZED;
|
|
483
|
+
if (n.L) GlobalQueue.ce(n, false, true);
|
|
467
484
|
}
|
|
468
485
|
e.length = 0;
|
|
469
486
|
}
|
|
@@ -471,39 +488,40 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
471
488
|
const n = !t;
|
|
472
489
|
if (n) commitPendingNodes();
|
|
473
490
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
474
|
-
if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.
|
|
491
|
+
if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.ue);
|
|
475
492
|
if (n) {
|
|
476
493
|
commitPendingNodes();
|
|
477
|
-
resolveOptimisticNodes(e ? e.
|
|
478
|
-
const t = e ? e.
|
|
479
|
-
if (GlobalQueue.
|
|
494
|
+
resolveOptimisticNodes(e ? e.q : globalQueue.q);
|
|
495
|
+
const t = e ? e.X : globalQueue.X;
|
|
496
|
+
if (GlobalQueue.ae && t.size) {
|
|
480
497
|
for (const e of t) {
|
|
481
|
-
GlobalQueue.
|
|
498
|
+
GlobalQueue.ae(e);
|
|
482
499
|
}
|
|
483
500
|
t.clear();
|
|
484
501
|
schedule();
|
|
485
502
|
}
|
|
503
|
+
sweepTransientStoreNodes();
|
|
486
504
|
cleanupCompletedLanes(e);
|
|
487
505
|
}
|
|
488
506
|
}
|
|
489
507
|
function checkBoundaryChildren(e) {
|
|
490
|
-
for (const t of e.
|
|
508
|
+
for (const t of e.se) {
|
|
491
509
|
t.checkSources?.();
|
|
492
510
|
checkBoundaryChildren(t);
|
|
493
511
|
}
|
|
494
512
|
}
|
|
495
513
|
function trackOptimisticStore(e) {
|
|
496
|
-
globalQueue.
|
|
514
|
+
globalQueue.X.add(e);
|
|
497
515
|
schedule();
|
|
498
516
|
}
|
|
499
517
|
function reassignPendingTransition(e) {
|
|
500
518
|
for (let t = 0; t < e.length; t++) {
|
|
501
|
-
e[t].
|
|
519
|
+
e[t].B = activeTransition;
|
|
502
520
|
}
|
|
503
521
|
}
|
|
504
522
|
const globalQueue = new GlobalQueue();
|
|
505
523
|
function flush() {
|
|
506
|
-
if (globalQueue.
|
|
524
|
+
if (globalQueue.ie) {
|
|
507
525
|
return;
|
|
508
526
|
}
|
|
509
527
|
while (scheduled || activeTransition) {
|
|
@@ -515,21 +533,21 @@ function runQueue(e, t) {
|
|
|
515
533
|
}
|
|
516
534
|
function reporterBlocksSource(e, t) {
|
|
517
535
|
if (e.O & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
|
|
518
|
-
if (e.
|
|
536
|
+
if (e.Oe === t || e._e?.has(t)) return true;
|
|
519
537
|
for (let n = e.C; n; n = n.D) {
|
|
520
538
|
let e = n.m;
|
|
521
539
|
while (e) {
|
|
522
540
|
if (e === t || e.V === t) return true;
|
|
523
|
-
e = e.
|
|
541
|
+
e = e.Ie;
|
|
524
542
|
}
|
|
525
543
|
}
|
|
526
|
-
return !!(e.
|
|
544
|
+
return !!(e.Re & STATUS_PENDING && e.Ee instanceof NotReadyError && e.Ee.source === t);
|
|
527
545
|
}
|
|
528
546
|
function transitionComplete(e) {
|
|
529
|
-
if (e.
|
|
530
|
-
if (e
|
|
547
|
+
if (e.Y) return true;
|
|
548
|
+
if (e.Z.length) return false;
|
|
531
549
|
let t = true;
|
|
532
|
-
for (const [n, i] of e.
|
|
550
|
+
for (const [n, i] of e.J) {
|
|
533
551
|
let r = false;
|
|
534
552
|
for (const e of i) {
|
|
535
553
|
if (reporterBlocksSource(e, n)) {
|
|
@@ -538,32 +556,32 @@ function transitionComplete(e) {
|
|
|
538
556
|
}
|
|
539
557
|
i.delete(e);
|
|
540
558
|
}
|
|
541
|
-
if (!r) e.
|
|
542
|
-
else if (n.
|
|
559
|
+
if (!r) e.J.delete(n);
|
|
560
|
+
else if (n.Re & STATUS_PENDING && n.Ee?.source === n) {
|
|
543
561
|
t = false;
|
|
544
562
|
break;
|
|
545
563
|
}
|
|
546
564
|
}
|
|
547
565
|
if (t) {
|
|
548
|
-
for (let n = 0; n < e.
|
|
549
|
-
const i = e.
|
|
566
|
+
for (let n = 0; n < e.q.length; n++) {
|
|
567
|
+
const i = e.q[n];
|
|
550
568
|
if (
|
|
551
569
|
hasActiveOverride(i) &&
|
|
552
|
-
"
|
|
553
|
-
i.
|
|
554
|
-
i.
|
|
555
|
-
i.
|
|
570
|
+
"Re" in i &&
|
|
571
|
+
i.Re & STATUS_PENDING &&
|
|
572
|
+
i.Ee instanceof NotReadyError &&
|
|
573
|
+
i.Ee.source !== i
|
|
556
574
|
) {
|
|
557
575
|
t = false;
|
|
558
576
|
break;
|
|
559
577
|
}
|
|
560
578
|
}
|
|
561
579
|
}
|
|
562
|
-
t && (e.
|
|
580
|
+
t && (e.Y = true);
|
|
563
581
|
return t;
|
|
564
582
|
}
|
|
565
583
|
function currentTransition(e) {
|
|
566
|
-
while (e.
|
|
584
|
+
while (e.Y && typeof e.Y === "object") e = e.Y;
|
|
567
585
|
return e;
|
|
568
586
|
}
|
|
569
587
|
function setActiveTransition(e) {
|
|
@@ -585,75 +603,75 @@ function getOrCreateLane(e) {
|
|
|
585
603
|
if (t) {
|
|
586
604
|
return findLane(t);
|
|
587
605
|
}
|
|
588
|
-
const n = e.
|
|
589
|
-
const i = n?.
|
|
590
|
-
t = {
|
|
606
|
+
const n = e.Ie;
|
|
607
|
+
const i = n?.ee ? findLane(n.ee) : null;
|
|
608
|
+
t = { ne: e, H: new Set(), M: [[], []], W: null, B: activeTransition, he: i };
|
|
591
609
|
signalLanes.set(e, t);
|
|
592
610
|
activeLanes.add(t);
|
|
593
|
-
e.
|
|
611
|
+
e.pe = false;
|
|
594
612
|
return t;
|
|
595
613
|
}
|
|
596
614
|
function findLane(e) {
|
|
597
|
-
while (e.
|
|
615
|
+
while (e.W) e = e.W;
|
|
598
616
|
return e;
|
|
599
617
|
}
|
|
600
618
|
function mergeLanes(e, t) {
|
|
601
619
|
e = findLane(e);
|
|
602
620
|
t = findLane(t);
|
|
603
621
|
if (e === t) return e;
|
|
604
|
-
t.
|
|
605
|
-
for (const n of t.
|
|
606
|
-
e.
|
|
607
|
-
e.
|
|
622
|
+
t.W = e;
|
|
623
|
+
for (const n of t.H) e.H.add(n);
|
|
624
|
+
e.M[0].push(...t.M[0]);
|
|
625
|
+
e.M[1].push(...t.M[1]);
|
|
608
626
|
return e;
|
|
609
627
|
}
|
|
610
628
|
function resolveLane(e) {
|
|
611
|
-
const t = e.
|
|
629
|
+
const t = e.ee;
|
|
612
630
|
if (!t) return undefined;
|
|
613
631
|
const n = findLane(t);
|
|
614
632
|
if (activeLanes.has(n)) return n;
|
|
615
|
-
e.
|
|
633
|
+
e.ee = undefined;
|
|
616
634
|
return undefined;
|
|
617
635
|
}
|
|
618
636
|
function resolveTransition(e) {
|
|
619
|
-
return resolveLane(e)?.
|
|
637
|
+
return resolveLane(e)?.B ?? e.B;
|
|
620
638
|
}
|
|
621
639
|
function hasActiveOverride(e) {
|
|
622
|
-
return !!(e.
|
|
640
|
+
return !!(e.k !== undefined && e.k !== NOT_PENDING);
|
|
623
641
|
}
|
|
624
642
|
function assignOrMergeLane(e, t) {
|
|
625
643
|
const n = findLane(t);
|
|
626
|
-
const i = e.
|
|
644
|
+
const i = e.ee;
|
|
627
645
|
if (i) {
|
|
628
|
-
if (i.
|
|
629
|
-
e.
|
|
646
|
+
if (i.W) {
|
|
647
|
+
e.ee = t;
|
|
630
648
|
return;
|
|
631
649
|
}
|
|
632
650
|
const r = findLane(i);
|
|
633
651
|
if (activeLanes.has(r)) {
|
|
634
652
|
if (r !== n && !hasActiveOverride(e)) {
|
|
635
|
-
if (n.
|
|
636
|
-
e.
|
|
637
|
-
} else if (r.
|
|
653
|
+
if (n.he && findLane(n.he) === r) {
|
|
654
|
+
e.ee = t;
|
|
655
|
+
} else if (r.he && findLane(r.he) === n);
|
|
638
656
|
else mergeLanes(n, r);
|
|
639
657
|
}
|
|
640
658
|
return;
|
|
641
659
|
}
|
|
642
660
|
}
|
|
643
|
-
e.
|
|
661
|
+
e.ee = t;
|
|
644
662
|
}
|
|
645
663
|
function unlinkSubs(e) {
|
|
646
664
|
const t = e.m;
|
|
647
665
|
const n = e.D;
|
|
648
666
|
const i = e.h;
|
|
649
|
-
const r = e.
|
|
650
|
-
if (i !== null) i.
|
|
651
|
-
else t.
|
|
667
|
+
const r = e.Ae;
|
|
668
|
+
if (i !== null) i.Ae = r;
|
|
669
|
+
else t.Ne = r;
|
|
652
670
|
if (r !== null) r.h = i;
|
|
653
671
|
else {
|
|
654
672
|
t.I = i;
|
|
655
673
|
if (i === null) {
|
|
656
|
-
t.
|
|
674
|
+
t.G?.();
|
|
657
675
|
t.L && !t.Pe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
658
676
|
}
|
|
659
677
|
}
|
|
@@ -666,6 +684,7 @@ function unobserved(e) {
|
|
|
666
684
|
t = unlinkSubs(t);
|
|
667
685
|
}
|
|
668
686
|
e.C = null;
|
|
687
|
+
e.ge = null;
|
|
669
688
|
disposeChildren(e, true);
|
|
670
689
|
}
|
|
671
690
|
function link(e, t) {
|
|
@@ -680,9 +699,9 @@ function link(e, t) {
|
|
|
680
699
|
return;
|
|
681
700
|
}
|
|
682
701
|
}
|
|
683
|
-
const s = e.
|
|
702
|
+
const s = e.Ne;
|
|
684
703
|
if (s !== null && s.p === t && (!r || isValidLink(s, t))) return;
|
|
685
|
-
const o = (t.ge = e.
|
|
704
|
+
const o = (t.ge = e.Ne = { m: e, p: t, D: i, Ae: s, h: null });
|
|
686
705
|
if (n !== null) n.D = o;
|
|
687
706
|
else t.C = o;
|
|
688
707
|
if (s !== null) s.h = o;
|
|
@@ -808,7 +827,7 @@ function createOwner(e) {
|
|
|
808
827
|
Ce: null,
|
|
809
828
|
De: null,
|
|
810
829
|
Ve: null,
|
|
811
|
-
|
|
830
|
+
$: t?.$ ?? globalQueue,
|
|
812
831
|
Le: t?.Le || defaultContext,
|
|
813
832
|
me: 0,
|
|
814
833
|
we: null,
|
|
@@ -834,51 +853,51 @@ function createRoot(e, t) {
|
|
|
834
853
|
return runWithOwner(n, () => e(n.dispose));
|
|
835
854
|
}
|
|
836
855
|
function addPendingSource(e, t) {
|
|
837
|
-
if (e.
|
|
838
|
-
if (!e.
|
|
839
|
-
e.
|
|
856
|
+
if (e.Oe === t || e._e?.has(t)) return false;
|
|
857
|
+
if (!e.Oe) {
|
|
858
|
+
e.Oe = t;
|
|
840
859
|
return true;
|
|
841
860
|
}
|
|
842
|
-
if (!e.
|
|
843
|
-
e.
|
|
861
|
+
if (!e._e) {
|
|
862
|
+
e._e = new Set([e.Oe, t]);
|
|
844
863
|
} else {
|
|
845
|
-
e.
|
|
864
|
+
e._e.add(t);
|
|
846
865
|
}
|
|
847
|
-
e.
|
|
866
|
+
e.Oe = undefined;
|
|
848
867
|
return true;
|
|
849
868
|
}
|
|
850
869
|
function removePendingSource(e, t) {
|
|
851
|
-
if (e.
|
|
852
|
-
if (e.
|
|
853
|
-
e.
|
|
870
|
+
if (e.Oe) {
|
|
871
|
+
if (e.Oe !== t) return false;
|
|
872
|
+
e.Oe = undefined;
|
|
854
873
|
return true;
|
|
855
874
|
}
|
|
856
|
-
if (!e.
|
|
857
|
-
if (e.
|
|
858
|
-
e.
|
|
859
|
-
e.
|
|
860
|
-
} else if (e.
|
|
861
|
-
e.
|
|
875
|
+
if (!e._e?.delete(t)) return false;
|
|
876
|
+
if (e._e.size === 1) {
|
|
877
|
+
e.Oe = e._e.values().next().value;
|
|
878
|
+
e._e = undefined;
|
|
879
|
+
} else if (e._e.size === 0) {
|
|
880
|
+
e._e = undefined;
|
|
862
881
|
}
|
|
863
882
|
return true;
|
|
864
883
|
}
|
|
865
884
|
function clearPendingSources(e) {
|
|
866
|
-
e.Re = undefined;
|
|
867
|
-
e.Oe?.clear();
|
|
868
885
|
e.Oe = undefined;
|
|
886
|
+
e._e?.clear();
|
|
887
|
+
e._e = undefined;
|
|
869
888
|
}
|
|
870
889
|
function setPendingError(e, t, n) {
|
|
871
890
|
if (!t) {
|
|
872
|
-
e.
|
|
891
|
+
e.Ee = null;
|
|
873
892
|
return;
|
|
874
893
|
}
|
|
875
894
|
if (n instanceof NotReadyError && n.source === t) {
|
|
876
|
-
e.
|
|
895
|
+
e.Ee = n;
|
|
877
896
|
return;
|
|
878
897
|
}
|
|
879
|
-
const i = e.
|
|
898
|
+
const i = e.Ee;
|
|
880
899
|
if (!(i instanceof NotReadyError) || i.source !== t) {
|
|
881
|
-
e.
|
|
900
|
+
e.Ee = new NotReadyError(t);
|
|
882
901
|
}
|
|
883
902
|
}
|
|
884
903
|
function forEachDependent(e, t) {
|
|
@@ -893,21 +912,21 @@ function settlePendingSource(e) {
|
|
|
893
912
|
const settle = i => {
|
|
894
913
|
if (n.has(i) || !removePendingSource(i, e)) return;
|
|
895
914
|
n.add(i);
|
|
896
|
-
i.
|
|
897
|
-
const r = i.
|
|
915
|
+
i.de = clock;
|
|
916
|
+
const r = i.Oe ?? i._e?.values().next().value;
|
|
898
917
|
if (r) {
|
|
899
918
|
setPendingError(i, r);
|
|
900
919
|
updatePendingSignal(i);
|
|
901
920
|
} else {
|
|
902
|
-
i.
|
|
921
|
+
i.Re &= ~STATUS_PENDING;
|
|
903
922
|
setPendingError(i);
|
|
904
923
|
updatePendingSignal(i);
|
|
905
924
|
if (i.Ue) {
|
|
906
|
-
if (i.
|
|
925
|
+
if (i.F === EFFECT_TRACKED) {
|
|
907
926
|
const e = i;
|
|
908
|
-
if (!e.
|
|
909
|
-
e.
|
|
910
|
-
e
|
|
927
|
+
if (!e.j) {
|
|
928
|
+
e.j = true;
|
|
929
|
+
e.$.enqueue(EFFECT_USER, e.K);
|
|
911
930
|
}
|
|
912
931
|
} else {
|
|
913
932
|
const e = i.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
@@ -937,33 +956,33 @@ function handleAsync(e, t, n) {
|
|
|
937
956
|
if (e.ye !== t) return;
|
|
938
957
|
globalQueue.initTransition(resolveTransition(e));
|
|
939
958
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
940
|
-
e.
|
|
959
|
+
e.de = clock;
|
|
941
960
|
};
|
|
942
961
|
const asyncWrite = (i, r) => {
|
|
943
962
|
if (e.ye !== t) return;
|
|
944
963
|
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
945
964
|
globalQueue.initTransition(resolveTransition(e));
|
|
946
|
-
const s = !!(e.
|
|
965
|
+
const s = !!(e.Re & STATUS_UNINITIALIZED);
|
|
947
966
|
clearStatus(e);
|
|
948
967
|
const o = resolveLane(e);
|
|
949
|
-
if (o) o.
|
|
968
|
+
if (o) o.H.delete(e);
|
|
950
969
|
if (n) n(i);
|
|
951
|
-
else if (e.
|
|
952
|
-
if (e.
|
|
970
|
+
else if (e.k !== undefined) {
|
|
971
|
+
if (e.k !== undefined && e.k !== NOT_PENDING) e.U = i;
|
|
953
972
|
else {
|
|
954
|
-
e.
|
|
973
|
+
e.te = i;
|
|
955
974
|
insertSubs(e);
|
|
956
975
|
}
|
|
957
|
-
e.
|
|
976
|
+
e.de = clock;
|
|
958
977
|
} else if (o) {
|
|
959
|
-
const t = e.
|
|
960
|
-
const n = e.
|
|
978
|
+
const t = e.F;
|
|
979
|
+
const n = e.te;
|
|
961
980
|
const r = e.ke;
|
|
962
981
|
if ((!t && s) || !r || !r(i, n)) {
|
|
963
|
-
e.
|
|
964
|
-
e.
|
|
965
|
-
if (e.
|
|
966
|
-
setSignal(e.
|
|
982
|
+
e.te = i;
|
|
983
|
+
e.de = clock;
|
|
984
|
+
if (e.Ge) {
|
|
985
|
+
setSignal(e.Ge, i);
|
|
967
986
|
}
|
|
968
987
|
insertSubs(e, true);
|
|
969
988
|
}
|
|
@@ -1054,27 +1073,27 @@ function handleAsync(e, t, n) {
|
|
|
1054
1073
|
function clearStatus(e, t = false) {
|
|
1055
1074
|
clearPendingSources(e);
|
|
1056
1075
|
e.Ue = false;
|
|
1057
|
-
e.
|
|
1076
|
+
e.Re = t ? 0 : e.Re & STATUS_UNINITIALIZED;
|
|
1058
1077
|
setPendingError(e);
|
|
1059
1078
|
updatePendingSignal(e);
|
|
1060
|
-
e.
|
|
1079
|
+
e.xe?.();
|
|
1061
1080
|
}
|
|
1062
1081
|
function notifyStatus(e, t, n, i, r) {
|
|
1063
1082
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
1064
1083
|
n = new StatusError(e, n);
|
|
1065
1084
|
const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
1066
1085
|
const o = s === e;
|
|
1067
|
-
const u = t === STATUS_PENDING && e.
|
|
1086
|
+
const u = t === STATUS_PENDING && e.k !== undefined && !o;
|
|
1068
1087
|
const c = u && hasActiveOverride(e);
|
|
1069
1088
|
if (!i) {
|
|
1070
1089
|
if (t === STATUS_PENDING && s) {
|
|
1071
1090
|
addPendingSource(e, s);
|
|
1072
|
-
e.
|
|
1091
|
+
e.Re = STATUS_PENDING | (e.Re & STATUS_UNINITIALIZED);
|
|
1073
1092
|
setPendingError(e, s, n);
|
|
1074
1093
|
} else {
|
|
1075
1094
|
clearPendingSources(e);
|
|
1076
|
-
e.
|
|
1077
|
-
e.
|
|
1095
|
+
e.Re = t | (t !== STATUS_ERROR ? e.Re & STATUS_UNINITIALIZED : 0);
|
|
1096
|
+
e.Ee = n;
|
|
1078
1097
|
}
|
|
1079
1098
|
updatePendingSignal(e);
|
|
1080
1099
|
}
|
|
@@ -1083,24 +1102,24 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
1083
1102
|
}
|
|
1084
1103
|
const a = i || c;
|
|
1085
1104
|
const l = i || u ? undefined : r;
|
|
1086
|
-
if (e.
|
|
1105
|
+
if (e.xe) {
|
|
1087
1106
|
if (i && t === STATUS_PENDING) {
|
|
1088
1107
|
return;
|
|
1089
1108
|
}
|
|
1090
1109
|
if (a) {
|
|
1091
|
-
e.
|
|
1110
|
+
e.xe(t, n);
|
|
1092
1111
|
} else {
|
|
1093
|
-
e.
|
|
1112
|
+
e.xe();
|
|
1094
1113
|
}
|
|
1095
1114
|
return;
|
|
1096
1115
|
}
|
|
1097
1116
|
forEachDependent(e, e => {
|
|
1098
|
-
e.
|
|
1117
|
+
e.de = clock;
|
|
1099
1118
|
if (
|
|
1100
|
-
(t === STATUS_PENDING && s && e.
|
|
1101
|
-
(t !== STATUS_PENDING && (e.
|
|
1119
|
+
(t === STATUS_PENDING && s && e.Oe !== s && !e._e?.has(s)) ||
|
|
1120
|
+
(t !== STATUS_PENDING && (e.Ee !== n || e.Oe || e._e))
|
|
1102
1121
|
) {
|
|
1103
|
-
if (!a && !e.
|
|
1122
|
+
if (!a && !e.B) globalQueue.oe.push(e);
|
|
1104
1123
|
notifyStatus(e, t, n, a, l);
|
|
1105
1124
|
}
|
|
1106
1125
|
});
|
|
@@ -1128,8 +1147,8 @@ function enableExternalSource(e) {
|
|
|
1128
1147
|
externalSourceConfig = { factory: t, untrack: n };
|
|
1129
1148
|
}
|
|
1130
1149
|
}
|
|
1131
|
-
GlobalQueue.
|
|
1132
|
-
GlobalQueue.
|
|
1150
|
+
GlobalQueue.ue = recompute;
|
|
1151
|
+
GlobalQueue.ce = disposeChildren;
|
|
1133
1152
|
let tracking = false;
|
|
1134
1153
|
let stale = false;
|
|
1135
1154
|
let refreshing = false;
|
|
@@ -1168,7 +1187,7 @@ function releaseSubtree(e) {
|
|
|
1168
1187
|
}
|
|
1169
1188
|
if (t.L) {
|
|
1170
1189
|
const e = t;
|
|
1171
|
-
e.
|
|
1190
|
+
e.Se = false;
|
|
1172
1191
|
if (e.O & REACTIVE_SNAPSHOT_STALE) {
|
|
1173
1192
|
e.O &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1174
1193
|
e.O |= REACTIVE_DIRTY;
|
|
@@ -1183,7 +1202,7 @@ function releaseSubtree(e) {
|
|
|
1183
1202
|
function clearSnapshots() {
|
|
1184
1203
|
if (snapshotSources) {
|
|
1185
1204
|
for (const e of snapshotSources) {
|
|
1186
|
-
delete e.
|
|
1205
|
+
delete e.Te;
|
|
1187
1206
|
delete e[STORE_SNAPSHOT_PROPS];
|
|
1188
1207
|
}
|
|
1189
1208
|
snapshotSources = null;
|
|
@@ -1191,13 +1210,13 @@ function clearSnapshots() {
|
|
|
1191
1210
|
snapshotCaptureActive = false;
|
|
1192
1211
|
}
|
|
1193
1212
|
function recompute(e, t = false) {
|
|
1194
|
-
const n = e.
|
|
1213
|
+
const n = e.F;
|
|
1195
1214
|
if (!t) {
|
|
1196
|
-
if (e.
|
|
1197
|
-
globalQueue.initTransition(e.
|
|
1215
|
+
if (e.B && (!n || activeTransition) && activeTransition !== e.B)
|
|
1216
|
+
globalQueue.initTransition(e.B);
|
|
1198
1217
|
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1199
1218
|
e.ye = null;
|
|
1200
|
-
if (e.
|
|
1219
|
+
if (e.B || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1201
1220
|
else {
|
|
1202
1221
|
markDisposal(e);
|
|
1203
1222
|
e.we = e.Ve;
|
|
@@ -1208,15 +1227,15 @@ function recompute(e, t = false) {
|
|
|
1208
1227
|
}
|
|
1209
1228
|
}
|
|
1210
1229
|
const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1211
|
-
const r = e.
|
|
1212
|
-
const s = !!(e.
|
|
1213
|
-
const o = !!(e.
|
|
1230
|
+
const r = e.k !== undefined && e.k !== NOT_PENDING;
|
|
1231
|
+
const s = !!(e.Re & STATUS_PENDING);
|
|
1232
|
+
const o = !!(e.Re & STATUS_UNINITIALIZED);
|
|
1214
1233
|
const u = context;
|
|
1215
1234
|
context = e;
|
|
1216
1235
|
e.ge = null;
|
|
1217
1236
|
e.O = REACTIVE_RECOMPUTING_DEPS;
|
|
1218
|
-
e.
|
|
1219
|
-
let c = e.
|
|
1237
|
+
e.de = clock;
|
|
1238
|
+
let c = e.U === NOT_PENDING ? e.te : e.U;
|
|
1220
1239
|
let a = e.o;
|
|
1221
1240
|
let l = tracking;
|
|
1222
1241
|
let f = currentOptimisticLane;
|
|
@@ -1226,20 +1245,22 @@ function recompute(e, t = false) {
|
|
|
1226
1245
|
if (t) currentOptimisticLane = t;
|
|
1227
1246
|
}
|
|
1228
1247
|
try {
|
|
1229
|
-
|
|
1248
|
+
const n = e.ye;
|
|
1249
|
+
const i = e.L(c);
|
|
1250
|
+
c = e.ye !== n ? i : handleAsync(e, i);
|
|
1230
1251
|
clearStatus(e, t);
|
|
1231
|
-
const
|
|
1232
|
-
if (
|
|
1233
|
-
|
|
1234
|
-
updatePendingSignal(
|
|
1252
|
+
const r = resolveLane(e);
|
|
1253
|
+
if (r) {
|
|
1254
|
+
r.H.delete(e);
|
|
1255
|
+
updatePendingSignal(r.ne);
|
|
1235
1256
|
}
|
|
1236
1257
|
} catch (t) {
|
|
1237
1258
|
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
1238
1259
|
const t = findLane(currentOptimisticLane);
|
|
1239
|
-
if (t.
|
|
1240
|
-
t.
|
|
1241
|
-
e.
|
|
1242
|
-
updatePendingSignal(t.
|
|
1260
|
+
if (t.ne !== e) {
|
|
1261
|
+
t.H.add(e);
|
|
1262
|
+
e.ee = t;
|
|
1263
|
+
updatePendingSignal(t.ne);
|
|
1243
1264
|
}
|
|
1244
1265
|
}
|
|
1245
1266
|
if (t instanceof NotReadyError) e.Ue = true;
|
|
@@ -1248,14 +1269,14 @@ function recompute(e, t = false) {
|
|
|
1248
1269
|
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
1249
1270
|
t,
|
|
1250
1271
|
undefined,
|
|
1251
|
-
t instanceof NotReadyError ? e.
|
|
1272
|
+
t instanceof NotReadyError ? e.ee : undefined
|
|
1252
1273
|
);
|
|
1253
1274
|
} finally {
|
|
1254
1275
|
tracking = l;
|
|
1255
1276
|
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1256
1277
|
context = u;
|
|
1257
1278
|
}
|
|
1258
|
-
if (!e.
|
|
1279
|
+
if (!e.Ee) {
|
|
1259
1280
|
const u = e.ge;
|
|
1260
1281
|
let l = u !== null ? u.D : e.C;
|
|
1261
1282
|
if (l !== null) {
|
|
@@ -1265,21 +1286,21 @@ function recompute(e, t = false) {
|
|
|
1265
1286
|
if (u !== null) u.D = null;
|
|
1266
1287
|
else e.C = null;
|
|
1267
1288
|
}
|
|
1268
|
-
const f = r ? e.
|
|
1289
|
+
const f = r ? e.k : e.U === NOT_PENDING ? e.te : e.U;
|
|
1269
1290
|
const E = (!n && o) || !e.ke || !e.ke(f, c);
|
|
1270
1291
|
if (E) {
|
|
1271
|
-
const o = r ? e.
|
|
1272
|
-
if (t || (n && activeTransition !== e.
|
|
1273
|
-
e.
|
|
1292
|
+
const o = r ? e.k : undefined;
|
|
1293
|
+
if (t || (n && activeTransition !== e.B) || i) {
|
|
1294
|
+
e.te = c;
|
|
1274
1295
|
if (r && i) {
|
|
1275
|
-
e.
|
|
1276
|
-
e.
|
|
1296
|
+
e.k = c;
|
|
1297
|
+
e.U = c;
|
|
1277
1298
|
}
|
|
1278
|
-
} else e.
|
|
1279
|
-
if (r && !i && s && !e.
|
|
1280
|
-
if (!r || i || e.
|
|
1299
|
+
} else e.U = c;
|
|
1300
|
+
if (r && !i && s && !e.pe) e.k = c;
|
|
1301
|
+
if (!r || i || e.k !== o) insertSubs(e, i || r);
|
|
1281
1302
|
} else if (r) {
|
|
1282
|
-
e.
|
|
1303
|
+
e.U = c;
|
|
1283
1304
|
} else if (e.o != a) {
|
|
1284
1305
|
for (let t = e.I; t !== null; t = t.h) {
|
|
1285
1306
|
insertIntoHeapHeight(t.p, t.p.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
@@ -1287,8 +1308,8 @@ function recompute(e, t = false) {
|
|
|
1287
1308
|
}
|
|
1288
1309
|
}
|
|
1289
1310
|
currentOptimisticLane = f;
|
|
1290
|
-
(!t || e.
|
|
1291
|
-
e.
|
|
1311
|
+
(!t || e.Re & STATUS_PENDING) && !e.B && !(activeTransition && r) && globalQueue.oe.push(e);
|
|
1312
|
+
e.B && n && activeTransition !== e.B && runInTransition(e.B, () => recompute(e));
|
|
1292
1313
|
}
|
|
1293
1314
|
function updateIfNecessary(e) {
|
|
1294
1315
|
if (e.O & REACTIVE_CHECK) {
|
|
@@ -1303,25 +1324,25 @@ function updateIfNecessary(e) {
|
|
|
1303
1324
|
}
|
|
1304
1325
|
}
|
|
1305
1326
|
}
|
|
1306
|
-
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.
|
|
1327
|
+
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.Ee && e.de < clock && !e.ye)) {
|
|
1307
1328
|
recompute(e);
|
|
1308
1329
|
}
|
|
1309
1330
|
e.O = e.O & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
|
|
1310
1331
|
}
|
|
1311
|
-
function computed(e, t
|
|
1312
|
-
const
|
|
1313
|
-
const
|
|
1314
|
-
id:
|
|
1315
|
-
be:
|
|
1316
|
-
ke:
|
|
1317
|
-
|
|
1318
|
-
|
|
1332
|
+
function computed(e, t) {
|
|
1333
|
+
const n = t?.transparent ?? false;
|
|
1334
|
+
const i = {
|
|
1335
|
+
id: t?.id ?? (n ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1336
|
+
be: n || undefined,
|
|
1337
|
+
ke: t?.equals != null ? t.equals : isEqual,
|
|
1338
|
+
fe: !!t?.ownedWrite,
|
|
1339
|
+
G: t?.unobserved,
|
|
1319
1340
|
Ve: null,
|
|
1320
|
-
|
|
1341
|
+
$: context?.$ ?? globalQueue,
|
|
1321
1342
|
Le: context?.Le ?? defaultContext,
|
|
1322
1343
|
me: 0,
|
|
1323
1344
|
L: e,
|
|
1324
|
-
|
|
1345
|
+
te: undefined,
|
|
1325
1346
|
o: 0,
|
|
1326
1347
|
A: null,
|
|
1327
1348
|
S: undefined,
|
|
@@ -1329,82 +1350,82 @@ function computed(e, t, n) {
|
|
|
1329
1350
|
C: null,
|
|
1330
1351
|
ge: null,
|
|
1331
1352
|
I: null,
|
|
1332
|
-
|
|
1353
|
+
Ne: null,
|
|
1333
1354
|
i: context,
|
|
1334
1355
|
De: null,
|
|
1335
1356
|
Ce: null,
|
|
1336
|
-
O:
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1357
|
+
O: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1358
|
+
Re: STATUS_UNINITIALIZED,
|
|
1359
|
+
de: clock,
|
|
1360
|
+
U: NOT_PENDING,
|
|
1340
1361
|
we: null,
|
|
1341
1362
|
ve: null,
|
|
1342
1363
|
ye: null,
|
|
1343
|
-
|
|
1364
|
+
B: null
|
|
1344
1365
|
};
|
|
1345
|
-
|
|
1346
|
-
const
|
|
1366
|
+
i.T = i;
|
|
1367
|
+
const r = context?.t ? context.u : context;
|
|
1347
1368
|
if (context) {
|
|
1348
1369
|
const e = context.Ce;
|
|
1349
1370
|
if (e === null) {
|
|
1350
|
-
context.Ce =
|
|
1371
|
+
context.Ce = i;
|
|
1351
1372
|
} else {
|
|
1352
|
-
|
|
1353
|
-
context.Ce =
|
|
1373
|
+
i.De = e;
|
|
1374
|
+
context.Ce = i;
|
|
1354
1375
|
}
|
|
1355
1376
|
}
|
|
1356
|
-
if (
|
|
1357
|
-
if (snapshotCaptureActive && ownerInSnapshotScope(context))
|
|
1377
|
+
if (r) i.o = r.o + 1;
|
|
1378
|
+
if (snapshotCaptureActive && ownerInSnapshotScope(context)) i.Se = true;
|
|
1358
1379
|
if (externalSourceConfig) {
|
|
1359
|
-
const e = signal(undefined, { equals: false,
|
|
1360
|
-
const t = externalSourceConfig.factory(
|
|
1380
|
+
const e = signal(undefined, { equals: false, ownedWrite: true });
|
|
1381
|
+
const t = externalSourceConfig.factory(i.L, () => {
|
|
1361
1382
|
setSignal(e, undefined);
|
|
1362
1383
|
});
|
|
1363
1384
|
cleanup(() => t.dispose());
|
|
1364
|
-
|
|
1385
|
+
i.L = n => {
|
|
1365
1386
|
read(e);
|
|
1366
1387
|
return t.track(n);
|
|
1367
1388
|
};
|
|
1368
1389
|
}
|
|
1369
|
-
!
|
|
1370
|
-
if (snapshotCaptureActive && !
|
|
1371
|
-
if (!(
|
|
1372
|
-
|
|
1373
|
-
snapshotSources.add(
|
|
1390
|
+
!t?.lazy && recompute(i, true);
|
|
1391
|
+
if (snapshotCaptureActive && !t?.lazy) {
|
|
1392
|
+
if (!(i.Re & STATUS_PENDING)) {
|
|
1393
|
+
i.Te = i.te === undefined ? NO_SNAPSHOT : i.te;
|
|
1394
|
+
snapshotSources.add(i);
|
|
1374
1395
|
}
|
|
1375
1396
|
}
|
|
1376
|
-
return
|
|
1397
|
+
return i;
|
|
1377
1398
|
}
|
|
1378
1399
|
function signal(e, t, n = null) {
|
|
1379
1400
|
const i = {
|
|
1380
1401
|
ke: t?.equals != null ? t.equals : isEqual,
|
|
1381
|
-
|
|
1402
|
+
fe: !!t?.ownedWrite,
|
|
1382
1403
|
He: !!t?.He,
|
|
1383
|
-
|
|
1384
|
-
|
|
1404
|
+
G: t?.unobserved,
|
|
1405
|
+
te: e,
|
|
1385
1406
|
I: null,
|
|
1386
|
-
|
|
1387
|
-
|
|
1407
|
+
Ne: null,
|
|
1408
|
+
de: clock,
|
|
1388
1409
|
V: n,
|
|
1389
1410
|
N: n?.A || null,
|
|
1390
|
-
|
|
1411
|
+
U: NOT_PENDING
|
|
1391
1412
|
};
|
|
1392
1413
|
n && (n.A = i);
|
|
1393
|
-
if (snapshotCaptureActive && !i.He && !((n?.
|
|
1394
|
-
i.
|
|
1414
|
+
if (snapshotCaptureActive && !i.He && !((n?.Re ?? 0) & STATUS_PENDING)) {
|
|
1415
|
+
i.Te = e === undefined ? NO_SNAPSHOT : e;
|
|
1395
1416
|
snapshotSources.add(i);
|
|
1396
1417
|
}
|
|
1397
1418
|
return i;
|
|
1398
1419
|
}
|
|
1399
1420
|
function optimisticSignal(e, t) {
|
|
1400
1421
|
const n = signal(e, t);
|
|
1401
|
-
n.
|
|
1422
|
+
n.k = NOT_PENDING;
|
|
1402
1423
|
return n;
|
|
1403
1424
|
}
|
|
1404
|
-
function optimisticComputed(e, t
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1407
|
-
return
|
|
1425
|
+
function optimisticComputed(e, t) {
|
|
1426
|
+
const n = computed(e, t);
|
|
1427
|
+
n.k = NOT_PENDING;
|
|
1428
|
+
return n;
|
|
1408
1429
|
}
|
|
1409
1430
|
function isEqual(e, t) {
|
|
1410
1431
|
return e === t;
|
|
@@ -1425,7 +1446,7 @@ function read(e) {
|
|
|
1425
1446
|
const t = getLatestValueComputed(e);
|
|
1426
1447
|
const n = latestReadActive;
|
|
1427
1448
|
latestReadActive = false;
|
|
1428
|
-
const i = e.
|
|
1449
|
+
const i = e.k !== undefined && e.k !== NOT_PENDING ? e.k : e.te;
|
|
1429
1450
|
let r;
|
|
1430
1451
|
try {
|
|
1431
1452
|
r = read(t);
|
|
@@ -1435,11 +1456,11 @@ function read(e) {
|
|
|
1435
1456
|
} finally {
|
|
1436
1457
|
latestReadActive = n;
|
|
1437
1458
|
}
|
|
1438
|
-
if (t.
|
|
1439
|
-
if (stale && currentOptimisticLane && t.
|
|
1440
|
-
const e = findLane(t.
|
|
1459
|
+
if (t.Re & STATUS_PENDING) return i;
|
|
1460
|
+
if (stale && currentOptimisticLane && t.ee) {
|
|
1461
|
+
const e = findLane(t.ee);
|
|
1441
1462
|
const n = findLane(currentOptimisticLane);
|
|
1442
|
-
if (e !== n && e.
|
|
1463
|
+
if (e !== n && e.H.size > 0) {
|
|
1443
1464
|
return i;
|
|
1444
1465
|
}
|
|
1445
1466
|
}
|
|
@@ -1449,8 +1470,8 @@ function read(e) {
|
|
|
1449
1470
|
const t = e.V;
|
|
1450
1471
|
const n = pendingCheckActive;
|
|
1451
1472
|
pendingCheckActive = false;
|
|
1452
|
-
if (t && e.
|
|
1453
|
-
if (e.
|
|
1473
|
+
if (t && e.k !== undefined) {
|
|
1474
|
+
if (e.k !== NOT_PENDING && (t.ye || !!(t.Re & STATUS_PENDING))) {
|
|
1454
1475
|
foundPending = true;
|
|
1455
1476
|
}
|
|
1456
1477
|
let n = context;
|
|
@@ -1463,86 +1484,104 @@ function read(e) {
|
|
|
1463
1484
|
if (t && read(getPendingSignal(t))) foundPending = true;
|
|
1464
1485
|
}
|
|
1465
1486
|
pendingCheckActive = n;
|
|
1466
|
-
return e.
|
|
1487
|
+
return e.te;
|
|
1467
1488
|
}
|
|
1468
1489
|
let t = context;
|
|
1469
1490
|
if (t?.t) t = t.u;
|
|
1470
|
-
|
|
1471
|
-
if (
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1491
|
+
const n = e;
|
|
1492
|
+
if (typeof n.L === "function") {
|
|
1493
|
+
const t = e;
|
|
1494
|
+
if (refreshing && !(t.O & REACTIVE_DISPOSED)) recompute(t);
|
|
1495
|
+
if (t.O & REACTIVE_LAZY) {
|
|
1496
|
+
t.O &= ~REACTIVE_LAZY;
|
|
1497
|
+
recompute(t, true);
|
|
1498
|
+
} else if (t.O & REACTIVE_DISPOSED) {
|
|
1499
|
+
recompute(t, true);
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
const i = e.V || e;
|
|
1476
1503
|
if (t && tracking) {
|
|
1477
|
-
if (e.L && e.O & REACTIVE_DISPOSED) recompute(e);
|
|
1478
1504
|
link(e, t);
|
|
1479
|
-
if (
|
|
1480
|
-
const
|
|
1481
|
-
if (
|
|
1505
|
+
if (i.L) {
|
|
1506
|
+
const n = e.O & REACTIVE_ZOMBIE;
|
|
1507
|
+
if (i.o >= (n ? zombieQueue.P : dirtyQueue.P)) {
|
|
1482
1508
|
markNode(t);
|
|
1483
|
-
markHeap(
|
|
1484
|
-
updateIfNecessary(
|
|
1509
|
+
markHeap(n ? zombieQueue : dirtyQueue);
|
|
1510
|
+
updateIfNecessary(i);
|
|
1485
1511
|
}
|
|
1486
|
-
const r =
|
|
1512
|
+
const r = i.o;
|
|
1487
1513
|
if (r >= t.o && e.i !== t) {
|
|
1488
1514
|
t.o = r + 1;
|
|
1489
1515
|
}
|
|
1490
1516
|
}
|
|
1491
1517
|
}
|
|
1492
|
-
if (
|
|
1493
|
-
if (t && !(stale &&
|
|
1518
|
+
if (i.Re & STATUS_PENDING) {
|
|
1519
|
+
if (t && !(stale && i.B && activeTransition !== i.B)) {
|
|
1494
1520
|
if (currentOptimisticLane) {
|
|
1495
|
-
const
|
|
1521
|
+
const n = i.ee;
|
|
1496
1522
|
const r = findLane(currentOptimisticLane);
|
|
1497
|
-
if (
|
|
1523
|
+
if (n && findLane(n) === r && !hasActiveOverride(i)) {
|
|
1498
1524
|
if (!tracking && e !== t) link(e, t);
|
|
1499
|
-
throw
|
|
1525
|
+
throw i.Ee;
|
|
1500
1526
|
}
|
|
1501
1527
|
} else {
|
|
1502
1528
|
if (!tracking && e !== t) link(e, t);
|
|
1503
|
-
throw
|
|
1529
|
+
throw i.Ee;
|
|
1504
1530
|
}
|
|
1505
|
-
} else if (t &&
|
|
1531
|
+
} else if (t && i !== e && i.Re & STATUS_UNINITIALIZED) {
|
|
1506
1532
|
if (!tracking && e !== t) link(e, t);
|
|
1507
|
-
throw
|
|
1508
|
-
} else if (!t &&
|
|
1509
|
-
throw
|
|
1533
|
+
throw i.Ee;
|
|
1534
|
+
} else if (!t && i.Re & STATUS_UNINITIALIZED) {
|
|
1535
|
+
throw i.Ee;
|
|
1510
1536
|
}
|
|
1511
1537
|
}
|
|
1512
|
-
if (e.L && e.
|
|
1513
|
-
if (e.
|
|
1538
|
+
if (e.L && e.Re & STATUS_ERROR) {
|
|
1539
|
+
if (e.de < clock) {
|
|
1514
1540
|
recompute(e);
|
|
1515
1541
|
return read(e);
|
|
1516
|
-
} else throw e.
|
|
1542
|
+
} else throw e.Ee;
|
|
1517
1543
|
}
|
|
1518
|
-
if (snapshotCaptureActive && t && t.
|
|
1519
|
-
const n = e.
|
|
1544
|
+
if (snapshotCaptureActive && t && t.Se) {
|
|
1545
|
+
const n = e.Te;
|
|
1520
1546
|
if (n !== undefined) {
|
|
1521
1547
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1522
|
-
const r = e.
|
|
1548
|
+
const r = e.U !== NOT_PENDING ? e.U : e.te;
|
|
1523
1549
|
if (r !== i) t.O |= REACTIVE_SNAPSHOT_STALE;
|
|
1524
1550
|
return i;
|
|
1525
1551
|
}
|
|
1526
1552
|
}
|
|
1527
|
-
if (e.
|
|
1528
|
-
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.
|
|
1529
|
-
return e.
|
|
1553
|
+
if (e.k !== undefined && e.k !== NOT_PENDING) {
|
|
1554
|
+
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.te;
|
|
1555
|
+
return e.k;
|
|
1530
1556
|
}
|
|
1531
|
-
|
|
1557
|
+
const r =
|
|
1558
|
+
!t ||
|
|
1532
1559
|
(currentOptimisticLane !== null &&
|
|
1533
|
-
(e.
|
|
1534
|
-
e.
|
|
1535
|
-
(stale && e.
|
|
1536
|
-
|
|
1537
|
-
|
|
1560
|
+
(e.k !== undefined || e.ee || (i === e && stale) || !!(i.Re & STATUS_PENDING))) ||
|
|
1561
|
+
e.U === NOT_PENDING ||
|
|
1562
|
+
(stale && e.B && activeTransition !== e.B)
|
|
1563
|
+
? e.te
|
|
1564
|
+
: e.U;
|
|
1565
|
+
if (
|
|
1566
|
+
!t &&
|
|
1567
|
+
i === e &&
|
|
1568
|
+
typeof n.L === "function" &&
|
|
1569
|
+
!n.Pe &&
|
|
1570
|
+
!(i.Re & STATUS_PENDING) &&
|
|
1571
|
+
!n.i &&
|
|
1572
|
+
!e.I
|
|
1573
|
+
) {
|
|
1574
|
+
unobserved(e);
|
|
1575
|
+
}
|
|
1576
|
+
return r;
|
|
1538
1577
|
}
|
|
1539
1578
|
function setSignal(e, t) {
|
|
1540
|
-
if (e.
|
|
1541
|
-
const n = e.
|
|
1542
|
-
const i = e.
|
|
1543
|
-
const r = n ? (i ? e.
|
|
1579
|
+
if (e.B && activeTransition !== e.B) globalQueue.initTransition(e.B);
|
|
1580
|
+
const n = e.k !== undefined && !projectionWriteActive;
|
|
1581
|
+
const i = e.k !== undefined && e.k !== NOT_PENDING;
|
|
1582
|
+
const r = n ? (i ? e.k : e.te) : e.U === NOT_PENDING ? e.te : e.U;
|
|
1544
1583
|
if (typeof t === "function") t = t(r);
|
|
1545
|
-
const s = !e.ke || !e.ke(r, t) || !!(e.
|
|
1584
|
+
const s = !e.ke || !e.ke(r, t) || !!(e.Re & STATUS_UNINITIALIZED);
|
|
1546
1585
|
if (!s) {
|
|
1547
1586
|
if (n && i && e.L) {
|
|
1548
1587
|
insertSubs(e, true);
|
|
@@ -1551,25 +1590,25 @@ function setSignal(e, t) {
|
|
|
1551
1590
|
return t;
|
|
1552
1591
|
}
|
|
1553
1592
|
if (n) {
|
|
1554
|
-
const n = e.
|
|
1593
|
+
const n = e.k === NOT_PENDING;
|
|
1555
1594
|
if (!n) globalQueue.initTransition(resolveTransition(e));
|
|
1556
1595
|
if (n) {
|
|
1557
|
-
e.
|
|
1558
|
-
globalQueue.
|
|
1596
|
+
e.U = e.te;
|
|
1597
|
+
globalQueue.q.push(e);
|
|
1559
1598
|
}
|
|
1560
|
-
e.
|
|
1599
|
+
e.pe = true;
|
|
1561
1600
|
const i = getOrCreateLane(e);
|
|
1562
|
-
e.
|
|
1563
|
-
e.
|
|
1601
|
+
e.ee = i;
|
|
1602
|
+
e.k = t;
|
|
1564
1603
|
} else {
|
|
1565
|
-
if (e.
|
|
1566
|
-
e.
|
|
1604
|
+
if (e.U === NOT_PENDING) globalQueue.oe.push(e);
|
|
1605
|
+
e.U = t;
|
|
1567
1606
|
}
|
|
1568
1607
|
updatePendingSignal(e);
|
|
1569
|
-
if (e.
|
|
1570
|
-
setSignal(e.
|
|
1608
|
+
if (e.Ge) {
|
|
1609
|
+
setSignal(e.Ge, t);
|
|
1571
1610
|
}
|
|
1572
|
-
e.
|
|
1611
|
+
e.de = clock;
|
|
1573
1612
|
insertSubs(e, n);
|
|
1574
1613
|
schedule();
|
|
1575
1614
|
return t;
|
|
@@ -1587,68 +1626,68 @@ function runWithOwner(e, t) {
|
|
|
1587
1626
|
}
|
|
1588
1627
|
}
|
|
1589
1628
|
function getPendingSignal(e) {
|
|
1590
|
-
if (!e.
|
|
1591
|
-
e.
|
|
1592
|
-
if (e.
|
|
1593
|
-
e.
|
|
1629
|
+
if (!e.Me) {
|
|
1630
|
+
e.Me = optimisticSignal(false, { ownedWrite: true });
|
|
1631
|
+
if (e.Ie) {
|
|
1632
|
+
e.Me.Ie = e;
|
|
1594
1633
|
}
|
|
1595
|
-
if (computePendingState(e)) setSignal(e.
|
|
1634
|
+
if (computePendingState(e)) setSignal(e.Me, true);
|
|
1596
1635
|
}
|
|
1597
|
-
return e.
|
|
1636
|
+
return e.Me;
|
|
1598
1637
|
}
|
|
1599
1638
|
function computePendingState(e) {
|
|
1600
1639
|
const t = e;
|
|
1601
1640
|
const n = e.V;
|
|
1602
|
-
if (n && e.
|
|
1603
|
-
return !n.ye && !(n.
|
|
1641
|
+
if (n && e.U !== NOT_PENDING) {
|
|
1642
|
+
return !n.ye && !(n.Re & STATUS_PENDING);
|
|
1604
1643
|
}
|
|
1605
|
-
if (e.
|
|
1606
|
-
if (t.
|
|
1607
|
-
if (e.
|
|
1608
|
-
const t = e.
|
|
1609
|
-
return !!(t && t.
|
|
1644
|
+
if (e.k !== undefined && e.k !== NOT_PENDING) {
|
|
1645
|
+
if (t.Re & STATUS_PENDING && !(t.Re & STATUS_UNINITIALIZED)) return true;
|
|
1646
|
+
if (e.Ie) {
|
|
1647
|
+
const t = e.ee ? findLane(e.ee) : null;
|
|
1648
|
+
return !!(t && t.H.size > 0);
|
|
1610
1649
|
}
|
|
1611
1650
|
return true;
|
|
1612
1651
|
}
|
|
1613
|
-
if (e.
|
|
1652
|
+
if (e.k !== undefined && e.k === NOT_PENDING && !e.Ie) {
|
|
1614
1653
|
return false;
|
|
1615
1654
|
}
|
|
1616
|
-
if (e.
|
|
1617
|
-
return !!(t.
|
|
1655
|
+
if (e.U !== NOT_PENDING && !(t.Re & STATUS_UNINITIALIZED)) return true;
|
|
1656
|
+
return !!(t.Re & STATUS_PENDING && !(t.Re & STATUS_UNINITIALIZED));
|
|
1618
1657
|
}
|
|
1619
1658
|
function updatePendingSignal(e) {
|
|
1620
|
-
if (e.
|
|
1659
|
+
if (e.Me) {
|
|
1621
1660
|
const t = computePendingState(e);
|
|
1622
|
-
const n = e.
|
|
1661
|
+
const n = e.Me;
|
|
1623
1662
|
setSignal(n, t);
|
|
1624
|
-
if (!t && n.
|
|
1663
|
+
if (!t && n.ee) {
|
|
1625
1664
|
const t = resolveLane(e);
|
|
1626
|
-
if (t && t.
|
|
1627
|
-
const e = findLane(n.
|
|
1665
|
+
if (t && t.H.size > 0) {
|
|
1666
|
+
const e = findLane(n.ee);
|
|
1628
1667
|
if (e !== t) {
|
|
1629
1668
|
mergeLanes(t, e);
|
|
1630
1669
|
}
|
|
1631
1670
|
}
|
|
1632
1671
|
signalLanes.delete(n);
|
|
1633
|
-
n.
|
|
1672
|
+
n.ee = undefined;
|
|
1634
1673
|
}
|
|
1635
1674
|
}
|
|
1636
1675
|
}
|
|
1637
1676
|
function getLatestValueComputed(e) {
|
|
1638
|
-
if (!e.
|
|
1677
|
+
if (!e.Ge) {
|
|
1639
1678
|
const t = latestReadActive;
|
|
1640
1679
|
latestReadActive = false;
|
|
1641
1680
|
const n = pendingCheckActive;
|
|
1642
1681
|
pendingCheckActive = false;
|
|
1643
1682
|
const i = context;
|
|
1644
1683
|
context = null;
|
|
1645
|
-
e.
|
|
1646
|
-
e.
|
|
1684
|
+
e.Ge = optimisticComputed(() => read(e));
|
|
1685
|
+
e.Ge.Ie = e;
|
|
1647
1686
|
context = i;
|
|
1648
1687
|
pendingCheckActive = n;
|
|
1649
1688
|
latestReadActive = t;
|
|
1650
1689
|
}
|
|
1651
|
-
return e.
|
|
1690
|
+
return e.Ge;
|
|
1652
1691
|
}
|
|
1653
1692
|
function staleValues(e, t = true) {
|
|
1654
1693
|
const n = stale;
|
|
@@ -1727,29 +1766,30 @@ function hasContext(e, t) {
|
|
|
1727
1766
|
function isUndefined(e) {
|
|
1728
1767
|
return typeof e === "undefined";
|
|
1729
1768
|
}
|
|
1730
|
-
function effect(e, t, n, i
|
|
1731
|
-
let
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1769
|
+
function effect(e, t, n, i) {
|
|
1770
|
+
let r = false;
|
|
1771
|
+
const s = !!i?.user;
|
|
1772
|
+
const o = computed(s ? e : t => staleValues(() => e(t)), {
|
|
1773
|
+
...i,
|
|
1734
1774
|
equals: () => {
|
|
1735
|
-
o.
|
|
1736
|
-
if (
|
|
1775
|
+
o.j = !o.Ee;
|
|
1776
|
+
if (r) o.$.enqueue(o.F, runEffect.bind(o));
|
|
1737
1777
|
return false;
|
|
1738
1778
|
},
|
|
1739
1779
|
lazy: true
|
|
1740
1780
|
});
|
|
1741
|
-
o.Qe =
|
|
1742
|
-
o.
|
|
1781
|
+
o.Qe = undefined;
|
|
1782
|
+
o.Fe = t;
|
|
1743
1783
|
o.je = n;
|
|
1744
1784
|
o.$e = undefined;
|
|
1745
|
-
o.
|
|
1746
|
-
o.
|
|
1747
|
-
const n = e !== undefined ? e : o.
|
|
1748
|
-
const i = t !== undefined ? t : o.
|
|
1785
|
+
o.F = s ? EFFECT_USER : EFFECT_RENDER;
|
|
1786
|
+
o.xe = (e, t) => {
|
|
1787
|
+
const n = e !== undefined ? e : o.Re;
|
|
1788
|
+
const i = t !== undefined ? t : o.Ee;
|
|
1749
1789
|
if (n & STATUS_ERROR) {
|
|
1750
1790
|
let e = i;
|
|
1751
|
-
o
|
|
1752
|
-
if (o.
|
|
1791
|
+
o.$.notify(o, STATUS_PENDING, 0);
|
|
1792
|
+
if (o.F === EFFECT_USER) {
|
|
1753
1793
|
try {
|
|
1754
1794
|
return o.je
|
|
1755
1795
|
? o.je(e, () => {
|
|
@@ -1761,38 +1801,39 @@ function effect(e, t, n, i, r) {
|
|
|
1761
1801
|
e = t;
|
|
1762
1802
|
}
|
|
1763
1803
|
}
|
|
1764
|
-
if (!o
|
|
1765
|
-
} else if (o.
|
|
1766
|
-
o
|
|
1804
|
+
if (!o.$.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1805
|
+
} else if (o.F === EFFECT_RENDER) {
|
|
1806
|
+
o.$.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
1767
1807
|
}
|
|
1768
1808
|
};
|
|
1769
1809
|
recompute(o, true);
|
|
1770
|
-
!
|
|
1771
|
-
|
|
1810
|
+
!i?.defer &&
|
|
1811
|
+
(o.F === EFFECT_USER || i?.schedule ? o.$.enqueue(o.F, runEffect.bind(o)) : runEffect.call(o));
|
|
1812
|
+
r = true;
|
|
1772
1813
|
cleanup(() => o.$e?.());
|
|
1773
1814
|
}
|
|
1774
1815
|
function runEffect() {
|
|
1775
|
-
if (!this.
|
|
1816
|
+
if (!this.j || this.O & REACTIVE_DISPOSED) return;
|
|
1776
1817
|
this.$e?.();
|
|
1777
1818
|
this.$e = undefined;
|
|
1778
1819
|
try {
|
|
1779
|
-
const e = this.
|
|
1820
|
+
const e = this.Fe(this.te, this.Qe);
|
|
1780
1821
|
if (false && e !== undefined && typeof e !== "function");
|
|
1781
1822
|
this.$e = e;
|
|
1782
1823
|
} catch (e) {
|
|
1783
|
-
this.
|
|
1784
|
-
this.
|
|
1785
|
-
if (!this
|
|
1824
|
+
this.Ee = new StatusError(this, e);
|
|
1825
|
+
this.Re |= STATUS_ERROR;
|
|
1826
|
+
if (!this.$.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1786
1827
|
} finally {
|
|
1787
|
-
this.Qe = this.
|
|
1788
|
-
this.
|
|
1828
|
+
this.Qe = this.te;
|
|
1829
|
+
this.j = false;
|
|
1789
1830
|
}
|
|
1790
1831
|
}
|
|
1791
1832
|
function trackedEffect(e, t) {
|
|
1792
1833
|
const run = () => {
|
|
1793
|
-
if (!n.
|
|
1834
|
+
if (!n.j || n.O & REACTIVE_DISPOSED) return;
|
|
1794
1835
|
try {
|
|
1795
|
-
n.
|
|
1836
|
+
n.j = false;
|
|
1796
1837
|
recompute(n);
|
|
1797
1838
|
} finally {
|
|
1798
1839
|
}
|
|
@@ -1804,23 +1845,22 @@ function trackedEffect(e, t) {
|
|
|
1804
1845
|
const t = staleValues(e);
|
|
1805
1846
|
n.$e = t;
|
|
1806
1847
|
},
|
|
1807
|
-
undefined,
|
|
1808
1848
|
{ ...t, lazy: true }
|
|
1809
1849
|
);
|
|
1810
1850
|
n.$e = undefined;
|
|
1811
1851
|
n.Ke = true;
|
|
1812
|
-
n.
|
|
1813
|
-
n.
|
|
1814
|
-
n.
|
|
1815
|
-
const i = e !== undefined ? e : n.
|
|
1852
|
+
n.j = true;
|
|
1853
|
+
n.F = EFFECT_TRACKED;
|
|
1854
|
+
n.xe = (e, t) => {
|
|
1855
|
+
const i = e !== undefined ? e : n.Re;
|
|
1816
1856
|
if (i & STATUS_ERROR) {
|
|
1817
|
-
n
|
|
1818
|
-
const e = t !== undefined ? t : n.
|
|
1819
|
-
if (!n
|
|
1857
|
+
n.$.notify(n, STATUS_PENDING, 0);
|
|
1858
|
+
const e = t !== undefined ? t : n.Ee;
|
|
1859
|
+
if (!n.$.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1820
1860
|
}
|
|
1821
1861
|
};
|
|
1822
|
-
n.
|
|
1823
|
-
n
|
|
1862
|
+
n.K = run;
|
|
1863
|
+
n.$.enqueue(EFFECT_USER, run);
|
|
1824
1864
|
cleanup(() => n.$e?.());
|
|
1825
1865
|
}
|
|
1826
1866
|
function restoreTransition(e, t) {
|
|
@@ -1835,11 +1875,11 @@ function action(e) {
|
|
|
1835
1875
|
const r = e(...t);
|
|
1836
1876
|
globalQueue.initTransition();
|
|
1837
1877
|
let s = activeTransition;
|
|
1838
|
-
s
|
|
1878
|
+
s.Z.push(r);
|
|
1839
1879
|
const done = (e, t) => {
|
|
1840
1880
|
s = currentTransition(s);
|
|
1841
|
-
const o = s
|
|
1842
|
-
if (o >= 0) s
|
|
1881
|
+
const o = s.Z.indexOf(r);
|
|
1882
|
+
if (o >= 0) s.Z.splice(o, 1);
|
|
1843
1883
|
setActiveTransition(s);
|
|
1844
1884
|
schedule();
|
|
1845
1885
|
t ? i(t) : n(e);
|
|
@@ -1875,23 +1915,24 @@ function accessor(e) {
|
|
|
1875
1915
|
t.$r = true;
|
|
1876
1916
|
return t;
|
|
1877
1917
|
}
|
|
1878
|
-
function createSignal(e, t
|
|
1918
|
+
function createSignal(e, t) {
|
|
1879
1919
|
if (typeof e === "function") {
|
|
1880
|
-
const
|
|
1881
|
-
|
|
1920
|
+
const n = computed(e, t);
|
|
1921
|
+
n.Pe = true;
|
|
1922
|
+
return [accessor(n), setSignal.bind(null, n)];
|
|
1882
1923
|
}
|
|
1883
|
-
const
|
|
1884
|
-
return [accessor(
|
|
1924
|
+
const n = signal(e, t);
|
|
1925
|
+
return [accessor(n), setSignal.bind(null, n)];
|
|
1885
1926
|
}
|
|
1886
|
-
function createMemo(e, t
|
|
1887
|
-
let
|
|
1888
|
-
return accessor(
|
|
1927
|
+
function createMemo(e, t) {
|
|
1928
|
+
let n = computed(e, t);
|
|
1929
|
+
return accessor(n);
|
|
1889
1930
|
}
|
|
1890
|
-
function createEffect(e, t, n
|
|
1891
|
-
effect(e, t.effect || t, t.error,
|
|
1931
|
+
function createEffect(e, t, n) {
|
|
1932
|
+
effect(e, t.effect || t, t.error, { user: true, ...n });
|
|
1892
1933
|
}
|
|
1893
|
-
function createRenderEffect(e, t, n
|
|
1894
|
-
effect(e, t, undefined, n
|
|
1934
|
+
function createRenderEffect(e, t, n) {
|
|
1935
|
+
effect(e, t, undefined, n);
|
|
1895
1936
|
}
|
|
1896
1937
|
function createTrackedEffect(e, t) {
|
|
1897
1938
|
trackedEffect(e, t);
|
|
@@ -1912,8 +1953,7 @@ function createReaction(e, t) {
|
|
|
1912
1953
|
dispose(t);
|
|
1913
1954
|
},
|
|
1914
1955
|
e.error,
|
|
1915
|
-
|
|
1916
|
-
{ defer: true, ...(false ? { ...t, name: t?.name ?? "effect" } : t) }
|
|
1956
|
+
{ ...(false ? { ...t, name: t?.name ?? "effect" } : t), user: true, defer: true }
|
|
1917
1957
|
);
|
|
1918
1958
|
});
|
|
1919
1959
|
};
|
|
@@ -1933,13 +1973,14 @@ function resolve(e) {
|
|
|
1933
1973
|
});
|
|
1934
1974
|
});
|
|
1935
1975
|
}
|
|
1936
|
-
function createOptimistic(e, t
|
|
1976
|
+
function createOptimistic(e, t) {
|
|
1937
1977
|
if (typeof e === "function") {
|
|
1938
|
-
const
|
|
1939
|
-
|
|
1978
|
+
const n = optimisticComputed(e, t);
|
|
1979
|
+
n.Pe = true;
|
|
1980
|
+
return [accessor(n), setSignal.bind(null, n)];
|
|
1940
1981
|
}
|
|
1941
|
-
const
|
|
1942
|
-
return [accessor(
|
|
1982
|
+
const n = optimisticSignal(e, t);
|
|
1983
|
+
return [accessor(n), setSignal.bind(null, n)];
|
|
1943
1984
|
}
|
|
1944
1985
|
function onSettled(e) {
|
|
1945
1986
|
const t = getOwner();
|
|
@@ -2086,7 +2127,7 @@ function reconcile(e, t) {
|
|
|
2086
2127
|
applyState(e, n, i);
|
|
2087
2128
|
};
|
|
2088
2129
|
}
|
|
2089
|
-
function createProjectionInternal(e, t
|
|
2130
|
+
function createProjectionInternal(e, t, n) {
|
|
2090
2131
|
let i;
|
|
2091
2132
|
const r = new WeakMap();
|
|
2092
2133
|
const wrapper = e => {
|
|
@@ -2108,28 +2149,35 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2108
2149
|
};
|
|
2109
2150
|
const s = wrapProjection(t);
|
|
2110
2151
|
i = computed(() => {
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
const o = new Proxy(
|
|
2115
|
-
s,
|
|
2116
|
-
createWriteTraps(() => !i || t.ye === r)
|
|
2117
|
-
);
|
|
2118
|
-
storeSetter(o, o => {
|
|
2119
|
-
r = e(o);
|
|
2120
|
-
i = true;
|
|
2121
|
-
const u = handleAsync(t, r, e => {
|
|
2122
|
-
e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
|
|
2123
|
-
});
|
|
2124
|
-
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2125
|
-
});
|
|
2126
|
-
});
|
|
2152
|
+
if (!i) i = getOwner();
|
|
2153
|
+
runProjectionComputed(s, e, n?.key || "id");
|
|
2154
|
+
}, undefined);
|
|
2127
2155
|
i.Pe = true;
|
|
2128
2156
|
return { store: s, node: i };
|
|
2129
2157
|
}
|
|
2130
|
-
function createProjection(e, t
|
|
2158
|
+
function createProjection(e, t, n) {
|
|
2131
2159
|
return createProjectionInternal(e, t, n).store;
|
|
2132
2160
|
}
|
|
2161
|
+
function runProjectionComputed(e, t, n, i) {
|
|
2162
|
+
const r = getOwner();
|
|
2163
|
+
let s = false;
|
|
2164
|
+
let o;
|
|
2165
|
+
const u = new Proxy(
|
|
2166
|
+
e,
|
|
2167
|
+
createWriteTraps(() => !s || r.ye === o)
|
|
2168
|
+
);
|
|
2169
|
+
storeSetter(u, u => {
|
|
2170
|
+
o = t(u);
|
|
2171
|
+
s = true;
|
|
2172
|
+
const commit = t => {
|
|
2173
|
+
if (t === u || t === undefined) return;
|
|
2174
|
+
const write = () => storeSetter(e, reconcile(t, n));
|
|
2175
|
+
i ? i(write) : write();
|
|
2176
|
+
};
|
|
2177
|
+
commit(handleAsync(r, o, commit));
|
|
2178
|
+
});
|
|
2179
|
+
return r;
|
|
2180
|
+
}
|
|
2133
2181
|
function createWriteTraps(e) {
|
|
2134
2182
|
const t = {
|
|
2135
2183
|
get(e, n) {
|
|
@@ -2239,17 +2287,17 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
|
2239
2287
|
{
|
|
2240
2288
|
equals: r,
|
|
2241
2289
|
unobserved() {
|
|
2242
|
-
delete e[t];
|
|
2290
|
+
if (e[t] === u) delete e[t];
|
|
2243
2291
|
}
|
|
2244
2292
|
},
|
|
2245
2293
|
i
|
|
2246
2294
|
);
|
|
2247
2295
|
if (s) {
|
|
2248
|
-
u.
|
|
2296
|
+
u.k = NOT_PENDING;
|
|
2249
2297
|
}
|
|
2250
2298
|
if (o && t in o) {
|
|
2251
2299
|
const e = o[t];
|
|
2252
|
-
u.
|
|
2300
|
+
u.Te = e === undefined ? NO_SNAPSHOT : e;
|
|
2253
2301
|
snapshotSources?.add(u);
|
|
2254
2302
|
}
|
|
2255
2303
|
return (e[t] = u);
|
|
@@ -2282,8 +2330,8 @@ function getPropertyDescriptor(e, t, n) {
|
|
|
2282
2330
|
function prepareStoreWrite(e, t, n) {
|
|
2283
2331
|
if (e[STORE_OPTIMISTIC]) {
|
|
2284
2332
|
const t = e[STORE_FIREWALL];
|
|
2285
|
-
if (t?.
|
|
2286
|
-
globalQueue.initTransition(t.
|
|
2333
|
+
if (t?.B) {
|
|
2334
|
+
globalQueue.initTransition(t.B);
|
|
2287
2335
|
}
|
|
2288
2336
|
}
|
|
2289
2337
|
const i = e[STORE_VALUE];
|
|
@@ -2291,7 +2339,7 @@ function prepareStoreWrite(e, t, n) {
|
|
|
2291
2339
|
if (
|
|
2292
2340
|
snapshotCaptureActive &&
|
|
2293
2341
|
typeof n !== "symbol" &&
|
|
2294
|
-
!((e[STORE_FIREWALL]?.
|
|
2342
|
+
!((e[STORE_FIREWALL]?.Re ?? 0) & STATUS_PENDING)
|
|
2295
2343
|
) {
|
|
2296
2344
|
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2297
2345
|
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
@@ -2306,20 +2354,45 @@ function prepareStoreWrite(e, t, n) {
|
|
|
2306
2354
|
if (s) trackOptimisticStore(t);
|
|
2307
2355
|
return { base: r, overrideKey: o, state: i };
|
|
2308
2356
|
}
|
|
2309
|
-
function
|
|
2310
|
-
if (
|
|
2311
|
-
const
|
|
2357
|
+
function upsertStoreNode(e, t, n, i, r) {
|
|
2358
|
+
if (t[n]) return t[n];
|
|
2359
|
+
const s = isWrappable(i) ? wrap(i, e) : i;
|
|
2360
|
+
const o = getNode(t, n, s, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC], r);
|
|
2361
|
+
registerTransientStoreNode(o);
|
|
2362
|
+
return o;
|
|
2363
|
+
}
|
|
2364
|
+
function notifyStoreProperty(e, t, n, i, r, s) {
|
|
2365
|
+
const o = projectionWriteActive || e[STORE_OPTIMISTIC];
|
|
2366
|
+
const u = n !== "delete";
|
|
2367
|
+
const c = e[STORE_HAS]?.[t];
|
|
2368
|
+
if (c) {
|
|
2369
|
+
setSignal(c, u);
|
|
2370
|
+
} else if (!o && n !== "invalidate" && s !== u) {
|
|
2371
|
+
const n = upsertStoreNode(e, getNodes(e, STORE_HAS), t, s);
|
|
2372
|
+
setSignal(n, u);
|
|
2373
|
+
}
|
|
2374
|
+
const a = getNodes(e, STORE_NODE);
|
|
2312
2375
|
if (n === "set") {
|
|
2313
|
-
|
|
2376
|
+
if (a[t]) {
|
|
2377
|
+
setSignal(a[t], () => (isWrappable(i) ? wrap(i, e) : i));
|
|
2378
|
+
} else if (!o) {
|
|
2379
|
+
const n = upsertStoreNode(e, a, t, r, e[STORE_SNAPSHOT_PROPS]);
|
|
2380
|
+
setSignal(n, () => (isWrappable(i) ? wrap(i, e) : i));
|
|
2381
|
+
}
|
|
2314
2382
|
} else if (n === "invalidate") {
|
|
2315
|
-
if (
|
|
2316
|
-
setSignal(
|
|
2317
|
-
delete
|
|
2383
|
+
if (a[t]) {
|
|
2384
|
+
setSignal(a[t], {});
|
|
2385
|
+
delete a[t];
|
|
2318
2386
|
}
|
|
2319
2387
|
} else {
|
|
2320
|
-
|
|
2388
|
+
if (a[t]) {
|
|
2389
|
+
setSignal(a[t], undefined);
|
|
2390
|
+
} else if (!o) {
|
|
2391
|
+
const n = upsertStoreNode(e, a, t, r, e[STORE_SNAPSHOT_PROPS]);
|
|
2392
|
+
setSignal(n, undefined);
|
|
2393
|
+
}
|
|
2321
2394
|
}
|
|
2322
|
-
|
|
2395
|
+
a[$TRACK] && setSignal(a[$TRACK], undefined);
|
|
2323
2396
|
}
|
|
2324
2397
|
let Writing = null;
|
|
2325
2398
|
const storeTraps = {
|
|
@@ -2348,11 +2421,11 @@ const storeTraps = {
|
|
|
2348
2421
|
if (writeOnly(n)) {
|
|
2349
2422
|
let n =
|
|
2350
2423
|
r && (o || !u)
|
|
2351
|
-
? r.
|
|
2352
|
-
? r.
|
|
2353
|
-
: r.
|
|
2354
|
-
? r.
|
|
2355
|
-
: r.
|
|
2424
|
+
? r.k !== undefined && r.k !== NOT_PENDING
|
|
2425
|
+
? r.k
|
|
2426
|
+
: r.U !== NOT_PENDING
|
|
2427
|
+
? r.U
|
|
2428
|
+
: r.te
|
|
2356
2429
|
: c[t];
|
|
2357
2430
|
n === $DELETED && (n = undefined);
|
|
2358
2431
|
if (!isWrappable(n)) return n;
|
|
@@ -2394,11 +2467,11 @@ const storeTraps = {
|
|
|
2394
2467
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2395
2468
|
? e[STORE_OVERRIDE][t] !== $DELETED
|
|
2396
2469
|
: t in e[STORE_VALUE];
|
|
2397
|
-
if (
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2470
|
+
if (writeOnly(e[$PROXY])) return n;
|
|
2471
|
+
const i = getNodes(e, STORE_HAS);
|
|
2472
|
+
if (i[t]) return read(i[t]);
|
|
2473
|
+
if (getObserver()) {
|
|
2474
|
+
return read(getNode(i, t, n, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC]));
|
|
2402
2475
|
}
|
|
2403
2476
|
return n;
|
|
2404
2477
|
},
|
|
@@ -2413,29 +2486,39 @@ const storeTraps = {
|
|
|
2413
2486
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2414
2487
|
? e[STORE_OVERRIDE][t]
|
|
2415
2488
|
: r;
|
|
2416
|
-
const c =
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2489
|
+
const c =
|
|
2490
|
+
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2491
|
+
? e[STORE_OPTIMISTIC_OVERRIDE][t] !== $DELETED
|
|
2492
|
+
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2493
|
+
? e[STORE_OVERRIDE][t] !== $DELETED
|
|
2494
|
+
: t in e[STORE_VALUE];
|
|
2495
|
+
const a = n?.[$TARGET]?.[STORE_VALUE] ?? n;
|
|
2496
|
+
const l = Array.isArray(o) && t !== "length";
|
|
2497
|
+
const f = l ? parseInt(t) + 1 : 0;
|
|
2498
|
+
const E =
|
|
2499
|
+
l &&
|
|
2421
2500
|
(e[STORE_OPTIMISTIC_OVERRIDE] && "length" in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2422
2501
|
? e[STORE_OPTIMISTIC_OVERRIDE].length
|
|
2423
2502
|
: e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
|
|
2424
2503
|
? e[STORE_OVERRIDE].length
|
|
2425
2504
|
: o.length);
|
|
2426
|
-
const
|
|
2427
|
-
if (u ===
|
|
2428
|
-
if (
|
|
2505
|
+
const d = l && f > E ? f : undefined;
|
|
2506
|
+
if (u === a && d === undefined) return true;
|
|
2507
|
+
if (a !== undefined && a === r && d === undefined) delete e[s]?.[t];
|
|
2429
2508
|
else {
|
|
2430
2509
|
const n = e[s] || (e[s] = Object.create(null));
|
|
2431
|
-
n[t] =
|
|
2432
|
-
if (
|
|
2510
|
+
n[t] = a;
|
|
2511
|
+
if (d !== undefined) n.length = d;
|
|
2433
2512
|
}
|
|
2434
|
-
notifyStoreProperty(e, t, "set", c);
|
|
2435
|
-
if (Array.isArray(o)) {
|
|
2436
|
-
const
|
|
2437
|
-
|
|
2438
|
-
|
|
2513
|
+
notifyStoreProperty(e, t, "set", a, u, c);
|
|
2514
|
+
if (Array.isArray(o) && t !== "length" && d !== undefined) {
|
|
2515
|
+
const t = getNodes(e, STORE_NODE);
|
|
2516
|
+
if (t.length) {
|
|
2517
|
+
setSignal(t.length, d);
|
|
2518
|
+
} else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
|
|
2519
|
+
const n = upsertStoreNode(e, t, "length", E, e[STORE_SNAPSHOT_PROPS]);
|
|
2520
|
+
setSignal(n, d);
|
|
2521
|
+
}
|
|
2439
2522
|
}
|
|
2440
2523
|
if (false);
|
|
2441
2524
|
});
|
|
@@ -2474,7 +2557,7 @@ const storeTraps = {
|
|
|
2474
2557
|
} else if (e[i] && t in e[i]) {
|
|
2475
2558
|
delete e[i][t];
|
|
2476
2559
|
} else return true;
|
|
2477
|
-
notifyStoreProperty(e, t, "delete");
|
|
2560
|
+
notifyStoreProperty(e, t, "delete", undefined, r, true);
|
|
2478
2561
|
});
|
|
2479
2562
|
}
|
|
2480
2563
|
return true;
|
|
@@ -2544,9 +2627,9 @@ function createStore(e, t, n) {
|
|
|
2544
2627
|
return [r, e => storeSetter(r, e)];
|
|
2545
2628
|
}
|
|
2546
2629
|
function createOptimisticStore(e, t, n) {
|
|
2547
|
-
GlobalQueue.
|
|
2630
|
+
GlobalQueue.ae ||= clearOptimisticStore;
|
|
2548
2631
|
const i = typeof e === "function";
|
|
2549
|
-
const r =
|
|
2632
|
+
const r = i ? t : e;
|
|
2550
2633
|
const s = i ? e : undefined;
|
|
2551
2634
|
const { store: o } = createOptimisticProjectionInternal(s, r, n);
|
|
2552
2635
|
return [o, e => storeSetter(o, e)];
|
|
@@ -2561,7 +2644,7 @@ function clearOptimisticStore(e) {
|
|
|
2561
2644
|
if (i) {
|
|
2562
2645
|
for (const e of Reflect.ownKeys(n)) {
|
|
2563
2646
|
if (i[e]) {
|
|
2564
|
-
i[e].
|
|
2647
|
+
i[e].ee = undefined;
|
|
2565
2648
|
const n =
|
|
2566
2649
|
t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
|
|
2567
2650
|
const r = n === $DELETED ? undefined : n;
|
|
@@ -2569,7 +2652,7 @@ function clearOptimisticStore(e) {
|
|
|
2569
2652
|
}
|
|
2570
2653
|
}
|
|
2571
2654
|
if (i[$TRACK]) {
|
|
2572
|
-
i[$TRACK].
|
|
2655
|
+
i[$TRACK].ee = undefined;
|
|
2573
2656
|
setSignal(i[$TRACK], undefined);
|
|
2574
2657
|
}
|
|
2575
2658
|
}
|
|
@@ -2578,7 +2661,7 @@ function clearOptimisticStore(e) {
|
|
|
2578
2661
|
}
|
|
2579
2662
|
delete t[STORE_OPTIMISTIC_OVERRIDE];
|
|
2580
2663
|
}
|
|
2581
|
-
function createOptimisticProjectionInternal(e, t
|
|
2664
|
+
function createOptimisticProjectionInternal(e, t, n) {
|
|
2582
2665
|
let i;
|
|
2583
2666
|
const r = new WeakMap();
|
|
2584
2667
|
const wrapper = e => {
|
|
@@ -2601,33 +2684,22 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2601
2684
|
};
|
|
2602
2685
|
const s = wrapProjection(t);
|
|
2603
2686
|
if (e) {
|
|
2687
|
+
const wrapCommit = e => {
|
|
2688
|
+
setProjectionWriteActive(true);
|
|
2689
|
+
try {
|
|
2690
|
+
e();
|
|
2691
|
+
} finally {
|
|
2692
|
+
setProjectionWriteActive(false);
|
|
2693
|
+
}
|
|
2694
|
+
};
|
|
2604
2695
|
i = computed(() => {
|
|
2605
|
-
const t = getOwner();
|
|
2606
|
-
let i = false;
|
|
2607
|
-
let r;
|
|
2608
|
-
const o = new Proxy(
|
|
2609
|
-
s,
|
|
2610
|
-
createWriteTraps(() => !i || t.ye === r)
|
|
2611
|
-
);
|
|
2612
2696
|
setProjectionWriteActive(true);
|
|
2613
2697
|
try {
|
|
2614
|
-
|
|
2615
|
-
r = e(o);
|
|
2616
|
-
i = true;
|
|
2617
|
-
const u = handleAsync(t, r, e => {
|
|
2618
|
-
setProjectionWriteActive(true);
|
|
2619
|
-
try {
|
|
2620
|
-
e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
|
|
2621
|
-
} finally {
|
|
2622
|
-
setProjectionWriteActive(false);
|
|
2623
|
-
}
|
|
2624
|
-
});
|
|
2625
|
-
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2626
|
-
});
|
|
2698
|
+
runProjectionComputed(s, e, n?.key || "id", wrapCommit);
|
|
2627
2699
|
} finally {
|
|
2628
2700
|
setProjectionWriteActive(false);
|
|
2629
2701
|
}
|
|
2630
|
-
});
|
|
2702
|
+
}, undefined);
|
|
2631
2703
|
i.Pe = true;
|
|
2632
2704
|
}
|
|
2633
2705
|
return { store: s, node: i };
|
|
@@ -2888,7 +2960,7 @@ function mapArray(e, t, n) {
|
|
|
2888
2960
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2889
2961
|
const r = t.length > 1;
|
|
2890
2962
|
const s = t;
|
|
2891
|
-
|
|
2963
|
+
const o = computed(
|
|
2892
2964
|
updateKeyedMap.bind({
|
|
2893
2965
|
Ye: createOwner(),
|
|
2894
2966
|
Ze: 0,
|
|
@@ -2903,8 +2975,10 @@ function mapArray(e, t, n) {
|
|
|
2903
2975
|
it: n?.fallback
|
|
2904
2976
|
})
|
|
2905
2977
|
);
|
|
2978
|
+
o.Pe = true;
|
|
2979
|
+
return accessor(o);
|
|
2906
2980
|
}
|
|
2907
|
-
const pureOptions = {
|
|
2981
|
+
const pureOptions = { ownedWrite: true };
|
|
2908
2982
|
function updateKeyedMap() {
|
|
2909
2983
|
const e = this.Be() || [],
|
|
2910
2984
|
t = e.length;
|
|
@@ -3026,17 +3100,21 @@ function updateKeyedMap() {
|
|
|
3026
3100
|
}
|
|
3027
3101
|
function repeat(e, t, n) {
|
|
3028
3102
|
const i = t;
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3103
|
+
const r = computed(
|
|
3104
|
+
updateRepeat.bind({
|
|
3105
|
+
Ye: createOwner(),
|
|
3106
|
+
Ze: 0,
|
|
3107
|
+
rt: 0,
|
|
3108
|
+
st: e,
|
|
3109
|
+
Xe: i,
|
|
3110
|
+
Je: [],
|
|
3111
|
+
ze: [],
|
|
3112
|
+
ot: n?.from,
|
|
3113
|
+
it: n?.fallback
|
|
3114
|
+
})
|
|
3115
|
+
);
|
|
3116
|
+
r.Pe = true;
|
|
3117
|
+
return accessor(r);
|
|
3040
3118
|
}
|
|
3041
3119
|
function updateRepeat() {
|
|
3042
3120
|
const e = this.st();
|
|
@@ -3089,12 +3167,12 @@ function compare(e, t, n) {
|
|
|
3089
3167
|
return e ? e(t) === e(n) : true;
|
|
3090
3168
|
}
|
|
3091
3169
|
function boundaryComputed(e, t) {
|
|
3092
|
-
const n = computed(e,
|
|
3093
|
-
n.
|
|
3094
|
-
const i = e !== undefined ? e : n.
|
|
3095
|
-
const r = t !== undefined ? t : n.
|
|
3096
|
-
n.
|
|
3097
|
-
n
|
|
3170
|
+
const n = computed(e, { lazy: true });
|
|
3171
|
+
n.xe = (e, t) => {
|
|
3172
|
+
const i = e !== undefined ? e : n.Re;
|
|
3173
|
+
const r = t !== undefined ? t : n.Ee;
|
|
3174
|
+
n.Re &= ~n.ut;
|
|
3175
|
+
n.$.notify(n, n.ut, i, r);
|
|
3098
3176
|
};
|
|
3099
3177
|
n.ut = t;
|
|
3100
3178
|
n.Pe = true;
|
|
@@ -3102,9 +3180,9 @@ function boundaryComputed(e, t) {
|
|
|
3102
3180
|
return n;
|
|
3103
3181
|
}
|
|
3104
3182
|
function createBoundChildren(e, t, n, i) {
|
|
3105
|
-
const r = e
|
|
3106
|
-
r.addChild((e
|
|
3107
|
-
cleanup(() => r.removeChild(e
|
|
3183
|
+
const r = e.$;
|
|
3184
|
+
r.addChild((e.$ = n));
|
|
3185
|
+
cleanup(() => r.removeChild(e.$));
|
|
3108
3186
|
return runWithOwner(e, () => {
|
|
3109
3187
|
const e = computed(t);
|
|
3110
3188
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
@@ -3114,12 +3192,16 @@ const ON_INIT = Symbol();
|
|
|
3114
3192
|
const RevealControllerContext = createContext(null);
|
|
3115
3193
|
let _revealUsed = false;
|
|
3116
3194
|
const FALSE_ACCESSOR = () => false;
|
|
3195
|
+
const SEQUENTIAL_ACCESSOR = () => "sequential";
|
|
3117
3196
|
function isRevealController(e) {
|
|
3118
3197
|
return e instanceof RevealController;
|
|
3119
3198
|
}
|
|
3120
3199
|
function isSlotReady(e) {
|
|
3121
3200
|
return isRevealController(e) ? e.isReady() : e.ct.size === 0 && !e.lt;
|
|
3122
3201
|
}
|
|
3202
|
+
function isSlotMinimallyReady(e) {
|
|
3203
|
+
return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
|
|
3204
|
+
}
|
|
3123
3205
|
function setSlotState(e, t, n, i) {
|
|
3124
3206
|
setSignal(e.ft, n);
|
|
3125
3207
|
setSignal(e.Et, i);
|
|
@@ -3134,15 +3216,16 @@ class RevealController {
|
|
|
3134
3216
|
Ot;
|
|
3135
3217
|
_t = [];
|
|
3136
3218
|
dt;
|
|
3137
|
-
ft = signal(false, {
|
|
3138
|
-
Et = signal(false, {
|
|
3219
|
+
ft = signal(false, { ownedWrite: true, He: true });
|
|
3220
|
+
Et = signal(false, { ownedWrite: true, He: true });
|
|
3139
3221
|
It = true;
|
|
3140
|
-
ht =
|
|
3222
|
+
ht = true;
|
|
3223
|
+
At = false;
|
|
3141
3224
|
constructor(e, t) {
|
|
3142
3225
|
this.Rt = e;
|
|
3143
3226
|
this.Ot = t;
|
|
3144
3227
|
}
|
|
3145
|
-
|
|
3228
|
+
Nt(e) {
|
|
3146
3229
|
for (let t = 0; t < this._t.length; t++) {
|
|
3147
3230
|
const n = this._t[t];
|
|
3148
3231
|
if ((isRevealController(n) ? n.dt : n.Tt) !== this) continue;
|
|
@@ -3151,13 +3234,35 @@ class RevealController {
|
|
|
3151
3234
|
return true;
|
|
3152
3235
|
}
|
|
3153
3236
|
isReady() {
|
|
3154
|
-
return this.
|
|
3237
|
+
return this.Nt(isSlotReady);
|
|
3238
|
+
}
|
|
3239
|
+
isMinimallyReady() {
|
|
3240
|
+
const e = untrack(this.Rt);
|
|
3241
|
+
if (e === "together") return this.isReady();
|
|
3242
|
+
if (e === "natural") {
|
|
3243
|
+
let e = false;
|
|
3244
|
+
let t = false;
|
|
3245
|
+
this.Nt(n => {
|
|
3246
|
+
e = true;
|
|
3247
|
+
if (isSlotMinimallyReady(n)) {
|
|
3248
|
+
t = true;
|
|
3249
|
+
return false;
|
|
3250
|
+
}
|
|
3251
|
+
});
|
|
3252
|
+
return !e || t;
|
|
3253
|
+
}
|
|
3254
|
+
let t = true;
|
|
3255
|
+
this.Nt(e => {
|
|
3256
|
+
t = isSlotMinimallyReady(e);
|
|
3257
|
+
return false;
|
|
3258
|
+
});
|
|
3259
|
+
return t;
|
|
3155
3260
|
}
|
|
3156
3261
|
register(e) {
|
|
3157
3262
|
if (this._t.includes(e)) return;
|
|
3158
3263
|
this._t.push(e);
|
|
3159
|
-
const t =
|
|
3160
|
-
setSignal(e.ft, true), setSignal(e.Et, t
|
|
3264
|
+
const t = untrack(this.Rt);
|
|
3265
|
+
(setSignal(e.ft, true), setSignal(e.Et, t === "sequential" ? !!untrack(this.Ot) : false));
|
|
3161
3266
|
untrack(() => this.evaluate());
|
|
3162
3267
|
}
|
|
3163
3268
|
unregister(e) {
|
|
@@ -3166,103 +3271,123 @@ class RevealController {
|
|
|
3166
3271
|
untrack(() => this.evaluate());
|
|
3167
3272
|
}
|
|
3168
3273
|
evaluate(e, t) {
|
|
3169
|
-
if (this.
|
|
3170
|
-
this.
|
|
3274
|
+
if (this.At) return;
|
|
3275
|
+
this.At = true;
|
|
3171
3276
|
const n = this.It;
|
|
3277
|
+
const i = this.ht;
|
|
3172
3278
|
try {
|
|
3173
3279
|
const n = e ?? read(this.ft),
|
|
3174
|
-
i =
|
|
3175
|
-
r =
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3280
|
+
i = untrack(this.Rt),
|
|
3281
|
+
r = i === "sequential" && !!untrack(this.Ot),
|
|
3282
|
+
s = t ?? r;
|
|
3283
|
+
if (n) {
|
|
3284
|
+
this.Nt(e => setSlotState(e, this, true, s));
|
|
3285
|
+
} else if (i === "natural") {
|
|
3286
|
+
this.Nt(e => {
|
|
3287
|
+
if (isRevealController(e)) {
|
|
3288
|
+
setSignal(e.Et, false);
|
|
3289
|
+
setSignal(e.ft, false);
|
|
3290
|
+
e.evaluate(false, false);
|
|
3291
|
+
} else {
|
|
3292
|
+
setSlotState(e, this, !isSlotReady(e), false);
|
|
3293
|
+
}
|
|
3294
|
+
});
|
|
3295
|
+
} else if (i === "together") {
|
|
3296
|
+
const e = this.Nt(isSlotMinimallyReady);
|
|
3297
|
+
this.Nt(t => setSlotState(t, this, !e, false));
|
|
3180
3298
|
} else {
|
|
3181
3299
|
let e = false;
|
|
3182
|
-
this.
|
|
3183
|
-
if (e) return setSlotState(t, this, true,
|
|
3300
|
+
this.Nt(t => {
|
|
3301
|
+
if (e) return setSlotState(t, this, true, r);
|
|
3184
3302
|
if (isSlotReady(t)) return setSlotState(t, this, false, false);
|
|
3185
3303
|
e = true;
|
|
3186
|
-
|
|
3304
|
+
if (isRevealController(t)) {
|
|
3305
|
+
setSignal(t.Et, false);
|
|
3306
|
+
setSignal(t.ft, false);
|
|
3307
|
+
t.evaluate(false, false);
|
|
3308
|
+
} else {
|
|
3309
|
+
setSlotState(t, this, true, false);
|
|
3310
|
+
}
|
|
3187
3311
|
});
|
|
3188
3312
|
}
|
|
3189
3313
|
} finally {
|
|
3190
3314
|
this.It = this.isReady();
|
|
3191
|
-
this.ht =
|
|
3315
|
+
this.ht = this.isMinimallyReady();
|
|
3316
|
+
this.At = false;
|
|
3192
3317
|
}
|
|
3193
|
-
if (this.dt && n !== this.It) this.dt.evaluate();
|
|
3318
|
+
if (this.dt && (n !== this.It || i !== this.ht)) this.dt.evaluate();
|
|
3194
3319
|
}
|
|
3195
3320
|
}
|
|
3196
3321
|
class CollectionQueue extends Queue {
|
|
3197
|
-
Nt;
|
|
3198
|
-
ct = new Set();
|
|
3199
3322
|
Pt;
|
|
3323
|
+
ct = new Set();
|
|
3324
|
+
gt;
|
|
3200
3325
|
lt = true;
|
|
3201
|
-
ft = signal(false, {
|
|
3202
|
-
Et = signal(false, {
|
|
3326
|
+
ft = signal(false, { ownedWrite: true, He: true });
|
|
3327
|
+
Et = signal(false, { ownedWrite: true, He: true });
|
|
3203
3328
|
Tt;
|
|
3204
3329
|
St = false;
|
|
3205
|
-
|
|
3206
|
-
|
|
3330
|
+
Ct;
|
|
3331
|
+
Dt = ON_INIT;
|
|
3207
3332
|
constructor(e) {
|
|
3208
3333
|
super();
|
|
3209
|
-
this.
|
|
3334
|
+
this.Pt = e;
|
|
3210
3335
|
}
|
|
3211
3336
|
run(e) {
|
|
3212
3337
|
if (!e || (read(this.ft) && (!_revealUsed || read(this.Et)))) return;
|
|
3213
3338
|
return super.run(e);
|
|
3214
3339
|
}
|
|
3215
3340
|
notify(e, t, n, i) {
|
|
3216
|
-
if (!(t & this.
|
|
3217
|
-
if (this.St && this.
|
|
3341
|
+
if (!(t & this.Pt)) return super.notify(e, t, n, i);
|
|
3342
|
+
if (this.St && this.Ct) {
|
|
3218
3343
|
const e = untrack(() => {
|
|
3219
3344
|
try {
|
|
3220
|
-
return this.
|
|
3345
|
+
return this.Ct();
|
|
3221
3346
|
} catch {
|
|
3222
3347
|
return ON_INIT;
|
|
3223
3348
|
}
|
|
3224
3349
|
});
|
|
3225
|
-
if (e !== this.
|
|
3226
|
-
this.
|
|
3350
|
+
if (e !== this.Dt) {
|
|
3351
|
+
this.Dt = e;
|
|
3227
3352
|
this.St = false;
|
|
3228
3353
|
this.ct.clear();
|
|
3229
3354
|
}
|
|
3230
3355
|
}
|
|
3231
|
-
if (this.
|
|
3232
|
-
if (this.
|
|
3356
|
+
if (this.Pt & STATUS_PENDING && this.St) return super.notify(e, t, n, i);
|
|
3357
|
+
if (this.Pt & STATUS_PENDING && n & STATUS_ERROR) {
|
|
3233
3358
|
return super.notify(e, STATUS_ERROR, n, i);
|
|
3234
3359
|
}
|
|
3235
|
-
if (n & this.
|
|
3360
|
+
if (n & this.Pt) {
|
|
3236
3361
|
this.lt = true;
|
|
3237
|
-
const t = i?.source || e.
|
|
3362
|
+
const t = i?.source || e.Ee?.source;
|
|
3238
3363
|
if (t) {
|
|
3239
3364
|
const e = this.ct.size === 0;
|
|
3240
3365
|
this.ct.add(t);
|
|
3241
3366
|
if (e) setSignal(this.ft, true);
|
|
3242
3367
|
}
|
|
3243
3368
|
}
|
|
3244
|
-
t &= ~this.
|
|
3369
|
+
t &= ~this.Pt;
|
|
3245
3370
|
return t ? super.notify(e, t, n, i) : true;
|
|
3246
3371
|
}
|
|
3247
3372
|
checkSources() {
|
|
3248
3373
|
for (const e of this.ct) {
|
|
3249
3374
|
if (
|
|
3250
3375
|
e.O & REACTIVE_DISPOSED ||
|
|
3251
|
-
(!(e.
|
|
3376
|
+
(!(e.Re & this.Pt) && !(this.Pt & STATUS_ERROR && e.Re & STATUS_PENDING))
|
|
3252
3377
|
)
|
|
3253
3378
|
this.ct.delete(e);
|
|
3254
3379
|
}
|
|
3255
3380
|
if (!this.ct.size) {
|
|
3256
|
-
if (this.
|
|
3257
|
-
this.lt = !!(this.
|
|
3381
|
+
if (this.Pt & STATUS_PENDING && this.lt && !this.St && this.gt) {
|
|
3382
|
+
this.lt = !!(this.gt.Re & this.Pt);
|
|
3258
3383
|
} else {
|
|
3259
3384
|
this.lt = false;
|
|
3260
3385
|
}
|
|
3261
3386
|
if (!this.lt) {
|
|
3262
3387
|
setSignal(this.ft, false);
|
|
3263
|
-
if (this.
|
|
3388
|
+
if (this.Ct) {
|
|
3264
3389
|
try {
|
|
3265
|
-
this.
|
|
3390
|
+
this.Dt = untrack(() => this.Ct());
|
|
3266
3391
|
} catch {}
|
|
3267
3392
|
}
|
|
3268
3393
|
}
|
|
@@ -3274,8 +3399,8 @@ function createCollectionBoundary(e, t, n, i) {
|
|
|
3274
3399
|
const r = createOwner();
|
|
3275
3400
|
if (_revealUsed) setContext(RevealControllerContext, null, r);
|
|
3276
3401
|
const s = new CollectionQueue(e);
|
|
3277
|
-
if (i) s.
|
|
3278
|
-
const o = (s.
|
|
3402
|
+
if (i) s.Ct = i;
|
|
3403
|
+
const o = (s.gt = createBoundChildren(r, t, s, e));
|
|
3279
3404
|
untrack(() => {
|
|
3280
3405
|
let t = false;
|
|
3281
3406
|
try {
|
|
@@ -3284,7 +3409,7 @@ function createCollectionBoundary(e, t, n, i) {
|
|
|
3284
3409
|
if (e instanceof NotReadyError) t = true;
|
|
3285
3410
|
else throw e;
|
|
3286
3411
|
}
|
|
3287
|
-
s.lt = t || !!(o.
|
|
3412
|
+
s.lt = t || !!(o.Re & e) || o.Ee instanceof NotReadyError;
|
|
3288
3413
|
});
|
|
3289
3414
|
const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
|
|
3290
3415
|
if (u) {
|
|
@@ -3295,7 +3420,7 @@ function createCollectionBoundary(e, t, n, i) {
|
|
|
3295
3420
|
const c = computed(() => {
|
|
3296
3421
|
if (!read(s.ft)) {
|
|
3297
3422
|
const e = read(o);
|
|
3298
|
-
if (!untrack(() => read(s.ft))) return (s.St = true), e;
|
|
3423
|
+
if (!untrack(() => read(s.ft))) return ((s.St = true), e);
|
|
3299
3424
|
}
|
|
3300
3425
|
if (_revealUsed && read(s.Et)) return undefined;
|
|
3301
3426
|
return n(s);
|
|
@@ -3308,7 +3433,7 @@ function createLoadingBoundary(e, t, n) {
|
|
|
3308
3433
|
function createErrorBoundary(e, t) {
|
|
3309
3434
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
3310
3435
|
let n = e.ct.values().next().value;
|
|
3311
|
-
const i = n.
|
|
3436
|
+
const i = n.Ee?.cause ?? n.Ee;
|
|
3312
3437
|
return t(i, () => {
|
|
3313
3438
|
for (const t of e.ct) recompute(t);
|
|
3314
3439
|
schedule();
|
|
@@ -3319,7 +3444,7 @@ function createRevealOrder(e, t) {
|
|
|
3319
3444
|
_revealUsed = true;
|
|
3320
3445
|
const n = createOwner();
|
|
3321
3446
|
const i = getContext(RevealControllerContext);
|
|
3322
|
-
const r = t?.
|
|
3447
|
+
const r = t?.order || SEQUENTIAL_ACCESSOR,
|
|
3323
3448
|
s = t?.collapsed || FALSE_ACCESSOR;
|
|
3324
3449
|
const o = new RevealController(r, s);
|
|
3325
3450
|
setContext(RevealControllerContext, o, n);
|