solid-js 2.0.0-beta.5 → 2.0.0-beta.6
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 +70 -48
- package/dist/dev.js +64 -51
- package/dist/server.cjs +124 -3
- package/dist/server.js +120 -5
- package/dist/solid.cjs +64 -34
- package/dist/solid.js +58 -37
- package/package.json +2 -2
- package/types/client/core.d.ts +1 -8
- package/types/client/flow.d.ts +22 -0
- package/types/index.d.ts +3 -6
- package/types/jsx.d.ts +156 -122
- package/types/server/flow.d.ts +9 -0
- package/types/server/hydration.d.ts +9 -0
- package/types/server/index.d.ts +1 -1
- package/types/server/shared.d.ts +5 -1
- package/types/server/signals.d.ts +5 -1
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getOwner, getContext, getNextChildId, createOwner, NotReadyError, runWithOwner, onCleanup, isWrappable, setContext, flatten, createRoot } from '@solidjs/signals';
|
|
2
|
-
export { $PROXY, $REFRESH, $TRACK, NotReadyError, createOwner, createRoot, enableExternalSource, enforceLoadingBoundary, flatten, getNextChildId, getOwner, isEqual, isWrappable, merge, omit, onCleanup, runWithOwner, snapshot, storePath } from '@solidjs/signals';
|
|
2
|
+
export { $PROXY, $REFRESH, $TRACK, NotReadyError, createOwner, createRoot, enableExternalSource, enforceLoadingBoundary, flatten, getNextChildId, getOwner, isDisposed, isEqual, isWrappable, merge, omit, onCleanup, runWithOwner, snapshot, storePath } from '@solidjs/signals';
|
|
3
3
|
|
|
4
4
|
const NoHydrateContext = {
|
|
5
5
|
id: Symbol("NoHydrateContext"),
|
|
@@ -416,13 +416,14 @@ function createProjection(fn, initialValue = {}, options) {
|
|
|
416
416
|
promise.s = 1;
|
|
417
417
|
if (disposed) {
|
|
418
418
|
promise.v = state;
|
|
419
|
-
return;
|
|
419
|
+
return state;
|
|
420
420
|
}
|
|
421
421
|
if (v !== undefined && v !== state) {
|
|
422
422
|
Object.assign(state, v);
|
|
423
423
|
}
|
|
424
424
|
promise.v = state;
|
|
425
425
|
markReady();
|
|
426
|
+
return state;
|
|
426
427
|
}, () => {});
|
|
427
428
|
if (ctx?.async && !getContext(NoHydrateContext) && owner.id) ctx.serialize(owner.id, promise, options?.deferStream);
|
|
428
429
|
const [pending, markReady] = createPendingProxy(state, promise);
|
|
@@ -567,6 +568,10 @@ function createLoadingBoundary$1(fn, fallback, options) {
|
|
|
567
568
|
throw err;
|
|
568
569
|
}
|
|
569
570
|
}
|
|
571
|
+
function createRevealOrder(fn, _options) {
|
|
572
|
+
const o = createOwner();
|
|
573
|
+
return runWithOwner(o, fn);
|
|
574
|
+
}
|
|
570
575
|
function untrack(fn) {
|
|
571
576
|
return fn();
|
|
572
577
|
}
|
|
@@ -691,6 +696,10 @@ function createUniqueId() {
|
|
|
691
696
|
return getNextChildId(o);
|
|
692
697
|
}
|
|
693
698
|
|
|
699
|
+
const RevealGroupContext = {
|
|
700
|
+
id: Symbol("RevealGroupContext"),
|
|
701
|
+
defaultValue: null
|
|
702
|
+
};
|
|
694
703
|
function ssrHandleError(err) {
|
|
695
704
|
if (err instanceof NotReadyError) {
|
|
696
705
|
return err.source;
|
|
@@ -716,6 +725,7 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
716
725
|
const ctx = currentCtx;
|
|
717
726
|
const parent = getOwner();
|
|
718
727
|
const parentHandler = parent && runWithOwner(parent, () => getContext(ErrorContext));
|
|
728
|
+
const revealGroup = parent && runWithOwner(parent, () => getContext(RevealGroupContext));
|
|
719
729
|
const o = createOwner();
|
|
720
730
|
const id = o.id;
|
|
721
731
|
o.id = id + "00";
|
|
@@ -778,12 +788,25 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
778
788
|
commitBoundaryState();
|
|
779
789
|
return () => ret;
|
|
780
790
|
}
|
|
791
|
+
const collapseFallback = revealGroup ? revealGroup.register(id) : false;
|
|
792
|
+
if (collapseFallback && !ctx.async) {
|
|
793
|
+
commitBoundaryState();
|
|
794
|
+
ctx.serialize(id, "$$f");
|
|
795
|
+
return () => undefined;
|
|
796
|
+
}
|
|
781
797
|
const fallbackOwner = createOwner({
|
|
782
798
|
id
|
|
783
799
|
});
|
|
784
|
-
const fallbackResult = runWithOwner(fallbackOwner, () =>
|
|
800
|
+
const fallbackResult = runWithOwner(fallbackOwner, () => {
|
|
801
|
+
if (!ctx.async) return fallback();
|
|
802
|
+
const tpl = collapseFallback ? [`<template id="pl-${id}">`, `</template><!--pl-${id}-->`] : [`<template id="pl-${id}"></template>`, `<!--pl-${id}-->`];
|
|
803
|
+
return ctx.ssr(tpl, ctx.escape(fallback()));
|
|
804
|
+
});
|
|
785
805
|
if (ctx.async) {
|
|
786
|
-
|
|
806
|
+
const regOpts = revealGroup ? {
|
|
807
|
+
revealGroup: revealGroup.id
|
|
808
|
+
} : undefined;
|
|
809
|
+
done = ctx.registerFragment(id, regOpts);
|
|
787
810
|
(async () => {
|
|
788
811
|
try {
|
|
789
812
|
commitBoundaryState();
|
|
@@ -793,6 +816,7 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
793
816
|
}
|
|
794
817
|
flushSerializeBuffer();
|
|
795
818
|
done(ret.t[0]);
|
|
819
|
+
if (revealGroup) revealGroup.onResolved(id);
|
|
796
820
|
} catch (err) {
|
|
797
821
|
finalizeError(err);
|
|
798
822
|
}
|
|
@@ -884,7 +908,98 @@ function Errored(props) {
|
|
|
884
908
|
function Loading(props) {
|
|
885
909
|
return createLoadingBoundary(() => props.children, () => props.fallback);
|
|
886
910
|
}
|
|
911
|
+
function Reveal(props) {
|
|
912
|
+
const o = createOwner();
|
|
913
|
+
const id = o.id;
|
|
914
|
+
const together = !!props.together;
|
|
915
|
+
const collapsed = !!props.collapsed;
|
|
916
|
+
if (!sharedConfig.context?.async) {
|
|
917
|
+
const parent = getOwner();
|
|
918
|
+
const parentGroup = parent ? runWithOwner(parent, () => getContext(RevealGroupContext)) : null;
|
|
919
|
+
let collapsedByParent = false;
|
|
920
|
+
if (parentGroup) {
|
|
921
|
+
collapsedByParent = parentGroup.register(id);
|
|
922
|
+
if (collapsed || together) console.warn("Nested <Reveal> with collapsed/together won't coordinate correctly with renderToString. Use renderToStream for full support.");
|
|
923
|
+
}
|
|
924
|
+
let count = 0;
|
|
925
|
+
return runWithOwner(o, () => {
|
|
926
|
+
setContext(RevealGroupContext, {
|
|
927
|
+
id,
|
|
928
|
+
register(_key) {
|
|
929
|
+
count++;
|
|
930
|
+
if (collapsedByParent) return true;
|
|
931
|
+
return !together && collapsed && count > 1;
|
|
932
|
+
},
|
|
933
|
+
onResolved() {}
|
|
934
|
+
});
|
|
935
|
+
return props.children;
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
const ctx = sharedConfig.context;
|
|
939
|
+
const keys = [];
|
|
940
|
+
const resolved = new Set();
|
|
941
|
+
const composites = new Map();
|
|
942
|
+
let frontier = 0;
|
|
943
|
+
const parent = getOwner();
|
|
944
|
+
const parentGroup = parent ? runWithOwner(parent, () => getContext(RevealGroupContext)) : null;
|
|
945
|
+
let collapsedByParent = false;
|
|
946
|
+
if (parentGroup) {
|
|
947
|
+
collapsedByParent = parentGroup.register(id, {
|
|
948
|
+
onActivate: () => {
|
|
949
|
+
collapsedByParent = false;
|
|
950
|
+
advanceFrontier();
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
function notifyParentIfDone() {
|
|
955
|
+
if (parentGroup && resolved.size === keys.length) {
|
|
956
|
+
parentGroup.onResolved(id);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
function advanceFrontier() {
|
|
960
|
+
while (frontier < keys.length && resolved.has(keys[frontier])) {
|
|
961
|
+
if (!composites.has(keys[frontier])) ctx.revealFragments?.([keys[frontier]]);
|
|
962
|
+
frontier++;
|
|
963
|
+
}
|
|
964
|
+
if (frontier < keys.length) {
|
|
965
|
+
const activate = composites.get(keys[frontier]);
|
|
966
|
+
if (activate) activate();else if (!together && collapsed) ctx.revealFallbacks?.(keys.slice(frontier));
|
|
967
|
+
}
|
|
968
|
+
notifyParentIfDone();
|
|
969
|
+
}
|
|
970
|
+
return runWithOwner(o, () => {
|
|
971
|
+
setContext(RevealGroupContext, {
|
|
972
|
+
id,
|
|
973
|
+
register(key, options) {
|
|
974
|
+
keys.push(key);
|
|
975
|
+
if (options?.onActivate) composites.set(key, options.onActivate);
|
|
976
|
+
if (collapsedByParent) return true;
|
|
977
|
+
return !together && collapsed && keys.length > 1;
|
|
978
|
+
},
|
|
979
|
+
onResolved(key) {
|
|
980
|
+
resolved.add(key);
|
|
981
|
+
if (collapsedByParent) {
|
|
982
|
+
notifyParentIfDone();
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
if (together) {
|
|
986
|
+
if (resolved.size === keys.length) {
|
|
987
|
+
ctx.revealFragments?.(id);
|
|
988
|
+
notifyParentIfDone();
|
|
989
|
+
}
|
|
990
|
+
} else {
|
|
991
|
+
advanceFrontier();
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
});
|
|
995
|
+
const result = props.children;
|
|
996
|
+
if (parentGroup && keys.length === 0) {
|
|
997
|
+
parentGroup.onResolved(id);
|
|
998
|
+
}
|
|
999
|
+
return result;
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
887
1002
|
|
|
888
1003
|
const DEV = undefined;
|
|
889
1004
|
|
|
890
|
-
export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Show, Switch, action, children, createComponent, createContext, createDeepProxy, createEffect, createErrorBoundary, createLoadingBoundary, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createSignal, createStore, createTrackedEffect, createUniqueId, deep, enableHydration, flush, getObserver, isPending, isRefreshing, latest, lazy, mapArray, onSettled, reconcile, refresh, repeat, resolve, sharedConfig, ssrHandleError, ssrRunInScope, untrack, useContext };
|
|
1005
|
+
export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Reveal, Show, Switch, action, children, createComponent, createContext, createDeepProxy, createEffect, createErrorBoundary, createLoadingBoundary, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRevealOrder, createSignal, createStore, createTrackedEffect, createUniqueId, deep, enableHydration, flush, getObserver, isPending, isRefreshing, latest, lazy, mapArray, onSettled, reconcile, refresh, repeat, resolve, sharedConfig, ssrHandleError, ssrRunInScope, untrack, useContext };
|
package/dist/solid.cjs
CHANGED
|
@@ -654,6 +654,38 @@ function resumeBoundaryHydration(o, id, set) {
|
|
|
654
654
|
signals.flush();
|
|
655
655
|
checkHydrationComplete();
|
|
656
656
|
}
|
|
657
|
+
function initBoundaryResume(o, id) {
|
|
658
|
+
_pendingBoundaries++;
|
|
659
|
+
signals.onCleanup(() => {
|
|
660
|
+
if (!signals.isDisposed(o)) return;
|
|
661
|
+
sharedConfig.cleanupFragment?.(id);
|
|
662
|
+
});
|
|
663
|
+
const set = createBoundaryTrigger();
|
|
664
|
+
return [set, () => resumeBoundaryHydration(o, id, set)];
|
|
665
|
+
}
|
|
666
|
+
function waitAndResume(p, resume, assetPromise) {
|
|
667
|
+
const waitFor = assetPromise ? Promise.all([p, assetPromise]) : p;
|
|
668
|
+
waitFor.then(() => {
|
|
669
|
+
if (p && typeof p === "object") p.s = 1;
|
|
670
|
+
resume();
|
|
671
|
+
}, err => {
|
|
672
|
+
if (p && typeof p === "object") {
|
|
673
|
+
p.s = 2;
|
|
674
|
+
p.v = err;
|
|
675
|
+
}
|
|
676
|
+
resume();
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
function scheduleResumeAfterAssets(id, resume, assetPromise) {
|
|
680
|
+
sharedConfig.gather?.(id);
|
|
681
|
+
const doResume = () => queueMicrotask(resume);
|
|
682
|
+
if (assetPromise) {
|
|
683
|
+
assetPromise.then(doResume);
|
|
684
|
+
return true;
|
|
685
|
+
}
|
|
686
|
+
doResume();
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
657
689
|
function createLoadingBoundary(fn, fallback, options) {
|
|
658
690
|
if (!sharedConfig.hydrating) return signals.createLoadingBoundary(fn, fallback, options);
|
|
659
691
|
let settledSerializationResumeQueued = false;
|
|
@@ -673,41 +705,14 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
673
705
|
}
|
|
674
706
|
if (ref && typeof ref === "object" && ref.s === 1 && p == null && !settledSerializationResumeQueued) {
|
|
675
707
|
settledSerializationResumeQueued = true;
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
if (!signals.isDisposed(o)) return;
|
|
679
|
-
sharedConfig.cleanupFragment?.(id);
|
|
680
|
-
});
|
|
681
|
-
const set = createBoundaryTrigger();
|
|
682
|
-
const scheduleResume = () => queueMicrotask(() => resumeBoundaryHydration(o, id, set));
|
|
683
|
-
if (assetPromise) {
|
|
684
|
-
assetPromise.then(scheduleResume);
|
|
685
|
-
return undefined;
|
|
686
|
-
}
|
|
687
|
-
scheduleResume();
|
|
708
|
+
const [, resume] = initBoundaryResume(o, id);
|
|
709
|
+
if (scheduleResumeAfterAssets(id, resume, assetPromise)) return undefined;
|
|
688
710
|
return fallback();
|
|
689
711
|
}
|
|
690
712
|
if (p) {
|
|
691
|
-
|
|
692
|
-
signals.onCleanup(() => {
|
|
693
|
-
if (!signals.isDisposed(o)) return;
|
|
694
|
-
sharedConfig.cleanupFragment?.(id);
|
|
695
|
-
});
|
|
696
|
-
const set = createBoundaryTrigger();
|
|
713
|
+
const [set, resume] = initBoundaryResume(o, id);
|
|
697
714
|
if (p !== "$$f") {
|
|
698
|
-
|
|
699
|
-
waitFor.then(() => {
|
|
700
|
-
if (p && typeof p === "object") {
|
|
701
|
-
p.s = 1;
|
|
702
|
-
}
|
|
703
|
-
resumeBoundaryHydration(o, id, set);
|
|
704
|
-
}, err => {
|
|
705
|
-
if (p && typeof p === "object") {
|
|
706
|
-
p.s = 2;
|
|
707
|
-
p.v = err;
|
|
708
|
-
}
|
|
709
|
-
resumeBoundaryHydration(o, id, set);
|
|
710
|
-
});
|
|
715
|
+
waitAndResume(p, resume, assetPromise);
|
|
711
716
|
} else {
|
|
712
717
|
const afterAssets = () => {
|
|
713
718
|
_pendingBoundaries--;
|
|
@@ -719,10 +724,20 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
719
724
|
return fallback();
|
|
720
725
|
}
|
|
721
726
|
}
|
|
727
|
+
if (sharedConfig.hydrating && sharedConfig.has(id + "_fr") && !settledSerializationResumeQueued) {
|
|
728
|
+
settledSerializationResumeQueued = true;
|
|
729
|
+
const fr = sharedConfig.load(id + "_fr");
|
|
730
|
+
const [, resume] = initBoundaryResume(o, id);
|
|
731
|
+
if (fr && typeof fr === "object" && (fr.s === 1 || fr.s === 2)) {
|
|
732
|
+
if (scheduleResumeAfterAssets(id, resume, assetPromise)) return undefined;
|
|
733
|
+
return fallback();
|
|
734
|
+
}
|
|
735
|
+
waitAndResume(fr, resume, assetPromise);
|
|
736
|
+
return fallback();
|
|
737
|
+
}
|
|
722
738
|
if (assetPromise && !sharedConfig.has(id)) {
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
assetPromise.then(() => resumeBoundaryHydration(o, id, set));
|
|
739
|
+
const [, resume] = initBoundaryResume(o, id);
|
|
740
|
+
assetPromise.then(resume);
|
|
726
741
|
return undefined;
|
|
727
742
|
}
|
|
728
743
|
return signals.createLoadingBoundary(fn, fallback, options);
|
|
@@ -855,6 +870,12 @@ function Loading(props) {
|
|
|
855
870
|
} : undefined;
|
|
856
871
|
return createLoadingBoundary(() => props.children, () => props.fallback, onOpt);
|
|
857
872
|
}
|
|
873
|
+
function Reveal(props) {
|
|
874
|
+
return signals.createRevealOrder(() => props.children, {
|
|
875
|
+
together: () => !!props.together,
|
|
876
|
+
collapsed: () => !!props.collapsed
|
|
877
|
+
});
|
|
878
|
+
}
|
|
858
879
|
|
|
859
880
|
function ssrHandleError() {}
|
|
860
881
|
function ssrRunInScope() {}
|
|
@@ -888,6 +909,10 @@ Object.defineProperty(exports, "createReaction", {
|
|
|
888
909
|
enumerable: true,
|
|
889
910
|
get: function () { return signals.createReaction; }
|
|
890
911
|
});
|
|
912
|
+
Object.defineProperty(exports, "createRevealOrder", {
|
|
913
|
+
enumerable: true,
|
|
914
|
+
get: function () { return signals.createRevealOrder; }
|
|
915
|
+
});
|
|
891
916
|
Object.defineProperty(exports, "createRoot", {
|
|
892
917
|
enumerable: true,
|
|
893
918
|
get: function () { return signals.createRoot; }
|
|
@@ -928,6 +953,10 @@ Object.defineProperty(exports, "getOwner", {
|
|
|
928
953
|
enumerable: true,
|
|
929
954
|
get: function () { return signals.getOwner; }
|
|
930
955
|
});
|
|
956
|
+
Object.defineProperty(exports, "isDisposed", {
|
|
957
|
+
enumerable: true,
|
|
958
|
+
get: function () { return signals.isDisposed; }
|
|
959
|
+
});
|
|
931
960
|
Object.defineProperty(exports, "isEqual", {
|
|
932
961
|
enumerable: true,
|
|
933
962
|
get: function () { return signals.isEqual; }
|
|
@@ -1010,6 +1039,7 @@ exports.Match = Match;
|
|
|
1010
1039
|
exports.NoHydrateContext = NoHydrateContext;
|
|
1011
1040
|
exports.NoHydration = NoHydration;
|
|
1012
1041
|
exports.Repeat = Repeat;
|
|
1042
|
+
exports.Reveal = Reveal;
|
|
1013
1043
|
exports.Show = Show;
|
|
1014
1044
|
exports.Switch = Switch;
|
|
1015
1045
|
exports.children = children;
|
package/dist/solid.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, createOwner, runWithOwner, createEffect as createEffect$1, createErrorBoundary as createErrorBoundary$1, createLoadingBoundary as createLoadingBoundary$1, getOwner,
|
|
2
|
-
export { $PROXY, $REFRESH, $TRACK, NotReadyError, action, createOwner, createReaction, createRoot, createTrackedEffect, deep, enableExternalSource, enforceLoadingBoundary, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isPending, isRefreshing, isWrappable, latest, mapArray, merge, omit, onCleanup, onSettled, reconcile, refresh, repeat, resolve, runWithOwner, snapshot, storePath, untrack } from '@solidjs/signals';
|
|
1
|
+
import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, createOwner, runWithOwner, createEffect as createEffect$1, createErrorBoundary as createErrorBoundary$1, createLoadingBoundary as createLoadingBoundary$1, getOwner, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getNextChildId, onCleanup, isDisposed, peekNextChildId, clearSnapshots, flush, markSnapshotScope, untrack, mapArray, repeat, createRevealOrder } from '@solidjs/signals';
|
|
2
|
+
export { $PROXY, $REFRESH, $TRACK, NotReadyError, action, createOwner, createReaction, createRevealOrder, createRoot, createTrackedEffect, deep, enableExternalSource, enforceLoadingBoundary, flatten, flush, getNextChildId, getObserver, getOwner, isDisposed, isEqual, isPending, isRefreshing, isWrappable, latest, mapArray, merge, omit, onCleanup, onSettled, reconcile, refresh, repeat, resolve, runWithOwner, snapshot, storePath, untrack } from '@solidjs/signals';
|
|
3
3
|
|
|
4
4
|
const IS_DEV = false;
|
|
5
5
|
const $DEVCOMP = Symbol(0);
|
|
@@ -653,6 +653,38 @@ function resumeBoundaryHydration(o, id, set) {
|
|
|
653
653
|
flush();
|
|
654
654
|
checkHydrationComplete();
|
|
655
655
|
}
|
|
656
|
+
function initBoundaryResume(o, id) {
|
|
657
|
+
_pendingBoundaries++;
|
|
658
|
+
onCleanup(() => {
|
|
659
|
+
if (!isDisposed(o)) return;
|
|
660
|
+
sharedConfig.cleanupFragment?.(id);
|
|
661
|
+
});
|
|
662
|
+
const set = createBoundaryTrigger();
|
|
663
|
+
return [set, () => resumeBoundaryHydration(o, id, set)];
|
|
664
|
+
}
|
|
665
|
+
function waitAndResume(p, resume, assetPromise) {
|
|
666
|
+
const waitFor = assetPromise ? Promise.all([p, assetPromise]) : p;
|
|
667
|
+
waitFor.then(() => {
|
|
668
|
+
if (p && typeof p === "object") p.s = 1;
|
|
669
|
+
resume();
|
|
670
|
+
}, err => {
|
|
671
|
+
if (p && typeof p === "object") {
|
|
672
|
+
p.s = 2;
|
|
673
|
+
p.v = err;
|
|
674
|
+
}
|
|
675
|
+
resume();
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
function scheduleResumeAfterAssets(id, resume, assetPromise) {
|
|
679
|
+
sharedConfig.gather?.(id);
|
|
680
|
+
const doResume = () => queueMicrotask(resume);
|
|
681
|
+
if (assetPromise) {
|
|
682
|
+
assetPromise.then(doResume);
|
|
683
|
+
return true;
|
|
684
|
+
}
|
|
685
|
+
doResume();
|
|
686
|
+
return false;
|
|
687
|
+
}
|
|
656
688
|
function createLoadingBoundary(fn, fallback, options) {
|
|
657
689
|
if (!sharedConfig.hydrating) return createLoadingBoundary$1(fn, fallback, options);
|
|
658
690
|
let settledSerializationResumeQueued = false;
|
|
@@ -672,41 +704,14 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
672
704
|
}
|
|
673
705
|
if (ref && typeof ref === "object" && ref.s === 1 && p == null && !settledSerializationResumeQueued) {
|
|
674
706
|
settledSerializationResumeQueued = true;
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
if (!isDisposed(o)) return;
|
|
678
|
-
sharedConfig.cleanupFragment?.(id);
|
|
679
|
-
});
|
|
680
|
-
const set = createBoundaryTrigger();
|
|
681
|
-
const scheduleResume = () => queueMicrotask(() => resumeBoundaryHydration(o, id, set));
|
|
682
|
-
if (assetPromise) {
|
|
683
|
-
assetPromise.then(scheduleResume);
|
|
684
|
-
return undefined;
|
|
685
|
-
}
|
|
686
|
-
scheduleResume();
|
|
707
|
+
const [, resume] = initBoundaryResume(o, id);
|
|
708
|
+
if (scheduleResumeAfterAssets(id, resume, assetPromise)) return undefined;
|
|
687
709
|
return fallback();
|
|
688
710
|
}
|
|
689
711
|
if (p) {
|
|
690
|
-
|
|
691
|
-
onCleanup(() => {
|
|
692
|
-
if (!isDisposed(o)) return;
|
|
693
|
-
sharedConfig.cleanupFragment?.(id);
|
|
694
|
-
});
|
|
695
|
-
const set = createBoundaryTrigger();
|
|
712
|
+
const [set, resume] = initBoundaryResume(o, id);
|
|
696
713
|
if (p !== "$$f") {
|
|
697
|
-
|
|
698
|
-
waitFor.then(() => {
|
|
699
|
-
if (p && typeof p === "object") {
|
|
700
|
-
p.s = 1;
|
|
701
|
-
}
|
|
702
|
-
resumeBoundaryHydration(o, id, set);
|
|
703
|
-
}, err => {
|
|
704
|
-
if (p && typeof p === "object") {
|
|
705
|
-
p.s = 2;
|
|
706
|
-
p.v = err;
|
|
707
|
-
}
|
|
708
|
-
resumeBoundaryHydration(o, id, set);
|
|
709
|
-
});
|
|
714
|
+
waitAndResume(p, resume, assetPromise);
|
|
710
715
|
} else {
|
|
711
716
|
const afterAssets = () => {
|
|
712
717
|
_pendingBoundaries--;
|
|
@@ -718,10 +723,20 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
718
723
|
return fallback();
|
|
719
724
|
}
|
|
720
725
|
}
|
|
726
|
+
if (sharedConfig.hydrating && sharedConfig.has(id + "_fr") && !settledSerializationResumeQueued) {
|
|
727
|
+
settledSerializationResumeQueued = true;
|
|
728
|
+
const fr = sharedConfig.load(id + "_fr");
|
|
729
|
+
const [, resume] = initBoundaryResume(o, id);
|
|
730
|
+
if (fr && typeof fr === "object" && (fr.s === 1 || fr.s === 2)) {
|
|
731
|
+
if (scheduleResumeAfterAssets(id, resume, assetPromise)) return undefined;
|
|
732
|
+
return fallback();
|
|
733
|
+
}
|
|
734
|
+
waitAndResume(fr, resume, assetPromise);
|
|
735
|
+
return fallback();
|
|
736
|
+
}
|
|
721
737
|
if (assetPromise && !sharedConfig.has(id)) {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
assetPromise.then(() => resumeBoundaryHydration(o, id, set));
|
|
738
|
+
const [, resume] = initBoundaryResume(o, id);
|
|
739
|
+
assetPromise.then(resume);
|
|
725
740
|
return undefined;
|
|
726
741
|
}
|
|
727
742
|
return createLoadingBoundary$1(fn, fallback, options);
|
|
@@ -854,9 +869,15 @@ function Loading(props) {
|
|
|
854
869
|
} : undefined;
|
|
855
870
|
return createLoadingBoundary(() => props.children, () => props.fallback, onOpt);
|
|
856
871
|
}
|
|
872
|
+
function Reveal(props) {
|
|
873
|
+
return createRevealOrder(() => props.children, {
|
|
874
|
+
together: () => !!props.together,
|
|
875
|
+
collapsed: () => !!props.collapsed
|
|
876
|
+
});
|
|
877
|
+
}
|
|
857
878
|
|
|
858
879
|
function ssrHandleError() {}
|
|
859
880
|
function ssrRunInScope() {}
|
|
860
881
|
const DEV = undefined;
|
|
861
882
|
|
|
862
|
-
export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Show, Switch, children, createComponent, createContext, createEffect, createErrorBoundary, createLoadingBoundary, createMemo, createOptimistic, createOptimisticStore, createProjection, createRenderEffect, createSignal, createStore, createUniqueId, enableHydration, lazy, sharedConfig, ssrHandleError, ssrRunInScope, useContext };
|
|
883
|
+
export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Reveal, Show, Switch, children, createComponent, createContext, createEffect, createErrorBoundary, createLoadingBoundary, createMemo, createOptimistic, createOptimisticStore, createProjection, createRenderEffect, createSignal, createStore, createUniqueId, enableHydration, lazy, sharedConfig, ssrHandleError, ssrRunInScope, useContext };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-js",
|
|
3
3
|
"description": "A declarative JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.6",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"performance"
|
|
80
80
|
],
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@solidjs/signals": "^0.13.
|
|
82
|
+
"@solidjs/signals": "^0.13.11",
|
|
83
83
|
"csstype": "^3.1.0",
|
|
84
84
|
"seroval": "~1.5.0",
|
|
85
85
|
"seroval-plugins": "~1.5.0"
|
package/types/client/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Accessor,
|
|
1
|
+
import type { Accessor, EffectOptions } from "@solidjs/signals";
|
|
2
2
|
import type { JSX } from "../jsx.js";
|
|
3
3
|
import { FlowComponent } from "./component.js";
|
|
4
4
|
export declare const IS_DEV: string | boolean;
|
|
@@ -56,10 +56,3 @@ export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
|
56
56
|
*/
|
|
57
57
|
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
58
58
|
export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
|
|
59
|
-
interface SourceMapValue {
|
|
60
|
-
value: unknown;
|
|
61
|
-
name?: string;
|
|
62
|
-
graph?: Owner;
|
|
63
|
-
}
|
|
64
|
-
export declare function registerGraph(value: SourceMapValue): void;
|
|
65
|
-
export {};
|
package/types/client/flow.d.ts
CHANGED
|
@@ -117,4 +117,26 @@ export declare function Loading(props: {
|
|
|
117
117
|
on?: any;
|
|
118
118
|
children: JSX.Element;
|
|
119
119
|
}): JSX.Element;
|
|
120
|
+
/**
|
|
121
|
+
* Coordinates the reveal timing of sibling `<Loading>` boundaries.
|
|
122
|
+
*
|
|
123
|
+
* - **Sequential** (default): boundaries reveal in DOM order as each resolves.
|
|
124
|
+
* - **Together** (`together`): all boundaries wait until the group is ready, then reveal at once.
|
|
125
|
+
* - **Collapsed** (`collapsed`, sequential only): only the frontier boundary shows its fallback;
|
|
126
|
+
* later boundaries produce nothing until their turn.
|
|
127
|
+
*
|
|
128
|
+
* ```typescript
|
|
129
|
+
* <Reveal>
|
|
130
|
+
* <Loading fallback={<Skeleton />}><ProfileHeader /></Loading>
|
|
131
|
+
* <Loading fallback={<Skeleton />}><Posts /></Loading>
|
|
132
|
+
* </Reveal>
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @description https://docs.solidjs.com/reference/components/reveal
|
|
136
|
+
*/
|
|
137
|
+
export declare function Reveal(props: {
|
|
138
|
+
together?: boolean;
|
|
139
|
+
collapsed?: boolean;
|
|
140
|
+
children: JSX.Element;
|
|
141
|
+
}): JSX.Element;
|
|
120
142
|
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { $PROXY, $REFRESH, $TRACK, action, createOwner, createReaction, createRoot, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, enableExternalSource, enforceLoadingBoundary, snapshot, storePath, untrack } from "@solidjs/signals";
|
|
1
|
+
export { $PROXY, $REFRESH, $TRACK, action, createOwner, createReaction, createRevealOrder, createRoot, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isDisposed, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, enableExternalSource, enforceLoadingBoundary, snapshot, storePath, untrack } from "@solidjs/signals";
|
|
2
2
|
export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, ExternalSource, ExternalSourceConfig, ExternalSourceFactory, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals";
|
|
3
3
|
export { $DEVCOMP, children, createContext, useContext } from "./client/core.js";
|
|
4
4
|
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./client/core.js";
|
|
@@ -10,11 +10,8 @@ export declare function ssrRunInScope(): void;
|
|
|
10
10
|
import type { JSX } from "./jsx.js";
|
|
11
11
|
type JSXElement = JSX.Element;
|
|
12
12
|
export type { JSXElement, JSX };
|
|
13
|
-
import {
|
|
14
|
-
export declare const DEV:
|
|
15
|
-
readonly hooks: {};
|
|
16
|
-
readonly registerGraph: typeof registerGraph;
|
|
17
|
-
} | undefined;
|
|
13
|
+
import { type Dev } from "@solidjs/signals";
|
|
14
|
+
export declare const DEV: Dev | undefined;
|
|
18
15
|
declare global {
|
|
19
16
|
var Solid$$: boolean;
|
|
20
17
|
}
|