@solidjs/web 2.0.0-rc.0 → 2.0.0-rc.10

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 (108) hide show
  1. package/README.md +1 -1
  2. package/dist/server.dev.js +4472 -0
  3. package/dist/server.js +1363 -224
  4. package/dist/{server.cjs → server.observe.js} +1563 -424
  5. package/dist/{dev.cjs → web.dev.js} +708 -365
  6. package/dist/web.js +460 -144
  7. package/dist/{dev.js → web.observe.js} +511 -213
  8. package/frames/dist/client.dev.js +464 -72
  9. package/frames/dist/client.js +364 -71
  10. package/frames/dist/{client.dev.cjs → client.observe.js} +487 -134
  11. package/frames/dist/server.dev.js +1713 -0
  12. package/frames/dist/server.js +553 -2495
  13. package/frames/dist/server.observe.js +1713 -0
  14. package/frames/package.json +2 -25
  15. package/package.json +214 -254
  16. package/performance-tracks/dist/performance-tracks.dev.js +678 -0
  17. package/performance-tracks/dist/performance-tracks.js +6 -0
  18. package/performance-tracks/dist/performance-tracks.observe.js +666 -0
  19. package/performance-tracks/package.json +7 -0
  20. package/performance-tracks/types/index.d.ts +67 -0
  21. package/serialization/decode/package.json +2 -15
  22. package/serialization/dist/decode.js +101 -12
  23. package/serialization/dist/serialization.js +112 -20
  24. package/serialization/package.json +2 -15
  25. package/serialization/types/index.d.ts +76 -157
  26. package/serialization/types/serializer-decode.d.ts +149 -112
  27. package/serialization/types/serializer.d.ts +101 -0
  28. package/server-functions/dist/client.dev.js +1364 -0
  29. package/server-functions/dist/client.js +745 -85
  30. package/server-functions/dist/client.observe.js +1343 -0
  31. package/server-functions/dist/server.dev.js +2203 -175
  32. package/server-functions/dist/server.js +2111 -176
  33. package/server-functions/dist/server.observe.js +3043 -0
  34. package/server-functions/package.json +2 -35
  35. package/server-functions/rich-args/package.json +2 -15
  36. package/storage/package.json +2 -15
  37. package/types/client.d.ts +193 -288
  38. package/types/constants.d.ts +20 -0
  39. package/types/cookies.d.ts +32 -84
  40. package/types/diagnostics.d.ts +56 -0
  41. package/types/frames/client.d.ts +1 -1
  42. package/types/frames/frame-client.d.ts +323 -259
  43. package/types/frames/frame-container-plugin.d.ts +72 -0
  44. package/types/frames/frame-sink.d.ts +101 -158
  45. package/types/frames/frame-transport.d.ts +192 -190
  46. package/types/frames/serializer-decode.d.ts +219 -0
  47. package/types/frames/serializer.d.ts +76 -157
  48. package/types/frames/server.d.ts +1 -1
  49. package/types/head.d.ts +19 -0
  50. package/types/index.d.ts +62 -76
  51. package/types/index.server.d.ts +174 -0
  52. package/types/jsx.d.ts +33 -26
  53. package/types/observe.d.ts +358 -0
  54. package/types/reconcile.d.ts +1 -0
  55. package/types/render.d.ts +9 -0
  56. package/types/response.d.ts +75 -150
  57. package/types/serializer-decode.d.ts +149 -112
  58. package/types/serializer.d.ts +76 -157
  59. package/types/server-functions/client.d.ts +202 -174
  60. package/types/server-functions/flash.d.ts +28 -30
  61. package/types/server-functions/registry.d.ts +102 -0
  62. package/types/server-functions/rich-args.d.ts +1 -10
  63. package/types/server-functions/server.d.ts +518 -454
  64. package/types/server-functions/shared.d.ts +366 -425
  65. package/types/server-mock.d.ts +110 -13
  66. package/types/server-observe.d.ts +77 -0
  67. package/types/server.d.ts +425 -425
  68. package/types/trace.d.ts +127 -0
  69. package/LICENSE +0 -21
  70. package/dist/web.cjs +0 -2007
  71. package/frames/dist/client.cjs +0 -1916
  72. package/frames/dist/server.cjs +0 -3667
  73. package/serialization/dist/decode.cjs +0 -110
  74. package/serialization/dist/serialization.cjs +0 -232
  75. package/serialization/types-cjs/index.d.cts +0 -182
  76. package/serialization/types-cjs/package.json +0 -3
  77. package/serialization/types-cjs/serializer-decode.d.cts +0 -182
  78. package/server-functions/dist/client.cjs +0 -646
  79. package/server-functions/dist/rich-args.cjs +0 -11
  80. package/server-functions/dist/server.cjs +0 -1077
  81. package/server-functions/dist/server.dev.cjs +0 -1077
  82. package/storage/dist/storage.cjs +0 -12
  83. package/storage/types-cjs/index.d.cts +0 -28
  84. package/storage/types-cjs/package.json +0 -3
  85. package/types/core.d.ts +0 -6
  86. package/types-cjs/client.d.cts +0 -337
  87. package/types-cjs/cookies.d.cts +0 -93
  88. package/types-cjs/core.d.cts +0 -6
  89. package/types-cjs/frames/client.d.cts +0 -36
  90. package/types-cjs/frames/frame-client.d.cts +0 -338
  91. package/types-cjs/frames/frame-sink.d.cts +0 -194
  92. package/types-cjs/frames/frame-transport.d.cts +0 -222
  93. package/types-cjs/frames/serializer.d.cts +0 -182
  94. package/types-cjs/frames/server.d.cts +0 -52
  95. package/types-cjs/index.d.cts +0 -230
  96. package/types-cjs/jsx-properties.d.cts +0 -93
  97. package/types-cjs/jsx.d.cts +0 -4150
  98. package/types-cjs/package.json +0 -3
  99. package/types-cjs/response.d.cts +0 -174
  100. package/types-cjs/serializer-decode.d.cts +0 -182
  101. package/types-cjs/serializer.d.cts +0 -182
  102. package/types-cjs/server-functions/client.d.cts +0 -201
  103. package/types-cjs/server-functions/flash.d.cts +0 -38
  104. package/types-cjs/server-functions/rich-args.d.cts +0 -10
  105. package/types-cjs/server-functions/server.d.cts +0 -588
  106. package/types-cjs/server-functions/shared.d.cts +0 -523
  107. package/types-cjs/server-mock.d.cts +0 -277
  108. package/types-cjs/server.d.cts +0 -523
