@solidjs/signals 2.0.0-beta.15 → 2.0.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +700 -385
- package/dist/node.cjs +1865 -1592
- package/dist/prod.js +1496 -1232
- package/dist/types/boundaries.d.ts +3 -3
- package/dist/types/core/async.d.ts +1 -0
- package/dist/types/core/core.d.ts +25 -1
- package/dist/types/core/dev.d.ts +10 -2
- package/dist/types/core/effect.d.ts +1 -3
- package/dist/types/core/graph.d.ts +1 -1
- package/dist/types/core/index.d.ts +2 -2
- package/dist/types/core/invariants.d.ts +49 -0
- package/dist/types/core/scheduler.d.ts +8 -0
- package/dist/types/core/types.d.ts +19 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/signals.d.ts +39 -2
- package/dist/types/store/projection.d.ts +2 -2
- package/dist/types/store/store.d.ts +28 -1
- package/dist/types-cjs/boundaries.d.cts +3 -3
- package/dist/types-cjs/core/async.d.cts +1 -0
- package/dist/types-cjs/core/core.d.cts +25 -1
- package/dist/types-cjs/core/dev.d.cts +10 -2
- package/dist/types-cjs/core/effect.d.cts +1 -3
- package/dist/types-cjs/core/graph.d.cts +1 -1
- package/dist/types-cjs/core/index.d.cts +2 -2
- package/dist/types-cjs/core/invariants.d.cts +49 -0
- package/dist/types-cjs/core/scheduler.d.cts +8 -0
- package/dist/types-cjs/core/types.d.cts +19 -0
- package/dist/types-cjs/index.d.cts +1 -1
- package/dist/types-cjs/signals.d.cts +39 -2
- package/dist/types-cjs/store/projection.d.cts +2 -2
- package/dist/types-cjs/store/store.d.cts +28 -1
- package/package.json +1 -1
- package/dist/types/src/boundaries.d.ts +0 -173
- package/dist/types/src/core/action.d.ts +0 -35
- package/dist/types/src/core/async.d.ts +0 -6
- package/dist/types/src/core/constants.d.ts +0 -51
- package/dist/types/src/core/context.d.ts +0 -36
- package/dist/types/src/core/core.d.ts +0 -174
- package/dist/types/src/core/dev.d.ts +0 -49
- package/dist/types/src/core/effect.d.ts +0 -32
- package/dist/types/src/core/error.d.ts +0 -38
- package/dist/types/src/core/external.d.ts +0 -45
- package/dist/types/src/core/graph.d.ts +0 -5
- package/dist/types/src/core/heap.d.ts +0 -14
- package/dist/types/src/core/index.d.ts +0 -12
- package/dist/types/src/core/lanes.d.ts +0 -54
- package/dist/types/src/core/owner.d.ts +0 -116
- package/dist/types/src/core/scheduler.d.ts +0 -122
- package/dist/types/src/core/types.d.ts +0 -85
- package/dist/types/src/index.d.ts +0 -9
- package/dist/types/src/map.d.ts +0 -53
- package/dist/types/src/signals.d.ts +0 -512
- package/dist/types/src/store/index.d.ts +0 -9
- package/dist/types/src/store/optimistic.d.ts +0 -45
- package/dist/types/src/store/projection.d.ts +0 -66
- package/dist/types/src/store/reconcile.d.ts +0 -23
- package/dist/types/src/store/store.d.ts +0 -125
- package/dist/types/src/store/storePath.d.ts +0 -58
- package/dist/types/src/store/utils.d.ts +0 -114
- package/dist/types-cjs/src/boundaries.d.cts +0 -173
- package/dist/types-cjs/src/core/action.d.cts +0 -35
- package/dist/types-cjs/src/core/async.d.cts +0 -6
- package/dist/types-cjs/src/core/constants.d.cts +0 -51
- package/dist/types-cjs/src/core/context.d.cts +0 -36
- package/dist/types-cjs/src/core/core.d.cts +0 -174
- package/dist/types-cjs/src/core/dev.d.cts +0 -49
- package/dist/types-cjs/src/core/effect.d.cts +0 -32
- package/dist/types-cjs/src/core/error.d.cts +0 -38
- package/dist/types-cjs/src/core/external.d.cts +0 -45
- package/dist/types-cjs/src/core/graph.d.cts +0 -5
- package/dist/types-cjs/src/core/heap.d.cts +0 -14
- package/dist/types-cjs/src/core/index.d.cts +0 -12
- package/dist/types-cjs/src/core/lanes.d.cts +0 -54
- package/dist/types-cjs/src/core/owner.d.cts +0 -116
- package/dist/types-cjs/src/core/scheduler.d.cts +0 -122
- package/dist/types-cjs/src/core/types.d.cts +0 -85
- package/dist/types-cjs/src/index.d.cts +0 -9
- package/dist/types-cjs/src/map.d.cts +0 -53
- package/dist/types-cjs/src/signals.d.cts +0 -512
- package/dist/types-cjs/src/store/index.d.cts +0 -9
- package/dist/types-cjs/src/store/optimistic.d.cts +0 -45
- package/dist/types-cjs/src/store/projection.d.cts +0 -66
- package/dist/types-cjs/src/store/reconcile.d.cts +0 -23
- package/dist/types-cjs/src/store/store.d.cts +0 -125
- package/dist/types-cjs/src/store/storePath.d.cts +0 -58
- package/dist/types-cjs/src/store/utils.d.cts +0 -114
package/dist/prod.js
CHANGED
|
@@ -54,6 +54,19 @@ const SUPPORTS_PROXY = typeof Proxy === "function";
|
|
|
54
54
|
const defaultContext = {};
|
|
55
55
|
const $REFRESH = Symbol("refresh");
|
|
56
56
|
const DEV$1 = undefined;
|
|
57
|
+
function devCheckActiveOverrides(e) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
function devCheckFlushStart() {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
typeof globalThis !== "undefined" && !!globalThis.process?.env?.COMPANION_CENSUS;
|
|
64
|
+
function devCensusCompanions(e) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
function devCheckQuiescent(e) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
57
70
|
const signalLanes = new WeakMap();
|
|
58
71
|
const activeLanes = new Set();
|
|
59
72
|
function getOrCreateLane(e) {
|
|
@@ -63,24 +76,26 @@ function getOrCreateLane(e) {
|
|
|
63
76
|
}
|
|
64
77
|
const n = e.t;
|
|
65
78
|
const i = n?.i ? findLane(n.i) : null;
|
|
66
|
-
t = { o: e, u: new Set(), l: [[], []],
|
|
79
|
+
t = { o: e, u: new Set(), l: [[], []], S: null, T: activeTransition, _: i };
|
|
67
80
|
signalLanes.set(e, t);
|
|
68
81
|
activeLanes.add(t);
|
|
69
|
-
e.O = false;
|
|
70
82
|
return t;
|
|
71
83
|
}
|
|
72
84
|
function findLane(e) {
|
|
73
|
-
while (e.
|
|
85
|
+
while (e.S) e = e.S;
|
|
74
86
|
return e;
|
|
75
87
|
}
|
|
76
88
|
function mergeLanes(e, t) {
|
|
77
89
|
e = findLane(e);
|
|
78
90
|
t = findLane(t);
|
|
79
91
|
if (e === t) return e;
|
|
80
|
-
t.
|
|
92
|
+
t.S = e;
|
|
81
93
|
for (const n of t.u) e.u.add(n);
|
|
94
|
+
t.u.clear();
|
|
82
95
|
e.l[0].push(...t.l[0]);
|
|
83
96
|
e.l[1].push(...t.l[1]);
|
|
97
|
+
t.l[0].length = 0;
|
|
98
|
+
t.l[1].length = 0;
|
|
84
99
|
return e;
|
|
85
100
|
}
|
|
86
101
|
function resolveLane(e) {
|
|
@@ -92,16 +107,16 @@ function resolveLane(e) {
|
|
|
92
107
|
return undefined;
|
|
93
108
|
}
|
|
94
109
|
function resolveTransition(e) {
|
|
95
|
-
return resolveLane(e)?.
|
|
110
|
+
return resolveLane(e)?.T ?? e.T;
|
|
96
111
|
}
|
|
97
112
|
function hasActiveOverride(e) {
|
|
98
|
-
return !!(e.
|
|
113
|
+
return !!(e.O !== undefined && e.O !== NOT_PENDING);
|
|
99
114
|
}
|
|
100
115
|
function assignOrMergeLane(e, t) {
|
|
101
116
|
const n = findLane(t);
|
|
102
117
|
const i = e.i;
|
|
103
118
|
if (i) {
|
|
104
|
-
if (i.
|
|
119
|
+
if (i.S) {
|
|
105
120
|
e.i = t;
|
|
106
121
|
return;
|
|
107
122
|
}
|
|
@@ -119,11 +134,13 @@ function assignOrMergeLane(e, t) {
|
|
|
119
134
|
e.i = t;
|
|
120
135
|
}
|
|
121
136
|
const transitions = new Set();
|
|
122
|
-
const dirtyQueue = {
|
|
123
|
-
const zombieQueue = {
|
|
137
|
+
const dirtyQueue = { p: new Array(2e3).fill(undefined), R: false, I: 0, h: 0 };
|
|
138
|
+
const zombieQueue = { p: new Array(2e3).fill(undefined), R: false, I: 0, h: 0 };
|
|
124
139
|
let clock = 0;
|
|
125
140
|
let activeTransition = null;
|
|
126
141
|
let scheduled = false;
|
|
142
|
+
let halted = false;
|
|
143
|
+
let haltNotified = false;
|
|
127
144
|
let syncDepth = 0;
|
|
128
145
|
let projectionWriteActive = false;
|
|
129
146
|
let stashedOptimisticReads = null;
|
|
@@ -136,7 +153,7 @@ function canUseSimpleSyncFlush(e) {
|
|
|
136
153
|
transitions.size === 0 &&
|
|
137
154
|
activeLanes.size === 0 &&
|
|
138
155
|
e.A.length === 0 &&
|
|
139
|
-
e.
|
|
156
|
+
e.N.length === 0 &&
|
|
140
157
|
e.C.size === 0 &&
|
|
141
158
|
transientStoreNodes.size === 0
|
|
142
159
|
);
|
|
@@ -144,14 +161,14 @@ function canUseSimpleSyncFlush(e) {
|
|
|
144
161
|
function sweepTransientStoreNodes() {
|
|
145
162
|
if (transientStoreNodes.size === 0) return;
|
|
146
163
|
for (const e of transientStoreNodes) {
|
|
147
|
-
if (e.
|
|
164
|
+
if (e.P !== null) {
|
|
148
165
|
transientStoreNodes.delete(e);
|
|
149
166
|
continue;
|
|
150
167
|
}
|
|
151
|
-
if (e.
|
|
152
|
-
if (e.
|
|
168
|
+
if (e.D !== NOT_PENDING) continue;
|
|
169
|
+
if (e.O !== undefined && e.O !== NOT_PENDING) continue;
|
|
153
170
|
transientStoreNodes.delete(e);
|
|
154
|
-
e.
|
|
171
|
+
e.m?.();
|
|
155
172
|
}
|
|
156
173
|
}
|
|
157
174
|
function enforceLoadingBoundary(e) {}
|
|
@@ -160,7 +177,7 @@ function shouldReadStashedOptimisticValue(e) {
|
|
|
160
177
|
}
|
|
161
178
|
function runLaneEffects(e) {
|
|
162
179
|
for (const t of activeLanes) {
|
|
163
|
-
if (t.
|
|
180
|
+
if (t.S || t.u.size > 0) continue;
|
|
164
181
|
const n = t.l[e - 1];
|
|
165
182
|
if (n.length) {
|
|
166
183
|
t.l[e - 1] = [];
|
|
@@ -169,18 +186,18 @@ function runLaneEffects(e) {
|
|
|
169
186
|
}
|
|
170
187
|
}
|
|
171
188
|
function queueStashedOptimisticEffects(e) {
|
|
172
|
-
for (let t = e.
|
|
189
|
+
for (let t = e.P; t !== null; t = t.L) {
|
|
173
190
|
const e = t.U;
|
|
174
|
-
if (!e.
|
|
175
|
-
if (e.
|
|
176
|
-
if (!e.
|
|
177
|
-
e.
|
|
178
|
-
e.F.enqueue(EFFECT_USER, e.
|
|
191
|
+
if (!e.V) continue;
|
|
192
|
+
if (e.V === EFFECT_TRACKED) {
|
|
193
|
+
if (!e.G) {
|
|
194
|
+
e.G = true;
|
|
195
|
+
e.F.enqueue(EFFECT_USER, e.k);
|
|
179
196
|
}
|
|
180
197
|
continue;
|
|
181
198
|
}
|
|
182
|
-
const n = e.
|
|
183
|
-
if (n.
|
|
199
|
+
const n = e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
200
|
+
if (n.I > e.H) n.I = e.H;
|
|
184
201
|
insertIntoHeap(e, n);
|
|
185
202
|
}
|
|
186
203
|
}
|
|
@@ -188,38 +205,42 @@ function setProjectionWriteActive(e) {
|
|
|
188
205
|
projectionWriteActive = e;
|
|
189
206
|
}
|
|
190
207
|
function mergeTransitionState(e, t) {
|
|
191
|
-
t.
|
|
192
|
-
e
|
|
193
|
-
for (const n of activeLanes) if (n.
|
|
194
|
-
e.
|
|
208
|
+
t.M = e;
|
|
209
|
+
e.j.push(...t.j);
|
|
210
|
+
for (const n of activeLanes) if (n.T === t) n.T = e;
|
|
211
|
+
e.N.push(...t.N);
|
|
195
212
|
for (const n of t.C) e.C.add(n);
|
|
196
|
-
for (const [n, i] of t
|
|
197
|
-
let t = e
|
|
198
|
-
if (!t) e
|
|
213
|
+
for (const [n, i] of t.$) {
|
|
214
|
+
let t = e.$.get(n);
|
|
215
|
+
if (!t) e.$.set(n, (t = new Set()));
|
|
199
216
|
for (const e of i) t.add(e);
|
|
200
217
|
}
|
|
201
|
-
for (const n of t.
|
|
218
|
+
for (const n of t.K) e.K.add(n);
|
|
202
219
|
}
|
|
203
220
|
function resolveOptimisticNodes(e) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
221
|
+
const t = e.length;
|
|
222
|
+
for (let n = 0; n < t; n++) {
|
|
223
|
+
const t = e[n];
|
|
224
|
+
t.i = undefined;
|
|
225
|
+
if (!(t.Y & STATUS_PENDING)) t.Y &= ~STATUS_UNINITIALIZED;
|
|
226
|
+
const i = t.O;
|
|
227
|
+
t.O = NOT_PENDING;
|
|
228
|
+
if (i !== NOT_PENDING && t.Z !== i) insertSubs(t, true);
|
|
229
|
+
t.T = null;
|
|
230
|
+
}
|
|
231
|
+
for (let n = 0; n < t; n++) {
|
|
232
|
+
const t = e[n];
|
|
233
|
+
if (t.B || t.q) snapCompanionsToState(t);
|
|
234
|
+
const i = t.t;
|
|
235
|
+
if (i && (i.B === t || i.q === t)) snapCompanionsToState(i);
|
|
236
|
+
}
|
|
237
|
+
e.splice(0, t);
|
|
217
238
|
}
|
|
218
239
|
function cleanupCompletedLanes(e) {
|
|
219
240
|
for (const t of activeLanes) {
|
|
220
|
-
const n = e ? t.
|
|
241
|
+
const n = e ? t.T === e : !t.T;
|
|
221
242
|
if (!n) continue;
|
|
222
|
-
if (!t.
|
|
243
|
+
if (!t.S) {
|
|
223
244
|
if (t.l[0].length) runQueue(t.l[0], EFFECT_RENDER);
|
|
224
245
|
if (t.l[1].length) runQueue(t.l[1], EFFECT_USER);
|
|
225
246
|
}
|
|
@@ -232,34 +253,53 @@ function cleanupCompletedLanes(e) {
|
|
|
232
253
|
}
|
|
233
254
|
}
|
|
234
255
|
function schedule() {
|
|
256
|
+
if (halted) {
|
|
257
|
+
notifyHalted();
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
235
260
|
if (scheduled) return;
|
|
236
261
|
scheduled = true;
|
|
237
|
-
if (!syncDepth && !globalQueue.
|
|
262
|
+
if (!syncDepth && !globalQueue.X && !projectionWriteActive) queueMicrotask(flush);
|
|
263
|
+
}
|
|
264
|
+
function haltReactivity() {
|
|
265
|
+
if (halted) return;
|
|
266
|
+
halted = true;
|
|
267
|
+
let e = "[REACTIVITY_HALTED] An uncaught error halted the reactive system.";
|
|
268
|
+
console.error(e);
|
|
269
|
+
}
|
|
270
|
+
function notifyHalted() {
|
|
271
|
+
if (haltNotified) return;
|
|
272
|
+
haltNotified = true;
|
|
273
|
+
console.error("[REACTIVITY_HALTED] Update ignored.");
|
|
274
|
+
}
|
|
275
|
+
function resetErrorHalt() {
|
|
276
|
+
halted = false;
|
|
277
|
+
haltNotified = false;
|
|
238
278
|
}
|
|
239
279
|
class Queue {
|
|
240
|
-
|
|
241
|
-
|
|
280
|
+
J = null;
|
|
281
|
+
ee = [[], []];
|
|
242
282
|
A = [];
|
|
243
283
|
created = clock;
|
|
244
284
|
addChild(e) {
|
|
245
285
|
this.A.push(e);
|
|
246
|
-
e.
|
|
286
|
+
e.J = this;
|
|
247
287
|
}
|
|
248
288
|
removeChild(e) {
|
|
249
289
|
const t = this.A.indexOf(e);
|
|
250
290
|
if (t >= 0) {
|
|
251
291
|
this.A.splice(t, 1);
|
|
252
|
-
e.
|
|
292
|
+
e.J = null;
|
|
253
293
|
}
|
|
254
294
|
}
|
|
255
295
|
notify(e, t, n, i) {
|
|
256
|
-
if (this.
|
|
296
|
+
if (this.J) return this.J.notify(e, t, n, i);
|
|
257
297
|
return false;
|
|
258
298
|
}
|
|
259
299
|
run(e) {
|
|
260
|
-
if (this.
|
|
261
|
-
const t = this.
|
|
262
|
-
this.
|
|
300
|
+
if (this.ee[e - 1].length) {
|
|
301
|
+
const t = this.ee[e - 1];
|
|
302
|
+
this.ee[e - 1] = [];
|
|
263
303
|
runQueue(t, e);
|
|
264
304
|
}
|
|
265
305
|
for (let t = 0; t < this.A.length; t++) this.A[t].run?.(e);
|
|
@@ -270,28 +310,28 @@ class Queue {
|
|
|
270
310
|
const n = findLane(currentOptimisticLane);
|
|
271
311
|
n.l[e - 1].push(t);
|
|
272
312
|
} else {
|
|
273
|
-
this.
|
|
313
|
+
this.ee[e - 1].push(t);
|
|
274
314
|
}
|
|
275
315
|
}
|
|
276
316
|
schedule();
|
|
277
317
|
}
|
|
278
318
|
stashQueues(e) {
|
|
279
|
-
e.
|
|
280
|
-
e.
|
|
281
|
-
this.
|
|
319
|
+
e.ee[0].push(...this.ee[0]);
|
|
320
|
+
e.ee[1].push(...this.ee[1]);
|
|
321
|
+
this.ee = [[], []];
|
|
282
322
|
for (let t = 0; t < this.A.length; t++) {
|
|
283
323
|
let n = this.A[t];
|
|
284
324
|
let i = e.A[t];
|
|
285
325
|
if (!i) {
|
|
286
|
-
i = {
|
|
326
|
+
i = { ee: [[], []], A: [] };
|
|
287
327
|
e.A[t] = i;
|
|
288
328
|
}
|
|
289
329
|
n.stashQueues(i);
|
|
290
330
|
}
|
|
291
331
|
}
|
|
292
332
|
restoreQueues(e) {
|
|
293
|
-
this.
|
|
294
|
-
this.
|
|
333
|
+
this.ee[0].push(...e.ee[0]);
|
|
334
|
+
this.ee[1].push(...e.ee[1]);
|
|
295
335
|
for (let t = 0; t < e.A.length; t++) {
|
|
296
336
|
const n = e.A[t];
|
|
297
337
|
let i = this.A[t];
|
|
@@ -300,41 +340,42 @@ class Queue {
|
|
|
300
340
|
}
|
|
301
341
|
}
|
|
302
342
|
class GlobalQueue extends Queue {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
343
|
+
X = false;
|
|
344
|
+
te = null;
|
|
345
|
+
ne = [];
|
|
346
|
+
N = [];
|
|
307
347
|
C = new Set();
|
|
308
|
-
static te;
|
|
309
|
-
static ne;
|
|
310
348
|
static ie;
|
|
311
|
-
static re
|
|
349
|
+
static re;
|
|
350
|
+
static oe;
|
|
351
|
+
static se = null;
|
|
312
352
|
flush() {
|
|
313
|
-
if (this.
|
|
314
|
-
this.
|
|
353
|
+
if (this.X) return;
|
|
354
|
+
this.X = true;
|
|
315
355
|
try {
|
|
316
|
-
|
|
356
|
+
if (false);
|
|
357
|
+
runHeap(dirtyQueue, GlobalQueue.ie);
|
|
317
358
|
if (activeTransition) {
|
|
318
359
|
const e = transitionComplete(activeTransition);
|
|
319
360
|
if (!e) {
|
|
320
361
|
const e = activeTransition;
|
|
321
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
322
|
-
this.
|
|
323
|
-
this.
|
|
324
|
-
this.
|
|
362
|
+
runHeap(zombieQueue, GlobalQueue.ie);
|
|
363
|
+
this.te = null;
|
|
364
|
+
this.ne = [];
|
|
365
|
+
this.N = [];
|
|
325
366
|
this.C = new Set();
|
|
326
367
|
runLaneEffects(EFFECT_RENDER);
|
|
327
368
|
runLaneEffects(EFFECT_USER);
|
|
328
|
-
this.stashQueues(e.
|
|
369
|
+
this.stashQueues(e.ue);
|
|
329
370
|
clock++;
|
|
330
|
-
scheduled = dirtyQueue.
|
|
331
|
-
reassignPendingTransition(e.
|
|
371
|
+
scheduled = dirtyQueue.h >= dirtyQueue.I;
|
|
372
|
+
reassignPendingTransition(e.ne);
|
|
332
373
|
activeTransition = null;
|
|
333
|
-
if (!e
|
|
374
|
+
if (!e.j.length && !e.$.size && e.N.length) {
|
|
334
375
|
stashedOptimisticReads = new Set();
|
|
335
|
-
for (let t = 0; t < e.
|
|
336
|
-
const n = e.
|
|
337
|
-
if (n.
|
|
376
|
+
for (let t = 0; t < e.N.length; t++) {
|
|
377
|
+
const n = e.N[t];
|
|
378
|
+
if (n.ce || n.le & CONFIG_OWNED_WRITE) continue;
|
|
338
379
|
stashedOptimisticReads.add(n);
|
|
339
380
|
queueStashedOptimisticEffects(n);
|
|
340
381
|
}
|
|
@@ -346,44 +387,52 @@ class GlobalQueue extends Queue {
|
|
|
346
387
|
}
|
|
347
388
|
return;
|
|
348
389
|
}
|
|
349
|
-
this.
|
|
350
|
-
this.restoreQueues(activeTransition.
|
|
390
|
+
this.ne !== activeTransition.ne && this.ne.push(...activeTransition.ne);
|
|
391
|
+
this.restoreQueues(activeTransition.ue);
|
|
351
392
|
transitions.delete(activeTransition);
|
|
352
393
|
const t = activeTransition;
|
|
353
394
|
activeTransition = null;
|
|
354
|
-
reassignPendingTransition(this.
|
|
395
|
+
reassignPendingTransition(this.ne);
|
|
355
396
|
finalizePureQueue(t);
|
|
356
397
|
} else {
|
|
357
398
|
if (canUseSimpleSyncFlush(this)) {
|
|
358
399
|
commitPendingNodes();
|
|
359
|
-
if (dirtyQueue.
|
|
360
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
400
|
+
if (dirtyQueue.h >= dirtyQueue.I) {
|
|
401
|
+
runHeap(dirtyQueue, GlobalQueue.ie);
|
|
361
402
|
commitPendingNodes();
|
|
362
403
|
}
|
|
363
404
|
} else {
|
|
364
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
405
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.ie);
|
|
365
406
|
finalizePureQueue();
|
|
366
407
|
}
|
|
367
408
|
}
|
|
368
409
|
clock++;
|
|
369
|
-
scheduled = dirtyQueue.
|
|
410
|
+
scheduled = dirtyQueue.h >= dirtyQueue.I;
|
|
370
411
|
activeLanes.size && runLaneEffects(EFFECT_RENDER);
|
|
371
412
|
this.run(EFFECT_RENDER);
|
|
372
413
|
activeLanes.size && runLaneEffects(EFFECT_USER);
|
|
373
414
|
this.run(EFFECT_USER);
|
|
374
415
|
if (false);
|
|
416
|
+
if (
|
|
417
|
+
false &&
|
|
418
|
+
!scheduled &&
|
|
419
|
+
!activeTransition &&
|
|
420
|
+
transitions.size === 0 &&
|
|
421
|
+
activeLanes.size === 0
|
|
422
|
+
);
|
|
423
|
+
if (false);
|
|
375
424
|
} finally {
|
|
376
|
-
this.
|
|
425
|
+
this.X = false;
|
|
377
426
|
}
|
|
378
427
|
}
|
|
379
428
|
notify(e, t, n, i) {
|
|
380
429
|
if (t & STATUS_PENDING) {
|
|
381
430
|
if (n & STATUS_PENDING) {
|
|
382
|
-
const t = i !== undefined ? i : e.
|
|
431
|
+
const t = i !== undefined ? i : e.ae;
|
|
383
432
|
if (activeTransition && t) {
|
|
384
433
|
const n = t.source;
|
|
385
|
-
let i = activeTransition
|
|
386
|
-
if (!i) activeTransition
|
|
434
|
+
let i = activeTransition.$.get(n);
|
|
435
|
+
if (!i) activeTransition.$.set(n, (i = new Set()));
|
|
387
436
|
const r = i.size;
|
|
388
437
|
i.add(e);
|
|
389
438
|
if (i.size !== r) schedule();
|
|
@@ -396,18 +445,18 @@ class GlobalQueue extends Queue {
|
|
|
396
445
|
initTransition(e) {
|
|
397
446
|
if (e) e = currentTransition(e);
|
|
398
447
|
if (e && e === activeTransition) return;
|
|
399
|
-
if (!e && activeTransition && activeTransition.
|
|
448
|
+
if (!e && activeTransition && activeTransition.fe === clock) return;
|
|
400
449
|
if (!activeTransition) {
|
|
401
450
|
activeTransition = e ?? {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
451
|
+
fe: clock,
|
|
452
|
+
ne: [],
|
|
453
|
+
$: new Map(),
|
|
454
|
+
N: [],
|
|
406
455
|
C: new Set(),
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
456
|
+
j: [],
|
|
457
|
+
ue: { ee: [[], []], A: [] },
|
|
458
|
+
M: false,
|
|
459
|
+
K: new Set()
|
|
411
460
|
};
|
|
412
461
|
} else if (e) {
|
|
413
462
|
const t = activeTransition;
|
|
@@ -416,30 +465,30 @@ class GlobalQueue extends Queue {
|
|
|
416
465
|
activeTransition = e;
|
|
417
466
|
}
|
|
418
467
|
transitions.add(activeTransition);
|
|
419
|
-
activeTransition.
|
|
420
|
-
if (this.
|
|
421
|
-
this.
|
|
422
|
-
activeTransition.
|
|
423
|
-
this.
|
|
424
|
-
}
|
|
425
|
-
if (this.
|
|
426
|
-
for (let e = 0; e < this.
|
|
427
|
-
const t = this.
|
|
428
|
-
t.
|
|
429
|
-
activeTransition.
|
|
468
|
+
activeTransition.fe = clock;
|
|
469
|
+
if (this.te !== null) {
|
|
470
|
+
this.te.T = activeTransition;
|
|
471
|
+
activeTransition.ne.push(this.te);
|
|
472
|
+
this.te = null;
|
|
473
|
+
}
|
|
474
|
+
if (this.ne !== activeTransition.ne) {
|
|
475
|
+
for (let e = 0; e < this.ne.length; e++) {
|
|
476
|
+
const t = this.ne[e];
|
|
477
|
+
t.T = activeTransition;
|
|
478
|
+
activeTransition.ne.push(t);
|
|
430
479
|
}
|
|
431
|
-
this.
|
|
480
|
+
this.ne = activeTransition.ne;
|
|
432
481
|
}
|
|
433
|
-
if (this.
|
|
434
|
-
for (let e = 0; e < this.
|
|
435
|
-
const t = this.
|
|
436
|
-
t.
|
|
437
|
-
activeTransition.
|
|
482
|
+
if (this.N !== activeTransition.N) {
|
|
483
|
+
for (let e = 0; e < this.N.length; e++) {
|
|
484
|
+
const t = this.N[e];
|
|
485
|
+
t.T = activeTransition;
|
|
486
|
+
activeTransition.N.push(t);
|
|
438
487
|
}
|
|
439
|
-
this.
|
|
488
|
+
this.N = activeTransition.N;
|
|
440
489
|
}
|
|
441
490
|
for (const e of activeLanes) {
|
|
442
|
-
if (!e.
|
|
491
|
+
if (!e.T) e.T = activeTransition;
|
|
443
492
|
}
|
|
444
493
|
if (this.C !== activeTransition.C) {
|
|
445
494
|
for (const e of this.C) activeTransition.C.add(e);
|
|
@@ -449,71 +498,73 @@ class GlobalQueue extends Queue {
|
|
|
449
498
|
}
|
|
450
499
|
function queuePendingNode(e) {
|
|
451
500
|
if (activeTransition) {
|
|
452
|
-
globalQueue.
|
|
501
|
+
globalQueue.ne.push(e);
|
|
453
502
|
return;
|
|
454
503
|
}
|
|
455
|
-
if (globalQueue.
|
|
456
|
-
globalQueue.
|
|
504
|
+
if (globalQueue.te === null && globalQueue.ne.length === 0) {
|
|
505
|
+
globalQueue.te = e;
|
|
457
506
|
return;
|
|
458
507
|
}
|
|
459
|
-
if (globalQueue.
|
|
460
|
-
globalQueue.
|
|
461
|
-
globalQueue.
|
|
508
|
+
if (globalQueue.te !== null) {
|
|
509
|
+
globalQueue.ne.push(globalQueue.te);
|
|
510
|
+
globalQueue.te = null;
|
|
462
511
|
}
|
|
463
|
-
globalQueue.
|
|
512
|
+
globalQueue.ne.push(e);
|
|
464
513
|
}
|
|
465
514
|
function insertSubs(e, t = false) {
|
|
466
515
|
const n = e.i || currentOptimisticLane;
|
|
467
|
-
const i = e.
|
|
468
|
-
for (let r = e.
|
|
469
|
-
if (i && r.U.
|
|
470
|
-
r.U.
|
|
516
|
+
const i = e.Ee !== undefined;
|
|
517
|
+
for (let r = e.P; r !== null; r = r.L) {
|
|
518
|
+
if (i && r.U.le & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
519
|
+
r.U.W |= REACTIVE_SNAPSHOT_STALE;
|
|
471
520
|
continue;
|
|
472
521
|
}
|
|
473
522
|
if (t && n) {
|
|
474
|
-
r.U.
|
|
523
|
+
r.U.W |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
475
524
|
assignOrMergeLane(r.U, n);
|
|
476
525
|
} else if (t) {
|
|
477
|
-
r.U.
|
|
526
|
+
r.U.W |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
478
527
|
r.U.i = undefined;
|
|
479
528
|
}
|
|
480
529
|
const e = r.U;
|
|
481
|
-
if (e.
|
|
482
|
-
if (!e.
|
|
483
|
-
e.
|
|
484
|
-
e.F.enqueue(EFFECT_USER, e.
|
|
530
|
+
if (e.V === EFFECT_TRACKED) {
|
|
531
|
+
if (!e.G) {
|
|
532
|
+
e.G = true;
|
|
533
|
+
e.F.enqueue(EFFECT_USER, e.k);
|
|
485
534
|
}
|
|
486
535
|
continue;
|
|
487
536
|
}
|
|
488
|
-
const o = r.U.
|
|
489
|
-
if (o.
|
|
537
|
+
const o = r.U.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
538
|
+
if (o.I > r.U.H) o.I = r.U.H;
|
|
490
539
|
insertIntoHeap(r.U, o);
|
|
491
540
|
}
|
|
492
541
|
}
|
|
493
542
|
function commitPendingNode(e) {
|
|
494
543
|
const t = e;
|
|
495
|
-
if (!t.
|
|
496
|
-
if (e.
|
|
497
|
-
e.Z = e.
|
|
498
|
-
e.
|
|
544
|
+
if (!t.ce) {
|
|
545
|
+
if (e.D !== NOT_PENDING) {
|
|
546
|
+
e.Z = e.D;
|
|
547
|
+
e.D = NOT_PENDING;
|
|
499
548
|
}
|
|
549
|
+
if (e.B || e.q) snapCompanionsToState(e);
|
|
500
550
|
return;
|
|
501
551
|
}
|
|
502
|
-
if (e.
|
|
503
|
-
e.Z = e.
|
|
504
|
-
e.
|
|
505
|
-
if (e.
|
|
552
|
+
if (e.D !== NOT_PENDING) {
|
|
553
|
+
e.Z = e.D;
|
|
554
|
+
e.D = NOT_PENDING;
|
|
555
|
+
if (e.V && e.V !== EFFECT_TRACKED) e.G = true;
|
|
506
556
|
}
|
|
507
|
-
t.
|
|
508
|
-
if (!(t.
|
|
509
|
-
if (t.
|
|
557
|
+
t.W &= ~REACTIVE_MANUAL_WRITE;
|
|
558
|
+
if (!(t.Y & STATUS_PENDING)) t.Y &= ~STATUS_UNINITIALIZED;
|
|
559
|
+
if (t.de !== null || t.Se !== null) GlobalQueue.re(t, false, true);
|
|
560
|
+
if (e.B || e.q) snapCompanionsToState(e);
|
|
510
561
|
}
|
|
511
562
|
function commitPendingNodes() {
|
|
512
|
-
if (globalQueue.
|
|
513
|
-
commitPendingNode(globalQueue.
|
|
514
|
-
globalQueue.
|
|
563
|
+
if (globalQueue.te !== null) {
|
|
564
|
+
commitPendingNode(globalQueue.te);
|
|
565
|
+
globalQueue.te = null;
|
|
515
566
|
}
|
|
516
|
-
const e = globalQueue.
|
|
567
|
+
const e = globalQueue.ne;
|
|
517
568
|
for (let t = 0; t < e.length; t++) {
|
|
518
569
|
commitPendingNode(e[t]);
|
|
519
570
|
}
|
|
@@ -523,31 +574,31 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
523
574
|
const n = !t;
|
|
524
575
|
if (n) commitPendingNodes();
|
|
525
576
|
if (!t && globalQueue.A.length) checkBoundaryChildren(globalQueue);
|
|
526
|
-
const i = dirtyQueue.
|
|
527
|
-
if (i) runHeap(dirtyQueue, GlobalQueue.
|
|
577
|
+
const i = dirtyQueue.h >= dirtyQueue.I;
|
|
578
|
+
if (i) runHeap(dirtyQueue, GlobalQueue.ie);
|
|
528
579
|
if (n) {
|
|
529
580
|
if (i) commitPendingNodes();
|
|
530
|
-
resolveOptimisticNodes(e ? e.
|
|
531
|
-
if (e && e.
|
|
532
|
-
for (const t of e.
|
|
533
|
-
if (t.
|
|
534
|
-
if (t.
|
|
535
|
-
if (!t.
|
|
536
|
-
t.
|
|
537
|
-
t.F.enqueue(EFFECT_USER, t.
|
|
581
|
+
resolveOptimisticNodes(e ? e.N : globalQueue.N);
|
|
582
|
+
if (e && e.K.size) {
|
|
583
|
+
for (const t of e.K) {
|
|
584
|
+
if (t.W & REACTIVE_DISPOSED) continue;
|
|
585
|
+
if (t.V === EFFECT_TRACKED) {
|
|
586
|
+
if (!t.G) {
|
|
587
|
+
t.G = true;
|
|
588
|
+
t.F.enqueue(EFFECT_USER, t.k);
|
|
538
589
|
}
|
|
539
590
|
continue;
|
|
540
591
|
}
|
|
541
|
-
const e = t.
|
|
542
|
-
if (e.
|
|
592
|
+
const e = t.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
593
|
+
if (e.I > t.H) e.I = t.H;
|
|
543
594
|
insertIntoHeap(t, e);
|
|
544
595
|
}
|
|
545
|
-
e.
|
|
596
|
+
e.K.clear();
|
|
546
597
|
}
|
|
547
598
|
const t = e ? e.C : globalQueue.C;
|
|
548
|
-
if (GlobalQueue.
|
|
599
|
+
if (GlobalQueue.se && t.size) {
|
|
549
600
|
for (const e of t) {
|
|
550
|
-
GlobalQueue.
|
|
601
|
+
GlobalQueue.se(e);
|
|
551
602
|
}
|
|
552
603
|
t.clear();
|
|
553
604
|
schedule();
|
|
@@ -568,7 +619,7 @@ function trackOptimisticStore(e) {
|
|
|
568
619
|
}
|
|
569
620
|
function reassignPendingTransition(e) {
|
|
570
621
|
for (let t = 0; t < e.length; t++) {
|
|
571
|
-
e[t].
|
|
622
|
+
e[t].T = activeTransition;
|
|
572
623
|
}
|
|
573
624
|
}
|
|
574
625
|
const globalQueue = new GlobalQueue();
|
|
@@ -585,9 +636,10 @@ function flush(e) {
|
|
|
585
636
|
}
|
|
586
637
|
}
|
|
587
638
|
}
|
|
588
|
-
if (globalQueue.
|
|
639
|
+
if (globalQueue.X) {
|
|
589
640
|
return;
|
|
590
641
|
}
|
|
642
|
+
if (halted) return;
|
|
591
643
|
while (scheduled || activeTransition) {
|
|
592
644
|
globalQueue.flush();
|
|
593
645
|
}
|
|
@@ -596,22 +648,22 @@ function runQueue(e, t) {
|
|
|
596
648
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
597
649
|
}
|
|
598
650
|
function reporterBlocksSource(e, t) {
|
|
599
|
-
if (e.
|
|
600
|
-
if (e.
|
|
601
|
-
for (let n = e.
|
|
651
|
+
if (e.W & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
|
|
652
|
+
if (e.Te === t || e._e?.has(t)) return true;
|
|
653
|
+
for (let n = e.Oe; n; n = n.pe) {
|
|
602
654
|
let e = n.Re;
|
|
603
655
|
while (e) {
|
|
604
656
|
if (e === t || e.Ie === t) return true;
|
|
605
657
|
e = e.t;
|
|
606
658
|
}
|
|
607
659
|
}
|
|
608
|
-
return !!(e.
|
|
660
|
+
return !!(e.Y & STATUS_PENDING && e.ae instanceof NotReadyError && e.ae.source === t);
|
|
609
661
|
}
|
|
610
662
|
function transitionComplete(e) {
|
|
611
|
-
if (e.
|
|
612
|
-
if (e
|
|
663
|
+
if (e.M) return true;
|
|
664
|
+
if (e.j.length) return false;
|
|
613
665
|
let t = true;
|
|
614
|
-
for (const [n, i] of e
|
|
666
|
+
for (const [n, i] of e.$) {
|
|
615
667
|
let r = false;
|
|
616
668
|
for (const e of i) {
|
|
617
669
|
if (reporterBlocksSource(e, n)) {
|
|
@@ -620,32 +672,31 @@ function transitionComplete(e) {
|
|
|
620
672
|
}
|
|
621
673
|
i.delete(e);
|
|
622
674
|
}
|
|
623
|
-
if (!r) e
|
|
624
|
-
else if (n.
|
|
675
|
+
if (!r) e.$.delete(n);
|
|
676
|
+
else if (n.Y & STATUS_PENDING && n.ae?.source === n) {
|
|
625
677
|
t = false;
|
|
626
678
|
break;
|
|
627
679
|
}
|
|
628
680
|
}
|
|
629
681
|
if (t) {
|
|
630
|
-
for (let n = 0; n < e.
|
|
631
|
-
const i = e.
|
|
682
|
+
for (let n = 0; n < e.N.length; n++) {
|
|
683
|
+
const i = e.N[n];
|
|
632
684
|
if (
|
|
633
685
|
hasActiveOverride(i) &&
|
|
634
|
-
"
|
|
635
|
-
i.
|
|
636
|
-
i.
|
|
637
|
-
i.ce.source !== i
|
|
686
|
+
"Y" in i &&
|
|
687
|
+
i.Y & STATUS_PENDING &&
|
|
688
|
+
i.ae instanceof NotReadyError
|
|
638
689
|
) {
|
|
639
690
|
t = false;
|
|
640
691
|
break;
|
|
641
692
|
}
|
|
642
693
|
}
|
|
643
694
|
}
|
|
644
|
-
t && (e.
|
|
695
|
+
t && (e.M = true);
|
|
645
696
|
return t;
|
|
646
697
|
}
|
|
647
698
|
function currentTransition(e) {
|
|
648
|
-
while (e.
|
|
699
|
+
while (e.M && typeof e.M === "object") e = e.M;
|
|
649
700
|
return e;
|
|
650
701
|
}
|
|
651
702
|
function setActiveTransition(e) {
|
|
@@ -661,102 +712,102 @@ function runInTransition(e, t) {
|
|
|
661
712
|
}
|
|
662
713
|
}
|
|
663
714
|
function actualInsertIntoHeap(e, t) {
|
|
664
|
-
const n = (e.
|
|
715
|
+
const n = (e.J?.he ? e.J.Ae?.H : e.J?.H) ?? -1;
|
|
665
716
|
if (n >= e.H) e.H = n + 1;
|
|
666
717
|
const i = e.H;
|
|
667
|
-
const r = t.
|
|
668
|
-
if (r === undefined) t.
|
|
718
|
+
const r = t.p[i];
|
|
719
|
+
if (r === undefined) t.p[i] = e;
|
|
669
720
|
else {
|
|
670
721
|
const t = r.Ne;
|
|
671
|
-
t.
|
|
722
|
+
t.Ce = e;
|
|
672
723
|
e.Ne = t;
|
|
673
724
|
r.Ne = e;
|
|
674
725
|
}
|
|
675
|
-
if (i > t.
|
|
726
|
+
if (i > t.h) t.h = i;
|
|
676
727
|
}
|
|
677
728
|
function insertIntoHeap(e, t) {
|
|
678
|
-
let n = e.
|
|
729
|
+
let n = e.W;
|
|
679
730
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_MANUAL_WRITE)) return;
|
|
680
731
|
if (n & REACTIVE_CHECK) {
|
|
681
|
-
e.
|
|
682
|
-
} else e.
|
|
732
|
+
e.W = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
733
|
+
} else e.W = n | REACTIVE_IN_HEAP;
|
|
683
734
|
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
684
735
|
}
|
|
685
736
|
function insertIntoHeapHeight(e, t) {
|
|
686
|
-
let n = e.
|
|
737
|
+
let n = e.W;
|
|
687
738
|
if (
|
|
688
739
|
n &
|
|
689
740
|
(REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT | REACTIVE_MANUAL_WRITE)
|
|
690
741
|
)
|
|
691
742
|
return;
|
|
692
|
-
e.
|
|
743
|
+
e.W = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
693
744
|
actualInsertIntoHeap(e, t);
|
|
694
745
|
}
|
|
695
746
|
function deleteFromHeap(e, t) {
|
|
696
|
-
const n = e.
|
|
747
|
+
const n = e.W;
|
|
697
748
|
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
698
|
-
e.
|
|
749
|
+
e.W = n & -25;
|
|
699
750
|
const i = e.H;
|
|
700
|
-
if (e.Ne === e) t.
|
|
751
|
+
if (e.Ne === e) t.p[i] = undefined;
|
|
701
752
|
else {
|
|
702
|
-
const n = e.
|
|
703
|
-
const r = t.
|
|
753
|
+
const n = e.Ce;
|
|
754
|
+
const r = t.p[i];
|
|
704
755
|
const o = n ?? r;
|
|
705
|
-
if (e === r) t.
|
|
706
|
-
else e.Ne.
|
|
756
|
+
if (e === r) t.p[i] = n;
|
|
757
|
+
else e.Ne.Ce = n;
|
|
707
758
|
o.Ne = e.Ne;
|
|
708
759
|
}
|
|
709
760
|
e.Ne = e;
|
|
710
|
-
e.
|
|
761
|
+
e.Ce = undefined;
|
|
711
762
|
}
|
|
712
763
|
function markHeap(e) {
|
|
713
|
-
if (e.
|
|
714
|
-
e.
|
|
715
|
-
for (let t = 0; t <= e.
|
|
716
|
-
for (let n = e.
|
|
717
|
-
if (n.
|
|
764
|
+
if (e.R) return;
|
|
765
|
+
e.R = true;
|
|
766
|
+
for (let t = 0; t <= e.h; t++) {
|
|
767
|
+
for (let n = e.p[t]; n !== undefined; n = n.Ce) {
|
|
768
|
+
if (n.W & REACTIVE_IN_HEAP) markNode(n);
|
|
718
769
|
}
|
|
719
770
|
}
|
|
720
771
|
}
|
|
721
772
|
function markNode(e, t = REACTIVE_DIRTY) {
|
|
722
|
-
const n = e.
|
|
773
|
+
const n = e.W;
|
|
723
774
|
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
724
|
-
e.
|
|
725
|
-
for (let t = e.
|
|
775
|
+
e.W = (n & -4) | t;
|
|
776
|
+
for (let t = e.P; t !== null; t = t.L) {
|
|
726
777
|
markNode(t.U, REACTIVE_CHECK);
|
|
727
778
|
}
|
|
728
|
-
if (e.
|
|
729
|
-
for (let t = e.
|
|
730
|
-
for (let e = t.
|
|
779
|
+
if (e.ye !== null) {
|
|
780
|
+
for (let t = e.ye; t !== null; t = t.Pe) {
|
|
781
|
+
for (let e = t.P; e !== null; e = e.L) {
|
|
731
782
|
markNode(e.U, REACTIVE_CHECK);
|
|
732
783
|
}
|
|
733
784
|
}
|
|
734
785
|
}
|
|
735
786
|
}
|
|
736
787
|
function runHeap(e, t) {
|
|
737
|
-
e.
|
|
738
|
-
for (e.
|
|
739
|
-
let n = e.
|
|
788
|
+
e.R = false;
|
|
789
|
+
for (e.I = 0; e.I <= e.h; e.I++) {
|
|
790
|
+
let n = e.p[e.I];
|
|
740
791
|
while (n !== undefined) {
|
|
741
|
-
if (n.
|
|
792
|
+
if (n.W & REACTIVE_IN_HEAP) t(n);
|
|
742
793
|
else adjustHeight(n, e);
|
|
743
|
-
n = e.
|
|
794
|
+
n = e.p[e.I];
|
|
744
795
|
}
|
|
745
796
|
}
|
|
746
|
-
e.
|
|
797
|
+
e.h = 0;
|
|
747
798
|
}
|
|
748
799
|
function adjustHeight(e, t) {
|
|
749
800
|
deleteFromHeap(e, t);
|
|
750
801
|
let n = e.H;
|
|
751
|
-
for (let t = e.
|
|
802
|
+
for (let t = e.Oe; t; t = t.pe) {
|
|
752
803
|
const e = t.Re;
|
|
753
804
|
const i = e.Ie || e;
|
|
754
|
-
if (i.
|
|
805
|
+
if (i.ce && i.H >= n) n = i.H + 1;
|
|
755
806
|
}
|
|
756
807
|
if (e.H !== n) {
|
|
757
808
|
e.H = n;
|
|
758
|
-
for (let t = e.
|
|
759
|
-
insertIntoHeapHeight(t.U, t.U.
|
|
809
|
+
for (let t = e.P; t !== null; t = t.L) {
|
|
810
|
+
insertIntoHeapHeight(t.U, t.U.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
760
811
|
}
|
|
761
812
|
}
|
|
762
813
|
}
|
|
@@ -764,8 +815,8 @@ const PENDING_OWNER = {};
|
|
|
764
815
|
function markDisposal(e) {
|
|
765
816
|
let t = e.ge;
|
|
766
817
|
while (t) {
|
|
767
|
-
const e = t.
|
|
768
|
-
t.
|
|
818
|
+
const e = t.W;
|
|
819
|
+
t.W = e | REACTIVE_ZOMBIE;
|
|
769
820
|
if (e & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT)) {
|
|
770
821
|
deleteFromHeap(t, e & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
771
822
|
if (e & REACTIVE_IN_HEAP) insertIntoHeap(t, zombieQueue);
|
|
@@ -776,53 +827,62 @@ function markDisposal(e) {
|
|
|
776
827
|
}
|
|
777
828
|
}
|
|
778
829
|
function dispose(e) {
|
|
779
|
-
let t = e.
|
|
830
|
+
let t = e.Oe;
|
|
780
831
|
while (t !== null) {
|
|
781
832
|
t = unlinkSubs(t);
|
|
782
833
|
}
|
|
783
|
-
e.
|
|
784
|
-
e.
|
|
834
|
+
e.Oe = null;
|
|
835
|
+
e.me = null;
|
|
785
836
|
disposeChildren(e, true);
|
|
786
837
|
}
|
|
787
838
|
function disposeChildren(e, t = false, n) {
|
|
788
|
-
const i = e.
|
|
839
|
+
const i = e.W;
|
|
789
840
|
if (i & REACTIVE_DISPOSED) return;
|
|
790
|
-
if (t)
|
|
791
|
-
|
|
792
|
-
|
|
841
|
+
if (t) {
|
|
842
|
+
e.W = i | REACTIVE_DISPOSED;
|
|
843
|
+
const t = e;
|
|
844
|
+
if (t.B || t.q) snapCompanionsToState(t);
|
|
845
|
+
}
|
|
846
|
+
if (t && e.ce) e.be = null;
|
|
847
|
+
let r = n ? e.de : e.ge;
|
|
793
848
|
while (r) {
|
|
794
849
|
const e = r.De;
|
|
795
|
-
if (r.
|
|
850
|
+
if (r.Oe) {
|
|
796
851
|
const e = r;
|
|
797
|
-
deleteFromHeap(e, e.
|
|
798
|
-
let t = e.
|
|
852
|
+
deleteFromHeap(e, e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
853
|
+
let t = e.Oe;
|
|
799
854
|
do {
|
|
800
855
|
t = unlinkSubs(t);
|
|
801
856
|
} while (t !== null);
|
|
802
|
-
e.
|
|
803
|
-
e.
|
|
857
|
+
e.Oe = null;
|
|
858
|
+
e.me = null;
|
|
804
859
|
}
|
|
805
860
|
disposeChildren(r, true);
|
|
806
861
|
r = e;
|
|
807
862
|
}
|
|
808
863
|
if (n) {
|
|
809
|
-
e.
|
|
864
|
+
e.de = null;
|
|
810
865
|
} else {
|
|
811
866
|
e.ge = null;
|
|
812
|
-
e.
|
|
867
|
+
e.ve = 0;
|
|
813
868
|
}
|
|
814
|
-
if (t && !n && !(i & REACTIVE_ZOMBIE) && e.
|
|
815
|
-
const t = e.
|
|
869
|
+
if (t && !n && !(i & REACTIVE_ZOMBIE) && e.J !== null && !(e.J.W & REACTIVE_DISPOSED)) {
|
|
870
|
+
const t = e.we;
|
|
816
871
|
const n = e.De;
|
|
817
872
|
if (t !== null) t.De = n;
|
|
818
|
-
else e.
|
|
819
|
-
if (n !== null) n.
|
|
820
|
-
e.
|
|
873
|
+
else e.J.ge = n;
|
|
874
|
+
if (n !== null) n.we = t;
|
|
875
|
+
e.we = null;
|
|
821
876
|
}
|
|
822
877
|
runDisposal(e, n);
|
|
878
|
+
if (t && e.Le) {
|
|
879
|
+
const t = e.Le;
|
|
880
|
+
e.Le = undefined;
|
|
881
|
+
t();
|
|
882
|
+
}
|
|
823
883
|
}
|
|
824
884
|
function runDisposal(e, t) {
|
|
825
|
-
let n = t ? e.
|
|
885
|
+
let n = t ? e.Se : e.Ue;
|
|
826
886
|
if (!n) return;
|
|
827
887
|
if (Array.isArray(n)) {
|
|
828
888
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -832,12 +892,12 @@ function runDisposal(e, t) {
|
|
|
832
892
|
} else {
|
|
833
893
|
n.call(n);
|
|
834
894
|
}
|
|
835
|
-
t ? (e.
|
|
895
|
+
t ? (e.Se = null) : (e.Ue = null);
|
|
836
896
|
}
|
|
837
897
|
function childId(e, t) {
|
|
838
898
|
let n = e;
|
|
839
|
-
while (n.
|
|
840
|
-
if (n.id != null) return formatId(n.id, t ? n.
|
|
899
|
+
while (n.le & CONFIG_TRANSPARENT && n.J) n = n.J;
|
|
900
|
+
if (n.id != null) return formatId(n.id, t ? n.ve++ : n.ve);
|
|
841
901
|
throw new Error("Cannot get child id from owner without an id");
|
|
842
902
|
}
|
|
843
903
|
function getNextChildId(e) {
|
|
@@ -860,13 +920,13 @@ function getOwner() {
|
|
|
860
920
|
}
|
|
861
921
|
function cleanup(e) {
|
|
862
922
|
if (!context) return e;
|
|
863
|
-
if (!context.
|
|
864
|
-
else if (Array.isArray(context.
|
|
865
|
-
else context.
|
|
923
|
+
if (!context.Ue) context.Ue = e;
|
|
924
|
+
else if (Array.isArray(context.Ue)) context.Ue.push(e);
|
|
925
|
+
else context.Ue = [context.Ue, e];
|
|
866
926
|
return e;
|
|
867
927
|
}
|
|
868
928
|
function isDisposed(e) {
|
|
869
|
-
return !!(e.
|
|
929
|
+
return !!(e.W & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
|
|
870
930
|
}
|
|
871
931
|
function disposeRootSelf(e = true) {
|
|
872
932
|
disposeChildren(this, e);
|
|
@@ -876,19 +936,19 @@ function createOwner(e) {
|
|
|
876
936
|
const n = e?.transparent ?? false;
|
|
877
937
|
const i = {
|
|
878
938
|
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
939
|
+
le: n ? CONFIG_TRANSPARENT : 0,
|
|
940
|
+
he: true,
|
|
941
|
+
Ae: t?.he ? t.Ae : t,
|
|
882
942
|
ge: null,
|
|
883
943
|
De: null,
|
|
884
|
-
|
|
885
|
-
|
|
944
|
+
we: null,
|
|
945
|
+
Ue: null,
|
|
886
946
|
F: t?.F ?? globalQueue,
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
947
|
+
Ve: t?.Ve || defaultContext,
|
|
948
|
+
ve: 0,
|
|
949
|
+
Se: null,
|
|
950
|
+
de: null,
|
|
951
|
+
J: t,
|
|
892
952
|
dispose: disposeRootSelf
|
|
893
953
|
};
|
|
894
954
|
if (t) {
|
|
@@ -897,7 +957,7 @@ function createOwner(e) {
|
|
|
897
957
|
t.ge = i;
|
|
898
958
|
} else {
|
|
899
959
|
i.De = e;
|
|
900
|
-
e.
|
|
960
|
+
e.we = i;
|
|
901
961
|
t.ge = i;
|
|
902
962
|
}
|
|
903
963
|
}
|
|
@@ -909,127 +969,136 @@ function createRoot(e, t) {
|
|
|
909
969
|
}
|
|
910
970
|
function unlinkSubs(e) {
|
|
911
971
|
const t = e.Re;
|
|
912
|
-
const n = e.
|
|
972
|
+
const n = e.pe;
|
|
913
973
|
const i = e.L;
|
|
914
|
-
const r = e.
|
|
915
|
-
if (i !== null) i.
|
|
916
|
-
else t.
|
|
974
|
+
const r = e.Ge;
|
|
975
|
+
if (i !== null) i.Ge = r;
|
|
976
|
+
else t.Fe = r;
|
|
917
977
|
if (r !== null) r.L = i;
|
|
918
978
|
else {
|
|
919
|
-
t.
|
|
979
|
+
t.P = i;
|
|
920
980
|
if (i === null) {
|
|
921
|
-
t.
|
|
981
|
+
t.m?.();
|
|
922
982
|
const e = t;
|
|
923
|
-
e.
|
|
983
|
+
e.ce && e.le & CONFIG_AUTO_DISPOSE && !(e.W & REACTIVE_ZOMBIE) && unobserved(e);
|
|
924
984
|
}
|
|
925
985
|
}
|
|
926
986
|
return n;
|
|
927
987
|
}
|
|
928
988
|
function trimStaleDeps(e) {
|
|
929
|
-
const t = e.
|
|
930
|
-
let n = t !== null ? t.
|
|
989
|
+
const t = e.me;
|
|
990
|
+
let n = t !== null ? t.pe : e.Oe;
|
|
931
991
|
if (n !== null) {
|
|
932
992
|
do {
|
|
933
993
|
n = unlinkSubs(n);
|
|
934
994
|
} while (n !== null);
|
|
935
|
-
if (t !== null) t.
|
|
936
|
-
else e.
|
|
995
|
+
if (t !== null) t.pe = null;
|
|
996
|
+
else e.Oe = null;
|
|
937
997
|
}
|
|
938
998
|
}
|
|
939
999
|
function unobserved(e) {
|
|
940
|
-
deleteFromHeap(e, e.
|
|
941
|
-
let t = e.
|
|
1000
|
+
deleteFromHeap(e, e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1001
|
+
let t = e.Oe;
|
|
942
1002
|
while (t !== null) {
|
|
943
1003
|
t = unlinkSubs(t);
|
|
944
1004
|
}
|
|
945
|
-
e.
|
|
946
|
-
e.
|
|
1005
|
+
e.Oe = null;
|
|
1006
|
+
e.me = null;
|
|
947
1007
|
disposeChildren(e, true);
|
|
948
1008
|
}
|
|
949
|
-
function link(e, t) {
|
|
950
|
-
const
|
|
951
|
-
if (
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
1009
|
+
function link(e, t, n = false) {
|
|
1010
|
+
const i = t.me;
|
|
1011
|
+
if (i !== null && i.Re === e) {
|
|
1012
|
+
i.ke = n;
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
let r = null;
|
|
1016
|
+
const o = t.W & REACTIVE_RECOMPUTING_DEPS;
|
|
1017
|
+
if (o) {
|
|
1018
|
+
r = i !== null ? i.pe : t.Oe;
|
|
1019
|
+
if (r !== null && r.Re === e) {
|
|
1020
|
+
r.We = t.He;
|
|
1021
|
+
t.me = r;
|
|
1022
|
+
r.ke = n;
|
|
958
1023
|
return;
|
|
959
1024
|
}
|
|
960
1025
|
}
|
|
961
|
-
const
|
|
962
|
-
if (
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
else t._e = s;
|
|
966
|
-
if (o !== null) o.L = s;
|
|
967
|
-
else e.D = s;
|
|
968
|
-
}
|
|
969
|
-
function isValidLink(e, t) {
|
|
970
|
-
const n = t.ye;
|
|
971
|
-
if (n !== null) {
|
|
972
|
-
let i = t._e;
|
|
973
|
-
do {
|
|
974
|
-
if (i === e) return true;
|
|
975
|
-
if (i === n) break;
|
|
976
|
-
i = i.Oe;
|
|
977
|
-
} while (i !== null);
|
|
1026
|
+
const s = e.Fe;
|
|
1027
|
+
if (s !== null && s.U === t && (!o || s.We === t.He)) {
|
|
1028
|
+
s.ke = n;
|
|
1029
|
+
return;
|
|
978
1030
|
}
|
|
979
|
-
|
|
1031
|
+
const u = (t.me = e.Fe = { Re: e, U: t, pe: r, Ge: s, L: null, We: t.He, ke: n });
|
|
1032
|
+
if (i !== null) i.pe = u;
|
|
1033
|
+
else t.Oe = u;
|
|
1034
|
+
if (s !== null) s.L = u;
|
|
1035
|
+
else e.P = u;
|
|
980
1036
|
}
|
|
981
1037
|
function addPendingSource(e, t) {
|
|
982
|
-
if (e.
|
|
983
|
-
if (!e.
|
|
984
|
-
e.
|
|
1038
|
+
if (e.Te === t || e._e?.has(t)) return false;
|
|
1039
|
+
if (!e.Te) {
|
|
1040
|
+
e.Te = t;
|
|
985
1041
|
return true;
|
|
986
1042
|
}
|
|
987
|
-
if (!e.
|
|
988
|
-
e.
|
|
1043
|
+
if (!e._e) {
|
|
1044
|
+
e._e = new Set([e.Te, t]);
|
|
989
1045
|
} else {
|
|
990
|
-
e.
|
|
1046
|
+
e._e.add(t);
|
|
991
1047
|
}
|
|
992
|
-
e.
|
|
1048
|
+
e.Te = undefined;
|
|
993
1049
|
return true;
|
|
994
1050
|
}
|
|
995
1051
|
function removePendingSource(e, t) {
|
|
996
|
-
if (e.
|
|
997
|
-
if (e.
|
|
998
|
-
e.
|
|
1052
|
+
if (e.Te) {
|
|
1053
|
+
if (e.Te !== t) return false;
|
|
1054
|
+
e.Te = undefined;
|
|
999
1055
|
return true;
|
|
1000
1056
|
}
|
|
1001
|
-
if (!e.
|
|
1002
|
-
if (e.
|
|
1003
|
-
e.
|
|
1004
|
-
e.
|
|
1005
|
-
} else if (e.
|
|
1006
|
-
e.
|
|
1057
|
+
if (!e._e?.delete(t)) return false;
|
|
1058
|
+
if (e._e.size === 1) {
|
|
1059
|
+
e.Te = e._e.values().next().value;
|
|
1060
|
+
e._e = undefined;
|
|
1061
|
+
} else if (e._e.size === 0) {
|
|
1062
|
+
e._e = undefined;
|
|
1007
1063
|
}
|
|
1008
1064
|
return true;
|
|
1009
1065
|
}
|
|
1010
1066
|
function clearPendingSources(e) {
|
|
1011
|
-
e.
|
|
1012
|
-
e.
|
|
1013
|
-
e.
|
|
1067
|
+
e.Te = undefined;
|
|
1068
|
+
e._e?.clear();
|
|
1069
|
+
e._e = undefined;
|
|
1014
1070
|
}
|
|
1015
1071
|
function setPendingError(e, t, n) {
|
|
1016
1072
|
if (!t) {
|
|
1017
|
-
e.
|
|
1073
|
+
e.ae = null;
|
|
1018
1074
|
return;
|
|
1019
1075
|
}
|
|
1020
1076
|
if (n instanceof NotReadyError && n.source === t) {
|
|
1021
|
-
e.
|
|
1077
|
+
e.ae = n;
|
|
1022
1078
|
return;
|
|
1023
1079
|
}
|
|
1024
|
-
const i = e.
|
|
1080
|
+
const i = e.ae;
|
|
1025
1081
|
if (!(i instanceof NotReadyError) || i.source !== t) {
|
|
1026
|
-
e.
|
|
1082
|
+
e.ae = new NotReadyError(t);
|
|
1027
1083
|
}
|
|
1028
1084
|
}
|
|
1029
1085
|
function forEachDependent(e, t) {
|
|
1030
|
-
for (let n = e.
|
|
1031
|
-
for (let n = e.
|
|
1032
|
-
for (let e = n.
|
|
1086
|
+
for (let n = e.P; n !== null; n = n.L) t(n.U, n);
|
|
1087
|
+
for (let n = e.ye; n !== null; n = n.Pe) {
|
|
1088
|
+
for (let e = n.P; e !== null; e = e.L) t(e.U, e);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
function enqueueForRerun(e) {
|
|
1092
|
+
if (e.V === EFFECT_TRACKED) {
|
|
1093
|
+
const t = e;
|
|
1094
|
+
if (!t.G) {
|
|
1095
|
+
t.G = true;
|
|
1096
|
+
t.F.enqueue(EFFECT_USER, t.k);
|
|
1097
|
+
}
|
|
1098
|
+
} else {
|
|
1099
|
+
const t = e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
1100
|
+
if (t.I > e.H) t.I = e.H;
|
|
1101
|
+
insertIntoHeap(e, t);
|
|
1033
1102
|
}
|
|
1034
1103
|
}
|
|
1035
1104
|
function settlePendingSource(e) {
|
|
@@ -1038,62 +1107,55 @@ function settlePendingSource(e) {
|
|
|
1038
1107
|
const settle = i => {
|
|
1039
1108
|
if (n.has(i) || !removePendingSource(i, e)) return;
|
|
1040
1109
|
n.add(i);
|
|
1041
|
-
i.
|
|
1042
|
-
const r = i.
|
|
1110
|
+
i.fe = clock;
|
|
1111
|
+
const r = i.Te ?? i._e?.values().next().value;
|
|
1043
1112
|
if (r) {
|
|
1044
1113
|
setPendingError(i, r);
|
|
1045
1114
|
updatePendingSignal(i);
|
|
1046
1115
|
} else {
|
|
1047
|
-
i.
|
|
1116
|
+
i.Y &= ~STATUS_PENDING;
|
|
1048
1117
|
setPendingError(i);
|
|
1049
1118
|
updatePendingSignal(i);
|
|
1050
|
-
if (i.
|
|
1051
|
-
|
|
1052
|
-
const e = i;
|
|
1053
|
-
if (!e.k) {
|
|
1054
|
-
e.k = true;
|
|
1055
|
-
e.F.enqueue(EFFECT_USER, e.W);
|
|
1056
|
-
}
|
|
1057
|
-
} else {
|
|
1058
|
-
const e = i.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
1059
|
-
if (e.h > i.H) e.h = i.H;
|
|
1060
|
-
insertIntoHeap(i, e);
|
|
1061
|
-
}
|
|
1119
|
+
if (i.Me) {
|
|
1120
|
+
enqueueForRerun(i);
|
|
1062
1121
|
t = true;
|
|
1063
1122
|
}
|
|
1064
|
-
i.
|
|
1123
|
+
i.Me = false;
|
|
1065
1124
|
}
|
|
1066
1125
|
forEachDependent(i, settle);
|
|
1067
1126
|
};
|
|
1068
1127
|
forEachDependent(e, settle);
|
|
1069
1128
|
if (t) schedule();
|
|
1070
1129
|
}
|
|
1130
|
+
function isThenable(e) {
|
|
1131
|
+
return e != null && typeof e === "object" && typeof e.then === "function";
|
|
1132
|
+
}
|
|
1071
1133
|
function handleAsync(e, t, n) {
|
|
1072
1134
|
let i = false;
|
|
1073
1135
|
let r = false;
|
|
1074
1136
|
if (typeof t === "object" && t !== null) {
|
|
1075
1137
|
untrack(() => {
|
|
1076
1138
|
i = t[Symbol.asyncIterator];
|
|
1077
|
-
r = !i &&
|
|
1139
|
+
r = !i && isThenable(t);
|
|
1078
1140
|
});
|
|
1079
1141
|
}
|
|
1080
1142
|
if (!r && !i) {
|
|
1081
|
-
e.
|
|
1143
|
+
e.be = null;
|
|
1082
1144
|
return t;
|
|
1083
1145
|
}
|
|
1084
|
-
e.
|
|
1146
|
+
e.be = t;
|
|
1085
1147
|
let o;
|
|
1086
1148
|
const handleError = n => {
|
|
1087
|
-
if (e.
|
|
1149
|
+
if (e.be !== t) return;
|
|
1088
1150
|
globalQueue.initTransition(resolveTransition(e));
|
|
1089
1151
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
1090
|
-
e.
|
|
1152
|
+
e.fe = clock;
|
|
1091
1153
|
};
|
|
1092
1154
|
const asyncWrite = (i, r) => {
|
|
1093
|
-
if (e.
|
|
1094
|
-
if (e.
|
|
1155
|
+
if (e.be !== t) return;
|
|
1156
|
+
if (e.W & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
1095
1157
|
globalQueue.initTransition(resolveTransition(e));
|
|
1096
|
-
const o = !!(e.
|
|
1158
|
+
const o = !!(e.Y & STATUS_UNINITIALIZED);
|
|
1097
1159
|
trimStaleDeps(e);
|
|
1098
1160
|
clearStatus(e);
|
|
1099
1161
|
const s = resolveLane(e);
|
|
@@ -1101,27 +1163,32 @@ function handleAsync(e, t, n) {
|
|
|
1101
1163
|
if (n) {
|
|
1102
1164
|
n(i);
|
|
1103
1165
|
if (o) clearStatus(e, true);
|
|
1104
|
-
} else if (e.
|
|
1105
|
-
if (e.
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
e.le = clock;
|
|
1166
|
+
} else if (e.O !== undefined) {
|
|
1167
|
+
if (e.D === NOT_PENDING) queuePendingNode(e);
|
|
1168
|
+
e.D = i;
|
|
1169
|
+
syncCompanions(e, i);
|
|
1170
|
+
if (!hasActiveOverride(e)) insertSubs(e);
|
|
1171
|
+
e.fe = clock;
|
|
1111
1172
|
} else if (s) {
|
|
1112
|
-
const t = e.
|
|
1173
|
+
const t = e.V;
|
|
1113
1174
|
const n = e.Z;
|
|
1114
|
-
const r = e.
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1175
|
+
const r = e.xe;
|
|
1176
|
+
try {
|
|
1177
|
+
if ((!t && o) || !r || !r(i, n)) {
|
|
1178
|
+
e.Z = i;
|
|
1179
|
+
e.fe = clock;
|
|
1180
|
+
syncCompanions(e, i);
|
|
1181
|
+
insertSubs(e, true);
|
|
1120
1182
|
}
|
|
1121
|
-
|
|
1183
|
+
} catch (t) {
|
|
1184
|
+
notifyStatus(e, STATUS_ERROR, t);
|
|
1122
1185
|
}
|
|
1123
1186
|
} else {
|
|
1124
|
-
|
|
1187
|
+
try {
|
|
1188
|
+
setSignal(e, () => i);
|
|
1189
|
+
} catch (t) {
|
|
1190
|
+
notifyStatus(e, STATUS_ERROR, t);
|
|
1191
|
+
}
|
|
1125
1192
|
}
|
|
1126
1193
|
settlePendingSource(e);
|
|
1127
1194
|
schedule();
|
|
@@ -1130,20 +1197,28 @@ function handleAsync(e, t, n) {
|
|
|
1130
1197
|
};
|
|
1131
1198
|
if (r) {
|
|
1132
1199
|
let n = false,
|
|
1133
|
-
i =
|
|
1200
|
+
i = false,
|
|
1201
|
+
r,
|
|
1202
|
+
s = true;
|
|
1134
1203
|
t.then(
|
|
1135
1204
|
e => {
|
|
1136
|
-
if (
|
|
1205
|
+
if (s) {
|
|
1137
1206
|
o = e;
|
|
1138
1207
|
n = true;
|
|
1139
1208
|
} else asyncWrite(e);
|
|
1140
1209
|
},
|
|
1141
1210
|
e => {
|
|
1142
|
-
if (
|
|
1211
|
+
if (s) {
|
|
1212
|
+
r = e;
|
|
1213
|
+
i = true;
|
|
1214
|
+
} else handleError(e);
|
|
1143
1215
|
}
|
|
1144
1216
|
);
|
|
1145
|
-
|
|
1146
|
-
if (
|
|
1217
|
+
s = false;
|
|
1218
|
+
if (i) {
|
|
1219
|
+
handleError(r);
|
|
1220
|
+
throw r;
|
|
1221
|
+
} else if (!n) {
|
|
1147
1222
|
globalQueue.initTransition(resolveTransition(e));
|
|
1148
1223
|
throw new NotReadyError(context);
|
|
1149
1224
|
}
|
|
@@ -1157,9 +1232,7 @@ function handleAsync(e, t, n) {
|
|
|
1157
1232
|
r = true;
|
|
1158
1233
|
try {
|
|
1159
1234
|
const e = n.return?.();
|
|
1160
|
-
if (e
|
|
1161
|
-
e.then(undefined, () => {});
|
|
1162
|
-
}
|
|
1235
|
+
if (isThenable(e)) e.then(undefined, () => {});
|
|
1163
1236
|
} catch {}
|
|
1164
1237
|
});
|
|
1165
1238
|
const iterate = () => {
|
|
@@ -1172,7 +1245,7 @@ function handleAsync(e, t, n) {
|
|
|
1172
1245
|
s = n;
|
|
1173
1246
|
u = true;
|
|
1174
1247
|
if (n.done) r = true;
|
|
1175
|
-
} else if (e.
|
|
1248
|
+
} else if (e.be !== t) {
|
|
1176
1249
|
return;
|
|
1177
1250
|
} else if (!n.done) asyncWrite(n.value, iterate);
|
|
1178
1251
|
else {
|
|
@@ -1182,7 +1255,7 @@ function handleAsync(e, t, n) {
|
|
|
1182
1255
|
}
|
|
1183
1256
|
},
|
|
1184
1257
|
n => {
|
|
1185
|
-
if (!c && e.
|
|
1258
|
+
if (!c && e.be === t) {
|
|
1186
1259
|
r = true;
|
|
1187
1260
|
handleError(n);
|
|
1188
1261
|
}
|
|
@@ -1205,55 +1278,62 @@ function handleAsync(e, t, n) {
|
|
|
1205
1278
|
return o;
|
|
1206
1279
|
}
|
|
1207
1280
|
function clearStatus(e, t = false) {
|
|
1208
|
-
if (e.
|
|
1209
|
-
if (e.
|
|
1210
|
-
e.
|
|
1211
|
-
if (e.
|
|
1212
|
-
if (e.
|
|
1213
|
-
if (e.
|
|
1281
|
+
if (e.Te || e._e) clearPendingSources(e);
|
|
1282
|
+
if (e.Me) e.Me = false;
|
|
1283
|
+
e.Y = t ? 0 : e.Y & STATUS_UNINITIALIZED;
|
|
1284
|
+
if (e.ae) setPendingError(e);
|
|
1285
|
+
if (e.B || e.q) updatePendingSignal(e);
|
|
1286
|
+
if (e.ye) updateChildCompanions(e);
|
|
1287
|
+
if (e.Qe) e.Qe();
|
|
1214
1288
|
}
|
|
1215
1289
|
function notifyStatus(e, t, n, i, r) {
|
|
1216
1290
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
1217
1291
|
n = new StatusError(e, n);
|
|
1218
1292
|
const o = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
1219
1293
|
const s = o === e;
|
|
1220
|
-
const u = t === STATUS_PENDING && e.
|
|
1294
|
+
const u = t === STATUS_PENDING && e.O !== undefined && !s;
|
|
1221
1295
|
const c = u && hasActiveOverride(e);
|
|
1222
1296
|
if (!i) {
|
|
1223
1297
|
if (t === STATUS_PENDING && o) {
|
|
1224
1298
|
addPendingSource(e, o);
|
|
1225
|
-
e.
|
|
1299
|
+
e.Y = STATUS_PENDING | (e.Y & STATUS_UNINITIALIZED);
|
|
1226
1300
|
setPendingError(e, o, n);
|
|
1227
1301
|
} else {
|
|
1228
1302
|
clearPendingSources(e);
|
|
1229
|
-
e.
|
|
1230
|
-
e.
|
|
1303
|
+
e.Y = t | (t !== STATUS_ERROR ? e.Y & STATUS_UNINITIALIZED : 0);
|
|
1304
|
+
e.ae = n;
|
|
1231
1305
|
}
|
|
1232
1306
|
updatePendingSignal(e);
|
|
1307
|
+
if (e.ye) updateChildCompanions(e);
|
|
1233
1308
|
}
|
|
1234
1309
|
if (r && !i) {
|
|
1235
1310
|
assignOrMergeLane(e, r);
|
|
1236
1311
|
}
|
|
1237
1312
|
const l = i || c;
|
|
1238
1313
|
const a = i || u ? undefined : r;
|
|
1239
|
-
if (e.
|
|
1314
|
+
if (e.Qe) {
|
|
1240
1315
|
if (i && t === STATUS_PENDING) {
|
|
1241
1316
|
return;
|
|
1242
1317
|
}
|
|
1243
1318
|
if (l) {
|
|
1244
|
-
e.
|
|
1319
|
+
e.Qe(t, n);
|
|
1245
1320
|
} else {
|
|
1246
|
-
e.
|
|
1321
|
+
e.Qe();
|
|
1247
1322
|
}
|
|
1248
1323
|
return;
|
|
1249
1324
|
}
|
|
1250
|
-
forEachDependent(e, e => {
|
|
1251
|
-
e.
|
|
1325
|
+
forEachDependent(e, (e, i) => {
|
|
1326
|
+
e.fe = clock;
|
|
1252
1327
|
if (
|
|
1253
|
-
(t === STATUS_PENDING && o && e.
|
|
1254
|
-
(t !== STATUS_PENDING && (e.
|
|
1328
|
+
(t === STATUS_PENDING && o && e.Te !== o && !e._e?.has(o)) ||
|
|
1329
|
+
(t !== STATUS_PENDING && (e.ae !== n || e.Te || e._e))
|
|
1255
1330
|
) {
|
|
1256
|
-
if (
|
|
1331
|
+
if (i.ke && t !== STATUS_PENDING && !(n instanceof NotReadyError)) {
|
|
1332
|
+
enqueueForRerun(e);
|
|
1333
|
+
schedule();
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1336
|
+
if (!l && !e.T) queuePendingNode(e);
|
|
1257
1337
|
notifyStatus(e, t, n, l, a);
|
|
1258
1338
|
}
|
|
1259
1339
|
});
|
|
@@ -1281,22 +1361,21 @@ function enableExternalSource(e) {
|
|
|
1281
1361
|
externalSourceConfig = { factory: t, untrack: n };
|
|
1282
1362
|
}
|
|
1283
1363
|
}
|
|
1284
|
-
GlobalQueue.
|
|
1285
|
-
GlobalQueue.
|
|
1364
|
+
GlobalQueue.ie = recompute;
|
|
1365
|
+
GlobalQueue.re = disposeChildren;
|
|
1286
1366
|
let tracking = false;
|
|
1287
1367
|
let stale = false;
|
|
1288
1368
|
let pendingCheckActive = false;
|
|
1289
|
-
let foundPending = false;
|
|
1290
1369
|
let latestReadActive = false;
|
|
1291
1370
|
let context = null;
|
|
1292
1371
|
let currentOptimisticLane = null;
|
|
1293
|
-
let
|
|
1372
|
+
let pendingProbe = null;
|
|
1294
1373
|
let snapshotCaptureActive = false;
|
|
1295
1374
|
let snapshotSources = null;
|
|
1296
1375
|
function ownerInSnapshotScope(e) {
|
|
1297
1376
|
while (e) {
|
|
1298
|
-
if (e.
|
|
1299
|
-
e = e.
|
|
1377
|
+
if (e.je) return true;
|
|
1378
|
+
e = e.J;
|
|
1300
1379
|
}
|
|
1301
1380
|
return false;
|
|
1302
1381
|
}
|
|
@@ -1305,27 +1384,27 @@ function setSnapshotCapture(e) {
|
|
|
1305
1384
|
if (e && !snapshotSources) snapshotSources = new Set();
|
|
1306
1385
|
}
|
|
1307
1386
|
function markSnapshotScope(e) {
|
|
1308
|
-
e.
|
|
1387
|
+
e.je = true;
|
|
1309
1388
|
}
|
|
1310
1389
|
function releaseSnapshotScope(e) {
|
|
1311
|
-
e.
|
|
1390
|
+
e.je = false;
|
|
1312
1391
|
releaseSubtree(e);
|
|
1313
1392
|
schedule();
|
|
1314
1393
|
}
|
|
1315
1394
|
function releaseSubtree(e) {
|
|
1316
1395
|
let t = e.ge;
|
|
1317
1396
|
while (t) {
|
|
1318
|
-
if (t.
|
|
1397
|
+
if (t.je) {
|
|
1319
1398
|
t = t.De;
|
|
1320
1399
|
continue;
|
|
1321
1400
|
}
|
|
1322
|
-
if (t.
|
|
1401
|
+
if (t.ce) {
|
|
1323
1402
|
const e = t;
|
|
1324
|
-
e.
|
|
1325
|
-
if (e.
|
|
1326
|
-
e.
|
|
1327
|
-
e.
|
|
1328
|
-
if (dirtyQueue.
|
|
1403
|
+
e.le &= ~CONFIG_IN_SNAPSHOT_SCOPE;
|
|
1404
|
+
if (e.W & REACTIVE_SNAPSHOT_STALE) {
|
|
1405
|
+
e.W &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1406
|
+
e.W |= REACTIVE_DIRTY;
|
|
1407
|
+
if (dirtyQueue.I > e.H) dirtyQueue.I = e.H;
|
|
1329
1408
|
insertIntoHeap(e, dirtyQueue);
|
|
1330
1409
|
}
|
|
1331
1410
|
}
|
|
@@ -1336,7 +1415,7 @@ function releaseSubtree(e) {
|
|
|
1336
1415
|
function clearSnapshots() {
|
|
1337
1416
|
if (snapshotSources) {
|
|
1338
1417
|
for (const e of snapshotSources) {
|
|
1339
|
-
delete e.
|
|
1418
|
+
delete e.Ee;
|
|
1340
1419
|
delete e[STORE_SNAPSHOT_PROPS];
|
|
1341
1420
|
}
|
|
1342
1421
|
snapshotSources = null;
|
|
@@ -1344,68 +1423,69 @@ function clearSnapshots() {
|
|
|
1344
1423
|
snapshotCaptureActive = false;
|
|
1345
1424
|
}
|
|
1346
1425
|
function recompute(e, t = false) {
|
|
1347
|
-
const n = e.
|
|
1426
|
+
const n = e.V;
|
|
1348
1427
|
if (!t) {
|
|
1349
|
-
if (e.
|
|
1350
|
-
globalQueue.initTransition(e.
|
|
1351
|
-
deleteFromHeap(e, e.
|
|
1352
|
-
e.
|
|
1353
|
-
if (e.
|
|
1354
|
-
else if (e.ge !== null || e.
|
|
1428
|
+
if (e.T && (!n || activeTransition) && activeTransition !== e.T)
|
|
1429
|
+
globalQueue.initTransition(e.T);
|
|
1430
|
+
deleteFromHeap(e, e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1431
|
+
e.be = null;
|
|
1432
|
+
if (e.T || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1433
|
+
else if (e.ge !== null || e.Ue !== null) {
|
|
1355
1434
|
markDisposal(e);
|
|
1356
|
-
e.
|
|
1357
|
-
e.
|
|
1358
|
-
e.
|
|
1435
|
+
e.Se = e.Ue;
|
|
1436
|
+
e.de = e.ge;
|
|
1437
|
+
e.Ue = null;
|
|
1359
1438
|
e.ge = null;
|
|
1360
|
-
e.
|
|
1439
|
+
e.ve = 0;
|
|
1361
1440
|
} else;
|
|
1362
1441
|
}
|
|
1363
|
-
let i = !!(e.
|
|
1364
|
-
const r = e.
|
|
1365
|
-
|
|
1366
|
-
const
|
|
1367
|
-
const
|
|
1442
|
+
let i = !!(e.W & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1443
|
+
const r = e.O !== undefined && e.O !== NOT_PENDING;
|
|
1444
|
+
!!(e.Y & STATUS_PENDING);
|
|
1445
|
+
const o = !!(e.Y & STATUS_UNINITIALIZED);
|
|
1446
|
+
const s = context;
|
|
1368
1447
|
context = e;
|
|
1369
|
-
e.
|
|
1370
|
-
e.
|
|
1371
|
-
e.
|
|
1372
|
-
|
|
1373
|
-
let
|
|
1374
|
-
let
|
|
1375
|
-
let
|
|
1448
|
+
e.me = null;
|
|
1449
|
+
e.He++;
|
|
1450
|
+
e.W = REACTIVE_RECOMPUTING_DEPS;
|
|
1451
|
+
e.fe = clock;
|
|
1452
|
+
let u = e.D === NOT_PENDING ? e.Z : e.D;
|
|
1453
|
+
let c = e.H;
|
|
1454
|
+
let l = tracking;
|
|
1455
|
+
let a = currentOptimisticLane;
|
|
1376
1456
|
tracking = true;
|
|
1377
1457
|
if (i) {
|
|
1378
1458
|
const t = resolveLane(e);
|
|
1379
1459
|
if (t) currentOptimisticLane = t;
|
|
1380
|
-
} else if (activeTransition && !t && activeTransition.
|
|
1381
|
-
for (let t = e.
|
|
1460
|
+
} else if (activeTransition && !t && activeTransition.N.length) {
|
|
1461
|
+
for (let t = e.Oe; t; t = t.pe) {
|
|
1382
1462
|
const n = t.Re;
|
|
1383
|
-
if (n.
|
|
1463
|
+
if (n.W & REACTIVE_OPTIMISTIC_DIRTY) {
|
|
1384
1464
|
const t = resolveLane(n);
|
|
1385
1465
|
if (t) {
|
|
1386
1466
|
i = true;
|
|
1387
1467
|
currentOptimisticLane = t;
|
|
1388
|
-
e.
|
|
1468
|
+
e.W |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
1389
1469
|
assignOrMergeLane(e, t);
|
|
1390
1470
|
break;
|
|
1391
1471
|
}
|
|
1392
1472
|
}
|
|
1393
1473
|
}
|
|
1394
1474
|
}
|
|
1395
|
-
const
|
|
1396
|
-
const
|
|
1397
|
-
if (
|
|
1475
|
+
const f = n && n !== EFFECT_USER;
|
|
1476
|
+
const E = stale;
|
|
1477
|
+
if (f) stale = true;
|
|
1398
1478
|
try {
|
|
1399
|
-
if (!false && e.
|
|
1400
|
-
|
|
1401
|
-
e.
|
|
1479
|
+
if (!false && e.le & CONFIG_SYNC) {
|
|
1480
|
+
u = e.ce(u);
|
|
1481
|
+
e.be = null;
|
|
1402
1482
|
} else {
|
|
1403
|
-
const t = e.
|
|
1404
|
-
const n = e.
|
|
1483
|
+
const t = e.be;
|
|
1484
|
+
const n = e.ce(u);
|
|
1405
1485
|
const i = typeof n === "object" && n !== null;
|
|
1406
|
-
const r = e.
|
|
1407
|
-
|
|
1408
|
-
if (!r && !i) e.
|
|
1486
|
+
const r = e.be !== t;
|
|
1487
|
+
u = r || !i ? n : handleAsync(e, n);
|
|
1488
|
+
if (!r && !i) e.be = null;
|
|
1409
1489
|
}
|
|
1410
1490
|
clearStatus(e, t);
|
|
1411
1491
|
if (e.i) {
|
|
@@ -1424,7 +1504,7 @@ function recompute(e, t = false) {
|
|
|
1424
1504
|
updatePendingSignal(t.o);
|
|
1425
1505
|
}
|
|
1426
1506
|
}
|
|
1427
|
-
if (t instanceof NotReadyError) e.
|
|
1507
|
+
if (t instanceof NotReadyError) e.Me = true;
|
|
1428
1508
|
notifyStatus(
|
|
1429
1509
|
e,
|
|
1430
1510
|
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
@@ -1433,103 +1513,114 @@ function recompute(e, t = false) {
|
|
|
1433
1513
|
t instanceof NotReadyError ? e.i : undefined
|
|
1434
1514
|
);
|
|
1435
1515
|
} finally {
|
|
1436
|
-
tracking =
|
|
1437
|
-
if (
|
|
1438
|
-
e.
|
|
1439
|
-
context =
|
|
1516
|
+
tracking = l;
|
|
1517
|
+
if (f) stale = E;
|
|
1518
|
+
e.W = REACTIVE_NONE | (t ? e.W & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1519
|
+
context = s;
|
|
1440
1520
|
}
|
|
1441
|
-
if (!e.
|
|
1521
|
+
if (!e.ae) {
|
|
1442
1522
|
trimStaleDeps(e);
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
e.
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1523
|
+
const s = r ? e.O : e.D === NOT_PENDING ? e.Z : e.D;
|
|
1524
|
+
let l = false;
|
|
1525
|
+
try {
|
|
1526
|
+
l = (!n && o) || !e.xe || !e.xe(s, u);
|
|
1527
|
+
} catch (t) {
|
|
1528
|
+
notifyStatus(e, STATUS_ERROR, t);
|
|
1529
|
+
}
|
|
1530
|
+
if (n && l) {
|
|
1531
|
+
e.G = !e.ae;
|
|
1532
|
+
if (!t) e.F.enqueue(n, (e.$e ??= GlobalQueue.oe.bind(null, e)));
|
|
1533
|
+
}
|
|
1534
|
+
if (e.ae);
|
|
1535
|
+
else if (l) {
|
|
1536
|
+
const o = r ? e.O : undefined;
|
|
1537
|
+
if (t || (n && activeTransition !== e.T) || i) {
|
|
1538
|
+
e.Z = u;
|
|
1453
1539
|
if (r && i) {
|
|
1454
|
-
e.
|
|
1455
|
-
e.
|
|
1540
|
+
e.O = u;
|
|
1541
|
+
e.D = NOT_PENDING;
|
|
1456
1542
|
}
|
|
1457
|
-
} else
|
|
1458
|
-
|
|
1459
|
-
|
|
1543
|
+
} else {
|
|
1544
|
+
e.D = u;
|
|
1545
|
+
if (activeTransition || e.T) syncCompanions(e, u);
|
|
1546
|
+
}
|
|
1547
|
+
if (!r || i || e.O !== o) insertSubs(e, i || r);
|
|
1460
1548
|
} else if (r) {
|
|
1461
|
-
e.
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1549
|
+
if (e.D === NOT_PENDING) queuePendingNode(e);
|
|
1550
|
+
e.D = u;
|
|
1551
|
+
} else if (e.H != c) {
|
|
1552
|
+
for (let t = e.P; t !== null; t = t.L) {
|
|
1553
|
+
insertIntoHeapHeight(t.U, t.U.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1465
1554
|
}
|
|
1466
1555
|
}
|
|
1467
1556
|
}
|
|
1468
|
-
currentOptimisticLane =
|
|
1469
|
-
const
|
|
1470
|
-
e.
|
|
1471
|
-
e.
|
|
1472
|
-
e.
|
|
1473
|
-
!!(e.
|
|
1474
|
-
|
|
1475
|
-
e.
|
|
1557
|
+
currentOptimisticLane = a;
|
|
1558
|
+
const d =
|
|
1559
|
+
e.D !== NOT_PENDING ||
|
|
1560
|
+
e.de !== null ||
|
|
1561
|
+
e.Se !== null ||
|
|
1562
|
+
!!(e.Y & (STATUS_PENDING | STATUS_UNINITIALIZED));
|
|
1563
|
+
d && (!t || e.Y & STATUS_PENDING) && (!e.T || r) && queuePendingNode(e);
|
|
1564
|
+
e.T && n && activeTransition !== e.T && runInTransition(e.T, () => recompute(e));
|
|
1476
1565
|
}
|
|
1477
1566
|
function updateIfNecessary(e) {
|
|
1478
|
-
if (e.
|
|
1479
|
-
for (let t = e.
|
|
1567
|
+
if (e.W & REACTIVE_CHECK) {
|
|
1568
|
+
for (let t = e.Oe; t; t = t.pe) {
|
|
1480
1569
|
const n = t.Re;
|
|
1481
1570
|
const i = n.Ie || n;
|
|
1482
|
-
if (i.
|
|
1571
|
+
if (i.ce) {
|
|
1483
1572
|
updateIfNecessary(i);
|
|
1484
1573
|
}
|
|
1485
|
-
if (e.
|
|
1574
|
+
if (e.W & REACTIVE_DIRTY) {
|
|
1486
1575
|
break;
|
|
1487
1576
|
}
|
|
1488
1577
|
}
|
|
1489
1578
|
}
|
|
1490
|
-
if (e.
|
|
1579
|
+
if (e.W & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.ae && e.fe < clock && !e.be)) {
|
|
1491
1580
|
recompute(e);
|
|
1492
1581
|
}
|
|
1493
|
-
e.
|
|
1582
|
+
e.W = e.W & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
|
|
1494
1583
|
}
|
|
1495
1584
|
function computed(e, t) {
|
|
1496
1585
|
const n = t?.transparent ?? false;
|
|
1497
1586
|
const i = {
|
|
1498
1587
|
id: t?.id ?? (n ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1499
|
-
|
|
1588
|
+
le:
|
|
1500
1589
|
(n ? CONFIG_TRANSPARENT : 0) |
|
|
1501
1590
|
(t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
|
|
1502
1591
|
(!context || t?.lazy ? CONFIG_AUTO_DISPOSE : 0) |
|
|
1503
1592
|
(t?.sync ? CONFIG_SYNC : 0) |
|
|
1593
|
+
(t?.Ke ? CONFIG_NO_SNAPSHOT : 0) |
|
|
1504
1594
|
(snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1595
|
+
xe: t?.equals != null ? t.equals : isEqual,
|
|
1596
|
+
m: t?.unobserved,
|
|
1597
|
+
Ue: null,
|
|
1508
1598
|
F: context?.F ?? globalQueue,
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1599
|
+
Ve: context?.Ve ?? defaultContext,
|
|
1600
|
+
ve: 0,
|
|
1601
|
+
ce: e,
|
|
1512
1602
|
Z: undefined,
|
|
1513
1603
|
H: 0,
|
|
1514
|
-
Pe: null,
|
|
1515
|
-
Ae: undefined,
|
|
1516
|
-
Ne: null,
|
|
1517
|
-
_e: null,
|
|
1518
1604
|
ye: null,
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1605
|
+
Ce: undefined,
|
|
1606
|
+
Ne: null,
|
|
1607
|
+
Oe: null,
|
|
1608
|
+
me: null,
|
|
1609
|
+
He: 0,
|
|
1610
|
+
P: null,
|
|
1611
|
+
Fe: null,
|
|
1612
|
+
J: context,
|
|
1522
1613
|
De: null,
|
|
1523
|
-
|
|
1614
|
+
we: null,
|
|
1524
1615
|
ge: null,
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1616
|
+
W: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1617
|
+
Y: STATUS_UNINITIALIZED,
|
|
1618
|
+
fe: clock,
|
|
1619
|
+
D: NOT_PENDING,
|
|
1620
|
+
Se: null,
|
|
1621
|
+
de: null,
|
|
1622
|
+
be: null,
|
|
1623
|
+
T: null
|
|
1533
1624
|
};
|
|
1534
1625
|
setupComputedNode(i, t);
|
|
1535
1626
|
return i;
|
|
@@ -1538,47 +1629,47 @@ function createEffectNode(e, t, n, i, r, o) {
|
|
|
1538
1629
|
const s = o?.transparent ?? false;
|
|
1539
1630
|
const u = {
|
|
1540
1631
|
id: o?.id ?? (s ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1541
|
-
|
|
1632
|
+
le:
|
|
1542
1633
|
(s ? CONFIG_TRANSPARENT : 0) |
|
|
1543
1634
|
(o?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
|
|
1544
1635
|
(o?.sync ? CONFIG_SYNC : 0) |
|
|
1545
1636
|
(snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1637
|
+
xe: false,
|
|
1638
|
+
m: o?.unobserved,
|
|
1639
|
+
Ue: null,
|
|
1549
1640
|
F: context?.F ?? globalQueue,
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1641
|
+
Ve: context?.Ve ?? defaultContext,
|
|
1642
|
+
ve: 0,
|
|
1643
|
+
ce: e,
|
|
1553
1644
|
Z: undefined,
|
|
1554
1645
|
H: 0,
|
|
1555
|
-
Pe: null,
|
|
1556
|
-
Ae: undefined,
|
|
1557
|
-
Ne: null,
|
|
1558
|
-
_e: null,
|
|
1559
1646
|
ye: null,
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1647
|
+
Ce: undefined,
|
|
1648
|
+
Ne: null,
|
|
1649
|
+
Oe: null,
|
|
1650
|
+
me: null,
|
|
1651
|
+
He: 0,
|
|
1652
|
+
P: null,
|
|
1653
|
+
Fe: null,
|
|
1654
|
+
J: context,
|
|
1563
1655
|
De: null,
|
|
1564
|
-
|
|
1656
|
+
we: null,
|
|
1565
1657
|
ge: null,
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
Me: r
|
|
1658
|
+
W: REACTIVE_LAZY,
|
|
1659
|
+
Y: STATUS_UNINITIALIZED,
|
|
1660
|
+
fe: clock,
|
|
1661
|
+
D: NOT_PENDING,
|
|
1662
|
+
Se: null,
|
|
1663
|
+
de: null,
|
|
1664
|
+
be: null,
|
|
1665
|
+
T: null,
|
|
1666
|
+
G: false,
|
|
1667
|
+
Ye: undefined,
|
|
1668
|
+
Ze: t,
|
|
1669
|
+
Be: n,
|
|
1670
|
+
Le: undefined,
|
|
1671
|
+
V: i,
|
|
1672
|
+
Qe: r
|
|
1582
1673
|
};
|
|
1583
1674
|
setupComputedNode(u, lazyOptions);
|
|
1584
1675
|
return u;
|
|
@@ -1586,65 +1677,65 @@ function createEffectNode(e, t, n, i, r, o) {
|
|
|
1586
1677
|
const lazyOptions = { lazy: true };
|
|
1587
1678
|
function setupComputedNode(e, t) {
|
|
1588
1679
|
e.Ne = e;
|
|
1589
|
-
const n = context?.
|
|
1680
|
+
const n = context?.he ? context.Ae : context;
|
|
1590
1681
|
if (context) {
|
|
1591
1682
|
const t = context.ge;
|
|
1592
1683
|
if (t === null) {
|
|
1593
1684
|
context.ge = e;
|
|
1594
1685
|
} else {
|
|
1595
1686
|
e.De = t;
|
|
1596
|
-
t.
|
|
1687
|
+
t.we = e;
|
|
1597
1688
|
context.ge = e;
|
|
1598
1689
|
}
|
|
1599
1690
|
}
|
|
1600
1691
|
if (n) e.H = n.H + 1;
|
|
1601
1692
|
if (externalSourceConfig) {
|
|
1602
1693
|
const t = signal(undefined, { equals: false, ownedWrite: true });
|
|
1603
|
-
const n = externalSourceConfig.factory(e.
|
|
1694
|
+
const n = externalSourceConfig.factory(e.ce, () => {
|
|
1604
1695
|
setSignal(t, undefined);
|
|
1605
1696
|
});
|
|
1606
1697
|
cleanup(() => n.dispose());
|
|
1607
|
-
e.
|
|
1698
|
+
e.ce = e => {
|
|
1608
1699
|
read(t);
|
|
1609
1700
|
return n.track(e);
|
|
1610
1701
|
};
|
|
1611
1702
|
}
|
|
1612
1703
|
!t?.lazy && recompute(e, true);
|
|
1613
1704
|
if (snapshotCaptureActive && !t?.lazy) {
|
|
1614
|
-
if (!(e.
|
|
1615
|
-
e.
|
|
1705
|
+
if (!(e.Y & STATUS_PENDING) && !(e.le & CONFIG_NO_SNAPSHOT)) {
|
|
1706
|
+
e.Ee = e.Z === undefined ? NO_SNAPSHOT : e.Z;
|
|
1616
1707
|
snapshotSources.add(e);
|
|
1617
1708
|
}
|
|
1618
1709
|
}
|
|
1619
1710
|
}
|
|
1620
1711
|
function signal(e, t, n = null) {
|
|
1621
1712
|
const i = {
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1713
|
+
xe: t?.equals != null ? t.equals : isEqual,
|
|
1714
|
+
le: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.Ke ? CONFIG_NO_SNAPSHOT : 0),
|
|
1715
|
+
m: t?.unobserved,
|
|
1625
1716
|
Z: e,
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1717
|
+
P: null,
|
|
1718
|
+
Fe: null,
|
|
1719
|
+
fe: clock,
|
|
1629
1720
|
Ie: n,
|
|
1630
|
-
|
|
1631
|
-
|
|
1721
|
+
Pe: n?.ye || null,
|
|
1722
|
+
D: NOT_PENDING
|
|
1632
1723
|
};
|
|
1633
|
-
n && (n.
|
|
1634
|
-
if (snapshotCaptureActive && !(i.
|
|
1635
|
-
i.
|
|
1724
|
+
n && (n.ye = i);
|
|
1725
|
+
if (snapshotCaptureActive && !(i.le & CONFIG_NO_SNAPSHOT) && !((n?.Y ?? 0) & STATUS_PENDING)) {
|
|
1726
|
+
i.Ee = e === undefined ? NO_SNAPSHOT : e;
|
|
1636
1727
|
snapshotSources.add(i);
|
|
1637
1728
|
}
|
|
1638
1729
|
return i;
|
|
1639
1730
|
}
|
|
1640
1731
|
function optimisticSignal(e, t) {
|
|
1641
1732
|
const n = signal(e, t);
|
|
1642
|
-
n.
|
|
1733
|
+
n.O = NOT_PENDING;
|
|
1643
1734
|
return n;
|
|
1644
1735
|
}
|
|
1645
1736
|
function optimisticComputed(e, t) {
|
|
1646
1737
|
const n = computed(e, t);
|
|
1647
|
-
n.
|
|
1738
|
+
n.O = NOT_PENDING;
|
|
1648
1739
|
return n;
|
|
1649
1740
|
}
|
|
1650
1741
|
function isEqual(e, t) {
|
|
@@ -1661,22 +1752,32 @@ function untrack(e, t) {
|
|
|
1661
1752
|
tracking = n;
|
|
1662
1753
|
}
|
|
1663
1754
|
}
|
|
1755
|
+
function prepareComputed(e, t) {
|
|
1756
|
+
if (e.W & REACTIVE_LAZY) {
|
|
1757
|
+
e.W &= ~REACTIVE_LAZY;
|
|
1758
|
+
recompute(e, true);
|
|
1759
|
+
} else if (e.W & REACTIVE_DISPOSED) {
|
|
1760
|
+
recompute(e, true);
|
|
1761
|
+
} else if (t) {
|
|
1762
|
+
updateIfNecessary(e);
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1664
1765
|
function read(e) {
|
|
1665
1766
|
if (latestReadActive) {
|
|
1666
1767
|
const t = getLatestValueComputed(e);
|
|
1667
1768
|
const n = latestReadActive;
|
|
1668
1769
|
latestReadActive = false;
|
|
1669
|
-
const i = e.
|
|
1770
|
+
const i = e.O !== undefined && e.O !== NOT_PENDING ? e.O : e.Z;
|
|
1670
1771
|
let r;
|
|
1671
1772
|
try {
|
|
1672
1773
|
r = read(t);
|
|
1673
|
-
} catch (
|
|
1674
|
-
if (!context
|
|
1675
|
-
throw
|
|
1774
|
+
} catch (t) {
|
|
1775
|
+
if (t instanceof NotReadyError && (!context || !(e.Y & STATUS_UNINITIALIZED))) return i;
|
|
1776
|
+
throw t;
|
|
1676
1777
|
} finally {
|
|
1677
1778
|
latestReadActive = n;
|
|
1678
1779
|
}
|
|
1679
|
-
if (t.
|
|
1780
|
+
if (t.Y & STATUS_PENDING) return i;
|
|
1680
1781
|
if (stale && currentOptimisticLane && t.i) {
|
|
1681
1782
|
const e = findLane(t.i);
|
|
1682
1783
|
const n = findLane(currentOptimisticLane);
|
|
@@ -1686,204 +1787,164 @@ function read(e) {
|
|
|
1686
1787
|
}
|
|
1687
1788
|
return r;
|
|
1688
1789
|
}
|
|
1689
|
-
if (pendingCheckActive) {
|
|
1690
|
-
const t = e.Ie;
|
|
1691
|
-
const n = pendingCheckActive;
|
|
1692
|
-
pendingCheckActive = false;
|
|
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);
|
|
1710
|
-
pendingCheckActive = n;
|
|
1711
|
-
throw r.ce;
|
|
1712
|
-
}
|
|
1713
|
-
if (t && e.R !== undefined) {
|
|
1714
|
-
if (e.R !== NOT_PENDING && (t.ve || !!(t.fe & STATUS_PENDING))) {
|
|
1715
|
-
foundPending = true;
|
|
1716
|
-
}
|
|
1717
|
-
collectPendingSources(e);
|
|
1718
|
-
collectPendingSources(t);
|
|
1719
|
-
if (i && tracking) link(e, i);
|
|
1720
|
-
} else {
|
|
1721
|
-
collectPendingSources(e);
|
|
1722
|
-
if (t) collectPendingSources(t);
|
|
1723
|
-
}
|
|
1724
|
-
pendingCheckActive = n;
|
|
1725
|
-
}
|
|
1726
1790
|
let t = context;
|
|
1727
|
-
if (t?.
|
|
1791
|
+
if (t?.he) t = t.Ae;
|
|
1728
1792
|
const n = e;
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1793
|
+
const i = e.Ie;
|
|
1794
|
+
const r = i || e;
|
|
1795
|
+
if (pendingCheckActive) {
|
|
1796
|
+
pendingCheckActive = false;
|
|
1797
|
+
if (typeof n.ce === "function") prepareComputed(e, true);
|
|
1798
|
+
if (t && r.Y & STATUS_PENDING && r.Y & STATUS_UNINITIALIZED) {
|
|
1799
|
+
if (tracking && e !== t) link(e, t);
|
|
1800
|
+
pendingCheckActive = true;
|
|
1801
|
+
throw r.ae;
|
|
1736
1802
|
}
|
|
1803
|
+
collectPendingSources(e);
|
|
1804
|
+
if (i) collectPendingSources(i);
|
|
1805
|
+
pendingCheckActive = true;
|
|
1806
|
+
} else if (typeof n.ce === "function") {
|
|
1807
|
+
prepareComputed(e, false);
|
|
1737
1808
|
}
|
|
1738
|
-
const i = e.Ie || e;
|
|
1739
1809
|
if (
|
|
1740
|
-
!n.
|
|
1741
|
-
|
|
1742
|
-
e.
|
|
1743
|
-
e.
|
|
1810
|
+
!n.ce &&
|
|
1811
|
+
r === e &&
|
|
1812
|
+
e.O === undefined &&
|
|
1813
|
+
e.Ee === undefined &&
|
|
1744
1814
|
activeTransition === null &&
|
|
1745
1815
|
currentOptimisticLane === null &&
|
|
1746
1816
|
!snapshotCaptureActive &&
|
|
1747
1817
|
true
|
|
1748
1818
|
) {
|
|
1749
1819
|
if (t && tracking) link(e, t);
|
|
1750
|
-
return !t || e.
|
|
1820
|
+
return !t || e.D === NOT_PENDING ? e.Z : e.D;
|
|
1751
1821
|
}
|
|
1752
1822
|
if (t && tracking) {
|
|
1753
|
-
link(e, t);
|
|
1754
|
-
if (
|
|
1755
|
-
const n = e.
|
|
1756
|
-
if (
|
|
1823
|
+
link(e, t, pendingCheckActive);
|
|
1824
|
+
if (r.ce) {
|
|
1825
|
+
const n = e.W & REACTIVE_ZOMBIE;
|
|
1826
|
+
if (r.H >= (n ? zombieQueue.I : dirtyQueue.I)) {
|
|
1757
1827
|
markNode(t);
|
|
1758
1828
|
markHeap(n ? zombieQueue : dirtyQueue);
|
|
1759
|
-
updateIfNecessary(
|
|
1829
|
+
updateIfNecessary(r);
|
|
1760
1830
|
}
|
|
1761
|
-
const
|
|
1762
|
-
if (
|
|
1763
|
-
t.H =
|
|
1831
|
+
const i = r.H;
|
|
1832
|
+
if (i >= t.H && e.J !== t) {
|
|
1833
|
+
t.H = i + 1;
|
|
1764
1834
|
}
|
|
1765
1835
|
}
|
|
1766
1836
|
}
|
|
1767
|
-
if (
|
|
1768
|
-
if (t && !(stale &&
|
|
1837
|
+
if (r.Y & STATUS_PENDING) {
|
|
1838
|
+
if (t && !(stale && r.T && activeTransition !== r.T)) {
|
|
1769
1839
|
if (currentOptimisticLane) {
|
|
1770
|
-
const n =
|
|
1771
|
-
const
|
|
1772
|
-
if (n && findLane(n) ===
|
|
1840
|
+
const n = r.i;
|
|
1841
|
+
const i = findLane(currentOptimisticLane);
|
|
1842
|
+
if (n && findLane(n) === i && !hasActiveOverride(r)) {
|
|
1773
1843
|
if (!tracking && e !== t) link(e, t);
|
|
1774
|
-
throw
|
|
1844
|
+
throw r.ae;
|
|
1775
1845
|
}
|
|
1776
1846
|
} else {
|
|
1777
1847
|
if (!tracking && e !== t) link(e, t);
|
|
1778
|
-
throw
|
|
1848
|
+
throw r.ae;
|
|
1779
1849
|
}
|
|
1780
|
-
} else if (t &&
|
|
1850
|
+
} else if (t && r !== e && r.Y & STATUS_UNINITIALIZED) {
|
|
1781
1851
|
if (!tracking && e !== t) link(e, t);
|
|
1782
|
-
throw
|
|
1783
|
-
} else if (!t &&
|
|
1784
|
-
throw
|
|
1852
|
+
throw r.ae;
|
|
1853
|
+
} else if (!t && r.Y & STATUS_UNINITIALIZED) {
|
|
1854
|
+
throw r.ae;
|
|
1785
1855
|
}
|
|
1786
1856
|
}
|
|
1787
|
-
if (e.
|
|
1788
|
-
if (e.
|
|
1857
|
+
if (e.ce && e.Y & STATUS_ERROR) {
|
|
1858
|
+
if (tracking && !pendingCheckActive && e.fe < clock) {
|
|
1789
1859
|
recompute(e);
|
|
1790
1860
|
return read(e);
|
|
1791
|
-
} else throw e.
|
|
1861
|
+
} else throw e.ae;
|
|
1792
1862
|
}
|
|
1793
|
-
if (snapshotCaptureActive && t && t.
|
|
1794
|
-
const n = e.
|
|
1863
|
+
if (snapshotCaptureActive && t && t.le & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
1864
|
+
const n = e.Ee;
|
|
1795
1865
|
if (n !== undefined) {
|
|
1796
1866
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1797
|
-
const r = e.
|
|
1798
|
-
if (r !== i) t.
|
|
1867
|
+
const r = e.D !== NOT_PENDING ? e.D : e.Z;
|
|
1868
|
+
if (r !== i) t.W |= REACTIVE_SNAPSHOT_STALE;
|
|
1799
1869
|
return i;
|
|
1800
1870
|
}
|
|
1801
1871
|
}
|
|
1802
|
-
if (e.
|
|
1872
|
+
if (e.O !== undefined && e.O !== NOT_PENDING) {
|
|
1803
1873
|
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.Z;
|
|
1804
|
-
return e.
|
|
1874
|
+
return e.O;
|
|
1805
1875
|
}
|
|
1806
1876
|
if (
|
|
1807
1877
|
activeTransition !== null &&
|
|
1808
1878
|
currentOptimisticLane !== null &&
|
|
1809
1879
|
!latestReadActive &&
|
|
1810
|
-
e.
|
|
1811
|
-
(
|
|
1812
|
-
!e.
|
|
1880
|
+
e.D !== NOT_PENDING &&
|
|
1881
|
+
(r === e || !!(r.W & REACTIVE_MANUAL_WRITE)) &&
|
|
1882
|
+
!e.ce &&
|
|
1813
1883
|
t
|
|
1814
1884
|
) {
|
|
1815
|
-
activeTransition.
|
|
1885
|
+
activeTransition.K.add(t);
|
|
1816
1886
|
return e.Z;
|
|
1817
1887
|
}
|
|
1818
|
-
const
|
|
1888
|
+
const o =
|
|
1819
1889
|
!t ||
|
|
1820
1890
|
(currentOptimisticLane !== null &&
|
|
1821
|
-
(e.
|
|
1822
|
-
e.
|
|
1823
|
-
(stale && e.
|
|
1891
|
+
(e.O !== undefined || e.i || (r === e && stale && t.t !== e) || !!(r.Y & STATUS_PENDING))) ||
|
|
1892
|
+
e.D === NOT_PENDING ||
|
|
1893
|
+
(stale && e.T && activeTransition !== e.T)
|
|
1824
1894
|
? e.Z
|
|
1825
|
-
: e.
|
|
1895
|
+
: e.D;
|
|
1896
|
+
if (pendingCheckActive && pendingProbe !== null && e.D !== NOT_PENDING && o === e.D)
|
|
1897
|
+
pendingProbe.freshReads.add(e);
|
|
1826
1898
|
if (
|
|
1827
1899
|
!t &&
|
|
1828
|
-
|
|
1829
|
-
typeof n.
|
|
1830
|
-
e.
|
|
1831
|
-
!(
|
|
1832
|
-
!e.
|
|
1900
|
+
r === e &&
|
|
1901
|
+
typeof n.ce === "function" &&
|
|
1902
|
+
e.le & CONFIG_AUTO_DISPOSE &&
|
|
1903
|
+
!(r.Y & STATUS_PENDING) &&
|
|
1904
|
+
!e.P
|
|
1833
1905
|
) {
|
|
1834
1906
|
unobserved(e);
|
|
1835
1907
|
}
|
|
1836
|
-
return
|
|
1908
|
+
return o;
|
|
1837
1909
|
}
|
|
1838
1910
|
function setSignal(e, t) {
|
|
1839
|
-
if (e.
|
|
1840
|
-
const n = e.
|
|
1841
|
-
const i = e.
|
|
1842
|
-
const r = n ? (i ? e.
|
|
1911
|
+
if (e.T && activeTransition !== e.T) globalQueue.initTransition(e.T);
|
|
1912
|
+
const n = e.O !== undefined && !projectionWriteActive;
|
|
1913
|
+
const i = e.O !== undefined && e.O !== NOT_PENDING;
|
|
1914
|
+
const r = n ? (i ? e.O : e.Z) : e.D === NOT_PENDING ? e.Z : e.D;
|
|
1843
1915
|
if (typeof t === "function") t = t(r);
|
|
1844
|
-
const o = !e.
|
|
1916
|
+
const o = !!(e.Y & STATUS_UNINITIALIZED) || !e.xe || !e.xe(r, t);
|
|
1845
1917
|
if (!o) {
|
|
1846
1918
|
if (n && i) {
|
|
1847
1919
|
const t = resolveTransition(e);
|
|
1848
1920
|
if (t && activeTransition !== t) globalQueue.initTransition(t);
|
|
1849
|
-
if (e.se) {
|
|
1850
|
-
insertSubs(e, true);
|
|
1851
|
-
schedule();
|
|
1852
|
-
}
|
|
1853
1921
|
}
|
|
1854
1922
|
return t;
|
|
1855
1923
|
}
|
|
1856
1924
|
if (n) {
|
|
1857
|
-
const n = e.
|
|
1925
|
+
const n = e.O === NOT_PENDING;
|
|
1858
1926
|
if (!n) globalQueue.initTransition(resolveTransition(e));
|
|
1859
|
-
if (n)
|
|
1860
|
-
e.m = e.Z;
|
|
1861
|
-
globalQueue.P.push(e);
|
|
1862
|
-
}
|
|
1863
|
-
e.O = true;
|
|
1927
|
+
if (n) globalQueue.N.push(e);
|
|
1864
1928
|
const i = getOrCreateLane(e);
|
|
1865
1929
|
e.i = i;
|
|
1866
|
-
e.
|
|
1930
|
+
e.O = t;
|
|
1867
1931
|
} else {
|
|
1868
|
-
if (e.
|
|
1869
|
-
e.
|
|
1870
|
-
}
|
|
1871
|
-
if (e.We) updatePendingSignal(e);
|
|
1872
|
-
if (e.Fe) {
|
|
1873
|
-
setSignal(e.Fe, t);
|
|
1932
|
+
if (e.D === NOT_PENDING) queuePendingNode(e);
|
|
1933
|
+
e.D = t;
|
|
1874
1934
|
}
|
|
1875
|
-
e
|
|
1935
|
+
syncCompanions(e, t);
|
|
1936
|
+
e.fe = clock;
|
|
1876
1937
|
insertSubs(e, n);
|
|
1877
1938
|
schedule();
|
|
1878
1939
|
return t;
|
|
1879
1940
|
}
|
|
1880
1941
|
function suppressComputedRecompute(e) {
|
|
1881
|
-
deleteFromHeap(e, e.
|
|
1882
|
-
if (!(e.
|
|
1942
|
+
deleteFromHeap(e, e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1943
|
+
if (!(e.W & REACTIVE_MANUAL_WRITE) && e.D === NOT_PENDING) {
|
|
1883
1944
|
queuePendingNode(e);
|
|
1884
1945
|
schedule();
|
|
1885
1946
|
}
|
|
1886
|
-
e.
|
|
1947
|
+
e.W = (e.W & -4) | REACTIVE_MANUAL_WRITE;
|
|
1887
1948
|
}
|
|
1888
1949
|
function setMemo(e, t) {
|
|
1889
1950
|
const n = setSignal(e, t);
|
|
@@ -1903,78 +1964,96 @@ function runWithOwner(e, t) {
|
|
|
1903
1964
|
}
|
|
1904
1965
|
}
|
|
1905
1966
|
function getPendingSignal(e) {
|
|
1906
|
-
if (!e.
|
|
1907
|
-
e.
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
}
|
|
1911
|
-
if (computePendingState(e)) setSignal(e.We, true);
|
|
1967
|
+
if (!e.B) {
|
|
1968
|
+
e.B = optimisticSignal(false, { ownedWrite: true });
|
|
1969
|
+
e.B.t = e;
|
|
1970
|
+
if (computePendingState(e)) setSignal(e.B, true);
|
|
1912
1971
|
}
|
|
1913
|
-
return e.
|
|
1972
|
+
return e.B;
|
|
1914
1973
|
}
|
|
1915
1974
|
function collectPendingSources(e) {
|
|
1916
|
-
|
|
1975
|
+
if (!pendingProbe) return;
|
|
1976
|
+
pendingProbe.sources.add(e);
|
|
1917
1977
|
const t = e.Ie || e;
|
|
1918
|
-
if (t !== e)
|
|
1978
|
+
if (t !== e) pendingProbe.sources.add(t);
|
|
1919
1979
|
}
|
|
1920
1980
|
function computePendingState(e) {
|
|
1921
1981
|
const t = e;
|
|
1982
|
+
if (t.W & REACTIVE_DISPOSED) return false;
|
|
1922
1983
|
const n = e.Ie;
|
|
1984
|
+
if ((n || t).qe) return false;
|
|
1923
1985
|
if (e.t) {
|
|
1924
|
-
const
|
|
1925
|
-
if (
|
|
1926
|
-
|
|
1986
|
+
const t = e.t;
|
|
1987
|
+
if (hasActiveOverride(t)) return false;
|
|
1988
|
+
const n = t.Ie || t;
|
|
1989
|
+
if (n.qe) return false;
|
|
1990
|
+
return !!(n.Y & STATUS_PENDING && !(n.Y & STATUS_UNINITIALIZED));
|
|
1927
1991
|
}
|
|
1928
|
-
if (
|
|
1929
|
-
|
|
1992
|
+
if (hasActiveOverride(e)) return false;
|
|
1993
|
+
if (n && e.D !== NOT_PENDING) {
|
|
1994
|
+
return !!(n.W & REACTIVE_MANUAL_WRITE) || (!n.be && !(n.Y & STATUS_PENDING));
|
|
1930
1995
|
}
|
|
1931
|
-
if (e.
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1996
|
+
if (e.D !== NOT_PENDING && !(t.Y & STATUS_UNINITIALIZED)) return true;
|
|
1997
|
+
return !!(t.Y & STATUS_PENDING && !(t.Y & STATUS_UNINITIALIZED));
|
|
1998
|
+
}
|
|
1999
|
+
function syncCompanions(e, t) {
|
|
2000
|
+
if (e.B) updatePendingSignal(e);
|
|
2001
|
+
if (e.q) setSignal(e.q, t);
|
|
2002
|
+
}
|
|
2003
|
+
function updatePendingSignal(e) {
|
|
2004
|
+
if (e.B) {
|
|
2005
|
+
setSignal(e.B, computePendingState(e));
|
|
1938
2006
|
}
|
|
1939
|
-
if (e.
|
|
1940
|
-
|
|
2007
|
+
if (e.q) updatePendingSignal(e.q);
|
|
2008
|
+
}
|
|
2009
|
+
function updateChildCompanions(e) {
|
|
2010
|
+
for (let t = e.ye; t !== null; t = t.Pe) {
|
|
2011
|
+
if (t.B || t.q) updatePendingSignal(t);
|
|
1941
2012
|
}
|
|
1942
|
-
if (e.m !== NOT_PENDING && !(t.fe & STATUS_UNINITIALIZED)) return true;
|
|
1943
|
-
return !!(t.fe & STATUS_PENDING && !(t.fe & STATUS_UNINITIALIZED));
|
|
1944
2013
|
}
|
|
1945
|
-
function
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
const n = e
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
mergeLanes(t, e);
|
|
1956
|
-
}
|
|
1957
|
-
}
|
|
1958
|
-
signalLanes.delete(n);
|
|
1959
|
-
n.i = undefined;
|
|
2014
|
+
function snapCompanionsToState(e) {
|
|
2015
|
+
const t = e.B;
|
|
2016
|
+
if (t && (t.O === undefined || t.O === NOT_PENDING)) {
|
|
2017
|
+
const n = computePendingState(e);
|
|
2018
|
+
if (t.Z !== n || t.D !== NOT_PENDING) {
|
|
2019
|
+
t.Z = n;
|
|
2020
|
+
t.D = NOT_PENDING;
|
|
2021
|
+
t.fe = clock;
|
|
2022
|
+
insertSubs(t);
|
|
2023
|
+
schedule();
|
|
1960
2024
|
}
|
|
1961
2025
|
}
|
|
2026
|
+
const n = e.q;
|
|
2027
|
+
if (n && !(n.W & REACTIVE_DISPOSED)) {
|
|
2028
|
+
if (
|
|
2029
|
+
(n.O === undefined || n.O === NOT_PENDING) &&
|
|
2030
|
+
n.D === NOT_PENDING &&
|
|
2031
|
+
!Object.is(n.Z, e.Z) &&
|
|
2032
|
+
!(n.W & (REACTIVE_DIRTY | REACTIVE_CHECK))
|
|
2033
|
+
) {
|
|
2034
|
+
n.W |= REACTIVE_DIRTY;
|
|
2035
|
+
insertIntoHeap(n, n.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
2036
|
+
insertSubs(n);
|
|
2037
|
+
schedule();
|
|
2038
|
+
}
|
|
2039
|
+
snapCompanionsToState(n);
|
|
2040
|
+
}
|
|
1962
2041
|
}
|
|
1963
2042
|
function getLatestValueComputed(e) {
|
|
1964
|
-
if (!e.
|
|
2043
|
+
if (!e.q) {
|
|
1965
2044
|
const t = latestReadActive;
|
|
1966
2045
|
latestReadActive = false;
|
|
1967
2046
|
const n = pendingCheckActive;
|
|
1968
2047
|
pendingCheckActive = false;
|
|
1969
2048
|
const i = context;
|
|
1970
2049
|
context = null;
|
|
1971
|
-
e.
|
|
1972
|
-
e.
|
|
2050
|
+
e.q = optimisticComputed(() => read(e));
|
|
2051
|
+
e.q.t = e;
|
|
1973
2052
|
context = i;
|
|
1974
2053
|
pendingCheckActive = n;
|
|
1975
2054
|
latestReadActive = t;
|
|
1976
2055
|
}
|
|
1977
|
-
return e.
|
|
2056
|
+
return e.q;
|
|
1978
2057
|
}
|
|
1979
2058
|
function staleValues(e, t = true) {
|
|
1980
2059
|
const n = stale;
|
|
@@ -1996,16 +2075,14 @@ function latest(e) {
|
|
|
1996
2075
|
}
|
|
1997
2076
|
function isPending(e) {
|
|
1998
2077
|
const t = pendingCheckActive;
|
|
1999
|
-
const n =
|
|
2000
|
-
const i = pendingCheckSources;
|
|
2078
|
+
const n = pendingProbe;
|
|
2001
2079
|
pendingCheckActive = true;
|
|
2002
|
-
|
|
2003
|
-
pendingCheckSources = new Set();
|
|
2080
|
+
const i = (pendingProbe = { found: false, sources: new Set(), freshReads: new Set() });
|
|
2004
2081
|
const collectPending = () => {
|
|
2005
2082
|
pendingCheckActive = false;
|
|
2006
2083
|
try {
|
|
2007
|
-
|
|
2008
|
-
if (read(getPendingSignal(e)))
|
|
2084
|
+
i.sources.forEach(e => {
|
|
2085
|
+
if (read(getPendingSignal(e)) && !i.freshReads.has(e)) i.found = true;
|
|
2009
2086
|
});
|
|
2010
2087
|
} finally {
|
|
2011
2088
|
pendingCheckActive = true;
|
|
@@ -2014,18 +2091,17 @@ function isPending(e) {
|
|
|
2014
2091
|
try {
|
|
2015
2092
|
e();
|
|
2016
2093
|
collectPending();
|
|
2017
|
-
return
|
|
2094
|
+
return i.found;
|
|
2018
2095
|
} catch (e) {
|
|
2019
2096
|
collectPending();
|
|
2020
2097
|
if (e instanceof NotReadyError) {
|
|
2021
|
-
if (
|
|
2098
|
+
if (i.found && !(e.source?.Y & STATUS_UNINITIALIZED)) return true;
|
|
2022
2099
|
if (context) throw e;
|
|
2023
2100
|
}
|
|
2024
|
-
return
|
|
2101
|
+
return i.found;
|
|
2025
2102
|
} finally {
|
|
2026
2103
|
pendingCheckActive = t;
|
|
2027
|
-
|
|
2028
|
-
pendingCheckSources = i;
|
|
2104
|
+
pendingProbe = n;
|
|
2029
2105
|
}
|
|
2030
2106
|
}
|
|
2031
2107
|
function refresh(e) {
|
|
@@ -2033,9 +2109,9 @@ function refresh(e) {
|
|
|
2033
2109
|
if (!t) {
|
|
2034
2110
|
return;
|
|
2035
2111
|
}
|
|
2036
|
-
if (typeof t.
|
|
2037
|
-
t.
|
|
2038
|
-
insertIntoHeap(t, t.
|
|
2112
|
+
if (typeof t.ce === "function" && !(t.W & (REACTIVE_DISPOSED | REACTIVE_MANUAL_WRITE))) {
|
|
2113
|
+
t.W = (t.W & ~REACTIVE_CHECK) | REACTIVE_DIRTY;
|
|
2114
|
+
insertIntoHeap(t, t.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
2039
2115
|
schedule();
|
|
2040
2116
|
}
|
|
2041
2117
|
}
|
|
@@ -2046,7 +2122,7 @@ function getContext(e, t = getOwner()) {
|
|
|
2046
2122
|
if (!t) {
|
|
2047
2123
|
throw new NoOwnerError();
|
|
2048
2124
|
}
|
|
2049
|
-
const n = hasContext(e, t) ? t.
|
|
2125
|
+
const n = hasContext(e, t) ? t.Ve[e.id] : e.defaultValue;
|
|
2050
2126
|
if (isUndefined(n)) {
|
|
2051
2127
|
throw new ContextNotFoundError();
|
|
2052
2128
|
}
|
|
@@ -2056,10 +2132,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
2056
2132
|
if (!n) {
|
|
2057
2133
|
throw new NoOwnerError();
|
|
2058
2134
|
}
|
|
2059
|
-
n.
|
|
2135
|
+
n.Ve = { ...n.Ve, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
2060
2136
|
}
|
|
2061
2137
|
function hasContext(e, t) {
|
|
2062
|
-
return !isUndefined(t?.
|
|
2138
|
+
return !isUndefined(t?.Ve[e.id]);
|
|
2063
2139
|
}
|
|
2064
2140
|
function isUndefined(e) {
|
|
2065
2141
|
return typeof e === "undefined";
|
|
@@ -2069,86 +2145,106 @@ function effect(e, t, n, i) {
|
|
|
2069
2145
|
const o = createEffectNode(e, t, n, r ? EFFECT_USER : EFFECT_RENDER, notifyEffectStatus, i);
|
|
2070
2146
|
recompute(o, true);
|
|
2071
2147
|
!i?.defer &&
|
|
2072
|
-
(o.
|
|
2148
|
+
(o.V === EFFECT_USER || i?.schedule ? o.F.enqueue(o.V, runEffect.bind(null, o)) : runEffect(o));
|
|
2073
2149
|
}
|
|
2074
2150
|
function notifyEffectStatus(e, t) {
|
|
2075
|
-
const n = e !== undefined ? e : this.
|
|
2076
|
-
const i = t !== undefined ? t : this.
|
|
2151
|
+
const n = e !== undefined ? e : this.Y;
|
|
2152
|
+
const i = t !== undefined ? t : this.ae;
|
|
2077
2153
|
if (n & STATUS_ERROR) {
|
|
2078
|
-
let e = i;
|
|
2079
2154
|
this.F.notify(this, STATUS_PENDING, 0);
|
|
2080
|
-
if (this.
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
this.$e?.();
|
|
2085
|
-
this.$e = undefined;
|
|
2086
|
-
})
|
|
2087
|
-
: console.error(e);
|
|
2088
|
-
} catch (t) {
|
|
2089
|
-
e = t;
|
|
2155
|
+
if (this.V === EFFECT_USER) {
|
|
2156
|
+
if (this.Y & STATUS_ERROR) {
|
|
2157
|
+
this.G = true;
|
|
2158
|
+
this.F.enqueue(this.V, (this.$e ??= runEffect.bind(null, this)));
|
|
2090
2159
|
}
|
|
2160
|
+
return;
|
|
2161
|
+
}
|
|
2162
|
+
if (!this.F.notify(this, STATUS_ERROR, STATUS_ERROR)) {
|
|
2163
|
+
haltReactivity();
|
|
2164
|
+
throw i;
|
|
2091
2165
|
}
|
|
2092
|
-
|
|
2093
|
-
} else if (this.G === EFFECT_RENDER) {
|
|
2166
|
+
} else if (this.V === EFFECT_RENDER) {
|
|
2094
2167
|
this.F.notify(this, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
2095
2168
|
}
|
|
2096
2169
|
}
|
|
2097
2170
|
function runEffect(e) {
|
|
2098
|
-
if (!e.
|
|
2099
|
-
e
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2171
|
+
if (!e.G || e.W & REACTIVE_DISPOSED) return;
|
|
2172
|
+
if (e.Y & STATUS_ERROR && e.V === EFFECT_USER) {
|
|
2173
|
+
const t = e.ae instanceof StatusError ? (e.ae.cause ?? e.ae) : e.ae;
|
|
2174
|
+
e.Ye = e.Z;
|
|
2175
|
+
e.G = false;
|
|
2176
|
+
try {
|
|
2177
|
+
e.Be
|
|
2178
|
+
? e.Be(t, () => {
|
|
2179
|
+
const t = e.Le;
|
|
2180
|
+
e.Le = undefined;
|
|
2181
|
+
t?.();
|
|
2182
|
+
})
|
|
2183
|
+
: console.error(t);
|
|
2184
|
+
} catch (t) {
|
|
2185
|
+
if (!e.F.notify(e, STATUS_ERROR, STATUS_ERROR)) {
|
|
2186
|
+
haltReactivity();
|
|
2187
|
+
throw t;
|
|
2188
|
+
}
|
|
2108
2189
|
}
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2192
|
+
const t = e.Le;
|
|
2193
|
+
e.Le = undefined;
|
|
2194
|
+
try {
|
|
2195
|
+
t?.();
|
|
2196
|
+
const n = e.Ze(e.Z, e.Ye);
|
|
2197
|
+
if (false && n !== undefined && typeof n !== "function");
|
|
2198
|
+
e.Le = n;
|
|
2109
2199
|
} catch (t) {
|
|
2110
|
-
e.
|
|
2111
|
-
e.
|
|
2112
|
-
if (!e.F.notify(e, STATUS_ERROR, STATUS_ERROR))
|
|
2200
|
+
e.ae = new StatusError(e, t);
|
|
2201
|
+
e.Y |= STATUS_ERROR;
|
|
2202
|
+
if (!e.F.notify(e, STATUS_ERROR, STATUS_ERROR)) {
|
|
2203
|
+
haltReactivity();
|
|
2204
|
+
throw t;
|
|
2205
|
+
}
|
|
2113
2206
|
} finally {
|
|
2114
|
-
e.
|
|
2115
|
-
e.
|
|
2207
|
+
e.Ye = e.Z;
|
|
2208
|
+
e.G = false;
|
|
2116
2209
|
}
|
|
2117
2210
|
}
|
|
2118
|
-
GlobalQueue.
|
|
2211
|
+
GlobalQueue.oe = runEffect;
|
|
2119
2212
|
function trackedEffect(e, t) {
|
|
2120
2213
|
const run = () => {
|
|
2121
|
-
if (!n.
|
|
2214
|
+
if (!n.G || n.W & REACTIVE_DISPOSED) return;
|
|
2122
2215
|
try {
|
|
2123
|
-
n.
|
|
2216
|
+
n.G = false;
|
|
2124
2217
|
recompute(n);
|
|
2125
2218
|
} finally {
|
|
2126
2219
|
}
|
|
2127
2220
|
};
|
|
2128
2221
|
const n = computed(
|
|
2129
2222
|
() => {
|
|
2130
|
-
n
|
|
2131
|
-
n
|
|
2132
|
-
|
|
2133
|
-
|
|
2223
|
+
const t = n.Le;
|
|
2224
|
+
n.Le = undefined;
|
|
2225
|
+
t?.();
|
|
2226
|
+
const i = staleValues(e);
|
|
2227
|
+
n.Le = i;
|
|
2134
2228
|
},
|
|
2135
2229
|
{ ...t, lazy: true }
|
|
2136
2230
|
);
|
|
2137
|
-
n
|
|
2138
|
-
n.
|
|
2139
|
-
n.
|
|
2140
|
-
n.
|
|
2141
|
-
n.
|
|
2142
|
-
const i = e !== undefined ? e : n.
|
|
2231
|
+
n.Le = undefined;
|
|
2232
|
+
n.le = (n.le & ~CONFIG_AUTO_DISPOSE) | CONFIG_CHILDREN_FORBIDDEN;
|
|
2233
|
+
n.G = true;
|
|
2234
|
+
n.V = EFFECT_TRACKED;
|
|
2235
|
+
n.Qe = (e, t) => {
|
|
2236
|
+
const i = e !== undefined ? e : n.Y;
|
|
2143
2237
|
if (i & STATUS_ERROR) {
|
|
2144
2238
|
n.F.notify(n, STATUS_PENDING, 0);
|
|
2145
|
-
const e = t !== undefined ? t : n.
|
|
2146
|
-
if (!n.F.notify(n, STATUS_ERROR, STATUS_ERROR))
|
|
2239
|
+
const e = t !== undefined ? t : n.ae;
|
|
2240
|
+
if (!n.F.notify(n, STATUS_ERROR, STATUS_ERROR)) {
|
|
2241
|
+
haltReactivity();
|
|
2242
|
+
throw e;
|
|
2243
|
+
}
|
|
2147
2244
|
}
|
|
2148
2245
|
};
|
|
2149
|
-
n.
|
|
2246
|
+
n.k = run;
|
|
2150
2247
|
n.F.enqueue(EFFECT_USER, run);
|
|
2151
|
-
cleanup(() => n.$e?.());
|
|
2152
2248
|
}
|
|
2153
2249
|
function restoreTransition(e, t) {
|
|
2154
2250
|
globalQueue.initTransition(e);
|
|
@@ -2162,11 +2258,11 @@ function action(e) {
|
|
|
2162
2258
|
const r = e(...t);
|
|
2163
2259
|
globalQueue.initTransition();
|
|
2164
2260
|
let o = activeTransition;
|
|
2165
|
-
o
|
|
2261
|
+
o.j.push(r);
|
|
2166
2262
|
const done = (e, t) => {
|
|
2167
2263
|
o = currentTransition(o);
|
|
2168
|
-
const s = o
|
|
2169
|
-
if (s >= 0) o
|
|
2264
|
+
const s = o.j.indexOf(r);
|
|
2265
|
+
if (s >= 0) o.j.splice(s, 1);
|
|
2170
2266
|
setActiveTransition(o);
|
|
2171
2267
|
schedule();
|
|
2172
2268
|
t ? i(t) : n(e);
|
|
@@ -2178,13 +2274,12 @@ function action(e) {
|
|
|
2178
2274
|
} catch (e) {
|
|
2179
2275
|
return done(undefined, e);
|
|
2180
2276
|
}
|
|
2181
|
-
if (n
|
|
2182
|
-
return void n.then(run, e => restoreTransition(o, () => step(e, true)));
|
|
2277
|
+
if (isThenable(n)) return void n.then(run, e => done(undefined, e));
|
|
2183
2278
|
run(n);
|
|
2184
2279
|
};
|
|
2185
2280
|
const run = e => {
|
|
2186
2281
|
if (e.done) return done(e.value);
|
|
2187
|
-
if (e.value
|
|
2282
|
+
if (isThenable(e.value))
|
|
2188
2283
|
return void e.value.then(
|
|
2189
2284
|
e => restoreTransition(o, () => step(e)),
|
|
2190
2285
|
e => restoreTransition(o, () => step(e, true))
|
|
@@ -2205,7 +2300,7 @@ function accessor(e) {
|
|
|
2205
2300
|
function createSignal(e, t) {
|
|
2206
2301
|
if (typeof e === "function") {
|
|
2207
2302
|
const n = computed(e, t);
|
|
2208
|
-
n.
|
|
2303
|
+
n.le &= ~CONFIG_AUTO_DISPOSE;
|
|
2209
2304
|
return [accessor(n), setMemo.bind(null, n)];
|
|
2210
2305
|
}
|
|
2211
2306
|
const n = signal(e, t);
|
|
@@ -2247,22 +2342,25 @@ function createReaction(e, t) {
|
|
|
2247
2342
|
function resolve(e) {
|
|
2248
2343
|
return new Promise((t, n) => {
|
|
2249
2344
|
createRoot(i => {
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2345
|
+
effect(
|
|
2346
|
+
e,
|
|
2347
|
+
e => {
|
|
2348
|
+
t(e);
|
|
2349
|
+
i();
|
|
2350
|
+
},
|
|
2351
|
+
e => {
|
|
2255
2352
|
n(e);
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2353
|
+
i();
|
|
2354
|
+
},
|
|
2355
|
+
{ user: true }
|
|
2356
|
+
);
|
|
2259
2357
|
});
|
|
2260
2358
|
});
|
|
2261
2359
|
}
|
|
2262
2360
|
function createOptimistic(e, t) {
|
|
2263
2361
|
if (typeof e === "function") {
|
|
2264
2362
|
const n = optimisticComputed(e, t);
|
|
2265
|
-
n.
|
|
2363
|
+
n.le &= ~CONFIG_AUTO_DISPOSE;
|
|
2266
2364
|
return [accessor(n), setSignal.bind(null, n)];
|
|
2267
2365
|
}
|
|
2268
2366
|
const n = optimisticSignal(e, t);
|
|
@@ -2270,26 +2368,103 @@ function createOptimistic(e, t) {
|
|
|
2270
2368
|
}
|
|
2271
2369
|
function onSettled(e) {
|
|
2272
2370
|
const t = getOwner();
|
|
2273
|
-
t && !(t.
|
|
2371
|
+
t && !(t.le & CONFIG_CHILDREN_FORBIDDEN)
|
|
2274
2372
|
? createTrackedEffect(() => untrack(e), undefined)
|
|
2275
2373
|
: globalQueue.enqueue(EFFECT_USER, () => {
|
|
2276
|
-
|
|
2277
|
-
t?.();
|
|
2374
|
+
e();
|
|
2278
2375
|
});
|
|
2279
2376
|
}
|
|
2377
|
+
function nodeKeys(e) {
|
|
2378
|
+
const t = Object.keys(e);
|
|
2379
|
+
if (symbolKeyedRecords.has(e)) {
|
|
2380
|
+
const n = Object.getOwnPropertySymbols(e);
|
|
2381
|
+
for (let e = 0, i = n.length; e < i; e++) {
|
|
2382
|
+
if (n[e] !== $TRACK) t.push(n[e]);
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
return t;
|
|
2386
|
+
}
|
|
2280
2387
|
function unwrap(e) {
|
|
2281
|
-
|
|
2388
|
+
if (e === null || typeof e !== "object") return e;
|
|
2389
|
+
return e[$TARGET]?.[STORE_VALUE] ?? e;
|
|
2282
2390
|
}
|
|
2283
2391
|
function getOverrideValue(e, t, n, i) {
|
|
2284
2392
|
if (i && n in i) return i[n];
|
|
2285
2393
|
return t && n in t ? t[n] : e[n];
|
|
2286
2394
|
}
|
|
2395
|
+
function addEnumSymbols(e, t, n) {
|
|
2396
|
+
for (let i = 0, r = t.length; i < r; i++) {
|
|
2397
|
+
if (Object.prototype.propertyIsEnumerable.call(e, t[i])) n.add(t[i]);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2287
2400
|
function getAllKeys(e, t, n) {
|
|
2288
2401
|
const i = getKeys(e, t);
|
|
2289
2402
|
const r = Object.keys(n);
|
|
2290
|
-
|
|
2403
|
+
const o = e[$TARGET]
|
|
2404
|
+
? untrack(() => Object.getOwnPropertySymbols(e))
|
|
2405
|
+
: Object.getOwnPropertySymbols(e);
|
|
2406
|
+
const s = Object.getOwnPropertySymbols(n);
|
|
2407
|
+
if (o.length === 0 && s.length === 0) {
|
|
2408
|
+
if (i.length === r.length) {
|
|
2409
|
+
let e = true;
|
|
2410
|
+
for (let t = 0; t < i.length; t++) {
|
|
2411
|
+
if (i[t] !== r[t]) {
|
|
2412
|
+
e = false;
|
|
2413
|
+
break;
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
if (e) return i;
|
|
2417
|
+
}
|
|
2418
|
+
const e = new Set(i);
|
|
2419
|
+
for (let t = 0; t < r.length; t++) e.add(r[t]);
|
|
2420
|
+
return Array.from(e);
|
|
2421
|
+
}
|
|
2422
|
+
const u = new Set(i);
|
|
2423
|
+
addEnumSymbols(e, o, u);
|
|
2424
|
+
if (t) {
|
|
2425
|
+
for (const e of Reflect.ownKeys(t)) {
|
|
2426
|
+
t[e] === $DELETED ? u.delete(e) : u.add(e);
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
for (let e = 0; e < r.length; e++) u.add(r[e]);
|
|
2430
|
+
addEnumSymbols(n, s, u);
|
|
2431
|
+
return Array.from(u);
|
|
2432
|
+
}
|
|
2433
|
+
function wrapValue(e, t) {
|
|
2434
|
+
return isWrappable(e) ? wrap(e, t) : e;
|
|
2435
|
+
}
|
|
2436
|
+
function itemKey(e, t) {
|
|
2437
|
+
return isWrappable(e) ? t(e) : e;
|
|
2438
|
+
}
|
|
2439
|
+
function keyedMatch(e, t, n) {
|
|
2440
|
+
return e === t || (isWrappable(e) && isWrappable(t) && n(e) === n(t));
|
|
2441
|
+
}
|
|
2442
|
+
function syncArrayNodeMembership(e, t) {
|
|
2443
|
+
let n = e[STORE_NODE];
|
|
2444
|
+
if (n) {
|
|
2445
|
+
const e = nodeKeys(n);
|
|
2446
|
+
for (let i = 0, r = e.length; i < r; i++) {
|
|
2447
|
+
const r = e[i];
|
|
2448
|
+
r in t || setSignal(n[r], undefined);
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
if ((n = e[STORE_HAS])) {
|
|
2452
|
+
const e = nodeKeys(n);
|
|
2453
|
+
for (let i = 0, r = e.length; i < r; i++) {
|
|
2454
|
+
const r = e[i];
|
|
2455
|
+
setSignal(n[r], r in t);
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
function applyArrayItem(e, t, n, i, r) {
|
|
2460
|
+
if (isWrappable(e) && isWrappable(t)) {
|
|
2461
|
+
const o = wrap(t, n);
|
|
2462
|
+
i && setSignal(i, o);
|
|
2463
|
+
applyState(e, o, r);
|
|
2464
|
+
} else i && setSignal(i, wrapValue(e, n));
|
|
2291
2465
|
}
|
|
2292
2466
|
function applyState(e, t, n) {
|
|
2467
|
+
e = unwrap(e);
|
|
2293
2468
|
const i = t?.[$TARGET];
|
|
2294
2469
|
if (!i) return;
|
|
2295
2470
|
if (i[STORE_OVERRIDE] || i[STORE_OPTIMISTIC_OVERRIDE]) {
|
|
@@ -2307,75 +2482,69 @@ function applyStateFast(e, t, n) {
|
|
|
2307
2482
|
if (Array.isArray(i)) {
|
|
2308
2483
|
let o = false;
|
|
2309
2484
|
const s = i.length;
|
|
2310
|
-
if (e.length && s && e[0] && n(e[0]) != null) {
|
|
2311
|
-
let u, c, l, a, f, E,
|
|
2312
|
-
for (
|
|
2313
|
-
l
|
|
2314
|
-
l < a && ((E = i[l]) === e[l] || (E && e[l] && n(E) === n(e[l])));
|
|
2315
|
-
l++
|
|
2316
|
-
) {
|
|
2317
|
-
applyState(e[l], wrap(E, t), n);
|
|
2485
|
+
if (e.length && s && isWrappable(e[0]) && n(e[0]) != null) {
|
|
2486
|
+
let u, c, l, a, f, E, d, S;
|
|
2487
|
+
for (l = 0, a = Math.min(s, e.length); l < a && keyedMatch((E = i[l]), e[l], n); l++) {
|
|
2488
|
+
isWrappable(E) && isWrappable(e[l]) && applyState(e[l], wrap(E, t), n);
|
|
2318
2489
|
}
|
|
2319
|
-
const
|
|
2490
|
+
const T = new Array(e.length),
|
|
2320
2491
|
_ = new Map();
|
|
2321
2492
|
for (
|
|
2322
2493
|
a = s - 1, f = e.length - 1;
|
|
2323
|
-
a >= l && f >= l && ((E = i[a])
|
|
2494
|
+
a >= l && f >= l && keyedMatch((E = i[a]), e[f], n);
|
|
2324
2495
|
a--, f--
|
|
2325
2496
|
) {
|
|
2326
|
-
|
|
2497
|
+
T[f] = E;
|
|
2327
2498
|
}
|
|
2328
2499
|
if (l > f || l > a) {
|
|
2329
2500
|
for (c = l; c <= f; c++) {
|
|
2330
2501
|
o = true;
|
|
2331
|
-
r?.[c] && setSignal(r[c],
|
|
2502
|
+
r?.[c] && setSignal(r[c], wrapValue(e[c], t));
|
|
2332
2503
|
}
|
|
2333
2504
|
for (; c < e.length; c++) {
|
|
2334
2505
|
o = true;
|
|
2335
|
-
|
|
2336
|
-
r?.[c] && setSignal(r[c], i);
|
|
2337
|
-
applyState(e[c], i, n);
|
|
2506
|
+
applyArrayItem(e[c], T[c], t, r?.[c], n);
|
|
2338
2507
|
}
|
|
2339
|
-
|
|
2508
|
+
syncArrayNodeMembership(t, e);
|
|
2509
|
+
(o || s !== e.length) && notifySelf(t);
|
|
2340
2510
|
s !== e.length && r?.length && setSignal(r.length, e.length);
|
|
2341
2511
|
return;
|
|
2342
2512
|
}
|
|
2343
|
-
|
|
2513
|
+
d = new Array(f + 1);
|
|
2344
2514
|
for (c = f; c >= l; c--) {
|
|
2345
2515
|
E = e[c];
|
|
2346
|
-
S = E
|
|
2516
|
+
S = itemKey(E, n);
|
|
2347
2517
|
u = _.get(S);
|
|
2348
|
-
|
|
2518
|
+
d[c] = u === undefined ? -1 : u;
|
|
2349
2519
|
_.set(S, c);
|
|
2350
2520
|
}
|
|
2351
2521
|
for (u = l; u <= a; u++) {
|
|
2352
2522
|
E = i[u];
|
|
2353
|
-
S = E
|
|
2523
|
+
S = itemKey(E, n);
|
|
2354
2524
|
c = _.get(S);
|
|
2355
2525
|
if (c !== undefined && c !== -1) {
|
|
2356
|
-
|
|
2357
|
-
c =
|
|
2526
|
+
T[c] = E;
|
|
2527
|
+
c = d[c];
|
|
2358
2528
|
_.set(S, c);
|
|
2359
2529
|
}
|
|
2360
2530
|
}
|
|
2361
2531
|
for (c = l; c < e.length; c++) {
|
|
2362
|
-
if (c in
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
applyState(e[c], i, n);
|
|
2366
|
-
} else r?.[c] && setSignal(r[c], wrap(e[c], t));
|
|
2532
|
+
if (c in T) {
|
|
2533
|
+
applyArrayItem(e[c], T[c], t, r?.[c], n);
|
|
2534
|
+
} else r?.[c] && setSignal(r[c], wrapValue(e[c], t));
|
|
2367
2535
|
}
|
|
2368
2536
|
if (l < e.length) o = true;
|
|
2369
2537
|
} else if (e.length) {
|
|
2370
2538
|
for (let s = 0, u = e.length; s < u; s++) {
|
|
2371
2539
|
const u = i[s];
|
|
2372
|
-
if (isWrappable(u)) applyState(e[s], wrap(u, t), n);
|
|
2540
|
+
if (isWrappable(u) && isWrappable(e[s])) applyState(e[s], wrap(u, t), n);
|
|
2373
2541
|
else {
|
|
2374
2542
|
if (u !== e[s]) o = true;
|
|
2375
|
-
r?.[s] && setSignal(r[s], e[s]);
|
|
2543
|
+
r?.[s] && setSignal(r[s], wrapValue(e[s], t));
|
|
2376
2544
|
}
|
|
2377
2545
|
}
|
|
2378
2546
|
}
|
|
2547
|
+
syncArrayNodeMembership(t, e);
|
|
2379
2548
|
if (s !== e.length) {
|
|
2380
2549
|
o = true;
|
|
2381
2550
|
r?.length && setSignal(r.length, e.length);
|
|
@@ -2386,21 +2555,27 @@ function applyStateFast(e, t, n) {
|
|
|
2386
2555
|
let o = t[STORE_NODE];
|
|
2387
2556
|
if (o) {
|
|
2388
2557
|
const r = o[$TRACK];
|
|
2389
|
-
const s = r ? getAllKeys(i, undefined, e) :
|
|
2558
|
+
const s = r ? getAllKeys(i, undefined, e) : nodeKeys(o);
|
|
2390
2559
|
for (let u = 0, c = s.length; u < c; u++) {
|
|
2391
2560
|
const c = s[u];
|
|
2392
2561
|
const l = o[c];
|
|
2393
2562
|
const a = unwrap(i[c]);
|
|
2394
2563
|
let f = unwrap(e[c]);
|
|
2395
2564
|
if (a === f) continue;
|
|
2396
|
-
if (
|
|
2565
|
+
if (
|
|
2566
|
+
!a ||
|
|
2567
|
+
!isWrappable(a) ||
|
|
2568
|
+
!isWrappable(f) ||
|
|
2569
|
+
Array.isArray(a) !== Array.isArray(f) ||
|
|
2570
|
+
(n(a) != null && n(a) !== n(f))
|
|
2571
|
+
) {
|
|
2397
2572
|
r && setSignal(r, void 0);
|
|
2398
2573
|
l && setSignal(l, isWrappable(f) ? wrap(f, t) : f);
|
|
2399
2574
|
} else applyState(f, wrap(a, t), n);
|
|
2400
2575
|
}
|
|
2401
2576
|
}
|
|
2402
2577
|
if ((o = t[STORE_HAS])) {
|
|
2403
|
-
const t =
|
|
2578
|
+
const t = nodeKeys(o);
|
|
2404
2579
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
2405
2580
|
const i = t[n];
|
|
2406
2581
|
setSignal(o[i], i in e);
|
|
@@ -2418,79 +2593,75 @@ function applyStateSlow(e, t, n) {
|
|
|
2418
2593
|
if (Array.isArray(i)) {
|
|
2419
2594
|
let u = false;
|
|
2420
2595
|
const c = getOverrideValue(i, r, "length", o);
|
|
2421
|
-
if (e.length && c && e[0] && n(e[0]) != null) {
|
|
2422
|
-
let l, a, f, E,
|
|
2596
|
+
if (e.length && c && isWrappable(e[0]) && n(e[0]) != null) {
|
|
2597
|
+
let l, a, f, E, d, S, T, _;
|
|
2423
2598
|
for (
|
|
2424
2599
|
f = 0, E = Math.min(c, e.length);
|
|
2425
|
-
f < E && ((S = getOverrideValue(i, r, f, o))
|
|
2600
|
+
f < E && keyedMatch((S = getOverrideValue(i, r, f, o)), e[f], n);
|
|
2426
2601
|
f++
|
|
2427
2602
|
) {
|
|
2428
|
-
applyState(e[f], wrap(S, t), n);
|
|
2603
|
+
isWrappable(S) && isWrappable(e[f]) && applyState(e[f], wrap(S, t), n);
|
|
2429
2604
|
}
|
|
2430
2605
|
const O = new Array(e.length),
|
|
2431
|
-
|
|
2606
|
+
p = new Map();
|
|
2432
2607
|
for (
|
|
2433
|
-
E = c - 1,
|
|
2434
|
-
E >= f &&
|
|
2435
|
-
|
|
2436
|
-
((S = getOverrideValue(i, r, E, o)) === e[T] || (S && e[T] && n(S) === n(e[T])));
|
|
2437
|
-
E--, T--
|
|
2608
|
+
E = c - 1, d = e.length - 1;
|
|
2609
|
+
E >= f && d >= f && keyedMatch((S = getOverrideValue(i, r, E, o)), e[d], n);
|
|
2610
|
+
E--, d--
|
|
2438
2611
|
) {
|
|
2439
|
-
O[
|
|
2612
|
+
O[d] = S;
|
|
2440
2613
|
}
|
|
2441
|
-
if (f >
|
|
2442
|
-
for (a = f; a <=
|
|
2614
|
+
if (f > d || f > E) {
|
|
2615
|
+
for (a = f; a <= d; a++) {
|
|
2443
2616
|
u = true;
|
|
2444
|
-
s?.[a] && setSignal(s[a],
|
|
2617
|
+
s?.[a] && setSignal(s[a], wrapValue(e[a], t));
|
|
2445
2618
|
}
|
|
2446
2619
|
for (; a < e.length; a++) {
|
|
2447
2620
|
u = true;
|
|
2448
|
-
|
|
2449
|
-
s?.[a] && setSignal(s[a], i);
|
|
2450
|
-
applyState(e[a], i, n);
|
|
2621
|
+
applyArrayItem(e[a], O[a], t, s?.[a], n);
|
|
2451
2622
|
}
|
|
2452
2623
|
const i = e.length;
|
|
2453
|
-
|
|
2624
|
+
syncArrayNodeMembership(t, e);
|
|
2625
|
+
(u || c !== i) && notifySelf(t);
|
|
2454
2626
|
c !== i && s?.length && setSignal(s.length, i);
|
|
2455
2627
|
return;
|
|
2456
2628
|
}
|
|
2457
|
-
|
|
2458
|
-
for (a =
|
|
2629
|
+
T = new Array(d + 1);
|
|
2630
|
+
for (a = d; a >= f; a--) {
|
|
2459
2631
|
S = e[a];
|
|
2460
|
-
_ = S
|
|
2461
|
-
l =
|
|
2462
|
-
|
|
2463
|
-
|
|
2632
|
+
_ = itemKey(S, n);
|
|
2633
|
+
l = p.get(_);
|
|
2634
|
+
T[a] = l === undefined ? -1 : l;
|
|
2635
|
+
p.set(_, a);
|
|
2464
2636
|
}
|
|
2465
2637
|
for (l = f; l <= E; l++) {
|
|
2466
2638
|
S = getOverrideValue(i, r, l, o);
|
|
2467
|
-
_ = S
|
|
2468
|
-
a =
|
|
2639
|
+
_ = itemKey(S, n);
|
|
2640
|
+
a = p.get(_);
|
|
2469
2641
|
if (a !== undefined && a !== -1) {
|
|
2470
2642
|
O[a] = S;
|
|
2471
|
-
a =
|
|
2472
|
-
|
|
2643
|
+
a = T[a];
|
|
2644
|
+
p.set(_, a);
|
|
2473
2645
|
}
|
|
2474
2646
|
}
|
|
2475
2647
|
for (a = f; a < e.length; a++) {
|
|
2476
2648
|
if (a in O) {
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
applyState(e[a], i, n);
|
|
2480
|
-
} else s?.[a] && setSignal(s[a], wrap(e[a], t));
|
|
2649
|
+
applyArrayItem(e[a], O[a], t, s?.[a], n);
|
|
2650
|
+
} else s?.[a] && setSignal(s[a], wrapValue(e[a], t));
|
|
2481
2651
|
}
|
|
2482
2652
|
if (f < e.length) u = true;
|
|
2483
2653
|
} else if (e.length) {
|
|
2484
2654
|
for (let c = 0, l = e.length; c < l; c++) {
|
|
2485
2655
|
const l = getOverrideValue(i, r, c, o);
|
|
2486
|
-
if (isWrappable(l)) applyState(e[c], wrap(l, t), n);
|
|
2656
|
+
if (isWrappable(l) && isWrappable(e[c])) applyState(e[c], wrap(l, t), n);
|
|
2487
2657
|
else {
|
|
2488
2658
|
if (l !== e[c]) u = true;
|
|
2489
|
-
s?.[c] && setSignal(s[c], e[c]);
|
|
2659
|
+
s?.[c] && setSignal(s[c], wrapValue(e[c], t));
|
|
2490
2660
|
}
|
|
2491
2661
|
}
|
|
2492
2662
|
}
|
|
2493
2663
|
const l = e.length;
|
|
2664
|
+
syncArrayNodeMembership(t, e);
|
|
2494
2665
|
if (c !== l) {
|
|
2495
2666
|
u = true;
|
|
2496
2667
|
s?.length && setSignal(s.length, l);
|
|
@@ -2500,21 +2671,27 @@ function applyStateSlow(e, t, n) {
|
|
|
2500
2671
|
}
|
|
2501
2672
|
if (s) {
|
|
2502
2673
|
const u = s[$TRACK];
|
|
2503
|
-
const c = u ? getAllKeys(i, r, e) :
|
|
2674
|
+
const c = u ? getAllKeys(i, r, e) : nodeKeys(s);
|
|
2504
2675
|
for (let l = 0, a = c.length; l < a; l++) {
|
|
2505
2676
|
const a = c[l];
|
|
2506
2677
|
const f = s[a];
|
|
2507
2678
|
const E = unwrap(getOverrideValue(i, r, a, o));
|
|
2508
|
-
let
|
|
2509
|
-
if (E ===
|
|
2510
|
-
if (
|
|
2679
|
+
let d = unwrap(e[a]);
|
|
2680
|
+
if (E === d) continue;
|
|
2681
|
+
if (
|
|
2682
|
+
!E ||
|
|
2683
|
+
!isWrappable(E) ||
|
|
2684
|
+
!isWrappable(d) ||
|
|
2685
|
+
Array.isArray(E) !== Array.isArray(d) ||
|
|
2686
|
+
(n(E) != null && n(E) !== n(d))
|
|
2687
|
+
) {
|
|
2511
2688
|
u && setSignal(u, void 0);
|
|
2512
|
-
f && setSignal(f, isWrappable(
|
|
2513
|
-
} else applyState(
|
|
2689
|
+
f && setSignal(f, isWrappable(d) ? wrap(d, t) : d);
|
|
2690
|
+
} else applyState(d, wrap(E, t), n);
|
|
2514
2691
|
}
|
|
2515
2692
|
}
|
|
2516
2693
|
if ((s = t[STORE_HAS])) {
|
|
2517
|
-
const t =
|
|
2694
|
+
const t = nodeKeys(s);
|
|
2518
2695
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
2519
2696
|
const i = t[n];
|
|
2520
2697
|
setSignal(s[i], i in e);
|
|
@@ -2556,7 +2733,7 @@ function createProjectionInternal(e, t, n) {
|
|
|
2556
2733
|
if (!i) i = getOwner();
|
|
2557
2734
|
runProjectionComputed(o, e, n?.key || "id");
|
|
2558
2735
|
}, undefined);
|
|
2559
|
-
i.
|
|
2736
|
+
i.le &= ~CONFIG_AUTO_DISPOSE;
|
|
2560
2737
|
return { store: o, node: i };
|
|
2561
2738
|
}
|
|
2562
2739
|
function createProjection(e, t, n) {
|
|
@@ -2568,7 +2745,7 @@ function runProjectionComputed(e, t, n, i, r) {
|
|
|
2568
2745
|
let u;
|
|
2569
2746
|
const c = new Proxy(
|
|
2570
2747
|
e,
|
|
2571
|
-
createWriteTraps(() => !s || o.
|
|
2748
|
+
createWriteTraps(() => !s || o.be === u, r)
|
|
2572
2749
|
);
|
|
2573
2750
|
storeSetter(c, r => {
|
|
2574
2751
|
u = t(r);
|
|
@@ -2651,7 +2828,8 @@ const STORE_VALUE = "v",
|
|
|
2651
2828
|
STORE_WRAP = "w",
|
|
2652
2829
|
STORE_LOOKUP = "l",
|
|
2653
2830
|
STORE_FIREWALL = "f",
|
|
2654
|
-
STORE_OPTIMISTIC = "p"
|
|
2831
|
+
STORE_OPTIMISTIC = "p",
|
|
2832
|
+
STORE_MASKED = "m";
|
|
2655
2833
|
const STORE_SELF_PENDING = Symbol(0);
|
|
2656
2834
|
function createStoreProxy(e, t = storeTraps, n) {
|
|
2657
2835
|
let i;
|
|
@@ -2670,6 +2848,7 @@ function createStoreProxy(e, t = storeTraps, n) {
|
|
|
2670
2848
|
return (i[$PROXY] = new Proxy(i, t));
|
|
2671
2849
|
}
|
|
2672
2850
|
const storeLookup = new WeakMap();
|
|
2851
|
+
const symbolKeyedRecords = new WeakSet();
|
|
2673
2852
|
function wrap(e, t) {
|
|
2674
2853
|
if (t?.[STORE_WRAP]) return t[STORE_WRAP](e, t);
|
|
2675
2854
|
let n = e[$PROXY] || storeLookup.get(e);
|
|
@@ -2710,11 +2889,22 @@ function unwrapStoreValue(e, t, n) {
|
|
|
2710
2889
|
function isPrototypePollutionKey$1(e) {
|
|
2711
2890
|
return e === "__proto__" || e === "constructor" || e === "prototype";
|
|
2712
2891
|
}
|
|
2713
|
-
function
|
|
2892
|
+
function ownEnumerableKeys(e) {
|
|
2893
|
+
return Reflect.ownKeys(e).filter(t => Object.prototype.propertyIsEnumerable.call(e, t));
|
|
2894
|
+
}
|
|
2895
|
+
function getOverlayLayer(e, t) {
|
|
2714
2896
|
const n = e[STORE_OPTIMISTIC_OVERRIDE];
|
|
2715
|
-
if (n &&
|
|
2897
|
+
if (n && t in n) return n;
|
|
2716
2898
|
const i = e[STORE_OVERRIDE];
|
|
2717
|
-
if (i &&
|
|
2899
|
+
if (i && t in i) return i;
|
|
2900
|
+
return undefined;
|
|
2901
|
+
}
|
|
2902
|
+
function visibleNodeValue(e) {
|
|
2903
|
+
return e.O !== undefined && e.O !== NOT_PENDING ? e.O : e.D !== NOT_PENDING ? e.D : e.Z;
|
|
2904
|
+
}
|
|
2905
|
+
function hasOwnStoreProperty(e, t) {
|
|
2906
|
+
const n = getOverlayLayer(e, t);
|
|
2907
|
+
if (n) return n[t] !== $DELETED;
|
|
2718
2908
|
return Object.prototype.hasOwnProperty.call(unwrapStoreValue(e[STORE_VALUE]), t);
|
|
2719
2909
|
}
|
|
2720
2910
|
function hasInheritedAccessor(e, t) {
|
|
@@ -2738,19 +2928,33 @@ function getNode(e, t, n, i, r = isEqual, o, s) {
|
|
|
2738
2928
|
{
|
|
2739
2929
|
equals: r,
|
|
2740
2930
|
unobserved() {
|
|
2741
|
-
if (e[t] === u)
|
|
2931
|
+
if (e[t] === u) {
|
|
2932
|
+
delete e[t];
|
|
2933
|
+
if (typeof t === "symbol" && t !== $TRACK && symbolKeyedRecords.has(e)) {
|
|
2934
|
+
const t = Object.getOwnPropertySymbols(e);
|
|
2935
|
+
let n = false;
|
|
2936
|
+
for (let e = 0, i = t.length; e < i; e++) {
|
|
2937
|
+
if (t[e] !== $TRACK) {
|
|
2938
|
+
n = true;
|
|
2939
|
+
break;
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
if (!n) symbolKeyedRecords.delete(e);
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2742
2945
|
}
|
|
2743
2946
|
},
|
|
2744
2947
|
i
|
|
2745
2948
|
);
|
|
2746
2949
|
if (o) {
|
|
2747
|
-
u.
|
|
2950
|
+
u.O = NOT_PENDING;
|
|
2748
2951
|
}
|
|
2749
2952
|
if (s && t in s) {
|
|
2750
2953
|
const e = s[t];
|
|
2751
|
-
u.
|
|
2954
|
+
u.Ee = e === undefined ? NO_SNAPSHOT : e;
|
|
2752
2955
|
snapshotSources?.add(u);
|
|
2753
2956
|
}
|
|
2957
|
+
if (typeof t === "symbol" && t !== $TRACK) symbolKeyedRecords.add(e);
|
|
2754
2958
|
return (e[t] = u);
|
|
2755
2959
|
}
|
|
2756
2960
|
function trackSelf(e, t = $TRACK) {
|
|
@@ -2764,7 +2968,11 @@ function notifySelf(e) {
|
|
|
2764
2968
|
t && setSignal(t, e[STORE_OPTIMISTIC] && !projectionWriteActive ? STORE_SELF_PENDING : undefined);
|
|
2765
2969
|
}
|
|
2766
2970
|
function getKeys(e, t, n = true) {
|
|
2767
|
-
const i =
|
|
2971
|
+
const i = e[$TARGET]
|
|
2972
|
+
? untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)))
|
|
2973
|
+
: n
|
|
2974
|
+
? Object.keys(e)
|
|
2975
|
+
: Reflect.ownKeys(e);
|
|
2768
2976
|
if (!t) return i;
|
|
2769
2977
|
const r = new Set(i);
|
|
2770
2978
|
const o = Reflect.ownKeys(t);
|
|
@@ -2778,15 +2986,31 @@ function getPropertyDescriptor(e, t, n) {
|
|
|
2778
2986
|
if (t && n in t) {
|
|
2779
2987
|
if (t[n] === $DELETED) return void 0;
|
|
2780
2988
|
const i = Reflect.getOwnPropertyDescriptor(t, n);
|
|
2781
|
-
if (i?.get || i?.set
|
|
2989
|
+
if (i?.get || i?.set) return i;
|
|
2990
|
+
const r = Reflect.getOwnPropertyDescriptor(e, n);
|
|
2991
|
+
if (!r) return i;
|
|
2992
|
+
if (r.get || r.set) return r;
|
|
2993
|
+
r.value = t[n];
|
|
2994
|
+
return r;
|
|
2782
2995
|
}
|
|
2783
2996
|
return Reflect.getOwnPropertyDescriptor(e, n);
|
|
2784
2997
|
}
|
|
2998
|
+
function maskStoreTarget(e, t) {
|
|
2999
|
+
const n = e[STORE_FIREWALL];
|
|
3000
|
+
if (!n) return;
|
|
3001
|
+
if (!!e[STORE_MASKED] === t) return;
|
|
3002
|
+
e[STORE_MASKED] = t;
|
|
3003
|
+
const i = (n.qe = (n.qe || 0) + (t ? 1 : -1));
|
|
3004
|
+
if ((t && i === 1) || (!t && i === 0)) {
|
|
3005
|
+
updatePendingSignal(n);
|
|
3006
|
+
updateChildCompanions(n);
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
2785
3009
|
function prepareStoreWrite(e, t, n) {
|
|
2786
3010
|
if (e[STORE_OPTIMISTIC]) {
|
|
2787
3011
|
const t = e[STORE_FIREWALL];
|
|
2788
|
-
if (t?.
|
|
2789
|
-
globalQueue.initTransition(t.
|
|
3012
|
+
if (t?.T) {
|
|
3013
|
+
globalQueue.initTransition(t.T);
|
|
2790
3014
|
}
|
|
2791
3015
|
}
|
|
2792
3016
|
const i = e[STORE_VALUE];
|
|
@@ -2794,7 +3018,7 @@ function prepareStoreWrite(e, t, n) {
|
|
|
2794
3018
|
if (
|
|
2795
3019
|
snapshotCaptureActive &&
|
|
2796
3020
|
typeof n !== "symbol" &&
|
|
2797
|
-
!((e[STORE_FIREWALL]?.
|
|
3021
|
+
!((e[STORE_FIREWALL]?.Y ?? 0) & STATUS_PENDING)
|
|
2798
3022
|
) {
|
|
2799
3023
|
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2800
3024
|
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
@@ -2806,9 +3030,14 @@ function prepareStoreWrite(e, t, n) {
|
|
|
2806
3030
|
}
|
|
2807
3031
|
const o = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
2808
3032
|
const s = o ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
2809
|
-
if (o) trackOptimisticStore(t);
|
|
2810
3033
|
return { base: r, overrideKey: s, state: i };
|
|
2811
3034
|
}
|
|
3035
|
+
function armOptimisticStoreWrite(e, t) {
|
|
3036
|
+
if (e[STORE_OPTIMISTIC] && !projectionWriteActive) {
|
|
3037
|
+
trackOptimisticStore(t);
|
|
3038
|
+
maskStoreTarget(e, true);
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
2812
3041
|
function upsertStoreNode(e, t, n, i, r) {
|
|
2813
3042
|
if (t[n]) return t[n];
|
|
2814
3043
|
const o = isWrappable(i) ? wrap(i, e) : i;
|
|
@@ -2878,14 +3107,10 @@ const storeTraps = {
|
|
|
2878
3107
|
) {
|
|
2879
3108
|
return read(getNode(r, t, undefined, e[STORE_FIREWALL]));
|
|
2880
3109
|
}
|
|
2881
|
-
const u = e
|
|
2882
|
-
const c = u
|
|
3110
|
+
const u = getOverlayLayer(e, t);
|
|
3111
|
+
const c = !!u;
|
|
2883
3112
|
const l = !!e[STORE_VALUE][$TARGET];
|
|
2884
|
-
const a = u
|
|
2885
|
-
? e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2886
|
-
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2887
|
-
? e[STORE_OVERRIDE]
|
|
2888
|
-
: e[STORE_VALUE];
|
|
3113
|
+
const a = u ?? e[STORE_VALUE];
|
|
2889
3114
|
if (!o) {
|
|
2890
3115
|
const i = Object.getOwnPropertyDescriptor(a, t);
|
|
2891
3116
|
if (i && i.get) return i.get.call(n);
|
|
@@ -2898,14 +3123,7 @@ const storeTraps = {
|
|
|
2898
3123
|
}
|
|
2899
3124
|
if (writeOnly(n)) {
|
|
2900
3125
|
if (isPrototypePollutionKey$1(t) && !hasOwnStoreProperty(e, t)) return undefined;
|
|
2901
|
-
let n =
|
|
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];
|
|
3126
|
+
let n = o && (c || !l) ? visibleNodeValue(o) : a[t];
|
|
2909
3127
|
n === $DELETED && (n = undefined);
|
|
2910
3128
|
if (!isWrappable(n)) return n;
|
|
2911
3129
|
const i = wrap(n, e);
|
|
@@ -2915,7 +3133,7 @@ const storeTraps = {
|
|
|
2915
3133
|
let f = o ? (c || !l ? read(r[t]) : (read(r[t]), a[t])) : a[t];
|
|
2916
3134
|
f === $DELETED && (f = undefined);
|
|
2917
3135
|
if (!o) {
|
|
2918
|
-
if (!c && typeof f === "function" && !
|
|
3136
|
+
if (!c && typeof f === "function" && !Object.prototype.hasOwnProperty.call(a, t)) {
|
|
2919
3137
|
let t;
|
|
2920
3138
|
return !Array.isArray(e[STORE_VALUE]) &&
|
|
2921
3139
|
(t = Object.getPrototypeOf(e[STORE_VALUE])) &&
|
|
@@ -2940,19 +3158,15 @@ const storeTraps = {
|
|
|
2940
3158
|
},
|
|
2941
3159
|
has(e, t) {
|
|
2942
3160
|
if (t === $PROXY || t === $TRACK || t === "__proto__") return true;
|
|
2943
|
-
const n =
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
: t in e[STORE_VALUE];
|
|
2949
|
-
if (writeOnly(e[$PROXY]) || getObserver() === e[STORE_FIREWALL]) return n;
|
|
2950
|
-
const i = getNodes(e, STORE_HAS);
|
|
2951
|
-
if (i[t]) return read(i[t]);
|
|
3161
|
+
const n = getOverlayLayer(e, t);
|
|
3162
|
+
const i = n ? n[t] !== $DELETED : t in e[STORE_VALUE];
|
|
3163
|
+
if (writeOnly(e[$PROXY]) || getObserver() === e[STORE_FIREWALL]) return i;
|
|
3164
|
+
const r = getNodes(e, STORE_HAS);
|
|
3165
|
+
if (r[t]) return read(r[t]);
|
|
2952
3166
|
if (getObserver()) {
|
|
2953
|
-
return read(getNode(
|
|
3167
|
+
return read(getNode(r, t, i, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC]));
|
|
2954
3168
|
}
|
|
2955
|
-
return
|
|
3169
|
+
return i;
|
|
2956
3170
|
},
|
|
2957
3171
|
set(e, t, n) {
|
|
2958
3172
|
if (t === "__proto__") return true;
|
|
@@ -2960,44 +3174,46 @@ const storeTraps = {
|
|
|
2960
3174
|
if (writeOnly(i)) {
|
|
2961
3175
|
untrack(() => {
|
|
2962
3176
|
const { base: r, overrideKey: o, state: s } = prepareStoreWrite(e, i, t);
|
|
2963
|
-
const u =
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
const
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
: t in e[STORE_VALUE];
|
|
2975
|
-
const l = unwrapStoreValue(n);
|
|
2976
|
-
const a = Array.isArray(s) && t !== "length";
|
|
2977
|
-
const f = a ? parseInt(t) + 1 : 0;
|
|
2978
|
-
const E =
|
|
2979
|
-
a &&
|
|
2980
|
-
(e[STORE_OPTIMISTIC_OVERRIDE] && "length" in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2981
|
-
? e[STORE_OPTIMISTIC_OVERRIDE].length
|
|
2982
|
-
: e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
|
|
2983
|
-
? e[STORE_OVERRIDE].length
|
|
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];
|
|
3177
|
+
const u = getOverlayLayer(e, t);
|
|
3178
|
+
const c = u ? u[t] : r;
|
|
3179
|
+
const l = u ? u[t] !== $DELETED : t in e[STORE_VALUE];
|
|
3180
|
+
const a = unwrapStoreValue(n);
|
|
3181
|
+
const f = Array.isArray(s) && t !== "length" && typeof t !== "symbol";
|
|
3182
|
+
const E = f ? parseInt(t) + 1 : 0;
|
|
3183
|
+
const d = f && (getOverlayLayer(e, "length") ?? s).length;
|
|
3184
|
+
const S = f && E > d ? E : undefined;
|
|
3185
|
+
if (c === a && S === undefined) return true;
|
|
3186
|
+
armOptimisticStoreWrite(e, i);
|
|
3187
|
+
if (a !== undefined && a === r && S === undefined) delete e[o]?.[t];
|
|
2988
3188
|
else {
|
|
2989
3189
|
const n = e[o] || (e[o] = Object.create(null));
|
|
2990
|
-
n[t] =
|
|
2991
|
-
if (
|
|
3190
|
+
n[t] = a;
|
|
3191
|
+
if (S !== undefined) n.length = S;
|
|
3192
|
+
}
|
|
3193
|
+
notifyStoreProperty(e, t, "set", a, c, l);
|
|
3194
|
+
if (
|
|
3195
|
+
Array.isArray(s) &&
|
|
3196
|
+
t === "length" &&
|
|
3197
|
+
typeof a === "number" &&
|
|
3198
|
+
typeof c === "number" &&
|
|
3199
|
+
a < c
|
|
3200
|
+
) {
|
|
3201
|
+
const t = e[o] || (e[o] = Object.create(null));
|
|
3202
|
+
for (let n = a; n < c; n++) {
|
|
3203
|
+
if (t[n] === $DELETED) continue;
|
|
3204
|
+
const i = n in t ? t[n] : s[n];
|
|
3205
|
+
if (!(n in t) && !(n in s)) continue;
|
|
3206
|
+
t[n] = $DELETED;
|
|
3207
|
+
notifyStoreProperty(e, n, "delete", undefined, i, true);
|
|
3208
|
+
}
|
|
2992
3209
|
}
|
|
2993
|
-
|
|
2994
|
-
if (Array.isArray(s) && t !== "length" && T !== undefined) {
|
|
3210
|
+
if (Array.isArray(s) && t !== "length" && S !== undefined) {
|
|
2995
3211
|
const t = getNodes(e, STORE_NODE);
|
|
2996
3212
|
if (t.length) {
|
|
2997
|
-
setSignal(t.length,
|
|
3213
|
+
setSignal(t.length, S);
|
|
2998
3214
|
} else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
|
|
2999
|
-
const n = upsertStoreNode(e, t, "length",
|
|
3000
|
-
setSignal(n,
|
|
3215
|
+
const n = upsertStoreNode(e, t, "length", d, e[STORE_SNAPSHOT_PROPS]);
|
|
3216
|
+
setSignal(n, S);
|
|
3001
3217
|
}
|
|
3002
3218
|
}
|
|
3003
3219
|
if (false);
|
|
@@ -3011,6 +3227,7 @@ const storeTraps = {
|
|
|
3011
3227
|
if (writeOnly(i)) {
|
|
3012
3228
|
untrack(() => {
|
|
3013
3229
|
const { base: r, overrideKey: o } = prepareStoreWrite(e, i, t);
|
|
3230
|
+
armOptimisticStoreWrite(e, i);
|
|
3014
3231
|
const s = "value" in n ? { ...n, value: unwrapStoreValue(n.value) } : n;
|
|
3015
3232
|
Object.defineProperty(e[o] || (e[o] = Object.create(null)), t, s);
|
|
3016
3233
|
notifyStoreProperty(e, t, "invalidate");
|
|
@@ -3027,19 +3244,16 @@ const storeTraps = {
|
|
|
3027
3244
|
untrack(() => {
|
|
3028
3245
|
const n = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
3029
3246
|
const i = n ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
3030
|
-
|
|
3031
|
-
const r
|
|
3032
|
-
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
3033
|
-
? e[STORE_OPTIMISTIC_OVERRIDE][t]
|
|
3034
|
-
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
3035
|
-
? e[STORE_OVERRIDE][t]
|
|
3036
|
-
: e[STORE_VALUE][t];
|
|
3247
|
+
const r = getOverlayLayer(e, t);
|
|
3248
|
+
const o = r ? r[t] : e[STORE_VALUE][t];
|
|
3037
3249
|
if (t in e[STORE_VALUE] || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE])) {
|
|
3250
|
+
armOptimisticStoreWrite(e, e[$PROXY]);
|
|
3038
3251
|
(e[i] || (e[i] = Object.create(null)))[t] = $DELETED;
|
|
3039
3252
|
} else if (e[i] && t in e[i]) {
|
|
3253
|
+
armOptimisticStoreWrite(e, e[$PROXY]);
|
|
3040
3254
|
delete e[i][t];
|
|
3041
3255
|
} else return true;
|
|
3042
|
-
notifyStoreProperty(e, t, "delete", undefined,
|
|
3256
|
+
notifyStoreProperty(e, t, "delete", undefined, o, true);
|
|
3043
3257
|
});
|
|
3044
3258
|
}
|
|
3045
3259
|
return true;
|
|
@@ -3065,7 +3279,9 @@ const storeTraps = {
|
|
|
3065
3279
|
if (n?.get || n?.set || !(t in e[STORE_VALUE])) return n;
|
|
3066
3280
|
const i = getPropertyDescriptor(e[STORE_VALUE], e[STORE_OVERRIDE], t);
|
|
3067
3281
|
if (i) {
|
|
3068
|
-
|
|
3282
|
+
const n = Reflect.getOwnPropertyDescriptor(e, t);
|
|
3283
|
+
const r = !n || n.configurable ? true : i.configurable;
|
|
3284
|
+
return { ...i, configurable: r, value: e[STORE_OPTIMISTIC_OVERRIDE][t] };
|
|
3069
3285
|
}
|
|
3070
3286
|
return {
|
|
3071
3287
|
value: e[STORE_OPTIMISTIC_OVERRIDE][t],
|
|
@@ -3074,7 +3290,12 @@ const storeTraps = {
|
|
|
3074
3290
|
configurable: true
|
|
3075
3291
|
};
|
|
3076
3292
|
}
|
|
3077
|
-
|
|
3293
|
+
const n = getPropertyDescriptor(e[STORE_VALUE], e[STORE_OVERRIDE], t);
|
|
3294
|
+
if (n && !n.configurable) {
|
|
3295
|
+
const i = Reflect.getOwnPropertyDescriptor(e, t);
|
|
3296
|
+
if (!i || i.configurable) return { ...n, configurable: true };
|
|
3297
|
+
}
|
|
3298
|
+
return n;
|
|
3078
3299
|
},
|
|
3079
3300
|
getPrototypeOf(e) {
|
|
3080
3301
|
return Object.getPrototypeOf(e[STORE_VALUE]);
|
|
@@ -3091,7 +3312,7 @@ function storeSetter(e, t) {
|
|
|
3091
3312
|
for (let t = 0, i = n.length; t < i; t++) e[t] = n[t];
|
|
3092
3313
|
e.length = n.length;
|
|
3093
3314
|
} else {
|
|
3094
|
-
const t = new Set([...
|
|
3315
|
+
const t = new Set([...ownEnumerableKeys(e), ...ownEnumerableKeys(n)]);
|
|
3095
3316
|
t.forEach(t => {
|
|
3096
3317
|
if (t in n) e[t] = n[t];
|
|
3097
3318
|
else delete e[t];
|
|
@@ -3117,7 +3338,7 @@ function createStore(e, t, n) {
|
|
|
3117
3338
|
];
|
|
3118
3339
|
}
|
|
3119
3340
|
function createOptimisticStore(e, t, n) {
|
|
3120
|
-
GlobalQueue.
|
|
3341
|
+
GlobalQueue.se ||= clearOptimisticStore;
|
|
3121
3342
|
const i = typeof e === "function";
|
|
3122
3343
|
const r = i ? t : e;
|
|
3123
3344
|
const o = i ? e : undefined;
|
|
@@ -3126,12 +3347,15 @@ function createOptimisticStore(e, t, n) {
|
|
|
3126
3347
|
}
|
|
3127
3348
|
function clearOptimisticStore(e) {
|
|
3128
3349
|
const t = e[$TARGET];
|
|
3129
|
-
if (!t
|
|
3350
|
+
if (!t) return;
|
|
3351
|
+
maskStoreTarget(t, false);
|
|
3352
|
+
if (!t[STORE_OPTIMISTIC_OVERRIDE]) return;
|
|
3130
3353
|
clearOptimisticOverride(t);
|
|
3131
3354
|
}
|
|
3132
3355
|
function clearOptimisticOverride(e) {
|
|
3133
3356
|
const t = e[STORE_OPTIMISTIC_OVERRIDE];
|
|
3134
3357
|
if (!t) return;
|
|
3358
|
+
maskStoreTarget(e, false);
|
|
3135
3359
|
const n = e[STORE_NODE];
|
|
3136
3360
|
delete e[STORE_OPTIMISTIC_OVERRIDE];
|
|
3137
3361
|
const i = projectionWriteActive;
|
|
@@ -3142,16 +3366,15 @@ function clearOptimisticOverride(e) {
|
|
|
3142
3366
|
if (n[i]) {
|
|
3143
3367
|
const t = n[i];
|
|
3144
3368
|
t.i = undefined;
|
|
3145
|
-
const r =
|
|
3146
|
-
|
|
3147
|
-
const
|
|
3148
|
-
const
|
|
3149
|
-
const
|
|
3150
|
-
|
|
3151
|
-
t.
|
|
3152
|
-
t.
|
|
3153
|
-
t.
|
|
3154
|
-
if (!t.ke || !t.ke(u, s)) {
|
|
3369
|
+
const r = getOverlayLayer(e, i);
|
|
3370
|
+
const o = r ? r[i] : e[STORE_VALUE][i];
|
|
3371
|
+
const s = o === $DELETED ? undefined : o;
|
|
3372
|
+
const u = isWrappable(s) ? wrap(s, e) : s;
|
|
3373
|
+
const c = visibleNodeValue(t);
|
|
3374
|
+
t.O = NOT_PENDING;
|
|
3375
|
+
t.D = NOT_PENDING;
|
|
3376
|
+
t.Z = u;
|
|
3377
|
+
if (!t.xe || !t.xe(c, u)) {
|
|
3155
3378
|
insertSubs(t, true);
|
|
3156
3379
|
schedule();
|
|
3157
3380
|
}
|
|
@@ -3211,7 +3434,7 @@ function createOptimisticProjectionInternal(e, t, n) {
|
|
|
3211
3434
|
setProjectionWriteActive(false);
|
|
3212
3435
|
}
|
|
3213
3436
|
}, undefined);
|
|
3214
|
-
i.
|
|
3437
|
+
i.le &= ~CONFIG_AUTO_DISPOSE;
|
|
3215
3438
|
}
|
|
3216
3439
|
return { store: o, node: i };
|
|
3217
3440
|
}
|
|
@@ -3267,10 +3490,10 @@ function updatePath(e, t, n = 0) {
|
|
|
3267
3490
|
delete e[i];
|
|
3268
3491
|
} else if (i === undefined || (isWrappable(r) && isWrappable(o) && !Array.isArray(o))) {
|
|
3269
3492
|
const t = i !== undefined ? e[i] : e;
|
|
3270
|
-
const n =
|
|
3493
|
+
const n = ownEnumerableKeys(o);
|
|
3271
3494
|
for (let e = 0; e < n.length; e++) {
|
|
3272
3495
|
const i = n[e];
|
|
3273
|
-
if (isPrototypePollutionKey(i)) continue;
|
|
3496
|
+
if (typeof i === "string" && isPrototypePollutionKey(i)) continue;
|
|
3274
3497
|
const r = Object.getOwnPropertyDescriptor(o, i);
|
|
3275
3498
|
if (r.get || r.set) Object.defineProperty(t, i, r);
|
|
3276
3499
|
else t[i] = r.value;
|
|
@@ -3287,6 +3510,11 @@ const storePath = Object.assign(
|
|
|
3287
3510
|
},
|
|
3288
3511
|
{ DELETE: DELETE }
|
|
3289
3512
|
);
|
|
3513
|
+
function mergedOverlay(e) {
|
|
3514
|
+
const t = e[STORE_OVERRIDE];
|
|
3515
|
+
const n = e[STORE_OPTIMISTIC_OVERRIDE];
|
|
3516
|
+
return t && n ? { ...t, ...n } : (n ?? t);
|
|
3517
|
+
}
|
|
3290
3518
|
function snapshotImpl(e, t, n, i) {
|
|
3291
3519
|
let r, o, s, u, c, l;
|
|
3292
3520
|
if (!isWrappable(e)) return e;
|
|
@@ -3294,7 +3522,7 @@ function snapshotImpl(e, t, n, i) {
|
|
|
3294
3522
|
if (!n) n = new Map();
|
|
3295
3523
|
if ((r = e[$TARGET] || i?.get(e)?.[$TARGET])) {
|
|
3296
3524
|
if (t) trackSelf(r, $TRACK);
|
|
3297
|
-
s = r
|
|
3525
|
+
s = mergedOverlay(r);
|
|
3298
3526
|
o = Array.isArray(r[STORE_VALUE]);
|
|
3299
3527
|
n.set(
|
|
3300
3528
|
e,
|
|
@@ -3317,13 +3545,30 @@ function snapshotImpl(e, t, n, i) {
|
|
|
3317
3545
|
u[a] = c;
|
|
3318
3546
|
}
|
|
3319
3547
|
}
|
|
3548
|
+
if (u) u.length = o;
|
|
3549
|
+
} else if (!s) {
|
|
3550
|
+
const o = getKeys(e, undefined);
|
|
3551
|
+
for (let s = 0, a = o.length; s < a; s++) {
|
|
3552
|
+
const a = o[s];
|
|
3553
|
+
const f = Object.getOwnPropertyDescriptor(e, a);
|
|
3554
|
+
if (f.get) continue;
|
|
3555
|
+
l = f.value;
|
|
3556
|
+
if (t && isWrappable(l)) wrap(l, r);
|
|
3557
|
+
if ((c = snapshotImpl(l, t, n, i)) !== l || u) {
|
|
3558
|
+
if (!u) {
|
|
3559
|
+
u = Object.create(Object.getPrototypeOf(e));
|
|
3560
|
+
Object.assign(u, e);
|
|
3561
|
+
}
|
|
3562
|
+
u[a] = c;
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3320
3565
|
} else {
|
|
3321
3566
|
const o = getKeys(e, s);
|
|
3322
3567
|
for (let a = 0, f = o.length; a < f; a++) {
|
|
3323
3568
|
let f = o[a];
|
|
3324
3569
|
const E = getPropertyDescriptor(e, s, f);
|
|
3325
3570
|
if (E.get) continue;
|
|
3326
|
-
l =
|
|
3571
|
+
l = f in s ? s[f] : e[f];
|
|
3327
3572
|
if (t && isWrappable(l)) wrap(l, r);
|
|
3328
3573
|
if ((c = snapshotImpl(l, t, n, i)) !== e[f] || u) {
|
|
3329
3574
|
if (!u) {
|
|
@@ -3406,7 +3651,7 @@ function merge(...e) {
|
|
|
3406
3651
|
keys() {
|
|
3407
3652
|
const e = new Set();
|
|
3408
3653
|
for (let t = 0; t < n.length; t++) {
|
|
3409
|
-
const i =
|
|
3654
|
+
const i = ownEnumerableKeys(resolveSource(n[t]));
|
|
3410
3655
|
for (let t = 0; t < i.length; t++) e.add(i[t]);
|
|
3411
3656
|
}
|
|
3412
3657
|
return [...e];
|
|
@@ -3458,7 +3703,7 @@ function omit(e, ...t) {
|
|
|
3458
3703
|
return !t.includes(n) && n in e;
|
|
3459
3704
|
},
|
|
3460
3705
|
keys() {
|
|
3461
|
-
return
|
|
3706
|
+
return ownEnumerableKeys(e).filter(e => !t.includes(e));
|
|
3462
3707
|
}
|
|
3463
3708
|
},
|
|
3464
3709
|
propTraps
|
|
@@ -3482,74 +3727,74 @@ function mapArray(e, t, n) {
|
|
|
3482
3727
|
const r = t.length > 1;
|
|
3483
3728
|
const o = t;
|
|
3484
3729
|
const s = {
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
ze: [],
|
|
3489
|
-
Xe: o,
|
|
3490
|
-
Je: [],
|
|
3730
|
+
ze: createOwner(),
|
|
3731
|
+
Xe: 0,
|
|
3732
|
+
Je: e,
|
|
3491
3733
|
et: [],
|
|
3492
|
-
tt:
|
|
3493
|
-
nt:
|
|
3494
|
-
it:
|
|
3495
|
-
rt:
|
|
3496
|
-
ot: n?.
|
|
3734
|
+
tt: o,
|
|
3735
|
+
nt: [],
|
|
3736
|
+
it: [],
|
|
3737
|
+
rt: i,
|
|
3738
|
+
ot: i || n?.keyed === false ? [] : undefined,
|
|
3739
|
+
st: r && n?.keyed !== false ? [] : undefined,
|
|
3740
|
+
ut: n?.keyed === false,
|
|
3741
|
+
ct: n?.fallback
|
|
3497
3742
|
};
|
|
3498
3743
|
const u = computed(updateKeyedMap.bind(s));
|
|
3499
|
-
s.
|
|
3500
|
-
u.
|
|
3744
|
+
s.ze.Ae = u;
|
|
3745
|
+
u.le &= ~CONFIG_AUTO_DISPOSE;
|
|
3501
3746
|
return accessor(u);
|
|
3502
3747
|
}
|
|
3503
3748
|
const pureOptions = { ownedWrite: true };
|
|
3504
3749
|
function updateKeyedMap() {
|
|
3505
|
-
const e = this.
|
|
3750
|
+
const e = this.Je() || [],
|
|
3506
3751
|
t = e.length;
|
|
3507
3752
|
e[$TRACK];
|
|
3508
|
-
runWithOwner(this.
|
|
3753
|
+
runWithOwner(this.ze, () => {
|
|
3509
3754
|
let n,
|
|
3510
3755
|
i,
|
|
3511
|
-
r = this.
|
|
3512
|
-
? this.
|
|
3756
|
+
r = this.ot
|
|
3757
|
+
? this.ut
|
|
3513
3758
|
? () => {
|
|
3514
|
-
this.
|
|
3515
|
-
return this.
|
|
3759
|
+
this.ot[i] = signal(e[i], pureOptions);
|
|
3760
|
+
return this.tt(accessor(this.ot[i]), i);
|
|
3516
3761
|
}
|
|
3517
3762
|
: () => {
|
|
3518
|
-
this.
|
|
3519
|
-
this.
|
|
3520
|
-
return this.
|
|
3763
|
+
this.ot[i] = signal(e[i], pureOptions);
|
|
3764
|
+
this.st && (this.st[i] = signal(i, pureOptions));
|
|
3765
|
+
return this.tt(accessor(this.ot[i]), this.st ? accessor(this.st[i]) : undefined);
|
|
3521
3766
|
}
|
|
3522
|
-
: this.
|
|
3767
|
+
: this.st
|
|
3523
3768
|
? () => {
|
|
3524
3769
|
const t = e[i];
|
|
3525
|
-
this.
|
|
3526
|
-
return this.
|
|
3770
|
+
this.st[i] = signal(i, pureOptions);
|
|
3771
|
+
return this.tt(t, accessor(this.st[i]));
|
|
3527
3772
|
}
|
|
3528
3773
|
: () => {
|
|
3529
3774
|
const t = e[i];
|
|
3530
|
-
return this.
|
|
3775
|
+
return this.tt(t);
|
|
3531
3776
|
};
|
|
3532
3777
|
if (t === 0) {
|
|
3533
|
-
if (this.
|
|
3534
|
-
this.
|
|
3778
|
+
if (this.Xe !== 0) {
|
|
3779
|
+
this.ze.dispose(false);
|
|
3780
|
+
this.it = [];
|
|
3535
3781
|
this.et = [];
|
|
3536
|
-
this.
|
|
3537
|
-
this.
|
|
3538
|
-
this.
|
|
3539
|
-
this.
|
|
3540
|
-
this.it && (this.it = []);
|
|
3782
|
+
this.nt = [];
|
|
3783
|
+
this.Xe = 0;
|
|
3784
|
+
this.ot && (this.ot = []);
|
|
3785
|
+
this.st && (this.st = []);
|
|
3541
3786
|
}
|
|
3542
|
-
if (this.
|
|
3543
|
-
this.
|
|
3787
|
+
if (this.ct && !this.nt[0]) {
|
|
3788
|
+
this.nt[0] = runWithOwner((this.it[0] = createOwner()), this.ct);
|
|
3544
3789
|
}
|
|
3545
|
-
} else if (this.
|
|
3546
|
-
if (this.
|
|
3547
|
-
this.
|
|
3790
|
+
} else if (this.Xe === 0) {
|
|
3791
|
+
if (this.it[0]) this.it[0].dispose();
|
|
3792
|
+
this.nt = new Array(t);
|
|
3548
3793
|
for (i = 0; i < t; i++) {
|
|
3549
|
-
this.
|
|
3550
|
-
this.
|
|
3794
|
+
this.et[i] = e[i];
|
|
3795
|
+
this.nt[i] = runWithOwner((this.it[i] = createOwner()), r);
|
|
3551
3796
|
}
|
|
3552
|
-
this.
|
|
3797
|
+
this.Xe = t;
|
|
3553
3798
|
} else {
|
|
3554
3799
|
let o,
|
|
3555
3800
|
s,
|
|
@@ -3559,151 +3804,166 @@ function updateKeyedMap() {
|
|
|
3559
3804
|
a,
|
|
3560
3805
|
f,
|
|
3561
3806
|
E = new Array(t),
|
|
3562
|
-
|
|
3563
|
-
S = this.
|
|
3564
|
-
|
|
3807
|
+
d = new Array(t),
|
|
3808
|
+
S = this.ot ? new Array(t) : undefined,
|
|
3809
|
+
T = this.st ? new Array(t) : undefined;
|
|
3565
3810
|
for (
|
|
3566
|
-
o = 0, s = Math.min(this.
|
|
3567
|
-
o < s && (this.
|
|
3811
|
+
o = 0, s = Math.min(this.Xe, t);
|
|
3812
|
+
o < s && (this.et[o] === e[o] || (this.ot && compare(this.rt, this.et[o], e[o])));
|
|
3568
3813
|
o++
|
|
3569
3814
|
) {
|
|
3570
|
-
if (this.
|
|
3815
|
+
if (this.ot) setSignal(this.ot[o], e[o]);
|
|
3571
3816
|
}
|
|
3572
3817
|
for (
|
|
3573
|
-
s = this.
|
|
3818
|
+
s = this.Xe - 1, u = t - 1;
|
|
3574
3819
|
s >= o &&
|
|
3575
3820
|
u >= o &&
|
|
3576
|
-
(this.
|
|
3821
|
+
(this.et[s] === e[u] || (this.ot && compare(this.rt, this.et[s], e[u])));
|
|
3577
3822
|
s--, u--
|
|
3578
3823
|
) {
|
|
3579
|
-
E[u] = this.
|
|
3580
|
-
|
|
3581
|
-
S && (S[u] = this.
|
|
3582
|
-
|
|
3824
|
+
E[u] = this.nt[s];
|
|
3825
|
+
d[u] = this.it[s];
|
|
3826
|
+
S && (S[u] = this.ot[s]);
|
|
3827
|
+
T && (T[u] = this.st[s]);
|
|
3583
3828
|
}
|
|
3584
3829
|
a = new Map();
|
|
3585
3830
|
f = new Array(u + 1);
|
|
3586
3831
|
for (i = u; i >= o; i--) {
|
|
3587
3832
|
c = e[i];
|
|
3588
|
-
l = this.
|
|
3833
|
+
l = this.rt ? this.rt(c) : c;
|
|
3589
3834
|
n = a.get(l);
|
|
3590
3835
|
f[i] = n === undefined ? -1 : n;
|
|
3591
3836
|
a.set(l, i);
|
|
3592
3837
|
}
|
|
3593
3838
|
for (n = o; n <= s; n++) {
|
|
3594
|
-
c = this.
|
|
3595
|
-
l = this.
|
|
3839
|
+
c = this.et[n];
|
|
3840
|
+
l = this.rt ? this.rt(c) : c;
|
|
3596
3841
|
i = a.get(l);
|
|
3597
3842
|
if (i !== undefined && i !== -1) {
|
|
3598
|
-
E[i] = this.
|
|
3599
|
-
|
|
3600
|
-
S && (S[i] = this.
|
|
3601
|
-
|
|
3843
|
+
E[i] = this.nt[n];
|
|
3844
|
+
d[i] = this.it[n];
|
|
3845
|
+
S && (S[i] = this.ot[n]);
|
|
3846
|
+
T && (T[i] = this.st[n]);
|
|
3602
3847
|
i = f[i];
|
|
3603
3848
|
a.set(l, i);
|
|
3604
|
-
} else this.
|
|
3849
|
+
} else this.it[n].dispose();
|
|
3605
3850
|
}
|
|
3606
3851
|
for (i = o; i < t; i++) {
|
|
3607
3852
|
if (i in E) {
|
|
3608
|
-
this.
|
|
3609
|
-
this.
|
|
3853
|
+
this.nt[i] = E[i];
|
|
3854
|
+
this.it[i] = d[i];
|
|
3610
3855
|
if (S) {
|
|
3611
|
-
this.
|
|
3612
|
-
setSignal(this.
|
|
3856
|
+
this.ot[i] = S[i];
|
|
3857
|
+
setSignal(this.ot[i], e[i]);
|
|
3613
3858
|
}
|
|
3614
|
-
if (
|
|
3615
|
-
this.
|
|
3616
|
-
setSignal(this.
|
|
3859
|
+
if (T) {
|
|
3860
|
+
this.st[i] = T[i];
|
|
3861
|
+
setSignal(this.st[i], i);
|
|
3617
3862
|
}
|
|
3618
3863
|
} else {
|
|
3619
|
-
this.
|
|
3864
|
+
this.nt[i] = runWithOwner((this.it[i] = createOwner()), r);
|
|
3620
3865
|
}
|
|
3621
3866
|
}
|
|
3622
|
-
this.
|
|
3623
|
-
this.
|
|
3867
|
+
this.nt = this.nt.slice(0, (this.Xe = t));
|
|
3868
|
+
this.et = e.slice(0);
|
|
3624
3869
|
}
|
|
3625
3870
|
});
|
|
3626
|
-
return this.
|
|
3871
|
+
return this.nt;
|
|
3627
3872
|
}
|
|
3628
3873
|
function repeat(e, t, n) {
|
|
3629
3874
|
const i = t;
|
|
3630
3875
|
const r = computed(
|
|
3631
3876
|
updateRepeat.bind({
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3877
|
+
ze: createOwner(),
|
|
3878
|
+
Xe: 0,
|
|
3879
|
+
lt: 0,
|
|
3880
|
+
ft: e,
|
|
3881
|
+
tt: i,
|
|
3882
|
+
it: [],
|
|
3883
|
+
nt: [],
|
|
3884
|
+
Et: n?.from,
|
|
3885
|
+
ct: n?.fallback
|
|
3641
3886
|
})
|
|
3642
3887
|
);
|
|
3643
|
-
r.
|
|
3888
|
+
r.le &= ~CONFIG_AUTO_DISPOSE;
|
|
3644
3889
|
return accessor(r);
|
|
3645
3890
|
}
|
|
3646
3891
|
function updateRepeat() {
|
|
3647
|
-
const e = this.
|
|
3648
|
-
const t = this.
|
|
3649
|
-
runWithOwner(this.
|
|
3892
|
+
const e = this.ft();
|
|
3893
|
+
const t = this.Et?.() || 0;
|
|
3894
|
+
runWithOwner(this.ze, () => {
|
|
3650
3895
|
if (e === 0) {
|
|
3651
|
-
if (this.
|
|
3652
|
-
this.
|
|
3653
|
-
this.
|
|
3654
|
-
this.
|
|
3655
|
-
this.
|
|
3656
|
-
this.
|
|
3896
|
+
if (this.Xe !== 0) {
|
|
3897
|
+
this.ze.dispose(false);
|
|
3898
|
+
this.it = [];
|
|
3899
|
+
this.nt = [];
|
|
3900
|
+
this.Xe = 0;
|
|
3901
|
+
this.lt = 0;
|
|
3657
3902
|
}
|
|
3658
|
-
if (this.
|
|
3659
|
-
this.
|
|
3903
|
+
if (this.ct && !this.nt[0]) {
|
|
3904
|
+
this.nt[0] = runWithOwner((this.it[0] = createOwner()), this.ct);
|
|
3660
3905
|
}
|
|
3661
3906
|
return;
|
|
3662
3907
|
}
|
|
3663
3908
|
const n = t + e;
|
|
3664
|
-
const i = this.
|
|
3665
|
-
if (this.
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3909
|
+
const i = this.lt + this.Xe;
|
|
3910
|
+
if (this.Xe === 0 && this.it[0]) this.it[0].dispose();
|
|
3911
|
+
if (t >= i || n <= this.lt) {
|
|
3912
|
+
for (let e = 0; e < this.Xe; e++) this.it[e].dispose();
|
|
3913
|
+
this.it = new Array(e);
|
|
3914
|
+
this.nt = new Array(e);
|
|
3915
|
+
for (let n = 0; n < e; n++)
|
|
3916
|
+
this.nt[n] = runWithOwner((this.it[n] = createOwner()), () => this.tt(t + n));
|
|
3917
|
+
this.lt = t;
|
|
3918
|
+
this.Xe = e;
|
|
3919
|
+
return;
|
|
3920
|
+
}
|
|
3921
|
+
for (let e = n; e < i; e++) this.it[e - this.lt].dispose();
|
|
3922
|
+
if (this.lt < t) {
|
|
3923
|
+
const e = t - this.lt;
|
|
3924
|
+
for (let t = 0; t < e && t < this.Xe; t++) this.it[t].dispose();
|
|
3925
|
+
this.it.splice(0, e);
|
|
3926
|
+
this.nt.splice(0, e);
|
|
3927
|
+
} else if (this.lt > t) {
|
|
3928
|
+
let n = i - this.lt - 1;
|
|
3929
|
+
let r = this.lt - t;
|
|
3930
|
+
this.it.length = this.nt.length = e;
|
|
3676
3931
|
while (n >= r) {
|
|
3677
|
-
this.
|
|
3678
|
-
this.
|
|
3932
|
+
this.it[n] = this.it[n - r];
|
|
3933
|
+
this.nt[n] = this.nt[n - r];
|
|
3679
3934
|
n--;
|
|
3680
3935
|
}
|
|
3681
3936
|
for (let e = 0; e < r; e++) {
|
|
3682
|
-
this.
|
|
3937
|
+
this.nt[e] = runWithOwner((this.it[e] = createOwner()), () => this.tt(e + t));
|
|
3683
3938
|
}
|
|
3684
3939
|
}
|
|
3685
3940
|
for (let e = i; e < n; e++) {
|
|
3686
|
-
this.
|
|
3941
|
+
this.nt[e - t] = runWithOwner((this.it[e - t] = createOwner()), () => this.tt(e));
|
|
3687
3942
|
}
|
|
3688
|
-
this.
|
|
3689
|
-
this.
|
|
3690
|
-
this.
|
|
3943
|
+
this.nt = this.nt.slice(0, e);
|
|
3944
|
+
this.lt = t;
|
|
3945
|
+
this.Xe = e;
|
|
3691
3946
|
});
|
|
3692
|
-
return this.
|
|
3947
|
+
return this.nt;
|
|
3693
3948
|
}
|
|
3694
3949
|
function compare(e, t, n) {
|
|
3695
3950
|
return e ? e(t) === e(n) : true;
|
|
3696
3951
|
}
|
|
3697
3952
|
function boundaryComputed(e, t) {
|
|
3698
3953
|
const n = computed(e, { lazy: true });
|
|
3699
|
-
n.
|
|
3700
|
-
const i = e !== undefined ? e : n.
|
|
3701
|
-
const r = t !== undefined ? t : n.
|
|
3702
|
-
n.
|
|
3703
|
-
n.F.notify(n,
|
|
3954
|
+
n.Qe = (e, t) => {
|
|
3955
|
+
const i = e !== undefined ? e : n.Y;
|
|
3956
|
+
const r = t !== undefined ? t : n.ae;
|
|
3957
|
+
n.Y &= ~n.dt;
|
|
3958
|
+
n.F.notify(n, STATUS_PENDING | STATUS_ERROR, i, r);
|
|
3959
|
+
const o = i & ~n.dt & (STATUS_PENDING | STATUS_ERROR);
|
|
3960
|
+
if (o) {
|
|
3961
|
+
n.Y &= ~o;
|
|
3962
|
+
if (n.ae === r && !(n.Y & (STATUS_PENDING | STATUS_ERROR))) n.ae = undefined;
|
|
3963
|
+
}
|
|
3704
3964
|
};
|
|
3705
|
-
n.
|
|
3706
|
-
n.
|
|
3965
|
+
n.dt = t;
|
|
3966
|
+
n.le &= ~CONFIG_AUTO_DISPOSE;
|
|
3707
3967
|
recompute(n, true);
|
|
3708
3968
|
return n;
|
|
3709
3969
|
}
|
|
@@ -3725,52 +3985,52 @@ function isRevealController(e) {
|
|
|
3725
3985
|
return e instanceof RevealController;
|
|
3726
3986
|
}
|
|
3727
3987
|
function isSlotReady(e) {
|
|
3728
|
-
return isRevealController(e) ? e.isReady() : e.
|
|
3988
|
+
return isRevealController(e) ? e.isReady() : e.St.size === 0 && !e.Tt;
|
|
3729
3989
|
}
|
|
3730
3990
|
function isSlotMinimallyReady(e) {
|
|
3731
3991
|
return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
|
|
3732
3992
|
}
|
|
3733
3993
|
function setSlotState(e, t, n, i) {
|
|
3734
|
-
setSignal(e.
|
|
3735
|
-
setSignal(e.
|
|
3994
|
+
setSignal(e._t, n);
|
|
3995
|
+
setSignal(e.Ot, i);
|
|
3736
3996
|
if (isRevealController(e)) {
|
|
3737
|
-
if (!n && e.
|
|
3997
|
+
if (!n && e.Rt === t) e.Rt = undefined;
|
|
3738
3998
|
return e.evaluate(n, i);
|
|
3739
3999
|
}
|
|
3740
|
-
if (!n && e.
|
|
4000
|
+
if (!n && e.It === t && e.ht) e.It = undefined;
|
|
3741
4001
|
}
|
|
3742
4002
|
class RevealController {
|
|
4003
|
+
At;
|
|
4004
|
+
Nt;
|
|
4005
|
+
Ct = [];
|
|
3743
4006
|
Rt;
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
Nt = true;
|
|
3750
|
-
At = true;
|
|
3751
|
-
Pt = false;
|
|
4007
|
+
_t = signal(false, { ownedWrite: true, Ke: true });
|
|
4008
|
+
Ot = signal(false, { ownedWrite: true, Ke: true });
|
|
4009
|
+
yt = true;
|
|
4010
|
+
Pt = true;
|
|
4011
|
+
gt = false;
|
|
3752
4012
|
constructor(e, t) {
|
|
3753
|
-
this.
|
|
3754
|
-
this.
|
|
4013
|
+
this.At = e;
|
|
4014
|
+
this.Nt = t;
|
|
3755
4015
|
}
|
|
3756
|
-
|
|
3757
|
-
for (let t = 0; t < this.
|
|
3758
|
-
const n = this.
|
|
3759
|
-
if ((isRevealController(n) ? n.
|
|
4016
|
+
Dt(e) {
|
|
4017
|
+
for (let t = 0; t < this.Ct.length; t++) {
|
|
4018
|
+
const n = this.Ct[t];
|
|
4019
|
+
if ((isRevealController(n) ? n.Rt : n.It) !== this) continue;
|
|
3760
4020
|
if (e(n) === false) return false;
|
|
3761
4021
|
}
|
|
3762
4022
|
return true;
|
|
3763
4023
|
}
|
|
3764
4024
|
isReady() {
|
|
3765
|
-
return this.
|
|
4025
|
+
return this.Dt(isSlotReady);
|
|
3766
4026
|
}
|
|
3767
4027
|
isMinimallyReady() {
|
|
3768
|
-
const e = untrack(this.
|
|
4028
|
+
const e = untrack(this.At);
|
|
3769
4029
|
if (e === "together") return this.isReady();
|
|
3770
4030
|
if (e === "natural") {
|
|
3771
4031
|
let e = false;
|
|
3772
4032
|
let t = false;
|
|
3773
|
-
this.
|
|
4033
|
+
this.Dt(n => {
|
|
3774
4034
|
e = true;
|
|
3775
4035
|
if (isSlotMinimallyReady(n)) {
|
|
3776
4036
|
t = true;
|
|
@@ -3780,58 +4040,58 @@ class RevealController {
|
|
|
3780
4040
|
return !e || t;
|
|
3781
4041
|
}
|
|
3782
4042
|
let t = true;
|
|
3783
|
-
this.
|
|
4043
|
+
this.Dt(e => {
|
|
3784
4044
|
t = isSlotMinimallyReady(e);
|
|
3785
4045
|
return false;
|
|
3786
4046
|
});
|
|
3787
4047
|
return t;
|
|
3788
4048
|
}
|
|
3789
4049
|
register(e) {
|
|
3790
|
-
if (this.
|
|
3791
|
-
this.
|
|
3792
|
-
const t = untrack(this.
|
|
3793
|
-
(setSignal(e.
|
|
4050
|
+
if (this.Ct.includes(e)) return;
|
|
4051
|
+
this.Ct.push(e);
|
|
4052
|
+
const t = untrack(this.At);
|
|
4053
|
+
(setSignal(e._t, true), setSignal(e.Ot, t === "sequential" ? !!untrack(this.Nt) : false));
|
|
3794
4054
|
untrack(() => this.evaluate());
|
|
3795
4055
|
}
|
|
3796
4056
|
unregister(e) {
|
|
3797
|
-
const t = this.
|
|
3798
|
-
if (t >= 0) this.
|
|
4057
|
+
const t = this.Ct.indexOf(e);
|
|
4058
|
+
if (t >= 0) this.Ct.splice(t, 1);
|
|
3799
4059
|
untrack(() => this.evaluate());
|
|
3800
4060
|
}
|
|
3801
4061
|
evaluate(e, t) {
|
|
3802
|
-
if (this.
|
|
3803
|
-
this.
|
|
3804
|
-
const n = this.
|
|
3805
|
-
const i = this.
|
|
4062
|
+
if (this.gt) return;
|
|
4063
|
+
this.gt = true;
|
|
4064
|
+
const n = this.yt;
|
|
4065
|
+
const i = this.Pt;
|
|
3806
4066
|
try {
|
|
3807
|
-
const n = e ?? read(this.
|
|
3808
|
-
i = untrack(this.
|
|
3809
|
-
r = i === "sequential" && !!untrack(this.
|
|
4067
|
+
const n = e ?? read(this._t),
|
|
4068
|
+
i = untrack(this.At),
|
|
4069
|
+
r = i === "sequential" && !!untrack(this.Nt),
|
|
3810
4070
|
o = t ?? r;
|
|
3811
4071
|
if (n) {
|
|
3812
|
-
this.
|
|
4072
|
+
this.Dt(e => setSlotState(e, this, true, o));
|
|
3813
4073
|
} else if (i === "natural") {
|
|
3814
|
-
this.
|
|
4074
|
+
this.Dt(e => {
|
|
3815
4075
|
if (isRevealController(e)) {
|
|
3816
|
-
setSignal(e.
|
|
3817
|
-
setSignal(e.
|
|
4076
|
+
setSignal(e.Ot, false);
|
|
4077
|
+
setSignal(e._t, false);
|
|
3818
4078
|
e.evaluate(false, false);
|
|
3819
4079
|
} else {
|
|
3820
4080
|
setSlotState(e, this, !isSlotReady(e), false);
|
|
3821
4081
|
}
|
|
3822
4082
|
});
|
|
3823
4083
|
} else if (i === "together") {
|
|
3824
|
-
const e = this.
|
|
3825
|
-
this.
|
|
4084
|
+
const e = this.Dt(isSlotMinimallyReady);
|
|
4085
|
+
this.Dt(t => setSlotState(t, this, !e, false));
|
|
3826
4086
|
} else {
|
|
3827
4087
|
let e = false;
|
|
3828
|
-
this.
|
|
4088
|
+
this.Dt(t => {
|
|
3829
4089
|
if (e) return setSlotState(t, this, true, r);
|
|
3830
4090
|
if (isSlotReady(t)) return setSlotState(t, this, false, false);
|
|
3831
4091
|
e = true;
|
|
3832
4092
|
if (isRevealController(t)) {
|
|
3833
|
-
setSignal(t.
|
|
3834
|
-
setSignal(t.
|
|
4093
|
+
setSignal(t.Ot, false);
|
|
4094
|
+
setSignal(t._t, false);
|
|
3835
4095
|
t.evaluate(false, false);
|
|
3836
4096
|
} else {
|
|
3837
4097
|
setSlotState(t, this, true, false);
|
|
@@ -3839,101 +4099,101 @@ class RevealController {
|
|
|
3839
4099
|
});
|
|
3840
4100
|
}
|
|
3841
4101
|
} finally {
|
|
3842
|
-
this.
|
|
3843
|
-
this.
|
|
3844
|
-
this.
|
|
4102
|
+
this.yt = this.isReady();
|
|
4103
|
+
this.Pt = this.isMinimallyReady();
|
|
4104
|
+
this.gt = false;
|
|
3845
4105
|
}
|
|
3846
|
-
if (this.
|
|
4106
|
+
if (this.Rt && (n !== this.yt || i !== this.Pt)) this.Rt.evaluate();
|
|
3847
4107
|
}
|
|
3848
4108
|
}
|
|
3849
4109
|
class CollectionQueue extends Queue {
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
4110
|
+
bt;
|
|
4111
|
+
St = new Set();
|
|
4112
|
+
vt;
|
|
4113
|
+
Tt = true;
|
|
4114
|
+
_t = signal(false, { ownedWrite: true, Ke: true });
|
|
4115
|
+
ae;
|
|
4116
|
+
Ot = signal(false, { ownedWrite: true, Ke: true });
|
|
4117
|
+
It;
|
|
4118
|
+
ht = false;
|
|
4119
|
+
wt;
|
|
4120
|
+
Lt = ON_INIT;
|
|
3861
4121
|
constructor(e) {
|
|
3862
4122
|
super();
|
|
3863
|
-
this.
|
|
4123
|
+
this.bt = e;
|
|
3864
4124
|
}
|
|
3865
4125
|
run(e) {
|
|
3866
|
-
if (!e || (read(this.
|
|
4126
|
+
if (!e || (read(this._t) && (!_revealUsed || read(this.Ot)))) return;
|
|
3867
4127
|
return super.run(e);
|
|
3868
4128
|
}
|
|
3869
4129
|
notify(e, t, n, i) {
|
|
3870
|
-
if (!(t & this.
|
|
3871
|
-
if (this.
|
|
4130
|
+
if (!(t & this.bt)) return super.notify(e, t, n, i);
|
|
4131
|
+
if (this.ht && this.wt) {
|
|
3872
4132
|
const e = untrack(() => {
|
|
3873
4133
|
try {
|
|
3874
|
-
return this.
|
|
4134
|
+
return this.wt();
|
|
3875
4135
|
} catch {
|
|
3876
4136
|
return ON_INIT;
|
|
3877
4137
|
}
|
|
3878
4138
|
});
|
|
3879
|
-
if (e !== this.
|
|
3880
|
-
this.
|
|
3881
|
-
this.
|
|
3882
|
-
this.
|
|
4139
|
+
if (e !== this.Lt) {
|
|
4140
|
+
this.Lt = e;
|
|
4141
|
+
this.ht = false;
|
|
4142
|
+
this.St.clear();
|
|
3883
4143
|
}
|
|
3884
4144
|
}
|
|
3885
|
-
if (this.
|
|
3886
|
-
if (this.gt & STATUS_PENDING && n & STATUS_ERROR) {
|
|
4145
|
+
if (this.bt & STATUS_PENDING && n & STATUS_ERROR) {
|
|
3887
4146
|
return super.notify(e, STATUS_ERROR, n, i);
|
|
3888
4147
|
}
|
|
3889
|
-
if (
|
|
3890
|
-
|
|
3891
|
-
|
|
4148
|
+
if (this.bt & STATUS_PENDING && this.ht) return super.notify(e, t, n, i);
|
|
4149
|
+
if (n & this.bt) {
|
|
4150
|
+
this.Tt = true;
|
|
4151
|
+
const t = i?.source || e.ae?.source;
|
|
3892
4152
|
if (t) {
|
|
3893
|
-
const e = this.
|
|
3894
|
-
this.
|
|
3895
|
-
if (e) setSignal(this.
|
|
3896
|
-
if (this.
|
|
3897
|
-
setSignal(this.
|
|
4153
|
+
const e = this.St.size === 0;
|
|
4154
|
+
this.St.add(t);
|
|
4155
|
+
if (e) setSignal(this._t, true);
|
|
4156
|
+
if (this.bt & STATUS_ERROR) {
|
|
4157
|
+
setSignal(this.ae, t.ae?.cause ?? t.ae);
|
|
3898
4158
|
}
|
|
3899
4159
|
}
|
|
3900
4160
|
}
|
|
3901
|
-
t &= ~this.
|
|
4161
|
+
t &= ~this.bt;
|
|
3902
4162
|
return t ? super.notify(e, t, n, i) : true;
|
|
3903
4163
|
}
|
|
3904
4164
|
checkSources() {
|
|
3905
|
-
for (const e of this.
|
|
4165
|
+
for (const e of this.St) {
|
|
3906
4166
|
if (
|
|
3907
|
-
e.
|
|
3908
|
-
(!(e.
|
|
4167
|
+
e.W & REACTIVE_DISPOSED ||
|
|
4168
|
+
(!(e.Y & this.bt) && !(this.bt & STATUS_ERROR && e.Y & STATUS_PENDING))
|
|
3909
4169
|
)
|
|
3910
|
-
this.
|
|
4170
|
+
this.St.delete(e);
|
|
3911
4171
|
}
|
|
3912
|
-
if (!this.
|
|
3913
|
-
if (this.
|
|
3914
|
-
this.
|
|
4172
|
+
if (!this.St.size) {
|
|
4173
|
+
if (this.bt & STATUS_PENDING && this.Tt && !this.ht && this.vt) {
|
|
4174
|
+
this.Tt = !!(this.vt.Y & this.bt);
|
|
3915
4175
|
} else {
|
|
3916
|
-
this.
|
|
4176
|
+
this.Tt = false;
|
|
3917
4177
|
}
|
|
3918
|
-
if (!this.
|
|
3919
|
-
setSignal(this.
|
|
3920
|
-
if (this.
|
|
4178
|
+
if (!this.Tt) {
|
|
4179
|
+
setSignal(this._t, false);
|
|
4180
|
+
if (this.wt) {
|
|
3921
4181
|
try {
|
|
3922
|
-
this.
|
|
4182
|
+
this.Lt = untrack(() => this.wt());
|
|
3923
4183
|
} catch {}
|
|
3924
4184
|
}
|
|
3925
4185
|
}
|
|
3926
4186
|
}
|
|
3927
|
-
if (_revealUsed) this.
|
|
4187
|
+
if (_revealUsed) this.It?.evaluate();
|
|
3928
4188
|
}
|
|
3929
4189
|
}
|
|
3930
4190
|
function createCollectionBoundary(e, t, n, i) {
|
|
3931
4191
|
const r = createOwner();
|
|
3932
4192
|
if (_revealUsed) setContext(RevealControllerContext, null, r);
|
|
3933
4193
|
const o = new CollectionQueue(e);
|
|
3934
|
-
if (e === STATUS_ERROR) o.
|
|
3935
|
-
if (i) o.
|
|
3936
|
-
const s = (o.
|
|
4194
|
+
if (e === STATUS_ERROR) o.ae = signal(undefined, { ownedWrite: true, Ke: true });
|
|
4195
|
+
if (i) o.wt = i;
|
|
4196
|
+
const s = (o.vt = createBoundChildren(r, t, o, e));
|
|
3937
4197
|
untrack(() => {
|
|
3938
4198
|
let t = false;
|
|
3939
4199
|
try {
|
|
@@ -3942,23 +4202,26 @@ function createCollectionBoundary(e, t, n, i) {
|
|
|
3942
4202
|
if (e instanceof NotReadyError) t = true;
|
|
3943
4203
|
else throw e;
|
|
3944
4204
|
}
|
|
3945
|
-
o.
|
|
4205
|
+
o.Tt = t || !!(s.Y & e) || s.ae instanceof NotReadyError;
|
|
3946
4206
|
});
|
|
3947
4207
|
const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
|
|
3948
4208
|
if (u) {
|
|
3949
|
-
o.
|
|
4209
|
+
o.It = u;
|
|
3950
4210
|
u.register(o);
|
|
3951
4211
|
cleanup(() => u.unregister(o));
|
|
3952
4212
|
}
|
|
3953
4213
|
return accessor(
|
|
3954
|
-
computed(
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
4214
|
+
computed(
|
|
4215
|
+
() => {
|
|
4216
|
+
if (!read(o._t)) {
|
|
4217
|
+
const e = read(s);
|
|
4218
|
+
if (!untrack(() => read(o._t))) return ((o.ht = true), e);
|
|
4219
|
+
}
|
|
4220
|
+
if (_revealUsed && read(o.Ot)) return undefined;
|
|
4221
|
+
return n(o);
|
|
4222
|
+
},
|
|
4223
|
+
{ Ke: true }
|
|
4224
|
+
)
|
|
3962
4225
|
);
|
|
3963
4226
|
}
|
|
3964
4227
|
function createLoadingBoundary(e, t, n) {
|
|
@@ -3966,8 +4229,8 @@ function createLoadingBoundary(e, t, n) {
|
|
|
3966
4229
|
}
|
|
3967
4230
|
function createErrorBoundary(e, t) {
|
|
3968
4231
|
return createCollectionBoundary(STATUS_ERROR, e, e =>
|
|
3969
|
-
t(accessor(e.
|
|
3970
|
-
for (const t of e.
|
|
4232
|
+
t(accessor(e.ae), () => {
|
|
4233
|
+
for (const t of e.St) recompute(t);
|
|
3971
4234
|
schedule();
|
|
3972
4235
|
})
|
|
3973
4236
|
);
|
|
@@ -3988,7 +4251,7 @@ function createRevealOrder(e, t) {
|
|
|
3988
4251
|
s.evaluate();
|
|
3989
4252
|
});
|
|
3990
4253
|
if (i) {
|
|
3991
|
-
s.
|
|
4254
|
+
s.Rt = i;
|
|
3992
4255
|
i.register(s);
|
|
3993
4256
|
cleanup(() => i.unregister(s));
|
|
3994
4257
|
}
|
|
@@ -4098,6 +4361,7 @@ export {
|
|
|
4098
4361
|
refresh,
|
|
4099
4362
|
releaseSnapshotScope,
|
|
4100
4363
|
repeat,
|
|
4364
|
+
resetErrorHalt,
|
|
4101
4365
|
resolve,
|
|
4102
4366
|
runWithOwner,
|
|
4103
4367
|
setContext,
|