solid-js 1.8.22 → 1.9.0

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.
Files changed (59) hide show
  1. package/dist/dev.cjs +7 -6
  2. package/dist/dev.js +567 -325
  3. package/dist/server.cjs +1 -1
  4. package/dist/server.js +169 -75
  5. package/dist/solid.cjs +7 -6
  6. package/dist/solid.js +494 -283
  7. package/h/dist/h.js +40 -9
  8. package/h/jsx-runtime/dist/jsx.js +1 -1
  9. package/h/jsx-runtime/types/index.d.ts +13 -10
  10. package/h/jsx-runtime/types/jsx.d.ts +22 -1
  11. package/h/types/hyperscript.d.ts +11 -11
  12. package/h/types/index.d.ts +1 -1
  13. package/html/dist/html.cjs +4 -2
  14. package/html/dist/html.js +222 -95
  15. package/html/types/index.d.ts +1 -1
  16. package/html/types/lit.d.ts +52 -33
  17. package/package.json +1 -5
  18. package/store/dist/dev.cjs +1 -1
  19. package/store/dist/dev.js +123 -43
  20. package/store/dist/server.cjs +4 -0
  21. package/store/dist/server.js +23 -8
  22. package/store/dist/store.cjs +1 -1
  23. package/store/dist/store.js +114 -40
  24. package/store/package.json +0 -4
  25. package/store/types/index.d.ts +21 -7
  26. package/store/types/modifiers.d.ts +6 -3
  27. package/store/types/mutable.d.ts +5 -2
  28. package/store/types/server.d.ts +26 -5
  29. package/store/types/store.d.ts +219 -62
  30. package/types/index.d.ts +75 -10
  31. package/types/jsx.d.ts +35 -8
  32. package/types/reactive/array.d.ts +12 -4
  33. package/types/reactive/observable.d.ts +25 -17
  34. package/types/reactive/scheduler.d.ts +9 -6
  35. package/types/reactive/signal.d.ts +236 -143
  36. package/types/render/Suspense.d.ts +5 -5
  37. package/types/render/component.d.ts +64 -33
  38. package/types/render/flow.d.ts +43 -31
  39. package/types/render/hydration.d.ts +15 -15
  40. package/types/server/index.d.ts +57 -2
  41. package/types/server/reactive.d.ts +73 -42
  42. package/types/server/rendering.d.ts +169 -98
  43. package/universal/dist/dev.js +28 -12
  44. package/universal/dist/universal.js +28 -12
  45. package/universal/types/index.d.ts +3 -1
  46. package/universal/types/universal.d.ts +0 -1
  47. package/web/dist/dev.cjs +57 -24
  48. package/web/dist/dev.js +679 -101
  49. package/web/dist/server.cjs +96 -15
  50. package/web/dist/server.js +676 -105
  51. package/web/dist/web.cjs +53 -23
  52. package/web/dist/web.js +664 -99
  53. package/web/package.json +0 -4
  54. package/web/storage/dist/storage.js +3 -3
  55. package/web/types/client.d.ts +5 -3
  56. package/web/types/core.d.ts +10 -1
  57. package/web/types/index.d.ts +27 -10
  58. package/web/types/server-mock.d.ts +47 -32
  59. package/web/types/server.d.ts +88 -0
package/web/dist/dev.js CHANGED
@@ -1,14 +1,83 @@
1
- import { createRoot, createRenderEffect, untrack, sharedConfig, enableHydration, getOwner, createEffect, runWithOwner, createMemo, createSignal, onCleanup, splitProps, $DEVCOMP } from 'solid-js';
2
- export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, createMemo as memo, mergeProps, untrack } from 'solid-js';
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
+ $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 = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
5
- const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
6
- const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
7
- const Aliases = /*#__PURE__*/Object.assign(Object.create(null), {
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
+ "inert",
46
+ "ismap",
47
+ "loop",
48
+ "multiple",
49
+ "muted",
50
+ "nomodule",
51
+ "novalidate",
52
+ "open",
53
+ "playsinline",
54
+ "readonly",
55
+ "required",
56
+ "reversed",
57
+ "seamless",
58
+ "selected"
59
+ ];
60
+ const Properties = /*#__PURE__*/ new Set([
61
+ "className",
62
+ "value",
63
+ "readOnly",
64
+ "formNoValidate",
65
+ "isMap",
66
+ "noModule",
67
+ "playsInline",
68
+ ...booleans
69
+ ]);
70
+ const ChildProperties = /*#__PURE__*/ new Set([
71
+ "innerHTML",
72
+ "textContent",
73
+ "innerText",
74
+ "children"
75
+ ]);
76
+ const Aliases = /*#__PURE__*/ Object.assign(Object.create(null), {
8
77
  className: "class",
9
78
  htmlFor: "for"
10
79
  });
11
- const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
80
+ const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
12
81
  class: "className",
13
82
  formnovalidate: {
14
83
  $: "formNoValidate",
@@ -35,19 +104,396 @@ const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
35
104
  });
