@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/dev.js
CHANGED
|
@@ -1,10 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createRoot,
|
|
3
|
+
untrack,
|
|
4
|
+
createRenderEffect,
|
|
5
|
+
sharedConfig,
|
|
6
|
+
flatten,
|
|
7
|
+
enableHydration,
|
|
8
|
+
createMemo,
|
|
9
|
+
$DEVCOMP,
|
|
10
|
+
omit
|
|
11
|
+
} from "solid-js";
|
|
12
|
+
export {
|
|
13
|
+
ErrorBoundary,
|
|
14
|
+
For,
|
|
15
|
+
Match,
|
|
16
|
+
Show,
|
|
17
|
+
Suspense,
|
|
18
|
+
Switch,
|
|
19
|
+
createComponent,
|
|
20
|
+
createRenderEffect as effect,
|
|
21
|
+
getOwner,
|
|
22
|
+
createMemo as memo,
|
|
23
|
+
merge as mergeProps,
|
|
24
|
+
untrack
|
|
25
|
+
} from "solid-js";
|
|
3
26
|
|
|
4
|
-
const booleans = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
27
|
+
const booleans = [
|
|
28
|
+
"allowfullscreen",
|
|
29
|
+
"async",
|
|
30
|
+
"autofocus",
|
|
31
|
+
"autoplay",
|
|
32
|
+
"checked",
|
|
33
|
+
"controls",
|
|
34
|
+
"default",
|
|
35
|
+
"disabled",
|
|
36
|
+
"formnovalidate",
|
|
37
|
+
"hidden",
|
|
38
|
+
"indeterminate",
|
|
39
|
+
"inert",
|
|
40
|
+
"ismap",
|
|
41
|
+
"loop",
|
|
42
|
+
"multiple",
|
|
43
|
+
"muted",
|
|
44
|
+
"nomodule",
|
|
45
|
+
"novalidate",
|
|
46
|
+
"open",
|
|
47
|
+
"playsinline",
|
|
48
|
+
"readonly",
|
|
49
|
+
"required",
|
|
50
|
+
"reversed",
|
|
51
|
+
"seamless",
|
|
52
|
+
"selected"
|
|
53
|
+
];
|
|
54
|
+
const Properties = /*#__PURE__*/ new Set([
|
|
55
|
+
"value",
|
|
56
|
+
"readOnly",
|
|
57
|
+
"formNoValidate",
|
|
58
|
+
"isMap",
|
|
59
|
+
"noModule",
|
|
60
|
+
"playsInline",
|
|
61
|
+
...booleans
|
|
62
|
+
]);
|
|
63
|
+
const ChildProperties = /*#__PURE__*/ new Set([
|
|
64
|
+
"innerHTML",
|
|
65
|
+
"textContent",
|
|
66
|
+
"innerText",
|
|
67
|
+
"children"
|
|
68
|
+
]);
|
|
69
|
+
const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
8
70
|
class: "className",
|
|
9
71
|
formnovalidate: {
|
|
10
72
|
$: "formNoValidate",
|
|
@@ -31,19 +93,396 @@ const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
|
31
93
|
});
|
|
32
94
|
function getPropAlias(prop, tagName) {
|
|
33
95
|
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
|
-
"
|
|
96
|
+
return typeof a === "object" ? (a[tagName] ? a["$"] : undefined) : a;
|
|
97
|
+
}
|
|
98
|
+
const DelegatedEvents = /*#__PURE__*/ new Set([
|
|
99
|
+
"beforeinput",
|
|
100
|
+
"click",
|
|
101
|
+
"dblclick",
|
|
102
|
+
"contextmenu",
|
|
103
|
+
"focusin",
|
|
104
|
+
"focusout",
|
|
105
|
+
"input",
|
|
106
|
+
"keydown",
|
|
107
|
+
"keyup",
|
|
108
|
+
"mousedown",
|
|
109
|
+
"mousemove",
|
|
110
|
+
"mouseout",
|
|
111
|
+
"mouseover",
|
|
112
|
+
"mouseup",
|
|
113
|
+
"pointerdown",
|
|
114
|
+
"pointermove",
|
|
115
|
+
"pointerout",
|
|
116
|
+
"pointerover",
|
|
117
|
+
"pointerup",
|
|
118
|
+
"touchend",
|
|
119
|
+
"touchmove",
|
|
120
|
+
"touchstart"
|
|
121
|
+
]);
|
|
122
|
+
const SVGElements = /*#__PURE__*/ new Set([
|
|
123
|
+
"altGlyph",
|
|
124
|
+
"altGlyphDef",
|
|
125
|
+
"altGlyphItem",
|
|
126
|
+
"animate",
|
|
127
|
+
"animateColor",
|
|
128
|
+
"animateMotion",
|
|
129
|
+
"animateTransform",
|
|
130
|
+
"circle",
|
|
131
|
+
"clipPath",
|
|
132
|
+
"color-profile",
|
|
133
|
+
"cursor",
|
|
134
|
+
"defs",
|
|
135
|
+
"desc",
|
|
136
|
+
"ellipse",
|
|
137
|
+
"feBlend",
|
|
138
|
+
"feColorMatrix",
|
|
139
|
+
"feComponentTransfer",
|
|
140
|
+
"feComposite",
|
|
141
|
+
"feConvolveMatrix",
|
|
142
|
+
"feDiffuseLighting",
|
|
143
|
+
"feDisplacementMap",
|
|
144
|
+
"feDistantLight",
|
|
145
|
+
"feDropShadow",
|
|
146
|
+
"feFlood",
|
|
147
|
+
"feFuncA",
|
|
148
|
+
"feFuncB",
|
|
149
|
+
"feFuncG",
|
|
150
|
+
"feFuncR",
|
|
151
|
+
"feGaussianBlur",
|
|
152
|
+
"feImage",
|
|
153
|
+
"feMerge",
|
|
154
|
+
"feMergeNode",
|
|
155
|
+
"feMorphology",
|
|
156
|
+
"feOffset",
|
|
157
|
+
"fePointLight",
|
|
158
|
+
"feSpecularLighting",
|
|
159
|
+
"feSpotLight",
|
|
160
|
+
"feTile",
|
|
161
|
+
"feTurbulence",
|
|
162
|
+
"filter",
|
|
163
|
+
"font",
|
|
164
|
+
"font-face",
|
|
165
|
+
"font-face-format",
|
|
166
|
+
"font-face-name",
|
|
167
|
+
"font-face-src",
|
|
168
|
+
"font-face-uri",
|
|
169
|
+
"foreignObject",
|
|
170
|
+
"g",
|
|
171
|
+
"glyph",
|
|
172
|
+
"glyphRef",
|
|
173
|
+
"hkern",
|
|
174
|
+
"image",
|
|
175
|
+
"line",
|
|
176
|
+
"linearGradient",
|
|
177
|
+
"marker",
|
|
178
|
+
"mask",
|
|
179
|
+
"metadata",
|
|
180
|
+
"missing-glyph",
|
|
181
|
+
"mpath",
|
|
182
|
+
"path",
|
|
183
|
+
"pattern",
|
|
184
|
+
"polygon",
|
|
185
|
+
"polyline",
|
|
186
|
+
"radialGradient",
|
|
187
|
+
"rect",
|
|
188
|
+
"set",
|
|
189
|
+
"stop",
|
|
190
|
+
"svg",
|
|
191
|
+
"switch",
|
|
192
|
+
"symbol",
|
|
193
|
+
"text",
|
|
194
|
+
"textPath",
|
|
195
|
+
"tref",
|
|
196
|
+
"tspan",
|
|
197
|
+
"use",
|
|
198
|
+
"view",
|
|
199
|
+
"vkern"
|
|
200
|
+
]);
|
|
42
201
|
const SVGNamespace = {
|
|
43
202
|
xlink: "http://www.w3.org/1999/xlink",
|
|
44
203
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
45
204
|
};
|
|
46
|
-
const DOMElements = /*#__PURE__*/new Set([
|
|
205
|
+
const DOMElements = /*#__PURE__*/ new Set([
|
|
206
|
+
"html",
|
|
207
|
+
"base",
|
|
208
|
+
"head",
|
|
209
|
+
"link",
|
|
210
|
+
"meta",
|
|
211
|
+
"style",
|
|
212
|
+
"title",
|
|
213
|
+
"body",
|
|
214
|
+
"address",
|
|
215
|
+
"article",
|
|
216
|
+
"aside",
|
|
217
|
+
"footer",
|
|
218
|
+
"header",
|
|
219
|
+
"main",
|
|
220
|
+
"nav",
|
|
221
|
+
"section",
|
|
222
|
+
"body",
|
|
223
|
+
"blockquote",
|
|
224
|
+
"dd",
|
|
225
|
+
"div",
|
|
226
|
+
"dl",
|
|
227
|
+
"dt",
|
|
228
|
+
"figcaption",
|
|
229
|
+
"figure",
|
|
230
|
+
"hr",
|
|
231
|
+
"li",
|
|
232
|
+
"ol",
|
|
233
|
+
"p",
|
|
234
|
+
"pre",
|
|
235
|
+
"ul",
|
|
236
|
+
"a",
|
|
237
|
+
"abbr",
|
|
238
|
+
"b",
|
|
239
|
+
"bdi",
|
|
240
|
+
"bdo",
|
|
241
|
+
"br",
|
|
242
|
+
"cite",
|
|
243
|
+
"code",
|
|
244
|
+
"data",
|
|
245
|
+
"dfn",
|
|
246
|
+
"em",
|
|
247
|
+
"i",
|
|
248
|
+
"kbd",
|
|
249
|
+
"mark",
|
|
250
|
+
"q",
|
|
251
|
+
"rp",
|
|
252
|
+
"rt",
|
|
253
|
+
"ruby",
|
|
254
|
+
"s",
|
|
255
|
+
"samp",
|
|
256
|
+
"small",
|
|
257
|
+
"span",
|
|
258
|
+
"strong",
|
|
259
|
+
"sub",
|
|
260
|
+
"sup",
|
|
261
|
+
"time",
|
|
262
|
+
"u",
|
|
263
|
+
"var",
|
|
264
|
+
"wbr",
|
|
265
|
+
"area",
|
|
266
|
+
"audio",
|
|
267
|
+
"img",
|
|
268
|
+
"map",
|
|
269
|
+
"track",
|
|
270
|
+
"video",
|
|
271
|
+
"embed",
|
|
272
|
+
"iframe",
|
|
273
|
+
"object",
|
|
274
|
+
"param",
|
|
275
|
+
"picture",
|
|
276
|
+
"portal",
|
|
277
|
+
"source",
|
|
278
|
+
"svg",
|
|
279
|
+
"math",
|
|
280
|
+
"canvas",
|
|
281
|
+
"noscript",
|
|
282
|
+
"script",
|
|
283
|
+
"del",
|
|
284
|
+
"ins",
|
|
285
|
+
"caption",
|
|
286
|
+
"col",
|
|
287
|
+
"colgroup",
|
|
288
|
+
"table",
|
|
289
|
+
"tbody",
|
|
290
|
+
"td",
|
|
291
|
+
"tfoot",
|
|
292
|
+
"th",
|
|
293
|
+
"thead",
|
|
294
|
+
"tr",
|
|
295
|
+
"button",
|
|
296
|
+
"datalist",
|
|
297
|
+
"fieldset",
|
|
298
|
+
"form",
|
|
299
|
+
"input",
|
|
300
|
+
"label",
|
|
301
|
+
"legend",
|
|
302
|
+
"meter",
|
|
303
|
+
"optgroup",
|
|
304
|
+
"option",
|
|
305
|
+
"output",
|
|
306
|
+
"progress",
|
|
307
|
+
"select",
|
|
308
|
+
"textarea",
|
|
309
|
+
"details",
|
|
310
|
+
"dialog",
|
|
311
|
+
"menu",
|
|
312
|
+
"summary",
|
|
313
|
+
"details",
|
|
314
|
+
"slot",
|
|
315
|
+
"template",
|
|
316
|
+
"acronym",
|
|
317
|
+
"applet",
|
|
318
|
+
"basefont",
|
|
319
|
+
"bgsound",
|
|
320
|
+
"big",
|
|
321
|
+
"blink",
|
|
322
|
+
"center",
|
|
323
|
+
"content",
|
|
324
|
+
"dir",
|
|
325
|
+
"font",
|
|
326
|
+
"frame",
|
|
327
|
+
"frameset",
|
|
328
|
+
"hgroup",
|
|
329
|
+
"image",
|
|
330
|
+
"keygen",
|
|
331
|
+
"marquee",
|
|
332
|
+
"menuitem",
|
|
333
|
+
"nobr",
|
|
334
|
+
"noembed",
|
|
335
|
+
"noframes",
|
|
336
|
+
"plaintext",
|
|
337
|
+
"rb",
|
|
338
|
+
"rtc",
|
|
339
|
+
"shadow",
|
|
340
|
+
"spacer",
|
|
341
|
+
"strike",
|
|
342
|
+
"tt",
|
|
343
|
+
"xmp",
|
|
344
|
+
"a",
|
|
345
|
+
"abbr",
|
|
346
|
+
"acronym",
|
|
347
|
+
"address",
|
|
348
|
+
"applet",
|
|
349
|
+
"area",
|
|
350
|
+
"article",
|
|
351
|
+
"aside",
|
|
352
|
+
"audio",
|
|
353
|
+
"b",
|
|
354
|
+
"base",
|
|
355
|
+
"basefont",
|
|
356
|
+
"bdi",
|
|
357
|
+
"bdo",
|
|
358
|
+
"bgsound",
|
|
359
|
+
"big",
|
|
360
|
+
"blink",
|
|
361
|
+
"blockquote",
|
|
362
|
+
"body",
|
|
363
|
+
"br",
|
|
364
|
+
"button",
|
|
365
|
+
"canvas",
|
|
366
|
+
"caption",
|
|
367
|
+
"center",
|
|
368
|
+
"cite",
|
|
369
|
+
"code",
|
|
370
|
+
"col",
|
|
371
|
+
"colgroup",
|
|
372
|
+
"content",
|
|
373
|
+
"data",
|
|
374
|
+
"datalist",
|
|
375
|
+
"dd",
|
|
376
|
+
"del",
|
|
377
|
+
"details",
|
|
378
|
+
"dfn",
|
|
379
|
+
"dialog",
|
|
380
|
+
"dir",
|
|
381
|
+
"div",
|
|
382
|
+
"dl",
|
|
383
|
+
"dt",
|
|
384
|
+
"em",
|
|
385
|
+
"embed",
|
|
386
|
+
"fieldset",
|
|
387
|
+
"figcaption",
|
|
388
|
+
"figure",
|
|
389
|
+
"font",
|
|
390
|
+
"footer",
|
|
391
|
+
"form",
|
|
392
|
+
"frame",
|
|
393
|
+
"frameset",
|
|
394
|
+
"head",
|
|
395
|
+
"header",
|
|
396
|
+
"hgroup",
|
|
397
|
+
"hr",
|
|
398
|
+
"html",
|
|
399
|
+
"i",
|
|
400
|
+
"iframe",
|
|
401
|
+
"image",
|
|
402
|
+
"img",
|
|
403
|
+
"input",
|
|
404
|
+
"ins",
|
|
405
|
+
"kbd",
|
|
406
|
+
"keygen",
|
|
407
|
+
"label",
|
|
408
|
+
"legend",
|
|
409
|
+
"li",
|
|
410
|
+
"link",
|
|
411
|
+
"main",
|
|
412
|
+
"map",
|
|
413
|
+
"mark",
|
|
414
|
+
"marquee",
|
|
415
|
+
"menu",
|
|
416
|
+
"menuitem",
|
|
417
|
+
"meta",
|
|
418
|
+
"meter",
|
|
419
|
+
"nav",
|
|
420
|
+
"nobr",
|
|
421
|
+
"noembed",
|
|
422
|
+
"noframes",
|
|
423
|
+
"noscript",
|
|
424
|
+
"object",
|
|
425
|
+
"ol",
|
|
426
|
+
"optgroup",
|
|
427
|
+
"option",
|
|
428
|
+
"output",
|
|
429
|
+
"p",
|
|
430
|
+
"param",
|
|
431
|
+
"picture",
|
|
432
|
+
"plaintext",
|
|
433
|
+
"portal",
|
|
434
|
+
"pre",
|
|
435
|
+
"progress",
|
|
436
|
+
"q",
|
|
437
|
+
"rb",
|
|
438
|
+
"rp",
|
|
439
|
+
"rt",
|
|
440
|
+
"rtc",
|
|
441
|
+
"ruby",
|
|
442
|
+
"s",
|
|
443
|
+
"samp",
|
|
444
|
+
"script",
|
|
445
|
+
"section",
|
|
446
|
+
"select",
|
|
447
|
+
"shadow",
|
|
448
|
+
"slot",
|
|
449
|
+
"small",
|
|
450
|
+
"source",
|
|
451
|
+
"spacer",
|
|
452
|
+
"span",
|
|
453
|
+
"strike",
|
|
454
|
+
"strong",
|
|
455
|
+
"style",
|
|
456
|
+
"sub",
|
|
457
|
+
"summary",
|
|
458
|
+
"sup",
|
|
459
|
+
"table",
|
|
460
|
+
"tbody",
|
|
461
|
+
"td",
|
|
462
|
+
"template",
|
|
463
|
+
"textarea",
|
|
464
|
+
"tfoot",
|
|
465
|
+
"th",
|
|
466
|
+
"thead",
|
|
467
|
+
"time",
|
|
468
|
+
"title",
|
|
469
|
+
"tr",
|
|
470
|
+
"track",
|
|
471
|
+
"tt",
|
|
472
|
+
"u",
|
|
473
|
+
"ul",
|
|
474
|
+
"var",
|
|
475
|
+
"video",
|
|
476
|
+
"wbr",
|
|
477
|
+
"xmp",
|
|
478
|
+
"input",
|
|
479
|
+
"h1",
|
|
480
|
+
"h2",
|
|
481
|
+
"h3",
|
|
482
|
+
"h4",
|
|
483
|
+
"h5",
|
|
484
|
+
"h6"
|
|
485
|
+
]);
|
|
47
486
|
|
|
48
487
|
function reconcileArrays(parentNode, a, b) {
|
|
49
488
|
let bLength = b.length,
|
|
@@ -64,7 +503,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
64
503
|
bEnd--;
|
|
65
504
|
}
|
|
66
505
|
if (aEnd === aStart) {
|
|
67
|
-
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
506
|
+
const node = bEnd < bLength ? (bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart]) : after;
|
|
68
507
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
69
508
|
} else if (bEnd === bStart) {
|
|
70
509
|
while (aStart < aEnd) {
|
|
@@ -105,12 +544,16 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
105
544
|
const $$EVENTS = "_$DX_DELEGATE";
|
|
106
545
|
function render(code, element, init, options = {}) {
|
|
107
546
|
if (!element) {
|
|
108
|
-
throw new Error(
|
|
547
|
+
throw new Error(
|
|
548
|
+
"The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document."
|
|
549
|
+
);
|
|
109
550
|
}
|
|
110
551
|
let disposer;
|
|
111
552
|
createRoot(dispose => {
|
|
112
553
|
disposer = dispose;
|
|
113
|
-
element === document
|
|
554
|
+
element === document
|
|
555
|
+
? code()
|
|
556
|
+
: insert(element, code(), element.firstChild ? null : undefined, init);
|
|
114
557
|
}, options.owner);
|
|
115
558
|
return () => {
|
|
116
559
|
disposer();
|
|
@@ -120,12 +563,19 @@ function render(code, element, init, options = {}) {
|
|
|
120
563
|
function template(html, isImportNode, isSVG, isMathML) {
|
|
121
564
|
let node;
|
|
122
565
|
const create = () => {
|
|
123
|
-
if (isHydrating())
|
|
124
|
-
|
|
566
|
+
if (isHydrating())
|
|
567
|
+
throw new Error(
|
|
568
|
+
"Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration."
|
|
569
|
+
);
|
|
570
|
+
const t = isMathML
|
|
571
|
+
? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template")
|
|
572
|
+
: document.createElement("template");
|
|
125
573
|
t.innerHTML = html;
|
|
126
574
|
return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
|
|
127
575
|
};
|
|
128
|
-
return isImportNode
|
|
576
|
+
return isImportNode
|
|
577
|
+
? () => untrack(() => document.importNode(node || (node = create()), true))
|
|
578
|
+
: () => (node || (node = create())).cloneNode(true);
|
|
129
579
|
}
|
|
130
580
|
function delegateEvents(eventNames, document = window.document) {
|
|
131
581
|
const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
|
|
@@ -147,10 +597,12 @@ function setProperty(node, name, value) {
|
|
|
147
597
|
node[name] = value;
|
|
148
598
|
}
|
|
149
599
|
function setAttribute(node, name, value) {
|
|
150
|
-
if (value == null) node.removeAttribute(name);
|
|
600
|
+
if (value == null) node.removeAttribute(name);
|
|
601
|
+
else node.setAttribute(name, value);
|
|
151
602
|
}
|
|
152
603
|
function setAttributeNS(node, namespace, name, value) {
|
|
153
|
-
if (value == null) node.removeAttributeNS(namespace, name);
|
|
604
|
+
if (value == null) node.removeAttributeNS(namespace, name);
|
|
605
|
+
else node.setAttributeNS(namespace, name, value);
|
|
154
606
|
}
|
|
155
607
|
function setBoolAttribute(node, name, value) {
|
|
156
608
|
if (isHydrating(node)) return;
|
|
@@ -162,7 +614,7 @@ function className(node, value, isSVG, prev) {
|
|
|
162
614
|
return;
|
|
163
615
|
}
|
|
164
616
|
if (typeof value === "string") {
|
|
165
|
-
value !== prev && (isSVG ? node.setAttribute("class", value) : node.className = value);
|
|
617
|
+
value !== prev && (isSVG ? node.setAttribute("class", value) : (node.className = value));
|
|
166
618
|
return;
|
|
167
619
|
}
|
|
168
620
|
if (typeof prev === "string") {
|
|
@@ -193,7 +645,7 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
193
645
|
} else node[`$$${name}`] = handler;
|
|
194
646
|
} else if (Array.isArray(handler)) {
|
|
195
647
|
const handlerFn = handler[0];
|
|
196
|
-
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
648
|
+
node.addEventListener(name, (handler[0] = e => handlerFn.call(node, handler[1], e)));
|
|
197
649
|
} else node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
198
650
|
}
|
|
199
651
|
function style(node, value, prev) {
|
|
@@ -202,7 +654,7 @@ function style(node, value, prev) {
|
|
|
202
654
|
return;
|
|
203
655
|
}
|
|
204
656
|
const nodeStyle = node.style;
|
|
205
|
-
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
657
|
+
if (typeof value === "string") return (nodeStyle.cssText = value);
|
|
206
658
|
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
207
659
|
prev || (prev = {});
|
|
208
660
|
value || (value = {});
|
|
@@ -217,20 +669,29 @@ function style(node, value, prev) {
|
|
|
217
669
|
function spread(node, props = {}, isSVG, skipChildren) {
|
|
218
670
|
const prevProps = {};
|
|
219
671
|
if (!skipChildren) {
|
|
220
|
-
createRenderEffect(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
672
|
+
createRenderEffect(
|
|
673
|
+
() => normalize(props.children, prevProps.children),
|
|
674
|
+
value => {
|
|
675
|
+
insertExpression(node, value, prevProps.children);
|
|
676
|
+
prevProps.children = value;
|
|
677
|
+
}
|
|
678
|
+
);
|
|
224
679
|
}
|
|
225
|
-
createRenderEffect(
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
680
|
+
createRenderEffect(
|
|
681
|
+
() => typeof props.ref === "function" && use(props.ref, node),
|
|
682
|
+
() => {}
|
|
683
|
+
);
|
|
684
|
+
createRenderEffect(
|
|
685
|
+
() => {
|
|
686
|
+
const newProps = {};
|
|
687
|
+
for (const prop in props) {
|
|
688
|
+
if (prop === "children" || prop === "ref") continue;
|
|
689
|
+
newProps[prop] = props[prop];
|
|
690
|
+
}
|
|
691
|
+
return newProps;
|
|
692
|
+
},
|
|
693
|
+
props => assign(node, props, isSVG, true, prevProps, true)
|
|
694
|
+
);
|
|
234
695
|
return prevProps;
|
|
235
696
|
}
|
|
236
697
|
function dynamicProperty(props, key) {
|
|
@@ -253,7 +714,11 @@ function insert(parent, accessor, marker, initial) {
|
|
|
253
714
|
accessor = normalize(accessor, initial, multi, true);
|
|
254
715
|
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
255
716
|
}
|
|
256
|
-
createRenderEffect(
|
|
717
|
+
createRenderEffect(
|
|
718
|
+
prev => normalize(accessor, prev, multi),
|
|
719
|
+
(value, current) => insertExpression(parent, value, current, marker),
|
|
720
|
+
initial
|
|
721
|
+
);
|
|
257
722
|
}
|
|
258
723
|
function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
|
|
259
724
|
props || (props = {});
|
|
@@ -295,10 +760,14 @@ function getNextElement(template) {
|
|
|
295
760
|
let node,
|
|
296
761
|
key,
|
|
297
762
|
hydrating = isHydrating();
|
|
298
|
-
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
763
|
+
if (!hydrating || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
|
|
299
764
|
if (hydrating) {
|
|
300
765
|
sharedConfig.done = true;
|
|
301
|
-
throw new Error(
|
|
766
|
+
throw new Error(
|
|
767
|
+
`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}\n${
|
|
768
|
+
template ? template().outerHTML : ""
|
|
769
|
+
}`
|
|
770
|
+
);
|
|
302
771
|
}
|
|
303
772
|
return template();
|
|
304
773
|
}
|
|
@@ -318,7 +787,8 @@ function getNextMarker(start) {
|
|
|
318
787
|
while (end) {
|
|
319
788
|
if (end.nodeType === 8) {
|
|
320
789
|
const v = end.nodeValue;
|
|
321
|
-
if (v === "$") count++;
|
|
790
|
+
if (v === "$") count++;
|
|
791
|
+
else if (v === "/") {
|
|
322
792
|
if (count === 0) return [end, current];
|
|
323
793
|
count--;
|
|
324
794
|
}
|
|
@@ -332,10 +802,7 @@ function getNextMarker(start) {
|
|
|
332
802
|
function runHydrationEvents() {
|
|
333
803
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
334
804
|
queueMicrotask(() => {
|
|
335
|
-
const {
|
|
336
|
-
completed,
|
|
337
|
-
events
|
|
338
|
-
} = sharedConfig;
|
|
805
|
+
const { completed, events } = sharedConfig;
|
|
339
806
|
if (!events) return;
|
|
340
807
|
events.queued = false;
|
|
341
808
|
while (events.length) {
|
|
@@ -357,19 +824,25 @@ function isHydrating(node) {
|
|
|
357
824
|
}
|
|
358
825
|
function toggleClassKey(node, key, value) {
|
|
359
826
|
const classNames = key.trim().split(/\s+/);
|
|
360
|
-
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
827
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
828
|
+
node.classList.toggle(classNames[i], value);
|
|
361
829
|
}
|
|
362
830
|
function classListToObject(classList) {
|
|
363
831
|
if (Array.isArray(classList)) {
|
|
364
832
|
const result = {};
|
|
365
|
-
|
|
366
|
-
const key = classList[i];
|
|
367
|
-
if (typeof key === "object" && key != null) Object.assign(result, key);else if (key || key === 0) result[key] = true;
|
|
368
|
-
}
|
|
833
|
+
flattenClassList(classList, result);
|
|
369
834
|
return result;
|
|
370
835
|
}
|
|
371
836
|
return classList;
|
|
372
837
|
}
|
|
838
|
+
function flattenClassList(list, result) {
|
|
839
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
840
|
+
const item = list[i];
|
|
841
|
+
if (Array.isArray(item)) flattenClassList(item, result);
|
|
842
|
+
else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
843
|
+
else if (item || item === 0) result[item] = true;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
373
846
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
374
847
|
let propAlias, forceProp;
|
|
375
848
|
if (prop === "style") return style(node, value, prev), value;
|
|
@@ -396,11 +869,20 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
396
869
|
setAttribute(node, prop.slice(5), value);
|
|
397
870
|
} else if (prop.slice(0, 5) === "bool:") {
|
|
398
871
|
setBoolAttribute(node, prop.slice(5), value);
|
|
399
|
-
} else if (
|
|
400
|
-
|
|
872
|
+
} else if (
|
|
873
|
+
(forceProp = prop.slice(0, 5) === "prop:") ||
|
|
874
|
+
ChildProperties.has(prop) ||
|
|
875
|
+
(!isSVG && (propAlias = getPropAlias(prop, node.tagName))) ||
|
|
876
|
+
Properties.has(prop)
|
|
877
|
+
) {
|
|
878
|
+
if (forceProp) prop = prop.slice(5);
|
|
879
|
+
if (prop === "value" && node.nodeName === "SELECT")
|
|
880
|
+
queueMicrotask(() => (node.value = value)) || (node.value = value);
|
|
881
|
+
else node[propAlias || prop] = value;
|
|
401
882
|
} else {
|
|
402
883
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
403
|
-
if (ns) setAttributeNS(node, ns, prop, value);
|
|
884
|
+
if (ns) setAttributeNS(node, ns, prop, value);
|
|
885
|
+
else setAttribute(node, prop, value);
|
|
404
886
|
}
|
|
405
887
|
return value;
|
|
406
888
|
}
|
|
@@ -412,10 +894,11 @@ function eventHandler(e) {
|
|
|
412
894
|
const key = `$$${e.type}`;
|
|
413
895
|
const oriTarget = e.target;
|
|
414
896
|
const oriCurrentTarget = e.currentTarget;
|
|
415
|
-
const retarget = value =>
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
897
|
+
const retarget = value =>
|
|
898
|
+
Object.defineProperty(e, "target", {
|
|
899
|
+
configurable: true,
|
|
900
|
+
value
|
|
901
|
+
});
|
|
419
902
|
const handleNode = () => {
|
|
420
903
|
const handler = node[key];
|
|
421
904
|
if (handler && !node.disabled) {
|
|
@@ -423,7 +906,11 @@ function eventHandler(e) {
|
|
|
423
906
|
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
424
907
|
if (e.cancelBubble) return;
|
|
425
908
|
}
|
|
426
|
-
node.host &&
|
|
909
|
+
node.host &&
|
|
910
|
+
typeof node.host !== "string" &&
|
|
911
|
+
!node.host._$host &&
|
|
912
|
+
node.contains(e.target) &&
|
|
913
|
+
retarget(node.host);
|
|
427
914
|
return true;
|
|
428
915
|
};
|
|
429
916
|
const walkUpTree = () => {
|
|
@@ -451,8 +938,7 @@ function eventHandler(e) {
|
|
|
451
938
|
break;
|
|
452
939
|
}
|
|
453
940
|
}
|
|
454
|
-
}
|
|
455
|
-
else walkUpTree();
|
|
941
|
+
} else walkUpTree();
|
|
456
942
|
retarget(oriTarget);
|
|
457
943
|
}
|
|
458
944
|
function insertExpression(parent, value, current, marker) {
|
|
@@ -492,13 +978,15 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
492
978
|
doNotUnwrap
|
|
493
979
|
});
|
|
494
980
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
495
|
-
if (multi &&
|
|
981
|
+
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
496
982
|
if (Array.isArray(value)) {
|
|
497
983
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
498
984
|
const item = value[i],
|
|
499
985
|
prev = current && current[i],
|
|
500
986
|
t = typeof item;
|
|
501
|
-
if (t === "string" || t === "number")
|
|
987
|
+
if (t === "string" || t === "number")
|
|
988
|
+
value[i] =
|
|
989
|
+
prev && prev.nodeType === 3 && prev.data === item ? prev : document.createTextNode(item);
|
|
502
990
|
}
|
|
503
991
|
}
|
|
504
992
|
return value;
|
|
@@ -507,14 +995,18 @@ function appendNodes(parent, array, marker = null) {
|
|
|
507
995
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
508
996
|
}
|
|
509
997
|
function cleanChildren(parent, current, marker, replacement) {
|
|
510
|
-
if (marker === undefined) return parent.textContent = "";
|
|
998
|
+
if (marker === undefined) return (parent.textContent = "");
|
|
511
999
|
if (current.length) {
|
|
512
1000
|
let inserted = false;
|
|
513
1001
|
for (let i = current.length - 1; i >= 0; i--) {
|
|
514
1002
|
const el = current[i];
|
|
515
1003
|
if (replacement !== el) {
|
|
516
1004
|
const isParent = el.parentNode === parent;
|
|
517
|
-
if (replacement && !inserted && !i)
|
|
1005
|
+
if (replacement && !inserted && !i)
|
|
1006
|
+
isParent
|
|
1007
|
+
? parent.replaceChild(replacement, el)
|
|
1008
|
+
: parent.insertBefore(replacement, marker);
|
|
1009
|
+
else isParent && el.remove();
|
|
518
1010
|
} else inserted = true;
|
|
519
1011
|
}
|
|
520
1012
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
@@ -524,7 +1016,8 @@ function gatherHydratable(element, root) {
|
|
|
524
1016
|
for (let i = 0; i < templates.length; i++) {
|
|
525
1017
|
const node = templates[i];
|
|
526
1018
|
const key = node.getAttribute("data-hk");
|
|
527
|
-
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1019
|
+
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1020
|
+
sharedConfig.registry.set(key, node);
|
|
528
1021
|
}
|
|
529
1022
|
}
|
|
530
1023
|
function getHydrationKey() {
|
|
@@ -577,18 +1070,21 @@ function Portal(props) {
|
|
|
577
1070
|
endMarker = document.createTextNode(""),
|
|
578
1071
|
mount = () => createElementProxy(props.mount || document.body, treeMarker);
|
|
579
1072
|
let content = createMemo(() => [startMarker, props.children]);
|
|
580
|
-
createRenderEffect(
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
1073
|
+
createRenderEffect(
|
|
1074
|
+
() => [mount(), content()],
|
|
1075
|
+
([m, c]) => {
|
|
1076
|
+
m.appendChild(endMarker);
|
|
1077
|
+
insert(m, c, endMarker);
|
|
1078
|
+
return () => {
|
|
1079
|
+
let c = startMarker;
|
|
1080
|
+
while (c && c !== endMarker) {
|
|
1081
|
+
const n = c.nextSibling;
|
|
1082
|
+
m.removeChild(c);
|
|
1083
|
+
c = n;
|
|
1084
|
+
}
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
);
|
|
592
1088
|
return treeMarker;
|
|
593
1089
|
}
|
|
594
1090
|
function createElementProxy(el, marker) {
|
|
@@ -608,9 +1104,8 @@ function createElementProxy(el, marker) {
|
|
|
608
1104
|
}
|
|
609
1105
|
});
|
|
610
1106
|
}
|
|
611
|
-
function
|
|
612
|
-
const
|
|
613
|
-
const cached = createMemo(() => props.component);
|
|
1107
|
+
function createDynamic(component, props) {
|
|
1108
|
+
const cached = createMemo(component);
|
|
614
1109
|
return createMemo(() => {
|
|
615
1110
|
const component = cached();
|
|
616
1111
|
switch (typeof component) {
|
|
@@ -618,14 +1113,73 @@ function Dynamic(props) {
|
|
|
618
1113
|
Object.assign(component, {
|
|
619
1114
|
[$DEVCOMP]: true
|
|
620
1115
|
});
|
|
621
|
-
return untrack(() => component(
|
|
1116
|
+
return untrack(() => component(props));
|
|
622
1117
|
case "string":
|
|
623
1118
|
const isSvg = SVGElements.has(component);
|
|
624
1119
|
const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg);
|
|
625
|
-
spread(el,
|
|
1120
|
+
spread(el, props, isSvg);
|
|
626
1121
|
return el;
|
|
627
1122
|
}
|
|
628
1123
|
});
|
|
629
1124
|
}
|
|
1125
|
+
function Dynamic(props) {
|
|
1126
|
+
const others = omit(props, "component");
|
|
1127
|
+
return createDynamic(() => props.component, others);
|
|
1128
|
+
}
|
|
630
1129
|
|
|
631
|
-
export {
|
|
1130
|
+
export {
|
|
1131
|
+
voidFn as Assets,
|
|
1132
|
+
ChildProperties,
|
|
1133
|
+
DOMElements,
|
|
1134
|
+
DelegatedEvents,
|
|
1135
|
+
Dynamic,
|
|
1136
|
+
Hydration,
|
|
1137
|
+
voidFn as HydrationScript,
|
|
1138
|
+
NoHydration,
|
|
1139
|
+
Portal,
|
|
1140
|
+
Properties,
|
|
1141
|
+
RequestContext,
|
|
1142
|
+
SVGElements,
|
|
1143
|
+
SVGNamespace,
|
|
1144
|
+
addEventListener,
|
|
1145
|
+
assign,
|
|
1146
|
+
className,
|
|
1147
|
+
clearDelegatedEvents,
|
|
1148
|
+
createDynamic,
|
|
1149
|
+
delegateEvents,
|
|
1150
|
+
dynamicProperty,
|
|
1151
|
+
escape,
|
|
1152
|
+
voidFn as generateHydrationScript,
|
|
1153
|
+
voidFn as getAssets,
|
|
1154
|
+
getHydrationKey,
|
|
1155
|
+
getNextElement,
|
|
1156
|
+
getNextMarker,
|
|
1157
|
+
getNextMatch,
|
|
1158
|
+
getPropAlias,
|
|
1159
|
+
voidFn as getRequestEvent,
|
|
1160
|
+
hydrate,
|
|
1161
|
+
insert,
|
|
1162
|
+
isDev,
|
|
1163
|
+
isServer,
|
|
1164
|
+
render,
|
|
1165
|
+
renderToStream,
|
|
1166
|
+
renderToString,
|
|
1167
|
+
renderToStringAsync,
|
|
1168
|
+
resolveSSRNode,
|
|
1169
|
+
runHydrationEvents,
|
|
1170
|
+
setAttribute,
|
|
1171
|
+
setAttributeNS,
|
|
1172
|
+
setBoolAttribute,
|
|
1173
|
+
setProperty,
|
|
1174
|
+
spread,
|
|
1175
|
+
ssr,
|
|
1176
|
+
ssrAttribute,
|
|
1177
|
+
ssrClassList,
|
|
1178
|
+
ssrElement,
|
|
1179
|
+
ssrHydrationKey,
|
|
1180
|
+
ssrStyle,
|
|
1181
|
+
style,
|
|
1182
|
+
template,
|
|
1183
|
+
use,
|
|
1184
|
+
voidFn as useAssets
|
|
1185
|
+
};
|