@solidjs/signals 0.4.4 → 0.4.5
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 +72 -52
- package/dist/node.cjs +348 -328
- package/dist/prod.js +348 -328
- package/dist/types/core/core.d.ts +3 -2
- package/dist/types/core/scheduler.d.ts +2 -2
- package/package.json +1 -1
package/dist/node.cjs
CHANGED
|
@@ -41,7 +41,7 @@ function incrementClock() {
|
|
|
41
41
|
clock++;
|
|
42
42
|
}
|
|
43
43
|
var ActiveTransition = null;
|
|
44
|
-
var
|
|
44
|
+
var Unobserved = [];
|
|
45
45
|
var scheduled = false;
|
|
46
46
|
function schedule() {
|
|
47
47
|
if (scheduled)
|
|
@@ -52,12 +52,12 @@ function schedule() {
|
|
|
52
52
|
}
|
|
53
53
|
function notifyUnobserved() {
|
|
54
54
|
var _a, _b;
|
|
55
|
-
for (let i = 0; i <
|
|
56
|
-
const source =
|
|
57
|
-
if (!source.
|
|
58
|
-
(_b = (_a =
|
|
55
|
+
for (let i = 0; i < Unobserved.length; i++) {
|
|
56
|
+
const source = Unobserved[i];
|
|
57
|
+
if (!source.b || !source.b.length)
|
|
58
|
+
(_b = (_a = Unobserved[i]).da) == null ? void 0 : _b.call(_a);
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
Unobserved = [];
|
|
61
61
|
}
|
|
62
62
|
var pureQueue = [];
|
|
63
63
|
var Queue = class {
|
|
@@ -67,8 +67,8 @@ var Queue = class {
|
|
|
67
67
|
e = [];
|
|
68
68
|
created = clock;
|
|
69
69
|
enqueue(type, fn) {
|
|
70
|
-
if (ActiveTransition && ActiveTransition.
|
|
71
|
-
return ActiveTransition.
|
|
70
|
+
if (ActiveTransition && ActiveTransition.u.has(this))
|
|
71
|
+
return ActiveTransition.u.get(this).enqueue(type, fn);
|
|
72
72
|
pureQueue.push(fn);
|
|
73
73
|
if (type)
|
|
74
74
|
this.f[type - 1].push(fn);
|
|
@@ -100,7 +100,7 @@ var Queue = class {
|
|
|
100
100
|
this.run(EFFECT_USER);
|
|
101
101
|
} finally {
|
|
102
102
|
this.z = false;
|
|
103
|
-
|
|
103
|
+
Unobserved.length && notifyUnobserved();
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
addChild(child) {
|
|
@@ -113,8 +113,8 @@ var Queue = class {
|
|
|
113
113
|
this.e.splice(index, 1);
|
|
114
114
|
}
|
|
115
115
|
notify(...args) {
|
|
116
|
-
if (ActiveTransition && ActiveTransition.
|
|
117
|
-
return ActiveTransition.
|
|
116
|
+
if (ActiveTransition && ActiveTransition.u.has(this))
|
|
117
|
+
return ActiveTransition.u.get(this).notify(...args);
|
|
118
118
|
if (this.m)
|
|
119
119
|
return this.m.notify(...args);
|
|
120
120
|
return false;
|
|
@@ -123,7 +123,7 @@ var Queue = class {
|
|
|
123
123
|
this.f[0].push.apply(this.f[0], queue.f[0]);
|
|
124
124
|
this.f[1].push.apply(this.f[1], queue.f[1]);
|
|
125
125
|
for (let i = 0; i < queue.e.length; i++) {
|
|
126
|
-
const og = this.e.find((c) => c.
|
|
126
|
+
const og = this.e.find((c) => c.g === queue.e[i].g);
|
|
127
127
|
if (og)
|
|
128
128
|
og.merge(queue.e[i]);
|
|
129
129
|
else
|
|
@@ -143,12 +143,12 @@ function runQueue(queue, type) {
|
|
|
143
143
|
}
|
|
144
144
|
var Transition = class _Transition {
|
|
145
145
|
a = /* @__PURE__ */ new Map();
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
s = /* @__PURE__ */ new Set();
|
|
147
|
+
R = /* @__PURE__ */ new Set();
|
|
148
148
|
W = /* @__PURE__ */ new Set();
|
|
149
149
|
I = false;
|
|
150
150
|
f = [[], []];
|
|
151
|
-
|
|
151
|
+
u = /* @__PURE__ */ new Map();
|
|
152
152
|
E = [];
|
|
153
153
|
e = [];
|
|
154
154
|
m = null;
|
|
@@ -156,9 +156,9 @@ var Transition = class _Transition {
|
|
|
156
156
|
X = false;
|
|
157
157
|
created = clock;
|
|
158
158
|
constructor() {
|
|
159
|
-
this.
|
|
159
|
+
this.u.set(globalQueue, this);
|
|
160
160
|
for (const child of globalQueue.e) {
|
|
161
|
-
cloneQueue(child, this, this.
|
|
161
|
+
cloneQueue(child, this, this.u);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
enqueue(type, fn) {
|
|
@@ -211,9 +211,9 @@ var Transition = class _Transition {
|
|
|
211
211
|
if (!(type & LOADING_BIT))
|
|
212
212
|
return false;
|
|
213
213
|
if (flags & LOADING_BIT) {
|
|
214
|
-
this.
|
|
214
|
+
this.s.add(node);
|
|
215
215
|
} else {
|
|
216
|
-
this.
|
|
216
|
+
this.s.delete(node);
|
|
217
217
|
}
|
|
218
218
|
return true;
|
|
219
219
|
}
|
|
@@ -222,7 +222,7 @@ var Transition = class _Transition {
|
|
|
222
222
|
this.f[1].push.apply(this.f[1], queue.f[1]);
|
|
223
223
|
this.E.push.apply(this.E, queue.E);
|
|
224
224
|
for (let i = 0; i < queue.e.length; i++) {
|
|
225
|
-
const og = this.e.find((c) => c.
|
|
225
|
+
const og = this.e.find((c) => c.g === queue.e[i].g);
|
|
226
226
|
if (og)
|
|
227
227
|
og.merge(queue.e[i]);
|
|
228
228
|
else
|
|
@@ -250,9 +250,9 @@ var Transition = class _Transition {
|
|
|
250
250
|
const result = fn();
|
|
251
251
|
const transition2 = ActiveTransition;
|
|
252
252
|
if (result instanceof Promise) {
|
|
253
|
-
transition2.
|
|
253
|
+
transition2.R.add(result);
|
|
254
254
|
result.finally(() => {
|
|
255
|
-
transition2.
|
|
255
|
+
transition2.R.delete(result);
|
|
256
256
|
finishTransition(transition2);
|
|
257
257
|
});
|
|
258
258
|
}
|
|
@@ -285,43 +285,51 @@ function cloneGraph(node) {
|
|
|
285
285
|
return node.k.a.get(node);
|
|
286
286
|
}
|
|
287
287
|
const clone = Object.create(Object.getPrototypeOf(node));
|
|
288
|
-
Object.assign(clone, node, {
|
|
288
|
+
Object.assign(clone, node, {
|
|
289
|
+
n: null,
|
|
290
|
+
r: null,
|
|
291
|
+
b: null,
|
|
292
|
+
a: node.a ? [...node.a] : null,
|
|
293
|
+
g: node
|
|
294
|
+
});
|
|
289
295
|
ActiveTransition.a.set(node, clone);
|
|
290
296
|
node.k = ActiveTransition;
|
|
291
|
-
if (node.
|
|
292
|
-
for (let i = 0
|
|
293
|
-
|
|
294
|
-
|
|
297
|
+
if (node.a) {
|
|
298
|
+
for (let i = 0; i < node.a.length; i++)
|
|
299
|
+
node.a[i].b.push(clone);
|
|
300
|
+
}
|
|
301
|
+
if (node.b) {
|
|
302
|
+
clone.b = [];
|
|
303
|
+
for (let i = 0, length = node.b.length; i < length; i++) {
|
|
304
|
+
!node.b[i].g && clone.b.push(cloneGraph(node.b[i]));
|
|
295
305
|
}
|
|
296
306
|
}
|
|
297
307
|
return clone;
|
|
298
308
|
}
|
|
299
|
-
function
|
|
309
|
+
function replaceSourceObservers(node, transition2) {
|
|
300
310
|
let source;
|
|
311
|
+
let transitionSource;
|
|
301
312
|
let swap;
|
|
302
|
-
for (let i =
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
if (!source.d.length)
|
|
310
|
-
unobserved.push(source);
|
|
313
|
+
for (let i = 0; i < node.a.length; i++) {
|
|
314
|
+
transitionSource = transition2.a.get(node.a[i]);
|
|
315
|
+
source = transitionSource || node.a[i];
|
|
316
|
+
if (source.b && (swap = source.b.indexOf(node)) !== -1) {
|
|
317
|
+
source.b[swap] = transitionSource ? node.g : source.b[source.b.length - 1];
|
|
318
|
+
!transitionSource && source.b.pop();
|
|
311
319
|
}
|
|
312
320
|
}
|
|
313
321
|
}
|
|
314
322
|
function cloneQueue(queue, parent, clonedQueues) {
|
|
315
323
|
const clone = Object.create(Object.getPrototypeOf(queue));
|
|
316
324
|
Object.assign(clone, queue, {
|
|
317
|
-
|
|
325
|
+
g: queue,
|
|
318
326
|
m: parent,
|
|
319
327
|
e: [],
|
|
320
328
|
enqueue(type, fn) {
|
|
321
329
|
ActiveTransition == null ? void 0 : ActiveTransition.enqueue(type, fn);
|
|
322
330
|
},
|
|
323
331
|
notify(node, type, flags) {
|
|
324
|
-
node = node.
|
|
332
|
+
node = node.g || node;
|
|
325
333
|
if (!clone.F || type & LOADING_BIT) {
|
|
326
334
|
type &= ~LOADING_BIT;
|
|
327
335
|
ActiveTransition == null ? void 0 : ActiveTransition.notify(node, LOADING_BIT, flags);
|
|
@@ -339,7 +347,7 @@ function cloneQueue(queue, parent, clonedQueues) {
|
|
|
339
347
|
}
|
|
340
348
|
function resolveQueues(children) {
|
|
341
349
|
for (const child of children) {
|
|
342
|
-
const og = child.
|
|
350
|
+
const og = child.g;
|
|
343
351
|
if (og) {
|
|
344
352
|
const clonedChildren = child.e;
|
|
345
353
|
delete child.enqueue;
|
|
@@ -347,10 +355,10 @@ function resolveQueues(children) {
|
|
|
347
355
|
delete child.m;
|
|
348
356
|
delete child.e;
|
|
349
357
|
Object.assign(og, child);
|
|
350
|
-
delete og.
|
|
358
|
+
delete og.g;
|
|
351
359
|
resolveQueues(clonedChildren);
|
|
352
|
-
} else if (child.m.
|
|
353
|
-
child.m.
|
|
360
|
+
} else if (child.m.g) {
|
|
361
|
+
child.m.g.addChild(child);
|
|
354
362
|
}
|
|
355
363
|
}
|
|
356
364
|
}
|
|
@@ -363,34 +371,34 @@ function mergeTransitions(t1, t2) {
|
|
|
363
371
|
c.k = t1;
|
|
364
372
|
t1.W.add(c);
|
|
365
373
|
});
|
|
366
|
-
t2.
|
|
367
|
-
t2.
|
|
374
|
+
t2.R.forEach((p) => t1.R.add(p));
|
|
375
|
+
t2.s.forEach((n) => t1.s.add(n));
|
|
368
376
|
t1.merge(t2);
|
|
369
377
|
t2.I = t1;
|
|
370
378
|
}
|
|
371
379
|
function finishTransition(transition2) {
|
|
372
|
-
if (transition2.I || transition2.X || transition2.
|
|
380
|
+
if (transition2.I || transition2.X || transition2.R.size || transition2.s.size)
|
|
373
381
|
return;
|
|
374
382
|
for (const [source, clone] of transition2.a) {
|
|
375
383
|
if (source === clone || source.k !== transition2)
|
|
376
384
|
continue;
|
|
377
385
|
if (clone.a)
|
|
378
|
-
|
|
386
|
+
replaceSourceObservers(clone, transition2);
|
|
379
387
|
source.dispose(false);
|
|
380
388
|
source.emptyDisposal();
|
|
381
389
|
Object.assign(source, clone);
|
|
382
|
-
delete source.
|
|
390
|
+
delete source.g;
|
|
383
391
|
delete source.k;
|
|
384
392
|
}
|
|
385
393
|
globalQueue.f[0].push.apply(globalQueue.f[0], transition2.f[0]);
|
|
386
394
|
globalQueue.f[1].push.apply(globalQueue.f[1], transition2.f[1]);
|
|
387
395
|
resolveQueues(transition2.e);
|
|
388
396
|
transition2.I = true;
|
|
389
|
-
globalQueue.flush();
|
|
390
397
|
for (const reset of transition2.W) {
|
|
391
398
|
delete reset.k;
|
|
392
399
|
reset();
|
|
393
400
|
}
|
|
401
|
+
globalQueue.flush();
|
|
394
402
|
}
|
|
395
403
|
|
|
396
404
|
// src/core/owner.ts
|
|
@@ -409,11 +417,11 @@ var Owner = class {
|
|
|
409
417
|
// However, the children are actually added in reverse creation order
|
|
410
418
|
// See comment at the top of the file for an example of the _nextSibling traversal
|
|
411
419
|
m = null;
|
|
412
|
-
|
|
420
|
+
r = null;
|
|
413
421
|
B = null;
|
|
414
|
-
|
|
422
|
+
c = STATE_CLEAN;
|
|
415
423
|
n = null;
|
|
416
|
-
|
|
424
|
+
w = defaultContext;
|
|
417
425
|
l = globalQueue;
|
|
418
426
|
ea = 0;
|
|
419
427
|
id = null;
|
|
@@ -426,27 +434,27 @@ var Owner = class {
|
|
|
426
434
|
append(child) {
|
|
427
435
|
child.m = this;
|
|
428
436
|
child.B = this;
|
|
429
|
-
if (this.
|
|
430
|
-
this.
|
|
431
|
-
child.
|
|
432
|
-
this.
|
|
437
|
+
if (this.r)
|
|
438
|
+
this.r.B = child;
|
|
439
|
+
child.r = this.r;
|
|
440
|
+
this.r = child;
|
|
433
441
|
if (this.id != null && child.id == null)
|
|
434
442
|
child.id = this.getNextChildId();
|
|
435
|
-
if (child.
|
|
436
|
-
child.
|
|
443
|
+
if (child.w !== this.w) {
|
|
444
|
+
child.w = { ...this.w, ...child.w };
|
|
437
445
|
}
|
|
438
446
|
if (this.l)
|
|
439
447
|
child.l = this.l;
|
|
440
448
|
}
|
|
441
449
|
dispose(self = true) {
|
|
442
|
-
if (this.
|
|
450
|
+
if (this.c === STATE_DISPOSED)
|
|
443
451
|
return;
|
|
444
|
-
let head = self ? this.B || this.m : this, current = this.
|
|
452
|
+
let head = self ? this.B || this.m : this, current = this.r, next = null;
|
|
445
453
|
while (current && current.m === this) {
|
|
446
454
|
current.dispose(true);
|
|
447
455
|
current.J();
|
|
448
|
-
next = current.
|
|
449
|
-
current.
|
|
456
|
+
next = current.r;
|
|
457
|
+
current.r = null;
|
|
450
458
|
current = next;
|
|
451
459
|
}
|
|
452
460
|
this.ea = 0;
|
|
@@ -455,15 +463,15 @@ var Owner = class {
|
|
|
455
463
|
if (current)
|
|
456
464
|
current.B = !self ? this : this.B;
|
|
457
465
|
if (head)
|
|
458
|
-
head.
|
|
466
|
+
head.r = current;
|
|
459
467
|
}
|
|
460
468
|
J() {
|
|
461
469
|
if (this.B)
|
|
462
|
-
this.B.
|
|
470
|
+
this.B.r = null;
|
|
463
471
|
this.m = null;
|
|
464
472
|
this.B = null;
|
|
465
|
-
this.
|
|
466
|
-
this.
|
|
473
|
+
this.w = defaultContext;
|
|
474
|
+
this.c = STATE_DISPOSED;
|
|
467
475
|
this.emptyDisposal();
|
|
468
476
|
}
|
|
469
477
|
emptyDisposal() {
|
|
@@ -492,7 +500,7 @@ function getContext(context, owner = currentOwner) {
|
|
|
492
500
|
if (!owner) {
|
|
493
501
|
throw new NoOwnerError();
|
|
494
502
|
}
|
|
495
|
-
const value = hasContext(context, owner) ? owner.
|
|
503
|
+
const value = hasContext(context, owner) ? owner.w[context.id] : context.defaultValue;
|
|
496
504
|
if (isUndefined(value)) {
|
|
497
505
|
throw new ContextNotFoundError();
|
|
498
506
|
}
|
|
@@ -502,13 +510,13 @@ function setContext(context, value, owner = currentOwner) {
|
|
|
502
510
|
if (!owner) {
|
|
503
511
|
throw new NoOwnerError();
|
|
504
512
|
}
|
|
505
|
-
owner.
|
|
506
|
-
...owner.
|
|
513
|
+
owner.w = {
|
|
514
|
+
...owner.w,
|
|
507
515
|
[context.id]: isUndefined(value) ? context.defaultValue : value
|
|
508
516
|
};
|
|
509
517
|
}
|
|
510
518
|
function hasContext(context, owner = currentOwner) {
|
|
511
|
-
return !isUndefined(owner == null ? void 0 : owner.
|
|
519
|
+
return !isUndefined(owner == null ? void 0 : owner.w[context.id]);
|
|
512
520
|
}
|
|
513
521
|
function onCleanup(fn) {
|
|
514
522
|
if (!currentOwner)
|
|
@@ -546,10 +554,10 @@ function getObserver() {
|
|
|
546
554
|
var UNCHANGED = Symbol(0);
|
|
547
555
|
var Computation = class extends Owner {
|
|
548
556
|
a = null;
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
R;
|
|
557
|
+
b = null;
|
|
558
|
+
j;
|
|
552
559
|
K;
|
|
560
|
+
L;
|
|
553
561
|
// Used in __DEV__ mode, hopefully removed in production
|
|
554
562
|
ka;
|
|
555
563
|
// Using false is an optimization as an alternative to _equals: () => false
|
|
@@ -561,16 +569,16 @@ var Computation = class extends Owner {
|
|
|
561
569
|
h = 0;
|
|
562
570
|
/** Which flags raised by sources are handled, vs. being passed through. */
|
|
563
571
|
aa = DEFAULT_FLAGS;
|
|
564
|
-
|
|
572
|
+
M = -1;
|
|
565
573
|
G = false;
|
|
566
574
|
k;
|
|
567
|
-
|
|
575
|
+
g;
|
|
568
576
|
constructor(initialValue, compute2, options) {
|
|
569
577
|
super(options == null ? void 0 : options.id, compute2 === null);
|
|
570
|
-
this.
|
|
571
|
-
this.
|
|
578
|
+
this.L = compute2;
|
|
579
|
+
this.c = compute2 ? STATE_DIRTY : STATE_CLEAN;
|
|
572
580
|
this.h = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
|
|
573
|
-
this.
|
|
581
|
+
this.j = initialValue;
|
|
574
582
|
if ((options == null ? void 0 : options.equals) !== void 0)
|
|
575
583
|
this.$ = options.equals;
|
|
576
584
|
if (options == null ? void 0 : options.pureWrite)
|
|
@@ -586,9 +594,9 @@ var Computation = class extends Owner {
|
|
|
586
594
|
track(this);
|
|
587
595
|
newFlags |= this.h & ~currentMask;
|
|
588
596
|
if (this.h & ERROR_BIT) {
|
|
589
|
-
throw this.
|
|
597
|
+
throw this.K;
|
|
590
598
|
} else {
|
|
591
|
-
return this.
|
|
599
|
+
return this.j;
|
|
592
600
|
}
|
|
593
601
|
}
|
|
594
602
|
/**
|
|
@@ -596,13 +604,13 @@ var Computation = class extends Owner {
|
|
|
596
604
|
* Automatically re-executes the surrounding computation when the value changes
|
|
597
605
|
*/
|
|
598
606
|
read() {
|
|
599
|
-
if (ActiveTransition && ActiveTransition.a.has(this)) {
|
|
600
|
-
const clone = ActiveTransition.a.get(this);
|
|
607
|
+
if (ActiveTransition && (ActiveTransition.a.has(this) || !this.g && this.h & UNINITIALIZED_BIT)) {
|
|
608
|
+
const clone = ActiveTransition.a.get(this) || cloneGraph(this);
|
|
601
609
|
if (clone !== this)
|
|
602
610
|
return clone.read();
|
|
603
611
|
}
|
|
604
|
-
if (this.
|
|
605
|
-
if (this.h & ERROR_BIT && this.
|
|
612
|
+
if (this.L) {
|
|
613
|
+
if (this.h & ERROR_BIT && this.M <= clock)
|
|
606
614
|
update(this);
|
|
607
615
|
else
|
|
608
616
|
this.H();
|
|
@@ -617,13 +625,13 @@ var Computation = class extends Owner {
|
|
|
617
625
|
* before continuing
|
|
618
626
|
*/
|
|
619
627
|
wait() {
|
|
620
|
-
if (ActiveTransition && ActiveTransition.a.has(this)) {
|
|
621
|
-
const clone = ActiveTransition.a.get(this);
|
|
628
|
+
if (ActiveTransition && (ActiveTransition.a.has(this) || !this.g && this.h & UNINITIALIZED_BIT)) {
|
|
629
|
+
const clone = ActiveTransition.a.get(this) || cloneGraph(this);
|
|
622
630
|
if (clone !== this)
|
|
623
631
|
return clone.wait();
|
|
624
632
|
}
|
|
625
|
-
if (this.
|
|
626
|
-
if (this.h & ERROR_BIT && this.
|
|
633
|
+
if (this.L) {
|
|
634
|
+
if (this.h & ERROR_BIT && this.M <= clock)
|
|
627
635
|
update(this);
|
|
628
636
|
else
|
|
629
637
|
this.H();
|
|
@@ -633,54 +641,49 @@ var Computation = class extends Owner {
|
|
|
633
641
|
throw new NotReadyError();
|
|
634
642
|
}
|
|
635
643
|
if (staleCheck && this.h & LOADING_BIT) {
|
|
636
|
-
staleCheck.
|
|
644
|
+
staleCheck.j = true;
|
|
637
645
|
}
|
|
638
646
|
return this.fa();
|
|
639
647
|
}
|
|
640
648
|
/** Update the computation with a new value. */
|
|
641
649
|
write(value, flags = 0, raw = false) {
|
|
642
|
-
if (ActiveTransition && !this.
|
|
650
|
+
if (ActiveTransition && !this.g) {
|
|
643
651
|
const clone = cloneGraph(this);
|
|
644
652
|
if (clone !== this)
|
|
645
653
|
return clone.write(value, flags, raw);
|
|
646
654
|
}
|
|
647
|
-
const newValue = !raw && typeof value === "function" ? value(this.
|
|
655
|
+
const newValue = !raw && typeof value === "function" ? value(this.j) : value;
|
|
648
656
|
const valueChanged = newValue !== UNCHANGED && (!!(this.h & UNINITIALIZED_BIT) || // this._stateFlags & LOADING_BIT & ~flags ||
|
|
649
|
-
this.$ === false || !this.$(this.
|
|
657
|
+
this.$ === false || !this.$(this.j, newValue));
|
|
650
658
|
if (valueChanged) {
|
|
651
|
-
this.
|
|
652
|
-
this.
|
|
659
|
+
this.j = newValue;
|
|
660
|
+
this.K = void 0;
|
|
653
661
|
}
|
|
654
662
|
const changedFlagsMask = this.h ^ flags, changedFlags = changedFlagsMask & flags;
|
|
655
663
|
this.h = flags;
|
|
656
|
-
this.
|
|
657
|
-
if (this.
|
|
658
|
-
for (let i = 0; i < this.
|
|
664
|
+
this.M = clock + 1;
|
|
665
|
+
if (this.b) {
|
|
666
|
+
for (let i = 0; i < this.b.length; i++) {
|
|
659
667
|
if (valueChanged) {
|
|
660
|
-
this.
|
|
668
|
+
this.b[i].x(STATE_DIRTY);
|
|
661
669
|
} else if (changedFlagsMask) {
|
|
662
|
-
this.
|
|
670
|
+
this.b[i].Y(changedFlagsMask, changedFlags);
|
|
663
671
|
}
|
|
664
672
|
}
|
|
665
673
|
}
|
|
666
|
-
return this.
|
|
674
|
+
return this.j;
|
|
667
675
|
}
|
|
668
676
|
/**
|
|
669
677
|
* Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
|
|
670
678
|
*/
|
|
671
|
-
|
|
672
|
-
if (
|
|
673
|
-
const clone = ActiveTransition.a.get(this);
|
|
674
|
-
if (clone !== this)
|
|
675
|
-
return clone.o(state, skipQueue);
|
|
676
|
-
}
|
|
677
|
-
if (this.b >= state && !this.G)
|
|
679
|
+
x(state, skipQueue) {
|
|
680
|
+
if (this.c >= state && !this.G)
|
|
678
681
|
return;
|
|
679
682
|
this.G = !!skipQueue;
|
|
680
|
-
this.
|
|
681
|
-
if (this.
|
|
682
|
-
for (let i = 0; i < this.
|
|
683
|
-
this.
|
|
683
|
+
this.c = state;
|
|
684
|
+
if (this.b) {
|
|
685
|
+
for (let i = 0; i < this.b.length; i++) {
|
|
686
|
+
this.b[i].x(STATE_CHECK, skipQueue);
|
|
684
687
|
}
|
|
685
688
|
}
|
|
686
689
|
}
|
|
@@ -691,34 +694,34 @@ var Computation = class extends Owner {
|
|
|
691
694
|
* @param newFlags The source's new flags, masked to just the changed ones.
|
|
692
695
|
*/
|
|
693
696
|
Y(mask, newFlags2) {
|
|
694
|
-
if (this.
|
|
697
|
+
if (this.c >= STATE_DIRTY)
|
|
695
698
|
return;
|
|
696
699
|
if (mask & this.aa) {
|
|
697
|
-
this.
|
|
700
|
+
this.x(STATE_DIRTY);
|
|
698
701
|
return;
|
|
699
702
|
}
|
|
700
|
-
if (this.
|
|
703
|
+
if (this.c >= STATE_CHECK)
|
|
701
704
|
return;
|
|
702
705
|
const prevFlags = this.h & mask;
|
|
703
706
|
const deltaFlags = prevFlags ^ newFlags2;
|
|
704
707
|
if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
|
|
705
|
-
this.
|
|
708
|
+
this.x(STATE_CHECK);
|
|
706
709
|
} else {
|
|
707
710
|
this.h ^= deltaFlags;
|
|
708
|
-
if (this.
|
|
709
|
-
for (let i = 0; i < this.
|
|
710
|
-
this.
|
|
711
|
+
if (this.b) {
|
|
712
|
+
for (let i = 0; i < this.b.length; i++) {
|
|
713
|
+
this.b[i].Y(mask, newFlags2);
|
|
711
714
|
}
|
|
712
715
|
}
|
|
713
716
|
}
|
|
714
717
|
}
|
|
715
|
-
|
|
716
|
-
if (ActiveTransition && !this.
|
|
718
|
+
N(error) {
|
|
719
|
+
if (ActiveTransition && !this.g) {
|
|
717
720
|
const clone = cloneGraph(this);
|
|
718
721
|
if (clone !== this)
|
|
719
|
-
return clone.
|
|
722
|
+
return clone.N(error);
|
|
720
723
|
}
|
|
721
|
-
this.
|
|
724
|
+
this.K = error;
|
|
722
725
|
this.write(UNCHANGED, this.h & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
|
|
723
726
|
}
|
|
724
727
|
/**
|
|
@@ -729,38 +732,38 @@ var Computation = class extends Owner {
|
|
|
729
732
|
* This function will ensure that the value and states we read from the computation are up to date
|
|
730
733
|
*/
|
|
731
734
|
H() {
|
|
732
|
-
if (!this.
|
|
735
|
+
if (!this.L) {
|
|
733
736
|
return;
|
|
734
737
|
}
|
|
735
|
-
if (this.
|
|
738
|
+
if (this.c === STATE_DISPOSED) {
|
|
736
739
|
return;
|
|
737
740
|
}
|
|
738
|
-
if (this.
|
|
741
|
+
if (this.c === STATE_CLEAN) {
|
|
739
742
|
return;
|
|
740
743
|
}
|
|
741
744
|
let observerFlags = 0;
|
|
742
|
-
if (this.
|
|
745
|
+
if (this.c === STATE_CHECK) {
|
|
743
746
|
for (let i = 0; i < this.a.length; i++) {
|
|
744
747
|
const source = ActiveTransition && ActiveTransition.a.get(this.a[i]) || this.a[i];
|
|
745
748
|
source.H();
|
|
746
|
-
observerFlags |= source.h;
|
|
747
|
-
if (this.
|
|
749
|
+
observerFlags |= source.h & ~UNINITIALIZED_BIT;
|
|
750
|
+
if (this.c === STATE_DIRTY) {
|
|
748
751
|
break;
|
|
749
752
|
}
|
|
750
753
|
}
|
|
751
754
|
}
|
|
752
|
-
if (this.
|
|
755
|
+
if (this.c === STATE_DIRTY) {
|
|
753
756
|
update(this);
|
|
754
757
|
} else {
|
|
755
758
|
this.write(UNCHANGED, observerFlags);
|
|
756
|
-
this.
|
|
759
|
+
this.c = STATE_CLEAN;
|
|
757
760
|
}
|
|
758
761
|
}
|
|
759
762
|
/**
|
|
760
763
|
* Remove ourselves from the owner graph and the computation graph
|
|
761
764
|
*/
|
|
762
765
|
J() {
|
|
763
|
-
if (this.
|
|
766
|
+
if (this.c === STATE_DISPOSED)
|
|
764
767
|
return;
|
|
765
768
|
if (this.a)
|
|
766
769
|
removeSourceObservers(this, 0);
|
|
@@ -768,8 +771,8 @@ var Computation = class extends Owner {
|
|
|
768
771
|
}
|
|
769
772
|
};
|
|
770
773
|
function track(computation) {
|
|
771
|
-
if (ActiveTransition && computation.
|
|
772
|
-
computation = computation.
|
|
774
|
+
if (ActiveTransition && computation.g)
|
|
775
|
+
computation = computation.g;
|
|
773
776
|
if (currentObserver) {
|
|
774
777
|
if (!newSources && currentObserver.a && currentObserver.a[newSourcesIndex] === computation) {
|
|
775
778
|
newSourcesIndex++;
|
|
@@ -779,7 +782,7 @@ function track(computation) {
|
|
|
779
782
|
newSources.push(computation);
|
|
780
783
|
}
|
|
781
784
|
if (updateCheck) {
|
|
782
|
-
updateCheck.
|
|
785
|
+
updateCheck.j = computation.M > currentObserver.M;
|
|
783
786
|
}
|
|
784
787
|
}
|
|
785
788
|
}
|
|
@@ -791,13 +794,13 @@ function update(node) {
|
|
|
791
794
|
try {
|
|
792
795
|
node.dispose(false);
|
|
793
796
|
node.emptyDisposal();
|
|
794
|
-
const result = compute(node, node.
|
|
797
|
+
const result = compute(node, node.L, node);
|
|
795
798
|
node.write(result, newFlags, true);
|
|
796
799
|
} catch (error) {
|
|
797
800
|
if (error instanceof NotReadyError) {
|
|
798
801
|
node.write(UNCHANGED, newFlags | LOADING_BIT | node.h & UNINITIALIZED_BIT);
|
|
799
802
|
} else {
|
|
800
|
-
node.
|
|
803
|
+
node.N(error);
|
|
801
804
|
}
|
|
802
805
|
} finally {
|
|
803
806
|
if (newSources) {
|
|
@@ -813,11 +816,11 @@ function update(node) {
|
|
|
813
816
|
}
|
|
814
817
|
let source;
|
|
815
818
|
for (let i = newSourcesIndex; i < node.a.length; i++) {
|
|
816
|
-
source = node.a[i];
|
|
817
|
-
if (!source.
|
|
818
|
-
source.
|
|
819
|
+
source = ActiveTransition && ActiveTransition.a.get(node.a[i]) || node.a[i];
|
|
820
|
+
if (!source.b)
|
|
821
|
+
source.b = [node];
|
|
819
822
|
else
|
|
820
|
-
source.
|
|
823
|
+
source.b.push(node);
|
|
821
824
|
}
|
|
822
825
|
} else if (node.a && newSourcesIndex < node.a.length) {
|
|
823
826
|
removeSourceObservers(node, newSourcesIndex);
|
|
@@ -826,8 +829,23 @@ function update(node) {
|
|
|
826
829
|
newSources = prevSources;
|
|
827
830
|
newSourcesIndex = prevSourcesIndex;
|
|
828
831
|
newFlags = prevFlags;
|
|
829
|
-
node.
|
|
830
|
-
node.
|
|
832
|
+
node.M = clock + 1;
|
|
833
|
+
node.c = STATE_CLEAN;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
function removeSourceObservers(node, index) {
|
|
837
|
+
let source;
|
|
838
|
+
let swap;
|
|
839
|
+
for (let i = index; i < node.a.length; i++) {
|
|
840
|
+
source = ActiveTransition && ActiveTransition.a.get(node.a[i]) || node.a[i];
|
|
841
|
+
if (source.b) {
|
|
842
|
+
if ((swap = source.b.indexOf(node)) !== -1) {
|
|
843
|
+
source.b[swap] = source.b[source.b.length - 1];
|
|
844
|
+
source.b.pop();
|
|
845
|
+
}
|
|
846
|
+
if (!source.b.length)
|
|
847
|
+
Unobserved.push(source);
|
|
848
|
+
}
|
|
831
849
|
}
|
|
832
850
|
}
|
|
833
851
|
function isEqual(a, b) {
|
|
@@ -840,20 +858,20 @@ function untrack(fn) {
|
|
|
840
858
|
}
|
|
841
859
|
function hasUpdated(fn) {
|
|
842
860
|
const current = updateCheck;
|
|
843
|
-
updateCheck = {
|
|
861
|
+
updateCheck = { j: false };
|
|
844
862
|
try {
|
|
845
863
|
fn();
|
|
846
|
-
return updateCheck.
|
|
864
|
+
return updateCheck.j;
|
|
847
865
|
} finally {
|
|
848
866
|
updateCheck = current;
|
|
849
867
|
}
|
|
850
868
|
}
|
|
851
869
|
function pendingCheck(fn, loadingValue) {
|
|
852
870
|
const current = staleCheck;
|
|
853
|
-
staleCheck = {
|
|
871
|
+
staleCheck = { j: false };
|
|
854
872
|
try {
|
|
855
873
|
latest(fn);
|
|
856
|
-
return staleCheck.
|
|
874
|
+
return staleCheck.j;
|
|
857
875
|
} catch (err) {
|
|
858
876
|
if (!(err instanceof NotReadyError))
|
|
859
877
|
return false;
|
|
@@ -901,7 +919,7 @@ function runWithObserver(observer, run) {
|
|
|
901
919
|
newFlags | LOADING_BIT | observer.h & UNINITIALIZED_BIT
|
|
902
920
|
);
|
|
903
921
|
} else {
|
|
904
|
-
observer.
|
|
922
|
+
observer.N(error);
|
|
905
923
|
}
|
|
906
924
|
} finally {
|
|
907
925
|
if (newSources) {
|
|
@@ -916,10 +934,10 @@ function runWithObserver(observer, run) {
|
|
|
916
934
|
let source;
|
|
917
935
|
for (let i = newSourcesIndex; i < observer.a.length; i++) {
|
|
918
936
|
source = observer.a[i];
|
|
919
|
-
if (!source.
|
|
920
|
-
source.
|
|
937
|
+
if (!source.b)
|
|
938
|
+
source.b = [observer];
|
|
921
939
|
else
|
|
922
|
-
source.
|
|
940
|
+
source.b.push(observer);
|
|
923
941
|
}
|
|
924
942
|
}
|
|
925
943
|
newSources = prevSources;
|
|
@@ -933,7 +951,7 @@ function compute(owner, fn, observer) {
|
|
|
933
951
|
currentMask = (observer == null ? void 0 : observer.aa) ?? DEFAULT_FLAGS;
|
|
934
952
|
notStale = true;
|
|
935
953
|
try {
|
|
936
|
-
return fn(observer ? observer.
|
|
954
|
+
return fn.call(observer, observer ? observer.j : void 0);
|
|
937
955
|
} finally {
|
|
938
956
|
setOwner(prevOwner);
|
|
939
957
|
currentObserver = prevObserver;
|
|
@@ -946,7 +964,7 @@ function compute(owner, fn, observer) {
|
|
|
946
964
|
var Effect = class extends Computation {
|
|
947
965
|
ba;
|
|
948
966
|
Z;
|
|
949
|
-
|
|
967
|
+
O;
|
|
950
968
|
ca = false;
|
|
951
969
|
_;
|
|
952
970
|
A;
|
|
@@ -957,55 +975,55 @@ var Effect = class extends Computation {
|
|
|
957
975
|
this._ = initialValue;
|
|
958
976
|
this.A = (options == null ? void 0 : options.render) ? EFFECT_RENDER : EFFECT_USER;
|
|
959
977
|
if (this.A === EFFECT_RENDER) {
|
|
960
|
-
this.
|
|
978
|
+
this.L = function(p) {
|
|
979
|
+
return !this.g && clock > this.l.created && !(this.h & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
|
|
980
|
+
};
|
|
961
981
|
}
|
|
962
982
|
this.H();
|
|
963
983
|
!(options == null ? void 0 : options.defer) && (this.A === EFFECT_USER ? this.l.enqueue(this.A, this.C.bind(this)) : this.C(this.A));
|
|
964
984
|
}
|
|
965
985
|
write(value, flags = 0) {
|
|
966
|
-
if (this.
|
|
986
|
+
if (this.c == STATE_DIRTY) {
|
|
967
987
|
this.h = flags;
|
|
968
988
|
if (this.A === EFFECT_RENDER) {
|
|
969
|
-
this.l.notify(this, LOADING_BIT | ERROR_BIT,
|
|
989
|
+
this.l.notify(this, LOADING_BIT | ERROR_BIT, this.h);
|
|
970
990
|
}
|
|
971
991
|
}
|
|
972
992
|
if (value === UNCHANGED)
|
|
973
|
-
return this.
|
|
974
|
-
this.
|
|
993
|
+
return this.j;
|
|
994
|
+
this.j = value;
|
|
975
995
|
this.ca = true;
|
|
996
|
+
this.K = void 0;
|
|
976
997
|
return value;
|
|
977
998
|
}
|
|
978
|
-
|
|
979
|
-
if (
|
|
980
|
-
return ActiveTransition.a.get(this).o(state, skipQueue);
|
|
981
|
-
}
|
|
982
|
-
if (this.b >= state || skipQueue)
|
|
999
|
+
x(state, skipQueue) {
|
|
1000
|
+
if (this.c >= state || skipQueue)
|
|
983
1001
|
return;
|
|
984
|
-
if (this.
|
|
1002
|
+
if (this.c === STATE_CLEAN)
|
|
985
1003
|
this.l.enqueue(this.A, this.C.bind(this));
|
|
986
|
-
this.
|
|
1004
|
+
this.c = state;
|
|
987
1005
|
}
|
|
988
1006
|
Y(mask, newFlags2) {
|
|
989
|
-
if (
|
|
990
|
-
if (this.
|
|
1007
|
+
if (this.g) {
|
|
1008
|
+
if (this.c >= STATE_DIRTY)
|
|
991
1009
|
return;
|
|
992
1010
|
if (mask & 3) {
|
|
993
|
-
this.
|
|
1011
|
+
this.x(STATE_DIRTY);
|
|
994
1012
|
return;
|
|
995
1013
|
}
|
|
996
1014
|
}
|
|
997
1015
|
super.Y(mask, newFlags2);
|
|
998
1016
|
}
|
|
999
|
-
|
|
1000
|
-
this.
|
|
1017
|
+
N(error) {
|
|
1018
|
+
this.K = error;
|
|
1001
1019
|
this.l.notify(this, LOADING_BIT, 0);
|
|
1002
1020
|
this.h = ERROR_BIT;
|
|
1003
1021
|
if (this.A === EFFECT_USER) {
|
|
1004
1022
|
try {
|
|
1005
1023
|
return this.Z ? this.Z(error, () => {
|
|
1006
1024
|
var _a;
|
|
1007
|
-
(_a = this.
|
|
1008
|
-
this.
|
|
1025
|
+
(_a = this.O) == null ? void 0 : _a.call(this);
|
|
1026
|
+
this.O = void 0;
|
|
1009
1027
|
}) : console.error(error);
|
|
1010
1028
|
} catch (e) {
|
|
1011
1029
|
error = e;
|
|
@@ -1016,33 +1034,33 @@ var Effect = class extends Computation {
|
|
|
1016
1034
|
}
|
|
1017
1035
|
J() {
|
|
1018
1036
|
var _a;
|
|
1019
|
-
if (this.
|
|
1037
|
+
if (this.c === STATE_DISPOSED)
|
|
1020
1038
|
return;
|
|
1021
1039
|
this.ba = void 0;
|
|
1022
1040
|
this._ = void 0;
|
|
1023
1041
|
this.Z = void 0;
|
|
1024
|
-
(_a = this.
|
|
1025
|
-
this.
|
|
1042
|
+
(_a = this.O) == null ? void 0 : _a.call(this);
|
|
1043
|
+
this.O = void 0;
|
|
1026
1044
|
super.J();
|
|
1027
1045
|
}
|
|
1028
1046
|
C(type) {
|
|
1029
1047
|
var _a;
|
|
1030
1048
|
if (type) {
|
|
1031
|
-
const effect = this.
|
|
1032
|
-
if (effect.ca && effect.
|
|
1033
|
-
(_a = effect.
|
|
1049
|
+
const effect = this.g || this;
|
|
1050
|
+
if (effect.ca && effect.c !== STATE_DISPOSED) {
|
|
1051
|
+
(_a = effect.O) == null ? void 0 : _a.call(effect);
|
|
1034
1052
|
try {
|
|
1035
|
-
effect.
|
|
1053
|
+
effect.O = effect.ba(effect.j, effect._);
|
|
1036
1054
|
} catch (e) {
|
|
1037
1055
|
if (!effect.l.notify(effect, ERROR_BIT, ERROR_BIT))
|
|
1038
1056
|
throw e;
|
|
1039
1057
|
} finally {
|
|
1040
|
-
effect._ = effect.
|
|
1058
|
+
effect._ = effect.j;
|
|
1041
1059
|
effect.ca = false;
|
|
1042
1060
|
}
|
|
1043
1061
|
}
|
|
1044
1062
|
} else
|
|
1045
|
-
this.
|
|
1063
|
+
this.c !== STATE_CLEAN && runTop(this);
|
|
1046
1064
|
}
|
|
1047
1065
|
};
|
|
1048
1066
|
var EagerComputation = class extends Computation {
|
|
@@ -1050,18 +1068,15 @@ var EagerComputation = class extends Computation {
|
|
|
1050
1068
|
super(initialValue, compute2, options);
|
|
1051
1069
|
!(options == null ? void 0 : options.defer) && this.H();
|
|
1052
1070
|
}
|
|
1053
|
-
|
|
1054
|
-
if (
|
|
1055
|
-
return ActiveTransition.a.get(this).o(state, skipQueue);
|
|
1056
|
-
}
|
|
1057
|
-
if (this.b >= state && !this.G)
|
|
1071
|
+
x(state, skipQueue) {
|
|
1072
|
+
if (this.c >= state && !this.G)
|
|
1058
1073
|
return;
|
|
1059
|
-
if (!skipQueue && (this.
|
|
1074
|
+
if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.G))
|
|
1060
1075
|
this.l.enqueue(EFFECT_PURE, this.C.bind(this));
|
|
1061
|
-
super.
|
|
1076
|
+
super.x(state, skipQueue);
|
|
1062
1077
|
}
|
|
1063
1078
|
C() {
|
|
1064
|
-
this.
|
|
1079
|
+
this.c !== STATE_CLEAN && runTop(this);
|
|
1065
1080
|
}
|
|
1066
1081
|
};
|
|
1067
1082
|
var FirewallComputation = class extends Computation {
|
|
@@ -1069,30 +1084,27 @@ var FirewallComputation = class extends Computation {
|
|
|
1069
1084
|
constructor(compute2) {
|
|
1070
1085
|
super(void 0, compute2);
|
|
1071
1086
|
}
|
|
1072
|
-
|
|
1073
|
-
if (
|
|
1074
|
-
return ActiveTransition.a.get(this).o(state, skipQueue);
|
|
1075
|
-
}
|
|
1076
|
-
if (this.b >= state && !this.G)
|
|
1087
|
+
x(state, skipQueue) {
|
|
1088
|
+
if (this.c >= state && !this.G)
|
|
1077
1089
|
return;
|
|
1078
|
-
if (!skipQueue && (this.
|
|
1090
|
+
if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.G))
|
|
1079
1091
|
this.l.enqueue(EFFECT_PURE, this.C.bind(this));
|
|
1080
|
-
super.
|
|
1092
|
+
super.x(state, true);
|
|
1081
1093
|
this.G = !!skipQueue;
|
|
1082
1094
|
}
|
|
1083
1095
|
C() {
|
|
1084
|
-
this.
|
|
1096
|
+
this.c !== STATE_CLEAN && runTop(this);
|
|
1085
1097
|
}
|
|
1086
1098
|
};
|
|
1087
1099
|
function runTop(node) {
|
|
1088
1100
|
const ancestors = [];
|
|
1089
1101
|
for (let current = node; current !== null; current = current.m) {
|
|
1090
|
-
if (current.
|
|
1102
|
+
if (current.c !== STATE_CLEAN) {
|
|
1091
1103
|
ancestors.push(current);
|
|
1092
1104
|
}
|
|
1093
1105
|
}
|
|
1094
1106
|
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
1095
|
-
if (ancestors[i].
|
|
1107
|
+
if (ancestors[i].c !== STATE_DISPOSED)
|
|
1096
1108
|
ancestors[i].H();
|
|
1097
1109
|
}
|
|
1098
1110
|
}
|
|
@@ -1228,7 +1240,7 @@ var storeTraps = {
|
|
|
1228
1240
|
return desc.get.call(receiver);
|
|
1229
1241
|
}
|
|
1230
1242
|
if (Writing == null ? void 0 : Writing.has(receiver)) {
|
|
1231
|
-
let value2 = tracked && (overridden || !proxySource) ? tracked.
|
|
1243
|
+
let value2 = tracked && (overridden || !proxySource) ? tracked.j : storeValue[property];
|
|
1232
1244
|
value2 === $DELETED && (value2 = void 0);
|
|
1233
1245
|
if (!isWrappable(value2))
|
|
1234
1246
|
return value2;
|
|
@@ -1525,6 +1537,8 @@ function applyState(next, state, keyFn, all) {
|
|
|
1525
1537
|
}
|
|
1526
1538
|
function reconcile(value, key, all = false) {
|
|
1527
1539
|
return (state) => {
|
|
1540
|
+
if (state == null)
|
|
1541
|
+
throw new Error("Cannot reconcile null or undefined state");
|
|
1528
1542
|
const keyFn = typeof key === "string" ? (item) => item[key] : key;
|
|
1529
1543
|
const eq = keyFn(state);
|
|
1530
1544
|
if (eq !== void 0 && keyFn(value) !== keyFn(state))
|
|
@@ -1766,12 +1780,12 @@ function createMemo(compute2, value, options) {
|
|
|
1766
1780
|
return () => {
|
|
1767
1781
|
var _a, _b;
|
|
1768
1782
|
if (node) {
|
|
1769
|
-
if (node.
|
|
1783
|
+
if (node.c === STATE_DISPOSED) {
|
|
1770
1784
|
node = void 0;
|
|
1771
1785
|
return resolvedValue;
|
|
1772
1786
|
}
|
|
1773
1787
|
resolvedValue = node.wait();
|
|
1774
|
-
if (!((_a = node.a) == null ? void 0 : _a.length) && ((_b = node.
|
|
1788
|
+
if (!((_a = node.a) == null ? void 0 : _a.length) && ((_b = node.r) == null ? void 0 : _b.m) !== node && !(node.h & UNINITIALIZED_BIT)) {
|
|
1775
1789
|
node.dispose();
|
|
1776
1790
|
node = void 0;
|
|
1777
1791
|
}
|
|
@@ -1807,8 +1821,8 @@ function createAsync(compute2, value, options) {
|
|
|
1807
1821
|
if (abort)
|
|
1808
1822
|
return;
|
|
1809
1823
|
if (transition2)
|
|
1810
|
-
return transition2.runTransition(() => node.
|
|
1811
|
-
node.
|
|
1824
|
+
return transition2.runTransition(() => node.N(error), true);
|
|
1825
|
+
node.N(error);
|
|
1812
1826
|
}
|
|
1813
1827
|
);
|
|
1814
1828
|
} else {
|
|
@@ -1832,9 +1846,13 @@ function createAsync(compute2, value, options) {
|
|
|
1832
1846
|
);
|
|
1833
1847
|
const read = node.wait.bind(node);
|
|
1834
1848
|
read.refresh = () => {
|
|
1835
|
-
|
|
1849
|
+
let n = node;
|
|
1850
|
+
if (ActiveTransition && !node.g) {
|
|
1851
|
+
n = cloneGraph(node);
|
|
1852
|
+
}
|
|
1853
|
+
n.c = STATE_DIRTY;
|
|
1836
1854
|
refreshing = true;
|
|
1837
|
-
|
|
1855
|
+
n.H();
|
|
1838
1856
|
};
|
|
1839
1857
|
return read;
|
|
1840
1858
|
}
|
|
@@ -1915,7 +1933,7 @@ function createOptimistic(initial, compute2, key) {
|
|
|
1915
1933
|
(s) => {
|
|
1916
1934
|
const value = initial();
|
|
1917
1935
|
if (!ActiveTransition)
|
|
1918
|
-
|
|
1936
|
+
reconcile({ value }, key)(s);
|
|
1919
1937
|
},
|
|
1920
1938
|
{ value: void 0 }
|
|
1921
1939
|
);
|
|
@@ -1923,9 +1941,9 @@ function createOptimistic(initial, compute2, key) {
|
|
|
1923
1941
|
[store, setStore] = createStore({ value: initial });
|
|
1924
1942
|
const reset = () => setStore(
|
|
1925
1943
|
(s) => reconcile(
|
|
1926
|
-
typeof initial === "function" ? initial() : initial,
|
|
1944
|
+
{ value: typeof initial === "function" ? initial() : initial },
|
|
1927
1945
|
key
|
|
1928
|
-
)(s
|
|
1946
|
+
)(s)
|
|
1929
1947
|
);
|
|
1930
1948
|
let lastChange = void 0;
|
|
1931
1949
|
function write(v) {
|
|
@@ -1947,15 +1965,15 @@ function mapArray(list, map, options) {
|
|
|
1947
1965
|
const keyFn = typeof (options == null ? void 0 : options.keyed) === "function" ? options.keyed : void 0;
|
|
1948
1966
|
return updateKeyedMap.bind({
|
|
1949
1967
|
S: new Owner(),
|
|
1950
|
-
|
|
1968
|
+
o: 0,
|
|
1951
1969
|
ha: list,
|
|
1952
1970
|
D: [],
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1971
|
+
P: map,
|
|
1972
|
+
i: [],
|
|
1973
|
+
d: [],
|
|
1974
|
+
Q: keyFn,
|
|
1975
|
+
p: keyFn || (options == null ? void 0 : options.keyed) === false ? [] : void 0,
|
|
1976
|
+
q: map.length > 1 ? [] : void 0,
|
|
1959
1977
|
T: options == null ? void 0 : options.fallback
|
|
1960
1978
|
});
|
|
1961
1979
|
}
|
|
@@ -1964,113 +1982,113 @@ function updateKeyedMap() {
|
|
|
1964
1982
|
const newItems = this.ha() || [], newLen = newItems.length;
|
|
1965
1983
|
newItems[$TRACK];
|
|
1966
1984
|
runWithOwner(this.S, () => {
|
|
1967
|
-
let i, j, mapper = this.
|
|
1968
|
-
this.
|
|
1969
|
-
this.
|
|
1970
|
-
return this.
|
|
1971
|
-
Computation.prototype.read.bind(this.
|
|
1972
|
-
this.
|
|
1985
|
+
let i, j, mapper = this.p ? () => {
|
|
1986
|
+
this.p[j] = new Computation(newItems[j], null, pureOptions);
|
|
1987
|
+
this.q && (this.q[j] = new Computation(j, null, pureOptions));
|
|
1988
|
+
return this.P(
|
|
1989
|
+
Computation.prototype.read.bind(this.p[j]),
|
|
1990
|
+
this.q ? Computation.prototype.read.bind(this.q[j]) : void 0
|
|
1973
1991
|
);
|
|
1974
|
-
} : this.
|
|
1992
|
+
} : this.q ? () => {
|
|
1975
1993
|
const item = newItems[j];
|
|
1976
|
-
this.
|
|
1977
|
-
return this.
|
|
1994
|
+
this.q[j] = new Computation(j, null, pureOptions);
|
|
1995
|
+
return this.P(() => item, Computation.prototype.read.bind(this.q[j]));
|
|
1978
1996
|
} : () => {
|
|
1979
1997
|
const item = newItems[j];
|
|
1980
|
-
return this.
|
|
1998
|
+
return this.P(() => item);
|
|
1981
1999
|
};
|
|
1982
2000
|
if (newLen === 0) {
|
|
1983
|
-
if (this.
|
|
2001
|
+
if (this.o !== 0) {
|
|
1984
2002
|
this.S.dispose(false);
|
|
1985
|
-
this.
|
|
2003
|
+
this.d = [];
|
|
1986
2004
|
this.D = [];
|
|
1987
|
-
this.
|
|
1988
|
-
this.
|
|
2005
|
+
this.i = [];
|
|
2006
|
+
this.o = 0;
|
|
2007
|
+
this.p && (this.p = []);
|
|
1989
2008
|
this.q && (this.q = []);
|
|
1990
|
-
this.r && (this.r = []);
|
|
1991
2009
|
}
|
|
1992
|
-
if (this.T && !this.
|
|
1993
|
-
this.
|
|
1994
|
-
this.
|
|
2010
|
+
if (this.T && !this.i[0]) {
|
|
2011
|
+
this.i[0] = compute(
|
|
2012
|
+
this.d[0] = new Owner(),
|
|
1995
2013
|
this.T,
|
|
1996
2014
|
null
|
|
1997
2015
|
);
|
|
1998
2016
|
}
|
|
1999
|
-
} else if (this.
|
|
2000
|
-
if (this.
|
|
2001
|
-
this.
|
|
2002
|
-
this.
|
|
2017
|
+
} else if (this.o === 0) {
|
|
2018
|
+
if (this.d[0])
|
|
2019
|
+
this.d[0].dispose();
|
|
2020
|
+
this.i = new Array(newLen);
|
|
2003
2021
|
for (j = 0; j < newLen; j++) {
|
|
2004
2022
|
this.D[j] = newItems[j];
|
|
2005
|
-
this.
|
|
2023
|
+
this.i[j] = compute(this.d[j] = new Owner(), mapper, null);
|
|
2006
2024
|
}
|
|
2007
|
-
this.
|
|
2025
|
+
this.o = newLen;
|
|
2008
2026
|
} else {
|
|
2009
|
-
let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.
|
|
2010
|
-
for (start = 0, end = Math.min(this.
|
|
2011
|
-
if (this.
|
|
2012
|
-
this.
|
|
2027
|
+
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;
|
|
2028
|
+
for (start = 0, end = Math.min(this.o, newLen); start < end && (this.D[start] === newItems[start] || this.p && compare(this.Q, this.D[start], newItems[start])); start++) {
|
|
2029
|
+
if (this.p)
|
|
2030
|
+
this.p[start].write(newItems[start]);
|
|
2013
2031
|
}
|
|
2014
|
-
for (end = this.
|
|
2015
|
-
temp[newEnd] = this.
|
|
2016
|
-
tempNodes[newEnd] = this.
|
|
2017
|
-
tempRows && (tempRows[newEnd] = this.
|
|
2018
|
-
tempIndexes && (tempIndexes[newEnd] = this.
|
|
2032
|
+
for (end = this.o - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.D[end] === newItems[newEnd] || this.p && compare(this.Q, this.D[end], newItems[newEnd])); end--, newEnd--) {
|
|
2033
|
+
temp[newEnd] = this.i[end];
|
|
2034
|
+
tempNodes[newEnd] = this.d[end];
|
|
2035
|
+
tempRows && (tempRows[newEnd] = this.p[end]);
|
|
2036
|
+
tempIndexes && (tempIndexes[newEnd] = this.q[end]);
|
|
2019
2037
|
}
|
|
2020
2038
|
newIndices = /* @__PURE__ */ new Map();
|
|
2021
2039
|
newIndicesNext = new Array(newEnd + 1);
|
|
2022
2040
|
for (j = newEnd; j >= start; j--) {
|
|
2023
2041
|
item = newItems[j];
|
|
2024
|
-
key = this.
|
|
2042
|
+
key = this.Q ? this.Q(item) : item;
|
|
2025
2043
|
i = newIndices.get(key);
|
|
2026
2044
|
newIndicesNext[j] = i === void 0 ? -1 : i;
|
|
2027
2045
|
newIndices.set(key, j);
|
|
2028
2046
|
}
|
|
2029
2047
|
for (i = start; i <= end; i++) {
|
|
2030
2048
|
item = this.D[i];
|
|
2031
|
-
key = this.
|
|
2049
|
+
key = this.Q ? this.Q(item) : item;
|
|
2032
2050
|
j = newIndices.get(key);
|
|
2033
2051
|
if (j !== void 0 && j !== -1) {
|
|
2034
|
-
temp[j] = this.
|
|
2035
|
-
tempNodes[j] = this.
|
|
2036
|
-
tempRows && (tempRows[j] = this.
|
|
2037
|
-
tempIndexes && (tempIndexes[j] = this.
|
|
2052
|
+
temp[j] = this.i[i];
|
|
2053
|
+
tempNodes[j] = this.d[i];
|
|
2054
|
+
tempRows && (tempRows[j] = this.p[i]);
|
|
2055
|
+
tempIndexes && (tempIndexes[j] = this.q[i]);
|
|
2038
2056
|
j = newIndicesNext[j];
|
|
2039
2057
|
newIndices.set(key, j);
|
|
2040
2058
|
} else
|
|
2041
|
-
this.
|
|
2059
|
+
this.d[i].dispose();
|
|
2042
2060
|
}
|
|
2043
2061
|
for (j = start; j < newLen; j++) {
|
|
2044
2062
|
if (j in temp) {
|
|
2045
|
-
this.
|
|
2046
|
-
this.
|
|
2063
|
+
this.i[j] = temp[j];
|
|
2064
|
+
this.d[j] = tempNodes[j];
|
|
2047
2065
|
if (tempRows) {
|
|
2048
|
-
this.
|
|
2049
|
-
this.
|
|
2066
|
+
this.p[j] = tempRows[j];
|
|
2067
|
+
this.p[j].write(newItems[j]);
|
|
2050
2068
|
}
|
|
2051
2069
|
if (tempIndexes) {
|
|
2052
|
-
this.
|
|
2053
|
-
this.
|
|
2070
|
+
this.q[j] = tempIndexes[j];
|
|
2071
|
+
this.q[j].write(j);
|
|
2054
2072
|
}
|
|
2055
2073
|
} else {
|
|
2056
|
-
this.
|
|
2074
|
+
this.i[j] = compute(this.d[j] = new Owner(), mapper, null);
|
|
2057
2075
|
}
|
|
2058
2076
|
}
|
|
2059
|
-
this.
|
|
2077
|
+
this.i = this.i.slice(0, this.o = newLen);
|
|
2060
2078
|
this.D = newItems.slice(0);
|
|
2061
2079
|
}
|
|
2062
2080
|
});
|
|
2063
|
-
return this.
|
|
2081
|
+
return this.i;
|
|
2064
2082
|
}
|
|
2065
2083
|
function repeat(count, map, options) {
|
|
2066
2084
|
return updateRepeat.bind({
|
|
2067
2085
|
S: new Owner(),
|
|
2068
|
-
|
|
2086
|
+
o: 0,
|
|
2069
2087
|
y: 0,
|
|
2070
2088
|
ia: count,
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2089
|
+
P: map,
|
|
2090
|
+
d: [],
|
|
2091
|
+
i: [],
|
|
2074
2092
|
ja: options == null ? void 0 : options.from,
|
|
2075
2093
|
T: options == null ? void 0 : options.fallback
|
|
2076
2094
|
});
|
|
@@ -2081,15 +2099,15 @@ function updateRepeat() {
|
|
|
2081
2099
|
const from = ((_a = this.ja) == null ? void 0 : _a.call(this)) || 0;
|
|
2082
2100
|
runWithOwner(this.S, () => {
|
|
2083
2101
|
if (newLen === 0) {
|
|
2084
|
-
if (this.
|
|
2102
|
+
if (this.o !== 0) {
|
|
2085
2103
|
this.S.dispose(false);
|
|
2086
|
-
this.
|
|
2087
|
-
this.
|
|
2088
|
-
this.
|
|
2104
|
+
this.d = [];
|
|
2105
|
+
this.i = [];
|
|
2106
|
+
this.o = 0;
|
|
2089
2107
|
}
|
|
2090
|
-
if (this.T && !this.
|
|
2091
|
-
this.
|
|
2092
|
-
this.
|
|
2108
|
+
if (this.T && !this.i[0]) {
|
|
2109
|
+
this.i[0] = compute(
|
|
2110
|
+
this.d[0] = new Owner(),
|
|
2093
2111
|
this.T,
|
|
2094
2112
|
null
|
|
2095
2113
|
);
|
|
@@ -2097,46 +2115,46 @@ function updateRepeat() {
|
|
|
2097
2115
|
return;
|
|
2098
2116
|
}
|
|
2099
2117
|
const to = from + newLen;
|
|
2100
|
-
const prevTo = this.y + this.
|
|
2101
|
-
if (this.
|
|
2102
|
-
this.
|
|
2118
|
+
const prevTo = this.y + this.o;
|
|
2119
|
+
if (this.o === 0 && this.d[0])
|
|
2120
|
+
this.d[0].dispose();
|
|
2103
2121
|
for (let i = to; i < prevTo; i++)
|
|
2104
|
-
this.
|
|
2122
|
+
this.d[i - this.y].dispose();
|
|
2105
2123
|
if (this.y < from) {
|
|
2106
2124
|
let i = this.y;
|
|
2107
|
-
while (i < from && i < this.
|
|
2108
|
-
this.
|
|
2109
|
-
this.
|
|
2110
|
-
this.
|
|
2125
|
+
while (i < from && i < this.o)
|
|
2126
|
+
this.d[i++].dispose();
|
|
2127
|
+
this.d.splice(0, from - this.y);
|
|
2128
|
+
this.i.splice(0, from - this.y);
|
|
2111
2129
|
} else if (this.y > from) {
|
|
2112
2130
|
let i = prevTo - this.y - 1;
|
|
2113
2131
|
let difference = this.y - from;
|
|
2114
|
-
this.
|
|
2132
|
+
this.d.length = this.i.length = newLen;
|
|
2115
2133
|
while (i >= difference) {
|
|
2116
|
-
this.
|
|
2117
|
-
this.
|
|
2134
|
+
this.d[i] = this.d[i - difference];
|
|
2135
|
+
this.i[i] = this.i[i - difference];
|
|
2118
2136
|
i--;
|
|
2119
2137
|
}
|
|
2120
2138
|
for (let i2 = 0; i2 < difference; i2++) {
|
|
2121
|
-
this.
|
|
2122
|
-
this.
|
|
2123
|
-
() => this.
|
|
2139
|
+
this.i[i2] = compute(
|
|
2140
|
+
this.d[i2] = new Owner(),
|
|
2141
|
+
() => this.P(i2 + from),
|
|
2124
2142
|
null
|
|
2125
2143
|
);
|
|
2126
2144
|
}
|
|
2127
2145
|
}
|
|
2128
2146
|
for (let i = prevTo; i < to; i++) {
|
|
2129
|
-
this.
|
|
2130
|
-
this.
|
|
2131
|
-
() => this.
|
|
2147
|
+
this.i[i - from] = compute(
|
|
2148
|
+
this.d[i - from] = new Owner(),
|
|
2149
|
+
() => this.P(i),
|
|
2132
2150
|
null
|
|
2133
2151
|
);
|
|
2134
2152
|
}
|
|
2135
|
-
this.
|
|
2153
|
+
this.i = this.i.slice(0, newLen);
|
|
2136
2154
|
this.y = from;
|
|
2137
|
-
this.
|
|
2155
|
+
this.o = newLen;
|
|
2138
2156
|
});
|
|
2139
|
-
return this.
|
|
2157
|
+
return this.i;
|
|
2140
2158
|
}
|
|
2141
2159
|
function compare(key, a, b) {
|
|
2142
2160
|
return key ? key(a) === key(b) : true;
|
|
@@ -2155,7 +2173,7 @@ var BoundaryComputation = class extends EagerComputation {
|
|
|
2155
2173
|
flags &= ~LOADING_BIT;
|
|
2156
2174
|
}
|
|
2157
2175
|
this.l.notify(this, this.U, flags);
|
|
2158
|
-
return this.
|
|
2176
|
+
return this.j;
|
|
2159
2177
|
}
|
|
2160
2178
|
};
|
|
2161
2179
|
function createBoundChildren(owner, fn, queue, mask) {
|
|
@@ -2172,27 +2190,27 @@ function createBoundChildren(owner, fn, queue, mask) {
|
|
|
2172
2190
|
);
|
|
2173
2191
|
}
|
|
2174
2192
|
var ConditionalQueue = class extends Queue {
|
|
2175
|
-
|
|
2193
|
+
t;
|
|
2176
2194
|
V = /* @__PURE__ */ new Set();
|
|
2177
|
-
|
|
2195
|
+
s = /* @__PURE__ */ new Set();
|
|
2178
2196
|
constructor(disabled) {
|
|
2179
2197
|
super();
|
|
2180
|
-
this.
|
|
2198
|
+
this.t = disabled;
|
|
2181
2199
|
}
|
|
2182
2200
|
run(type) {
|
|
2183
|
-
if (!type || this.
|
|
2201
|
+
if (!type || this.t.read())
|
|
2184
2202
|
return;
|
|
2185
2203
|
return super.run(type);
|
|
2186
2204
|
}
|
|
2187
2205
|
notify(node, type, flags) {
|
|
2188
|
-
if (ActiveTransition && ActiveTransition.
|
|
2189
|
-
return ActiveTransition.
|
|
2190
|
-
if (this.
|
|
2206
|
+
if (ActiveTransition && ActiveTransition.u.has(this))
|
|
2207
|
+
return ActiveTransition.u.get(this).notify(node, type, flags);
|
|
2208
|
+
if (this.t.read()) {
|
|
2191
2209
|
if (type & LOADING_BIT) {
|
|
2192
2210
|
if (flags & LOADING_BIT) {
|
|
2193
|
-
this.
|
|
2211
|
+
this.s.add(node);
|
|
2194
2212
|
type &= ~LOADING_BIT;
|
|
2195
|
-
} else if (this.
|
|
2213
|
+
} else if (this.s.delete(node))
|
|
2196
2214
|
type &= ~LOADING_BIT;
|
|
2197
2215
|
}
|
|
2198
2216
|
if (type & ERROR_BIT) {
|
|
@@ -2206,43 +2224,43 @@ var ConditionalQueue = class extends Queue {
|
|
|
2206
2224
|
return type ? super.notify(node, type, flags) : true;
|
|
2207
2225
|
}
|
|
2208
2226
|
merge(queue) {
|
|
2209
|
-
queue.
|
|
2227
|
+
queue.s.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
|
|
2210
2228
|
queue.V.forEach((n) => this.notify(n, ERROR_BIT, ERROR_BIT));
|
|
2211
2229
|
super.merge(queue);
|
|
2212
2230
|
}
|
|
2213
2231
|
};
|
|
2214
2232
|
var CollectionQueue = class extends Queue {
|
|
2215
2233
|
F;
|
|
2216
|
-
|
|
2217
|
-
|
|
2234
|
+
d = /* @__PURE__ */ new Set();
|
|
2235
|
+
t = new Computation(false, null, { pureWrite: true });
|
|
2218
2236
|
constructor(type) {
|
|
2219
2237
|
super();
|
|
2220
2238
|
this.F = type;
|
|
2221
2239
|
}
|
|
2222
2240
|
run(type) {
|
|
2223
|
-
if (!type || this.
|
|
2241
|
+
if (!type || this.t.read())
|
|
2224
2242
|
return;
|
|
2225
2243
|
return super.run(type);
|
|
2226
2244
|
}
|
|
2227
2245
|
notify(node, type, flags) {
|
|
2228
|
-
if (ActiveTransition && ActiveTransition.
|
|
2229
|
-
return ActiveTransition.
|
|
2246
|
+
if (ActiveTransition && ActiveTransition.u.has(this))
|
|
2247
|
+
return ActiveTransition.u.get(this).notify(node, type, flags);
|
|
2230
2248
|
if (!(type & this.F))
|
|
2231
2249
|
return super.notify(node, type, flags);
|
|
2232
2250
|
if (flags & this.F) {
|
|
2233
|
-
this.
|
|
2234
|
-
if (this.
|
|
2235
|
-
this.
|
|
2251
|
+
this.d.add(node);
|
|
2252
|
+
if (this.d.size === 1)
|
|
2253
|
+
this.t.write(true);
|
|
2236
2254
|
} else {
|
|
2237
|
-
this.
|
|
2238
|
-
if (this.
|
|
2239
|
-
this.
|
|
2255
|
+
this.d.delete(node);
|
|
2256
|
+
if (this.d.size === 0)
|
|
2257
|
+
this.t.write(false);
|
|
2240
2258
|
}
|
|
2241
2259
|
type &= ~this.F;
|
|
2242
2260
|
return type ? super.notify(node, type, flags) : true;
|
|
2243
2261
|
}
|
|
2244
2262
|
merge(queue) {
|
|
2245
|
-
queue.
|
|
2263
|
+
queue.d.forEach((n) => this.notify(n, this.F, this.F));
|
|
2246
2264
|
super.merge(queue);
|
|
2247
2265
|
}
|
|
2248
2266
|
};
|
|
@@ -2253,25 +2271,25 @@ function createBoundary(fn, condition) {
|
|
|
2253
2271
|
);
|
|
2254
2272
|
const tree = createBoundChildren(owner, fn, queue, 0);
|
|
2255
2273
|
new EagerComputation(void 0, () => {
|
|
2256
|
-
const disabled = queue.
|
|
2274
|
+
const disabled = queue.t.read();
|
|
2257
2275
|
tree.U = disabled ? ERROR_BIT | LOADING_BIT : 0;
|
|
2258
2276
|
if (!disabled) {
|
|
2259
|
-
queue.
|
|
2277
|
+
queue.s.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
|
|
2260
2278
|
queue.V.forEach((node) => queue.notify(node, ERROR_BIT, ERROR_BIT));
|
|
2261
|
-
queue.
|
|
2279
|
+
queue.s.clear();
|
|
2262
2280
|
queue.V.clear();
|
|
2263
2281
|
}
|
|
2264
2282
|
});
|
|
2265
|
-
return () => queue.
|
|
2283
|
+
return () => queue.t.read() ? void 0 : tree.read();
|
|
2266
2284
|
}
|
|
2267
2285
|
function createCollectionBoundary(type, fn, fallback) {
|
|
2268
2286
|
const owner = new Owner();
|
|
2269
2287
|
const queue = new CollectionQueue(type);
|
|
2270
2288
|
const tree = createBoundChildren(owner, fn, queue, type);
|
|
2271
2289
|
const decision = new Computation(void 0, () => {
|
|
2272
|
-
if (!queue.
|
|
2290
|
+
if (!queue.t.read()) {
|
|
2273
2291
|
const resolved = tree.read();
|
|
2274
|
-
if (!queue.
|
|
2292
|
+
if (!queue.t.read())
|
|
2275
2293
|
return resolved;
|
|
2276
2294
|
}
|
|
2277
2295
|
return fallback(queue);
|
|
@@ -2283,13 +2301,15 @@ function createSuspense(fn, fallback) {
|
|
|
2283
2301
|
}
|
|
2284
2302
|
function createErrorBoundary(fn, fallback) {
|
|
2285
2303
|
return createCollectionBoundary(ERROR_BIT, fn, (queue) => {
|
|
2286
|
-
let node = queue.
|
|
2304
|
+
let node = queue.d.values().next().value;
|
|
2287
2305
|
ActiveTransition && ActiveTransition.a.has(node) && (node = ActiveTransition.a.get(node));
|
|
2288
|
-
return fallback(node.
|
|
2306
|
+
return fallback(node.K, () => {
|
|
2289
2307
|
var _a;
|
|
2290
2308
|
incrementClock();
|
|
2291
|
-
for (let node2 of queue.
|
|
2292
|
-
node2.
|
|
2309
|
+
for (let node2 of queue.d) {
|
|
2310
|
+
if (ActiveTransition && !node2.g)
|
|
2311
|
+
node2 = cloneGraph(node2);
|
|
2312
|
+
node2.c = STATE_DIRTY;
|
|
2293
2313
|
(_a = node2.l) == null ? void 0 : _a.enqueue(node2.A, node2.C.bind(node2));
|
|
2294
2314
|
}
|
|
2295
2315
|
});
|