@solidjs/signals 0.9.8 → 0.9.9
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 +397 -175
- package/dist/node.cjs +1158 -953
- package/dist/prod.js +955 -756
- package/dist/types/boundaries.d.ts +3 -2
- package/dist/types/core/core.d.ts +3 -2
- package/dist/types/core/error.d.ts +6 -2
- package/dist/types/core/scheduler.d.ts +66 -16
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
class NotReadyError extends Error {
|
|
2
|
-
|
|
2
|
+
t;
|
|
3
3
|
constructor(e) {
|
|
4
4
|
super();
|
|
5
|
-
this.
|
|
5
|
+
this.t = e;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
class StatusError extends Error {
|
|
9
|
+
t;
|
|
10
|
+
constructor(e, t) {
|
|
11
|
+
super(t instanceof Error ? t.message : String(t), { cause: t });
|
|
12
|
+
this.t = e;
|
|
6
13
|
}
|
|
7
14
|
}
|
|
8
15
|
class NoOwnerError extends Error {
|
|
@@ -24,7 +31,6 @@ const REACTIVE_IN_HEAP_HEIGHT = 1 << 4;
|
|
|
24
31
|
const REACTIVE_ZOMBIE = 1 << 5;
|
|
25
32
|
const REACTIVE_DISPOSED = 1 << 6;
|
|
26
33
|
const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
|
|
27
|
-
const STATUS_NONE = 0;
|
|
28
34
|
const STATUS_PENDING = 1 << 0;
|
|
29
35
|
const STATUS_ERROR = 1 << 1;
|
|
30
36
|
const STATUS_UNINITIALIZED = 1 << 2;
|
|
@@ -36,111 +42,180 @@ const SUPPORTS_PROXY = typeof Proxy === "function";
|
|
|
36
42
|
const defaultContext = {};
|
|
37
43
|
const $REFRESH = Symbol("refresh");
|
|
38
44
|
function actualInsertIntoHeap(e, t) {
|
|
39
|
-
const n = (e.i
|
|
40
|
-
if (n >= e.
|
|
41
|
-
const i = e.
|
|
42
|
-
const r = t.
|
|
43
|
-
if (r === undefined) t.
|
|
45
|
+
const n = (e.o?.i ? e.o.l?.u : e.o?.u) ?? -1;
|
|
46
|
+
if (n >= e.u) e.u = n + 1;
|
|
47
|
+
const i = e.u;
|
|
48
|
+
const r = t.T[i];
|
|
49
|
+
if (r === undefined) t.T[i] = e;
|
|
44
50
|
else {
|
|
45
|
-
const t = r.
|
|
46
|
-
t.
|
|
47
|
-
e.
|
|
48
|
-
r.
|
|
51
|
+
const t = r.R;
|
|
52
|
+
t.O = e;
|
|
53
|
+
e.R = t;
|
|
54
|
+
r.R = e;
|
|
49
55
|
}
|
|
50
|
-
if (i > t.
|
|
56
|
+
if (i > t.S) t.S = i;
|
|
51
57
|
}
|
|
52
58
|
function insertIntoHeap(e, t) {
|
|
53
|
-
let n = e.
|
|
59
|
+
let n = e._;
|
|
54
60
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
|
|
55
61
|
if (n & REACTIVE_CHECK) {
|
|
56
|
-
e.
|
|
57
|
-
} else e.
|
|
62
|
+
e._ = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
63
|
+
} else e._ = n | REACTIVE_IN_HEAP;
|
|
58
64
|
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
59
65
|
}
|
|
60
66
|
function insertIntoHeapHeight(e, t) {
|
|
61
|
-
let n = e.
|
|
67
|
+
let n = e._;
|
|
62
68
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
|
|
63
|
-
e.
|
|
69
|
+
e._ = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
64
70
|
actualInsertIntoHeap(e, t);
|
|
65
71
|
}
|
|
66
72
|
function deleteFromHeap(e, t) {
|
|
67
|
-
const n = e.
|
|
73
|
+
const n = e._;
|
|
68
74
|
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
69
|
-
e.
|
|
70
|
-
const i = e.
|
|
71
|
-
if (e.
|
|
75
|
+
e._ = n & -25;
|
|
76
|
+
const i = e.u;
|
|
77
|
+
if (e.R === e) t.T[i] = undefined;
|
|
72
78
|
else {
|
|
73
|
-
const n = e.
|
|
74
|
-
const r = t.
|
|
79
|
+
const n = e.O;
|
|
80
|
+
const r = t.T[i];
|
|
75
81
|
const o = n ?? r;
|
|
76
|
-
if (e === r) t.
|
|
77
|
-
else e.
|
|
78
|
-
o.
|
|
82
|
+
if (e === r) t.T[i] = n;
|
|
83
|
+
else e.R.O = n;
|
|
84
|
+
o.R = e.R;
|
|
79
85
|
}
|
|
80
|
-
e.
|
|
81
|
-
e.
|
|
86
|
+
e.R = e;
|
|
87
|
+
e.O = undefined;
|
|
82
88
|
}
|
|
83
89
|
function markHeap(e) {
|
|
84
|
-
if (e.
|
|
85
|
-
e.
|
|
86
|
-
for (let t = 0; t <= e.
|
|
87
|
-
for (let n = e.
|
|
88
|
-
if (n.
|
|
90
|
+
if (e.I) return;
|
|
91
|
+
e.I = true;
|
|
92
|
+
for (let t = 0; t <= e.S; t++) {
|
|
93
|
+
for (let n = e.T[t]; n !== undefined; n = n.O) {
|
|
94
|
+
if (n._ & REACTIVE_IN_HEAP) markNode(n);
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
}
|
|
92
98
|
function markNode(e, t = REACTIVE_DIRTY) {
|
|
93
|
-
const n = e.
|
|
99
|
+
const n = e._;
|
|
94
100
|
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
95
|
-
e.
|
|
96
|
-
for (let t = e.p; t !== null; t = t.
|
|
97
|
-
markNode(t.
|
|
98
|
-
}
|
|
99
|
-
if (e.
|
|
100
|
-
for (let t = e.
|
|
101
|
-
for (let e = t.p; e !== null; e = e.
|
|
102
|
-
markNode(e.
|
|
101
|
+
e._ = (n & -4) | t;
|
|
102
|
+
for (let t = e.p; t !== null; t = t.h) {
|
|
103
|
+
markNode(t.A, REACTIVE_CHECK);
|
|
104
|
+
}
|
|
105
|
+
if (e.P !== null) {
|
|
106
|
+
for (let t = e.P; t !== null; t = t.C) {
|
|
107
|
+
for (let e = t.p; e !== null; e = e.h) {
|
|
108
|
+
markNode(e.A, REACTIVE_CHECK);
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
113
|
function runHeap(e, t) {
|
|
108
|
-
e.
|
|
109
|
-
for (e.N = 0; e.N <= e.
|
|
110
|
-
let n = e.
|
|
114
|
+
e.I = false;
|
|
115
|
+
for (e.N = 0; e.N <= e.S; e.N++) {
|
|
116
|
+
let n = e.T[e.N];
|
|
111
117
|
while (n !== undefined) {
|
|
112
|
-
if (n.
|
|
118
|
+
if (n._ & REACTIVE_IN_HEAP) t(n);
|
|
113
119
|
else adjustHeight(n, e);
|
|
114
|
-
n = e.
|
|
120
|
+
n = e.T[e.N];
|
|
115
121
|
}
|
|
116
122
|
}
|
|
117
|
-
e.
|
|
123
|
+
e.S = 0;
|
|
118
124
|
}
|
|
119
125
|
function adjustHeight(e, t) {
|
|
120
126
|
deleteFromHeap(e, t);
|
|
121
|
-
let n = e.
|
|
122
|
-
for (let t = e.
|
|
127
|
+
let n = e.u;
|
|
128
|
+
for (let t = e.D; t; t = t.m) {
|
|
123
129
|
const e = t.V;
|
|
124
|
-
const i = e.
|
|
125
|
-
if (i.U && i.
|
|
130
|
+
const i = e.L || e;
|
|
131
|
+
if (i.U && i.u >= n) n = i.u + 1;
|
|
126
132
|
}
|
|
127
|
-
if (e.
|
|
128
|
-
e.
|
|
129
|
-
for (let n = e.p; n !== null; n = n.
|
|
130
|
-
insertIntoHeapHeight(n.
|
|
133
|
+
if (e.u !== n) {
|
|
134
|
+
e.u = n;
|
|
135
|
+
for (let n = e.p; n !== null; n = n.h) {
|
|
136
|
+
insertIntoHeapHeight(n.A, t);
|
|
131
137
|
}
|
|
132
138
|
}
|
|
133
139
|
}
|
|
134
140
|
const transitions = new Set();
|
|
135
|
-
const dirtyQueue = {
|
|
136
|
-
const zombieQueue = {
|
|
141
|
+
const dirtyQueue = { T: new Array(2e3).fill(undefined), I: false, N: 0, S: 0 };
|
|
142
|
+
const zombieQueue = { T: new Array(2e3).fill(undefined), I: false, N: 0, S: 0 };
|
|
137
143
|
let clock = 0;
|
|
138
144
|
let activeTransition = null;
|
|
139
145
|
let scheduled = false;
|
|
140
|
-
let optimisticReadActive = false;
|
|
141
146
|
let projectionWriteActive = false;
|
|
142
|
-
|
|
143
|
-
|
|
147
|
+
const signalLanes = new WeakMap();
|
|
148
|
+
const activeLanes = new Set();
|
|
149
|
+
let currentOptimisticLane = null;
|
|
150
|
+
function setCurrentOptimisticLane(e) {
|
|
151
|
+
currentOptimisticLane = e;
|
|
152
|
+
}
|
|
153
|
+
function getOrCreateLane(e) {
|
|
154
|
+
let t = signalLanes.get(e);
|
|
155
|
+
if (t) {
|
|
156
|
+
return findLane(t);
|
|
157
|
+
}
|
|
158
|
+
t = { t: e, k: new Set(), W: [[], []], G: null, M: activeTransition };
|
|
159
|
+
signalLanes.set(e, t);
|
|
160
|
+
activeLanes.add(t);
|
|
161
|
+
e.F = e.$ || 0;
|
|
162
|
+
return t;
|
|
163
|
+
}
|
|
164
|
+
function findLane(e) {
|
|
165
|
+
while (e.G) e = e.G;
|
|
166
|
+
return e;
|
|
167
|
+
}
|
|
168
|
+
function mergeLanes(e, t) {
|
|
169
|
+
e = findLane(e);
|
|
170
|
+
t = findLane(t);
|
|
171
|
+
if (e === t) return e;
|
|
172
|
+
t.G = e;
|
|
173
|
+
for (const n of t.k) e.k.add(n);
|
|
174
|
+
e.W[0].push(...t.W[0]);
|
|
175
|
+
e.W[1].push(...t.W[1]);
|
|
176
|
+
return e;
|
|
177
|
+
}
|
|
178
|
+
function clearLaneEntry(e) {
|
|
179
|
+
signalLanes.delete(e);
|
|
180
|
+
}
|
|
181
|
+
function resolveLane(e) {
|
|
182
|
+
const t = e.H;
|
|
183
|
+
if (!t) return undefined;
|
|
184
|
+
const n = findLane(t);
|
|
185
|
+
if (activeLanes.has(n)) return n;
|
|
186
|
+
e.H = undefined;
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
function hasActiveOverride(e) {
|
|
190
|
+
return !!(e.j && e.K !== NOT_PENDING);
|
|
191
|
+
}
|
|
192
|
+
function assignOrMergeLane(e, t) {
|
|
193
|
+
const n = findLane(t);
|
|
194
|
+
const i = e.H;
|
|
195
|
+
if (i) {
|
|
196
|
+
if (i.G) {
|
|
197
|
+
e.H = t;
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const r = findLane(i);
|
|
201
|
+
if (activeLanes.has(r)) {
|
|
202
|
+
if (r !== n && !hasActiveOverride(e)) {
|
|
203
|
+
mergeLanes(n, r);
|
|
204
|
+
}
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
e.H = t;
|
|
209
|
+
}
|
|
210
|
+
function runLaneEffects(e) {
|
|
211
|
+
for (const t of activeLanes) {
|
|
212
|
+
if (t.G || t.k.size > 0) continue;
|
|
213
|
+
const n = t.W[e - 1];
|
|
214
|
+
if (n.length) {
|
|
215
|
+
t.W[e - 1] = [];
|
|
216
|
+
runQueue(n, e);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
144
219
|
}
|
|
145
220
|
function setProjectionWriteActive(e) {
|
|
146
221
|
projectionWriteActive = e;
|
|
@@ -148,133 +223,129 @@ function setProjectionWriteActive(e) {
|
|
|
148
223
|
function schedule() {
|
|
149
224
|
if (scheduled) return;
|
|
150
225
|
scheduled = true;
|
|
151
|
-
if (!globalQueue.
|
|
226
|
+
if (!globalQueue.Y) queueMicrotask(flush);
|
|
152
227
|
}
|
|
153
228
|
class Queue {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
M = [];
|
|
229
|
+
o = null;
|
|
230
|
+
B = [[], []];
|
|
231
|
+
X = [];
|
|
158
232
|
created = clock;
|
|
159
233
|
addChild(e) {
|
|
160
|
-
this.
|
|
161
|
-
e.
|
|
234
|
+
this.X.push(e);
|
|
235
|
+
e.o = this;
|
|
162
236
|
}
|
|
163
237
|
removeChild(e) {
|
|
164
|
-
const t = this.
|
|
238
|
+
const t = this.X.indexOf(e);
|
|
165
239
|
if (t >= 0) {
|
|
166
|
-
this.
|
|
167
|
-
e.
|
|
240
|
+
this.X.splice(t, 1);
|
|
241
|
+
e.o = null;
|
|
168
242
|
}
|
|
169
243
|
}
|
|
170
|
-
notify(e, t, n) {
|
|
171
|
-
if (this.
|
|
244
|
+
notify(e, t, n, i) {
|
|
245
|
+
if (this.o) return this.o.notify(e, t, n, i);
|
|
172
246
|
return false;
|
|
173
247
|
}
|
|
174
|
-
$(e, t, n) {
|
|
175
|
-
if (t[e - 1].length) {
|
|
176
|
-
const n = t[e - 1];
|
|
177
|
-
t[e - 1] = [];
|
|
178
|
-
runQueue(n, e);
|
|
179
|
-
}
|
|
180
|
-
for (let t = 0; t < this.M.length; t++) {
|
|
181
|
-
this.M[t][n]?.(e);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
248
|
run(e) {
|
|
185
|
-
this
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
249
|
+
if (this.B[e - 1].length) {
|
|
250
|
+
const t = this.B[e - 1];
|
|
251
|
+
this.B[e - 1] = [];
|
|
252
|
+
runQueue(t, e);
|
|
253
|
+
}
|
|
254
|
+
for (let t = 0; t < this.X.length; t++) this.X[t].run?.(e);
|
|
189
255
|
}
|
|
190
256
|
enqueue(e, t) {
|
|
191
257
|
if (e) {
|
|
192
|
-
|
|
193
|
-
|
|
258
|
+
if (currentOptimisticLane) {
|
|
259
|
+
const n = findLane(currentOptimisticLane);
|
|
260
|
+
n.W[e - 1].push(t);
|
|
261
|
+
} else {
|
|
262
|
+
this.B[e - 1].push(t);
|
|
263
|
+
}
|
|
194
264
|
}
|
|
195
265
|
schedule();
|
|
196
266
|
}
|
|
197
267
|
stashQueues(e) {
|
|
198
|
-
e.
|
|
199
|
-
e.
|
|
200
|
-
this.
|
|
201
|
-
for (let t = 0; t < this.
|
|
202
|
-
let n = this.
|
|
203
|
-
let i = e.
|
|
268
|
+
e.B[0].push(...this.B[0]);
|
|
269
|
+
e.B[1].push(...this.B[1]);
|
|
270
|
+
this.B = [[], []];
|
|
271
|
+
for (let t = 0; t < this.X.length; t++) {
|
|
272
|
+
let n = this.X[t];
|
|
273
|
+
let i = e.X[t];
|
|
204
274
|
if (!i) {
|
|
205
|
-
i = {
|
|
206
|
-
e.
|
|
275
|
+
i = { B: [[], []], X: [] };
|
|
276
|
+
e.X[t] = i;
|
|
207
277
|
}
|
|
208
278
|
n.stashQueues(i);
|
|
209
279
|
}
|
|
210
280
|
}
|
|
211
281
|
restoreQueues(e) {
|
|
212
|
-
this.
|
|
213
|
-
this.
|
|
214
|
-
for (let t = 0; t < e.
|
|
215
|
-
const n = e.
|
|
216
|
-
let i = this.
|
|
282
|
+
this.B[0].push(...e.B[0]);
|
|
283
|
+
this.B[1].push(...e.B[1]);
|
|
284
|
+
for (let t = 0; t < e.X.length; t++) {
|
|
285
|
+
const n = e.X[t];
|
|
286
|
+
let i = this.X[t];
|
|
217
287
|
if (i) i.restoreQueues(n);
|
|
218
288
|
}
|
|
219
289
|
}
|
|
220
290
|
}
|
|
221
291
|
class GlobalQueue extends Queue {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
static
|
|
227
|
-
static
|
|
228
|
-
static
|
|
292
|
+
Y = false;
|
|
293
|
+
q = [];
|
|
294
|
+
Z = [];
|
|
295
|
+
J = new Set();
|
|
296
|
+
static ee;
|
|
297
|
+
static te;
|
|
298
|
+
static ne = null;
|
|
229
299
|
flush() {
|
|
230
|
-
if (this.
|
|
231
|
-
this.
|
|
300
|
+
if (this.Y) return;
|
|
301
|
+
this.Y = true;
|
|
232
302
|
try {
|
|
233
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
303
|
+
runHeap(dirtyQueue, GlobalQueue.ee);
|
|
234
304
|
if (activeTransition) {
|
|
235
305
|
const e = transitionComplete(activeTransition);
|
|
236
306
|
if (!e) {
|
|
237
307
|
let e = activeTransition;
|
|
238
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
239
|
-
this.
|
|
240
|
-
this.
|
|
241
|
-
this.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
this.stashQueues(activeTransition.
|
|
308
|
+
runHeap(zombieQueue, GlobalQueue.ee);
|
|
309
|
+
this.q = [];
|
|
310
|
+
this.Z = [];
|
|
311
|
+
this.J = new Set();
|
|
312
|
+
runLaneEffects(EFFECT_RENDER);
|
|
313
|
+
runLaneEffects(EFFECT_USER);
|
|
314
|
+
this.stashQueues(activeTransition.ie);
|
|
245
315
|
clock++;
|
|
246
|
-
scheduled =
|
|
247
|
-
|
|
316
|
+
scheduled = dirtyQueue.S >= dirtyQueue.N;
|
|
317
|
+
reassignPendingTransition(activeTransition.q);
|
|
248
318
|
activeTransition = null;
|
|
249
319
|
finalizePureQueue(null, true);
|
|
250
320
|
return;
|
|
251
321
|
}
|
|
252
|
-
this.
|
|
253
|
-
this.restoreQueues(activeTransition.
|
|
322
|
+
this.q !== activeTransition.q && this.q.push(...activeTransition.q);
|
|
323
|
+
this.restoreQueues(activeTransition.ie);
|
|
254
324
|
transitions.delete(activeTransition);
|
|
255
325
|
const t = activeTransition;
|
|
256
326
|
activeTransition = null;
|
|
257
|
-
|
|
327
|
+
reassignPendingTransition(this.q);
|
|
258
328
|
finalizePureQueue(t);
|
|
259
329
|
} else {
|
|
260
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
330
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.ee);
|
|
261
331
|
finalizePureQueue();
|
|
262
332
|
}
|
|
263
333
|
clock++;
|
|
264
|
-
scheduled = dirtyQueue.
|
|
265
|
-
|
|
334
|
+
scheduled = dirtyQueue.S >= dirtyQueue.N;
|
|
335
|
+
runLaneEffects(EFFECT_RENDER);
|
|
266
336
|
this.run(EFFECT_RENDER);
|
|
267
|
-
|
|
337
|
+
runLaneEffects(EFFECT_USER);
|
|
268
338
|
this.run(EFFECT_USER);
|
|
269
339
|
} finally {
|
|
270
|
-
this.
|
|
340
|
+
this.Y = false;
|
|
271
341
|
}
|
|
272
342
|
}
|
|
273
|
-
notify(e, t, n) {
|
|
343
|
+
notify(e, t, n, i) {
|
|
274
344
|
if (t & STATUS_PENDING) {
|
|
275
345
|
if (n & STATUS_PENDING) {
|
|
276
|
-
|
|
277
|
-
|
|
346
|
+
const t = i !== undefined ? i : e.re;
|
|
347
|
+
if (activeTransition && t && !activeTransition.oe.includes(t.t)) {
|
|
348
|
+
activeTransition.oe.push(t.t);
|
|
278
349
|
schedule();
|
|
279
350
|
}
|
|
280
351
|
}
|
|
@@ -285,106 +356,143 @@ class GlobalQueue extends Queue {
|
|
|
285
356
|
initTransition(e) {
|
|
286
357
|
if (e) e = currentTransition(e);
|
|
287
358
|
if (e && e === activeTransition) return;
|
|
288
|
-
if (!e && activeTransition && activeTransition.
|
|
359
|
+
if (!e && activeTransition && activeTransition.se === clock) return;
|
|
289
360
|
if (!activeTransition) {
|
|
290
361
|
activeTransition = e ?? {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
362
|
+
se: clock,
|
|
363
|
+
q: [],
|
|
364
|
+
oe: [],
|
|
365
|
+
Z: [],
|
|
366
|
+
J: new Set(),
|
|
367
|
+
ue: [],
|
|
368
|
+
ie: { B: [[], []], X: [] },
|
|
369
|
+
ce: false
|
|
299
370
|
};
|
|
300
371
|
} else if (e) {
|
|
301
|
-
|
|
302
|
-
e
|
|
303
|
-
|
|
372
|
+
const t = activeTransition;
|
|
373
|
+
t.ce = e;
|
|
374
|
+
e.ue.push(...t.ue);
|
|
375
|
+
for (const n of activeLanes) {
|
|
376
|
+
if (n.M === t) n.M = e;
|
|
377
|
+
}
|
|
378
|
+
e.Z.push(...t.Z);
|
|
379
|
+
for (const n of t.J) {
|
|
380
|
+
e.J.add(n);
|
|
381
|
+
}
|
|
382
|
+
transitions.delete(t);
|
|
304
383
|
activeTransition = e;
|
|
305
384
|
}
|
|
306
385
|
transitions.add(activeTransition);
|
|
307
|
-
activeTransition.
|
|
308
|
-
for (let e = 0; e < this.
|
|
309
|
-
const t = this.
|
|
310
|
-
t.
|
|
311
|
-
activeTransition.
|
|
386
|
+
activeTransition.se = clock;
|
|
387
|
+
for (let e = 0; e < this.q.length; e++) {
|
|
388
|
+
const t = this.q[e];
|
|
389
|
+
t.M = activeTransition;
|
|
390
|
+
activeTransition.q.push(t);
|
|
312
391
|
}
|
|
313
|
-
this.
|
|
314
|
-
for (let e = 0; e < this.
|
|
315
|
-
const t = this.
|
|
316
|
-
t.
|
|
317
|
-
activeTransition.
|
|
392
|
+
this.q = activeTransition.q;
|
|
393
|
+
for (let e = 0; e < this.Z.length; e++) {
|
|
394
|
+
const t = this.Z[e];
|
|
395
|
+
t.M = activeTransition;
|
|
396
|
+
activeTransition.Z.push(t);
|
|
318
397
|
}
|
|
319
|
-
this.
|
|
320
|
-
for (const e of
|
|
321
|
-
|
|
398
|
+
this.Z = activeTransition.Z;
|
|
399
|
+
for (const e of activeLanes) {
|
|
400
|
+
if (!e.M) e.M = activeTransition;
|
|
322
401
|
}
|
|
323
|
-
this.
|
|
402
|
+
for (const e of this.J) activeTransition.J.add(e);
|
|
403
|
+
this.J = activeTransition.J;
|
|
324
404
|
}
|
|
325
405
|
}
|
|
326
406
|
function insertSubs(e, t = false) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
407
|
+
const n = e.H || currentOptimisticLane;
|
|
408
|
+
for (let i = e.p; i !== null; i = i.h) {
|
|
409
|
+
if (t && n) {
|
|
410
|
+
i.A._ |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
411
|
+
assignOrMergeLane(i.A, n);
|
|
412
|
+
} else if (t) {
|
|
413
|
+
i.A._ |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
414
|
+
i.A.H = undefined;
|
|
415
|
+
}
|
|
416
|
+
const e = i.A;
|
|
417
|
+
if (e.le === EFFECT_TRACKED) {
|
|
418
|
+
if (!e.ae) {
|
|
419
|
+
e.ae = true;
|
|
420
|
+
e.fe.enqueue(EFFECT_USER, e.Ee);
|
|
334
421
|
}
|
|
335
422
|
continue;
|
|
336
423
|
}
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
339
|
-
insertIntoHeap(
|
|
424
|
+
const r = i.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
425
|
+
if (r.N > i.A.u) r.N = i.A.u;
|
|
426
|
+
insertIntoHeap(i.A, r);
|
|
340
427
|
}
|
|
341
428
|
}
|
|
342
429
|
function finalizePureQueue(e = null, t = false) {
|
|
343
430
|
let n = !t;
|
|
344
|
-
if (
|
|
345
|
-
|
|
346
|
-
}
|
|
431
|
+
if (!t) checkBoundaryChildren(globalQueue);
|
|
432
|
+
if (dirtyQueue.S >= dirtyQueue.N) runHeap(dirtyQueue, GlobalQueue.ee);
|
|
347
433
|
if (n) {
|
|
348
|
-
const t = globalQueue.
|
|
434
|
+
const t = globalQueue.q;
|
|
349
435
|
for (let e = 0; e < t.length; e++) {
|
|
350
436
|
const n = t[e];
|
|
351
|
-
if (n.
|
|
352
|
-
n.
|
|
353
|
-
n.
|
|
354
|
-
if (n.
|
|
437
|
+
if (n.K !== NOT_PENDING) {
|
|
438
|
+
n.Te = n.K;
|
|
439
|
+
n.K = NOT_PENDING;
|
|
440
|
+
if (n.le && n.le !== EFFECT_TRACKED) n.ae = true;
|
|
355
441
|
}
|
|
356
|
-
|
|
442
|
+
n.de &= ~STATUS_UNINITIALIZED;
|
|
443
|
+
if (n.U) GlobalQueue.te(n, false, true);
|
|
357
444
|
}
|
|
358
445
|
t.length = 0;
|
|
359
|
-
const n = e ? e.
|
|
446
|
+
const n = e ? e.Z : globalQueue.Z;
|
|
360
447
|
for (let e = 0; e < n.length; e++) {
|
|
361
448
|
const t = n[e];
|
|
362
|
-
const i = t.
|
|
363
|
-
|
|
364
|
-
|
|
449
|
+
const i = t.K;
|
|
450
|
+
t.H = undefined;
|
|
451
|
+
if (i !== NOT_PENDING && t.Te !== i) {
|
|
452
|
+
t.Te = i;
|
|
365
453
|
insertSubs(t, true);
|
|
366
454
|
}
|
|
367
|
-
t.
|
|
368
|
-
t.
|
|
455
|
+
t.K = NOT_PENDING;
|
|
456
|
+
t.M = null;
|
|
369
457
|
}
|
|
370
458
|
n.length = 0;
|
|
371
|
-
const i = e ? e.
|
|
372
|
-
if (GlobalQueue.
|
|
459
|
+
const i = e ? e.J : globalQueue.J;
|
|
460
|
+
if (GlobalQueue.ne && i.size) {
|
|
373
461
|
for (const e of i) {
|
|
374
|
-
GlobalQueue.
|
|
462
|
+
GlobalQueue.ne(e);
|
|
375
463
|
}
|
|
376
464
|
i.clear();
|
|
377
465
|
schedule();
|
|
378
466
|
}
|
|
467
|
+
for (const t of activeLanes) {
|
|
468
|
+
const n = e ? t.M === e : !t.M;
|
|
469
|
+
if (!n) continue;
|
|
470
|
+
if (!t.G) {
|
|
471
|
+
if (t.W[0].length) runQueue(t.W[0], EFFECT_RENDER);
|
|
472
|
+
if (t.W[1].length) runQueue(t.W[1], EFFECT_USER);
|
|
473
|
+
}
|
|
474
|
+
if (t.t.H === t) t.t.H = undefined;
|
|
475
|
+
t.k.clear();
|
|
476
|
+
t.W[0].length = 0;
|
|
477
|
+
t.W[1].length = 0;
|
|
478
|
+
activeLanes.delete(t);
|
|
479
|
+
signalLanes.delete(t.t);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
function checkBoundaryChildren(e) {
|
|
484
|
+
for (const t of e.X) {
|
|
485
|
+
t.checkSources?.();
|
|
486
|
+
checkBoundaryChildren(t);
|
|
379
487
|
}
|
|
380
488
|
}
|
|
381
489
|
function trackOptimisticStore(e) {
|
|
382
|
-
globalQueue.
|
|
490
|
+
globalQueue.J.add(e);
|
|
383
491
|
schedule();
|
|
384
492
|
}
|
|
385
|
-
function
|
|
493
|
+
function reassignPendingTransition(e) {
|
|
386
494
|
for (let t = 0; t < e.length; t++) {
|
|
387
|
-
e[t].
|
|
495
|
+
e[t].M = activeTransition;
|
|
388
496
|
}
|
|
389
497
|
}
|
|
390
498
|
const globalQueue = new GlobalQueue();
|
|
@@ -397,20 +505,20 @@ function runQueue(e, t) {
|
|
|
397
505
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
398
506
|
}
|
|
399
507
|
function transitionComplete(e) {
|
|
400
|
-
if (e.
|
|
401
|
-
if (e.
|
|
508
|
+
if (e.ce) return true;
|
|
509
|
+
if (e.ue.length) return false;
|
|
402
510
|
let t = true;
|
|
403
|
-
for (let n = 0; n < e.
|
|
404
|
-
if (e.
|
|
511
|
+
for (let n = 0; n < e.oe.length; n++) {
|
|
512
|
+
if (e.oe[n].de & STATUS_PENDING) {
|
|
405
513
|
t = false;
|
|
406
514
|
break;
|
|
407
515
|
}
|
|
408
516
|
}
|
|
409
|
-
t && (e.
|
|
517
|
+
t && (e.ce = true);
|
|
410
518
|
return t;
|
|
411
519
|
}
|
|
412
520
|
function currentTransition(e) {
|
|
413
|
-
while (e.
|
|
521
|
+
while (e.ce && typeof e.ce === "object") e = e.ce;
|
|
414
522
|
return e;
|
|
415
523
|
}
|
|
416
524
|
function runInTransition(e, t) {
|
|
@@ -434,11 +542,11 @@ function action(e) {
|
|
|
434
542
|
const r = e(...t);
|
|
435
543
|
globalQueue.initTransition();
|
|
436
544
|
let o = activeTransition;
|
|
437
|
-
o.
|
|
545
|
+
o.ue.push(r);
|
|
438
546
|
const done = (e, t) => {
|
|
439
547
|
o = currentTransition(o);
|
|
440
|
-
const s = o.
|
|
441
|
-
if (s >= 0) o.
|
|
548
|
+
const s = o.ue.indexOf(r);
|
|
549
|
+
if (s >= 0) o.ue.splice(s, 1);
|
|
442
550
|
activeTransition = o;
|
|
443
551
|
schedule();
|
|
444
552
|
t ? i(t) : n(e);
|
|
@@ -466,8 +574,8 @@ function action(e) {
|
|
|
466
574
|
step();
|
|
467
575
|
});
|
|
468
576
|
}
|
|
469
|
-
GlobalQueue.
|
|
470
|
-
GlobalQueue.
|
|
577
|
+
GlobalQueue.ee = recompute;
|
|
578
|
+
GlobalQueue.te = disposeChildren;
|
|
471
579
|
let tracking = false;
|
|
472
580
|
let stale = false;
|
|
473
581
|
let refreshing = false;
|
|
@@ -476,105 +584,145 @@ let foundPending = false;
|
|
|
476
584
|
let pendingReadActive = false;
|
|
477
585
|
let context = null;
|
|
478
586
|
function recompute(e, t = false) {
|
|
479
|
-
const n = e.
|
|
587
|
+
const n = e.le;
|
|
480
588
|
if (!t) {
|
|
481
|
-
if (e.
|
|
482
|
-
globalQueue.initTransition(e.
|
|
483
|
-
deleteFromHeap(e, e.
|
|
484
|
-
if (e.
|
|
589
|
+
if (e.M && (!n || activeTransition) && activeTransition !== e.M)
|
|
590
|
+
globalQueue.initTransition(e.M);
|
|
591
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
592
|
+
if (e.M || n === EFFECT_TRACKED) disposeChildren(e);
|
|
485
593
|
else {
|
|
486
594
|
markDisposal(e);
|
|
487
|
-
e.
|
|
488
|
-
e.
|
|
489
|
-
e.
|
|
490
|
-
e.
|
|
595
|
+
e.Re = e.Oe;
|
|
596
|
+
e.Se = e._e;
|
|
597
|
+
e.Oe = null;
|
|
598
|
+
e._e = null;
|
|
491
599
|
}
|
|
492
600
|
}
|
|
493
|
-
const i = !!(e.
|
|
494
|
-
const r = e
|
|
495
|
-
const o =
|
|
601
|
+
const i = !!(e._ & REACTIVE_OPTIMISTIC_DIRTY);
|
|
602
|
+
const r = hasActiveOverride(e);
|
|
603
|
+
const o = !!(e.de & STATUS_PENDING);
|
|
604
|
+
const s = context;
|
|
496
605
|
context = e;
|
|
497
|
-
e.
|
|
498
|
-
e.
|
|
499
|
-
e.
|
|
500
|
-
let
|
|
501
|
-
let
|
|
606
|
+
e.Ie = null;
|
|
607
|
+
e._ = REACTIVE_RECOMPUTING_DEPS;
|
|
608
|
+
e.se = clock;
|
|
609
|
+
let u = e.K === NOT_PENDING ? e.Te : e.K;
|
|
610
|
+
let c = e.u;
|
|
502
611
|
let l = tracking;
|
|
503
|
-
let
|
|
612
|
+
let a = currentOptimisticLane;
|
|
504
613
|
tracking = true;
|
|
505
|
-
if (i)
|
|
614
|
+
if (i) {
|
|
615
|
+
const t = resolveLane(e);
|
|
616
|
+
if (t) setCurrentOptimisticLane(t);
|
|
617
|
+
}
|
|
506
618
|
try {
|
|
507
|
-
|
|
619
|
+
u = handleAsync(e, e.U(u));
|
|
508
620
|
clearStatus(e);
|
|
621
|
+
const t = resolveLane(e);
|
|
622
|
+
if (t) t.k.delete(e);
|
|
509
623
|
} catch (t) {
|
|
510
|
-
if (t instanceof NotReadyError) {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
624
|
+
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
625
|
+
const t = findLane(currentOptimisticLane);
|
|
626
|
+
if (t.t !== e) {
|
|
627
|
+
t.k.add(e);
|
|
628
|
+
e.H = t;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
notifyStatus(
|
|
632
|
+
e,
|
|
633
|
+
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
634
|
+
t,
|
|
635
|
+
undefined,
|
|
636
|
+
t instanceof NotReadyError ? e.H : undefined
|
|
637
|
+
);
|
|
514
638
|
} finally {
|
|
515
639
|
tracking = l;
|
|
516
|
-
e.
|
|
517
|
-
context =
|
|
640
|
+
e._ = REACTIVE_NONE;
|
|
641
|
+
context = s;
|
|
518
642
|
}
|
|
519
|
-
if (!e.
|
|
520
|
-
const
|
|
521
|
-
let l =
|
|
643
|
+
if (!e.re) {
|
|
644
|
+
const s = e.Ie;
|
|
645
|
+
let l = s !== null ? s.m : e.D;
|
|
522
646
|
if (l !== null) {
|
|
523
647
|
do {
|
|
524
648
|
l = unlinkSubs(l);
|
|
525
649
|
} while (l !== null);
|
|
526
|
-
if (
|
|
527
|
-
else e.
|
|
528
|
-
}
|
|
529
|
-
const
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
650
|
+
if (s !== null) s.m = null;
|
|
651
|
+
else e.D = null;
|
|
652
|
+
}
|
|
653
|
+
const a = r ? e.Te : e.K === NOT_PENDING ? e.Te : e.K;
|
|
654
|
+
const f = !e.pe || !e.pe(a, u);
|
|
655
|
+
if (f) {
|
|
656
|
+
const s = r ? e.Te : undefined;
|
|
657
|
+
if (t || (n && activeTransition !== e.M) || i) e.Te = u;
|
|
658
|
+
else e.K = u;
|
|
659
|
+
if (r && !i && o) {
|
|
660
|
+
const t = e.$ || 0;
|
|
661
|
+
const n = e.F || 0;
|
|
662
|
+
if (t <= n) e.Te = u;
|
|
663
|
+
}
|
|
664
|
+
if (!r || i || e.Te !== s) {
|
|
665
|
+
insertSubs(e, i || r);
|
|
666
|
+
}
|
|
667
|
+
} else if (r) {
|
|
668
|
+
e.K = u;
|
|
669
|
+
} else if (e.u != c) {
|
|
670
|
+
for (let t = e.p; t !== null; t = t.h) {
|
|
671
|
+
insertIntoHeapHeight(t.A, t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
537
672
|
}
|
|
538
673
|
}
|
|
539
674
|
}
|
|
540
|
-
|
|
541
|
-
(!t || e.
|
|
542
|
-
e.
|
|
675
|
+
setCurrentOptimisticLane(a);
|
|
676
|
+
(!t || e.de & STATUS_PENDING) && !e.M && !(activeTransition && e.j) && globalQueue.q.push(e);
|
|
677
|
+
e.M && n && activeTransition !== e.M && runInTransition(e.M, () => recompute(e));
|
|
543
678
|
}
|
|
544
679
|
function handleAsync(e, t, n) {
|
|
545
680
|
const i = typeof t === "object" && t !== null;
|
|
546
681
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
547
682
|
const o = !r && i && untrack(() => typeof t.then === "function");
|
|
548
683
|
if (!o && !r) {
|
|
549
|
-
e.
|
|
684
|
+
e.he = null;
|
|
550
685
|
return t;
|
|
551
686
|
}
|
|
552
|
-
e.
|
|
687
|
+
e.he = t;
|
|
553
688
|
let s;
|
|
554
689
|
const handleError = n => {
|
|
555
|
-
if (e.
|
|
556
|
-
globalQueue.initTransition(e.
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
notifyStatus(e, STATUS_PENDING, n);
|
|
560
|
-
} else notifyStatus(e, STATUS_ERROR, n);
|
|
561
|
-
e.ae = clock;
|
|
690
|
+
if (e.he !== t) return;
|
|
691
|
+
globalQueue.initTransition(e.M);
|
|
692
|
+
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
693
|
+
e.se = clock;
|
|
562
694
|
};
|
|
563
695
|
const asyncWrite = (i, r) => {
|
|
564
|
-
if (e.
|
|
565
|
-
|
|
696
|
+
if (e.he !== t) return;
|
|
697
|
+
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
698
|
+
globalQueue.initTransition(e.M);
|
|
566
699
|
clearStatus(e);
|
|
700
|
+
const o = resolveLane(e);
|
|
701
|
+
if (o) o.k.delete(e);
|
|
567
702
|
if (n) n(i);
|
|
568
|
-
else if (e.
|
|
569
|
-
const t = e.
|
|
570
|
-
if (e.U) e.
|
|
703
|
+
else if (e.j) {
|
|
704
|
+
const t = e.K !== NOT_PENDING;
|
|
705
|
+
if (e.U) e.K = i;
|
|
571
706
|
if (!t) {
|
|
572
|
-
e.
|
|
707
|
+
e.Te = i;
|
|
573
708
|
insertSubs(e);
|
|
574
709
|
}
|
|
575
|
-
e.
|
|
576
|
-
|
|
577
|
-
|
|
710
|
+
e.se = clock;
|
|
711
|
+
} else if (o) {
|
|
712
|
+
const t = e.Te;
|
|
713
|
+
const n = e.pe;
|
|
714
|
+
if (!n || !n(i, t)) {
|
|
715
|
+
e.Te = i;
|
|
716
|
+
e.se = clock;
|
|
717
|
+
if (e.Ae) {
|
|
718
|
+
setSignal(e.Ae, i);
|
|
719
|
+
}
|
|
720
|
+
insertSubs(e, true);
|
|
721
|
+
}
|
|
722
|
+
} else {
|
|
723
|
+
setSignal(e, () => i);
|
|
724
|
+
}
|
|
725
|
+
schedule();
|
|
578
726
|
flush();
|
|
579
727
|
r?.();
|
|
580
728
|
};
|
|
@@ -594,7 +742,7 @@ function handleAsync(e, t, n) {
|
|
|
594
742
|
);
|
|
595
743
|
i = false;
|
|
596
744
|
if (!n) {
|
|
597
|
-
globalQueue.initTransition(e.
|
|
745
|
+
globalQueue.initTransition(e.M);
|
|
598
746
|
throw new NotReadyError(context);
|
|
599
747
|
}
|
|
600
748
|
}
|
|
@@ -626,177 +774,191 @@ function handleAsync(e, t, n) {
|
|
|
626
774
|
};
|
|
627
775
|
const r = iterate();
|
|
628
776
|
if (!i && !r) {
|
|
629
|
-
globalQueue.initTransition(e.
|
|
777
|
+
globalQueue.initTransition(e.M);
|
|
630
778
|
throw new NotReadyError(context);
|
|
631
779
|
}
|
|
632
780
|
}
|
|
633
781
|
return s;
|
|
634
782
|
}
|
|
635
783
|
function clearStatus(e) {
|
|
636
|
-
e.
|
|
637
|
-
e.
|
|
784
|
+
e.de = e.de & STATUS_UNINITIALIZED;
|
|
785
|
+
e.re = null;
|
|
638
786
|
updatePendingSignal(e);
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
787
|
+
e.ge?.();
|
|
788
|
+
}
|
|
789
|
+
function notifyStatus(e, t, n, i, r) {
|
|
790
|
+
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
791
|
+
n = new StatusError(e, n);
|
|
792
|
+
const o = n instanceof NotReadyError && n.t === e;
|
|
793
|
+
const s = t === STATUS_PENDING && e.j && !o;
|
|
794
|
+
const u = s && hasActiveOverride(e);
|
|
795
|
+
if (!i) {
|
|
796
|
+
e.de = t | (t !== STATUS_ERROR ? e.de & STATUS_UNINITIALIZED : 0);
|
|
797
|
+
e.re = n;
|
|
798
|
+
updatePendingSignal(e);
|
|
799
|
+
}
|
|
800
|
+
if (r && !i) {
|
|
801
|
+
assignOrMergeLane(e, r);
|
|
802
|
+
}
|
|
803
|
+
if (u && activeTransition && n instanceof NotReadyError) {
|
|
804
|
+
const e = n.t;
|
|
805
|
+
if (!activeTransition.oe.includes(e)) {
|
|
806
|
+
activeTransition.oe.push(e);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
const c = i || u;
|
|
810
|
+
const l = i || s ? undefined : r;
|
|
811
|
+
if (e.ge) {
|
|
812
|
+
if (c) {
|
|
813
|
+
e.ge(t, n);
|
|
814
|
+
} else {
|
|
815
|
+
e.ge();
|
|
648
816
|
}
|
|
649
|
-
|
|
817
|
+
return;
|
|
650
818
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
if (e.Te) return e.Te();
|
|
657
|
-
for (let i = e.p; i !== null; i = i.I) {
|
|
658
|
-
i.h.ae = clock;
|
|
659
|
-
if (i.h.B !== n) {
|
|
660
|
-
!i.h.X && globalQueue.L.push(i.h);
|
|
661
|
-
notifyStatus(i.h, t, n);
|
|
819
|
+
for (let i = e.p; i !== null; i = i.h) {
|
|
820
|
+
i.A.se = clock;
|
|
821
|
+
if (i.A.re !== n) {
|
|
822
|
+
!i.A.M && globalQueue.q.push(i.A);
|
|
823
|
+
notifyStatus(i.A, t, n, c, l);
|
|
662
824
|
}
|
|
663
825
|
}
|
|
664
|
-
for (let i = e.
|
|
665
|
-
for (let e = i.p; e !== null; e = e.
|
|
666
|
-
e.
|
|
667
|
-
if (e.
|
|
668
|
-
!e.
|
|
669
|
-
notifyStatus(e.
|
|
826
|
+
for (let i = e.P; i !== null; i = i.C) {
|
|
827
|
+
for (let e = i.p; e !== null; e = e.h) {
|
|
828
|
+
e.A.se = clock;
|
|
829
|
+
if (e.A.re !== n) {
|
|
830
|
+
!e.A.M && globalQueue.q.push(e.A);
|
|
831
|
+
notifyStatus(e.A, t, n, c, l);
|
|
670
832
|
}
|
|
671
833
|
}
|
|
672
834
|
}
|
|
673
835
|
}
|
|
674
836
|
function updateIfNecessary(e) {
|
|
675
|
-
if (e.
|
|
676
|
-
for (let t = e.
|
|
837
|
+
if (e._ & REACTIVE_CHECK) {
|
|
838
|
+
for (let t = e.D; t; t = t.m) {
|
|
677
839
|
const n = t.V;
|
|
678
|
-
const i = n.
|
|
840
|
+
const i = n.L || n;
|
|
679
841
|
if (i.U) {
|
|
680
842
|
updateIfNecessary(i);
|
|
681
843
|
}
|
|
682
|
-
if (e.
|
|
844
|
+
if (e._ & REACTIVE_DIRTY) {
|
|
683
845
|
break;
|
|
684
846
|
}
|
|
685
847
|
}
|
|
686
848
|
}
|
|
687
|
-
if (e.
|
|
849
|
+
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.re && e.se < clock)) {
|
|
688
850
|
recompute(e);
|
|
689
851
|
}
|
|
690
|
-
e.
|
|
852
|
+
e._ = REACTIVE_NONE;
|
|
691
853
|
}
|
|
692
854
|
function unlinkSubs(e) {
|
|
693
855
|
const t = e.V;
|
|
694
|
-
const n = e.
|
|
695
|
-
const i = e.
|
|
696
|
-
const r = e.
|
|
697
|
-
if (i !== null) i.
|
|
698
|
-
else t.
|
|
699
|
-
if (r !== null) r.
|
|
856
|
+
const n = e.m;
|
|
857
|
+
const i = e.h;
|
|
858
|
+
const r = e.Pe;
|
|
859
|
+
if (i !== null) i.Pe = r;
|
|
860
|
+
else t.Ce = r;
|
|
861
|
+
if (r !== null) r.h = i;
|
|
700
862
|
else {
|
|
701
863
|
t.p = i;
|
|
702
864
|
if (i === null) {
|
|
703
|
-
t.
|
|
704
|
-
t.U && !t.
|
|
865
|
+
t.Ne?.();
|
|
866
|
+
t.U && !t.ye && unobserved(t);
|
|
705
867
|
}
|
|
706
868
|
}
|
|
707
869
|
return n;
|
|
708
870
|
}
|
|
709
871
|
function unobserved(e) {
|
|
710
|
-
deleteFromHeap(e, e.
|
|
711
|
-
let t = e.
|
|
872
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
873
|
+
let t = e.D;
|
|
712
874
|
while (t !== null) {
|
|
713
875
|
t = unlinkSubs(t);
|
|
714
876
|
}
|
|
715
|
-
e.
|
|
877
|
+
e.D = null;
|
|
716
878
|
disposeChildren(e, true);
|
|
717
879
|
}
|
|
718
880
|
function link(e, t) {
|
|
719
|
-
const n = t.
|
|
881
|
+
const n = t.Ie;
|
|
720
882
|
if (n !== null && n.V === e) return;
|
|
721
883
|
let i = null;
|
|
722
|
-
const r = t.
|
|
884
|
+
const r = t._ & REACTIVE_RECOMPUTING_DEPS;
|
|
723
885
|
if (r) {
|
|
724
|
-
i = n !== null ? n.
|
|
886
|
+
i = n !== null ? n.m : t.D;
|
|
725
887
|
if (i !== null && i.V === e) {
|
|
726
|
-
t.
|
|
888
|
+
t.Ie = i;
|
|
727
889
|
return;
|
|
728
890
|
}
|
|
729
891
|
}
|
|
730
|
-
const o = e.
|
|
731
|
-
if (o !== null && o.
|
|
732
|
-
const s = (t.
|
|
733
|
-
if (n !== null) n.
|
|
734
|
-
else t.
|
|
735
|
-
if (o !== null) o.
|
|
892
|
+
const o = e.Ce;
|
|
893
|
+
if (o !== null && o.A === t && (!r || isValidLink(o, t))) return;
|
|
894
|
+
const s = (t.Ie = e.Ce = { V: e, A: t, m: i, Pe: o, h: null });
|
|
895
|
+
if (n !== null) n.m = s;
|
|
896
|
+
else t.D = s;
|
|
897
|
+
if (o !== null) o.h = s;
|
|
736
898
|
else e.p = s;
|
|
737
899
|
}
|
|
738
900
|
function isValidLink(e, t) {
|
|
739
|
-
const n = t.
|
|
901
|
+
const n = t.Ie;
|
|
740
902
|
if (n !== null) {
|
|
741
|
-
let i = t.
|
|
903
|
+
let i = t.D;
|
|
742
904
|
do {
|
|
743
905
|
if (i === e) return true;
|
|
744
906
|
if (i === n) break;
|
|
745
|
-
i = i.
|
|
907
|
+
i = i.m;
|
|
746
908
|
} while (i !== null);
|
|
747
909
|
}
|
|
748
910
|
return false;
|
|
749
911
|
}
|
|
750
912
|
function markDisposal(e) {
|
|
751
|
-
let t = e.
|
|
913
|
+
let t = e._e;
|
|
752
914
|
while (t) {
|
|
753
|
-
t.
|
|
754
|
-
if (t.
|
|
915
|
+
t._ |= REACTIVE_ZOMBIE;
|
|
916
|
+
if (t._ & REACTIVE_IN_HEAP) {
|
|
755
917
|
deleteFromHeap(t, dirtyQueue);
|
|
756
918
|
insertIntoHeap(t, zombieQueue);
|
|
757
919
|
}
|
|
758
920
|
markDisposal(t);
|
|
759
|
-
t = t.
|
|
921
|
+
t = t.De;
|
|
760
922
|
}
|
|
761
923
|
}
|
|
762
924
|
function dispose(e) {
|
|
763
|
-
let t = e.
|
|
925
|
+
let t = e.D || null;
|
|
764
926
|
do {
|
|
765
927
|
t = unlinkSubs(t);
|
|
766
928
|
} while (t !== null);
|
|
767
|
-
e.
|
|
768
|
-
e.
|
|
929
|
+
e.D = null;
|
|
930
|
+
e.Ie = null;
|
|
769
931
|
disposeChildren(e, true);
|
|
770
932
|
}
|
|
771
933
|
function disposeChildren(e, t = false, n) {
|
|
772
|
-
if (e.
|
|
773
|
-
if (t) e.
|
|
774
|
-
let i = n ? e.
|
|
934
|
+
if (e._ & REACTIVE_DISPOSED) return;
|
|
935
|
+
if (t) e._ = REACTIVE_DISPOSED;
|
|
936
|
+
let i = n ? e.Se : e._e;
|
|
775
937
|
while (i) {
|
|
776
|
-
const e = i.
|
|
777
|
-
if (i.
|
|
938
|
+
const e = i.De;
|
|
939
|
+
if (i.D) {
|
|
778
940
|
const e = i;
|
|
779
|
-
deleteFromHeap(e, e.
|
|
780
|
-
let t = e.
|
|
941
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
942
|
+
let t = e.D;
|
|
781
943
|
do {
|
|
782
944
|
t = unlinkSubs(t);
|
|
783
945
|
} while (t !== null);
|
|
784
|
-
e.
|
|
785
|
-
e.
|
|
946
|
+
e.D = null;
|
|
947
|
+
e.Ie = null;
|
|
786
948
|
}
|
|
787
949
|
disposeChildren(i, true);
|
|
788
950
|
i = e;
|
|
789
951
|
}
|
|
790
952
|
if (n) {
|
|
791
|
-
e.
|
|
953
|
+
e.Se = null;
|
|
792
954
|
} else {
|
|
793
|
-
e.ue = null;
|
|
794
955
|
e._e = null;
|
|
956
|
+
e.De = null;
|
|
795
957
|
}
|
|
796
958
|
runDisposal(e, n);
|
|
797
959
|
}
|
|
798
960
|
function runDisposal(e, t) {
|
|
799
|
-
let n = t ? e.
|
|
961
|
+
let n = t ? e.Re : e.Oe;
|
|
800
962
|
if (!n) return;
|
|
801
963
|
if (Array.isArray(n)) {
|
|
802
964
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -806,10 +968,10 @@ function runDisposal(e, t) {
|
|
|
806
968
|
} else {
|
|
807
969
|
n.call(n);
|
|
808
970
|
}
|
|
809
|
-
t ? (e.
|
|
971
|
+
t ? (e.Re = null) : (e.Oe = null);
|
|
810
972
|
}
|
|
811
973
|
function getNextChildId(e) {
|
|
812
|
-
if (e.id != null) return formatId(e.id, e.
|
|
974
|
+
if (e.id != null) return formatId(e.id, e.ve++);
|
|
813
975
|
throw new Error("Cannot get child id from owner without an id");
|
|
814
976
|
}
|
|
815
977
|
function formatId(e, t) {
|
|
@@ -820,102 +982,117 @@ function formatId(e, t) {
|
|
|
820
982
|
function computed(e, t, n) {
|
|
821
983
|
const i = {
|
|
822
984
|
id: n?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
985
|
+
pe: n?.equals != null ? n.equals : isEqual,
|
|
986
|
+
we: !!n?.pureWrite,
|
|
987
|
+
Ne: n?.unobserved,
|
|
988
|
+
Oe: null,
|
|
989
|
+
fe: context?.fe ?? globalQueue,
|
|
990
|
+
be: context?.be ?? defaultContext,
|
|
991
|
+
ve: 0,
|
|
830
992
|
U: e,
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
993
|
+
Te: t,
|
|
994
|
+
u: 0,
|
|
995
|
+
P: null,
|
|
996
|
+
O: undefined,
|
|
997
|
+
R: null,
|
|
998
|
+
D: null,
|
|
999
|
+
Ie: null,
|
|
838
1000
|
p: null,
|
|
839
|
-
|
|
840
|
-
|
|
1001
|
+
Ce: null,
|
|
1002
|
+
o: context,
|
|
1003
|
+
De: null,
|
|
841
1004
|
_e: null,
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
X: null
|
|
1005
|
+
_: REACTIVE_NONE,
|
|
1006
|
+
de: STATUS_UNINITIALIZED,
|
|
1007
|
+
se: clock,
|
|
1008
|
+
K: NOT_PENDING,
|
|
1009
|
+
Re: null,
|
|
1010
|
+
Se: null,
|
|
1011
|
+
he: null,
|
|
1012
|
+
M: null
|
|
851
1013
|
};
|
|
852
|
-
i.
|
|
853
|
-
const r = context?.
|
|
1014
|
+
i.R = i;
|
|
1015
|
+
const r = context?.i ? context.l : context;
|
|
854
1016
|
if (context) {
|
|
855
|
-
const e = context.
|
|
1017
|
+
const e = context._e;
|
|
856
1018
|
if (e === null) {
|
|
857
|
-
context.
|
|
1019
|
+
context._e = i;
|
|
858
1020
|
} else {
|
|
859
|
-
i.
|
|
860
|
-
context.
|
|
1021
|
+
i.De = e;
|
|
1022
|
+
context._e = i;
|
|
861
1023
|
}
|
|
862
1024
|
}
|
|
863
|
-
if (r) i.
|
|
1025
|
+
if (r) i.u = r.u + 1;
|
|
864
1026
|
!n?.lazy && recompute(i, true);
|
|
865
1027
|
return i;
|
|
866
1028
|
}
|
|
867
1029
|
function signal(e, t, n = null) {
|
|
868
1030
|
const i = {
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
1031
|
+
pe: t?.equals != null ? t.equals : isEqual,
|
|
1032
|
+
we: !!t?.pureWrite,
|
|
1033
|
+
Ne: t?.unobserved,
|
|
1034
|
+
Te: e,
|
|
873
1035
|
p: null,
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
1036
|
+
Ce: null,
|
|
1037
|
+
se: clock,
|
|
1038
|
+
L: n,
|
|
1039
|
+
C: n?.P || null,
|
|
1040
|
+
K: NOT_PENDING
|
|
879
1041
|
};
|
|
880
|
-
n && (n.
|
|
1042
|
+
n && (n.P = i);
|
|
881
1043
|
return i;
|
|
882
1044
|
}
|
|
883
1045
|
function optimisticSignal(e, t) {
|
|
884
1046
|
const n = signal(e, t);
|
|
885
|
-
n.
|
|
1047
|
+
n.j = true;
|
|
886
1048
|
return n;
|
|
887
1049
|
}
|
|
888
1050
|
function optimisticComputed(e, t, n) {
|
|
889
1051
|
const i = computed(e, t, n);
|
|
890
|
-
i.
|
|
1052
|
+
i.j = true;
|
|
891
1053
|
return i;
|
|
892
1054
|
}
|
|
893
1055
|
function getPendingSignal(e) {
|
|
894
|
-
if (!e.
|
|
895
|
-
e.
|
|
896
|
-
if (computePendingState(e)) setSignal(e.
|
|
1056
|
+
if (!e.me) {
|
|
1057
|
+
e.me = optimisticSignal(false, { pureWrite: true });
|
|
1058
|
+
if (computePendingState(e)) setSignal(e.me, true);
|
|
897
1059
|
}
|
|
898
|
-
return e.
|
|
1060
|
+
return e.me;
|
|
899
1061
|
}
|
|
900
1062
|
function computePendingState(e) {
|
|
901
|
-
if (e.te !== NOT_PENDING) return true;
|
|
902
1063
|
const t = e;
|
|
903
|
-
|
|
1064
|
+
if (e.K !== NOT_PENDING && !(t.de & STATUS_UNINITIALIZED)) return true;
|
|
1065
|
+
return !!(t.de & STATUS_PENDING && !(t.de & STATUS_UNINITIALIZED));
|
|
904
1066
|
}
|
|
905
1067
|
function getPendingValueComputed(e) {
|
|
906
|
-
if (!e.
|
|
1068
|
+
if (!e.Ae) {
|
|
907
1069
|
const t = pendingReadActive;
|
|
908
1070
|
pendingReadActive = false;
|
|
909
1071
|
const n = context;
|
|
910
1072
|
context = null;
|
|
911
|
-
e.
|
|
1073
|
+
e.Ae = optimisticComputed(() => read(e));
|
|
912
1074
|
context = n;
|
|
913
1075
|
pendingReadActive = t;
|
|
914
1076
|
}
|
|
915
|
-
return e.
|
|
1077
|
+
return e.Ae;
|
|
916
1078
|
}
|
|
917
1079
|
function updatePendingSignal(e) {
|
|
918
|
-
if (e.
|
|
1080
|
+
if (e.me) {
|
|
1081
|
+
const t = computePendingState(e);
|
|
1082
|
+
const n = e.me;
|
|
1083
|
+
setSignal(n, t);
|
|
1084
|
+
if (!t && n.H) {
|
|
1085
|
+
const t = resolveLane(e);
|
|
1086
|
+
if (t && t.k.size > 0) {
|
|
1087
|
+
const e = findLane(n.H);
|
|
1088
|
+
if (e !== t) {
|
|
1089
|
+
mergeLanes(t, e);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
clearLaneEntry(n);
|
|
1093
|
+
n.H = undefined;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
919
1096
|
}
|
|
920
1097
|
function isEqual(e, t) {
|
|
921
1098
|
return e === t;
|
|
@@ -931,7 +1108,7 @@ function untrack(e) {
|
|
|
931
1108
|
}
|
|
932
1109
|
function read(e) {
|
|
933
1110
|
if (pendingCheckActive) {
|
|
934
|
-
const t = e.
|
|
1111
|
+
const t = e.L || e;
|
|
935
1112
|
const n = getPendingSignal(t);
|
|
936
1113
|
const i = pendingCheckActive;
|
|
937
1114
|
pendingCheckActive = false;
|
|
@@ -939,7 +1116,7 @@ function read(e) {
|
|
|
939
1116
|
foundPending = true;
|
|
940
1117
|
}
|
|
941
1118
|
pendingCheckActive = i;
|
|
942
|
-
return e.
|
|
1119
|
+
return e.Te;
|
|
943
1120
|
}
|
|
944
1121
|
if (pendingReadActive) {
|
|
945
1122
|
const t = getPendingValueComputed(e);
|
|
@@ -947,78 +1124,93 @@ function read(e) {
|
|
|
947
1124
|
pendingReadActive = false;
|
|
948
1125
|
const i = read(t);
|
|
949
1126
|
pendingReadActive = n;
|
|
950
|
-
if (t.
|
|
1127
|
+
if (t.de & STATUS_PENDING) return e.Te;
|
|
951
1128
|
return i;
|
|
952
1129
|
}
|
|
953
1130
|
let t = context;
|
|
954
|
-
if (t?.
|
|
1131
|
+
if (t?.i) t = t.l;
|
|
955
1132
|
if (refreshing && e.U) recompute(e);
|
|
956
1133
|
if (t && tracking) {
|
|
957
|
-
if (e.U && e.
|
|
1134
|
+
if (e.U && e._ & REACTIVE_DISPOSED) recompute(e);
|
|
958
1135
|
link(e, t);
|
|
959
|
-
const n = e.
|
|
1136
|
+
const n = e.L || e;
|
|
960
1137
|
if (n.U) {
|
|
961
|
-
const i = e.
|
|
962
|
-
if (n.
|
|
1138
|
+
const i = e._ & REACTIVE_ZOMBIE;
|
|
1139
|
+
if (n.u >= (i ? zombieQueue.N : dirtyQueue.N)) {
|
|
963
1140
|
markNode(t);
|
|
964
1141
|
markHeap(i ? zombieQueue : dirtyQueue);
|
|
965
1142
|
updateIfNecessary(n);
|
|
966
1143
|
}
|
|
967
|
-
const r = n.
|
|
968
|
-
if (r >= t.
|
|
969
|
-
t.
|
|
1144
|
+
const r = n.u;
|
|
1145
|
+
if (r >= t.u && e.o !== t) {
|
|
1146
|
+
t.u = r + 1;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
const n = e.L || e;
|
|
1151
|
+
if (t && n.de & STATUS_PENDING && !(stale && n.M && activeTransition !== n.M)) {
|
|
1152
|
+
if (currentOptimisticLane) {
|
|
1153
|
+
const i = n.H;
|
|
1154
|
+
const r = findLane(currentOptimisticLane);
|
|
1155
|
+
if (i && findLane(i) === r && !hasActiveOverride(n)) {
|
|
1156
|
+
if (!tracking) link(e, t);
|
|
1157
|
+
throw n.re;
|
|
970
1158
|
}
|
|
1159
|
+
} else {
|
|
1160
|
+
if (!tracking) link(e, t);
|
|
1161
|
+
throw n.re;
|
|
971
1162
|
}
|
|
972
1163
|
}
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
t &&
|
|
976
|
-
!optimisticReadActive &&
|
|
977
|
-
n.ie & STATUS_PENDING &&
|
|
978
|
-
!(stale && n.X && activeTransition !== n.X)
|
|
979
|
-
)
|
|
980
|
-
throw n.B;
|
|
981
|
-
if (e.U && e.ie & STATUS_ERROR) {
|
|
982
|
-
if (e.ae < clock) {
|
|
1164
|
+
if (e.U && e.de & STATUS_ERROR) {
|
|
1165
|
+
if (e.se < clock) {
|
|
983
1166
|
recompute(e, true);
|
|
984
1167
|
return read(e);
|
|
985
|
-
} else throw e.
|
|
1168
|
+
} else throw e.re;
|
|
986
1169
|
}
|
|
987
1170
|
return !t ||
|
|
988
|
-
|
|
989
|
-
e.
|
|
990
|
-
(stale && e.
|
|
991
|
-
? e.
|
|
992
|
-
: e.
|
|
1171
|
+
currentOptimisticLane !== null ||
|
|
1172
|
+
e.K === NOT_PENDING ||
|
|
1173
|
+
(stale && e.M && activeTransition !== e.M)
|
|
1174
|
+
? e.Te
|
|
1175
|
+
: e.K;
|
|
993
1176
|
}
|
|
994
1177
|
function setSignal(e, t) {
|
|
995
|
-
if (e.
|
|
996
|
-
const n = e.
|
|
997
|
-
const i = n ? e.
|
|
1178
|
+
if (e.M && activeTransition !== e.M) globalQueue.initTransition(e.M);
|
|
1179
|
+
const n = e.j && !projectionWriteActive;
|
|
1180
|
+
const i = n ? e.Te : e.K === NOT_PENDING ? e.Te : e.K;
|
|
998
1181
|
if (typeof t === "function") t = t(i);
|
|
999
|
-
const r = !e.
|
|
1000
|
-
if (!r)
|
|
1182
|
+
const r = !e.pe || !e.pe(i, t);
|
|
1183
|
+
if (!r) {
|
|
1184
|
+
if (n && e.K !== NOT_PENDING && e.U) {
|
|
1185
|
+
insertSubs(e, true);
|
|
1186
|
+
schedule();
|
|
1187
|
+
}
|
|
1188
|
+
return t;
|
|
1189
|
+
}
|
|
1001
1190
|
if (n) {
|
|
1002
|
-
const n = globalQueue.
|
|
1003
|
-
if (e.
|
|
1004
|
-
globalQueue.initTransition(e.
|
|
1191
|
+
const n = globalQueue.Z.includes(e);
|
|
1192
|
+
if (e.M && n) {
|
|
1193
|
+
globalQueue.initTransition(e.M);
|
|
1005
1194
|
}
|
|
1006
|
-
if (e.
|
|
1007
|
-
e.
|
|
1195
|
+
if (e.K === NOT_PENDING) {
|
|
1196
|
+
e.K = e.Te;
|
|
1008
1197
|
}
|
|
1009
1198
|
if (!n) {
|
|
1010
|
-
globalQueue.
|
|
1199
|
+
globalQueue.Z.push(e);
|
|
1011
1200
|
}
|
|
1012
|
-
e
|
|
1201
|
+
e.$ = (e.$ || 0) + 1;
|
|
1202
|
+
const i = getOrCreateLane(e);
|
|
1203
|
+
e.H = i;
|
|
1204
|
+
e.Te = t;
|
|
1013
1205
|
} else {
|
|
1014
|
-
if (e.
|
|
1015
|
-
e.
|
|
1206
|
+
if (e.K === NOT_PENDING) globalQueue.q.push(e);
|
|
1207
|
+
e.K = t;
|
|
1016
1208
|
}
|
|
1017
1209
|
updatePendingSignal(e);
|
|
1018
|
-
if (e.
|
|
1019
|
-
setSignal(e.
|
|
1210
|
+
if (e.Ae) {
|
|
1211
|
+
setSignal(e.Ae, t);
|
|
1020
1212
|
}
|
|
1021
|
-
e.
|
|
1213
|
+
e.se = clock;
|
|
1022
1214
|
insertSubs(e, n);
|
|
1023
1215
|
schedule();
|
|
1024
1216
|
return t;
|
|
@@ -1033,37 +1225,37 @@ function getOwner() {
|
|
|
1033
1225
|
}
|
|
1034
1226
|
function onCleanup(e) {
|
|
1035
1227
|
if (!context) return e;
|
|
1036
|
-
if (!context.
|
|
1037
|
-
else if (Array.isArray(context.
|
|
1038
|
-
else context.
|
|
1228
|
+
if (!context.Oe) context.Oe = e;
|
|
1229
|
+
else if (Array.isArray(context.Oe)) context.Oe.push(e);
|
|
1230
|
+
else context.Oe = [context.Oe, e];
|
|
1039
1231
|
return e;
|
|
1040
1232
|
}
|
|
1041
1233
|
function createOwner(e) {
|
|
1042
1234
|
const t = context;
|
|
1043
1235
|
const n = {
|
|
1044
1236
|
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
ue: null,
|
|
1237
|
+
i: true,
|
|
1238
|
+
l: t?.i ? t.l : t,
|
|
1048
1239
|
_e: null,
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1240
|
+
De: null,
|
|
1241
|
+
Oe: null,
|
|
1242
|
+
fe: t?.fe ?? globalQueue,
|
|
1243
|
+
be: t?.be || defaultContext,
|
|
1244
|
+
ve: 0,
|
|
1245
|
+
Re: null,
|
|
1246
|
+
Se: null,
|
|
1247
|
+
o: t,
|
|
1056
1248
|
dispose(e = true) {
|
|
1057
1249
|
disposeChildren(n, e);
|
|
1058
1250
|
}
|
|
1059
1251
|
};
|
|
1060
1252
|
if (t) {
|
|
1061
|
-
const e = t.
|
|
1253
|
+
const e = t._e;
|
|
1062
1254
|
if (e === null) {
|
|
1063
|
-
t.
|
|
1255
|
+
t._e = n;
|
|
1064
1256
|
} else {
|
|
1065
|
-
n.
|
|
1066
|
-
t.
|
|
1257
|
+
n.De = e;
|
|
1258
|
+
t._e = n;
|
|
1067
1259
|
}
|
|
1068
1260
|
}
|
|
1069
1261
|
return n;
|
|
@@ -1110,6 +1302,8 @@ function isPending(e) {
|
|
|
1110
1302
|
try {
|
|
1111
1303
|
e();
|
|
1112
1304
|
return foundPending;
|
|
1305
|
+
} catch {
|
|
1306
|
+
return foundPending;
|
|
1113
1307
|
} finally {
|
|
1114
1308
|
pendingCheckActive = t;
|
|
1115
1309
|
foundPending = n;
|
|
@@ -1141,7 +1335,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1141
1335
|
if (!t) {
|
|
1142
1336
|
throw new NoOwnerError();
|
|
1143
1337
|
}
|
|
1144
|
-
const n = hasContext(e, t) ? t.
|
|
1338
|
+
const n = hasContext(e, t) ? t.be[e.id] : e.defaultValue;
|
|
1145
1339
|
if (isUndefined(n)) {
|
|
1146
1340
|
throw new ContextNotFoundError();
|
|
1147
1341
|
}
|
|
@@ -1151,10 +1345,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1151
1345
|
if (!n) {
|
|
1152
1346
|
throw new NoOwnerError();
|
|
1153
1347
|
}
|
|
1154
|
-
n.
|
|
1348
|
+
n.be = { ...n.be, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1155
1349
|
}
|
|
1156
1350
|
function hasContext(e, t) {
|
|
1157
|
-
return !isUndefined(t?.
|
|
1351
|
+
return !isUndefined(t?.be[e.id]);
|
|
1158
1352
|
}
|
|
1159
1353
|
function isUndefined(e) {
|
|
1160
1354
|
return typeof e === "undefined";
|
|
@@ -1164,78 +1358,80 @@ function effect(e, t, n, i, r) {
|
|
|
1164
1358
|
const s = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
1165
1359
|
...r,
|
|
1166
1360
|
equals: () => {
|
|
1167
|
-
s.
|
|
1168
|
-
if (o) s.
|
|
1361
|
+
s.ae = !s.re;
|
|
1362
|
+
if (o) s.fe.enqueue(s.le, runEffect.bind(s));
|
|
1169
1363
|
return false;
|
|
1170
1364
|
},
|
|
1171
1365
|
lazy: true
|
|
1172
1366
|
});
|
|
1173
|
-
s.
|
|
1174
|
-
s.
|
|
1175
|
-
s.
|
|
1176
|
-
s.
|
|
1177
|
-
s.
|
|
1178
|
-
s.
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1367
|
+
s.Ve = i;
|
|
1368
|
+
s.Le = t;
|
|
1369
|
+
s.Ue = n;
|
|
1370
|
+
s.ke = undefined;
|
|
1371
|
+
s.le = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
1372
|
+
s.ge = (e, t) => {
|
|
1373
|
+
const n = e !== undefined ? e : s.de;
|
|
1374
|
+
const i = t !== undefined ? t : s.re;
|
|
1375
|
+
if (n & STATUS_ERROR) {
|
|
1376
|
+
let e = i;
|
|
1377
|
+
s.fe.notify(s, STATUS_PENDING, 0);
|
|
1378
|
+
if (s.le === EFFECT_USER) {
|
|
1183
1379
|
try {
|
|
1184
|
-
return s.
|
|
1185
|
-
? s.
|
|
1186
|
-
s.
|
|
1187
|
-
s.
|
|
1380
|
+
return s.Ue
|
|
1381
|
+
? s.Ue(e, () => {
|
|
1382
|
+
s.ke?.();
|
|
1383
|
+
s.ke = undefined;
|
|
1188
1384
|
})
|
|
1189
1385
|
: console.error(e);
|
|
1190
1386
|
} catch (t) {
|
|
1191
1387
|
e = t;
|
|
1192
1388
|
}
|
|
1193
1389
|
}
|
|
1194
|
-
if (!s.
|
|
1195
|
-
} else if (s.
|
|
1390
|
+
if (!s.fe.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1391
|
+
} else if (s.le === EFFECT_RENDER) s.fe.notify(s, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
1196
1392
|
};
|
|
1197
1393
|
recompute(s, true);
|
|
1198
|
-
!r?.defer && (s.
|
|
1394
|
+
!r?.defer && (s.le === EFFECT_USER ? s.fe.enqueue(s.le, runEffect.bind(s)) : runEffect.call(s));
|
|
1199
1395
|
o = true;
|
|
1200
|
-
onCleanup(() => s.
|
|
1396
|
+
onCleanup(() => s.ke?.());
|
|
1201
1397
|
}
|
|
1202
1398
|
function runEffect() {
|
|
1203
|
-
if (!this.
|
|
1204
|
-
this.
|
|
1205
|
-
this.
|
|
1399
|
+
if (!this.ae || this._ & REACTIVE_DISPOSED) return;
|
|
1400
|
+
this.ke?.();
|
|
1401
|
+
this.ke = undefined;
|
|
1206
1402
|
try {
|
|
1207
|
-
this.
|
|
1403
|
+
this.ke = this.Le(this.Te, this.Ve);
|
|
1208
1404
|
} catch (e) {
|
|
1209
|
-
if (!this.
|
|
1405
|
+
if (!this.fe.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1210
1406
|
} finally {
|
|
1211
|
-
this.
|
|
1212
|
-
this.
|
|
1407
|
+
this.Ve = this.Te;
|
|
1408
|
+
this.ae = false;
|
|
1213
1409
|
}
|
|
1214
1410
|
}
|
|
1215
1411
|
function trackedEffect(e, t) {
|
|
1216
1412
|
const run = () => {
|
|
1217
|
-
if (!n.
|
|
1218
|
-
n.
|
|
1413
|
+
if (!n.ae || n._ & REACTIVE_DISPOSED) return;
|
|
1414
|
+
n.ae = false;
|
|
1219
1415
|
recompute(n);
|
|
1220
1416
|
};
|
|
1221
1417
|
const n = computed(
|
|
1222
1418
|
() => {
|
|
1223
1419
|
try {
|
|
1224
|
-
n.
|
|
1225
|
-
n.
|
|
1226
|
-
n.
|
|
1420
|
+
n.ke?.();
|
|
1421
|
+
n.ke = undefined;
|
|
1422
|
+
n.ke = staleValues(e) || undefined;
|
|
1227
1423
|
} finally {
|
|
1228
1424
|
}
|
|
1229
1425
|
},
|
|
1230
1426
|
undefined,
|
|
1231
1427
|
{ ...t, lazy: true, pureWrite: true }
|
|
1232
1428
|
);
|
|
1233
|
-
n.
|
|
1234
|
-
n.
|
|
1235
|
-
n.
|
|
1236
|
-
n.
|
|
1237
|
-
n.
|
|
1238
|
-
onCleanup(() => n.
|
|
1429
|
+
n.ke = undefined;
|
|
1430
|
+
n.ae = true;
|
|
1431
|
+
n.le = EFFECT_TRACKED;
|
|
1432
|
+
n.Ee = run;
|
|
1433
|
+
n.fe.enqueue(EFFECT_USER, run);
|
|
1434
|
+
onCleanup(() => n.ke?.());
|
|
1239
1435
|
}
|
|
1240
1436
|
function createSignal(e, t, n) {
|
|
1241
1437
|
if (typeof e === "function") {
|
|
@@ -1328,26 +1524,26 @@ function applyState(e, t, n, i) {
|
|
|
1328
1524
|
r[STORE_OVERRIDE] = undefined;
|
|
1329
1525
|
if (Array.isArray(o)) {
|
|
1330
1526
|
let t = false;
|
|
1331
|
-
const
|
|
1332
|
-
if (e.length &&
|
|
1333
|
-
let
|
|
1527
|
+
const c = getOverrideValue(o, s, u, "length");
|
|
1528
|
+
if (e.length && c && e[0] && n(e[0]) != null) {
|
|
1529
|
+
let l, a, f, E, T, d, R, O;
|
|
1334
1530
|
for (
|
|
1335
|
-
f = 0, E = Math.min(
|
|
1336
|
-
f < E && ((
|
|
1531
|
+
f = 0, E = Math.min(c, e.length);
|
|
1532
|
+
f < E && ((d = getOverrideValue(o, s, u, f)) === e[f] || (d && e[f] && n(d) === n(e[f])));
|
|
1337
1533
|
f++
|
|
1338
1534
|
) {
|
|
1339
|
-
applyState(e[f], wrap(
|
|
1535
|
+
applyState(e[f], wrap(d, r), n, i);
|
|
1340
1536
|
}
|
|
1341
1537
|
const S = new Array(e.length),
|
|
1342
1538
|
_ = new Map();
|
|
1343
1539
|
for (
|
|
1344
|
-
E =
|
|
1540
|
+
E = c - 1, T = e.length - 1;
|
|
1345
1541
|
E >= f &&
|
|
1346
1542
|
T >= f &&
|
|
1347
|
-
((
|
|
1543
|
+
((d = getOverrideValue(o, s, u, E)) === e[T] || (d && e[T] && n(d) === n(e[T])));
|
|
1348
1544
|
E--, T--
|
|
1349
1545
|
) {
|
|
1350
|
-
S[T] =
|
|
1546
|
+
S[T] = d;
|
|
1351
1547
|
}
|
|
1352
1548
|
if (f > T || f > E) {
|
|
1353
1549
|
for (a = f; a <= T; a++) {
|
|
@@ -1361,24 +1557,24 @@ function applyState(e, t, n, i) {
|
|
|
1361
1557
|
applyState(e[a], o, n, i);
|
|
1362
1558
|
}
|
|
1363
1559
|
t && r[STORE_NODE][$TRACK] && setSignal(r[STORE_NODE][$TRACK], void 0);
|
|
1364
|
-
|
|
1560
|
+
c !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
|
|
1365
1561
|
return;
|
|
1366
1562
|
}
|
|
1367
|
-
|
|
1563
|
+
R = new Array(T + 1);
|
|
1368
1564
|
for (a = T; a >= f; a--) {
|
|
1369
|
-
|
|
1370
|
-
O =
|
|
1371
|
-
|
|
1372
|
-
|
|
1565
|
+
d = e[a];
|
|
1566
|
+
O = d ? n(d) : d;
|
|
1567
|
+
l = _.get(O);
|
|
1568
|
+
R[a] = l === undefined ? -1 : l;
|
|
1373
1569
|
_.set(O, a);
|
|
1374
1570
|
}
|
|
1375
|
-
for (
|
|
1376
|
-
|
|
1377
|
-
O =
|
|
1571
|
+
for (l = f; l <= E; l++) {
|
|
1572
|
+
d = getOverrideValue(o, s, u, l);
|
|
1573
|
+
O = d ? n(d) : d;
|
|
1378
1574
|
a = _.get(O);
|
|
1379
1575
|
if (a !== undefined && a !== -1) {
|
|
1380
|
-
S[a] =
|
|
1381
|
-
a =
|
|
1576
|
+
S[a] = d;
|
|
1577
|
+
a = R[a];
|
|
1382
1578
|
_.set(O, a);
|
|
1383
1579
|
}
|
|
1384
1580
|
}
|
|
@@ -1391,14 +1587,14 @@ function applyState(e, t, n, i) {
|
|
|
1391
1587
|
}
|
|
1392
1588
|
if (f < e.length) t = true;
|
|
1393
1589
|
} else if (e.length) {
|
|
1394
|
-
for (let t = 0,
|
|
1395
|
-
const
|
|
1396
|
-
isWrappable(
|
|
1397
|
-
? applyState(e[t], wrap(
|
|
1590
|
+
for (let t = 0, c = e.length; t < c; t++) {
|
|
1591
|
+
const c = getOverrideValue(o, s, u, t);
|
|
1592
|
+
isWrappable(c)
|
|
1593
|
+
? applyState(e[t], wrap(c, r), n, i)
|
|
1398
1594
|
: r[STORE_NODE][t] && setSignal(r[STORE_NODE][t], e[t]);
|
|
1399
1595
|
}
|
|
1400
1596
|
}
|
|
1401
|
-
if (
|
|
1597
|
+
if (c !== e.length) {
|
|
1402
1598
|
t = true;
|
|
1403
1599
|
r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
|
|
1404
1600
|
}
|
|
@@ -1407,9 +1603,9 @@ function applyState(e, t, n, i) {
|
|
|
1407
1603
|
}
|
|
1408
1604
|
if (u) {
|
|
1409
1605
|
const t = u[$TRACK];
|
|
1410
|
-
const
|
|
1411
|
-
for (let
|
|
1412
|
-
const a = l
|
|
1606
|
+
const c = t || i ? getAllKeys(o, s, e) : Object.keys(u);
|
|
1607
|
+
for (let l = 0, a = c.length; l < a; l++) {
|
|
1608
|
+
const a = c[l];
|
|
1413
1609
|
const f = u[a];
|
|
1414
1610
|
const E = unwrap(getOverrideValue(o, s, u, a));
|
|
1415
1611
|
let T = unwrap(e[a]);
|
|
@@ -1469,7 +1665,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1469
1665
|
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(o);
|
|
1470
1666
|
});
|
|
1471
1667
|
});
|
|
1472
|
-
i.
|
|
1668
|
+
i.ye = true;
|
|
1473
1669
|
return { store: o, node: i };
|
|
1474
1670
|
}
|
|
1475
1671
|
function createProjection(e, t = {}, n) {
|
|
@@ -1569,7 +1765,7 @@ function getNode(e, t, n, i, r = isEqual, o) {
|
|
|
1569
1765
|
},
|
|
1570
1766
|
i
|
|
1571
1767
|
);
|
|
1572
|
-
if (o) s.
|
|
1768
|
+
if (o) s.j = true;
|
|
1573
1769
|
return (e[t] = s);
|
|
1574
1770
|
}
|
|
1575
1771
|
function trackSelf(e, t = $TRACK) {
|
|
@@ -1612,39 +1808,39 @@ const storeTraps = {
|
|
|
1612
1808
|
const o = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
|
|
1613
1809
|
const s = o || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
|
|
1614
1810
|
const u = !!e[STORE_VALUE][$TARGET];
|
|
1615
|
-
const
|
|
1811
|
+
const c = o
|
|
1616
1812
|
? e[STORE_OPTIMISTIC_OVERRIDE]
|
|
1617
1813
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
1618
1814
|
? e[STORE_OVERRIDE]
|
|
1619
1815
|
: e[STORE_VALUE];
|
|
1620
1816
|
if (!r) {
|
|
1621
|
-
const e = Object.getOwnPropertyDescriptor(
|
|
1817
|
+
const e = Object.getOwnPropertyDescriptor(c, t);
|
|
1622
1818
|
if (e && e.get) return e.get.call(n);
|
|
1623
1819
|
}
|
|
1624
1820
|
if (writeOnly(n)) {
|
|
1625
|
-
let n = r && (s || !u) ? (r.
|
|
1821
|
+
let n = r && (s || !u) ? (r.K !== NOT_PENDING ? (r.j ? r.Te : r.K) : r.Te) : c[t];
|
|
1626
1822
|
n === $DELETED && (n = undefined);
|
|
1627
1823
|
if (!isWrappable(n)) return n;
|
|
1628
1824
|
const i = wrap(n, e);
|
|
1629
1825
|
Writing?.add(i);
|
|
1630
1826
|
return i;
|
|
1631
1827
|
}
|
|
1632
|
-
let
|
|
1633
|
-
|
|
1828
|
+
let l = r ? (s || !u ? read(i[t]) : (read(i[t]), c[t])) : c[t];
|
|
1829
|
+
l === $DELETED && (l = undefined);
|
|
1634
1830
|
if (!r) {
|
|
1635
|
-
if (!s && typeof
|
|
1831
|
+
if (!s && typeof l === "function" && !c.hasOwnProperty(t)) {
|
|
1636
1832
|
let t;
|
|
1637
1833
|
return !Array.isArray(e[STORE_VALUE]) &&
|
|
1638
1834
|
(t = Object.getPrototypeOf(e[STORE_VALUE])) &&
|
|
1639
1835
|
t !== Object.prototype
|
|
1640
|
-
?
|
|
1641
|
-
:
|
|
1836
|
+
? l.bind(c)
|
|
1837
|
+
: l;
|
|
1642
1838
|
} else if (getObserver()) {
|
|
1643
1839
|
return read(
|
|
1644
1840
|
getNode(
|
|
1645
1841
|
i,
|
|
1646
1842
|
t,
|
|
1647
|
-
isWrappable(
|
|
1843
|
+
isWrappable(l) ? wrap(l, e) : l,
|
|
1648
1844
|
e[STORE_FIREWALL],
|
|
1649
1845
|
isEqual,
|
|
1650
1846
|
e[STORE_OPTIMISTIC]
|
|
@@ -1652,7 +1848,7 @@ const storeTraps = {
|
|
|
1652
1848
|
);
|
|
1653
1849
|
}
|
|
1654
1850
|
}
|
|
1655
|
-
return isWrappable(
|
|
1851
|
+
return isWrappable(l) ? wrap(l, e) : l;
|
|
1656
1852
|
},
|
|
1657
1853
|
has(e, t) {
|
|
1658
1854
|
if (t === $PROXY || t === $TRACK || t === "__proto__") return true;
|
|
@@ -1671,8 +1867,8 @@ const storeTraps = {
|
|
|
1671
1867
|
if (writeOnly(i)) {
|
|
1672
1868
|
if (e[STORE_OPTIMISTIC]) {
|
|
1673
1869
|
const t = e[STORE_FIREWALL];
|
|
1674
|
-
if (t?.
|
|
1675
|
-
globalQueue.initTransition(t.
|
|
1870
|
+
if (t?.M) {
|
|
1871
|
+
globalQueue.initTransition(t.M);
|
|
1676
1872
|
}
|
|
1677
1873
|
}
|
|
1678
1874
|
untrack(() => {
|
|
@@ -1681,29 +1877,29 @@ const storeTraps = {
|
|
|
1681
1877
|
const s = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
1682
1878
|
const u = s ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
1683
1879
|
if (s) trackOptimisticStore(i);
|
|
1684
|
-
const
|
|
1880
|
+
const c =
|
|
1685
1881
|
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
1686
1882
|
? e[STORE_OPTIMISTIC_OVERRIDE][t]
|
|
1687
1883
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
1688
1884
|
? e[STORE_OVERRIDE][t]
|
|
1689
1885
|
: o;
|
|
1690
|
-
const
|
|
1691
|
-
if (
|
|
1886
|
+
const l = n?.[$TARGET]?.[STORE_VALUE] ?? n;
|
|
1887
|
+
if (c === l) return true;
|
|
1692
1888
|
const a = e[STORE_OPTIMISTIC_OVERRIDE]?.length || e[STORE_OVERRIDE]?.length || r.length;
|
|
1693
|
-
if (
|
|
1694
|
-
else (e[u] || (e[u] = Object.create(null)))[t] =
|
|
1695
|
-
const f = isWrappable(
|
|
1696
|
-
if (isWrappable(
|
|
1697
|
-
const e = PARENTS.get(
|
|
1698
|
-
e && (e instanceof Set ? e.delete(i) : PARENTS.delete(
|
|
1889
|
+
if (l !== undefined && l === o) delete e[u][t];
|
|
1890
|
+
else (e[u] || (e[u] = Object.create(null)))[t] = l;
|
|
1891
|
+
const f = isWrappable(l);
|
|
1892
|
+
if (isWrappable(c)) {
|
|
1893
|
+
const e = PARENTS.get(c);
|
|
1894
|
+
e && (e instanceof Set ? e.delete(i) : PARENTS.delete(c));
|
|
1699
1895
|
}
|
|
1700
|
-
if (recursivelyNotify(i, storeLookup) && f) recursivelyAddParent(
|
|
1896
|
+
if (recursivelyNotify(i, storeLookup) && f) recursivelyAddParent(l, i);
|
|
1701
1897
|
e[STORE_HAS]?.[t] && setSignal(e[STORE_HAS][t], true);
|
|
1702
1898
|
const E = getNodes(e, STORE_NODE);
|
|
1703
|
-
E[t] && setSignal(E[t], () => (f ? wrap(
|
|
1899
|
+
E[t] && setSignal(E[t], () => (f ? wrap(l, e) : l));
|
|
1704
1900
|
if (Array.isArray(r)) {
|
|
1705
1901
|
if (t === "length") {
|
|
1706
|
-
E.length && setSignal(E.length,
|
|
1902
|
+
E.length && setSignal(E.length, l);
|
|
1707
1903
|
} else {
|
|
1708
1904
|
const e = parseInt(t) + 1;
|
|
1709
1905
|
if (e > a) E.length && setSignal(E.length, e);
|
|
@@ -1861,7 +2057,7 @@ function deep(e) {
|
|
|
1861
2057
|
return e[$DEEP];
|
|
1862
2058
|
}
|
|
1863
2059
|
function createOptimisticStore(e, t, n) {
|
|
1864
|
-
GlobalQueue.
|
|
2060
|
+
GlobalQueue.ne ||= clearOptimisticStore;
|
|
1865
2061
|
const i = typeof e === "function";
|
|
1866
2062
|
const r = (i ? t : e) ?? {};
|
|
1867
2063
|
const o = i ? e : undefined;
|
|
@@ -1873,16 +2069,25 @@ function clearOptimisticStore(e) {
|
|
|
1873
2069
|
if (!t || !t[STORE_OPTIMISTIC_OVERRIDE]) return;
|
|
1874
2070
|
const n = t[STORE_OPTIMISTIC_OVERRIDE];
|
|
1875
2071
|
const i = t[STORE_NODE];
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
2072
|
+
setProjectionWriteActive(true);
|
|
2073
|
+
try {
|
|
2074
|
+
if (i) {
|
|
2075
|
+
for (const e of Reflect.ownKeys(n)) {
|
|
2076
|
+
if (i[e]) {
|
|
2077
|
+
i[e].H = undefined;
|
|
2078
|
+
const n =
|
|
2079
|
+
t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
|
|
2080
|
+
const r = n === $DELETED ? undefined : n;
|
|
2081
|
+
setSignal(i[e], isWrappable(r) ? wrap(r, t) : r);
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
if (i[$TRACK]) {
|
|
2085
|
+
i[$TRACK].H = undefined;
|
|
2086
|
+
setSignal(i[$TRACK], undefined);
|
|
1883
2087
|
}
|
|
1884
2088
|
}
|
|
1885
|
-
|
|
2089
|
+
} finally {
|
|
2090
|
+
setProjectionWriteActive(false);
|
|
1886
2091
|
}
|
|
1887
2092
|
delete t[STORE_OPTIMISTIC_OVERRIDE];
|
|
1888
2093
|
}
|
|
@@ -1928,12 +2133,12 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
1928
2133
|
setProjectionWriteActive(false);
|
|
1929
2134
|
}
|
|
1930
2135
|
});
|
|
1931
|
-
i.
|
|
2136
|
+
i.ye = true;
|
|
1932
2137
|
}
|
|
1933
2138
|
return { store: o, node: i };
|
|
1934
2139
|
}
|
|
1935
2140
|
function snapshot(e, t, n) {
|
|
1936
|
-
let i, r, o, s, u,
|
|
2141
|
+
let i, r, o, s, u, c;
|
|
1937
2142
|
if (!isWrappable(e)) return e;
|
|
1938
2143
|
if (t && t.has(e)) return t.get(e);
|
|
1939
2144
|
if (!t) t = new Map();
|
|
@@ -1953,26 +2158,26 @@ function snapshot(e, t, n) {
|
|
|
1953
2158
|
if (r) {
|
|
1954
2159
|
const i = o?.length || e.length;
|
|
1955
2160
|
for (let r = 0; r < i; r++) {
|
|
1956
|
-
|
|
1957
|
-
if (
|
|
1958
|
-
if ((u = snapshot(
|
|
2161
|
+
c = o && r in o ? o[r] : e[r];
|
|
2162
|
+
if (c === $DELETED) continue;
|
|
2163
|
+
if ((u = snapshot(c, t, n)) !== c || s) {
|
|
1959
2164
|
if (!s) t.set(e, (s = [...e]));
|
|
1960
2165
|
s[r] = u;
|
|
1961
2166
|
}
|
|
1962
2167
|
}
|
|
1963
2168
|
} else {
|
|
1964
2169
|
const i = getKeys(e, o);
|
|
1965
|
-
for (let r = 0,
|
|
1966
|
-
let
|
|
1967
|
-
const a = getPropertyDescriptor(e, o,
|
|
2170
|
+
for (let r = 0, l = i.length; r < l; r++) {
|
|
2171
|
+
let l = i[r];
|
|
2172
|
+
const a = getPropertyDescriptor(e, o, l);
|
|
1968
2173
|
if (a.get) continue;
|
|
1969
|
-
|
|
1970
|
-
if ((u = snapshot(
|
|
2174
|
+
c = o && l in o ? o[l] : e[l];
|
|
2175
|
+
if ((u = snapshot(c, t, n)) !== e[l] || s) {
|
|
1971
2176
|
if (!s) {
|
|
1972
2177
|
s = Object.create(Object.getPrototypeOf(e));
|
|
1973
2178
|
Object.assign(s, e);
|
|
1974
2179
|
}
|
|
1975
|
-
s[
|
|
2180
|
+
s[l] = u;
|
|
1976
2181
|
}
|
|
1977
2182
|
}
|
|
1978
2183
|
}
|
|
@@ -2112,281 +2317,289 @@ function mapArray(e, t, n) {
|
|
|
2112
2317
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2113
2318
|
return createMemo(
|
|
2114
2319
|
updateKeyedMap.bind({
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2320
|
+
We: createOwner(),
|
|
2321
|
+
Qe: 0,
|
|
2322
|
+
xe: e,
|
|
2323
|
+
Ge: [],
|
|
2324
|
+
Me: t,
|
|
2325
|
+
Fe: [],
|
|
2326
|
+
$e: [],
|
|
2327
|
+
He: i,
|
|
2328
|
+
je: i || n?.keyed === false ? [] : undefined,
|
|
2329
|
+
Ke: t.length > 1 ? [] : undefined,
|
|
2330
|
+
Ye: n?.fallback
|
|
2126
2331
|
})
|
|
2127
2332
|
);
|
|
2128
2333
|
}
|
|
2129
2334
|
const pureOptions = { pureWrite: true };
|
|
2130
2335
|
function updateKeyedMap() {
|
|
2131
|
-
const e = this.
|
|
2336
|
+
const e = this.xe() || [],
|
|
2132
2337
|
t = e.length;
|
|
2133
2338
|
e[$TRACK];
|
|
2134
|
-
runWithOwner(this.
|
|
2339
|
+
runWithOwner(this.We, () => {
|
|
2135
2340
|
let n,
|
|
2136
2341
|
i,
|
|
2137
|
-
r = this.
|
|
2342
|
+
r = this.je
|
|
2138
2343
|
? () => {
|
|
2139
|
-
this.
|
|
2140
|
-
this.
|
|
2141
|
-
return this.
|
|
2142
|
-
read.bind(null, this.
|
|
2143
|
-
this.
|
|
2344
|
+
this.je[i] = signal(e[i], pureOptions);
|
|
2345
|
+
this.Ke && (this.Ke[i] = signal(i, pureOptions));
|
|
2346
|
+
return this.Me(
|
|
2347
|
+
read.bind(null, this.je[i]),
|
|
2348
|
+
this.Ke ? read.bind(null, this.Ke[i]) : undefined
|
|
2144
2349
|
);
|
|
2145
2350
|
}
|
|
2146
|
-
: this.
|
|
2351
|
+
: this.Ke
|
|
2147
2352
|
? () => {
|
|
2148
2353
|
const t = e[i];
|
|
2149
|
-
this.
|
|
2150
|
-
return this.
|
|
2354
|
+
this.Ke[i] = signal(i, pureOptions);
|
|
2355
|
+
return this.Me(() => t, read.bind(null, this.Ke[i]));
|
|
2151
2356
|
}
|
|
2152
2357
|
: () => {
|
|
2153
2358
|
const t = e[i];
|
|
2154
|
-
return this.
|
|
2359
|
+
return this.Me(() => t);
|
|
2155
2360
|
};
|
|
2156
2361
|
if (t === 0) {
|
|
2157
|
-
if (this.
|
|
2158
|
-
this.
|
|
2159
|
-
this
|
|
2160
|
-
this.
|
|
2161
|
-
this.
|
|
2162
|
-
this.
|
|
2163
|
-
this.
|
|
2164
|
-
this.
|
|
2165
|
-
}
|
|
2166
|
-
if (this.
|
|
2167
|
-
this.
|
|
2168
|
-
}
|
|
2169
|
-
} else if (this.
|
|
2170
|
-
if (this
|
|
2171
|
-
this.
|
|
2362
|
+
if (this.Qe !== 0) {
|
|
2363
|
+
this.We.dispose(false);
|
|
2364
|
+
this.$e = [];
|
|
2365
|
+
this.Ge = [];
|
|
2366
|
+
this.Fe = [];
|
|
2367
|
+
this.Qe = 0;
|
|
2368
|
+
this.je && (this.je = []);
|
|
2369
|
+
this.Ke && (this.Ke = []);
|
|
2370
|
+
}
|
|
2371
|
+
if (this.Ye && !this.Fe[0]) {
|
|
2372
|
+
this.Fe[0] = runWithOwner((this.$e[0] = createOwner()), this.Ye);
|
|
2373
|
+
}
|
|
2374
|
+
} else if (this.Qe === 0) {
|
|
2375
|
+
if (this.$e[0]) this.$e[0].dispose();
|
|
2376
|
+
this.Fe = new Array(t);
|
|
2172
2377
|
for (i = 0; i < t; i++) {
|
|
2173
|
-
this.
|
|
2174
|
-
this.
|
|
2378
|
+
this.Ge[i] = e[i];
|
|
2379
|
+
this.Fe[i] = runWithOwner((this.$e[i] = createOwner()), r);
|
|
2175
2380
|
}
|
|
2176
|
-
this.
|
|
2381
|
+
this.Qe = t;
|
|
2177
2382
|
} else {
|
|
2178
2383
|
let o,
|
|
2179
2384
|
s,
|
|
2180
2385
|
u,
|
|
2181
|
-
l,
|
|
2182
2386
|
c,
|
|
2387
|
+
l,
|
|
2183
2388
|
a,
|
|
2184
2389
|
f,
|
|
2185
2390
|
E = new Array(t),
|
|
2186
2391
|
T = new Array(t),
|
|
2187
|
-
|
|
2188
|
-
|
|
2392
|
+
d = this.je ? new Array(t) : undefined,
|
|
2393
|
+
R = this.Ke ? new Array(t) : undefined;
|
|
2189
2394
|
for (
|
|
2190
|
-
o = 0, s = Math.min(this.
|
|
2191
|
-
o < s && (this.
|
|
2395
|
+
o = 0, s = Math.min(this.Qe, t);
|
|
2396
|
+
o < s && (this.Ge[o] === e[o] || (this.je && compare(this.He, this.Ge[o], e[o])));
|
|
2192
2397
|
o++
|
|
2193
2398
|
) {
|
|
2194
|
-
if (this.
|
|
2399
|
+
if (this.je) setSignal(this.je[o], e[o]);
|
|
2195
2400
|
}
|
|
2196
2401
|
for (
|
|
2197
|
-
s = this.
|
|
2402
|
+
s = this.Qe - 1, u = t - 1;
|
|
2198
2403
|
s >= o &&
|
|
2199
2404
|
u >= o &&
|
|
2200
|
-
(this.
|
|
2405
|
+
(this.Ge[s] === e[u] || (this.je && compare(this.He, this.Ge[s], e[u])));
|
|
2201
2406
|
s--, u--
|
|
2202
2407
|
) {
|
|
2203
|
-
E[u] = this.
|
|
2204
|
-
T[u] = this
|
|
2205
|
-
|
|
2206
|
-
|
|
2408
|
+
E[u] = this.Fe[s];
|
|
2409
|
+
T[u] = this.$e[s];
|
|
2410
|
+
d && (d[u] = this.je[s]);
|
|
2411
|
+
R && (R[u] = this.Ke[s]);
|
|
2207
2412
|
}
|
|
2208
2413
|
a = new Map();
|
|
2209
2414
|
f = new Array(u + 1);
|
|
2210
2415
|
for (i = u; i >= o; i--) {
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
n = a.get(
|
|
2416
|
+
c = e[i];
|
|
2417
|
+
l = this.He ? this.He(c) : c;
|
|
2418
|
+
n = a.get(l);
|
|
2214
2419
|
f[i] = n === undefined ? -1 : n;
|
|
2215
|
-
a.set(
|
|
2420
|
+
a.set(l, i);
|
|
2216
2421
|
}
|
|
2217
2422
|
for (n = o; n <= s; n++) {
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
i = a.get(
|
|
2423
|
+
c = this.Ge[n];
|
|
2424
|
+
l = this.He ? this.He(c) : c;
|
|
2425
|
+
i = a.get(l);
|
|
2221
2426
|
if (i !== undefined && i !== -1) {
|
|
2222
|
-
E[i] = this.
|
|
2223
|
-
T[i] = this
|
|
2224
|
-
|
|
2225
|
-
|
|
2427
|
+
E[i] = this.Fe[n];
|
|
2428
|
+
T[i] = this.$e[n];
|
|
2429
|
+
d && (d[i] = this.je[n]);
|
|
2430
|
+
R && (R[i] = this.Ke[n]);
|
|
2226
2431
|
i = f[i];
|
|
2227
|
-
a.set(
|
|
2228
|
-
} else this
|
|
2432
|
+
a.set(l, i);
|
|
2433
|
+
} else this.$e[n].dispose();
|
|
2229
2434
|
}
|
|
2230
2435
|
for (i = o; i < t; i++) {
|
|
2231
2436
|
if (i in E) {
|
|
2232
|
-
this.
|
|
2233
|
-
this
|
|
2234
|
-
if (R) {
|
|
2235
|
-
this.We[i] = R[i];
|
|
2236
|
-
setSignal(this.We[i], e[i]);
|
|
2237
|
-
}
|
|
2437
|
+
this.Fe[i] = E[i];
|
|
2438
|
+
this.$e[i] = T[i];
|
|
2238
2439
|
if (d) {
|
|
2239
|
-
this.
|
|
2240
|
-
setSignal(this.
|
|
2440
|
+
this.je[i] = d[i];
|
|
2441
|
+
setSignal(this.je[i], e[i]);
|
|
2442
|
+
}
|
|
2443
|
+
if (R) {
|
|
2444
|
+
this.Ke[i] = R[i];
|
|
2445
|
+
setSignal(this.Ke[i], i);
|
|
2241
2446
|
}
|
|
2242
2447
|
} else {
|
|
2243
|
-
this.
|
|
2448
|
+
this.Fe[i] = runWithOwner((this.$e[i] = createOwner()), r);
|
|
2244
2449
|
}
|
|
2245
2450
|
}
|
|
2246
|
-
this.
|
|
2247
|
-
this.
|
|
2451
|
+
this.Fe = this.Fe.slice(0, (this.Qe = t));
|
|
2452
|
+
this.Ge = e.slice(0);
|
|
2248
2453
|
}
|
|
2249
2454
|
});
|
|
2250
|
-
return this.
|
|
2455
|
+
return this.Fe;
|
|
2251
2456
|
}
|
|
2252
2457
|
function repeat(e, t, n) {
|
|
2253
2458
|
return updateRepeat.bind({
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2459
|
+
We: createOwner(),
|
|
2460
|
+
Qe: 0,
|
|
2461
|
+
Be: 0,
|
|
2462
|
+
Xe: e,
|
|
2463
|
+
Me: t,
|
|
2464
|
+
$e: [],
|
|
2465
|
+
Fe: [],
|
|
2466
|
+
qe: n?.from,
|
|
2467
|
+
Ye: n?.fallback
|
|
2263
2468
|
});
|
|
2264
2469
|
}
|
|
2265
2470
|
function updateRepeat() {
|
|
2266
|
-
const e = this.
|
|
2267
|
-
const t = this
|
|
2268
|
-
runWithOwner(this.
|
|
2471
|
+
const e = this.Xe();
|
|
2472
|
+
const t = this.qe?.() || 0;
|
|
2473
|
+
runWithOwner(this.We, () => {
|
|
2269
2474
|
if (e === 0) {
|
|
2270
|
-
if (this.
|
|
2271
|
-
this.
|
|
2272
|
-
this
|
|
2273
|
-
this.
|
|
2274
|
-
this.
|
|
2475
|
+
if (this.Qe !== 0) {
|
|
2476
|
+
this.We.dispose(false);
|
|
2477
|
+
this.$e = [];
|
|
2478
|
+
this.Fe = [];
|
|
2479
|
+
this.Qe = 0;
|
|
2275
2480
|
}
|
|
2276
|
-
if (this.
|
|
2277
|
-
this.
|
|
2481
|
+
if (this.Ye && !this.Fe[0]) {
|
|
2482
|
+
this.Fe[0] = runWithOwner((this.$e[0] = createOwner()), this.Ye);
|
|
2278
2483
|
}
|
|
2279
2484
|
return;
|
|
2280
2485
|
}
|
|
2281
2486
|
const n = t + e;
|
|
2282
|
-
const i = this.
|
|
2283
|
-
if (this.
|
|
2284
|
-
for (let e = n; e < i; e++) this
|
|
2285
|
-
if (this.
|
|
2286
|
-
let e = this.
|
|
2287
|
-
while (e < t && e < this.
|
|
2288
|
-
this.
|
|
2289
|
-
this.
|
|
2290
|
-
} else if (this.
|
|
2291
|
-
let n = i - this.
|
|
2292
|
-
let r = this.
|
|
2293
|
-
this.
|
|
2487
|
+
const i = this.Be + this.Qe;
|
|
2488
|
+
if (this.Qe === 0 && this.$e[0]) this.$e[0].dispose();
|
|
2489
|
+
for (let e = n; e < i; e++) this.$e[e - this.Be].dispose();
|
|
2490
|
+
if (this.Be < t) {
|
|
2491
|
+
let e = this.Be;
|
|
2492
|
+
while (e < t && e < this.Qe) this.$e[e++].dispose();
|
|
2493
|
+
this.$e.splice(0, t - this.Be);
|
|
2494
|
+
this.Fe.splice(0, t - this.Be);
|
|
2495
|
+
} else if (this.Be > t) {
|
|
2496
|
+
let n = i - this.Be - 1;
|
|
2497
|
+
let r = this.Be - t;
|
|
2498
|
+
this.$e.length = this.Fe.length = e;
|
|
2294
2499
|
while (n >= r) {
|
|
2295
|
-
this
|
|
2296
|
-
this.
|
|
2500
|
+
this.$e[n] = this.$e[n - r];
|
|
2501
|
+
this.Fe[n] = this.Fe[n - r];
|
|
2297
2502
|
n--;
|
|
2298
2503
|
}
|
|
2299
2504
|
for (let e = 0; e < r; e++) {
|
|
2300
|
-
this.
|
|
2505
|
+
this.Fe[e] = runWithOwner((this.$e[e] = createOwner()), () => this.Me(e + t));
|
|
2301
2506
|
}
|
|
2302
2507
|
}
|
|
2303
2508
|
for (let e = i; e < n; e++) {
|
|
2304
|
-
this.
|
|
2509
|
+
this.Fe[e - t] = runWithOwner((this.$e[e - t] = createOwner()), () => this.Me(e));
|
|
2305
2510
|
}
|
|
2306
|
-
this.
|
|
2307
|
-
this.
|
|
2308
|
-
this.
|
|
2511
|
+
this.Fe = this.Fe.slice(0, e);
|
|
2512
|
+
this.Be = t;
|
|
2513
|
+
this.Qe = e;
|
|
2309
2514
|
});
|
|
2310
|
-
return this.
|
|
2515
|
+
return this.Fe;
|
|
2311
2516
|
}
|
|
2312
2517
|
function compare(e, t, n) {
|
|
2313
2518
|
return e ? e(t) === e(n) : true;
|
|
2314
2519
|
}
|
|
2315
2520
|
function boundaryComputed(e, t) {
|
|
2316
2521
|
const n = computed(e, undefined, { lazy: true });
|
|
2317
|
-
n.
|
|
2318
|
-
const
|
|
2319
|
-
|
|
2320
|
-
n.
|
|
2522
|
+
n.ge = (e, t) => {
|
|
2523
|
+
const i = e !== undefined ? e : n.de;
|
|
2524
|
+
const r = t !== undefined ? t : n.re;
|
|
2525
|
+
n.de &= ~n.ze;
|
|
2526
|
+
n.fe.notify(n, n.ze, i, r);
|
|
2321
2527
|
};
|
|
2322
|
-
n.
|
|
2323
|
-
n.
|
|
2528
|
+
n.ze = t;
|
|
2529
|
+
n.ye = true;
|
|
2324
2530
|
recompute(n, true);
|
|
2325
2531
|
return n;
|
|
2326
2532
|
}
|
|
2327
2533
|
function createBoundChildren(e, t, n, i) {
|
|
2328
|
-
const r = e.
|
|
2329
|
-
r.addChild((e.
|
|
2330
|
-
onCleanup(() => r.removeChild(e.
|
|
2534
|
+
const r = e.fe;
|
|
2535
|
+
r.addChild((e.fe = n));
|
|
2536
|
+
onCleanup(() => r.removeChild(e.fe));
|
|
2331
2537
|
return runWithOwner(e, () => {
|
|
2332
2538
|
const e = computed(t);
|
|
2333
2539
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
2334
2540
|
});
|
|
2335
2541
|
}
|
|
2336
2542
|
class ConditionalQueue extends Queue {
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2543
|
+
Ze;
|
|
2544
|
+
Je = new Set();
|
|
2545
|
+
q = new Set();
|
|
2340
2546
|
constructor(e) {
|
|
2341
2547
|
super();
|
|
2342
|
-
this.
|
|
2548
|
+
this.Ze = e;
|
|
2343
2549
|
}
|
|
2344
2550
|
run(e) {
|
|
2345
|
-
if (!e || read(this.
|
|
2551
|
+
if (!e || read(this.Ze)) return;
|
|
2346
2552
|
return super.run(e);
|
|
2347
2553
|
}
|
|
2348
|
-
notify(e, t, n) {
|
|
2349
|
-
if (read(this.
|
|
2554
|
+
notify(e, t, n, i) {
|
|
2555
|
+
if (read(this.Ze)) {
|
|
2350
2556
|
if (t & STATUS_PENDING) {
|
|
2351
2557
|
if (n & STATUS_PENDING) {
|
|
2352
|
-
this.
|
|
2558
|
+
this.q.add(e);
|
|
2353
2559
|
t &= ~STATUS_PENDING;
|
|
2354
|
-
} else if (this.
|
|
2560
|
+
} else if (this.q.delete(e)) t &= ~STATUS_PENDING;
|
|
2355
2561
|
}
|
|
2356
2562
|
if (t & STATUS_ERROR) {
|
|
2357
2563
|
if (n & STATUS_ERROR) {
|
|
2358
|
-
this.
|
|
2564
|
+
this.Je.add(e);
|
|
2359
2565
|
t &= ~STATUS_ERROR;
|
|
2360
|
-
} else if (this.
|
|
2566
|
+
} else if (this.Je.delete(e)) t &= ~STATUS_ERROR;
|
|
2361
2567
|
}
|
|
2362
2568
|
}
|
|
2363
|
-
return t ? super.notify(e, t, n) : true;
|
|
2569
|
+
return t ? super.notify(e, t, n, i ?? e.re) : true;
|
|
2364
2570
|
}
|
|
2365
2571
|
}
|
|
2366
2572
|
class CollectionQueue extends Queue {
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2573
|
+
et;
|
|
2574
|
+
tt = new Set();
|
|
2575
|
+
Ze = signal(false, { pureWrite: true });
|
|
2576
|
+
nt = false;
|
|
2371
2577
|
constructor(e) {
|
|
2372
2578
|
super();
|
|
2373
|
-
this.
|
|
2579
|
+
this.et = e;
|
|
2374
2580
|
}
|
|
2375
2581
|
run(e) {
|
|
2376
|
-
if (!e || read(this.
|
|
2582
|
+
if (!e || read(this.Ze)) return;
|
|
2377
2583
|
return super.run(e);
|
|
2378
2584
|
}
|
|
2379
|
-
notify(e, t, n) {
|
|
2380
|
-
if (!(t & this.
|
|
2381
|
-
if (n & this.
|
|
2382
|
-
|
|
2383
|
-
if (
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2585
|
+
notify(e, t, n, i) {
|
|
2586
|
+
if (!(t & this.et) || (this.et & STATUS_PENDING && this.nt)) return super.notify(e, t, n, i);
|
|
2587
|
+
if (n & this.et) {
|
|
2588
|
+
const t = i?.t || e.re?.t;
|
|
2589
|
+
if (t) {
|
|
2590
|
+
const e = this.tt.size === 0;
|
|
2591
|
+
this.tt.add(t);
|
|
2592
|
+
if (e) setSignal(this.Ze, true);
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
t &= ~this.et;
|
|
2596
|
+
return t ? super.notify(e, t, n, i) : true;
|
|
2597
|
+
}
|
|
2598
|
+
checkSources() {
|
|
2599
|
+
for (const e of this.tt) {
|
|
2600
|
+
if (!(e.de & this.et)) this.tt.delete(e);
|
|
2387
2601
|
}
|
|
2388
|
-
|
|
2389
|
-
return t ? super.notify(e, t, n) : true;
|
|
2602
|
+
if (!this.tt.size) setSignal(this.Ze, false);
|
|
2390
2603
|
}
|
|
2391
2604
|
}
|
|
2392
2605
|
var BoundaryMode;
|
|
@@ -2399,26 +2612,26 @@ function createBoundary(e, t) {
|
|
|
2399
2612
|
const i = new ConditionalQueue(computed(() => t() === BoundaryMode.HIDDEN));
|
|
2400
2613
|
const r = createBoundChildren(n, e, i, 0);
|
|
2401
2614
|
computed(() => {
|
|
2402
|
-
const e = read(i.
|
|
2403
|
-
r.
|
|
2615
|
+
const e = read(i.Ze);
|
|
2616
|
+
r.ze = e ? STATUS_ERROR | STATUS_PENDING : 0;
|
|
2404
2617
|
if (!e) {
|
|
2405
|
-
i.
|
|
2406
|
-
i.
|
|
2407
|
-
i.
|
|
2408
|
-
i.
|
|
2618
|
+
i.q.forEach(e => i.notify(e, STATUS_PENDING, STATUS_PENDING, e.re));
|
|
2619
|
+
i.Je.forEach(e => i.notify(e, STATUS_ERROR, STATUS_ERROR, e.re));
|
|
2620
|
+
i.q.clear();
|
|
2621
|
+
i.Je.clear();
|
|
2409
2622
|
}
|
|
2410
2623
|
});
|
|
2411
|
-
return () => (read(i.
|
|
2624
|
+
return () => (read(i.Ze) ? undefined : read(r));
|
|
2412
2625
|
}
|
|
2413
2626
|
function createCollectionBoundary(e, t, n) {
|
|
2414
2627
|
const i = createOwner();
|
|
2415
2628
|
const r = new CollectionQueue(e);
|
|
2416
2629
|
const o = createBoundChildren(i, t, r, e);
|
|
2417
2630
|
const s = computed(() => {
|
|
2418
|
-
if (!read(r.
|
|
2631
|
+
if (!read(r.Ze)) {
|
|
2419
2632
|
const e = read(o);
|
|
2420
|
-
if (!untrack(() => read(r.
|
|
2421
|
-
r.
|
|
2633
|
+
if (!untrack(() => read(r.Ze))) {
|
|
2634
|
+
r.nt = true;
|
|
2422
2635
|
return e;
|
|
2423
2636
|
}
|
|
2424
2637
|
}
|
|
@@ -2429,26 +2642,12 @@ function createCollectionBoundary(e, t, n) {
|
|
|
2429
2642
|
function createLoadBoundary(e, t) {
|
|
2430
2643
|
return createCollectionBoundary(STATUS_PENDING, e, () => t());
|
|
2431
2644
|
}
|
|
2432
|
-
function collectErrorSources(e, t) {
|
|
2433
|
-
let n = true;
|
|
2434
|
-
let i = e.C;
|
|
2435
|
-
while (i !== null) {
|
|
2436
|
-
const e = i.V;
|
|
2437
|
-
if (e.C && e.ie & STATUS_ERROR) {
|
|
2438
|
-
n = false;
|
|
2439
|
-
collectErrorSources(e, t);
|
|
2440
|
-
}
|
|
2441
|
-
i = i.D;
|
|
2442
|
-
}
|
|
2443
|
-
n && t.push(e);
|
|
2444
|
-
}
|
|
2445
2645
|
function createErrorBoundary(e, t) {
|
|
2446
2646
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2447
|
-
let n = e.
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
for (const
|
|
2451
|
-
for (const e of t) recompute(e);
|
|
2647
|
+
let n = e.tt.values().next().value;
|
|
2648
|
+
const i = n.re?.cause ?? n.re;
|
|
2649
|
+
return t(i, () => {
|
|
2650
|
+
for (const t of e.tt) recompute(t);
|
|
2452
2651
|
schedule();
|
|
2453
2652
|
});
|
|
2454
2653
|
});
|