solid-js 1.8.19 → 1.8.21

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 (48) hide show
  1. package/dist/dev.cjs +6 -6
  2. package/dist/dev.js +562 -321
  3. package/dist/server.js +168 -74
  4. package/dist/solid.cjs +6 -6
  5. package/dist/solid.js +489 -279
  6. package/h/dist/h.js +38 -9
  7. package/h/jsx-runtime/dist/jsx.js +1 -1
  8. package/h/jsx-runtime/types/index.d.ts +11 -8
  9. package/h/types/hyperscript.d.ts +11 -11
  10. package/html/dist/html.js +216 -94
  11. package/html/types/lit.d.ts +47 -33
  12. package/package.json +1 -1
  13. package/store/dist/dev.js +122 -43
  14. package/store/dist/server.js +19 -8
  15. package/store/dist/store.js +113 -40
  16. package/store/types/index.d.ts +21 -7
  17. package/store/types/modifiers.d.ts +6 -3
  18. package/store/types/mutable.d.ts +5 -2
  19. package/store/types/server.d.ts +12 -4
  20. package/store/types/store.d.ts +218 -61
  21. package/types/index.d.ts +75 -10
  22. package/types/jsx.d.ts +913 -862
  23. package/types/reactive/array.d.ts +12 -4
  24. package/types/reactive/observable.d.ts +25 -17
  25. package/types/reactive/scheduler.d.ts +9 -6
  26. package/types/reactive/signal.d.ts +233 -142
  27. package/types/render/Suspense.d.ts +5 -5
  28. package/types/render/component.d.ts +64 -33
  29. package/types/render/flow.d.ts +43 -31
  30. package/types/render/hydration.d.ts +15 -15
  31. package/types/server/index.d.ts +57 -2
  32. package/types/server/reactive.d.ts +73 -42
  33. package/types/server/rendering.d.ts +169 -98
  34. package/universal/dist/dev.js +28 -12
  35. package/universal/dist/universal.js +28 -12
  36. package/universal/types/index.d.ts +3 -1
  37. package/universal/types/universal.d.ts +0 -1
  38. package/web/dist/dev.cjs +34 -18
  39. package/web/dist/dev.js +655 -97
  40. package/web/dist/server.cjs +1 -1
  41. package/web/dist/server.js +210 -96
  42. package/web/dist/web.cjs +32 -16
  43. package/web/dist/web.js +646 -95
  44. package/web/storage/dist/storage.js +3 -3
  45. package/web/types/client.d.ts +2 -2
  46. package/web/types/core.d.ts +10 -1
  47. package/web/types/index.d.ts +27 -10
  48. package/web/types/server-mock.d.ts +47 -32
package/web/dist/web.js CHANGED
@@ -1,14 +1,82 @@
1
- import { createRoot, sharedConfig, createRenderEffect, untrack, enableHydration, getOwner, createEffect, runWithOwner, createMemo, createSignal, onCleanup, splitProps } 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
+ } 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 = ["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), {
32
+ const booleans = [
33
+ "allowfullscreen",
34
+ "async",
35
+ "autofocus",
36
+ "autoplay",
37
+ "checked",
38
+ "controls",
39
+ "default",
40
+ "disabled",
41
+ "formnovalidate",
42
+ "hidden",
43
+ "indeterminate",
44
+ "inert",
45
+ "ismap",
46
+ "loop",
47
+ "multiple",
48
+ "muted",
49
+ "nomodule",
50
+ "novalidate",
51
+ "open",
52
+ "playsinline",
53
+ "readonly",
54
+ "required",
55
+ "reversed",
56
+ "seamless",
57
+ "selected"
58
+ ];
59
+ const Properties = /*#__PURE__*/ new Set([
60
+ "className",
61
+ "value",
62
+ "readOnly",
63
+ "formNoValidate",
64
+ "isMap",
65
+ "noModule",
66
+ "playsInline",
67
+ ...booleans
68
+ ]);
69
+ const ChildProperties = /*#__PURE__*/ new Set([
70
+ "innerHTML",
71
+ "textContent",
72
+ "innerText",
73
+ "children"
74
+ ]);
75
+ const Aliases = /*#__PURE__*/ Object.assign(Object.create(null), {
8
76
  className: "class",
9
77
  htmlFor: "for"
10
78
  });
11
- const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
79
+ const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
12
80
  class: "className",
13
81
  formnovalidate: {
14
82
  $: "formNoValidate",
@@ -35,19 +103,396 @@ const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
35
103
  });
