@solidjs/web 2.0.0-beta.3 → 2.0.0-beta.31

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 (73) hide show
  1. package/README.md +27 -4
  2. package/dist/dev.cjs +1224 -205
  3. package/dist/dev.js +1188 -199
  4. package/dist/server.cjs +1429 -234
  5. package/dist/server.js +1391 -231
  6. package/dist/web.cjs +1207 -195
  7. package/dist/web.js +1171 -189
  8. package/frames/dist/client.cjs +1694 -0
  9. package/frames/dist/client.dev.cjs +1707 -0
  10. package/frames/dist/client.dev.js +1695 -0
  11. package/frames/dist/client.js +1682 -0
  12. package/frames/dist/server.cjs +2520 -0
  13. package/frames/dist/server.js +2508 -0
  14. package/frames/package.json +30 -0
  15. package/package.json +285 -37
  16. package/serialization/dist/serialization.cjs +169 -0
  17. package/serialization/dist/serialization.js +159 -0
  18. package/serialization/package.json +20 -0
  19. package/serialization/types/index.d.ts +157 -0
  20. package/serialization/types-cjs/index.d.cts +157 -0
  21. package/serialization/types-cjs/package.json +3 -0
  22. package/server-functions/dist/client.cjs +613 -0
  23. package/server-functions/dist/client.js +585 -0
  24. package/server-functions/dist/server.cjs +904 -0
  25. package/server-functions/dist/server.js +875 -0
  26. package/server-functions/package.json +30 -0
  27. package/storage/package.json +8 -3
  28. package/storage/types/index.d.ts +26 -0
  29. package/storage/types-cjs/index.d.cts +28 -0
  30. package/storage/types-cjs/package.json +3 -0
  31. package/types/client.d.ts +127 -21
  32. package/types/core.d.ts +4 -3
  33. package/types/frames/client.d.ts +22 -0
  34. package/types/frames/frame-client.d.ts +282 -0
  35. package/types/frames/frame-sink.d.ts +171 -0
  36. package/types/frames/frame-transport.d.ts +190 -0
  37. package/types/frames/serializer.d.ts +157 -0
  38. package/types/frames/server.d.ts +30 -0
  39. package/types/index.d.ts +211 -26
  40. package/types/jsx-properties.d.ts +93 -0
  41. package/types/jsx.d.ts +4150 -1
  42. package/types/response.d.ts +129 -0
  43. package/types/serializer.d.ts +157 -0
  44. package/types/server-functions/client.d.ts +200 -0
  45. package/types/server-functions/flash.d.ts +38 -0
  46. package/types/server-functions/server.d.ts +490 -0
  47. package/types/server-functions/shared.d.ts +445 -0
  48. package/types/server-mock.d.ts +93 -0
  49. package/types/server.d.ts +223 -28
  50. package/types-cjs/client.d.cts +194 -0
  51. package/types-cjs/core.d.cts +4 -0
  52. package/types-cjs/frames/client.d.cts +22 -0
  53. package/types-cjs/frames/frame-client.d.cts +282 -0
  54. package/types-cjs/frames/frame-sink.d.cts +171 -0
  55. package/types-cjs/frames/frame-transport.d.cts +190 -0
  56. package/types-cjs/frames/serializer.d.cts +157 -0
  57. package/types-cjs/frames/server.d.cts +30 -0
  58. package/types-cjs/index.d.cts +231 -0
  59. package/types-cjs/jsx-properties.d.cts +93 -0
  60. package/types-cjs/jsx.d.cts +4150 -0
  61. package/types-cjs/package.json +3 -0
  62. package/types-cjs/response.d.cts +129 -0
  63. package/types-cjs/serializer.d.cts +157 -0
  64. package/types-cjs/server-functions/client.d.cts +200 -0
  65. package/types-cjs/server-functions/flash.d.cts +38 -0
  66. package/types-cjs/server-functions/server.d.cts +490 -0
  67. package/types-cjs/server-functions/shared.d.cts +445 -0
  68. package/types-cjs/server-mock.d.cts +165 -0
  69. package/types-cjs/server.d.cts +351 -0
  70. package/storage/types/src/client.d.ts +0 -1
  71. package/storage/types/src/index.d.ts +0 -46
  72. package/storage/types/src/server-mock.d.ts +0 -72
  73. package/storage/types/storage/src/index.d.ts +0 -2
package/dist/web.cjs CHANGED
@@ -1,40 +1,81 @@
1
1
  'use strict';
2
2
 
3
3
  var solidJs = require('solid-js');
4
- var signals = require('@solidjs/signals');
5
4
 
6
- const Properties = /*#__PURE__*/new Set([
7
- "value", "checked", "selected", "muted"]);
5
+ const DOMWithState = {
6
+ INPUT: {
7
+ value: 1,
8
+ defaultValue: 2,
9
+ checked: 1,
10
+ defaultChecked: 2
11
+ },
12
+ SELECT: {
13
+ value: 1
14
+ },
15
+ OPTION: {
16
+ value: 1,
17
+ selected: 1,
18
+ defaultSelected: 2
19
+ },
20
+ TEXTAREA: {
21
+ value: 1,
22
+ defaultValue: 2
23
+ },
24
+ VIDEO: {
25
+ muted: 1,
26
+ defaultMuted: 2
27
+ },
28
+ AUDIO: {
29
+ muted: 1,
30
+ defaultMuted: 2
31
+ }
32
+ };
8
33
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
34
+ const $$SLOT = /*#__PURE__*/Symbol("slot");
35
+ const $$HOST = /*#__PURE__*/Symbol("host");
9
36
  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"]);
10
37
  const SVGElements = /*#__PURE__*/new Set([
11
38
  "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",
12
39
  "set", "stop",
13
40
  "svg", "switch", "symbol", "text", "textPath",
14
41
  "tref", "tspan", "use", "view", "vkern"]);
15
- const SVGNamespace = {
42
+ const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
43
+ const Namespaces = {
44
+ svg: "http://www.w3.org/2000/svg",
45
+ mathml: "http://www.w3.org/1998/Math/MathML",
16
46
  xlink: "http://www.w3.org/1999/xlink",
17
47
  xml: "http://www.w3.org/XML/1998/namespace"
18
48
  };
19
- 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",
20
- "webview",
21
- "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
49
+ const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
50
+ const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
51
+ const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"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,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
22
52
 
23
- const effect = (fn, effectFn, initial) => solidJs.createRenderEffect(fn, effectFn, initial, {
24
- transparent: true
25
- });
26
- const memo = (fn, transparent) => transparent ? fn.$r ? fn : signals.createMemo(() => fn(), undefined, {
27
- transparent: true
28
- }) : solidJs.createMemo(() => fn());
53
+ const transparentOptions = {
54
+ transparent: true,
55
+ sync: true
56
+ };
57
+ const syncOptions = {
58
+ sync: true
59
+ };
60
+ const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectFn, options ? {
61
+ sync: true,
62
+ ...options,
63
+ transparent: !options.scope
64
+ } : transparentOptions);
65
+ const memo = fn => solidJs.createMemo(() => fn(), syncOptions);
29
66
 
30
- function reconcileArrays(parentNode, a, b) {
67
+ function reconcileArrays(parentNode, a, b, marker) {
31
68
  let bLength = b.length,
32
69
  aEnd = a.length,
33
70
  bEnd = bLength,
34
71
  aStart = 0,
35
72
  bStart = 0,
36
- after = a[aEnd - 1].nextSibling,
37
- map = null;
73
+ tail = a[aEnd - 1],
74
+ tailTag = tail[$$SLOT],
75
+ after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
76
+ map = null,
77
+ anchor,
78
+ anchorTag;
38
79
  while (aStart < aEnd || bStart < bEnd) {
39
80
  if (a[aStart] === b[bStart]) {
40
81
  aStart++;
@@ -46,18 +87,43 @@ function reconcileArrays(parentNode, a, b) {
46
87
  bEnd--;
47
88
  }
48
89
  if (aEnd === aStart) {
49
- const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
50
- while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
90
+ let node;
91
+ if (bEnd < bLength) {
92
+ if (bStart) {
93
+ const prev = b[bStart - 1];
94
+ const prevTag = prev[$$SLOT];
95
+ node = prev.parentNode === parentNode && (!prevTag || prevTag === marker) ? prev.nextSibling : after;
96
+ } else node = b[bEnd - bStart];
97
+ } else node = after;
98
+ while (bStart < bEnd) {
99
+ const n = b[bStart++];
100
+ parentNode.insertBefore(n, node);
101
+ if (marker) n[$$SLOT] = marker;
102
+ }
51
103
  } else if (bEnd === bStart) {
52
104
  while (aStart < aEnd) {
53
- if (!map || !map.has(a[aStart])) a[aStart].remove();
54
- aStart++;
105
+ const n = a[aStart++];
106
+ if (!map || !map.has(n)) {
107
+ const tag = n[$$SLOT];
108
+ if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
109
+ }
110
+ }
111
+ } else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
112
+ if (marker) {
113
+ do {
114
+ const n = a[--aEnd];
115
+ parentNode.insertBefore(n, anchor);
116
+ n[$$SLOT] = marker;
117
+ bStart++;
118
+ if (aStart >= aEnd - 1 || bStart >= bEnd) break;
119
+ } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
120
+ } else {
121
+ do {
122
+ parentNode.insertBefore(a[--aEnd], anchor);
123
+ bStart++;
124
+ if (aStart >= aEnd - 1 || bStart >= bEnd) break;
125
+ } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
55
126
  }
56
- } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
57
- const node = a[--aEnd].nextSibling;
58
- parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
59
- parentNode.insertBefore(b[--bEnd], node);
60
- a[aEnd] = b[bEnd];
61
127
  } else {
62
128
  if (!map) {
63
129
  map = new Map();
@@ -75,75 +141,273 @@ function reconcileArrays(parentNode, a, b) {
75
141
  sequence++;
76
142
  }
77
143
  if (sequence > index - bStart) {
78
- const node = a[aStart];
79
- while (bStart < index) parentNode.insertBefore(b[bStart++], node);
80
- } else parentNode.replaceChild(b[bStart++], a[aStart++]);
144
+ const head = a[aStart];
145
+ const headTag = head[$$SLOT];
146
+ const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
147
+ while (bStart < index) {
148
+ const n = b[bStart++];
149
+ parentNode.insertBefore(n, node);
150
+ if (marker) n[$$SLOT] = marker;
151
+ }
152
+ } else {
153
+ const oldNode = a[aStart++];
154
+ const newNode = b[bStart++];
155
+ const oldTag = oldNode[$$SLOT];
156
+ if (oldNode.parentNode === parentNode && (!oldTag || oldTag === marker)) {
157
+ parentNode.replaceChild(newNode, oldNode);
158
+ } else {
159
+ parentNode.insertBefore(newNode, after);
160
+ }
161
+ if (marker) newNode[$$SLOT] = marker;
162
+ }
81
163
  } else aStart++;
82
- } else a[aStart++].remove();
164
+ } else {
165
+ const n = a[aStart++];
166
+ const nTag = n[$$SLOT];
167
+ if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
168
+ }
83
169
  }
