@solidjs/web 2.0.0-experimental.5 → 2.0.0-experimental.7
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 +19 -50
- package/dist/dev.js +19 -49
- package/dist/server.cjs +114 -110
- package/dist/server.js +112 -111
- package/dist/web.cjs +19 -50
- package/dist/web.js +19 -49
- package/package.json +3 -3
- package/types/client.d.ts +0 -2
- package/types/server.d.ts +0 -1
package/dist/server.cjs
CHANGED
|
@@ -4,39 +4,9 @@ var solidJs = require('solid-js');
|
|
|
4
4
|
var seroval = require('seroval');
|
|
5
5
|
var web = require('seroval-plugins/web');
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const Properties = /*#__PURE__*/new Set(["value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
7
|
+
const Properties = /*#__PURE__*/new Set([
|
|
8
|
+
"value", "checked", "selected", "muted"]);
|
|
10
9
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
11
|
-
const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
12
|
-
class: "className",
|
|
13
|
-
formnovalidate: {
|
|
14
|
-
$: "formNoValidate",
|
|
15
|
-
BUTTON: 1,
|
|
16
|
-
INPUT: 1
|
|
17
|
-
},
|
|
18
|
-
ismap: {
|
|
19
|
-
$: "isMap",
|
|
20
|
-
IMG: 1
|
|
21
|
-
},
|
|
22
|
-
nomodule: {
|
|
23
|
-
$: "noModule",
|
|
24
|
-
SCRIPT: 1
|
|
25
|
-
},
|
|
26
|
-
playsinline: {
|
|
27
|
-
$: "playsInline",
|
|
28
|
-
VIDEO: 1
|
|
29
|
-
},
|
|
30
|
-
readonly: {
|
|
31
|
-
$: "readOnly",
|
|
32
|
-
INPUT: 1,
|
|
33
|
-
TEXTAREA: 1
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
function getPropAlias(prop, tagName) {
|
|
37
|
-
const a = PropAliases[prop];
|
|
38
|
-
return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
|
|
39
|
-
}
|
|
40
10
|
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"]);
|
|
41
11
|
const SVGElements = /*#__PURE__*/new Set([
|
|
42
12
|
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
@@ -47,7 +17,9 @@ const SVGNamespace = {
|
|
|
47
17
|
xlink: "http://www.w3.org/1999/xlink",
|
|
48
18
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
49
19
|
};
|
|
50
|
-
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"
|
|
20
|
+
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",
|
|
21
|
+
"webview",
|
|
22
|
+
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
51
23
|
|
|
52
24
|
const memo = fn => solidJs.createMemo(() => fn());
|
|
53
25
|
|
|
@@ -62,7 +34,7 @@ function createSerializer({
|
|
|
62
34
|
}) {
|
|
63
35
|
return new seroval.Serializer({
|
|
64
36
|
scopeId,
|
|
65
|
-
plugins: [
|
|
37
|
+
plugins: [web.AbortSignalPlugin,
|
|
66
38
|
web.CustomEventPlugin, web.DOMExceptionPlugin, web.EventPlugin,
|
|
67
39
|
web.FormDataPlugin, web.HeadersPlugin, web.ReadableStreamPlugin, web.RequestPlugin, web.ResponsePlugin, web.URLSearchParamsPlugin, web.URLPlugin],
|
|
68
40
|
globalIdentifier: GLOBAL_IDENTIFIER,
|
|
@@ -97,20 +69,18 @@ function renderToString(code, options = {}) {
|
|
|
97
69
|
onError: options.onError
|
|
98
70
|
});
|
|
99
71
|
solidJs.sharedConfig.context = {
|
|
100
|
-
id: renderId,
|
|
101
|
-
resources: {},
|
|
102
72
|
assets: [],
|
|
103
73
|
nonce,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
74
|
+
escape: escape,
|
|
75
|
+
resolve: resolveSSRNode,
|
|
76
|
+
ssr: ssr,
|
|
107
77
|
serialize(id, p) {
|
|
108
78
|
!solidJs.sharedConfig.context.noHydrate && serializer.write(id, p);
|
|
109
79
|
}
|
|
110
80
|
};
|
|
111
81
|
let html = solidJs.createRoot(d => {
|
|
112
82
|
setTimeout(d);
|
|
113
|
-
return
|
|
83
|
+
return resolveSSRSync(escape(code()));
|
|
114
84
|
}, {
|
|
115
85
|
id: renderId
|
|
116
86
|
});
|
|
@@ -187,9 +157,7 @@ function renderToStream(code, options = {}) {
|
|
|
187
157
|
}
|
|
188
158
|
};
|
|
189
159
|
solidJs.sharedConfig.context = context = {
|
|
190
|
-
id: renderId,
|
|
191
160
|
async: true,
|
|
192
|
-
resources: {},
|
|
193
161
|
assets: [],
|
|
194
162
|
nonce,
|
|
195
163
|
block(p) {
|
|
@@ -201,7 +169,7 @@ function renderToStream(code, options = {}) {
|
|
|
201
169
|
const first = html.indexOf(placeholder);
|
|
202
170
|
if (first === -1) return;
|
|
203
171
|
const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
|
|
204
|
-
html = html.slice(0, first) +
|
|
172
|
+
html = html.slice(0, first) + resolveSSRSync(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
|
|
205
173
|
},
|
|
206
174
|
serialize(id, p, wait) {
|
|
207
175
|
const serverOnly = solidJs.sharedConfig.context.noHydrate;
|
|
@@ -214,35 +182,46 @@ function renderToStream(code, options = {}) {
|
|
|
214
182
|
});
|
|
215
183
|
} else if (!serverOnly) serializer.write(id, p);
|
|
216
184
|
},
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
185
|
+
escape: escape,
|
|
186
|
+
resolve: resolveSSRNode,
|
|
187
|
+
ssr: ssr,
|
|
220
188
|
registerFragment(key) {
|
|
221
189
|
if (!registry.has(key)) {
|
|
222
190
|
let resolve, reject;
|
|
223
191
|
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
224
|
-
registry.set(key,
|
|
225
|
-
err
|
|
226
|
-
|
|
227
|
-
|
|
192
|
+
registry.set(key, {
|
|
193
|
+
resolve: err => queue(() => queue(() => {
|
|
194
|
+
err ? reject(err) : resolve(true);
|
|
195
|
+
queue(flushEnd);
|
|
196
|
+
}))
|
|
197
|
+
});
|
|
228
198
|
serializer.write(key, p);
|
|
229
199
|
}
|
|
230
200
|
return (value, error) => {
|
|
231
201
|
if (registry.has(key)) {
|
|
232
|
-
const
|
|
202
|
+
const item = registry.get(key);
|
|
233
203
|
registry.delete(key);
|
|
234
|
-
if (
|
|
235
|
-
|
|
204
|
+
if (item.children) {
|
|
205
|
+
for (const k in item.children) {
|
|
206
|
+
value = replacePlaceholder(value, k, item.children[k]);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const parentKey = waitForFragments(registry, key);
|
|
210
|
+
if (parentKey) {
|
|
211
|
+
const parent = registry.get(parentKey);
|
|
212
|
+
parent.children ||= {};
|
|
213
|
+
parent.children[key] = value !== undefined ? value : "";
|
|
214
|
+
item.resolve();
|
|
236
215
|
return;
|
|
237
216
|
}
|
|
238
217
|
if (!completed) {
|
|
239
218
|
if (!firstFlushed) {
|
|
240
219
|
queue(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
|
|
241
|
-
resolve(error);
|
|
220
|
+
item.resolve(error);
|
|
242
221
|
} else {
|
|
243
222
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
244
223
|
pushTask(`$df("${key}")${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
|
|
245
|
-
resolve(error);
|
|
224
|
+
item.resolve(error);
|
|
246
225
|
scriptFlushed = true;
|
|
247
226
|
}
|
|
248
227
|
}
|
|
@@ -253,14 +232,13 @@ function renderToStream(code, options = {}) {
|
|
|
253
232
|
};
|
|
254
233
|
let html = solidJs.createRoot(d => {
|
|
255
234
|
dispose = d;
|
|
256
|
-
return
|
|
235
|
+
return resolveSSRSync(escape(code()));
|
|
257
236
|
}, {
|
|
258
237
|
id: renderId
|
|
259
238
|
});
|
|
260
239
|
function doShell() {
|
|
261
240
|
if (shellCompleted) return;
|
|
262
241
|
solidJs.sharedConfig.context = context;
|
|
263
|
-
context.noHydrate = true;
|
|
264
242
|
html = injectAssets(context.assets, html);
|
|
265
243
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
266
244
|
buffer.write(html);
|
|
@@ -343,15 +321,7 @@ function HydrationScript(props) {
|
|
|
343
321
|
}));
|
|
344
322
|
}
|
|
345
323
|
function ssr(t, ...nodes) {
|
|
346
|
-
if (nodes.length)
|
|
347
|
-
let result = "";
|
|
348
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
349
|
-
result += t[i];
|
|
350
|
-
const node = nodes[i];
|
|
351
|
-
if (node !== undefined) result += resolveSSRNode(node);
|
|
352
|
-
}
|
|
353
|
-
t = result + t[nodes.length];
|
|
354
|
-
}
|
|
324
|
+
if (nodes.length) return resolveSSR(t, nodes);
|
|
355
325
|
return {
|
|
356
326
|
t
|
|
357
327
|
};
|
|
@@ -381,11 +351,17 @@ function ssrStyle(value) {
|
|
|
381
351
|
const v = value[s];
|
|
382
352
|
if (v != undefined) {
|
|
383
353
|
if (i) result += ";";
|
|
384
|
-
|
|
354
|
+
const r = escape(v, true);
|
|
355
|
+
if (r != undefined && r !== "undefined") {
|
|
356
|
+
result += `${s}:${r}`;
|
|
357
|
+
}
|
|
385
358
|
}
|
|
386
359
|
}
|
|
387
360
|
return result;
|
|
388
361
|
}
|
|
362
|
+
function ssrStyleProperty(name, value) {
|
|
363
|
+
return value != null ? name + value : "";
|
|
364
|
+
}
|
|
389
365
|
function ssrElement(tag, props, children, needsId) {
|
|
390
366
|
if (props == null) props = {};else if (typeof props === "function") props = props();
|
|
391
367
|
const skipChildren = VOID_ELEMENTS.test(tag);
|
|
@@ -402,17 +378,13 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
402
378
|
result += `style="${ssrStyle(value)}"`;
|
|
403
379
|
} else if (prop === "class") {
|
|
404
380
|
result += `class="${ssrClassName(value)}"`;
|
|
405
|
-
} else if (BooleanAttributes.has(prop)) {
|
|
406
|
-
if (value) result += prop;else continue;
|
|
407
381
|
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
|
|
408
382
|
continue;
|
|
409
|
-
} else if (
|
|
383
|
+
} else if (typeof value === "boolean") {
|
|
410
384
|
if (!value) continue;
|
|
411
|
-
result += escape(prop
|
|
412
|
-
} else if (prop.slice(0, 5) === "attr:") {
|
|
413
|
-
result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
|
|
385
|
+
result += escape(prop);
|
|
414
386
|
} else {
|
|
415
|
-
result += `${escape(prop)}="${escape(value, true)}"`;
|
|
387
|
+
result += value === "" ? escape(prop) : `${escape(prop)}="${escape(value, true)}"`;
|
|
416
388
|
}
|
|
417
389
|
if (i !== keys.length - 1) result += " ";
|
|
418
390
|
}
|
|
@@ -420,12 +392,10 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
420
392
|
t: result + "/>"
|
|
421
393
|
};
|
|
422
394
|
if (typeof children === "function") children = children();
|
|
423
|
-
return {
|
|
424
|
-
t: result + `>${resolveSSRNode(children, true)}</${tag}>`
|
|
425
|
-
};
|
|
395
|
+
return ssr([result + ">", `</${tag}>`], resolveSSRNode(children, undefined, true));
|
|
426
396
|
}
|
|
427
|
-
function ssrAttribute(key, value
|
|
428
|
-
return
|
|
397
|
+
function ssrAttribute(key, value) {
|
|
398
|
+
return value == null || value === false ? "" : value === true ? ` ${key}` : ` ${key}="${value}"`;
|
|
429
399
|
}
|
|
430
400
|
function ssrHydrationKey() {
|
|
431
401
|
const hk = getHydrationKey();
|
|
@@ -434,12 +404,12 @@ function ssrHydrationKey() {
|
|
|
434
404
|
function escape(s, attr) {
|
|
435
405
|
const t = typeof s;
|
|
436
406
|
if (t !== "string") {
|
|
437
|
-
if (!attr && t === "function") return escape(s());
|
|
438
407
|
if (!attr && Array.isArray(s)) {
|
|
408
|
+
s = s.slice();
|
|
439
409
|
for (let i = 0; i < s.length; i++) s[i] = escape(s[i]);
|
|
440
410
|
return s;
|
|
441
411
|
}
|
|
442
|
-
if (attr && t === "boolean") return
|
|
412
|
+
if (attr && t === "boolean") return s;
|
|
443
413
|
return s;
|
|
444
414
|
}
|
|
445
415
|
const delim = attr ? '"' : "<";
|
|
@@ -477,29 +447,6 @@ function escape(s, attr) {
|
|
|
477
447
|
}
|
|
478
448
|
return left < s.length ? out + s.substring(left) : out;
|
|
479
449
|
}
|
|
480
|
-
function resolveSSRNode(node, top) {
|
|
481
|
-
const t = typeof node;
|
|
482
|
-
if (t === "string") return node;
|
|
483
|
-
if (node == null || t === "boolean") return "";
|
|
484
|
-
if (Array.isArray(node)) {
|
|
485
|
-
let prev = {};
|
|
486
|
-
let mapped = "";
|
|
487
|
-
for (let i = 0, len = node.length; i < len; i++) {
|
|
488
|
-
if (!top && typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
|
|
489
|
-
mapped += resolveSSRNode(prev = node[i]);
|
|
490
|
-
}
|
|
491
|
-
return mapped;
|
|
492
|
-
}
|
|
493
|
-
if (t === "object") return node.t;
|
|
494
|
-
if (t === "function") {
|
|
495
|
-
try {
|
|
496
|
-
return resolveSSRNode(node());
|
|
497
|
-
} catch (err) {
|
|
498
|
-
if (!solidJs.ssrHandleError(err)) throw err;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return String(node);
|
|
502
|
-
}
|
|
503
450
|
function mergeProps(...sources) {
|
|
504
451
|
const target = {};
|
|
505
452
|
for (let i = 0; i < sources.length; i++) {
|
|
@@ -528,7 +475,7 @@ function getHydrationKey() {
|
|
|
528
475
|
return hydrate && !hydrate.noHydrate && solidJs.sharedConfig.getNextContextId();
|
|
529
476
|
}
|
|
530
477
|
function useAssets(fn) {
|
|
531
|
-
solidJs.sharedConfig.context.assets.push(() =>
|
|
478
|
+
solidJs.sharedConfig.context.assets.push(() => resolveSSRSync(escape(fn())));
|
|
532
479
|
}
|
|
533
480
|
function getAssets() {
|
|
534
481
|
const assets = solidJs.sharedConfig.context.assets;
|
|
@@ -547,8 +494,6 @@ function Hydration(props) {
|
|
|
547
494
|
const context = solidJs.sharedConfig.context;
|
|
548
495
|
solidJs.sharedConfig.context = {
|
|
549
496
|
...context,
|
|
550
|
-
count: 0,
|
|
551
|
-
id: solidJs.sharedConfig.getNextContextId(),
|
|
552
497
|
noHydrate: false
|
|
553
498
|
};
|
|
554
499
|
const res = props.children;
|
|
@@ -593,7 +538,7 @@ function injectScripts(html, scripts, nonce) {
|
|
|
593
538
|
}
|
|
594
539
|
function waitForFragments(registry, key) {
|
|
595
540
|
for (const k of [...registry.keys()].reverse()) {
|
|
596
|
-
if (key.startsWith(k)) return
|
|
541
|
+
if (key.startsWith(k)) return k;
|
|
597
542
|
}
|
|
598
543
|
return false;
|
|
599
544
|
}
|
|
@@ -619,6 +564,62 @@ function flattenClassList(list, result) {
|
|
|
619
564
|
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
|
|
620
565
|
}
|
|
621
566
|
}
|
|
567
|
+
function resolveSSR(template, holes, result = {
|
|
568
|
+
t: [""],
|
|
569
|
+
h: [],
|
|
570
|
+
p: []
|
|
571
|
+
}) {
|
|
572
|
+
for (let i = 0; i < holes.length; i++) {
|
|
573
|
+
const hole = holes[i];
|
|
574
|
+
result.t[result.t.length - 1] += template[i];
|
|
575
|
+
if (hole == null || hole === true || hole === false) continue;
|
|
576
|
+
resolveSSRNode(hole, result);
|
|
577
|
+
}
|
|
578
|
+
result.t[result.t.length - 1] += template[template.length - 1];
|
|
579
|
+
return result;
|
|
580
|
+
}
|
|
581
|
+
function resolveSSRNode(node, result = {
|
|
582
|
+
t: [""],
|
|
583
|
+
h: [],
|
|
584
|
+
p: []
|
|
585
|
+
}, top) {
|
|
586
|
+
const t = typeof node;
|
|
587
|
+
if (t === "string" || t === "number") {
|
|
588
|
+
result.t[result.t.length - 1] += node;
|
|
589
|
+
} else if (node == null || t === "boolean") ; else if (Array.isArray(node)) {
|
|
590
|
+
let prev = {};
|
|
591
|
+
for (let i = 0, len = node.length; i < len; i++) {
|
|
592
|
+
if (!top && typeof prev !== "object" && typeof node[i] !== "object") result.t[result.t.length - 1] += `<!--!$-->`;
|
|
593
|
+
resolveSSRNode(prev = node[i], result);
|
|
594
|
+
}
|
|
595
|
+
} else if (t === "object") {
|
|
596
|
+
if (node.h) {
|
|
597
|
+
result.t[result.t.length - 1] += node.t[0];
|
|
598
|
+
if (node.t.length > 1) {
|
|
599
|
+
result.t.push(...node.t.slice(1));
|
|
600
|
+
result.h.push(...node.h);
|
|
601
|
+
result.p.push(...node.p);
|
|
602
|
+
}
|
|
603
|
+
} else result.t[result.t.length - 1] += node.t;
|
|
604
|
+
} else if (t === "function") {
|
|
605
|
+
try {
|
|
606
|
+
resolveSSRNode(node(), result);
|
|
607
|
+
} catch (err) {
|
|
608
|
+
const p = solidJs.ssrHandleError(err);
|
|
609
|
+
if (p) {
|
|
610
|
+
result.h.push(node);
|
|
611
|
+
result.p.push(p);
|
|
612
|
+
result.t.push("");
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return result;
|
|
617
|
+
}
|
|
618
|
+
function resolveSSRSync(node) {
|
|
619
|
+
const res = resolveSSRNode(node);
|
|
620
|
+
if (!res.h.length) return res.t[0];
|
|
621
|
+
throw new Error("This value cannot be rendered synchronously. Are you missing a Suspsense boundary?");
|
|
622
|
+
}
|
|
622
623
|
const RequestContext = Symbol();
|
|
623
624
|
function getRequestEvent() {
|
|
624
625
|
return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || solidJs.sharedConfig.context && solidJs.sharedConfig.context.event || console.log("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.") : undefined;
|
|
@@ -689,6 +690,10 @@ Object.defineProperty(exports, "getOwner", {
|
|
|
689
690
|
enumerable: true,
|
|
690
691
|
get: function () { return solidJs.getOwner; }
|
|
691
692
|
});
|
|
693
|
+
Object.defineProperty(exports, "ssrRunInScope", {
|
|
694
|
+
enumerable: true,
|
|
695
|
+
get: function () { return solidJs.ssrRunInScope; }
|
|
696
|
+
});
|
|
692
697
|
Object.defineProperty(exports, "untrack", {
|
|
693
698
|
enumerable: true,
|
|
694
699
|
get: function () { return solidJs.untrack; }
|
|
@@ -718,7 +723,6 @@ exports.getHydrationKey = getHydrationKey;
|
|
|
718
723
|
exports.getNextElement = notSup;
|
|
719
724
|
exports.getNextMarker = notSup;
|
|
720
725
|
exports.getNextMatch = notSup;
|
|
721
|
-
exports.getPropAlias = getPropAlias;
|
|
722
726
|
exports.getRequestEvent = getRequestEvent;
|
|
723
727
|
exports.hydrate = notSup;
|
|
724
728
|
exports.insert = notSup;
|
|
@@ -730,7 +734,6 @@ exports.render = notSup;
|
|
|
730
734
|
exports.renderToStream = renderToStream;
|
|
731
735
|
exports.renderToString = renderToString;
|
|
732
736
|
exports.renderToStringAsync = renderToStringAsync;
|
|
733
|
-
exports.resolveSSRNode = resolveSSRNode;
|
|
734
737
|
exports.runHydrationEvents = notSup;
|
|
735
738
|
exports.setAttribute = notSup;
|
|
736
739
|
exports.setAttributeNS = notSup;
|
|
@@ -742,6 +745,7 @@ exports.ssrClassName = ssrClassName;
|
|
|
742
745
|
exports.ssrElement = ssrElement;
|
|
743
746
|
exports.ssrHydrationKey = ssrHydrationKey;
|
|
744
747
|
exports.ssrStyle = ssrStyle;
|
|
748
|
+
exports.ssrStyleProperty = ssrStyleProperty;
|
|
745
749
|
exports.style = notSup;
|
|
746
750
|
exports.template = notSup;
|
|
747
751
|
exports.useAssets = useAssets;
|