@solidjs/signals 0.8.2 → 0.8.3
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 +88 -42
- package/dist/node.cjs +339 -289
- package/dist/prod.js +334 -288
- package/dist/types/core/core.d.ts +2 -1
- package/dist/types/core/effect.d.ts +0 -1
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/scheduler.d.ts +0 -1
- package/dist/types/signals.d.ts +1 -1
- package/dist/types/store/store.d.ts +3 -2
- package/package.json +1 -1
package/dist/node.cjs
CHANGED
|
@@ -27,13 +27,13 @@ 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.w) == null ? void 0 : _a
|
|
30
|
+
const parentHeight = (((_a = n.w) == null ? void 0 : _a.$) ? (_b = n.w.aa) == null ? void 0 : _b.c : (_c = n.w) == null ? void 0 : _c.c) ?? -1;
|
|
31
31
|
if (parentHeight >= n.c)
|
|
32
32
|
n.c = parentHeight + 1;
|
|
33
33
|
const height = n.c;
|
|
34
|
-
const heapAtHeight = heap.
|
|
34
|
+
const heapAtHeight = heap.s[height];
|
|
35
35
|
if (heapAtHeight === void 0) {
|
|
36
|
-
heap.
|
|
36
|
+
heap.s[height] = n;
|
|
37
37
|
} else {
|
|
38
38
|
const tail = heapAtHeight.z;
|
|
39
39
|
tail.Q = n;
|
|
@@ -70,13 +70,13 @@ function deleteFromHeap(n, heap) {
|
|
|
70
70
|
n.b = flags & ~(8 /* InHeap */ | 16 /* InHeapHeight */);
|
|
71
71
|
const height = n.c;
|
|
72
72
|
if (n.z === n) {
|
|
73
|
-
heap.
|
|
73
|
+
heap.s[height] = void 0;
|
|
74
74
|
} else {
|
|
75
75
|
const next = n.Q;
|
|
76
|
-
const dhh = heap.
|
|
76
|
+
const dhh = heap.s[height];
|
|
77
77
|
const end = next ?? dhh;
|
|
78
78
|
if (n === dhh) {
|
|
79
|
-
heap.
|
|
79
|
+
heap.s[height] = next;
|
|
80
80
|
} else {
|
|
81
81
|
n.z.Q = next;
|
|
82
82
|
}
|
|
@@ -86,11 +86,11 @@ function deleteFromHeap(n, heap) {
|
|
|
86
86
|
n.Q = void 0;
|
|
87
87
|
}
|
|
88
88
|
function markHeap(heap) {
|
|
89
|
-
if (heap.
|
|
89
|
+
if (heap.ba)
|
|
90
90
|
return;
|
|
91
|
-
heap.
|
|
91
|
+
heap.ba = true;
|
|
92
92
|
for (let i = 0; i <= heap.L; i++) {
|
|
93
|
-
for (let el = heap.
|
|
93
|
+
for (let el = heap.s[i]; el !== void 0; el = el.Q) {
|
|
94
94
|
if (el.b & 8 /* InHeap */)
|
|
95
95
|
markNode(el);
|
|
96
96
|
}
|
|
@@ -101,28 +101,28 @@ 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.
|
|
104
|
+
for (let link2 = el.x; link2 !== null; link2 = link2.A) {
|
|
105
105
|
markNode(link2.j, 1 /* Check */);
|
|
106
106
|
}
|
|
107
|
-
if (el.
|
|
108
|
-
for (let child = el.
|
|
109
|
-
for (let link2 = child.
|
|
107
|
+
if (el.ca !== null) {
|
|
108
|
+
for (let child = el.ca; child !== null; child = child.sa) {
|
|
109
|
+
for (let link2 = child.x; link2 !== null; link2 = link2.A) {
|
|
110
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.ba = false;
|
|
117
|
+
for (heap.q = 0; heap.q <= heap.L; heap.q++) {
|
|
118
|
+
let el = heap.s[heap.q];
|
|
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.s[heap.q];
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
heap.L = 0;
|
|
@@ -130,10 +130,10 @@ function runHeap(heap, recompute2) {
|
|
|
130
130
|
function adjustHeight(el, heap) {
|
|
131
131
|
deleteFromHeap(el, heap);
|
|
132
132
|
let newHeight = el.c;
|
|
133
|
-
for (let d = el.
|
|
133
|
+
for (let d = el.l; d; d = d.E) {
|
|
134
134
|
const dep1 = d.R;
|
|
135
|
-
const dep =
|
|
136
|
-
if (
|
|
135
|
+
const dep = dep1.ia || dep1;
|
|
136
|
+
if (dep.H) {
|
|
137
137
|
if (dep.c >= newHeight) {
|
|
138
138
|
newHeight = dep.c + 1;
|
|
139
139
|
}
|
|
@@ -141,7 +141,7 @@ function adjustHeight(el, heap) {
|
|
|
141
141
|
}
|
|
142
142
|
if (el.c !== newHeight) {
|
|
143
143
|
el.c = newHeight;
|
|
144
|
-
for (let s = el.
|
|
144
|
+
for (let s = el.x; s !== null; s = s.A) {
|
|
145
145
|
insertIntoHeapHeight(s.j, heap);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
@@ -150,41 +150,40 @@ function adjustHeight(el, heap) {
|
|
|
150
150
|
// src/core/scheduler.ts
|
|
151
151
|
var clock = 0;
|
|
152
152
|
var activeTransition = null;
|
|
153
|
-
var unobserved = [];
|
|
154
153
|
var transitions = /* @__PURE__ */ new Set();
|
|
155
154
|
var scheduled = false;
|
|
156
155
|
function schedule() {
|
|
157
156
|
if (scheduled)
|
|
158
157
|
return;
|
|
159
158
|
scheduled = true;
|
|
160
|
-
if (!globalQueue.
|
|
159
|
+
if (!globalQueue.da)
|
|
161
160
|
queueMicrotask(flush);
|
|
162
161
|
}
|
|
163
162
|
var dirtyQueue = {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
s: new Array(2e3).fill(void 0),
|
|
164
|
+
ba: false,
|
|
165
|
+
q: 0,
|
|
167
166
|
L: 0
|
|
168
167
|
};
|
|
169
168
|
var zombieQueue = {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
s: new Array(2e3).fill(void 0),
|
|
170
|
+
ba: false,
|
|
171
|
+
q: 0,
|
|
173
172
|
L: 0
|
|
174
173
|
};
|
|
175
174
|
var Queue = class {
|
|
176
175
|
w = null;
|
|
177
176
|
k = [[], []];
|
|
178
|
-
|
|
177
|
+
m = [];
|
|
179
178
|
created = clock;
|
|
180
179
|
addChild(child) {
|
|
181
|
-
this.
|
|
180
|
+
this.m.push(child);
|
|
182
181
|
child.w = this;
|
|
183
182
|
}
|
|
184
183
|
removeChild(child) {
|
|
185
|
-
const index = this.
|
|
184
|
+
const index = this.m.indexOf(child);
|
|
186
185
|
if (index >= 0) {
|
|
187
|
-
this.
|
|
186
|
+
this.m.splice(index, 1);
|
|
188
187
|
child.w = null;
|
|
189
188
|
}
|
|
190
189
|
}
|
|
@@ -199,8 +198,8 @@ var Queue = class {
|
|
|
199
198
|
this.k[type - 1] = [];
|
|
200
199
|
runQueue(effects, type);
|
|
201
200
|
}
|
|
202
|
-
for (let i = 0; i < this.
|
|
203
|
-
this.
|
|
201
|
+
for (let i = 0; i < this.m.length; i++) {
|
|
202
|
+
this.m[i].run(type);
|
|
204
203
|
}
|
|
205
204
|
}
|
|
206
205
|
enqueue(type, fn) {
|
|
@@ -212,12 +211,12 @@ var Queue = class {
|
|
|
212
211
|
stub.k[0].push(...this.k[0]);
|
|
213
212
|
stub.k[1].push(...this.k[1]);
|
|
214
213
|
this.k = [[], []];
|
|
215
|
-
for (let i = 0; i < this.
|
|
216
|
-
let child = this.
|
|
217
|
-
let childStub = stub.
|
|
214
|
+
for (let i = 0; i < this.m.length; i++) {
|
|
215
|
+
let child = this.m[i];
|
|
216
|
+
let childStub = stub.m[i];
|
|
218
217
|
if (!childStub) {
|
|
219
|
-
childStub = { k: [[], []],
|
|
220
|
-
stub.
|
|
218
|
+
childStub = { k: [[], []], m: [] };
|
|
219
|
+
stub.m[i] = childStub;
|
|
221
220
|
}
|
|
222
221
|
child.stashQueues(childStub);
|
|
223
222
|
}
|
|
@@ -225,23 +224,23 @@ var Queue = class {
|
|
|
225
224
|
restoreQueues(stub) {
|
|
226
225
|
this.k[0].push(...stub.k[0]);
|
|
227
226
|
this.k[1].push(...stub.k[1]);
|
|
228
|
-
for (let i = 0; i < stub.
|
|
229
|
-
const childStub = stub.
|
|
230
|
-
let child = this.
|
|
227
|
+
for (let i = 0; i < stub.m.length; i++) {
|
|
228
|
+
const childStub = stub.m[i];
|
|
229
|
+
let child = this.m[i];
|
|
231
230
|
if (child)
|
|
232
231
|
child.restoreQueues(childStub);
|
|
233
232
|
}
|
|
234
233
|
}
|
|
235
234
|
};
|
|
236
235
|
var GlobalQueue = class _GlobalQueue extends Queue {
|
|
237
|
-
|
|
236
|
+
da = false;
|
|
238
237
|
h = [];
|
|
239
238
|
static S;
|
|
240
|
-
static
|
|
239
|
+
static la;
|
|
241
240
|
flush() {
|
|
242
|
-
if (this.
|
|
241
|
+
if (this.da)
|
|
243
242
|
return;
|
|
244
|
-
this.
|
|
243
|
+
this.da = true;
|
|
245
244
|
try {
|
|
246
245
|
runHeap(dirtyQueue, _GlobalQueue.S);
|
|
247
246
|
if (activeTransition) {
|
|
@@ -269,8 +268,8 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
269
268
|
n.g = n.e;
|
|
270
269
|
n.e = NOT_PENDING;
|
|
271
270
|
}
|
|
272
|
-
if (n.
|
|
273
|
-
_GlobalQueue.
|
|
271
|
+
if (n.H)
|
|
272
|
+
_GlobalQueue.la(n, false, true);
|
|
274
273
|
}
|
|
275
274
|
globalQueue.h.length = 0;
|
|
276
275
|
clock++;
|
|
@@ -278,15 +277,14 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
278
277
|
this.run(1 /* Render */);
|
|
279
278
|
this.run(2 /* User */);
|
|
280
279
|
} finally {
|
|
281
|
-
this.
|
|
282
|
-
unobserved.length && notifyUnobserved();
|
|
280
|
+
this.da = false;
|
|
283
281
|
}
|
|
284
282
|
}
|
|
285
283
|
notify(node, mask, flags) {
|
|
286
284
|
if (mask & 1 /* Pending */) {
|
|
287
285
|
if (flags & 1 /* Pending */) {
|
|
288
|
-
if (activeTransition && !activeTransition.asyncNodes.includes(node.
|
|
289
|
-
activeTransition.asyncNodes.push(node.
|
|
286
|
+
if (activeTransition && !activeTransition.asyncNodes.includes(node.B.cause))
|
|
287
|
+
activeTransition.asyncNodes.push(node.B.cause);
|
|
290
288
|
}
|
|
291
289
|
return true;
|
|
292
290
|
}
|
|
@@ -300,7 +298,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
300
298
|
time: clock,
|
|
301
299
|
pendingNodes: [],
|
|
302
300
|
asyncNodes: [],
|
|
303
|
-
queueStash: { k: [[], []],
|
|
301
|
+
queueStash: { k: [[], []], m: [] }
|
|
304
302
|
};
|
|
305
303
|
}
|
|
306
304
|
transitions.add(activeTransition);
|
|
@@ -319,8 +317,8 @@ function runPending(pendingNodes, value) {
|
|
|
319
317
|
for (let i = 0; i < p.length; i++) {
|
|
320
318
|
const n = p[i];
|
|
321
319
|
n.T = activeTransition;
|
|
322
|
-
if (n.
|
|
323
|
-
n.
|
|
320
|
+
if (n.I) {
|
|
321
|
+
n.I.ea(value);
|
|
324
322
|
needsReset = true;
|
|
325
323
|
}
|
|
326
324
|
}
|
|
@@ -346,19 +344,10 @@ function transitionComplete(transition) {
|
|
|
346
344
|
}
|
|
347
345
|
return done;
|
|
348
346
|
}
|
|
349
|
-
function notifyUnobserved() {
|
|
350
|
-
var _a, _b;
|
|
351
|
-
for (let i = 0; i < unobserved.length; i++) {
|
|
352
|
-
const source = unobserved[i];
|
|
353
|
-
if (!source.s)
|
|
354
|
-
(_b = (_a = unobserved[i]).sa) == null ? void 0 : _b.call(_a);
|
|
355
|
-
}
|
|
356
|
-
unobserved = [];
|
|
357
|
-
}
|
|
358
347
|
|
|
359
348
|
// src/core/core.ts
|
|
360
349
|
GlobalQueue.S = recompute;
|
|
361
|
-
GlobalQueue.
|
|
350
|
+
GlobalQueue.la = disposeChildren;
|
|
362
351
|
var tracking = false;
|
|
363
352
|
var stale = false;
|
|
364
353
|
var pendingValueCheck = false;
|
|
@@ -366,10 +355,10 @@ var pendingCheck = null;
|
|
|
366
355
|
var context = null;
|
|
367
356
|
var defaultContext = {};
|
|
368
357
|
function notifySubs(node) {
|
|
369
|
-
for (let s = node.
|
|
358
|
+
for (let s = node.x; s !== null; s = s.A) {
|
|
370
359
|
const queue = s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
|
|
371
|
-
if (queue.
|
|
372
|
-
queue.
|
|
360
|
+
if (queue.q > s.j.c)
|
|
361
|
+
queue.q = s.j.c;
|
|
373
362
|
insertIntoHeap(s.j, queue);
|
|
374
363
|
}
|
|
375
364
|
}
|
|
@@ -382,24 +371,24 @@ function recompute(el, create = false) {
|
|
|
382
371
|
markDisposal(el);
|
|
383
372
|
globalQueue.h.push(el);
|
|
384
373
|
el.V = el.t;
|
|
385
|
-
el.U = el.
|
|
374
|
+
el.U = el.r;
|
|
386
375
|
el.t = null;
|
|
387
|
-
el.
|
|
376
|
+
el.r = null;
|
|
388
377
|
}
|
|
389
378
|
const oldcontext = context;
|
|
390
379
|
context = el;
|
|
391
|
-
el.
|
|
380
|
+
el.F = null;
|
|
392
381
|
el.b = 4 /* RecomputingDeps */;
|
|
393
382
|
el.J = clock;
|
|
394
383
|
let value = el.e === NOT_PENDING ? el.g : el.e;
|
|
395
384
|
let oldHeight = el.c;
|
|
396
385
|
let prevStatusFlags = el.f;
|
|
397
|
-
let prevError = el.
|
|
386
|
+
let prevError = el.B;
|
|
398
387
|
let prevTracking = tracking;
|
|
399
388
|
clearStatusFlags(el);
|
|
400
389
|
tracking = true;
|
|
401
390
|
try {
|
|
402
|
-
value = el.
|
|
391
|
+
value = el.H(value);
|
|
403
392
|
} catch (e) {
|
|
404
393
|
if (e instanceof NotReadyError) {
|
|
405
394
|
if (e.cause !== el)
|
|
@@ -413,51 +402,51 @@ function recompute(el, create = false) {
|
|
|
413
402
|
}
|
|
414
403
|
el.b = 0 /* None */;
|
|
415
404
|
context = oldcontext;
|
|
416
|
-
const depsTail = el.
|
|
417
|
-
let toRemove = depsTail !== null ? depsTail.
|
|
405
|
+
const depsTail = el.F;
|
|
406
|
+
let toRemove = depsTail !== null ? depsTail.E : el.l;
|
|
418
407
|
if (toRemove !== null) {
|
|
419
408
|
do {
|
|
420
409
|
toRemove = unlinkSubs(toRemove);
|
|
421
410
|
} while (toRemove !== null);
|
|
422
411
|
if (depsTail !== null) {
|
|
423
|
-
depsTail.
|
|
412
|
+
depsTail.E = null;
|
|
424
413
|
} else {
|
|
425
|
-
el.
|
|
414
|
+
el.l = null;
|
|
426
415
|
}
|
|
427
416
|
}
|
|
428
|
-
const valueChanged = !el.
|
|
429
|
-
const statusFlagsChanged = el.f !== prevStatusFlags || el.
|
|
430
|
-
(_a = el.
|
|
417
|
+
const valueChanged = !el.fa || !el.fa(el.e === NOT_PENDING ? el.g : el.e, value);
|
|
418
|
+
const statusFlagsChanged = el.f !== prevStatusFlags || el.B !== prevError;
|
|
419
|
+
(_a = el.ma) == null ? void 0 : _a.call(el, statusFlagsChanged, prevStatusFlags);
|
|
431
420
|
if (valueChanged || statusFlagsChanged) {
|
|
432
421
|
if (valueChanged) {
|
|
433
|
-
if (create || el.
|
|
422
|
+
if (create || el.ja || el.K)
|
|
434
423
|
el.g = value;
|
|
435
424
|
else {
|
|
436
425
|
if (el.e === NOT_PENDING)
|
|
437
426
|
globalQueue.h.push(el);
|
|
438
427
|
el.e = value;
|
|
439
428
|
}
|
|
440
|
-
if (el.
|
|
441
|
-
el.
|
|
429
|
+
if (el.C)
|
|
430
|
+
el.C.ea(value);
|
|
442
431
|
}
|
|
443
|
-
for (let s = el.
|
|
432
|
+
for (let s = el.x; s !== null; s = s.A) {
|
|
444
433
|
const queue = s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
|
|
445
|
-
if (s.j.c < el.c && queue.
|
|
446
|
-
queue.
|
|
434
|
+
if (s.j.c < el.c && queue.q > s.j.c)
|
|
435
|
+
queue.q = s.j.c;
|
|
447
436
|
insertIntoHeap(s.j, queue);
|
|
448
437
|
}
|
|
449
438
|
} else if (el.c != oldHeight) {
|
|
450
|
-
for (let s = el.
|
|
439
|
+
for (let s = el.x; s !== null; s = s.A) {
|
|
451
440
|
insertIntoHeapHeight(s.j, s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
|
|
452
441
|
}
|
|
453
442
|
}
|
|
454
443
|
}
|
|
455
444
|
function updateIfNecessary(el) {
|
|
456
445
|
if (el.b & 1 /* Check */) {
|
|
457
|
-
for (let d = el.
|
|
446
|
+
for (let d = el.l; d; d = d.E) {
|
|
458
447
|
const dep1 = d.R;
|
|
459
|
-
const dep =
|
|
460
|
-
if (
|
|
448
|
+
const dep = dep1.ia || dep1;
|
|
449
|
+
if (dep.H) {
|
|
461
450
|
updateIfNecessary(dep);
|
|
462
451
|
}
|
|
463
452
|
if (el.b & 2 /* Dirty */) {
|
|
@@ -471,33 +460,47 @@ function updateIfNecessary(el) {
|
|
|
471
460
|
el.b = 0 /* None */;
|
|
472
461
|
}
|
|
473
462
|
function unlinkSubs(link2) {
|
|
463
|
+
var _a;
|
|
474
464
|
const dep = link2.R;
|
|
475
|
-
const nextDep = link2.
|
|
465
|
+
const nextDep = link2.E;
|
|
476
466
|
const nextSub = link2.A;
|
|
477
|
-
const prevSub = link2.
|
|
467
|
+
const prevSub = link2.na;
|
|
478
468
|
if (nextSub !== null) {
|
|
479
|
-
nextSub.
|
|
469
|
+
nextSub.na = prevSub;
|
|
480
470
|
} else {
|
|
481
471
|
dep.W = prevSub;
|
|
482
472
|
}
|
|
483
473
|
if (prevSub !== null) {
|
|
484
474
|
prevSub.A = nextSub;
|
|
485
475
|
} else {
|
|
486
|
-
dep.
|
|
476
|
+
dep.x = nextSub;
|
|
477
|
+
if (nextSub === null) {
|
|
478
|
+
(_a = dep.ta) == null ? void 0 : _a.call(dep);
|
|
479
|
+
dep.H && unobserved(dep);
|
|
480
|
+
}
|
|
487
481
|
}
|
|
488
482
|
return nextDep;
|
|
489
483
|
}
|
|
484
|
+
function unobserved(el) {
|
|
485
|
+
deleteFromHeap(el, el.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
|
|
486
|
+
let dep = el.l;
|
|
487
|
+
while (dep !== null) {
|
|
488
|
+
dep = unlinkSubs(dep);
|
|
489
|
+
}
|
|
490
|
+
el.l = null;
|
|
491
|
+
runDisposal(el);
|
|
492
|
+
}
|
|
490
493
|
function link(dep, sub) {
|
|
491
|
-
const prevDep = sub.
|
|
494
|
+
const prevDep = sub.F;
|
|
492
495
|
if (prevDep !== null && prevDep.R === dep) {
|
|
493
496
|
return;
|
|
494
497
|
}
|
|
495
498
|
let nextDep = null;
|
|
496
499
|
const isRecomputing = sub.b & 4 /* RecomputingDeps */;
|
|
497
500
|
if (isRecomputing) {
|
|
498
|
-
nextDep = prevDep !== null ? prevDep.
|
|
501
|
+
nextDep = prevDep !== null ? prevDep.E : sub.l;
|
|
499
502
|
if (nextDep !== null && nextDep.R === dep) {
|
|
500
|
-
sub.
|
|
503
|
+
sub.F = nextDep;
|
|
501
504
|
return;
|
|
502
505
|
}
|
|
503
506
|
}
|
|
@@ -505,28 +508,28 @@ function link(dep, sub) {
|
|
|
505
508
|
if (prevSub !== null && prevSub.j === sub && (!isRecomputing || isValidLink(prevSub, sub))) {
|
|
506
509
|
return;
|
|
507
510
|
}
|
|
508
|
-
const newLink = sub.
|
|
511
|
+
const newLink = sub.F = dep.W = {
|
|
509
512
|
R: dep,
|
|
510
513
|
j: sub,
|
|
511
|
-
|
|
512
|
-
|
|
514
|
+
E: nextDep,
|
|
515
|
+
na: prevSub,
|
|
513
516
|
A: null
|
|
514
517
|
};
|
|
515
518
|
if (prevDep !== null) {
|
|
516
|
-
prevDep.
|
|
519
|
+
prevDep.E = newLink;
|
|
517
520
|
} else {
|
|
518
|
-
sub.
|
|
521
|
+
sub.l = newLink;
|
|
519
522
|
}
|
|
520
523
|
if (prevSub !== null) {
|
|
521
524
|
prevSub.A = newLink;
|
|
522
525
|
} else {
|
|
523
|
-
dep.
|
|
526
|
+
dep.x = newLink;
|
|
524
527
|
}
|
|
525
528
|
}
|
|
526
529
|
function isValidLink(checkLink, sub) {
|
|
527
|
-
const depsTail = sub.
|
|
530
|
+
const depsTail = sub.F;
|
|
528
531
|
if (depsTail !== null) {
|
|
529
|
-
let link2 = sub.
|
|
532
|
+
let link2 = sub.l;
|
|
530
533
|
do {
|
|
531
534
|
if (link2 === checkLink) {
|
|
532
535
|
return true;
|
|
@@ -534,14 +537,14 @@ function isValidLink(checkLink, sub) {
|
|
|
534
537
|
if (link2 === depsTail) {
|
|
535
538
|
break;
|
|
536
539
|
}
|
|
537
|
-
link2 = link2.
|
|
540
|
+
link2 = link2.E;
|
|
538
541
|
} while (link2 !== null);
|
|
539
542
|
}
|
|
540
543
|
return false;
|
|
541
544
|
}
|
|
542
545
|
function setStatusFlags(signal2, flags, error = null) {
|
|
543
546
|
signal2.f = flags;
|
|
544
|
-
signal2.
|
|
547
|
+
signal2.B = error;
|
|
545
548
|
}
|
|
546
549
|
function setError(signal2, error) {
|
|
547
550
|
setStatusFlags(signal2, 2 /* Error */, error);
|
|
@@ -550,7 +553,7 @@ function clearStatusFlags(signal2) {
|
|
|
550
553
|
setStatusFlags(signal2, 0 /* None */);
|
|
551
554
|
}
|
|
552
555
|
function markDisposal(el) {
|
|
553
|
-
let child = el.
|
|
556
|
+
let child = el.r;
|
|
554
557
|
while (child) {
|
|
555
558
|
child.b |= 32 /* Zombie */;
|
|
556
559
|
const inHeap = child.b & 8 /* InHeap */;
|
|
@@ -562,23 +565,32 @@ function markDisposal(el) {
|
|
|
562
565
|
child = child.M;
|
|
563
566
|
}
|
|
564
567
|
}
|
|
568
|
+
function dispose(node) {
|
|
569
|
+
let toRemove = node.l || null;
|
|
570
|
+
do {
|
|
571
|
+
toRemove = unlinkSubs(toRemove);
|
|
572
|
+
} while (toRemove !== null);
|
|
573
|
+
node.l = null;
|
|
574
|
+
node.F = null;
|
|
575
|
+
disposeChildren(node, true);
|
|
576
|
+
}
|
|
565
577
|
function disposeChildren(node, self = false, zombie) {
|
|
566
578
|
if (node.b & 64 /* Disposed */)
|
|
567
579
|
return;
|
|
568
580
|
if (self)
|
|
569
581
|
node.b = 64 /* Disposed */;
|
|
570
|
-
let child = zombie ? node.U : node.
|
|
582
|
+
let child = zombie ? node.U : node.r;
|
|
571
583
|
while (child) {
|
|
572
584
|
const nextChild = child.M;
|
|
573
|
-
if (child.
|
|
585
|
+
if (child.l) {
|
|
574
586
|
const n = child;
|
|
575
587
|
deleteFromHeap(n, n.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
|
|
576
|
-
let toRemove = n.
|
|
588
|
+
let toRemove = n.l;
|
|
577
589
|
do {
|
|
578
590
|
toRemove = unlinkSubs(toRemove);
|
|
579
591
|
} while (toRemove !== null);
|
|
580
|
-
n.
|
|
581
|
-
n.
|
|
592
|
+
n.l = null;
|
|
593
|
+
n.F = null;
|
|
582
594
|
}
|
|
583
595
|
disposeChildren(child, true);
|
|
584
596
|
child = nextChild;
|
|
@@ -586,7 +598,7 @@ function disposeChildren(node, self = false, zombie) {
|
|
|
586
598
|
if (zombie) {
|
|
587
599
|
node.U = null;
|
|
588
600
|
} else {
|
|
589
|
-
node.
|
|
601
|
+
node.r = null;
|
|
590
602
|
node.M = null;
|
|
591
603
|
}
|
|
592
604
|
runDisposal(node, zombie);
|
|
@@ -607,16 +619,16 @@ function runDisposal(node, zombie) {
|
|
|
607
619
|
}
|
|
608
620
|
function withOptions(obj, options) {
|
|
609
621
|
obj.id = (options == null ? void 0 : options.id) ?? ((context == null ? void 0 : context.id) != null ? getNextChildId(context) : void 0);
|
|
610
|
-
obj.
|
|
611
|
-
obj.
|
|
612
|
-
obj.
|
|
613
|
-
if (options == null ? void 0 : options.
|
|
614
|
-
Object.assign(obj, options.
|
|
622
|
+
obj.fa = (options == null ? void 0 : options.equals) != null ? options.equals : isEqual;
|
|
623
|
+
obj.za = !!(options == null ? void 0 : options.pureWrite);
|
|
624
|
+
obj.ta = options == null ? void 0 : options.unobserved;
|
|
625
|
+
if (options == null ? void 0 : options.ka)
|
|
626
|
+
Object.assign(obj, options.ka);
|
|
615
627
|
return obj;
|
|
616
628
|
}
|
|
617
629
|
function getNextChildId(owner) {
|
|
618
630
|
if (owner.id != null)
|
|
619
|
-
return formatId(owner.id, owner.
|
|
631
|
+
return formatId(owner.id, owner.oa++);
|
|
620
632
|
throw new Error("Cannot get child id from owner without an id");
|
|
621
633
|
}
|
|
622
634
|
function formatId(prefix, id) {
|
|
@@ -628,21 +640,21 @@ function computed(fn, initialValue, options) {
|
|
|
628
640
|
{
|
|
629
641
|
t: null,
|
|
630
642
|
i: globalQueue,
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
643
|
+
D: defaultContext,
|
|
644
|
+
oa: 0,
|
|
645
|
+
H: fn,
|
|
634
646
|
g: initialValue,
|
|
635
647
|
c: 0,
|
|
636
|
-
|
|
648
|
+
ca: null,
|
|
637
649
|
Q: void 0,
|
|
638
650
|
z: null,
|
|
651
|
+
l: null,
|
|
652
|
+
F: null,
|
|
639
653
|
x: null,
|
|
640
|
-
I: null,
|
|
641
|
-
s: null,
|
|
642
654
|
W: null,
|
|
643
655
|
w: context,
|
|
644
656
|
M: null,
|
|
645
|
-
|
|
657
|
+
r: null,
|
|
646
658
|
b: 0 /* None */,
|
|
647
659
|
f: 4 /* Uninitialized */,
|
|
648
660
|
J: clock,
|
|
@@ -653,16 +665,16 @@ function computed(fn, initialValue, options) {
|
|
|
653
665
|
options
|
|
654
666
|
);
|
|
655
667
|
self.z = self;
|
|
656
|
-
const parent = (context == null ? void 0 : context
|
|
668
|
+
const parent = (context == null ? void 0 : context.$) ? context.aa : context;
|
|
657
669
|
if (context) {
|
|
658
670
|
context.i && (self.i = context.i);
|
|
659
|
-
context.
|
|
660
|
-
const lastChild = context.
|
|
671
|
+
context.D && (self.D = context.D);
|
|
672
|
+
const lastChild = context.r;
|
|
661
673
|
if (lastChild === null) {
|
|
662
|
-
context.
|
|
674
|
+
context.r = self;
|
|
663
675
|
} else {
|
|
664
676
|
self.M = lastChild;
|
|
665
|
-
context.
|
|
677
|
+
context.r = self;
|
|
666
678
|
}
|
|
667
679
|
}
|
|
668
680
|
if (parent)
|
|
@@ -725,7 +737,7 @@ function asyncComputed(asyncFn, initialValue, options) {
|
|
|
725
737
|
throw new NotReadyError(context);
|
|
726
738
|
};
|
|
727
739
|
const self = computed(fn, initialValue, options);
|
|
728
|
-
self.
|
|
740
|
+
self.ua = () => {
|
|
729
741
|
refreshing = true;
|
|
730
742
|
recompute(self);
|
|
731
743
|
flush();
|
|
@@ -734,13 +746,13 @@ function asyncComputed(asyncFn, initialValue, options) {
|
|
|
734
746
|
}
|
|
735
747
|
function signal(v, options, firewall = null) {
|
|
736
748
|
if (firewall !== null) {
|
|
737
|
-
return firewall.
|
|
749
|
+
return firewall.ca = withOptions(
|
|
738
750
|
{
|
|
739
751
|
g: v,
|
|
740
|
-
|
|
752
|
+
x: null,
|
|
741
753
|
W: null,
|
|
742
|
-
|
|
743
|
-
|
|
754
|
+
ia: firewall,
|
|
755
|
+
sa: firewall.ca,
|
|
744
756
|
f: 0 /* None */,
|
|
745
757
|
J: clock,
|
|
746
758
|
e: NOT_PENDING
|
|
@@ -751,7 +763,7 @@ function signal(v, options, firewall = null) {
|
|
|
751
763
|
return withOptions(
|
|
752
764
|
{
|
|
753
765
|
g: v,
|
|
754
|
-
|
|
766
|
+
x: null,
|
|
755
767
|
W: null,
|
|
756
768
|
f: 0 /* None */,
|
|
757
769
|
J: clock,
|
|
@@ -776,14 +788,14 @@ function untrack(fn) {
|
|
|
776
788
|
}
|
|
777
789
|
function read(el) {
|
|
778
790
|
let c = context;
|
|
779
|
-
if (c == null ? void 0 : c
|
|
780
|
-
c = c
|
|
791
|
+
if (c == null ? void 0 : c.$)
|
|
792
|
+
c = c.aa;
|
|
781
793
|
if (c && tracking) {
|
|
782
794
|
link(el, c);
|
|
783
|
-
const owner =
|
|
784
|
-
if (
|
|
795
|
+
const owner = el.ia || el;
|
|
796
|
+
if (owner.H) {
|
|
785
797
|
const isZombie = el.b & 32 /* Zombie */;
|
|
786
|
-
if (owner.c >= (isZombie ? zombieQueue.
|
|
798
|
+
if (owner.c >= (isZombie ? zombieQueue.q : dirtyQueue.q)) {
|
|
787
799
|
markNode(c);
|
|
788
800
|
markHeap(isZombie ? zombieQueue : dirtyQueue);
|
|
789
801
|
updateIfNecessary(owner);
|
|
@@ -796,40 +808,40 @@ function read(el) {
|
|
|
796
808
|
}
|
|
797
809
|
if (pendingCheck) {
|
|
798
810
|
const pendingResult = (el.f & 1 /* Pending */) !== 0 || !!el.T || false;
|
|
799
|
-
if (!el.
|
|
800
|
-
el.
|
|
801
|
-
el.
|
|
802
|
-
el.
|
|
811
|
+
if (!el.I) {
|
|
812
|
+
el.I = signal(pendingResult);
|
|
813
|
+
el.I.ja = true;
|
|
814
|
+
el.I.ea = (v) => setSignal(el.I, v);
|
|
803
815
|
}
|
|
804
816
|
const prev = pendingCheck;
|
|
805
817
|
pendingCheck = null;
|
|
806
|
-
read(el.
|
|
818
|
+
read(el.I);
|
|
807
819
|
pendingCheck = prev;
|
|
808
820
|
prev.g = pendingResult || prev.g;
|
|
809
821
|
}
|
|
810
822
|
if (pendingValueCheck) {
|
|
811
|
-
if (!el.
|
|
812
|
-
el.
|
|
823
|
+
if (!el.C) {
|
|
824
|
+
el.C = signal(
|
|
813
825
|
el.e === NOT_PENDING ? el.g : el.e
|
|
814
826
|
);
|
|
815
|
-
el.
|
|
816
|
-
el.
|
|
827
|
+
el.C.ja = true;
|
|
828
|
+
el.C.ea = (v) => queueMicrotask(() => queueMicrotask(() => setSignal(el.C, v)));
|
|
817
829
|
}
|
|
818
830
|
pendingValueCheck = false;
|
|
819
831
|
try {
|
|
820
|
-
return read(el.
|
|
832
|
+
return read(el.C);
|
|
821
833
|
} finally {
|
|
822
834
|
pendingValueCheck = true;
|
|
823
835
|
}
|
|
824
836
|
}
|
|
825
837
|
if (el.f & 1 /* Pending */) {
|
|
826
838
|
if (c && !stale || el.f & 4 /* Uninitialized */)
|
|
827
|
-
throw el.
|
|
839
|
+
throw el.B;
|
|
828
840
|
else if (c && stale && !pendingCheck) {
|
|
829
841
|
setStatusFlags(
|
|
830
842
|
c,
|
|
831
843
|
c.f | 1,
|
|
832
|
-
el.
|
|
844
|
+
el.B
|
|
833
845
|
);
|
|
834
846
|
}
|
|
835
847
|
}
|
|
@@ -838,7 +850,7 @@ function read(el) {
|
|
|
838
850
|
recompute(el, true);
|
|
839
851
|
return read(el);
|
|
840
852
|
} else {
|
|
841
|
-
throw el.
|
|
853
|
+
throw el.B;
|
|
842
854
|
}
|
|
843
855
|
}
|
|
844
856
|
return !c || el.e === NOT_PENDING || stale && !pendingCheck && el.T && activeTransition !== el.T ? el.g : el.e;
|
|
@@ -849,19 +861,19 @@ function setSignal(el, v) {
|
|
|
849
861
|
el.e === NOT_PENDING ? el.g : el.e
|
|
850
862
|
);
|
|
851
863
|
}
|
|
852
|
-
const valueChanged = !el.
|
|
864
|
+
const valueChanged = !el.fa || !el.fa(el.e === NOT_PENDING ? el.g : el.e, v);
|
|
853
865
|
if (!valueChanged && !el.f)
|
|
854
866
|
return v;
|
|
855
867
|
if (valueChanged) {
|
|
856
|
-
if (el.
|
|
868
|
+
if (el.ja)
|
|
857
869
|
el.g = v;
|
|
858
870
|
else {
|
|
859
871
|
if (el.e === NOT_PENDING)
|
|
860
872
|
globalQueue.h.push(el);
|
|
861
873
|
el.e = v;
|
|
862
874
|
}
|
|
863
|
-
if (el.
|
|
864
|
-
el.
|
|
875
|
+
if (el.C)
|
|
876
|
+
el.C.ea(v);
|
|
865
877
|
}
|
|
866
878
|
clearStatusFlags(el);
|
|
867
879
|
el.J = clock;
|
|
@@ -891,15 +903,15 @@ function onCleanup(fn) {
|
|
|
891
903
|
function createOwner(options) {
|
|
892
904
|
const parent = context;
|
|
893
905
|
const owner = {
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
906
|
+
$: true,
|
|
907
|
+
aa: (parent == null ? void 0 : parent.$) ? parent.aa : parent,
|
|
908
|
+
r: null,
|
|
897
909
|
M: null,
|
|
898
910
|
t: null,
|
|
899
911
|
id: (options == null ? void 0 : options.id) ?? ((parent == null ? void 0 : parent.id) != null ? getNextChildId(parent) : void 0),
|
|
900
912
|
i: (parent == null ? void 0 : parent.i) ?? globalQueue,
|
|
901
|
-
|
|
902
|
-
|
|
913
|
+
D: (parent == null ? void 0 : parent.D) || defaultContext,
|
|
914
|
+
oa: 0,
|
|
903
915
|
V: null,
|
|
904
916
|
U: null,
|
|
905
917
|
w: parent,
|
|
@@ -908,12 +920,12 @@ function createOwner(options) {
|
|
|
908
920
|
}
|
|
909
921
|
};
|
|
910
922
|
if (parent) {
|
|
911
|
-
const lastChild = parent.
|
|
923
|
+
const lastChild = parent.r;
|
|
912
924
|
if (lastChild === null) {
|
|
913
|
-
parent.
|
|
925
|
+
parent.r = owner;
|
|
914
926
|
} else {
|
|
915
927
|
owner.M = lastChild;
|
|
916
|
-
parent.
|
|
928
|
+
parent.r = owner;
|
|
917
929
|
}
|
|
918
930
|
}
|
|
919
931
|
return owner;
|
|
@@ -974,7 +986,7 @@ function getContext(context2, owner = getOwner()) {
|
|
|
974
986
|
if (!owner) {
|
|
975
987
|
throw new NoOwnerError();
|
|
976
988
|
}
|
|
977
|
-
const value = hasContext(context2, owner) ? owner.
|
|
989
|
+
const value = hasContext(context2, owner) ? owner.D[context2.id] : context2.defaultValue;
|
|
978
990
|
if (isUndefined(value)) {
|
|
979
991
|
throw new ContextNotFoundError();
|
|
980
992
|
}
|
|
@@ -984,13 +996,13 @@ function setContext(context2, value, owner = getOwner()) {
|
|
|
984
996
|
if (!owner) {
|
|
985
997
|
throw new NoOwnerError();
|
|
986
998
|
}
|
|
987
|
-
owner.
|
|
988
|
-
...owner.
|
|
999
|
+
owner.D = {
|
|
1000
|
+
...owner.D,
|
|
989
1001
|
[context2.id]: isUndefined(value) ? context2.defaultValue : value
|
|
990
1002
|
};
|
|
991
1003
|
}
|
|
992
1004
|
function hasContext(context2, owner) {
|
|
993
|
-
return !isUndefined(owner == null ? void 0 : owner.
|
|
1005
|
+
return !isUndefined(owner == null ? void 0 : owner.D[context2.id]);
|
|
994
1006
|
}
|
|
995
1007
|
function isUndefined(value) {
|
|
996
1008
|
return typeof value === "undefined";
|
|
@@ -1002,27 +1014,27 @@ function effect(compute, effect2, error, initialValue, options) {
|
|
|
1002
1014
|
let initialized = false;
|
|
1003
1015
|
const node = computed(compute, initialValue, {
|
|
1004
1016
|
...options,
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1017
|
+
ka: {
|
|
1018
|
+
ga: true,
|
|
1019
|
+
pa: initialValue,
|
|
1020
|
+
va: effect2,
|
|
1021
|
+
qa: error,
|
|
1010
1022
|
N: void 0,
|
|
1011
1023
|
i: ((_a = getOwner()) == null ? void 0 : _a.i) ?? globalQueue,
|
|
1012
1024
|
K: (options == null ? void 0 : options.render) ? 1 /* Render */ : 2 /* User */,
|
|
1013
|
-
|
|
1025
|
+
ma(statusFlagsChanged, prevStatusFlags) {
|
|
1014
1026
|
if (initialized) {
|
|
1015
1027
|
const errorChanged = this.f && this.f === prevStatusFlags && statusFlagsChanged;
|
|
1016
|
-
this.
|
|
1017
|
-
if (this.
|
|
1028
|
+
this.ga = !(this.f & 2 /* Error */) && !(this.f & 1 /* Pending */ & ~prevStatusFlags) && !errorChanged;
|
|
1029
|
+
if (this.ga)
|
|
1018
1030
|
this.i.enqueue(this.K, runEffect.bind(this));
|
|
1019
1031
|
}
|
|
1020
1032
|
if (this.f & 2 /* Error */) {
|
|
1021
|
-
let error2 = this.
|
|
1033
|
+
let error2 = this.B;
|
|
1022
1034
|
this.i.notify(this, 1 /* Pending */, 0);
|
|
1023
1035
|
if (this.K === 2 /* User */) {
|
|
1024
1036
|
try {
|
|
1025
|
-
return this.
|
|
1037
|
+
return this.qa ? this.qa(error2, () => {
|
|
1026
1038
|
var _a2;
|
|
1027
1039
|
(_a2 = this.N) == null ? void 0 : _a2.call(this);
|
|
1028
1040
|
this.N = void 0;
|
|
@@ -1045,7 +1057,7 @@ function effect(compute, effect2, error, initialValue, options) {
|
|
|
1045
1057
|
});
|
|
1046
1058
|
initialized = true;
|
|
1047
1059
|
if (node.K === 1 /* Render */)
|
|
1048
|
-
node.
|
|
1060
|
+
node.H = (p) => staleValues(() => compute(p));
|
|
1049
1061
|
!(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));
|
|
1050
1062
|
onCleanup(() => {
|
|
1051
1063
|
var _a2;
|
|
@@ -1054,18 +1066,18 @@ function effect(compute, effect2, error, initialValue, options) {
|
|
|
1054
1066
|
}
|
|
1055
1067
|
function runEffect() {
|
|
1056
1068
|
var _a;
|
|
1057
|
-
if (!this.
|
|
1069
|
+
if (!this.ga || this.b & 64 /* Disposed */)
|
|
1058
1070
|
return;
|
|
1059
1071
|
(_a = this.N) == null ? void 0 : _a.call(this);
|
|
1060
1072
|
this.N = void 0;
|
|
1061
1073
|
try {
|
|
1062
|
-
this.N = this.
|
|
1074
|
+
this.N = this.va(this.g, this.pa);
|
|
1063
1075
|
} catch (error) {
|
|
1064
1076
|
if (!this.i.notify(this, 2 /* Error */, 2 /* Error */))
|
|
1065
1077
|
throw error;
|
|
1066
1078
|
} finally {
|
|
1067
|
-
this.
|
|
1068
|
-
this.
|
|
1079
|
+
this.pa = this.g;
|
|
1080
|
+
this.ga = false;
|
|
1069
1081
|
}
|
|
1070
1082
|
}
|
|
1071
1083
|
|
|
@@ -1096,7 +1108,7 @@ function createMemo(compute, value, options) {
|
|
|
1096
1108
|
function createAsync(compute, value, options) {
|
|
1097
1109
|
const node = asyncComputed(compute, value, options);
|
|
1098
1110
|
const ret = read.bind(null, node);
|
|
1099
|
-
ret.refresh = node.
|
|
1111
|
+
ret.refresh = node.ua;
|
|
1100
1112
|
return ret;
|
|
1101
1113
|
}
|
|
1102
1114
|
function createEffect(compute, effectFn, value, options) {
|
|
@@ -1116,11 +1128,30 @@ function createRenderEffect(compute, effectFn, value, options) {
|
|
|
1116
1128
|
}
|
|
1117
1129
|
function createTrackedEffect(compute, options) {
|
|
1118
1130
|
}
|
|
1119
|
-
function createReaction(
|
|
1131
|
+
function createReaction(effectFn, options) {
|
|
1132
|
+
let cleanup = void 0;
|
|
1133
|
+
onCleanup(() => cleanup == null ? void 0 : cleanup());
|
|
1134
|
+
return (tracking2) => {
|
|
1135
|
+
effect(
|
|
1136
|
+
() => (tracking2(), getOwner()),
|
|
1137
|
+
(node) => {
|
|
1138
|
+
var _a;
|
|
1139
|
+
cleanup == null ? void 0 : cleanup();
|
|
1140
|
+
cleanup = (_a = effectFn.effect || effectFn) == null ? void 0 : _a();
|
|
1141
|
+
dispose(node);
|
|
1142
|
+
},
|
|
1143
|
+
effectFn.error,
|
|
1144
|
+
void 0,
|
|
1145
|
+
{
|
|
1146
|
+
defer: true,
|
|
1147
|
+
...options
|
|
1148
|
+
}
|
|
1149
|
+
);
|
|
1150
|
+
};
|
|
1120
1151
|
}
|
|
1121
1152
|
function resolve(fn) {
|
|
1122
1153
|
return new Promise((res, rej) => {
|
|
1123
|
-
createRoot((
|
|
1154
|
+
createRoot((dispose2) => {
|
|
1124
1155
|
computed(() => {
|
|
1125
1156
|
try {
|
|
1126
1157
|
res(fn());
|
|
@@ -1129,7 +1160,7 @@ function resolve(fn) {
|
|
|
1129
1160
|
throw err;
|
|
1130
1161
|
rej(err);
|
|
1131
1162
|
}
|
|
1132
|
-
|
|
1163
|
+
dispose2();
|
|
1133
1164
|
});
|
|
1134
1165
|
});
|
|
1135
1166
|
});
|
|
@@ -1138,6 +1169,14 @@ function createOptimistic(first, second, third) {
|
|
|
1138
1169
|
return {};
|
|
1139
1170
|
}
|
|
1140
1171
|
function onSettled(callback) {
|
|
1172
|
+
let cleanup;
|
|
1173
|
+
const o = getOwner();
|
|
1174
|
+
if (o)
|
|
1175
|
+
onCleanup(() => cleanup == null ? void 0 : cleanup());
|
|
1176
|
+
globalQueue.enqueue(2 /* User */, () => {
|
|
1177
|
+
cleanup = callback();
|
|
1178
|
+
!o && (cleanup == null ? void 0 : cleanup());
|
|
1179
|
+
});
|
|
1141
1180
|
}
|
|
1142
1181
|
|
|
1143
1182
|
// src/store/reconcile.ts
|
|
@@ -1274,24 +1313,18 @@ function reconcile(value, key, all = false) {
|
|
|
1274
1313
|
function createProjectionInternal(fn, initialValue = {}, options) {
|
|
1275
1314
|
let node;
|
|
1276
1315
|
const wrappedMap = /* @__PURE__ */ new WeakMap();
|
|
1277
|
-
const traps = {
|
|
1278
|
-
...storeTraps,
|
|
1279
|
-
get(target, property, receiver) {
|
|
1280
|
-
const o = getOwner();
|
|
1281
|
-
const n = node;
|
|
1282
|
-
(!o || o !== n) && n && read(n);
|
|
1283
|
-
return storeTraps.get(target, property, receiver);
|
|
1284
|
-
}
|
|
1285
|
-
};
|
|
1286
1316
|
const wrapProjection = (source) => {
|
|
1287
1317
|
var _a;
|
|
1288
1318
|
if (wrappedMap.has(source))
|
|
1289
1319
|
return wrappedMap.get(source);
|
|
1290
1320
|
if (((_a = source[$TARGET]) == null ? void 0 : _a[STORE_WRAP]) === wrapProjection)
|
|
1291
1321
|
return source;
|
|
1292
|
-
const wrapped = createStoreProxy(source,
|
|
1322
|
+
const wrapped = createStoreProxy(source, storeTraps, {
|
|
1293
1323
|
[STORE_WRAP]: wrapProjection,
|
|
1294
|
-
[STORE_LOOKUP]: wrappedMap
|
|
1324
|
+
[STORE_LOOKUP]: wrappedMap,
|
|
1325
|
+
[STORE_FIREWALL]() {
|
|
1326
|
+
return node;
|
|
1327
|
+
}
|
|
1295
1328
|
});
|
|
1296
1329
|
wrappedMap.set(source, wrapped);
|
|
1297
1330
|
return wrapped;
|
|
@@ -1324,6 +1357,7 @@ var STORE_NODE = "n";
|
|
|
1324
1357
|
var STORE_HAS = "h";
|
|
1325
1358
|
var STORE_WRAP = "w";
|
|
1326
1359
|
var STORE_LOOKUP = "l";
|
|
1360
|
+
var STORE_FIREWALL = "f";
|
|
1327
1361
|
function createStoreProxy(value, traps = storeTraps, extend) {
|
|
1328
1362
|
let newTarget;
|
|
1329
1363
|
if (Array.isArray(value)) {
|
|
@@ -1352,18 +1386,25 @@ function getNodes(target, type) {
|
|
|
1352
1386
|
target[type] = nodes = /* @__PURE__ */ Object.create(null);
|
|
1353
1387
|
return nodes;
|
|
1354
1388
|
}
|
|
1355
|
-
function getNode(nodes, property, value, equals = isEqual) {
|
|
1389
|
+
function getNode(nodes, property, value, firewall, equals = isEqual) {
|
|
1356
1390
|
if (nodes[property])
|
|
1357
1391
|
return nodes[property];
|
|
1358
|
-
return nodes[property] = signal(
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1392
|
+
return nodes[property] = signal(
|
|
1393
|
+
value,
|
|
1394
|
+
{
|
|
1395
|
+
equals,
|
|
1396
|
+
unobserved() {
|
|
1397
|
+
delete nodes[property];
|
|
1398
|
+
}
|
|
1399
|
+
},
|
|
1400
|
+
firewall
|
|
1401
|
+
);
|
|
1364
1402
|
}
|
|
1365
1403
|
function trackSelf(target, symbol = $TRACK) {
|
|
1366
|
-
|
|
1404
|
+
var _a;
|
|
1405
|
+
getObserver() && read(
|
|
1406
|
+
getNode(getNodes(target, STORE_NODE), symbol, void 0, (_a = target[STORE_FIREWALL]) == null ? void 0 : _a.call(target), false)
|
|
1407
|
+
);
|
|
1367
1408
|
}
|
|
1368
1409
|
function getKeys(source, override, enumerable = true) {
|
|
1369
1410
|
const baseKeys = untrack(() => enumerable ? Object.keys(source) : Reflect.ownKeys(source));
|
|
@@ -1392,6 +1433,7 @@ function getPropertyDescriptor(source, override, property) {
|
|
|
1392
1433
|
var Writing = null;
|
|
1393
1434
|
var storeTraps = {
|
|
1394
1435
|
get(target, property, receiver) {
|
|
1436
|
+
var _a;
|
|
1395
1437
|
if (property === $TARGET)
|
|
1396
1438
|
return target;
|
|
1397
1439
|
if (property === $PROXY)
|
|
@@ -1426,16 +1468,24 @@ var storeTraps = {
|
|
|
1426
1468
|
let proto;
|
|
1427
1469
|
return !Array.isArray(target[STORE_VALUE]) && (proto = Object.getPrototypeOf(target[STORE_VALUE])) && proto !== Object.prototype ? value.bind(storeValue) : value;
|
|
1428
1470
|
} else if (getObserver()) {
|
|
1429
|
-
return read(
|
|
1471
|
+
return read(
|
|
1472
|
+
getNode(
|
|
1473
|
+
nodes,
|
|
1474
|
+
property,
|
|
1475
|
+
isWrappable(value) ? wrap(value, target) : value,
|
|
1476
|
+
(_a = target[STORE_FIREWALL]) == null ? void 0 : _a.call(target)
|
|
1477
|
+
)
|
|
1478
|
+
);
|
|
1430
1479
|
}
|
|
1431
1480
|
}
|
|
1432
1481
|
return isWrappable(value) ? wrap(value, target) : value;
|
|
1433
1482
|
},
|
|
1434
1483
|
has(target, property) {
|
|
1484
|
+
var _a;
|
|
1435
1485
|
if (property === $PROXY || property === $TRACK || property === "__proto__")
|
|
1436
1486
|
return true;
|
|
1437
1487
|
const has = target[STORE_OVERRIDE] && property in target[STORE_OVERRIDE] ? target[STORE_OVERRIDE][property] !== $DELETED : property in target[STORE_VALUE];
|
|
1438
|
-
getObserver() && read(getNode(getNodes(target, STORE_HAS), property, has));
|
|
1488
|
+
getObserver() && read(getNode(getNodes(target, STORE_HAS), property, has, (_a = target[STORE_FIREWALL]) == null ? void 0 : _a.call(target)));
|
|
1439
1489
|
return has;
|
|
1440
1490
|
},
|
|
1441
1491
|
set(target, property, rawValue) {
|
|
@@ -1815,60 +1865,60 @@ function mapArray(list, map, options) {
|
|
|
1815
1865
|
const keyFn = typeof (options == null ? void 0 : options.keyed) === "function" ? options.keyed : void 0;
|
|
1816
1866
|
return createMemo(
|
|
1817
1867
|
updateKeyedMap.bind({
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1868
|
+
X: createOwner(),
|
|
1869
|
+
n: 0,
|
|
1870
|
+
wa: list,
|
|
1821
1871
|
G: [],
|
|
1822
1872
|
O: map,
|
|
1823
1873
|
d: [],
|
|
1824
1874
|
a: [],
|
|
1825
1875
|
P: keyFn,
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1876
|
+
o: keyFn || (options == null ? void 0 : options.keyed) === false ? [] : void 0,
|
|
1877
|
+
p: map.length > 1 ? [] : void 0,
|
|
1878
|
+
Y: options == null ? void 0 : options.fallback
|
|
1829
1879
|
})
|
|
1830
1880
|
);
|
|
1831
1881
|
}
|
|
1832
1882
|
var pureOptions = { pureWrite: true };
|
|
1833
1883
|
function updateKeyedMap() {
|
|
1834
|
-
const newItems = this.
|
|
1884
|
+
const newItems = this.wa() || [], newLen = newItems.length;
|
|
1835
1885
|
newItems[$TRACK];
|
|
1836
|
-
runWithOwner(this.
|
|
1837
|
-
let i, j, mapper = this.
|
|
1838
|
-
this.
|
|
1839
|
-
this.
|
|
1886
|
+
runWithOwner(this.X, () => {
|
|
1887
|
+
let i, j, mapper = this.o ? () => {
|
|
1888
|
+
this.o[j] = signal(newItems[j], pureOptions);
|
|
1889
|
+
this.p && (this.p[j] = signal(j, pureOptions));
|
|
1840
1890
|
return this.O(
|
|
1841
|
-
read.bind(null, this.
|
|
1842
|
-
this.
|
|
1891
|
+
read.bind(null, this.o[j]),
|
|
1892
|
+
this.p ? read.bind(null, this.p[j]) : void 0
|
|
1843
1893
|
);
|
|
1844
|
-
} : this.
|
|
1894
|
+
} : this.p ? () => {
|
|
1845
1895
|
const item = newItems[j];
|
|
1846
|
-
this.
|
|
1896
|
+
this.p[j] = signal(j, pureOptions);
|
|
1847
1897
|
return this.O(
|
|
1848
1898
|
() => item,
|
|
1849
|
-
read.bind(null, this.
|
|
1899
|
+
read.bind(null, this.p[j])
|
|
1850
1900
|
);
|
|
1851
1901
|
} : () => {
|
|
1852
1902
|
const item = newItems[j];
|
|
1853
1903
|
return this.O(() => item);
|
|
1854
1904
|
};
|
|
1855
1905
|
if (newLen === 0) {
|
|
1856
|
-
if (this.
|
|
1857
|
-
this.
|
|
1906
|
+
if (this.n !== 0) {
|
|
1907
|
+
this.X.dispose(false);
|
|
1858
1908
|
this.a = [];
|
|
1859
1909
|
this.G = [];
|
|
1860
1910
|
this.d = [];
|
|
1861
|
-
this.
|
|
1862
|
-
this.n && (this.n = []);
|
|
1911
|
+
this.n = 0;
|
|
1863
1912
|
this.o && (this.o = []);
|
|
1913
|
+
this.p && (this.p = []);
|
|
1864
1914
|
}
|
|
1865
|
-
if (this.
|
|
1915
|
+
if (this.Y && !this.d[0]) {
|
|
1866
1916
|
this.d[0] = runWithOwner(
|
|
1867
1917
|
this.a[0] = createOwner(),
|
|
1868
|
-
this.
|
|
1918
|
+
this.Y
|
|
1869
1919
|
);
|
|
1870
1920
|
}
|
|
1871
|
-
} else if (this.
|
|
1921
|
+
} else if (this.n === 0) {
|
|
1872
1922
|
if (this.a[0])
|
|
1873
1923
|
this.a[0].dispose();
|
|
1874
1924
|
this.d = new Array(newLen);
|
|
@@ -1876,18 +1926,18 @@ function updateKeyedMap() {
|
|
|
1876
1926
|
this.G[j] = newItems[j];
|
|
1877
1927
|
this.d[j] = runWithOwner(this.a[j] = createOwner(), mapper);
|
|
1878
1928
|
}
|
|
1879
|
-
this.
|
|
1929
|
+
this.n = newLen;
|
|
1880
1930
|
} else {
|
|
1881
|
-
let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.
|
|
1882
|
-
for (start = 0, end = Math.min(this.
|
|
1883
|
-
if (this.
|
|
1884
|
-
setSignal(this.
|
|
1931
|
+
let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.o ? new Array(newLen) : void 0, tempIndexes = this.p ? new Array(newLen) : void 0;
|
|
1932
|
+
for (start = 0, end = Math.min(this.n, newLen); start < end && (this.G[start] === newItems[start] || this.o && compare(this.P, this.G[start], newItems[start])); start++) {
|
|
1933
|
+
if (this.o)
|
|
1934
|
+
setSignal(this.o[start], newItems[start]);
|
|
1885
1935
|
}
|
|
1886
|
-
for (end = this.
|
|
1936
|
+
for (end = this.n - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.G[end] === newItems[newEnd] || this.o && compare(this.P, this.G[end], newItems[newEnd])); end--, newEnd--) {
|
|
1887
1937
|
temp[newEnd] = this.d[end];
|
|
1888
1938
|
tempNodes[newEnd] = this.a[end];
|
|
1889
|
-
tempRows && (tempRows[newEnd] = this.
|
|
1890
|
-
tempIndexes && (tempIndexes[newEnd] = this.
|
|
1939
|
+
tempRows && (tempRows[newEnd] = this.o[end]);
|
|
1940
|
+
tempIndexes && (tempIndexes[newEnd] = this.p[end]);
|
|
1891
1941
|
}
|
|
1892
1942
|
newIndices = /* @__PURE__ */ new Map();
|
|
1893
1943
|
newIndicesNext = new Array(newEnd + 1);
|
|
@@ -1905,8 +1955,8 @@ function updateKeyedMap() {
|
|
|
1905
1955
|
if (j !== void 0 && j !== -1) {
|
|
1906
1956
|
temp[j] = this.d[i];
|
|
1907
1957
|
tempNodes[j] = this.a[i];
|
|
1908
|
-
tempRows && (tempRows[j] = this.
|
|
1909
|
-
tempIndexes && (tempIndexes[j] = this.
|
|
1958
|
+
tempRows && (tempRows[j] = this.o[i]);
|
|
1959
|
+
tempIndexes && (tempIndexes[j] = this.p[i]);
|
|
1910
1960
|
j = newIndicesNext[j];
|
|
1911
1961
|
newIndices.set(key, j);
|
|
1912
1962
|
} else
|
|
@@ -1917,18 +1967,18 @@ function updateKeyedMap() {
|
|
|
1917
1967
|
this.d[j] = temp[j];
|
|
1918
1968
|
this.a[j] = tempNodes[j];
|
|
1919
1969
|
if (tempRows) {
|
|
1920
|
-
this.
|
|
1921
|
-
setSignal(this.
|
|
1970
|
+
this.o[j] = tempRows[j];
|
|
1971
|
+
setSignal(this.o[j], newItems[j]);
|
|
1922
1972
|
}
|
|
1923
1973
|
if (tempIndexes) {
|
|
1924
|
-
this.
|
|
1925
|
-
setSignal(this.
|
|
1974
|
+
this.p[j] = tempIndexes[j];
|
|
1975
|
+
setSignal(this.p[j], j);
|
|
1926
1976
|
}
|
|
1927
1977
|
} else {
|
|
1928
1978
|
this.d[j] = runWithOwner(this.a[j] = createOwner(), mapper);
|
|
1929
1979
|
}
|
|
1930
1980
|
}
|
|
1931
|
-
this.d = this.d.slice(0, this.
|
|
1981
|
+
this.d = this.d.slice(0, this.n = newLen);
|
|
1932
1982
|
this.G = newItems.slice(0);
|
|
1933
1983
|
}
|
|
1934
1984
|
});
|
|
@@ -1936,46 +1986,46 @@ function updateKeyedMap() {
|
|
|
1936
1986
|
}
|
|
1937
1987
|
function repeat(count, map, options) {
|
|
1938
1988
|
return updateRepeat.bind({
|
|
1939
|
-
|
|
1940
|
-
|
|
1989
|
+
X: createOwner(),
|
|
1990
|
+
n: 0,
|
|
1941
1991
|
y: 0,
|
|
1942
|
-
|
|
1992
|
+
xa: count,
|
|
1943
1993
|
O: map,
|
|
1944
1994
|
a: [],
|
|
1945
1995
|
d: [],
|
|
1946
|
-
|
|
1947
|
-
|
|
1996
|
+
ya: options == null ? void 0 : options.from,
|
|
1997
|
+
Y: options == null ? void 0 : options.fallback
|
|
1948
1998
|
});
|
|
1949
1999
|
}
|
|
1950
2000
|
function updateRepeat() {
|
|
1951
2001
|
var _a;
|
|
1952
|
-
const newLen = this.
|
|
1953
|
-
const from = ((_a = this.
|
|
1954
|
-
runWithOwner(this.
|
|
2002
|
+
const newLen = this.xa();
|
|
2003
|
+
const from = ((_a = this.ya) == null ? void 0 : _a.call(this)) || 0;
|
|
2004
|
+
runWithOwner(this.X, () => {
|
|
1955
2005
|
if (newLen === 0) {
|
|
1956
|
-
if (this.
|
|
1957
|
-
this.
|
|
2006
|
+
if (this.n !== 0) {
|
|
2007
|
+
this.X.dispose(false);
|
|
1958
2008
|
this.a = [];
|
|
1959
2009
|
this.d = [];
|
|
1960
|
-
this.
|
|
2010
|
+
this.n = 0;
|
|
1961
2011
|
}
|
|
1962
|
-
if (this.
|
|
2012
|
+
if (this.Y && !this.d[0]) {
|
|
1963
2013
|
this.d[0] = runWithOwner(
|
|
1964
2014
|
this.a[0] = createOwner(),
|
|
1965
|
-
this.
|
|
2015
|
+
this.Y
|
|
1966
2016
|
);
|
|
1967
2017
|
}
|
|
1968
2018
|
return;
|
|
1969
2019
|
}
|
|
1970
2020
|
const to = from + newLen;
|
|
1971
|
-
const prevTo = this.y + this.
|
|
1972
|
-
if (this.
|
|
2021
|
+
const prevTo = this.y + this.n;
|
|
2022
|
+
if (this.n === 0 && this.a[0])
|
|
1973
2023
|
this.a[0].dispose();
|
|
1974
2024
|
for (let i = to; i < prevTo; i++)
|
|
1975
2025
|
this.a[i - this.y].dispose();
|
|
1976
2026
|
if (this.y < from) {
|
|
1977
2027
|
let i = this.y;
|
|
1978
|
-
while (i < from && i < this.
|
|
2028
|
+
while (i < from && i < this.n)
|
|
1979
2029
|
this.a[i++].dispose();
|
|
1980
2030
|
this.a.splice(0, from - this.y);
|
|
1981
2031
|
this.d.splice(0, from - this.y);
|
|
@@ -2003,7 +2053,7 @@ function updateRepeat() {
|
|
|
2003
2053
|
}
|
|
2004
2054
|
this.d = this.d.slice(0, newLen);
|
|
2005
2055
|
this.y = from;
|
|
2006
|
-
this.
|
|
2056
|
+
this.n = newLen;
|
|
2007
2057
|
});
|
|
2008
2058
|
return this.d;
|
|
2009
2059
|
}
|
|
@@ -2014,19 +2064,19 @@ function compare(key, a, b) {
|
|
|
2014
2064
|
// src/boundaries.ts
|
|
2015
2065
|
function boundaryComputed(fn, propagationMask) {
|
|
2016
2066
|
const node = computed(fn, void 0, {
|
|
2017
|
-
|
|
2018
|
-
|
|
2067
|
+
ka: {
|
|
2068
|
+
ma() {
|
|
2019
2069
|
let flags = this.f;
|
|
2020
|
-
this.f &= ~this.
|
|
2021
|
-
if (this.
|
|
2070
|
+
this.f &= ~this.Z;
|
|
2071
|
+
if (this.Z & 1 /* Pending */ && !(this.f & 4 /* Uninitialized */)) {
|
|
2022
2072
|
flags &= ~1 /* Pending */;
|
|
2023
2073
|
}
|
|
2024
|
-
this.i.notify(this, this.
|
|
2074
|
+
this.i.notify(this, this.Z, flags);
|
|
2025
2075
|
},
|
|
2026
|
-
|
|
2076
|
+
Z: propagationMask
|
|
2027
2077
|
}
|
|
2028
2078
|
});
|
|
2029
|
-
node.
|
|
2079
|
+
node.Z = propagationMask;
|
|
2030
2080
|
return node;
|
|
2031
2081
|
}
|
|
2032
2082
|
function createBoundChildren(owner, fn, queue, mask) {
|
|
@@ -2040,7 +2090,7 @@ function createBoundChildren(owner, fn, queue, mask) {
|
|
|
2040
2090
|
}
|
|
2041
2091
|
var ConditionalQueue = class extends Queue {
|
|
2042
2092
|
u;
|
|
2043
|
-
|
|
2093
|
+
ha = /* @__PURE__ */ new Set();
|
|
2044
2094
|
h = /* @__PURE__ */ new Set();
|
|
2045
2095
|
constructor(disabled) {
|
|
2046
2096
|
super();
|
|
@@ -2062,9 +2112,9 @@ var ConditionalQueue = class extends Queue {
|
|
|
2062
2112
|
}
|
|
2063
2113
|
if (type & 2 /* Error */) {
|
|
2064
2114
|
if (flags & 2 /* Error */) {
|
|
2065
|
-
this.
|
|
2115
|
+
this.ha.add(node);
|
|
2066
2116
|
type &= ~2 /* Error */;
|
|
2067
|
-
} else if (this.
|
|
2117
|
+
} else if (this.ha.delete(node))
|
|
2068
2118
|
type &= ~2 /* Error */;
|
|
2069
2119
|
}
|
|
2070
2120
|
}
|
|
@@ -2072,13 +2122,13 @@ var ConditionalQueue = class extends Queue {
|
|
|
2072
2122
|
}
|
|
2073
2123
|
};
|
|
2074
2124
|
var CollectionQueue = class extends Queue {
|
|
2075
|
-
|
|
2125
|
+
_;
|
|
2076
2126
|
a = /* @__PURE__ */ new Set();
|
|
2077
2127
|
u = signal(false, { pureWrite: true });
|
|
2078
|
-
|
|
2128
|
+
ra = false;
|
|
2079
2129
|
constructor(type) {
|
|
2080
2130
|
super();
|
|
2081
|
-
this.
|
|
2131
|
+
this._ = type;
|
|
2082
2132
|
}
|
|
2083
2133
|
run(type) {
|
|
2084
2134
|
if (!type || read(this.u))
|
|
@@ -2086,9 +2136,9 @@ var CollectionQueue = class extends Queue {
|
|
|
2086
2136
|
return super.run(type);
|
|
2087
2137
|
}
|
|
2088
2138
|
notify(node, type, flags) {
|
|
2089
|
-
if (!(type & this.
|
|
2139
|
+
if (!(type & this._) || this._ & 1 /* Pending */ && this.ra)
|
|
2090
2140
|
return super.notify(node, type, flags);
|
|
2091
|
-
if (flags & this.
|
|
2141
|
+
if (flags & this._) {
|
|
2092
2142
|
this.a.add(node);
|
|
2093
2143
|
if (this.a.size === 1)
|
|
2094
2144
|
setSignal(this.u, true);
|
|
@@ -2097,7 +2147,7 @@ var CollectionQueue = class extends Queue {
|
|
|
2097
2147
|
if (this.a.size === 0)
|
|
2098
2148
|
setSignal(this.u, false);
|
|
2099
2149
|
}
|
|
2100
|
-
type &= ~this.
|
|
2150
|
+
type &= ~this._;
|
|
2101
2151
|
return type ? super.notify(node, type, flags) : true;
|
|
2102
2152
|
}
|
|
2103
2153
|
};
|
|
@@ -2107,14 +2157,14 @@ function createBoundary(fn, condition) {
|
|
|
2107
2157
|
const tree = createBoundChildren(owner, fn, queue, 0);
|
|
2108
2158
|
computed(() => {
|
|
2109
2159
|
const disabled = read(queue.u);
|
|
2110
|
-
tree.
|
|
2160
|
+
tree.Z = disabled ? 2 /* Error */ | 1 /* Pending */ : 0;
|
|
2111
2161
|
if (!disabled) {
|
|
2112
2162
|
queue.h.forEach(
|
|
2113
2163
|
(node) => queue.notify(node, 1 /* Pending */, 1 /* Pending */)
|
|
2114
2164
|
);
|
|
2115
|
-
queue.
|
|
2165
|
+
queue.ha.forEach((node) => queue.notify(node, 2 /* Error */, 2 /* Error */));
|
|
2116
2166
|
queue.h.clear();
|
|
2117
|
-
queue.
|
|
2167
|
+
queue.ha.clear();
|
|
2118
2168
|
}
|
|
2119
2169
|
});
|
|
2120
2170
|
return () => read(queue.u) ? void 0 : read(tree);
|
|
@@ -2127,7 +2177,7 @@ function createCollectionBoundary(type, fn, fallback) {
|
|
|
2127
2177
|
if (!read(queue.u)) {
|
|
2128
2178
|
const resolved = read(tree);
|
|
2129
2179
|
if (!untrack(() => read(queue.u)))
|
|
2130
|
-
queue.
|
|
2180
|
+
queue.ra = true;
|
|
2131
2181
|
return resolved;
|
|
2132
2182
|
}
|
|
2133
2183
|
return fallback(queue);
|
|
@@ -2140,7 +2190,7 @@ function createLoadBoundary(fn, fallback) {
|
|
|
2140
2190
|
function createErrorBoundary(fn, fallback) {
|
|
2141
2191
|
return createCollectionBoundary(2 /* Error */, fn, (queue) => {
|
|
2142
2192
|
let node = queue.a.values().next().value;
|
|
2143
|
-
return fallback(node.
|
|
2193
|
+
return fallback(node.B, () => {
|
|
2144
2194
|
for (let node2 of queue.a) {
|
|
2145
2195
|
recompute(node2, true);
|
|
2146
2196
|
}
|