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