36
105
  function getPropAlias(prop, tagName) {
37
106
  const a = PropAliases[prop];
38
- return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
39
- }
40
- const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
41
- const SVGElements = /*#__PURE__*/new Set([
42
- "altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
43
- "set", "stop",
44
- "svg", "switch", "symbol", "text", "textPath",
45
- "tref", "tspan", "use", "view", "vkern"]);
107
+ return typeof a === "object" ? (a[tagName] ? a["$"] : undefined) : a;
108
+ }
109
+ const DelegatedEvents = /*#__PURE__*/ new Set([
110
+ "beforeinput",
111
+ "click",
112
+ "dblclick",
113
+ "contextmenu",
114
+ "focusin",
115
+ "focusout",
116
+ "input",
117
+ "keydown",
118
+ "keyup",
119
+ "mousedown",
120
+ "mousemove",
121
+ "mouseout",
122
+ "mouseover",
123
+ "mouseup",
124
+ "pointerdown",
125
+ "pointermove",
126
+ "pointerout",
127
+ "pointerover",
128
+ "pointerup",
129
+ "touchend",
130
+ "touchmove",
131
+ "touchstart"
132
+ ]);
133
+ const SVGElements = /*#__PURE__*/ new Set([
134
+ "altGlyph",
135
+ "altGlyphDef",
136
+ "altGlyphItem",
137
+ "animate",
138
+ "animateColor",
139
+ "animateMotion",
140
+ "animateTransform",
141
+ "circle",
142
+ "clipPath",
143
+ "color-profile",
144
+ "cursor",
145
+ "defs",
146
+ "desc",
147
+ "ellipse",
148
+ "feBlend",
149
+ "feColorMatrix",
150
+ "feComponentTransfer",
151
+ "feComposite",
152
+ "feConvolveMatrix",
153
+ "feDiffuseLighting",
154
+ "feDisplacementMap",
155
+ "feDistantLight",
156
+ "feDropShadow",
157
+ "feFlood",
158
+ "feFuncA",
159
+ "feFuncB",
160
+ "feFuncG",
161
+ "feFuncR",
162
+ "feGaussianBlur",
163
+ "feImage",
164
+ "feMerge",
165
+ "feMergeNode",
166
+ "feMorphology",
167
+ "feOffset",
168
+ "fePointLight",
169
+ "feSpecularLighting",
170
+ "feSpotLight",
171
+ "feTile",
172
+ "feTurbulence",
173
+ "filter",
174
+ "font",
175
+ "font-face",
176
+ "font-face-format",
177
+ "font-face-name",
178
+ "font-face-src",
179
+ "font-face-uri",
180
+ "foreignObject",
181
+ "g",
182
+ "glyph",
183
+ "glyphRef",
184
+ "hkern",
185
+ "image",
186
+ "line",
187
+ "linearGradient",
188
+ "marker",
189
+ "mask",
190
+ "metadata",
191
+ "missing-glyph",
192
+ "mpath",
193
+ "path",
194
+ "pattern",
195
+ "polygon",
196
+ "polyline",
197
+ "radialGradient",
198
+ "rect",
199
+ "set",
200
+ "stop",
201
+ "svg",
202
+ "switch",
203
+ "symbol",
204
+ "text",
205
+ "textPath",
206
+ "tref",
207
+ "tspan",
208
+ "use",
209
+ "view",
210
+ "vkern"
211
+ ]);
46
212
  const SVGNamespace = {
47
213
  xlink: "http://www.w3.org/1999/xlink",
48
214
  xml: "http://www.w3.org/XML/1998/namespace"
49
215
  };
