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