36
104
  function getPropAlias(prop, tagName) {
37
105
  const a = PropAliases[prop];
38
- return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
39
- }
40
- const DelegatedEvents = /*#__PURE__*/new Set(["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"]);
106
+ return typeof a === "object" ? (a[tagName] ? a["$"] : undefined) : a;
107
+ }
108
+ const DelegatedEvents = /*#__PURE__*/ new Set([
109
+ "beforeinput",
110
+ "click",
111
+ "dblclick",
112
+ "contextmenu",
113
+ "focusin",
114
+ "focusout",
115
+ "input",
116
+ "keydown",
117
+ "keyup",
118
+ "mousedown",
119
+ "mousemove",
120
+ "mouseout",
121
+ "mouseover",
122
+ "mouseup",
123
+ "pointerdown",
124
+ "pointermove",
125
+ "pointerout",
126
+ "pointerover",
127
+ "pointerup",
128
+ "touchend",
129
+ "touchmove",
130
+ "touchstart"
131
+ ]);
132
+ const SVGElements = /*#__PURE__*/ new Set([
133
+ "altGlyph",
134
+ "altGlyphDef",
135
+ "altGlyphItem",
136
+ "animate",
137
+ "animateColor",
138
+ "animateMotion",
139
+ "animateTransform",
140
+ "circle",
141
+ "clipPath",
142
+ "color-profile",
143
+ "cursor",
144
+ "defs",
145
+ "desc",
146
+ "ellipse",
147
+ "feBlend",
148
+ "feColorMatrix",
149
+ "feComponentTransfer",
150
+ "feComposite",
151
+ "feConvolveMatrix",
152
+ "feDiffuseLighting",
153
+ "feDisplacementMap",
154
+ "feDistantLight",
155
+ "feDropShadow",
156
+ "feFlood",
157
+ "feFuncA",
158
+ "feFuncB",
159
+ "feFuncG",
160
+ "feFuncR",
161
+ "feGaussianBlur",
162
+ "feImage",
163
+ "feMerge",
164
+ "feMergeNode",
165
+ "feMorphology",
166
+ "feOffset",
167
+ "fePointLight",
168
+ "feSpecularLighting",
169
+ "feSpotLight",
170
+ "feTile",
171
+ "feTurbulence",
172
+ "filter",
173
+ "font",
174
+ "font-face",
175
+ "font-face-format",
176
+ "font-face-name",
177
+ "font-face-src",
178
+ "font-face-uri",
179
+ "foreignObject",
180
+ "g",
181
+ "glyph",
182
+ "glyphRef",
183
+ "hkern",
184
+ "image",
185
+ "line",
186
+ "linearGradient",
187
+ "marker",
188
+ "mask",
189
+ "metadata",
190
+ "missing-glyph",
191
+ "mpath",
192
+ "path",
193
+ "pattern",
194
+ "polygon",
195
+ "polyline",
196
+ "radialGradient",
197
+ "rect",
198
+ "set",
199
+ "stop",
200
+ "svg",
201
+ "switch",
202
+ "symbol",
203
+ "text",
204
+ "textPath",
205
+ "tref",
206
+ "tspan",
207
+ "use",
208
+ "view",
209
+ "vkern"
210
+ ]);
46
211
  const SVGNamespace = {
47
212
  xlink: "http://www.w3.org/1999/xlink",
48
213
  xml: "http://www.w3.org/XML/1998/namespace"
49
214
  };