50
- const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input", "h1", "h2", "h3", "h4", "h5", "h6"]);
216
+ const DOMElements = /*#__PURE__*/ new Set([
217
+ "html",
218
+ "base",
219
+ "head",
220
+ "link",
221
+ "meta",
222
+ "style",
223
+ "title",
224
+ "body",
225
+ "address",
226
+ "article",
227
+ "aside",
228
+ "footer",
229
+ "header",
230
+ "main",
231
+ "nav",
232
+ "section",
233
+ "body",
234
+ "blockquote",
235
+ "dd",
236
+ "div",
237
+ "dl",
238
+ "dt",
239
+ "figcaption",
240
+ "figure",
241
+ "hr",
242
+ "li",
243
+ "ol",
244
+ "p",
245
+ "pre",
246
+ "ul",
247
+ "a",
248
+ "abbr",
249
+ "b",
250
+ "bdi",
251
+ "bdo",
252
+ "br",
253
+ "cite",
254
+ "code",
255
+ "data",
256
+ "dfn",
257
+ "em",
258
+ "i",
259
+ "kbd",
260
+ "mark",
261
+ "q",
262
+ "rp",
263
+ "rt",
264
+ "ruby",
265
+ "s",
266
+ "samp",
267
+ "small",
268
+ "span",
269
+ "strong",
270
+ "sub",
271
+ "sup",
272
+ "time",
273
+ "u",
274
+ "var",
275
+ "wbr",
276
+ "area",
277
+ "audio",
278
+ "img",
279
+ "map",
280
+ "track",
281
+ "video",
282
+ "embed",
283
+ "iframe",
284
+ "object",
285
+ "param",
286
+ "picture",
287
+ "portal",
288
+ "source",
289
+ "svg",
290
+ "math",
291
+ "canvas",
292
+ "noscript",
293
+ "script",
294
+ "del",
295
+ "ins",
296
+ "caption",
297
+ "col",
298
+ "colgroup",
299
+ "table",
300
+ "tbody",
301
+ "td",
302
+ "tfoot",
303
+ "th",
304
+ "thead",
305
+ "tr",
306
+ "button",
307
+ "datalist",
308
+ "fieldset",
309
+ "form",
310
+ "input",
311
+ "label",
312
+ "legend",
313
+ "meter",
314
+ "optgroup",
315
+ "option",
316
+ "output",
317
+ "progress",
318
+ "select",
319
+ "textarea",
320
+ "details",
321
+ "dialog",
322
+ "menu",
323
+ "summary",
324
+ "details",
325
+ "slot",
326
+ "template",
327
+ "acronym",
328
+ "applet",
329
+ "basefont",
330
+ "bgsound",
331
+ "big",
332
+ "blink",
333
+ "center",
334
+ "content",
335
+ "dir",
336
+ "font",
337
+ "frame",
338
+ "frameset",
339
+ "hgroup",
340
+ "image",
341
+ "keygen",
342
+ "marquee",
343
+ "menuitem",
344
+ "nobr",
345
+ "noembed",
346
+ "noframes",
347
+ "plaintext",
348
+ "rb",
349
+ "rtc",
350
+ "shadow",
351
+ "spacer",
352
+ "strike",
353
+ "tt",
354
+ "xmp",
355
+ "a",
356
+ "abbr",
357
+ "acronym",
358
+ "address",
359
+ "applet",
360
+ "area",
361
+ "article",
362
+ "aside",
363
+ "audio",
364
+ "b",
365
+ "base",
366
+ "basefont",
367
+ "bdi",
368
+ "bdo",
369
+ "bgsound",
370
+ "big",
371
+ "blink",
372
+ "blockquote",
373
+ "body",
374
+ "br",
375
+ "button",
376
+ "canvas",
377
+ "caption",
378
+ "center",
379
+ "cite",
380
+ "code",
381
+ "col",
382
+ "colgroup",
383
+ "content",
384
+ "data",
385
+ "datalist",
386
+ "dd",
387
+ "del",
388
+ "details",
389
+ "dfn",
390
+ "dialog",
391
+ "dir",
392
+ "div",
393
+ "dl",
394
+ "dt",
395
+ "em",
396
+ "embed",
397
+ "fieldset",
398
+ "figcaption",
399
+ "figure",
400
+ "font",
401
+ "footer",
402
+ "form",
403
+ "frame",
404
+ "frameset",
405
+ "head",
406
+ "header",
407
+ "hgroup",
408
+ "hr",
409
+ "html",
410
+ "i",
411
+ "iframe",
412
+ "image",
413
+ "img",
414
+ "input",
415
+ "ins",
416
+ "kbd",
417
+ "keygen",
418
+ "label",
419
+ "legend",
420
+ "li",
421
+ "link",
422
+ "main",
423
+ "map",
424
+ "mark",
425
+ "marquee",
426
+ "menu",
427
+ "menuitem",
428
+ "meta",
429
+ "meter",
430
+ "nav",
431
+ "nobr",
432
+ "noembed",
433
+ "noframes",
434
+ "noscript",
435
+ "object",
436
+ "ol",
437
+ "optgroup",
438
+ "option",
439
+ "output",
440
+ "p",
441
+ "param",
442
+ "picture",
443
+ "plaintext",
444
+ "portal",
445
+ "pre",
446
+ "progress",
447
+ "q",
448
+ "rb",
449
+ "rp",
450
+ "rt",
451
+ "rtc",
452
+ "ruby",
453
+ "s",
454
+ "samp",
455
+ "script",
456
+ "section",
457
+ "select",
458
+ "shadow",
459
+ "slot",
460
+ "small",
461
+ "source",
462
+ "spacer",
463
+ "span",
464
+ "strike",
465
+ "strong",
466
+ "style",
467
+ "sub",
468
+ "summary",
469
+ "sup",
470
+ "table",
471
+ "tbody",
472
+ "td",
473
+ "template",
474
+ "textarea",
475
+ "tfoot",
476
+ "th",
477
+ "thead",
478
+ "time",
479
+ "title",
480
+ "tr",
481
+ "track",
482
+ "tt",
483
+ "u",
484
+ "ul",
485
+ "var",
486
+ "video",
487
+ "wbr",
488
+ "xmp",
489
+ "input",
490
+ "h1",
491
+ "h2",
492
+ "h3",
493
+ "h4",
494
+ "h5",
495
+ "h6"
496
+ ]);
51
497
 