84
170
  }
85
171
  }
86
172
 
87
- const $$EVENTS = "_$DX_DELEGATE";
173
+ const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
174
+ const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
175
+ const RESOURCE_LINK_RELS = new Set(["preload", "modulepreload", "prefetch", "preconnect", "dns-prefetch", "stylesheet"]);
176
+ const RESOURCE_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
177
+ function evalHeadValue(v) {
178
+ return typeof v === "function" ? v() : v;
179
+ }
180
+ function evalHeadProps(props, presets) {
181
+ const out = {};
182
+ for (const name in props) out[name] = presets && name in presets ? presets[name] : evalHeadValue(props[name]);
183
+ return out;
184
+ }
185
+ function classifyHeadTag(desc) {
186
+ const tag = desc.tag;
187
+ if (tag === "link") {
188
+ const rel = evalHeadValue(desc.props && desc.props.rel);
189
+ return {
190
+ resource: RESOURCE_LINK_RELS.has(rel),
191
+ rel
192
+ };
193
+ }
194
+ if (tag === "style") return {
195
+ resource: !!(desc.props && "href" in desc.props)
196
+ };
197
+ if (tag === "script") return {
198
+ resource: !!(desc.props && "src" in desc.props)
199
+ };
200
+ return {
201
+ resource: false
202
+ };
203
+ }
204
+ function resourceIdentity(tag, props) {
205
+ let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
206
+ for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
207
+ const q = RESOURCE_QUALIFIERS[i];
208
+ if (props[q] != null) id += ":" + q + "=" + props[q];
209
+ }
210
+ return id;
211
+ }
212
+ function replaceableIdentity(tag, props, key, unique) {
213
+ if (tag === "title") return "title";
214
+ if (tag === "base") return "base";
215
+ if (tag === "meta" && props.charset != null) return "charset";
216
+ if (key != null) return tag + ":key:" + key;
217
+ if (tag === "meta") {
218
+ for (const ns of ["name", "property", "http-equiv"]) if (props[ns] != null) return "meta:" + ns + ":" + props[ns] + (props.media != null ? ":media=" + props.media : "");
219
+ return unique;
220
+ }
221
+ if (tag === "link") {
222
+ const rel = props.rel || "";
223
+ if (rel === "icon" || rel === "apple-touch-icon") return "link:" + rel + (props.sizes != null ? ":sizes=" + props.sizes : "") + (props.type != null ? ":type=" + props.type : "");
224
+ return "link:" + rel + ":" + (props.href || "");
225
+ }
226
+ return unique;
227
+ }
228
+ function resolveHead(groups) {
229
+ const winners = new Map();
230
+ const sorted = groups.slice().sort((a, b) => a.seq - b.seq);
231
+ for (let i = 0; i < sorted.length; i++) {
232
+ const group = sorted[i];
233
+ const byIdentity = new Map();
234
+ for (let j = 0; j < group.tags.length; j++) {
235
+ const t = group.tags[j];
236
+ let list = byIdentity.get(t.identity);
237
+ if (!list) byIdentity.set(t.identity, list = []);
238
+ list.push(t);
239
+ }
240
+ for (const [identity, tags] of byIdentity) {
241
+ if (identity === "title") {
242
+ winners.set(identity, {
243
+ seq: group.seq,
244
+ tags: [tags[tags.length - 1]]
245
+ });
246
+ } else {
247
+ winners.set(identity, {
248
+ seq: group.seq,
249
+ tags
250
+ });
251
+ }
252
+ }
253
+ }
254
+ return winners;
255
+ }
256
+
257
+ const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
258
+ const INNER_OWNED = {};
259
+ const delegatedEvents = new Set();
260
+ const delegatedContainers = new Map();
88
261
  function render$1(code, element, init, options = {}) {
89
262
  let disposer;
90
- solidJs.createRoot(dispose => {
91
- disposer = dispose;
92
- element === document ? solidJs.flatten(code) : insert(element, code(), element.firstChild ? null : undefined, init);
93
- }, {
94
- id: options.renderId
95
- });
263
+ registerDelegatedRoot(element);
264
+ try {
265
+ solidJs.createRoot(dispose => {
266
+ disposer = dispose;
267
+ if (element === document) {
268
+ const tree = code();
269
+ effect(() => solidJs.flatten(tree), () => {});
270
+ } else {
271
+ const tree = code();
272
+ insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
273
+ }
274
+ }, {
275
+ id: options.renderId
276
+ });
277
+ } catch (err) {
278
+ if (disposer) disposer();
279
+ unregisterDelegatedRoot(element);
280
+ throw err;
281
+ }
96
282
  return () => {
97
283
  disposer();
284
+ unregisterDelegatedRoot(element);
98
285
  element.textContent = "";
99
286
  };
100
287
  }
