solid-js 1.9.2 → 1.9.3
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.js +559 -318
- package/dist/server.js +168 -74
- package/dist/solid.js +486 -276
- package/h/dist/h.js +40 -9
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +11 -8
- package/h/jsx-runtime/types/jsx.d.ts +93 -91
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +219 -94
- package/html/types/lit.d.ts +52 -33
- package/package.json +1 -1
- package/store/dist/dev.js +123 -43
- package/store/dist/server.js +20 -8
- package/store/dist/store.js +114 -40
- 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 +25 -5
- package/store/types/store.d.ts +218 -61
- package/types/index.d.ts +75 -10
- package/types/jsx.d.ts +143 -157
- 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 +233 -142
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +71 -35
- 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.js +639 -89
- package/web/dist/server.cjs +13 -10
- package/web/dist/server.js +653 -118
- package/web/dist/web.js +627 -87
- package/web/storage/dist/storage.js +3 -3
- package/web/types/client.d.ts +1 -1
- 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 +1 -1
package/web/dist/server.js
CHANGED
|
@@ -1,17 +1,83 @@
|
|
|
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
|
-
|
|
10
|
-
|
|
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), {
|
|
11
77
|
className: "class",
|
|
12
78
|
htmlFor: "for"
|
|
13
79
|
});
|
|
14
|
-
const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
80
|
+
const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
15
81
|
class: "className",
|
|
16
82
|
formnovalidate: {
|
|
17
83
|
$: "formNoValidate",
|
|
@@ -38,34 +104,414 @@ const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
|
38
104
|
});
|
|
39
105
|
function getPropAlias(prop, tagName) {
|
|
40
106
|
const a = PropAliases[prop];
|
|
41
|
-
return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
|
|
42
|
-
}
|
|
43
|
-
const DelegatedEvents = /*#__PURE__*/new Set([
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
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
|
+
]);
|
|
49
212
|
const SVGNamespace = {
|
|
50
213
|
xlink: "http://www.w3.org/1999/xlink",
|
|
51
214
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
52
215
|
};
|
|
53
|
-
const DOMElements = /*#__PURE__*/new Set([
|
|
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
|
+
]);
|
|
54
497
|
|
|
55
|
-
const ES2017FLAG = Feature.AggregateError
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
function createSerializer({
|
|
59
|
-
onData,
|
|
60
|
-
onDone,
|
|
61
|
-
scopeId,
|
|
62
|
-
onError
|
|
63
|
-
}) {
|
|
498
|
+
const ES2017FLAG = Feature.AggregateError | Feature.BigIntTypedArray;
|
|
499
|
+
const GLOBAL_IDENTIFIER = "_$HY.r";
|
|
500
|
+
function createSerializer({ onData, onDone, scopeId, onError }) {
|
|
64
501
|
return new Serializer({
|
|
65
502
|
scopeId,
|
|
66
503
|
plugins: [
|
|
67
|
-
|
|
68
|
-
|
|
504
|
+
CustomEventPlugin,
|
|
505
|
+
DOMExceptionPlugin,
|
|
506
|
+
EventPlugin,
|
|
507
|
+
FormDataPlugin,
|
|
508
|
+
HeadersPlugin,
|
|
509
|
+
ReadableStreamPlugin,
|
|
510
|
+
RequestPlugin,
|
|
511
|
+
ResponsePlugin,
|
|
512
|
+
URLSearchParamsPlugin,
|
|
513
|
+
URLPlugin
|
|
514
|
+
],
|
|
69
515
|
globalIdentifier: GLOBAL_IDENTIFIER,
|
|
70
516
|
disabledFeatures: ES2017FLAG,
|
|
71
517
|
onData,
|
|
@@ -74,15 +520,14 @@ function createSerializer({
|
|
|
74
520
|
});
|
|
75
521
|
}
|
|
76
522
|
function getLocalHeaderScript(id) {
|
|
77
|
-
return getCrossReferenceHeader(id) +
|
|
523
|
+
return getCrossReferenceHeader(id) + ";";
|
|
78
524
|
}
|
|
79
525
|
|
|
80
|
-
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;
|
|
81
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)}`;
|
|
82
529
|
function renderToString(code, options = {}) {
|
|
83
|
-
const {
|
|
84
|
-
renderId
|
|
85
|
-
} = options;
|
|
530
|
+
const { renderId } = options;
|
|
86
531
|
let scripts = "";
|
|
87
532
|
const serializer = createSerializer({
|
|
88
533
|
scopeId: renderId,
|
|
@@ -120,9 +565,7 @@ function renderToString(code, options = {}) {
|
|
|
120
565
|
return html;
|
|
121
566
|
}
|
|
122
567
|
function renderToStringAsync(code, options = {}) {
|
|
123
|
-
const {
|
|
124
|
-
timeoutMs = 30000
|
|
125
|
-
} = options;
|
|
568
|
+
const { timeoutMs = 30000 } = options;
|
|
126
569
|
let timeoutHandle;
|
|
127
570
|
const timeout = new Promise((_, reject) => {
|
|
128
571
|
timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
|
|
@@ -133,13 +576,7 @@ function renderToStringAsync(code, options = {}) {
|
|
|
133
576
|
});
|
|
134
577
|
}
|
|
135
578
|
function renderToStream(code, options = {}) {
|
|
136
|
-
let {
|
|
137
|
-
nonce,
|
|
138
|
-
onCompleteShell,
|
|
139
|
-
onCompleteAll,
|
|
140
|
-
renderId,
|
|
141
|
-
noScripts
|
|
142
|
-
} = options;
|
|
579
|
+
let { nonce, onCompleteShell, onCompleteAll, renderId, noScripts } = options;
|
|
143
580
|
let dispose;
|
|
144
581
|
const blockingPromises = [];
|
|
145
582
|
const pushTask = task => {
|
|
@@ -155,11 +592,12 @@ function renderToStream(code, options = {}) {
|
|
|
155
592
|
const onDone = () => {
|
|
156
593
|
writeTasks();
|
|
157
594
|
doShell();
|
|
158
|
-
onCompleteAll &&
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
595
|
+
onCompleteAll &&
|
|
596
|
+
onCompleteAll({
|
|
597
|
+
write(v) {
|
|
598
|
+
!completed && buffer.write(v);
|
|
599
|
+
}
|
|
600
|
+
});
|
|
163
601
|
writable && writable.end();
|
|
164
602
|
completed = true;
|
|
165
603
|
if (firstFlushed) dispose();
|
|
@@ -216,17 +654,23 @@ function renderToStream(code, options = {}) {
|
|
|
216
654
|
const first = html.indexOf(placeholder);
|
|
217
655
|
if (first === -1) return;
|
|
218
656
|
const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
|
|
219
|
-
html = html.replace(
|
|
657
|
+
html = html.replace(
|
|
658
|
+
html.slice(first, last + placeholder.length + 1),
|
|
659
|
+
resolveSSRNode(payloadFn())
|
|
660
|
+
);
|
|
220
661
|
},
|
|
221
662
|
serialize(id, p, wait) {
|
|
222
663
|
const serverOnly = sharedConfig.context.noHydrate;
|
|
223
664
|
if (!firstFlushed && wait && typeof p === "object" && "then" in p) {
|
|
224
665
|
blockingPromises.push(p);
|
|
225
|
-
!serverOnly &&
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
666
|
+
!serverOnly &&
|
|
667
|
+
p
|
|
668
|
+
.then(d => {
|
|
669
|
+
serializer.write(id, d);
|
|
670
|
+
})
|
|
671
|
+
.catch(e => {
|
|
672
|
+
serializer.write(id, e);
|
|
673
|
+
});
|
|
230
674
|
} else if (!serverOnly) serializer.write(id, p);
|
|
231
675
|
},
|
|
232
676
|
roots: 0,
|
|
@@ -236,11 +680,15 @@ function renderToStream(code, options = {}) {
|
|
|
236
680
|
registerFragment(key) {
|
|
237
681
|
if (!registry.has(key)) {
|
|
238
682
|
let resolve, reject;
|
|
239
|
-
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
240
|
-
registry.set(key, err =>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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
|
+
);
|
|
244
692
|
serializer.write(key, p);
|
|
245
693
|
}
|
|
246
694
|
return (value, error) => {
|
|
@@ -253,7 +701,7 @@ function renderToStream(code, options = {}) {
|
|
|
253
701
|
}
|
|
254
702
|
if (!completed) {
|
|
255
703
|
if (!firstFlushed) {
|
|
256
|
-
queue(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
|
|
704
|
+
queue(() => (html = replacePlaceholder(html, key, value !== undefined ? value : "")));
|
|
257
705
|
resolve(error);
|
|
258
706
|
} else {
|
|
259
707
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
@@ -279,11 +727,12 @@ function renderToStream(code, options = {}) {
|
|
|
279
727
|
if (tasks.length) html = injectScripts(html, tasks, nonce);
|
|
280
728
|
buffer.write(html);
|
|
281
729
|
tasks = "";
|
|
282
|
-
onCompleteShell &&
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
730
|
+
onCompleteShell &&
|
|
731
|
+
onCompleteShell({
|
|
732
|
+
write(v) {
|
|
733
|
+
!completed && buffer.write(v);
|
|
734
|
+
}
|
|
735
|
+
});
|
|
287
736
|
shellCompleted = true;
|
|
288
737
|
}
|
|
289
738
|
return {
|
|
@@ -318,7 +767,7 @@ function renderToStream(code, options = {}) {
|
|
|
318
767
|
pipeTo(w) {
|
|
319
768
|
return allSettled(blockingPromises).then(() => {
|
|
320
769
|
let resolve;
|
|
321
|
-
const p = new Promise(r => resolve = r);
|
|
770
|
+
const p = new Promise(r => (resolve = r));
|
|
322
771
|
setTimeout(() => {
|
|
323
772
|
doShell();
|
|
324
773
|
const encoder = new TextEncoder();
|
|
@@ -348,13 +797,13 @@ function renderToStream(code, options = {}) {
|
|
|
348
797
|
};
|
|
349
798
|
}
|
|
350
799
|
function HydrationScript(props) {
|
|
351
|
-
const {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
800
|
+
const { nonce } = sharedConfig.context;
|
|
801
|
+
return ssr(
|
|
802
|
+
generateHydrationScript({
|
|
803
|
+
nonce,
|
|
804
|
+
...props
|
|
805
|
+
})
|
|
806
|
+
);
|
|
358
807
|
}
|
|
359
808
|
function ssr(t, ...nodes) {
|
|
360
809
|
if (nodes.length) {
|
|
@@ -399,7 +848,8 @@ function ssrStyle(value) {
|
|
|
399
848
|
return result;
|
|
400
849
|
}
|
|
401
850
|
function ssrElement(tag, props, children, needsId) {
|
|
402
|
-
if (props == null) props = {};
|
|
851
|
+
if (props == null) props = {};
|
|
852
|
+
else if (typeof props === "function") props = props();
|
|
403
853
|
const skipChildren = VOID_ELEMENTS.test(tag);
|
|
404
854
|
const keys = Object.keys(props);
|
|
405
855
|
let result = `<${tag}${needsId ? ssrHydrationKey() : ""} `;
|
|
@@ -407,7 +857,8 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
407
857
|
for (let i = 0; i < keys.length; i++) {
|
|
408
858
|
const prop = keys[i];
|
|
409
859
|
if (ChildProperties.has(prop)) {
|
|
410
|
-
if (children === undefined && !skipChildren)
|
|
860
|
+
if (children === undefined && !skipChildren)
|
|
861
|
+
children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
411
862
|
continue;
|
|
412
863
|
}
|
|
413
864
|
const value = props[prop];
|
|
@@ -416,27 +867,42 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
416
867
|
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
417
868
|
if (classResolved) continue;
|
|
418
869
|
let n;
|
|
419
|
-
result += `class="${
|
|
870
|
+
result += `class="${
|
|
871
|
+
escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) +
|
|
872
|
+
ssrClassList(props.classList)
|
|
873
|
+
}"`;
|
|
420
874
|
classResolved = true;
|
|
421
875
|
} else if (BooleanAttributes.has(prop)) {
|
|
422
|
-
if (value) result += prop;
|
|
423
|
-
|
|
876
|
+
if (value) result += prop;
|
|
877
|
+
else continue;
|
|
878
|
+
} else if (
|
|
879
|
+
value == undefined ||
|
|
880
|
+
prop === "ref" ||
|
|
881
|
+
prop.slice(0, 2) === "on" ||
|
|
882
|
+
prop.slice(0, 5) === "prop:"
|
|
883
|
+
) {
|
|
424
884
|
continue;
|
|
885
|
+
} else if (prop.slice(0, 5) === "bool:") {
|
|
886
|
+
if (!value) continue;
|
|
887
|
+
result += escape(prop.slice(5));
|
|
888
|
+
} else if (prop.slice(0, 5) === "attr:") {
|
|
889
|
+
result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
|
|
425
890
|
} else {
|
|
426
891
|
result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
|
|
427
892
|
}
|
|
428
893
|
if (i !== keys.length - 1) result += " ";
|
|
429
894
|
}
|
|
430
|
-
if (skipChildren)
|
|
431
|
-
|
|
432
|
-
|
|
895
|
+
if (skipChildren)
|
|
896
|
+
return {
|
|
897
|
+
t: result + "/>"
|
|
898
|
+
};
|
|
433
899
|
if (typeof children === "function") children = children();
|
|
434
900
|
return {
|
|
435
901
|
t: result + `>${resolveSSRNode(children, true)}</${tag}>`
|
|
436
902
|
};
|
|
437
903
|
}
|
|
438
904
|
function ssrAttribute(key, value, isBoolean) {
|
|
439
|
-
return isBoolean ? value ? " " + key : "" : value != null ? ` ${key}="${value}"` : "";
|
|
905
|
+
return isBoolean ? (value ? " " + key : "") : value != null ? ` ${key}="${value}"` : "";
|
|
440
906
|
}
|
|
441
907
|
function ssrHydrationKey() {
|
|
442
908
|
const hk = getHydrationKey();
|
|
@@ -480,12 +946,13 @@ function escape(s, attr) {
|
|
|
480
946
|
left = iDelim + 1;
|
|
481
947
|
iDelim = s.indexOf(delim, left);
|
|
482
948
|
} while (iDelim >= 0);
|
|
483
|
-
} else
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
949
|
+
} else
|
|
950
|
+
while (iAmp >= 0) {
|
|
951
|
+
if (left < iAmp) out += s.substring(left, iAmp);
|
|
952
|
+
out += "&";
|
|
953
|
+
left = iAmp + 1;
|
|
954
|
+
iAmp = s.indexOf("&", left);
|
|
955
|
+
}
|
|
489
956
|
return left < s.length ? out + s.substring(left) : out;
|
|
490
957
|
}
|
|
491
958
|
function resolveSSRNode(node, top) {
|
|
@@ -497,7 +964,7 @@ function resolveSSRNode(node, top) {
|
|
|
497
964
|
let mapped = "";
|
|
498
965
|
for (let i = 0, len = node.length; i < len; i++) {
|
|
499
966
|
if (!top && typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
|
|
500
|
-
mapped += resolveSSRNode(prev = node[i]);
|
|
967
|
+
mapped += resolveSSRNode((prev = node[i]));
|
|
501
968
|
}
|
|
502
969
|
return mapped;
|
|
503
970
|
}
|
|
@@ -518,11 +985,12 @@ function getAssets() {
|
|
|
518
985
|
for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
|
|
519
986
|
return out;
|
|
520
987
|
}
|
|
521
|
-
function generateHydrationScript({
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
} =
|
|
525
|
-
|
|
988
|
+
function generateHydrationScript({ eventNames = ["click", "input"], nonce } = {}) {
|
|
989
|
+
return `<script${
|
|
990
|
+
nonce ? ` nonce="${nonce}"` : ""
|
|
991
|
+
}>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(
|
|
992
|
+
'", "'
|
|
993
|
+
)}"].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-->`;
|
|
526
994
|
}
|
|
527
995
|
function Hydration(props) {
|
|
528
996
|
if (!sharedConfig.context.noHydrate) return props.children;
|
|
@@ -538,7 +1006,7 @@ function Hydration(props) {
|
|
|
538
1006
|
return res;
|
|
539
1007
|
}
|
|
540
1008
|
function NoHydration(props) {
|
|
541
|
-
sharedConfig.context.noHydrate = true;
|
|
1009
|
+
if (sharedConfig.context) sharedConfig.context.noHydrate = true;
|
|
542
1010
|
return props.children;
|
|
543
1011
|
}
|
|
544
1012
|
function queue(fn) {
|
|
@@ -581,16 +1049,20 @@ function replacePlaceholder(html, key, value) {
|
|
|
581
1049
|
}
|
|
582
1050
|
const RequestContext = Symbol();
|
|
583
1051
|
function getRequestEvent() {
|
|
584
|
-
return globalThis[RequestContext]
|
|
1052
|
+
return globalThis[RequestContext]
|
|
1053
|
+
? globalThis[RequestContext].getStore() ||
|
|
1054
|
+
(sharedConfig.context && sharedConfig.context.event) ||
|
|
1055
|
+
console.log(
|
|
1056
|
+
"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."
|
|
1057
|
+
)
|
|
1058
|
+
: undefined;
|
|
585
1059
|
}
|
|
586
1060
|
function Assets(props) {
|
|
587
1061
|
useAssets(() => props.children);
|
|
588
1062
|
}
|
|
589
1063
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
590
1064
|
if (options.onReady) {
|
|
591
|
-
options.onCompleteShell = ({
|
|
592
|
-
write
|
|
593
|
-
}) => {
|
|
1065
|
+
options.onCompleteShell = ({ write }) => {
|
|
594
1066
|
options.onReady({
|
|
595
1067
|
write,
|
|
596
1068
|
startWriting() {
|
|
@@ -604,9 +1076,7 @@ function pipeToNodeWritable(code, writable, options = {}) {
|
|
|
604
1076
|
}
|
|
605
1077
|
function pipeToWritable(code, writable, options = {}) {
|
|
606
1078
|
if (options.onReady) {
|
|
607
|
-
options.onCompleteShell = ({
|
|
608
|
-
write
|
|
609
|
-
}) => {
|
|
1079
|
+
options.onCompleteShell = ({ write }) => {
|
|
610
1080
|
options.onReady({
|
|
611
1081
|
write,
|
|
612
1082
|
startWriting() {
|
|
@@ -636,28 +1106,36 @@ function ssrSpread(props, isSVG, skipChildren) {
|
|
|
636
1106
|
} else if (prop === "class" || prop === "className" || prop === "classList") {
|
|
637
1107
|
if (classResolved) continue;
|
|
638
1108
|
let n;
|
|
639
|
-
result += `class="${(n = props.class) ? n + " " : ""}${
|
|
1109
|
+
result += `class="${(n = props.class) ? n + " " : ""}${
|
|
1110
|
+
(n = props.className) ? n + " " : ""
|
|
1111
|
+
}${ssrClassList(props.classList)}"`;
|
|
640
1112
|
classResolved = true;
|
|
641
1113
|
} else if (prop !== "value" && Properties.has(prop)) {
|
|
642
|
-
if (value) result += prop;
|
|
643
|
-
|
|
1114
|
+
if (value) result += prop;
|
|
1115
|
+
else continue;
|
|
1116
|
+
} else if (
|
|
1117
|
+
value == undefined ||
|
|
1118
|
+
prop === "ref" ||
|
|
1119
|
+
prop.slice(0, 2) === "on" ||
|
|
1120
|
+
prop.slice(0, 5) === "prop:"
|
|
1121
|
+
) {
|
|
644
1122
|
continue;
|
|
1123
|
+
} else if (prop.slice(0, 5) === "bool:") {
|
|
1124
|
+
if (!value) continue;
|
|
1125
|
+
result += escape(prop.slice(5));
|
|
1126
|
+
} else if (prop.slice(0, 5) === "attr:") {
|
|
1127
|
+
result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
|
|
645
1128
|
} else {
|
|
646
|
-
|
|
647
|
-
if (!value) continue;
|
|
648
|
-
prop = prop.slice(5);
|
|
649
|
-
result += `${escape(prop)}`;
|
|
650
|
-
} else {
|
|
651
|
-
if (prop.slice(0, 5) === "attr:") prop = prop.slice(5);
|
|
652
|
-
result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
|
|
653
|
-
}
|
|
1129
|
+
result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
|
|
654
1130
|
}
|
|
655
1131
|
if (i !== keys.length - 1) result += " ";
|
|
656
1132
|
}
|
|
657
1133
|
return result;
|
|
658
1134
|
}
|
|
659
1135
|
function notSup() {
|
|
660
|
-
throw new Error(
|
|
1136
|
+
throw new Error(
|
|
1137
|
+
"Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>."
|
|
1138
|
+
);
|
|
661
1139
|
}
|
|
662
1140
|
|
|
663
1141
|
const isServer = true;
|
|
@@ -667,7 +1145,8 @@ function Dynamic(props) {
|
|
|
667
1145
|
const comp = p.component,
|
|
668
1146
|
t = typeof comp;
|
|
669
1147
|
if (comp) {
|
|
670
|
-
if (t === "function") return comp(others);
|
|
1148
|
+
if (t === "function") return comp(others);
|
|
1149
|
+
else if (t === "string") {
|
|
671
1150
|
return ssrElement(comp, others, undefined, true);
|
|
672
1151
|
}
|
|
673
1152
|
}
|
|
@@ -676,4 +1155,60 @@ function Portal(props) {
|
|
|
676
1155
|
return "";
|
|
677
1156
|
}
|
|
678
1157
|
|
|
679
|
-
export {
|
|
1158
|
+
export {
|
|
1159
|
+
Aliases,
|
|
1160
|
+
Assets,
|
|
1161
|
+
ChildProperties,
|
|
1162
|
+
DOMElements,
|
|
1163
|
+
DelegatedEvents,
|
|
1164
|
+
Dynamic,
|
|
1165
|
+
Hydration,
|
|
1166
|
+
HydrationScript,
|
|
1167
|
+
NoHydration,
|
|
1168
|
+
Portal,
|
|
1169
|
+
Properties,
|
|
1170
|
+
RequestContext,
|
|
1171
|
+
SVGElements,
|
|
1172
|
+
SVGNamespace,
|
|
1173
|
+
notSup as addEventListener,
|
|
1174
|
+
notSup as assign,
|
|
1175
|
+
notSup as classList,
|
|
1176
|
+
notSup as className,
|
|
1177
|
+
notSup as delegateEvents,
|
|
1178
|
+
notSup as dynamicProperty,
|
|
1179
|
+
escape,
|
|
1180
|
+
generateHydrationScript,
|
|
1181
|
+
getAssets,
|
|
1182
|
+
getHydrationKey,
|
|
1183
|
+
notSup as getNextElement,
|
|
1184
|
+
notSup as getNextMarker,
|
|
1185
|
+
notSup as getNextMatch,
|
|
1186
|
+
getPropAlias,
|
|
1187
|
+
getRequestEvent,
|
|
1188
|
+
notSup as hydrate,
|
|
1189
|
+
notSup as insert,
|
|
1190
|
+
isDev,
|
|
1191
|
+
isServer,
|
|
1192
|
+
pipeToNodeWritable,
|
|
1193
|
+
pipeToWritable,
|
|
1194
|
+
notSup as render,
|
|
1195
|
+
renderToStream,
|
|
1196
|
+
renderToString,
|
|
1197
|
+
renderToStringAsync,
|
|
1198
|
+
resolveSSRNode,
|
|
1199
|
+
notSup as runHydrationEvents,
|
|
1200
|
+
notSup as setAttribute,
|
|
1201
|
+
notSup as setAttributeNS,
|
|
1202
|
+
notSup as setProperty,
|
|
1203
|
+
notSup as spread,
|
|
1204
|
+
ssr,
|
|
1205
|
+
ssrAttribute,
|
|
1206
|
+
ssrClassList,
|
|
1207
|
+
ssrElement,
|
|
1208
|
+
ssrHydrationKey,
|
|
1209
|
+
ssrSpread,
|
|
1210
|
+
ssrStyle,
|
|
1211
|
+
notSup as style,
|
|
1212
|
+
notSup as template,
|
|
1213
|
+
useAssets
|
|
1214
|
+
};
|