@solidjs/web 2.0.0-beta.1 → 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 +223 -95
- package/dist/dev.js +211 -91
- package/dist/server.cjs +184 -79
- package/dist/server.js +178 -79
- package/dist/web.cjs +209 -86
- package/dist/web.js +197 -82
- 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 -15
- 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 -17
- 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.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, omit, getOwner, getNextChildId, createOwner, runWithOwner } from 'solid-js';
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Show, Switch, createComponent, getOwner, ssrRunInScope, untrack } from 'solid-js';
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, createComponent, omit, getOwner, getNextChildId, createOwner, runWithOwner } from 'solid-js';
|
|
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
5
|
|
|
6
|
-
const Properties = /*#__PURE__*/new Set([
|
|
7
|
-
"value", "checked", "selected", "muted"]);
|
|
8
6
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
9
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"]);
|
|
10
8
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -12,22 +10,31 @@ const SVGElements = /*#__PURE__*/new Set([
|
|
|
12
10
|
"set", "stop",
|
|
13
11
|
"svg", "switch", "symbol", "text", "textPath",
|
|
14
12
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
15
|
-
const
|
|
13
|
+
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"]);
|
|
14
|
+
const Namespaces = {
|
|
15
|
+
svg: "http://www.w3.org/2000/svg",
|
|
16
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
16
17
|
xlink: "http://www.w3.org/1999/xlink",
|
|
17
18
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
18
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"]);
|
|
19
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",
|
|
20
23
|
"webview",
|
|
21
24
|
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
22
25
|
|
|
23
|
-
const
|
|
26
|
+
const transparentOptions = {
|
|
24
27
|
transparent: true
|
|
25
|
-
}
|
|
28
|
+
};
|
|
29
|
+
const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
|
|
30
|
+
transparent: true,
|
|
31
|
+
...options
|
|
32
|
+
} : transparentOptions);
|
|
26
33
|
const memo = fn => createMemo(() => fn());
|
|
27
34
|
|
|
28
|
-
const ES2017FLAG = Feature.AggregateError
|
|
29
|
-
|
|
30
|
-
const GLOBAL_IDENTIFIER =
|
|
35
|
+
const ES2017FLAG = Feature.AggregateError |
|
|
36
|
+
Feature.BigIntTypedArray;
|
|
37
|
+
const GLOBAL_IDENTIFIER = "_$HY.r";
|
|
31
38
|
function createSerializer({
|
|
32
39
|
onData,
|
|
33
40
|
onDone,
|
|
@@ -50,7 +57,7 @@ function createSerializer({
|
|
|
50
57
|
});
|
|
51
58
|
}
|
|
52
59
|
function getLocalHeaderScript(id) {
|
|
53
|
-
return getCrossReferenceHeader(id) +
|
|
60
|
+
return getCrossReferenceHeader(id) + ";";
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
function resolveAssets(moduleUrl, manifest) {
|
|
@@ -106,11 +113,11 @@ function createAssetTracking() {
|
|
|
106
113
|
currentBoundaryId = v;
|
|
107
114
|
},
|
|
108
115
|
registerModule(moduleUrl, entryUrl) {
|
|
109
|
-
|
|
110
|
-
let map = boundaryModules.get(
|
|
116
|
+
const id = currentBoundaryId || "";
|
|
117
|
+
let map = boundaryModules.get(id);
|
|
111
118
|
if (!map) {
|
|
112
119
|
map = {};
|
|
113
|
-
boundaryModules.set(
|
|
120
|
+
boundaryModules.set(id, map);
|
|
114
121
|
}
|
|
115
122
|
map[moduleUrl] = entryUrl;
|
|
116
123
|
},
|
|
@@ -138,7 +145,7 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
138
145
|
if (manifest) context.resolveAssets = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
139
146
|
}
|
|
140
147
|
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)
|
|
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])}`;
|
|
142
149
|
function renderToString(code, options = {}) {
|
|
143
150
|
const {
|
|
144
151
|
renderId = "",
|
|
@@ -193,6 +200,7 @@ function renderToString(code, options = {}) {
|
|
|
193
200
|
}, {
|
|
194
201
|
id: renderId
|
|
195
202
|
});
|
|
203
|
+
serializeFragmentAssets("", tracking.boundaryModules, sharedConfig.context);
|
|
196
204
|
sharedConfig.context.noHydrate = true;
|
|
197
205
|
serializer.close();
|
|
198
206
|
html = injectAssets(sharedConfig.context.assets, html);
|
|
@@ -211,10 +219,12 @@ function renderToStream(code, options = {}) {
|
|
|
211
219
|
} = options;
|
|
212
220
|
let dispose;
|
|
213
221
|
const blockingPromises = new Set();
|
|
222
|
+
let headerEmitted = false;
|
|
214
223
|
const pushTask = task => {
|
|
215
224
|
if (noScripts) return;
|
|
216
|
-
if (!
|
|
217
|
-
|
|
225
|
+
if (!headerEmitted) {
|
|
226
|
+
headerEmitted = true;
|
|
227
|
+
tasks += getLocalHeaderScript(renderId);
|
|
218
228
|
}
|
|
219
229
|
tasks += task + ";";
|
|
220
230
|
if (!timer && firstFlushed) {
|
|
@@ -240,8 +250,15 @@ function renderToStream(code, options = {}) {
|
|
|
240
250
|
onDone,
|
|
241
251
|
onError: options.onError
|
|
242
252
|
});
|
|
253
|
+
let rootAssetsSerialized = false;
|
|
254
|
+
const serializeRootAssets = () => {
|
|
255
|
+
if (rootAssetsSerialized) return;
|
|
256
|
+
rootAssetsSerialized = true;
|
|
257
|
+
serializeFragmentAssets("", tracking.boundaryModules, context);
|
|
258
|
+
};
|
|
243
259
|
const flushEnd = () => {
|
|
244
260
|
if (!registry.size) {
|
|
261
|
+
serializeRootAssets();
|
|
245
262
|
queue(() => queue(() => serializer.flush()));
|
|
246
263
|
}
|
|
247
264
|
};
|
|
@@ -263,7 +280,29 @@ function renderToStream(code, options = {}) {
|
|
|
263
280
|
let shellCompleted = false;
|
|
264
281
|
let scriptFlushed = false;
|
|
265
282
|
let headStyles;
|
|
283
|
+
const revealGroups = new Map();
|
|
266
284
|
let timer = null;
|
|
285
|
+
const emitTask = task => {
|
|
286
|
+
pushTask(`${task}${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
|
|
287
|
+
scriptFlushed = true;
|
|
288
|
+
};
|
|
289
|
+
function resolveRevealKeys(groupOrKeys, release, consume) {
|
|
290
|
+
if (Array.isArray(groupOrKeys)) return groupOrKeys.slice();
|
|
291
|
+
let group = revealGroups.get(groupOrKeys);
|
|
292
|
+
if (!group) {
|
|
293
|
+
if (!release) return;
|
|
294
|
+
group = {
|
|
295
|
+
order: [],
|
|
296
|
+
keys: new Set(),
|
|
297
|
+
released: true
|
|
298
|
+
};
|
|
299
|
+
revealGroups.set(groupOrKeys, group);
|
|
300
|
+
} else if (release) group.released = true;
|
|
301
|
+
if (!group.order.length) return;
|
|
302
|
+
const keys = group.order.slice();
|
|
303
|
+
if (consume) revealGroups.delete(groupOrKeys);
|
|
304
|
+
return keys;
|
|
305
|
+
}
|
|
267
306
|
let rootHoles = null;
|
|
268
307
|
let nextHoleId = 0;
|
|
269
308
|
let buffer = {
|
|
@@ -313,7 +352,26 @@ function renderToStream(code, options = {}) {
|
|
|
313
352
|
escape: escape,
|
|
314
353
|
resolve: resolveSSRNode,
|
|
315
354
|
ssr: ssr,
|
|
316
|
-
registerFragment(key) {
|
|
355
|
+
registerFragment(key, options) {
|
|
356
|
+
const revealGroup = options && options.revealGroup;
|
|
357
|
+
if (revealGroup) {
|
|
358
|
+
let group = revealGroups.get(revealGroup);
|
|
359
|
+
if (!group) {
|
|
360
|
+
group = {
|
|
361
|
+
order: [],
|
|
362
|
+
keys: new Set(),
|
|
363
|
+
released: false
|
|
364
|
+
};
|
|
365
|
+
revealGroups.set(revealGroup, group);
|
|
366
|
+
}
|
|
367
|
+
if (!group.keys.has(key)) {
|
|
368
|
+
group.keys.add(key);
|
|
369
|
+
group.order.push(key);
|
|
370
|
+
}
|
|
371
|
+
if (group.released) {
|
|
372
|
+
throw new Error("registerFragment() for reveal group '" + revealGroup + "' was called after revealFragments(). Ensure template payload is emitted before grouped reveal.");
|
|
373
|
+
}
|
|
374
|
+
}
|
|
317
375
|
if (!registry.has(key)) {
|
|
318
376
|
let resolve, reject;
|
|
319
377
|
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
@@ -323,7 +381,7 @@ function renderToStream(code, options = {}) {
|
|
|
323
381
|
queue(flushEnd);
|
|
324
382
|
}))
|
|
325
383
|
});
|
|
326
|
-
serializer.write(key, p);
|
|
384
|
+
serializer.write(key + "_fr", p);
|
|
327
385
|
}
|
|
328
386
|
return (value, error) => {
|
|
329
387
|
if (registry.has(key)) {
|
|
@@ -352,9 +410,9 @@ function renderToStream(code, options = {}) {
|
|
|
352
410
|
} else {
|
|
353
411
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
354
412
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
413
|
+
const deferActivation = !!revealGroup;
|
|
355
414
|
if (styles.length) {
|
|
356
|
-
|
|
357
|
-
scriptFlushed = true;
|
|
415
|
+
emitTask(`$dfs("${key}",${styles.length},${deferActivation ? 1 : 0})`);
|
|
358
416
|
writeTasks();
|
|
359
417
|
for (const url of styles) {
|
|
360
418
|
buffer.write(`<link rel="stylesheet" href="${url}" onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
@@ -362,8 +420,9 @@ function renderToStream(code, options = {}) {
|
|
|
362
420
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
363
421
|
} else {
|
|
364
422
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
365
|
-
|
|
366
|
-
|
|
423
|
+
if (!deferActivation) {
|
|
424
|
+
emitTask(`$df("${key}")`);
|
|
425
|
+
}
|
|
367
426
|
}
|
|
368
427
|
item.resolve(error);
|
|
369
428
|
}
|
|
@@ -371,6 +430,16 @@ function renderToStream(code, options = {}) {
|
|
|
371
430
|
}
|
|
372
431
|
return firstFlushed;
|
|
373
432
|
};
|
|
433
|
+
},
|
|
434
|
+
revealFragments(groupOrKeys) {
|
|
435
|
+
const keys = resolveRevealKeys(groupOrKeys, true, true);
|
|
436
|
+
if (!keys) return;
|
|
437
|
+
emitTask(`$dfj(${JSON.stringify(keys)})`);
|
|
438
|
+
},
|
|
439
|
+
revealFallbacks(groupOrKeys) {
|
|
440
|
+
const keys = resolveRevealKeys(groupOrKeys, false, false);
|
|
441
|
+
if (!keys) return;
|
|
442
|
+
emitTask(`$dflj(${JSON.stringify(keys)})`);
|
|
374
443
|
}
|
|
375
444
|
};
|
|
376
445
|
applyAssetTracking(context, tracking, manifest);
|
|
@@ -397,13 +466,32 @@ function renderToStream(code, options = {}) {
|
|
|
397
466
|
function doShell() {
|
|
398
467
|
if (shellCompleted) return;
|
|
399
468
|
if (rootHoles) {
|
|
469
|
+
const pending = [];
|
|
400
470
|
for (const {
|
|
401
471
|
id,
|
|
402
472
|
fn
|
|
403
473
|
} of rootHoles) {
|
|
404
474
|
const marker = `<!--rh${id}-->`;
|
|
405
475
|
const res = resolveSSRNode(fn);
|
|
406
|
-
|
|
476
|
+
if (!res.h.length) {
|
|
477
|
+
html = html.replace(marker, res.t[0]);
|
|
478
|
+
} else {
|
|
479
|
+
let out = res.t[0];
|
|
480
|
+
for (let j = 0; j < res.h.length; j++) {
|
|
481
|
+
const newId = nextHoleId++;
|
|
482
|
+
pending.push({
|
|
483
|
+
id: newId,
|
|
484
|
+
fn: res.h[j]
|
|
485
|
+
});
|
|
486
|
+
out += `<!--rh${newId}-->` + res.t[j + 1];
|
|
487
|
+
}
|
|
488
|
+
html = html.replace(marker, out);
|
|
489
|
+
for (const p of res.p) blockingPromises.add(p);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
if (pending.length) {
|
|
493
|
+
rootHoles = pending;
|
|
494
|
+
return;
|
|
407
495
|
}
|
|
408
496
|
rootHoles = null;
|
|
409
497
|
}
|
|
@@ -414,6 +502,7 @@ function renderToStream(code, options = {}) {
|
|
|
414
502
|
if (url.endsWith(".css")) headStyles.add(url);
|
|
415
503
|
}
|
|
416
504
|
html = injectPreloadLinks(tracking.emittedAssets, html);
|
|
505
|
+
serializeRootAssets();
|
|
417
506
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
418
507
|
buffer.write(html);
|
|
419
508
|
tasks = "";
|
|
@@ -440,48 +529,56 @@ function renderToStream(code, options = {}) {
|
|
|
440
529
|
queue(flushEnd);
|
|
441
530
|
},
|
|
442
531
|
pipe(w) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
532
|
+
function flush() {
|
|
533
|
+
allSettled(blockingPromises).then(() => {
|
|
534
|
+
setTimeout(() => {
|
|
535
|
+
doShell();
|
|
536
|
+
if (!shellCompleted) return flush();
|
|
537
|
+
buffer = writable = w;
|
|
538
|
+
buffer.write(tmp);
|
|
539
|
+
firstFlushed = true;
|
|
540
|
+
if (completed) {
|
|
541
|
+
dispose();
|
|
542
|
+
writable.end();
|
|
543
|
+
} else flushEnd();
|
|
544
|
+
});
|
|
453
545
|
});
|
|
454
|
-
}
|
|
546
|
+
}
|
|
547
|
+
flush();
|
|
455
548
|
},
|
|
456
549
|
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
|
-
|
|
550
|
+
let resolve;
|
|
551
|
+
const p = new Promise(r => resolve = r);
|
|
552
|
+
function flush() {
|
|
553
|
+
allSettled(blockingPromises).then(() => {
|
|
554
|
+
setTimeout(() => {
|
|
555
|
+
doShell();
|
|
556
|
+
if (!shellCompleted) return flush();
|
|
557
|
+
const encoder = new TextEncoder();
|
|
558
|
+
const writer = w.getWriter();
|
|
559
|
+
writable = {
|
|
560
|
+
end() {
|
|
561
|
+
writer.releaseLock();
|
|
562
|
+
w.close().catch(() => {});
|
|
563
|
+
resolve();
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
buffer = {
|
|
567
|
+
write(payload) {
|
|
568
|
+
writer.write(encoder.encode(payload)).catch(() => {});
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
buffer.write(tmp);
|
|
572
|
+
firstFlushed = true;
|
|
573
|
+
if (completed) {
|
|
574
|
+
dispose();
|
|
575
|
+
writable.end();
|
|
576
|
+
} else flushEnd();
|
|
577
|
+
});
|
|
482
578
|
});
|
|
483
|
-
|
|
484
|
-
|
|
579
|
+
}
|
|
580
|
+
flush();
|
|
581
|
+
return p;
|
|
485
582
|
}
|
|
486
583
|
};
|
|
487
584
|
}
|
|
@@ -511,7 +608,7 @@ function ssrClassName(value) {
|
|
|
511
608
|
classValue = !!value[key];
|
|
512
609
|
if (!key || key === "undefined" || !classValue) continue;
|
|
513
610
|
i && (result += " ");
|
|
514
|
-
result += escape(key);
|
|
611
|
+
result += escape(key, true);
|
|
515
612
|
}
|
|
516
613
|
return result;
|
|
517
614
|
}
|
|
@@ -521,8 +618,8 @@ function ssrStyle(value) {
|
|
|
521
618
|
let result = "";
|
|
522
619
|
const k = Object.keys(value);
|
|
523
620
|
for (let i = 0; i < k.length; i++) {
|
|
524
|
-
const s = k[i];
|
|
525
|
-
const v = value[
|
|
621
|
+
const s = escape(k[i], true);
|
|
622
|
+
const v = value[k[i]];
|
|
526
623
|
if (v != undefined) {
|
|
527
624
|
if (i) result += ";";
|
|
528
625
|
const r = escape(v, true);
|
|
@@ -664,7 +761,7 @@ function generateHydrationScript({
|
|
|
664
761
|
eventNames = ["click", "input"],
|
|
665
762
|
nonce
|
|
666
763
|
} = {}) {
|
|
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('",
|
|
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-->`;
|
|
668
765
|
}
|
|
669
766
|
function queue(fn) {
|
|
670
767
|
return Promise.resolve().then(fn);
|
|
@@ -831,26 +928,28 @@ function notSup() {
|
|
|
831
928
|
|
|
832
929
|
const isServer = true;
|
|
833
930
|
const isDev = false;
|
|
834
|
-
function
|
|
931
|
+
function dynamic(source) {
|
|
835
932
|
const o = getOwner();
|
|
836
933
|
if (o?.id != null) getNextChildId(o);
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
if (
|
|
843
|
-
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
|
+
}
|
|
844
943
|
}
|
|
845
|
-
}
|
|
846
|
-
}
|
|
944
|
+
});
|
|
945
|
+
};
|
|
847
946
|
}
|
|
848
947
|
function Dynamic(props) {
|
|
849
|
-
const
|
|
850
|
-
return
|
|
948
|
+
const Comp = dynamic(() => props.component);
|
|
949
|
+
return createComponent(Comp, omit(props, "component"));
|
|
851
950
|
}
|
|
852
951
|
function Portal(props) {
|
|
853
952
|
throw new Error("Portal is not supported on the server");
|
|
854
953
|
}
|
|
855
954
|
|
|
856
|
-
export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, HydrationScript, Portal,
|
|
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 };
|