package/dist/web.cjs DELETED
@@ -1,2007 +0,0 @@
1
- 'use strict';
2
-
3
- var solidJs = require('solid-js');
4
-
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
- };
33
- const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
34
- const $$SLOT = /*#__PURE__*/Symbol("slot");
35
- const $$HOST = /*#__PURE__*/Symbol("host");
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"]);
37
- const SVGElements = /*#__PURE__*/new Set([
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",
39
- "set", "stop",
40
- "svg", "switch", "symbol", "text", "textPath",
41
- "tref", "tspan", "use", "view", "vkern"]);
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",
46
- xlink: "http://www.w3.org/1999/xlink",
47
- xml: "http://www.w3.org/XML/1998/namespace"
48
- };
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(","));
52
-
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);
66
- const assetGates = new WeakMap();
67
- const waitAsset = promise => {
68
- let gate = assetGates.get(promise);
69
- if (!gate) {
70
- solidJs.runWithOwner(null, () => {
71
- gate = solidJs.createMemo(() => promise);
72
- });
73
- assetGates.set(promise, gate);
74
- }
75
- gate();
76
- };
77
-
78
- function reconcileArrays(parentNode, a, b, marker) {
79
- let bLength = b.length,
80
- aEnd = a.length,
81
- bEnd = bLength,
82
- aStart = 0,
83
- bStart = 0,
84
- tail = a[aEnd - 1],
85
- tailTag = tail[$$SLOT],
86
- after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
87
- map = null,
88
- anchor,
89
- anchorTag;
90
- while (aStart < aEnd || bStart < bEnd) {
91
- if (a[aStart] === b[bStart]) {
92
- aStart++;
93
- bStart++;
94
- continue;
95
- }
96
- while (a[aEnd - 1] === b[bEnd - 1]) {
97
- aEnd--;
98
- bEnd--;
99
- }
100
- if (aEnd === aStart) {
101
- let node;
102
- if (bEnd < bLength) {
103
- if (bStart) {
104
- const prev = b[bStart - 1];
105
- const prevTag = prev[$$SLOT];
106
- node = prev.parentNode === parentNode && (!prevTag || prevTag === marker) ? prev.nextSibling : after;
107
- } else node = b[bEnd - bStart];
108
- } else node = after;
109
- while (bStart < bEnd) {
110
- const n = b[bStart++];
111
- parentNode.insertBefore(n, node);
112
- if (marker) n[$$SLOT] = marker;
113
- }
114
- } else if (bEnd === bStart) {
115
- while (aStart < aEnd) {
116
- const n = a[aStart++];
117
- if (!map || !map.has(n)) {
118
- const tag = n[$$SLOT];
119
- if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
120
- }
121
- }
122
- } else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
123
- if (marker) {
124
- do {
125
- const n = a[--aEnd];
126
- parentNode.insertBefore(n, anchor);
127
- n[$$SLOT] = marker;
128
- bStart++;
129
- if (aStart >= aEnd - 1 || bStart >= bEnd) break;
130
- } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
131
- } else {
132
- do {
133
- parentNode.insertBefore(a[--aEnd], anchor);
134
- bStart++;
135
- if (aStart >= aEnd - 1 || bStart >= bEnd) break;
136
- } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
137
- }
138
- } else {
139
- if (!map) {
140
- map = new Map();
141
- let i = bStart;
142
- while (i < bEnd) map.set(b[i], i++);
143
- }
144
- const index = map.get(a[aStart]);
145
- if (index != null) {
146
- if (bStart < index && index < bEnd) {
147
- let i = aStart,
148
- sequence = 1,
149
- t;
150
- while (++i < aEnd && i < bEnd) {
151
- if ((t = map.get(a[i])) == null || t !== index + sequence) break;
152
- sequence++;
153
- }
154
- if (sequence > index - bStart) {
155
- const head = a[aStart];
156
- const headTag = head[$$SLOT];
157
- const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
158
- while (bStart < index) {
159
- const n = b[bStart++];
160
- parentNode.insertBefore(n, node);
161
- if (marker) n[$$SLOT] = marker;
162
- }
163
- } else {
164
- const oldNode = a[aStart++];
165
- const newNode = b[bStart++];
166
- const oldTag = oldNode[$$SLOT];
167
- if (oldNode.parentNode === parentNode && (!oldTag || oldTag === marker)) {
168
- parentNode.replaceChild(newNode, oldNode);
169
- } else {
170
- parentNode.insertBefore(newNode, after);
171
- }
172
- if (marker) newNode[$$SLOT] = marker;
173
- }
174
- } else aStart++;
175
- } else {
176
- const n = a[aStart++];
177
- const nTag = n[$$SLOT];
178
- if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
179
- }
180
- }
181
- }
182
- }
183
-
184
- const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
185
- const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
186
- const RESOURCE_LINK_RELS = new Set(["preload", "modulepreload", "prefetch", "preconnect", "dns-prefetch", "stylesheet"]);
187
- const RESOURCE_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
188
- const STYLESHEET_FETCH_META = new Set(["crossorigin", "integrity", "referrerpolicy", "fetchpriority"]);
189
- function evalHeadValue(v) {
190
- return typeof v === "function" ? v() : v;
191
- }
192
- function evalHeadProps(props, presets) {
193
- const out = {};
194
- for (const name in props) out[name] = presets && name in presets ? presets[name] : evalHeadValue(props[name]);
195
- return out;
196
- }
197
- function classifyHeadTag(desc) {
198
- const tag = desc.tag;
199
- if (tag === "link") {
200
- const rel = evalHeadValue(desc.props && desc.props.rel);
201
- return {
202
- resource: RESOURCE_LINK_RELS.has(rel),
203
- rel
204
- };
205
- }
206
- if (tag === "style") return {
207
- resource: !!(desc.props && "href" in desc.props)
208
- };
209
- if (tag === "script") return {
210
- resource: !!(desc.props && "src" in desc.props)
211
- };
212
- return {
213
- resource: false
214
- };
215
- }
216
- function resourceIdentity(tag, props) {
217
- let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
218
- for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
219
- const q = RESOURCE_QUALIFIERS[i];
220
- if (props[q] != null) id += ":" + q + "=" + props[q];
221
- }
222
- return id;
223
- }
224
- function replaceableIdentity(tag, props, key, unique) {
225
- if (tag === "title") return "title";
226
- if (tag === "base") return "base";
227
- if (tag === "meta" && props.charset != null) return "charset";
228
- if (key != null) return tag + ":key:" + key;
229
- if (tag === "meta") {
230
- for (const ns of ["name", "property", "http-equiv"]) if (props[ns] != null) return "meta:" + ns + ":" + props[ns] + (props.media != null ? ":media=" + props.media : "");
231
- return unique;
232
- }
233
- if (tag === "link") {
234
- const rel = props.rel || "";
235
- if (rel === "icon" || rel === "apple-touch-icon") return "link:" + rel + (props.sizes != null ? ":sizes=" + props.sizes : "") + (props.type != null ? ":type=" + props.type : "");
236
- return "link:" + rel + ":" + (props.href || "");
237
- }
238
- return unique;
239
- }
240
- function resolveHead(groups) {
241
- const winners = new Map();
242
- const sorted = groups.slice().sort((a, b) => a.seq - b.seq);
243
- for (let i = 0; i < sorted.length; i++) {
244
- const group = sorted[i];
245
- const byIdentity = new Map();
246
- for (let j = 0; j < group.tags.length; j++) {
247
- const t = group.tags[j];
248
- let list = byIdentity.get(t.identity);
249
- if (!list) byIdentity.set(t.identity, list = []);
250
- list.push(t);
251
- }
252
- for (const [identity, tags] of byIdentity) {
253
- if (identity === "title") {
254
- winners.set(identity, {
255
- seq: group.seq,
256
- tags: [tags[tags.length - 1]]
257
- });
258
- } else {
259
- winners.set(identity, {
260
- seq: group.seq,
261
- tags
262
- });
263
- }
264
- }
265
- }
266
- return winners;
267
- }
268
-
269
- function parseCookieHeader(header) {
270
- const cookies = {};
271
- if (!header) return cookies;
272
- for (const part of header.split(";")) {
273
- const eq = part.indexOf("=");
274
- if (eq < 0) continue;
275
- const name = decodeSafe(part.slice(0, eq).trim());
276
- let value = part.slice(eq + 1).trim();
277
- if (value.length > 1 && value[0] === '"' && value[value.length - 1] === '"') {
278
- value = value.slice(1, -1);
279
- }
280
- cookies[name] = decodeSafe(value);
281
- }
282
- return cookies;
283
- }
284
- function decodeSafe(text) {
285
- try {
286
- return decodeURIComponent(text);
287
- } catch {
288
- return text;
289
- }
290
- }
291
- function serializeCookie(name, value, options = {}) {
292
- let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
293
- cookie += `; Path=${options.path === undefined ? "/" : options.path}`;
294
- if (options.domain) cookie += `; Domain=${options.domain}`;
295
- if (options.maxAge !== undefined) cookie += `; Max-Age=${Math.trunc(options.maxAge)}`;
296
- if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
297
- if (options.httpOnly) cookie += "; HttpOnly";
298
- if (options.secure) cookie += "; Secure";
299
- if (options.sameSite) {
300
- const sameSite = options.sameSite.toLowerCase();
301
- cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
302
- }
303
- return cookie;
304
- }
305
- const FLASH_COOKIE = "flash";
306
- const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
307
- function hasFlashCookie(cookieHeader) {
308
- return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
309
- }
310
- function clearFlashCookie() {
311
- return `${FLASH_COOKIE}=; Max-Age=0; Path=/`;
312
- }
313
-
314
- const SERVER_FUNCTION_METADATA = Symbol.for("solid.ServerFunctionMetadata");
315
- function getServerFunctionMetadata(fn) {
316
- if (typeof fn !== "function") return undefined;
317
- return fn[SERVER_FUNCTION_METADATA] || undefined;
318
- }
319
- function isServerFunction(fn) {
320
- return typeof fn === "function" && !!fn[SERVER_FUNCTION_METADATA];
321
- }
322
- const SERVER_FUNCTION_RPC = Symbol.for("solid.ServerFunctionRPC");
323
- function getServerFunctionRPC() {
324
- return globalThis[SERVER_FUNCTION_RPC];
325
- }
326
-
327
- const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
328
- const INNER_OWNED = {};
329
- const delegatedEvents = new Set();
330
- const delegatedContainers = new Map();
331
- function render$1(code, element, init, options = {}) {
332
- let disposer;
333
- registerDelegatedRoot(element);
334
- try {
335
- solidJs.createRoot(dispose => {
336
- disposer = dispose;
337
- if (element === document) {
338
- const tree = code();
339
- effect(() => solidJs.flatten(tree), () => {});
340
- } else {
341
- const tree = code();
342
- insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
343
- }
344
- }, {
345
- id: options.renderId
346
- });
347
- } catch (err) {
348
- if (disposer) disposer();
349
- unregisterDelegatedRoot(element);
350
- throw err;
351
- }
352
- return () => {
353
- disposer();
354
- unregisterDelegatedRoot(element);
355
- element.textContent = "";
356
- };
357
- }
358
- function create(html, bypassGuard, flag) {
359
- const t = document.createElement("template");
360
- t.innerHTML = html;
361
- return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
362
- }
363
- function template(html, flag) {
364
- let node;
365
- const fn = flag === 1 ? bypassGuard => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : bypassGuard => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
366
- return fn;
367
- }
368
- function delegateEvents(eventNames) {
369
- for (let i = 0, l = eventNames.length; i < l; i++) {
370
- const name = eventNames[i];
371
- if (!delegatedEvents.has(name)) {
372
- delegatedEvents.add(name);
373
- delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
374
- }
375
- }
376
- }
377
- function registerDelegatedRoot(root) {
378
- const state = registerDelegatedContainer(root, root);
379
- if (state) state.roots = (state.roots || 0) + 1;
380
- }
381
- function unregisterDelegatedRoot(root) {
382
- const state = delegatedContainers.get(root);
383
- if (state) state.roots > 1 ? state.roots-- : delete state.roots;
384
- unregisterDelegatedContainer(root, root);
385
- }
386
- function registerDelegatedContainer(container, owner = container) {
387
- if (!container || !owner) return;
388
- let state = delegatedContainers.get(container);
389
- if (!state) delegatedContainers.set(container, state = {
390
- owners: new Map(),
391
- handlers: new Map()
392
- });
393
- state.owners.set(owner, (state.owners.get(owner) || 0) + 1);
394
- delegatedEvents.forEach(name => attachDelegatedEvent(name, container, state));
395
- return state;
396
- }
397
- function unregisterDelegatedContainer(container, owner = container) {
398
- const state = delegatedContainers.get(container);
399
- if (!state) return;
400
- const count = state.owners.get(owner);
401
- if (count > 1) state.owners.set(owner, count - 1);else state.owners.delete(owner);
402
- if (state.owners.size) return;
403
- state.handlers.forEach((handler, name) => container.removeEventListener(name, handler));
404
- delegatedContainers.delete(container);
405
- }
406
- function attachDelegatedEvent(name, container, state) {
407
- if (state.handlers.has(name)) return;
408
- const handler = e => eventHandler(e, container, state);
409
- state.handlers.set(name, handler);
410
- container.addEventListener(name, handler);
411
- }
412
- function getDelegatedRoot(node) {
413
- while (node) {
414
- if (delegatedContainers.get(node)?.roots) return node;
415
- node = node._$host || node.parentNode || node.host;
416
- }
417
- }
418
- function findOwner(target, state) {
419
- let node = target;
420
- let distance = 0;
421
- while (node) {
422
- if (state.owners.has(node)) return {
423
- owner: node,
424
- distance
425
- };
426
- distance++;
427
- node = node._$host || node.parentNode || node.host;
428
- }
429
- }
430
- function setProperty(node, name, value) {
431
- if (isHydrating(node)) return;
432
- node[name] = value;
433
- }
434
- let claimHandlers = null;
435
- const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
436
- function registerElementClaim(handler) {
437
- (claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
438
- return () => {
439
- const index = claimHandlers.indexOf(handler);
440
- index > -1 && claimHandlers.splice(index, 1);
441
- };
442
- }
443
- const CLAIMED_ELEMENTS = "a[href], form[action]";
444
- function claimElementTree(root) {
445
- const handlers = globalThis[CLAIM_SEAM];
446
- if (handlers === undefined || handlers.length === 0) return root;
447
- const isElement = root.nodeType === 1;
448
- if (!isElement && root.nodeType !== 11) return root;
449
- if (isElement && root.matches(CLAIMED_ELEMENTS)) {
450
- for (let i = 0; i < handlers.length; i++) handlers[i](root);
451
- }
452
- const found = root.querySelectorAll(CLAIMED_ELEMENTS);
453
- for (let i = 0; i < found.length; i++) {
454
- for (let j = 0; j < handlers.length; j++) handlers[j](found[i]);
455
- }
456
- return root;
457
- }
458
- function claimElement(node) {
459
- if (claimHandlers !== null) {
460
- for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
461
- }
462
- return node;
463
- }
464
- function setAttribute(node, name, value) {
465
- if (isHydrating(node)) return;
466
- if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
467
- if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
468
- }
469
- function setAttributeNS(node, namespace, name, value) {
470
- if (isHydrating(node)) return;
471
- if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
472
- }
473
- function className(node, value, prev) {
474
- if (isHydrating(node)) return;
475
- if (value == null || value === false) {
476
- prev && node.removeAttribute("class");
477
- return;
478
- }
479
- if (typeof value === "string") {
480
- value !== prev && node.setAttribute("class", value);
481
- return;
482
- }
483
- if (typeof prev === "string") {
484
- prev = {};
485
- node.removeAttribute("class");
486
- } else prev = classListToObject(prev || {});
487
- value = classListToObject(value);
488
- const classKeys = Object.keys(value || {});
489
- const prevKeys = Object.keys(prev);
490
- let i, len;
491
- for (i = 0, len = prevKeys.length; i < len; i++) {
492
- const key = prevKeys[i];
493
- if (!key || key === "undefined" || value[key]) continue;
494
- node.classList.remove(key);
495
- }
496
- for (i = 0, len = classKeys.length; i < len; i++) {
497
- const key = classKeys[i],
498
- classValue = !!value[key];
499
- if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
500
- node.classList.add(key);
501
- }
502
- }
503
- function addEvent(node, name, handler, delegate) {
504
- if (delegate) {
505
- if (Array.isArray(handler)) {
506
- node[`$$${name}`] = handler[0];
507
- node[`$$${name}Data`] = handler[1];
508
- } else node[`$$${name}`] = handler;
509
- } else if (Array.isArray(handler)) {
510
- const handlerFn = handler[0];
511
- node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
512
- } else node.addEventListener(name, handler, typeof handler !== "function" && handler);
513
- }
514
- function style(node, value, prev) {
515
- if (!value) {
516
- if (prev || node._$styles) {
517
- setAttribute(node, "style");
518
- node._$styles = undefined;
519
- }
520
- return;
521
- }
522
- const nodeStyle = node.style;
523
- if (typeof value === "string") {
524
- node._$styles = undefined;
525
- return nodeStyle.cssText = value;
526
- }
527
- if (typeof prev === "string") {
528
- nodeStyle.cssText = "";
529
- prev = undefined;
530
- }
531
- let applied = node._$styles;
532
- if (!applied) {
533
- applied = node._$styles = prev ? {
534
- ...prev
535
- } : {};
536
- }
537
- let v, s;
538
- for (s in applied) {
539
- if (value[s] == null) {
540
- nodeStyle.removeProperty(s);
541
- delete applied[s];
542
- }
543
- }
544
- for (s in value) {
545
- v = value[s];
546
- if (v != null && v !== applied[s]) {
547
- nodeStyle.setProperty(s, v);
548
- applied[s] = v;
549
- }
550
- }
551
- }
552
- function setStyleProperty(node, name, value) {
553
- value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
554
- }
555
- function spread(node, props = {}, skipChildren) {
556
- const prevProps = {};
557
- if (!skipChildren) insert(node, () => props.children);
558
- effect(() => {
559
- const r = props.ref;
560
- (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
561
- }, () => {});
562
- effect(() => {
563
- const newProps = {};
564
- for (const prop in props) {
565
- if (prop === "children" || prop === "ref") continue;
566
- newProps[prop] = props[prop];
567
- }
568
- return newProps;
569
- }, props => assign(node, props, true, prevProps, true));
570
- return prevProps;
571
- }
572
- function dynamicProperty(props, key) {
573
- const src = props[key];
574
- Object.defineProperty(props, key, {
575
- get() {
576
- return src();
577
- },
578
- enumerable: true
579
- });
580
- return props;
581
- }
582
- function applyRef(r, element) {
583
- Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
584
- }
585
- function ref(fn, element) {
586
- const resolved = solidJs.untrack(fn);
587
- solidJs.runWithOwner(null, () => applyRef(resolved, element));
588
- }
589
- function scope(fn) {
590
- fn.$s = true;
591
- return fn;
592
- }
593
- const SCOPE_OPTIONS = {
594
- scope: true
595
- };
596
- let hydrationRt = null;
597
- function installHydrationRuntime() {
598
- hydrationRt = {
599
- claimInitial(parent, multi, initial) {
600
- if (isHydrating(parent)) {
601
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
602
- if (Array.isArray(initial)) stripTextSeparators(initial);
603
- }
604
- return initial;
605
- },
606
- reclaimRegion(current, parent, marker) {
607
- if (!solidJs.sharedConfig.hydrating || !current || !parent.isConnected) return current;
608
- const first = Array.isArray(current) ? current[0] : current;
609
- if (!first || !first.nodeType || first.isConnected) return current;
610
- let nodes;
611
- if (marker) {
612
- nodes = [];
613
- let node = marker.previousSibling,
614
- depth = 0;
615
- while (node) {
616
- if (node.nodeType === 8) {
617
- const v = node.nodeValue;
618
- if (v === "/") depth++;else if (v === "$") {
619
- if (depth === 0) break;
620
- depth--;
621
- }
622
- }
623
- nodes.unshift(node);
624
- node = node.previousSibling;
625
- }
626
- } else nodes = [...parent.childNodes];
627
- return stripTextSeparators(nodes);
628
- },
629
- dedupEvent(e) {
630
- return !!(solidJs.sharedConfig.registry && solidJs.sharedConfig.events && solidJs.sharedConfig.events.find(([el, ev]) => ev === e));
631
- }
632
- };
633
- }
634
- function stripTextSeparators(nodes) {
635
- let j = 0;
636
- for (let i = 0; i < nodes.length; i++) {
637
- const node = nodes[i],
638
- t = node.nodeType;
639
- if (t === 8) {
640
- const v = node.nodeValue;
641
- if (v === "!$") {
642
- node.remove();
643
- continue;
644
- }
645
- if (v.startsWith("pl-")) continue;
646
- } else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
647
- nodes[j++] = node;
648
- }
649
- nodes.length = j;
650
- return nodes;
651
- }
652
- function insert(parent, accessor, marker, initial, options) {
653
- const multi = marker !== undefined;
654
- const host = options && options.host;
655
- if (multi && !initial) initial = [];
656
- if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
657
- if (typeof accessor !== "function") {
658
- accessor = normalize(accessor, initial, multi, true);
659
- if (typeof accessor !== "function") {
660
- insertExpression(parent, accessor, initial, marker);
661
- host && tagHost(accessor, host);
662
- return;
663
- }
664
- }
665
- if (multi && initial.length === 0) {
666
- const placeholder = document.createTextNode("");
667
- parent.insertBefore(placeholder, marker);
668
- initial = [placeholder];
669
- }
670
- let current = initial;
671
- effect(prev => {
672
- if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
673
- const value = normalize(accessor(), current, multi, true);
674
- if (typeof value !== "function") return value;
675
- effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
676
- current = insertExpression(parent, inner, current, marker);
677
- host && tagHost(current, host);
678
- }, prev !== undefined && !(options && options.schedule) ? {
679
- ...options,
680
- schedule: true
681
- } : options);
682
- return INNER_OWNED;
683
- }, value => {
684
- if (value === INNER_OWNED) return;
685
- current = insertExpression(parent, value, current, marker);
686
- host && tagHost(current, host);
687
- },
688
- accessor.$s ? options ? {
689
- ...options,
690
- scope: true
691
- } : SCOPE_OPTIONS : options);
692
- }
693
- function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
694
- const nodeName = node.nodeName;
695
- props || (props = {});
696
- for (const prop in prevProps) {
697
- if (!(prop in props)) {
698
- if (prop === "children") continue;
699
- prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
700
- }
701
- }
702
- for (const prop in props) {
703
- if (prop === "children") {
704
- if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
705
- continue;
706
- }
707
- prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
708
- }
709
- }
710
- const ASSET_REMOVAL_GRACE = 100;
711
- const assetRegistry = new Map();
712
- function assetEntryKey(descriptor) {
713
- if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
714
- return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
715
- }
716
- function findAssetElement(selector, attr, value) {
717
- const nodes = document.querySelectorAll(selector);
718
- for (let i = 0; i < nodes.length; i++) {
719
- if (nodes[i].getAttribute(attr) === value) return nodes[i];
720
- }
721
- return null;
722
- }
723
- function setAssetAttrs(el, attrs) {
724
- for (const name in attrs) el.setAttribute(name, attrs[name]);
725
- }
726
- function mountAssetElement(descriptor) {
727
- let el;
728
- if (descriptor.type === "inline-style") {
729
- el = findAssetElement("style[data-asset]", "data-asset", descriptor.id);
730
- if (!el) {
731
- el = document.createElement("style");
732
- el.setAttribute("data-asset", descriptor.id);
733
- el.textContent = descriptor.content || "";
734
- }
735
- } else {
736
- const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
737
- el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
738
- if (!el) {
739
- el = document.createElement("link");
740
- el.rel = rel;
741
- el.href = descriptor.href;
742
- }
743
- }
744
- if (descriptor.attrs) setAssetAttrs(el, descriptor.attrs);
745
- if (!el.isConnected) document.head.appendChild(el);
746
- return el;
747
- }
748
- const assetLoadSettled = /*#__PURE__*/Promise.resolve();
749
- function trackAssetLoad(entry, adopted) {
750
- if (entry.loadPromise) return;
751
- const el = entry.element;
752
- let settled = el.sheet != null;
753
- if (!settled && adopted && typeof performance !== "undefined" && performance.getEntriesByName) {
754
- settled = performance.getEntriesByName(el.href).length > 0;
755
- }
756
- if (settled) {
757
- entry.loadState = "loaded";
758
- entry.loadPromise = assetLoadSettled;
759
- return;
760
- }
761
- entry.loadState = "pending";
762
- entry.loadPromise = new Promise(resolve => {
763
- const settle = state => {
764
- entry.loadState = state;
765
- resolve();
766
- };
767
- el.addEventListener("load", () => settle("loaded"), {
768
- once: true
769
- });
770
- el.addEventListener("error", () => settle("errored"), {
771
- once: true
772
- });
773
- });
774
- }
775
- function warmAsset(descriptor) {
776
- if (descriptor.policy === "exclusive" || descriptor.type === "inline-style") return;
777
- const key = assetEntryKey(descriptor);
778
- let entry = assetRegistry.get(key);
779
- if (!entry) {
780
- entry = {
781
- count: 0,
782
- element: null,
783
- timer: null
784
- };
785
- assetRegistry.set(key, entry);
786
- }
787
- let adopted = true;
788
- if (!entry.element || !entry.element.isConnected) {
789
- const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
790
- let el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
791
- if (!el && descriptor.type === "style") {
792
- el = findAssetElement('link[rel="preload"][as="style"]', "href", descriptor.href);
793
- }
794
- if (!el) {
795
- adopted = false;
796
- el = document.createElement("link");
797
- if (descriptor.type === "style") {
798
- el.setAttribute("rel", "preload");
799
- el.setAttribute("as", "style");
800
- } else {
801
- el.setAttribute("rel", "modulepreload");
802
- }
803
- el.setAttribute("href", descriptor.href);
804
- if (!document.body) el.setAttribute("blocking", "render");
805
- }
806
- if (descriptor.attrs) setAssetAttrs(el, descriptor.attrs);
807
- if (!el.isConnected) document.head.appendChild(el);
808
- entry.element = el;
809
- entry.loadState = undefined;
810
- entry.loadPromise = undefined;
811
- }
812
- if (descriptor.type === "style") trackAssetLoad(entry, adopted);
813
- return entry;
814
- }
815
- function acquireAsset(descriptor) {
816
- const key = assetEntryKey(descriptor);
817
- let entry = assetRegistry.get(key);
818
- if (descriptor.policy === "exclusive") {
819
- if (!entry) {
820
- entry = {
821
- original: descriptor.get(),
822
- set: descriptor.set,
823
- writers: []
824
- };
825
- assetRegistry.set(key, entry);
826
- }
827
- const writer = {
828
- value: descriptor.value
829
- };
830
- entry.writers.push(writer);
831
- entry.set(writer.value);
832
- let released = false;
833
- return () => {
834
- if (released) return;
835
- released = true;
836
- const index = entry.writers.indexOf(writer);
837
- const wasTop = index === entry.writers.length - 1;
838
- entry.writers.splice(index, 1);
839
- if (!wasTop) return;
840
- if (entry.writers.length) {
841
- entry.set(entry.writers[entry.writers.length - 1].value);
842
- } else {
843
- entry.set(entry.original);
844
- assetRegistry.delete(key);
845
- }
846
- };
847
- }
848
- if (!entry) {
849
- entry = {
850
- count: 0,
851
- element: null,
852
- timer: null
853
- };
854
- assetRegistry.set(key, entry);
855
- }
856
- if (entry.timer) {
857
- clearTimeout(entry.timer);
858
- entry.timer = null;
859
- }
860
- entry.count++;
861
- if (!entry.element || !entry.element.isConnected) {
862
- entry.element = mountAssetElement(descriptor);
863
- } else if (descriptor.type === "style" && entry.element.getAttribute("rel") === "preload") {
864
- entry.element.removeAttribute("as");
865
- entry.element.setAttribute("rel", "stylesheet");
866
- }
867
- let released = false;
868
- return () => {
869
- if (released) return;
870
- released = true;
871
- if (--entry.count > 0) return;
872
- entry.timer = setTimeout(() => {
873
- assetRegistry.delete(key);
874
- entry.element && entry.element.remove();
875
- }, ASSET_REMOVAL_GRACE);
876
- };
877
- }
878
- let headRegistrations = null;
879
- let headSeq = 0;
880
- let headUid = 0;
881
- let headOwned = null;
882
- let headApplied = null;
883
- let headFallbackTitle = null;
884
- let headScheduled = false;
885
- const headMountedResources = new Set();
886
- function initHeadRegistry() {
887
- if (headRegistrations) return;
888
- headRegistrations = [];
889
- headOwned = new Map();
890
- headApplied = new Map();
891
- const t = document.querySelector("title");
892
- headFallbackTitle = t && !t.hasAttribute("data-dh") ? t.textContent : null;
893
- if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
894
- }
895
- function applyServerHeadOps(ops) {
896
- for (let i = 0; i < ops.length; i++) {
897
- const op = ops[i];
898
- const identity = op[0] === "t" ? "title" : op[1];
899
- if (headOwned.has(identity)) continue;
900
- if (op[0] === "t") setHeadTitle(op[1]);else if (op[0] === "r") {
901
- const els = headMarkedElements(identity);
902
- for (let j = 0; j < els.length; j++) els[j].remove();
903
- } else {
904
- const el = document.createElement(op[2]);
905
- for (const name in op[3]) el.setAttribute(name, op[3][name]);
906
- if (op[4] != null) el.textContent = op[4];
907
- el.setAttribute("data-dh", identity);
908
- document.head.appendChild(el);
909
- }
910
- }
911
- }
912
- function headMarkedElements(identity) {
913
- const nodes = document.head.querySelectorAll("[data-dh]");
914
- const out = [];
915
- for (let i = 0; i < nodes.length; i++) {
916
- if (nodes[i].getAttribute("data-dh") === identity) out.push(nodes[i]);
917
- }
918
- return out;
919
- }
920
- function setHeadTitle(text) {
921
- let el = document.querySelector("title");
922
- if (!el) {
923
- el = document.createElement("title");
924
- document.head.appendChild(el);
925
- }
926
- el.textContent = text;
927
- el.setAttribute("data-dh", "title");
928
- return el;
929
- }
930
- function scheduleHeadApply() {
931
- if (headScheduled) return;
932
- headScheduled = true;
933
- queueMicrotask(flushHeadRegistry);
934
- }
935
- function flushHeadRegistry() {
936
- if (solidJs.sharedConfig.hydrating) {
937
- setTimeout(flushHeadRegistry, 0);
938
- return;
939
- }
940
- headScheduled = false;
941
- const winners = resolveHead(headRegistrations);
942
- for (const [identity, els] of headOwned) {
943
- if (winners.has(identity)) continue;
944
- headOwned.delete(identity);
945
- headApplied.delete(identity);
946
- if (identity === "title") {
947
- if (headFallbackTitle != null) setHeadTitle(headFallbackTitle).removeAttribute("data-dh");
948
- } else {
949
- for (let i = 0; i < els.length; i++) els[i].remove();
950
- }
951
- }
952
- for (const [identity, winner] of winners) {
953
- let sig = "";
954
- for (let i = 0; i < winner.tags.length; i++) sig += winner.tags[i].tag + JSON.stringify(winner.tags[i].props) + "|";
955
- if (headApplied.get(identity) === sig) continue;
956
- headApplied.set(identity, sig);
957
- if (identity === "base" || identity === "charset") {
958
- continue;
959
- }
960
- if (identity === "title") {
961
- const children = winner.tags[0].props.children;
962
- setHeadTitle(children == null ? "" : String(children));
963
- headOwned.set(identity, []);
964
- continue;
965
- }
966
- const existing = headMarkedElements(identity);
967
- const els = [];
968
- for (let i = 0; i < winner.tags.length; i++) {
969
- els.push(renderHeadElement(winner.tags[i], identity, existing));
970
- }
971
- for (let i = 0; i < existing.length; i++) {
972
- if (els.indexOf(existing[i]) === -1) existing[i].remove();
973
- }
974
- headOwned.set(identity, els);
975
- }
976
- }
977
- function createHeadElement(tag, props) {
978
- const el = document.createElement(tag);
979
- for (const name in props) {
980
- if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
981
- if (!HEAD_ATTR_NAME.test(name)) {
982
- continue;
983
- }
984
- const v = props[name];
985
- if (v == null || v === false) continue;
986
- el.setAttribute(name, v === true ? "" : String(v));
987
- }
988
- if (props.children != null) el.textContent = String(props.children);
989
- return el;
990
- }
991
- function renderHeadElement(t, identity, existing) {
992
- for (let i = 0; i < existing.length; i++) {
993
- if (headElementMatches(existing[i], t)) return existing.splice(i, 1)[0];
994
- }
995
- const el = createHeadElement(t.tag, t.props);
996
- el.setAttribute("data-dh", identity);
997
- document.head.appendChild(el);
998
- return el;
999
- }
1000
- function headElementMatches(el, t) {
1001
- if (el.tagName.toLowerCase() !== t.tag) return false;
1002
- for (const name in t.props) {
1003
- if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
1004
- if (!HEAD_ATTR_NAME.test(name)) continue;
1005
- const v = t.props[name];
1006
- if (v == null || v === false) {
1007
- if (el.hasAttribute(name)) return false;
1008
- } else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
1009
- }
1010
- const children = t.props.children;
1011
- return (children == null ? "" : String(children)) === el.textContent;
1012
- }
1013
- function mountHeadResource(tag, props) {
1014
- const identity = resourceIdentity(tag, props);
1015
- if (headMountedResources.has(identity)) return;
1016
- headMountedResources.add(identity);
1017
- const url = props.href || props.src;
1018
- let el = null;
1019
- if (url != null) {
1020
- 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);
1021
- }
1022
- if (!el) document.head.appendChild(createHeadElement(tag, props));
1023
- }
1024
- function gateHeadResource(props) {
1025
- const descriptor = {
1026
- type: props.rel === "stylesheet" ? "style" : "module",
1027
- href: props.href
1028
- };
1029
- let gateable = props.rel === "stylesheet" && props.href != null;
1030
- let attrs = null;
1031
- for (const name in props) {
1032
- if (name === "rel" || name === "href") continue;
1033
- if (!STYLESHEET_FETCH_META.has(name)) gateable = false;
1034
- if (!HEAD_ATTR_NAME.test(name)) continue;
1035
- const v = props[name];
1036
- if (v == null || v === false) continue;
1037
- (attrs || (attrs = {}))[name] = v === true ? "" : String(v);
1038
- }
1039
- if (attrs) descriptor.attrs = attrs;
1040
- effect(() => {
1041
- const entry = warmAsset(descriptor);
1042
- if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
1043
- }, () => acquireAsset(descriptor));
1044
- }
1045
- function useHead(tags) {
1046
- initHeadRegistry();
1047
- const reg = {
1048
- seq: -1,
1049
- tags: null
1050
- };
1051
- const uid = ++headUid;
1052
- effect(() => {
1053
- let list = typeof tags === "function" ? tags() : tags;
1054
- if (!Array.isArray(list)) list = [list];
1055
- const replaceable = [];
1056
- const resources = [];
1057
- for (let i = 0; i < list.length; i++) {
1058
- const desc = list[i];
1059
- if (!desc || !HEAD_ELIGIBLE_TAGS.has(desc.tag)) {
1060
- continue;
1061
- }
1062
- const cls = classifyHeadTag(desc);
1063
- const props = evalHeadProps(desc.props || {}, cls.rel !== undefined ? {
1064
- rel: cls.rel
1065
- } : undefined);
1066
- if (cls.resource) {
1067
- if (desc.tag === "link" && (props.rel === "stylesheet" || props.rel === "modulepreload")) {
1068
- gateHeadResource(props);
1069
- } else if (desc.tag === "link") {
1070
- mountHeadResource(desc.tag, props);
1071
- } else {
1072
- resources.push({
1073
- tag: desc.tag,
1074
- props
1075
- });
1076
- }
1077
- } else {
1078
- const key = evalHeadValue(desc.key);
1079
- replaceable.push({
1080
- tag: desc.tag,
1081
- props,
1082
- identity: replaceableIdentity(desc.tag, props, key, "u:c" + uid + ":" + i)
1083
- });
1084
- }
1085
- }
1086
- return {
1087
- replaceable,
1088
- resources
1089
- };
1090
- }, evaluated => {
1091
- for (let i = 0; i < evaluated.resources.length; i++) {
1092
- mountHeadResource(evaluated.resources[i].tag, evaluated.resources[i].props);
1093
- }
1094
- reg.tags = evaluated.replaceable;
1095
- if (reg.seq < 0) reg.seq = ++headSeq;
1096
- if (headRegistrations.indexOf(reg) === -1) headRegistrations.push(reg);
1097
- scheduleHeadApply();
1098
- return () => {
1099
- const idx = headRegistrations.indexOf(reg);
1100
- if (idx > -1) headRegistrations.splice(idx, 1);
1101
- scheduleHeadApply();
1102
- };
1103
- });
1104
- }
1105
- function loadModuleAssets(mapping) {
1106
- const hy = globalThis._$HY;
1107
- if (!hy) return;
1108
- const pending = [];
1109
- for (const key in mapping) {
1110
- if (hy.modules[key]) continue;
1111
- const entryUrl = mapping[key];
1112
- if (!hy.loading[key]) {
1113
- hy.loading[key] = import(entryUrl).then(mod => {
1114
- hy.modules[key] = mod;
1115
- }, err => {
1116
- delete hy.loading[key];
1117
- throw err;
1118
- });
1119
- }
1120
- pending.push(hy.loading[key]);
1121
- }
1122
- return pending.length ? Promise.all(pending).then(() => {}) : undefined;
1123
- }
1124
- function hydrate$1(code, element, options = {}) {
1125
- installHydrationRuntime();
1126
- if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
1127
- options.renderId ||= "";
1128
- if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
1129
- if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
1130
- solidJs.sharedConfig.completed = globalThis._$HY.completed;
1131
- solidJs.sharedConfig.events = globalThis._$HY.events;
1132
- solidJs.sharedConfig.load = id => globalThis._$HY.r[id];
1133
- solidJs.sharedConfig.has = id => id in globalThis._$HY.r;
1134
- solidJs.sharedConfig.gather = root => gatherHydratable(element, root);
1135
- solidJs.sharedConfig.loadModuleAssets = loadModuleAssets;
1136
- solidJs.sharedConfig.cleanupFragment = id => {
1137
- const tpl = document.getElementById("pl-" + id);
1138
- if (tpl) {
1139
- let node = tpl.nextSibling;
1140
- while (node) {
1141
- const next = node.nextSibling;
1142
- if (node.nodeType === 8 && node.nodeValue === "pl-" + id) {
1143
- node.remove();
1144
- break;
1145
- }
1146
- node.remove();
1147
- node = next;
1148
- }
1149
- tpl.remove();
1150
- }
1151
- };
1152
- solidJs.sharedConfig.registry = new Map();
1153
- if (!solidJs.sharedConfig.boundaryScopes) solidJs.sharedConfig.boundaryScopes = new Map();
1154
- solidJs.sharedConfig.captureBoundaryScope = id => {
1155
- if (solidJs.sharedConfig.registry) solidJs.sharedConfig.boundaryScopes.set(id, {
1156
- registry: solidJs.sharedConfig.registry,
1157
- gather: solidJs.sharedConfig.gather
1158
- });
1159
- };
1160
- solidJs.sharedConfig.hydrating = true;
1161
- const hyr = globalThis._$HY.r;
1162
- const rootMapping = hyr && (hyr[options.renderId + "_assets"] || hyr["_assets"]);
1163
- if (rootMapping && typeof rootMapping === "object") {
1164
- const p = loadModuleAssets(rootMapping);
1165
- if (p) {
1166
- gatherHydratable(element, options.renderId);
1167
- const registry = solidJs.sharedConfig.registry;
1168
- const gather = solidJs.sharedConfig.gather;
1169
- let disposer;
1170
- p.then(() => {
1171
- solidJs.sharedConfig.registry = registry;
1172
- solidJs.sharedConfig.gather = gather;
1173
- solidJs.sharedConfig.hydrating = true;
1174
- try {
1175
- disposer = render$1(code, element, [...element.childNodes], options);
1176
- } finally {
1177
- solidJs.sharedConfig.hydrating = false;
1178
- }
1179
- }, err => {
1180
- console.error("Hydration module preload failed, falling back to client render:", err);
1181
- solidJs.sharedConfig.hydrating = false;
1182
- solidJs.sharedConfig.registry = undefined;
1183
- disposer = render$1(code, element, [...element.childNodes], options);
1184
- });
1185
- return () => disposer && disposer();
1186
- }
1187
- }
1188
- try {
1189
- gatherHydratable(element, options.renderId);
1190
- return render$1(code, element, [...element.childNodes], options);
1191
- } finally {
1192
- solidJs.sharedConfig.hydrating = false;
1193
- }
1194
- }
1195
- function getNextElement(template) {
1196
- let node,
1197
- key,
1198
- hydrating = isHydrating();
1199
- if (!hydrating || !(node = solidJs.sharedConfig.registry.get(key = getHydrationKey()))) {
1200
- if (!template) {
1201
- throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
1202
- }
1203
- return template(true);
1204
- }
1205
- if (solidJs.sharedConfig.completed) solidJs.sharedConfig.completed.add(node);
1206
- solidJs.sharedConfig.registry.delete(key);
1207
- return node;
1208
- }
1209
- function getNextMatch(el, nodeName) {
1210
- while (el && el.localName !== nodeName) el = el.nextSibling;
1211
- return el;
1212
- }
1213
- function getNextMarker(start) {
1214
- let end = start,
1215
- count = 0,
1216
- current = [];
1217
- if (isHydrating(start)) {
1218
- while (end) {
1219
- if (end.nodeType === 8) {
1220
- const v = end.nodeValue;
1221
- if (v === "$") count++;else if (v === "/") {
1222
- if (count === 0) return [end, current];
1223
- count--;
1224
- }
1225
- }
1226
- current.push(end);
1227
- end = end.nextSibling;
1228
- }
1229
- }
1230
- return [end, current];
1231
- }
1232
- function getFirstChild(node, expectedTag) {
1233
- const child = node.firstChild;
1234
- return child;
1235
- }
1236
- function getNextSibling(node, expectedTag) {
1237
- const sibling = node.nextSibling;
1238
- return sibling;
1239
- }
1240
- function runHydrationEvents() {
1241
- if (solidJs.sharedConfig.events && !solidJs.sharedConfig.events.queued) {
1242
- queueMicrotask(() => {
1243
- const {
1244
- completed,
1245
- events
1246
- } = solidJs.sharedConfig;
1247
- if (!events) return;
1248
- events.queued = false;
1249
- while (events.length) {
1250
- const [el, e] = events[0];
1251
- if (!completed.has(el)) return;
1252
- events.shift();
1253
- let matchContainer, matchState, matchDistance, matches;
1254
- for (const [container, state] of delegatedContainers) {
1255
- if (!state.handlers.has(e.type)) continue;
1256
- const entry = findOwner(e.target, state);
1257
- if (!entry) continue;
1258
- if (matchContainer) {
1259
- if (!matches) matches = [{
1260
- container: matchContainer,
1261
- state: matchState,
1262
- distance: matchDistance
1263
- }];
1264
- matches.push({
1265
- container,
1266
- state,
1267
- distance: entry.distance
1268
- });
1269
- } else {
1270
- matchContainer = container;
1271
- matchState = state;
1272
- matchDistance = entry.distance;
1273
- }
1274
- }
1275
- if (matches) {
1276
- matches.sort((a, b) => a.distance - b.distance);
1277
- for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
1278
- } else if (matchContainer) eventHandler(e, matchContainer, matchState);
1279
- }
1280
- if (solidJs.sharedConfig.done) {
1281
- solidJs.sharedConfig.events = _$HY.events = null;
1282
- solidJs.sharedConfig.completed = _$HY.completed = null;
1283
- }
1284
- });
1285
- solidJs.sharedConfig.events.queued = true;
1286
- }
1287
- }
1288
- function isHydrating(node) {
1289
- if (!solidJs.sharedConfig.hydrating) return false;
1290
- if (!node || node.isConnected) return true;
1291
- const roots = solidJs.sharedConfig.claimRoots;
1292
- if (roots) {
1293
- for (let i = 0; i < roots.length; i++) {
1294
- if (roots[i].contains(node)) return true;
1295
- }
1296
- }
1297
- return false;
1298
- }
1299
- function classListToObject(classList) {
1300
- if (Array.isArray(classList)) {
1301
- const result = {};
1302
- flattenClassList(classList, result);
1303
- classList = result;
1304
- }
1305
- if (classList && typeof classList === "object") {
1306
- const result = {},
1307
- keys = Object.keys(classList);
1308
- for (let i = 0, len = keys.length; i < len; i++) {
1309
- const key = keys[i];
1310
- if (!classList[key]) continue;
1311
- const classNames = key.trim().split(/\s+/);
1312
- for (let j = 0, nameLen = classNames.length; j < nameLen; j++) classNames[j] && (result[classNames[j]] = true);
1313
- }
1314
- return result;
1315
- }
1316
- return classList;
1317
- }
1318
- function flattenClassList(list, result) {
1319
- for (let i = 0, len = list.length; i < len; i++) {
1320
- const item = list[i];
1321
- 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;
1322
- }
1323
- }
1324
- function assignProp(node, prop, value, prev, skipRef, nodeName) {
1325
- if (prop === "style") return style(node, value, prev), value;
1326
- if (prop === "class") return className(node, value, prev), value;
1327
- if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
1328
- if (prop === "ref") {
1329
- if (!skipRef && value) ref(() => value, node);
1330
- return value;
1331
- }
1332
- const hasNamespace = prop.indexOf(":") > -1;
1333
- if (!hasNamespace && prop.slice(0, 2) === "on") {
1334
- const name = prop.slice(2).toLowerCase();
1335
- const delegate = DelegatedEvents.has(name);
1336
- if (!delegate && prev) {
1337
- const h = Array.isArray(prev) ? prev[0] : prev;
1338
- node.removeEventListener(name, h);
1339
- }
1340
- if (delegate || value) {
1341
- addEvent(node, name, value, delegate);
1342
- delegate && delegateEvents([name]);
1343
- }
1344
- } else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
1345
- if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
1346
- if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
1347
- node[prop] = value ?? "";else node[prop] = value;
1348
- } else {
1349
- const ns = hasNamespace && Namespaces[prop.split(":")[0]];
1350
- if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
1351
- }
1352
- return value;
1353
- }
1354
- function eventHandler(e, container, state) {
1355
- if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
1356
- const prev = e[$$EVENT_OWNER];
1357
- let resumeNode;
1358
- if (prev) {
1359
- if (prev === true || prev === container || !container.contains(prev)) return;
1360
- resumeNode = prev;
1361
- }
1362
- const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
1363
- if (state && !owner) return;
1364
- e[$$EVENT_OWNER] = owner || true;
1365
- let node = resumeNode || e.target;
1366
- const key = `$$${e.type}`;
1367
- const oriTarget = e.target;
1368
- const boundary = owner || container || e.currentTarget;
1369
- const retarget = value => Object.defineProperty(e, "target", {
1370
- configurable: true,
1371
- value
1372
- });
1373
- const handleNode = () => {
1374
- const handler = node[key];
1375
- if (handler && !node.disabled) {
1376
- const data = node[`${key}Data`];
1377
- data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
1378
- if (e.cancelBubble) return;
1379
- }
1380
- node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
1381
- return true;
1382
- };
1383
- const walkUpTree = () => {
1384
- while (handleNode()) {
1385
- if (node === boundary || node.parentNode === boundary) break;
1386
- node = node._$host || node.parentNode || node.host;
1387
- }
1388
- };
1389
- Object.defineProperty(e, "currentTarget", {
1390
- configurable: true,
1391
- get() {
1392
- return node || boundary || document;
1393
- }
1394
- });
1395
- if (resumeNode) {
1396
- if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
1397
- if (node && node !== boundary) walkUpTree();
1398
- } else if (e.composedPath) {
1399
- const path = e.composedPath();
1400
- if (path.length) {
1401
- retarget(path[0]);
1402
- for (let i = 0; i < path.length; i++) {
1403
- node = path[i];
1404
- if (!handleNode()) break;
1405
- if (node._$host) {
1406
- node = node._$host;
1407
- walkUpTree();
1408
- break;
1409
- }
1410
- if (node === boundary || node.parentNode === boundary) {
1411
- break;
1412
- }
1413
- }
1414
- } else walkUpTree();
1415
- }
1416
- else walkUpTree();
1417
- retarget(oriTarget);
1418
- }
1419
- function insertExpression(parent, value, current, marker) {
1420
- if (hydrationRt !== null && isHydrating(parent)) {
1421
- if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
1422
- return value;
1423
- }
1424
- if (value === current) return value;
1425
- const t = typeof value,
1426
- multi = marker !== undefined;
1427
- if (t === "string" || t === "number") {
1428
- const tc = typeof current;
1429
- if (tc === "string" || tc === "number") {
1430
- parent.firstChild.data = value;
1431
- } else {
1432
- if (ownsAllChildren(parent, current)) parent.textContent = value;else {
1433
- removeOwnedChildren(parent, current);
1434
- parent.insertBefore(document.createTextNode(value), parent.firstChild);
1435
- }
1436
- }
1437
- } else if (value === undefined) {
1438
- cleanChildren(parent, current, marker);
1439
- } else if (value.nodeType) {
1440
- if (Array.isArray(current)) {
1441
- cleanChildren(parent, current, multi ? marker : null, value);
1442
- } else if (current && current.nodeType) {
1443
- current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
1444
- } else if (current && parent.firstChild) {
1445
- parent.replaceChild(value, parent.firstChild);
1446
- } else {
1447
- parent.appendChild(value);
1448
- }
1449
- if (marker) value[$$SLOT] = marker;
1450
- } else if (Array.isArray(value)) {
1451
- const currentArray = current && Array.isArray(current);
1452
- if (value.length === 0) {
1453
- cleanChildren(parent, current, marker);
1454
- } else if (currentArray) {
1455
- if (current.length === 0) {
1456
- appendNodes(parent, value, marker);
1457
- } else reconcileArrays(parent, current, value, marker);
1458
- } else {
1459
- current && cleanChildren(parent, current);
1460
- appendNodes(parent, value);
1461
- }
1462
- } else ;
1463
- return value;
1464
- }
1465
- function normalize(value, current, multi, doNotUnwrap) {
1466
- value = solidJs.flatten(value, {
1467
- skipNonRendered: true,
1468
- doNotUnwrap
1469
- });
1470
- if (doNotUnwrap && typeof value === "function") return value;
1471
- if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
1472
- if (Array.isArray(value)) {
1473
- for (let i = 0, len = value.length; i < len; i++) {
1474
- const item = value[i],
1475
- prev = current && current[i],
1476
- t = typeof item;
1477
- if (t === "string" || t === "number") value[i] = prev && prev.nodeType === 3 && (solidJs.sharedConfig.hydrating || prev.data === "" + item) ? prev : document.createTextNode(item);
1478
- }
1479
- }
1480
- return value;
1481
- }
1482
- function tagHost(value, host) {
1483
- if (Array.isArray(value)) {
1484
- for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
1485
- } else if (value && value.nodeType && value[$$HOST] !== host) {
1486
- value[$$HOST] = host;
1487
- Object.defineProperty(value, "_$host", {
1488
- get: host,
1489
- configurable: true
1490
- });
1491
- }
1492
- }
1493
- function appendNodes(parent, array, marker = null) {
1494
- for (let i = 0, len = array.length; i < len; i++) {
1495
- const n = array[i];
1496
- parent.insertBefore(n, marker);
1497
- if (marker) n[$$SLOT] = marker;
1498
- }
1499
- }
1500
- function ownsAllChildren(parent, current) {
1501
- if (current == null) return true;
1502
- if (Array.isArray(current)) {
1503
- return current.length ? parent.firstChild === current[0] && parent.lastChild === current[current.length - 1] : parent.firstChild === null;
1504
- }
1505
- if (current === "") return parent.firstChild === null;
1506
- if (current.nodeType) return parent.firstChild === current && parent.lastChild === current;
1507
- const first = parent.firstChild;
1508
- return first !== null && first.nodeType === 3 && parent.lastChild === first;
1509
- }
1510
- function removeOwnedChildren(parent, current) {
1511
- if (Array.isArray(current)) {
1512
- for (let i = 0; i < current.length; i++) {
1513
- const el = current[i];
1514
- if (el.parentNode === parent) el.remove();
1515
- }
1516
- } else if (current.nodeType) {
1517
- if (current.parentNode === parent) current.remove();
1518
- } else {
1519
- const first = parent.firstChild;
1520
- if (first && first.nodeType === 3) first.remove();
1521
- }
1522
- }
1523
- function cleanChildren(parent, current, marker, replacement) {
1524
- if (marker === undefined) {
1525
- if (ownsAllChildren(parent, current)) return parent.textContent = "";
1526
- return removeOwnedChildren(parent, current);
1527
- }
1528
- if (current.length) {
1529
- let inserted = false;
1530
- for (let i = current.length - 1; i >= 0; i--) {
1531
- const el = current[i];
1532
- if (replacement !== el) {
1533
- const tag = el[$$SLOT];
1534
- const owns = el.parentNode === parent && (!tag || tag === marker);
1535
- if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
1536
- } else inserted = true;
1537
- }
1538
- } else if (replacement) parent.insertBefore(replacement, marker);
1539
- if (replacement && marker) replacement[$$SLOT] = marker;
1540
- }
1541
- function gatherHydratable(element, root) {
1542
- const templates = element.querySelectorAll(`*[_hk]`);
1543
- for (let i = 0; i < templates.length; i++) {
1544
- const node = templates[i];
1545
- const key = node.getAttribute("_hk");
1546
- if (root) {
1547
- if (!key.startsWith(root)) continue;
1548
- } else {
1549
- const frame = node.closest("[data-fid]");
1550
- if (frame && frame !== element && element.contains(frame)) continue;
1551
- }
1552
- if (!solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
1553
- }
1554
- }
1555
- function getHydrationKey() {
1556
- return solidJs.sharedConfig.getNextContextId();
1557
- }
1558
- const voidFn = () => undefined;
1559
- const RequestContext = Symbol();
1560
-
1561
- function throwInBrowser(func) {
1562
- const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
1563
- console.error(err);
1564
- }
1565
- function renderToString(fn, options) {
1566
- throwInBrowser(renderToString);
1567
- }
1568
- function renderToStream(fn, options) {
1569
- throwInBrowser(renderToStream);
1570
- }
1571
- function createResponseStub() {
1572
- throwInBrowser(createResponseStub);
1573
- }
1574
- function createRequestEvent(request, init) {
1575
- throwInBrowser(createRequestEvent);
1576
- }
1577
- function getExpectedRedirectStatus(response) {
1578
- throwInBrowser(getExpectedRedirectStatus);
1579
- }
1580
- function createSSRResponse() {
1581
- throwInBrowser(createSSRResponse);
1582
- }
1583
- function commitEventResponse(response, event) {
1584
- throwInBrowser(commitEventResponse);
1585
- }
1586
- function composeMiddleware(middlewares) {
1587
- throwInBrowser(composeMiddleware);
1588
- }
1589
- function ssr(template, ...nodes) {}
1590
- function ssrElement(name, props, children, needsId) {}
1591
- function ssrClassName(value) {}
1592
- function ssrStyle(value) {}
1593
- function ssrStyleProperty(name, value) {}
1594
- function ssrAttribute(key, value) {}
1595
- function ssrGroup(fn, n) {}
1596
- function ssrHydrationKey() {}
1597
- function resolveSSRNode(node, result, top) {}
1598
- function escape(s, attr) {}
1599
-
1600
- const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
1601
- // PURE-annotated factory (same convention as solid's MockPromise): the brand
1602
- const ResponseEnvelope = /* @__PURE__ */(() => {
1603
- class ResponseEnvelope {
1604
- constructor(response, value) {
1605
- this.response = response;
1606
- this.value = value;
1607
- }
1608
- }
1609
- ResponseEnvelope.prototype[ENVELOPE] = true;
1610
- return ResponseEnvelope;
1611
- })();
1612
- function isResponseEnvelope(value) {
1613
- return !!(value && typeof value === "object" && value[ENVELOPE]);
1614
- }
1615
- const HREF = Symbol.for("solid.Href");
1616
- function isHref(value) {
1617
- return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
1618
- }
1619
- const SAFE_ERROR = Symbol.for("solid.SafeError");
1620
- function markSafeError(error) {
1621
- if (error && (typeof error === "object" || typeof error === "function")) {
1622
- Object.defineProperty(error, SAFE_ERROR, {
1623
- value: true,
1624
- enumerable: false,
1625
- configurable: true
1626
- });
1627
- }
1628
- return error;
1629
- }
1630
- function isSafeError(value) {
1631
- return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
1632
- }
1633
- const REVALIDATE_HEADER = "X-Revalidate";
1634
- function initWithRevalidate(init) {
1635
- const {
1636
- revalidate,
1637
- ...responseInit
1638
- } = init;
1639
- let headers;
1640
- if (responseInit.headers && responseInit.headers.getSetCookie) {
1641
- headers = new Headers();
1642
- responseInit.headers.forEach((value, key) => {
1643
- if (key !== "set-cookie") headers.append(key, value);
1644
- });
1645
- for (const cookie of responseInit.headers.getSetCookie()) {
1646
- headers.append("Set-Cookie", cookie);
1647
- }
1648
- } else {
1649
- headers = new Headers(responseInit.headers);
1650
- }
1651
- revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
1652
- return {
1653
- responseInit,
1654
- headers
1655
- };
1656
- }
1657
- function redirect(url, init = 302) {
1658
- if (typeof url !== "string" && !isHref(url)) {
1659
- throw new TypeError("redirect() expects a string URL or an Href-branded value (Symbol.for('solid.Href')).");
1660
- }
1661
- const {
1662
- responseInit,
1663
- headers
1664
- } = initWithRevalidate(typeof init === "number" ? {
1665
- status: init
1666
- } : init);
1667
- if (responseInit.status === undefined) {
1668
- responseInit.status = 302;
1669
- }
1670
- headers.set("Location", String(url));
1671
- return new Response(null, {
1672
- ...responseInit,
1673
- headers
1674
- });
1675
- }
1676
- function reload(init = {}) {
1677
- const {
1678
- responseInit,
1679
- headers
1680
- } = initWithRevalidate(init);
1681
- return new Response(null, {
1682
- ...responseInit,
1683
- headers
1684
- });
1685
- }
1686
- function respond(value, init = {}) {
1687
- const {
1688
- responseInit,
1689
- headers
1690
- } = initWithRevalidate(init);
1691
- headers.set("Content-Type", "application/json");
1692
- return new ResponseEnvelope(new Response(JSON.stringify(value), {
1693
- ...responseInit,
1694
- headers
1695
- }), value);
1696
- }
1697
-
1698
- const mergeProps = solidJs.merge;
1699
- const isServer = false;
1700
- const isDev = false;
1701
- function render(code, element, init, options = {}) {
1702
- try {
1703
- const dispose = render$1(code, element, init, {
1704
- ...options,
1705
- insertOptions: {
1706
- schedule: true
1707
- }
1708
- });
1709
- solidJs.flush();
1710
- return dispose;
1711
- } finally {
1712
- }
1713
- }
1714
- const hydrate = (...args) => {
1715
- solidJs.enableHydration();
1716
- return hydrate$1(...args);
1717
- };
1718
- function Portal(props) {
1719
- return solidJs.runWithOwner(solidJs.createOwner(), () => portalImpl(props));
1720
- }
1721
- function portalImpl(props) {
1722
- const treeMarker = document.createTextNode(""),
1723
- startMarker = document.createTextNode(""),
1724
- endMarker = document.createTextNode(""),
1725
- mount = () => props.mount || document.body,
1726
- content = solidJs.createMemo(() => [startMarker, props.children], {
1727
- ssrSource: "client",
1728
- loadingValue: undefined
1729
- });
1730
- solidJs.createRenderEffect(
1731
- () => [mount(), content(), solidJs.getOwner()], ([, c, owner]) => {
1732
- const m = solidJs.untrack(mount);
1733
- m.appendChild(endMarker);
1734
- const dispose = solidJs.runWithOwner(owner, () => solidJs.createRoot(d => {
1735
- insert(m, c, endMarker, undefined, {
1736
- host: () => treeMarker.parentNode
1737
- });
1738
- return d;
1739
- }));
1740
- return () => {
1741
- dispose();
1742
- let c = startMarker;
1743
- while (c) {
1744
- const n = c.nextSibling;
1745
- m.removeChild(c);
1746
- if (c === endMarker) break;
1747
- c = n;
1748
- }
1749
- };
1750
- },
1751
- {
1752
- schedule: true,
1753
- ssrSource: "client"
1754
- });
1755
- solidJs.createEffect(mount, () => {
1756
- const m = solidJs.untrack(mount);
1757
- const ownerRoot = getDelegatedRoot(treeMarker);
1758
- if (!ownerRoot || ownerRoot.contains(m)) return;
1759
- registerDelegatedContainer(m, ownerRoot);
1760
- return () => unregisterDelegatedContainer(m, ownerRoot);
1761
- }, {
1762
- ssrSource: "client"
1763
- });
1764
- if (solidJs.sharedConfig.hydrating) return solidJs.createMemo(() => treeMarker, {
1765
- ssrSource: "client",
1766
- loadingValue: undefined
1767
- });
1768
- return treeMarker;
1769
- }
1770
- const COMPONENT_BINDING = Symbol.for("dom-expressions.component-binding");
1771
- function bindingOf(value) {
1772
- return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
1773
- }
1774
- function dynamic(source) {
1775
- let latest = 0;
1776
- const sites = new Set();
1777
- let deliveredAddress;
1778
- const resolveBinding = (next, prev) => {
1779
- const binding = bindingOf(next);
1780
- if (!binding) return next;
1781
- deliveredAddress = binding.address;
1782
- const prevBinding = bindingOf(prev);
1783
- if (prevBinding && prevBinding.component === binding.component) {
1784
- for (const deliver of sites) deliver(binding.address);
1785
- return prev;
1786
- }
1787
- return next;
1788
- };
1789
- const cached = solidJs.createMemo(prev => {
1790
- const next = source();
1791
- if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
1792
- const token = ++latest;
1793
- return {
1794
- then: (onFulfilled, onRejected) => next.then(resolved => onFulfilled(token === latest ? resolveBinding(resolved, prev) : resolved), onRejected)
1795
- };
1796
- }, {
1797
- lazy: true
1798
- });
1799
- return props => {
1800
- return solidJs.createMemo(() => {
1801
- const component = cached();
1802
- switch (typeof component) {
1803
- case "function":
1804
- {
1805
- const binding = bindingOf(component);
1806
- if (binding) {
1807
- const [address, setAddress] = solidJs.createSignal(deliveredAddress ?? binding.address);
1808
- sites.add(setAddress);
1809
- solidJs.onCleanup(() => sites.delete(setAddress));
1810
- return solidJs.untrack(() => binding.component(props, address));
1811
- }
1812
- return solidJs.untrack(() => component(props));
1813
- }
1814
- case "string":
1815
- const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
1816
- spread(el, props);
1817
- return el;
1818
- }
1819
- });
1820
- };
1821
- }
1822
- function Dynamic(props) {
1823
- const Comp = dynamic(() => props.component);
1824
- return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
1825
- }
1826
- function createElement(tagName, is = undefined) {
1827
- return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
1828
- is
1829
- });
1830
- }
1831
- function loadClientOnly(fn, setComp) {
1832
- fn().then(m => setComp(() => m.default));
1833
- }
1834
- function clientOnly(fn, options = {},
1835
- _moduleUrl) {
1836
- const [comp, setComp] = solidJs.createSignal();
1837
- let started = !options.lazy;
1838
- started && loadClientOnly(fn, setComp);
1839
- return props => {
1840
- let Comp;
1841
- let m;
1842
- const rest = solidJs.omit(props, "fallback");
1843
- if (!started) {
1844
- started = true;
1845
- loadClientOnly(fn, setComp);
1846
- }
1847
- if ((Comp = solidJs.untrack(comp)) && !solidJs.sharedConfig.hydrating) return Comp(rest);
1848
- const [mounted, setMounted] = solidJs.createSignal(!solidJs.sharedConfig.hydrating);
1849
- const gate = solidJs.createMemo(() => (Comp = comp(), m = mounted(), solidJs.untrack(() => Comp && m ? Comp(rest) : props.fallback)));
1850
- const onHydrationEnd = solidJs.sharedConfig.onHydrationEnd;
1851
- const release = () => setMounted(true);
1852
- onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
1853
- return gate;
1854
- };
1855
- }
1856
- function httpStatus(_code, _text) {}
1857
- function httpHeader(_name, _value, _options) {}
1858
-
1859
- Object.defineProperty(exports, "Errored", {
1860
- enumerable: true,
1861
- get: function () { return solidJs.Errored; }
1862
- });
1863
- Object.defineProperty(exports, "For", {
1864
- enumerable: true,
1865
- get: function () { return solidJs.For; }
1866
- });
1867
- Object.defineProperty(exports, "Hydration", {
1868
- enumerable: true,
1869
- get: function () { return solidJs.Hydration; }
1870
- });
1871
- Object.defineProperty(exports, "Loading", {
1872
- enumerable: true,
1873
- get: function () { return solidJs.Loading; }
1874
- });
1875
- Object.defineProperty(exports, "Match", {
1876
- enumerable: true,
1877
- get: function () { return solidJs.Match; }
1878
- });
1879
- Object.defineProperty(exports, "NoHydration", {
1880
- enumerable: true,
1881
- get: function () { return solidJs.NoHydration; }
1882
- });
1883
- Object.defineProperty(exports, "Repeat", {
1884
- enumerable: true,
1885
- get: function () { return solidJs.Repeat; }
1886
- });
1887
- Object.defineProperty(exports, "Reveal", {
1888
- enumerable: true,
1889
- get: function () { return solidJs.Reveal; }
1890
- });
1891
- Object.defineProperty(exports, "Show", {
1892
- enumerable: true,
1893
- get: function () { return solidJs.Show; }
1894
- });
1895
- Object.defineProperty(exports, "Switch", {
1896
- enumerable: true,
1897
- get: function () { return solidJs.Switch; }
1898
- });
1899
- Object.defineProperty(exports, "createComponent", {
1900
- enumerable: true,
1901
- get: function () { return solidJs.createComponent; }
1902
- });
1903
- Object.defineProperty(exports, "getOwner", {
1904
- enumerable: true,
1905
- get: function () { return solidJs.getOwner; }
1906
- });
1907
- Object.defineProperty(exports, "untrack", {
1908
- enumerable: true,
1909
- get: function () { return solidJs.untrack; }
1910
- });
1911
- exports.ChildProperties = ChildProperties;
1912
- exports.DOMElements = DOMElements;
1913
- exports.DOMWithState = DOMWithState;
1914
- exports.DelegatedEvents = DelegatedEvents;
1915
- exports.Dynamic = Dynamic;
1916
- exports.HREF = HREF;
1917
- exports.HydrationScript = voidFn;
1918
- exports.MathMLElements = MathMLElements;
1919
- exports.Namespaces = Namespaces;
1920
- exports.Portal = Portal;
1921
- exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
1922
- exports.RawTextElements = RawTextElements;
1923
- exports.RequestContext = RequestContext;
1924
- exports.ResponseEnvelope = ResponseEnvelope;
1925
- exports.SAFE_ERROR = SAFE_ERROR;
1926
- exports.SVGElements = SVGElements;
1927
- exports.VoidElements = VoidElements;
1928
- exports.acquireAsset = acquireAsset;
1929
- exports.addEvent = addEvent;
1930
- exports.applyRef = applyRef;
1931
- exports.assign = assign;
1932
- exports.claimElement = claimElement;
1933
- exports.claimElementTree = claimElementTree;
1934
- exports.className = className;
1935
- exports.clearFlashCookie = clearFlashCookie;
1936
- exports.clientOnly = clientOnly;
1937
- exports.commitEventResponse = commitEventResponse;
1938
- exports.composeMiddleware = composeMiddleware;
1939
- exports.createRequestEvent = createRequestEvent;
1940
- exports.createResponseStub = createResponseStub;
1941
- exports.createSSRResponse = createSSRResponse;
1942
- exports.delegateEvents = delegateEvents;
1943
- exports.dynamic = dynamic;
1944
- exports.dynamicProperty = dynamicProperty;
1945
- exports.effect = effect;
1946
- exports.escape = escape;
1947
- exports.generateHydrationScript = voidFn;
1948
- exports.getDelegatedRoot = getDelegatedRoot;
1949
- exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
1950
- exports.getFirstChild = getFirstChild;
1951
- exports.getHydrationKey = getHydrationKey;
1952
- exports.getNextElement = getNextElement;
1953
- exports.getNextMarker = getNextMarker;
1954
- exports.getNextMatch = getNextMatch;
1955
- exports.getNextSibling = getNextSibling;
1956
- exports.getRequestEvent = voidFn;
1957
- exports.getServerFunctionMetadata = getServerFunctionMetadata;
1958
- exports.getServerFunctionRPC = getServerFunctionRPC;
1959
- exports.hasFlashCookie = hasFlashCookie;
1960
- exports.httpHeader = httpHeader;
1961
- exports.httpStatus = httpStatus;
1962
- exports.hydrate = hydrate;
1963
- exports.insert = insert;
1964
- exports.installHydrationRuntime = installHydrationRuntime;
1965
- exports.isDev = isDev;
1966
- exports.isHref = isHref;
1967
- exports.isResponseEnvelope = isResponseEnvelope;
1968
- exports.isSafeError = isSafeError;
1969
- exports.isServer = isServer;
1970
- exports.isServerFunction = isServerFunction;
1971
- exports.markSafeError = markSafeError;
1972
- exports.memo = memo;
1973
- exports.mergeProps = mergeProps;
1974
- exports.parseCookieHeader = parseCookieHeader;
1975
- exports.redirect = redirect;
1976
- exports.ref = ref;
1977
- exports.registerDelegatedContainer = registerDelegatedContainer;
1978
- exports.registerDelegatedRoot = registerDelegatedRoot;
1979
- exports.registerElementClaim = registerElementClaim;
1980
- exports.reload = reload;
1981
- exports.render = render;
1982
- exports.renderToStream = renderToStream;
1983
- exports.renderToString = renderToString;
1984
- exports.resolveSSRNode = resolveSSRNode;
1985
- exports.respond = respond;
1986
- exports.runHydrationEvents = runHydrationEvents;
1987
- exports.scope = scope;
1988
- exports.serializeCookie = serializeCookie;
1989
- exports.setAttribute = setAttribute;
1990
- exports.setAttributeNS = setAttributeNS;
1991
- exports.setProperty = setProperty;
1992
- exports.setStyleProperty = setStyleProperty;
1993
- exports.spread = spread;
1994
- exports.ssr = ssr;
1995
- exports.ssrAttribute = ssrAttribute;
1996
- exports.ssrClassName = ssrClassName;
1997
- exports.ssrElement = ssrElement;
1998
- exports.ssrGroup = ssrGroup;
1999
- exports.ssrHydrationKey = ssrHydrationKey;
2000
- exports.ssrStyle = ssrStyle;
2001
- exports.ssrStyleProperty = ssrStyleProperty;
2002
- exports.style = style;
2003
- exports.template = template;
2004
- exports.unregisterDelegatedContainer = unregisterDelegatedContainer;
2005
- exports.unregisterDelegatedRoot = unregisterDelegatedRoot;
2006
- exports.useHead = useHead;
2007
- exports.warmAsset = warmAsset;