solid-js 1.8.22 → 1.8.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.cjs +7 -6
- package/dist/dev.js +567 -325
- package/dist/server.cjs +1 -1
- package/dist/server.js +169 -75
- package/dist/solid.cjs +7 -6
- package/dist/solid.js +494 -283
- package/h/dist/h.js +40 -9
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +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.cjs +1 -1
- package/store/dist/dev.js +123 -43
- package/store/dist/server.js +19 -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 +12 -4
- package/store/types/store.d.ts +218 -61
- package/types/index.d.ts +75 -10
- package/types/jsx.d.ts +13 -7
- package/types/reactive/array.d.ts +12 -4
- package/types/reactive/observable.d.ts +25 -17
- package/types/reactive/scheduler.d.ts +9 -6
- package/types/reactive/signal.d.ts +236 -143
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +64 -33
- package/types/render/flow.d.ts +43 -31
- package/types/render/hydration.d.ts +15 -15
- package/types/server/index.d.ts +57 -2
- package/types/server/reactive.d.ts +73 -42
- package/types/server/rendering.d.ts +169 -98
- package/universal/dist/dev.js +28 -12
- package/universal/dist/universal.js +28 -12
- package/universal/types/index.d.ts +3 -1
- package/universal/types/universal.d.ts +0 -1
- package/web/dist/dev.cjs +1 -0
- package/web/dist/dev.js +626 -83
- package/web/dist/server.cjs +1 -1
- package/web/dist/server.js +211 -97
- package/web/dist/web.cjs +1 -0
- package/web/dist/web.js +617 -81
- 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 (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 = 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
|
}
|
|
@@ -155,15 +610,18 @@ 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 className(node, value) {
|
|
165
622
|
if (isHydrating(node)) return;
|
|
166
|
-
if (value == null) node.removeAttribute("class");
|
|
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));
|
|
@@ -283,8 +743,9 @@ function getNextElement(template) {
|
|
|
283
743
|
let node,
|
|
284
744
|
key,
|
|
285
745
|
hydrating = isHydrating();
|
|
286
|
-
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
287
|
-
if (hydrating)
|
|
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}`);
|
|
288
749
|
return template();
|
|
289
750
|
}
|
|
290
751
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
@@ -303,7 +764,8 @@ function getNextMarker(start) {
|
|
|
303
764
|
while (end) {
|
|
304
765
|
if (end.nodeType === 8) {
|
|
305
766
|
const v = end.nodeValue;
|
|
306
|
-
if (v === "$") count++;
|
|
767
|
+
if (v === "$") count++;
|
|
768
|
+
else if (v === "/") {
|
|
307
769
|
if (count === 0) return [end, current];
|
|
308
770
|
count--;
|
|
309
771
|
}
|
|
@@ -317,10 +779,8 @@ function getNextMarker(start) {
|
|
|
317
779
|
function runHydrationEvents() {
|
|
318
780
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
319
781
|
queueMicrotask(() => {
|
|
320
|
-
const {
|
|
321
|
-
|
|
322
|
-
events
|
|
323
|
-
} = sharedConfig;
|
|
782
|
+
const { completed, events } = sharedConfig;
|
|
783
|
+
if (!events) return;
|
|
324
784
|
events.queued = false;
|
|
325
785
|
while (events.length) {
|
|
326
786
|
const [el, e] = events[0];
|
|
@@ -344,7 +804,8 @@ function toPropertyName(name) {
|
|
|
344
804
|
}
|
|
345
805
|
function toggleClassKey(node, key, value) {
|
|
346
806
|
const classNames = key.trim().split(/\s+/);
|
|
347
|
-
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
807
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
808
|
+
node.classList.toggle(classNames[i], value);
|
|
348
809
|
}
|
|
349
810
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
350
811
|
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
@@ -374,15 +835,24 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
374
835
|
}
|
|
375
836
|
} else if (prop.slice(0, 5) === "attr:") {
|
|
376
837
|
setAttribute(node, prop.slice(5), value);
|
|
377
|
-
} else if (
|
|
838
|
+
} else if (
|
|
839
|
+
(forceProp = prop.slice(0, 5) === "prop:") ||
|
|
840
|
+
(isChildProp = ChildProperties.has(prop)) ||
|
|
841
|
+
(!isSVG &&
|
|
842
|
+
((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop)))) ||
|
|
843
|
+
(isCE = node.nodeName.includes("-"))
|
|
844
|
+
) {
|
|
378
845
|
if (forceProp) {
|
|
379
846
|
prop = prop.slice(5);
|
|
380
847
|
isProp = true;
|
|
381
848
|
} else if (isHydrating(node)) return value;
|
|
382
|
-
if (prop === "class" || prop === "className") className(node, value);
|
|
849
|
+
if (prop === "class" || prop === "className") className(node, value);
|
|
850
|
+
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
851
|
+
else node[propAlias || prop] = value;
|
|
383
852
|
} else {
|
|
384
853
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
385
|
-
if (ns) setAttributeNS(node, ns, prop, value);
|
|
854
|
+
if (ns) setAttributeNS(node, ns, prop, value);
|
|
855
|
+
else setAttribute(node, Aliases[prop] || prop, value);
|
|
386
856
|
}
|
|
387
857
|
return value;
|
|
388
858
|
}
|
|
@@ -391,7 +861,7 @@ function eventHandler(e) {
|
|
|
391
861
|
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
392
862
|
}
|
|
393
863
|
const key = `$$${e.type}`;
|
|
394
|
-
let node = e.composedPath && e.composedPath()[0] || e.target;
|
|
864
|
+
let node = (e.composedPath && e.composedPath()[0]) || e.target;
|
|
395
865
|
if (e.target !== node) {
|
|
396
866
|
Object.defineProperty(e, "target", {
|
|
397
867
|
configurable: true,
|
|
@@ -422,7 +892,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
422
892
|
let cleaned = [];
|
|
423
893
|
for (let i = 0; i < current.length; i++) {
|
|
424
894
|
const node = current[i];
|
|
425
|
-
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
895
|
+
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
896
|
+
else cleaned.push(node);
|
|
426
897
|
}
|
|
427
898
|
current = cleaned;
|
|
428
899
|
}
|
|
@@ -430,7 +901,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
430
901
|
if (value === current) return current;
|
|
431
902
|
const t = typeof value,
|
|
432
903
|
multi = marker !== undefined;
|
|
433
|
-
parent = multi && current[0] && current[0].parentNode || parent;
|
|
904
|
+
parent = (multi && current[0] && current[0].parentNode) || parent;
|
|
434
905
|
if (t === "string" || t === "number") {
|
|
435
906
|
if (hydrating) return current;
|
|
436
907
|
if (t === "number") {
|
|
@@ -462,17 +933,17 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
462
933
|
const array = [];
|
|
463
934
|
const currentArray = current && Array.isArray(current);
|
|
464
935
|
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
465
|
-
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
936
|
+
createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
|
|
466
937
|
return () => current;
|
|
467
938
|
}
|
|
468
939
|
if (hydrating) {
|
|
469
940
|
if (!array.length) return current;
|
|
470
|
-
if (marker === undefined) return current = [...parent.childNodes];
|
|
941
|
+
if (marker === undefined) return (current = [...parent.childNodes]);
|
|
471
942
|
let node = array[0];
|
|
472
943
|
if (node.parentNode !== parent) return current;
|
|
473
944
|
const nodes = [node];
|
|
474
945
|
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
475
|
-
return current = nodes;
|
|
946
|
+
return (current = nodes);
|
|
476
947
|
}
|
|
477
948
|
if (array.length === 0) {
|
|
478
949
|
current = cleanChildren(parent, current, marker);
|
|
@@ -487,9 +958,9 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
487
958
|
}
|
|
488
959
|
current = array;
|
|
489
960
|
} else if (value.nodeType) {
|
|
490
|
-
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
961
|
+
if (hydrating && value.parentNode) return (current = multi ? [value] : value);
|
|
491
962
|
if (Array.isArray(current)) {
|
|
492
|
-
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
963
|
+
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
|
493
964
|
cleanChildren(parent, current, null, value);
|
|
494
965
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
495
966
|
parent.appendChild(value);
|
|
@@ -504,21 +975,28 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
504
975
|
let item = array[i],
|
|
505
976
|
prev = current && current[normalized.length],
|
|
506
977
|
t;
|
|
507
|
-
if (item == null || item === true || item === false)
|
|
978
|
+
if (item == null || item === true || item === false);
|
|
979
|
+
else if ((t = typeof item) === "object" && item.nodeType) {
|
|
508
980
|
normalized.push(item);
|
|
509
981
|
} else if (Array.isArray(item)) {
|
|
510
982
|
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
511
983
|
} else if (t === "function") {
|
|
512
984
|
if (unwrap) {
|
|
513
985
|
while (typeof item === "function") item = item();
|
|
514
|
-
dynamic =
|
|
986
|
+
dynamic =
|
|
987
|
+
normalizeIncomingArray(
|
|
988
|
+
normalized,
|
|
989
|
+
Array.isArray(item) ? item : [item],
|
|
990
|
+
Array.isArray(prev) ? prev : [prev]
|
|
991
|
+
) || dynamic;
|
|
515
992
|
} else {
|
|
516
993
|
normalized.push(item);
|
|
517
994
|
dynamic = true;
|
|
518
995
|
}
|
|
519
996
|
} else {
|
|
520
997
|
const value = String(item);
|
|
521
|
-
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
998
|
+
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
999
|
+
else normalized.push(document.createTextNode(value));
|
|
522
1000
|
}
|
|
523
1001
|
}
|
|
524
1002
|
return dynamic;
|
|
@@ -527,7 +1005,7 @@ function appendNodes(parent, array, marker = null) {
|
|
|
527
1005
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
528
1006
|
}
|
|
529
1007
|
function cleanChildren(parent, current, marker, replacement) {
|
|
530
|
-
if (marker === undefined) return parent.textContent = "";
|
|
1008
|
+
if (marker === undefined) return (parent.textContent = "");
|
|
531
1009
|
const node = replacement || document.createTextNode("");
|
|
532
1010
|
if (current.length) {
|
|
533
1011
|
let inserted = false;
|
|
@@ -535,7 +1013,9 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
535
1013
|
const el = current[i];
|
|
536
1014
|
if (node !== el) {
|
|
537
1015
|
const isParent = el.parentNode === parent;
|
|
538
|
-
if (!inserted && !i)
|
|
1016
|
+
if (!inserted && !i)
|
|
1017
|
+
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
1018
|
+
else isParent && el.remove();
|
|
539
1019
|
} else inserted = true;
|
|
540
1020
|
}
|
|
541
1021
|
} else parent.insertBefore(node, marker);
|
|
@@ -546,7 +1026,8 @@ function gatherHydratable(element, root) {
|
|
|
546
1026
|
for (let i = 0; i < templates.length; i++) {
|
|
547
1027
|
const node = templates[i];
|
|
548
1028
|
const key = node.getAttribute("data-hk");
|
|
549
|
-
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1029
|
+
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1030
|
+
sharedConfig.registry.set(key, node);
|
|
550
1031
|
}
|
|
551
1032
|
}
|
|
552
1033
|
function getHydrationKey() {
|
|
@@ -598,42 +1079,47 @@ const hydrate = (...args) => {
|
|
|
598
1079
|
return hydrate$1(...args);
|
|
599
1080
|
};
|
|
600
1081
|
function Portal(props) {
|
|
601
|
-
const {
|
|
602
|
-
useShadow
|
|
603
|
-
} = props,
|
|
1082
|
+
const { useShadow } = props,
|
|
604
1083
|
marker = document.createTextNode(""),
|
|
605
1084
|
mount = () => props.mount || document.body,
|
|
606
1085
|
owner = getOwner();
|
|
607
1086
|
let content;
|
|
608
1087
|
let hydrating = !!sharedConfig.context;
|
|
609
|
-
createEffect(
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
1088
|
+
createEffect(
|
|
1089
|
+
() => {
|
|
1090
|
+
if (hydrating) getOwner().user = hydrating = false;
|
|
1091
|
+
content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
|
|
1092
|
+
const el = mount();
|
|
1093
|
+
if (el instanceof HTMLHeadElement) {
|
|
1094
|
+
const [clean, setClean] = createSignal(false);
|
|
1095
|
+
const cleanup = () => setClean(true);
|
|
1096
|
+
createRoot(dispose => insert(el, () => (!clean() ? content() : dispose()), null));
|
|
1097
|
+
onCleanup(cleanup);
|
|
1098
|
+
} else {
|
|
1099
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
1100
|
+
renderRoot =
|
|
1101
|
+
useShadow && container.attachShadow
|
|
1102
|
+
? container.attachShadow({
|
|
1103
|
+
mode: "open"
|
|
1104
|
+
})
|
|
1105
|
+
: container;
|
|
1106
|
+
Object.defineProperty(container, "_$host", {
|
|
1107
|
+
get() {
|
|
1108
|
+
return marker.parentNode;
|
|
1109
|
+
},
|
|
1110
|
+
configurable: true
|
|
1111
|
+
});
|
|
1112
|
+
insert(renderRoot, content);
|
|
1113
|
+
el.appendChild(container);
|
|
1114
|
+
props.ref && props.ref(container);
|
|
1115
|
+
onCleanup(() => el.removeChild(container));
|
|
1116
|
+
}
|
|
1117
|
+
},
|
|
1118
|
+
undefined,
|
|
1119
|
+
{
|
|
1120
|
+
render: !hydrating
|
|
633
1121
|
}
|
|
634
|
-
|
|
635
|
-
render: !hydrating
|
|
636
|
-
});
|
|
1122
|
+
);
|
|
637
1123
|
return marker;
|
|
638
1124
|
}
|
|
639
1125
|
function Dynamic(props) {
|
|
@@ -656,4 +1142,61 @@ function Dynamic(props) {
|
|
|
656
1142
|
});
|
|
657
1143
|
}
|
|
658
1144
|
|
|
659
|
-
export {
|
|
1145
|
+
export {
|
|
1146
|
+
Aliases,
|
|
1147
|
+
voidFn as Assets,
|
|
1148
|
+
ChildProperties,
|
|
1149
|
+
DOMElements,
|
|
1150
|
+
DelegatedEvents,
|
|
1151
|
+
Dynamic,
|
|
1152
|
+
Hydration,
|
|
1153
|
+
voidFn as HydrationScript,
|
|
1154
|
+
NoHydration,
|
|
1155
|
+
Portal,
|
|
1156
|
+
Properties,
|
|
1157
|
+
RequestContext,
|
|
1158
|
+
SVGElements,
|
|
1159
|
+
SVGNamespace,
|
|
1160
|
+
addEventListener,
|
|
1161
|
+
assign,
|
|
1162
|
+
classList,
|
|
1163
|
+
className,
|
|
1164
|
+
clearDelegatedEvents,
|
|
1165
|
+
delegateEvents,
|
|
1166
|
+
dynamicProperty,
|
|
1167
|
+
escape,
|
|
1168
|
+
voidFn as generateHydrationScript,
|
|
1169
|
+
voidFn as getAssets,
|
|
1170
|
+
getHydrationKey,
|
|
1171
|
+
getNextElement,
|
|
1172
|
+
getNextMarker,
|
|
1173
|
+
getNextMatch,
|
|
1174
|
+
getPropAlias,
|
|
1175
|
+
voidFn as getRequestEvent,
|
|
1176
|
+
hydrate,
|
|
1177
|
+
innerHTML,
|
|
1178
|
+
insert,
|
|
1179
|
+
isDev,
|
|
1180
|
+
isServer,
|
|
1181
|
+
render,
|
|
1182
|
+
renderToStream,
|
|
1183
|
+
renderToString,
|
|
1184
|
+
renderToStringAsync,
|
|
1185
|
+
resolveSSRNode,
|
|
1186
|
+
runHydrationEvents,
|
|
1187
|
+
setAttribute,
|
|
1188
|
+
setAttributeNS,
|
|
1189
|
+
setProperty,
|
|
1190
|
+
spread,
|
|
1191
|
+
ssr,
|
|
1192
|
+
ssrAttribute,
|
|
1193
|
+
ssrClassList,
|
|
1194
|
+
ssrElement,
|
|
1195
|
+
ssrHydrationKey,
|
|
1196
|
+
ssrSpread,
|
|
1197
|
+
ssrStyle,
|
|
1198
|
+
style,
|
|
1199
|
+
template,
|
|
1200
|
+
use,
|
|
1201
|
+
voidFn as useAssets
|
|
1202
|
+
};
|