@solidjs/signals 0.10.4 → 0.10.6
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 +131 -18
- package/dist/node.cjs +903 -790
- package/dist/prod.js +604 -490
- package/dist/types/core/constants.d.ts +3 -0
- package/dist/types/core/core.d.ts +6 -0
- package/dist/types/core/index.d.ts +2 -2
- package/dist/types/core/owner.d.ts +1 -0
- package/dist/types/core/types.d.ts +3 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/store/store.d.ts +6 -5
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -31,6 +31,7 @@ const REACTIVE_IN_HEAP_HEIGHT = 1 << 4;
|
|
|
31
31
|
const REACTIVE_ZOMBIE = 1 << 5;
|
|
32
32
|
const REACTIVE_DISPOSED = 1 << 6;
|
|
33
33
|
const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
|
|
34
|
+
const REACTIVE_SNAPSHOT_STALE = 1 << 8;
|
|
34
35
|
const STATUS_PENDING = 1 << 0;
|
|
35
36
|
const STATUS_ERROR = 1 << 1;
|
|
36
37
|
const STATUS_UNINITIALIZED = 1 << 2;
|
|
@@ -38,6 +39,8 @@ const EFFECT_RENDER = 1;
|
|
|
38
39
|
const EFFECT_USER = 2;
|
|
39
40
|
const EFFECT_TRACKED = 3;
|
|
40
41
|
const NOT_PENDING = {};
|
|
42
|
+
const NO_SNAPSHOT = {};
|
|
43
|
+
const STORE_SNAPSHOT_PROPS = "sp";
|
|
41
44
|
const SUPPORTS_PROXY = typeof Proxy === "function";
|
|
42
45
|
const defaultContext = {};
|
|
43
46
|
const $REFRESH = Symbol("refresh");
|
|
@@ -49,61 +52,61 @@ function actualInsertIntoHeap(e, t) {
|
|
|
49
52
|
if (r === undefined) t.l[i] = e;
|
|
50
53
|
else {
|
|
51
54
|
const t = r.T;
|
|
52
|
-
t.
|
|
55
|
+
t.S = e;
|
|
53
56
|
e.T = t;
|
|
54
57
|
r.T = e;
|
|
55
58
|
}
|
|
56
|
-
if (i > t.
|
|
59
|
+
if (i > t.R) t.R = i;
|
|
57
60
|
}
|
|
58
61
|
function insertIntoHeap(e, t) {
|
|
59
|
-
let n = e.
|
|
62
|
+
let n = e.O;
|
|
60
63
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
|
|
61
64
|
if (n & REACTIVE_CHECK) {
|
|
62
|
-
e.
|
|
63
|
-
} else e.
|
|
65
|
+
e.O = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
66
|
+
} else e.O = n | REACTIVE_IN_HEAP;
|
|
64
67
|
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
65
68
|
}
|
|
66
69
|
function insertIntoHeapHeight(e, t) {
|
|
67
|
-
let n = e.
|
|
70
|
+
let n = e.O;
|
|
68
71
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
|
|
69
|
-
e.
|
|
72
|
+
e.O = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
70
73
|
actualInsertIntoHeap(e, t);
|
|
71
74
|
}
|
|
72
75
|
function deleteFromHeap(e, t) {
|
|
73
|
-
const n = e.
|
|
76
|
+
const n = e.O;
|
|
74
77
|
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
75
|
-
e.
|
|
78
|
+
e.O = n & -25;
|
|
76
79
|
const i = e.o;
|
|
77
80
|
if (e.T === e) t.l[i] = undefined;
|
|
78
81
|
else {
|
|
79
|
-
const n = e.
|
|
82
|
+
const n = e.S;
|
|
80
83
|
const r = t.l[i];
|
|
81
84
|
const o = n ?? r;
|
|
82
85
|
if (e === r) t.l[i] = n;
|
|
83
|
-
else e.T.
|
|
86
|
+
else e.T.S = n;
|
|
84
87
|
o.T = e.T;
|
|
85
88
|
}
|
|
86
89
|
e.T = e;
|
|
87
|
-
e.
|
|
90
|
+
e.S = undefined;
|
|
88
91
|
}
|
|
89
92
|
function markHeap(e) {
|
|
90
93
|
if (e._) return;
|
|
91
94
|
e._ = true;
|
|
92
|
-
for (let t = 0; t <= e.
|
|
93
|
-
for (let n = e.l[t]; n !== undefined; n = n.
|
|
94
|
-
if (n.
|
|
95
|
+
for (let t = 0; t <= e.R; t++) {
|
|
96
|
+
for (let n = e.l[t]; n !== undefined; n = n.S) {
|
|
97
|
+
if (n.O & REACTIVE_IN_HEAP) markNode(n);
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
function markNode(e, t = REACTIVE_DIRTY) {
|
|
99
|
-
const n = e.
|
|
102
|
+
const n = e.O;
|
|
100
103
|
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
101
|
-
e.
|
|
104
|
+
e.O = (n & -4) | t;
|
|
102
105
|
for (let t = e.I; t !== null; t = t.p) {
|
|
103
106
|
markNode(t.h, REACTIVE_CHECK);
|
|
104
107
|
}
|
|
105
108
|
if (e.A !== null) {
|
|
106
|
-
for (let t = e.A; t !== null; t = t.
|
|
109
|
+
for (let t = e.A; t !== null; t = t.P) {
|
|
107
110
|
for (let e = t.I; e !== null; e = e.p) {
|
|
108
111
|
markNode(e.h, REACTIVE_CHECK);
|
|
109
112
|
}
|
|
@@ -112,20 +115,20 @@ function markNode(e, t = REACTIVE_DIRTY) {
|
|
|
112
115
|
}
|
|
113
116
|
function runHeap(e, t) {
|
|
114
117
|
e._ = false;
|
|
115
|
-
for (e.
|
|
116
|
-
let n = e.l[e.
|
|
118
|
+
for (e.N = 0; e.N <= e.R; e.N++) {
|
|
119
|
+
let n = e.l[e.N];
|
|
117
120
|
while (n !== undefined) {
|
|
118
|
-
if (n.
|
|
121
|
+
if (n.O & REACTIVE_IN_HEAP) t(n);
|
|
119
122
|
else adjustHeight(n, e);
|
|
120
|
-
n = e.l[e.
|
|
123
|
+
n = e.l[e.N];
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
|
-
e.
|
|
126
|
+
e.R = 0;
|
|
124
127
|
}
|
|
125
128
|
function adjustHeight(e, t) {
|
|
126
129
|
deleteFromHeap(e, t);
|
|
127
130
|
let n = e.o;
|
|
128
|
-
for (let t = e.
|
|
131
|
+
for (let t = e.C; t; t = t.D) {
|
|
129
132
|
const e = t.V;
|
|
130
133
|
const i = e.m || e;
|
|
131
134
|
if (i.L && i.o >= n) n = i.o + 1;
|
|
@@ -138,8 +141,8 @@ function adjustHeight(e, t) {
|
|
|
138
141
|
}
|
|
139
142
|
}
|
|
140
143
|
const transitions = new Set();
|
|
141
|
-
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false,
|
|
142
|
-
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false,
|
|
144
|
+
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, N: 0, R: 0 };
|
|
145
|
+
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, N: 0, R: 0 };
|
|
143
146
|
let clock = 0;
|
|
144
147
|
let activeTransition = null;
|
|
145
148
|
let scheduled = false;
|
|
@@ -160,11 +163,11 @@ function setProjectionWriteActive(e) {
|
|
|
160
163
|
function schedule() {
|
|
161
164
|
if (scheduled) return;
|
|
162
165
|
scheduled = true;
|
|
163
|
-
if (!globalQueue.
|
|
166
|
+
if (!globalQueue.H) queueMicrotask(flush);
|
|
164
167
|
}
|
|
165
168
|
class Queue {
|
|
166
169
|
i = null;
|
|
167
|
-
|
|
170
|
+
M = [[], []];
|
|
168
171
|
G = [];
|
|
169
172
|
created = clock;
|
|
170
173
|
addChild(e) {
|
|
@@ -183,9 +186,9 @@ class Queue {
|
|
|
183
186
|
return false;
|
|
184
187
|
}
|
|
185
188
|
run(e) {
|
|
186
|
-
if (this.
|
|
187
|
-
const t = this.
|
|
188
|
-
this.
|
|
189
|
+
if (this.M[e - 1].length) {
|
|
190
|
+
const t = this.M[e - 1];
|
|
191
|
+
this.M[e - 1] = [];
|
|
189
192
|
runQueue(t, e);
|
|
190
193
|
}
|
|
191
194
|
for (let t = 0; t < this.G.length; t++) this.G[t].run?.(e);
|
|
@@ -196,28 +199,28 @@ class Queue {
|
|
|
196
199
|
const n = findLane(currentOptimisticLane);
|
|
197
200
|
n.W[e - 1].push(t);
|
|
198
201
|
} else {
|
|
199
|
-
this.
|
|
202
|
+
this.M[e - 1].push(t);
|
|
200
203
|
}
|
|
201
204
|
}
|
|
202
205
|
schedule();
|
|
203
206
|
}
|
|
204
207
|
stashQueues(e) {
|
|
205
|
-
e.
|
|
206
|
-
e.
|
|
207
|
-
this.
|
|
208
|
+
e.M[0].push(...this.M[0]);
|
|
209
|
+
e.M[1].push(...this.M[1]);
|
|
210
|
+
this.M = [[], []];
|
|
208
211
|
for (let t = 0; t < this.G.length; t++) {
|
|
209
212
|
let n = this.G[t];
|
|
210
213
|
let i = e.G[t];
|
|
211
214
|
if (!i) {
|
|
212
|
-
i = {
|
|
215
|
+
i = { M: [[], []], G: [] };
|
|
213
216
|
e.G[t] = i;
|
|
214
217
|
}
|
|
215
218
|
n.stashQueues(i);
|
|
216
219
|
}
|
|
217
220
|
}
|
|
218
221
|
restoreQueues(e) {
|
|
219
|
-
this.
|
|
220
|
-
this.
|
|
222
|
+
this.M[0].push(...e.M[0]);
|
|
223
|
+
this.M[1].push(...e.M[1]);
|
|
221
224
|
for (let t = 0; t < e.G.length; t++) {
|
|
222
225
|
const n = e.G[t];
|
|
223
226
|
let i = this.G[t];
|
|
@@ -226,16 +229,16 @@ class Queue {
|
|
|
226
229
|
}
|
|
227
230
|
}
|
|
228
231
|
class GlobalQueue extends Queue {
|
|
229
|
-
|
|
232
|
+
H = false;
|
|
233
|
+
F = [];
|
|
230
234
|
$ = [];
|
|
231
|
-
H = [];
|
|
232
235
|
j = new Set();
|
|
233
236
|
static K;
|
|
234
237
|
static Y;
|
|
235
238
|
static B = null;
|
|
236
239
|
flush() {
|
|
237
|
-
if (this.
|
|
238
|
-
this.
|
|
240
|
+
if (this.H) return;
|
|
241
|
+
this.H = true;
|
|
239
242
|
try {
|
|
240
243
|
runHeap(dirtyQueue, GlobalQueue.K);
|
|
241
244
|
if (activeTransition) {
|
|
@@ -243,38 +246,38 @@ class GlobalQueue extends Queue {
|
|
|
243
246
|
if (!e) {
|
|
244
247
|
let e = activeTransition;
|
|
245
248
|
runHeap(zombieQueue, GlobalQueue.K);
|
|
249
|
+
this.F = [];
|
|
246
250
|
this.$ = [];
|
|
247
|
-
this.H = [];
|
|
248
251
|
this.j = new Set();
|
|
249
252
|
runLaneEffects(EFFECT_RENDER);
|
|
250
253
|
runLaneEffects(EFFECT_USER);
|
|
251
254
|
this.stashQueues(activeTransition.X);
|
|
252
255
|
clock++;
|
|
253
|
-
scheduled = dirtyQueue.
|
|
254
|
-
reassignPendingTransition(activeTransition
|
|
256
|
+
scheduled = dirtyQueue.R >= dirtyQueue.N;
|
|
257
|
+
reassignPendingTransition(activeTransition.F);
|
|
255
258
|
activeTransition = null;
|
|
256
259
|
finalizePureQueue(null, true);
|
|
257
260
|
return;
|
|
258
261
|
}
|
|
259
|
-
this
|
|
262
|
+
this.F !== activeTransition.F && this.F.push(...activeTransition.F);
|
|
260
263
|
this.restoreQueues(activeTransition.X);
|
|
261
264
|
transitions.delete(activeTransition);
|
|
262
265
|
const t = activeTransition;
|
|
263
266
|
activeTransition = null;
|
|
264
|
-
reassignPendingTransition(this
|
|
267
|
+
reassignPendingTransition(this.F);
|
|
265
268
|
finalizePureQueue(t);
|
|
266
269
|
} else {
|
|
267
270
|
if (transitions.size) runHeap(zombieQueue, GlobalQueue.K);
|
|
268
271
|
finalizePureQueue();
|
|
269
272
|
}
|
|
270
273
|
clock++;
|
|
271
|
-
scheduled = dirtyQueue.
|
|
274
|
+
scheduled = dirtyQueue.R >= dirtyQueue.N;
|
|
272
275
|
runLaneEffects(EFFECT_RENDER);
|
|
273
276
|
this.run(EFFECT_RENDER);
|
|
274
277
|
runLaneEffects(EFFECT_USER);
|
|
275
278
|
this.run(EFFECT_USER);
|
|
276
279
|
} finally {
|
|
277
|
-
this.
|
|
280
|
+
this.H = false;
|
|
278
281
|
}
|
|
279
282
|
}
|
|
280
283
|
notify(e, t, n, i) {
|
|
@@ -297,12 +300,12 @@ class GlobalQueue extends Queue {
|
|
|
297
300
|
if (!activeTransition) {
|
|
298
301
|
activeTransition = e ?? {
|
|
299
302
|
J: clock,
|
|
300
|
-
|
|
303
|
+
F: [],
|
|
301
304
|
Z: [],
|
|
302
|
-
|
|
305
|
+
$: [],
|
|
303
306
|
j: new Set(),
|
|
304
307
|
ee: [],
|
|
305
|
-
X: {
|
|
308
|
+
X: { M: [[], []], G: [] },
|
|
306
309
|
te: false
|
|
307
310
|
};
|
|
308
311
|
} else if (e) {
|
|
@@ -312,7 +315,7 @@ class GlobalQueue extends Queue {
|
|
|
312
315
|
for (const n of activeLanes) {
|
|
313
316
|
if (n.ne === t) n.ne = e;
|
|
314
317
|
}
|
|
315
|
-
e
|
|
318
|
+
e.$.push(...t.$);
|
|
316
319
|
for (const n of t.j) {
|
|
317
320
|
e.j.add(n);
|
|
318
321
|
}
|
|
@@ -321,18 +324,18 @@ class GlobalQueue extends Queue {
|
|
|
321
324
|
}
|
|
322
325
|
transitions.add(activeTransition);
|
|
323
326
|
activeTransition.J = clock;
|
|
327
|
+
for (let e = 0; e < this.F.length; e++) {
|
|
328
|
+
const t = this.F[e];
|
|
329
|
+
t.ne = activeTransition;
|
|
330
|
+
activeTransition.F.push(t);
|
|
331
|
+
}
|
|
332
|
+
this.F = activeTransition.F;
|
|
324
333
|
for (let e = 0; e < this.$.length; e++) {
|
|
325
334
|
const t = this.$[e];
|
|
326
335
|
t.ne = activeTransition;
|
|
327
336
|
activeTransition.$.push(t);
|
|
328
337
|
}
|
|
329
338
|
this.$ = activeTransition.$;
|
|
330
|
-
for (let e = 0; e < this.H.length; e++) {
|
|
331
|
-
const t = this.H[e];
|
|
332
|
-
t.ne = activeTransition;
|
|
333
|
-
activeTransition.H.push(t);
|
|
334
|
-
}
|
|
335
|
-
this.H = activeTransition.H;
|
|
336
339
|
for (const e of activeLanes) {
|
|
337
340
|
if (!e.ne) e.ne = activeTransition;
|
|
338
341
|
}
|
|
@@ -342,54 +345,59 @@ class GlobalQueue extends Queue {
|
|
|
342
345
|
}
|
|
343
346
|
function insertSubs(e, t = false) {
|
|
344
347
|
const n = e.ie || currentOptimisticLane;
|
|
345
|
-
|
|
348
|
+
const i = e.re !== undefined;
|
|
349
|
+
for (let r = e.I; r !== null; r = r.p) {
|
|
350
|
+
if (i && r.h.oe) {
|
|
351
|
+
r.h.O |= REACTIVE_SNAPSHOT_STALE;
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
346
354
|
if (t && n) {
|
|
347
|
-
|
|
348
|
-
assignOrMergeLane(
|
|
355
|
+
r.h.O |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
356
|
+
assignOrMergeLane(r.h, n);
|
|
349
357
|
} else if (t) {
|
|
350
|
-
|
|
351
|
-
|
|
358
|
+
r.h.O |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
359
|
+
r.h.ie = undefined;
|
|
352
360
|
}
|
|
353
|
-
const e =
|
|
354
|
-
if (e.
|
|
355
|
-
if (!e.
|
|
356
|
-
e.
|
|
357
|
-
e.
|
|
361
|
+
const e = r.h;
|
|
362
|
+
if (e.se === EFFECT_TRACKED) {
|
|
363
|
+
if (!e.ue) {
|
|
364
|
+
e.ue = true;
|
|
365
|
+
e.ce.enqueue(EFFECT_USER, e.le);
|
|
358
366
|
}
|
|
359
367
|
continue;
|
|
360
368
|
}
|
|
361
|
-
const
|
|
362
|
-
if (
|
|
363
|
-
insertIntoHeap(
|
|
369
|
+
const o = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
370
|
+
if (o.N > r.h.o) o.N = r.h.o;
|
|
371
|
+
insertIntoHeap(r.h, o);
|
|
364
372
|
}
|
|
365
373
|
}
|
|
366
374
|
function finalizePureQueue(e = null, t = false) {
|
|
367
375
|
let n = !t;
|
|
368
376
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
369
|
-
if (dirtyQueue.
|
|
377
|
+
if (dirtyQueue.R >= dirtyQueue.N) runHeap(dirtyQueue, GlobalQueue.K);
|
|
370
378
|
if (n) {
|
|
371
|
-
const t = globalQueue
|
|
379
|
+
const t = globalQueue.F;
|
|
372
380
|
for (let e = 0; e < t.length; e++) {
|
|
373
381
|
const n = t[e];
|
|
374
|
-
if (n.
|
|
375
|
-
n.
|
|
376
|
-
n.
|
|
377
|
-
if (n.
|
|
382
|
+
if (n.ae !== NOT_PENDING) {
|
|
383
|
+
n.fe = n.ae;
|
|
384
|
+
n.ae = NOT_PENDING;
|
|
385
|
+
if (n.se && n.se !== EFFECT_TRACKED) n.ue = true;
|
|
378
386
|
}
|
|
379
|
-
n.
|
|
387
|
+
n.Ee &= ~STATUS_UNINITIALIZED;
|
|
380
388
|
if (n.L) GlobalQueue.Y(n, false, true);
|
|
381
389
|
}
|
|
382
390
|
t.length = 0;
|
|
383
|
-
const n = e ? e
|
|
391
|
+
const n = e ? e.$ : globalQueue.$;
|
|
384
392
|
for (let e = 0; e < n.length; e++) {
|
|
385
393
|
const t = n[e];
|
|
386
|
-
const i = t.
|
|
394
|
+
const i = t.ae;
|
|
387
395
|
t.ie = undefined;
|
|
388
|
-
if (i !== NOT_PENDING && t.
|
|
389
|
-
t.
|
|
396
|
+
if (i !== NOT_PENDING && t.fe !== i) {
|
|
397
|
+
t.fe = i;
|
|
390
398
|
insertSubs(t, true);
|
|
391
399
|
}
|
|
392
|
-
t.
|
|
400
|
+
t.ae = NOT_PENDING;
|
|
393
401
|
t.ne = null;
|
|
394
402
|
}
|
|
395
403
|
n.length = 0;
|
|
@@ -408,12 +416,12 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
408
416
|
if (t.W[0].length) runQueue(t.W[0], EFFECT_RENDER);
|
|
409
417
|
if (t.W[1].length) runQueue(t.W[1], EFFECT_USER);
|
|
410
418
|
}
|
|
411
|
-
if (t.
|
|
419
|
+
if (t.Te.ie === t) t.Te.ie = undefined;
|
|
412
420
|
t.U.clear();
|
|
413
421
|
t.W[0].length = 0;
|
|
414
422
|
t.W[1].length = 0;
|
|
415
423
|
activeLanes.delete(t);
|
|
416
|
-
signalLanes.delete(t.
|
|
424
|
+
signalLanes.delete(t.Te);
|
|
417
425
|
}
|
|
418
426
|
}
|
|
419
427
|
}
|
|
@@ -447,7 +455,7 @@ function transitionComplete(e) {
|
|
|
447
455
|
let t = true;
|
|
448
456
|
for (let n = 0; n < e.Z.length; n++) {
|
|
449
457
|
const i = e.Z[n];
|
|
450
|
-
if (i.
|
|
458
|
+
if (i.Ee & STATUS_PENDING && i.q?.source === i) {
|
|
451
459
|
t = false;
|
|
452
460
|
break;
|
|
453
461
|
}
|
|
@@ -478,12 +486,12 @@ function getOrCreateLane(e) {
|
|
|
478
486
|
if (t) {
|
|
479
487
|
return findLane(t);
|
|
480
488
|
}
|
|
481
|
-
const n = e.
|
|
489
|
+
const n = e.de;
|
|
482
490
|
const i = n?.ie ? findLane(n.ie) : null;
|
|
483
|
-
t = {
|
|
491
|
+
t = { Te: e, U: new Set(), W: [[], []], k: null, ne: activeTransition, Se: i };
|
|
484
492
|
signalLanes.set(e, t);
|
|
485
493
|
activeLanes.add(t);
|
|
486
|
-
e.
|
|
494
|
+
e.Re = e.Oe || 0;
|
|
487
495
|
return t;
|
|
488
496
|
}
|
|
489
497
|
function findLane(e) {
|
|
@@ -509,7 +517,7 @@ function resolveLane(e) {
|
|
|
509
517
|
return undefined;
|
|
510
518
|
}
|
|
511
519
|
function hasActiveOverride(e) {
|
|
512
|
-
return !!(e.
|
|
520
|
+
return !!(e._e && e.ae !== NOT_PENDING);
|
|
513
521
|
}
|
|
514
522
|
function assignOrMergeLane(e, t) {
|
|
515
523
|
const n = findLane(t);
|
|
@@ -522,9 +530,9 @@ function assignOrMergeLane(e, t) {
|
|
|
522
530
|
const r = findLane(i);
|
|
523
531
|
if (activeLanes.has(r)) {
|
|
524
532
|
if (r !== n && !hasActiveOverride(e)) {
|
|
525
|
-
if (n.
|
|
533
|
+
if (n.Se && findLane(n.Se) === r) {
|
|
526
534
|
e.ie = t;
|
|
527
|
-
} else if (r.
|
|
535
|
+
} else if (r.Se && findLane(r.Se) === n);
|
|
528
536
|
else mergeLanes(n, r);
|
|
529
537
|
}
|
|
530
538
|
return;
|
|
@@ -537,41 +545,41 @@ function handleAsync(e, t, n) {
|
|
|
537
545
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
538
546
|
const o = !r && i && untrack(() => typeof t.then === "function");
|
|
539
547
|
if (!o && !r) {
|
|
540
|
-
e.
|
|
548
|
+
e.Ie = null;
|
|
541
549
|
return t;
|
|
542
550
|
}
|
|
543
|
-
e.
|
|
551
|
+
e.Ie = t;
|
|
544
552
|
let s;
|
|
545
553
|
const handleError = n => {
|
|
546
|
-
if (e.
|
|
554
|
+
if (e.Ie !== t) return;
|
|
547
555
|
globalQueue.initTransition(e.ne);
|
|
548
556
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
549
557
|
e.J = clock;
|
|
550
558
|
};
|
|
551
559
|
const asyncWrite = (i, r) => {
|
|
552
|
-
if (e.
|
|
553
|
-
if (e.
|
|
560
|
+
if (e.Ie !== t) return;
|
|
561
|
+
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
554
562
|
globalQueue.initTransition(e.ne);
|
|
555
563
|
clearStatus(e);
|
|
556
564
|
const o = resolveLane(e);
|
|
557
565
|
if (o) o.U.delete(e);
|
|
558
566
|
if (n) n(i);
|
|
559
|
-
else if (e.
|
|
560
|
-
const t = e.
|
|
561
|
-
if (e.L) e.
|
|
567
|
+
else if (e._e) {
|
|
568
|
+
const t = e.ae !== NOT_PENDING;
|
|
569
|
+
if (e.L) e.ae = i;
|
|
562
570
|
if (!t) {
|
|
563
|
-
e.
|
|
571
|
+
e.fe = i;
|
|
564
572
|
insertSubs(e);
|
|
565
573
|
}
|
|
566
574
|
e.J = clock;
|
|
567
575
|
} else if (o) {
|
|
568
|
-
const t = e.
|
|
569
|
-
const n = e.
|
|
576
|
+
const t = e.fe;
|
|
577
|
+
const n = e.pe;
|
|
570
578
|
if (!n || !n(i, t)) {
|
|
571
|
-
e.
|
|
579
|
+
e.fe = i;
|
|
572
580
|
e.J = clock;
|
|
573
|
-
if (e.
|
|
574
|
-
setSignal(e.
|
|
581
|
+
if (e.he) {
|
|
582
|
+
setSignal(e.he, i);
|
|
575
583
|
}
|
|
576
584
|
insertSubs(e, true);
|
|
577
585
|
}
|
|
@@ -637,19 +645,19 @@ function handleAsync(e, t, n) {
|
|
|
637
645
|
return s;
|
|
638
646
|
}
|
|
639
647
|
function clearStatus(e) {
|
|
640
|
-
e.
|
|
648
|
+
e.Ee = e.Ee & STATUS_UNINITIALIZED;
|
|
641
649
|
e.q = null;
|
|
642
650
|
updatePendingSignal(e);
|
|
643
|
-
e.
|
|
651
|
+
e.Ae?.();
|
|
644
652
|
}
|
|
645
653
|
function notifyStatus(e, t, n, i, r) {
|
|
646
654
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
647
655
|
n = new StatusError(e, n);
|
|
648
656
|
const o = n instanceof NotReadyError && n.source === e;
|
|
649
|
-
const s = t === STATUS_PENDING && e.
|
|
657
|
+
const s = t === STATUS_PENDING && e._e && !o;
|
|
650
658
|
const u = s && hasActiveOverride(e);
|
|
651
659
|
if (!i) {
|
|
652
|
-
e.
|
|
660
|
+
e.Ee = t | (t !== STATUS_ERROR ? e.Ee & STATUS_UNINITIALIZED : 0);
|
|
653
661
|
e.q = n;
|
|
654
662
|
updatePendingSignal(e);
|
|
655
663
|
}
|
|
@@ -664,26 +672,26 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
664
672
|
}
|
|
665
673
|
const c = i || u;
|
|
666
674
|
const l = i || s ? undefined : r;
|
|
667
|
-
if (e.
|
|
675
|
+
if (e.Ae) {
|
|
668
676
|
if (c) {
|
|
669
|
-
e.
|
|
677
|
+
e.Ae(t, n);
|
|
670
678
|
} else {
|
|
671
|
-
e.
|
|
679
|
+
e.Ae();
|
|
672
680
|
}
|
|
673
681
|
return;
|
|
674
682
|
}
|
|
675
683
|
for (let i = e.I; i !== null; i = i.p) {
|
|
676
684
|
i.h.J = clock;
|
|
677
685
|
if (i.h.q !== n) {
|
|
678
|
-
!i.h.ne && globalQueue
|
|
686
|
+
!i.h.ne && globalQueue.F.push(i.h);
|
|
679
687
|
notifyStatus(i.h, t, n, c, l);
|
|
680
688
|
}
|
|
681
689
|
}
|
|
682
|
-
for (let i = e.A; i !== null; i = i.
|
|
690
|
+
for (let i = e.A; i !== null; i = i.P) {
|
|
683
691
|
for (let e = i.I; e !== null; e = e.p) {
|
|
684
692
|
e.h.J = clock;
|
|
685
693
|
if (e.h.q !== n) {
|
|
686
|
-
!e.h.ne && globalQueue
|
|
694
|
+
!e.h.ne && globalQueue.F.push(e.h);
|
|
687
695
|
notifyStatus(e.h, t, n, c, l);
|
|
688
696
|
}
|
|
689
697
|
}
|
|
@@ -693,52 +701,52 @@ function unlinkSubs(e) {
|
|
|
693
701
|
const t = e.V;
|
|
694
702
|
const n = e.D;
|
|
695
703
|
const i = e.p;
|
|
696
|
-
const r = e.
|
|
697
|
-
if (i !== null) i.
|
|
698
|
-
else t.
|
|
704
|
+
const r = e.ge;
|
|
705
|
+
if (i !== null) i.ge = r;
|
|
706
|
+
else t.Pe = r;
|
|
699
707
|
if (r !== null) r.p = i;
|
|
700
708
|
else {
|
|
701
709
|
t.I = i;
|
|
702
710
|
if (i === null) {
|
|
703
|
-
t.
|
|
704
|
-
t.L && !t.Ce && unobserved(t);
|
|
711
|
+
t.Ne?.();
|
|
712
|
+
t.L && !t.Ce && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
705
713
|
}
|
|
706
714
|
}
|
|
707
715
|
return n;
|
|
708
716
|
}
|
|
709
717
|
function unobserved(e) {
|
|
710
|
-
deleteFromHeap(e, e.
|
|
711
|
-
let t = e.
|
|
718
|
+
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
719
|
+
let t = e.C;
|
|
712
720
|
while (t !== null) {
|
|
713
721
|
t = unlinkSubs(t);
|
|
714
722
|
}
|
|
715
|
-
e.
|
|
723
|
+
e.C = null;
|
|
716
724
|
disposeChildren(e, true);
|
|
717
725
|
}
|
|
718
726
|
function link(e, t) {
|
|
719
|
-
const n = t.
|
|
727
|
+
const n = t.ye;
|
|
720
728
|
if (n !== null && n.V === e) return;
|
|
721
729
|
let i = null;
|
|
722
|
-
const r = t.
|
|
730
|
+
const r = t.O & REACTIVE_RECOMPUTING_DEPS;
|
|
723
731
|
if (r) {
|
|
724
|
-
i = n !== null ? n.D : t.
|
|
732
|
+
i = n !== null ? n.D : t.C;
|
|
725
733
|
if (i !== null && i.V === e) {
|
|
726
|
-
t.
|
|
734
|
+
t.ye = i;
|
|
727
735
|
return;
|
|
728
736
|
}
|
|
729
737
|
}
|
|
730
|
-
const o = e.
|
|
738
|
+
const o = e.Pe;
|
|
731
739
|
if (o !== null && o.h === t && (!r || isValidLink(o, t))) return;
|
|
732
|
-
const s = (t.
|
|
740
|
+
const s = (t.ye = e.Pe = { V: e, h: t, D: i, ge: o, p: null });
|
|
733
741
|
if (n !== null) n.D = s;
|
|
734
|
-
else t.
|
|
742
|
+
else t.C = s;
|
|
735
743
|
if (o !== null) o.p = s;
|
|
736
744
|
else e.I = s;
|
|
737
745
|
}
|
|
738
746
|
function isValidLink(e, t) {
|
|
739
|
-
const n = t.
|
|
747
|
+
const n = t.ye;
|
|
740
748
|
if (n !== null) {
|
|
741
|
-
let i = t.
|
|
749
|
+
let i = t.C;
|
|
742
750
|
do {
|
|
743
751
|
if (i === e) return true;
|
|
744
752
|
if (i === n) break;
|
|
@@ -749,56 +757,56 @@ function isValidLink(e, t) {
|
|
|
749
757
|
}
|
|
750
758
|
const PENDING_OWNER = {};
|
|
751
759
|
function markDisposal(e) {
|
|
752
|
-
let t = e.
|
|
760
|
+
let t = e.De;
|
|
753
761
|
while (t) {
|
|
754
|
-
t.
|
|
755
|
-
if (t.
|
|
762
|
+
t.O |= REACTIVE_ZOMBIE;
|
|
763
|
+
if (t.O & REACTIVE_IN_HEAP) {
|
|
756
764
|
deleteFromHeap(t, dirtyQueue);
|
|
757
765
|
insertIntoHeap(t, zombieQueue);
|
|
758
766
|
}
|
|
759
767
|
markDisposal(t);
|
|
760
|
-
t = t.
|
|
768
|
+
t = t.ve;
|
|
761
769
|
}
|
|
762
770
|
}
|
|
763
771
|
function dispose(e) {
|
|
764
|
-
let t = e.
|
|
772
|
+
let t = e.C || null;
|
|
765
773
|
do {
|
|
766
774
|
t = unlinkSubs(t);
|
|
767
775
|
} while (t !== null);
|
|
768
|
-
e.
|
|
769
|
-
e.
|
|
776
|
+
e.C = null;
|
|
777
|
+
e.ye = null;
|
|
770
778
|
disposeChildren(e, true);
|
|
771
779
|
}
|
|
772
780
|
function disposeChildren(e, t = false, n) {
|
|
773
|
-
if (e.
|
|
774
|
-
if (t) e.
|
|
775
|
-
let i = n ? e.
|
|
781
|
+
if (e.O & REACTIVE_DISPOSED) return;
|
|
782
|
+
if (t) e.O = REACTIVE_DISPOSED;
|
|
783
|
+
let i = n ? e.we : e.De;
|
|
776
784
|
while (i) {
|
|
777
|
-
const e = i.
|
|
778
|
-
if (i.
|
|
785
|
+
const e = i.ve;
|
|
786
|
+
if (i.C) {
|
|
779
787
|
const e = i;
|
|
780
|
-
deleteFromHeap(e, e.
|
|
781
|
-
let t = e.
|
|
788
|
+
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
789
|
+
let t = e.C;
|
|
782
790
|
do {
|
|
783
791
|
t = unlinkSubs(t);
|
|
784
792
|
} while (t !== null);
|
|
785
|
-
e.
|
|
786
|
-
e.
|
|
793
|
+
e.C = null;
|
|
794
|
+
e.ye = null;
|
|
787
795
|
}
|
|
788
796
|
disposeChildren(i, true);
|
|
789
797
|
i = e;
|
|
790
798
|
}
|
|
791
799
|
if (n) {
|
|
792
|
-
e.
|
|
800
|
+
e.we = null;
|
|
793
801
|
} else {
|
|
794
|
-
e.
|
|
795
|
-
e.
|
|
796
|
-
e.
|
|
802
|
+
e.De = null;
|
|
803
|
+
e.ve = null;
|
|
804
|
+
e.Ve = 0;
|
|
797
805
|
}
|
|
798
806
|
runDisposal(e, n);
|
|
799
807
|
}
|
|
800
808
|
function runDisposal(e, t) {
|
|
801
|
-
let n = t ? e.
|
|
809
|
+
let n = t ? e.be : e.me;
|
|
802
810
|
if (!n) return;
|
|
803
811
|
if (Array.isArray(n)) {
|
|
804
812
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -808,12 +816,12 @@ function runDisposal(e, t) {
|
|
|
808
816
|
} else {
|
|
809
817
|
n.call(n);
|
|
810
818
|
}
|
|
811
|
-
t ? (e.
|
|
819
|
+
t ? (e.be = null) : (e.me = null);
|
|
812
820
|
}
|
|
813
821
|
function childId(e, t) {
|
|
814
822
|
let n = e;
|
|
815
|
-
while (n.
|
|
816
|
-
if (n.id != null) return formatId(n.id, t ? n.
|
|
823
|
+
while (n.Le && n.i) n = n.i;
|
|
824
|
+
if (n.id != null) return formatId(n.id, t ? n.Ve++ : n.Ve);
|
|
817
825
|
throw new Error("Cannot get child id from owner without an id");
|
|
818
826
|
}
|
|
819
827
|
function getNextChildId(e) {
|
|
@@ -836,39 +844,42 @@ function getOwner() {
|
|
|
836
844
|
}
|
|
837
845
|
function onCleanup(e) {
|
|
838
846
|
if (!context) return e;
|
|
839
|
-
if (!context.
|
|
840
|
-
else if (Array.isArray(context.
|
|
841
|
-
else context.
|
|
847
|
+
if (!context.me) context.me = e;
|
|
848
|
+
else if (Array.isArray(context.me)) context.me.push(e);
|
|
849
|
+
else context.me = [context.me, e];
|
|
842
850
|
return e;
|
|
843
851
|
}
|
|
852
|
+
function isDisposed(e) {
|
|
853
|
+
return !!(e.O & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
|
|
854
|
+
}
|
|
844
855
|
function createOwner(e) {
|
|
845
856
|
const t = context;
|
|
846
857
|
const n = e?.transparent ?? false;
|
|
847
858
|
const i = {
|
|
848
859
|
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
849
|
-
|
|
860
|
+
Le: n || undefined,
|
|
850
861
|
t: true,
|
|
851
862
|
u: t?.t ? t.u : t,
|
|
852
|
-
|
|
853
|
-
|
|
863
|
+
De: null,
|
|
864
|
+
ve: null,
|
|
865
|
+
me: null,
|
|
866
|
+
ce: t?.ce ?? globalQueue,
|
|
867
|
+
ke: t?.ke || defaultContext,
|
|
868
|
+
Ve: 0,
|
|
854
869
|
be: null,
|
|
855
|
-
se: t?.se ?? globalQueue,
|
|
856
|
-
me: t?.me || defaultContext,
|
|
857
|
-
ve: 0,
|
|
858
870
|
we: null,
|
|
859
|
-
De: null,
|
|
860
871
|
i: t,
|
|
861
872
|
dispose(e = true) {
|
|
862
873
|
disposeChildren(i, e);
|
|
863
874
|
}
|
|
864
875
|
};
|
|
865
876
|
if (t) {
|
|
866
|
-
const e = t.
|
|
877
|
+
const e = t.De;
|
|
867
878
|
if (e === null) {
|
|
868
|
-
t.
|
|
879
|
+
t.De = i;
|
|
869
880
|
} else {
|
|
870
|
-
i.
|
|
871
|
-
t.
|
|
881
|
+
i.ve = e;
|
|
882
|
+
t.De = i;
|
|
872
883
|
}
|
|
873
884
|
}
|
|
874
885
|
return i;
|
|
@@ -882,80 +893,80 @@ function effect(e, t, n, i, r) {
|
|
|
882
893
|
const s = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
883
894
|
...r,
|
|
884
895
|
equals: () => {
|
|
885
|
-
s.
|
|
886
|
-
if (o) s.
|
|
896
|
+
s.ue = !s.q;
|
|
897
|
+
if (o) s.ce.enqueue(s.se, runEffect.bind(s));
|
|
887
898
|
return false;
|
|
888
899
|
},
|
|
889
900
|
lazy: true
|
|
890
901
|
});
|
|
891
|
-
s.
|
|
892
|
-
s.
|
|
893
|
-
s.
|
|
894
|
-
s.
|
|
895
|
-
s.
|
|
896
|
-
s.
|
|
897
|
-
const n = e !== undefined ? e : s.
|
|
902
|
+
s.Ue = i;
|
|
903
|
+
s.We = t;
|
|
904
|
+
s.He = n;
|
|
905
|
+
s.xe = undefined;
|
|
906
|
+
s.se = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
907
|
+
s.Ae = (e, t) => {
|
|
908
|
+
const n = e !== undefined ? e : s.Ee;
|
|
898
909
|
const i = t !== undefined ? t : s.q;
|
|
899
910
|
if (n & STATUS_ERROR) {
|
|
900
911
|
let e = i;
|
|
901
|
-
s.
|
|
902
|
-
if (s.
|
|
912
|
+
s.ce.notify(s, STATUS_PENDING, 0);
|
|
913
|
+
if (s.se === EFFECT_USER) {
|
|
903
914
|
try {
|
|
904
|
-
return s.
|
|
905
|
-
? s.
|
|
906
|
-
s.
|
|
907
|
-
s.
|
|
915
|
+
return s.He
|
|
916
|
+
? s.He(e, () => {
|
|
917
|
+
s.xe?.();
|
|
918
|
+
s.xe = undefined;
|
|
908
919
|
})
|
|
909
920
|
: console.error(e);
|
|
910
921
|
} catch (t) {
|
|
911
922
|
e = t;
|
|
912
923
|
}
|
|
913
924
|
}
|
|
914
|
-
if (!s.
|
|
915
|
-
} else if (s.
|
|
925
|
+
if (!s.ce.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
926
|
+
} else if (s.se === EFFECT_RENDER) s.ce.notify(s, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
916
927
|
};
|
|
917
928
|
recompute(s, true);
|
|
918
|
-
!r?.defer && (s.
|
|
929
|
+
!r?.defer && (s.se === EFFECT_USER ? s.ce.enqueue(s.se, runEffect.bind(s)) : runEffect.call(s));
|
|
919
930
|
o = true;
|
|
920
|
-
onCleanup(() => s.
|
|
931
|
+
onCleanup(() => s.xe?.());
|
|
921
932
|
}
|
|
922
933
|
function runEffect() {
|
|
923
|
-
if (!this.
|
|
924
|
-
this.
|
|
925
|
-
this.
|
|
934
|
+
if (!this.ue || this.O & REACTIVE_DISPOSED) return;
|
|
935
|
+
this.xe?.();
|
|
936
|
+
this.xe = undefined;
|
|
926
937
|
try {
|
|
927
|
-
this.
|
|
938
|
+
this.xe = this.We(this.fe, this.Ue);
|
|
928
939
|
} catch (e) {
|
|
929
|
-
if (!this.
|
|
940
|
+
if (!this.ce.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
930
941
|
} finally {
|
|
931
|
-
this.
|
|
932
|
-
this.
|
|
942
|
+
this.Ue = this.fe;
|
|
943
|
+
this.ue = false;
|
|
933
944
|
}
|
|
934
945
|
}
|
|
935
946
|
function trackedEffect(e, t) {
|
|
936
947
|
const run = () => {
|
|
937
|
-
if (!n.
|
|
938
|
-
n.
|
|
948
|
+
if (!n.ue || n.O & REACTIVE_DISPOSED) return;
|
|
949
|
+
n.ue = false;
|
|
939
950
|
recompute(n);
|
|
940
951
|
};
|
|
941
952
|
const n = computed(
|
|
942
953
|
() => {
|
|
943
954
|
try {
|
|
944
|
-
n.
|
|
945
|
-
n.
|
|
946
|
-
n.
|
|
955
|
+
n.xe?.();
|
|
956
|
+
n.xe = undefined;
|
|
957
|
+
n.xe = staleValues(e) || undefined;
|
|
947
958
|
} finally {
|
|
948
959
|
}
|
|
949
960
|
},
|
|
950
961
|
undefined,
|
|
951
962
|
{ ...t, lazy: true, pureWrite: true }
|
|
952
963
|
);
|
|
953
|
-
n.
|
|
954
|
-
n.
|
|
955
|
-
n.
|
|
956
|
-
n.
|
|
957
|
-
n.
|
|
958
|
-
onCleanup(() => n.
|
|
964
|
+
n.xe = undefined;
|
|
965
|
+
n.ue = true;
|
|
966
|
+
n.se = EFFECT_TRACKED;
|
|
967
|
+
n.le = run;
|
|
968
|
+
n.ce.enqueue(EFFECT_USER, run);
|
|
969
|
+
onCleanup(() => n.xe?.());
|
|
959
970
|
}
|
|
960
971
|
GlobalQueue.K = recompute;
|
|
961
972
|
GlobalQueue.Y = disposeChildren;
|
|
@@ -967,31 +978,83 @@ let foundPending = false;
|
|
|
967
978
|
let pendingReadActive = false;
|
|
968
979
|
let context = null;
|
|
969
980
|
let currentOptimisticLane = null;
|
|
981
|
+
let snapshotCaptureActive = false;
|
|
982
|
+
let snapshotSources = null;
|
|
983
|
+
function ownerInSnapshotScope(e) {
|
|
984
|
+
while (e) {
|
|
985
|
+
if (e.Qe) return true;
|
|
986
|
+
e = e.i;
|
|
987
|
+
}
|
|
988
|
+
return false;
|
|
989
|
+
}
|
|
990
|
+
function setSnapshotCapture(e) {
|
|
991
|
+
snapshotCaptureActive = e;
|
|
992
|
+
if (e && !snapshotSources) snapshotSources = new Set();
|
|
993
|
+
}
|
|
994
|
+
function markSnapshotScope(e) {
|
|
995
|
+
e.Qe = true;
|
|
996
|
+
}
|
|
997
|
+
function releaseSnapshotScope(e) {
|
|
998
|
+
e.Qe = false;
|
|
999
|
+
releaseSubtree(e);
|
|
1000
|
+
schedule();
|
|
1001
|
+
}
|
|
1002
|
+
function releaseSubtree(e) {
|
|
1003
|
+
let t = e.De;
|
|
1004
|
+
while (t) {
|
|
1005
|
+
if (t.Qe) {
|
|
1006
|
+
t = t.ve;
|
|
1007
|
+
continue;
|
|
1008
|
+
}
|
|
1009
|
+
if (t.L) {
|
|
1010
|
+
const e = t;
|
|
1011
|
+
e.oe = false;
|
|
1012
|
+
if (e.O & REACTIVE_SNAPSHOT_STALE) {
|
|
1013
|
+
e.O &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1014
|
+
e.O |= REACTIVE_DIRTY;
|
|
1015
|
+
if (dirtyQueue.N > e.o) dirtyQueue.N = e.o;
|
|
1016
|
+
insertIntoHeap(e, dirtyQueue);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
releaseSubtree(t);
|
|
1020
|
+
t = t.ve;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
function clearSnapshots() {
|
|
1024
|
+
if (snapshotSources) {
|
|
1025
|
+
for (const e of snapshotSources) {
|
|
1026
|
+
delete e.re;
|
|
1027
|
+
delete e[STORE_SNAPSHOT_PROPS];
|
|
1028
|
+
}
|
|
1029
|
+
snapshotSources = null;
|
|
1030
|
+
}
|
|
1031
|
+
snapshotCaptureActive = false;
|
|
1032
|
+
}
|
|
970
1033
|
function recompute(e, t = false) {
|
|
971
|
-
const n = e.
|
|
1034
|
+
const n = e.se;
|
|
972
1035
|
if (!t) {
|
|
973
1036
|
if (e.ne && (!n || activeTransition) && activeTransition !== e.ne)
|
|
974
1037
|
globalQueue.initTransition(e.ne);
|
|
975
|
-
deleteFromHeap(e, e.
|
|
1038
|
+
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
976
1039
|
if (e.ne || n === EFFECT_TRACKED) disposeChildren(e);
|
|
977
1040
|
else {
|
|
978
1041
|
markDisposal(e);
|
|
979
|
-
e.
|
|
980
|
-
e.
|
|
981
|
-
e.
|
|
982
|
-
e.
|
|
983
|
-
e.
|
|
1042
|
+
e.be = e.me;
|
|
1043
|
+
e.we = e.De;
|
|
1044
|
+
e.me = null;
|
|
1045
|
+
e.De = null;
|
|
1046
|
+
e.Ve = 0;
|
|
984
1047
|
}
|
|
985
1048
|
}
|
|
986
|
-
const i = !!(e.
|
|
1049
|
+
const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
|
|
987
1050
|
const r = hasActiveOverride(e);
|
|
988
|
-
const o = !!(e.
|
|
1051
|
+
const o = !!(e.Ee & STATUS_PENDING);
|
|
989
1052
|
const s = context;
|
|
990
1053
|
context = e;
|
|
991
|
-
e.
|
|
992
|
-
e.
|
|
1054
|
+
e.ye = null;
|
|
1055
|
+
e.O = REACTIVE_RECOMPUTING_DEPS;
|
|
993
1056
|
e.J = clock;
|
|
994
|
-
let u = e.
|
|
1057
|
+
let u = e.ae === NOT_PENDING ? e.fe : e.ae;
|
|
995
1058
|
let c = e.o;
|
|
996
1059
|
let l = tracking;
|
|
997
1060
|
let a = currentOptimisticLane;
|
|
@@ -1006,15 +1069,15 @@ function recompute(e, t = false) {
|
|
|
1006
1069
|
const t = resolveLane(e);
|
|
1007
1070
|
if (t) {
|
|
1008
1071
|
t.U.delete(e);
|
|
1009
|
-
updatePendingSignal(t.
|
|
1072
|
+
updatePendingSignal(t.Te);
|
|
1010
1073
|
}
|
|
1011
1074
|
} catch (t) {
|
|
1012
1075
|
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
1013
1076
|
const t = findLane(currentOptimisticLane);
|
|
1014
|
-
if (t.
|
|
1077
|
+
if (t.Te !== e) {
|
|
1015
1078
|
t.U.add(e);
|
|
1016
1079
|
e.ie = t;
|
|
1017
|
-
updatePendingSignal(t.
|
|
1080
|
+
updatePendingSignal(t.Te);
|
|
1018
1081
|
}
|
|
1019
1082
|
}
|
|
1020
1083
|
notifyStatus(
|
|
@@ -1026,136 +1089,147 @@ function recompute(e, t = false) {
|
|
|
1026
1089
|
);
|
|
1027
1090
|
} finally {
|
|
1028
1091
|
tracking = l;
|
|
1029
|
-
e.
|
|
1092
|
+
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1030
1093
|
context = s;
|
|
1031
1094
|
}
|
|
1032
1095
|
if (!e.q) {
|
|
1033
|
-
const s = e.
|
|
1034
|
-
let l = s !== null ? s.D : e.
|
|
1096
|
+
const s = e.ye;
|
|
1097
|
+
let l = s !== null ? s.D : e.C;
|
|
1035
1098
|
if (l !== null) {
|
|
1036
1099
|
do {
|
|
1037
1100
|
l = unlinkSubs(l);
|
|
1038
1101
|
} while (l !== null);
|
|
1039
1102
|
if (s !== null) s.D = null;
|
|
1040
|
-
else e.
|
|
1103
|
+
else e.C = null;
|
|
1041
1104
|
}
|
|
1042
|
-
const a = r ? e.
|
|
1043
|
-
const f = !e.
|
|
1105
|
+
const a = r ? e.fe : e.ae === NOT_PENDING ? e.fe : e.ae;
|
|
1106
|
+
const f = !e.pe || !e.pe(a, u);
|
|
1044
1107
|
if (f) {
|
|
1045
|
-
const s = r ? e.
|
|
1046
|
-
if (t || (n && activeTransition !== e.ne) || i) e.
|
|
1047
|
-
else e.
|
|
1108
|
+
const s = r ? e.fe : undefined;
|
|
1109
|
+
if (t || (n && activeTransition !== e.ne) || i) e.fe = u;
|
|
1110
|
+
else e.ae = u;
|
|
1048
1111
|
if (r && !i && o) {
|
|
1049
|
-
const t = e.
|
|
1050
|
-
const n = e.
|
|
1051
|
-
if (t <= n) e.
|
|
1112
|
+
const t = e.Oe || 0;
|
|
1113
|
+
const n = e.Re || 0;
|
|
1114
|
+
if (t <= n) e.fe = u;
|
|
1052
1115
|
}
|
|
1053
|
-
if (!r || i || e.
|
|
1116
|
+
if (!r || i || e.fe !== s) {
|
|
1054
1117
|
insertSubs(e, i || r);
|
|
1055
1118
|
}
|
|
1056
1119
|
} else if (r) {
|
|
1057
|
-
e.
|
|
1120
|
+
e.ae = u;
|
|
1058
1121
|
} else if (e.o != c) {
|
|
1059
1122
|
for (let t = e.I; t !== null; t = t.p) {
|
|
1060
|
-
insertIntoHeapHeight(t.h, t.h.
|
|
1123
|
+
insertIntoHeapHeight(t.h, t.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1061
1124
|
}
|
|
1062
1125
|
}
|
|
1063
1126
|
}
|
|
1064
1127
|
currentOptimisticLane = a;
|
|
1065
|
-
(!t || e.
|
|
1128
|
+
(!t || e.Ee & STATUS_PENDING) && !e.ne && !(activeTransition && e._e) && globalQueue.F.push(e);
|
|
1066
1129
|
e.ne && n && activeTransition !== e.ne && runInTransition(e.ne, () => recompute(e));
|
|
1067
1130
|
}
|
|
1068
1131
|
function updateIfNecessary(e) {
|
|
1069
|
-
if (e.
|
|
1070
|
-
for (let t = e.
|
|
1132
|
+
if (e.O & REACTIVE_CHECK) {
|
|
1133
|
+
for (let t = e.C; t; t = t.D) {
|
|
1071
1134
|
const n = t.V;
|
|
1072
1135
|
const i = n.m || n;
|
|
1073
1136
|
if (i.L) {
|
|
1074
1137
|
updateIfNecessary(i);
|
|
1075
1138
|
}
|
|
1076
|
-
if (e.
|
|
1139
|
+
if (e.O & REACTIVE_DIRTY) {
|
|
1077
1140
|
break;
|
|
1078
1141
|
}
|
|
1079
1142
|
}
|
|
1080
1143
|
}
|
|
1081
|
-
if (e.
|
|
1144
|
+
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.q && e.J < clock)) {
|
|
1082
1145
|
recompute(e);
|
|
1083
1146
|
}
|
|
1084
|
-
e.
|
|
1147
|
+
e.O = REACTIVE_NONE | (e.O & REACTIVE_SNAPSHOT_STALE);
|
|
1085
1148
|
}
|
|
1086
1149
|
function computed(e, t, n) {
|
|
1087
1150
|
const i = n?.transparent ?? false;
|
|
1088
1151
|
const r = {
|
|
1089
1152
|
id: n?.id ?? (i ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1153
|
+
Le: i || undefined,
|
|
1154
|
+
pe: n?.equals != null ? n.equals : isEqual,
|
|
1155
|
+
Me: !!n?.pureWrite,
|
|
1156
|
+
Ne: n?.unobserved,
|
|
1157
|
+
me: null,
|
|
1158
|
+
ce: context?.ce ?? globalQueue,
|
|
1159
|
+
ke: context?.ke ?? defaultContext,
|
|
1160
|
+
Ve: 0,
|
|
1098
1161
|
L: e,
|
|
1099
|
-
|
|
1162
|
+
fe: t,
|
|
1100
1163
|
o: 0,
|
|
1101
1164
|
A: null,
|
|
1102
|
-
|
|
1165
|
+
S: undefined,
|
|
1103
1166
|
T: null,
|
|
1104
|
-
|
|
1105
|
-
|
|
1167
|
+
C: null,
|
|
1168
|
+
ye: null,
|
|
1106
1169
|
I: null,
|
|
1107
|
-
|
|
1170
|
+
Pe: null,
|
|
1108
1171
|
i: context,
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1172
|
+
ve: null,
|
|
1173
|
+
De: null,
|
|
1174
|
+
O: REACTIVE_NONE,
|
|
1175
|
+
Ee: STATUS_UNINITIALIZED,
|
|
1113
1176
|
J: clock,
|
|
1114
|
-
|
|
1177
|
+
ae: NOT_PENDING,
|
|
1178
|
+
be: null,
|
|
1115
1179
|
we: null,
|
|
1116
|
-
|
|
1117
|
-
Se: null,
|
|
1180
|
+
Ie: null,
|
|
1118
1181
|
ne: null
|
|
1119
1182
|
};
|
|
1120
1183
|
r.T = r;
|
|
1121
1184
|
const o = context?.t ? context.u : context;
|
|
1122
1185
|
if (context) {
|
|
1123
|
-
const e = context.
|
|
1186
|
+
const e = context.De;
|
|
1124
1187
|
if (e === null) {
|
|
1125
|
-
context.
|
|
1188
|
+
context.De = r;
|
|
1126
1189
|
} else {
|
|
1127
|
-
r.
|
|
1128
|
-
context.
|
|
1190
|
+
r.ve = e;
|
|
1191
|
+
context.De = r;
|
|
1129
1192
|
}
|
|
1130
1193
|
}
|
|
1131
1194
|
if (o) r.o = o.o + 1;
|
|
1195
|
+
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.oe = true;
|
|
1132
1196
|
!n?.lazy && recompute(r, true);
|
|
1197
|
+
if (snapshotCaptureActive && !n?.lazy) {
|
|
1198
|
+
if (!(r.Ee & STATUS_PENDING)) {
|
|
1199
|
+
r.re = r.fe === undefined ? NO_SNAPSHOT : r.fe;
|
|
1200
|
+
snapshotSources.add(r);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1133
1203
|
return r;
|
|
1134
1204
|
}
|
|
1135
1205
|
function signal(e, t, n = null) {
|
|
1136
1206
|
const i = {
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1207
|
+
pe: t?.equals != null ? t.equals : isEqual,
|
|
1208
|
+
Me: !!t?.pureWrite,
|
|
1209
|
+
Ne: t?.unobserved,
|
|
1210
|
+
fe: e,
|
|
1141
1211
|
I: null,
|
|
1142
|
-
|
|
1212
|
+
Pe: null,
|
|
1143
1213
|
J: clock,
|
|
1144
1214
|
m: n,
|
|
1145
|
-
|
|
1146
|
-
|
|
1215
|
+
P: n?.A || null,
|
|
1216
|
+
ae: NOT_PENDING
|
|
1147
1217
|
};
|
|
1148
1218
|
n && (n.A = i);
|
|
1219
|
+
if (snapshotCaptureActive) {
|
|
1220
|
+
i.re = e === undefined ? NO_SNAPSHOT : e;
|
|
1221
|
+
snapshotSources.add(i);
|
|
1222
|
+
}
|
|
1149
1223
|
return i;
|
|
1150
1224
|
}
|
|
1151
1225
|
function optimisticSignal(e, t) {
|
|
1152
1226
|
const n = signal(e, t);
|
|
1153
|
-
n.
|
|
1227
|
+
n._e = true;
|
|
1154
1228
|
return n;
|
|
1155
1229
|
}
|
|
1156
1230
|
function optimisticComputed(e, t, n) {
|
|
1157
1231
|
const i = computed(e, t, n);
|
|
1158
|
-
i.
|
|
1232
|
+
i._e = true;
|
|
1159
1233
|
return i;
|
|
1160
1234
|
}
|
|
1161
1235
|
function isEqual(e, t) {
|
|
@@ -1175,14 +1249,21 @@ function read(e) {
|
|
|
1175
1249
|
const t = getPendingValueComputed(e);
|
|
1176
1250
|
const n = pendingReadActive;
|
|
1177
1251
|
pendingReadActive = false;
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1252
|
+
let i;
|
|
1253
|
+
try {
|
|
1254
|
+
i = read(t);
|
|
1255
|
+
} catch (t) {
|
|
1256
|
+
if (!context && t instanceof NotReadyError) return e.fe;
|
|
1257
|
+
throw t;
|
|
1258
|
+
} finally {
|
|
1259
|
+
pendingReadActive = n;
|
|
1260
|
+
}
|
|
1261
|
+
if (t.Ee & STATUS_PENDING) return e.fe;
|
|
1181
1262
|
if (stale && currentOptimisticLane && t.ie) {
|
|
1182
1263
|
const n = findLane(t.ie);
|
|
1183
1264
|
const i = findLane(currentOptimisticLane);
|
|
1184
1265
|
if (n !== i && n.U.size > 0) {
|
|
1185
|
-
return e.
|
|
1266
|
+
return e.fe;
|
|
1186
1267
|
}
|
|
1187
1268
|
}
|
|
1188
1269
|
return i;
|
|
@@ -1196,18 +1277,18 @@ function read(e) {
|
|
|
1196
1277
|
foundPending = true;
|
|
1197
1278
|
}
|
|
1198
1279
|
pendingCheckActive = i;
|
|
1199
|
-
return e.
|
|
1280
|
+
return e.fe;
|
|
1200
1281
|
}
|
|
1201
1282
|
let t = context;
|
|
1202
1283
|
if (t?.t) t = t.u;
|
|
1203
1284
|
if (refreshing && e.L) recompute(e);
|
|
1204
1285
|
if (t && tracking) {
|
|
1205
|
-
if (e.L && e.
|
|
1286
|
+
if (e.L && e.O & REACTIVE_DISPOSED) recompute(e);
|
|
1206
1287
|
link(e, t);
|
|
1207
1288
|
const n = e.m || e;
|
|
1208
1289
|
if (n.L) {
|
|
1209
|
-
const i = e.
|
|
1210
|
-
if (n.o >= (i ? zombieQueue.
|
|
1290
|
+
const i = e.O & REACTIVE_ZOMBIE;
|
|
1291
|
+
if (n.o >= (i ? zombieQueue.N : dirtyQueue.N)) {
|
|
1211
1292
|
markNode(t);
|
|
1212
1293
|
markHeap(i ? zombieQueue : dirtyQueue);
|
|
1213
1294
|
updateIfNecessary(n);
|
|
@@ -1219,67 +1300,80 @@ function read(e) {
|
|
|
1219
1300
|
}
|
|
1220
1301
|
}
|
|
1221
1302
|
const n = e.m || e;
|
|
1222
|
-
if (
|
|
1223
|
-
if (
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1303
|
+
if (n.Ee & STATUS_PENDING) {
|
|
1304
|
+
if (t && !(stale && n.ne && activeTransition !== n.ne)) {
|
|
1305
|
+
if (currentOptimisticLane) {
|
|
1306
|
+
const i = n.ie;
|
|
1307
|
+
const r = findLane(currentOptimisticLane);
|
|
1308
|
+
if (i && findLane(i) === r && !hasActiveOverride(n)) {
|
|
1309
|
+
if (!tracking) link(e, t);
|
|
1310
|
+
throw n.q;
|
|
1311
|
+
}
|
|
1312
|
+
} else {
|
|
1227
1313
|
if (!tracking) link(e, t);
|
|
1228
1314
|
throw n.q;
|
|
1229
1315
|
}
|
|
1230
|
-
} else {
|
|
1231
|
-
if (!tracking) link(e, t);
|
|
1316
|
+
} else if (!t && n.Ee & STATUS_UNINITIALIZED) {
|
|
1232
1317
|
throw n.q;
|
|
1233
1318
|
}
|
|
1234
1319
|
}
|
|
1235
|
-
if (e.L && e.
|
|
1320
|
+
if (e.L && e.Ee & STATUS_ERROR) {
|
|
1236
1321
|
if (e.J < clock) {
|
|
1237
1322
|
recompute(e, true);
|
|
1238
1323
|
return read(e);
|
|
1239
1324
|
} else throw e.q;
|
|
1240
1325
|
}
|
|
1326
|
+
if (snapshotCaptureActive && t && t.oe) {
|
|
1327
|
+
const n = e.re;
|
|
1328
|
+
if (n !== undefined) {
|
|
1329
|
+
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1330
|
+
const r = e.ae !== NOT_PENDING ? e.ae : e.fe;
|
|
1331
|
+
if (r !== i) t.O |= REACTIVE_SNAPSHOT_STALE;
|
|
1332
|
+
return i;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1241
1335
|
return !t ||
|
|
1242
1336
|
currentOptimisticLane !== null ||
|
|
1243
|
-
e.
|
|
1337
|
+
e.ae === NOT_PENDING ||
|
|
1244
1338
|
(stale && e.ne && activeTransition !== e.ne)
|
|
1245
|
-
? e.
|
|
1246
|
-
: e.
|
|
1339
|
+
? e.fe
|
|
1340
|
+
: e.ae;
|
|
1247
1341
|
}
|
|
1248
1342
|
function setSignal(e, t) {
|
|
1249
1343
|
if (e.ne && activeTransition !== e.ne) globalQueue.initTransition(e.ne);
|
|
1250
|
-
const n = e.
|
|
1251
|
-
const i = n ? e.
|
|
1344
|
+
const n = e._e && !projectionWriteActive;
|
|
1345
|
+
const i = n ? e.fe : e.ae === NOT_PENDING ? e.fe : e.ae;
|
|
1252
1346
|
if (typeof t === "function") t = t(i);
|
|
1253
|
-
const r = !e.
|
|
1347
|
+
const r = !e.pe || !e.pe(i, t);
|
|
1254
1348
|
if (!r) {
|
|
1255
|
-
if (n && e.
|
|
1349
|
+
if (n && e.ae !== NOT_PENDING && e.L) {
|
|
1256
1350
|
insertSubs(e, true);
|
|
1257
1351
|
schedule();
|
|
1258
1352
|
}
|
|
1259
1353
|
return t;
|
|
1260
1354
|
}
|
|
1261
1355
|
if (n) {
|
|
1262
|
-
const n = globalQueue
|
|
1356
|
+
const n = globalQueue.$.includes(e);
|
|
1263
1357
|
if (e.ne && n) {
|
|
1264
1358
|
globalQueue.initTransition(e.ne);
|
|
1265
1359
|
}
|
|
1266
|
-
if (e.
|
|
1267
|
-
e.
|
|
1360
|
+
if (e.ae === NOT_PENDING) {
|
|
1361
|
+
e.ae = e.fe;
|
|
1268
1362
|
}
|
|
1269
1363
|
if (!n) {
|
|
1270
|
-
globalQueue
|
|
1364
|
+
globalQueue.$.push(e);
|
|
1271
1365
|
}
|
|
1272
|
-
e.
|
|
1366
|
+
e.Oe = (e.Oe || 0) + 1;
|
|
1273
1367
|
const i = getOrCreateLane(e);
|
|
1274
1368
|
e.ie = i;
|
|
1275
|
-
e.
|
|
1369
|
+
e.fe = t;
|
|
1276
1370
|
} else {
|
|
1277
|
-
if (e.
|
|
1278
|
-
e.
|
|
1371
|
+
if (e.ae === NOT_PENDING) globalQueue.F.push(e);
|
|
1372
|
+
e.ae = t;
|
|
1279
1373
|
}
|
|
1280
1374
|
updatePendingSignal(e);
|
|
1281
|
-
if (e.
|
|
1282
|
-
setSignal(e.
|
|
1375
|
+
if (e.he) {
|
|
1376
|
+
setSignal(e.he, t);
|
|
1283
1377
|
}
|
|
1284
1378
|
e.J = clock;
|
|
1285
1379
|
insertSubs(e, n);
|
|
@@ -1299,32 +1393,32 @@ function runWithOwner(e, t) {
|
|
|
1299
1393
|
}
|
|
1300
1394
|
}
|
|
1301
1395
|
function getPendingSignal(e) {
|
|
1302
|
-
if (!e.
|
|
1303
|
-
e.
|
|
1304
|
-
if (e.
|
|
1305
|
-
e.
|
|
1396
|
+
if (!e.Ge) {
|
|
1397
|
+
e.Ge = optimisticSignal(false, { pureWrite: true });
|
|
1398
|
+
if (e.de) {
|
|
1399
|
+
e.Ge.de = e;
|
|
1306
1400
|
}
|
|
1307
|
-
if (computePendingState(e)) setSignal(e.
|
|
1401
|
+
if (computePendingState(e)) setSignal(e.Ge, true);
|
|
1308
1402
|
}
|
|
1309
|
-
return e.
|
|
1403
|
+
return e.Ge;
|
|
1310
1404
|
}
|
|
1311
1405
|
function computePendingState(e) {
|
|
1312
1406
|
const t = e;
|
|
1313
|
-
if (e.
|
|
1314
|
-
if (t.
|
|
1315
|
-
if (e.
|
|
1407
|
+
if (e._e && e.ae !== NOT_PENDING) {
|
|
1408
|
+
if (t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
|
|
1409
|
+
if (e.de) {
|
|
1316
1410
|
const t = e.ie ? findLane(e.ie) : null;
|
|
1317
1411
|
return !!(t && t.U.size > 0);
|
|
1318
1412
|
}
|
|
1319
1413
|
return true;
|
|
1320
1414
|
}
|
|
1321
|
-
if (e.
|
|
1322
|
-
return !!(t.
|
|
1415
|
+
if (e.ae !== NOT_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
|
|
1416
|
+
return !!(t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED));
|
|
1323
1417
|
}
|
|
1324
1418
|
function updatePendingSignal(e) {
|
|
1325
|
-
if (e.
|
|
1419
|
+
if (e.Ge) {
|
|
1326
1420
|
const t = computePendingState(e);
|
|
1327
|
-
const n = e.
|
|
1421
|
+
const n = e.Ge;
|
|
1328
1422
|
setSignal(n, t);
|
|
1329
1423
|
if (!t && n.ie) {
|
|
1330
1424
|
const t = resolveLane(e);
|
|
@@ -1340,20 +1434,20 @@ function updatePendingSignal(e) {
|
|
|
1340
1434
|
}
|
|
1341
1435
|
}
|
|
1342
1436
|
function getPendingValueComputed(e) {
|
|
1343
|
-
if (!e.
|
|
1437
|
+
if (!e.he) {
|
|
1344
1438
|
const t = pendingReadActive;
|
|
1345
1439
|
pendingReadActive = false;
|
|
1346
1440
|
const n = pendingCheckActive;
|
|
1347
1441
|
pendingCheckActive = false;
|
|
1348
1442
|
const i = context;
|
|
1349
1443
|
context = null;
|
|
1350
|
-
e.
|
|
1351
|
-
e.
|
|
1444
|
+
e.he = optimisticComputed(() => read(e));
|
|
1445
|
+
e.he.de = e;
|
|
1352
1446
|
context = i;
|
|
1353
1447
|
pendingCheckActive = n;
|
|
1354
1448
|
pendingReadActive = t;
|
|
1355
1449
|
}
|
|
1356
|
-
return e.
|
|
1450
|
+
return e.he;
|
|
1357
1451
|
}
|
|
1358
1452
|
function staleValues(e, t = true) {
|
|
1359
1453
|
const n = stale;
|
|
@@ -1414,7 +1508,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1414
1508
|
if (!t) {
|
|
1415
1509
|
throw new NoOwnerError();
|
|
1416
1510
|
}
|
|
1417
|
-
const n = hasContext(e, t) ? t.
|
|
1511
|
+
const n = hasContext(e, t) ? t.ke[e.id] : e.defaultValue;
|
|
1418
1512
|
if (isUndefined(n)) {
|
|
1419
1513
|
throw new ContextNotFoundError();
|
|
1420
1514
|
}
|
|
@@ -1424,10 +1518,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1424
1518
|
if (!n) {
|
|
1425
1519
|
throw new NoOwnerError();
|
|
1426
1520
|
}
|
|
1427
|
-
n.
|
|
1521
|
+
n.ke = { ...n.ke, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1428
1522
|
}
|
|
1429
1523
|
function hasContext(e, t) {
|
|
1430
|
-
return !isUndefined(t?.
|
|
1524
|
+
return !isUndefined(t?.ke[e.id]);
|
|
1431
1525
|
}
|
|
1432
1526
|
function isUndefined(e) {
|
|
1433
1527
|
return typeof e === "undefined";
|
|
@@ -1571,14 +1665,14 @@ function applyState(e, t, n, i) {
|
|
|
1571
1665
|
let t = false;
|
|
1572
1666
|
const l = getOverrideValue(o, s, c, "length", u);
|
|
1573
1667
|
if (e.length && l && e[0] && n(e[0]) != null) {
|
|
1574
|
-
let a, f, E, T, d, R, O
|
|
1668
|
+
let a, f, E, T, d, S, R, O;
|
|
1575
1669
|
for (
|
|
1576
1670
|
E = 0, T = Math.min(l, e.length);
|
|
1577
1671
|
E < T &&
|
|
1578
|
-
((
|
|
1672
|
+
((S = getOverrideValue(o, s, c, E, u)) === e[E] || (S && e[E] && n(S) === n(e[E])));
|
|
1579
1673
|
E++
|
|
1580
1674
|
) {
|
|
1581
|
-
applyState(e[E], wrap(
|
|
1675
|
+
applyState(e[E], wrap(S, r), n, i);
|
|
1582
1676
|
}
|
|
1583
1677
|
const _ = new Array(e.length),
|
|
1584
1678
|
I = new Map();
|
|
@@ -1586,10 +1680,10 @@ function applyState(e, t, n, i) {
|
|
|
1586
1680
|
T = l - 1, d = e.length - 1;
|
|
1587
1681
|
T >= E &&
|
|
1588
1682
|
d >= E &&
|
|
1589
|
-
((
|
|
1683
|
+
((S = getOverrideValue(o, s, c, T, u)) === e[d] || (S && e[d] && n(S) === n(e[d])));
|
|
1590
1684
|
T--, d--
|
|
1591
1685
|
) {
|
|
1592
|
-
_[d] =
|
|
1686
|
+
_[d] = S;
|
|
1593
1687
|
}
|
|
1594
1688
|
if (E > d || E > T) {
|
|
1595
1689
|
for (f = E; f <= d; f++) {
|
|
@@ -1606,22 +1700,22 @@ function applyState(e, t, n, i) {
|
|
|
1606
1700
|
l !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
|
|
1607
1701
|
return;
|
|
1608
1702
|
}
|
|
1609
|
-
|
|
1703
|
+
R = new Array(d + 1);
|
|
1610
1704
|
for (f = d; f >= E; f--) {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
a = I.get(
|
|
1614
|
-
|
|
1615
|
-
I.set(
|
|
1705
|
+
S = e[f];
|
|
1706
|
+
O = S ? n(S) : S;
|
|
1707
|
+
a = I.get(O);
|
|
1708
|
+
R[f] = a === undefined ? -1 : a;
|
|
1709
|
+
I.set(O, f);
|
|
1616
1710
|
}
|
|
1617
1711
|
for (a = E; a <= T; a++) {
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
f = I.get(
|
|
1712
|
+
S = getOverrideValue(o, s, c, a, u);
|
|
1713
|
+
O = S ? n(S) : S;
|
|
1714
|
+
f = I.get(O);
|
|
1621
1715
|
if (f !== undefined && f !== -1) {
|
|
1622
|
-
_[f] =
|
|
1623
|
-
f =
|
|
1624
|
-
I.set(
|
|
1716
|
+
_[f] = S;
|
|
1717
|
+
f = R[f];
|
|
1718
|
+
I.set(O, f);
|
|
1625
1719
|
}
|
|
1626
1720
|
}
|
|
1627
1721
|
for (f = E; f < e.length; f++) {
|
|
@@ -1799,9 +1893,9 @@ function getNodes(e, t) {
|
|
|
1799
1893
|
if (!n) e[t] = n = Object.create(null);
|
|
1800
1894
|
return n;
|
|
1801
1895
|
}
|
|
1802
|
-
function getNode(e, t, n, i, r = isEqual, o) {
|
|
1896
|
+
function getNode(e, t, n, i, r = isEqual, o, s) {
|
|
1803
1897
|
if (e[t]) return e[t];
|
|
1804
|
-
const
|
|
1898
|
+
const u = signal(
|
|
1805
1899
|
n,
|
|
1806
1900
|
{
|
|
1807
1901
|
equals: r,
|
|
@@ -1811,8 +1905,13 @@ function getNode(e, t, n, i, r = isEqual, o) {
|
|
|
1811
1905
|
},
|
|
1812
1906
|
i
|
|
1813
1907
|
);
|
|
1814
|
-
if (o)
|
|
1815
|
-
|
|
1908
|
+
if (o) u._e = true;
|
|
1909
|
+
if (s && t in s) {
|
|
1910
|
+
const e = s[t];
|
|
1911
|
+
u.re = e === undefined ? NO_SNAPSHOT : e;
|
|
1912
|
+
snapshotSources?.add(u);
|
|
1913
|
+
}
|
|
1914
|
+
return (e[t] = u);
|
|
1816
1915
|
}
|
|
1817
1916
|
function trackSelf(e, t = $TRACK) {
|
|
1818
1917
|
getObserver() &&
|
|
@@ -1864,7 +1963,7 @@ const storeTraps = {
|
|
|
1864
1963
|
if (e && e.get) return e.get.call(n);
|
|
1865
1964
|
}
|
|
1866
1965
|
if (writeOnly(n)) {
|
|
1867
|
-
let n = r && (s || !u) ? (r.
|
|
1966
|
+
let n = r && (s || !u) ? (r.ae !== NOT_PENDING ? (r._e ? r.fe : r.ae) : r.fe) : c[t];
|
|
1868
1967
|
n === $DELETED && (n = undefined);
|
|
1869
1968
|
if (!isWrappable(n)) return n;
|
|
1870
1969
|
const i = wrap(n, e);
|
|
@@ -1889,7 +1988,8 @@ const storeTraps = {
|
|
|
1889
1988
|
isWrappable(l) ? wrap(l, e) : l,
|
|
1890
1989
|
e[STORE_FIREWALL],
|
|
1891
1990
|
isEqual,
|
|
1892
|
-
e[STORE_OPTIMISTIC]
|
|
1991
|
+
e[STORE_OPTIMISTIC],
|
|
1992
|
+
e[STORE_SNAPSHOT_PROPS]
|
|
1893
1993
|
)
|
|
1894
1994
|
);
|
|
1895
1995
|
}
|
|
@@ -1920,6 +2020,15 @@ const storeTraps = {
|
|
|
1920
2020
|
untrack(() => {
|
|
1921
2021
|
const r = e[STORE_VALUE];
|
|
1922
2022
|
const o = r[t];
|
|
2023
|
+
if (snapshotCaptureActive && typeof t !== "symbol") {
|
|
2024
|
+
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2025
|
+
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
2026
|
+
snapshotSources?.add(e);
|
|
2027
|
+
}
|
|
2028
|
+
if (!(t in e[STORE_SNAPSHOT_PROPS])) {
|
|
2029
|
+
e[STORE_SNAPSHOT_PROPS][t] = o;
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
1923
2032
|
const s = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
1924
2033
|
const u = s ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
1925
2034
|
if (s) trackOptimisticStore(i);
|
|
@@ -2363,68 +2472,68 @@ function mapArray(e, t, n) {
|
|
|
2363
2472
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2364
2473
|
return createMemo(
|
|
2365
2474
|
updateKeyedMap.bind({
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
$e: [],
|
|
2370
|
-
He: t,
|
|
2371
|
-
je: [],
|
|
2475
|
+
Fe: createOwner(),
|
|
2476
|
+
$e: 0,
|
|
2477
|
+
je: e,
|
|
2372
2478
|
Ke: [],
|
|
2373
|
-
Ye:
|
|
2374
|
-
Be:
|
|
2375
|
-
Xe:
|
|
2376
|
-
qe:
|
|
2479
|
+
Ye: t,
|
|
2480
|
+
Be: [],
|
|
2481
|
+
Xe: [],
|
|
2482
|
+
qe: i,
|
|
2483
|
+
ze: i || n?.keyed === false ? [] : undefined,
|
|
2484
|
+
Ze: t.length > 1 ? [] : undefined,
|
|
2485
|
+
Je: n?.fallback
|
|
2377
2486
|
})
|
|
2378
2487
|
);
|
|
2379
2488
|
}
|
|
2380
2489
|
const pureOptions = { pureWrite: true };
|
|
2381
2490
|
function updateKeyedMap() {
|
|
2382
|
-
const e = this.
|
|
2491
|
+
const e = this.je() || [],
|
|
2383
2492
|
t = e.length;
|
|
2384
2493
|
e[$TRACK];
|
|
2385
|
-
runWithOwner(this.
|
|
2494
|
+
runWithOwner(this.Fe, () => {
|
|
2386
2495
|
let n,
|
|
2387
2496
|
i,
|
|
2388
|
-
r = this.
|
|
2497
|
+
r = this.ze
|
|
2389
2498
|
? () => {
|
|
2390
|
-
this.
|
|
2391
|
-
this.
|
|
2392
|
-
return this.
|
|
2393
|
-
read.bind(null, this.
|
|
2394
|
-
this.
|
|
2499
|
+
this.ze[i] = signal(e[i], pureOptions);
|
|
2500
|
+
this.Ze && (this.Ze[i] = signal(i, pureOptions));
|
|
2501
|
+
return this.Ye(
|
|
2502
|
+
read.bind(null, this.ze[i]),
|
|
2503
|
+
this.Ze ? read.bind(null, this.Ze[i]) : undefined
|
|
2395
2504
|
);
|
|
2396
2505
|
}
|
|
2397
|
-
: this.
|
|
2506
|
+
: this.Ze
|
|
2398
2507
|
? () => {
|
|
2399
2508
|
const t = e[i];
|
|
2400
|
-
this.
|
|
2401
|
-
return this.
|
|
2509
|
+
this.Ze[i] = signal(i, pureOptions);
|
|
2510
|
+
return this.Ye(() => t, read.bind(null, this.Ze[i]));
|
|
2402
2511
|
}
|
|
2403
2512
|
: () => {
|
|
2404
2513
|
const t = e[i];
|
|
2405
|
-
return this.
|
|
2514
|
+
return this.Ye(() => t);
|
|
2406
2515
|
};
|
|
2407
2516
|
if (t === 0) {
|
|
2408
|
-
if (this
|
|
2409
|
-
this.
|
|
2517
|
+
if (this.$e !== 0) {
|
|
2518
|
+
this.Fe.dispose(false);
|
|
2519
|
+
this.Xe = [];
|
|
2410
2520
|
this.Ke = [];
|
|
2411
|
-
this
|
|
2412
|
-
this
|
|
2413
|
-
this.
|
|
2414
|
-
this.
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
this.je = new Array(t);
|
|
2521
|
+
this.Be = [];
|
|
2522
|
+
this.$e = 0;
|
|
2523
|
+
this.ze && (this.ze = []);
|
|
2524
|
+
this.Ze && (this.Ze = []);
|
|
2525
|
+
}
|
|
2526
|
+
if (this.Je && !this.Be[0]) {
|
|
2527
|
+
this.Be[0] = runWithOwner((this.Xe[0] = createOwner()), this.Je);
|
|
2528
|
+
}
|
|
2529
|
+
} else if (this.$e === 0) {
|
|
2530
|
+
if (this.Xe[0]) this.Xe[0].dispose();
|
|
2531
|
+
this.Be = new Array(t);
|
|
2423
2532
|
for (i = 0; i < t; i++) {
|
|
2424
|
-
this
|
|
2425
|
-
this.
|
|
2533
|
+
this.Ke[i] = e[i];
|
|
2534
|
+
this.Be[i] = runWithOwner((this.Xe[i] = createOwner()), r);
|
|
2426
2535
|
}
|
|
2427
|
-
this
|
|
2536
|
+
this.$e = t;
|
|
2428
2537
|
} else {
|
|
2429
2538
|
let o,
|
|
2430
2539
|
s,
|
|
@@ -2435,187 +2544,187 @@ function updateKeyedMap() {
|
|
|
2435
2544
|
f,
|
|
2436
2545
|
E = new Array(t),
|
|
2437
2546
|
T = new Array(t),
|
|
2438
|
-
d = this.
|
|
2439
|
-
|
|
2547
|
+
d = this.ze ? new Array(t) : undefined,
|
|
2548
|
+
S = this.Ze ? new Array(t) : undefined;
|
|
2440
2549
|
for (
|
|
2441
|
-
o = 0, s = Math.min(this
|
|
2442
|
-
o < s && (this
|
|
2550
|
+
o = 0, s = Math.min(this.$e, t);
|
|
2551
|
+
o < s && (this.Ke[o] === e[o] || (this.ze && compare(this.qe, this.Ke[o], e[o])));
|
|
2443
2552
|
o++
|
|
2444
2553
|
) {
|
|
2445
|
-
if (this.
|
|
2554
|
+
if (this.ze) setSignal(this.ze[o], e[o]);
|
|
2446
2555
|
}
|
|
2447
2556
|
for (
|
|
2448
|
-
s = this
|
|
2557
|
+
s = this.$e - 1, u = t - 1;
|
|
2449
2558
|
s >= o &&
|
|
2450
2559
|
u >= o &&
|
|
2451
|
-
(this
|
|
2560
|
+
(this.Ke[s] === e[u] || (this.ze && compare(this.qe, this.Ke[s], e[u])));
|
|
2452
2561
|
s--, u--
|
|
2453
2562
|
) {
|
|
2454
|
-
E[u] = this.
|
|
2455
|
-
T[u] = this.
|
|
2456
|
-
d && (d[u] = this.
|
|
2457
|
-
|
|
2563
|
+
E[u] = this.Be[s];
|
|
2564
|
+
T[u] = this.Xe[s];
|
|
2565
|
+
d && (d[u] = this.ze[s]);
|
|
2566
|
+
S && (S[u] = this.Ze[s]);
|
|
2458
2567
|
}
|
|
2459
2568
|
a = new Map();
|
|
2460
2569
|
f = new Array(u + 1);
|
|
2461
2570
|
for (i = u; i >= o; i--) {
|
|
2462
2571
|
c = e[i];
|
|
2463
|
-
l = this.
|
|
2572
|
+
l = this.qe ? this.qe(c) : c;
|
|
2464
2573
|
n = a.get(l);
|
|
2465
2574
|
f[i] = n === undefined ? -1 : n;
|
|
2466
2575
|
a.set(l, i);
|
|
2467
2576
|
}
|
|
2468
2577
|
for (n = o; n <= s; n++) {
|
|
2469
|
-
c = this
|
|
2470
|
-
l = this.
|
|
2578
|
+
c = this.Ke[n];
|
|
2579
|
+
l = this.qe ? this.qe(c) : c;
|
|
2471
2580
|
i = a.get(l);
|
|
2472
2581
|
if (i !== undefined && i !== -1) {
|
|
2473
|
-
E[i] = this.
|
|
2474
|
-
T[i] = this.
|
|
2475
|
-
d && (d[i] = this.
|
|
2476
|
-
|
|
2582
|
+
E[i] = this.Be[n];
|
|
2583
|
+
T[i] = this.Xe[n];
|
|
2584
|
+
d && (d[i] = this.ze[n]);
|
|
2585
|
+
S && (S[i] = this.Ze[n]);
|
|
2477
2586
|
i = f[i];
|
|
2478
2587
|
a.set(l, i);
|
|
2479
|
-
} else this.
|
|
2588
|
+
} else this.Xe[n].dispose();
|
|
2480
2589
|
}
|
|
2481
2590
|
for (i = o; i < t; i++) {
|
|
2482
2591
|
if (i in E) {
|
|
2483
|
-
this.
|
|
2484
|
-
this.
|
|
2592
|
+
this.Be[i] = E[i];
|
|
2593
|
+
this.Xe[i] = T[i];
|
|
2485
2594
|
if (d) {
|
|
2486
|
-
this.
|
|
2487
|
-
setSignal(this.
|
|
2595
|
+
this.ze[i] = d[i];
|
|
2596
|
+
setSignal(this.ze[i], e[i]);
|
|
2488
2597
|
}
|
|
2489
|
-
if (
|
|
2490
|
-
this.
|
|
2491
|
-
setSignal(this.
|
|
2598
|
+
if (S) {
|
|
2599
|
+
this.Ze[i] = S[i];
|
|
2600
|
+
setSignal(this.Ze[i], i);
|
|
2492
2601
|
}
|
|
2493
2602
|
} else {
|
|
2494
|
-
this.
|
|
2603
|
+
this.Be[i] = runWithOwner((this.Xe[i] = createOwner()), r);
|
|
2495
2604
|
}
|
|
2496
2605
|
}
|
|
2497
|
-
this.
|
|
2498
|
-
this
|
|
2606
|
+
this.Be = this.Be.slice(0, (this.$e = t));
|
|
2607
|
+
this.Ke = e.slice(0);
|
|
2499
2608
|
}
|
|
2500
2609
|
});
|
|
2501
|
-
return this.
|
|
2610
|
+
return this.Be;
|
|
2502
2611
|
}
|
|
2503
2612
|
function repeat(e, t, n) {
|
|
2504
2613
|
return updateRepeat.bind({
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2614
|
+
Fe: createOwner(),
|
|
2615
|
+
$e: 0,
|
|
2616
|
+
et: 0,
|
|
2617
|
+
tt: e,
|
|
2618
|
+
Ye: t,
|
|
2619
|
+
Xe: [],
|
|
2620
|
+
Be: [],
|
|
2621
|
+
nt: n?.from,
|
|
2622
|
+
Je: n?.fallback
|
|
2514
2623
|
});
|
|
2515
2624
|
}
|
|
2516
2625
|
function updateRepeat() {
|
|
2517
|
-
const e = this.
|
|
2518
|
-
const t = this.
|
|
2519
|
-
runWithOwner(this.
|
|
2626
|
+
const e = this.tt();
|
|
2627
|
+
const t = this.nt?.() || 0;
|
|
2628
|
+
runWithOwner(this.Fe, () => {
|
|
2520
2629
|
if (e === 0) {
|
|
2521
|
-
if (this
|
|
2522
|
-
this.
|
|
2523
|
-
this.
|
|
2524
|
-
this.
|
|
2525
|
-
this
|
|
2630
|
+
if (this.$e !== 0) {
|
|
2631
|
+
this.Fe.dispose(false);
|
|
2632
|
+
this.Xe = [];
|
|
2633
|
+
this.Be = [];
|
|
2634
|
+
this.$e = 0;
|
|
2526
2635
|
}
|
|
2527
|
-
if (this.
|
|
2528
|
-
this.
|
|
2636
|
+
if (this.Je && !this.Be[0]) {
|
|
2637
|
+
this.Be[0] = runWithOwner((this.Xe[0] = createOwner()), this.Je);
|
|
2529
2638
|
}
|
|
2530
2639
|
return;
|
|
2531
2640
|
}
|
|
2532
2641
|
const n = t + e;
|
|
2533
|
-
const i = this.
|
|
2534
|
-
if (this
|
|
2535
|
-
for (let e = n; e < i; e++) this.
|
|
2536
|
-
if (this.
|
|
2537
|
-
let e = this.
|
|
2538
|
-
while (e < t && e < this
|
|
2539
|
-
this.
|
|
2540
|
-
this.
|
|
2541
|
-
} else if (this.
|
|
2542
|
-
let n = i - this.
|
|
2543
|
-
let r = this.
|
|
2544
|
-
this.
|
|
2642
|
+
const i = this.et + this.$e;
|
|
2643
|
+
if (this.$e === 0 && this.Xe[0]) this.Xe[0].dispose();
|
|
2644
|
+
for (let e = n; e < i; e++) this.Xe[e - this.et].dispose();
|
|
2645
|
+
if (this.et < t) {
|
|
2646
|
+
let e = this.et;
|
|
2647
|
+
while (e < t && e < this.$e) this.Xe[e++].dispose();
|
|
2648
|
+
this.Xe.splice(0, t - this.et);
|
|
2649
|
+
this.Be.splice(0, t - this.et);
|
|
2650
|
+
} else if (this.et > t) {
|
|
2651
|
+
let n = i - this.et - 1;
|
|
2652
|
+
let r = this.et - t;
|
|
2653
|
+
this.Xe.length = this.Be.length = e;
|
|
2545
2654
|
while (n >= r) {
|
|
2546
|
-
this.
|
|
2547
|
-
this.
|
|
2655
|
+
this.Xe[n] = this.Xe[n - r];
|
|
2656
|
+
this.Be[n] = this.Be[n - r];
|
|
2548
2657
|
n--;
|
|
2549
2658
|
}
|
|
2550
2659
|
for (let e = 0; e < r; e++) {
|
|
2551
|
-
this.
|
|
2660
|
+
this.Be[e] = runWithOwner((this.Xe[e] = createOwner()), () => this.Ye(e + t));
|
|
2552
2661
|
}
|
|
2553
2662
|
}
|
|
2554
2663
|
for (let e = i; e < n; e++) {
|
|
2555
|
-
this.
|
|
2664
|
+
this.Be[e - t] = runWithOwner((this.Xe[e - t] = createOwner()), () => this.Ye(e));
|
|
2556
2665
|
}
|
|
2557
|
-
this.
|
|
2558
|
-
this.
|
|
2559
|
-
this
|
|
2666
|
+
this.Be = this.Be.slice(0, e);
|
|
2667
|
+
this.et = t;
|
|
2668
|
+
this.$e = e;
|
|
2560
2669
|
});
|
|
2561
|
-
return this.
|
|
2670
|
+
return this.Be;
|
|
2562
2671
|
}
|
|
2563
2672
|
function compare(e, t, n) {
|
|
2564
2673
|
return e ? e(t) === e(n) : true;
|
|
2565
2674
|
}
|
|
2566
2675
|
function boundaryComputed(e, t) {
|
|
2567
2676
|
const n = computed(e, undefined, { lazy: true });
|
|
2568
|
-
n.
|
|
2569
|
-
const i = e !== undefined ? e : n.
|
|
2677
|
+
n.Ae = (e, t) => {
|
|
2678
|
+
const i = e !== undefined ? e : n.Ee;
|
|
2570
2679
|
const r = t !== undefined ? t : n.q;
|
|
2571
|
-
n.
|
|
2572
|
-
n.
|
|
2680
|
+
n.Ee &= ~n.it;
|
|
2681
|
+
n.ce.notify(n, n.it, i, r);
|
|
2573
2682
|
};
|
|
2574
|
-
n.
|
|
2683
|
+
n.it = t;
|
|
2575
2684
|
n.Ce = true;
|
|
2576
2685
|
recompute(n, true);
|
|
2577
2686
|
return n;
|
|
2578
2687
|
}
|
|
2579
2688
|
function createBoundChildren(e, t, n, i) {
|
|
2580
|
-
const r = e.
|
|
2581
|
-
r.addChild((e.
|
|
2582
|
-
onCleanup(() => r.removeChild(e.
|
|
2689
|
+
const r = e.ce;
|
|
2690
|
+
r.addChild((e.ce = n));
|
|
2691
|
+
onCleanup(() => r.removeChild(e.ce));
|
|
2583
2692
|
return runWithOwner(e, () => {
|
|
2584
2693
|
const e = computed(t);
|
|
2585
2694
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
2586
2695
|
});
|
|
2587
2696
|
}
|
|
2588
2697
|
class CollectionQueue extends Queue {
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2698
|
+
rt;
|
|
2699
|
+
ot = new Set();
|
|
2700
|
+
st = signal(false, { pureWrite: true });
|
|
2701
|
+
ut = false;
|
|
2593
2702
|
constructor(e) {
|
|
2594
2703
|
super();
|
|
2595
|
-
this.
|
|
2704
|
+
this.rt = e;
|
|
2596
2705
|
}
|
|
2597
2706
|
run(e) {
|
|
2598
|
-
if (!e || read(this.
|
|
2707
|
+
if (!e || read(this.st)) return;
|
|
2599
2708
|
return super.run(e);
|
|
2600
2709
|
}
|
|
2601
2710
|
notify(e, t, n, i) {
|
|
2602
|
-
if (!(t & this.
|
|
2603
|
-
if (n & this.
|
|
2711
|
+
if (!(t & this.rt) || (this.rt & STATUS_PENDING && this.ut)) return super.notify(e, t, n, i);
|
|
2712
|
+
if (n & this.rt) {
|
|
2604
2713
|
const t = i?.source || e.q?.source;
|
|
2605
2714
|
if (t) {
|
|
2606
|
-
const e = this.
|
|
2607
|
-
this.
|
|
2608
|
-
if (e) setSignal(this.
|
|
2715
|
+
const e = this.ot.size === 0;
|
|
2716
|
+
this.ot.add(t);
|
|
2717
|
+
if (e) setSignal(this.st, true);
|
|
2609
2718
|
}
|
|
2610
2719
|
}
|
|
2611
|
-
t &= ~this.
|
|
2720
|
+
t &= ~this.rt;
|
|
2612
2721
|
return t ? super.notify(e, t, n, i) : true;
|
|
2613
2722
|
}
|
|
2614
2723
|
checkSources() {
|
|
2615
|
-
for (const e of this.
|
|
2616
|
-
if (!(e.
|
|
2724
|
+
for (const e of this.ot) {
|
|
2725
|
+
if (!(e.Ee & this.rt)) this.ot.delete(e);
|
|
2617
2726
|
}
|
|
2618
|
-
if (!this.
|
|
2727
|
+
if (!this.ot.size) setSignal(this.st, false);
|
|
2619
2728
|
}
|
|
2620
2729
|
}
|
|
2621
2730
|
function createCollectionBoundary(e, t, n) {
|
|
@@ -2623,10 +2732,10 @@ function createCollectionBoundary(e, t, n) {
|
|
|
2623
2732
|
const r = new CollectionQueue(e);
|
|
2624
2733
|
const o = createBoundChildren(i, t, r, e);
|
|
2625
2734
|
const s = computed(() => {
|
|
2626
|
-
if (!read(r.
|
|
2735
|
+
if (!read(r.st)) {
|
|
2627
2736
|
const e = read(o);
|
|
2628
|
-
if (!untrack(() => read(r.
|
|
2629
|
-
r.
|
|
2737
|
+
if (!untrack(() => read(r.st))) {
|
|
2738
|
+
r.ut = true;
|
|
2630
2739
|
return e;
|
|
2631
2740
|
}
|
|
2632
2741
|
}
|
|
@@ -2639,10 +2748,10 @@ function createLoadBoundary(e, t) {
|
|
|
2639
2748
|
}
|
|
2640
2749
|
function createErrorBoundary(e, t) {
|
|
2641
2750
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2642
|
-
let n = e.
|
|
2751
|
+
let n = e.ot.values().next().value;
|
|
2643
2752
|
const i = n.q?.cause ?? n.q;
|
|
2644
2753
|
return t(i, () => {
|
|
2645
|
-
for (const t of e.
|
|
2754
|
+
for (const t of e.ot) recompute(t);
|
|
2646
2755
|
schedule();
|
|
2647
2756
|
});
|
|
2648
2757
|
});
|
|
@@ -2705,6 +2814,7 @@ export {
|
|
|
2705
2814
|
NotReadyError,
|
|
2706
2815
|
SUPPORTS_PROXY,
|
|
2707
2816
|
action,
|
|
2817
|
+
clearSnapshots,
|
|
2708
2818
|
createContext,
|
|
2709
2819
|
createEffect,
|
|
2710
2820
|
createErrorBoundary,
|
|
@@ -2727,11 +2837,13 @@ export {
|
|
|
2727
2837
|
getNextChildId,
|
|
2728
2838
|
getObserver,
|
|
2729
2839
|
getOwner,
|
|
2840
|
+
isDisposed,
|
|
2730
2841
|
isEqual,
|
|
2731
2842
|
isPending,
|
|
2732
2843
|
isRefreshing,
|
|
2733
2844
|
isWrappable,
|
|
2734
2845
|
mapArray,
|
|
2846
|
+
markSnapshotScope,
|
|
2735
2847
|
merge,
|
|
2736
2848
|
omit,
|
|
2737
2849
|
onCleanup,
|
|
@@ -2740,10 +2852,12 @@ export {
|
|
|
2740
2852
|
pending,
|
|
2741
2853
|
reconcile,
|
|
2742
2854
|
refresh,
|
|
2855
|
+
releaseSnapshotScope,
|
|
2743
2856
|
repeat,
|
|
2744
2857
|
resolve,
|
|
2745
2858
|
runWithOwner,
|
|
2746
2859
|
setContext,
|
|
2860
|
+
setSnapshotCapture,
|
|
2747
2861
|
snapshot,
|
|
2748
2862
|
untrack
|
|
2749
2863
|
};
|