101
- function template(html, isImportNode, isSVG, isMathML) {
288
+ function create(html, bypassGuard, flag) {
289
+ const t = document.createElement("template");
290
+ t.innerHTML = html;
291
+ return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
292
+ }
293
+ function template(html, flag) {
102
294
  let node;
103
- const create = bypassGuard => {
104
- const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
105
- t.innerHTML = html;
106
- return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
107
- };
108
- const fn = isImportNode ? bypassGuard => solidJs.untrack(() => document.importNode(node || (node = create()), true)) : bypassGuard => (node || (node = create())).cloneNode(true);
295
+ const fn = flag === 1 ? bypassGuard => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : bypassGuard => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
109
296
  return fn;
110
297
  }
111
- function delegateEvents(eventNames, document = window.document) {
112
- const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
298
+ function delegateEvents(eventNames) {
113
299
  for (let i = 0, l = eventNames.length; i < l; i++) {
114
300
  const name = eventNames[i];
115
- if (!e.has(name)) {
116
- e.add(name);
117
- document.addEventListener(name, eventHandler);
301
+ if (!delegatedEvents.has(name)) {
302
+ delegatedEvents.add(name);
303
+ delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
118
304
  }
119
305
  }
120
306
  }
121
- function clearDelegatedEvents(document = window.document) {
122
- if (document[$$EVENTS]) {
123
- for (let name of document[$$EVENTS].keys()) document.removeEventListener(name, eventHandler);
124
- delete document[$$EVENTS];
307
+ function registerDelegatedRoot(root) {
308
+ const state = registerDelegatedContainer(root, root);
309
+ if (state) state.roots = (state.roots || 0) + 1;
310
+ }
311
+ function unregisterDelegatedRoot(root) {
312
+ const state = delegatedContainers.get(root);
313
+ if (state) state.roots > 1 ? state.roots-- : delete state.roots;
314
+ unregisterDelegatedContainer(root, root);
315
+ }
316
+ function registerDelegatedContainer(container, owner = container) {
317
+ if (!container || !owner) return;
318
+ let state = delegatedContainers.get(container);
319
+ if (!state) delegatedContainers.set(container, state = {
320
+ owners: new Map(),
321
+ handlers: new Map()
322
+ });
323
+ state.owners.set(owner, (state.owners.get(owner) || 0) + 1);
324
+ delegatedEvents.forEach(name => attachDelegatedEvent(name, container, state));
325
+ return state;
326
+ }
327
+ function unregisterDelegatedContainer(container, owner = container) {
328
+ const state = delegatedContainers.get(container);
329
+ if (!state) return;
330
+ const count = state.owners.get(owner);
331
+ if (count > 1) state.owners.set(owner, count - 1);else state.owners.delete(owner);
332
+ if (state.owners.size) return;
333
+ state.handlers.forEach((handler, name) => container.removeEventListener(name, handler));
334
+ delegatedContainers.delete(container);
335
+ }
336
+ function attachDelegatedEvent(name, container, state) {
337
+ if (state.handlers.has(name)) return;
338
+ const handler = e => eventHandler(e, container, state);
339
+ state.handlers.set(name, handler);
340
+ container.addEventListener(name, handler);
341
+ }
342
+ function getDelegatedRoot(node) {
343
+ while (node) {
344
+ if (delegatedContainers.get(node)?.roots) return node;
345
+ node = node._$host || node.parentNode || node.host;
346
+ }
347
+ }
348
+ function findOwner(target, state) {
349
+ let node = target;
350
+ let distance = 0;
351
+ while (node) {
352
+ if (state.owners.has(node)) return {
353
+ owner: node,
354
+ distance
355
+ };
356
+ distance++;
357
+ node = node._$host || node.parentNode || node.host;
125
358
  }
126
359
  }
127
360
  function setProperty(node, name, value) {
128
361
  if (isHydrating(node)) return;
129
362
  node[name] = value;
130
363
  }
364
+ let claimHandlers = null;
365
+ const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
366
+ function registerElementClaim(handler) {
367
+ (claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
368
+ return () => {
369
+ const index = claimHandlers.indexOf(handler);
370
+ index > -1 && claimHandlers.splice(index, 1);
371
+ };
372
+ }
373
+ const CLAIMED_ELEMENTS = "a[href], form[action]";
374
+ function claimElementTree(root) {
375
+ const handlers = globalThis[CLAIM_SEAM];
376
+ if (handlers === undefined || handlers.length === 0) return root;
377
+ const isElement = root.nodeType === 1;
378
+ if (!isElement && root.nodeType !== 11) return root;
379
+ if (isElement && root.matches(CLAIMED_ELEMENTS)) {
380
+ for (let i = 0; i < handlers.length; i++) handlers[i](root);
381
+ }
382
+ const found = root.querySelectorAll(CLAIMED_ELEMENTS);
383
+ for (let i = 0; i < found.length; i++) {
384
+ for (let j = 0; j < handlers.length; j++) handlers[j](found[i]);
385
+ }
386
+ return root;
387
+ }
388
+ function claimElement(node) {
389
+ if (claimHandlers !== null) {
390
+ for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
391
+ }
392
+ return node;
393
+ }
131
394
  function setAttribute(node, name, value) {
132
395
  if (isHydrating(node)) return;
133
396
  if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
397
+ if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
134
398
  }
135
399
  function setAttributeNS(node, namespace, name, value) {
136
400
  if (isHydrating(node)) return;
137
- if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
401
+ if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
138
402
  }
139
- function className(node, value, isSVG, prev) {
403
+ function className(node, value, prev) {
140
404
  if (isHydrating(node)) return;
141
405
  if (value == null || value === false) {
142
406
  prev && node.removeAttribute("class");
143
407
  return;
144
408
  }
145
409
  if (typeof value === "string") {
146
- value !== prev && (isSVG ? node.setAttribute("class", value) : node.className = value);
410
+ value !== prev && node.setAttribute("class", value);
147
411
  return;
148
412
  }
149
413
  if (typeof prev === "string") {
@@ -157,16 +421,16 @@ function className(node, value, isSVG, prev) {
157
421
  for (i = 0, len = prevKeys.length; i < len; i++) {
158
422
  const key = prevKeys[i];
159
423
  if (!key || key === "undefined" || value[key]) continue;
160
- toggleClassKey(node, key, false);
424
+ node.classList.remove(key);
161
425
  }
162
426
  for (i = 0, len = classKeys.length; i < len; i++) {
163
427
  const key = classKeys[i],
164
428
  classValue = !!value[key];
165
429
  if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
166
- toggleClassKey(node, key, true);
430
+ node.classList.add(key);
167
431
  }
168
432
  }
169
- function addEventListener(node, name, handler, delegate) {
433
+ function addEvent(node, name, handler, delegate) {
170
434
  if (delegate) {
171
435
  if (Array.isArray(handler)) {
172
436
  node[`$$${name}`] = handler[0];
@@ -179,33 +443,48 @@ function addEventListener(node, name, handler, delegate) {
179
443
  }
180
444
  function style(node, value, prev) {
181
445
  if (!value) {
182
- if (prev) setAttribute(node, "style");
446
+ if (prev || node._$styles) {
447
+ setAttribute(node, "style");
448
+ node._$styles = undefined;
449
+ }
183
450
  return;
184
451
  }
185
452
  const nodeStyle = node.style;
186
- if (typeof value === "string") return nodeStyle.cssText = value;
187
- typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
188
- prev || (prev = {});
189
- value || (value = {});
453
+ if (typeof value === "string") {
454
+ node._$styles = undefined;
455
+ return nodeStyle.cssText = value;
456
+ }
457
+ if (typeof prev === "string") {
458
+ nodeStyle.cssText = "";
459
+ prev = undefined;
460
+ }
461
+ let applied = node._$styles;
462
+ if (!applied) {
463
+ applied = node._$styles = prev ? {
464
+ ...prev
465
+ } : {};
466
+ }
190
467
  let v, s;
468
+ for (s in applied) {
469
+ if (value[s] == null) {
470
+ nodeStyle.removeProperty(s);
471
+ delete applied[s];
472
+ }
473
+ }
191
474
  for (s in value) {
192
475
  v = value[s];
193
- if (v !== prev[s]) nodeStyle.setProperty(s, v);
194
- delete prev[s];
476
+ if (v != null && v !== applied[s]) {
477
+ nodeStyle.setProperty(s, v);
478
+ applied[s] = v;
479
+ }
195
480
  }
196
- for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
197
481
  }
198
482
  function setStyleProperty(node, name, value) {
199
483
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
200
484
  }
201
- function spread(node, props = {}, isSVG, skipChildren) {
485
+ function spread(node, props = {}, skipChildren) {
202
486
  const prevProps = {};
203
- if (!skipChildren) {
204
- effect(() => normalize(props.children, prevProps.children), value => {
205
- insertExpression(node, value, prevProps.children);
206
- prevProps.children = value;
207
- });
208
- }
487
+ if (!skipChildren) insert(node, () => props.children);
209
488
  effect(() => {
210
489
  const r = props.ref;
211
490
  (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
@@ -217,7 +496,7 @@ function spread(node, props = {}, isSVG, skipChildren) {
217
496
  newProps[prop] = props[prop];
218
497
  }
219
498
  return newProps;
220
- }, props => assign(node, props, isSVG, true, prevProps, true));
499
+ }, props => assign(node, props, true, prevProps, true));
221
500
  return prevProps;
222
501
  }
223
502
  function dynamicProperty(props, key) {
@@ -237,49 +516,465 @@ function ref(fn, element) {
237
516
  const resolved = solidJs.untrack(fn);
238
517
  solidJs.runWithOwner(null, () => applyRef(resolved, element));
239
518
  }
240
- function insert(parent, accessor, marker, initial) {
241
- const multi = marker !== undefined;
242
- if (multi && !initial) initial = [];
243
- if (isHydrating(parent)) {
244
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
245
- if (Array.isArray(initial)) {
246
- let j = 0;
247
- for (let i = 0; i < initial.length; i++) {
248
- if (initial[i].nodeType === 8 && initial[i].nodeValue === "!$") initial[i].remove();else initial[j++] = initial[i];
519
+ function scope(fn) {
520
+ fn.$s = true;
521
+ return fn;
522
+ }
523
+ const SCOPE_OPTIONS = {
524
+ scope: true
525
+ };
526
+ let hydrationRt = null;
527
+ function installHydrationRuntime() {
528
+ hydrationRt = {
529
+ claimInitial(parent, multi, initial) {
530
+ if (isHydrating(parent)) {
531
+ if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
532
+ if (Array.isArray(initial)) stripTextSeparators(initial);
249
533
  }
250
- initial.length = j;
534
+ return initial;
535
+ },
536
+ reclaimRegion(current, parent, marker) {
537
+ if (!solidJs.sharedConfig.hydrating || !current || !parent.isConnected) return current;
538
+ const first = Array.isArray(current) ? current[0] : current;
539
+ if (!first || !first.nodeType || first.isConnected) return current;
540
+ let nodes;
541
+ if (marker) {
542
+ nodes = [];
543
+ let node = marker.previousSibling,
544
+ depth = 0;
545
+ while (node) {
546
+ if (node.nodeType === 8) {
547
+ const v = node.nodeValue;
548
+ if (v === "/") depth++;else if (v === "$") {
549
+ if (depth === 0) break;
550
+ depth--;
551
+ }
552
+ }
553
+ nodes.unshift(node);
554
+ node = node.previousSibling;
555
+ }
556
+ } else nodes = [...parent.childNodes];
557
+ return stripTextSeparators(nodes);
558
+ },
559
+ dedupEvent(e) {
560
+ return !!(solidJs.sharedConfig.registry && solidJs.sharedConfig.events && solidJs.sharedConfig.events.find(([el, ev]) => ev === e));
251
561
  }
562
+ };
563
+ }
564
+ function stripTextSeparators(nodes) {
565
+ let j = 0;
566
+ for (let i = 0; i < nodes.length; i++) {
567
+ const node = nodes[i],
568
+ t = node.nodeType;
569
+ if (t === 8) {
570
+ const v = node.nodeValue;
571
+ if (v === "!$") {
572
+ node.remove();
573
+ continue;
574
+ }
575
+ if (v.startsWith("pl-")) continue;
576
+ } else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
577
+ nodes[j++] = node;
252
578
  }
579
+ nodes.length = j;
580
+ return nodes;
581
+ }
582
+ function insert(parent, accessor, marker, initial, options) {
583
+ const multi = marker !== undefined;
584
+ const host = options && options.host;
585
+ if (multi && !initial) initial = [];
586
+ if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
253
587
  if (typeof accessor !== "function") {
254
588
  accessor = normalize(accessor, initial, multi, true);
255
- if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
589
+ if (typeof accessor !== "function") {
590
+ insertExpression(parent, accessor, initial, marker);
591
+ host && tagHost(accessor, host);
592
+ return;
593
+ }
256
594
  }
257
- accessor = memo(accessor, true);
258
- if (multi && initial.length === 0 && !isHydrating(parent)) {
595
+ if (multi && initial.length === 0) {
259
596
  const placeholder = document.createTextNode("");
260
597
  parent.insertBefore(placeholder, marker);
261
598
  initial = [placeholder];
262
599
  }
263
- effect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
600
+ let current = initial;
601
+ effect(prev => {
602
+ if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
603
+ const value = normalize(accessor(), current, multi, true);
604
+ if (typeof value !== "function") return value;
605
+ effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
606
+ insertExpression(parent, inner, current, marker);
607
+ current = inner;
608
+ host && tagHost(current, host);
609
+ }, prev !== undefined && !(options && options.schedule) ? {
610
+ ...options,
611
+ schedule: true
612
+ } : options);
613
+ return INNER_OWNED;
614
+ }, value => {
615
+ if (value === INNER_OWNED) return;
616
+ insertExpression(parent, value, current, marker);
617
+ current = value;
618
+ host && tagHost(current, host);
619
+ },
620
+ accessor.$s ? options ? {
621
+ ...options,
622
+ scope: true
623
+ } : SCOPE_OPTIONS : options);
264
624
  }
265
- function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
625
+ function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
626
+ const nodeName = node.nodeName;
266
627
  props || (props = {});
267
628
  for (const prop in prevProps) {
268
629
  if (!(prop in props)) {
269
630
  if (prop === "children") continue;
270
- prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
631
+ prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
271
632
  }
272
633
  }
273
634
  for (const prop in props) {
274
635
  if (prop === "children") {
275
- if (!skipChildren) insertExpression(node, props.children);
636
+ if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
637
+ continue;
638
+ }
639
+ prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
640
+ }
641
+ }
642
+ const ASSET_REMOVAL_GRACE = 100;
643
+ const assetRegistry = new Map();
644
+ function assetEntryKey(descriptor) {
645
+ if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
646
+ return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
647
+ }
648
+ function findAssetElement(selector, attr, value) {
649
+ const nodes = document.querySelectorAll(selector);
650
+ for (let i = 0; i < nodes.length; i++) {
651
+ if (nodes[i].getAttribute(attr) === value) return nodes[i];
652
+ }
653
+ return null;
654
+ }
655
+ function mountAssetElement(descriptor) {
656
+ let el;
657
+ if (descriptor.type === "inline-style") {
658
+ el = findAssetElement("style[data-asset]", "data-asset", descriptor.id);
659
+ if (!el) {
660
+ el = document.createElement("style");
661
+ el.setAttribute("data-asset", descriptor.id);
662
+ el.textContent = descriptor.content || "";
663
+ }
664
+ } else {
665
+ const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
666
+ el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
667
+ if (!el) {
668
+ el = document.createElement("link");
669
+ el.rel = rel;
670
+ el.href = descriptor.href;
671
+ }
672
+ }
673
+ if (descriptor.attrs) {
674
+ for (const name in descriptor.attrs) el.setAttribute(name, descriptor.attrs[name]);
675
+ }
676
+ if (!el.isConnected) document.head.appendChild(el);
677
+ return el;
678
+ }
679
+ function acquireAsset(descriptor) {
680
+ const key = assetEntryKey(descriptor);
681
+ let entry = assetRegistry.get(key);
682
+ if (descriptor.policy === "exclusive") {
683
+ if (!entry) {
684
+ entry = {
685
+ original: descriptor.get(),
686
+ set: descriptor.set,
687
+ writers: []
688
+ };
689
+ assetRegistry.set(key, entry);
690
+ }
691
+ const writer = {
692
+ value: descriptor.value
693
+ };
694
+ entry.writers.push(writer);
695
+ entry.set(writer.value);
696
+ let released = false;
697
+ return () => {
698
+ if (released) return;
699
+ released = true;
700
+ const index = entry.writers.indexOf(writer);
701
+ const wasTop = index === entry.writers.length - 1;
702
+ entry.writers.splice(index, 1);
703
+ if (!wasTop) return;
704
+ if (entry.writers.length) {
705
+ entry.set(entry.writers[entry.writers.length - 1].value);
706
+ } else {
707
+ entry.set(entry.original);
708
+ assetRegistry.delete(key);
709
+ }
710
+ };
711
+ }
712
+ if (!entry) {
713
+ entry = {
714
+ count: 0,
715
+ element: null,
716
+ timer: null
717
+ };
718
+ assetRegistry.set(key, entry);
719
+ }
720
+ if (entry.timer) {
721
+ clearTimeout(entry.timer);
722
+ entry.timer = null;
723
+ }
724
+ entry.count++;
725
+ if (!entry.element || !entry.element.isConnected) entry.element = mountAssetElement(descriptor);
726
+ let released = false;
727
+ return () => {
728
+ if (released) return;
729
+ released = true;
730
+ if (--entry.count > 0) return;
731
+ entry.timer = setTimeout(() => {
732
+ assetRegistry.delete(key);
733
+ entry.element && entry.element.remove();
734
+ }, ASSET_REMOVAL_GRACE);
735
+ };
736
+ }
737
+ let headRegistrations = null;
738
+ let headSeq = 0;
739
+ let headUid = 0;
740
+ let headOwned = null;
741
+ let headApplied = null;
742
+ let headFallbackTitle = null;
743
+ let headScheduled = false;
744
+ const headMountedResources = new Set();
745
+ function initHeadRegistry() {
746
+ if (headRegistrations) return;
747
+ headRegistrations = [];
748
+ headOwned = new Map();
749
+ headApplied = new Map();
750
+ const t = document.querySelector("title");
751
+ headFallbackTitle = t && !t.hasAttribute("data-dh") ? t.textContent : null;
752
+ if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
753
+ }
754
+ function applyServerHeadOps(ops) {
755
+ for (let i = 0; i < ops.length; i++) {
756
+ const op = ops[i];
757
+ const identity = op[0] === "t" ? "title" : op[1];
758
+ if (headOwned.has(identity)) continue;
759
+ if (op[0] === "t") setHeadTitle(op[1]);else if (op[0] === "r") {
760
+ const els = headMarkedElements(identity);
761
+ for (let j = 0; j < els.length; j++) els[j].remove();
762
+ } else {
763
+ const el = document.createElement(op[2]);
764
+ for (const name in op[3]) el.setAttribute(name, op[3][name]);
765
+ if (op[4] != null) el.textContent = op[4];
766
+ el.setAttribute("data-dh", identity);
767
+ document.head.appendChild(el);
768
+ }
769
+ }
770
+ }
771
+ function headMarkedElements(identity) {
772
+ const nodes = document.head.querySelectorAll("[data-dh]");
773
+ const out = [];
774
+ for (let i = 0; i < nodes.length; i++) {
775
+ if (nodes[i].getAttribute("data-dh") === identity) out.push(nodes[i]);
776
+ }
777
+ return out;
778
+ }
779
+ function setHeadTitle(text) {
780
+ let el = document.querySelector("title");
781
+ if (!el) {
782
+ el = document.createElement("title");
783
+ document.head.appendChild(el);
784
+ }
785
+ el.textContent = text;
786
+ el.setAttribute("data-dh", "title");
787
+ return el;
788
+ }
789
+ function scheduleHeadApply() {
790
+ if (headScheduled) return;
791
+ headScheduled = true;
792
+ queueMicrotask(flushHeadRegistry);
793
+ }
794
+ function flushHeadRegistry() {
795
+ if (solidJs.sharedConfig.hydrating) {
796
+ setTimeout(flushHeadRegistry, 0);
797
+ return;
798
+ }
799
+ headScheduled = false;
800
+ const winners = resolveHead(headRegistrations);
801
+ for (const [identity, els] of headOwned) {
802
+ if (winners.has(identity)) continue;
803
+ headOwned.delete(identity);
804
+ headApplied.delete(identity);
805
+ if (identity === "title") {
806
+ if (headFallbackTitle != null) setHeadTitle(headFallbackTitle).removeAttribute("data-dh");
807
+ } else {
808
+ for (let i = 0; i < els.length; i++) els[i].remove();
809
+ }
810
+ }
811
+ for (const [identity, winner] of winners) {
812
+ let sig = "";
813
+ for (let i = 0; i < winner.tags.length; i++) sig += winner.tags[i].tag + JSON.stringify(winner.tags[i].props) + "|";
814
+ if (headApplied.get(identity) === sig) continue;
815
+ headApplied.set(identity, sig);
816
+ if (identity === "base" || identity === "charset") {
817
+ continue;
818
+ }
819
+ if (identity === "title") {
820
+ const children = winner.tags[0].props.children;
821
+ setHeadTitle(children == null ? "" : String(children));
822
+ headOwned.set(identity, []);
823
+ continue;
824
+ }
825
+ const existing = headMarkedElements(identity);
826
+ const els = [];
827
+ for (let i = 0; i < winner.tags.length; i++) {
828
+ els.push(renderHeadElement(winner.tags[i], identity, existing));
829
+ }
830
+ for (let i = 0; i < existing.length; i++) {
831
+ if (els.indexOf(existing[i]) === -1) existing[i].remove();
832
+ }
833
+ headOwned.set(identity, els);
834
+ }
835
+ }
836
+ function createHeadElement(tag, props) {
837
+ const el = document.createElement(tag);
838
+ for (const name in props) {
839
+ if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
840
+ if (!HEAD_ATTR_NAME.test(name)) {
276
841
  continue;
277
842
  }
278
- const value = props[prop];
279
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
843
+ const v = props[name];
844
+ if (v == null || v === false) continue;
845
+ el.setAttribute(name, v === true ? "" : String(v));
846
+ }
847
+ if (props.children != null) el.textContent = String(props.children);
848
+ return el;
849
+ }
850
+ function renderHeadElement(t, identity, existing) {
851
+ for (let i = 0; i < existing.length; i++) {
852
+ if (headElementMatches(existing[i], t)) return existing.splice(i, 1)[0];
280
853
  }
854
+ const el = createHeadElement(t.tag, t.props);
855
+ el.setAttribute("data-dh", identity);
856
+ document.head.appendChild(el);
857
+ return el;
858
+ }
859
+ function headElementMatches(el, t) {
860
+ if (el.tagName.toLowerCase() !== t.tag) return false;
861
+ for (const name in t.props) {
862
+ if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
863
+ if (!HEAD_ATTR_NAME.test(name)) continue;
864
+ const v = t.props[name];
865
+ if (v == null || v === false) {
866
+ if (el.hasAttribute(name)) return false;
867
+ } else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
868
+ }
869
+ const children = t.props.children;
870
+ return (children == null ? "" : String(children)) === el.textContent;
871
+ }
872
+ function acquireHeadResource(tag, props) {
873
+ if (tag === "link" && (props.rel === "stylesheet" || props.rel === "modulepreload")) {
874
+ const descriptor = {
875
+ type: props.rel === "stylesheet" ? "style" : "module",
876
+ href: props.href
877
+ };
878
+ let attrs = null;
879
+ for (const name in props) {
880
+ if (name === "rel" || name === "href") continue;
881
+ if (!HEAD_ATTR_NAME.test(name)) continue;
882
+ const v = props[name];
883
+ if (v == null || v === false) continue;
884
+ (attrs || (attrs = {}))[name] = v === true ? "" : String(v);
885
+ }
886
+ if (attrs) descriptor.attrs = attrs;
887
+ return acquireAsset(descriptor);
888
+ }
889
+ const identity = resourceIdentity(tag, props);
890
+ if (headMountedResources.has(identity)) return noopFn;
891
+ headMountedResources.add(identity);
892
+ const url = props.href || props.src;
893
+ let el = null;
894
+ if (url != null) {
895
+ if (tag === "link") el = findAssetElement(`link[rel="${props.rel}"]`, "href", url);else if (tag === "script") el = findAssetElement("script[src]", "src", url);else el = findAssetElement("style[href]", "href", url);
896
+ }
897
+ if (!el) document.head.appendChild(createHeadElement(tag, props));
898
+ return noopFn;
899
+ }
900
+ function noopFn() {}
901
+ function useHead(tags) {
902
+ initHeadRegistry();
903
+ const reg = {
904
+ seq: -1,
905
+ tags: null
906
+ };
907
+ const uid = ++headUid;
908
+ effect(() => {
909
+ let list = typeof tags === "function" ? tags() : tags;
910
+ if (!Array.isArray(list)) list = [list];
911
+ const replaceable = [];
912
+ const resources = [];
913
+ for (let i = 0; i < list.length; i++) {
914
+ const desc = list[i];
915
+ if (!desc || !HEAD_ELIGIBLE_TAGS.has(desc.tag)) {
916
+ continue;
917
+ }
918
+ const cls = classifyHeadTag(desc);
919
+ const props = evalHeadProps(desc.props || {}, cls.rel !== undefined ? {
920
+ rel: cls.rel
921
+ } : undefined);
922
+ if (cls.resource) {
923
+ resources.push({
924
+ tag: desc.tag,
925
+ props
926
+ });
927
+ } else {
928
+ const key = evalHeadValue(desc.key);
929
+ replaceable.push({
930
+ tag: desc.tag,
931
+ props,
932
+ identity: replaceableIdentity(desc.tag, props, key, "u:c" + uid + ":" + i)
933
+ });
934
+ }
935
+ }
936
+ return {
937
+ replaceable,
938
+ resources
939
+ };
940
+ }, evaluated => {
941
+ const releases = [];
942
+ for (let i = 0; i < evaluated.resources.length; i++) {
943
+ releases.push(acquireHeadResource(evaluated.resources[i].tag, evaluated.resources[i].props));
944
+ }
945
+ reg.tags = evaluated.replaceable;
946
+ if (reg.seq < 0) reg.seq = ++headSeq;
947
+ if (headRegistrations.indexOf(reg) === -1) headRegistrations.push(reg);
948
+ scheduleHeadApply();
949
+ return () => {
950
+ const idx = headRegistrations.indexOf(reg);
951
+ if (idx > -1) headRegistrations.splice(idx, 1);
952
+ for (let i = 0; i < releases.length; i++) releases[i]();
953
+ scheduleHeadApply();
954
+ };
955
+ });
956
+ }
957
+ function loadModuleAssets(mapping) {
958
+ const hy = globalThis._$HY;
959
+ if (!hy) return;
960
+ const pending = [];
961
+ for (const key in mapping) {
962
+ if (hy.modules[key]) continue;
963
+ const entryUrl = mapping[key];
964
+ if (!hy.loading[key]) {
965
+ hy.loading[key] = import(entryUrl).then(mod => {
966
+ hy.modules[key] = mod;
967
+ }, err => {
968
+ delete hy.loading[key];
969
+ throw err;
970
+ });
971
+ }
972
+ pending.push(hy.loading[key]);
973
+ }
974
+ return pending.length ? Promise.all(pending).then(() => {}) : undefined;
281
975
  }
282
976
  function hydrate$1(code, element, options = {}) {
977
+ installHydrationRuntime();
283
978
  if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
284
979
  options.renderId ||= "";
285
980
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
@@ -289,6 +984,7 @@ function hydrate$1(code, element, options = {}) {
289
984
  solidJs.sharedConfig.load = id => globalThis._$HY.r[id];
290
985
  solidJs.sharedConfig.has = id => id in globalThis._$HY.r;
291
986
  solidJs.sharedConfig.gather = root => gatherHydratable(element, root);
987
+ solidJs.sharedConfig.loadModuleAssets = loadModuleAssets;
292
988
  solidJs.sharedConfig.cleanupFragment = id => {
293
989
  const tpl = document.getElementById("pl-" + id);
294
990
  if (tpl) {
@@ -306,7 +1002,35 @@ function hydrate$1(code, element, options = {}) {
306
1002
  }
307
1003
  };
308
1004
  solidJs.sharedConfig.registry = new Map();
1005
+ if (!solidJs.sharedConfig.boundaryScopes) solidJs.sharedConfig.boundaryScopes = new Map();
1006
+ solidJs.sharedConfig.captureBoundaryScope = id => {
1007
+ if (solidJs.sharedConfig.registry) solidJs.sharedConfig.boundaryScopes.set(id, {
1008
+ registry: solidJs.sharedConfig.registry,
1009
+ gather: solidJs.sharedConfig.gather
1010
+ });
1011
+ };
309
1012
  solidJs.sharedConfig.hydrating = true;
1013
+ const rootMapping = globalThis._$HY.r && globalThis._$HY.r["_assets"];
1014
+ if (rootMapping && typeof rootMapping === "object") {
1015
+ const p = loadModuleAssets(rootMapping);
1016
+ if (p) {
1017
+ gatherHydratable(element, options.renderId);
1018
+ let disposer;
1019
+ p.then(() => {
1020
+ try {
1021
+ disposer = render$1(code, element, [...element.childNodes], options);
1022
+ } finally {
1023
+ solidJs.sharedConfig.hydrating = false;
1024
+ }
1025
+ }, err => {
1026
+ console.error("Hydration module preload failed, falling back to client render:", err);
1027
+ solidJs.sharedConfig.hydrating = false;
1028
+ solidJs.sharedConfig.registry = undefined;
1029
+ disposer = render$1(code, element, [...element.childNodes], options);
1030
+ });
1031
+ return () => disposer && disposer();
1032
+ }
1033
+ }
310
1034
  try {
311
1035
  gatherHydratable(element, options.renderId);
312
1036
  return render$1(code, element, [...element.childNodes], options);
@@ -372,7 +1096,32 @@ function runHydrationEvents() {
372
1096
  const [el, e] = events[0];
373
1097
  if (!completed.has(el)) return;
374
1098
  events.shift();
375
- eventHandler(e);
1099
+ let matchContainer, matchState, matchDistance, matches;
1100
+ for (const [container, state] of delegatedContainers) {
1101
+ if (!state.handlers.has(e.type)) continue;
1102
+ const entry = findOwner(e.target, state);
1103
+ if (!entry) continue;
1104
+ if (matchContainer) {
1105
+ if (!matches) matches = [{
1106
+ container: matchContainer,
1107
+ state: matchState,
1108
+ distance: matchDistance
1109
+ }];
1110
+ matches.push({
1111
+ container,
1112
+ state,
1113
+ distance: entry.distance
1114
+ });
1115
+ } else {
1116
+ matchContainer = container;
1117
+ matchState = state;
1118
+ matchDistance = entry.distance;
1119
+ }
1120
+ }
1121
+ if (matches) {
1122
+ matches.sort((a, b) => a.distance - b.distance);
1123
+ for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
1124
+ } else if (matchContainer) eventHandler(e, matchContainer, matchState);
376
1125
  }
377
1126
  if (solidJs.sharedConfig.done) {
378
1127
  solidJs.sharedConfig.events = _$HY.events = null;
@@ -383,16 +1132,31 @@ function runHydrationEvents() {
383
1132
  }
384
1133
  }
385
1134
  function isHydrating(node) {
386
- return solidJs.sharedConfig.hydrating && (!node || node.isConnected);
387
- }
388
- function toggleClassKey(node, key, value) {
389
- const classNames = key.trim().split(/\s+/);
390
- for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
1135
+ if (!solidJs.sharedConfig.hydrating) return false;
1136
+ if (!node || node.isConnected) return true;
1137
+ const roots = solidJs.sharedConfig.claimRoots;
1138
+ if (roots) {
1139
+ for (let i = 0; i < roots.length; i++) {
1140
+ if (roots[i].contains(node)) return true;
1141
+ }
1142
+ }
1143
+ return false;
391
1144
  }
392
1145
  function classListToObject(classList) {
393
1146
  if (Array.isArray(classList)) {
394
1147
  const result = {};
395
1148
  flattenClassList(classList, result);
1149
+ classList = result;
1150
+ }
1151
+ if (classList && typeof classList === "object") {
1152
+ const result = {},
1153
+ keys = Object.keys(classList);
1154
+ for (let i = 0, len = keys.length; i < len; i++) {
1155
+ const key = keys[i];
1156
+ if (!classList[key]) continue;
1157
+ const classNames = key.trim().split(/\s+/);
1158
+ for (let j = 0, nameLen = classNames.length; j < nameLen; j++) classNames[j] && (result[classNames[j]] = true);
1159
+ }
396
1160
  return result;
397
1161
  }
398
1162
  return classList;
@@ -403,18 +1167,16 @@ function flattenClassList(list, result) {
403
1167
  if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
404
1168
  }
405
1169
  }
406
- function assignProp(node, prop, value, prev, isSVG, skipRef) {
407
- let forceProp;
1170
+ function assignProp(node, prop, value, prev, skipRef, nodeName) {
408
1171
  if (prop === "style") return style(node, value, prev), value;
409
- if (prop === "class") return className(node, value, isSVG, prev), value;
410
- if (value === prev) return prev;
1172
+ if (prop === "class") return className(node, value, prev), value;
1173
+ if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
411
1174
  if (prop === "ref") {
412
1175
  if (!skipRef && value) ref(() => value, node);
413
- } else if (prop.slice(0, 3) === "on:") {
414
- const e = prop.slice(3);
415
- prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
416
- value && node.addEventListener(e, value, typeof value !== "function" && value);
417
- } else if (prop.slice(0, 2) === "on") {
1176
+ return value;
1177
+ }
1178
+ const hasNamespace = prop.indexOf(":") > -1;
1179
+ if (!hasNamespace && prop.slice(0, 2) === "on") {
418
1180
  const name = prop.slice(2).toLowerCase();
419
1181
  const delegate = DelegatedEvents.has(name);
420
1182
  if (!delegate && prev) {
@@ -422,26 +1184,34 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
422
1184
  node.removeEventListener(name, h);
423
1185
  }
424
1186
  if (delegate || value) {
425
- addEventListener(node, name, value, delegate);
1187
+ addEvent(node, name, value, delegate);
426
1188
  delegate && delegateEvents([name]);
427
1189
  }
428
- } else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && Properties.has(prop)) {
429
- if (forceProp) prop = prop.slice(5);else if (isHydrating(node)) return value;
430
- if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
1190
+ } else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
1191
+ if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
1192
+ if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
1193
+ node[prop] = value ?? "";else node[prop] = value;
431
1194
  } else {
432
- const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
1195
+ const ns = hasNamespace && Namespaces[prop.split(":")[0]];
433
1196
  if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
434
1197
  }
435
1198
  return value;
436
1199
  }
437
- function eventHandler(e) {
438
- if (solidJs.sharedConfig.registry && solidJs.sharedConfig.events) {
439
- if (solidJs.sharedConfig.events.find(([el, ev]) => ev === e)) return;
1200
+ function eventHandler(e, container, state) {
1201
+ if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
1202
+ const prev = e[$$EVENT_OWNER];
1203
+ let resumeNode;
1204
+ if (prev) {
1205
+ if (prev === true || prev === container || !container.contains(prev)) return;
1206
+ resumeNode = prev;
440
1207
  }
441
- let node = e.target;
1208
+ const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
1209
+ if (state && !owner) return;
1210
+ e[$$EVENT_OWNER] = owner || true;
1211
+ let node = resumeNode || e.target;
442
1212
  const key = `$$${e.type}`;
443
1213
  const oriTarget = e.target;
444
- const oriCurrentTarget = e.currentTarget;
1214
+ const boundary = owner || container || e.currentTarget;
445
1215
  const retarget = value => Object.defineProperty(e, "target", {
446
1216
  configurable: true,
447
1217
  value
@@ -457,35 +1227,43 @@ function eventHandler(e) {
457
1227
  return true;
458
1228
  };
459
1229
  const walkUpTree = () => {
460
- while (handleNode() && (node = node._$host || node.parentNode || node.host));
1230
+ while (handleNode()) {
1231
+ if (node === boundary || node.parentNode === boundary) break;
1232
+ node = node._$host || node.parentNode || node.host;
1233
+ }
461
1234
  };
462
1235
  Object.defineProperty(e, "currentTarget", {
463
1236
  configurable: true,
464
1237
  get() {
465
- return node || document;
1238
+ return node || boundary || document;
466
1239
  }
467
1240
  });
468
- if (e.composedPath) {
1241
+ if (resumeNode) {
1242
+ if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
1243
+ if (node && node !== boundary) walkUpTree();
1244
+ } else if (e.composedPath) {
469
1245
  const path = e.composedPath();
470
- retarget(path[0]);
471
- for (let i = 0; i < path.length - 2; i++) {
472
- node = path[i];
473
- if (!handleNode()) break;
474
- if (node._$host) {
475
- node = node._$host;
476
- walkUpTree();
477
- break;
478
- }
479
- if (node.parentNode === oriCurrentTarget) {
480
- break;
1246
+ if (path.length) {
1247
+ retarget(path[0]);
1248
+ for (let i = 0; i < path.length; i++) {
1249
+ node = path[i];
1250
+ if (!handleNode()) break;
1251
+ if (node._$host) {
1252
+ node = node._$host;
1253
+ walkUpTree();
1254
+ break;
1255
+ }
1256
+ if (node === boundary || node.parentNode === boundary) {
1257
+ break;
1258
+ }
481
1259
  }
482
- }
1260
+ } else walkUpTree();
483
1261
  }
484
1262
  else walkUpTree();
485
1263
  retarget(oriTarget);
486
1264
  }
487
1265
  function insertExpression(parent, value, current, marker) {
488
- if (isHydrating(parent)) return;
1266
+ if (hydrationRt !== null && isHydrating(parent)) return;
489
1267
  if (value === current) return;
490
1268
  const t = typeof value,
491
1269
  multi = marker !== undefined;
@@ -493,15 +1271,25 @@ function insertExpression(parent, value, current, marker) {
493
1271
  const tc = typeof current;
494
1272
  if (tc === "string" || tc === "number") {
495
1273
  parent.firstChild.data = value;
496
- } else parent.textContent = value;
1274
+ } else {
1275
+ if (ownsAllChildren(parent, current)) parent.textContent = value;else {
1276
+ removeOwnedChildren(parent, current);
1277
+ parent.insertBefore(document.createTextNode(value), parent.firstChild);
1278
+ }
1279
+ }
497
1280
  } else if (value === undefined) {
498
1281
  cleanChildren(parent, current, marker);
499
1282
  } else if (value.nodeType) {
500
1283
  if (Array.isArray(current)) {
501
1284
  cleanChildren(parent, current, multi ? marker : null, value);
502
- } else if (current === undefined || !parent.firstChild) {
1285
+ } else if (current && current.nodeType) {
1286
+ current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
1287
+ } else if (current && parent.firstChild) {
1288
+ parent.replaceChild(value, parent.firstChild);
1289
+ } else {
503
1290
  parent.appendChild(value);
504
- } else parent.replaceChild(value, parent.firstChild);
1291
+ }
1292
+ if (marker) value[$$SLOT] = marker;
505
1293
  } else if (Array.isArray(value)) {
506
1294
  const currentArray = current && Array.isArray(current);
507
1295
  if (value.length === 0) {
@@ -509,9 +1297,9 @@ function insertExpression(parent, value, current, marker) {
509
1297
  } else if (currentArray) {
510
1298
  if (current.length === 0) {
511
1299
  appendNodes(parent, value, marker);
512
- } else reconcileArrays(parent, current, value);
1300
+ } else reconcileArrays(parent, current, value, marker);
513
1301
  } else {
514
- current && cleanChildren(parent);
1302
+ current && cleanChildren(parent, current);
515
1303
  appendNodes(parent, value);
516
1304
  }
517
1305
  } else ;
@@ -533,21 +1321,64 @@ function normalize(value, current, multi, doNotUnwrap) {
533
1321
  }
534
1322
  return value;
535
1323
  }
1324
+ function tagHost(value, host) {
1325
+ if (Array.isArray(value)) {
1326
+ for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
1327
+ } else if (value && value.nodeType && value[$$HOST] !== host) {
1328
+ value[$$HOST] = host;
1329
+ Object.defineProperty(value, "_$host", {
1330
+ get: host,
1331
+ configurable: true
1332
+ });
1333
+ }
1334
+ }
536
1335
  function appendNodes(parent, array, marker = null) {
537
- for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
1336
+ for (let i = 0, len = array.length; i < len; i++) {
1337
+ const n = array[i];
1338
+ parent.insertBefore(n, marker);
1339
+ if (marker) n[$$SLOT] = marker;
1340
+ }
1341
+ }
1342
+ function ownsAllChildren(parent, current) {
1343
+ if (current == null) return true;
1344
+ if (Array.isArray(current)) {
1345
+ return current.length ? parent.firstChild === current[0] && parent.lastChild === current[current.length - 1] : parent.firstChild === null;
1346
+ }
1347
+ if (current === "") return parent.firstChild === null;
1348
+ if (current.nodeType) return parent.firstChild === current && parent.lastChild === current;
1349
+ const first = parent.firstChild;
1350
+ return first !== null && first.nodeType === 3 && parent.lastChild === first;
1351
+ }
1352
+ function removeOwnedChildren(parent, current) {
1353
+ if (Array.isArray(current)) {
1354
+ for (let i = 0; i < current.length; i++) {
1355
+ const el = current[i];
1356
+ if (el.parentNode === parent) el.remove();
1357
+ }
1358
+ } else if (current.nodeType) {
1359
+ if (current.parentNode === parent) current.remove();
1360
+ } else {
1361
+ const first = parent.firstChild;
1362
+ if (first && first.nodeType === 3) first.remove();
1363
+ }
538
1364
  }
539
1365
  function cleanChildren(parent, current, marker, replacement) {
540
- if (marker === undefined) return parent.textContent = "";
1366
+ if (marker === undefined) {
1367
+ if (ownsAllChildren(parent, current)) return parent.textContent = "";
1368
+ return removeOwnedChildren(parent, current);
1369
+ }
541
1370
  if (current.length) {
542
1371
  let inserted = false;
543
1372
  for (let i = current.length - 1; i >= 0; i--) {
544
1373
  const el = current[i];
545
1374
  if (replacement !== el) {
546
- const isParent = el.parentNode === parent;
547
- if (replacement && !inserted && !i) isParent ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else isParent && el.remove();
1375
+ const tag = el[$$SLOT];
1376
+ const owns = el.parentNode === parent && (!tag || tag === marker);
1377
+ if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
548
1378
  } else inserted = true;
549
1379
  }
550
1380
  } else if (replacement) parent.insertBefore(replacement, marker);
1381
+ if (replacement && marker) replacement[$$SLOT] = marker;
551
1382
  }
552
1383
  function gatherHydratable(element, root) {
553
1384
  const templates = element.querySelectorAll(`*[_hk]`);
@@ -585,78 +1416,229 @@ function ssrHydrationKey() {}
585
1416
  function resolveSSRNode(node) {}
586
1417
  function escape(html) {}
587
1418
 
588
- function render(...args) {
589
- const result = render$1(...args);
590
- return result;
1419
+ const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
1420
+ class ResponseEnvelope {
1421
+ constructor(response, value) {
1422
+ this.response = response;
1423
+ this.value = value;
1424
+ }
1425
+ }
1426
+ ResponseEnvelope.prototype[ENVELOPE] = true;
1427
+ function isResponseEnvelope(value) {
1428
+ return !!(value && typeof value === "object" && value[ENVELOPE]);
1429
+ }
1430
+ const HREF = Symbol.for("solid.Href");
1431
+ function isHref(value) {
1432
+ return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
591
1433
  }
1434
+ const REVALIDATE_HEADER = "X-Revalidate";
1435
+ function initWithRevalidate(init) {
1436
+ const {
1437
+ revalidate,
1438
+ ...responseInit
1439
+ } = init;
1440
+ const headers = new Headers(responseInit.headers);
1441
+ revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
1442
+ return {
1443
+ responseInit,
1444
+ headers
1445
+ };
1446
+ }
1447
+ function redirect(url, init = 302) {
1448
+ if (typeof url !== "string" && !isHref(url)) {
1449
+ throw new TypeError("redirect() expects a string URL or an Href-branded value (Symbol.for('solid.Href')).");
1450
+ }
1451
+ const {
1452
+ responseInit,
1453
+ headers
1454
+ } = initWithRevalidate(typeof init === "number" ? {
1455
+ status: init
1456
+ } : init);
1457
+ if (responseInit.status === undefined) {
1458
+ responseInit.status = 302;
1459
+ }
1460
+ headers.set("Location", String(url));
1461
+ return new Response(null, {
1462
+ ...responseInit,
1463
+ headers
1464
+ });
1465
+ }
1466
+ function reload(init = {}) {
1467
+ const {
1468
+ responseInit,
1469
+ headers
1470
+ } = initWithRevalidate(init);
1471
+ return new Response(null, {
1472
+ ...responseInit,
1473
+ headers
1474
+ });
1475
+ }
1476
+ function respond(value, init = {}) {
1477
+ const {
1478
+ responseInit,
1479
+ headers
1480
+ } = initWithRevalidate(init);
1481
+ headers.set("Content-Type", "application/json");
1482
+ return new ResponseEnvelope(new Response(JSON.stringify(value), {
1483
+ ...responseInit,
1484
+ headers
1485
+ }), value);
1486
+ }
1487
+
1488
+ const mergeProps = solidJs.merge;
592
1489
  const isServer = false;
593
1490
  const isDev = false;
594
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
595
- function createElement(tagName, isSVG = false, is = undefined) {
596
- return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName, {
597
- is
598
- });
1491
+ function render(code, element, init, options = {}) {
1492
+ try {
1493
+ const dispose = render$1(code, element, init, {
1494
+ ...options,
1495
+ insertOptions: {
1496
+ schedule: true
1497
+ }
1498
+ });
1499
+ solidJs.flush();
1500
+ return dispose;
1501
+ } finally {
1502
+ }
599
1503
  }
600
1504
  const hydrate = (...args) => {
601
1505
  solidJs.enableHydration();
602
1506
  return hydrate$1(...args);
603
1507
  };
604
1508
  function Portal(props) {
1509
+ return solidJs.runWithOwner(solidJs.createOwner(), () => portalImpl(props));
1510
+ }
1511
+ function portalImpl(props) {
605
1512
  const treeMarker = document.createTextNode(""),
606
1513
  startMarker = document.createTextNode(""),
607
1514
  endMarker = document.createTextNode(""),
608
- mount = () => createElementProxy(props.mount || document.body, treeMarker);
609
- let content = solidJs.createMemo(() => [startMarker, props.children]);
610
- solidJs.createRenderEffect(() => [mount(), content()], ([m, c]) => {
1515
+ mount = () => props.mount || document.body,
1516
+ content = solidJs.createMemo(() => [startMarker, props.children], {
1517
+ ssrSource: "client"
1518
+ });
1519
+ solidJs.createRenderEffect(
1520
+ () => [mount(), content(), solidJs.getOwner()], ([, c, owner]) => {
1521
+ const m = solidJs.untrack(mount);
611
1522
  m.appendChild(endMarker);
612
- insert(m, c, endMarker);
1523
+ const dispose = solidJs.runWithOwner(owner, () => solidJs.createRoot(d => {
1524
+ insert(m, c, endMarker, undefined, {
1525
+ host: () => treeMarker.parentNode
1526
+ });
1527
+ return d;
1528
+ }));
613
1529
  return () => {
1530
+ dispose();
614
1531
  let c = startMarker;
615
- while (c && c !== endMarker) {
1532
+ while (c) {
616
1533
  const n = c.nextSibling;
617
1534
  m.removeChild(c);
1535
+ if (c === endMarker) break;
618
1536
  c = n;
619
1537
  }
620
1538
  };
1539
+ },
1540
+ {
1541
+ schedule: true,
1542
+ ssrSource: "client"
1543
+ });
1544
+ solidJs.createEffect(mount, () => {
1545
+ const m = solidJs.untrack(mount);
1546
+ const ownerRoot = getDelegatedRoot(treeMarker);
1547
+ if (!ownerRoot || ownerRoot.contains(m)) return;
1548
+ registerDelegatedContainer(m, ownerRoot);
1549
+ return () => unregisterDelegatedContainer(m, ownerRoot);
1550
+ }, {
1551
+ ssrSource: "client"
1552
+ });
1553
+ if (solidJs.sharedConfig.hydrating) return solidJs.createMemo(() => treeMarker, {
1554
+ ssrSource: "client"
621
1555
  });
622
1556
  return treeMarker;
623
1557
  }
624
- function createElementProxy(el, marker) {
625
- return new Proxy(el, {
626
- get(target, prop) {
627
- if (prop === "appendChild" || prop === "insertBefore") {
628
- return (...args) => {
629
- Object.defineProperty(args[0], "_$host", {
630
- get: () => marker.parentNode,
631
- configurable: true
632
- });
633
- target[prop](...args);
634
- };
635
- }
636
- const value = Reflect.get(target, prop);
637
- return typeof value === "function" ? value.bind(target) : value;
638
- }
639
- });
1558
+ const COMPONENT_BINDING = Symbol.for("dom-expressions.component-binding");
1559
+ function bindingOf(value) {
1560
+ return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
640
1561
  }
641
- function createDynamic(component, props) {
642
- const cached = solidJs.createMemo(component);
643
- return solidJs.createMemo(() => {
644
- const component = cached();
645
- switch (typeof component) {
646
- case "function":
647
- return solidJs.untrack(() => component(props));
648
- case "string":
649
- const isSvg = SVGElements.has(component);
650
- const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, solidJs.untrack(() => props.is));
651
- spread(el, props, isSvg);
652
- return el;
1562
+ function dynamic(source) {
1563
+ let latest = 0;
1564
+ const sites = new Set();
1565
+ const resolveBinding = (next, prev) => {
1566
+ const binding = bindingOf(next);
1567
+ if (!binding) return next;
1568
+ const prevBinding = bindingOf(prev);
1569
+ if (prevBinding && prevBinding.component === binding.component) {
1570
+ for (const deliver of sites) deliver(binding.address);
1571
+ return prev;
653
1572
  }
1573
+ return next;
1574
+ };
1575
+ const cached = solidJs.createMemo(prev => {
1576
+ const next = source();
1577
+ if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
1578
+ const token = ++latest;
1579
+ return {
1580
+ then: (onFulfilled, onRejected) => next.then(resolved => onFulfilled(token === latest ? resolveBinding(resolved, prev) : resolved), onRejected)
1581
+ };
1582
+ }, {
1583
+ lazy: true
654
1584
  });
1585
+ return props => {
1586
+ return solidJs.createMemo(() => {
1587
+ const component = cached();
1588
+ switch (typeof component) {
1589
+ case "function":
1590
+ {
1591
+ const binding = bindingOf(component);
1592
+ if (binding) {
1593
+ const [address, setAddress] = solidJs.createSignal(binding.address);
1594
+ sites.add(setAddress);
1595
+ solidJs.onCleanup(() => sites.delete(setAddress));
1596
+ return solidJs.untrack(() => binding.component(props, address));
1597
+ }
1598
+ return solidJs.untrack(() => component(props));
1599
+ }
1600
+ case "string":
1601
+ const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
1602
+ spread(el, props);
1603
+ return el;
1604
+ }
1605
+ });
1606
+ };
655
1607
  }
656
1608
  function Dynamic(props) {
657
- const others = solidJs.omit(props, "component");
658
- return createDynamic(() => props.component, others);
1609
+ const Comp = dynamic(() => props.component);
1610
+ return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
1611
+ }
1612
+ function createElement(tagName, is = undefined) {
1613
+ return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
1614
+ is
1615
+ });
1616
+ }
1617
+ function loadClientOnly(fn, setComp) {
1618
+ fn().then(m => setComp(() => m.default));
659
1619
  }
1620
+ function clientOnly(fn, options = {},
1621
+ _moduleUrl) {
1622
+ const [comp, setComp] = solidJs.createSignal();
1623
+ let started = !options.lazy;
1624
+ started && loadClientOnly(fn, setComp);
1625
+ return props => {
1626
+ let Comp;
1627
+ let m;
1628
+ const rest = solidJs.omit(props, "fallback");
1629
+ if (!started) {
1630
+ started = true;
1631
+ loadClientOnly(fn, setComp);
1632
+ }
1633
+ if ((Comp = solidJs.untrack(comp)) && !solidJs.sharedConfig.hydrating) return Comp(rest);
1634
+ const [mounted, setMounted] = solidJs.createSignal(!solidJs.sharedConfig.hydrating);
1635
+ const gate = solidJs.createMemo(() => (Comp = comp(), m = mounted(), solidJs.untrack(() => Comp && m ? Comp(rest) : props.fallback)));
1636
+ solidJs.sharedConfig.onHydrationEnd(() => setMounted(true));
1637
+ return gate;
1638
+ };
1639
+ }
1640
+ function httpStatus(_code, _text) {}
1641
+ function httpHeader(_name, _value, _options) {}
660
1642
 
661
1643
  Object.defineProperty(exports, "Errored", {
662
1644
  enumerable: true,
@@ -682,6 +1664,14 @@ Object.defineProperty(exports, "NoHydration", {
682
1664
  enumerable: true,
683
1665
  get: function () { return solidJs.NoHydration; }
684
1666
  });
1667
+ Object.defineProperty(exports, "Repeat", {
1668
+ enumerable: true,
1669
+ get: function () { return solidJs.Repeat; }
1670
+ });
1671
+ Object.defineProperty(exports, "Reveal", {
1672
+ enumerable: true,
1673
+ get: function () { return solidJs.Reveal; }
1674
+ });
685
1675
  Object.defineProperty(exports, "Show", {
686
1676
  enumerable: true,
687
1677
  get: function () { return solidJs.Show; }
@@ -698,10 +1688,6 @@ Object.defineProperty(exports, "getOwner", {
698
1688
  enumerable: true,
699
1689
  get: function () { return solidJs.getOwner; }
700
1690
  });
701
- Object.defineProperty(exports, "mergeProps", {
702
- enumerable: true,
703
- get: function () { return solidJs.merge; }
704
- });
705
1691
  Object.defineProperty(exports, "untrack", {
706
1692
  enumerable: true,
707
1693
  get: function () { return solidJs.untrack; }
@@ -709,26 +1695,36 @@ Object.defineProperty(exports, "untrack", {
709
1695
  exports.Assets = voidFn;
710
1696
  exports.ChildProperties = ChildProperties;
711
1697
  exports.DOMElements = DOMElements;
1698
+ exports.DOMWithState = DOMWithState;
712
1699
  exports.DelegatedEvents = DelegatedEvents;
713
1700
  exports.Dynamic = Dynamic;
1701
+ exports.HREF = HREF;
714
1702
  exports.HydrationScript = voidFn;
1703
+ exports.MathMLElements = MathMLElements;
1704
+ exports.Namespaces = Namespaces;
715
1705
  exports.Portal = Portal;
716
- exports.Properties = Properties;
1706
+ exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
1707
+ exports.RawTextElements = RawTextElements;
717
1708
  exports.RequestContext = RequestContext;
1709
+ exports.ResponseEnvelope = ResponseEnvelope;
718
1710
  exports.SVGElements = SVGElements;
719
- exports.SVGNamespace = SVGNamespace;
720
- exports.addEventListener = addEventListener;
1711
+ exports.VoidElements = VoidElements;
1712
+ exports.acquireAsset = acquireAsset;
1713
+ exports.addEvent = addEvent;
721
1714
  exports.applyRef = applyRef;
722
1715
  exports.assign = assign;
1716
+ exports.claimElement = claimElement;
1717
+ exports.claimElementTree = claimElementTree;
723
1718
  exports.className = className;
724
- exports.clearDelegatedEvents = clearDelegatedEvents;
725
- exports.createDynamic = createDynamic;
1719
+ exports.clientOnly = clientOnly;
726
1720
  exports.delegateEvents = delegateEvents;
1721
+ exports.dynamic = dynamic;
727
1722
  exports.dynamicProperty = dynamicProperty;
728
1723
  exports.effect = effect;
729
1724
  exports.escape = escape;
730
1725
  exports.generateHydrationScript = voidFn;
731
1726
  exports.getAssets = voidFn;
1727
+ exports.getDelegatedRoot = getDelegatedRoot;
732
1728
  exports.getFirstChild = getFirstChild;
733
1729
  exports.getHydrationKey = getHydrationKey;
734
1730
  exports.getNextElement = getNextElement;
@@ -736,18 +1732,31 @@ exports.getNextMarker = getNextMarker;
736
1732
  exports.getNextMatch = getNextMatch;
737
1733
  exports.getNextSibling = getNextSibling;
738
1734
  exports.getRequestEvent = voidFn;
1735
+ exports.httpHeader = httpHeader;
1736
+ exports.httpStatus = httpStatus;
739
1737
  exports.hydrate = hydrate;
740
1738
  exports.insert = insert;
1739
+ exports.installHydrationRuntime = installHydrationRuntime;
741
1740
  exports.isDev = isDev;
1741
+ exports.isHref = isHref;
1742
+ exports.isResponseEnvelope = isResponseEnvelope;
742
1743
  exports.isServer = isServer;
743
1744
  exports.memo = memo;
1745
+ exports.mergeProps = mergeProps;
1746
+ exports.redirect = redirect;
744
1747
  exports.ref = ref;
1748
+ exports.registerDelegatedContainer = registerDelegatedContainer;
1749
+ exports.registerDelegatedRoot = registerDelegatedRoot;
1750
+ exports.registerElementClaim = registerElementClaim;
1751
+ exports.reload = reload;
745
1752
  exports.render = render;
746
1753
  exports.renderToStream = renderToStream;
747
1754
  exports.renderToString = renderToString;
748
1755
  exports.renderToStringAsync = renderToStringAsync;
749
1756
  exports.resolveSSRNode = resolveSSRNode;
1757
+ exports.respond = respond;
750
1758
  exports.runHydrationEvents = runHydrationEvents;
1759
+ exports.scope = scope;
751
1760
  exports.setAttribute = setAttribute;
752
1761
  exports.setAttributeNS = setAttributeNS;
753
1762
  exports.setProperty = setProperty;
@@ -761,4 +1770,7 @@ exports.ssrHydrationKey = ssrHydrationKey;
761
1770
  exports.ssrStyle = ssrStyle;
762
1771
  exports.style = style;
763
1772
  exports.template = template;
1773
+ exports.unregisterDelegatedContainer = unregisterDelegatedContainer;
1774
+ exports.unregisterDelegatedRoot = unregisterDelegatedRoot;
764
1775
  exports.useAssets = voidFn;
1776
+ exports.useHead = useHead;