@solidjs/signals 0.8.0 → 0.8.2
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 +49 -15
- package/dist/node.cjs +436 -402
- package/dist/prod.js +436 -402
- package/dist/types/boundaries.d.ts +1 -0
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/scheduler.d.ts +11 -2
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -24,21 +24,21 @@ var SUPPORTS_PROXY = typeof Proxy === "function";
|
|
|
24
24
|
|
|
25
25
|
// src/core/heap.ts
|
|
26
26
|
function actualInsertIntoHeap(n, heap) {
|
|
27
|
-
const parentHeight = (n.
|
|
28
|
-
if (parentHeight >= n.
|
|
29
|
-
n.
|
|
30
|
-
const height = n.
|
|
31
|
-
const heapAtHeight = heap.
|
|
27
|
+
const parentHeight = (n.w?._ ? n.w.$?.c : n.w?.c) ?? -1;
|
|
28
|
+
if (parentHeight >= n.c)
|
|
29
|
+
n.c = parentHeight + 1;
|
|
30
|
+
const height = n.c;
|
|
31
|
+
const heapAtHeight = heap.r[height];
|
|
32
32
|
if (heapAtHeight === void 0) {
|
|
33
|
-
heap.
|
|
33
|
+
heap.r[height] = n;
|
|
34
34
|
} else {
|
|
35
|
-
const tail = heapAtHeight.
|
|
36
|
-
tail.
|
|
37
|
-
n.
|
|
38
|
-
heapAtHeight.
|
|
35
|
+
const tail = heapAtHeight.z;
|
|
36
|
+
tail.Q = n;
|
|
37
|
+
n.z = tail;
|
|
38
|
+
heapAtHeight.z = n;
|
|
39
39
|
}
|
|
40
|
-
if (height > heap.
|
|
41
|
-
heap.
|
|
40
|
+
if (height > heap.L) {
|
|
41
|
+
heap.L = height;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
function insertIntoHeap(n, heap) {
|
|
@@ -65,29 +65,29 @@ function deleteFromHeap(n, heap) {
|
|
|
65
65
|
if (!(flags & (8 /* InHeap */ | 16 /* InHeapHeight */)))
|
|
66
66
|
return;
|
|
67
67
|
n.b = flags & ~(8 /* InHeap */ | 16 /* InHeapHeight */);
|
|
68
|
-
const height = n.
|
|
69
|
-
if (n.
|
|
70
|
-
heap.
|
|
68
|
+
const height = n.c;
|
|
69
|
+
if (n.z === n) {
|
|
70
|
+
heap.r[height] = void 0;
|
|
71
71
|
} else {
|
|
72
|
-
const next = n.
|
|
73
|
-
const dhh = heap.
|
|
72
|
+
const next = n.Q;
|
|
73
|
+
const dhh = heap.r[height];
|
|
74
74
|
const end = next ?? dhh;
|
|
75
75
|
if (n === dhh) {
|
|
76
|
-
heap.
|
|
76
|
+
heap.r[height] = next;
|
|
77
77
|
} else {
|
|
78
|
-
n.
|
|
78
|
+
n.z.Q = next;
|
|
79
79
|
}
|
|
80
|
-
end.
|
|
80
|
+
end.z = n.z;
|
|
81
81
|
}
|
|
82
|
-
n.
|
|
83
|
-
n.
|
|
82
|
+
n.z = n;
|
|
83
|
+
n.Q = void 0;
|
|
84
84
|
}
|
|
85
85
|
function markHeap(heap) {
|
|
86
|
-
if (heap
|
|
86
|
+
if (heap.aa)
|
|
87
87
|
return;
|
|
88
|
-
heap
|
|
89
|
-
for (let i = 0; i <= heap.
|
|
90
|
-
for (let el = heap.
|
|
88
|
+
heap.aa = true;
|
|
89
|
+
for (let i = 0; i <= heap.L; i++) {
|
|
90
|
+
for (let el = heap.r[i]; el !== void 0; el = el.Q) {
|
|
91
91
|
if (el.b & 8 /* InHeap */)
|
|
92
92
|
markNode(el);
|
|
93
93
|
}
|
|
@@ -98,48 +98,48 @@ function markNode(el, newState = 2 /* Dirty */) {
|
|
|
98
98
|
if ((flags & (1 /* Check */ | 2 /* Dirty */)) >= newState)
|
|
99
99
|
return;
|
|
100
100
|
el.b = flags & ~(1 /* Check */ | 2 /* Dirty */) | newState;
|
|
101
|
-
for (let link2 = el.
|
|
102
|
-
markNode(link2.
|
|
101
|
+
for (let link2 = el.s; link2 !== null; link2 = link2.A) {
|
|
102
|
+
markNode(link2.j, 1 /* Check */);
|
|
103
103
|
}
|
|
104
|
-
if (el.
|
|
105
|
-
for (let child = el.
|
|
106
|
-
for (let link2 = child.
|
|
107
|
-
markNode(link2.
|
|
104
|
+
if (el.ba !== null) {
|
|
105
|
+
for (let child = el.ba; child !== null; child = child.ra) {
|
|
106
|
+
for (let link2 = child.s; link2 !== null; link2 = link2.A) {
|
|
107
|
+
markNode(link2.j, 1 /* Check */);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
function runHeap(heap, recompute2) {
|
|
113
|
-
heap
|
|
114
|
-
for (heap.
|
|
115
|
-
let el = heap.
|
|
113
|
+
heap.aa = false;
|
|
114
|
+
for (heap.p = 0; heap.p <= heap.L; heap.p++) {
|
|
115
|
+
let el = heap.r[heap.p];
|
|
116
116
|
while (el !== void 0) {
|
|
117
117
|
if (el.b & 8 /* InHeap */)
|
|
118
118
|
recompute2(el);
|
|
119
119
|
else {
|
|
120
120
|
adjustHeight(el, heap);
|
|
121
121
|
}
|
|
122
|
-
el = heap.
|
|
122
|
+
el = heap.r[heap.p];
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
heap.
|
|
125
|
+
heap.L = 0;
|
|
126
126
|
}
|
|
127
127
|
function adjustHeight(el, heap) {
|
|
128
128
|
deleteFromHeap(el, heap);
|
|
129
|
-
let newHeight = el.
|
|
130
|
-
for (let d = el.
|
|
131
|
-
const dep1 = d.
|
|
132
|
-
const dep = "_owner" in dep1 ? dep1.
|
|
129
|
+
let newHeight = el.c;
|
|
130
|
+
for (let d = el.x; d; d = d.F) {
|
|
131
|
+
const dep1 = d.R;
|
|
132
|
+
const dep = "_owner" in dep1 ? dep1.B : dep1;
|
|
133
133
|
if ("_fn" in dep) {
|
|
134
|
-
if (dep.
|
|
135
|
-
newHeight = dep.
|
|
134
|
+
if (dep.c >= newHeight) {
|
|
135
|
+
newHeight = dep.c + 1;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
if (el.
|
|
140
|
-
el.
|
|
141
|
-
for (let s = el.
|
|
142
|
-
insertIntoHeapHeight(s.
|
|
139
|
+
if (el.c !== newHeight) {
|
|
140
|
+
el.c = newHeight;
|
|
141
|
+
for (let s = el.s; s !== null; s = s.A) {
|
|
142
|
+
insertIntoHeapHeight(s.j, heap);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -154,76 +154,98 @@ function schedule() {
|
|
|
154
154
|
if (scheduled)
|
|
155
155
|
return;
|
|
156
156
|
scheduled = true;
|
|
157
|
-
if (!globalQueue.
|
|
157
|
+
if (!globalQueue.ca)
|
|
158
158
|
queueMicrotask(flush);
|
|
159
159
|
}
|
|
160
160
|
var dirtyQueue = {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
r: new Array(2e3).fill(void 0),
|
|
162
|
+
aa: false,
|
|
163
|
+
p: 0,
|
|
164
|
+
L: 0
|
|
165
165
|
};
|
|
166
166
|
var zombieQueue = {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
r: new Array(2e3).fill(void 0),
|
|
168
|
+
aa: false,
|
|
169
|
+
p: 0,
|
|
170
|
+
L: 0
|
|
171
171
|
};
|
|
172
172
|
var Queue = class {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
w = null;
|
|
174
|
+
k = [[], []];
|
|
175
|
+
l = [];
|
|
176
176
|
created = clock;
|
|
177
177
|
addChild(child) {
|
|
178
|
-
this.
|
|
179
|
-
child.
|
|
178
|
+
this.l.push(child);
|
|
179
|
+
child.w = this;
|
|
180
180
|
}
|
|
181
181
|
removeChild(child) {
|
|
182
|
-
const index = this.
|
|
182
|
+
const index = this.l.indexOf(child);
|
|
183
183
|
if (index >= 0) {
|
|
184
|
-
this.
|
|
185
|
-
child.
|
|
184
|
+
this.l.splice(index, 1);
|
|
185
|
+
child.w = null;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
notify(node, mask, flags) {
|
|
189
|
-
if (this.
|
|
190
|
-
return this.
|
|
189
|
+
if (this.w)
|
|
190
|
+
return this.w.notify(node, mask, flags);
|
|
191
191
|
return false;
|
|
192
192
|
}
|
|
193
193
|
run(type) {
|
|
194
|
-
if (this.
|
|
195
|
-
const effects = this.
|
|
196
|
-
this.
|
|
194
|
+
if (this.k[type - 1].length) {
|
|
195
|
+
const effects = this.k[type - 1];
|
|
196
|
+
this.k[type - 1] = [];
|
|
197
197
|
runQueue(effects, type);
|
|
198
198
|
}
|
|
199
|
-
for (let i = 0; i < this.
|
|
200
|
-
this.
|
|
199
|
+
for (let i = 0; i < this.l.length; i++) {
|
|
200
|
+
this.l[i].run(type);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
enqueue(type, fn) {
|
|
204
204
|
if (type)
|
|
205
|
-
this.
|
|
205
|
+
this.k[type - 1].push(fn);
|
|
206
206
|
schedule();
|
|
207
207
|
}
|
|
208
|
+
stashQueues(stub) {
|
|
209
|
+
stub.k[0].push(...this.k[0]);
|
|
210
|
+
stub.k[1].push(...this.k[1]);
|
|
211
|
+
this.k = [[], []];
|
|
212
|
+
for (let i = 0; i < this.l.length; i++) {
|
|
213
|
+
let child = this.l[i];
|
|
214
|
+
let childStub = stub.l[i];
|
|
215
|
+
if (!childStub) {
|
|
216
|
+
childStub = { k: [[], []], l: [] };
|
|
217
|
+
stub.l[i] = childStub;
|
|
218
|
+
}
|
|
219
|
+
child.stashQueues(childStub);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
restoreQueues(stub) {
|
|
223
|
+
this.k[0].push(...stub.k[0]);
|
|
224
|
+
this.k[1].push(...stub.k[1]);
|
|
225
|
+
for (let i = 0; i < stub.l.length; i++) {
|
|
226
|
+
const childStub = stub.l[i];
|
|
227
|
+
let child = this.l[i];
|
|
228
|
+
if (child)
|
|
229
|
+
child.restoreQueues(childStub);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
208
232
|
};
|
|
209
233
|
var GlobalQueue = class _GlobalQueue extends Queue {
|
|
210
|
-
|
|
234
|
+
ca = false;
|
|
211
235
|
h = [];
|
|
212
|
-
static
|
|
236
|
+
static S;
|
|
213
237
|
static ka;
|
|
214
238
|
flush() {
|
|
215
|
-
if (this.
|
|
239
|
+
if (this.ca)
|
|
216
240
|
return;
|
|
217
|
-
this.
|
|
241
|
+
this.ca = true;
|
|
218
242
|
try {
|
|
219
|
-
runHeap(dirtyQueue, _GlobalQueue.
|
|
243
|
+
runHeap(dirtyQueue, _GlobalQueue.S);
|
|
220
244
|
if (activeTransition) {
|
|
221
245
|
if (!transitionComplete(activeTransition)) {
|
|
222
|
-
runHeap(zombieQueue, _GlobalQueue.
|
|
246
|
+
runHeap(zombieQueue, _GlobalQueue.S);
|
|
223
247
|
globalQueue.h = [];
|
|
224
|
-
|
|
225
|
-
activeTransition.queues[1].push(...globalQueue.A[1]);
|
|
226
|
-
globalQueue.A = [[], []];
|
|
248
|
+
globalQueue.stashQueues(activeTransition.queueStash);
|
|
227
249
|
clock++;
|
|
228
250
|
scheduled = false;
|
|
229
251
|
runPending(activeTransition.pendingNodes, true);
|
|
@@ -231,19 +253,18 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
231
253
|
return;
|
|
232
254
|
}
|
|
233
255
|
globalQueue.h.push(...activeTransition.pendingNodes);
|
|
234
|
-
globalQueue.
|
|
235
|
-
globalQueue.A[1].push(...activeTransition.queues[1]);
|
|
256
|
+
globalQueue.restoreQueues(activeTransition.queueStash);
|
|
236
257
|
transitions.delete(activeTransition);
|
|
237
258
|
activeTransition = null;
|
|
238
259
|
if (runPending(globalQueue.h, false))
|
|
239
|
-
runHeap(dirtyQueue, _GlobalQueue.
|
|
260
|
+
runHeap(dirtyQueue, _GlobalQueue.S);
|
|
240
261
|
} else if (transitions.size)
|
|
241
|
-
runHeap(zombieQueue, _GlobalQueue.
|
|
262
|
+
runHeap(zombieQueue, _GlobalQueue.S);
|
|
242
263
|
for (let i = 0; i < globalQueue.h.length; i++) {
|
|
243
264
|
const n = globalQueue.h[i];
|
|
244
|
-
if (n.
|
|
245
|
-
n.g = n.
|
|
246
|
-
n.
|
|
265
|
+
if (n.e !== NOT_PENDING) {
|
|
266
|
+
n.g = n.e;
|
|
267
|
+
n.e = NOT_PENDING;
|
|
247
268
|
}
|
|
248
269
|
if (n.ha)
|
|
249
270
|
_GlobalQueue.ka(n, false, true);
|
|
@@ -254,15 +275,15 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
254
275
|
this.run(1 /* Render */);
|
|
255
276
|
this.run(2 /* User */);
|
|
256
277
|
} finally {
|
|
257
|
-
this.
|
|
278
|
+
this.ca = false;
|
|
258
279
|
unobserved.length && notifyUnobserved();
|
|
259
280
|
}
|
|
260
281
|
}
|
|
261
282
|
notify(node, mask, flags) {
|
|
262
283
|
if (mask & 1 /* Pending */) {
|
|
263
284
|
if (flags & 1 /* Pending */) {
|
|
264
|
-
if (activeTransition && !activeTransition.asyncNodes.includes(node.
|
|
265
|
-
activeTransition.asyncNodes.push(node.
|
|
285
|
+
if (activeTransition && !activeTransition.asyncNodes.includes(node.C.cause))
|
|
286
|
+
activeTransition.asyncNodes.push(node.C.cause);
|
|
266
287
|
}
|
|
267
288
|
return true;
|
|
268
289
|
}
|
|
@@ -272,18 +293,18 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
272
293
|
if (activeTransition && activeTransition.time === clock)
|
|
273
294
|
return;
|
|
274
295
|
if (!activeTransition) {
|
|
275
|
-
activeTransition = node.
|
|
296
|
+
activeTransition = node.T ?? {
|
|
276
297
|
time: clock,
|
|
277
298
|
pendingNodes: [],
|
|
278
299
|
asyncNodes: [],
|
|
279
|
-
|
|
300
|
+
queueStash: { k: [[], []], l: [] }
|
|
280
301
|
};
|
|
281
302
|
}
|
|
282
303
|
transitions.add(activeTransition);
|
|
283
304
|
activeTransition.time = clock;
|
|
284
305
|
for (let i = 0; i < globalQueue.h.length; i++) {
|
|
285
306
|
const n = globalQueue.h[i];
|
|
286
|
-
n.
|
|
307
|
+
n.T = activeTransition;
|
|
287
308
|
activeTransition.pendingNodes.push(n);
|
|
288
309
|
}
|
|
289
310
|
globalQueue.h = activeTransition.pendingNodes;
|
|
@@ -294,9 +315,9 @@ function runPending(pendingNodes, value) {
|
|
|
294
315
|
const p = pendingNodes.slice();
|
|
295
316
|
for (let i = 0; i < p.length; i++) {
|
|
296
317
|
const n = p[i];
|
|
297
|
-
n.
|
|
298
|
-
if (n.
|
|
299
|
-
n.
|
|
318
|
+
n.T = activeTransition;
|
|
319
|
+
if (n.H) {
|
|
320
|
+
n.H.da(value);
|
|
300
321
|
needsReset = true;
|
|
301
322
|
}
|
|
302
323
|
}
|
|
@@ -325,14 +346,14 @@ function transitionComplete(transition) {
|
|
|
325
346
|
function notifyUnobserved() {
|
|
326
347
|
for (let i = 0; i < unobserved.length; i++) {
|
|
327
348
|
const source = unobserved[i];
|
|
328
|
-
if (!source.
|
|
329
|
-
unobserved[i].
|
|
349
|
+
if (!source.s)
|
|
350
|
+
unobserved[i].sa?.();
|
|
330
351
|
}
|
|
331
352
|
unobserved = [];
|
|
332
353
|
}
|
|
333
354
|
|
|
334
355
|
// src/core/core.ts
|
|
335
|
-
GlobalQueue.
|
|
356
|
+
GlobalQueue.S = recompute;
|
|
336
357
|
GlobalQueue.ka = disposeChildren;
|
|
337
358
|
var tracking = false;
|
|
338
359
|
var stale = false;
|
|
@@ -340,27 +361,35 @@ var pendingValueCheck = false;
|
|
|
340
361
|
var pendingCheck = null;
|
|
341
362
|
var context = null;
|
|
342
363
|
var defaultContext = {};
|
|
364
|
+
function notifySubs(node) {
|
|
365
|
+
for (let s = node.s; s !== null; s = s.A) {
|
|
366
|
+
const queue = s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
|
|
367
|
+
if (queue.p > s.j.c)
|
|
368
|
+
queue.p = s.j.c;
|
|
369
|
+
insertIntoHeap(s.j, queue);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
343
372
|
function recompute(el, create = false) {
|
|
344
373
|
deleteFromHeap(el, el.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
|
|
345
|
-
if (el.
|
|
374
|
+
if (el.e !== NOT_PENDING || el.U || el.V)
|
|
346
375
|
disposeChildren(el);
|
|
347
376
|
else {
|
|
348
377
|
markDisposal(el);
|
|
349
378
|
globalQueue.h.push(el);
|
|
379
|
+
el.V = el.t;
|
|
350
380
|
el.U = el.q;
|
|
351
|
-
el.
|
|
381
|
+
el.t = null;
|
|
352
382
|
el.q = null;
|
|
353
|
-
el.n = null;
|
|
354
383
|
}
|
|
355
384
|
const oldcontext = context;
|
|
356
385
|
context = el;
|
|
357
|
-
el.
|
|
386
|
+
el.I = null;
|
|
358
387
|
el.b = 4 /* RecomputingDeps */;
|
|
359
|
-
el.
|
|
360
|
-
let value = el.
|
|
361
|
-
let oldHeight = el.
|
|
388
|
+
el.J = clock;
|
|
389
|
+
let value = el.e === NOT_PENDING ? el.g : el.e;
|
|
390
|
+
let oldHeight = el.c;
|
|
362
391
|
let prevStatusFlags = el.f;
|
|
363
|
-
let prevError = el.
|
|
392
|
+
let prevError = el.C;
|
|
364
393
|
let prevTracking = tracking;
|
|
365
394
|
clearStatusFlags(el);
|
|
366
395
|
tracking = true;
|
|
@@ -379,50 +408,50 @@ function recompute(el, create = false) {
|
|
|
379
408
|
}
|
|
380
409
|
el.b = 0 /* None */;
|
|
381
410
|
context = oldcontext;
|
|
382
|
-
const depsTail = el.
|
|
383
|
-
let toRemove = depsTail !== null ? depsTail.
|
|
411
|
+
const depsTail = el.I;
|
|
412
|
+
let toRemove = depsTail !== null ? depsTail.F : el.x;
|
|
384
413
|
if (toRemove !== null) {
|
|
385
414
|
do {
|
|
386
415
|
toRemove = unlinkSubs(toRemove);
|
|
387
416
|
} while (toRemove !== null);
|
|
388
417
|
if (depsTail !== null) {
|
|
389
|
-
depsTail.
|
|
418
|
+
depsTail.F = null;
|
|
390
419
|
} else {
|
|
391
|
-
el.
|
|
420
|
+
el.x = null;
|
|
392
421
|
}
|
|
393
422
|
}
|
|
394
|
-
const valueChanged = !el.
|
|
395
|
-
const statusFlagsChanged = el.f !== prevStatusFlags || el.
|
|
423
|
+
const valueChanged = !el.ea || !el.ea(el.e === NOT_PENDING ? el.g : el.e, value);
|
|
424
|
+
const statusFlagsChanged = el.f !== prevStatusFlags || el.C !== prevError;
|
|
396
425
|
el.la?.(statusFlagsChanged, prevStatusFlags);
|
|
397
426
|
if (valueChanged || statusFlagsChanged) {
|
|
398
427
|
if (valueChanged) {
|
|
399
|
-
if (create || el.ia || el.
|
|
428
|
+
if (create || el.ia || el.K)
|
|
400
429
|
el.g = value;
|
|
401
430
|
else {
|
|
402
|
-
if (el.
|
|
431
|
+
if (el.e === NOT_PENDING)
|
|
403
432
|
globalQueue.h.push(el);
|
|
404
|
-
el.
|
|
433
|
+
el.e = value;
|
|
405
434
|
}
|
|
406
|
-
if (el.
|
|
407
|
-
el.
|
|
435
|
+
if (el.D)
|
|
436
|
+
el.D.da(value);
|
|
408
437
|
}
|
|
409
|
-
for (let s = el.
|
|
410
|
-
const queue = s.
|
|
411
|
-
if (s.
|
|
412
|
-
queue.
|
|
413
|
-
insertIntoHeap(s.
|
|
438
|
+
for (let s = el.s; s !== null; s = s.A) {
|
|
439
|
+
const queue = s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
|
|
440
|
+
if (s.j.c < el.c && queue.p > s.j.c)
|
|
441
|
+
queue.p = s.j.c;
|
|
442
|
+
insertIntoHeap(s.j, queue);
|
|
414
443
|
}
|
|
415
|
-
} else if (el.
|
|
416
|
-
for (let s = el.
|
|
417
|
-
insertIntoHeapHeight(s.
|
|
444
|
+
} else if (el.c != oldHeight) {
|
|
445
|
+
for (let s = el.s; s !== null; s = s.A) {
|
|
446
|
+
insertIntoHeapHeight(s.j, s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
|
|
418
447
|
}
|
|
419
448
|
}
|
|
420
449
|
}
|
|
421
450
|
function updateIfNecessary(el) {
|
|
422
451
|
if (el.b & 1 /* Check */) {
|
|
423
|
-
for (let d = el.
|
|
424
|
-
const dep1 = d.
|
|
425
|
-
const dep = "_owner" in dep1 ? dep1.
|
|
452
|
+
for (let d = el.x; d; d = d.F) {
|
|
453
|
+
const dep1 = d.R;
|
|
454
|
+
const dep = "_owner" in dep1 ? dep1.B : dep1;
|
|
426
455
|
if ("_fn" in dep) {
|
|
427
456
|
updateIfNecessary(dep);
|
|
428
457
|
}
|
|
@@ -437,9 +466,9 @@ function updateIfNecessary(el) {
|
|
|
437
466
|
el.b = 0 /* None */;
|
|
438
467
|
}
|
|
439
468
|
function unlinkSubs(link2) {
|
|
440
|
-
const dep = link2.
|
|
441
|
-
const nextDep = link2.
|
|
442
|
-
const nextSub = link2.
|
|
469
|
+
const dep = link2.R;
|
|
470
|
+
const nextDep = link2.F;
|
|
471
|
+
const nextSub = link2.A;
|
|
443
472
|
const prevSub = link2.ma;
|
|
444
473
|
if (nextSub !== null) {
|
|
445
474
|
nextSub.ma = prevSub;
|
|
@@ -447,52 +476,52 @@ function unlinkSubs(link2) {
|
|
|
447
476
|
dep.W = prevSub;
|
|
448
477
|
}
|
|
449
478
|
if (prevSub !== null) {
|
|
450
|
-
prevSub.
|
|
479
|
+
prevSub.A = nextSub;
|
|
451
480
|
} else {
|
|
452
|
-
dep.
|
|
481
|
+
dep.s = nextSub;
|
|
453
482
|
}
|
|
454
483
|
return nextDep;
|
|
455
484
|
}
|
|
456
485
|
function link(dep, sub) {
|
|
457
|
-
const prevDep = sub.
|
|
458
|
-
if (prevDep !== null && prevDep.
|
|
486
|
+
const prevDep = sub.I;
|
|
487
|
+
if (prevDep !== null && prevDep.R === dep) {
|
|
459
488
|
return;
|
|
460
489
|
}
|
|
461
490
|
let nextDep = null;
|
|
462
491
|
const isRecomputing = sub.b & 4 /* RecomputingDeps */;
|
|
463
492
|
if (isRecomputing) {
|
|
464
|
-
nextDep = prevDep !== null ? prevDep.
|
|
465
|
-
if (nextDep !== null && nextDep.
|
|
466
|
-
sub.
|
|
493
|
+
nextDep = prevDep !== null ? prevDep.F : sub.x;
|
|
494
|
+
if (nextDep !== null && nextDep.R === dep) {
|
|
495
|
+
sub.I = nextDep;
|
|
467
496
|
return;
|
|
468
497
|
}
|
|
469
498
|
}
|
|
470
499
|
const prevSub = dep.W;
|
|
471
|
-
if (prevSub !== null && prevSub.
|
|
500
|
+
if (prevSub !== null && prevSub.j === sub && (!isRecomputing || isValidLink(prevSub, sub))) {
|
|
472
501
|
return;
|
|
473
502
|
}
|
|
474
|
-
const newLink = sub.
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
503
|
+
const newLink = sub.I = dep.W = {
|
|
504
|
+
R: dep,
|
|
505
|
+
j: sub,
|
|
506
|
+
F: nextDep,
|
|
478
507
|
ma: prevSub,
|
|
479
|
-
|
|
508
|
+
A: null
|
|
480
509
|
};
|
|
481
510
|
if (prevDep !== null) {
|
|
482
|
-
prevDep.
|
|
511
|
+
prevDep.F = newLink;
|
|
483
512
|
} else {
|
|
484
|
-
sub.
|
|
513
|
+
sub.x = newLink;
|
|
485
514
|
}
|
|
486
515
|
if (prevSub !== null) {
|
|
487
|
-
prevSub.
|
|
516
|
+
prevSub.A = newLink;
|
|
488
517
|
} else {
|
|
489
|
-
dep.
|
|
518
|
+
dep.s = newLink;
|
|
490
519
|
}
|
|
491
520
|
}
|
|
492
521
|
function isValidLink(checkLink, sub) {
|
|
493
|
-
const depsTail = sub.
|
|
522
|
+
const depsTail = sub.I;
|
|
494
523
|
if (depsTail !== null) {
|
|
495
|
-
let link2 = sub.
|
|
524
|
+
let link2 = sub.x;
|
|
496
525
|
do {
|
|
497
526
|
if (link2 === checkLink) {
|
|
498
527
|
return true;
|
|
@@ -500,23 +529,23 @@ function isValidLink(checkLink, sub) {
|
|
|
500
529
|
if (link2 === depsTail) {
|
|
501
530
|
break;
|
|
502
531
|
}
|
|
503
|
-
link2 = link2.
|
|
532
|
+
link2 = link2.F;
|
|
504
533
|
} while (link2 !== null);
|
|
505
534
|
}
|
|
506
535
|
return false;
|
|
507
536
|
}
|
|
508
537
|
function setStatusFlags(signal2, flags, error = null) {
|
|
509
538
|
signal2.f = flags;
|
|
510
|
-
signal2.
|
|
539
|
+
signal2.C = error;
|
|
511
540
|
}
|
|
512
541
|
function setError(signal2, error) {
|
|
513
|
-
setStatusFlags(signal2, 2 /* Error
|
|
542
|
+
setStatusFlags(signal2, 2 /* Error */, error);
|
|
514
543
|
}
|
|
515
544
|
function clearStatusFlags(signal2) {
|
|
516
545
|
setStatusFlags(signal2, 0 /* None */);
|
|
517
546
|
}
|
|
518
547
|
function markDisposal(el) {
|
|
519
|
-
let child = el.
|
|
548
|
+
let child = el.q;
|
|
520
549
|
while (child) {
|
|
521
550
|
child.b |= 32 /* Zombie */;
|
|
522
551
|
const inHeap = child.b & 8 /* InHeap */;
|
|
@@ -525,7 +554,7 @@ function markDisposal(el) {
|
|
|
525
554
|
insertIntoHeap(child, zombieQueue);
|
|
526
555
|
}
|
|
527
556
|
markDisposal(child);
|
|
528
|
-
child = child.
|
|
557
|
+
child = child.M;
|
|
529
558
|
}
|
|
530
559
|
}
|
|
531
560
|
function disposeChildren(node, self = false, zombie) {
|
|
@@ -533,32 +562,32 @@ function disposeChildren(node, self = false, zombie) {
|
|
|
533
562
|
return;
|
|
534
563
|
if (self)
|
|
535
564
|
node.b = 64 /* Disposed */;
|
|
536
|
-
let child = zombie ? node.
|
|
565
|
+
let child = zombie ? node.U : node.q;
|
|
537
566
|
while (child) {
|
|
538
|
-
const nextChild = child.
|
|
539
|
-
if (child.
|
|
567
|
+
const nextChild = child.M;
|
|
568
|
+
if (child.x) {
|
|
540
569
|
const n = child;
|
|
541
570
|
deleteFromHeap(n, n.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
|
|
542
|
-
let toRemove = n.
|
|
571
|
+
let toRemove = n.x;
|
|
543
572
|
do {
|
|
544
573
|
toRemove = unlinkSubs(toRemove);
|
|
545
574
|
} while (toRemove !== null);
|
|
546
|
-
n.
|
|
547
|
-
n.
|
|
575
|
+
n.x = null;
|
|
576
|
+
n.I = null;
|
|
548
577
|
}
|
|
549
578
|
disposeChildren(child, true);
|
|
550
579
|
child = nextChild;
|
|
551
580
|
}
|
|
552
581
|
if (zombie) {
|
|
553
|
-
node.
|
|
582
|
+
node.U = null;
|
|
554
583
|
} else {
|
|
555
|
-
node.
|
|
556
|
-
node.
|
|
584
|
+
node.q = null;
|
|
585
|
+
node.M = null;
|
|
557
586
|
}
|
|
558
587
|
runDisposal(node, zombie);
|
|
559
588
|
}
|
|
560
589
|
function runDisposal(node, zombie) {
|
|
561
|
-
let disposal = zombie ? node.
|
|
590
|
+
let disposal = zombie ? node.V : node.t;
|
|
562
591
|
if (!disposal)
|
|
563
592
|
return;
|
|
564
593
|
if (Array.isArray(disposal)) {
|
|
@@ -569,13 +598,13 @@ function runDisposal(node, zombie) {
|
|
|
569
598
|
} else {
|
|
570
599
|
disposal.call(disposal);
|
|
571
600
|
}
|
|
572
|
-
zombie ? node.
|
|
601
|
+
zombie ? node.V = null : node.t = null;
|
|
573
602
|
}
|
|
574
603
|
function withOptions(obj, options) {
|
|
575
604
|
obj.id = options?.id ?? (context?.id != null ? getNextChildId(context) : void 0);
|
|
576
|
-
obj.
|
|
577
|
-
obj.
|
|
578
|
-
obj.
|
|
605
|
+
obj.ea = options?.equals != null ? options.equals : isEqual;
|
|
606
|
+
obj.ya = !!options?.pureWrite;
|
|
607
|
+
obj.sa = options?.unobserved;
|
|
579
608
|
if (options?.ja)
|
|
580
609
|
Object.assign(obj, options.ja);
|
|
581
610
|
return obj;
|
|
@@ -592,47 +621,47 @@ function formatId(prefix, id) {
|
|
|
592
621
|
function computed(fn, initialValue, options) {
|
|
593
622
|
const self = withOptions(
|
|
594
623
|
{
|
|
595
|
-
|
|
624
|
+
t: null,
|
|
596
625
|
i: globalQueue,
|
|
597
|
-
|
|
626
|
+
E: defaultContext,
|
|
598
627
|
na: 0,
|
|
599
628
|
ha: fn,
|
|
600
629
|
g: initialValue,
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
630
|
+
c: 0,
|
|
631
|
+
ba: null,
|
|
632
|
+
Q: void 0,
|
|
633
|
+
z: null,
|
|
604
634
|
x: null,
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
p: null,
|
|
635
|
+
I: null,
|
|
636
|
+
s: null,
|
|
608
637
|
W: null,
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
638
|
+
w: context,
|
|
639
|
+
M: null,
|
|
640
|
+
q: null,
|
|
612
641
|
b: 0 /* None */,
|
|
613
642
|
f: 4 /* Uninitialized */,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
643
|
+
J: clock,
|
|
644
|
+
e: NOT_PENDING,
|
|
645
|
+
V: null,
|
|
646
|
+
U: null
|
|
618
647
|
},
|
|
619
648
|
options
|
|
620
649
|
);
|
|
621
|
-
self.
|
|
622
|
-
const parent = context?.
|
|
650
|
+
self.z = self;
|
|
651
|
+
const parent = context?._ ? context.$ : context;
|
|
623
652
|
if (context) {
|
|
624
653
|
context.i && (self.i = context.i);
|
|
625
|
-
context.
|
|
626
|
-
const lastChild = context.
|
|
654
|
+
context.E && (self.E = context.E);
|
|
655
|
+
const lastChild = context.q;
|
|
627
656
|
if (lastChild === null) {
|
|
628
|
-
context.
|
|
657
|
+
context.q = self;
|
|
629
658
|
} else {
|
|
630
|
-
self.
|
|
631
|
-
context.
|
|
659
|
+
self.M = lastChild;
|
|
660
|
+
context.q = self;
|
|
632
661
|
}
|
|
633
662
|
}
|
|
634
663
|
if (parent)
|
|
635
|
-
self.
|
|
664
|
+
self.c = parent.c + 1;
|
|
636
665
|
recompute(self, true);
|
|
637
666
|
return self;
|
|
638
667
|
}
|
|
@@ -660,6 +689,9 @@ function asyncComputed(asyncFn, initialValue, options) {
|
|
|
660
689
|
return;
|
|
661
690
|
globalQueue.initTransition(self);
|
|
662
691
|
setError(self, e);
|
|
692
|
+
self.J = clock;
|
|
693
|
+
notifySubs(self);
|
|
694
|
+
schedule();
|
|
663
695
|
flush();
|
|
664
696
|
});
|
|
665
697
|
} else {
|
|
@@ -677,6 +709,9 @@ function asyncComputed(asyncFn, initialValue, options) {
|
|
|
677
709
|
return;
|
|
678
710
|
globalQueue.initTransition(self);
|
|
679
711
|
setError(self, error);
|
|
712
|
+
self.J = clock;
|
|
713
|
+
notifySubs(self);
|
|
714
|
+
schedule();
|
|
680
715
|
flush();
|
|
681
716
|
}
|
|
682
717
|
})();
|
|
@@ -685,7 +720,7 @@ function asyncComputed(asyncFn, initialValue, options) {
|
|
|
685
720
|
throw new NotReadyError(context);
|
|
686
721
|
};
|
|
687
722
|
const self = computed(fn, initialValue, options);
|
|
688
|
-
self.
|
|
723
|
+
self.ta = () => {
|
|
689
724
|
refreshing = true;
|
|
690
725
|
recompute(self);
|
|
691
726
|
flush();
|
|
@@ -694,16 +729,16 @@ function asyncComputed(asyncFn, initialValue, options) {
|
|
|
694
729
|
}
|
|
695
730
|
function signal(v, options, firewall = null) {
|
|
696
731
|
if (firewall !== null) {
|
|
697
|
-
return firewall.
|
|
732
|
+
return firewall.ba = withOptions(
|
|
698
733
|
{
|
|
699
734
|
g: v,
|
|
700
|
-
|
|
735
|
+
s: null,
|
|
701
736
|
W: null,
|
|
702
|
-
|
|
703
|
-
|
|
737
|
+
B: firewall,
|
|
738
|
+
ra: firewall.ba,
|
|
704
739
|
f: 0 /* None */,
|
|
705
|
-
|
|
706
|
-
|
|
740
|
+
J: clock,
|
|
741
|
+
e: NOT_PENDING
|
|
707
742
|
},
|
|
708
743
|
options
|
|
709
744
|
);
|
|
@@ -711,11 +746,11 @@ function signal(v, options, firewall = null) {
|
|
|
711
746
|
return withOptions(
|
|
712
747
|
{
|
|
713
748
|
g: v,
|
|
714
|
-
|
|
749
|
+
s: null,
|
|
715
750
|
W: null,
|
|
716
751
|
f: 0 /* None */,
|
|
717
|
-
|
|
718
|
-
|
|
752
|
+
J: clock,
|
|
753
|
+
e: NOT_PENDING
|
|
719
754
|
},
|
|
720
755
|
options
|
|
721
756
|
);
|
|
@@ -736,98 +771,96 @@ function untrack(fn) {
|
|
|
736
771
|
}
|
|
737
772
|
function read(el) {
|
|
738
773
|
let c = context;
|
|
739
|
-
if (c?.
|
|
740
|
-
c = c
|
|
774
|
+
if (c?._)
|
|
775
|
+
c = c.$;
|
|
741
776
|
if (c && tracking) {
|
|
742
777
|
link(el, c);
|
|
743
|
-
const owner = "_owner" in el ? el.
|
|
778
|
+
const owner = "_owner" in el ? el.B : el;
|
|
744
779
|
if ("_fn" in owner) {
|
|
745
780
|
const isZombie = el.b & 32 /* Zombie */;
|
|
746
|
-
if (owner.
|
|
781
|
+
if (owner.c >= (isZombie ? zombieQueue.p : dirtyQueue.p)) {
|
|
747
782
|
markNode(c);
|
|
748
783
|
markHeap(isZombie ? zombieQueue : dirtyQueue);
|
|
749
784
|
updateIfNecessary(owner);
|
|
750
785
|
}
|
|
751
|
-
const height = owner.
|
|
752
|
-
if (height >= c.
|
|
753
|
-
c.
|
|
786
|
+
const height = owner.c;
|
|
787
|
+
if (height >= c.c && el.w !== c) {
|
|
788
|
+
c.c = height + 1;
|
|
754
789
|
}
|
|
755
790
|
}
|
|
756
791
|
}
|
|
757
792
|
if (pendingCheck) {
|
|
758
|
-
const pendingResult = (el.f & 1 /* Pending */) !== 0 || !!el.
|
|
759
|
-
if (!el.
|
|
760
|
-
el.
|
|
761
|
-
el.
|
|
762
|
-
el.
|
|
793
|
+
const pendingResult = (el.f & 1 /* Pending */) !== 0 || !!el.T || false;
|
|
794
|
+
if (!el.H) {
|
|
795
|
+
el.H = signal(pendingResult);
|
|
796
|
+
el.H.ia = true;
|
|
797
|
+
el.H.da = (v) => setSignal(el.H, v);
|
|
763
798
|
}
|
|
764
799
|
const prev = pendingCheck;
|
|
765
800
|
pendingCheck = null;
|
|
766
|
-
read(el.
|
|
801
|
+
read(el.H);
|
|
767
802
|
pendingCheck = prev;
|
|
768
803
|
prev.g = pendingResult || prev.g;
|
|
769
804
|
}
|
|
770
805
|
if (pendingValueCheck) {
|
|
771
|
-
if (!el.
|
|
772
|
-
el.
|
|
773
|
-
el.
|
|
806
|
+
if (!el.D) {
|
|
807
|
+
el.D = signal(
|
|
808
|
+
el.e === NOT_PENDING ? el.g : el.e
|
|
774
809
|
);
|
|
775
|
-
el.
|
|
776
|
-
el.
|
|
810
|
+
el.D.ia = true;
|
|
811
|
+
el.D.da = (v) => queueMicrotask(() => queueMicrotask(() => setSignal(el.D, v)));
|
|
777
812
|
}
|
|
778
813
|
pendingValueCheck = false;
|
|
779
814
|
try {
|
|
780
|
-
return read(el.
|
|
815
|
+
return read(el.D);
|
|
781
816
|
} finally {
|
|
782
817
|
pendingValueCheck = true;
|
|
783
818
|
}
|
|
784
819
|
}
|
|
785
820
|
if (el.f & 1 /* Pending */) {
|
|
786
821
|
if (c && !stale || el.f & 4 /* Uninitialized */)
|
|
787
|
-
throw el.
|
|
822
|
+
throw el.C;
|
|
788
823
|
else if (c && stale && !pendingCheck) {
|
|
789
824
|
setStatusFlags(
|
|
790
825
|
c,
|
|
791
826
|
c.f | 1,
|
|
792
|
-
el.
|
|
827
|
+
el.C
|
|
793
828
|
);
|
|
794
829
|
}
|
|
795
830
|
}
|
|
796
831
|
if (el.f & 2 /* Error */) {
|
|
797
|
-
if (el.
|
|
832
|
+
if (el.J < clock) {
|
|
798
833
|
recompute(el, true);
|
|
799
834
|
return read(el);
|
|
800
835
|
} else {
|
|
801
|
-
throw el.
|
|
836
|
+
throw el.C;
|
|
802
837
|
}
|
|
803
838
|
}
|
|
804
|
-
return !c || el.
|
|
839
|
+
return !c || el.e === NOT_PENDING || stale && !pendingCheck && el.T && activeTransition !== el.T ? el.g : el.e;
|
|
805
840
|
}
|
|
806
841
|
function setSignal(el, v) {
|
|
807
842
|
if (typeof v === "function") {
|
|
808
843
|
v = v(
|
|
809
|
-
el.
|
|
844
|
+
el.e === NOT_PENDING ? el.g : el.e
|
|
810
845
|
);
|
|
811
846
|
}
|
|
812
|
-
const valueChanged = !el.
|
|
847
|
+
const valueChanged = !el.ea || !el.ea(el.e === NOT_PENDING ? el.g : el.e, v);
|
|
813
848
|
if (!valueChanged && !el.f)
|
|
814
849
|
return v;
|
|
815
850
|
if (valueChanged) {
|
|
816
851
|
if (el.ia)
|
|
817
852
|
el.g = v;
|
|
818
853
|
else {
|
|
819
|
-
if (el.
|
|
854
|
+
if (el.e === NOT_PENDING)
|
|
820
855
|
globalQueue.h.push(el);
|
|
821
|
-
el.
|
|
856
|
+
el.e = v;
|
|
822
857
|
}
|
|
823
|
-
if (el.
|
|
824
|
-
el.
|
|
858
|
+
if (el.D)
|
|
859
|
+
el.D.da(v);
|
|
825
860
|
}
|
|
826
861
|
clearStatusFlags(el);
|
|
827
|
-
el.
|
|
828
|
-
|
|
829
|
-
insertIntoHeap(link2.m, link2.m.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
|
|
830
|
-
}
|
|
862
|
+
el.J = clock;
|
|
863
|
+
notifySubs(el);
|
|
831
864
|
schedule();
|
|
832
865
|
return v;
|
|
833
866
|
}
|
|
@@ -841,41 +874,41 @@ function onCleanup(fn) {
|
|
|
841
874
|
if (!context)
|
|
842
875
|
return fn;
|
|
843
876
|
const node = context;
|
|
844
|
-
if (!node.
|
|
845
|
-
node.
|
|
846
|
-
} else if (Array.isArray(node.
|
|
847
|
-
node.
|
|
877
|
+
if (!node.t) {
|
|
878
|
+
node.t = fn;
|
|
879
|
+
} else if (Array.isArray(node.t)) {
|
|
880
|
+
node.t.push(fn);
|
|
848
881
|
} else {
|
|
849
|
-
node.
|
|
882
|
+
node.t = [node.t, fn];
|
|
850
883
|
}
|
|
851
884
|
return fn;
|
|
852
885
|
}
|
|
853
886
|
function createOwner(options) {
|
|
854
887
|
const parent = context;
|
|
855
888
|
const owner = {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
n: null,
|
|
859
|
-
K: null,
|
|
889
|
+
_: true,
|
|
890
|
+
$: parent?._ ? parent.$ : parent,
|
|
860
891
|
q: null,
|
|
892
|
+
M: null,
|
|
893
|
+
t: null,
|
|
861
894
|
id: options?.id ?? (parent?.id != null ? getNextChildId(parent) : void 0),
|
|
862
895
|
i: parent?.i ?? globalQueue,
|
|
863
|
-
|
|
896
|
+
E: parent?.E || defaultContext,
|
|
864
897
|
na: 0,
|
|
898
|
+
V: null,
|
|
865
899
|
U: null,
|
|
866
|
-
|
|
867
|
-
s: parent,
|
|
900
|
+
w: parent,
|
|
868
901
|
dispose(self = true) {
|
|
869
902
|
disposeChildren(owner, self);
|
|
870
903
|
}
|
|
871
904
|
};
|
|
872
905
|
if (parent) {
|
|
873
|
-
const lastChild = parent.
|
|
906
|
+
const lastChild = parent.q;
|
|
874
907
|
if (lastChild === null) {
|
|
875
|
-
parent.
|
|
908
|
+
parent.q = owner;
|
|
876
909
|
} else {
|
|
877
|
-
owner.
|
|
878
|
-
parent.
|
|
910
|
+
owner.M = lastChild;
|
|
911
|
+
parent.q = owner;
|
|
879
912
|
}
|
|
880
913
|
}
|
|
881
914
|
return owner;
|
|
@@ -936,7 +969,7 @@ function getContext(context2, owner = getOwner()) {
|
|
|
936
969
|
if (!owner) {
|
|
937
970
|
throw new NoOwnerError();
|
|
938
971
|
}
|
|
939
|
-
const value = hasContext(context2, owner) ? owner.
|
|
972
|
+
const value = hasContext(context2, owner) ? owner.E[context2.id] : context2.defaultValue;
|
|
940
973
|
if (isUndefined(value)) {
|
|
941
974
|
throw new ContextNotFoundError();
|
|
942
975
|
}
|
|
@@ -946,13 +979,13 @@ function setContext(context2, value, owner = getOwner()) {
|
|
|
946
979
|
if (!owner) {
|
|
947
980
|
throw new NoOwnerError();
|
|
948
981
|
}
|
|
949
|
-
owner.
|
|
950
|
-
...owner.
|
|
982
|
+
owner.E = {
|
|
983
|
+
...owner.E,
|
|
951
984
|
[context2.id]: isUndefined(value) ? context2.defaultValue : value
|
|
952
985
|
};
|
|
953
986
|
}
|
|
954
987
|
function hasContext(context2, owner) {
|
|
955
|
-
return !isUndefined(owner?.
|
|
988
|
+
return !isUndefined(owner?.E[context2.id]);
|
|
956
989
|
}
|
|
957
990
|
function isUndefined(value) {
|
|
958
991
|
return typeof value === "undefined";
|
|
@@ -964,28 +997,28 @@ function effect(compute, effect2, error, initialValue, options) {
|
|
|
964
997
|
const node = computed(compute, initialValue, {
|
|
965
998
|
...options,
|
|
966
999
|
ja: {
|
|
967
|
-
|
|
1000
|
+
fa: true,
|
|
968
1001
|
oa: initialValue,
|
|
969
|
-
|
|
1002
|
+
ua: effect2,
|
|
970
1003
|
pa: error,
|
|
971
|
-
|
|
1004
|
+
N: void 0,
|
|
972
1005
|
i: getOwner()?.i ?? globalQueue,
|
|
973
|
-
|
|
1006
|
+
K: options?.render ? 1 /* Render */ : 2 /* User */,
|
|
974
1007
|
la(statusFlagsChanged, prevStatusFlags) {
|
|
975
1008
|
if (initialized) {
|
|
976
1009
|
const errorChanged = this.f && this.f === prevStatusFlags && statusFlagsChanged;
|
|
977
|
-
this.
|
|
978
|
-
if (this.
|
|
979
|
-
this.i.enqueue(this.
|
|
1010
|
+
this.fa = !(this.f & 2 /* Error */) && !(this.f & 1 /* Pending */ & ~prevStatusFlags) && !errorChanged;
|
|
1011
|
+
if (this.fa)
|
|
1012
|
+
this.i.enqueue(this.K, runEffect.bind(this));
|
|
980
1013
|
}
|
|
981
1014
|
if (this.f & 2 /* Error */) {
|
|
982
|
-
let error2 = this.
|
|
1015
|
+
let error2 = this.C;
|
|
983
1016
|
this.i.notify(this, 1 /* Pending */, 0);
|
|
984
|
-
if (this.
|
|
1017
|
+
if (this.K === 2 /* User */) {
|
|
985
1018
|
try {
|
|
986
1019
|
return this.pa ? this.pa(error2, () => {
|
|
987
|
-
this.
|
|
988
|
-
this.
|
|
1020
|
+
this.N?.();
|
|
1021
|
+
this.N = void 0;
|
|
989
1022
|
}) : console.error(error2);
|
|
990
1023
|
} catch (e) {
|
|
991
1024
|
error2 = e;
|
|
@@ -993,7 +1026,7 @@ function effect(compute, effect2, error, initialValue, options) {
|
|
|
993
1026
|
}
|
|
994
1027
|
if (!this.i.notify(this, 2 /* Error */, 2 /* Error */))
|
|
995
1028
|
throw error2;
|
|
996
|
-
} else if (this.
|
|
1029
|
+
} else if (this.K === 1 /* Render */) {
|
|
997
1030
|
this.i.notify(
|
|
998
1031
|
this,
|
|
999
1032
|
1 /* Pending */ | 2 /* Error */,
|
|
@@ -1004,25 +1037,24 @@ function effect(compute, effect2, error, initialValue, options) {
|
|
|
1004
1037
|
}
|
|
1005
1038
|
});
|
|
1006
1039
|
initialized = true;
|
|
1007
|
-
if (node.
|
|
1008
|
-
node.ha = (p) =>
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
onCleanup(() => node.L?.());
|
|
1040
|
+
if (node.K === 1 /* Render */)
|
|
1041
|
+
node.ha = (p) => staleValues(() => compute(p));
|
|
1042
|
+
!options?.defer && !(node.f & (2 /* Error */ | 1 /* Pending */)) && (node.K === 2 /* User */ ? node.i.enqueue(node.K, runEffect.bind(node)) : runEffect.call(node));
|
|
1043
|
+
onCleanup(() => node.N?.());
|
|
1012
1044
|
}
|
|
1013
1045
|
function runEffect() {
|
|
1014
|
-
if (!this.
|
|
1046
|
+
if (!this.fa || this.b & 64 /* Disposed */)
|
|
1015
1047
|
return;
|
|
1016
|
-
this.
|
|
1017
|
-
this.
|
|
1048
|
+
this.N?.();
|
|
1049
|
+
this.N = void 0;
|
|
1018
1050
|
try {
|
|
1019
|
-
this.
|
|
1051
|
+
this.N = this.ua(this.g, this.oa);
|
|
1020
1052
|
} catch (error) {
|
|
1021
1053
|
if (!this.i.notify(this, 2 /* Error */, 2 /* Error */))
|
|
1022
1054
|
throw error;
|
|
1023
1055
|
} finally {
|
|
1024
1056
|
this.oa = this.g;
|
|
1025
|
-
this.
|
|
1057
|
+
this.fa = false;
|
|
1026
1058
|
}
|
|
1027
1059
|
}
|
|
1028
1060
|
|
|
@@ -1053,7 +1085,7 @@ function createMemo(compute, value, options) {
|
|
|
1053
1085
|
function createAsync(compute, value, options) {
|
|
1054
1086
|
const node = asyncComputed(compute, value, options);
|
|
1055
1087
|
const ret = read.bind(null, node);
|
|
1056
|
-
ret.refresh = node.
|
|
1088
|
+
ret.refresh = node.ta;
|
|
1057
1089
|
return ret;
|
|
1058
1090
|
}
|
|
1059
1091
|
function createEffect(compute, effectFn, value, options) {
|
|
@@ -1366,7 +1398,7 @@ var storeTraps = {
|
|
|
1366
1398
|
return desc.get.call(receiver);
|
|
1367
1399
|
}
|
|
1368
1400
|
if (Writing?.has(receiver)) {
|
|
1369
|
-
let value2 = tracked && (overridden || !proxySource) ? tracked.
|
|
1401
|
+
let value2 = tracked && (overridden || !proxySource) ? tracked.e !== NOT_PENDING ? tracked.e : tracked.g : storeValue[property];
|
|
1370
1402
|
value2 === $DELETED && (value2 = void 0);
|
|
1371
1403
|
if (!isWrappable(value2))
|
|
1372
1404
|
return value2;
|
|
@@ -1765,98 +1797,98 @@ function mapArray(list, map, options) {
|
|
|
1765
1797
|
const keyFn = typeof options?.keyed === "function" ? options.keyed : void 0;
|
|
1766
1798
|
return createMemo(
|
|
1767
1799
|
updateKeyedMap.bind({
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1800
|
+
B: createOwner(),
|
|
1801
|
+
m: 0,
|
|
1802
|
+
va: list,
|
|
1803
|
+
G: [],
|
|
1804
|
+
O: map,
|
|
1805
|
+
d: [],
|
|
1774
1806
|
a: [],
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1807
|
+
P: keyFn,
|
|
1808
|
+
n: keyFn || options?.keyed === false ? [] : void 0,
|
|
1809
|
+
o: map.length > 1 ? [] : void 0,
|
|
1778
1810
|
X: options?.fallback
|
|
1779
1811
|
})
|
|
1780
1812
|
);
|
|
1781
1813
|
}
|
|
1782
1814
|
var pureOptions = { pureWrite: true };
|
|
1783
1815
|
function updateKeyedMap() {
|
|
1784
|
-
const newItems = this.
|
|
1816
|
+
const newItems = this.va() || [], newLen = newItems.length;
|
|
1785
1817
|
newItems[$TRACK];
|
|
1786
|
-
runWithOwner(this.
|
|
1787
|
-
let i, j, mapper = this.
|
|
1788
|
-
this.
|
|
1789
|
-
this.
|
|
1790
|
-
return this.
|
|
1791
|
-
read.bind(null, this.
|
|
1792
|
-
this.
|
|
1818
|
+
runWithOwner(this.B, () => {
|
|
1819
|
+
let i, j, mapper = this.n ? () => {
|
|
1820
|
+
this.n[j] = signal(newItems[j], pureOptions);
|
|
1821
|
+
this.o && (this.o[j] = signal(j, pureOptions));
|
|
1822
|
+
return this.O(
|
|
1823
|
+
read.bind(null, this.n[j]),
|
|
1824
|
+
this.o ? read.bind(null, this.o[j]) : void 0
|
|
1793
1825
|
);
|
|
1794
|
-
} : this.
|
|
1826
|
+
} : this.o ? () => {
|
|
1795
1827
|
const item = newItems[j];
|
|
1796
|
-
this.
|
|
1797
|
-
return this.
|
|
1828
|
+
this.o[j] = signal(j, pureOptions);
|
|
1829
|
+
return this.O(
|
|
1798
1830
|
() => item,
|
|
1799
|
-
read.bind(null, this.
|
|
1831
|
+
read.bind(null, this.o[j])
|
|
1800
1832
|
);
|
|
1801
1833
|
} : () => {
|
|
1802
1834
|
const item = newItems[j];
|
|
1803
|
-
return this.
|
|
1835
|
+
return this.O(() => item);
|
|
1804
1836
|
};
|
|
1805
1837
|
if (newLen === 0) {
|
|
1806
|
-
if (this.
|
|
1807
|
-
this.
|
|
1838
|
+
if (this.m !== 0) {
|
|
1839
|
+
this.B.dispose(false);
|
|
1808
1840
|
this.a = [];
|
|
1809
|
-
this.
|
|
1810
|
-
this.
|
|
1811
|
-
this.
|
|
1812
|
-
this.
|
|
1813
|
-
this.
|
|
1841
|
+
this.G = [];
|
|
1842
|
+
this.d = [];
|
|
1843
|
+
this.m = 0;
|
|
1844
|
+
this.n && (this.n = []);
|
|
1845
|
+
this.o && (this.o = []);
|
|
1814
1846
|
}
|
|
1815
|
-
if (this.X && !this.
|
|
1816
|
-
this.
|
|
1847
|
+
if (this.X && !this.d[0]) {
|
|
1848
|
+
this.d[0] = runWithOwner(
|
|
1817
1849
|
this.a[0] = createOwner(),
|
|
1818
1850
|
this.X
|
|
1819
1851
|
);
|
|
1820
1852
|
}
|
|
1821
|
-
} else if (this.
|
|
1853
|
+
} else if (this.m === 0) {
|
|
1822
1854
|
if (this.a[0])
|
|
1823
1855
|
this.a[0].dispose();
|
|
1824
|
-
this.
|
|
1856
|
+
this.d = new Array(newLen);
|
|
1825
1857
|
for (j = 0; j < newLen; j++) {
|
|
1826
|
-
this.
|
|
1827
|
-
this.
|
|
1858
|
+
this.G[j] = newItems[j];
|
|
1859
|
+
this.d[j] = runWithOwner(this.a[j] = createOwner(), mapper);
|
|
1828
1860
|
}
|
|
1829
|
-
this.
|
|
1861
|
+
this.m = newLen;
|
|
1830
1862
|
} else {
|
|
1831
|
-
let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.
|
|
1832
|
-
for (start = 0, end = Math.min(this.
|
|
1833
|
-
if (this.
|
|
1834
|
-
setSignal(this.
|
|
1863
|
+
let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.n ? new Array(newLen) : void 0, tempIndexes = this.o ? new Array(newLen) : void 0;
|
|
1864
|
+
for (start = 0, end = Math.min(this.m, newLen); start < end && (this.G[start] === newItems[start] || this.n && compare(this.P, this.G[start], newItems[start])); start++) {
|
|
1865
|
+
if (this.n)
|
|
1866
|
+
setSignal(this.n[start], newItems[start]);
|
|
1835
1867
|
}
|
|
1836
|
-
for (end = this.
|
|
1837
|
-
temp[newEnd] = this.
|
|
1868
|
+
for (end = this.m - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.G[end] === newItems[newEnd] || this.n && compare(this.P, this.G[end], newItems[newEnd])); end--, newEnd--) {
|
|
1869
|
+
temp[newEnd] = this.d[end];
|
|
1838
1870
|
tempNodes[newEnd] = this.a[end];
|
|
1839
|
-
tempRows && (tempRows[newEnd] = this.
|
|
1840
|
-
tempIndexes && (tempIndexes[newEnd] = this.
|
|
1871
|
+
tempRows && (tempRows[newEnd] = this.n[end]);
|
|
1872
|
+
tempIndexes && (tempIndexes[newEnd] = this.o[end]);
|
|
1841
1873
|
}
|
|
1842
1874
|
newIndices = /* @__PURE__ */ new Map();
|
|
1843
1875
|
newIndicesNext = new Array(newEnd + 1);
|
|
1844
1876
|
for (j = newEnd; j >= start; j--) {
|
|
1845
1877
|
item = newItems[j];
|
|
1846
|
-
key = this.
|
|
1878
|
+
key = this.P ? this.P(item) : item;
|
|
1847
1879
|
i = newIndices.get(key);
|
|
1848
1880
|
newIndicesNext[j] = i === void 0 ? -1 : i;
|
|
1849
1881
|
newIndices.set(key, j);
|
|
1850
1882
|
}
|
|
1851
1883
|
for (i = start; i <= end; i++) {
|
|
1852
|
-
item = this.
|
|
1853
|
-
key = this.
|
|
1884
|
+
item = this.G[i];
|
|
1885
|
+
key = this.P ? this.P(item) : item;
|
|
1854
1886
|
j = newIndices.get(key);
|
|
1855
1887
|
if (j !== void 0 && j !== -1) {
|
|
1856
|
-
temp[j] = this.
|
|
1888
|
+
temp[j] = this.d[i];
|
|
1857
1889
|
tempNodes[j] = this.a[i];
|
|
1858
|
-
tempRows && (tempRows[j] = this.
|
|
1859
|
-
tempIndexes && (tempIndexes[j] = this.
|
|
1890
|
+
tempRows && (tempRows[j] = this.n[i]);
|
|
1891
|
+
tempIndexes && (tempIndexes[j] = this.o[i]);
|
|
1860
1892
|
j = newIndicesNext[j];
|
|
1861
1893
|
newIndices.set(key, j);
|
|
1862
1894
|
} else
|
|
@@ -1864,52 +1896,52 @@ function updateKeyedMap() {
|
|
|
1864
1896
|
}
|
|
1865
1897
|
for (j = start; j < newLen; j++) {
|
|
1866
1898
|
if (j in temp) {
|
|
1867
|
-
this.
|
|
1899
|
+
this.d[j] = temp[j];
|
|
1868
1900
|
this.a[j] = tempNodes[j];
|
|
1869
1901
|
if (tempRows) {
|
|
1870
|
-
this.
|
|
1871
|
-
setSignal(this.
|
|
1902
|
+
this.n[j] = tempRows[j];
|
|
1903
|
+
setSignal(this.n[j], newItems[j]);
|
|
1872
1904
|
}
|
|
1873
1905
|
if (tempIndexes) {
|
|
1874
|
-
this.
|
|
1875
|
-
setSignal(this.
|
|
1906
|
+
this.o[j] = tempIndexes[j];
|
|
1907
|
+
setSignal(this.o[j], j);
|
|
1876
1908
|
}
|
|
1877
1909
|
} else {
|
|
1878
|
-
this.
|
|
1910
|
+
this.d[j] = runWithOwner(this.a[j] = createOwner(), mapper);
|
|
1879
1911
|
}
|
|
1880
1912
|
}
|
|
1881
|
-
this.
|
|
1882
|
-
this.
|
|
1913
|
+
this.d = this.d.slice(0, this.m = newLen);
|
|
1914
|
+
this.G = newItems.slice(0);
|
|
1883
1915
|
}
|
|
1884
1916
|
});
|
|
1885
|
-
return this.
|
|
1917
|
+
return this.d;
|
|
1886
1918
|
}
|
|
1887
1919
|
function repeat(count, map, options) {
|
|
1888
1920
|
return updateRepeat.bind({
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1921
|
+
B: createOwner(),
|
|
1922
|
+
m: 0,
|
|
1923
|
+
y: 0,
|
|
1924
|
+
wa: count,
|
|
1925
|
+
O: map,
|
|
1894
1926
|
a: [],
|
|
1895
|
-
|
|
1896
|
-
|
|
1927
|
+
d: [],
|
|
1928
|
+
xa: options?.from,
|
|
1897
1929
|
X: options?.fallback
|
|
1898
1930
|
});
|
|
1899
1931
|
}
|
|
1900
1932
|
function updateRepeat() {
|
|
1901
|
-
const newLen = this.
|
|
1902
|
-
const from = this.
|
|
1903
|
-
runWithOwner(this.
|
|
1933
|
+
const newLen = this.wa();
|
|
1934
|
+
const from = this.xa?.() || 0;
|
|
1935
|
+
runWithOwner(this.B, () => {
|
|
1904
1936
|
if (newLen === 0) {
|
|
1905
|
-
if (this.
|
|
1906
|
-
this.
|
|
1937
|
+
if (this.m !== 0) {
|
|
1938
|
+
this.B.dispose(false);
|
|
1907
1939
|
this.a = [];
|
|
1908
|
-
this.
|
|
1909
|
-
this.
|
|
1940
|
+
this.d = [];
|
|
1941
|
+
this.m = 0;
|
|
1910
1942
|
}
|
|
1911
|
-
if (this.X && !this.
|
|
1912
|
-
this.
|
|
1943
|
+
if (this.X && !this.d[0]) {
|
|
1944
|
+
this.d[0] = runWithOwner(
|
|
1913
1945
|
this.a[0] = createOwner(),
|
|
1914
1946
|
this.X
|
|
1915
1947
|
);
|
|
@@ -1917,44 +1949,44 @@ function updateRepeat() {
|
|
|
1917
1949
|
return;
|
|
1918
1950
|
}
|
|
1919
1951
|
const to = from + newLen;
|
|
1920
|
-
const prevTo = this.
|
|
1921
|
-
if (this.
|
|
1952
|
+
const prevTo = this.y + this.m;
|
|
1953
|
+
if (this.m === 0 && this.a[0])
|
|
1922
1954
|
this.a[0].dispose();
|
|
1923
1955
|
for (let i = to; i < prevTo; i++)
|
|
1924
|
-
this.a[i - this.
|
|
1925
|
-
if (this.
|
|
1926
|
-
let i = this.
|
|
1927
|
-
while (i < from && i < this.
|
|
1956
|
+
this.a[i - this.y].dispose();
|
|
1957
|
+
if (this.y < from) {
|
|
1958
|
+
let i = this.y;
|
|
1959
|
+
while (i < from && i < this.m)
|
|
1928
1960
|
this.a[i++].dispose();
|
|
1929
|
-
this.a.splice(0, from - this.
|
|
1930
|
-
this.
|
|
1931
|
-
} else if (this.
|
|
1932
|
-
let i = prevTo - this.
|
|
1933
|
-
let difference = this.
|
|
1934
|
-
this.a.length = this.
|
|
1961
|
+
this.a.splice(0, from - this.y);
|
|
1962
|
+
this.d.splice(0, from - this.y);
|
|
1963
|
+
} else if (this.y > from) {
|
|
1964
|
+
let i = prevTo - this.y - 1;
|
|
1965
|
+
let difference = this.y - from;
|
|
1966
|
+
this.a.length = this.d.length = newLen;
|
|
1935
1967
|
while (i >= difference) {
|
|
1936
1968
|
this.a[i] = this.a[i - difference];
|
|
1937
|
-
this.
|
|
1969
|
+
this.d[i] = this.d[i - difference];
|
|
1938
1970
|
i--;
|
|
1939
1971
|
}
|
|
1940
1972
|
for (let i2 = 0; i2 < difference; i2++) {
|
|
1941
|
-
this.
|
|
1973
|
+
this.d[i2] = runWithOwner(
|
|
1942
1974
|
this.a[i2] = createOwner(),
|
|
1943
|
-
() => this.
|
|
1975
|
+
() => this.O(i2 + from)
|
|
1944
1976
|
);
|
|
1945
1977
|
}
|
|
1946
1978
|
}
|
|
1947
1979
|
for (let i = prevTo; i < to; i++) {
|
|
1948
|
-
this.
|
|
1980
|
+
this.d[i - from] = runWithOwner(
|
|
1949
1981
|
this.a[i - from] = createOwner(),
|
|
1950
|
-
() => this.
|
|
1982
|
+
() => this.O(i)
|
|
1951
1983
|
);
|
|
1952
1984
|
}
|
|
1953
|
-
this.
|
|
1954
|
-
this.
|
|
1955
|
-
this.
|
|
1985
|
+
this.d = this.d.slice(0, newLen);
|
|
1986
|
+
this.y = from;
|
|
1987
|
+
this.m = newLen;
|
|
1956
1988
|
});
|
|
1957
|
-
return this.
|
|
1989
|
+
return this.d;
|
|
1958
1990
|
}
|
|
1959
1991
|
function compare(key, a, b) {
|
|
1960
1992
|
return key ? key(a) === key(b) : true;
|
|
@@ -1988,20 +2020,20 @@ function createBoundChildren(owner, fn, queue, mask) {
|
|
|
1988
2020
|
});
|
|
1989
2021
|
}
|
|
1990
2022
|
var ConditionalQueue = class extends Queue {
|
|
1991
|
-
|
|
1992
|
-
|
|
2023
|
+
u;
|
|
2024
|
+
ga = /* @__PURE__ */ new Set();
|
|
1993
2025
|
h = /* @__PURE__ */ new Set();
|
|
1994
2026
|
constructor(disabled) {
|
|
1995
2027
|
super();
|
|
1996
|
-
this.
|
|
2028
|
+
this.u = disabled;
|
|
1997
2029
|
}
|
|
1998
2030
|
run(type) {
|
|
1999
|
-
if (!type || read(this.
|
|
2031
|
+
if (!type || read(this.u))
|
|
2000
2032
|
return;
|
|
2001
2033
|
return super.run(type);
|
|
2002
2034
|
}
|
|
2003
2035
|
notify(node, type, flags) {
|
|
2004
|
-
if (read(this.
|
|
2036
|
+
if (read(this.u)) {
|
|
2005
2037
|
if (type & 1 /* Pending */) {
|
|
2006
2038
|
if (flags & 1 /* Pending */) {
|
|
2007
2039
|
this.h.add(node);
|
|
@@ -2011,9 +2043,9 @@ var ConditionalQueue = class extends Queue {
|
|
|
2011
2043
|
}
|
|
2012
2044
|
if (type & 2 /* Error */) {
|
|
2013
2045
|
if (flags & 2 /* Error */) {
|
|
2014
|
-
this.
|
|
2046
|
+
this.ga.add(node);
|
|
2015
2047
|
type &= ~2 /* Error */;
|
|
2016
|
-
} else if (this.
|
|
2048
|
+
} else if (this.ga.delete(node))
|
|
2017
2049
|
type &= ~2 /* Error */;
|
|
2018
2050
|
}
|
|
2019
2051
|
}
|
|
@@ -2021,31 +2053,32 @@ var ConditionalQueue = class extends Queue {
|
|
|
2021
2053
|
}
|
|
2022
2054
|
};
|
|
2023
2055
|
var CollectionQueue = class extends Queue {
|
|
2024
|
-
|
|
2056
|
+
Z;
|
|
2025
2057
|
a = /* @__PURE__ */ new Set();
|
|
2026
|
-
|
|
2058
|
+
u = signal(false, { pureWrite: true });
|
|
2059
|
+
qa = false;
|
|
2027
2060
|
constructor(type) {
|
|
2028
2061
|
super();
|
|
2029
|
-
this.
|
|
2062
|
+
this.Z = type;
|
|
2030
2063
|
}
|
|
2031
2064
|
run(type) {
|
|
2032
|
-
if (!type || read(this.
|
|
2065
|
+
if (!type || read(this.u))
|
|
2033
2066
|
return;
|
|
2034
2067
|
return super.run(type);
|
|
2035
2068
|
}
|
|
2036
2069
|
notify(node, type, flags) {
|
|
2037
|
-
if (!(type & this.
|
|
2070
|
+
if (!(type & this.Z) || this.Z & 1 /* Pending */ && this.qa)
|
|
2038
2071
|
return super.notify(node, type, flags);
|
|
2039
|
-
if (flags & this.
|
|
2072
|
+
if (flags & this.Z) {
|
|
2040
2073
|
this.a.add(node);
|
|
2041
2074
|
if (this.a.size === 1)
|
|
2042
|
-
setSignal(this.
|
|
2075
|
+
setSignal(this.u, true);
|
|
2043
2076
|
} else if (this.a.size > 0) {
|
|
2044
2077
|
this.a.delete(node);
|
|
2045
2078
|
if (this.a.size === 0)
|
|
2046
|
-
setSignal(this.
|
|
2079
|
+
setSignal(this.u, false);
|
|
2047
2080
|
}
|
|
2048
|
-
type &= ~this.
|
|
2081
|
+
type &= ~this.Z;
|
|
2049
2082
|
return type ? super.notify(node, type, flags) : true;
|
|
2050
2083
|
}
|
|
2051
2084
|
};
|
|
@@ -2054,28 +2087,29 @@ function createBoundary(fn, condition) {
|
|
|
2054
2087
|
const queue = new ConditionalQueue(computed(() => condition() === "hidden" /* HIDDEN */));
|
|
2055
2088
|
const tree = createBoundChildren(owner, fn, queue, 0);
|
|
2056
2089
|
computed(() => {
|
|
2057
|
-
const disabled = read(queue.
|
|
2090
|
+
const disabled = read(queue.u);
|
|
2058
2091
|
tree.Y = disabled ? 2 /* Error */ | 1 /* Pending */ : 0;
|
|
2059
2092
|
if (!disabled) {
|
|
2060
2093
|
queue.h.forEach(
|
|
2061
2094
|
(node) => queue.notify(node, 1 /* Pending */, 1 /* Pending */)
|
|
2062
2095
|
);
|
|
2063
|
-
queue.
|
|
2096
|
+
queue.ga.forEach((node) => queue.notify(node, 2 /* Error */, 2 /* Error */));
|
|
2064
2097
|
queue.h.clear();
|
|
2065
|
-
queue.
|
|
2098
|
+
queue.ga.clear();
|
|
2066
2099
|
}
|
|
2067
2100
|
});
|
|
2068
|
-
return () => read(queue.
|
|
2101
|
+
return () => read(queue.u) ? void 0 : read(tree);
|
|
2069
2102
|
}
|
|
2070
2103
|
function createCollectionBoundary(type, fn, fallback) {
|
|
2071
2104
|
const owner = createOwner();
|
|
2072
2105
|
const queue = new CollectionQueue(type);
|
|
2073
2106
|
const tree = createBoundChildren(owner, fn, queue, type);
|
|
2074
2107
|
const decision = computed(() => {
|
|
2075
|
-
if (!read(queue.
|
|
2108
|
+
if (!read(queue.u)) {
|
|
2076
2109
|
const resolved = read(tree);
|
|
2077
|
-
if (!untrack(() => read(queue.
|
|
2078
|
-
|
|
2110
|
+
if (!untrack(() => read(queue.u)))
|
|
2111
|
+
queue.qa = true;
|
|
2112
|
+
return resolved;
|
|
2079
2113
|
}
|
|
2080
2114
|
return fallback(queue);
|
|
2081
2115
|
});
|
|
@@ -2087,7 +2121,7 @@ function createLoadBoundary(fn, fallback) {
|
|
|
2087
2121
|
function createErrorBoundary(fn, fallback) {
|
|
2088
2122
|
return createCollectionBoundary(2 /* Error */, fn, (queue) => {
|
|
2089
2123
|
let node = queue.a.values().next().value;
|
|
2090
|
-
return fallback(node.
|
|
2124
|
+
return fallback(node.C, () => {
|
|
2091
2125
|
for (let node2 of queue.a) {
|
|
2092
2126
|
recompute(node2, true);
|
|
2093
2127
|
}
|