@solidjs/signals 0.9.11 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +559 -618
- package/dist/node.cjs +1024 -1075
- package/dist/prod.js +961 -1012
- package/dist/types/boundaries.d.ts +0 -5
- package/dist/types/core/action.d.ts +1 -0
- package/dist/types/core/async.d.ts +5 -0
- package/dist/types/core/context.d.ts +1 -1
- package/dist/types/core/core.d.ts +25 -104
- package/dist/types/core/effect.d.ts +4 -3
- package/dist/types/core/error.d.ts +4 -4
- package/dist/types/core/graph.d.ts +3 -0
- package/dist/types/core/heap.d.ts +1 -1
- package/dist/types/core/index.d.ts +4 -2
- package/dist/types/core/lanes.d.ts +52 -0
- package/dist/types/core/owner.d.ts +22 -0
- package/dist/types/core/scheduler.d.ts +6 -59
- package/dist/types/core/types.d.ts +74 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/signals.d.ts +73 -76
- package/dist/types/store/index.d.ts +1 -1
- package/dist/types/store/optimistic.d.ts +9 -12
- package/dist/types/store/projection.d.ts +12 -4
- package/dist/types/store/store.d.ts +26 -1
- package/package.json +2 -2
package/dist/prod.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
class NotReadyError extends Error {
|
|
2
|
-
|
|
2
|
+
source;
|
|
3
3
|
constructor(e) {
|
|
4
4
|
super();
|
|
5
|
-
this.
|
|
5
|
+
this.source = e;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
class StatusError extends Error {
|
|
9
|
-
|
|
9
|
+
source;
|
|
10
10
|
constructor(e, t) {
|
|
11
11
|
super(t instanceof Error ? t.message : String(t), { cause: t });
|
|
12
|
-
this.
|
|
12
|
+
this.source = e;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
class NoOwnerError extends Error {
|
|
@@ -42,182 +42,114 @@ const SUPPORTS_PROXY = typeof Proxy === "function";
|
|
|
42
42
|
const defaultContext = {};
|
|
43
43
|
const $REFRESH = Symbol("refresh");
|
|
44
44
|
function actualInsertIntoHeap(e, t) {
|
|
45
|
-
const n = (e.
|
|
46
|
-
if (n >= e.
|
|
47
|
-
const i = e.
|
|
48
|
-
const r = t.
|
|
49
|
-
if (r === undefined) t.
|
|
45
|
+
const n = (e.i?.t ? e.i.u?.o : e.i?.o) ?? -1;
|
|
46
|
+
if (n >= e.o) e.o = n + 1;
|
|
47
|
+
const i = e.o;
|
|
48
|
+
const r = t.l[i];
|
|
49
|
+
if (r === undefined) t.l[i] = e;
|
|
50
50
|
else {
|
|
51
|
-
const t = r.
|
|
52
|
-
t.
|
|
53
|
-
e.
|
|
54
|
-
r.
|
|
51
|
+
const t = r.T;
|
|
52
|
+
t.R = e;
|
|
53
|
+
e.T = t;
|
|
54
|
+
r.T = e;
|
|
55
55
|
}
|
|
56
|
-
if (i > t.
|
|
56
|
+
if (i > t.O) t.O = i;
|
|
57
57
|
}
|
|
58
58
|
function insertIntoHeap(e, t) {
|
|
59
|
-
let n = e.
|
|
59
|
+
let n = e.S;
|
|
60
60
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
|
|
61
61
|
if (n & REACTIVE_CHECK) {
|
|
62
|
-
e.
|
|
63
|
-
} else e.
|
|
62
|
+
e.S = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
63
|
+
} else e.S = n | REACTIVE_IN_HEAP;
|
|
64
64
|
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
65
65
|
}
|
|
66
66
|
function insertIntoHeapHeight(e, t) {
|
|
67
|
-
let n = e.
|
|
67
|
+
let n = e.S;
|
|
68
68
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
|
|
69
|
-
e.
|
|
69
|
+
e.S = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
70
70
|
actualInsertIntoHeap(e, t);
|
|
71
71
|
}
|
|
72
72
|
function deleteFromHeap(e, t) {
|
|
73
|
-
const n = e.
|
|
73
|
+
const n = e.S;
|
|
74
74
|
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
75
|
-
e.
|
|
76
|
-
const i = e.
|
|
77
|
-
if (e.
|
|
75
|
+
e.S = n & -25;
|
|
76
|
+
const i = e.o;
|
|
77
|
+
if (e.T === e) t.l[i] = undefined;
|
|
78
78
|
else {
|
|
79
|
-
const n = e.
|
|
80
|
-
const r = t.
|
|
79
|
+
const n = e.R;
|
|
80
|
+
const r = t.l[i];
|
|
81
81
|
const o = n ?? r;
|
|
82
|
-
if (e === r) t.
|
|
83
|
-
else e.R
|
|
84
|
-
o.
|
|
82
|
+
if (e === r) t.l[i] = n;
|
|
83
|
+
else e.T.R = n;
|
|
84
|
+
o.T = e.T;
|
|
85
85
|
}
|
|
86
|
-
e.
|
|
87
|
-
e.
|
|
86
|
+
e.T = e;
|
|
87
|
+
e.R = undefined;
|
|
88
88
|
}
|
|
89
89
|
function markHeap(e) {
|
|
90
|
-
if (e.
|
|
91
|
-
e.
|
|
92
|
-
for (let t = 0; t <= e.
|
|
93
|
-
for (let n = e.
|
|
94
|
-
if (n.
|
|
90
|
+
if (e._) return;
|
|
91
|
+
e._ = true;
|
|
92
|
+
for (let t = 0; t <= e.O; t++) {
|
|
93
|
+
for (let n = e.l[t]; n !== undefined; n = n.R) {
|
|
94
|
+
if (n.S & REACTIVE_IN_HEAP) markNode(n);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
function markNode(e, t = REACTIVE_DIRTY) {
|
|
99
|
-
const n = e.
|
|
99
|
+
const n = e.S;
|
|
100
100
|
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
101
|
-
e.
|
|
102
|
-
for (let t = e.
|
|
103
|
-
markNode(t.
|
|
101
|
+
e.S = (n & -4) | t;
|
|
102
|
+
for (let t = e.I; t !== null; t = t.p) {
|
|
103
|
+
markNode(t.h, REACTIVE_CHECK);
|
|
104
104
|
}
|
|
105
|
-
if (e.
|
|
106
|
-
for (let t = e.
|
|
107
|
-
for (let e = t.
|
|
108
|
-
markNode(e.
|
|
105
|
+
if (e.A !== null) {
|
|
106
|
+
for (let t = e.A; t !== null; t = t.P) {
|
|
107
|
+
for (let e = t.I; e !== null; e = e.p) {
|
|
108
|
+
markNode(e.h, REACTIVE_CHECK);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
function runHeap(e, t) {
|
|
114
|
-
e.
|
|
115
|
-
for (e.C = 0; e.C <= e.
|
|
116
|
-
let n = e.
|
|
114
|
+
e._ = false;
|
|
115
|
+
for (e.C = 0; e.C <= e.O; e.C++) {
|
|
116
|
+
let n = e.l[e.C];
|
|
117
117
|
while (n !== undefined) {
|
|
118
|
-
if (n.
|
|
118
|
+
if (n.S & REACTIVE_IN_HEAP) t(n);
|
|
119
119
|
else adjustHeight(n, e);
|
|
120
|
-
n = e.
|
|
120
|
+
n = e.l[e.C];
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
e.
|
|
123
|
+
e.O = 0;
|
|
124
124
|
}
|
|
125
125
|
function adjustHeight(e, t) {
|
|
126
126
|
deleteFromHeap(e, t);
|
|
127
|
-
let n = e.
|
|
128
|
-
for (let t = e.
|
|
127
|
+
let n = e.o;
|
|
128
|
+
for (let t = e.N; t; t = t.D) {
|
|
129
129
|
const e = t.V;
|
|
130
|
-
const i = e.
|
|
131
|
-
if (i.
|
|
130
|
+
const i = e.m || e;
|
|
131
|
+
if (i.L && i.o >= n) n = i.o + 1;
|
|
132
132
|
}
|
|
133
|
-
if (e.
|
|
134
|
-
e.
|
|
135
|
-
for (let n = e.
|
|
136
|
-
insertIntoHeapHeight(n.
|
|
133
|
+
if (e.o !== n) {
|
|
134
|
+
e.o = n;
|
|
135
|
+
for (let n = e.I; n !== null; n = n.p) {
|
|
136
|
+
insertIntoHeapHeight(n.h, t);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
const transitions = new Set();
|
|
141
|
-
const dirtyQueue = {
|
|
142
|
-
const zombieQueue = {
|
|
141
|
+
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, C: 0, O: 0 };
|
|
142
|
+
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, C: 0, O: 0 };
|
|
143
143
|
let clock = 0;
|
|
144
144
|
let activeTransition = null;
|
|
145
145
|
let scheduled = false;
|
|
146
146
|
let projectionWriteActive = false;
|
|
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
|
-
const n = e.k;
|
|
159
|
-
const i = n?.W ? findLane(n.W) : null;
|
|
160
|
-
t = { t: e, G: new Set(), M: [[], []], F: null, $: activeTransition, H: i };
|
|
161
|
-
signalLanes.set(e, t);
|
|
162
|
-
activeLanes.add(t);
|
|
163
|
-
e.j = e.K || 0;
|
|
164
|
-
return t;
|
|
165
|
-
}
|
|
166
|
-
function findLane(e) {
|
|
167
|
-
while (e.F) e = e.F;
|
|
168
|
-
return e;
|
|
169
|
-
}
|
|
170
|
-
function mergeLanes(e, t) {
|
|
171
|
-
e = findLane(e);
|
|
172
|
-
t = findLane(t);
|
|
173
|
-
if (e === t) return e;
|
|
174
|
-
t.F = e;
|
|
175
|
-
for (const n of t.G) e.G.add(n);
|
|
176
|
-
e.M[0].push(...t.M[0]);
|
|
177
|
-
e.M[1].push(...t.M[1]);
|
|
178
|
-
return e;
|
|
179
|
-
}
|
|
180
|
-
function clearLaneEntry(e) {
|
|
181
|
-
signalLanes.delete(e);
|
|
182
|
-
}
|
|
183
|
-
function resolveLane(e) {
|
|
184
|
-
const t = e.W;
|
|
185
|
-
if (!t) return undefined;
|
|
186
|
-
const n = findLane(t);
|
|
187
|
-
if (activeLanes.has(n)) return n;
|
|
188
|
-
e.W = undefined;
|
|
189
|
-
return undefined;
|
|
190
|
-
}
|
|
191
|
-
function hasActiveOverride(e) {
|
|
192
|
-
return !!(e.Y && e.B !== NOT_PENDING);
|
|
193
|
-
}
|
|
194
|
-
function assignOrMergeLane(e, t) {
|
|
195
|
-
const n = findLane(t);
|
|
196
|
-
const i = e.W;
|
|
197
|
-
if (i) {
|
|
198
|
-
if (i.F) {
|
|
199
|
-
e.W = t;
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
const r = findLane(i);
|
|
203
|
-
if (activeLanes.has(r)) {
|
|
204
|
-
if (r !== n && !hasActiveOverride(e)) {
|
|
205
|
-
if (n.H && findLane(n.H) === r) {
|
|
206
|
-
e.W = t;
|
|
207
|
-
} else if (r.H && findLane(r.H) === n);
|
|
208
|
-
else mergeLanes(n, r);
|
|
209
|
-
}
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
e.W = t;
|
|
214
|
-
}
|
|
215
147
|
function runLaneEffects(e) {
|
|
216
148
|
for (const t of activeLanes) {
|
|
217
|
-
if (t.
|
|
218
|
-
const n = t.
|
|
149
|
+
if (t.k || t.U.size > 0) continue;
|
|
150
|
+
const n = t.W[e - 1];
|
|
219
151
|
if (n.length) {
|
|
220
|
-
t.
|
|
152
|
+
t.W[e - 1] = [];
|
|
221
153
|
runQueue(n, e);
|
|
222
154
|
}
|
|
223
155
|
}
|
|
@@ -228,129 +160,129 @@ function setProjectionWriteActive(e) {
|
|
|
228
160
|
function schedule() {
|
|
229
161
|
if (scheduled) return;
|
|
230
162
|
scheduled = true;
|
|
231
|
-
if (!globalQueue.
|
|
163
|
+
if (!globalQueue.M) queueMicrotask(flush);
|
|
232
164
|
}
|
|
233
165
|
class Queue {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
166
|
+
i = null;
|
|
167
|
+
F = [[], []];
|
|
168
|
+
G = [];
|
|
237
169
|
created = clock;
|
|
238
170
|
addChild(e) {
|
|
239
|
-
this.
|
|
240
|
-
e.
|
|
171
|
+
this.G.push(e);
|
|
172
|
+
e.i = this;
|
|
241
173
|
}
|
|
242
174
|
removeChild(e) {
|
|
243
|
-
const t = this.
|
|
175
|
+
const t = this.G.indexOf(e);
|
|
244
176
|
if (t >= 0) {
|
|
245
|
-
this.
|
|
246
|
-
e.
|
|
177
|
+
this.G.splice(t, 1);
|
|
178
|
+
e.i = null;
|
|
247
179
|
}
|
|
248
180
|
}
|
|
249
181
|
notify(e, t, n, i) {
|
|
250
|
-
if (this.
|
|
182
|
+
if (this.i) return this.i.notify(e, t, n, i);
|
|
251
183
|
return false;
|
|
252
184
|
}
|
|
253
185
|
run(e) {
|
|
254
|
-
if (this.
|
|
255
|
-
const t = this.
|
|
256
|
-
this.
|
|
186
|
+
if (this.F[e - 1].length) {
|
|
187
|
+
const t = this.F[e - 1];
|
|
188
|
+
this.F[e - 1] = [];
|
|
257
189
|
runQueue(t, e);
|
|
258
190
|
}
|
|
259
|
-
for (let t = 0; t < this.
|
|
191
|
+
for (let t = 0; t < this.G.length; t++) this.G[t].run?.(e);
|
|
260
192
|
}
|
|
261
193
|
enqueue(e, t) {
|
|
262
194
|
if (e) {
|
|
263
195
|
if (currentOptimisticLane) {
|
|
264
196
|
const n = findLane(currentOptimisticLane);
|
|
265
|
-
n.
|
|
197
|
+
n.W[e - 1].push(t);
|
|
266
198
|
} else {
|
|
267
|
-
this.
|
|
199
|
+
this.F[e - 1].push(t);
|
|
268
200
|
}
|
|
269
201
|
}
|
|
270
202
|
schedule();
|
|
271
203
|
}
|
|
272
204
|
stashQueues(e) {
|
|
273
|
-
e.
|
|
274
|
-
e.
|
|
275
|
-
this.
|
|
276
|
-
for (let t = 0; t < this.
|
|
277
|
-
let n = this.
|
|
278
|
-
let i = e.
|
|
205
|
+
e.F[0].push(...this.F[0]);
|
|
206
|
+
e.F[1].push(...this.F[1]);
|
|
207
|
+
this.F = [[], []];
|
|
208
|
+
for (let t = 0; t < this.G.length; t++) {
|
|
209
|
+
let n = this.G[t];
|
|
210
|
+
let i = e.G[t];
|
|
279
211
|
if (!i) {
|
|
280
|
-
i = {
|
|
281
|
-
e.
|
|
212
|
+
i = { F: [[], []], G: [] };
|
|
213
|
+
e.G[t] = i;
|
|
282
214
|
}
|
|
283
215
|
n.stashQueues(i);
|
|
284
216
|
}
|
|
285
217
|
}
|
|
286
218
|
restoreQueues(e) {
|
|
287
|
-
this.
|
|
288
|
-
this.
|
|
289
|
-
for (let t = 0; t < e.
|
|
290
|
-
const n = e.
|
|
291
|
-
let i = this.
|
|
219
|
+
this.F[0].push(...e.F[0]);
|
|
220
|
+
this.F[1].push(...e.F[1]);
|
|
221
|
+
for (let t = 0; t < e.G.length; t++) {
|
|
222
|
+
const n = e.G[t];
|
|
223
|
+
let i = this.G[t];
|
|
292
224
|
if (i) i.restoreQueues(n);
|
|
293
225
|
}
|
|
294
226
|
}
|
|
295
227
|
}
|
|
296
228
|
class GlobalQueue extends Queue {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
static
|
|
302
|
-
static
|
|
303
|
-
static
|
|
229
|
+
M = false;
|
|
230
|
+
$ = [];
|
|
231
|
+
H = [];
|
|
232
|
+
j = new Set();
|
|
233
|
+
static K;
|
|
234
|
+
static Y;
|
|
235
|
+
static B = null;
|
|
304
236
|
flush() {
|
|
305
|
-
if (this.
|
|
306
|
-
this.
|
|
237
|
+
if (this.M) return;
|
|
238
|
+
this.M = true;
|
|
307
239
|
try {
|
|
308
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
240
|
+
runHeap(dirtyQueue, GlobalQueue.K);
|
|
309
241
|
if (activeTransition) {
|
|
310
242
|
const e = transitionComplete(activeTransition);
|
|
311
243
|
if (!e) {
|
|
312
244
|
let e = activeTransition;
|
|
313
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
314
|
-
this
|
|
315
|
-
this.
|
|
316
|
-
this.
|
|
245
|
+
runHeap(zombieQueue, GlobalQueue.K);
|
|
246
|
+
this.$ = [];
|
|
247
|
+
this.H = [];
|
|
248
|
+
this.j = new Set();
|
|
317
249
|
runLaneEffects(EFFECT_RENDER);
|
|
318
250
|
runLaneEffects(EFFECT_USER);
|
|
319
|
-
this.stashQueues(activeTransition.
|
|
251
|
+
this.stashQueues(activeTransition.X);
|
|
320
252
|
clock++;
|
|
321
|
-
scheduled = dirtyQueue.
|
|
322
|
-
reassignPendingTransition(activeTransition
|
|
253
|
+
scheduled = dirtyQueue.O >= dirtyQueue.C;
|
|
254
|
+
reassignPendingTransition(activeTransition.$);
|
|
323
255
|
activeTransition = null;
|
|
324
256
|
finalizePureQueue(null, true);
|
|
325
257
|
return;
|
|
326
258
|
}
|
|
327
|
-
this
|
|
328
|
-
this.restoreQueues(activeTransition.
|
|
259
|
+
this.$ !== activeTransition.$ && this.$.push(...activeTransition.$);
|
|
260
|
+
this.restoreQueues(activeTransition.X);
|
|
329
261
|
transitions.delete(activeTransition);
|
|
330
262
|
const t = activeTransition;
|
|
331
263
|
activeTransition = null;
|
|
332
|
-
reassignPendingTransition(this
|
|
264
|
+
reassignPendingTransition(this.$);
|
|
333
265
|
finalizePureQueue(t);
|
|
334
266
|
} else {
|
|
335
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
267
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.K);
|
|
336
268
|
finalizePureQueue();
|
|
337
269
|
}
|
|
338
270
|
clock++;
|
|
339
|
-
scheduled = dirtyQueue.
|
|
271
|
+
scheduled = dirtyQueue.O >= dirtyQueue.C;
|
|
340
272
|
runLaneEffects(EFFECT_RENDER);
|
|
341
273
|
this.run(EFFECT_RENDER);
|
|
342
274
|
runLaneEffects(EFFECT_USER);
|
|
343
275
|
this.run(EFFECT_USER);
|
|
344
276
|
} finally {
|
|
345
|
-
this.
|
|
277
|
+
this.M = false;
|
|
346
278
|
}
|
|
347
279
|
}
|
|
348
280
|
notify(e, t, n, i) {
|
|
349
281
|
if (t & STATUS_PENDING) {
|
|
350
282
|
if (n & STATUS_PENDING) {
|
|
351
|
-
const t = i !== undefined ? i : e.
|
|
352
|
-
if (activeTransition && t && !activeTransition.
|
|
353
|
-
activeTransition.
|
|
283
|
+
const t = i !== undefined ? i : e.q;
|
|
284
|
+
if (activeTransition && t && !activeTransition.Z.includes(t.source)) {
|
|
285
|
+
activeTransition.Z.push(t.source);
|
|
354
286
|
schedule();
|
|
355
287
|
}
|
|
356
288
|
}
|
|
@@ -361,143 +293,143 @@ class GlobalQueue extends Queue {
|
|
|
361
293
|
initTransition(e) {
|
|
362
294
|
if (e) e = currentTransition(e);
|
|
363
295
|
if (e && e === activeTransition) return;
|
|
364
|
-
if (!e && activeTransition && activeTransition.
|
|
296
|
+
if (!e && activeTransition && activeTransition.J === clock) return;
|
|
365
297
|
if (!activeTransition) {
|
|
366
298
|
activeTransition = e ?? {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
299
|
+
J: clock,
|
|
300
|
+
$: [],
|
|
301
|
+
Z: [],
|
|
302
|
+
H: [],
|
|
303
|
+
j: new Set(),
|
|
370
304
|
ee: [],
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
oe: { q: [[], []], Z: [] },
|
|
374
|
-
ae: false
|
|
305
|
+
X: { F: [[], []], G: [] },
|
|
306
|
+
te: false
|
|
375
307
|
};
|
|
376
308
|
} else if (e) {
|
|
377
309
|
const t = activeTransition;
|
|
378
|
-
t.
|
|
379
|
-
e.
|
|
310
|
+
t.te = e;
|
|
311
|
+
e.ee.push(...t.ee);
|
|
380
312
|
for (const n of activeLanes) {
|
|
381
|
-
if (n
|
|
313
|
+
if (n.ne === t) n.ne = e;
|
|
382
314
|
}
|
|
383
|
-
e.
|
|
384
|
-
for (const n of t.
|
|
385
|
-
e.
|
|
315
|
+
e.H.push(...t.H);
|
|
316
|
+
for (const n of t.j) {
|
|
317
|
+
e.j.add(n);
|
|
386
318
|
}
|
|
387
319
|
transitions.delete(t);
|
|
388
320
|
activeTransition = e;
|
|
389
321
|
}
|
|
390
322
|
transitions.add(activeTransition);
|
|
391
|
-
activeTransition.
|
|
392
|
-
for (let e = 0; e < this
|
|
393
|
-
const t = this
|
|
394
|
-
t
|
|
395
|
-
activeTransition
|
|
396
|
-
}
|
|
397
|
-
this
|
|
398
|
-
for (let e = 0; e < this.
|
|
399
|
-
const t = this.
|
|
400
|
-
t
|
|
401
|
-
activeTransition.
|
|
402
|
-
}
|
|
403
|
-
this.
|
|
323
|
+
activeTransition.J = clock;
|
|
324
|
+
for (let e = 0; e < this.$.length; e++) {
|
|
325
|
+
const t = this.$[e];
|
|
326
|
+
t.ne = activeTransition;
|
|
327
|
+
activeTransition.$.push(t);
|
|
328
|
+
}
|
|
329
|
+
this.$ = activeTransition.$;
|
|
330
|
+
for (let e = 0; e < this.H.length; e++) {
|
|
331
|
+
const t = this.H[e];
|
|
332
|
+
t.ne = activeTransition;
|
|
333
|
+
activeTransition.H.push(t);
|
|
334
|
+
}
|
|
335
|
+
this.H = activeTransition.H;
|
|
404
336
|
for (const e of activeLanes) {
|
|
405
|
-
if (!e
|
|
337
|
+
if (!e.ne) e.ne = activeTransition;
|
|
406
338
|
}
|
|
407
|
-
for (const e of this.
|
|
408
|
-
this.
|
|
339
|
+
for (const e of this.j) activeTransition.j.add(e);
|
|
340
|
+
this.j = activeTransition.j;
|
|
409
341
|
}
|
|
410
342
|
}
|
|
411
343
|
function insertSubs(e, t = false) {
|
|
412
|
-
const n = e.
|
|
413
|
-
for (let i = e.
|
|
344
|
+
const n = e.ie || currentOptimisticLane;
|
|
345
|
+
for (let i = e.I; i !== null; i = i.p) {
|
|
414
346
|
if (t && n) {
|
|
415
|
-
i.
|
|
416
|
-
assignOrMergeLane(i.
|
|
347
|
+
i.h.S |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
348
|
+
assignOrMergeLane(i.h, n);
|
|
417
349
|
} else if (t) {
|
|
418
|
-
i.
|
|
419
|
-
i.
|
|
350
|
+
i.h.S |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
351
|
+
i.h.ie = undefined;
|
|
420
352
|
}
|
|
421
|
-
const e = i.
|
|
422
|
-
if (e.
|
|
423
|
-
if (!e.
|
|
424
|
-
e.
|
|
425
|
-
e.
|
|
353
|
+
const e = i.h;
|
|
354
|
+
if (e.re === EFFECT_TRACKED) {
|
|
355
|
+
if (!e.oe) {
|
|
356
|
+
e.oe = true;
|
|
357
|
+
e.se.enqueue(EFFECT_USER, e.ue);
|
|
426
358
|
}
|
|
427
359
|
continue;
|
|
428
360
|
}
|
|
429
|
-
const r = i.
|
|
430
|
-
if (r.C > i.
|
|
431
|
-
insertIntoHeap(i.
|
|
361
|
+
const r = i.h.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
362
|
+
if (r.C > i.h.o) r.C = i.h.o;
|
|
363
|
+
insertIntoHeap(i.h, r);
|
|
432
364
|
}
|
|
433
365
|
}
|
|
434
366
|
function finalizePureQueue(e = null, t = false) {
|
|
435
367
|
let n = !t;
|
|
436
368
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
437
|
-
if (dirtyQueue.
|
|
369
|
+
if (dirtyQueue.O >= dirtyQueue.C) runHeap(dirtyQueue, GlobalQueue.K);
|
|
438
370
|
if (n) {
|
|
439
|
-
const t = globalQueue
|
|
371
|
+
const t = globalQueue.$;
|
|
440
372
|
for (let e = 0; e < t.length; e++) {
|
|
441
373
|
const n = t[e];
|
|
442
|
-
if (n.
|
|
443
|
-
n.
|
|
444
|
-
n.
|
|
445
|
-
if (n.
|
|
374
|
+
if (n.ce !== NOT_PENDING) {
|
|
375
|
+
n.le = n.ce;
|
|
376
|
+
n.ce = NOT_PENDING;
|
|
377
|
+
if (n.re && n.re !== EFFECT_TRACKED) n.oe = true;
|
|
446
378
|
}
|
|
447
|
-
n.
|
|
448
|
-
if (n.
|
|
379
|
+
n.ae &= ~STATUS_UNINITIALIZED;
|
|
380
|
+
if (n.L) GlobalQueue.Y(n, false, true);
|
|
449
381
|
}
|
|
450
382
|
t.length = 0;
|
|
451
|
-
const n = e ? e.
|
|
383
|
+
const n = e ? e.H : globalQueue.H;
|
|
452
384
|
for (let e = 0; e < n.length; e++) {
|
|
453
385
|
const t = n[e];
|
|
454
|
-
const i = t.
|
|
455
|
-
t.
|
|
456
|
-
if (i !== NOT_PENDING && t.
|
|
457
|
-
t.
|
|
386
|
+
const i = t.ce;
|
|
387
|
+
t.ie = undefined;
|
|
388
|
+
if (i !== NOT_PENDING && t.le !== i) {
|
|
389
|
+
t.le = i;
|
|
458
390
|
insertSubs(t, true);
|
|
459
391
|
}
|
|
460
|
-
t.
|
|
461
|
-
t
|
|
392
|
+
t.ce = NOT_PENDING;
|
|
393
|
+
t.ne = null;
|
|
462
394
|
}
|
|
463
395
|
n.length = 0;
|
|
464
|
-
const i = e ? e.
|
|
465
|
-
if (GlobalQueue.
|
|
396
|
+
const i = e ? e.j : globalQueue.j;
|
|
397
|
+
if (GlobalQueue.B && i.size) {
|
|
466
398
|
for (const e of i) {
|
|
467
|
-
GlobalQueue.
|
|
399
|
+
GlobalQueue.B(e);
|
|
468
400
|
}
|
|
469
401
|
i.clear();
|
|
470
402
|
schedule();
|
|
471
403
|
}
|
|
472
404
|
for (const t of activeLanes) {
|
|
473
|
-
const n = e ? t
|
|
405
|
+
const n = e ? t.ne === e : !t.ne;
|
|
474
406
|
if (!n) continue;
|
|
475
|
-
if (!t.
|
|
476
|
-
if (t.
|
|
477
|
-
if (t.
|
|
478
|
-
}
|
|
479
|
-
if (t.
|
|
480
|
-
t.
|
|
481
|
-
t.
|
|
482
|
-
t.
|
|
407
|
+
if (!t.k) {
|
|
408
|
+
if (t.W[0].length) runQueue(t.W[0], EFFECT_RENDER);
|
|
409
|
+
if (t.W[1].length) runQueue(t.W[1], EFFECT_USER);
|
|
410
|
+
}
|
|
411
|
+
if (t.fe.ie === t) t.fe.ie = undefined;
|
|
412
|
+
t.U.clear();
|
|
413
|
+
t.W[0].length = 0;
|
|
414
|
+
t.W[1].length = 0;
|
|
483
415
|
activeLanes.delete(t);
|
|
484
|
-
signalLanes.delete(t.
|
|
416
|
+
signalLanes.delete(t.fe);
|
|
485
417
|
}
|
|
486
418
|
}
|
|
487
419
|
}
|
|
488
420
|
function checkBoundaryChildren(e) {
|
|
489
|
-
for (const t of e.
|
|
421
|
+
for (const t of e.G) {
|
|
490
422
|
t.checkSources?.();
|
|
491
423
|
checkBoundaryChildren(t);
|
|
492
424
|
}
|
|
493
425
|
}
|
|
494
426
|
function trackOptimisticStore(e) {
|
|
495
|
-
globalQueue.
|
|
427
|
+
globalQueue.j.add(e);
|
|
496
428
|
schedule();
|
|
497
429
|
}
|
|
498
430
|
function reassignPendingTransition(e) {
|
|
499
431
|
for (let t = 0; t < e.length; t++) {
|
|
500
|
-
e[t]
|
|
432
|
+
e[t].ne = activeTransition;
|
|
501
433
|
}
|
|
502
434
|
}
|
|
503
435
|
const globalQueue = new GlobalQueue();
|
|
@@ -510,23 +442,26 @@ function runQueue(e, t) {
|
|
|
510
442
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
511
443
|
}
|
|
512
444
|
function transitionComplete(e) {
|
|
513
|
-
if (e.
|
|
514
|
-
if (e.
|
|
445
|
+
if (e.te) return true;
|
|
446
|
+
if (e.ee.length) return false;
|
|
515
447
|
let t = true;
|
|
516
|
-
for (let n = 0; n < e.
|
|
517
|
-
const i = e.
|
|
518
|
-
if (i.
|
|
448
|
+
for (let n = 0; n < e.Z.length; n++) {
|
|
449
|
+
const i = e.Z[n];
|
|
450
|
+
if (i.ae & STATUS_PENDING && i.q?.source === i) {
|
|
519
451
|
t = false;
|
|
520
452
|
break;
|
|
521
453
|
}
|
|
522
454
|
}
|
|
523
|
-
t && (e.
|
|
455
|
+
t && (e.te = true);
|
|
524
456
|
return t;
|
|
525
457
|
}
|
|
526
458
|
function currentTransition(e) {
|
|
527
|
-
while (e.
|
|
459
|
+
while (e.te && typeof e.te === "object") e = e.te;
|
|
528
460
|
return e;
|
|
529
461
|
}
|
|
462
|
+
function setActiveTransition(e) {
|
|
463
|
+
activeTransition = e;
|
|
464
|
+
}
|
|
530
465
|
function runInTransition(e, t) {
|
|
531
466
|
const n = activeTransition;
|
|
532
467
|
try {
|
|
@@ -536,196 +471,107 @@ function runInTransition(e, t) {
|
|
|
536
471
|
activeTransition = n;
|
|
537
472
|
}
|
|
538
473
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
474
|
+
const signalLanes = new WeakMap();
|
|
475
|
+
const activeLanes = new Set();
|
|
476
|
+
function getOrCreateLane(e) {
|
|
477
|
+
let t = signalLanes.get(e);
|
|
478
|
+
if (t) {
|
|
479
|
+
return findLane(t);
|
|
480
|
+
}
|
|
481
|
+
const n = e.Ee;
|
|
482
|
+
const i = n?.ie ? findLane(n.ie) : null;
|
|
483
|
+
t = { fe: e, U: new Set(), W: [[], []], k: null, ne: activeTransition, Te: i };
|
|
484
|
+
signalLanes.set(e, t);
|
|
485
|
+
activeLanes.add(t);
|
|
486
|
+
e.de = e.Re || 0;
|
|
487
|
+
return t;
|
|
544
488
|
}
|
|
545
|
-
function
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
const r = e(...t);
|
|
549
|
-
globalQueue.initTransition();
|
|
550
|
-
let o = activeTransition;
|
|
551
|
-
o.le.push(r);
|
|
552
|
-
const done = (e, t) => {
|
|
553
|
-
o = currentTransition(o);
|
|
554
|
-
const s = o.le.indexOf(r);
|
|
555
|
-
if (s >= 0) o.le.splice(s, 1);
|
|
556
|
-
activeTransition = o;
|
|
557
|
-
schedule();
|
|
558
|
-
t ? i(t) : n(e);
|
|
559
|
-
};
|
|
560
|
-
const step = (e, t) => {
|
|
561
|
-
let n;
|
|
562
|
-
try {
|
|
563
|
-
n = t ? r.throw(e) : r.next(e);
|
|
564
|
-
} catch (e) {
|
|
565
|
-
return done(undefined, e);
|
|
566
|
-
}
|
|
567
|
-
if (n instanceof Promise)
|
|
568
|
-
return void n.then(run, e => restoreTransition(o, () => step(e, true)));
|
|
569
|
-
run(n);
|
|
570
|
-
};
|
|
571
|
-
const run = e => {
|
|
572
|
-
if (e.done) return done(e.value);
|
|
573
|
-
if (e.value instanceof Promise)
|
|
574
|
-
return void e.value.then(
|
|
575
|
-
e => restoreTransition(o, () => step(e)),
|
|
576
|
-
e => restoreTransition(o, () => step(e, true))
|
|
577
|
-
);
|
|
578
|
-
restoreTransition(o, () => step(e.value));
|
|
579
|
-
};
|
|
580
|
-
step();
|
|
581
|
-
});
|
|
489
|
+
function findLane(e) {
|
|
490
|
+
while (e.k) e = e.k;
|
|
491
|
+
return e;
|
|
582
492
|
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
const i = !!(e._ & REACTIVE_OPTIMISTIC_DIRTY);
|
|
608
|
-
const r = hasActiveOverride(e);
|
|
609
|
-
const o = !!(e.Oe & STATUS_PENDING);
|
|
610
|
-
const s = context;
|
|
611
|
-
context = e;
|
|
612
|
-
e.he = null;
|
|
613
|
-
e._ = REACTIVE_RECOMPUTING_DEPS;
|
|
614
|
-
e.ce = clock;
|
|
615
|
-
let u = e.B === NOT_PENDING ? e.Re : e.B;
|
|
616
|
-
let c = e.u;
|
|
617
|
-
let l = tracking;
|
|
618
|
-
let a = currentOptimisticLane;
|
|
619
|
-
tracking = true;
|
|
493
|
+
function mergeLanes(e, t) {
|
|
494
|
+
e = findLane(e);
|
|
495
|
+
t = findLane(t);
|
|
496
|
+
if (e === t) return e;
|
|
497
|
+
t.k = e;
|
|
498
|
+
for (const n of t.U) e.U.add(n);
|
|
499
|
+
e.W[0].push(...t.W[0]);
|
|
500
|
+
e.W[1].push(...t.W[1]);
|
|
501
|
+
return e;
|
|
502
|
+
}
|
|
503
|
+
function resolveLane(e) {
|
|
504
|
+
const t = e.ie;
|
|
505
|
+
if (!t) return undefined;
|
|
506
|
+
const n = findLane(t);
|
|
507
|
+
if (activeLanes.has(n)) return n;
|
|
508
|
+
e.ie = undefined;
|
|
509
|
+
return undefined;
|
|
510
|
+
}
|
|
511
|
+
function hasActiveOverride(e) {
|
|
512
|
+
return !!(e.Oe && e.ce !== NOT_PENDING);
|
|
513
|
+
}
|
|
514
|
+
function assignOrMergeLane(e, t) {
|
|
515
|
+
const n = findLane(t);
|
|
516
|
+
const i = e.ie;
|
|
620
517
|
if (i) {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
try {
|
|
625
|
-
u = handleAsync(e, e.U(u));
|
|
626
|
-
clearStatus(e);
|
|
627
|
-
const t = resolveLane(e);
|
|
628
|
-
if (t) {
|
|
629
|
-
t.G.delete(e);
|
|
630
|
-
updatePendingSignal(t.t);
|
|
631
|
-
}
|
|
632
|
-
} catch (t) {
|
|
633
|
-
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
634
|
-
const t = findLane(currentOptimisticLane);
|
|
635
|
-
if (t.t !== e) {
|
|
636
|
-
t.G.add(e);
|
|
637
|
-
e.W = t;
|
|
638
|
-
updatePendingSignal(t.t);
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
notifyStatus(
|
|
642
|
-
e,
|
|
643
|
-
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
644
|
-
t,
|
|
645
|
-
undefined,
|
|
646
|
-
t instanceof NotReadyError ? e.W : undefined
|
|
647
|
-
);
|
|
648
|
-
} finally {
|
|
649
|
-
tracking = l;
|
|
650
|
-
e._ = REACTIVE_NONE;
|
|
651
|
-
context = s;
|
|
652
|
-
}
|
|
653
|
-
if (!e.se) {
|
|
654
|
-
const s = e.he;
|
|
655
|
-
let l = s !== null ? s.m : e.D;
|
|
656
|
-
if (l !== null) {
|
|
657
|
-
do {
|
|
658
|
-
l = unlinkSubs(l);
|
|
659
|
-
} while (l !== null);
|
|
660
|
-
if (s !== null) s.m = null;
|
|
661
|
-
else e.D = null;
|
|
518
|
+
if (i.k) {
|
|
519
|
+
e.ie = t;
|
|
520
|
+
return;
|
|
662
521
|
}
|
|
663
|
-
const
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
const t = e.K || 0;
|
|
671
|
-
const n = e.j || 0;
|
|
672
|
-
if (t <= n) e.Re = u;
|
|
673
|
-
}
|
|
674
|
-
if (!r || i || e.Re !== s) {
|
|
675
|
-
insertSubs(e, i || r);
|
|
676
|
-
}
|
|
677
|
-
} else if (r) {
|
|
678
|
-
e.B = u;
|
|
679
|
-
} else if (e.u != c) {
|
|
680
|
-
for (let t = e.p; t !== null; t = t.h) {
|
|
681
|
-
insertIntoHeapHeight(t.A, t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
522
|
+
const r = findLane(i);
|
|
523
|
+
if (activeLanes.has(r)) {
|
|
524
|
+
if (r !== n && !hasActiveOverride(e)) {
|
|
525
|
+
if (n.Te && findLane(n.Te) === r) {
|
|
526
|
+
e.ie = t;
|
|
527
|
+
} else if (r.Te && findLane(r.Te) === n);
|
|
528
|
+
else mergeLanes(n, r);
|
|
682
529
|
}
|
|
530
|
+
return;
|
|
683
531
|
}
|
|
684
532
|
}
|
|
685
|
-
|
|
686
|
-
(!t || e.Oe & STATUS_PENDING) && !e.$ && !(activeTransition && e.Y) && globalQueue.J.push(e);
|
|
687
|
-
e.$ && n && activeTransition !== e.$ && runInTransition(e.$, () => recompute(e));
|
|
533
|
+
e.ie = t;
|
|
688
534
|
}
|
|
689
535
|
function handleAsync(e, t, n) {
|
|
690
536
|
const i = typeof t === "object" && t !== null;
|
|
691
537
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
692
538
|
const o = !r && i && untrack(() => typeof t.then === "function");
|
|
693
539
|
if (!o && !r) {
|
|
694
|
-
e.
|
|
540
|
+
e.Se = null;
|
|
695
541
|
return t;
|
|
696
542
|
}
|
|
697
|
-
e.
|
|
543
|
+
e.Se = t;
|
|
698
544
|
let s;
|
|
699
545
|
const handleError = n => {
|
|
700
|
-
if (e.
|
|
701
|
-
globalQueue.initTransition(e
|
|
546
|
+
if (e.Se !== t) return;
|
|
547
|
+
globalQueue.initTransition(e.ne);
|
|
702
548
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
703
|
-
e.
|
|
549
|
+
e.J = clock;
|
|
704
550
|
};
|
|
705
551
|
const asyncWrite = (i, r) => {
|
|
706
|
-
if (e.
|
|
707
|
-
if (e.
|
|
708
|
-
globalQueue.initTransition(e
|
|
552
|
+
if (e.Se !== t) return;
|
|
553
|
+
if (e.S & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
554
|
+
globalQueue.initTransition(e.ne);
|
|
709
555
|
clearStatus(e);
|
|
710
556
|
const o = resolveLane(e);
|
|
711
|
-
if (o) o.
|
|
557
|
+
if (o) o.U.delete(e);
|
|
712
558
|
if (n) n(i);
|
|
713
|
-
else if (e.
|
|
714
|
-
const t = e.
|
|
715
|
-
if (e.
|
|
559
|
+
else if (e.Oe) {
|
|
560
|
+
const t = e.ce !== NOT_PENDING;
|
|
561
|
+
if (e.L) e.ce = i;
|
|
716
562
|
if (!t) {
|
|
717
|
-
e.
|
|
563
|
+
e.le = i;
|
|
718
564
|
insertSubs(e);
|
|
719
565
|
}
|
|
720
|
-
e.
|
|
566
|
+
e.J = clock;
|
|
721
567
|
} else if (o) {
|
|
722
|
-
const t = e.
|
|
723
|
-
const n = e.
|
|
568
|
+
const t = e.le;
|
|
569
|
+
const n = e._e;
|
|
724
570
|
if (!n || !n(i, t)) {
|
|
725
|
-
e.
|
|
726
|
-
e.
|
|
727
|
-
if (e.
|
|
728
|
-
setSignal(e.
|
|
571
|
+
e.le = i;
|
|
572
|
+
e.J = clock;
|
|
573
|
+
if (e.Ie) {
|
|
574
|
+
setSignal(e.Ie, i);
|
|
729
575
|
}
|
|
730
576
|
insertSubs(e, true);
|
|
731
577
|
}
|
|
@@ -752,7 +598,7 @@ function handleAsync(e, t, n) {
|
|
|
752
598
|
);
|
|
753
599
|
i = false;
|
|
754
600
|
if (!n) {
|
|
755
|
-
globalQueue.initTransition(e
|
|
601
|
+
globalQueue.initTransition(e.ne);
|
|
756
602
|
throw new NotReadyError(context);
|
|
757
603
|
}
|
|
758
604
|
}
|
|
@@ -784,341 +630,520 @@ function handleAsync(e, t, n) {
|
|
|
784
630
|
};
|
|
785
631
|
const r = iterate();
|
|
786
632
|
if (!i && !r) {
|
|
787
|
-
globalQueue.initTransition(e
|
|
633
|
+
globalQueue.initTransition(e.ne);
|
|
788
634
|
throw new NotReadyError(context);
|
|
789
635
|
}
|
|
790
636
|
}
|
|
791
637
|
return s;
|
|
792
638
|
}
|
|
793
639
|
function clearStatus(e) {
|
|
794
|
-
e.
|
|
795
|
-
e.
|
|
640
|
+
e.ae = e.ae & STATUS_UNINITIALIZED;
|
|
641
|
+
e.q = null;
|
|
796
642
|
updatePendingSignal(e);
|
|
797
|
-
e.
|
|
643
|
+
e.pe?.();
|
|
798
644
|
}
|
|
799
645
|
function notifyStatus(e, t, n, i, r) {
|
|
800
646
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
801
647
|
n = new StatusError(e, n);
|
|
802
|
-
const o = n instanceof NotReadyError && n.
|
|
803
|
-
const s = t === STATUS_PENDING && e.
|
|
648
|
+
const o = n instanceof NotReadyError && n.source === e;
|
|
649
|
+
const s = t === STATUS_PENDING && e.Oe && !o;
|
|
804
650
|
const u = s && hasActiveOverride(e);
|
|
805
651
|
if (!i) {
|
|
806
|
-
e.
|
|
807
|
-
e.
|
|
652
|
+
e.ae = t | (t !== STATUS_ERROR ? e.ae & STATUS_UNINITIALIZED : 0);
|
|
653
|
+
e.q = n;
|
|
808
654
|
updatePendingSignal(e);
|
|
809
655
|
}
|
|
810
656
|
if (r && !i) {
|
|
811
657
|
assignOrMergeLane(e, r);
|
|
812
658
|
}
|
|
813
659
|
if (u && activeTransition && n instanceof NotReadyError) {
|
|
814
|
-
const e = n.
|
|
815
|
-
if (!activeTransition.
|
|
816
|
-
activeTransition.
|
|
660
|
+
const e = n.source;
|
|
661
|
+
if (!activeTransition.Z.includes(e)) {
|
|
662
|
+
activeTransition.Z.push(e);
|
|
817
663
|
}
|
|
818
664
|
}
|
|
819
665
|
const c = i || u;
|
|
820
666
|
const l = i || s ? undefined : r;
|
|
821
|
-
if (e.
|
|
667
|
+
if (e.pe) {
|
|
822
668
|
if (c) {
|
|
823
|
-
e.
|
|
669
|
+
e.pe(t, n);
|
|
824
670
|
} else {
|
|
825
|
-
e.
|
|
671
|
+
e.pe();
|
|
826
672
|
}
|
|
827
673
|
return;
|
|
828
674
|
}
|
|
829
|
-
for (let i = e.
|
|
830
|
-
i.
|
|
831
|
-
if (i.
|
|
832
|
-
!i.
|
|
833
|
-
notifyStatus(i.
|
|
675
|
+
for (let i = e.I; i !== null; i = i.p) {
|
|
676
|
+
i.h.J = clock;
|
|
677
|
+
if (i.h.q !== n) {
|
|
678
|
+
!i.h.ne && globalQueue.$.push(i.h);
|
|
679
|
+
notifyStatus(i.h, t, n, c, l);
|
|
834
680
|
}
|
|
835
681
|
}
|
|
836
|
-
for (let i = e.
|
|
837
|
-
for (let e = i.
|
|
838
|
-
e.
|
|
839
|
-
if (e.
|
|
840
|
-
!e.
|
|
841
|
-
notifyStatus(e.
|
|
682
|
+
for (let i = e.A; i !== null; i = i.P) {
|
|
683
|
+
for (let e = i.I; e !== null; e = e.p) {
|
|
684
|
+
e.h.J = clock;
|
|
685
|
+
if (e.h.q !== n) {
|
|
686
|
+
!e.h.ne && globalQueue.$.push(e.h);
|
|
687
|
+
notifyStatus(e.h, t, n, c, l);
|
|
842
688
|
}
|
|
843
689
|
}
|
|
844
690
|
}
|
|
845
691
|
}
|
|
846
|
-
function
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
692
|
+
function effect(e, t, n, i, r) {
|
|
693
|
+
let o = false;
|
|
694
|
+
const s = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
|
|
695
|
+
...r,
|
|
696
|
+
equals: () => {
|
|
697
|
+
s.oe = !s.q;
|
|
698
|
+
if (o) s.se.enqueue(s.re, runEffect.bind(s));
|
|
699
|
+
return false;
|
|
700
|
+
},
|
|
701
|
+
lazy: true
|
|
702
|
+
});
|
|
703
|
+
s.he = i;
|
|
704
|
+
s.Ae = t;
|
|
705
|
+
s.ge = n;
|
|
706
|
+
s.Pe = undefined;
|
|
707
|
+
s.re = r?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
708
|
+
s.pe = (e, t) => {
|
|
709
|
+
const n = e !== undefined ? e : s.ae;
|
|
710
|
+
const i = t !== undefined ? t : s.q;
|
|
711
|
+
if (n & STATUS_ERROR) {
|
|
712
|
+
let e = i;
|
|
713
|
+
s.se.notify(s, STATUS_PENDING, 0);
|
|
714
|
+
if (s.re === EFFECT_USER) {
|
|
715
|
+
try {
|
|
716
|
+
return s.ge
|
|
717
|
+
? s.ge(e, () => {
|
|
718
|
+
s.Pe?.();
|
|
719
|
+
s.Pe = undefined;
|
|
720
|
+
})
|
|
721
|
+
: console.error(e);
|
|
722
|
+
} catch (t) {
|
|
723
|
+
e = t;
|
|
724
|
+
}
|
|
853
725
|
}
|
|
854
|
-
if (
|
|
855
|
-
|
|
726
|
+
if (!s.se.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
727
|
+
} else if (s.re === EFFECT_RENDER) s.se.notify(s, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
728
|
+
};
|
|
729
|
+
recompute(s, true);
|
|
730
|
+
!r?.defer && (s.re === EFFECT_USER ? s.se.enqueue(s.re, runEffect.bind(s)) : runEffect.call(s));
|
|
731
|
+
o = true;
|
|
732
|
+
onCleanup(() => s.Pe?.());
|
|
733
|
+
}
|
|
734
|
+
function runEffect() {
|
|
735
|
+
if (!this.oe || this.S & REACTIVE_DISPOSED) return;
|
|
736
|
+
this.Pe?.();
|
|
737
|
+
this.Pe = undefined;
|
|
738
|
+
try {
|
|
739
|
+
this.Pe = this.Ae(this.le, this.he);
|
|
740
|
+
} catch (e) {
|
|
741
|
+
if (!this.se.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
742
|
+
} finally {
|
|
743
|
+
this.he = this.le;
|
|
744
|
+
this.oe = false;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
function trackedEffect(e, t) {
|
|
748
|
+
const run = () => {
|
|
749
|
+
if (!n.oe || n.S & REACTIVE_DISPOSED) return;
|
|
750
|
+
n.oe = false;
|
|
751
|
+
recompute(n);
|
|
752
|
+
};
|
|
753
|
+
const n = computed(
|
|
754
|
+
() => {
|
|
755
|
+
try {
|
|
756
|
+
n.Pe?.();
|
|
757
|
+
n.Pe = undefined;
|
|
758
|
+
n.Pe = staleValues(e) || undefined;
|
|
759
|
+
} finally {
|
|
856
760
|
}
|
|
761
|
+
},
|
|
762
|
+
undefined,
|
|
763
|
+
{ ...t, lazy: true, pureWrite: true }
|
|
764
|
+
);
|
|
765
|
+
n.Pe = undefined;
|
|
766
|
+
n.oe = true;
|
|
767
|
+
n.re = EFFECT_TRACKED;
|
|
768
|
+
n.ue = run;
|
|
769
|
+
n.se.enqueue(EFFECT_USER, run);
|
|
770
|
+
onCleanup(() => n.Pe?.());
|
|
771
|
+
}
|
|
772
|
+
const PENDING_OWNER = {};
|
|
773
|
+
function markDisposal(e) {
|
|
774
|
+
let t = e.Ce;
|
|
775
|
+
while (t) {
|
|
776
|
+
t.S |= REACTIVE_ZOMBIE;
|
|
777
|
+
if (t.S & REACTIVE_IN_HEAP) {
|
|
778
|
+
deleteFromHeap(t, dirtyQueue);
|
|
779
|
+
insertIntoHeap(t, zombieQueue);
|
|
857
780
|
}
|
|
781
|
+
markDisposal(t);
|
|
782
|
+
t = t.Ne;
|
|
858
783
|
}
|
|
859
|
-
|
|
860
|
-
|
|
784
|
+
}
|
|
785
|
+
function dispose(e) {
|
|
786
|
+
let t = e.N || null;
|
|
787
|
+
do {
|
|
788
|
+
t = unlinkSubs(t);
|
|
789
|
+
} while (t !== null);
|
|
790
|
+
e.N = null;
|
|
791
|
+
e.ye = null;
|
|
792
|
+
disposeChildren(e, true);
|
|
793
|
+
}
|
|
794
|
+
function disposeChildren(e, t = false, n) {
|
|
795
|
+
if (e.S & REACTIVE_DISPOSED) return;
|
|
796
|
+
if (t) e.S = REACTIVE_DISPOSED;
|
|
797
|
+
let i = n ? e.De : e.Ce;
|
|
798
|
+
while (i) {
|
|
799
|
+
const e = i.Ne;
|
|
800
|
+
if (i.N) {
|
|
801
|
+
const e = i;
|
|
802
|
+
deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
803
|
+
let t = e.N;
|
|
804
|
+
do {
|
|
805
|
+
t = unlinkSubs(t);
|
|
806
|
+
} while (t !== null);
|
|
807
|
+
e.N = null;
|
|
808
|
+
e.ye = null;
|
|
809
|
+
}
|
|
810
|
+
disposeChildren(i, true);
|
|
811
|
+
i = e;
|
|
861
812
|
}
|
|
862
|
-
|
|
813
|
+
if (n) {
|
|
814
|
+
e.De = null;
|
|
815
|
+
} else {
|
|
816
|
+
e.Ce = null;
|
|
817
|
+
e.Ne = null;
|
|
818
|
+
}
|
|
819
|
+
runDisposal(e, n);
|
|
820
|
+
}
|
|
821
|
+
function runDisposal(e, t) {
|
|
822
|
+
let n = t ? e.ve : e.we;
|
|
823
|
+
if (!n) return;
|
|
824
|
+
if (Array.isArray(n)) {
|
|
825
|
+
for (let e = 0; e < n.length; e++) {
|
|
826
|
+
const t = n[e];
|
|
827
|
+
t.call(t);
|
|
828
|
+
}
|
|
829
|
+
} else {
|
|
830
|
+
n.call(n);
|
|
831
|
+
}
|
|
832
|
+
t ? (e.ve = null) : (e.we = null);
|
|
833
|
+
}
|
|
834
|
+
function getNextChildId(e) {
|
|
835
|
+
if (e.id != null) return formatId(e.id, e.be++);
|
|
836
|
+
throw new Error("Cannot get child id from owner without an id");
|
|
837
|
+
}
|
|
838
|
+
function formatId(e, t) {
|
|
839
|
+
const n = t.toString(36),
|
|
840
|
+
i = n.length - 1;
|
|
841
|
+
return e + (i ? String.fromCharCode(64 + i) : "") + n;
|
|
842
|
+
}
|
|
843
|
+
function getObserver() {
|
|
844
|
+
if (pendingCheckActive || pendingReadActive) return PENDING_OWNER;
|
|
845
|
+
return tracking ? context : null;
|
|
846
|
+
}
|
|
847
|
+
function getOwner() {
|
|
848
|
+
return context;
|
|
849
|
+
}
|
|
850
|
+
function onCleanup(e) {
|
|
851
|
+
if (!context) return e;
|
|
852
|
+
if (!context.we) context.we = e;
|
|
853
|
+
else if (Array.isArray(context.we)) context.we.push(e);
|
|
854
|
+
else context.we = [context.we, e];
|
|
855
|
+
return e;
|
|
856
|
+
}
|
|
857
|
+
function createOwner(e) {
|
|
858
|
+
const t = context;
|
|
859
|
+
const n = {
|
|
860
|
+
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
861
|
+
t: true,
|
|
862
|
+
u: t?.t ? t.u : t,
|
|
863
|
+
Ce: null,
|
|
864
|
+
Ne: null,
|
|
865
|
+
we: null,
|
|
866
|
+
se: t?.se ?? globalQueue,
|
|
867
|
+
Ve: t?.Ve || defaultContext,
|
|
868
|
+
be: 0,
|
|
869
|
+
ve: null,
|
|
870
|
+
De: null,
|
|
871
|
+
i: t,
|
|
872
|
+
dispose(e = true) {
|
|
873
|
+
disposeChildren(n, e);
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
if (t) {
|
|
877
|
+
const e = t.Ce;
|
|
878
|
+
if (e === null) {
|
|
879
|
+
t.Ce = n;
|
|
880
|
+
} else {
|
|
881
|
+
n.Ne = e;
|
|
882
|
+
t.Ce = n;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
return n;
|
|
886
|
+
}
|
|
887
|
+
function createRoot(e, t) {
|
|
888
|
+
const n = createOwner(t);
|
|
889
|
+
return runWithOwner(n, () => e(n.dispose));
|
|
863
890
|
}
|
|
864
891
|
function unlinkSubs(e) {
|
|
865
892
|
const t = e.V;
|
|
866
|
-
const n = e.
|
|
867
|
-
const i = e.
|
|
868
|
-
const r = e.
|
|
869
|
-
if (i !== null) i.
|
|
870
|
-
else t.
|
|
871
|
-
if (r !== null) r.
|
|
893
|
+
const n = e.D;
|
|
894
|
+
const i = e.p;
|
|
895
|
+
const r = e.me;
|
|
896
|
+
if (i !== null) i.me = r;
|
|
897
|
+
else t.Le = r;
|
|
898
|
+
if (r !== null) r.p = i;
|
|
872
899
|
else {
|
|
873
|
-
t.
|
|
900
|
+
t.I = i;
|
|
874
901
|
if (i === null) {
|
|
875
|
-
t.
|
|
876
|
-
t.
|
|
902
|
+
t.ke?.();
|
|
903
|
+
t.L && !t.Ue && unobserved(t);
|
|
877
904
|
}
|
|
878
905
|
}
|
|
879
906
|
return n;
|
|
880
907
|
}
|
|
881
908
|
function unobserved(e) {
|
|
882
|
-
deleteFromHeap(e, e.
|
|
883
|
-
let t = e.
|
|
909
|
+
deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
910
|
+
let t = e.N;
|
|
884
911
|
while (t !== null) {
|
|
885
912
|
t = unlinkSubs(t);
|
|
886
913
|
}
|
|
887
|
-
e.
|
|
914
|
+
e.N = null;
|
|
888
915
|
disposeChildren(e, true);
|
|
889
916
|
}
|
|
890
917
|
function link(e, t) {
|
|
891
|
-
const n = t.
|
|
918
|
+
const n = t.ye;
|
|
892
919
|
if (n !== null && n.V === e) return;
|
|
893
920
|
let i = null;
|
|
894
|
-
const r = t.
|
|
921
|
+
const r = t.S & REACTIVE_RECOMPUTING_DEPS;
|
|
895
922
|
if (r) {
|
|
896
|
-
i = n !== null ? n.
|
|
923
|
+
i = n !== null ? n.D : t.N;
|
|
897
924
|
if (i !== null && i.V === e) {
|
|
898
|
-
t.
|
|
925
|
+
t.ye = i;
|
|
899
926
|
return;
|
|
900
927
|
}
|
|
901
928
|
}
|
|
902
|
-
const o = e.
|
|
903
|
-
if (o !== null && o.
|
|
904
|
-
const s = (t.
|
|
905
|
-
if (n !== null) n.
|
|
906
|
-
else t.
|
|
907
|
-
if (o !== null) o.
|
|
908
|
-
else e.
|
|
929
|
+
const o = e.Le;
|
|
930
|
+
if (o !== null && o.h === t && (!r || isValidLink(o, t))) return;
|
|
931
|
+
const s = (t.ye = e.Le = { V: e, h: t, D: i, me: o, p: null });
|
|
932
|
+
if (n !== null) n.D = s;
|
|
933
|
+
else t.N = s;
|
|
934
|
+
if (o !== null) o.p = s;
|
|
935
|
+
else e.I = s;
|
|
909
936
|
}
|
|
910
937
|
function isValidLink(e, t) {
|
|
911
|
-
const n = t.
|
|
938
|
+
const n = t.ye;
|
|
912
939
|
if (n !== null) {
|
|
913
|
-
let i = t.
|
|
940
|
+
let i = t.N;
|
|
914
941
|
do {
|
|
915
942
|
if (i === e) return true;
|
|
916
943
|
if (i === n) break;
|
|
917
|
-
i = i.
|
|
944
|
+
i = i.D;
|
|
918
945
|
} while (i !== null);
|
|
919
946
|
}
|
|
920
947
|
return false;
|
|
921
948
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
949
|
+
GlobalQueue.K = recompute;
|
|
950
|
+
GlobalQueue.Y = disposeChildren;
|
|
951
|
+
let tracking = false;
|
|
952
|
+
let stale = false;
|
|
953
|
+
let refreshing = false;
|
|
954
|
+
let pendingCheckActive = false;
|
|
955
|
+
let foundPending = false;
|
|
956
|
+
let pendingReadActive = false;
|
|
957
|
+
let context = null;
|
|
958
|
+
let currentOptimisticLane = null;
|
|
959
|
+
function recompute(e, t = false) {
|
|
960
|
+
const n = e.re;
|
|
961
|
+
if (!t) {
|
|
962
|
+
if (e.ne && (!n || activeTransition) && activeTransition !== e.ne)
|
|
963
|
+
globalQueue.initTransition(e.ne);
|
|
964
|
+
deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
965
|
+
if (e.ne || n === EFFECT_TRACKED) disposeChildren(e);
|
|
966
|
+
else {
|
|
967
|
+
markDisposal(e);
|
|
968
|
+
e.ve = e.we;
|
|
969
|
+
e.De = e.Ce;
|
|
970
|
+
e.we = null;
|
|
971
|
+
e.Ce = null;
|
|
929
972
|
}
|
|
930
|
-
markDisposal(t);
|
|
931
|
-
t = t.we;
|
|
932
973
|
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
e.
|
|
940
|
-
e.
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
974
|
+
const i = !!(e.S & REACTIVE_OPTIMISTIC_DIRTY);
|
|
975
|
+
const r = hasActiveOverride(e);
|
|
976
|
+
const o = !!(e.ae & STATUS_PENDING);
|
|
977
|
+
const s = context;
|
|
978
|
+
context = e;
|
|
979
|
+
e.ye = null;
|
|
980
|
+
e.S = REACTIVE_RECOMPUTING_DEPS;
|
|
981
|
+
e.J = clock;
|
|
982
|
+
let u = e.ce === NOT_PENDING ? e.le : e.ce;
|
|
983
|
+
let c = e.o;
|
|
984
|
+
let l = tracking;
|
|
985
|
+
let a = currentOptimisticLane;
|
|
986
|
+
tracking = true;
|
|
987
|
+
if (i) {
|
|
988
|
+
const t = resolveLane(e);
|
|
989
|
+
if (t) currentOptimisticLane = t;
|
|
990
|
+
}
|
|
991
|
+
try {
|
|
992
|
+
u = handleAsync(e, e.L(u));
|
|
993
|
+
clearStatus(e);
|
|
994
|
+
const t = resolveLane(e);
|
|
995
|
+
if (t) {
|
|
996
|
+
t.U.delete(e);
|
|
997
|
+
updatePendingSignal(t.fe);
|
|
998
|
+
}
|
|
999
|
+
} catch (t) {
|
|
1000
|
+
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
1001
|
+
const t = findLane(currentOptimisticLane);
|
|
1002
|
+
if (t.fe !== e) {
|
|
1003
|
+
t.U.add(e);
|
|
1004
|
+
e.ie = t;
|
|
1005
|
+
updatePendingSignal(t.fe);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
notifyStatus(
|
|
1009
|
+
e,
|
|
1010
|
+
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
1011
|
+
t,
|
|
1012
|
+
undefined,
|
|
1013
|
+
t instanceof NotReadyError ? e.ie : undefined
|
|
1014
|
+
);
|
|
1015
|
+
} finally {
|
|
1016
|
+
tracking = l;
|
|
1017
|
+
e.S = REACTIVE_NONE;
|
|
1018
|
+
context = s;
|
|
1019
|
+
}
|
|
1020
|
+
if (!e.q) {
|
|
1021
|
+
const s = e.ye;
|
|
1022
|
+
let l = s !== null ? s.D : e.N;
|
|
1023
|
+
if (l !== null) {
|
|
953
1024
|
do {
|
|
954
|
-
|
|
955
|
-
} while (
|
|
956
|
-
|
|
957
|
-
e.
|
|
1025
|
+
l = unlinkSubs(l);
|
|
1026
|
+
} while (l !== null);
|
|
1027
|
+
if (s !== null) s.D = null;
|
|
1028
|
+
else e.N = null;
|
|
1029
|
+
}
|
|
1030
|
+
const a = r ? e.le : e.ce === NOT_PENDING ? e.le : e.ce;
|
|
1031
|
+
const f = !e._e || !e._e(a, u);
|
|
1032
|
+
if (f) {
|
|
1033
|
+
const s = r ? e.le : undefined;
|
|
1034
|
+
if (t || (n && activeTransition !== e.ne) || i) e.le = u;
|
|
1035
|
+
else e.ce = u;
|
|
1036
|
+
if (r && !i && o) {
|
|
1037
|
+
const t = e.Re || 0;
|
|
1038
|
+
const n = e.de || 0;
|
|
1039
|
+
if (t <= n) e.le = u;
|
|
1040
|
+
}
|
|
1041
|
+
if (!r || i || e.le !== s) {
|
|
1042
|
+
insertSubs(e, i || r);
|
|
1043
|
+
}
|
|
1044
|
+
} else if (r) {
|
|
1045
|
+
e.ce = u;
|
|
1046
|
+
} else if (e.o != c) {
|
|
1047
|
+
for (let t = e.I; t !== null; t = t.p) {
|
|
1048
|
+
insertIntoHeapHeight(t.h, t.h.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1049
|
+
}
|
|
958
1050
|
}
|
|
959
|
-
disposeChildren(i, true);
|
|
960
|
-
i = e;
|
|
961
|
-
}
|
|
962
|
-
if (n) {
|
|
963
|
-
e.Ie = null;
|
|
964
|
-
} else {
|
|
965
|
-
e.pe = null;
|
|
966
|
-
e.we = null;
|
|
967
1051
|
}
|
|
968
|
-
|
|
1052
|
+
currentOptimisticLane = a;
|
|
1053
|
+
(!t || e.ae & STATUS_PENDING) && !e.ne && !(activeTransition && e.Oe) && globalQueue.$.push(e);
|
|
1054
|
+
e.ne && n && activeTransition !== e.ne && runInTransition(e.ne, () => recompute(e));
|
|
969
1055
|
}
|
|
970
|
-
function
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1056
|
+
function updateIfNecessary(e) {
|
|
1057
|
+
if (e.S & REACTIVE_CHECK) {
|
|
1058
|
+
for (let t = e.N; t; t = t.D) {
|
|
1059
|
+
const n = t.V;
|
|
1060
|
+
const i = n.m || n;
|
|
1061
|
+
if (i.L) {
|
|
1062
|
+
updateIfNecessary(i);
|
|
1063
|
+
}
|
|
1064
|
+
if (e.S & REACTIVE_DIRTY) {
|
|
1065
|
+
break;
|
|
1066
|
+
}
|
|
977
1067
|
}
|
|
978
|
-
} else {
|
|
979
|
-
n.call(n);
|
|
980
1068
|
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
throw new Error("Cannot get child id from owner without an id");
|
|
986
|
-
}
|
|
987
|
-
function formatId(e, t) {
|
|
988
|
-
const n = t.toString(36),
|
|
989
|
-
i = n.length - 1;
|
|
990
|
-
return e + (i ? String.fromCharCode(64 + i) : "") + n;
|
|
1069
|
+
if (e.S & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.q && e.J < clock)) {
|
|
1070
|
+
recompute(e);
|
|
1071
|
+
}
|
|
1072
|
+
e.S = REACTIVE_NONE;
|
|
991
1073
|
}
|
|
992
1074
|
function computed(e, t, n) {
|
|
993
1075
|
const i = {
|
|
994
1076
|
id: n?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1077
|
+
_e: n?.equals != null ? n.equals : isEqual,
|
|
1078
|
+
We: !!n?.pureWrite,
|
|
1079
|
+
ke: n?.unobserved,
|
|
1080
|
+
we: null,
|
|
1081
|
+
se: context?.se ?? globalQueue,
|
|
1000
1082
|
Ve: context?.Ve ?? defaultContext,
|
|
1001
1083
|
be: 0,
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1084
|
+
L: e,
|
|
1085
|
+
le: t,
|
|
1086
|
+
o: 0,
|
|
1087
|
+
A: null,
|
|
1088
|
+
R: undefined,
|
|
1089
|
+
T: null,
|
|
1005
1090
|
N: null,
|
|
1006
|
-
O: undefined,
|
|
1007
|
-
R: null,
|
|
1008
|
-
D: null,
|
|
1009
|
-
he: null,
|
|
1010
|
-
p: null,
|
|
1011
1091
|
ye: null,
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1092
|
+
I: null,
|
|
1093
|
+
Le: null,
|
|
1094
|
+
i: context,
|
|
1095
|
+
Ne: null,
|
|
1096
|
+
Ce: null,
|
|
1097
|
+
S: REACTIVE_NONE,
|
|
1098
|
+
ae: STATUS_UNINITIALIZED,
|
|
1099
|
+
J: clock,
|
|
1100
|
+
ce: NOT_PENDING,
|
|
1101
|
+
ve: null,
|
|
1102
|
+
De: null,
|
|
1019
1103
|
Se: null,
|
|
1020
|
-
|
|
1021
|
-
ge: null,
|
|
1022
|
-
$: null
|
|
1104
|
+
ne: null
|
|
1023
1105
|
};
|
|
1024
|
-
i.
|
|
1025
|
-
const r = context?.
|
|
1106
|
+
i.T = i;
|
|
1107
|
+
const r = context?.t ? context.u : context;
|
|
1026
1108
|
if (context) {
|
|
1027
|
-
const e = context.
|
|
1109
|
+
const e = context.Ce;
|
|
1028
1110
|
if (e === null) {
|
|
1029
|
-
context.
|
|
1111
|
+
context.Ce = i;
|
|
1030
1112
|
} else {
|
|
1031
|
-
i.
|
|
1032
|
-
context.
|
|
1113
|
+
i.Ne = e;
|
|
1114
|
+
context.Ce = i;
|
|
1033
1115
|
}
|
|
1034
1116
|
}
|
|
1035
|
-
if (r) i.
|
|
1117
|
+
if (r) i.o = r.o + 1;
|
|
1036
1118
|
!n?.lazy && recompute(i, true);
|
|
1037
1119
|
return i;
|
|
1038
1120
|
}
|
|
1039
1121
|
function signal(e, t, n = null) {
|
|
1040
1122
|
const i = {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
P: n?.
|
|
1050
|
-
|
|
1123
|
+
_e: t?.equals != null ? t.equals : isEqual,
|
|
1124
|
+
We: !!t?.pureWrite,
|
|
1125
|
+
ke: t?.unobserved,
|
|
1126
|
+
le: e,
|
|
1127
|
+
I: null,
|
|
1128
|
+
Le: null,
|
|
1129
|
+
J: clock,
|
|
1130
|
+
m: n,
|
|
1131
|
+
P: n?.A || null,
|
|
1132
|
+
ce: NOT_PENDING
|
|
1051
1133
|
};
|
|
1052
|
-
n && (n.
|
|
1134
|
+
n && (n.A = i);
|
|
1053
1135
|
return i;
|
|
1054
1136
|
}
|
|
1055
1137
|
function optimisticSignal(e, t) {
|
|
1056
1138
|
const n = signal(e, t);
|
|
1057
|
-
n.
|
|
1139
|
+
n.Oe = true;
|
|
1058
1140
|
return n;
|
|
1059
1141
|
}
|
|
1060
1142
|
function optimisticComputed(e, t, n) {
|
|
1061
1143
|
const i = computed(e, t, n);
|
|
1062
|
-
i.
|
|
1144
|
+
i.Oe = true;
|
|
1063
1145
|
return i;
|
|
1064
1146
|
}
|
|
1065
|
-
function getPendingSignal(e) {
|
|
1066
|
-
if (!e.Le) {
|
|
1067
|
-
e.Le = optimisticSignal(false, { pureWrite: true });
|
|
1068
|
-
if (e.k) {
|
|
1069
|
-
e.Le.k = e;
|
|
1070
|
-
}
|
|
1071
|
-
if (computePendingState(e)) setSignal(e.Le, true);
|
|
1072
|
-
}
|
|
1073
|
-
return e.Le;
|
|
1074
|
-
}
|
|
1075
|
-
function computePendingState(e) {
|
|
1076
|
-
const t = e;
|
|
1077
|
-
if (e.Y && e.B !== NOT_PENDING) {
|
|
1078
|
-
if (t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
|
|
1079
|
-
if (e.k) {
|
|
1080
|
-
const t = e.W ? findLane(e.W) : null;
|
|
1081
|
-
return !!(t && t.G.size > 0);
|
|
1082
|
-
}
|
|
1083
|
-
return true;
|
|
1084
|
-
}
|
|
1085
|
-
if (e.B !== NOT_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
|
|
1086
|
-
return !!(t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED));
|
|
1087
|
-
}
|
|
1088
|
-
function getPendingValueComputed(e) {
|
|
1089
|
-
if (!e.Ne) {
|
|
1090
|
-
const t = pendingReadActive;
|
|
1091
|
-
pendingReadActive = false;
|
|
1092
|
-
const n = pendingCheckActive;
|
|
1093
|
-
pendingCheckActive = false;
|
|
1094
|
-
const i = context;
|
|
1095
|
-
context = null;
|
|
1096
|
-
e.Ne = optimisticComputed(() => read(e));
|
|
1097
|
-
e.Ne.k = e;
|
|
1098
|
-
context = i;
|
|
1099
|
-
pendingCheckActive = n;
|
|
1100
|
-
pendingReadActive = t;
|
|
1101
|
-
}
|
|
1102
|
-
return e.Ne;
|
|
1103
|
-
}
|
|
1104
|
-
function updatePendingSignal(e) {
|
|
1105
|
-
if (e.Le) {
|
|
1106
|
-
const t = computePendingState(e);
|
|
1107
|
-
const n = e.Le;
|
|
1108
|
-
setSignal(n, t);
|
|
1109
|
-
if (!t && n.W) {
|
|
1110
|
-
const t = resolveLane(e);
|
|
1111
|
-
if (t && t.G.size > 0) {
|
|
1112
|
-
const e = findLane(n.W);
|
|
1113
|
-
if (e !== t) {
|
|
1114
|
-
mergeLanes(t, e);
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
clearLaneEntry(n);
|
|
1118
|
-
n.W = undefined;
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
1147
|
function isEqual(e, t) {
|
|
1123
1148
|
return e === t;
|
|
1124
1149
|
}
|
|
@@ -1138,18 +1163,18 @@ function read(e) {
|
|
|
1138
1163
|
pendingReadActive = false;
|
|
1139
1164
|
const i = read(t);
|
|
1140
1165
|
pendingReadActive = n;
|
|
1141
|
-
if (t.
|
|
1142
|
-
if (stale && currentOptimisticLane && t.
|
|
1143
|
-
const n = findLane(t.
|
|
1166
|
+
if (t.ae & STATUS_PENDING) return e.le;
|
|
1167
|
+
if (stale && currentOptimisticLane && t.ie) {
|
|
1168
|
+
const n = findLane(t.ie);
|
|
1144
1169
|
const i = findLane(currentOptimisticLane);
|
|
1145
|
-
if (n !== i && n.
|
|
1146
|
-
return e.
|
|
1170
|
+
if (n !== i && n.U.size > 0) {
|
|
1171
|
+
return e.le;
|
|
1147
1172
|
}
|
|
1148
1173
|
}
|
|
1149
1174
|
return i;
|
|
1150
1175
|
}
|
|
1151
1176
|
if (pendingCheckActive) {
|
|
1152
|
-
const t = e.
|
|
1177
|
+
const t = e.m || e;
|
|
1153
1178
|
const n = getPendingSignal(t);
|
|
1154
1179
|
const i = pendingCheckActive;
|
|
1155
1180
|
pendingCheckActive = false;
|
|
@@ -1157,145 +1182,96 @@ function read(e) {
|
|
|
1157
1182
|
foundPending = true;
|
|
1158
1183
|
}
|
|
1159
1184
|
pendingCheckActive = i;
|
|
1160
|
-
return e.
|
|
1185
|
+
return e.le;
|
|
1161
1186
|
}
|
|
1162
1187
|
let t = context;
|
|
1163
|
-
if (t?.
|
|
1164
|
-
if (refreshing && e.
|
|
1188
|
+
if (t?.t) t = t.u;
|
|
1189
|
+
if (refreshing && e.L) recompute(e);
|
|
1165
1190
|
if (t && tracking) {
|
|
1166
|
-
if (e.
|
|
1191
|
+
if (e.L && e.S & REACTIVE_DISPOSED) recompute(e);
|
|
1167
1192
|
link(e, t);
|
|
1168
|
-
const n = e.
|
|
1169
|
-
if (n.
|
|
1170
|
-
const i = e.
|
|
1171
|
-
if (n.
|
|
1193
|
+
const n = e.m || e;
|
|
1194
|
+
if (n.L) {
|
|
1195
|
+
const i = e.S & REACTIVE_ZOMBIE;
|
|
1196
|
+
if (n.o >= (i ? zombieQueue.C : dirtyQueue.C)) {
|
|
1172
1197
|
markNode(t);
|
|
1173
1198
|
markHeap(i ? zombieQueue : dirtyQueue);
|
|
1174
1199
|
updateIfNecessary(n);
|
|
1175
1200
|
}
|
|
1176
|
-
const r = n.
|
|
1177
|
-
if (r >= t.
|
|
1178
|
-
t.
|
|
1201
|
+
const r = n.o;
|
|
1202
|
+
if (r >= t.o && e.i !== t) {
|
|
1203
|
+
t.o = r + 1;
|
|
1179
1204
|
}
|
|
1180
1205
|
}
|
|
1181
1206
|
}
|
|
1182
|
-
const n = e.
|
|
1183
|
-
if (t && n.
|
|
1207
|
+
const n = e.m || e;
|
|
1208
|
+
if (t && n.ae & STATUS_PENDING && !(stale && n.ne && activeTransition !== n.ne)) {
|
|
1184
1209
|
if (currentOptimisticLane) {
|
|
1185
|
-
const i = n.
|
|
1210
|
+
const i = n.ie;
|
|
1186
1211
|
const r = findLane(currentOptimisticLane);
|
|
1187
1212
|
if (i && findLane(i) === r && !hasActiveOverride(n)) {
|
|
1188
1213
|
if (!tracking) link(e, t);
|
|
1189
|
-
throw n.
|
|
1214
|
+
throw n.q;
|
|
1190
1215
|
}
|
|
1191
1216
|
} else {
|
|
1192
1217
|
if (!tracking) link(e, t);
|
|
1193
|
-
throw n.
|
|
1218
|
+
throw n.q;
|
|
1194
1219
|
}
|
|
1195
1220
|
}
|
|
1196
|
-
if (e.
|
|
1197
|
-
if (e.
|
|
1221
|
+
if (e.L && e.ae & STATUS_ERROR) {
|
|
1222
|
+
if (e.J < clock) {
|
|
1198
1223
|
recompute(e, true);
|
|
1199
1224
|
return read(e);
|
|
1200
|
-
} else throw e.
|
|
1225
|
+
} else throw e.q;
|
|
1201
1226
|
}
|
|
1202
1227
|
return !t ||
|
|
1203
1228
|
currentOptimisticLane !== null ||
|
|
1204
|
-
e.
|
|
1205
|
-
(stale && e
|
|
1206
|
-
? e.
|
|
1207
|
-
: e.
|
|
1229
|
+
e.ce === NOT_PENDING ||
|
|
1230
|
+
(stale && e.ne && activeTransition !== e.ne)
|
|
1231
|
+
? e.le
|
|
1232
|
+
: e.ce;
|
|
1208
1233
|
}
|
|
1209
1234
|
function setSignal(e, t) {
|
|
1210
|
-
if (e
|
|
1211
|
-
const n = e.
|
|
1212
|
-
const i = n ? e.
|
|
1235
|
+
if (e.ne && activeTransition !== e.ne) globalQueue.initTransition(e.ne);
|
|
1236
|
+
const n = e.Oe && !projectionWriteActive;
|
|
1237
|
+
const i = n ? e.le : e.ce === NOT_PENDING ? e.le : e.ce;
|
|
1213
1238
|
if (typeof t === "function") t = t(i);
|
|
1214
|
-
const r = !e.
|
|
1239
|
+
const r = !e._e || !e._e(i, t);
|
|
1215
1240
|
if (!r) {
|
|
1216
|
-
if (n && e.
|
|
1241
|
+
if (n && e.ce !== NOT_PENDING && e.L) {
|
|
1217
1242
|
insertSubs(e, true);
|
|
1218
1243
|
schedule();
|
|
1219
1244
|
}
|
|
1220
1245
|
return t;
|
|
1221
1246
|
}
|
|
1222
1247
|
if (n) {
|
|
1223
|
-
const n = globalQueue.
|
|
1224
|
-
if (e
|
|
1225
|
-
globalQueue.initTransition(e
|
|
1248
|
+
const n = globalQueue.H.includes(e);
|
|
1249
|
+
if (e.ne && n) {
|
|
1250
|
+
globalQueue.initTransition(e.ne);
|
|
1226
1251
|
}
|
|
1227
|
-
if (e.
|
|
1228
|
-
e.
|
|
1252
|
+
if (e.ce === NOT_PENDING) {
|
|
1253
|
+
e.ce = e.le;
|
|
1229
1254
|
}
|
|
1230
1255
|
if (!n) {
|
|
1231
|
-
globalQueue.
|
|
1256
|
+
globalQueue.H.push(e);
|
|
1232
1257
|
}
|
|
1233
|
-
e.
|
|
1258
|
+
e.Re = (e.Re || 0) + 1;
|
|
1234
1259
|
const i = getOrCreateLane(e);
|
|
1235
|
-
e.
|
|
1236
|
-
e.
|
|
1260
|
+
e.ie = i;
|
|
1261
|
+
e.le = t;
|
|
1237
1262
|
} else {
|
|
1238
|
-
if (e.
|
|
1239
|
-
e.
|
|
1263
|
+
if (e.ce === NOT_PENDING) globalQueue.$.push(e);
|
|
1264
|
+
e.ce = t;
|
|
1240
1265
|
}
|
|
1241
1266
|
updatePendingSignal(e);
|
|
1242
|
-
if (e.
|
|
1243
|
-
setSignal(e.
|
|
1267
|
+
if (e.Ie) {
|
|
1268
|
+
setSignal(e.Ie, t);
|
|
1244
1269
|
}
|
|
1245
|
-
e.
|
|
1270
|
+
e.J = clock;
|
|
1246
1271
|
insertSubs(e, n);
|
|
1247
1272
|
schedule();
|
|
1248
1273
|
return t;
|
|
1249
1274
|
}
|
|
1250
|
-
const PENDING_OWNER = {};
|
|
1251
|
-
function getObserver() {
|
|
1252
|
-
if (pendingCheckActive || pendingReadActive) return PENDING_OWNER;
|
|
1253
|
-
return tracking ? context : null;
|
|
1254
|
-
}
|
|
1255
|
-
function getOwner() {
|
|
1256
|
-
return context;
|
|
1257
|
-
}
|
|
1258
|
-
function onCleanup(e) {
|
|
1259
|
-
if (!context) return e;
|
|
1260
|
-
if (!context._e) context._e = e;
|
|
1261
|
-
else if (Array.isArray(context._e)) context._e.push(e);
|
|
1262
|
-
else context._e = [context._e, e];
|
|
1263
|
-
return e;
|
|
1264
|
-
}
|
|
1265
|
-
function createOwner(e) {
|
|
1266
|
-
const t = context;
|
|
1267
|
-
const n = {
|
|
1268
|
-
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
1269
|
-
i: true,
|
|
1270
|
-
l: t?.i ? t.l : t,
|
|
1271
|
-
pe: null,
|
|
1272
|
-
we: null,
|
|
1273
|
-
_e: null,
|
|
1274
|
-
Te: t?.Te ?? globalQueue,
|
|
1275
|
-
Ve: t?.Ve || defaultContext,
|
|
1276
|
-
be: 0,
|
|
1277
|
-
Se: null,
|
|
1278
|
-
Ie: null,
|
|
1279
|
-
o: t,
|
|
1280
|
-
dispose(e = true) {
|
|
1281
|
-
disposeChildren(n, e);
|
|
1282
|
-
}
|
|
1283
|
-
};
|
|
1284
|
-
if (t) {
|
|
1285
|
-
const e = t.pe;
|
|
1286
|
-
if (e === null) {
|
|
1287
|
-
t.pe = n;
|
|
1288
|
-
} else {
|
|
1289
|
-
n.we = e;
|
|
1290
|
-
t.pe = n;
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
return n;
|
|
1294
|
-
}
|
|
1295
|
-
function createRoot(e, t) {
|
|
1296
|
-
const n = createOwner(t);
|
|
1297
|
-
return runWithOwner(n, () => e(n.dispose));
|
|
1298
|
-
}
|
|
1299
1275
|
function runWithOwner(e, t) {
|
|
1300
1276
|
const n = context;
|
|
1301
1277
|
const i = tracking;
|
|
@@ -1308,6 +1284,63 @@ function runWithOwner(e, t) {
|
|
|
1308
1284
|
tracking = i;
|
|
1309
1285
|
}
|
|
1310
1286
|
}
|
|
1287
|
+
function getPendingSignal(e) {
|
|
1288
|
+
if (!e.Qe) {
|
|
1289
|
+
e.Qe = optimisticSignal(false, { pureWrite: true });
|
|
1290
|
+
if (e.Ee) {
|
|
1291
|
+
e.Qe.Ee = e;
|
|
1292
|
+
}
|
|
1293
|
+
if (computePendingState(e)) setSignal(e.Qe, true);
|
|
1294
|
+
}
|
|
1295
|
+
return e.Qe;
|
|
1296
|
+
}
|
|
1297
|
+
function computePendingState(e) {
|
|
1298
|
+
const t = e;
|
|
1299
|
+
if (e.Oe && e.ce !== NOT_PENDING) {
|
|
1300
|
+
if (t.ae & STATUS_PENDING && !(t.ae & STATUS_UNINITIALIZED)) return true;
|
|
1301
|
+
if (e.Ee) {
|
|
1302
|
+
const t = e.ie ? findLane(e.ie) : null;
|
|
1303
|
+
return !!(t && t.U.size > 0);
|
|
1304
|
+
}
|
|
1305
|
+
return true;
|
|
1306
|
+
}
|
|
1307
|
+
if (e.ce !== NOT_PENDING && !(t.ae & STATUS_UNINITIALIZED)) return true;
|
|
1308
|
+
return !!(t.ae & STATUS_PENDING && !(t.ae & STATUS_UNINITIALIZED));
|
|
1309
|
+
}
|
|
1310
|
+
function updatePendingSignal(e) {
|
|
1311
|
+
if (e.Qe) {
|
|
1312
|
+
const t = computePendingState(e);
|
|
1313
|
+
const n = e.Qe;
|
|
1314
|
+
setSignal(n, t);
|
|
1315
|
+
if (!t && n.ie) {
|
|
1316
|
+
const t = resolveLane(e);
|
|
1317
|
+
if (t && t.U.size > 0) {
|
|
1318
|
+
const e = findLane(n.ie);
|
|
1319
|
+
if (e !== t) {
|
|
1320
|
+
mergeLanes(t, e);
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
signalLanes.delete(n);
|
|
1324
|
+
n.ie = undefined;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
function getPendingValueComputed(e) {
|
|
1329
|
+
if (!e.Ie) {
|
|
1330
|
+
const t = pendingReadActive;
|
|
1331
|
+
pendingReadActive = false;
|
|
1332
|
+
const n = pendingCheckActive;
|
|
1333
|
+
pendingCheckActive = false;
|
|
1334
|
+
const i = context;
|
|
1335
|
+
context = null;
|
|
1336
|
+
e.Ie = optimisticComputed(() => read(e));
|
|
1337
|
+
e.Ie.Ee = e;
|
|
1338
|
+
context = i;
|
|
1339
|
+
pendingCheckActive = n;
|
|
1340
|
+
pendingReadActive = t;
|
|
1341
|
+
}
|
|
1342
|
+
return e.Ie;
|
|
1343
|
+
}
|
|
1311
1344
|
function staleValues(e, t = true) {
|
|
1312
1345
|
const n = stale;
|
|
1313
1346
|
stale = t;
|
|
@@ -1385,85 +1418,49 @@ function hasContext(e, t) {
|
|
|
1385
1418
|
function isUndefined(e) {
|
|
1386
1419
|
return typeof e === "undefined";
|
|
1387
1420
|
}
|
|
1388
|
-
function
|
|
1389
|
-
|
|
1390
|
-
const
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1421
|
+
function restoreTransition(e, t) {
|
|
1422
|
+
globalQueue.initTransition(e);
|
|
1423
|
+
const n = t();
|
|
1424
|
+
flush();
|
|
1425
|
+
return n;
|
|
1426
|
+
}
|
|
1427
|
+
function action(e) {
|
|
1428
|
+
return (...t) =>
|
|
1429
|
+
new Promise((n, i) => {
|
|
1430
|
+
const r = e(...t);
|
|
1431
|
+
globalQueue.initTransition();
|
|
1432
|
+
let o = activeTransition;
|
|
1433
|
+
o.ee.push(r);
|
|
1434
|
+
const done = (e, t) => {
|
|
1435
|
+
o = currentTransition(o);
|
|
1436
|
+
const s = o.ee.indexOf(r);
|
|
1437
|
+
if (s >= 0) o.ee.splice(s, 1);
|
|
1438
|
+
setActiveTransition(o);
|
|
1439
|
+
schedule();
|
|
1440
|
+
t ? i(t) : n(e);
|
|
1441
|
+
};
|
|
1442
|
+
const step = (e, t) => {
|
|
1443
|
+
let n;
|
|
1411
1444
|
try {
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
s.Qe = undefined;
|
|
1416
|
-
})
|
|
1417
|
-
: console.error(e);
|
|
1418
|
-
} catch (t) {
|
|
1419
|
-
e = t;
|
|
1445
|
+
n = t ? r.throw(e) : r.next(e);
|
|
1446
|
+
} catch (e) {
|
|
1447
|
+
return done(undefined, e);
|
|
1420
1448
|
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
} catch (e) {
|
|
1437
|
-
if (!this.Te.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1438
|
-
} finally {
|
|
1439
|
-
this.Ue = this.Re;
|
|
1440
|
-
this.Ee = false;
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
function trackedEffect(e, t) {
|
|
1444
|
-
const run = () => {
|
|
1445
|
-
if (!n.Ee || n._ & REACTIVE_DISPOSED) return;
|
|
1446
|
-
n.Ee = false;
|
|
1447
|
-
recompute(n);
|
|
1448
|
-
};
|
|
1449
|
-
const n = computed(
|
|
1450
|
-
() => {
|
|
1451
|
-
try {
|
|
1452
|
-
n.Qe?.();
|
|
1453
|
-
n.Qe = undefined;
|
|
1454
|
-
n.Qe = staleValues(e) || undefined;
|
|
1455
|
-
} finally {
|
|
1456
|
-
}
|
|
1457
|
-
},
|
|
1458
|
-
undefined,
|
|
1459
|
-
{ ...t, lazy: true, pureWrite: true }
|
|
1460
|
-
);
|
|
1461
|
-
n.Qe = undefined;
|
|
1462
|
-
n.Ee = true;
|
|
1463
|
-
n.fe = EFFECT_TRACKED;
|
|
1464
|
-
n.de = run;
|
|
1465
|
-
n.Te.enqueue(EFFECT_USER, run);
|
|
1466
|
-
onCleanup(() => n.Qe?.());
|
|
1449
|
+
if (n instanceof Promise)
|
|
1450
|
+
return void n.then(run, e => restoreTransition(o, () => step(e, true)));
|
|
1451
|
+
run(n);
|
|
1452
|
+
};
|
|
1453
|
+
const run = e => {
|
|
1454
|
+
if (e.done) return done(e.value);
|
|
1455
|
+
if (e.value instanceof Promise)
|
|
1456
|
+
return void e.value.then(
|
|
1457
|
+
e => restoreTransition(o, () => step(e)),
|
|
1458
|
+
e => restoreTransition(o, () => step(e, true))
|
|
1459
|
+
);
|
|
1460
|
+
restoreTransition(o, () => step(e.value));
|
|
1461
|
+
};
|
|
1462
|
+
step();
|
|
1463
|
+
});
|
|
1467
1464
|
}
|
|
1468
1465
|
function createSignal(e, t, n) {
|
|
1469
1466
|
if (typeof e === "function") {
|
|
@@ -1536,7 +1533,8 @@ function onSettled(e) {
|
|
|
1536
1533
|
function unwrap(e) {
|
|
1537
1534
|
return e?.[$TARGET]?.[STORE_NODE] ?? e;
|
|
1538
1535
|
}
|
|
1539
|
-
function getOverrideValue(e, t, n, i) {
|
|
1536
|
+
function getOverrideValue(e, t, n, i, r) {
|
|
1537
|
+
if (r && i in r) return r[i];
|
|
1540
1538
|
return t && i in t ? t[i] : e[i];
|
|
1541
1539
|
}
|
|
1542
1540
|
function getAllKeys(e, t, n) {
|
|
@@ -1549,110 +1547,112 @@ function applyState(e, t, n, i) {
|
|
|
1549
1547
|
if (!r) return;
|
|
1550
1548
|
const o = r[STORE_VALUE];
|
|
1551
1549
|
const s = r[STORE_OVERRIDE];
|
|
1552
|
-
|
|
1553
|
-
|
|
1550
|
+
const u = r[STORE_OPTIMISTIC_OVERRIDE];
|
|
1551
|
+
let c = r[STORE_NODE];
|
|
1552
|
+
if (e === o && !s && !u) return;
|
|
1554
1553
|
(r[STORE_LOOKUP] || storeLookup).set(e, r[$PROXY]);
|
|
1555
1554
|
r[STORE_VALUE] = e;
|
|
1556
1555
|
r[STORE_OVERRIDE] = undefined;
|
|
1557
1556
|
if (Array.isArray(o)) {
|
|
1558
1557
|
let t = false;
|
|
1559
|
-
const
|
|
1560
|
-
if (e.length &&
|
|
1561
|
-
let
|
|
1558
|
+
const l = getOverrideValue(o, s, c, "length", u);
|
|
1559
|
+
if (e.length && l && e[0] && n(e[0]) != null) {
|
|
1560
|
+
let a, f, E, T, d, R, O, S;
|
|
1562
1561
|
for (
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1562
|
+
E = 0, T = Math.min(l, e.length);
|
|
1563
|
+
E < T &&
|
|
1564
|
+
((R = getOverrideValue(o, s, c, E, u)) === e[E] || (R && e[E] && n(R) === n(e[E])));
|
|
1565
|
+
E++
|
|
1566
1566
|
) {
|
|
1567
|
-
applyState(e[
|
|
1567
|
+
applyState(e[E], wrap(R, r), n, i);
|
|
1568
1568
|
}
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1569
|
+
const _ = new Array(e.length),
|
|
1570
|
+
I = new Map();
|
|
1571
1571
|
for (
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
((
|
|
1576
|
-
|
|
1572
|
+
T = l - 1, d = e.length - 1;
|
|
1573
|
+
T >= E &&
|
|
1574
|
+
d >= E &&
|
|
1575
|
+
((R = getOverrideValue(o, s, c, T, u)) === e[d] || (R && e[d] && n(R) === n(e[d])));
|
|
1576
|
+
T--, d--
|
|
1577
1577
|
) {
|
|
1578
|
-
|
|
1578
|
+
_[d] = R;
|
|
1579
1579
|
}
|
|
1580
|
-
if (
|
|
1581
|
-
for (
|
|
1580
|
+
if (E > d || E > T) {
|
|
1581
|
+
for (f = E; f <= d; f++) {
|
|
1582
1582
|
t = true;
|
|
1583
|
-
r[STORE_NODE][
|
|
1583
|
+
r[STORE_NODE][f] && setSignal(r[STORE_NODE][f], wrap(e[f], r));
|
|
1584
1584
|
}
|
|
1585
|
-
for (;
|
|
1585
|
+
for (; f < e.length; f++) {
|
|
1586
1586
|
t = true;
|
|
1587
|
-
const o = wrap(
|
|
1588
|
-
r[STORE_NODE][
|
|
1589
|
-
applyState(e[
|
|
1587
|
+
const o = wrap(_[f], r);
|
|
1588
|
+
r[STORE_NODE][f] && setSignal(r[STORE_NODE][f], o);
|
|
1589
|
+
applyState(e[f], o, n, i);
|
|
1590
1590
|
}
|
|
1591
1591
|
t && r[STORE_NODE][$TRACK] && setSignal(r[STORE_NODE][$TRACK], void 0);
|
|
1592
|
-
|
|
1592
|
+
l !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
|
|
1593
1593
|
return;
|
|
1594
1594
|
}
|
|
1595
|
-
|
|
1596
|
-
for (
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
}
|
|
1603
|
-
for (
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
if (
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1595
|
+
O = new Array(d + 1);
|
|
1596
|
+
for (f = d; f >= E; f--) {
|
|
1597
|
+
R = e[f];
|
|
1598
|
+
S = R ? n(R) : R;
|
|
1599
|
+
a = I.get(S);
|
|
1600
|
+
O[f] = a === undefined ? -1 : a;
|
|
1601
|
+
I.set(S, f);
|
|
1602
|
+
}
|
|
1603
|
+
for (a = E; a <= T; a++) {
|
|
1604
|
+
R = getOverrideValue(o, s, c, a, u);
|
|
1605
|
+
S = R ? n(R) : R;
|
|
1606
|
+
f = I.get(S);
|
|
1607
|
+
if (f !== undefined && f !== -1) {
|
|
1608
|
+
_[f] = R;
|
|
1609
|
+
f = O[f];
|
|
1610
|
+
I.set(S, f);
|
|
1611
1611
|
}
|
|
1612
1612
|
}
|
|
1613
|
-
for (
|
|
1614
|
-
if (
|
|
1615
|
-
const t = wrap(
|
|
1616
|
-
r[STORE_NODE][
|
|
1617
|
-
applyState(e[
|
|
1618
|
-
} else r[STORE_NODE][
|
|
1613
|
+
for (f = E; f < e.length; f++) {
|
|
1614
|
+
if (f in _) {
|
|
1615
|
+
const t = wrap(_[f], r);
|
|
1616
|
+
r[STORE_NODE][f] && setSignal(r[STORE_NODE][f], t);
|
|
1617
|
+
applyState(e[f], t, n, i);
|
|
1618
|
+
} else r[STORE_NODE][f] && setSignal(r[STORE_NODE][f], wrap(e[f], r));
|
|
1619
1619
|
}
|
|
1620
|
-
if (
|
|
1620
|
+
if (E < e.length) t = true;
|
|
1621
1621
|
} else if (e.length) {
|
|
1622
|
-
for (let t = 0,
|
|
1623
|
-
const
|
|
1624
|
-
isWrappable(
|
|
1625
|
-
? applyState(e[t], wrap(
|
|
1622
|
+
for (let t = 0, l = e.length; t < l; t++) {
|
|
1623
|
+
const l = getOverrideValue(o, s, c, t, u);
|
|
1624
|
+
isWrappable(l)
|
|
1625
|
+
? applyState(e[t], wrap(l, r), n, i)
|
|
1626
1626
|
: r[STORE_NODE][t] && setSignal(r[STORE_NODE][t], e[t]);
|
|
1627
1627
|
}
|
|
1628
1628
|
}
|
|
1629
|
-
if (
|
|
1629
|
+
if (l !== e.length) {
|
|
1630
1630
|
t = true;
|
|
1631
1631
|
r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
|
|
1632
1632
|
}
|
|
1633
1633
|
t && r[STORE_NODE][$TRACK] && setSignal(r[STORE_NODE][$TRACK], void 0);
|
|
1634
1634
|
return;
|
|
1635
1635
|
}
|
|
1636
|
-
if (
|
|
1637
|
-
const t =
|
|
1638
|
-
const
|
|
1639
|
-
for (let
|
|
1640
|
-
const
|
|
1641
|
-
const
|
|
1642
|
-
const
|
|
1643
|
-
let
|
|
1644
|
-
if (
|
|
1645
|
-
if (!
|
|
1636
|
+
if (c) {
|
|
1637
|
+
const t = c[$TRACK];
|
|
1638
|
+
const l = t || i ? getAllKeys(o, s, e) : Object.keys(c);
|
|
1639
|
+
for (let a = 0, f = l.length; a < f; a++) {
|
|
1640
|
+
const f = l[a];
|
|
1641
|
+
const E = c[f];
|
|
1642
|
+
const T = unwrap(getOverrideValue(o, s, c, f, u));
|
|
1643
|
+
let d = unwrap(e[f]);
|
|
1644
|
+
if (T === d) continue;
|
|
1645
|
+
if (!T || !isWrappable(T) || !isWrappable(d) || (n(T) != null && n(T) !== n(d))) {
|
|
1646
1646
|
t && setSignal(t, void 0);
|
|
1647
|
-
|
|
1648
|
-
} else applyState(
|
|
1647
|
+
E && setSignal(E, isWrappable(d) ? wrap(d, r) : d);
|
|
1648
|
+
} else applyState(d, wrap(T, r), n, i);
|
|
1649
1649
|
}
|
|
1650
1650
|
}
|
|
1651
|
-
if ((
|
|
1652
|
-
const t = Object.keys(
|
|
1651
|
+
if ((c = r[STORE_HAS])) {
|
|
1652
|
+
const t = Object.keys(c);
|
|
1653
1653
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
1654
1654
|
const i = t[n];
|
|
1655
|
-
setSignal(
|
|
1655
|
+
setSignal(c[i], i in e);
|
|
1656
1656
|
}
|
|
1657
1657
|
}
|
|
1658
1658
|
}
|
|
@@ -1697,7 +1697,7 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1697
1697
|
r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(o);
|
|
1698
1698
|
});
|
|
1699
1699
|
});
|
|
1700
|
-
i.
|
|
1700
|
+
i.Ue = true;
|
|
1701
1701
|
return { store: o, node: i };
|
|
1702
1702
|
}
|
|
1703
1703
|
function createProjection(e, t = {}, n) {
|
|
@@ -1797,7 +1797,7 @@ function getNode(e, t, n, i, r = isEqual, o) {
|
|
|
1797
1797
|
},
|
|
1798
1798
|
i
|
|
1799
1799
|
);
|
|
1800
|
-
if (o) s.
|
|
1800
|
+
if (o) s.Oe = true;
|
|
1801
1801
|
return (e[t] = s);
|
|
1802
1802
|
}
|
|
1803
1803
|
function trackSelf(e, t = $TRACK) {
|
|
@@ -1850,7 +1850,7 @@ const storeTraps = {
|
|
|
1850
1850
|
if (e && e.get) return e.get.call(n);
|
|
1851
1851
|
}
|
|
1852
1852
|
if (writeOnly(n)) {
|
|
1853
|
-
let n = r && (s || !u) ? (r.
|
|
1853
|
+
let n = r && (s || !u) ? (r.ce !== NOT_PENDING ? (r.Oe ? r.le : r.ce) : r.le) : c[t];
|
|
1854
1854
|
n === $DELETED && (n = undefined);
|
|
1855
1855
|
if (!isWrappable(n)) return n;
|
|
1856
1856
|
const i = wrap(n, e);
|
|
@@ -1899,8 +1899,8 @@ const storeTraps = {
|
|
|
1899
1899
|
if (writeOnly(i)) {
|
|
1900
1900
|
if (e[STORE_OPTIMISTIC]) {
|
|
1901
1901
|
const t = e[STORE_FIREWALL];
|
|
1902
|
-
if (t
|
|
1903
|
-
globalQueue.initTransition(t
|
|
1902
|
+
if (t?.ne) {
|
|
1903
|
+
globalQueue.initTransition(t.ne);
|
|
1904
1904
|
}
|
|
1905
1905
|
}
|
|
1906
1906
|
untrack(() => {
|
|
@@ -2089,7 +2089,7 @@ function deep(e) {
|
|
|
2089
2089
|
return e[$DEEP];
|
|
2090
2090
|
}
|
|
2091
2091
|
function createOptimisticStore(e, t, n) {
|
|
2092
|
-
GlobalQueue.
|
|
2092
|
+
GlobalQueue.B ||= clearOptimisticStore;
|
|
2093
2093
|
const i = typeof e === "function";
|
|
2094
2094
|
const r = (i ? t : e) ?? {};
|
|
2095
2095
|
const o = i ? e : undefined;
|
|
@@ -2106,7 +2106,7 @@ function clearOptimisticStore(e) {
|
|
|
2106
2106
|
if (i) {
|
|
2107
2107
|
for (const e of Reflect.ownKeys(n)) {
|
|
2108
2108
|
if (i[e]) {
|
|
2109
|
-
i[e].
|
|
2109
|
+
i[e].ie = undefined;
|
|
2110
2110
|
const n =
|
|
2111
2111
|
t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
|
|
2112
2112
|
const r = n === $DELETED ? undefined : n;
|
|
@@ -2114,7 +2114,7 @@ function clearOptimisticStore(e) {
|
|
|
2114
2114
|
}
|
|
2115
2115
|
}
|
|
2116
2116
|
if (i[$TRACK]) {
|
|
2117
|
-
i[$TRACK].
|
|
2117
|
+
i[$TRACK].ie = undefined;
|
|
2118
2118
|
setSignal(i[$TRACK], undefined);
|
|
2119
2119
|
}
|
|
2120
2120
|
}
|
|
@@ -2165,7 +2165,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2165
2165
|
setProjectionWriteActive(false);
|
|
2166
2166
|
}
|
|
2167
2167
|
});
|
|
2168
|
-
i.
|
|
2168
|
+
i.Ue = true;
|
|
2169
2169
|
}
|
|
2170
2170
|
return { store: o, node: i };
|
|
2171
2171
|
}
|
|
@@ -2350,9 +2350,9 @@ function mapArray(e, t, n) {
|
|
|
2350
2350
|
return createMemo(
|
|
2351
2351
|
updateKeyedMap.bind({
|
|
2352
2352
|
xe: createOwner(),
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2353
|
+
Me: 0,
|
|
2354
|
+
Fe: e,
|
|
2355
|
+
Ge: [],
|
|
2356
2356
|
$e: t,
|
|
2357
2357
|
He: [],
|
|
2358
2358
|
je: [],
|
|
@@ -2365,7 +2365,7 @@ function mapArray(e, t, n) {
|
|
|
2365
2365
|
}
|
|
2366
2366
|
const pureOptions = { pureWrite: true };
|
|
2367
2367
|
function updateKeyedMap() {
|
|
2368
|
-
const e = this.
|
|
2368
|
+
const e = this.Fe() || [],
|
|
2369
2369
|
t = e.length;
|
|
2370
2370
|
e[$TRACK];
|
|
2371
2371
|
runWithOwner(this.xe, () => {
|
|
@@ -2391,26 +2391,26 @@ function updateKeyedMap() {
|
|
|
2391
2391
|
return this.$e(() => t);
|
|
2392
2392
|
};
|
|
2393
2393
|
if (t === 0) {
|
|
2394
|
-
if (this.
|
|
2394
|
+
if (this.Me !== 0) {
|
|
2395
2395
|
this.xe.dispose(false);
|
|
2396
2396
|
this.je = [];
|
|
2397
|
-
this.
|
|
2397
|
+
this.Ge = [];
|
|
2398
2398
|
this.He = [];
|
|
2399
|
-
this.
|
|
2399
|
+
this.Me = 0;
|
|
2400
2400
|
this.Ye && (this.Ye = []);
|
|
2401
2401
|
this.Be && (this.Be = []);
|
|
2402
2402
|
}
|
|
2403
2403
|
if (this.Xe && !this.He[0]) {
|
|
2404
2404
|
this.He[0] = runWithOwner((this.je[0] = createOwner()), this.Xe);
|
|
2405
2405
|
}
|
|
2406
|
-
} else if (this.
|
|
2406
|
+
} else if (this.Me === 0) {
|
|
2407
2407
|
if (this.je[0]) this.je[0].dispose();
|
|
2408
2408
|
this.He = new Array(t);
|
|
2409
2409
|
for (i = 0; i < t; i++) {
|
|
2410
|
-
this.
|
|
2410
|
+
this.Ge[i] = e[i];
|
|
2411
2411
|
this.He[i] = runWithOwner((this.je[i] = createOwner()), r);
|
|
2412
2412
|
}
|
|
2413
|
-
this.
|
|
2413
|
+
this.Me = t;
|
|
2414
2414
|
} else {
|
|
2415
2415
|
let o,
|
|
2416
2416
|
s,
|
|
@@ -2424,17 +2424,17 @@ function updateKeyedMap() {
|
|
|
2424
2424
|
d = this.Ye ? new Array(t) : undefined,
|
|
2425
2425
|
R = this.Be ? new Array(t) : undefined;
|
|
2426
2426
|
for (
|
|
2427
|
-
o = 0, s = Math.min(this.
|
|
2428
|
-
o < s && (this.
|
|
2427
|
+
o = 0, s = Math.min(this.Me, t);
|
|
2428
|
+
o < s && (this.Ge[o] === e[o] || (this.Ye && compare(this.Ke, this.Ge[o], e[o])));
|
|
2429
2429
|
o++
|
|
2430
2430
|
) {
|
|
2431
2431
|
if (this.Ye) setSignal(this.Ye[o], e[o]);
|
|
2432
2432
|
}
|
|
2433
2433
|
for (
|
|
2434
|
-
s = this.
|
|
2434
|
+
s = this.Me - 1, u = t - 1;
|
|
2435
2435
|
s >= o &&
|
|
2436
2436
|
u >= o &&
|
|
2437
|
-
(this.
|
|
2437
|
+
(this.Ge[s] === e[u] || (this.Ye && compare(this.Ke, this.Ge[s], e[u])));
|
|
2438
2438
|
s--, u--
|
|
2439
2439
|
) {
|
|
2440
2440
|
E[u] = this.He[s];
|
|
@@ -2452,7 +2452,7 @@ function updateKeyedMap() {
|
|
|
2452
2452
|
a.set(l, i);
|
|
2453
2453
|
}
|
|
2454
2454
|
for (n = o; n <= s; n++) {
|
|
2455
|
-
c = this.
|
|
2455
|
+
c = this.Ge[n];
|
|
2456
2456
|
l = this.Ke ? this.Ke(c) : c;
|
|
2457
2457
|
i = a.get(l);
|
|
2458
2458
|
if (i !== undefined && i !== -1) {
|
|
@@ -2480,8 +2480,8 @@ function updateKeyedMap() {
|
|
|
2480
2480
|
this.He[i] = runWithOwner((this.je[i] = createOwner()), r);
|
|
2481
2481
|
}
|
|
2482
2482
|
}
|
|
2483
|
-
this.He = this.He.slice(0, (this.
|
|
2484
|
-
this.
|
|
2483
|
+
this.He = this.He.slice(0, (this.Me = t));
|
|
2484
|
+
this.Ge = e.slice(0);
|
|
2485
2485
|
}
|
|
2486
2486
|
});
|
|
2487
2487
|
return this.He;
|
|
@@ -2489,7 +2489,7 @@ function updateKeyedMap() {
|
|
|
2489
2489
|
function repeat(e, t, n) {
|
|
2490
2490
|
return updateRepeat.bind({
|
|
2491
2491
|
xe: createOwner(),
|
|
2492
|
-
|
|
2492
|
+
Me: 0,
|
|
2493
2493
|
qe: 0,
|
|
2494
2494
|
ze: e,
|
|
2495
2495
|
$e: t,
|
|
@@ -2504,11 +2504,11 @@ function updateRepeat() {
|
|
|
2504
2504
|
const t = this.Ze?.() || 0;
|
|
2505
2505
|
runWithOwner(this.xe, () => {
|
|
2506
2506
|
if (e === 0) {
|
|
2507
|
-
if (this.
|
|
2507
|
+
if (this.Me !== 0) {
|
|
2508
2508
|
this.xe.dispose(false);
|
|
2509
2509
|
this.je = [];
|
|
2510
2510
|
this.He = [];
|
|
2511
|
-
this.
|
|
2511
|
+
this.Me = 0;
|
|
2512
2512
|
}
|
|
2513
2513
|
if (this.Xe && !this.He[0]) {
|
|
2514
2514
|
this.He[0] = runWithOwner((this.je[0] = createOwner()), this.Xe);
|
|
@@ -2516,12 +2516,12 @@ function updateRepeat() {
|
|
|
2516
2516
|
return;
|
|
2517
2517
|
}
|
|
2518
2518
|
const n = t + e;
|
|
2519
|
-
const i = this.qe + this.
|
|
2520
|
-
if (this.
|
|
2519
|
+
const i = this.qe + this.Me;
|
|
2520
|
+
if (this.Me === 0 && this.je[0]) this.je[0].dispose();
|
|
2521
2521
|
for (let e = n; e < i; e++) this.je[e - this.qe].dispose();
|
|
2522
2522
|
if (this.qe < t) {
|
|
2523
2523
|
let e = this.qe;
|
|
2524
|
-
while (e < t && e < this.
|
|
2524
|
+
while (e < t && e < this.Me) this.je[e++].dispose();
|
|
2525
2525
|
this.je.splice(0, t - this.qe);
|
|
2526
2526
|
this.He.splice(0, t - this.qe);
|
|
2527
2527
|
} else if (this.qe > t) {
|
|
@@ -2542,7 +2542,7 @@ function updateRepeat() {
|
|
|
2542
2542
|
}
|
|
2543
2543
|
this.He = this.He.slice(0, e);
|
|
2544
2544
|
this.qe = t;
|
|
2545
|
-
this.
|
|
2545
|
+
this.Me = e;
|
|
2546
2546
|
});
|
|
2547
2547
|
return this.He;
|
|
2548
2548
|
}
|
|
@@ -2551,119 +2551,68 @@ function compare(e, t, n) {
|
|
|
2551
2551
|
}
|
|
2552
2552
|
function boundaryComputed(e, t) {
|
|
2553
2553
|
const n = computed(e, undefined, { lazy: true });
|
|
2554
|
-
n.
|
|
2555
|
-
const i = e !== undefined ? e : n.
|
|
2556
|
-
const r = t !== undefined ? t : n.
|
|
2557
|
-
n.
|
|
2558
|
-
n.
|
|
2554
|
+
n.pe = (e, t) => {
|
|
2555
|
+
const i = e !== undefined ? e : n.ae;
|
|
2556
|
+
const r = t !== undefined ? t : n.q;
|
|
2557
|
+
n.ae &= ~n.Je;
|
|
2558
|
+
n.se.notify(n, n.Je, i, r);
|
|
2559
2559
|
};
|
|
2560
2560
|
n.Je = t;
|
|
2561
|
-
n.
|
|
2561
|
+
n.Ue = true;
|
|
2562
2562
|
recompute(n, true);
|
|
2563
2563
|
return n;
|
|
2564
2564
|
}
|
|
2565
2565
|
function createBoundChildren(e, t, n, i) {
|
|
2566
|
-
const r = e.
|
|
2567
|
-
r.addChild((e.
|
|
2568
|
-
onCleanup(() => r.removeChild(e.
|
|
2566
|
+
const r = e.se;
|
|
2567
|
+
r.addChild((e.se = n));
|
|
2568
|
+
onCleanup(() => r.removeChild(e.se));
|
|
2569
2569
|
return runWithOwner(e, () => {
|
|
2570
2570
|
const e = computed(t);
|
|
2571
2571
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
2572
2572
|
});
|
|
2573
2573
|
}
|
|
2574
|
-
class
|
|
2574
|
+
class CollectionQueue extends Queue {
|
|
2575
2575
|
et;
|
|
2576
2576
|
tt = new Set();
|
|
2577
|
-
|
|
2577
|
+
nt = signal(false, { pureWrite: true });
|
|
2578
|
+
it = false;
|
|
2578
2579
|
constructor(e) {
|
|
2579
2580
|
super();
|
|
2580
2581
|
this.et = e;
|
|
2581
2582
|
}
|
|
2582
2583
|
run(e) {
|
|
2583
|
-
if (!e || read(this.
|
|
2584
|
-
return super.run(e);
|
|
2585
|
-
}
|
|
2586
|
-
notify(e, t, n, i) {
|
|
2587
|
-
if (read(this.et)) {
|
|
2588
|
-
if (t & STATUS_PENDING) {
|
|
2589
|
-
if (n & STATUS_PENDING) {
|
|
2590
|
-
this.J.add(e);
|
|
2591
|
-
t &= ~STATUS_PENDING;
|
|
2592
|
-
} else if (this.J.delete(e)) t &= ~STATUS_PENDING;
|
|
2593
|
-
}
|
|
2594
|
-
if (t & STATUS_ERROR) {
|
|
2595
|
-
if (n & STATUS_ERROR) {
|
|
2596
|
-
this.tt.add(e);
|
|
2597
|
-
t &= ~STATUS_ERROR;
|
|
2598
|
-
} else if (this.tt.delete(e)) t &= ~STATUS_ERROR;
|
|
2599
|
-
}
|
|
2600
|
-
}
|
|
2601
|
-
return t ? super.notify(e, t, n, i ?? e.se) : true;
|
|
2602
|
-
}
|
|
2603
|
-
}
|
|
2604
|
-
class CollectionQueue extends Queue {
|
|
2605
|
-
nt;
|
|
2606
|
-
it = new Set();
|
|
2607
|
-
et = signal(false, { pureWrite: true });
|
|
2608
|
-
rt = false;
|
|
2609
|
-
constructor(e) {
|
|
2610
|
-
super();
|
|
2611
|
-
this.nt = e;
|
|
2612
|
-
}
|
|
2613
|
-
run(e) {
|
|
2614
|
-
if (!e || read(this.et)) return;
|
|
2584
|
+
if (!e || read(this.nt)) return;
|
|
2615
2585
|
return super.run(e);
|
|
2616
2586
|
}
|
|
2617
2587
|
notify(e, t, n, i) {
|
|
2618
|
-
if (!(t & this.
|
|
2619
|
-
if (n & this.
|
|
2620
|
-
const t = i?.
|
|
2588
|
+
if (!(t & this.et) || (this.et & STATUS_PENDING && this.it)) return super.notify(e, t, n, i);
|
|
2589
|
+
if (n & this.et) {
|
|
2590
|
+
const t = i?.source || e.q?.source;
|
|
2621
2591
|
if (t) {
|
|
2622
|
-
const e = this.
|
|
2623
|
-
this.
|
|
2624
|
-
if (e) setSignal(this.
|
|
2592
|
+
const e = this.tt.size === 0;
|
|
2593
|
+
this.tt.add(t);
|
|
2594
|
+
if (e) setSignal(this.nt, true);
|
|
2625
2595
|
}
|
|
2626
2596
|
}
|
|
2627
|
-
t &= ~this.
|
|
2597
|
+
t &= ~this.et;
|
|
2628
2598
|
return t ? super.notify(e, t, n, i) : true;
|
|
2629
2599
|
}
|
|
2630
2600
|
checkSources() {
|
|
2631
|
-
for (const e of this.
|
|
2632
|
-
if (!(e.
|
|
2633
|
-
}
|
|
2634
|
-
if (!this.it.size) setSignal(this.et, false);
|
|
2635
|
-
}
|
|
2636
|
-
}
|
|
2637
|
-
var BoundaryMode;
|
|
2638
|
-
(function (e) {
|
|
2639
|
-
e["VISIBLE"] = "visible";
|
|
2640
|
-
e["HIDDEN"] = "hidden";
|
|
2641
|
-
})(BoundaryMode || (BoundaryMode = {}));
|
|
2642
|
-
function createBoundary(e, t) {
|
|
2643
|
-
const n = createOwner();
|
|
2644
|
-
const i = new ConditionalQueue(computed(() => t() === BoundaryMode.HIDDEN));
|
|
2645
|
-
const r = createBoundChildren(n, e, i, 0);
|
|
2646
|
-
computed(() => {
|
|
2647
|
-
const e = read(i.et);
|
|
2648
|
-
r.Je = e ? STATUS_ERROR | STATUS_PENDING : 0;
|
|
2649
|
-
if (!e) {
|
|
2650
|
-
i.J.forEach(e => i.notify(e, STATUS_PENDING, STATUS_PENDING, e.se));
|
|
2651
|
-
i.tt.forEach(e => i.notify(e, STATUS_ERROR, STATUS_ERROR, e.se));
|
|
2652
|
-
i.J.clear();
|
|
2653
|
-
i.tt.clear();
|
|
2601
|
+
for (const e of this.tt) {
|
|
2602
|
+
if (!(e.ae & this.et)) this.tt.delete(e);
|
|
2654
2603
|
}
|
|
2655
|
-
|
|
2656
|
-
|
|
2604
|
+
if (!this.tt.size) setSignal(this.nt, false);
|
|
2605
|
+
}
|
|
2657
2606
|
}
|
|
2658
2607
|
function createCollectionBoundary(e, t, n) {
|
|
2659
2608
|
const i = createOwner();
|
|
2660
2609
|
const r = new CollectionQueue(e);
|
|
2661
2610
|
const o = createBoundChildren(i, t, r, e);
|
|
2662
2611
|
const s = computed(() => {
|
|
2663
|
-
if (!read(r.
|
|
2612
|
+
if (!read(r.nt)) {
|
|
2664
2613
|
const e = read(o);
|
|
2665
|
-
if (!untrack(() => read(r.
|
|
2666
|
-
r.
|
|
2614
|
+
if (!untrack(() => read(r.nt))) {
|
|
2615
|
+
r.it = true;
|
|
2667
2616
|
return e;
|
|
2668
2617
|
}
|
|
2669
2618
|
}
|
|
@@ -2676,10 +2625,10 @@ function createLoadBoundary(e, t) {
|
|
|
2676
2625
|
}
|
|
2677
2626
|
function createErrorBoundary(e, t) {
|
|
2678
2627
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
2679
|
-
let n = e.
|
|
2680
|
-
const i = n.
|
|
2628
|
+
let n = e.tt.values().next().value;
|
|
2629
|
+
const i = n.q?.cause ?? n.q;
|
|
2681
2630
|
return t(i, () => {
|
|
2682
|
-
for (const t of e.
|
|
2631
|
+
for (const t of e.tt) recompute(t);
|
|
2683
2632
|
schedule();
|
|
2684
2633
|
});
|
|
2685
2634
|
});
|
|
@@ -2742,7 +2691,6 @@ export {
|
|
|
2742
2691
|
NotReadyError,
|
|
2743
2692
|
SUPPORTS_PROXY,
|
|
2744
2693
|
action,
|
|
2745
|
-
createBoundary,
|
|
2746
2694
|
createContext,
|
|
2747
2695
|
createEffect,
|
|
2748
2696
|
createErrorBoundary,
|
|
@@ -2750,6 +2698,7 @@ export {
|
|
|
2750
2698
|
createMemo,
|
|
2751
2699
|
createOptimistic,
|
|
2752
2700
|
createOptimisticStore,
|
|
2701
|
+
createOwner,
|
|
2753
2702
|
createProjection,
|
|
2754
2703
|
createReaction,
|
|
2755
2704
|
createRenderEffect,
|