@solidjs/web 2.0.0-beta.7 → 2.0.0-beta.9
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/README.md +27 -4
- package/dist/dev.cjs +79 -44
- package/dist/dev.js +79 -46
- package/dist/server.cjs +43 -29
- package/dist/server.js +42 -30
- package/dist/web.cjs +74 -39
- package/dist/web.js +74 -41
- package/package.json +6 -7
- package/storage/types/src/index.d.ts +81 -18
- package/storage/types/src/server-mock.d.ts +57 -0
- package/storage/types-cjs/src/index.d.cts +81 -18
- package/storage/types-cjs/src/server-mock.d.cts +57 -0
- package/types/client.d.ts +20 -9
- package/types/core.d.ts +2 -2
- package/types/index.d.ts +81 -18
- package/types/server-mock.d.ts +57 -0
- package/types/server.d.ts +23 -10
- package/types-cjs/client.d.cts +20 -9
- package/types-cjs/core.d.cts +2 -2
- package/types-cjs/index.d.cts +81 -18
- package/types-cjs/server-mock.d.cts +57 -0
- package/types-cjs/server.d.cts +23 -10
package/dist/server.cjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var solidJs = require('solid-js');
|
|
4
4
|
var seroval = require('seroval');
|
|
5
5
|
var web = require('seroval-plugins/web');
|
|
6
|
-
var signals = require('@solidjs/signals');
|
|
7
6
|
|
|
8
7
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
9
8
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
@@ -19,20 +18,24 @@ const Namespaces = {
|
|
|
19
18
|
xlink: "http://www.w3.org/1999/xlink",
|
|
20
19
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
21
20
|
};
|
|
21
|
+
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
22
|
+
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
22
23
|
const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input", "h1", "h2", "h3", "h4", "h5", "h6",
|
|
23
24
|
"webview",
|
|
24
25
|
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
25
26
|
|
|
26
|
-
const
|
|
27
|
+
const transparentOptions = {
|
|
27
28
|
transparent: true
|
|
28
|
-
}
|
|
29
|
-
const
|
|
30
|
-
transparent: true
|
|
31
|
-
|
|
29
|
+
};
|
|
30
|
+
const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectFn, options ? {
|
|
31
|
+
transparent: true,
|
|
32
|
+
...options
|
|
33
|
+
} : transparentOptions);
|
|
34
|
+
const memo = fn => solidJs.createMemo(() => fn());
|
|
32
35
|
|
|
33
|
-
const ES2017FLAG = seroval.Feature.AggregateError
|
|
34
|
-
|
|
35
|
-
const GLOBAL_IDENTIFIER =
|
|
36
|
+
const ES2017FLAG = seroval.Feature.AggregateError |
|
|
37
|
+
seroval.Feature.BigIntTypedArray;
|
|
38
|
+
const GLOBAL_IDENTIFIER = "_$HY.r";
|
|
36
39
|
function createSerializer({
|
|
37
40
|
onData,
|
|
38
41
|
onDone,
|
|
@@ -55,7 +58,7 @@ function createSerializer({
|
|
|
55
58
|
});
|
|
56
59
|
}
|
|
57
60
|
function getLocalHeaderScript(id) {
|
|
58
|
-
return seroval.getCrossReferenceHeader(id) +
|
|
61
|
+
return seroval.getCrossReferenceHeader(id) + ";";
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
function resolveAssets(moduleUrl, manifest) {
|
|
@@ -143,7 +146,7 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
143
146
|
if (manifest) context.resolveAssets = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
144
147
|
}
|
|
145
148
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
146
|
-
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(!(n=document.getElementById(e))||!(o=document.getElementById("pl-"+e)))return 0;for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)t=o.nextSibling,o.remove(),o=t;_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(e);return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return 0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1;return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)
|
|
149
|
+
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(!(n=document.getElementById(e))||!(o=document.getElementById("pl-"+e)))return 0;for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)t=o.nextSibling,o.remove(),o=t;_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(e);return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return 0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1;return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)$dfl(e[i])}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}`;
|
|
147
150
|
function renderToString(code, options = {}) {
|
|
148
151
|
const {
|
|
149
152
|
renderId = "",
|
|
@@ -248,8 +251,15 @@ function renderToStream(code, options = {}) {
|
|
|
248
251
|
onDone,
|
|
249
252
|
onError: options.onError
|
|
250
253
|
});
|
|
254
|
+
let rootAssetsSerialized = false;
|
|
255
|
+
const serializeRootAssets = () => {
|
|
256
|
+
if (rootAssetsSerialized) return;
|
|
257
|
+
rootAssetsSerialized = true;
|
|
258
|
+
serializeFragmentAssets("", tracking.boundaryModules, context);
|
|
259
|
+
};
|
|
251
260
|
const flushEnd = () => {
|
|
252
261
|
if (!registry.size) {
|
|
262
|
+
serializeRootAssets();
|
|
253
263
|
queue(() => queue(() => serializer.flush()));
|
|
254
264
|
}
|
|
255
265
|
};
|
|
@@ -493,7 +503,7 @@ function renderToStream(code, options = {}) {
|
|
|
493
503
|
if (url.endsWith(".css")) headStyles.add(url);
|
|
494
504
|
}
|
|
495
505
|
html = injectPreloadLinks(tracking.emittedAssets, html);
|
|
496
|
-
|
|
506
|
+
serializeRootAssets();
|
|
497
507
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
498
508
|
buffer.write(html);
|
|
499
509
|
tasks = "";
|
|
@@ -599,7 +609,7 @@ function ssrClassName(value) {
|
|
|
599
609
|
classValue = !!value[key];
|
|
600
610
|
if (!key || key === "undefined" || !classValue) continue;
|
|
601
611
|
i && (result += " ");
|
|
602
|
-
result += escape(key);
|
|
612
|
+
result += escape(key, true);
|
|
603
613
|
}
|
|
604
614
|
return result;
|
|
605
615
|
}
|
|
@@ -609,8 +619,8 @@ function ssrStyle(value) {
|
|
|
609
619
|
let result = "";
|
|
610
620
|
const k = Object.keys(value);
|
|
611
621
|
for (let i = 0; i < k.length; i++) {
|
|
612
|
-
const s = k[i];
|
|
613
|
-
const v = value[
|
|
622
|
+
const s = escape(k[i], true);
|
|
623
|
+
const v = value[k[i]];
|
|
614
624
|
if (v != undefined) {
|
|
615
625
|
if (i) result += ";";
|
|
616
626
|
const r = escape(v, true);
|
|
@@ -752,7 +762,7 @@ function generateHydrationScript({
|
|
|
752
762
|
eventNames = ["click", "input"],
|
|
753
763
|
nonce
|
|
754
764
|
} = {}) {
|
|
755
|
-
return `<script${nonce ? ` nonce="${nonce}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('",
|
|
765
|
+
return `<script${nonce ? ` nonce="${nonce}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:{},fe(){}});</script><!--xs-->`;
|
|
756
766
|
}
|
|
757
767
|
function queue(fn) {
|
|
758
768
|
return Promise.resolve().then(fn);
|
|
@@ -919,23 +929,25 @@ function notSup() {
|
|
|
919
929
|
|
|
920
930
|
const isServer = true;
|
|
921
931
|
const isDev = false;
|
|
922
|
-
function
|
|
932
|
+
function dynamic(source) {
|
|
923
933
|
const o = solidJs.getOwner();
|
|
924
934
|
if (o?.id != null) solidJs.getNextChildId(o);
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
if (
|
|
931
|
-
return
|
|
935
|
+
return props => {
|
|
936
|
+
const memoOwner = solidJs.createOwner();
|
|
937
|
+
return solidJs.runWithOwner(memoOwner, () => {
|
|
938
|
+
const comp = source(),
|
|
939
|
+
t = typeof comp;
|
|
940
|
+
if (comp) {
|
|
941
|
+
if (t === "function") return comp(props);else if (t === "string") {
|
|
942
|
+
return ssrElement(comp, props, undefined, true);
|
|
943
|
+
}
|
|
932
944
|
}
|
|
933
|
-
}
|
|
934
|
-
}
|
|
945
|
+
});
|
|
946
|
+
};
|
|
935
947
|
}
|
|
936
948
|
function Dynamic(props) {
|
|
937
|
-
const
|
|
938
|
-
return
|
|
949
|
+
const Comp = dynamic(() => props.component);
|
|
950
|
+
return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
|
|
939
951
|
}
|
|
940
952
|
function Portal(props) {
|
|
941
953
|
throw new Error("Portal is not supported on the server");
|
|
@@ -1005,14 +1017,16 @@ exports.HydrationScript = HydrationScript;
|
|
|
1005
1017
|
exports.MathMLElements = MathMLElements;
|
|
1006
1018
|
exports.Namespaces = Namespaces;
|
|
1007
1019
|
exports.Portal = Portal;
|
|
1020
|
+
exports.RawTextElements = RawTextElements;
|
|
1008
1021
|
exports.RequestContext = RequestContext;
|
|
1009
1022
|
exports.SVGElements = SVGElements;
|
|
1023
|
+
exports.VoidElements = VoidElements;
|
|
1010
1024
|
exports.addEventListener = notSup;
|
|
1011
1025
|
exports.applyRef = applyRef;
|
|
1012
1026
|
exports.assign = notSup;
|
|
1013
1027
|
exports.className = notSup;
|
|
1014
|
-
exports.createDynamic = createDynamic;
|
|
1015
1028
|
exports.delegateEvents = notSup;
|
|
1029
|
+
exports.dynamic = dynamic;
|
|
1016
1030
|
exports.dynamicProperty = notSup;
|
|
1017
1031
|
exports.effect = effect;
|
|
1018
1032
|
exports.escape = escape;
|
package/dist/server.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, createComponent, omit, getOwner, getNextChildId, createOwner, runWithOwner } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, ssrRunInScope, untrack } from 'solid-js';
|
|
3
3
|
import { Serializer, Feature, getCrossReferenceHeader } from 'seroval';
|
|
4
4
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
5
|
-
import { createMemo } from '@solidjs/signals';
|
|
6
5
|
|
|
7
6
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
8
7
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
@@ -18,20 +17,24 @@ const Namespaces = {
|
|
|
18
17
|
xlink: "http://www.w3.org/1999/xlink",
|
|
19
18
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
20
19
|
};
|
|
20
|
+
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
21
|
+
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
21
22
|
const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input", "h1", "h2", "h3", "h4", "h5", "h6",
|
|
22
23
|
"webview",
|
|
23
24
|
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
+
const transparentOptions = {
|
|
26
27
|
transparent: true
|
|
27
|
-
}
|
|
28
|
-
const
|
|
29
|
-
transparent: true
|
|
30
|
-
|
|
28
|
+
};
|
|
29
|
+
const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
|
|
30
|
+
transparent: true,
|
|
31
|
+
...options
|
|
32
|
+
} : transparentOptions);
|
|
33
|
+
const memo = fn => createMemo(() => fn());
|
|
31
34
|
|
|
32
|
-
const ES2017FLAG = Feature.AggregateError
|
|
33
|
-
|
|
34
|
-
const GLOBAL_IDENTIFIER =
|
|
35
|
+
const ES2017FLAG = Feature.AggregateError |
|
|
36
|
+
Feature.BigIntTypedArray;
|
|
37
|
+
const GLOBAL_IDENTIFIER = "_$HY.r";
|
|
35
38
|
function createSerializer({
|
|
36
39
|
onData,
|
|
37
40
|
onDone,
|
|
@@ -54,7 +57,7 @@ function createSerializer({
|
|
|
54
57
|
});
|
|
55
58
|
}
|
|
56
59
|
function getLocalHeaderScript(id) {
|
|
57
|
-
return getCrossReferenceHeader(id) +
|
|
60
|
+
return getCrossReferenceHeader(id) + ";";
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
function resolveAssets(moduleUrl, manifest) {
|
|
@@ -142,7 +145,7 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
142
145
|
if (manifest) context.resolveAssets = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
143
146
|
}
|
|
144
147
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
145
|
-
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(!(n=document.getElementById(e))||!(o=document.getElementById("pl-"+e)))return 0;for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)t=o.nextSibling,o.remove(),o=t;_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(e);return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return 0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1;return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)
|
|
148
|
+
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(!(n=document.getElementById(e))||!(o=document.getElementById("pl-"+e)))return 0;for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)t=o.nextSibling,o.remove(),o=t;_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(e);return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return 0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1;return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)$dfl(e[i])}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}`;
|
|
146
149
|
function renderToString(code, options = {}) {
|
|
147
150
|
const {
|
|
148
151
|
renderId = "",
|
|
@@ -247,8 +250,15 @@ function renderToStream(code, options = {}) {
|
|
|
247
250
|
onDone,
|
|
248
251
|
onError: options.onError
|
|
249
252
|
});
|
|
253
|
+
let rootAssetsSerialized = false;
|
|
254
|
+
const serializeRootAssets = () => {
|
|
255
|
+
if (rootAssetsSerialized) return;
|
|
256
|
+
rootAssetsSerialized = true;
|
|
257
|
+
serializeFragmentAssets("", tracking.boundaryModules, context);
|
|
258
|
+
};
|
|
250
259
|
const flushEnd = () => {
|
|
251
260
|
if (!registry.size) {
|
|
261
|
+
serializeRootAssets();
|
|
252
262
|
queue(() => queue(() => serializer.flush()));
|
|
253
263
|
}
|
|
254
264
|
};
|
|
@@ -492,7 +502,7 @@ function renderToStream(code, options = {}) {
|
|
|
492
502
|
if (url.endsWith(".css")) headStyles.add(url);
|
|
493
503
|
}
|
|
494
504
|
html = injectPreloadLinks(tracking.emittedAssets, html);
|
|
495
|
-
|
|
505
|
+
serializeRootAssets();
|
|
496
506
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
497
507
|
buffer.write(html);
|
|
498
508
|
tasks = "";
|
|
@@ -598,7 +608,7 @@ function ssrClassName(value) {
|
|
|
598
608
|
classValue = !!value[key];
|
|
599
609
|
if (!key || key === "undefined" || !classValue) continue;
|
|
600
610
|
i && (result += " ");
|
|
601
|
-
result += escape(key);
|
|
611
|
+
result += escape(key, true);
|
|
602
612
|
}
|
|
603
613
|
return result;
|
|
604
614
|
}
|
|
@@ -608,8 +618,8 @@ function ssrStyle(value) {
|
|
|
608
618
|
let result = "";
|
|
609
619
|
const k = Object.keys(value);
|
|
610
620
|
for (let i = 0; i < k.length; i++) {
|
|
611
|
-
const s = k[i];
|
|
612
|
-
const v = value[
|
|
621
|
+
const s = escape(k[i], true);
|
|
622
|
+
const v = value[k[i]];
|
|
613
623
|
if (v != undefined) {
|
|
614
624
|
if (i) result += ";";
|
|
615
625
|
const r = escape(v, true);
|
|
@@ -751,7 +761,7 @@ function generateHydrationScript({
|
|
|
751
761
|
eventNames = ["click", "input"],
|
|
752
762
|
nonce
|
|
753
763
|
} = {}) {
|
|
754
|
-
return `<script${nonce ? ` nonce="${nonce}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('",
|
|
764
|
+
return `<script${nonce ? ` nonce="${nonce}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:{},fe(){}});</script><!--xs-->`;
|
|
755
765
|
}
|
|
756
766
|
function queue(fn) {
|
|
757
767
|
return Promise.resolve().then(fn);
|
|
@@ -918,26 +928,28 @@ function notSup() {
|
|
|
918
928
|
|
|
919
929
|
const isServer = true;
|
|
920
930
|
const isDev = false;
|
|
921
|
-
function
|
|
931
|
+
function dynamic(source) {
|
|
922
932
|
const o = getOwner();
|
|
923
933
|
if (o?.id != null) getNextChildId(o);
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
if (
|
|
930
|
-
return
|
|
934
|
+
return props => {
|
|
935
|
+
const memoOwner = createOwner();
|
|
936
|
+
return runWithOwner(memoOwner, () => {
|
|
937
|
+
const comp = source(),
|
|
938
|
+
t = typeof comp;
|
|
939
|
+
if (comp) {
|
|
940
|
+
if (t === "function") return comp(props);else if (t === "string") {
|
|
941
|
+
return ssrElement(comp, props, undefined, true);
|
|
942
|
+
}
|
|
931
943
|
}
|
|
932
|
-
}
|
|
933
|
-
}
|
|
944
|
+
});
|
|
945
|
+
};
|
|
934
946
|
}
|
|
935
947
|
function Dynamic(props) {
|
|
936
|
-
const
|
|
937
|
-
return
|
|
948
|
+
const Comp = dynamic(() => props.component);
|
|
949
|
+
return createComponent(Comp, omit(props, "component"));
|
|
938
950
|
}
|
|
939
951
|
function Portal(props) {
|
|
940
952
|
throw new Error("Portal is not supported on the server");
|
|
941
953
|
}
|
|
942
954
|
|
|
943
|
-
export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RequestContext, SVGElements, notSup as addEventListener, applyRef, notSup as assign, notSup as className,
|
|
955
|
+
export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, notSup as addEventListener, applyRef, notSup as assign, notSup as className, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isServer, memo, mergeProps, notSup as render, renderToStream, renderToString, renderToStringAsync, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, useAssets };
|
package/dist/web.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var solidJs = require('solid-js');
|
|
4
|
-
var signals = require('@solidjs/signals');
|
|
5
4
|
|
|
6
5
|
const DOMWithState = {
|
|
7
6
|
INPUT: {
|
|
@@ -45,16 +44,20 @@ const Namespaces = {
|
|
|
45
44
|
xlink: "http://www.w3.org/1999/xlink",
|
|
46
45
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
47
46
|
};
|
|
47
|
+
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
48
|
+
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
48
49
|
const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input", "h1", "h2", "h3", "h4", "h5", "h6",
|
|
49
50
|
"webview",
|
|
50
51
|
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
51
52
|
|
|
52
|
-
const
|
|
53
|
+
const transparentOptions = {
|
|
53
54
|
transparent: true
|
|
54
|
-
}
|
|
55
|
-
const
|
|
56
|
-
transparent: true
|
|
57
|
-
|
|
55
|
+
};
|
|
56
|
+
const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectFn, options ? {
|
|
57
|
+
transparent: true,
|
|
58
|
+
...options
|
|
59
|
+
} : transparentOptions);
|
|
60
|
+
const memo = fn => solidJs.createMemo(() => fn());
|
|
58
61
|
|
|
59
62
|
function reconcileArrays(parentNode, a, b) {
|
|
60
63
|
let bLength = b.length,
|
|
@@ -114,12 +117,18 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
const $$EVENTS = "_$DX_DELEGATE";
|
|
120
|
+
const INNER_OWNED = {};
|
|
117
121
|
function render$1(code, element, init, options = {}) {
|
|
118
122
|
const renderRoot = getChildRoot(element);
|
|
119
123
|
let disposer;
|
|
120
124
|
solidJs.createRoot(dispose => {
|
|
121
125
|
disposer = dispose;
|
|
122
|
-
element === document
|
|
126
|
+
if (element === document) {
|
|
127
|
+
solidJs.flatten(code);
|
|
128
|
+
} else {
|
|
129
|
+
const tree = code();
|
|
130
|
+
insert(element, () => tree, renderRoot.firstChild ? null : undefined, init, options.insertOptions);
|
|
131
|
+
}
|
|
123
132
|
}, {
|
|
124
133
|
id: options.renderId
|
|
125
134
|
});
|
|
@@ -164,7 +173,7 @@ function setAttribute(node, name, value) {
|
|
|
164
173
|
}
|
|
165
174
|
function setAttributeNS(node, namespace, name, value) {
|
|
166
175
|
if (isHydrating(node)) return;
|
|
167
|
-
if (value == null || value === false) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
176
|
+
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
168
177
|
}
|
|
169
178
|
function className(node, value, prev) {
|
|
170
179
|
if (isHydrating(node)) return;
|
|
@@ -216,7 +225,6 @@ function style(node, value, prev) {
|
|
|
216
225
|
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
217
226
|
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
218
227
|
prev || (prev = {});
|
|
219
|
-
value || (value = {});
|
|
220
228
|
let v, s;
|
|
221
229
|
for (s in value) {
|
|
222
230
|
v = value[s];
|
|
@@ -262,7 +270,7 @@ function ref(fn, element) {
|
|
|
262
270
|
const resolved = solidJs.untrack(fn);
|
|
263
271
|
solidJs.runWithOwner(null, () => applyRef(resolved, element));
|
|
264
272
|
}
|
|
265
|
-
function insert(parent, accessor, marker, initial) {
|
|
273
|
+
function insert(parent, accessor, marker, initial, options) {
|
|
266
274
|
const childRoot = getChildRoot(parent);
|
|
267
275
|
const multi = marker !== undefined;
|
|
268
276
|
if (multi && !initial) initial = [];
|
|
@@ -280,13 +288,25 @@ function insert(parent, accessor, marker, initial) {
|
|
|
280
288
|
accessor = normalize(accessor, initial, multi, true);
|
|
281
289
|
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
282
290
|
}
|
|
283
|
-
accessor = memo(accessor, true);
|
|
284
291
|
if (multi && initial.length === 0) {
|
|
285
292
|
const placeholder = document.createTextNode("");
|
|
286
293
|
childRoot.insertBefore(placeholder, marker);
|
|
287
294
|
initial = [placeholder];
|
|
288
295
|
}
|
|
289
|
-
|
|
296
|
+
let current = initial;
|
|
297
|
+
effect(() => {
|
|
298
|
+
const value = normalize(accessor(), current, multi, true);
|
|
299
|
+
if (typeof value !== "function") return value;
|
|
300
|
+
effect(() => normalize(value, current, multi), inner => {
|
|
301
|
+
insertExpression(parent, inner, current, marker);
|
|
302
|
+
current = inner;
|
|
303
|
+
}, options);
|
|
304
|
+
return INNER_OWNED;
|
|
305
|
+
}, value => {
|
|
306
|
+
if (value === INNER_OWNED) return;
|
|
307
|
+
insertExpression(parent, value, current, marker);
|
|
308
|
+
current = value;
|
|
309
|
+
}, options);
|
|
290
310
|
}
|
|
291
311
|
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
292
312
|
const nodeName = node.nodeName;
|
|
@@ -654,16 +674,20 @@ function ssrHydrationKey() {}
|
|
|
654
674
|
function resolveSSRNode(node) {}
|
|
655
675
|
function escape(html) {}
|
|
656
676
|
|
|
657
|
-
function render(...args) {
|
|
658
|
-
const result = render$1(...args);
|
|
659
|
-
return result;
|
|
660
|
-
}
|
|
661
677
|
const isServer = false;
|
|
662
678
|
const isDev = false;
|
|
663
|
-
function
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
679
|
+
function render(code, element, init, options = {}) {
|
|
680
|
+
try {
|
|
681
|
+
const dispose = render$1(code, element, init, {
|
|
682
|
+
...options,
|
|
683
|
+
insertOptions: {
|
|
684
|
+
schedule: true
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
solidJs.flush();
|
|
688
|
+
return dispose;
|
|
689
|
+
} finally {
|
|
690
|
+
}
|
|
667
691
|
}
|
|
668
692
|
const hydrate = (...args) => {
|
|
669
693
|
solidJs.enableHydration();
|
|
@@ -689,6 +713,33 @@ function Portal(props) {
|
|
|
689
713
|
});
|
|
690
714
|
return treeMarker;
|
|
691
715
|
}
|
|
716
|
+
function dynamic(source) {
|
|
717
|
+
const cached = solidJs.createMemo(source, {
|
|
718
|
+
lazy: true
|
|
719
|
+
});
|
|
720
|
+
return props => {
|
|
721
|
+
return solidJs.createMemo(() => {
|
|
722
|
+
const component = cached();
|
|
723
|
+
switch (typeof component) {
|
|
724
|
+
case "function":
|
|
725
|
+
return solidJs.untrack(() => component(props));
|
|
726
|
+
case "string":
|
|
727
|
+
const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
|
|
728
|
+
spread(el, props);
|
|
729
|
+
return el;
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
function Dynamic(props) {
|
|
735
|
+
const Comp = dynamic(() => props.component);
|
|
736
|
+
return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
|
|
737
|
+
}
|
|
738
|
+
function createElement(tagName, is = undefined) {
|
|
739
|
+
return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
740
|
+
is
|
|
741
|
+
});
|
|
742
|
+
}
|
|
692
743
|
function createElementProxy(el, marker) {
|
|
693
744
|
return new Proxy(el, {
|
|
694
745
|
get(target, prop) {
|
|
@@ -706,24 +757,6 @@ function createElementProxy(el, marker) {
|
|
|
706
757
|
}
|
|
707
758
|
});
|
|
708
759
|
}
|
|
709
|
-
function createDynamic(component, props) {
|
|
710
|
-
const cached = solidJs.createMemo(component);
|
|
711
|
-
return solidJs.createMemo(() => {
|
|
712
|
-
const component = cached();
|
|
713
|
-
switch (typeof component) {
|
|
714
|
-
case "function":
|
|
715
|
-
return solidJs.untrack(() => component(props));
|
|
716
|
-
case "string":
|
|
717
|
-
const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
|
|
718
|
-
spread(el, props);
|
|
719
|
-
return el;
|
|
720
|
-
}
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
function Dynamic(props) {
|
|
724
|
-
const others = solidJs.omit(props, "component");
|
|
725
|
-
return createDynamic(() => props.component, others);
|
|
726
|
-
}
|
|
727
760
|
|
|
728
761
|
Object.defineProperty(exports, "Errored", {
|
|
729
762
|
enumerable: true,
|
|
@@ -791,15 +824,17 @@ exports.HydrationScript = voidFn;
|
|
|
791
824
|
exports.MathMLElements = MathMLElements;
|
|
792
825
|
exports.Namespaces = Namespaces;
|
|
793
826
|
exports.Portal = Portal;
|
|
827
|
+
exports.RawTextElements = RawTextElements;
|
|
794
828
|
exports.RequestContext = RequestContext;
|
|
795
829
|
exports.SVGElements = SVGElements;
|
|
830
|
+
exports.VoidElements = VoidElements;
|
|
796
831
|
exports.addEventListener = addEventListener;
|
|
797
832
|
exports.applyRef = applyRef;
|
|
798
833
|
exports.assign = assign;
|
|
799
834
|
exports.className = className;
|
|
800
835
|
exports.clearDelegatedEvents = clearDelegatedEvents;
|
|
801
|
-
exports.createDynamic = createDynamic;
|
|
802
836
|
exports.delegateEvents = delegateEvents;
|
|
837
|
+
exports.dynamic = dynamic;
|
|
803
838
|
exports.dynamicProperty = dynamicProperty;
|
|
804
839
|
exports.effect = effect;
|
|
805
840
|
exports.escape = escape;
|