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

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