@solidjs/web 2.0.0-beta.0 → 2.0.0-beta.10
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 +238 -107
- package/dist/dev.js +218 -101
- package/dist/server.cjs +196 -105
- package/dist/server.js +182 -103
- package/dist/web.cjs +224 -98
- package/dist/web.js +204 -92
- package/package.json +98 -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 -17
- package/types/core.d.ts +1 -1
- 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 +35 -16
- 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,31 @@ 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
|
|
27
|
+
const transparentOptions = {
|
|
25
28
|
transparent: true
|
|
26
|
-
}
|
|
29
|
+
};
|
|
30
|
+
const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectFn, options ? {
|
|
31
|
+
transparent: true,
|
|
32
|
+
...options
|
|
33
|
+
} : transparentOptions);
|
|
27
34
|
const memo = fn => solidJs.createMemo(() => fn());
|
|
28
35
|
|
|
29
|
-
const ES2017FLAG = seroval.Feature.AggregateError
|
|
30
|
-
|
|
31
|
-
const GLOBAL_IDENTIFIER =
|
|
36
|
+
const ES2017FLAG = seroval.Feature.AggregateError |
|
|
37
|
+
seroval.Feature.BigIntTypedArray;
|
|
38
|
+
const GLOBAL_IDENTIFIER = "_$HY.r";
|
|
32
39
|
function createSerializer({
|
|
33
40
|
onData,
|
|
34
41
|
onDone,
|
|
@@ -51,11 +58,12 @@ function createSerializer({
|
|
|
51
58
|
});
|
|
52
59
|
}
|
|
53
60
|
function getLocalHeaderScript(id) {
|
|
54
|
-
return seroval.getCrossReferenceHeader(id) +
|
|
61
|
+
return seroval.getCrossReferenceHeader(id) + ";";
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
function resolveAssets(moduleUrl, manifest) {
|
|
58
65
|
if (!manifest) return null;
|
|
66
|
+
const base = manifest._base || "/";
|
|
59
67
|
const entry = manifest[moduleUrl];
|
|
60
68
|
if (!entry) return null;
|
|
61
69
|
const css = [];
|
|
@@ -66,8 +74,8 @@ function resolveAssets(moduleUrl, manifest) {
|
|
|
66
74
|
visited.add(key);
|
|
67
75
|
const e = manifest[key];
|
|
68
76
|
if (!e) return;
|
|
69
|
-
js.push(e.file);
|
|
70
|
-
if (e.css) for (let i = 0; i < e.css.length; i++) css.push(e.css[i]);
|
|
77
|
+
js.push(base + e.file);
|
|
78
|
+
if (e.css) for (let i = 0; i < e.css.length; i++) css.push(base + e.css[i]);
|
|
71
79
|
if (e.imports) for (let i = 0; i < e.imports.length; i++) walk(e.imports[i]);
|
|
72
80
|
};
|
|
73
81
|
walk(moduleUrl);
|
|
@@ -106,11 +114,11 @@ function createAssetTracking() {
|
|
|
106
114
|
currentBoundaryId = v;
|
|
107
115
|
},
|
|
108
116
|
registerModule(moduleUrl, entryUrl) {
|
|
109
|
-
|
|
110
|
-
let map = boundaryModules.get(
|
|
117
|
+
const id = currentBoundaryId || "";
|
|
118
|
+
let map = boundaryModules.get(id);
|
|
111
119
|
if (!map) {
|
|
112
120
|
map = {};
|
|
113
|
-
boundaryModules.set(
|
|
121
|
+
boundaryModules.set(id, map);
|
|
114
122
|
}
|
|
115
123
|
map[moduleUrl] = entryUrl;
|
|
116
124
|
},
|
|
@@ -138,7 +146,7 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
138
146
|
if (manifest) context.resolveAssets = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
139
147
|
}
|
|
140
148
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
141
|
-
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(n=document.getElementById(e)
|
|
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])}`;
|
|
142
150
|
function renderToString(code, options = {}) {
|
|
143
151
|
const {
|
|
144
152
|
renderId = "",
|
|
@@ -193,6 +201,7 @@ function renderToString(code, options = {}) {
|
|
|
193
201
|
}, {
|
|
194
202
|
id: renderId
|
|
195
203
|
});
|
|
204
|
+
serializeFragmentAssets("", tracking.boundaryModules, solidJs.sharedConfig.context);
|
|
196
205
|
solidJs.sharedConfig.context.noHydrate = true;
|
|
197
206
|
serializer.close();
|
|
198
207
|
html = injectAssets(solidJs.sharedConfig.context.assets, html);
|
|
@@ -211,10 +220,12 @@ function renderToStream(code, options = {}) {
|
|
|
211
220
|
} = options;
|
|
212
221
|
let dispose;
|
|
213
222
|
const blockingPromises = new Set();
|
|
223
|
+
let headerEmitted = false;
|
|
214
224
|
const pushTask = task => {
|
|
215
225
|
if (noScripts) return;
|
|
216
|
-
if (!
|
|
217
|
-
|
|
226
|
+
if (!headerEmitted) {
|
|
227
|
+
headerEmitted = true;
|
|
228
|
+
tasks += getLocalHeaderScript(renderId);
|
|
218
229
|
}
|
|
219
230
|
tasks += task + ";";
|
|
220
231
|
if (!timer && firstFlushed) {
|
|
@@ -240,8 +251,15 @@ function renderToStream(code, options = {}) {
|
|
|
240
251
|
onDone,
|
|
241
252
|
onError: options.onError
|
|
242
253
|
});
|
|
254
|
+
let rootAssetsSerialized = false;
|
|
255
|
+
const serializeRootAssets = () => {
|
|
256
|
+
if (rootAssetsSerialized) return;
|
|
257
|
+
rootAssetsSerialized = true;
|
|
258
|
+
serializeFragmentAssets("", tracking.boundaryModules, context);
|
|
259
|
+
};
|
|
243
260
|
const flushEnd = () => {
|
|
244
261
|
if (!registry.size) {
|
|
262
|
+
serializeRootAssets();
|
|
245
263
|
queue(() => queue(() => serializer.flush()));
|
|
246
264
|
}
|
|
247
265
|
};
|
|
@@ -263,7 +281,29 @@ function renderToStream(code, options = {}) {
|
|
|
263
281
|
let shellCompleted = false;
|
|
264
282
|
let scriptFlushed = false;
|
|
265
283
|
let headStyles;
|
|
284
|
+
const revealGroups = new Map();
|
|
266
285
|
let timer = null;
|
|
286
|
+
const emitTask = task => {
|
|
287
|
+
pushTask(`${task}${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
|
|
288
|
+
scriptFlushed = true;
|
|
289
|
+
};
|
|
290
|
+
function resolveRevealKeys(groupOrKeys, release, consume) {
|
|
291
|
+
if (Array.isArray(groupOrKeys)) return groupOrKeys.slice();
|
|
292
|
+
let group = revealGroups.get(groupOrKeys);
|
|
293
|
+
if (!group) {
|
|
294
|
+
if (!release) return;
|
|
295
|
+
group = {
|
|
296
|
+
order: [],
|
|
297
|
+
keys: new Set(),
|
|
298
|
+
released: true
|
|
299
|
+
};
|
|
300
|
+
revealGroups.set(groupOrKeys, group);
|
|
301
|
+
} else if (release) group.released = true;
|
|
302
|
+
if (!group.order.length) return;
|
|
303
|
+
const keys = group.order.slice();
|
|
304
|
+
if (consume) revealGroups.delete(groupOrKeys);
|
|
305
|
+
return keys;
|
|
306
|
+
}
|
|
267
307
|
let rootHoles = null;
|
|
268
308
|
let nextHoleId = 0;
|
|
269
309
|
let buffer = {
|
|
@@ -313,7 +353,26 @@ function renderToStream(code, options = {}) {
|
|
|
313
353
|
escape: escape,
|
|
314
354
|
resolve: resolveSSRNode,
|
|
315
355
|
ssr: ssr,
|
|
316
|
-
registerFragment(key) {
|
|
356
|
+
registerFragment(key, options) {
|
|
357
|
+
const revealGroup = options && options.revealGroup;
|
|
358
|
+
if (revealGroup) {
|
|
359
|
+
let group = revealGroups.get(revealGroup);
|
|
360
|
+
if (!group) {
|
|
361
|
+
group = {
|
|
362
|
+
order: [],
|
|
363
|
+
keys: new Set(),
|
|
364
|
+
released: false
|
|
365
|
+
};
|
|
366
|
+
revealGroups.set(revealGroup, group);
|
|
367
|
+
}
|
|
368
|
+
if (!group.keys.has(key)) {
|
|
369
|
+
group.keys.add(key);
|
|
370
|
+
group.order.push(key);
|
|
371
|
+
}
|
|
372
|
+
if (group.released) {
|
|
373
|
+
throw new Error("registerFragment() for reveal group '" + revealGroup + "' was called after revealFragments(). Ensure template payload is emitted before grouped reveal.");
|
|
374
|
+
}
|
|
375
|
+
}
|
|
317
376
|
if (!registry.has(key)) {
|
|
318
377
|
let resolve, reject;
|
|
319
378
|
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
@@ -323,7 +382,7 @@ function renderToStream(code, options = {}) {
|
|
|
323
382
|
queue(flushEnd);
|
|
324
383
|
}))
|
|
325
384
|
});
|
|
326
|
-
serializer.write(key, p);
|
|
385
|
+
serializer.write(key + "_fr", p);
|
|
327
386
|
}
|
|
328
387
|
return (value, error) => {
|
|
329
388
|
if (registry.has(key)) {
|
|
@@ -352,9 +411,9 @@ function renderToStream(code, options = {}) {
|
|
|
352
411
|
} else {
|
|
353
412
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
354
413
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
414
|
+
const deferActivation = !!revealGroup;
|
|
355
415
|
if (styles.length) {
|
|
356
|
-
|
|
357
|
-
scriptFlushed = true;
|
|
416
|
+
emitTask(`$dfs("${key}",${styles.length},${deferActivation ? 1 : 0})`);
|
|
358
417
|
writeTasks();
|
|
359
418
|
for (const url of styles) {
|
|
360
419
|
buffer.write(`<link rel="stylesheet" href="${url}" onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
@@ -362,8 +421,9 @@ function renderToStream(code, options = {}) {
|
|
|
362
421
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
363
422
|
} else {
|
|
364
423
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
365
|
-
|
|
366
|
-
|
|
424
|
+
if (!deferActivation) {
|
|
425
|
+
emitTask(`$df("${key}")`);
|
|
426
|
+
}
|
|
367
427
|
}
|
|
368
428
|
item.resolve(error);
|
|
369
429
|
}
|
|
@@ -371,6 +431,16 @@ function renderToStream(code, options = {}) {
|
|
|
371
431
|
}
|
|
372
432
|
return firstFlushed;
|
|
373
433
|
};
|
|
434
|
+
},
|
|
435
|
+
revealFragments(groupOrKeys) {
|
|
436
|
+
const keys = resolveRevealKeys(groupOrKeys, true, true);
|
|
437
|
+
if (!keys) return;
|
|
438
|
+
emitTask(`$dfj(${JSON.stringify(keys)})`);
|
|
439
|
+
},
|
|
440
|
+
revealFallbacks(groupOrKeys) {
|
|
441
|
+
const keys = resolveRevealKeys(groupOrKeys, false, false);
|
|
442
|
+
if (!keys) return;
|
|
443
|
+
emitTask(`$dflj(${JSON.stringify(keys)})`);
|
|
374
444
|
}
|
|
375
445
|
};
|
|
376
446
|
applyAssetTracking(context, tracking, manifest);
|
|
@@ -397,13 +467,32 @@ function renderToStream(code, options = {}) {
|
|
|
397
467
|
function doShell() {
|
|
398
468
|
if (shellCompleted) return;
|
|
399
469
|
if (rootHoles) {
|
|
470
|
+
const pending = [];
|
|
400
471
|
for (const {
|
|
401
472
|
id,
|
|
402
473
|
fn
|
|
403
474
|
} of rootHoles) {
|
|
404
475
|
const marker = `<!--rh${id}-->`;
|
|
405
476
|
const res = resolveSSRNode(fn);
|
|
406
|
-
|
|
477
|
+
if (!res.h.length) {
|
|
478
|
+
html = html.replace(marker, res.t[0]);
|
|
479
|
+
} else {
|
|
480
|
+
let out = res.t[0];
|
|
481
|
+
for (let j = 0; j < res.h.length; j++) {
|
|
482
|
+
const newId = nextHoleId++;
|
|
483
|
+
pending.push({
|
|
484
|
+
id: newId,
|
|
485
|
+
fn: res.h[j]
|
|
486
|
+
});
|
|
487
|
+
out += `<!--rh${newId}-->` + res.t[j + 1];
|
|
488
|
+
}
|
|
489
|
+
html = html.replace(marker, out);
|
|
490
|
+
for (const p of res.p) blockingPromises.add(p);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
if (pending.length) {
|
|
494
|
+
rootHoles = pending;
|
|
495
|
+
return;
|
|
407
496
|
}
|
|
408
497
|
rootHoles = null;
|
|
409
498
|
}
|
|
@@ -414,6 +503,7 @@ function renderToStream(code, options = {}) {
|
|
|
414
503
|
if (url.endsWith(".css")) headStyles.add(url);
|
|
415
504
|
}
|
|
416
505
|
html = injectPreloadLinks(tracking.emittedAssets, html);
|
|
506
|
+
serializeRootAssets();
|
|
417
507
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
418
508
|
buffer.write(html);
|
|
419
509
|
tasks = "";
|
|
@@ -440,48 +530,56 @@ function renderToStream(code, options = {}) {
|
|
|
440
530
|
queue(flushEnd);
|
|
441
531
|
},
|
|
442
532
|
pipe(w) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
533
|
+
function flush() {
|
|
534
|
+
allSettled(blockingPromises).then(() => {
|
|
535
|
+
setTimeout(() => {
|
|
536
|
+
doShell();
|
|
537
|
+
if (!shellCompleted) return flush();
|
|
538
|
+
buffer = writable = w;
|
|
539
|
+
buffer.write(tmp);
|
|
540
|
+
firstFlushed = true;
|
|
541
|
+
if (completed) {
|
|
542
|
+
dispose();
|
|
543
|
+
writable.end();
|
|
544
|
+
} else flushEnd();
|
|
545
|
+
});
|
|
453
546
|
});
|
|
454
|
-
}
|
|
547
|
+
}
|
|
548
|
+
flush();
|
|
455
549
|
},
|
|
456
550
|
pipeTo(w) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
551
|
+
let resolve;
|
|
552
|
+
const p = new Promise(r => resolve = r);
|
|
553
|
+
function flush() {
|
|
554
|
+
allSettled(blockingPromises).then(() => {
|
|
555
|
+
setTimeout(() => {
|
|
556
|
+
doShell();
|
|
557
|
+
if (!shellCompleted) return flush();
|
|
558
|
+
const encoder = new TextEncoder();
|
|
559
|
+
const writer = w.getWriter();
|
|
560
|
+
writable = {
|
|
561
|
+
end() {
|
|
562
|
+
writer.releaseLock();
|
|
563
|
+
w.close().catch(() => {});
|
|
564
|
+
resolve();
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
buffer = {
|
|
568
|
+
write(payload) {
|
|
569
|
+
writer.write(encoder.encode(payload)).catch(() => {});
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
buffer.write(tmp);
|
|
573
|
+
firstFlushed = true;
|
|
574
|
+
if (completed) {
|
|
575
|
+
dispose();
|
|
576
|
+
writable.end();
|
|
577
|
+
} else flushEnd();
|
|
578
|
+
});
|
|
482
579
|
});
|
|
483
|
-
|
|
484
|
-
|
|
580
|
+
}
|
|
581
|
+
flush();
|
|
582
|
+
return p;
|
|
485
583
|
}
|
|
486
584
|
};
|
|
487
585
|
}
|
|
@@ -511,7 +609,7 @@ function ssrClassName(value) {
|
|
|
511
609
|
classValue = !!value[key];
|
|
512
610
|
if (!key || key === "undefined" || !classValue) continue;
|
|
513
611
|
i && (result += " ");
|
|
514
|
-
result += escape(key);
|
|
612
|
+
result += escape(key, true);
|
|
515
613
|
}
|
|
516
614
|
return result;
|
|
517
615
|
}
|
|
@@ -521,8 +619,8 @@ function ssrStyle(value) {
|
|
|
521
619
|
let result = "";
|
|
522
620
|
const k = Object.keys(value);
|
|
523
621
|
for (let i = 0; i < k.length; i++) {
|
|
524
|
-
const s = k[i];
|
|
525
|
-
const v = value[
|
|
622
|
+
const s = escape(k[i], true);
|
|
623
|
+
const v = value[k[i]];
|
|
526
624
|
if (v != undefined) {
|
|
527
625
|
if (i) result += ";";
|
|
528
626
|
const r = escape(v, true);
|
|
@@ -646,7 +744,7 @@ function mergeProps(...sources) {
|
|
|
646
744
|
}
|
|
647
745
|
function getHydrationKey() {
|
|
648
746
|
const hydrate = solidJs.sharedConfig.context;
|
|
649
|
-
return hydrate &&
|
|
747
|
+
return hydrate && solidJs.sharedConfig.getNextContextId();
|
|
650
748
|
}
|
|
651
749
|
function applyRef(r, element) {
|
|
652
750
|
Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
|
|
@@ -664,28 +762,7 @@ function generateHydrationScript({
|
|
|
664
762
|
eventNames = ["click", "input"],
|
|
665
763
|
nonce
|
|
666
764
|
} = {}) {
|
|
667
|
-
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('",
|
|
668
|
-
}
|
|
669
|
-
function Hydration(props) {
|
|
670
|
-
if (!solidJs.sharedConfig.context.noHydrate) return props.children;
|
|
671
|
-
const context = solidJs.sharedConfig.context;
|
|
672
|
-
solidJs.sharedConfig.context = {
|
|
673
|
-
...context,
|
|
674
|
-
noHydrate: false
|
|
675
|
-
};
|
|
676
|
-
const res = props.children;
|
|
677
|
-
solidJs.sharedConfig.context = context;
|
|
678
|
-
return res;
|
|
679
|
-
}
|
|
680
|
-
function NoHydration(props) {
|
|
681
|
-
let context = solidJs.sharedConfig.context;
|
|
682
|
-
if (context) solidJs.sharedConfig.context = {
|
|
683
|
-
...context,
|
|
684
|
-
noHydrate: true
|
|
685
|
-
};
|
|
686
|
-
const res = props.children;
|
|
687
|
-
if (context) solidJs.sharedConfig.context = context;
|
|
688
|
-
return res;
|
|
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-->`;
|
|
689
766
|
}
|
|
690
767
|
function queue(fn) {
|
|
691
768
|
return Promise.resolve().then(fn);
|
|
@@ -852,23 +929,25 @@ function notSup() {
|
|
|
852
929
|
|
|
853
930
|
const isServer = true;
|
|
854
931
|
const isDev = false;
|
|
855
|
-
function
|
|
932
|
+
function dynamic(source) {
|
|
856
933
|
const o = solidJs.getOwner();
|
|
857
934
|
if (o?.id != null) solidJs.getNextChildId(o);
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
if (
|
|
864
|
-
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
|
+
}
|
|
865
944
|
}
|
|
866
|
-
}
|
|
867
|
-
}
|
|
945
|
+
});
|
|
946
|
+
};
|
|
868
947
|
}
|
|
869
948
|
function Dynamic(props) {
|
|
870
|
-
const
|
|
871
|
-
return
|
|
949
|
+
const Comp = dynamic(() => props.component);
|
|
950
|
+
return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
|
|
872
951
|
}
|
|
873
952
|
function Portal(props) {
|
|
874
953
|
throw new Error("Portal is not supported on the server");
|
|
@@ -882,6 +961,10 @@ Object.defineProperty(exports, "For", {
|
|
|
882
961
|
enumerable: true,
|
|
883
962
|
get: function () { return solidJs.For; }
|
|
884
963
|
});
|
|
964
|
+
Object.defineProperty(exports, "Hydration", {
|
|
965
|
+
enumerable: true,
|
|
966
|
+
get: function () { return solidJs.Hydration; }
|
|
967
|
+
});
|
|
885
968
|
Object.defineProperty(exports, "Loading", {
|
|
886
969
|
enumerable: true,
|
|
887
970
|
get: function () { return solidJs.Loading; }
|
|
@@ -890,10 +973,18 @@ Object.defineProperty(exports, "Match", {
|
|
|
890
973
|
enumerable: true,
|
|
891
974
|
get: function () { return solidJs.Match; }
|
|
892
975
|
});
|
|
976
|
+
Object.defineProperty(exports, "NoHydration", {
|
|
977
|
+
enumerable: true,
|
|
978
|
+
get: function () { return solidJs.NoHydration; }
|
|
979
|
+
});
|
|
893
980
|
Object.defineProperty(exports, "Repeat", {
|
|
894
981
|
enumerable: true,
|
|
895
982
|
get: function () { return solidJs.Repeat; }
|
|
896
983
|
});
|
|
984
|
+
Object.defineProperty(exports, "Reveal", {
|
|
985
|
+
enumerable: true,
|
|
986
|
+
get: function () { return solidJs.Reveal; }
|
|
987
|
+
});
|
|
897
988
|
Object.defineProperty(exports, "Show", {
|
|
898
989
|
enumerable: true,
|
|
899
990
|
get: function () { return solidJs.Show; }
|
|
@@ -922,20 +1013,20 @@ exports.ChildProperties = ChildProperties;
|
|
|
922
1013
|
exports.DOMElements = DOMElements;
|
|
923
1014
|
exports.DelegatedEvents = DelegatedEvents;
|
|
924
1015
|
exports.Dynamic = Dynamic;
|
|
925
|
-
exports.Hydration = Hydration;
|
|
926
1016
|
exports.HydrationScript = HydrationScript;
|
|
927
|
-
exports.
|
|
1017
|
+
exports.MathMLElements = MathMLElements;
|
|
1018
|
+
exports.Namespaces = Namespaces;
|
|
928
1019
|
exports.Portal = Portal;
|
|
929
|
-
exports.
|
|
1020
|
+
exports.RawTextElements = RawTextElements;
|
|
930
1021
|
exports.RequestContext = RequestContext;
|
|
931
1022
|
exports.SVGElements = SVGElements;
|
|
932
|
-
exports.
|
|
1023
|
+
exports.VoidElements = VoidElements;
|
|
933
1024
|
exports.addEventListener = notSup;
|
|
934
1025
|
exports.applyRef = applyRef;
|
|
935
1026
|
exports.assign = notSup;
|
|
936
1027
|
exports.className = notSup;
|
|
937
|
-
exports.createDynamic = createDynamic;
|
|
938
1028
|
exports.delegateEvents = notSup;
|
|
1029
|
+
exports.dynamic = dynamic;
|
|
939
1030
|
exports.dynamicProperty = notSup;
|
|
940
1031
|
exports.effect = effect;
|
|
941
1032
|
exports.escape = escape;
|