solid-js 1.8.2 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.cjs +1 -1
- package/dist/dev.js +534 -299
- package/dist/server.js +170 -75
- package/dist/solid.cjs +1 -1
- package/dist/solid.js +461 -257
- 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 +47 -31
- package/package.json +7 -3
- 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 +57 -2
- package/types/server/reactive.d.ts +73 -42
- 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 +3 -0
- package/web/dist/dev.js +620 -81
- package/web/dist/server.cjs +17 -5
- package/web/dist/server.js +188 -95
- package/web/dist/storage.cjs +12 -0
- package/web/dist/storage.js +10 -0
- package/web/dist/web.cjs +3 -0
- package/web/dist/web.js +614 -80
- package/web/types/client.d.ts +8 -3
- 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 +10 -1
- package/web/types/storage.d.ts +2 -0
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,7 +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()))) {
|
|
728
|
+
if (!sharedConfig.context || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
|
|
277
729
|
return template();
|
|
278
730
|
}
|
|
279
731
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
@@ -292,7 +744,8 @@ function getNextMarker(start) {
|
|
|
292
744
|
while (end) {
|
|
293
745
|
if (end.nodeType === 8) {
|
|
294
746
|
const v = end.nodeValue;
|
|
295
|
-
if (v === "$") count++;
|
|
747
|
+
if (v === "$") count++;
|
|
748
|
+
else if (v === "/") {
|
|
296
749
|
if (count === 0) return [end, current];
|
|
297
750
|
count--;
|
|
298
751
|
}
|
|
@@ -306,10 +759,7 @@ function getNextMarker(start) {
|
|
|
306
759
|
function runHydrationEvents() {
|
|
307
760
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
308
761
|
queueMicrotask(() => {
|
|
309
|
-
const {
|
|
310
|
-
completed,
|
|
311
|
-
events
|
|
312
|
-
} = sharedConfig;
|
|
762
|
+
const { completed, events } = sharedConfig;
|
|
313
763
|
events.queued = false;
|
|
314
764
|
while (events.length) {
|
|
315
765
|
const [el, e] = events[0];
|
|
@@ -326,7 +776,8 @@ function toPropertyName(name) {
|
|
|
326
776
|
}
|
|
327
777
|
function toggleClassKey(node, key, value) {
|
|
328
778
|
const classNames = key.trim().split(/\s+/);
|
|
329
|
-
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);
|
|
330
781
|
}
|
|
331
782
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
332
783
|
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
@@ -356,21 +807,30 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
356
807
|
}
|
|
357
808
|
} else if (prop.slice(0, 5) === "attr:") {
|
|
358
809
|
setAttribute(node, prop.slice(5), value);
|
|
359
|
-
} 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
|
+
) {
|
|
360
817
|
if (forceProp) {
|
|
361
818
|
prop = prop.slice(5);
|
|
362
819
|
isProp = true;
|
|
363
820
|
} else if (sharedConfig.context) return value;
|
|
364
|
-
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;
|
|
365
824
|
} else {
|
|
366
825
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
367
|
-
if (ns) setAttributeNS(node, ns, prop, value);
|
|
826
|
+
if (ns) setAttributeNS(node, ns, prop, value);
|
|
827
|
+
else setAttribute(node, Aliases[prop] || prop, value);
|
|
368
828
|
}
|
|
369
829
|
return value;
|
|
370
830
|
}
|
|
371
831
|
function eventHandler(e) {
|
|
372
832
|
const key = `$$${e.type}`;
|
|
373
|
-
let node = e.composedPath && e.composedPath()[0] || e.target;
|
|
833
|
+
let node = (e.composedPath && e.composedPath()[0]) || e.target;
|
|
374
834
|
if (e.target !== node) {
|
|
375
835
|
Object.defineProperty(e, "target", {
|
|
376
836
|
configurable: true,
|
|
@@ -400,7 +860,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
400
860
|
let cleaned = [];
|
|
401
861
|
for (let i = 0; i < current.length; i++) {
|
|
402
862
|
const node = current[i];
|
|
403
|
-
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);
|
|
404
865
|
}
|
|
405
866
|
current = cleaned;
|
|
406
867
|
}
|
|
@@ -408,7 +869,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
408
869
|
if (value === current) return current;
|
|
409
870
|
const t = typeof value,
|
|
410
871
|
multi = marker !== undefined;
|
|
411
|
-
parent = multi && current[0] && current[0].parentNode || parent;
|
|
872
|
+
parent = (multi && current[0] && current[0].parentNode) || parent;
|
|
412
873
|
if (t === "string" || t === "number") {
|
|
413
874
|
if (sharedConfig.context) return current;
|
|
414
875
|
if (t === "number") value = value.toString();
|
|
@@ -437,7 +898,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
437
898
|
const array = [];
|
|
438
899
|
const currentArray = current && Array.isArray(current);
|
|
439
900
|
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
440
|
-
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
901
|
+
createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
|
|
441
902
|
return () => current;
|
|
442
903
|
}
|
|
443
904
|
if (sharedConfig.context) {
|
|
@@ -446,7 +907,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
446
907
|
let node = array[0];
|
|
447
908
|
let nodes = [node];
|
|
448
909
|
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
449
|
-
return current = nodes;
|
|
910
|
+
return (current = nodes);
|
|
450
911
|
}
|
|
451
912
|
if (array.length === 0) {
|
|
452
913
|
current = cleanChildren(parent, current, marker);
|
|
@@ -461,15 +922,15 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
461
922
|
}
|
|
462
923
|
current = array;
|
|
463
924
|
} else if (value.nodeType) {
|
|
464
|
-
if (sharedConfig.context && value.parentNode) return current = multi ? [value] : value;
|
|
925
|
+
if (sharedConfig.context && value.parentNode) return (current = multi ? [value] : value);
|
|
465
926
|
if (Array.isArray(current)) {
|
|
466
|
-
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
927
|
+
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
|
467
928
|
cleanChildren(parent, current, null, value);
|
|
468
929
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
469
930
|
parent.appendChild(value);
|
|
470
931
|
} else parent.replaceChild(value, parent.firstChild);
|
|
471
932
|
current = value;
|
|
472
|
-
} else
|
|
933
|
+
} else;
|
|
473
934
|
return current;
|
|
474
935
|
}
|
|
475
936
|
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
@@ -478,21 +939,28 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
478
939
|
let item = array[i],
|
|
479
940
|
prev = current && current[i],
|
|
480
941
|
t;
|
|
481
|
-
if (item == null || item === true || item === false)
|
|
942
|
+
if (item == null || item === true || item === false);
|
|
943
|
+
else if ((t = typeof item) === "object" && item.nodeType) {
|
|
482
944
|
normalized.push(item);
|
|
483
945
|
} else if (Array.isArray(item)) {
|
|
484
946
|
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
485
947
|
} else if (t === "function") {
|
|
486
948
|
if (unwrap) {
|
|
487
949
|
while (typeof item === "function") item = item();
|
|
488
|
-
dynamic =
|
|
950
|
+
dynamic =
|
|
951
|
+
normalizeIncomingArray(
|
|
952
|
+
normalized,
|
|
953
|
+
Array.isArray(item) ? item : [item],
|
|
954
|
+
Array.isArray(prev) ? prev : [prev]
|
|
955
|
+
) || dynamic;
|
|
489
956
|
} else {
|
|
490
957
|
normalized.push(item);
|
|
491
958
|
dynamic = true;
|
|
492
959
|
}
|
|
493
960
|
} else {
|
|
494
961
|
const value = String(item);
|
|
495
|
-
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));
|
|
496
964
|
}
|
|
497
965
|
}
|
|
498
966
|
return dynamic;
|
|
@@ -501,7 +969,7 @@ function appendNodes(parent, array, marker = null) {
|
|
|
501
969
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
502
970
|
}
|
|
503
971
|
function cleanChildren(parent, current, marker, replacement) {
|
|
504
|
-
if (marker === undefined) return parent.textContent = "";
|
|
972
|
+
if (marker === undefined) return (parent.textContent = "");
|
|
505
973
|
const node = replacement || document.createTextNode("");
|
|
506
974
|
if (current.length) {
|
|
507
975
|
let inserted = false;
|
|
@@ -509,7 +977,9 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
509
977
|
const el = current[i];
|
|
510
978
|
if (node !== el) {
|
|
511
979
|
const isParent = el.parentNode === parent;
|
|
512
|
-
if (!inserted && !i)
|
|
980
|
+
if (!inserted && !i)
|
|
981
|
+
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
982
|
+
else isParent && el.remove();
|
|
513
983
|
} else inserted = true;
|
|
514
984
|
}
|
|
515
985
|
} else parent.insertBefore(node, marker);
|
|
@@ -520,7 +990,8 @@ function gatherHydratable(element, root) {
|
|
|
520
990
|
for (let i = 0; i < templates.length; i++) {
|
|
521
991
|
const node = templates[i];
|
|
522
992
|
const key = node.getAttribute("data-hk");
|
|
523
|
-
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);
|
|
524
995
|
}
|
|
525
996
|
}
|
|
526
997
|
function getHydrationKey() {
|
|
@@ -534,6 +1005,7 @@ function Hydration(props) {
|
|
|
534
1005
|
return props.children;
|
|
535
1006
|
}
|
|
536
1007
|
function voidFn() {}
|
|
1008
|
+
const RequestContext = Symbol();
|
|
537
1009
|
function innerHTML(parent, content) {
|
|
538
1010
|
!sharedConfig.context && (parent.innerHTML = content);
|
|
539
1011
|
}
|
|
@@ -572,42 +1044,47 @@ const hydrate = (...args) => {
|
|
|
572
1044
|
return hydrate$1(...args);
|
|
573
1045
|
};
|
|
574
1046
|
function Portal(props) {
|
|
575
|
-
const {
|
|
576
|
-
useShadow
|
|
577
|
-
} = props,
|
|
1047
|
+
const { useShadow } = props,
|
|
578
1048
|
marker = document.createTextNode(""),
|
|
579
1049
|
mount = () => props.mount || document.body,
|
|
580
1050
|
owner = getOwner();
|
|
581
1051
|
let content;
|
|
582
1052
|
let hydrating = !!sharedConfig.context;
|
|
583
|
-
createEffect(
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
1053
|
+
createEffect(
|
|
1054
|
+
() => {
|
|
1055
|
+
if (hydrating) getOwner().user = hydrating = false;
|
|
1056
|
+
content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
|
|
1057
|
+
const el = mount();
|
|
1058
|
+
if (el instanceof HTMLHeadElement) {
|
|
1059
|
+
const [clean, setClean] = createSignal(false);
|
|
1060
|
+
const cleanup = () => setClean(true);
|
|
1061
|
+
createRoot(dispose => insert(el, () => (!clean() ? content() : dispose()), null));
|
|
1062
|
+
onCleanup(cleanup);
|
|
1063
|
+
} else {
|
|
1064
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
1065
|
+
renderRoot =
|
|
1066
|
+
useShadow && container.attachShadow
|
|
1067
|
+
? container.attachShadow({
|
|
1068
|
+
mode: "open"
|
|
1069
|
+
})
|
|
1070
|
+
: container;
|
|
1071
|
+
Object.defineProperty(container, "_$host", {
|
|
1072
|
+
get() {
|
|
1073
|
+
return marker.parentNode;
|
|
1074
|
+
},
|
|
1075
|
+
configurable: true
|
|
1076
|
+
});
|
|
1077
|
+
insert(renderRoot, content);
|
|
1078
|
+
el.appendChild(container);
|
|
1079
|
+
props.ref && props.ref(container);
|
|
1080
|
+
onCleanup(() => el.removeChild(container));
|
|
1081
|
+
}
|
|
1082
|
+
},
|
|
1083
|
+
undefined,
|
|
1084
|
+
{
|
|
1085
|
+
render: !hydrating
|
|
607
1086
|
}
|
|
608
|
-
|
|
609
|
-
render: !hydrating
|
|
610
|
-
});
|
|
1087
|
+
);
|
|
611
1088
|
return marker;
|
|
612
1089
|
}
|
|
613
1090
|
function Dynamic(props) {
|
|
@@ -627,4 +1104,61 @@ function Dynamic(props) {
|
|
|
627
1104
|
});
|
|
628
1105
|
}
|
|
629
1106
|
|
|
630
|
-
export {
|
|
1107
|
+
export {
|
|
1108
|
+
Aliases,
|
|
1109
|
+
voidFn as Assets,
|
|
1110
|
+
ChildProperties,
|
|
1111
|
+
DOMElements,
|
|
1112
|
+
DelegatedEvents,
|
|
1113
|
+
Dynamic,
|
|
1114
|
+
Hydration,
|
|
1115
|
+
voidFn as HydrationScript,
|
|
1116
|
+
NoHydration,
|
|
1117
|
+
Portal,
|
|
1118
|
+
Properties,
|
|
1119
|
+
RequestContext,
|
|
1120
|
+
SVGElements,
|
|
1121
|
+
SVGNamespace,
|
|
1122
|
+
addEventListener,
|
|
1123
|
+
assign,
|
|
1124
|
+
classList,
|
|
1125
|
+
className,
|
|
1126
|
+
clearDelegatedEvents,
|
|
1127
|
+
delegateEvents,
|
|
1128
|
+
dynamicProperty,
|
|
1129
|
+
escape,
|
|
1130
|
+
voidFn as generateHydrationScript,
|
|
1131
|
+
voidFn as getAssets,
|
|
1132
|
+
getHydrationKey,
|
|
1133
|
+
getNextElement,
|
|
1134
|
+
getNextMarker,
|
|
1135
|
+
getNextMatch,
|
|
1136
|
+
getPropAlias,
|
|
1137
|
+
voidFn as getRequestEvent,
|
|
1138
|
+
hydrate,
|
|
1139
|
+
innerHTML,
|
|
1140
|
+
insert,
|
|
1141
|
+
isDev,
|
|
1142
|
+
isServer,
|
|
1143
|
+
render,
|
|
1144
|
+
renderToStream,
|
|
1145
|
+
renderToString,
|
|
1146
|
+
renderToStringAsync,
|
|
1147
|
+
resolveSSRNode,
|
|
1148
|
+
runHydrationEvents,
|
|
1149
|
+
setAttribute,
|
|
1150
|
+
setAttributeNS,
|
|
1151
|
+
setProperty,
|
|
1152
|
+
spread,
|
|
1153
|
+
ssr,
|
|
1154
|
+
ssrAttribute,
|
|
1155
|
+
ssrClassList,
|
|
1156
|
+
ssrElement,
|
|
1157
|
+
ssrHydrationKey,
|
|
1158
|
+
ssrSpread,
|
|
1159
|
+
ssrStyle,
|
|
1160
|
+
style,
|
|
1161
|
+
template,
|
|
1162
|
+
use,
|
|
1163
|
+
voidFn as useAssets
|
|
1164
|
+
};
|