solid-js 1.9.2 → 1.9.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/dist/dev.js +559 -318
- package/dist/server.js +168 -74
- package/dist/solid.js +486 -276
- package/h/dist/h.js +40 -9
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +11 -8
- package/h/jsx-runtime/types/jsx.d.ts +93 -91
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +219 -94
- package/html/types/lit.d.ts +52 -33
- package/package.json +1 -1
- package/store/dist/dev.js +123 -43
- package/store/dist/server.js +20 -8
- package/store/dist/store.js +114 -40
- package/store/types/index.d.ts +21 -7
- package/store/types/modifiers.d.ts +6 -3
- package/store/types/mutable.d.ts +5 -2
- package/store/types/server.d.ts +25 -5
- package/store/types/store.d.ts +218 -61
- package/types/index.d.ts +75 -10
- package/types/jsx.d.ts +143 -157
- 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 +233 -142
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +71 -35
- package/types/render/flow.d.ts +43 -31
- package/types/render/hydration.d.ts +15 -15
- package/types/server/index.d.ts +57 -2
- package/types/server/reactive.d.ts +73 -42
- package/types/server/rendering.d.ts +169 -98
- package/universal/dist/dev.js +28 -12
- package/universal/dist/universal.js +28 -12
- package/universal/types/index.d.ts +3 -1
- package/universal/types/universal.d.ts +0 -1
- package/web/dist/dev.js +639 -89
- package/web/dist/server.cjs +13 -10
- package/web/dist/server.js +653 -118
- package/web/dist/web.js +627 -87
- package/web/storage/dist/storage.js +3 -3
- package/web/types/client.d.ts +1 -1
- 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/types/server.d.ts +1 -1
package/web/dist/web.js
CHANGED
|
@@ -1,14 +1,82 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createRoot,
|
|
3
|
+
createRenderEffect,
|
|
4
|
+
untrack,
|
|
5
|
+
sharedConfig,
|
|
6
|
+
enableHydration,
|
|
7
|
+
getOwner,
|
|
8
|
+
createEffect,
|
|
9
|
+
runWithOwner,
|
|
10
|
+
createMemo,
|
|
11
|
+
createSignal,
|
|
12
|
+
onCleanup,
|
|
13
|
+
splitProps
|
|
14
|
+
} from "solid-js";
|
|
15
|
+
export {
|
|
16
|
+
ErrorBoundary,
|
|
17
|
+
For,
|
|
18
|
+
Index,
|
|
19
|
+
Match,
|
|
20
|
+
Show,
|
|
21
|
+
Suspense,
|
|
22
|
+
SuspenseList,
|
|
23
|
+
Switch,
|
|
24
|
+
createComponent,
|
|
25
|
+
createRenderEffect as effect,
|
|
26
|
+
getOwner,
|
|
27
|
+
createMemo as memo,
|
|
28
|
+
mergeProps,
|
|
29
|
+
untrack
|
|
30
|
+
} from "solid-js";
|
|
3
31
|
|
|
4
|
-
const booleans = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
32
|
+
const booleans = [
|
|
33
|
+
"allowfullscreen",
|
|
34
|
+
"async",
|
|
35
|
+
"autofocus",
|
|
36
|
+
"autoplay",
|
|
37
|
+
"checked",
|
|
38
|
+
"controls",
|
|
39
|
+
"default",
|
|
40
|
+
"disabled",
|
|
41
|
+
"formnovalidate",
|
|
42
|
+
"hidden",
|
|
43
|
+
"indeterminate",
|
|
44
|
+
"inert",
|
|
45
|
+
"ismap",
|
|
46
|
+
"loop",
|
|
47
|
+
"multiple",
|
|
48
|
+
"muted",
|
|
49
|
+
"nomodule",
|
|
50
|
+
"novalidate",
|
|
51
|
+
"open",
|
|
52
|
+
"playsinline",
|
|
53
|
+
"readonly",
|
|
54
|
+
"required",
|
|
55
|
+
"reversed",
|
|
56
|
+
"seamless",
|
|
57
|
+
"selected"
|
|
58
|
+
];
|
|
59
|
+
const Properties = /*#__PURE__*/ new Set([
|
|
60
|
+
"className",
|
|
61
|
+
"value",
|
|
62
|
+
"readOnly",
|
|
63
|
+
"formNoValidate",
|
|
64
|
+
"isMap",
|
|
65
|
+
"noModule",
|
|
66
|
+
"playsInline",
|
|
67
|
+
...booleans
|
|
68
|
+
]);
|
|
69
|
+
const ChildProperties = /*#__PURE__*/ new Set([
|
|
70
|
+
"innerHTML",
|
|
71
|
+
"textContent",
|
|
72
|
+
"innerText",
|
|
73
|
+
"children"
|
|
74
|
+
]);
|
|
75
|
+
const Aliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
8
76
|
className: "class",
|
|
9
77
|
htmlFor: "for"
|
|
10
78
|
});
|
|
11
|
-
const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
79
|
+
const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
|
|
12
80
|
class: "className",
|
|
13
81
|
formnovalidate: {
|
|
14
82
|
$: "formNoValidate",
|
|
@@ -35,19 +103,396 @@ const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
|
35
103
|
});
|
|
36
104
|
function getPropAlias(prop, tagName) {
|
|
37
105
|
const a = PropAliases[prop];
|
|
38
|
-
return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
|
|
39
|
-
}
|
|
40
|
-
const DelegatedEvents = /*#__PURE__*/new Set([
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
106
|
+
return typeof a === "object" ? (a[tagName] ? a["$"] : undefined) : a;
|
|
107
|
+
}
|
|
108
|
+
const DelegatedEvents = /*#__PURE__*/ new Set([
|
|
109
|
+
"beforeinput",
|
|
110
|
+
"click",
|
|
111
|
+
"dblclick",
|
|
112
|
+
"contextmenu",
|
|
113
|
+
"focusin",
|
|
114
|
+
"focusout",
|
|
115
|
+
"input",
|
|
116
|
+
"keydown",
|
|
117
|
+
"keyup",
|
|
118
|
+
"mousedown",
|
|
119
|
+
"mousemove",
|
|
120
|
+
"mouseout",
|
|
121
|
+
"mouseover",
|
|
122
|
+
"mouseup",
|
|
123
|
+
"pointerdown",
|
|
124
|
+
"pointermove",
|
|
125
|
+
"pointerout",
|
|
126
|
+
"pointerover",
|
|
127
|
+
"pointerup",
|
|
128
|
+
"touchend",
|
|
129
|
+
"touchmove",
|
|
130
|
+
"touchstart"
|
|
131
|
+
]);
|
|
132
|
+
const SVGElements = /*#__PURE__*/ new Set([
|
|
133
|
+
"altGlyph",
|
|
134
|
+
"altGlyphDef",
|
|
135
|
+
"altGlyphItem",
|
|
136
|
+
"animate",
|
|
137
|
+
"animateColor",
|
|
138
|
+
"animateMotion",
|
|
139
|
+
"animateTransform",
|
|
140
|
+
"circle",
|
|
141
|
+
"clipPath",
|
|
142
|
+
"color-profile",
|
|
143
|
+
"cursor",
|
|
144
|
+
"defs",
|
|
145
|
+
"desc",
|
|
146
|
+
"ellipse",
|
|
147
|
+
"feBlend",
|
|
148
|
+
"feColorMatrix",
|
|
149
|
+
"feComponentTransfer",
|
|
150
|
+
"feComposite",
|
|
151
|
+
"feConvolveMatrix",
|
|
152
|
+
"feDiffuseLighting",
|
|
153
|
+
"feDisplacementMap",
|
|
154
|
+
"feDistantLight",
|
|
155
|
+
"feDropShadow",
|
|
156
|
+
"feFlood",
|
|
157
|
+
"feFuncA",
|
|
158
|
+
"feFuncB",
|
|
159
|
+
"feFuncG",
|
|
160
|
+
"feFuncR",
|
|
161
|
+
"feGaussianBlur",
|
|
162
|
+
"feImage",
|
|
163
|
+
"feMerge",
|
|
164
|
+
"feMergeNode",
|
|
165
|
+
"feMorphology",
|
|
166
|
+
"feOffset",
|
|
167
|
+
"fePointLight",
|
|
168
|
+
"feSpecularLighting",
|
|
169
|
+
"feSpotLight",
|
|
170
|
+
"feTile",
|
|
171
|
+
"feTurbulence",
|
|
172
|
+
"filter",
|
|
173
|
+
"font",
|
|
174
|
+
"font-face",
|
|
175
|
+
"font-face-format",
|
|
176
|
+
"font-face-name",
|
|
177
|
+
"font-face-src",
|
|
178
|
+
"font-face-uri",
|
|
179
|
+
"foreignObject",
|
|
180
|
+
"g",
|
|
181
|
+
"glyph",
|
|
182
|
+
"glyphRef",
|
|
183
|
+
"hkern",
|
|
184
|
+
"image",
|
|
185
|
+
"line",
|
|
186
|
+
"linearGradient",
|
|
187
|
+
"marker",
|
|
188
|
+
"mask",
|
|
189
|
+
"metadata",
|
|
190
|
+
"missing-glyph",
|
|
191
|
+
"mpath",
|
|
192
|
+
"path",
|
|
193
|
+
"pattern",
|
|
194
|
+
"polygon",
|
|
195
|
+
"polyline",
|
|
196
|
+
"radialGradient",
|
|
197
|
+
"rect",
|
|
198
|
+
"set",
|
|
199
|
+
"stop",
|
|
200
|
+
"svg",
|
|
201
|
+
"switch",
|
|
202
|
+
"symbol",
|
|
203
|
+
"text",
|
|
204
|
+
"textPath",
|
|
205
|
+
"tref",
|
|
206
|
+
"tspan",
|
|
207
|
+
"use",
|
|
208
|
+
"view",
|
|
209
|
+
"vkern"
|
|
210
|
+
]);
|
|
46
211
|
const SVGNamespace = {
|
|
47
212
|
xlink: "http://www.w3.org/1999/xlink",
|
|
48
213
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
49
214
|
};
|
|
50
|
-
const DOMElements = /*#__PURE__*/new Set([
|
|
215
|
+
const DOMElements = /*#__PURE__*/ new Set([
|
|
216
|
+
"html",
|
|
217
|
+
"base",
|
|
218
|
+
"head",
|
|
219
|
+
"link",
|
|
220
|
+
"meta",
|
|
221
|
+
"style",
|
|
222
|
+
"title",
|
|
223
|
+
"body",
|
|
224
|
+
"address",
|
|
225
|
+
"article",
|
|
226
|
+
"aside",
|
|
227
|
+
"footer",
|
|
228
|
+
"header",
|
|
229
|
+
"main",
|
|
230
|
+
"nav",
|
|
231
|
+
"section",
|
|
232
|
+
"body",
|
|
233
|
+
"blockquote",
|
|
234
|
+
"dd",
|
|
235
|
+
"div",
|
|
236
|
+
"dl",
|
|
237
|
+
"dt",
|
|
238
|
+
"figcaption",
|
|
239
|
+
"figure",
|
|
240
|
+
"hr",
|
|
241
|
+
"li",
|
|
242
|
+
"ol",
|
|
243
|
+
"p",
|
|
244
|
+
"pre",
|
|
245
|
+
"ul",
|
|
246
|
+
"a",
|
|
247
|
+
"abbr",
|
|
248
|
+
"b",
|
|
249
|
+
"bdi",
|
|
250
|
+
"bdo",
|
|
251
|
+
"br",
|
|
252
|
+
"cite",
|
|
253
|
+
"code",
|
|
254
|
+
"data",
|
|
255
|
+
"dfn",
|
|
256
|
+
"em",
|
|
257
|
+
"i",
|
|
258
|
+
"kbd",
|
|
259
|
+
"mark",
|
|
260
|
+
"q",
|
|
261
|
+
"rp",
|
|
262
|
+
"rt",
|
|
263
|
+
"ruby",
|
|
264
|
+
"s",
|
|
265
|
+
"samp",
|
|
266
|
+
"small",
|
|
267
|
+
"span",
|
|
268
|
+
"strong",
|
|
269
|
+
"sub",
|
|
270
|
+
"sup",
|
|
271
|
+
"time",
|
|
272
|
+
"u",
|
|
273
|
+
"var",
|
|
274
|
+
"wbr",
|
|
275
|
+
"area",
|
|
276
|
+
"audio",
|
|
277
|
+
"img",
|
|
278
|
+
"map",
|
|
279
|
+
"track",
|
|
280
|
+
"video",
|
|
281
|
+
"embed",
|
|
282
|
+
"iframe",
|
|
283
|
+
"object",
|
|
284
|
+
"param",
|
|
285
|
+
"picture",
|
|
286
|
+
"portal",
|
|
287
|
+
"source",
|
|
288
|
+
"svg",
|
|
289
|
+
"math",
|
|
290
|
+
"canvas",
|
|
291
|
+
"noscript",
|
|
292
|
+
"script",
|
|
293
|
+
"del",
|
|
294
|
+
"ins",
|
|
295
|
+
"caption",
|
|
296
|
+
"col",
|
|
297
|
+
"colgroup",
|
|
298
|
+
"table",
|
|
299
|
+
"tbody",
|
|
300
|
+
"td",
|
|
301
|
+
"tfoot",
|
|
302
|
+
"th",
|
|
303
|
+
"thead",
|
|
304
|
+
"tr",
|
|
305
|
+
"button",
|
|
306
|
+
"datalist",
|
|
307
|
+
"fieldset",
|
|
308
|
+
"form",
|
|
309
|
+
"input",
|
|
310
|
+
"label",
|
|
311
|
+
"legend",
|
|
312
|
+
"meter",
|
|
313
|
+
"optgroup",
|
|
314
|
+
"option",
|
|
315
|
+
"output",
|
|
316
|
+
"progress",
|
|
317
|
+
"select",
|
|
318
|
+
"textarea",
|
|
319
|
+
"details",
|
|
320
|
+
"dialog",
|
|
321
|
+
"menu",
|
|
322
|
+
"summary",
|
|
323
|
+
"details",
|
|
324
|
+
"slot",
|
|
325
|
+
"template",
|
|
326
|
+
"acronym",
|
|
327
|
+
"applet",
|
|
328
|
+
"basefont",
|
|
329
|
+
"bgsound",
|
|
330
|
+
"big",
|
|
331
|
+
"blink",
|
|
332
|
+
"center",
|
|
333
|
+
"content",
|
|
334
|
+
"dir",
|
|
335
|
+
"font",
|
|
336
|
+
"frame",
|
|
337
|
+
"frameset",
|
|
338
|
+
"hgroup",
|
|
339
|
+
"image",
|
|
340
|
+
"keygen",
|
|
341
|
+
"marquee",
|
|
342
|
+
"menuitem",
|
|
343
|
+
"nobr",
|
|
344
|
+
"noembed",
|
|
345
|
+
"noframes",
|
|
346
|
+
"plaintext",
|
|
347
|
+
"rb",
|
|
348
|
+
"rtc",
|
|
349
|
+
"shadow",
|
|
350
|
+
"spacer",
|
|
351
|
+
"strike",
|
|
352
|
+
"tt",
|
|
353
|
+
"xmp",
|
|
354
|
+
"a",
|
|
355
|
+
"abbr",
|
|
356
|
+
"acronym",
|
|
357
|
+
"address",
|
|
358
|
+
"applet",
|
|
359
|
+
"area",
|
|
360
|
+
"article",
|
|
361
|
+
"aside",
|
|
362
|
+
"audio",
|
|
363
|
+
"b",
|
|
364
|
+
"base",
|
|
365
|
+
"basefont",
|
|
366
|
+
"bdi",
|
|
367
|
+
"bdo",
|
|
368
|
+
"bgsound",
|
|
369
|
+
"big",
|
|
370
|
+
"blink",
|
|
371
|
+
"blockquote",
|
|
372
|
+
"body",
|
|
373
|
+
"br",
|
|
374
|
+
"button",
|
|
375
|
+
"canvas",
|
|
376
|
+
"caption",
|
|
377
|
+
"center",
|
|
378
|
+
"cite",
|
|
379
|
+
"code",
|
|
380
|
+
"col",
|
|
381
|
+
"colgroup",
|
|
382
|
+
"content",
|
|
383
|
+
"data",
|
|
384
|
+
"datalist",
|
|
385
|
+
"dd",
|
|
386
|
+
"del",
|
|
387
|
+
"details",
|
|
388
|
+
"dfn",
|
|
389
|
+
"dialog",
|
|
390
|
+
"dir",
|
|
391
|
+
"div",
|
|
392
|
+
"dl",
|
|
393
|
+
"dt",
|
|
394
|
+
"em",
|
|
395
|
+
"embed",
|
|
396
|
+
"fieldset",
|
|
397
|
+
"figcaption",
|
|
398
|
+
"figure",
|
|
399
|
+
"font",
|
|
400
|
+
"footer",
|
|
401
|
+
"form",
|
|
402
|
+
"frame",
|
|
403
|
+
"frameset",
|
|
404
|
+
"head",
|
|
405
|
+
"header",
|
|
406
|
+
"hgroup",
|
|
407
|
+
"hr",
|
|
408
|
+
"html",
|
|
409
|
+
"i",
|
|
410
|
+
"iframe",
|
|
411
|
+
"image",
|
|
412
|
+
"img",
|
|
413
|
+
"input",
|
|
414
|
+
"ins",
|
|
415
|
+
"kbd",
|
|
416
|
+
"keygen",
|
|
417
|
+
"label",
|
|
418
|
+
"legend",
|
|
419
|
+
"li",
|
|
420
|
+
"link",
|
|
421
|
+
"main",
|
|
422
|
+
"map",
|
|
423
|
+
"mark",
|
|
424
|
+
"marquee",
|
|
425
|
+
"menu",
|
|
426
|
+
"menuitem",
|
|
427
|
+
"meta",
|
|
428
|
+
"meter",
|
|
429
|
+
"nav",
|
|
430
|
+
"nobr",
|
|
431
|
+
"noembed",
|
|
432
|
+
"noframes",
|
|
433
|
+
"noscript",
|
|
434
|
+
"object",
|
|
435
|
+
"ol",
|
|
436
|
+
"optgroup",
|
|
437
|
+
"option",
|
|
438
|
+
"output",
|
|
439
|
+
"p",
|
|
440
|
+
"param",
|
|
441
|
+
"picture",
|
|
442
|
+
"plaintext",
|
|
443
|
+
"portal",
|
|
444
|
+
"pre",
|
|
445
|
+
"progress",
|
|
446
|
+
"q",
|
|
447
|
+
"rb",
|
|
448
|
+
"rp",
|
|
449
|
+
"rt",
|
|
450
|
+
"rtc",
|
|
451
|
+
"ruby",
|
|
452
|
+
"s",
|
|
453
|
+
"samp",
|
|
454
|
+
"script",
|
|
455
|
+
"section",
|
|
456
|
+
"select",
|
|
457
|
+
"shadow",
|
|
458
|
+
"slot",
|
|
459
|
+
"small",
|
|
460
|
+
"source",
|
|
461
|
+
"spacer",
|
|
462
|
+
"span",
|
|
463
|
+
"strike",
|
|
464
|
+
"strong",
|
|
465
|
+
"style",
|
|
466
|
+
"sub",
|
|
467
|
+
"summary",
|
|
468
|
+
"sup",
|
|
469
|
+
"table",
|
|
470
|
+
"tbody",
|
|
471
|
+
"td",
|
|
472
|
+
"template",
|
|
473
|
+
"textarea",
|
|
474
|
+
"tfoot",
|
|
475
|
+
"th",
|
|
476
|
+
"thead",
|
|
477
|
+
"time",
|
|
478
|
+
"title",
|
|
479
|
+
"tr",
|
|
480
|
+
"track",
|
|
481
|
+
"tt",
|
|
482
|
+
"u",
|
|
483
|
+
"ul",
|
|
484
|
+
"var",
|
|
485
|
+
"video",
|
|
486
|
+
"wbr",
|
|
487
|
+
"xmp",
|
|
488
|
+
"input",
|
|
489
|
+
"h1",
|
|
490
|
+
"h2",
|
|
491
|
+
"h3",
|
|
492
|
+
"h4",
|
|
493
|
+
"h5",
|
|
494
|
+
"h6"
|
|
495
|
+
]);
|
|
51
496
|
|
|
52
497
|
function reconcileArrays(parentNode, a, b) {
|
|
53
498
|
let bLength = b.length,
|
|
@@ -68,7 +513,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
68
513
|
bEnd--;
|
|
69
514
|
}
|
|
70
515
|
if (aEnd === aStart) {
|
|
71
|
-
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
516
|
+
const node = bEnd < bLength ? (bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart]) : after;
|
|
72
517
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
73
518
|
} else if (bEnd === bStart) {
|
|
74
519
|
while (aStart < aEnd) {
|
|
@@ -111,7 +556,9 @@ function render(code, element, init, options = {}) {
|
|
|
111
556
|
let disposer;
|
|
112
557
|
createRoot(dispose => {
|
|
113
558
|
disposer = dispose;
|
|
114
|
-
element === document
|
|
559
|
+
element === document
|
|
560
|
+
? code()
|
|
561
|
+
: insert(element, code(), element.firstChild ? null : undefined, init);
|
|
115
562
|
}, options.owner);
|
|
116
563
|
return () => {
|
|
117
564
|
disposer();
|
|
@@ -125,7 +572,9 @@ function template(html, isImportNode, isSVG) {
|
|
|
125
572
|
t.innerHTML = html;
|
|
126
573
|
return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
127
574
|
};
|
|
128
|
-
const fn = isImportNode
|
|
575
|
+
const fn = isImportNode
|
|
576
|
+
? () => untrack(() => document.importNode(node || (node = create()), true))
|
|
577
|
+
: () => (node || (node = create())).cloneNode(true);
|
|
129
578
|
fn.cloneNode = fn;
|
|
130
579
|
return fn;
|
|
131
580
|
}
|
|
@@ -151,11 +600,13 @@ function setProperty(node, name, value) {
|
|
|
151
600
|
}
|
|
152
601
|
function setAttribute(node, name, value) {
|
|
153
602
|
if (isHydrating(node)) return;
|
|
154
|
-
if (value == null) node.removeAttribute(name);
|
|
603
|
+
if (value == null) node.removeAttribute(name);
|
|
604
|
+
else node.setAttribute(name, value);
|
|
155
605
|
}
|
|
156
606
|
function setAttributeNS(node, namespace, name, value) {
|
|
157
607
|
if (isHydrating(node)) return;
|
|
158
|
-
if (value == null) node.removeAttributeNS(namespace, name);
|
|
608
|
+
if (value == null) node.removeAttributeNS(namespace, name);
|
|
609
|
+
else node.setAttributeNS(namespace, name, value);
|
|
159
610
|
}
|
|
160
611
|
function setBoolAttribute(node, name, value) {
|
|
161
612
|
if (isHydrating(node)) return;
|
|
@@ -163,7 +614,8 @@ function setBoolAttribute(node, name, value) {
|
|
|
163
614
|
}
|
|
164
615
|
function className(node, value) {
|
|
165
616
|
if (isHydrating(node)) return;
|
|
166
|
-
if (value == null) node.removeAttribute("class");
|
|
617
|
+
if (value == null) node.removeAttribute("class");
|
|
618
|
+
else node.className = value;
|
|
167
619
|
}
|
|
168
620
|
function addEventListener(node, name, handler, delegate) {
|
|
169
621
|
if (delegate) {
|
|
@@ -173,7 +625,7 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
173
625
|
} else node[`$$${name}`] = handler;
|
|
174
626
|
} else if (Array.isArray(handler)) {
|
|
175
627
|
const handlerFn = handler[0];
|
|
176
|
-
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
628
|
+
node.addEventListener(name, (handler[0] = e => handlerFn.call(node, handler[1], e)));
|
|
177
629
|
} else node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
178
630
|
}
|
|
179
631
|
function classList(node, value, prev = {}) {
|
|
@@ -198,7 +650,7 @@ function classList(node, value, prev = {}) {
|
|
|
198
650
|
function style(node, value, prev) {
|
|
199
651
|
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
200
652
|
const nodeStyle = node.style;
|
|
201
|
-
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
653
|
+
if (typeof value === "string") return (nodeStyle.cssText = value);
|
|
202
654
|
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
203
655
|
prev || (prev = {});
|
|
204
656
|
value || (value = {});
|
|
@@ -219,7 +671,9 @@ function style(node, value, prev) {
|
|
|
219
671
|
function spread(node, props = {}, isSVG, skipChildren) {
|
|
220
672
|
const prevProps = {};
|
|
221
673
|
if (!skipChildren) {
|
|
222
|
-
createRenderEffect(
|
|
674
|
+
createRenderEffect(
|
|
675
|
+
() => (prevProps.children = insertExpression(node, props.children, prevProps.children))
|
|
676
|
+
);
|
|
223
677
|
}
|
|
224
678
|
createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
|
|
225
679
|
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
@@ -283,7 +737,7 @@ function getNextElement(template) {
|
|
|
283
737
|
let node,
|
|
284
738
|
key,
|
|
285
739
|
hydrating = isHydrating();
|
|
286
|
-
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
740
|
+
if (!hydrating || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
|
|
287
741
|
return template();
|
|
288
742
|
}
|
|
289
743
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
@@ -302,7 +756,8 @@ function getNextMarker(start) {
|
|
|
302
756
|
while (end) {
|
|
303
757
|
if (end.nodeType === 8) {
|
|
304
758
|
const v = end.nodeValue;
|
|
305
|
-
if (v === "$") count++;
|
|
759
|
+
if (v === "$") count++;
|
|
760
|
+
else if (v === "/") {
|
|
306
761
|
if (count === 0) return [end, current];
|
|
307
762
|
count--;
|
|
308
763
|
}
|
|
@@ -316,10 +771,7 @@ function getNextMarker(start) {
|
|
|
316
771
|
function runHydrationEvents() {
|
|
317
772
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
318
773
|
queueMicrotask(() => {
|
|
319
|
-
const {
|
|
320
|
-
completed,
|
|
321
|
-
events
|
|
322
|
-
} = sharedConfig;
|
|
774
|
+
const { completed, events } = sharedConfig;
|
|
323
775
|
if (!events) return;
|
|
324
776
|
events.queued = false;
|
|
325
777
|
while (events.length) {
|
|
@@ -344,7 +796,8 @@ function toPropertyName(name) {
|
|
|
344
796
|
}
|
|
345
797
|
function toggleClassKey(node, key, value) {
|
|
346
798
|
const classNames = key.trim().split(/\s+/);
|
|
347
|
-
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
799
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
800
|
+
node.classList.toggle(classNames[i], value);
|
|
348
801
|
}
|
|
349
802
|
function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
|
|
350
803
|
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
@@ -376,15 +829,24 @@ function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
|
|
|
376
829
|
setAttribute(node, prop.slice(5), value);
|
|
377
830
|
} else if (prop.slice(0, 5) === "bool:") {
|
|
378
831
|
setBoolAttribute(node, prop.slice(5), value);
|
|
379
|
-
} else if (
|
|
832
|
+
} else if (
|
|
833
|
+
(forceProp = prop.slice(0, 5) === "prop:") ||
|
|
834
|
+
(isChildProp = ChildProperties.has(prop)) ||
|
|
835
|
+
(!isSVG &&
|
|
836
|
+
((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop)))) ||
|
|
837
|
+
(isCE = node.nodeName.includes("-") || "is" in props)
|
|
838
|
+
) {
|
|
380
839
|
if (forceProp) {
|
|
381
840
|
prop = prop.slice(5);
|
|
382
841
|
isProp = true;
|
|
383
842
|
} else if (isHydrating(node)) return value;
|
|
384
|
-
if (prop === "class" || prop === "className") className(node, value);
|
|
843
|
+
if (prop === "class" || prop === "className") className(node, value);
|
|
844
|
+
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
845
|
+
else node[propAlias || prop] = value;
|
|
385
846
|
} else {
|
|
386
847
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
387
|
-
if (ns) setAttributeNS(node, ns, prop, value);
|
|
848
|
+
if (ns) setAttributeNS(node, ns, prop, value);
|
|
849
|
+
else setAttribute(node, Aliases[prop] || prop, value);
|
|
388
850
|
}
|
|
389
851
|
return value;
|
|
390
852
|
}
|
|
@@ -396,10 +858,11 @@ function eventHandler(e) {
|
|
|
396
858
|
const key = `$$${e.type}`;
|
|
397
859
|
const oriTarget = e.target;
|
|
398
860
|
const oriCurrentTarget = e.currentTarget;
|
|
399
|
-
const retarget = value =>
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
861
|
+
const retarget = value =>
|
|
862
|
+
Object.defineProperty(e, "target", {
|
|
863
|
+
configurable: true,
|
|
864
|
+
value
|
|
865
|
+
});
|
|
403
866
|
const handleNode = () => {
|
|
404
867
|
const handler = node[key];
|
|
405
868
|
if (handler && !node.disabled) {
|
|
@@ -407,7 +870,11 @@ function eventHandler(e) {
|
|
|
407
870
|
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
408
871
|
if (e.cancelBubble) return;
|
|
409
872
|
}
|
|
410
|
-
node.host &&
|
|
873
|
+
node.host &&
|
|
874
|
+
typeof node.host !== "string" &&
|
|
875
|
+
!node.host._$host &&
|
|
876
|
+
node.contains(e.target) &&
|
|
877
|
+
retarget(node.host);
|
|
411
878
|
return true;
|
|
412
879
|
};
|
|
413
880
|
const walkUpTree = () => {
|
|
@@ -435,8 +902,7 @@ function eventHandler(e) {
|
|
|
435
902
|
break;
|
|
436
903
|
}
|
|
437
904
|
}
|
|
438
|
-
}
|
|
439
|
-
else walkUpTree();
|
|
905
|
+
} else walkUpTree();
|
|
440
906
|
retarget(oriTarget);
|
|
441
907
|
}
|
|
442
908
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
@@ -446,7 +912,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
446
912
|
let cleaned = [];
|
|
447
913
|
for (let i = 0; i < current.length; i++) {
|
|
448
914
|
const node = current[i];
|
|
449
|
-
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
915
|
+
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
916
|
+
else cleaned.push(node);
|
|
450
917
|
}
|
|
451
918
|
current = cleaned;
|
|
452
919
|
}
|
|
@@ -454,7 +921,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
454
921
|
if (value === current) return current;
|
|
455
922
|
const t = typeof value,
|
|
456
923
|
multi = marker !== undefined;
|
|
457
|
-
parent = multi && current[0] && current[0].parentNode || parent;
|
|
924
|
+
parent = (multi && current[0] && current[0].parentNode) || parent;
|
|
458
925
|
if (t === "string" || t === "number") {
|
|
459
926
|
if (hydrating) return current;
|
|
460
927
|
if (t === "number") {
|
|
@@ -486,17 +953,17 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
486
953
|
const array = [];
|
|
487
954
|
const currentArray = current && Array.isArray(current);
|
|
488
955
|
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
489
|
-
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
956
|
+
createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
|
|
490
957
|
return () => current;
|
|
491
958
|
}
|
|
492
959
|
if (hydrating) {
|
|
493
960
|
if (!array.length) return current;
|
|
494
|
-
if (marker === undefined) return current = [...parent.childNodes];
|
|
961
|
+
if (marker === undefined) return (current = [...parent.childNodes]);
|
|
495
962
|
let node = array[0];
|
|
496
963
|
if (node.parentNode !== parent) return current;
|
|
497
964
|
const nodes = [node];
|
|
498
965
|
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
499
|
-
return current = nodes;
|
|
966
|
+
return (current = nodes);
|
|
500
967
|
}
|
|
501
968
|
if (array.length === 0) {
|
|
502
969
|
current = cleanChildren(parent, current, marker);
|
|
@@ -511,15 +978,15 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
511
978
|
}
|
|
512
979
|
current = array;
|
|
513
980
|
} else if (value.nodeType) {
|
|
514
|
-
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
981
|
+
if (hydrating && value.parentNode) return (current = multi ? [value] : value);
|
|
515
982
|
if (Array.isArray(current)) {
|
|
516
|
-
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
983
|
+
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
|
517
984
|
cleanChildren(parent, current, null, value);
|
|
518
985
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
519
986
|
parent.appendChild(value);
|
|
520
987
|
} else parent.replaceChild(value, parent.firstChild);
|
|
521
988
|
current = value;
|
|
522
|
-
} else
|
|
989
|
+
} else;
|
|
523
990
|
return current;
|
|
524
991
|
}
|
|
525
992
|
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
@@ -528,21 +995,28 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
528
995
|
let item = array[i],
|
|
529
996
|
prev = current && current[normalized.length],
|
|
530
997
|
t;
|
|
531
|
-
if (item == null || item === true || item === false)
|
|
998
|
+
if (item == null || item === true || item === false);
|
|
999
|
+
else if ((t = typeof item) === "object" && item.nodeType) {
|
|
532
1000
|
normalized.push(item);
|
|
533
1001
|
} else if (Array.isArray(item)) {
|
|
534
1002
|
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
535
1003
|
} else if (t === "function") {
|
|
536
1004
|
if (unwrap) {
|
|
537
1005
|
while (typeof item === "function") item = item();
|
|
538
|
-
dynamic =
|
|
1006
|
+
dynamic =
|
|
1007
|
+
normalizeIncomingArray(
|
|
1008
|
+
normalized,
|
|
1009
|
+
Array.isArray(item) ? item : [item],
|
|
1010
|
+
Array.isArray(prev) ? prev : [prev]
|
|
1011
|
+
) || dynamic;
|
|
539
1012
|
} else {
|
|
540
1013
|
normalized.push(item);
|
|
541
1014
|
dynamic = true;
|
|
542
1015
|
}
|
|
543
1016
|
} else {
|
|
544
1017
|
const value = String(item);
|
|
545
|
-
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
1018
|
+
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
1019
|
+
else normalized.push(document.createTextNode(value));
|
|
546
1020
|
}
|
|
547
1021
|
}
|
|
548
1022
|
return dynamic;
|
|
@@ -551,7 +1025,7 @@ function appendNodes(parent, array, marker = null) {
|
|
|
551
1025
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
552
1026
|
}
|
|
553
1027
|
function cleanChildren(parent, current, marker, replacement) {
|
|
554
|
-
if (marker === undefined) return parent.textContent = "";
|
|
1028
|
+
if (marker === undefined) return (parent.textContent = "");
|
|
555
1029
|
const node = replacement || document.createTextNode("");
|
|
556
1030
|
if (current.length) {
|
|
557
1031
|
let inserted = false;
|
|
@@ -559,7 +1033,9 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
559
1033
|
const el = current[i];
|
|
560
1034
|
if (node !== el) {
|
|
561
1035
|
const isParent = el.parentNode === parent;
|
|
562
|
-
if (!inserted && !i)
|
|
1036
|
+
if (!inserted && !i)
|
|
1037
|
+
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
1038
|
+
else isParent && el.remove();
|
|
563
1039
|
} else inserted = true;
|
|
564
1040
|
}
|
|
565
1041
|
} else parent.insertBefore(node, marker);
|
|
@@ -570,7 +1046,8 @@ function gatherHydratable(element, root) {
|
|
|
570
1046
|
for (let i = 0; i < templates.length; i++) {
|
|
571
1047
|
const node = templates[i];
|
|
572
1048
|
const key = node.getAttribute("data-hk");
|
|
573
|
-
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1049
|
+
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
1050
|
+
sharedConfig.registry.set(key, node);
|
|
574
1051
|
}
|
|
575
1052
|
}
|
|
576
1053
|
function getHydrationKey() {
|
|
@@ -622,42 +1099,47 @@ const hydrate = (...args) => {
|
|
|
622
1099
|
return hydrate$1(...args);
|
|
623
1100
|
};
|
|
624
1101
|
function Portal(props) {
|
|
625
|
-
const {
|
|
626
|
-
useShadow
|
|
627
|
-
} = props,
|
|
1102
|
+
const { useShadow } = props,
|
|
628
1103
|
marker = document.createTextNode(""),
|
|
629
1104
|
mount = () => props.mount || document.body,
|
|
630
1105
|
owner = getOwner();
|
|
631
1106
|
let content;
|
|
632
1107
|
let hydrating = !!sharedConfig.context;
|
|
633
|
-
createEffect(
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
1108
|
+
createEffect(
|
|
1109
|
+
() => {
|
|
1110
|
+
if (hydrating) getOwner().user = hydrating = false;
|
|
1111
|
+
content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
|
|
1112
|
+
const el = mount();
|
|
1113
|
+
if (el instanceof HTMLHeadElement) {
|
|
1114
|
+
const [clean, setClean] = createSignal(false);
|
|
1115
|
+
const cleanup = () => setClean(true);
|
|
1116
|
+
createRoot(dispose => insert(el, () => (!clean() ? content() : dispose()), null));
|
|
1117
|
+
onCleanup(cleanup);
|
|
1118
|
+
} else {
|
|
1119
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
1120
|
+
renderRoot =
|
|
1121
|
+
useShadow && container.attachShadow
|
|
1122
|
+
? container.attachShadow({
|
|
1123
|
+
mode: "open"
|
|
1124
|
+
})
|
|
1125
|
+
: container;
|
|
1126
|
+
Object.defineProperty(container, "_$host", {
|
|
1127
|
+
get() {
|
|
1128
|
+
return marker.parentNode;
|
|
1129
|
+
},
|
|
1130
|
+
configurable: true
|
|
1131
|
+
});
|
|
1132
|
+
insert(renderRoot, content);
|
|
1133
|
+
el.appendChild(container);
|
|
1134
|
+
props.ref && props.ref(container);
|
|
1135
|
+
onCleanup(() => el.removeChild(container));
|
|
1136
|
+
}
|
|
1137
|
+
},
|
|
1138
|
+
undefined,
|
|
1139
|
+
{
|
|
1140
|
+
render: !hydrating
|
|
657
1141
|
}
|
|
658
|
-
|
|
659
|
-
render: !hydrating
|
|
660
|
-
});
|
|
1142
|
+
);
|
|
661
1143
|
return marker;
|
|
662
1144
|
}
|
|
663
1145
|
function Dynamic(props) {
|
|
@@ -677,4 +1159,62 @@ function Dynamic(props) {
|
|
|
677
1159
|
});
|
|
678
1160
|
}
|
|
679
1161
|
|
|
680
|
-
export {
|
|
1162
|
+
export {
|
|
1163
|
+
Aliases,
|
|
1164
|
+
voidFn as Assets,
|
|
1165
|
+
ChildProperties,
|
|
1166
|
+
DOMElements,
|
|
1167
|
+
DelegatedEvents,
|
|
1168
|
+
Dynamic,
|
|
1169
|
+
Hydration,
|
|
1170
|
+
voidFn as HydrationScript,
|
|
1171
|
+
NoHydration,
|
|
1172
|
+
Portal,
|
|
1173
|
+
Properties,
|
|
1174
|
+
RequestContext,
|
|
1175
|
+
SVGElements,
|
|
1176
|
+
SVGNamespace,
|
|
1177
|
+
addEventListener,
|
|
1178
|
+
assign,
|
|
1179
|
+
classList,
|
|
1180
|
+
className,
|
|
1181
|
+
clearDelegatedEvents,
|
|
1182
|
+
delegateEvents,
|
|
1183
|
+
dynamicProperty,
|
|
1184
|
+
escape,
|
|
1185
|
+
voidFn as generateHydrationScript,
|
|
1186
|
+
voidFn as getAssets,
|
|
1187
|
+
getHydrationKey,
|
|
1188
|
+
getNextElement,
|
|
1189
|
+
getNextMarker,
|
|
1190
|
+
getNextMatch,
|
|
1191
|
+
getPropAlias,
|
|
1192
|
+
voidFn as getRequestEvent,
|
|
1193
|
+
hydrate,
|
|
1194
|
+
innerHTML,
|
|
1195
|
+
insert,
|
|
1196
|
+
isDev,
|
|
1197
|
+
isServer,
|
|
1198
|
+
render,
|
|
1199
|
+
renderToStream,
|
|
1200
|
+
renderToString,
|
|
1201
|
+
renderToStringAsync,
|
|
1202
|
+
resolveSSRNode,
|
|
1203
|
+
runHydrationEvents,
|
|
1204
|
+
setAttribute,
|
|
1205
|
+
setAttributeNS,
|
|
1206
|
+
setBoolAttribute,
|
|
1207
|
+
setProperty,
|
|
1208
|
+
spread,
|
|
1209
|
+
ssr,
|
|
1210
|
+
ssrAttribute,
|
|
1211
|
+
ssrClassList,
|
|
1212
|
+
ssrElement,
|
|
1213
|
+
ssrHydrationKey,
|
|
1214
|
+
ssrSpread,
|
|
1215
|
+
ssrStyle,
|
|
1216
|
+
style,
|
|
1217
|
+
template,
|
|
1218
|
+
use,
|
|
1219
|
+
voidFn as useAssets
|
|
1220
|
+
};
|