@solidjs/signals 0.9.4 → 0.9.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 +39 -15
- package/dist/node.cjs +165 -144
- package/dist/prod.js +53 -32
- package/dist/types/core/scheduler.d.ts +1 -1
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -226,7 +226,8 @@ class GlobalQueue extends Queue {
|
|
|
226
226
|
runOptimistic(t);
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
|
-
this._pendingNodes
|
|
229
|
+
this._pendingNodes !== activeTransition.pendingNodes &&
|
|
230
|
+
this._pendingNodes.push(...activeTransition.pendingNodes);
|
|
230
231
|
this._optimisticNodes !== activeTransition.optimisticNodes &&
|
|
231
232
|
this._optimisticNodes.push(...activeTransition.optimisticNodes);
|
|
232
233
|
this.restoreQueues(activeTransition.queueStash);
|
|
@@ -255,10 +256,12 @@ class GlobalQueue extends Queue {
|
|
|
255
256
|
}
|
|
256
257
|
return false;
|
|
257
258
|
}
|
|
258
|
-
initTransition(
|
|
259
|
-
if (
|
|
259
|
+
initTransition(transition) {
|
|
260
|
+
if (transition) transition = currentTransition(transition);
|
|
261
|
+
if (transition && transition === activeTransition) return;
|
|
262
|
+
if (!transition && activeTransition && activeTransition.time === clock) return;
|
|
260
263
|
if (!activeTransition) {
|
|
261
|
-
activeTransition =
|
|
264
|
+
activeTransition = transition ?? {
|
|
262
265
|
time: clock,
|
|
263
266
|
pendingNodes: [],
|
|
264
267
|
asyncNodes: [],
|
|
@@ -267,6 +270,11 @@ class GlobalQueue extends Queue {
|
|
|
267
270
|
queueStash: { _queues: [[], []], _children: [] },
|
|
268
271
|
done: false
|
|
269
272
|
};
|
|
273
|
+
} else if (transition) {
|
|
274
|
+
activeTransition.done = transition;
|
|
275
|
+
transition.actions.push(...activeTransition.actions);
|
|
276
|
+
transitions.delete(activeTransition);
|
|
277
|
+
activeTransition = transition;
|
|
270
278
|
}
|
|
271
279
|
transitions.add(activeTransition);
|
|
272
280
|
activeTransition.time = clock;
|
|
@@ -333,7 +341,10 @@ function runTransitionPending(pendingNodes, value) {
|
|
|
333
341
|
for (let i = 0; i < p.length; i++) {
|
|
334
342
|
const n = p[i];
|
|
335
343
|
n._transition = activeTransition;
|
|
336
|
-
if (n._pendingCheck)
|
|
344
|
+
if (n._pendingCheck) {
|
|
345
|
+
n._pendingCheck._transition = activeTransition;
|
|
346
|
+
n._pendingCheck._set(value);
|
|
347
|
+
}
|
|
337
348
|
}
|
|
338
349
|
}
|
|
339
350
|
const globalQueue = new GlobalQueue();
|
|
@@ -360,10 +371,15 @@ function transitionComplete(transition) {
|
|
|
360
371
|
done && (transition.done = true);
|
|
361
372
|
return done;
|
|
362
373
|
}
|
|
374
|
+
function currentTransition(transition) {
|
|
375
|
+
while (transition.done && typeof transition.done === "object") transition = transition.done;
|
|
376
|
+
return transition;
|
|
377
|
+
}
|
|
363
378
|
function runInTransition(transition, fn) {
|
|
364
379
|
const prevTransition = activeTransition;
|
|
380
|
+
activeTransition = null;
|
|
365
381
|
try {
|
|
366
|
-
activeTransition = transition;
|
|
382
|
+
activeTransition = currentTransition(transition);
|
|
367
383
|
return fn();
|
|
368
384
|
} finally {
|
|
369
385
|
activeTransition = prevTransition;
|
|
@@ -382,6 +398,7 @@ function action(genFn) {
|
|
|
382
398
|
};
|
|
383
399
|
const process = result => {
|
|
384
400
|
if (result.done) {
|
|
401
|
+
ctx = currentTransition(ctx);
|
|
385
402
|
ctx.actions.splice(ctx.actions.indexOf(iterator), 1);
|
|
386
403
|
activeTransition = ctx;
|
|
387
404
|
schedule();
|
|
@@ -389,7 +406,7 @@ function action(genFn) {
|
|
|
389
406
|
return;
|
|
390
407
|
}
|
|
391
408
|
const yielded = result.value;
|
|
392
|
-
if (yielded instanceof Promise) return yielded.then(step);
|
|
409
|
+
if (yielded instanceof Promise) return yielded.then(v => runInTransition(ctx, () => step(v)));
|
|
393
410
|
runInTransition(ctx, () => step(yielded));
|
|
394
411
|
};
|
|
395
412
|
runInTransition(ctx, () => step());
|
|
@@ -407,7 +424,7 @@ function recompute(el, create = false) {
|
|
|
407
424
|
const honoraryOptimistic = el._type && el._transition != activeTransition;
|
|
408
425
|
if (!create) {
|
|
409
426
|
if (el._transition && activeTransition !== el._transition && !honoraryOptimistic)
|
|
410
|
-
globalQueue.initTransition(el);
|
|
427
|
+
globalQueue.initTransition(el._transition);
|
|
411
428
|
deleteFromHeap(el, el._flags & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
412
429
|
if (el._transition) disposeChildren(el);
|
|
413
430
|
else {
|
|
@@ -466,6 +483,8 @@ function recompute(el, create = false) {
|
|
|
466
483
|
value
|
|
467
484
|
);
|
|
468
485
|
const statusFlagsChanged = el._statusFlags !== prevStatusFlags || el._error !== prevError;
|
|
486
|
+
if (el._child && el._statusFlags & STATUS_PENDING && activeTransition)
|
|
487
|
+
activeTransition.asyncNodes.push(el);
|
|
469
488
|
el._notifyQueue?.(statusFlagsChanged, prevStatusFlags);
|
|
470
489
|
if (valueChanged || statusFlagsChanged) {
|
|
471
490
|
if (valueChanged) {
|
|
@@ -498,13 +517,13 @@ function handleAsync(el, result, setter) {
|
|
|
498
517
|
result
|
|
499
518
|
.then(value => {
|
|
500
519
|
if (el._inFlight !== result) return;
|
|
501
|
-
globalQueue.initTransition(el);
|
|
502
|
-
setter
|
|
520
|
+
globalQueue.initTransition(el._transition);
|
|
521
|
+
setter ? setter(value) : setSignal(el, () => value);
|
|
503
522
|
flush();
|
|
504
523
|
})
|
|
505
524
|
.catch(e => {
|
|
506
525
|
if (el._inFlight !== result) return;
|
|
507
|
-
globalQueue.initTransition(el);
|
|
526
|
+
globalQueue.initTransition(el._transition);
|
|
508
527
|
setStatusFlags(el, STATUS_ERROR, e);
|
|
509
528
|
el._time = clock;
|
|
510
529
|
notifySubs(el);
|
|
@@ -516,13 +535,13 @@ function handleAsync(el, result, setter) {
|
|
|
516
535
|
try {
|
|
517
536
|
for await (let value of result) {
|
|
518
537
|
if (el._inFlight !== result) return;
|
|
519
|
-
globalQueue.initTransition(el);
|
|
520
|
-
setter
|
|
538
|
+
globalQueue.initTransition(el._transition);
|
|
539
|
+
setter ? setter(value) : setSignal(el, () => value);
|
|
521
540
|
flush();
|
|
522
541
|
}
|
|
523
542
|
} catch (error) {
|
|
524
543
|
if (el._inFlight !== result) return;
|
|
525
|
-
globalQueue.initTransition(el);
|
|
544
|
+
globalQueue.initTransition(el._transition);
|
|
526
545
|
setStatusFlags(el, STATUS_ERROR, error);
|
|
527
546
|
el._time = clock;
|
|
528
547
|
notifySubs(el);
|
|
@@ -531,7 +550,7 @@ function handleAsync(el, result, setter) {
|
|
|
531
550
|
}
|
|
532
551
|
})();
|
|
533
552
|
}
|
|
534
|
-
globalQueue.initTransition(el);
|
|
553
|
+
globalQueue.initTransition(el._transition);
|
|
535
554
|
throw new NotReadyError(context);
|
|
536
555
|
}
|
|
537
556
|
function updateIfNecessary(el) {
|
|
@@ -840,6 +859,8 @@ function read(el) {
|
|
|
840
859
|
function setSignal(el, v) {
|
|
841
860
|
if (!el._pureWrite && context && el._firewall !== context)
|
|
842
861
|
console.warn("A Signal was written to in an owned scope.");
|
|
862
|
+
if (el._transition && activeTransition !== el._transition)
|
|
863
|
+
globalQueue.initTransition(el._transition);
|
|
843
864
|
if (typeof v === "function") {
|
|
844
865
|
v = v(
|
|
845
866
|
el._pendingValue === NOT_PENDING || (el._optimistic && el._transition)
|
|
@@ -924,11 +945,14 @@ function createRoot(init, options) {
|
|
|
924
945
|
}
|
|
925
946
|
function runWithOwner(owner, fn) {
|
|
926
947
|
const oldContext = context;
|
|
948
|
+
const prevTracking = tracking;
|
|
927
949
|
context = owner;
|
|
950
|
+
tracking = false;
|
|
928
951
|
try {
|
|
929
952
|
return fn();
|
|
930
953
|
} finally {
|
|
931
954
|
context = oldContext;
|
|
955
|
+
tracking = prevTracking;
|
|
932
956
|
}
|
|
933
957
|
}
|
|
934
958
|
function staleValues(fn, set = true) {
|
package/dist/node.cjs
CHANGED
|
@@ -144,17 +144,17 @@ function schedule() {
|
|
|
144
144
|
}
|
|
145
145
|
class Queue {
|
|
146
146
|
i = null;
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
T = [[], []];
|
|
148
|
+
V = [];
|
|
149
149
|
created = O;
|
|
150
150
|
addChild(e) {
|
|
151
|
-
this.
|
|
151
|
+
this.V.push(e);
|
|
152
152
|
e.i = this;
|
|
153
153
|
}
|
|
154
154
|
removeChild(e) {
|
|
155
|
-
const t = this.
|
|
155
|
+
const t = this.V.indexOf(e);
|
|
156
156
|
if (t >= 0) {
|
|
157
|
-
this.
|
|
157
|
+
this.V.splice(t, 1);
|
|
158
158
|
e.i = null;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
@@ -163,47 +163,47 @@ class Queue {
|
|
|
163
163
|
return false;
|
|
164
164
|
}
|
|
165
165
|
run(e) {
|
|
166
|
-
if (this.
|
|
167
|
-
const t = this.
|
|
168
|
-
this.
|
|
166
|
+
if (this.T[e - 1].length) {
|
|
167
|
+
const t = this.T[e - 1];
|
|
168
|
+
this.T[e - 1] = [];
|
|
169
169
|
runQueue(t, e);
|
|
170
170
|
}
|
|
171
|
-
for (let t = 0; t < this.
|
|
172
|
-
this.
|
|
171
|
+
for (let t = 0; t < this.V.length; t++) {
|
|
172
|
+
this.V[t].run(e);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
enqueue(e, t) {
|
|
176
|
-
if (e) this.
|
|
176
|
+
if (e) this.T[e - 1].push(t);
|
|
177
177
|
schedule();
|
|
178
178
|
}
|
|
179
179
|
stashQueues(e) {
|
|
180
|
-
e.
|
|
181
|
-
e.
|
|
182
|
-
this.
|
|
183
|
-
for (let t = 0; t < this.
|
|
184
|
-
let n = this.
|
|
185
|
-
let r = e.
|
|
180
|
+
e.T[0].push(...this.T[0]);
|
|
181
|
+
e.T[1].push(...this.T[1]);
|
|
182
|
+
this.T = [[], []];
|
|
183
|
+
for (let t = 0; t < this.V.length; t++) {
|
|
184
|
+
let n = this.V[t];
|
|
185
|
+
let r = e.V[t];
|
|
186
186
|
if (!r) {
|
|
187
|
-
r = {
|
|
188
|
-
e.
|
|
187
|
+
r = { T: [[], []], V: [] };
|
|
188
|
+
e.V[t] = r;
|
|
189
189
|
}
|
|
190
190
|
n.stashQueues(r);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
restoreQueues(e) {
|
|
194
|
-
this.
|
|
195
|
-
this.
|
|
196
|
-
for (let t = 0; t < e.
|
|
197
|
-
const n = e.
|
|
198
|
-
let r = this.
|
|
194
|
+
this.T[0].push(...e.T[0]);
|
|
195
|
+
this.T[1].push(...e.T[1]);
|
|
196
|
+
for (let t = 0; t < e.V.length; t++) {
|
|
197
|
+
const n = e.V[t];
|
|
198
|
+
let r = this.V[t];
|
|
199
199
|
if (r) r.restoreQueues(n);
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
class GlobalQueue extends Queue {
|
|
204
204
|
R = false;
|
|
205
|
+
q = [];
|
|
205
206
|
M = [];
|
|
206
|
-
T = [];
|
|
207
207
|
static D;
|
|
208
208
|
static B;
|
|
209
209
|
flush() {
|
|
@@ -215,7 +215,7 @@ class GlobalQueue extends Queue {
|
|
|
215
215
|
if (!transitionComplete(x)) {
|
|
216
216
|
let e = x;
|
|
217
217
|
runHeap(m, GlobalQueue.D);
|
|
218
|
-
this.
|
|
218
|
+
this.q = [];
|
|
219
219
|
this.stashQueues(x.queueStash);
|
|
220
220
|
O++;
|
|
221
221
|
v = false;
|
|
@@ -224,12 +224,12 @@ class GlobalQueue extends Queue {
|
|
|
224
224
|
runOptimistic(e);
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
|
-
this.
|
|
228
|
-
this.
|
|
227
|
+
this.q !== x.pendingNodes && this.q.push(...x.pendingNodes);
|
|
228
|
+
this.M !== x.optimisticNodes && this.M.push(...x.optimisticNodes);
|
|
229
229
|
this.restoreQueues(x.queueStash);
|
|
230
230
|
_.delete(x);
|
|
231
231
|
x = null;
|
|
232
|
-
runTransitionPending(this.
|
|
232
|
+
runTransitionPending(this.q, false);
|
|
233
233
|
} else if (_.size) runHeap(m, GlobalQueue.D);
|
|
234
234
|
runOptimistic();
|
|
235
235
|
O++;
|
|
@@ -253,32 +253,39 @@ class GlobalQueue extends Queue {
|
|
|
253
253
|
return false;
|
|
254
254
|
}
|
|
255
255
|
initTransition(e) {
|
|
256
|
-
if (
|
|
256
|
+
if (e) e = currentTransition(e);
|
|
257
|
+
if (e && e === x) return;
|
|
258
|
+
if (!e && x && x.time === O) return;
|
|
257
259
|
if (!x) {
|
|
258
|
-
x = e
|
|
260
|
+
x = e ?? {
|
|
259
261
|
time: O,
|
|
260
262
|
pendingNodes: [],
|
|
261
263
|
asyncNodes: [],
|
|
262
264
|
optimisticNodes: [],
|
|
263
265
|
actions: [],
|
|
264
|
-
queueStash: {
|
|
266
|
+
queueStash: { T: [[], []], V: [] },
|
|
265
267
|
done: false
|
|
266
268
|
};
|
|
269
|
+
} else if (e) {
|
|
270
|
+
x.done = e;
|
|
271
|
+
e.actions.push(...x.actions);
|
|
272
|
+
_.delete(x);
|
|
273
|
+
x = e;
|
|
267
274
|
}
|
|
268
275
|
_.add(x);
|
|
269
276
|
x.time = O;
|
|
270
|
-
for (let e = 0; e < this.
|
|
271
|
-
const t = this.
|
|
277
|
+
for (let e = 0; e < this.q.length; e++) {
|
|
278
|
+
const t = this.q[e];
|
|
272
279
|
t.G = x;
|
|
273
280
|
x.pendingNodes.push(t);
|
|
274
281
|
}
|
|
275
|
-
for (let e = 0; e < this.
|
|
276
|
-
const t = this.
|
|
282
|
+
for (let e = 0; e < this.M.length; e++) {
|
|
283
|
+
const t = this.M[e];
|
|
277
284
|
t.G = x;
|
|
278
285
|
x.optimisticNodes.push(t);
|
|
279
286
|
}
|
|
280
|
-
this.
|
|
281
|
-
this.
|
|
287
|
+
this.q = x.pendingNodes;
|
|
288
|
+
this.M = x.optimisticNodes;
|
|
282
289
|
}
|
|
283
290
|
}
|
|
284
291
|
function notifySubs(e) {
|
|
@@ -290,7 +297,7 @@ function notifySubs(e) {
|
|
|
290
297
|
}
|
|
291
298
|
function runOptimistic(e = null) {
|
|
292
299
|
let t = !e;
|
|
293
|
-
const n = C.
|
|
300
|
+
const n = C.M;
|
|
294
301
|
S = true;
|
|
295
302
|
for (let t = 0; t < n.length; t++) {
|
|
296
303
|
const r = n[t];
|
|
@@ -301,13 +308,13 @@ function runOptimistic(e = null) {
|
|
|
301
308
|
r.G = e;
|
|
302
309
|
notifySubs(r);
|
|
303
310
|
}
|
|
304
|
-
C.
|
|
311
|
+
C.M = [];
|
|
305
312
|
if (b._ >= b.P) {
|
|
306
313
|
t = true;
|
|
307
314
|
runHeap(b, GlobalQueue.D);
|
|
308
315
|
}
|
|
309
316
|
S = false;
|
|
310
|
-
t && runPending(C.
|
|
317
|
+
t && runPending(C.q);
|
|
311
318
|
}
|
|
312
319
|
function runPending(e) {
|
|
313
320
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -326,7 +333,10 @@ function runTransitionPending(e, t) {
|
|
|
326
333
|
for (let e = 0; e < n.length; e++) {
|
|
327
334
|
const r = n[e];
|
|
328
335
|
r.G = x;
|
|
329
|
-
if (r.Y)
|
|
336
|
+
if (r.Y) {
|
|
337
|
+
r.Y.G = x;
|
|
338
|
+
r.Y.Z(t);
|
|
339
|
+
}
|
|
330
340
|
}
|
|
331
341
|
}
|
|
332
342
|
const C = new GlobalQueue();
|
|
@@ -351,10 +361,15 @@ function transitionComplete(e) {
|
|
|
351
361
|
t && (e.done = true);
|
|
352
362
|
return t;
|
|
353
363
|
}
|
|
364
|
+
function currentTransition(e) {
|
|
365
|
+
while (e.done && typeof e.done === "object") e = e.done;
|
|
366
|
+
return e;
|
|
367
|
+
}
|
|
354
368
|
function runInTransition(e, t) {
|
|
355
369
|
const n = x;
|
|
370
|
+
x = null;
|
|
356
371
|
try {
|
|
357
|
-
x = e;
|
|
372
|
+
x = currentTransition(e);
|
|
358
373
|
return t();
|
|
359
374
|
} finally {
|
|
360
375
|
x = n;
|
|
@@ -373,6 +388,7 @@ function action(e) {
|
|
|
373
388
|
};
|
|
374
389
|
const process = e => {
|
|
375
390
|
if (e.done) {
|
|
391
|
+
r = currentTransition(r);
|
|
376
392
|
r.actions.splice(r.actions.indexOf(n), 1);
|
|
377
393
|
x = r;
|
|
378
394
|
schedule();
|
|
@@ -380,7 +396,7 @@ function action(e) {
|
|
|
380
396
|
return;
|
|
381
397
|
}
|
|
382
398
|
const t = e.value;
|
|
383
|
-
if (t instanceof Promise) return t.then(step);
|
|
399
|
+
if (t instanceof Promise) return t.then(e => runInTransition(r, () => step(e)));
|
|
384
400
|
runInTransition(r, () => step(t));
|
|
385
401
|
};
|
|
386
402
|
runInTransition(r, () => step());
|
|
@@ -397,7 +413,7 @@ let A = null;
|
|
|
397
413
|
function recompute(t, n = false) {
|
|
398
414
|
const i = t.J && t.G != x;
|
|
399
415
|
if (!n) {
|
|
400
|
-
if (t.G && x !== t.G && !i) C.initTransition(t);
|
|
416
|
+
if (t.G && x !== t.G && !i) C.initTransition(t.G);
|
|
401
417
|
deleteFromHeap(t, t.S & o ? m : b);
|
|
402
418
|
if (t.G) disposeChildren(t);
|
|
403
419
|
else {
|
|
@@ -446,6 +462,7 @@ function recompute(t, n = false) {
|
|
|
446
462
|
}
|
|
447
463
|
const w = !t.ue || !t.ue(t.U === p || (t.oe && t.G) || i ? t.L : t.U, u);
|
|
448
464
|
const _ = t.$ !== h || t.K !== y;
|
|
465
|
+
if (t.k && t.$ & f && x) x.asyncNodes.push(t);
|
|
449
466
|
t.le?.(_, h);
|
|
450
467
|
if (w || _) {
|
|
451
468
|
if (w) {
|
|
@@ -459,8 +476,8 @@ function recompute(t, n = false) {
|
|
|
459
476
|
insertIntoHeapHeight(e.N, e.N.S & o ? m : b);
|
|
460
477
|
}
|
|
461
478
|
}
|
|
462
|
-
t.oe && !S && C.
|
|
463
|
-
(!n || t.$ & f) && !t.G && C.
|
|
479
|
+
t.oe && !S && C.M.push(t);
|
|
480
|
+
(!n || t.$ & f) && !t.G && C.q.push(t);
|
|
464
481
|
t.G && i && runInTransition(t.G, () => recompute(t));
|
|
465
482
|
}
|
|
466
483
|
function handleAsync(e, t, n) {
|
|
@@ -475,12 +492,12 @@ function handleAsync(e, t, n) {
|
|
|
475
492
|
if (i) {
|
|
476
493
|
t.then(r => {
|
|
477
494
|
if (e.ce !== t) return;
|
|
478
|
-
C.initTransition(e);
|
|
479
|
-
n
|
|
495
|
+
C.initTransition(e.G);
|
|
496
|
+
n ? n(r) : setSignal(e, () => r);
|
|
480
497
|
flush();
|
|
481
498
|
}).catch(n => {
|
|
482
499
|
if (e.ce !== t) return;
|
|
483
|
-
C.initTransition(e);
|
|
500
|
+
C.initTransition(e.G);
|
|
484
501
|
setStatusFlags(e, c, n);
|
|
485
502
|
e.se = O;
|
|
486
503
|
notifySubs(e);
|
|
@@ -492,13 +509,13 @@ function handleAsync(e, t, n) {
|
|
|
492
509
|
try {
|
|
493
510
|
for await (let r of t) {
|
|
494
511
|
if (e.ce !== t) return;
|
|
495
|
-
C.initTransition(e);
|
|
496
|
-
n
|
|
512
|
+
C.initTransition(e.G);
|
|
513
|
+
n ? n(r) : setSignal(e, () => r);
|
|
497
514
|
flush();
|
|
498
515
|
}
|
|
499
516
|
} catch (n) {
|
|
500
517
|
if (e.ce !== t) return;
|
|
501
|
-
C.initTransition(e);
|
|
518
|
+
C.initTransition(e.G);
|
|
502
519
|
setStatusFlags(e, c, n);
|
|
503
520
|
e.se = O;
|
|
504
521
|
notifySubs(e);
|
|
@@ -507,7 +524,7 @@ function handleAsync(e, t, n) {
|
|
|
507
524
|
}
|
|
508
525
|
})();
|
|
509
526
|
}
|
|
510
|
-
C.initTransition(e);
|
|
527
|
+
C.initTransition(e.G);
|
|
511
528
|
throw new NotReadyError(A);
|
|
512
529
|
}
|
|
513
530
|
function updateIfNecessary(r) {
|
|
@@ -800,6 +817,7 @@ function read(e) {
|
|
|
800
817
|
return !t || e.oe || e.U === p || (k && !P && (t.oe || (e.G && x !== e.G))) ? e.L : e.U;
|
|
801
818
|
}
|
|
802
819
|
function setSignal(e, t) {
|
|
820
|
+
if (e.G && x !== e.G) C.initTransition(e.G);
|
|
803
821
|
if (typeof t === "function") {
|
|
804
822
|
t = t(e.U === p || (e.oe && e.G) ? e.L : e.U);
|
|
805
823
|
}
|
|
@@ -808,14 +826,14 @@ function setSignal(e, t) {
|
|
|
808
826
|
if (n) {
|
|
809
827
|
if (e.oe) e.L = t;
|
|
810
828
|
else {
|
|
811
|
-
if (e.U === p) C.
|
|
829
|
+
if (e.U === p) C.q.push(e);
|
|
812
830
|
e.U = t;
|
|
813
831
|
}
|
|
814
832
|
if (e.fe) setSignal(e.fe, t);
|
|
815
833
|
}
|
|
816
834
|
setStatusFlags(e, l);
|
|
817
835
|
e.se = O;
|
|
818
|
-
e.oe && !S ? C.
|
|
836
|
+
e.oe && !S ? C.M.push(e) : notifySubs(e);
|
|
819
837
|
schedule();
|
|
820
838
|
return t;
|
|
821
839
|
}
|
|
@@ -873,11 +891,14 @@ function createRoot(e, t) {
|
|
|
873
891
|
}
|
|
874
892
|
function runWithOwner(e, t) {
|
|
875
893
|
const n = A;
|
|
894
|
+
const r = N;
|
|
876
895
|
A = e;
|
|
896
|
+
N = false;
|
|
877
897
|
try {
|
|
878
898
|
return t();
|
|
879
899
|
} finally {
|
|
880
900
|
A = n;
|
|
901
|
+
N = r;
|
|
881
902
|
}
|
|
882
903
|
}
|
|
883
904
|
function staleValues(e, t = true) {
|
|
@@ -1105,7 +1126,7 @@ function onSettled(e) {
|
|
|
1105
1126
|
});
|
|
1106
1127
|
}
|
|
1107
1128
|
function unwrap(e) {
|
|
1108
|
-
return e?.[H]?.[
|
|
1129
|
+
return e?.[H]?.[M] ?? e;
|
|
1109
1130
|
}
|
|
1110
1131
|
function getOverrideValue(e, t, n, r) {
|
|
1111
1132
|
return t && r in t ? t[r] : e[r];
|
|
@@ -1118,13 +1139,13 @@ function getAllKeys(e, t, n) {
|
|
|
1118
1139
|
function applyState(e, t, n, r) {
|
|
1119
1140
|
const i = t?.[H];
|
|
1120
1141
|
if (!i) return;
|
|
1121
|
-
const s = i[
|
|
1122
|
-
const o = i[
|
|
1123
|
-
let u = i[
|
|
1142
|
+
const s = i[V];
|
|
1143
|
+
const o = i[q];
|
|
1144
|
+
let u = i[M];
|
|
1124
1145
|
if (e === s && !o) return;
|
|
1125
1146
|
(i[K] || U).set(e, i[Q]);
|
|
1126
|
-
i[
|
|
1127
|
-
i[
|
|
1147
|
+
i[V] = e;
|
|
1148
|
+
i[q] = undefined;
|
|
1128
1149
|
if (Array.isArray(s)) {
|
|
1129
1150
|
let t = false;
|
|
1130
1151
|
const l = getOverrideValue(s, o, u, "length");
|
|
@@ -1151,16 +1172,16 @@ function applyState(e, t, n, r) {
|
|
|
1151
1172
|
if (a > h || a > d) {
|
|
1152
1173
|
for (c = a; c <= h; c++) {
|
|
1153
1174
|
t = true;
|
|
1154
|
-
i[
|
|
1175
|
+
i[M][c] && setSignal(i[M][c], wrap(e[c], i));
|
|
1155
1176
|
}
|
|
1156
1177
|
for (; c < e.length; c++) {
|
|
1157
1178
|
t = true;
|
|
1158
1179
|
const s = wrap(w[c], i);
|
|
1159
|
-
i[
|
|
1180
|
+
i[M][c] && setSignal(i[M][c], s);
|
|
1160
1181
|
applyState(e[c], s, n, r);
|
|
1161
1182
|
}
|
|
1162
|
-
t && i[
|
|
1163
|
-
l !== e.length && i[
|
|
1183
|
+
t && i[M][I] && setSignal(i[M][I], void 0);
|
|
1184
|
+
l !== e.length && i[M].length && setSignal(i[M].length, e.length);
|
|
1164
1185
|
return;
|
|
1165
1186
|
}
|
|
1166
1187
|
y = new Array(h + 1);
|
|
@@ -1184,22 +1205,22 @@ function applyState(e, t, n, r) {
|
|
|
1184
1205
|
for (c = a; c < e.length; c++) {
|
|
1185
1206
|
if (c in w) {
|
|
1186
1207
|
const t = wrap(w[c], i);
|
|
1187
|
-
i[
|
|
1208
|
+
i[M][c] && setSignal(i[M][c], t);
|
|
1188
1209
|
applyState(e[c], t, n, r);
|
|
1189
|
-
} else i[
|
|
1210
|
+
} else i[M][c] && setSignal(i[M][c], wrap(e[c], i));
|
|
1190
1211
|
}
|
|
1191
1212
|
if (a < e.length) t = true;
|
|
1192
1213
|
} else if (e.length) {
|
|
1193
1214
|
for (let t = 0, l = e.length; t < l; t++) {
|
|
1194
1215
|
const l = getOverrideValue(s, o, u, t);
|
|
1195
|
-
isWrappable(l) ? applyState(e[t], wrap(l, i), n, r) : i[
|
|
1216
|
+
isWrappable(l) ? applyState(e[t], wrap(l, i), n, r) : i[M][t] && setSignal(i[M][t], e[t]);
|
|
1196
1217
|
}
|
|
1197
1218
|
}
|
|
1198
1219
|
if (l !== e.length) {
|
|
1199
1220
|
t = true;
|
|
1200
|
-
i[
|
|
1221
|
+
i[M].length && setSignal(i[M].length, e.length);
|
|
1201
1222
|
}
|
|
1202
|
-
t && i[
|
|
1223
|
+
t && i[M][I] && setSignal(i[M][I], void 0);
|
|
1203
1224
|
return;
|
|
1204
1225
|
}
|
|
1205
1226
|
if (u) {
|
|
@@ -1307,10 +1328,10 @@ const I = Symbol(0),
|
|
|
1307
1328
|
H = Symbol(0),
|
|
1308
1329
|
Q = Symbol(0),
|
|
1309
1330
|
R = Symbol(0);
|
|
1310
|
-
const
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1313
|
-
|
|
1331
|
+
const T = new WeakMap();
|
|
1332
|
+
const V = "v",
|
|
1333
|
+
q = "o",
|
|
1334
|
+
M = "n",
|
|
1314
1335
|
D = "h",
|
|
1315
1336
|
B = "w",
|
|
1316
1337
|
K = "l",
|
|
@@ -1360,7 +1381,7 @@ function getNode(e, t, n, r, i = isEqual) {
|
|
|
1360
1381
|
));
|
|
1361
1382
|
}
|
|
1362
1383
|
function trackSelf(e, t = I) {
|
|
1363
|
-
getObserver() && read(getNode(getNodes(e,
|
|
1384
|
+
getObserver() && read(getNode(getNodes(e, M), t, undefined, e[G], false));
|
|
1364
1385
|
}
|
|
1365
1386
|
function getKeys(e, t, n = true) {
|
|
1366
1387
|
const r = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
|
|
@@ -1391,11 +1412,11 @@ const J = {
|
|
|
1391
1412
|
trackSelf(e, t);
|
|
1392
1413
|
return n;
|
|
1393
1414
|
}
|
|
1394
|
-
const r = getNodes(e,
|
|
1415
|
+
const r = getNodes(e, M);
|
|
1395
1416
|
const i = r[t];
|
|
1396
|
-
const s = e[
|
|
1397
|
-
const o = !!e[
|
|
1398
|
-
const u = s ? e[
|
|
1417
|
+
const s = e[q] && t in e[q];
|
|
1418
|
+
const o = !!e[V][H];
|
|
1419
|
+
const u = s ? e[q] : e[V];
|
|
1399
1420
|
if (!i) {
|
|
1400
1421
|
const e = Object.getOwnPropertyDescriptor(u, t);
|
|
1401
1422
|
if (e && e.get) return e.get.call(n);
|
|
@@ -1413,7 +1434,7 @@ const J = {
|
|
|
1413
1434
|
if (!i) {
|
|
1414
1435
|
if (!s && typeof l === "function" && !u.hasOwnProperty(t)) {
|
|
1415
1436
|
let t;
|
|
1416
|
-
return !Array.isArray(e[
|
|
1437
|
+
return !Array.isArray(e[V]) && (t = Object.getPrototypeOf(e[V])) && t !== Object.prototype
|
|
1417
1438
|
? l.bind(u)
|
|
1418
1439
|
: l;
|
|
1419
1440
|
} else if (getObserver()) {
|
|
@@ -1424,7 +1445,7 @@ const J = {
|
|
|
1424
1445
|
},
|
|
1425
1446
|
has(e, t) {
|
|
1426
1447
|
if (t === Q || t === I || t === "__proto__") return true;
|
|
1427
|
-
const n = e[
|
|
1448
|
+
const n = e[q] && t in e[q] ? e[q][t] !== R : t in e[V];
|
|
1428
1449
|
getObserver() && read(getNode(getNodes(e, D), t, n, e[G]));
|
|
1429
1450
|
return n;
|
|
1430
1451
|
},
|
|
@@ -1432,22 +1453,22 @@ const J = {
|
|
|
1432
1453
|
const r = e[Q];
|
|
1433
1454
|
if (writeOnly(r)) {
|
|
1434
1455
|
untrack(() => {
|
|
1435
|
-
const i = e[
|
|
1456
|
+
const i = e[V];
|
|
1436
1457
|
const s = i[t];
|
|
1437
|
-
const o = e[
|
|
1438
|
-
const u = n?.[H]?.[
|
|
1458
|
+
const o = e[q] && t in e[q] ? e[q][t] : s;
|
|
1459
|
+
const u = n?.[H]?.[V] ?? n;
|
|
1439
1460
|
if (o === u) return true;
|
|
1440
|
-
const l = e[
|
|
1441
|
-
if (u !== undefined && u === s) delete e[
|
|
1442
|
-
else (e[
|
|
1461
|
+
const l = e[q]?.length || i.length;
|
|
1462
|
+
if (u !== undefined && u === s) delete e[q][t];
|
|
1463
|
+
else (e[q] || (e[q] = Object.create(null)))[t] = u;
|
|
1443
1464
|
const f = isWrappable(u);
|
|
1444
1465
|
if (isWrappable(o)) {
|
|
1445
|
-
const e =
|
|
1446
|
-
e && (e instanceof Set ? e.delete(r) :
|
|
1466
|
+
const e = T.get(o);
|
|
1467
|
+
e && (e instanceof Set ? e.delete(r) : T.delete(o));
|
|
1447
1468
|
}
|
|
1448
1469
|
if (recursivelyNotify(r, U) && f) recursivelyAddParent(u, r);
|
|
1449
1470
|
e[D]?.[t] && setSignal(e[D][t], true);
|
|
1450
|
-
const c = getNodes(e,
|
|
1471
|
+
const c = getNodes(e, M);
|
|
1451
1472
|
c[t] && setSignal(c[t], () => (f ? wrap(u, e) : u));
|
|
1452
1473
|
if (Array.isArray(i)) {
|
|
1453
1474
|
const e = parseInt(t) + 1;
|
|
@@ -1459,20 +1480,20 @@ const J = {
|
|
|
1459
1480
|
return true;
|
|
1460
1481
|
},
|
|
1461
1482
|
deleteProperty(e, t) {
|
|
1462
|
-
if (writeOnly(e[Q]) && e[
|
|
1483
|
+
if (writeOnly(e[Q]) && e[q]?.[t] !== R) {
|
|
1463
1484
|
untrack(() => {
|
|
1464
|
-
const n = e[
|
|
1465
|
-
if (t in e[
|
|
1466
|
-
(e[
|
|
1467
|
-
} else if (e[
|
|
1468
|
-
delete e[
|
|
1485
|
+
const n = e[q] && t in e[q] ? e[q][t] : e[V][t];
|
|
1486
|
+
if (t in e[V]) {
|
|
1487
|
+
(e[q] || (e[q] = Object.create(null)))[t] = R;
|
|
1488
|
+
} else if (e[q] && t in e[q]) {
|
|
1489
|
+
delete e[q][t];
|
|
1469
1490
|
} else return true;
|
|
1470
1491
|
if (isWrappable(n)) {
|
|
1471
|
-
const t =
|
|
1472
|
-
t && (t instanceof Set ? t.delete(e) :
|
|
1492
|
+
const t = T.get(n);
|
|
1493
|
+
t && (t instanceof Set ? t.delete(e) : T.delete(n));
|
|
1473
1494
|
}
|
|
1474
1495
|
if (e[D]?.[t]) setSignal(e[D][t], false);
|
|
1475
|
-
const r = getNodes(e,
|
|
1496
|
+
const r = getNodes(e, M);
|
|
1476
1497
|
r[t] && setSignal(r[t], undefined);
|
|
1477
1498
|
r[I] && setSignal(r[I], undefined);
|
|
1478
1499
|
});
|
|
@@ -1481,14 +1502,14 @@ const J = {
|
|
|
1481
1502
|
},
|
|
1482
1503
|
ownKeys(e) {
|
|
1483
1504
|
trackSelf(e);
|
|
1484
|
-
return getKeys(e[
|
|
1505
|
+
return getKeys(e[V], e[q], false);
|
|
1485
1506
|
},
|
|
1486
1507
|
getOwnPropertyDescriptor(e, t) {
|
|
1487
1508
|
if (t === Q) return { value: e[Q], writable: true, configurable: true };
|
|
1488
|
-
return getPropertyDescriptor(e[
|
|
1509
|
+
return getPropertyDescriptor(e[V], e[q], t);
|
|
1489
1510
|
},
|
|
1490
1511
|
getPrototypeOf(e) {
|
|
1491
|
-
return Object.getPrototypeOf(e[
|
|
1512
|
+
return Object.getPrototypeOf(e[V]);
|
|
1492
1513
|
}
|
|
1493
1514
|
};
|
|
1494
1515
|
function storeSetter(e, t) {
|
|
@@ -1523,14 +1544,14 @@ function recursivelyNotify(e, t) {
|
|
|
1523
1544
|
let n = e[H] || t?.get(e)?.[H];
|
|
1524
1545
|
let r = false;
|
|
1525
1546
|
if (n) {
|
|
1526
|
-
const e = getNodes(n,
|
|
1547
|
+
const e = getNodes(n, M)[F];
|
|
1527
1548
|
if (e) {
|
|
1528
1549
|
setSignal(e, undefined);
|
|
1529
1550
|
r = true;
|
|
1530
1551
|
}
|
|
1531
1552
|
t = n[K] || t;
|
|
1532
1553
|
}
|
|
1533
|
-
const i =
|
|
1554
|
+
const i = T.get(n?.[V] || e);
|
|
1534
1555
|
if (!i) return r;
|
|
1535
1556
|
if (i instanceof Set) {
|
|
1536
1557
|
for (let e of i) r = recursivelyNotify(e, t) || r;
|
|
@@ -1541,14 +1562,14 @@ function recursivelyAddParent(e, t) {
|
|
|
1541
1562
|
let n;
|
|
1542
1563
|
const r = e[H];
|
|
1543
1564
|
if (r) {
|
|
1544
|
-
n = r[
|
|
1545
|
-
e = r[
|
|
1565
|
+
n = r[q];
|
|
1566
|
+
e = r[V];
|
|
1546
1567
|
}
|
|
1547
1568
|
if (t) {
|
|
1548
|
-
let n =
|
|
1549
|
-
if (!n)
|
|
1569
|
+
let n = T.get(e);
|
|
1570
|
+
if (!n) T.set(e, t);
|
|
1550
1571
|
else if (n !== t) {
|
|
1551
|
-
if (!(n instanceof Set))
|
|
1572
|
+
if (!(n instanceof Set)) T.set(e, (n = new Set([n])));
|
|
1552
1573
|
else if (n.has(t)) return;
|
|
1553
1574
|
n.add(t);
|
|
1554
1575
|
} else return;
|
|
@@ -1581,10 +1602,10 @@ function snapshot(e, t, n) {
|
|
|
1581
1602
|
if (t && t.has(e)) return t.get(e);
|
|
1582
1603
|
if (!t) t = new Map();
|
|
1583
1604
|
if ((r = e[H] || n?.get(e)?.[H])) {
|
|
1584
|
-
s = r[
|
|
1585
|
-
i = Array.isArray(r[
|
|
1586
|
-
t.set(e, s ? (o = i ? [] : Object.create(Object.getPrototypeOf(r[
|
|
1587
|
-
e = r[
|
|
1605
|
+
s = r[q];
|
|
1606
|
+
i = Array.isArray(r[V]);
|
|
1607
|
+
t.set(e, s ? (o = i ? [] : Object.create(Object.getPrototypeOf(r[V]))) : r[V]);
|
|
1608
|
+
e = r[V];
|
|
1588
1609
|
n = U;
|
|
1589
1610
|
} else {
|
|
1590
1611
|
i = Array.isArray(e);
|
|
@@ -1898,13 +1919,13 @@ function repeat(e, t, n) {
|
|
|
1898
1919
|
Pe: t,
|
|
1899
1920
|
Ae: [],
|
|
1900
1921
|
We: [],
|
|
1901
|
-
|
|
1922
|
+
Te: n?.from,
|
|
1902
1923
|
He: n?.fallback
|
|
1903
1924
|
});
|
|
1904
1925
|
}
|
|
1905
1926
|
function updateRepeat() {
|
|
1906
1927
|
const e = this.Re();
|
|
1907
|
-
const t = this.
|
|
1928
|
+
const t = this.Te?.() || 0;
|
|
1908
1929
|
runWithOwner(this.Ce, () => {
|
|
1909
1930
|
if (e === 0) {
|
|
1910
1931
|
if (this.Ne !== 0) {
|
|
@@ -1957,16 +1978,16 @@ function boundaryComputed(e, t) {
|
|
|
1957
1978
|
be: {
|
|
1958
1979
|
le() {
|
|
1959
1980
|
let e = this.$;
|
|
1960
|
-
this.$ &= ~this.
|
|
1961
|
-
if (this.
|
|
1981
|
+
this.$ &= ~this.Ve;
|
|
1982
|
+
if (this.Ve & f && !(this.$ & a)) {
|
|
1962
1983
|
e &= ~f;
|
|
1963
1984
|
}
|
|
1964
|
-
this._e.notify(this, this.
|
|
1985
|
+
this._e.notify(this, this.Ve, e);
|
|
1965
1986
|
},
|
|
1966
|
-
|
|
1987
|
+
Ve: t
|
|
1967
1988
|
}
|
|
1968
1989
|
});
|
|
1969
|
-
n.
|
|
1990
|
+
n.Ve = t;
|
|
1970
1991
|
n.pe = true;
|
|
1971
1992
|
return n;
|
|
1972
1993
|
}
|
|
@@ -1980,30 +2001,30 @@ function createBoundChildren(e, t, n, r) {
|
|
|
1980
2001
|
});
|
|
1981
2002
|
}
|
|
1982
2003
|
class ConditionalQueue extends Queue {
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
2004
|
+
qe;
|
|
2005
|
+
Me = new Set();
|
|
2006
|
+
q = new Set();
|
|
1986
2007
|
constructor(e) {
|
|
1987
2008
|
super();
|
|
1988
|
-
this.
|
|
2009
|
+
this.qe = e;
|
|
1989
2010
|
}
|
|
1990
2011
|
run(e) {
|
|
1991
|
-
if (!e || read(this.
|
|
2012
|
+
if (!e || read(this.qe)) return;
|
|
1992
2013
|
return super.run(e);
|
|
1993
2014
|
}
|
|
1994
2015
|
notify(e, t, n) {
|
|
1995
|
-
if (read(this.
|
|
2016
|
+
if (read(this.qe)) {
|
|
1996
2017
|
if (t & f) {
|
|
1997
2018
|
if (n & f) {
|
|
1998
|
-
this.
|
|
2019
|
+
this.q.add(e);
|
|
1999
2020
|
t &= ~f;
|
|
2000
|
-
} else if (this.
|
|
2021
|
+
} else if (this.q.delete(e)) t &= ~f;
|
|
2001
2022
|
}
|
|
2002
2023
|
if (t & c) {
|
|
2003
2024
|
if (n & c) {
|
|
2004
|
-
this.
|
|
2025
|
+
this.Me.add(e);
|
|
2005
2026
|
t &= ~c;
|
|
2006
|
-
} else if (this.
|
|
2027
|
+
} else if (this.Me.delete(e)) t &= ~c;
|
|
2007
2028
|
}
|
|
2008
2029
|
}
|
|
2009
2030
|
return t ? super.notify(e, t, n) : true;
|
|
@@ -2012,24 +2033,24 @@ class ConditionalQueue extends Queue {
|
|
|
2012
2033
|
class CollectionQueue extends Queue {
|
|
2013
2034
|
De;
|
|
2014
2035
|
Ae = new Set();
|
|
2015
|
-
|
|
2036
|
+
qe = signal(false, { pureWrite: true });
|
|
2016
2037
|
Be = false;
|
|
2017
2038
|
constructor(e) {
|
|
2018
2039
|
super();
|
|
2019
2040
|
this.De = e;
|
|
2020
2041
|
}
|
|
2021
2042
|
run(e) {
|
|
2022
|
-
if (!e || read(this.
|
|
2043
|
+
if (!e || read(this.qe)) return;
|
|
2023
2044
|
return super.run(e);
|
|
2024
2045
|
}
|
|
2025
2046
|
notify(e, t, n) {
|
|
2026
2047
|
if (!(t & this.De) || (this.De & f && this.Be)) return super.notify(e, t, n);
|
|
2027
2048
|
if (n & this.De) {
|
|
2028
2049
|
this.Ae.add(e);
|
|
2029
|
-
if (this.Ae.size === 1) setSignal(this.
|
|
2050
|
+
if (this.Ae.size === 1) setSignal(this.qe, true);
|
|
2030
2051
|
} else if (this.Ae.size > 0) {
|
|
2031
2052
|
this.Ae.delete(e);
|
|
2032
|
-
if (this.Ae.size === 0) setSignal(this.
|
|
2053
|
+
if (this.Ae.size === 0) setSignal(this.qe, false);
|
|
2033
2054
|
}
|
|
2034
2055
|
t &= ~this.De;
|
|
2035
2056
|
return t ? super.notify(e, t, n) : true;
|
|
@@ -2045,25 +2066,25 @@ function createBoundary(e, t) {
|
|
|
2045
2066
|
const r = new ConditionalQueue(computed(() => t() === $.HIDDEN));
|
|
2046
2067
|
const i = createBoundChildren(n, e, r, 0);
|
|
2047
2068
|
computed(() => {
|
|
2048
|
-
const e = read(r.
|
|
2049
|
-
i.
|
|
2069
|
+
const e = read(r.qe);
|
|
2070
|
+
i.Ve = e ? c | f : 0;
|
|
2050
2071
|
if (!e) {
|
|
2051
|
-
r.
|
|
2052
|
-
r.
|
|
2053
|
-
r.
|
|
2054
|
-
r.
|
|
2072
|
+
r.q.forEach(e => r.notify(e, f, f));
|
|
2073
|
+
r.Me.forEach(e => r.notify(e, c, c));
|
|
2074
|
+
r.q.clear();
|
|
2075
|
+
r.Me.clear();
|
|
2055
2076
|
}
|
|
2056
2077
|
});
|
|
2057
|
-
return () => (read(r.
|
|
2078
|
+
return () => (read(r.qe) ? undefined : read(i));
|
|
2058
2079
|
}
|
|
2059
2080
|
function createCollectionBoundary(e, t, n) {
|
|
2060
2081
|
const r = createOwner();
|
|
2061
2082
|
const i = new CollectionQueue(e);
|
|
2062
2083
|
const s = createBoundChildren(r, t, i, e);
|
|
2063
2084
|
const o = computed(() => {
|
|
2064
|
-
if (!read(i.
|
|
2085
|
+
if (!read(i.qe)) {
|
|
2065
2086
|
const e = read(s);
|
|
2066
|
-
if (!untrack(() => read(i.
|
|
2087
|
+
if (!untrack(() => read(i.qe))) i.Be = true;
|
|
2067
2088
|
return e;
|
|
2068
2089
|
}
|
|
2069
2090
|
return n(i);
|
package/dist/prod.js
CHANGED
|
@@ -223,7 +223,7 @@ class GlobalQueue extends Queue {
|
|
|
223
223
|
runOptimistic(e);
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
|
-
this.L.push(...activeTransition.pendingNodes);
|
|
226
|
+
this.L !== activeTransition.pendingNodes && this.L.push(...activeTransition.pendingNodes);
|
|
227
227
|
this.$ !== activeTransition.optimisticNodes &&
|
|
228
228
|
this.$.push(...activeTransition.optimisticNodes);
|
|
229
229
|
this.restoreQueues(activeTransition.queueStash);
|
|
@@ -253,9 +253,11 @@ class GlobalQueue extends Queue {
|
|
|
253
253
|
return false;
|
|
254
254
|
}
|
|
255
255
|
initTransition(e) {
|
|
256
|
-
if (
|
|
256
|
+
if (e) e = currentTransition(e);
|
|
257
|
+
if (e && e === activeTransition) return;
|
|
258
|
+
if (!e && activeTransition && activeTransition.time === clock) return;
|
|
257
259
|
if (!activeTransition) {
|
|
258
|
-
activeTransition = e
|
|
260
|
+
activeTransition = e ?? {
|
|
259
261
|
time: clock,
|
|
260
262
|
pendingNodes: [],
|
|
261
263
|
asyncNodes: [],
|
|
@@ -264,6 +266,11 @@ class GlobalQueue extends Queue {
|
|
|
264
266
|
queueStash: { G: [[], []], H: [] },
|
|
265
267
|
done: false
|
|
266
268
|
};
|
|
269
|
+
} else if (e) {
|
|
270
|
+
activeTransition.done = e;
|
|
271
|
+
e.actions.push(...activeTransition.actions);
|
|
272
|
+
transitions.delete(activeTransition);
|
|
273
|
+
activeTransition = e;
|
|
267
274
|
}
|
|
268
275
|
transitions.add(activeTransition);
|
|
269
276
|
activeTransition.time = clock;
|
|
@@ -326,7 +333,10 @@ function runTransitionPending(e, t) {
|
|
|
326
333
|
for (let e = 0; e < n.length; e++) {
|
|
327
334
|
const i = n[e];
|
|
328
335
|
i.K = activeTransition;
|
|
329
|
-
if (i.q)
|
|
336
|
+
if (i.q) {
|
|
337
|
+
i.q.K = activeTransition;
|
|
338
|
+
i.q.Z(t);
|
|
339
|
+
}
|
|
330
340
|
}
|
|
331
341
|
}
|
|
332
342
|
const globalQueue = new GlobalQueue();
|
|
@@ -351,10 +361,15 @@ function transitionComplete(e) {
|
|
|
351
361
|
t && (e.done = true);
|
|
352
362
|
return t;
|
|
353
363
|
}
|
|
364
|
+
function currentTransition(e) {
|
|
365
|
+
while (e.done && typeof e.done === "object") e = e.done;
|
|
366
|
+
return e;
|
|
367
|
+
}
|
|
354
368
|
function runInTransition(e, t) {
|
|
355
369
|
const n = activeTransition;
|
|
370
|
+
activeTransition = null;
|
|
356
371
|
try {
|
|
357
|
-
activeTransition = e;
|
|
372
|
+
activeTransition = currentTransition(e);
|
|
358
373
|
return t();
|
|
359
374
|
} finally {
|
|
360
375
|
activeTransition = n;
|
|
@@ -373,6 +388,7 @@ function action(e) {
|
|
|
373
388
|
};
|
|
374
389
|
const process = e => {
|
|
375
390
|
if (e.done) {
|
|
391
|
+
i = currentTransition(i);
|
|
376
392
|
i.actions.splice(i.actions.indexOf(n), 1);
|
|
377
393
|
activeTransition = i;
|
|
378
394
|
schedule();
|
|
@@ -380,7 +396,7 @@ function action(e) {
|
|
|
380
396
|
return;
|
|
381
397
|
}
|
|
382
398
|
const t = e.value;
|
|
383
|
-
if (t instanceof Promise) return t.then(step);
|
|
399
|
+
if (t instanceof Promise) return t.then(e => runInTransition(i, () => step(e)));
|
|
384
400
|
runInTransition(i, () => step(t));
|
|
385
401
|
};
|
|
386
402
|
runInTransition(i, () => step());
|
|
@@ -397,7 +413,7 @@ let context = null;
|
|
|
397
413
|
function recompute(e, t = false) {
|
|
398
414
|
const n = e.B && e.K != activeTransition;
|
|
399
415
|
if (!t) {
|
|
400
|
-
if (e.K && activeTransition !== e.K && !n) globalQueue.initTransition(e);
|
|
416
|
+
if (e.K && activeTransition !== e.K && !n) globalQueue.initTransition(e.K);
|
|
401
417
|
deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
402
418
|
if (e.K) disposeChildren(e);
|
|
403
419
|
else {
|
|
@@ -446,6 +462,7 @@ function recompute(e, t = false) {
|
|
|
446
462
|
}
|
|
447
463
|
const c = !e.ue || !e.ue(e.M === NOT_PENDING || (e.oe && e.K) || n ? e.Y : e.M, r);
|
|
448
464
|
const a = e.J !== o || e.j !== u;
|
|
465
|
+
if (e.N && e.J & STATUS_PENDING && activeTransition) activeTransition.asyncNodes.push(e);
|
|
449
466
|
e.le?.(a, o);
|
|
450
467
|
if (c || a) {
|
|
451
468
|
if (c) {
|
|
@@ -475,12 +492,12 @@ function handleAsync(e, t, n) {
|
|
|
475
492
|
if (r) {
|
|
476
493
|
t.then(i => {
|
|
477
494
|
if (e.ae !== t) return;
|
|
478
|
-
globalQueue.initTransition(e);
|
|
479
|
-
n
|
|
495
|
+
globalQueue.initTransition(e.K);
|
|
496
|
+
n ? n(i) : setSignal(e, () => i);
|
|
480
497
|
flush();
|
|
481
498
|
}).catch(n => {
|
|
482
499
|
if (e.ae !== t) return;
|
|
483
|
-
globalQueue.initTransition(e);
|
|
500
|
+
globalQueue.initTransition(e.K);
|
|
484
501
|
setStatusFlags(e, STATUS_ERROR, n);
|
|
485
502
|
e.se = clock;
|
|
486
503
|
notifySubs(e);
|
|
@@ -492,13 +509,13 @@ function handleAsync(e, t, n) {
|
|
|
492
509
|
try {
|
|
493
510
|
for await (let i of t) {
|
|
494
511
|
if (e.ae !== t) return;
|
|
495
|
-
globalQueue.initTransition(e);
|
|
496
|
-
n
|
|
512
|
+
globalQueue.initTransition(e.K);
|
|
513
|
+
n ? n(i) : setSignal(e, () => i);
|
|
497
514
|
flush();
|
|
498
515
|
}
|
|
499
516
|
} catch (n) {
|
|
500
517
|
if (e.ae !== t) return;
|
|
501
|
-
globalQueue.initTransition(e);
|
|
518
|
+
globalQueue.initTransition(e.K);
|
|
502
519
|
setStatusFlags(e, STATUS_ERROR, n);
|
|
503
520
|
e.se = clock;
|
|
504
521
|
notifySubs(e);
|
|
@@ -507,7 +524,7 @@ function handleAsync(e, t, n) {
|
|
|
507
524
|
}
|
|
508
525
|
})();
|
|
509
526
|
}
|
|
510
|
-
globalQueue.initTransition(e);
|
|
527
|
+
globalQueue.initTransition(e.K);
|
|
511
528
|
throw new NotReadyError(context);
|
|
512
529
|
}
|
|
513
530
|
function updateIfNecessary(e) {
|
|
@@ -805,6 +822,7 @@ function read(e) {
|
|
|
805
822
|
: e.M;
|
|
806
823
|
}
|
|
807
824
|
function setSignal(e, t) {
|
|
825
|
+
if (e.K && activeTransition !== e.K) globalQueue.initTransition(e.K);
|
|
808
826
|
if (typeof t === "function") {
|
|
809
827
|
t = t(e.M === NOT_PENDING || (e.oe && e.K) ? e.Y : e.M);
|
|
810
828
|
}
|
|
@@ -878,11 +896,14 @@ function createRoot(e, t) {
|
|
|
878
896
|
}
|
|
879
897
|
function runWithOwner(e, t) {
|
|
880
898
|
const n = context;
|
|
899
|
+
const i = tracking;
|
|
881
900
|
context = e;
|
|
901
|
+
tracking = false;
|
|
882
902
|
try {
|
|
883
903
|
return t();
|
|
884
904
|
} finally {
|
|
885
905
|
context = n;
|
|
906
|
+
tracking = i;
|
|
886
907
|
}
|
|
887
908
|
}
|
|
888
909
|
function staleValues(e, t = true) {
|
|
@@ -1777,8 +1798,8 @@ function mapArray(e, t, n) {
|
|
|
1777
1798
|
Ve: [],
|
|
1778
1799
|
me: i,
|
|
1779
1800
|
Ue: i || n?.keyed === false ? [] : undefined,
|
|
1780
|
-
|
|
1781
|
-
|
|
1801
|
+
ve: t.length > 1 ? [] : undefined,
|
|
1802
|
+
ke: n?.fallback
|
|
1782
1803
|
})
|
|
1783
1804
|
);
|
|
1784
1805
|
}
|
|
@@ -1793,17 +1814,17 @@ function updateKeyedMap() {
|
|
|
1793
1814
|
r = this.Ue
|
|
1794
1815
|
? () => {
|
|
1795
1816
|
this.Ue[i] = signal(e[i], pureOptions);
|
|
1796
|
-
this.
|
|
1817
|
+
this.ve && (this.ve[i] = signal(i, pureOptions));
|
|
1797
1818
|
return this.we(
|
|
1798
1819
|
read.bind(null, this.Ue[i]),
|
|
1799
|
-
this.
|
|
1820
|
+
this.ve ? read.bind(null, this.ve[i]) : undefined
|
|
1800
1821
|
);
|
|
1801
1822
|
}
|
|
1802
|
-
: this.
|
|
1823
|
+
: this.ve
|
|
1803
1824
|
? () => {
|
|
1804
1825
|
const t = e[i];
|
|
1805
|
-
this.
|
|
1806
|
-
return this.we(() => t, read.bind(null, this.
|
|
1826
|
+
this.ve[i] = signal(i, pureOptions);
|
|
1827
|
+
return this.we(() => t, read.bind(null, this.ve[i]));
|
|
1807
1828
|
}
|
|
1808
1829
|
: () => {
|
|
1809
1830
|
const t = e[i];
|
|
@@ -1817,10 +1838,10 @@ function updateKeyedMap() {
|
|
|
1817
1838
|
this.be = [];
|
|
1818
1839
|
this.Ce = 0;
|
|
1819
1840
|
this.Ue && (this.Ue = []);
|
|
1820
|
-
this.
|
|
1841
|
+
this.ve && (this.ve = []);
|
|
1821
1842
|
}
|
|
1822
|
-
if (this.
|
|
1823
|
-
this.be[0] = runWithOwner((this.Ve[0] = createOwner()), this.
|
|
1843
|
+
if (this.ke && !this.be[0]) {
|
|
1844
|
+
this.be[0] = runWithOwner((this.Ve[0] = createOwner()), this.ke);
|
|
1824
1845
|
}
|
|
1825
1846
|
} else if (this.Ce === 0) {
|
|
1826
1847
|
if (this.Ve[0]) this.Ve[0].dispose();
|
|
@@ -1841,7 +1862,7 @@ function updateKeyedMap() {
|
|
|
1841
1862
|
E = new Array(t),
|
|
1842
1863
|
d = new Array(t),
|
|
1843
1864
|
T = this.Ue ? new Array(t) : undefined,
|
|
1844
|
-
R = this.
|
|
1865
|
+
R = this.ve ? new Array(t) : undefined;
|
|
1845
1866
|
for (
|
|
1846
1867
|
s = 0, o = Math.min(this.Ce, t);
|
|
1847
1868
|
s < o && (this.Pe[s] === e[s] || (this.Ue && compare(this.me, this.Pe[s], e[s])));
|
|
@@ -1859,7 +1880,7 @@ function updateKeyedMap() {
|
|
|
1859
1880
|
E[u] = this.be[o];
|
|
1860
1881
|
d[u] = this.Ve[o];
|
|
1861
1882
|
T && (T[u] = this.Ue[o]);
|
|
1862
|
-
R && (R[u] = this.
|
|
1883
|
+
R && (R[u] = this.ve[o]);
|
|
1863
1884
|
}
|
|
1864
1885
|
a = new Map();
|
|
1865
1886
|
f = new Array(u + 1);
|
|
@@ -1878,7 +1899,7 @@ function updateKeyedMap() {
|
|
|
1878
1899
|
E[i] = this.be[n];
|
|
1879
1900
|
d[i] = this.Ve[n];
|
|
1880
1901
|
T && (T[i] = this.Ue[n]);
|
|
1881
|
-
R && (R[i] = this.
|
|
1902
|
+
R && (R[i] = this.ve[n]);
|
|
1882
1903
|
i = f[i];
|
|
1883
1904
|
a.set(c, i);
|
|
1884
1905
|
} else this.Ve[n].dispose();
|
|
@@ -1892,8 +1913,8 @@ function updateKeyedMap() {
|
|
|
1892
1913
|
setSignal(this.Ue[i], e[i]);
|
|
1893
1914
|
}
|
|
1894
1915
|
if (R) {
|
|
1895
|
-
this.
|
|
1896
|
-
setSignal(this.
|
|
1916
|
+
this.ve[i] = R[i];
|
|
1917
|
+
setSignal(this.ve[i], i);
|
|
1897
1918
|
}
|
|
1898
1919
|
} else {
|
|
1899
1920
|
this.be[i] = runWithOwner((this.Ve[i] = createOwner()), r);
|
|
@@ -1915,7 +1936,7 @@ function repeat(e, t, n) {
|
|
|
1915
1936
|
Ve: [],
|
|
1916
1937
|
be: [],
|
|
1917
1938
|
He: n?.from,
|
|
1918
|
-
|
|
1939
|
+
ke: n?.fallback
|
|
1919
1940
|
});
|
|
1920
1941
|
}
|
|
1921
1942
|
function updateRepeat() {
|
|
@@ -1929,8 +1950,8 @@ function updateRepeat() {
|
|
|
1929
1950
|
this.be = [];
|
|
1930
1951
|
this.Ce = 0;
|
|
1931
1952
|
}
|
|
1932
|
-
if (this.
|
|
1933
|
-
this.be[0] = runWithOwner((this.Ve[0] = createOwner()), this.
|
|
1953
|
+
if (this.ke && !this.be[0]) {
|
|
1954
|
+
this.be[0] = runWithOwner((this.Ve[0] = createOwner()), this.ke);
|
|
1934
1955
|
}
|
|
1935
1956
|
return;
|
|
1936
1957
|
}
|
|
@@ -52,7 +52,7 @@ export declare class GlobalQueue extends Queue {
|
|
|
52
52
|
static _dispose: (el: Computed<unknown>, self: boolean, zombie: boolean) => void;
|
|
53
53
|
flush(): void;
|
|
54
54
|
notify(node: Computed<any>, mask: number, flags: number): boolean;
|
|
55
|
-
initTransition(
|
|
55
|
+
initTransition(transition?: Transition | null): void;
|
|
56
56
|
}
|
|
57
57
|
export declare function notifySubs(node: Signal<any> | Computed<any>): void;
|
|
58
58
|
export declare function runOptimistic(activeTransition?: Transition | null): void;
|