solid-js 1.8.19 → 1.8.21
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 +6 -6
- package/dist/dev.js +562 -321
- package/dist/server.js +168 -74
- package/dist/solid.cjs +6 -6
- package/dist/solid.js +489 -279
- package/h/dist/h.js +38 -9
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +11 -8
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +216 -94
- package/html/types/lit.d.ts +47 -33
- package/package.json +1 -1
- package/store/dist/dev.js +122 -43
- package/store/dist/server.js +19 -8
- package/store/dist/store.js +113 -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 +12 -4
- package/store/types/store.d.ts +218 -61
- package/types/index.d.ts +75 -10
- package/types/jsx.d.ts +913 -862
- 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 +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 +34 -18
- package/web/dist/dev.js +655 -97
- package/web/dist/server.cjs +1 -1
- package/web/dist/server.js +210 -96
- package/web/dist/web.cjs +32 -16
- package/web/dist/web.js +646 -95
- package/web/storage/dist/storage.js +3 -3
- package/web/types/client.d.ts +2 -2
- 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/dist/dev.js
CHANGED
|
@@ -1,14 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createRoot,
|
|
3
|
+
createRenderEffect,
|
|
4
|
+
untrack,
|
|
5
|
+
sharedConfig,
|
|
6
|
+
enableHydration,
|
|
7
|
+
getOwner,
|
|
8
|
+
createEffect,
|
|
9
|
+
runWithOwner,
|
|
10
|
+
createMemo,
|
|
11
|
+
createSignal,
|
|
12
|
+
onCleanup,
|
|
13
|
+
splitProps,
|
|
14
|
+
$DEVCOMP
|
|
15
|
+
} from "solid-js";
|
|
16
|
+
export {
|
|
17
|
+
ErrorBoundary,
|
|
18
|
+
For,
|
|
19
|
+
Index,
|
|
20
|
+
Match,
|
|
21
|
+
Show,
|
|
22
|
+
Suspense,
|
|
23
|
+
SuspenseList,
|
|
24
|
+
Switch,
|
|
25
|
+
createComponent,
|
|
26
|
+
createRenderEffect as effect,
|
|
27
|
+
getOwner,
|
|
28
|
+
createMemo as memo,
|
|
29
|
+
mergeProps,
|
|
30
|
+
untrack
|
|
31
|
+
} from "solid-js";
|
|
3
32
|
|
|
4
|
-
const booleans = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
33
|
+
const booleans = [
|
|
34
|
+
"allowfullscreen",
|
|
35
|
+
"async",
|
|
36
|
+
"autofocus",
|
|
37
|
+
"autoplay",
|
|
38
|
+
"checked",
|
|
39
|
+
"controls",
|
|
40
|
+
"default",
|
|
41
|
+
"disabled",
|
|
42
|
+
"formnovalidate",
|
|
43
|
+
"hidden",
|
|
44
|
+
"indeterminate",
|
|
45
|
+
"inert",
|
|
46
|
+
"ismap",
|
|
47
|
+
"loop",
|
|
48
|
+
"multiple",
|
|
49
|
+
"muted",
|
|
50
|
+
"nomodule",
|
|
51
|
+
"novalidate",
|
|
52
|
+
"open",
|
|
53
|
+
"playsinline",
|
|
54
|
+
"readonly",
|
|
55
|
+
"required",
|
|
56
|
+
"reversed",
|
|
57
|
+
"seamless",
|
|
58
|
+
"selected"
|
|
59
|
+
];
|
|
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), {
|
|
8
77
|
className: "class",
|
|
9
78
|
htmlFor: "for"
|
|
10
79
|
});
|
|
11
|
-
const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
80
|
+
const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
12
81
|
class: "className",
|
|
13
82
|
formnovalidate: {
|
|
14
83
|
$: "formNoValidate",
|
|
@@ -35,19 +104,396 @@ const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
|
35
104
|
});
|
|
36
105
|
function getPropAlias(prop, tagName) {
|
|
37
106
|
const a = PropAliases[prop];
|
|
38
|
-
return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
|
|
39
|
-
}
|
|
40
|
-
const DelegatedEvents = /*#__PURE__*/new Set([
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
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
|
+
]);
|
|
46
212
|
const SVGNamespace = {
|
|
47
213
|
xlink: "http://www.w3.org/1999/xlink",
|
|
48
214
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
49
215
|
};
|
|
50
|
-
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
|
+
]);
|
|
51
497
|
|
|
52
498
|
function reconcileArrays(parentNode, a, b) {
|
|
53
499
|
let bLength = b.length,
|
|
@@ -68,7 +514,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
68
514
|
bEnd--;
|
|
69
515
|
}
|
|
70
516
|
if (aEnd === aStart) {
|
|
71
|
-
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
517
|
+
const node = bEnd < bLength ? (bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart]) : after;
|
|
72
518
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
73
519
|
} else if (bEnd === bStart) {
|
|
74
520
|
while (aStart < aEnd) {
|
|
@@ -109,12 +555,16 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
109
555
|
const $$EVENTS = "_$DX_DELEGATE";
|
|
110
556
|
function render(code, element, init, options = {}) {
|
|
111
557
|
if (!element) {
|
|
112
|
-
throw new Error(
|
|
558
|
+
throw new Error(
|
|
559
|
+
"The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document."
|
|
560
|
+
);
|
|
113
561
|
}
|
|
114
562
|
let disposer;
|
|
115
563
|
createRoot(dispose => {
|
|
116
564
|
disposer = dispose;
|
|
117
|
-
element === document
|
|
565
|
+
element === document
|
|
566
|
+
? code()
|
|
567
|
+
: insert(element, code(), element.firstChild ? null : undefined, init);
|
|
118
568
|
}, options.owner);
|
|
119
569
|
return () => {
|
|
120
570
|
disposer();
|
|
@@ -124,12 +574,17 @@ function render(code, element, init, options = {}) {
|
|
|
124
574
|
function template(html, isCE, isSVG) {
|
|
125
575
|
let node;
|
|
126
576
|
const create = () => {
|
|
127
|
-
if (
|
|
577
|
+
if (isHydrating())
|
|
578
|
+
throw new Error(
|
|
579
|
+
"Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration."
|
|
580
|
+
);
|
|
128
581
|
const t = document.createElement("template");
|
|
129
582
|
t.innerHTML = html;
|
|
130
583
|
return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
131
584
|
};
|
|
132
|
-
const fn = isCE
|
|
585
|
+
const fn = isCE
|
|
586
|
+
? () => untrack(() => document.importNode(node || (node = create()), true))
|
|
587
|
+
: () => (node || (node = create())).cloneNode(true);
|
|
133
588
|
fn.cloneNode = fn;
|
|
134
589
|
return fn;
|
|
135
590
|
}
|
|
@@ -150,20 +605,23 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
150
605
|
}
|
|
151
606
|
}
|
|
152
607
|
function setProperty(node, name, value) {
|
|
153
|
-
if (
|
|
608
|
+
if (isHydrating(node)) return;
|
|
154
609
|
node[name] = value;
|
|
155
610
|
}
|
|
156
611
|
function setAttribute(node, name, value) {
|
|
157
|
-
if (
|
|
158
|
-
if (value == null) node.removeAttribute(name);
|
|
612
|
+
if (isHydrating(node)) return;
|
|
613
|
+
if (value == null) node.removeAttribute(name);
|
|
614
|
+
else node.setAttribute(name, value);
|
|
159
615
|
}
|
|
160
616
|
function setAttributeNS(node, namespace, name, value) {
|
|
161
|
-
if (
|
|
162
|
-
if (value == null) node.removeAttributeNS(namespace, name);
|
|
617
|
+
if (isHydrating(node)) return;
|
|
618
|
+
if (value == null) node.removeAttributeNS(namespace, name);
|
|
619
|
+
else node.setAttributeNS(namespace, name, value);
|
|
163
620
|
}
|
|
164
621
|
function className(node, value) {
|
|
165
|
-
if (
|
|
166
|
-
if (value == null) node.removeAttribute("class");
|
|
622
|
+
if (isHydrating(node)) return;
|
|
623
|
+
if (value == null) node.removeAttribute("class");
|
|
624
|
+
else node.className = value;
|
|
167
625
|
}
|
|
168
626
|
function addEventListener(node, name, handler, delegate) {
|
|
169
627
|
if (delegate) {
|
|
@@ -173,7 +631,7 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
173
631
|
} else node[`$$${name}`] = handler;
|
|
174
632
|
} else if (Array.isArray(handler)) {
|
|
175
633
|
const handlerFn = handler[0];
|
|
176
|
-
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
634
|
+
node.addEventListener(name, (handler[0] = e => handlerFn.call(node, handler[1], e)));
|
|
177
635
|
} else node.addEventListener(name, handler);
|
|
178
636
|
}
|
|
179
637
|
function classList(node, value, prev = {}) {
|
|
@@ -198,7 +656,7 @@ function classList(node, value, prev = {}) {
|
|
|
198
656
|
function style(node, value, prev) {
|
|
199
657
|
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
200
658
|
const nodeStyle = node.style;
|
|
201
|
-
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
659
|
+
if (typeof value === "string") return (nodeStyle.cssText = value);
|
|
202
660
|
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
203
661
|
prev || (prev = {});
|
|
204
662
|
value || (value = {});
|
|
@@ -219,7 +677,9 @@ function style(node, value, prev) {
|
|
|
219
677
|
function spread(node, props = {}, isSVG, skipChildren) {
|
|
220
678
|
const prevProps = {};
|
|
221
679
|
if (!skipChildren) {
|
|
222
|
-
createRenderEffect(
|
|
680
|
+
createRenderEffect(
|
|
681
|
+
() => (prevProps.children = insertExpression(node, props.children, prevProps.children))
|
|
682
|
+
);
|
|
223
683
|
}
|
|
224
684
|
createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
|
|
225
685
|
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
@@ -261,6 +721,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
|
|
|
261
721
|
}
|
|
262
722
|
}
|
|
263
723
|
function hydrate$1(code, element, options = {}) {
|
|
724
|
+
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
264
725
|
sharedConfig.completed = globalThis._$HY.completed;
|
|
265
726
|
sharedConfig.events = globalThis._$HY.events;
|
|
266
727
|
sharedConfig.load = id => globalThis._$HY.r[id];
|
|
@@ -271,15 +732,20 @@ function hydrate$1(code, element, options = {}) {
|
|
|
271
732
|
id: options.renderId || "",
|
|
272
733
|
count: 0
|
|
273
734
|
};
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
735
|
+
try {
|
|
736
|
+
gatherHydratable(element, options.renderId);
|
|
737
|
+
return render(code, element, [...element.childNodes], options);
|
|
738
|
+
} finally {
|
|
739
|
+
sharedConfig.context = null;
|
|
740
|
+
}
|
|
278
741
|
}
|
|
279
742
|
function getNextElement(template) {
|
|
280
|
-
let node,
|
|
281
|
-
|
|
282
|
-
|
|
743
|
+
let node,
|
|
744
|
+
key,
|
|
745
|
+
hydrating = isHydrating();
|
|
746
|
+
if (!hydrating || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
|
|
747
|
+
if (hydrating)
|
|
748
|
+
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
283
749
|
return template();
|
|
284
750
|
}
|
|
285
751
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
@@ -294,11 +760,12 @@ function getNextMarker(start) {
|
|
|
294
760
|
let end = start,
|
|
295
761
|
count = 0,
|
|
296
762
|
current = [];
|
|
297
|
-
if (
|
|
763
|
+
if (isHydrating(start)) {
|
|
298
764
|
while (end) {
|
|
299
765
|
if (end.nodeType === 8) {
|
|
300
766
|
const v = end.nodeValue;
|
|
301
|
-
if (v === "$") count++;
|
|
767
|
+
if (v === "$") count++;
|
|
768
|
+
else if (v === "/") {
|
|
302
769
|
if (count === 0) return [end, current];
|
|
303
770
|
count--;
|
|
304
771
|
}
|
|
@@ -312,27 +779,32 @@ function getNextMarker(start) {
|
|
|
312
779
|
function runHydrationEvents() {
|
|
313
780
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
314
781
|
queueMicrotask(() => {
|
|
315
|
-
const {
|
|
316
|
-
completed,
|
|
317
|
-
events
|
|
318
|
-
} = sharedConfig;
|
|
782
|
+
const { completed, events } = sharedConfig;
|
|
319
783
|
events.queued = false;
|
|
320
784
|
while (events.length) {
|
|
321
785
|
const [el, e] = events[0];
|
|
322
786
|
if (!completed.has(el)) return;
|
|
323
|
-
eventHandler(e);
|
|
324
787
|
events.shift();
|
|
788
|
+
eventHandler(e);
|
|
789
|
+
}
|
|
790
|
+
if (sharedConfig.done) {
|
|
791
|
+
sharedConfig.events = _$HY.events = null;
|
|
792
|
+
sharedConfig.completed = _$HY.completed = null;
|
|
325
793
|
}
|
|
326
794
|
});
|
|
327
795
|
sharedConfig.events.queued = true;
|
|
328
796
|
}
|
|
329
797
|
}
|
|
798
|
+
function isHydrating(node) {
|
|
799
|
+
return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
|
|
800
|
+
}
|
|
330
801
|
function toPropertyName(name) {
|
|
331
802
|
return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
|
|
332
803
|
}
|
|
333
804
|
function toggleClassKey(node, key, value) {
|
|
334
805
|
const classNames = key.trim().split(/\s+/);
|
|
335
|
-
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
806
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
807
|
+
node.classList.toggle(classNames[i], value);
|
|
336
808
|
}
|
|
337
809
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
338
810
|
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
@@ -362,21 +834,33 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
362
834
|
}
|
|
363
835
|
} else if (prop.slice(0, 5) === "attr:") {
|
|
364
836
|
setAttribute(node, prop.slice(5), value);
|
|
365
|
-
} else if (
|
|
837
|
+
} else if (
|
|
838
|
+
(forceProp = prop.slice(0, 5) === "prop:") ||
|
|
839
|
+
(isChildProp = ChildProperties.has(prop)) ||
|
|
840
|
+
(!isSVG &&
|
|
841
|
+
((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop)))) ||
|
|
842
|
+
(isCE = node.nodeName.includes("-"))
|
|
843
|
+
) {
|
|
366
844
|
if (forceProp) {
|
|
367
845
|
prop = prop.slice(5);
|
|
368
846
|
isProp = true;
|
|
369
|
-
} else if (
|
|
370
|
-
if (prop === "class" || prop === "className") className(node, value);
|
|
847
|
+
} else if (isHydrating(node)) return value;
|
|
848
|
+
if (prop === "class" || prop === "className") className(node, value);
|
|
849
|
+
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
850
|
+
else node[propAlias || prop] = value;
|
|
371
851
|
} else {
|
|
372
852
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
373
|
-
if (ns) setAttributeNS(node, ns, prop, value);
|
|
853
|
+
if (ns) setAttributeNS(node, ns, prop, value);
|
|
854
|
+
else setAttribute(node, Aliases[prop] || prop, value);
|
|
374
855
|
}
|
|
375
856
|
return value;
|
|
376
857
|
}
|
|
377
858
|
function eventHandler(e) {
|
|
859
|
+
if (sharedConfig.registry && sharedConfig.events) {
|
|
860
|
+
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
861
|
+
}
|
|
378
862
|
const key = `$$${e.type}`;
|
|
379
|
-
let node = e.composedPath && e.composedPath()[0] || e.target;
|
|
863
|
+
let node = (e.composedPath && e.composedPath()[0]) || e.target;
|
|
380
864
|
if (e.target !== node) {
|
|
381
865
|
Object.defineProperty(e, "target", {
|
|
382
866
|
configurable: true,
|
|
@@ -401,13 +885,14 @@ function eventHandler(e) {
|
|
|
401
885
|
}
|
|
402
886
|
}
|
|
403
887
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
404
|
-
const hydrating =
|
|
888
|
+
const hydrating = isHydrating(parent);
|
|
405
889
|
if (hydrating) {
|
|
406
890
|
!current && (current = [...parent.childNodes]);
|
|
407
891
|
let cleaned = [];
|
|
408
892
|
for (let i = 0; i < current.length; i++) {
|
|
409
893
|
const node = current[i];
|
|
410
|
-
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
894
|
+
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
895
|
+
else cleaned.push(node);
|
|
411
896
|
}
|
|
412
897
|
current = cleaned;
|
|
413
898
|
}
|
|
@@ -415,7 +900,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
415
900
|
if (value === current) return current;
|
|
416
901
|
const t = typeof value,
|
|
417
902
|
multi = marker !== undefined;
|
|
418
|
-
parent = multi && current[0] && current[0].parentNode || parent;
|
|
903
|
+
parent = (multi && current[0] && current[0].parentNode) || parent;
|
|
419
904
|
if (t === "string" || t === "number") {
|
|
420
905
|
if (hydrating) return current;
|
|
421
906
|
if (t === "number") {
|
|
@@ -447,16 +932,17 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
447
932
|
const array = [];
|
|
448
933
|
const currentArray = current && Array.isArray(current);
|
|
449
934
|
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
450
|
-
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
935
|
+
createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
|
|
451
936
|
return () => current;
|
|
452
937
|
}
|
|
453
938
|
if (hydrating) {
|
|
454
939
|
if (!array.length) return current;
|
|
455
|
-
if (marker === undefined) return [...parent.childNodes];
|
|
940
|
+
if (marker === undefined) return (current = [...parent.childNodes]);
|
|
456
941
|
let node = array[0];
|
|
457
|
-
|
|
942
|
+
if (node.parentNode !== parent) return current;
|
|
943
|
+
const nodes = [node];
|
|
458
944
|
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
459
|
-
return current = nodes;
|
|
945
|
+
return (current = nodes);
|
|
460
946
|
}
|
|
461
947
|
if (array.length === 0) {
|
|
462
948
|
current = cleanChildren(parent, current, marker);
|
|
@@ -471,9 +957,9 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
471
957
|
}
|
|
472
958
|
current = array;
|
|
473
959
|
} else if (value.nodeType) {
|
|
474
|
-
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
960
|
+
if (hydrating && value.parentNode) return (current = multi ? [value] : value);
|
|
475
961
|
if (Array.isArray(current)) {
|
|
476
|
-
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
962
|
+
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
|
477
963
|
cleanChildren(parent, current, null, value);
|
|
478
964
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
479
965
|
parent.appendChild(value);
|
|
@@ -488,21 +974,28 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
488
974
|
let item = array[i],
|
|
489
975
|
prev = current && current[normalized.length],
|
|
490
976
|
t;
|
|
491
|
-
if (item == null || item === true || item === false)
|
|
977
|
+
if (item == null || item === true || item === false);
|
|
978
|
+
else if ((t = typeof item) === "object" && item.nodeType) {
|
|
492
979
|
normalized.push(item);
|
|
493
980
|
} else if (Array.isArray(item)) {
|
|
494
981
|
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
495
982
|
} else if (t === "function") {
|
|
496
983
|
if (unwrap) {
|
|
497
984
|
while (typeof item === "function") item = item();
|
|
498
|
-
dynamic =
|
|
985
|
+
dynamic =
|
|
986
|
+
normalizeIncomingArray(
|
|
987
|
+
normalized,
|
|
988
|
+
Array.isArray(item) ? item : [item],
|
|
989
|
+
Array.isArray(prev) ? prev : [prev]
|
|
990
|
+
) || dynamic;
|
|
499
991
|
} else {
|
|
500
992
|
normalized.push(item);
|
|
501
993
|
dynamic = true;
|
|
502
994
|
}
|
|
503
995
|
} else {
|
|
504
996
|
const value = String(item);
|
|
505
|
-
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
997
|
+
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
998
|
+
else normalized.push(document.createTextNode(value));
|
|
506
999
|
}
|
|
507
1000
|
}
|
|
508
1001
|
return dynamic;
|
|
@@ -511,7 +1004,7 @@ function appendNodes(parent, array, marker = null) {
|
|
|
511
1004
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
512
1005
|
}
|
|
513
1006
|
function cleanChildren(parent, current, marker, replacement) {
|
|
514
|
-
if (marker === undefined) return parent.textContent = "";
|
|
1007
|
+
if (marker === undefined) return (parent.textContent = "");
|
|
515
1008
|
const node = replacement || document.createTextNode("");
|
|
516
1009
|
if (current.length) {
|
|
517
1010
|
let inserted = false;
|
|
@@ -519,7 +1012,9 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
519
1012
|
const el = current[i];
|
|
520
1013
|
if (node !== el) {
|
|
521
1014
|
const isParent = el.parentNode === parent;
|
|
522
|
-
if (!inserted && !i)
|
|
1015
|
+
if (!inserted && !i)
|
|
1016
|
+
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
1017
|
+
else isParent && el.remove();
|
|
523
1018
|
} else inserted = true;
|
|
524
1019
|
}
|
|
525
1020
|
} else parent.insertBefore(node, marker);
|
|
@@ -530,7 +1025,8 @@ function gatherHydratable(element, root) {
|
|
|
530
1025
|
for (let i = 0; i < templates.length; i++) {
|
|
531
1026
|
const node = templates[i];
|
|
532
1027
|
const key = node.getAttribute("data-hk");
|
|
533
|
-
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1028
|
+
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1029
|
+
sharedConfig.registry.set(key, node);
|
|
534
1030
|
}
|
|
535
1031
|
}
|
|
536
1032
|
function getHydrationKey() {
|
|
@@ -582,42 +1078,47 @@ const hydrate = (...args) => {
|
|
|
582
1078
|
return hydrate$1(...args);
|
|
583
1079
|
};
|
|
584
1080
|
function Portal(props) {
|
|
585
|
-
const {
|
|
586
|
-
useShadow
|
|
587
|
-
} = props,
|
|
1081
|
+
const { useShadow } = props,
|
|
588
1082
|
marker = document.createTextNode(""),
|
|
589
1083
|
mount = () => props.mount || document.body,
|
|
590
1084
|
owner = getOwner();
|
|
591
1085
|
let content;
|
|
592
1086
|
let hydrating = !!sharedConfig.context;
|
|
593
|
-
createEffect(
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
1087
|
+
createEffect(
|
|
1088
|
+
() => {
|
|
1089
|
+
if (hydrating) getOwner().user = hydrating = false;
|
|
1090
|
+
content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
|
|
1091
|
+
const el = mount();
|
|
1092
|
+
if (el instanceof HTMLHeadElement) {
|
|
1093
|
+
const [clean, setClean] = createSignal(false);
|
|
1094
|
+
const cleanup = () => setClean(true);
|
|
1095
|
+
createRoot(dispose => insert(el, () => (!clean() ? content() : dispose()), null));
|
|
1096
|
+
onCleanup(cleanup);
|
|
1097
|
+
} else {
|
|
1098
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
1099
|
+
renderRoot =
|
|
1100
|
+
useShadow && container.attachShadow
|
|
1101
|
+
? container.attachShadow({
|
|
1102
|
+
mode: "open"
|
|
1103
|
+
})
|
|
1104
|
+
: container;
|
|
1105
|
+
Object.defineProperty(container, "_$host", {
|
|
1106
|
+
get() {
|
|
1107
|
+
return marker.parentNode;
|
|
1108
|
+
},
|
|
1109
|
+
configurable: true
|
|
1110
|
+
});
|
|
1111
|
+
insert(renderRoot, content);
|
|
1112
|
+
el.appendChild(container);
|
|
1113
|
+
props.ref && props.ref(container);
|
|
1114
|
+
onCleanup(() => el.removeChild(container));
|
|
1115
|
+
}
|
|
1116
|
+
},
|
|
1117
|
+
undefined,
|
|
1118
|
+
{
|
|
1119
|
+
render: !hydrating
|
|
617
1120
|
}
|
|
618
|
-
|
|
619
|
-
render: !hydrating
|
|
620
|
-
});
|
|
1121
|
+
);
|
|
621
1122
|
return marker;
|
|
622
1123
|
}
|
|
623
1124
|
function Dynamic(props) {
|
|
@@ -640,4 +1141,61 @@ function Dynamic(props) {
|
|
|
640
1141
|
});
|
|
641
1142
|
}
|
|
642
1143
|
|
|
643
|
-
export {
|
|
1144
|
+
export {
|
|
1145
|
+
Aliases,
|
|
1146
|
+
voidFn as Assets,
|
|
1147
|
+
ChildProperties,
|
|
1148
|
+
DOMElements,
|
|
1149
|
+
DelegatedEvents,
|
|
1150
|
+
Dynamic,
|
|
1151
|
+
Hydration,
|
|
1152
|
+
voidFn as HydrationScript,
|
|
1153
|
+
NoHydration,
|
|
1154
|
+
Portal,
|
|
1155
|
+
Properties,
|
|
1156
|
+
RequestContext,
|
|
1157
|
+
SVGElements,
|
|
1158
|
+
SVGNamespace,
|
|
1159
|
+
addEventListener,
|
|
1160
|
+
assign,
|
|
1161
|
+
classList,
|
|
1162
|
+
className,
|
|
1163
|
+
clearDelegatedEvents,
|
|
1164
|
+
delegateEvents,
|
|
1165
|
+
dynamicProperty,
|
|
1166
|
+
escape,
|
|
1167
|
+
voidFn as generateHydrationScript,
|
|
1168
|
+
voidFn as getAssets,
|
|
1169
|
+
getHydrationKey,
|
|
1170
|
+
getNextElement,
|
|
1171
|
+
getNextMarker,
|
|
1172
|
+
getNextMatch,
|
|
1173
|
+
getPropAlias,
|
|
1174
|
+
voidFn as getRequestEvent,
|
|
1175
|
+
hydrate,
|
|
1176
|
+
innerHTML,
|
|
1177
|
+
insert,
|
|
1178
|
+
isDev,
|
|
1179
|
+
isServer,
|
|
1180
|
+
render,
|
|
1181
|
+
renderToStream,
|
|
1182
|
+
renderToString,
|
|
1183
|
+
renderToStringAsync,
|
|
1184
|
+
resolveSSRNode,
|
|
1185
|
+
runHydrationEvents,
|
|
1186
|
+
setAttribute,
|
|
1187
|
+
setAttributeNS,
|
|
1188
|
+
setProperty,
|
|
1189
|
+
spread,
|
|
1190
|
+
ssr,
|
|
1191
|
+
ssrAttribute,
|
|
1192
|
+
ssrClassList,
|
|
1193
|
+
ssrElement,
|
|
1194
|
+
ssrHydrationKey,
|
|
1195
|
+
ssrSpread,
|
|
1196
|
+
ssrStyle,
|
|
1197
|
+
style,
|
|
1198
|
+
template,
|
|
1199
|
+
use,
|
|
1200
|
+
voidFn as useAssets
|
|
1201
|
+
};
|