solid-js 1.8.22 → 1.9.0
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/dist/dev.cjs +7 -6
- package/dist/dev.js +567 -325
- package/dist/server.cjs +1 -1
- package/dist/server.js +169 -75
- package/dist/solid.cjs +7 -6
- package/dist/solid.js +494 -283
- package/h/dist/h.js +40 -9
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +13 -10
- package/h/jsx-runtime/types/jsx.d.ts +22 -1
- package/h/types/hyperscript.d.ts +11 -11
- package/h/types/index.d.ts +1 -1
- package/html/dist/html.cjs +4 -2
- package/html/dist/html.js +222 -95
- package/html/types/index.d.ts +1 -1
- package/html/types/lit.d.ts +52 -33
- package/package.json +1 -5
- package/store/dist/dev.cjs +1 -1
- package/store/dist/dev.js +123 -43
- package/store/dist/server.cjs +4 -0
- package/store/dist/server.js +23 -8
- package/store/dist/store.cjs +1 -1
- package/store/dist/store.js +114 -40
- package/store/package.json +0 -4
- package/store/types/index.d.ts +21 -7
- package/store/types/modifiers.d.ts +6 -3
- package/store/types/mutable.d.ts +5 -2
- package/store/types/server.d.ts +26 -5
- package/store/types/store.d.ts +219 -62
- package/types/index.d.ts +75 -10
- package/types/jsx.d.ts +35 -8
- package/types/reactive/array.d.ts +12 -4
- package/types/reactive/observable.d.ts +25 -17
- package/types/reactive/scheduler.d.ts +9 -6
- package/types/reactive/signal.d.ts +236 -143
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +64 -33
- package/types/render/flow.d.ts +43 -31
- package/types/render/hydration.d.ts +15 -15
- package/types/server/index.d.ts +57 -2
- package/types/server/reactive.d.ts +73 -42
- package/types/server/rendering.d.ts +169 -98
- package/universal/dist/dev.js +28 -12
- package/universal/dist/universal.js +28 -12
- package/universal/types/index.d.ts +3 -1
- package/universal/types/universal.d.ts +0 -1
- package/web/dist/dev.cjs +57 -24
- package/web/dist/dev.js +679 -101
- package/web/dist/server.cjs +96 -15
- package/web/dist/server.js +676 -105
- package/web/dist/web.cjs +53 -23
- package/web/dist/web.js +664 -99
- package/web/package.json +0 -4
- package/web/storage/dist/storage.js +3 -3
- package/web/types/client.d.ts +5 -3
- package/web/types/core.d.ts +10 -1
- package/web/types/index.d.ts +27 -10
- package/web/types/server-mock.d.ts +47 -32
- package/web/types/server.d.ts +88 -0
package/web/dist/server.js
CHANGED
|
@@ -1,30 +1,517 @@
|
|
|
1
|
-
import { sharedConfig, createRoot, splitProps } from
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { sharedConfig, createRoot, splitProps } from "solid-js";
|
|
2
|
+
export {
|
|
3
|
+
ErrorBoundary,
|
|
4
|
+
For,
|
|
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";
|
|
5
31
|
|
|
6
|
-
const booleans = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
32
|
+
const booleans = [
|
|
33
|
+
"allowfullscreen",
|
|
34
|
+
"async",
|
|
35
|
+
"autofocus",
|
|
36
|
+
"autoplay",
|
|
37
|
+
"checked",
|
|
38
|
+
"controls",
|
|
39
|
+
"default",
|
|
40
|
+
"disabled",
|
|
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
|
+
"className",
|
|
62
|
+
"value",
|
|
63
|
+
"readOnly",
|
|
64
|
+
"formNoValidate",
|
|
65
|
+
"isMap",
|
|
66
|
+
"noModule",
|
|
67
|
+
"playsInline",
|
|
68
|
+
...booleans
|
|
69
|
+
]);
|
|
70
|
+
const ChildProperties = /*#__PURE__*/ new Set([
|
|
71
|
+
"innerHTML",
|
|
72
|
+
"textContent",
|
|
73
|
+
"innerText",
|
|
74
|
+
"children"
|
|
75
|
+
]);
|
|
76
|
+
const Aliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
10
77
|
className: "class",
|
|
11
78
|
htmlFor: "for"
|
|
12
79
|
});
|
|
80
|
+
const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
81
|
+
class: "className",
|
|
82
|
+
formnovalidate: {
|
|
83
|
+
$: "formNoValidate",
|
|
84
|
+
BUTTON: 1,
|
|
85
|
+
INPUT: 1
|
|
86
|
+
},
|
|
87
|
+
ismap: {
|
|
88
|
+
$: "isMap",
|
|
89
|
+
IMG: 1
|
|
90
|
+
},
|
|
91
|
+
nomodule: {
|
|
92
|
+
$: "noModule",
|
|
93
|
+
SCRIPT: 1
|
|
94
|
+
},
|
|
95
|
+
playsinline: {
|
|
96
|
+
$: "playsInline",
|
|
97
|
+
VIDEO: 1
|
|
98
|
+
},
|
|
99
|
+
readonly: {
|
|
100
|
+
$: "readOnly",
|
|
101
|
+
INPUT: 1,
|
|
102
|
+
TEXTAREA: 1
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
function getPropAlias(prop, tagName) {
|
|
106
|
+
const a = PropAliases[prop];
|
|
107
|
+
return typeof a === "object" ? (a[tagName] ? a["$"] : undefined) : a;
|
|
108
|
+
}
|
|
109
|
+
const DelegatedEvents = /*#__PURE__*/ new Set([
|
|
110
|
+
"beforeinput",
|
|
111
|
+
"click",
|
|
112
|
+
"dblclick",
|
|
113
|
+
"contextmenu",
|
|
114
|
+
"focusin",
|
|
115
|
+
"focusout",
|
|
116
|
+
"input",
|
|
117
|
+
"keydown",
|
|
118
|
+
"keyup",
|
|
119
|
+
"mousedown",
|
|
120
|
+
"mousemove",
|
|
121
|
+
"mouseout",
|
|
122
|
+
"mouseover",
|
|
123
|
+
"mouseup",
|
|
124
|
+
"pointerdown",
|
|
125
|
+
"pointermove",
|
|
126
|
+
"pointerout",
|
|
127
|
+
"pointerover",
|
|
128
|
+
"pointerup",
|
|
129
|
+
"touchend",
|
|
130
|
+
"touchmove",
|
|
131
|
+
"touchstart"
|
|
132
|
+
]);
|
|
133
|
+
const SVGElements = /*#__PURE__*/ new Set([
|
|
134
|
+
"altGlyph",
|
|
135
|
+
"altGlyphDef",
|
|
136
|
+
"altGlyphItem",
|
|
137
|
+
"animate",
|
|
138
|
+
"animateColor",
|
|
139
|
+
"animateMotion",
|
|
140
|
+
"animateTransform",
|
|
141
|
+
"circle",
|
|
142
|
+
"clipPath",
|
|
143
|
+
"color-profile",
|
|
144
|
+
"cursor",
|
|
145
|
+
"defs",
|
|
146
|
+
"desc",
|
|
147
|
+
"ellipse",
|
|
148
|
+
"feBlend",
|
|
149
|
+
"feColorMatrix",
|
|
150
|
+
"feComponentTransfer",
|
|
151
|
+
"feComposite",
|
|
152
|
+
"feConvolveMatrix",
|
|
153
|
+
"feDiffuseLighting",
|
|
154
|
+
"feDisplacementMap",
|
|
155
|
+
"feDistantLight",
|
|
156
|
+
"feDropShadow",
|
|
157
|
+
"feFlood",
|
|
158
|
+
"feFuncA",
|
|
159
|
+
"feFuncB",
|
|
160
|
+
"feFuncG",
|
|
161
|
+
"feFuncR",
|
|
162
|
+
"feGaussianBlur",
|
|
163
|
+
"feImage",
|
|
164
|
+
"feMerge",
|
|
165
|
+
"feMergeNode",
|
|
166
|
+
"feMorphology",
|
|
167
|
+
"feOffset",
|
|
168
|
+
"fePointLight",
|
|
169
|
+
"feSpecularLighting",
|
|
170
|
+
"feSpotLight",
|
|
171
|
+
"feTile",
|
|
172
|
+
"feTurbulence",
|
|
173
|
+
"filter",
|
|
174
|
+
"font",
|
|
175
|
+
"font-face",
|
|
176
|
+
"font-face-format",
|
|
177
|
+
"font-face-name",
|
|
178
|
+
"font-face-src",
|
|
179
|
+
"font-face-uri",
|
|
180
|
+
"foreignObject",
|
|
181
|
+
"g",
|
|
182
|
+
"glyph",
|
|
183
|
+
"glyphRef",
|
|
184
|
+
"hkern",
|
|
185
|
+
"image",
|
|
186
|
+
"line",
|
|
187
|
+
"linearGradient",
|
|
188
|
+
"marker",
|
|
189
|
+
"mask",
|
|
190
|
+
"metadata",
|
|
191
|
+
"missing-glyph",
|
|
192
|
+
"mpath",
|
|
193
|
+
"path",
|
|
194
|
+
"pattern",
|
|
195
|
+
"polygon",
|
|
196
|
+
"polyline",
|
|
197
|
+
"radialGradient",
|
|
198
|
+
"rect",
|
|
199
|
+
"set",
|
|
200
|
+
"stop",
|
|
201
|
+
"svg",
|
|
202
|
+
"switch",
|
|
203
|
+
"symbol",
|
|
204
|
+
"text",
|
|
205
|
+
"textPath",
|
|
206
|
+
"tref",
|
|
207
|
+
"tspan",
|
|
208
|
+
"use",
|
|
209
|
+
"view",
|
|
210
|
+
"vkern"
|
|
211
|
+
]);
|
|
212
|
+
const SVGNamespace = {
|
|
213
|
+
xlink: "http://www.w3.org/1999/xlink",
|
|
214
|
+
xml: "http://www.w3.org/XML/1998/namespace"
|
|
215
|
+
};
|
|
216
|
+
const DOMElements = /*#__PURE__*/ new Set([
|
|
217
|
+
"html",
|
|
218
|
+
"base",
|
|
219
|
+
"head",
|
|
220
|
+
"link",
|
|
221
|
+
"meta",
|
|
222
|
+
"style",
|
|
223
|
+
"title",
|
|
224
|
+
"body",
|
|
225
|
+
"address",
|
|
226
|
+
"article",
|
|
227
|
+
"aside",
|
|
228
|
+
"footer",
|
|
229
|
+
"header",
|
|
230
|
+
"main",
|
|
231
|
+
"nav",
|
|
232
|
+
"section",
|
|
233
|
+
"body",
|
|
234
|
+
"blockquote",
|
|
235
|
+
"dd",
|
|
236
|
+
"div",
|
|
237
|
+
"dl",
|
|
238
|
+
"dt",
|
|
239
|
+
"figcaption",
|
|
240
|
+
"figure",
|
|
241
|
+
"hr",
|
|
242
|
+
"li",
|
|
243
|
+
"ol",
|
|
244
|
+
"p",
|
|
245
|
+
"pre",
|
|
246
|
+
"ul",
|
|
247
|
+
"a",
|
|
248
|
+
"abbr",
|
|
249
|
+
"b",
|
|
250
|
+
"bdi",
|
|
251
|
+
"bdo",
|
|
252
|
+
"br",
|
|
253
|
+
"cite",
|
|
254
|
+
"code",
|
|
255
|
+
"data",
|
|
256
|
+
"dfn",
|
|
257
|
+
"em",
|
|
258
|
+
"i",
|
|
259
|
+
"kbd",
|
|
260
|
+
"mark",
|
|
261
|
+
"q",
|
|
262
|
+
"rp",
|
|
263
|
+
"rt",
|
|
264
|
+
"ruby",
|
|
265
|
+
"s",
|
|
266
|
+
"samp",
|
|
267
|
+
"small",
|
|
268
|
+
"span",
|
|
269
|
+
"strong",
|
|
270
|
+
"sub",
|
|
271
|
+
"sup",
|
|
272
|
+
"time",
|
|
273
|
+
"u",
|
|
274
|
+
"var",
|
|
275
|
+
"wbr",
|
|
276
|
+
"area",
|
|
277
|
+
"audio",
|
|
278
|
+
"img",
|
|
279
|
+
"map",
|
|
280
|
+
"track",
|
|
281
|
+
"video",
|
|
282
|
+
"embed",
|
|
283
|
+
"iframe",
|
|
284
|
+
"object",
|
|
285
|
+
"param",
|
|
286
|
+
"picture",
|
|
287
|
+
"portal",
|
|
288
|
+
"source",
|
|
289
|
+
"svg",
|
|
290
|
+
"math",
|
|
291
|
+
"canvas",
|
|
292
|
+
"noscript",
|
|
293
|
+
"script",
|
|
294
|
+
"del",
|
|
295
|
+
"ins",
|
|
296
|
+
"caption",
|
|
297
|
+
"col",
|
|
298
|
+
"colgroup",
|
|
299
|
+
"table",
|
|
300
|
+
"tbody",
|
|
301
|
+
"td",
|
|
302
|
+
"tfoot",
|
|
303
|
+
"th",
|
|
304
|
+
"thead",
|
|
305
|
+
"tr",
|
|
306
|
+
"button",
|
|
307
|
+
"datalist",
|
|
308
|
+
"fieldset",
|
|
309
|
+
"form",
|
|
310
|
+
"input",
|
|
311
|
+
"label",
|
|
312
|
+
"legend",
|
|
313
|
+
"meter",
|
|
314
|
+
"optgroup",
|
|
315
|
+
"option",
|
|
316
|
+
"output",
|
|
317
|
+
"progress",
|
|
318
|
+
"select",
|
|
319
|
+
"textarea",
|
|
320
|
+
"details",
|
|
321
|
+
"dialog",
|
|
322
|
+
"menu",
|
|
323
|
+
"summary",
|
|
324
|
+
"details",
|
|
325
|
+
"slot",
|
|
326
|
+
"template",
|
|
327
|
+
"acronym",
|
|
328
|
+
"applet",
|
|
329
|
+
"basefont",
|
|
330
|
+
"bgsound",
|
|
331
|
+
"big",
|
|
332
|
+
"blink",
|
|
333
|
+
"center",
|
|
334
|
+
"content",
|
|
335
|
+
"dir",
|
|
336
|
+
"font",
|
|
337
|
+
"frame",
|
|
338
|
+
"frameset",
|
|
339
|
+
"hgroup",
|
|
340
|
+
"image",
|
|
341
|
+
"keygen",
|
|
342
|
+
"marquee",
|
|
343
|
+
"menuitem",
|
|
344
|
+
"nobr",
|
|
345
|
+
"noembed",
|
|
346
|
+
"noframes",
|
|
347
|
+
"plaintext",
|
|
348
|
+
"rb",
|
|
349
|
+
"rtc",
|
|
350
|
+
"shadow",
|
|
351
|
+
"spacer",
|
|
352
|
+
"strike",
|
|
353
|
+
"tt",
|
|
354
|
+
"xmp",
|
|
355
|
+
"a",
|
|
356
|
+
"abbr",
|
|
357
|
+
"acronym",
|
|
358
|
+
"address",
|
|
359
|
+
"applet",
|
|
360
|
+
"area",
|
|
361
|
+
"article",
|
|
362
|
+
"aside",
|
|
363
|
+
"audio",
|
|
364
|
+
"b",
|
|
365
|
+
"base",
|
|
366
|
+
"basefont",
|
|
367
|
+
"bdi",
|
|
368
|
+
"bdo",
|
|
369
|
+
"bgsound",
|
|
370
|
+
"big",
|
|
371
|
+
"blink",
|
|
372
|
+
"blockquote",
|
|
373
|
+
"body",
|
|
374
|
+
"br",
|
|
375
|
+
"button",
|
|
376
|
+
"canvas",
|
|
377
|
+
"caption",
|
|
378
|
+
"center",
|
|
379
|
+
"cite",
|
|
380
|
+
"code",
|
|
381
|
+
"col",
|
|
382
|
+
"colgroup",
|
|
383
|
+
"content",
|
|
384
|
+
"data",
|
|
385
|
+
"datalist",
|
|
386
|
+
"dd",
|
|
387
|
+
"del",
|
|
388
|
+
"details",
|
|
389
|
+
"dfn",
|
|
390
|
+
"dialog",
|
|
391
|
+
"dir",
|
|
392
|
+
"div",
|
|
393
|
+
"dl",
|
|
394
|
+
"dt",
|
|
395
|
+
"em",
|
|
396
|
+
"embed",
|
|
397
|
+
"fieldset",
|
|
398
|
+
"figcaption",
|
|
399
|
+
"figure",
|
|
400
|
+
"font",
|
|
401
|
+
"footer",
|
|
402
|
+
"form",
|
|
403
|
+
"frame",
|
|
404
|
+
"frameset",
|
|
405
|
+
"head",
|
|
406
|
+
"header",
|
|
407
|
+
"hgroup",
|
|
408
|
+
"hr",
|
|
409
|
+
"html",
|
|
410
|
+
"i",
|
|
411
|
+
"iframe",
|
|
412
|
+
"image",
|
|
413
|
+
"img",
|
|
414
|
+
"input",
|
|
415
|
+
"ins",
|
|
416
|
+
"kbd",
|
|
417
|
+
"keygen",
|
|
418
|
+
"label",
|
|
419
|
+
"legend",
|
|
420
|
+
"li",
|
|
421
|
+
"link",
|
|
422
|
+
"main",
|
|
423
|
+
"map",
|
|
424
|
+
"mark",
|
|
425
|
+
"marquee",
|
|
426
|
+
"menu",
|
|
427
|
+
"menuitem",
|
|
428
|
+
"meta",
|
|
429
|
+
"meter",
|
|
430
|
+
"nav",
|
|
431
|
+
"nobr",
|
|
432
|
+
"noembed",
|
|
433
|
+
"noframes",
|
|
434
|
+
"noscript",
|
|
435
|
+
"object",
|
|
436
|
+
"ol",
|
|
437
|
+
"optgroup",
|
|
438
|
+
"option",
|
|
439
|
+
"output",
|
|
440
|
+
"p",
|
|
441
|
+
"param",
|
|
442
|
+
"picture",
|
|
443
|
+
"plaintext",
|
|
444
|
+
"portal",
|
|
445
|
+
"pre",
|
|
446
|
+
"progress",
|
|
447
|
+
"q",
|
|
448
|
+
"rb",
|
|
449
|
+
"rp",
|
|
450
|
+
"rt",
|
|
451
|
+
"rtc",
|
|
452
|
+
"ruby",
|
|
453
|
+
"s",
|
|
454
|
+
"samp",
|
|
455
|
+
"script",
|
|
456
|
+
"section",
|
|
457
|
+
"select",
|
|
458
|
+
"shadow",
|
|
459
|
+
"slot",
|
|
460
|
+
"small",
|
|
461
|
+
"source",
|
|
462
|
+
"spacer",
|
|
463
|
+
"span",
|
|
464
|
+
"strike",
|
|
465
|
+
"strong",
|
|
466
|
+
"style",
|
|
467
|
+
"sub",
|
|
468
|
+
"summary",
|
|
469
|
+
"sup",
|
|
470
|
+
"table",
|
|
471
|
+
"tbody",
|
|
472
|
+
"td",
|
|
473
|
+
"template",
|
|
474
|
+
"textarea",
|
|
475
|
+
"tfoot",
|
|
476
|
+
"th",
|
|
477
|
+
"thead",
|
|
478
|
+
"time",
|
|
479
|
+
"title",
|
|
480
|
+
"tr",
|
|
481
|
+
"track",
|
|
482
|
+
"tt",
|
|
483
|
+
"u",
|
|
484
|
+
"ul",
|
|
485
|
+
"var",
|
|
486
|
+
"video",
|
|
487
|
+
"wbr",
|
|
488
|
+
"xmp",
|
|
489
|
+
"input",
|
|
490
|
+
"h1",
|
|
491
|
+
"h2",
|
|
492
|
+
"h3",
|
|
493
|
+
"h4",
|
|
494
|
+
"h5",
|
|
495
|
+
"h6"
|
|
496
|
+
]);
|
|
13
497
|
|
|
14
|
-
const ES2017FLAG = Feature.AggregateError
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function createSerializer({
|
|
18
|
-
onData,
|
|
19
|
-
onDone,
|
|
20
|
-
scopeId,
|
|
21
|
-
onError
|
|
22
|
-
}) {
|
|
498
|
+
const ES2017FLAG = Feature.AggregateError | Feature.BigIntTypedArray;
|
|
499
|
+
const GLOBAL_IDENTIFIER = "_$HY.r";
|
|
500
|
+
function createSerializer({ onData, onDone, scopeId, onError }) {
|
|
23
501
|
return new Serializer({
|
|
24
502
|
scopeId,
|
|
25
503
|
plugins: [
|
|
26
|
-
|
|
27
|
-
|
|
504
|
+
CustomEventPlugin,
|
|
505
|
+
DOMExceptionPlugin,
|
|
506
|
+
EventPlugin,
|
|
507
|
+
FormDataPlugin,
|
|
508
|
+
HeadersPlugin,
|
|
509
|
+
ReadableStreamPlugin,
|
|
510
|
+
RequestPlugin,
|
|
511
|
+
ResponsePlugin,
|
|
512
|
+
URLSearchParamsPlugin,
|
|
513
|
+
URLPlugin
|
|
514
|
+
],
|
|
28
515
|
globalIdentifier: GLOBAL_IDENTIFIER,
|
|
29
516
|
disabledFeatures: ES2017FLAG,
|
|
30
517
|
onData,
|
|
@@ -33,15 +520,14 @@ function createSerializer({
|
|
|
33
520
|
});
|
|
34
521
|
}
|
|
35
522
|
function getLocalHeaderScript(id) {
|
|
36
|
-
return getCrossReferenceHeader(id) +
|
|
523
|
+
return getCrossReferenceHeader(id) + ";";
|
|
37
524
|
}
|
|
38
525
|
|
|
39
|
-
const VOID_ELEMENTS =
|
|
526
|
+
const VOID_ELEMENTS =
|
|
527
|
+
/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
40
528
|
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)}`;
|
|
41
529
|
function renderToString(code, options = {}) {
|
|
42
|
-
const {
|
|
43
|
-
renderId
|
|
44
|
-
} = options;
|
|
530
|
+
const { renderId } = options;
|
|
45
531
|
let scripts = "";
|
|
46
532
|
const serializer = createSerializer({
|
|
47
533
|
scopeId: renderId,
|
|
@@ -49,7 +535,7 @@ function renderToString(code, options = {}) {
|
|
|
49
535
|
if (!scripts) {
|
|
50
536
|
scripts = getLocalHeaderScript(renderId);
|
|
51
537
|
}
|
|
52
|
-
scripts += script;
|
|
538
|
+
scripts += script + ";";
|
|
53
539
|
},
|
|
54
540
|
onError: options.onError
|
|
55
541
|
});
|
|
@@ -79,9 +565,7 @@ function renderToString(code, options = {}) {
|
|
|
79
565
|
return html;
|
|
80
566
|
}
|
|
81
567
|
function renderToStringAsync(code, options = {}) {
|
|
82
|
-
const {
|
|
83
|
-
timeoutMs = 30000
|
|
84
|
-
} = options;
|
|
568
|
+
const { timeoutMs = 30000 } = options;
|
|
85
569
|
let timeoutHandle;
|
|
86
570
|
const timeout = new Promise((_, reject) => {
|
|
87
571
|
timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
|
|
@@ -92,13 +576,7 @@ function renderToStringAsync(code, options = {}) {
|
|
|
92
576
|
});
|
|
93
577
|
}
|
|
94
578
|
function renderToStream(code, options = {}) {
|
|
95
|
-
let {
|
|
96
|
-
nonce,
|
|
97
|
-
onCompleteShell,
|
|
98
|
-
onCompleteAll,
|
|
99
|
-
renderId,
|
|
100
|
-
noScripts
|
|
101
|
-
} = options;
|
|
579
|
+
let { nonce, onCompleteShell, onCompleteAll, renderId, noScripts } = options;
|
|
102
580
|
let dispose;
|
|
103
581
|
const blockingPromises = [];
|
|
104
582
|
const pushTask = task => {
|
|
@@ -114,11 +592,12 @@ function renderToStream(code, options = {}) {
|
|
|
114
592
|
const onDone = () => {
|
|
115
593
|
writeTasks();
|
|
116
594
|
doShell();
|
|
117
|
-
onCompleteAll &&
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
595
|
+
onCompleteAll &&
|
|
596
|
+
onCompleteAll({
|
|
597
|
+
write(v) {
|
|
598
|
+
!completed && buffer.write(v);
|
|
599
|
+
}
|
|
600
|
+
});
|
|
122
601
|
writable && writable.end();
|
|
123
602
|
completed = true;
|
|
124
603
|
if (firstFlushed) dispose();
|
|
@@ -175,17 +654,23 @@ function renderToStream(code, options = {}) {
|
|
|
175
654
|
const first = html.indexOf(placeholder);
|
|
176
655
|
if (first === -1) return;
|
|
177
656
|
const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
|
|
178
|
-
html = html.replace(
|
|
657
|
+
html = html.replace(
|
|
658
|
+
html.slice(first, last + placeholder.length + 1),
|
|
659
|
+
resolveSSRNode(payloadFn())
|
|
660
|
+
);
|
|
179
661
|
},
|
|
180
662
|
serialize(id, p, wait) {
|
|
181
663
|
const serverOnly = sharedConfig.context.noHydrate;
|
|
182
664
|
if (!firstFlushed && wait && typeof p === "object" && "then" in p) {
|
|
183
665
|
blockingPromises.push(p);
|
|
184
|
-
!serverOnly &&
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
666
|
+
!serverOnly &&
|
|
667
|
+
p
|
|
668
|
+
.then(d => {
|
|
669
|
+
serializer.write(id, d);
|
|
670
|
+
})
|
|
671
|
+
.catch(e => {
|
|
672
|
+
serializer.write(id, e);
|
|
673
|
+
});
|
|
189
674
|
} else if (!serverOnly) serializer.write(id, p);
|
|
190
675
|
},
|
|
191
676
|
roots: 0,
|
|
@@ -195,11 +680,15 @@ function renderToStream(code, options = {}) {
|
|
|
195
680
|
registerFragment(key) {
|
|
196
681
|
if (!registry.has(key)) {
|
|
197
682
|
let resolve, reject;
|
|
198
|
-
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
199
|
-
registry.set(key, err =>
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
683
|
+
const p = new Promise((r, rej) => ((resolve = r), (reject = rej)));
|
|
684
|
+
registry.set(key, err =>
|
|
685
|
+
queue(() =>
|
|
686
|
+
queue(() => {
|
|
687
|
+
err ? reject(err) : resolve(true);
|
|
688
|
+
queue(flushEnd);
|
|
689
|
+
})
|
|
690
|
+
)
|
|
691
|
+
);
|
|
203
692
|
serializer.write(key, p);
|
|
204
693
|
}
|
|
205
694
|
return (value, error) => {
|
|
@@ -212,7 +701,7 @@ function renderToStream(code, options = {}) {
|
|
|
212
701
|
}
|
|
213
702
|
if (!completed) {
|
|
214
703
|
if (!firstFlushed) {
|
|
215
|
-
queue(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
|
|
704
|
+
queue(() => (html = replacePlaceholder(html, key, value !== undefined ? value : "")));
|
|
216
705
|
resolve(error);
|
|
217
706
|
} else {
|
|
218
707
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
@@ -238,11 +727,12 @@ function renderToStream(code, options = {}) {
|
|
|
238
727
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
239
728
|
buffer.write(html);
|
|
240
729
|
tasks = "";
|
|
241
|
-
onCompleteShell &&
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
730
|
+
onCompleteShell &&
|
|
731
|
+
onCompleteShell({
|
|
732
|
+
write(v) {
|
|
733
|
+
!completed && buffer.write(v);
|
|
734
|
+
}
|
|
735
|
+
});
|
|
246
736
|
shellCompleted = true;
|
|
247
737
|
}
|
|
248
738
|
return {
|
|
@@ -277,7 +767,7 @@ function renderToStream(code, options = {}) {
|
|
|
277
767
|
pipeTo(w) {
|
|
278
768
|
return allSettled(blockingPromises).then(() => {
|
|
279
769
|
let resolve;
|
|
280
|
-
const p = new Promise(r => resolve = r);
|
|
770
|
+
const p = new Promise(r => (resolve = r));
|
|
281
771
|
setTimeout(() => {
|
|
282
772
|
doShell();
|
|
283
773
|
const encoder = new TextEncoder();
|
|
@@ -307,13 +797,13 @@ function renderToStream(code, options = {}) {
|
|
|
307
797
|
};
|
|
308
798
|
}
|
|
309
799
|
function HydrationScript(props) {
|
|
310
|
-
const {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
800
|
+
const { nonce } = sharedConfig.context;
|
|
801
|
+
return ssr(
|
|
802
|
+
generateHydrationScript({
|
|
803
|
+
nonce,
|
|
804
|
+
...props
|
|
805
|
+
})
|
|
806
|
+
);
|
|
317
807
|
}
|
|
318
808
|
function ssr(t, ...nodes) {
|
|
319
809
|
if (nodes.length) {
|
|
@@ -358,7 +848,8 @@ function ssrStyle(value) {
|
|
|
358
848
|
return result;
|
|
359
849
|
}
|
|
360
850
|
function ssrElement(tag, props, children, needsId) {
|
|
361
|
-
if (props == null) props = {};
|
|
851
|
+
if (props == null) props = {};
|
|
852
|
+
else if (typeof props === "function") props = props();
|
|
362
853
|
const skipChildren = VOID_ELEMENTS.test(tag);
|
|
363
854
|
const keys = Object.keys(props);
|
|
364
855
|
let result = `<${tag}${needsId ? ssrHydrationKey() : ""} `;
|
|
@@ -366,7 +857,8 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
366
857
|
for (let i = 0; i < keys.length; i++) {
|
|
367
858
|
const prop = keys[i];
|
|
368
859
|
if (ChildProperties.has(prop)) {
|
|
369
|
-
if (children === undefined && !skipChildren)
|
|
860
|
+
if (children === undefined && !skipChildren)
|
|
861
|
+
children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
370
862
|
continue;
|
|
371
863
|
}
|
|
372
864
|
const value = props[prop];
|
|
@@ -375,10 +867,14 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
375
867
|
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
376
868
|
if (classResolved) continue;
|
|
377
869
|
let n;
|
|
378
|
-
result += `class="${
|
|
870
|
+
result += `class="${
|
|
871
|
+
escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) +
|
|
872
|
+
ssrClassList(props.classList)
|
|
873
|
+
}"`;
|
|
379
874
|
classResolved = true;
|
|
380
875
|
} else if (BooleanAttributes.has(prop)) {
|
|
381
|
-
if (value) result += prop;
|
|
876
|
+
if (value) result += prop;
|
|
877
|
+
else continue;
|
|
382
878
|
} else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on") {
|
|
383
879
|
continue;
|
|
384
880
|
} else {
|
|
@@ -386,16 +882,17 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
386
882
|
}
|
|
387
883
|
if (i !== keys.length - 1) result += " ";
|
|
388
884
|
}
|
|
389
|
-
if (skipChildren)
|
|
390
|
-
|
|
391
|
-
|
|
885
|
+
if (skipChildren)
|
|
886
|
+
return {
|
|
887
|
+
t: result + "/>"
|
|
888
|
+
};
|
|
392
889
|
if (typeof children === "function") children = children();
|
|
393
890
|
return {
|
|
394
891
|
t: result + `>${resolveSSRNode(children, true)}</${tag}>`
|
|
395
892
|
};
|
|
396
893
|
}
|
|
397
894
|
function ssrAttribute(key, value, isBoolean) {
|
|
398
|
-
return isBoolean ? value ? " " + key : "" : value != null ? ` ${key}="${value}"` : "";
|
|
895
|
+
return isBoolean ? (value ? " " + key : "") : value != null ? ` ${key}="${value}"` : "";
|
|
399
896
|
}
|
|
400
897
|
function ssrHydrationKey() {
|
|
401
898
|
const hk = getHydrationKey();
|
|
@@ -439,12 +936,13 @@ function escape(s, attr) {
|
|
|
439
936
|
left = iDelim + 1;
|
|
440
937
|
iDelim = s.indexOf(delim, left);
|
|
441
938
|
} while (iDelim >= 0);
|
|
442
|
-
} else
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
939
|
+
} else
|
|
940
|
+
while (iAmp >= 0) {
|
|
941
|
+
if (left < iAmp) out += s.substring(left, iAmp);
|
|
942
|
+
out += "&";
|
|
943
|
+
left = iAmp + 1;
|
|
944
|
+
iAmp = s.indexOf("&", left);
|
|
945
|
+
}
|
|
448
946
|
return left < s.length ? out + s.substring(left) : out;
|
|
449
947
|
}
|
|
450
948
|
function resolveSSRNode(node, top) {
|
|
@@ -456,7 +954,7 @@ function resolveSSRNode(node, top) {
|
|
|
456
954
|
let mapped = "";
|
|
457
955
|
for (let i = 0, len = node.length; i < len; i++) {
|
|
458
956
|
if (!top && typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
|
|
459
|
-
mapped += resolveSSRNode(prev = node[i]);
|
|
957
|
+
mapped += resolveSSRNode((prev = node[i]));
|
|
460
958
|
}
|
|
461
959
|
return mapped;
|
|
462
960
|
}
|
|
@@ -477,11 +975,12 @@ function getAssets() {
|
|
|
477
975
|
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
478
976
|
return out;
|
|
479
977
|
}
|
|
480
|
-
function generateHydrationScript({
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
} =
|
|
484
|
-
|
|
978
|
+
function generateHydrationScript({ eventNames = ["click", "input"], nonce } = {}) {
|
|
979
|
+
return `<script${
|
|
980
|
+
nonce ? ` nonce="${nonce}"` : ""
|
|
981
|
+
}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join(
|
|
982
|
+
'", "'
|
|
983
|
+
)}"].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
984
|
}
|
|
486
985
|
function Hydration(props) {
|
|
487
986
|
if (!sharedConfig.context.noHydrate) return props.children;
|
|
@@ -540,16 +1039,20 @@ function replacePlaceholder(html, key, value) {
|
|
|
540
1039
|
}
|
|
541
1040
|
const RequestContext = Symbol();
|
|
542
1041
|
function getRequestEvent() {
|
|
543
|
-
return globalThis[RequestContext]
|
|
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;
|
|
544
1049
|
}
|
|
545
1050
|
function Assets(props) {
|
|
546
1051
|
useAssets(() => props.children);
|
|
547
1052
|
}
|
|
548
1053
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
549
1054
|
if (options.onReady) {
|
|
550
|
-
options.onCompleteShell = ({
|
|
551
|
-
write
|
|
552
|
-
}) => {
|
|
1055
|
+
options.onCompleteShell = ({ write }) => {
|
|
553
1056
|
options.onReady({
|
|
554
1057
|
write,
|
|
555
1058
|
startWriting() {
|
|
@@ -563,9 +1066,7 @@ function pipeToNodeWritable(code, writable, options = {}) {
|
|
|
563
1066
|
}
|
|
564
1067
|
function pipeToWritable(code, writable, options = {}) {
|
|
565
1068
|
if (options.onReady) {
|
|
566
|
-
options.onCompleteShell = ({
|
|
567
|
-
write
|
|
568
|
-
}) => {
|
|
1069
|
+
options.onCompleteShell = ({ write }) => {
|
|
569
1070
|
options.onReady({
|
|
570
1071
|
write,
|
|
571
1072
|
startWriting() {
|
|
@@ -595,35 +1096,49 @@ function ssrSpread(props, isSVG, skipChildren) {
|
|
|
595
1096
|
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
596
1097
|
if (classResolved) continue;
|
|
597
1098
|
let n;
|
|
598
|
-
result += `class="${(n = props.class) ? n + " " : ""}${
|
|
1099
|
+
result += `class="${(n = props.class) ? n + " " : ""}${
|
|
1100
|
+
(n = props.className) ? n + " " : ""
|
|
1101
|
+
}${ssrClassList(props.classList)}"`;
|
|
599
1102
|
classResolved = true;
|
|
600
1103
|
} else if (prop !== "value" && Properties.has(prop)) {
|
|
601
|
-
if (value) result += prop;
|
|
602
|
-
|
|
1104
|
+
if (value) result += prop;
|
|
1105
|
+
else continue;
|
|
1106
|
+
} else if (
|
|
1107
|
+
value == undefined ||
|
|
1108
|
+
prop === "ref" ||
|
|
1109
|
+
prop.slice(0, 2) === "on" ||
|
|
1110
|
+
prop.slice(0, 5) === "prop:"
|
|
1111
|
+
) {
|
|
603
1112
|
continue;
|
|
604
1113
|
} else {
|
|
605
|
-
if (prop.slice(0, 5) === "
|
|
606
|
-
|
|
1114
|
+
if (prop.slice(0, 5) === "bool:") {
|
|
1115
|
+
if (!value) continue;
|
|
1116
|
+
prop = prop.slice(5);
|
|
1117
|
+
result += `${escape(prop)}`;
|
|
1118
|
+
} else {
|
|
1119
|
+
if (prop.slice(0, 5) === "attr:") prop = prop.slice(5);
|
|
1120
|
+
result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
|
|
1121
|
+
}
|
|
607
1122
|
}
|
|
608
1123
|
if (i !== keys.length - 1) result += " ";
|
|
609
1124
|
}
|
|
610
1125
|
return result;
|
|
611
1126
|
}
|
|
1127
|
+
function notSup() {
|
|
1128
|
+
throw new Error(
|
|
1129
|
+
"Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>."
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
612
1132
|
|
|
613
1133
|
const isServer = true;
|
|
614
1134
|
const isDev = false;
|
|
615
|
-
function render() {}
|
|
616
|
-
function hydrate() {}
|
|
617
|
-
function insert() {}
|
|
618
|
-
function spread() {}
|
|
619
|
-
function addEventListener() {}
|
|
620
|
-
function delegateEvents() {}
|
|
621
1135
|
function Dynamic(props) {
|
|
622
1136
|
const [p, others] = splitProps(props, ["component"]);
|
|
623
1137
|
const comp = p.component,
|
|
624
1138
|
t = typeof comp;
|
|
625
1139
|
if (comp) {
|
|
626
|
-
if (t === "function") return comp(others);
|
|
1140
|
+
if (t === "function") return comp(others);
|
|
1141
|
+
else if (t === "string") {
|
|
627
1142
|
return ssrElement(comp, others, undefined, true);
|
|
628
1143
|
}
|
|
629
1144
|
}
|
|
@@ -632,4 +1147,60 @@ function Portal(props) {
|
|
|
632
1147
|
return "";
|
|
633
1148
|
}
|
|
634
1149
|
|
|
635
|
-
export {
|
|
1150
|
+
export {
|
|
1151
|
+
Aliases,
|
|
1152
|
+
Assets,
|
|
1153
|
+
ChildProperties,
|
|
1154
|
+
DOMElements,
|
|
1155
|
+
DelegatedEvents,
|
|
1156
|
+
Dynamic,
|
|
1157
|
+
Hydration,
|
|
1158
|
+
HydrationScript,
|
|
1159
|
+
NoHydration,
|
|
1160
|
+
Portal,
|
|
1161
|
+
Properties,
|
|
1162
|
+
RequestContext,
|
|
1163
|
+
SVGElements,
|
|
1164
|
+
SVGNamespace,
|
|
1165
|
+
notSup as addEventListener,
|
|
1166
|
+
notSup as assign,
|
|
1167
|
+
notSup as classList,
|
|
1168
|
+
notSup as className,
|
|
1169
|
+
notSup as delegateEvents,
|
|
1170
|
+
notSup as dynamicProperty,
|
|
1171
|
+
escape,
|
|
1172
|
+
generateHydrationScript,
|
|
1173
|
+
getAssets,
|
|
1174
|
+
getHydrationKey,
|
|
1175
|
+
notSup as getNextElement,
|
|
1176
|
+
notSup as getNextMarker,
|
|
1177
|
+
notSup as getNextMatch,
|
|
1178
|
+
getPropAlias,
|
|
1179
|
+
getRequestEvent,
|
|
1180
|
+
notSup as hydrate,
|
|
1181
|
+
notSup as insert,
|
|
1182
|
+
isDev,
|
|
1183
|
+
isServer,
|
|
1184
|
+
pipeToNodeWritable,
|
|
1185
|
+
pipeToWritable,
|
|
1186
|
+
notSup as render,
|
|
1187
|
+
renderToStream,
|
|
1188
|
+
renderToString,
|
|
1189
|
+
renderToStringAsync,
|
|
1190
|
+
resolveSSRNode,
|
|
1191
|
+
notSup as runHydrationEvents,
|
|
1192
|
+
notSup as setAttribute,
|
|
1193
|
+
notSup as setAttributeNS,
|
|
1194
|
+
notSup as setProperty,
|
|
1195
|
+
notSup as spread,
|
|
1196
|
+
ssr,
|
|
1197
|
+
ssrAttribute,
|
|
1198
|
+
ssrClassList,
|
|
1199
|
+
ssrElement,
|
|
1200
|
+
ssrHydrationKey,
|
|
1201
|
+
ssrSpread,
|
|
1202
|
+
ssrStyle,
|
|
1203
|
+
notSup as style,
|
|
1204
|
+
notSup as template,
|
|
1205
|
+
useAssets
|
|
1206
|
+
};
|