@tanstack/solid-query-persist-client 6.0.0-alpha.0 → 6.0.0-alpha.1
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/build/dev.cjs +524 -363
- package/build/dev.js +524 -363
- package/build/index.cjs +524 -363
- package/build/index.js +524 -363
- package/package.json +6 -6
package/build/dev.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var solidQuery = require('@tanstack/solid-query');
|
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
|
|
9
|
-
// ../../node_modules/.pnpm/@solidjs+signals@0.
|
|
9
|
+
// ../../node_modules/.pnpm/@solidjs+signals@0.13.6/node_modules/@solidjs/signals/dist/prod.js
|
|
10
10
|
var NotReadyError = class extends Error {
|
|
11
11
|
source;
|
|
12
12
|
constructor(e) {
|
|
@@ -85,12 +85,12 @@ function deleteFromHeap(e, t) {
|
|
|
85
85
|
}
|
|
86
86
|
function runHeap(e, t) {
|
|
87
87
|
e._ = false;
|
|
88
|
-
for (e.
|
|
89
|
-
let n = e.l[e.
|
|
88
|
+
for (e.P = 0; e.P <= e.R; e.P++) {
|
|
89
|
+
let n = e.l[e.P];
|
|
90
90
|
while (n !== void 0) {
|
|
91
91
|
if (n.O & REACTIVE_IN_HEAP) t(n);
|
|
92
92
|
else adjustHeight(n, e);
|
|
93
|
-
n = e.l[e.
|
|
93
|
+
n = e.l[e.P];
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
e.R = 0;
|
|
@@ -99,8 +99,8 @@ function adjustHeight(e, t) {
|
|
|
99
99
|
deleteFromHeap(e, t);
|
|
100
100
|
let n = e.o;
|
|
101
101
|
for (let t2 = e.C; t2; t2 = t2.D) {
|
|
102
|
-
const e2 = t2.
|
|
103
|
-
const i = e2.
|
|
102
|
+
const e2 = t2.m;
|
|
103
|
+
const i = e2.V || e2;
|
|
104
104
|
if (i.L && i.o >= n) n = i.o + 1;
|
|
105
105
|
}
|
|
106
106
|
if (e.o !== n) {
|
|
@@ -111,40 +111,100 @@ function adjustHeight(e, t) {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
var transitions = /* @__PURE__ */ new Set();
|
|
114
|
-
var dirtyQueue = { l: new Array(2e3).fill(void 0), _: false,
|
|
115
|
-
var zombieQueue = { l: new Array(2e3).fill(void 0), _: false,
|
|
114
|
+
var dirtyQueue = { l: new Array(2e3).fill(void 0), _: false, P: 0, R: 0 };
|
|
115
|
+
var zombieQueue = { l: new Array(2e3).fill(void 0), _: false, P: 0, R: 0 };
|
|
116
116
|
var clock = 0;
|
|
117
117
|
var activeTransition = null;
|
|
118
118
|
var scheduled = false;
|
|
119
119
|
var projectionWriteActive = false;
|
|
120
|
+
var stashedOptimisticReads = null;
|
|
120
121
|
function runLaneEffects(e) {
|
|
121
122
|
for (const t of activeLanes) {
|
|
122
|
-
if (t.
|
|
123
|
-
const n = t.
|
|
123
|
+
if (t.U || t.k.size > 0) continue;
|
|
124
|
+
const n = t.G[e - 1];
|
|
124
125
|
if (n.length) {
|
|
125
|
-
t.
|
|
126
|
+
t.G[e - 1] = [];
|
|
126
127
|
runQueue(n, e);
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
}
|
|
131
|
+
function queueStashedOptimisticEffects(e) {
|
|
132
|
+
for (let t = e.I; t !== null; t = t.p) {
|
|
133
|
+
const e2 = t.h;
|
|
134
|
+
if (!e2.W) continue;
|
|
135
|
+
if (e2.W === EFFECT_TRACKED) {
|
|
136
|
+
if (!e2.H) {
|
|
137
|
+
e2.H = true;
|
|
138
|
+
e2.F.enqueue(EFFECT_USER, e2.M);
|
|
139
|
+
}
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const n = e2.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
143
|
+
if (n.P > e2.o) n.P = e2.o;
|
|
144
|
+
insertIntoHeap(e2, n);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function mergeTransitionState(e, t) {
|
|
148
|
+
t.$ = e;
|
|
149
|
+
e.j.push(...t.j);
|
|
150
|
+
for (const n of activeLanes) {
|
|
151
|
+
if (n.K === t) n.K = e;
|
|
152
|
+
}
|
|
153
|
+
e.Y.push(...t.Y);
|
|
154
|
+
for (const n of t.Z) e.Z.add(n);
|
|
155
|
+
for (const n of t.B) {
|
|
156
|
+
if (!e.B.includes(n)) e.B.push(n);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function resolveOptimisticNodes(e) {
|
|
160
|
+
for (let t = 0; t < e.length; t++) {
|
|
161
|
+
const n = e[t];
|
|
162
|
+
n.q = void 0;
|
|
163
|
+
if (n.X !== NOT_PENDING) {
|
|
164
|
+
n.J = n.X;
|
|
165
|
+
n.X = NOT_PENDING;
|
|
166
|
+
}
|
|
167
|
+
const i = n.ee;
|
|
168
|
+
n.ee = NOT_PENDING;
|
|
169
|
+
if (i !== NOT_PENDING && n.J !== i) insertSubs(n, true);
|
|
170
|
+
n.K = null;
|
|
171
|
+
}
|
|
172
|
+
e.length = 0;
|
|
173
|
+
}
|
|
174
|
+
function cleanupCompletedLanes(e) {
|
|
175
|
+
for (const t of activeLanes) {
|
|
176
|
+
const n = e ? t.K === e : !t.K;
|
|
177
|
+
if (!n) continue;
|
|
178
|
+
if (!t.U) {
|
|
179
|
+
if (t.G[0].length) runQueue(t.G[0], EFFECT_RENDER);
|
|
180
|
+
if (t.G[1].length) runQueue(t.G[1], EFFECT_USER);
|
|
181
|
+
}
|
|
182
|
+
if (t.te.q === t) t.te.q = void 0;
|
|
183
|
+
t.k.clear();
|
|
184
|
+
t.G[0].length = 0;
|
|
185
|
+
t.G[1].length = 0;
|
|
186
|
+
activeLanes.delete(t);
|
|
187
|
+
signalLanes.delete(t.te);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
130
190
|
function schedule() {
|
|
131
191
|
if (scheduled) return;
|
|
132
192
|
scheduled = true;
|
|
133
|
-
if (!globalQueue.
|
|
193
|
+
if (!globalQueue.ne && !projectionWriteActive) queueMicrotask(flush);
|
|
134
194
|
}
|
|
135
195
|
var Queue = class {
|
|
136
196
|
i = null;
|
|
137
|
-
|
|
138
|
-
|
|
197
|
+
ie = [[], []];
|
|
198
|
+
re = [];
|
|
139
199
|
created = clock;
|
|
140
200
|
addChild(e) {
|
|
141
|
-
this.
|
|
201
|
+
this.re.push(e);
|
|
142
202
|
e.i = this;
|
|
143
203
|
}
|
|
144
204
|
removeChild(e) {
|
|
145
|
-
const t = this.
|
|
205
|
+
const t = this.re.indexOf(e);
|
|
146
206
|
if (t >= 0) {
|
|
147
|
-
this.
|
|
207
|
+
this.re.splice(t, 1);
|
|
148
208
|
e.i = null;
|
|
149
209
|
}
|
|
150
210
|
}
|
|
@@ -153,107 +213,123 @@ var Queue = class {
|
|
|
153
213
|
return false;
|
|
154
214
|
}
|
|
155
215
|
run(e) {
|
|
156
|
-
if (this.
|
|
157
|
-
const t = this.
|
|
158
|
-
this.
|
|
216
|
+
if (this.ie[e - 1].length) {
|
|
217
|
+
const t = this.ie[e - 1];
|
|
218
|
+
this.ie[e - 1] = [];
|
|
159
219
|
runQueue(t, e);
|
|
160
220
|
}
|
|
161
|
-
for (let t = 0; t < this.
|
|
221
|
+
for (let t = 0; t < this.re.length; t++) this.re[t].run?.(e);
|
|
162
222
|
}
|
|
163
223
|
enqueue(e, t) {
|
|
164
224
|
if (e) {
|
|
165
225
|
if (currentOptimisticLane) {
|
|
166
226
|
const n = findLane(currentOptimisticLane);
|
|
167
|
-
n.
|
|
227
|
+
n.G[e - 1].push(t);
|
|
168
228
|
} else {
|
|
169
|
-
this.
|
|
229
|
+
this.ie[e - 1].push(t);
|
|
170
230
|
}
|
|
171
231
|
}
|
|
172
232
|
schedule();
|
|
173
233
|
}
|
|
174
234
|
stashQueues(e) {
|
|
175
|
-
e.
|
|
176
|
-
e.
|
|
177
|
-
this.
|
|
178
|
-
for (let t = 0; t < this.
|
|
179
|
-
let n = this.
|
|
180
|
-
let i = e.
|
|
235
|
+
e.ie[0].push(...this.ie[0]);
|
|
236
|
+
e.ie[1].push(...this.ie[1]);
|
|
237
|
+
this.ie = [[], []];
|
|
238
|
+
for (let t = 0; t < this.re.length; t++) {
|
|
239
|
+
let n = this.re[t];
|
|
240
|
+
let i = e.re[t];
|
|
181
241
|
if (!i) {
|
|
182
|
-
i = {
|
|
183
|
-
e.
|
|
242
|
+
i = { ie: [[], []], re: [] };
|
|
243
|
+
e.re[t] = i;
|
|
184
244
|
}
|
|
185
245
|
n.stashQueues(i);
|
|
186
246
|
}
|
|
187
247
|
}
|
|
188
248
|
restoreQueues(e) {
|
|
189
|
-
this.
|
|
190
|
-
this.
|
|
191
|
-
for (let t = 0; t < e.
|
|
192
|
-
const n = e.
|
|
193
|
-
let i = this.
|
|
249
|
+
this.ie[0].push(...e.ie[0]);
|
|
250
|
+
this.ie[1].push(...e.ie[1]);
|
|
251
|
+
for (let t = 0; t < e.re.length; t++) {
|
|
252
|
+
const n = e.re[t];
|
|
253
|
+
let i = this.re[t];
|
|
194
254
|
if (i) i.restoreQueues(n);
|
|
195
255
|
}
|
|
196
256
|
}
|
|
197
257
|
};
|
|
198
258
|
var GlobalQueue = class _GlobalQueue extends Queue {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
static
|
|
204
|
-
static
|
|
205
|
-
static
|
|
259
|
+
ne = false;
|
|
260
|
+
se = [];
|
|
261
|
+
Y = [];
|
|
262
|
+
Z = /* @__PURE__ */ new Set();
|
|
263
|
+
static oe;
|
|
264
|
+
static ue;
|
|
265
|
+
static ce = null;
|
|
206
266
|
flush() {
|
|
207
|
-
if (this.
|
|
208
|
-
this.
|
|
267
|
+
if (this.ne) return;
|
|
268
|
+
this.ne = true;
|
|
209
269
|
try {
|
|
210
|
-
runHeap(dirtyQueue, _GlobalQueue.
|
|
270
|
+
runHeap(dirtyQueue, _GlobalQueue.oe);
|
|
211
271
|
if (activeTransition) {
|
|
212
272
|
const e = transitionComplete(activeTransition);
|
|
213
273
|
if (!e) {
|
|
214
|
-
|
|
215
|
-
runHeap(zombieQueue, _GlobalQueue.
|
|
216
|
-
this.
|
|
217
|
-
this
|
|
218
|
-
this.
|
|
274
|
+
const e2 = activeTransition;
|
|
275
|
+
runHeap(zombieQueue, _GlobalQueue.oe);
|
|
276
|
+
this.se = [];
|
|
277
|
+
this.Y = [];
|
|
278
|
+
this.Z = /* @__PURE__ */ new Set();
|
|
219
279
|
runLaneEffects(EFFECT_RENDER);
|
|
220
280
|
runLaneEffects(EFFECT_USER);
|
|
221
|
-
this.stashQueues(
|
|
281
|
+
this.stashQueues(e2.ae);
|
|
222
282
|
clock++;
|
|
223
|
-
scheduled = dirtyQueue.R >= dirtyQueue.
|
|
224
|
-
reassignPendingTransition(
|
|
283
|
+
scheduled = dirtyQueue.R >= dirtyQueue.P;
|
|
284
|
+
reassignPendingTransition(e2.se);
|
|
225
285
|
activeTransition = null;
|
|
226
|
-
|
|
286
|
+
if (!e2.j.length && e2.Y.length) {
|
|
287
|
+
stashedOptimisticReads = /* @__PURE__ */ new Set();
|
|
288
|
+
for (let t2 = 0; t2 < e2.Y.length; t2++) {
|
|
289
|
+
const n = e2.Y[t2];
|
|
290
|
+
if (n.L || n.fe) continue;
|
|
291
|
+
stashedOptimisticReads.add(n);
|
|
292
|
+
queueStashedOptimisticEffects(n);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
try {
|
|
296
|
+
finalizePureQueue(null, true);
|
|
297
|
+
} finally {
|
|
298
|
+
stashedOptimisticReads = null;
|
|
299
|
+
}
|
|
227
300
|
return;
|
|
228
301
|
}
|
|
229
|
-
this.
|
|
230
|
-
this.restoreQueues(activeTransition.
|
|
302
|
+
this.se !== activeTransition.se && this.se.push(...activeTransition.se);
|
|
303
|
+
this.restoreQueues(activeTransition.ae);
|
|
231
304
|
transitions.delete(activeTransition);
|
|
232
305
|
const t = activeTransition;
|
|
233
306
|
activeTransition = null;
|
|
234
|
-
reassignPendingTransition(this.
|
|
307
|
+
reassignPendingTransition(this.se);
|
|
235
308
|
finalizePureQueue(t);
|
|
236
309
|
} else {
|
|
237
|
-
if (transitions.size) runHeap(zombieQueue, _GlobalQueue.
|
|
310
|
+
if (transitions.size) runHeap(zombieQueue, _GlobalQueue.oe);
|
|
238
311
|
finalizePureQueue();
|
|
239
312
|
}
|
|
240
313
|
clock++;
|
|
241
|
-
scheduled = dirtyQueue.R >= dirtyQueue.
|
|
314
|
+
scheduled = dirtyQueue.R >= dirtyQueue.P;
|
|
242
315
|
runLaneEffects(EFFECT_RENDER);
|
|
243
316
|
this.run(EFFECT_RENDER);
|
|
244
317
|
runLaneEffects(EFFECT_USER);
|
|
245
318
|
this.run(EFFECT_USER);
|
|
246
319
|
} finally {
|
|
247
|
-
this.
|
|
320
|
+
this.ne = false;
|
|
248
321
|
}
|
|
249
322
|
}
|
|
250
323
|
notify(e, t, n, i) {
|
|
251
324
|
if (t & STATUS_PENDING) {
|
|
252
325
|
if (n & STATUS_PENDING) {
|
|
253
|
-
const t2 = i !== void 0 ? i : e.
|
|
254
|
-
if (activeTransition && t2
|
|
255
|
-
|
|
256
|
-
|
|
326
|
+
const t2 = i !== void 0 ? i : e.le;
|
|
327
|
+
if (activeTransition && t2) {
|
|
328
|
+
const e2 = t2.source;
|
|
329
|
+
if (!activeTransition.B.includes(e2)) {
|
|
330
|
+
activeTransition.B.push(e2);
|
|
331
|
+
schedule();
|
|
332
|
+
}
|
|
257
333
|
}
|
|
258
334
|
}
|
|
259
335
|
return true;
|
|
@@ -263,58 +339,56 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
263
339
|
initTransition(e) {
|
|
264
340
|
if (e) e = currentTransition(e);
|
|
265
341
|
if (e && e === activeTransition) return;
|
|
266
|
-
if (!e && activeTransition && activeTransition.
|
|
342
|
+
if (!e && activeTransition && activeTransition.Ee === clock) return;
|
|
267
343
|
if (!activeTransition) {
|
|
268
344
|
activeTransition = e ?? {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
345
|
+
Ee: clock,
|
|
346
|
+
se: [],
|
|
347
|
+
B: [],
|
|
348
|
+
Y: [],
|
|
349
|
+
Z: /* @__PURE__ */ new Set(),
|
|
350
|
+
j: [],
|
|
351
|
+
ae: { ie: [[], []], re: [] },
|
|
352
|
+
$: false
|
|
277
353
|
};
|
|
278
354
|
} else if (e) {
|
|
279
355
|
const t = activeTransition;
|
|
280
|
-
t
|
|
281
|
-
e.ee.push(...t.ee);
|
|
282
|
-
for (const n of activeLanes) {
|
|
283
|
-
if (n.ne === t) n.ne = e;
|
|
284
|
-
}
|
|
285
|
-
e.$.push(...t.$);
|
|
286
|
-
for (const n of t.j) {
|
|
287
|
-
e.j.add(n);
|
|
288
|
-
}
|
|
356
|
+
mergeTransitionState(e, t);
|
|
289
357
|
transitions.delete(t);
|
|
290
358
|
activeTransition = e;
|
|
291
359
|
}
|
|
292
360
|
transitions.add(activeTransition);
|
|
293
|
-
activeTransition.
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
361
|
+
activeTransition.Ee = clock;
|
|
362
|
+
if (this.se !== activeTransition.se) {
|
|
363
|
+
for (let e2 = 0; e2 < this.se.length; e2++) {
|
|
364
|
+
const t = this.se[e2];
|
|
365
|
+
t.K = activeTransition;
|
|
366
|
+
activeTransition.se.push(t);
|
|
367
|
+
}
|
|
368
|
+
this.se = activeTransition.se;
|
|
298
369
|
}
|
|
299
|
-
this.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
370
|
+
if (this.Y !== activeTransition.Y) {
|
|
371
|
+
for (let e2 = 0; e2 < this.Y.length; e2++) {
|
|
372
|
+
const t = this.Y[e2];
|
|
373
|
+
t.K = activeTransition;
|
|
374
|
+
activeTransition.Y.push(t);
|
|
375
|
+
}
|
|
376
|
+
this.Y = activeTransition.Y;
|
|
304
377
|
}
|
|
305
|
-
this.$ = activeTransition.$;
|
|
306
378
|
for (const e2 of activeLanes) {
|
|
307
|
-
if (!e2.
|
|
379
|
+
if (!e2.K) e2.K = activeTransition;
|
|
380
|
+
}
|
|
381
|
+
if (this.Z !== activeTransition.Z) {
|
|
382
|
+
for (const e2 of this.Z) activeTransition.Z.add(e2);
|
|
383
|
+
this.Z = activeTransition.Z;
|
|
308
384
|
}
|
|
309
|
-
for (const e2 of this.j) activeTransition.j.add(e2);
|
|
310
|
-
this.j = activeTransition.j;
|
|
311
385
|
}
|
|
312
386
|
};
|
|
313
387
|
function insertSubs(e, t = false) {
|
|
314
|
-
const n = e.
|
|
315
|
-
const i = e.
|
|
388
|
+
const n = e.q || currentOptimisticLane;
|
|
389
|
+
const i = e.Te !== void 0;
|
|
316
390
|
for (let r = e.I; r !== null; r = r.p) {
|
|
317
|
-
if (i && r.h.
|
|
391
|
+
if (i && r.h.de) {
|
|
318
392
|
r.h.O |= REACTIVE_SNAPSHOT_STALE;
|
|
319
393
|
continue;
|
|
320
394
|
}
|
|
@@ -323,89 +397,71 @@ function insertSubs(e, t = false) {
|
|
|
323
397
|
assignOrMergeLane(r.h, n);
|
|
324
398
|
} else if (t) {
|
|
325
399
|
r.h.O |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
326
|
-
r.h.
|
|
400
|
+
r.h.q = void 0;
|
|
327
401
|
}
|
|
328
402
|
const e2 = r.h;
|
|
329
|
-
if (e2.
|
|
330
|
-
if (!e2.
|
|
331
|
-
e2.
|
|
332
|
-
e2.
|
|
403
|
+
if (e2.W === EFFECT_TRACKED) {
|
|
404
|
+
if (!e2.H) {
|
|
405
|
+
e2.H = true;
|
|
406
|
+
e2.F.enqueue(EFFECT_USER, e2.M);
|
|
333
407
|
}
|
|
334
408
|
continue;
|
|
335
409
|
}
|
|
336
410
|
const s = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
337
|
-
if (s.
|
|
411
|
+
if (s.P > r.h.o) s.P = r.h.o;
|
|
338
412
|
insertIntoHeap(r.h, s);
|
|
339
413
|
}
|
|
340
414
|
}
|
|
415
|
+
function commitPendingNodes() {
|
|
416
|
+
const e = globalQueue.se;
|
|
417
|
+
for (let t = 0; t < e.length; t++) {
|
|
418
|
+
const n = e[t];
|
|
419
|
+
if (n.X !== NOT_PENDING) {
|
|
420
|
+
n.J = n.X;
|
|
421
|
+
n.X = NOT_PENDING;
|
|
422
|
+
if (n.W && n.W !== EFFECT_TRACKED) n.H = true;
|
|
423
|
+
}
|
|
424
|
+
if (!(n.Se & STATUS_PENDING)) n.Se &= ~STATUS_UNINITIALIZED;
|
|
425
|
+
if (n.L) GlobalQueue.ue(n, false, true);
|
|
426
|
+
}
|
|
427
|
+
e.length = 0;
|
|
428
|
+
}
|
|
341
429
|
function finalizePureQueue(e = null, t = false) {
|
|
342
|
-
|
|
430
|
+
const n = !t;
|
|
431
|
+
if (n) commitPendingNodes();
|
|
343
432
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
344
|
-
if (dirtyQueue.R >= dirtyQueue.
|
|
433
|
+
if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.oe);
|
|
345
434
|
if (n) {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
if (n3.oe && n3.oe !== EFFECT_TRACKED) n3.ue = true;
|
|
353
|
-
}
|
|
354
|
-
if (!(n3.Ee & STATUS_PENDING)) n3.Ee &= ~STATUS_UNINITIALIZED;
|
|
355
|
-
if (n3.L) GlobalQueue.Y(n3, false, true);
|
|
356
|
-
}
|
|
357
|
-
t2.length = 0;
|
|
358
|
-
const n2 = e ? e.$ : globalQueue.$;
|
|
359
|
-
for (let e2 = 0; e2 < n2.length; e2++) {
|
|
360
|
-
const t3 = n2[e2];
|
|
361
|
-
const i2 = t3.ae;
|
|
362
|
-
t3.ie = void 0;
|
|
363
|
-
if (i2 !== NOT_PENDING && t3.fe !== i2) {
|
|
364
|
-
t3.fe = i2;
|
|
365
|
-
insertSubs(t3, true);
|
|
366
|
-
}
|
|
367
|
-
t3.ae = NOT_PENDING;
|
|
368
|
-
t3.ne = null;
|
|
369
|
-
}
|
|
370
|
-
n2.length = 0;
|
|
371
|
-
const i = e ? e.j : globalQueue.j;
|
|
372
|
-
if (GlobalQueue.Z && i.size) {
|
|
373
|
-
for (const e2 of i) {
|
|
374
|
-
GlobalQueue.Z(e2);
|
|
435
|
+
commitPendingNodes();
|
|
436
|
+
resolveOptimisticNodes(e ? e.Y : globalQueue.Y);
|
|
437
|
+
const t2 = e ? e.Z : globalQueue.Z;
|
|
438
|
+
if (GlobalQueue.ce && t2.size) {
|
|
439
|
+
for (const e2 of t2) {
|
|
440
|
+
GlobalQueue.ce(e2);
|
|
375
441
|
}
|
|
376
|
-
|
|
442
|
+
t2.clear();
|
|
377
443
|
schedule();
|
|
378
444
|
}
|
|
379
|
-
|
|
380
|
-
const n3 = e ? t3.ne === e : !t3.ne;
|
|
381
|
-
if (!n3) continue;
|
|
382
|
-
if (!t3.k) {
|
|
383
|
-
if (t3.W[0].length) runQueue(t3.W[0], EFFECT_RENDER);
|
|
384
|
-
if (t3.W[1].length) runQueue(t3.W[1], EFFECT_USER);
|
|
385
|
-
}
|
|
386
|
-
if (t3.Te.ie === t3) t3.Te.ie = void 0;
|
|
387
|
-
t3.U.clear();
|
|
388
|
-
t3.W[0].length = 0;
|
|
389
|
-
t3.W[1].length = 0;
|
|
390
|
-
activeLanes.delete(t3);
|
|
391
|
-
signalLanes.delete(t3.Te);
|
|
392
|
-
}
|
|
445
|
+
cleanupCompletedLanes(e);
|
|
393
446
|
}
|
|
394
447
|
}
|
|
395
448
|
function checkBoundaryChildren(e) {
|
|
396
|
-
for (const t of e.
|
|
449
|
+
for (const t of e.re) {
|
|
397
450
|
t.checkSources?.();
|
|
398
451
|
checkBoundaryChildren(t);
|
|
399
452
|
}
|
|
400
453
|
}
|
|
401
454
|
function reassignPendingTransition(e) {
|
|
402
455
|
for (let t = 0; t < e.length; t++) {
|
|
403
|
-
e[t].
|
|
456
|
+
e[t].K = activeTransition;
|
|
404
457
|
}
|
|
405
458
|
}
|
|
406
459
|
var globalQueue = new GlobalQueue();
|
|
407
460
|
function flush() {
|
|
408
|
-
|
|
461
|
+
if (globalQueue.ne) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
while (scheduled || activeTransition) {
|
|
409
465
|
globalQueue.flush();
|
|
410
466
|
}
|
|
411
467
|
}
|
|
@@ -413,21 +469,30 @@ function runQueue(e, t) {
|
|
|
413
469
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
414
470
|
}
|
|
415
471
|
function transitionComplete(e) {
|
|
416
|
-
if (e
|
|
417
|
-
if (e.
|
|
472
|
+
if (e.$) return true;
|
|
473
|
+
if (e.j.length) return false;
|
|
418
474
|
let t = true;
|
|
419
|
-
for (let n = 0; n < e.
|
|
420
|
-
const i = e.
|
|
421
|
-
if (i.
|
|
475
|
+
for (let n = 0; n < e.B.length; n++) {
|
|
476
|
+
const i = e.B[n];
|
|
477
|
+
if (i.Se & STATUS_PENDING && i.le?.source === i) {
|
|
422
478
|
t = false;
|
|
423
479
|
break;
|
|
424
480
|
}
|
|
425
481
|
}
|
|
426
|
-
|
|
482
|
+
if (t) {
|
|
483
|
+
for (let n = 0; n < e.Y.length; n++) {
|
|
484
|
+
const i = e.Y[n];
|
|
485
|
+
if (hasActiveOverride(i) && "Se" in i && i.Se & STATUS_PENDING && i.le instanceof NotReadyError && i.le.source !== i) {
|
|
486
|
+
t = false;
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
t && (e.$ = true);
|
|
427
492
|
return t;
|
|
428
493
|
}
|
|
429
494
|
function currentTransition(e) {
|
|
430
|
-
while (e
|
|
495
|
+
while (e.$ && typeof e.$ === "object") e = e.$;
|
|
431
496
|
return e;
|
|
432
497
|
}
|
|
433
498
|
function runInTransition(e, t) {
|
|
@@ -446,105 +511,198 @@ function getOrCreateLane(e) {
|
|
|
446
511
|
if (t) {
|
|
447
512
|
return findLane(t);
|
|
448
513
|
}
|
|
449
|
-
const n = e.
|
|
450
|
-
const i = n?.
|
|
451
|
-
t = {
|
|
514
|
+
const n = e.Re;
|
|
515
|
+
const i = n?.q ? findLane(n.q) : null;
|
|
516
|
+
t = { te: e, k: /* @__PURE__ */ new Set(), G: [[], []], U: null, K: activeTransition, Oe: i };
|
|
452
517
|
signalLanes.set(e, t);
|
|
453
518
|
activeLanes.add(t);
|
|
454
|
-
e.
|
|
519
|
+
e._e = false;
|
|
455
520
|
return t;
|
|
456
521
|
}
|
|
457
522
|
function findLane(e) {
|
|
458
|
-
while (e.
|
|
523
|
+
while (e.U) e = e.U;
|
|
459
524
|
return e;
|
|
460
525
|
}
|
|
461
526
|
function mergeLanes(e, t) {
|
|
462
527
|
e = findLane(e);
|
|
463
528
|
t = findLane(t);
|
|
464
529
|
if (e === t) return e;
|
|
465
|
-
t.
|
|
466
|
-
for (const n of t.
|
|
467
|
-
e.
|
|
468
|
-
e.
|
|
530
|
+
t.U = e;
|
|
531
|
+
for (const n of t.k) e.k.add(n);
|
|
532
|
+
e.G[0].push(...t.G[0]);
|
|
533
|
+
e.G[1].push(...t.G[1]);
|
|
469
534
|
return e;
|
|
470
535
|
}
|
|
471
536
|
function resolveLane(e) {
|
|
472
|
-
const t = e.
|
|
537
|
+
const t = e.q;
|
|
473
538
|
if (!t) return void 0;
|
|
474
539
|
const n = findLane(t);
|
|
475
540
|
if (activeLanes.has(n)) return n;
|
|
476
|
-
e.
|
|
541
|
+
e.q = void 0;
|
|
477
542
|
return void 0;
|
|
478
543
|
}
|
|
544
|
+
function resolveTransition(e) {
|
|
545
|
+
return resolveLane(e)?.K ?? e.K;
|
|
546
|
+
}
|
|
479
547
|
function hasActiveOverride(e) {
|
|
480
|
-
return !!(e.
|
|
548
|
+
return !!(e.ee !== void 0 && e.ee !== NOT_PENDING);
|
|
481
549
|
}
|
|
482
550
|
function assignOrMergeLane(e, t) {
|
|
483
551
|
const n = findLane(t);
|
|
484
|
-
const i = e.
|
|
552
|
+
const i = e.q;
|
|
485
553
|
if (i) {
|
|
486
|
-
if (i.
|
|
487
|
-
e.
|
|
554
|
+
if (i.U) {
|
|
555
|
+
e.q = t;
|
|
488
556
|
return;
|
|
489
557
|
}
|
|
490
558
|
const r = findLane(i);
|
|
491
559
|
if (activeLanes.has(r)) {
|
|
492
560
|
if (r !== n && !hasActiveOverride(e)) {
|
|
493
|
-
if (n.
|
|
494
|
-
e.
|
|
495
|
-
} else if (r.
|
|
561
|
+
if (n.Oe && findLane(n.Oe) === r) {
|
|
562
|
+
e.q = t;
|
|
563
|
+
} else if (r.Oe && findLane(r.Oe) === n) ;
|
|
496
564
|
else mergeLanes(n, r);
|
|
497
565
|
}
|
|
498
566
|
return;
|
|
499
567
|
}
|
|
500
568
|
}
|
|
501
|
-
e.
|
|
569
|
+
e.q = t;
|
|
570
|
+
}
|
|
571
|
+
function addPendingSource(e, t) {
|
|
572
|
+
if (e.Ie === t || e.pe?.has(t)) return false;
|
|
573
|
+
if (!e.Ie) {
|
|
574
|
+
e.Ie = t;
|
|
575
|
+
return true;
|
|
576
|
+
}
|
|
577
|
+
if (!e.pe) {
|
|
578
|
+
e.pe = /* @__PURE__ */ new Set([e.Ie, t]);
|
|
579
|
+
} else {
|
|
580
|
+
e.pe.add(t);
|
|
581
|
+
}
|
|
582
|
+
e.Ie = void 0;
|
|
583
|
+
return true;
|
|
584
|
+
}
|
|
585
|
+
function removePendingSource(e, t) {
|
|
586
|
+
if (e.Ie) {
|
|
587
|
+
if (e.Ie !== t) return false;
|
|
588
|
+
e.Ie = void 0;
|
|
589
|
+
return true;
|
|
590
|
+
}
|
|
591
|
+
if (!e.pe?.delete(t)) return false;
|
|
592
|
+
if (e.pe.size === 1) {
|
|
593
|
+
e.Ie = e.pe.values().next().value;
|
|
594
|
+
e.pe = void 0;
|
|
595
|
+
} else if (e.pe.size === 0) {
|
|
596
|
+
e.pe = void 0;
|
|
597
|
+
}
|
|
598
|
+
return true;
|
|
599
|
+
}
|
|
600
|
+
function clearPendingSources(e) {
|
|
601
|
+
e.Ie = void 0;
|
|
602
|
+
e.pe?.clear();
|
|
603
|
+
e.pe = void 0;
|
|
604
|
+
}
|
|
605
|
+
function setPendingError(e, t, n) {
|
|
606
|
+
if (!t) {
|
|
607
|
+
e.le = null;
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
if (n instanceof NotReadyError && n.source === t) {
|
|
611
|
+
e.le = n;
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
const i = e.le;
|
|
615
|
+
if (!(i instanceof NotReadyError) || i.source !== t) {
|
|
616
|
+
e.le = new NotReadyError(t);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
function forEachDependent(e, t) {
|
|
620
|
+
for (let n = e.I; n !== null; n = n.p) t(n.h);
|
|
621
|
+
for (let n = e.A; n !== null; n = n.N) {
|
|
622
|
+
for (let e2 = n.I; e2 !== null; e2 = e2.p) t(e2.h);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
function settlePendingSource(e) {
|
|
626
|
+
let t = false;
|
|
627
|
+
const n = /* @__PURE__ */ new Set();
|
|
628
|
+
const settle = (i) => {
|
|
629
|
+
if (n.has(i) || !removePendingSource(i, e)) return;
|
|
630
|
+
n.add(i);
|
|
631
|
+
i.Ee = clock;
|
|
632
|
+
const r = i.Ie ?? i.pe?.values().next().value;
|
|
633
|
+
if (r) {
|
|
634
|
+
setPendingError(i, r);
|
|
635
|
+
updatePendingSignal(i);
|
|
636
|
+
} else {
|
|
637
|
+
i.Se &= ~STATUS_PENDING;
|
|
638
|
+
setPendingError(i);
|
|
639
|
+
updatePendingSignal(i);
|
|
640
|
+
if (i.he) {
|
|
641
|
+
if (i.W === EFFECT_TRACKED) {
|
|
642
|
+
const e2 = i;
|
|
643
|
+
if (!e2.H) {
|
|
644
|
+
e2.H = true;
|
|
645
|
+
e2.F.enqueue(EFFECT_USER, e2.M);
|
|
646
|
+
}
|
|
647
|
+
} else {
|
|
648
|
+
const e2 = i.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
649
|
+
if (e2.P > i.o) e2.P = i.o;
|
|
650
|
+
insertIntoHeap(i, e2);
|
|
651
|
+
}
|
|
652
|
+
t = true;
|
|
653
|
+
}
|
|
654
|
+
i.he = false;
|
|
655
|
+
}
|
|
656
|
+
forEachDependent(i, settle);
|
|
657
|
+
};
|
|
658
|
+
forEachDependent(e, settle);
|
|
659
|
+
if (t) schedule();
|
|
502
660
|
}
|
|
503
661
|
function handleAsync(e, t, n) {
|
|
504
662
|
const i = typeof t === "object" && t !== null;
|
|
505
663
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
506
664
|
const s = !r && i && untrack(() => typeof t.then === "function");
|
|
507
665
|
if (!s && !r) {
|
|
508
|
-
e.
|
|
666
|
+
e.Ae = null;
|
|
509
667
|
return t;
|
|
510
668
|
}
|
|
511
|
-
e.
|
|
669
|
+
e.Ae = t;
|
|
512
670
|
let o;
|
|
513
671
|
const handleError = (n2) => {
|
|
514
|
-
if (e.
|
|
515
|
-
globalQueue.initTransition(e
|
|
672
|
+
if (e.Ae !== t) return;
|
|
673
|
+
globalQueue.initTransition(resolveTransition(e));
|
|
516
674
|
notifyStatus(e, n2 instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n2);
|
|
517
|
-
e.
|
|
675
|
+
e.Ee = clock;
|
|
518
676
|
};
|
|
519
677
|
const asyncWrite = (i2, r2) => {
|
|
520
|
-
if (e.
|
|
678
|
+
if (e.Ae !== t) return;
|
|
521
679
|
if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
522
|
-
globalQueue.initTransition(e
|
|
680
|
+
globalQueue.initTransition(resolveTransition(e));
|
|
523
681
|
clearStatus(e);
|
|
524
682
|
const s2 = resolveLane(e);
|
|
525
|
-
if (s2) s2.
|
|
526
|
-
if (e.
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
e.fe = i2;
|
|
683
|
+
if (s2) s2.k.delete(e);
|
|
684
|
+
if (e.ee !== void 0) {
|
|
685
|
+
if (e.ee !== void 0 && e.ee !== NOT_PENDING) e.X = i2;
|
|
686
|
+
else {
|
|
687
|
+
e.J = i2;
|
|
531
688
|
insertSubs(e);
|
|
532
689
|
}
|
|
533
|
-
e.
|
|
690
|
+
e.Ee = clock;
|
|
534
691
|
} else if (s2) {
|
|
535
|
-
const t2 = e.
|
|
536
|
-
const n2 = e.
|
|
692
|
+
const t2 = e.J;
|
|
693
|
+
const n2 = e.Ne;
|
|
537
694
|
if (!n2 || !n2(i2, t2)) {
|
|
538
|
-
e.
|
|
539
|
-
e.
|
|
540
|
-
if (e.
|
|
541
|
-
setSignal(e.
|
|
695
|
+
e.J = i2;
|
|
696
|
+
e.Ee = clock;
|
|
697
|
+
if (e.Pe) {
|
|
698
|
+
setSignal(e.Pe, i2);
|
|
542
699
|
}
|
|
543
700
|
insertSubs(e, true);
|
|
544
701
|
}
|
|
545
702
|
} else {
|
|
546
703
|
setSignal(e, () => i2);
|
|
547
704
|
}
|
|
705
|
+
settlePendingSource(e);
|
|
548
706
|
schedule();
|
|
549
707
|
flush();
|
|
550
708
|
r2?.();
|
|
@@ -564,7 +722,7 @@ function handleAsync(e, t, n) {
|
|
|
564
722
|
);
|
|
565
723
|
i2 = false;
|
|
566
724
|
if (!n2) {
|
|
567
|
-
globalQueue.initTransition(e
|
|
725
|
+
globalQueue.initTransition(resolveTransition(e));
|
|
568
726
|
throw new NotReadyError(context);
|
|
569
727
|
}
|
|
570
728
|
}
|
|
@@ -598,93 +756,66 @@ function handleAsync(e, t, n) {
|
|
|
598
756
|
};
|
|
599
757
|
const r2 = iterate();
|
|
600
758
|
if (!i2 && !r2) {
|
|
601
|
-
globalQueue.initTransition(e
|
|
759
|
+
globalQueue.initTransition(resolveTransition(e));
|
|
602
760
|
throw new NotReadyError(context);
|
|
603
761
|
}
|
|
604
762
|
}
|
|
605
763
|
return o;
|
|
606
764
|
}
|
|
607
|
-
function clearStatus(e) {
|
|
608
|
-
e
|
|
609
|
-
e.
|
|
765
|
+
function clearStatus(e, t = false) {
|
|
766
|
+
clearPendingSources(e);
|
|
767
|
+
e.he = false;
|
|
768
|
+
e.Se = t ? 0 : e.Se & STATUS_UNINITIALIZED;
|
|
769
|
+
setPendingError(e);
|
|
610
770
|
updatePendingSignal(e);
|
|
611
|
-
e.
|
|
771
|
+
e.ge?.();
|
|
612
772
|
}
|
|
613
773
|
function notifyStatus(e, t, n, i, r) {
|
|
614
774
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
615
775
|
n = new StatusError(e, n);
|
|
616
|
-
const s = n instanceof NotReadyError
|
|
617
|
-
const o =
|
|
618
|
-
const u =
|
|
776
|
+
const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : void 0;
|
|
777
|
+
const o = s === e;
|
|
778
|
+
const u = t === STATUS_PENDING && e.ee !== void 0 && !o;
|
|
779
|
+
const c = u && hasActiveOverride(e);
|
|
619
780
|
if (!i) {
|
|
620
|
-
|
|
621
|
-
|
|
781
|
+
if (t === STATUS_PENDING && s) {
|
|
782
|
+
addPendingSource(e, s);
|
|
783
|
+
e.Se = STATUS_PENDING | e.Se & STATUS_UNINITIALIZED;
|
|
784
|
+
setPendingError(e, s, n);
|
|
785
|
+
} else {
|
|
786
|
+
clearPendingSources(e);
|
|
787
|
+
e.Se = t | (t !== STATUS_ERROR ? e.Se & STATUS_UNINITIALIZED : 0);
|
|
788
|
+
e.le = n;
|
|
789
|
+
}
|
|
622
790
|
updatePendingSignal(e);
|
|
623
791
|
}
|
|
624
792
|
if (r && !i) {
|
|
625
793
|
assignOrMergeLane(e, r);
|
|
626
794
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
795
|
+
const a = i || c;
|
|
796
|
+
const f = i || u ? void 0 : r;
|
|
797
|
+
if (e.ge) {
|
|
798
|
+
if (i && t === STATUS_PENDING) {
|
|
799
|
+
return;
|
|
631
800
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
const l = i || o ? void 0 : r;
|
|
635
|
-
if (e.Ae) {
|
|
636
|
-
if (c) {
|
|
637
|
-
e.Ae(t, n);
|
|
801
|
+
if (a) {
|
|
802
|
+
e.ge(t, n);
|
|
638
803
|
} else {
|
|
639
|
-
e.
|
|
804
|
+
e.ge();
|
|
640
805
|
}
|
|
641
806
|
return;
|
|
642
807
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
if (
|
|
646
|
-
!
|
|
647
|
-
notifyStatus(
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
for (let i2 = e.A; i2 !== null; i2 = i2.P) {
|
|
651
|
-
for (let e2 = i2.I; e2 !== null; e2 = e2.p) {
|
|
652
|
-
e2.h.J = clock;
|
|
653
|
-
if (e2.h.X !== n) {
|
|
654
|
-
!e2.h.ne && globalQueue.F.push(e2.h);
|
|
655
|
-
notifyStatus(e2.h, t, n, c, l);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
function unlinkSubs(e) {
|
|
661
|
-
const t = e.V;
|
|
662
|
-
const n = e.D;
|
|
663
|
-
const i = e.p;
|
|
664
|
-
const r = e.Pe;
|
|
665
|
-
if (i !== null) i.Pe = r;
|
|
666
|
-
else t.Ne = r;
|
|
667
|
-
if (r !== null) r.p = i;
|
|
668
|
-
else {
|
|
669
|
-
t.I = i;
|
|
670
|
-
if (i === null) {
|
|
671
|
-
t.ge?.();
|
|
672
|
-
t.L && !t.Ce && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
808
|
+
forEachDependent(e, (e2) => {
|
|
809
|
+
e2.Ee = clock;
|
|
810
|
+
if (t === STATUS_PENDING && s && e2.Ie !== s && !e2.pe?.has(s) || t !== STATUS_PENDING && (e2.le !== n || e2.Ie || e2.pe)) {
|
|
811
|
+
if (!a && !e2.K) globalQueue.se.push(e2);
|
|
812
|
+
notifyStatus(e2, t, n, a, f);
|
|
673
813
|
}
|
|
674
|
-
}
|
|
675
|
-
return n;
|
|
676
|
-
}
|
|
677
|
-
function unobserved(e) {
|
|
678
|
-
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
679
|
-
let t = e.C;
|
|
680
|
-
while (t !== null) {
|
|
681
|
-
t = unlinkSubs(t);
|
|
682
|
-
}
|
|
683
|
-
e.C = null;
|
|
684
|
-
disposeChildren(e, true);
|
|
814
|
+
});
|
|
685
815
|
}
|
|
816
|
+
var externalSourceConfig = null;
|
|
686
817
|
function markDisposal(e) {
|
|
687
|
-
let t = e.
|
|
818
|
+
let t = e.Ce;
|
|
688
819
|
while (t) {
|
|
689
820
|
t.O |= REACTIVE_ZOMBIE;
|
|
690
821
|
if (t.O & REACTIVE_IN_HEAP) {
|
|
@@ -692,15 +823,15 @@ function markDisposal(e) {
|
|
|
692
823
|
insertIntoHeap(t, zombieQueue);
|
|
693
824
|
}
|
|
694
825
|
markDisposal(t);
|
|
695
|
-
t = t.
|
|
826
|
+
t = t.De;
|
|
696
827
|
}
|
|
697
828
|
}
|
|
698
829
|
function disposeChildren(e, t = false, n) {
|
|
699
830
|
if (e.O & REACTIVE_DISPOSED) return;
|
|
700
831
|
if (t) e.O = REACTIVE_DISPOSED;
|
|
701
|
-
let i = n ? e.
|
|
832
|
+
let i = n ? e.me : e.Ce;
|
|
702
833
|
while (i) {
|
|
703
|
-
const e2 = i.
|
|
834
|
+
const e2 = i.De;
|
|
704
835
|
if (i.C) {
|
|
705
836
|
const e3 = i;
|
|
706
837
|
deleteFromHeap(e3, e3.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
@@ -715,16 +846,15 @@ function disposeChildren(e, t = false, n) {
|
|
|
715
846
|
i = e2;
|
|
716
847
|
}
|
|
717
848
|
if (n) {
|
|
718
|
-
e.
|
|
849
|
+
e.me = null;
|
|
719
850
|
} else {
|
|
720
|
-
e.
|
|
721
|
-
e.ve =
|
|
722
|
-
e.we = 0;
|
|
851
|
+
e.Ce = null;
|
|
852
|
+
e.ve = 0;
|
|
723
853
|
}
|
|
724
854
|
runDisposal(e, n);
|
|
725
855
|
}
|
|
726
856
|
function runDisposal(e, t) {
|
|
727
|
-
let n = t ? e.
|
|
857
|
+
let n = t ? e.we : e.be;
|
|
728
858
|
if (!n) return;
|
|
729
859
|
if (Array.isArray(n)) {
|
|
730
860
|
for (let e2 = 0; e2 < n.length; e2++) {
|
|
@@ -734,41 +864,67 @@ function runDisposal(e, t) {
|
|
|
734
864
|
} else {
|
|
735
865
|
n.call(n);
|
|
736
866
|
}
|
|
737
|
-
t ? e.
|
|
867
|
+
t ? e.we = null : e.be = null;
|
|
868
|
+
}
|
|
869
|
+
function unlinkSubs(e) {
|
|
870
|
+
const t = e.m;
|
|
871
|
+
const n = e.D;
|
|
872
|
+
const i = e.p;
|
|
873
|
+
const r = e.Ue;
|
|
874
|
+
if (i !== null) i.Ue = r;
|
|
875
|
+
else t.ke = r;
|
|
876
|
+
if (r !== null) r.p = i;
|
|
877
|
+
else {
|
|
878
|
+
t.I = i;
|
|
879
|
+
if (i === null) {
|
|
880
|
+
t.Ge?.();
|
|
881
|
+
t.L && !t.xe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
return n;
|
|
885
|
+
}
|
|
886
|
+
function unobserved(e) {
|
|
887
|
+
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
888
|
+
let t = e.C;
|
|
889
|
+
while (t !== null) {
|
|
890
|
+
t = unlinkSubs(t);
|
|
891
|
+
}
|
|
892
|
+
e.C = null;
|
|
893
|
+
disposeChildren(e, true);
|
|
738
894
|
}
|
|
739
|
-
GlobalQueue.
|
|
740
|
-
GlobalQueue.
|
|
895
|
+
GlobalQueue.oe = recompute;
|
|
896
|
+
GlobalQueue.ue = disposeChildren;
|
|
741
897
|
var tracking = false;
|
|
742
898
|
var context = null;
|
|
743
899
|
var currentOptimisticLane = null;
|
|
744
900
|
function recompute(e, t = false) {
|
|
745
|
-
const n = e.
|
|
901
|
+
const n = e.W;
|
|
746
902
|
if (!t) {
|
|
747
|
-
if (e.
|
|
748
|
-
globalQueue.initTransition(e.
|
|
903
|
+
if (e.K && (!n || activeTransition) && activeTransition !== e.K)
|
|
904
|
+
globalQueue.initTransition(e.K);
|
|
749
905
|
deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
750
|
-
if (e.
|
|
906
|
+
if (e.K || n === EFFECT_TRACKED) disposeChildren(e);
|
|
751
907
|
else {
|
|
752
908
|
markDisposal(e);
|
|
753
|
-
e.
|
|
754
|
-
e.
|
|
755
|
-
e.
|
|
756
|
-
e.
|
|
757
|
-
e.
|
|
909
|
+
e.we = e.be;
|
|
910
|
+
e.me = e.Ce;
|
|
911
|
+
e.be = null;
|
|
912
|
+
e.Ce = null;
|
|
913
|
+
e.ve = 0;
|
|
758
914
|
}
|
|
759
915
|
}
|
|
760
916
|
const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
|
|
761
|
-
const r =
|
|
762
|
-
const s = !!(e.
|
|
917
|
+
const r = e.ee !== void 0 && e.ee !== NOT_PENDING;
|
|
918
|
+
const s = !!(e.Se & STATUS_PENDING);
|
|
763
919
|
const o = context;
|
|
764
920
|
context = e;
|
|
765
921
|
e.ye = null;
|
|
766
922
|
e.O = REACTIVE_RECOMPUTING_DEPS;
|
|
767
|
-
e.
|
|
768
|
-
let u = e.
|
|
923
|
+
e.Ee = clock;
|
|
924
|
+
let u = e.X === NOT_PENDING ? e.J : e.X;
|
|
769
925
|
let c = e.o;
|
|
770
|
-
let
|
|
771
|
-
let
|
|
926
|
+
let a = tracking;
|
|
927
|
+
let f = currentOptimisticLane;
|
|
772
928
|
tracking = true;
|
|
773
929
|
if (i) {
|
|
774
930
|
const t2 = resolveLane(e);
|
|
@@ -776,148 +932,153 @@ function recompute(e, t = false) {
|
|
|
776
932
|
}
|
|
777
933
|
try {
|
|
778
934
|
u = handleAsync(e, e.L(u));
|
|
779
|
-
clearStatus(e);
|
|
780
|
-
const
|
|
781
|
-
if (
|
|
782
|
-
|
|
783
|
-
updatePendingSignal(
|
|
935
|
+
clearStatus(e, t);
|
|
936
|
+
const n2 = resolveLane(e);
|
|
937
|
+
if (n2) {
|
|
938
|
+
n2.k.delete(e);
|
|
939
|
+
updatePendingSignal(n2.te);
|
|
784
940
|
}
|
|
785
941
|
} catch (t2) {
|
|
786
942
|
if (t2 instanceof NotReadyError && currentOptimisticLane) {
|
|
787
943
|
const t3 = findLane(currentOptimisticLane);
|
|
788
|
-
if (t3.
|
|
789
|
-
t3.
|
|
790
|
-
e.
|
|
791
|
-
updatePendingSignal(t3.
|
|
944
|
+
if (t3.te !== e) {
|
|
945
|
+
t3.k.add(e);
|
|
946
|
+
e.q = t3;
|
|
947
|
+
updatePendingSignal(t3.te);
|
|
792
948
|
}
|
|
793
949
|
}
|
|
950
|
+
if (t2 instanceof NotReadyError) e.he = true;
|
|
794
951
|
notifyStatus(
|
|
795
952
|
e,
|
|
796
953
|
t2 instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
797
954
|
t2,
|
|
798
955
|
void 0,
|
|
799
|
-
t2 instanceof NotReadyError ? e.
|
|
956
|
+
t2 instanceof NotReadyError ? e.q : void 0
|
|
800
957
|
);
|
|
801
958
|
} finally {
|
|
802
|
-
tracking =
|
|
959
|
+
tracking = a;
|
|
803
960
|
e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
|
|
804
961
|
context = o;
|
|
805
962
|
}
|
|
806
|
-
if (!e.
|
|
963
|
+
if (!e.le) {
|
|
807
964
|
const o2 = e.ye;
|
|
808
|
-
let
|
|
809
|
-
if (
|
|
965
|
+
let a2 = o2 !== null ? o2.D : e.C;
|
|
966
|
+
if (a2 !== null) {
|
|
810
967
|
do {
|
|
811
|
-
|
|
812
|
-
} while (
|
|
968
|
+
a2 = unlinkSubs(a2);
|
|
969
|
+
} while (a2 !== null);
|
|
813
970
|
if (o2 !== null) o2.D = null;
|
|
814
971
|
else e.C = null;
|
|
815
972
|
}
|
|
816
|
-
const
|
|
817
|
-
const
|
|
818
|
-
if (
|
|
819
|
-
const o3 = r ? e.
|
|
820
|
-
if (t || n && activeTransition !== e.
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
}
|
|
827
|
-
if (
|
|
828
|
-
|
|
829
|
-
}
|
|
973
|
+
const f2 = r ? e.ee : e.X === NOT_PENDING ? e.J : e.X;
|
|
974
|
+
const l = !e.Ne || !e.Ne(f2, u);
|
|
975
|
+
if (l) {
|
|
976
|
+
const o3 = r ? e.ee : void 0;
|
|
977
|
+
if (t || n && activeTransition !== e.K || i) {
|
|
978
|
+
e.J = u;
|
|
979
|
+
if (r && i) {
|
|
980
|
+
e.ee = u;
|
|
981
|
+
e.X = u;
|
|
982
|
+
}
|
|
983
|
+
} else e.X = u;
|
|
984
|
+
if (r && !i && s && !e._e) e.ee = u;
|
|
985
|
+
if (!r || i || e.ee !== o3) insertSubs(e, i || r);
|
|
830
986
|
} else if (r) {
|
|
831
|
-
e.
|
|
987
|
+
e.X = u;
|
|
832
988
|
} else if (e.o != c) {
|
|
833
989
|
for (let t2 = e.I; t2 !== null; t2 = t2.p) {
|
|
834
990
|
insertIntoHeapHeight(t2.h, t2.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
835
991
|
}
|
|
836
992
|
}
|
|
837
993
|
}
|
|
838
|
-
currentOptimisticLane =
|
|
839
|
-
(!t || e.
|
|
840
|
-
e.
|
|
994
|
+
currentOptimisticLane = f;
|
|
995
|
+
(!t || e.Se & STATUS_PENDING) && !e.K && !(activeTransition && r) && globalQueue.se.push(e);
|
|
996
|
+
e.K && n && activeTransition !== e.K && runInTransition(e.K, () => recompute(e));
|
|
841
997
|
}
|
|
842
998
|
function untrack(e, t) {
|
|
843
|
-
if (!tracking && true) return e();
|
|
999
|
+
if (!externalSourceConfig && !tracking && true) return e();
|
|
844
1000
|
const n = tracking;
|
|
845
1001
|
tracking = false;
|
|
846
1002
|
try {
|
|
1003
|
+
if (externalSourceConfig) return externalSourceConfig.untrack(e);
|
|
847
1004
|
return e();
|
|
848
1005
|
} finally {
|
|
849
1006
|
tracking = n;
|
|
850
1007
|
}
|
|
851
1008
|
}
|
|
852
1009
|
function setSignal(e, t) {
|
|
853
|
-
if (e.
|
|
854
|
-
const n = e.
|
|
855
|
-
const i =
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
1010
|
+
if (e.K && activeTransition !== e.K) globalQueue.initTransition(e.K);
|
|
1011
|
+
const n = e.ee !== void 0 && !projectionWriteActive;
|
|
1012
|
+
const i = e.ee !== void 0 && e.ee !== NOT_PENDING;
|
|
1013
|
+
const r = n ? i ? e.ee : e.J : e.X === NOT_PENDING ? e.J : e.X;
|
|
1014
|
+
if (typeof t === "function") t = t(r);
|
|
1015
|
+
const s = !e.Ne || !e.Ne(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
|
|
1016
|
+
if (!s) {
|
|
1017
|
+
if (n && i && e.L) {
|
|
860
1018
|
insertSubs(e, true);
|
|
861
1019
|
schedule();
|
|
862
1020
|
}
|
|
863
1021
|
return t;
|
|
864
1022
|
}
|
|
865
1023
|
if (n) {
|
|
866
|
-
const n2 =
|
|
867
|
-
if (
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
e.ae = e.fe;
|
|
872
|
-
}
|
|
873
|
-
if (!n2) {
|
|
874
|
-
globalQueue.$.push(e);
|
|
1024
|
+
const n2 = e.ee === NOT_PENDING;
|
|
1025
|
+
if (!n2) globalQueue.initTransition(resolveTransition(e));
|
|
1026
|
+
if (n2) {
|
|
1027
|
+
e.X = e.J;
|
|
1028
|
+
globalQueue.Y.push(e);
|
|
875
1029
|
}
|
|
876
|
-
e.
|
|
1030
|
+
e._e = true;
|
|
877
1031
|
const i2 = getOrCreateLane(e);
|
|
878
|
-
e.
|
|
879
|
-
e.
|
|
1032
|
+
e.q = i2;
|
|
1033
|
+
e.ee = t;
|
|
880
1034
|
} else {
|
|
881
|
-
if (e.
|
|
882
|
-
e.
|
|
1035
|
+
if (e.X === NOT_PENDING) globalQueue.se.push(e);
|
|
1036
|
+
e.X = t;
|
|
883
1037
|
}
|
|
884
1038
|
updatePendingSignal(e);
|
|
885
|
-
if (e.
|
|
886
|
-
setSignal(e.
|
|
1039
|
+
if (e.Pe) {
|
|
1040
|
+
setSignal(e.Pe, t);
|
|
887
1041
|
}
|
|
888
|
-
e.
|
|
1042
|
+
e.Ee = clock;
|
|
889
1043
|
insertSubs(e, n);
|
|
890
1044
|
schedule();
|
|
891
1045
|
return t;
|
|
892
1046
|
}
|
|
893
1047
|
function computePendingState(e) {
|
|
894
1048
|
const t = e;
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
1049
|
+
const n = e.V;
|
|
1050
|
+
if (n && e.X !== NOT_PENDING) {
|
|
1051
|
+
return !n.Ae && !(n.Se & STATUS_PENDING);
|
|
1052
|
+
}
|
|
1053
|
+
if (e.ee !== void 0 && e.ee !== NOT_PENDING) {
|
|
1054
|
+
if (t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
|
|
1055
|
+
if (e.Re) {
|
|
1056
|
+
const t2 = e.q ? findLane(e.q) : null;
|
|
1057
|
+
return !!(t2 && t2.k.size > 0);
|
|
900
1058
|
}
|
|
901
1059
|
return true;
|
|
902
1060
|
}
|
|
903
|
-
if (e.
|
|
904
|
-
|
|
1061
|
+
if (e.ee !== void 0 && e.ee === NOT_PENDING && !e.Re) {
|
|
1062
|
+
return false;
|
|
1063
|
+
}
|
|
1064
|
+
if (e.X !== NOT_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
|
|
1065
|
+
return !!(t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED));
|
|
905
1066
|
}
|
|
906
1067
|
function updatePendingSignal(e) {
|
|
907
|
-
if (e.
|
|
1068
|
+
if (e.Qe) {
|
|
908
1069
|
const t = computePendingState(e);
|
|
909
|
-
const n = e.
|
|
1070
|
+
const n = e.Qe;
|
|
910
1071
|
setSignal(n, t);
|
|
911
|
-
if (!t && n.
|
|
1072
|
+
if (!t && n.q) {
|
|
912
1073
|
const t2 = resolveLane(e);
|
|
913
|
-
if (t2 && t2.
|
|
914
|
-
const e2 = findLane(n.
|
|
1074
|
+
if (t2 && t2.k.size > 0) {
|
|
1075
|
+
const e2 = findLane(n.q);
|
|
915
1076
|
if (e2 !== t2) {
|
|
916
1077
|
mergeLanes(t2, e2);
|
|
917
1078
|
}
|
|
918
1079
|
}
|
|
919
1080
|
signalLanes.delete(n);
|
|
920
|
-
n.
|
|
1081
|
+
n.q = void 0;
|
|
921
1082
|
}
|
|
922
1083
|
}
|
|
923
1084
|
}
|