@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/node.cjs
CHANGED
|
@@ -47,7 +47,7 @@ function schedule() {
|
|
|
47
47
|
if (scheduled)
|
|
48
48
|
return;
|
|
49
49
|
scheduled = true;
|
|
50
|
-
if (!globalQueue.
|
|
50
|
+
if (!globalQueue.A)
|
|
51
51
|
queueMicrotask(flush);
|
|
52
52
|
}
|
|
53
53
|
function notifyUnobserved() {
|
|
@@ -62,13 +62,11 @@ function notifyUnobserved() {
|
|
|
62
62
|
var pureQueue = [];
|
|
63
63
|
var Queue = class {
|
|
64
64
|
k = null;
|
|
65
|
-
|
|
65
|
+
A = false;
|
|
66
66
|
g = [[], []];
|
|
67
67
|
f = [];
|
|
68
68
|
created = clock;
|
|
69
69
|
enqueue(type, fn) {
|
|
70
|
-
if (ActiveTransition && ActiveTransition.p.has(this))
|
|
71
|
-
return ActiveTransition.p.get(this).enqueue(type, fn);
|
|
72
70
|
pureQueue.push(fn);
|
|
73
71
|
if (type)
|
|
74
72
|
this.g[type - 1].push(fn);
|
|
@@ -89,9 +87,9 @@ var Queue = class {
|
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
89
|
flush() {
|
|
92
|
-
if (this.
|
|
90
|
+
if (this.A)
|
|
93
91
|
return;
|
|
94
|
-
this.
|
|
92
|
+
this.A = true;
|
|
95
93
|
try {
|
|
96
94
|
this.run(EFFECT_PURE);
|
|
97
95
|
incrementClock();
|
|
@@ -99,19 +97,19 @@ var Queue = class {
|
|
|
99
97
|
this.run(EFFECT_RENDER);
|
|
100
98
|
this.run(EFFECT_USER);
|
|
101
99
|
} finally {
|
|
102
|
-
this.
|
|
100
|
+
this.A = false;
|
|
103
101
|
Unobserved.length && notifyUnobserved();
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
104
|
addChild(child) {
|
|
107
|
-
if (ActiveTransition && ActiveTransition.
|
|
108
|
-
return ActiveTransition.
|
|
105
|
+
if (ActiveTransition && ActiveTransition.r.has(this))
|
|
106
|
+
return ActiveTransition.r.get(this).addChild(child);
|
|
109
107
|
this.f.push(child);
|
|
110
108
|
child.k = this;
|
|
111
109
|
}
|
|
112
110
|
removeChild(child) {
|
|
113
|
-
if (ActiveTransition && ActiveTransition.
|
|
114
|
-
return ActiveTransition.
|
|
111
|
+
if (ActiveTransition && ActiveTransition.r.has(this))
|
|
112
|
+
return ActiveTransition.r.get(this).removeChild(child);
|
|
115
113
|
const index = this.f.indexOf(child);
|
|
116
114
|
if (index >= 0) {
|
|
117
115
|
this.f.splice(index, 1);
|
|
@@ -119,8 +117,6 @@ var Queue = class {
|
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
notify(...args) {
|
|
122
|
-
if (ActiveTransition && ActiveTransition.p.has(this))
|
|
123
|
-
return ActiveTransition.p.get(this).notify(...args);
|
|
124
120
|
if (this.k)
|
|
125
121
|
return this.k.notify(...args);
|
|
126
122
|
return false;
|
|
@@ -164,35 +160,35 @@ function runQueue(queue, type) {
|
|
|
164
160
|
}
|
|
165
161
|
var Transition = class _Transition {
|
|
166
162
|
a = /* @__PURE__ */ new Map();
|
|
167
|
-
|
|
168
|
-
|
|
163
|
+
s = /* @__PURE__ */ new Set();
|
|
164
|
+
H = /* @__PURE__ */ new Set();
|
|
169
165
|
W = /* @__PURE__ */ new Set();
|
|
170
|
-
|
|
166
|
+
u = false;
|
|
171
167
|
g = [[], []];
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
r = /* @__PURE__ */ new Map();
|
|
169
|
+
I = [];
|
|
174
170
|
f = [];
|
|
175
171
|
k = null;
|
|
176
|
-
|
|
172
|
+
A = false;
|
|
177
173
|
X = false;
|
|
178
174
|
e = globalQueue;
|
|
179
175
|
created = clock;
|
|
180
176
|
constructor() {
|
|
181
|
-
this.
|
|
177
|
+
this.r.set(globalQueue, this);
|
|
182
178
|
for (const child of globalQueue.f) {
|
|
183
|
-
cloneQueue(child, this, this.
|
|
179
|
+
cloneQueue(child, this, this.r);
|
|
184
180
|
}
|
|
185
181
|
}
|
|
186
182
|
enqueue(type, fn) {
|
|
187
|
-
this.
|
|
183
|
+
this.I.push(fn);
|
|
188
184
|
if (type)
|
|
189
185
|
this.g[type - 1].push(fn);
|
|
190
186
|
this.schedule();
|
|
191
187
|
}
|
|
192
188
|
run(type) {
|
|
193
189
|
if (type === EFFECT_PURE) {
|
|
194
|
-
this.
|
|
195
|
-
this.
|
|
190
|
+
this.I.length && runQueue(this.I, type);
|
|
191
|
+
this.I = [];
|
|
196
192
|
return;
|
|
197
193
|
} else if (this.g[type - 1].length) {
|
|
198
194
|
const effects = this.g[type - 1];
|
|
@@ -204,9 +200,9 @@ var Transition = class _Transition {
|
|
|
204
200
|
}
|
|
205
201
|
}
|
|
206
202
|
flush() {
|
|
207
|
-
if (this.
|
|
203
|
+
if (this.A)
|
|
208
204
|
return;
|
|
209
|
-
this.
|
|
205
|
+
this.A = true;
|
|
210
206
|
let currentTransition = ActiveTransition;
|
|
211
207
|
ActiveTransition = this;
|
|
212
208
|
try {
|
|
@@ -216,7 +212,7 @@ var Transition = class _Transition {
|
|
|
216
212
|
ActiveTransition = currentTransition;
|
|
217
213
|
finishTransition(this);
|
|
218
214
|
} finally {
|
|
219
|
-
this.
|
|
215
|
+
this.A = false;
|
|
220
216
|
ActiveTransition = currentTransition;
|
|
221
217
|
}
|
|
222
218
|
}
|
|
@@ -233,16 +229,16 @@ var Transition = class _Transition {
|
|
|
233
229
|
if (!(type & LOADING_BIT))
|
|
234
230
|
return false;
|
|
235
231
|
if (flags & LOADING_BIT) {
|
|
236
|
-
this.
|
|
232
|
+
this.s.add(node);
|
|
237
233
|
} else {
|
|
238
|
-
this.
|
|
234
|
+
this.s.delete(node);
|
|
239
235
|
}
|
|
240
236
|
return true;
|
|
241
237
|
}
|
|
242
238
|
merge(queue) {
|
|
243
239
|
this.g[0].push.apply(this.g[0], queue.g[0]);
|
|
244
240
|
this.g[1].push.apply(this.g[1], queue.g[1]);
|
|
245
|
-
this.
|
|
241
|
+
this.I.push.apply(this.I, queue.I);
|
|
246
242
|
for (let i = 0; i < queue.f.length; i++) {
|
|
247
243
|
const og = this.f.find((c) => c.e === queue.f[i].e);
|
|
248
244
|
if (og)
|
|
@@ -255,13 +251,13 @@ var Transition = class _Transition {
|
|
|
255
251
|
if (this.X)
|
|
256
252
|
return;
|
|
257
253
|
this.X = true;
|
|
258
|
-
if (!this.
|
|
254
|
+
if (!this.A)
|
|
259
255
|
queueMicrotask(() => this.flush());
|
|
260
256
|
}
|
|
261
257
|
runTransition(fn, force = false) {
|
|
262
|
-
if (this.
|
|
263
|
-
if (this.
|
|
264
|
-
return this.
|
|
258
|
+
if (this.u) {
|
|
259
|
+
if (this.u instanceof _Transition)
|
|
260
|
+
return this.u.runTransition(fn, force);
|
|
265
261
|
if (!force)
|
|
266
262
|
throw new Error("Transition already completed");
|
|
267
263
|
fn();
|
|
@@ -276,27 +272,29 @@ var Transition = class _Transition {
|
|
|
276
272
|
let temp, value;
|
|
277
273
|
while (!(temp = result.next(value)).done) {
|
|
278
274
|
if (temp.value instanceof Promise) {
|
|
279
|
-
transition2.
|
|
275
|
+
transition2.H.add(temp.value);
|
|
280
276
|
try {
|
|
281
277
|
value = await temp.value;
|
|
282
278
|
} finally {
|
|
283
|
-
while (transition2.
|
|
284
|
-
transition2 = transition2.
|
|
285
|
-
transition2.
|
|
279
|
+
while (transition2.u instanceof _Transition)
|
|
280
|
+
transition2 = transition2.u;
|
|
281
|
+
transition2.H.delete(temp.value);
|
|
286
282
|
}
|
|
287
283
|
ActiveTransition = transition2;
|
|
288
284
|
} else
|
|
289
285
|
value = temp.value;
|
|
290
286
|
}
|
|
287
|
+
ActiveTransition = null;
|
|
291
288
|
finishTransition(transition2);
|
|
292
289
|
})();
|
|
293
290
|
}
|
|
294
291
|
if (result instanceof Promise) {
|
|
295
|
-
transition2.
|
|
292
|
+
transition2.H.add(result);
|
|
296
293
|
result.finally(() => {
|
|
297
|
-
while (transition2.
|
|
298
|
-
transition2 = transition2.
|
|
299
|
-
transition2.
|
|
294
|
+
while (transition2.u instanceof _Transition)
|
|
295
|
+
transition2 = transition2.u;
|
|
296
|
+
transition2.H.delete(result);
|
|
297
|
+
ActiveTransition = null;
|
|
300
298
|
finishTransition(transition2);
|
|
301
299
|
});
|
|
302
300
|
}
|
|
@@ -330,8 +328,8 @@ function cloneGraph(node) {
|
|
|
330
328
|
}
|
|
331
329
|
const clone = Object.create(Object.getPrototypeOf(node));
|
|
332
330
|
Object.assign(clone, node, {
|
|
333
|
-
o: null,
|
|
334
331
|
n: null,
|
|
332
|
+
m: null,
|
|
335
333
|
b: null,
|
|
336
334
|
a: node.a ? [...node.a] : null,
|
|
337
335
|
e: node
|
|
@@ -373,7 +371,7 @@ function cloneQueue(queue, parent, clonedQueues) {
|
|
|
373
371
|
},
|
|
374
372
|
notify(node, type, flags) {
|
|
375
373
|
node = node.e || node;
|
|
376
|
-
if (!clone.
|
|
374
|
+
if (!clone.J || type & LOADING_BIT) {
|
|
377
375
|
type &= ~LOADING_BIT;
|
|
378
376
|
ActiveTransition == null ? void 0 : ActiveTransition.notify(node, LOADING_BIT, flags);
|
|
379
377
|
if (!type)
|
|
@@ -414,26 +412,31 @@ function mergeTransitions(t1, t2) {
|
|
|
414
412
|
c.j = t1;
|
|
415
413
|
t1.W.add(c);
|
|
416
414
|
});
|
|
417
|
-
t2.
|
|
418
|
-
t2.
|
|
415
|
+
t2.H.forEach((p) => t1.H.add(p));
|
|
416
|
+
t2.s.forEach((n) => t1.s.add(n));
|
|
419
417
|
t1.merge(t2);
|
|
420
|
-
t2.
|
|
418
|
+
t2.u = t1;
|
|
421
419
|
}
|
|
422
420
|
function getTransitionSource(input) {
|
|
423
421
|
return ActiveTransition && ActiveTransition.a.get(input) || input;
|
|
424
422
|
}
|
|
423
|
+
function getQueue(node) {
|
|
424
|
+
var _a;
|
|
425
|
+
const transition2 = (_a = node.e) == null ? void 0 : _a.j;
|
|
426
|
+
return transition2 && transition2.r.get(node.B) || node.B;
|
|
427
|
+
}
|
|
425
428
|
function initialDispose(node) {
|
|
426
|
-
let current = node.
|
|
429
|
+
let current = node.m;
|
|
427
430
|
while (current !== null && current.k === node) {
|
|
428
431
|
initialDispose(current);
|
|
429
432
|
const clone = ActiveTransition.a.get(current);
|
|
430
433
|
if (clone && !clone.Y)
|
|
431
434
|
clone.dispose(true);
|
|
432
|
-
current = current.
|
|
435
|
+
current = current.m;
|
|
433
436
|
}
|
|
434
437
|
}
|
|
435
438
|
function finishTransition(transition2) {
|
|
436
|
-
if (transition2.
|
|
439
|
+
if (transition2.u || transition2.X || transition2.H.size || transition2.s.size)
|
|
437
440
|
return;
|
|
438
441
|
globalQueue.g[0].push.apply(globalQueue.g[0], transition2.g[0]);
|
|
439
442
|
globalQueue.g[1].push.apply(globalQueue.g[1], transition2.g[1]);
|
|
@@ -450,21 +453,21 @@ function finishTransition(transition2) {
|
|
|
450
453
|
source.emptyDisposal();
|
|
451
454
|
delete clone.Y;
|
|
452
455
|
} else {
|
|
456
|
+
delete clone.m;
|
|
453
457
|
delete clone.n;
|
|
454
|
-
delete clone.o;
|
|
455
458
|
}
|
|
456
459
|
Object.assign(source, clone);
|
|
457
460
|
delete source.e;
|
|
458
|
-
let current = clone.
|
|
459
|
-
if ((current == null ? void 0 : current.
|
|
460
|
-
current.
|
|
461
|
+
let current = clone.m;
|
|
462
|
+
if ((current == null ? void 0 : current.w) === clone)
|
|
463
|
+
current.w = source;
|
|
461
464
|
while ((current == null ? void 0 : current.k) === clone) {
|
|
462
465
|
current.k = source;
|
|
463
|
-
current = current.
|
|
466
|
+
current = current.m;
|
|
464
467
|
}
|
|
465
468
|
delete source.j;
|
|
466
469
|
}
|
|
467
|
-
transition2.
|
|
470
|
+
transition2.u = true;
|
|
468
471
|
for (const reset of transition2.W) {
|
|
469
472
|
delete reset.j;
|
|
470
473
|
reset();
|
|
@@ -488,12 +491,12 @@ var Owner = class {
|
|
|
488
491
|
// However, the children are actually added in reverse creation order
|
|
489
492
|
// See comment at the top of the file for an example of the _nextSibling traversal
|
|
490
493
|
k = null;
|
|
491
|
-
|
|
492
|
-
|
|
494
|
+
m = null;
|
|
495
|
+
w = null;
|
|
493
496
|
c = STATE_CLEAN;
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
+
n = null;
|
|
498
|
+
x = defaultContext;
|
|
499
|
+
B = globalQueue;
|
|
497
500
|
fa = 0;
|
|
498
501
|
id = null;
|
|
499
502
|
constructor(id = null, skipAppend = false) {
|
|
@@ -504,58 +507,58 @@ var Owner = class {
|
|
|
504
507
|
}
|
|
505
508
|
append(child) {
|
|
506
509
|
child.k = this;
|
|
507
|
-
child.
|
|
508
|
-
if (this.
|
|
509
|
-
this.
|
|
510
|
-
child.
|
|
511
|
-
this.
|
|
510
|
+
child.w = this;
|
|
511
|
+
if (this.m)
|
|
512
|
+
this.m.w = child;
|
|
513
|
+
child.m = this.m;
|
|
514
|
+
this.m = child;
|
|
512
515
|
if (this.id != null && child.id == null)
|
|
513
516
|
child.id = this.getNextChildId();
|
|
514
|
-
if (child.
|
|
515
|
-
child.
|
|
517
|
+
if (child.x !== this.x) {
|
|
518
|
+
child.x = { ...this.x, ...child.x };
|
|
516
519
|
}
|
|
517
|
-
if (this.
|
|
518
|
-
child.
|
|
520
|
+
if (this.B)
|
|
521
|
+
child.B = this.B;
|
|
519
522
|
}
|
|
520
523
|
dispose(self = true) {
|
|
521
524
|
if (this.c === STATE_DISPOSED)
|
|
522
525
|
return;
|
|
523
|
-
let head = self ? this.
|
|
526
|
+
let head = self ? this.w || this.k : this, current = this.m, next = null;
|
|
524
527
|
while (current && current.k === this) {
|
|
525
528
|
current.dispose(true);
|
|
526
|
-
next = current.
|
|
527
|
-
current.
|
|
529
|
+
next = current.m;
|
|
530
|
+
current.m = null;
|
|
528
531
|
current = next;
|
|
529
532
|
}
|
|
530
533
|
this.fa = 0;
|
|
531
534
|
if (self)
|
|
532
535
|
this.R();
|
|
533
536
|
if (current)
|
|
534
|
-
current.
|
|
537
|
+
current.w = !self ? this : this.w;
|
|
535
538
|
if (head)
|
|
536
|
-
head.
|
|
539
|
+
head.m = current;
|
|
537
540
|
}
|
|
538
541
|
R() {
|
|
539
|
-
if (this.
|
|
540
|
-
this.
|
|
542
|
+
if (this.w)
|
|
543
|
+
this.w.m = null;
|
|
541
544
|
this.k = null;
|
|
542
|
-
this.
|
|
543
|
-
this.
|
|
545
|
+
this.w = null;
|
|
546
|
+
this.x = defaultContext;
|
|
544
547
|
this.c = STATE_DISPOSED;
|
|
545
548
|
this.emptyDisposal();
|
|
546
549
|
}
|
|
547
550
|
emptyDisposal() {
|
|
548
|
-
if (!this.
|
|
551
|
+
if (!this.n)
|
|
549
552
|
return;
|
|
550
|
-
if (Array.isArray(this.
|
|
551
|
-
for (let i = 0; i < this.
|
|
552
|
-
const callable = this.
|
|
553
|
+
if (Array.isArray(this.n)) {
|
|
554
|
+
for (let i = 0; i < this.n.length; i++) {
|
|
555
|
+
const callable = this.n[i];
|
|
553
556
|
callable.call(callable);
|
|
554
557
|
}
|
|
555
558
|
} else {
|
|
556
|
-
this.
|
|
559
|
+
this.n.call(this.n);
|
|
557
560
|
}
|
|
558
|
-
this.
|
|
561
|
+
this.n = null;
|
|
559
562
|
}
|
|
560
563
|
getNextChildId() {
|
|
561
564
|
if (this.id != null)
|
|
@@ -570,7 +573,7 @@ function getContext(context, owner = currentOwner) {
|
|
|
570
573
|
if (!owner) {
|
|
571
574
|
throw new NoOwnerError();
|
|
572
575
|
}
|
|
573
|
-
const value = hasContext(context, owner) ? owner.
|
|
576
|
+
const value = hasContext(context, owner) ? owner.x[context.id] : context.defaultValue;
|
|
574
577
|
if (isUndefined(value)) {
|
|
575
578
|
throw new ContextNotFoundError();
|
|
576
579
|
}
|
|
@@ -580,24 +583,24 @@ function setContext(context, value, owner = currentOwner) {
|
|
|
580
583
|
if (!owner) {
|
|
581
584
|
throw new NoOwnerError();
|
|
582
585
|
}
|
|
583
|
-
owner.
|
|
584
|
-
...owner.
|
|
586
|
+
owner.x = {
|
|
587
|
+
...owner.x,
|
|
585
588
|
[context.id]: isUndefined(value) ? context.defaultValue : value
|
|
586
589
|
};
|
|
587
590
|
}
|
|
588
591
|
function hasContext(context, owner = currentOwner) {
|
|
589
|
-
return !isUndefined(owner == null ? void 0 : owner.
|
|
592
|
+
return !isUndefined(owner == null ? void 0 : owner.x[context.id]);
|
|
590
593
|
}
|
|
591
594
|
function onCleanup(fn) {
|
|
592
595
|
if (!currentOwner)
|
|
593
596
|
return fn;
|
|
594
597
|
const node = currentOwner;
|
|
595
|
-
if (!node.
|
|
596
|
-
node.
|
|
597
|
-
} else if (Array.isArray(node.
|
|
598
|
-
node.
|
|
598
|
+
if (!node.n) {
|
|
599
|
+
node.n = fn;
|
|
600
|
+
} else if (Array.isArray(node.n)) {
|
|
601
|
+
node.n.push(fn);
|
|
599
602
|
} else {
|
|
600
|
-
node.
|
|
603
|
+
node.n = [node.n, fn];
|
|
601
604
|
}
|
|
602
605
|
return fn;
|
|
603
606
|
}
|
|
@@ -640,7 +643,7 @@ var Computation = class extends Owner {
|
|
|
640
643
|
/** Which flags raised by sources are handled, vs. being passed through. */
|
|
641
644
|
ba = DEFAULT_FLAGS;
|
|
642
645
|
N = -1;
|
|
643
|
-
|
|
646
|
+
D = false;
|
|
644
647
|
j;
|
|
645
648
|
e;
|
|
646
649
|
constructor(initialValue, compute2, options) {
|
|
@@ -735,7 +738,7 @@ var Computation = class extends Owner {
|
|
|
735
738
|
if (this.b) {
|
|
736
739
|
for (let i = 0; i < this.b.length; i++) {
|
|
737
740
|
if (valueChanged) {
|
|
738
|
-
this.b[i].
|
|
741
|
+
this.b[i].y(STATE_DIRTY);
|
|
739
742
|
} else if (changedFlagsMask) {
|
|
740
743
|
this.b[i].Z(changedFlagsMask, changedFlags);
|
|
741
744
|
}
|
|
@@ -746,14 +749,14 @@ var Computation = class extends Owner {
|
|
|
746
749
|
/**
|
|
747
750
|
* Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
|
|
748
751
|
*/
|
|
749
|
-
|
|
750
|
-
if (this.c >= state && !this.
|
|
752
|
+
y(state, skipQueue) {
|
|
753
|
+
if (this.c >= state && !this.D)
|
|
751
754
|
return;
|
|
752
|
-
this.
|
|
755
|
+
this.D = !!skipQueue;
|
|
753
756
|
this.c = state;
|
|
754
757
|
if (this.b) {
|
|
755
758
|
for (let i = 0; i < this.b.length; i++) {
|
|
756
|
-
this.b[i].
|
|
759
|
+
this.b[i].y(STATE_CHECK, skipQueue);
|
|
757
760
|
}
|
|
758
761
|
}
|
|
759
762
|
}
|
|
@@ -767,15 +770,15 @@ var Computation = class extends Owner {
|
|
|
767
770
|
if (this.c >= STATE_DIRTY)
|
|
768
771
|
return;
|
|
769
772
|
if (mask & this.ba) {
|
|
770
|
-
this.
|
|
773
|
+
this.y(STATE_DIRTY);
|
|
771
774
|
return;
|
|
772
775
|
}
|
|
773
|
-
if (this.c >= STATE_CHECK)
|
|
776
|
+
if (this.c >= STATE_CHECK && !this.D)
|
|
774
777
|
return;
|
|
775
778
|
const prevFlags = this.h & mask;
|
|
776
779
|
const deltaFlags = prevFlags ^ newFlags2;
|
|
777
780
|
if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
|
|
778
|
-
this.
|
|
781
|
+
this.y(STATE_CHECK);
|
|
779
782
|
} else {
|
|
780
783
|
this.h ^= deltaFlags;
|
|
781
784
|
if (this.b) {
|
|
@@ -785,11 +788,11 @@ var Computation = class extends Owner {
|
|
|
785
788
|
}
|
|
786
789
|
}
|
|
787
790
|
}
|
|
788
|
-
|
|
791
|
+
E(error) {
|
|
789
792
|
if (ActiveTransition && !this.e) {
|
|
790
793
|
const clone = cloneGraph(this);
|
|
791
794
|
if (clone !== this)
|
|
792
|
-
return clone.
|
|
795
|
+
return clone.E(error);
|
|
793
796
|
}
|
|
794
797
|
this.L = error;
|
|
795
798
|
this.write(UNCHANGED, this.h & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
|
|
@@ -874,7 +877,7 @@ function update(node) {
|
|
|
874
877
|
if (error instanceof NotReadyError) {
|
|
875
878
|
node.write(UNCHANGED, newFlags | LOADING_BIT | node.h & UNINITIALIZED_BIT);
|
|
876
879
|
} else {
|
|
877
|
-
node.
|
|
880
|
+
node.E(error);
|
|
878
881
|
}
|
|
879
882
|
} finally {
|
|
880
883
|
if (newSources) {
|
|
@@ -978,7 +981,7 @@ function runWithObserver(observer, run) {
|
|
|
978
981
|
newFlags | LOADING_BIT | observer.h & UNINITIALIZED_BIT
|
|
979
982
|
);
|
|
980
983
|
} else {
|
|
981
|
-
observer.
|
|
984
|
+
observer.E(error);
|
|
982
985
|
}
|
|
983
986
|
} finally {
|
|
984
987
|
if (newSources) {
|
|
@@ -1035,17 +1038,17 @@ var Effect = class extends Computation {
|
|
|
1035
1038
|
this.C = (options == null ? void 0 : options.render) ? EFFECT_RENDER : EFFECT_USER;
|
|
1036
1039
|
if (this.C === EFFECT_RENDER) {
|
|
1037
1040
|
this.M = function(p) {
|
|
1038
|
-
return !this.e && clock > this.
|
|
1041
|
+
return !this.e && clock > this.B.created && !(this.h & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
|
|
1039
1042
|
};
|
|
1040
1043
|
}
|
|
1041
1044
|
this.K();
|
|
1042
|
-
!(options == null ? void 0 : options.defer) && (this.C === EFFECT_USER ? this.
|
|
1045
|
+
!(options == null ? void 0 : options.defer) && (this.C === EFFECT_USER ? getQueue(this).enqueue(this.C, this.F.bind(this)) : this.F(this.C));
|
|
1043
1046
|
}
|
|
1044
1047
|
write(value, flags = 0) {
|
|
1045
1048
|
if (this.c == STATE_DIRTY) {
|
|
1046
1049
|
this.h = flags;
|
|
1047
1050
|
if (this.C === EFFECT_RENDER) {
|
|
1048
|
-
this.
|
|
1051
|
+
getQueue(this).notify(this, LOADING_BIT | ERROR_BIT, this.h);
|
|
1049
1052
|
}
|
|
1050
1053
|
}
|
|
1051
1054
|
if (value === UNCHANGED)
|
|
@@ -1055,11 +1058,11 @@ var Effect = class extends Computation {
|
|
|
1055
1058
|
this.L = void 0;
|
|
1056
1059
|
return value;
|
|
1057
1060
|
}
|
|
1058
|
-
|
|
1061
|
+
y(state, skipQueue) {
|
|
1059
1062
|
if (this.c >= state || skipQueue)
|
|
1060
1063
|
return;
|
|
1061
1064
|
if (this.c === STATE_CLEAN)
|
|
1062
|
-
this.
|
|
1065
|
+
getQueue(this).enqueue(this.C, this.F.bind(this));
|
|
1063
1066
|
this.c = state;
|
|
1064
1067
|
}
|
|
1065
1068
|
Z(mask, newFlags2) {
|
|
@@ -1067,15 +1070,15 @@ var Effect = class extends Computation {
|
|
|
1067
1070
|
if (this.c >= STATE_DIRTY)
|
|
1068
1071
|
return;
|
|
1069
1072
|
if (mask & 3) {
|
|
1070
|
-
this.
|
|
1073
|
+
this.y(STATE_DIRTY);
|
|
1071
1074
|
return;
|
|
1072
1075
|
}
|
|
1073
1076
|
}
|
|
1074
1077
|
super.Z(mask, newFlags2);
|
|
1075
1078
|
}
|
|
1076
|
-
|
|
1079
|
+
E(error) {
|
|
1077
1080
|
this.L = error;
|
|
1078
|
-
this.
|
|
1081
|
+
getQueue(this).notify(this, LOADING_BIT, 0);
|
|
1079
1082
|
this.h = ERROR_BIT;
|
|
1080
1083
|
if (this.C === EFFECT_USER) {
|
|
1081
1084
|
try {
|
|
@@ -1088,7 +1091,7 @@ var Effect = class extends Computation {
|
|
|
1088
1091
|
error = e;
|
|
1089
1092
|
}
|
|
1090
1093
|
}
|
|
1091
|
-
if (!this.
|
|
1094
|
+
if (!getQueue(this).notify(this, ERROR_BIT, ERROR_BIT))
|
|
1092
1095
|
throw error;
|
|
1093
1096
|
}
|
|
1094
1097
|
R() {
|
|
@@ -1100,10 +1103,10 @@ var Effect = class extends Computation {
|
|
|
1100
1103
|
this._ = void 0;
|
|
1101
1104
|
(_a = this.O) == null ? void 0 : _a.call(this);
|
|
1102
1105
|
this.O = void 0;
|
|
1103
|
-
this.
|
|
1106
|
+
getQueue(this).notify(this, ERROR_BIT | LOADING_BIT, 0);
|
|
1104
1107
|
super.R();
|
|
1105
1108
|
}
|
|
1106
|
-
|
|
1109
|
+
F(type) {
|
|
1107
1110
|
var _a;
|
|
1108
1111
|
if (type) {
|
|
1109
1112
|
const effect = this.e || this;
|
|
@@ -1112,7 +1115,7 @@ var Effect = class extends Computation {
|
|
|
1112
1115
|
try {
|
|
1113
1116
|
effect.O = effect.ca(effect.l, effect.$);
|
|
1114
1117
|
} catch (e) {
|
|
1115
|
-
if (!effect.
|
|
1118
|
+
if (!getQueue(effect).notify(effect, ERROR_BIT, ERROR_BIT))
|
|
1116
1119
|
throw e;
|
|
1117
1120
|
} finally {
|
|
1118
1121
|
effect.$ = effect.l;
|
|
@@ -1128,14 +1131,14 @@ var EagerComputation = class extends Computation {
|
|
|
1128
1131
|
super(initialValue, compute2, options);
|
|
1129
1132
|
!(options == null ? void 0 : options.defer) && this.K();
|
|
1130
1133
|
}
|
|
1131
|
-
|
|
1132
|
-
if (this.c >= state && !this.
|
|
1134
|
+
y(state, skipQueue) {
|
|
1135
|
+
if (this.c >= state && !this.D)
|
|
1133
1136
|
return;
|
|
1134
|
-
if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.
|
|
1135
|
-
this.
|
|
1136
|
-
super.
|
|
1137
|
+
if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.D))
|
|
1138
|
+
getQueue(this).enqueue(EFFECT_PURE, this.F.bind(this));
|
|
1139
|
+
super.y(state, skipQueue);
|
|
1137
1140
|
}
|
|
1138
|
-
|
|
1141
|
+
F() {
|
|
1139
1142
|
this.c !== STATE_CLEAN && runTop(this);
|
|
1140
1143
|
}
|
|
1141
1144
|
};
|
|
@@ -1144,15 +1147,15 @@ var FirewallComputation = class extends Computation {
|
|
|
1144
1147
|
constructor(compute2) {
|
|
1145
1148
|
super(void 0, compute2);
|
|
1146
1149
|
}
|
|
1147
|
-
|
|
1148
|
-
if (this.c >= state && !this.
|
|
1150
|
+
y(state, skipQueue) {
|
|
1151
|
+
if (this.c >= state && !this.D)
|
|
1149
1152
|
return;
|
|
1150
|
-
if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.
|
|
1151
|
-
this.
|
|
1152
|
-
super.
|
|
1153
|
-
this.
|
|
1153
|
+
if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.D))
|
|
1154
|
+
getQueue(this).enqueue(EFFECT_PURE, this.F.bind(this));
|
|
1155
|
+
super.y(state, true);
|
|
1156
|
+
this.D = !!skipQueue;
|
|
1154
1157
|
}
|
|
1155
|
-
|
|
1158
|
+
F() {
|
|
1156
1159
|
this.c !== STATE_CLEAN && runTop(this);
|
|
1157
1160
|
}
|
|
1158
1161
|
};
|
|
@@ -1868,7 +1871,7 @@ function createMemo(compute2, value, options) {
|
|
|
1868
1871
|
return resolvedValue;
|
|
1869
1872
|
}
|
|
1870
1873
|
resolvedValue = node.wait();
|
|
1871
|
-
if (!((_a = node.a) == null ? void 0 : _a.length) && ((_b = node.
|
|
1874
|
+
if (!((_a = node.a) == null ? void 0 : _a.length) && ((_b = node.m) == null ? void 0 : _b.k) !== node && !(node.h & UNINITIALIZED_BIT)) {
|
|
1872
1875
|
node.dispose();
|
|
1873
1876
|
node = void 0;
|
|
1874
1877
|
}
|
|
@@ -1906,8 +1909,8 @@ function createAsync(compute2, value, options) {
|
|
|
1906
1909
|
if (abort)
|
|
1907
1910
|
return;
|
|
1908
1911
|
if (transition2)
|
|
1909
|
-
return transition2.runTransition(() => node.
|
|
1910
|
-
node.
|
|
1912
|
+
return transition2.runTransition(() => node.E(error), true);
|
|
1913
|
+
node.E(error);
|
|
1911
1914
|
}
|
|
1912
1915
|
);
|
|
1913
1916
|
} else {
|
|
@@ -1928,10 +1931,10 @@ function createAsync(compute2, value, options) {
|
|
|
1928
1931
|
return;
|
|
1929
1932
|
if (transition2)
|
|
1930
1933
|
return transition2.runTransition(() => {
|
|
1931
|
-
node.
|
|
1934
|
+
node.E(error);
|
|
1932
1935
|
transition2 = null;
|
|
1933
1936
|
}, true);
|
|
1934
|
-
node.
|
|
1937
|
+
node.E(error);
|
|
1935
1938
|
}
|
|
1936
1939
|
})();
|
|
1937
1940
|
}
|
|
@@ -2026,11 +2029,11 @@ function createOptimistic(first, second, options) {
|
|
|
2026
2029
|
} else
|
|
2027
2030
|
[store, setStore] = createStore(first);
|
|
2028
2031
|
const reset = () => setStore(
|
|
2029
|
-
|
|
2030
|
-
|
|
2032
|
+
reconcile(
|
|
2033
|
+
typeof first === "function" ? first(second) : first,
|
|
2031
2034
|
(options == null ? void 0 : options.key) || "id",
|
|
2032
2035
|
options == null ? void 0 : options.all
|
|
2033
|
-
)
|
|
2036
|
+
)
|
|
2034
2037
|
);
|
|
2035
2038
|
function write(v) {
|
|
2036
2039
|
if (!ActiveTransition)
|
|
@@ -2046,15 +2049,15 @@ function mapArray(list, map, options) {
|
|
|
2046
2049
|
const keyFn = typeof (options == null ? void 0 : options.keyed) === "function" ? options.keyed : void 0;
|
|
2047
2050
|
return updateKeyedMap.bind({
|
|
2048
2051
|
S: new Owner(),
|
|
2049
|
-
|
|
2052
|
+
o: 0,
|
|
2050
2053
|
ia: list,
|
|
2051
|
-
|
|
2054
|
+
G: [],
|
|
2052
2055
|
P: map,
|
|
2053
2056
|
i: [],
|
|
2054
2057
|
d: [],
|
|
2055
2058
|
Q: keyFn,
|
|
2056
|
-
|
|
2057
|
-
|
|
2059
|
+
p: keyFn || (options == null ? void 0 : options.keyed) === false ? [] : void 0,
|
|
2060
|
+
q: map.length > 1 ? [] : void 0,
|
|
2058
2061
|
T: options == null ? void 0 : options.fallback
|
|
2059
2062
|
});
|
|
2060
2063
|
}
|
|
@@ -2063,30 +2066,30 @@ function updateKeyedMap() {
|
|
|
2063
2066
|
const newItems = this.ia() || [], newLen = newItems.length;
|
|
2064
2067
|
newItems[$TRACK];
|
|
2065
2068
|
runWithOwner(this.S, () => {
|
|
2066
|
-
let i, j, mapper = this.
|
|
2067
|
-
this.
|
|
2068
|
-
this.
|
|
2069
|
+
let i, j, mapper = this.p ? () => {
|
|
2070
|
+
this.p[j] = new Computation(newItems[j], null, pureOptions);
|
|
2071
|
+
this.q && (this.q[j] = new Computation(j, null, pureOptions));
|
|
2069
2072
|
return this.P(
|
|
2070
|
-
Computation.prototype.read.bind(this.
|
|
2071
|
-
this.
|
|
2073
|
+
Computation.prototype.read.bind(this.p[j]),
|
|
2074
|
+
this.q ? Computation.prototype.read.bind(this.q[j]) : void 0
|
|
2072
2075
|
);
|
|
2073
|
-
} : this.
|
|
2076
|
+
} : this.q ? () => {
|
|
2074
2077
|
const item = newItems[j];
|
|
2075
|
-
this.
|
|
2076
|
-
return this.P(() => item, Computation.prototype.read.bind(this.
|
|
2078
|
+
this.q[j] = new Computation(j, null, pureOptions);
|
|
2079
|
+
return this.P(() => item, Computation.prototype.read.bind(this.q[j]));
|
|
2077
2080
|
} : () => {
|
|
2078
2081
|
const item = newItems[j];
|
|
2079
2082
|
return this.P(() => item);
|
|
2080
2083
|
};
|
|
2081
2084
|
if (newLen === 0) {
|
|
2082
|
-
if (this.
|
|
2085
|
+
if (this.o !== 0) {
|
|
2083
2086
|
this.S.dispose(false);
|
|
2084
2087
|
this.d = [];
|
|
2085
|
-
this.
|
|
2088
|
+
this.G = [];
|
|
2086
2089
|
this.i = [];
|
|
2087
|
-
this.
|
|
2088
|
-
this.
|
|
2089
|
-
this.
|
|
2090
|
+
this.o = 0;
|
|
2091
|
+
this.p && (this.p = []);
|
|
2092
|
+
this.q && (this.q = []);
|
|
2090
2093
|
}
|
|
2091
2094
|
if (this.T && !this.i[0]) {
|
|
2092
2095
|
this.i[0] = compute(
|
|
@@ -2095,26 +2098,26 @@ function updateKeyedMap() {
|
|
|
2095
2098
|
null
|
|
2096
2099
|
);
|
|
2097
2100
|
}
|
|
2098
|
-
} else if (this.
|
|
2101
|
+
} else if (this.o === 0) {
|
|
2099
2102
|
if (this.d[0])
|
|
2100
2103
|
this.d[0].dispose();
|
|
2101
2104
|
this.i = new Array(newLen);
|
|
2102
2105
|
for (j = 0; j < newLen; j++) {
|
|
2103
|
-
this.
|
|
2106
|
+
this.G[j] = newItems[j];
|
|
2104
2107
|
this.i[j] = compute(this.d[j] = new Owner(), mapper, null);
|
|
2105
2108
|
}
|
|
2106
|
-
this.
|
|
2109
|
+
this.o = newLen;
|
|
2107
2110
|
} else {
|
|
2108
|
-
let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.
|
|
2109
|
-
for (start = 0, end = Math.min(this.
|
|
2110
|
-
if (this.
|
|
2111
|
-
this.
|
|
2111
|
+
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;
|
|
2112
|
+
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++) {
|
|
2113
|
+
if (this.p)
|
|
2114
|
+
this.p[start].write(newItems[start]);
|
|
2112
2115
|
}
|
|
2113
|
-
for (end = this.
|
|
2116
|
+
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--) {
|
|
2114
2117
|
temp[newEnd] = this.i[end];
|
|
2115
2118
|
tempNodes[newEnd] = this.d[end];
|
|
2116
|
-
tempRows && (tempRows[newEnd] = this.
|
|
2117
|
-
tempIndexes && (tempIndexes[newEnd] = this.
|
|
2119
|
+
tempRows && (tempRows[newEnd] = this.p[end]);
|
|
2120
|
+
tempIndexes && (tempIndexes[newEnd] = this.q[end]);
|
|
2118
2121
|
}
|
|
2119
2122
|
newIndices = /* @__PURE__ */ new Map();
|
|
2120
2123
|
newIndicesNext = new Array(newEnd + 1);
|
|
@@ -2126,14 +2129,14 @@ function updateKeyedMap() {
|
|
|
2126
2129
|
newIndices.set(key, j);
|
|
2127
2130
|
}
|
|
2128
2131
|
for (i = start; i <= end; i++) {
|
|
2129
|
-
item = this.
|
|
2132
|
+
item = this.G[i];
|
|
2130
2133
|
key = this.Q ? this.Q(item) : item;
|
|
2131
2134
|
j = newIndices.get(key);
|
|
2132
2135
|
if (j !== void 0 && j !== -1) {
|
|
2133
2136
|
temp[j] = this.i[i];
|
|
2134
2137
|
tempNodes[j] = this.d[i];
|
|
2135
|
-
tempRows && (tempRows[j] = this.
|
|
2136
|
-
tempIndexes && (tempIndexes[j] = this.
|
|
2138
|
+
tempRows && (tempRows[j] = this.p[i]);
|
|
2139
|
+
tempIndexes && (tempIndexes[j] = this.q[i]);
|
|
2137
2140
|
j = newIndicesNext[j];
|
|
2138
2141
|
newIndices.set(key, j);
|
|
2139
2142
|
} else
|
|
@@ -2144,19 +2147,19 @@ function updateKeyedMap() {
|
|
|
2144
2147
|
this.i[j] = temp[j];
|
|
2145
2148
|
this.d[j] = tempNodes[j];
|
|
2146
2149
|
if (tempRows) {
|
|
2147
|
-
this.
|
|
2148
|
-
this.
|
|
2150
|
+
this.p[j] = tempRows[j];
|
|
2151
|
+
this.p[j].write(newItems[j]);
|
|
2149
2152
|
}
|
|
2150
2153
|
if (tempIndexes) {
|
|
2151
|
-
this.
|
|
2152
|
-
this.
|
|
2154
|
+
this.q[j] = tempIndexes[j];
|
|
2155
|
+
this.q[j].write(j);
|
|
2153
2156
|
}
|
|
2154
2157
|
} else {
|
|
2155
2158
|
this.i[j] = compute(this.d[j] = new Owner(), mapper, null);
|
|
2156
2159
|
}
|
|
2157
2160
|
}
|
|
2158
|
-
this.i = this.i.slice(0, this.
|
|
2159
|
-
this.
|
|
2161
|
+
this.i = this.i.slice(0, this.o = newLen);
|
|
2162
|
+
this.G = newItems.slice(0);
|
|
2160
2163
|
}
|
|
2161
2164
|
});
|
|
2162
2165
|
return this.i;
|
|
@@ -2164,8 +2167,8 @@ function updateKeyedMap() {
|
|
|
2164
2167
|
function repeat(count, map, options) {
|
|
2165
2168
|
return updateRepeat.bind({
|
|
2166
2169
|
S: new Owner(),
|
|
2167
|
-
|
|
2168
|
-
|
|
2170
|
+
o: 0,
|
|
2171
|
+
z: 0,
|
|
2169
2172
|
ja: count,
|
|
2170
2173
|
P: map,
|
|
2171
2174
|
d: [],
|
|
@@ -2180,11 +2183,11 @@ function updateRepeat() {
|
|
|
2180
2183
|
const from = ((_a = this.ka) == null ? void 0 : _a.call(this)) || 0;
|
|
2181
2184
|
runWithOwner(this.S, () => {
|
|
2182
2185
|
if (newLen === 0) {
|
|
2183
|
-
if (this.
|
|
2186
|
+
if (this.o !== 0) {
|
|
2184
2187
|
this.S.dispose(false);
|
|
2185
2188
|
this.d = [];
|
|
2186
2189
|
this.i = [];
|
|
2187
|
-
this.
|
|
2190
|
+
this.o = 0;
|
|
2188
2191
|
}
|
|
2189
2192
|
if (this.T && !this.i[0]) {
|
|
2190
2193
|
this.i[0] = compute(
|
|
@@ -2196,20 +2199,20 @@ function updateRepeat() {
|
|
|
2196
2199
|
return;
|
|
2197
2200
|
}
|
|
2198
2201
|
const to = from + newLen;
|
|
2199
|
-
const prevTo = this.
|
|
2200
|
-
if (this.
|
|
2202
|
+
const prevTo = this.z + this.o;
|
|
2203
|
+
if (this.o === 0 && this.d[0])
|
|
2201
2204
|
this.d[0].dispose();
|
|
2202
2205
|
for (let i = to; i < prevTo; i++)
|
|
2203
|
-
this.d[i - this.
|
|
2204
|
-
if (this.
|
|
2205
|
-
let i = this.
|
|
2206
|
-
while (i < from && i < this.
|
|
2206
|
+
this.d[i - this.z].dispose();
|
|
2207
|
+
if (this.z < from) {
|
|
2208
|
+
let i = this.z;
|
|
2209
|
+
while (i < from && i < this.o)
|
|
2207
2210
|
this.d[i++].dispose();
|
|
2208
|
-
this.d.splice(0, from - this.
|
|
2209
|
-
this.i.splice(0, from - this.
|
|
2210
|
-
} else if (this.
|
|
2211
|
-
let i = prevTo - this.
|
|
2212
|
-
let difference = this.
|
|
2211
|
+
this.d.splice(0, from - this.z);
|
|
2212
|
+
this.i.splice(0, from - this.z);
|
|
2213
|
+
} else if (this.z > from) {
|
|
2214
|
+
let i = prevTo - this.z - 1;
|
|
2215
|
+
let difference = this.z - from;
|
|
2213
2216
|
this.d.length = this.i.length = newLen;
|
|
2214
2217
|
while (i >= difference) {
|
|
2215
2218
|
this.d[i] = this.d[i - difference];
|
|
@@ -2232,8 +2235,8 @@ function updateRepeat() {
|
|
|
2232
2235
|
);
|
|
2233
2236
|
}
|
|
2234
2237
|
this.i = this.i.slice(0, newLen);
|
|
2235
|
-
this.
|
|
2236
|
-
this.
|
|
2238
|
+
this.z = from;
|
|
2239
|
+
this.o = newLen;
|
|
2237
2240
|
});
|
|
2238
2241
|
return this.i;
|
|
2239
2242
|
}
|
|
@@ -2253,14 +2256,14 @@ var BoundaryComputation = class extends EagerComputation {
|
|
|
2253
2256
|
if (this.U & LOADING_BIT && !(this.h & UNINITIALIZED_BIT || ActiveTransition)) {
|
|
2254
2257
|
flags &= ~LOADING_BIT;
|
|
2255
2258
|
}
|
|
2256
|
-
this.
|
|
2259
|
+
getQueue(this).notify(this, this.U, flags);
|
|
2257
2260
|
return this.l;
|
|
2258
2261
|
}
|
|
2259
2262
|
};
|
|
2260
2263
|
function createBoundChildren(owner, fn, queue, mask) {
|
|
2261
|
-
const parentQueue = owner.
|
|
2262
|
-
parentQueue.addChild(owner.
|
|
2263
|
-
onCleanup(() => parentQueue.removeChild(owner.
|
|
2264
|
+
const parentQueue = owner.B;
|
|
2265
|
+
parentQueue.addChild(owner.B = queue);
|
|
2266
|
+
onCleanup(() => parentQueue.removeChild(owner.B));
|
|
2264
2267
|
return compute(
|
|
2265
2268
|
owner,
|
|
2266
2269
|
() => {
|
|
@@ -2271,27 +2274,27 @@ function createBoundChildren(owner, fn, queue, mask) {
|
|
|
2271
2274
|
);
|
|
2272
2275
|
}
|
|
2273
2276
|
var ConditionalQueue = class extends Queue {
|
|
2274
|
-
|
|
2277
|
+
t;
|
|
2275
2278
|
V = /* @__PURE__ */ new Set();
|
|
2276
|
-
|
|
2279
|
+
s = /* @__PURE__ */ new Set();
|
|
2277
2280
|
constructor(disabled) {
|
|
2278
2281
|
super();
|
|
2279
|
-
this.
|
|
2282
|
+
this.t = disabled;
|
|
2280
2283
|
}
|
|
2281
2284
|
run(type) {
|
|
2282
|
-
if (!type || this.
|
|
2285
|
+
if (!type || this.t.read())
|
|
2283
2286
|
return;
|
|
2284
2287
|
return super.run(type);
|
|
2285
2288
|
}
|
|
2286
2289
|
notify(node, type, flags) {
|
|
2287
|
-
if (ActiveTransition && ActiveTransition.
|
|
2288
|
-
return ActiveTransition.
|
|
2289
|
-
if (this.
|
|
2290
|
+
if (ActiveTransition && ActiveTransition.r.has(this))
|
|
2291
|
+
return ActiveTransition.r.get(this).notify(node, type, flags);
|
|
2292
|
+
if (this.t.read()) {
|
|
2290
2293
|
if (type & LOADING_BIT) {
|
|
2291
2294
|
if (flags & LOADING_BIT) {
|
|
2292
|
-
this.
|
|
2295
|
+
this.s.add(node);
|
|
2293
2296
|
type &= ~LOADING_BIT;
|
|
2294
|
-
} else if (this.
|
|
2297
|
+
} else if (this.s.delete(node))
|
|
2295
2298
|
type &= ~LOADING_BIT;
|
|
2296
2299
|
}
|
|
2297
2300
|
if (type & ERROR_BIT) {
|
|
@@ -2305,43 +2308,43 @@ var ConditionalQueue = class extends Queue {
|
|
|
2305
2308
|
return type ? super.notify(node, type, flags) : true;
|
|
2306
2309
|
}
|
|
2307
2310
|
merge(queue) {
|
|
2308
|
-
queue.
|
|
2311
|
+
queue.s.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
|
|
2309
2312
|
queue.V.forEach((n) => this.notify(n, ERROR_BIT, ERROR_BIT));
|
|
2310
2313
|
super.merge(queue);
|
|
2311
2314
|
}
|
|
2312
2315
|
};
|
|
2313
2316
|
var CollectionQueue = class extends Queue {
|
|
2314
|
-
|
|
2317
|
+
J;
|
|
2315
2318
|
d = /* @__PURE__ */ new Set();
|
|
2316
|
-
|
|
2319
|
+
t = new Computation(false, null, { pureWrite: true });
|
|
2317
2320
|
constructor(type) {
|
|
2318
2321
|
super();
|
|
2319
|
-
this.
|
|
2322
|
+
this.J = type;
|
|
2320
2323
|
}
|
|
2321
2324
|
run(type) {
|
|
2322
|
-
if (!type || this.
|
|
2325
|
+
if (!type || this.t.read())
|
|
2323
2326
|
return;
|
|
2324
2327
|
return super.run(type);
|
|
2325
2328
|
}
|
|
2326
2329
|
notify(node, type, flags) {
|
|
2327
|
-
if (ActiveTransition && ActiveTransition.
|
|
2328
|
-
return ActiveTransition.
|
|
2329
|
-
if (!(type & this.
|
|
2330
|
+
if (ActiveTransition && ActiveTransition.r.has(this))
|
|
2331
|
+
return ActiveTransition.r.get(this).notify(node, type, flags);
|
|
2332
|
+
if (!(type & this.J))
|
|
2330
2333
|
return super.notify(node, type, flags);
|
|
2331
|
-
if (flags & this.
|
|
2334
|
+
if (flags & this.J) {
|
|
2332
2335
|
this.d.add(node);
|
|
2333
2336
|
if (this.d.size === 1)
|
|
2334
|
-
this.
|
|
2337
|
+
this.t.write(true);
|
|
2335
2338
|
} else if (this.d.size > 0) {
|
|
2336
2339
|
this.d.delete(node);
|
|
2337
2340
|
if (this.d.size === 0)
|
|
2338
|
-
this.
|
|
2341
|
+
this.t.write(false);
|
|
2339
2342
|
}
|
|
2340
|
-
type &= ~this.
|
|
2343
|
+
type &= ~this.J;
|
|
2341
2344
|
return type ? super.notify(node, type, flags) : true;
|
|
2342
2345
|
}
|
|
2343
2346
|
merge(queue) {
|
|
2344
|
-
queue.d.forEach((n) => this.notify(n, this.
|
|
2347
|
+
queue.d.forEach((n) => this.notify(n, this.J, this.J));
|
|
2345
2348
|
super.merge(queue);
|
|
2346
2349
|
}
|
|
2347
2350
|
};
|
|
@@ -2352,25 +2355,25 @@ function createBoundary(fn, condition) {
|
|
|
2352
2355
|
);
|
|
2353
2356
|
const tree = createBoundChildren(owner, fn, queue, 0);
|
|
2354
2357
|
new EagerComputation(void 0, () => {
|
|
2355
|
-
const disabled = queue.
|
|
2358
|
+
const disabled = queue.t.read();
|
|
2356
2359
|
tree.U = disabled ? ERROR_BIT | LOADING_BIT : 0;
|
|
2357
2360
|
if (!disabled) {
|
|
2358
|
-
queue.
|
|
2361
|
+
queue.s.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
|
|
2359
2362
|
queue.V.forEach((node) => queue.notify(node, ERROR_BIT, ERROR_BIT));
|
|
2360
|
-
queue.
|
|
2363
|
+
queue.s.clear();
|
|
2361
2364
|
queue.V.clear();
|
|
2362
2365
|
}
|
|
2363
2366
|
});
|
|
2364
|
-
return () => queue.
|
|
2367
|
+
return () => queue.t.read() ? void 0 : tree.read();
|
|
2365
2368
|
}
|
|
2366
2369
|
function createCollectionBoundary(type, fn, fallback) {
|
|
2367
2370
|
const owner = new Owner();
|
|
2368
2371
|
const queue = new CollectionQueue(type);
|
|
2369
2372
|
const tree = createBoundChildren(owner, fn, queue, type);
|
|
2370
2373
|
const decision = new Computation(void 0, () => {
|
|
2371
|
-
if (!queue.
|
|
2374
|
+
if (!queue.t.read()) {
|
|
2372
2375
|
const resolved = tree.read();
|
|
2373
|
-
if (!untrack(() => queue.
|
|
2376
|
+
if (!untrack(() => queue.t.read()))
|
|
2374
2377
|
return resolved;
|
|
2375
2378
|
}
|
|
2376
2379
|
return fallback(queue);
|
|
@@ -2384,13 +2387,12 @@ function createErrorBoundary(fn, fallback) {
|
|
|
2384
2387
|
return createCollectionBoundary(ERROR_BIT, fn, (queue) => {
|
|
2385
2388
|
let node = getTransitionSource(queue.d.values().next().value);
|
|
2386
2389
|
return fallback(node.L, () => {
|
|
2387
|
-
var _a;
|
|
2388
2390
|
incrementClock();
|
|
2389
2391
|
for (let node2 of queue.d) {
|
|
2390
2392
|
if (ActiveTransition && !node2.e)
|
|
2391
2393
|
node2 = cloneGraph(node2);
|
|
2392
2394
|
node2.c = STATE_DIRTY;
|
|
2393
|
-
(
|
|
2395
|
+
getQueue(node2).enqueue(node2.C, node2.F.bind(node2));
|
|
2394
2396
|
}
|
|
2395
2397
|
});
|
|
2396
2398
|
});
|