solid-js 1.9.2 → 1.9.4
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 +5 -5
- package/dist/dev.js +563 -322
- package/dist/server.cjs +50 -10
- package/dist/server.js +220 -83
- package/dist/solid.cjs +5 -5
- package/dist/solid.js +490 -280
- 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.cjs +1 -1
- package/store/dist/dev.js +123 -43
- package/store/dist/server.js +20 -8
- package/store/dist/store.cjs +1 -1
- 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 +18 -13
- package/web/dist/server.js +657 -120
- 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/storage/types/index.js +0 -13
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, isImportNode, isSVG) {
|
|
125
575
|
let node;
|
|
126
576
|
const create = () => {
|
|
127
|
-
if (isHydrating())
|
|
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 = isImportNode
|
|
585
|
+
const fn = isImportNode
|
|
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
|
}
|
|
@@ -155,11 +610,13 @@ function setProperty(node, name, value) {
|
|
|
155
610
|
}
|
|
156
611
|
function setAttribute(node, name, value) {
|
|
157
612
|
if (isHydrating(node)) return;
|
|
158
|
-
if (value == null) node.removeAttribute(name);
|
|
613
|
+
if (value == null) node.removeAttribute(name);
|
|
614
|
+
else node.setAttribute(name, value);
|
|
159
615
|
}
|
|
160
616
|
function setAttributeNS(node, namespace, name, value) {
|
|
161
617
|
if (isHydrating(node)) return;
|
|
162
|
-
if (value == null) node.removeAttributeNS(namespace, name);
|
|
618
|
+
if (value == null) node.removeAttributeNS(namespace, name);
|
|
619
|
+
else node.setAttributeNS(namespace, name, value);
|
|
163
620
|
}
|
|
164
621
|
function setBoolAttribute(node, name, value) {
|
|
165
622
|
if (isHydrating(node)) return;
|
|
@@ -167,7 +624,8 @@ function setBoolAttribute(node, name, value) {
|
|
|
167
624
|
}
|
|
168
625
|
function className(node, value) {
|
|
169
626
|
if (isHydrating(node)) return;
|
|
170
|
-
if (value == null) node.removeAttribute("class");
|
|
627
|
+
if (value == null) node.removeAttribute("class");
|
|
628
|
+
else node.className = value;
|
|
171
629
|
}
|
|
172
630
|
function addEventListener(node, name, handler, delegate) {
|
|
173
631
|
if (delegate) {
|
|
@@ -177,7 +635,7 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
177
635
|
} else node[`$$${name}`] = handler;
|
|
178
636
|
} else if (Array.isArray(handler)) {
|
|
179
637
|
const handlerFn = handler[0];
|
|
180
|
-
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
638
|
+
node.addEventListener(name, (handler[0] = e => handlerFn.call(node, handler[1], e)));
|
|
181
639
|
} else node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
182
640
|
}
|
|
183
641
|
function classList(node, value, prev = {}) {
|
|
@@ -202,7 +660,7 @@ function classList(node, value, prev = {}) {
|
|
|
202
660
|
function style(node, value, prev) {
|
|
203
661
|
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
204
662
|
const nodeStyle = node.style;
|
|
205
|
-
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
663
|
+
if (typeof value === "string") return (nodeStyle.cssText = value);
|
|
206
664
|
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
207
665
|
prev || (prev = {});
|
|
208
666
|
value || (value = {});
|
|
@@ -223,7 +681,9 @@ function style(node, value, prev) {
|
|
|
223
681
|
function spread(node, props = {}, isSVG, skipChildren) {
|
|
224
682
|
const prevProps = {};
|
|
225
683
|
if (!skipChildren) {
|
|
226
|
-
createRenderEffect(
|
|
684
|
+
createRenderEffect(
|
|
685
|
+
() => (prevProps.children = insertExpression(node, props.children, prevProps.children))
|
|
686
|
+
);
|
|
227
687
|
}
|
|
228
688
|
createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
|
|
229
689
|
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
@@ -287,10 +747,14 @@ function getNextElement(template) {
|
|
|
287
747
|
let node,
|
|
288
748
|
key,
|
|
289
749
|
hydrating = isHydrating();
|
|
290
|
-
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
750
|
+
if (!hydrating || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
|
|
291
751
|
if (hydrating) {
|
|
292
752
|
sharedConfig.done = true;
|
|
293
|
-
throw new Error(
|
|
753
|
+
throw new Error(
|
|
754
|
+
`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}\n${
|
|
755
|
+
template ? template().outerHTML : ""
|
|
756
|
+
}`
|
|
757
|
+
);
|
|
294
758
|
}
|
|
295
759
|
return template();
|
|
296
760
|
}
|
|
@@ -310,7 +774,8 @@ function getNextMarker(start) {
|
|
|
310
774
|
while (end) {
|
|
311
775
|
if (end.nodeType === 8) {
|
|
312
776
|
const v = end.nodeValue;
|
|
313
|
-
if (v === "$") count++;
|
|
777
|
+
if (v === "$") count++;
|
|
778
|
+
else if (v === "/") {
|
|
314
779
|
if (count === 0) return [end, current];
|
|
315
780
|
count--;
|
|
316
781
|
}
|
|
@@ -324,10 +789,7 @@ function getNextMarker(start) {
|
|
|
324
789
|
function runHydrationEvents() {
|
|
325
790
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
326
791
|
queueMicrotask(() => {
|
|
327
|
-
const {
|
|
328
|
-
completed,
|
|
329
|
-
events
|
|
330
|
-
} = sharedConfig;
|
|
792
|
+
const { completed, events } = sharedConfig;
|
|
331
793
|
if (!events) return;
|
|
332
794
|
events.queued = false;
|
|
333
795
|
while (events.length) {
|
|
@@ -352,7 +814,8 @@ function toPropertyName(name) {
|
|
|
352
814
|
}
|
|
353
815
|
function toggleClassKey(node, key, value) {
|
|
354
816
|
const classNames = key.trim().split(/\s+/);
|
|
355
|
-
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
817
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
818
|
+
node.classList.toggle(classNames[i], value);
|
|
356
819
|
}
|
|
357
820
|
function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
|
|
358
821
|
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
@@ -384,15 +847,24 @@ function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
|
|
|
384
847
|
setAttribute(node, prop.slice(5), value);
|
|
385
848
|
} else if (prop.slice(0, 5) === "bool:") {
|
|
386
849
|
setBoolAttribute(node, prop.slice(5), value);
|
|
387
|
-
} else if (
|
|
850
|
+
} else if (
|
|
851
|
+
(forceProp = prop.slice(0, 5) === "prop:") ||
|
|
852
|
+
(isChildProp = ChildProperties.has(prop)) ||
|
|
853
|
+
(!isSVG &&
|
|
854
|
+
((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop)))) ||
|
|
855
|
+
(isCE = node.nodeName.includes("-") || "is" in props)
|
|
856
|
+
) {
|
|
388
857
|
if (forceProp) {
|
|
389
858
|
prop = prop.slice(5);
|
|
390
859
|
isProp = true;
|
|
391
860
|
} else if (isHydrating(node)) return value;
|
|
392
|
-
if (prop === "class" || prop === "className") className(node, value);
|
|
861
|
+
if (prop === "class" || prop === "className") className(node, value);
|
|
862
|
+
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
863
|
+
else node[propAlias || prop] = value;
|
|
393
864
|
} else {
|
|
394
865
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
395
|
-
if (ns) setAttributeNS(node, ns, prop, value);
|
|
866
|
+
if (ns) setAttributeNS(node, ns, prop, value);
|
|
867
|
+
else setAttribute(node, Aliases[prop] || prop, value);
|
|
396
868
|
}
|
|
397
869
|
return value;
|
|
398
870
|
}
|
|
@@ -404,10 +876,11 @@ function eventHandler(e) {
|
|
|
404
876
|
const key = `$$${e.type}`;
|
|
405
877
|
const oriTarget = e.target;
|
|
406
878
|
const oriCurrentTarget = e.currentTarget;
|
|
407
|
-
const retarget = value =>
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
879
|
+
const retarget = value =>
|
|
880
|
+
Object.defineProperty(e, "target", {
|
|
881
|
+
configurable: true,
|
|
882
|
+
value
|
|
883
|
+
});
|
|
411
884
|
const handleNode = () => {
|
|
412
885
|
const handler = node[key];
|
|
413
886
|
if (handler && !node.disabled) {
|
|
@@ -415,7 +888,11 @@ function eventHandler(e) {
|
|
|
415
888
|
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
416
889
|
if (e.cancelBubble) return;
|
|
417
890
|
}
|
|
418
|
-
node.host &&
|
|
891
|
+
node.host &&
|
|
892
|
+
typeof node.host !== "string" &&
|
|
893
|
+
!node.host._$host &&
|
|
894
|
+
node.contains(e.target) &&
|
|
895
|
+
retarget(node.host);
|
|
419
896
|
return true;
|
|
420
897
|
};
|
|
421
898
|
const walkUpTree = () => {
|
|
@@ -443,8 +920,7 @@ function eventHandler(e) {
|
|
|
443
920
|
break;
|
|
444
921
|
}
|
|
445
922
|
}
|
|
446
|
-
}
|
|
447
|
-
else walkUpTree();
|
|
923
|
+
} else walkUpTree();
|
|
448
924
|
retarget(oriTarget);
|
|
449
925
|
}
|
|
450
926
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
@@ -454,7 +930,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
454
930
|
let cleaned = [];
|
|
455
931
|
for (let i = 0; i < current.length; i++) {
|
|
456
932
|
const node = current[i];
|
|
457
|
-
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
933
|
+
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
934
|
+
else cleaned.push(node);
|
|
458
935
|
}
|
|
459
936
|
current = cleaned;
|
|
460
937
|
}
|
|
@@ -462,7 +939,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
462
939
|
if (value === current) return current;
|
|
463
940
|
const t = typeof value,
|
|
464
941
|
multi = marker !== undefined;
|
|
465
|
-
parent = multi && current[0] && current[0].parentNode || parent;
|
|
942
|
+
parent = (multi && current[0] && current[0].parentNode) || parent;
|
|
466
943
|
if (t === "string" || t === "number") {
|
|
467
944
|
if (hydrating) return current;
|
|
468
945
|
if (t === "number") {
|
|
@@ -494,17 +971,17 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
494
971
|
const array = [];
|
|
495
972
|
const currentArray = current && Array.isArray(current);
|
|
496
973
|
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
497
|
-
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
974
|
+
createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
|
|
498
975
|
return () => current;
|
|
499
976
|
}
|
|
500
977
|
if (hydrating) {
|
|
501
978
|
if (!array.length) return current;
|
|
502
|
-
if (marker === undefined) return current = [...parent.childNodes];
|
|
979
|
+
if (marker === undefined) return (current = [...parent.childNodes]);
|
|
503
980
|
let node = array[0];
|
|
504
981
|
if (node.parentNode !== parent) return current;
|
|
505
982
|
const nodes = [node];
|
|
506
983
|
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
507
|
-
return current = nodes;
|
|
984
|
+
return (current = nodes);
|
|
508
985
|
}
|
|
509
986
|
if (array.length === 0) {
|
|
510
987
|
current = cleanChildren(parent, current, marker);
|
|
@@ -519,9 +996,9 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
519
996
|
}
|
|
520
997
|
current = array;
|
|
521
998
|
} else if (value.nodeType) {
|
|
522
|
-
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
999
|
+
if (hydrating && value.parentNode) return (current = multi ? [value] : value);
|
|
523
1000
|
if (Array.isArray(current)) {
|
|
524
|
-
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
1001
|
+
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
|
525
1002
|
cleanChildren(parent, current, null, value);
|
|
526
1003
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
527
1004
|
parent.appendChild(value);
|
|
@@ -536,21 +1013,28 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
536
1013
|
let item = array[i],
|
|
537
1014
|
prev = current && current[normalized.length],
|
|
538
1015
|
t;
|
|
539
|
-
if (item == null || item === true || item === false)
|
|
1016
|
+
if (item == null || item === true || item === false);
|
|
1017
|
+
else if ((t = typeof item) === "object" && item.nodeType) {
|
|
540
1018
|
normalized.push(item);
|
|
541
1019
|
} else if (Array.isArray(item)) {
|
|
542
1020
|
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
543
1021
|
} else if (t === "function") {
|
|
544
1022
|
if (unwrap) {
|
|
545
1023
|
while (typeof item === "function") item = item();
|
|
546
|
-
dynamic =
|
|
1024
|
+
dynamic =
|
|
1025
|
+
normalizeIncomingArray(
|
|
1026
|
+
normalized,
|
|
1027
|
+
Array.isArray(item) ? item : [item],
|
|
1028
|
+
Array.isArray(prev) ? prev : [prev]
|
|
1029
|
+
) || dynamic;
|
|
547
1030
|
} else {
|
|
548
1031
|
normalized.push(item);
|
|
549
1032
|
dynamic = true;
|
|
550
1033
|
}
|
|
551
1034
|
} else {
|
|
552
1035
|
const value = String(item);
|
|
553
|
-
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
1036
|
+
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
1037
|
+
else normalized.push(document.createTextNode(value));
|
|
554
1038
|
}
|
|
555
1039
|
}
|
|
556
1040
|
return dynamic;
|
|
@@ -559,7 +1043,7 @@ function appendNodes(parent, array, marker = null) {
|
|
|
559
1043
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
560
1044
|
}
|
|
561
1045
|
function cleanChildren(parent, current, marker, replacement) {
|
|
562
|
-
if (marker === undefined) return parent.textContent = "";
|
|
1046
|
+
if (marker === undefined) return (parent.textContent = "");
|
|
563
1047
|
const node = replacement || document.createTextNode("");
|
|
564
1048
|
if (current.length) {
|
|
565
1049
|
let inserted = false;
|
|
@@ -567,7 +1051,9 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
567
1051
|
const el = current[i];
|
|
568
1052
|
if (node !== el) {
|
|
569
1053
|
const isParent = el.parentNode === parent;
|
|
570
|
-
if (!inserted && !i)
|
|
1054
|
+
if (!inserted && !i)
|
|
1055
|
+
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
1056
|
+
else isParent && el.remove();
|
|
571
1057
|
} else inserted = true;
|
|
572
1058
|
}
|
|
573
1059
|
} else parent.insertBefore(node, marker);
|
|
@@ -578,7 +1064,8 @@ function gatherHydratable(element, root) {
|
|
|
578
1064
|
for (let i = 0; i < templates.length; i++) {
|
|
579
1065
|
const node = templates[i];
|
|
580
1066
|
const key = node.getAttribute("data-hk");
|
|
581
|
-
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1067
|
+
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1068
|
+
sharedConfig.registry.set(key, node);
|
|
582
1069
|
}
|
|
583
1070
|
}
|
|
584
1071
|
function getHydrationKey() {
|
|
@@ -630,42 +1117,47 @@ const hydrate = (...args) => {
|
|
|
630
1117
|
return hydrate$1(...args);
|
|
631
1118
|
};
|
|
632
1119
|
function Portal(props) {
|
|
633
|
-
const {
|
|
634
|
-
useShadow
|
|
635
|
-
} = props,
|
|
1120
|
+
const { useShadow } = props,
|
|
636
1121
|
marker = document.createTextNode(""),
|
|
637
1122
|
mount = () => props.mount || document.body,
|
|
638
1123
|
owner = getOwner();
|
|
639
1124
|
let content;
|
|
640
1125
|
let hydrating = !!sharedConfig.context;
|
|
641
|
-
createEffect(
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
1126
|
+
createEffect(
|
|
1127
|
+
() => {
|
|
1128
|
+
if (hydrating) getOwner().user = hydrating = false;
|
|
1129
|
+
content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
|
|
1130
|
+
const el = mount();
|
|
1131
|
+
if (el instanceof HTMLHeadElement) {
|
|
1132
|
+
const [clean, setClean] = createSignal(false);
|
|
1133
|
+
const cleanup = () => setClean(true);
|
|
1134
|
+
createRoot(dispose => insert(el, () => (!clean() ? content() : dispose()), null));
|
|
1135
|
+
onCleanup(cleanup);
|
|
1136
|
+
} else {
|
|
1137
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
1138
|
+
renderRoot =
|
|
1139
|
+
useShadow && container.attachShadow
|
|
1140
|
+
? container.attachShadow({
|
|
1141
|
+
mode: "open"
|
|
1142
|
+
})
|
|
1143
|
+
: container;
|
|
1144
|
+
Object.defineProperty(container, "_$host", {
|
|
1145
|
+
get() {
|
|
1146
|
+
return marker.parentNode;
|
|
1147
|
+
},
|
|
1148
|
+
configurable: true
|
|
1149
|
+
});
|
|
1150
|
+
insert(renderRoot, content);
|
|
1151
|
+
el.appendChild(container);
|
|
1152
|
+
props.ref && props.ref(container);
|
|
1153
|
+
onCleanup(() => el.removeChild(container));
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
undefined,
|
|
1157
|
+
{
|
|
1158
|
+
render: !hydrating
|
|
665
1159
|
}
|
|
666
|
-
|
|
667
|
-
render: !hydrating
|
|
668
|
-
});
|
|
1160
|
+
);
|
|
669
1161
|
return marker;
|
|
670
1162
|
}
|
|
671
1163
|
function Dynamic(props) {
|
|
@@ -688,4 +1180,62 @@ function Dynamic(props) {
|
|
|
688
1180
|
});
|
|
689
1181
|
}
|
|
690
1182
|
|
|
691
|
-
export {
|
|
1183
|
+
export {
|
|
1184
|
+
Aliases,
|
|
1185
|
+
voidFn as Assets,
|
|
1186
|
+
ChildProperties,
|
|
1187
|
+
DOMElements,
|
|
1188
|
+
DelegatedEvents,
|
|
1189
|
+
Dynamic,
|
|
1190
|
+
Hydration,
|
|
1191
|
+
voidFn as HydrationScript,
|
|
1192
|
+
NoHydration,
|
|
1193
|
+
Portal,
|
|
1194
|
+
Properties,
|
|
1195
|
+
RequestContext,
|
|
1196
|
+
SVGElements,
|
|
1197
|
+
SVGNamespace,
|
|
1198
|
+
addEventListener,
|
|
1199
|
+
assign,
|
|
1200
|
+
classList,
|
|
1201
|
+
className,
|
|
1202
|
+
clearDelegatedEvents,
|
|
1203
|
+
delegateEvents,
|
|
1204
|
+
dynamicProperty,
|
|
1205
|
+
escape,
|
|
1206
|
+
voidFn as generateHydrationScript,
|
|
1207
|
+
voidFn as getAssets,
|
|
1208
|
+
getHydrationKey,
|
|
1209
|
+
getNextElement,
|
|
1210
|
+
getNextMarker,
|
|
1211
|
+
getNextMatch,
|
|
1212
|
+
getPropAlias,
|
|
1213
|
+
voidFn as getRequestEvent,
|
|
1214
|
+
hydrate,
|
|
1215
|
+
innerHTML,
|
|
1216
|
+
insert,
|
|
1217
|
+
isDev,
|
|
1218
|
+
isServer,
|
|
1219
|
+
render,
|
|
1220
|
+
renderToStream,
|
|
1221
|
+
renderToString,
|
|
1222
|
+
renderToStringAsync,
|
|
1223
|
+
resolveSSRNode,
|
|
1224
|
+
runHydrationEvents,
|
|
1225
|
+
setAttribute,
|
|
1226
|
+
setAttributeNS,
|
|
1227
|
+
setBoolAttribute,
|
|
1228
|
+
setProperty,
|
|
1229
|
+
spread,
|
|
1230
|
+
ssr,
|
|
1231
|
+
ssrAttribute,
|
|
1232
|
+
ssrClassList,
|
|
1233
|
+
ssrElement,
|
|
1234
|
+
ssrHydrationKey,
|
|
1235
|
+
ssrSpread,
|
|
1236
|
+
ssrStyle,
|
|
1237
|
+
style,
|
|
1238
|
+
template,
|
|
1239
|
+
use,
|
|
1240
|
+
voidFn as useAssets
|
|
1241
|
+
};
|