@solidjs/web 2.0.0-experimental.0 → 2.0.0-experimental.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/LICENSE +1 -1
- package/dist/dev.cjs +56 -75
- package/dist/dev.js +117 -677
- package/dist/server.cjs +189 -152
- package/dist/server.js +254 -729
- package/dist/web.cjs +56 -75
- package/dist/web.js +115 -665
- package/package.json +3 -3
- package/storage/dist/storage.js +3 -3
- package/types/client.d.ts +2 -13
- package/types/core.d.ts +2 -11
- package/types/index.d.ts +17 -4
- package/types/server-mock.d.ts +26 -33
- package/types/server.d.ts +0 -1
package/dist/server.js
CHANGED
|
@@ -1,512 +1,41 @@
|
|
|
1
|
-
import { sharedConfig, createRoot,
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Index,
|
|
6
|
-
Match,
|
|
7
|
-
Show,
|
|
8
|
-
Suspense,
|
|
9
|
-
SuspenseList,
|
|
10
|
-
Switch,
|
|
11
|
-
createComponent,
|
|
12
|
-
createRenderEffect as effect,
|
|
13
|
-
getOwner,
|
|
14
|
-
createMemo as memo,
|
|
15
|
-
mergeProps,
|
|
16
|
-
untrack
|
|
17
|
-
} from "solid-js";
|
|
18
|
-
import { Feature, Serializer, getCrossReferenceHeader } from "seroval";
|
|
19
|
-
import {
|
|
20
|
-
CustomEventPlugin,
|
|
21
|
-
DOMExceptionPlugin,
|
|
22
|
-
EventPlugin,
|
|
23
|
-
FormDataPlugin,
|
|
24
|
-
HeadersPlugin,
|
|
25
|
-
ReadableStreamPlugin,
|
|
26
|
-
RequestPlugin,
|
|
27
|
-
ResponsePlugin,
|
|
28
|
-
URLSearchParamsPlugin,
|
|
29
|
-
URLPlugin
|
|
30
|
-
} from "seroval-plugins/web";
|
|
1
|
+
import { createMemo, sharedConfig, createRoot, ssrHandleError, omit } from 'solid-js';
|
|
2
|
+
export { ErrorBoundary, For, Match, Repeat, Show, Suspense, Switch, createComponent, createRenderEffect as effect, getOwner, ssrRunInScope, untrack } from 'solid-js';
|
|
3
|
+
import { Feature, Serializer, getCrossReferenceHeader } from 'seroval';
|
|
4
|
+
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
31
5
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"formnovalidate",
|
|
42
|
-
"hidden",
|
|
43
|
-
"indeterminate",
|
|
44
|
-
"inert",
|
|
45
|
-
"ismap",
|
|
46
|
-
"loop",
|
|
47
|
-
"multiple",
|
|
48
|
-
"muted",
|
|
49
|
-
"nomodule",
|
|
50
|
-
"novalidate",
|
|
51
|
-
"open",
|
|
52
|
-
"playsinline",
|
|
53
|
-
"readonly",
|
|
54
|
-
"required",
|
|
55
|
-
"reversed",
|
|
56
|
-
"seamless",
|
|
57
|
-
"selected"
|
|
58
|
-
];
|
|
59
|
-
const BooleanAttributes = /*#__PURE__*/ new Set(booleans);
|
|
60
|
-
const Properties = /*#__PURE__*/ new Set([
|
|
61
|
-
"value",
|
|
62
|
-
"readOnly",
|
|
63
|
-
"formNoValidate",
|
|
64
|
-
"isMap",
|
|
65
|
-
"noModule",
|
|
66
|
-
"playsInline",
|
|
67
|
-
...booleans
|
|
68
|
-
]);
|
|
69
|
-
const ChildProperties = /*#__PURE__*/ new Set([
|
|
70
|
-
"innerHTML",
|
|
71
|
-
"textContent",
|
|
72
|
-
"innerText",
|
|
73
|
-
"children"
|
|
74
|
-
]);
|
|
75
|
-
const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
76
|
-
class: "className",
|
|
77
|
-
formnovalidate: {
|
|
78
|
-
$: "formNoValidate",
|
|
79
|
-
BUTTON: 1,
|
|
80
|
-
INPUT: 1
|
|
81
|
-
},
|
|
82
|
-
ismap: {
|
|
83
|
-
$: "isMap",
|
|
84
|
-
IMG: 1
|
|
85
|
-
},
|
|
86
|
-
nomodule: {
|
|
87
|
-
$: "noModule",
|
|
88
|
-
SCRIPT: 1
|
|
89
|
-
},
|
|
90
|
-
playsinline: {
|
|
91
|
-
$: "playsInline",
|
|
92
|
-
VIDEO: 1
|
|
93
|
-
},
|
|
94
|
-
readonly: {
|
|
95
|
-
$: "readOnly",
|
|
96
|
-
INPUT: 1,
|
|
97
|
-
TEXTAREA: 1
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
function getPropAlias(prop, tagName) {
|
|
101
|
-
const a = PropAliases[prop];
|
|
102
|
-
return typeof a === "object" ? (a[tagName] ? a["$"] : undefined) : a;
|
|
103
|
-
}
|
|
104
|
-
const DelegatedEvents = /*#__PURE__*/ new Set([
|
|
105
|
-
"beforeinput",
|
|
106
|
-
"click",
|
|
107
|
-
"dblclick",
|
|
108
|
-
"contextmenu",
|
|
109
|
-
"focusin",
|
|
110
|
-
"focusout",
|
|
111
|
-
"input",
|
|
112
|
-
"keydown",
|
|
113
|
-
"keyup",
|
|
114
|
-
"mousedown",
|
|
115
|
-
"mousemove",
|
|
116
|
-
"mouseout",
|
|
117
|
-
"mouseover",
|
|
118
|
-
"mouseup",
|
|
119
|
-
"pointerdown",
|
|
120
|
-
"pointermove",
|
|
121
|
-
"pointerout",
|
|
122
|
-
"pointerover",
|
|
123
|
-
"pointerup",
|
|
124
|
-
"touchend",
|
|
125
|
-
"touchmove",
|
|
126
|
-
"touchstart"
|
|
127
|
-
]);
|
|
128
|
-
const SVGElements = /*#__PURE__*/ new Set([
|
|
129
|
-
"altGlyph",
|
|
130
|
-
"altGlyphDef",
|
|
131
|
-
"altGlyphItem",
|
|
132
|
-
"animate",
|
|
133
|
-
"animateColor",
|
|
134
|
-
"animateMotion",
|
|
135
|
-
"animateTransform",
|
|
136
|
-
"circle",
|
|
137
|
-
"clipPath",
|
|
138
|
-
"color-profile",
|
|
139
|
-
"cursor",
|
|
140
|
-
"defs",
|
|
141
|
-
"desc",
|
|
142
|
-
"ellipse",
|
|
143
|
-
"feBlend",
|
|
144
|
-
"feColorMatrix",
|
|
145
|
-
"feComponentTransfer",
|
|
146
|
-
"feComposite",
|
|
147
|
-
"feConvolveMatrix",
|
|
148
|
-
"feDiffuseLighting",
|
|
149
|
-
"feDisplacementMap",
|
|
150
|
-
"feDistantLight",
|
|
151
|
-
"feDropShadow",
|
|
152
|
-
"feFlood",
|
|
153
|
-
"feFuncA",
|
|
154
|
-
"feFuncB",
|
|
155
|
-
"feFuncG",
|
|
156
|
-
"feFuncR",
|
|
157
|
-
"feGaussianBlur",
|
|
158
|
-
"feImage",
|
|
159
|
-
"feMerge",
|
|
160
|
-
"feMergeNode",
|
|
161
|
-
"feMorphology",
|
|
162
|
-
"feOffset",
|
|
163
|
-
"fePointLight",
|
|
164
|
-
"feSpecularLighting",
|
|
165
|
-
"feSpotLight",
|
|
166
|
-
"feTile",
|
|
167
|
-
"feTurbulence",
|
|
168
|
-
"filter",
|
|
169
|
-
"font",
|
|
170
|
-
"font-face",
|
|
171
|
-
"font-face-format",
|
|
172
|
-
"font-face-name",
|
|
173
|
-
"font-face-src",
|
|
174
|
-
"font-face-uri",
|
|
175
|
-
"foreignObject",
|
|
176
|
-
"g",
|
|
177
|
-
"glyph",
|
|
178
|
-
"glyphRef",
|
|
179
|
-
"hkern",
|
|
180
|
-
"image",
|
|
181
|
-
"line",
|
|
182
|
-
"linearGradient",
|
|
183
|
-
"marker",
|
|
184
|
-
"mask",
|
|
185
|
-
"metadata",
|
|
186
|
-
"missing-glyph",
|
|
187
|
-
"mpath",
|
|
188
|
-
"path",
|
|
189
|
-
"pattern",
|
|
190
|
-
"polygon",
|
|
191
|
-
"polyline",
|
|
192
|
-
"radialGradient",
|
|
193
|
-
"rect",
|
|
194
|
-
"set",
|
|
195
|
-
"stop",
|
|
196
|
-
"svg",
|
|
197
|
-
"switch",
|
|
198
|
-
"symbol",
|
|
199
|
-
"text",
|
|
200
|
-
"textPath",
|
|
201
|
-
"tref",
|
|
202
|
-
"tspan",
|
|
203
|
-
"use",
|
|
204
|
-
"view",
|
|
205
|
-
"vkern"
|
|
206
|
-
]);
|
|
6
|
+
const Properties = /*#__PURE__*/new Set([
|
|
7
|
+
"value", "checked", "selected", "muted"]);
|
|
8
|
+
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
9
|
+
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
|
+
const SVGElements = /*#__PURE__*/new Set([
|
|
11
|
+
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
12
|
+
"set", "stop",
|
|
13
|
+
"svg", "switch", "symbol", "text", "textPath",
|
|
14
|
+
"tref", "tspan", "use", "view", "vkern"]);
|
|
207
15
|
const SVGNamespace = {
|
|
208
16
|
xlink: "http://www.w3.org/1999/xlink",
|
|
209
17
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
210
18
|
};
|
|
211
|
-
const DOMElements = /*#__PURE__*/
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
"meta",
|
|
217
|
-
"style",
|
|
218
|
-
"title",
|
|
219
|
-
"body",
|
|
220
|
-
"address",
|
|
221
|
-
"article",
|
|
222
|
-
"aside",
|
|
223
|
-
"footer",
|
|
224
|
-
"header",
|
|
225
|
-
"main",
|
|
226
|
-
"nav",
|
|
227
|
-
"section",
|
|
228
|
-
"body",
|
|
229
|
-
"blockquote",
|
|
230
|
-
"dd",
|
|
231
|
-
"div",
|
|
232
|
-
"dl",
|
|
233
|
-
"dt",
|
|
234
|
-
"figcaption",
|
|
235
|
-
"figure",
|
|
236
|
-
"hr",
|
|
237
|
-
"li",
|
|
238
|
-
"ol",
|
|
239
|
-
"p",
|
|
240
|
-
"pre",
|
|
241
|
-
"ul",
|
|
242
|
-
"a",
|
|
243
|
-
"abbr",
|
|
244
|
-
"b",
|
|
245
|
-
"bdi",
|
|
246
|
-
"bdo",
|
|
247
|
-
"br",
|
|
248
|
-
"cite",
|
|
249
|
-
"code",
|
|
250
|
-
"data",
|
|
251
|
-
"dfn",
|
|
252
|
-
"em",
|
|
253
|
-
"i",
|
|
254
|
-
"kbd",
|
|
255
|
-
"mark",
|
|
256
|
-
"q",
|
|
257
|
-
"rp",
|
|
258
|
-
"rt",
|
|
259
|
-
"ruby",
|
|
260
|
-
"s",
|
|
261
|
-
"samp",
|
|
262
|
-
"small",
|
|
263
|
-
"span",
|
|
264
|
-
"strong",
|
|
265
|
-
"sub",
|
|
266
|
-
"sup",
|
|
267
|
-
"time",
|
|
268
|
-
"u",
|
|
269
|
-
"var",
|
|
270
|
-
"wbr",
|
|
271
|
-
"area",
|
|
272
|
-
"audio",
|
|
273
|
-
"img",
|
|
274
|
-
"map",
|
|
275
|
-
"track",
|
|
276
|
-
"video",
|
|
277
|
-
"embed",
|
|
278
|
-
"iframe",
|
|
279
|
-
"object",
|
|
280
|
-
"param",
|
|
281
|
-
"picture",
|
|
282
|
-
"portal",
|
|
283
|
-
"source",
|
|
284
|
-
"svg",
|
|
285
|
-
"math",
|
|
286
|
-
"canvas",
|
|
287
|
-
"noscript",
|
|
288
|
-
"script",
|
|
289
|
-
"del",
|
|
290
|
-
"ins",
|
|
291
|
-
"caption",
|
|
292
|
-
"col",
|
|
293
|
-
"colgroup",
|
|
294
|
-
"table",
|
|
295
|
-
"tbody",
|
|
296
|
-
"td",
|
|
297
|
-
"tfoot",
|
|
298
|
-
"th",
|
|
299
|
-
"thead",
|
|
300
|
-
"tr",
|
|
301
|
-
"button",
|
|
302
|
-
"datalist",
|
|
303
|
-
"fieldset",
|
|
304
|
-
"form",
|
|
305
|
-
"input",
|
|
306
|
-
"label",
|
|
307
|
-
"legend",
|
|
308
|
-
"meter",
|
|
309
|
-
"optgroup",
|
|
310
|
-
"option",
|
|
311
|
-
"output",
|
|
312
|
-
"progress",
|
|
313
|
-
"select",
|
|
314
|
-
"textarea",
|
|
315
|
-
"details",
|
|
316
|
-
"dialog",
|
|
317
|
-
"menu",
|
|
318
|
-
"summary",
|
|
319
|
-
"details",
|
|
320
|
-
"slot",
|
|
321
|
-
"template",
|
|
322
|
-
"acronym",
|
|
323
|
-
"applet",
|
|
324
|
-
"basefont",
|
|
325
|
-
"bgsound",
|
|
326
|
-
"big",
|
|
327
|
-
"blink",
|
|
328
|
-
"center",
|
|
329
|
-
"content",
|
|
330
|
-
"dir",
|
|
331
|
-
"font",
|
|
332
|
-
"frame",
|
|
333
|
-
"frameset",
|
|
334
|
-
"hgroup",
|
|
335
|
-
"image",
|
|
336
|
-
"keygen",
|
|
337
|
-
"marquee",
|
|
338
|
-
"menuitem",
|
|
339
|
-
"nobr",
|
|
340
|
-
"noembed",
|
|
341
|
-
"noframes",
|
|
342
|
-
"plaintext",
|
|
343
|
-
"rb",
|
|
344
|
-
"rtc",
|
|
345
|
-
"shadow",
|
|
346
|
-
"spacer",
|
|
347
|
-
"strike",
|
|
348
|
-
"tt",
|
|
349
|
-
"xmp",
|
|
350
|
-
"a",
|
|
351
|
-
"abbr",
|
|
352
|
-
"acronym",
|
|
353
|
-
"address",
|
|
354
|
-
"applet",
|
|
355
|
-
"area",
|
|
356
|
-
"article",
|
|
357
|
-
"aside",
|
|
358
|
-
"audio",
|
|
359
|
-
"b",
|
|
360
|
-
"base",
|
|
361
|
-
"basefont",
|
|
362
|
-
"bdi",
|
|
363
|
-
"bdo",
|
|
364
|
-
"bgsound",
|
|
365
|
-
"big",
|
|
366
|
-
"blink",
|
|
367
|
-
"blockquote",
|
|
368
|
-
"body",
|
|
369
|
-
"br",
|
|
370
|
-
"button",
|
|
371
|
-
"canvas",
|
|
372
|
-
"caption",
|
|
373
|
-
"center",
|
|
374
|
-
"cite",
|
|
375
|
-
"code",
|
|
376
|
-
"col",
|
|
377
|
-
"colgroup",
|
|
378
|
-
"content",
|
|
379
|
-
"data",
|
|
380
|
-
"datalist",
|
|
381
|
-
"dd",
|
|
382
|
-
"del",
|
|
383
|
-
"details",
|
|
384
|
-
"dfn",
|
|
385
|
-
"dialog",
|
|
386
|
-
"dir",
|
|
387
|
-
"div",
|
|
388
|
-
"dl",
|
|
389
|
-
"dt",
|
|
390
|
-
"em",
|
|
391
|
-
"embed",
|
|
392
|
-
"fieldset",
|
|
393
|
-
"figcaption",
|
|
394
|
-
"figure",
|
|
395
|
-
"font",
|
|
396
|
-
"footer",
|
|
397
|
-
"form",
|
|
398
|
-
"frame",
|
|
399
|
-
"frameset",
|
|
400
|
-
"head",
|
|
401
|
-
"header",
|
|
402
|
-
"hgroup",
|
|
403
|
-
"hr",
|
|
404
|
-
"html",
|
|
405
|
-
"i",
|
|
406
|
-
"iframe",
|
|
407
|
-
"image",
|
|
408
|
-
"img",
|
|
409
|
-
"input",
|
|
410
|
-
"ins",
|
|
411
|
-
"kbd",
|
|
412
|
-
"keygen",
|
|
413
|
-
"label",
|
|
414
|
-
"legend",
|
|
415
|
-
"li",
|
|
416
|
-
"link",
|
|
417
|
-
"main",
|
|
418
|
-
"map",
|
|
419
|
-
"mark",
|
|
420
|
-
"marquee",
|
|
421
|
-
"menu",
|
|
422
|
-
"menuitem",
|
|
423
|
-
"meta",
|
|
424
|
-
"meter",
|
|
425
|
-
"nav",
|
|
426
|
-
"nobr",
|
|
427
|
-
"noembed",
|
|
428
|
-
"noframes",
|
|
429
|
-
"noscript",
|
|
430
|
-
"object",
|
|
431
|
-
"ol",
|
|
432
|
-
"optgroup",
|
|
433
|
-
"option",
|
|
434
|
-
"output",
|
|
435
|
-
"p",
|
|
436
|
-
"param",
|
|
437
|
-
"picture",
|
|
438
|
-
"plaintext",
|
|
439
|
-
"portal",
|
|
440
|
-
"pre",
|
|
441
|
-
"progress",
|
|
442
|
-
"q",
|
|
443
|
-
"rb",
|
|
444
|
-
"rp",
|
|
445
|
-
"rt",
|
|
446
|
-
"rtc",
|
|
447
|
-
"ruby",
|
|
448
|
-
"s",
|
|
449
|
-
"samp",
|
|
450
|
-
"script",
|
|
451
|
-
"section",
|
|
452
|
-
"select",
|
|
453
|
-
"shadow",
|
|
454
|
-
"slot",
|
|
455
|
-
"small",
|
|
456
|
-
"source",
|
|
457
|
-
"spacer",
|
|
458
|
-
"span",
|
|
459
|
-
"strike",
|
|
460
|
-
"strong",
|
|
461
|
-
"style",
|
|
462
|
-
"sub",
|
|
463
|
-
"summary",
|
|
464
|
-
"sup",
|
|
465
|
-
"table",
|
|
466
|
-
"tbody",
|
|
467
|
-
"td",
|
|
468
|
-
"template",
|
|
469
|
-
"textarea",
|
|
470
|
-
"tfoot",
|
|
471
|
-
"th",
|
|
472
|
-
"thead",
|
|
473
|
-
"time",
|
|
474
|
-
"title",
|
|
475
|
-
"tr",
|
|
476
|
-
"track",
|
|
477
|
-
"tt",
|
|
478
|
-
"u",
|
|
479
|
-
"ul",
|
|
480
|
-
"var",
|
|
481
|
-
"video",
|
|
482
|
-
"wbr",
|
|
483
|
-
"xmp",
|
|
484
|
-
"input",
|
|
485
|
-
"h1",
|
|
486
|
-
"h2",
|
|
487
|
-
"h3",
|
|
488
|
-
"h4",
|
|
489
|
-
"h5",
|
|
490
|
-
"h6"
|
|
491
|
-
]);
|
|
19
|
+
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
|
+
"webview",
|
|
21
|
+
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
22
|
+
|
|
23
|
+
const memo = fn => createMemo(() => fn());
|
|
492
24
|
|
|
493
|
-
const ES2017FLAG = Feature.AggregateError
|
|
494
|
-
|
|
495
|
-
|
|
25
|
+
const ES2017FLAG = Feature.AggregateError
|
|
26
|
+
| Feature.BigIntTypedArray;
|
|
27
|
+
const GLOBAL_IDENTIFIER = '_$HY.r';
|
|
28
|
+
function createSerializer({
|
|
29
|
+
onData,
|
|
30
|
+
onDone,
|
|
31
|
+
scopeId,
|
|
32
|
+
onError
|
|
33
|
+
}) {
|
|
496
34
|
return new Serializer({
|
|
497
35
|
scopeId,
|
|
498
|
-
plugins: [
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
EventPlugin,
|
|
502
|
-
FormDataPlugin,
|
|
503
|
-
HeadersPlugin,
|
|
504
|
-
ReadableStreamPlugin,
|
|
505
|
-
RequestPlugin,
|
|
506
|
-
ResponsePlugin,
|
|
507
|
-
URLSearchParamsPlugin,
|
|
508
|
-
URLPlugin
|
|
509
|
-
],
|
|
36
|
+
plugins: [AbortSignalPlugin,
|
|
37
|
+
CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
|
|
38
|
+
FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin],
|
|
510
39
|
globalIdentifier: GLOBAL_IDENTIFIER,
|
|
511
40
|
disabledFeatures: ES2017FLAG,
|
|
512
41
|
onData,
|
|
@@ -515,18 +44,22 @@ function createSerializer({ onData, onDone, scopeId, onError }) {
|
|
|
515
44
|
});
|
|
516
45
|
}
|
|
517
46
|
function getLocalHeaderScript(id) {
|
|
518
|
-
return getCrossReferenceHeader(id) +
|
|
47
|
+
return getCrossReferenceHeader(id) + ';';
|
|
519
48
|
}
|
|
520
49
|
|
|
521
|
-
const VOID_ELEMENTS =
|
|
522
|
-
/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
50
|
+
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
523
51
|
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(n=document.getElementById(e),o=document.getElementById("pl-"+e)){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)}`;
|
|
524
52
|
function renderToString(code, options = {}) {
|
|
525
|
-
const {
|
|
53
|
+
const {
|
|
54
|
+
renderId = "",
|
|
55
|
+
nonce,
|
|
56
|
+
noScripts
|
|
57
|
+
} = options;
|
|
526
58
|
let scripts = "";
|
|
527
59
|
const serializer = createSerializer({
|
|
528
60
|
scopeId: renderId,
|
|
529
61
|
onData(script) {
|
|
62
|
+
if (noScripts) return;
|
|
530
63
|
if (!scripts) {
|
|
531
64
|
scripts = getLocalHeaderScript(renderId);
|
|
532
65
|
}
|
|
@@ -535,23 +68,20 @@ function renderToString(code, options = {}) {
|
|
|
535
68
|
onError: options.onError
|
|
536
69
|
});
|
|
537
70
|
sharedConfig.context = {
|
|
538
|
-
id: renderId || "",
|
|
539
|
-
count: 0,
|
|
540
|
-
suspense: {},
|
|
541
|
-
lazy: {},
|
|
542
71
|
assets: [],
|
|
543
|
-
nonce
|
|
72
|
+
nonce,
|
|
73
|
+
escape: escape,
|
|
74
|
+
resolve: resolveSSRNode,
|
|
75
|
+
ssr: ssr,
|
|
544
76
|
serialize(id, p) {
|
|
545
77
|
!sharedConfig.context.noHydrate && serializer.write(id, p);
|
|
546
|
-
},
|
|
547
|
-
roots: 0,
|
|
548
|
-
nextRoot() {
|
|
549
|
-
return this.renderId + "i-" + this.roots++;
|
|
550
78
|
}
|
|
551
79
|
};
|
|
552
80
|
let html = createRoot(d => {
|
|
553
81
|
setTimeout(d);
|
|
554
|
-
return
|
|
82
|
+
return resolveSSRSync(escape(code()));
|
|
83
|
+
}, {
|
|
84
|
+
id: renderId
|
|
555
85
|
});
|
|
556
86
|
sharedConfig.context.noHydrate = true;
|
|
557
87
|
serializer.close();
|
|
@@ -559,19 +89,14 @@ function renderToString(code, options = {}) {
|
|
|
559
89
|
if (scripts.length) html = injectScripts(html, scripts, options.nonce);
|
|
560
90
|
return html;
|
|
561
91
|
}
|
|
562
|
-
function renderToStringAsync(code, options = {}) {
|
|
563
|
-
const { timeoutMs = 30000 } = options;
|
|
564
|
-
let timeoutHandle;
|
|
565
|
-
const timeout = new Promise((_, reject) => {
|
|
566
|
-
timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
|
|
567
|
-
});
|
|
568
|
-
return Promise.race([renderToStream(code, options), timeout]).then(html => {
|
|
569
|
-
clearTimeout(timeoutHandle);
|
|
570
|
-
return html;
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
92
|
function renderToStream(code, options = {}) {
|
|
574
|
-
let {
|
|
93
|
+
let {
|
|
94
|
+
nonce,
|
|
95
|
+
onCompleteShell,
|
|
96
|
+
onCompleteAll,
|
|
97
|
+
renderId = "",
|
|
98
|
+
noScripts
|
|
99
|
+
} = options;
|
|
575
100
|
let dispose;
|
|
576
101
|
const blockingPromises = [];
|
|
577
102
|
const pushTask = task => {
|
|
@@ -587,12 +112,11 @@ function renderToStream(code, options = {}) {
|
|
|
587
112
|
const onDone = () => {
|
|
588
113
|
writeTasks();
|
|
589
114
|
doShell();
|
|
590
|
-
onCompleteAll &&
|
|
591
|
-
|
|
592
|
-
write(v)
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
});
|
|
115
|
+
onCompleteAll && onCompleteAll({
|
|
116
|
+
write(v) {
|
|
117
|
+
!completed && buffer.write(v);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
596
120
|
writable && writable.end();
|
|
597
121
|
completed = true;
|
|
598
122
|
if (firstFlushed) dispose();
|
|
@@ -632,12 +156,7 @@ function renderToStream(code, options = {}) {
|
|
|
632
156
|
}
|
|
633
157
|
};
|
|
634
158
|
sharedConfig.context = context = {
|
|
635
|
-
id: renderId || "",
|
|
636
|
-
count: 0,
|
|
637
159
|
async: true,
|
|
638
|
-
resources: {},
|
|
639
|
-
lazy: {},
|
|
640
|
-
suspense: {},
|
|
641
160
|
assets: [],
|
|
642
161
|
nonce,
|
|
643
162
|
block(p) {
|
|
@@ -649,59 +168,59 @@ function renderToStream(code, options = {}) {
|
|
|
649
168
|
const first = html.indexOf(placeholder);
|
|
650
169
|
if (first === -1) return;
|
|
651
170
|
const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
|
|
652
|
-
html =
|
|
653
|
-
html.slice(0, first) +
|
|
654
|
-
resolveSSRNode(escape(payloadFn())) +
|
|
655
|
-
html.slice(last + placeholder.length + 1);
|
|
171
|
+
html = html.slice(0, first) + resolveSSRSync(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
|
|
656
172
|
},
|
|
657
173
|
serialize(id, p, wait) {
|
|
658
174
|
const serverOnly = sharedConfig.context.noHydrate;
|
|
659
175
|
if (!firstFlushed && wait && typeof p === "object" && "then" in p) {
|
|
660
176
|
blockingPromises.push(p);
|
|
661
|
-
!serverOnly &&
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
.catch(e => {
|
|
667
|
-
serializer.write(id, e);
|
|
668
|
-
});
|
|
177
|
+
!serverOnly && p.then(d => {
|
|
178
|
+
serializer.write(id, d);
|
|
179
|
+
}).catch(e => {
|
|
180
|
+
serializer.write(id, e);
|
|
181
|
+
});
|
|
669
182
|
} else if (!serverOnly) serializer.write(id, p);
|
|
670
183
|
},
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
},
|
|
184
|
+
escape: escape,
|
|
185
|
+
resolve: resolveSSRNode,
|
|
186
|
+
ssr: ssr,
|
|
675
187
|
registerFragment(key) {
|
|
676
188
|
if (!registry.has(key)) {
|
|
677
189
|
let resolve, reject;
|
|
678
|
-
const p = new Promise((r, rej) => (
|
|
679
|
-
registry.set(key,
|
|
680
|
-
queue(() =>
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
)
|
|
686
|
-
);
|
|
190
|
+
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
191
|
+
registry.set(key, {
|
|
192
|
+
resolve: err => queue(() => queue(() => {
|
|
193
|
+
err ? reject(err) : resolve(true);
|
|
194
|
+
queue(flushEnd);
|
|
195
|
+
}))
|
|
196
|
+
});
|
|
687
197
|
serializer.write(key, p);
|
|
688
198
|
}
|
|
689
199
|
return (value, error) => {
|
|
690
200
|
if (registry.has(key)) {
|
|
691
|
-
const
|
|
201
|
+
const item = registry.get(key);
|
|
692
202
|
registry.delete(key);
|
|
693
|
-
if (
|
|
694
|
-
|
|
203
|
+
if (item.children) {
|
|
204
|
+
for (const k in item.children) {
|
|
205
|
+
value = replacePlaceholder(value, k, item.children[k]);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const parentKey = waitForFragments(registry, key);
|
|
209
|
+
if (parentKey) {
|
|
210
|
+
const parent = registry.get(parentKey);
|
|
211
|
+
parent.children ||= {};
|
|
212
|
+
parent.children[key] = value !== undefined ? value : "";
|
|
213
|
+
item.resolve();
|
|
695
214
|
return;
|
|
696
215
|
}
|
|
697
216
|
if (!completed) {
|
|
698
217
|
if (!firstFlushed) {
|
|
699
|
-
queue(() =>
|
|
700
|
-
resolve(error);
|
|
218
|
+
queue(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
|
|
219
|
+
item.resolve(error);
|
|
701
220
|
} else {
|
|
702
221
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
703
222
|
pushTask(`$df("${key}")${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
|
|
704
|
-
resolve(error);
|
|
223
|
+
item.resolve(error);
|
|
705
224
|
scriptFlushed = true;
|
|
706
225
|
}
|
|
707
226
|
}
|
|
@@ -712,22 +231,22 @@ function renderToStream(code, options = {}) {
|
|
|
712
231
|
};
|
|
713
232
|
let html = createRoot(d => {
|
|
714
233
|
dispose = d;
|
|
715
|
-
return
|
|
234
|
+
return resolveSSRSync(escape(code()));
|
|
235
|
+
}, {
|
|
236
|
+
id: renderId
|
|
716
237
|
});
|
|
717
238
|
function doShell() {
|
|
718
239
|
if (shellCompleted) return;
|
|
719
240
|
sharedConfig.context = context;
|
|
720
|
-
context.noHydrate = true;
|
|
721
241
|
html = injectAssets(context.assets, html);
|
|
722
242
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
723
243
|
buffer.write(html);
|
|
724
244
|
tasks = "";
|
|
725
|
-
onCompleteShell &&
|
|
726
|
-
|
|
727
|
-
write(v)
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
});
|
|
245
|
+
onCompleteShell && onCompleteShell({
|
|
246
|
+
write(v) {
|
|
247
|
+
!completed && buffer.write(v);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
731
250
|
shellCompleted = true;
|
|
732
251
|
}
|
|
733
252
|
return {
|
|
@@ -762,7 +281,7 @@ function renderToStream(code, options = {}) {
|
|
|
762
281
|
pipeTo(w) {
|
|
763
282
|
return allSettled(blockingPromises).then(() => {
|
|
764
283
|
let resolve;
|
|
765
|
-
const p = new Promise(r =>
|
|
284
|
+
const p = new Promise(r => resolve = r);
|
|
766
285
|
setTimeout(() => {
|
|
767
286
|
doShell();
|
|
768
287
|
const encoder = new TextEncoder();
|
|
@@ -792,30 +311,24 @@ function renderToStream(code, options = {}) {
|
|
|
792
311
|
};
|
|
793
312
|
}
|
|
794
313
|
function HydrationScript(props) {
|
|
795
|
-
const {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
);
|
|
314
|
+
const {
|
|
315
|
+
nonce
|
|
316
|
+
} = sharedConfig.context;
|
|
317
|
+
return ssr(generateHydrationScript({
|
|
318
|
+
nonce,
|
|
319
|
+
...props
|
|
320
|
+
}));
|
|
802
321
|
}
|
|
803
322
|
function ssr(t, ...nodes) {
|
|
804
|
-
if (nodes.length)
|
|
805
|
-
let result = "";
|
|
806
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
807
|
-
result += t[i];
|
|
808
|
-
const node = nodes[i];
|
|
809
|
-
if (node !== undefined) result += resolveSSRNode(node);
|
|
810
|
-
}
|
|
811
|
-
t = result + t[nodes.length];
|
|
812
|
-
}
|
|
323
|
+
if (nodes.length) return resolveSSR(t, nodes);
|
|
813
324
|
return {
|
|
814
325
|
t
|
|
815
326
|
};
|
|
816
327
|
}
|
|
817
328
|
function ssrClassName(value) {
|
|
818
329
|
if (!value) return "";
|
|
330
|
+
if (typeof value === "string") return escape(value, true);
|
|
331
|
+
value = classListToObject(value);
|
|
819
332
|
let classKeys = Object.keys(value),
|
|
820
333
|
result = "";
|
|
821
334
|
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
@@ -837,22 +350,26 @@ function ssrStyle(value) {
|
|
|
837
350
|
const v = value[s];
|
|
838
351
|
if (v != undefined) {
|
|
839
352
|
if (i) result += ";";
|
|
840
|
-
|
|
353
|
+
const r = escape(v, true);
|
|
354
|
+
if (r != undefined && r !== "undefined") {
|
|
355
|
+
result += `${s}:${r}`;
|
|
356
|
+
}
|
|
841
357
|
}
|
|
842
358
|
}
|
|
843
359
|
return result;
|
|
844
360
|
}
|
|
361
|
+
function ssrStyleProperty(name, value) {
|
|
362
|
+
return value != null ? name + value : "";
|
|
363
|
+
}
|
|
845
364
|
function ssrElement(tag, props, children, needsId) {
|
|
846
|
-
if (props == null) props = {};
|
|
847
|
-
else if (typeof props === "function") props = props();
|
|
365
|
+
if (props == null) props = {};else if (typeof props === "function") props = props();
|
|
848
366
|
const skipChildren = VOID_ELEMENTS.test(tag);
|
|
849
367
|
const keys = Object.keys(props);
|
|
850
368
|
let result = `<${tag}${needsId ? ssrHydrationKey() : ""} `;
|
|
851
369
|
for (let i = 0; i < keys.length; i++) {
|
|
852
370
|
const prop = keys[i];
|
|
853
371
|
if (ChildProperties.has(prop)) {
|
|
854
|
-
if (children === undefined && !skipChildren)
|
|
855
|
-
children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
372
|
+
if (children === undefined && !skipChildren) children = tag === "script" || tag === "style" || prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
856
373
|
continue;
|
|
857
374
|
}
|
|
858
375
|
const value = props[prop];
|
|
@@ -860,51 +377,38 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
860
377
|
result += `style="${ssrStyle(value)}"`;
|
|
861
378
|
} else if (prop === "class") {
|
|
862
379
|
result += `class="${ssrClassName(value)}"`;
|
|
863
|
-
} else if (
|
|
864
|
-
if (value) result += prop;
|
|
865
|
-
else continue;
|
|
866
|
-
} else if (
|
|
867
|
-
value == undefined ||
|
|
868
|
-
prop === "ref" ||
|
|
869
|
-
prop.slice(0, 2) === "on" ||
|
|
870
|
-
prop.slice(0, 5) === "prop:"
|
|
871
|
-
) {
|
|
380
|
+
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
|
|
872
381
|
continue;
|
|
873
|
-
} else if (
|
|
382
|
+
} else if (typeof value === "boolean") {
|
|
874
383
|
if (!value) continue;
|
|
875
|
-
result += escape(prop
|
|
876
|
-
} else if (prop.slice(0, 5) === "attr:") {
|
|
877
|
-
result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
|
|
384
|
+
result += escape(prop);
|
|
878
385
|
} else {
|
|
879
|
-
result +=
|
|
386
|
+
result += value === "" ? escape(prop) : `${escape(prop)}="${escape(value, true)}"`;
|
|
880
387
|
}
|
|
881
388
|
if (i !== keys.length - 1) result += " ";
|
|
882
389
|
}
|
|
883
|
-
if (skipChildren)
|
|
884
|
-
|
|
885
|
-
t: result + "/>"
|
|
886
|
-
};
|
|
887
|
-
if (typeof children === "function") children = children();
|
|
888
|
-
return {
|
|
889
|
-
t: result + `>${resolveSSRNode(children, true)}</${tag}>`
|
|
390
|
+
if (skipChildren) return {
|
|
391
|
+
t: result + "/>"
|
|
890
392
|
};
|
|
393
|
+
if (typeof children === "function") children = children();
|
|
394
|
+
return ssr([result + ">", `</${tag}>`], resolveSSRNode(children, undefined, true));
|
|
891
395
|
}
|
|
892
|
-
function ssrAttribute(key, value
|
|
893
|
-
return
|
|
396
|
+
function ssrAttribute(key, value) {
|
|
397
|
+
return value == null || value === false ? "" : value === true ? ` ${key}` : ` ${key}="${value}"`;
|
|
894
398
|
}
|
|
895
399
|
function ssrHydrationKey() {
|
|
896
400
|
const hk = getHydrationKey();
|
|
897
|
-
return hk ? `
|
|
401
|
+
return hk ? ` _hk=${hk}` : "";
|
|
898
402
|
}
|
|
899
403
|
function escape(s, attr) {
|
|
900
404
|
const t = typeof s;
|
|
901
405
|
if (t !== "string") {
|
|
902
|
-
if (!attr && t === "function") return escape(s());
|
|
903
406
|
if (!attr && Array.isArray(s)) {
|
|
407
|
+
s = s.slice();
|
|
904
408
|
for (let i = 0; i < s.length; i++) s[i] = escape(s[i]);
|
|
905
409
|
return s;
|
|
906
410
|
}
|
|
907
|
-
if (attr && t === "boolean") return
|
|
411
|
+
if (attr && t === "boolean") return s;
|
|
908
412
|
return s;
|
|
909
413
|
}
|
|
910
414
|
const delim = attr ? '"' : "<";
|
|
@@ -934,38 +438,43 @@ function escape(s, attr) {
|
|
|
934
438
|
left = iDelim + 1;
|
|
935
439
|
iDelim = s.indexOf(delim, left);
|
|
936
440
|
} while (iDelim >= 0);
|
|
937
|
-
} else
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
}
|
|
441
|
+
} else while (iAmp >= 0) {
|
|
442
|
+
if (left < iAmp) out += s.substring(left, iAmp);
|
|
443
|
+
out += "&";
|
|
444
|
+
left = iAmp + 1;
|
|
445
|
+
iAmp = s.indexOf("&", left);
|
|
446
|
+
}
|
|
944
447
|
return left < s.length ? out + s.substring(left) : out;
|
|
945
448
|
}
|
|
946
|
-
function
|
|
947
|
-
const
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
449
|
+
function mergeProps(...sources) {
|
|
450
|
+
const target = {};
|
|
451
|
+
for (let i = 0; i < sources.length; i++) {
|
|
452
|
+
let source = sources[i];
|
|
453
|
+
if (typeof source === "function") source = source();
|
|
454
|
+
if (source) {
|
|
455
|
+
const descriptors = Object.getOwnPropertyDescriptors(source);
|
|
456
|
+
for (const key in descriptors) {
|
|
457
|
+
if (key in target) continue;
|
|
458
|
+
Object.defineProperty(target, key, {
|
|
459
|
+
enumerable: true,
|
|
460
|
+
get() {
|
|
461
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
462
|
+
const v = (sources[i] || {})[key];
|
|
463
|
+
if (v !== undefined) return v;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
}
|
|
956
468
|
}
|
|
957
|
-
return mapped;
|
|
958
469
|
}
|
|
959
|
-
|
|
960
|
-
if (t === "function") return resolveSSRNode(node());
|
|
961
|
-
return String(node);
|
|
470
|
+
return target;
|
|
962
471
|
}
|
|
963
472
|
function getHydrationKey() {
|
|
964
473
|
const hydrate = sharedConfig.context;
|
|
965
474
|
return hydrate && !hydrate.noHydrate && sharedConfig.getNextContextId();
|
|
966
475
|
}
|
|
967
476
|
function useAssets(fn) {
|
|
968
|
-
sharedConfig.context.assets.push(() =>
|
|
477
|
+
sharedConfig.context.assets.push(() => resolveSSRSync(escape(fn())));
|
|
969
478
|
}
|
|
970
479
|
function getAssets() {
|
|
971
480
|
const assets = sharedConfig.context.assets;
|
|
@@ -973,20 +482,17 @@ function getAssets() {
|
|
|
973
482
|
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
974
483
|
return out;
|
|
975
484
|
}
|
|
976
|
-
function generateHydrationScript({
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
)}"].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-->`;
|
|
485
|
+
function generateHydrationScript({
|
|
486
|
+
eventNames = ["click", "input"],
|
|
487
|
+
nonce
|
|
488
|
+
} = {}) {
|
|
489
|
+
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-->`;
|
|
982
490
|
}
|
|
983
491
|
function Hydration(props) {
|
|
984
492
|
if (!sharedConfig.context.noHydrate) return props.children;
|
|
985
493
|
const context = sharedConfig.context;
|
|
986
494
|
sharedConfig.context = {
|
|
987
495
|
...context,
|
|
988
|
-
count: 0,
|
|
989
|
-
id: sharedConfig.getNextContextId(),
|
|
990
496
|
noHydrate: false
|
|
991
497
|
};
|
|
992
498
|
const res = props.children;
|
|
@@ -994,8 +500,14 @@ function Hydration(props) {
|
|
|
994
500
|
return res;
|
|
995
501
|
}
|
|
996
502
|
function NoHydration(props) {
|
|
997
|
-
|
|
998
|
-
|
|
503
|
+
let context = sharedConfig.context;
|
|
504
|
+
if (context) sharedConfig.context = {
|
|
505
|
+
...context,
|
|
506
|
+
noHydrate: true
|
|
507
|
+
};
|
|
508
|
+
const res = props.children;
|
|
509
|
+
if (context) sharedConfig.context = context;
|
|
510
|
+
return res;
|
|
999
511
|
}
|
|
1000
512
|
function queue(fn) {
|
|
1001
513
|
return Promise.resolve().then(fn);
|
|
@@ -1025,7 +537,7 @@ function injectScripts(html, scripts, nonce) {
|
|
|
1025
537
|
}
|
|
1026
538
|
function waitForFragments(registry, key) {
|
|
1027
539
|
for (const k of [...registry.keys()].reverse()) {
|
|
1028
|
-
if (key.startsWith(k)) return
|
|
540
|
+
if (key.startsWith(k)) return k;
|
|
1029
541
|
}
|
|
1030
542
|
return false;
|
|
1031
543
|
}
|
|
@@ -1037,91 +549,104 @@ function replacePlaceholder(html, key, value) {
|
|
|
1037
549
|
const last = html.indexOf(close, first + marker.length);
|
|
1038
550
|
return html.slice(0, first) + value + html.slice(last + close.length);
|
|
1039
551
|
}
|
|
552
|
+
function classListToObject(classList) {
|
|
553
|
+
if (Array.isArray(classList)) {
|
|
554
|
+
const result = {};
|
|
555
|
+
flattenClassList(classList, result);
|
|
556
|
+
return result;
|
|
557
|
+
}
|
|
558
|
+
return classList;
|
|
559
|
+
}
|
|
560
|
+
function flattenClassList(list, result) {
|
|
561
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
562
|
+
const item = list[i];
|
|
563
|
+
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;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
function resolveSSR(template, holes, result = {
|
|
567
|
+
t: [""],
|
|
568
|
+
h: [],
|
|
569
|
+
p: []
|
|
570
|
+
}) {
|
|
571
|
+
for (let i = 0; i < holes.length; i++) {
|
|
572
|
+
const hole = holes[i];
|
|
573
|
+
result.t[result.t.length - 1] += template[i];
|
|
574
|
+
if (hole == null || hole === true || hole === false) continue;
|
|
575
|
+
resolveSSRNode(hole, result);
|
|
576
|
+
}
|
|
577
|
+
result.t[result.t.length - 1] += template[template.length - 1];
|
|
578
|
+
return result;
|
|
579
|
+
}
|
|
580
|
+
function resolveSSRNode(node, result = {
|
|
581
|
+
t: [""],
|
|
582
|
+
h: [],
|
|
583
|
+
p: []
|
|
584
|
+
}, top) {
|
|
585
|
+
const t = typeof node;
|
|
586
|
+
if (t === "string" || t === "number") {
|
|
587
|
+
result.t[result.t.length - 1] += node;
|
|
588
|
+
} else if (node == null || t === "boolean") ; else if (Array.isArray(node)) {
|
|
589
|
+
let prev = {};
|
|
590
|
+
for (let i = 0, len = node.length; i < len; i++) {
|
|
591
|
+
if (!top && typeof prev !== "object" && typeof node[i] !== "object") result.t[result.t.length - 1] += `<!--!$-->`;
|
|
592
|
+
resolveSSRNode(prev = node[i], result);
|
|
593
|
+
}
|
|
594
|
+
} else if (t === "object") {
|
|
595
|
+
if (node.h) {
|
|
596
|
+
result.t[result.t.length - 1] += node.t[0];
|
|
597
|
+
if (node.t.length > 1) {
|
|
598
|
+
result.t.push(...node.t.slice(1));
|
|
599
|
+
result.h.push(...node.h);
|
|
600
|
+
result.p.push(...node.p);
|
|
601
|
+
}
|
|
602
|
+
} else result.t[result.t.length - 1] += node.t;
|
|
603
|
+
} else if (t === "function") {
|
|
604
|
+
try {
|
|
605
|
+
resolveSSRNode(node(), result);
|
|
606
|
+
} catch (err) {
|
|
607
|
+
const p = ssrHandleError(err);
|
|
608
|
+
if (p) {
|
|
609
|
+
result.h.push(node);
|
|
610
|
+
result.p.push(p);
|
|
611
|
+
result.t.push("");
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
return result;
|
|
616
|
+
}
|
|
617
|
+
function resolveSSRSync(node) {
|
|
618
|
+
const res = resolveSSRNode(node);
|
|
619
|
+
if (!res.h.length) return res.t[0];
|
|
620
|
+
throw new Error("This value cannot be rendered synchronously. Are you missing a Suspsense boundary?");
|
|
621
|
+
}
|
|
1040
622
|
const RequestContext = Symbol();
|
|
1041
623
|
function getRequestEvent() {
|
|
1042
|
-
return globalThis[RequestContext]
|
|
1043
|
-
? globalThis[RequestContext].getStore() ||
|
|
1044
|
-
(sharedConfig.context && sharedConfig.context.event) ||
|
|
1045
|
-
console.log(
|
|
1046
|
-
"RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls."
|
|
1047
|
-
)
|
|
1048
|
-
: undefined;
|
|
624
|
+
return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || sharedConfig.context && sharedConfig.context.event || console.log("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.") : undefined;
|
|
1049
625
|
}
|
|
1050
|
-
function
|
|
1051
|
-
|
|
626
|
+
function renderToStringAsync(code, options = {}) {
|
|
627
|
+
return renderToStream(code, options).then(html => html);
|
|
1052
628
|
}
|
|
1053
629
|
function notSup() {
|
|
1054
|
-
throw new Error(
|
|
1055
|
-
"Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>."
|
|
1056
|
-
);
|
|
630
|
+
throw new Error("Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.");
|
|
1057
631
|
}
|
|
1058
632
|
|
|
1059
633
|
const isServer = true;
|
|
1060
634
|
const isDev = false;
|
|
1061
|
-
function
|
|
1062
|
-
const
|
|
1063
|
-
const comp = p.component,
|
|
635
|
+
function createDynamic(component, props) {
|
|
636
|
+
const comp = component(),
|
|
1064
637
|
t = typeof comp;
|
|
1065
638
|
if (comp) {
|
|
1066
|
-
if (t === "function") return comp(
|
|
1067
|
-
|
|
1068
|
-
return ssrElement(comp, others, undefined, true);
|
|
639
|
+
if (t === "function") return comp(props);else if (t === "string") {
|
|
640
|
+
return ssrElement(comp, props, undefined, true);
|
|
1069
641
|
}
|
|
1070
642
|
}
|
|
1071
643
|
}
|
|
644
|
+
function Dynamic(props) {
|
|
645
|
+
const others = omit(props, "component");
|
|
646
|
+
return createDynamic(() => props.component, others);
|
|
647
|
+
}
|
|
1072
648
|
function Portal(props) {
|
|
1073
|
-
|
|
649
|
+
throw new Error("Portal is not supported on the server");
|
|
1074
650
|
}
|
|
1075
651
|
|
|
1076
|
-
export {
|
|
1077
|
-
Assets,
|
|
1078
|
-
ChildProperties,
|
|
1079
|
-
DOMElements,
|
|
1080
|
-
DelegatedEvents,
|
|
1081
|
-
Dynamic,
|
|
1082
|
-
Hydration,
|
|
1083
|
-
HydrationScript,
|
|
1084
|
-
NoHydration,
|
|
1085
|
-
Portal,
|
|
1086
|
-
Properties,
|
|
1087
|
-
RequestContext,
|
|
1088
|
-
SVGElements,
|
|
1089
|
-
SVGNamespace,
|
|
1090
|
-
notSup as addEventListener,
|
|
1091
|
-
notSup as assign,
|
|
1092
|
-
notSup as className,
|
|
1093
|
-
notSup as delegateEvents,
|
|
1094
|
-
notSup as dynamicProperty,
|
|
1095
|
-
escape,
|
|
1096
|
-
generateHydrationScript,
|
|
1097
|
-
getAssets,
|
|
1098
|
-
getHydrationKey,
|
|
1099
|
-
notSup as getNextElement,
|
|
1100
|
-
notSup as getNextMarker,
|
|
1101
|
-
notSup as getNextMatch,
|
|
1102
|
-
getPropAlias,
|
|
1103
|
-
getRequestEvent,
|
|
1104
|
-
notSup as hydrate,
|
|
1105
|
-
notSup as insert,
|
|
1106
|
-
isDev,
|
|
1107
|
-
isServer,
|
|
1108
|
-
notSup as render,
|
|
1109
|
-
renderToStream,
|
|
1110
|
-
renderToString,
|
|
1111
|
-
renderToStringAsync,
|
|
1112
|
-
resolveSSRNode,
|
|
1113
|
-
notSup as runHydrationEvents,
|
|
1114
|
-
notSup as setAttribute,
|
|
1115
|
-
notSup as setAttributeNS,
|
|
1116
|
-
notSup as setProperty,
|
|
1117
|
-
notSup as spread,
|
|
1118
|
-
ssr,
|
|
1119
|
-
ssrAttribute,
|
|
1120
|
-
ssrClassName,
|
|
1121
|
-
ssrElement,
|
|
1122
|
-
ssrHydrationKey,
|
|
1123
|
-
ssrStyle,
|
|
1124
|
-
notSup as style,
|
|
1125
|
-
notSup as template,
|
|
1126
|
-
useAssets
|
|
1127
|
-
};
|
|
652
|
+
export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, notSup as addEventListener, notSup as assign, notSup as className, createDynamic, notSup as delegateEvents, notSup as dynamicProperty, 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 };
|