@solidjs/signals 2.0.0-beta.14 → 2.0.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/dist/dev.js +295 -194
- package/dist/node.cjs +1419 -1360
- package/dist/prod.js +1152 -1098
- package/dist/types/core/core.d.ts +2 -14
- package/dist/types/core/dev.d.ts +1 -1
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/store/projection.d.ts +2 -2
- package/dist/types/store/store.d.ts +1 -0
- package/dist/types-cjs/core/core.d.cts +2 -14
- package/dist/types-cjs/core/dev.d.cts +1 -1
- package/dist/types-cjs/core/index.d.cts +1 -1
- package/dist/types-cjs/index.d.cts +1 -1
- package/dist/types-cjs/store/projection.d.cts +2 -2
- package/dist/types-cjs/store/store.d.cts +1 -0
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -53,116 +53,7 @@ const STORE_SNAPSHOT_PROPS = "sp";
|
|
|
53
53
|
const SUPPORTS_PROXY = typeof Proxy === "function";
|
|
54
54
|
const defaultContext = {};
|
|
55
55
|
const $REFRESH = Symbol("refresh");
|
|
56
|
-
const diagnosticListeners = new Set();
|
|
57
|
-
const diagnosticCaptures = new Set();
|
|
58
|
-
let diagnosticSequence = 0;
|
|
59
56
|
const DEV$1 = undefined;
|
|
60
|
-
function emitDiagnostic(e) {
|
|
61
|
-
const t = { sequence: ++diagnosticSequence, ...e };
|
|
62
|
-
for (const e of diagnosticListeners) e(t);
|
|
63
|
-
for (const e of diagnosticCaptures) e.push(t);
|
|
64
|
-
return t;
|
|
65
|
-
}
|
|
66
|
-
function actualInsertIntoHeap(e, t) {
|
|
67
|
-
const n = (e.i?.t ? e.i.u?.o : e.i?.o) ?? -1;
|
|
68
|
-
if (n >= e.o) e.o = n + 1;
|
|
69
|
-
const i = e.o;
|
|
70
|
-
const r = t.l[i];
|
|
71
|
-
if (r === undefined) t.l[i] = e;
|
|
72
|
-
else {
|
|
73
|
-
const t = r.S;
|
|
74
|
-
t.T = e;
|
|
75
|
-
e.S = t;
|
|
76
|
-
r.S = e;
|
|
77
|
-
}
|
|
78
|
-
if (i > t._) t._ = i;
|
|
79
|
-
}
|
|
80
|
-
function insertIntoHeap(e, t) {
|
|
81
|
-
let n = e.O;
|
|
82
|
-
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_MANUAL_WRITE)) return;
|
|
83
|
-
if (n & REACTIVE_CHECK) {
|
|
84
|
-
e.O = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
85
|
-
} else e.O = n | REACTIVE_IN_HEAP;
|
|
86
|
-
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
87
|
-
}
|
|
88
|
-
function insertIntoHeapHeight(e, t) {
|
|
89
|
-
let n = e.O;
|
|
90
|
-
if (
|
|
91
|
-
n &
|
|
92
|
-
(REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT | REACTIVE_MANUAL_WRITE)
|
|
93
|
-
)
|
|
94
|
-
return;
|
|
95
|
-
e.O = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
96
|
-
actualInsertIntoHeap(e, t);
|
|
97
|
-
}
|
|
98
|
-
function deleteFromHeap(e, t) {
|
|
99
|
-
const n = e.O;
|
|
100
|
-
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
101
|
-
e.O = n & -25;
|
|
102
|
-
const i = e.o;
|
|
103
|
-
if (e.S === e) t.l[i] = undefined;
|
|
104
|
-
else {
|
|
105
|
-
const n = e.T;
|
|
106
|
-
const r = t.l[i];
|
|
107
|
-
const o = n ?? r;
|
|
108
|
-
if (e === r) t.l[i] = n;
|
|
109
|
-
else e.S.T = n;
|
|
110
|
-
o.S = e.S;
|
|
111
|
-
}
|
|
112
|
-
e.S = e;
|
|
113
|
-
e.T = undefined;
|
|
114
|
-
}
|
|
115
|
-
function markHeap(e) {
|
|
116
|
-
if (e.R) return;
|
|
117
|
-
e.R = true;
|
|
118
|
-
for (let t = 0; t <= e._; t++) {
|
|
119
|
-
for (let n = e.l[t]; n !== undefined; n = n.T) {
|
|
120
|
-
if (n.O & REACTIVE_IN_HEAP) markNode(n);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function markNode(e, t = REACTIVE_DIRTY) {
|
|
125
|
-
const n = e.O;
|
|
126
|
-
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
127
|
-
e.O = (n & -4) | t;
|
|
128
|
-
for (let t = e.I; t !== null; t = t.p) {
|
|
129
|
-
markNode(t.h, REACTIVE_CHECK);
|
|
130
|
-
}
|
|
131
|
-
if (e.N !== null) {
|
|
132
|
-
for (let t = e.N; t !== null; t = t.A) {
|
|
133
|
-
for (let e = t.I; e !== null; e = e.p) {
|
|
134
|
-
markNode(e.h, REACTIVE_CHECK);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function runHeap(e, t) {
|
|
140
|
-
e.R = false;
|
|
141
|
-
for (e.C = 0; e.C <= e._; e.C++) {
|
|
142
|
-
let n = e.l[e.C];
|
|
143
|
-
while (n !== undefined) {
|
|
144
|
-
if (n.O & REACTIVE_IN_HEAP) t(n);
|
|
145
|
-
else adjustHeight(n, e);
|
|
146
|
-
n = e.l[e.C];
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
e._ = 0;
|
|
150
|
-
}
|
|
151
|
-
function adjustHeight(e, t) {
|
|
152
|
-
deleteFromHeap(e, t);
|
|
153
|
-
let n = e.o;
|
|
154
|
-
for (let t = e.P; t; t = t.D) {
|
|
155
|
-
const e = t.m;
|
|
156
|
-
const i = e.V || e;
|
|
157
|
-
if (i.L && i.o >= n) n = i.o + 1;
|
|
158
|
-
}
|
|
159
|
-
if (e.o !== n) {
|
|
160
|
-
e.o = n;
|
|
161
|
-
for (let n = e.I; n !== null; n = n.p) {
|
|
162
|
-
insertIntoHeapHeight(n.h, t);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
57
|
const signalLanes = new WeakMap();
|
|
167
58
|
const activeLanes = new Set();
|
|
168
59
|
function getOrCreateLane(e) {
|
|
@@ -170,66 +61,66 @@ function getOrCreateLane(e) {
|
|
|
170
61
|
if (t) {
|
|
171
62
|
return findLane(t);
|
|
172
63
|
}
|
|
173
|
-
const n = e.
|
|
174
|
-
const i = n?.
|
|
175
|
-
t = {
|
|
64
|
+
const n = e.t;
|
|
65
|
+
const i = n?.i ? findLane(n.i) : null;
|
|
66
|
+
t = { o: e, u: new Set(), l: [[], []], T: null, S: activeTransition, _: i };
|
|
176
67
|
signalLanes.set(e, t);
|
|
177
68
|
activeLanes.add(t);
|
|
178
|
-
e
|
|
69
|
+
e.O = false;
|
|
179
70
|
return t;
|
|
180
71
|
}
|
|
181
72
|
function findLane(e) {
|
|
182
|
-
while (e.
|
|
73
|
+
while (e.T) e = e.T;
|
|
183
74
|
return e;
|
|
184
75
|
}
|
|
185
76
|
function mergeLanes(e, t) {
|
|
186
77
|
e = findLane(e);
|
|
187
78
|
t = findLane(t);
|
|
188
79
|
if (e === t) return e;
|
|
189
|
-
t.
|
|
190
|
-
for (const n of t.
|
|
191
|
-
e.
|
|
192
|
-
e.
|
|
80
|
+
t.T = e;
|
|
81
|
+
for (const n of t.u) e.u.add(n);
|
|
82
|
+
e.l[0].push(...t.l[0]);
|
|
83
|
+
e.l[1].push(...t.l[1]);
|
|
193
84
|
return e;
|
|
194
85
|
}
|
|
195
86
|
function resolveLane(e) {
|
|
196
|
-
const t = e.
|
|
87
|
+
const t = e.i;
|
|
197
88
|
if (!t) return undefined;
|
|
198
89
|
const n = findLane(t);
|
|
199
90
|
if (activeLanes.has(n)) return n;
|
|
200
|
-
e.
|
|
91
|
+
e.i = undefined;
|
|
201
92
|
return undefined;
|
|
202
93
|
}
|
|
203
94
|
function resolveTransition(e) {
|
|
204
|
-
return resolveLane(e)?.
|
|
95
|
+
return resolveLane(e)?.S ?? e.S;
|
|
205
96
|
}
|
|
206
97
|
function hasActiveOverride(e) {
|
|
207
|
-
return !!(e.
|
|
98
|
+
return !!(e.R !== undefined && e.R !== NOT_PENDING);
|
|
208
99
|
}
|
|
209
100
|
function assignOrMergeLane(e, t) {
|
|
210
101
|
const n = findLane(t);
|
|
211
|
-
const i = e.
|
|
102
|
+
const i = e.i;
|
|
212
103
|
if (i) {
|
|
213
|
-
if (i.
|
|
214
|
-
e.
|
|
104
|
+
if (i.T) {
|
|
105
|
+
e.i = t;
|
|
215
106
|
return;
|
|
216
107
|
}
|
|
217
108
|
const r = findLane(i);
|
|
218
109
|
if (activeLanes.has(r)) {
|
|
219
110
|
if (r !== n && !hasActiveOverride(e)) {
|
|
220
|
-
if (n.
|
|
221
|
-
e.
|
|
222
|
-
} else if (r.
|
|
111
|
+
if (n._ && findLane(n._) === r) {
|
|
112
|
+
e.i = t;
|
|
113
|
+
} else if (r._ && findLane(r._) === n);
|
|
223
114
|
else mergeLanes(n, r);
|
|
224
115
|
}
|
|
225
116
|
return;
|
|
226
117
|
}
|
|
227
118
|
}
|
|
228
|
-
e.
|
|
119
|
+
e.i = t;
|
|
229
120
|
}
|
|
230
121
|
const transitions = new Set();
|
|
231
|
-
const dirtyQueue = {
|
|
232
|
-
const zombieQueue = {
|
|
122
|
+
const dirtyQueue = { I: new Array(2e3).fill(undefined), p: false, h: 0, N: 0 };
|
|
123
|
+
const zombieQueue = { I: new Array(2e3).fill(undefined), p: false, h: 0, N: 0 };
|
|
233
124
|
let clock = 0;
|
|
234
125
|
let activeTransition = null;
|
|
235
126
|
let scheduled = false;
|
|
@@ -244,23 +135,23 @@ function canUseSimpleSyncFlush(e) {
|
|
|
244
135
|
return (
|
|
245
136
|
transitions.size === 0 &&
|
|
246
137
|
activeLanes.size === 0 &&
|
|
247
|
-
e.
|
|
248
|
-
e.
|
|
249
|
-
e.
|
|
138
|
+
e.A.length === 0 &&
|
|
139
|
+
e.P.length === 0 &&
|
|
140
|
+
e.C.size === 0 &&
|
|
250
141
|
transientStoreNodes.size === 0
|
|
251
142
|
);
|
|
252
143
|
}
|
|
253
144
|
function sweepTransientStoreNodes() {
|
|
254
145
|
if (transientStoreNodes.size === 0) return;
|
|
255
146
|
for (const e of transientStoreNodes) {
|
|
256
|
-
if (e.
|
|
147
|
+
if (e.D !== null) {
|
|
257
148
|
transientStoreNodes.delete(e);
|
|
258
149
|
continue;
|
|
259
150
|
}
|
|
260
|
-
if (e.
|
|
261
|
-
if (e.
|
|
151
|
+
if (e.m !== NOT_PENDING) continue;
|
|
152
|
+
if (e.R !== undefined && e.R !== NOT_PENDING) continue;
|
|
262
153
|
transientStoreNodes.delete(e);
|
|
263
|
-
e.
|
|
154
|
+
e.V?.();
|
|
264
155
|
}
|
|
265
156
|
}
|
|
266
157
|
function enforceLoadingBoundary(e) {}
|
|
@@ -269,27 +160,27 @@ function shouldReadStashedOptimisticValue(e) {
|
|
|
269
160
|
}
|
|
270
161
|
function runLaneEffects(e) {
|
|
271
162
|
for (const t of activeLanes) {
|
|
272
|
-
if (t.
|
|
273
|
-
const n = t.
|
|
163
|
+
if (t.T || t.u.size > 0) continue;
|
|
164
|
+
const n = t.l[e - 1];
|
|
274
165
|
if (n.length) {
|
|
275
|
-
t.
|
|
166
|
+
t.l[e - 1] = [];
|
|
276
167
|
runQueue(n, e);
|
|
277
168
|
}
|
|
278
169
|
}
|
|
279
170
|
}
|
|
280
171
|
function queueStashedOptimisticEffects(e) {
|
|
281
|
-
for (let t = e.
|
|
282
|
-
const e = t.
|
|
283
|
-
if (!e.
|
|
284
|
-
if (e.
|
|
285
|
-
if (!e.
|
|
286
|
-
e.
|
|
287
|
-
e.
|
|
172
|
+
for (let t = e.D; t !== null; t = t.L) {
|
|
173
|
+
const e = t.U;
|
|
174
|
+
if (!e.G) continue;
|
|
175
|
+
if (e.G === EFFECT_TRACKED) {
|
|
176
|
+
if (!e.k) {
|
|
177
|
+
e.k = true;
|
|
178
|
+
e.F.enqueue(EFFECT_USER, e.W);
|
|
288
179
|
}
|
|
289
180
|
continue;
|
|
290
181
|
}
|
|
291
|
-
const n = e.
|
|
292
|
-
if (n.
|
|
182
|
+
const n = e.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
183
|
+
if (n.h > e.H) n.h = e.H;
|
|
293
184
|
insertIntoHeap(e, n);
|
|
294
185
|
}
|
|
295
186
|
}
|
|
@@ -297,153 +188,153 @@ function setProjectionWriteActive(e) {
|
|
|
297
188
|
projectionWriteActive = e;
|
|
298
189
|
}
|
|
299
190
|
function mergeTransitionState(e, t) {
|
|
300
|
-
t.
|
|
301
|
-
e
|
|
302
|
-
for (const n of activeLanes) if (n.
|
|
303
|
-
e.
|
|
304
|
-
for (const n of t.
|
|
305
|
-
for (const [n, i] of t.
|
|
306
|
-
let t = e.
|
|
307
|
-
if (!t) e.
|
|
191
|
+
t.j = e;
|
|
192
|
+
e.$.push(...t.$);
|
|
193
|
+
for (const n of activeLanes) if (n.S === t) n.S = e;
|
|
194
|
+
e.P.push(...t.P);
|
|
195
|
+
for (const n of t.C) e.C.add(n);
|
|
196
|
+
for (const [n, i] of t.K) {
|
|
197
|
+
let t = e.K.get(n);
|
|
198
|
+
if (!t) e.K.set(n, (t = new Set()));
|
|
308
199
|
for (const e of i) t.add(e);
|
|
309
200
|
}
|
|
310
|
-
for (const n of t.
|
|
201
|
+
for (const n of t.Y) e.Y.add(n);
|
|
311
202
|
}
|
|
312
203
|
function resolveOptimisticNodes(e) {
|
|
313
204
|
for (let t = 0; t < e.length; t++) {
|
|
314
205
|
const n = e[t];
|
|
315
|
-
n.
|
|
316
|
-
if (n.
|
|
317
|
-
n.
|
|
318
|
-
n.
|
|
206
|
+
n.i = undefined;
|
|
207
|
+
if (n.m !== NOT_PENDING) {
|
|
208
|
+
n.Z = n.m;
|
|
209
|
+
n.m = NOT_PENDING;
|
|
319
210
|
}
|
|
320
|
-
const i = n.
|
|
321
|
-
n.
|
|
322
|
-
if (i !== NOT_PENDING && n.
|
|
323
|
-
n.
|
|
211
|
+
const i = n.R;
|
|
212
|
+
n.R = NOT_PENDING;
|
|
213
|
+
if (i !== NOT_PENDING && n.Z !== i) insertSubs(n, true);
|
|
214
|
+
n.S = null;
|
|
324
215
|
}
|
|
325
216
|
e.length = 0;
|
|
326
217
|
}
|
|
327
218
|
function cleanupCompletedLanes(e) {
|
|
328
219
|
for (const t of activeLanes) {
|
|
329
|
-
const n = e ? t.
|
|
220
|
+
const n = e ? t.S === e : !t.S;
|
|
330
221
|
if (!n) continue;
|
|
331
|
-
if (!t.
|
|
332
|
-
if (t.
|
|
333
|
-
if (t.
|
|
334
|
-
}
|
|
335
|
-
if (t.
|
|
336
|
-
t.
|
|
337
|
-
t.
|
|
338
|
-
t.
|
|
222
|
+
if (!t.T) {
|
|
223
|
+
if (t.l[0].length) runQueue(t.l[0], EFFECT_RENDER);
|
|
224
|
+
if (t.l[1].length) runQueue(t.l[1], EFFECT_USER);
|
|
225
|
+
}
|
|
226
|
+
if (t.o.i === t) t.o.i = undefined;
|
|
227
|
+
t.u.clear();
|
|
228
|
+
t.l[0].length = 0;
|
|
229
|
+
t.l[1].length = 0;
|
|
339
230
|
activeLanes.delete(t);
|
|
340
|
-
signalLanes.delete(t.
|
|
231
|
+
signalLanes.delete(t.o);
|
|
341
232
|
}
|
|
342
233
|
}
|
|
343
234
|
function schedule() {
|
|
344
235
|
if (scheduled) return;
|
|
345
236
|
scheduled = true;
|
|
346
|
-
if (!syncDepth && !globalQueue.
|
|
237
|
+
if (!syncDepth && !globalQueue.B && !projectionWriteActive) queueMicrotask(flush);
|
|
347
238
|
}
|
|
348
239
|
class Queue {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
240
|
+
q = null;
|
|
241
|
+
X = [[], []];
|
|
242
|
+
A = [];
|
|
352
243
|
created = clock;
|
|
353
244
|
addChild(e) {
|
|
354
|
-
this.
|
|
355
|
-
e.
|
|
245
|
+
this.A.push(e);
|
|
246
|
+
e.q = this;
|
|
356
247
|
}
|
|
357
248
|
removeChild(e) {
|
|
358
|
-
const t = this.
|
|
249
|
+
const t = this.A.indexOf(e);
|
|
359
250
|
if (t >= 0) {
|
|
360
|
-
this.
|
|
361
|
-
e.
|
|
251
|
+
this.A.splice(t, 1);
|
|
252
|
+
e.q = null;
|
|
362
253
|
}
|
|
363
254
|
}
|
|
364
255
|
notify(e, t, n, i) {
|
|
365
|
-
if (this.
|
|
256
|
+
if (this.q) return this.q.notify(e, t, n, i);
|
|
366
257
|
return false;
|
|
367
258
|
}
|
|
368
259
|
run(e) {
|
|
369
|
-
if (this.
|
|
370
|
-
const t = this.
|
|
371
|
-
this.
|
|
260
|
+
if (this.X[e - 1].length) {
|
|
261
|
+
const t = this.X[e - 1];
|
|
262
|
+
this.X[e - 1] = [];
|
|
372
263
|
runQueue(t, e);
|
|
373
264
|
}
|
|
374
|
-
for (let t = 0; t < this.
|
|
265
|
+
for (let t = 0; t < this.A.length; t++) this.A[t].run?.(e);
|
|
375
266
|
}
|
|
376
267
|
enqueue(e, t) {
|
|
377
268
|
if (e) {
|
|
378
269
|
if (currentOptimisticLane) {
|
|
379
270
|
const n = findLane(currentOptimisticLane);
|
|
380
|
-
n.
|
|
271
|
+
n.l[e - 1].push(t);
|
|
381
272
|
} else {
|
|
382
|
-
this.
|
|
273
|
+
this.X[e - 1].push(t);
|
|
383
274
|
}
|
|
384
275
|
}
|
|
385
276
|
schedule();
|
|
386
277
|
}
|
|
387
278
|
stashQueues(e) {
|
|
388
|
-
e.
|
|
389
|
-
e.
|
|
390
|
-
this.
|
|
391
|
-
for (let t = 0; t < this.
|
|
392
|
-
let n = this.
|
|
393
|
-
let i = e.
|
|
279
|
+
e.X[0].push(...this.X[0]);
|
|
280
|
+
e.X[1].push(...this.X[1]);
|
|
281
|
+
this.X = [[], []];
|
|
282
|
+
for (let t = 0; t < this.A.length; t++) {
|
|
283
|
+
let n = this.A[t];
|
|
284
|
+
let i = e.A[t];
|
|
394
285
|
if (!i) {
|
|
395
|
-
i = {
|
|
396
|
-
e.
|
|
286
|
+
i = { X: [[], []], A: [] };
|
|
287
|
+
e.A[t] = i;
|
|
397
288
|
}
|
|
398
289
|
n.stashQueues(i);
|
|
399
290
|
}
|
|
400
291
|
}
|
|
401
292
|
restoreQueues(e) {
|
|
402
|
-
this.
|
|
403
|
-
this.
|
|
404
|
-
for (let t = 0; t < e.
|
|
405
|
-
const n = e.
|
|
406
|
-
let i = this.
|
|
293
|
+
this.X[0].push(...e.X[0]);
|
|
294
|
+
this.X[1].push(...e.X[1]);
|
|
295
|
+
for (let t = 0; t < e.A.length; t++) {
|
|
296
|
+
const n = e.A[t];
|
|
297
|
+
let i = this.A[t];
|
|
407
298
|
if (i) i.restoreQueues(n);
|
|
408
299
|
}
|
|
409
300
|
}
|
|
410
301
|
}
|
|
411
302
|
class GlobalQueue extends Queue {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
static
|
|
418
|
-
static
|
|
419
|
-
static
|
|
420
|
-
static
|
|
303
|
+
B = false;
|
|
304
|
+
J = null;
|
|
305
|
+
ee = [];
|
|
306
|
+
P = [];
|
|
307
|
+
C = new Set();
|
|
308
|
+
static te;
|
|
309
|
+
static ne;
|
|
310
|
+
static ie;
|
|
311
|
+
static re = null;
|
|
421
312
|
flush() {
|
|
422
|
-
if (this.
|
|
423
|
-
this.
|
|
313
|
+
if (this.B) return;
|
|
314
|
+
this.B = true;
|
|
424
315
|
try {
|
|
425
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
316
|
+
runHeap(dirtyQueue, GlobalQueue.te);
|
|
426
317
|
if (activeTransition) {
|
|
427
318
|
const e = transitionComplete(activeTransition);
|
|
428
319
|
if (!e) {
|
|
429
320
|
const e = activeTransition;
|
|
430
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
431
|
-
this.
|
|
432
|
-
this.
|
|
433
|
-
this.
|
|
434
|
-
this.
|
|
321
|
+
runHeap(zombieQueue, GlobalQueue.te);
|
|
322
|
+
this.J = null;
|
|
323
|
+
this.ee = [];
|
|
324
|
+
this.P = [];
|
|
325
|
+
this.C = new Set();
|
|
435
326
|
runLaneEffects(EFFECT_RENDER);
|
|
436
327
|
runLaneEffects(EFFECT_USER);
|
|
437
|
-
this.stashQueues(e.
|
|
328
|
+
this.stashQueues(e.oe);
|
|
438
329
|
clock++;
|
|
439
|
-
scheduled = dirtyQueue.
|
|
440
|
-
reassignPendingTransition(e.
|
|
330
|
+
scheduled = dirtyQueue.N >= dirtyQueue.h;
|
|
331
|
+
reassignPendingTransition(e.ee);
|
|
441
332
|
activeTransition = null;
|
|
442
|
-
if (!e
|
|
333
|
+
if (!e.$.length && !e.K.size && e.P.length) {
|
|
443
334
|
stashedOptimisticReads = new Set();
|
|
444
|
-
for (let t = 0; t < e.
|
|
445
|
-
const n = e.
|
|
446
|
-
if (n.
|
|
335
|
+
for (let t = 0; t < e.P.length; t++) {
|
|
336
|
+
const n = e.P[t];
|
|
337
|
+
if (n.se || n.ue & CONFIG_OWNED_WRITE) continue;
|
|
447
338
|
stashedOptimisticReads.add(n);
|
|
448
339
|
queueStashedOptimisticEffects(n);
|
|
449
340
|
}
|
|
@@ -455,44 +346,44 @@ class GlobalQueue extends Queue {
|
|
|
455
346
|
}
|
|
456
347
|
return;
|
|
457
348
|
}
|
|
458
|
-
this.
|
|
459
|
-
this.restoreQueues(activeTransition.
|
|
349
|
+
this.ee !== activeTransition.ee && this.ee.push(...activeTransition.ee);
|
|
350
|
+
this.restoreQueues(activeTransition.oe);
|
|
460
351
|
transitions.delete(activeTransition);
|
|
461
352
|
const t = activeTransition;
|
|
462
353
|
activeTransition = null;
|
|
463
|
-
reassignPendingTransition(this.
|
|
354
|
+
reassignPendingTransition(this.ee);
|
|
464
355
|
finalizePureQueue(t);
|
|
465
356
|
} else {
|
|
466
357
|
if (canUseSimpleSyncFlush(this)) {
|
|
467
358
|
commitPendingNodes();
|
|
468
|
-
if (dirtyQueue.
|
|
469
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
359
|
+
if (dirtyQueue.N >= dirtyQueue.h) {
|
|
360
|
+
runHeap(dirtyQueue, GlobalQueue.te);
|
|
470
361
|
commitPendingNodes();
|
|
471
362
|
}
|
|
472
363
|
} else {
|
|
473
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
364
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.te);
|
|
474
365
|
finalizePureQueue();
|
|
475
366
|
}
|
|
476
367
|
}
|
|
477
368
|
clock++;
|
|
478
|
-
scheduled = dirtyQueue.
|
|
369
|
+
scheduled = dirtyQueue.N >= dirtyQueue.h;
|
|
479
370
|
activeLanes.size && runLaneEffects(EFFECT_RENDER);
|
|
480
371
|
this.run(EFFECT_RENDER);
|
|
481
372
|
activeLanes.size && runLaneEffects(EFFECT_USER);
|
|
482
373
|
this.run(EFFECT_USER);
|
|
483
374
|
if (false);
|
|
484
375
|
} finally {
|
|
485
|
-
this.
|
|
376
|
+
this.B = false;
|
|
486
377
|
}
|
|
487
378
|
}
|
|
488
379
|
notify(e, t, n, i) {
|
|
489
380
|
if (t & STATUS_PENDING) {
|
|
490
381
|
if (n & STATUS_PENDING) {
|
|
491
|
-
const t = i !== undefined ? i : e.
|
|
382
|
+
const t = i !== undefined ? i : e.ce;
|
|
492
383
|
if (activeTransition && t) {
|
|
493
384
|
const n = t.source;
|
|
494
|
-
let i = activeTransition.
|
|
495
|
-
if (!i) activeTransition.
|
|
385
|
+
let i = activeTransition.K.get(n);
|
|
386
|
+
if (!i) activeTransition.K.set(n, (i = new Set()));
|
|
496
387
|
const r = i.size;
|
|
497
388
|
i.add(e);
|
|
498
389
|
if (i.size !== r) schedule();
|
|
@@ -505,18 +396,18 @@ class GlobalQueue extends Queue {
|
|
|
505
396
|
initTransition(e) {
|
|
506
397
|
if (e) e = currentTransition(e);
|
|
507
398
|
if (e && e === activeTransition) return;
|
|
508
|
-
if (!e && activeTransition && activeTransition.
|
|
399
|
+
if (!e && activeTransition && activeTransition.le === clock) return;
|
|
509
400
|
if (!activeTransition) {
|
|
510
401
|
activeTransition = e ?? {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
402
|
+
le: clock,
|
|
403
|
+
ee: [],
|
|
404
|
+
K: new Map(),
|
|
405
|
+
P: [],
|
|
406
|
+
C: new Set(),
|
|
407
|
+
$: [],
|
|
408
|
+
oe: { X: [[], []], A: [] },
|
|
409
|
+
j: false,
|
|
410
|
+
Y: new Set()
|
|
520
411
|
};
|
|
521
412
|
} else if (e) {
|
|
522
413
|
const t = activeTransition;
|
|
@@ -525,104 +416,104 @@ class GlobalQueue extends Queue {
|
|
|
525
416
|
activeTransition = e;
|
|
526
417
|
}
|
|
527
418
|
transitions.add(activeTransition);
|
|
528
|
-
activeTransition.
|
|
529
|
-
if (this.
|
|
530
|
-
this.
|
|
531
|
-
activeTransition.
|
|
532
|
-
this.
|
|
533
|
-
}
|
|
534
|
-
if (this.
|
|
535
|
-
for (let e = 0; e < this.
|
|
536
|
-
const t = this.
|
|
537
|
-
t.
|
|
538
|
-
activeTransition.
|
|
419
|
+
activeTransition.le = clock;
|
|
420
|
+
if (this.J !== null) {
|
|
421
|
+
this.J.S = activeTransition;
|
|
422
|
+
activeTransition.ee.push(this.J);
|
|
423
|
+
this.J = null;
|
|
424
|
+
}
|
|
425
|
+
if (this.ee !== activeTransition.ee) {
|
|
426
|
+
for (let e = 0; e < this.ee.length; e++) {
|
|
427
|
+
const t = this.ee[e];
|
|
428
|
+
t.S = activeTransition;
|
|
429
|
+
activeTransition.ee.push(t);
|
|
539
430
|
}
|
|
540
|
-
this.
|
|
431
|
+
this.ee = activeTransition.ee;
|
|
541
432
|
}
|
|
542
|
-
if (this.
|
|
543
|
-
for (let e = 0; e < this.
|
|
544
|
-
const t = this.
|
|
545
|
-
t.
|
|
546
|
-
activeTransition.
|
|
433
|
+
if (this.P !== activeTransition.P) {
|
|
434
|
+
for (let e = 0; e < this.P.length; e++) {
|
|
435
|
+
const t = this.P[e];
|
|
436
|
+
t.S = activeTransition;
|
|
437
|
+
activeTransition.P.push(t);
|
|
547
438
|
}
|
|
548
|
-
this.
|
|
439
|
+
this.P = activeTransition.P;
|
|
549
440
|
}
|
|
550
441
|
for (const e of activeLanes) {
|
|
551
|
-
if (!e.
|
|
442
|
+
if (!e.S) e.S = activeTransition;
|
|
552
443
|
}
|
|
553
|
-
if (this.
|
|
554
|
-
for (const e of this.
|
|
555
|
-
this.
|
|
444
|
+
if (this.C !== activeTransition.C) {
|
|
445
|
+
for (const e of this.C) activeTransition.C.add(e);
|
|
446
|
+
this.C = activeTransition.C;
|
|
556
447
|
}
|
|
557
448
|
}
|
|
558
449
|
}
|
|
559
450
|
function queuePendingNode(e) {
|
|
560
451
|
if (activeTransition) {
|
|
561
|
-
globalQueue.
|
|
452
|
+
globalQueue.ee.push(e);
|
|
562
453
|
return;
|
|
563
454
|
}
|
|
564
|
-
if (globalQueue.
|
|
565
|
-
globalQueue.
|
|
455
|
+
if (globalQueue.J === null && globalQueue.ee.length === 0) {
|
|
456
|
+
globalQueue.J = e;
|
|
566
457
|
return;
|
|
567
458
|
}
|
|
568
|
-
if (globalQueue.
|
|
569
|
-
globalQueue.
|
|
570
|
-
globalQueue.
|
|
459
|
+
if (globalQueue.J !== null) {
|
|
460
|
+
globalQueue.ee.push(globalQueue.J);
|
|
461
|
+
globalQueue.J = null;
|
|
571
462
|
}
|
|
572
|
-
globalQueue.
|
|
463
|
+
globalQueue.ee.push(e);
|
|
573
464
|
}
|
|
574
465
|
function insertSubs(e, t = false) {
|
|
575
|
-
const n = e.
|
|
576
|
-
const i = e.
|
|
577
|
-
for (let r = e.
|
|
578
|
-
if (i && r.
|
|
579
|
-
r.
|
|
466
|
+
const n = e.i || currentOptimisticLane;
|
|
467
|
+
const i = e.ae !== undefined;
|
|
468
|
+
for (let r = e.D; r !== null; r = r.L) {
|
|
469
|
+
if (i && r.U.ue & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
470
|
+
r.U.M |= REACTIVE_SNAPSHOT_STALE;
|
|
580
471
|
continue;
|
|
581
472
|
}
|
|
582
473
|
if (t && n) {
|
|
583
|
-
r.
|
|
584
|
-
assignOrMergeLane(r.
|
|
474
|
+
r.U.M |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
475
|
+
assignOrMergeLane(r.U, n);
|
|
585
476
|
} else if (t) {
|
|
586
|
-
r.
|
|
587
|
-
r.
|
|
588
|
-
}
|
|
589
|
-
const e = r.
|
|
590
|
-
if (e.
|
|
591
|
-
if (!e.
|
|
592
|
-
e.
|
|
593
|
-
e.
|
|
477
|
+
r.U.M |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
478
|
+
r.U.i = undefined;
|
|
479
|
+
}
|
|
480
|
+
const e = r.U;
|
|
481
|
+
if (e.G === EFFECT_TRACKED) {
|
|
482
|
+
if (!e.k) {
|
|
483
|
+
e.k = true;
|
|
484
|
+
e.F.enqueue(EFFECT_USER, e.W);
|
|
594
485
|
}
|
|
595
486
|
continue;
|
|
596
487
|
}
|
|
597
|
-
const o = r.
|
|
598
|
-
if (o.
|
|
599
|
-
insertIntoHeap(r.
|
|
488
|
+
const o = r.U.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
489
|
+
if (o.h > r.U.H) o.h = r.U.H;
|
|
490
|
+
insertIntoHeap(r.U, o);
|
|
600
491
|
}
|
|
601
492
|
}
|
|
602
493
|
function commitPendingNode(e) {
|
|
603
494
|
const t = e;
|
|
604
|
-
if (!t.
|
|
605
|
-
if (e.
|
|
606
|
-
e.
|
|
607
|
-
e.
|
|
495
|
+
if (!t.se) {
|
|
496
|
+
if (e.m !== NOT_PENDING) {
|
|
497
|
+
e.Z = e.m;
|
|
498
|
+
e.m = NOT_PENDING;
|
|
608
499
|
}
|
|
609
500
|
return;
|
|
610
501
|
}
|
|
611
|
-
if (e.
|
|
612
|
-
e.
|
|
613
|
-
e.
|
|
614
|
-
if (e.
|
|
502
|
+
if (e.m !== NOT_PENDING) {
|
|
503
|
+
e.Z = e.m;
|
|
504
|
+
e.m = NOT_PENDING;
|
|
505
|
+
if (e.G && e.G !== EFFECT_TRACKED) e.k = true;
|
|
615
506
|
}
|
|
616
|
-
t.
|
|
617
|
-
if (!(t.
|
|
618
|
-
if (t.
|
|
507
|
+
t.M &= ~REACTIVE_MANUAL_WRITE;
|
|
508
|
+
if (!(t.fe & STATUS_PENDING)) t.fe &= ~STATUS_UNINITIALIZED;
|
|
509
|
+
if (t.Ee !== null || t.Te !== null) GlobalQueue.ne(t, false, true);
|
|
619
510
|
}
|
|
620
511
|
function commitPendingNodes() {
|
|
621
|
-
if (globalQueue.
|
|
622
|
-
commitPendingNode(globalQueue.
|
|
623
|
-
globalQueue.
|
|
512
|
+
if (globalQueue.J !== null) {
|
|
513
|
+
commitPendingNode(globalQueue.J);
|
|
514
|
+
globalQueue.J = null;
|
|
624
515
|
}
|
|
625
|
-
const e = globalQueue.
|
|
516
|
+
const e = globalQueue.ee;
|
|
626
517
|
for (let t = 0; t < e.length; t++) {
|
|
627
518
|
commitPendingNode(e[t]);
|
|
628
519
|
}
|
|
@@ -631,32 +522,32 @@ function commitPendingNodes() {
|
|
|
631
522
|
function finalizePureQueue(e = null, t = false) {
|
|
632
523
|
const n = !t;
|
|
633
524
|
if (n) commitPendingNodes();
|
|
634
|
-
if (!t && globalQueue.
|
|
635
|
-
const i = dirtyQueue.
|
|
636
|
-
if (i) runHeap(dirtyQueue, GlobalQueue.
|
|
525
|
+
if (!t && globalQueue.A.length) checkBoundaryChildren(globalQueue);
|
|
526
|
+
const i = dirtyQueue.N >= dirtyQueue.h;
|
|
527
|
+
if (i) runHeap(dirtyQueue, GlobalQueue.te);
|
|
637
528
|
if (n) {
|
|
638
529
|
if (i) commitPendingNodes();
|
|
639
|
-
resolveOptimisticNodes(e ? e.
|
|
640
|
-
if (e && e.
|
|
641
|
-
for (const t of e.
|
|
642
|
-
if (t.
|
|
643
|
-
if (t.
|
|
644
|
-
if (!t.
|
|
645
|
-
t.
|
|
646
|
-
t.
|
|
530
|
+
resolveOptimisticNodes(e ? e.P : globalQueue.P);
|
|
531
|
+
if (e && e.Y.size) {
|
|
532
|
+
for (const t of e.Y) {
|
|
533
|
+
if (t.M & REACTIVE_DISPOSED) continue;
|
|
534
|
+
if (t.G === EFFECT_TRACKED) {
|
|
535
|
+
if (!t.k) {
|
|
536
|
+
t.k = true;
|
|
537
|
+
t.F.enqueue(EFFECT_USER, t.W);
|
|
647
538
|
}
|
|
648
539
|
continue;
|
|
649
540
|
}
|
|
650
|
-
const e = t.
|
|
651
|
-
if (e.
|
|
541
|
+
const e = t.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
542
|
+
if (e.h > t.H) e.h = t.H;
|
|
652
543
|
insertIntoHeap(t, e);
|
|
653
544
|
}
|
|
654
|
-
e.
|
|
545
|
+
e.Y.clear();
|
|
655
546
|
}
|
|
656
|
-
const t = e ? e.
|
|
657
|
-
if (GlobalQueue.
|
|
547
|
+
const t = e ? e.C : globalQueue.C;
|
|
548
|
+
if (GlobalQueue.re && t.size) {
|
|
658
549
|
for (const e of t) {
|
|
659
|
-
GlobalQueue.
|
|
550
|
+
GlobalQueue.re(e);
|
|
660
551
|
}
|
|
661
552
|
t.clear();
|
|
662
553
|
schedule();
|
|
@@ -666,18 +557,18 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
666
557
|
}
|
|
667
558
|
}
|
|
668
559
|
function checkBoundaryChildren(e) {
|
|
669
|
-
for (const t of e.
|
|
560
|
+
for (const t of e.A) {
|
|
670
561
|
t.checkSources?.();
|
|
671
562
|
checkBoundaryChildren(t);
|
|
672
563
|
}
|
|
673
564
|
}
|
|
674
565
|
function trackOptimisticStore(e) {
|
|
675
|
-
globalQueue.
|
|
566
|
+
globalQueue.C.add(e);
|
|
676
567
|
schedule();
|
|
677
568
|
}
|
|
678
569
|
function reassignPendingTransition(e) {
|
|
679
570
|
for (let t = 0; t < e.length; t++) {
|
|
680
|
-
e[t].
|
|
571
|
+
e[t].S = activeTransition;
|
|
681
572
|
}
|
|
682
573
|
}
|
|
683
574
|
const globalQueue = new GlobalQueue();
|
|
@@ -687,11 +578,14 @@ function flush(e) {
|
|
|
687
578
|
try {
|
|
688
579
|
return e();
|
|
689
580
|
} finally {
|
|
690
|
-
|
|
691
|
-
|
|
581
|
+
try {
|
|
582
|
+
flush();
|
|
583
|
+
} finally {
|
|
584
|
+
syncDepth--;
|
|
585
|
+
}
|
|
692
586
|
}
|
|
693
587
|
}
|
|
694
|
-
if (globalQueue.
|
|
588
|
+
if (globalQueue.B) {
|
|
695
589
|
return;
|
|
696
590
|
}
|
|
697
591
|
while (scheduled || activeTransition) {
|
|
@@ -702,22 +596,22 @@ function runQueue(e, t) {
|
|
|
702
596
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
703
597
|
}
|
|
704
598
|
function reporterBlocksSource(e, t) {
|
|
705
|
-
if (e.
|
|
706
|
-
if (e.
|
|
707
|
-
for (let n = e.
|
|
708
|
-
let e = n.
|
|
599
|
+
if (e.M & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
|
|
600
|
+
if (e.Se === t || e.de?.has(t)) return true;
|
|
601
|
+
for (let n = e._e; n; n = n.Oe) {
|
|
602
|
+
let e = n.Re;
|
|
709
603
|
while (e) {
|
|
710
|
-
if (e === t || e.
|
|
711
|
-
e = e.
|
|
604
|
+
if (e === t || e.Ie === t) return true;
|
|
605
|
+
e = e.t;
|
|
712
606
|
}
|
|
713
607
|
}
|
|
714
|
-
return !!(e.
|
|
608
|
+
return !!(e.fe & STATUS_PENDING && e.ce instanceof NotReadyError && e.ce.source === t);
|
|
715
609
|
}
|
|
716
610
|
function transitionComplete(e) {
|
|
717
|
-
if (e.
|
|
718
|
-
if (e
|
|
611
|
+
if (e.j) return true;
|
|
612
|
+
if (e.$.length) return false;
|
|
719
613
|
let t = true;
|
|
720
|
-
for (const [n, i] of e.
|
|
614
|
+
for (const [n, i] of e.K) {
|
|
721
615
|
let r = false;
|
|
722
616
|
for (const e of i) {
|
|
723
617
|
if (reporterBlocksSource(e, n)) {
|
|
@@ -726,32 +620,32 @@ function transitionComplete(e) {
|
|
|
726
620
|
}
|
|
727
621
|
i.delete(e);
|
|
728
622
|
}
|
|
729
|
-
if (!r) e.
|
|
730
|
-
else if (n.
|
|
623
|
+
if (!r) e.K.delete(n);
|
|
624
|
+
else if (n.fe & STATUS_PENDING && n.ce?.source === n) {
|
|
731
625
|
t = false;
|
|
732
626
|
break;
|
|
733
627
|
}
|
|
734
628
|
}
|
|
735
629
|
if (t) {
|
|
736
|
-
for (let n = 0; n < e.
|
|
737
|
-
const i = e.
|
|
630
|
+
for (let n = 0; n < e.P.length; n++) {
|
|
631
|
+
const i = e.P[n];
|
|
738
632
|
if (
|
|
739
633
|
hasActiveOverride(i) &&
|
|
740
|
-
"
|
|
741
|
-
i.
|
|
742
|
-
i.
|
|
743
|
-
i.
|
|
634
|
+
"fe" in i &&
|
|
635
|
+
i.fe & STATUS_PENDING &&
|
|
636
|
+
i.ce instanceof NotReadyError &&
|
|
637
|
+
i.ce.source !== i
|
|
744
638
|
) {
|
|
745
639
|
t = false;
|
|
746
640
|
break;
|
|
747
641
|
}
|
|
748
642
|
}
|
|
749
643
|
}
|
|
750
|
-
t && (e.
|
|
644
|
+
t && (e.j = true);
|
|
751
645
|
return t;
|
|
752
646
|
}
|
|
753
647
|
function currentTransition(e) {
|
|
754
|
-
while (e.
|
|
648
|
+
while (e.j && typeof e.j === "object") e = e.j;
|
|
755
649
|
return e;
|
|
756
650
|
}
|
|
757
651
|
function setActiveTransition(e) {
|
|
@@ -766,67 +660,169 @@ function runInTransition(e, t) {
|
|
|
766
660
|
activeTransition = n;
|
|
767
661
|
}
|
|
768
662
|
}
|
|
663
|
+
function actualInsertIntoHeap(e, t) {
|
|
664
|
+
const n = (e.q?.pe ? e.q.he?.H : e.q?.H) ?? -1;
|
|
665
|
+
if (n >= e.H) e.H = n + 1;
|
|
666
|
+
const i = e.H;
|
|
667
|
+
const r = t.I[i];
|
|
668
|
+
if (r === undefined) t.I[i] = e;
|
|
669
|
+
else {
|
|
670
|
+
const t = r.Ne;
|
|
671
|
+
t.Ae = e;
|
|
672
|
+
e.Ne = t;
|
|
673
|
+
r.Ne = e;
|
|
674
|
+
}
|
|
675
|
+
if (i > t.N) t.N = i;
|
|
676
|
+
}
|
|
677
|
+
function insertIntoHeap(e, t) {
|
|
678
|
+
let n = e.M;
|
|
679
|
+
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_MANUAL_WRITE)) return;
|
|
680
|
+
if (n & REACTIVE_CHECK) {
|
|
681
|
+
e.M = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
682
|
+
} else e.M = n | REACTIVE_IN_HEAP;
|
|
683
|
+
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
684
|
+
}
|
|
685
|
+
function insertIntoHeapHeight(e, t) {
|
|
686
|
+
let n = e.M;
|
|
687
|
+
if (
|
|
688
|
+
n &
|
|
689
|
+
(REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT | REACTIVE_MANUAL_WRITE)
|
|
690
|
+
)
|
|
691
|
+
return;
|
|
692
|
+
e.M = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
693
|
+
actualInsertIntoHeap(e, t);
|
|
694
|
+
}
|
|
695
|
+
function deleteFromHeap(e, t) {
|
|
696
|
+
const n = e.M;
|
|
697
|
+
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
698
|
+
e.M = n & -25;
|
|
699
|
+
const i = e.H;
|
|
700
|
+
if (e.Ne === e) t.I[i] = undefined;
|
|
701
|
+
else {
|
|
702
|
+
const n = e.Ae;
|
|
703
|
+
const r = t.I[i];
|
|
704
|
+
const o = n ?? r;
|
|
705
|
+
if (e === r) t.I[i] = n;
|
|
706
|
+
else e.Ne.Ae = n;
|
|
707
|
+
o.Ne = e.Ne;
|
|
708
|
+
}
|
|
709
|
+
e.Ne = e;
|
|
710
|
+
e.Ae = undefined;
|
|
711
|
+
}
|
|
712
|
+
function markHeap(e) {
|
|
713
|
+
if (e.p) return;
|
|
714
|
+
e.p = true;
|
|
715
|
+
for (let t = 0; t <= e.N; t++) {
|
|
716
|
+
for (let n = e.I[t]; n !== undefined; n = n.Ae) {
|
|
717
|
+
if (n.M & REACTIVE_IN_HEAP) markNode(n);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
function markNode(e, t = REACTIVE_DIRTY) {
|
|
722
|
+
const n = e.M;
|
|
723
|
+
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
724
|
+
e.M = (n & -4) | t;
|
|
725
|
+
for (let t = e.D; t !== null; t = t.L) {
|
|
726
|
+
markNode(t.U, REACTIVE_CHECK);
|
|
727
|
+
}
|
|
728
|
+
if (e.Pe !== null) {
|
|
729
|
+
for (let t = e.Pe; t !== null; t = t.Ce) {
|
|
730
|
+
for (let e = t.D; e !== null; e = e.L) {
|
|
731
|
+
markNode(e.U, REACTIVE_CHECK);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
function runHeap(e, t) {
|
|
737
|
+
e.p = false;
|
|
738
|
+
for (e.h = 0; e.h <= e.N; e.h++) {
|
|
739
|
+
let n = e.I[e.h];
|
|
740
|
+
while (n !== undefined) {
|
|
741
|
+
if (n.M & REACTIVE_IN_HEAP) t(n);
|
|
742
|
+
else adjustHeight(n, e);
|
|
743
|
+
n = e.I[e.h];
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
e.N = 0;
|
|
747
|
+
}
|
|
748
|
+
function adjustHeight(e, t) {
|
|
749
|
+
deleteFromHeap(e, t);
|
|
750
|
+
let n = e.H;
|
|
751
|
+
for (let t = e._e; t; t = t.Oe) {
|
|
752
|
+
const e = t.Re;
|
|
753
|
+
const i = e.Ie || e;
|
|
754
|
+
if (i.se && i.H >= n) n = i.H + 1;
|
|
755
|
+
}
|
|
756
|
+
if (e.H !== n) {
|
|
757
|
+
e.H = n;
|
|
758
|
+
for (let t = e.D; t !== null; t = t.L) {
|
|
759
|
+
insertIntoHeapHeight(t.U, t.U.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
}
|
|
769
763
|
const PENDING_OWNER = {};
|
|
770
764
|
function markDisposal(e) {
|
|
771
765
|
let t = e.ge;
|
|
772
766
|
while (t) {
|
|
773
|
-
t.
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
767
|
+
const e = t.M;
|
|
768
|
+
t.M = e | REACTIVE_ZOMBIE;
|
|
769
|
+
if (e & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT)) {
|
|
770
|
+
deleteFromHeap(t, e & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
771
|
+
if (e & REACTIVE_IN_HEAP) insertIntoHeap(t, zombieQueue);
|
|
772
|
+
else insertIntoHeapHeight(t, zombieQueue);
|
|
777
773
|
}
|
|
778
774
|
markDisposal(t);
|
|
779
775
|
t = t.De;
|
|
780
776
|
}
|
|
781
777
|
}
|
|
782
778
|
function dispose(e) {
|
|
783
|
-
let t = e.
|
|
784
|
-
|
|
779
|
+
let t = e._e;
|
|
780
|
+
while (t !== null) {
|
|
785
781
|
t = unlinkSubs(t);
|
|
786
|
-
}
|
|
787
|
-
e.
|
|
782
|
+
}
|
|
783
|
+
e._e = null;
|
|
788
784
|
e.ye = null;
|
|
789
785
|
disposeChildren(e, true);
|
|
790
786
|
}
|
|
791
787
|
function disposeChildren(e, t = false, n) {
|
|
792
|
-
const i = e.
|
|
788
|
+
const i = e.M;
|
|
793
789
|
if (i & REACTIVE_DISPOSED) return;
|
|
794
|
-
if (t) e.
|
|
795
|
-
if (t && e.
|
|
796
|
-
let r = n ? e.
|
|
790
|
+
if (t) e.M = i | REACTIVE_DISPOSED;
|
|
791
|
+
if (t && e.se) e.ve = null;
|
|
792
|
+
let r = n ? e.Ee : e.ge;
|
|
797
793
|
while (r) {
|
|
798
794
|
const e = r.De;
|
|
799
|
-
if (r.
|
|
795
|
+
if (r._e) {
|
|
800
796
|
const e = r;
|
|
801
|
-
deleteFromHeap(e, e.
|
|
802
|
-
let t = e.
|
|
797
|
+
deleteFromHeap(e, e.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
798
|
+
let t = e._e;
|
|
803
799
|
do {
|
|
804
800
|
t = unlinkSubs(t);
|
|
805
801
|
} while (t !== null);
|
|
806
|
-
e.
|
|
802
|
+
e._e = null;
|
|
807
803
|
e.ye = null;
|
|
808
804
|
}
|
|
809
805
|
disposeChildren(r, true);
|
|
810
806
|
r = e;
|
|
811
807
|
}
|
|
812
808
|
if (n) {
|
|
813
|
-
e.
|
|
809
|
+
e.Ee = null;
|
|
814
810
|
} else {
|
|
815
811
|
e.ge = null;
|
|
816
812
|
e.me = 0;
|
|
817
813
|
}
|
|
818
|
-
if (t && !n && !(i & REACTIVE_ZOMBIE) && e.
|
|
819
|
-
const t = e.
|
|
814
|
+
if (t && !n && !(i & REACTIVE_ZOMBIE) && e.q !== null && !(e.q.M & REACTIVE_DISPOSED)) {
|
|
815
|
+
const t = e.be;
|
|
820
816
|
const n = e.De;
|
|
821
817
|
if (t !== null) t.De = n;
|
|
822
|
-
else e.
|
|
823
|
-
if (n !== null) n.
|
|
824
|
-
e.
|
|
818
|
+
else e.q.ge = n;
|
|
819
|
+
if (n !== null) n.be = t;
|
|
820
|
+
e.be = null;
|
|
825
821
|
}
|
|
826
822
|
runDisposal(e, n);
|
|
827
823
|
}
|
|
828
824
|
function runDisposal(e, t) {
|
|
829
|
-
let n = t ? e.
|
|
825
|
+
let n = t ? e.Te : e.Ve;
|
|
830
826
|
if (!n) return;
|
|
831
827
|
if (Array.isArray(n)) {
|
|
832
828
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -836,11 +832,11 @@ function runDisposal(e, t) {
|
|
|
836
832
|
} else {
|
|
837
833
|
n.call(n);
|
|
838
834
|
}
|
|
839
|
-
t ? (e.
|
|
835
|
+
t ? (e.Te = null) : (e.Ve = null);
|
|
840
836
|
}
|
|
841
837
|
function childId(e, t) {
|
|
842
838
|
let n = e;
|
|
843
|
-
while (n.
|
|
839
|
+
while (n.ue & CONFIG_TRANSPARENT && n.q) n = n.q;
|
|
844
840
|
if (n.id != null) return formatId(n.id, t ? n.me++ : n.me);
|
|
845
841
|
throw new Error("Cannot get child id from owner without an id");
|
|
846
842
|
}
|
|
@@ -864,13 +860,13 @@ function getOwner() {
|
|
|
864
860
|
}
|
|
865
861
|
function cleanup(e) {
|
|
866
862
|
if (!context) return e;
|
|
867
|
-
if (!context.
|
|
868
|
-
else if (Array.isArray(context.
|
|
869
|
-
else context.
|
|
863
|
+
if (!context.Ve) context.Ve = e;
|
|
864
|
+
else if (Array.isArray(context.Ve)) context.Ve.push(e);
|
|
865
|
+
else context.Ve = [context.Ve, e];
|
|
870
866
|
return e;
|
|
871
867
|
}
|
|
872
868
|
function isDisposed(e) {
|
|
873
|
-
return !!(e.
|
|
869
|
+
return !!(e.M & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
|
|
874
870
|
}
|
|
875
871
|
function disposeRootSelf(e = true) {
|
|
876
872
|
disposeChildren(this, e);
|
|
@@ -880,19 +876,19 @@ function createOwner(e) {
|
|
|
880
876
|
const n = e?.transparent ?? false;
|
|
881
877
|
const i = {
|
|
882
878
|
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
879
|
+
ue: n ? CONFIG_TRANSPARENT : 0,
|
|
880
|
+
pe: true,
|
|
881
|
+
he: t?.pe ? t.he : t,
|
|
886
882
|
ge: null,
|
|
887
883
|
De: null,
|
|
888
|
-
we: null,
|
|
889
884
|
be: null,
|
|
890
|
-
|
|
891
|
-
|
|
885
|
+
Ve: null,
|
|
886
|
+
F: t?.F ?? globalQueue,
|
|
887
|
+
we: t?.we || defaultContext,
|
|
892
888
|
me: 0,
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
889
|
+
Te: null,
|
|
890
|
+
Ee: null,
|
|
891
|
+
q: t,
|
|
896
892
|
dispose: disposeRootSelf
|
|
897
893
|
};
|
|
898
894
|
if (t) {
|
|
@@ -901,7 +897,7 @@ function createOwner(e) {
|
|
|
901
897
|
t.ge = i;
|
|
902
898
|
} else {
|
|
903
899
|
i.De = e;
|
|
904
|
-
e.
|
|
900
|
+
e.be = i;
|
|
905
901
|
t.ge = i;
|
|
906
902
|
}
|
|
907
903
|
}
|
|
@@ -912,128 +908,128 @@ function createRoot(e, t) {
|
|
|
912
908
|
return runWithOwner(n, () => e(() => n.dispose()));
|
|
913
909
|
}
|
|
914
910
|
function unlinkSubs(e) {
|
|
915
|
-
const t = e.
|
|
916
|
-
const n = e.
|
|
917
|
-
const i = e.
|
|
911
|
+
const t = e.Re;
|
|
912
|
+
const n = e.Oe;
|
|
913
|
+
const i = e.L;
|
|
918
914
|
const r = e.Le;
|
|
919
915
|
if (i !== null) i.Le = r;
|
|
920
916
|
else t.Ue = r;
|
|
921
|
-
if (r !== null) r.
|
|
917
|
+
if (r !== null) r.L = i;
|
|
922
918
|
else {
|
|
923
|
-
t.
|
|
919
|
+
t.D = i;
|
|
924
920
|
if (i === null) {
|
|
925
|
-
t.
|
|
921
|
+
t.V?.();
|
|
926
922
|
const e = t;
|
|
927
|
-
e.
|
|
923
|
+
e.se && e.ue & CONFIG_AUTO_DISPOSE && !(e.M & REACTIVE_ZOMBIE) && unobserved(e);
|
|
928
924
|
}
|
|
929
925
|
}
|
|
930
926
|
return n;
|
|
931
927
|
}
|
|
932
928
|
function trimStaleDeps(e) {
|
|
933
929
|
const t = e.ye;
|
|
934
|
-
let n = t !== null ? t.
|
|
930
|
+
let n = t !== null ? t.Oe : e._e;
|
|
935
931
|
if (n !== null) {
|
|
936
932
|
do {
|
|
937
933
|
n = unlinkSubs(n);
|
|
938
934
|
} while (n !== null);
|
|
939
|
-
if (t !== null) t.
|
|
940
|
-
else e.
|
|
935
|
+
if (t !== null) t.Oe = null;
|
|
936
|
+
else e._e = null;
|
|
941
937
|
}
|
|
942
938
|
}
|
|
943
939
|
function unobserved(e) {
|
|
944
|
-
deleteFromHeap(e, e.
|
|
945
|
-
let t = e.
|
|
940
|
+
deleteFromHeap(e, e.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
941
|
+
let t = e._e;
|
|
946
942
|
while (t !== null) {
|
|
947
943
|
t = unlinkSubs(t);
|
|
948
944
|
}
|
|
949
|
-
e.
|
|
945
|
+
e._e = null;
|
|
950
946
|
e.ye = null;
|
|
951
947
|
disposeChildren(e, true);
|
|
952
948
|
}
|
|
953
949
|
function link(e, t) {
|
|
954
950
|
const n = t.ye;
|
|
955
|
-
if (n !== null && n.
|
|
951
|
+
if (n !== null && n.Re === e) return;
|
|
956
952
|
let i = null;
|
|
957
|
-
const r = t.
|
|
953
|
+
const r = t.M & REACTIVE_RECOMPUTING_DEPS;
|
|
958
954
|
if (r) {
|
|
959
|
-
i = n !== null ? n.
|
|
960
|
-
if (i !== null && i.
|
|
955
|
+
i = n !== null ? n.Oe : t._e;
|
|
956
|
+
if (i !== null && i.Re === e) {
|
|
961
957
|
t.ye = i;
|
|
962
958
|
return;
|
|
963
959
|
}
|
|
964
960
|
}
|
|
965
961
|
const o = e.Ue;
|
|
966
|
-
if (o !== null && o.
|
|
967
|
-
const s = (t.ye = e.Ue = {
|
|
968
|
-
if (n !== null) n.
|
|
969
|
-
else t.
|
|
970
|
-
if (o !== null) o.
|
|
971
|
-
else e.
|
|
962
|
+
if (o !== null && o.U === t && (!r || isValidLink(o, t))) return;
|
|
963
|
+
const s = (t.ye = e.Ue = { Re: e, U: t, Oe: i, Le: o, L: null });
|
|
964
|
+
if (n !== null) n.Oe = s;
|
|
965
|
+
else t._e = s;
|
|
966
|
+
if (o !== null) o.L = s;
|
|
967
|
+
else e.D = s;
|
|
972
968
|
}
|
|
973
969
|
function isValidLink(e, t) {
|
|
974
970
|
const n = t.ye;
|
|
975
971
|
if (n !== null) {
|
|
976
|
-
let i = t.
|
|
972
|
+
let i = t._e;
|
|
977
973
|
do {
|
|
978
974
|
if (i === e) return true;
|
|
979
975
|
if (i === n) break;
|
|
980
|
-
i = i.
|
|
976
|
+
i = i.Oe;
|
|
981
977
|
} while (i !== null);
|
|
982
978
|
}
|
|
983
979
|
return false;
|
|
984
980
|
}
|
|
985
981
|
function addPendingSource(e, t) {
|
|
986
|
-
if (e.
|
|
987
|
-
if (!e.
|
|
988
|
-
e.
|
|
982
|
+
if (e.Se === t || e.de?.has(t)) return false;
|
|
983
|
+
if (!e.Se) {
|
|
984
|
+
e.Se = t;
|
|
989
985
|
return true;
|
|
990
986
|
}
|
|
991
|
-
if (!e.
|
|
992
|
-
e.
|
|
987
|
+
if (!e.de) {
|
|
988
|
+
e.de = new Set([e.Se, t]);
|
|
993
989
|
} else {
|
|
994
|
-
e.
|
|
990
|
+
e.de.add(t);
|
|
995
991
|
}
|
|
996
|
-
e.
|
|
992
|
+
e.Se = undefined;
|
|
997
993
|
return true;
|
|
998
994
|
}
|
|
999
995
|
function removePendingSource(e, t) {
|
|
1000
|
-
if (e.
|
|
1001
|
-
if (e.
|
|
1002
|
-
e.
|
|
996
|
+
if (e.Se) {
|
|
997
|
+
if (e.Se !== t) return false;
|
|
998
|
+
e.Se = undefined;
|
|
1003
999
|
return true;
|
|
1004
1000
|
}
|
|
1005
|
-
if (!e.
|
|
1006
|
-
if (e.
|
|
1007
|
-
e.
|
|
1008
|
-
e.
|
|
1009
|
-
} else if (e.
|
|
1010
|
-
e.
|
|
1001
|
+
if (!e.de?.delete(t)) return false;
|
|
1002
|
+
if (e.de.size === 1) {
|
|
1003
|
+
e.Se = e.de.values().next().value;
|
|
1004
|
+
e.de = undefined;
|
|
1005
|
+
} else if (e.de.size === 0) {
|
|
1006
|
+
e.de = undefined;
|
|
1011
1007
|
}
|
|
1012
1008
|
return true;
|
|
1013
1009
|
}
|
|
1014
1010
|
function clearPendingSources(e) {
|
|
1015
|
-
e.
|
|
1016
|
-
e.
|
|
1017
|
-
e.
|
|
1011
|
+
e.Se = undefined;
|
|
1012
|
+
e.de?.clear();
|
|
1013
|
+
e.de = undefined;
|
|
1018
1014
|
}
|
|
1019
1015
|
function setPendingError(e, t, n) {
|
|
1020
1016
|
if (!t) {
|
|
1021
|
-
e.
|
|
1017
|
+
e.ce = null;
|
|
1022
1018
|
return;
|
|
1023
1019
|
}
|
|
1024
1020
|
if (n instanceof NotReadyError && n.source === t) {
|
|
1025
|
-
e.
|
|
1021
|
+
e.ce = n;
|
|
1026
1022
|
return;
|
|
1027
1023
|
}
|
|
1028
|
-
const i = e.
|
|
1024
|
+
const i = e.ce;
|
|
1029
1025
|
if (!(i instanceof NotReadyError) || i.source !== t) {
|
|
1030
|
-
e.
|
|
1026
|
+
e.ce = new NotReadyError(t);
|
|
1031
1027
|
}
|
|
1032
1028
|
}
|
|
1033
1029
|
function forEachDependent(e, t) {
|
|
1034
|
-
for (let n = e.
|
|
1035
|
-
for (let n = e.
|
|
1036
|
-
for (let e = n.
|
|
1030
|
+
for (let n = e.D; n !== null; n = n.L) t(n.U);
|
|
1031
|
+
for (let n = e.Pe; n !== null; n = n.Ce) {
|
|
1032
|
+
for (let e = n.D; e !== null; e = e.L) t(e.U);
|
|
1037
1033
|
}
|
|
1038
1034
|
}
|
|
1039
1035
|
function settlePendingSource(e) {
|
|
@@ -1042,25 +1038,25 @@ function settlePendingSource(e) {
|
|
|
1042
1038
|
const settle = i => {
|
|
1043
1039
|
if (n.has(i) || !removePendingSource(i, e)) return;
|
|
1044
1040
|
n.add(i);
|
|
1045
|
-
i.
|
|
1046
|
-
const r = i.
|
|
1041
|
+
i.le = clock;
|
|
1042
|
+
const r = i.Se ?? i.de?.values().next().value;
|
|
1047
1043
|
if (r) {
|
|
1048
1044
|
setPendingError(i, r);
|
|
1049
1045
|
updatePendingSignal(i);
|
|
1050
1046
|
} else {
|
|
1051
|
-
i.
|
|
1047
|
+
i.fe &= ~STATUS_PENDING;
|
|
1052
1048
|
setPendingError(i);
|
|
1053
1049
|
updatePendingSignal(i);
|
|
1054
1050
|
if (i.Ge) {
|
|
1055
|
-
if (i.
|
|
1051
|
+
if (i.G === EFFECT_TRACKED) {
|
|
1056
1052
|
const e = i;
|
|
1057
|
-
if (!e.
|
|
1058
|
-
e.
|
|
1059
|
-
e.
|
|
1053
|
+
if (!e.k) {
|
|
1054
|
+
e.k = true;
|
|
1055
|
+
e.F.enqueue(EFFECT_USER, e.W);
|
|
1060
1056
|
}
|
|
1061
1057
|
} else {
|
|
1062
|
-
const e = i.
|
|
1063
|
-
if (e.
|
|
1058
|
+
const e = i.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
1059
|
+
if (e.h > i.H) e.h = i.H;
|
|
1064
1060
|
insertIntoHeap(i, e);
|
|
1065
1061
|
}
|
|
1066
1062
|
t = true;
|
|
@@ -1091,32 +1087,34 @@ function handleAsync(e, t, n) {
|
|
|
1091
1087
|
if (e.ve !== t) return;
|
|
1092
1088
|
globalQueue.initTransition(resolveTransition(e));
|
|
1093
1089
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
1094
|
-
e.
|
|
1090
|
+
e.le = clock;
|
|
1095
1091
|
};
|
|
1096
1092
|
const asyncWrite = (i, r) => {
|
|
1097
1093
|
if (e.ve !== t) return;
|
|
1098
|
-
if (e.
|
|
1094
|
+
if (e.M & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
1099
1095
|
globalQueue.initTransition(resolveTransition(e));
|
|
1100
|
-
const o = !!(e.
|
|
1096
|
+
const o = !!(e.fe & STATUS_UNINITIALIZED);
|
|
1101
1097
|
trimStaleDeps(e);
|
|
1102
1098
|
clearStatus(e);
|
|
1103
1099
|
const s = resolveLane(e);
|
|
1104
|
-
if (s) s.
|
|
1105
|
-
if (n)
|
|
1106
|
-
|
|
1107
|
-
if (
|
|
1100
|
+
if (s) s.u.delete(e);
|
|
1101
|
+
if (n) {
|
|
1102
|
+
n(i);
|
|
1103
|
+
if (o) clearStatus(e, true);
|
|
1104
|
+
} else if (e.R !== undefined) {
|
|
1105
|
+
if (e.R !== undefined && e.R !== NOT_PENDING) e.m = i;
|
|
1108
1106
|
else {
|
|
1109
|
-
e.
|
|
1107
|
+
e.Z = i;
|
|
1110
1108
|
insertSubs(e);
|
|
1111
1109
|
}
|
|
1112
|
-
e.
|
|
1110
|
+
e.le = clock;
|
|
1113
1111
|
} else if (s) {
|
|
1114
|
-
const t = e.
|
|
1115
|
-
const n = e.
|
|
1112
|
+
const t = e.G;
|
|
1113
|
+
const n = e.Z;
|
|
1116
1114
|
const r = e.ke;
|
|
1117
1115
|
if ((!t && o) || !r || !r(i, n)) {
|
|
1118
|
-
e.
|
|
1119
|
-
e.
|
|
1116
|
+
e.Z = i;
|
|
1117
|
+
e.le = clock;
|
|
1120
1118
|
if (e.Fe) {
|
|
1121
1119
|
setSignal(e.Fe, i);
|
|
1122
1120
|
}
|
|
@@ -1207,29 +1205,29 @@ function handleAsync(e, t, n) {
|
|
|
1207
1205
|
return o;
|
|
1208
1206
|
}
|
|
1209
1207
|
function clearStatus(e, t = false) {
|
|
1210
|
-
if (e.
|
|
1208
|
+
if (e.Se || e.de) clearPendingSources(e);
|
|
1211
1209
|
if (e.Ge) e.Ge = false;
|
|
1212
|
-
e.
|
|
1213
|
-
if (e.
|
|
1210
|
+
e.fe = t ? 0 : e.fe & STATUS_UNINITIALIZED;
|
|
1211
|
+
if (e.ce) setPendingError(e);
|
|
1214
1212
|
if (e.We) updatePendingSignal(e);
|
|
1215
|
-
if (e.
|
|
1213
|
+
if (e.Me) e.Me();
|
|
1216
1214
|
}
|
|
1217
1215
|
function notifyStatus(e, t, n, i, r) {
|
|
1218
1216
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
1219
1217
|
n = new StatusError(e, n);
|
|
1220
1218
|
const o = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
1221
1219
|
const s = o === e;
|
|
1222
|
-
const u = t === STATUS_PENDING && e.
|
|
1220
|
+
const u = t === STATUS_PENDING && e.R !== undefined && !s;
|
|
1223
1221
|
const c = u && hasActiveOverride(e);
|
|
1224
1222
|
if (!i) {
|
|
1225
1223
|
if (t === STATUS_PENDING && o) {
|
|
1226
1224
|
addPendingSource(e, o);
|
|
1227
|
-
e.
|
|
1225
|
+
e.fe = STATUS_PENDING | (e.fe & STATUS_UNINITIALIZED);
|
|
1228
1226
|
setPendingError(e, o, n);
|
|
1229
1227
|
} else {
|
|
1230
1228
|
clearPendingSources(e);
|
|
1231
|
-
e.
|
|
1232
|
-
e.
|
|
1229
|
+
e.fe = t | (t !== STATUS_ERROR ? e.fe & STATUS_UNINITIALIZED : 0);
|
|
1230
|
+
e.ce = n;
|
|
1233
1231
|
}
|
|
1234
1232
|
updatePendingSignal(e);
|
|
1235
1233
|
}
|
|
@@ -1238,24 +1236,24 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
1238
1236
|
}
|
|
1239
1237
|
const l = i || c;
|
|
1240
1238
|
const a = i || u ? undefined : r;
|
|
1241
|
-
if (e.
|
|
1239
|
+
if (e.Me) {
|
|
1242
1240
|
if (i && t === STATUS_PENDING) {
|
|
1243
1241
|
return;
|
|
1244
1242
|
}
|
|
1245
1243
|
if (l) {
|
|
1246
|
-
e.
|
|
1244
|
+
e.Me(t, n);
|
|
1247
1245
|
} else {
|
|
1248
|
-
e.
|
|
1246
|
+
e.Me();
|
|
1249
1247
|
}
|
|
1250
1248
|
return;
|
|
1251
1249
|
}
|
|
1252
1250
|
forEachDependent(e, e => {
|
|
1253
|
-
e.
|
|
1251
|
+
e.le = clock;
|
|
1254
1252
|
if (
|
|
1255
|
-
(t === STATUS_PENDING && o && e.
|
|
1256
|
-
(t !== STATUS_PENDING && (e.
|
|
1253
|
+
(t === STATUS_PENDING && o && e.Se !== o && !e.de?.has(o)) ||
|
|
1254
|
+
(t !== STATUS_PENDING && (e.ce !== n || e.Se || e.de))
|
|
1257
1255
|
) {
|
|
1258
|
-
if (!l && !e.
|
|
1256
|
+
if (!l && !e.S) queuePendingNode(e);
|
|
1259
1257
|
notifyStatus(e, t, n, l, a);
|
|
1260
1258
|
}
|
|
1261
1259
|
});
|
|
@@ -1283,11 +1281,10 @@ function enableExternalSource(e) {
|
|
|
1283
1281
|
externalSourceConfig = { factory: t, untrack: n };
|
|
1284
1282
|
}
|
|
1285
1283
|
}
|
|
1286
|
-
GlobalQueue.
|
|
1287
|
-
GlobalQueue.
|
|
1284
|
+
GlobalQueue.te = recompute;
|
|
1285
|
+
GlobalQueue.ne = disposeChildren;
|
|
1288
1286
|
let tracking = false;
|
|
1289
1287
|
let stale = false;
|
|
1290
|
-
let refreshing = false;
|
|
1291
1288
|
let pendingCheckActive = false;
|
|
1292
1289
|
let foundPending = false;
|
|
1293
1290
|
let latestReadActive = false;
|
|
@@ -1299,7 +1296,7 @@ let snapshotSources = null;
|
|
|
1299
1296
|
function ownerInSnapshotScope(e) {
|
|
1300
1297
|
while (e) {
|
|
1301
1298
|
if (e.He) return true;
|
|
1302
|
-
e = e.
|
|
1299
|
+
e = e.q;
|
|
1303
1300
|
}
|
|
1304
1301
|
return false;
|
|
1305
1302
|
}
|
|
@@ -1322,13 +1319,13 @@ function releaseSubtree(e) {
|
|
|
1322
1319
|
t = t.De;
|
|
1323
1320
|
continue;
|
|
1324
1321
|
}
|
|
1325
|
-
if (t.
|
|
1322
|
+
if (t.se) {
|
|
1326
1323
|
const e = t;
|
|
1327
|
-
e.
|
|
1328
|
-
if (e.
|
|
1329
|
-
e.
|
|
1330
|
-
e.
|
|
1331
|
-
if (dirtyQueue.
|
|
1324
|
+
e.ue &= ~CONFIG_IN_SNAPSHOT_SCOPE;
|
|
1325
|
+
if (e.M & REACTIVE_SNAPSHOT_STALE) {
|
|
1326
|
+
e.M &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1327
|
+
e.M |= REACTIVE_DIRTY;
|
|
1328
|
+
if (dirtyQueue.h > e.H) dirtyQueue.h = e.H;
|
|
1332
1329
|
insertIntoHeap(e, dirtyQueue);
|
|
1333
1330
|
}
|
|
1334
1331
|
}
|
|
@@ -1339,7 +1336,7 @@ function releaseSubtree(e) {
|
|
|
1339
1336
|
function clearSnapshots() {
|
|
1340
1337
|
if (snapshotSources) {
|
|
1341
1338
|
for (const e of snapshotSources) {
|
|
1342
|
-
delete e.
|
|
1339
|
+
delete e.ae;
|
|
1343
1340
|
delete e[STORE_SNAPSHOT_PROPS];
|
|
1344
1341
|
}
|
|
1345
1342
|
snapshotSources = null;
|
|
@@ -1347,48 +1344,48 @@ function clearSnapshots() {
|
|
|
1347
1344
|
snapshotCaptureActive = false;
|
|
1348
1345
|
}
|
|
1349
1346
|
function recompute(e, t = false) {
|
|
1350
|
-
const n = e.
|
|
1347
|
+
const n = e.G;
|
|
1351
1348
|
if (!t) {
|
|
1352
|
-
if (e.
|
|
1353
|
-
globalQueue.initTransition(e.
|
|
1354
|
-
deleteFromHeap(e, e.
|
|
1349
|
+
if (e.S && (!n || activeTransition) && activeTransition !== e.S)
|
|
1350
|
+
globalQueue.initTransition(e.S);
|
|
1351
|
+
deleteFromHeap(e, e.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1355
1352
|
e.ve = null;
|
|
1356
|
-
if (e.
|
|
1357
|
-
else if (e.ge !== null || e.
|
|
1353
|
+
if (e.S || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1354
|
+
else if (e.ge !== null || e.Ve !== null) {
|
|
1358
1355
|
markDisposal(e);
|
|
1359
|
-
e.
|
|
1360
|
-
e.
|
|
1361
|
-
e.
|
|
1356
|
+
e.Te = e.Ve;
|
|
1357
|
+
e.Ee = e.ge;
|
|
1358
|
+
e.Ve = null;
|
|
1362
1359
|
e.ge = null;
|
|
1363
1360
|
e.me = 0;
|
|
1364
1361
|
} else;
|
|
1365
1362
|
}
|
|
1366
|
-
let i = !!(e.
|
|
1367
|
-
const r = e.
|
|
1368
|
-
const o = !!(e.
|
|
1369
|
-
const s = !!(e.
|
|
1363
|
+
let i = !!(e.M & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1364
|
+
const r = e.R !== undefined && e.R !== NOT_PENDING;
|
|
1365
|
+
const o = !!(e.fe & STATUS_PENDING);
|
|
1366
|
+
const s = !!(e.fe & STATUS_UNINITIALIZED);
|
|
1370
1367
|
const u = context;
|
|
1371
1368
|
context = e;
|
|
1372
1369
|
e.ye = null;
|
|
1373
|
-
e.
|
|
1374
|
-
e.
|
|
1375
|
-
let c = e.
|
|
1376
|
-
let l = e.
|
|
1370
|
+
e.M = REACTIVE_RECOMPUTING_DEPS;
|
|
1371
|
+
e.le = clock;
|
|
1372
|
+
let c = e.m === NOT_PENDING ? e.Z : e.m;
|
|
1373
|
+
let l = e.H;
|
|
1377
1374
|
let a = tracking;
|
|
1378
1375
|
let f = currentOptimisticLane;
|
|
1379
1376
|
tracking = true;
|
|
1380
1377
|
if (i) {
|
|
1381
1378
|
const t = resolveLane(e);
|
|
1382
1379
|
if (t) currentOptimisticLane = t;
|
|
1383
|
-
} else if (activeTransition && !t && activeTransition.
|
|
1384
|
-
for (let t = e.
|
|
1385
|
-
const n = t.
|
|
1386
|
-
if (n.
|
|
1380
|
+
} else if (activeTransition && !t && activeTransition.P.length) {
|
|
1381
|
+
for (let t = e._e; t; t = t.Oe) {
|
|
1382
|
+
const n = t.Re;
|
|
1383
|
+
if (n.M & REACTIVE_OPTIMISTIC_DIRTY) {
|
|
1387
1384
|
const t = resolveLane(n);
|
|
1388
1385
|
if (t) {
|
|
1389
1386
|
i = true;
|
|
1390
1387
|
currentOptimisticLane = t;
|
|
1391
|
-
e.
|
|
1388
|
+
e.M |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
1392
1389
|
assignOrMergeLane(e, t);
|
|
1393
1390
|
break;
|
|
1394
1391
|
}
|
|
@@ -1396,35 +1393,35 @@ function recompute(e, t = false) {
|
|
|
1396
1393
|
}
|
|
1397
1394
|
}
|
|
1398
1395
|
const E = n && n !== EFFECT_USER;
|
|
1399
|
-
const
|
|
1396
|
+
const T = stale;
|
|
1400
1397
|
if (E) stale = true;
|
|
1401
1398
|
try {
|
|
1402
|
-
if (!false && e.
|
|
1403
|
-
c = e.
|
|
1399
|
+
if (!false && e.ue & CONFIG_SYNC) {
|
|
1400
|
+
c = e.se(c);
|
|
1404
1401
|
e.ve = null;
|
|
1405
1402
|
} else {
|
|
1406
1403
|
const t = e.ve;
|
|
1407
|
-
const n = e.
|
|
1404
|
+
const n = e.se(c);
|
|
1408
1405
|
const i = typeof n === "object" && n !== null;
|
|
1409
1406
|
const r = e.ve !== t;
|
|
1410
1407
|
c = r || !i ? n : handleAsync(e, n);
|
|
1411
1408
|
if (!r && !i) e.ve = null;
|
|
1412
1409
|
}
|
|
1413
1410
|
clearStatus(e, t);
|
|
1414
|
-
if (e.
|
|
1411
|
+
if (e.i) {
|
|
1415
1412
|
const t = resolveLane(e);
|
|
1416
1413
|
if (t) {
|
|
1417
|
-
t.
|
|
1418
|
-
updatePendingSignal(t.
|
|
1414
|
+
t.u.delete(e);
|
|
1415
|
+
updatePendingSignal(t.o);
|
|
1419
1416
|
}
|
|
1420
1417
|
}
|
|
1421
1418
|
} catch (t) {
|
|
1422
1419
|
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
1423
1420
|
const t = findLane(currentOptimisticLane);
|
|
1424
|
-
if (t.
|
|
1425
|
-
t.
|
|
1426
|
-
e.
|
|
1427
|
-
updatePendingSignal(t.
|
|
1421
|
+
if (t.o !== e) {
|
|
1422
|
+
t.u.add(e);
|
|
1423
|
+
e.i = t;
|
|
1424
|
+
updatePendingSignal(t.o);
|
|
1428
1425
|
}
|
|
1429
1426
|
}
|
|
1430
1427
|
if (t instanceof NotReadyError) e.Ge = true;
|
|
@@ -1433,106 +1430,106 @@ function recompute(e, t = false) {
|
|
|
1433
1430
|
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
1434
1431
|
t,
|
|
1435
1432
|
undefined,
|
|
1436
|
-
t instanceof NotReadyError ? e.
|
|
1433
|
+
t instanceof NotReadyError ? e.i : undefined
|
|
1437
1434
|
);
|
|
1438
1435
|
} finally {
|
|
1439
1436
|
tracking = a;
|
|
1440
|
-
if (E) stale =
|
|
1441
|
-
e.
|
|
1437
|
+
if (E) stale = T;
|
|
1438
|
+
e.M = REACTIVE_NONE | (t ? e.M & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1442
1439
|
context = u;
|
|
1443
1440
|
}
|
|
1444
|
-
if (!e.
|
|
1441
|
+
if (!e.ce) {
|
|
1445
1442
|
trimStaleDeps(e);
|
|
1446
|
-
const u = r ? e.
|
|
1443
|
+
const u = r ? e.R : e.m === NOT_PENDING ? e.Z : e.m;
|
|
1447
1444
|
const a = (!n && s) || !e.ke || !e.ke(u, c);
|
|
1448
1445
|
if (n && a) {
|
|
1449
|
-
e.
|
|
1450
|
-
if (!t) e.
|
|
1446
|
+
e.k = !e.ce;
|
|
1447
|
+
if (!t) e.F.enqueue(n, GlobalQueue.ie.bind(null, e));
|
|
1451
1448
|
}
|
|
1452
1449
|
if (a) {
|
|
1453
|
-
const s = r ? e.
|
|
1454
|
-
if (t || (n && activeTransition !== e.
|
|
1455
|
-
e.
|
|
1450
|
+
const s = r ? e.R : undefined;
|
|
1451
|
+
if (t || (n && activeTransition !== e.S) || i) {
|
|
1452
|
+
e.Z = c;
|
|
1456
1453
|
if (r && i) {
|
|
1457
|
-
e.
|
|
1458
|
-
e.
|
|
1454
|
+
e.R = c;
|
|
1455
|
+
e.m = c;
|
|
1459
1456
|
}
|
|
1460
|
-
} else e.
|
|
1461
|
-
if (r && !i && o && !e
|
|
1462
|
-
if (!r || i || e.
|
|
1457
|
+
} else e.m = c;
|
|
1458
|
+
if (r && !i && o && !e.O) e.R = c;
|
|
1459
|
+
if (!r || i || e.R !== s) insertSubs(e, i || r);
|
|
1463
1460
|
} else if (r) {
|
|
1464
|
-
e.
|
|
1465
|
-
} else if (e.
|
|
1466
|
-
for (let t = e.
|
|
1467
|
-
insertIntoHeapHeight(t.
|
|
1461
|
+
e.m = c;
|
|
1462
|
+
} else if (e.H != l) {
|
|
1463
|
+
for (let t = e.D; t !== null; t = t.L) {
|
|
1464
|
+
insertIntoHeapHeight(t.U, t.U.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1468
1465
|
}
|
|
1469
1466
|
}
|
|
1470
1467
|
}
|
|
1471
1468
|
currentOptimisticLane = f;
|
|
1472
|
-
const
|
|
1473
|
-
e.
|
|
1474
|
-
e.
|
|
1475
|
-
e.
|
|
1476
|
-
!!(e.
|
|
1477
|
-
|
|
1478
|
-
e.
|
|
1469
|
+
const S =
|
|
1470
|
+
e.m !== NOT_PENDING ||
|
|
1471
|
+
e.Ee !== null ||
|
|
1472
|
+
e.Te !== null ||
|
|
1473
|
+
!!(e.fe & (STATUS_PENDING | STATUS_UNINITIALIZED));
|
|
1474
|
+
S && (!t || e.fe & STATUS_PENDING) && !e.S && !(activeTransition && r) && queuePendingNode(e);
|
|
1475
|
+
e.S && n && activeTransition !== e.S && runInTransition(e.S, () => recompute(e));
|
|
1479
1476
|
}
|
|
1480
1477
|
function updateIfNecessary(e) {
|
|
1481
|
-
if (e.
|
|
1482
|
-
for (let t = e.
|
|
1483
|
-
const n = t.
|
|
1484
|
-
const i = n.
|
|
1485
|
-
if (i.
|
|
1478
|
+
if (e.M & REACTIVE_CHECK) {
|
|
1479
|
+
for (let t = e._e; t; t = t.Oe) {
|
|
1480
|
+
const n = t.Re;
|
|
1481
|
+
const i = n.Ie || n;
|
|
1482
|
+
if (i.se) {
|
|
1486
1483
|
updateIfNecessary(i);
|
|
1487
1484
|
}
|
|
1488
|
-
if (e.
|
|
1485
|
+
if (e.M & REACTIVE_DIRTY) {
|
|
1489
1486
|
break;
|
|
1490
1487
|
}
|
|
1491
1488
|
}
|
|
1492
1489
|
}
|
|
1493
|
-
if (e.
|
|
1490
|
+
if (e.M & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.ce && e.le < clock && !e.ve)) {
|
|
1494
1491
|
recompute(e);
|
|
1495
1492
|
}
|
|
1496
|
-
e.
|
|
1493
|
+
e.M = e.M & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
|
|
1497
1494
|
}
|
|
1498
1495
|
function computed(e, t) {
|
|
1499
1496
|
const n = t?.transparent ?? false;
|
|
1500
1497
|
const i = {
|
|
1501
1498
|
id: t?.id ?? (n ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1502
|
-
|
|
1499
|
+
ue:
|
|
1503
1500
|
(n ? CONFIG_TRANSPARENT : 0) |
|
|
1504
1501
|
(t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
|
|
1505
1502
|
(!context || t?.lazy ? CONFIG_AUTO_DISPOSE : 0) |
|
|
1506
1503
|
(t?.sync ? CONFIG_SYNC : 0) |
|
|
1507
1504
|
(snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
|
|
1508
1505
|
ke: t?.equals != null ? t.equals : isEqual,
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1506
|
+
V: t?.unobserved,
|
|
1507
|
+
Ve: null,
|
|
1508
|
+
F: context?.F ?? globalQueue,
|
|
1509
|
+
we: context?.we ?? defaultContext,
|
|
1513
1510
|
me: 0,
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1511
|
+
se: e,
|
|
1512
|
+
Z: undefined,
|
|
1513
|
+
H: 0,
|
|
1514
|
+
Pe: null,
|
|
1515
|
+
Ae: undefined,
|
|
1516
|
+
Ne: null,
|
|
1517
|
+
_e: null,
|
|
1521
1518
|
ye: null,
|
|
1522
|
-
|
|
1519
|
+
D: null,
|
|
1523
1520
|
Ue: null,
|
|
1524
|
-
|
|
1521
|
+
q: context,
|
|
1525
1522
|
De: null,
|
|
1526
|
-
|
|
1523
|
+
be: null,
|
|
1527
1524
|
ge: null,
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1525
|
+
M: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1526
|
+
fe: STATUS_UNINITIALIZED,
|
|
1527
|
+
le: clock,
|
|
1528
|
+
m: NOT_PENDING,
|
|
1529
|
+
Te: null,
|
|
1530
|
+
Ee: null,
|
|
1534
1531
|
ve: null,
|
|
1535
|
-
|
|
1532
|
+
S: null
|
|
1536
1533
|
};
|
|
1537
1534
|
setupComputedNode(i, t);
|
|
1538
1535
|
return i;
|
|
@@ -1541,81 +1538,81 @@ function createEffectNode(e, t, n, i, r, o) {
|
|
|
1541
1538
|
const s = o?.transparent ?? false;
|
|
1542
1539
|
const u = {
|
|
1543
1540
|
id: o?.id ?? (s ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1544
|
-
|
|
1541
|
+
ue:
|
|
1545
1542
|
(s ? CONFIG_TRANSPARENT : 0) |
|
|
1546
1543
|
(o?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
|
|
1547
1544
|
(o?.sync ? CONFIG_SYNC : 0) |
|
|
1548
1545
|
(snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
|
|
1549
1546
|
ke: false,
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1547
|
+
V: o?.unobserved,
|
|
1548
|
+
Ve: null,
|
|
1549
|
+
F: context?.F ?? globalQueue,
|
|
1550
|
+
we: context?.we ?? defaultContext,
|
|
1554
1551
|
me: 0,
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1552
|
+
se: e,
|
|
1553
|
+
Z: undefined,
|
|
1554
|
+
H: 0,
|
|
1555
|
+
Pe: null,
|
|
1556
|
+
Ae: undefined,
|
|
1557
|
+
Ne: null,
|
|
1558
|
+
_e: null,
|
|
1562
1559
|
ye: null,
|
|
1563
|
-
|
|
1560
|
+
D: null,
|
|
1564
1561
|
Ue: null,
|
|
1565
|
-
|
|
1562
|
+
q: context,
|
|
1566
1563
|
De: null,
|
|
1567
|
-
|
|
1564
|
+
be: null,
|
|
1568
1565
|
ge: null,
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1566
|
+
M: REACTIVE_LAZY,
|
|
1567
|
+
fe: STATUS_UNINITIALIZED,
|
|
1568
|
+
le: clock,
|
|
1569
|
+
m: NOT_PENDING,
|
|
1570
|
+
Te: null,
|
|
1571
|
+
Ee: null,
|
|
1575
1572
|
ve: null,
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1573
|
+
S: null,
|
|
1574
|
+
k: false,
|
|
1575
|
+
xe: undefined,
|
|
1579
1576
|
Qe: t,
|
|
1580
1577
|
je: n,
|
|
1581
1578
|
$e: undefined,
|
|
1582
1579
|
Ke: false,
|
|
1583
|
-
|
|
1584
|
-
|
|
1580
|
+
G: i,
|
|
1581
|
+
Me: r
|
|
1585
1582
|
};
|
|
1586
1583
|
setupComputedNode(u, lazyOptions);
|
|
1587
1584
|
return u;
|
|
1588
1585
|
}
|
|
1589
1586
|
const lazyOptions = { lazy: true };
|
|
1590
1587
|
function setupComputedNode(e, t) {
|
|
1591
|
-
e.
|
|
1592
|
-
const n = context?.
|
|
1588
|
+
e.Ne = e;
|
|
1589
|
+
const n = context?.pe ? context.he : context;
|
|
1593
1590
|
if (context) {
|
|
1594
1591
|
const t = context.ge;
|
|
1595
1592
|
if (t === null) {
|
|
1596
1593
|
context.ge = e;
|
|
1597
1594
|
} else {
|
|
1598
1595
|
e.De = t;
|
|
1599
|
-
t.
|
|
1596
|
+
t.be = e;
|
|
1600
1597
|
context.ge = e;
|
|
1601
1598
|
}
|
|
1602
1599
|
}
|
|
1603
|
-
if (n) e.
|
|
1600
|
+
if (n) e.H = n.H + 1;
|
|
1604
1601
|
if (externalSourceConfig) {
|
|
1605
1602
|
const t = signal(undefined, { equals: false, ownedWrite: true });
|
|
1606
|
-
const n = externalSourceConfig.factory(e.
|
|
1603
|
+
const n = externalSourceConfig.factory(e.se, () => {
|
|
1607
1604
|
setSignal(t, undefined);
|
|
1608
1605
|
});
|
|
1609
1606
|
cleanup(() => n.dispose());
|
|
1610
|
-
e.
|
|
1607
|
+
e.se = e => {
|
|
1611
1608
|
read(t);
|
|
1612
1609
|
return n.track(e);
|
|
1613
1610
|
};
|
|
1614
1611
|
}
|
|
1615
1612
|
!t?.lazy && recompute(e, true);
|
|
1616
1613
|
if (snapshotCaptureActive && !t?.lazy) {
|
|
1617
|
-
if (!(e.
|
|
1618
|
-
e.
|
|
1614
|
+
if (!(e.fe & STATUS_PENDING)) {
|
|
1615
|
+
e.ae = e.Z === undefined ? NO_SNAPSHOT : e.Z;
|
|
1619
1616
|
snapshotSources.add(e);
|
|
1620
1617
|
}
|
|
1621
1618
|
}
|
|
@@ -1623,31 +1620,31 @@ function setupComputedNode(e, t) {
|
|
|
1623
1620
|
function signal(e, t, n = null) {
|
|
1624
1621
|
const i = {
|
|
1625
1622
|
ke: t?.equals != null ? t.equals : isEqual,
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1623
|
+
ue: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.Ye ? CONFIG_NO_SNAPSHOT : 0),
|
|
1624
|
+
V: t?.unobserved,
|
|
1625
|
+
Z: e,
|
|
1626
|
+
D: null,
|
|
1630
1627
|
Ue: null,
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1628
|
+
le: clock,
|
|
1629
|
+
Ie: n,
|
|
1630
|
+
Ce: n?.Pe || null,
|
|
1631
|
+
m: NOT_PENDING
|
|
1635
1632
|
};
|
|
1636
|
-
n && (n.
|
|
1637
|
-
if (snapshotCaptureActive && !(i.
|
|
1638
|
-
i.
|
|
1633
|
+
n && (n.Pe = i);
|
|
1634
|
+
if (snapshotCaptureActive && !(i.ue & CONFIG_NO_SNAPSHOT) && !((n?.fe ?? 0) & STATUS_PENDING)) {
|
|
1635
|
+
i.ae = e === undefined ? NO_SNAPSHOT : e;
|
|
1639
1636
|
snapshotSources.add(i);
|
|
1640
1637
|
}
|
|
1641
1638
|
return i;
|
|
1642
1639
|
}
|
|
1643
1640
|
function optimisticSignal(e, t) {
|
|
1644
1641
|
const n = signal(e, t);
|
|
1645
|
-
n.
|
|
1642
|
+
n.R = NOT_PENDING;
|
|
1646
1643
|
return n;
|
|
1647
1644
|
}
|
|
1648
1645
|
function optimisticComputed(e, t) {
|
|
1649
1646
|
const n = computed(e, t);
|
|
1650
|
-
n.
|
|
1647
|
+
n.R = NOT_PENDING;
|
|
1651
1648
|
return n;
|
|
1652
1649
|
}
|
|
1653
1650
|
function isEqual(e, t) {
|
|
@@ -1669,7 +1666,7 @@ function read(e) {
|
|
|
1669
1666
|
const t = getLatestValueComputed(e);
|
|
1670
1667
|
const n = latestReadActive;
|
|
1671
1668
|
latestReadActive = false;
|
|
1672
|
-
const i = e.
|
|
1669
|
+
const i = e.R !== undefined && e.R !== NOT_PENDING ? e.R : e.Z;
|
|
1673
1670
|
let r;
|
|
1674
1671
|
try {
|
|
1675
1672
|
r = read(t);
|
|
@@ -1679,42 +1676,42 @@ function read(e) {
|
|
|
1679
1676
|
} finally {
|
|
1680
1677
|
latestReadActive = n;
|
|
1681
1678
|
}
|
|
1682
|
-
if (t.
|
|
1683
|
-
if (stale && currentOptimisticLane && t.
|
|
1684
|
-
const e = findLane(t.
|
|
1679
|
+
if (t.fe & STATUS_PENDING) return i;
|
|
1680
|
+
if (stale && currentOptimisticLane && t.i) {
|
|
1681
|
+
const e = findLane(t.i);
|
|
1685
1682
|
const n = findLane(currentOptimisticLane);
|
|
1686
|
-
if (e !== n && e.
|
|
1683
|
+
if (e !== n && e.u.size > 0) {
|
|
1687
1684
|
return i;
|
|
1688
1685
|
}
|
|
1689
1686
|
}
|
|
1690
1687
|
return r;
|
|
1691
1688
|
}
|
|
1692
1689
|
if (pendingCheckActive) {
|
|
1693
|
-
const t = e.
|
|
1690
|
+
const t = e.Ie;
|
|
1694
1691
|
const n = pendingCheckActive;
|
|
1695
1692
|
pendingCheckActive = false;
|
|
1696
1693
|
let i = context;
|
|
1697
|
-
if (i?.
|
|
1694
|
+
if (i?.pe) i = i.he;
|
|
1698
1695
|
const r = t || e;
|
|
1699
1696
|
const o = e;
|
|
1700
|
-
if (typeof o.
|
|
1697
|
+
if (typeof o.se === "function") {
|
|
1701
1698
|
const t = e;
|
|
1702
|
-
if (t.
|
|
1703
|
-
t.
|
|
1699
|
+
if (t.M & REACTIVE_LAZY) {
|
|
1700
|
+
t.M &= ~REACTIVE_LAZY;
|
|
1704
1701
|
recompute(t, true);
|
|
1705
|
-
} else if (t.
|
|
1702
|
+
} else if (t.M & REACTIVE_DISPOSED) {
|
|
1706
1703
|
recompute(t, true);
|
|
1707
1704
|
} else {
|
|
1708
1705
|
updateIfNecessary(t);
|
|
1709
1706
|
}
|
|
1710
1707
|
}
|
|
1711
|
-
if (i && r.
|
|
1708
|
+
if (i && r.fe & STATUS_PENDING && r.fe & STATUS_UNINITIALIZED) {
|
|
1712
1709
|
if (tracking && e !== i) link(e, i);
|
|
1713
1710
|
pendingCheckActive = n;
|
|
1714
|
-
throw r.
|
|
1711
|
+
throw r.ce;
|
|
1715
1712
|
}
|
|
1716
|
-
if (t && e.
|
|
1717
|
-
if (e.
|
|
1713
|
+
if (t && e.R !== undefined) {
|
|
1714
|
+
if (e.R !== NOT_PENDING && (t.ve || !!(t.fe & STATUS_PENDING))) {
|
|
1718
1715
|
foundPending = true;
|
|
1719
1716
|
}
|
|
1720
1717
|
collectPendingSources(e);
|
|
@@ -1727,159 +1724,166 @@ function read(e) {
|
|
|
1727
1724
|
pendingCheckActive = n;
|
|
1728
1725
|
}
|
|
1729
1726
|
let t = context;
|
|
1730
|
-
if (t?.
|
|
1727
|
+
if (t?.pe) t = t.he;
|
|
1731
1728
|
const n = e;
|
|
1732
|
-
if (typeof n.
|
|
1729
|
+
if (typeof n.se === "function") {
|
|
1733
1730
|
const t = e;
|
|
1734
|
-
if (t.
|
|
1735
|
-
t.
|
|
1731
|
+
if (t.M & REACTIVE_LAZY) {
|
|
1732
|
+
t.M &= ~REACTIVE_LAZY;
|
|
1736
1733
|
recompute(t, true);
|
|
1737
|
-
} else if (t.
|
|
1734
|
+
} else if (t.M & REACTIVE_DISPOSED) {
|
|
1738
1735
|
recompute(t, true);
|
|
1739
1736
|
}
|
|
1740
1737
|
}
|
|
1741
|
-
const i = e.
|
|
1738
|
+
const i = e.Ie || e;
|
|
1742
1739
|
if (
|
|
1743
|
-
!n.
|
|
1740
|
+
!n.se &&
|
|
1744
1741
|
i === e &&
|
|
1745
|
-
e.
|
|
1746
|
-
e.
|
|
1742
|
+
e.R === undefined &&
|
|
1743
|
+
e.ae === undefined &&
|
|
1747
1744
|
activeTransition === null &&
|
|
1748
1745
|
currentOptimisticLane === null &&
|
|
1749
1746
|
!snapshotCaptureActive &&
|
|
1750
1747
|
true
|
|
1751
1748
|
) {
|
|
1752
1749
|
if (t && tracking) link(e, t);
|
|
1753
|
-
return !t || e.
|
|
1750
|
+
return !t || e.m === NOT_PENDING ? e.Z : e.m;
|
|
1754
1751
|
}
|
|
1755
1752
|
if (t && tracking) {
|
|
1756
1753
|
link(e, t);
|
|
1757
|
-
if (i.
|
|
1758
|
-
const n = e.
|
|
1759
|
-
if (i.
|
|
1754
|
+
if (i.se) {
|
|
1755
|
+
const n = e.M & REACTIVE_ZOMBIE;
|
|
1756
|
+
if (i.H >= (n ? zombieQueue.h : dirtyQueue.h)) {
|
|
1760
1757
|
markNode(t);
|
|
1761
1758
|
markHeap(n ? zombieQueue : dirtyQueue);
|
|
1762
1759
|
updateIfNecessary(i);
|
|
1763
1760
|
}
|
|
1764
|
-
const r = i.
|
|
1765
|
-
if (r >= t.
|
|
1766
|
-
t.
|
|
1761
|
+
const r = i.H;
|
|
1762
|
+
if (r >= t.H && e.q !== t) {
|
|
1763
|
+
t.H = r + 1;
|
|
1767
1764
|
}
|
|
1768
1765
|
}
|
|
1769
1766
|
}
|
|
1770
|
-
if (i.
|
|
1771
|
-
if (t && !(stale && i.
|
|
1767
|
+
if (i.fe & STATUS_PENDING) {
|
|
1768
|
+
if (t && !(stale && i.S && activeTransition !== i.S)) {
|
|
1772
1769
|
if (currentOptimisticLane) {
|
|
1773
|
-
const n = i.
|
|
1770
|
+
const n = i.i;
|
|
1774
1771
|
const r = findLane(currentOptimisticLane);
|
|
1775
1772
|
if (n && findLane(n) === r && !hasActiveOverride(i)) {
|
|
1776
1773
|
if (!tracking && e !== t) link(e, t);
|
|
1777
|
-
throw i.
|
|
1774
|
+
throw i.ce;
|
|
1778
1775
|
}
|
|
1779
1776
|
} else {
|
|
1780
1777
|
if (!tracking && e !== t) link(e, t);
|
|
1781
|
-
throw i.
|
|
1778
|
+
throw i.ce;
|
|
1782
1779
|
}
|
|
1783
|
-
} else if (t && i !== e && i.
|
|
1780
|
+
} else if (t && i !== e && i.fe & STATUS_UNINITIALIZED) {
|
|
1784
1781
|
if (!tracking && e !== t) link(e, t);
|
|
1785
|
-
throw i.
|
|
1786
|
-
} else if (!t && i.
|
|
1787
|
-
throw i.
|
|
1782
|
+
throw i.ce;
|
|
1783
|
+
} else if (!t && i.fe & STATUS_UNINITIALIZED) {
|
|
1784
|
+
throw i.ce;
|
|
1788
1785
|
}
|
|
1789
1786
|
}
|
|
1790
|
-
if (e.
|
|
1791
|
-
if (e.
|
|
1787
|
+
if (e.se && e.fe & STATUS_ERROR) {
|
|
1788
|
+
if (e.le < clock) {
|
|
1792
1789
|
recompute(e);
|
|
1793
1790
|
return read(e);
|
|
1794
|
-
} else throw e.
|
|
1791
|
+
} else throw e.ce;
|
|
1795
1792
|
}
|
|
1796
|
-
if (snapshotCaptureActive && t && t.
|
|
1797
|
-
const n = e.
|
|
1793
|
+
if (snapshotCaptureActive && t && t.ue & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
1794
|
+
const n = e.ae;
|
|
1798
1795
|
if (n !== undefined) {
|
|
1799
1796
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1800
|
-
const r = e.
|
|
1801
|
-
if (r !== i) t.
|
|
1797
|
+
const r = e.m !== NOT_PENDING ? e.m : e.Z;
|
|
1798
|
+
if (r !== i) t.M |= REACTIVE_SNAPSHOT_STALE;
|
|
1802
1799
|
return i;
|
|
1803
1800
|
}
|
|
1804
1801
|
}
|
|
1805
|
-
if (e.
|
|
1806
|
-
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.
|
|
1807
|
-
return e.
|
|
1802
|
+
if (e.R !== undefined && e.R !== NOT_PENDING) {
|
|
1803
|
+
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.Z;
|
|
1804
|
+
return e.R;
|
|
1808
1805
|
}
|
|
1809
1806
|
if (
|
|
1810
1807
|
activeTransition !== null &&
|
|
1811
1808
|
currentOptimisticLane !== null &&
|
|
1812
1809
|
!latestReadActive &&
|
|
1813
|
-
e.
|
|
1814
|
-
i === e &&
|
|
1815
|
-
!e.
|
|
1810
|
+
e.m !== NOT_PENDING &&
|
|
1811
|
+
(i === e || !!(i.M & REACTIVE_MANUAL_WRITE)) &&
|
|
1812
|
+
!e.se &&
|
|
1816
1813
|
t
|
|
1817
1814
|
) {
|
|
1818
|
-
activeTransition.
|
|
1819
|
-
return e.
|
|
1815
|
+
activeTransition.Y.add(t);
|
|
1816
|
+
return e.Z;
|
|
1820
1817
|
}
|
|
1821
1818
|
const r =
|
|
1822
1819
|
!t ||
|
|
1823
1820
|
(currentOptimisticLane !== null &&
|
|
1824
|
-
(e.
|
|
1825
|
-
e.
|
|
1826
|
-
(stale && e.
|
|
1827
|
-
? e.
|
|
1828
|
-
: e.
|
|
1821
|
+
(e.R !== undefined || e.i || (i === e && stale) || !!(i.fe & STATUS_PENDING))) ||
|
|
1822
|
+
e.m === NOT_PENDING ||
|
|
1823
|
+
(stale && e.S && activeTransition !== e.S)
|
|
1824
|
+
? e.Z
|
|
1825
|
+
: e.m;
|
|
1829
1826
|
if (
|
|
1830
1827
|
!t &&
|
|
1831
1828
|
i === e &&
|
|
1832
|
-
typeof n.
|
|
1833
|
-
e.
|
|
1834
|
-
!(i.
|
|
1835
|
-
!e.
|
|
1829
|
+
typeof n.se === "function" &&
|
|
1830
|
+
e.ue & CONFIG_AUTO_DISPOSE &&
|
|
1831
|
+
!(i.fe & STATUS_PENDING) &&
|
|
1832
|
+
!e.D
|
|
1836
1833
|
) {
|
|
1837
1834
|
unobserved(e);
|
|
1838
1835
|
}
|
|
1839
1836
|
return r;
|
|
1840
1837
|
}
|
|
1841
1838
|
function setSignal(e, t) {
|
|
1842
|
-
if (e.
|
|
1843
|
-
const n = e.
|
|
1844
|
-
const i = e.
|
|
1845
|
-
const r = n ? (i ? e.
|
|
1839
|
+
if (e.S && activeTransition !== e.S) globalQueue.initTransition(e.S);
|
|
1840
|
+
const n = e.R !== undefined && !projectionWriteActive;
|
|
1841
|
+
const i = e.R !== undefined && e.R !== NOT_PENDING;
|
|
1842
|
+
const r = n ? (i ? e.R : e.Z) : e.m === NOT_PENDING ? e.Z : e.m;
|
|
1846
1843
|
if (typeof t === "function") t = t(r);
|
|
1847
|
-
const o = !e.ke || !e.ke(r, t) || !!(e.
|
|
1844
|
+
const o = !e.ke || !e.ke(r, t) || !!(e.fe & STATUS_UNINITIALIZED);
|
|
1848
1845
|
if (!o) {
|
|
1849
|
-
if (n && i
|
|
1850
|
-
|
|
1851
|
-
|
|
1846
|
+
if (n && i) {
|
|
1847
|
+
const t = resolveTransition(e);
|
|
1848
|
+
if (t && activeTransition !== t) globalQueue.initTransition(t);
|
|
1849
|
+
if (e.se) {
|
|
1850
|
+
insertSubs(e, true);
|
|
1851
|
+
schedule();
|
|
1852
|
+
}
|
|
1852
1853
|
}
|
|
1853
1854
|
return t;
|
|
1854
1855
|
}
|
|
1855
1856
|
if (n) {
|
|
1856
|
-
const n = e.
|
|
1857
|
+
const n = e.R === NOT_PENDING;
|
|
1857
1858
|
if (!n) globalQueue.initTransition(resolveTransition(e));
|
|
1858
1859
|
if (n) {
|
|
1859
|
-
e.
|
|
1860
|
-
globalQueue.
|
|
1860
|
+
e.m = e.Z;
|
|
1861
|
+
globalQueue.P.push(e);
|
|
1861
1862
|
}
|
|
1862
|
-
e
|
|
1863
|
+
e.O = true;
|
|
1863
1864
|
const i = getOrCreateLane(e);
|
|
1864
|
-
e.
|
|
1865
|
-
e.
|
|
1865
|
+
e.i = i;
|
|
1866
|
+
e.R = t;
|
|
1866
1867
|
} else {
|
|
1867
|
-
if (e.
|
|
1868
|
-
e.
|
|
1868
|
+
if (e.m === NOT_PENDING) queuePendingNode(e);
|
|
1869
|
+
e.m = t;
|
|
1869
1870
|
}
|
|
1870
1871
|
if (e.We) updatePendingSignal(e);
|
|
1871
1872
|
if (e.Fe) {
|
|
1872
1873
|
setSignal(e.Fe, t);
|
|
1873
1874
|
}
|
|
1874
|
-
e.
|
|
1875
|
+
e.le = clock;
|
|
1875
1876
|
insertSubs(e, n);
|
|
1876
1877
|
schedule();
|
|
1877
1878
|
return t;
|
|
1878
1879
|
}
|
|
1879
1880
|
function suppressComputedRecompute(e) {
|
|
1880
|
-
deleteFromHeap(e, e.
|
|
1881
|
-
if (!(e.
|
|
1882
|
-
|
|
1881
|
+
deleteFromHeap(e, e.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1882
|
+
if (!(e.M & REACTIVE_MANUAL_WRITE) && e.m === NOT_PENDING) {
|
|
1883
|
+
queuePendingNode(e);
|
|
1884
|
+
schedule();
|
|
1885
|
+
}
|
|
1886
|
+
e.M = (e.M & -4) | REACTIVE_MANUAL_WRITE;
|
|
1883
1887
|
}
|
|
1884
1888
|
function setMemo(e, t) {
|
|
1885
1889
|
const n = setSignal(e, t);
|
|
@@ -1901,8 +1905,8 @@ function runWithOwner(e, t) {
|
|
|
1901
1905
|
function getPendingSignal(e) {
|
|
1902
1906
|
if (!e.We) {
|
|
1903
1907
|
e.We = optimisticSignal(false, { ownedWrite: true });
|
|
1904
|
-
if (e.
|
|
1905
|
-
e.We.
|
|
1908
|
+
if (e.t) {
|
|
1909
|
+
e.We.t = e;
|
|
1906
1910
|
}
|
|
1907
1911
|
if (computePendingState(e)) setSignal(e.We, true);
|
|
1908
1912
|
}
|
|
@@ -1910,49 +1914,49 @@ function getPendingSignal(e) {
|
|
|
1910
1914
|
}
|
|
1911
1915
|
function collectPendingSources(e) {
|
|
1912
1916
|
pendingCheckSources?.add(e);
|
|
1913
|
-
const t = e.
|
|
1917
|
+
const t = e.Ie || e;
|
|
1914
1918
|
if (t !== e) pendingCheckSources?.add(t);
|
|
1915
1919
|
}
|
|
1916
1920
|
function computePendingState(e) {
|
|
1917
1921
|
const t = e;
|
|
1918
|
-
const n = e.
|
|
1919
|
-
if (e.
|
|
1920
|
-
const n = e.
|
|
1921
|
-
if (n.
|
|
1922
|
-
return e.
|
|
1922
|
+
const n = e.Ie;
|
|
1923
|
+
if (e.t) {
|
|
1924
|
+
const n = e.t;
|
|
1925
|
+
if (n.fe & STATUS_PENDING && !(n.fe & STATUS_UNINITIALIZED)) return true;
|
|
1926
|
+
return e.m !== NOT_PENDING && !(t.fe & STATUS_UNINITIALIZED);
|
|
1923
1927
|
}
|
|
1924
|
-
if (n && e.
|
|
1925
|
-
return !n.ve && !(n.
|
|
1928
|
+
if (n && e.m !== NOT_PENDING) {
|
|
1929
|
+
return !!(n.M & REACTIVE_MANUAL_WRITE) || (!n.ve && !(n.fe & STATUS_PENDING));
|
|
1926
1930
|
}
|
|
1927
|
-
if (e.
|
|
1928
|
-
if (t.
|
|
1929
|
-
if (e.
|
|
1930
|
-
const t = e.
|
|
1931
|
-
return !!(t && t.
|
|
1931
|
+
if (e.R !== undefined && e.R !== NOT_PENDING) {
|
|
1932
|
+
if (t.fe & STATUS_PENDING && !(t.fe & STATUS_UNINITIALIZED)) return true;
|
|
1933
|
+
if (e.t) {
|
|
1934
|
+
const t = e.i ? findLane(e.i) : null;
|
|
1935
|
+
return !!(t && t.u.size > 0);
|
|
1932
1936
|
}
|
|
1933
1937
|
return true;
|
|
1934
1938
|
}
|
|
1935
|
-
if (e.
|
|
1939
|
+
if (e.R !== undefined && e.R === NOT_PENDING && !e.t) {
|
|
1936
1940
|
return false;
|
|
1937
1941
|
}
|
|
1938
|
-
if (e.
|
|
1939
|
-
return !!(t.
|
|
1942
|
+
if (e.m !== NOT_PENDING && !(t.fe & STATUS_UNINITIALIZED)) return true;
|
|
1943
|
+
return !!(t.fe & STATUS_PENDING && !(t.fe & STATUS_UNINITIALIZED));
|
|
1940
1944
|
}
|
|
1941
1945
|
function updatePendingSignal(e) {
|
|
1942
1946
|
if (e.We) {
|
|
1943
1947
|
const t = computePendingState(e);
|
|
1944
1948
|
const n = e.We;
|
|
1945
1949
|
setSignal(n, t);
|
|
1946
|
-
if (!t && n.
|
|
1950
|
+
if (!t && n.i) {
|
|
1947
1951
|
const t = resolveLane(e);
|
|
1948
|
-
if (t && t.
|
|
1949
|
-
const e = findLane(n.
|
|
1952
|
+
if (t && t.u.size > 0) {
|
|
1953
|
+
const e = findLane(n.i);
|
|
1950
1954
|
if (e !== t) {
|
|
1951
1955
|
mergeLanes(t, e);
|
|
1952
1956
|
}
|
|
1953
1957
|
}
|
|
1954
1958
|
signalLanes.delete(n);
|
|
1955
|
-
n.
|
|
1959
|
+
n.i = undefined;
|
|
1956
1960
|
}
|
|
1957
1961
|
}
|
|
1958
1962
|
}
|
|
@@ -1965,7 +1969,7 @@ function getLatestValueComputed(e) {
|
|
|
1965
1969
|
const i = context;
|
|
1966
1970
|
context = null;
|
|
1967
1971
|
e.Fe = optimisticComputed(() => read(e));
|
|
1968
|
-
e.Fe.
|
|
1972
|
+
e.Fe.t = e;
|
|
1969
1973
|
context = i;
|
|
1970
1974
|
pendingCheckActive = n;
|
|
1971
1975
|
latestReadActive = t;
|
|
@@ -2014,7 +2018,7 @@ function isPending(e) {
|
|
|
2014
2018
|
} catch (e) {
|
|
2015
2019
|
collectPending();
|
|
2016
2020
|
if (e instanceof NotReadyError) {
|
|
2017
|
-
if (foundPending && !(e.source?.
|
|
2021
|
+
if (foundPending && !(e.source?.fe & STATUS_UNINITIALIZED)) return true;
|
|
2018
2022
|
if (context) throw e;
|
|
2019
2023
|
}
|
|
2020
2024
|
return foundPending;
|
|
@@ -2025,23 +2029,15 @@ function isPending(e) {
|
|
|
2025
2029
|
}
|
|
2026
2030
|
}
|
|
2027
2031
|
function refresh(e) {
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
} finally {
|
|
2037
|
-
refreshing = t;
|
|
2038
|
-
if (!t) {
|
|
2039
|
-
schedule();
|
|
2040
|
-
}
|
|
2032
|
+
const t = e?.[$REFRESH];
|
|
2033
|
+
if (!t) {
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
if (typeof t.se === "function" && !(t.M & (REACTIVE_DISPOSED | REACTIVE_MANUAL_WRITE))) {
|
|
2037
|
+
t.M = (t.M & ~REACTIVE_CHECK) | REACTIVE_DIRTY;
|
|
2038
|
+
insertIntoHeap(t, t.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
2039
|
+
schedule();
|
|
2041
2040
|
}
|
|
2042
|
-
}
|
|
2043
|
-
function isRefreshing() {
|
|
2044
|
-
return refreshing;
|
|
2045
2041
|
}
|
|
2046
2042
|
function createContext(e, t) {
|
|
2047
2043
|
return { id: Symbol(t), defaultValue: e };
|
|
@@ -2050,7 +2046,7 @@ function getContext(e, t = getOwner()) {
|
|
|
2050
2046
|
if (!t) {
|
|
2051
2047
|
throw new NoOwnerError();
|
|
2052
2048
|
}
|
|
2053
|
-
const n = hasContext(e, t) ? t.
|
|
2049
|
+
const n = hasContext(e, t) ? t.we[e.id] : e.defaultValue;
|
|
2054
2050
|
if (isUndefined(n)) {
|
|
2055
2051
|
throw new ContextNotFoundError();
|
|
2056
2052
|
}
|
|
@@ -2060,10 +2056,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
2060
2056
|
if (!n) {
|
|
2061
2057
|
throw new NoOwnerError();
|
|
2062
2058
|
}
|
|
2063
|
-
n.
|
|
2059
|
+
n.we = { ...n.we, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
2064
2060
|
}
|
|
2065
2061
|
function hasContext(e, t) {
|
|
2066
|
-
return !isUndefined(t?.
|
|
2062
|
+
return !isUndefined(t?.we[e.id]);
|
|
2067
2063
|
}
|
|
2068
2064
|
function isUndefined(e) {
|
|
2069
2065
|
return typeof e === "undefined";
|
|
@@ -2073,17 +2069,15 @@ function effect(e, t, n, i) {
|
|
|
2073
2069
|
const o = createEffectNode(e, t, n, r ? EFFECT_USER : EFFECT_RENDER, notifyEffectStatus, i);
|
|
2074
2070
|
recompute(o, true);
|
|
2075
2071
|
!i?.defer &&
|
|
2076
|
-
(o.
|
|
2077
|
-
? o.te.enqueue(o.J, runEffect.bind(null, o))
|
|
2078
|
-
: runEffect(o));
|
|
2072
|
+
(o.G === EFFECT_USER || i?.schedule ? o.F.enqueue(o.G, runEffect.bind(null, o)) : runEffect(o));
|
|
2079
2073
|
}
|
|
2080
2074
|
function notifyEffectStatus(e, t) {
|
|
2081
|
-
const n = e !== undefined ? e : this.
|
|
2082
|
-
const i = t !== undefined ? t : this.
|
|
2075
|
+
const n = e !== undefined ? e : this.fe;
|
|
2076
|
+
const i = t !== undefined ? t : this.ce;
|
|
2083
2077
|
if (n & STATUS_ERROR) {
|
|
2084
2078
|
let e = i;
|
|
2085
|
-
this.
|
|
2086
|
-
if (this.
|
|
2079
|
+
this.F.notify(this, STATUS_PENDING, 0);
|
|
2080
|
+
if (this.G === EFFECT_USER) {
|
|
2087
2081
|
try {
|
|
2088
2082
|
return this.je
|
|
2089
2083
|
? this.je(e, () => {
|
|
@@ -2095,38 +2089,38 @@ function notifyEffectStatus(e, t) {
|
|
|
2095
2089
|
e = t;
|
|
2096
2090
|
}
|
|
2097
2091
|
}
|
|
2098
|
-
if (!this.
|
|
2099
|
-
} else if (this.
|
|
2100
|
-
this.
|
|
2092
|
+
if (!this.F.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
2093
|
+
} else if (this.G === EFFECT_RENDER) {
|
|
2094
|
+
this.F.notify(this, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
2101
2095
|
}
|
|
2102
2096
|
}
|
|
2103
2097
|
function runEffect(e) {
|
|
2104
|
-
if (!e.
|
|
2098
|
+
if (!e.k || e.M & REACTIVE_DISPOSED) return;
|
|
2105
2099
|
e.$e?.();
|
|
2106
2100
|
e.$e = undefined;
|
|
2107
2101
|
try {
|
|
2108
|
-
const t = e.Qe(e.
|
|
2102
|
+
const t = e.Qe(e.Z, e.xe);
|
|
2109
2103
|
if (false && t !== undefined && typeof t !== "function");
|
|
2110
2104
|
e.$e = t;
|
|
2111
2105
|
if (e.$e && !e.Ke) {
|
|
2112
2106
|
e.Ke = true;
|
|
2113
|
-
runWithOwner(e.
|
|
2107
|
+
runWithOwner(e.q, () => cleanup(() => e.$e?.()));
|
|
2114
2108
|
}
|
|
2115
2109
|
} catch (t) {
|
|
2116
|
-
e.
|
|
2117
|
-
e.
|
|
2118
|
-
if (!e.
|
|
2110
|
+
e.ce = new StatusError(e, t);
|
|
2111
|
+
e.fe |= STATUS_ERROR;
|
|
2112
|
+
if (!e.F.notify(e, STATUS_ERROR, STATUS_ERROR)) throw t;
|
|
2119
2113
|
} finally {
|
|
2120
|
-
e.
|
|
2121
|
-
e.
|
|
2114
|
+
e.xe = e.Z;
|
|
2115
|
+
e.k = false;
|
|
2122
2116
|
}
|
|
2123
2117
|
}
|
|
2124
|
-
GlobalQueue.
|
|
2118
|
+
GlobalQueue.ie = runEffect;
|
|
2125
2119
|
function trackedEffect(e, t) {
|
|
2126
2120
|
const run = () => {
|
|
2127
|
-
if (!n.
|
|
2121
|
+
if (!n.k || n.M & REACTIVE_DISPOSED) return;
|
|
2128
2122
|
try {
|
|
2129
|
-
n.
|
|
2123
|
+
n.k = false;
|
|
2130
2124
|
recompute(n);
|
|
2131
2125
|
} finally {
|
|
2132
2126
|
}
|
|
@@ -2141,19 +2135,19 @@ function trackedEffect(e, t) {
|
|
|
2141
2135
|
{ ...t, lazy: true }
|
|
2142
2136
|
);
|
|
2143
2137
|
n.$e = undefined;
|
|
2144
|
-
n.
|
|
2145
|
-
n.
|
|
2146
|
-
n.
|
|
2147
|
-
n.
|
|
2148
|
-
const i = e !== undefined ? e : n.
|
|
2138
|
+
n.ue = (n.ue & ~CONFIG_AUTO_DISPOSE) | CONFIG_CHILDREN_FORBIDDEN;
|
|
2139
|
+
n.k = true;
|
|
2140
|
+
n.G = EFFECT_TRACKED;
|
|
2141
|
+
n.Me = (e, t) => {
|
|
2142
|
+
const i = e !== undefined ? e : n.fe;
|
|
2149
2143
|
if (i & STATUS_ERROR) {
|
|
2150
|
-
n.
|
|
2151
|
-
const e = t !== undefined ? t : n.
|
|
2152
|
-
if (!n.
|
|
2144
|
+
n.F.notify(n, STATUS_PENDING, 0);
|
|
2145
|
+
const e = t !== undefined ? t : n.ce;
|
|
2146
|
+
if (!n.F.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
2153
2147
|
}
|
|
2154
2148
|
};
|
|
2155
|
-
n.
|
|
2156
|
-
n.
|
|
2149
|
+
n.W = run;
|
|
2150
|
+
n.F.enqueue(EFFECT_USER, run);
|
|
2157
2151
|
cleanup(() => n.$e?.());
|
|
2158
2152
|
}
|
|
2159
2153
|
function restoreTransition(e, t) {
|
|
@@ -2168,11 +2162,11 @@ function action(e) {
|
|
|
2168
2162
|
const r = e(...t);
|
|
2169
2163
|
globalQueue.initTransition();
|
|
2170
2164
|
let o = activeTransition;
|
|
2171
|
-
o
|
|
2165
|
+
o.$.push(r);
|
|
2172
2166
|
const done = (e, t) => {
|
|
2173
2167
|
o = currentTransition(o);
|
|
2174
|
-
const s = o
|
|
2175
|
-
if (s >= 0) o
|
|
2168
|
+
const s = o.$.indexOf(r);
|
|
2169
|
+
if (s >= 0) o.$.splice(s, 1);
|
|
2176
2170
|
setActiveTransition(o);
|
|
2177
2171
|
schedule();
|
|
2178
2172
|
t ? i(t) : n(e);
|
|
@@ -2211,7 +2205,7 @@ function accessor(e) {
|
|
|
2211
2205
|
function createSignal(e, t) {
|
|
2212
2206
|
if (typeof e === "function") {
|
|
2213
2207
|
const n = computed(e, t);
|
|
2214
|
-
n.
|
|
2208
|
+
n.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
2215
2209
|
return [accessor(n), setMemo.bind(null, n)];
|
|
2216
2210
|
}
|
|
2217
2211
|
const n = signal(e, t);
|
|
@@ -2268,7 +2262,7 @@ function resolve(e) {
|
|
|
2268
2262
|
function createOptimistic(e, t) {
|
|
2269
2263
|
if (typeof e === "function") {
|
|
2270
2264
|
const n = optimisticComputed(e, t);
|
|
2271
|
-
n.
|
|
2265
|
+
n.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
2272
2266
|
return [accessor(n), setSignal.bind(null, n)];
|
|
2273
2267
|
}
|
|
2274
2268
|
const n = optimisticSignal(e, t);
|
|
@@ -2276,7 +2270,7 @@ function createOptimistic(e, t) {
|
|
|
2276
2270
|
}
|
|
2277
2271
|
function onSettled(e) {
|
|
2278
2272
|
const t = getOwner();
|
|
2279
|
-
t && !(t.
|
|
2273
|
+
t && !(t.ue & CONFIG_CHILDREN_FORBIDDEN)
|
|
2280
2274
|
? createTrackedEffect(() => untrack(e), undefined)
|
|
2281
2275
|
: globalQueue.enqueue(EFFECT_USER, () => {
|
|
2282
2276
|
const t = e();
|
|
@@ -2307,106 +2301,109 @@ function applyState(e, t, n) {
|
|
|
2307
2301
|
function applyStateFast(e, t, n) {
|
|
2308
2302
|
const i = t[STORE_VALUE];
|
|
2309
2303
|
if (e === i) return;
|
|
2304
|
+
const r = t[STORE_NODE];
|
|
2310
2305
|
(t[STORE_LOOKUP] || storeLookup).set(e, t[$PROXY]);
|
|
2311
2306
|
t[STORE_VALUE] = e;
|
|
2312
2307
|
if (Array.isArray(i)) {
|
|
2313
|
-
let
|
|
2314
|
-
const
|
|
2315
|
-
if (e.length &&
|
|
2316
|
-
let
|
|
2308
|
+
let o = false;
|
|
2309
|
+
const s = i.length;
|
|
2310
|
+
if (e.length && s && e[0] && n(e[0]) != null) {
|
|
2311
|
+
let u, c, l, a, f, E, T, S;
|
|
2317
2312
|
for (
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2313
|
+
l = 0, a = Math.min(s, e.length);
|
|
2314
|
+
l < a && ((E = i[l]) === e[l] || (E && e[l] && n(E) === n(e[l])));
|
|
2315
|
+
l++
|
|
2321
2316
|
) {
|
|
2322
|
-
applyState(e[
|
|
2317
|
+
applyState(e[l], wrap(E, t), n);
|
|
2323
2318
|
}
|
|
2324
|
-
const
|
|
2325
|
-
|
|
2319
|
+
const d = new Array(e.length),
|
|
2320
|
+
_ = new Map();
|
|
2326
2321
|
for (
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2322
|
+
a = s - 1, f = e.length - 1;
|
|
2323
|
+
a >= l && f >= l && ((E = i[a]) === e[f] || (E && e[f] && n(E) === n(e[f])));
|
|
2324
|
+
a--, f--
|
|
2330
2325
|
) {
|
|
2331
|
-
|
|
2326
|
+
d[f] = E;
|
|
2332
2327
|
}
|
|
2333
|
-
if (
|
|
2334
|
-
for (
|
|
2335
|
-
|
|
2336
|
-
|
|
2328
|
+
if (l > f || l > a) {
|
|
2329
|
+
for (c = l; c <= f; c++) {
|
|
2330
|
+
o = true;
|
|
2331
|
+
r?.[c] && setSignal(r[c], wrap(e[c], t));
|
|
2337
2332
|
}
|
|
2338
|
-
for (;
|
|
2339
|
-
|
|
2340
|
-
const i = wrap(
|
|
2341
|
-
|
|
2342
|
-
applyState(e[
|
|
2333
|
+
for (; c < e.length; c++) {
|
|
2334
|
+
o = true;
|
|
2335
|
+
const i = wrap(d[c], t);
|
|
2336
|
+
r?.[c] && setSignal(r[c], i);
|
|
2337
|
+
applyState(e[c], i, n);
|
|
2343
2338
|
}
|
|
2344
|
-
|
|
2345
|
-
|
|
2339
|
+
o && notifySelf(t);
|
|
2340
|
+
s !== e.length && r?.length && setSignal(r.length, e.length);
|
|
2346
2341
|
return;
|
|
2347
2342
|
}
|
|
2348
|
-
|
|
2349
|
-
for (
|
|
2350
|
-
|
|
2351
|
-
S =
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
}
|
|
2356
|
-
for (
|
|
2357
|
-
|
|
2358
|
-
S =
|
|
2359
|
-
|
|
2360
|
-
if (
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2343
|
+
T = new Array(f + 1);
|
|
2344
|
+
for (c = f; c >= l; c--) {
|
|
2345
|
+
E = e[c];
|
|
2346
|
+
S = E ? n(E) : E;
|
|
2347
|
+
u = _.get(S);
|
|
2348
|
+
T[c] = u === undefined ? -1 : u;
|
|
2349
|
+
_.set(S, c);
|
|
2350
|
+
}
|
|
2351
|
+
for (u = l; u <= a; u++) {
|
|
2352
|
+
E = i[u];
|
|
2353
|
+
S = E ? n(E) : E;
|
|
2354
|
+
c = _.get(S);
|
|
2355
|
+
if (c !== undefined && c !== -1) {
|
|
2356
|
+
d[c] = E;
|
|
2357
|
+
c = T[c];
|
|
2358
|
+
_.set(S, c);
|
|
2364
2359
|
}
|
|
2365
2360
|
}
|
|
2366
|
-
for (
|
|
2367
|
-
if (
|
|
2368
|
-
const i = wrap(
|
|
2369
|
-
|
|
2370
|
-
applyState(e[
|
|
2371
|
-
} else
|
|
2361
|
+
for (c = l; c < e.length; c++) {
|
|
2362
|
+
if (c in d) {
|
|
2363
|
+
const i = wrap(d[c], t);
|
|
2364
|
+
r?.[c] && setSignal(r[c], i);
|
|
2365
|
+
applyState(e[c], i, n);
|
|
2366
|
+
} else r?.[c] && setSignal(r[c], wrap(e[c], t));
|
|
2372
2367
|
}
|
|
2373
|
-
if (
|
|
2368
|
+
if (l < e.length) o = true;
|
|
2374
2369
|
} else if (e.length) {
|
|
2375
|
-
for (let
|
|
2376
|
-
const
|
|
2377
|
-
isWrappable(
|
|
2378
|
-
|
|
2379
|
-
|
|
2370
|
+
for (let s = 0, u = e.length; s < u; s++) {
|
|
2371
|
+
const u = i[s];
|
|
2372
|
+
if (isWrappable(u)) applyState(e[s], wrap(u, t), n);
|
|
2373
|
+
else {
|
|
2374
|
+
if (u !== e[s]) o = true;
|
|
2375
|
+
r?.[s] && setSignal(r[s], e[s]);
|
|
2376
|
+
}
|
|
2380
2377
|
}
|
|
2381
2378
|
}
|
|
2382
|
-
if (
|
|
2383
|
-
|
|
2384
|
-
|
|
2379
|
+
if (s !== e.length) {
|
|
2380
|
+
o = true;
|
|
2381
|
+
r?.length && setSignal(r.length, e.length);
|
|
2385
2382
|
}
|
|
2386
|
-
|
|
2383
|
+
o && notifySelf(t);
|
|
2387
2384
|
return;
|
|
2388
2385
|
}
|
|
2389
|
-
let
|
|
2390
|
-
if (
|
|
2391
|
-
const
|
|
2392
|
-
const s =
|
|
2386
|
+
let o = t[STORE_NODE];
|
|
2387
|
+
if (o) {
|
|
2388
|
+
const r = o[$TRACK];
|
|
2389
|
+
const s = r ? getAllKeys(i, undefined, e) : Object.keys(o);
|
|
2393
2390
|
for (let u = 0, c = s.length; u < c; u++) {
|
|
2394
2391
|
const c = s[u];
|
|
2395
|
-
const l =
|
|
2392
|
+
const l = o[c];
|
|
2396
2393
|
const a = unwrap(i[c]);
|
|
2397
2394
|
let f = unwrap(e[c]);
|
|
2398
2395
|
if (a === f) continue;
|
|
2399
2396
|
if (!a || !isWrappable(a) || !isWrappable(f) || (n(a) != null && n(a) !== n(f))) {
|
|
2400
|
-
|
|
2397
|
+
r && setSignal(r, void 0);
|
|
2401
2398
|
l && setSignal(l, isWrappable(f) ? wrap(f, t) : f);
|
|
2402
2399
|
} else applyState(f, wrap(a, t), n);
|
|
2403
2400
|
}
|
|
2404
2401
|
}
|
|
2405
|
-
if ((
|
|
2406
|
-
const t = Object.keys(
|
|
2402
|
+
if ((o = t[STORE_HAS])) {
|
|
2403
|
+
const t = Object.keys(o);
|
|
2407
2404
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
2408
2405
|
const i = t[n];
|
|
2409
|
-
setSignal(
|
|
2406
|
+
setSignal(o[i], i in e);
|
|
2410
2407
|
}
|
|
2411
2408
|
}
|
|
2412
2409
|
}
|
|
@@ -2419,82 +2416,86 @@ function applyStateSlow(e, t, n) {
|
|
|
2419
2416
|
t[STORE_VALUE] = e;
|
|
2420
2417
|
t[STORE_OVERRIDE] = undefined;
|
|
2421
2418
|
if (Array.isArray(i)) {
|
|
2422
|
-
let
|
|
2423
|
-
const
|
|
2424
|
-
if (e.length &&
|
|
2425
|
-
let
|
|
2419
|
+
let u = false;
|
|
2420
|
+
const c = getOverrideValue(i, r, "length", o);
|
|
2421
|
+
if (e.length && c && e[0] && n(e[0]) != null) {
|
|
2422
|
+
let l, a, f, E, T, S, d, _;
|
|
2426
2423
|
for (
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2424
|
+
f = 0, E = Math.min(c, e.length);
|
|
2425
|
+
f < E && ((S = getOverrideValue(i, r, f, o)) === e[f] || (S && e[f] && n(S) === n(e[f])));
|
|
2426
|
+
f++
|
|
2430
2427
|
) {
|
|
2431
|
-
applyState(e[
|
|
2428
|
+
applyState(e[f], wrap(S, t), n);
|
|
2432
2429
|
}
|
|
2433
|
-
const
|
|
2434
|
-
|
|
2430
|
+
const O = new Array(e.length),
|
|
2431
|
+
R = new Map();
|
|
2435
2432
|
for (
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
((S = getOverrideValue(i, r,
|
|
2440
|
-
|
|
2433
|
+
E = c - 1, T = e.length - 1;
|
|
2434
|
+
E >= f &&
|
|
2435
|
+
T >= f &&
|
|
2436
|
+
((S = getOverrideValue(i, r, E, o)) === e[T] || (S && e[T] && n(S) === n(e[T])));
|
|
2437
|
+
E--, T--
|
|
2441
2438
|
) {
|
|
2442
|
-
|
|
2439
|
+
O[T] = S;
|
|
2443
2440
|
}
|
|
2444
|
-
if (
|
|
2445
|
-
for (
|
|
2446
|
-
|
|
2447
|
-
|
|
2441
|
+
if (f > T || f > E) {
|
|
2442
|
+
for (a = f; a <= T; a++) {
|
|
2443
|
+
u = true;
|
|
2444
|
+
s?.[a] && setSignal(s[a], wrap(e[a], t));
|
|
2448
2445
|
}
|
|
2449
|
-
for (;
|
|
2450
|
-
|
|
2451
|
-
const i = wrap(
|
|
2452
|
-
|
|
2453
|
-
applyState(e[
|
|
2446
|
+
for (; a < e.length; a++) {
|
|
2447
|
+
u = true;
|
|
2448
|
+
const i = wrap(O[a], t);
|
|
2449
|
+
s?.[a] && setSignal(s[a], i);
|
|
2450
|
+
applyState(e[a], i, n);
|
|
2454
2451
|
}
|
|
2455
|
-
|
|
2456
|
-
u
|
|
2452
|
+
const i = e.length;
|
|
2453
|
+
u && notifySelf(t);
|
|
2454
|
+
c !== i && s?.length && setSignal(s.length, i);
|
|
2457
2455
|
return;
|
|
2458
2456
|
}
|
|
2459
|
-
|
|
2460
|
-
for (
|
|
2461
|
-
S = e[
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
}
|
|
2467
|
-
for (
|
|
2468
|
-
S = getOverrideValue(i, r,
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
if (
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2457
|
+
d = new Array(T + 1);
|
|
2458
|
+
for (a = T; a >= f; a--) {
|
|
2459
|
+
S = e[a];
|
|
2460
|
+
_ = S ? n(S) : S;
|
|
2461
|
+
l = R.get(_);
|
|
2462
|
+
d[a] = l === undefined ? -1 : l;
|
|
2463
|
+
R.set(_, a);
|
|
2464
|
+
}
|
|
2465
|
+
for (l = f; l <= E; l++) {
|
|
2466
|
+
S = getOverrideValue(i, r, l, o);
|
|
2467
|
+
_ = S ? n(S) : S;
|
|
2468
|
+
a = R.get(_);
|
|
2469
|
+
if (a !== undefined && a !== -1) {
|
|
2470
|
+
O[a] = S;
|
|
2471
|
+
a = d[a];
|
|
2472
|
+
R.set(_, a);
|
|
2475
2473
|
}
|
|
2476
2474
|
}
|
|
2477
|
-
for (
|
|
2478
|
-
if (
|
|
2479
|
-
const i = wrap(
|
|
2480
|
-
|
|
2481
|
-
applyState(e[
|
|
2482
|
-
} else
|
|
2475
|
+
for (a = f; a < e.length; a++) {
|
|
2476
|
+
if (a in O) {
|
|
2477
|
+
const i = wrap(O[a], t);
|
|
2478
|
+
s?.[a] && setSignal(s[a], i);
|
|
2479
|
+
applyState(e[a], i, n);
|
|
2480
|
+
} else s?.[a] && setSignal(s[a], wrap(e[a], t));
|
|
2483
2481
|
}
|
|
2484
|
-
if (
|
|
2482
|
+
if (f < e.length) u = true;
|
|
2485
2483
|
} else if (e.length) {
|
|
2486
|
-
for (let
|
|
2487
|
-
const
|
|
2488
|
-
isWrappable(
|
|
2489
|
-
|
|
2490
|
-
|
|
2484
|
+
for (let c = 0, l = e.length; c < l; c++) {
|
|
2485
|
+
const l = getOverrideValue(i, r, c, o);
|
|
2486
|
+
if (isWrappable(l)) applyState(e[c], wrap(l, t), n);
|
|
2487
|
+
else {
|
|
2488
|
+
if (l !== e[c]) u = true;
|
|
2489
|
+
s?.[c] && setSignal(s[c], e[c]);
|
|
2490
|
+
}
|
|
2491
2491
|
}
|
|
2492
2492
|
}
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2493
|
+
const l = e.length;
|
|
2494
|
+
if (c !== l) {
|
|
2495
|
+
u = true;
|
|
2496
|
+
s?.length && setSignal(s.length, l);
|
|
2496
2497
|
}
|
|
2497
|
-
|
|
2498
|
+
u && notifySelf(t);
|
|
2498
2499
|
return;
|
|
2499
2500
|
}
|
|
2500
2501
|
if (s) {
|
|
@@ -2504,12 +2505,12 @@ function applyStateSlow(e, t, n) {
|
|
|
2504
2505
|
const a = c[l];
|
|
2505
2506
|
const f = s[a];
|
|
2506
2507
|
const E = unwrap(getOverrideValue(i, r, a, o));
|
|
2507
|
-
let
|
|
2508
|
-
if (E ===
|
|
2509
|
-
if (!E || !isWrappable(E) || !isWrappable(
|
|
2508
|
+
let T = unwrap(e[a]);
|
|
2509
|
+
if (E === T) continue;
|
|
2510
|
+
if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
|
|
2510
2511
|
u && setSignal(u, void 0);
|
|
2511
|
-
f && setSignal(f, isWrappable(
|
|
2512
|
-
} else applyState(
|
|
2512
|
+
f && setSignal(f, isWrappable(T) ? wrap(T, t) : T);
|
|
2513
|
+
} else applyState(T, wrap(E, t), n);
|
|
2513
2514
|
}
|
|
2514
2515
|
}
|
|
2515
2516
|
if ((s = t[STORE_HAS])) {
|
|
@@ -2525,7 +2526,7 @@ function reconcile(e, t) {
|
|
|
2525
2526
|
if (n == null) throw new Error("Cannot reconcile null or undefined state");
|
|
2526
2527
|
const i = typeof t === "string" ? e => e[t] : t;
|
|
2527
2528
|
const r = i(n);
|
|
2528
|
-
if (r !== undefined && i(e) !==
|
|
2529
|
+
if (r !== undefined && i(e) !== r)
|
|
2529
2530
|
throw new Error("Cannot reconcile states with different identity");
|
|
2530
2531
|
applyState(e, n, i);
|
|
2531
2532
|
};
|
|
@@ -2555,45 +2556,46 @@ function createProjectionInternal(e, t, n) {
|
|
|
2555
2556
|
if (!i) i = getOwner();
|
|
2556
2557
|
runProjectionComputed(o, e, n?.key || "id");
|
|
2557
2558
|
}, undefined);
|
|
2558
|
-
i.
|
|
2559
|
+
i.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
2559
2560
|
return { store: o, node: i };
|
|
2560
2561
|
}
|
|
2561
2562
|
function createProjection(e, t, n) {
|
|
2562
2563
|
return createProjectionInternal(e, t, n).store;
|
|
2563
2564
|
}
|
|
2564
|
-
function runProjectionComputed(e, t, n, i) {
|
|
2565
|
-
const
|
|
2566
|
-
let
|
|
2567
|
-
let
|
|
2568
|
-
const
|
|
2565
|
+
function runProjectionComputed(e, t, n, i, r) {
|
|
2566
|
+
const o = getOwner();
|
|
2567
|
+
let s = false;
|
|
2568
|
+
let u;
|
|
2569
|
+
const c = new Proxy(
|
|
2569
2570
|
e,
|
|
2570
|
-
createWriteTraps(() => !
|
|
2571
|
+
createWriteTraps(() => !s || o.ve === u, r)
|
|
2571
2572
|
);
|
|
2572
|
-
storeSetter(
|
|
2573
|
-
|
|
2574
|
-
|
|
2573
|
+
storeSetter(c, r => {
|
|
2574
|
+
u = t(r);
|
|
2575
|
+
s = true;
|
|
2575
2576
|
const commit = t => {
|
|
2576
|
-
if (t ===
|
|
2577
|
+
if (t === r || t === undefined) return;
|
|
2577
2578
|
const write = () => storeSetter(e, reconcile(t, n));
|
|
2578
2579
|
i ? i(write) : write();
|
|
2579
2580
|
};
|
|
2580
|
-
commit(handleAsync(
|
|
2581
|
+
commit(handleAsync(o, u, commit));
|
|
2581
2582
|
});
|
|
2582
|
-
return
|
|
2583
|
+
return o;
|
|
2583
2584
|
}
|
|
2584
|
-
function createWriteTraps(e) {
|
|
2585
|
-
const
|
|
2586
|
-
get(e,
|
|
2585
|
+
function createWriteTraps(e, t) {
|
|
2586
|
+
const n = {
|
|
2587
|
+
get(e, t) {
|
|
2587
2588
|
let i;
|
|
2588
2589
|
setWriteOverride(true);
|
|
2589
2590
|
setProjectionWriteActive(true);
|
|
2590
2591
|
try {
|
|
2591
|
-
i = e[
|
|
2592
|
+
i = e[t];
|
|
2592
2593
|
} finally {
|
|
2593
2594
|
setWriteOverride(false);
|
|
2594
2595
|
setProjectionWriteActive(false);
|
|
2595
2596
|
}
|
|
2596
|
-
|
|
2597
|
+
if (t === $TARGET) return i;
|
|
2598
|
+
return typeof i === "object" && i !== null ? new Proxy(i, n) : i;
|
|
2597
2599
|
},
|
|
2598
2600
|
has(e, t) {
|
|
2599
2601
|
let n;
|
|
@@ -2607,24 +2609,26 @@ function createWriteTraps(e) {
|
|
|
2607
2609
|
}
|
|
2608
2610
|
return n;
|
|
2609
2611
|
},
|
|
2610
|
-
set(
|
|
2612
|
+
set(n, i, r) {
|
|
2611
2613
|
if (e && !e()) return true;
|
|
2612
2614
|
setWriteOverride(true);
|
|
2613
2615
|
setProjectionWriteActive(true);
|
|
2614
2616
|
try {
|
|
2615
|
-
|
|
2617
|
+
n[i] = r;
|
|
2618
|
+
t?.();
|
|
2616
2619
|
} finally {
|
|
2617
2620
|
setWriteOverride(false);
|
|
2618
2621
|
setProjectionWriteActive(false);
|
|
2619
2622
|
}
|
|
2620
2623
|
return true;
|
|
2621
2624
|
},
|
|
2622
|
-
deleteProperty(
|
|
2625
|
+
deleteProperty(n, i) {
|
|
2623
2626
|
if (e && !e()) return true;
|
|
2624
2627
|
setWriteOverride(true);
|
|
2625
2628
|
setProjectionWriteActive(true);
|
|
2626
2629
|
try {
|
|
2627
|
-
delete
|
|
2630
|
+
delete n[i];
|
|
2631
|
+
t?.();
|
|
2628
2632
|
} finally {
|
|
2629
2633
|
setWriteOverride(false);
|
|
2630
2634
|
setProjectionWriteActive(false);
|
|
@@ -2632,7 +2636,7 @@ function createWriteTraps(e) {
|
|
|
2632
2636
|
return true;
|
|
2633
2637
|
}
|
|
2634
2638
|
};
|
|
2635
|
-
return
|
|
2639
|
+
return n;
|
|
2636
2640
|
}
|
|
2637
2641
|
const $TRACK = Symbol(0),
|
|
2638
2642
|
$TARGET = Symbol(0),
|
|
@@ -2648,6 +2652,7 @@ const STORE_VALUE = "v",
|
|
|
2648
2652
|
STORE_LOOKUP = "l",
|
|
2649
2653
|
STORE_FIREWALL = "f",
|
|
2650
2654
|
STORE_OPTIMISTIC = "p";
|
|
2655
|
+
const STORE_SELF_PENDING = Symbol(0);
|
|
2651
2656
|
function createStoreProxy(e, t = storeTraps, n) {
|
|
2652
2657
|
let i;
|
|
2653
2658
|
if (Array.isArray(e)) {
|
|
@@ -2682,8 +2687,25 @@ function setWriteOverride(e) {
|
|
|
2682
2687
|
function writeOnly(e) {
|
|
2683
2688
|
return writeOverride || !!Writing?.has(e);
|
|
2684
2689
|
}
|
|
2685
|
-
function unwrapStoreValue(e) {
|
|
2686
|
-
|
|
2690
|
+
function unwrapStoreValue(e, t, n) {
|
|
2691
|
+
const i = e?.[$TARGET] || n?.get(e)?.[$TARGET];
|
|
2692
|
+
if (!i) return e;
|
|
2693
|
+
const r = i[STORE_OVERRIDE];
|
|
2694
|
+
if (!r) return i[STORE_VALUE];
|
|
2695
|
+
if (!t) t = new Map();
|
|
2696
|
+
if (t.has(e)) return t.get(e);
|
|
2697
|
+
const o = i[STORE_VALUE];
|
|
2698
|
+
const s = Array.isArray(o);
|
|
2699
|
+
const u = s ? [] : Object.create(Object.getPrototypeOf(o));
|
|
2700
|
+
t.set(e, u);
|
|
2701
|
+
n = i[STORE_LOOKUP] ?? storeLookup;
|
|
2702
|
+
for (const e of getKeys(o, r)) {
|
|
2703
|
+
if (s && e === "length") continue;
|
|
2704
|
+
const i = e in r ? r[e] : o[e];
|
|
2705
|
+
if (i !== $DELETED) u[e] = unwrapStoreValue(i, t, n);
|
|
2706
|
+
}
|
|
2707
|
+
if (s) u.length = r.length ?? o.length;
|
|
2708
|
+
return u;
|
|
2687
2709
|
}
|
|
2688
2710
|
function isPrototypePollutionKey$1(e) {
|
|
2689
2711
|
return e === "__proto__" || e === "constructor" || e === "prototype";
|
|
@@ -2722,11 +2744,11 @@ function getNode(e, t, n, i, r = isEqual, o, s) {
|
|
|
2722
2744
|
i
|
|
2723
2745
|
);
|
|
2724
2746
|
if (o) {
|
|
2725
|
-
u.
|
|
2747
|
+
u.R = NOT_PENDING;
|
|
2726
2748
|
}
|
|
2727
2749
|
if (s && t in s) {
|
|
2728
2750
|
const e = s[t];
|
|
2729
|
-
u.
|
|
2751
|
+
u.ae = e === undefined ? NO_SNAPSHOT : e;
|
|
2730
2752
|
snapshotSources?.add(u);
|
|
2731
2753
|
}
|
|
2732
2754
|
return (e[t] = u);
|
|
@@ -2737,6 +2759,10 @@ function trackSelf(e, t = $TRACK) {
|
|
|
2737
2759
|
getNode(getNodes(e, STORE_NODE), t, undefined, e[STORE_FIREWALL], false, e[STORE_OPTIMISTIC])
|
|
2738
2760
|
);
|
|
2739
2761
|
}
|
|
2762
|
+
function notifySelf(e) {
|
|
2763
|
+
const t = e[STORE_NODE]?.[$TRACK];
|
|
2764
|
+
t && setSignal(t, e[STORE_OPTIMISTIC] && !projectionWriteActive ? STORE_SELF_PENDING : undefined);
|
|
2765
|
+
}
|
|
2740
2766
|
function getKeys(e, t, n = true) {
|
|
2741
2767
|
const i = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
|
|
2742
2768
|
if (!t) return i;
|
|
@@ -2759,8 +2785,8 @@ function getPropertyDescriptor(e, t, n) {
|
|
|
2759
2785
|
function prepareStoreWrite(e, t, n) {
|
|
2760
2786
|
if (e[STORE_OPTIMISTIC]) {
|
|
2761
2787
|
const t = e[STORE_FIREWALL];
|
|
2762
|
-
if (t?.
|
|
2763
|
-
globalQueue.initTransition(t.
|
|
2788
|
+
if (t?.S) {
|
|
2789
|
+
globalQueue.initTransition(t.S);
|
|
2764
2790
|
}
|
|
2765
2791
|
}
|
|
2766
2792
|
const i = e[STORE_VALUE];
|
|
@@ -2768,7 +2794,7 @@ function prepareStoreWrite(e, t, n) {
|
|
|
2768
2794
|
if (
|
|
2769
2795
|
snapshotCaptureActive &&
|
|
2770
2796
|
typeof n !== "symbol" &&
|
|
2771
|
-
!((e[STORE_FIREWALL]?.
|
|
2797
|
+
!((e[STORE_FIREWALL]?.fe ?? 0) & STATUS_PENDING)
|
|
2772
2798
|
) {
|
|
2773
2799
|
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2774
2800
|
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
@@ -2821,7 +2847,7 @@ function notifyStoreProperty(e, t, n, i, r, o) {
|
|
|
2821
2847
|
setSignal(n, undefined);
|
|
2822
2848
|
}
|
|
2823
2849
|
}
|
|
2824
|
-
|
|
2850
|
+
notifySelf(e);
|
|
2825
2851
|
}
|
|
2826
2852
|
let Writing = null;
|
|
2827
2853
|
const storeTraps = {
|
|
@@ -2833,73 +2859,75 @@ const storeTraps = {
|
|
|
2833
2859
|
trackSelf(e);
|
|
2834
2860
|
return n;
|
|
2835
2861
|
}
|
|
2836
|
-
const i =
|
|
2837
|
-
const r =
|
|
2838
|
-
const o =
|
|
2862
|
+
const i = getObserver() === e[STORE_FIREWALL];
|
|
2863
|
+
const r = getNodes(e, STORE_NODE);
|
|
2864
|
+
const o = i ? undefined : r[t];
|
|
2865
|
+
const s = e[STORE_VALUE];
|
|
2839
2866
|
if (
|
|
2840
|
-
!
|
|
2867
|
+
!o &&
|
|
2841
2868
|
!e[STORE_OVERRIDE] &&
|
|
2842
2869
|
!e[STORE_OPTIMISTIC_OVERRIDE] &&
|
|
2843
2870
|
!e[STORE_CUSTOM_PROTO] &&
|
|
2844
2871
|
!e[STORE_OPTIMISTIC] &&
|
|
2845
2872
|
!e[STORE_SNAPSHOT_PROPS] &&
|
|
2846
|
-
!
|
|
2847
|
-
!(t in
|
|
2873
|
+
!s[$TARGET] &&
|
|
2874
|
+
!(t in s) &&
|
|
2848
2875
|
getObserver() &&
|
|
2876
|
+
!i &&
|
|
2849
2877
|
!writeOnly(n)
|
|
2850
2878
|
) {
|
|
2851
|
-
return read(getNode(
|
|
2879
|
+
return read(getNode(r, t, undefined, e[STORE_FIREWALL]));
|
|
2852
2880
|
}
|
|
2853
|
-
const
|
|
2854
|
-
const
|
|
2855
|
-
const
|
|
2856
|
-
const
|
|
2881
|
+
const u = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
|
|
2882
|
+
const c = u || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
|
|
2883
|
+
const l = !!e[STORE_VALUE][$TARGET];
|
|
2884
|
+
const a = u
|
|
2857
2885
|
? e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2858
2886
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2859
2887
|
? e[STORE_OVERRIDE]
|
|
2860
2888
|
: e[STORE_VALUE];
|
|
2861
|
-
if (!
|
|
2862
|
-
const i = Object.getOwnPropertyDescriptor(
|
|
2889
|
+
if (!o) {
|
|
2890
|
+
const i = Object.getOwnPropertyDescriptor(a, t);
|
|
2863
2891
|
if (i && i.get) return i.get.call(n);
|
|
2864
|
-
if (!i && !
|
|
2865
|
-
const e = unwrapStoreValue(
|
|
2892
|
+
if (!i && !c && e[STORE_CUSTOM_PROTO]) {
|
|
2893
|
+
const e = unwrapStoreValue(a);
|
|
2866
2894
|
if (hasInheritedAccessor(e, t)) {
|
|
2867
|
-
return Reflect.get(
|
|
2895
|
+
return Reflect.get(a, t, n);
|
|
2868
2896
|
}
|
|
2869
2897
|
}
|
|
2870
2898
|
}
|
|
2871
2899
|
if (writeOnly(n)) {
|
|
2872
2900
|
if (isPrototypePollutionKey$1(t) && !hasOwnStoreProperty(e, t)) return undefined;
|
|
2873
2901
|
let n =
|
|
2874
|
-
|
|
2875
|
-
?
|
|
2876
|
-
?
|
|
2877
|
-
:
|
|
2878
|
-
?
|
|
2879
|
-
:
|
|
2880
|
-
:
|
|
2902
|
+
o && (c || !l)
|
|
2903
|
+
? o.R !== undefined && o.R !== NOT_PENDING
|
|
2904
|
+
? o.R
|
|
2905
|
+
: o.m !== NOT_PENDING
|
|
2906
|
+
? o.m
|
|
2907
|
+
: o.Z
|
|
2908
|
+
: a[t];
|
|
2881
2909
|
n === $DELETED && (n = undefined);
|
|
2882
2910
|
if (!isWrappable(n)) return n;
|
|
2883
2911
|
const i = wrap(n, e);
|
|
2884
2912
|
Writing?.add(i);
|
|
2885
2913
|
return i;
|
|
2886
2914
|
}
|
|
2887
|
-
let
|
|
2888
|
-
|
|
2889
|
-
if (!
|
|
2890
|
-
if (!
|
|
2915
|
+
let f = o ? (c || !l ? read(r[t]) : (read(r[t]), a[t])) : a[t];
|
|
2916
|
+
f === $DELETED && (f = undefined);
|
|
2917
|
+
if (!o) {
|
|
2918
|
+
if (!c && typeof f === "function" && !a.hasOwnProperty(t)) {
|
|
2891
2919
|
let t;
|
|
2892
2920
|
return !Array.isArray(e[STORE_VALUE]) &&
|
|
2893
2921
|
(t = Object.getPrototypeOf(e[STORE_VALUE])) &&
|
|
2894
2922
|
t !== Object.prototype
|
|
2895
|
-
?
|
|
2896
|
-
:
|
|
2897
|
-
} else if (getObserver()) {
|
|
2923
|
+
? f.bind(a)
|
|
2924
|
+
: f;
|
|
2925
|
+
} else if (getObserver() && !i) {
|
|
2898
2926
|
return read(
|
|
2899
2927
|
getNode(
|
|
2900
|
-
|
|
2928
|
+
r,
|
|
2901
2929
|
t,
|
|
2902
|
-
isWrappable(
|
|
2930
|
+
isWrappable(f) ? wrap(f, e) : f,
|
|
2903
2931
|
e[STORE_FIREWALL],
|
|
2904
2932
|
isEqual,
|
|
2905
2933
|
e[STORE_OPTIMISTIC],
|
|
@@ -2908,7 +2936,7 @@ const storeTraps = {
|
|
|
2908
2936
|
);
|
|
2909
2937
|
}
|
|
2910
2938
|
}
|
|
2911
|
-
return isWrappable(
|
|
2939
|
+
return isWrappable(f) ? wrap(f, e) : f;
|
|
2912
2940
|
},
|
|
2913
2941
|
has(e, t) {
|
|
2914
2942
|
if (t === $PROXY || t === $TRACK || t === "__proto__") return true;
|
|
@@ -2918,7 +2946,7 @@ const storeTraps = {
|
|
|
2918
2946
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2919
2947
|
? e[STORE_OVERRIDE][t] !== $DELETED
|
|
2920
2948
|
: t in e[STORE_VALUE];
|
|
2921
|
-
if (writeOnly(e[$PROXY])) return n;
|
|
2949
|
+
if (writeOnly(e[$PROXY]) || getObserver() === e[STORE_FIREWALL]) return n;
|
|
2922
2950
|
const i = getNodes(e, STORE_HAS);
|
|
2923
2951
|
if (i[t]) return read(i[t]);
|
|
2924
2952
|
if (getObserver()) {
|
|
@@ -2954,22 +2982,22 @@ const storeTraps = {
|
|
|
2954
2982
|
: e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
|
|
2955
2983
|
? e[STORE_OVERRIDE].length
|
|
2956
2984
|
: s.length);
|
|
2957
|
-
const
|
|
2958
|
-
if (u === l &&
|
|
2959
|
-
if (l !== undefined && l === r &&
|
|
2985
|
+
const T = a && f > E ? f : undefined;
|
|
2986
|
+
if (u === l && T === undefined) return true;
|
|
2987
|
+
if (l !== undefined && l === r && T === undefined) delete e[o]?.[t];
|
|
2960
2988
|
else {
|
|
2961
2989
|
const n = e[o] || (e[o] = Object.create(null));
|
|
2962
2990
|
n[t] = l;
|
|
2963
|
-
if (
|
|
2991
|
+
if (T !== undefined) n.length = T;
|
|
2964
2992
|
}
|
|
2965
2993
|
notifyStoreProperty(e, t, "set", l, u, c);
|
|
2966
|
-
if (Array.isArray(s) && t !== "length" &&
|
|
2994
|
+
if (Array.isArray(s) && t !== "length" && T !== undefined) {
|
|
2967
2995
|
const t = getNodes(e, STORE_NODE);
|
|
2968
2996
|
if (t.length) {
|
|
2969
|
-
setSignal(t.length,
|
|
2997
|
+
setSignal(t.length, T);
|
|
2970
2998
|
} else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
|
|
2971
2999
|
const n = upsertStoreNode(e, t, "length", E, e[STORE_SNAPSHOT_PROPS]);
|
|
2972
|
-
setSignal(n,
|
|
3000
|
+
setSignal(n, T);
|
|
2973
3001
|
}
|
|
2974
3002
|
}
|
|
2975
3003
|
if (false);
|
|
@@ -3017,7 +3045,7 @@ const storeTraps = {
|
|
|
3017
3045
|
return true;
|
|
3018
3046
|
},
|
|
3019
3047
|
ownKeys(e) {
|
|
3020
|
-
trackSelf(e);
|
|
3048
|
+
if (getObserver() !== e[STORE_FIREWALL]) trackSelf(e);
|
|
3021
3049
|
let t = getKeys(e[STORE_VALUE], e[STORE_OVERRIDE], false);
|
|
3022
3050
|
if (e[STORE_OPTIMISTIC_OVERRIDE]) {
|
|
3023
3051
|
const n = new Set(t);
|
|
@@ -3080,11 +3108,16 @@ function createStore(e, t, n) {
|
|
|
3080
3108
|
r = i ? createProjectionInternal(e, t, n).store : wrap(e);
|
|
3081
3109
|
return [
|
|
3082
3110
|
r,
|
|
3083
|
-
i
|
|
3111
|
+
i
|
|
3112
|
+
? e => {
|
|
3113
|
+
suppressComputedRecompute(r[$REFRESH]);
|
|
3114
|
+
storeSetter(r, e);
|
|
3115
|
+
}
|
|
3116
|
+
: e => storeSetter(r, e)
|
|
3084
3117
|
];
|
|
3085
3118
|
}
|
|
3086
3119
|
function createOptimisticStore(e, t, n) {
|
|
3087
|
-
GlobalQueue.
|
|
3120
|
+
GlobalQueue.re ||= clearOptimisticStore;
|
|
3088
3121
|
const i = typeof e === "function";
|
|
3089
3122
|
const r = i ? t : e;
|
|
3090
3123
|
const o = i ? e : undefined;
|
|
@@ -3094,29 +3127,44 @@ function createOptimisticStore(e, t, n) {
|
|
|
3094
3127
|
function clearOptimisticStore(e) {
|
|
3095
3128
|
const t = e[$TARGET];
|
|
3096
3129
|
if (!t || !t[STORE_OPTIMISTIC_OVERRIDE]) return;
|
|
3097
|
-
|
|
3098
|
-
|
|
3130
|
+
clearOptimisticOverride(t);
|
|
3131
|
+
}
|
|
3132
|
+
function clearOptimisticOverride(e) {
|
|
3133
|
+
const t = e[STORE_OPTIMISTIC_OVERRIDE];
|
|
3134
|
+
if (!t) return;
|
|
3135
|
+
const n = e[STORE_NODE];
|
|
3136
|
+
delete e[STORE_OPTIMISTIC_OVERRIDE];
|
|
3137
|
+
const i = projectionWriteActive;
|
|
3099
3138
|
setProjectionWriteActive(true);
|
|
3100
3139
|
try {
|
|
3101
|
-
if (
|
|
3102
|
-
for (const
|
|
3103
|
-
if (i
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3140
|
+
if (n) {
|
|
3141
|
+
for (const i of Reflect.ownKeys(t)) {
|
|
3142
|
+
if (n[i]) {
|
|
3143
|
+
const t = n[i];
|
|
3144
|
+
t.i = undefined;
|
|
3145
|
+
const r =
|
|
3146
|
+
e[STORE_OVERRIDE] && i in e[STORE_OVERRIDE] ? e[STORE_OVERRIDE][i] : e[STORE_VALUE][i];
|
|
3147
|
+
const o = r === $DELETED ? undefined : r;
|
|
3148
|
+
const s = isWrappable(o) ? wrap(o, e) : o;
|
|
3149
|
+
const u =
|
|
3150
|
+
t.R !== undefined && t.R !== NOT_PENDING ? t.R : t.m !== NOT_PENDING ? t.m : t.Z;
|
|
3151
|
+
t.R = NOT_PENDING;
|
|
3152
|
+
t.m = NOT_PENDING;
|
|
3153
|
+
t.Z = s;
|
|
3154
|
+
if (!t.ke || !t.ke(u, s)) {
|
|
3155
|
+
insertSubs(t, true);
|
|
3156
|
+
schedule();
|
|
3157
|
+
}
|
|
3109
3158
|
}
|
|
3110
3159
|
}
|
|
3111
|
-
if (
|
|
3112
|
-
|
|
3113
|
-
|
|
3160
|
+
if (n[$TRACK]) {
|
|
3161
|
+
n[$TRACK].i = undefined;
|
|
3162
|
+
notifySelf(e);
|
|
3114
3163
|
}
|
|
3115
3164
|
}
|
|
3116
3165
|
} finally {
|
|
3117
|
-
setProjectionWriteActive(
|
|
3166
|
+
setProjectionWriteActive(i);
|
|
3118
3167
|
}
|
|
3119
|
-
delete t[STORE_OPTIMISTIC_OVERRIDE];
|
|
3120
3168
|
}
|
|
3121
3169
|
function createOptimisticProjectionInternal(e, t, n) {
|
|
3122
3170
|
let i;
|
|
@@ -3141,23 +3189,29 @@ function createOptimisticProjectionInternal(e, t, n) {
|
|
|
3141
3189
|
};
|
|
3142
3190
|
const o = wrapProjection(t);
|
|
3143
3191
|
if (e) {
|
|
3192
|
+
const clearProjectionOverride = () => {
|
|
3193
|
+
const e = o[$TARGET];
|
|
3194
|
+
if (e?.[STORE_OPTIMISTIC_OVERRIDE]) clearOptimisticOverride(e);
|
|
3195
|
+
};
|
|
3144
3196
|
const wrapCommit = e => {
|
|
3197
|
+
const t = projectionWriteActive;
|
|
3145
3198
|
setProjectionWriteActive(true);
|
|
3146
3199
|
try {
|
|
3147
3200
|
e();
|
|
3201
|
+
clearProjectionOverride();
|
|
3148
3202
|
} finally {
|
|
3149
|
-
setProjectionWriteActive(
|
|
3203
|
+
setProjectionWriteActive(t);
|
|
3150
3204
|
}
|
|
3151
3205
|
};
|
|
3152
3206
|
i = computed(() => {
|
|
3153
3207
|
setProjectionWriteActive(true);
|
|
3154
3208
|
try {
|
|
3155
|
-
runProjectionComputed(o, e, n?.key || "id", wrapCommit);
|
|
3209
|
+
runProjectionComputed(o, e, n?.key || "id", wrapCommit, clearProjectionOverride);
|
|
3156
3210
|
} finally {
|
|
3157
3211
|
setProjectionWriteActive(false);
|
|
3158
3212
|
}
|
|
3159
3213
|
}, undefined);
|
|
3160
|
-
i.
|
|
3214
|
+
i.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
3161
3215
|
}
|
|
3162
3216
|
return { store: o, node: i };
|
|
3163
3217
|
}
|
|
@@ -3247,13 +3301,13 @@ function snapshotImpl(e, t, n, i) {
|
|
|
3247
3301
|
s ? (u = o ? [] : Object.create(Object.getPrototypeOf(r[STORE_VALUE]))) : r[STORE_VALUE]
|
|
3248
3302
|
);
|
|
3249
3303
|
e = r[STORE_VALUE];
|
|
3250
|
-
i = storeLookup;
|
|
3304
|
+
i = r[STORE_LOOKUP] ?? storeLookup;
|
|
3251
3305
|
} else {
|
|
3252
3306
|
o = Array.isArray(e);
|
|
3253
3307
|
n.set(e, e);
|
|
3254
3308
|
}
|
|
3255
3309
|
if (o) {
|
|
3256
|
-
const o = s?.length
|
|
3310
|
+
const o = s?.length ?? e.length;
|
|
3257
3311
|
for (let a = 0; a < o; a++) {
|
|
3258
3312
|
l = s && a in s ? s[a] : e[a];
|
|
3259
3313
|
if (l === $DELETED) continue;
|
|
@@ -3429,8 +3483,8 @@ function mapArray(e, t, n) {
|
|
|
3429
3483
|
const o = t;
|
|
3430
3484
|
const s = {
|
|
3431
3485
|
Ze: createOwner(),
|
|
3432
|
-
|
|
3433
|
-
|
|
3486
|
+
Be: 0,
|
|
3487
|
+
qe: e,
|
|
3434
3488
|
ze: [],
|
|
3435
3489
|
Xe: o,
|
|
3436
3490
|
Je: [],
|
|
@@ -3442,13 +3496,13 @@ function mapArray(e, t, n) {
|
|
|
3442
3496
|
ot: n?.fallback
|
|
3443
3497
|
};
|
|
3444
3498
|
const u = computed(updateKeyedMap.bind(s));
|
|
3445
|
-
s.Ze.
|
|
3446
|
-
u.
|
|
3499
|
+
s.Ze.he = u;
|
|
3500
|
+
u.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
3447
3501
|
return accessor(u);
|
|
3448
3502
|
}
|
|
3449
3503
|
const pureOptions = { ownedWrite: true };
|
|
3450
3504
|
function updateKeyedMap() {
|
|
3451
|
-
const e = this.
|
|
3505
|
+
const e = this.qe() || [],
|
|
3452
3506
|
t = e.length;
|
|
3453
3507
|
e[$TRACK];
|
|
3454
3508
|
runWithOwner(this.Ze, () => {
|
|
@@ -3476,26 +3530,26 @@ function updateKeyedMap() {
|
|
|
3476
3530
|
return this.Xe(t);
|
|
3477
3531
|
};
|
|
3478
3532
|
if (t === 0) {
|
|
3479
|
-
if (this.
|
|
3533
|
+
if (this.Be !== 0) {
|
|
3480
3534
|
this.Ze.dispose(false);
|
|
3481
3535
|
this.et = [];
|
|
3482
3536
|
this.ze = [];
|
|
3483
3537
|
this.Je = [];
|
|
3484
|
-
this.
|
|
3538
|
+
this.Be = 0;
|
|
3485
3539
|
this.nt && (this.nt = []);
|
|
3486
3540
|
this.it && (this.it = []);
|
|
3487
3541
|
}
|
|
3488
3542
|
if (this.ot && !this.Je[0]) {
|
|
3489
3543
|
this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.ot);
|
|
3490
3544
|
}
|
|
3491
|
-
} else if (this.
|
|
3545
|
+
} else if (this.Be === 0) {
|
|
3492
3546
|
if (this.et[0]) this.et[0].dispose();
|
|
3493
3547
|
this.Je = new Array(t);
|
|
3494
3548
|
for (i = 0; i < t; i++) {
|
|
3495
3549
|
this.ze[i] = e[i];
|
|
3496
3550
|
this.Je[i] = runWithOwner((this.et[i] = createOwner()), r);
|
|
3497
3551
|
}
|
|
3498
|
-
this.
|
|
3552
|
+
this.Be = t;
|
|
3499
3553
|
} else {
|
|
3500
3554
|
let o,
|
|
3501
3555
|
s,
|
|
@@ -3505,26 +3559,26 @@ function updateKeyedMap() {
|
|
|
3505
3559
|
a,
|
|
3506
3560
|
f,
|
|
3507
3561
|
E = new Array(t),
|
|
3508
|
-
|
|
3509
|
-
|
|
3562
|
+
T = new Array(t),
|
|
3563
|
+
S = this.nt ? new Array(t) : undefined,
|
|
3510
3564
|
d = this.it ? new Array(t) : undefined;
|
|
3511
3565
|
for (
|
|
3512
|
-
o = 0, s = Math.min(this.
|
|
3566
|
+
o = 0, s = Math.min(this.Be, t);
|
|
3513
3567
|
o < s && (this.ze[o] === e[o] || (this.nt && compare(this.tt, this.ze[o], e[o])));
|
|
3514
3568
|
o++
|
|
3515
3569
|
) {
|
|
3516
3570
|
if (this.nt) setSignal(this.nt[o], e[o]);
|
|
3517
3571
|
}
|
|
3518
3572
|
for (
|
|
3519
|
-
s = this.
|
|
3573
|
+
s = this.Be - 1, u = t - 1;
|
|
3520
3574
|
s >= o &&
|
|
3521
3575
|
u >= o &&
|
|
3522
3576
|
(this.ze[s] === e[u] || (this.nt && compare(this.tt, this.ze[s], e[u])));
|
|
3523
3577
|
s--, u--
|
|
3524
3578
|
) {
|
|
3525
3579
|
E[u] = this.Je[s];
|
|
3526
|
-
|
|
3527
|
-
|
|
3580
|
+
T[u] = this.et[s];
|
|
3581
|
+
S && (S[u] = this.nt[s]);
|
|
3528
3582
|
d && (d[u] = this.it[s]);
|
|
3529
3583
|
}
|
|
3530
3584
|
a = new Map();
|
|
@@ -3542,8 +3596,8 @@ function updateKeyedMap() {
|
|
|
3542
3596
|
i = a.get(l);
|
|
3543
3597
|
if (i !== undefined && i !== -1) {
|
|
3544
3598
|
E[i] = this.Je[n];
|
|
3545
|
-
|
|
3546
|
-
|
|
3599
|
+
T[i] = this.et[n];
|
|
3600
|
+
S && (S[i] = this.nt[n]);
|
|
3547
3601
|
d && (d[i] = this.it[n]);
|
|
3548
3602
|
i = f[i];
|
|
3549
3603
|
a.set(l, i);
|
|
@@ -3552,9 +3606,9 @@ function updateKeyedMap() {
|
|
|
3552
3606
|
for (i = o; i < t; i++) {
|
|
3553
3607
|
if (i in E) {
|
|
3554
3608
|
this.Je[i] = E[i];
|
|
3555
|
-
this.et[i] =
|
|
3556
|
-
if (
|
|
3557
|
-
this.nt[i] =
|
|
3609
|
+
this.et[i] = T[i];
|
|
3610
|
+
if (S) {
|
|
3611
|
+
this.nt[i] = S[i];
|
|
3558
3612
|
setSignal(this.nt[i], e[i]);
|
|
3559
3613
|
}
|
|
3560
3614
|
if (d) {
|
|
@@ -3565,7 +3619,7 @@ function updateKeyedMap() {
|
|
|
3565
3619
|
this.Je[i] = runWithOwner((this.et[i] = createOwner()), r);
|
|
3566
3620
|
}
|
|
3567
3621
|
}
|
|
3568
|
-
this.Je = this.Je.slice(0, (this.
|
|
3622
|
+
this.Je = this.Je.slice(0, (this.Be = t));
|
|
3569
3623
|
this.ze = e.slice(0);
|
|
3570
3624
|
}
|
|
3571
3625
|
});
|
|
@@ -3576,7 +3630,7 @@ function repeat(e, t, n) {
|
|
|
3576
3630
|
const r = computed(
|
|
3577
3631
|
updateRepeat.bind({
|
|
3578
3632
|
Ze: createOwner(),
|
|
3579
|
-
|
|
3633
|
+
Be: 0,
|
|
3580
3634
|
st: 0,
|
|
3581
3635
|
ut: e,
|
|
3582
3636
|
Xe: i,
|
|
@@ -3586,7 +3640,7 @@ function repeat(e, t, n) {
|
|
|
3586
3640
|
ot: n?.fallback
|
|
3587
3641
|
})
|
|
3588
3642
|
);
|
|
3589
|
-
r.
|
|
3643
|
+
r.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
3590
3644
|
return accessor(r);
|
|
3591
3645
|
}
|
|
3592
3646
|
function updateRepeat() {
|
|
@@ -3594,11 +3648,12 @@ function updateRepeat() {
|
|
|
3594
3648
|
const t = this.ct?.() || 0;
|
|
3595
3649
|
runWithOwner(this.Ze, () => {
|
|
3596
3650
|
if (e === 0) {
|
|
3597
|
-
if (this.
|
|
3651
|
+
if (this.Be !== 0) {
|
|
3598
3652
|
this.Ze.dispose(false);
|
|
3599
3653
|
this.et = [];
|
|
3600
3654
|
this.Je = [];
|
|
3601
|
-
this.
|
|
3655
|
+
this.Be = 0;
|
|
3656
|
+
this.st = 0;
|
|
3602
3657
|
}
|
|
3603
3658
|
if (this.ot && !this.Je[0]) {
|
|
3604
3659
|
this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.ot);
|
|
@@ -3606,14 +3661,14 @@ function updateRepeat() {
|
|
|
3606
3661
|
return;
|
|
3607
3662
|
}
|
|
3608
3663
|
const n = t + e;
|
|
3609
|
-
const i = this.st + this.
|
|
3610
|
-
if (this.
|
|
3664
|
+
const i = this.st + this.Be;
|
|
3665
|
+
if (this.Be === 0 && this.et[0]) this.et[0].dispose();
|
|
3611
3666
|
for (let e = n; e < i; e++) this.et[e - this.st].dispose();
|
|
3612
3667
|
if (this.st < t) {
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
this.et.splice(0,
|
|
3616
|
-
this.Je.splice(0,
|
|
3668
|
+
const e = t - this.st;
|
|
3669
|
+
for (let t = 0; t < e && t < this.Be; t++) this.et[t].dispose();
|
|
3670
|
+
this.et.splice(0, e);
|
|
3671
|
+
this.Je.splice(0, e);
|
|
3617
3672
|
} else if (this.st > t) {
|
|
3618
3673
|
let n = i - this.st - 1;
|
|
3619
3674
|
let r = this.st - t;
|
|
@@ -3632,7 +3687,7 @@ function updateRepeat() {
|
|
|
3632
3687
|
}
|
|
3633
3688
|
this.Je = this.Je.slice(0, e);
|
|
3634
3689
|
this.st = t;
|
|
3635
|
-
this.
|
|
3690
|
+
this.Be = e;
|
|
3636
3691
|
});
|
|
3637
3692
|
return this.Je;
|
|
3638
3693
|
}
|
|
@@ -3641,21 +3696,21 @@ function compare(e, t, n) {
|
|
|
3641
3696
|
}
|
|
3642
3697
|
function boundaryComputed(e, t) {
|
|
3643
3698
|
const n = computed(e, { lazy: true });
|
|
3644
|
-
n.
|
|
3645
|
-
const i = e !== undefined ? e : n.
|
|
3646
|
-
const r = t !== undefined ? t : n.
|
|
3647
|
-
n.
|
|
3648
|
-
n.
|
|
3699
|
+
n.Me = (e, t) => {
|
|
3700
|
+
const i = e !== undefined ? e : n.fe;
|
|
3701
|
+
const r = t !== undefined ? t : n.ce;
|
|
3702
|
+
n.fe &= ~n.lt;
|
|
3703
|
+
n.F.notify(n, n.lt, i, r);
|
|
3649
3704
|
};
|
|
3650
3705
|
n.lt = t;
|
|
3651
|
-
n.
|
|
3706
|
+
n.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
3652
3707
|
recompute(n, true);
|
|
3653
3708
|
return n;
|
|
3654
3709
|
}
|
|
3655
3710
|
function createBoundChildren(e, t, n, i) {
|
|
3656
|
-
const r = e.
|
|
3657
|
-
r.addChild((e.
|
|
3658
|
-
cleanup(() => r.removeChild(e.
|
|
3711
|
+
const r = e.F;
|
|
3712
|
+
r.addChild((e.F = n));
|
|
3713
|
+
cleanup(() => r.removeChild(e.F));
|
|
3659
3714
|
return runWithOwner(e, () => {
|
|
3660
3715
|
const e = computed(t);
|
|
3661
3716
|
return boundaryComputed(() => flatten(read(e)), i);
|
|
@@ -3676,8 +3731,8 @@ function isSlotMinimallyReady(e) {
|
|
|
3676
3731
|
return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
|
|
3677
3732
|
}
|
|
3678
3733
|
function setSlotState(e, t, n, i) {
|
|
3679
|
-
setSignal(e.
|
|
3680
|
-
setSignal(e.
|
|
3734
|
+
setSignal(e.Tt, n);
|
|
3735
|
+
setSignal(e.St, i);
|
|
3681
3736
|
if (isRevealController(e)) {
|
|
3682
3737
|
if (!n && e.dt === t) e.dt = undefined;
|
|
3683
3738
|
return e.evaluate(n, i);
|
|
@@ -3689,16 +3744,16 @@ class RevealController {
|
|
|
3689
3744
|
It;
|
|
3690
3745
|
ht = [];
|
|
3691
3746
|
dt;
|
|
3692
|
-
St = signal(false, { ownedWrite: true, Ye: true });
|
|
3693
3747
|
Tt = signal(false, { ownedWrite: true, Ye: true });
|
|
3748
|
+
St = signal(false, { ownedWrite: true, Ye: true });
|
|
3694
3749
|
Nt = true;
|
|
3695
3750
|
At = true;
|
|
3696
|
-
|
|
3751
|
+
Pt = false;
|
|
3697
3752
|
constructor(e, t) {
|
|
3698
3753
|
this.Rt = e;
|
|
3699
3754
|
this.It = t;
|
|
3700
3755
|
}
|
|
3701
|
-
|
|
3756
|
+
Ct(e) {
|
|
3702
3757
|
for (let t = 0; t < this.ht.length; t++) {
|
|
3703
3758
|
const n = this.ht[t];
|
|
3704
3759
|
if ((isRevealController(n) ? n.dt : n._t) !== this) continue;
|
|
@@ -3707,7 +3762,7 @@ class RevealController {
|
|
|
3707
3762
|
return true;
|
|
3708
3763
|
}
|
|
3709
3764
|
isReady() {
|
|
3710
|
-
return this.
|
|
3765
|
+
return this.Ct(isSlotReady);
|
|
3711
3766
|
}
|
|
3712
3767
|
isMinimallyReady() {
|
|
3713
3768
|
const e = untrack(this.Rt);
|
|
@@ -3715,7 +3770,7 @@ class RevealController {
|
|
|
3715
3770
|
if (e === "natural") {
|
|
3716
3771
|
let e = false;
|
|
3717
3772
|
let t = false;
|
|
3718
|
-
this.
|
|
3773
|
+
this.Ct(n => {
|
|
3719
3774
|
e = true;
|
|
3720
3775
|
if (isSlotMinimallyReady(n)) {
|
|
3721
3776
|
t = true;
|
|
@@ -3725,7 +3780,7 @@ class RevealController {
|
|
|
3725
3780
|
return !e || t;
|
|
3726
3781
|
}
|
|
3727
3782
|
let t = true;
|
|
3728
|
-
this.
|
|
3783
|
+
this.Ct(e => {
|
|
3729
3784
|
t = isSlotMinimallyReady(e);
|
|
3730
3785
|
return false;
|
|
3731
3786
|
});
|
|
@@ -3735,7 +3790,7 @@ class RevealController {
|
|
|
3735
3790
|
if (this.ht.includes(e)) return;
|
|
3736
3791
|
this.ht.push(e);
|
|
3737
3792
|
const t = untrack(this.Rt);
|
|
3738
|
-
(setSignal(e.
|
|
3793
|
+
(setSignal(e.Tt, true), setSignal(e.St, t === "sequential" ? !!untrack(this.It) : false));
|
|
3739
3794
|
untrack(() => this.evaluate());
|
|
3740
3795
|
}
|
|
3741
3796
|
unregister(e) {
|
|
@@ -3744,39 +3799,39 @@ class RevealController {
|
|
|
3744
3799
|
untrack(() => this.evaluate());
|
|
3745
3800
|
}
|
|
3746
3801
|
evaluate(e, t) {
|
|
3747
|
-
if (this.
|
|
3748
|
-
this.
|
|
3802
|
+
if (this.Pt) return;
|
|
3803
|
+
this.Pt = true;
|
|
3749
3804
|
const n = this.Nt;
|
|
3750
3805
|
const i = this.At;
|
|
3751
3806
|
try {
|
|
3752
|
-
const n = e ?? read(this.
|
|
3807
|
+
const n = e ?? read(this.Tt),
|
|
3753
3808
|
i = untrack(this.Rt),
|
|
3754
3809
|
r = i === "sequential" && !!untrack(this.It),
|
|
3755
3810
|
o = t ?? r;
|
|
3756
3811
|
if (n) {
|
|
3757
|
-
this.
|
|
3812
|
+
this.Ct(e => setSlotState(e, this, true, o));
|
|
3758
3813
|
} else if (i === "natural") {
|
|
3759
|
-
this.
|
|
3814
|
+
this.Ct(e => {
|
|
3760
3815
|
if (isRevealController(e)) {
|
|
3761
|
-
setSignal(e.Tt, false);
|
|
3762
3816
|
setSignal(e.St, false);
|
|
3817
|
+
setSignal(e.Tt, false);
|
|
3763
3818
|
e.evaluate(false, false);
|
|
3764
3819
|
} else {
|
|
3765
3820
|
setSlotState(e, this, !isSlotReady(e), false);
|
|
3766
3821
|
}
|
|
3767
3822
|
});
|
|
3768
3823
|
} else if (i === "together") {
|
|
3769
|
-
const e = this.
|
|
3770
|
-
this.
|
|
3824
|
+
const e = this.Ct(isSlotMinimallyReady);
|
|
3825
|
+
this.Ct(t => setSlotState(t, this, !e, false));
|
|
3771
3826
|
} else {
|
|
3772
3827
|
let e = false;
|
|
3773
|
-
this.
|
|
3828
|
+
this.Ct(t => {
|
|
3774
3829
|
if (e) return setSlotState(t, this, true, r);
|
|
3775
3830
|
if (isSlotReady(t)) return setSlotState(t, this, false, false);
|
|
3776
3831
|
e = true;
|
|
3777
3832
|
if (isRevealController(t)) {
|
|
3778
|
-
setSignal(t.Tt, false);
|
|
3779
3833
|
setSignal(t.St, false);
|
|
3834
|
+
setSignal(t.Tt, false);
|
|
3780
3835
|
t.evaluate(false, false);
|
|
3781
3836
|
} else {
|
|
3782
3837
|
setSlotState(t, this, true, false);
|
|
@@ -3786,7 +3841,7 @@ class RevealController {
|
|
|
3786
3841
|
} finally {
|
|
3787
3842
|
this.Nt = this.isReady();
|
|
3788
3843
|
this.At = this.isMinimallyReady();
|
|
3789
|
-
this.
|
|
3844
|
+
this.Pt = false;
|
|
3790
3845
|
}
|
|
3791
3846
|
if (this.dt && (n !== this.Nt || i !== this.At)) this.dt.evaluate();
|
|
3792
3847
|
}
|
|
@@ -3796,9 +3851,9 @@ class CollectionQueue extends Queue {
|
|
|
3796
3851
|
ft = new Set();
|
|
3797
3852
|
Dt;
|
|
3798
3853
|
Et = true;
|
|
3799
|
-
St = signal(false, { ownedWrite: true, Ye: true });
|
|
3800
|
-
Re;
|
|
3801
3854
|
Tt = signal(false, { ownedWrite: true, Ye: true });
|
|
3855
|
+
ce;
|
|
3856
|
+
St = signal(false, { ownedWrite: true, Ye: true });
|
|
3802
3857
|
_t;
|
|
3803
3858
|
Ot = false;
|
|
3804
3859
|
yt;
|
|
@@ -3808,7 +3863,7 @@ class CollectionQueue extends Queue {
|
|
|
3808
3863
|
this.gt = e;
|
|
3809
3864
|
}
|
|
3810
3865
|
run(e) {
|
|
3811
|
-
if (!e || (read(this.
|
|
3866
|
+
if (!e || (read(this.Tt) && (!_revealUsed || read(this.St)))) return;
|
|
3812
3867
|
return super.run(e);
|
|
3813
3868
|
}
|
|
3814
3869
|
notify(e, t, n, i) {
|
|
@@ -3833,13 +3888,13 @@ class CollectionQueue extends Queue {
|
|
|
3833
3888
|
}
|
|
3834
3889
|
if (n & this.gt) {
|
|
3835
3890
|
this.Et = true;
|
|
3836
|
-
const t = i?.source || e.
|
|
3891
|
+
const t = i?.source || e.ce?.source;
|
|
3837
3892
|
if (t) {
|
|
3838
3893
|
const e = this.ft.size === 0;
|
|
3839
3894
|
this.ft.add(t);
|
|
3840
|
-
if (e) setSignal(this.
|
|
3895
|
+
if (e) setSignal(this.Tt, true);
|
|
3841
3896
|
if (this.gt & STATUS_ERROR) {
|
|
3842
|
-
setSignal(this.
|
|
3897
|
+
setSignal(this.ce, t.ce?.cause ?? t.ce);
|
|
3843
3898
|
}
|
|
3844
3899
|
}
|
|
3845
3900
|
}
|
|
@@ -3849,19 +3904,19 @@ class CollectionQueue extends Queue {
|
|
|
3849
3904
|
checkSources() {
|
|
3850
3905
|
for (const e of this.ft) {
|
|
3851
3906
|
if (
|
|
3852
|
-
e.
|
|
3853
|
-
(!(e.
|
|
3907
|
+
e.M & REACTIVE_DISPOSED ||
|
|
3908
|
+
(!(e.fe & this.gt) && !(this.gt & STATUS_ERROR && e.fe & STATUS_PENDING))
|
|
3854
3909
|
)
|
|
3855
3910
|
this.ft.delete(e);
|
|
3856
3911
|
}
|
|
3857
3912
|
if (!this.ft.size) {
|
|
3858
3913
|
if (this.gt & STATUS_PENDING && this.Et && !this.Ot && this.Dt) {
|
|
3859
|
-
this.Et = !!(this.Dt.
|
|
3914
|
+
this.Et = !!(this.Dt.fe & this.gt);
|
|
3860
3915
|
} else {
|
|
3861
3916
|
this.Et = false;
|
|
3862
3917
|
}
|
|
3863
3918
|
if (!this.Et) {
|
|
3864
|
-
setSignal(this.
|
|
3919
|
+
setSignal(this.Tt, false);
|
|
3865
3920
|
if (this.yt) {
|
|
3866
3921
|
try {
|
|
3867
3922
|
this.vt = untrack(() => this.yt());
|
|
@@ -3876,7 +3931,7 @@ function createCollectionBoundary(e, t, n, i) {
|
|
|
3876
3931
|
const r = createOwner();
|
|
3877
3932
|
if (_revealUsed) setContext(RevealControllerContext, null, r);
|
|
3878
3933
|
const o = new CollectionQueue(e);
|
|
3879
|
-
if (e === STATUS_ERROR) o.
|
|
3934
|
+
if (e === STATUS_ERROR) o.ce = signal(undefined, { ownedWrite: true, Ye: true });
|
|
3880
3935
|
if (i) o.yt = i;
|
|
3881
3936
|
const s = (o.Dt = createBoundChildren(r, t, o, e));
|
|
3882
3937
|
untrack(() => {
|
|
@@ -3887,7 +3942,7 @@ function createCollectionBoundary(e, t, n, i) {
|
|
|
3887
3942
|
if (e instanceof NotReadyError) t = true;
|
|
3888
3943
|
else throw e;
|
|
3889
3944
|
}
|
|
3890
|
-
o.Et = t || !!(s.
|
|
3945
|
+
o.Et = t || !!(s.fe & e) || s.ce instanceof NotReadyError;
|
|
3891
3946
|
});
|
|
3892
3947
|
const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
|
|
3893
3948
|
if (u) {
|
|
@@ -3897,11 +3952,11 @@ function createCollectionBoundary(e, t, n, i) {
|
|
|
3897
3952
|
}
|
|
3898
3953
|
return accessor(
|
|
3899
3954
|
computed(() => {
|
|
3900
|
-
if (!read(o.
|
|
3955
|
+
if (!read(o.Tt)) {
|
|
3901
3956
|
const e = read(s);
|
|
3902
|
-
if (!untrack(() => read(o.
|
|
3957
|
+
if (!untrack(() => read(o.Tt))) return ((o.Ot = true), e);
|
|
3903
3958
|
}
|
|
3904
|
-
if (_revealUsed && read(o.
|
|
3959
|
+
if (_revealUsed && read(o.St)) return undefined;
|
|
3905
3960
|
return n(o);
|
|
3906
3961
|
})
|
|
3907
3962
|
);
|
|
@@ -3911,7 +3966,7 @@ function createLoadingBoundary(e, t, n) {
|
|
|
3911
3966
|
}
|
|
3912
3967
|
function createErrorBoundary(e, t) {
|
|
3913
3968
|
return createCollectionBoundary(STATUS_ERROR, e, e =>
|
|
3914
|
-
t(accessor(e.
|
|
3969
|
+
t(accessor(e.ce), () => {
|
|
3915
3970
|
for (const t of e.ft) recompute(t);
|
|
3916
3971
|
schedule();
|
|
3917
3972
|
})
|
|
@@ -4030,7 +4085,6 @@ export {
|
|
|
4030
4085
|
isDisposed,
|
|
4031
4086
|
isEqual,
|
|
4032
4087
|
isPending,
|
|
4033
|
-
isRefreshing,
|
|
4034
4088
|
isWrappable,
|
|
4035
4089
|
latest,
|
|
4036
4090
|
mapArray,
|