50
- const DOMElements = /*#__PURE__*/new Set(["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"]);
215
+ const DOMElements = /*#__PURE__*/ new Set([
216
+ "html",
217
+ "base",
218
+ "head",
219
+ "link",
220
+ "meta",
221
+ "style",
222
+ "title",
223
+ "body",
224
+ "address",
225
+ "article",
226
+ "aside",
227
+ "footer",
228
+ "header",
229
+ "main",
230
+ "nav",
231
+ "section",
232
+ "body",
233
+ "blockquote",
234
+ "dd",
235
+ "div",
236
+ "dl",
237
+ "dt",
238
+ "figcaption",
239
+ "figure",
240
+ "hr",
241
+ "li",
242
+ "ol",
243
+ "p",
244
+ "pre",
245
+ "ul",
246
+ "a",
247
+ "abbr",
248
+ "b",
249
+ "bdi",
250
+ "bdo",
251
+ "br",
252
+ "cite",
253
+ "code",
254
+ "data",
255
+ "dfn",
256
+ "em",
257
+ "i",
258
+ "kbd",
259
+ "mark",
260
+ "q",
261
+ "rp",
262
+ "rt",
263
+ "ruby",
264
+ "s",
265
+ "samp",
266
+ "small",
267
+ "span",
268
+ "strong",
269
+ "sub",
270
+ "sup",
271
+ "time",
272
+ "u",
273
+ "var",
274
+ "wbr",
275
+ "area",
276
+ "audio",
277
+ "img",
278
+ "map",
279
+ "track",
280
+ "video",
281
+ "embed",
282
+ "iframe",
283
+ "object",
284
+ "param",
285
+ "picture",
286
+ "portal",
287
+ "source",
288
+ "svg",
289
+ "math",
290
+ "canvas",
291
+ "noscript",
292
+ "script",
293
+ "del",
294
+ "ins",
295
+ "caption",
296
+ "col",
297
+ "colgroup",
298
+ "table",
299
+ "tbody",
300
+ "td",
301
+ "tfoot",
302
+ "th",
303
+ "thead",
304
+ "tr",
305
+ "button",
306
+ "datalist",
307
+ "fieldset",
308
+ "form",
309
+ "input",
310
+ "label",
311
+ "legend",
312
+ "meter",
313
+ "optgroup",
314
+ "option",
315
+ "output",
316
+ "progress",
317
+ "select",
318
+ "textarea",
319
+ "details",
320
+ "dialog",
321
+ "menu",
322
+ "summary",
323
+ "details",
324
+ "slot",
325
+ "template",
326
+ "acronym",
327
+ "applet",
328
+ "basefont",
329
+ "bgsound",
330
+ "big",
331
+ "blink",
332
+ "center",
333
+ "content",
334
+ "dir",
335
+ "font",
336
+ "frame",
337
+ "frameset",
338
+ "hgroup",
339
+ "image",
340
+ "keygen",
341
+ "marquee",
342
+ "menuitem",
343
+ "nobr",
344
+ "noembed",
345
+ "noframes",
346
+ "plaintext",
347
+ "rb",
348
+ "rtc",
349
+ "shadow",
350
+ "spacer",
351
+ "strike",
352
+ "tt",
353
+ "xmp",
354
+ "a",
355
+ "abbr",
356
+ "acronym",
357
+ "address",
358
+ "applet",
359
+ "area",
360
+ "article",
361
+ "aside",
362
+ "audio",
363
+ "b",
364
+ "base",
365
+ "basefont",
366
+ "bdi",
367
+ "bdo",
368
+ "bgsound",
369
+ "big",
370
+ "blink",
371
+ "blockquote",
372
+ "body",
373
+ "br",
374
+ "button",
375
+ "canvas",
376
+ "caption",
377
+ "center",
378
+ "cite",
379
+ "code",
380
+ "col",
381
+ "colgroup",
382
+ "content",
383
+ "data",
384
+ "datalist",
385
+ "dd",
386
+ "del",
387
+ "details",
388
+ "dfn",
389
+ "dialog",
390
+ "dir",
391
+ "div",
392
+ "dl",
393
+ "dt",
394
+ "em",
395
+ "embed",
396
+ "fieldset",
397
+ "figcaption",
398
+ "figure",
399
+ "font",
400
+ "footer",
401
+ "form",
402
+ "frame",
403
+ "frameset",
404
+ "head",
405
+ "header",
406
+ "hgroup",
407
+ "hr",
408
+ "html",
409
+ "i",
410
+ "iframe",
411
+ "image",
412
+ "img",
413
+ "input",
414
+ "ins",
415
+ "kbd",
416
+ "keygen",
417
+ "label",
418
+ "legend",
419
+ "li",
420
+ "link",
421
+ "main",
422
+ "map",
423
+ "mark",
424
+ "marquee",
425
+ "menu",
426
+ "menuitem",
427
+ "meta",
428
+ "meter",
429
+ "nav",
430
+ "nobr",
431
+ "noembed",
432
+ "noframes",
433
+ "noscript",
434
+ "object",
435
+ "ol",
436
+ "optgroup",
437
+ "option",
438
+ "output",
439
+ "p",
440
+ "param",
441
+ "picture",
442
+ "plaintext",
443
+ "portal",
444
+ "pre",
445
+ "progress",
446
+ "q",
447
+ "rb",
448
+ "rp",
449
+ "rt",
450
+ "rtc",
451
+ "ruby",
452
+ "s",
453
+ "samp",
454
+ "script",
455
+ "section",
456
+ "select",
457
+ "shadow",
458
+ "slot",
459
+ "small",
460
+ "source",
461
+ "spacer",
462
+ "span",
463
+ "strike",
464
+ "strong",
465
+ "style",
466
+ "sub",
467
+ "summary",
468
+ "sup",
469
+ "table",
470
+ "tbody",
471
+ "td",
472
+ "template",
473
+ "textarea",
474
+ "tfoot",
475
+ "th",
476
+ "thead",
477
+ "time",
478
+ "title",
479
+ "tr",
480
+ "track",
481
+ "tt",
482
+ "u",
483
+ "ul",
484
+ "var",
485
+ "video",
486
+ "wbr",
487
+ "xmp",
488
+ "input",
489
+ "h1",
490
+ "h2",
491
+ "h3",
492
+ "h4",
493
+ "h5",
494
+ "h6"
495
+ ]);
51
496
 
