solid-js 1.6.10 → 1.6.12
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/LICENSE +1 -1
- package/dist/dev.cjs +20 -10
- package/dist/dev.js +20 -10
- package/dist/server.cjs +3 -4
- package/dist/server.js +3 -4
- package/dist/solid.cjs +18 -8
- package/dist/solid.js +18 -8
- package/h/jsx-runtime/dist/jsx.cjs +6 -3
- package/h/jsx-runtime/dist/jsx.js +5 -2
- package/h/jsx-runtime/types/index.d.ts +6 -2
- package/h/jsx-runtime/types/jsx.d.ts +2 -0
- package/html/dist/html.cjs +7 -3
- package/html/dist/html.js +7 -3
- package/package.json +3 -2
- package/store/dist/dev.cjs +2 -5
- package/store/dist/dev.js +2 -5
- package/store/dist/store.cjs +2 -5
- package/store/dist/store.js +2 -5
- package/store/types/modifiers.d.ts +1 -1
- package/store/types/server.d.ts +2 -2
- package/store/types/store.d.ts +23 -21
- package/types/index.d.ts +1 -1
- package/types/jsx.d.ts +2 -0
- package/types/reactive/array.d.ts +23 -0
- package/types/reactive/observable.d.ts +1 -1
- package/types/reactive/signal.d.ts +54 -31
- package/types/render/component.d.ts +18 -18
- package/types/render/flow.d.ts +1 -1
- package/types/render/hydration.d.ts +2 -2
- package/types/server/reactive.d.ts +7 -7
- package/types/server/rendering.d.ts +20 -20
- package/web/dist/dev.cjs +31 -25
- package/web/dist/dev.js +32 -27
- package/web/dist/server.cjs +10 -1
- package/web/dist/server.js +10 -2
- package/web/dist/web.cjs +38 -26
- package/web/dist/web.js +39 -28
- package/web/types/index.d.ts +3 -2
- package/web/types/server-mock.d.ts +1 -1
package/web/dist/dev.cjs
CHANGED
|
@@ -529,6 +529,7 @@ function escape(html) {}
|
|
|
529
529
|
function ssrSpread(props, isSVG, skipChildren) {}
|
|
530
530
|
|
|
531
531
|
const isServer = false;
|
|
532
|
+
const isDev = true;
|
|
532
533
|
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
533
534
|
function createElement(tagName, isSVG = false) {
|
|
534
535
|
return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
|
|
@@ -542,37 +543,41 @@ function Portal(props) {
|
|
|
542
543
|
useShadow
|
|
543
544
|
} = props,
|
|
544
545
|
marker = document.createTextNode(""),
|
|
545
|
-
mount = props.mount || document.body
|
|
546
|
+
mount = () => props.mount || document.body,
|
|
547
|
+
content = solidJs.createMemo(renderPortal());
|
|
546
548
|
function renderPortal() {
|
|
547
549
|
if (solidJs.sharedConfig.context) {
|
|
548
550
|
const [s, set] = solidJs.createSignal(false);
|
|
549
|
-
|
|
551
|
+
solidJs.onMount(() => set(true));
|
|
550
552
|
return () => s() && props.children;
|
|
551
553
|
} else return () => props.children;
|
|
552
554
|
}
|
|
553
|
-
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
555
|
+
solidJs.createRenderEffect(() => {
|
|
556
|
+
const el = mount();
|
|
557
|
+
if (el instanceof HTMLHeadElement) {
|
|
558
|
+
const [clean, setClean] = solidJs.createSignal(false);
|
|
559
|
+
const cleanup = () => setClean(true);
|
|
560
|
+
solidJs.createRoot(dispose => insert(el, () => !clean() ? content() : dispose(), null));
|
|
561
|
+
solidJs.onCleanup(() => {
|
|
562
|
+
if (solidJs.sharedConfig.context) queueMicrotask(cleanup);else cleanup();
|
|
563
|
+
});
|
|
564
|
+
} else {
|
|
565
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
566
|
+
renderRoot = useShadow && container.attachShadow ? container.attachShadow({
|
|
567
|
+
mode: "open"
|
|
568
|
+
}) : container;
|
|
569
|
+
Object.defineProperty(container, "_$host", {
|
|
570
|
+
get() {
|
|
571
|
+
return marker.parentNode;
|
|
572
|
+
},
|
|
573
|
+
configurable: true
|
|
574
|
+
});
|
|
575
|
+
insert(renderRoot, content);
|
|
576
|
+
el.appendChild(container);
|
|
577
|
+
props.ref && props.ref(container);
|
|
578
|
+
solidJs.onCleanup(() => el.removeChild(container));
|
|
579
|
+
}
|
|
580
|
+
});
|
|
576
581
|
return marker;
|
|
577
582
|
}
|
|
578
583
|
function Dynamic(props) {
|
|
@@ -682,6 +687,7 @@ exports.getNextMatch = getNextMatch;
|
|
|
682
687
|
exports.hydrate = hydrate;
|
|
683
688
|
exports.innerHTML = innerHTML;
|
|
684
689
|
exports.insert = insert;
|
|
690
|
+
exports.isDev = isDev;
|
|
685
691
|
exports.isServer = isServer;
|
|
686
692
|
exports.render = render;
|
|
687
693
|
exports.renderToStream = renderToStream;
|
package/web/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRoot, createRenderEffect, sharedConfig, untrack, enableHydration, createSignal, onCleanup, splitProps,
|
|
1
|
+
import { createRoot, createRenderEffect, sharedConfig, untrack, enableHydration, createMemo, createSignal, onMount, onCleanup, splitProps, $DEVCOMP } from 'solid-js';
|
|
2
2
|
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, createMemo as memo, mergeProps, untrack } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
|
|
@@ -528,6 +528,7 @@ function escape(html) {}
|
|
|
528
528
|
function ssrSpread(props, isSVG, skipChildren) {}
|
|
529
529
|
|
|
530
530
|
const isServer = false;
|
|
531
|
+
const isDev = true;
|
|
531
532
|
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
532
533
|
function createElement(tagName, isSVG = false) {
|
|
533
534
|
return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
|
|
@@ -541,37 +542,41 @@ function Portal(props) {
|
|
|
541
542
|
useShadow
|
|
542
543
|
} = props,
|
|
543
544
|
marker = document.createTextNode(""),
|
|
544
|
-
mount = props.mount || document.body
|
|
545
|
+
mount = () => props.mount || document.body,
|
|
546
|
+
content = createMemo(renderPortal());
|
|
545
547
|
function renderPortal() {
|
|
546
548
|
if (sharedConfig.context) {
|
|
547
549
|
const [s, set] = createSignal(false);
|
|
548
|
-
|
|
550
|
+
onMount(() => set(true));
|
|
549
551
|
return () => s() && props.children;
|
|
550
552
|
} else return () => props.children;
|
|
551
553
|
}
|
|
552
|
-
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
554
|
+
createRenderEffect(() => {
|
|
555
|
+
const el = mount();
|
|
556
|
+
if (el instanceof HTMLHeadElement) {
|
|
557
|
+
const [clean, setClean] = createSignal(false);
|
|
558
|
+
const cleanup = () => setClean(true);
|
|
559
|
+
createRoot(dispose => insert(el, () => !clean() ? content() : dispose(), null));
|
|
560
|
+
onCleanup(() => {
|
|
561
|
+
if (sharedConfig.context) queueMicrotask(cleanup);else cleanup();
|
|
562
|
+
});
|
|
563
|
+
} else {
|
|
564
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
565
|
+
renderRoot = useShadow && container.attachShadow ? container.attachShadow({
|
|
566
|
+
mode: "open"
|
|
567
|
+
}) : container;
|
|
568
|
+
Object.defineProperty(container, "_$host", {
|
|
569
|
+
get() {
|
|
570
|
+
return marker.parentNode;
|
|
571
|
+
},
|
|
572
|
+
configurable: true
|
|
573
|
+
});
|
|
574
|
+
insert(renderRoot, content);
|
|
575
|
+
el.appendChild(container);
|
|
576
|
+
props.ref && props.ref(container);
|
|
577
|
+
onCleanup(() => el.removeChild(container));
|
|
578
|
+
}
|
|
579
|
+
});
|
|
575
580
|
return marker;
|
|
576
581
|
}
|
|
577
582
|
function Dynamic(props) {
|
|
@@ -594,4 +599,4 @@ function Dynamic(props) {
|
|
|
594
599
|
});
|
|
595
600
|
}
|
|
596
601
|
|
|
597
|
-
export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, style, template, use, voidFn as useAssets };
|
|
602
|
+
export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isDev, isServer, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, style, template, use, voidFn as useAssets };
|
package/web/dist/server.cjs
CHANGED
|
@@ -261,6 +261,7 @@ function toRefParam(index) {
|
|
|
261
261
|
return ref;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
+
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
264
265
|
const REPLACE_SCRIPT = `function $df(e,t,n,o,d){if(n=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)d=o.nextSibling,o.remove(),o=d;o.replaceWith(n.content)}n.remove(),_$HY.set(e,t),_$HY.fe(e)}`;
|
|
265
266
|
function renderToString(code, options = {}) {
|
|
266
267
|
let scripts = "";
|
|
@@ -522,13 +523,14 @@ function ssrStyle(value) {
|
|
|
522
523
|
}
|
|
523
524
|
function ssrElement(tag, props, children, needsId) {
|
|
524
525
|
let result = `<${tag}${needsId ? ssrHydrationKey() : ""} `;
|
|
526
|
+
const skipChildren = VOID_ELEMENTS.test(tag);
|
|
525
527
|
if (props == null) props = {};else if (typeof props === "function") props = props();
|
|
526
528
|
const keys = Object.keys(props);
|
|
527
529
|
let classResolved;
|
|
528
530
|
for (let i = 0; i < keys.length; i++) {
|
|
529
531
|
const prop = keys[i];
|
|
530
532
|
if (ChildProperties.has(prop)) {
|
|
531
|
-
if (children === undefined) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
533
|
+
if (children === undefined && !skipChildren) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
532
534
|
continue;
|
|
533
535
|
}
|
|
534
536
|
const value = props[prop];
|
|
@@ -548,6 +550,11 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
548
550
|
}
|
|
549
551
|
if (i !== keys.length - 1) result += " ";
|
|
550
552
|
}
|
|
553
|
+
if (skipChildren) {
|
|
554
|
+
return {
|
|
555
|
+
t: result + '/>'
|
|
556
|
+
};
|
|
557
|
+
}
|
|
551
558
|
return {
|
|
552
559
|
t: result + `>${resolveSSRNode(children)}</${tag}>`
|
|
553
560
|
};
|
|
@@ -777,6 +784,7 @@ function ssrSpread(props, isSVG, skipChildren) {
|
|
|
777
784
|
}
|
|
778
785
|
|
|
779
786
|
const isServer = true;
|
|
787
|
+
const isDev = false;
|
|
780
788
|
function render() {}
|
|
781
789
|
function hydrate() {}
|
|
782
790
|
function insert() {}
|
|
@@ -851,6 +859,7 @@ exports.getAssets = getAssets;
|
|
|
851
859
|
exports.getHydrationKey = getHydrationKey;
|
|
852
860
|
exports.hydrate = hydrate;
|
|
853
861
|
exports.insert = insert;
|
|
862
|
+
exports.isDev = isDev;
|
|
854
863
|
exports.isServer = isServer;
|
|
855
864
|
exports.pipeToNodeWritable = pipeToNodeWritable;
|
|
856
865
|
exports.pipeToWritable = pipeToWritable;
|
package/web/dist/server.js
CHANGED
|
@@ -260,6 +260,7 @@ function toRefParam(index) {
|
|
|
260
260
|
return ref;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
263
264
|
const REPLACE_SCRIPT = `function $df(e,t,n,o,d){if(n=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)d=o.nextSibling,o.remove(),o=d;o.replaceWith(n.content)}n.remove(),_$HY.set(e,t),_$HY.fe(e)}`;
|
|
264
265
|
function renderToString(code, options = {}) {
|
|
265
266
|
let scripts = "";
|
|
@@ -521,13 +522,14 @@ function ssrStyle(value) {
|
|
|
521
522
|
}
|
|
522
523
|
function ssrElement(tag, props, children, needsId) {
|
|
523
524
|
let result = `<${tag}${needsId ? ssrHydrationKey() : ""} `;
|
|
525
|
+
const skipChildren = VOID_ELEMENTS.test(tag);
|
|
524
526
|
if (props == null) props = {};else if (typeof props === "function") props = props();
|
|
525
527
|
const keys = Object.keys(props);
|
|
526
528
|
let classResolved;
|
|
527
529
|
for (let i = 0; i < keys.length; i++) {
|
|
528
530
|
const prop = keys[i];
|
|
529
531
|
if (ChildProperties.has(prop)) {
|
|
530
|
-
if (children === undefined) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
532
|
+
if (children === undefined && !skipChildren) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
531
533
|
continue;
|
|
532
534
|
}
|
|
533
535
|
const value = props[prop];
|
|
@@ -547,6 +549,11 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
547
549
|
}
|
|
548
550
|
if (i !== keys.length - 1) result += " ";
|
|
549
551
|
}
|
|
552
|
+
if (skipChildren) {
|
|
553
|
+
return {
|
|
554
|
+
t: result + '/>'
|
|
555
|
+
};
|
|
556
|
+
}
|
|
550
557
|
return {
|
|
551
558
|
t: result + `>${resolveSSRNode(children)}</${tag}>`
|
|
552
559
|
};
|
|
@@ -776,6 +783,7 @@ function ssrSpread(props, isSVG, skipChildren) {
|
|
|
776
783
|
}
|
|
777
784
|
|
|
778
785
|
const isServer = true;
|
|
786
|
+
const isDev = false;
|
|
779
787
|
function render() {}
|
|
780
788
|
function hydrate() {}
|
|
781
789
|
function insert() {}
|
|
@@ -796,4 +804,4 @@ function Portal(props) {
|
|
|
796
804
|
return "";
|
|
797
805
|
}
|
|
798
806
|
|
|
799
|
-
export { Assets, Dynamic, Hydration, HydrationScript, NoHydration, Portal, addEventListener, delegateEvents, escape, generateHydrationScript, getAssets, getHydrationKey, hydrate, insert, isServer, pipeToNodeWritable, pipeToWritable, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, stringify, useAssets };
|
|
807
|
+
export { Assets, Dynamic, Hydration, HydrationScript, NoHydration, Portal, addEventListener, delegateEvents, escape, generateHydrationScript, getAssets, getHydrationKey, hydrate, insert, isDev, isServer, pipeToNodeWritable, pipeToWritable, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, stringify, useAssets };
|
package/web/dist/web.cjs
CHANGED
|
@@ -101,6 +101,7 @@ function render(code, element, init, options = {}) {
|
|
|
101
101
|
function template(html, check, isSVG) {
|
|
102
102
|
const t = document.createElement("template");
|
|
103
103
|
t.innerHTML = html;
|
|
104
|
+
if (check && t.innerHTML.split("<").length - 1 !== check) throw `The browser resolved template HTML does not match JSX input:\n${t.innerHTML}\n\n${html}. Is your HTML properly formed?`;
|
|
104
105
|
let node = t.content.firstChild;
|
|
105
106
|
if (isSVG) node = node.firstChild;
|
|
106
107
|
return node;
|
|
@@ -246,6 +247,8 @@ function hydrate$1(code, element, options = {}) {
|
|
|
246
247
|
function getNextElement(template) {
|
|
247
248
|
let node, key;
|
|
248
249
|
if (!solidJs.sharedConfig.context || !(node = solidJs.sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
250
|
+
if (solidJs.sharedConfig.context) console.warn("Unable to find DOM nodes for hydration key:", key);
|
|
251
|
+
if (!template) throw new Error("Unrecoverable Hydration Mismatch. No template for key: " + key);
|
|
249
252
|
return template.cloneNode(true);
|
|
250
253
|
}
|
|
251
254
|
if (solidJs.sharedConfig.completed) solidJs.sharedConfig.completed.add(node);
|
|
@@ -435,7 +438,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
435
438
|
parent.appendChild(value);
|
|
436
439
|
} else parent.replaceChild(value, parent.firstChild);
|
|
437
440
|
current = value;
|
|
438
|
-
} else ;
|
|
441
|
+
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
439
442
|
return current;
|
|
440
443
|
}
|
|
441
444
|
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
@@ -526,6 +529,7 @@ function escape(html) {}
|
|
|
526
529
|
function ssrSpread(props, isSVG, skipChildren) {}
|
|
527
530
|
|
|
528
531
|
const isServer = false;
|
|
532
|
+
const isDev = false;
|
|
529
533
|
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
530
534
|
function createElement(tagName, isSVG = false) {
|
|
531
535
|
return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
|
|
@@ -539,37 +543,41 @@ function Portal(props) {
|
|
|
539
543
|
useShadow
|
|
540
544
|
} = props,
|
|
541
545
|
marker = document.createTextNode(""),
|
|
542
|
-
mount = props.mount || document.body
|
|
546
|
+
mount = () => props.mount || document.body,
|
|
547
|
+
content = solidJs.createMemo(renderPortal());
|
|
543
548
|
function renderPortal() {
|
|
544
549
|
if (solidJs.sharedConfig.context) {
|
|
545
550
|
const [s, set] = solidJs.createSignal(false);
|
|
546
|
-
|
|
551
|
+
solidJs.onMount(() => set(true));
|
|
547
552
|
return () => s() && props.children;
|
|
548
553
|
} else return () => props.children;
|
|
549
554
|
}
|
|
550
|
-
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
555
|
+
solidJs.createRenderEffect(() => {
|
|
556
|
+
const el = mount();
|
|
557
|
+
if (el instanceof HTMLHeadElement) {
|
|
558
|
+
const [clean, setClean] = solidJs.createSignal(false);
|
|
559
|
+
const cleanup = () => setClean(true);
|
|
560
|
+
solidJs.createRoot(dispose => insert(el, () => !clean() ? content() : dispose(), null));
|
|
561
|
+
solidJs.onCleanup(() => {
|
|
562
|
+
if (solidJs.sharedConfig.context) queueMicrotask(cleanup);else cleanup();
|
|
563
|
+
});
|
|
564
|
+
} else {
|
|
565
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
566
|
+
renderRoot = useShadow && container.attachShadow ? container.attachShadow({
|
|
567
|
+
mode: "open"
|
|
568
|
+
}) : container;
|
|
569
|
+
Object.defineProperty(container, "_$host", {
|
|
570
|
+
get() {
|
|
571
|
+
return marker.parentNode;
|
|
572
|
+
},
|
|
573
|
+
configurable: true
|
|
574
|
+
});
|
|
575
|
+
insert(renderRoot, content);
|
|
576
|
+
el.appendChild(container);
|
|
577
|
+
props.ref && props.ref(container);
|
|
578
|
+
solidJs.onCleanup(() => el.removeChild(container));
|
|
579
|
+
}
|
|
580
|
+
});
|
|
573
581
|
return marker;
|
|
574
582
|
}
|
|
575
583
|
function Dynamic(props) {
|
|
@@ -579,6 +587,9 @@ function Dynamic(props) {
|
|
|
579
587
|
const component = cached();
|
|
580
588
|
switch (typeof component) {
|
|
581
589
|
case "function":
|
|
590
|
+
Object.assign(component, {
|
|
591
|
+
[solidJs.$DEVCOMP]: true
|
|
592
|
+
});
|
|
582
593
|
return solidJs.untrack(() => component(others));
|
|
583
594
|
case "string":
|
|
584
595
|
const isSvg = SVGElements.has(component);
|
|
@@ -676,6 +687,7 @@ exports.getNextMatch = getNextMatch;
|
|
|
676
687
|
exports.hydrate = hydrate;
|
|
677
688
|
exports.innerHTML = innerHTML;
|
|
678
689
|
exports.insert = insert;
|
|
690
|
+
exports.isDev = isDev;
|
|
679
691
|
exports.isServer = isServer;
|
|
680
692
|
exports.render = render;
|
|
681
693
|
exports.renderToStream = renderToStream;
|
package/web/dist/web.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRoot, createRenderEffect, sharedConfig, untrack, enableHydration, createSignal, onCleanup, splitProps,
|
|
1
|
+
import { createRoot, createRenderEffect, sharedConfig, untrack, enableHydration, createMemo, createSignal, onMount, onCleanup, splitProps, $DEVCOMP } from 'solid-js';
|
|
2
2
|
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, createMemo as memo, mergeProps, untrack } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
|
|
@@ -100,6 +100,7 @@ function render(code, element, init, options = {}) {
|
|
|
100
100
|
function template(html, check, isSVG) {
|
|
101
101
|
const t = document.createElement("template");
|
|
102
102
|
t.innerHTML = html;
|
|
103
|
+
if (check && t.innerHTML.split("<").length - 1 !== check) throw `The browser resolved template HTML does not match JSX input:\n${t.innerHTML}\n\n${html}. Is your HTML properly formed?`;
|
|
103
104
|
let node = t.content.firstChild;
|
|
104
105
|
if (isSVG) node = node.firstChild;
|
|
105
106
|
return node;
|
|
@@ -245,6 +246,8 @@ function hydrate$1(code, element, options = {}) {
|
|
|
245
246
|
function getNextElement(template) {
|
|
246
247
|
let node, key;
|
|
247
248
|
if (!sharedConfig.context || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
249
|
+
if (sharedConfig.context) console.warn("Unable to find DOM nodes for hydration key:", key);
|
|
250
|
+
if (!template) throw new Error("Unrecoverable Hydration Mismatch. No template for key: " + key);
|
|
248
251
|
return template.cloneNode(true);
|
|
249
252
|
}
|
|
250
253
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
@@ -434,7 +437,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
434
437
|
parent.appendChild(value);
|
|
435
438
|
} else parent.replaceChild(value, parent.firstChild);
|
|
436
439
|
current = value;
|
|
437
|
-
} else ;
|
|
440
|
+
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
438
441
|
return current;
|
|
439
442
|
}
|
|
440
443
|
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
@@ -525,6 +528,7 @@ function escape(html) {}
|
|
|
525
528
|
function ssrSpread(props, isSVG, skipChildren) {}
|
|
526
529
|
|
|
527
530
|
const isServer = false;
|
|
531
|
+
const isDev = false;
|
|
528
532
|
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
529
533
|
function createElement(tagName, isSVG = false) {
|
|
530
534
|
return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
|
|
@@ -538,37 +542,41 @@ function Portal(props) {
|
|
|
538
542
|
useShadow
|
|
539
543
|
} = props,
|
|
540
544
|
marker = document.createTextNode(""),
|
|
541
|
-
mount = props.mount || document.body
|
|
545
|
+
mount = () => props.mount || document.body,
|
|
546
|
+
content = createMemo(renderPortal());
|
|
542
547
|
function renderPortal() {
|
|
543
548
|
if (sharedConfig.context) {
|
|
544
549
|
const [s, set] = createSignal(false);
|
|
545
|
-
|
|
550
|
+
onMount(() => set(true));
|
|
546
551
|
return () => s() && props.children;
|
|
547
552
|
} else return () => props.children;
|
|
548
553
|
}
|
|
549
|
-
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
554
|
+
createRenderEffect(() => {
|
|
555
|
+
const el = mount();
|
|
556
|
+
if (el instanceof HTMLHeadElement) {
|
|
557
|
+
const [clean, setClean] = createSignal(false);
|
|
558
|
+
const cleanup = () => setClean(true);
|
|
559
|
+
createRoot(dispose => insert(el, () => !clean() ? content() : dispose(), null));
|
|
560
|
+
onCleanup(() => {
|
|
561
|
+
if (sharedConfig.context) queueMicrotask(cleanup);else cleanup();
|
|
562
|
+
});
|
|
563
|
+
} else {
|
|
564
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
565
|
+
renderRoot = useShadow && container.attachShadow ? container.attachShadow({
|
|
566
|
+
mode: "open"
|
|
567
|
+
}) : container;
|
|
568
|
+
Object.defineProperty(container, "_$host", {
|
|
569
|
+
get() {
|
|
570
|
+
return marker.parentNode;
|
|
571
|
+
},
|
|
572
|
+
configurable: true
|
|
573
|
+
});
|
|
574
|
+
insert(renderRoot, content);
|
|
575
|
+
el.appendChild(container);
|
|
576
|
+
props.ref && props.ref(container);
|
|
577
|
+
onCleanup(() => el.removeChild(container));
|
|
578
|
+
}
|
|
579
|
+
});
|
|
572
580
|
return marker;
|
|
573
581
|
}
|
|
574
582
|
function Dynamic(props) {
|
|
@@ -578,6 +586,9 @@ function Dynamic(props) {
|
|
|
578
586
|
const component = cached();
|
|
579
587
|
switch (typeof component) {
|
|
580
588
|
case "function":
|
|
589
|
+
Object.assign(component, {
|
|
590
|
+
[$DEVCOMP]: true
|
|
591
|
+
});
|
|
581
592
|
return untrack(() => component(others));
|
|
582
593
|
case "string":
|
|
583
594
|
const isSvg = SVGElements.has(component);
|
|
@@ -588,4 +599,4 @@ function Dynamic(props) {
|
|
|
588
599
|
});
|
|
589
600
|
}
|
|
590
601
|
|
|
591
|
-
export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, style, template, use, voidFn as useAssets };
|
|
602
|
+
export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isDev, isServer, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, style, template, use, voidFn as useAssets };
|
package/web/types/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { JSX, Accessor, ComponentProps, ValidComponent } from "solid-js";
|
|
|
3
3
|
export * from "./client.js";
|
|
4
4
|
export { For, Show, Suspense, SuspenseList, Switch, Match, Index, ErrorBoundary, mergeProps } from "solid-js";
|
|
5
5
|
export * from "./server-mock.js";
|
|
6
|
-
export declare const isServer
|
|
6
|
+
export declare const isServer: boolean;
|
|
7
|
+
export declare const isDev: boolean;
|
|
7
8
|
export declare const hydrate: typeof hydrateCore;
|
|
8
9
|
/**
|
|
9
10
|
* renders components somewhere else in the DOM
|
|
@@ -21,7 +22,7 @@ export declare function Portal<T extends boolean = false, S extends boolean = fa
|
|
|
21
22
|
} : {}) & (S extends true ? SVGGElement : HTMLDivElement)) => void);
|
|
22
23
|
children: JSX.Element;
|
|
23
24
|
}): Text;
|
|
24
|
-
export
|
|
25
|
+
export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
25
26
|
[K in keyof P]: P[K];
|
|
26
27
|
} & {
|
|
27
28
|
component: T | undefined;
|
|
@@ -42,7 +42,7 @@ export declare function escape(html: string): string;
|
|
|
42
42
|
* @deprecated Replaced by ssrElement
|
|
43
43
|
*/
|
|
44
44
|
export declare function ssrSpread(props: any, isSVG: boolean, skipChildren: boolean): void;
|
|
45
|
-
export
|
|
45
|
+
export type LegacyResults = {
|
|
46
46
|
startWriting: () => void;
|
|
47
47
|
};
|
|
48
48
|
/**
|