solid-js 1.8.14 → 1.8.16
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 +8 -7
- package/dist/dev.js +561 -319
- package/dist/server.js +170 -75
- package/dist/solid.cjs +8 -7
- package/dist/solid.js +488 -277
- package/h/dist/h.js +34 -8
- 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 +7 -2
- 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 +2 -2
- 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 +219 -62
- package/types/index.d.ts +75 -10
- package/types/jsx.d.ts +7 -2
- package/types/reactive/array.d.ts +14 -6
- package/types/reactive/observable.d.ts +26 -18
- package/types/reactive/scheduler.d.ts +9 -6
- package/types/reactive/signal.d.ts +239 -147
- package/types/render/Suspense.d.ts +7 -7
- package/types/render/component.d.ts +64 -33
- package/types/render/flow.d.ts +47 -35
- package/types/render/hydration.d.ts +13 -13
- package/types/server/index.d.ts +57 -2
- package/types/server/reactive.d.ts +73 -42
- package/types/server/rendering.d.ts +167 -96
- 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 +13 -11
- package/web/dist/dev.js +635 -92
- package/web/dist/server.js +210 -96
- package/web/dist/web.cjs +13 -11
- package/web/dist/web.js +626 -90
- 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 +29 -12
- 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
|
+
sharedConfig,
|
|
4
|
+
createRenderEffect,
|
|
5
|
+
untrack,
|
|
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,395 @@ 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
|
+
"feFlood",
|
|
157
|
+
"feFuncA",
|
|
158
|
+
"feFuncB",
|
|
159
|
+
"feFuncG",
|
|
160
|
+
"feFuncR",
|
|
161
|
+
"feGaussianBlur",
|
|
162
|
+
"feImage",
|
|
163
|
+
"feMerge",
|
|
164
|
+
"feMergeNode",
|
|
165
|
+
"feMorphology",
|
|
166
|
+
"feOffset",
|
|
167
|
+
"fePointLight",
|
|
168
|
+
"feSpecularLighting",
|
|
169
|
+
"feSpotLight",
|
|
170
|
+
"feTile",
|
|
171
|
+
"feTurbulence",
|
|
172
|
+
"filter",
|
|
173
|
+
"font",
|
|
174
|
+
"font-face",
|
|
175
|
+
"font-face-format",
|
|
176
|
+
"font-face-name",
|
|
177
|
+
"font-face-src",
|
|
178
|
+
"font-face-uri",
|
|
179
|
+
"foreignObject",
|
|
180
|
+
"g",
|
|
181
|
+
"glyph",
|
|
182
|
+
"glyphRef",
|
|
183
|
+
"hkern",
|
|
184
|
+
"image",
|
|
185
|
+
"line",
|
|
186
|
+
"linearGradient",
|
|
187
|
+
"marker",
|
|
188
|
+
"mask",
|
|
189
|
+
"metadata",
|
|
190
|
+
"missing-glyph",
|
|
191
|
+
"mpath",
|
|
192
|
+
"path",
|
|
193
|
+
"pattern",
|
|
194
|
+
"polygon",
|
|
195
|
+
"polyline",
|
|
196
|
+
"radialGradient",
|
|
197
|
+
"rect",
|
|
198
|
+
"set",
|
|
199
|
+
"stop",
|
|
200
|
+
"svg",
|
|
201
|
+
"switch",
|
|
202
|
+
"symbol",
|
|
203
|
+
"text",
|
|
204
|
+
"textPath",
|
|
205
|
+
"tref",
|
|
206
|
+
"tspan",
|
|
207
|
+
"use",
|
|
208
|
+
"view",
|
|
209
|
+
"vkern"
|
|
210
|
+
]);
|
|
46
211
|
const SVGNamespace = {
|
|
47
212
|
xlink: "http://www.w3.org/1999/xlink",
|
|
48
213
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
49
214
|
};
|
|
50
|
-
const DOMElements = /*#__PURE__*/new Set([
|
|
215
|
+
const DOMElements = /*#__PURE__*/ new Set([
|
|
216
|
+
"html",
|
|
217
|
+
"base",
|
|
218
|
+
"head",
|
|
219
|
+
"link",
|
|
220
|
+
"meta",
|
|
221
|
+
"style",
|
|
222
|
+
"title",
|
|
223
|
+
"body",
|
|
224
|
+
"address",
|
|
225
|
+
"article",
|
|
226
|
+
"aside",
|
|
227
|
+
"footer",
|
|
228
|
+
"header",
|
|
229
|
+
"main",
|
|
230
|
+
"nav",
|
|
231
|
+
"section",
|
|
232
|
+
"body",
|
|
233
|
+
"blockquote",
|
|
234
|
+
"dd",
|
|
235
|
+
"div",
|
|
236
|
+
"dl",
|
|
237
|
+
"dt",
|
|
238
|
+
"figcaption",
|
|
239
|
+
"figure",
|
|
240
|
+
"hr",
|
|
241
|
+
"li",
|
|
242
|
+
"ol",
|
|
243
|
+
"p",
|
|
244
|
+
"pre",
|
|
245
|
+
"ul",
|
|
246
|
+
"a",
|
|
247
|
+
"abbr",
|
|
248
|
+
"b",
|
|
249
|
+
"bdi",
|
|
250
|
+
"bdo",
|
|
251
|
+
"br",
|
|
252
|
+
"cite",
|
|
253
|
+
"code",
|
|
254
|
+
"data",
|
|
255
|
+
"dfn",
|
|
256
|
+
"em",
|
|
257
|
+
"i",
|
|
258
|
+
"kbd",
|
|
259
|
+
"mark",
|
|
260
|
+
"q",
|
|
261
|
+
"rp",
|
|
262
|
+
"rt",
|
|
263
|
+
"ruby",
|
|
264
|
+
"s",
|
|
265
|
+
"samp",
|
|
266
|
+
"small",
|
|
267
|
+
"span",
|
|
268
|
+
"strong",
|
|
269
|
+
"sub",
|
|
270
|
+
"sup",
|
|
271
|
+
"time",
|
|
272
|
+
"u",
|
|
273
|
+
"var",
|
|
274
|
+
"wbr",
|
|
275
|
+
"area",
|
|
276
|
+
"audio",
|
|
277
|
+
"img",
|
|
278
|
+
"map",
|
|
279
|
+
"track",
|
|
280
|
+
"video",
|
|
281
|
+
"embed",
|
|
282
|
+
"iframe",
|
|
283
|
+
"object",
|
|
284
|
+
"param",
|
|
285
|
+
"picture",
|
|
286
|
+
"portal",
|
|
287
|
+
"source",
|
|
288
|
+
"svg",
|
|
289
|
+
"math",
|
|
290
|
+
"canvas",
|
|
291
|
+
"noscript",
|
|
292
|
+
"script",
|
|
293
|
+
"del",
|
|
294
|
+
"ins",
|
|
295
|
+
"caption",
|
|
296
|
+
"col",
|
|
297
|
+
"colgroup",
|
|
298
|
+
"table",
|
|
299
|
+
"tbody",
|
|
300
|
+
"td",
|
|
301
|
+
"tfoot",
|
|
302
|
+
"th",
|
|
303
|
+
"thead",
|
|
304
|
+
"tr",
|
|
305
|
+
"button",
|
|
306
|
+
"datalist",
|
|
307
|
+
"fieldset",
|
|
308
|
+
"form",
|
|
309
|
+
"input",
|
|
310
|
+
"label",
|
|
311
|
+
"legend",
|
|
312
|
+
"meter",
|
|
313
|
+
"optgroup",
|
|
314
|
+
"option",
|
|
315
|
+
"output",
|
|
316
|
+
"progress",
|
|
317
|
+
"select",
|
|
318
|
+
"textarea",
|
|
319
|
+
"details",
|
|
320
|
+
"dialog",
|
|
321
|
+
"menu",
|
|
322
|
+
"summary",
|
|
323
|
+
"details",
|
|
324
|
+
"slot",
|
|
325
|
+
"template",
|
|
326
|
+
"acronym",
|
|
327
|
+
"applet",
|
|
328
|
+
"basefont",
|
|
329
|
+
"bgsound",
|
|
330
|
+
"big",
|
|
331
|
+
"blink",
|
|
332
|
+
"center",
|
|
333
|
+
"content",
|
|
334
|
+
"dir",
|
|
335
|
+
"font",
|
|
336
|
+
"frame",
|
|
337
|
+
"frameset",
|
|
338
|
+
"hgroup",
|
|
339
|
+
"image",
|
|
340
|
+
"keygen",
|
|
341
|
+
"marquee",
|
|
342
|
+
"menuitem",
|
|
343
|
+
"nobr",
|
|
344
|
+
"noembed",
|
|
345
|
+
"noframes",
|
|
346
|
+
"plaintext",
|
|
347
|
+
"rb",
|
|
348
|
+
"rtc",
|
|
349
|
+
"shadow",
|
|
350
|
+
"spacer",
|
|
351
|
+
"strike",
|
|
352
|
+
"tt",
|
|
353
|
+
"xmp",
|
|
354
|
+
"a",
|
|
355
|
+
"abbr",
|
|
356
|
+
"acronym",
|
|
357
|
+
"address",
|
|
358
|
+
"applet",
|
|
359
|
+
"area",
|
|
360
|
+
"article",
|
|
361
|
+
"aside",
|
|
362
|
+
"audio",
|
|
363
|
+
"b",
|
|
364
|
+
"base",
|
|
365
|
+
"basefont",
|
|
366
|
+
"bdi",
|
|
367
|
+
"bdo",
|
|
368
|
+
"bgsound",
|
|
369
|
+
"big",
|
|
370
|
+
"blink",
|
|
371
|
+
"blockquote",
|
|
372
|
+
"body",
|
|
373
|
+
"br",
|
|
374
|
+
"button",
|
|
375
|
+
"canvas",
|
|
376
|
+
"caption",
|
|
377
|
+
"center",
|
|
378
|
+
"cite",
|
|
379
|
+
"code",
|
|
380
|
+
"col",
|
|
381
|
+
"colgroup",
|
|
382
|
+
"content",
|
|
383
|
+
"data",
|
|
384
|
+
"datalist",
|
|
385
|
+
"dd",
|
|
386
|
+
"del",
|
|
387
|
+
"details",
|
|
388
|
+
"dfn",
|
|
389
|
+
"dialog",
|
|
390
|
+
"dir",
|
|
391
|
+
"div",
|
|
392
|
+
"dl",
|
|
393
|
+
"dt",
|
|
394
|
+
"em",
|
|
395
|
+
"embed",
|
|
396
|
+
"fieldset",
|
|
397
|
+
"figcaption",
|
|
398
|
+
"figure",
|
|
399
|
+
"font",
|
|
400
|
+
"footer",
|
|
401
|
+
"form",
|
|
402
|
+
"frame",
|
|
403
|
+
"frameset",
|
|
404
|
+
"head",
|
|
405
|
+
"header",
|
|
406
|
+
"hgroup",
|
|
407
|
+
"hr",
|
|
408
|
+
"html",
|
|
409
|
+
"i",
|
|
410
|
+
"iframe",
|
|
411
|
+
"image",
|
|
412
|
+
"img",
|
|
413
|
+
"input",
|
|
414
|
+
"ins",
|
|
415
|
+
"kbd",
|
|
416
|
+
"keygen",
|
|
417
|
+
"label",
|
|
418
|
+
"legend",
|
|
419
|
+
"li",
|
|
420
|
+
"link",
|
|
421
|
+
"main",
|
|
422
|
+
"map",
|
|
423
|
+
"mark",
|
|
424
|
+
"marquee",
|
|
425
|
+
"menu",
|
|
426
|
+
"menuitem",
|
|
427
|
+
"meta",
|
|
428
|
+
"meter",
|
|
429
|
+
"nav",
|
|
430
|
+
"nobr",
|
|
431
|
+
"noembed",
|
|
432
|
+
"noframes",
|
|
433
|
+
"noscript",
|
|
434
|
+
"object",
|
|
435
|
+
"ol",
|
|
436
|
+
"optgroup",
|
|
437
|
+
"option",
|
|
438
|
+
"output",
|
|
439
|
+
"p",
|
|
440
|
+
"param",
|
|
441
|
+
"picture",
|
|
442
|
+
"plaintext",
|
|
443
|
+
"portal",
|
|
444
|
+
"pre",
|
|
445
|
+
"progress",
|
|
446
|
+
"q",
|
|
447
|
+
"rb",
|
|
448
|
+
"rp",
|
|
449
|
+
"rt",
|
|
450
|
+
"rtc",
|
|
451
|
+
"ruby",
|
|
452
|
+
"s",
|
|
453
|
+
"samp",
|
|
454
|
+
"script",
|
|
455
|
+
"section",
|
|
456
|
+
"select",
|
|
457
|
+
"shadow",
|
|
458
|
+
"slot",
|
|
459
|
+
"small",
|
|
460
|
+
"source",
|
|
461
|
+
"spacer",
|
|
462
|
+
"span",
|
|
463
|
+
"strike",
|
|
464
|
+
"strong",
|
|
465
|
+
"style",
|
|
466
|
+
"sub",
|
|
467
|
+
"summary",
|
|
468
|
+
"sup",
|
|
469
|
+
"table",
|
|
470
|
+
"tbody",
|
|
471
|
+
"td",
|
|
472
|
+
"template",
|
|
473
|
+
"textarea",
|
|
474
|
+
"tfoot",
|
|
475
|
+
"th",
|
|
476
|
+
"thead",
|
|
477
|
+
"time",
|
|
478
|
+
"title",
|
|
479
|
+
"tr",
|
|
480
|
+
"track",
|
|
481
|
+
"tt",
|
|
482
|
+
"u",
|
|
483
|
+
"ul",
|
|
484
|
+
"var",
|
|
485
|
+
"video",
|
|
486
|
+
"wbr",
|
|
487
|
+
"xmp",
|
|
488
|
+
"input",
|
|
489
|
+
"h1",
|
|
490
|
+
"h2",
|
|
491
|
+
"h3",
|
|
492
|
+
"h4",
|
|
493
|
+
"h5",
|
|
494
|
+
"h6"
|
|
495
|
+
]);
|
|
51
496
|
|
|
52
497
|
function reconcileArrays(parentNode, a, b) {
|
|
53
498
|
let bLength = b.length,
|
|
@@ -68,7 +513,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
68
513
|
bEnd--;
|
|
69
514
|
}
|
|
70
515
|
if (aEnd === aStart) {
|
|
71
|
-
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
516
|
+
const node = bEnd < bLength ? (bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart]) : after;
|
|
72
517
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
73
518
|
} else if (bEnd === bStart) {
|
|
74
519
|
while (aStart < aEnd) {
|
|
@@ -109,12 +554,16 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
109
554
|
const $$EVENTS = "_$DX_DELEGATE";
|
|
110
555
|
function render(code, element, init, options = {}) {
|
|
111
556
|
if (!element) {
|
|
112
|
-
throw new Error(
|
|
557
|
+
throw new Error(
|
|
558
|
+
"The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document."
|
|
559
|
+
);
|
|
113
560
|
}
|
|
114
561
|
let disposer;
|
|
115
562
|
createRoot(dispose => {
|
|
116
563
|
disposer = dispose;
|
|
117
|
-
element === document
|
|
564
|
+
element === document
|
|
565
|
+
? code()
|
|
566
|
+
: insert(element, code(), element.firstChild ? null : undefined, init);
|
|
118
567
|
}, options.owner);
|
|
119
568
|
return () => {
|
|
120
569
|
disposer();
|
|
@@ -124,12 +573,17 @@ function render(code, element, init, options = {}) {
|
|
|
124
573
|
function template(html, isCE, isSVG) {
|
|
125
574
|
let node;
|
|
126
575
|
const create = () => {
|
|
127
|
-
if (sharedConfig.context)
|
|
576
|
+
if (sharedConfig.context)
|
|
577
|
+
throw new Error(
|
|
578
|
+
"Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration."
|
|
579
|
+
);
|
|
128
580
|
const t = document.createElement("template");
|
|
129
581
|
t.innerHTML = html;
|
|
130
582
|
return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
131
583
|
};
|
|
132
|
-
const fn = isCE
|
|
584
|
+
const fn = isCE
|
|
585
|
+
? () => untrack(() => document.importNode(node || (node = create()), true))
|
|
586
|
+
: () => (node || (node = create())).cloneNode(true);
|
|
133
587
|
fn.cloneNode = fn;
|
|
134
588
|
return fn;
|
|
135
589
|
}
|
|
@@ -150,19 +604,23 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
150
604
|
}
|
|
151
605
|
}
|
|
152
606
|
function setProperty(node, name, value) {
|
|
153
|
-
|
|
607
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
608
|
+
node[name] = value;
|
|
154
609
|
}
|
|
155
610
|
function setAttribute(node, name, value) {
|
|
156
|
-
if (sharedConfig.context) return;
|
|
157
|
-
if (value == null) node.removeAttribute(name);
|
|
611
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
612
|
+
if (value == null) node.removeAttribute(name);
|
|
613
|
+
else node.setAttribute(name, value);
|
|
158
614
|
}
|
|
159
615
|
function setAttributeNS(node, namespace, name, value) {
|
|
160
|
-
if (sharedConfig.context) return;
|
|
161
|
-
if (value == null) node.removeAttributeNS(namespace, name);
|
|
616
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
617
|
+
if (value == null) node.removeAttributeNS(namespace, name);
|
|
618
|
+
else node.setAttributeNS(namespace, name, value);
|
|
162
619
|
}
|
|
163
620
|
function className(node, value) {
|
|
164
|
-
if (sharedConfig.context) return;
|
|
165
|
-
if (value == null) node.removeAttribute("class");
|
|
621
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
622
|
+
if (value == null) node.removeAttribute("class");
|
|
623
|
+
else node.className = value;
|
|
166
624
|
}
|
|
167
625
|
function addEventListener(node, name, handler, delegate) {
|
|
168
626
|
if (delegate) {
|
|
@@ -172,7 +630,7 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
172
630
|
} else node[`$$${name}`] = handler;
|
|
173
631
|
} else if (Array.isArray(handler)) {
|
|
174
632
|
const handlerFn = handler[0];
|
|
175
|
-
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
633
|
+
node.addEventListener(name, (handler[0] = e => handlerFn.call(node, handler[1], e)));
|
|
176
634
|
} else node.addEventListener(name, handler);
|
|
177
635
|
}
|
|
178
636
|
function classList(node, value, prev = {}) {
|
|
@@ -197,7 +655,7 @@ function classList(node, value, prev = {}) {
|
|
|
197
655
|
function style(node, value, prev) {
|
|
198
656
|
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
199
657
|
const nodeStyle = node.style;
|
|
200
|
-
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
658
|
+
if (typeof value === "string") return (nodeStyle.cssText = value);
|
|
201
659
|
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
202
660
|
prev || (prev = {});
|
|
203
661
|
value || (value = {});
|
|
@@ -218,7 +676,9 @@ function style(node, value, prev) {
|
|
|
218
676
|
function spread(node, props = {}, isSVG, skipChildren) {
|
|
219
677
|
const prevProps = {};
|
|
220
678
|
if (!skipChildren) {
|
|
221
|
-
createRenderEffect(
|
|
679
|
+
createRenderEffect(
|
|
680
|
+
() => (prevProps.children = insertExpression(node, props.children, prevProps.children))
|
|
681
|
+
);
|
|
222
682
|
}
|
|
223
683
|
createRenderEffect(() => props.ref && props.ref(node));
|
|
224
684
|
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
@@ -277,8 +737,9 @@ function hydrate$1(code, element, options = {}) {
|
|
|
277
737
|
}
|
|
278
738
|
function getNextElement(template) {
|
|
279
739
|
let node, key;
|
|
280
|
-
if (!sharedConfig.context || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
281
|
-
if (sharedConfig.context)
|
|
740
|
+
if (!sharedConfig.context || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
|
|
741
|
+
if (sharedConfig.context)
|
|
742
|
+
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
282
743
|
return template();
|
|
283
744
|
}
|
|
284
745
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
@@ -297,7 +758,8 @@ function getNextMarker(start) {
|
|
|
297
758
|
while (end) {
|
|
298
759
|
if (end.nodeType === 8) {
|
|
299
760
|
const v = end.nodeValue;
|
|
300
|
-
if (v === "$") count++;
|
|
761
|
+
if (v === "$") count++;
|
|
762
|
+
else if (v === "/") {
|
|
301
763
|
if (count === 0) return [end, current];
|
|
302
764
|
count--;
|
|
303
765
|
}
|
|
@@ -311,10 +773,7 @@ function getNextMarker(start) {
|
|
|
311
773
|
function runHydrationEvents() {
|
|
312
774
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
313
775
|
queueMicrotask(() => {
|
|
314
|
-
const {
|
|
315
|
-
completed,
|
|
316
|
-
events
|
|
317
|
-
} = sharedConfig;
|
|
776
|
+
const { completed, events } = sharedConfig;
|
|
318
777
|
events.queued = false;
|
|
319
778
|
while (events.length) {
|
|
320
779
|
const [el, e] = events[0];
|
|
@@ -331,7 +790,8 @@ function toPropertyName(name) {
|
|
|
331
790
|
}
|
|
332
791
|
function toggleClassKey(node, key, value) {
|
|
333
792
|
const classNames = key.trim().split(/\s+/);
|
|
334
|
-
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
793
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
794
|
+
node.classList.toggle(classNames[i], value);
|
|
335
795
|
}
|
|
336
796
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
337
797
|
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
@@ -361,21 +821,30 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
361
821
|
}
|
|
362
822
|
} else if (prop.slice(0, 5) === "attr:") {
|
|
363
823
|
setAttribute(node, prop.slice(5), value);
|
|
364
|
-
} else if (
|
|
824
|
+
} else if (
|
|
825
|
+
(forceProp = prop.slice(0, 5) === "prop:") ||
|
|
826
|
+
(isChildProp = ChildProperties.has(prop)) ||
|
|
827
|
+
(!isSVG &&
|
|
828
|
+
((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop)))) ||
|
|
829
|
+
(isCE = node.nodeName.includes("-"))
|
|
830
|
+
) {
|
|
365
831
|
if (forceProp) {
|
|
366
832
|
prop = prop.slice(5);
|
|
367
833
|
isProp = true;
|
|
368
|
-
} else if (sharedConfig.context) return value;
|
|
369
|
-
if (prop === "class" || prop === "className") className(node, value);
|
|
834
|
+
} else if (!!sharedConfig.context && node.isConnected) return value;
|
|
835
|
+
if (prop === "class" || prop === "className") className(node, value);
|
|
836
|
+
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
837
|
+
else node[propAlias || prop] = value;
|
|
370
838
|
} else {
|
|
371
839
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
372
|
-
if (ns) setAttributeNS(node, ns, prop, value);
|
|
840
|
+
if (ns) setAttributeNS(node, ns, prop, value);
|
|
841
|
+
else setAttribute(node, Aliases[prop] || prop, value);
|
|
373
842
|
}
|
|
374
843
|
return value;
|
|
375
844
|
}
|
|
376
845
|
function eventHandler(e) {
|
|
377
846
|
const key = `$$${e.type}`;
|
|
378
|
-
let node = e.composedPath && e.composedPath()[0] || e.target;
|
|
847
|
+
let node = (e.composedPath && e.composedPath()[0]) || e.target;
|
|
379
848
|
if (e.target !== node) {
|
|
380
849
|
Object.defineProperty(e, "target", {
|
|
381
850
|
configurable: true,
|
|
@@ -400,12 +869,14 @@ function eventHandler(e) {
|
|
|
400
869
|
}
|
|
401
870
|
}
|
|
402
871
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
403
|
-
|
|
872
|
+
const hydrating = !!sharedConfig.context && parent.isConnected;
|
|
873
|
+
if (hydrating) {
|
|
404
874
|
!current && (current = [...parent.childNodes]);
|
|
405
875
|
let cleaned = [];
|
|
406
876
|
for (let i = 0; i < current.length; i++) {
|
|
407
877
|
const node = current[i];
|
|
408
|
-
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
878
|
+
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
879
|
+
else cleaned.push(node);
|
|
409
880
|
}
|
|
410
881
|
current = cleaned;
|
|
411
882
|
}
|
|
@@ -413,9 +884,9 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
413
884
|
if (value === current) return current;
|
|
414
885
|
const t = typeof value,
|
|
415
886
|
multi = marker !== undefined;
|
|
416
|
-
parent = multi && current[0] && current[0].parentNode || parent;
|
|
887
|
+
parent = (multi && current[0] && current[0].parentNode) || parent;
|
|
417
888
|
if (t === "string" || t === "number") {
|
|
418
|
-
if (
|
|
889
|
+
if (hydrating) return current;
|
|
419
890
|
if (t === "number") value = value.toString();
|
|
420
891
|
if (multi) {
|
|
421
892
|
let node = current[0];
|
|
@@ -429,7 +900,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
429
900
|
} else current = parent.textContent = value;
|
|
430
901
|
}
|
|
431
902
|
} else if (value == null || t === "boolean") {
|
|
432
|
-
if (
|
|
903
|
+
if (hydrating) return current;
|
|
433
904
|
current = cleanChildren(parent, current, marker);
|
|
434
905
|
} else if (t === "function") {
|
|
435
906
|
createRenderEffect(() => {
|
|
@@ -442,16 +913,16 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
442
913
|
const array = [];
|
|
443
914
|
const currentArray = current && Array.isArray(current);
|
|
444
915
|
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
445
|
-
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
916
|
+
createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
|
|
446
917
|
return () => current;
|
|
447
918
|
}
|
|
448
|
-
if (
|
|
919
|
+
if (hydrating) {
|
|
449
920
|
if (!array.length) return current;
|
|
450
921
|
if (marker === undefined) return [...parent.childNodes];
|
|
451
922
|
let node = array[0];
|
|
452
923
|
let nodes = [node];
|
|
453
924
|
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
454
|
-
return current = nodes;
|
|
925
|
+
return (current = nodes);
|
|
455
926
|
}
|
|
456
927
|
if (array.length === 0) {
|
|
457
928
|
current = cleanChildren(parent, current, marker);
|
|
@@ -466,9 +937,9 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
466
937
|
}
|
|
467
938
|
current = array;
|
|
468
939
|
} else if (value.nodeType) {
|
|
469
|
-
if (
|
|
940
|
+
if (hydrating && value.parentNode) return (current = multi ? [value] : value);
|
|
470
941
|
if (Array.isArray(current)) {
|
|
471
|
-
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
942
|
+
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
|
472
943
|
cleanChildren(parent, current, null, value);
|
|
473
944
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
474
945
|
parent.appendChild(value);
|
|
@@ -481,23 +952,30 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
481
952
|
let dynamic = false;
|
|
482
953
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
483
954
|
let item = array[i],
|
|
484
|
-
prev = current && current[
|
|
955
|
+
prev = current && current[normalized.length],
|
|
485
956
|
t;
|
|
486
|
-
if (item == null || item === true || item === false)
|
|
957
|
+
if (item == null || item === true || item === false);
|
|
958
|
+
else if ((t = typeof item) === "object" && item.nodeType) {
|
|
487
959
|
normalized.push(item);
|
|
488
960
|
} else if (Array.isArray(item)) {
|
|
489
961
|
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
490
962
|
} else if (t === "function") {
|
|
491
963
|
if (unwrap) {
|
|
492
964
|
while (typeof item === "function") item = item();
|
|
493
|
-
dynamic =
|
|
965
|
+
dynamic =
|
|
966
|
+
normalizeIncomingArray(
|
|
967
|
+
normalized,
|
|
968
|
+
Array.isArray(item) ? item : [item],
|
|
969
|
+
Array.isArray(prev) ? prev : [prev]
|
|
970
|
+
) || dynamic;
|
|
494
971
|
} else {
|
|
495
972
|
normalized.push(item);
|
|
496
973
|
dynamic = true;
|
|
497
974
|
}
|
|
498
975
|
} else {
|
|
499
976
|
const value = String(item);
|
|
500
|
-
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
977
|
+
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
978
|
+
else normalized.push(document.createTextNode(value));
|
|
501
979
|
}
|
|
502
980
|
}
|
|
503
981
|
return dynamic;
|
|
@@ -506,7 +984,7 @@ function appendNodes(parent, array, marker = null) {
|
|
|
506
984
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
507
985
|
}
|
|
508
986
|
function cleanChildren(parent, current, marker, replacement) {
|
|
509
|
-
if (marker === undefined) return parent.textContent = "";
|
|
987
|
+
if (marker === undefined) return (parent.textContent = "");
|
|
510
988
|
const node = replacement || document.createTextNode("");
|
|
511
989
|
if (current.length) {
|
|
512
990
|
let inserted = false;
|
|
@@ -514,7 +992,9 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
514
992
|
const el = current[i];
|
|
515
993
|
if (node !== el) {
|
|
516
994
|
const isParent = el.parentNode === parent;
|
|
517
|
-
if (!inserted && !i)
|
|
995
|
+
if (!inserted && !i)
|
|
996
|
+
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
997
|
+
else isParent && el.remove();
|
|
518
998
|
} else inserted = true;
|
|
519
999
|
}
|
|
520
1000
|
} else parent.insertBefore(node, marker);
|
|
@@ -525,7 +1005,8 @@ function gatherHydratable(element, root) {
|
|
|
525
1005
|
for (let i = 0; i < templates.length; i++) {
|
|
526
1006
|
const node = templates[i];
|
|
527
1007
|
const key = node.getAttribute("data-hk");
|
|
528
|
-
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1008
|
+
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1009
|
+
sharedConfig.registry.set(key, node);
|
|
529
1010
|
}
|
|
530
1011
|
}
|
|
531
1012
|
function getHydrationKey() {
|
|
@@ -578,42 +1059,47 @@ const hydrate = (...args) => {
|
|
|
578
1059
|
return hydrate$1(...args);
|
|
579
1060
|
};
|
|
580
1061
|
function Portal(props) {
|
|
581
|
-
const {
|
|
582
|
-
useShadow
|
|
583
|
-
} = props,
|
|
1062
|
+
const { useShadow } = props,
|
|
584
1063
|
marker = document.createTextNode(""),
|
|
585
1064
|
mount = () => props.mount || document.body,
|
|
586
1065
|
owner = getOwner();
|
|
587
1066
|
let content;
|
|
588
1067
|
let hydrating = !!sharedConfig.context;
|
|
589
|
-
createEffect(
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
1068
|
+
createEffect(
|
|
1069
|
+
() => {
|
|
1070
|
+
if (hydrating) getOwner().user = hydrating = false;
|
|
1071
|
+
content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
|
|
1072
|
+
const el = mount();
|
|
1073
|
+
if (el instanceof HTMLHeadElement) {
|
|
1074
|
+
const [clean, setClean] = createSignal(false);
|
|
1075
|
+
const cleanup = () => setClean(true);
|
|
1076
|
+
createRoot(dispose => insert(el, () => (!clean() ? content() : dispose()), null));
|
|
1077
|
+
onCleanup(cleanup);
|
|
1078
|
+
} else {
|
|
1079
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
1080
|
+
renderRoot =
|
|
1081
|
+
useShadow && container.attachShadow
|
|
1082
|
+
? container.attachShadow({
|
|
1083
|
+
mode: "open"
|
|
1084
|
+
})
|
|
1085
|
+
: container;
|
|
1086
|
+
Object.defineProperty(container, "_$host", {
|
|
1087
|
+
get() {
|
|
1088
|
+
return marker.parentNode;
|
|
1089
|
+
},
|
|
1090
|
+
configurable: true
|
|
1091
|
+
});
|
|
1092
|
+
insert(renderRoot, content);
|
|
1093
|
+
el.appendChild(container);
|
|
1094
|
+
props.ref && props.ref(container);
|
|
1095
|
+
onCleanup(() => el.removeChild(container));
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
undefined,
|
|
1099
|
+
{
|
|
1100
|
+
render: !hydrating
|
|
613
1101
|
}
|
|
614
|
-
|
|
615
|
-
render: !hydrating
|
|
616
|
-
});
|
|
1102
|
+
);
|
|
617
1103
|
return marker;
|
|
618
1104
|
}
|
|
619
1105
|
function Dynamic(props) {
|
|
@@ -636,4 +1122,61 @@ function Dynamic(props) {
|
|
|
636
1122
|
});
|
|
637
1123
|
}
|
|
638
1124
|
|
|
639
|
-
export {
|
|
1125
|
+
export {
|
|
1126
|
+
Aliases,
|
|
1127
|
+
voidFn as Assets,
|
|
1128
|
+
ChildProperties,
|
|
1129
|
+
DOMElements,
|
|
1130
|
+
DelegatedEvents,
|
|
1131
|
+
Dynamic,
|
|
1132
|
+
Hydration,
|
|
1133
|
+
voidFn as HydrationScript,
|
|
1134
|
+
NoHydration,
|
|
1135
|
+
Portal,
|
|
1136
|
+
Properties,
|
|
1137
|
+
RequestContext,
|
|
1138
|
+
SVGElements,
|
|
1139
|
+
SVGNamespace,
|
|
1140
|
+
addEventListener,
|
|
1141
|
+
assign,
|
|
1142
|
+
classList,
|
|
1143
|
+
className,
|
|
1144
|
+
clearDelegatedEvents,
|
|
1145
|
+
delegateEvents,
|
|
1146
|
+
dynamicProperty,
|
|
1147
|
+
escape,
|
|
1148
|
+
voidFn as generateHydrationScript,
|
|
1149
|
+
voidFn as getAssets,
|
|
1150
|
+
getHydrationKey,
|
|
1151
|
+
getNextElement,
|
|
1152
|
+
getNextMarker,
|
|
1153
|
+
getNextMatch,
|
|
1154
|
+
getPropAlias,
|
|
1155
|
+
voidFn as getRequestEvent,
|
|
1156
|
+
hydrate,
|
|
1157
|
+
innerHTML,
|
|
1158
|
+
insert,
|
|
1159
|
+
isDev,
|
|
1160
|
+
isServer,
|
|
1161
|
+
render,
|
|
1162
|
+
renderToStream,
|
|
1163
|
+
renderToString,
|
|
1164
|
+
renderToStringAsync,
|
|
1165
|
+
resolveSSRNode,
|
|
1166
|
+
runHydrationEvents,
|
|
1167
|
+
setAttribute,
|
|
1168
|
+
setAttributeNS,
|
|
1169
|
+
setProperty,
|
|
1170
|
+
spread,
|
|
1171
|
+
ssr,
|
|
1172
|
+
ssrAttribute,
|
|
1173
|
+
ssrClassList,
|
|
1174
|
+
ssrElement,
|
|
1175
|
+
ssrHydrationKey,
|
|
1176
|
+
ssrSpread,
|
|
1177
|
+
ssrStyle,
|
|
1178
|
+
style,
|
|
1179
|
+
template,
|
|
1180
|
+
use,
|
|
1181
|
+
voidFn as useAssets
|
|
1182
|
+
};
|