@solidjs/web 2.0.0-experimental.1 → 2.0.0-experimental.3
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/LICENSE +1 -1
- package/dist/dev.cjs +19 -11
- package/dist/dev.js +639 -85
- package/dist/server.cjs +27 -7
- package/dist/server.js +647 -103
- package/dist/web.cjs +19 -11
- package/dist/web.js +627 -83
- package/package.json +3 -3
- package/storage/dist/storage.js +3 -3
- package/types/client.d.ts +11 -2
- package/types/core.d.ts +11 -1
- package/types/index.d.ts +20 -4
- package/types/server-mock.d.ts +33 -26
package/dist/web.js
CHANGED
|
@@ -1,10 +1,71 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createRoot,
|
|
3
|
+
untrack,
|
|
4
|
+
createRenderEffect,
|
|
5
|
+
sharedConfig,
|
|
6
|
+
flatten,
|
|
7
|
+
enableHydration,
|
|
8
|
+
createMemo,
|
|
9
|
+
omit
|
|
10
|
+
} from "solid-js";
|
|
11
|
+
export {
|
|
12
|
+
ErrorBoundary,
|
|
13
|
+
For,
|
|
14
|
+
Match,
|
|
15
|
+
Show,
|
|
16
|
+
Suspense,
|
|
17
|
+
Switch,
|
|
18
|
+
createComponent,
|
|
19
|
+
createRenderEffect as effect,
|
|
20
|
+
getOwner,
|
|
21
|
+
createMemo as memo,
|
|
22
|
+
merge as mergeProps,
|
|
23
|
+
untrack
|
|
24
|
+
} from "solid-js";
|
|
3
25
|
|
|
4
|
-
const booleans = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
26
|
+
const booleans = [
|
|
27
|
+
"allowfullscreen",
|
|
28
|
+
"async",
|
|
29
|
+
"autofocus",
|
|
30
|
+
"autoplay",
|
|
31
|
+
"checked",
|
|
32
|
+
"controls",
|
|
33
|
+
"default",
|
|
34
|
+
"disabled",
|
|
35
|
+
"formnovalidate",
|
|
36
|
+
"hidden",
|
|
37
|
+
"indeterminate",
|
|
38
|
+
"inert",
|
|
39
|
+
"ismap",
|
|
40
|
+
"loop",
|
|
41
|
+
"multiple",
|
|
42
|
+
"muted",
|
|
43
|
+
"nomodule",
|
|
44
|
+
"novalidate",
|
|
45
|
+
"open",
|
|
46
|
+
"playsinline",
|
|
47
|
+
"readonly",
|
|
48
|
+
"required",
|
|
49
|
+
"reversed",
|
|
50
|
+
"seamless",
|
|
51
|
+
"selected"
|
|
52
|
+
];
|
|
53
|
+
const Properties = /*#__PURE__*/ new Set([
|
|
54
|
+
"value",
|
|
55
|
+
"readOnly",
|
|
56
|
+
"formNoValidate",
|
|
57
|
+
"isMap",
|
|
58
|
+
"noModule",
|
|
59
|
+
"playsInline",
|
|
60
|
+
...booleans
|
|
61
|
+
]);
|
|
62
|
+
const ChildProperties = /*#__PURE__*/ new Set([
|
|
63
|
+
"innerHTML",
|
|
64
|
+
"textContent",
|
|
65
|
+
"innerText",
|
|
66
|
+
"children"
|
|
67
|
+
]);
|
|
68
|
+
const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
8
69
|
class: "className",
|
|
9
70
|
formnovalidate: {
|
|
10
71
|
$: "formNoValidate",
|
|
@@ -31,19 +92,396 @@ const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
|
31
92
|
});
|
|
32
93
|
function getPropAlias(prop, tagName) {
|
|
33
94
|
const a = PropAliases[prop];
|
|
34
|
-
return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
|
|
35
|
-
}
|
|
36
|
-
const DelegatedEvents = /*#__PURE__*/new Set([
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
95
|
+
return typeof a === "object" ? (a[tagName] ? a["$"] : undefined) : a;
|
|
96
|
+
}
|
|
97
|
+
const DelegatedEvents = /*#__PURE__*/ new Set([
|
|
98
|
+
"beforeinput",
|
|
99
|
+
"click",
|
|
100
|
+
"dblclick",
|
|
101
|
+
"contextmenu",
|
|
102
|
+
"focusin",
|
|
103
|
+
"focusout",
|
|
104
|
+
"input",
|
|
105
|
+
"keydown",
|
|
106
|
+
"keyup",
|
|
107
|
+
"mousedown",
|
|
108
|
+
"mousemove",
|
|
109
|
+
"mouseout",
|
|
110
|
+
"mouseover",
|
|
111
|
+
"mouseup",
|
|
112
|
+
"pointerdown",
|
|
113
|
+
"pointermove",
|
|
114
|
+
"pointerout",
|
|
115
|
+
"pointerover",
|
|
116
|
+
"pointerup",
|
|
117
|
+
"touchend",
|
|
118
|
+
"touchmove",
|
|
119
|
+
"touchstart"
|
|
120
|
+
]);
|
|
121
|
+
const SVGElements = /*#__PURE__*/ new Set([
|
|
122
|
+
"altGlyph",
|
|
123
|
+
"altGlyphDef",
|
|
124
|
+
"altGlyphItem",
|
|
125
|
+
"animate",
|
|
126
|
+
"animateColor",
|
|
127
|
+
"animateMotion",
|
|
128
|
+
"animateTransform",
|
|
129
|
+
"circle",
|
|
130
|
+
"clipPath",
|
|
131
|
+
"color-profile",
|
|
132
|
+
"cursor",
|
|
133
|
+
"defs",
|
|
134
|
+
"desc",
|
|
135
|
+
"ellipse",
|
|
136
|
+
"feBlend",
|
|
137
|
+
"feColorMatrix",
|
|
138
|
+
"feComponentTransfer",
|
|
139
|
+
"feComposite",
|
|
140
|
+
"feConvolveMatrix",
|
|
141
|
+
"feDiffuseLighting",
|
|
142
|
+
"feDisplacementMap",
|
|
143
|
+
"feDistantLight",
|
|
144
|
+
"feDropShadow",
|
|
145
|
+
"feFlood",
|
|
146
|
+
"feFuncA",
|
|
147
|
+
"feFuncB",
|
|
148
|
+
"feFuncG",
|
|
149
|
+
"feFuncR",
|
|
150
|
+
"feGaussianBlur",
|
|
151
|
+
"feImage",
|
|
152
|
+
"feMerge",
|
|
153
|
+
"feMergeNode",
|
|
154
|
+
"feMorphology",
|
|
155
|
+
"feOffset",
|
|
156
|
+
"fePointLight",
|
|
157
|
+
"feSpecularLighting",
|
|
158
|
+
"feSpotLight",
|
|
159
|
+
"feTile",
|
|
160
|
+
"feTurbulence",
|
|
161
|
+
"filter",
|
|
162
|
+
"font",
|
|
163
|
+
"font-face",
|
|
164
|
+
"font-face-format",
|
|
165
|
+
"font-face-name",
|
|
166
|
+
"font-face-src",
|
|
167
|
+
"font-face-uri",
|
|
168
|
+
"foreignObject",
|
|
169
|
+
"g",
|
|
170
|
+
"glyph",
|
|
171
|
+
"glyphRef",
|
|
172
|
+
"hkern",
|
|
173
|
+
"image",
|
|
174
|
+
"line",
|
|
175
|
+
"linearGradient",
|
|
176
|
+
"marker",
|
|
177
|
+
"mask",
|
|
178
|
+
"metadata",
|
|
179
|
+
"missing-glyph",
|
|
180
|
+
"mpath",
|
|
181
|
+
"path",
|
|
182
|
+
"pattern",
|
|
183
|
+
"polygon",
|
|
184
|
+
"polyline",
|
|
185
|
+
"radialGradient",
|
|
186
|
+
"rect",
|
|
187
|
+
"set",
|
|
188
|
+
"stop",
|
|
189
|
+
"svg",
|
|
190
|
+
"switch",
|
|
191
|
+
"symbol",
|
|
192
|
+
"text",
|
|
193
|
+
"textPath",
|
|
194
|
+
"tref",
|
|
195
|
+
"tspan",
|
|
196
|
+
"use",
|
|
197
|
+
"view",
|
|
198
|
+
"vkern"
|
|
199
|
+
]);
|
|
42
200
|
const SVGNamespace = {
|
|
43
201
|
xlink: "http://www.w3.org/1999/xlink",
|
|
44
202
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
45
203
|
};
|
|
46
|
-
const DOMElements = /*#__PURE__*/new Set([
|
|
204
|
+
const DOMElements = /*#__PURE__*/ new Set([
|
|
205
|
+
"html",
|
|
206
|
+
"base",
|
|
207
|
+
"head",
|
|
208
|
+
"link",
|
|
209
|
+
"meta",
|
|
210
|
+
"style",
|
|
211
|
+
"title",
|
|
212
|
+
"body",
|
|
213
|
+
"address",
|
|
214
|
+
"article",
|
|
215
|
+
"aside",
|
|
216
|
+
"footer",
|
|
217
|
+
"header",
|
|
218
|
+
"main",
|
|
219
|
+
"nav",
|
|
220
|
+
"section",
|
|
221
|
+
"body",
|
|
222
|
+
"blockquote",
|
|
223
|
+
"dd",
|
|
224
|
+
"div",
|
|
225
|
+
"dl",
|
|
226
|
+
"dt",
|
|
227
|
+
"figcaption",
|
|
228
|
+
"figure",
|
|
229
|
+
"hr",
|
|
230
|
+
"li",
|
|
231
|
+
"ol",
|
|
232
|
+
"p",
|
|
233
|
+
"pre",
|
|
234
|
+
"ul",
|
|
235
|
+
"a",
|
|
236
|
+
"abbr",
|
|
237
|
+
"b",
|
|
238
|
+
"bdi",
|
|
239
|
+
"bdo",
|
|
240
|
+
"br",
|
|
241
|
+
"cite",
|
|
242
|
+
"code",
|
|
243
|
+
"data",
|
|
244
|
+
"dfn",
|
|
245
|
+
"em",
|
|
246
|
+
"i",
|
|
247
|
+
"kbd",
|
|
248
|
+
"mark",
|
|
249
|
+
"q",
|
|
250
|
+
"rp",
|
|
251
|
+
"rt",
|
|
252
|
+
"ruby",
|
|
253
|
+
"s",
|
|
254
|
+
"samp",
|
|
255
|
+
"small",
|
|
256
|
+
"span",
|
|
257
|
+
"strong",
|
|
258
|
+
"sub",
|
|
259
|
+
"sup",
|
|
260
|
+
"time",
|
|
261
|
+
"u",
|
|
262
|
+
"var",
|
|
263
|
+
"wbr",
|
|
264
|
+
"area",
|
|
265
|
+
"audio",
|
|
266
|
+
"img",
|
|
267
|
+
"map",
|
|
268
|
+
"track",
|
|
269
|
+
"video",
|
|
270
|
+
"embed",
|
|
271
|
+
"iframe",
|
|
272
|
+
"object",
|
|
273
|
+
"param",
|
|
274
|
+
"picture",
|
|
275
|
+
"portal",
|
|
276
|
+
"source",
|
|
277
|
+
"svg",
|
|
278
|
+
"math",
|
|
279
|
+
"canvas",
|
|
280
|
+
"noscript",
|
|
281
|
+
"script",
|
|
282
|
+
"del",
|
|
283
|
+
"ins",
|
|
284
|
+
"caption",
|
|
285
|
+
"col",
|
|
286
|
+
"colgroup",
|
|
287
|
+
"table",
|
|
288
|
+
"tbody",
|
|
289
|
+
"td",
|
|
290
|
+
"tfoot",
|
|
291
|
+
"th",
|
|
292
|
+
"thead",
|
|
293
|
+
"tr",
|
|
294
|
+
"button",
|
|
295
|
+
"datalist",
|
|
296
|
+
"fieldset",
|
|
297
|
+
"form",
|
|
298
|
+
"input",
|
|
299
|
+
"label",
|
|
300
|
+
"legend",
|
|
301
|
+
"meter",
|
|
302
|
+
"optgroup",
|
|
303
|
+
"option",
|
|
304
|
+
"output",
|
|
305
|
+
"progress",
|
|
306
|
+
"select",
|
|
307
|
+
"textarea",
|
|
308
|
+
"details",
|
|
309
|
+
"dialog",
|
|
310
|
+
"menu",
|
|
311
|
+
"summary",
|
|
312
|
+
"details",
|
|
313
|
+
"slot",
|
|
314
|
+
"template",
|
|
315
|
+
"acronym",
|
|
316
|
+
"applet",
|
|
317
|
+
"basefont",
|
|
318
|
+
"bgsound",
|
|
319
|
+
"big",
|
|
320
|
+
"blink",
|
|
321
|
+
"center",
|
|
322
|
+
"content",
|
|
323
|
+
"dir",
|
|
324
|
+
"font",
|
|
325
|
+
"frame",
|
|
326
|
+
"frameset",
|
|
327
|
+
"hgroup",
|
|
328
|
+
"image",
|
|
329
|
+
"keygen",
|
|
330
|
+
"marquee",
|
|
331
|
+
"menuitem",
|
|
332
|
+
"nobr",
|
|
333
|
+
"noembed",
|
|
334
|
+
"noframes",
|
|
335
|
+
"plaintext",
|
|
336
|
+
"rb",
|
|
337
|
+
"rtc",
|
|
338
|
+
"shadow",
|
|
339
|
+
"spacer",
|
|
340
|
+
"strike",
|
|
341
|
+
"tt",
|
|
342
|
+
"xmp",
|
|
343
|
+
"a",
|
|
344
|
+
"abbr",
|
|
345
|
+
"acronym",
|
|
346
|
+
"address",
|
|
347
|
+
"applet",
|
|
348
|
+
"area",
|
|
349
|
+
"article",
|
|
350
|
+
"aside",
|
|
351
|
+
"audio",
|
|
352
|
+
"b",
|
|
353
|
+
"base",
|
|
354
|
+
"basefont",
|
|
355
|
+
"bdi",
|
|
356
|
+
"bdo",
|
|
357
|
+
"bgsound",
|
|
358
|
+
"big",
|
|
359
|
+
"blink",
|
|
360
|
+
"blockquote",
|
|
361
|
+
"body",
|
|
362
|
+
"br",
|
|
363
|
+
"button",
|
|
364
|
+
"canvas",
|
|
365
|
+
"caption",
|
|
366
|
+
"center",
|
|
367
|
+
"cite",
|
|
368
|
+
"code",
|
|
369
|
+
"col",
|
|
370
|
+
"colgroup",
|
|
371
|
+
"content",
|
|
372
|
+
"data",
|
|
373
|
+
"datalist",
|
|
374
|
+
"dd",
|
|
375
|
+
"del",
|
|
376
|
+
"details",
|
|
377
|
+
"dfn",
|
|
378
|
+
"dialog",
|
|
379
|
+
"dir",
|
|
380
|
+
"div",
|
|
381
|
+
"dl",
|
|
382
|
+
"dt",
|
|
383
|
+
"em",
|
|
384
|
+
"embed",
|
|
385
|
+
"fieldset",
|
|
386
|
+
"figcaption",
|
|
387
|
+
"figure",
|
|
388
|
+
"font",
|
|
389
|
+
"footer",
|
|
390
|
+
"form",
|
|
391
|
+
"frame",
|
|
392
|
+
"frameset",
|
|
393
|
+
"head",
|
|
394
|
+
"header",
|
|
395
|
+
"hgroup",
|
|
396
|
+
"hr",
|
|
397
|
+
"html",
|
|
398
|
+
"i",
|
|
399
|
+
"iframe",
|
|
400
|
+
"image",
|
|
401
|
+
"img",
|
|
402
|
+
"input",
|
|
403
|
+
"ins",
|
|
404
|
+
"kbd",
|
|
405
|
+
"keygen",
|
|
406
|
+
"label",
|
|
407
|
+
"legend",
|
|
408
|
+
"li",
|
|
409
|
+
"link",
|
|
410
|
+
"main",
|
|
411
|
+
"map",
|
|
412
|
+
"mark",
|
|
413
|
+
"marquee",
|
|
414
|
+
"menu",
|
|
415
|
+
"menuitem",
|
|
416
|
+
"meta",
|
|
417
|
+
"meter",
|
|
418
|
+
"nav",
|
|
419
|
+
"nobr",
|
|
420
|
+
"noembed",
|
|
421
|
+
"noframes",
|
|
422
|
+
"noscript",
|
|
423
|
+
"object",
|
|
424
|
+
"ol",
|
|
425
|
+
"optgroup",
|
|
426
|
+
"option",
|
|
427
|
+
"output",
|
|
428
|
+
"p",
|
|
429
|
+
"param",
|
|
430
|
+
"picture",
|
|
431
|
+
"plaintext",
|
|
432
|
+
"portal",
|
|
433
|
+
"pre",
|
|
434
|
+
"progress",
|
|
435
|
+
"q",
|
|
436
|
+
"rb",
|
|
437
|
+
"rp",
|
|
438
|
+
"rt",
|
|
439
|
+
"rtc",
|
|
440
|
+
"ruby",
|
|
441
|
+
"s",
|
|
442
|
+
"samp",
|
|
443
|
+
"script",
|
|
444
|
+
"section",
|
|
445
|
+
"select",
|
|
446
|
+
"shadow",
|
|
447
|
+
"slot",
|
|
448
|
+
"small",
|
|
449
|
+
"source",
|
|
450
|
+
"spacer",
|
|
451
|
+
"span",
|
|
452
|
+
"strike",
|
|
453
|
+
"strong",
|
|
454
|
+
"style",
|
|
455
|
+
"sub",
|
|
456
|
+
"summary",
|
|
457
|
+
"sup",
|
|
458
|
+
"table",
|
|
459
|
+
"tbody",
|
|
460
|
+
"td",
|
|
461
|
+
"template",
|
|
462
|
+
"textarea",
|
|
463
|
+
"tfoot",
|
|
464
|
+
"th",
|
|
465
|
+
"thead",
|
|
466
|
+
"time",
|
|
467
|
+
"title",
|
|
468
|
+
"tr",
|
|
469
|
+
"track",
|
|
470
|
+
"tt",
|
|
471
|
+
"u",
|
|
472
|
+
"ul",
|
|
473
|
+
"var",
|
|
474
|
+
"video",
|
|
475
|
+
"wbr",
|
|
476
|
+
"xmp",
|
|
477
|
+
"input",
|
|
478
|
+
"h1",
|
|
479
|
+
"h2",
|
|
480
|
+
"h3",
|
|
481
|
+
"h4",
|
|
482
|
+
"h5",
|
|
483
|
+
"h6"
|
|
484
|
+
]);
|
|
47
485
|
|
|
48
486
|
function reconcileArrays(parentNode, a, b) {
|
|
49
487
|
let bLength = b.length,
|
|
@@ -64,7 +502,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
64
502
|
bEnd--;
|
|
65
503
|
}
|
|
66
504
|
if (aEnd === aStart) {
|
|
67
|
-
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
505
|
+
const node = bEnd < bLength ? (bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart]) : after;
|
|
68
506
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
69
507
|
} else if (bEnd === bStart) {
|
|
70
508
|
while (aStart < aEnd) {
|
|
@@ -107,7 +545,9 @@ function render(code, element, init, options = {}) {
|
|
|
107
545
|
let disposer;
|
|
108
546
|
createRoot(dispose => {
|
|
109
547
|
disposer = dispose;
|
|
110
|
-
element === document
|
|
548
|
+
element === document
|
|
549
|
+
? code()
|
|
550
|
+
: insert(element, code(), element.firstChild ? null : undefined, init);
|
|
111
551
|
}, options.owner);
|
|
112
552
|
return () => {
|
|
113
553
|
disposer();
|
|
@@ -117,11 +557,15 @@ function render(code, element, init, options = {}) {
|
|
|
117
557
|
function template(html, isImportNode, isSVG, isMathML) {
|
|
118
558
|
let node;
|
|
119
559
|
const create = () => {
|
|
120
|
-
const t = isMathML
|
|
560
|
+
const t = isMathML
|
|
561
|
+
? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template")
|
|
562
|
+
: document.createElement("template");
|
|
121
563
|
t.innerHTML = html;
|
|
122
564
|
return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
|
|
123
565
|
};
|
|
124
|
-
return isImportNode
|
|
566
|
+
return isImportNode
|
|
567
|
+
? () => untrack(() => document.importNode(node || (node = create()), true))
|
|
568
|
+
: () => (node || (node = create())).cloneNode(true);
|
|
125
569
|
}
|
|
126
570
|
function delegateEvents(eventNames, document = window.document) {
|
|
127
571
|
const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
|
|
@@ -143,10 +587,12 @@ function setProperty(node, name, value) {
|
|
|
143
587
|
node[name] = value;
|
|
144
588
|
}
|
|
145
589
|
function setAttribute(node, name, value) {
|
|
146
|
-
if (value == null) node.removeAttribute(name);
|
|
590
|
+
if (value == null) node.removeAttribute(name);
|
|
591
|
+
else node.setAttribute(name, value);
|
|
147
592
|
}
|
|
148
593
|
function setAttributeNS(node, namespace, name, value) {
|
|
149
|
-
if (value == null) node.removeAttributeNS(namespace, name);
|
|
594
|
+
if (value == null) node.removeAttributeNS(namespace, name);
|
|
595
|
+
else node.setAttributeNS(namespace, name, value);
|
|
150
596
|
}
|
|
151
597
|
function setBoolAttribute(node, name, value) {
|
|
152
598
|
if (isHydrating(node)) return;
|
|
@@ -158,7 +604,7 @@ function className(node, value, isSVG, prev) {
|
|
|
158
604
|
return;
|
|
159
605
|
}
|
|
160
606
|
if (typeof value === "string") {
|
|
161
|
-
value !== prev && (isSVG ? node.setAttribute("class", value) : node.className = value);
|
|
607
|
+
value !== prev && (isSVG ? node.setAttribute("class", value) : (node.className = value));
|
|
162
608
|
return;
|
|
163
609
|
}
|
|
164
610
|
if (typeof prev === "string") {
|
|
@@ -189,7 +635,7 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
189
635
|
} else node[`$$${name}`] = handler;
|
|
190
636
|
} else if (Array.isArray(handler)) {
|
|
191
637
|
const handlerFn = handler[0];
|
|
192
|
-
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
638
|
+
node.addEventListener(name, (handler[0] = e => handlerFn.call(node, handler[1], e)));
|
|
193
639
|
} else node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
194
640
|
}
|
|
195
641
|
function style(node, value, prev) {
|
|
@@ -198,7 +644,7 @@ function style(node, value, prev) {
|
|
|
198
644
|
return;
|
|
199
645
|
}
|
|
200
646
|
const nodeStyle = node.style;
|
|
201
|
-
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
647
|
+
if (typeof value === "string") return (nodeStyle.cssText = value);
|
|
202
648
|
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
203
649
|
prev || (prev = {});
|
|
204
650
|
value || (value = {});
|
|
@@ -213,20 +659,29 @@ function style(node, value, prev) {
|
|
|
213
659
|
function spread(node, props = {}, isSVG, skipChildren) {
|
|
214
660
|
const prevProps = {};
|
|
215
661
|
if (!skipChildren) {
|
|
216
|
-
createRenderEffect(
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
662
|
+
createRenderEffect(
|
|
663
|
+
() => normalize(props.children, prevProps.children),
|
|
664
|
+
value => {
|
|
665
|
+
insertExpression(node, value, prevProps.children);
|
|
666
|
+
prevProps.children = value;
|
|
667
|
+
}
|
|
668
|
+
);
|
|
220
669
|
}
|
|
221
|
-
createRenderEffect(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
670
|
+
createRenderEffect(
|
|
671
|
+
() => typeof props.ref === "function" && use(props.ref, node),
|
|
672
|
+
() => {}
|
|
673
|
+
);
|
|
674
|
+
createRenderEffect(
|
|
675
|
+
() => {
|
|
676
|
+
const newProps = {};
|
|
677
|
+
for (const prop in props) {
|
|
678
|
+
if (prop === "children" || prop === "ref") continue;
|
|
679
|
+
newProps[prop] = props[prop];
|
|
680
|
+
}
|
|
681
|
+
return newProps;
|
|
682
|
+
},
|
|
683
|
+
props => assign(node, props, isSVG, true, prevProps, true)
|
|
684
|
+
);
|
|
230
685
|
return prevProps;
|
|
231
686
|
}
|
|
232
687
|
function dynamicProperty(props, key) {
|
|
@@ -249,7 +704,11 @@ function insert(parent, accessor, marker, initial) {
|
|
|
249
704
|
accessor = normalize(accessor, initial, multi, true);
|
|
250
705
|
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
251
706
|
}
|
|
252
|
-
createRenderEffect(
|
|
707
|
+
createRenderEffect(
|
|
708
|
+
prev => normalize(accessor, prev, multi),
|
|
709
|
+
(value, current) => insertExpression(parent, value, current, marker),
|
|
710
|
+
initial
|
|
711
|
+
);
|
|
253
712
|
}
|
|
254
713
|
function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
|
|
255
714
|
props || (props = {});
|
|
@@ -291,7 +750,7 @@ function getNextElement(template) {
|
|
|
291
750
|
let node,
|
|
292
751
|
key,
|
|
293
752
|
hydrating = isHydrating();
|
|
294
|
-
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
753
|
+
if (!hydrating || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
|
|
295
754
|
return template();
|
|
296
755
|
}
|
|
297
756
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
@@ -310,7 +769,8 @@ function getNextMarker(start) {
|
|
|
310
769
|
while (end) {
|
|
311
770
|
if (end.nodeType === 8) {
|
|
312
771
|
const v = end.nodeValue;
|
|
313
|
-
if (v === "$") count++;
|
|
772
|
+
if (v === "$") count++;
|
|
773
|
+
else if (v === "/") {
|
|
314
774
|
if (count === 0) return [end, current];
|
|
315
775
|
count--;
|
|
316
776
|
}
|
|
@@ -324,10 +784,7 @@ function getNextMarker(start) {
|
|
|
324
784
|
function runHydrationEvents() {
|
|
325
785
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
326
786
|
queueMicrotask(() => {
|
|
327
|
-
const {
|
|
328
|
-
completed,
|
|
329
|
-
events
|
|
330
|
-
} = sharedConfig;
|
|
787
|
+
const { completed, events } = sharedConfig;
|
|
331
788
|
if (!events) return;
|
|
332
789
|
events.queued = false;
|
|
333
790
|
while (events.length) {
|
|
@@ -349,19 +806,25 @@ function isHydrating(node) {
|
|
|
349
806
|
}
|
|
350
807
|
function toggleClassKey(node, key, value) {
|
|
351
808
|
const classNames = key.trim().split(/\s+/);
|
|
352
|
-
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
809
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
810
|
+
node.classList.toggle(classNames[i], value);
|
|
353
811
|
}
|
|
354
812
|
function classListToObject(classList) {
|
|
355
813
|
if (Array.isArray(classList)) {
|
|
356
814
|
const result = {};
|
|
357
|
-
|
|
358
|
-
const key = classList[i];
|
|
359
|
-
if (typeof key === "object" && key != null) Object.assign(result, key);else if (key || key === 0) result[key] = true;
|
|
360
|
-
}
|
|
815
|
+
flattenClassList(classList, result);
|
|
361
816
|
return result;
|
|
362
817
|
}
|
|
363
818
|
return classList;
|
|
364
819
|
}
|
|
820
|
+
function flattenClassList(list, result) {
|
|
821
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
822
|
+
const item = list[i];
|
|
823
|
+
if (Array.isArray(item)) flattenClassList(item, result);
|
|
824
|
+
else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
825
|
+
else if (item || item === 0) result[item] = true;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
365
828
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
366
829
|
let propAlias, forceProp;
|
|
367
830
|
if (prop === "style") return style(node, value, prev), value;
|
|
@@ -388,11 +851,20 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
388
851
|
setAttribute(node, prop.slice(5), value);
|
|
389
852
|
} else if (prop.slice(0, 5) === "bool:") {
|
|
390
853
|
setBoolAttribute(node, prop.slice(5), value);
|
|
391
|
-
} else if (
|
|
392
|
-
|
|
854
|
+
} else if (
|
|
855
|
+
(forceProp = prop.slice(0, 5) === "prop:") ||
|
|
856
|
+
ChildProperties.has(prop) ||
|
|
857
|
+
(!isSVG && (propAlias = getPropAlias(prop, node.tagName))) ||
|
|
858
|
+
Properties.has(prop)
|
|
859
|
+
) {
|
|
860
|
+
if (forceProp) prop = prop.slice(5);
|
|
861
|
+
if (prop === "value" && node.nodeName === "SELECT")
|
|
862
|
+
queueMicrotask(() => (node.value = value)) || (node.value = value);
|
|
863
|
+
else node[propAlias || prop] = value;
|
|
393
864
|
} else {
|
|
394
865
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
395
|
-
if (ns) setAttributeNS(node, ns, prop, value);
|
|
866
|
+
if (ns) setAttributeNS(node, ns, prop, value);
|
|
867
|
+
else setAttribute(node, prop, value);
|
|
396
868
|
}
|
|
397
869
|
return value;
|
|
398
870
|
}
|
|
@@ -404,10 +876,11 @@ function eventHandler(e) {
|
|
|
404
876
|
const key = `$$${e.type}`;
|
|
405
877
|
const oriTarget = e.target;
|
|
406
878
|
const oriCurrentTarget = e.currentTarget;
|
|
407
|
-
const retarget = value =>
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
879
|
+
const retarget = value =>
|
|
880
|
+
Object.defineProperty(e, "target", {
|
|
881
|
+
configurable: true,
|
|
882
|
+
value
|
|
883
|
+
});
|
|
411
884
|
const handleNode = () => {
|
|
412
885
|
const handler = node[key];
|
|
413
886
|
if (handler && !node.disabled) {
|
|
@@ -415,7 +888,11 @@ function eventHandler(e) {
|
|
|
415
888
|
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
416
889
|
if (e.cancelBubble) return;
|
|
417
890
|
}
|
|
418
|
-
node.host &&
|
|
891
|
+
node.host &&
|
|
892
|
+
typeof node.host !== "string" &&
|
|
893
|
+
!node.host._$host &&
|
|
894
|
+
node.contains(e.target) &&
|
|
895
|
+
retarget(node.host);
|
|
419
896
|
return true;
|
|
420
897
|
};
|
|
421
898
|
const walkUpTree = () => {
|
|
@@ -443,8 +920,7 @@ function eventHandler(e) {
|
|
|
443
920
|
break;
|
|
444
921
|
}
|
|
445
922
|
}
|
|
446
|
-
}
|
|
447
|
-
else walkUpTree();
|
|
923
|
+
} else walkUpTree();
|
|
448
924
|
retarget(oriTarget);
|
|
449
925
|
}
|
|
450
926
|
function insertExpression(parent, value, current, marker) {
|
|
@@ -476,7 +952,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
476
952
|
current && cleanChildren(parent);
|
|
477
953
|
appendNodes(parent, value);
|
|
478
954
|
}
|
|
479
|
-
} else
|
|
955
|
+
} else;
|
|
480
956
|
}
|
|
481
957
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
482
958
|
value = flatten(value, {
|
|
@@ -484,13 +960,15 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
484
960
|
doNotUnwrap
|
|
485
961
|
});
|
|
486
962
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
487
|
-
if (multi &&
|
|
963
|
+
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
488
964
|
if (Array.isArray(value)) {
|
|
489
965
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
490
966
|
const item = value[i],
|
|
491
967
|
prev = current && current[i],
|
|
492
968
|
t = typeof item;
|
|
493
|
-
if (t === "string" || t === "number")
|
|
969
|
+
if (t === "string" || t === "number")
|
|
970
|
+
value[i] =
|
|
971
|
+
prev && prev.nodeType === 3 && prev.data === item ? prev : document.createTextNode(item);
|
|
494
972
|
}
|
|
495
973
|
}
|
|
496
974
|
return value;
|
|
@@ -499,14 +977,18 @@ function appendNodes(parent, array, marker = null) {
|
|
|
499
977
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
500
978
|
}
|
|
501
979
|
function cleanChildren(parent, current, marker, replacement) {
|
|
502
|
-
if (marker === undefined) return parent.textContent = "";
|
|
980
|
+
if (marker === undefined) return (parent.textContent = "");
|
|
503
981
|
if (current.length) {
|
|
504
982
|
let inserted = false;
|
|
505
983
|
for (let i = current.length - 1; i >= 0; i--) {
|
|
506
984
|
const el = current[i];
|
|
507
985
|
if (replacement !== el) {
|
|
508
986
|
const isParent = el.parentNode === parent;
|
|
509
|
-
if (replacement && !inserted && !i)
|
|
987
|
+
if (replacement && !inserted && !i)
|
|
988
|
+
isParent
|
|
989
|
+
? parent.replaceChild(replacement, el)
|
|
990
|
+
: parent.insertBefore(replacement, marker);
|
|
991
|
+
else isParent && el.remove();
|
|
510
992
|
} else inserted = true;
|
|
511
993
|
}
|
|
512
994
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
@@ -516,7 +998,8 @@ function gatherHydratable(element, root) {
|
|
|
516
998
|
for (let i = 0; i < templates.length; i++) {
|
|
517
999
|
const node = templates[i];
|
|
518
1000
|
const key = node.getAttribute("data-hk");
|
|
519
|
-
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1001
|
+
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1002
|
+
sharedConfig.registry.set(key, node);
|
|
520
1003
|
}
|
|
521
1004
|
}
|
|
522
1005
|
function getHydrationKey() {
|
|
@@ -569,18 +1052,21 @@ function Portal(props) {
|
|
|
569
1052
|
endMarker = document.createTextNode(""),
|
|
570
1053
|
mount = () => createElementProxy(props.mount || document.body, treeMarker);
|
|
571
1054
|
let content = createMemo(() => [startMarker, props.children]);
|
|
572
|
-
createRenderEffect(
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
1055
|
+
createRenderEffect(
|
|
1056
|
+
() => [mount(), content()],
|
|
1057
|
+
([m, c]) => {
|
|
1058
|
+
m.appendChild(endMarker);
|
|
1059
|
+
insert(m, c, endMarker);
|
|
1060
|
+
return () => {
|
|
1061
|
+
let c = startMarker;
|
|
1062
|
+
while (c && c !== endMarker) {
|
|
1063
|
+
const n = c.nextSibling;
|
|
1064
|
+
m.removeChild(c);
|
|
1065
|
+
c = n;
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
);
|
|
584
1070
|
return treeMarker;
|
|
585
1071
|
}
|
|
586
1072
|
function createElementProxy(el, marker) {
|
|
@@ -600,21 +1086,79 @@ function createElementProxy(el, marker) {
|
|
|
600
1086
|
}
|
|
601
1087
|
});
|
|
602
1088
|
}
|
|
603
|
-
function
|
|
604
|
-
const
|
|
605
|
-
const cached = createMemo(() => props.component);
|
|
1089
|
+
function createDynamic(component, props) {
|
|
1090
|
+
const cached = createMemo(component);
|
|
606
1091
|
return createMemo(() => {
|
|
607
1092
|
const component = cached();
|
|
608
1093
|
switch (typeof component) {
|
|
609
1094
|
case "function":
|
|
610
|
-
return untrack(() => component(
|
|
1095
|
+
return untrack(() => component(props));
|
|
611
1096
|
case "string":
|
|
612
1097
|
const isSvg = SVGElements.has(component);
|
|
613
1098
|
const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg);
|
|
614
|
-
spread(el,
|
|
1099
|
+
spread(el, props, isSvg);
|
|
615
1100
|
return el;
|
|
616
1101
|
}
|
|
617
1102
|
});
|
|
618
1103
|
}
|
|
1104
|
+
function Dynamic(props) {
|
|
1105
|
+
const others = omit(props, "component");
|
|
1106
|
+
return createDynamic(() => props.component, others);
|
|
1107
|
+
}
|
|
619
1108
|
|
|
620
|
-
export {
|
|
1109
|
+
export {
|
|
1110
|
+
voidFn as Assets,
|
|
1111
|
+
ChildProperties,
|
|
1112
|
+
DOMElements,
|
|
1113
|
+
DelegatedEvents,
|
|
1114
|
+
Dynamic,
|
|
1115
|
+
Hydration,
|
|
1116
|
+
voidFn as HydrationScript,
|
|
1117
|
+
NoHydration,
|
|
1118
|
+
Portal,
|
|
1119
|
+
Properties,
|
|
1120
|
+
RequestContext,
|
|
1121
|
+
SVGElements,
|
|
1122
|
+
SVGNamespace,
|
|
1123
|
+
addEventListener,
|
|
1124
|
+
assign,
|
|
1125
|
+
className,
|
|
1126
|
+
clearDelegatedEvents,
|
|
1127
|
+
createDynamic,
|
|
1128
|
+
delegateEvents,
|
|
1129
|
+
dynamicProperty,
|
|
1130
|
+
escape,
|
|
1131
|
+
voidFn as generateHydrationScript,
|
|
1132
|
+
voidFn as getAssets,
|
|
1133
|
+
getHydrationKey,
|
|
1134
|
+
getNextElement,
|
|
1135
|
+
getNextMarker,
|
|
1136
|
+
getNextMatch,
|
|
1137
|
+
getPropAlias,
|
|
1138
|
+
voidFn as getRequestEvent,
|
|
1139
|
+
hydrate,
|
|
1140
|
+
insert,
|
|
1141
|
+
isDev,
|
|
1142
|
+
isServer,
|
|
1143
|
+
render,
|
|
1144
|
+
renderToStream,
|
|
1145
|
+
renderToString,
|
|
1146
|
+
renderToStringAsync,
|
|
1147
|
+
resolveSSRNode,
|
|
1148
|
+
runHydrationEvents,
|
|
1149
|
+
setAttribute,
|
|
1150
|
+
setAttributeNS,
|
|
1151
|
+
setBoolAttribute,
|
|
1152
|
+
setProperty,
|
|
1153
|
+
spread,
|
|
1154
|
+
ssr,
|
|
1155
|
+
ssrAttribute,
|
|
1156
|
+
ssrClassList,
|
|
1157
|
+
ssrElement,
|
|
1158
|
+
ssrHydrationKey,
|
|
1159
|
+
ssrStyle,
|
|
1160
|
+
style,
|
|
1161
|
+
template,
|
|
1162
|
+
use,
|
|
1163
|
+
voidFn as useAssets
|
|
1164
|
+
};
|