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/web.js
CHANGED
|
@@ -1,14 +1,82 @@
|
|
|
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
|
+
} from "solid-js";
|
|
15
|
+
export {
|
|
16
|
+
ErrorBoundary,
|
|
17
|
+
For,
|
|
18
|
+
Index,
|
|
19
|
+
Match,
|
|
20
|
+
Show,
|
|
21
|
+
Suspense,
|
|
22
|
+
SuspenseList,
|
|
23
|
+
Switch,
|
|
24
|
+
createComponent,
|
|
25
|
+
createRenderEffect as effect,
|
|
26
|
+
getOwner,
|
|
27
|
+
createMemo as memo,
|
|
28
|
+
mergeProps,
|
|
29
|
+
untrack
|
|
30
|
+
} from "solid-js";
|
|
3
31
|
|
|
4
|
-
const booleans = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
32
|
+
const booleans = [
|
|
33
|
+
"allowfullscreen",
|
|
34
|
+
"async",
|
|
35
|
+
"autofocus",
|
|
36
|
+
"autoplay",
|
|
37
|
+
"checked",
|
|
38
|
+
"controls",
|
|
39
|
+
"default",
|
|
40
|
+
"disabled",
|
|
41
|
+
"formnovalidate",
|
|
42
|
+
"hidden",
|
|
43
|
+
"indeterminate",
|
|
44
|
+
"inert",
|
|
45
|
+
"ismap",
|
|
46
|
+
"loop",
|
|
47
|
+
"multiple",
|
|
48
|
+
"muted",
|
|
49
|
+
"nomodule",
|
|
50
|
+
"novalidate",
|
|
51
|
+
"open",
|
|
52
|
+
"playsinline",
|
|
53
|
+
"readonly",
|
|
54
|
+
"required",
|
|
55
|
+
"reversed",
|
|
56
|
+
"seamless",
|
|
57
|
+
"selected"
|
|
58
|
+
];
|
|
59
|
+
const Properties = /*#__PURE__*/ new Set([
|
|
60
|
+
"className",
|
|
61
|
+
"value",
|
|
62
|
+
"readOnly",
|
|
63
|
+
"formNoValidate",
|
|
64
|
+
"isMap",
|
|
65
|
+
"noModule",
|
|
66
|
+
"playsInline",
|
|
67
|
+
...booleans
|
|
68
|
+
]);
|
|
69
|
+
const ChildProperties = /*#__PURE__*/ new Set([
|
|
70
|
+
"innerHTML",
|
|
71
|
+
"textContent",
|
|
72
|
+
"innerText",
|
|
73
|
+
"children"
|
|
74
|
+
]);
|
|
75
|
+
const Aliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
8
76
|
className: "class",
|
|
9
77
|
htmlFor: "for"
|
|
10
78
|
});
|
|
11
|
-
const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
79
|
+
const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
12
80
|
class: "className",
|
|
13
81
|
formnovalidate: {
|
|
14
82
|
$: "formNoValidate",
|
|
@@ -35,19 +103,395 @@ const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
|
35
103
|
});
|
|
36
104
|
function getPropAlias(prop, tagName) {
|
|
37
105
|
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
|
-
"
|
|
106
|
+
return typeof a === "object" ? (a[tagName] ? a["$"] : undefined) : a;
|
|
107
|
+
}
|
|
108
|
+
const DelegatedEvents = /*#__PURE__*/ new Set([
|
|
109
|
+
"beforeinput",
|
|
110
|
+
"click",
|
|
111
|
+
"dblclick",
|
|
112
|
+
"contextmenu",
|
|
113
|
+
"focusin",
|
|
114
|
+
"focusout",
|
|
115
|
+
"input",
|
|
116
|
+
"keydown",
|
|
117
|
+
"keyup",
|
|
118
|
+
"mousedown",
|
|
119
|
+
"mousemove",
|
|
120
|
+
"mouseout",
|
|
121
|
+
"mouseover",
|
|
122
|
+
"mouseup",
|
|
123
|
+
"pointerdown",
|
|
124
|
+
"pointermove",
|
|
125
|
+
"pointerout",
|
|
126
|
+
"pointerover",
|
|
127
|
+
"pointerup",
|
|
128
|
+
"touchend",
|
|
129
|
+
"touchmove",
|
|
130
|
+
"touchstart"
|
|
131
|
+
]);
|
|
132
|
+
const SVGElements = /*#__PURE__*/ new Set([
|
|
133
|
+
"altGlyph",
|
|
134
|
+
"altGlyphDef",
|
|
135
|
+
"altGlyphItem",
|
|
136
|
+
"animate",
|
|
137
|
+
"animateColor",
|
|
138
|
+
"animateMotion",
|
|
139
|
+
"animateTransform",
|
|
140
|
+
"circle",
|
|
141
|
+
"clipPath",
|
|
142
|
+
"color-profile",
|
|
143
|
+
"cursor",
|
|
144
|
+
"defs",
|
|
145
|
+
"desc",
|
|
146
|
+
"ellipse",
|
|
147
|
+
"feBlend",
|
|
148
|
+
"feColorMatrix",
|
|
149
|
+
"feComponentTransfer",
|
|
150
|
+
"feComposite",
|
|
151
|
+
"feConvolveMatrix",
|
|
152
|
+
"feDiffuseLighting",
|
|
153
|
+
"feDisplacementMap",
|
|
154
|
+
"feDistantLight",
|
|
155
|
+
"feFlood",
|
|
156
|
+
"feFuncA",
|
|
157
|
+
"feFuncB",
|
|
158
|
+
"feFuncG",
|
|
159
|
+
"feFuncR",
|
|
160
|
+
"feGaussianBlur",
|
|
161
|
+
"feImage",
|
|
162
|
+
"feMerge",
|
|
163
|
+
"feMergeNode",
|
|
164
|
+
"feMorphology",
|
|
165
|
+
"feOffset",
|
|
166
|
+
"fePointLight",
|
|
167
|
+
"feSpecularLighting",
|
|
168
|
+
"feSpotLight",
|
|
169
|
+
"feTile",
|
|
170
|
+
"feTurbulence",
|
|
171
|
+
"filter",
|
|
172
|
+
"font",
|
|
173
|
+
"font-face",
|
|
174
|
+
"font-face-format",
|
|
175
|
+
"font-face-name",
|
|
176
|
+
"font-face-src",
|
|
177
|
+
"font-face-uri",
|
|
178
|
+
"foreignObject",
|
|
179
|
+
"g",
|
|
180
|
+
"glyph",
|
|
181
|
+
"glyphRef",
|
|
182
|
+
"hkern",
|
|
183
|
+
"image",
|
|
184
|
+
"line",
|
|
185
|
+
"linearGradient",
|
|
186
|
+
"marker",
|
|
187
|
+
"mask",
|
|
188
|
+
"metadata",
|
|
189
|
+
"missing-glyph",
|
|
190
|
+
"mpath",
|
|
191
|
+
"path",
|
|
192
|
+
"pattern",
|
|
193
|
+
"polygon",
|
|
194
|
+
"polyline",
|
|
195
|
+
"radialGradient",
|
|
196
|
+
"rect",
|
|
197
|
+
"set",
|
|
198
|
+
"stop",
|
|
199
|
+
"svg",
|
|
200
|
+
"switch",
|
|
201
|
+
"symbol",
|
|
202
|
+
"text",
|
|
203
|
+
"textPath",
|
|
204
|
+
"tref",
|
|
205
|
+
"tspan",
|
|
206
|
+
"use",
|
|
207
|
+
"view",
|
|
208
|
+
"vkern"
|
|
209
|
+
]);
|
|
46
210
|
const SVGNamespace = {
|
|
47
211
|
xlink: "http://www.w3.org/1999/xlink",
|
|
48
212
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
49
213
|
};
|
|
50
|
-
const DOMElements = /*#__PURE__*/new Set([
|
|
214
|
+
const DOMElements = /*#__PURE__*/ new Set([
|
|
215
|
+
"html",
|
|
216
|
+
"base",
|
|
217
|
+
"head",
|
|
218
|
+
"link",
|
|
219
|
+
"meta",
|
|
220
|
+
"style",
|
|
221
|
+
"title",
|
|
222
|
+
"body",
|
|
223
|
+
"address",
|
|
224
|
+
"article",
|
|
225
|
+
"aside",
|
|
226
|
+
"footer",
|
|
227
|
+
"header",
|
|
228
|
+
"main",
|
|
229
|
+
"nav",
|
|
230
|
+
"section",
|
|
231
|
+
"body",
|
|
232
|
+
"blockquote",
|
|
233
|
+
"dd",
|
|
234
|
+
"div",
|
|
235
|
+
"dl",
|
|
236
|
+
"dt",
|
|
237
|
+
"figcaption",
|
|
238
|
+
"figure",
|
|
239
|
+
"hr",
|
|
240
|
+
"li",
|
|
241
|
+
"ol",
|
|
242
|
+
"p",
|
|
243
|
+
"pre",
|
|
244
|
+
"ul",
|
|
245
|
+
"a",
|
|
246
|
+
"abbr",
|
|
247
|
+
"b",
|
|
248
|
+
"bdi",
|
|
249
|
+
"bdo",
|
|
250
|
+
"br",
|
|
251
|
+
"cite",
|
|
252
|
+
"code",
|
|
253
|
+
"data",
|
|
254
|
+
"dfn",
|
|
255
|
+
"em",
|
|
256
|
+
"i",
|
|
257
|
+
"kbd",
|
|
258
|
+
"mark",
|
|
259
|
+
"q",
|
|
260
|
+
"rp",
|
|
261
|
+
"rt",
|
|
262
|
+
"ruby",
|
|
263
|
+
"s",
|
|
264
|
+
"samp",
|
|
265
|
+
"small",
|
|
266
|
+
"span",
|
|
267
|
+
"strong",
|
|
268
|
+
"sub",
|
|
269
|
+
"sup",
|
|
270
|
+
"time",
|
|
271
|
+
"u",
|
|
272
|
+
"var",
|
|
273
|
+
"wbr",
|
|
274
|
+
"area",
|
|
275
|
+
"audio",
|
|
276
|
+
"img",
|
|
277
|
+
"map",
|
|
278
|
+
"track",
|
|
279
|
+
"video",
|
|
280
|
+
"embed",
|
|
281
|
+
"iframe",
|
|
282
|
+
"object",
|
|
283
|
+
"param",
|
|
284
|
+
"picture",
|
|
285
|
+
"portal",
|
|
286
|
+
"source",
|
|
287
|
+
"svg",
|
|
288
|
+
"math",
|
|
289
|
+
"canvas",
|
|
290
|
+
"noscript",
|
|
291
|
+
"script",
|
|
292
|
+
"del",
|
|
293
|
+
"ins",
|
|
294
|
+
"caption",
|
|
295
|
+
"col",
|
|
296
|
+
"colgroup",
|
|
297
|
+
"table",
|
|
298
|
+
"tbody",
|
|
299
|
+
"td",
|
|
300
|
+
"tfoot",
|
|
301
|
+
"th",
|
|
302
|
+
"thead",
|
|
303
|
+
"tr",
|
|
304
|
+
"button",
|
|
305
|
+
"datalist",
|
|
306
|
+
"fieldset",
|
|
307
|
+
"form",
|
|
308
|
+
"input",
|
|
309
|
+
"label",
|
|
310
|
+
"legend",
|
|
311
|
+
"meter",
|
|
312
|
+
"optgroup",
|
|
313
|
+
"option",
|
|
314
|
+
"output",
|
|
315
|
+
"progress",
|
|
316
|
+
"select",
|
|
317
|
+
"textarea",
|
|
318
|
+
"details",
|
|
319
|
+
"dialog",
|
|
320
|
+
"menu",
|
|
321
|
+
"summary",
|
|
322
|
+
"details",
|
|
323
|
+
"slot",
|
|
324
|
+
"template",
|
|
325
|
+
"acronym",
|
|
326
|
+
"applet",
|
|
327
|
+
"basefont",
|
|
328
|
+
"bgsound",
|
|
329
|
+
"big",
|
|
330
|
+
"blink",
|
|
331
|
+
"center",
|
|
332
|
+
"content",
|
|
333
|
+
"dir",
|
|
334
|
+
"font",
|
|
335
|
+
"frame",
|
|
336
|
+
"frameset",
|
|
337
|
+
"hgroup",
|
|
338
|
+
"image",
|
|
339
|
+
"keygen",
|
|
340
|
+
"marquee",
|
|
341
|
+
"menuitem",
|
|
342
|
+
"nobr",
|
|
343
|
+
"noembed",
|
|
344
|
+
"noframes",
|
|
345
|
+
"plaintext",
|
|
346
|
+
"rb",
|
|
347
|
+
"rtc",
|
|
348
|
+
"shadow",
|
|
349
|
+
"spacer",
|
|
350
|
+
"strike",
|
|
351
|
+
"tt",
|
|
352
|
+
"xmp",
|
|
353
|
+
"a",
|
|
354
|
+
"abbr",
|
|
355
|
+
"acronym",
|
|
356
|
+
"address",
|
|
357
|
+
"applet",
|
|
358
|
+
"area",
|
|
359
|
+
"article",
|
|
360
|
+
"aside",
|
|
361
|
+
"audio",
|
|
362
|
+
"b",
|
|
363
|
+
"base",
|
|
364
|
+
"basefont",
|
|
365
|
+
"bdi",
|
|
366
|
+
"bdo",
|
|
367
|
+
"bgsound",
|
|
368
|
+
"big",
|
|
369
|
+
"blink",
|
|
370
|
+
"blockquote",
|
|
371
|
+
"body",
|
|
372
|
+
"br",
|
|
373
|
+
"button",
|
|
374
|
+
"canvas",
|
|
375
|
+
"caption",
|
|
376
|
+
"center",
|
|
377
|
+
"cite",
|
|
378
|
+
"code",
|
|
379
|
+
"col",
|
|
380
|
+
"colgroup",
|
|
381
|
+
"content",
|
|
382
|
+
"data",
|
|
383
|
+
"datalist",
|
|
384
|
+
"dd",
|
|
385
|
+
"del",
|
|
386
|
+
"details",
|
|
387
|
+
"dfn",
|
|
388
|
+
"dialog",
|
|
389
|
+
"dir",
|
|
390
|
+
"div",
|
|
391
|
+
"dl",
|
|
392
|
+
"dt",
|
|
393
|
+
"em",
|
|
394
|
+
"embed",
|
|
395
|
+
"fieldset",
|
|
396
|
+
"figcaption",
|
|
397
|
+
"figure",
|
|
398
|
+
"font",
|
|
399
|
+
"footer",
|
|
400
|
+
"form",
|
|
401
|
+
"frame",
|
|
402
|
+
"frameset",
|
|
403
|
+
"head",
|
|
404
|
+
"header",
|
|
405
|
+
"hgroup",
|
|
406
|
+
"hr",
|
|
407
|
+
"html",
|
|
408
|
+
"i",
|
|
409
|
+
"iframe",
|
|
410
|
+
"image",
|
|
411
|
+
"img",
|
|
412
|
+
"input",
|
|
413
|
+
"ins",
|
|
414
|
+
"kbd",
|
|
415
|
+
"keygen",
|
|
416
|
+
"label",
|
|
417
|
+
"legend",
|
|
418
|
+
"li",
|
|
419
|
+
"link",
|
|
420
|
+
"main",
|
|
421
|
+
"map",
|
|
422
|
+
"mark",
|
|
423
|
+
"marquee",
|
|
424
|
+
"menu",
|
|
425
|
+
"menuitem",
|
|
426
|
+
"meta",
|
|
427
|
+
"meter",
|
|
428
|
+
"nav",
|
|
429
|
+
"nobr",
|
|
430
|
+
"noembed",
|
|
431
|
+
"noframes",
|
|
432
|
+
"noscript",
|
|
433
|
+
"object",
|
|
434
|
+
"ol",
|
|
435
|
+
"optgroup",
|
|
436
|
+
"option",
|
|
437
|
+
"output",
|
|
438
|
+
"p",
|
|
439
|
+
"param",
|
|
440
|
+
"picture",
|
|
441
|
+
"plaintext",
|
|
442
|
+
"portal",
|
|
443
|
+
"pre",
|
|
444
|
+
"progress",
|
|
445
|
+
"q",
|
|
446
|
+
"rb",
|
|
447
|
+
"rp",
|
|
448
|
+
"rt",
|
|
449
|
+
"rtc",
|
|
450
|
+
"ruby",
|
|
451
|
+
"s",
|
|
452
|
+
"samp",
|
|
453
|
+
"script",
|
|
454
|
+
"section",
|
|
455
|
+
"select",
|
|
456
|
+
"shadow",
|
|
457
|
+
"slot",
|
|
458
|
+
"small",
|
|
459
|
+
"source",
|
|
460
|
+
"spacer",
|
|
461
|
+
"span",
|
|
462
|
+
"strike",
|
|
463
|
+
"strong",
|
|
464
|
+
"style",
|
|
465
|
+
"sub",
|
|
466
|
+
"summary",
|
|
467
|
+
"sup",
|
|
468
|
+
"table",
|
|
469
|
+
"tbody",
|
|
470
|
+
"td",
|
|
471
|
+
"template",
|
|
472
|
+
"textarea",
|
|
473
|
+
"tfoot",
|
|
474
|
+
"th",
|
|
475
|
+
"thead",
|
|
476
|
+
"time",
|
|
477
|
+
"title",
|
|
478
|
+
"tr",
|
|
479
|
+
"track",
|
|
480
|
+
"tt",
|
|
481
|
+
"u",
|
|
482
|
+
"ul",
|
|
483
|
+
"var",
|
|
484
|
+
"video",
|
|
485
|
+
"wbr",
|
|
486
|
+
"xmp",
|
|
487
|
+
"input",
|
|
488
|
+
"h1",
|
|
489
|
+
"h2",
|
|
490
|
+
"h3",
|
|
491
|
+
"h4",
|
|
492
|
+
"h5",
|
|
493
|
+
"h6"
|
|
494
|
+
]);
|
|
51
495
|
|
|
52
496
|
function reconcileArrays(parentNode, a, b) {
|
|
53
497
|
let bLength = b.length,
|
|
@@ -68,7 +512,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
68
512
|
bEnd--;
|
|
69
513
|
}
|
|
70
514
|
if (aEnd === aStart) {
|
|
71
|
-
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
515
|
+
const node = bEnd < bLength ? (bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart]) : after;
|
|
72
516
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
73
517
|
} else if (bEnd === bStart) {
|
|
74
518
|
while (aStart < aEnd) {
|
|
@@ -111,7 +555,9 @@ function render(code, element, init, options = {}) {
|
|
|
111
555
|
let disposer;
|
|
112
556
|
createRoot(dispose => {
|
|
113
557
|
disposer = dispose;
|
|
114
|
-
element === document
|
|
558
|
+
element === document
|
|
559
|
+
? code()
|
|
560
|
+
: insert(element, code(), element.firstChild ? null : undefined, init);
|
|
115
561
|
}, options.owner);
|
|
116
562
|
return () => {
|
|
117
563
|
disposer();
|
|
@@ -125,7 +571,9 @@ function template(html, isCE, isSVG) {
|
|
|
125
571
|
t.innerHTML = html;
|
|
126
572
|
return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
127
573
|
};
|
|
128
|
-
const fn = isCE
|
|
574
|
+
const fn = isCE
|
|
575
|
+
? () => untrack(() => document.importNode(node || (node = create()), true))
|
|
576
|
+
: () => (node || (node = create())).cloneNode(true);
|
|
129
577
|
fn.cloneNode = fn;
|
|
130
578
|
return fn;
|
|
131
579
|
}
|
|
@@ -146,19 +594,23 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
146
594
|
}
|
|
147
595
|
}
|
|
148
596
|
function setProperty(node, name, value) {
|
|
149
|
-
|
|
597
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
598
|
+
node[name] = value;
|
|
150
599
|
}
|
|
151
600
|
function setAttribute(node, name, value) {
|
|
152
|
-
if (sharedConfig.context) return;
|
|
153
|
-
if (value == null) node.removeAttribute(name);
|
|
601
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
602
|
+
if (value == null) node.removeAttribute(name);
|
|
603
|
+
else node.setAttribute(name, value);
|
|
154
604
|
}
|
|
155
605
|
function setAttributeNS(node, namespace, name, value) {
|
|
156
|
-
if (sharedConfig.context) return;
|
|
157
|
-
if (value == null) node.removeAttributeNS(namespace, name);
|
|
606
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
607
|
+
if (value == null) node.removeAttributeNS(namespace, name);
|
|
608
|
+
else node.setAttributeNS(namespace, name, value);
|
|
158
609
|
}
|
|
159
610
|
function className(node, value) {
|
|
160
|
-
if (sharedConfig.context) return;
|
|
161
|
-
if (value == null) node.removeAttribute("class");
|
|
611
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
612
|
+
if (value == null) node.removeAttribute("class");
|
|
613
|
+
else node.className = value;
|
|
162
614
|
}
|
|
163
615
|
function addEventListener(node, name, handler, delegate) {
|
|
164
616
|
if (delegate) {
|
|
@@ -168,7 +620,7 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
168
620
|
} else node[`$$${name}`] = handler;
|
|
169
621
|
} else if (Array.isArray(handler)) {
|
|
170
622
|
const handlerFn = handler[0];
|
|
171
|
-
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
623
|
+
node.addEventListener(name, (handler[0] = e => handlerFn.call(node, handler[1], e)));
|
|
172
624
|
} else node.addEventListener(name, handler);
|
|
173
625
|
}
|
|
174
626
|
function classList(node, value, prev = {}) {
|
|
@@ -193,7 +645,7 @@ function classList(node, value, prev = {}) {
|
|
|
193
645
|
function style(node, value, prev) {
|
|
194
646
|
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
195
647
|
const nodeStyle = node.style;
|
|
196
|
-
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
648
|
+
if (typeof value === "string") return (nodeStyle.cssText = value);
|
|
197
649
|
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
198
650
|
prev || (prev = {});
|
|
199
651
|
value || (value = {});
|
|
@@ -214,7 +666,9 @@ function style(node, value, prev) {
|
|
|
214
666
|
function spread(node, props = {}, isSVG, skipChildren) {
|
|
215
667
|
const prevProps = {};
|
|
216
668
|
if (!skipChildren) {
|
|
217
|
-
createRenderEffect(
|
|
669
|
+
createRenderEffect(
|
|
670
|
+
() => (prevProps.children = insertExpression(node, props.children, prevProps.children))
|
|
671
|
+
);
|
|
218
672
|
}
|
|
219
673
|
createRenderEffect(() => props.ref && props.ref(node));
|
|
220
674
|
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
@@ -273,7 +727,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
273
727
|
}
|
|
274
728
|
function getNextElement(template) {
|
|
275
729
|
let node, key;
|
|
276
|
-
if (!sharedConfig.context || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
730
|
+
if (!sharedConfig.context || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
|
|
277
731
|
return template();
|
|
278
732
|
}
|
|
279
733
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
@@ -292,7 +746,8 @@ function getNextMarker(start) {
|
|
|
292
746
|
while (end) {
|
|
293
747
|
if (end.nodeType === 8) {
|
|
294
748
|
const v = end.nodeValue;
|
|
295
|
-
if (v === "$") count++;
|
|
749
|
+
if (v === "$") count++;
|
|
750
|
+
else if (v === "/") {
|
|
296
751
|
if (count === 0) return [end, current];
|
|
297
752
|
count--;
|
|
298
753
|
}
|
|
@@ -306,10 +761,7 @@ function getNextMarker(start) {
|
|
|
306
761
|
function runHydrationEvents() {
|
|
307
762
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
308
763
|
queueMicrotask(() => {
|
|
309
|
-
const {
|
|
310
|
-
completed,
|
|
311
|
-
events
|
|
312
|
-
} = sharedConfig;
|
|
764
|
+
const { completed, events } = sharedConfig;
|
|
313
765
|
events.queued = false;
|
|
314
766
|
while (events.length) {
|
|
315
767
|
const [el, e] = events[0];
|
|
@@ -326,7 +778,8 @@ function toPropertyName(name) {
|
|
|
326
778
|
}
|
|
327
779
|
function toggleClassKey(node, key, value) {
|
|
328
780
|
const classNames = key.trim().split(/\s+/);
|
|
329
|
-
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
781
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
782
|
+
node.classList.toggle(classNames[i], value);
|
|
330
783
|
}
|
|
331
784
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
332
785
|
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
@@ -356,21 +809,30 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
356
809
|
}
|
|
357
810
|
} else if (prop.slice(0, 5) === "attr:") {
|
|
358
811
|
setAttribute(node, prop.slice(5), value);
|
|
359
|
-
} else if (
|
|
812
|
+
} else if (
|
|
813
|
+
(forceProp = prop.slice(0, 5) === "prop:") ||
|
|
814
|
+
(isChildProp = ChildProperties.has(prop)) ||
|
|
815
|
+
(!isSVG &&
|
|
816
|
+
((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop)))) ||
|
|
817
|
+
(isCE = node.nodeName.includes("-"))
|
|
818
|
+
) {
|
|
360
819
|
if (forceProp) {
|
|
361
820
|
prop = prop.slice(5);
|
|
362
821
|
isProp = true;
|
|
363
|
-
} else if (sharedConfig.context) return value;
|
|
364
|
-
if (prop === "class" || prop === "className") className(node, value);
|
|
822
|
+
} else if (!!sharedConfig.context && node.isConnected) return value;
|
|
823
|
+
if (prop === "class" || prop === "className") className(node, value);
|
|
824
|
+
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
825
|
+
else node[propAlias || prop] = value;
|
|
365
826
|
} else {
|
|
366
827
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
367
|
-
if (ns) setAttributeNS(node, ns, prop, value);
|
|
828
|
+
if (ns) setAttributeNS(node, ns, prop, value);
|
|
829
|
+
else setAttribute(node, Aliases[prop] || prop, value);
|
|
368
830
|
}
|
|
369
831
|
return value;
|
|
370
832
|
}
|
|
371
833
|
function eventHandler(e) {
|
|
372
834
|
const key = `$$${e.type}`;
|
|
373
|
-
let node = e.composedPath && e.composedPath()[0] || e.target;
|
|
835
|
+
let node = (e.composedPath && e.composedPath()[0]) || e.target;
|
|
374
836
|
if (e.target !== node) {
|
|
375
837
|
Object.defineProperty(e, "target", {
|
|
376
838
|
configurable: true,
|
|
@@ -395,12 +857,14 @@ function eventHandler(e) {
|
|
|
395
857
|
}
|
|
396
858
|
}
|
|
397
859
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
398
|
-
|
|
860
|
+
const hydrating = !!sharedConfig.context && parent.isConnected;
|
|
861
|
+
if (hydrating) {
|
|
399
862
|
!current && (current = [...parent.childNodes]);
|
|
400
863
|
let cleaned = [];
|
|
401
864
|
for (let i = 0; i < current.length; i++) {
|
|
402
865
|
const node = current[i];
|
|
403
|
-
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
866
|
+
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
867
|
+
else cleaned.push(node);
|
|
404
868
|
}
|
|
405
869
|
current = cleaned;
|
|
406
870
|
}
|
|
@@ -408,9 +872,9 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
408
872
|
if (value === current) return current;
|
|
409
873
|
const t = typeof value,
|
|
410
874
|
multi = marker !== undefined;
|
|
411
|
-
parent = multi && current[0] && current[0].parentNode || parent;
|
|
875
|
+
parent = (multi && current[0] && current[0].parentNode) || parent;
|
|
412
876
|
if (t === "string" || t === "number") {
|
|
413
|
-
if (
|
|
877
|
+
if (hydrating) return current;
|
|
414
878
|
if (t === "number") value = value.toString();
|
|
415
879
|
if (multi) {
|
|
416
880
|
let node = current[0];
|
|
@@ -424,7 +888,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
424
888
|
} else current = parent.textContent = value;
|
|
425
889
|
}
|
|
426
890
|
} else if (value == null || t === "boolean") {
|
|
427
|
-
if (
|
|
891
|
+
if (hydrating) return current;
|
|
428
892
|
current = cleanChildren(parent, current, marker);
|
|
429
893
|
} else if (t === "function") {
|
|
430
894
|
createRenderEffect(() => {
|
|
@@ -437,16 +901,16 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
437
901
|
const array = [];
|
|
438
902
|
const currentArray = current && Array.isArray(current);
|
|
439
903
|
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
440
|
-
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
904
|
+
createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
|
|
441
905
|
return () => current;
|
|
442
906
|
}
|
|
443
|
-
if (
|
|
907
|
+
if (hydrating) {
|
|
444
908
|
if (!array.length) return current;
|
|
445
909
|
if (marker === undefined) return [...parent.childNodes];
|
|
446
910
|
let node = array[0];
|
|
447
911
|
let nodes = [node];
|
|
448
912
|
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
449
|
-
return current = nodes;
|
|
913
|
+
return (current = nodes);
|
|
450
914
|
}
|
|
451
915
|
if (array.length === 0) {
|
|
452
916
|
current = cleanChildren(parent, current, marker);
|
|
@@ -461,38 +925,45 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
461
925
|
}
|
|
462
926
|
current = array;
|
|
463
927
|
} else if (value.nodeType) {
|
|
464
|
-
if (
|
|
928
|
+
if (hydrating && value.parentNode) return (current = multi ? [value] : value);
|
|
465
929
|
if (Array.isArray(current)) {
|
|
466
|
-
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
930
|
+
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
|
467
931
|
cleanChildren(parent, current, null, value);
|
|
468
932
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
469
933
|
parent.appendChild(value);
|
|
470
934
|
} else parent.replaceChild(value, parent.firstChild);
|
|
471
935
|
current = value;
|
|
472
|
-
} else
|
|
936
|
+
} else;
|
|
473
937
|
return current;
|
|
474
938
|
}
|
|
475
939
|
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
476
940
|
let dynamic = false;
|
|
477
941
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
478
942
|
let item = array[i],
|
|
479
|
-
prev = current && current[
|
|
943
|
+
prev = current && current[normalized.length],
|
|
480
944
|
t;
|
|
481
|
-
if (item == null || item === true || item === false)
|
|
945
|
+
if (item == null || item === true || item === false);
|
|
946
|
+
else if ((t = typeof item) === "object" && item.nodeType) {
|
|
482
947
|
normalized.push(item);
|
|
483
948
|
} else if (Array.isArray(item)) {
|
|
484
949
|
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
485
950
|
} else if (t === "function") {
|
|
486
951
|
if (unwrap) {
|
|
487
952
|
while (typeof item === "function") item = item();
|
|
488
|
-
dynamic =
|
|
953
|
+
dynamic =
|
|
954
|
+
normalizeIncomingArray(
|
|
955
|
+
normalized,
|
|
956
|
+
Array.isArray(item) ? item : [item],
|
|
957
|
+
Array.isArray(prev) ? prev : [prev]
|
|
958
|
+
) || dynamic;
|
|
489
959
|
} else {
|
|
490
960
|
normalized.push(item);
|
|
491
961
|
dynamic = true;
|
|
492
962
|
}
|
|
493
963
|
} else {
|
|
494
964
|
const value = String(item);
|
|
495
|
-
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
965
|
+
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
966
|
+
else normalized.push(document.createTextNode(value));
|
|
496
967
|
}
|
|
497
968
|
}
|
|
498
969
|
return dynamic;
|
|
@@ -501,7 +972,7 @@ function appendNodes(parent, array, marker = null) {
|
|
|
501
972
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
502
973
|
}
|
|
503
974
|
function cleanChildren(parent, current, marker, replacement) {
|
|
504
|
-
if (marker === undefined) return parent.textContent = "";
|
|
975
|
+
if (marker === undefined) return (parent.textContent = "");
|
|
505
976
|
const node = replacement || document.createTextNode("");
|
|
506
977
|
if (current.length) {
|
|
507
978
|
let inserted = false;
|
|
@@ -509,7 +980,9 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
509
980
|
const el = current[i];
|
|
510
981
|
if (node !== el) {
|
|
511
982
|
const isParent = el.parentNode === parent;
|
|
512
|
-
if (!inserted && !i)
|
|
983
|
+
if (!inserted && !i)
|
|
984
|
+
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
985
|
+
else isParent && el.remove();
|
|
513
986
|
} else inserted = true;
|
|
514
987
|
}
|
|
515
988
|
} else parent.insertBefore(node, marker);
|
|
@@ -520,7 +993,8 @@ function gatherHydratable(element, root) {
|
|
|
520
993
|
for (let i = 0; i < templates.length; i++) {
|
|
521
994
|
const node = templates[i];
|
|
522
995
|
const key = node.getAttribute("data-hk");
|
|
523
|
-
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
996
|
+
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
997
|
+
sharedConfig.registry.set(key, node);
|
|
524
998
|
}
|
|
525
999
|
}
|
|
526
1000
|
function getHydrationKey() {
|
|
@@ -573,42 +1047,47 @@ const hydrate = (...args) => {
|
|
|
573
1047
|
return hydrate$1(...args);
|
|
574
1048
|
};
|
|
575
1049
|
function Portal(props) {
|
|
576
|
-
const {
|
|
577
|
-
useShadow
|
|
578
|
-
} = props,
|
|
1050
|
+
const { useShadow } = props,
|
|
579
1051
|
marker = document.createTextNode(""),
|
|
580
1052
|
mount = () => props.mount || document.body,
|
|
581
1053
|
owner = getOwner();
|
|
582
1054
|
let content;
|
|
583
1055
|
let hydrating = !!sharedConfig.context;
|
|
584
|
-
createEffect(
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
1056
|
+
createEffect(
|
|
1057
|
+
() => {
|
|
1058
|
+
if (hydrating) getOwner().user = hydrating = false;
|
|
1059
|
+
content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
|
|
1060
|
+
const el = mount();
|
|
1061
|
+
if (el instanceof HTMLHeadElement) {
|
|
1062
|
+
const [clean, setClean] = createSignal(false);
|
|
1063
|
+
const cleanup = () => setClean(true);
|
|
1064
|
+
createRoot(dispose => insert(el, () => (!clean() ? content() : dispose()), null));
|
|
1065
|
+
onCleanup(cleanup);
|
|
1066
|
+
} else {
|
|
1067
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
1068
|
+
renderRoot =
|
|
1069
|
+
useShadow && container.attachShadow
|
|
1070
|
+
? container.attachShadow({
|
|
1071
|
+
mode: "open"
|
|
1072
|
+
})
|
|
1073
|
+
: container;
|
|
1074
|
+
Object.defineProperty(container, "_$host", {
|
|
1075
|
+
get() {
|
|
1076
|
+
return marker.parentNode;
|
|
1077
|
+
},
|
|
1078
|
+
configurable: true
|
|
1079
|
+
});
|
|
1080
|
+
insert(renderRoot, content);
|
|
1081
|
+
el.appendChild(container);
|
|
1082
|
+
props.ref && props.ref(container);
|
|
1083
|
+
onCleanup(() => el.removeChild(container));
|
|
1084
|
+
}
|
|
1085
|
+
},
|
|
1086
|
+
undefined,
|
|
1087
|
+
{
|
|
1088
|
+
render: !hydrating
|
|
608
1089
|
}
|
|
609
|
-
|
|
610
|
-
render: !hydrating
|
|
611
|
-
});
|
|
1090
|
+
);
|
|
612
1091
|
return marker;
|
|
613
1092
|
}
|
|
614
1093
|
function Dynamic(props) {
|
|
@@ -628,4 +1107,61 @@ function Dynamic(props) {
|
|
|
628
1107
|
});
|
|
629
1108
|
}
|
|
630
1109
|
|
|
631
|
-
export {
|
|
1110
|
+
export {
|
|
1111
|
+
Aliases,
|
|
1112
|
+
voidFn as Assets,
|
|
1113
|
+
ChildProperties,
|
|
1114
|
+
DOMElements,
|
|
1115
|
+
DelegatedEvents,
|
|
1116
|
+
Dynamic,
|
|
1117
|
+
Hydration,
|
|
1118
|
+
voidFn as HydrationScript,
|
|
1119
|
+
NoHydration,
|
|
1120
|
+
Portal,
|
|
1121
|
+
Properties,
|
|
1122
|
+
RequestContext,
|
|
1123
|
+
SVGElements,
|
|
1124
|
+
SVGNamespace,
|
|
1125
|
+
addEventListener,
|
|
1126
|
+
assign,
|
|
1127
|
+
classList,
|
|
1128
|
+
className,
|
|
1129
|
+
clearDelegatedEvents,
|
|
1130
|
+
delegateEvents,
|
|
1131
|
+
dynamicProperty,
|
|
1132
|
+
escape,
|
|
1133
|
+
voidFn as generateHydrationScript,
|
|
1134
|
+
voidFn as getAssets,
|
|
1135
|
+
getHydrationKey,
|
|
1136
|
+
getNextElement,
|
|
1137
|
+
getNextMarker,
|
|
1138
|
+
getNextMatch,
|
|
1139
|
+
getPropAlias,
|
|
1140
|
+
voidFn as getRequestEvent,
|
|
1141
|
+
hydrate,
|
|
1142
|
+
innerHTML,
|
|
1143
|
+
insert,
|
|
1144
|
+
isDev,
|
|
1145
|
+
isServer,
|
|
1146
|
+
render,
|
|
1147
|
+
renderToStream,
|
|
1148
|
+
renderToString,
|
|
1149
|
+
renderToStringAsync,
|
|
1150
|
+
resolveSSRNode,
|
|
1151
|
+
runHydrationEvents,
|
|
1152
|
+
setAttribute,
|
|
1153
|
+
setAttributeNS,
|
|
1154
|
+
setProperty,
|
|
1155
|
+
spread,
|
|
1156
|
+
ssr,
|
|
1157
|
+
ssrAttribute,
|
|
1158
|
+
ssrClassList,
|
|
1159
|
+
ssrElement,
|
|
1160
|
+
ssrHydrationKey,
|
|
1161
|
+
ssrSpread,
|
|
1162
|
+
ssrStyle,
|
|
1163
|
+
style,
|
|
1164
|
+
template,
|
|
1165
|
+
use,
|
|
1166
|
+
voidFn as useAssets
|
|
1167
|
+
};
|