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