52
497
  function reconcileArrays(parentNode, a, b) {
53
498
  let bLength = b.length,
@@ -68,7 +513,7 @@ function reconcileArrays(parentNode, a, b) {
68
513
  bEnd--;
69
514
  }
70
515
  if (aEnd === aStart) {
71
- const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
516
+ const node = bEnd < bLength ? (bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart]) : after;
72
517
  while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
73
518
  } else if (bEnd === bStart) {
74
519
  while (aStart < aEnd) {
@@ -111,7 +556,9 @@ function render(code, element, init, options = {}) {
111
556
  let disposer;
112
557
  createRoot(dispose => {
113
558
  disposer = dispose;
114
- element === document ? code() : insert(element, code(), element.firstChild ? null : undefined, init);
559
+ element === document
560
+ ? code()
561
+ : insert(element, code(), element.firstChild ? null : undefined, init);
115
562
  }, options.owner);
116
563
  return () => {
117
564
  disposer();
@@ -125,7 +572,9 @@ function template(html, isCE, isSVG) {
125
572
  t.innerHTML = html;
126
573
  return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
127
574
  };
128
- const fn = isCE ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
575
+ const fn = isCE
576
+ ? () => untrack(() => document.importNode(node || (node = create()), true))
577
+ : () => (node || (node = create())).cloneNode(true);
129
578
  fn.cloneNode = fn;
130
579
  return fn;
131
580
  }
@@ -146,20 +595,23 @@ function clearDelegatedEvents(document = window.document) {
146
595
  }
147
596
  }
148
597
  function setProperty(node, name, value) {
149
- if (!!sharedConfig.context && node.isConnected) return;
598
+ if (isHydrating(node)) return;
150
599
  node[name] = value;
151
600
  }
152
601
  function setAttribute(node, name, value) {
153
- if (!!sharedConfig.context && node.isConnected) return;
154
- if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
602
+ if (isHydrating(node)) return;
603
+ if (value == null) node.removeAttribute(name);
604
+ else node.setAttribute(name, value);
155
605
  }
156
606
  function setAttributeNS(node, namespace, name, value) {
157
- if (!!sharedConfig.context && node.isConnected) return;
158
- if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
607
+ if (isHydrating(node)) return;
608
+ if (value == null) node.removeAttributeNS(namespace, name);
609
+ else node.setAttributeNS(namespace, name, value);
159
610
  }
160
611
  function className(node, value) {
161
- if (!!sharedConfig.context && node.isConnected) return;
162
- if (value == null) node.removeAttribute("class");else node.className = value;
612
+ if (isHydrating(node)) return;
613
+ if (value == null) node.removeAttribute("class");
614
+ else node.className = value;
163
615
  }
164
616
  function addEventListener(node, name, handler, delegate) {
165
617
  if (delegate) {
@@ -169,7 +621,7 @@ function addEventListener(node, name, handler, delegate) {
169
621
  } else node[`$$${name}`] = handler;
170
622
  } else if (Array.isArray(handler)) {
171
623
  const handlerFn = handler[0];
172
- node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
624
+ node.addEventListener(name, (handler[0] = e => handlerFn.call(node, handler[1], e)));
173
625
  } else node.addEventListener(name, handler);
174
626
  }
175
627
  function classList(node, value, prev = {}) {
@@ -194,7 +646,7 @@ function classList(node, value, prev = {}) {
194
646
  function style(node, value, prev) {
195
647
  if (!value) return prev ? setAttribute(node, "style") : value;
196
648
  const nodeStyle = node.style;
197
- if (typeof value === "string") return nodeStyle.cssText = value;
649
+ if (typeof value === "string") return (nodeStyle.cssText = value);
198
650
  typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
199
651
  prev || (prev = {});
200
652
  value || (value = {});
@@ -215,7 +667,9 @@ function style(node, value, prev) {
215
667
  function spread(node, props = {}, isSVG, skipChildren) {
216
668
  const prevProps = {};
217
669
  if (!skipChildren) {
218
- createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
670
+ createRenderEffect(
671
+ () => (prevProps.children = insertExpression(node, props.children, prevProps.children))
672
+ );
219
673
  }
220
674
  createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
221
675
  createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
@@ -257,6 +711,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
257
711
  }
258
712
  }
259
713
  function hydrate$1(code, element, options = {}) {
714
+ if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
260
715
  sharedConfig.completed = globalThis._$HY.completed;
261
716
  sharedConfig.events = globalThis._$HY.events;
262
717
  sharedConfig.load = id => globalThis._$HY.r[id];
@@ -267,14 +722,18 @@ function hydrate$1(code, element, options = {}) {
267
722
  id: options.renderId || "",
268
723
  count: 0
269
724
  };
270
- gatherHydratable(element, options.renderId);
271
- const dispose = render(code, element, [...element.childNodes], options);
272
- sharedConfig.context = null;
273
- return dispose;
725
+ try {
726
+ gatherHydratable(element, options.renderId);
727
+ return render(code, element, [...element.childNodes], options);
728
+ } finally {
729
+ sharedConfig.context = null;
730
+ }
274
731
  }
275
732
  function getNextElement(template) {
276
- let node, key;
277
- if (!sharedConfig.context || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
733
+ let node,
734
+ key,
735
+ hydrating = isHydrating();
736
+ if (!hydrating || !(node = sharedConfig.registry.get((key = getHydrationKey())))) {
278
737
  return template();
279
738
  }
280
739
  if (sharedConfig.completed) sharedConfig.completed.add(node);
@@ -289,11 +748,12 @@ function getNextMarker(start) {
289
748
  let end = start,
290
749
  count = 0,
291
750
  current = [];
292
- if (sharedConfig.context) {
751
+ if (isHydrating(start)) {
293
752
  while (end) {
294
753
  if (end.nodeType === 8) {
295
754
  const v = end.nodeValue;
296
- if (v === "$") count++;else if (v === "/") {
755
+ if (v === "$") count++;
756
+ else if (v === "/") {
297
757
  if (count === 0) return [end, current];
298
758
  count--;
299
759
  }
@@ -307,27 +767,32 @@ function getNextMarker(start) {
307
767
  function runHydrationEvents() {
308
768
  if (sharedConfig.events && !sharedConfig.events.queued) {
309
769
  queueMicrotask(() => {
310
- const {
311
- completed,
312
- events
313
- } = sharedConfig;
770
+ const { completed, events } = sharedConfig;
314
771
  events.queued = false;
315
772
  while (events.length) {
316
773
  const [el, e] = events[0];
317
774
  if (!completed.has(el)) return;
318
- eventHandler(e);
319
775
  events.shift();
776
+ eventHandler(e);
777
+ }
778
+ if (sharedConfig.done) {
779
+ sharedConfig.events = _$HY.events = null;
780
+ sharedConfig.completed = _$HY.completed = null;
320
781
  }
321
782
  });
322
783
  sharedConfig.events.queued = true;
323
784
  }
324
785
  }
786
+ function isHydrating(node) {
787
+ return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
788
+ }
325
789
  function toPropertyName(name) {
326
790
  return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
327
791
  }
328
792
  function toggleClassKey(node, key, value) {
329
793
  const classNames = key.trim().split(/\s+/);
330
- for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
794
+ for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
795
+ node.classList.toggle(classNames[i], value);
331
796
  }
332
797
  function assignProp(node, prop, value, prev, isSVG, skipRef) {
333
798
  let isCE, isProp, isChildProp, propAlias, forceProp;
@@ -357,21 +822,33 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
357
822
  }
358
823
  } else if (prop.slice(0, 5) === "attr:") {
359
824
  setAttribute(node, prop.slice(5), value);
360
- } 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("-"))) {
825
+ } else if (
826
+ (forceProp = prop.slice(0, 5) === "prop:") ||
827
+ (isChildProp = ChildProperties.has(prop)) ||
828
+ (!isSVG &&
829
+ ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop)))) ||
830
+ (isCE = node.nodeName.includes("-"))
831
+ ) {
361
832
  if (forceProp) {
362
833
  prop = prop.slice(5);
363
834
  isProp = true;
364
- } else if (!!sharedConfig.context && node.isConnected) return value;
365
- if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[propAlias || prop] = value;
835
+ } else if (isHydrating(node)) return value;
836
+ if (prop === "class" || prop === "className") className(node, value);
837
+ else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
838
+ else node[propAlias || prop] = value;
366
839
  } else {
367
840
  const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
368
- if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, Aliases[prop] || prop, value);
841
+ if (ns) setAttributeNS(node, ns, prop, value);
842
+ else setAttribute(node, Aliases[prop] || prop, value);
369
843
  }
370
844
  return value;
371
845
  }
372
846
  function eventHandler(e) {
847
+ if (sharedConfig.registry && sharedConfig.events) {
848
+ if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
849
+ }
373
850
  const key = `$$${e.type}`;
374
- let node = e.composedPath && e.composedPath()[0] || e.target;
851
+ let node = (e.composedPath && e.composedPath()[0]) || e.target;
375
852
  if (e.target !== node) {
376
853
  Object.defineProperty(e, "target", {
377
854
  configurable: true,
@@ -396,13 +873,14 @@ function eventHandler(e) {
396
873
  }
397
874
  }
398
875
  function insertExpression(parent, value, current, marker, unwrapArray) {
399
- const hydrating = !!sharedConfig.context && parent.isConnected;
876
+ const hydrating = isHydrating(parent);
400
877
  if (hydrating) {
401
878
  !current && (current = [...parent.childNodes]);
402
879
  let cleaned = [];
403
880
  for (let i = 0; i < current.length; i++) {
404
881
  const node = current[i];
405
- if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();else cleaned.push(node);
882
+ if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
883
+ else cleaned.push(node);
406
884
  }
407
885
  current = cleaned;
408
886
  }
@@ -410,7 +888,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
410
888
  if (value === current) return current;
411
889
  const t = typeof value,
412
890
  multi = marker !== undefined;
413
- parent = multi && current[0] && current[0].parentNode || parent;
891
+ parent = (multi && current[0] && current[0].parentNode) || parent;
414
892
  if (t === "string" || t === "number") {
415
893
  if (hydrating) return current;
416
894
  if (t === "number") {
@@ -442,16 +920,17 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
442
920
  const array = [];
443
921
  const currentArray = current && Array.isArray(current);
444
922
  if (normalizeIncomingArray(array, value, current, unwrapArray)) {
445
- createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
923
+ createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
446
924
  return () => current;
447
925
  }
448
926
  if (hydrating) {
449
927
  if (!array.length) return current;
450
- if (marker === undefined) return [...parent.childNodes];
928
+ if (marker === undefined) return (current = [...parent.childNodes]);
451
929
  let node = array[0];
452
- let nodes = [node];
930
+ if (node.parentNode !== parent) return current;
931
+ const nodes = [node];
453
932
  while ((node = node.nextSibling) !== marker) nodes.push(node);
454
- return current = nodes;
933
+ return (current = nodes);
455
934
  }
456
935
  if (array.length === 0) {
457
936
  current = cleanChildren(parent, current, marker);
@@ -466,15 +945,15 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
466
945
  }
467
946
  current = array;
468
947
  } else if (value.nodeType) {
469
- if (hydrating && value.parentNode) return current = multi ? [value] : value;
948
+ if (hydrating && value.parentNode) return (current = multi ? [value] : value);
470
949
  if (Array.isArray(current)) {
471
- if (multi) return current = cleanChildren(parent, current, marker, value);
950
+ if (multi) return (current = cleanChildren(parent, current, marker, value));
472
951
  cleanChildren(parent, current, null, value);
473
952
  } else if (current == null || current === "" || !parent.firstChild) {
474
953
  parent.appendChild(value);
475
954
  } else parent.replaceChild(value, parent.firstChild);
476
955
  current = value;
477
- } else ;
956
+ } else;
478
957
  return current;
479
958
  }
480
959
  function normalizeIncomingArray(normalized, array, current, unwrap) {
@@ -483,21 +962,28 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
483
962
  let item = array[i],
484
963
  prev = current && current[normalized.length],
485
964
  t;
486
- if (item == null || item === true || item === false) ; else if ((t = typeof item) === "object" && item.nodeType) {
965
+ if (item == null || item === true || item === false);
966
+ else if ((t = typeof item) === "object" && item.nodeType) {
487
967
  normalized.push(item);
488
968
  } else if (Array.isArray(item)) {
489
969
  dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
490
970
  } else if (t === "function") {
491
971
  if (unwrap) {
492
972
  while (typeof item === "function") item = item();
493
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
973
+ dynamic =
974
+ normalizeIncomingArray(
975
+ normalized,
976
+ Array.isArray(item) ? item : [item],
977
+ Array.isArray(prev) ? prev : [prev]
978
+ ) || dynamic;
494
979
  } else {
495
980
  normalized.push(item);
496
981
  dynamic = true;
497
982
  }
498
983
  } else {
499
984
  const value = String(item);
500
- if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);else normalized.push(document.createTextNode(value));
985
+ if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
986
+ else normalized.push(document.createTextNode(value));
501
987
  }
502
988
  }
503
989
  return dynamic;
@@ -506,7 +992,7 @@ function appendNodes(parent, array, marker = null) {
506
992
  for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
507
993
  }
508
994
  function cleanChildren(parent, current, marker, replacement) {
509
- if (marker === undefined) return parent.textContent = "";
995
+ if (marker === undefined) return (parent.textContent = "");
510
996
  const node = replacement || document.createTextNode("");
511
997
  if (current.length) {
512
998
  let inserted = false;
@@ -514,7 +1000,9 @@ function cleanChildren(parent, current, marker, replacement) {
514
1000
  const el = current[i];
515
1001
  if (node !== el) {
516
1002
  const isParent = el.parentNode === parent;
517
- if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();
1003
+ if (!inserted && !i)
1004
+ isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
1005
+ else isParent && el.remove();
518
1006
  } else inserted = true;
519
1007
  }
520
1008
  } else parent.insertBefore(node, marker);
@@ -525,7 +1013,8 @@ function gatherHydratable(element, root) {
525
1013
  for (let i = 0; i < templates.length; i++) {
526
1014
  const node = templates[i];
527
1015
  const key = node.getAttribute("data-hk");
528
- if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
1016
+ if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
1017
+ sharedConfig.registry.set(key, node);
529
1018
  }
530
1019
  }
531
1020
  function getHydrationKey() {
@@ -577,42 +1066,47 @@ const hydrate = (...args) => {
577
1066
  return hydrate$1(...args);
578
1067
  };
579
1068
  function Portal(props) {
580
- const {
581
- useShadow
582
- } = props,
1069
+ const { useShadow } = props,
583
1070
  marker = document.createTextNode(""),
584
1071
  mount = () => props.mount || document.body,
585
1072
  owner = getOwner();
586
1073
  let content;
587
1074
  let hydrating = !!sharedConfig.context;
588
- createEffect(() => {
589
- if (hydrating) getOwner().user = hydrating = false;
590
- content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
591
- const el = mount();
592
- if (el instanceof HTMLHeadElement) {
593
- const [clean, setClean] = createSignal(false);
594
- const cleanup = () => setClean(true);
595
- createRoot(dispose => insert(el, () => !clean() ? content() : dispose(), null));
596
- onCleanup(cleanup);
597
- } else {
598
- const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
599
- renderRoot = useShadow && container.attachShadow ? container.attachShadow({
600
- mode: "open"
601
- }) : container;
602
- Object.defineProperty(container, "_$host", {
603
- get() {
604
- return marker.parentNode;
605
- },
606
- configurable: true
607
- });
608
- insert(renderRoot, content);
609
- el.appendChild(container);
610
- props.ref && props.ref(container);
611
- onCleanup(() => el.removeChild(container));
1075
+ createEffect(
1076
+ () => {
1077
+ if (hydrating) getOwner().user = hydrating = false;
1078
+ content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
1079
+ const el = mount();
1080
+ if (el instanceof HTMLHeadElement) {
1081
+ const [clean, setClean] = createSignal(false);
1082
+ const cleanup = () => setClean(true);
1083
+ createRoot(dispose => insert(el, () => (!clean() ? content() : dispose()), null));
1084
+ onCleanup(cleanup);
1085
+ } else {
1086
+ const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
1087
+ renderRoot =
1088
+ useShadow && container.attachShadow
1089
+ ? container.attachShadow({
1090
+ mode: "open"
1091
+ })
1092
+ : container;
1093
+ Object.defineProperty(container, "_$host", {
1094
+ get() {
1095
+ return marker.parentNode;
1096
+ },
1097
+ configurable: true
1098
+ });
1099
+ insert(renderRoot, content);
1100
+ el.appendChild(container);
1101
+ props.ref && props.ref(container);
1102
+ onCleanup(() => el.removeChild(container));
1103
+ }
1104
+ },
1105
+ undefined,
1106
+ {
1107
+ render: !hydrating
612
1108
  }
613
- }, undefined, {
614
- render: !hydrating
615
- });
1109
+ );
616
1110
  return marker;
617
1111
  }
618
1112
  function Dynamic(props) {
@@ -632,4 +1126,61 @@ function Dynamic(props) {
632
1126
  });
633
1127
  }
634
1128
 
635
- 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 };
1129
+ export {
1130
+ Aliases,
1131
+ voidFn as Assets,
1132
+ ChildProperties,
1133
+ DOMElements,
1134
+ DelegatedEvents,
1135
+ Dynamic,
1136
+ Hydration,
1137
+ voidFn as HydrationScript,
1138
+ NoHydration,
1139
+ Portal,
1140
+ Properties,
1141
+ RequestContext,
1142
+ SVGElements,
1143
+ SVGNamespace,
1144
+ addEventListener,
1145
+ assign,
1146
+ classList,
1147
+ className,
1148
+ clearDelegatedEvents,
1149
+ delegateEvents,
1150
+ dynamicProperty,
1151
+ escape,
1152
+ voidFn as generateHydrationScript,
1153
+ voidFn as getAssets,
1154
+ getHydrationKey,
1155
+ getNextElement,
1156
+ getNextMarker,
1157
+ getNextMatch,
1158
+ getPropAlias,
1159
+ voidFn as getRequestEvent,
1160
+ hydrate,
1161
+ innerHTML,
1162
+ insert,
1163
+ isDev,
1164
+ isServer,
1165
+ render,
1166
+ renderToStream,
1167
+ renderToString,
1168
+ renderToStringAsync,
1169
+ resolveSSRNode,
1170
+ runHydrationEvents,
1171
+ setAttribute,
1172
+ setAttributeNS,
1173
+ setProperty,
1174
+ spread,
1175
+ ssr,
1176
+ ssrAttribute,
1177
+ ssrClassList,
1178
+ ssrElement,
1179
+ ssrHydrationKey,
1180
+ ssrSpread,
1181
+ ssrStyle,
1182
+ style,
1183
+ template,
1184
+ use,
1185
+ voidFn as useAssets
1186
+ };