@solidjs/web 2.0.0-beta.1 → 2.0.0-beta.11
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 +251 -106
- package/dist/dev.js +239 -102
- package/dist/server.cjs +391 -109
- package/dist/server.js +384 -105
- package/dist/web.cjs +237 -97
- package/dist/web.js +225 -93
- package/package.json +100 -33
- package/storage/package.json +8 -3
- package/storage/types/src/index.d.ts +147 -21
- package/storage/types/src/jsx.d.ts +29 -0
- package/storage/types/src/server-mock.d.ts +89 -0
- package/storage/types-cjs/index.d.cts +2 -0
- package/storage/types-cjs/package.json +3 -0
- package/storage/types-cjs/src/client.d.cts +1 -0
- package/storage/types-cjs/src/index.d.cts +171 -0
- package/storage/types-cjs/src/jsx.d.cts +29 -0
- package/storage/types-cjs/src/server-mock.d.cts +161 -0
- package/storage/types-cjs/storage/src/index.d.cts +2 -0
- package/types/client.d.ts +31 -15
- package/types/core.d.ts +3 -3
- package/types/index.d.ts +147 -21
- package/types/jsx-properties.d.ts +92 -0
- package/types/jsx.d.ts +4321 -1
- package/types/server-mock.d.ts +89 -0
- package/types/server.d.ts +36 -18
- package/types-cjs/client.d.cts +104 -0
- package/types-cjs/core.d.cts +3 -0
- package/types-cjs/index.d.cts +171 -0
- package/types-cjs/jsx-properties.d.cts +92 -0
- package/types-cjs/jsx.d.cts +4321 -0
- package/types-cjs/package.json +3 -0
- package/types-cjs/server-mock.d.cts +161 -0
- package/types-cjs/server.d.cts +174 -0
package/dist/server.cjs
CHANGED
|
@@ -4,8 +4,6 @@ var solidJs = require('solid-js');
|
|
|
4
4
|
var seroval = require('seroval');
|
|
5
5
|
var web = require('seroval-plugins/web');
|
|
6
6
|
|
|
7
|
-
const Properties = /*#__PURE__*/new Set([
|
|
8
|
-
"value", "checked", "selected", "muted"]);
|
|
9
7
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
10
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"]);
|
|
11
9
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -13,22 +11,36 @@ const SVGElements = /*#__PURE__*/new Set([
|
|
|
13
11
|
"set", "stop",
|
|
14
12
|
"svg", "switch", "symbol", "text", "textPath",
|
|
15
13
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
16
|
-
const
|
|
14
|
+
const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
|
|
15
|
+
const Namespaces = {
|
|
16
|
+
svg: "http://www.w3.org/2000/svg",
|
|
17
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
17
18
|
xlink: "http://www.w3.org/1999/xlink",
|
|
18
19
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
19
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"]);
|
|
20
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",
|
|
21
24
|
"webview",
|
|
22
25
|
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
23
26
|
|
|
24
|
-
const
|
|
25
|
-
transparent: true
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const transparentOptions = {
|
|
28
|
+
transparent: true,
|
|
29
|
+
sync: true
|
|
30
|
+
};
|
|
31
|
+
const syncOptions = {
|
|
32
|
+
sync: true
|
|
33
|
+
};
|
|
34
|
+
const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectFn, options ? {
|
|
35
|
+
transparent: true,
|
|
36
|
+
sync: true,
|
|
37
|
+
...options
|
|
38
|
+
} : transparentOptions);
|
|
39
|
+
const memo = fn => solidJs.createMemo(() => fn(), syncOptions);
|
|
28
40
|
|
|
29
|
-
const ES2017FLAG = seroval.Feature.AggregateError
|
|
30
|
-
|
|
31
|
-
const GLOBAL_IDENTIFIER =
|
|
41
|
+
const ES2017FLAG = seroval.Feature.AggregateError |
|
|
42
|
+
seroval.Feature.BigIntTypedArray;
|
|
43
|
+
const GLOBAL_IDENTIFIER = "_$HY.r";
|
|
32
44
|
function createSerializer({
|
|
33
45
|
onData,
|
|
34
46
|
onDone,
|
|
@@ -51,7 +63,7 @@ function createSerializer({
|
|
|
51
63
|
});
|
|
52
64
|
}
|
|
53
65
|
function getLocalHeaderScript(id) {
|
|
54
|
-
return seroval.getCrossReferenceHeader(id) +
|
|
66
|
+
return seroval.getCrossReferenceHeader(id) + ";";
|
|
55
67
|
}
|
|
56
68
|
|
|
57
69
|
function resolveAssets(moduleUrl, manifest) {
|
|
@@ -107,11 +119,11 @@ function createAssetTracking() {
|
|
|
107
119
|
currentBoundaryId = v;
|
|
108
120
|
},
|
|
109
121
|
registerModule(moduleUrl, entryUrl) {
|
|
110
|
-
|
|
111
|
-
let map = boundaryModules.get(
|
|
122
|
+
const id = currentBoundaryId || "";
|
|
123
|
+
let map = boundaryModules.get(id);
|
|
112
124
|
if (!map) {
|
|
113
125
|
map = {};
|
|
114
|
-
boundaryModules.set(
|
|
126
|
+
boundaryModules.set(id, map);
|
|
115
127
|
}
|
|
116
128
|
map[moduleUrl] = entryUrl;
|
|
117
129
|
},
|
|
@@ -139,7 +151,7 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
139
151
|
if (manifest) context.resolveAssets = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
140
152
|
}
|
|
141
153
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
142
|
-
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(n=document.getElementById(e)
|
|
154
|
+
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])}`;
|
|
143
155
|
function renderToString(code, options = {}) {
|
|
144
156
|
const {
|
|
145
157
|
renderId = "",
|
|
@@ -194,6 +206,7 @@ function renderToString(code, options = {}) {
|
|
|
194
206
|
}, {
|
|
195
207
|
id: renderId
|
|
196
208
|
});
|
|
209
|
+
serializeFragmentAssets("", tracking.boundaryModules, solidJs.sharedConfig.context);
|
|
197
210
|
solidJs.sharedConfig.context.noHydrate = true;
|
|
198
211
|
serializer.close();
|
|
199
212
|
html = injectAssets(solidJs.sharedConfig.context.assets, html);
|
|
@@ -212,10 +225,12 @@ function renderToStream(code, options = {}) {
|
|
|
212
225
|
} = options;
|
|
213
226
|
let dispose;
|
|
214
227
|
const blockingPromises = new Set();
|
|
228
|
+
let headerEmitted = false;
|
|
215
229
|
const pushTask = task => {
|
|
216
230
|
if (noScripts) return;
|
|
217
|
-
if (!
|
|
218
|
-
|
|
231
|
+
if (!headerEmitted) {
|
|
232
|
+
headerEmitted = true;
|
|
233
|
+
tasks += getLocalHeaderScript(renderId);
|
|
219
234
|
}
|
|
220
235
|
tasks += task + ";";
|
|
221
236
|
if (!timer && firstFlushed) {
|
|
@@ -241,8 +256,15 @@ function renderToStream(code, options = {}) {
|
|
|
241
256
|
onDone,
|
|
242
257
|
onError: options.onError
|
|
243
258
|
});
|
|
259
|
+
let rootAssetsSerialized = false;
|
|
260
|
+
const serializeRootAssets = () => {
|
|
261
|
+
if (rootAssetsSerialized) return;
|
|
262
|
+
rootAssetsSerialized = true;
|
|
263
|
+
serializeFragmentAssets("", tracking.boundaryModules, context);
|
|
264
|
+
};
|
|
244
265
|
const flushEnd = () => {
|
|
245
266
|
if (!registry.size) {
|
|
267
|
+
serializeRootAssets();
|
|
246
268
|
queue(() => queue(() => serializer.flush()));
|
|
247
269
|
}
|
|
248
270
|
};
|
|
@@ -264,7 +286,29 @@ function renderToStream(code, options = {}) {
|
|
|
264
286
|
let shellCompleted = false;
|
|
265
287
|
let scriptFlushed = false;
|
|
266
288
|
let headStyles;
|
|
289
|
+
const revealGroups = new Map();
|
|
267
290
|
let timer = null;
|
|
291
|
+
const emitTask = task => {
|
|
292
|
+
pushTask(`${task}${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
|
|
293
|
+
scriptFlushed = true;
|
|
294
|
+
};
|
|
295
|
+
function resolveRevealKeys(groupOrKeys, release, consume) {
|
|
296
|
+
if (Array.isArray(groupOrKeys)) return groupOrKeys.slice();
|
|
297
|
+
let group = revealGroups.get(groupOrKeys);
|
|
298
|
+
if (!group) {
|
|
299
|
+
if (!release) return;
|
|
300
|
+
group = {
|
|
301
|
+
order: [],
|
|
302
|
+
keys: new Set(),
|
|
303
|
+
released: true
|
|
304
|
+
};
|
|
305
|
+
revealGroups.set(groupOrKeys, group);
|
|
306
|
+
} else if (release) group.released = true;
|
|
307
|
+
if (!group.order.length) return;
|
|
308
|
+
const keys = group.order.slice();
|
|
309
|
+
if (consume) revealGroups.delete(groupOrKeys);
|
|
310
|
+
return keys;
|
|
311
|
+
}
|
|
268
312
|
let rootHoles = null;
|
|
269
313
|
let nextHoleId = 0;
|
|
270
314
|
let buffer = {
|
|
@@ -314,7 +358,26 @@ function renderToStream(code, options = {}) {
|
|
|
314
358
|
escape: escape,
|
|
315
359
|
resolve: resolveSSRNode,
|
|
316
360
|
ssr: ssr,
|
|
317
|
-
registerFragment(key) {
|
|
361
|
+
registerFragment(key, options) {
|
|
362
|
+
const revealGroup = options && options.revealGroup;
|
|
363
|
+
if (revealGroup) {
|
|
364
|
+
let group = revealGroups.get(revealGroup);
|
|
365
|
+
if (!group) {
|
|
366
|
+
group = {
|
|
367
|
+
order: [],
|
|
368
|
+
keys: new Set(),
|
|
369
|
+
released: false
|
|
370
|
+
};
|
|
371
|
+
revealGroups.set(revealGroup, group);
|
|
372
|
+
}
|
|
373
|
+
if (!group.keys.has(key)) {
|
|
374
|
+
group.keys.add(key);
|
|
375
|
+
group.order.push(key);
|
|
376
|
+
}
|
|
377
|
+
if (group.released) {
|
|
378
|
+
throw new Error("registerFragment() for reveal group '" + revealGroup + "' was called after revealFragments(). Ensure template payload is emitted before grouped reveal.");
|
|
379
|
+
}
|
|
380
|
+
}
|
|
318
381
|
if (!registry.has(key)) {
|
|
319
382
|
let resolve, reject;
|
|
320
383
|
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
@@ -324,7 +387,7 @@ function renderToStream(code, options = {}) {
|
|
|
324
387
|
queue(flushEnd);
|
|
325
388
|
}))
|
|
326
389
|
});
|
|
327
|
-
serializer.write(key, p);
|
|
390
|
+
serializer.write(key + "_fr", p);
|
|
328
391
|
}
|
|
329
392
|
return (value, error) => {
|
|
330
393
|
if (registry.has(key)) {
|
|
@@ -353,9 +416,9 @@ function renderToStream(code, options = {}) {
|
|
|
353
416
|
} else {
|
|
354
417
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
355
418
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
419
|
+
const deferActivation = !!revealGroup;
|
|
356
420
|
if (styles.length) {
|
|
357
|
-
|
|
358
|
-
scriptFlushed = true;
|
|
421
|
+
emitTask(`$dfs("${key}",${styles.length},${deferActivation ? 1 : 0})`);
|
|
359
422
|
writeTasks();
|
|
360
423
|
for (const url of styles) {
|
|
361
424
|
buffer.write(`<link rel="stylesheet" href="${url}" onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
@@ -363,8 +426,9 @@ function renderToStream(code, options = {}) {
|
|
|
363
426
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
364
427
|
} else {
|
|
365
428
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
366
|
-
|
|
367
|
-
|
|
429
|
+
if (!deferActivation) {
|
|
430
|
+
emitTask(`$df("${key}")`);
|
|
431
|
+
}
|
|
368
432
|
}
|
|
369
433
|
item.resolve(error);
|
|
370
434
|
}
|
|
@@ -372,6 +436,16 @@ function renderToStream(code, options = {}) {
|
|
|
372
436
|
}
|
|
373
437
|
return firstFlushed;
|
|
374
438
|
};
|
|
439
|
+
},
|
|
440
|
+
revealFragments(groupOrKeys) {
|
|
441
|
+
const keys = resolveRevealKeys(groupOrKeys, true, true);
|
|
442
|
+
if (!keys) return;
|
|
443
|
+
emitTask(`$dfj(${JSON.stringify(keys)})`);
|
|
444
|
+
},
|
|
445
|
+
revealFallbacks(groupOrKeys) {
|
|
446
|
+
const keys = resolveRevealKeys(groupOrKeys, false, false);
|
|
447
|
+
if (!keys) return;
|
|
448
|
+
emitTask(`$dflj(${JSON.stringify(keys)})`);
|
|
375
449
|
}
|
|
376
450
|
};
|
|
377
451
|
applyAssetTracking(context, tracking, manifest);
|
|
@@ -398,13 +472,32 @@ function renderToStream(code, options = {}) {
|
|
|
398
472
|
function doShell() {
|
|
399
473
|
if (shellCompleted) return;
|
|
400
474
|
if (rootHoles) {
|
|
475
|
+
const pending = [];
|
|
401
476
|
for (const {
|
|
402
477
|
id,
|
|
403
478
|
fn
|
|
404
479
|
} of rootHoles) {
|
|
405
480
|
const marker = `<!--rh${id}-->`;
|
|
406
481
|
const res = resolveSSRNode(fn);
|
|
407
|
-
|
|
482
|
+
if (!res.h.length) {
|
|
483
|
+
html = html.replace(marker, res.t[0]);
|
|
484
|
+
} else {
|
|
485
|
+
let out = res.t[0];
|
|
486
|
+
for (let j = 0; j < res.h.length; j++) {
|
|
487
|
+
const newId = nextHoleId++;
|
|
488
|
+
pending.push({
|
|
489
|
+
id: newId,
|
|
490
|
+
fn: res.h[j]
|
|
491
|
+
});
|
|
492
|
+
out += `<!--rh${newId}-->` + res.t[j + 1];
|
|
493
|
+
}
|
|
494
|
+
html = html.replace(marker, out);
|
|
495
|
+
for (const p of res.p) blockingPromises.add(p);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
if (pending.length) {
|
|
499
|
+
rootHoles = pending;
|
|
500
|
+
return;
|
|
408
501
|
}
|
|
409
502
|
rootHoles = null;
|
|
410
503
|
}
|
|
@@ -415,6 +508,7 @@ function renderToStream(code, options = {}) {
|
|
|
415
508
|
if (url.endsWith(".css")) headStyles.add(url);
|
|
416
509
|
}
|
|
417
510
|
html = injectPreloadLinks(tracking.emittedAssets, html);
|
|
511
|
+
serializeRootAssets();
|
|
418
512
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
419
513
|
buffer.write(html);
|
|
420
514
|
tasks = "";
|
|
@@ -441,48 +535,56 @@ function renderToStream(code, options = {}) {
|
|
|
441
535
|
queue(flushEnd);
|
|
442
536
|
},
|
|
443
537
|
pipe(w) {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
538
|
+
function flush() {
|
|
539
|
+
allSettled(blockingPromises).then(() => {
|
|
540
|
+
setTimeout(() => {
|
|
541
|
+
doShell();
|
|
542
|
+
if (!shellCompleted) return flush();
|
|
543
|
+
buffer = writable = w;
|
|
544
|
+
buffer.write(tmp);
|
|
545
|
+
firstFlushed = true;
|
|
546
|
+
if (completed) {
|
|
547
|
+
dispose();
|
|
548
|
+
writable.end();
|
|
549
|
+
} else flushEnd();
|
|
550
|
+
});
|
|
454
551
|
});
|
|
455
|
-
}
|
|
552
|
+
}
|
|
553
|
+
flush();
|
|
456
554
|
},
|
|
457
555
|
pipeTo(w) {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
556
|
+
let resolve;
|
|
557
|
+
const p = new Promise(r => resolve = r);
|
|
558
|
+
function flush() {
|
|
559
|
+
allSettled(blockingPromises).then(() => {
|
|
560
|
+
setTimeout(() => {
|
|
561
|
+
doShell();
|
|
562
|
+
if (!shellCompleted) return flush();
|
|
563
|
+
const encoder = new TextEncoder();
|
|
564
|
+
const writer = w.getWriter();
|
|
565
|
+
writable = {
|
|
566
|
+
end() {
|
|
567
|
+
writer.releaseLock();
|
|
568
|
+
w.close().catch(() => {});
|
|
569
|
+
resolve();
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
buffer = {
|
|
573
|
+
write(payload) {
|
|
574
|
+
writer.write(encoder.encode(payload)).catch(() => {});
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
buffer.write(tmp);
|
|
578
|
+
firstFlushed = true;
|
|
579
|
+
if (completed) {
|
|
580
|
+
dispose();
|
|
581
|
+
writable.end();
|
|
582
|
+
} else flushEnd();
|
|
583
|
+
});
|
|
483
584
|
});
|
|
484
|
-
|
|
485
|
-
|
|
585
|
+
}
|
|
586
|
+
flush();
|
|
587
|
+
return p;
|
|
486
588
|
}
|
|
487
589
|
};
|
|
488
590
|
}
|
|
@@ -495,11 +597,149 @@ function HydrationScript(props) {
|
|
|
495
597
|
...props
|
|
496
598
|
}));
|
|
497
599
|
}
|
|
498
|
-
function
|
|
499
|
-
|
|
600
|
+
function ssrGroup(fn, n) {
|
|
601
|
+
fn.$g = n;
|
|
602
|
+
return fn;
|
|
603
|
+
}
|
|
604
|
+
function buildAsyncWrap(err, node) {
|
|
605
|
+
const p = solidJs.ssrHandleError(err);
|
|
606
|
+
if (!p) return null;
|
|
607
|
+
const owner = solidJs.getOwner();
|
|
500
608
|
return {
|
|
609
|
+
fn: owner ? () => solidJs.runWithOwner(owner, node) : node,
|
|
610
|
+
p
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
function ssrFirstGroupHit(hole) {
|
|
614
|
+
try {
|
|
615
|
+
return hole();
|
|
616
|
+
} catch (err) {
|
|
617
|
+
return buildAsyncWrap(err, hole);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
function mergeTemplateInto(result, node) {
|
|
621
|
+
result.t[result.t.length - 1] += node.t[0];
|
|
622
|
+
if (node.t.length > 1) {
|
|
623
|
+
result.t.push(...node.t.slice(1));
|
|
624
|
+
result.h.push(...node.h);
|
|
625
|
+
result.p.push(...node.p);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
let _lastGroupFn = null;
|
|
629
|
+
let _lastGroupArr = null;
|
|
630
|
+
let _lastGroupErr = null;
|
|
631
|
+
function ssrGroupSlot(fn, idx) {
|
|
632
|
+
return () => {
|
|
633
|
+
if (idx > 0 && _lastGroupFn === fn) {
|
|
634
|
+
if (_lastGroupArr !== null) return _lastGroupArr[idx];
|
|
635
|
+
throw _lastGroupErr;
|
|
636
|
+
}
|
|
637
|
+
_lastGroupFn = fn;
|
|
638
|
+
_lastGroupArr = null;
|
|
639
|
+
_lastGroupErr = null;
|
|
640
|
+
try {
|
|
641
|
+
_lastGroupArr = fn();
|
|
642
|
+
return _lastGroupArr[idx];
|
|
643
|
+
} catch (err) {
|
|
644
|
+
_lastGroupErr = err;
|
|
645
|
+
throw err;
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
function ssr(t) {
|
|
650
|
+
const len = arguments.length;
|
|
651
|
+
if (len === 1) return {
|
|
501
652
|
t
|
|
502
653
|
};
|
|
654
|
+
let s = t[0];
|
|
655
|
+
let result = null;
|
|
656
|
+
let lastGroup = null;
|
|
657
|
+
let lastGroupVal = null;
|
|
658
|
+
let lastGroupIdx = 0;
|
|
659
|
+
for (let i = 1; i < len; i++) {
|
|
660
|
+
const hole = arguments[i];
|
|
661
|
+
const ht = typeof hole;
|
|
662
|
+
if (ht === "string") {
|
|
663
|
+
if (result === null) s += hole;else result.t[result.t.length - 1] += hole;
|
|
664
|
+
} else if (ht === "number") {
|
|
665
|
+
if (result === null) s += hole;else result.t[result.t.length - 1] += hole;
|
|
666
|
+
} else if (hole == null || ht === "boolean") ; else if (ht === "function" && hole.$g) {
|
|
667
|
+
let value;
|
|
668
|
+
let hasValue = false;
|
|
669
|
+
if (lastGroup !== hole) {
|
|
670
|
+
const r = ssrFirstGroupHit(hole);
|
|
671
|
+
if (r !== null) {
|
|
672
|
+
lastGroup = hole;
|
|
673
|
+
lastGroupVal = r;
|
|
674
|
+
lastGroupIdx = 0;
|
|
675
|
+
if (!Array.isArray(r) && result === null) {
|
|
676
|
+
result = {
|
|
677
|
+
t: [s],
|
|
678
|
+
h: [],
|
|
679
|
+
p: []
|
|
680
|
+
};
|
|
681
|
+
s = "";
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
if (lastGroup === hole) {
|
|
686
|
+
if (Array.isArray(lastGroupVal)) {
|
|
687
|
+
value = lastGroupVal[lastGroupIdx++];
|
|
688
|
+
hasValue = true;
|
|
689
|
+
} else {
|
|
690
|
+
result.h.push(ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++));
|
|
691
|
+
result.p.push(lastGroupVal.p);
|
|
692
|
+
result.t.push("");
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
if (hasValue) {
|
|
696
|
+
const vt = typeof value;
|
|
697
|
+
if (vt === "string" || vt === "number") {
|
|
698
|
+
if (result === null) s += value;else result.t[result.t.length - 1] += value;
|
|
699
|
+
} else if (value == null || vt === "boolean") ; else if (result !== null) {
|
|
700
|
+
resolveSSRNode(value, result);
|
|
701
|
+
} else {
|
|
702
|
+
const rs = tryResolveString(value);
|
|
703
|
+
if (typeof rs === "string") {
|
|
704
|
+
s += rs;
|
|
705
|
+
} else {
|
|
706
|
+
result = {
|
|
707
|
+
t: [s],
|
|
708
|
+
h: [],
|
|
709
|
+
p: []
|
|
710
|
+
};
|
|
711
|
+
s = "";
|
|
712
|
+
if (rs.merge !== undefined) mergeTemplateInto(result, rs.merge);else resolveSSRNode(rs.bail, result);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
} else if (result !== null) {
|
|
717
|
+
resolveSSRNode(hole, result);
|
|
718
|
+
} else {
|
|
719
|
+
const r = tryResolveString(hole);
|
|
720
|
+
if (typeof r === "string") {
|
|
721
|
+
s += r;
|
|
722
|
+
} else {
|
|
723
|
+
result = {
|
|
724
|
+
t: [s],
|
|
725
|
+
h: [],
|
|
726
|
+
p: []
|
|
727
|
+
};
|
|
728
|
+
s = "";
|
|
729
|
+
if (r.fn !== undefined) {
|
|
730
|
+
result.h.push(r.fn);
|
|
731
|
+
result.p.push(r.p);
|
|
732
|
+
result.t.push("");
|
|
733
|
+
} else if (r.merge !== undefined) mergeTemplateInto(result, r.merge);else resolveSSRNode(r.bail, result);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
const next = t[i];
|
|
737
|
+
if (result === null) s += next;else result.t[result.t.length - 1] += next;
|
|
738
|
+
}
|
|
739
|
+
if (result === null) return {
|
|
740
|
+
t: s
|
|
741
|
+
};
|
|
742
|
+
return result;
|
|
503
743
|
}
|
|
504
744
|
function ssrClassName(value) {
|
|
505
745
|
if (!value) return "";
|
|
@@ -512,7 +752,7 @@ function ssrClassName(value) {
|
|
|
512
752
|
classValue = !!value[key];
|
|
513
753
|
if (!key || key === "undefined" || !classValue) continue;
|
|
514
754
|
i && (result += " ");
|
|
515
|
-
result += escape(key);
|
|
755
|
+
result += escape(key, true);
|
|
516
756
|
}
|
|
517
757
|
return result;
|
|
518
758
|
}
|
|
@@ -522,8 +762,8 @@ function ssrStyle(value) {
|
|
|
522
762
|
let result = "";
|
|
523
763
|
const k = Object.keys(value);
|
|
524
764
|
for (let i = 0; i < k.length; i++) {
|
|
525
|
-
const s = k[i];
|
|
526
|
-
const v = value[
|
|
765
|
+
const s = escape(k[i], true);
|
|
766
|
+
const v = value[k[i]];
|
|
527
767
|
if (v != undefined) {
|
|
528
768
|
if (i) result += ";";
|
|
529
769
|
const r = escape(v, true);
|
|
@@ -587,11 +827,21 @@ function escape(s, attr) {
|
|
|
587
827
|
if (attr && t === "boolean") return s;
|
|
588
828
|
return s;
|
|
589
829
|
}
|
|
830
|
+
const delimCode = attr ? 34 : 60;
|
|
831
|
+
const len = s.length;
|
|
832
|
+
for (let i = 0; i < len; i++) {
|
|
833
|
+
const c = s.charCodeAt(i);
|
|
834
|
+
if (c === 38 || c === delimCode) return escapeSlow(s, attr, i);
|
|
835
|
+
}
|
|
836
|
+
return s;
|
|
837
|
+
}
|
|
838
|
+
function escapeSlow(s, attr, start) {
|
|
590
839
|
const delim = attr ? '"' : "<";
|
|
840
|
+
const delimCode = attr ? 34 : 60;
|
|
591
841
|
const escDelim = attr ? """ : "<";
|
|
592
|
-
|
|
593
|
-
let
|
|
594
|
-
|
|
842
|
+
const c0 = s.charCodeAt(start);
|
|
843
|
+
let iDelim = c0 === delimCode ? start : s.indexOf(delim, start);
|
|
844
|
+
let iAmp = c0 === 38 ? start : s.indexOf("&", start);
|
|
595
845
|
let left = 0,
|
|
596
846
|
out = "";
|
|
597
847
|
while (iDelim >= 0 && iAmp >= 0) {
|
|
@@ -665,7 +915,7 @@ function generateHydrationScript({
|
|
|
665
915
|
eventNames = ["click", "input"],
|
|
666
916
|
nonce
|
|
667
917
|
} = {}) {
|
|
668
|
-
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('",
|
|
918
|
+
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-->`;
|
|
669
919
|
}
|
|
670
920
|
function queue(fn) {
|
|
671
921
|
return Promise.resolve().then(fn);
|
|
@@ -763,19 +1013,43 @@ function flattenClassList(list, result) {
|
|
|
763
1013
|
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;
|
|
764
1014
|
}
|
|
765
1015
|
}
|
|
766
|
-
function
|
|
767
|
-
t
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
1016
|
+
function tryResolveString(node) {
|
|
1017
|
+
const t = typeof node;
|
|
1018
|
+
if (t === "string") return node;
|
|
1019
|
+
if (t === "number") return "" + node;
|
|
1020
|
+
if (node == null || t === "boolean") return "";
|
|
1021
|
+
if (t === "object") {
|
|
1022
|
+
if (Array.isArray(node)) {
|
|
1023
|
+
let s = "";
|
|
1024
|
+
let prevNonObj = false;
|
|
1025
|
+
for (let i = 0, len = node.length; i < len; i++) {
|
|
1026
|
+
const item = node[i];
|
|
1027
|
+
const itemNonObj = item !== null && typeof item !== "object";
|
|
1028
|
+
if (prevNonObj && itemNonObj) s += "<!--!$-->";
|
|
1029
|
+
prevNonObj = itemNonObj;
|
|
1030
|
+
const r = tryResolveString(item);
|
|
1031
|
+
if (typeof r !== "string") return {
|
|
1032
|
+
bail: node
|
|
1033
|
+
};
|
|
1034
|
+
s += r;
|
|
1035
|
+
}
|
|
1036
|
+
return s;
|
|
1037
|
+
}
|
|
1038
|
+
if (node.h && node.h.length > 0) return {
|
|
1039
|
+
merge: node
|
|
1040
|
+
};
|
|
1041
|
+
return Array.isArray(node.t) ? node.t[0] : node.t;
|
|
776
1042
|
}
|
|
777
|
-
|
|
778
|
-
|
|
1043
|
+
if (t === "function") {
|
|
1044
|
+
let v;
|
|
1045
|
+
try {
|
|
1046
|
+
v = node();
|
|
1047
|
+
} catch (err) {
|
|
1048
|
+
return buildAsyncWrap(err, node) || "";
|
|
1049
|
+
}
|
|
1050
|
+
return tryResolveString(v);
|
|
1051
|
+
}
|
|
1052
|
+
return "";
|
|
779
1053
|
}
|
|
780
1054
|
function resolveSSRNode(node, result = {
|
|
781
1055
|
t: [""],
|
|
@@ -786,10 +1060,13 @@ function resolveSSRNode(node, result = {
|
|
|
786
1060
|
if (t === "string" || t === "number") {
|
|
787
1061
|
result.t[result.t.length - 1] += node;
|
|
788
1062
|
} else if (node == null || t === "boolean") ; else if (Array.isArray(node)) {
|
|
789
|
-
let
|
|
1063
|
+
let prevNonObj = false;
|
|
790
1064
|
for (let i = 0, len = node.length; i < len; i++) {
|
|
791
|
-
|
|
792
|
-
|
|
1065
|
+
const item = node[i];
|
|
1066
|
+
const itemNonObj = item !== null && typeof item !== "object";
|
|
1067
|
+
if (!top && prevNonObj && itemNonObj) result.t[result.t.length - 1] += `<!--!$-->`;
|
|
1068
|
+
prevNonObj = itemNonObj;
|
|
1069
|
+
resolveSSRNode(item, result);
|
|
793
1070
|
}
|
|
794
1071
|
} else if (t === "object") {
|
|
795
1072
|
if (node.h) {
|
|
@@ -804,10 +1081,10 @@ function resolveSSRNode(node, result = {
|
|
|
804
1081
|
try {
|
|
805
1082
|
resolveSSRNode(node(), result);
|
|
806
1083
|
} catch (err) {
|
|
807
|
-
const
|
|
808
|
-
if (
|
|
809
|
-
result.h.push(
|
|
810
|
-
result.p.push(p);
|
|
1084
|
+
const wrap = buildAsyncWrap(err, node);
|
|
1085
|
+
if (wrap) {
|
|
1086
|
+
result.h.push(wrap.fn);
|
|
1087
|
+
result.p.push(wrap.p);
|
|
811
1088
|
result.t.push("");
|
|
812
1089
|
}
|
|
813
1090
|
}
|
|
@@ -832,23 +1109,25 @@ function notSup() {
|
|
|
832
1109
|
|
|
833
1110
|
const isServer = true;
|
|
834
1111
|
const isDev = false;
|
|
835
|
-
function
|
|
1112
|
+
function dynamic(source) {
|
|
836
1113
|
const o = solidJs.getOwner();
|
|
837
1114
|
if (o?.id != null) solidJs.getNextChildId(o);
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
if (
|
|
844
|
-
return
|
|
1115
|
+
return props => {
|
|
1116
|
+
const memoOwner = solidJs.createOwner();
|
|
1117
|
+
return solidJs.runWithOwner(memoOwner, () => {
|
|
1118
|
+
const comp = source(),
|
|
1119
|
+
t = typeof comp;
|
|
1120
|
+
if (comp) {
|
|
1121
|
+
if (t === "function") return comp(props);else if (t === "string") {
|
|
1122
|
+
return ssrElement(comp, props, undefined, true);
|
|
1123
|
+
}
|
|
845
1124
|
}
|
|
846
|
-
}
|
|
847
|
-
}
|
|
1125
|
+
});
|
|
1126
|
+
};
|
|
848
1127
|
}
|
|
849
1128
|
function Dynamic(props) {
|
|
850
|
-
const
|
|
851
|
-
return
|
|
1129
|
+
const Comp = dynamic(() => props.component);
|
|
1130
|
+
return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
|
|
852
1131
|
}
|
|
853
1132
|
function Portal(props) {
|
|
854
1133
|
throw new Error("Portal is not supported on the server");
|
|
@@ -882,6 +1161,10 @@ Object.defineProperty(exports, "Repeat", {
|
|
|
882
1161
|
enumerable: true,
|
|
883
1162
|
get: function () { return solidJs.Repeat; }
|
|
884
1163
|
});
|
|
1164
|
+
Object.defineProperty(exports, "Reveal", {
|
|
1165
|
+
enumerable: true,
|
|
1166
|
+
get: function () { return solidJs.Reveal; }
|
|
1167
|
+
});
|
|
885
1168
|
Object.defineProperty(exports, "Show", {
|
|
886
1169
|
enumerable: true,
|
|
887
1170
|
get: function () { return solidJs.Show; }
|
|
@@ -898,10 +1181,6 @@ Object.defineProperty(exports, "getOwner", {
|
|
|
898
1181
|
enumerable: true,
|
|
899
1182
|
get: function () { return solidJs.getOwner; }
|
|
900
1183
|
});
|
|
901
|
-
Object.defineProperty(exports, "ssrRunInScope", {
|
|
902
|
-
enumerable: true,
|
|
903
|
-
get: function () { return solidJs.ssrRunInScope; }
|
|
904
|
-
});
|
|
905
1184
|
Object.defineProperty(exports, "untrack", {
|
|
906
1185
|
enumerable: true,
|
|
907
1186
|
get: function () { return solidJs.untrack; }
|
|
@@ -911,17 +1190,19 @@ exports.DOMElements = DOMElements;
|
|
|
911
1190
|
exports.DelegatedEvents = DelegatedEvents;
|
|
912
1191
|
exports.Dynamic = Dynamic;
|
|
913
1192
|
exports.HydrationScript = HydrationScript;
|
|
1193
|
+
exports.MathMLElements = MathMLElements;
|
|
1194
|
+
exports.Namespaces = Namespaces;
|
|
914
1195
|
exports.Portal = Portal;
|
|
915
|
-
exports.
|
|
1196
|
+
exports.RawTextElements = RawTextElements;
|
|
916
1197
|
exports.RequestContext = RequestContext;
|
|
917
1198
|
exports.SVGElements = SVGElements;
|
|
918
|
-
exports.
|
|
1199
|
+
exports.VoidElements = VoidElements;
|
|
919
1200
|
exports.addEventListener = notSup;
|
|
920
1201
|
exports.applyRef = applyRef;
|
|
921
1202
|
exports.assign = notSup;
|
|
922
1203
|
exports.className = notSup;
|
|
923
|
-
exports.createDynamic = createDynamic;
|
|
924
1204
|
exports.delegateEvents = notSup;
|
|
1205
|
+
exports.dynamic = dynamic;
|
|
925
1206
|
exports.dynamicProperty = notSup;
|
|
926
1207
|
exports.effect = effect;
|
|
927
1208
|
exports.escape = escape;
|
|
@@ -951,6 +1232,7 @@ exports.ssr = ssr;
|
|
|
951
1232
|
exports.ssrAttribute = ssrAttribute;
|
|
952
1233
|
exports.ssrClassName = ssrClassName;
|
|
953
1234
|
exports.ssrElement = ssrElement;
|
|
1235
|
+
exports.ssrGroup = ssrGroup;
|
|
954
1236
|
exports.ssrHydrationKey = ssrHydrationKey;
|
|
955
1237
|
exports.ssrStyle = ssrStyle;
|
|
956
1238
|
exports.ssrStyleProperty = ssrStyleProperty;
|