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