@solidjs/signals 2.0.0-beta.8 → 2.0.0-beta.9
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 +172 -79
- package/dist/node.cjs +1091 -1043
- package/dist/prod.js +802 -752
- package/dist/types/boundaries.d.ts +35 -0
- package/dist/types/core/action.d.ts +34 -0
- package/dist/types/core/constants.d.ts +17 -0
- package/dist/types/core/core.d.ts +106 -7
- package/dist/types/core/dev.d.ts +1 -1
- package/dist/types/core/owner.d.ts +54 -3
- package/dist/types/core/scheduler.d.ts +18 -2
- package/dist/types/core/types.d.ts +2 -5
- package/dist/types/index.d.ts +1 -1
- package/dist/types/map.d.ts +32 -3
- package/dist/types/signals.d.ts +264 -11
- package/dist/types/store/optimistic.d.ts +38 -12
- package/dist/types/store/projection.d.ts +40 -14
- package/dist/types/store/reconcile.d.ts +22 -0
- package/dist/types/store/store.d.ts +64 -14
- package/dist/types/store/storePath.d.ts +28 -0
- package/dist/types/store/utils.d.ts +78 -7
- package/dist/types-cjs/boundaries.d.cts +35 -0
- package/dist/types-cjs/core/action.d.cts +34 -0
- package/dist/types-cjs/core/constants.d.cts +17 -0
- package/dist/types-cjs/core/core.d.cts +106 -7
- package/dist/types-cjs/core/dev.d.cts +1 -1
- package/dist/types-cjs/core/owner.d.cts +54 -3
- package/dist/types-cjs/core/scheduler.d.cts +18 -2
- package/dist/types-cjs/core/types.d.cts +2 -5
- package/dist/types-cjs/index.d.cts +1 -1
- package/dist/types-cjs/map.d.cts +32 -3
- package/dist/types-cjs/signals.d.cts +264 -11
- package/dist/types-cjs/store/optimistic.d.cts +38 -12
- package/dist/types-cjs/store/projection.d.cts +40 -14
- package/dist/types-cjs/store/reconcile.d.cts +22 -0
- package/dist/types-cjs/store/store.d.cts +64 -14
- package/dist/types-cjs/store/storePath.d.cts +28 -0
- package/dist/types-cjs/store/utils.d.cts +78 -7
- package/package.json +4 -3
package/dist/prod.js
CHANGED
|
@@ -33,6 +33,12 @@ const REACTIVE_DISPOSED = 1 << 6;
|
|
|
33
33
|
const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
|
|
34
34
|
const REACTIVE_SNAPSHOT_STALE = 1 << 8;
|
|
35
35
|
const REACTIVE_LAZY = 1 << 9;
|
|
36
|
+
const CONFIG_OWNED_WRITE = 1 << 0;
|
|
37
|
+
const CONFIG_NO_SNAPSHOT = 1 << 1;
|
|
38
|
+
const CONFIG_TRANSPARENT = 1 << 2;
|
|
39
|
+
const CONFIG_IN_SNAPSHOT_SCOPE = 1 << 3;
|
|
40
|
+
const CONFIG_CHILDREN_FORBIDDEN = 1 << 4;
|
|
41
|
+
const CONFIG_AUTO_DISPOSE = 1 << 5;
|
|
36
42
|
const STATUS_PENDING = 1 << 0;
|
|
37
43
|
const STATUS_ERROR = 1 << 1;
|
|
38
44
|
const STATUS_UNINITIALIZED = 1 << 2;
|
|
@@ -57,26 +63,26 @@ function actualInsertIntoHeap(e, t) {
|
|
|
57
63
|
e.T = t;
|
|
58
64
|
r.T = e;
|
|
59
65
|
}
|
|
60
|
-
if (i > t.
|
|
66
|
+
if (i > t.O) t.O = i;
|
|
61
67
|
}
|
|
62
68
|
function insertIntoHeap(e, t) {
|
|
63
|
-
let n = e.
|
|
69
|
+
let n = e.R;
|
|
64
70
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
|
|
65
71
|
if (n & REACTIVE_CHECK) {
|
|
66
|
-
e.
|
|
67
|
-
} else e.
|
|
72
|
+
e.R = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
73
|
+
} else e.R = n | REACTIVE_IN_HEAP;
|
|
68
74
|
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
69
75
|
}
|
|
70
76
|
function insertIntoHeapHeight(e, t) {
|
|
71
|
-
let n = e.
|
|
77
|
+
let n = e.R;
|
|
72
78
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
|
|
73
|
-
e.
|
|
79
|
+
e.R = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
74
80
|
actualInsertIntoHeap(e, t);
|
|
75
81
|
}
|
|
76
82
|
function deleteFromHeap(e, t) {
|
|
77
|
-
const n = e.
|
|
83
|
+
const n = e.R;
|
|
78
84
|
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
79
|
-
e.
|
|
85
|
+
e.R = n & -25;
|
|
80
86
|
const i = e.o;
|
|
81
87
|
if (e.T === e) t.l[i] = undefined;
|
|
82
88
|
else {
|
|
@@ -93,21 +99,21 @@ function deleteFromHeap(e, t) {
|
|
|
93
99
|
function markHeap(e) {
|
|
94
100
|
if (e._) return;
|
|
95
101
|
e._ = true;
|
|
96
|
-
for (let t = 0; t <= e.
|
|
102
|
+
for (let t = 0; t <= e.O; t++) {
|
|
97
103
|
for (let n = e.l[t]; n !== undefined; n = n.S) {
|
|
98
|
-
if (n.
|
|
104
|
+
if (n.R & REACTIVE_IN_HEAP) markNode(n);
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
108
|
function markNode(e, t = REACTIVE_DIRTY) {
|
|
103
|
-
const n = e.
|
|
109
|
+
const n = e.R;
|
|
104
110
|
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
105
|
-
e.
|
|
111
|
+
e.R = (n & -4) | t;
|
|
106
112
|
for (let t = e.I; t !== null; t = t.h) {
|
|
107
113
|
markNode(t.p, REACTIVE_CHECK);
|
|
108
114
|
}
|
|
109
|
-
if (e.
|
|
110
|
-
for (let t = e.
|
|
115
|
+
if (e.N !== null) {
|
|
116
|
+
for (let t = e.N; t !== null; t = t.A) {
|
|
111
117
|
for (let e = t.I; e !== null; e = e.h) {
|
|
112
118
|
markNode(e.p, REACTIVE_CHECK);
|
|
113
119
|
}
|
|
@@ -116,15 +122,15 @@ function markNode(e, t = REACTIVE_DIRTY) {
|
|
|
116
122
|
}
|
|
117
123
|
function runHeap(e, t) {
|
|
118
124
|
e._ = false;
|
|
119
|
-
for (e.P = 0; e.P <= e.
|
|
125
|
+
for (e.P = 0; e.P <= e.O; e.P++) {
|
|
120
126
|
let n = e.l[e.P];
|
|
121
127
|
while (n !== undefined) {
|
|
122
|
-
if (n.
|
|
128
|
+
if (n.R & REACTIVE_IN_HEAP) t(n);
|
|
123
129
|
else adjustHeight(n, e);
|
|
124
130
|
n = e.l[e.P];
|
|
125
131
|
}
|
|
126
132
|
}
|
|
127
|
-
e.
|
|
133
|
+
e.O = 0;
|
|
128
134
|
}
|
|
129
135
|
function adjustHeight(e, t) {
|
|
130
136
|
deleteFromHeap(e, t);
|
|
@@ -143,8 +149,8 @@ function adjustHeight(e, t) {
|
|
|
143
149
|
}
|
|
144
150
|
const DEV$1 = undefined;
|
|
145
151
|
const transitions = new Set();
|
|
146
|
-
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0,
|
|
147
|
-
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0,
|
|
152
|
+
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, O: 0 };
|
|
153
|
+
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, O: 0 };
|
|
148
154
|
let clock = 0;
|
|
149
155
|
let activeTransition = null;
|
|
150
156
|
let scheduled = false;
|
|
@@ -162,9 +168,9 @@ function sweepTransientStoreNodes() {
|
|
|
162
168
|
continue;
|
|
163
169
|
}
|
|
164
170
|
if (e.U !== NOT_PENDING) continue;
|
|
165
|
-
if (e.
|
|
171
|
+
if (e.G !== undefined && e.G !== NOT_PENDING) continue;
|
|
166
172
|
transientStoreNodes.delete(e);
|
|
167
|
-
e.
|
|
173
|
+
e.k?.();
|
|
168
174
|
}
|
|
169
175
|
}
|
|
170
176
|
function enforceLoadingBoundary(e) {}
|
|
@@ -173,10 +179,10 @@ function shouldReadStashedOptimisticValue(e) {
|
|
|
173
179
|
}
|
|
174
180
|
function runLaneEffects(e) {
|
|
175
181
|
for (const t of activeLanes) {
|
|
176
|
-
if (t.
|
|
177
|
-
const n = t.
|
|
182
|
+
if (t.F || t.W.size > 0) continue;
|
|
183
|
+
const n = t.H[e - 1];
|
|
178
184
|
if (n.length) {
|
|
179
|
-
t.
|
|
185
|
+
t.H[e - 1] = [];
|
|
180
186
|
runQueue(n, e);
|
|
181
187
|
}
|
|
182
188
|
}
|
|
@@ -184,15 +190,15 @@ function runLaneEffects(e) {
|
|
|
184
190
|
function queueStashedOptimisticEffects(e) {
|
|
185
191
|
for (let t = e.I; t !== null; t = t.h) {
|
|
186
192
|
const e = t.p;
|
|
187
|
-
if (!e.
|
|
188
|
-
if (e.
|
|
193
|
+
if (!e.M) continue;
|
|
194
|
+
if (e.M === EFFECT_TRACKED) {
|
|
189
195
|
if (!e.j) {
|
|
190
196
|
e.j = true;
|
|
191
197
|
e.$.enqueue(EFFECT_USER, e.K);
|
|
192
198
|
}
|
|
193
199
|
continue;
|
|
194
200
|
}
|
|
195
|
-
const n = e.
|
|
201
|
+
const n = e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
196
202
|
if (n.P > e.o) n.P = e.o;
|
|
197
203
|
insertIntoHeap(e, n);
|
|
198
204
|
}
|
|
@@ -202,8 +208,8 @@ function setProjectionWriteActive(e) {
|
|
|
202
208
|
}
|
|
203
209
|
function mergeTransitionState(e, t) {
|
|
204
210
|
t.Y = e;
|
|
205
|
-
e.
|
|
206
|
-
for (const n of activeLanes) if (n.
|
|
211
|
+
e.B.push(...t.B);
|
|
212
|
+
for (const n of activeLanes) if (n.Z === t) n.Z = e;
|
|
207
213
|
e.q.push(...t.q);
|
|
208
214
|
for (const n of t.X) e.X.add(n);
|
|
209
215
|
for (const [n, i] of t.J) {
|
|
@@ -211,56 +217,57 @@ function mergeTransitionState(e, t) {
|
|
|
211
217
|
if (!t) e.J.set(n, (t = new Set()));
|
|
212
218
|
for (const e of i) t.add(e);
|
|
213
219
|
}
|
|
220
|
+
for (const n of t.ee) e.ee.add(n);
|
|
214
221
|
}
|
|
215
222
|
function resolveOptimisticNodes(e) {
|
|
216
223
|
for (let t = 0; t < e.length; t++) {
|
|
217
224
|
const n = e[t];
|
|
218
|
-
n.
|
|
225
|
+
n.te = undefined;
|
|
219
226
|
if (n.U !== NOT_PENDING) {
|
|
220
|
-
n.
|
|
227
|
+
n.ne = n.U;
|
|
221
228
|
n.U = NOT_PENDING;
|
|
222
229
|
}
|
|
223
|
-
const i = n.
|
|
224
|
-
n.
|
|
225
|
-
if (i !== NOT_PENDING && n.
|
|
226
|
-
n.
|
|
230
|
+
const i = n.G;
|
|
231
|
+
n.G = NOT_PENDING;
|
|
232
|
+
if (i !== NOT_PENDING && n.ne !== i) insertSubs(n, true);
|
|
233
|
+
n.Z = null;
|
|
227
234
|
}
|
|
228
235
|
e.length = 0;
|
|
229
236
|
}
|
|
230
237
|
function cleanupCompletedLanes(e) {
|
|
231
238
|
for (const t of activeLanes) {
|
|
232
|
-
const n = e ? t.
|
|
239
|
+
const n = e ? t.Z === e : !t.Z;
|
|
233
240
|
if (!n) continue;
|
|
234
|
-
if (!t.
|
|
235
|
-
if (t.
|
|
236
|
-
if (t.
|
|
237
|
-
}
|
|
238
|
-
if (t.
|
|
239
|
-
t.
|
|
240
|
-
t.
|
|
241
|
-
t.
|
|
241
|
+
if (!t.F) {
|
|
242
|
+
if (t.H[0].length) runQueue(t.H[0], EFFECT_RENDER);
|
|
243
|
+
if (t.H[1].length) runQueue(t.H[1], EFFECT_USER);
|
|
244
|
+
}
|
|
245
|
+
if (t.ie.te === t) t.ie.te = undefined;
|
|
246
|
+
t.W.clear();
|
|
247
|
+
t.H[0].length = 0;
|
|
248
|
+
t.H[1].length = 0;
|
|
242
249
|
activeLanes.delete(t);
|
|
243
|
-
signalLanes.delete(t.
|
|
250
|
+
signalLanes.delete(t.ie);
|
|
244
251
|
}
|
|
245
252
|
}
|
|
246
253
|
function schedule() {
|
|
247
254
|
if (scheduled) return;
|
|
248
255
|
scheduled = true;
|
|
249
|
-
if (!globalQueue.
|
|
256
|
+
if (!globalQueue.re && !projectionWriteActive) queueMicrotask(flush);
|
|
250
257
|
}
|
|
251
258
|
class Queue {
|
|
252
259
|
i = null;
|
|
253
|
-
|
|
254
|
-
|
|
260
|
+
se = [[], []];
|
|
261
|
+
oe = [];
|
|
255
262
|
created = clock;
|
|
256
263
|
addChild(e) {
|
|
257
|
-
this.
|
|
264
|
+
this.oe.push(e);
|
|
258
265
|
e.i = this;
|
|
259
266
|
}
|
|
260
267
|
removeChild(e) {
|
|
261
|
-
const t = this.
|
|
268
|
+
const t = this.oe.indexOf(e);
|
|
262
269
|
if (t >= 0) {
|
|
263
|
-
this.
|
|
270
|
+
this.oe.splice(t, 1);
|
|
264
271
|
e.i = null;
|
|
265
272
|
}
|
|
266
273
|
}
|
|
@@ -269,81 +276,81 @@ class Queue {
|
|
|
269
276
|
return false;
|
|
270
277
|
}
|
|
271
278
|
run(e) {
|
|
272
|
-
if (this.
|
|
273
|
-
const t = this.
|
|
274
|
-
this.
|
|
279
|
+
if (this.se[e - 1].length) {
|
|
280
|
+
const t = this.se[e - 1];
|
|
281
|
+
this.se[e - 1] = [];
|
|
275
282
|
runQueue(t, e);
|
|
276
283
|
}
|
|
277
|
-
for (let t = 0; t < this.
|
|
284
|
+
for (let t = 0; t < this.oe.length; t++) this.oe[t].run?.(e);
|
|
278
285
|
}
|
|
279
286
|
enqueue(e, t) {
|
|
280
287
|
if (e) {
|
|
281
288
|
if (currentOptimisticLane) {
|
|
282
289
|
const n = findLane(currentOptimisticLane);
|
|
283
|
-
n.
|
|
290
|
+
n.H[e - 1].push(t);
|
|
284
291
|
} else {
|
|
285
|
-
this.
|
|
292
|
+
this.se[e - 1].push(t);
|
|
286
293
|
}
|
|
287
294
|
}
|
|
288
295
|
schedule();
|
|
289
296
|
}
|
|
290
297
|
stashQueues(e) {
|
|
291
|
-
e.
|
|
292
|
-
e.
|
|
293
|
-
this.
|
|
294
|
-
for (let t = 0; t < this.
|
|
295
|
-
let n = this.
|
|
296
|
-
let i = e.
|
|
298
|
+
e.se[0].push(...this.se[0]);
|
|
299
|
+
e.se[1].push(...this.se[1]);
|
|
300
|
+
this.se = [[], []];
|
|
301
|
+
for (let t = 0; t < this.oe.length; t++) {
|
|
302
|
+
let n = this.oe[t];
|
|
303
|
+
let i = e.oe[t];
|
|
297
304
|
if (!i) {
|
|
298
|
-
i = {
|
|
299
|
-
e.
|
|
305
|
+
i = { se: [[], []], oe: [] };
|
|
306
|
+
e.oe[t] = i;
|
|
300
307
|
}
|
|
301
308
|
n.stashQueues(i);
|
|
302
309
|
}
|
|
303
310
|
}
|
|
304
311
|
restoreQueues(e) {
|
|
305
|
-
this.
|
|
306
|
-
this.
|
|
307
|
-
for (let t = 0; t < e.
|
|
308
|
-
const n = e.
|
|
309
|
-
let i = this.
|
|
312
|
+
this.se[0].push(...e.se[0]);
|
|
313
|
+
this.se[1].push(...e.se[1]);
|
|
314
|
+
for (let t = 0; t < e.oe.length; t++) {
|
|
315
|
+
const n = e.oe[t];
|
|
316
|
+
let i = this.oe[t];
|
|
310
317
|
if (i) i.restoreQueues(n);
|
|
311
318
|
}
|
|
312
319
|
}
|
|
313
320
|
}
|
|
314
321
|
class GlobalQueue extends Queue {
|
|
315
|
-
|
|
316
|
-
|
|
322
|
+
re = false;
|
|
323
|
+
ue = [];
|
|
317
324
|
q = [];
|
|
318
325
|
X = new Set();
|
|
319
|
-
static ue;
|
|
320
326
|
static ce;
|
|
321
|
-
static ae
|
|
327
|
+
static ae;
|
|
328
|
+
static le = null;
|
|
322
329
|
flush() {
|
|
323
|
-
if (this.
|
|
324
|
-
this.
|
|
330
|
+
if (this.re) return;
|
|
331
|
+
this.re = true;
|
|
325
332
|
try {
|
|
326
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
333
|
+
runHeap(dirtyQueue, GlobalQueue.ce);
|
|
327
334
|
if (activeTransition) {
|
|
328
335
|
const e = transitionComplete(activeTransition);
|
|
329
336
|
if (!e) {
|
|
330
337
|
const e = activeTransition;
|
|
331
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
332
|
-
this.
|
|
338
|
+
runHeap(zombieQueue, GlobalQueue.ce);
|
|
339
|
+
this.ue = [];
|
|
333
340
|
this.q = [];
|
|
334
341
|
this.X = new Set();
|
|
335
342
|
runLaneEffects(EFFECT_RENDER);
|
|
336
343
|
runLaneEffects(EFFECT_USER);
|
|
337
|
-
this.stashQueues(e.
|
|
344
|
+
this.stashQueues(e.fe);
|
|
338
345
|
clock++;
|
|
339
|
-
scheduled = dirtyQueue.
|
|
340
|
-
reassignPendingTransition(e.
|
|
346
|
+
scheduled = dirtyQueue.O >= dirtyQueue.P;
|
|
347
|
+
reassignPendingTransition(e.ue);
|
|
341
348
|
activeTransition = null;
|
|
342
|
-
if (!e.
|
|
349
|
+
if (!e.B.length && !e.J.size && e.q.length) {
|
|
343
350
|
stashedOptimisticReads = new Set();
|
|
344
351
|
for (let t = 0; t < e.q.length; t++) {
|
|
345
352
|
const n = e.q[t];
|
|
346
|
-
if (n.L || n.
|
|
353
|
+
if (n.L || n.Ee & CONFIG_OWNED_WRITE) continue;
|
|
347
354
|
stashedOptimisticReads.add(n);
|
|
348
355
|
queueStashedOptimisticEffects(n);
|
|
349
356
|
}
|
|
@@ -355,32 +362,32 @@ class GlobalQueue extends Queue {
|
|
|
355
362
|
}
|
|
356
363
|
return;
|
|
357
364
|
}
|
|
358
|
-
this.
|
|
359
|
-
this.restoreQueues(activeTransition.
|
|
365
|
+
this.ue !== activeTransition.ue && this.ue.push(...activeTransition.ue);
|
|
366
|
+
this.restoreQueues(activeTransition.fe);
|
|
360
367
|
transitions.delete(activeTransition);
|
|
361
368
|
const t = activeTransition;
|
|
362
369
|
activeTransition = null;
|
|
363
|
-
reassignPendingTransition(this.
|
|
370
|
+
reassignPendingTransition(this.ue);
|
|
364
371
|
finalizePureQueue(t);
|
|
365
372
|
} else {
|
|
366
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
373
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.ce);
|
|
367
374
|
finalizePureQueue();
|
|
368
375
|
}
|
|
369
376
|
clock++;
|
|
370
|
-
scheduled = dirtyQueue.
|
|
377
|
+
scheduled = dirtyQueue.O >= dirtyQueue.P;
|
|
371
378
|
runLaneEffects(EFFECT_RENDER);
|
|
372
379
|
this.run(EFFECT_RENDER);
|
|
373
380
|
runLaneEffects(EFFECT_USER);
|
|
374
381
|
this.run(EFFECT_USER);
|
|
375
382
|
if (false);
|
|
376
383
|
} finally {
|
|
377
|
-
this.
|
|
384
|
+
this.re = false;
|
|
378
385
|
}
|
|
379
386
|
}
|
|
380
387
|
notify(e, t, n, i) {
|
|
381
388
|
if (t & STATUS_PENDING) {
|
|
382
389
|
if (n & STATUS_PENDING) {
|
|
383
|
-
const t = i !== undefined ? i : e.
|
|
390
|
+
const t = i !== undefined ? i : e.Te;
|
|
384
391
|
if (activeTransition && t) {
|
|
385
392
|
const n = t.source;
|
|
386
393
|
let i = activeTransition.J.get(n);
|
|
@@ -397,17 +404,18 @@ class GlobalQueue extends Queue {
|
|
|
397
404
|
initTransition(e) {
|
|
398
405
|
if (e) e = currentTransition(e);
|
|
399
406
|
if (e && e === activeTransition) return;
|
|
400
|
-
if (!e && activeTransition && activeTransition.
|
|
407
|
+
if (!e && activeTransition && activeTransition.Se === clock) return;
|
|
401
408
|
if (!activeTransition) {
|
|
402
409
|
activeTransition = e ?? {
|
|
403
|
-
|
|
404
|
-
|
|
410
|
+
Se: clock,
|
|
411
|
+
ue: [],
|
|
405
412
|
J: new Map(),
|
|
406
413
|
q: [],
|
|
407
414
|
X: new Set(),
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
Y: false
|
|
415
|
+
B: [],
|
|
416
|
+
fe: { se: [[], []], oe: [] },
|
|
417
|
+
Y: false,
|
|
418
|
+
ee: new Set()
|
|
411
419
|
};
|
|
412
420
|
} else if (e) {
|
|
413
421
|
const t = activeTransition;
|
|
@@ -416,25 +424,25 @@ class GlobalQueue extends Queue {
|
|
|
416
424
|
activeTransition = e;
|
|
417
425
|
}
|
|
418
426
|
transitions.add(activeTransition);
|
|
419
|
-
activeTransition.
|
|
420
|
-
if (this.
|
|
421
|
-
for (let e = 0; e < this.
|
|
422
|
-
const t = this.
|
|
423
|
-
t.
|
|
424
|
-
activeTransition.
|
|
427
|
+
activeTransition.Se = clock;
|
|
428
|
+
if (this.ue !== activeTransition.ue) {
|
|
429
|
+
for (let e = 0; e < this.ue.length; e++) {
|
|
430
|
+
const t = this.ue[e];
|
|
431
|
+
t.Z = activeTransition;
|
|
432
|
+
activeTransition.ue.push(t);
|
|
425
433
|
}
|
|
426
|
-
this.
|
|
434
|
+
this.ue = activeTransition.ue;
|
|
427
435
|
}
|
|
428
436
|
if (this.q !== activeTransition.q) {
|
|
429
437
|
for (let e = 0; e < this.q.length; e++) {
|
|
430
438
|
const t = this.q[e];
|
|
431
|
-
t.
|
|
439
|
+
t.Z = activeTransition;
|
|
432
440
|
activeTransition.q.push(t);
|
|
433
441
|
}
|
|
434
442
|
this.q = activeTransition.q;
|
|
435
443
|
}
|
|
436
444
|
for (const e of activeLanes) {
|
|
437
|
-
if (!e.
|
|
445
|
+
if (!e.Z) e.Z = activeTransition;
|
|
438
446
|
}
|
|
439
447
|
if (this.X !== activeTransition.X) {
|
|
440
448
|
for (const e of this.X) activeTransition.X.add(e);
|
|
@@ -443,44 +451,44 @@ class GlobalQueue extends Queue {
|
|
|
443
451
|
}
|
|
444
452
|
}
|
|
445
453
|
function insertSubs(e, t = false) {
|
|
446
|
-
const n = e.
|
|
447
|
-
const i = e.
|
|
454
|
+
const n = e.te || currentOptimisticLane;
|
|
455
|
+
const i = e.de !== undefined;
|
|
448
456
|
for (let r = e.I; r !== null; r = r.h) {
|
|
449
|
-
if (i && r.p.
|
|
450
|
-
r.p.
|
|
457
|
+
if (i && r.p.Ee & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
458
|
+
r.p.R |= REACTIVE_SNAPSHOT_STALE;
|
|
451
459
|
continue;
|
|
452
460
|
}
|
|
453
461
|
if (t && n) {
|
|
454
|
-
r.p.
|
|
462
|
+
r.p.R |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
455
463
|
assignOrMergeLane(r.p, n);
|
|
456
464
|
} else if (t) {
|
|
457
|
-
r.p.
|
|
458
|
-
r.p.
|
|
465
|
+
r.p.R |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
466
|
+
r.p.te = undefined;
|
|
459
467
|
}
|
|
460
468
|
const e = r.p;
|
|
461
|
-
if (e.
|
|
469
|
+
if (e.M === EFFECT_TRACKED) {
|
|
462
470
|
if (!e.j) {
|
|
463
471
|
e.j = true;
|
|
464
472
|
e.$.enqueue(EFFECT_USER, e.K);
|
|
465
473
|
}
|
|
466
474
|
continue;
|
|
467
475
|
}
|
|
468
|
-
const s = r.p.
|
|
476
|
+
const s = r.p.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
469
477
|
if (s.P > r.p.o) s.P = r.p.o;
|
|
470
478
|
insertIntoHeap(r.p, s);
|
|
471
479
|
}
|
|
472
480
|
}
|
|
473
481
|
function commitPendingNodes() {
|
|
474
|
-
const e = globalQueue.
|
|
482
|
+
const e = globalQueue.ue;
|
|
475
483
|
for (let t = 0; t < e.length; t++) {
|
|
476
484
|
const n = e[t];
|
|
477
485
|
if (n.U !== NOT_PENDING) {
|
|
478
|
-
n.
|
|
486
|
+
n.ne = n.U;
|
|
479
487
|
n.U = NOT_PENDING;
|
|
480
|
-
if (n.
|
|
488
|
+
if (n.M && n.M !== EFFECT_TRACKED) n.j = true;
|
|
481
489
|
}
|
|
482
|
-
if (!(n.
|
|
483
|
-
if (n.L) GlobalQueue.
|
|
490
|
+
if (!(n.Oe & STATUS_PENDING)) n.Oe &= ~STATUS_UNINITIALIZED;
|
|
491
|
+
if (n.L) GlobalQueue.ae(n, false, true);
|
|
484
492
|
}
|
|
485
493
|
e.length = 0;
|
|
486
494
|
}
|
|
@@ -488,14 +496,30 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
488
496
|
const n = !t;
|
|
489
497
|
if (n) commitPendingNodes();
|
|
490
498
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
491
|
-
if (dirtyQueue.
|
|
499
|
+
if (dirtyQueue.O >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.ce);
|
|
492
500
|
if (n) {
|
|
493
501
|
commitPendingNodes();
|
|
494
502
|
resolveOptimisticNodes(e ? e.q : globalQueue.q);
|
|
503
|
+
if (e && e.ee.size) {
|
|
504
|
+
for (const t of e.ee) {
|
|
505
|
+
if (t.R & REACTIVE_DISPOSED) continue;
|
|
506
|
+
if (t.M === EFFECT_TRACKED) {
|
|
507
|
+
if (!t.j) {
|
|
508
|
+
t.j = true;
|
|
509
|
+
t.$.enqueue(EFFECT_USER, t.K);
|
|
510
|
+
}
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
const e = t.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
514
|
+
if (e.P > t.o) e.P = t.o;
|
|
515
|
+
insertIntoHeap(t, e);
|
|
516
|
+
}
|
|
517
|
+
e.ee.clear();
|
|
518
|
+
}
|
|
495
519
|
const t = e ? e.X : globalQueue.X;
|
|
496
|
-
if (GlobalQueue.
|
|
520
|
+
if (GlobalQueue.le && t.size) {
|
|
497
521
|
for (const e of t) {
|
|
498
|
-
GlobalQueue.
|
|
522
|
+
GlobalQueue.le(e);
|
|
499
523
|
}
|
|
500
524
|
t.clear();
|
|
501
525
|
schedule();
|
|
@@ -505,7 +529,7 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
505
529
|
}
|
|
506
530
|
}
|
|
507
531
|
function checkBoundaryChildren(e) {
|
|
508
|
-
for (const t of e.
|
|
532
|
+
for (const t of e.oe) {
|
|
509
533
|
t.checkSources?.();
|
|
510
534
|
checkBoundaryChildren(t);
|
|
511
535
|
}
|
|
@@ -516,12 +540,12 @@ function trackOptimisticStore(e) {
|
|
|
516
540
|
}
|
|
517
541
|
function reassignPendingTransition(e) {
|
|
518
542
|
for (let t = 0; t < e.length; t++) {
|
|
519
|
-
e[t].
|
|
543
|
+
e[t].Z = activeTransition;
|
|
520
544
|
}
|
|
521
545
|
}
|
|
522
546
|
const globalQueue = new GlobalQueue();
|
|
523
547
|
function flush() {
|
|
524
|
-
if (globalQueue.
|
|
548
|
+
if (globalQueue.re) {
|
|
525
549
|
return;
|
|
526
550
|
}
|
|
527
551
|
while (scheduled || activeTransition) {
|
|
@@ -532,8 +556,8 @@ function runQueue(e, t) {
|
|
|
532
556
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
533
557
|
}
|
|
534
558
|
function reporterBlocksSource(e, t) {
|
|
535
|
-
if (e.
|
|
536
|
-
if (e.
|
|
559
|
+
if (e.R & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
|
|
560
|
+
if (e.Re === t || e._e?.has(t)) return true;
|
|
537
561
|
for (let n = e.C; n; n = n.D) {
|
|
538
562
|
let e = n.m;
|
|
539
563
|
while (e) {
|
|
@@ -541,11 +565,11 @@ function reporterBlocksSource(e, t) {
|
|
|
541
565
|
e = e.Ie;
|
|
542
566
|
}
|
|
543
567
|
}
|
|
544
|
-
return !!(e.
|
|
568
|
+
return !!(e.Oe & STATUS_PENDING && e.Te instanceof NotReadyError && e.Te.source === t);
|
|
545
569
|
}
|
|
546
570
|
function transitionComplete(e) {
|
|
547
571
|
if (e.Y) return true;
|
|
548
|
-
if (e.
|
|
572
|
+
if (e.B.length) return false;
|
|
549
573
|
let t = true;
|
|
550
574
|
for (const [n, i] of e.J) {
|
|
551
575
|
let r = false;
|
|
@@ -557,7 +581,7 @@ function transitionComplete(e) {
|
|
|
557
581
|
i.delete(e);
|
|
558
582
|
}
|
|
559
583
|
if (!r) e.J.delete(n);
|
|
560
|
-
else if (n.
|
|
584
|
+
else if (n.Oe & STATUS_PENDING && n.Te?.source === n) {
|
|
561
585
|
t = false;
|
|
562
586
|
break;
|
|
563
587
|
}
|
|
@@ -567,10 +591,10 @@ function transitionComplete(e) {
|
|
|
567
591
|
const i = e.q[n];
|
|
568
592
|
if (
|
|
569
593
|
hasActiveOverride(i) &&
|
|
570
|
-
"
|
|
571
|
-
i.
|
|
572
|
-
i.
|
|
573
|
-
i.
|
|
594
|
+
"Oe" in i &&
|
|
595
|
+
i.Oe & STATUS_PENDING &&
|
|
596
|
+
i.Te instanceof NotReadyError &&
|
|
597
|
+
i.Te.source !== i
|
|
574
598
|
) {
|
|
575
599
|
t = false;
|
|
576
600
|
break;
|
|
@@ -604,111 +628,112 @@ function getOrCreateLane(e) {
|
|
|
604
628
|
return findLane(t);
|
|
605
629
|
}
|
|
606
630
|
const n = e.Ie;
|
|
607
|
-
const i = n?.
|
|
608
|
-
t = {
|
|
631
|
+
const i = n?.te ? findLane(n.te) : null;
|
|
632
|
+
t = { ie: e, W: new Set(), H: [[], []], F: null, Z: activeTransition, he: i };
|
|
609
633
|
signalLanes.set(e, t);
|
|
610
634
|
activeLanes.add(t);
|
|
611
635
|
e.pe = false;
|
|
612
636
|
return t;
|
|
613
637
|
}
|
|
614
638
|
function findLane(e) {
|
|
615
|
-
while (e.
|
|
639
|
+
while (e.F) e = e.F;
|
|
616
640
|
return e;
|
|
617
641
|
}
|
|
618
642
|
function mergeLanes(e, t) {
|
|
619
643
|
e = findLane(e);
|
|
620
644
|
t = findLane(t);
|
|
621
645
|
if (e === t) return e;
|
|
622
|
-
t.
|
|
623
|
-
for (const n of t.
|
|
624
|
-
e.
|
|
625
|
-
e.
|
|
646
|
+
t.F = e;
|
|
647
|
+
for (const n of t.W) e.W.add(n);
|
|
648
|
+
e.H[0].push(...t.H[0]);
|
|
649
|
+
e.H[1].push(...t.H[1]);
|
|
626
650
|
return e;
|
|
627
651
|
}
|
|
628
652
|
function resolveLane(e) {
|
|
629
|
-
const t = e.
|
|
653
|
+
const t = e.te;
|
|
630
654
|
if (!t) return undefined;
|
|
631
655
|
const n = findLane(t);
|
|
632
656
|
if (activeLanes.has(n)) return n;
|
|
633
|
-
e.
|
|
657
|
+
e.te = undefined;
|
|
634
658
|
return undefined;
|
|
635
659
|
}
|
|
636
660
|
function resolveTransition(e) {
|
|
637
|
-
return resolveLane(e)?.
|
|
661
|
+
return resolveLane(e)?.Z ?? e.Z;
|
|
638
662
|
}
|
|
639
663
|
function hasActiveOverride(e) {
|
|
640
|
-
return !!(e.
|
|
664
|
+
return !!(e.G !== undefined && e.G !== NOT_PENDING);
|
|
641
665
|
}
|
|
642
666
|
function assignOrMergeLane(e, t) {
|
|
643
667
|
const n = findLane(t);
|
|
644
|
-
const i = e.
|
|
668
|
+
const i = e.te;
|
|
645
669
|
if (i) {
|
|
646
|
-
if (i.
|
|
647
|
-
e.
|
|
670
|
+
if (i.F) {
|
|
671
|
+
e.te = t;
|
|
648
672
|
return;
|
|
649
673
|
}
|
|
650
674
|
const r = findLane(i);
|
|
651
675
|
if (activeLanes.has(r)) {
|
|
652
676
|
if (r !== n && !hasActiveOverride(e)) {
|
|
653
677
|
if (n.he && findLane(n.he) === r) {
|
|
654
|
-
e.
|
|
678
|
+
e.te = t;
|
|
655
679
|
} else if (r.he && findLane(r.he) === n);
|
|
656
680
|
else mergeLanes(n, r);
|
|
657
681
|
}
|
|
658
682
|
return;
|
|
659
683
|
}
|
|
660
684
|
}
|
|
661
|
-
e.
|
|
685
|
+
e.te = t;
|
|
662
686
|
}
|
|
663
687
|
function unlinkSubs(e) {
|
|
664
688
|
const t = e.m;
|
|
665
689
|
const n = e.D;
|
|
666
690
|
const i = e.h;
|
|
667
|
-
const r = e.
|
|
668
|
-
if (i !== null) i.
|
|
669
|
-
else t.
|
|
691
|
+
const r = e.Ne;
|
|
692
|
+
if (i !== null) i.Ne = r;
|
|
693
|
+
else t.Ae = r;
|
|
670
694
|
if (r !== null) r.h = i;
|
|
671
695
|
else {
|
|
672
696
|
t.I = i;
|
|
673
697
|
if (i === null) {
|
|
674
|
-
t.
|
|
675
|
-
|
|
698
|
+
t.k?.();
|
|
699
|
+
const e = t;
|
|
700
|
+
e.L && e.Ee & CONFIG_AUTO_DISPOSE && !(e.R & REACTIVE_ZOMBIE) && unobserved(e);
|
|
676
701
|
}
|
|
677
702
|
}
|
|
678
703
|
return n;
|
|
679
704
|
}
|
|
680
705
|
function unobserved(e) {
|
|
681
|
-
deleteFromHeap(e, e.
|
|
706
|
+
deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
682
707
|
let t = e.C;
|
|
683
708
|
while (t !== null) {
|
|
684
709
|
t = unlinkSubs(t);
|
|
685
710
|
}
|
|
686
711
|
e.C = null;
|
|
687
|
-
e.
|
|
712
|
+
e.Pe = null;
|
|
688
713
|
disposeChildren(e, true);
|
|
689
714
|
}
|
|
690
715
|
function link(e, t) {
|
|
691
|
-
const n = t.
|
|
716
|
+
const n = t.Pe;
|
|
692
717
|
if (n !== null && n.m === e) return;
|
|
693
718
|
let i = null;
|
|
694
|
-
const r = t.
|
|
719
|
+
const r = t.R & REACTIVE_RECOMPUTING_DEPS;
|
|
695
720
|
if (r) {
|
|
696
721
|
i = n !== null ? n.D : t.C;
|
|
697
722
|
if (i !== null && i.m === e) {
|
|
698
|
-
t.
|
|
723
|
+
t.Pe = i;
|
|
699
724
|
return;
|
|
700
725
|
}
|
|
701
726
|
}
|
|
702
|
-
const s = e.
|
|
727
|
+
const s = e.Ae;
|
|
703
728
|
if (s !== null && s.p === t && (!r || isValidLink(s, t))) return;
|
|
704
|
-
const o = (t.
|
|
729
|
+
const o = (t.Pe = e.Ae = { m: e, p: t, D: i, Ne: s, h: null });
|
|
705
730
|
if (n !== null) n.D = o;
|
|
706
731
|
else t.C = o;
|
|
707
732
|
if (s !== null) s.h = o;
|
|
708
733
|
else e.I = o;
|
|
709
734
|
}
|
|
710
735
|
function isValidLink(e, t) {
|
|
711
|
-
const n = t.
|
|
736
|
+
const n = t.Pe;
|
|
712
737
|
if (n !== null) {
|
|
713
738
|
let i = t.C;
|
|
714
739
|
do {
|
|
@@ -723,13 +748,13 @@ const PENDING_OWNER = {};
|
|
|
723
748
|
function markDisposal(e) {
|
|
724
749
|
let t = e.Ce;
|
|
725
750
|
while (t) {
|
|
726
|
-
t.
|
|
727
|
-
if (t.
|
|
751
|
+
t.R |= REACTIVE_ZOMBIE;
|
|
752
|
+
if (t.R & REACTIVE_IN_HEAP) {
|
|
728
753
|
deleteFromHeap(t, dirtyQueue);
|
|
729
754
|
insertIntoHeap(t, zombieQueue);
|
|
730
755
|
}
|
|
731
756
|
markDisposal(t);
|
|
732
|
-
t = t.
|
|
757
|
+
t = t.ge;
|
|
733
758
|
}
|
|
734
759
|
}
|
|
735
760
|
function dispose(e) {
|
|
@@ -738,39 +763,39 @@ function dispose(e) {
|
|
|
738
763
|
t = unlinkSubs(t);
|
|
739
764
|
} while (t !== null);
|
|
740
765
|
e.C = null;
|
|
741
|
-
e.
|
|
766
|
+
e.Pe = null;
|
|
742
767
|
disposeChildren(e, true);
|
|
743
768
|
}
|
|
744
769
|
function disposeChildren(e, t = false, n) {
|
|
745
|
-
if (e.
|
|
746
|
-
if (t) e.
|
|
747
|
-
if (t && e.L) e.
|
|
748
|
-
let i = n ? e.
|
|
770
|
+
if (e.R & REACTIVE_DISPOSED) return;
|
|
771
|
+
if (t) e.R = REACTIVE_DISPOSED;
|
|
772
|
+
if (t && e.L) e.De = null;
|
|
773
|
+
let i = n ? e.ye : e.Ce;
|
|
749
774
|
while (i) {
|
|
750
|
-
const e = i.
|
|
775
|
+
const e = i.ge;
|
|
751
776
|
if (i.C) {
|
|
752
777
|
const e = i;
|
|
753
|
-
deleteFromHeap(e, e.
|
|
778
|
+
deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
754
779
|
let t = e.C;
|
|
755
780
|
do {
|
|
756
781
|
t = unlinkSubs(t);
|
|
757
782
|
} while (t !== null);
|
|
758
783
|
e.C = null;
|
|
759
|
-
e.
|
|
784
|
+
e.Pe = null;
|
|
760
785
|
}
|
|
761
786
|
disposeChildren(i, true);
|
|
762
787
|
i = e;
|
|
763
788
|
}
|
|
764
789
|
if (n) {
|
|
765
|
-
e.
|
|
790
|
+
e.ye = null;
|
|
766
791
|
} else {
|
|
767
792
|
e.Ce = null;
|
|
768
|
-
e.
|
|
793
|
+
e.ve = 0;
|
|
769
794
|
}
|
|
770
795
|
runDisposal(e, n);
|
|
771
796
|
}
|
|
772
797
|
function runDisposal(e, t) {
|
|
773
|
-
let n = t ? e.
|
|
798
|
+
let n = t ? e.me : e.we;
|
|
774
799
|
if (!n) return;
|
|
775
800
|
if (Array.isArray(n)) {
|
|
776
801
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -780,12 +805,12 @@ function runDisposal(e, t) {
|
|
|
780
805
|
} else {
|
|
781
806
|
n.call(n);
|
|
782
807
|
}
|
|
783
|
-
t ? (e.
|
|
808
|
+
t ? (e.me = null) : (e.we = null);
|
|
784
809
|
}
|
|
785
810
|
function childId(e, t) {
|
|
786
811
|
let n = e;
|
|
787
|
-
while (n.
|
|
788
|
-
if (n.id != null) return formatId(n.id, t ? n.
|
|
812
|
+
while (n.Ee & CONFIG_TRANSPARENT && n.i) n = n.i;
|
|
813
|
+
if (n.id != null) return formatId(n.id, t ? n.ve++ : n.ve);
|
|
789
814
|
throw new Error("Cannot get child id from owner without an id");
|
|
790
815
|
}
|
|
791
816
|
function getNextChildId(e) {
|
|
@@ -808,30 +833,30 @@ function getOwner() {
|
|
|
808
833
|
}
|
|
809
834
|
function cleanup(e) {
|
|
810
835
|
if (!context) return e;
|
|
811
|
-
if (!context.
|
|
812
|
-
else if (Array.isArray(context.
|
|
813
|
-
else context.
|
|
836
|
+
if (!context.we) context.we = e;
|
|
837
|
+
else if (Array.isArray(context.we)) context.we.push(e);
|
|
838
|
+
else context.we = [context.we, e];
|
|
814
839
|
return e;
|
|
815
840
|
}
|
|
816
841
|
function isDisposed(e) {
|
|
817
|
-
return !!(e.
|
|
842
|
+
return !!(e.R & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
|
|
818
843
|
}
|
|
819
844
|
function createOwner(e) {
|
|
820
845
|
const t = context;
|
|
821
846
|
const n = e?.transparent ?? false;
|
|
822
847
|
const i = {
|
|
823
848
|
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
824
|
-
|
|
849
|
+
Ee: n ? CONFIG_TRANSPARENT : 0,
|
|
825
850
|
t: true,
|
|
826
851
|
u: t?.t ? t.u : t,
|
|
827
852
|
Ce: null,
|
|
828
|
-
|
|
829
|
-
Ve: null,
|
|
830
|
-
$: t?.$ ?? globalQueue,
|
|
831
|
-
Le: t?.Le || defaultContext,
|
|
832
|
-
me: 0,
|
|
853
|
+
ge: null,
|
|
833
854
|
we: null,
|
|
834
|
-
|
|
855
|
+
$: t?.$ ?? globalQueue,
|
|
856
|
+
Ve: t?.Ve || defaultContext,
|
|
857
|
+
ve: 0,
|
|
858
|
+
me: null,
|
|
859
|
+
ye: null,
|
|
835
860
|
i: t,
|
|
836
861
|
dispose(e = true) {
|
|
837
862
|
disposeChildren(i, e);
|
|
@@ -842,7 +867,7 @@ function createOwner(e) {
|
|
|
842
867
|
if (e === null) {
|
|
843
868
|
t.Ce = i;
|
|
844
869
|
} else {
|
|
845
|
-
i.
|
|
870
|
+
i.ge = e;
|
|
846
871
|
t.Ce = i;
|
|
847
872
|
}
|
|
848
873
|
}
|
|
@@ -853,28 +878,28 @@ function createRoot(e, t) {
|
|
|
853
878
|
return runWithOwner(n, () => e(n.dispose));
|
|
854
879
|
}
|
|
855
880
|
function addPendingSource(e, t) {
|
|
856
|
-
if (e.
|
|
857
|
-
if (!e.
|
|
858
|
-
e.
|
|
881
|
+
if (e.Re === t || e._e?.has(t)) return false;
|
|
882
|
+
if (!e.Re) {
|
|
883
|
+
e.Re = t;
|
|
859
884
|
return true;
|
|
860
885
|
}
|
|
861
886
|
if (!e._e) {
|
|
862
|
-
e._e = new Set([e.
|
|
887
|
+
e._e = new Set([e.Re, t]);
|
|
863
888
|
} else {
|
|
864
889
|
e._e.add(t);
|
|
865
890
|
}
|
|
866
|
-
e.
|
|
891
|
+
e.Re = undefined;
|
|
867
892
|
return true;
|
|
868
893
|
}
|
|
869
894
|
function removePendingSource(e, t) {
|
|
870
|
-
if (e.
|
|
871
|
-
if (e.
|
|
872
|
-
e.
|
|
895
|
+
if (e.Re) {
|
|
896
|
+
if (e.Re !== t) return false;
|
|
897
|
+
e.Re = undefined;
|
|
873
898
|
return true;
|
|
874
899
|
}
|
|
875
900
|
if (!e._e?.delete(t)) return false;
|
|
876
901
|
if (e._e.size === 1) {
|
|
877
|
-
e.
|
|
902
|
+
e.Re = e._e.values().next().value;
|
|
878
903
|
e._e = undefined;
|
|
879
904
|
} else if (e._e.size === 0) {
|
|
880
905
|
e._e = undefined;
|
|
@@ -882,27 +907,27 @@ function removePendingSource(e, t) {
|
|
|
882
907
|
return true;
|
|
883
908
|
}
|
|
884
909
|
function clearPendingSources(e) {
|
|
885
|
-
e.
|
|
910
|
+
e.Re = undefined;
|
|
886
911
|
e._e?.clear();
|
|
887
912
|
e._e = undefined;
|
|
888
913
|
}
|
|
889
914
|
function setPendingError(e, t, n) {
|
|
890
915
|
if (!t) {
|
|
891
|
-
e.
|
|
916
|
+
e.Te = null;
|
|
892
917
|
return;
|
|
893
918
|
}
|
|
894
919
|
if (n instanceof NotReadyError && n.source === t) {
|
|
895
|
-
e.
|
|
920
|
+
e.Te = n;
|
|
896
921
|
return;
|
|
897
922
|
}
|
|
898
|
-
const i = e.
|
|
923
|
+
const i = e.Te;
|
|
899
924
|
if (!(i instanceof NotReadyError) || i.source !== t) {
|
|
900
|
-
e.
|
|
925
|
+
e.Te = new NotReadyError(t);
|
|
901
926
|
}
|
|
902
927
|
}
|
|
903
928
|
function forEachDependent(e, t) {
|
|
904
929
|
for (let n = e.I; n !== null; n = n.h) t(n.p);
|
|
905
|
-
for (let n = e.
|
|
930
|
+
for (let n = e.N; n !== null; n = n.A) {
|
|
906
931
|
for (let e = n.I; e !== null; e = e.h) t(e.p);
|
|
907
932
|
}
|
|
908
933
|
}
|
|
@@ -912,30 +937,30 @@ function settlePendingSource(e) {
|
|
|
912
937
|
const settle = i => {
|
|
913
938
|
if (n.has(i) || !removePendingSource(i, e)) return;
|
|
914
939
|
n.add(i);
|
|
915
|
-
i.
|
|
916
|
-
const r = i.
|
|
940
|
+
i.Se = clock;
|
|
941
|
+
const r = i.Re ?? i._e?.values().next().value;
|
|
917
942
|
if (r) {
|
|
918
943
|
setPendingError(i, r);
|
|
919
944
|
updatePendingSignal(i);
|
|
920
945
|
} else {
|
|
921
|
-
i.
|
|
946
|
+
i.Oe &= ~STATUS_PENDING;
|
|
922
947
|
setPendingError(i);
|
|
923
948
|
updatePendingSignal(i);
|
|
924
|
-
if (i.
|
|
925
|
-
if (i.
|
|
949
|
+
if (i.be) {
|
|
950
|
+
if (i.M === EFFECT_TRACKED) {
|
|
926
951
|
const e = i;
|
|
927
952
|
if (!e.j) {
|
|
928
953
|
e.j = true;
|
|
929
954
|
e.$.enqueue(EFFECT_USER, e.K);
|
|
930
955
|
}
|
|
931
956
|
} else {
|
|
932
|
-
const e = i.
|
|
957
|
+
const e = i.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
933
958
|
if (e.P > i.o) e.P = i.o;
|
|
934
959
|
insertIntoHeap(i, e);
|
|
935
960
|
}
|
|
936
961
|
t = true;
|
|
937
962
|
}
|
|
938
|
-
i.
|
|
963
|
+
i.be = false;
|
|
939
964
|
}
|
|
940
965
|
forEachDependent(i, settle);
|
|
941
966
|
};
|
|
@@ -947,42 +972,42 @@ function handleAsync(e, t, n) {
|
|
|
947
972
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
948
973
|
const s = !r && i && untrack(() => typeof t.then === "function");
|
|
949
974
|
if (!s && !r) {
|
|
950
|
-
e.
|
|
975
|
+
e.De = null;
|
|
951
976
|
return t;
|
|
952
977
|
}
|
|
953
|
-
e.
|
|
978
|
+
e.De = t;
|
|
954
979
|
let o;
|
|
955
980
|
const handleError = n => {
|
|
956
|
-
if (e.
|
|
981
|
+
if (e.De !== t) return;
|
|
957
982
|
globalQueue.initTransition(resolveTransition(e));
|
|
958
983
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
959
|
-
e.
|
|
984
|
+
e.Se = clock;
|
|
960
985
|
};
|
|
961
986
|
const asyncWrite = (i, r) => {
|
|
962
|
-
if (e.
|
|
963
|
-
if (e.
|
|
987
|
+
if (e.De !== t) return;
|
|
988
|
+
if (e.R & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
964
989
|
globalQueue.initTransition(resolveTransition(e));
|
|
965
|
-
const s = !!(e.
|
|
990
|
+
const s = !!(e.Oe & STATUS_UNINITIALIZED);
|
|
966
991
|
clearStatus(e);
|
|
967
992
|
const o = resolveLane(e);
|
|
968
|
-
if (o) o.
|
|
993
|
+
if (o) o.W.delete(e);
|
|
969
994
|
if (n) n(i);
|
|
970
|
-
else if (e.
|
|
971
|
-
if (e.
|
|
995
|
+
else if (e.G !== undefined) {
|
|
996
|
+
if (e.G !== undefined && e.G !== NOT_PENDING) e.U = i;
|
|
972
997
|
else {
|
|
973
|
-
e.
|
|
998
|
+
e.ne = i;
|
|
974
999
|
insertSubs(e);
|
|
975
1000
|
}
|
|
976
|
-
e.
|
|
1001
|
+
e.Se = clock;
|
|
977
1002
|
} else if (o) {
|
|
978
|
-
const t = e.
|
|
979
|
-
const n = e.
|
|
980
|
-
const r = e.
|
|
1003
|
+
const t = e.M;
|
|
1004
|
+
const n = e.ne;
|
|
1005
|
+
const r = e.Le;
|
|
981
1006
|
if ((!t && s) || !r || !r(i, n)) {
|
|
982
|
-
e.
|
|
983
|
-
e.
|
|
984
|
-
if (e.
|
|
985
|
-
setSignal(e.
|
|
1007
|
+
e.ne = i;
|
|
1008
|
+
e.Se = clock;
|
|
1009
|
+
if (e.Ue) {
|
|
1010
|
+
setSignal(e.Ue, i);
|
|
986
1011
|
}
|
|
987
1012
|
insertSubs(e, true);
|
|
988
1013
|
}
|
|
@@ -1038,7 +1063,7 @@ function handleAsync(e, t, n) {
|
|
|
1038
1063
|
s = n;
|
|
1039
1064
|
u = true;
|
|
1040
1065
|
if (n.done) r = true;
|
|
1041
|
-
} else if (e.
|
|
1066
|
+
} else if (e.De !== t) {
|
|
1042
1067
|
return;
|
|
1043
1068
|
} else if (!n.done) asyncWrite(n.value, iterate);
|
|
1044
1069
|
else {
|
|
@@ -1048,7 +1073,7 @@ function handleAsync(e, t, n) {
|
|
|
1048
1073
|
}
|
|
1049
1074
|
},
|
|
1050
1075
|
n => {
|
|
1051
|
-
if (!c && e.
|
|
1076
|
+
if (!c && e.De === t) {
|
|
1052
1077
|
r = true;
|
|
1053
1078
|
handleError(n);
|
|
1054
1079
|
}
|
|
@@ -1072,28 +1097,28 @@ function handleAsync(e, t, n) {
|
|
|
1072
1097
|
}
|
|
1073
1098
|
function clearStatus(e, t = false) {
|
|
1074
1099
|
clearPendingSources(e);
|
|
1075
|
-
e.
|
|
1076
|
-
e.
|
|
1100
|
+
e.be = false;
|
|
1101
|
+
e.Oe = t ? 0 : e.Oe & STATUS_UNINITIALIZED;
|
|
1077
1102
|
setPendingError(e);
|
|
1078
1103
|
updatePendingSignal(e);
|
|
1079
|
-
e.
|
|
1104
|
+
e.Ge?.();
|
|
1080
1105
|
}
|
|
1081
1106
|
function notifyStatus(e, t, n, i, r) {
|
|
1082
1107
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
1083
1108
|
n = new StatusError(e, n);
|
|
1084
1109
|
const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
1085
1110
|
const o = s === e;
|
|
1086
|
-
const u = t === STATUS_PENDING && e.
|
|
1111
|
+
const u = t === STATUS_PENDING && e.G !== undefined && !o;
|
|
1087
1112
|
const c = u && hasActiveOverride(e);
|
|
1088
1113
|
if (!i) {
|
|
1089
1114
|
if (t === STATUS_PENDING && s) {
|
|
1090
1115
|
addPendingSource(e, s);
|
|
1091
|
-
e.
|
|
1116
|
+
e.Oe = STATUS_PENDING | (e.Oe & STATUS_UNINITIALIZED);
|
|
1092
1117
|
setPendingError(e, s, n);
|
|
1093
1118
|
} else {
|
|
1094
1119
|
clearPendingSources(e);
|
|
1095
|
-
e.
|
|
1096
|
-
e.
|
|
1120
|
+
e.Oe = t | (t !== STATUS_ERROR ? e.Oe & STATUS_UNINITIALIZED : 0);
|
|
1121
|
+
e.Te = n;
|
|
1097
1122
|
}
|
|
1098
1123
|
updatePendingSignal(e);
|
|
1099
1124
|
}
|
|
@@ -1102,24 +1127,24 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
1102
1127
|
}
|
|
1103
1128
|
const a = i || c;
|
|
1104
1129
|
const l = i || u ? undefined : r;
|
|
1105
|
-
if (e.
|
|
1130
|
+
if (e.Ge) {
|
|
1106
1131
|
if (i && t === STATUS_PENDING) {
|
|
1107
1132
|
return;
|
|
1108
1133
|
}
|
|
1109
1134
|
if (a) {
|
|
1110
|
-
e.
|
|
1135
|
+
e.Ge(t, n);
|
|
1111
1136
|
} else {
|
|
1112
|
-
e.
|
|
1137
|
+
e.Ge();
|
|
1113
1138
|
}
|
|
1114
1139
|
return;
|
|
1115
1140
|
}
|
|
1116
1141
|
forEachDependent(e, e => {
|
|
1117
|
-
e.
|
|
1142
|
+
e.Se = clock;
|
|
1118
1143
|
if (
|
|
1119
|
-
(t === STATUS_PENDING && s && e.
|
|
1120
|
-
(t !== STATUS_PENDING && (e.
|
|
1144
|
+
(t === STATUS_PENDING && s && e.Re !== s && !e._e?.has(s)) ||
|
|
1145
|
+
(t !== STATUS_PENDING && (e.Te !== n || e.Re || e._e))
|
|
1121
1146
|
) {
|
|
1122
|
-
if (!a && !e.
|
|
1147
|
+
if (!a && !e.Z) globalQueue.ue.push(e);
|
|
1123
1148
|
notifyStatus(e, t, n, a, l);
|
|
1124
1149
|
}
|
|
1125
1150
|
});
|
|
@@ -1147,8 +1172,8 @@ function enableExternalSource(e) {
|
|
|
1147
1172
|
externalSourceConfig = { factory: t, untrack: n };
|
|
1148
1173
|
}
|
|
1149
1174
|
}
|
|
1150
|
-
GlobalQueue.
|
|
1151
|
-
GlobalQueue.
|
|
1175
|
+
GlobalQueue.ce = recompute;
|
|
1176
|
+
GlobalQueue.ae = disposeChildren;
|
|
1152
1177
|
let tracking = false;
|
|
1153
1178
|
let stale = false;
|
|
1154
1179
|
let refreshing = false;
|
|
@@ -1161,7 +1186,7 @@ let snapshotCaptureActive = false;
|
|
|
1161
1186
|
let snapshotSources = null;
|
|
1162
1187
|
function ownerInSnapshotScope(e) {
|
|
1163
1188
|
while (e) {
|
|
1164
|
-
if (e.
|
|
1189
|
+
if (e.ke) return true;
|
|
1165
1190
|
e = e.i;
|
|
1166
1191
|
}
|
|
1167
1192
|
return false;
|
|
@@ -1171,38 +1196,38 @@ function setSnapshotCapture(e) {
|
|
|
1171
1196
|
if (e && !snapshotSources) snapshotSources = new Set();
|
|
1172
1197
|
}
|
|
1173
1198
|
function markSnapshotScope(e) {
|
|
1174
|
-
e.
|
|
1199
|
+
e.ke = true;
|
|
1175
1200
|
}
|
|
1176
1201
|
function releaseSnapshotScope(e) {
|
|
1177
|
-
e.
|
|
1202
|
+
e.ke = false;
|
|
1178
1203
|
releaseSubtree(e);
|
|
1179
1204
|
schedule();
|
|
1180
1205
|
}
|
|
1181
1206
|
function releaseSubtree(e) {
|
|
1182
1207
|
let t = e.Ce;
|
|
1183
1208
|
while (t) {
|
|
1184
|
-
if (t.
|
|
1185
|
-
t = t.
|
|
1209
|
+
if (t.ke) {
|
|
1210
|
+
t = t.ge;
|
|
1186
1211
|
continue;
|
|
1187
1212
|
}
|
|
1188
1213
|
if (t.L) {
|
|
1189
1214
|
const e = t;
|
|
1190
|
-
e.
|
|
1191
|
-
if (e.
|
|
1192
|
-
e.
|
|
1193
|
-
e.
|
|
1215
|
+
e.Ee &= ~CONFIG_IN_SNAPSHOT_SCOPE;
|
|
1216
|
+
if (e.R & REACTIVE_SNAPSHOT_STALE) {
|
|
1217
|
+
e.R &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1218
|
+
e.R |= REACTIVE_DIRTY;
|
|
1194
1219
|
if (dirtyQueue.P > e.o) dirtyQueue.P = e.o;
|
|
1195
1220
|
insertIntoHeap(e, dirtyQueue);
|
|
1196
1221
|
}
|
|
1197
1222
|
}
|
|
1198
1223
|
releaseSubtree(t);
|
|
1199
|
-
t = t.
|
|
1224
|
+
t = t.ge;
|
|
1200
1225
|
}
|
|
1201
1226
|
}
|
|
1202
1227
|
function clearSnapshots() {
|
|
1203
1228
|
if (snapshotSources) {
|
|
1204
1229
|
for (const e of snapshotSources) {
|
|
1205
|
-
delete e.
|
|
1230
|
+
delete e.de;
|
|
1206
1231
|
delete e[STORE_SNAPSHOT_PROPS];
|
|
1207
1232
|
}
|
|
1208
1233
|
snapshotSources = null;
|
|
@@ -1210,32 +1235,32 @@ function clearSnapshots() {
|
|
|
1210
1235
|
snapshotCaptureActive = false;
|
|
1211
1236
|
}
|
|
1212
1237
|
function recompute(e, t = false) {
|
|
1213
|
-
const n = e.
|
|
1238
|
+
const n = e.M;
|
|
1214
1239
|
if (!t) {
|
|
1215
|
-
if (e.
|
|
1216
|
-
globalQueue.initTransition(e.
|
|
1217
|
-
deleteFromHeap(e, e.
|
|
1218
|
-
e.
|
|
1219
|
-
if (e.
|
|
1240
|
+
if (e.Z && (!n || activeTransition) && activeTransition !== e.Z)
|
|
1241
|
+
globalQueue.initTransition(e.Z);
|
|
1242
|
+
deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1243
|
+
e.De = null;
|
|
1244
|
+
if (e.Z || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1220
1245
|
else {
|
|
1221
1246
|
markDisposal(e);
|
|
1222
|
-
e.
|
|
1223
|
-
e.
|
|
1224
|
-
e.
|
|
1247
|
+
e.me = e.we;
|
|
1248
|
+
e.ye = e.Ce;
|
|
1249
|
+
e.we = null;
|
|
1225
1250
|
e.Ce = null;
|
|
1226
|
-
e.
|
|
1251
|
+
e.ve = 0;
|
|
1227
1252
|
}
|
|
1228
1253
|
}
|
|
1229
|
-
|
|
1230
|
-
const r = e.
|
|
1231
|
-
const s = !!(e.
|
|
1232
|
-
const o = !!(e.
|
|
1254
|
+
let i = !!(e.R & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1255
|
+
const r = e.G !== undefined && e.G !== NOT_PENDING;
|
|
1256
|
+
const s = !!(e.Oe & STATUS_PENDING);
|
|
1257
|
+
const o = !!(e.Oe & STATUS_UNINITIALIZED);
|
|
1233
1258
|
const u = context;
|
|
1234
1259
|
context = e;
|
|
1235
|
-
e.
|
|
1236
|
-
e.
|
|
1237
|
-
e.
|
|
1238
|
-
let c = e.U === NOT_PENDING ? e.
|
|
1260
|
+
e.Pe = null;
|
|
1261
|
+
e.R = REACTIVE_RECOMPUTING_DEPS;
|
|
1262
|
+
e.Se = clock;
|
|
1263
|
+
let c = e.U === NOT_PENDING ? e.ne : e.U;
|
|
1239
1264
|
let a = e.o;
|
|
1240
1265
|
let l = tracking;
|
|
1241
1266
|
let f = currentOptimisticLane;
|
|
@@ -1243,41 +1268,55 @@ function recompute(e, t = false) {
|
|
|
1243
1268
|
if (i) {
|
|
1244
1269
|
const t = resolveLane(e);
|
|
1245
1270
|
if (t) currentOptimisticLane = t;
|
|
1271
|
+
} else if (activeTransition && !t && activeTransition.q.length) {
|
|
1272
|
+
for (let t = e.C; t; t = t.D) {
|
|
1273
|
+
const n = t.m;
|
|
1274
|
+
if (n.R & REACTIVE_OPTIMISTIC_DIRTY) {
|
|
1275
|
+
const t = resolveLane(n);
|
|
1276
|
+
if (t) {
|
|
1277
|
+
i = true;
|
|
1278
|
+
currentOptimisticLane = t;
|
|
1279
|
+
e.R |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
1280
|
+
assignOrMergeLane(e, t);
|
|
1281
|
+
break;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1246
1285
|
}
|
|
1247
1286
|
try {
|
|
1248
|
-
const n = e.
|
|
1287
|
+
const n = e.De;
|
|
1249
1288
|
const i = e.L(c);
|
|
1250
|
-
c = e.
|
|
1289
|
+
c = e.De !== n ? i : handleAsync(e, i);
|
|
1251
1290
|
clearStatus(e, t);
|
|
1252
1291
|
const r = resolveLane(e);
|
|
1253
1292
|
if (r) {
|
|
1254
|
-
r.
|
|
1255
|
-
updatePendingSignal(r.
|
|
1293
|
+
r.W.delete(e);
|
|
1294
|
+
updatePendingSignal(r.ie);
|
|
1256
1295
|
}
|
|
1257
1296
|
} catch (t) {
|
|
1258
1297
|
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
1259
1298
|
const t = findLane(currentOptimisticLane);
|
|
1260
|
-
if (t.
|
|
1261
|
-
t.
|
|
1262
|
-
e.
|
|
1263
|
-
updatePendingSignal(t.
|
|
1299
|
+
if (t.ie !== e) {
|
|
1300
|
+
t.W.add(e);
|
|
1301
|
+
e.te = t;
|
|
1302
|
+
updatePendingSignal(t.ie);
|
|
1264
1303
|
}
|
|
1265
1304
|
}
|
|
1266
|
-
if (t instanceof NotReadyError) e.
|
|
1305
|
+
if (t instanceof NotReadyError) e.be = true;
|
|
1267
1306
|
notifyStatus(
|
|
1268
1307
|
e,
|
|
1269
1308
|
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
1270
1309
|
t,
|
|
1271
1310
|
undefined,
|
|
1272
|
-
t instanceof NotReadyError ? e.
|
|
1311
|
+
t instanceof NotReadyError ? e.te : undefined
|
|
1273
1312
|
);
|
|
1274
1313
|
} finally {
|
|
1275
1314
|
tracking = l;
|
|
1276
|
-
e.
|
|
1315
|
+
e.R = REACTIVE_NONE | (t ? e.R & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1277
1316
|
context = u;
|
|
1278
1317
|
}
|
|
1279
|
-
if (!e.
|
|
1280
|
-
const u = e.
|
|
1318
|
+
if (!e.Te) {
|
|
1319
|
+
const u = e.Pe;
|
|
1281
1320
|
let l = u !== null ? u.D : e.C;
|
|
1282
1321
|
if (l !== null) {
|
|
1283
1322
|
do {
|
|
@@ -1286,82 +1325,85 @@ function recompute(e, t = false) {
|
|
|
1286
1325
|
if (u !== null) u.D = null;
|
|
1287
1326
|
else e.C = null;
|
|
1288
1327
|
}
|
|
1289
|
-
const f = r ? e.
|
|
1290
|
-
const E = (!n && o) || !e.
|
|
1328
|
+
const f = r ? e.G : e.U === NOT_PENDING ? e.ne : e.U;
|
|
1329
|
+
const E = (!n && o) || !e.Le || !e.Le(f, c);
|
|
1291
1330
|
if (E) {
|
|
1292
|
-
const o = r ? e.
|
|
1293
|
-
if (t || (n && activeTransition !== e.
|
|
1294
|
-
e.
|
|
1331
|
+
const o = r ? e.G : undefined;
|
|
1332
|
+
if (t || (n && activeTransition !== e.Z) || i) {
|
|
1333
|
+
e.ne = c;
|
|
1295
1334
|
if (r && i) {
|
|
1296
|
-
e.
|
|
1335
|
+
e.G = c;
|
|
1297
1336
|
e.U = c;
|
|
1298
1337
|
}
|
|
1299
1338
|
} else e.U = c;
|
|
1300
|
-
if (r && !i && s && !e.pe) e.
|
|
1301
|
-
if (!r || i || e.
|
|
1339
|
+
if (r && !i && s && !e.pe) e.G = c;
|
|
1340
|
+
if (!r || i || e.G !== o) insertSubs(e, i || r);
|
|
1302
1341
|
} else if (r) {
|
|
1303
1342
|
e.U = c;
|
|
1304
1343
|
} else if (e.o != a) {
|
|
1305
1344
|
for (let t = e.I; t !== null; t = t.h) {
|
|
1306
|
-
insertIntoHeapHeight(t.p, t.p.
|
|
1345
|
+
insertIntoHeapHeight(t.p, t.p.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1307
1346
|
}
|
|
1308
1347
|
}
|
|
1309
1348
|
}
|
|
1310
1349
|
currentOptimisticLane = f;
|
|
1311
|
-
(!t || e.
|
|
1312
|
-
e.
|
|
1350
|
+
(!t || e.Oe & STATUS_PENDING) && !e.Z && !(activeTransition && r) && globalQueue.ue.push(e);
|
|
1351
|
+
e.Z && n && activeTransition !== e.Z && runInTransition(e.Z, () => recompute(e));
|
|
1313
1352
|
}
|
|
1314
1353
|
function updateIfNecessary(e) {
|
|
1315
|
-
if (e.
|
|
1354
|
+
if (e.R & REACTIVE_CHECK) {
|
|
1316
1355
|
for (let t = e.C; t; t = t.D) {
|
|
1317
1356
|
const n = t.m;
|
|
1318
1357
|
const i = n.V || n;
|
|
1319
1358
|
if (i.L) {
|
|
1320
1359
|
updateIfNecessary(i);
|
|
1321
1360
|
}
|
|
1322
|
-
if (e.
|
|
1361
|
+
if (e.R & REACTIVE_DIRTY) {
|
|
1323
1362
|
break;
|
|
1324
1363
|
}
|
|
1325
1364
|
}
|
|
1326
1365
|
}
|
|
1327
|
-
if (e.
|
|
1366
|
+
if (e.R & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.Te && e.Se < clock && !e.De)) {
|
|
1328
1367
|
recompute(e);
|
|
1329
1368
|
}
|
|
1330
|
-
e.
|
|
1369
|
+
e.R = e.R & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
|
|
1331
1370
|
}
|
|
1332
1371
|
function computed(e, t) {
|
|
1333
1372
|
const n = t?.transparent ?? false;
|
|
1334
1373
|
const i = {
|
|
1335
1374
|
id: t?.id ?? (n ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1375
|
+
Ee:
|
|
1376
|
+
(n ? CONFIG_TRANSPARENT : 0) |
|
|
1377
|
+
(t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
|
|
1378
|
+
(!context || t?.lazy ? CONFIG_AUTO_DISPOSE : 0) |
|
|
1379
|
+
(snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
|
|
1380
|
+
Le: t?.equals != null ? t.equals : isEqual,
|
|
1381
|
+
k: t?.unobserved,
|
|
1382
|
+
we: null,
|
|
1341
1383
|
$: context?.$ ?? globalQueue,
|
|
1342
|
-
|
|
1343
|
-
|
|
1384
|
+
Ve: context?.Ve ?? defaultContext,
|
|
1385
|
+
ve: 0,
|
|
1344
1386
|
L: e,
|
|
1345
|
-
|
|
1387
|
+
ne: undefined,
|
|
1346
1388
|
o: 0,
|
|
1347
|
-
|
|
1389
|
+
N: null,
|
|
1348
1390
|
S: undefined,
|
|
1349
1391
|
T: null,
|
|
1350
1392
|
C: null,
|
|
1351
|
-
|
|
1393
|
+
Pe: null,
|
|
1352
1394
|
I: null,
|
|
1353
|
-
|
|
1395
|
+
Ae: null,
|
|
1354
1396
|
i: context,
|
|
1355
|
-
|
|
1397
|
+
ge: null,
|
|
1356
1398
|
Ce: null,
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1399
|
+
R: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1400
|
+
Oe: STATUS_UNINITIALIZED,
|
|
1401
|
+
Se: clock,
|
|
1360
1402
|
U: NOT_PENDING,
|
|
1361
|
-
|
|
1362
|
-
ve: null,
|
|
1403
|
+
me: null,
|
|
1363
1404
|
ye: null,
|
|
1364
|
-
|
|
1405
|
+
De: null,
|
|
1406
|
+
Z: null
|
|
1365
1407
|
};
|
|
1366
1408
|
i.T = i;
|
|
1367
1409
|
const r = context?.t ? context.u : context;
|
|
@@ -1370,12 +1412,11 @@ function computed(e, t) {
|
|
|
1370
1412
|
if (e === null) {
|
|
1371
1413
|
context.Ce = i;
|
|
1372
1414
|
} else {
|
|
1373
|
-
i.
|
|
1415
|
+
i.ge = e;
|
|
1374
1416
|
context.Ce = i;
|
|
1375
1417
|
}
|
|
1376
1418
|
}
|
|
1377
1419
|
if (r) i.o = r.o + 1;
|
|
1378
|
-
if (snapshotCaptureActive && ownerInSnapshotScope(context)) i.Se = true;
|
|
1379
1420
|
if (externalSourceConfig) {
|
|
1380
1421
|
const e = signal(undefined, { equals: false, ownedWrite: true });
|
|
1381
1422
|
const t = externalSourceConfig.factory(i.L, () => {
|
|
@@ -1389,8 +1430,8 @@ function computed(e, t) {
|
|
|
1389
1430
|
}
|
|
1390
1431
|
!t?.lazy && recompute(i, true);
|
|
1391
1432
|
if (snapshotCaptureActive && !t?.lazy) {
|
|
1392
|
-
if (!(i.
|
|
1393
|
-
i.
|
|
1433
|
+
if (!(i.Oe & STATUS_PENDING)) {
|
|
1434
|
+
i.de = i.ne === undefined ? NO_SNAPSHOT : i.ne;
|
|
1394
1435
|
snapshotSources.add(i);
|
|
1395
1436
|
}
|
|
1396
1437
|
}
|
|
@@ -1398,33 +1439,32 @@ function computed(e, t) {
|
|
|
1398
1439
|
}
|
|
1399
1440
|
function signal(e, t, n = null) {
|
|
1400
1441
|
const i = {
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
te: e,
|
|
1442
|
+
Le: t?.equals != null ? t.equals : isEqual,
|
|
1443
|
+
Ee: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.Fe ? CONFIG_NO_SNAPSHOT : 0),
|
|
1444
|
+
k: t?.unobserved,
|
|
1445
|
+
ne: e,
|
|
1406
1446
|
I: null,
|
|
1407
|
-
|
|
1408
|
-
|
|
1447
|
+
Ae: null,
|
|
1448
|
+
Se: clock,
|
|
1409
1449
|
V: n,
|
|
1410
|
-
|
|
1450
|
+
A: n?.N || null,
|
|
1411
1451
|
U: NOT_PENDING
|
|
1412
1452
|
};
|
|
1413
|
-
n && (n.
|
|
1414
|
-
if (snapshotCaptureActive && !i.
|
|
1415
|
-
i.
|
|
1453
|
+
n && (n.N = i);
|
|
1454
|
+
if (snapshotCaptureActive && !(i.Ee & CONFIG_NO_SNAPSHOT) && !((n?.Oe ?? 0) & STATUS_PENDING)) {
|
|
1455
|
+
i.de = e === undefined ? NO_SNAPSHOT : e;
|
|
1416
1456
|
snapshotSources.add(i);
|
|
1417
1457
|
}
|
|
1418
1458
|
return i;
|
|
1419
1459
|
}
|
|
1420
1460
|
function optimisticSignal(e, t) {
|
|
1421
1461
|
const n = signal(e, t);
|
|
1422
|
-
n.
|
|
1462
|
+
n.G = NOT_PENDING;
|
|
1423
1463
|
return n;
|
|
1424
1464
|
}
|
|
1425
1465
|
function optimisticComputed(e, t) {
|
|
1426
1466
|
const n = computed(e, t);
|
|
1427
|
-
n.
|
|
1467
|
+
n.G = NOT_PENDING;
|
|
1428
1468
|
return n;
|
|
1429
1469
|
}
|
|
1430
1470
|
function isEqual(e, t) {
|
|
@@ -1446,7 +1486,7 @@ function read(e) {
|
|
|
1446
1486
|
const t = getLatestValueComputed(e);
|
|
1447
1487
|
const n = latestReadActive;
|
|
1448
1488
|
latestReadActive = false;
|
|
1449
|
-
const i = e.
|
|
1489
|
+
const i = e.G !== undefined && e.G !== NOT_PENDING ? e.G : e.ne;
|
|
1450
1490
|
let r;
|
|
1451
1491
|
try {
|
|
1452
1492
|
r = read(t);
|
|
@@ -1456,11 +1496,11 @@ function read(e) {
|
|
|
1456
1496
|
} finally {
|
|
1457
1497
|
latestReadActive = n;
|
|
1458
1498
|
}
|
|
1459
|
-
if (t.
|
|
1460
|
-
if (stale && currentOptimisticLane && t.
|
|
1461
|
-
const e = findLane(t.
|
|
1499
|
+
if (t.Oe & STATUS_PENDING) return i;
|
|
1500
|
+
if (stale && currentOptimisticLane && t.te) {
|
|
1501
|
+
const e = findLane(t.te);
|
|
1462
1502
|
const n = findLane(currentOptimisticLane);
|
|
1463
|
-
if (e !== n && e.
|
|
1503
|
+
if (e !== n && e.W.size > 0) {
|
|
1464
1504
|
return i;
|
|
1465
1505
|
}
|
|
1466
1506
|
}
|
|
@@ -1470,8 +1510,8 @@ function read(e) {
|
|
|
1470
1510
|
const t = e.V;
|
|
1471
1511
|
const n = pendingCheckActive;
|
|
1472
1512
|
pendingCheckActive = false;
|
|
1473
|
-
if (t && e.
|
|
1474
|
-
if (e.
|
|
1513
|
+
if (t && e.G !== undefined) {
|
|
1514
|
+
if (e.G !== NOT_PENDING && (t.De || !!(t.Oe & STATUS_PENDING))) {
|
|
1475
1515
|
foundPending = true;
|
|
1476
1516
|
}
|
|
1477
1517
|
let n = context;
|
|
@@ -1484,18 +1524,18 @@ function read(e) {
|
|
|
1484
1524
|
if (t && read(getPendingSignal(t))) foundPending = true;
|
|
1485
1525
|
}
|
|
1486
1526
|
pendingCheckActive = n;
|
|
1487
|
-
return e.
|
|
1527
|
+
return e.ne;
|
|
1488
1528
|
}
|
|
1489
1529
|
let t = context;
|
|
1490
1530
|
if (t?.t) t = t.u;
|
|
1491
1531
|
const n = e;
|
|
1492
1532
|
if (typeof n.L === "function") {
|
|
1493
1533
|
const t = e;
|
|
1494
|
-
if (refreshing && !(t.
|
|
1495
|
-
if (t.
|
|
1496
|
-
t.
|
|
1534
|
+
if (refreshing && !(t.R & REACTIVE_DISPOSED)) recompute(t);
|
|
1535
|
+
if (t.R & REACTIVE_LAZY) {
|
|
1536
|
+
t.R &= ~REACTIVE_LAZY;
|
|
1497
1537
|
recompute(t, true);
|
|
1498
|
-
} else if (t.
|
|
1538
|
+
} else if (t.R & REACTIVE_DISPOSED) {
|
|
1499
1539
|
recompute(t, true);
|
|
1500
1540
|
}
|
|
1501
1541
|
}
|
|
@@ -1503,7 +1543,7 @@ function read(e) {
|
|
|
1503
1543
|
if (t && tracking) {
|
|
1504
1544
|
link(e, t);
|
|
1505
1545
|
if (i.L) {
|
|
1506
|
-
const n = e.
|
|
1546
|
+
const n = e.R & REACTIVE_ZOMBIE;
|
|
1507
1547
|
if (i.o >= (n ? zombieQueue.P : dirtyQueue.P)) {
|
|
1508
1548
|
markNode(t);
|
|
1509
1549
|
markHeap(n ? zombieQueue : dirtyQueue);
|
|
@@ -1515,60 +1555,71 @@ function read(e) {
|
|
|
1515
1555
|
}
|
|
1516
1556
|
}
|
|
1517
1557
|
}
|
|
1518
|
-
if (i.
|
|
1519
|
-
if (t && !(stale && i.
|
|
1558
|
+
if (i.Oe & STATUS_PENDING) {
|
|
1559
|
+
if (t && !(stale && i.Z && activeTransition !== i.Z)) {
|
|
1520
1560
|
if (currentOptimisticLane) {
|
|
1521
|
-
const n = i.
|
|
1561
|
+
const n = i.te;
|
|
1522
1562
|
const r = findLane(currentOptimisticLane);
|
|
1523
1563
|
if (n && findLane(n) === r && !hasActiveOverride(i)) {
|
|
1524
1564
|
if (!tracking && e !== t) link(e, t);
|
|
1525
|
-
throw i.
|
|
1565
|
+
throw i.Te;
|
|
1526
1566
|
}
|
|
1527
1567
|
} else {
|
|
1528
1568
|
if (!tracking && e !== t) link(e, t);
|
|
1529
|
-
throw i.
|
|
1569
|
+
throw i.Te;
|
|
1530
1570
|
}
|
|
1531
|
-
} else if (t && i !== e && i.
|
|
1571
|
+
} else if (t && i !== e && i.Oe & STATUS_UNINITIALIZED) {
|
|
1532
1572
|
if (!tracking && e !== t) link(e, t);
|
|
1533
|
-
throw i.
|
|
1534
|
-
} else if (!t && i.
|
|
1535
|
-
throw i.
|
|
1573
|
+
throw i.Te;
|
|
1574
|
+
} else if (!t && i.Oe & STATUS_UNINITIALIZED) {
|
|
1575
|
+
throw i.Te;
|
|
1536
1576
|
}
|
|
1537
1577
|
}
|
|
1538
|
-
if (e.L && e.
|
|
1539
|
-
if (e.
|
|
1578
|
+
if (e.L && e.Oe & STATUS_ERROR) {
|
|
1579
|
+
if (e.Se < clock) {
|
|
1540
1580
|
recompute(e);
|
|
1541
1581
|
return read(e);
|
|
1542
|
-
} else throw e.
|
|
1582
|
+
} else throw e.Te;
|
|
1543
1583
|
}
|
|
1544
|
-
if (snapshotCaptureActive && t && t.
|
|
1545
|
-
const n = e.
|
|
1584
|
+
if (snapshotCaptureActive && t && t.Ee & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
1585
|
+
const n = e.de;
|
|
1546
1586
|
if (n !== undefined) {
|
|
1547
1587
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1548
|
-
const r = e.U !== NOT_PENDING ? e.U : e.
|
|
1549
|
-
if (r !== i) t.
|
|
1588
|
+
const r = e.U !== NOT_PENDING ? e.U : e.ne;
|
|
1589
|
+
if (r !== i) t.R |= REACTIVE_SNAPSHOT_STALE;
|
|
1550
1590
|
return i;
|
|
1551
1591
|
}
|
|
1552
1592
|
}
|
|
1553
|
-
if (e.
|
|
1554
|
-
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.
|
|
1555
|
-
return e.
|
|
1593
|
+
if (e.G !== undefined && e.G !== NOT_PENDING) {
|
|
1594
|
+
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.ne;
|
|
1595
|
+
return e.G;
|
|
1596
|
+
}
|
|
1597
|
+
if (
|
|
1598
|
+
activeTransition !== null &&
|
|
1599
|
+
currentOptimisticLane !== null &&
|
|
1600
|
+
!latestReadActive &&
|
|
1601
|
+
e.U !== NOT_PENDING &&
|
|
1602
|
+
i === e &&
|
|
1603
|
+
!e.L &&
|
|
1604
|
+
t
|
|
1605
|
+
) {
|
|
1606
|
+
activeTransition.ee.add(t);
|
|
1607
|
+
return e.ne;
|
|
1556
1608
|
}
|
|
1557
1609
|
const r =
|
|
1558
1610
|
!t ||
|
|
1559
1611
|
(currentOptimisticLane !== null &&
|
|
1560
|
-
(e.
|
|
1612
|
+
(e.G !== undefined || e.te || (i === e && stale) || !!(i.Oe & STATUS_PENDING))) ||
|
|
1561
1613
|
e.U === NOT_PENDING ||
|
|
1562
|
-
(stale && e.
|
|
1563
|
-
? e.
|
|
1614
|
+
(stale && e.Z && activeTransition !== e.Z)
|
|
1615
|
+
? e.ne
|
|
1564
1616
|
: e.U;
|
|
1565
1617
|
if (
|
|
1566
1618
|
!t &&
|
|
1567
1619
|
i === e &&
|
|
1568
1620
|
typeof n.L === "function" &&
|
|
1569
|
-
|
|
1570
|
-
!(i.
|
|
1571
|
-
!n.i &&
|
|
1621
|
+
e.Ee & CONFIG_AUTO_DISPOSE &&
|
|
1622
|
+
!(i.Oe & STATUS_PENDING) &&
|
|
1572
1623
|
!e.I
|
|
1573
1624
|
) {
|
|
1574
1625
|
unobserved(e);
|
|
@@ -1576,12 +1627,12 @@ function read(e) {
|
|
|
1576
1627
|
return r;
|
|
1577
1628
|
}
|
|
1578
1629
|
function setSignal(e, t) {
|
|
1579
|
-
if (e.
|
|
1580
|
-
const n = e.
|
|
1581
|
-
const i = e.
|
|
1582
|
-
const r = n ? (i ? e.
|
|
1630
|
+
if (e.Z && activeTransition !== e.Z) globalQueue.initTransition(e.Z);
|
|
1631
|
+
const n = e.G !== undefined && !projectionWriteActive;
|
|
1632
|
+
const i = e.G !== undefined && e.G !== NOT_PENDING;
|
|
1633
|
+
const r = n ? (i ? e.G : e.ne) : e.U === NOT_PENDING ? e.ne : e.U;
|
|
1583
1634
|
if (typeof t === "function") t = t(r);
|
|
1584
|
-
const s = !e.
|
|
1635
|
+
const s = !e.Le || !e.Le(r, t) || !!(e.Oe & STATUS_UNINITIALIZED);
|
|
1585
1636
|
if (!s) {
|
|
1586
1637
|
if (n && i && e.L) {
|
|
1587
1638
|
insertSubs(e, true);
|
|
@@ -1590,25 +1641,25 @@ function setSignal(e, t) {
|
|
|
1590
1641
|
return t;
|
|
1591
1642
|
}
|
|
1592
1643
|
if (n) {
|
|
1593
|
-
const n = e.
|
|
1644
|
+
const n = e.G === NOT_PENDING;
|
|
1594
1645
|
if (!n) globalQueue.initTransition(resolveTransition(e));
|
|
1595
1646
|
if (n) {
|
|
1596
|
-
e.U = e.
|
|
1647
|
+
e.U = e.ne;
|
|
1597
1648
|
globalQueue.q.push(e);
|
|
1598
1649
|
}
|
|
1599
1650
|
e.pe = true;
|
|
1600
1651
|
const i = getOrCreateLane(e);
|
|
1601
|
-
e.
|
|
1602
|
-
e.
|
|
1652
|
+
e.te = i;
|
|
1653
|
+
e.G = t;
|
|
1603
1654
|
} else {
|
|
1604
|
-
if (e.U === NOT_PENDING) globalQueue.
|
|
1655
|
+
if (e.U === NOT_PENDING) globalQueue.ue.push(e);
|
|
1605
1656
|
e.U = t;
|
|
1606
1657
|
}
|
|
1607
1658
|
updatePendingSignal(e);
|
|
1608
|
-
if (e.
|
|
1609
|
-
setSignal(e.
|
|
1659
|
+
if (e.Ue) {
|
|
1660
|
+
setSignal(e.Ue, t);
|
|
1610
1661
|
}
|
|
1611
|
-
e.
|
|
1662
|
+
e.Se = clock;
|
|
1612
1663
|
insertSubs(e, n);
|
|
1613
1664
|
schedule();
|
|
1614
1665
|
return t;
|
|
@@ -1626,68 +1677,68 @@ function runWithOwner(e, t) {
|
|
|
1626
1677
|
}
|
|
1627
1678
|
}
|
|
1628
1679
|
function getPendingSignal(e) {
|
|
1629
|
-
if (!e.
|
|
1630
|
-
e.
|
|
1680
|
+
if (!e.We) {
|
|
1681
|
+
e.We = optimisticSignal(false, { ownedWrite: true });
|
|
1631
1682
|
if (e.Ie) {
|
|
1632
|
-
e.
|
|
1683
|
+
e.We.Ie = e;
|
|
1633
1684
|
}
|
|
1634
|
-
if (computePendingState(e)) setSignal(e.
|
|
1685
|
+
if (computePendingState(e)) setSignal(e.We, true);
|
|
1635
1686
|
}
|
|
1636
|
-
return e.
|
|
1687
|
+
return e.We;
|
|
1637
1688
|
}
|
|
1638
1689
|
function computePendingState(e) {
|
|
1639
1690
|
const t = e;
|
|
1640
1691
|
const n = e.V;
|
|
1641
1692
|
if (n && e.U !== NOT_PENDING) {
|
|
1642
|
-
return !n.
|
|
1693
|
+
return !n.De && !(n.Oe & STATUS_PENDING);
|
|
1643
1694
|
}
|
|
1644
|
-
if (e.
|
|
1645
|
-
if (t.
|
|
1695
|
+
if (e.G !== undefined && e.G !== NOT_PENDING) {
|
|
1696
|
+
if (t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
|
|
1646
1697
|
if (e.Ie) {
|
|
1647
|
-
const t = e.
|
|
1648
|
-
return !!(t && t.
|
|
1698
|
+
const t = e.te ? findLane(e.te) : null;
|
|
1699
|
+
return !!(t && t.W.size > 0);
|
|
1649
1700
|
}
|
|
1650
1701
|
return true;
|
|
1651
1702
|
}
|
|
1652
|
-
if (e.
|
|
1703
|
+
if (e.G !== undefined && e.G === NOT_PENDING && !e.Ie) {
|
|
1653
1704
|
return false;
|
|
1654
1705
|
}
|
|
1655
|
-
if (e.U !== NOT_PENDING && !(t.
|
|
1656
|
-
return !!(t.
|
|
1706
|
+
if (e.U !== NOT_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
|
|
1707
|
+
return !!(t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED));
|
|
1657
1708
|
}
|
|
1658
1709
|
function updatePendingSignal(e) {
|
|
1659
|
-
if (e.
|
|
1710
|
+
if (e.We) {
|
|
1660
1711
|
const t = computePendingState(e);
|
|
1661
|
-
const n = e.
|
|
1712
|
+
const n = e.We;
|
|
1662
1713
|
setSignal(n, t);
|
|
1663
|
-
if (!t && n.
|
|
1714
|
+
if (!t && n.te) {
|
|
1664
1715
|
const t = resolveLane(e);
|
|
1665
|
-
if (t && t.
|
|
1666
|
-
const e = findLane(n.
|
|
1716
|
+
if (t && t.W.size > 0) {
|
|
1717
|
+
const e = findLane(n.te);
|
|
1667
1718
|
if (e !== t) {
|
|
1668
1719
|
mergeLanes(t, e);
|
|
1669
1720
|
}
|
|
1670
1721
|
}
|
|
1671
1722
|
signalLanes.delete(n);
|
|
1672
|
-
n.
|
|
1723
|
+
n.te = undefined;
|
|
1673
1724
|
}
|
|
1674
1725
|
}
|
|
1675
1726
|
}
|
|
1676
1727
|
function getLatestValueComputed(e) {
|
|
1677
|
-
if (!e.
|
|
1728
|
+
if (!e.Ue) {
|
|
1678
1729
|
const t = latestReadActive;
|
|
1679
1730
|
latestReadActive = false;
|
|
1680
1731
|
const n = pendingCheckActive;
|
|
1681
1732
|
pendingCheckActive = false;
|
|
1682
1733
|
const i = context;
|
|
1683
1734
|
context = null;
|
|
1684
|
-
e.
|
|
1685
|
-
e.
|
|
1735
|
+
e.Ue = optimisticComputed(() => read(e));
|
|
1736
|
+
e.Ue.Ie = e;
|
|
1686
1737
|
context = i;
|
|
1687
1738
|
pendingCheckActive = n;
|
|
1688
1739
|
latestReadActive = t;
|
|
1689
1740
|
}
|
|
1690
|
-
return e.
|
|
1741
|
+
return e.Ue;
|
|
1691
1742
|
}
|
|
1692
1743
|
function staleValues(e, t = true) {
|
|
1693
1744
|
const n = stale;
|
|
@@ -1748,7 +1799,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1748
1799
|
if (!t) {
|
|
1749
1800
|
throw new NoOwnerError();
|
|
1750
1801
|
}
|
|
1751
|
-
const n = hasContext(e, t) ? t.
|
|
1802
|
+
const n = hasContext(e, t) ? t.Ve[e.id] : e.defaultValue;
|
|
1752
1803
|
if (isUndefined(n)) {
|
|
1753
1804
|
throw new ContextNotFoundError();
|
|
1754
1805
|
}
|
|
@@ -1758,10 +1809,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1758
1809
|
if (!n) {
|
|
1759
1810
|
throw new NoOwnerError();
|
|
1760
1811
|
}
|
|
1761
|
-
n.
|
|
1812
|
+
n.Ve = { ...n.Ve, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1762
1813
|
}
|
|
1763
1814
|
function hasContext(e, t) {
|
|
1764
|
-
return !isUndefined(t?.
|
|
1815
|
+
return !isUndefined(t?.Ve[e.id]);
|
|
1765
1816
|
}
|
|
1766
1817
|
function isUndefined(e) {
|
|
1767
1818
|
return typeof e === "undefined";
|
|
@@ -1772,29 +1823,30 @@ function effect(e, t, n, i) {
|
|
|
1772
1823
|
const o = computed(s ? e : t => staleValues(() => e(t)), {
|
|
1773
1824
|
...i,
|
|
1774
1825
|
equals: () => {
|
|
1775
|
-
o.j = !o.
|
|
1776
|
-
if (r) o.$.enqueue(o.
|
|
1826
|
+
o.j = !o.Te;
|
|
1827
|
+
if (r) o.$.enqueue(o.M, runEffect.bind(o));
|
|
1777
1828
|
return false;
|
|
1778
1829
|
},
|
|
1779
1830
|
lazy: true
|
|
1780
1831
|
});
|
|
1832
|
+
o.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
1833
|
+
o.xe = undefined;
|
|
1834
|
+
o.He = t;
|
|
1835
|
+
o.Me = n;
|
|
1781
1836
|
o.Qe = undefined;
|
|
1782
|
-
o.
|
|
1783
|
-
o.
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
o.xe = (e, t) => {
|
|
1787
|
-
const n = e !== undefined ? e : o.Re;
|
|
1788
|
-
const i = t !== undefined ? t : o.Ee;
|
|
1837
|
+
o.M = s ? EFFECT_USER : EFFECT_RENDER;
|
|
1838
|
+
o.Ge = (e, t) => {
|
|
1839
|
+
const n = e !== undefined ? e : o.Oe;
|
|
1840
|
+
const i = t !== undefined ? t : o.Te;
|
|
1789
1841
|
if (n & STATUS_ERROR) {
|
|
1790
1842
|
let e = i;
|
|
1791
1843
|
o.$.notify(o, STATUS_PENDING, 0);
|
|
1792
|
-
if (o.
|
|
1844
|
+
if (o.M === EFFECT_USER) {
|
|
1793
1845
|
try {
|
|
1794
|
-
return o.
|
|
1795
|
-
? o.
|
|
1796
|
-
o
|
|
1797
|
-
o
|
|
1846
|
+
return o.Me
|
|
1847
|
+
? o.Me(e, () => {
|
|
1848
|
+
o.Qe?.();
|
|
1849
|
+
o.Qe = undefined;
|
|
1798
1850
|
})
|
|
1799
1851
|
: console.error(e);
|
|
1800
1852
|
} catch (t) {
|
|
@@ -1802,36 +1854,36 @@ function effect(e, t, n, i) {
|
|
|
1802
1854
|
}
|
|
1803
1855
|
}
|
|
1804
1856
|
if (!o.$.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1805
|
-
} else if (o.
|
|
1857
|
+
} else if (o.M === EFFECT_RENDER) {
|
|
1806
1858
|
o.$.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
1807
1859
|
}
|
|
1808
1860
|
};
|
|
1809
1861
|
recompute(o, true);
|
|
1810
1862
|
!i?.defer &&
|
|
1811
|
-
(o.
|
|
1863
|
+
(o.M === EFFECT_USER || i?.schedule ? o.$.enqueue(o.M, runEffect.bind(o)) : runEffect.call(o));
|
|
1812
1864
|
r = true;
|
|
1813
|
-
cleanup(() => o
|
|
1865
|
+
cleanup(() => o.Qe?.());
|
|
1814
1866
|
}
|
|
1815
1867
|
function runEffect() {
|
|
1816
|
-
if (!this.j || this.
|
|
1817
|
-
this
|
|
1818
|
-
this
|
|
1868
|
+
if (!this.j || this.R & REACTIVE_DISPOSED) return;
|
|
1869
|
+
this.Qe?.();
|
|
1870
|
+
this.Qe = undefined;
|
|
1819
1871
|
try {
|
|
1820
|
-
const e = this.
|
|
1872
|
+
const e = this.He(this.ne, this.xe);
|
|
1821
1873
|
if (false && e !== undefined && typeof e !== "function");
|
|
1822
|
-
this
|
|
1874
|
+
this.Qe = e;
|
|
1823
1875
|
} catch (e) {
|
|
1824
|
-
this.
|
|
1825
|
-
this.
|
|
1876
|
+
this.Te = new StatusError(this, e);
|
|
1877
|
+
this.Oe |= STATUS_ERROR;
|
|
1826
1878
|
if (!this.$.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1827
1879
|
} finally {
|
|
1828
|
-
this.
|
|
1880
|
+
this.xe = this.ne;
|
|
1829
1881
|
this.j = false;
|
|
1830
1882
|
}
|
|
1831
1883
|
}
|
|
1832
1884
|
function trackedEffect(e, t) {
|
|
1833
1885
|
const run = () => {
|
|
1834
|
-
if (!n.j || n.
|
|
1886
|
+
if (!n.j || n.R & REACTIVE_DISPOSED) return;
|
|
1835
1887
|
try {
|
|
1836
1888
|
n.j = false;
|
|
1837
1889
|
recompute(n);
|
|
@@ -1840,28 +1892,28 @@ function trackedEffect(e, t) {
|
|
|
1840
1892
|
};
|
|
1841
1893
|
const n = computed(
|
|
1842
1894
|
() => {
|
|
1843
|
-
n
|
|
1844
|
-
n
|
|
1895
|
+
n.Qe?.();
|
|
1896
|
+
n.Qe = undefined;
|
|
1845
1897
|
const t = staleValues(e);
|
|
1846
|
-
n
|
|
1898
|
+
n.Qe = t;
|
|
1847
1899
|
},
|
|
1848
1900
|
{ ...t, lazy: true }
|
|
1849
1901
|
);
|
|
1850
|
-
n
|
|
1851
|
-
n.
|
|
1902
|
+
n.Qe = undefined;
|
|
1903
|
+
n.Ee = (n.Ee & ~CONFIG_AUTO_DISPOSE) | CONFIG_CHILDREN_FORBIDDEN;
|
|
1852
1904
|
n.j = true;
|
|
1853
|
-
n.
|
|
1854
|
-
n.
|
|
1855
|
-
const i = e !== undefined ? e : n.
|
|
1905
|
+
n.M = EFFECT_TRACKED;
|
|
1906
|
+
n.Ge = (e, t) => {
|
|
1907
|
+
const i = e !== undefined ? e : n.Oe;
|
|
1856
1908
|
if (i & STATUS_ERROR) {
|
|
1857
1909
|
n.$.notify(n, STATUS_PENDING, 0);
|
|
1858
|
-
const e = t !== undefined ? t : n.
|
|
1910
|
+
const e = t !== undefined ? t : n.Te;
|
|
1859
1911
|
if (!n.$.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1860
1912
|
}
|
|
1861
1913
|
};
|
|
1862
1914
|
n.K = run;
|
|
1863
1915
|
n.$.enqueue(EFFECT_USER, run);
|
|
1864
|
-
cleanup(() => n
|
|
1916
|
+
cleanup(() => n.Qe?.());
|
|
1865
1917
|
}
|
|
1866
1918
|
function restoreTransition(e, t) {
|
|
1867
1919
|
globalQueue.initTransition(e);
|
|
@@ -1875,11 +1927,11 @@ function action(e) {
|
|
|
1875
1927
|
const r = e(...t);
|
|
1876
1928
|
globalQueue.initTransition();
|
|
1877
1929
|
let s = activeTransition;
|
|
1878
|
-
s.
|
|
1930
|
+
s.B.push(r);
|
|
1879
1931
|
const done = (e, t) => {
|
|
1880
1932
|
s = currentTransition(s);
|
|
1881
|
-
const o = s.
|
|
1882
|
-
if (o >= 0) s.
|
|
1933
|
+
const o = s.B.indexOf(r);
|
|
1934
|
+
if (o >= 0) s.B.splice(o, 1);
|
|
1883
1935
|
setActiveTransition(s);
|
|
1884
1936
|
schedule();
|
|
1885
1937
|
t ? i(t) : n(e);
|
|
@@ -1911,22 +1963,19 @@ function onCleanup(e) {
|
|
|
1911
1963
|
return cleanup(e);
|
|
1912
1964
|
}
|
|
1913
1965
|
function accessor(e) {
|
|
1914
|
-
|
|
1915
|
-
t.$r = true;
|
|
1916
|
-
return t;
|
|
1966
|
+
return read.bind(null, e);
|
|
1917
1967
|
}
|
|
1918
1968
|
function createSignal(e, t) {
|
|
1919
1969
|
if (typeof e === "function") {
|
|
1920
1970
|
const n = computed(e, t);
|
|
1921
|
-
n.
|
|
1971
|
+
n.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
1922
1972
|
return [accessor(n), setSignal.bind(null, n)];
|
|
1923
1973
|
}
|
|
1924
1974
|
const n = signal(e, t);
|
|
1925
1975
|
return [accessor(n), setSignal.bind(null, n)];
|
|
1926
1976
|
}
|
|
1927
1977
|
function createMemo(e, t) {
|
|
1928
|
-
|
|
1929
|
-
return accessor(n);
|
|
1978
|
+
return accessor(computed(e, t));
|
|
1930
1979
|
}
|
|
1931
1980
|
function createEffect(e, t, n) {
|
|
1932
1981
|
effect(e, t.effect || t, t.error, { user: true, ...n });
|
|
@@ -1976,7 +2025,7 @@ function resolve(e) {
|
|
|
1976
2025
|
function createOptimistic(e, t) {
|
|
1977
2026
|
if (typeof e === "function") {
|
|
1978
2027
|
const n = optimisticComputed(e, t);
|
|
1979
|
-
n.
|
|
2028
|
+
n.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
1980
2029
|
return [accessor(n), setSignal.bind(null, n)];
|
|
1981
2030
|
}
|
|
1982
2031
|
const n = optimisticSignal(e, t);
|
|
@@ -1984,7 +2033,7 @@ function createOptimistic(e, t) {
|
|
|
1984
2033
|
}
|
|
1985
2034
|
function onSettled(e) {
|
|
1986
2035
|
const t = getOwner();
|
|
1987
|
-
t && !t.
|
|
2036
|
+
t && !(t.Ee & CONFIG_CHILDREN_FORBIDDEN)
|
|
1988
2037
|
? createTrackedEffect(() => untrack(e), undefined)
|
|
1989
2038
|
: globalQueue.enqueue(EFFECT_USER, () => {
|
|
1990
2039
|
const t = e();
|
|
@@ -2018,34 +2067,34 @@ function applyState(e, t, n) {
|
|
|
2018
2067
|
let t = false;
|
|
2019
2068
|
const c = getOverrideValue(r, s, u, "length", o);
|
|
2020
2069
|
if (e.length && c && e[0] && n(e[0]) != null) {
|
|
2021
|
-
let a, l, f, E,
|
|
2070
|
+
let a, l, f, E, T, S, d, O;
|
|
2022
2071
|
for (
|
|
2023
2072
|
f = 0, E = Math.min(c, e.length);
|
|
2024
2073
|
f < E &&
|
|
2025
|
-
((
|
|
2074
|
+
((S = getOverrideValue(r, s, u, f, o)) === e[f] || (S && e[f] && n(S) === n(e[f])));
|
|
2026
2075
|
f++
|
|
2027
2076
|
) {
|
|
2028
|
-
applyState(e[f], wrap(
|
|
2077
|
+
applyState(e[f], wrap(S, i), n);
|
|
2029
2078
|
}
|
|
2030
|
-
const
|
|
2079
|
+
const R = new Array(e.length),
|
|
2031
2080
|
_ = new Map();
|
|
2032
2081
|
for (
|
|
2033
|
-
E = c - 1,
|
|
2082
|
+
E = c - 1, T = e.length - 1;
|
|
2034
2083
|
E >= f &&
|
|
2035
|
-
|
|
2036
|
-
((
|
|
2037
|
-
E--,
|
|
2084
|
+
T >= f &&
|
|
2085
|
+
((S = getOverrideValue(r, s, u, E, o)) === e[T] || (S && e[T] && n(S) === n(e[T])));
|
|
2086
|
+
E--, T--
|
|
2038
2087
|
) {
|
|
2039
|
-
|
|
2088
|
+
R[T] = S;
|
|
2040
2089
|
}
|
|
2041
|
-
if (f >
|
|
2042
|
-
for (l = f; l <=
|
|
2090
|
+
if (f > T || f > E) {
|
|
2091
|
+
for (l = f; l <= T; l++) {
|
|
2043
2092
|
t = true;
|
|
2044
2093
|
i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
|
|
2045
2094
|
}
|
|
2046
2095
|
for (; l < e.length; l++) {
|
|
2047
2096
|
t = true;
|
|
2048
|
-
const r = wrap(
|
|
2097
|
+
const r = wrap(R[l], i);
|
|
2049
2098
|
i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], r);
|
|
2050
2099
|
applyState(e[l], r, n);
|
|
2051
2100
|
}
|
|
@@ -2053,27 +2102,27 @@ function applyState(e, t, n) {
|
|
|
2053
2102
|
c !== e.length && i[STORE_NODE].length && setSignal(i[STORE_NODE].length, e.length);
|
|
2054
2103
|
return;
|
|
2055
2104
|
}
|
|
2056
|
-
|
|
2057
|
-
for (l =
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
a = _.get(
|
|
2061
|
-
|
|
2062
|
-
_.set(
|
|
2105
|
+
d = new Array(T + 1);
|
|
2106
|
+
for (l = T; l >= f; l--) {
|
|
2107
|
+
S = e[l];
|
|
2108
|
+
O = S ? n(S) : S;
|
|
2109
|
+
a = _.get(O);
|
|
2110
|
+
d[l] = a === undefined ? -1 : a;
|
|
2111
|
+
_.set(O, l);
|
|
2063
2112
|
}
|
|
2064
2113
|
for (a = f; a <= E; a++) {
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
l = _.get(
|
|
2114
|
+
S = getOverrideValue(r, s, u, a, o);
|
|
2115
|
+
O = S ? n(S) : S;
|
|
2116
|
+
l = _.get(O);
|
|
2068
2117
|
if (l !== undefined && l !== -1) {
|
|
2069
|
-
|
|
2070
|
-
l =
|
|
2071
|
-
_.set(
|
|
2118
|
+
R[l] = S;
|
|
2119
|
+
l = d[l];
|
|
2120
|
+
_.set(O, l);
|
|
2072
2121
|
}
|
|
2073
2122
|
}
|
|
2074
2123
|
for (l = f; l < e.length; l++) {
|
|
2075
|
-
if (l in
|
|
2076
|
-
const t = wrap(
|
|
2124
|
+
if (l in R) {
|
|
2125
|
+
const t = wrap(R[l], i);
|
|
2077
2126
|
i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], t);
|
|
2078
2127
|
applyState(e[l], t, n);
|
|
2079
2128
|
} else i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
|
|
@@ -2101,12 +2150,12 @@ function applyState(e, t, n) {
|
|
|
2101
2150
|
const l = c[a];
|
|
2102
2151
|
const f = u[l];
|
|
2103
2152
|
const E = unwrap(getOverrideValue(r, s, u, l, o));
|
|
2104
|
-
let
|
|
2105
|
-
if (E ===
|
|
2106
|
-
if (!E || !isWrappable(E) || !isWrappable(
|
|
2153
|
+
let T = unwrap(e[l]);
|
|
2154
|
+
if (E === T) continue;
|
|
2155
|
+
if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
|
|
2107
2156
|
t && setSignal(t, void 0);
|
|
2108
|
-
f && setSignal(f, isWrappable(
|
|
2109
|
-
} else applyState(
|
|
2157
|
+
f && setSignal(f, isWrappable(T) ? wrap(T, i) : T);
|
|
2158
|
+
} else applyState(T, wrap(E, i), n);
|
|
2110
2159
|
}
|
|
2111
2160
|
}
|
|
2112
2161
|
if ((u = i[STORE_HAS])) {
|
|
@@ -2152,7 +2201,7 @@ function createProjectionInternal(e, t, n) {
|
|
|
2152
2201
|
if (!i) i = getOwner();
|
|
2153
2202
|
runProjectionComputed(s, e, n?.key || "id");
|
|
2154
2203
|
}, undefined);
|
|
2155
|
-
i.
|
|
2204
|
+
i.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
2156
2205
|
return { store: s, node: i };
|
|
2157
2206
|
}
|
|
2158
2207
|
function createProjection(e, t, n) {
|
|
@@ -2164,7 +2213,7 @@ function runProjectionComputed(e, t, n, i) {
|
|
|
2164
2213
|
let o;
|
|
2165
2214
|
const u = new Proxy(
|
|
2166
2215
|
e,
|
|
2167
|
-
createWriteTraps(() => !s || r.
|
|
2216
|
+
createWriteTraps(() => !s || r.De === o)
|
|
2168
2217
|
);
|
|
2169
2218
|
storeSetter(u, u => {
|
|
2170
2219
|
o = t(u);
|
|
@@ -2293,11 +2342,11 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
|
2293
2342
|
i
|
|
2294
2343
|
);
|
|
2295
2344
|
if (s) {
|
|
2296
|
-
u.
|
|
2345
|
+
u.G = NOT_PENDING;
|
|
2297
2346
|
}
|
|
2298
2347
|
if (o && t in o) {
|
|
2299
2348
|
const e = o[t];
|
|
2300
|
-
u.
|
|
2349
|
+
u.de = e === undefined ? NO_SNAPSHOT : e;
|
|
2301
2350
|
snapshotSources?.add(u);
|
|
2302
2351
|
}
|
|
2303
2352
|
return (e[t] = u);
|
|
@@ -2330,8 +2379,8 @@ function getPropertyDescriptor(e, t, n) {
|
|
|
2330
2379
|
function prepareStoreWrite(e, t, n) {
|
|
2331
2380
|
if (e[STORE_OPTIMISTIC]) {
|
|
2332
2381
|
const t = e[STORE_FIREWALL];
|
|
2333
|
-
if (t?.
|
|
2334
|
-
globalQueue.initTransition(t.
|
|
2382
|
+
if (t?.Z) {
|
|
2383
|
+
globalQueue.initTransition(t.Z);
|
|
2335
2384
|
}
|
|
2336
2385
|
}
|
|
2337
2386
|
const i = e[STORE_VALUE];
|
|
@@ -2339,7 +2388,7 @@ function prepareStoreWrite(e, t, n) {
|
|
|
2339
2388
|
if (
|
|
2340
2389
|
snapshotCaptureActive &&
|
|
2341
2390
|
typeof n !== "symbol" &&
|
|
2342
|
-
!((e[STORE_FIREWALL]?.
|
|
2391
|
+
!((e[STORE_FIREWALL]?.Oe ?? 0) & STATUS_PENDING)
|
|
2343
2392
|
) {
|
|
2344
2393
|
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2345
2394
|
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
@@ -2421,11 +2470,11 @@ const storeTraps = {
|
|
|
2421
2470
|
if (writeOnly(n)) {
|
|
2422
2471
|
let n =
|
|
2423
2472
|
r && (o || !u)
|
|
2424
|
-
? r.
|
|
2425
|
-
? r.
|
|
2473
|
+
? r.G !== undefined && r.G !== NOT_PENDING
|
|
2474
|
+
? r.G
|
|
2426
2475
|
: r.U !== NOT_PENDING
|
|
2427
2476
|
? r.U
|
|
2428
|
-
: r.
|
|
2477
|
+
: r.ne
|
|
2429
2478
|
: c[t];
|
|
2430
2479
|
n === $DELETED && (n = undefined);
|
|
2431
2480
|
if (!isWrappable(n)) return n;
|
|
@@ -2502,22 +2551,22 @@ const storeTraps = {
|
|
|
2502
2551
|
: e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
|
|
2503
2552
|
? e[STORE_OVERRIDE].length
|
|
2504
2553
|
: o.length);
|
|
2505
|
-
const
|
|
2506
|
-
if (u === a &&
|
|
2507
|
-
if (a !== undefined && a === r &&
|
|
2554
|
+
const T = l && f > E ? f : undefined;
|
|
2555
|
+
if (u === a && T === undefined) return true;
|
|
2556
|
+
if (a !== undefined && a === r && T === undefined) delete e[s]?.[t];
|
|
2508
2557
|
else {
|
|
2509
2558
|
const n = e[s] || (e[s] = Object.create(null));
|
|
2510
2559
|
n[t] = a;
|
|
2511
|
-
if (
|
|
2560
|
+
if (T !== undefined) n.length = T;
|
|
2512
2561
|
}
|
|
2513
2562
|
notifyStoreProperty(e, t, "set", a, u, c);
|
|
2514
|
-
if (Array.isArray(o) && t !== "length" &&
|
|
2563
|
+
if (Array.isArray(o) && t !== "length" && T !== undefined) {
|
|
2515
2564
|
const t = getNodes(e, STORE_NODE);
|
|
2516
2565
|
if (t.length) {
|
|
2517
|
-
setSignal(t.length,
|
|
2566
|
+
setSignal(t.length, T);
|
|
2518
2567
|
} else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
|
|
2519
2568
|
const n = upsertStoreNode(e, t, "length", E, e[STORE_SNAPSHOT_PROPS]);
|
|
2520
|
-
setSignal(n,
|
|
2569
|
+
setSignal(n, T);
|
|
2521
2570
|
}
|
|
2522
2571
|
}
|
|
2523
2572
|
if (false);
|
|
@@ -2627,7 +2676,7 @@ function createStore(e, t, n) {
|
|
|
2627
2676
|
return [r, e => storeSetter(r, e)];
|
|
2628
2677
|
}
|
|
2629
2678
|
function createOptimisticStore(e, t, n) {
|
|
2630
|
-
GlobalQueue.
|
|
2679
|
+
GlobalQueue.le ||= clearOptimisticStore;
|
|
2631
2680
|
const i = typeof e === "function";
|
|
2632
2681
|
const r = i ? t : e;
|
|
2633
2682
|
const s = i ? e : undefined;
|
|
@@ -2644,7 +2693,7 @@ function clearOptimisticStore(e) {
|
|
|
2644
2693
|
if (i) {
|
|
2645
2694
|
for (const e of Reflect.ownKeys(n)) {
|
|
2646
2695
|
if (i[e]) {
|
|
2647
|
-
i[e].
|
|
2696
|
+
i[e].te = undefined;
|
|
2648
2697
|
const n =
|
|
2649
2698
|
t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
|
|
2650
2699
|
const r = n === $DELETED ? undefined : n;
|
|
@@ -2652,7 +2701,7 @@ function clearOptimisticStore(e) {
|
|
|
2652
2701
|
}
|
|
2653
2702
|
}
|
|
2654
2703
|
if (i[$TRACK]) {
|
|
2655
|
-
i[$TRACK].
|
|
2704
|
+
i[$TRACK].te = undefined;
|
|
2656
2705
|
setSignal(i[$TRACK], undefined);
|
|
2657
2706
|
}
|
|
2658
2707
|
}
|
|
@@ -2700,7 +2749,7 @@ function createOptimisticProjectionInternal(e, t, n) {
|
|
|
2700
2749
|
setProjectionWriteActive(false);
|
|
2701
2750
|
}
|
|
2702
2751
|
}, undefined);
|
|
2703
|
-
i.
|
|
2752
|
+
i.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
2704
2753
|
}
|
|
2705
2754
|
return { store: s, node: i };
|
|
2706
2755
|
}
|
|
@@ -2960,69 +3009,69 @@ function mapArray(e, t, n) {
|
|
|
2960
3009
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2961
3010
|
const r = t.length > 1;
|
|
2962
3011
|
const s = t;
|
|
2963
|
-
const o =
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
return accessor(
|
|
3012
|
+
const o = {
|
|
3013
|
+
je: createOwner(),
|
|
3014
|
+
$e: 0,
|
|
3015
|
+
Ke: e,
|
|
3016
|
+
Ye: [],
|
|
3017
|
+
Be: s,
|
|
3018
|
+
Ze: [],
|
|
3019
|
+
qe: [],
|
|
3020
|
+
ze: i,
|
|
3021
|
+
Xe: i || n?.keyed === false ? [] : undefined,
|
|
3022
|
+
Je: r ? [] : undefined,
|
|
3023
|
+
et: n?.fallback
|
|
3024
|
+
};
|
|
3025
|
+
const u = computed(updateKeyedMap.bind(o));
|
|
3026
|
+
o.je.u = u;
|
|
3027
|
+
u.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
3028
|
+
return accessor(u);
|
|
2980
3029
|
}
|
|
2981
3030
|
const pureOptions = { ownedWrite: true };
|
|
2982
3031
|
function updateKeyedMap() {
|
|
2983
|
-
const e = this.
|
|
3032
|
+
const e = this.Ke() || [],
|
|
2984
3033
|
t = e.length;
|
|
2985
3034
|
e[$TRACK];
|
|
2986
|
-
runWithOwner(this.
|
|
3035
|
+
runWithOwner(this.je, () => {
|
|
2987
3036
|
let n,
|
|
2988
3037
|
i,
|
|
2989
|
-
r = this.
|
|
3038
|
+
r = this.Xe
|
|
2990
3039
|
? () => {
|
|
2991
|
-
this.
|
|
2992
|
-
this.
|
|
2993
|
-
return this.
|
|
3040
|
+
this.Xe[i] = signal(e[i], pureOptions);
|
|
3041
|
+
this.Je && (this.Je[i] = signal(i, pureOptions));
|
|
3042
|
+
return this.Be(accessor(this.Xe[i]), this.Je ? accessor(this.Je[i]) : undefined);
|
|
2994
3043
|
}
|
|
2995
|
-
: this.
|
|
3044
|
+
: this.Je
|
|
2996
3045
|
? () => {
|
|
2997
3046
|
const t = e[i];
|
|
2998
|
-
this.
|
|
2999
|
-
return this.
|
|
3047
|
+
this.Je[i] = signal(i, pureOptions);
|
|
3048
|
+
return this.Be(() => t, accessor(this.Je[i]));
|
|
3000
3049
|
}
|
|
3001
3050
|
: () => {
|
|
3002
3051
|
const t = e[i];
|
|
3003
|
-
return this.
|
|
3052
|
+
return this.Be(() => t);
|
|
3004
3053
|
};
|
|
3005
3054
|
if (t === 0) {
|
|
3006
|
-
if (this
|
|
3007
|
-
this.
|
|
3008
|
-
this.Je = [];
|
|
3055
|
+
if (this.$e !== 0) {
|
|
3056
|
+
this.je.dispose(false);
|
|
3009
3057
|
this.qe = [];
|
|
3010
|
-
this.
|
|
3011
|
-
this.Ze =
|
|
3012
|
-
this
|
|
3013
|
-
this.
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
this.
|
|
3058
|
+
this.Ye = [];
|
|
3059
|
+
this.Ze = [];
|
|
3060
|
+
this.$e = 0;
|
|
3061
|
+
this.Xe && (this.Xe = []);
|
|
3062
|
+
this.Je && (this.Je = []);
|
|
3063
|
+
}
|
|
3064
|
+
if (this.et && !this.Ze[0]) {
|
|
3065
|
+
this.Ze[0] = runWithOwner((this.qe[0] = createOwner()), this.et);
|
|
3066
|
+
}
|
|
3067
|
+
} else if (this.$e === 0) {
|
|
3068
|
+
if (this.qe[0]) this.qe[0].dispose();
|
|
3069
|
+
this.Ze = new Array(t);
|
|
3021
3070
|
for (i = 0; i < t; i++) {
|
|
3022
|
-
this.
|
|
3023
|
-
this.
|
|
3071
|
+
this.Ye[i] = e[i];
|
|
3072
|
+
this.Ze[i] = runWithOwner((this.qe[i] = createOwner()), r);
|
|
3024
3073
|
}
|
|
3025
|
-
this
|
|
3074
|
+
this.$e = t;
|
|
3026
3075
|
} else {
|
|
3027
3076
|
let s,
|
|
3028
3077
|
o,
|
|
@@ -3032,150 +3081,150 @@ function updateKeyedMap() {
|
|
|
3032
3081
|
l,
|
|
3033
3082
|
f,
|
|
3034
3083
|
E = new Array(t),
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3084
|
+
T = new Array(t),
|
|
3085
|
+
S = this.Xe ? new Array(t) : undefined,
|
|
3086
|
+
d = this.Je ? new Array(t) : undefined;
|
|
3038
3087
|
for (
|
|
3039
|
-
s = 0, o = Math.min(this
|
|
3040
|
-
s < o && (this.
|
|
3088
|
+
s = 0, o = Math.min(this.$e, t);
|
|
3089
|
+
s < o && (this.Ye[s] === e[s] || (this.Xe && compare(this.ze, this.Ye[s], e[s])));
|
|
3041
3090
|
s++
|
|
3042
3091
|
) {
|
|
3043
|
-
if (this.
|
|
3092
|
+
if (this.Xe) setSignal(this.Xe[s], e[s]);
|
|
3044
3093
|
}
|
|
3045
3094
|
for (
|
|
3046
|
-
o = this
|
|
3095
|
+
o = this.$e - 1, u = t - 1;
|
|
3047
3096
|
o >= s &&
|
|
3048
3097
|
u >= s &&
|
|
3049
|
-
(this.
|
|
3098
|
+
(this.Ye[o] === e[u] || (this.Xe && compare(this.ze, this.Ye[o], e[u])));
|
|
3050
3099
|
o--, u--
|
|
3051
3100
|
) {
|
|
3052
|
-
E[u] = this.
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3101
|
+
E[u] = this.Ze[o];
|
|
3102
|
+
T[u] = this.qe[o];
|
|
3103
|
+
S && (S[u] = this.Xe[o]);
|
|
3104
|
+
d && (d[u] = this.Je[o]);
|
|
3056
3105
|
}
|
|
3057
3106
|
l = new Map();
|
|
3058
3107
|
f = new Array(u + 1);
|
|
3059
3108
|
for (i = u; i >= s; i--) {
|
|
3060
3109
|
c = e[i];
|
|
3061
|
-
a = this.
|
|
3110
|
+
a = this.ze ? this.ze(c) : c;
|
|
3062
3111
|
n = l.get(a);
|
|
3063
3112
|
f[i] = n === undefined ? -1 : n;
|
|
3064
3113
|
l.set(a, i);
|
|
3065
3114
|
}
|
|
3066
3115
|
for (n = s; n <= o; n++) {
|
|
3067
|
-
c = this.
|
|
3068
|
-
a = this.
|
|
3116
|
+
c = this.Ye[n];
|
|
3117
|
+
a = this.ze ? this.ze(c) : c;
|
|
3069
3118
|
i = l.get(a);
|
|
3070
3119
|
if (i !== undefined && i !== -1) {
|
|
3071
|
-
E[i] = this.
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3120
|
+
E[i] = this.Ze[n];
|
|
3121
|
+
T[i] = this.qe[n];
|
|
3122
|
+
S && (S[i] = this.Xe[n]);
|
|
3123
|
+
d && (d[i] = this.Je[n]);
|
|
3075
3124
|
i = f[i];
|
|
3076
3125
|
l.set(a, i);
|
|
3077
|
-
} else this.
|
|
3126
|
+
} else this.qe[n].dispose();
|
|
3078
3127
|
}
|
|
3079
3128
|
for (i = s; i < t; i++) {
|
|
3080
3129
|
if (i in E) {
|
|
3081
|
-
this.
|
|
3082
|
-
this.
|
|
3083
|
-
if (T) {
|
|
3084
|
-
this.tt[i] = T[i];
|
|
3085
|
-
setSignal(this.tt[i], e[i]);
|
|
3086
|
-
}
|
|
3130
|
+
this.Ze[i] = E[i];
|
|
3131
|
+
this.qe[i] = T[i];
|
|
3087
3132
|
if (S) {
|
|
3088
|
-
this.
|
|
3089
|
-
setSignal(this.
|
|
3133
|
+
this.Xe[i] = S[i];
|
|
3134
|
+
setSignal(this.Xe[i], e[i]);
|
|
3135
|
+
}
|
|
3136
|
+
if (d) {
|
|
3137
|
+
this.Je[i] = d[i];
|
|
3138
|
+
setSignal(this.Je[i], i);
|
|
3090
3139
|
}
|
|
3091
3140
|
} else {
|
|
3092
|
-
this.
|
|
3141
|
+
this.Ze[i] = runWithOwner((this.qe[i] = createOwner()), r);
|
|
3093
3142
|
}
|
|
3094
3143
|
}
|
|
3095
|
-
this.
|
|
3096
|
-
this.
|
|
3144
|
+
this.Ze = this.Ze.slice(0, (this.$e = t));
|
|
3145
|
+
this.Ye = e.slice(0);
|
|
3097
3146
|
}
|
|
3098
3147
|
});
|
|
3099
|
-
return this.
|
|
3148
|
+
return this.Ze;
|
|
3100
3149
|
}
|
|
3101
3150
|
function repeat(e, t, n) {
|
|
3102
3151
|
const i = t;
|
|
3103
3152
|
const r = computed(
|
|
3104
3153
|
updateRepeat.bind({
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3154
|
+
je: createOwner(),
|
|
3155
|
+
$e: 0,
|
|
3156
|
+
tt: 0,
|
|
3157
|
+
nt: e,
|
|
3158
|
+
Be: i,
|
|
3159
|
+
qe: [],
|
|
3160
|
+
Ze: [],
|
|
3161
|
+
it: n?.from,
|
|
3162
|
+
et: n?.fallback
|
|
3114
3163
|
})
|
|
3115
3164
|
);
|
|
3116
|
-
r.
|
|
3165
|
+
r.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
3117
3166
|
return accessor(r);
|
|
3118
3167
|
}
|
|
3119
3168
|
function updateRepeat() {
|
|
3120
|
-
const e = this.
|
|
3121
|
-
const t = this.
|
|
3122
|
-
runWithOwner(this.
|
|
3169
|
+
const e = this.nt();
|
|
3170
|
+
const t = this.it?.() || 0;
|
|
3171
|
+
runWithOwner(this.je, () => {
|
|
3123
3172
|
if (e === 0) {
|
|
3124
|
-
if (this
|
|
3125
|
-
this.
|
|
3126
|
-
this.
|
|
3127
|
-
this.
|
|
3128
|
-
this
|
|
3173
|
+
if (this.$e !== 0) {
|
|
3174
|
+
this.je.dispose(false);
|
|
3175
|
+
this.qe = [];
|
|
3176
|
+
this.Ze = [];
|
|
3177
|
+
this.$e = 0;
|
|
3129
3178
|
}
|
|
3130
|
-
if (this.
|
|
3131
|
-
this.
|
|
3179
|
+
if (this.et && !this.Ze[0]) {
|
|
3180
|
+
this.Ze[0] = runWithOwner((this.qe[0] = createOwner()), this.et);
|
|
3132
3181
|
}
|
|
3133
3182
|
return;
|
|
3134
3183
|
}
|
|
3135
3184
|
const n = t + e;
|
|
3136
|
-
const i = this.
|
|
3137
|
-
if (this
|
|
3138
|
-
for (let e = n; e < i; e++) this.
|
|
3139
|
-
if (this.
|
|
3140
|
-
let e = this.
|
|
3141
|
-
while (e < t && e < this
|
|
3142
|
-
this.
|
|
3143
|
-
this.
|
|
3144
|
-
} else if (this.
|
|
3145
|
-
let n = i - this.
|
|
3146
|
-
let r = this.
|
|
3147
|
-
this.
|
|
3185
|
+
const i = this.tt + this.$e;
|
|
3186
|
+
if (this.$e === 0 && this.qe[0]) this.qe[0].dispose();
|
|
3187
|
+
for (let e = n; e < i; e++) this.qe[e - this.tt].dispose();
|
|
3188
|
+
if (this.tt < t) {
|
|
3189
|
+
let e = this.tt;
|
|
3190
|
+
while (e < t && e < this.$e) this.qe[e++].dispose();
|
|
3191
|
+
this.qe.splice(0, t - this.tt);
|
|
3192
|
+
this.Ze.splice(0, t - this.tt);
|
|
3193
|
+
} else if (this.tt > t) {
|
|
3194
|
+
let n = i - this.tt - 1;
|
|
3195
|
+
let r = this.tt - t;
|
|
3196
|
+
this.qe.length = this.Ze.length = e;
|
|
3148
3197
|
while (n >= r) {
|
|
3149
|
-
this.
|
|
3150
|
-
this.
|
|
3198
|
+
this.qe[n] = this.qe[n - r];
|
|
3199
|
+
this.Ze[n] = this.Ze[n - r];
|
|
3151
3200
|
n--;
|
|
3152
3201
|
}
|
|
3153
3202
|
for (let e = 0; e < r; e++) {
|
|
3154
|
-
this.
|
|
3203
|
+
this.Ze[e] = runWithOwner((this.qe[e] = createOwner()), () => this.Be(e + t));
|
|
3155
3204
|
}
|
|
3156
3205
|
}
|
|
3157
3206
|
for (let e = i; e < n; e++) {
|
|
3158
|
-
this.
|
|
3207
|
+
this.Ze[e - t] = runWithOwner((this.qe[e - t] = createOwner()), () => this.Be(e));
|
|
3159
3208
|
}
|
|
3160
|
-
this.
|
|
3161
|
-
this.
|
|
3162
|
-
this
|
|
3209
|
+
this.Ze = this.Ze.slice(0, e);
|
|
3210
|
+
this.tt = t;
|
|
3211
|
+
this.$e = e;
|
|
3163
3212
|
});
|
|
3164
|
-
return this.
|
|
3213
|
+
return this.Ze;
|
|
3165
3214
|
}
|
|
3166
3215
|
function compare(e, t, n) {
|
|
3167
3216
|
return e ? e(t) === e(n) : true;
|
|
3168
3217
|
}
|
|
3169
3218
|
function boundaryComputed(e, t) {
|
|
3170
3219
|
const n = computed(e, { lazy: true });
|
|
3171
|
-
n.
|
|
3172
|
-
const i = e !== undefined ? e : n.
|
|
3173
|
-
const r = t !== undefined ? t : n.
|
|
3174
|
-
n.
|
|
3175
|
-
n.$.notify(n, n.
|
|
3220
|
+
n.Ge = (e, t) => {
|
|
3221
|
+
const i = e !== undefined ? e : n.Oe;
|
|
3222
|
+
const r = t !== undefined ? t : n.Te;
|
|
3223
|
+
n.Oe &= ~n.rt;
|
|
3224
|
+
n.$.notify(n, n.rt, i, r);
|
|
3176
3225
|
};
|
|
3177
|
-
n.
|
|
3178
|
-
n.
|
|
3226
|
+
n.rt = t;
|
|
3227
|
+
n.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
3179
3228
|
recompute(n, true);
|
|
3180
3229
|
return n;
|
|
3181
3230
|
}
|
|
@@ -3197,52 +3246,52 @@ function isRevealController(e) {
|
|
|
3197
3246
|
return e instanceof RevealController;
|
|
3198
3247
|
}
|
|
3199
3248
|
function isSlotReady(e) {
|
|
3200
|
-
return isRevealController(e) ? e.isReady() : e.
|
|
3249
|
+
return isRevealController(e) ? e.isReady() : e.st.size === 0 && !e.ot;
|
|
3201
3250
|
}
|
|
3202
3251
|
function isSlotMinimallyReady(e) {
|
|
3203
3252
|
return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
|
|
3204
3253
|
}
|
|
3205
3254
|
function setSlotState(e, t, n, i) {
|
|
3206
|
-
setSignal(e.
|
|
3207
|
-
setSignal(e.
|
|
3255
|
+
setSignal(e.ut, n);
|
|
3256
|
+
setSignal(e.ct, i);
|
|
3208
3257
|
if (isRevealController(e)) {
|
|
3209
|
-
if (!n && e.
|
|
3258
|
+
if (!n && e.lt === t) e.lt = undefined;
|
|
3210
3259
|
return e.evaluate(n, i);
|
|
3211
3260
|
}
|
|
3212
|
-
if (!n && e.
|
|
3261
|
+
if (!n && e.ft === t && e.Et) e.ft = undefined;
|
|
3213
3262
|
}
|
|
3214
3263
|
class RevealController {
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3264
|
+
Tt;
|
|
3265
|
+
St;
|
|
3266
|
+
dt = [];
|
|
3267
|
+
lt;
|
|
3268
|
+
ut = signal(false, { ownedWrite: true, Fe: true });
|
|
3269
|
+
ct = signal(false, { ownedWrite: true, Fe: true });
|
|
3270
|
+
Ot = true;
|
|
3271
|
+
Rt = true;
|
|
3272
|
+
_t = false;
|
|
3224
3273
|
constructor(e, t) {
|
|
3225
|
-
this.
|
|
3226
|
-
this.
|
|
3274
|
+
this.Tt = e;
|
|
3275
|
+
this.St = t;
|
|
3227
3276
|
}
|
|
3228
|
-
|
|
3229
|
-
for (let t = 0; t < this.
|
|
3230
|
-
const n = this.
|
|
3231
|
-
if ((isRevealController(n) ? n.
|
|
3277
|
+
It(e) {
|
|
3278
|
+
for (let t = 0; t < this.dt.length; t++) {
|
|
3279
|
+
const n = this.dt[t];
|
|
3280
|
+
if ((isRevealController(n) ? n.lt : n.ft) !== this) continue;
|
|
3232
3281
|
if (e(n) === false) return false;
|
|
3233
3282
|
}
|
|
3234
3283
|
return true;
|
|
3235
3284
|
}
|
|
3236
3285
|
isReady() {
|
|
3237
|
-
return this.
|
|
3286
|
+
return this.It(isSlotReady);
|
|
3238
3287
|
}
|
|
3239
3288
|
isMinimallyReady() {
|
|
3240
|
-
const e = untrack(this.
|
|
3289
|
+
const e = untrack(this.Tt);
|
|
3241
3290
|
if (e === "together") return this.isReady();
|
|
3242
3291
|
if (e === "natural") {
|
|
3243
3292
|
let e = false;
|
|
3244
3293
|
let t = false;
|
|
3245
|
-
this.
|
|
3294
|
+
this.It(n => {
|
|
3246
3295
|
e = true;
|
|
3247
3296
|
if (isSlotMinimallyReady(n)) {
|
|
3248
3297
|
t = true;
|
|
@@ -3252,58 +3301,58 @@ class RevealController {
|
|
|
3252
3301
|
return !e || t;
|
|
3253
3302
|
}
|
|
3254
3303
|
let t = true;
|
|
3255
|
-
this.
|
|
3304
|
+
this.It(e => {
|
|
3256
3305
|
t = isSlotMinimallyReady(e);
|
|
3257
3306
|
return false;
|
|
3258
3307
|
});
|
|
3259
3308
|
return t;
|
|
3260
3309
|
}
|
|
3261
3310
|
register(e) {
|
|
3262
|
-
if (this.
|
|
3263
|
-
this.
|
|
3264
|
-
const t = untrack(this.
|
|
3265
|
-
(setSignal(e.
|
|
3311
|
+
if (this.dt.includes(e)) return;
|
|
3312
|
+
this.dt.push(e);
|
|
3313
|
+
const t = untrack(this.Tt);
|
|
3314
|
+
(setSignal(e.ut, true), setSignal(e.ct, t === "sequential" ? !!untrack(this.St) : false));
|
|
3266
3315
|
untrack(() => this.evaluate());
|
|
3267
3316
|
}
|
|
3268
3317
|
unregister(e) {
|
|
3269
|
-
const t = this.
|
|
3270
|
-
if (t >= 0) this.
|
|
3318
|
+
const t = this.dt.indexOf(e);
|
|
3319
|
+
if (t >= 0) this.dt.splice(t, 1);
|
|
3271
3320
|
untrack(() => this.evaluate());
|
|
3272
3321
|
}
|
|
3273
3322
|
evaluate(e, t) {
|
|
3274
|
-
if (this.
|
|
3275
|
-
this.
|
|
3276
|
-
const n = this.
|
|
3277
|
-
const i = this.
|
|
3323
|
+
if (this._t) return;
|
|
3324
|
+
this._t = true;
|
|
3325
|
+
const n = this.Ot;
|
|
3326
|
+
const i = this.Rt;
|
|
3278
3327
|
try {
|
|
3279
|
-
const n = e ?? read(this.
|
|
3280
|
-
i = untrack(this.
|
|
3281
|
-
r = i === "sequential" && !!untrack(this.
|
|
3328
|
+
const n = e ?? read(this.ut),
|
|
3329
|
+
i = untrack(this.Tt),
|
|
3330
|
+
r = i === "sequential" && !!untrack(this.St),
|
|
3282
3331
|
s = t ?? r;
|
|
3283
3332
|
if (n) {
|
|
3284
|
-
this.
|
|
3333
|
+
this.It(e => setSlotState(e, this, true, s));
|
|
3285
3334
|
} else if (i === "natural") {
|
|
3286
|
-
this.
|
|
3335
|
+
this.It(e => {
|
|
3287
3336
|
if (isRevealController(e)) {
|
|
3288
|
-
setSignal(e.
|
|
3289
|
-
setSignal(e.
|
|
3337
|
+
setSignal(e.ct, false);
|
|
3338
|
+
setSignal(e.ut, false);
|
|
3290
3339
|
e.evaluate(false, false);
|
|
3291
3340
|
} else {
|
|
3292
3341
|
setSlotState(e, this, !isSlotReady(e), false);
|
|
3293
3342
|
}
|
|
3294
3343
|
});
|
|
3295
3344
|
} else if (i === "together") {
|
|
3296
|
-
const e = this.
|
|
3297
|
-
this.
|
|
3345
|
+
const e = this.It(isSlotMinimallyReady);
|
|
3346
|
+
this.It(t => setSlotState(t, this, !e, false));
|
|
3298
3347
|
} else {
|
|
3299
3348
|
let e = false;
|
|
3300
|
-
this.
|
|
3349
|
+
this.It(t => {
|
|
3301
3350
|
if (e) return setSlotState(t, this, true, r);
|
|
3302
3351
|
if (isSlotReady(t)) return setSlotState(t, this, false, false);
|
|
3303
3352
|
e = true;
|
|
3304
3353
|
if (isRevealController(t)) {
|
|
3305
|
-
setSignal(t.
|
|
3306
|
-
setSignal(t.
|
|
3354
|
+
setSignal(t.ct, false);
|
|
3355
|
+
setSignal(t.ut, false);
|
|
3307
3356
|
t.evaluate(false, false);
|
|
3308
3357
|
} else {
|
|
3309
3358
|
setSlotState(t, this, true, false);
|
|
@@ -3311,96 +3360,96 @@ class RevealController {
|
|
|
3311
3360
|
});
|
|
3312
3361
|
}
|
|
3313
3362
|
} finally {
|
|
3314
|
-
this.
|
|
3315
|
-
this.
|
|
3316
|
-
this.
|
|
3363
|
+
this.Ot = this.isReady();
|
|
3364
|
+
this.Rt = this.isMinimallyReady();
|
|
3365
|
+
this._t = false;
|
|
3317
3366
|
}
|
|
3318
|
-
if (this.
|
|
3367
|
+
if (this.lt && (n !== this.Ot || i !== this.Rt)) this.lt.evaluate();
|
|
3319
3368
|
}
|
|
3320
3369
|
}
|
|
3321
3370
|
class CollectionQueue extends Queue {
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3371
|
+
ht;
|
|
3372
|
+
st = new Set();
|
|
3373
|
+
Nt;
|
|
3374
|
+
ot = true;
|
|
3375
|
+
ut = signal(false, { ownedWrite: true, Fe: true });
|
|
3376
|
+
ct = signal(false, { ownedWrite: true, Fe: true });
|
|
3377
|
+
ft;
|
|
3378
|
+
Et = false;
|
|
3379
|
+
At;
|
|
3380
|
+
Pt = ON_INIT;
|
|
3332
3381
|
constructor(e) {
|
|
3333
3382
|
super();
|
|
3334
|
-
this.
|
|
3383
|
+
this.ht = e;
|
|
3335
3384
|
}
|
|
3336
3385
|
run(e) {
|
|
3337
|
-
if (!e || (read(this.
|
|
3386
|
+
if (!e || (read(this.ut) && (!_revealUsed || read(this.ct)))) return;
|
|
3338
3387
|
return super.run(e);
|
|
3339
3388
|
}
|
|
3340
3389
|
notify(e, t, n, i) {
|
|
3341
|
-
if (!(t & this.
|
|
3342
|
-
if (this.
|
|
3390
|
+
if (!(t & this.ht)) return super.notify(e, t, n, i);
|
|
3391
|
+
if (this.Et && this.At) {
|
|
3343
3392
|
const e = untrack(() => {
|
|
3344
3393
|
try {
|
|
3345
|
-
return this.
|
|
3394
|
+
return this.At();
|
|
3346
3395
|
} catch {
|
|
3347
3396
|
return ON_INIT;
|
|
3348
3397
|
}
|
|
3349
3398
|
});
|
|
3350
|
-
if (e !== this.
|
|
3351
|
-
this.
|
|
3352
|
-
this.
|
|
3353
|
-
this.
|
|
3399
|
+
if (e !== this.Pt) {
|
|
3400
|
+
this.Pt = e;
|
|
3401
|
+
this.Et = false;
|
|
3402
|
+
this.st.clear();
|
|
3354
3403
|
}
|
|
3355
3404
|
}
|
|
3356
|
-
if (this.
|
|
3357
|
-
if (this.
|
|
3405
|
+
if (this.ht & STATUS_PENDING && this.Et) return super.notify(e, t, n, i);
|
|
3406
|
+
if (this.ht & STATUS_PENDING && n & STATUS_ERROR) {
|
|
3358
3407
|
return super.notify(e, STATUS_ERROR, n, i);
|
|
3359
3408
|
}
|
|
3360
|
-
if (n & this.
|
|
3361
|
-
this.
|
|
3362
|
-
const t = i?.source || e.
|
|
3409
|
+
if (n & this.ht) {
|
|
3410
|
+
this.ot = true;
|
|
3411
|
+
const t = i?.source || e.Te?.source;
|
|
3363
3412
|
if (t) {
|
|
3364
|
-
const e = this.
|
|
3365
|
-
this.
|
|
3366
|
-
if (e) setSignal(this.
|
|
3413
|
+
const e = this.st.size === 0;
|
|
3414
|
+
this.st.add(t);
|
|
3415
|
+
if (e) setSignal(this.ut, true);
|
|
3367
3416
|
}
|
|
3368
3417
|
}
|
|
3369
|
-
t &= ~this.
|
|
3418
|
+
t &= ~this.ht;
|
|
3370
3419
|
return t ? super.notify(e, t, n, i) : true;
|
|
3371
3420
|
}
|
|
3372
3421
|
checkSources() {
|
|
3373
|
-
for (const e of this.
|
|
3422
|
+
for (const e of this.st) {
|
|
3374
3423
|
if (
|
|
3375
|
-
e.
|
|
3376
|
-
(!(e.
|
|
3424
|
+
e.R & REACTIVE_DISPOSED ||
|
|
3425
|
+
(!(e.Oe & this.ht) && !(this.ht & STATUS_ERROR && e.Oe & STATUS_PENDING))
|
|
3377
3426
|
)
|
|
3378
|
-
this.
|
|
3427
|
+
this.st.delete(e);
|
|
3379
3428
|
}
|
|
3380
|
-
if (!this.
|
|
3381
|
-
if (this.
|
|
3382
|
-
this.
|
|
3429
|
+
if (!this.st.size) {
|
|
3430
|
+
if (this.ht & STATUS_PENDING && this.ot && !this.Et && this.Nt) {
|
|
3431
|
+
this.ot = !!(this.Nt.Oe & this.ht);
|
|
3383
3432
|
} else {
|
|
3384
|
-
this.
|
|
3433
|
+
this.ot = false;
|
|
3385
3434
|
}
|
|
3386
|
-
if (!this.
|
|
3387
|
-
setSignal(this.
|
|
3388
|
-
if (this.
|
|
3435
|
+
if (!this.ot) {
|
|
3436
|
+
setSignal(this.ut, false);
|
|
3437
|
+
if (this.At) {
|
|
3389
3438
|
try {
|
|
3390
|
-
this.
|
|
3439
|
+
this.Pt = untrack(() => this.At());
|
|
3391
3440
|
} catch {}
|
|
3392
3441
|
}
|
|
3393
3442
|
}
|
|
3394
3443
|
}
|
|
3395
|
-
if (_revealUsed) this.
|
|
3444
|
+
if (_revealUsed) this.ft?.evaluate();
|
|
3396
3445
|
}
|
|
3397
3446
|
}
|
|
3398
3447
|
function createCollectionBoundary(e, t, n, i) {
|
|
3399
3448
|
const r = createOwner();
|
|
3400
3449
|
if (_revealUsed) setContext(RevealControllerContext, null, r);
|
|
3401
3450
|
const s = new CollectionQueue(e);
|
|
3402
|
-
if (i) s.
|
|
3403
|
-
const o = (s.
|
|
3451
|
+
if (i) s.At = i;
|
|
3452
|
+
const o = (s.Nt = createBoundChildren(r, t, s, e));
|
|
3404
3453
|
untrack(() => {
|
|
3405
3454
|
let t = false;
|
|
3406
3455
|
try {
|
|
@@ -3409,33 +3458,34 @@ function createCollectionBoundary(e, t, n, i) {
|
|
|
3409
3458
|
if (e instanceof NotReadyError) t = true;
|
|
3410
3459
|
else throw e;
|
|
3411
3460
|
}
|
|
3412
|
-
s.
|
|
3461
|
+
s.ot = t || !!(o.Oe & e) || o.Te instanceof NotReadyError;
|
|
3413
3462
|
});
|
|
3414
3463
|
const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
|
|
3415
3464
|
if (u) {
|
|
3416
|
-
s.
|
|
3465
|
+
s.ft = u;
|
|
3417
3466
|
u.register(s);
|
|
3418
3467
|
cleanup(() => u.unregister(s));
|
|
3419
3468
|
}
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3469
|
+
return accessor(
|
|
3470
|
+
computed(() => {
|
|
3471
|
+
if (!read(s.ut)) {
|
|
3472
|
+
const e = read(o);
|
|
3473
|
+
if (!untrack(() => read(s.ut))) return ((s.Et = true), e);
|
|
3474
|
+
}
|
|
3475
|
+
if (_revealUsed && read(s.ct)) return undefined;
|
|
3476
|
+
return n(s);
|
|
3477
|
+
})
|
|
3478
|
+
);
|
|
3429
3479
|
}
|
|
3430
3480
|
function createLoadingBoundary(e, t, n) {
|
|
3431
3481
|
return createCollectionBoundary(STATUS_PENDING, e, () => t(), n?.on);
|
|
3432
3482
|
}
|
|
3433
3483
|
function createErrorBoundary(e, t) {
|
|
3434
3484
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
3435
|
-
let n = e.
|
|
3436
|
-
const i = n.
|
|
3485
|
+
let n = e.st.values().next().value;
|
|
3486
|
+
const i = n.Te?.cause ?? n.Te;
|
|
3437
3487
|
return t(i, () => {
|
|
3438
|
-
for (const t of e.
|
|
3488
|
+
for (const t of e.st) recompute(t);
|
|
3439
3489
|
schedule();
|
|
3440
3490
|
});
|
|
3441
3491
|
});
|
|
@@ -3456,7 +3506,7 @@ function createRevealOrder(e, t) {
|
|
|
3456
3506
|
o.evaluate();
|
|
3457
3507
|
});
|
|
3458
3508
|
if (i) {
|
|
3459
|
-
o.
|
|
3509
|
+
o.lt = i;
|
|
3460
3510
|
i.register(o);
|
|
3461
3511
|
cleanup(() => i.unregister(o));
|
|
3462
3512
|
}
|