@solidjs/signals 0.9.3 → 0.9.4
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 +8 -10
- package/dist/node.cjs +96 -98
- package/dist/prod.js +62 -64
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -1082,9 +1082,7 @@ function createSignal(first, second, third) {
|
|
|
1082
1082
|
const node = computed(first, second, third);
|
|
1083
1083
|
return [read.bind(null, node), setSignal.bind(null, node)];
|
|
1084
1084
|
}
|
|
1085
|
-
const
|
|
1086
|
-
const needsId = o?.id != null;
|
|
1087
|
-
const node = signal(first, needsId ? { id: getNextChildId(o), ...second } : second);
|
|
1085
|
+
const node = signal(first, second);
|
|
1088
1086
|
return [read.bind(null, node), setSignal.bind(null, node)];
|
|
1089
1087
|
}
|
|
1090
1088
|
function createMemo(compute, value, options) {
|
|
@@ -1143,8 +1141,10 @@ function createOptimistic(first, second, third) {
|
|
|
1143
1141
|
if (typeof first === "function") {
|
|
1144
1142
|
const node = computed(
|
|
1145
1143
|
prev => {
|
|
1146
|
-
|
|
1147
|
-
|
|
1144
|
+
const n = getOwner();
|
|
1145
|
+
const value = first(prev);
|
|
1146
|
+
if (n._statusFlags & STATUS_UNINITIALIZED) return value;
|
|
1147
|
+
n._pendingValue = value;
|
|
1148
1148
|
return prev;
|
|
1149
1149
|
},
|
|
1150
1150
|
second,
|
|
@@ -1153,9 +1153,7 @@ function createOptimistic(first, second, third) {
|
|
|
1153
1153
|
node._optimistic = true;
|
|
1154
1154
|
return [read.bind(null, node), setSignal.bind(null, node)];
|
|
1155
1155
|
}
|
|
1156
|
-
const
|
|
1157
|
-
const needsId = o?.id != null;
|
|
1158
|
-
const node = signal(first, needsId ? { id: getNextChildId(o), ...second } : second);
|
|
1156
|
+
const node = signal(first, second);
|
|
1159
1157
|
node._optimistic = true;
|
|
1160
1158
|
return [
|
|
1161
1159
|
read.bind(null, node),
|
|
@@ -1338,13 +1336,13 @@ function createProjectionInternal(fn, initialValue = {}, options) {
|
|
|
1338
1336
|
};
|
|
1339
1337
|
const wrappedStore = wrapProjection(initialValue);
|
|
1340
1338
|
node = computed(() => {
|
|
1341
|
-
const owner =
|
|
1339
|
+
const owner = getOwner();
|
|
1342
1340
|
storeSetter(new Proxy(wrappedStore, writeTraps), s => {
|
|
1343
1341
|
const value = handleAsync(owner, fn(s), value => {
|
|
1344
1342
|
value !== wrappedStore &&
|
|
1345
1343
|
value !== undefined &&
|
|
1346
1344
|
storeSetter(wrappedStore, reconcile(value, options?.key || "id", options?.all));
|
|
1347
|
-
setSignal(
|
|
1345
|
+
setSignal(owner, undefined);
|
|
1348
1346
|
});
|
|
1349
1347
|
value !== wrappedStore &&
|
|
1350
1348
|
value !== undefined &&
|
package/dist/node.cjs
CHANGED
|
@@ -80,8 +80,8 @@ function deleteFromHeap(e, t) {
|
|
|
80
80
|
e.p = undefined;
|
|
81
81
|
}
|
|
82
82
|
function markHeap(e) {
|
|
83
|
-
if (e.
|
|
84
|
-
e.
|
|
83
|
+
if (e.m) return;
|
|
84
|
+
e.m = true;
|
|
85
85
|
for (let t = 0; t <= e._; t++) {
|
|
86
86
|
for (let n = e.l[t]; n !== undefined; n = n.p) {
|
|
87
87
|
if (n.S & i) markNode(n);
|
|
@@ -92,19 +92,19 @@ function markNode(e, r = n) {
|
|
|
92
92
|
const i = e.S;
|
|
93
93
|
if ((i & (t | n)) >= r) return;
|
|
94
94
|
e.S = (i & -4) | r;
|
|
95
|
-
for (let n = e.
|
|
95
|
+
for (let n = e.O; n !== null; n = n.C) {
|
|
96
96
|
markNode(n.N, t);
|
|
97
97
|
}
|
|
98
98
|
if (e.k !== null) {
|
|
99
99
|
for (let n = e.k; n !== null; n = n.j) {
|
|
100
|
-
for (let e = n.
|
|
100
|
+
for (let e = n.O; e !== null; e = e.C) {
|
|
101
101
|
markNode(e.N, t);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
function runHeap(e, t) {
|
|
107
|
-
e.
|
|
107
|
+
e.m = false;
|
|
108
108
|
for (e.P = 0; e.P <= e._; e.P++) {
|
|
109
109
|
let n = e.l[e.P];
|
|
110
110
|
while (n !== undefined) {
|
|
@@ -125,28 +125,28 @@ function adjustHeight(e, t) {
|
|
|
125
125
|
}
|
|
126
126
|
if (e.o !== n) {
|
|
127
127
|
e.o = n;
|
|
128
|
-
for (let n = e.
|
|
128
|
+
for (let n = e.O; n !== null; n = n.C) {
|
|
129
129
|
insertIntoHeapHeight(n.N, t);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
const _ = new Set();
|
|
134
134
|
let S = false;
|
|
135
|
-
const b = { l: new Array(2e3).fill(undefined),
|
|
136
|
-
const
|
|
137
|
-
let
|
|
135
|
+
const b = { l: new Array(2e3).fill(undefined), m: false, P: 0, _: 0 };
|
|
136
|
+
const m = { l: new Array(2e3).fill(undefined), m: false, P: 0, _: 0 };
|
|
137
|
+
let O = 0;
|
|
138
138
|
let x = null;
|
|
139
|
-
let
|
|
139
|
+
let v = false;
|
|
140
140
|
function schedule() {
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
if (!
|
|
141
|
+
if (v) return;
|
|
142
|
+
v = true;
|
|
143
|
+
if (!C.R) Promise.resolve().then(() => queueMicrotask(flush));
|
|
144
144
|
}
|
|
145
145
|
class Queue {
|
|
146
146
|
i = null;
|
|
147
147
|
V = [[], []];
|
|
148
148
|
q = [];
|
|
149
|
-
created =
|
|
149
|
+
created = O;
|
|
150
150
|
addChild(e) {
|
|
151
151
|
this.q.push(e);
|
|
152
152
|
e.i = this;
|
|
@@ -214,11 +214,11 @@ class GlobalQueue extends Queue {
|
|
|
214
214
|
if (x) {
|
|
215
215
|
if (!transitionComplete(x)) {
|
|
216
216
|
let e = x;
|
|
217
|
-
runHeap(
|
|
217
|
+
runHeap(m, GlobalQueue.D);
|
|
218
218
|
this.M = [];
|
|
219
219
|
this.stashQueues(x.queueStash);
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
O++;
|
|
221
|
+
v = false;
|
|
222
222
|
runTransitionPending(x.pendingNodes, true);
|
|
223
223
|
x = null;
|
|
224
224
|
runOptimistic(e);
|
|
@@ -230,10 +230,10 @@ class GlobalQueue extends Queue {
|
|
|
230
230
|
_.delete(x);
|
|
231
231
|
x = null;
|
|
232
232
|
runTransitionPending(this.M, false);
|
|
233
|
-
} else if (_.size) runHeap(
|
|
233
|
+
} else if (_.size) runHeap(m, GlobalQueue.D);
|
|
234
234
|
runOptimistic();
|
|
235
|
-
|
|
236
|
-
|
|
235
|
+
O++;
|
|
236
|
+
v = false;
|
|
237
237
|
this.run(d);
|
|
238
238
|
this.run(h);
|
|
239
239
|
} finally {
|
|
@@ -253,10 +253,10 @@ class GlobalQueue extends Queue {
|
|
|
253
253
|
return false;
|
|
254
254
|
}
|
|
255
255
|
initTransition(e) {
|
|
256
|
-
if (x && x.time ===
|
|
256
|
+
if (x && x.time === O) return;
|
|
257
257
|
if (!x) {
|
|
258
258
|
x = e?.G ?? {
|
|
259
|
-
time:
|
|
259
|
+
time: O,
|
|
260
260
|
pendingNodes: [],
|
|
261
261
|
asyncNodes: [],
|
|
262
262
|
optimisticNodes: [],
|
|
@@ -266,7 +266,7 @@ class GlobalQueue extends Queue {
|
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
268
|
_.add(x);
|
|
269
|
-
x.time =
|
|
269
|
+
x.time = O;
|
|
270
270
|
for (let e = 0; e < this.M.length; e++) {
|
|
271
271
|
const t = this.M[e];
|
|
272
272
|
t.G = x;
|
|
@@ -282,15 +282,15 @@ class GlobalQueue extends Queue {
|
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
function notifySubs(e) {
|
|
285
|
-
for (let t = e.
|
|
286
|
-
const e = t.N.S & o ?
|
|
285
|
+
for (let t = e.O; t !== null; t = t.C) {
|
|
286
|
+
const e = t.N.S & o ? m : b;
|
|
287
287
|
if (e.P > t.N.o) e.P = t.N.o;
|
|
288
288
|
insertIntoHeap(t.N, e);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
function runOptimistic(e = null) {
|
|
292
292
|
let t = !e;
|
|
293
|
-
const n =
|
|
293
|
+
const n = C.T;
|
|
294
294
|
S = true;
|
|
295
295
|
for (let t = 0; t < n.length; t++) {
|
|
296
296
|
const r = n[t];
|
|
@@ -301,13 +301,13 @@ function runOptimistic(e = null) {
|
|
|
301
301
|
r.G = e;
|
|
302
302
|
notifySubs(r);
|
|
303
303
|
}
|
|
304
|
-
|
|
304
|
+
C.T = [];
|
|
305
305
|
if (b._ >= b.P) {
|
|
306
306
|
t = true;
|
|
307
307
|
runHeap(b, GlobalQueue.D);
|
|
308
308
|
}
|
|
309
309
|
S = false;
|
|
310
|
-
t && runPending(
|
|
310
|
+
t && runPending(C.M);
|
|
311
311
|
}
|
|
312
312
|
function runPending(e) {
|
|
313
313
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -329,10 +329,10 @@ function runTransitionPending(e, t) {
|
|
|
329
329
|
if (r.Y) r.Y.Z(t);
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
const
|
|
332
|
+
const C = new GlobalQueue();
|
|
333
333
|
function flush() {
|
|
334
|
-
while (
|
|
335
|
-
|
|
334
|
+
while (v) {
|
|
335
|
+
C.flush();
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
function runQueue(e, t) {
|
|
@@ -363,7 +363,7 @@ function runInTransition(e, t) {
|
|
|
363
363
|
function action(e) {
|
|
364
364
|
return (...t) => {
|
|
365
365
|
const n = e(...t);
|
|
366
|
-
|
|
366
|
+
C.initTransition();
|
|
367
367
|
let r = x;
|
|
368
368
|
r.actions.push(n);
|
|
369
369
|
const step = e => {
|
|
@@ -397,8 +397,8 @@ let A = null;
|
|
|
397
397
|
function recompute(t, n = false) {
|
|
398
398
|
const i = t.J && t.G != x;
|
|
399
399
|
if (!n) {
|
|
400
|
-
if (t.G && x !== t.G && !i)
|
|
401
|
-
deleteFromHeap(t, t.S & o ?
|
|
400
|
+
if (t.G && x !== t.G && !i) C.initTransition(t);
|
|
401
|
+
deleteFromHeap(t, t.S & o ? m : b);
|
|
402
402
|
if (t.G) disposeChildren(t);
|
|
403
403
|
else {
|
|
404
404
|
markDisposal(t);
|
|
@@ -412,7 +412,7 @@ function recompute(t, n = false) {
|
|
|
412
412
|
A = t;
|
|
413
413
|
t.ie = null;
|
|
414
414
|
t.S = r;
|
|
415
|
-
t.se =
|
|
415
|
+
t.se = O;
|
|
416
416
|
let u = t.U === p || (t.oe && t.G) ? t.L : t.U;
|
|
417
417
|
let d = t.o;
|
|
418
418
|
let h = t.$;
|
|
@@ -455,12 +455,12 @@ function recompute(t, n = false) {
|
|
|
455
455
|
}
|
|
456
456
|
(!t.oe || S) && notifySubs(t);
|
|
457
457
|
} else if (t.o != d) {
|
|
458
|
-
for (let e = t.
|
|
459
|
-
insertIntoHeapHeight(e.N, e.N.S & o ?
|
|
458
|
+
for (let e = t.O; e !== null; e = e.C) {
|
|
459
|
+
insertIntoHeapHeight(e.N, e.N.S & o ? m : b);
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
t.oe && !S &&
|
|
463
|
-
(!n || t.$ & f) && !t.G &&
|
|
462
|
+
t.oe && !S && C.T.push(t);
|
|
463
|
+
(!n || t.$ & f) && !t.G && C.M.push(t);
|
|
464
464
|
t.G && i && runInTransition(t.G, () => recompute(t));
|
|
465
465
|
}
|
|
466
466
|
function handleAsync(e, t, n) {
|
|
@@ -475,14 +475,14 @@ function handleAsync(e, t, n) {
|
|
|
475
475
|
if (i) {
|
|
476
476
|
t.then(r => {
|
|
477
477
|
if (e.ce !== t) return;
|
|
478
|
-
|
|
478
|
+
C.initTransition(e);
|
|
479
479
|
n?.(r) ?? setSignal(e, () => r);
|
|
480
480
|
flush();
|
|
481
481
|
}).catch(n => {
|
|
482
482
|
if (e.ce !== t) return;
|
|
483
|
-
|
|
483
|
+
C.initTransition(e);
|
|
484
484
|
setStatusFlags(e, c, n);
|
|
485
|
-
e.se =
|
|
485
|
+
e.se = O;
|
|
486
486
|
notifySubs(e);
|
|
487
487
|
schedule();
|
|
488
488
|
flush();
|
|
@@ -492,22 +492,22 @@ function handleAsync(e, t, n) {
|
|
|
492
492
|
try {
|
|
493
493
|
for await (let r of t) {
|
|
494
494
|
if (e.ce !== t) return;
|
|
495
|
-
|
|
495
|
+
C.initTransition(e);
|
|
496
496
|
n?.(r) ?? setSignal(e, () => r);
|
|
497
497
|
flush();
|
|
498
498
|
}
|
|
499
499
|
} catch (n) {
|
|
500
500
|
if (e.ce !== t) return;
|
|
501
|
-
|
|
501
|
+
C.initTransition(e);
|
|
502
502
|
setStatusFlags(e, c, n);
|
|
503
|
-
e.se =
|
|
503
|
+
e.se = O;
|
|
504
504
|
notifySubs(e);
|
|
505
505
|
schedule();
|
|
506
506
|
flush();
|
|
507
507
|
}
|
|
508
508
|
})();
|
|
509
509
|
}
|
|
510
|
-
|
|
510
|
+
C.initTransition(e);
|
|
511
511
|
throw new NotReadyError(A);
|
|
512
512
|
}
|
|
513
513
|
function updateIfNecessary(r) {
|
|
@@ -537,7 +537,7 @@ function unlinkSubs(e) {
|
|
|
537
537
|
else t.de = i;
|
|
538
538
|
if (i !== null) i.C = r;
|
|
539
539
|
else {
|
|
540
|
-
t.
|
|
540
|
+
t.O = r;
|
|
541
541
|
if (r === null) {
|
|
542
542
|
t.he?.();
|
|
543
543
|
t.H && !t.pe && unobserved(t);
|
|
@@ -546,7 +546,7 @@ function unlinkSubs(e) {
|
|
|
546
546
|
return n;
|
|
547
547
|
}
|
|
548
548
|
function unobserved(e) {
|
|
549
|
-
deleteFromHeap(e, e.S & o ?
|
|
549
|
+
deleteFromHeap(e, e.S & o ? m : b);
|
|
550
550
|
let t = e.W;
|
|
551
551
|
while (t !== null) {
|
|
552
552
|
t = unlinkSubs(t);
|
|
@@ -572,7 +572,7 @@ function link(e, t) {
|
|
|
572
572
|
if (n !== null) n.A = u;
|
|
573
573
|
else t.W = u;
|
|
574
574
|
if (o !== null) o.C = u;
|
|
575
|
-
else e.
|
|
575
|
+
else e.O = u;
|
|
576
576
|
}
|
|
577
577
|
function isValidLink(e, t) {
|
|
578
578
|
const n = t.ie;
|
|
@@ -596,7 +596,7 @@ function markDisposal(e) {
|
|
|
596
596
|
t.S |= o;
|
|
597
597
|
if (t.S & i) {
|
|
598
598
|
deleteFromHeap(t, b);
|
|
599
|
-
insertIntoHeap(t,
|
|
599
|
+
insertIntoHeap(t, m);
|
|
600
600
|
}
|
|
601
601
|
markDisposal(t);
|
|
602
602
|
t = t.ye;
|
|
@@ -619,7 +619,7 @@ function disposeChildren(e, t = false, n) {
|
|
|
619
619
|
const e = r.ye;
|
|
620
620
|
if (r.W) {
|
|
621
621
|
const e = r;
|
|
622
|
-
deleteFromHeap(e, e.S & o ?
|
|
622
|
+
deleteFromHeap(e, e.S & o ? m : b);
|
|
623
623
|
let t = e.W;
|
|
624
624
|
do {
|
|
625
625
|
t = unlinkSubs(t);
|
|
@@ -667,7 +667,7 @@ function computed(t, n, r) {
|
|
|
667
667
|
we: !!r?.pureWrite,
|
|
668
668
|
he: r?.unobserved,
|
|
669
669
|
te: null,
|
|
670
|
-
_e: A?._e ??
|
|
670
|
+
_e: A?._e ?? C,
|
|
671
671
|
Se: A?.Se ?? g,
|
|
672
672
|
ge: 0,
|
|
673
673
|
H: t,
|
|
@@ -678,14 +678,14 @@ function computed(t, n, r) {
|
|
|
678
678
|
h: null,
|
|
679
679
|
W: null,
|
|
680
680
|
ie: null,
|
|
681
|
-
|
|
681
|
+
O: null,
|
|
682
682
|
de: null,
|
|
683
683
|
i: A,
|
|
684
684
|
ye: null,
|
|
685
685
|
re: null,
|
|
686
686
|
S: e,
|
|
687
687
|
$: a,
|
|
688
|
-
se:
|
|
688
|
+
se: O,
|
|
689
689
|
U: p,
|
|
690
690
|
ee: null,
|
|
691
691
|
ne: null,
|
|
@@ -715,10 +715,10 @@ function signal(e, t, n = null) {
|
|
|
715
715
|
we: !!t?.pureWrite,
|
|
716
716
|
he: t?.unobserved,
|
|
717
717
|
L: e,
|
|
718
|
-
|
|
718
|
+
O: null,
|
|
719
719
|
de: null,
|
|
720
720
|
$: l,
|
|
721
|
-
se:
|
|
721
|
+
se: O,
|
|
722
722
|
F: n,
|
|
723
723
|
j: n?.k || null,
|
|
724
724
|
U: p
|
|
@@ -748,9 +748,9 @@ function read(e) {
|
|
|
748
748
|
const n = e.F || e;
|
|
749
749
|
if (n.H) {
|
|
750
750
|
const r = e.S & o;
|
|
751
|
-
if (n.o >= (r ?
|
|
751
|
+
if (n.o >= (r ? m.P : b.P)) {
|
|
752
752
|
markNode(t);
|
|
753
|
-
markHeap(r ?
|
|
753
|
+
markHeap(r ? m : b);
|
|
754
754
|
updateIfNecessary(n);
|
|
755
755
|
}
|
|
756
756
|
const i = n.o;
|
|
@@ -790,7 +790,7 @@ function read(e) {
|
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
if (e.$ & c) {
|
|
793
|
-
if (e.se <
|
|
793
|
+
if (e.se < O) {
|
|
794
794
|
recompute(e, true);
|
|
795
795
|
return read(e);
|
|
796
796
|
} else {
|
|
@@ -808,14 +808,14 @@ function setSignal(e, t) {
|
|
|
808
808
|
if (n) {
|
|
809
809
|
if (e.oe) e.L = t;
|
|
810
810
|
else {
|
|
811
|
-
if (e.U === p)
|
|
811
|
+
if (e.U === p) C.M.push(e);
|
|
812
812
|
e.U = t;
|
|
813
813
|
}
|
|
814
814
|
if (e.fe) setSignal(e.fe, t);
|
|
815
815
|
}
|
|
816
816
|
setStatusFlags(e, l);
|
|
817
|
-
e.se =
|
|
818
|
-
e.oe && !S ?
|
|
817
|
+
e.se = O;
|
|
818
|
+
e.oe && !S ? C.T.push(e) : notifySubs(e);
|
|
819
819
|
schedule();
|
|
820
820
|
return t;
|
|
821
821
|
}
|
|
@@ -846,7 +846,7 @@ function createOwner(e) {
|
|
|
846
846
|
ye: null,
|
|
847
847
|
te: null,
|
|
848
848
|
id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
|
|
849
|
-
_e: t?._e ??
|
|
849
|
+
_e: t?._e ?? C,
|
|
850
850
|
Se: t?.Se || g,
|
|
851
851
|
ge: 0,
|
|
852
852
|
ee: null,
|
|
@@ -962,10 +962,10 @@ function effect(e, t, n, r, i) {
|
|
|
962
962
|
...i,
|
|
963
963
|
be: {
|
|
964
964
|
X: true,
|
|
965
|
-
|
|
966
|
-
|
|
965
|
+
me: r,
|
|
966
|
+
Oe: t,
|
|
967
967
|
xe: n,
|
|
968
|
-
|
|
968
|
+
ve: undefined,
|
|
969
969
|
J: i?.render ? d : h,
|
|
970
970
|
le(e, t) {
|
|
971
971
|
if (s) {
|
|
@@ -980,8 +980,8 @@ function effect(e, t, n, r, i) {
|
|
|
980
980
|
try {
|
|
981
981
|
return this.xe
|
|
982
982
|
? this.xe(e, () => {
|
|
983
|
-
this.
|
|
984
|
-
this.
|
|
983
|
+
this.ve?.();
|
|
984
|
+
this.ve = undefined;
|
|
985
985
|
})
|
|
986
986
|
: console.error(e);
|
|
987
987
|
} catch (t) {
|
|
@@ -1000,18 +1000,18 @@ function effect(e, t, n, r, i) {
|
|
|
1000
1000
|
!i?.defer &&
|
|
1001
1001
|
!(o.$ & (c | f)) &&
|
|
1002
1002
|
(o.J === h ? o._e.enqueue(o.J, runEffect.bind(o)) : runEffect.call(o));
|
|
1003
|
-
onCleanup(() => o.
|
|
1003
|
+
onCleanup(() => o.ve?.());
|
|
1004
1004
|
}
|
|
1005
1005
|
function runEffect() {
|
|
1006
1006
|
if (!this.X || this.S & u) return;
|
|
1007
|
-
this.
|
|
1008
|
-
this.
|
|
1007
|
+
this.ve?.();
|
|
1008
|
+
this.ve = undefined;
|
|
1009
1009
|
try {
|
|
1010
|
-
this.
|
|
1010
|
+
this.ve = this.Oe(this.L, this.me);
|
|
1011
1011
|
} catch (e) {
|
|
1012
1012
|
if (!this._e.notify(this, c, c)) throw e;
|
|
1013
1013
|
} finally {
|
|
1014
|
-
this.
|
|
1014
|
+
this.me = this.L;
|
|
1015
1015
|
this.X = false;
|
|
1016
1016
|
}
|
|
1017
1017
|
}
|
|
@@ -1020,10 +1020,8 @@ function createSignal(e, t, n) {
|
|
|
1020
1020
|
const r = computed(e, t, n);
|
|
1021
1021
|
return [read.bind(null, r), setSignal.bind(null, r)];
|
|
1022
1022
|
}
|
|
1023
|
-
const r =
|
|
1024
|
-
|
|
1025
|
-
const s = signal(e, i ? { id: getNextChildId(r), ...t } : t);
|
|
1026
|
-
return [read.bind(null, s), setSignal.bind(null, s)];
|
|
1023
|
+
const r = signal(e, t);
|
|
1024
|
+
return [read.bind(null, r), setSignal.bind(null, r)];
|
|
1027
1025
|
}
|
|
1028
1026
|
function createMemo(e, t, n) {
|
|
1029
1027
|
let r = computed(e, t, n);
|
|
@@ -1075,8 +1073,10 @@ function createOptimistic(e, t, n) {
|
|
|
1075
1073
|
if (typeof e === "function") {
|
|
1076
1074
|
const r = computed(
|
|
1077
1075
|
t => {
|
|
1078
|
-
|
|
1079
|
-
|
|
1076
|
+
const n = getOwner();
|
|
1077
|
+
const r = e(t);
|
|
1078
|
+
if (n.$ & a) return r;
|
|
1079
|
+
n.U = r;
|
|
1080
1080
|
return t;
|
|
1081
1081
|
},
|
|
1082
1082
|
t,
|
|
@@ -1085,15 +1085,13 @@ function createOptimistic(e, t, n) {
|
|
|
1085
1085
|
r.oe = true;
|
|
1086
1086
|
return [read.bind(null, r), setSignal.bind(null, r)];
|
|
1087
1087
|
}
|
|
1088
|
-
const r =
|
|
1089
|
-
|
|
1090
|
-
const s = signal(e, i ? { id: getNextChildId(r), ...t } : t);
|
|
1091
|
-
s.oe = true;
|
|
1088
|
+
const r = signal(e, t);
|
|
1089
|
+
r.oe = true;
|
|
1092
1090
|
return [
|
|
1093
|
-
read.bind(null,
|
|
1091
|
+
read.bind(null, r),
|
|
1094
1092
|
t => {
|
|
1095
|
-
|
|
1096
|
-
return setSignal(
|
|
1093
|
+
r.U = e;
|
|
1094
|
+
return setSignal(r, t);
|
|
1097
1095
|
}
|
|
1098
1096
|
];
|
|
1099
1097
|
}
|
|
@@ -1101,7 +1099,7 @@ function onSettled(e) {
|
|
|
1101
1099
|
let t;
|
|
1102
1100
|
const n = getOwner();
|
|
1103
1101
|
if (n) onCleanup(() => t?.());
|
|
1104
|
-
|
|
1102
|
+
C.enqueue(h, () => {
|
|
1105
1103
|
t = e();
|
|
1106
1104
|
!n && t?.();
|
|
1107
1105
|
});
|
|
@@ -1259,13 +1257,13 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1259
1257
|
};
|
|
1260
1258
|
const s = wrapProjection(t);
|
|
1261
1259
|
r = computed(() => {
|
|
1262
|
-
const t =
|
|
1263
|
-
storeSetter(new Proxy(s, E),
|
|
1264
|
-
const
|
|
1260
|
+
const t = getOwner();
|
|
1261
|
+
storeSetter(new Proxy(s, E), r => {
|
|
1262
|
+
const i = handleAsync(t, e(r), e => {
|
|
1265
1263
|
e !== s && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
|
|
1266
|
-
setSignal(
|
|
1264
|
+
setSignal(t, undefined);
|
|
1267
1265
|
});
|
|
1268
|
-
|
|
1266
|
+
i !== s && i !== undefined && reconcile(i, n?.key || "id", n?.all)(s);
|
|
1269
1267
|
});
|
|
1270
1268
|
});
|
|
1271
1269
|
r.pe = true;
|
|
@@ -1754,7 +1752,7 @@ function mapArray(e, t, n) {
|
|
|
1754
1752
|
const r = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
1755
1753
|
return createMemo(
|
|
1756
1754
|
updateKeyedMap.bind({
|
|
1757
|
-
|
|
1755
|
+
Ce: createOwner(),
|
|
1758
1756
|
Ne: 0,
|
|
1759
1757
|
ke: e,
|
|
1760
1758
|
je: [],
|
|
@@ -1773,7 +1771,7 @@ function updateKeyedMap() {
|
|
|
1773
1771
|
const e = this.ke() || [],
|
|
1774
1772
|
t = e.length;
|
|
1775
1773
|
e[I];
|
|
1776
|
-
runWithOwner(this.
|
|
1774
|
+
runWithOwner(this.Ce, () => {
|
|
1777
1775
|
let n,
|
|
1778
1776
|
r,
|
|
1779
1777
|
i = this.Ie
|
|
@@ -1797,7 +1795,7 @@ function updateKeyedMap() {
|
|
|
1797
1795
|
};
|
|
1798
1796
|
if (t === 0) {
|
|
1799
1797
|
if (this.Ne !== 0) {
|
|
1800
|
-
this.
|
|
1798
|
+
this.Ce.dispose(false);
|
|
1801
1799
|
this.Ae = [];
|
|
1802
1800
|
this.je = [];
|
|
1803
1801
|
this.We = [];
|
|
@@ -1893,7 +1891,7 @@ function updateKeyedMap() {
|
|
|
1893
1891
|
}
|
|
1894
1892
|
function repeat(e, t, n) {
|
|
1895
1893
|
return updateRepeat.bind({
|
|
1896
|
-
|
|
1894
|
+
Ce: createOwner(),
|
|
1897
1895
|
Ne: 0,
|
|
1898
1896
|
Qe: 0,
|
|
1899
1897
|
Re: e,
|
|
@@ -1907,10 +1905,10 @@ function repeat(e, t, n) {
|
|
|
1907
1905
|
function updateRepeat() {
|
|
1908
1906
|
const e = this.Re();
|
|
1909
1907
|
const t = this.Ve?.() || 0;
|
|
1910
|
-
runWithOwner(this.
|
|
1908
|
+
runWithOwner(this.Ce, () => {
|
|
1911
1909
|
if (e === 0) {
|
|
1912
1910
|
if (this.Ne !== 0) {
|
|
1913
|
-
this.
|
|
1911
|
+
this.Ce.dispose(false);
|
|
1914
1912
|
this.Ae = [];
|
|
1915
1913
|
this.We = [];
|
|
1916
1914
|
this.Ne = 0;
|
package/dist/prod.js
CHANGED
|
@@ -201,8 +201,8 @@ class Queue {
|
|
|
201
201
|
}
|
|
202
202
|
class GlobalQueue extends Queue {
|
|
203
203
|
k = false;
|
|
204
|
-
$ = [];
|
|
205
204
|
L = [];
|
|
205
|
+
$ = [];
|
|
206
206
|
static F;
|
|
207
207
|
static W;
|
|
208
208
|
flush() {
|
|
@@ -214,7 +214,7 @@ class GlobalQueue extends Queue {
|
|
|
214
214
|
if (!transitionComplete(activeTransition)) {
|
|
215
215
|
let e = activeTransition;
|
|
216
216
|
runHeap(zombieQueue, GlobalQueue.F);
|
|
217
|
-
this
|
|
217
|
+
this.L = [];
|
|
218
218
|
this.stashQueues(activeTransition.queueStash);
|
|
219
219
|
clock++;
|
|
220
220
|
scheduled = false;
|
|
@@ -223,13 +223,13 @@ class GlobalQueue extends Queue {
|
|
|
223
223
|
runOptimistic(e);
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
|
-
this
|
|
227
|
-
this
|
|
228
|
-
this
|
|
226
|
+
this.L.push(...activeTransition.pendingNodes);
|
|
227
|
+
this.$ !== activeTransition.optimisticNodes &&
|
|
228
|
+
this.$.push(...activeTransition.optimisticNodes);
|
|
229
229
|
this.restoreQueues(activeTransition.queueStash);
|
|
230
230
|
transitions.delete(activeTransition);
|
|
231
231
|
activeTransition = null;
|
|
232
|
-
runTransitionPending(this
|
|
232
|
+
runTransitionPending(this.L, false);
|
|
233
233
|
} else if (transitions.size) runHeap(zombieQueue, GlobalQueue.F);
|
|
234
234
|
runOptimistic();
|
|
235
235
|
clock++;
|
|
@@ -267,18 +267,18 @@ class GlobalQueue extends Queue {
|
|
|
267
267
|
}
|
|
268
268
|
transitions.add(activeTransition);
|
|
269
269
|
activeTransition.time = clock;
|
|
270
|
-
for (let e = 0; e < this
|
|
271
|
-
const t = this
|
|
270
|
+
for (let e = 0; e < this.L.length; e++) {
|
|
271
|
+
const t = this.L[e];
|
|
272
272
|
t.K = activeTransition;
|
|
273
273
|
activeTransition.pendingNodes.push(t);
|
|
274
274
|
}
|
|
275
|
-
for (let e = 0; e < this
|
|
276
|
-
const t = this
|
|
275
|
+
for (let e = 0; e < this.$.length; e++) {
|
|
276
|
+
const t = this.$[e];
|
|
277
277
|
t.K = activeTransition;
|
|
278
278
|
activeTransition.optimisticNodes.push(t);
|
|
279
279
|
}
|
|
280
|
-
this
|
|
281
|
-
this
|
|
280
|
+
this.L = activeTransition.pendingNodes;
|
|
281
|
+
this.$ = activeTransition.optimisticNodes;
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
function notifySubs(e) {
|
|
@@ -290,7 +290,7 @@ function notifySubs(e) {
|
|
|
290
290
|
}
|
|
291
291
|
function runOptimistic(e = null) {
|
|
292
292
|
let t = !e;
|
|
293
|
-
const n = globalQueue
|
|
293
|
+
const n = globalQueue.$;
|
|
294
294
|
optimisticRun = true;
|
|
295
295
|
for (let t = 0; t < n.length; t++) {
|
|
296
296
|
const i = n[t];
|
|
@@ -301,13 +301,13 @@ function runOptimistic(e = null) {
|
|
|
301
301
|
i.K = e;
|
|
302
302
|
notifySubs(i);
|
|
303
303
|
}
|
|
304
|
-
globalQueue
|
|
304
|
+
globalQueue.$ = [];
|
|
305
305
|
if (dirtyQueue.h >= dirtyQueue.C) {
|
|
306
306
|
t = true;
|
|
307
307
|
runHeap(dirtyQueue, GlobalQueue.F);
|
|
308
308
|
}
|
|
309
309
|
optimisticRun = false;
|
|
310
|
-
t && runPending(globalQueue
|
|
310
|
+
t && runPending(globalQueue.L);
|
|
311
311
|
}
|
|
312
312
|
function runPending(e) {
|
|
313
313
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -459,8 +459,8 @@ function recompute(e, t = false) {
|
|
|
459
459
|
insertIntoHeapHeight(t.A, t.A.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
e.oe && !optimisticRun && globalQueue
|
|
463
|
-
(!t || e.J & STATUS_PENDING) && !e.K && globalQueue
|
|
462
|
+
e.oe && !optimisticRun && globalQueue.$.push(e);
|
|
463
|
+
(!t || e.J & STATUS_PENDING) && !e.K && globalQueue.L.push(e);
|
|
464
464
|
e.K && n && runInTransition(e.K, () => recompute(e));
|
|
465
465
|
}
|
|
466
466
|
function handleAsync(e, t, n) {
|
|
@@ -813,14 +813,14 @@ function setSignal(e, t) {
|
|
|
813
813
|
if (n) {
|
|
814
814
|
if (e.oe) e.Y = t;
|
|
815
815
|
else {
|
|
816
|
-
if (e.M === NOT_PENDING) globalQueue
|
|
816
|
+
if (e.M === NOT_PENDING) globalQueue.L.push(e);
|
|
817
817
|
e.M = t;
|
|
818
818
|
}
|
|
819
819
|
if (e.ce) setSignal(e.ce, t);
|
|
820
820
|
}
|
|
821
821
|
setStatusFlags(e, STATUS_NONE);
|
|
822
822
|
e.se = clock;
|
|
823
|
-
e.oe && !optimisticRun ? globalQueue
|
|
823
|
+
e.oe && !optimisticRun ? globalQueue.$.push(e) : notifySubs(e);
|
|
824
824
|
schedule();
|
|
825
825
|
return t;
|
|
826
826
|
}
|
|
@@ -968,8 +968,8 @@ function effect(e, t, n, i, r) {
|
|
|
968
968
|
pe: {
|
|
969
969
|
X: true,
|
|
970
970
|
Ae: i,
|
|
971
|
-
|
|
972
|
-
|
|
971
|
+
Ne: t,
|
|
972
|
+
ge: n,
|
|
973
973
|
Ie: undefined,
|
|
974
974
|
B: r?.render ? EFFECT_RENDER : EFFECT_USER,
|
|
975
975
|
le(e, t) {
|
|
@@ -983,8 +983,8 @@ function effect(e, t, n, i, r) {
|
|
|
983
983
|
this._e.notify(this, STATUS_PENDING, 0);
|
|
984
984
|
if (this.B === EFFECT_USER) {
|
|
985
985
|
try {
|
|
986
|
-
return this.
|
|
987
|
-
? this.
|
|
986
|
+
return this.ge
|
|
987
|
+
? this.ge(e, () => {
|
|
988
988
|
this.Ie?.();
|
|
989
989
|
this.Ie = undefined;
|
|
990
990
|
})
|
|
@@ -1012,7 +1012,7 @@ function runEffect() {
|
|
|
1012
1012
|
this.Ie?.();
|
|
1013
1013
|
this.Ie = undefined;
|
|
1014
1014
|
try {
|
|
1015
|
-
this.Ie = this.
|
|
1015
|
+
this.Ie = this.Ne(this.Y, this.Ae);
|
|
1016
1016
|
} catch (e) {
|
|
1017
1017
|
if (!this._e.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1018
1018
|
} finally {
|
|
@@ -1025,10 +1025,8 @@ function createSignal(e, t, n) {
|
|
|
1025
1025
|
const i = computed(e, t, n);
|
|
1026
1026
|
return [read.bind(null, i), setSignal.bind(null, i)];
|
|
1027
1027
|
}
|
|
1028
|
-
const i =
|
|
1029
|
-
|
|
1030
|
-
const s = signal(e, r ? { id: getNextChildId(i), ...t } : t);
|
|
1031
|
-
return [read.bind(null, s), setSignal.bind(null, s)];
|
|
1028
|
+
const i = signal(e, t);
|
|
1029
|
+
return [read.bind(null, i), setSignal.bind(null, i)];
|
|
1032
1030
|
}
|
|
1033
1031
|
function createMemo(e, t, n) {
|
|
1034
1032
|
let i = computed(e, t, n);
|
|
@@ -1080,8 +1078,10 @@ function createOptimistic(e, t, n) {
|
|
|
1080
1078
|
if (typeof e === "function") {
|
|
1081
1079
|
const i = computed(
|
|
1082
1080
|
t => {
|
|
1083
|
-
|
|
1084
|
-
|
|
1081
|
+
const n = getOwner();
|
|
1082
|
+
const i = e(t);
|
|
1083
|
+
if (n.J & STATUS_UNINITIALIZED) return i;
|
|
1084
|
+
n.M = i;
|
|
1085
1085
|
return t;
|
|
1086
1086
|
},
|
|
1087
1087
|
t,
|
|
@@ -1090,15 +1090,13 @@ function createOptimistic(e, t, n) {
|
|
|
1090
1090
|
i.oe = true;
|
|
1091
1091
|
return [read.bind(null, i), setSignal.bind(null, i)];
|
|
1092
1092
|
}
|
|
1093
|
-
const i =
|
|
1094
|
-
|
|
1095
|
-
const s = signal(e, r ? { id: getNextChildId(i), ...t } : t);
|
|
1096
|
-
s.oe = true;
|
|
1093
|
+
const i = signal(e, t);
|
|
1094
|
+
i.oe = true;
|
|
1097
1095
|
return [
|
|
1098
|
-
read.bind(null,
|
|
1096
|
+
read.bind(null, i),
|
|
1099
1097
|
t => {
|
|
1100
|
-
|
|
1101
|
-
return setSignal(
|
|
1098
|
+
i.M = e;
|
|
1099
|
+
return setSignal(i, t);
|
|
1102
1100
|
}
|
|
1103
1101
|
];
|
|
1104
1102
|
}
|
|
@@ -1266,13 +1264,13 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
1266
1264
|
};
|
|
1267
1265
|
const s = wrapProjection(t);
|
|
1268
1266
|
i = computed(() => {
|
|
1269
|
-
const t =
|
|
1270
|
-
storeSetter(new Proxy(s, writeTraps),
|
|
1271
|
-
const
|
|
1267
|
+
const t = getOwner();
|
|
1268
|
+
storeSetter(new Proxy(s, writeTraps), i => {
|
|
1269
|
+
const r = handleAsync(t, e(i), e => {
|
|
1272
1270
|
e !== s && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
|
|
1273
|
-
setSignal(
|
|
1271
|
+
setSignal(t, undefined);
|
|
1274
1272
|
});
|
|
1275
|
-
|
|
1273
|
+
r !== s && r !== undefined && reconcile(r, n?.key || "id", n?.all)(s);
|
|
1276
1274
|
});
|
|
1277
1275
|
});
|
|
1278
1276
|
i.Te = true;
|
|
@@ -1998,30 +1996,30 @@ function createBoundChildren(e, t, n, i) {
|
|
|
1998
1996
|
});
|
|
1999
1997
|
}
|
|
2000
1998
|
class ConditionalQueue extends Queue {
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
1999
|
+
Le;
|
|
2000
|
+
$e = new Set();
|
|
2001
|
+
L = new Set();
|
|
2004
2002
|
constructor(e) {
|
|
2005
2003
|
super();
|
|
2006
|
-
this
|
|
2004
|
+
this.Le = e;
|
|
2007
2005
|
}
|
|
2008
2006
|
run(e) {
|
|
2009
|
-
if (!e || read(this
|
|
2007
|
+
if (!e || read(this.Le)) return;
|
|
2010
2008
|
return super.run(e);
|
|
2011
2009
|
}
|
|
2012
2010
|
notify(e, t, n) {
|
|
2013
|
-
if (read(this
|
|
2011
|
+
if (read(this.Le)) {
|
|
2014
2012
|
if (t & STATUS_PENDING) {
|
|
2015
2013
|
if (n & STATUS_PENDING) {
|
|
2016
|
-
this
|
|
2014
|
+
this.L.add(e);
|
|
2017
2015
|
t &= ~STATUS_PENDING;
|
|
2018
|
-
} else if (this
|
|
2016
|
+
} else if (this.L.delete(e)) t &= ~STATUS_PENDING;
|
|
2019
2017
|
}
|
|
2020
2018
|
if (t & STATUS_ERROR) {
|
|
2021
2019
|
if (n & STATUS_ERROR) {
|
|
2022
|
-
this.
|
|
2020
|
+
this.$e.add(e);
|
|
2023
2021
|
t &= ~STATUS_ERROR;
|
|
2024
|
-
} else if (this.
|
|
2022
|
+
} else if (this.$e.delete(e)) t &= ~STATUS_ERROR;
|
|
2025
2023
|
}
|
|
2026
2024
|
}
|
|
2027
2025
|
return t ? super.notify(e, t, n) : true;
|
|
@@ -2030,24 +2028,24 @@ class ConditionalQueue extends Queue {
|
|
|
2030
2028
|
class CollectionQueue extends Queue {
|
|
2031
2029
|
Fe;
|
|
2032
2030
|
Ve = new Set();
|
|
2033
|
-
|
|
2031
|
+
Le = signal(false, { pureWrite: true });
|
|
2034
2032
|
We = false;
|
|
2035
2033
|
constructor(e) {
|
|
2036
2034
|
super();
|
|
2037
2035
|
this.Fe = e;
|
|
2038
2036
|
}
|
|
2039
2037
|
run(e) {
|
|
2040
|
-
if (!e || read(this
|
|
2038
|
+
if (!e || read(this.Le)) return;
|
|
2041
2039
|
return super.run(e);
|
|
2042
2040
|
}
|
|
2043
2041
|
notify(e, t, n) {
|
|
2044
2042
|
if (!(t & this.Fe) || (this.Fe & STATUS_PENDING && this.We)) return super.notify(e, t, n);
|
|
2045
2043
|
if (n & this.Fe) {
|
|
2046
2044
|
this.Ve.add(e);
|
|
2047
|
-
if (this.Ve.size === 1) setSignal(this
|
|
2045
|
+
if (this.Ve.size === 1) setSignal(this.Le, true);
|
|
2048
2046
|
} else if (this.Ve.size > 0) {
|
|
2049
2047
|
this.Ve.delete(e);
|
|
2050
|
-
if (this.Ve.size === 0) setSignal(this
|
|
2048
|
+
if (this.Ve.size === 0) setSignal(this.Le, false);
|
|
2051
2049
|
}
|
|
2052
2050
|
t &= ~this.Fe;
|
|
2053
2051
|
return t ? super.notify(e, t, n) : true;
|
|
@@ -2063,25 +2061,25 @@ function createBoundary(e, t) {
|
|
|
2063
2061
|
const i = new ConditionalQueue(computed(() => t() === BoundaryMode.HIDDEN));
|
|
2064
2062
|
const r = createBoundChildren(n, e, i, 0);
|
|
2065
2063
|
computed(() => {
|
|
2066
|
-
const e = read(i
|
|
2064
|
+
const e = read(i.Le);
|
|
2067
2065
|
r.Qe = e ? STATUS_ERROR | STATUS_PENDING : 0;
|
|
2068
2066
|
if (!e) {
|
|
2069
|
-
i
|
|
2070
|
-
i.
|
|
2071
|
-
i
|
|
2072
|
-
i.
|
|
2067
|
+
i.L.forEach(e => i.notify(e, STATUS_PENDING, STATUS_PENDING));
|
|
2068
|
+
i.$e.forEach(e => i.notify(e, STATUS_ERROR, STATUS_ERROR));
|
|
2069
|
+
i.L.clear();
|
|
2070
|
+
i.$e.clear();
|
|
2073
2071
|
}
|
|
2074
2072
|
});
|
|
2075
|
-
return () => (read(i
|
|
2073
|
+
return () => (read(i.Le) ? undefined : read(r));
|
|
2076
2074
|
}
|
|
2077
2075
|
function createCollectionBoundary(e, t, n) {
|
|
2078
2076
|
const i = createOwner();
|
|
2079
2077
|
const r = new CollectionQueue(e);
|
|
2080
2078
|
const s = createBoundChildren(i, t, r, e);
|
|
2081
2079
|
const o = computed(() => {
|
|
2082
|
-
if (!read(r
|
|
2080
|
+
if (!read(r.Le)) {
|
|
2083
2081
|
const e = read(s);
|
|
2084
|
-
if (!untrack(() => read(r
|
|
2082
|
+
if (!untrack(() => read(r.Le))) r.We = true;
|
|
2085
2083
|
return e;
|
|
2086
2084
|
}
|
|
2087
2085
|
return n(r);
|