@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.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, Loading, Match, 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,11 +57,12 @@ 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) {
|
|
57
64
|
if (!manifest) return null;
|
|
65
|
+
const base = manifest._base || "/";
|
|
58
66
|
const entry = manifest[moduleUrl];
|
|
59
67
|
if (!entry) return null;
|
|
60
68
|
const css = [];
|
|
@@ -65,8 +73,8 @@ function resolveAssets(moduleUrl, manifest) {
|
|
|
65
73
|
visited.add(key);
|
|
66
74
|
const e = manifest[key];
|
|
67
75
|
if (!e) return;
|
|
68
|
-
js.push(e.file);
|
|
69
|
-
if (e.css) for (let i = 0; i < e.css.length; i++) css.push(e.css[i]);
|
|
76
|
+
js.push(base + e.file);
|
|
77
|
+
if (e.css) for (let i = 0; i < e.css.length; i++) css.push(base + e.css[i]);
|
|
70
78
|
if (e.imports) for (let i = 0; i < e.imports.length; i++) walk(e.imports[i]);
|
|
71
79
|
};
|
|
72
80
|
walk(moduleUrl);
|
|
@@ -105,11 +113,11 @@ function createAssetTracking() {
|
|
|
105
113
|
currentBoundaryId = v;
|
|
106
114
|
},
|
|
107
115
|
registerModule(moduleUrl, entryUrl) {
|
|
108
|
-
|
|
109
|
-
let map = boundaryModules.get(
|
|
116
|
+
const id = currentBoundaryId || "";
|
|
117
|
+
let map = boundaryModules.get(id);
|
|
110
118
|
if (!map) {
|
|
111
119
|
map = {};
|
|
112
|
-
boundaryModules.set(
|
|
120
|
+
boundaryModules.set(id, map);
|
|
113
121
|
}
|
|
114
122
|
map[moduleUrl] = entryUrl;
|
|
115
123
|
},
|
|
@@ -137,7 +145,7 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
137
145
|
if (manifest) context.resolveAssets = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
138
146
|
}
|
|
139
147
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
140
|
-
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])}`;
|
|
141
149
|
function renderToString(code, options = {}) {
|
|
142
150
|
const {
|
|
143
151
|
renderId = "",
|
|
@@ -192,6 +200,7 @@ function renderToString(code, options = {}) {
|
|
|
192
200
|
}, {
|
|
193
201
|
id: renderId
|
|
194
202
|
});
|
|
203
|
+
serializeFragmentAssets("", tracking.boundaryModules, sharedConfig.context);
|
|
195
204
|
sharedConfig.context.noHydrate = true;
|
|
196
205
|
serializer.close();
|
|
197
206
|
html = injectAssets(sharedConfig.context.assets, html);
|
|
@@ -210,10 +219,12 @@ function renderToStream(code, options = {}) {
|
|
|
210
219
|
} = options;
|
|
211
220
|
let dispose;
|
|
212
221
|
const blockingPromises = new Set();
|
|
222
|
+
let headerEmitted = false;
|
|
213
223
|
const pushTask = task => {
|
|
214
224
|
if (noScripts) return;
|
|
215
|
-
if (!
|
|
216
|
-
|
|
225
|
+
if (!headerEmitted) {
|
|
226
|
+
headerEmitted = true;
|
|
227
|
+
tasks += getLocalHeaderScript(renderId);
|
|
217
228
|
}
|
|
218
229
|
tasks += task + ";";
|
|
219
230
|
if (!timer && firstFlushed) {
|
|
@@ -239,8 +250,15 @@ function renderToStream(code, options = {}) {
|
|
|
239
250
|
onDone,
|
|
240
251
|
onError: options.onError
|
|
241
252
|
});
|
|
253
|
+
let rootAssetsSerialized = false;
|
|
254
|
+
const serializeRootAssets = () => {
|
|
255
|
+
if (rootAssetsSerialized) return;
|
|
256
|
+
rootAssetsSerialized = true;
|
|
257
|
+
serializeFragmentAssets("", tracking.boundaryModules, context);
|
|
258
|
+
};
|
|
242
259
|
const flushEnd = () => {
|
|
243
260
|
if (!registry.size) {
|
|
261
|
+
serializeRootAssets();
|
|
244
262
|
queue(() => queue(() => serializer.flush()));
|
|
245
263
|
}
|
|
246
264
|
};
|
|
@@ -262,7 +280,29 @@ function renderToStream(code, options = {}) {
|
|
|
262
280
|
let shellCompleted = false;
|
|
263
281
|
let scriptFlushed = false;
|
|
264
282
|
let headStyles;
|
|
283
|
+
const revealGroups = new Map();
|
|
265
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
|
+
}
|
|
266
306
|
let rootHoles = null;
|
|
267
307
|
let nextHoleId = 0;
|
|
268
308
|
let buffer = {
|
|
@@ -312,7 +352,26 @@ function renderToStream(code, options = {}) {
|
|
|
312
352
|
escape: escape,
|
|
313
353
|
resolve: resolveSSRNode,
|
|
314
354
|
ssr: ssr,
|
|
315
|
-
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
|
+
}
|
|
316
375
|
if (!registry.has(key)) {
|
|
317
376
|
let resolve, reject;
|
|
318
377
|
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
@@ -322,7 +381,7 @@ function renderToStream(code, options = {}) {
|
|
|
322
381
|
queue(flushEnd);
|
|
323
382
|
}))
|
|
324
383
|
});
|
|
325
|
-
serializer.write(key, p);
|
|
384
|
+
serializer.write(key + "_fr", p);
|
|
326
385
|
}
|
|
327
386
|
return (value, error) => {
|
|
328
387
|
if (registry.has(key)) {
|
|
@@ -351,9 +410,9 @@ function renderToStream(code, options = {}) {
|
|
|
351
410
|
} else {
|
|
352
411
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
353
412
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
413
|
+
const deferActivation = !!revealGroup;
|
|
354
414
|
if (styles.length) {
|
|
355
|
-
|
|
356
|
-
scriptFlushed = true;
|
|
415
|
+
emitTask(`$dfs("${key}",${styles.length},${deferActivation ? 1 : 0})`);
|
|
357
416
|
writeTasks();
|
|
358
417
|
for (const url of styles) {
|
|
359
418
|
buffer.write(`<link rel="stylesheet" href="${url}" onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
@@ -361,8 +420,9 @@ function renderToStream(code, options = {}) {
|
|
|
361
420
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
362
421
|
} else {
|
|
363
422
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
364
|
-
|
|
365
|
-
|
|
423
|
+
if (!deferActivation) {
|
|
424
|
+
emitTask(`$df("${key}")`);
|
|
425
|
+
}
|
|
366
426
|
}
|
|
367
427
|
item.resolve(error);
|
|
368
428
|
}
|
|
@@ -370,6 +430,16 @@ function renderToStream(code, options = {}) {
|
|
|
370
430
|
}
|
|
371
431
|
return firstFlushed;
|
|
372
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)})`);
|
|
373
443
|
}
|
|
374
444
|
};
|
|
375
445
|
applyAssetTracking(context, tracking, manifest);
|
|
@@ -396,13 +466,32 @@ function renderToStream(code, options = {}) {
|
|
|
396
466
|
function doShell() {
|
|
397
467
|
if (shellCompleted) return;
|
|
398
468
|
if (rootHoles) {
|
|
469
|
+
const pending = [];
|
|
399
470
|
for (const {
|
|
400
471
|
id,
|
|
401
472
|
fn
|
|
402
473
|
} of rootHoles) {
|
|
403
474
|
const marker = `<!--rh${id}-->`;
|
|
404
475
|
const res = resolveSSRNode(fn);
|
|
405
|
-
|
|
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;
|
|
406
495
|
}
|
|
407
496
|
rootHoles = null;
|
|
408
497
|
}
|
|
@@ -413,6 +502,7 @@ function renderToStream(code, options = {}) {
|
|
|
413
502
|
if (url.endsWith(".css")) headStyles.add(url);
|
|
414
503
|
}
|
|
415
504
|
html = injectPreloadLinks(tracking.emittedAssets, html);
|
|
505
|
+
serializeRootAssets();
|
|
416
506
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
417
507
|
buffer.write(html);
|
|
418
508
|
tasks = "";
|
|
@@ -439,48 +529,56 @@ function renderToStream(code, options = {}) {
|
|
|
439
529
|
queue(flushEnd);
|
|
440
530
|
},
|
|
441
531
|
pipe(w) {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
+
});
|
|
452
545
|
});
|
|
453
|
-
}
|
|
546
|
+
}
|
|
547
|
+
flush();
|
|
454
548
|
},
|
|
455
549
|
pipeTo(w) {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
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
|
+
});
|
|
481
578
|
});
|
|
482
|
-
|
|
483
|
-
|
|
579
|
+
}
|
|
580
|
+
flush();
|
|
581
|
+
return p;
|
|
484
582
|
}
|
|
485
583
|
};
|
|
486
584
|
}
|
|
@@ -510,7 +608,7 @@ function ssrClassName(value) {
|
|
|
510
608
|
classValue = !!value[key];
|
|
511
609
|
if (!key || key === "undefined" || !classValue) continue;
|
|
512
610
|
i && (result += " ");
|
|
513
|
-
result += escape(key);
|
|
611
|
+
result += escape(key, true);
|
|
514
612
|
}
|
|
515
613
|
return result;
|
|
516
614
|
}
|
|
@@ -520,8 +618,8 @@ function ssrStyle(value) {
|
|
|
520
618
|
let result = "";
|
|
521
619
|
const k = Object.keys(value);
|
|
522
620
|
for (let i = 0; i < k.length; i++) {
|
|
523
|
-
const s = k[i];
|
|
524
|
-
const v = value[
|
|
621
|
+
const s = escape(k[i], true);
|
|
622
|
+
const v = value[k[i]];
|
|
525
623
|
if (v != undefined) {
|
|
526
624
|
if (i) result += ";";
|
|
527
625
|
const r = escape(v, true);
|
|
@@ -645,7 +743,7 @@ function mergeProps(...sources) {
|
|
|
645
743
|
}
|
|
646
744
|
function getHydrationKey() {
|
|
647
745
|
const hydrate = sharedConfig.context;
|
|
648
|
-
return hydrate &&
|
|
746
|
+
return hydrate && sharedConfig.getNextContextId();
|
|
649
747
|
}
|
|
650
748
|
function applyRef(r, element) {
|
|
651
749
|
Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
|
|
@@ -663,28 +761,7 @@ function generateHydrationScript({
|
|
|
663
761
|
eventNames = ["click", "input"],
|
|
664
762
|
nonce
|
|
665
763
|
} = {}) {
|
|
666
|
-
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('",
|
|
667
|
-
}
|
|
668
|
-
function Hydration(props) {
|
|
669
|
-
if (!sharedConfig.context.noHydrate) return props.children;
|
|
670
|
-
const context = sharedConfig.context;
|
|
671
|
-
sharedConfig.context = {
|
|
672
|
-
...context,
|
|
673
|
-
noHydrate: false
|
|
674
|
-
};
|
|
675
|
-
const res = props.children;
|
|
676
|
-
sharedConfig.context = context;
|
|
677
|
-
return res;
|
|
678
|
-
}
|
|
679
|
-
function NoHydration(props) {
|
|
680
|
-
let context = sharedConfig.context;
|
|
681
|
-
if (context) sharedConfig.context = {
|
|
682
|
-
...context,
|
|
683
|
-
noHydrate: true
|
|
684
|
-
};
|
|
685
|
-
const res = props.children;
|
|
686
|
-
if (context) sharedConfig.context = context;
|
|
687
|
-
return res;
|
|
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-->`;
|
|
688
765
|
}
|
|
689
766
|
function queue(fn) {
|
|
690
767
|
return Promise.resolve().then(fn);
|
|
@@ -851,26 +928,28 @@ function notSup() {
|
|
|
851
928
|
|
|
852
929
|
const isServer = true;
|
|
853
930
|
const isDev = false;
|
|
854
|
-
function
|
|
931
|
+
function dynamic(source) {
|
|
855
932
|
const o = getOwner();
|
|
856
933
|
if (o?.id != null) getNextChildId(o);
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
if (
|
|
863
|
-
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
|
+
}
|
|
864
943
|
}
|
|
865
|
-
}
|
|
866
|
-
}
|
|
944
|
+
});
|
|
945
|
+
};
|
|
867
946
|
}
|
|
868
947
|
function Dynamic(props) {
|
|
869
|
-
const
|
|
870
|
-
return
|
|
948
|
+
const Comp = dynamic(() => props.component);
|
|
949
|
+
return createComponent(Comp, omit(props, "component"));
|
|
871
950
|
}
|
|
872
951
|
function Portal(props) {
|
|
873
952
|
throw new Error("Portal is not supported on the server");
|
|
874
953
|
}
|
|
875
954
|
|
|
876
|
-
export { ChildProperties, DOMElements, DelegatedEvents, Dynamic,
|
|
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 };
|