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