@solidjs/signals 2.0.0-beta.13 → 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 +4 -6
- package/dist/dev.js +376 -217
- package/dist/node.cjs +1634 -1528
- package/dist/prod.js +1400 -1299
- package/dist/types/core/core.d.ts +6 -22
- 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/index.d.ts +1 -1
- package/dist/types/store/projection.d.ts +2 -2
- package/dist/types/store/store.d.ts +7 -2
- package/dist/types-cjs/core/core.d.cts +6 -22
- 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/index.d.cts +1 -1
- package/dist/types-cjs/store/projection.d.cts +2 -2
- package/dist/types-cjs/store/store.d.cts +7 -2
- 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.O) t.O = i;
|
|
79
|
-
}
|
|
80
|
-
function insertIntoHeap(e, t) {
|
|
81
|
-
let n = e._;
|
|
82
|
-
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_MANUAL_WRITE)) return;
|
|
83
|
-
if (n & REACTIVE_CHECK) {
|
|
84
|
-
e._ = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
85
|
-
} else e._ = n | REACTIVE_IN_HEAP;
|
|
86
|
-
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
87
|
-
}
|
|
88
|
-
function insertIntoHeapHeight(e, t) {
|
|
89
|
-
let n = e._;
|
|
90
|
-
if (
|
|
91
|
-
n &
|
|
92
|
-
(REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT | REACTIVE_MANUAL_WRITE)
|
|
93
|
-
)
|
|
94
|
-
return;
|
|
95
|
-
e._ = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
96
|
-
actualInsertIntoHeap(e, t);
|
|
97
|
-
}
|
|
98
|
-
function deleteFromHeap(e, t) {
|
|
99
|
-
const n = e._;
|
|
100
|
-
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
101
|
-
e._ = 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 s = n ?? r;
|
|
108
|
-
if (e === r) t.l[i] = n;
|
|
109
|
-
else e.S.T = n;
|
|
110
|
-
s.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.O; t++) {
|
|
119
|
-
for (let n = e.l[t]; n !== undefined; n = n.T) {
|
|
120
|
-
if (n._ & REACTIVE_IN_HEAP) markNode(n);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function markNode(e, t = REACTIVE_DIRTY) {
|
|
125
|
-
const n = e._;
|
|
126
|
-
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
127
|
-
e._ = (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.O; e.C++) {
|
|
142
|
-
let n = e.l[e.C];
|
|
143
|
-
while (n !== undefined) {
|
|
144
|
-
if (n._ & REACTIVE_IN_HEAP) t(n);
|
|
145
|
-
else adjustHeight(n, e);
|
|
146
|
-
n = e.l[e.C];
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
e.O = 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
|
|
598
|
-
if (
|
|
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
|
-
const
|
|
966
|
-
if (
|
|
967
|
-
const
|
|
968
|
-
if (n !== null) n.
|
|
969
|
-
else t.
|
|
970
|
-
if (
|
|
971
|
-
else e.
|
|
961
|
+
const o = e.Ue;
|
|
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;
|
|
@@ -1086,37 +1082,39 @@ function handleAsync(e, t, n) {
|
|
|
1086
1082
|
return t;
|
|
1087
1083
|
}
|
|
1088
1084
|
e.ve = t;
|
|
1089
|
-
let
|
|
1085
|
+
let o;
|
|
1090
1086
|
const handleError = 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
|
|
1096
|
+
const o = !!(e.fe & STATUS_UNINITIALIZED);
|
|
1101
1097
|
trimStaleDeps(e);
|
|
1102
1098
|
clearStatus(e);
|
|
1103
|
-
const
|
|
1104
|
-
if (
|
|
1105
|
-
if (n)
|
|
1106
|
-
|
|
1107
|
-
if (
|
|
1099
|
+
const s = resolveLane(e);
|
|
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.
|
|
1113
|
-
} else if (
|
|
1114
|
-
const t = e.
|
|
1115
|
-
const n = e.
|
|
1110
|
+
e.le = clock;
|
|
1111
|
+
} else if (s) {
|
|
1112
|
+
const t = e.G;
|
|
1113
|
+
const n = e.Z;
|
|
1116
1114
|
const r = e.ke;
|
|
1117
|
-
if ((!t &&
|
|
1118
|
-
e.
|
|
1119
|
-
e.
|
|
1115
|
+
if ((!t && o) || !r || !r(i, n)) {
|
|
1116
|
+
e.Z = i;
|
|
1117
|
+
e.le = clock;
|
|
1120
1118
|
if (e.Fe) {
|
|
1121
1119
|
setSignal(e.Fe, i);
|
|
1122
1120
|
}
|
|
@@ -1136,7 +1134,7 @@ function handleAsync(e, t, n) {
|
|
|
1136
1134
|
t.then(
|
|
1137
1135
|
e => {
|
|
1138
1136
|
if (i) {
|
|
1139
|
-
|
|
1137
|
+
o = e;
|
|
1140
1138
|
n = true;
|
|
1141
1139
|
} else asyncWrite(e);
|
|
1142
1140
|
},
|
|
@@ -1165,13 +1163,13 @@ function handleAsync(e, t, n) {
|
|
|
1165
1163
|
} catch {}
|
|
1166
1164
|
});
|
|
1167
1165
|
const iterate = () => {
|
|
1168
|
-
let
|
|
1166
|
+
let s,
|
|
1169
1167
|
u = false,
|
|
1170
1168
|
c = true;
|
|
1171
1169
|
n.next().then(
|
|
1172
1170
|
n => {
|
|
1173
1171
|
if (c) {
|
|
1174
|
-
|
|
1172
|
+
s = n;
|
|
1175
1173
|
u = true;
|
|
1176
1174
|
if (n.done) r = true;
|
|
1177
1175
|
} else if (e.ve !== t) {
|
|
@@ -1191,45 +1189,45 @@ function handleAsync(e, t, n) {
|
|
|
1191
1189
|
}
|
|
1192
1190
|
);
|
|
1193
1191
|
c = false;
|
|
1194
|
-
if (u && !
|
|
1195
|
-
|
|
1192
|
+
if (u && !s.done) {
|
|
1193
|
+
o = s.value;
|
|
1196
1194
|
i = true;
|
|
1197
1195
|
return iterate();
|
|
1198
1196
|
}
|
|
1199
|
-
return u &&
|
|
1197
|
+
return u && s.done;
|
|
1200
1198
|
};
|
|
1201
|
-
const
|
|
1202
|
-
if (!i && !
|
|
1199
|
+
const s = iterate();
|
|
1200
|
+
if (!i && !s) {
|
|
1203
1201
|
globalQueue.initTransition(resolveTransition(e));
|
|
1204
1202
|
throw new NotReadyError(context);
|
|
1205
1203
|
}
|
|
1206
1204
|
}
|
|
1207
|
-
return
|
|
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
|
-
const
|
|
1221
|
-
const
|
|
1222
|
-
const u = t === STATUS_PENDING && e.
|
|
1218
|
+
const o = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
1219
|
+
const s = o === e;
|
|
1220
|
+
const u = t === STATUS_PENDING && e.R !== undefined && !s;
|
|
1223
1221
|
const c = u && hasActiveOverride(e);
|
|
1224
1222
|
if (!i) {
|
|
1225
|
-
if (t === STATUS_PENDING &&
|
|
1226
|
-
addPendingSource(e,
|
|
1227
|
-
e.
|
|
1228
|
-
setPendingError(e,
|
|
1223
|
+
if (t === STATUS_PENDING && o) {
|
|
1224
|
+
addPendingSource(e, o);
|
|
1225
|
+
e.fe = STATUS_PENDING | (e.fe & STATUS_UNINITIALIZED);
|
|
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 &&
|
|
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
|
});
|
|
@@ -1268,11 +1266,11 @@ function enableExternalSource(e) {
|
|
|
1268
1266
|
externalSourceConfig = {
|
|
1269
1267
|
factory: (n, i) => {
|
|
1270
1268
|
const r = e(n, i);
|
|
1271
|
-
const
|
|
1269
|
+
const o = t(e => r.track(e), i);
|
|
1272
1270
|
return {
|
|
1273
|
-
track: e =>
|
|
1271
|
+
track: e => o.track(e),
|
|
1274
1272
|
dispose() {
|
|
1275
|
-
|
|
1273
|
+
o.dispose();
|
|
1276
1274
|
r.dispose();
|
|
1277
1275
|
}
|
|
1278
1276
|
};
|
|
@@ -1283,23 +1281,22 @@ 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;
|
|
1294
1291
|
let context = null;
|
|
1295
1292
|
let currentOptimisticLane = null;
|
|
1296
|
-
let
|
|
1293
|
+
let pendingCheckSources = null;
|
|
1297
1294
|
let snapshotCaptureActive = false;
|
|
1298
1295
|
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
|
|
1369
|
-
const
|
|
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,189 +1430,189 @@ 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.
|
|
1447
|
-
const a = (!n &&
|
|
1443
|
+
const u = r ? e.R : e.m === NOT_PENDING ? e.Z : e.m;
|
|
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
|
|
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 &&
|
|
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;
|
|
1539
1536
|
}
|
|
1540
|
-
function createEffectNode(e, t, n, i, r,
|
|
1541
|
-
const
|
|
1537
|
+
function createEffectNode(e, t, n, i, r, o) {
|
|
1538
|
+
const s = o?.transparent ?? false;
|
|
1542
1539
|
const u = {
|
|
1543
|
-
id:
|
|
1544
|
-
|
|
1545
|
-
(
|
|
1546
|
-
(
|
|
1547
|
-
(
|
|
1540
|
+
id: o?.id ?? (s ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1541
|
+
ue:
|
|
1542
|
+
(s ? CONFIG_TRANSPARENT : 0) |
|
|
1543
|
+
(o?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
|
|
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,198 +1676,214 @@ 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
|
-
|
|
1697
|
-
if (
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1693
|
+
let i = context;
|
|
1694
|
+
if (i?.pe) i = i.he;
|
|
1695
|
+
const r = t || e;
|
|
1696
|
+
const o = e;
|
|
1697
|
+
if (typeof o.se === "function") {
|
|
1698
|
+
const t = e;
|
|
1699
|
+
if (t.M & REACTIVE_LAZY) {
|
|
1700
|
+
t.M &= ~REACTIVE_LAZY;
|
|
1701
|
+
recompute(t, true);
|
|
1702
|
+
} else if (t.M & REACTIVE_DISPOSED) {
|
|
1703
|
+
recompute(t, true);
|
|
1704
|
+
} else {
|
|
1705
|
+
updateIfNecessary(t);
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
if (i && r.fe & STATUS_PENDING && r.fe & STATUS_UNINITIALIZED) {
|
|
1709
|
+
if (tracking && e !== i) link(e, i);
|
|
1701
1710
|
pendingCheckActive = n;
|
|
1702
|
-
throw
|
|
1711
|
+
throw r.ce;
|
|
1703
1712
|
}
|
|
1704
|
-
if (t && e.
|
|
1705
|
-
if (e.
|
|
1713
|
+
if (t && e.R !== undefined) {
|
|
1714
|
+
if (e.R !== NOT_PENDING && (t.ve || !!(t.fe & STATUS_PENDING))) {
|
|
1706
1715
|
foundPending = true;
|
|
1707
1716
|
}
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
if (
|
|
1711
|
-
read(getPendingSignal(e));
|
|
1712
|
-
read(getPendingSignal(t));
|
|
1717
|
+
collectPendingSources(e);
|
|
1718
|
+
collectPendingSources(t);
|
|
1719
|
+
if (i && tracking) link(e, i);
|
|
1713
1720
|
} else {
|
|
1714
|
-
|
|
1715
|
-
if (t
|
|
1721
|
+
collectPendingSources(e);
|
|
1722
|
+
if (t) collectPendingSources(t);
|
|
1716
1723
|
}
|
|
1717
1724
|
pendingCheckActive = n;
|
|
1718
|
-
return e.ue;
|
|
1719
1725
|
}
|
|
1720
1726
|
let t = context;
|
|
1721
|
-
if (t?.
|
|
1727
|
+
if (t?.pe) t = t.he;
|
|
1722
1728
|
const n = e;
|
|
1723
|
-
if (typeof n.
|
|
1729
|
+
if (typeof n.se === "function") {
|
|
1724
1730
|
const t = e;
|
|
1725
|
-
if (t.
|
|
1726
|
-
t.
|
|
1731
|
+
if (t.M & REACTIVE_LAZY) {
|
|
1732
|
+
t.M &= ~REACTIVE_LAZY;
|
|
1727
1733
|
recompute(t, true);
|
|
1728
|
-
} else if (t.
|
|
1734
|
+
} else if (t.M & REACTIVE_DISPOSED) {
|
|
1729
1735
|
recompute(t, true);
|
|
1730
1736
|
}
|
|
1731
1737
|
}
|
|
1732
|
-
const i = e.
|
|
1738
|
+
const i = e.Ie || e;
|
|
1733
1739
|
if (
|
|
1734
|
-
!n.
|
|
1740
|
+
!n.se &&
|
|
1735
1741
|
i === e &&
|
|
1736
|
-
e.
|
|
1737
|
-
e.
|
|
1742
|
+
e.R === undefined &&
|
|
1743
|
+
e.ae === undefined &&
|
|
1738
1744
|
activeTransition === null &&
|
|
1739
1745
|
currentOptimisticLane === null &&
|
|
1740
1746
|
!snapshotCaptureActive &&
|
|
1741
1747
|
true
|
|
1742
1748
|
) {
|
|
1743
1749
|
if (t && tracking) link(e, t);
|
|
1744
|
-
return !t || e.
|
|
1750
|
+
return !t || e.m === NOT_PENDING ? e.Z : e.m;
|
|
1745
1751
|
}
|
|
1746
1752
|
if (t && tracking) {
|
|
1747
1753
|
link(e, t);
|
|
1748
|
-
if (i.
|
|
1749
|
-
const n = e.
|
|
1750
|
-
if (i.
|
|
1754
|
+
if (i.se) {
|
|
1755
|
+
const n = e.M & REACTIVE_ZOMBIE;
|
|
1756
|
+
if (i.H >= (n ? zombieQueue.h : dirtyQueue.h)) {
|
|
1751
1757
|
markNode(t);
|
|
1752
1758
|
markHeap(n ? zombieQueue : dirtyQueue);
|
|
1753
1759
|
updateIfNecessary(i);
|
|
1754
1760
|
}
|
|
1755
|
-
const r = i.
|
|
1756
|
-
if (r >= t.
|
|
1757
|
-
t.
|
|
1761
|
+
const r = i.H;
|
|
1762
|
+
if (r >= t.H && e.q !== t) {
|
|
1763
|
+
t.H = r + 1;
|
|
1758
1764
|
}
|
|
1759
1765
|
}
|
|
1760
1766
|
}
|
|
1761
|
-
if (i.
|
|
1762
|
-
if (t && !(stale && i.
|
|
1767
|
+
if (i.fe & STATUS_PENDING) {
|
|
1768
|
+
if (t && !(stale && i.S && activeTransition !== i.S)) {
|
|
1763
1769
|
if (currentOptimisticLane) {
|
|
1764
|
-
const n = i.
|
|
1770
|
+
const n = i.i;
|
|
1765
1771
|
const r = findLane(currentOptimisticLane);
|
|
1766
1772
|
if (n && findLane(n) === r && !hasActiveOverride(i)) {
|
|
1767
1773
|
if (!tracking && e !== t) link(e, t);
|
|
1768
|
-
throw i.
|
|
1774
|
+
throw i.ce;
|
|
1769
1775
|
}
|
|
1770
1776
|
} else {
|
|
1771
1777
|
if (!tracking && e !== t) link(e, t);
|
|
1772
|
-
throw i.
|
|
1778
|
+
throw i.ce;
|
|
1773
1779
|
}
|
|
1774
|
-
} else if (t && i !== e && i.
|
|
1780
|
+
} else if (t && i !== e && i.fe & STATUS_UNINITIALIZED) {
|
|
1775
1781
|
if (!tracking && e !== t) link(e, t);
|
|
1776
|
-
throw i.
|
|
1777
|
-
} else if (!t && i.
|
|
1778
|
-
throw i.
|
|
1782
|
+
throw i.ce;
|
|
1783
|
+
} else if (!t && i.fe & STATUS_UNINITIALIZED) {
|
|
1784
|
+
throw i.ce;
|
|
1779
1785
|
}
|
|
1780
1786
|
}
|
|
1781
|
-
if (e.
|
|
1782
|
-
if (e.
|
|
1787
|
+
if (e.se && e.fe & STATUS_ERROR) {
|
|
1788
|
+
if (e.le < clock) {
|
|
1783
1789
|
recompute(e);
|
|
1784
1790
|
return read(e);
|
|
1785
|
-
} else throw e.
|
|
1791
|
+
} else throw e.ce;
|
|
1786
1792
|
}
|
|
1787
|
-
if (snapshotCaptureActive && t && t.
|
|
1788
|
-
const n = e.
|
|
1793
|
+
if (snapshotCaptureActive && t && t.ue & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
1794
|
+
const n = e.ae;
|
|
1789
1795
|
if (n !== undefined) {
|
|
1790
1796
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1791
|
-
const r = e.
|
|
1792
|
-
if (r !== i) t.
|
|
1797
|
+
const r = e.m !== NOT_PENDING ? e.m : e.Z;
|
|
1798
|
+
if (r !== i) t.M |= REACTIVE_SNAPSHOT_STALE;
|
|
1793
1799
|
return i;
|
|
1794
1800
|
}
|
|
1795
1801
|
}
|
|
1796
|
-
if (e.
|
|
1797
|
-
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.
|
|
1798
|
-
return e.
|
|
1802
|
+
if (e.R !== undefined && e.R !== NOT_PENDING) {
|
|
1803
|
+
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.Z;
|
|
1804
|
+
return e.R;
|
|
1799
1805
|
}
|
|
1800
1806
|
if (
|
|
1801
1807
|
activeTransition !== null &&
|
|
1802
1808
|
currentOptimisticLane !== null &&
|
|
1803
1809
|
!latestReadActive &&
|
|
1804
|
-
e.
|
|
1805
|
-
i === e &&
|
|
1806
|
-
!e.
|
|
1810
|
+
e.m !== NOT_PENDING &&
|
|
1811
|
+
(i === e || !!(i.M & REACTIVE_MANUAL_WRITE)) &&
|
|
1812
|
+
!e.se &&
|
|
1807
1813
|
t
|
|
1808
1814
|
) {
|
|
1809
|
-
activeTransition.
|
|
1810
|
-
return e.
|
|
1815
|
+
activeTransition.Y.add(t);
|
|
1816
|
+
return e.Z;
|
|
1811
1817
|
}
|
|
1812
1818
|
const r =
|
|
1813
1819
|
!t ||
|
|
1814
1820
|
(currentOptimisticLane !== null &&
|
|
1815
|
-
(e.
|
|
1816
|
-
e.
|
|
1817
|
-
(stale && e.
|
|
1818
|
-
? e.
|
|
1819
|
-
: 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;
|
|
1820
1826
|
if (
|
|
1821
1827
|
!t &&
|
|
1822
1828
|
i === e &&
|
|
1823
|
-
typeof n.
|
|
1824
|
-
e.
|
|
1825
|
-
!(i.
|
|
1826
|
-
!e.
|
|
1829
|
+
typeof n.se === "function" &&
|
|
1830
|
+
e.ue & CONFIG_AUTO_DISPOSE &&
|
|
1831
|
+
!(i.fe & STATUS_PENDING) &&
|
|
1832
|
+
!e.D
|
|
1827
1833
|
) {
|
|
1828
1834
|
unobserved(e);
|
|
1829
1835
|
}
|
|
1830
1836
|
return r;
|
|
1831
1837
|
}
|
|
1832
1838
|
function setSignal(e, t) {
|
|
1833
|
-
if (e.
|
|
1834
|
-
const n = e.
|
|
1835
|
-
const i = e.
|
|
1836
|
-
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;
|
|
1837
1843
|
if (typeof t === "function") t = t(r);
|
|
1838
|
-
const
|
|
1839
|
-
if (!
|
|
1840
|
-
if (n && i
|
|
1841
|
-
|
|
1842
|
-
|
|
1844
|
+
const o = !e.ke || !e.ke(r, t) || !!(e.fe & STATUS_UNINITIALIZED);
|
|
1845
|
+
if (!o) {
|
|
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
|
+
}
|
|
1843
1853
|
}
|
|
1844
1854
|
return t;
|
|
1845
1855
|
}
|
|
1846
1856
|
if (n) {
|
|
1847
|
-
const n = e.
|
|
1857
|
+
const n = e.R === NOT_PENDING;
|
|
1848
1858
|
if (!n) globalQueue.initTransition(resolveTransition(e));
|
|
1849
1859
|
if (n) {
|
|
1850
|
-
e.
|
|
1851
|
-
globalQueue.
|
|
1860
|
+
e.m = e.Z;
|
|
1861
|
+
globalQueue.P.push(e);
|
|
1852
1862
|
}
|
|
1853
|
-
e
|
|
1863
|
+
e.O = true;
|
|
1854
1864
|
const i = getOrCreateLane(e);
|
|
1855
|
-
e.
|
|
1856
|
-
e.
|
|
1865
|
+
e.i = i;
|
|
1866
|
+
e.R = t;
|
|
1857
1867
|
} else {
|
|
1858
|
-
if (e.
|
|
1859
|
-
e.
|
|
1868
|
+
if (e.m === NOT_PENDING) queuePendingNode(e);
|
|
1869
|
+
e.m = t;
|
|
1860
1870
|
}
|
|
1861
1871
|
if (e.We) updatePendingSignal(e);
|
|
1862
1872
|
if (e.Fe) {
|
|
1863
1873
|
setSignal(e.Fe, t);
|
|
1864
1874
|
}
|
|
1865
|
-
e.
|
|
1875
|
+
e.le = clock;
|
|
1866
1876
|
insertSubs(e, n);
|
|
1867
1877
|
schedule();
|
|
1868
1878
|
return t;
|
|
1869
1879
|
}
|
|
1870
1880
|
function suppressComputedRecompute(e) {
|
|
1871
|
-
deleteFromHeap(e, e.
|
|
1872
|
-
if (!(e.
|
|
1873
|
-
|
|
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;
|
|
1874
1887
|
}
|
|
1875
1888
|
function setMemo(e, t) {
|
|
1876
1889
|
const n = setSignal(e, t);
|
|
@@ -1892,48 +1905,58 @@ function runWithOwner(e, t) {
|
|
|
1892
1905
|
function getPendingSignal(e) {
|
|
1893
1906
|
if (!e.We) {
|
|
1894
1907
|
e.We = optimisticSignal(false, { ownedWrite: true });
|
|
1895
|
-
if (e.
|
|
1896
|
-
e.We.
|
|
1908
|
+
if (e.t) {
|
|
1909
|
+
e.We.t = e;
|
|
1897
1910
|
}
|
|
1898
1911
|
if (computePendingState(e)) setSignal(e.We, true);
|
|
1899
1912
|
}
|
|
1900
1913
|
return e.We;
|
|
1901
1914
|
}
|
|
1915
|
+
function collectPendingSources(e) {
|
|
1916
|
+
pendingCheckSources?.add(e);
|
|
1917
|
+
const t = e.Ie || e;
|
|
1918
|
+
if (t !== e) pendingCheckSources?.add(t);
|
|
1919
|
+
}
|
|
1902
1920
|
function computePendingState(e) {
|
|
1903
1921
|
const t = e;
|
|
1904
|
-
const n = e.
|
|
1905
|
-
if (
|
|
1906
|
-
|
|
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);
|
|
1907
1927
|
}
|
|
1908
|
-
if (
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1928
|
+
if (n && e.m !== NOT_PENDING) {
|
|
1929
|
+
return !!(n.M & REACTIVE_MANUAL_WRITE) || (!n.ve && !(n.fe & STATUS_PENDING));
|
|
1930
|
+
}
|
|
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);
|
|
1913
1936
|
}
|
|
1914
1937
|
return true;
|
|
1915
1938
|
}
|
|
1916
|
-
if (e.
|
|
1939
|
+
if (e.R !== undefined && e.R === NOT_PENDING && !e.t) {
|
|
1917
1940
|
return false;
|
|
1918
1941
|
}
|
|
1919
|
-
if (e.
|
|
1920
|
-
return !!(t.
|
|
1942
|
+
if (e.m !== NOT_PENDING && !(t.fe & STATUS_UNINITIALIZED)) return true;
|
|
1943
|
+
return !!(t.fe & STATUS_PENDING && !(t.fe & STATUS_UNINITIALIZED));
|
|
1921
1944
|
}
|
|
1922
1945
|
function updatePendingSignal(e) {
|
|
1923
1946
|
if (e.We) {
|
|
1924
1947
|
const t = computePendingState(e);
|
|
1925
1948
|
const n = e.We;
|
|
1926
1949
|
setSignal(n, t);
|
|
1927
|
-
if (!t && n.
|
|
1950
|
+
if (!t && n.i) {
|
|
1928
1951
|
const t = resolveLane(e);
|
|
1929
|
-
if (t && t.
|
|
1930
|
-
const e = findLane(n.
|
|
1952
|
+
if (t && t.u.size > 0) {
|
|
1953
|
+
const e = findLane(n.i);
|
|
1931
1954
|
if (e !== t) {
|
|
1932
1955
|
mergeLanes(t, e);
|
|
1933
1956
|
}
|
|
1934
1957
|
}
|
|
1935
1958
|
signalLanes.delete(n);
|
|
1936
|
-
n.
|
|
1959
|
+
n.i = undefined;
|
|
1937
1960
|
}
|
|
1938
1961
|
}
|
|
1939
1962
|
}
|
|
@@ -1946,7 +1969,7 @@ function getLatestValueComputed(e) {
|
|
|
1946
1969
|
const i = context;
|
|
1947
1970
|
context = null;
|
|
1948
1971
|
e.Fe = optimisticComputed(() => read(e));
|
|
1949
|
-
e.Fe.
|
|
1972
|
+
e.Fe.t = e;
|
|
1950
1973
|
context = i;
|
|
1951
1974
|
pendingCheckActive = n;
|
|
1952
1975
|
latestReadActive = t;
|
|
@@ -1971,44 +1994,50 @@ function latest(e) {
|
|
|
1971
1994
|
latestReadActive = t;
|
|
1972
1995
|
}
|
|
1973
1996
|
}
|
|
1974
|
-
function isPending(e
|
|
1975
|
-
const
|
|
1976
|
-
const
|
|
1977
|
-
const
|
|
1978
|
-
const s = t === true;
|
|
1997
|
+
function isPending(e) {
|
|
1998
|
+
const t = pendingCheckActive;
|
|
1999
|
+
const n = foundPending;
|
|
2000
|
+
const i = pendingCheckSources;
|
|
1979
2001
|
pendingCheckActive = true;
|
|
1980
|
-
pendingCheckLoadingPath = s;
|
|
1981
2002
|
foundPending = false;
|
|
2003
|
+
pendingCheckSources = new Set();
|
|
2004
|
+
const collectPending = () => {
|
|
2005
|
+
pendingCheckActive = false;
|
|
2006
|
+
try {
|
|
2007
|
+
pendingCheckSources.forEach(e => {
|
|
2008
|
+
if (read(getPendingSignal(e))) foundPending = true;
|
|
2009
|
+
});
|
|
2010
|
+
} finally {
|
|
2011
|
+
pendingCheckActive = true;
|
|
2012
|
+
}
|
|
2013
|
+
};
|
|
1982
2014
|
try {
|
|
1983
2015
|
e();
|
|
2016
|
+
collectPending();
|
|
1984
2017
|
return foundPending;
|
|
1985
2018
|
} catch (e) {
|
|
1986
|
-
|
|
2019
|
+
collectPending();
|
|
2020
|
+
if (e instanceof NotReadyError) {
|
|
2021
|
+
if (foundPending && !(e.source?.fe & STATUS_UNINITIALIZED)) return true;
|
|
2022
|
+
if (context) throw e;
|
|
2023
|
+
}
|
|
1987
2024
|
return foundPending;
|
|
1988
2025
|
} finally {
|
|
1989
|
-
pendingCheckActive =
|
|
1990
|
-
|
|
1991
|
-
|
|
2026
|
+
pendingCheckActive = t;
|
|
2027
|
+
foundPending = n;
|
|
2028
|
+
pendingCheckSources = i;
|
|
1992
2029
|
}
|
|
1993
2030
|
}
|
|
1994
2031
|
function refresh(e) {
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
} finally {
|
|
2004
|
-
refreshing = t;
|
|
2005
|
-
if (!t) {
|
|
2006
|
-
schedule();
|
|
2007
|
-
}
|
|
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();
|
|
2008
2040
|
}
|
|
2009
|
-
}
|
|
2010
|
-
function isRefreshing() {
|
|
2011
|
-
return refreshing;
|
|
2012
2041
|
}
|
|
2013
2042
|
function createContext(e, t) {
|
|
2014
2043
|
return { id: Symbol(t), defaultValue: e };
|
|
@@ -2017,7 +2046,7 @@ function getContext(e, t = getOwner()) {
|
|
|
2017
2046
|
if (!t) {
|
|
2018
2047
|
throw new NoOwnerError();
|
|
2019
2048
|
}
|
|
2020
|
-
const n = hasContext(e, t) ? t.
|
|
2049
|
+
const n = hasContext(e, t) ? t.we[e.id] : e.defaultValue;
|
|
2021
2050
|
if (isUndefined(n)) {
|
|
2022
2051
|
throw new ContextNotFoundError();
|
|
2023
2052
|
}
|
|
@@ -2027,30 +2056,28 @@ function setContext(e, t, n = getOwner()) {
|
|
|
2027
2056
|
if (!n) {
|
|
2028
2057
|
throw new NoOwnerError();
|
|
2029
2058
|
}
|
|
2030
|
-
n.
|
|
2059
|
+
n.we = { ...n.we, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
2031
2060
|
}
|
|
2032
2061
|
function hasContext(e, t) {
|
|
2033
|
-
return !isUndefined(t?.
|
|
2062
|
+
return !isUndefined(t?.we[e.id]);
|
|
2034
2063
|
}
|
|
2035
2064
|
function isUndefined(e) {
|
|
2036
2065
|
return typeof e === "undefined";
|
|
2037
2066
|
}
|
|
2038
2067
|
function effect(e, t, n, i) {
|
|
2039
2068
|
const r = !!i?.user;
|
|
2040
|
-
const
|
|
2041
|
-
recompute(
|
|
2069
|
+
const o = createEffectNode(e, t, n, r ? EFFECT_USER : EFFECT_RENDER, notifyEffectStatus, i);
|
|
2070
|
+
recompute(o, true);
|
|
2042
2071
|
!i?.defer &&
|
|
2043
|
-
(
|
|
2044
|
-
? s.te.enqueue(s.J, runEffect.bind(null, s))
|
|
2045
|
-
: runEffect(s));
|
|
2072
|
+
(o.G === EFFECT_USER || i?.schedule ? o.F.enqueue(o.G, runEffect.bind(null, o)) : runEffect(o));
|
|
2046
2073
|
}
|
|
2047
2074
|
function notifyEffectStatus(e, t) {
|
|
2048
|
-
const n = e !== undefined ? e : this.
|
|
2049
|
-
const i = t !== undefined ? t : this.
|
|
2075
|
+
const n = e !== undefined ? e : this.fe;
|
|
2076
|
+
const i = t !== undefined ? t : this.ce;
|
|
2050
2077
|
if (n & STATUS_ERROR) {
|
|
2051
2078
|
let e = i;
|
|
2052
|
-
this.
|
|
2053
|
-
if (this.
|
|
2079
|
+
this.F.notify(this, STATUS_PENDING, 0);
|
|
2080
|
+
if (this.G === EFFECT_USER) {
|
|
2054
2081
|
try {
|
|
2055
2082
|
return this.je
|
|
2056
2083
|
? this.je(e, () => {
|
|
@@ -2062,38 +2089,38 @@ function notifyEffectStatus(e, t) {
|
|
|
2062
2089
|
e = t;
|
|
2063
2090
|
}
|
|
2064
2091
|
}
|
|
2065
|
-
if (!this.
|
|
2066
|
-
} else if (this.
|
|
2067
|
-
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);
|
|
2068
2095
|
}
|
|
2069
2096
|
}
|
|
2070
2097
|
function runEffect(e) {
|
|
2071
|
-
if (!e.
|
|
2098
|
+
if (!e.k || e.M & REACTIVE_DISPOSED) return;
|
|
2072
2099
|
e.$e?.();
|
|
2073
2100
|
e.$e = undefined;
|
|
2074
2101
|
try {
|
|
2075
|
-
const t = e.Qe(e.
|
|
2102
|
+
const t = e.Qe(e.Z, e.xe);
|
|
2076
2103
|
if (false && t !== undefined && typeof t !== "function");
|
|
2077
2104
|
e.$e = t;
|
|
2078
2105
|
if (e.$e && !e.Ke) {
|
|
2079
2106
|
e.Ke = true;
|
|
2080
|
-
runWithOwner(e.
|
|
2107
|
+
runWithOwner(e.q, () => cleanup(() => e.$e?.()));
|
|
2081
2108
|
}
|
|
2082
2109
|
} catch (t) {
|
|
2083
|
-
e.
|
|
2084
|
-
e.
|
|
2085
|
-
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;
|
|
2086
2113
|
} finally {
|
|
2087
|
-
e.
|
|
2088
|
-
e.
|
|
2114
|
+
e.xe = e.Z;
|
|
2115
|
+
e.k = false;
|
|
2089
2116
|
}
|
|
2090
2117
|
}
|
|
2091
|
-
GlobalQueue.
|
|
2118
|
+
GlobalQueue.ie = runEffect;
|
|
2092
2119
|
function trackedEffect(e, t) {
|
|
2093
2120
|
const run = () => {
|
|
2094
|
-
if (!n.
|
|
2121
|
+
if (!n.k || n.M & REACTIVE_DISPOSED) return;
|
|
2095
2122
|
try {
|
|
2096
|
-
n.
|
|
2123
|
+
n.k = false;
|
|
2097
2124
|
recompute(n);
|
|
2098
2125
|
} finally {
|
|
2099
2126
|
}
|
|
@@ -2108,19 +2135,19 @@ function trackedEffect(e, t) {
|
|
|
2108
2135
|
{ ...t, lazy: true }
|
|
2109
2136
|
);
|
|
2110
2137
|
n.$e = undefined;
|
|
2111
|
-
n.
|
|
2112
|
-
n.
|
|
2113
|
-
n.
|
|
2114
|
-
n.
|
|
2115
|
-
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;
|
|
2116
2143
|
if (i & STATUS_ERROR) {
|
|
2117
|
-
n.
|
|
2118
|
-
const e = t !== undefined ? t : n.
|
|
2119
|
-
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;
|
|
2120
2147
|
}
|
|
2121
2148
|
};
|
|
2122
|
-
n.
|
|
2123
|
-
n.
|
|
2149
|
+
n.W = run;
|
|
2150
|
+
n.F.enqueue(EFFECT_USER, run);
|
|
2124
2151
|
cleanup(() => n.$e?.());
|
|
2125
2152
|
}
|
|
2126
2153
|
function restoreTransition(e, t) {
|
|
@@ -2134,13 +2161,13 @@ function action(e) {
|
|
|
2134
2161
|
new Promise((n, i) => {
|
|
2135
2162
|
const r = e(...t);
|
|
2136
2163
|
globalQueue.initTransition();
|
|
2137
|
-
let
|
|
2138
|
-
|
|
2164
|
+
let o = activeTransition;
|
|
2165
|
+
o.$.push(r);
|
|
2139
2166
|
const done = (e, t) => {
|
|
2140
|
-
|
|
2141
|
-
const
|
|
2142
|
-
if (
|
|
2143
|
-
setActiveTransition(
|
|
2167
|
+
o = currentTransition(o);
|
|
2168
|
+
const s = o.$.indexOf(r);
|
|
2169
|
+
if (s >= 0) o.$.splice(s, 1);
|
|
2170
|
+
setActiveTransition(o);
|
|
2144
2171
|
schedule();
|
|
2145
2172
|
t ? i(t) : n(e);
|
|
2146
2173
|
};
|
|
@@ -2152,17 +2179,17 @@ function action(e) {
|
|
|
2152
2179
|
return done(undefined, e);
|
|
2153
2180
|
}
|
|
2154
2181
|
if (n instanceof Promise)
|
|
2155
|
-
return void n.then(run, e => restoreTransition(
|
|
2182
|
+
return void n.then(run, e => restoreTransition(o, () => step(e, true)));
|
|
2156
2183
|
run(n);
|
|
2157
2184
|
};
|
|
2158
2185
|
const run = e => {
|
|
2159
2186
|
if (e.done) return done(e.value);
|
|
2160
2187
|
if (e.value instanceof Promise)
|
|
2161
2188
|
return void e.value.then(
|
|
2162
|
-
e => restoreTransition(
|
|
2163
|
-
e => restoreTransition(
|
|
2189
|
+
e => restoreTransition(o, () => step(e)),
|
|
2190
|
+
e => restoreTransition(o, () => step(e, true))
|
|
2164
2191
|
);
|
|
2165
|
-
restoreTransition(
|
|
2192
|
+
restoreTransition(o, () => step(e.value));
|
|
2166
2193
|
};
|
|
2167
2194
|
step();
|
|
2168
2195
|
});
|
|
@@ -2178,7 +2205,7 @@ function accessor(e) {
|
|
|
2178
2205
|
function createSignal(e, t) {
|
|
2179
2206
|
if (typeof e === "function") {
|
|
2180
2207
|
const n = computed(e, t);
|
|
2181
|
-
n.
|
|
2208
|
+
n.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
2182
2209
|
return [accessor(n), setMemo.bind(null, n)];
|
|
2183
2210
|
}
|
|
2184
2211
|
const n = signal(e, t);
|
|
@@ -2235,7 +2262,7 @@ function resolve(e) {
|
|
|
2235
2262
|
function createOptimistic(e, t) {
|
|
2236
2263
|
if (typeof e === "function") {
|
|
2237
2264
|
const n = optimisticComputed(e, t);
|
|
2238
|
-
n.
|
|
2265
|
+
n.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
2239
2266
|
return [accessor(n), setSignal.bind(null, n)];
|
|
2240
2267
|
}
|
|
2241
2268
|
const n = optimisticSignal(e, t);
|
|
@@ -2243,7 +2270,7 @@ function createOptimistic(e, t) {
|
|
|
2243
2270
|
}
|
|
2244
2271
|
function onSettled(e) {
|
|
2245
2272
|
const t = getOwner();
|
|
2246
|
-
t && !(t.
|
|
2273
|
+
t && !(t.ue & CONFIG_CHILDREN_FORBIDDEN)
|
|
2247
2274
|
? createTrackedEffect(() => untrack(e), undefined)
|
|
2248
2275
|
: globalQueue.enqueue(EFFECT_USER, () => {
|
|
2249
2276
|
const t = e();
|
|
@@ -2274,216 +2301,223 @@ function applyState(e, t, n) {
|
|
|
2274
2301
|
function applyStateFast(e, t, n) {
|
|
2275
2302
|
const i = t[STORE_VALUE];
|
|
2276
2303
|
if (e === i) return;
|
|
2304
|
+
const r = t[STORE_NODE];
|
|
2277
2305
|
(t[STORE_LOOKUP] || storeLookup).set(e, t[$PROXY]);
|
|
2278
2306
|
t[STORE_VALUE] = e;
|
|
2279
2307
|
if (Array.isArray(i)) {
|
|
2280
|
-
let
|
|
2308
|
+
let o = false;
|
|
2281
2309
|
const s = i.length;
|
|
2282
2310
|
if (e.length && s && e[0] && n(e[0]) != null) {
|
|
2283
|
-
let
|
|
2311
|
+
let u, c, l, a, f, E, T, S;
|
|
2284
2312
|
for (
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
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++
|
|
2288
2316
|
) {
|
|
2289
|
-
applyState(e[
|
|
2317
|
+
applyState(e[l], wrap(E, t), n);
|
|
2290
2318
|
}
|
|
2291
|
-
const
|
|
2292
|
-
|
|
2319
|
+
const d = new Array(e.length),
|
|
2320
|
+
_ = new Map();
|
|
2293
2321
|
for (
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
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--
|
|
2297
2325
|
) {
|
|
2298
|
-
|
|
2326
|
+
d[f] = E;
|
|
2299
2327
|
}
|
|
2300
|
-
if (
|
|
2301
|
-
for (
|
|
2302
|
-
|
|
2303
|
-
|
|
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));
|
|
2304
2332
|
}
|
|
2305
|
-
for (;
|
|
2306
|
-
|
|
2307
|
-
const i = wrap(
|
|
2308
|
-
|
|
2309
|
-
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);
|
|
2310
2338
|
}
|
|
2311
|
-
|
|
2312
|
-
s !== e.length &&
|
|
2339
|
+
o && notifySelf(t);
|
|
2340
|
+
s !== e.length && r?.length && setSignal(r.length, e.length);
|
|
2313
2341
|
return;
|
|
2314
2342
|
}
|
|
2315
|
-
|
|
2316
|
-
for (
|
|
2317
|
-
|
|
2318
|
-
S =
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
}
|
|
2323
|
-
for (
|
|
2324
|
-
|
|
2325
|
-
S =
|
|
2326
|
-
|
|
2327
|
-
if (
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
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);
|
|
2331
2359
|
}
|
|
2332
2360
|
}
|
|
2333
|
-
for (
|
|
2334
|
-
if (
|
|
2335
|
-
const i = wrap(
|
|
2336
|
-
|
|
2337
|
-
applyState(e[
|
|
2338
|
-
} 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));
|
|
2339
2367
|
}
|
|
2340
|
-
if (
|
|
2368
|
+
if (l < e.length) o = true;
|
|
2341
2369
|
} else if (e.length) {
|
|
2342
|
-
for (let
|
|
2343
|
-
const
|
|
2344
|
-
isWrappable(s)
|
|
2345
|
-
|
|
2346
|
-
|
|
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
|
+
}
|
|
2347
2377
|
}
|
|
2348
2378
|
}
|
|
2349
2379
|
if (s !== e.length) {
|
|
2350
|
-
|
|
2351
|
-
|
|
2380
|
+
o = true;
|
|
2381
|
+
r?.length && setSignal(r.length, e.length);
|
|
2352
2382
|
}
|
|
2353
|
-
|
|
2383
|
+
o && notifySelf(t);
|
|
2354
2384
|
return;
|
|
2355
2385
|
}
|
|
2356
|
-
let
|
|
2357
|
-
if (
|
|
2358
|
-
const
|
|
2359
|
-
const
|
|
2360
|
-
for (let u = 0, c =
|
|
2361
|
-
const c =
|
|
2362
|
-
const l =
|
|
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);
|
|
2390
|
+
for (let u = 0, c = s.length; u < c; u++) {
|
|
2391
|
+
const c = s[u];
|
|
2392
|
+
const l = o[c];
|
|
2363
2393
|
const a = unwrap(i[c]);
|
|
2364
2394
|
let f = unwrap(e[c]);
|
|
2365
2395
|
if (a === f) continue;
|
|
2366
2396
|
if (!a || !isWrappable(a) || !isWrappable(f) || (n(a) != null && n(a) !== n(f))) {
|
|
2367
|
-
|
|
2397
|
+
r && setSignal(r, void 0);
|
|
2368
2398
|
l && setSignal(l, isWrappable(f) ? wrap(f, t) : f);
|
|
2369
2399
|
} else applyState(f, wrap(a, t), n);
|
|
2370
2400
|
}
|
|
2371
2401
|
}
|
|
2372
|
-
if ((
|
|
2373
|
-
const t = Object.keys(
|
|
2402
|
+
if ((o = t[STORE_HAS])) {
|
|
2403
|
+
const t = Object.keys(o);
|
|
2374
2404
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
2375
2405
|
const i = t[n];
|
|
2376
|
-
setSignal(
|
|
2406
|
+
setSignal(o[i], i in e);
|
|
2377
2407
|
}
|
|
2378
2408
|
}
|
|
2379
2409
|
}
|
|
2380
2410
|
function applyStateSlow(e, t, n) {
|
|
2381
2411
|
const i = t[STORE_VALUE];
|
|
2382
2412
|
const r = t[STORE_OVERRIDE];
|
|
2383
|
-
const
|
|
2384
|
-
let
|
|
2413
|
+
const o = t[STORE_OPTIMISTIC_OVERRIDE];
|
|
2414
|
+
let s = t[STORE_NODE];
|
|
2385
2415
|
(t[STORE_LOOKUP] || storeLookup).set(e, t[$PROXY]);
|
|
2386
2416
|
t[STORE_VALUE] = e;
|
|
2387
2417
|
t[STORE_OVERRIDE] = undefined;
|
|
2388
2418
|
if (Array.isArray(i)) {
|
|
2389
|
-
let
|
|
2390
|
-
const
|
|
2391
|
-
if (e.length &&
|
|
2392
|
-
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, _;
|
|
2393
2423
|
for (
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
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++
|
|
2397
2427
|
) {
|
|
2398
|
-
applyState(e[
|
|
2428
|
+
applyState(e[f], wrap(S, t), n);
|
|
2399
2429
|
}
|
|
2400
2430
|
const O = new Array(e.length),
|
|
2401
|
-
|
|
2431
|
+
R = new Map();
|
|
2402
2432
|
for (
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
((S = getOverrideValue(i, r,
|
|
2407
|
-
|
|
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--
|
|
2408
2438
|
) {
|
|
2409
|
-
O[
|
|
2439
|
+
O[T] = S;
|
|
2410
2440
|
}
|
|
2411
|
-
if (
|
|
2412
|
-
for (
|
|
2413
|
-
|
|
2414
|
-
|
|
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));
|
|
2415
2445
|
}
|
|
2416
|
-
for (;
|
|
2417
|
-
|
|
2418
|
-
const i = wrap(O[
|
|
2419
|
-
|
|
2420
|
-
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);
|
|
2421
2451
|
}
|
|
2422
|
-
|
|
2423
|
-
u
|
|
2452
|
+
const i = e.length;
|
|
2453
|
+
u && notifySelf(t);
|
|
2454
|
+
c !== i && s?.length && setSignal(s.length, i);
|
|
2424
2455
|
return;
|
|
2425
2456
|
}
|
|
2426
|
-
|
|
2427
|
-
for (
|
|
2428
|
-
S = e[
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
}
|
|
2434
|
-
for (
|
|
2435
|
-
S = getOverrideValue(i, r,
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
if (
|
|
2439
|
-
O[
|
|
2440
|
-
|
|
2441
|
-
|
|
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);
|
|
2442
2473
|
}
|
|
2443
2474
|
}
|
|
2444
|
-
for (
|
|
2445
|
-
if (
|
|
2446
|
-
const i = wrap(O[
|
|
2447
|
-
|
|
2448
|
-
applyState(e[
|
|
2449
|
-
} 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));
|
|
2450
2481
|
}
|
|
2451
|
-
if (
|
|
2482
|
+
if (f < e.length) u = true;
|
|
2452
2483
|
} else if (e.length) {
|
|
2453
|
-
for (let
|
|
2454
|
-
const
|
|
2455
|
-
isWrappable(
|
|
2456
|
-
|
|
2457
|
-
|
|
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
|
+
}
|
|
2458
2491
|
}
|
|
2459
2492
|
}
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2493
|
+
const l = e.length;
|
|
2494
|
+
if (c !== l) {
|
|
2495
|
+
u = true;
|
|
2496
|
+
s?.length && setSignal(s.length, l);
|
|
2463
2497
|
}
|
|
2464
|
-
|
|
2498
|
+
u && notifySelf(t);
|
|
2465
2499
|
return;
|
|
2466
2500
|
}
|
|
2467
|
-
if (
|
|
2468
|
-
const u =
|
|
2469
|
-
const c = u ? getAllKeys(i, r, e) : Object.keys(
|
|
2501
|
+
if (s) {
|
|
2502
|
+
const u = s[$TRACK];
|
|
2503
|
+
const c = u ? getAllKeys(i, r, e) : Object.keys(s);
|
|
2470
2504
|
for (let l = 0, a = c.length; l < a; l++) {
|
|
2471
2505
|
const a = c[l];
|
|
2472
|
-
const f =
|
|
2473
|
-
const E = unwrap(getOverrideValue(i, r, a,
|
|
2474
|
-
let
|
|
2475
|
-
if (E ===
|
|
2476
|
-
if (!E || !isWrappable(E) || !isWrappable(
|
|
2506
|
+
const f = s[a];
|
|
2507
|
+
const E = unwrap(getOverrideValue(i, r, a, o));
|
|
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))) {
|
|
2477
2511
|
u && setSignal(u, void 0);
|
|
2478
|
-
f && setSignal(f, isWrappable(
|
|
2479
|
-
} else applyState(
|
|
2512
|
+
f && setSignal(f, isWrappable(T) ? wrap(T, t) : T);
|
|
2513
|
+
} else applyState(T, wrap(E, t), n);
|
|
2480
2514
|
}
|
|
2481
2515
|
}
|
|
2482
|
-
if ((
|
|
2483
|
-
const t = Object.keys(
|
|
2516
|
+
if ((s = t[STORE_HAS])) {
|
|
2517
|
+
const t = Object.keys(s);
|
|
2484
2518
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
2485
2519
|
const i = t[n];
|
|
2486
|
-
setSignal(
|
|
2520
|
+
setSignal(s[i], i in e);
|
|
2487
2521
|
}
|
|
2488
2522
|
}
|
|
2489
2523
|
}
|
|
@@ -2492,7 +2526,7 @@ function reconcile(e, t) {
|
|
|
2492
2526
|
if (n == null) throw new Error("Cannot reconcile null or undefined state");
|
|
2493
2527
|
const i = typeof t === "string" ? e => e[t] : t;
|
|
2494
2528
|
const r = i(n);
|
|
2495
|
-
if (r !== undefined && i(e) !==
|
|
2529
|
+
if (r !== undefined && i(e) !== r)
|
|
2496
2530
|
throw new Error("Cannot reconcile states with different identity");
|
|
2497
2531
|
applyState(e, n, i);
|
|
2498
2532
|
};
|
|
@@ -2517,50 +2551,51 @@ function createProjectionInternal(e, t, n) {
|
|
|
2517
2551
|
r.set(e, t);
|
|
2518
2552
|
return t;
|
|
2519
2553
|
};
|
|
2520
|
-
const
|
|
2554
|
+
const o = wrapProjection(t);
|
|
2521
2555
|
i = computed(() => {
|
|
2522
2556
|
if (!i) i = getOwner();
|
|
2523
|
-
runProjectionComputed(
|
|
2557
|
+
runProjectionComputed(o, e, n?.key || "id");
|
|
2524
2558
|
}, undefined);
|
|
2525
|
-
i.
|
|
2526
|
-
return { store:
|
|
2559
|
+
i.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
2560
|
+
return { store: o, node: i };
|
|
2527
2561
|
}
|
|
2528
2562
|
function createProjection(e, t, n) {
|
|
2529
2563
|
return createProjectionInternal(e, t, n).store;
|
|
2530
2564
|
}
|
|
2531
|
-
function runProjectionComputed(e, t, n, i) {
|
|
2532
|
-
const
|
|
2565
|
+
function runProjectionComputed(e, t, n, i, r) {
|
|
2566
|
+
const o = getOwner();
|
|
2533
2567
|
let s = false;
|
|
2534
|
-
let
|
|
2535
|
-
const
|
|
2568
|
+
let u;
|
|
2569
|
+
const c = new Proxy(
|
|
2536
2570
|
e,
|
|
2537
|
-
createWriteTraps(() => !s ||
|
|
2571
|
+
createWriteTraps(() => !s || o.ve === u, r)
|
|
2538
2572
|
);
|
|
2539
|
-
storeSetter(
|
|
2540
|
-
|
|
2573
|
+
storeSetter(c, r => {
|
|
2574
|
+
u = t(r);
|
|
2541
2575
|
s = true;
|
|
2542
2576
|
const commit = t => {
|
|
2543
|
-
if (t ===
|
|
2577
|
+
if (t === r || t === undefined) return;
|
|
2544
2578
|
const write = () => storeSetter(e, reconcile(t, n));
|
|
2545
2579
|
i ? i(write) : write();
|
|
2546
2580
|
};
|
|
2547
|
-
commit(handleAsync(
|
|
2581
|
+
commit(handleAsync(o, u, commit));
|
|
2548
2582
|
});
|
|
2549
|
-
return
|
|
2583
|
+
return o;
|
|
2550
2584
|
}
|
|
2551
|
-
function createWriteTraps(e) {
|
|
2552
|
-
const
|
|
2553
|
-
get(e,
|
|
2585
|
+
function createWriteTraps(e, t) {
|
|
2586
|
+
const n = {
|
|
2587
|
+
get(e, t) {
|
|
2554
2588
|
let i;
|
|
2555
2589
|
setWriteOverride(true);
|
|
2556
2590
|
setProjectionWriteActive(true);
|
|
2557
2591
|
try {
|
|
2558
|
-
i = e[
|
|
2592
|
+
i = e[t];
|
|
2559
2593
|
} finally {
|
|
2560
2594
|
setWriteOverride(false);
|
|
2561
2595
|
setProjectionWriteActive(false);
|
|
2562
2596
|
}
|
|
2563
|
-
|
|
2597
|
+
if (t === $TARGET) return i;
|
|
2598
|
+
return typeof i === "object" && i !== null ? new Proxy(i, n) : i;
|
|
2564
2599
|
},
|
|
2565
2600
|
has(e, t) {
|
|
2566
2601
|
let n;
|
|
@@ -2574,24 +2609,26 @@ function createWriteTraps(e) {
|
|
|
2574
2609
|
}
|
|
2575
2610
|
return n;
|
|
2576
2611
|
},
|
|
2577
|
-
set(
|
|
2612
|
+
set(n, i, r) {
|
|
2578
2613
|
if (e && !e()) return true;
|
|
2579
2614
|
setWriteOverride(true);
|
|
2580
2615
|
setProjectionWriteActive(true);
|
|
2581
2616
|
try {
|
|
2582
|
-
|
|
2617
|
+
n[i] = r;
|
|
2618
|
+
t?.();
|
|
2583
2619
|
} finally {
|
|
2584
2620
|
setWriteOverride(false);
|
|
2585
2621
|
setProjectionWriteActive(false);
|
|
2586
2622
|
}
|
|
2587
2623
|
return true;
|
|
2588
2624
|
},
|
|
2589
|
-
deleteProperty(
|
|
2625
|
+
deleteProperty(n, i) {
|
|
2590
2626
|
if (e && !e()) return true;
|
|
2591
2627
|
setWriteOverride(true);
|
|
2592
2628
|
setProjectionWriteActive(true);
|
|
2593
2629
|
try {
|
|
2594
|
-
delete
|
|
2630
|
+
delete n[i];
|
|
2631
|
+
t?.();
|
|
2595
2632
|
} finally {
|
|
2596
2633
|
setWriteOverride(false);
|
|
2597
2634
|
setProjectionWriteActive(false);
|
|
@@ -2599,7 +2636,7 @@ function createWriteTraps(e) {
|
|
|
2599
2636
|
return true;
|
|
2600
2637
|
}
|
|
2601
2638
|
};
|
|
2602
|
-
return
|
|
2639
|
+
return n;
|
|
2603
2640
|
}
|
|
2604
2641
|
const $TRACK = Symbol(0),
|
|
2605
2642
|
$TARGET = Symbol(0),
|
|
@@ -2615,6 +2652,7 @@ const STORE_VALUE = "v",
|
|
|
2615
2652
|
STORE_LOOKUP = "l",
|
|
2616
2653
|
STORE_FIREWALL = "f",
|
|
2617
2654
|
STORE_OPTIMISTIC = "p";
|
|
2655
|
+
const STORE_SELF_PENDING = Symbol(0);
|
|
2618
2656
|
function createStoreProxy(e, t = storeTraps, n) {
|
|
2619
2657
|
let i;
|
|
2620
2658
|
if (Array.isArray(e)) {
|
|
@@ -2649,8 +2687,35 @@ function setWriteOverride(e) {
|
|
|
2649
2687
|
function writeOnly(e) {
|
|
2650
2688
|
return writeOverride || !!Writing?.has(e);
|
|
2651
2689
|
}
|
|
2652
|
-
function unwrapStoreValue(e) {
|
|
2653
|
-
|
|
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;
|
|
2709
|
+
}
|
|
2710
|
+
function isPrototypePollutionKey$1(e) {
|
|
2711
|
+
return e === "__proto__" || e === "constructor" || e === "prototype";
|
|
2712
|
+
}
|
|
2713
|
+
function hasOwnStoreProperty(e, t) {
|
|
2714
|
+
const n = e[STORE_OPTIMISTIC_OVERRIDE];
|
|
2715
|
+
if (n && Object.prototype.hasOwnProperty.call(n, t) && n[t] !== $DELETED) return true;
|
|
2716
|
+
const i = e[STORE_OVERRIDE];
|
|
2717
|
+
if (i && Object.prototype.hasOwnProperty.call(i, t) && i[t] !== $DELETED) return true;
|
|
2718
|
+
return Object.prototype.hasOwnProperty.call(unwrapStoreValue(e[STORE_VALUE]), t);
|
|
2654
2719
|
}
|
|
2655
2720
|
function hasInheritedAccessor(e, t) {
|
|
2656
2721
|
let n = Object.getPrototypeOf(e);
|
|
@@ -2666,7 +2731,7 @@ function getNodes(e, t) {
|
|
|
2666
2731
|
if (!n) e[t] = n = Object.create(null);
|
|
2667
2732
|
return n;
|
|
2668
2733
|
}
|
|
2669
|
-
function getNode(e, t, n, i, r = isEqual,
|
|
2734
|
+
function getNode(e, t, n, i, r = isEqual, o, s) {
|
|
2670
2735
|
if (e[t]) return e[t];
|
|
2671
2736
|
const u = signal(
|
|
2672
2737
|
n,
|
|
@@ -2678,12 +2743,12 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
|
2678
2743
|
},
|
|
2679
2744
|
i
|
|
2680
2745
|
);
|
|
2681
|
-
if (
|
|
2682
|
-
u.
|
|
2746
|
+
if (o) {
|
|
2747
|
+
u.R = NOT_PENDING;
|
|
2683
2748
|
}
|
|
2684
|
-
if (
|
|
2685
|
-
const e =
|
|
2686
|
-
u.
|
|
2749
|
+
if (s && t in s) {
|
|
2750
|
+
const e = s[t];
|
|
2751
|
+
u.ae = e === undefined ? NO_SNAPSHOT : e;
|
|
2687
2752
|
snapshotSources?.add(u);
|
|
2688
2753
|
}
|
|
2689
2754
|
return (e[t] = u);
|
|
@@ -2694,12 +2759,16 @@ function trackSelf(e, t = $TRACK) {
|
|
|
2694
2759
|
getNode(getNodes(e, STORE_NODE), t, undefined, e[STORE_FIREWALL], false, e[STORE_OPTIMISTIC])
|
|
2695
2760
|
);
|
|
2696
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
|
+
}
|
|
2697
2766
|
function getKeys(e, t, n = true) {
|
|
2698
2767
|
const i = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
|
|
2699
2768
|
if (!t) return i;
|
|
2700
2769
|
const r = new Set(i);
|
|
2701
|
-
const
|
|
2702
|
-
for (const e of
|
|
2770
|
+
const o = Reflect.ownKeys(t);
|
|
2771
|
+
for (const e of o) {
|
|
2703
2772
|
if (t[e] !== $DELETED) r.add(e);
|
|
2704
2773
|
else r.delete(e);
|
|
2705
2774
|
}
|
|
@@ -2716,8 +2785,8 @@ function getPropertyDescriptor(e, t, n) {
|
|
|
2716
2785
|
function prepareStoreWrite(e, t, n) {
|
|
2717
2786
|
if (e[STORE_OPTIMISTIC]) {
|
|
2718
2787
|
const t = e[STORE_FIREWALL];
|
|
2719
|
-
if (t?.
|
|
2720
|
-
globalQueue.initTransition(t.
|
|
2788
|
+
if (t?.S) {
|
|
2789
|
+
globalQueue.initTransition(t.S);
|
|
2721
2790
|
}
|
|
2722
2791
|
}
|
|
2723
2792
|
const i = e[STORE_VALUE];
|
|
@@ -2725,7 +2794,7 @@ function prepareStoreWrite(e, t, n) {
|
|
|
2725
2794
|
if (
|
|
2726
2795
|
snapshotCaptureActive &&
|
|
2727
2796
|
typeof n !== "symbol" &&
|
|
2728
|
-
!((e[STORE_FIREWALL]?.
|
|
2797
|
+
!((e[STORE_FIREWALL]?.fe ?? 0) & STATUS_PENDING)
|
|
2729
2798
|
) {
|
|
2730
2799
|
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2731
2800
|
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
@@ -2735,33 +2804,33 @@ function prepareStoreWrite(e, t, n) {
|
|
|
2735
2804
|
e[STORE_SNAPSHOT_PROPS][n] = r;
|
|
2736
2805
|
}
|
|
2737
2806
|
}
|
|
2738
|
-
const
|
|
2739
|
-
const
|
|
2740
|
-
if (
|
|
2741
|
-
return { base: r, overrideKey:
|
|
2807
|
+
const o = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
2808
|
+
const s = o ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
2809
|
+
if (o) trackOptimisticStore(t);
|
|
2810
|
+
return { base: r, overrideKey: s, state: i };
|
|
2742
2811
|
}
|
|
2743
2812
|
function upsertStoreNode(e, t, n, i, r) {
|
|
2744
2813
|
if (t[n]) return t[n];
|
|
2745
|
-
const
|
|
2746
|
-
const
|
|
2747
|
-
registerTransientStoreNode(
|
|
2748
|
-
return
|
|
2814
|
+
const o = isWrappable(i) ? wrap(i, e) : i;
|
|
2815
|
+
const s = getNode(t, n, o, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC], r);
|
|
2816
|
+
registerTransientStoreNode(s);
|
|
2817
|
+
return s;
|
|
2749
2818
|
}
|
|
2750
|
-
function notifyStoreProperty(e, t, n, i, r,
|
|
2751
|
-
const
|
|
2819
|
+
function notifyStoreProperty(e, t, n, i, r, o) {
|
|
2820
|
+
const s = projectionWriteActive || e[STORE_OPTIMISTIC];
|
|
2752
2821
|
const u = n !== "delete";
|
|
2753
2822
|
const c = e[STORE_HAS]?.[t];
|
|
2754
2823
|
if (c) {
|
|
2755
2824
|
setSignal(c, u);
|
|
2756
|
-
} else if (!
|
|
2757
|
-
const n = upsertStoreNode(e, getNodes(e, STORE_HAS), t,
|
|
2825
|
+
} else if (!s && n !== "invalidate" && o !== u) {
|
|
2826
|
+
const n = upsertStoreNode(e, getNodes(e, STORE_HAS), t, o);
|
|
2758
2827
|
setSignal(n, u);
|
|
2759
2828
|
}
|
|
2760
2829
|
const l = getNodes(e, STORE_NODE);
|
|
2761
2830
|
if (n === "set") {
|
|
2762
2831
|
if (l[t]) {
|
|
2763
2832
|
setSignal(l[t], () => (isWrappable(i) ? wrap(i, e) : i));
|
|
2764
|
-
} else if (!
|
|
2833
|
+
} else if (!s) {
|
|
2765
2834
|
const n = upsertStoreNode(e, l, t, r, e[STORE_SNAPSHOT_PROPS]);
|
|
2766
2835
|
setSignal(n, () => (isWrappable(i) ? wrap(i, e) : i));
|
|
2767
2836
|
}
|
|
@@ -2773,12 +2842,12 @@ function notifyStoreProperty(e, t, n, i, r, s) {
|
|
|
2773
2842
|
} else {
|
|
2774
2843
|
if (l[t]) {
|
|
2775
2844
|
setSignal(l[t], undefined);
|
|
2776
|
-
} else if (!
|
|
2845
|
+
} else if (!s) {
|
|
2777
2846
|
const n = upsertStoreNode(e, l, t, r, e[STORE_SNAPSHOT_PROPS]);
|
|
2778
2847
|
setSignal(n, undefined);
|
|
2779
2848
|
}
|
|
2780
2849
|
}
|
|
2781
|
-
|
|
2850
|
+
notifySelf(e);
|
|
2782
2851
|
}
|
|
2783
2852
|
let Writing = null;
|
|
2784
2853
|
const storeTraps = {
|
|
@@ -2790,11 +2859,12 @@ const storeTraps = {
|
|
|
2790
2859
|
trackSelf(e);
|
|
2791
2860
|
return n;
|
|
2792
2861
|
}
|
|
2793
|
-
const i =
|
|
2794
|
-
const r =
|
|
2862
|
+
const i = getObserver() === e[STORE_FIREWALL];
|
|
2863
|
+
const r = getNodes(e, STORE_NODE);
|
|
2864
|
+
const o = i ? undefined : r[t];
|
|
2795
2865
|
const s = e[STORE_VALUE];
|
|
2796
2866
|
if (
|
|
2797
|
-
!
|
|
2867
|
+
!o &&
|
|
2798
2868
|
!e[STORE_OVERRIDE] &&
|
|
2799
2869
|
!e[STORE_OPTIMISTIC_OVERRIDE] &&
|
|
2800
2870
|
!e[STORE_CUSTOM_PROTO] &&
|
|
@@ -2803,59 +2873,61 @@ const storeTraps = {
|
|
|
2803
2873
|
!s[$TARGET] &&
|
|
2804
2874
|
!(t in s) &&
|
|
2805
2875
|
getObserver() &&
|
|
2876
|
+
!i &&
|
|
2806
2877
|
!writeOnly(n)
|
|
2807
2878
|
) {
|
|
2808
|
-
return read(getNode(
|
|
2879
|
+
return read(getNode(r, t, undefined, e[STORE_FIREWALL]));
|
|
2809
2880
|
}
|
|
2810
|
-
const
|
|
2811
|
-
const
|
|
2812
|
-
const
|
|
2813
|
-
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
|
|
2814
2885
|
? e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2815
2886
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2816
2887
|
? e[STORE_OVERRIDE]
|
|
2817
2888
|
: e[STORE_VALUE];
|
|
2818
|
-
if (!
|
|
2819
|
-
const i = Object.getOwnPropertyDescriptor(
|
|
2889
|
+
if (!o) {
|
|
2890
|
+
const i = Object.getOwnPropertyDescriptor(a, t);
|
|
2820
2891
|
if (i && i.get) return i.get.call(n);
|
|
2821
|
-
if (!i && !
|
|
2822
|
-
const e = unwrapStoreValue(
|
|
2892
|
+
if (!i && !c && e[STORE_CUSTOM_PROTO]) {
|
|
2893
|
+
const e = unwrapStoreValue(a);
|
|
2823
2894
|
if (hasInheritedAccessor(e, t)) {
|
|
2824
|
-
return Reflect.get(
|
|
2895
|
+
return Reflect.get(a, t, n);
|
|
2825
2896
|
}
|
|
2826
2897
|
}
|
|
2827
2898
|
}
|
|
2828
2899
|
if (writeOnly(n)) {
|
|
2900
|
+
if (isPrototypePollutionKey$1(t) && !hasOwnStoreProperty(e, t)) return undefined;
|
|
2829
2901
|
let n =
|
|
2830
|
-
|
|
2831
|
-
?
|
|
2832
|
-
?
|
|
2833
|
-
:
|
|
2834
|
-
?
|
|
2835
|
-
:
|
|
2836
|
-
:
|
|
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];
|
|
2837
2909
|
n === $DELETED && (n = undefined);
|
|
2838
2910
|
if (!isWrappable(n)) return n;
|
|
2839
2911
|
const i = wrap(n, e);
|
|
2840
2912
|
Writing?.add(i);
|
|
2841
2913
|
return i;
|
|
2842
2914
|
}
|
|
2843
|
-
let
|
|
2844
|
-
|
|
2845
|
-
if (!
|
|
2846
|
-
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)) {
|
|
2847
2919
|
let t;
|
|
2848
2920
|
return !Array.isArray(e[STORE_VALUE]) &&
|
|
2849
2921
|
(t = Object.getPrototypeOf(e[STORE_VALUE])) &&
|
|
2850
2922
|
t !== Object.prototype
|
|
2851
|
-
?
|
|
2852
|
-
:
|
|
2853
|
-
} else if (getObserver()) {
|
|
2923
|
+
? f.bind(a)
|
|
2924
|
+
: f;
|
|
2925
|
+
} else if (getObserver() && !i) {
|
|
2854
2926
|
return read(
|
|
2855
2927
|
getNode(
|
|
2856
|
-
|
|
2928
|
+
r,
|
|
2857
2929
|
t,
|
|
2858
|
-
isWrappable(
|
|
2930
|
+
isWrappable(f) ? wrap(f, e) : f,
|
|
2859
2931
|
e[STORE_FIREWALL],
|
|
2860
2932
|
isEqual,
|
|
2861
2933
|
e[STORE_OPTIMISTIC],
|
|
@@ -2864,7 +2936,7 @@ const storeTraps = {
|
|
|
2864
2936
|
);
|
|
2865
2937
|
}
|
|
2866
2938
|
}
|
|
2867
|
-
return isWrappable(
|
|
2939
|
+
return isWrappable(f) ? wrap(f, e) : f;
|
|
2868
2940
|
},
|
|
2869
2941
|
has(e, t) {
|
|
2870
2942
|
if (t === $PROXY || t === $TRACK || t === "__proto__") return true;
|
|
@@ -2874,7 +2946,7 @@ const storeTraps = {
|
|
|
2874
2946
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2875
2947
|
? e[STORE_OVERRIDE][t] !== $DELETED
|
|
2876
2948
|
: t in e[STORE_VALUE];
|
|
2877
|
-
if (writeOnly(e[$PROXY])) return n;
|
|
2949
|
+
if (writeOnly(e[$PROXY]) || getObserver() === e[STORE_FIREWALL]) return n;
|
|
2878
2950
|
const i = getNodes(e, STORE_HAS);
|
|
2879
2951
|
if (i[t]) return read(i[t]);
|
|
2880
2952
|
if (getObserver()) {
|
|
@@ -2883,10 +2955,11 @@ const storeTraps = {
|
|
|
2883
2955
|
return n;
|
|
2884
2956
|
},
|
|
2885
2957
|
set(e, t, n) {
|
|
2958
|
+
if (t === "__proto__") return true;
|
|
2886
2959
|
const i = e[$PROXY];
|
|
2887
2960
|
if (writeOnly(i)) {
|
|
2888
2961
|
untrack(() => {
|
|
2889
|
-
const { base: r, overrideKey:
|
|
2962
|
+
const { base: r, overrideKey: o, state: s } = prepareStoreWrite(e, i, t);
|
|
2890
2963
|
const u =
|
|
2891
2964
|
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2892
2965
|
? e[STORE_OPTIMISTIC_OVERRIDE][t]
|
|
@@ -2900,7 +2973,7 @@ const storeTraps = {
|
|
|
2900
2973
|
? e[STORE_OVERRIDE][t] !== $DELETED
|
|
2901
2974
|
: t in e[STORE_VALUE];
|
|
2902
2975
|
const l = unwrapStoreValue(n);
|
|
2903
|
-
const a = Array.isArray(
|
|
2976
|
+
const a = Array.isArray(s) && t !== "length";
|
|
2904
2977
|
const f = a ? parseInt(t) + 1 : 0;
|
|
2905
2978
|
const E =
|
|
2906
2979
|
a &&
|
|
@@ -2908,23 +2981,23 @@ const storeTraps = {
|
|
|
2908
2981
|
? e[STORE_OPTIMISTIC_OVERRIDE].length
|
|
2909
2982
|
: e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
|
|
2910
2983
|
? e[STORE_OVERRIDE].length
|
|
2911
|
-
:
|
|
2912
|
-
const
|
|
2913
|
-
if (u === l &&
|
|
2914
|
-
if (l !== undefined && l === r &&
|
|
2984
|
+
: s.length);
|
|
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];
|
|
2915
2988
|
else {
|
|
2916
|
-
const n = e[
|
|
2989
|
+
const n = e[o] || (e[o] = Object.create(null));
|
|
2917
2990
|
n[t] = l;
|
|
2918
|
-
if (
|
|
2991
|
+
if (T !== undefined) n.length = T;
|
|
2919
2992
|
}
|
|
2920
2993
|
notifyStoreProperty(e, t, "set", l, u, c);
|
|
2921
|
-
if (Array.isArray(
|
|
2994
|
+
if (Array.isArray(s) && t !== "length" && T !== undefined) {
|
|
2922
2995
|
const t = getNodes(e, STORE_NODE);
|
|
2923
2996
|
if (t.length) {
|
|
2924
|
-
setSignal(t.length,
|
|
2997
|
+
setSignal(t.length, T);
|
|
2925
2998
|
} else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
|
|
2926
2999
|
const n = upsertStoreNode(e, t, "length", E, e[STORE_SNAPSHOT_PROPS]);
|
|
2927
|
-
setSignal(n,
|
|
3000
|
+
setSignal(n, T);
|
|
2928
3001
|
}
|
|
2929
3002
|
}
|
|
2930
3003
|
if (false);
|
|
@@ -2933,12 +3006,13 @@ const storeTraps = {
|
|
|
2933
3006
|
return true;
|
|
2934
3007
|
},
|
|
2935
3008
|
defineProperty(e, t, n) {
|
|
3009
|
+
if (t === "__proto__") return true;
|
|
2936
3010
|
const i = e[$PROXY];
|
|
2937
3011
|
if (writeOnly(i)) {
|
|
2938
3012
|
untrack(() => {
|
|
2939
|
-
const { base: r, overrideKey:
|
|
2940
|
-
const
|
|
2941
|
-
Object.defineProperty(e[
|
|
3013
|
+
const { base: r, overrideKey: o } = prepareStoreWrite(e, i, t);
|
|
3014
|
+
const s = "value" in n ? { ...n, value: unwrapStoreValue(n.value) } : n;
|
|
3015
|
+
Object.defineProperty(e[o] || (e[o] = Object.create(null)), t, s);
|
|
2942
3016
|
notifyStoreProperty(e, t, "invalidate");
|
|
2943
3017
|
if (false);
|
|
2944
3018
|
});
|
|
@@ -2946,6 +3020,7 @@ const storeTraps = {
|
|
|
2946
3020
|
return true;
|
|
2947
3021
|
},
|
|
2948
3022
|
deleteProperty(e, t) {
|
|
3023
|
+
if (t === "__proto__") return true;
|
|
2949
3024
|
const n = e[STORE_OPTIMISTIC_OVERRIDE]?.[t] === $DELETED;
|
|
2950
3025
|
const i = e[STORE_OVERRIDE]?.[t] === $DELETED;
|
|
2951
3026
|
if (writeOnly(e[$PROXY]) && !n && !i) {
|
|
@@ -2970,7 +3045,7 @@ const storeTraps = {
|
|
|
2970
3045
|
return true;
|
|
2971
3046
|
},
|
|
2972
3047
|
ownKeys(e) {
|
|
2973
|
-
trackSelf(e);
|
|
3048
|
+
if (getObserver() !== e[STORE_FIREWALL]) trackSelf(e);
|
|
2974
3049
|
let t = getKeys(e[STORE_VALUE], e[STORE_OVERRIDE], false);
|
|
2975
3050
|
if (e[STORE_OPTIMISTIC_OVERRIDE]) {
|
|
2976
3051
|
const n = new Set(t);
|
|
@@ -3033,43 +3108,63 @@ function createStore(e, t, n) {
|
|
|
3033
3108
|
r = i ? createProjectionInternal(e, t, n).store : wrap(e);
|
|
3034
3109
|
return [
|
|
3035
3110
|
r,
|
|
3036
|
-
i
|
|
3111
|
+
i
|
|
3112
|
+
? e => {
|
|
3113
|
+
suppressComputedRecompute(r[$REFRESH]);
|
|
3114
|
+
storeSetter(r, e);
|
|
3115
|
+
}
|
|
3116
|
+
: e => storeSetter(r, e)
|
|
3037
3117
|
];
|
|
3038
3118
|
}
|
|
3039
3119
|
function createOptimisticStore(e, t, n) {
|
|
3040
|
-
GlobalQueue.
|
|
3120
|
+
GlobalQueue.re ||= clearOptimisticStore;
|
|
3041
3121
|
const i = typeof e === "function";
|
|
3042
3122
|
const r = i ? t : e;
|
|
3043
|
-
const
|
|
3044
|
-
const { store:
|
|
3045
|
-
return [
|
|
3123
|
+
const o = i ? e : undefined;
|
|
3124
|
+
const { store: s } = createOptimisticProjectionInternal(o, r, n);
|
|
3125
|
+
return [s, e => storeSetter(s, e)];
|
|
3046
3126
|
}
|
|
3047
3127
|
function clearOptimisticStore(e) {
|
|
3048
3128
|
const t = e[$TARGET];
|
|
3049
3129
|
if (!t || !t[STORE_OPTIMISTIC_OVERRIDE]) return;
|
|
3050
|
-
|
|
3051
|
-
|
|
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;
|
|
3052
3138
|
setProjectionWriteActive(true);
|
|
3053
3139
|
try {
|
|
3054
|
-
if (
|
|
3055
|
-
for (const
|
|
3056
|
-
if (i
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
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
|
+
}
|
|
3062
3158
|
}
|
|
3063
3159
|
}
|
|
3064
|
-
if (
|
|
3065
|
-
|
|
3066
|
-
|
|
3160
|
+
if (n[$TRACK]) {
|
|
3161
|
+
n[$TRACK].i = undefined;
|
|
3162
|
+
notifySelf(e);
|
|
3067
3163
|
}
|
|
3068
3164
|
}
|
|
3069
3165
|
} finally {
|
|
3070
|
-
setProjectionWriteActive(
|
|
3166
|
+
setProjectionWriteActive(i);
|
|
3071
3167
|
}
|
|
3072
|
-
delete t[STORE_OPTIMISTIC_OVERRIDE];
|
|
3073
3168
|
}
|
|
3074
3169
|
function createOptimisticProjectionInternal(e, t, n) {
|
|
3075
3170
|
let i;
|
|
@@ -3092,27 +3187,33 @@ function createOptimisticProjectionInternal(e, t, n) {
|
|
|
3092
3187
|
r.set(e, t);
|
|
3093
3188
|
return t;
|
|
3094
3189
|
};
|
|
3095
|
-
const
|
|
3190
|
+
const o = wrapProjection(t);
|
|
3096
3191
|
if (e) {
|
|
3192
|
+
const clearProjectionOverride = () => {
|
|
3193
|
+
const e = o[$TARGET];
|
|
3194
|
+
if (e?.[STORE_OPTIMISTIC_OVERRIDE]) clearOptimisticOverride(e);
|
|
3195
|
+
};
|
|
3097
3196
|
const wrapCommit = e => {
|
|
3197
|
+
const t = projectionWriteActive;
|
|
3098
3198
|
setProjectionWriteActive(true);
|
|
3099
3199
|
try {
|
|
3100
3200
|
e();
|
|
3201
|
+
clearProjectionOverride();
|
|
3101
3202
|
} finally {
|
|
3102
|
-
setProjectionWriteActive(
|
|
3203
|
+
setProjectionWriteActive(t);
|
|
3103
3204
|
}
|
|
3104
3205
|
};
|
|
3105
3206
|
i = computed(() => {
|
|
3106
3207
|
setProjectionWriteActive(true);
|
|
3107
3208
|
try {
|
|
3108
|
-
runProjectionComputed(
|
|
3209
|
+
runProjectionComputed(o, e, n?.key || "id", wrapCommit, clearProjectionOverride);
|
|
3109
3210
|
} finally {
|
|
3110
3211
|
setProjectionWriteActive(false);
|
|
3111
3212
|
}
|
|
3112
3213
|
}, undefined);
|
|
3113
|
-
i.
|
|
3214
|
+
i.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
3114
3215
|
}
|
|
3115
|
-
return { store:
|
|
3216
|
+
return { store: o, node: i };
|
|
3116
3217
|
}
|
|
3117
3218
|
const DELETE = Symbol(0);
|
|
3118
3219
|
function isPrototypePollutionKey(e) {
|
|
@@ -3123,9 +3224,9 @@ function updatePath(e, t, n = 0) {
|
|
|
3123
3224
|
r = e;
|
|
3124
3225
|
if (n < t.length - 1) {
|
|
3125
3226
|
i = t[n];
|
|
3126
|
-
const
|
|
3127
|
-
const
|
|
3128
|
-
if (
|
|
3227
|
+
const o = typeof i;
|
|
3228
|
+
const s = Array.isArray(e);
|
|
3229
|
+
if (o === "string" && isPrototypePollutionKey(i)) return;
|
|
3129
3230
|
if (Array.isArray(i)) {
|
|
3130
3231
|
for (let r = 0; r < i.length; r++) {
|
|
3131
3232
|
t[n] = i[r];
|
|
@@ -3133,7 +3234,7 @@ function updatePath(e, t, n = 0) {
|
|
|
3133
3234
|
}
|
|
3134
3235
|
t[n] = i;
|
|
3135
3236
|
return;
|
|
3136
|
-
} else if (
|
|
3237
|
+
} else if (s && o === "function") {
|
|
3137
3238
|
for (let r = 0; r < e.length; r++) {
|
|
3138
3239
|
if (i(e[r], r)) {
|
|
3139
3240
|
t[n] = r;
|
|
@@ -3142,9 +3243,9 @@ function updatePath(e, t, n = 0) {
|
|
|
3142
3243
|
}
|
|
3143
3244
|
t[n] = i;
|
|
3144
3245
|
return;
|
|
3145
|
-
} else if (
|
|
3146
|
-
const { from: r = 0, to:
|
|
3147
|
-
for (let i = r; i <=
|
|
3246
|
+
} else if (s && o === "object") {
|
|
3247
|
+
const { from: r = 0, to: o = e.length - 1, by: s = 1 } = i;
|
|
3248
|
+
for (let i = r; i <= o; i += s) {
|
|
3148
3249
|
t[n] = i;
|
|
3149
3250
|
updatePath(e, t, n);
|
|
3150
3251
|
}
|
|
@@ -3156,26 +3257,26 @@ function updatePath(e, t, n = 0) {
|
|
|
3156
3257
|
}
|
|
3157
3258
|
r = e[i];
|
|
3158
3259
|
}
|
|
3159
|
-
let
|
|
3160
|
-
if (typeof
|
|
3161
|
-
|
|
3162
|
-
if (
|
|
3260
|
+
let o = t[t.length - 1];
|
|
3261
|
+
if (typeof o === "function") {
|
|
3262
|
+
o = o(r);
|
|
3263
|
+
if (o === r) return;
|
|
3163
3264
|
}
|
|
3164
|
-
if (i === undefined &&
|
|
3165
|
-
if (
|
|
3265
|
+
if (i === undefined && o == undefined) return;
|
|
3266
|
+
if (o === DELETE) {
|
|
3166
3267
|
delete e[i];
|
|
3167
|
-
} else if (i === undefined || (isWrappable(r) && isWrappable(
|
|
3268
|
+
} else if (i === undefined || (isWrappable(r) && isWrappable(o) && !Array.isArray(o))) {
|
|
3168
3269
|
const t = i !== undefined ? e[i] : e;
|
|
3169
|
-
const n = Object.keys(
|
|
3270
|
+
const n = Object.keys(o);
|
|
3170
3271
|
for (let e = 0; e < n.length; e++) {
|
|
3171
3272
|
const i = n[e];
|
|
3172
3273
|
if (isPrototypePollutionKey(i)) continue;
|
|
3173
|
-
const r = Object.getOwnPropertyDescriptor(
|
|
3274
|
+
const r = Object.getOwnPropertyDescriptor(o, i);
|
|
3174
3275
|
if (r.get || r.set) Object.defineProperty(t, i, r);
|
|
3175
3276
|
else t[i] = r.value;
|
|
3176
3277
|
}
|
|
3177
3278
|
} else {
|
|
3178
|
-
e[i] =
|
|
3279
|
+
e[i] = o;
|
|
3179
3280
|
}
|
|
3180
3281
|
}
|
|
3181
3282
|
const storePath = Object.assign(
|
|
@@ -3187,28 +3288,28 @@ const storePath = Object.assign(
|
|
|
3187
3288
|
{ DELETE: DELETE }
|
|
3188
3289
|
);
|
|
3189
3290
|
function snapshotImpl(e, t, n, i) {
|
|
3190
|
-
let r,
|
|
3291
|
+
let r, o, s, u, c, l;
|
|
3191
3292
|
if (!isWrappable(e)) return e;
|
|
3192
3293
|
if (n && n.has(e)) return n.get(e);
|
|
3193
3294
|
if (!n) n = new Map();
|
|
3194
3295
|
if ((r = e[$TARGET] || i?.get(e)?.[$TARGET])) {
|
|
3195
3296
|
if (t) trackSelf(r, $TRACK);
|
|
3196
|
-
|
|
3197
|
-
|
|
3297
|
+
s = r[STORE_OVERRIDE];
|
|
3298
|
+
o = Array.isArray(r[STORE_VALUE]);
|
|
3198
3299
|
n.set(
|
|
3199
3300
|
e,
|
|
3200
|
-
|
|
3301
|
+
s ? (u = o ? [] : Object.create(Object.getPrototypeOf(r[STORE_VALUE]))) : r[STORE_VALUE]
|
|
3201
3302
|
);
|
|
3202
3303
|
e = r[STORE_VALUE];
|
|
3203
|
-
i = storeLookup;
|
|
3304
|
+
i = r[STORE_LOOKUP] ?? storeLookup;
|
|
3204
3305
|
} else {
|
|
3205
|
-
|
|
3306
|
+
o = Array.isArray(e);
|
|
3206
3307
|
n.set(e, e);
|
|
3207
3308
|
}
|
|
3208
|
-
if (
|
|
3209
|
-
const
|
|
3210
|
-
for (let a = 0; a <
|
|
3211
|
-
l =
|
|
3309
|
+
if (o) {
|
|
3310
|
+
const o = s?.length ?? e.length;
|
|
3311
|
+
for (let a = 0; a < o; a++) {
|
|
3312
|
+
l = s && a in s ? s[a] : e[a];
|
|
3212
3313
|
if (l === $DELETED) continue;
|
|
3213
3314
|
if (t && isWrappable(l)) wrap(l, r);
|
|
3214
3315
|
if ((c = snapshotImpl(l, t, n, i)) !== l || u) {
|
|
@@ -3217,12 +3318,12 @@ function snapshotImpl(e, t, n, i) {
|
|
|
3217
3318
|
}
|
|
3218
3319
|
}
|
|
3219
3320
|
} else {
|
|
3220
|
-
const
|
|
3221
|
-
for (let a = 0, f =
|
|
3222
|
-
let f =
|
|
3223
|
-
const E = getPropertyDescriptor(e,
|
|
3321
|
+
const o = getKeys(e, s);
|
|
3322
|
+
for (let a = 0, f = o.length; a < f; a++) {
|
|
3323
|
+
let f = o[a];
|
|
3324
|
+
const E = getPropertyDescriptor(e, s, f);
|
|
3224
3325
|
if (E.get) continue;
|
|
3225
|
-
l =
|
|
3326
|
+
l = s && f in s ? s[f] : e[f];
|
|
3226
3327
|
if (t && isWrappable(l)) wrap(l, r);
|
|
3227
3328
|
if ((c = snapshotImpl(l, t, n, i)) !== e[f] || u) {
|
|
3228
3329
|
if (!u) {
|
|
@@ -3281,9 +3382,9 @@ function merge(...e) {
|
|
|
3281
3382
|
for (let i = 0; i < e.length; i++) {
|
|
3282
3383
|
const r = e[i];
|
|
3283
3384
|
t = t || (!!r && $PROXY in r);
|
|
3284
|
-
const
|
|
3285
|
-
if (
|
|
3286
|
-
for (let e = 0; e <
|
|
3385
|
+
const o = !!r && r[$SOURCES];
|
|
3386
|
+
if (o) {
|
|
3387
|
+
for (let e = 0; e < o.length; e++) n.push(o[e]);
|
|
3287
3388
|
} else n.push(typeof r === "function" ? ((t = true), createMemo(r)) : r);
|
|
3288
3389
|
}
|
|
3289
3390
|
if (SUPPORTS_PROXY && t) {
|
|
@@ -3316,35 +3417,35 @@ function merge(...e) {
|
|
|
3316
3417
|
}
|
|
3317
3418
|
const i = Object.create(null);
|
|
3318
3419
|
let r = false;
|
|
3319
|
-
let
|
|
3320
|
-
for (let e =
|
|
3420
|
+
let o = n.length - 1;
|
|
3421
|
+
for (let e = o; e >= 0; e--) {
|
|
3321
3422
|
const t = n[e];
|
|
3322
3423
|
if (!t) {
|
|
3323
|
-
e ===
|
|
3424
|
+
e === o && o--;
|
|
3324
3425
|
continue;
|
|
3325
3426
|
}
|
|
3326
|
-
const
|
|
3327
|
-
for (let n =
|
|
3328
|
-
const u =
|
|
3427
|
+
const s = Object.getOwnPropertyNames(t);
|
|
3428
|
+
for (let n = s.length - 1; n >= 0; n--) {
|
|
3429
|
+
const u = s[n];
|
|
3329
3430
|
if (u === "__proto__" || u === "constructor") continue;
|
|
3330
3431
|
if (!i[u]) {
|
|
3331
|
-
r = r || e !==
|
|
3432
|
+
r = r || e !== o;
|
|
3332
3433
|
const n = Object.getOwnPropertyDescriptor(t, u);
|
|
3333
3434
|
i[u] = n.get ? { enumerable: true, configurable: true, get: n.get.bind(t) } : n;
|
|
3334
3435
|
}
|
|
3335
3436
|
}
|
|
3336
3437
|
}
|
|
3337
|
-
if (!r) return n[
|
|
3338
|
-
const
|
|
3438
|
+
if (!r) return n[o];
|
|
3439
|
+
const s = {};
|
|
3339
3440
|
const u = Object.keys(i);
|
|
3340
3441
|
for (let e = u.length - 1; e >= 0; e--) {
|
|
3341
3442
|
const t = u[e],
|
|
3342
3443
|
n = i[t];
|
|
3343
|
-
if (n.get) Object.defineProperty(
|
|
3344
|
-
else
|
|
3444
|
+
if (n.get) Object.defineProperty(s, t, n);
|
|
3445
|
+
else s[t] = n.value;
|
|
3345
3446
|
}
|
|
3346
|
-
|
|
3347
|
-
return
|
|
3447
|
+
s[$SOURCES] = n;
|
|
3448
|
+
return s;
|
|
3348
3449
|
}
|
|
3349
3450
|
function omit(e, ...t) {
|
|
3350
3451
|
if (SUPPORTS_PROXY && $PROXY in e) {
|
|
@@ -3366,12 +3467,12 @@ function omit(e, ...t) {
|
|
|
3366
3467
|
const n = {};
|
|
3367
3468
|
const i = Object.getOwnPropertyNames(e);
|
|
3368
3469
|
const r = t.length > 4 && i.length > t.length ? new Set(t) : undefined;
|
|
3369
|
-
for (const
|
|
3370
|
-
if (r ? !r.has(
|
|
3371
|
-
const t = Object.getOwnPropertyDescriptor(e,
|
|
3470
|
+
for (const o of i) {
|
|
3471
|
+
if (r ? !r.has(o) : !t.includes(o)) {
|
|
3472
|
+
const t = Object.getOwnPropertyDescriptor(e, o);
|
|
3372
3473
|
!t.get && !t.set && t.enumerable && t.writable && t.configurable
|
|
3373
|
-
? (n[
|
|
3374
|
-
: Object.defineProperty(n,
|
|
3474
|
+
? (n[o] = t.value)
|
|
3475
|
+
: Object.defineProperty(n, o, t);
|
|
3375
3476
|
}
|
|
3376
3477
|
}
|
|
3377
3478
|
return n;
|
|
@@ -3379,29 +3480,29 @@ function omit(e, ...t) {
|
|
|
3379
3480
|
function mapArray(e, t, n) {
|
|
3380
3481
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
3381
3482
|
const r = t.length > 1;
|
|
3382
|
-
const
|
|
3383
|
-
const
|
|
3483
|
+
const o = t;
|
|
3484
|
+
const s = {
|
|
3384
3485
|
Ze: createOwner(),
|
|
3385
|
-
|
|
3386
|
-
|
|
3486
|
+
Be: 0,
|
|
3487
|
+
qe: e,
|
|
3387
3488
|
ze: [],
|
|
3388
|
-
Xe:
|
|
3489
|
+
Xe: o,
|
|
3389
3490
|
Je: [],
|
|
3390
3491
|
et: [],
|
|
3391
3492
|
tt: i,
|
|
3392
3493
|
nt: i || n?.keyed === false ? [] : undefined,
|
|
3393
3494
|
it: r && n?.keyed !== false ? [] : undefined,
|
|
3394
3495
|
rt: n?.keyed === false,
|
|
3395
|
-
|
|
3496
|
+
ot: n?.fallback
|
|
3396
3497
|
};
|
|
3397
|
-
const u = computed(updateKeyedMap.bind(
|
|
3398
|
-
|
|
3399
|
-
u.
|
|
3498
|
+
const u = computed(updateKeyedMap.bind(s));
|
|
3499
|
+
s.Ze.he = u;
|
|
3500
|
+
u.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
3400
3501
|
return accessor(u);
|
|
3401
3502
|
}
|
|
3402
3503
|
const pureOptions = { ownedWrite: true };
|
|
3403
3504
|
function updateKeyedMap() {
|
|
3404
|
-
const e = this.
|
|
3505
|
+
const e = this.qe() || [],
|
|
3405
3506
|
t = e.length;
|
|
3406
3507
|
e[$TRACK];
|
|
3407
3508
|
runWithOwner(this.Ze, () => {
|
|
@@ -3429,85 +3530,85 @@ function updateKeyedMap() {
|
|
|
3429
3530
|
return this.Xe(t);
|
|
3430
3531
|
};
|
|
3431
3532
|
if (t === 0) {
|
|
3432
|
-
if (this.
|
|
3533
|
+
if (this.Be !== 0) {
|
|
3433
3534
|
this.Ze.dispose(false);
|
|
3434
3535
|
this.et = [];
|
|
3435
3536
|
this.ze = [];
|
|
3436
3537
|
this.Je = [];
|
|
3437
|
-
this.
|
|
3538
|
+
this.Be = 0;
|
|
3438
3539
|
this.nt && (this.nt = []);
|
|
3439
3540
|
this.it && (this.it = []);
|
|
3440
3541
|
}
|
|
3441
|
-
if (this.
|
|
3442
|
-
this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.
|
|
3542
|
+
if (this.ot && !this.Je[0]) {
|
|
3543
|
+
this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.ot);
|
|
3443
3544
|
}
|
|
3444
|
-
} else if (this.
|
|
3545
|
+
} else if (this.Be === 0) {
|
|
3445
3546
|
if (this.et[0]) this.et[0].dispose();
|
|
3446
3547
|
this.Je = new Array(t);
|
|
3447
3548
|
for (i = 0; i < t; i++) {
|
|
3448
3549
|
this.ze[i] = e[i];
|
|
3449
3550
|
this.Je[i] = runWithOwner((this.et[i] = createOwner()), r);
|
|
3450
3551
|
}
|
|
3451
|
-
this.
|
|
3552
|
+
this.Be = t;
|
|
3452
3553
|
} else {
|
|
3453
|
-
let
|
|
3454
|
-
|
|
3554
|
+
let o,
|
|
3555
|
+
s,
|
|
3455
3556
|
u,
|
|
3456
3557
|
c,
|
|
3457
3558
|
l,
|
|
3458
3559
|
a,
|
|
3459
3560
|
f,
|
|
3460
3561
|
E = new Array(t),
|
|
3461
|
-
|
|
3462
|
-
|
|
3562
|
+
T = new Array(t),
|
|
3563
|
+
S = this.nt ? new Array(t) : undefined,
|
|
3463
3564
|
d = this.it ? new Array(t) : undefined;
|
|
3464
3565
|
for (
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3566
|
+
o = 0, s = Math.min(this.Be, t);
|
|
3567
|
+
o < s && (this.ze[o] === e[o] || (this.nt && compare(this.tt, this.ze[o], e[o])));
|
|
3568
|
+
o++
|
|
3468
3569
|
) {
|
|
3469
|
-
if (this.nt) setSignal(this.nt[
|
|
3570
|
+
if (this.nt) setSignal(this.nt[o], e[o]);
|
|
3470
3571
|
}
|
|
3471
3572
|
for (
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
u >=
|
|
3475
|
-
(this.ze[
|
|
3476
|
-
|
|
3573
|
+
s = this.Be - 1, u = t - 1;
|
|
3574
|
+
s >= o &&
|
|
3575
|
+
u >= o &&
|
|
3576
|
+
(this.ze[s] === e[u] || (this.nt && compare(this.tt, this.ze[s], e[u])));
|
|
3577
|
+
s--, u--
|
|
3477
3578
|
) {
|
|
3478
|
-
E[u] = this.Je[
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
d && (d[u] = this.it[
|
|
3579
|
+
E[u] = this.Je[s];
|
|
3580
|
+
T[u] = this.et[s];
|
|
3581
|
+
S && (S[u] = this.nt[s]);
|
|
3582
|
+
d && (d[u] = this.it[s]);
|
|
3482
3583
|
}
|
|
3483
3584
|
a = new Map();
|
|
3484
3585
|
f = new Array(u + 1);
|
|
3485
|
-
for (i = u; i >=
|
|
3586
|
+
for (i = u; i >= o; i--) {
|
|
3486
3587
|
c = e[i];
|
|
3487
3588
|
l = this.tt ? this.tt(c) : c;
|
|
3488
3589
|
n = a.get(l);
|
|
3489
3590
|
f[i] = n === undefined ? -1 : n;
|
|
3490
3591
|
a.set(l, i);
|
|
3491
3592
|
}
|
|
3492
|
-
for (n =
|
|
3593
|
+
for (n = o; n <= s; n++) {
|
|
3493
3594
|
c = this.ze[n];
|
|
3494
3595
|
l = this.tt ? this.tt(c) : c;
|
|
3495
3596
|
i = a.get(l);
|
|
3496
3597
|
if (i !== undefined && i !== -1) {
|
|
3497
3598
|
E[i] = this.Je[n];
|
|
3498
|
-
|
|
3499
|
-
|
|
3599
|
+
T[i] = this.et[n];
|
|
3600
|
+
S && (S[i] = this.nt[n]);
|
|
3500
3601
|
d && (d[i] = this.it[n]);
|
|
3501
3602
|
i = f[i];
|
|
3502
3603
|
a.set(l, i);
|
|
3503
3604
|
} else this.et[n].dispose();
|
|
3504
3605
|
}
|
|
3505
|
-
for (i =
|
|
3606
|
+
for (i = o; i < t; i++) {
|
|
3506
3607
|
if (i in E) {
|
|
3507
3608
|
this.Je[i] = E[i];
|
|
3508
|
-
this.et[i] =
|
|
3509
|
-
if (
|
|
3510
|
-
this.nt[i] =
|
|
3609
|
+
this.et[i] = T[i];
|
|
3610
|
+
if (S) {
|
|
3611
|
+
this.nt[i] = S[i];
|
|
3511
3612
|
setSignal(this.nt[i], e[i]);
|
|
3512
3613
|
}
|
|
3513
3614
|
if (d) {
|
|
@@ -3518,7 +3619,7 @@ function updateKeyedMap() {
|
|
|
3518
3619
|
this.Je[i] = runWithOwner((this.et[i] = createOwner()), r);
|
|
3519
3620
|
}
|
|
3520
3621
|
}
|
|
3521
|
-
this.Je = this.Je.slice(0, (this.
|
|
3622
|
+
this.Je = this.Je.slice(0, (this.Be = t));
|
|
3522
3623
|
this.ze = e.slice(0);
|
|
3523
3624
|
}
|
|
3524
3625
|
});
|
|
@@ -3529,17 +3630,17 @@ function repeat(e, t, n) {
|
|
|
3529
3630
|
const r = computed(
|
|
3530
3631
|
updateRepeat.bind({
|
|
3531
3632
|
Ze: createOwner(),
|
|
3532
|
-
|
|
3533
|
-
|
|
3633
|
+
Be: 0,
|
|
3634
|
+
st: 0,
|
|
3534
3635
|
ut: e,
|
|
3535
3636
|
Xe: i,
|
|
3536
3637
|
et: [],
|
|
3537
3638
|
Je: [],
|
|
3538
3639
|
ct: n?.from,
|
|
3539
|
-
|
|
3640
|
+
ot: n?.fallback
|
|
3540
3641
|
})
|
|
3541
3642
|
);
|
|
3542
|
-
r.
|
|
3643
|
+
r.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
3543
3644
|
return accessor(r);
|
|
3544
3645
|
}
|
|
3545
3646
|
function updateRepeat() {
|
|
@@ -3547,29 +3648,30 @@ function updateRepeat() {
|
|
|
3547
3648
|
const t = this.ct?.() || 0;
|
|
3548
3649
|
runWithOwner(this.Ze, () => {
|
|
3549
3650
|
if (e === 0) {
|
|
3550
|
-
if (this.
|
|
3651
|
+
if (this.Be !== 0) {
|
|
3551
3652
|
this.Ze.dispose(false);
|
|
3552
3653
|
this.et = [];
|
|
3553
3654
|
this.Je = [];
|
|
3554
|
-
this.
|
|
3655
|
+
this.Be = 0;
|
|
3656
|
+
this.st = 0;
|
|
3555
3657
|
}
|
|
3556
|
-
if (this.
|
|
3557
|
-
this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.
|
|
3658
|
+
if (this.ot && !this.Je[0]) {
|
|
3659
|
+
this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.ot);
|
|
3558
3660
|
}
|
|
3559
3661
|
return;
|
|
3560
3662
|
}
|
|
3561
3663
|
const n = t + e;
|
|
3562
|
-
const i = this.
|
|
3563
|
-
if (this.
|
|
3564
|
-
for (let e = n; e < i; e++) this.et[e - this.
|
|
3565
|
-
if (this.
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
this.et.splice(0,
|
|
3569
|
-
this.Je.splice(0,
|
|
3570
|
-
} else if (this.
|
|
3571
|
-
let n = i - this.
|
|
3572
|
-
let r = this.
|
|
3664
|
+
const i = this.st + this.Be;
|
|
3665
|
+
if (this.Be === 0 && this.et[0]) this.et[0].dispose();
|
|
3666
|
+
for (let e = n; e < i; e++) this.et[e - this.st].dispose();
|
|
3667
|
+
if (this.st < t) {
|
|
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);
|
|
3672
|
+
} else if (this.st > t) {
|
|
3673
|
+
let n = i - this.st - 1;
|
|
3674
|
+
let r = this.st - t;
|
|
3573
3675
|
this.et.length = this.Je.length = e;
|
|
3574
3676
|
while (n >= r) {
|
|
3575
3677
|
this.et[n] = this.et[n - r];
|
|
@@ -3584,8 +3686,8 @@ function updateRepeat() {
|
|
|
3584
3686
|
this.Je[e - t] = runWithOwner((this.et[e - t] = createOwner()), () => this.Xe(e));
|
|
3585
3687
|
}
|
|
3586
3688
|
this.Je = this.Je.slice(0, e);
|
|
3587
|
-
this.
|
|
3588
|
-
this.
|
|
3689
|
+
this.st = t;
|
|
3690
|
+
this.Be = e;
|
|
3589
3691
|
});
|
|
3590
3692
|
return this.Je;
|
|
3591
3693
|
}
|
|
@@ -3594,24 +3696,24 @@ function compare(e, t, n) {
|
|
|
3594
3696
|
}
|
|
3595
3697
|
function boundaryComputed(e, t) {
|
|
3596
3698
|
const n = computed(e, { lazy: true });
|
|
3597
|
-
n.
|
|
3598
|
-
const i = e !== undefined ? e : n.
|
|
3599
|
-
const r = t !== undefined ? t : n.
|
|
3600
|
-
n.
|
|
3601
|
-
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);
|
|
3602
3704
|
};
|
|
3603
3705
|
n.lt = t;
|
|
3604
|
-
n.
|
|
3706
|
+
n.ue &= ~CONFIG_AUTO_DISPOSE;
|
|
3605
3707
|
recompute(n, true);
|
|
3606
3708
|
return n;
|
|
3607
3709
|
}
|
|
3608
3710
|
function createBoundChildren(e, t, n, i) {
|
|
3609
|
-
const r = e.
|
|
3610
|
-
r.addChild((e.
|
|
3611
|
-
cleanup(() => r.removeChild(e.
|
|
3711
|
+
const r = e.F;
|
|
3712
|
+
r.addChild((e.F = n));
|
|
3713
|
+
cleanup(() => r.removeChild(e.F));
|
|
3612
3714
|
return runWithOwner(e, () => {
|
|
3613
3715
|
const e = computed(t);
|
|
3614
|
-
return boundaryComputed(() =>
|
|
3716
|
+
return boundaryComputed(() => flatten(read(e)), i);
|
|
3615
3717
|
});
|
|
3616
3718
|
}
|
|
3617
3719
|
const ON_INIT = Symbol();
|
|
@@ -3629,38 +3731,38 @@ function isSlotMinimallyReady(e) {
|
|
|
3629
3731
|
return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
|
|
3630
3732
|
}
|
|
3631
3733
|
function setSlotState(e, t, n, i) {
|
|
3632
|
-
setSignal(e.
|
|
3633
|
-
setSignal(e.
|
|
3734
|
+
setSignal(e.Tt, n);
|
|
3735
|
+
setSignal(e.St, i);
|
|
3634
3736
|
if (isRevealController(e)) {
|
|
3635
3737
|
if (!n && e.dt === t) e.dt = undefined;
|
|
3636
3738
|
return e.evaluate(n, i);
|
|
3637
3739
|
}
|
|
3638
|
-
if (!n && e.
|
|
3740
|
+
if (!n && e._t === t && e.Ot) e._t = undefined;
|
|
3639
3741
|
}
|
|
3640
3742
|
class RevealController {
|
|
3641
3743
|
Rt;
|
|
3642
3744
|
It;
|
|
3643
3745
|
ht = [];
|
|
3644
3746
|
dt;
|
|
3645
|
-
St = signal(false, { ownedWrite: true, Ye: true });
|
|
3646
3747
|
Tt = signal(false, { ownedWrite: true, Ye: true });
|
|
3748
|
+
St = signal(false, { ownedWrite: true, Ye: true });
|
|
3647
3749
|
Nt = true;
|
|
3648
3750
|
At = true;
|
|
3649
|
-
|
|
3751
|
+
Pt = false;
|
|
3650
3752
|
constructor(e, t) {
|
|
3651
3753
|
this.Rt = e;
|
|
3652
3754
|
this.It = t;
|
|
3653
3755
|
}
|
|
3654
|
-
|
|
3756
|
+
Ct(e) {
|
|
3655
3757
|
for (let t = 0; t < this.ht.length; t++) {
|
|
3656
3758
|
const n = this.ht[t];
|
|
3657
|
-
if ((isRevealController(n) ? n.dt : n.
|
|
3759
|
+
if ((isRevealController(n) ? n.dt : n._t) !== this) continue;
|
|
3658
3760
|
if (e(n) === false) return false;
|
|
3659
3761
|
}
|
|
3660
3762
|
return true;
|
|
3661
3763
|
}
|
|
3662
3764
|
isReady() {
|
|
3663
|
-
return this.
|
|
3765
|
+
return this.Ct(isSlotReady);
|
|
3664
3766
|
}
|
|
3665
3767
|
isMinimallyReady() {
|
|
3666
3768
|
const e = untrack(this.Rt);
|
|
@@ -3668,7 +3770,7 @@ class RevealController {
|
|
|
3668
3770
|
if (e === "natural") {
|
|
3669
3771
|
let e = false;
|
|
3670
3772
|
let t = false;
|
|
3671
|
-
this.
|
|
3773
|
+
this.Ct(n => {
|
|
3672
3774
|
e = true;
|
|
3673
3775
|
if (isSlotMinimallyReady(n)) {
|
|
3674
3776
|
t = true;
|
|
@@ -3678,7 +3780,7 @@ class RevealController {
|
|
|
3678
3780
|
return !e || t;
|
|
3679
3781
|
}
|
|
3680
3782
|
let t = true;
|
|
3681
|
-
this.
|
|
3783
|
+
this.Ct(e => {
|
|
3682
3784
|
t = isSlotMinimallyReady(e);
|
|
3683
3785
|
return false;
|
|
3684
3786
|
});
|
|
@@ -3688,7 +3790,7 @@ class RevealController {
|
|
|
3688
3790
|
if (this.ht.includes(e)) return;
|
|
3689
3791
|
this.ht.push(e);
|
|
3690
3792
|
const t = untrack(this.Rt);
|
|
3691
|
-
(setSignal(e.
|
|
3793
|
+
(setSignal(e.Tt, true), setSignal(e.St, t === "sequential" ? !!untrack(this.It) : false));
|
|
3692
3794
|
untrack(() => this.evaluate());
|
|
3693
3795
|
}
|
|
3694
3796
|
unregister(e) {
|
|
@@ -3697,39 +3799,39 @@ class RevealController {
|
|
|
3697
3799
|
untrack(() => this.evaluate());
|
|
3698
3800
|
}
|
|
3699
3801
|
evaluate(e, t) {
|
|
3700
|
-
if (this.
|
|
3701
|
-
this.
|
|
3802
|
+
if (this.Pt) return;
|
|
3803
|
+
this.Pt = true;
|
|
3702
3804
|
const n = this.Nt;
|
|
3703
3805
|
const i = this.At;
|
|
3704
3806
|
try {
|
|
3705
|
-
const n = e ?? read(this.
|
|
3807
|
+
const n = e ?? read(this.Tt),
|
|
3706
3808
|
i = untrack(this.Rt),
|
|
3707
3809
|
r = i === "sequential" && !!untrack(this.It),
|
|
3708
|
-
|
|
3810
|
+
o = t ?? r;
|
|
3709
3811
|
if (n) {
|
|
3710
|
-
this.
|
|
3812
|
+
this.Ct(e => setSlotState(e, this, true, o));
|
|
3711
3813
|
} else if (i === "natural") {
|
|
3712
|
-
this.
|
|
3814
|
+
this.Ct(e => {
|
|
3713
3815
|
if (isRevealController(e)) {
|
|
3714
|
-
setSignal(e.Tt, false);
|
|
3715
3816
|
setSignal(e.St, false);
|
|
3817
|
+
setSignal(e.Tt, false);
|
|
3716
3818
|
e.evaluate(false, false);
|
|
3717
3819
|
} else {
|
|
3718
3820
|
setSlotState(e, this, !isSlotReady(e), false);
|
|
3719
3821
|
}
|
|
3720
3822
|
});
|
|
3721
3823
|
} else if (i === "together") {
|
|
3722
|
-
const e = this.
|
|
3723
|
-
this.
|
|
3824
|
+
const e = this.Ct(isSlotMinimallyReady);
|
|
3825
|
+
this.Ct(t => setSlotState(t, this, !e, false));
|
|
3724
3826
|
} else {
|
|
3725
3827
|
let e = false;
|
|
3726
|
-
this.
|
|
3828
|
+
this.Ct(t => {
|
|
3727
3829
|
if (e) return setSlotState(t, this, true, r);
|
|
3728
3830
|
if (isSlotReady(t)) return setSlotState(t, this, false, false);
|
|
3729
3831
|
e = true;
|
|
3730
3832
|
if (isRevealController(t)) {
|
|
3731
|
-
setSignal(t.Tt, false);
|
|
3732
3833
|
setSignal(t.St, false);
|
|
3834
|
+
setSignal(t.Tt, false);
|
|
3733
3835
|
t.evaluate(false, false);
|
|
3734
3836
|
} else {
|
|
3735
3837
|
setSlotState(t, this, true, false);
|
|
@@ -3739,7 +3841,7 @@ class RevealController {
|
|
|
3739
3841
|
} finally {
|
|
3740
3842
|
this.Nt = this.isReady();
|
|
3741
3843
|
this.At = this.isMinimallyReady();
|
|
3742
|
-
this.
|
|
3844
|
+
this.Pt = false;
|
|
3743
3845
|
}
|
|
3744
3846
|
if (this.dt && (n !== this.Nt || i !== this.At)) this.dt.evaluate();
|
|
3745
3847
|
}
|
|
@@ -3749,11 +3851,11 @@ class CollectionQueue extends Queue {
|
|
|
3749
3851
|
ft = new Set();
|
|
3750
3852
|
Dt;
|
|
3751
3853
|
Et = true;
|
|
3752
|
-
St = signal(false, { ownedWrite: true, Ye: true });
|
|
3753
|
-
Re;
|
|
3754
3854
|
Tt = signal(false, { ownedWrite: true, Ye: true });
|
|
3755
|
-
|
|
3756
|
-
|
|
3855
|
+
ce;
|
|
3856
|
+
St = signal(false, { ownedWrite: true, Ye: true });
|
|
3857
|
+
_t;
|
|
3858
|
+
Ot = false;
|
|
3757
3859
|
yt;
|
|
3758
3860
|
vt = ON_INIT;
|
|
3759
3861
|
constructor(e) {
|
|
@@ -3761,12 +3863,12 @@ class CollectionQueue extends Queue {
|
|
|
3761
3863
|
this.gt = e;
|
|
3762
3864
|
}
|
|
3763
3865
|
run(e) {
|
|
3764
|
-
if (!e || (read(this.
|
|
3866
|
+
if (!e || (read(this.Tt) && (!_revealUsed || read(this.St)))) return;
|
|
3765
3867
|
return super.run(e);
|
|
3766
3868
|
}
|
|
3767
3869
|
notify(e, t, n, i) {
|
|
3768
3870
|
if (!(t & this.gt)) return super.notify(e, t, n, i);
|
|
3769
|
-
if (this.
|
|
3871
|
+
if (this.Ot && this.yt) {
|
|
3770
3872
|
const e = untrack(() => {
|
|
3771
3873
|
try {
|
|
3772
3874
|
return this.yt();
|
|
@@ -3776,23 +3878,23 @@ class CollectionQueue extends Queue {
|
|
|
3776
3878
|
});
|
|
3777
3879
|
if (e !== this.vt) {
|
|
3778
3880
|
this.vt = e;
|
|
3779
|
-
this.
|
|
3881
|
+
this.Ot = false;
|
|
3780
3882
|
this.ft.clear();
|
|
3781
3883
|
}
|
|
3782
3884
|
}
|
|
3783
|
-
if (this.gt & STATUS_PENDING && this.
|
|
3885
|
+
if (this.gt & STATUS_PENDING && this.Ot) return super.notify(e, t, n, i);
|
|
3784
3886
|
if (this.gt & STATUS_PENDING && n & STATUS_ERROR) {
|
|
3785
3887
|
return super.notify(e, STATUS_ERROR, n, i);
|
|
3786
3888
|
}
|
|
3787
3889
|
if (n & this.gt) {
|
|
3788
3890
|
this.Et = true;
|
|
3789
|
-
const t = i?.source || e.
|
|
3891
|
+
const t = i?.source || e.ce?.source;
|
|
3790
3892
|
if (t) {
|
|
3791
3893
|
const e = this.ft.size === 0;
|
|
3792
3894
|
this.ft.add(t);
|
|
3793
|
-
if (e) setSignal(this.
|
|
3895
|
+
if (e) setSignal(this.Tt, true);
|
|
3794
3896
|
if (this.gt & STATUS_ERROR) {
|
|
3795
|
-
setSignal(this.
|
|
3897
|
+
setSignal(this.ce, t.ce?.cause ?? t.ce);
|
|
3796
3898
|
}
|
|
3797
3899
|
}
|
|
3798
3900
|
}
|
|
@@ -3802,19 +3904,19 @@ class CollectionQueue extends Queue {
|
|
|
3802
3904
|
checkSources() {
|
|
3803
3905
|
for (const e of this.ft) {
|
|
3804
3906
|
if (
|
|
3805
|
-
e.
|
|
3806
|
-
(!(e.
|
|
3907
|
+
e.M & REACTIVE_DISPOSED ||
|
|
3908
|
+
(!(e.fe & this.gt) && !(this.gt & STATUS_ERROR && e.fe & STATUS_PENDING))
|
|
3807
3909
|
)
|
|
3808
3910
|
this.ft.delete(e);
|
|
3809
3911
|
}
|
|
3810
3912
|
if (!this.ft.size) {
|
|
3811
|
-
if (this.gt & STATUS_PENDING && this.Et && !this.
|
|
3812
|
-
this.Et = !!(this.Dt.
|
|
3913
|
+
if (this.gt & STATUS_PENDING && this.Et && !this.Ot && this.Dt) {
|
|
3914
|
+
this.Et = !!(this.Dt.fe & this.gt);
|
|
3813
3915
|
} else {
|
|
3814
3916
|
this.Et = false;
|
|
3815
3917
|
}
|
|
3816
3918
|
if (!this.Et) {
|
|
3817
|
-
setSignal(this.
|
|
3919
|
+
setSignal(this.Tt, false);
|
|
3818
3920
|
if (this.yt) {
|
|
3819
3921
|
try {
|
|
3820
3922
|
this.vt = untrack(() => this.yt());
|
|
@@ -3822,40 +3924,40 @@ class CollectionQueue extends Queue {
|
|
|
3822
3924
|
}
|
|
3823
3925
|
}
|
|
3824
3926
|
}
|
|
3825
|
-
if (_revealUsed) this.
|
|
3927
|
+
if (_revealUsed) this._t?.evaluate();
|
|
3826
3928
|
}
|
|
3827
3929
|
}
|
|
3828
3930
|
function createCollectionBoundary(e, t, n, i) {
|
|
3829
3931
|
const r = createOwner();
|
|
3830
3932
|
if (_revealUsed) setContext(RevealControllerContext, null, r);
|
|
3831
|
-
const
|
|
3832
|
-
if (e === STATUS_ERROR)
|
|
3833
|
-
if (i)
|
|
3834
|
-
const
|
|
3933
|
+
const o = new CollectionQueue(e);
|
|
3934
|
+
if (e === STATUS_ERROR) o.ce = signal(undefined, { ownedWrite: true, Ye: true });
|
|
3935
|
+
if (i) o.yt = i;
|
|
3936
|
+
const s = (o.Dt = createBoundChildren(r, t, o, e));
|
|
3835
3937
|
untrack(() => {
|
|
3836
3938
|
let t = false;
|
|
3837
3939
|
try {
|
|
3838
|
-
read(
|
|
3940
|
+
read(s);
|
|
3839
3941
|
} catch (e) {
|
|
3840
3942
|
if (e instanceof NotReadyError) t = true;
|
|
3841
3943
|
else throw e;
|
|
3842
3944
|
}
|
|
3843
|
-
|
|
3945
|
+
o.Et = t || !!(s.fe & e) || s.ce instanceof NotReadyError;
|
|
3844
3946
|
});
|
|
3845
3947
|
const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
|
|
3846
3948
|
if (u) {
|
|
3847
|
-
|
|
3848
|
-
u.register(
|
|
3849
|
-
cleanup(() => u.unregister(
|
|
3949
|
+
o._t = u;
|
|
3950
|
+
u.register(o);
|
|
3951
|
+
cleanup(() => u.unregister(o));
|
|
3850
3952
|
}
|
|
3851
3953
|
return accessor(
|
|
3852
3954
|
computed(() => {
|
|
3853
|
-
if (!read(
|
|
3854
|
-
const e = read(
|
|
3855
|
-
if (!untrack(() => read(
|
|
3955
|
+
if (!read(o.Tt)) {
|
|
3956
|
+
const e = read(s);
|
|
3957
|
+
if (!untrack(() => read(o.Tt))) return ((o.Ot = true), e);
|
|
3856
3958
|
}
|
|
3857
|
-
if (_revealUsed && read(
|
|
3858
|
-
return n(
|
|
3959
|
+
if (_revealUsed && read(o.St)) return undefined;
|
|
3960
|
+
return n(o);
|
|
3859
3961
|
})
|
|
3860
3962
|
);
|
|
3861
3963
|
}
|
|
@@ -3864,7 +3966,7 @@ function createLoadingBoundary(e, t, n) {
|
|
|
3864
3966
|
}
|
|
3865
3967
|
function createErrorBoundary(e, t) {
|
|
3866
3968
|
return createCollectionBoundary(STATUS_ERROR, e, e =>
|
|
3867
|
-
t(accessor(e.
|
|
3969
|
+
t(accessor(e.ce), () => {
|
|
3868
3970
|
for (const t of e.ft) recompute(t);
|
|
3869
3971
|
schedule();
|
|
3870
3972
|
})
|
|
@@ -3875,20 +3977,20 @@ function createRevealOrder(e, t) {
|
|
|
3875
3977
|
const n = createOwner();
|
|
3876
3978
|
const i = getContext(RevealControllerContext);
|
|
3877
3979
|
const r = t?.order || SEQUENTIAL_ACCESSOR,
|
|
3878
|
-
|
|
3879
|
-
const
|
|
3880
|
-
setContext(RevealControllerContext,
|
|
3980
|
+
o = t?.collapsed || FALSE_ACCESSOR;
|
|
3981
|
+
const s = new RevealController(r, o);
|
|
3982
|
+
setContext(RevealControllerContext, s, n);
|
|
3881
3983
|
return runWithOwner(n, () => {
|
|
3882
3984
|
const t = e();
|
|
3883
3985
|
computed(() => {
|
|
3884
3986
|
r();
|
|
3885
|
-
|
|
3886
|
-
|
|
3987
|
+
o();
|
|
3988
|
+
s.evaluate();
|
|
3887
3989
|
});
|
|
3888
3990
|
if (i) {
|
|
3889
|
-
|
|
3890
|
-
i.register(
|
|
3891
|
-
cleanup(() => i.unregister(
|
|
3991
|
+
s.dt = i;
|
|
3992
|
+
i.register(s);
|
|
3993
|
+
cleanup(() => i.unregister(s));
|
|
3892
3994
|
}
|
|
3893
3995
|
return t;
|
|
3894
3996
|
});
|
|
@@ -3917,9 +4019,9 @@ function flatten(e, t) {
|
|
|
3917
4019
|
function flattenArray(e, t = [], n) {
|
|
3918
4020
|
let i = null;
|
|
3919
4021
|
let r = false;
|
|
3920
|
-
for (let
|
|
4022
|
+
for (let o = 0; o < e.length; o++) {
|
|
3921
4023
|
try {
|
|
3922
|
-
let i = e[
|
|
4024
|
+
let i = e[o];
|
|
3923
4025
|
if (typeof i === "function" && !i.length) {
|
|
3924
4026
|
if (n?.doNotUnwrap) {
|
|
3925
4027
|
t.push(i);
|
|
@@ -3983,7 +4085,6 @@ export {
|
|
|
3983
4085
|
isDisposed,
|
|
3984
4086
|
isEqual,
|
|
3985
4087
|
isPending,
|
|
3986
|
-
isRefreshing,
|
|
3987
4088
|
isWrappable,
|
|
3988
4089
|
latest,
|
|
3989
4090
|
mapArray,
|