@solidjs/signals 0.9.7 → 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 +403 -179
- package/dist/node.cjs +1160 -954
- package/dist/prod.js +957 -757
- 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,107 +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
|
-
runHeap(dirtyQueue, GlobalQueue.j);
|
|
347
|
-
}
|
|
431
|
+
if (!t) checkBoundaryChildren(globalQueue);
|
|
432
|
+
if (dirtyQueue.S >= dirtyQueue.N) runHeap(dirtyQueue, GlobalQueue.ee);
|
|
348
433
|
if (n) {
|
|
349
|
-
const t = globalQueue.
|
|
434
|
+
const t = globalQueue.q;
|
|
350
435
|
for (let e = 0; e < t.length; e++) {
|
|
351
436
|
const n = t[e];
|
|
352
|
-
if (n.
|
|
353
|
-
n.
|
|
354
|
-
n.
|
|
355
|
-
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;
|
|
356
441
|
}
|
|
357
|
-
|
|
442
|
+
n.de &= ~STATUS_UNINITIALIZED;
|
|
443
|
+
if (n.U) GlobalQueue.te(n, false, true);
|
|
358
444
|
}
|
|
359
445
|
t.length = 0;
|
|
360
|
-
const n = e ? e.
|
|
446
|
+
const n = e ? e.Z : globalQueue.Z;
|
|
361
447
|
for (let e = 0; e < n.length; e++) {
|
|
362
448
|
const t = n[e];
|
|
363
|
-
const i = t.
|
|
364
|
-
|
|
365
|
-
|
|
449
|
+
const i = t.K;
|
|
450
|
+
t.H = undefined;
|
|
451
|
+
if (i !== NOT_PENDING && t.Te !== i) {
|
|
452
|
+
t.Te = i;
|
|
366
453
|
insertSubs(t, true);
|
|
367
454
|
}
|
|
368
|
-
t.
|
|
369
|
-
t.
|
|
455
|
+
t.K = NOT_PENDING;
|
|
456
|
+
t.M = null;
|
|
370
457
|
}
|
|
371
458
|
n.length = 0;
|
|
372
|
-
const i = e ? e.
|
|
373
|
-
if (GlobalQueue.
|
|
459
|
+
const i = e ? e.J : globalQueue.J;
|
|
460
|
+
if (GlobalQueue.ne && i.size) {
|
|
374
461
|
for (const e of i) {
|
|
375
|
-
GlobalQueue.
|
|
462
|
+
GlobalQueue.ne(e);
|
|
376
463
|
}
|
|
377
464
|
i.clear();
|
|
378
465
|
schedule();
|
|
379
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);
|
|
380
487
|
}
|
|
381
488
|
}
|
|
382
489
|
function trackOptimisticStore(e) {
|
|
383
|
-
globalQueue.
|
|
490
|
+
globalQueue.J.add(e);
|
|
384
491
|
schedule();
|
|
385
492
|
}
|
|
386
|
-
function
|
|
493
|
+
function reassignPendingTransition(e) {
|
|
387
494
|
for (let t = 0; t < e.length; t++) {
|
|
388
|
-
e[t].
|
|
495
|
+
e[t].M = activeTransition;
|
|
389
496
|
}
|
|
390
497
|
}
|
|
391
498
|
const globalQueue = new GlobalQueue();
|
|
@@ -398,20 +505,20 @@ function runQueue(e, t) {
|
|
|
398
505
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
399
506
|
}
|
|
400
507
|
function transitionComplete(e) {
|
|
401
|
-
if (e.
|
|
402
|
-
if (e.
|
|
508
|
+
if (e.ce) return true;
|
|
509
|
+
if (e.ue.length) return false;
|
|
403
510
|
let t = true;
|
|
404
|
-
for (let n = 0; n < e.
|
|
405
|
-
if (e.
|
|
511
|
+
for (let n = 0; n < e.oe.length; n++) {
|
|
512
|
+
if (e.oe[n].de & STATUS_PENDING) {
|
|
406
513
|
t = false;
|
|
407
514
|
break;
|
|
408
515
|
}
|
|
409
516
|
}
|
|
410
|
-
t && (e.
|
|
517
|
+
t && (e.ce = true);
|
|
411
518
|
return t;
|
|
412
519
|
}
|
|
413
520
|
function currentTransition(e) {
|
|
414
|
-
while (e.
|
|
521
|
+
while (e.ce && typeof e.ce === "object") e = e.ce;
|
|
415
522
|
return e;
|
|
416
523
|
}
|
|
417
524
|
function runInTransition(e, t) {
|
|
@@ -435,11 +542,11 @@ function action(e) {
|
|
|
435
542
|
const r = e(...t);
|
|
436
543
|
globalQueue.initTransition();
|
|
437
544
|
let o = activeTransition;
|
|
438
|
-
o.
|
|
545
|
+
o.ue.push(r);
|
|
439
546
|
const done = (e, t) => {
|
|
440
547
|
o = currentTransition(o);
|
|
441
|
-
const s = o.
|
|
442
|
-
if (s >= 0) o.
|
|
548
|
+
const s = o.ue.indexOf(r);
|
|
549
|
+
if (s >= 0) o.ue.splice(s, 1);
|
|
443
550
|
activeTransition = o;
|
|
444
551
|
schedule();
|
|
445
552
|
t ? i(t) : n(e);
|
|
@@ -467,8 +574,8 @@ function action(e) {
|
|
|
467
574
|
step();
|
|
468
575
|
});
|
|
469
576
|
}
|
|
470
|
-
GlobalQueue.
|
|
471
|
-
GlobalQueue.
|
|
577
|
+
GlobalQueue.ee = recompute;
|
|
578
|
+
GlobalQueue.te = disposeChildren;
|
|
472
579
|
let tracking = false;
|
|
473
580
|
let stale = false;
|
|
474
581
|
let refreshing = false;
|
|
@@ -477,105 +584,145 @@ let foundPending = false;
|
|
|
477
584
|
let pendingReadActive = false;
|
|
478
585
|
let context = null;
|
|
479
586
|
function recompute(e, t = false) {
|
|
480
|
-
const n = e.
|
|
587
|
+
const n = e.le;
|
|
481
588
|
if (!t) {
|
|
482
|
-
if (e.
|
|
483
|
-
globalQueue.initTransition(e.
|
|
484
|
-
deleteFromHeap(e, e.
|
|
485
|
-
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);
|
|
486
593
|
else {
|
|
487
594
|
markDisposal(e);
|
|
488
|
-
e.
|
|
489
|
-
e.
|
|
490
|
-
e.
|
|
491
|
-
e.
|
|
595
|
+
e.Re = e.Oe;
|
|
596
|
+
e.Se = e._e;
|
|
597
|
+
e.Oe = null;
|
|
598
|
+
e._e = null;
|
|
492
599
|
}
|
|
493
600
|
}
|
|
494
|
-
const i = !!(e.
|
|
495
|
-
const r = e
|
|
496
|
-
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;
|
|
497
605
|
context = e;
|
|
498
|
-
e.
|
|
499
|
-
e.
|
|
500
|
-
e.
|
|
501
|
-
let
|
|
502
|
-
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;
|
|
503
611
|
let l = tracking;
|
|
504
|
-
let
|
|
612
|
+
let a = currentOptimisticLane;
|
|
505
613
|
tracking = true;
|
|
506
|
-
if (i)
|
|
614
|
+
if (i) {
|
|
615
|
+
const t = resolveLane(e);
|
|
616
|
+
if (t) setCurrentOptimisticLane(t);
|
|
617
|
+
}
|
|
507
618
|
try {
|
|
508
|
-
|
|
619
|
+
u = handleAsync(e, e.U(u));
|
|
509
620
|
clearStatus(e);
|
|
621
|
+
const t = resolveLane(e);
|
|
622
|
+
if (t) t.k.delete(e);
|
|
510
623
|
} catch (t) {
|
|
511
|
-
if (t instanceof NotReadyError) {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
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
|
+
);
|
|
515
638
|
} finally {
|
|
516
639
|
tracking = l;
|
|
517
|
-
e.
|
|
518
|
-
context =
|
|
640
|
+
e._ = REACTIVE_NONE;
|
|
641
|
+
context = s;
|
|
519
642
|
}
|
|
520
|
-
if (!e.
|
|
521
|
-
const
|
|
522
|
-
let l =
|
|
643
|
+
if (!e.re) {
|
|
644
|
+
const s = e.Ie;
|
|
645
|
+
let l = s !== null ? s.m : e.D;
|
|
523
646
|
if (l !== null) {
|
|
524
647
|
do {
|
|
525
648
|
l = unlinkSubs(l);
|
|
526
649
|
} while (l !== null);
|
|
527
|
-
if (
|
|
528
|
-
else e.
|
|
529
|
-
}
|
|
530
|
-
const
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
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);
|
|
538
672
|
}
|
|
539
673
|
}
|
|
540
674
|
}
|
|
541
|
-
|
|
542
|
-
(!t || e.
|
|
543
|
-
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));
|
|
544
678
|
}
|
|
545
679
|
function handleAsync(e, t, n) {
|
|
546
680
|
const i = typeof t === "object" && t !== null;
|
|
547
681
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
548
682
|
const o = !r && i && untrack(() => typeof t.then === "function");
|
|
549
683
|
if (!o && !r) {
|
|
550
|
-
e.
|
|
684
|
+
e.he = null;
|
|
551
685
|
return t;
|
|
552
686
|
}
|
|
553
|
-
e.
|
|
687
|
+
e.he = t;
|
|
554
688
|
let s;
|
|
555
689
|
const handleError = n => {
|
|
556
|
-
if (e.
|
|
557
|
-
globalQueue.initTransition(e.
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
notifyStatus(e, STATUS_PENDING, n);
|
|
561
|
-
} else notifyStatus(e, STATUS_ERROR, n);
|
|
562
|
-
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;
|
|
563
694
|
};
|
|
564
695
|
const asyncWrite = (i, r) => {
|
|
565
|
-
if (e.
|
|
566
|
-
|
|
696
|
+
if (e.he !== t) return;
|
|
697
|
+
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
698
|
+
globalQueue.initTransition(e.M);
|
|
567
699
|
clearStatus(e);
|
|
700
|
+
const o = resolveLane(e);
|
|
701
|
+
if (o) o.k.delete(e);
|
|
568
702
|
if (n) n(i);
|
|
569
|
-
else if (e.
|
|
570
|
-
const t = e.
|
|
571
|
-
if (e.U) e.
|
|
703
|
+
else if (e.j) {
|
|
704
|
+
const t = e.K !== NOT_PENDING;
|
|
705
|
+
if (e.U) e.K = i;
|
|
572
706
|
if (!t) {
|
|
573
|
-
e.
|
|
707
|
+
e.Te = i;
|
|
574
708
|
insertSubs(e);
|
|
575
709
|
}
|
|
576
|
-
e.
|
|
577
|
-
|
|
578
|
-
|
|
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();
|
|
579
726
|
flush();
|
|
580
727
|
r?.();
|
|
581
728
|
};
|
|
@@ -595,7 +742,7 @@ function handleAsync(e, t, n) {
|
|
|
595
742
|
);
|
|
596
743
|
i = false;
|
|
597
744
|
if (!n) {
|
|
598
|
-
globalQueue.initTransition(e.
|
|
745
|
+
globalQueue.initTransition(e.M);
|
|
599
746
|
throw new NotReadyError(context);
|
|
600
747
|
}
|
|
601
748
|
}
|
|
@@ -627,177 +774,191 @@ function handleAsync(e, t, n) {
|
|
|
627
774
|
};
|
|
628
775
|
const r = iterate();
|
|
629
776
|
if (!i && !r) {
|
|
630
|
-
globalQueue.initTransition(e.
|
|
777
|
+
globalQueue.initTransition(e.M);
|
|
631
778
|
throw new NotReadyError(context);
|
|
632
779
|
}
|
|
633
780
|
}
|
|
634
781
|
return s;
|
|
635
782
|
}
|
|
636
783
|
function clearStatus(e) {
|
|
637
|
-
e.
|
|
638
|
-
e.
|
|
784
|
+
e.de = e.de & STATUS_UNINITIALIZED;
|
|
785
|
+
e.re = null;
|
|
639
786
|
updatePendingSignal(e);
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
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();
|
|
649
816
|
}
|
|
650
|
-
|
|
817
|
+
return;
|
|
651
818
|
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
if (e.Te) return e.Te();
|
|
658
|
-
for (let i = e.p; i !== null; i = i.I) {
|
|
659
|
-
i.h.ae = clock;
|
|
660
|
-
if (i.h.B !== n) {
|
|
661
|
-
!i.h.X && globalQueue.L.push(i.h);
|
|
662
|
-
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);
|
|
663
824
|
}
|
|
664
825
|
}
|
|
665
|
-
for (let i = e.
|
|
666
|
-
for (let e = i.p; e !== null; e = e.
|
|
667
|
-
e.
|
|
668
|
-
if (e.
|
|
669
|
-
!e.
|
|
670
|
-
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);
|
|
671
832
|
}
|
|
672
833
|
}
|
|
673
834
|
}
|
|
674
835
|
}
|
|
675
836
|
function updateIfNecessary(e) {
|
|
676
|
-
if (e.
|
|
677
|
-
for (let t = e.
|
|
837
|
+
if (e._ & REACTIVE_CHECK) {
|
|
838
|
+
for (let t = e.D; t; t = t.m) {
|
|
678
839
|
const n = t.V;
|
|
679
|
-
const i = n.
|
|
840
|
+
const i = n.L || n;
|
|
680
841
|
if (i.U) {
|
|
681
842
|
updateIfNecessary(i);
|
|
682
843
|
}
|
|
683
|
-
if (e.
|
|
844
|
+
if (e._ & REACTIVE_DIRTY) {
|
|
684
845
|
break;
|
|
685
846
|
}
|
|
686
847
|
}
|
|
687
848
|
}
|
|
688
|
-
if (e.
|
|
849
|
+
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.re && e.se < clock)) {
|
|
689
850
|
recompute(e);
|
|
690
851
|
}
|
|
691
|
-
e.
|
|
852
|
+
e._ = REACTIVE_NONE;
|
|
692
853
|
}
|
|
693
854
|
function unlinkSubs(e) {
|
|
694
855
|
const t = e.V;
|
|
695
|
-
const n = e.
|
|
696
|
-
const i = e.
|
|
697
|
-
const r = e.
|
|
698
|
-
if (i !== null) i.
|
|
699
|
-
else t.
|
|
700
|
-
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;
|
|
701
862
|
else {
|
|
702
863
|
t.p = i;
|
|
703
864
|
if (i === null) {
|
|
704
|
-
t.
|
|
705
|
-
t.U && !t.
|
|
865
|
+
t.Ne?.();
|
|
866
|
+
t.U && !t.ye && unobserved(t);
|
|
706
867
|
}
|
|
707
868
|
}
|
|
708
869
|
return n;
|
|
709
870
|
}
|
|
710
871
|
function unobserved(e) {
|
|
711
|
-
deleteFromHeap(e, e.
|
|
712
|
-
let t = e.
|
|
872
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
873
|
+
let t = e.D;
|
|
713
874
|
while (t !== null) {
|
|
714
875
|
t = unlinkSubs(t);
|
|
715
876
|
}
|
|
716
|
-
e.
|
|
877
|
+
e.D = null;
|
|
717
878
|
disposeChildren(e, true);
|
|
718
879
|
}
|
|
719
880
|
function link(e, t) {
|
|
720
|
-
const n = t.
|
|
881
|
+
const n = t.Ie;
|
|
721
882
|
if (n !== null && n.V === e) return;
|
|
722
883
|
let i = null;
|
|
723
|
-
const r = t.
|
|
884
|
+
const r = t._ & REACTIVE_RECOMPUTING_DEPS;
|
|
724
885
|
if (r) {
|
|
725
|
-
i = n !== null ? n.
|
|
886
|
+
i = n !== null ? n.m : t.D;
|
|
726
887
|
if (i !== null && i.V === e) {
|
|
727
|
-
t.
|
|
888
|
+
t.Ie = i;
|
|
728
889
|
return;
|
|
729
890
|
}
|
|
730
891
|
}
|
|
731
|
-
const o = e.
|
|
732
|
-
if (o !== null && o.
|
|
733
|
-
const s = (t.
|
|
734
|
-
if (n !== null) n.
|
|
735
|
-
else t.
|
|
736
|
-
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;
|
|
737
898
|
else e.p = s;
|
|
738
899
|
}
|
|
739
900
|
function isValidLink(e, t) {
|
|
740
|
-
const n = t.
|
|
901
|
+
const n = t.Ie;
|
|
741
902
|
if (n !== null) {
|
|
742
|
-
let i = t.
|
|
903
|
+
let i = t.D;
|
|
743
904
|
do {
|
|
744
905
|
if (i === e) return true;
|
|
745
906
|
if (i === n) break;
|
|
746
|
-
i = i.
|
|
907
|
+
i = i.m;
|
|
747
908
|
} while (i !== null);
|
|
748
909
|
}
|
|
749
910
|
return false;
|
|
750
911
|
}
|
|
751
912
|
function markDisposal(e) {
|
|
752
|
-
let t = e.
|
|
913
|
+
let t = e._e;
|
|
753
914
|
while (t) {
|
|
754
|
-
t.
|
|
755
|
-
if (t.
|
|
915
|
+
t._ |= REACTIVE_ZOMBIE;
|
|
916
|
+
if (t._ & REACTIVE_IN_HEAP) {
|
|
756
917
|
deleteFromHeap(t, dirtyQueue);
|
|
757
918
|
insertIntoHeap(t, zombieQueue);
|
|
758
919
|
}
|
|
759
920
|
markDisposal(t);
|
|
760
|
-
t = t.
|
|
921
|
+
t = t.De;
|
|
761
922
|
}
|
|
762
923
|
}
|
|
763
924
|
function dispose(e) {
|
|
764
|
-
let t = e.
|
|
925
|
+
let t = e.D || null;
|
|
765
926
|
do {
|
|
766
927
|
t = unlinkSubs(t);
|
|
767
928
|
} while (t !== null);
|
|
768
|
-
e.
|
|
769
|
-
e.
|
|
929
|
+
e.D = null;
|
|
930
|
+
e.Ie = null;
|
|
770
931
|
disposeChildren(e, true);
|
|
771
932
|
}
|
|
772
933
|
function disposeChildren(e, t = false, n) {
|
|
773
|
-
if (e.
|
|
774
|
-
if (t) e.
|
|
775
|
-
let i = n ? e.
|
|
934
|
+
if (e._ & REACTIVE_DISPOSED) return;
|
|
935
|
+
if (t) e._ = REACTIVE_DISPOSED;
|
|
936
|
+
let i = n ? e.Se : e._e;
|
|
776
937
|
while (i) {
|
|
777
|
-
const e = i.
|
|
778
|
-
if (i.
|
|
938
|
+
const e = i.De;
|
|
939
|
+
if (i.D) {
|
|
779
940
|
const e = i;
|
|
780
|
-
deleteFromHeap(e, e.
|
|
781
|
-
let t = e.
|
|
941
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
942
|
+
let t = e.D;
|
|
782
943
|
do {
|
|
783
944
|
t = unlinkSubs(t);
|
|
784
945
|
} while (t !== null);
|
|
785
|
-
e.
|
|
786
|
-
e.
|
|
946
|
+
e.D = null;
|
|
947
|
+
e.Ie = null;
|
|
787
948
|
}
|
|
788
949
|
disposeChildren(i, true);
|
|
789
950
|
i = e;
|
|
790
951
|
}
|
|
791
952
|
if (n) {
|
|
792
|
-
e.
|
|
953
|
+
e.Se = null;
|
|
793
954
|
} else {
|
|
794
|
-
e.ue = null;
|
|
795
955
|
e._e = null;
|
|
956
|
+
e.De = null;
|
|
796
957
|
}
|
|
797
958
|
runDisposal(e, n);
|
|
798
959
|
}
|
|
799
960
|
function runDisposal(e, t) {
|
|
800
|
-
let n = t ? e.
|
|
961
|
+
let n = t ? e.Re : e.Oe;
|
|
801
962
|
if (!n) return;
|
|
802
963
|
if (Array.isArray(n)) {
|
|
803
964
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -807,10 +968,10 @@ function runDisposal(e, t) {
|
|
|
807
968
|
} else {
|
|
808
969
|
n.call(n);
|
|
809
970
|
}
|
|
810
|
-
t ? (e.
|
|
971
|
+
t ? (e.Re = null) : (e.Oe = null);
|
|
811
972
|
}
|
|
812
973
|
function getNextChildId(e) {
|
|
813
|
-
if (e.id != null) return formatId(e.id, e.
|
|
974
|
+
if (e.id != null) return formatId(e.id, e.ve++);
|
|
814
975
|
throw new Error("Cannot get child id from owner without an id");
|
|
815
976
|
}
|
|
816
977
|
function formatId(e, t) {
|
|
@@ -821,102 +982,117 @@ function formatId(e, t) {
|
|
|
821
982
|
function computed(e, t, n) {
|
|
822
983
|
const i = {
|
|
823
984
|
id: n?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
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,
|
|
831
992
|
U: e,
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
993
|
+
Te: t,
|
|
994
|
+
u: 0,
|
|
995
|
+
P: null,
|
|
996
|
+
O: undefined,
|
|
997
|
+
R: null,
|
|
998
|
+
D: null,
|
|
999
|
+
Ie: null,
|
|
839
1000
|
p: null,
|
|
840
|
-
|
|
841
|
-
|
|
1001
|
+
Ce: null,
|
|
1002
|
+
o: context,
|
|
1003
|
+
De: null,
|
|
842
1004
|
_e: null,
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
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
|
|
852
1013
|
};
|
|
853
|
-
i.
|
|
854
|
-
const r = context?.
|
|
1014
|
+
i.R = i;
|
|
1015
|
+
const r = context?.i ? context.l : context;
|
|
855
1016
|
if (context) {
|
|
856
|
-
const e = context.
|
|
1017
|
+
const e = context._e;
|
|
857
1018
|
if (e === null) {
|
|
858
|
-
context.
|
|
1019
|
+
context._e = i;
|
|
859
1020
|
} else {
|
|
860
|
-
i.
|
|
861
|
-
context.
|
|
1021
|
+
i.De = e;
|
|
1022
|
+
context._e = i;
|
|
862
1023
|
}
|
|
863
1024
|
}
|
|
864
|
-
if (r) i.
|
|
1025
|
+
if (r) i.u = r.u + 1;
|
|
865
1026
|
!n?.lazy && recompute(i, true);
|
|
866
1027
|
return i;
|
|
867
1028
|
}
|
|
868
1029
|
function signal(e, t, n = null) {
|
|
869
1030
|
const i = {
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
1031
|
+
pe: t?.equals != null ? t.equals : isEqual,
|
|
1032
|
+
we: !!t?.pureWrite,
|
|
1033
|
+
Ne: t?.unobserved,
|
|
1034
|
+
Te: e,
|
|
874
1035
|
p: null,
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
1036
|
+
Ce: null,
|
|
1037
|
+
se: clock,
|
|
1038
|
+
L: n,
|
|
1039
|
+
C: n?.P || null,
|
|
1040
|
+
K: NOT_PENDING
|
|
880
1041
|
};
|
|
881
|
-
n && (n.
|
|
1042
|
+
n && (n.P = i);
|
|
882
1043
|
return i;
|
|
883
1044
|
}
|
|
884
1045
|
function optimisticSignal(e, t) {
|
|
885
1046
|
const n = signal(e, t);
|
|
886
|
-
n.
|
|
1047
|
+
n.j = true;
|
|
887
1048
|
return n;
|
|
888
1049
|
}
|
|
889
1050
|
function optimisticComputed(e, t, n) {
|
|
890
1051
|
const i = computed(e, t, n);
|
|
891
|
-
i.
|
|
1052
|
+
i.j = true;
|
|
892
1053
|
return i;
|
|
893
1054
|
}
|
|
894
1055
|
function getPendingSignal(e) {
|
|
895
|
-
if (!e.
|
|
896
|
-
e.
|
|
897
|
-
if (computePendingState(e)) setSignal(e.
|
|
1056
|
+
if (!e.me) {
|
|
1057
|
+
e.me = optimisticSignal(false, { pureWrite: true });
|
|
1058
|
+
if (computePendingState(e)) setSignal(e.me, true);
|
|
898
1059
|
}
|
|
899
|
-
return e.
|
|
1060
|
+
return e.me;
|
|
900
1061
|
}
|
|
901
1062
|
function computePendingState(e) {
|
|
902
|
-
if (e.te !== NOT_PENDING) return true;
|
|
903
1063
|
const t = e;
|
|
904
|
-
|
|
1064
|
+
if (e.K !== NOT_PENDING && !(t.de & STATUS_UNINITIALIZED)) return true;
|
|
1065
|
+
return !!(t.de & STATUS_PENDING && !(t.de & STATUS_UNINITIALIZED));
|
|
905
1066
|
}
|
|
906
1067
|
function getPendingValueComputed(e) {
|
|
907
|
-
if (!e.
|
|
1068
|
+
if (!e.Ae) {
|
|
908
1069
|
const t = pendingReadActive;
|
|
909
1070
|
pendingReadActive = false;
|
|
910
1071
|
const n = context;
|
|
911
1072
|
context = null;
|
|
912
|
-
e.
|
|
1073
|
+
e.Ae = optimisticComputed(() => read(e));
|
|
913
1074
|
context = n;
|
|
914
1075
|
pendingReadActive = t;
|
|
915
1076
|
}
|
|
916
|
-
return e.
|
|
1077
|
+
return e.Ae;
|
|
917
1078
|
}
|
|
918
1079
|
function updatePendingSignal(e) {
|
|
919
|
-
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
|
+
}
|
|
920
1096
|
}
|
|
921
1097
|
function isEqual(e, t) {
|
|
922
1098
|
return e === t;
|
|
@@ -932,7 +1108,7 @@ function untrack(e) {
|
|
|
932
1108
|
}
|
|
933
1109
|
function read(e) {
|
|
934
1110
|
if (pendingCheckActive) {
|
|
935
|
-
const t = e.
|
|
1111
|
+
const t = e.L || e;
|
|
936
1112
|
const n = getPendingSignal(t);
|
|
937
1113
|
const i = pendingCheckActive;
|
|
938
1114
|
pendingCheckActive = false;
|
|
@@ -940,7 +1116,7 @@ function read(e) {
|
|
|
940
1116
|
foundPending = true;
|
|
941
1117
|
}
|
|
942
1118
|
pendingCheckActive = i;
|
|
943
|
-
return e.
|
|
1119
|
+
return e.Te;
|
|
944
1120
|
}
|
|
945
1121
|
if (pendingReadActive) {
|
|
946
1122
|
const t = getPendingValueComputed(e);
|
|
@@ -948,76 +1124,93 @@ function read(e) {
|
|
|
948
1124
|
pendingReadActive = false;
|
|
949
1125
|
const i = read(t);
|
|
950
1126
|
pendingReadActive = n;
|
|
951
|
-
if (t.
|
|
1127
|
+
if (t.de & STATUS_PENDING) return e.Te;
|
|
952
1128
|
return i;
|
|
953
1129
|
}
|
|
954
1130
|
let t = context;
|
|
955
|
-
if (t?.
|
|
1131
|
+
if (t?.i) t = t.l;
|
|
956
1132
|
if (refreshing && e.U) recompute(e);
|
|
957
1133
|
if (t && tracking) {
|
|
958
|
-
if (e.U && e.
|
|
1134
|
+
if (e.U && e._ & REACTIVE_DISPOSED) recompute(e);
|
|
959
1135
|
link(e, t);
|
|
960
|
-
const n = e.
|
|
1136
|
+
const n = e.L || e;
|
|
961
1137
|
if (n.U) {
|
|
962
|
-
const i = e.
|
|
963
|
-
if (n.
|
|
1138
|
+
const i = e._ & REACTIVE_ZOMBIE;
|
|
1139
|
+
if (n.u >= (i ? zombieQueue.N : dirtyQueue.N)) {
|
|
964
1140
|
markNode(t);
|
|
965
1141
|
markHeap(i ? zombieQueue : dirtyQueue);
|
|
966
1142
|
updateIfNecessary(n);
|
|
967
1143
|
}
|
|
968
|
-
const r = n.
|
|
969
|
-
if (r >= t.
|
|
970
|
-
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;
|
|
971
1158
|
}
|
|
1159
|
+
} else {
|
|
1160
|
+
if (!tracking) link(e, t);
|
|
1161
|
+
throw n.re;
|
|
972
1162
|
}
|
|
973
1163
|
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
t &&
|
|
977
|
-
!optimisticReadActive &&
|
|
978
|
-
n.ie & STATUS_PENDING &&
|
|
979
|
-
!(stale && n.X && activeTransition !== n.X)
|
|
980
|
-
)
|
|
981
|
-
throw n.B;
|
|
982
|
-
if (e.U && e.ie & STATUS_ERROR) {
|
|
983
|
-
if (e.ae < clock) {
|
|
1164
|
+
if (e.U && e.de & STATUS_ERROR) {
|
|
1165
|
+
if (e.se < clock) {
|
|
984
1166
|
recompute(e, true);
|
|
985
1167
|
return read(e);
|
|
986
|
-
} else throw e.
|
|
1168
|
+
} else throw e.re;
|
|
987
1169
|
}
|
|
988
1170
|
return !t ||
|
|
989
|
-
|
|
990
|
-
e.
|
|
991
|
-
(stale && e.
|
|
992
|
-
? e.
|
|
993
|
-
: e.
|
|
1171
|
+
currentOptimisticLane !== null ||
|
|
1172
|
+
e.K === NOT_PENDING ||
|
|
1173
|
+
(stale && e.M && activeTransition !== e.M)
|
|
1174
|
+
? e.Te
|
|
1175
|
+
: e.K;
|
|
994
1176
|
}
|
|
995
1177
|
function setSignal(e, t) {
|
|
996
|
-
if (e.
|
|
997
|
-
const n = e.
|
|
998
|
-
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;
|
|
999
1181
|
if (typeof t === "function") t = t(i);
|
|
1000
|
-
const r = !e.
|
|
1001
|
-
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
|
+
}
|
|
1002
1190
|
if (n) {
|
|
1003
|
-
const n = e
|
|
1004
|
-
if (e.
|
|
1005
|
-
globalQueue.initTransition(e.
|
|
1191
|
+
const n = globalQueue.Z.includes(e);
|
|
1192
|
+
if (e.M && n) {
|
|
1193
|
+
globalQueue.initTransition(e.M);
|
|
1006
1194
|
}
|
|
1007
|
-
if (
|
|
1008
|
-
e.
|
|
1009
|
-
globalQueue.H.push(e);
|
|
1195
|
+
if (e.K === NOT_PENDING) {
|
|
1196
|
+
e.K = e.Te;
|
|
1010
1197
|
}
|
|
1011
|
-
|
|
1198
|
+
if (!n) {
|
|
1199
|
+
globalQueue.Z.push(e);
|
|
1200
|
+
}
|
|
1201
|
+
e.$ = (e.$ || 0) + 1;
|
|
1202
|
+
const i = getOrCreateLane(e);
|
|
1203
|
+
e.H = i;
|
|
1204
|
+
e.Te = t;
|
|
1012
1205
|
} else {
|
|
1013
|
-
if (e.
|
|
1014
|
-
e.
|
|
1206
|
+
if (e.K === NOT_PENDING) globalQueue.q.push(e);
|
|
1207
|
+
e.K = t;
|
|
1015
1208
|
}
|
|
1016
1209
|
updatePendingSignal(e);
|
|
1017
|
-
if (e.
|
|
1018
|
-
setSignal(e.
|
|
1210
|
+
if (e.Ae) {
|
|
1211
|
+
setSignal(e.Ae, t);
|
|
1019
1212
|
}
|
|
1020
|
-
e.
|
|
1213
|
+
e.se = clock;
|
|
1021
1214
|
insertSubs(e, n);
|
|
1022
1215
|
schedule();
|
|
1023
1216
|
return t;
|
|
@@ -1032,37 +1225,37 @@ function getOwner() {
|
|
|
1032
1225
|
}
|
|
1033
1226
|
function onCleanup(e) {
|
|
1034
1227
|
if (!context) return e;
|
|
1035
|
-
if (!context.
|
|
1036
|
-
else if (Array.isArray(context.
|
|
1037
|
-
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];
|
|
1038
1231
|
return e;
|
|
1039
1232
|
}
|
|
1040
1233
|
function createOwner(e) {
|
|
1041
1234
|
const t = context;
|
|
1042
1235
|
const n = {
|
|
1043
1236
|
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
ue: null,
|
|
1237
|
+
i: true,
|
|
1238
|
+
l: t?.i ? t.l : t,
|
|
1047
1239
|
_e: null,
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
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,
|
|
1055
1248
|
dispose(e = true) {
|
|
1056
1249
|
disposeChildren(n, e);
|
|
1057
1250
|
}
|
|
1058
1251
|
};
|
|
1059
1252
|
if (t) {
|
|
1060
|
-
const e = t.
|
|
1253
|
+
const e = t._e;
|
|
1061
1254
|
if (e === null) {
|
|
1062
|
-
t.
|
|
1255
|
+
t._e = n;
|
|
1063
1256
|
} else {
|
|
1064
|
-
n.
|
|
1065
|
-
t.
|
|
1257
|
+
n.De = e;
|
|
1258
|
+
t._e = n;
|
|
1066
1259
|
}
|
|
1067
1260
|
}
|
|
1068
1261
|
return n;
|
|
@@ -1109,6 +1302,8 @@ function isPending(e) {
|
|
|
1109
1302
|
try {
|
|
1110
1303
|
e();
|
|
1111
1304
|
return foundPending;
|
|
1305
|
+
} catch {
|
|
1306
|
+
return foundPending;
|
|
1112
1307
|
} finally {
|
|
1113
1308
|
pendingCheckActive = t;
|
|
1114
1309
|
foundPending = n;
|
|
@@ -1140,7 +1335,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1140
1335
|
if (!t) {
|
|
1141
1336
|
throw new NoOwnerError();
|
|
1142
1337
|
}
|
|
1143
|
-
const n = hasContext(e, t) ? t.
|
|
1338
|
+
const n = hasContext(e, t) ? t.be[e.id] : e.defaultValue;
|
|
1144
1339
|
if (isUndefined(n)) {
|
|
1145
1340
|
throw new ContextNotFoundError();
|
|
1146
1341
|
}
|
|
@@ -1150,10 +1345,10 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1150
1345
|
if (!n) {
|
|
1151
1346
|
throw new NoOwnerError();
|
|
1152
1347
|
}
|
|
1153
|
-
n.
|
|
1348
|
+
n.be = { ...n.be, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1154
1349
|
}
|
|
1155
1350
|
function hasContext(e, t) {
|
|
1156
|
-
return !isUndefined(t?.
|
|
1351
|
+
return !isUndefined(t?.be[e.id]);
|
|
1157
1352
|
}
|
|
1158
1353
|
function isUndefined(e) {
|
|
1159
1354
|
return typeof e === "undefined";
|
|
@@ -1163,78 +1358,80 @@ function effect(e, t, n, i, r) {
|
|
|
1163
1358
|
const s = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
1164
1359
|
...r,
|
|
1165
1360
|
equals: () => {
|
|
1166
|
-
s.
|
|
1167
|
-
if (o) s.
|
|
1361
|
+
s.ae = !s.re;
|
|
1362
|
+
if (o) s.fe.enqueue(s.le, runEffect.bind(s));
|
|
1168
1363
|
return false;
|
|
1169
1364
|
},
|
|
1170
1365
|
lazy: true
|
|
1171
1366
|
});
|
|
1172
|
-
s.
|
|
1173
|
-
s.
|
|
1174
|
-
s.
|
|
1175
|
-
s.
|
|
1176
|
-
s.
|
|
1177
|
-
s.
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
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) {
|
|
1182
1379
|
try {
|
|
1183
|
-
return s.
|
|
1184
|
-
? s.
|
|
1185
|
-
s.
|
|
1186
|
-
s.
|
|
1380
|
+
return s.Ue
|
|
1381
|
+
? s.Ue(e, () => {
|
|
1382
|
+
s.ke?.();
|
|
1383
|
+
s.ke = undefined;
|
|
1187
1384
|
})
|
|
1188
1385
|
: console.error(e);
|
|
1189
1386
|
} catch (t) {
|
|
1190
1387
|
e = t;
|
|
1191
1388
|
}
|
|
1192
1389
|
}
|
|
1193
|
-
if (!s.
|
|
1194
|
-
} 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);
|
|
1195
1392
|
};
|
|
1196
1393
|
recompute(s, true);
|
|
1197
|
-
!r?.defer && (s.
|
|
1394
|
+
!r?.defer && (s.le === EFFECT_USER ? s.fe.enqueue(s.le, runEffect.bind(s)) : runEffect.call(s));
|
|
1198
1395
|
o = true;
|
|
1199
|
-
onCleanup(() => s.
|
|
1396
|
+
onCleanup(() => s.ke?.());
|
|
1200
1397
|
}
|
|
1201
1398
|
function runEffect() {
|
|
1202
|
-
if (!this.
|
|
1203
|
-
this.
|
|
1204
|
-
this.
|
|
1399
|
+
if (!this.ae || this._ & REACTIVE_DISPOSED) return;
|
|
1400
|
+
this.ke?.();
|
|
1401
|
+
this.ke = undefined;
|
|
1205
1402
|
try {
|
|
1206
|
-
this.
|
|
1403
|
+
this.ke = this.Le(this.Te, this.Ve);
|
|
1207
1404
|
} catch (e) {
|
|
1208
|
-
if (!this.
|
|
1405
|
+
if (!this.fe.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1209
1406
|
} finally {
|
|
1210
|
-
this.
|
|
1211
|
-
this.
|
|
1407
|
+
this.Ve = this.Te;
|
|
1408
|
+
this.ae = false;
|
|
1212
1409
|
}
|
|
1213
1410
|
}
|
|
1214
1411
|
function trackedEffect(e, t) {
|
|
1215
1412
|
const run = () => {
|
|
1216
|
-
if (!n.
|
|
1217
|
-
n.
|
|
1413
|
+
if (!n.ae || n._ & REACTIVE_DISPOSED) return;
|
|
1414
|
+
n.ae = false;
|
|
1218
1415
|
recompute(n);
|
|
1219
1416
|
};
|
|
1220
1417
|
const n = computed(
|
|
1221
1418
|
() => {
|
|
1222
1419
|
try {
|
|
1223
|
-
n.
|
|
1224
|
-
n.
|
|
1225
|
-
n.
|
|
1420
|
+
n.ke?.();
|
|
1421
|
+
n.ke = undefined;
|
|
1422
|
+
n.ke = staleValues(e) || undefined;
|
|
1226
1423
|
} finally {
|
|
1227
1424
|
}
|
|
1228
1425
|
},
|
|
1229
1426
|
undefined,
|
|
1230
1427
|
{ ...t, lazy: true, pureWrite: true }
|
|
1231
1428
|
);
|
|
1232
|
-
n.
|
|
1233
|
-
n.
|
|
1234
|
-
n.
|
|
1235
|
-
n.
|
|
1236
|
-
n.
|
|
1237
|
-
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?.());
|
|
1238
1435
|
}
|
|
1239
1436
|
function createSignal(e, t, n) {
|
|
1240
1437
|
if (typeof e === "function") {
|
|
@@ -1327,26 +1524,26 @@ function applyState(e, t, n, i) {
|
|
|
1327
1524
|
r[STORE_OVERRIDE] = undefined;
|
|
1328
1525
|
if (Array.isArray(o)) {
|
|
1329
1526
|
let t = false;
|
|
1330
|
-
const
|
|
1331
|
-
if (e.length &&
|
|
1332
|
-
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;
|
|
1333
1530
|
for (
|
|
1334
|
-
f = 0, E = Math.min(
|
|
1335
|
-
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])));
|
|
1336
1533
|
f++
|
|
1337
1534
|
) {
|
|
1338
|
-
applyState(e[f], wrap(
|
|
1535
|
+
applyState(e[f], wrap(d, r), n, i);
|
|
1339
1536
|
}
|
|
1340
1537
|
const S = new Array(e.length),
|
|
1341
1538
|
_ = new Map();
|
|
1342
1539
|
for (
|
|
1343
|
-
E =
|
|
1540
|
+
E = c - 1, T = e.length - 1;
|
|
1344
1541
|
E >= f &&
|
|
1345
1542
|
T >= f &&
|
|
1346
|
-
((
|
|
1543
|
+
((d = getOverrideValue(o, s, u, E)) === e[T] || (d && e[T] && n(d) === n(e[T])));
|
|
1347
1544
|
E--, T--
|
|
1348
1545
|
) {
|
|
1349
|
-
S[T] =
|
|
1546
|
+
S[T] = d;
|
|
1350
1547
|
}
|
|
1351
1548
|
if (f > T || f > E) {
|
|
1352
1549
|
for (a = f; a <= T; a++) {
|
|
@@ -1360,24 +1557,24 @@ function applyState(e, t, n, i) {
|
|
|
1360
1557
|
applyState(e[a], o, n, i);
|
|
1361
1558
|
}
|
|
1362
1559
|
t && r[STORE_NODE][$TRACK] && setSignal(r[STORE_NODE][$TRACK], void 0);
|
|
1363
|
-
|
|
1560
|
+
c !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
|
|
1364
1561
|
return;
|
|
1365
1562
|
}
|
|
1366
|
-
|
|
1563
|
+
R = new Array(T + 1);
|
|
1367
1564
|
for (a = T; a >= f; a--) {
|
|
1368
|
-
|
|
1369
|
-
O =
|
|
1370
|
-
|
|
1371
|
-
|
|
1565
|
+
d = e[a];
|
|
1566
|
+
O = d ? n(d) : d;
|
|
1567
|
+
l = _.get(O);
|
|
1568
|
+
R[a] = l === undefined ? -1 : l;
|
|
1372
1569
|
_.set(O, a);
|
|
1373
1570
|
}
|
|
1374
|
-
for (
|
|
1375
|
-
|
|
1376
|
-
O =
|
|
1571
|
+
for (l = f; l <= E; l++) {
|
|
1572
|
+
d = getOverrideValue(o, s, u, l);
|
|
1573
|
+
O = d ? n(d) : d;
|
|
1377
1574
|
a = _.get(O);
|
|
1378
1575
|
if (a !== undefined && a !== -1) {
|
|
1379
|
-
S[a] =
|
|
1380
|
-
a =
|
|
1576
|
+
S[a] = d;
|
|
1577
|
+
a = R[a];
|
|
1381
1578
|
_.set(O, a);
|
|
1382
1579
|
}
|
|
1383
1580
|
}
|
|
@@ -1390,14 +1587,14 @@ function applyState(e, t, n, i) {
|
|
|
1390
1587
|
}
|
|
1391
1588
|
if (f < e.length) t = true;
|
|
1392
1589
|
} else if (e.length) {
|
|
1393
|
-
for (let t = 0,
|
|
1394
|
-
const
|
|
1395
|
-
isWrappable(
|
|
1396
|
-
? 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)
|
|
1397
1594
|
: r[STORE_NODE][t] && setSignal(r[STORE_NODE][t], e[t]);
|
|
1398
1595
|
}
|
|
1399
1596
|
}
|
|
1400
|
-
if (
|
|
1597
|
+
if (c !== e.length) {
|
|
1401
1598
|
t = true;
|
|
1402
1599
|
r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
|
|
1403
1600
|
}
|
|
@@ -1406,9 +1603,9 @@ function applyState(e, t, n, i) {
|
|
|
1406
1603
|
}
|
|
1407
1604
|
if (u) {
|
|
1408
1605
|
const t = u[$TRACK];
|
|
1409
|
-
const
|
|
1410
|
-
for (let
|
|
1411
|
-
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];
|
|
1412
1609
|
const f = u[a];
|
|
1413
1610
|
const E = unwrap(getOverrideValue(o, s, u, a));
|
|
1414
1611
|
let T = unwrap(e[a]);
|
|
@@ -1468,7 +1665,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1468
1665
|
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(o);
|
|
1469
1666
|
});
|
|
1470
1667
|
});
|
|
1471
|
-
i.
|
|
1668
|
+
i.ye = true;
|
|
1472
1669
|
return { store: o, node: i };
|
|
1473
1670
|
}
|
|
1474
1671
|
function createProjection(e, t = {}, n) {
|
|
@@ -1568,7 +1765,7 @@ function getNode(e, t, n, i, r = isEqual, o) {
|
|
|
1568
1765
|
},
|
|
1569
1766
|
i
|
|
1570
1767
|
);
|
|
1571
|
-
if (o) s.
|
|
1768
|
+
if (o) s.j = true;
|
|
1572
1769
|
return (e[t] = s);
|
|
1573
1770
|
}
|
|
1574
1771
|
function trackSelf(e, t = $TRACK) {
|
|
@@ -1611,39 +1808,39 @@ const storeTraps = {
|
|
|
1611
1808
|
const o = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
|
|
1612
1809
|
const s = o || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
|
|
1613
1810
|
const u = !!e[STORE_VALUE][$TARGET];
|
|
1614
|
-
const
|
|
1811
|
+
const c = o
|
|
1615
1812
|
? e[STORE_OPTIMISTIC_OVERRIDE]
|
|
1616
1813
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
1617
1814
|
? e[STORE_OVERRIDE]
|
|
1618
1815
|
: e[STORE_VALUE];
|
|
1619
1816
|
if (!r) {
|
|
1620
|
-
const e = Object.getOwnPropertyDescriptor(
|
|
1817
|
+
const e = Object.getOwnPropertyDescriptor(c, t);
|
|
1621
1818
|
if (e && e.get) return e.get.call(n);
|
|
1622
1819
|
}
|
|
1623
1820
|
if (writeOnly(n)) {
|
|
1624
|
-
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];
|
|
1625
1822
|
n === $DELETED && (n = undefined);
|
|
1626
1823
|
if (!isWrappable(n)) return n;
|
|
1627
1824
|
const i = wrap(n, e);
|
|
1628
1825
|
Writing?.add(i);
|
|
1629
1826
|
return i;
|
|
1630
1827
|
}
|
|
1631
|
-
let
|
|
1632
|
-
|
|
1828
|
+
let l = r ? (s || !u ? read(i[t]) : (read(i[t]), c[t])) : c[t];
|
|
1829
|
+
l === $DELETED && (l = undefined);
|
|
1633
1830
|
if (!r) {
|
|
1634
|
-
if (!s && typeof
|
|
1831
|
+
if (!s && typeof l === "function" && !c.hasOwnProperty(t)) {
|
|
1635
1832
|
let t;
|
|
1636
1833
|
return !Array.isArray(e[STORE_VALUE]) &&
|
|
1637
1834
|
(t = Object.getPrototypeOf(e[STORE_VALUE])) &&
|
|
1638
1835
|
t !== Object.prototype
|
|
1639
|
-
?
|
|
1640
|
-
:
|
|
1836
|
+
? l.bind(c)
|
|
1837
|
+
: l;
|
|
1641
1838
|
} else if (getObserver()) {
|
|
1642
1839
|
return read(
|
|
1643
1840
|
getNode(
|
|
1644
1841
|
i,
|
|
1645
1842
|
t,
|
|
1646
|
-
isWrappable(
|
|
1843
|
+
isWrappable(l) ? wrap(l, e) : l,
|
|
1647
1844
|
e[STORE_FIREWALL],
|
|
1648
1845
|
isEqual,
|
|
1649
1846
|
e[STORE_OPTIMISTIC]
|
|
@@ -1651,7 +1848,7 @@ const storeTraps = {
|
|
|
1651
1848
|
);
|
|
1652
1849
|
}
|
|
1653
1850
|
}
|
|
1654
|
-
return isWrappable(
|
|
1851
|
+
return isWrappable(l) ? wrap(l, e) : l;
|
|
1655
1852
|
},
|
|
1656
1853
|
has(e, t) {
|
|
1657
1854
|
if (t === $PROXY || t === $TRACK || t === "__proto__") return true;
|
|
@@ -1670,8 +1867,8 @@ const storeTraps = {
|
|
|
1670
1867
|
if (writeOnly(i)) {
|
|
1671
1868
|
if (e[STORE_OPTIMISTIC]) {
|
|
1672
1869
|
const t = e[STORE_FIREWALL];
|
|
1673
|
-
if (t?.
|
|
1674
|
-
globalQueue.initTransition(t.
|
|
1870
|
+
if (t?.M) {
|
|
1871
|
+
globalQueue.initTransition(t.M);
|
|
1675
1872
|
}
|
|
1676
1873
|
}
|
|
1677
1874
|
untrack(() => {
|
|
@@ -1680,29 +1877,29 @@ const storeTraps = {
|
|
|
1680
1877
|
const s = e[STORE_OPTIMISTIC] && !projectionWriteActive;
|
|
1681
1878
|
const u = s ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
|
|
1682
1879
|
if (s) trackOptimisticStore(i);
|
|
1683
|
-
const
|
|
1880
|
+
const c =
|
|
1684
1881
|
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
1685
1882
|
? e[STORE_OPTIMISTIC_OVERRIDE][t]
|
|
1686
1883
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
1687
1884
|
? e[STORE_OVERRIDE][t]
|
|
1688
1885
|
: o;
|
|
1689
|
-
const
|
|
1690
|
-
if (
|
|
1886
|
+
const l = n?.[$TARGET]?.[STORE_VALUE] ?? n;
|
|
1887
|
+
if (c === l) return true;
|
|
1691
1888
|
const a = e[STORE_OPTIMISTIC_OVERRIDE]?.length || e[STORE_OVERRIDE]?.length || r.length;
|
|
1692
|
-
if (
|
|
1693
|
-
else (e[u] || (e[u] = Object.create(null)))[t] =
|
|
1694
|
-
const f = isWrappable(
|
|
1695
|
-
if (isWrappable(
|
|
1696
|
-
const e = PARENTS.get(
|
|
1697
|
-
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));
|
|
1698
1895
|
}
|
|
1699
|
-
if (recursivelyNotify(i, storeLookup) && f) recursivelyAddParent(
|
|
1896
|
+
if (recursivelyNotify(i, storeLookup) && f) recursivelyAddParent(l, i);
|
|
1700
1897
|
e[STORE_HAS]?.[t] && setSignal(e[STORE_HAS][t], true);
|
|
1701
1898
|
const E = getNodes(e, STORE_NODE);
|
|
1702
|
-
E[t] && setSignal(E[t], () => (f ? wrap(
|
|
1899
|
+
E[t] && setSignal(E[t], () => (f ? wrap(l, e) : l));
|
|
1703
1900
|
if (Array.isArray(r)) {
|
|
1704
1901
|
if (t === "length") {
|
|
1705
|
-
E.length && setSignal(E.length,
|
|
1902
|
+
E.length && setSignal(E.length, l);
|
|
1706
1903
|
} else {
|
|
1707
1904
|
const e = parseInt(t) + 1;
|
|
1708
1905
|
if (e > a) E.length && setSignal(E.length, e);
|
|
@@ -1860,7 +2057,7 @@ function deep(e) {
|
|
|
1860
2057
|
return e[$DEEP];
|
|
1861
2058
|
}
|
|
1862
2059
|
function createOptimisticStore(e, t, n) {
|
|
1863
|
-
GlobalQueue.
|
|
2060
|
+
GlobalQueue.ne ||= clearOptimisticStore;
|
|
1864
2061
|
const i = typeof e === "function";
|
|
1865
2062
|
const r = (i ? t : e) ?? {};
|
|
1866
2063
|
const o = i ? e : undefined;
|
|
@@ -1872,16 +2069,25 @@ function clearOptimisticStore(e) {
|
|
|
1872
2069
|
if (!t || !t[STORE_OPTIMISTIC_OVERRIDE]) return;
|
|
1873
2070
|
const n = t[STORE_OPTIMISTIC_OVERRIDE];
|
|
1874
2071
|
const i = t[STORE_NODE];
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
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);
|
|
1882
2087
|
}
|
|
1883
2088
|
}
|
|
1884
|
-
|
|
2089
|
+
} finally {
|
|
2090
|
+
setProjectionWriteActive(false);
|
|
1885
2091
|
}
|
|
1886
2092
|
delete t[STORE_OPTIMISTIC_OVERRIDE];
|
|
1887
2093
|
}
|
|
@@ -1927,12 +2133,12 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
1927
2133
|
setProjectionWriteActive(false);
|
|
1928
2134
|
}
|
|
1929
2135
|
});
|
|
1930
|
-
i.
|
|
2136
|
+
i.ye = true;
|
|
1931
2137
|
}
|
|
1932
2138
|
return { store: o, node: i };
|
|
1933
2139
|
}
|
|
1934
2140
|
function snapshot(e, t, n) {
|
|
1935
|
-
let i, r, o, s, u,
|
|
2141
|
+
let i, r, o, s, u, c;
|
|
1936
2142
|
if (!isWrappable(e)) return e;
|
|
1937
2143
|
if (t && t.has(e)) return t.get(e);
|
|
1938
2144
|
if (!t) t = new Map();
|
|
@@ -1952,26 +2158,26 @@ function snapshot(e, t, n) {
|
|
|
1952
2158
|
if (r) {
|
|
1953
2159
|
const i = o?.length || e.length;
|
|
1954
2160
|
for (let r = 0; r < i; r++) {
|
|
1955
|
-
|
|
1956
|
-
if (
|
|
1957
|
-
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) {
|
|
1958
2164
|
if (!s) t.set(e, (s = [...e]));
|
|
1959
2165
|
s[r] = u;
|
|
1960
2166
|
}
|
|
1961
2167
|
}
|
|
1962
2168
|
} else {
|
|
1963
2169
|
const i = getKeys(e, o);
|
|
1964
|
-
for (let r = 0,
|
|
1965
|
-
let
|
|
1966
|
-
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);
|
|
1967
2173
|
if (a.get) continue;
|
|
1968
|
-
|
|
1969
|
-
if ((u = snapshot(
|
|
2174
|
+
c = o && l in o ? o[l] : e[l];
|
|
2175
|
+
if ((u = snapshot(c, t, n)) !== e[l] || s) {
|
|
1970
2176
|
if (!s) {
|
|
1971
2177
|
s = Object.create(Object.getPrototypeOf(e));
|
|
1972
2178
|
Object.assign(s, e);
|
|
1973
2179
|
}
|
|
1974
|
-
s[
|
|
2180
|
+
s[l] = u;
|
|
1975
2181
|
}
|
|
1976
2182
|
}
|
|
1977
2183
|
}
|
|
@@ -2111,281 +2317,289 @@ function mapArray(e, t, n) {
|
|
|
2111
2317
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2112
2318
|
return createMemo(
|
|
2113
2319
|
updateKeyedMap.bind({
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
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
|
|
2125
2331
|
})
|
|
2126
2332
|
);
|
|
2127
2333
|
}
|
|
2128
2334
|
const pureOptions = { pureWrite: true };
|
|
2129
2335
|
function updateKeyedMap() {
|
|
2130
|
-
const e = this.
|
|
2336
|
+
const e = this.xe() || [],
|
|
2131
2337
|
t = e.length;
|
|
2132
2338
|
e[$TRACK];
|
|
2133
|
-
runWithOwner(this.
|
|
2339
|
+
runWithOwner(this.We, () => {
|
|
2134
2340
|
let n,
|
|
2135
2341
|
i,
|
|
2136
|
-
r = this.
|
|
2342
|
+
r = this.je
|
|
2137
2343
|
? () => {
|
|
2138
|
-
this.
|
|
2139
|
-
this.
|
|
2140
|
-
return this.
|
|
2141
|
-
read.bind(null, this.
|
|
2142
|
-
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
|
|
2143
2349
|
);
|
|
2144
2350
|
}
|
|
2145
|
-
: this.
|
|
2351
|
+
: this.Ke
|
|
2146
2352
|
? () => {
|
|
2147
2353
|
const t = e[i];
|
|
2148
|
-
this.
|
|
2149
|
-
return this.
|
|
2354
|
+
this.Ke[i] = signal(i, pureOptions);
|
|
2355
|
+
return this.Me(() => t, read.bind(null, this.Ke[i]));
|
|
2150
2356
|
}
|
|
2151
2357
|
: () => {
|
|
2152
2358
|
const t = e[i];
|
|
2153
|
-
return this.
|
|
2359
|
+
return this.Me(() => t);
|
|
2154
2360
|
};
|
|
2155
2361
|
if (t === 0) {
|
|
2156
|
-
if (this.
|
|
2157
|
-
this.
|
|
2158
|
-
this
|
|
2159
|
-
this.
|
|
2160
|
-
this.
|
|
2161
|
-
this.
|
|
2162
|
-
this.
|
|
2163
|
-
this.
|
|
2164
|
-
}
|
|
2165
|
-
if (this.
|
|
2166
|
-
this.
|
|
2167
|
-
}
|
|
2168
|
-
} else if (this.
|
|
2169
|
-
if (this
|
|
2170
|
-
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);
|
|
2171
2377
|
for (i = 0; i < t; i++) {
|
|
2172
|
-
this.
|
|
2173
|
-
this.
|
|
2378
|
+
this.Ge[i] = e[i];
|
|
2379
|
+
this.Fe[i] = runWithOwner((this.$e[i] = createOwner()), r);
|
|
2174
2380
|
}
|
|
2175
|
-
this.
|
|
2381
|
+
this.Qe = t;
|
|
2176
2382
|
} else {
|
|
2177
2383
|
let o,
|
|
2178
2384
|
s,
|
|
2179
2385
|
u,
|
|
2180
|
-
l,
|
|
2181
2386
|
c,
|
|
2387
|
+
l,
|
|
2182
2388
|
a,
|
|
2183
2389
|
f,
|
|
2184
2390
|
E = new Array(t),
|
|
2185
2391
|
T = new Array(t),
|
|
2186
|
-
|
|
2187
|
-
|
|
2392
|
+
d = this.je ? new Array(t) : undefined,
|
|
2393
|
+
R = this.Ke ? new Array(t) : undefined;
|
|
2188
2394
|
for (
|
|
2189
|
-
o = 0, s = Math.min(this.
|
|
2190
|
-
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])));
|
|
2191
2397
|
o++
|
|
2192
2398
|
) {
|
|
2193
|
-
if (this.
|
|
2399
|
+
if (this.je) setSignal(this.je[o], e[o]);
|
|
2194
2400
|
}
|
|
2195
2401
|
for (
|
|
2196
|
-
s = this.
|
|
2402
|
+
s = this.Qe - 1, u = t - 1;
|
|
2197
2403
|
s >= o &&
|
|
2198
2404
|
u >= o &&
|
|
2199
|
-
(this.
|
|
2405
|
+
(this.Ge[s] === e[u] || (this.je && compare(this.He, this.Ge[s], e[u])));
|
|
2200
2406
|
s--, u--
|
|
2201
2407
|
) {
|
|
2202
|
-
E[u] = this.
|
|
2203
|
-
T[u] = this
|
|
2204
|
-
|
|
2205
|
-
|
|
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]);
|
|
2206
2412
|
}
|
|
2207
2413
|
a = new Map();
|
|
2208
2414
|
f = new Array(u + 1);
|
|
2209
2415
|
for (i = u; i >= o; i--) {
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
n = a.get(
|
|
2416
|
+
c = e[i];
|
|
2417
|
+
l = this.He ? this.He(c) : c;
|
|
2418
|
+
n = a.get(l);
|
|
2213
2419
|
f[i] = n === undefined ? -1 : n;
|
|
2214
|
-
a.set(
|
|
2420
|
+
a.set(l, i);
|
|
2215
2421
|
}
|
|
2216
2422
|
for (n = o; n <= s; n++) {
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
i = a.get(
|
|
2423
|
+
c = this.Ge[n];
|
|
2424
|
+
l = this.He ? this.He(c) : c;
|
|
2425
|
+
i = a.get(l);
|
|
2220
2426
|
if (i !== undefined && i !== -1) {
|
|
2221
|
-
E[i] = this.
|
|
2222
|
-
T[i] = this
|
|
2223
|
-
|
|
2224
|
-
|
|
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]);
|
|
2225
2431
|
i = f[i];
|
|
2226
|
-
a.set(
|
|
2227
|
-
} else this
|
|
2432
|
+
a.set(l, i);
|
|
2433
|
+
} else this.$e[n].dispose();
|
|
2228
2434
|
}
|
|
2229
2435
|
for (i = o; i < t; i++) {
|
|
2230
2436
|
if (i in E) {
|
|
2231
|
-
this.
|
|
2232
|
-
this
|
|
2233
|
-
if (R) {
|
|
2234
|
-
this.We[i] = R[i];
|
|
2235
|
-
setSignal(this.We[i], e[i]);
|
|
2236
|
-
}
|
|
2437
|
+
this.Fe[i] = E[i];
|
|
2438
|
+
this.$e[i] = T[i];
|
|
2237
2439
|
if (d) {
|
|
2238
|
-
this.
|
|
2239
|
-
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);
|
|
2240
2446
|
}
|
|
2241
2447
|
} else {
|
|
2242
|
-
this.
|
|
2448
|
+
this.Fe[i] = runWithOwner((this.$e[i] = createOwner()), r);
|
|
2243
2449
|
}
|
|
2244
2450
|
}
|
|
2245
|
-
this.
|
|
2246
|
-
this.
|
|
2451
|
+
this.Fe = this.Fe.slice(0, (this.Qe = t));
|
|
2452
|
+
this.Ge = e.slice(0);
|
|
2247
2453
|
}
|
|
2248
2454
|
});
|
|
2249
|
-
return this.
|
|
2455
|
+
return this.Fe;
|
|
2250
2456
|
}
|
|
2251
2457
|
function repeat(e, t, n) {
|
|
2252
2458
|
return updateRepeat.bind({
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
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
|
|
2262
2468
|
});
|
|
2263
2469
|
}
|
|
2264
2470
|
function updateRepeat() {
|
|
2265
|
-
const e = this.
|
|
2266
|
-
const t = this
|
|
2267
|
-
runWithOwner(this.
|
|
2471
|
+
const e = this.Xe();
|
|
2472
|
+
const t = this.qe?.() || 0;
|
|
2473
|
+
runWithOwner(this.We, () => {
|
|
2268
2474
|
if (e === 0) {
|
|
2269
|
-
if (this.
|
|
2270
|
-
this.
|
|
2271
|
-
this
|
|
2272
|
-
this.
|
|
2273
|
-
this.
|
|
2475
|
+
if (this.Qe !== 0) {
|
|
2476
|
+
this.We.dispose(false);
|
|
2477
|
+
this.$e = [];
|
|
2478
|
+
this.Fe = [];
|
|
2479
|
+
this.Qe = 0;
|
|
2274
2480
|
}
|
|
2275
|
-
if (this.
|
|
2276
|
-
this.
|
|
2481
|
+
if (this.Ye && !this.Fe[0]) {
|
|
2482
|
+
this.Fe[0] = runWithOwner((this.$e[0] = createOwner()), this.Ye);
|
|
2277
2483
|
}
|
|
2278
2484
|
return;
|
|
2279
2485
|
}
|
|
2280
2486
|
const n = t + e;
|
|
2281
|
-
const i = this.
|
|
2282
|
-
if (this.
|
|
2283
|
-
for (let e = n; e < i; e++) this
|
|
2284
|
-
if (this.
|
|
2285
|
-
let e = this.
|
|
2286
|
-
while (e < t && e < this.
|
|
2287
|
-
this.
|
|
2288
|
-
this.
|
|
2289
|
-
} else if (this.
|
|
2290
|
-
let n = i - this.
|
|
2291
|
-
let r = this.
|
|
2292
|
-
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;
|
|
2293
2499
|
while (n >= r) {
|
|
2294
|
-
this
|
|
2295
|
-
this.
|
|
2500
|
+
this.$e[n] = this.$e[n - r];
|
|
2501
|
+
this.Fe[n] = this.Fe[n - r];
|
|
2296
2502
|
n--;
|
|
2297
2503
|
}
|
|
2298
2504
|
for (let e = 0; e < r; e++) {
|
|
2299
|
-
this.
|
|
2505
|
+
this.Fe[e] = runWithOwner((this.$e[e] = createOwner()), () => this.Me(e + t));
|
|
2300
2506
|
}
|
|
2301
2507
|
}
|
|
2302
2508
|
for (let e = i; e < n; e++) {
|
|
2303
|
-
this.
|
|
2509
|
+
this.Fe[e - t] = runWithOwner((this.$e[e - t] = createOwner()), () => this.Me(e));
|
|
2304
2510
|
}
|
|
2305
|
-
this.
|
|
2306
|
-
this.
|
|
2307
|
-
this.
|
|
2511
|
+
this.Fe = this.Fe.slice(0, e);
|
|
2512
|
+
this.Be = t;
|
|
2513
|
+
this.Qe = e;
|
|
2308
2514
|
});
|
|
2309
|
-
return this.
|
|
2515
|
+
return this.Fe;
|
|
2310
2516
|
}
|
|
2311
2517
|
function compare(e, t, n) {
|
|
2312
2518
|
return e ? e(t) === e(n) : true;
|
|
2313
2519
|
}
|
|
2314
2520
|
function boundaryComputed(e, t) {
|
|
2315
2521
|
const n = computed(e, undefined, { lazy: true });
|
|
2316
|
-
n.
|
|
2317
|
-
const
|
|
2318
|
-
|
|
2319
|
-
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);
|
|
2320
2527
|
};
|
|
2321
|
-
n.
|
|
2322
|
-
n.
|
|
2528
|
+
n.ze = t;
|
|
2529
|
+
n.ye = true;
|
|
2323
2530
|
recompute(n, true);
|
|
2324
2531
|
return n;
|
|
2325
2532
|
}
|
|
2326
2533
|
function createBoundChildren(e, t, n, i) {
|
|
2327
|
-
const r = e.
|
|
2328
|
-
r.addChild((e.
|
|
2329
|
-
onCleanup(() => r.removeChild(e.
|
|
2534
|
+
const r = e.fe;
|
|
2535
|
+
r.addChild((e.fe = n));
|
|
2536
|
+
onCleanup(() => r.removeChild(e.fe));
|
|
2330
2537
|
return runWithOwner(e, () => {
|
|
2331
2538
|
const e = computed(t);
|
|
2332
2539
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
2333
2540
|
});
|
|
2334
2541
|
}
|
|
2335
2542
|
class ConditionalQueue extends Queue {
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2543
|
+
Ze;
|
|
2544
|
+
Je = new Set();
|
|
2545
|
+
q = new Set();
|
|
2339
2546
|
constructor(e) {
|
|
2340
2547
|
super();
|
|
2341
|
-
this.
|
|
2548
|
+
this.Ze = e;
|
|
2342
2549
|
}
|
|
2343
2550
|
run(e) {
|
|
2344
|
-
if (!e || read(this.
|
|
2551
|
+
if (!e || read(this.Ze)) return;
|
|
2345
2552
|
return super.run(e);
|
|
2346
2553
|
}
|
|
2347
|
-
notify(e, t, n) {
|
|
2348
|
-
if (read(this.
|
|
2554
|
+
notify(e, t, n, i) {
|
|
2555
|
+
if (read(this.Ze)) {
|
|
2349
2556
|
if (t & STATUS_PENDING) {
|
|
2350
2557
|
if (n & STATUS_PENDING) {
|
|
2351
|
-
this.
|
|
2558
|
+
this.q.add(e);
|
|
2352
2559
|
t &= ~STATUS_PENDING;
|
|
2353
|
-
} else if (this.
|
|
2560
|
+
} else if (this.q.delete(e)) t &= ~STATUS_PENDING;
|
|
2354
2561
|
}
|
|
2355
2562
|
if (t & STATUS_ERROR) {
|
|
2356
2563
|
if (n & STATUS_ERROR) {
|
|
2357
|
-
this.
|
|
2564
|
+
this.Je.add(e);
|
|
2358
2565
|
t &= ~STATUS_ERROR;
|
|
2359
|
-
} else if (this.
|
|
2566
|
+
} else if (this.Je.delete(e)) t &= ~STATUS_ERROR;
|
|
2360
2567
|
}
|
|
2361
2568
|
}
|
|
2362
|
-
return t ? super.notify(e, t, n) : true;
|
|
2569
|
+
return t ? super.notify(e, t, n, i ?? e.re) : true;
|
|
2363
2570
|
}
|
|
2364
2571
|
}
|
|
2365
2572
|
class CollectionQueue extends Queue {
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2573
|
+
et;
|
|
2574
|
+
tt = new Set();
|
|
2575
|
+
Ze = signal(false, { pureWrite: true });
|
|
2576
|
+
nt = false;
|
|
2370
2577
|
constructor(e) {
|
|
2371
2578
|
super();
|
|
2372
|
-
this.
|
|
2579
|
+
this.et = e;
|
|
2373
2580
|
}
|
|
2374
2581
|
run(e) {
|
|
2375
|
-
if (!e || read(this.
|
|
2582
|
+
if (!e || read(this.Ze)) return;
|
|
2376
2583
|
return super.run(e);
|
|
2377
2584
|
}
|
|
2378
|
-
notify(e, t, n) {
|
|
2379
|
-
if (!(t & this.
|
|
2380
|
-
if (n & this.
|
|
2381
|
-
|
|
2382
|
-
if (
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
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);
|
|
2386
2601
|
}
|
|
2387
|
-
|
|
2388
|
-
return t ? super.notify(e, t, n) : true;
|
|
2602
|
+
if (!this.tt.size) setSignal(this.Ze, false);
|
|
2389
2603
|
}
|
|
2390
2604
|
}
|
|
2391
2605
|
var BoundaryMode;
|
|
@@ -2398,26 +2612,26 @@ function createBoundary(e, t) {
|
|
|
2398
2612
|
const i = new ConditionalQueue(computed(() => t() === BoundaryMode.HIDDEN));
|
|
2399
2613
|
const r = createBoundChildren(n, e, i, 0);
|
|
2400
2614
|
computed(() => {
|
|
2401
|
-
const e = read(i.
|
|
2402
|
-
r.
|
|
2615
|
+
const e = read(i.Ze);
|
|
2616
|
+
r.ze = e ? STATUS_ERROR | STATUS_PENDING : 0;
|
|
2403
2617
|
if (!e) {
|
|
2404
|
-
i.
|
|
2405
|
-
i.
|
|
2406
|
-
i.
|
|
2407
|
-
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();
|
|
2408
2622
|
}
|
|
2409
2623
|
});
|
|
2410
|
-
return () => (read(i.
|
|
2624
|
+
return () => (read(i.Ze) ? undefined : read(r));
|
|
2411
2625
|
}
|
|
2412
2626
|
function createCollectionBoundary(e, t, n) {
|
|
2413
2627
|
const i = createOwner();
|
|
2414
2628
|
const r = new CollectionQueue(e);
|
|
2415
2629
|
const o = createBoundChildren(i, t, r, e);
|
|
2416
2630
|
const s = computed(() => {
|
|
2417
|
-
if (!read(r.
|
|
2631
|
+
if (!read(r.Ze)) {
|
|
2418
2632
|
const e = read(o);
|
|
2419
|
-
if (!untrack(() => read(r.
|
|
2420
|
-
r.
|
|
2633
|
+
if (!untrack(() => read(r.Ze))) {
|
|
2634
|
+
r.nt = true;
|
|
2421
2635
|
return e;
|
|
2422
2636
|
}
|
|
2423
2637
|
}
|
|
@@ -2428,26 +2642,12 @@ function createCollectionBoundary(e, t, n) {
|
|
|
2428
2642
|
function createLoadBoundary(e, t) {
|
|
2429
2643
|
return createCollectionBoundary(STATUS_PENDING, e, () => t());
|
|
2430
2644
|
}
|
|
2431
|
-
function collectErrorSources(e, t) {
|
|
2432
|
-
let n = true;
|
|
2433
|
-
let i = e.C;
|
|
2434
|
-
while (i !== null) {
|
|
2435
|
-
const e = i.V;
|
|
2436
|
-
if (e.C && e.ie & STATUS_ERROR) {
|
|
2437
|
-
n = false;
|
|
2438
|
-
collectErrorSources(e, t);
|
|
2439
|
-
}
|
|
2440
|
-
i = i.D;
|
|
2441
|
-
}
|
|
2442
|
-
n && t.push(e);
|
|
2443
|
-
}
|
|
2444
2645
|
function createErrorBoundary(e, t) {
|
|
2445
2646
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2446
|
-
let n = e.
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
for (const
|
|
2450
|
-
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);
|
|
2451
2651
|
schedule();
|
|
2452
2652
|
});
|
|
2453
2653
|
});
|