solid-js 1.9.2 → 1.9.3
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 +559 -318
- package/dist/server.js +168 -74
- package/dist/solid.js +486 -276
- package/h/dist/h.js +40 -9
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +11 -8
- package/h/jsx-runtime/types/jsx.d.ts +93 -91
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +219 -94
- package/html/types/lit.d.ts +52 -33
- package/package.json +1 -1
- package/store/dist/dev.js +123 -43
- package/store/dist/server.js +20 -8
- package/store/dist/store.js +114 -40
- package/store/types/index.d.ts +21 -7
- package/store/types/modifiers.d.ts +6 -3
- package/store/types/mutable.d.ts +5 -2
- package/store/types/server.d.ts +25 -5
- package/store/types/store.d.ts +218 -61
- package/types/index.d.ts +75 -10
- package/types/jsx.d.ts +143 -157
- package/types/reactive/array.d.ts +12 -4
- package/types/reactive/observable.d.ts +25 -17
- package/types/reactive/scheduler.d.ts +9 -6
- package/types/reactive/signal.d.ts +233 -142
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +71 -35
- package/types/render/flow.d.ts +43 -31
- package/types/render/hydration.d.ts +15 -15
- package/types/server/index.d.ts +57 -2
- package/types/server/reactive.d.ts +73 -42
- package/types/server/rendering.d.ts +169 -98
- package/universal/dist/dev.js +28 -12
- package/universal/dist/universal.js +28 -12
- package/universal/types/index.d.ts +3 -1
- package/universal/types/universal.d.ts +0 -1
- package/web/dist/dev.js +639 -89
- package/web/dist/server.cjs +13 -10
- package/web/dist/server.js +653 -118
- package/web/dist/web.js +627 -87
- package/web/storage/dist/storage.js +3 -3
- package/web/types/client.d.ts +1 -1
- package/web/types/core.d.ts +10 -1
- package/web/types/index.d.ts +27 -10
- package/web/types/server-mock.d.ts +47 -32
- package/web/types/server.d.ts +1 -1
package/dist/solid.js
CHANGED
|
@@ -52,9 +52,11 @@ function enqueue(taskQueue, task) {
|
|
|
52
52
|
let m = 0;
|
|
53
53
|
let n = taskQueue.length - 1;
|
|
54
54
|
while (m <= n) {
|
|
55
|
-
const k = n + m >> 1;
|
|
55
|
+
const k = (n + m) >> 1;
|
|
56
56
|
const cmp = task.expirationTime - taskQueue[k].expirationTime;
|
|
57
|
-
if (cmp > 0) m = k + 1;
|
|
57
|
+
if (cmp > 0) m = k + 1;
|
|
58
|
+
else if (cmp < 0) n = k - 1;
|
|
59
|
+
else return k;
|
|
58
60
|
}
|
|
59
61
|
return m;
|
|
60
62
|
}
|
|
@@ -174,12 +176,14 @@ function createRoot(fn, detachedOwner) {
|
|
|
174
176
|
owner = Owner,
|
|
175
177
|
unowned = fn.length === 0,
|
|
176
178
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
177
|
-
root = unowned
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
root = unowned
|
|
180
|
+
? UNOWNED
|
|
181
|
+
: {
|
|
182
|
+
owned: null,
|
|
183
|
+
cleanups: null,
|
|
184
|
+
context: current ? current.context : null,
|
|
185
|
+
owner: current
|
|
186
|
+
},
|
|
183
187
|
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
184
188
|
Owner = root;
|
|
185
189
|
Listener = null;
|
|
@@ -200,7 +204,8 @@ function createSignal(value, options) {
|
|
|
200
204
|
};
|
|
201
205
|
const setter = value => {
|
|
202
206
|
if (typeof value === "function") {
|
|
203
|
-
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
207
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
208
|
+
else value = value(s.value);
|
|
204
209
|
}
|
|
205
210
|
return writeSignal(s, value);
|
|
206
211
|
};
|
|
@@ -208,11 +213,13 @@ function createSignal(value, options) {
|
|
|
208
213
|
}
|
|
209
214
|
function createComputed(fn, value, options) {
|
|
210
215
|
const c = createComputation(fn, value, true, STALE);
|
|
211
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
216
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
217
|
+
else updateComputation(c);
|
|
212
218
|
}
|
|
213
219
|
function createRenderEffect(fn, value, options) {
|
|
214
220
|
const c = createComputation(fn, value, false, STALE);
|
|
215
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
221
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
222
|
+
else updateComputation(c);
|
|
216
223
|
}
|
|
217
224
|
function createEffect(fn, value, options) {
|
|
218
225
|
runEffects = runUserEffects;
|
|
@@ -224,10 +231,15 @@ function createEffect(fn, value, options) {
|
|
|
224
231
|
}
|
|
225
232
|
function createReaction(onInvalidate, options) {
|
|
226
233
|
let fn;
|
|
227
|
-
const c = createComputation(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
234
|
+
const c = createComputation(
|
|
235
|
+
() => {
|
|
236
|
+
fn ? fn() : untrack(onInvalidate);
|
|
237
|
+
fn = undefined;
|
|
238
|
+
},
|
|
239
|
+
undefined,
|
|
240
|
+
false,
|
|
241
|
+
0
|
|
242
|
+
),
|
|
231
243
|
s = SuspenseContext && useContext(SuspenseContext);
|
|
232
244
|
if (s) c.suspense = s;
|
|
233
245
|
c.user = true;
|
|
@@ -255,7 +267,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
255
267
|
let source;
|
|
256
268
|
let fetcher;
|
|
257
269
|
let options;
|
|
258
|
-
if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
|
|
270
|
+
if ((arguments.length === 2 && typeof pFetcher === "object") || arguments.length === 1) {
|
|
259
271
|
source = true;
|
|
260
272
|
fetcher = pSource;
|
|
261
273
|
options = pFetcher || {};
|
|
@@ -280,15 +292,19 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
280
292
|
[state, setState] = createSignal(resolved ? "ready" : "unresolved");
|
|
281
293
|
if (sharedConfig.context) {
|
|
282
294
|
id = sharedConfig.getNextContextId();
|
|
283
|
-
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
295
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
296
|
+
else if (sharedConfig.load && sharedConfig.has(id)) initP = sharedConfig.load(id);
|
|
284
297
|
}
|
|
285
298
|
function loadEnd(p, v, error, key) {
|
|
286
299
|
if (pr === p) {
|
|
287
300
|
pr = null;
|
|
288
301
|
key !== undefined && (resolved = true);
|
|
289
|
-
if ((p === initP || v === initP) && options.onHydrated)
|
|
290
|
-
|
|
291
|
-
|
|
302
|
+
if ((p === initP || v === initP) && options.onHydrated)
|
|
303
|
+
queueMicrotask(() =>
|
|
304
|
+
options.onHydrated(key, {
|
|
305
|
+
value: v
|
|
306
|
+
})
|
|
307
|
+
);
|
|
292
308
|
initP = NO_INIT;
|
|
293
309
|
if (Transition && p && loadedUnderTransition) {
|
|
294
310
|
Transition.promises.delete(p);
|
|
@@ -319,7 +335,8 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
319
335
|
createComputed(() => {
|
|
320
336
|
track();
|
|
321
337
|
if (pr) {
|
|
322
|
-
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
338
|
+
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
339
|
+
else if (!contexts.has(c)) {
|
|
323
340
|
c.increment();
|
|
324
341
|
contexts.add(c);
|
|
325
342
|
}
|
|
@@ -338,26 +355,35 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
338
355
|
return;
|
|
339
356
|
}
|
|
340
357
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
341
|
-
const p =
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
358
|
+
const p =
|
|
359
|
+
initP !== NO_INIT
|
|
360
|
+
? initP
|
|
361
|
+
: untrack(() =>
|
|
362
|
+
fetcher(lookup, {
|
|
363
|
+
value: value(),
|
|
364
|
+
refetching
|
|
365
|
+
})
|
|
366
|
+
);
|
|
345
367
|
if (!isPromise(p)) {
|
|
346
368
|
loadEnd(pr, p, undefined, lookup);
|
|
347
369
|
return p;
|
|
348
370
|
}
|
|
349
371
|
pr = p;
|
|
350
372
|
if ("value" in p) {
|
|
351
|
-
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
|
|
373
|
+
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
|
|
374
|
+
else loadEnd(pr, undefined, castError(p.value), lookup);
|
|
352
375
|
return p;
|
|
353
376
|
}
|
|
354
377
|
scheduled = true;
|
|
355
|
-
queueMicrotask(() => scheduled = false);
|
|
378
|
+
queueMicrotask(() => (scheduled = false));
|
|
356
379
|
runUpdates(() => {
|
|
357
380
|
setState(resolved ? "refreshing" : "pending");
|
|
358
381
|
trigger();
|
|
359
382
|
}, false);
|
|
360
|
-
return p.then(
|
|
383
|
+
return p.then(
|
|
384
|
+
v => loadEnd(p, v, undefined, lookup),
|
|
385
|
+
e => loadEnd(p, undefined, castError(e), lookup)
|
|
386
|
+
);
|
|
361
387
|
}
|
|
362
388
|
Object.defineProperties(read, {
|
|
363
389
|
state: {
|
|
@@ -381,50 +407,80 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
381
407
|
}
|
|
382
408
|
}
|
|
383
409
|
});
|
|
384
|
-
if (dynamic) createComputed(() => load(false));
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
410
|
+
if (dynamic) createComputed(() => load(false));
|
|
411
|
+
else load(false);
|
|
412
|
+
return [
|
|
413
|
+
read,
|
|
414
|
+
{
|
|
415
|
+
refetch: load,
|
|
416
|
+
mutate: setValue
|
|
417
|
+
}
|
|
418
|
+
];
|
|
389
419
|
}
|
|
390
420
|
function createDeferred(source, options) {
|
|
391
421
|
let t,
|
|
392
422
|
timeout = options ? options.timeoutMs : undefined;
|
|
393
|
-
const node = createComputation(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
423
|
+
const node = createComputation(
|
|
424
|
+
() => {
|
|
425
|
+
if (!t || !t.fn)
|
|
426
|
+
t = requestCallback(
|
|
427
|
+
() => setDeferred(() => node.value),
|
|
428
|
+
timeout !== undefined
|
|
429
|
+
? {
|
|
430
|
+
timeout
|
|
431
|
+
}
|
|
432
|
+
: undefined
|
|
433
|
+
);
|
|
434
|
+
return source();
|
|
435
|
+
},
|
|
436
|
+
undefined,
|
|
437
|
+
true
|
|
438
|
+
);
|
|
439
|
+
const [deferred, setDeferred] = createSignal(
|
|
440
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
441
|
+
options
|
|
442
|
+
);
|
|
400
443
|
updateComputation(node);
|
|
401
|
-
setDeferred(() =>
|
|
444
|
+
setDeferred(() =>
|
|
445
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
446
|
+
);
|
|
402
447
|
return deferred;
|
|
403
448
|
}
|
|
404
449
|
function createSelector(source, fn = equalFn, options) {
|
|
405
450
|
const subs = new Map();
|
|
406
|
-
const node = createComputation(
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
for (const
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
451
|
+
const node = createComputation(
|
|
452
|
+
p => {
|
|
453
|
+
const v = source();
|
|
454
|
+
for (const [key, val] of subs.entries())
|
|
455
|
+
if (fn(key, v) !== fn(key, p)) {
|
|
456
|
+
for (const c of val.values()) {
|
|
457
|
+
c.state = STALE;
|
|
458
|
+
if (c.pure) Updates.push(c);
|
|
459
|
+
else Effects.push(c);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return v;
|
|
463
|
+
},
|
|
464
|
+
undefined,
|
|
465
|
+
true,
|
|
466
|
+
STALE
|
|
467
|
+
);
|
|
416
468
|
updateComputation(node);
|
|
417
469
|
return key => {
|
|
418
470
|
const listener = Listener;
|
|
419
471
|
if (listener) {
|
|
420
472
|
let l;
|
|
421
|
-
if (l = subs.get(key)) l.add(listener);
|
|
473
|
+
if ((l = subs.get(key))) l.add(listener);
|
|
474
|
+
else subs.set(key, (l = new Set([listener])));
|
|
422
475
|
onCleanup(() => {
|
|
423
476
|
l.delete(listener);
|
|
424
477
|
!l.size && subs.delete(key);
|
|
425
478
|
});
|
|
426
479
|
}
|
|
427
|
-
return fn(
|
|
480
|
+
return fn(
|
|
481
|
+
key,
|
|
482
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
483
|
+
);
|
|
428
484
|
};
|
|
429
485
|
}
|
|
430
486
|
function batch(fn) {
|
|
@@ -464,7 +520,9 @@ function onMount(fn) {
|
|
|
464
520
|
createEffect(() => untrack(fn));
|
|
465
521
|
}
|
|
466
522
|
function onCleanup(fn) {
|
|
467
|
-
if (Owner === null)
|
|
523
|
+
if (Owner === null);
|
|
524
|
+
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
525
|
+
else Owner.cleanups.push(fn);
|
|
468
526
|
return fn;
|
|
469
527
|
}
|
|
470
528
|
function catchError(fn, handler) {
|
|
@@ -518,15 +576,17 @@ function startTransition(fn) {
|
|
|
518
576
|
Owner = o;
|
|
519
577
|
let t;
|
|
520
578
|
if (Scheduler || SuspenseContext) {
|
|
521
|
-
t =
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
579
|
+
t =
|
|
580
|
+
Transition ||
|
|
581
|
+
(Transition = {
|
|
582
|
+
sources: new Set(),
|
|
583
|
+
effects: [],
|
|
584
|
+
promises: new Set(),
|
|
585
|
+
disposed: new Set(),
|
|
586
|
+
queue: new Set(),
|
|
587
|
+
running: true
|
|
588
|
+
});
|
|
589
|
+
t.done || (t.done = new Promise(res => (t.resolve = res)));
|
|
530
590
|
t.running = true;
|
|
531
591
|
}
|
|
532
592
|
runUpdates(fn, false);
|
|
@@ -534,7 +594,7 @@ function startTransition(fn) {
|
|
|
534
594
|
return t ? t.done : undefined;
|
|
535
595
|
});
|
|
536
596
|
}
|
|
537
|
-
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
597
|
+
const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);
|
|
538
598
|
function useTransition() {
|
|
539
599
|
return [transPending, startTransition];
|
|
540
600
|
}
|
|
@@ -552,7 +612,9 @@ function createContext(defaultValue, options) {
|
|
|
552
612
|
}
|
|
553
613
|
function useContext(context) {
|
|
554
614
|
let value;
|
|
555
|
-
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined
|
|
615
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined
|
|
616
|
+
? value
|
|
617
|
+
: context.defaultValue;
|
|
556
618
|
}
|
|
557
619
|
function children(fn) {
|
|
558
620
|
const children = createMemo(fn);
|
|
@@ -569,10 +631,7 @@ function getSuspenseContext() {
|
|
|
569
631
|
}
|
|
570
632
|
function enableExternalSource(factory, untrack = fn => fn()) {
|
|
571
633
|
if (ExternalSourceConfig) {
|
|
572
|
-
const {
|
|
573
|
-
factory: oldFactory,
|
|
574
|
-
untrack: oldUntrack
|
|
575
|
-
} = ExternalSourceConfig;
|
|
634
|
+
const { factory: oldFactory, untrack: oldUntrack } = ExternalSourceConfig;
|
|
576
635
|
ExternalSourceConfig = {
|
|
577
636
|
factory: (fn, trigger) => {
|
|
578
637
|
const oldSource = oldFactory(fn, trigger);
|
|
@@ -597,7 +656,8 @@ function enableExternalSource(factory, untrack = fn => fn()) {
|
|
|
597
656
|
function readSignal() {
|
|
598
657
|
const runningTransition = Transition && Transition.running;
|
|
599
658
|
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
600
|
-
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
659
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
660
|
+
else {
|
|
601
661
|
const updates = Updates;
|
|
602
662
|
Updates = null;
|
|
603
663
|
runUpdates(() => lookUpstream(this), false);
|
|
@@ -625,11 +685,12 @@ function readSignal() {
|
|
|
625
685
|
return this.value;
|
|
626
686
|
}
|
|
627
687
|
function writeSignal(node, value, isComp) {
|
|
628
|
-
let current =
|
|
688
|
+
let current =
|
|
689
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
629
690
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
630
691
|
if (Transition) {
|
|
631
692
|
const TransitionRunning = Transition.running;
|
|
632
|
-
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
693
|
+
if (TransitionRunning || (!isComp && Transition.sources.has(node))) {
|
|
633
694
|
Transition.sources.add(node);
|
|
634
695
|
node.tValue = value;
|
|
635
696
|
}
|
|
@@ -642,14 +703,16 @@ function writeSignal(node, value, isComp) {
|
|
|
642
703
|
const TransitionRunning = Transition && Transition.running;
|
|
643
704
|
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
644
705
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
645
|
-
if (o.pure) Updates.push(o);
|
|
706
|
+
if (o.pure) Updates.push(o);
|
|
707
|
+
else Effects.push(o);
|
|
646
708
|
if (o.observers) markDownstream(o);
|
|
647
709
|
}
|
|
648
|
-
if (!TransitionRunning) o.state = STALE;
|
|
710
|
+
if (!TransitionRunning) o.state = STALE;
|
|
711
|
+
else o.tState = STALE;
|
|
649
712
|
}
|
|
650
713
|
if (Updates.length > 10e5) {
|
|
651
714
|
Updates = [];
|
|
652
|
-
if (false)
|
|
715
|
+
if (false);
|
|
653
716
|
throw new Error();
|
|
654
717
|
}
|
|
655
718
|
}, false);
|
|
@@ -661,7 +724,11 @@ function updateComputation(node) {
|
|
|
661
724
|
if (!node.fn) return;
|
|
662
725
|
cleanNode(node);
|
|
663
726
|
const time = ExecCount;
|
|
664
|
-
runComputation(
|
|
727
|
+
runComputation(
|
|
728
|
+
node,
|
|
729
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
730
|
+
time
|
|
731
|
+
);
|
|
665
732
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
666
733
|
queueMicrotask(() => {
|
|
667
734
|
runUpdates(() => {
|
|
@@ -726,11 +793,14 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
726
793
|
c.state = 0;
|
|
727
794
|
c.tState = state;
|
|
728
795
|
}
|
|
729
|
-
if (Owner === null)
|
|
796
|
+
if (Owner === null);
|
|
797
|
+
else if (Owner !== UNOWNED) {
|
|
730
798
|
if (Transition && Transition.running && Owner.pure) {
|
|
731
|
-
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
799
|
+
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
800
|
+
else Owner.tOwned.push(c);
|
|
732
801
|
} else {
|
|
733
|
-
if (!Owner.owned) Owner.owned = [c];
|
|
802
|
+
if (!Owner.owned) Owner.owned = [c];
|
|
803
|
+
else Owner.owned.push(c);
|
|
734
804
|
}
|
|
735
805
|
}
|
|
736
806
|
if (ExternalSourceConfig && c.fn) {
|
|
@@ -781,7 +851,8 @@ function runUpdates(fn, init) {
|
|
|
781
851
|
if (Updates) return fn();
|
|
782
852
|
let wait = false;
|
|
783
853
|
if (!init) Updates = [];
|
|
784
|
-
if (Effects) wait = true;
|
|
854
|
+
if (Effects) wait = true;
|
|
855
|
+
else Effects = [];
|
|
785
856
|
ExecCount++;
|
|
786
857
|
try {
|
|
787
858
|
const res = fn();
|
|
@@ -795,7 +866,8 @@ function runUpdates(fn, init) {
|
|
|
795
866
|
}
|
|
796
867
|
function completeUpdates(wait) {
|
|
797
868
|
if (Updates) {
|
|
798
|
-
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
869
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
870
|
+
else runQueue(Updates);
|
|
799
871
|
Updates = null;
|
|
800
872
|
}
|
|
801
873
|
if (wait) return;
|
|
@@ -863,7 +935,8 @@ function runUserEffects(queue) {
|
|
|
863
935
|
userLength = 0;
|
|
864
936
|
for (i = 0; i < queue.length; i++) {
|
|
865
937
|
const e = queue[i];
|
|
866
|
-
if (!e.user) runTop(e);
|
|
938
|
+
if (!e.user) runTop(e);
|
|
939
|
+
else queue[userLength++] = e;
|
|
867
940
|
}
|
|
868
941
|
if (sharedConfig.context) {
|
|
869
942
|
if (sharedConfig.count) {
|
|
@@ -882,13 +955,15 @@ function runUserEffects(queue) {
|
|
|
882
955
|
}
|
|
883
956
|
function lookUpstream(node, ignore) {
|
|
884
957
|
const runningTransition = Transition && Transition.running;
|
|
885
|
-
if (runningTransition) node.tState = 0;
|
|
958
|
+
if (runningTransition) node.tState = 0;
|
|
959
|
+
else node.state = 0;
|
|
886
960
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
887
961
|
const source = node.sources[i];
|
|
888
962
|
if (source.sources) {
|
|
889
963
|
const state = runningTransition ? source.tState : source.state;
|
|
890
964
|
if (state === STALE) {
|
|
891
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
965
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
966
|
+
runTop(source);
|
|
892
967
|
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
893
968
|
}
|
|
894
969
|
}
|
|
@@ -898,8 +973,10 @@ function markDownstream(node) {
|
|
|
898
973
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
899
974
|
const o = node.observers[i];
|
|
900
975
|
if (runningTransition ? !o.tState : !o.state) {
|
|
901
|
-
if (runningTransition) o.tState = PENDING;
|
|
902
|
-
|
|
976
|
+
if (runningTransition) o.tState = PENDING;
|
|
977
|
+
else o.state = PENDING;
|
|
978
|
+
if (o.pure) Updates.push(o);
|
|
979
|
+
else Effects.push(o);
|
|
903
980
|
o.observers && markDownstream(o);
|
|
904
981
|
}
|
|
905
982
|
}
|
|
@@ -936,7 +1013,8 @@ function cleanNode(node) {
|
|
|
936
1013
|
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
937
1014
|
node.cleanups = null;
|
|
938
1015
|
}
|
|
939
|
-
if (Transition && Transition.running) node.tState = 0;
|
|
1016
|
+
if (Transition && Transition.running) node.tState = 0;
|
|
1017
|
+
else node.state = 0;
|
|
940
1018
|
}
|
|
941
1019
|
function reset(node, top) {
|
|
942
1020
|
if (!top) {
|
|
@@ -957,19 +1035,21 @@ function runErrors(err, fns, owner) {
|
|
|
957
1035
|
try {
|
|
958
1036
|
for (const f of fns) f(err);
|
|
959
1037
|
} catch (e) {
|
|
960
|
-
handleError(e, owner && owner.owner || null);
|
|
1038
|
+
handleError(e, (owner && owner.owner) || null);
|
|
961
1039
|
}
|
|
962
1040
|
}
|
|
963
1041
|
function handleError(err, owner = Owner) {
|
|
964
1042
|
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
965
1043
|
const error = castError(err);
|
|
966
1044
|
if (!fns) throw error;
|
|
967
|
-
if (Effects)
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1045
|
+
if (Effects)
|
|
1046
|
+
Effects.push({
|
|
1047
|
+
fn() {
|
|
1048
|
+
runErrors(error, fns, owner);
|
|
1049
|
+
},
|
|
1050
|
+
state: STALE
|
|
1051
|
+
});
|
|
1052
|
+
else runErrors(error, fns, owner);
|
|
973
1053
|
}
|
|
974
1054
|
function resolveChildren(children) {
|
|
975
1055
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -986,19 +1066,24 @@ function resolveChildren(children) {
|
|
|
986
1066
|
function createProvider(id, options) {
|
|
987
1067
|
return function provider(props) {
|
|
988
1068
|
let res;
|
|
989
|
-
createRenderEffect(
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1069
|
+
createRenderEffect(
|
|
1070
|
+
() =>
|
|
1071
|
+
(res = untrack(() => {
|
|
1072
|
+
Owner.context = {
|
|
1073
|
+
...Owner.context,
|
|
1074
|
+
[id]: props.value
|
|
1075
|
+
};
|
|
1076
|
+
return children(() => props.children);
|
|
1077
|
+
})),
|
|
1078
|
+
undefined
|
|
1079
|
+
);
|
|
996
1080
|
return res;
|
|
997
1081
|
};
|
|
998
1082
|
}
|
|
999
1083
|
function onError(fn) {
|
|
1000
1084
|
ERROR || (ERROR = Symbol("error"));
|
|
1001
|
-
if (Owner === null)
|
|
1085
|
+
if (Owner === null);
|
|
1086
|
+
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1002
1087
|
Owner.context = {
|
|
1003
1088
|
...Owner.context,
|
|
1004
1089
|
[ERROR]: [fn]
|
|
@@ -1027,7 +1112,8 @@ function observable(input) {
|
|
|
1027
1112
|
if (!(observer instanceof Object) || observer == null) {
|
|
1028
1113
|
throw new TypeError("Expected the observer to be an object.");
|
|
1029
1114
|
}
|
|
1030
|
-
const handler =
|
|
1115
|
+
const handler =
|
|
1116
|
+
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1031
1117
|
if (!handler) {
|
|
1032
1118
|
return {
|
|
1033
1119
|
unsubscribe() {}
|
|
@@ -1058,7 +1144,7 @@ function from(producer) {
|
|
|
1058
1144
|
});
|
|
1059
1145
|
if ("subscribe" in producer) {
|
|
1060
1146
|
const unsub = producer.subscribe(v => set(() => v));
|
|
1061
|
-
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
1147
|
+
onCleanup(() => ("unsubscribe" in unsub ? unsub.unsubscribe() : unsub()));
|
|
1062
1148
|
} else {
|
|
1063
1149
|
const clean = producer(set);
|
|
1064
1150
|
onCleanup(clean);
|
|
@@ -1102,8 +1188,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1102
1188
|
});
|
|
1103
1189
|
len = 1;
|
|
1104
1190
|
}
|
|
1105
|
-
}
|
|
1106
|
-
else if (len === 0) {
|
|
1191
|
+
} else if (len === 0) {
|
|
1107
1192
|
mapped = new Array(newLen);
|
|
1108
1193
|
for (j = 0; j < newLen; j++) {
|
|
1109
1194
|
items[j] = newItems[j];
|
|
@@ -1114,8 +1199,16 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1114
1199
|
temp = new Array(newLen);
|
|
1115
1200
|
tempdisposers = new Array(newLen);
|
|
1116
1201
|
indexes && (tempIndexes = new Array(newLen));
|
|
1117
|
-
for (
|
|
1118
|
-
|
|
1202
|
+
for (
|
|
1203
|
+
start = 0, end = Math.min(len, newLen);
|
|
1204
|
+
start < end && items[start] === newItems[start];
|
|
1205
|
+
start++
|
|
1206
|
+
);
|
|
1207
|
+
for (
|
|
1208
|
+
end = len - 1, newEnd = newLen - 1;
|
|
1209
|
+
end >= start && newEnd >= start && items[end] === newItems[newEnd];
|
|
1210
|
+
end--, newEnd--
|
|
1211
|
+
) {
|
|
1119
1212
|
temp[newEnd] = mapped[end];
|
|
1120
1213
|
tempdisposers[newEnd] = disposers[end];
|
|
1121
1214
|
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
@@ -1149,7 +1242,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1149
1242
|
}
|
|
1150
1243
|
} else mapped[j] = createRoot(mapper);
|
|
1151
1244
|
}
|
|
1152
|
-
mapped = mapped.slice(0, len = newLen);
|
|
1245
|
+
mapped = mapped.slice(0, (len = newLen));
|
|
1153
1246
|
items = newItems.slice(0);
|
|
1154
1247
|
}
|
|
1155
1248
|
return mapped;
|
|
@@ -1216,7 +1309,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1216
1309
|
}
|
|
1217
1310
|
len = signals.length = disposers.length = newLen;
|
|
1218
1311
|
items = newItems.slice(0);
|
|
1219
|
-
return mapped = mapped.slice(0, len);
|
|
1312
|
+
return (mapped = mapped.slice(0, len));
|
|
1220
1313
|
});
|
|
1221
1314
|
function mapper(disposer) {
|
|
1222
1315
|
disposers[i] = disposer;
|
|
@@ -1285,29 +1378,33 @@ function mergeProps(...sources) {
|
|
|
1285
1378
|
let proxy = false;
|
|
1286
1379
|
for (let i = 0; i < sources.length; i++) {
|
|
1287
1380
|
const s = sources[i];
|
|
1288
|
-
proxy = proxy || !!s && $PROXY in s;
|
|
1289
|
-
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
1381
|
+
proxy = proxy || (!!s && $PROXY in s);
|
|
1382
|
+
sources[i] = typeof s === "function" ? ((proxy = true), createMemo(s)) : s;
|
|
1290
1383
|
}
|
|
1291
1384
|
if (SUPPORTS_PROXY && proxy) {
|
|
1292
|
-
return new Proxy(
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1385
|
+
return new Proxy(
|
|
1386
|
+
{
|
|
1387
|
+
get(property) {
|
|
1388
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1389
|
+
const v = resolveSource(sources[i])[property];
|
|
1390
|
+
if (v !== undefined) return v;
|
|
1391
|
+
}
|
|
1392
|
+
},
|
|
1393
|
+
has(property) {
|
|
1394
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1395
|
+
if (property in resolveSource(sources[i])) return true;
|
|
1396
|
+
}
|
|
1397
|
+
return false;
|
|
1398
|
+
},
|
|
1399
|
+
keys() {
|
|
1400
|
+
const keys = [];
|
|
1401
|
+
for (let i = 0; i < sources.length; i++)
|
|
1402
|
+
keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1403
|
+
return [...new Set(keys)];
|
|
1302
1404
|
}
|
|
1303
|
-
return false;
|
|
1304
1405
|
},
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1308
|
-
return [...new Set(keys)];
|
|
1309
|
-
}
|
|
1310
|
-
}, propTraps);
|
|
1406
|
+
propTraps
|
|
1407
|
+
);
|
|
1311
1408
|
}
|
|
1312
1409
|
const sourcesMap = {};
|
|
1313
1410
|
const defined = Object.create(null);
|
|
@@ -1320,15 +1417,20 @@ function mergeProps(...sources) {
|
|
|
1320
1417
|
if (key === "__proto__" || key === "constructor") continue;
|
|
1321
1418
|
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
1322
1419
|
if (!defined[key]) {
|
|
1323
|
-
defined[key] = desc.get
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1420
|
+
defined[key] = desc.get
|
|
1421
|
+
? {
|
|
1422
|
+
enumerable: true,
|
|
1423
|
+
configurable: true,
|
|
1424
|
+
get: resolveSources.bind((sourcesMap[key] = [desc.get.bind(source)]))
|
|
1425
|
+
}
|
|
1426
|
+
: desc.value !== undefined
|
|
1427
|
+
? desc
|
|
1428
|
+
: undefined;
|
|
1328
1429
|
} else {
|
|
1329
1430
|
const sources = sourcesMap[key];
|
|
1330
1431
|
if (sources) {
|
|
1331
|
-
if (desc.get) sources.push(desc.get.bind(source));
|
|
1432
|
+
if (desc.get) sources.push(desc.get.bind(source));
|
|
1433
|
+
else if (desc.value !== undefined) sources.push(() => desc.value);
|
|
1332
1434
|
}
|
|
1333
1435
|
}
|
|
1334
1436
|
}
|
|
@@ -1338,7 +1440,8 @@ function mergeProps(...sources) {
|
|
|
1338
1440
|
for (let i = definedKeys.length - 1; i >= 0; i--) {
|
|
1339
1441
|
const key = definedKeys[i],
|
|
1340
1442
|
desc = defined[key];
|
|
1341
|
-
if (desc && desc.get) Object.defineProperty(target, key, desc);
|
|
1443
|
+
if (desc && desc.get) Object.defineProperty(target, key, desc);
|
|
1444
|
+
else target[key] = desc ? desc.value : undefined;
|
|
1342
1445
|
}
|
|
1343
1446
|
return target;
|
|
1344
1447
|
}
|
|
@@ -1346,47 +1449,60 @@ function splitProps(props, ...keys) {
|
|
|
1346
1449
|
if (SUPPORTS_PROXY && $PROXY in props) {
|
|
1347
1450
|
const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
|
|
1348
1451
|
const res = keys.map(k => {
|
|
1349
|
-
return new Proxy(
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1452
|
+
return new Proxy(
|
|
1453
|
+
{
|
|
1454
|
+
get(property) {
|
|
1455
|
+
return k.includes(property) ? props[property] : undefined;
|
|
1456
|
+
},
|
|
1457
|
+
has(property) {
|
|
1458
|
+
return k.includes(property) && property in props;
|
|
1459
|
+
},
|
|
1460
|
+
keys() {
|
|
1461
|
+
return k.filter(property => property in props);
|
|
1462
|
+
}
|
|
1355
1463
|
},
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
}
|
|
1359
|
-
}, propTraps);
|
|
1464
|
+
propTraps
|
|
1465
|
+
);
|
|
1360
1466
|
});
|
|
1361
|
-
res.push(
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1467
|
+
res.push(
|
|
1468
|
+
new Proxy(
|
|
1469
|
+
{
|
|
1470
|
+
get(property) {
|
|
1471
|
+
return blocked.has(property) ? undefined : props[property];
|
|
1472
|
+
},
|
|
1473
|
+
has(property) {
|
|
1474
|
+
return blocked.has(property) ? false : property in props;
|
|
1475
|
+
},
|
|
1476
|
+
keys() {
|
|
1477
|
+
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1478
|
+
}
|
|
1479
|
+
},
|
|
1480
|
+
propTraps
|
|
1481
|
+
)
|
|
1482
|
+
);
|
|
1372
1483
|
return res;
|
|
1373
1484
|
}
|
|
1374
1485
|
const otherObject = {};
|
|
1375
1486
|
const objects = keys.map(() => ({}));
|
|
1376
1487
|
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
1377
1488
|
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
1378
|
-
const isDefaultDesc =
|
|
1489
|
+
const isDefaultDesc =
|
|
1490
|
+
!desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1379
1491
|
let blocked = false;
|
|
1380
1492
|
let objectIndex = 0;
|
|
1381
1493
|
for (const k of keys) {
|
|
1382
1494
|
if (k.includes(propName)) {
|
|
1383
1495
|
blocked = true;
|
|
1384
|
-
isDefaultDesc
|
|
1496
|
+
isDefaultDesc
|
|
1497
|
+
? (objects[objectIndex][propName] = desc.value)
|
|
1498
|
+
: Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1385
1499
|
}
|
|
1386
1500
|
++objectIndex;
|
|
1387
1501
|
}
|
|
1388
1502
|
if (!blocked) {
|
|
1389
|
-
isDefaultDesc
|
|
1503
|
+
isDefaultDesc
|
|
1504
|
+
? (otherObject[propName] = desc.value)
|
|
1505
|
+
: Object.defineProperty(otherObject, propName, desc);
|
|
1390
1506
|
}
|
|
1391
1507
|
}
|
|
1392
1508
|
return [...objects, otherObject];
|
|
@@ -1412,17 +1528,21 @@ function lazy(fn) {
|
|
|
1412
1528
|
comp = s;
|
|
1413
1529
|
}
|
|
1414
1530
|
let Comp;
|
|
1415
|
-
return createMemo(() =>
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1531
|
+
return createMemo(() =>
|
|
1532
|
+
(Comp = comp())
|
|
1533
|
+
? untrack(() => {
|
|
1534
|
+
if (false);
|
|
1535
|
+
if (!ctx || sharedConfig.done) return Comp(props);
|
|
1536
|
+
const c = sharedConfig.context;
|
|
1537
|
+
setHydrateContext(ctx);
|
|
1538
|
+
const r = Comp(props);
|
|
1539
|
+
setHydrateContext(c);
|
|
1540
|
+
return r;
|
|
1541
|
+
})
|
|
1542
|
+
: ""
|
|
1543
|
+
);
|
|
1424
1544
|
};
|
|
1425
|
-
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
1545
|
+
wrap.preload = () => p || ((p = fn()).then(mod => (comp = () => mod.default)), p);
|
|
1426
1546
|
return wrap;
|
|
1427
1547
|
}
|
|
1428
1548
|
let counter = 0;
|
|
@@ -1447,49 +1567,77 @@ function Index(props) {
|
|
|
1447
1567
|
function Show(props) {
|
|
1448
1568
|
const keyed = props.keyed;
|
|
1449
1569
|
const condition = createMemo(() => props.when, undefined, {
|
|
1450
|
-
equals: (a, b) => keyed ? a === b : !a === !b
|
|
1570
|
+
equals: (a, b) => (keyed ? a === b : !a === !b)
|
|
1451
1571
|
});
|
|
1452
|
-
return createMemo(
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1572
|
+
return createMemo(
|
|
1573
|
+
() => {
|
|
1574
|
+
const c = condition();
|
|
1575
|
+
if (c) {
|
|
1576
|
+
const child = props.children;
|
|
1577
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1578
|
+
return fn
|
|
1579
|
+
? untrack(() =>
|
|
1580
|
+
child(
|
|
1581
|
+
keyed
|
|
1582
|
+
? c
|
|
1583
|
+
: () => {
|
|
1584
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1585
|
+
return props.when;
|
|
1586
|
+
}
|
|
1587
|
+
)
|
|
1588
|
+
)
|
|
1589
|
+
: child;
|
|
1590
|
+
}
|
|
1591
|
+
return props.fallback;
|
|
1592
|
+
},
|
|
1593
|
+
undefined,
|
|
1594
|
+
undefined
|
|
1595
|
+
);
|
|
1464
1596
|
}
|
|
1465
1597
|
function Switch(props) {
|
|
1466
1598
|
let keyed = false;
|
|
1467
1599
|
const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1468
1600
|
const conditions = children(() => props.children),
|
|
1469
|
-
evalConditions = createMemo(
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1601
|
+
evalConditions = createMemo(
|
|
1602
|
+
() => {
|
|
1603
|
+
let conds = conditions();
|
|
1604
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1605
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1606
|
+
const c = conds[i].when;
|
|
1607
|
+
if (c) {
|
|
1608
|
+
keyed = !!conds[i].keyed;
|
|
1609
|
+
return [i, c, conds[i]];
|
|
1610
|
+
}
|
|
1477
1611
|
}
|
|
1612
|
+
return [-1];
|
|
1613
|
+
},
|
|
1614
|
+
undefined,
|
|
1615
|
+
{
|
|
1616
|
+
equals
|
|
1478
1617
|
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1618
|
+
);
|
|
1619
|
+
return createMemo(
|
|
1620
|
+
() => {
|
|
1621
|
+
const [index, when, cond] = evalConditions();
|
|
1622
|
+
if (index < 0) return props.fallback;
|
|
1623
|
+
const c = cond.children;
|
|
1624
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1625
|
+
return fn
|
|
1626
|
+
? untrack(() =>
|
|
1627
|
+
c(
|
|
1628
|
+
keyed
|
|
1629
|
+
? when
|
|
1630
|
+
: () => {
|
|
1631
|
+
if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
|
|
1632
|
+
return cond.when;
|
|
1633
|
+
}
|
|
1634
|
+
)
|
|
1635
|
+
)
|
|
1636
|
+
: c;
|
|
1637
|
+
},
|
|
1638
|
+
undefined,
|
|
1639
|
+
undefined
|
|
1640
|
+
);
|
|
1493
1641
|
}
|
|
1494
1642
|
function Match(props) {
|
|
1495
1643
|
return props;
|
|
@@ -1500,23 +1648,29 @@ function resetErrorBoundaries() {
|
|
|
1500
1648
|
}
|
|
1501
1649
|
function ErrorBoundary(props) {
|
|
1502
1650
|
let err;
|
|
1503
|
-
if (sharedConfig.context && sharedConfig.load)
|
|
1651
|
+
if (sharedConfig.context && sharedConfig.load)
|
|
1652
|
+
err = sharedConfig.load(sharedConfig.getContextId());
|
|
1504
1653
|
const [errored, setErrored] = createSignal(err, undefined);
|
|
1505
1654
|
Errors || (Errors = new Set());
|
|
1506
1655
|
Errors.add(setErrored);
|
|
1507
1656
|
onCleanup(() => Errors.delete(setErrored));
|
|
1508
|
-
return createMemo(
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1657
|
+
return createMemo(
|
|
1658
|
+
() => {
|
|
1659
|
+
let e;
|
|
1660
|
+
if ((e = errored())) {
|
|
1661
|
+
const f = props.fallback;
|
|
1662
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1663
|
+
}
|
|
1664
|
+
return catchError(() => props.children, setErrored);
|
|
1665
|
+
},
|
|
1666
|
+
undefined,
|
|
1667
|
+
undefined
|
|
1668
|
+
);
|
|
1516
1669
|
}
|
|
1517
1670
|
|
|
1518
|
-
const suspenseListEquals = (a, b) =>
|
|
1519
|
-
|
|
1671
|
+
const suspenseListEquals = (a, b) =>
|
|
1672
|
+
a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1673
|
+
const SuspenseListContext = /* #__PURE__ */ createContext();
|
|
1520
1674
|
function SuspenseList(props) {
|
|
1521
1675
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1522
1676
|
inFallback: false
|
|
@@ -1527,51 +1681,51 @@ function SuspenseList(props) {
|
|
|
1527
1681
|
if (listContext) {
|
|
1528
1682
|
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1529
1683
|
}
|
|
1530
|
-
const resolved = createMemo(
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
showContent = true,
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
const res = reg.map(() => ({
|
|
1542
|
-
showContent: all && showContent,
|
|
1543
|
-
showFallback
|
|
1544
|
-
}));
|
|
1545
|
-
res.inFallback = !all;
|
|
1546
|
-
return res;
|
|
1547
|
-
}
|
|
1548
|
-
let stop = false;
|
|
1549
|
-
let inFallback = prev.inFallback;
|
|
1550
|
-
const res = [];
|
|
1551
|
-
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1552
|
-
const n = reverse ? len - i - 1 : i,
|
|
1553
|
-
s = reg[n]();
|
|
1554
|
-
if (!stop && !s) {
|
|
1555
|
-
res[n] = {
|
|
1556
|
-
showContent,
|
|
1684
|
+
const resolved = createMemo(
|
|
1685
|
+
prev => {
|
|
1686
|
+
const reveal = props.revealOrder,
|
|
1687
|
+
tail = props.tail,
|
|
1688
|
+
{ showContent = true, showFallback = true } = show ? show() : {},
|
|
1689
|
+
reg = registry(),
|
|
1690
|
+
reverse = reveal === "backwards";
|
|
1691
|
+
if (reveal === "together") {
|
|
1692
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1693
|
+
const res = reg.map(() => ({
|
|
1694
|
+
showContent: all && showContent,
|
|
1557
1695
|
showFallback
|
|
1558
|
-
};
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1696
|
+
}));
|
|
1697
|
+
res.inFallback = !all;
|
|
1698
|
+
return res;
|
|
1699
|
+
}
|
|
1700
|
+
let stop = false;
|
|
1701
|
+
let inFallback = prev.inFallback;
|
|
1702
|
+
const res = [];
|
|
1703
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1704
|
+
const n = reverse ? len - i - 1 : i,
|
|
1705
|
+
s = reg[n]();
|
|
1706
|
+
if (!stop && !s) {
|
|
1707
|
+
res[n] = {
|
|
1708
|
+
showContent,
|
|
1709
|
+
showFallback
|
|
1710
|
+
};
|
|
1711
|
+
} else {
|
|
1712
|
+
const next = !stop;
|
|
1713
|
+
if (next) inFallback = true;
|
|
1714
|
+
res[n] = {
|
|
1715
|
+
showContent: next,
|
|
1716
|
+
showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
|
|
1717
|
+
};
|
|
1718
|
+
stop = true;
|
|
1719
|
+
}
|
|
1567
1720
|
}
|
|
1721
|
+
if (!stop) inFallback = false;
|
|
1722
|
+
res.inFallback = inFallback;
|
|
1723
|
+
return res;
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
inFallback: false
|
|
1568
1727
|
}
|
|
1569
|
-
|
|
1570
|
-
res.inFallback = inFallback;
|
|
1571
|
-
return res;
|
|
1572
|
-
}, {
|
|
1573
|
-
inFallback: false
|
|
1574
|
-
});
|
|
1728
|
+
);
|
|
1575
1729
|
setWrapper(() => resolved);
|
|
1576
1730
|
return createComponent(SuspenseListContext.Provider, {
|
|
1577
1731
|
value: {
|
|
@@ -1616,23 +1770,27 @@ function Suspense(props) {
|
|
|
1616
1770
|
const key = sharedConfig.getContextId();
|
|
1617
1771
|
let ref = sharedConfig.load(key);
|
|
1618
1772
|
if (ref) {
|
|
1619
|
-
if (typeof ref !== "object" || ref.status !== "success") p = ref;
|
|
1773
|
+
if (typeof ref !== "object" || ref.status !== "success") p = ref;
|
|
1774
|
+
else sharedConfig.gather(key);
|
|
1620
1775
|
}
|
|
1621
1776
|
if (p && p !== "$$f") {
|
|
1622
1777
|
const [s, set] = createSignal(undefined, {
|
|
1623
1778
|
equals: false
|
|
1624
1779
|
});
|
|
1625
1780
|
flicker = s;
|
|
1626
|
-
p.then(
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1781
|
+
p.then(
|
|
1782
|
+
() => {
|
|
1783
|
+
if (sharedConfig.done) return set();
|
|
1784
|
+
sharedConfig.gather(key);
|
|
1785
|
+
setHydrateContext(ctx);
|
|
1786
|
+
set();
|
|
1787
|
+
setHydrateContext();
|
|
1788
|
+
},
|
|
1789
|
+
err => {
|
|
1790
|
+
error = err;
|
|
1791
|
+
set();
|
|
1792
|
+
}
|
|
1793
|
+
);
|
|
1636
1794
|
}
|
|
1637
1795
|
}
|
|
1638
1796
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1647,17 +1805,14 @@ function Suspense(props) {
|
|
|
1647
1805
|
ctx = sharedConfig.context;
|
|
1648
1806
|
if (flicker) {
|
|
1649
1807
|
flicker();
|
|
1650
|
-
return flicker = undefined;
|
|
1808
|
+
return (flicker = undefined);
|
|
1651
1809
|
}
|
|
1652
1810
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1653
1811
|
const rendered = createMemo(() => props.children);
|
|
1654
1812
|
return createMemo(prev => {
|
|
1655
1813
|
const inFallback = store.inFallback(),
|
|
1656
|
-
{
|
|
1657
|
-
|
|
1658
|
-
showFallback = true
|
|
1659
|
-
} = show ? show() : {};
|
|
1660
|
-
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1814
|
+
{ showContent = true, showFallback = true } = show ? show() : {};
|
|
1815
|
+
if ((!inFallback || (p && p !== "$$f")) && showContent) {
|
|
1661
1816
|
store.resolved = true;
|
|
1662
1817
|
dispose && dispose();
|
|
1663
1818
|
dispose = ctx = p = undefined;
|
|
@@ -1685,4 +1840,59 @@ function Suspense(props) {
|
|
|
1685
1840
|
|
|
1686
1841
|
const DEV = undefined;
|
|
1687
1842
|
|
|
1688
|
-
export {
|
|
1843
|
+
export {
|
|
1844
|
+
$DEVCOMP,
|
|
1845
|
+
$PROXY,
|
|
1846
|
+
$TRACK,
|
|
1847
|
+
DEV,
|
|
1848
|
+
ErrorBoundary,
|
|
1849
|
+
For,
|
|
1850
|
+
Index,
|
|
1851
|
+
Match,
|
|
1852
|
+
Show,
|
|
1853
|
+
Suspense,
|
|
1854
|
+
SuspenseList,
|
|
1855
|
+
Switch,
|
|
1856
|
+
batch,
|
|
1857
|
+
cancelCallback,
|
|
1858
|
+
catchError,
|
|
1859
|
+
children,
|
|
1860
|
+
createComponent,
|
|
1861
|
+
createComputed,
|
|
1862
|
+
createContext,
|
|
1863
|
+
createDeferred,
|
|
1864
|
+
createEffect,
|
|
1865
|
+
createMemo,
|
|
1866
|
+
createReaction,
|
|
1867
|
+
createRenderEffect,
|
|
1868
|
+
createResource,
|
|
1869
|
+
createRoot,
|
|
1870
|
+
createSelector,
|
|
1871
|
+
createSignal,
|
|
1872
|
+
createUniqueId,
|
|
1873
|
+
enableExternalSource,
|
|
1874
|
+
enableHydration,
|
|
1875
|
+
enableScheduling,
|
|
1876
|
+
equalFn,
|
|
1877
|
+
from,
|
|
1878
|
+
getListener,
|
|
1879
|
+
getOwner,
|
|
1880
|
+
indexArray,
|
|
1881
|
+
lazy,
|
|
1882
|
+
mapArray,
|
|
1883
|
+
mergeProps,
|
|
1884
|
+
observable,
|
|
1885
|
+
on,
|
|
1886
|
+
onCleanup,
|
|
1887
|
+
onError,
|
|
1888
|
+
onMount,
|
|
1889
|
+
requestCallback,
|
|
1890
|
+
resetErrorBoundaries,
|
|
1891
|
+
runWithOwner,
|
|
1892
|
+
sharedConfig,
|
|
1893
|
+
splitProps,
|
|
1894
|
+
startTransition,
|
|
1895
|
+
untrack,
|
|
1896
|
+
useContext,
|
|
1897
|
+
useTransition
|
|
1898
|
+
};
|