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/web.js
CHANGED
|
@@ -1,14 +1,82 @@
|
|
|
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
|
+
} 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,396 @@ 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
|
+
"feDropShadow",
|
|
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) {
|
|
@@ -111,7 +556,9 @@ function render(code, element, init, options = {}) {
|
|
|
111
556
|
let disposer;
|
|
112
557
|
createRoot(dispose => {
|
|
113
558
|
disposer = dispose;
|
|
114
|
-
element === document
|
|
559
|
+
element === document
|
|
560
|
+
? code()
|
|
561
|
+
: insert(element, code(), element.firstChild ? null : undefined, init);
|
|
115
562
|
}, options.owner);
|
|
116
563
|
return () => {
|
|
117
564
|
disposer();
|
|
@@ -125,7 +572,9 @@ function template(html, isCE, isSVG) {
|
|
|
125
572
|
t.innerHTML = html;
|
|
126
573
|
return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
127
574
|
};
|
|
128
|
-
const fn = isCE
|
|
575
|
+
const fn = isCE
|
|
576
|
+
? () => untrack(() => document.importNode(node || (node = create()), true))
|
|
577
|
+
: () => (node || (node = create())).cloneNode(true);
|
|
129
578
|
fn.cloneNode = fn;
|
|
130
579
|
return fn;
|
|
131
580
|
}
|
|
@@ -151,15 +600,18 @@ function setProperty(node, name, value) {
|
|
|
151
600
|
}
|
|
152
601
|
function setAttribute(node, name, value) {
|
|
153
602
|
if (isHydrating(node)) return;
|
|
154
|
-
if (value == null) node.removeAttribute(name);
|
|
603
|
+
if (value == null) node.removeAttribute(name);
|
|
604
|
+
else node.setAttribute(name, value);
|
|
155
605
|
}
|
|
156
606
|
function setAttributeNS(node, namespace, name, value) {
|
|
157
607
|
if (isHydrating(node)) return;
|
|
158
|
-
if (value == null) node.removeAttributeNS(namespace, name);
|
|
608
|
+
if (value == null) node.removeAttributeNS(namespace, name);
|
|
609
|
+
else node.setAttributeNS(namespace, name, value);
|
|
159
610
|
}
|
|
160
611
|
function className(node, value) {
|
|
161
612
|
if (isHydrating(node)) return;
|
|
162
|
-
if (value == null) node.removeAttribute("class");
|
|
613
|
+
if (value == null) node.removeAttribute("class");
|
|
614
|
+
else node.className = value;
|
|
163
615
|
}
|
|
164
616
|
function addEventListener(node, name, handler, delegate) {
|
|
165
617
|
if (delegate) {
|
|
@@ -169,7 +621,7 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
169
621
|
} else node[`$$${name}`] = handler;
|
|
170
622
|
} else if (Array.isArray(handler)) {
|
|
171
623
|
const handlerFn = handler[0];
|
|
172
|
-
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
624
|
+
node.addEventListener(name, (handler[0] = e => handlerFn.call(node, handler[1], e)));
|
|
173
625
|
} else node.addEventListener(name, handler);
|
|
174
626
|
}
|
|
175
627
|
function classList(node, value, prev = {}) {
|
|
@@ -194,7 +646,7 @@ function classList(node, value, prev = {}) {
|
|
|
194
646
|
function style(node, value, prev) {
|
|
195
647
|
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
196
648
|
const nodeStyle = node.style;
|
|
197
|
-
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
649
|
+
if (typeof value === "string") return (nodeStyle.cssText = value);
|
|
198
650
|
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
199
651
|
prev || (prev = {});
|
|
200
652
|
value || (value = {});
|
|
@@ -215,7 +667,9 @@ function style(node, value, prev) {
|
|
|
215
667
|
function spread(node, props = {}, isSVG, skipChildren) {
|
|
216
668
|
const prevProps = {};
|
|
217
669
|
if (!skipChildren) {
|
|
218
|
-
createRenderEffect(
|
|
670
|
+
createRenderEffect(
|
|
671
|
+
() => (prevProps.children = insertExpression(node, props.children, prevProps.children))
|
|
672
|
+
);
|
|
219
673
|
}
|
|
220
674
|
createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
|
|
221
675
|
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
@@ -279,7 +733,7 @@ function getNextElement(template) {
|
|
|
279
733
|
let node,
|
|
280
734
|
key,
|
|
281
735
|
hydrating = isHydrating();
|
|
282
|
-
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
736
|
+
if (!hydrating || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
|
|
283
737
|
return template();
|
|
284
738
|
}
|
|
285
739
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
@@ -298,7 +752,8 @@ function getNextMarker(start) {
|
|
|
298
752
|
while (end) {
|
|
299
753
|
if (end.nodeType === 8) {
|
|
300
754
|
const v = end.nodeValue;
|
|
301
|
-
if (v === "$") count++;
|
|
755
|
+
if (v === "$") count++;
|
|
756
|
+
else if (v === "/") {
|
|
302
757
|
if (count === 0) return [end, current];
|
|
303
758
|
count--;
|
|
304
759
|
}
|
|
@@ -312,10 +767,8 @@ function getNextMarker(start) {
|
|
|
312
767
|
function runHydrationEvents() {
|
|
313
768
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
314
769
|
queueMicrotask(() => {
|
|
315
|
-
const {
|
|
316
|
-
|
|
317
|
-
events
|
|
318
|
-
} = sharedConfig;
|
|
770
|
+
const { completed, events } = sharedConfig;
|
|
771
|
+
if (!events) return;
|
|
319
772
|
events.queued = false;
|
|
320
773
|
while (events.length) {
|
|
321
774
|
const [el, e] = events[0];
|
|
@@ -339,7 +792,8 @@ function toPropertyName(name) {
|
|
|
339
792
|
}
|
|
340
793
|
function toggleClassKey(node, key, value) {
|
|
341
794
|
const classNames = key.trim().split(/\s+/);
|
|
342
|
-
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
795
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
796
|
+
node.classList.toggle(classNames[i], value);
|
|
343
797
|
}
|
|
344
798
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
345
799
|
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
@@ -369,15 +823,24 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
369
823
|
}
|
|
370
824
|
} else if (prop.slice(0, 5) === "attr:") {
|
|
371
825
|
setAttribute(node, prop.slice(5), value);
|
|
372
|
-
} else if (
|
|
826
|
+
} else if (
|
|
827
|
+
(forceProp = prop.slice(0, 5) === "prop:") ||
|
|
828
|
+
(isChildProp = ChildProperties.has(prop)) ||
|
|
829
|
+
(!isSVG &&
|
|
830
|
+
((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop)))) ||
|
|
831
|
+
(isCE = node.nodeName.includes("-"))
|
|
832
|
+
) {
|
|
373
833
|
if (forceProp) {
|
|
374
834
|
prop = prop.slice(5);
|
|
375
835
|
isProp = true;
|
|
376
836
|
} else if (isHydrating(node)) return value;
|
|
377
|
-
if (prop === "class" || prop === "className") className(node, value);
|
|
837
|
+
if (prop === "class" || prop === "className") className(node, value);
|
|
838
|
+
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
839
|
+
else node[propAlias || prop] = value;
|
|
378
840
|
} else {
|
|
379
841
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
380
|
-
if (ns) setAttributeNS(node, ns, prop, value);
|
|
842
|
+
if (ns) setAttributeNS(node, ns, prop, value);
|
|
843
|
+
else setAttribute(node, Aliases[prop] || prop, value);
|
|
381
844
|
}
|
|
382
845
|
return value;
|
|
383
846
|
}
|
|
@@ -386,7 +849,7 @@ function eventHandler(e) {
|
|
|
386
849
|
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
387
850
|
}
|
|
388
851
|
const key = `$$${e.type}`;
|
|
389
|
-
let node = e.composedPath && e.composedPath()[0] || e.target;
|
|
852
|
+
let node = (e.composedPath && e.composedPath()[0]) || e.target;
|
|
390
853
|
if (e.target !== node) {
|
|
391
854
|
Object.defineProperty(e, "target", {
|
|
392
855
|
configurable: true,
|
|
@@ -417,7 +880,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
417
880
|
let cleaned = [];
|
|
418
881
|
for (let i = 0; i < current.length; i++) {
|
|
419
882
|
const node = current[i];
|
|
420
|
-
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
883
|
+
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
884
|
+
else cleaned.push(node);
|
|
421
885
|
}
|
|
422
886
|
current = cleaned;
|
|
423
887
|
}
|
|
@@ -425,7 +889,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
425
889
|
if (value === current) return current;
|
|
426
890
|
const t = typeof value,
|
|
427
891
|
multi = marker !== undefined;
|
|
428
|
-
parent = multi && current[0] && current[0].parentNode || parent;
|
|
892
|
+
parent = (multi && current[0] && current[0].parentNode) || parent;
|
|
429
893
|
if (t === "string" || t === "number") {
|
|
430
894
|
if (hydrating) return current;
|
|
431
895
|
if (t === "number") {
|
|
@@ -457,17 +921,17 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
457
921
|
const array = [];
|
|
458
922
|
const currentArray = current && Array.isArray(current);
|
|
459
923
|
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
460
|
-
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
924
|
+
createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
|
|
461
925
|
return () => current;
|
|
462
926
|
}
|
|
463
927
|
if (hydrating) {
|
|
464
928
|
if (!array.length) return current;
|
|
465
|
-
if (marker === undefined) return current = [...parent.childNodes];
|
|
929
|
+
if (marker === undefined) return (current = [...parent.childNodes]);
|
|
466
930
|
let node = array[0];
|
|
467
931
|
if (node.parentNode !== parent) return current;
|
|
468
932
|
const nodes = [node];
|
|
469
933
|
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
470
|
-
return current = nodes;
|
|
934
|
+
return (current = nodes);
|
|
471
935
|
}
|
|
472
936
|
if (array.length === 0) {
|
|
473
937
|
current = cleanChildren(parent, current, marker);
|
|
@@ -482,15 +946,15 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
482
946
|
}
|
|
483
947
|
current = array;
|
|
484
948
|
} else if (value.nodeType) {
|
|
485
|
-
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
949
|
+
if (hydrating && value.parentNode) return (current = multi ? [value] : value);
|
|
486
950
|
if (Array.isArray(current)) {
|
|
487
|
-
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
951
|
+
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
|
488
952
|
cleanChildren(parent, current, null, value);
|
|
489
953
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
490
954
|
parent.appendChild(value);
|
|
491
955
|
} else parent.replaceChild(value, parent.firstChild);
|
|
492
956
|
current = value;
|
|
493
|
-
} else
|
|
957
|
+
} else;
|
|
494
958
|
return current;
|
|
495
959
|
}
|
|
496
960
|
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
@@ -499,21 +963,28 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
499
963
|
let item = array[i],
|
|
500
964
|
prev = current && current[normalized.length],
|
|
501
965
|
t;
|
|
502
|
-
if (item == null || item === true || item === false)
|
|
966
|
+
if (item == null || item === true || item === false);
|
|
967
|
+
else if ((t = typeof item) === "object" && item.nodeType) {
|
|
503
968
|
normalized.push(item);
|
|
504
969
|
} else if (Array.isArray(item)) {
|
|
505
970
|
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
506
971
|
} else if (t === "function") {
|
|
507
972
|
if (unwrap) {
|
|
508
973
|
while (typeof item === "function") item = item();
|
|
509
|
-
dynamic =
|
|
974
|
+
dynamic =
|
|
975
|
+
normalizeIncomingArray(
|
|
976
|
+
normalized,
|
|
977
|
+
Array.isArray(item) ? item : [item],
|
|
978
|
+
Array.isArray(prev) ? prev : [prev]
|
|
979
|
+
) || dynamic;
|
|
510
980
|
} else {
|
|
511
981
|
normalized.push(item);
|
|
512
982
|
dynamic = true;
|
|
513
983
|
}
|
|
514
984
|
} else {
|
|
515
985
|
const value = String(item);
|
|
516
|
-
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
986
|
+
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
987
|
+
else normalized.push(document.createTextNode(value));
|
|
517
988
|
}
|
|
518
989
|
}
|
|
519
990
|
return dynamic;
|
|
@@ -522,7 +993,7 @@ function appendNodes(parent, array, marker = null) {
|
|
|
522
993
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
523
994
|
}
|
|
524
995
|
function cleanChildren(parent, current, marker, replacement) {
|
|
525
|
-
if (marker === undefined) return parent.textContent = "";
|
|
996
|
+
if (marker === undefined) return (parent.textContent = "");
|
|
526
997
|
const node = replacement || document.createTextNode("");
|
|
527
998
|
if (current.length) {
|
|
528
999
|
let inserted = false;
|
|
@@ -530,7 +1001,9 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
530
1001
|
const el = current[i];
|
|
531
1002
|
if (node !== el) {
|
|
532
1003
|
const isParent = el.parentNode === parent;
|
|
533
|
-
if (!inserted && !i)
|
|
1004
|
+
if (!inserted && !i)
|
|
1005
|
+
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
1006
|
+
else isParent && el.remove();
|
|
534
1007
|
} else inserted = true;
|
|
535
1008
|
}
|
|
536
1009
|
} else parent.insertBefore(node, marker);
|
|
@@ -541,7 +1014,8 @@ function gatherHydratable(element, root) {
|
|
|
541
1014
|
for (let i = 0; i < templates.length; i++) {
|
|
542
1015
|
const node = templates[i];
|
|
543
1016
|
const key = node.getAttribute("data-hk");
|
|
544
|
-
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1017
|
+
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1018
|
+
sharedConfig.registry.set(key, node);
|
|
545
1019
|
}
|
|
546
1020
|
}
|
|
547
1021
|
function getHydrationKey() {
|
|
@@ -593,42 +1067,47 @@ const hydrate = (...args) => {
|
|
|
593
1067
|
return hydrate$1(...args);
|
|
594
1068
|
};
|
|
595
1069
|
function Portal(props) {
|
|
596
|
-
const {
|
|
597
|
-
useShadow
|
|
598
|
-
} = props,
|
|
1070
|
+
const { useShadow } = props,
|
|
599
1071
|
marker = document.createTextNode(""),
|
|
600
1072
|
mount = () => props.mount || document.body,
|
|
601
1073
|
owner = getOwner();
|
|
602
1074
|
let content;
|
|
603
1075
|
let hydrating = !!sharedConfig.context;
|
|
604
|
-
createEffect(
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
1076
|
+
createEffect(
|
|
1077
|
+
() => {
|
|
1078
|
+
if (hydrating) getOwner().user = hydrating = false;
|
|
1079
|
+
content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
|
|
1080
|
+
const el = mount();
|
|
1081
|
+
if (el instanceof HTMLHeadElement) {
|
|
1082
|
+
const [clean, setClean] = createSignal(false);
|
|
1083
|
+
const cleanup = () => setClean(true);
|
|
1084
|
+
createRoot(dispose => insert(el, () => (!clean() ? content() : dispose()), null));
|
|
1085
|
+
onCleanup(cleanup);
|
|
1086
|
+
} else {
|
|
1087
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
1088
|
+
renderRoot =
|
|
1089
|
+
useShadow && container.attachShadow
|
|
1090
|
+
? container.attachShadow({
|
|
1091
|
+
mode: "open"
|
|
1092
|
+
})
|
|
1093
|
+
: container;
|
|
1094
|
+
Object.defineProperty(container, "_$host", {
|
|
1095
|
+
get() {
|
|
1096
|
+
return marker.parentNode;
|
|
1097
|
+
},
|
|
1098
|
+
configurable: true
|
|
1099
|
+
});
|
|
1100
|
+
insert(renderRoot, content);
|
|
1101
|
+
el.appendChild(container);
|
|
1102
|
+
props.ref && props.ref(container);
|
|
1103
|
+
onCleanup(() => el.removeChild(container));
|
|
1104
|
+
}
|
|
1105
|
+
},
|
|
1106
|
+
undefined,
|
|
1107
|
+
{
|
|
1108
|
+
render: !hydrating
|
|
628
1109
|
}
|
|
629
|
-
|
|
630
|
-
render: !hydrating
|
|
631
|
-
});
|
|
1110
|
+
);
|
|
632
1111
|
return marker;
|
|
633
1112
|
}
|
|
634
1113
|
function Dynamic(props) {
|
|
@@ -648,4 +1127,61 @@ function Dynamic(props) {
|
|
|
648
1127
|
});
|
|
649
1128
|
}
|
|
650
1129
|
|
|
651
|
-
export {
|
|
1130
|
+
export {
|
|
1131
|
+
Aliases,
|
|
1132
|
+
voidFn as Assets,
|
|
1133
|
+
ChildProperties,
|
|
1134
|
+
DOMElements,
|
|
1135
|
+
DelegatedEvents,
|
|
1136
|
+
Dynamic,
|
|
1137
|
+
Hydration,
|
|
1138
|
+
voidFn as HydrationScript,
|
|
1139
|
+
NoHydration,
|
|
1140
|
+
Portal,
|
|
1141
|
+
Properties,
|
|
1142
|
+
RequestContext,
|
|
1143
|
+
SVGElements,
|
|
1144
|
+
SVGNamespace,
|
|
1145
|
+
addEventListener,
|
|
1146
|
+
assign,
|
|
1147
|
+
classList,
|
|
1148
|
+
className,
|
|
1149
|
+
clearDelegatedEvents,
|
|
1150
|
+
delegateEvents,
|
|
1151
|
+
dynamicProperty,
|
|
1152
|
+
escape,
|
|
1153
|
+
voidFn as generateHydrationScript,
|
|
1154
|
+
voidFn as getAssets,
|
|
1155
|
+
getHydrationKey,
|
|
1156
|
+
getNextElement,
|
|
1157
|
+
getNextMarker,
|
|
1158
|
+
getNextMatch,
|
|
1159
|
+
getPropAlias,
|
|
1160
|
+
voidFn as getRequestEvent,
|
|
1161
|
+
hydrate,
|
|
1162
|
+
innerHTML,
|
|
1163
|
+
insert,
|
|
1164
|
+
isDev,
|
|
1165
|
+
isServer,
|
|
1166
|
+
render,
|
|
1167
|
+
renderToStream,
|
|
1168
|
+
renderToString,
|
|
1169
|
+
renderToStringAsync,
|
|
1170
|
+
resolveSSRNode,
|
|
1171
|
+
runHydrationEvents,
|
|
1172
|
+
setAttribute,
|
|
1173
|
+
setAttributeNS,
|
|
1174
|
+
setProperty,
|
|
1175
|
+
spread,
|
|
1176
|
+
ssr,
|
|
1177
|
+
ssrAttribute,
|
|
1178
|
+
ssrClassList,
|
|
1179
|
+
ssrElement,
|
|
1180
|
+
ssrHydrationKey,
|
|
1181
|
+
ssrSpread,
|
|
1182
|
+
ssrStyle,
|
|
1183
|
+
style,
|
|
1184
|
+
template,
|
|
1185
|
+
use,
|
|
1186
|
+
voidFn as useAssets
|
|
1187
|
+
};
|