52
498
  function reconcileArrays(parentNode, a, b) {
53
499
  let bLength = b.length,
@@ -68,7 +514,7 @@ function reconcileArrays(parentNode, a, b) {
68
514
  bEnd--;
69
515
  }
70
516
  if (aEnd === aStart) {
71
- const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
517
+ const node = bEnd < bLength ? (bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart]) : after;
72
518
  while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
73
519
  } else if (bEnd === bStart) {
74
520
  while (aStart < aEnd) {
@@ -109,27 +555,36 @@ function reconcileArrays(parentNode, a, b) {
109
555
  const $$EVENTS = "_$DX_DELEGATE";
110
556
  function render(code, element, init, options = {}) {
111
557
  if (!element) {
112
- throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
558
+ throw new Error(
559
+ "The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document."
560
+ );
113
561
  }
114
562
  let disposer;
115
563
  createRoot(dispose => {
116
564
  disposer = dispose;
117
- element === document ? code() : insert(element, code(), element.firstChild ? null : undefined, init);
565
+ element === document
566
+ ? code()
567
+ : insert(element, code(), element.firstChild ? null : undefined, init);
118
568
  }, options.owner);
119
569
  return () => {
120
570
  disposer();
121
571
  element.textContent = "";
122
572
  };
123
573
  }
124
- function template(html, isCE, isSVG) {
574
+ function template(html, isImportNode, isSVG) {
125
575
  let node;
126
576
  const create = () => {
127
- if (isHydrating()) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
577
+ if (isHydrating())
578
+ throw new Error(
579
+ "Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration."
580
+ );
128
581
  const t = document.createElement("template");
129
582
  t.innerHTML = html;
130
583
  return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
131
584
  };
132
- const fn = isCE ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
585
+ const fn = isImportNode
586
+ ? () => untrack(() => document.importNode(node || (node = create()), true))
587
+ : () => (node || (node = create())).cloneNode(true);
133
588
  fn.cloneNode = fn;
134
589
  return fn;
135
590
  }
@@ -155,15 +610,22 @@ function setProperty(node, name, value) {
155
610
  }
156
611
  function setAttribute(node, name, value) {
157
612
  if (isHydrating(node)) return;
158
- if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
613
+ if (value == null) node.removeAttribute(name);
614
+ else node.setAttribute(name, value);
159
615
  }
160
616
  function setAttributeNS(node, namespace, name, value) {
161
617
  if (isHydrating(node)) return;
162
- if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
618
+ if (value == null) node.removeAttributeNS(namespace, name);
619
+ else node.setAttributeNS(namespace, name, value);
620
+ }
621
+ function setBoolAttribute(node, name, value) {
622
+ if (isHydrating(node)) return;
623
+ value ? node.setAttribute(name, "") : node.removeAttribute(name);
163
624
  }
164
625
  function className(node, value) {
165
626
  if (isHydrating(node)) return;
166
- if (value == null) node.removeAttribute("class");else node.className = value;
627
+ if (value == null) node.removeAttribute("class");
628
+ else node.className = value;
167
629
  }
168
630
  function addEventListener(node, name, handler, delegate) {
169
631
  if (delegate) {
@@ -173,8 +635,8 @@ function addEventListener(node, name, handler, delegate) {
173
635
  } else node[`$$${name}`] = handler;
174
636
  } else if (Array.isArray(handler)) {
175
637
  const handlerFn = handler[0];
176
- node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
177
- } else node.addEventListener(name, handler);
638
+ node.addEventListener(name, (handler[0] = e => handlerFn.call(node, handler[1], e)));
639
+ } else node.addEventListener(name, handler, typeof handler !== "function" && handler);
178
640
  }
179
641
  function classList(node, value, prev = {}) {
180
642
  const classKeys = Object.keys(value || {}),
@@ -198,7 +660,7 @@ function classList(node, value, prev = {}) {
198
660
  function style(node, value, prev) {
199
661
  if (!value) return prev ? setAttribute(node, "style") : value;
200
662
  const nodeStyle = node.style;
201
- if (typeof value === "string") return nodeStyle.cssText = value;
663
+ if (typeof value === "string") return (nodeStyle.cssText = value);
202
664
  typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
203
665
  prev || (prev = {});
204
666
  value || (value = {});
@@ -219,7 +681,9 @@ function style(node, value, prev) {
219
681
  function spread(node, props = {}, isSVG, skipChildren) {
220
682
  const prevProps = {};
221
683
  if (!skipChildren) {
222
- createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
684
+ createRenderEffect(
685
+ () => (prevProps.children = insertExpression(node, props.children, prevProps.children))
686
+ );
223
687
  }
224
688
  createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
225
689
  createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
@@ -248,7 +712,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
248
712
  for (const prop in prevProps) {
249
713
  if (!(prop in props)) {
250
714
  if (prop === "children") continue;
251
- prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
715
+ prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef, props);
252
716
  }
253
717
  }
254
718
  for (const prop in props) {
@@ -257,7 +721,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
257
721
  continue;
258
722
  }
259
723
  const value = props[prop];
260
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
724
+ prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef, props);
261
725
  }
262
726
  }
263
727
  function hydrate$1(code, element, options = {}) {
@@ -283,8 +747,15 @@ function getNextElement(template) {
283
747
  let node,
284
748
  key,
285
749
  hydrating = isHydrating();
286
- if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
287
- if (hydrating) throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
750
+ if (!hydrating || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
751
+ if (hydrating) {
752
+ sharedConfig.done = true;
753
+ throw new Error(
754
+ `Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}\n${
755
+ template ? template().outerHTML : ""
756
+ }`
757
+ );
758
+ }
288
759
  return template();
289
760
  }
290
761
  if (sharedConfig.completed) sharedConfig.completed.add(node);
@@ -303,7 +774,8 @@ function getNextMarker(start) {
303
774
  while (end) {
304
775
  if (end.nodeType === 8) {
305
776
  const v = end.nodeValue;
306
- if (v === "$") count++;else if (v === "/") {
777
+ if (v === "$") count++;
778
+ else if (v === "/") {
307
779
  if (count === 0) return [end, current];
308
780
  count--;
309
781
  }
@@ -317,10 +789,8 @@ function getNextMarker(start) {
317
789
  function runHydrationEvents() {
318
790
  if (sharedConfig.events && !sharedConfig.events.queued) {
319
791
  queueMicrotask(() => {
320
- const {
321
- completed,
322
- events
323
- } = sharedConfig;
792
+ const { completed, events } = sharedConfig;
793
+ if (!events) return;
324
794
  events.queued = false;
325
795
  while (events.length) {
326
796
  const [el, e] = events[0];
@@ -344,9 +814,10 @@ function toPropertyName(name) {
344
814
  }
345
815
  function toggleClassKey(node, key, value) {
346
816
  const classNames = key.trim().split(/\s+/);
347
- for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
817
+ for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
818
+ node.classList.toggle(classNames[i], value);
348
819
  }
349
- function assignProp(node, prop, value, prev, isSVG, skipRef) {
820
+ function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
350
821
  let isCE, isProp, isChildProp, propAlias, forceProp;
351
822
  if (prop === "style") return style(node, value, prev);
352
823
  if (prop === "classList") return classList(node, value, prev);
@@ -355,8 +826,8 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
355
826
  if (!skipRef) value(node);
356
827
  } else if (prop.slice(0, 3) === "on:") {
357
828
  const e = prop.slice(3);
358
- prev && node.removeEventListener(e, prev);
359
- value && node.addEventListener(e, value);
829
+ prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
830
+ value && node.addEventListener(e, value, typeof value !== "function" && value);
360
831
  } else if (prop.slice(0, 10) === "oncapture:") {
361
832
  const e = prop.slice(10);
362
833
  prev && node.removeEventListener(e, prev, true);
@@ -374,15 +845,26 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
374
845
  }
375
846
  } else if (prop.slice(0, 5) === "attr:") {
376
847
  setAttribute(node, prop.slice(5), value);
377
- } else if ((forceProp = prop.slice(0, 5) === "prop:") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
848
+ } else if (prop.slice(0, 5) === "bool:") {
849
+ setBoolAttribute(node, prop.slice(5), value);
850
+ } else if (
851
+ (forceProp = prop.slice(0, 5) === "prop:") ||
852
+ (isChildProp = ChildProperties.has(prop)) ||
853
+ (!isSVG &&
854
+ ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop)))) ||
855
+ (isCE = node.nodeName.includes("-") || "is" in props)
856
+ ) {
378
857
  if (forceProp) {
379
858
  prop = prop.slice(5);
380
859
  isProp = true;
381
860
  } else if (isHydrating(node)) return value;
382
- if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[propAlias || prop] = value;
861
+ if (prop === "class" || prop === "className") className(node, value);
862
+ else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
863
+ else node[propAlias || prop] = value;
383
864
  } else {
384
865
  const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
385
- if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, Aliases[prop] || prop, value);
866
+ if (ns) setAttributeNS(node, ns, prop, value);
867
+ else setAttribute(node, Aliases[prop] || prop, value);
386
868
  }
387
869
  return value;
388
870
  }
@@ -390,14 +872,28 @@ function eventHandler(e) {
390
872
  if (sharedConfig.registry && sharedConfig.events) {
391
873
  if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
392
874
  }
875
+ let node = e.target;
393
876
  const key = `$$${e.type}`;
394
- let node = e.composedPath && e.composedPath()[0] || e.target;
395
- if (e.target !== node) {
877
+ const oriTarget = e.target;
878
+ const oriCurrentTarget = e.currentTarget;
879
+ const retarget = value =>
396
880
  Object.defineProperty(e, "target", {
397
881
  configurable: true,
398
- value: node
882
+ value
399
883
  });
400
- }
884
+ const handleNode = () => {
885
+ const handler = node[key];
886
+ if (handler && !node.disabled) {
887
+ const data = node[`${key}Data`];
888
+ data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
889
+ if (e.cancelBubble) return;
890
+ }
891
+ node.host && node.contains(e.target) && !node.host._$host && retarget(node.host);
892
+ return true;
893
+ };
894
+ const walkUpTree = () => {
895
+ while (handleNode() && (node = node._$host || node.parentNode || node.host));
896
+ };
401
897
  Object.defineProperty(e, "currentTarget", {
402
898
  configurable: true,
403
899
  get() {
@@ -405,15 +901,23 @@ function eventHandler(e) {
405
901
  }
406
902
  });
407
903
  if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
408
- while (node) {
409
- const handler = node[key];
410
- if (handler && !node.disabled) {
411
- const data = node[`${key}Data`];
412
- data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
413
- if (e.cancelBubble) return;
904
+ if (e.composedPath) {
905
+ const path = e.composedPath();
906
+ retarget(path[0]);
907
+ for (let i = 0; i < path.length - 2; i++) {
908
+ node = path[i];
909
+ if (!handleNode()) break;
910
+ if (node._$host) {
911
+ node = node._$host;
912
+ walkUpTree();
913
+ break;
914
+ }
915
+ if (node.parentNode === oriCurrentTarget) {
916
+ break;
917
+ }
414
918
  }
415
- node = node._$host || node.parentNode || node.host;
416
- }
919
+ } else walkUpTree();
920
+ retarget(oriTarget);
417
921
  }
418
922
  function insertExpression(parent, value, current, marker, unwrapArray) {
419
923
  const hydrating = isHydrating(parent);
@@ -422,7 +926,8 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
422
926
  let cleaned = [];
423
927
  for (let i = 0; i < current.length; i++) {
424
928
  const node = current[i];
425
- if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();else cleaned.push(node);
929
+ if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
930
+ else cleaned.push(node);
426
931
  }
427
932
  current = cleaned;
428
933
  }
@@ -430,7 +935,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
430
935
  if (value === current) return current;
431
936
  const t = typeof value,
432
937
  multi = marker !== undefined;
433
- parent = multi && current[0] && current[0].parentNode || parent;
938
+ parent = (multi && current[0] && current[0].parentNode) || parent;
434
939
  if (t === "string" || t === "number") {
435
940
  if (hydrating) return current;
436
941
  if (t === "number") {
@@ -462,17 +967,17 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
462
967
  const array = [];
463
968
  const currentArray = current && Array.isArray(current);
464
969
  if (normalizeIncomingArray(array, value, current, unwrapArray)) {
465
- createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
970
+ createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
466
971
  return () => current;
467
972
  }
468
973
  if (hydrating) {
469
974
  if (!array.length) return current;
470
- if (marker === undefined) return current = [...parent.childNodes];
975
+ if (marker === undefined) return (current = [...parent.childNodes]);
471
976
  let node = array[0];
472
977
  if (node.parentNode !== parent) return current;
473
978
  const nodes = [node];
474
979
  while ((node = node.nextSibling) !== marker) nodes.push(node);
475
- return current = nodes;
980
+ return (current = nodes);
476
981
  }
477
982
  if (array.length === 0) {
478
983
  current = cleanChildren(parent, current, marker);
@@ -487,9 +992,9 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
487
992
  }
488
993
  current = array;
489
994
  } else if (value.nodeType) {
490
- if (hydrating && value.parentNode) return current = multi ? [value] : value;
995
+ if (hydrating && value.parentNode) return (current = multi ? [value] : value);
491
996
  if (Array.isArray(current)) {
492
- if (multi) return current = cleanChildren(parent, current, marker, value);
997
+ if (multi) return (current = cleanChildren(parent, current, marker, value));
493
998
  cleanChildren(parent, current, null, value);
494
999
  } else if (current == null || current === "" || !parent.firstChild) {
495
1000
  parent.appendChild(value);
@@ -504,21 +1009,28 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
504
1009
  let item = array[i],
505
1010
  prev = current && current[normalized.length],
506
1011
  t;
507
- if (item == null || item === true || item === false) ; else if ((t = typeof item) === "object" && item.nodeType) {
1012
+ if (item == null || item === true || item === false);
1013
+ else if ((t = typeof item) === "object" && item.nodeType) {
508
1014
  normalized.push(item);
509
1015
  } else if (Array.isArray(item)) {
510
1016
  dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
511
1017
  } else if (t === "function") {
512
1018
  if (unwrap) {
513
1019
  while (typeof item === "function") item = item();
514
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
1020
+ dynamic =
1021
+ normalizeIncomingArray(
1022
+ normalized,
1023
+ Array.isArray(item) ? item : [item],
1024
+ Array.isArray(prev) ? prev : [prev]
1025
+ ) || dynamic;
515
1026
  } else {
516
1027
  normalized.push(item);
517
1028
  dynamic = true;
518
1029
  }
519
1030
  } else {
520
1031
  const value = String(item);
521
- if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);else normalized.push(document.createTextNode(value));
1032
+ if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
1033
+ else normalized.push(document.createTextNode(value));
522
1034
  }
523
1035
  }
524
1036
  return dynamic;
@@ -527,7 +1039,7 @@ function appendNodes(parent, array, marker = null) {
527
1039
  for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
528
1040
  }
529
1041
  function cleanChildren(parent, current, marker, replacement) {
530
- if (marker === undefined) return parent.textContent = "";
1042
+ if (marker === undefined) return (parent.textContent = "");
531
1043
  const node = replacement || document.createTextNode("");
532
1044
  if (current.length) {
533
1045
  let inserted = false;
@@ -535,7 +1047,9 @@ function cleanChildren(parent, current, marker, replacement) {
535
1047
  const el = current[i];
536
1048
  if (node !== el) {
537
1049
  const isParent = el.parentNode === parent;
538
- if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();
1050
+ if (!inserted && !i)
1051
+ isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
1052
+ else isParent && el.remove();
539
1053
  } else inserted = true;
540
1054
  }
541
1055
  } else parent.insertBefore(node, marker);
@@ -546,7 +1060,8 @@ function gatherHydratable(element, root) {
546
1060
  for (let i = 0; i < templates.length; i++) {
547
1061
  const node = templates[i];
548
1062
  const key = node.getAttribute("data-hk");
549
- if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
1063
+ if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
1064
+ sharedConfig.registry.set(key, node);
550
1065
  }
551
1066
  }
552
1067
  function getHydrationKey() {
@@ -598,42 +1113,47 @@ const hydrate = (...args) => {
598
1113
  return hydrate$1(...args);
599
1114
  };
600
1115
  function Portal(props) {
601
- const {
602
- useShadow
603
- } = props,
1116
+ const { useShadow } = props,
604
1117
  marker = document.createTextNode(""),
605
1118
  mount = () => props.mount || document.body,
606
1119
  owner = getOwner();
607
1120
  let content;
608
1121
  let hydrating = !!sharedConfig.context;
609
- createEffect(() => {
610
- if (hydrating) getOwner().user = hydrating = false;
611
- content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
612
- const el = mount();
613
- if (el instanceof HTMLHeadElement) {
614
- const [clean, setClean] = createSignal(false);
615
- const cleanup = () => setClean(true);
616
- createRoot(dispose => insert(el, () => !clean() ? content() : dispose(), null));
617
- onCleanup(cleanup);
618
- } else {
619
- const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
620
- renderRoot = useShadow && container.attachShadow ? container.attachShadow({
621
- mode: "open"
622
- }) : container;
623
- Object.defineProperty(container, "_$host", {
624
- get() {
625
- return marker.parentNode;
626
- },
627
- configurable: true
628
- });
629
- insert(renderRoot, content);
630
- el.appendChild(container);
631
- props.ref && props.ref(container);
632
- onCleanup(() => el.removeChild(container));
1122
+ createEffect(
1123
+ () => {
1124
+ if (hydrating) getOwner().user = hydrating = false;
1125
+ content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
1126
+ const el = mount();
1127
+ if (el instanceof HTMLHeadElement) {
1128
+ const [clean, setClean] = createSignal(false);
1129
+ const cleanup = () => setClean(true);
1130
+ createRoot(dispose => insert(el, () => (!clean() ? content() : dispose()), null));
1131
+ onCleanup(cleanup);
1132
+ } else {
1133
+ const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
1134
+ renderRoot =
1135
+ useShadow && container.attachShadow
1136
+ ? container.attachShadow({
1137
+ mode: "open"
1138
+ })
1139
+ : container;
1140
+ Object.defineProperty(container, "_$host", {
1141
+ get() {
1142
+ return marker.parentNode;
1143
+ },
1144
+ configurable: true
1145
+ });
1146
+ insert(renderRoot, content);
1147
+ el.appendChild(container);
1148
+ props.ref && props.ref(container);
1149
+ onCleanup(() => el.removeChild(container));
1150
+ }
1151
+ },
1152
+ undefined,
1153
+ {
1154
+ render: !hydrating
633
1155
  }
634
- }, undefined, {
635
- render: !hydrating
636
- });
1156
+ );
637
1157
  return marker;
638
1158
  }
639
1159
  function Dynamic(props) {
@@ -656,4 +1176,62 @@ function Dynamic(props) {
656
1176
  });
657
1177
  }
658
1178
 
659
- export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getPropAlias, voidFn as getRequestEvent, hydrate, innerHTML, insert, isDev, isServer, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, style, template, use, voidFn as useAssets };
1179
+ export {
1180
+ Aliases,
1181
+ voidFn as Assets,
1182
+ ChildProperties,
1183
+ DOMElements,
1184
+ DelegatedEvents,
1185
+ Dynamic,
1186
+ Hydration,
1187
+ voidFn as HydrationScript,
1188
+ NoHydration,
1189
+ Portal,
1190
+ Properties,
1191
+ RequestContext,
1192
+ SVGElements,
1193
+ SVGNamespace,
1194
+ addEventListener,
1195
+ assign,
1196
+ classList,
1197
+ className,
1198
+ clearDelegatedEvents,
1199
+ delegateEvents,
1200
+ dynamicProperty,
1201
+ escape,
1202
+ voidFn as generateHydrationScript,
1203
+ voidFn as getAssets,
1204
+ getHydrationKey,
1205
+ getNextElement,
1206
+ getNextMarker,
1207
+ getNextMatch,
1208
+ getPropAlias,
1209
+ voidFn as getRequestEvent,
1210
+ hydrate,
1211
+ innerHTML,
1212
+ insert,
1213
+ isDev,
1214
+ isServer,
1215
+ render,
1216
+ renderToStream,
1217
+ renderToString,
1218
+ renderToStringAsync,
1219
+ resolveSSRNode,
1220
+ runHydrationEvents,
1221
+ setAttribute,
1222
+ setAttributeNS,
1223
+ setBoolAttribute,
1224
+ setProperty,
1225
+ spread,
1226
+ ssr,
1227
+ ssrAttribute,
1228
+ ssrClassList,
1229
+ ssrElement,
1230
+ ssrHydrationKey,
1231
+ ssrSpread,
1232
+ ssrStyle,
1233
+ style,
1234
+ template,
1235
+ use,
1236
+ voidFn as useAssets
1237
+ };