@solidjs/signals 0.9.10 → 0.10.0
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 +539 -601
- package/dist/node.cjs +850 -906
- package/dist/prod.js +795 -851
- package/dist/types/boundaries.d.ts +0 -5
- package/dist/types/core/action.d.ts +1 -0
- package/dist/types/core/async.d.ts +5 -0
- package/dist/types/core/context.d.ts +1 -1
- package/dist/types/core/core.d.ts +25 -104
- package/dist/types/core/effect.d.ts +4 -3
- package/dist/types/core/graph.d.ts +3 -0
- package/dist/types/core/heap.d.ts +1 -1
- package/dist/types/core/index.d.ts +4 -2
- package/dist/types/core/lanes.d.ts +52 -0
- package/dist/types/core/owner.d.ts +22 -0
- package/dist/types/core/scheduler.d.ts +6 -59
- package/dist/types/core/types.d.ts +74 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/signals.d.ts +73 -76
- package/dist/types/store/index.d.ts +1 -1
- package/dist/types/store/optimistic.d.ts +9 -12
- package/dist/types/store/projection.d.ts +12 -4
- package/dist/types/store/store.d.ts +26 -1
- package/package.json +2 -2
package/dist/prod.js
CHANGED
|
@@ -102,8 +102,8 @@ function markNode(e, t = REACTIVE_DIRTY) {
|
|
|
102
102
|
for (let t = e.p; t !== null; t = t.h) {
|
|
103
103
|
markNode(t.A, REACTIVE_CHECK);
|
|
104
104
|
}
|
|
105
|
-
if (e.
|
|
106
|
-
for (let t = e.
|
|
105
|
+
if (e.P !== null) {
|
|
106
|
+
for (let t = e.P; t !== null; t = t.C) {
|
|
107
107
|
for (let e = t.p; e !== null; e = e.h) {
|
|
108
108
|
markNode(e.A, REACTIVE_CHECK);
|
|
109
109
|
}
|
|
@@ -112,12 +112,12 @@ function markNode(e, t = REACTIVE_DIRTY) {
|
|
|
112
112
|
}
|
|
113
113
|
function runHeap(e, t) {
|
|
114
114
|
e.I = false;
|
|
115
|
-
for (e.
|
|
116
|
-
let n = e.T[e.
|
|
115
|
+
for (e.N = 0; e.N <= e.S; e.N++) {
|
|
116
|
+
let n = e.T[e.N];
|
|
117
117
|
while (n !== undefined) {
|
|
118
118
|
if (n._ & REACTIVE_IN_HEAP) t(n);
|
|
119
119
|
else adjustHeight(n, e);
|
|
120
|
-
n = e.T[e.
|
|
120
|
+
n = e.T[e.N];
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
e.S = 0;
|
|
@@ -125,10 +125,10 @@ function runHeap(e, t) {
|
|
|
125
125
|
function adjustHeight(e, t) {
|
|
126
126
|
deleteFromHeap(e, t);
|
|
127
127
|
let n = e.u;
|
|
128
|
-
for (let t = e.D; t; t = t.
|
|
129
|
-
const e = t.
|
|
128
|
+
for (let t = e.D; t; t = t.V) {
|
|
129
|
+
const e = t.m;
|
|
130
130
|
const i = e.L || e;
|
|
131
|
-
if (i.
|
|
131
|
+
if (i.k && i.u >= n) n = i.u + 1;
|
|
132
132
|
}
|
|
133
133
|
if (e.u !== n) {
|
|
134
134
|
e.u = n;
|
|
@@ -138,88 +138,18 @@ function adjustHeight(e, t) {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
const transitions = new Set();
|
|
141
|
-
const dirtyQueue = { T: new Array(2e3).fill(undefined), I: false,
|
|
142
|
-
const zombieQueue = { T: new Array(2e3).fill(undefined), I: false,
|
|
141
|
+
const dirtyQueue = { T: new Array(2e3).fill(undefined), I: false, N: 0, S: 0 };
|
|
142
|
+
const zombieQueue = { T: new Array(2e3).fill(undefined), I: false, N: 0, S: 0 };
|
|
143
143
|
let clock = 0;
|
|
144
144
|
let activeTransition = null;
|
|
145
145
|
let scheduled = false;
|
|
146
146
|
let projectionWriteActive = false;
|
|
147
|
-
const signalLanes = new WeakMap();
|
|
148
|
-
const activeLanes = new Set();
|
|
149
|
-
let currentOptimisticLane = null;
|
|
150
|
-
function setCurrentOptimisticLane(e) {
|
|
151
|
-
currentOptimisticLane = e;
|
|
152
|
-
}
|
|
153
|
-
function getOrCreateLane(e) {
|
|
154
|
-
let t = signalLanes.get(e);
|
|
155
|
-
if (t) {
|
|
156
|
-
return findLane(t);
|
|
157
|
-
}
|
|
158
|
-
const n = e.k;
|
|
159
|
-
const i = n?.W ? findLane(n.W) : null;
|
|
160
|
-
t = { t: e, G: new Set(), M: [[], []], F: null, $: activeTransition, H: i };
|
|
161
|
-
signalLanes.set(e, t);
|
|
162
|
-
activeLanes.add(t);
|
|
163
|
-
e.j = e.K || 0;
|
|
164
|
-
return t;
|
|
165
|
-
}
|
|
166
|
-
function findLane(e) {
|
|
167
|
-
while (e.F) e = e.F;
|
|
168
|
-
return e;
|
|
169
|
-
}
|
|
170
|
-
function mergeLanes(e, t) {
|
|
171
|
-
e = findLane(e);
|
|
172
|
-
t = findLane(t);
|
|
173
|
-
if (e === t) return e;
|
|
174
|
-
t.F = e;
|
|
175
|
-
for (const n of t.G) e.G.add(n);
|
|
176
|
-
e.M[0].push(...t.M[0]);
|
|
177
|
-
e.M[1].push(...t.M[1]);
|
|
178
|
-
return e;
|
|
179
|
-
}
|
|
180
|
-
function clearLaneEntry(e) {
|
|
181
|
-
signalLanes.delete(e);
|
|
182
|
-
}
|
|
183
|
-
function resolveLane(e) {
|
|
184
|
-
const t = e.W;
|
|
185
|
-
if (!t) return undefined;
|
|
186
|
-
const n = findLane(t);
|
|
187
|
-
if (activeLanes.has(n)) return n;
|
|
188
|
-
e.W = undefined;
|
|
189
|
-
return undefined;
|
|
190
|
-
}
|
|
191
|
-
function hasActiveOverride(e) {
|
|
192
|
-
return !!(e.Y && e.B !== NOT_PENDING);
|
|
193
|
-
}
|
|
194
|
-
function assignOrMergeLane(e, t) {
|
|
195
|
-
const n = findLane(t);
|
|
196
|
-
const i = e.W;
|
|
197
|
-
if (i) {
|
|
198
|
-
if (i.F) {
|
|
199
|
-
e.W = t;
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
const r = findLane(i);
|
|
203
|
-
if (activeLanes.has(r)) {
|
|
204
|
-
if (r !== n && !hasActiveOverride(e)) {
|
|
205
|
-
if (n.H && findLane(n.H) === r) {
|
|
206
|
-
e.W = t;
|
|
207
|
-
} else if (r.H && findLane(r.H) === n);
|
|
208
|
-
else {
|
|
209
|
-
mergeLanes(n, r);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
e.W = t;
|
|
216
|
-
}
|
|
217
147
|
function runLaneEffects(e) {
|
|
218
148
|
for (const t of activeLanes) {
|
|
219
|
-
if (t.
|
|
220
|
-
const n = t.
|
|
149
|
+
if (t.U || t.W.size > 0) continue;
|
|
150
|
+
const n = t.F[e - 1];
|
|
221
151
|
if (n.length) {
|
|
222
|
-
t.
|
|
152
|
+
t.F[e - 1] = [];
|
|
223
153
|
runQueue(n, e);
|
|
224
154
|
}
|
|
225
155
|
}
|
|
@@ -230,21 +160,21 @@ function setProjectionWriteActive(e) {
|
|
|
230
160
|
function schedule() {
|
|
231
161
|
if (scheduled) return;
|
|
232
162
|
scheduled = true;
|
|
233
|
-
if (!globalQueue.
|
|
163
|
+
if (!globalQueue.G) queueMicrotask(flush);
|
|
234
164
|
}
|
|
235
165
|
class Queue {
|
|
236
166
|
o = null;
|
|
237
|
-
|
|
238
|
-
|
|
167
|
+
M = [[], []];
|
|
168
|
+
$ = [];
|
|
239
169
|
created = clock;
|
|
240
170
|
addChild(e) {
|
|
241
|
-
this
|
|
171
|
+
this.$.push(e);
|
|
242
172
|
e.o = this;
|
|
243
173
|
}
|
|
244
174
|
removeChild(e) {
|
|
245
|
-
const t = this
|
|
175
|
+
const t = this.$.indexOf(e);
|
|
246
176
|
if (t >= 0) {
|
|
247
|
-
this
|
|
177
|
+
this.$.splice(t, 1);
|
|
248
178
|
e.o = null;
|
|
249
179
|
}
|
|
250
180
|
}
|
|
@@ -253,106 +183,106 @@ class Queue {
|
|
|
253
183
|
return false;
|
|
254
184
|
}
|
|
255
185
|
run(e) {
|
|
256
|
-
if (this.
|
|
257
|
-
const t = this.
|
|
258
|
-
this.
|
|
186
|
+
if (this.M[e - 1].length) {
|
|
187
|
+
const t = this.M[e - 1];
|
|
188
|
+
this.M[e - 1] = [];
|
|
259
189
|
runQueue(t, e);
|
|
260
190
|
}
|
|
261
|
-
for (let t = 0; t < this
|
|
191
|
+
for (let t = 0; t < this.$.length; t++) this.$[t].run?.(e);
|
|
262
192
|
}
|
|
263
193
|
enqueue(e, t) {
|
|
264
194
|
if (e) {
|
|
265
195
|
if (currentOptimisticLane) {
|
|
266
196
|
const n = findLane(currentOptimisticLane);
|
|
267
|
-
n.
|
|
197
|
+
n.F[e - 1].push(t);
|
|
268
198
|
} else {
|
|
269
|
-
this.
|
|
199
|
+
this.M[e - 1].push(t);
|
|
270
200
|
}
|
|
271
201
|
}
|
|
272
202
|
schedule();
|
|
273
203
|
}
|
|
274
204
|
stashQueues(e) {
|
|
275
|
-
e.
|
|
276
|
-
e.
|
|
277
|
-
this.
|
|
278
|
-
for (let t = 0; t < this
|
|
279
|
-
let n = this
|
|
280
|
-
let i = e
|
|
205
|
+
e.M[0].push(...this.M[0]);
|
|
206
|
+
e.M[1].push(...this.M[1]);
|
|
207
|
+
this.M = [[], []];
|
|
208
|
+
for (let t = 0; t < this.$.length; t++) {
|
|
209
|
+
let n = this.$[t];
|
|
210
|
+
let i = e.$[t];
|
|
281
211
|
if (!i) {
|
|
282
|
-
i = {
|
|
283
|
-
e
|
|
212
|
+
i = { M: [[], []], $: [] };
|
|
213
|
+
e.$[t] = i;
|
|
284
214
|
}
|
|
285
215
|
n.stashQueues(i);
|
|
286
216
|
}
|
|
287
217
|
}
|
|
288
218
|
restoreQueues(e) {
|
|
289
|
-
this.
|
|
290
|
-
this.
|
|
291
|
-
for (let t = 0; t < e
|
|
292
|
-
const n = e
|
|
293
|
-
let i = this
|
|
219
|
+
this.M[0].push(...e.M[0]);
|
|
220
|
+
this.M[1].push(...e.M[1]);
|
|
221
|
+
for (let t = 0; t < e.$.length; t++) {
|
|
222
|
+
const n = e.$[t];
|
|
223
|
+
let i = this.$[t];
|
|
294
224
|
if (i) i.restoreQueues(n);
|
|
295
225
|
}
|
|
296
226
|
}
|
|
297
227
|
}
|
|
298
228
|
class GlobalQueue extends Queue {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
static
|
|
304
|
-
static
|
|
305
|
-
static
|
|
229
|
+
G = false;
|
|
230
|
+
H = [];
|
|
231
|
+
j = [];
|
|
232
|
+
K = new Set();
|
|
233
|
+
static Y;
|
|
234
|
+
static B;
|
|
235
|
+
static X = null;
|
|
306
236
|
flush() {
|
|
307
|
-
if (this.
|
|
308
|
-
this.
|
|
237
|
+
if (this.G) return;
|
|
238
|
+
this.G = true;
|
|
309
239
|
try {
|
|
310
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
240
|
+
runHeap(dirtyQueue, GlobalQueue.Y);
|
|
311
241
|
if (activeTransition) {
|
|
312
242
|
const e = transitionComplete(activeTransition);
|
|
313
243
|
if (!e) {
|
|
314
244
|
let e = activeTransition;
|
|
315
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
316
|
-
this.
|
|
317
|
-
this.
|
|
318
|
-
this.
|
|
245
|
+
runHeap(zombieQueue, GlobalQueue.Y);
|
|
246
|
+
this.H = [];
|
|
247
|
+
this.j = [];
|
|
248
|
+
this.K = new Set();
|
|
319
249
|
runLaneEffects(EFFECT_RENDER);
|
|
320
250
|
runLaneEffects(EFFECT_USER);
|
|
321
|
-
this.stashQueues(activeTransition.
|
|
251
|
+
this.stashQueues(activeTransition.q);
|
|
322
252
|
clock++;
|
|
323
|
-
scheduled = dirtyQueue.S >= dirtyQueue.
|
|
324
|
-
reassignPendingTransition(activeTransition.
|
|
253
|
+
scheduled = dirtyQueue.S >= dirtyQueue.N;
|
|
254
|
+
reassignPendingTransition(activeTransition.H);
|
|
325
255
|
activeTransition = null;
|
|
326
256
|
finalizePureQueue(null, true);
|
|
327
257
|
return;
|
|
328
258
|
}
|
|
329
|
-
this.
|
|
330
|
-
this.restoreQueues(activeTransition.
|
|
259
|
+
this.H !== activeTransition.H && this.H.push(...activeTransition.H);
|
|
260
|
+
this.restoreQueues(activeTransition.q);
|
|
331
261
|
transitions.delete(activeTransition);
|
|
332
262
|
const t = activeTransition;
|
|
333
263
|
activeTransition = null;
|
|
334
|
-
reassignPendingTransition(this.
|
|
264
|
+
reassignPendingTransition(this.H);
|
|
335
265
|
finalizePureQueue(t);
|
|
336
266
|
} else {
|
|
337
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
267
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.Y);
|
|
338
268
|
finalizePureQueue();
|
|
339
269
|
}
|
|
340
270
|
clock++;
|
|
341
|
-
scheduled = dirtyQueue.S >= dirtyQueue.
|
|
271
|
+
scheduled = dirtyQueue.S >= dirtyQueue.N;
|
|
342
272
|
runLaneEffects(EFFECT_RENDER);
|
|
343
273
|
this.run(EFFECT_RENDER);
|
|
344
274
|
runLaneEffects(EFFECT_USER);
|
|
345
275
|
this.run(EFFECT_USER);
|
|
346
276
|
} finally {
|
|
347
|
-
this.
|
|
277
|
+
this.G = false;
|
|
348
278
|
}
|
|
349
279
|
}
|
|
350
280
|
notify(e, t, n, i) {
|
|
351
281
|
if (t & STATUS_PENDING) {
|
|
352
282
|
if (n & STATUS_PENDING) {
|
|
353
|
-
const t = i !== undefined ? i : e.
|
|
354
|
-
if (activeTransition && t && !activeTransition.
|
|
355
|
-
activeTransition.
|
|
283
|
+
const t = i !== undefined ? i : e.Z;
|
|
284
|
+
if (activeTransition && t && !activeTransition.J.includes(t.t)) {
|
|
285
|
+
activeTransition.J.push(t.t);
|
|
356
286
|
schedule();
|
|
357
287
|
}
|
|
358
288
|
}
|
|
@@ -363,143 +293,143 @@ class GlobalQueue extends Queue {
|
|
|
363
293
|
initTransition(e) {
|
|
364
294
|
if (e) e = currentTransition(e);
|
|
365
295
|
if (e && e === activeTransition) return;
|
|
366
|
-
if (!e && activeTransition && activeTransition.
|
|
296
|
+
if (!e && activeTransition && activeTransition.ee === clock) return;
|
|
367
297
|
if (!activeTransition) {
|
|
368
298
|
activeTransition = e ?? {
|
|
369
|
-
|
|
299
|
+
ee: clock,
|
|
300
|
+
H: [],
|
|
370
301
|
J: [],
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
te:
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
ae: false
|
|
302
|
+
j: [],
|
|
303
|
+
K: new Set(),
|
|
304
|
+
te: [],
|
|
305
|
+
q: { M: [[], []], $: [] },
|
|
306
|
+
ne: false
|
|
377
307
|
};
|
|
378
308
|
} else if (e) {
|
|
379
309
|
const t = activeTransition;
|
|
380
|
-
t.
|
|
381
|
-
e.
|
|
310
|
+
t.ne = e;
|
|
311
|
+
e.te.push(...t.te);
|
|
382
312
|
for (const n of activeLanes) {
|
|
383
|
-
if (n
|
|
313
|
+
if (n.ie === t) n.ie = e;
|
|
384
314
|
}
|
|
385
|
-
e.
|
|
386
|
-
for (const n of t.
|
|
387
|
-
e.
|
|
315
|
+
e.j.push(...t.j);
|
|
316
|
+
for (const n of t.K) {
|
|
317
|
+
e.K.add(n);
|
|
388
318
|
}
|
|
389
319
|
transitions.delete(t);
|
|
390
320
|
activeTransition = e;
|
|
391
321
|
}
|
|
392
322
|
transitions.add(activeTransition);
|
|
393
|
-
activeTransition.
|
|
394
|
-
for (let e = 0; e < this.
|
|
395
|
-
const t = this.
|
|
396
|
-
t
|
|
397
|
-
activeTransition.
|
|
398
|
-
}
|
|
399
|
-
this.
|
|
400
|
-
for (let e = 0; e < this.
|
|
401
|
-
const t = this.
|
|
402
|
-
t
|
|
403
|
-
activeTransition.
|
|
404
|
-
}
|
|
405
|
-
this.
|
|
323
|
+
activeTransition.ee = clock;
|
|
324
|
+
for (let e = 0; e < this.H.length; e++) {
|
|
325
|
+
const t = this.H[e];
|
|
326
|
+
t.ie = activeTransition;
|
|
327
|
+
activeTransition.H.push(t);
|
|
328
|
+
}
|
|
329
|
+
this.H = activeTransition.H;
|
|
330
|
+
for (let e = 0; e < this.j.length; e++) {
|
|
331
|
+
const t = this.j[e];
|
|
332
|
+
t.ie = activeTransition;
|
|
333
|
+
activeTransition.j.push(t);
|
|
334
|
+
}
|
|
335
|
+
this.j = activeTransition.j;
|
|
406
336
|
for (const e of activeLanes) {
|
|
407
|
-
if (!e
|
|
337
|
+
if (!e.ie) e.ie = activeTransition;
|
|
408
338
|
}
|
|
409
|
-
for (const e of this.
|
|
410
|
-
this.
|
|
339
|
+
for (const e of this.K) activeTransition.K.add(e);
|
|
340
|
+
this.K = activeTransition.K;
|
|
411
341
|
}
|
|
412
342
|
}
|
|
413
343
|
function insertSubs(e, t = false) {
|
|
414
|
-
const n = e.
|
|
344
|
+
const n = e.re || currentOptimisticLane;
|
|
415
345
|
for (let i = e.p; i !== null; i = i.h) {
|
|
416
346
|
if (t && n) {
|
|
417
347
|
i.A._ |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
418
348
|
assignOrMergeLane(i.A, n);
|
|
419
349
|
} else if (t) {
|
|
420
350
|
i.A._ |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
421
|
-
i.A.
|
|
351
|
+
i.A.re = undefined;
|
|
422
352
|
}
|
|
423
353
|
const e = i.A;
|
|
424
|
-
if (e.
|
|
425
|
-
if (!e.
|
|
426
|
-
e.
|
|
427
|
-
e.
|
|
354
|
+
if (e.oe === EFFECT_TRACKED) {
|
|
355
|
+
if (!e.se) {
|
|
356
|
+
e.se = true;
|
|
357
|
+
e.ue.enqueue(EFFECT_USER, e.ce);
|
|
428
358
|
}
|
|
429
359
|
continue;
|
|
430
360
|
}
|
|
431
361
|
const r = i.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
432
|
-
if (r.
|
|
362
|
+
if (r.N > i.A.u) r.N = i.A.u;
|
|
433
363
|
insertIntoHeap(i.A, r);
|
|
434
364
|
}
|
|
435
365
|
}
|
|
436
366
|
function finalizePureQueue(e = null, t = false) {
|
|
437
367
|
let n = !t;
|
|
438
368
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
439
|
-
if (dirtyQueue.S >= dirtyQueue.
|
|
369
|
+
if (dirtyQueue.S >= dirtyQueue.N) runHeap(dirtyQueue, GlobalQueue.Y);
|
|
440
370
|
if (n) {
|
|
441
|
-
const t = globalQueue.
|
|
371
|
+
const t = globalQueue.H;
|
|
442
372
|
for (let e = 0; e < t.length; e++) {
|
|
443
373
|
const n = t[e];
|
|
444
|
-
if (n.
|
|
445
|
-
n.
|
|
446
|
-
n.
|
|
447
|
-
if (n.
|
|
374
|
+
if (n.le !== NOT_PENDING) {
|
|
375
|
+
n.ae = n.le;
|
|
376
|
+
n.le = NOT_PENDING;
|
|
377
|
+
if (n.oe && n.oe !== EFFECT_TRACKED) n.se = true;
|
|
448
378
|
}
|
|
449
|
-
n.
|
|
450
|
-
if (n.
|
|
379
|
+
n.fe &= ~STATUS_UNINITIALIZED;
|
|
380
|
+
if (n.k) GlobalQueue.B(n, false, true);
|
|
451
381
|
}
|
|
452
382
|
t.length = 0;
|
|
453
|
-
const n = e ? e.
|
|
383
|
+
const n = e ? e.j : globalQueue.j;
|
|
454
384
|
for (let e = 0; e < n.length; e++) {
|
|
455
385
|
const t = n[e];
|
|
456
|
-
const i = t.
|
|
457
|
-
t.
|
|
458
|
-
if (i !== NOT_PENDING && t.
|
|
459
|
-
t.
|
|
386
|
+
const i = t.le;
|
|
387
|
+
t.re = undefined;
|
|
388
|
+
if (i !== NOT_PENDING && t.ae !== i) {
|
|
389
|
+
t.ae = i;
|
|
460
390
|
insertSubs(t, true);
|
|
461
391
|
}
|
|
462
|
-
t.
|
|
463
|
-
t
|
|
392
|
+
t.le = NOT_PENDING;
|
|
393
|
+
t.ie = null;
|
|
464
394
|
}
|
|
465
395
|
n.length = 0;
|
|
466
|
-
const i = e ? e.
|
|
467
|
-
if (GlobalQueue.
|
|
396
|
+
const i = e ? e.K : globalQueue.K;
|
|
397
|
+
if (GlobalQueue.X && i.size) {
|
|
468
398
|
for (const e of i) {
|
|
469
|
-
GlobalQueue.
|
|
399
|
+
GlobalQueue.X(e);
|
|
470
400
|
}
|
|
471
401
|
i.clear();
|
|
472
402
|
schedule();
|
|
473
403
|
}
|
|
474
404
|
for (const t of activeLanes) {
|
|
475
|
-
const n = e ? t
|
|
405
|
+
const n = e ? t.ie === e : !t.ie;
|
|
476
406
|
if (!n) continue;
|
|
477
|
-
if (!t.
|
|
478
|
-
if (t.
|
|
479
|
-
if (t.
|
|
480
|
-
}
|
|
481
|
-
if (t.t.
|
|
482
|
-
t.
|
|
483
|
-
t.
|
|
484
|
-
t.
|
|
407
|
+
if (!t.U) {
|
|
408
|
+
if (t.F[0].length) runQueue(t.F[0], EFFECT_RENDER);
|
|
409
|
+
if (t.F[1].length) runQueue(t.F[1], EFFECT_USER);
|
|
410
|
+
}
|
|
411
|
+
if (t.t.re === t) t.t.re = undefined;
|
|
412
|
+
t.W.clear();
|
|
413
|
+
t.F[0].length = 0;
|
|
414
|
+
t.F[1].length = 0;
|
|
485
415
|
activeLanes.delete(t);
|
|
486
416
|
signalLanes.delete(t.t);
|
|
487
417
|
}
|
|
488
418
|
}
|
|
489
419
|
}
|
|
490
420
|
function checkBoundaryChildren(e) {
|
|
491
|
-
for (const t of e
|
|
421
|
+
for (const t of e.$) {
|
|
492
422
|
t.checkSources?.();
|
|
493
423
|
checkBoundaryChildren(t);
|
|
494
424
|
}
|
|
495
425
|
}
|
|
496
426
|
function trackOptimisticStore(e) {
|
|
497
|
-
globalQueue.
|
|
427
|
+
globalQueue.K.add(e);
|
|
498
428
|
schedule();
|
|
499
429
|
}
|
|
500
430
|
function reassignPendingTransition(e) {
|
|
501
431
|
for (let t = 0; t < e.length; t++) {
|
|
502
|
-
e[t]
|
|
432
|
+
e[t].ie = activeTransition;
|
|
503
433
|
}
|
|
504
434
|
}
|
|
505
435
|
const globalQueue = new GlobalQueue();
|
|
@@ -512,23 +442,26 @@ function runQueue(e, t) {
|
|
|
512
442
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
513
443
|
}
|
|
514
444
|
function transitionComplete(e) {
|
|
515
|
-
if (e.
|
|
516
|
-
if (e.
|
|
445
|
+
if (e.ne) return true;
|
|
446
|
+
if (e.te.length) return false;
|
|
517
447
|
let t = true;
|
|
518
|
-
for (let n = 0; n < e.
|
|
519
|
-
const i = e.
|
|
520
|
-
if (i.
|
|
448
|
+
for (let n = 0; n < e.J.length; n++) {
|
|
449
|
+
const i = e.J[n];
|
|
450
|
+
if (i.fe & STATUS_PENDING && i.Z?.t === i) {
|
|
521
451
|
t = false;
|
|
522
452
|
break;
|
|
523
453
|
}
|
|
524
454
|
}
|
|
525
|
-
t && (e.
|
|
455
|
+
t && (e.ne = true);
|
|
526
456
|
return t;
|
|
527
457
|
}
|
|
528
458
|
function currentTransition(e) {
|
|
529
|
-
while (e.
|
|
459
|
+
while (e.ne && typeof e.ne === "object") e = e.ne;
|
|
530
460
|
return e;
|
|
531
461
|
}
|
|
462
|
+
function setActiveTransition(e) {
|
|
463
|
+
activeTransition = e;
|
|
464
|
+
}
|
|
532
465
|
function runInTransition(e, t) {
|
|
533
466
|
const n = activeTransition;
|
|
534
467
|
try {
|
|
@@ -538,196 +471,107 @@ function runInTransition(e, t) {
|
|
|
538
471
|
activeTransition = n;
|
|
539
472
|
}
|
|
540
473
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
474
|
+
const signalLanes = new WeakMap();
|
|
475
|
+
const activeLanes = new Set();
|
|
476
|
+
function getOrCreateLane(e) {
|
|
477
|
+
let t = signalLanes.get(e);
|
|
478
|
+
if (t) {
|
|
479
|
+
return findLane(t);
|
|
480
|
+
}
|
|
481
|
+
const n = e.Ee;
|
|
482
|
+
const i = n?.re ? findLane(n.re) : null;
|
|
483
|
+
t = { t: e, W: new Set(), F: [[], []], U: null, ie: activeTransition, Te: i };
|
|
484
|
+
signalLanes.set(e, t);
|
|
485
|
+
activeLanes.add(t);
|
|
486
|
+
e.de = e.Re || 0;
|
|
487
|
+
return t;
|
|
546
488
|
}
|
|
547
|
-
function
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
const r = e(...t);
|
|
551
|
-
globalQueue.initTransition();
|
|
552
|
-
let o = activeTransition;
|
|
553
|
-
o.le.push(r);
|
|
554
|
-
const done = (e, t) => {
|
|
555
|
-
o = currentTransition(o);
|
|
556
|
-
const s = o.le.indexOf(r);
|
|
557
|
-
if (s >= 0) o.le.splice(s, 1);
|
|
558
|
-
activeTransition = o;
|
|
559
|
-
schedule();
|
|
560
|
-
t ? i(t) : n(e);
|
|
561
|
-
};
|
|
562
|
-
const step = (e, t) => {
|
|
563
|
-
let n;
|
|
564
|
-
try {
|
|
565
|
-
n = t ? r.throw(e) : r.next(e);
|
|
566
|
-
} catch (e) {
|
|
567
|
-
return done(undefined, e);
|
|
568
|
-
}
|
|
569
|
-
if (n instanceof Promise)
|
|
570
|
-
return void n.then(run, e => restoreTransition(o, () => step(e, true)));
|
|
571
|
-
run(n);
|
|
572
|
-
};
|
|
573
|
-
const run = e => {
|
|
574
|
-
if (e.done) return done(e.value);
|
|
575
|
-
if (e.value instanceof Promise)
|
|
576
|
-
return void e.value.then(
|
|
577
|
-
e => restoreTransition(o, () => step(e)),
|
|
578
|
-
e => restoreTransition(o, () => step(e, true))
|
|
579
|
-
);
|
|
580
|
-
restoreTransition(o, () => step(e.value));
|
|
581
|
-
};
|
|
582
|
-
step();
|
|
583
|
-
});
|
|
489
|
+
function findLane(e) {
|
|
490
|
+
while (e.U) e = e.U;
|
|
491
|
+
return e;
|
|
584
492
|
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
const i = !!(e._ & REACTIVE_OPTIMISTIC_DIRTY);
|
|
610
|
-
const r = hasActiveOverride(e);
|
|
611
|
-
const o = !!(e.Oe & STATUS_PENDING);
|
|
612
|
-
const s = context;
|
|
613
|
-
context = e;
|
|
614
|
-
e.he = null;
|
|
615
|
-
e._ = REACTIVE_RECOMPUTING_DEPS;
|
|
616
|
-
e.ce = clock;
|
|
617
|
-
let u = e.B === NOT_PENDING ? e.Re : e.B;
|
|
618
|
-
let c = e.u;
|
|
619
|
-
let l = tracking;
|
|
620
|
-
let a = currentOptimisticLane;
|
|
621
|
-
tracking = true;
|
|
493
|
+
function mergeLanes(e, t) {
|
|
494
|
+
e = findLane(e);
|
|
495
|
+
t = findLane(t);
|
|
496
|
+
if (e === t) return e;
|
|
497
|
+
t.U = e;
|
|
498
|
+
for (const n of t.W) e.W.add(n);
|
|
499
|
+
e.F[0].push(...t.F[0]);
|
|
500
|
+
e.F[1].push(...t.F[1]);
|
|
501
|
+
return e;
|
|
502
|
+
}
|
|
503
|
+
function resolveLane(e) {
|
|
504
|
+
const t = e.re;
|
|
505
|
+
if (!t) return undefined;
|
|
506
|
+
const n = findLane(t);
|
|
507
|
+
if (activeLanes.has(n)) return n;
|
|
508
|
+
e.re = undefined;
|
|
509
|
+
return undefined;
|
|
510
|
+
}
|
|
511
|
+
function hasActiveOverride(e) {
|
|
512
|
+
return !!(e.Oe && e.le !== NOT_PENDING);
|
|
513
|
+
}
|
|
514
|
+
function assignOrMergeLane(e, t) {
|
|
515
|
+
const n = findLane(t);
|
|
516
|
+
const i = e.re;
|
|
622
517
|
if (i) {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
try {
|
|
627
|
-
u = handleAsync(e, e.U(u));
|
|
628
|
-
clearStatus(e);
|
|
629
|
-
const t = resolveLane(e);
|
|
630
|
-
if (t) {
|
|
631
|
-
t.G.delete(e);
|
|
632
|
-
updatePendingSignal(t.t);
|
|
633
|
-
}
|
|
634
|
-
} catch (t) {
|
|
635
|
-
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
636
|
-
const t = findLane(currentOptimisticLane);
|
|
637
|
-
if (t.t !== e) {
|
|
638
|
-
t.G.add(e);
|
|
639
|
-
e.W = t;
|
|
640
|
-
updatePendingSignal(t.t);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
notifyStatus(
|
|
644
|
-
e,
|
|
645
|
-
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
646
|
-
t,
|
|
647
|
-
undefined,
|
|
648
|
-
t instanceof NotReadyError ? e.W : undefined
|
|
649
|
-
);
|
|
650
|
-
} finally {
|
|
651
|
-
tracking = l;
|
|
652
|
-
e._ = REACTIVE_NONE;
|
|
653
|
-
context = s;
|
|
654
|
-
}
|
|
655
|
-
if (!e.se) {
|
|
656
|
-
const s = e.he;
|
|
657
|
-
let l = s !== null ? s.m : e.D;
|
|
658
|
-
if (l !== null) {
|
|
659
|
-
do {
|
|
660
|
-
l = unlinkSubs(l);
|
|
661
|
-
} while (l !== null);
|
|
662
|
-
if (s !== null) s.m = null;
|
|
663
|
-
else e.D = null;
|
|
518
|
+
if (i.U) {
|
|
519
|
+
e.re = t;
|
|
520
|
+
return;
|
|
664
521
|
}
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
const t = e.K || 0;
|
|
673
|
-
const n = e.j || 0;
|
|
674
|
-
if (t <= n) e.Re = u;
|
|
675
|
-
}
|
|
676
|
-
if (!r || i || e.Re !== s) {
|
|
677
|
-
insertSubs(e, i || r);
|
|
678
|
-
}
|
|
679
|
-
} else if (r) {
|
|
680
|
-
e.B = u;
|
|
681
|
-
} else if (e.u != c) {
|
|
682
|
-
for (let t = e.p; t !== null; t = t.h) {
|
|
683
|
-
insertIntoHeapHeight(t.A, t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
522
|
+
const r = findLane(i);
|
|
523
|
+
if (activeLanes.has(r)) {
|
|
524
|
+
if (r !== n && !hasActiveOverride(e)) {
|
|
525
|
+
if (n.Te && findLane(n.Te) === r) {
|
|
526
|
+
e.re = t;
|
|
527
|
+
} else if (r.Te && findLane(r.Te) === n);
|
|
528
|
+
else mergeLanes(n, r);
|
|
684
529
|
}
|
|
530
|
+
return;
|
|
685
531
|
}
|
|
686
532
|
}
|
|
687
|
-
|
|
688
|
-
(!t || e.Oe & STATUS_PENDING) && !e.$ && !(activeTransition && e.Y) && globalQueue.J.push(e);
|
|
689
|
-
e.$ && n && activeTransition !== e.$ && runInTransition(e.$, () => recompute(e));
|
|
533
|
+
e.re = t;
|
|
690
534
|
}
|
|
691
535
|
function handleAsync(e, t, n) {
|
|
692
536
|
const i = typeof t === "object" && t !== null;
|
|
693
537
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
694
538
|
const o = !r && i && untrack(() => typeof t.then === "function");
|
|
695
539
|
if (!o && !r) {
|
|
696
|
-
e.
|
|
540
|
+
e.Se = null;
|
|
697
541
|
return t;
|
|
698
542
|
}
|
|
699
|
-
e.
|
|
543
|
+
e.Se = t;
|
|
700
544
|
let s;
|
|
701
545
|
const handleError = n => {
|
|
702
|
-
if (e.
|
|
703
|
-
globalQueue.initTransition(e
|
|
546
|
+
if (e.Se !== t) return;
|
|
547
|
+
globalQueue.initTransition(e.ie);
|
|
704
548
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
705
|
-
e.
|
|
549
|
+
e.ee = clock;
|
|
706
550
|
};
|
|
707
551
|
const asyncWrite = (i, r) => {
|
|
708
|
-
if (e.
|
|
552
|
+
if (e.Se !== t) return;
|
|
709
553
|
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
710
|
-
globalQueue.initTransition(e
|
|
554
|
+
globalQueue.initTransition(e.ie);
|
|
711
555
|
clearStatus(e);
|
|
712
556
|
const o = resolveLane(e);
|
|
713
|
-
if (o) o.
|
|
557
|
+
if (o) o.W.delete(e);
|
|
714
558
|
if (n) n(i);
|
|
715
|
-
else if (e.
|
|
716
|
-
const t = e.
|
|
717
|
-
if (e.
|
|
559
|
+
else if (e.Oe) {
|
|
560
|
+
const t = e.le !== NOT_PENDING;
|
|
561
|
+
if (e.k) e.le = i;
|
|
718
562
|
if (!t) {
|
|
719
|
-
e.
|
|
563
|
+
e.ae = i;
|
|
720
564
|
insertSubs(e);
|
|
721
565
|
}
|
|
722
|
-
e.
|
|
566
|
+
e.ee = clock;
|
|
723
567
|
} else if (o) {
|
|
724
|
-
const t = e.
|
|
725
|
-
const n = e.
|
|
568
|
+
const t = e.ae;
|
|
569
|
+
const n = e._e;
|
|
726
570
|
if (!n || !n(i, t)) {
|
|
727
|
-
e.
|
|
728
|
-
e.
|
|
729
|
-
if (e.
|
|
730
|
-
setSignal(e.
|
|
571
|
+
e.ae = i;
|
|
572
|
+
e.ee = clock;
|
|
573
|
+
if (e.Ie) {
|
|
574
|
+
setSignal(e.Ie, i);
|
|
731
575
|
}
|
|
732
576
|
insertSubs(e, true);
|
|
733
577
|
}
|
|
@@ -754,7 +598,7 @@ function handleAsync(e, t, n) {
|
|
|
754
598
|
);
|
|
755
599
|
i = false;
|
|
756
600
|
if (!n) {
|
|
757
|
-
globalQueue.initTransition(e
|
|
601
|
+
globalQueue.initTransition(e.ie);
|
|
758
602
|
throw new NotReadyError(context);
|
|
759
603
|
}
|
|
760
604
|
}
|
|
@@ -786,27 +630,27 @@ function handleAsync(e, t, n) {
|
|
|
786
630
|
};
|
|
787
631
|
const r = iterate();
|
|
788
632
|
if (!i && !r) {
|
|
789
|
-
globalQueue.initTransition(e
|
|
633
|
+
globalQueue.initTransition(e.ie);
|
|
790
634
|
throw new NotReadyError(context);
|
|
791
635
|
}
|
|
792
636
|
}
|
|
793
637
|
return s;
|
|
794
638
|
}
|
|
795
639
|
function clearStatus(e) {
|
|
796
|
-
e.
|
|
797
|
-
e.
|
|
640
|
+
e.fe = e.fe & STATUS_UNINITIALIZED;
|
|
641
|
+
e.Z = null;
|
|
798
642
|
updatePendingSignal(e);
|
|
799
|
-
e.
|
|
643
|
+
e.pe?.();
|
|
800
644
|
}
|
|
801
645
|
function notifyStatus(e, t, n, i, r) {
|
|
802
646
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
803
647
|
n = new StatusError(e, n);
|
|
804
648
|
const o = n instanceof NotReadyError && n.t === e;
|
|
805
|
-
const s = t === STATUS_PENDING && e.
|
|
649
|
+
const s = t === STATUS_PENDING && e.Oe && !o;
|
|
806
650
|
const u = s && hasActiveOverride(e);
|
|
807
651
|
if (!i) {
|
|
808
|
-
e.
|
|
809
|
-
e.
|
|
652
|
+
e.fe = t | (t !== STATUS_ERROR ? e.fe & STATUS_UNINITIALIZED : 0);
|
|
653
|
+
e.Z = n;
|
|
810
654
|
updatePendingSignal(e);
|
|
811
655
|
}
|
|
812
656
|
if (r && !i) {
|
|
@@ -814,68 +658,249 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
814
658
|
}
|
|
815
659
|
if (u && activeTransition && n instanceof NotReadyError) {
|
|
816
660
|
const e = n.t;
|
|
817
|
-
if (!activeTransition.
|
|
818
|
-
activeTransition.
|
|
661
|
+
if (!activeTransition.J.includes(e)) {
|
|
662
|
+
activeTransition.J.push(e);
|
|
819
663
|
}
|
|
820
664
|
}
|
|
821
665
|
const c = i || u;
|
|
822
666
|
const l = i || s ? undefined : r;
|
|
823
|
-
if (e.
|
|
667
|
+
if (e.pe) {
|
|
824
668
|
if (c) {
|
|
825
|
-
e.
|
|
669
|
+
e.pe(t, n);
|
|
826
670
|
} else {
|
|
827
|
-
e.
|
|
671
|
+
e.pe();
|
|
828
672
|
}
|
|
829
673
|
return;
|
|
830
674
|
}
|
|
831
675
|
for (let i = e.p; i !== null; i = i.h) {
|
|
832
|
-
i.A.
|
|
833
|
-
if (i.A.
|
|
834
|
-
!i.A
|
|
676
|
+
i.A.ee = clock;
|
|
677
|
+
if (i.A.Z !== n) {
|
|
678
|
+
!i.A.ie && globalQueue.H.push(i.A);
|
|
835
679
|
notifyStatus(i.A, t, n, c, l);
|
|
836
680
|
}
|
|
837
681
|
}
|
|
838
|
-
for (let i = e.
|
|
682
|
+
for (let i = e.P; i !== null; i = i.C) {
|
|
839
683
|
for (let e = i.p; e !== null; e = e.h) {
|
|
840
|
-
e.A.
|
|
841
|
-
if (e.A.
|
|
842
|
-
!e.A
|
|
684
|
+
e.A.ee = clock;
|
|
685
|
+
if (e.A.Z !== n) {
|
|
686
|
+
!e.A.ie && globalQueue.H.push(e.A);
|
|
843
687
|
notifyStatus(e.A, t, n, c, l);
|
|
844
688
|
}
|
|
845
689
|
}
|
|
846
690
|
}
|
|
847
691
|
}
|
|
848
|
-
function
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
692
|
+
function effect(e, t, n, i, r) {
|
|
693
|
+
let o = false;
|
|
694
|
+
const s = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
695
|
+
...r,
|
|
696
|
+
equals: () => {
|
|
697
|
+
s.se = !s.Z;
|
|
698
|
+
if (o) s.ue.enqueue(s.oe, runEffect.bind(s));
|
|
699
|
+
return false;
|
|
700
|
+
},
|
|
701
|
+
lazy: true
|
|
702
|
+
});
|
|
703
|
+
s.he = i;
|
|
704
|
+
s.Ae = t;
|
|
705
|
+
s.ge = n;
|
|
706
|
+
s.Pe = undefined;
|
|
707
|
+
s.oe = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
708
|
+
s.pe = (e, t) => {
|
|
709
|
+
const n = e !== undefined ? e : s.fe;
|
|
710
|
+
const i = t !== undefined ? t : s.Z;
|
|
711
|
+
if (n & STATUS_ERROR) {
|
|
712
|
+
let e = i;
|
|
713
|
+
s.ue.notify(s, STATUS_PENDING, 0);
|
|
714
|
+
if (s.oe === EFFECT_USER) {
|
|
715
|
+
try {
|
|
716
|
+
return s.ge
|
|
717
|
+
? s.ge(e, () => {
|
|
718
|
+
s.Pe?.();
|
|
719
|
+
s.Pe = undefined;
|
|
720
|
+
})
|
|
721
|
+
: console.error(e);
|
|
722
|
+
} catch (t) {
|
|
723
|
+
e = t;
|
|
724
|
+
}
|
|
855
725
|
}
|
|
856
|
-
if (
|
|
857
|
-
|
|
726
|
+
if (!s.ue.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
727
|
+
} else if (s.oe === EFFECT_RENDER) s.ue.notify(s, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
728
|
+
};
|
|
729
|
+
recompute(s, true);
|
|
730
|
+
!r?.defer && (s.oe === EFFECT_USER ? s.ue.enqueue(s.oe, runEffect.bind(s)) : runEffect.call(s));
|
|
731
|
+
o = true;
|
|
732
|
+
onCleanup(() => s.Pe?.());
|
|
733
|
+
}
|
|
734
|
+
function runEffect() {
|
|
735
|
+
if (!this.se || this._ & REACTIVE_DISPOSED) return;
|
|
736
|
+
this.Pe?.();
|
|
737
|
+
this.Pe = undefined;
|
|
738
|
+
try {
|
|
739
|
+
this.Pe = this.Ae(this.ae, this.he);
|
|
740
|
+
} catch (e) {
|
|
741
|
+
if (!this.ue.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
742
|
+
} finally {
|
|
743
|
+
this.he = this.ae;
|
|
744
|
+
this.se = false;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
function trackedEffect(e, t) {
|
|
748
|
+
const run = () => {
|
|
749
|
+
if (!n.se || n._ & REACTIVE_DISPOSED) return;
|
|
750
|
+
n.se = false;
|
|
751
|
+
recompute(n);
|
|
752
|
+
};
|
|
753
|
+
const n = computed(
|
|
754
|
+
() => {
|
|
755
|
+
try {
|
|
756
|
+
n.Pe?.();
|
|
757
|
+
n.Pe = undefined;
|
|
758
|
+
n.Pe = staleValues(e) || undefined;
|
|
759
|
+
} finally {
|
|
858
760
|
}
|
|
761
|
+
},
|
|
762
|
+
undefined,
|
|
763
|
+
{ ...t, lazy: true, pureWrite: true }
|
|
764
|
+
);
|
|
765
|
+
n.Pe = undefined;
|
|
766
|
+
n.se = true;
|
|
767
|
+
n.oe = EFFECT_TRACKED;
|
|
768
|
+
n.ce = run;
|
|
769
|
+
n.ue.enqueue(EFFECT_USER, run);
|
|
770
|
+
onCleanup(() => n.Pe?.());
|
|
771
|
+
}
|
|
772
|
+
const PENDING_OWNER = {};
|
|
773
|
+
function markDisposal(e) {
|
|
774
|
+
let t = e.Ce;
|
|
775
|
+
while (t) {
|
|
776
|
+
t._ |= REACTIVE_ZOMBIE;
|
|
777
|
+
if (t._ & REACTIVE_IN_HEAP) {
|
|
778
|
+
deleteFromHeap(t, dirtyQueue);
|
|
779
|
+
insertIntoHeap(t, zombieQueue);
|
|
859
780
|
}
|
|
781
|
+
markDisposal(t);
|
|
782
|
+
t = t.Ne;
|
|
860
783
|
}
|
|
861
|
-
|
|
862
|
-
|
|
784
|
+
}
|
|
785
|
+
function dispose(e) {
|
|
786
|
+
let t = e.D || null;
|
|
787
|
+
do {
|
|
788
|
+
t = unlinkSubs(t);
|
|
789
|
+
} while (t !== null);
|
|
790
|
+
e.D = null;
|
|
791
|
+
e.ye = null;
|
|
792
|
+
disposeChildren(e, true);
|
|
793
|
+
}
|
|
794
|
+
function disposeChildren(e, t = false, n) {
|
|
795
|
+
if (e._ & REACTIVE_DISPOSED) return;
|
|
796
|
+
if (t) e._ = REACTIVE_DISPOSED;
|
|
797
|
+
let i = n ? e.De : e.Ce;
|
|
798
|
+
while (i) {
|
|
799
|
+
const e = i.Ne;
|
|
800
|
+
if (i.D) {
|
|
801
|
+
const e = i;
|
|
802
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
803
|
+
let t = e.D;
|
|
804
|
+
do {
|
|
805
|
+
t = unlinkSubs(t);
|
|
806
|
+
} while (t !== null);
|
|
807
|
+
e.D = null;
|
|
808
|
+
e.ye = null;
|
|
809
|
+
}
|
|
810
|
+
disposeChildren(i, true);
|
|
811
|
+
i = e;
|
|
863
812
|
}
|
|
864
|
-
|
|
813
|
+
if (n) {
|
|
814
|
+
e.De = null;
|
|
815
|
+
} else {
|
|
816
|
+
e.Ce = null;
|
|
817
|
+
e.Ne = null;
|
|
818
|
+
}
|
|
819
|
+
runDisposal(e, n);
|
|
820
|
+
}
|
|
821
|
+
function runDisposal(e, t) {
|
|
822
|
+
let n = t ? e.ve : e.we;
|
|
823
|
+
if (!n) return;
|
|
824
|
+
if (Array.isArray(n)) {
|
|
825
|
+
for (let e = 0; e < n.length; e++) {
|
|
826
|
+
const t = n[e];
|
|
827
|
+
t.call(t);
|
|
828
|
+
}
|
|
829
|
+
} else {
|
|
830
|
+
n.call(n);
|
|
831
|
+
}
|
|
832
|
+
t ? (e.ve = null) : (e.we = null);
|
|
833
|
+
}
|
|
834
|
+
function getNextChildId(e) {
|
|
835
|
+
if (e.id != null) return formatId(e.id, e.be++);
|
|
836
|
+
throw new Error("Cannot get child id from owner without an id");
|
|
837
|
+
}
|
|
838
|
+
function formatId(e, t) {
|
|
839
|
+
const n = t.toString(36),
|
|
840
|
+
i = n.length - 1;
|
|
841
|
+
return e + (i ? String.fromCharCode(64 + i) : "") + n;
|
|
842
|
+
}
|
|
843
|
+
function getObserver() {
|
|
844
|
+
if (pendingCheckActive || pendingReadActive) return PENDING_OWNER;
|
|
845
|
+
return tracking ? context : null;
|
|
846
|
+
}
|
|
847
|
+
function getOwner() {
|
|
848
|
+
return context;
|
|
849
|
+
}
|
|
850
|
+
function onCleanup(e) {
|
|
851
|
+
if (!context) return e;
|
|
852
|
+
if (!context.we) context.we = e;
|
|
853
|
+
else if (Array.isArray(context.we)) context.we.push(e);
|
|
854
|
+
else context.we = [context.we, e];
|
|
855
|
+
return e;
|
|
856
|
+
}
|
|
857
|
+
function createOwner(e) {
|
|
858
|
+
const t = context;
|
|
859
|
+
const n = {
|
|
860
|
+
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
861
|
+
i: true,
|
|
862
|
+
l: t?.i ? t.l : t,
|
|
863
|
+
Ce: null,
|
|
864
|
+
Ne: null,
|
|
865
|
+
we: null,
|
|
866
|
+
ue: t?.ue ?? globalQueue,
|
|
867
|
+
Ve: t?.Ve || defaultContext,
|
|
868
|
+
be: 0,
|
|
869
|
+
ve: null,
|
|
870
|
+
De: null,
|
|
871
|
+
o: t,
|
|
872
|
+
dispose(e = true) {
|
|
873
|
+
disposeChildren(n, e);
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
if (t) {
|
|
877
|
+
const e = t.Ce;
|
|
878
|
+
if (e === null) {
|
|
879
|
+
t.Ce = n;
|
|
880
|
+
} else {
|
|
881
|
+
n.Ne = e;
|
|
882
|
+
t.Ce = n;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
return n;
|
|
886
|
+
}
|
|
887
|
+
function createRoot(e, t) {
|
|
888
|
+
const n = createOwner(t);
|
|
889
|
+
return runWithOwner(n, () => e(n.dispose));
|
|
865
890
|
}
|
|
866
891
|
function unlinkSubs(e) {
|
|
867
|
-
const t = e.
|
|
868
|
-
const n = e.
|
|
892
|
+
const t = e.m;
|
|
893
|
+
const n = e.V;
|
|
869
894
|
const i = e.h;
|
|
870
|
-
const r = e.
|
|
871
|
-
if (i !== null) i.
|
|
872
|
-
else t.
|
|
895
|
+
const r = e.me;
|
|
896
|
+
if (i !== null) i.me = r;
|
|
897
|
+
else t.Le = r;
|
|
873
898
|
if (r !== null) r.h = i;
|
|
874
899
|
else {
|
|
875
900
|
t.p = i;
|
|
876
901
|
if (i === null) {
|
|
877
|
-
t.
|
|
878
|
-
t.
|
|
902
|
+
t.ke?.();
|
|
903
|
+
t.k && !t.Ue && unobserved(t);
|
|
879
904
|
}
|
|
880
905
|
}
|
|
881
906
|
return n;
|
|
@@ -890,148 +915,203 @@ function unobserved(e) {
|
|
|
890
915
|
disposeChildren(e, true);
|
|
891
916
|
}
|
|
892
917
|
function link(e, t) {
|
|
893
|
-
const n = t.
|
|
894
|
-
if (n !== null && n.
|
|
918
|
+
const n = t.ye;
|
|
919
|
+
if (n !== null && n.m === e) return;
|
|
895
920
|
let i = null;
|
|
896
921
|
const r = t._ & REACTIVE_RECOMPUTING_DEPS;
|
|
897
922
|
if (r) {
|
|
898
|
-
i = n !== null ? n.
|
|
899
|
-
if (i !== null && i.
|
|
900
|
-
t.
|
|
923
|
+
i = n !== null ? n.V : t.D;
|
|
924
|
+
if (i !== null && i.m === e) {
|
|
925
|
+
t.ye = i;
|
|
901
926
|
return;
|
|
902
927
|
}
|
|
903
928
|
}
|
|
904
|
-
const o = e.
|
|
929
|
+
const o = e.Le;
|
|
905
930
|
if (o !== null && o.A === t && (!r || isValidLink(o, t))) return;
|
|
906
|
-
const s = (t.
|
|
907
|
-
if (n !== null) n.
|
|
931
|
+
const s = (t.ye = e.Le = { m: e, A: t, V: i, me: o, h: null });
|
|
932
|
+
if (n !== null) n.V = s;
|
|
908
933
|
else t.D = s;
|
|
909
934
|
if (o !== null) o.h = s;
|
|
910
935
|
else e.p = s;
|
|
911
936
|
}
|
|
912
937
|
function isValidLink(e, t) {
|
|
913
|
-
const n = t.
|
|
938
|
+
const n = t.ye;
|
|
914
939
|
if (n !== null) {
|
|
915
940
|
let i = t.D;
|
|
916
941
|
do {
|
|
917
942
|
if (i === e) return true;
|
|
918
943
|
if (i === n) break;
|
|
919
|
-
i = i.
|
|
944
|
+
i = i.V;
|
|
920
945
|
} while (i !== null);
|
|
921
946
|
}
|
|
922
947
|
return false;
|
|
923
948
|
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
949
|
+
GlobalQueue.Y = recompute;
|
|
950
|
+
GlobalQueue.B = disposeChildren;
|
|
951
|
+
let tracking = false;
|
|
952
|
+
let stale = false;
|
|
953
|
+
let refreshing = false;
|
|
954
|
+
let pendingCheckActive = false;
|
|
955
|
+
let foundPending = false;
|
|
956
|
+
let pendingReadActive = false;
|
|
957
|
+
let context = null;
|
|
958
|
+
let currentOptimisticLane = null;
|
|
959
|
+
function recompute(e, t = false) {
|
|
960
|
+
const n = e.oe;
|
|
961
|
+
if (!t) {
|
|
962
|
+
if (e.ie && (!n || activeTransition) && activeTransition !== e.ie)
|
|
963
|
+
globalQueue.initTransition(e.ie);
|
|
964
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
965
|
+
if (e.ie || n === EFFECT_TRACKED) disposeChildren(e);
|
|
966
|
+
else {
|
|
967
|
+
markDisposal(e);
|
|
968
|
+
e.ve = e.we;
|
|
969
|
+
e.De = e.Ce;
|
|
970
|
+
e.we = null;
|
|
971
|
+
e.Ce = null;
|
|
931
972
|
}
|
|
932
|
-
markDisposal(t);
|
|
933
|
-
t = t.we;
|
|
934
973
|
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
e.
|
|
942
|
-
e.
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
974
|
+
const i = !!(e._ & REACTIVE_OPTIMISTIC_DIRTY);
|
|
975
|
+
const r = hasActiveOverride(e);
|
|
976
|
+
const o = !!(e.fe & STATUS_PENDING);
|
|
977
|
+
const s = context;
|
|
978
|
+
context = e;
|
|
979
|
+
e.ye = null;
|
|
980
|
+
e._ = REACTIVE_RECOMPUTING_DEPS;
|
|
981
|
+
e.ee = clock;
|
|
982
|
+
let u = e.le === NOT_PENDING ? e.ae : e.le;
|
|
983
|
+
let c = e.u;
|
|
984
|
+
let l = tracking;
|
|
985
|
+
let a = currentOptimisticLane;
|
|
986
|
+
tracking = true;
|
|
987
|
+
if (i) {
|
|
988
|
+
const t = resolveLane(e);
|
|
989
|
+
if (t) currentOptimisticLane = t;
|
|
990
|
+
}
|
|
991
|
+
try {
|
|
992
|
+
u = handleAsync(e, e.k(u));
|
|
993
|
+
clearStatus(e);
|
|
994
|
+
const t = resolveLane(e);
|
|
995
|
+
if (t) {
|
|
996
|
+
t.W.delete(e);
|
|
997
|
+
updatePendingSignal(t.t);
|
|
998
|
+
}
|
|
999
|
+
} catch (t) {
|
|
1000
|
+
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
1001
|
+
const t = findLane(currentOptimisticLane);
|
|
1002
|
+
if (t.t !== e) {
|
|
1003
|
+
t.W.add(e);
|
|
1004
|
+
e.re = t;
|
|
1005
|
+
updatePendingSignal(t.t);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
notifyStatus(
|
|
1009
|
+
e,
|
|
1010
|
+
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
1011
|
+
t,
|
|
1012
|
+
undefined,
|
|
1013
|
+
t instanceof NotReadyError ? e.re : undefined
|
|
1014
|
+
);
|
|
1015
|
+
} finally {
|
|
1016
|
+
tracking = l;
|
|
1017
|
+
e._ = REACTIVE_NONE;
|
|
1018
|
+
context = s;
|
|
1019
|
+
}
|
|
1020
|
+
if (!e.Z) {
|
|
1021
|
+
const s = e.ye;
|
|
1022
|
+
let l = s !== null ? s.V : e.D;
|
|
1023
|
+
if (l !== null) {
|
|
955
1024
|
do {
|
|
956
|
-
|
|
957
|
-
} while (
|
|
958
|
-
|
|
959
|
-
e.
|
|
1025
|
+
l = unlinkSubs(l);
|
|
1026
|
+
} while (l !== null);
|
|
1027
|
+
if (s !== null) s.V = null;
|
|
1028
|
+
else e.D = null;
|
|
1029
|
+
}
|
|
1030
|
+
const a = r ? e.ae : e.le === NOT_PENDING ? e.ae : e.le;
|
|
1031
|
+
const f = !e._e || !e._e(a, u);
|
|
1032
|
+
if (f) {
|
|
1033
|
+
const s = r ? e.ae : undefined;
|
|
1034
|
+
if (t || (n && activeTransition !== e.ie) || i) e.ae = u;
|
|
1035
|
+
else e.le = u;
|
|
1036
|
+
if (r && !i && o) {
|
|
1037
|
+
const t = e.Re || 0;
|
|
1038
|
+
const n = e.de || 0;
|
|
1039
|
+
if (t <= n) e.ae = u;
|
|
1040
|
+
}
|
|
1041
|
+
if (!r || i || e.ae !== s) {
|
|
1042
|
+
insertSubs(e, i || r);
|
|
1043
|
+
}
|
|
1044
|
+
} else if (r) {
|
|
1045
|
+
e.le = u;
|
|
1046
|
+
} else if (e.u != c) {
|
|
1047
|
+
for (let t = e.p; t !== null; t = t.h) {
|
|
1048
|
+
insertIntoHeapHeight(t.A, t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1049
|
+
}
|
|
960
1050
|
}
|
|
961
|
-
disposeChildren(i, true);
|
|
962
|
-
i = e;
|
|
963
|
-
}
|
|
964
|
-
if (n) {
|
|
965
|
-
e.Ie = null;
|
|
966
|
-
} else {
|
|
967
|
-
e.pe = null;
|
|
968
|
-
e.we = null;
|
|
969
1051
|
}
|
|
970
|
-
|
|
1052
|
+
currentOptimisticLane = a;
|
|
1053
|
+
(!t || e.fe & STATUS_PENDING) && !e.ie && !(activeTransition && e.Oe) && globalQueue.H.push(e);
|
|
1054
|
+
e.ie && n && activeTransition !== e.ie && runInTransition(e.ie, () => recompute(e));
|
|
971
1055
|
}
|
|
972
|
-
function
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
1056
|
+
function updateIfNecessary(e) {
|
|
1057
|
+
if (e._ & REACTIVE_CHECK) {
|
|
1058
|
+
for (let t = e.D; t; t = t.V) {
|
|
1059
|
+
const n = t.m;
|
|
1060
|
+
const i = n.L || n;
|
|
1061
|
+
if (i.k) {
|
|
1062
|
+
updateIfNecessary(i);
|
|
1063
|
+
}
|
|
1064
|
+
if (e._ & REACTIVE_DIRTY) {
|
|
1065
|
+
break;
|
|
1066
|
+
}
|
|
979
1067
|
}
|
|
980
|
-
} else {
|
|
981
|
-
n.call(n);
|
|
982
1068
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
throw new Error("Cannot get child id from owner without an id");
|
|
988
|
-
}
|
|
989
|
-
function formatId(e, t) {
|
|
990
|
-
const n = t.toString(36),
|
|
991
|
-
i = n.length - 1;
|
|
992
|
-
return e + (i ? String.fromCharCode(64 + i) : "") + n;
|
|
1069
|
+
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.Z && e.ee < clock)) {
|
|
1070
|
+
recompute(e);
|
|
1071
|
+
}
|
|
1072
|
+
e._ = REACTIVE_NONE;
|
|
993
1073
|
}
|
|
994
1074
|
function computed(e, t, n) {
|
|
995
1075
|
const i = {
|
|
996
1076
|
id: n?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1077
|
+
_e: n?.equals != null ? n.equals : isEqual,
|
|
1078
|
+
We: !!n?.pureWrite,
|
|
1079
|
+
ke: n?.unobserved,
|
|
1080
|
+
we: null,
|
|
1081
|
+
ue: context?.ue ?? globalQueue,
|
|
1002
1082
|
Ve: context?.Ve ?? defaultContext,
|
|
1003
1083
|
be: 0,
|
|
1004
|
-
|
|
1005
|
-
|
|
1084
|
+
k: e,
|
|
1085
|
+
ae: t,
|
|
1006
1086
|
u: 0,
|
|
1007
|
-
|
|
1087
|
+
P: null,
|
|
1008
1088
|
O: undefined,
|
|
1009
1089
|
R: null,
|
|
1010
1090
|
D: null,
|
|
1011
|
-
he: null,
|
|
1012
|
-
p: null,
|
|
1013
1091
|
ye: null,
|
|
1092
|
+
p: null,
|
|
1093
|
+
Le: null,
|
|
1014
1094
|
o: context,
|
|
1015
|
-
|
|
1016
|
-
|
|
1095
|
+
Ne: null,
|
|
1096
|
+
Ce: null,
|
|
1017
1097
|
_: REACTIVE_NONE,
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1098
|
+
fe: STATUS_UNINITIALIZED,
|
|
1099
|
+
ee: clock,
|
|
1100
|
+
le: NOT_PENDING,
|
|
1101
|
+
ve: null,
|
|
1102
|
+
De: null,
|
|
1021
1103
|
Se: null,
|
|
1022
|
-
|
|
1023
|
-
ge: null,
|
|
1024
|
-
$: null
|
|
1104
|
+
ie: null
|
|
1025
1105
|
};
|
|
1026
1106
|
i.R = i;
|
|
1027
1107
|
const r = context?.i ? context.l : context;
|
|
1028
1108
|
if (context) {
|
|
1029
|
-
const e = context.
|
|
1109
|
+
const e = context.Ce;
|
|
1030
1110
|
if (e === null) {
|
|
1031
|
-
context.
|
|
1111
|
+
context.Ce = i;
|
|
1032
1112
|
} else {
|
|
1033
|
-
i.
|
|
1034
|
-
context.
|
|
1113
|
+
i.Ne = e;
|
|
1114
|
+
context.Ce = i;
|
|
1035
1115
|
}
|
|
1036
1116
|
}
|
|
1037
1117
|
if (r) i.u = r.u + 1;
|
|
@@ -1040,87 +1120,30 @@ function computed(e, t, n) {
|
|
|
1040
1120
|
}
|
|
1041
1121
|
function signal(e, t, n = null) {
|
|
1042
1122
|
const i = {
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1123
|
+
_e: t?.equals != null ? t.equals : isEqual,
|
|
1124
|
+
We: !!t?.pureWrite,
|
|
1125
|
+
ke: t?.unobserved,
|
|
1126
|
+
ae: e,
|
|
1047
1127
|
p: null,
|
|
1048
|
-
|
|
1049
|
-
|
|
1128
|
+
Le: null,
|
|
1129
|
+
ee: clock,
|
|
1050
1130
|
L: n,
|
|
1051
|
-
|
|
1052
|
-
|
|
1131
|
+
C: n?.P || null,
|
|
1132
|
+
le: NOT_PENDING
|
|
1053
1133
|
};
|
|
1054
|
-
n && (n.
|
|
1134
|
+
n && (n.P = i);
|
|
1055
1135
|
return i;
|
|
1056
1136
|
}
|
|
1057
1137
|
function optimisticSignal(e, t) {
|
|
1058
1138
|
const n = signal(e, t);
|
|
1059
|
-
n.
|
|
1139
|
+
n.Oe = true;
|
|
1060
1140
|
return n;
|
|
1061
1141
|
}
|
|
1062
1142
|
function optimisticComputed(e, t, n) {
|
|
1063
1143
|
const i = computed(e, t, n);
|
|
1064
|
-
i.
|
|
1144
|
+
i.Oe = true;
|
|
1065
1145
|
return i;
|
|
1066
1146
|
}
|
|
1067
|
-
function getPendingSignal(e) {
|
|
1068
|
-
if (!e.Le) {
|
|
1069
|
-
e.Le = optimisticSignal(false, { pureWrite: true });
|
|
1070
|
-
if (e.k) {
|
|
1071
|
-
e.Le.k = e;
|
|
1072
|
-
}
|
|
1073
|
-
if (computePendingState(e)) setSignal(e.Le, true);
|
|
1074
|
-
}
|
|
1075
|
-
return e.Le;
|
|
1076
|
-
}
|
|
1077
|
-
function computePendingState(e) {
|
|
1078
|
-
const t = e;
|
|
1079
|
-
if (e.Y && e.B !== NOT_PENDING) {
|
|
1080
|
-
if (t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
|
|
1081
|
-
if (e.k) {
|
|
1082
|
-
const t = e.W ? findLane(e.W) : null;
|
|
1083
|
-
return !!(t && t.G.size > 0);
|
|
1084
|
-
}
|
|
1085
|
-
return true;
|
|
1086
|
-
}
|
|
1087
|
-
if (e.B !== NOT_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
|
|
1088
|
-
return !!(t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED));
|
|
1089
|
-
}
|
|
1090
|
-
function getPendingValueComputed(e) {
|
|
1091
|
-
if (!e.Ne) {
|
|
1092
|
-
const t = pendingReadActive;
|
|
1093
|
-
pendingReadActive = false;
|
|
1094
|
-
const n = pendingCheckActive;
|
|
1095
|
-
pendingCheckActive = false;
|
|
1096
|
-
const i = context;
|
|
1097
|
-
context = null;
|
|
1098
|
-
e.Ne = optimisticComputed(() => read(e));
|
|
1099
|
-
e.Ne.k = e;
|
|
1100
|
-
context = i;
|
|
1101
|
-
pendingCheckActive = n;
|
|
1102
|
-
pendingReadActive = t;
|
|
1103
|
-
}
|
|
1104
|
-
return e.Ne;
|
|
1105
|
-
}
|
|
1106
|
-
function updatePendingSignal(e) {
|
|
1107
|
-
if (e.Le) {
|
|
1108
|
-
const t = computePendingState(e);
|
|
1109
|
-
const n = e.Le;
|
|
1110
|
-
setSignal(n, t);
|
|
1111
|
-
if (!t && n.W) {
|
|
1112
|
-
const t = resolveLane(e);
|
|
1113
|
-
if (t && t.G.size > 0) {
|
|
1114
|
-
const e = findLane(n.W);
|
|
1115
|
-
if (e !== t) {
|
|
1116
|
-
mergeLanes(t, e);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
clearLaneEntry(n);
|
|
1120
|
-
n.W = undefined;
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
1147
|
function isEqual(e, t) {
|
|
1125
1148
|
return e === t;
|
|
1126
1149
|
}
|
|
@@ -1140,12 +1163,12 @@ function read(e) {
|
|
|
1140
1163
|
pendingReadActive = false;
|
|
1141
1164
|
const i = read(t);
|
|
1142
1165
|
pendingReadActive = n;
|
|
1143
|
-
if (t.
|
|
1144
|
-
if (stale && currentOptimisticLane && t.
|
|
1145
|
-
const n = findLane(t.
|
|
1166
|
+
if (t.fe & STATUS_PENDING) return e.ae;
|
|
1167
|
+
if (stale && currentOptimisticLane && t.re) {
|
|
1168
|
+
const n = findLane(t.re);
|
|
1146
1169
|
const i = findLane(currentOptimisticLane);
|
|
1147
|
-
if (n !== i && n.
|
|
1148
|
-
return e.
|
|
1170
|
+
if (n !== i && n.W.size > 0) {
|
|
1171
|
+
return e.ae;
|
|
1149
1172
|
}
|
|
1150
1173
|
}
|
|
1151
1174
|
return i;
|
|
@@ -1159,18 +1182,18 @@ function read(e) {
|
|
|
1159
1182
|
foundPending = true;
|
|
1160
1183
|
}
|
|
1161
1184
|
pendingCheckActive = i;
|
|
1162
|
-
return e.
|
|
1185
|
+
return e.ae;
|
|
1163
1186
|
}
|
|
1164
1187
|
let t = context;
|
|
1165
1188
|
if (t?.i) t = t.l;
|
|
1166
|
-
if (refreshing && e.
|
|
1189
|
+
if (refreshing && e.k) recompute(e);
|
|
1167
1190
|
if (t && tracking) {
|
|
1168
|
-
if (e.
|
|
1191
|
+
if (e.k && e._ & REACTIVE_DISPOSED) recompute(e);
|
|
1169
1192
|
link(e, t);
|
|
1170
1193
|
const n = e.L || e;
|
|
1171
|
-
if (n.
|
|
1194
|
+
if (n.k) {
|
|
1172
1195
|
const i = e._ & REACTIVE_ZOMBIE;
|
|
1173
|
-
if (n.u >= (i ? zombieQueue.
|
|
1196
|
+
if (n.u >= (i ? zombieQueue.N : dirtyQueue.N)) {
|
|
1174
1197
|
markNode(t);
|
|
1175
1198
|
markHeap(i ? zombieQueue : dirtyQueue);
|
|
1176
1199
|
updateIfNecessary(n);
|
|
@@ -1182,122 +1205,73 @@ function read(e) {
|
|
|
1182
1205
|
}
|
|
1183
1206
|
}
|
|
1184
1207
|
const n = e.L || e;
|
|
1185
|
-
if (t && n.
|
|
1208
|
+
if (t && n.fe & STATUS_PENDING && !(stale && n.ie && activeTransition !== n.ie)) {
|
|
1186
1209
|
if (currentOptimisticLane) {
|
|
1187
|
-
const i = n.
|
|
1210
|
+
const i = n.re;
|
|
1188
1211
|
const r = findLane(currentOptimisticLane);
|
|
1189
1212
|
if (i && findLane(i) === r && !hasActiveOverride(n)) {
|
|
1190
1213
|
if (!tracking) link(e, t);
|
|
1191
|
-
throw n.
|
|
1214
|
+
throw n.Z;
|
|
1192
1215
|
}
|
|
1193
1216
|
} else {
|
|
1194
1217
|
if (!tracking) link(e, t);
|
|
1195
|
-
throw n.
|
|
1218
|
+
throw n.Z;
|
|
1196
1219
|
}
|
|
1197
1220
|
}
|
|
1198
|
-
if (e.
|
|
1199
|
-
if (e.
|
|
1221
|
+
if (e.k && e.fe & STATUS_ERROR) {
|
|
1222
|
+
if (e.ee < clock) {
|
|
1200
1223
|
recompute(e, true);
|
|
1201
1224
|
return read(e);
|
|
1202
|
-
} else throw e.
|
|
1225
|
+
} else throw e.Z;
|
|
1203
1226
|
}
|
|
1204
1227
|
return !t ||
|
|
1205
1228
|
currentOptimisticLane !== null ||
|
|
1206
|
-
e.
|
|
1207
|
-
(stale && e
|
|
1208
|
-
? e.
|
|
1209
|
-
: e.
|
|
1229
|
+
e.le === NOT_PENDING ||
|
|
1230
|
+
(stale && e.ie && activeTransition !== e.ie)
|
|
1231
|
+
? e.ae
|
|
1232
|
+
: e.le;
|
|
1210
1233
|
}
|
|
1211
1234
|
function setSignal(e, t) {
|
|
1212
|
-
if (e
|
|
1213
|
-
const n = e.
|
|
1214
|
-
const i = n ? e.
|
|
1235
|
+
if (e.ie && activeTransition !== e.ie) globalQueue.initTransition(e.ie);
|
|
1236
|
+
const n = e.Oe && !projectionWriteActive;
|
|
1237
|
+
const i = n ? e.ae : e.le === NOT_PENDING ? e.ae : e.le;
|
|
1215
1238
|
if (typeof t === "function") t = t(i);
|
|
1216
|
-
const r = !e.
|
|
1239
|
+
const r = !e._e || !e._e(i, t);
|
|
1217
1240
|
if (!r) {
|
|
1218
|
-
if (n && e.
|
|
1241
|
+
if (n && e.le !== NOT_PENDING && e.k) {
|
|
1219
1242
|
insertSubs(e, true);
|
|
1220
1243
|
schedule();
|
|
1221
1244
|
}
|
|
1222
1245
|
return t;
|
|
1223
1246
|
}
|
|
1224
1247
|
if (n) {
|
|
1225
|
-
const n = globalQueue.
|
|
1226
|
-
if (e
|
|
1227
|
-
globalQueue.initTransition(e
|
|
1248
|
+
const n = globalQueue.j.includes(e);
|
|
1249
|
+
if (e.ie && n) {
|
|
1250
|
+
globalQueue.initTransition(e.ie);
|
|
1228
1251
|
}
|
|
1229
|
-
if (e.
|
|
1230
|
-
e.
|
|
1252
|
+
if (e.le === NOT_PENDING) {
|
|
1253
|
+
e.le = e.ae;
|
|
1231
1254
|
}
|
|
1232
1255
|
if (!n) {
|
|
1233
|
-
globalQueue.
|
|
1256
|
+
globalQueue.j.push(e);
|
|
1234
1257
|
}
|
|
1235
|
-
e.
|
|
1258
|
+
e.Re = (e.Re || 0) + 1;
|
|
1236
1259
|
const i = getOrCreateLane(e);
|
|
1237
|
-
e.
|
|
1238
|
-
e.
|
|
1260
|
+
e.re = i;
|
|
1261
|
+
e.ae = t;
|
|
1239
1262
|
} else {
|
|
1240
|
-
if (e.
|
|
1241
|
-
e.
|
|
1263
|
+
if (e.le === NOT_PENDING) globalQueue.H.push(e);
|
|
1264
|
+
e.le = t;
|
|
1242
1265
|
}
|
|
1243
1266
|
updatePendingSignal(e);
|
|
1244
|
-
if (e.
|
|
1245
|
-
setSignal(e.
|
|
1267
|
+
if (e.Ie) {
|
|
1268
|
+
setSignal(e.Ie, t);
|
|
1246
1269
|
}
|
|
1247
|
-
e.
|
|
1270
|
+
e.ee = clock;
|
|
1248
1271
|
insertSubs(e, n);
|
|
1249
1272
|
schedule();
|
|
1250
1273
|
return t;
|
|
1251
1274
|
}
|
|
1252
|
-
const PENDING_OWNER = {};
|
|
1253
|
-
function getObserver() {
|
|
1254
|
-
if (pendingCheckActive || pendingReadActive) return PENDING_OWNER;
|
|
1255
|
-
return tracking ? context : null;
|
|
1256
|
-
}
|
|
1257
|
-
function getOwner() {
|
|
1258
|
-
return context;
|
|
1259
|
-
}
|
|
1260
|
-
function onCleanup(e) {
|
|
1261
|
-
if (!context) return e;
|
|
1262
|
-
if (!context._e) context._e = e;
|
|
1263
|
-
else if (Array.isArray(context._e)) context._e.push(e);
|
|
1264
|
-
else context._e = [context._e, e];
|
|
1265
|
-
return e;
|
|
1266
|
-
}
|
|
1267
|
-
function createOwner(e) {
|
|
1268
|
-
const t = context;
|
|
1269
|
-
const n = {
|
|
1270
|
-
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
1271
|
-
i: true,
|
|
1272
|
-
l: t?.i ? t.l : t,
|
|
1273
|
-
pe: null,
|
|
1274
|
-
we: null,
|
|
1275
|
-
_e: null,
|
|
1276
|
-
Te: t?.Te ?? globalQueue,
|
|
1277
|
-
Ve: t?.Ve || defaultContext,
|
|
1278
|
-
be: 0,
|
|
1279
|
-
Se: null,
|
|
1280
|
-
Ie: null,
|
|
1281
|
-
o: t,
|
|
1282
|
-
dispose(e = true) {
|
|
1283
|
-
disposeChildren(n, e);
|
|
1284
|
-
}
|
|
1285
|
-
};
|
|
1286
|
-
if (t) {
|
|
1287
|
-
const e = t.pe;
|
|
1288
|
-
if (e === null) {
|
|
1289
|
-
t.pe = n;
|
|
1290
|
-
} else {
|
|
1291
|
-
n.we = e;
|
|
1292
|
-
t.pe = n;
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
return n;
|
|
1296
|
-
}
|
|
1297
|
-
function createRoot(e, t) {
|
|
1298
|
-
const n = createOwner(t);
|
|
1299
|
-
return runWithOwner(n, () => e(n.dispose));
|
|
1300
|
-
}
|
|
1301
1275
|
function runWithOwner(e, t) {
|
|
1302
1276
|
const n = context;
|
|
1303
1277
|
const i = tracking;
|
|
@@ -1310,6 +1284,63 @@ function runWithOwner(e, t) {
|
|
|
1310
1284
|
tracking = i;
|
|
1311
1285
|
}
|
|
1312
1286
|
}
|
|
1287
|
+
function getPendingSignal(e) {
|
|
1288
|
+
if (!e.Qe) {
|
|
1289
|
+
e.Qe = optimisticSignal(false, { pureWrite: true });
|
|
1290
|
+
if (e.Ee) {
|
|
1291
|
+
e.Qe.Ee = e;
|
|
1292
|
+
}
|
|
1293
|
+
if (computePendingState(e)) setSignal(e.Qe, true);
|
|
1294
|
+
}
|
|
1295
|
+
return e.Qe;
|
|
1296
|
+
}
|
|
1297
|
+
function computePendingState(e) {
|
|
1298
|
+
const t = e;
|
|
1299
|
+
if (e.Oe && e.le !== NOT_PENDING) {
|
|
1300
|
+
if (t.fe & STATUS_PENDING && !(t.fe & STATUS_UNINITIALIZED)) return true;
|
|
1301
|
+
if (e.Ee) {
|
|
1302
|
+
const t = e.re ? findLane(e.re) : null;
|
|
1303
|
+
return !!(t && t.W.size > 0);
|
|
1304
|
+
}
|
|
1305
|
+
return true;
|
|
1306
|
+
}
|
|
1307
|
+
if (e.le !== NOT_PENDING && !(t.fe & STATUS_UNINITIALIZED)) return true;
|
|
1308
|
+
return !!(t.fe & STATUS_PENDING && !(t.fe & STATUS_UNINITIALIZED));
|
|
1309
|
+
}
|
|
1310
|
+
function updatePendingSignal(e) {
|
|
1311
|
+
if (e.Qe) {
|
|
1312
|
+
const t = computePendingState(e);
|
|
1313
|
+
const n = e.Qe;
|
|
1314
|
+
setSignal(n, t);
|
|
1315
|
+
if (!t && n.re) {
|
|
1316
|
+
const t = resolveLane(e);
|
|
1317
|
+
if (t && t.W.size > 0) {
|
|
1318
|
+
const e = findLane(n.re);
|
|
1319
|
+
if (e !== t) {
|
|
1320
|
+
mergeLanes(t, e);
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
signalLanes.delete(n);
|
|
1324
|
+
n.re = undefined;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
function getPendingValueComputed(e) {
|
|
1329
|
+
if (!e.Ie) {
|
|
1330
|
+
const t = pendingReadActive;
|
|
1331
|
+
pendingReadActive = false;
|
|
1332
|
+
const n = pendingCheckActive;
|
|
1333
|
+
pendingCheckActive = false;
|
|
1334
|
+
const i = context;
|
|
1335
|
+
context = null;
|
|
1336
|
+
e.Ie = optimisticComputed(() => read(e));
|
|
1337
|
+
e.Ie.Ee = e;
|
|
1338
|
+
context = i;
|
|
1339
|
+
pendingCheckActive = n;
|
|
1340
|
+
pendingReadActive = t;
|
|
1341
|
+
}
|
|
1342
|
+
return e.Ie;
|
|
1343
|
+
}
|
|
1313
1344
|
function staleValues(e, t = true) {
|
|
1314
1345
|
const n = stale;
|
|
1315
1346
|
stale = t;
|
|
@@ -1387,85 +1418,49 @@ function hasContext(e, t) {
|
|
|
1387
1418
|
function isUndefined(e) {
|
|
1388
1419
|
return typeof e === "undefined";
|
|
1389
1420
|
}
|
|
1390
|
-
function
|
|
1391
|
-
|
|
1392
|
-
const
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1421
|
+
function restoreTransition(e, t) {
|
|
1422
|
+
globalQueue.initTransition(e);
|
|
1423
|
+
const n = t();
|
|
1424
|
+
flush();
|
|
1425
|
+
return n;
|
|
1426
|
+
}
|
|
1427
|
+
function action(e) {
|
|
1428
|
+
return (...t) =>
|
|
1429
|
+
new Promise((n, i) => {
|
|
1430
|
+
const r = e(...t);
|
|
1431
|
+
globalQueue.initTransition();
|
|
1432
|
+
let o = activeTransition;
|
|
1433
|
+
o.te.push(r);
|
|
1434
|
+
const done = (e, t) => {
|
|
1435
|
+
o = currentTransition(o);
|
|
1436
|
+
const s = o.te.indexOf(r);
|
|
1437
|
+
if (s >= 0) o.te.splice(s, 1);
|
|
1438
|
+
setActiveTransition(o);
|
|
1439
|
+
schedule();
|
|
1440
|
+
t ? i(t) : n(e);
|
|
1441
|
+
};
|
|
1442
|
+
const step = (e, t) => {
|
|
1443
|
+
let n;
|
|
1413
1444
|
try {
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
s.Qe = undefined;
|
|
1418
|
-
})
|
|
1419
|
-
: console.error(e);
|
|
1420
|
-
} catch (t) {
|
|
1421
|
-
e = t;
|
|
1445
|
+
n = t ? r.throw(e) : r.next(e);
|
|
1446
|
+
} catch (e) {
|
|
1447
|
+
return done(undefined, e);
|
|
1422
1448
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
} catch (e) {
|
|
1439
|
-
if (!this.Te.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1440
|
-
} finally {
|
|
1441
|
-
this.Ue = this.Re;
|
|
1442
|
-
this.Ee = false;
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
function trackedEffect(e, t) {
|
|
1446
|
-
const run = () => {
|
|
1447
|
-
if (!n.Ee || n._ & REACTIVE_DISPOSED) return;
|
|
1448
|
-
n.Ee = false;
|
|
1449
|
-
recompute(n);
|
|
1450
|
-
};
|
|
1451
|
-
const n = computed(
|
|
1452
|
-
() => {
|
|
1453
|
-
try {
|
|
1454
|
-
n.Qe?.();
|
|
1455
|
-
n.Qe = undefined;
|
|
1456
|
-
n.Qe = staleValues(e) || undefined;
|
|
1457
|
-
} finally {
|
|
1458
|
-
}
|
|
1459
|
-
},
|
|
1460
|
-
undefined,
|
|
1461
|
-
{ ...t, lazy: true, pureWrite: true }
|
|
1462
|
-
);
|
|
1463
|
-
n.Qe = undefined;
|
|
1464
|
-
n.Ee = true;
|
|
1465
|
-
n.fe = EFFECT_TRACKED;
|
|
1466
|
-
n.de = run;
|
|
1467
|
-
n.Te.enqueue(EFFECT_USER, run);
|
|
1468
|
-
onCleanup(() => n.Qe?.());
|
|
1449
|
+
if (n instanceof Promise)
|
|
1450
|
+
return void n.then(run, e => restoreTransition(o, () => step(e, true)));
|
|
1451
|
+
run(n);
|
|
1452
|
+
};
|
|
1453
|
+
const run = e => {
|
|
1454
|
+
if (e.done) return done(e.value);
|
|
1455
|
+
if (e.value instanceof Promise)
|
|
1456
|
+
return void e.value.then(
|
|
1457
|
+
e => restoreTransition(o, () => step(e)),
|
|
1458
|
+
e => restoreTransition(o, () => step(e, true))
|
|
1459
|
+
);
|
|
1460
|
+
restoreTransition(o, () => step(e.value));
|
|
1461
|
+
};
|
|
1462
|
+
step();
|
|
1463
|
+
});
|
|
1469
1464
|
}
|
|
1470
1465
|
function createSignal(e, t, n) {
|
|
1471
1466
|
if (typeof e === "function") {
|
|
@@ -1644,7 +1639,7 @@ function applyState(e, t, n, i) {
|
|
|
1644
1639
|
const E = unwrap(getOverrideValue(o, s, u, a));
|
|
1645
1640
|
let T = unwrap(e[a]);
|
|
1646
1641
|
if (E === T) continue;
|
|
1647
|
-
if (!E || !isWrappable(E) || (n(E) != null && n(E) !== n(T))) {
|
|
1642
|
+
if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
|
|
1648
1643
|
t && setSignal(t, void 0);
|
|
1649
1644
|
f && setSignal(f, isWrappable(T) ? wrap(T, r) : T);
|
|
1650
1645
|
} else applyState(T, wrap(E, r), n, i);
|
|
@@ -1699,7 +1694,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1699
1694
|
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(o);
|
|
1700
1695
|
});
|
|
1701
1696
|
});
|
|
1702
|
-
i.
|
|
1697
|
+
i.Ue = true;
|
|
1703
1698
|
return { store: o, node: i };
|
|
1704
1699
|
}
|
|
1705
1700
|
function createProjection(e, t = {}, n) {
|
|
@@ -1799,7 +1794,7 @@ function getNode(e, t, n, i, r = isEqual, o) {
|
|
|
1799
1794
|
},
|
|
1800
1795
|
i
|
|
1801
1796
|
);
|
|
1802
|
-
if (o) s.
|
|
1797
|
+
if (o) s.Oe = true;
|
|
1803
1798
|
return (e[t] = s);
|
|
1804
1799
|
}
|
|
1805
1800
|
function trackSelf(e, t = $TRACK) {
|
|
@@ -1852,7 +1847,7 @@ const storeTraps = {
|
|
|
1852
1847
|
if (e && e.get) return e.get.call(n);
|
|
1853
1848
|
}
|
|
1854
1849
|
if (writeOnly(n)) {
|
|
1855
|
-
let n = r && (s || !u) ? (r.
|
|
1850
|
+
let n = r && (s || !u) ? (r.le !== NOT_PENDING ? (r.Oe ? r.ae : r.le) : r.ae) : c[t];
|
|
1856
1851
|
n === $DELETED && (n = undefined);
|
|
1857
1852
|
if (!isWrappable(n)) return n;
|
|
1858
1853
|
const i = wrap(n, e);
|
|
@@ -1901,8 +1896,8 @@ const storeTraps = {
|
|
|
1901
1896
|
if (writeOnly(i)) {
|
|
1902
1897
|
if (e[STORE_OPTIMISTIC]) {
|
|
1903
1898
|
const t = e[STORE_FIREWALL];
|
|
1904
|
-
if (t
|
|
1905
|
-
globalQueue.initTransition(t
|
|
1899
|
+
if (t?.ie) {
|
|
1900
|
+
globalQueue.initTransition(t.ie);
|
|
1906
1901
|
}
|
|
1907
1902
|
}
|
|
1908
1903
|
untrack(() => {
|
|
@@ -2091,7 +2086,7 @@ function deep(e) {
|
|
|
2091
2086
|
return e[$DEEP];
|
|
2092
2087
|
}
|
|
2093
2088
|
function createOptimisticStore(e, t, n) {
|
|
2094
|
-
GlobalQueue.
|
|
2089
|
+
GlobalQueue.X ||= clearOptimisticStore;
|
|
2095
2090
|
const i = typeof e === "function";
|
|
2096
2091
|
const r = (i ? t : e) ?? {};
|
|
2097
2092
|
const o = i ? e : undefined;
|
|
@@ -2108,7 +2103,7 @@ function clearOptimisticStore(e) {
|
|
|
2108
2103
|
if (i) {
|
|
2109
2104
|
for (const e of Reflect.ownKeys(n)) {
|
|
2110
2105
|
if (i[e]) {
|
|
2111
|
-
i[e].
|
|
2106
|
+
i[e].re = undefined;
|
|
2112
2107
|
const n =
|
|
2113
2108
|
t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
|
|
2114
2109
|
const r = n === $DELETED ? undefined : n;
|
|
@@ -2116,7 +2111,7 @@ function clearOptimisticStore(e) {
|
|
|
2116
2111
|
}
|
|
2117
2112
|
}
|
|
2118
2113
|
if (i[$TRACK]) {
|
|
2119
|
-
i[$TRACK].
|
|
2114
|
+
i[$TRACK].re = undefined;
|
|
2120
2115
|
setSignal(i[$TRACK], undefined);
|
|
2121
2116
|
}
|
|
2122
2117
|
}
|
|
@@ -2167,7 +2162,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2167
2162
|
setProjectionWriteActive(false);
|
|
2168
2163
|
}
|
|
2169
2164
|
});
|
|
2170
|
-
i.
|
|
2165
|
+
i.Ue = true;
|
|
2171
2166
|
}
|
|
2172
2167
|
return { store: o, node: i };
|
|
2173
2168
|
}
|
|
@@ -2352,9 +2347,9 @@ function mapArray(e, t, n) {
|
|
|
2352
2347
|
return createMemo(
|
|
2353
2348
|
updateKeyedMap.bind({
|
|
2354
2349
|
xe: createOwner(),
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2350
|
+
Fe: 0,
|
|
2351
|
+
Ge: e,
|
|
2352
|
+
Me: [],
|
|
2358
2353
|
$e: t,
|
|
2359
2354
|
He: [],
|
|
2360
2355
|
je: [],
|
|
@@ -2367,7 +2362,7 @@ function mapArray(e, t, n) {
|
|
|
2367
2362
|
}
|
|
2368
2363
|
const pureOptions = { pureWrite: true };
|
|
2369
2364
|
function updateKeyedMap() {
|
|
2370
|
-
const e = this.
|
|
2365
|
+
const e = this.Ge() || [],
|
|
2371
2366
|
t = e.length;
|
|
2372
2367
|
e[$TRACK];
|
|
2373
2368
|
runWithOwner(this.xe, () => {
|
|
@@ -2393,26 +2388,26 @@ function updateKeyedMap() {
|
|
|
2393
2388
|
return this.$e(() => t);
|
|
2394
2389
|
};
|
|
2395
2390
|
if (t === 0) {
|
|
2396
|
-
if (this.
|
|
2391
|
+
if (this.Fe !== 0) {
|
|
2397
2392
|
this.xe.dispose(false);
|
|
2398
2393
|
this.je = [];
|
|
2399
|
-
this.
|
|
2394
|
+
this.Me = [];
|
|
2400
2395
|
this.He = [];
|
|
2401
|
-
this.
|
|
2396
|
+
this.Fe = 0;
|
|
2402
2397
|
this.Ye && (this.Ye = []);
|
|
2403
2398
|
this.Be && (this.Be = []);
|
|
2404
2399
|
}
|
|
2405
2400
|
if (this.Xe && !this.He[0]) {
|
|
2406
2401
|
this.He[0] = runWithOwner((this.je[0] = createOwner()), this.Xe);
|
|
2407
2402
|
}
|
|
2408
|
-
} else if (this.
|
|
2403
|
+
} else if (this.Fe === 0) {
|
|
2409
2404
|
if (this.je[0]) this.je[0].dispose();
|
|
2410
2405
|
this.He = new Array(t);
|
|
2411
2406
|
for (i = 0; i < t; i++) {
|
|
2412
|
-
this.
|
|
2407
|
+
this.Me[i] = e[i];
|
|
2413
2408
|
this.He[i] = runWithOwner((this.je[i] = createOwner()), r);
|
|
2414
2409
|
}
|
|
2415
|
-
this.
|
|
2410
|
+
this.Fe = t;
|
|
2416
2411
|
} else {
|
|
2417
2412
|
let o,
|
|
2418
2413
|
s,
|
|
@@ -2426,17 +2421,17 @@ function updateKeyedMap() {
|
|
|
2426
2421
|
d = this.Ye ? new Array(t) : undefined,
|
|
2427
2422
|
R = this.Be ? new Array(t) : undefined;
|
|
2428
2423
|
for (
|
|
2429
|
-
o = 0, s = Math.min(this.
|
|
2430
|
-
o < s && (this.
|
|
2424
|
+
o = 0, s = Math.min(this.Fe, t);
|
|
2425
|
+
o < s && (this.Me[o] === e[o] || (this.Ye && compare(this.Ke, this.Me[o], e[o])));
|
|
2431
2426
|
o++
|
|
2432
2427
|
) {
|
|
2433
2428
|
if (this.Ye) setSignal(this.Ye[o], e[o]);
|
|
2434
2429
|
}
|
|
2435
2430
|
for (
|
|
2436
|
-
s = this.
|
|
2431
|
+
s = this.Fe - 1, u = t - 1;
|
|
2437
2432
|
s >= o &&
|
|
2438
2433
|
u >= o &&
|
|
2439
|
-
(this.
|
|
2434
|
+
(this.Me[s] === e[u] || (this.Ye && compare(this.Ke, this.Me[s], e[u])));
|
|
2440
2435
|
s--, u--
|
|
2441
2436
|
) {
|
|
2442
2437
|
E[u] = this.He[s];
|
|
@@ -2454,7 +2449,7 @@ function updateKeyedMap() {
|
|
|
2454
2449
|
a.set(l, i);
|
|
2455
2450
|
}
|
|
2456
2451
|
for (n = o; n <= s; n++) {
|
|
2457
|
-
c = this.
|
|
2452
|
+
c = this.Me[n];
|
|
2458
2453
|
l = this.Ke ? this.Ke(c) : c;
|
|
2459
2454
|
i = a.get(l);
|
|
2460
2455
|
if (i !== undefined && i !== -1) {
|
|
@@ -2482,8 +2477,8 @@ function updateKeyedMap() {
|
|
|
2482
2477
|
this.He[i] = runWithOwner((this.je[i] = createOwner()), r);
|
|
2483
2478
|
}
|
|
2484
2479
|
}
|
|
2485
|
-
this.He = this.He.slice(0, (this.
|
|
2486
|
-
this.
|
|
2480
|
+
this.He = this.He.slice(0, (this.Fe = t));
|
|
2481
|
+
this.Me = e.slice(0);
|
|
2487
2482
|
}
|
|
2488
2483
|
});
|
|
2489
2484
|
return this.He;
|
|
@@ -2491,7 +2486,7 @@ function updateKeyedMap() {
|
|
|
2491
2486
|
function repeat(e, t, n) {
|
|
2492
2487
|
return updateRepeat.bind({
|
|
2493
2488
|
xe: createOwner(),
|
|
2494
|
-
|
|
2489
|
+
Fe: 0,
|
|
2495
2490
|
qe: 0,
|
|
2496
2491
|
ze: e,
|
|
2497
2492
|
$e: t,
|
|
@@ -2506,11 +2501,11 @@ function updateRepeat() {
|
|
|
2506
2501
|
const t = this.Ze?.() || 0;
|
|
2507
2502
|
runWithOwner(this.xe, () => {
|
|
2508
2503
|
if (e === 0) {
|
|
2509
|
-
if (this.
|
|
2504
|
+
if (this.Fe !== 0) {
|
|
2510
2505
|
this.xe.dispose(false);
|
|
2511
2506
|
this.je = [];
|
|
2512
2507
|
this.He = [];
|
|
2513
|
-
this.
|
|
2508
|
+
this.Fe = 0;
|
|
2514
2509
|
}
|
|
2515
2510
|
if (this.Xe && !this.He[0]) {
|
|
2516
2511
|
this.He[0] = runWithOwner((this.je[0] = createOwner()), this.Xe);
|
|
@@ -2518,12 +2513,12 @@ function updateRepeat() {
|
|
|
2518
2513
|
return;
|
|
2519
2514
|
}
|
|
2520
2515
|
const n = t + e;
|
|
2521
|
-
const i = this.qe + this.
|
|
2522
|
-
if (this.
|
|
2516
|
+
const i = this.qe + this.Fe;
|
|
2517
|
+
if (this.Fe === 0 && this.je[0]) this.je[0].dispose();
|
|
2523
2518
|
for (let e = n; e < i; e++) this.je[e - this.qe].dispose();
|
|
2524
2519
|
if (this.qe < t) {
|
|
2525
2520
|
let e = this.qe;
|
|
2526
|
-
while (e < t && e < this.
|
|
2521
|
+
while (e < t && e < this.Fe) this.je[e++].dispose();
|
|
2527
2522
|
this.je.splice(0, t - this.qe);
|
|
2528
2523
|
this.He.splice(0, t - this.qe);
|
|
2529
2524
|
} else if (this.qe > t) {
|
|
@@ -2544,7 +2539,7 @@ function updateRepeat() {
|
|
|
2544
2539
|
}
|
|
2545
2540
|
this.He = this.He.slice(0, e);
|
|
2546
2541
|
this.qe = t;
|
|
2547
|
-
this.
|
|
2542
|
+
this.Fe = e;
|
|
2548
2543
|
});
|
|
2549
2544
|
return this.He;
|
|
2550
2545
|
}
|
|
@@ -2553,119 +2548,68 @@ function compare(e, t, n) {
|
|
|
2553
2548
|
}
|
|
2554
2549
|
function boundaryComputed(e, t) {
|
|
2555
2550
|
const n = computed(e, undefined, { lazy: true });
|
|
2556
|
-
n.
|
|
2557
|
-
const i = e !== undefined ? e : n.
|
|
2558
|
-
const r = t !== undefined ? t : n.
|
|
2559
|
-
n.
|
|
2560
|
-
n.
|
|
2551
|
+
n.pe = (e, t) => {
|
|
2552
|
+
const i = e !== undefined ? e : n.fe;
|
|
2553
|
+
const r = t !== undefined ? t : n.Z;
|
|
2554
|
+
n.fe &= ~n.Je;
|
|
2555
|
+
n.ue.notify(n, n.Je, i, r);
|
|
2561
2556
|
};
|
|
2562
2557
|
n.Je = t;
|
|
2563
|
-
n.
|
|
2558
|
+
n.Ue = true;
|
|
2564
2559
|
recompute(n, true);
|
|
2565
2560
|
return n;
|
|
2566
2561
|
}
|
|
2567
2562
|
function createBoundChildren(e, t, n, i) {
|
|
2568
|
-
const r = e.
|
|
2569
|
-
r.addChild((e.
|
|
2570
|
-
onCleanup(() => r.removeChild(e.
|
|
2563
|
+
const r = e.ue;
|
|
2564
|
+
r.addChild((e.ue = n));
|
|
2565
|
+
onCleanup(() => r.removeChild(e.ue));
|
|
2571
2566
|
return runWithOwner(e, () => {
|
|
2572
2567
|
const e = computed(t);
|
|
2573
2568
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
2574
2569
|
});
|
|
2575
2570
|
}
|
|
2576
|
-
class
|
|
2571
|
+
class CollectionQueue extends Queue {
|
|
2577
2572
|
et;
|
|
2578
2573
|
tt = new Set();
|
|
2579
|
-
|
|
2574
|
+
nt = signal(false, { pureWrite: true });
|
|
2575
|
+
it = false;
|
|
2580
2576
|
constructor(e) {
|
|
2581
2577
|
super();
|
|
2582
2578
|
this.et = e;
|
|
2583
2579
|
}
|
|
2584
2580
|
run(e) {
|
|
2585
|
-
if (!e || read(this.
|
|
2586
|
-
return super.run(e);
|
|
2587
|
-
}
|
|
2588
|
-
notify(e, t, n, i) {
|
|
2589
|
-
if (read(this.et)) {
|
|
2590
|
-
if (t & STATUS_PENDING) {
|
|
2591
|
-
if (n & STATUS_PENDING) {
|
|
2592
|
-
this.J.add(e);
|
|
2593
|
-
t &= ~STATUS_PENDING;
|
|
2594
|
-
} else if (this.J.delete(e)) t &= ~STATUS_PENDING;
|
|
2595
|
-
}
|
|
2596
|
-
if (t & STATUS_ERROR) {
|
|
2597
|
-
if (n & STATUS_ERROR) {
|
|
2598
|
-
this.tt.add(e);
|
|
2599
|
-
t &= ~STATUS_ERROR;
|
|
2600
|
-
} else if (this.tt.delete(e)) t &= ~STATUS_ERROR;
|
|
2601
|
-
}
|
|
2602
|
-
}
|
|
2603
|
-
return t ? super.notify(e, t, n, i ?? e.se) : true;
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
class CollectionQueue extends Queue {
|
|
2607
|
-
nt;
|
|
2608
|
-
it = new Set();
|
|
2609
|
-
et = signal(false, { pureWrite: true });
|
|
2610
|
-
rt = false;
|
|
2611
|
-
constructor(e) {
|
|
2612
|
-
super();
|
|
2613
|
-
this.nt = e;
|
|
2614
|
-
}
|
|
2615
|
-
run(e) {
|
|
2616
|
-
if (!e || read(this.et)) return;
|
|
2581
|
+
if (!e || read(this.nt)) return;
|
|
2617
2582
|
return super.run(e);
|
|
2618
2583
|
}
|
|
2619
2584
|
notify(e, t, n, i) {
|
|
2620
|
-
if (!(t & this.
|
|
2621
|
-
if (n & this.
|
|
2622
|
-
const t = i?.t || e.
|
|
2585
|
+
if (!(t & this.et) || (this.et & STATUS_PENDING && this.it)) return super.notify(e, t, n, i);
|
|
2586
|
+
if (n & this.et) {
|
|
2587
|
+
const t = i?.t || e.Z?.t;
|
|
2623
2588
|
if (t) {
|
|
2624
|
-
const e = this.
|
|
2625
|
-
this.
|
|
2626
|
-
if (e) setSignal(this.
|
|
2589
|
+
const e = this.tt.size === 0;
|
|
2590
|
+
this.tt.add(t);
|
|
2591
|
+
if (e) setSignal(this.nt, true);
|
|
2627
2592
|
}
|
|
2628
2593
|
}
|
|
2629
|
-
t &= ~this.
|
|
2594
|
+
t &= ~this.et;
|
|
2630
2595
|
return t ? super.notify(e, t, n, i) : true;
|
|
2631
2596
|
}
|
|
2632
2597
|
checkSources() {
|
|
2633
|
-
for (const e of this.
|
|
2634
|
-
if (!(e.
|
|
2635
|
-
}
|
|
2636
|
-
if (!this.it.size) setSignal(this.et, false);
|
|
2637
|
-
}
|
|
2638
|
-
}
|
|
2639
|
-
var BoundaryMode;
|
|
2640
|
-
(function (e) {
|
|
2641
|
-
e["VISIBLE"] = "visible";
|
|
2642
|
-
e["HIDDEN"] = "hidden";
|
|
2643
|
-
})(BoundaryMode || (BoundaryMode = {}));
|
|
2644
|
-
function createBoundary(e, t) {
|
|
2645
|
-
const n = createOwner();
|
|
2646
|
-
const i = new ConditionalQueue(computed(() => t() === BoundaryMode.HIDDEN));
|
|
2647
|
-
const r = createBoundChildren(n, e, i, 0);
|
|
2648
|
-
computed(() => {
|
|
2649
|
-
const e = read(i.et);
|
|
2650
|
-
r.Je = e ? STATUS_ERROR | STATUS_PENDING : 0;
|
|
2651
|
-
if (!e) {
|
|
2652
|
-
i.J.forEach(e => i.notify(e, STATUS_PENDING, STATUS_PENDING, e.se));
|
|
2653
|
-
i.tt.forEach(e => i.notify(e, STATUS_ERROR, STATUS_ERROR, e.se));
|
|
2654
|
-
i.J.clear();
|
|
2655
|
-
i.tt.clear();
|
|
2598
|
+
for (const e of this.tt) {
|
|
2599
|
+
if (!(e.fe & this.et)) this.tt.delete(e);
|
|
2656
2600
|
}
|
|
2657
|
-
|
|
2658
|
-
|
|
2601
|
+
if (!this.tt.size) setSignal(this.nt, false);
|
|
2602
|
+
}
|
|
2659
2603
|
}
|
|
2660
2604
|
function createCollectionBoundary(e, t, n) {
|
|
2661
2605
|
const i = createOwner();
|
|
2662
2606
|
const r = new CollectionQueue(e);
|
|
2663
2607
|
const o = createBoundChildren(i, t, r, e);
|
|
2664
2608
|
const s = computed(() => {
|
|
2665
|
-
if (!read(r.
|
|
2609
|
+
if (!read(r.nt)) {
|
|
2666
2610
|
const e = read(o);
|
|
2667
|
-
if (!untrack(() => read(r.
|
|
2668
|
-
r.
|
|
2611
|
+
if (!untrack(() => read(r.nt))) {
|
|
2612
|
+
r.it = true;
|
|
2669
2613
|
return e;
|
|
2670
2614
|
}
|
|
2671
2615
|
}
|
|
@@ -2678,10 +2622,10 @@ function createLoadBoundary(e, t) {
|
|
|
2678
2622
|
}
|
|
2679
2623
|
function createErrorBoundary(e, t) {
|
|
2680
2624
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2681
|
-
let n = e.
|
|
2682
|
-
const i = n.
|
|
2625
|
+
let n = e.tt.values().next().value;
|
|
2626
|
+
const i = n.Z?.cause ?? n.Z;
|
|
2683
2627
|
return t(i, () => {
|
|
2684
|
-
for (const t of e.
|
|
2628
|
+
for (const t of e.tt) recompute(t);
|
|
2685
2629
|
schedule();
|
|
2686
2630
|
});
|
|
2687
2631
|
});
|
|
@@ -2744,7 +2688,6 @@ export {
|
|
|
2744
2688
|
NotReadyError,
|
|
2745
2689
|
SUPPORTS_PROXY,
|
|
2746
2690
|
action,
|
|
2747
|
-
createBoundary,
|
|
2748
2691
|
createContext,
|
|
2749
2692
|
createEffect,
|
|
2750
2693
|
createErrorBoundary,
|
|
@@ -2752,6 +2695,7 @@ export {
|
|
|
2752
2695
|
createMemo,
|
|
2753
2696
|
createOptimistic,
|
|
2754
2697
|
createOptimisticStore,
|
|
2698
|
+
createOwner,
|
|
2755
2699
|
createProjection,
|
|
2756
2700
|
createReaction,
|
|
2757
2701
|
createRenderEffect,
|