@solidjs/signals 0.6.1 → 0.6.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 +21 -19
- package/dist/node.cjs +229 -227
- package/dist/prod.js +228 -226
- package/dist/types/core/scheduler.d.ts +2 -1
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -45,7 +45,7 @@ function schedule() {
|
|
|
45
45
|
if (scheduled)
|
|
46
46
|
return;
|
|
47
47
|
scheduled = true;
|
|
48
|
-
if (!globalQueue.
|
|
48
|
+
if (!globalQueue.A)
|
|
49
49
|
queueMicrotask(flush);
|
|
50
50
|
}
|
|
51
51
|
function notifyUnobserved() {
|
|
@@ -59,13 +59,11 @@ function notifyUnobserved() {
|
|
|
59
59
|
var pureQueue = [];
|
|
60
60
|
var Queue = class {
|
|
61
61
|
k = null;
|
|
62
|
-
|
|
62
|
+
A = false;
|
|
63
63
|
g = [[], []];
|
|
64
64
|
f = [];
|
|
65
65
|
created = clock;
|
|
66
66
|
enqueue(type, fn) {
|
|
67
|
-
if (ActiveTransition && ActiveTransition.p.has(this))
|
|
68
|
-
return ActiveTransition.p.get(this).enqueue(type, fn);
|
|
69
67
|
pureQueue.push(fn);
|
|
70
68
|
if (type)
|
|
71
69
|
this.g[type - 1].push(fn);
|
|
@@ -86,9 +84,9 @@ var Queue = class {
|
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
86
|
flush() {
|
|
89
|
-
if (this.
|
|
87
|
+
if (this.A)
|
|
90
88
|
return;
|
|
91
|
-
this.
|
|
89
|
+
this.A = true;
|
|
92
90
|
try {
|
|
93
91
|
this.run(EFFECT_PURE);
|
|
94
92
|
incrementClock();
|
|
@@ -96,19 +94,19 @@ var Queue = class {
|
|
|
96
94
|
this.run(EFFECT_RENDER);
|
|
97
95
|
this.run(EFFECT_USER);
|
|
98
96
|
} finally {
|
|
99
|
-
this.
|
|
97
|
+
this.A = false;
|
|
100
98
|
Unobserved.length && notifyUnobserved();
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
addChild(child) {
|
|
104
|
-
if (ActiveTransition && ActiveTransition.
|
|
105
|
-
return ActiveTransition.
|
|
102
|
+
if (ActiveTransition && ActiveTransition.r.has(this))
|
|
103
|
+
return ActiveTransition.r.get(this).addChild(child);
|
|
106
104
|
this.f.push(child);
|
|
107
105
|
child.k = this;
|
|
108
106
|
}
|
|
109
107
|
removeChild(child) {
|
|
110
|
-
if (ActiveTransition && ActiveTransition.
|
|
111
|
-
return ActiveTransition.
|
|
108
|
+
if (ActiveTransition && ActiveTransition.r.has(this))
|
|
109
|
+
return ActiveTransition.r.get(this).removeChild(child);
|
|
112
110
|
const index = this.f.indexOf(child);
|
|
113
111
|
if (index >= 0) {
|
|
114
112
|
this.f.splice(index, 1);
|
|
@@ -116,8 +114,6 @@ var Queue = class {
|
|
|
116
114
|
}
|
|
117
115
|
}
|
|
118
116
|
notify(...args) {
|
|
119
|
-
if (ActiveTransition && ActiveTransition.p.has(this))
|
|
120
|
-
return ActiveTransition.p.get(this).notify(...args);
|
|
121
117
|
if (this.k)
|
|
122
118
|
return this.k.notify(...args);
|
|
123
119
|
return false;
|
|
@@ -161,35 +157,35 @@ function runQueue(queue, type) {
|
|
|
161
157
|
}
|
|
162
158
|
var Transition = class _Transition {
|
|
163
159
|
a = /* @__PURE__ */ new Map();
|
|
164
|
-
|
|
165
|
-
|
|
160
|
+
s = /* @__PURE__ */ new Set();
|
|
161
|
+
H = /* @__PURE__ */ new Set();
|
|
166
162
|
W = /* @__PURE__ */ new Set();
|
|
167
|
-
|
|
163
|
+
u = false;
|
|
168
164
|
g = [[], []];
|
|
169
|
-
|
|
170
|
-
|
|
165
|
+
r = /* @__PURE__ */ new Map();
|
|
166
|
+
I = [];
|
|
171
167
|
f = [];
|
|
172
168
|
k = null;
|
|
173
|
-
|
|
169
|
+
A = false;
|
|
174
170
|
X = false;
|
|
175
171
|
e = globalQueue;
|
|
176
172
|
created = clock;
|
|
177
173
|
constructor() {
|
|
178
|
-
this.
|
|
174
|
+
this.r.set(globalQueue, this);
|
|
179
175
|
for (const child of globalQueue.f) {
|
|
180
|
-
cloneQueue(child, this, this.
|
|
176
|
+
cloneQueue(child, this, this.r);
|
|
181
177
|
}
|
|
182
178
|
}
|
|
183
179
|
enqueue(type, fn) {
|
|
184
|
-
this.
|
|
180
|
+
this.I.push(fn);
|
|
185
181
|
if (type)
|
|
186
182
|
this.g[type - 1].push(fn);
|
|
187
183
|
this.schedule();
|
|
188
184
|
}
|
|
189
185
|
run(type) {
|
|
190
186
|
if (type === EFFECT_PURE) {
|
|
191
|
-
this.
|
|
192
|
-
this.
|
|
187
|
+
this.I.length && runQueue(this.I, type);
|
|
188
|
+
this.I = [];
|
|
193
189
|
return;
|
|
194
190
|
} else if (this.g[type - 1].length) {
|
|
195
191
|
const effects = this.g[type - 1];
|
|
@@ -201,9 +197,9 @@ var Transition = class _Transition {
|
|
|
201
197
|
}
|
|
202
198
|
}
|
|
203
199
|
flush() {
|
|
204
|
-
if (this.
|
|
200
|
+
if (this.A)
|
|
205
201
|
return;
|
|
206
|
-
this.
|
|
202
|
+
this.A = true;
|
|
207
203
|
let currentTransition = ActiveTransition;
|
|
208
204
|
ActiveTransition = this;
|
|
209
205
|
try {
|
|
@@ -213,7 +209,7 @@ var Transition = class _Transition {
|
|
|
213
209
|
ActiveTransition = currentTransition;
|
|
214
210
|
finishTransition(this);
|
|
215
211
|
} finally {
|
|
216
|
-
this.
|
|
212
|
+
this.A = false;
|
|
217
213
|
ActiveTransition = currentTransition;
|
|
218
214
|
}
|
|
219
215
|
}
|
|
@@ -230,16 +226,16 @@ var Transition = class _Transition {
|
|
|
230
226
|
if (!(type & LOADING_BIT))
|
|
231
227
|
return false;
|
|
232
228
|
if (flags & LOADING_BIT) {
|
|
233
|
-
this.
|
|
229
|
+
this.s.add(node);
|
|
234
230
|
} else {
|
|
235
|
-
this.
|
|
231
|
+
this.s.delete(node);
|
|
236
232
|
}
|
|
237
233
|
return true;
|
|
238
234
|
}
|
|
239
235
|
merge(queue) {
|
|
240
236
|
this.g[0].push.apply(this.g[0], queue.g[0]);
|
|
241
237
|
this.g[1].push.apply(this.g[1], queue.g[1]);
|
|
242
|
-
this.
|
|
238
|
+
this.I.push.apply(this.I, queue.I);
|
|
243
239
|
for (let i = 0; i < queue.f.length; i++) {
|
|
244
240
|
const og = this.f.find((c) => c.e === queue.f[i].e);
|
|
245
241
|
if (og)
|
|
@@ -252,13 +248,13 @@ var Transition = class _Transition {
|
|
|
252
248
|
if (this.X)
|
|
253
249
|
return;
|
|
254
250
|
this.X = true;
|
|
255
|
-
if (!this.
|
|
251
|
+
if (!this.A)
|
|
256
252
|
queueMicrotask(() => this.flush());
|
|
257
253
|
}
|
|
258
254
|
runTransition(fn, force = false) {
|
|
259
|
-
if (this.
|
|
260
|
-
if (this.
|
|
261
|
-
return this.
|
|
255
|
+
if (this.u) {
|
|
256
|
+
if (this.u instanceof _Transition)
|
|
257
|
+
return this.u.runTransition(fn, force);
|
|
262
258
|
if (!force)
|
|
263
259
|
throw new Error("Transition already completed");
|
|
264
260
|
fn();
|
|
@@ -273,27 +269,29 @@ var Transition = class _Transition {
|
|
|
273
269
|
let temp, value;
|
|
274
270
|
while (!(temp = result.next(value)).done) {
|
|
275
271
|
if (temp.value instanceof Promise) {
|
|
276
|
-
transition2.
|
|
272
|
+
transition2.H.add(temp.value);
|
|
277
273
|
try {
|
|
278
274
|
value = await temp.value;
|
|
279
275
|
} finally {
|
|
280
|
-
while (transition2.
|
|
281
|
-
transition2 = transition2.
|
|
282
|
-
transition2.
|
|
276
|
+
while (transition2.u instanceof _Transition)
|
|
277
|
+
transition2 = transition2.u;
|
|
278
|
+
transition2.H.delete(temp.value);
|
|
283
279
|
}
|
|
284
280
|
ActiveTransition = transition2;
|
|
285
281
|
} else
|
|
286
282
|
value = temp.value;
|
|
287
283
|
}
|
|
284
|
+
ActiveTransition = null;
|
|
288
285
|
finishTransition(transition2);
|
|
289
286
|
})();
|
|
290
287
|
}
|
|
291
288
|
if (result instanceof Promise) {
|
|
292
|
-
transition2.
|
|
289
|
+
transition2.H.add(result);
|
|
293
290
|
result.finally(() => {
|
|
294
|
-
while (transition2.
|
|
295
|
-
transition2 = transition2.
|
|
296
|
-
transition2.
|
|
291
|
+
while (transition2.u instanceof _Transition)
|
|
292
|
+
transition2 = transition2.u;
|
|
293
|
+
transition2.H.delete(result);
|
|
294
|
+
ActiveTransition = null;
|
|
297
295
|
finishTransition(transition2);
|
|
298
296
|
});
|
|
299
297
|
}
|
|
@@ -327,8 +325,8 @@ function cloneGraph(node) {
|
|
|
327
325
|
}
|
|
328
326
|
const clone = Object.create(Object.getPrototypeOf(node));
|
|
329
327
|
Object.assign(clone, node, {
|
|
330
|
-
o: null,
|
|
331
328
|
n: null,
|
|
329
|
+
m: null,
|
|
332
330
|
b: null,
|
|
333
331
|
a: node.a ? [...node.a] : null,
|
|
334
332
|
e: node
|
|
@@ -370,7 +368,7 @@ function cloneQueue(queue, parent, clonedQueues) {
|
|
|
370
368
|
},
|
|
371
369
|
notify(node, type, flags) {
|
|
372
370
|
node = node.e || node;
|
|
373
|
-
if (!clone.
|
|
371
|
+
if (!clone.J || type & LOADING_BIT) {
|
|
374
372
|
type &= ~LOADING_BIT;
|
|
375
373
|
ActiveTransition?.notify(node, LOADING_BIT, flags);
|
|
376
374
|
if (!type)
|
|
@@ -411,26 +409,30 @@ function mergeTransitions(t1, t2) {
|
|
|
411
409
|
c.j = t1;
|
|
412
410
|
t1.W.add(c);
|
|
413
411
|
});
|
|
414
|
-
t2.
|
|
415
|
-
t2.
|
|
412
|
+
t2.H.forEach((p) => t1.H.add(p));
|
|
413
|
+
t2.s.forEach((n) => t1.s.add(n));
|
|
416
414
|
t1.merge(t2);
|
|
417
|
-
t2.
|
|
415
|
+
t2.u = t1;
|
|
418
416
|
}
|
|
419
417
|
function getTransitionSource(input) {
|
|
420
418
|
return ActiveTransition && ActiveTransition.a.get(input) || input;
|
|
421
419
|
}
|
|
420
|
+
function getQueue(node) {
|
|
421
|
+
const transition2 = node.e?.j;
|
|
422
|
+
return transition2 && transition2.r.get(node.B) || node.B;
|
|
423
|
+
}
|
|
422
424
|
function initialDispose(node) {
|
|
423
|
-
let current = node.
|
|
425
|
+
let current = node.m;
|
|
424
426
|
while (current !== null && current.k === node) {
|
|
425
427
|
initialDispose(current);
|
|
426
428
|
const clone = ActiveTransition.a.get(current);
|
|
427
429
|
if (clone && !clone.Y)
|
|
428
430
|
clone.dispose(true);
|
|
429
|
-
current = current.
|
|
431
|
+
current = current.m;
|
|
430
432
|
}
|
|
431
433
|
}
|
|
432
434
|
function finishTransition(transition2) {
|
|
433
|
-
if (transition2.
|
|
435
|
+
if (transition2.u || transition2.X || transition2.H.size || transition2.s.size)
|
|
434
436
|
return;
|
|
435
437
|
globalQueue.g[0].push.apply(globalQueue.g[0], transition2.g[0]);
|
|
436
438
|
globalQueue.g[1].push.apply(globalQueue.g[1], transition2.g[1]);
|
|
@@ -447,21 +449,21 @@ function finishTransition(transition2) {
|
|
|
447
449
|
source.emptyDisposal();
|
|
448
450
|
delete clone.Y;
|
|
449
451
|
} else {
|
|
452
|
+
delete clone.m;
|
|
450
453
|
delete clone.n;
|
|
451
|
-
delete clone.o;
|
|
452
454
|
}
|
|
453
455
|
Object.assign(source, clone);
|
|
454
456
|
delete source.e;
|
|
455
|
-
let current = clone.
|
|
456
|
-
if (current?.
|
|
457
|
-
current.
|
|
457
|
+
let current = clone.m;
|
|
458
|
+
if (current?.w === clone)
|
|
459
|
+
current.w = source;
|
|
458
460
|
while (current?.k === clone) {
|
|
459
461
|
current.k = source;
|
|
460
|
-
current = current.
|
|
462
|
+
current = current.m;
|
|
461
463
|
}
|
|
462
464
|
delete source.j;
|
|
463
465
|
}
|
|
464
|
-
transition2.
|
|
466
|
+
transition2.u = true;
|
|
465
467
|
for (const reset of transition2.W) {
|
|
466
468
|
delete reset.j;
|
|
467
469
|
reset();
|
|
@@ -485,12 +487,12 @@ var Owner = class {
|
|
|
485
487
|
// However, the children are actually added in reverse creation order
|
|
486
488
|
// See comment at the top of the file for an example of the _nextSibling traversal
|
|
487
489
|
k = null;
|
|
488
|
-
|
|
489
|
-
|
|
490
|
+
m = null;
|
|
491
|
+
w = null;
|
|
490
492
|
c = STATE_CLEAN;
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
493
|
+
n = null;
|
|
494
|
+
x = defaultContext;
|
|
495
|
+
B = globalQueue;
|
|
494
496
|
fa = 0;
|
|
495
497
|
id = null;
|
|
496
498
|
constructor(id = null, skipAppend = false) {
|
|
@@ -501,58 +503,58 @@ var Owner = class {
|
|
|
501
503
|
}
|
|
502
504
|
append(child) {
|
|
503
505
|
child.k = this;
|
|
504
|
-
child.
|
|
505
|
-
if (this.
|
|
506
|
-
this.
|
|
507
|
-
child.
|
|
508
|
-
this.
|
|
506
|
+
child.w = this;
|
|
507
|
+
if (this.m)
|
|
508
|
+
this.m.w = child;
|
|
509
|
+
child.m = this.m;
|
|
510
|
+
this.m = child;
|
|
509
511
|
if (this.id != null && child.id == null)
|
|
510
512
|
child.id = this.getNextChildId();
|
|
511
|
-
if (child.
|
|
512
|
-
child.
|
|
513
|
+
if (child.x !== this.x) {
|
|
514
|
+
child.x = { ...this.x, ...child.x };
|
|
513
515
|
}
|
|
514
|
-
if (this.
|
|
515
|
-
child.
|
|
516
|
+
if (this.B)
|
|
517
|
+
child.B = this.B;
|
|
516
518
|
}
|
|
517
519
|
dispose(self = true) {
|
|
518
520
|
if (this.c === STATE_DISPOSED)
|
|
519
521
|
return;
|
|
520
|
-
let head = self ? this.
|
|
522
|
+
let head = self ? this.w || this.k : this, current = this.m, next = null;
|
|
521
523
|
while (current && current.k === this) {
|
|
522
524
|
current.dispose(true);
|
|
523
|
-
next = current.
|
|
524
|
-
current.
|
|
525
|
+
next = current.m;
|
|
526
|
+
current.m = null;
|
|
525
527
|
current = next;
|
|
526
528
|
}
|
|
527
529
|
this.fa = 0;
|
|
528
530
|
if (self)
|
|
529
531
|
this.R();
|
|
530
532
|
if (current)
|
|
531
|
-
current.
|
|
533
|
+
current.w = !self ? this : this.w;
|
|
532
534
|
if (head)
|
|
533
|
-
head.
|
|
535
|
+
head.m = current;
|
|
534
536
|
}
|
|
535
537
|
R() {
|
|
536
|
-
if (this.
|
|
537
|
-
this.
|
|
538
|
+
if (this.w)
|
|
539
|
+
this.w.m = null;
|
|
538
540
|
this.k = null;
|
|
539
|
-
this.
|
|
540
|
-
this.
|
|
541
|
+
this.w = null;
|
|
542
|
+
this.x = defaultContext;
|
|
541
543
|
this.c = STATE_DISPOSED;
|
|
542
544
|
this.emptyDisposal();
|
|
543
545
|
}
|
|
544
546
|
emptyDisposal() {
|
|
545
|
-
if (!this.
|
|
547
|
+
if (!this.n)
|
|
546
548
|
return;
|
|
547
|
-
if (Array.isArray(this.
|
|
548
|
-
for (let i = 0; i < this.
|
|
549
|
-
const callable = this.
|
|
549
|
+
if (Array.isArray(this.n)) {
|
|
550
|
+
for (let i = 0; i < this.n.length; i++) {
|
|
551
|
+
const callable = this.n[i];
|
|
550
552
|
callable.call(callable);
|
|
551
553
|
}
|
|
552
554
|
} else {
|
|
553
|
-
this.
|
|
555
|
+
this.n.call(this.n);
|
|
554
556
|
}
|
|
555
|
-
this.
|
|
557
|
+
this.n = null;
|
|
556
558
|
}
|
|
557
559
|
getNextChildId() {
|
|
558
560
|
if (this.id != null)
|
|
@@ -567,7 +569,7 @@ function getContext(context, owner = currentOwner) {
|
|
|
567
569
|
if (!owner) {
|
|
568
570
|
throw new NoOwnerError();
|
|
569
571
|
}
|
|
570
|
-
const value = hasContext(context, owner) ? owner.
|
|
572
|
+
const value = hasContext(context, owner) ? owner.x[context.id] : context.defaultValue;
|
|
571
573
|
if (isUndefined(value)) {
|
|
572
574
|
throw new ContextNotFoundError();
|
|
573
575
|
}
|
|
@@ -577,24 +579,24 @@ function setContext(context, value, owner = currentOwner) {
|
|
|
577
579
|
if (!owner) {
|
|
578
580
|
throw new NoOwnerError();
|
|
579
581
|
}
|
|
580
|
-
owner.
|
|
581
|
-
...owner.
|
|
582
|
+
owner.x = {
|
|
583
|
+
...owner.x,
|
|
582
584
|
[context.id]: isUndefined(value) ? context.defaultValue : value
|
|
583
585
|
};
|
|
584
586
|
}
|
|
585
587
|
function hasContext(context, owner = currentOwner) {
|
|
586
|
-
return !isUndefined(owner?.
|
|
588
|
+
return !isUndefined(owner?.x[context.id]);
|
|
587
589
|
}
|
|
588
590
|
function onCleanup(fn) {
|
|
589
591
|
if (!currentOwner)
|
|
590
592
|
return fn;
|
|
591
593
|
const node = currentOwner;
|
|
592
|
-
if (!node.
|
|
593
|
-
node.
|
|
594
|
-
} else if (Array.isArray(node.
|
|
595
|
-
node.
|
|
594
|
+
if (!node.n) {
|
|
595
|
+
node.n = fn;
|
|
596
|
+
} else if (Array.isArray(node.n)) {
|
|
597
|
+
node.n.push(fn);
|
|
596
598
|
} else {
|
|
597
|
-
node.
|
|
599
|
+
node.n = [node.n, fn];
|
|
598
600
|
}
|
|
599
601
|
return fn;
|
|
600
602
|
}
|
|
@@ -637,7 +639,7 @@ var Computation = class extends Owner {
|
|
|
637
639
|
/** Which flags raised by sources are handled, vs. being passed through. */
|
|
638
640
|
ba = DEFAULT_FLAGS;
|
|
639
641
|
N = -1;
|
|
640
|
-
|
|
642
|
+
D = false;
|
|
641
643
|
j;
|
|
642
644
|
e;
|
|
643
645
|
constructor(initialValue, compute2, options) {
|
|
@@ -732,7 +734,7 @@ var Computation = class extends Owner {
|
|
|
732
734
|
if (this.b) {
|
|
733
735
|
for (let i = 0; i < this.b.length; i++) {
|
|
734
736
|
if (valueChanged) {
|
|
735
|
-
this.b[i].
|
|
737
|
+
this.b[i].y(STATE_DIRTY);
|
|
736
738
|
} else if (changedFlagsMask) {
|
|
737
739
|
this.b[i].Z(changedFlagsMask, changedFlags);
|
|
738
740
|
}
|
|
@@ -743,14 +745,14 @@ var Computation = class extends Owner {
|
|
|
743
745
|
/**
|
|
744
746
|
* Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
|
|
745
747
|
*/
|
|
746
|
-
|
|
747
|
-
if (this.c >= state && !this.
|
|
748
|
+
y(state, skipQueue) {
|
|
749
|
+
if (this.c >= state && !this.D)
|
|
748
750
|
return;
|
|
749
|
-
this.
|
|
751
|
+
this.D = !!skipQueue;
|
|
750
752
|
this.c = state;
|
|
751
753
|
if (this.b) {
|
|
752
754
|
for (let i = 0; i < this.b.length; i++) {
|
|
753
|
-
this.b[i].
|
|
755
|
+
this.b[i].y(STATE_CHECK, skipQueue);
|
|
754
756
|
}
|
|
755
757
|
}
|
|
756
758
|
}
|
|
@@ -764,15 +766,15 @@ var Computation = class extends Owner {
|
|
|
764
766
|
if (this.c >= STATE_DIRTY)
|
|
765
767
|
return;
|
|
766
768
|
if (mask & this.ba) {
|
|
767
|
-
this.
|
|
769
|
+
this.y(STATE_DIRTY);
|
|
768
770
|
return;
|
|
769
771
|
}
|
|
770
|
-
if (this.c >= STATE_CHECK)
|
|
772
|
+
if (this.c >= STATE_CHECK && !this.D)
|
|
771
773
|
return;
|
|
772
774
|
const prevFlags = this.h & mask;
|
|
773
775
|
const deltaFlags = prevFlags ^ newFlags2;
|
|
774
776
|
if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
|
|
775
|
-
this.
|
|
777
|
+
this.y(STATE_CHECK);
|
|
776
778
|
} else {
|
|
777
779
|
this.h ^= deltaFlags;
|
|
778
780
|
if (this.b) {
|
|
@@ -782,11 +784,11 @@ var Computation = class extends Owner {
|
|
|
782
784
|
}
|
|
783
785
|
}
|
|
784
786
|
}
|
|
785
|
-
|
|
787
|
+
E(error) {
|
|
786
788
|
if (ActiveTransition && !this.e) {
|
|
787
789
|
const clone = cloneGraph(this);
|
|
788
790
|
if (clone !== this)
|
|
789
|
-
return clone.
|
|
791
|
+
return clone.E(error);
|
|
790
792
|
}
|
|
791
793
|
this.L = error;
|
|
792
794
|
this.write(UNCHANGED, this.h & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
|
|
@@ -871,7 +873,7 @@ function update(node) {
|
|
|
871
873
|
if (error instanceof NotReadyError) {
|
|
872
874
|
node.write(UNCHANGED, newFlags | LOADING_BIT | node.h & UNINITIALIZED_BIT);
|
|
873
875
|
} else {
|
|
874
|
-
node.
|
|
876
|
+
node.E(error);
|
|
875
877
|
}
|
|
876
878
|
} finally {
|
|
877
879
|
if (newSources) {
|
|
@@ -975,7 +977,7 @@ function runWithObserver(observer, run) {
|
|
|
975
977
|
newFlags | LOADING_BIT | observer.h & UNINITIALIZED_BIT
|
|
976
978
|
);
|
|
977
979
|
} else {
|
|
978
|
-
observer.
|
|
980
|
+
observer.E(error);
|
|
979
981
|
}
|
|
980
982
|
} finally {
|
|
981
983
|
if (newSources) {
|
|
@@ -1032,17 +1034,17 @@ var Effect = class extends Computation {
|
|
|
1032
1034
|
this.C = options?.render ? EFFECT_RENDER : EFFECT_USER;
|
|
1033
1035
|
if (this.C === EFFECT_RENDER) {
|
|
1034
1036
|
this.M = function(p) {
|
|
1035
|
-
return !this.e && clock > this.
|
|
1037
|
+
return !this.e && clock > this.B.created && !(this.h & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
|
|
1036
1038
|
};
|
|
1037
1039
|
}
|
|
1038
1040
|
this.K();
|
|
1039
|
-
!options?.defer && (this.C === EFFECT_USER ? this.
|
|
1041
|
+
!options?.defer && (this.C === EFFECT_USER ? getQueue(this).enqueue(this.C, this.F.bind(this)) : this.F(this.C));
|
|
1040
1042
|
}
|
|
1041
1043
|
write(value, flags = 0) {
|
|
1042
1044
|
if (this.c == STATE_DIRTY) {
|
|
1043
1045
|
this.h = flags;
|
|
1044
1046
|
if (this.C === EFFECT_RENDER) {
|
|
1045
|
-
this.
|
|
1047
|
+
getQueue(this).notify(this, LOADING_BIT | ERROR_BIT, this.h);
|
|
1046
1048
|
}
|
|
1047
1049
|
}
|
|
1048
1050
|
if (value === UNCHANGED)
|
|
@@ -1052,11 +1054,11 @@ var Effect = class extends Computation {
|
|
|
1052
1054
|
this.L = void 0;
|
|
1053
1055
|
return value;
|
|
1054
1056
|
}
|
|
1055
|
-
|
|
1057
|
+
y(state, skipQueue) {
|
|
1056
1058
|
if (this.c >= state || skipQueue)
|
|
1057
1059
|
return;
|
|
1058
1060
|
if (this.c === STATE_CLEAN)
|
|
1059
|
-
this.
|
|
1061
|
+
getQueue(this).enqueue(this.C, this.F.bind(this));
|
|
1060
1062
|
this.c = state;
|
|
1061
1063
|
}
|
|
1062
1064
|
Z(mask, newFlags2) {
|
|
@@ -1064,15 +1066,15 @@ var Effect = class extends Computation {
|
|
|
1064
1066
|
if (this.c >= STATE_DIRTY)
|
|
1065
1067
|
return;
|
|
1066
1068
|
if (mask & 3) {
|
|
1067
|
-
this.
|
|
1069
|
+
this.y(STATE_DIRTY);
|
|
1068
1070
|
return;
|
|
1069
1071
|
}
|
|
1070
1072
|
}
|
|
1071
1073
|
super.Z(mask, newFlags2);
|
|
1072
1074
|
}
|
|
1073
|
-
|
|
1075
|
+
E(error) {
|
|
1074
1076
|
this.L = error;
|
|
1075
|
-
this.
|
|
1077
|
+
getQueue(this).notify(this, LOADING_BIT, 0);
|
|
1076
1078
|
this.h = ERROR_BIT;
|
|
1077
1079
|
if (this.C === EFFECT_USER) {
|
|
1078
1080
|
try {
|
|
@@ -1084,7 +1086,7 @@ var Effect = class extends Computation {
|
|
|
1084
1086
|
error = e;
|
|
1085
1087
|
}
|
|
1086
1088
|
}
|
|
1087
|
-
if (!this.
|
|
1089
|
+
if (!getQueue(this).notify(this, ERROR_BIT, ERROR_BIT))
|
|
1088
1090
|
throw error;
|
|
1089
1091
|
}
|
|
1090
1092
|
R() {
|
|
@@ -1095,10 +1097,10 @@ var Effect = class extends Computation {
|
|
|
1095
1097
|
this._ = void 0;
|
|
1096
1098
|
this.O?.();
|
|
1097
1099
|
this.O = void 0;
|
|
1098
|
-
this.
|
|
1100
|
+
getQueue(this).notify(this, ERROR_BIT | LOADING_BIT, 0);
|
|
1099
1101
|
super.R();
|
|
1100
1102
|
}
|
|
1101
|
-
|
|
1103
|
+
F(type) {
|
|
1102
1104
|
if (type) {
|
|
1103
1105
|
const effect = this.e || this;
|
|
1104
1106
|
if (effect.da && effect.c !== STATE_DISPOSED) {
|
|
@@ -1106,7 +1108,7 @@ var Effect = class extends Computation {
|
|
|
1106
1108
|
try {
|
|
1107
1109
|
effect.O = effect.ca(effect.l, effect.$);
|
|
1108
1110
|
} catch (e) {
|
|
1109
|
-
if (!effect.
|
|
1111
|
+
if (!getQueue(effect).notify(effect, ERROR_BIT, ERROR_BIT))
|
|
1110
1112
|
throw e;
|
|
1111
1113
|
} finally {
|
|
1112
1114
|
effect.$ = effect.l;
|
|
@@ -1122,14 +1124,14 @@ var EagerComputation = class extends Computation {
|
|
|
1122
1124
|
super(initialValue, compute2, options);
|
|
1123
1125
|
!options?.defer && this.K();
|
|
1124
1126
|
}
|
|
1125
|
-
|
|
1126
|
-
if (this.c >= state && !this.
|
|
1127
|
+
y(state, skipQueue) {
|
|
1128
|
+
if (this.c >= state && !this.D)
|
|
1127
1129
|
return;
|
|
1128
|
-
if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.
|
|
1129
|
-
this.
|
|
1130
|
-
super.
|
|
1130
|
+
if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.D))
|
|
1131
|
+
getQueue(this).enqueue(EFFECT_PURE, this.F.bind(this));
|
|
1132
|
+
super.y(state, skipQueue);
|
|
1131
1133
|
}
|
|
1132
|
-
|
|
1134
|
+
F() {
|
|
1133
1135
|
this.c !== STATE_CLEAN && runTop(this);
|
|
1134
1136
|
}
|
|
1135
1137
|
};
|
|
@@ -1138,15 +1140,15 @@ var FirewallComputation = class extends Computation {
|
|
|
1138
1140
|
constructor(compute2) {
|
|
1139
1141
|
super(void 0, compute2);
|
|
1140
1142
|
}
|
|
1141
|
-
|
|
1142
|
-
if (this.c >= state && !this.
|
|
1143
|
+
y(state, skipQueue) {
|
|
1144
|
+
if (this.c >= state && !this.D)
|
|
1143
1145
|
return;
|
|
1144
|
-
if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.
|
|
1145
|
-
this.
|
|
1146
|
-
super.
|
|
1147
|
-
this.
|
|
1146
|
+
if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.D))
|
|
1147
|
+
getQueue(this).enqueue(EFFECT_PURE, this.F.bind(this));
|
|
1148
|
+
super.y(state, true);
|
|
1149
|
+
this.D = !!skipQueue;
|
|
1148
1150
|
}
|
|
1149
|
-
|
|
1151
|
+
F() {
|
|
1150
1152
|
this.c !== STATE_CLEAN && runTop(this);
|
|
1151
1153
|
}
|
|
1152
1154
|
};
|
|
@@ -1853,7 +1855,7 @@ function createMemo(compute2, value, options) {
|
|
|
1853
1855
|
return resolvedValue;
|
|
1854
1856
|
}
|
|
1855
1857
|
resolvedValue = node.wait();
|
|
1856
|
-
if (!node.a?.length && node.
|
|
1858
|
+
if (!node.a?.length && node.m?.k !== node && !(node.h & UNINITIALIZED_BIT)) {
|
|
1857
1859
|
node.dispose();
|
|
1858
1860
|
node = void 0;
|
|
1859
1861
|
}
|
|
@@ -1891,8 +1893,8 @@ function createAsync(compute2, value, options) {
|
|
|
1891
1893
|
if (abort)
|
|
1892
1894
|
return;
|
|
1893
1895
|
if (transition2)
|
|
1894
|
-
return transition2.runTransition(() => node.
|
|
1895
|
-
node.
|
|
1896
|
+
return transition2.runTransition(() => node.E(error), true);
|
|
1897
|
+
node.E(error);
|
|
1896
1898
|
}
|
|
1897
1899
|
);
|
|
1898
1900
|
} else {
|
|
@@ -1913,10 +1915,10 @@ function createAsync(compute2, value, options) {
|
|
|
1913
1915
|
return;
|
|
1914
1916
|
if (transition2)
|
|
1915
1917
|
return transition2.runTransition(() => {
|
|
1916
|
-
node.
|
|
1918
|
+
node.E(error);
|
|
1917
1919
|
transition2 = null;
|
|
1918
1920
|
}, true);
|
|
1919
|
-
node.
|
|
1921
|
+
node.E(error);
|
|
1920
1922
|
}
|
|
1921
1923
|
})();
|
|
1922
1924
|
}
|
|
@@ -2011,11 +2013,11 @@ function createOptimistic(first, second, options) {
|
|
|
2011
2013
|
} else
|
|
2012
2014
|
[store, setStore] = createStore(first);
|
|
2013
2015
|
const reset = () => setStore(
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
+
reconcile(
|
|
2017
|
+
typeof first === "function" ? first(second) : first,
|
|
2016
2018
|
options?.key || "id",
|
|
2017
2019
|
options?.all
|
|
2018
|
-
)
|
|
2020
|
+
)
|
|
2019
2021
|
);
|
|
2020
2022
|
function write(v) {
|
|
2021
2023
|
if (!ActiveTransition)
|
|
@@ -2031,15 +2033,15 @@ function mapArray(list, map, options) {
|
|
|
2031
2033
|
const keyFn = typeof options?.keyed === "function" ? options.keyed : void 0;
|
|
2032
2034
|
return updateKeyedMap.bind({
|
|
2033
2035
|
S: new Owner(),
|
|
2034
|
-
|
|
2036
|
+
o: 0,
|
|
2035
2037
|
ia: list,
|
|
2036
|
-
|
|
2038
|
+
G: [],
|
|
2037
2039
|
P: map,
|
|
2038
2040
|
i: [],
|
|
2039
2041
|
d: [],
|
|
2040
2042
|
Q: keyFn,
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
+
p: keyFn || options?.keyed === false ? [] : void 0,
|
|
2044
|
+
q: map.length > 1 ? [] : void 0,
|
|
2043
2045
|
T: options?.fallback
|
|
2044
2046
|
});
|
|
2045
2047
|
}
|
|
@@ -2048,30 +2050,30 @@ function updateKeyedMap() {
|
|
|
2048
2050
|
const newItems = this.ia() || [], newLen = newItems.length;
|
|
2049
2051
|
newItems[$TRACK];
|
|
2050
2052
|
runWithOwner(this.S, () => {
|
|
2051
|
-
let i, j, mapper = this.
|
|
2052
|
-
this.
|
|
2053
|
-
this.
|
|
2053
|
+
let i, j, mapper = this.p ? () => {
|
|
2054
|
+
this.p[j] = new Computation(newItems[j], null, pureOptions);
|
|
2055
|
+
this.q && (this.q[j] = new Computation(j, null, pureOptions));
|
|
2054
2056
|
return this.P(
|
|
2055
|
-
Computation.prototype.read.bind(this.
|
|
2056
|
-
this.
|
|
2057
|
+
Computation.prototype.read.bind(this.p[j]),
|
|
2058
|
+
this.q ? Computation.prototype.read.bind(this.q[j]) : void 0
|
|
2057
2059
|
);
|
|
2058
|
-
} : this.
|
|
2060
|
+
} : this.q ? () => {
|
|
2059
2061
|
const item = newItems[j];
|
|
2060
|
-
this.
|
|
2061
|
-
return this.P(() => item, Computation.prototype.read.bind(this.
|
|
2062
|
+
this.q[j] = new Computation(j, null, pureOptions);
|
|
2063
|
+
return this.P(() => item, Computation.prototype.read.bind(this.q[j]));
|
|
2062
2064
|
} : () => {
|
|
2063
2065
|
const item = newItems[j];
|
|
2064
2066
|
return this.P(() => item);
|
|
2065
2067
|
};
|
|
2066
2068
|
if (newLen === 0) {
|
|
2067
|
-
if (this.
|
|
2069
|
+
if (this.o !== 0) {
|
|
2068
2070
|
this.S.dispose(false);
|
|
2069
2071
|
this.d = [];
|
|
2070
|
-
this.
|
|
2072
|
+
this.G = [];
|
|
2071
2073
|
this.i = [];
|
|
2072
|
-
this.
|
|
2073
|
-
this.
|
|
2074
|
-
this.
|
|
2074
|
+
this.o = 0;
|
|
2075
|
+
this.p && (this.p = []);
|
|
2076
|
+
this.q && (this.q = []);
|
|
2075
2077
|
}
|
|
2076
2078
|
if (this.T && !this.i[0]) {
|
|
2077
2079
|
this.i[0] = compute(
|
|
@@ -2080,26 +2082,26 @@ function updateKeyedMap() {
|
|
|
2080
2082
|
null
|
|
2081
2083
|
);
|
|
2082
2084
|
}
|
|
2083
|
-
} else if (this.
|
|
2085
|
+
} else if (this.o === 0) {
|
|
2084
2086
|
if (this.d[0])
|
|
2085
2087
|
this.d[0].dispose();
|
|
2086
2088
|
this.i = new Array(newLen);
|
|
2087
2089
|
for (j = 0; j < newLen; j++) {
|
|
2088
|
-
this.
|
|
2090
|
+
this.G[j] = newItems[j];
|
|
2089
2091
|
this.i[j] = compute(this.d[j] = new Owner(), mapper, null);
|
|
2090
2092
|
}
|
|
2091
|
-
this.
|
|
2093
|
+
this.o = newLen;
|
|
2092
2094
|
} else {
|
|
2093
|
-
let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.
|
|
2094
|
-
for (start = 0, end = Math.min(this.
|
|
2095
|
-
if (this.
|
|
2096
|
-
this.
|
|
2095
|
+
let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.p ? new Array(newLen) : void 0, tempIndexes = this.q ? new Array(newLen) : void 0;
|
|
2096
|
+
for (start = 0, end = Math.min(this.o, newLen); start < end && (this.G[start] === newItems[start] || this.p && compare(this.Q, this.G[start], newItems[start])); start++) {
|
|
2097
|
+
if (this.p)
|
|
2098
|
+
this.p[start].write(newItems[start]);
|
|
2097
2099
|
}
|
|
2098
|
-
for (end = this.
|
|
2100
|
+
for (end = this.o - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.G[end] === newItems[newEnd] || this.p && compare(this.Q, this.G[end], newItems[newEnd])); end--, newEnd--) {
|
|
2099
2101
|
temp[newEnd] = this.i[end];
|
|
2100
2102
|
tempNodes[newEnd] = this.d[end];
|
|
2101
|
-
tempRows && (tempRows[newEnd] = this.
|
|
2102
|
-
tempIndexes && (tempIndexes[newEnd] = this.
|
|
2103
|
+
tempRows && (tempRows[newEnd] = this.p[end]);
|
|
2104
|
+
tempIndexes && (tempIndexes[newEnd] = this.q[end]);
|
|
2103
2105
|
}
|
|
2104
2106
|
newIndices = /* @__PURE__ */ new Map();
|
|
2105
2107
|
newIndicesNext = new Array(newEnd + 1);
|
|
@@ -2111,14 +2113,14 @@ function updateKeyedMap() {
|
|
|
2111
2113
|
newIndices.set(key, j);
|
|
2112
2114
|
}
|
|
2113
2115
|
for (i = start; i <= end; i++) {
|
|
2114
|
-
item = this.
|
|
2116
|
+
item = this.G[i];
|
|
2115
2117
|
key = this.Q ? this.Q(item) : item;
|
|
2116
2118
|
j = newIndices.get(key);
|
|
2117
2119
|
if (j !== void 0 && j !== -1) {
|
|
2118
2120
|
temp[j] = this.i[i];
|
|
2119
2121
|
tempNodes[j] = this.d[i];
|
|
2120
|
-
tempRows && (tempRows[j] = this.
|
|
2121
|
-
tempIndexes && (tempIndexes[j] = this.
|
|
2122
|
+
tempRows && (tempRows[j] = this.p[i]);
|
|
2123
|
+
tempIndexes && (tempIndexes[j] = this.q[i]);
|
|
2122
2124
|
j = newIndicesNext[j];
|
|
2123
2125
|
newIndices.set(key, j);
|
|
2124
2126
|
} else
|
|
@@ -2129,19 +2131,19 @@ function updateKeyedMap() {
|
|
|
2129
2131
|
this.i[j] = temp[j];
|
|
2130
2132
|
this.d[j] = tempNodes[j];
|
|
2131
2133
|
if (tempRows) {
|
|
2132
|
-
this.
|
|
2133
|
-
this.
|
|
2134
|
+
this.p[j] = tempRows[j];
|
|
2135
|
+
this.p[j].write(newItems[j]);
|
|
2134
2136
|
}
|
|
2135
2137
|
if (tempIndexes) {
|
|
2136
|
-
this.
|
|
2137
|
-
this.
|
|
2138
|
+
this.q[j] = tempIndexes[j];
|
|
2139
|
+
this.q[j].write(j);
|
|
2138
2140
|
}
|
|
2139
2141
|
} else {
|
|
2140
2142
|
this.i[j] = compute(this.d[j] = new Owner(), mapper, null);
|
|
2141
2143
|
}
|
|
2142
2144
|
}
|
|
2143
|
-
this.i = this.i.slice(0, this.
|
|
2144
|
-
this.
|
|
2145
|
+
this.i = this.i.slice(0, this.o = newLen);
|
|
2146
|
+
this.G = newItems.slice(0);
|
|
2145
2147
|
}
|
|
2146
2148
|
});
|
|
2147
2149
|
return this.i;
|
|
@@ -2149,8 +2151,8 @@ function updateKeyedMap() {
|
|
|
2149
2151
|
function repeat(count, map, options) {
|
|
2150
2152
|
return updateRepeat.bind({
|
|
2151
2153
|
S: new Owner(),
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
+
o: 0,
|
|
2155
|
+
z: 0,
|
|
2154
2156
|
ja: count,
|
|
2155
2157
|
P: map,
|
|
2156
2158
|
d: [],
|
|
@@ -2164,11 +2166,11 @@ function updateRepeat() {
|
|
|
2164
2166
|
const from = this.ka?.() || 0;
|
|
2165
2167
|
runWithOwner(this.S, () => {
|
|
2166
2168
|
if (newLen === 0) {
|
|
2167
|
-
if (this.
|
|
2169
|
+
if (this.o !== 0) {
|
|
2168
2170
|
this.S.dispose(false);
|
|
2169
2171
|
this.d = [];
|
|
2170
2172
|
this.i = [];
|
|
2171
|
-
this.
|
|
2173
|
+
this.o = 0;
|
|
2172
2174
|
}
|
|
2173
2175
|
if (this.T && !this.i[0]) {
|
|
2174
2176
|
this.i[0] = compute(
|
|
@@ -2180,20 +2182,20 @@ function updateRepeat() {
|
|
|
2180
2182
|
return;
|
|
2181
2183
|
}
|
|
2182
2184
|
const to = from + newLen;
|
|
2183
|
-
const prevTo = this.
|
|
2184
|
-
if (this.
|
|
2185
|
+
const prevTo = this.z + this.o;
|
|
2186
|
+
if (this.o === 0 && this.d[0])
|
|
2185
2187
|
this.d[0].dispose();
|
|
2186
2188
|
for (let i = to; i < prevTo; i++)
|
|
2187
|
-
this.d[i - this.
|
|
2188
|
-
if (this.
|
|
2189
|
-
let i = this.
|
|
2190
|
-
while (i < from && i < this.
|
|
2189
|
+
this.d[i - this.z].dispose();
|
|
2190
|
+
if (this.z < from) {
|
|
2191
|
+
let i = this.z;
|
|
2192
|
+
while (i < from && i < this.o)
|
|
2191
2193
|
this.d[i++].dispose();
|
|
2192
|
-
this.d.splice(0, from - this.
|
|
2193
|
-
this.i.splice(0, from - this.
|
|
2194
|
-
} else if (this.
|
|
2195
|
-
let i = prevTo - this.
|
|
2196
|
-
let difference = this.
|
|
2194
|
+
this.d.splice(0, from - this.z);
|
|
2195
|
+
this.i.splice(0, from - this.z);
|
|
2196
|
+
} else if (this.z > from) {
|
|
2197
|
+
let i = prevTo - this.z - 1;
|
|
2198
|
+
let difference = this.z - from;
|
|
2197
2199
|
this.d.length = this.i.length = newLen;
|
|
2198
2200
|
while (i >= difference) {
|
|
2199
2201
|
this.d[i] = this.d[i - difference];
|
|
@@ -2216,8 +2218,8 @@ function updateRepeat() {
|
|
|
2216
2218
|
);
|
|
2217
2219
|
}
|
|
2218
2220
|
this.i = this.i.slice(0, newLen);
|
|
2219
|
-
this.
|
|
2220
|
-
this.
|
|
2221
|
+
this.z = from;
|
|
2222
|
+
this.o = newLen;
|
|
2221
2223
|
});
|
|
2222
2224
|
return this.i;
|
|
2223
2225
|
}
|
|
@@ -2237,14 +2239,14 @@ var BoundaryComputation = class extends EagerComputation {
|
|
|
2237
2239
|
if (this.U & LOADING_BIT && !(this.h & UNINITIALIZED_BIT || ActiveTransition)) {
|
|
2238
2240
|
flags &= ~LOADING_BIT;
|
|
2239
2241
|
}
|
|
2240
|
-
this.
|
|
2242
|
+
getQueue(this).notify(this, this.U, flags);
|
|
2241
2243
|
return this.l;
|
|
2242
2244
|
}
|
|
2243
2245
|
};
|
|
2244
2246
|
function createBoundChildren(owner, fn, queue, mask) {
|
|
2245
|
-
const parentQueue = owner.
|
|
2246
|
-
parentQueue.addChild(owner.
|
|
2247
|
-
onCleanup(() => parentQueue.removeChild(owner.
|
|
2247
|
+
const parentQueue = owner.B;
|
|
2248
|
+
parentQueue.addChild(owner.B = queue);
|
|
2249
|
+
onCleanup(() => parentQueue.removeChild(owner.B));
|
|
2248
2250
|
return compute(
|
|
2249
2251
|
owner,
|
|
2250
2252
|
() => {
|
|
@@ -2255,27 +2257,27 @@ function createBoundChildren(owner, fn, queue, mask) {
|
|
|
2255
2257
|
);
|
|
2256
2258
|
}
|
|
2257
2259
|
var ConditionalQueue = class extends Queue {
|
|
2258
|
-
|
|
2260
|
+
t;
|
|
2259
2261
|
V = /* @__PURE__ */ new Set();
|
|
2260
|
-
|
|
2262
|
+
s = /* @__PURE__ */ new Set();
|
|
2261
2263
|
constructor(disabled) {
|
|
2262
2264
|
super();
|
|
2263
|
-
this.
|
|
2265
|
+
this.t = disabled;
|
|
2264
2266
|
}
|
|
2265
2267
|
run(type) {
|
|
2266
|
-
if (!type || this.
|
|
2268
|
+
if (!type || this.t.read())
|
|
2267
2269
|
return;
|
|
2268
2270
|
return super.run(type);
|
|
2269
2271
|
}
|
|
2270
2272
|
notify(node, type, flags) {
|
|
2271
|
-
if (ActiveTransition && ActiveTransition.
|
|
2272
|
-
return ActiveTransition.
|
|
2273
|
-
if (this.
|
|
2273
|
+
if (ActiveTransition && ActiveTransition.r.has(this))
|
|
2274
|
+
return ActiveTransition.r.get(this).notify(node, type, flags);
|
|
2275
|
+
if (this.t.read()) {
|
|
2274
2276
|
if (type & LOADING_BIT) {
|
|
2275
2277
|
if (flags & LOADING_BIT) {
|
|
2276
|
-
this.
|
|
2278
|
+
this.s.add(node);
|
|
2277
2279
|
type &= ~LOADING_BIT;
|
|
2278
|
-
} else if (this.
|
|
2280
|
+
} else if (this.s.delete(node))
|
|
2279
2281
|
type &= ~LOADING_BIT;
|
|
2280
2282
|
}
|
|
2281
2283
|
if (type & ERROR_BIT) {
|
|
@@ -2289,43 +2291,43 @@ var ConditionalQueue = class extends Queue {
|
|
|
2289
2291
|
return type ? super.notify(node, type, flags) : true;
|
|
2290
2292
|
}
|
|
2291
2293
|
merge(queue) {
|
|
2292
|
-
queue.
|
|
2294
|
+
queue.s.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
|
|
2293
2295
|
queue.V.forEach((n) => this.notify(n, ERROR_BIT, ERROR_BIT));
|
|
2294
2296
|
super.merge(queue);
|
|
2295
2297
|
}
|
|
2296
2298
|
};
|
|
2297
2299
|
var CollectionQueue = class extends Queue {
|
|
2298
|
-
|
|
2300
|
+
J;
|
|
2299
2301
|
d = /* @__PURE__ */ new Set();
|
|
2300
|
-
|
|
2302
|
+
t = new Computation(false, null, { pureWrite: true });
|
|
2301
2303
|
constructor(type) {
|
|
2302
2304
|
super();
|
|
2303
|
-
this.
|
|
2305
|
+
this.J = type;
|
|
2304
2306
|
}
|
|
2305
2307
|
run(type) {
|
|
2306
|
-
if (!type || this.
|
|
2308
|
+
if (!type || this.t.read())
|
|
2307
2309
|
return;
|
|
2308
2310
|
return super.run(type);
|
|
2309
2311
|
}
|
|
2310
2312
|
notify(node, type, flags) {
|
|
2311
|
-
if (ActiveTransition && ActiveTransition.
|
|
2312
|
-
return ActiveTransition.
|
|
2313
|
-
if (!(type & this.
|
|
2313
|
+
if (ActiveTransition && ActiveTransition.r.has(this))
|
|
2314
|
+
return ActiveTransition.r.get(this).notify(node, type, flags);
|
|
2315
|
+
if (!(type & this.J))
|
|
2314
2316
|
return super.notify(node, type, flags);
|
|
2315
|
-
if (flags & this.
|
|
2317
|
+
if (flags & this.J) {
|
|
2316
2318
|
this.d.add(node);
|
|
2317
2319
|
if (this.d.size === 1)
|
|
2318
|
-
this.
|
|
2320
|
+
this.t.write(true);
|
|
2319
2321
|
} else if (this.d.size > 0) {
|
|
2320
2322
|
this.d.delete(node);
|
|
2321
2323
|
if (this.d.size === 0)
|
|
2322
|
-
this.
|
|
2324
|
+
this.t.write(false);
|
|
2323
2325
|
}
|
|
2324
|
-
type &= ~this.
|
|
2326
|
+
type &= ~this.J;
|
|
2325
2327
|
return type ? super.notify(node, type, flags) : true;
|
|
2326
2328
|
}
|
|
2327
2329
|
merge(queue) {
|
|
2328
|
-
queue.d.forEach((n) => this.notify(n, this.
|
|
2330
|
+
queue.d.forEach((n) => this.notify(n, this.J, this.J));
|
|
2329
2331
|
super.merge(queue);
|
|
2330
2332
|
}
|
|
2331
2333
|
};
|
|
@@ -2336,25 +2338,25 @@ function createBoundary(fn, condition) {
|
|
|
2336
2338
|
);
|
|
2337
2339
|
const tree = createBoundChildren(owner, fn, queue, 0);
|
|
2338
2340
|
new EagerComputation(void 0, () => {
|
|
2339
|
-
const disabled = queue.
|
|
2341
|
+
const disabled = queue.t.read();
|
|
2340
2342
|
tree.U = disabled ? ERROR_BIT | LOADING_BIT : 0;
|
|
2341
2343
|
if (!disabled) {
|
|
2342
|
-
queue.
|
|
2344
|
+
queue.s.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
|
|
2343
2345
|
queue.V.forEach((node) => queue.notify(node, ERROR_BIT, ERROR_BIT));
|
|
2344
|
-
queue.
|
|
2346
|
+
queue.s.clear();
|
|
2345
2347
|
queue.V.clear();
|
|
2346
2348
|
}
|
|
2347
2349
|
});
|
|
2348
|
-
return () => queue.
|
|
2350
|
+
return () => queue.t.read() ? void 0 : tree.read();
|
|
2349
2351
|
}
|
|
2350
2352
|
function createCollectionBoundary(type, fn, fallback) {
|
|
2351
2353
|
const owner = new Owner();
|
|
2352
2354
|
const queue = new CollectionQueue(type);
|
|
2353
2355
|
const tree = createBoundChildren(owner, fn, queue, type);
|
|
2354
2356
|
const decision = new Computation(void 0, () => {
|
|
2355
|
-
if (!queue.
|
|
2357
|
+
if (!queue.t.read()) {
|
|
2356
2358
|
const resolved = tree.read();
|
|
2357
|
-
if (!untrack(() => queue.
|
|
2359
|
+
if (!untrack(() => queue.t.read()))
|
|
2358
2360
|
return resolved;
|
|
2359
2361
|
}
|
|
2360
2362
|
return fallback(queue);
|
|
@@ -2373,7 +2375,7 @@ function createErrorBoundary(fn, fallback) {
|
|
|
2373
2375
|
if (ActiveTransition && !node2.e)
|
|
2374
2376
|
node2 = cloneGraph(node2);
|
|
2375
2377
|
node2.c = STATE_DIRTY;
|
|
2376
|
-
node2.
|
|
2378
|
+
getQueue(node2).enqueue(node2.C, node2.F.bind(node2));
|
|
2377
2379
|
}
|
|
2378
2380
|
});
|
|
2379
2381
|
});
|