solid-js 1.9.6 → 1.9.8
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.cjs +26 -15
- package/dist/dev.js +334 -564
- package/dist/server.cjs +3 -1
- package/dist/server.js +83 -178
- package/dist/solid.cjs +26 -15
- package/dist/solid.js +290 -493
- package/h/dist/h.js +9 -40
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +8 -11
- package/h/jsx-runtime/types/jsx.d.ts +246 -234
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +94 -219
- package/html/types/lit.d.ts +33 -52
- package/package.json +3 -3
- package/store/dist/dev.cjs +9 -5
- package/store/dist/dev.js +50 -126
- package/store/dist/server.js +8 -20
- package/store/dist/store.cjs +9 -5
- package/store/dist/store.js +47 -117
- package/store/types/index.d.ts +7 -21
- package/store/types/modifiers.d.ts +3 -6
- package/store/types/mutable.d.ts +2 -5
- package/store/types/server.d.ts +5 -25
- package/store/types/store.d.ts +61 -218
- package/types/index.d.ts +11 -78
- package/types/jsx.d.ts +245 -229
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +16 -22
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +145 -236
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +37 -73
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +15 -15
- package/types/server/index.d.ts +2 -57
- package/types/server/reactive.d.ts +45 -76
- package/types/server/rendering.d.ts +98 -169
- package/universal/dist/dev.js +12 -28
- package/universal/dist/universal.js +12 -28
- package/universal/types/index.d.ts +2 -3
- package/universal/types/universal.d.ts +3 -2
- package/web/dist/dev.cjs +89 -6
- package/web/dist/dev.js +174 -646
- package/web/dist/server.cjs +90 -5
- package/web/dist/server.js +194 -647
- package/web/dist/web.cjs +89 -6
- package/web/dist/web.js +172 -634
- package/web/storage/dist/storage.js +3 -3
- package/web/types/core.d.ts +1 -9
- package/web/types/index.d.ts +11 -31
- package/web/types/server-mock.d.ts +32 -47
package/dist/server.cjs
CHANGED
|
@@ -602,10 +602,12 @@ function createResource(source, fetcher, options = {}) {
|
|
|
602
602
|
return ctx.resources[id].data;
|
|
603
603
|
}
|
|
604
604
|
if (options.ssrLoadFrom !== "initial") load();
|
|
605
|
-
|
|
605
|
+
const ref = [read, {
|
|
606
606
|
refetch: load,
|
|
607
607
|
mutate: v => value = v
|
|
608
608
|
}];
|
|
609
|
+
if (p) resource.ref = ref;
|
|
610
|
+
return ref;
|
|
609
611
|
}
|
|
610
612
|
function lazy(fn) {
|
|
611
613
|
let p;
|
package/dist/server.js
CHANGED
|
@@ -17,7 +17,7 @@ function handleError(err, owner = Owner) {
|
|
|
17
17
|
try {
|
|
18
18
|
for (const f of fns) f(error);
|
|
19
19
|
} catch (e) {
|
|
20
|
-
handleError(e,
|
|
20
|
+
handleError(e, owner && owner.owner || null);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
const UNOWNED = {
|
|
@@ -35,23 +35,19 @@ function createOwner() {
|
|
|
35
35
|
cleanups: null
|
|
36
36
|
};
|
|
37
37
|
if (Owner) {
|
|
38
|
-
if (!Owner.owned) Owner.owned = [o];
|
|
39
|
-
else Owner.owned.push(o);
|
|
38
|
+
if (!Owner.owned) Owner.owned = [o];else Owner.owned.push(o);
|
|
40
39
|
}
|
|
41
40
|
return o;
|
|
42
41
|
}
|
|
43
42
|
function createRoot(fn, detachedOwner) {
|
|
44
43
|
const owner = Owner,
|
|
45
44
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
46
|
-
root =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
owned: null,
|
|
53
|
-
cleanups: null
|
|
54
|
-
};
|
|
45
|
+
root = fn.length === 0 ? UNOWNED : {
|
|
46
|
+
context: current ? current.context : null,
|
|
47
|
+
owner: current,
|
|
48
|
+
owned: null,
|
|
49
|
+
cleanups: null
|
|
50
|
+
};
|
|
55
51
|
Owner = root;
|
|
56
52
|
let result;
|
|
57
53
|
try {
|
|
@@ -64,12 +60,9 @@ function createRoot(fn, detachedOwner) {
|
|
|
64
60
|
return result;
|
|
65
61
|
}
|
|
66
62
|
function createSignal(value, options) {
|
|
67
|
-
return [
|
|
68
|
-
()
|
|
69
|
-
|
|
70
|
-
return (value = typeof v === "function" ? v(value) : v);
|
|
71
|
-
}
|
|
72
|
-
];
|
|
63
|
+
return [() => value, v => {
|
|
64
|
+
return value = typeof v === "function" ? v(value) : v;
|
|
65
|
+
}];
|
|
73
66
|
}
|
|
74
67
|
function createComputed(fn, value) {
|
|
75
68
|
Owner = createOwner();
|
|
@@ -126,8 +119,7 @@ function on(deps, fn, options = {}) {
|
|
|
126
119
|
function onMount(fn) {}
|
|
127
120
|
function onCleanup(fn) {
|
|
128
121
|
if (Owner) {
|
|
129
|
-
if (!Owner.cleanups) Owner.cleanups = [fn];
|
|
130
|
-
else Owner.cleanups.push(fn);
|
|
122
|
+
if (!Owner.cleanups) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
|
|
131
123
|
}
|
|
132
124
|
return fn;
|
|
133
125
|
}
|
|
@@ -168,9 +160,7 @@ function createContext(defaultValue) {
|
|
|
168
160
|
};
|
|
169
161
|
}
|
|
170
162
|
function useContext(context) {
|
|
171
|
-
return Owner && Owner.context && Owner.context[context.id] !== undefined
|
|
172
|
-
? Owner.context[context.id]
|
|
173
|
-
: context.defaultValue;
|
|
163
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
|
|
174
164
|
}
|
|
175
165
|
function getOwner() {
|
|
176
166
|
return Owner;
|
|
@@ -247,8 +237,7 @@ function observable(input) {
|
|
|
247
237
|
if (!(observer instanceof Object) || observer == null) {
|
|
248
238
|
throw new TypeError("Expected the observer to be an object.");
|
|
249
239
|
}
|
|
250
|
-
const handler =
|
|
251
|
-
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
240
|
+
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
252
241
|
if (!handler) {
|
|
253
242
|
return {
|
|
254
243
|
unsubscribe() {}
|
|
@@ -277,7 +266,7 @@ function from(producer) {
|
|
|
277
266
|
const [s, set] = createSignal(undefined);
|
|
278
267
|
if ("subscribe" in producer) {
|
|
279
268
|
const unsub = producer.subscribe(v => set(() => v));
|
|
280
|
-
onCleanup(() =>
|
|
269
|
+
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
281
270
|
} else {
|
|
282
271
|
const clean = producer(set);
|
|
283
272
|
onCleanup(clean);
|
|
@@ -348,13 +337,12 @@ function escape(s, attr) {
|
|
|
348
337
|
left = iDelim + 1;
|
|
349
338
|
iDelim = s.indexOf(delim, left);
|
|
350
339
|
} while (iDelim >= 0);
|
|
351
|
-
} else
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
340
|
+
} else while (iAmp >= 0) {
|
|
341
|
+
if (left < iAmp) out += s.substring(left, iAmp);
|
|
342
|
+
out += "&";
|
|
343
|
+
left = iAmp + 1;
|
|
344
|
+
iAmp = s.indexOf("&", left);
|
|
345
|
+
}
|
|
358
346
|
return left < s.length ? out + s.substring(left) : out;
|
|
359
347
|
}
|
|
360
348
|
function resolveSSRNode(node) {
|
|
@@ -366,7 +354,7 @@ function resolveSSRNode(node) {
|
|
|
366
354
|
let mapped = "";
|
|
367
355
|
for (let i = 0, len = node.length; i < len; i++) {
|
|
368
356
|
if (typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
|
|
369
|
-
mapped += resolveSSRNode(
|
|
357
|
+
mapped += resolveSSRNode(prev = node[i]);
|
|
370
358
|
}
|
|
371
359
|
return mapped;
|
|
372
360
|
}
|
|
@@ -381,8 +369,7 @@ const sharedConfig = {
|
|
|
381
369
|
return getContextId(this.context.count);
|
|
382
370
|
},
|
|
383
371
|
getNextContextId() {
|
|
384
|
-
if (!this.context)
|
|
385
|
-
throw new Error(`getNextContextId cannot be used under non-hydrating context`);
|
|
372
|
+
if (!this.context) throw new Error(`getNextContextId cannot be used under non-hydrating context`);
|
|
386
373
|
return getContextId(this.context.count++);
|
|
387
374
|
}
|
|
388
375
|
};
|
|
@@ -395,13 +382,11 @@ function setHydrateContext(context) {
|
|
|
395
382
|
sharedConfig.context = context;
|
|
396
383
|
}
|
|
397
384
|
function nextHydrateContext() {
|
|
398
|
-
return sharedConfig.context
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
404
|
-
: undefined;
|
|
385
|
+
return sharedConfig.context ? {
|
|
386
|
+
...sharedConfig.context,
|
|
387
|
+
id: sharedConfig.getNextContextId(),
|
|
388
|
+
count: 0
|
|
389
|
+
} : undefined;
|
|
405
390
|
}
|
|
406
391
|
function createUniqueId() {
|
|
407
392
|
return sharedConfig.getNextContextId();
|
|
@@ -476,11 +461,7 @@ function Index(props) {
|
|
|
476
461
|
}
|
|
477
462
|
function Show(props) {
|
|
478
463
|
let c;
|
|
479
|
-
return props.when
|
|
480
|
-
? typeof (c = props.children) === "function"
|
|
481
|
-
? c(props.keyed ? props.when : () => props.when)
|
|
482
|
-
: c
|
|
483
|
-
: props.fallback || "";
|
|
464
|
+
return props.when ? typeof (c = props.children) === "function" ? c(props.keyed ? props.when : () => props.when) : c : props.fallback || "";
|
|
484
465
|
}
|
|
485
466
|
function Switch(props) {
|
|
486
467
|
let conditions = props.children;
|
|
@@ -517,14 +498,11 @@ function ErrorBoundary(props) {
|
|
|
517
498
|
}
|
|
518
499
|
createMemo(() => {
|
|
519
500
|
clean = Owner;
|
|
520
|
-
return catchError(
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
sync = true;
|
|
526
|
-
}
|
|
527
|
-
);
|
|
501
|
+
return catchError(() => res = props.children, err => {
|
|
502
|
+
error = err;
|
|
503
|
+
!sync && ctx.replace("e" + id, displayFallback);
|
|
504
|
+
sync = true;
|
|
505
|
+
});
|
|
528
506
|
});
|
|
529
507
|
if (error) return displayFallback();
|
|
530
508
|
sync = false;
|
|
@@ -549,17 +527,13 @@ function createResource(source, fetcher, options = {}) {
|
|
|
549
527
|
if (sharedConfig.context.async && options.ssrLoadFrom !== "initial") {
|
|
550
528
|
resource = sharedConfig.context.resources[id] || (sharedConfig.context.resources[id] = {});
|
|
551
529
|
if (resource.ref) {
|
|
552
|
-
if (!resource.data && !resource.ref[0].loading && !resource.ref[0].error)
|
|
553
|
-
resource.ref[1].refetch();
|
|
530
|
+
if (!resource.data && !resource.ref[0].loading && !resource.ref[0].error) resource.ref[1].refetch();
|
|
554
531
|
return resource.ref;
|
|
555
532
|
}
|
|
556
533
|
}
|
|
557
534
|
const read = () => {
|
|
558
535
|
if (error) throw error;
|
|
559
|
-
const resolved =
|
|
560
|
-
options.ssrLoadFrom !== "initial" &&
|
|
561
|
-
sharedConfig.context.async &&
|
|
562
|
-
"data" in sharedConfig.context.resources[id];
|
|
536
|
+
const resolved = options.ssrLoadFrom !== "initial" && sharedConfig.context.async && "data" in sharedConfig.context.resources[id];
|
|
563
537
|
if (!resolved && resourceContext) resourceContext.push(id);
|
|
564
538
|
if (!resolved && read.loading) {
|
|
565
539
|
const ctx = useContext(SuspenseContext);
|
|
@@ -580,7 +554,7 @@ function createResource(source, fetcher, options = {}) {
|
|
|
580
554
|
});
|
|
581
555
|
function load() {
|
|
582
556
|
const ctx = sharedConfig.context;
|
|
583
|
-
if (!ctx.async) return
|
|
557
|
+
if (!ctx.async) return read.loading = !!(typeof source === "function" ? source() : source);
|
|
584
558
|
if (ctx.resources && id in ctx.resources && "data" in ctx.resources[id]) {
|
|
585
559
|
value = ctx.resources[id].data;
|
|
586
560
|
return;
|
|
@@ -602,23 +576,21 @@ function createResource(source, fetcher, options = {}) {
|
|
|
602
576
|
if (p != undefined && typeof p === "object" && "then" in p) {
|
|
603
577
|
read.loading = true;
|
|
604
578
|
read.state = "pending";
|
|
605
|
-
p = p
|
|
606
|
-
.
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
.
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
throw error;
|
|
621
|
-
});
|
|
579
|
+
p = p.then(res => {
|
|
580
|
+
read.loading = false;
|
|
581
|
+
read.state = "ready";
|
|
582
|
+
ctx.resources[id].data = res;
|
|
583
|
+
p = null;
|
|
584
|
+
notifySuspense(contexts);
|
|
585
|
+
return res;
|
|
586
|
+
}).catch(err => {
|
|
587
|
+
read.loading = false;
|
|
588
|
+
read.state = "errored";
|
|
589
|
+
read.error = error = castError(err);
|
|
590
|
+
p = null;
|
|
591
|
+
notifySuspense(contexts);
|
|
592
|
+
throw error;
|
|
593
|
+
});
|
|
622
594
|
if (ctx.serialize) ctx.serialize(id, p, options.deferStream);
|
|
623
595
|
return p;
|
|
624
596
|
}
|
|
@@ -628,20 +600,19 @@ function createResource(source, fetcher, options = {}) {
|
|
|
628
600
|
return ctx.resources[id].data;
|
|
629
601
|
}
|
|
630
602
|
if (options.ssrLoadFrom !== "initial") load();
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
]);
|
|
603
|
+
const ref = [read, {
|
|
604
|
+
refetch: load,
|
|
605
|
+
mutate: v => value = v
|
|
606
|
+
}];
|
|
607
|
+
if (p) resource.ref = ref;
|
|
608
|
+
return ref;
|
|
638
609
|
}
|
|
639
610
|
function lazy(fn) {
|
|
640
611
|
let p;
|
|
641
612
|
let load = id => {
|
|
642
613
|
if (!p) {
|
|
643
614
|
p = fn();
|
|
644
|
-
p.then(mod =>
|
|
615
|
+
p.then(mod => p.resolved = mod.default);
|
|
645
616
|
if (id) sharedConfig.context.lazy[id] = p;
|
|
646
617
|
}
|
|
647
618
|
return p;
|
|
@@ -650,8 +621,7 @@ function lazy(fn) {
|
|
|
650
621
|
const wrap = props => {
|
|
651
622
|
const id = sharedConfig.context.id;
|
|
652
623
|
let ref = sharedConfig.context.lazy[id];
|
|
653
|
-
if (ref) p = ref;
|
|
654
|
-
else load(id);
|
|
624
|
+
if (ref) p = ref;else load(id);
|
|
655
625
|
if (p.resolved) return p.resolved(props);
|
|
656
626
|
const ctx = useContext(SuspenseContext);
|
|
657
627
|
const track = {
|
|
@@ -663,12 +633,10 @@ function lazy(fn) {
|
|
|
663
633
|
contexts.add(ctx);
|
|
664
634
|
}
|
|
665
635
|
if (sharedConfig.context.async) {
|
|
666
|
-
sharedConfig.context.block(
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
})
|
|
671
|
-
);
|
|
636
|
+
sharedConfig.context.block(p.then(() => {
|
|
637
|
+
track.loading = false;
|
|
638
|
+
notifySuspense(contexts);
|
|
639
|
+
}));
|
|
672
640
|
}
|
|
673
641
|
return "";
|
|
674
642
|
};
|
|
@@ -696,12 +664,9 @@ function startTransition(fn) {
|
|
|
696
664
|
fn();
|
|
697
665
|
}
|
|
698
666
|
function useTransition() {
|
|
699
|
-
return [
|
|
700
|
-
()
|
|
701
|
-
|
|
702
|
-
fn();
|
|
703
|
-
}
|
|
704
|
-
];
|
|
667
|
+
return [() => false, fn => {
|
|
668
|
+
fn();
|
|
669
|
+
}];
|
|
705
670
|
}
|
|
706
671
|
function SuspenseList(props) {
|
|
707
672
|
return props.children;
|
|
@@ -711,17 +676,15 @@ function Suspense(props) {
|
|
|
711
676
|
const ctx = sharedConfig.context;
|
|
712
677
|
const id = sharedConfig.getContextId();
|
|
713
678
|
const o = createOwner();
|
|
714
|
-
const value =
|
|
715
|
-
|
|
716
|
-
(
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
if (suspenseComplete(value)) {
|
|
721
|
-
done(resolveSSRNode(escape(res)));
|
|
722
|
-
}
|
|
679
|
+
const value = ctx.suspense[id] || (ctx.suspense[id] = {
|
|
680
|
+
resources: new Map(),
|
|
681
|
+
completed: () => {
|
|
682
|
+
const res = runSuspense();
|
|
683
|
+
if (suspenseComplete(value)) {
|
|
684
|
+
done(resolveSSRNode(escape(res)));
|
|
723
685
|
}
|
|
724
|
-
}
|
|
686
|
+
}
|
|
687
|
+
});
|
|
725
688
|
function suspenseError(err) {
|
|
726
689
|
if (!done || !done(undefined, err)) {
|
|
727
690
|
runWithOwner(o.owner, () => {
|
|
@@ -735,14 +698,12 @@ function Suspense(props) {
|
|
|
735
698
|
count: 0
|
|
736
699
|
});
|
|
737
700
|
cleanNode(o);
|
|
738
|
-
return runWithOwner(o, () =>
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
})
|
|
745
|
-
);
|
|
701
|
+
return runWithOwner(o, () => createComponent(SuspenseContext.Provider, {
|
|
702
|
+
value,
|
|
703
|
+
get children() {
|
|
704
|
+
return catchError(() => props.children, suspenseError);
|
|
705
|
+
}
|
|
706
|
+
}));
|
|
746
707
|
}
|
|
747
708
|
const res = runSuspense();
|
|
748
709
|
if (suspenseComplete(value)) {
|
|
@@ -759,9 +720,7 @@ function Suspense(props) {
|
|
|
759
720
|
noHydrate: true
|
|
760
721
|
});
|
|
761
722
|
const res = {
|
|
762
|
-
t: `<template id="pl-${id}"></template>${resolveSSRNode(
|
|
763
|
-
escape(props.fallback)
|
|
764
|
-
)}<!--pl-${id}-->`
|
|
723
|
+
t: `<template id="pl-${id}"></template>${resolveSSRNode(escape(props.fallback))}<!--pl-${id}-->`
|
|
765
724
|
};
|
|
766
725
|
setHydrateContext(ctx);
|
|
767
726
|
return res;
|
|
@@ -776,58 +735,4 @@ function Suspense(props) {
|
|
|
776
735
|
}, suspenseError);
|
|
777
736
|
}
|
|
778
737
|
|
|
779
|
-
export {
|
|
780
|
-
$DEVCOMP,
|
|
781
|
-
$PROXY,
|
|
782
|
-
$TRACK,
|
|
783
|
-
DEV,
|
|
784
|
-
ErrorBoundary,
|
|
785
|
-
For,
|
|
786
|
-
Index,
|
|
787
|
-
Match,
|
|
788
|
-
Show,
|
|
789
|
-
Suspense,
|
|
790
|
-
SuspenseList,
|
|
791
|
-
Switch,
|
|
792
|
-
batch,
|
|
793
|
-
catchError,
|
|
794
|
-
children,
|
|
795
|
-
createComponent,
|
|
796
|
-
createComputed,
|
|
797
|
-
createContext,
|
|
798
|
-
createDeferred,
|
|
799
|
-
createEffect,
|
|
800
|
-
createMemo,
|
|
801
|
-
createReaction,
|
|
802
|
-
createRenderEffect,
|
|
803
|
-
createResource,
|
|
804
|
-
createRoot,
|
|
805
|
-
createSelector,
|
|
806
|
-
createSignal,
|
|
807
|
-
createUniqueId,
|
|
808
|
-
enableExternalSource,
|
|
809
|
-
enableHydration,
|
|
810
|
-
enableScheduling,
|
|
811
|
-
equalFn,
|
|
812
|
-
from,
|
|
813
|
-
getListener,
|
|
814
|
-
getOwner,
|
|
815
|
-
indexArray,
|
|
816
|
-
lazy,
|
|
817
|
-
mapArray,
|
|
818
|
-
mergeProps,
|
|
819
|
-
observable,
|
|
820
|
-
on,
|
|
821
|
-
onCleanup,
|
|
822
|
-
onError,
|
|
823
|
-
onMount,
|
|
824
|
-
requestCallback,
|
|
825
|
-
resetErrorBoundaries,
|
|
826
|
-
runWithOwner,
|
|
827
|
-
sharedConfig,
|
|
828
|
-
splitProps,
|
|
829
|
-
startTransition,
|
|
830
|
-
untrack,
|
|
831
|
-
useContext,
|
|
832
|
-
useTransition
|
|
833
|
-
};
|
|
738
|
+
export { $DEVCOMP, $PROXY, $TRACK, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, catchError, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/dist/solid.cjs
CHANGED
|
@@ -9,6 +9,7 @@ let taskIdCounter = 1,
|
|
|
9
9
|
yieldInterval = 5,
|
|
10
10
|
deadline = 0,
|
|
11
11
|
maxYieldInterval = 300,
|
|
12
|
+
maxDeadline = 0,
|
|
12
13
|
scheduleCallback = null,
|
|
13
14
|
scheduledCallback = null;
|
|
14
15
|
const maxSigned31BitInt = 1073741823;
|
|
@@ -20,9 +21,9 @@ function setupScheduler() {
|
|
|
20
21
|
if (scheduledCallback !== null) {
|
|
21
22
|
const currentTime = performance.now();
|
|
22
23
|
deadline = currentTime + yieldInterval;
|
|
23
|
-
|
|
24
|
+
maxDeadline = currentTime + maxYieldInterval;
|
|
24
25
|
try {
|
|
25
|
-
const hasMoreWork = scheduledCallback(
|
|
26
|
+
const hasMoreWork = scheduledCallback(currentTime);
|
|
26
27
|
if (!hasMoreWork) {
|
|
27
28
|
scheduledCallback = null;
|
|
28
29
|
} else port.postMessage(null);
|
|
@@ -40,7 +41,7 @@ function setupScheduler() {
|
|
|
40
41
|
if (scheduling.isInputPending()) {
|
|
41
42
|
return true;
|
|
42
43
|
}
|
|
43
|
-
return currentTime >=
|
|
44
|
+
return currentTime >= maxDeadline;
|
|
44
45
|
} else {
|
|
45
46
|
return false;
|
|
46
47
|
}
|
|
@@ -84,21 +85,21 @@ function requestCallback(fn, options) {
|
|
|
84
85
|
function cancelCallback(task) {
|
|
85
86
|
task.fn = null;
|
|
86
87
|
}
|
|
87
|
-
function flushWork(
|
|
88
|
+
function flushWork(initialTime) {
|
|
88
89
|
isCallbackScheduled = false;
|
|
89
90
|
isPerformingWork = true;
|
|
90
91
|
try {
|
|
91
|
-
return workLoop(
|
|
92
|
+
return workLoop(initialTime);
|
|
92
93
|
} finally {
|
|
93
94
|
currentTask = null;
|
|
94
95
|
isPerformingWork = false;
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
|
-
function workLoop(
|
|
98
|
+
function workLoop(initialTime) {
|
|
98
99
|
let currentTime = initialTime;
|
|
99
100
|
currentTask = taskQueue[0] || null;
|
|
100
101
|
while (currentTask !== null) {
|
|
101
|
-
if (currentTask.expirationTime > currentTime &&
|
|
102
|
+
if (currentTask.expirationTime > currentTime && shouldYieldToHost()) {
|
|
102
103
|
break;
|
|
103
104
|
}
|
|
104
105
|
const callback = currentTask.fn;
|
|
@@ -341,17 +342,27 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
341
342
|
return;
|
|
342
343
|
}
|
|
343
344
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
345
|
+
let error;
|
|
346
|
+
const p = initP !== NO_INIT ? initP : untrack(() => {
|
|
347
|
+
try {
|
|
348
|
+
return fetcher(lookup, {
|
|
349
|
+
value: value(),
|
|
350
|
+
refetching
|
|
351
|
+
});
|
|
352
|
+
} catch (fetcherError) {
|
|
353
|
+
error = fetcherError;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
if (error !== undefined) {
|
|
357
|
+
loadEnd(pr, undefined, castError(error), lookup);
|
|
358
|
+
return;
|
|
359
|
+
} else if (!isPromise(p)) {
|
|
349
360
|
loadEnd(pr, p, undefined, lookup);
|
|
350
361
|
return p;
|
|
351
362
|
}
|
|
352
363
|
pr = p;
|
|
353
|
-
if ("
|
|
354
|
-
if (p.
|
|
364
|
+
if ("v" in p) {
|
|
365
|
+
if (p.s === 1) loadEnd(pr, p.v, undefined, lookup);else loadEnd(pr, undefined, castError(p.v), lookup);
|
|
355
366
|
return p;
|
|
356
367
|
}
|
|
357
368
|
scheduled = true;
|
|
@@ -1622,7 +1633,7 @@ function Suspense(props) {
|
|
|
1622
1633
|
const key = sharedConfig.getContextId();
|
|
1623
1634
|
let ref = sharedConfig.load(key);
|
|
1624
1635
|
if (ref) {
|
|
1625
|
-
if (typeof ref !== "object" || ref.
|
|
1636
|
+
if (typeof ref !== "object" || ref.s !== 1) p = ref;else sharedConfig.gather(key);
|
|
1626
1637
|
}
|
|
1627
1638
|
if (p && p !== "$$f") {
|
|
1628
1639
|
const [s, set] = createSignal(undefined, {
|