solid-js 1.8.18 → 1.8.20
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 +34 -29
- package/dist/dev.js +47 -42
- package/dist/server.cjs +33 -11
- package/dist/server.js +34 -11
- package/dist/solid.cjs +34 -29
- package/dist/solid.js +44 -39
- package/package.json +3 -3
- package/types/jsx.d.ts +913 -862
- package/types/render/hydration.d.ts +2 -0
- package/types/server/rendering.d.ts +2 -0
- package/web/dist/dev.cjs +36 -21
- package/web/dist/dev.js +37 -24
- package/web/dist/server.cjs +4 -4
- package/web/dist/server.js +4 -4
- package/web/dist/web.cjs +34 -19
- package/web/dist/web.js +35 -22
package/web/dist/web.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRoot,
|
|
3
|
-
sharedConfig,
|
|
4
3
|
createRenderEffect,
|
|
5
4
|
untrack,
|
|
5
|
+
sharedConfig,
|
|
6
6
|
enableHydration,
|
|
7
7
|
getOwner,
|
|
8
8
|
createEffect,
|
|
@@ -595,21 +595,21 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
597
|
function setProperty(node, name, value) {
|
|
598
|
-
if (
|
|
598
|
+
if (isHydrating(node)) return;
|
|
599
599
|
node[name] = value;
|
|
600
600
|
}
|
|
601
601
|
function setAttribute(node, name, value) {
|
|
602
|
-
if (
|
|
602
|
+
if (isHydrating(node)) return;
|
|
603
603
|
if (value == null) node.removeAttribute(name);
|
|
604
604
|
else node.setAttribute(name, value);
|
|
605
605
|
}
|
|
606
606
|
function setAttributeNS(node, namespace, name, value) {
|
|
607
|
-
if (
|
|
607
|
+
if (isHydrating(node)) return;
|
|
608
608
|
if (value == null) node.removeAttributeNS(namespace, name);
|
|
609
609
|
else node.setAttributeNS(namespace, name, value);
|
|
610
610
|
}
|
|
611
611
|
function className(node, value) {
|
|
612
|
-
if (
|
|
612
|
+
if (isHydrating(node)) return;
|
|
613
613
|
if (value == null) node.removeAttribute("class");
|
|
614
614
|
else node.className = value;
|
|
615
615
|
}
|
|
@@ -671,9 +671,7 @@ function spread(node, props = {}, isSVG, skipChildren) {
|
|
|
671
671
|
() => (prevProps.children = insertExpression(node, props.children, prevProps.children))
|
|
672
672
|
);
|
|
673
673
|
}
|
|
674
|
-
createRenderEffect(() =>
|
|
675
|
-
typeof props.ref === "function" ? use(props.ref, node) : (props.ref = node)
|
|
676
|
-
);
|
|
674
|
+
createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
|
|
677
675
|
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
678
676
|
return prevProps;
|
|
679
677
|
}
|
|
@@ -717,20 +715,25 @@ function hydrate$1(code, element, options = {}) {
|
|
|
717
715
|
sharedConfig.events = globalThis._$HY.events;
|
|
718
716
|
sharedConfig.load = id => globalThis._$HY.r[id];
|
|
719
717
|
sharedConfig.has = id => id in globalThis._$HY.r;
|
|
718
|
+
sharedConfig.done = globalThis._$HY.done;
|
|
720
719
|
sharedConfig.gather = root => gatherHydratable(element, root);
|
|
721
720
|
sharedConfig.registry = new Map();
|
|
722
721
|
sharedConfig.context = {
|
|
723
722
|
id: options.renderId || "",
|
|
724
723
|
count: 0
|
|
725
724
|
};
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
725
|
+
try {
|
|
726
|
+
gatherHydratable(element, options.renderId);
|
|
727
|
+
return render(code, element, [...element.childNodes], options);
|
|
728
|
+
} finally {
|
|
729
|
+
sharedConfig.context = null;
|
|
730
|
+
}
|
|
730
731
|
}
|
|
731
732
|
function getNextElement(template) {
|
|
732
|
-
let node,
|
|
733
|
-
|
|
733
|
+
let node,
|
|
734
|
+
key,
|
|
735
|
+
hydrating = isHydrating();
|
|
736
|
+
if (!hydrating || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
|
|
734
737
|
return template();
|
|
735
738
|
}
|
|
736
739
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
@@ -745,7 +748,7 @@ function getNextMarker(start) {
|
|
|
745
748
|
let end = start,
|
|
746
749
|
count = 0,
|
|
747
750
|
current = [];
|
|
748
|
-
if (
|
|
751
|
+
if (isHydrating(start)) {
|
|
749
752
|
while (end) {
|
|
750
753
|
if (end.nodeType === 8) {
|
|
751
754
|
const v = end.nodeValue;
|
|
@@ -769,13 +772,20 @@ function runHydrationEvents() {
|
|
|
769
772
|
while (events.length) {
|
|
770
773
|
const [el, e] = events[0];
|
|
771
774
|
if (!completed.has(el)) return;
|
|
772
|
-
eventHandler(e);
|
|
773
775
|
events.shift();
|
|
776
|
+
eventHandler(e);
|
|
777
|
+
}
|
|
778
|
+
if (sharedConfig.done) {
|
|
779
|
+
sharedConfig.events = _$HY.events = null;
|
|
780
|
+
sharedConfig.completed = _$HY.completed = null;
|
|
774
781
|
}
|
|
775
782
|
});
|
|
776
783
|
sharedConfig.events.queued = true;
|
|
777
784
|
}
|
|
778
785
|
}
|
|
786
|
+
function isHydrating(node) {
|
|
787
|
+
return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
|
|
788
|
+
}
|
|
779
789
|
function toPropertyName(name) {
|
|
780
790
|
return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
|
|
781
791
|
}
|
|
@@ -822,7 +832,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
822
832
|
if (forceProp) {
|
|
823
833
|
prop = prop.slice(5);
|
|
824
834
|
isProp = true;
|
|
825
|
-
} else if (
|
|
835
|
+
} else if (isHydrating(node)) return value;
|
|
826
836
|
if (prop === "class" || prop === "className") className(node, value);
|
|
827
837
|
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
828
838
|
else node[propAlias || prop] = value;
|
|
@@ -834,6 +844,9 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
834
844
|
return value;
|
|
835
845
|
}
|
|
836
846
|
function eventHandler(e) {
|
|
847
|
+
if (sharedConfig.registry && sharedConfig.events) {
|
|
848
|
+
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
849
|
+
}
|
|
837
850
|
const key = `$$${e.type}`;
|
|
838
851
|
let node = (e.composedPath && e.composedPath()[0]) || e.target;
|
|
839
852
|
if (e.target !== node) {
|
|
@@ -860,7 +873,7 @@ function eventHandler(e) {
|
|
|
860
873
|
}
|
|
861
874
|
}
|
|
862
875
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
863
|
-
const hydrating =
|
|
876
|
+
const hydrating = isHydrating(parent);
|
|
864
877
|
if (hydrating) {
|
|
865
878
|
!current && (current = [...parent.childNodes]);
|
|
866
879
|
let cleaned = [];
|
|
@@ -912,9 +925,10 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
912
925
|
}
|
|
913
926
|
if (hydrating) {
|
|
914
927
|
if (!array.length) return current;
|
|
915
|
-
if (marker === undefined) return [...parent.childNodes];
|
|
928
|
+
if (marker === undefined) return (current = [...parent.childNodes]);
|
|
916
929
|
let node = array[0];
|
|
917
|
-
|
|
930
|
+
if (node.parentNode !== parent) return current;
|
|
931
|
+
const nodes = [node];
|
|
918
932
|
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
919
933
|
return (current = nodes);
|
|
920
934
|
}
|
|
@@ -1004,8 +1018,7 @@ function gatherHydratable(element, root) {
|
|
|
1004
1018
|
}
|
|
1005
1019
|
}
|
|
1006
1020
|
function getHydrationKey() {
|
|
1007
|
-
|
|
1008
|
-
return `${hydrate.id}${hydrate.count++}`;
|
|
1021
|
+
return sharedConfig.getNextContextId();
|
|
1009
1022
|
}
|
|
1010
1023
|
function NoHydration(props) {
|
|
1011
1024
|
return sharedConfig.context ? undefined : props.children;
|