@solidjs/web 2.0.0-experimental.9 → 2.0.0-rc.1
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.
- package/README.md +22 -4
- package/dist/dev.cjs +1588 -224
- package/dist/dev.js +1513 -200
- package/dist/server.cjs +2722 -254
- package/dist/server.js +2659 -245
- package/dist/web.cjs +1524 -218
- package/dist/web.js +1449 -194
- package/frames/dist/client.cjs +1916 -0
- package/frames/dist/client.dev.cjs +1933 -0
- package/frames/dist/client.dev.js +1921 -0
- package/frames/dist/client.js +1904 -0
- package/frames/dist/server.cjs +3756 -0
- package/frames/dist/server.js +3743 -0
- package/frames/package.json +30 -0
- package/package.json +350 -37
- package/serialization/decode/package.json +20 -0
- package/serialization/dist/decode.cjs +122 -0
- package/serialization/dist/decode.js +116 -0
- package/serialization/dist/serialization.cjs +244 -0
- package/serialization/dist/serialization.js +227 -0
- package/serialization/package.json +20 -0
- package/serialization/types/index.d.ts +182 -0
- package/serialization/types/serializer-decode.d.ts +182 -0
- package/serialization/types-cjs/index.d.cts +182 -0
- package/serialization/types-cjs/package.json +3 -0
- package/serialization/types-cjs/serializer-decode.d.cts +182 -0
- package/server-functions/dist/client.cjs +793 -0
- package/server-functions/dist/client.js +763 -0
- package/server-functions/dist/rich-args.cjs +11 -0
- package/server-functions/dist/rich-args.js +9 -0
- package/server-functions/dist/server.cjs +1171 -0
- package/server-functions/dist/server.dev.cjs +1171 -0
- package/server-functions/dist/server.dev.js +1137 -0
- package/server-functions/dist/server.js +1137 -0
- package/server-functions/package.json +40 -0
- package/server-functions/rich-args/package.json +20 -0
- package/storage/package.json +8 -3
- package/storage/types/index.d.ts +26 -0
- package/storage/types-cjs/index.d.cts +28 -0
- package/storage/types-cjs/package.json +3 -0
- package/types/client.d.ts +290 -27
- package/types/cookies.d.ts +93 -0
- package/types/core.d.ts +6 -2
- package/types/frames/client.d.ts +36 -0
- package/types/frames/frame-client.d.ts +338 -0
- package/types/frames/frame-sink.d.ts +194 -0
- package/types/frames/frame-transport.d.ts +222 -0
- package/types/frames/serializer.d.ts +182 -0
- package/types/frames/server.d.ts +52 -0
- package/types/index.d.ts +223 -24
- package/types/jsx-properties.d.ts +93 -0
- package/types/jsx.d.ts +4159 -1
- package/types/response.d.ts +174 -0
- package/types/serializer-decode.d.ts +182 -0
- package/types/serializer.d.ts +182 -0
- package/types/server-functions/client.d.ts +231 -0
- package/types/server-functions/flash.d.ts +38 -0
- package/types/server-functions/rich-args.d.ts +10 -0
- package/types/server-functions/server.d.ts +616 -0
- package/types/server-functions/shared.d.ts +523 -0
- package/types/server-mock.d.ts +249 -12
- package/types/server.d.ts +424 -51
- package/types-cjs/client.d.cts +337 -0
- package/types-cjs/cookies.d.cts +93 -0
- package/types-cjs/core.d.cts +6 -0
- package/types-cjs/frames/client.d.cts +36 -0
- package/types-cjs/frames/frame-client.d.cts +338 -0
- package/types-cjs/frames/frame-sink.d.cts +194 -0
- package/types-cjs/frames/frame-transport.d.cts +222 -0
- package/types-cjs/frames/serializer.d.cts +182 -0
- package/types-cjs/frames/server.d.cts +52 -0
- package/types-cjs/index.d.cts +244 -0
- package/types-cjs/jsx-properties.d.cts +93 -0
- package/types-cjs/jsx.d.cts +4159 -0
- package/types-cjs/package.json +3 -0
- package/types-cjs/response.d.cts +174 -0
- package/types-cjs/serializer-decode.d.cts +182 -0
- package/types-cjs/serializer.d.cts +182 -0
- package/types-cjs/server-functions/client.d.cts +231 -0
- package/types-cjs/server-functions/flash.d.cts +38 -0
- package/types-cjs/server-functions/rich-args.d.cts +10 -0
- package/types-cjs/server-functions/server.d.cts +616 -0
- package/types-cjs/server-functions/shared.d.cts +523 -0
- package/types-cjs/server-mock.d.cts +277 -0
- package/types-cjs/server.d.cts +523 -0
package/dist/web.js
CHANGED
|
@@ -1,33 +1,91 @@
|
|
|
1
|
-
import { createMemo,
|
|
2
|
-
export {
|
|
1
|
+
import { createRenderEffect, createMemo, runWithOwner, sharedConfig, untrack, flatten, createRoot, merge, createComponent, omit, createOwner, createSignal, onCleanup, enableHydration, flush, getOwner, createEffect } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const DOMWithState = {
|
|
5
|
+
INPUT: {
|
|
6
|
+
value: 1,
|
|
7
|
+
defaultValue: 2,
|
|
8
|
+
checked: 1,
|
|
9
|
+
defaultChecked: 2
|
|
10
|
+
},
|
|
11
|
+
SELECT: {
|
|
12
|
+
value: 1
|
|
13
|
+
},
|
|
14
|
+
OPTION: {
|
|
15
|
+
value: 1,
|
|
16
|
+
selected: 1,
|
|
17
|
+
defaultSelected: 2
|
|
18
|
+
},
|
|
19
|
+
TEXTAREA: {
|
|
20
|
+
value: 1,
|
|
21
|
+
defaultValue: 2
|
|
22
|
+
},
|
|
23
|
+
VIDEO: {
|
|
24
|
+
muted: 1,
|
|
25
|
+
defaultMuted: 2
|
|
26
|
+
},
|
|
27
|
+
AUDIO: {
|
|
28
|
+
muted: 1,
|
|
29
|
+
defaultMuted: 2
|
|
30
|
+
}
|
|
31
|
+
};
|
|
6
32
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
33
|
+
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
34
|
+
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
7
35
|
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"]);
|
|
8
36
|
const SVGElements = /*#__PURE__*/new Set([
|
|
9
37
|
"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",
|
|
10
38
|
"set", "stop",
|
|
11
39
|
"svg", "switch", "symbol", "text", "textPath",
|
|
12
40
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
13
|
-
const
|
|
41
|
+
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"]);
|
|
42
|
+
const Namespaces = {
|
|
43
|
+
svg: "http://www.w3.org/2000/svg",
|
|
44
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
14
45
|
xlink: "http://www.w3.org/1999/xlink",
|
|
15
46
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
16
47
|
};
|
|
17
|
-
const
|
|
18
|
-
"
|
|
19
|
-
"isindex
|
|
48
|
+
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
49
|
+
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
50
|
+
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(","));
|
|
20
51
|
|
|
21
|
-
const
|
|
52
|
+
const transparentOptions = {
|
|
53
|
+
transparent: true,
|
|
54
|
+
sync: true
|
|
55
|
+
};
|
|
56
|
+
const syncOptions = {
|
|
57
|
+
sync: true
|
|
58
|
+
};
|
|
59
|
+
const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
|
|
60
|
+
sync: true,
|
|
61
|
+
...options,
|
|
62
|
+
transparent: !options.scope
|
|
63
|
+
} : transparentOptions);
|
|
64
|
+
const memo = fn => createMemo(() => fn(), syncOptions);
|
|
65
|
+
const assetGates = new WeakMap();
|
|
66
|
+
const waitAsset = promise => {
|
|
67
|
+
let gate = assetGates.get(promise);
|
|
68
|
+
if (!gate) {
|
|
69
|
+
runWithOwner(null, () => {
|
|
70
|
+
gate = createMemo(() => promise);
|
|
71
|
+
});
|
|
72
|
+
assetGates.set(promise, gate);
|
|
73
|
+
}
|
|
74
|
+
gate();
|
|
75
|
+
};
|
|
22
76
|
|
|
23
|
-
function reconcileArrays(parentNode, a, b) {
|
|
77
|
+
function reconcileArrays(parentNode, a, b, marker) {
|
|
24
78
|
let bLength = b.length,
|
|
25
79
|
aEnd = a.length,
|
|
26
80
|
bEnd = bLength,
|
|
27
81
|
aStart = 0,
|
|
28
82
|
bStart = 0,
|
|
29
|
-
|
|
30
|
-
|
|
83
|
+
tail = a[aEnd - 1],
|
|
84
|
+
tailTag = tail[$$SLOT],
|
|
85
|
+
after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
|
|
86
|
+
map = null,
|
|
87
|
+
anchor,
|
|
88
|
+
anchorTag;
|
|
31
89
|
while (aStart < aEnd || bStart < bEnd) {
|
|
32
90
|
if (a[aStart] === b[bStart]) {
|
|
33
91
|
aStart++;
|
|
@@ -39,18 +97,43 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
39
97
|
bEnd--;
|
|
40
98
|
}
|
|
41
99
|
if (aEnd === aStart) {
|
|
42
|
-
|
|
43
|
-
|
|
100
|
+
let node;
|
|
101
|
+
if (bEnd < bLength) {
|
|
102
|
+
if (bStart) {
|
|
103
|
+
const prev = b[bStart - 1];
|
|
104
|
+
const prevTag = prev[$$SLOT];
|
|
105
|
+
node = prev.parentNode === parentNode && (!prevTag || prevTag === marker) ? prev.nextSibling : after;
|
|
106
|
+
} else node = b[bEnd - bStart];
|
|
107
|
+
} else node = after;
|
|
108
|
+
while (bStart < bEnd) {
|
|
109
|
+
const n = b[bStart++];
|
|
110
|
+
parentNode.insertBefore(n, node);
|
|
111
|
+
if (marker) n[$$SLOT] = marker;
|
|
112
|
+
}
|
|
44
113
|
} else if (bEnd === bStart) {
|
|
45
114
|
while (aStart < aEnd) {
|
|
46
|
-
|
|
47
|
-
|
|
115
|
+
const n = a[aStart++];
|
|
116
|
+
if (!map || !map.has(n)) {
|
|
117
|
+
const tag = n[$$SLOT];
|
|
118
|
+
if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
|
|
122
|
+
if (marker) {
|
|
123
|
+
do {
|
|
124
|
+
const n = a[--aEnd];
|
|
125
|
+
parentNode.insertBefore(n, anchor);
|
|
126
|
+
n[$$SLOT] = marker;
|
|
127
|
+
bStart++;
|
|
128
|
+
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
129
|
+
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
130
|
+
} else {
|
|
131
|
+
do {
|
|
132
|
+
parentNode.insertBefore(a[--aEnd], anchor);
|
|
133
|
+
bStart++;
|
|
134
|
+
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
135
|
+
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
48
136
|
}
|
|
49
|
-
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
50
|
-
const node = a[--aEnd].nextSibling;
|
|
51
|
-
parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
|
|
52
|
-
parentNode.insertBefore(b[--bEnd], node);
|
|
53
|
-
a[aEnd] = b[bEnd];
|
|
54
137
|
} else {
|
|
55
138
|
if (!map) {
|
|
56
139
|
map = new Map();
|
|
@@ -68,74 +151,332 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
68
151
|
sequence++;
|
|
69
152
|
}
|
|
70
153
|
if (sequence > index - bStart) {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
154
|
+
const head = a[aStart];
|
|
155
|
+
const headTag = head[$$SLOT];
|
|
156
|
+
const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
|
|
157
|
+
while (bStart < index) {
|
|
158
|
+
const n = b[bStart++];
|
|
159
|
+
parentNode.insertBefore(n, node);
|
|
160
|
+
if (marker) n[$$SLOT] = marker;
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
const oldNode = a[aStart++];
|
|
164
|
+
const newNode = b[bStart++];
|
|
165
|
+
const oldTag = oldNode[$$SLOT];
|
|
166
|
+
if (oldNode.parentNode === parentNode && (!oldTag || oldTag === marker)) {
|
|
167
|
+
parentNode.replaceChild(newNode, oldNode);
|
|
168
|
+
} else {
|
|
169
|
+
parentNode.insertBefore(newNode, after);
|
|
170
|
+
}
|
|
171
|
+
if (marker) newNode[$$SLOT] = marker;
|
|
172
|
+
}
|
|
74
173
|
} else aStart++;
|
|
75
|
-
} else
|
|
174
|
+
} else {
|
|
175
|
+
const n = a[aStart++];
|
|
176
|
+
const nTag = n[$$SLOT];
|
|
177
|
+
if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
|
|
178
|
+
}
|
|
76
179
|
}
|
|
77
180
|
}
|
|
78
181
|
}
|
|
79
182
|
|
|
80
|
-
const
|
|
81
|
-
|
|
183
|
+
const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
|
|
184
|
+
const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
|
|
185
|
+
const RESOURCE_LINK_RELS = new Set(["preload", "modulepreload", "prefetch", "preconnect", "dns-prefetch", "stylesheet"]);
|
|
186
|
+
const RESOURCE_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
|
|
187
|
+
const STYLESHEET_FETCH_META = new Set(["crossorigin", "integrity", "referrerpolicy", "fetchpriority"]);
|
|
188
|
+
function evalHeadValue(v) {
|
|
189
|
+
return typeof v === "function" ? v() : v;
|
|
190
|
+
}
|
|
191
|
+
function evalHeadProps(props, presets) {
|
|
192
|
+
const out = {};
|
|
193
|
+
for (const name in props) out[name] = presets && name in presets ? presets[name] : evalHeadValue(props[name]);
|
|
194
|
+
return out;
|
|
195
|
+
}
|
|
196
|
+
function classifyHeadTag(desc) {
|
|
197
|
+
const tag = desc.tag;
|
|
198
|
+
if (tag === "link") {
|
|
199
|
+
const rel = evalHeadValue(desc.props && desc.props.rel);
|
|
200
|
+
return {
|
|
201
|
+
resource: RESOURCE_LINK_RELS.has(rel),
|
|
202
|
+
rel
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (tag === "style") return {
|
|
206
|
+
resource: !!(desc.props && "href" in desc.props)
|
|
207
|
+
};
|
|
208
|
+
if (tag === "script") return {
|
|
209
|
+
resource: !!(desc.props && "src" in desc.props)
|
|
210
|
+
};
|
|
211
|
+
return {
|
|
212
|
+
resource: false
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
function resourceIdentity(tag, props) {
|
|
216
|
+
let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
|
|
217
|
+
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
218
|
+
const q = RESOURCE_QUALIFIERS[i];
|
|
219
|
+
if (props[q] != null) id += ":" + q + "=" + props[q];
|
|
220
|
+
}
|
|
221
|
+
return id;
|
|
222
|
+
}
|
|
223
|
+
function replaceableIdentity(tag, props, key, unique) {
|
|
224
|
+
if (tag === "title") return "title";
|
|
225
|
+
if (tag === "base") return "base";
|
|
226
|
+
if (tag === "meta" && props.charset != null) return "charset";
|
|
227
|
+
if (key != null) return tag + ":key:" + key;
|
|
228
|
+
if (tag === "meta") {
|
|
229
|
+
for (const ns of ["name", "property", "http-equiv"]) if (props[ns] != null) return "meta:" + ns + ":" + props[ns] + (props.media != null ? ":media=" + props.media : "");
|
|
230
|
+
return unique;
|
|
231
|
+
}
|
|
232
|
+
if (tag === "link") {
|
|
233
|
+
const rel = props.rel || "";
|
|
234
|
+
if (rel === "icon" || rel === "apple-touch-icon") return "link:" + rel + (props.sizes != null ? ":sizes=" + props.sizes : "") + (props.type != null ? ":type=" + props.type : "");
|
|
235
|
+
return "link:" + rel + ":" + (props.href || "");
|
|
236
|
+
}
|
|
237
|
+
return unique;
|
|
238
|
+
}
|
|
239
|
+
function resolveHead(groups) {
|
|
240
|
+
const winners = new Map();
|
|
241
|
+
const sorted = groups.slice().sort((a, b) => a.seq - b.seq);
|
|
242
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
243
|
+
const group = sorted[i];
|
|
244
|
+
const byIdentity = new Map();
|
|
245
|
+
for (let j = 0; j < group.tags.length; j++) {
|
|
246
|
+
const t = group.tags[j];
|
|
247
|
+
let list = byIdentity.get(t.identity);
|
|
248
|
+
if (!list) byIdentity.set(t.identity, list = []);
|
|
249
|
+
list.push(t);
|
|
250
|
+
}
|
|
251
|
+
for (const [identity, tags] of byIdentity) {
|
|
252
|
+
if (identity === "title") {
|
|
253
|
+
winners.set(identity, {
|
|
254
|
+
seq: group.seq,
|
|
255
|
+
tags: [tags[tags.length - 1]]
|
|
256
|
+
});
|
|
257
|
+
} else {
|
|
258
|
+
winners.set(identity, {
|
|
259
|
+
seq: group.seq,
|
|
260
|
+
tags
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return winners;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function parseCookieHeader(header) {
|
|
269
|
+
const cookies = {};
|
|
270
|
+
if (!header) return cookies;
|
|
271
|
+
for (const part of header.split(";")) {
|
|
272
|
+
const eq = part.indexOf("=");
|
|
273
|
+
if (eq < 0) continue;
|
|
274
|
+
const name = decodeSafe(part.slice(0, eq).trim());
|
|
275
|
+
let value = part.slice(eq + 1).trim();
|
|
276
|
+
if (value.length > 1 && value[0] === '"' && value[value.length - 1] === '"') {
|
|
277
|
+
value = value.slice(1, -1);
|
|
278
|
+
}
|
|
279
|
+
cookies[name] = decodeSafe(value);
|
|
280
|
+
}
|
|
281
|
+
return cookies;
|
|
282
|
+
}
|
|
283
|
+
function decodeSafe(text) {
|
|
284
|
+
try {
|
|
285
|
+
return decodeURIComponent(text);
|
|
286
|
+
} catch {
|
|
287
|
+
return text;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function serializeCookie(name, value, options = {}) {
|
|
291
|
+
let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
|
|
292
|
+
cookie += `; Path=${options.path === undefined ? "/" : options.path}`;
|
|
293
|
+
if (options.domain) cookie += `; Domain=${options.domain}`;
|
|
294
|
+
if (options.maxAge !== undefined) cookie += `; Max-Age=${Math.trunc(options.maxAge)}`;
|
|
295
|
+
if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
296
|
+
if (options.httpOnly) cookie += "; HttpOnly";
|
|
297
|
+
if (options.secure) cookie += "; Secure";
|
|
298
|
+
if (options.sameSite) {
|
|
299
|
+
const sameSite = options.sameSite.toLowerCase();
|
|
300
|
+
cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
|
|
301
|
+
}
|
|
302
|
+
return cookie;
|
|
303
|
+
}
|
|
304
|
+
const FLASH_COOKIE = "flash";
|
|
305
|
+
const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
|
|
306
|
+
function hasFlashCookie(cookieHeader) {
|
|
307
|
+
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
308
|
+
}
|
|
309
|
+
function clearFlashCookie() {
|
|
310
|
+
return `${FLASH_COOKIE}=; Max-Age=0; Path=/`;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const SERVER_FUNCTION_METADATA = Symbol.for("solid.ServerFunctionMetadata");
|
|
314
|
+
function getServerFunctionMetadata(fn) {
|
|
315
|
+
if (typeof fn !== "function") return undefined;
|
|
316
|
+
return fn[SERVER_FUNCTION_METADATA] || undefined;
|
|
317
|
+
}
|
|
318
|
+
function isServerFunction(fn) {
|
|
319
|
+
return typeof fn === "function" && !!fn[SERVER_FUNCTION_METADATA];
|
|
320
|
+
}
|
|
321
|
+
const SERVER_FUNCTION_RPC = Symbol.for("solid.ServerFunctionRPC");
|
|
322
|
+
function getServerFunctionRPC() {
|
|
323
|
+
return globalThis[SERVER_FUNCTION_RPC];
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
|
|
327
|
+
const INNER_OWNED = {};
|
|
328
|
+
const delegatedEvents = new Set();
|
|
329
|
+
const delegatedContainers = new Map();
|
|
330
|
+
function render$1(code, element, init, options = {}) {
|
|
82
331
|
let disposer;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
332
|
+
registerDelegatedRoot(element);
|
|
333
|
+
try {
|
|
334
|
+
createRoot(dispose => {
|
|
335
|
+
disposer = dispose;
|
|
336
|
+
if (element === document) {
|
|
337
|
+
const tree = code();
|
|
338
|
+
effect(() => flatten(tree), () => {});
|
|
339
|
+
} else {
|
|
340
|
+
const tree = code();
|
|
341
|
+
insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
|
|
342
|
+
}
|
|
343
|
+
}, {
|
|
344
|
+
id: options.renderId
|
|
345
|
+
});
|
|
346
|
+
} catch (err) {
|
|
347
|
+
if (disposer) disposer();
|
|
348
|
+
unregisterDelegatedRoot(element);
|
|
349
|
+
throw err;
|
|
350
|
+
}
|
|
89
351
|
return () => {
|
|
90
352
|
disposer();
|
|
353
|
+
unregisterDelegatedRoot(element);
|
|
91
354
|
element.textContent = "";
|
|
92
355
|
};
|
|
93
356
|
}
|
|
94
|
-
function
|
|
357
|
+
function create(html, bypassGuard, flag) {
|
|
358
|
+
const t = document.createElement("template");
|
|
359
|
+
t.innerHTML = html;
|
|
360
|
+
return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
361
|
+
}
|
|
362
|
+
function template(html, flag) {
|
|
95
363
|
let node;
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
t.innerHTML = html;
|
|
99
|
-
return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
|
|
100
|
-
};
|
|
101
|
-
return isImportNode ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
|
|
364
|
+
const fn = flag === 1 ? bypassGuard => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : bypassGuard => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
|
|
365
|
+
return fn;
|
|
102
366
|
}
|
|
103
|
-
function delegateEvents(eventNames
|
|
104
|
-
const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
|
|
367
|
+
function delegateEvents(eventNames) {
|
|
105
368
|
for (let i = 0, l = eventNames.length; i < l; i++) {
|
|
106
369
|
const name = eventNames[i];
|
|
107
|
-
if (!
|
|
108
|
-
|
|
109
|
-
|
|
370
|
+
if (!delegatedEvents.has(name)) {
|
|
371
|
+
delegatedEvents.add(name);
|
|
372
|
+
delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
|
|
110
373
|
}
|
|
111
374
|
}
|
|
112
375
|
}
|
|
113
|
-
function
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
376
|
+
function registerDelegatedRoot(root) {
|
|
377
|
+
const state = registerDelegatedContainer(root, root);
|
|
378
|
+
if (state) state.roots = (state.roots || 0) + 1;
|
|
379
|
+
}
|
|
380
|
+
function unregisterDelegatedRoot(root) {
|
|
381
|
+
const state = delegatedContainers.get(root);
|
|
382
|
+
if (state) state.roots > 1 ? state.roots-- : delete state.roots;
|
|
383
|
+
unregisterDelegatedContainer(root, root);
|
|
384
|
+
}
|
|
385
|
+
function registerDelegatedContainer(container, owner = container) {
|
|
386
|
+
if (!container || !owner) return;
|
|
387
|
+
let state = delegatedContainers.get(container);
|
|
388
|
+
if (!state) delegatedContainers.set(container, state = {
|
|
389
|
+
owners: new Map(),
|
|
390
|
+
handlers: new Map()
|
|
391
|
+
});
|
|
392
|
+
state.owners.set(owner, (state.owners.get(owner) || 0) + 1);
|
|
393
|
+
delegatedEvents.forEach(name => attachDelegatedEvent(name, container, state));
|
|
394
|
+
return state;
|
|
395
|
+
}
|
|
396
|
+
function unregisterDelegatedContainer(container, owner = container) {
|
|
397
|
+
const state = delegatedContainers.get(container);
|
|
398
|
+
if (!state) return;
|
|
399
|
+
const count = state.owners.get(owner);
|
|
400
|
+
if (count > 1) state.owners.set(owner, count - 1);else state.owners.delete(owner);
|
|
401
|
+
if (state.owners.size) return;
|
|
402
|
+
state.handlers.forEach((handler, name) => container.removeEventListener(name, handler));
|
|
403
|
+
delegatedContainers.delete(container);
|
|
404
|
+
}
|
|
405
|
+
function attachDelegatedEvent(name, container, state) {
|
|
406
|
+
if (state.handlers.has(name)) return;
|
|
407
|
+
const handler = e => eventHandler(e, container, state);
|
|
408
|
+
state.handlers.set(name, handler);
|
|
409
|
+
container.addEventListener(name, handler);
|
|
410
|
+
}
|
|
411
|
+
function getDelegatedRoot(node) {
|
|
412
|
+
while (node) {
|
|
413
|
+
if (delegatedContainers.get(node)?.roots) return node;
|
|
414
|
+
node = node._$host || node.parentNode || node.host;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
function findOwner(target, state) {
|
|
418
|
+
let node = target;
|
|
419
|
+
let distance = 0;
|
|
420
|
+
while (node) {
|
|
421
|
+
if (state.owners.has(node)) return {
|
|
422
|
+
owner: node,
|
|
423
|
+
distance
|
|
424
|
+
};
|
|
425
|
+
distance++;
|
|
426
|
+
node = node._$host || node.parentNode || node.host;
|
|
117
427
|
}
|
|
118
428
|
}
|
|
119
429
|
function setProperty(node, name, value) {
|
|
120
430
|
if (isHydrating(node)) return;
|
|
121
431
|
node[name] = value;
|
|
122
432
|
}
|
|
433
|
+
let claimHandlers = null;
|
|
434
|
+
const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
|
|
435
|
+
function registerElementClaim(handler) {
|
|
436
|
+
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
437
|
+
return () => {
|
|
438
|
+
const index = claimHandlers.indexOf(handler);
|
|
439
|
+
index > -1 && claimHandlers.splice(index, 1);
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
443
|
+
function claimElementTree(root) {
|
|
444
|
+
const handlers = globalThis[CLAIM_SEAM];
|
|
445
|
+
if (handlers === undefined || handlers.length === 0) return root;
|
|
446
|
+
const isElement = root.nodeType === 1;
|
|
447
|
+
if (!isElement && root.nodeType !== 11) return root;
|
|
448
|
+
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
449
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](root);
|
|
450
|
+
}
|
|
451
|
+
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
452
|
+
for (let i = 0; i < found.length; i++) {
|
|
453
|
+
for (let j = 0; j < handlers.length; j++) handlers[j](found[i]);
|
|
454
|
+
}
|
|
455
|
+
return root;
|
|
456
|
+
}
|
|
457
|
+
function claimElement(node) {
|
|
458
|
+
if (claimHandlers !== null) {
|
|
459
|
+
for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
|
|
460
|
+
}
|
|
461
|
+
return node;
|
|
462
|
+
}
|
|
123
463
|
function setAttribute(node, name, value) {
|
|
124
464
|
if (isHydrating(node)) return;
|
|
125
465
|
if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
|
|
466
|
+
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
126
467
|
}
|
|
127
468
|
function setAttributeNS(node, namespace, name, value) {
|
|
128
469
|
if (isHydrating(node)) return;
|
|
129
|
-
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
470
|
+
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
130
471
|
}
|
|
131
|
-
function className(node, value,
|
|
472
|
+
function className(node, value, prev) {
|
|
132
473
|
if (isHydrating(node)) return;
|
|
133
474
|
if (value == null || value === false) {
|
|
134
475
|
prev && node.removeAttribute("class");
|
|
135
476
|
return;
|
|
136
477
|
}
|
|
137
478
|
if (typeof value === "string") {
|
|
138
|
-
value !== prev &&
|
|
479
|
+
value !== prev && node.setAttribute("class", value);
|
|
139
480
|
return;
|
|
140
481
|
}
|
|
141
482
|
if (typeof prev === "string") {
|
|
@@ -149,16 +490,16 @@ function className(node, value, isSVG, prev) {
|
|
|
149
490
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
150
491
|
const key = prevKeys[i];
|
|
151
492
|
if (!key || key === "undefined" || value[key]) continue;
|
|
152
|
-
|
|
493
|
+
node.classList.remove(key);
|
|
153
494
|
}
|
|
154
495
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
155
496
|
const key = classKeys[i],
|
|
156
497
|
classValue = !!value[key];
|
|
157
498
|
if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
|
|
158
|
-
|
|
499
|
+
node.classList.add(key);
|
|
159
500
|
}
|
|
160
501
|
}
|
|
161
|
-
function
|
|
502
|
+
function addEvent(node, name, handler, delegate) {
|
|
162
503
|
if (delegate) {
|
|
163
504
|
if (Array.isArray(handler)) {
|
|
164
505
|
node[`$$${name}`] = handler[0];
|
|
@@ -171,42 +512,60 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
171
512
|
}
|
|
172
513
|
function style(node, value, prev) {
|
|
173
514
|
if (!value) {
|
|
174
|
-
prev
|
|
515
|
+
if (prev || node._$styles) {
|
|
516
|
+
setAttribute(node, "style");
|
|
517
|
+
node._$styles = undefined;
|
|
518
|
+
}
|
|
175
519
|
return;
|
|
176
520
|
}
|
|
177
521
|
const nodeStyle = node.style;
|
|
178
|
-
if (typeof value === "string")
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
522
|
+
if (typeof value === "string") {
|
|
523
|
+
node._$styles = undefined;
|
|
524
|
+
return nodeStyle.cssText = value;
|
|
525
|
+
}
|
|
526
|
+
if (typeof prev === "string") {
|
|
527
|
+
nodeStyle.cssText = "";
|
|
528
|
+
prev = undefined;
|
|
529
|
+
}
|
|
530
|
+
let applied = node._$styles;
|
|
531
|
+
if (!applied) {
|
|
532
|
+
applied = node._$styles = prev ? {
|
|
533
|
+
...prev
|
|
534
|
+
} : {};
|
|
535
|
+
}
|
|
182
536
|
let v, s;
|
|
537
|
+
for (s in applied) {
|
|
538
|
+
if (value[s] == null) {
|
|
539
|
+
nodeStyle.removeProperty(s);
|
|
540
|
+
delete applied[s];
|
|
541
|
+
}
|
|
542
|
+
}
|
|
183
543
|
for (s in value) {
|
|
184
544
|
v = value[s];
|
|
185
|
-
if (v !==
|
|
186
|
-
|
|
545
|
+
if (v != null && v !== applied[s]) {
|
|
546
|
+
nodeStyle.setProperty(s, v);
|
|
547
|
+
applied[s] = v;
|
|
548
|
+
}
|
|
187
549
|
}
|
|
188
|
-
for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
|
|
189
550
|
}
|
|
190
551
|
function setStyleProperty(node, name, value) {
|
|
191
552
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
192
553
|
}
|
|
193
|
-
function spread(node, props = {},
|
|
554
|
+
function spread(node, props = {}, skipChildren) {
|
|
194
555
|
const prevProps = {};
|
|
195
|
-
if (!skipChildren)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node), () => {});
|
|
202
|
-
createRenderEffect(() => {
|
|
556
|
+
if (!skipChildren) insert(node, () => props.children);
|
|
557
|
+
effect(() => {
|
|
558
|
+
const r = props.ref;
|
|
559
|
+
(typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
|
|
560
|
+
}, () => {});
|
|
561
|
+
effect(() => {
|
|
203
562
|
const newProps = {};
|
|
204
563
|
for (const prop in props) {
|
|
205
564
|
if (prop === "children" || prop === "ref") continue;
|
|
206
565
|
newProps[prop] = props[prop];
|
|
207
566
|
}
|
|
208
567
|
return newProps;
|
|
209
|
-
}, props => assign(node, props,
|
|
568
|
+
}, props => assign(node, props, true, prevProps, true));
|
|
210
569
|
return prevProps;
|
|
211
570
|
}
|
|
212
571
|
function dynamicProperty(props, key) {
|
|
@@ -219,48 +578,615 @@ function dynamicProperty(props, key) {
|
|
|
219
578
|
});
|
|
220
579
|
return props;
|
|
221
580
|
}
|
|
222
|
-
function
|
|
223
|
-
|
|
581
|
+
function applyRef(r, element) {
|
|
582
|
+
Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
|
|
583
|
+
}
|
|
584
|
+
function ref(fn, element) {
|
|
585
|
+
const resolved = untrack(fn);
|
|
586
|
+
runWithOwner(null, () => applyRef(resolved, element));
|
|
587
|
+
}
|
|
588
|
+
function scope(fn) {
|
|
589
|
+
fn.$s = true;
|
|
590
|
+
return fn;
|
|
591
|
+
}
|
|
592
|
+
const SCOPE_OPTIONS = {
|
|
593
|
+
scope: true
|
|
594
|
+
};
|
|
595
|
+
let hydrationRt = null;
|
|
596
|
+
function installHydrationRuntime() {
|
|
597
|
+
hydrationRt = {
|
|
598
|
+
claimInitial(parent, multi, initial) {
|
|
599
|
+
if (isHydrating(parent)) {
|
|
600
|
+
if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
|
|
601
|
+
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
602
|
+
}
|
|
603
|
+
return initial;
|
|
604
|
+
},
|
|
605
|
+
reclaimRegion(current, parent, marker) {
|
|
606
|
+
if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
|
|
607
|
+
const first = Array.isArray(current) ? current[0] : current;
|
|
608
|
+
if (!first || !first.nodeType || first.isConnected) return current;
|
|
609
|
+
let nodes;
|
|
610
|
+
if (marker) {
|
|
611
|
+
nodes = [];
|
|
612
|
+
let node = marker.previousSibling,
|
|
613
|
+
depth = 0;
|
|
614
|
+
while (node) {
|
|
615
|
+
if (node.nodeType === 8) {
|
|
616
|
+
const v = node.nodeValue;
|
|
617
|
+
if (v === "/") depth++;else if (v === "$") {
|
|
618
|
+
if (depth === 0) break;
|
|
619
|
+
depth--;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
nodes.unshift(node);
|
|
623
|
+
node = node.previousSibling;
|
|
624
|
+
}
|
|
625
|
+
} else nodes = [...parent.childNodes];
|
|
626
|
+
return stripTextSeparators(nodes);
|
|
627
|
+
},
|
|
628
|
+
dedupEvent(e) {
|
|
629
|
+
return !!(sharedConfig.registry && sharedConfig.events && sharedConfig.events.find(([el, ev]) => ev === e));
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
function stripTextSeparators(nodes) {
|
|
634
|
+
let j = 0;
|
|
635
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
636
|
+
const node = nodes[i],
|
|
637
|
+
t = node.nodeType;
|
|
638
|
+
if (t === 8) {
|
|
639
|
+
const v = node.nodeValue;
|
|
640
|
+
if (v === "!$") {
|
|
641
|
+
node.remove();
|
|
642
|
+
continue;
|
|
643
|
+
}
|
|
644
|
+
if (v.startsWith("pl-")) continue;
|
|
645
|
+
} else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
|
|
646
|
+
nodes[j++] = node;
|
|
647
|
+
}
|
|
648
|
+
nodes.length = j;
|
|
649
|
+
return nodes;
|
|
224
650
|
}
|
|
225
|
-
function insert(parent, accessor, marker, initial) {
|
|
651
|
+
function insert(parent, accessor, marker, initial, options) {
|
|
226
652
|
const multi = marker !== undefined;
|
|
653
|
+
const host = options && options.host;
|
|
227
654
|
if (multi && !initial) initial = [];
|
|
655
|
+
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
228
656
|
if (typeof accessor !== "function") {
|
|
229
657
|
accessor = normalize(accessor, initial, multi, true);
|
|
230
|
-
if (typeof accessor !== "function")
|
|
658
|
+
if (typeof accessor !== "function") {
|
|
659
|
+
insertExpression(parent, accessor, initial, marker);
|
|
660
|
+
host && tagHost(accessor, host);
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
if (multi && initial.length === 0) {
|
|
665
|
+
const placeholder = document.createTextNode("");
|
|
666
|
+
parent.insertBefore(placeholder, marker);
|
|
667
|
+
initial = [placeholder];
|
|
231
668
|
}
|
|
232
|
-
|
|
669
|
+
let current = initial;
|
|
670
|
+
effect(prev => {
|
|
671
|
+
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
672
|
+
const value = normalize(accessor(), current, multi, true);
|
|
673
|
+
if (typeof value !== "function") return value;
|
|
674
|
+
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
675
|
+
current = insertExpression(parent, inner, current, marker);
|
|
676
|
+
host && tagHost(current, host);
|
|
677
|
+
}, prev !== undefined && !(options && options.schedule) ? {
|
|
678
|
+
...options,
|
|
679
|
+
schedule: true
|
|
680
|
+
} : options);
|
|
681
|
+
return INNER_OWNED;
|
|
682
|
+
}, value => {
|
|
683
|
+
if (value === INNER_OWNED) return;
|
|
684
|
+
current = insertExpression(parent, value, current, marker);
|
|
685
|
+
host && tagHost(current, host);
|
|
686
|
+
},
|
|
687
|
+
accessor.$s ? options ? {
|
|
688
|
+
...options,
|
|
689
|
+
scope: true
|
|
690
|
+
} : SCOPE_OPTIONS : options);
|
|
233
691
|
}
|
|
234
|
-
function assign(node, props,
|
|
692
|
+
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
693
|
+
const nodeName = node.nodeName;
|
|
235
694
|
props || (props = {});
|
|
236
695
|
for (const prop in prevProps) {
|
|
237
696
|
if (!(prop in props)) {
|
|
238
697
|
if (prop === "children") continue;
|
|
239
|
-
prevProps[prop] = assignProp(node, prop, null, prevProps[prop],
|
|
698
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
|
|
240
699
|
}
|
|
241
700
|
}
|
|
242
701
|
for (const prop in props) {
|
|
243
702
|
if (prop === "children") {
|
|
244
|
-
if (!skipChildren) insertExpression(node, props.children);
|
|
703
|
+
if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
|
|
245
704
|
continue;
|
|
246
705
|
}
|
|
247
|
-
|
|
248
|
-
prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
|
|
706
|
+
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
|
|
249
707
|
}
|
|
250
708
|
}
|
|
709
|
+
const ASSET_REMOVAL_GRACE = 100;
|
|
710
|
+
const assetRegistry = new Map();
|
|
711
|
+
function assetEntryKey(descriptor) {
|
|
712
|
+
if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
|
|
713
|
+
return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
|
|
714
|
+
}
|
|
715
|
+
function findAssetElement(selector, attr, value) {
|
|
716
|
+
const nodes = document.querySelectorAll(selector);
|
|
717
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
718
|
+
if (nodes[i].getAttribute(attr) === value) return nodes[i];
|
|
719
|
+
}
|
|
720
|
+
return null;
|
|
721
|
+
}
|
|
722
|
+
function setAssetAttrs(el, attrs) {
|
|
723
|
+
for (const name in attrs) el.setAttribute(name, attrs[name]);
|
|
724
|
+
}
|
|
725
|
+
function mountAssetElement(descriptor) {
|
|
726
|
+
let el;
|
|
727
|
+
if (descriptor.type === "inline-style") {
|
|
728
|
+
el = findAssetElement("style[data-asset]", "data-asset", descriptor.id);
|
|
729
|
+
if (!el) {
|
|
730
|
+
el = document.createElement("style");
|
|
731
|
+
el.setAttribute("data-asset", descriptor.id);
|
|
732
|
+
el.textContent = descriptor.content || "";
|
|
733
|
+
}
|
|
734
|
+
} else {
|
|
735
|
+
const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
|
|
736
|
+
el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
|
|
737
|
+
if (!el) {
|
|
738
|
+
el = document.createElement("link");
|
|
739
|
+
el.rel = rel;
|
|
740
|
+
el.href = descriptor.href;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
if (descriptor.attrs) setAssetAttrs(el, descriptor.attrs);
|
|
744
|
+
if (!el.isConnected) document.head.appendChild(el);
|
|
745
|
+
return el;
|
|
746
|
+
}
|
|
747
|
+
const assetLoadSettled = /*#__PURE__*/Promise.resolve();
|
|
748
|
+
function trackAssetLoad(entry, adopted) {
|
|
749
|
+
if (entry.loadPromise) return;
|
|
750
|
+
const el = entry.element;
|
|
751
|
+
let settled = el.sheet != null;
|
|
752
|
+
if (!settled && adopted && typeof performance !== "undefined" && performance.getEntriesByName) {
|
|
753
|
+
settled = performance.getEntriesByName(el.href).length > 0;
|
|
754
|
+
}
|
|
755
|
+
if (settled) {
|
|
756
|
+
entry.loadState = "loaded";
|
|
757
|
+
entry.loadPromise = assetLoadSettled;
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
entry.loadState = "pending";
|
|
761
|
+
entry.loadPromise = new Promise(resolve => {
|
|
762
|
+
const settle = state => {
|
|
763
|
+
entry.loadState = state;
|
|
764
|
+
resolve();
|
|
765
|
+
};
|
|
766
|
+
el.addEventListener("load", () => settle("loaded"), {
|
|
767
|
+
once: true
|
|
768
|
+
});
|
|
769
|
+
el.addEventListener("error", () => settle("errored"), {
|
|
770
|
+
once: true
|
|
771
|
+
});
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
function warmAsset(descriptor) {
|
|
775
|
+
if (descriptor.policy === "exclusive" || descriptor.type === "inline-style") return;
|
|
776
|
+
const key = assetEntryKey(descriptor);
|
|
777
|
+
let entry = assetRegistry.get(key);
|
|
778
|
+
if (!entry) {
|
|
779
|
+
entry = {
|
|
780
|
+
count: 0,
|
|
781
|
+
element: null,
|
|
782
|
+
timer: null
|
|
783
|
+
};
|
|
784
|
+
assetRegistry.set(key, entry);
|
|
785
|
+
}
|
|
786
|
+
let adopted = true;
|
|
787
|
+
if (!entry.element || !entry.element.isConnected) {
|
|
788
|
+
const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
|
|
789
|
+
let el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
|
|
790
|
+
if (!el && descriptor.type === "style") {
|
|
791
|
+
el = findAssetElement('link[rel="preload"][as="style"]', "href", descriptor.href);
|
|
792
|
+
}
|
|
793
|
+
if (!el) {
|
|
794
|
+
adopted = false;
|
|
795
|
+
el = document.createElement("link");
|
|
796
|
+
if (descriptor.type === "style") {
|
|
797
|
+
el.setAttribute("rel", "preload");
|
|
798
|
+
el.setAttribute("as", "style");
|
|
799
|
+
} else {
|
|
800
|
+
el.setAttribute("rel", "modulepreload");
|
|
801
|
+
}
|
|
802
|
+
el.setAttribute("href", descriptor.href);
|
|
803
|
+
if (!document.body) el.setAttribute("blocking", "render");
|
|
804
|
+
}
|
|
805
|
+
if (descriptor.attrs) setAssetAttrs(el, descriptor.attrs);
|
|
806
|
+
if (!el.isConnected) document.head.appendChild(el);
|
|
807
|
+
entry.element = el;
|
|
808
|
+
entry.loadState = undefined;
|
|
809
|
+
entry.loadPromise = undefined;
|
|
810
|
+
}
|
|
811
|
+
if (descriptor.type === "style") trackAssetLoad(entry, adopted);
|
|
812
|
+
return entry;
|
|
813
|
+
}
|
|
814
|
+
function acquireAsset(descriptor) {
|
|
815
|
+
const key = assetEntryKey(descriptor);
|
|
816
|
+
let entry = assetRegistry.get(key);
|
|
817
|
+
if (descriptor.policy === "exclusive") {
|
|
818
|
+
if (!entry) {
|
|
819
|
+
entry = {
|
|
820
|
+
original: descriptor.get(),
|
|
821
|
+
set: descriptor.set,
|
|
822
|
+
writers: []
|
|
823
|
+
};
|
|
824
|
+
assetRegistry.set(key, entry);
|
|
825
|
+
}
|
|
826
|
+
const writer = {
|
|
827
|
+
value: descriptor.value
|
|
828
|
+
};
|
|
829
|
+
entry.writers.push(writer);
|
|
830
|
+
entry.set(writer.value);
|
|
831
|
+
let released = false;
|
|
832
|
+
return () => {
|
|
833
|
+
if (released) return;
|
|
834
|
+
released = true;
|
|
835
|
+
const index = entry.writers.indexOf(writer);
|
|
836
|
+
const wasTop = index === entry.writers.length - 1;
|
|
837
|
+
entry.writers.splice(index, 1);
|
|
838
|
+
if (!wasTop) return;
|
|
839
|
+
if (entry.writers.length) {
|
|
840
|
+
entry.set(entry.writers[entry.writers.length - 1].value);
|
|
841
|
+
} else {
|
|
842
|
+
entry.set(entry.original);
|
|
843
|
+
assetRegistry.delete(key);
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
if (!entry) {
|
|
848
|
+
entry = {
|
|
849
|
+
count: 0,
|
|
850
|
+
element: null,
|
|
851
|
+
timer: null
|
|
852
|
+
};
|
|
853
|
+
assetRegistry.set(key, entry);
|
|
854
|
+
}
|
|
855
|
+
if (entry.timer) {
|
|
856
|
+
clearTimeout(entry.timer);
|
|
857
|
+
entry.timer = null;
|
|
858
|
+
}
|
|
859
|
+
entry.count++;
|
|
860
|
+
if (!entry.element || !entry.element.isConnected) {
|
|
861
|
+
entry.element = mountAssetElement(descriptor);
|
|
862
|
+
} else if (descriptor.type === "style" && entry.element.getAttribute("rel") === "preload") {
|
|
863
|
+
entry.element.removeAttribute("as");
|
|
864
|
+
entry.element.setAttribute("rel", "stylesheet");
|
|
865
|
+
}
|
|
866
|
+
let released = false;
|
|
867
|
+
return () => {
|
|
868
|
+
if (released) return;
|
|
869
|
+
released = true;
|
|
870
|
+
if (--entry.count > 0) return;
|
|
871
|
+
entry.timer = setTimeout(() => {
|
|
872
|
+
assetRegistry.delete(key);
|
|
873
|
+
entry.element && entry.element.remove();
|
|
874
|
+
}, ASSET_REMOVAL_GRACE);
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
let headRegistrations = null;
|
|
878
|
+
let headSeq = 0;
|
|
879
|
+
let headUid = 0;
|
|
880
|
+
let headOwned = null;
|
|
881
|
+
let headApplied = null;
|
|
882
|
+
let headFallbackTitle = null;
|
|
883
|
+
let headScheduled = false;
|
|
884
|
+
const headMountedResources = new Set();
|
|
885
|
+
function initHeadRegistry() {
|
|
886
|
+
if (headRegistrations) return;
|
|
887
|
+
headRegistrations = [];
|
|
888
|
+
headOwned = new Map();
|
|
889
|
+
headApplied = new Map();
|
|
890
|
+
const t = document.querySelector("title");
|
|
891
|
+
headFallbackTitle = t && !t.hasAttribute("data-dh") ? t.textContent : null;
|
|
892
|
+
if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
|
|
893
|
+
}
|
|
894
|
+
function applyServerHeadOps(ops) {
|
|
895
|
+
for (let i = 0; i < ops.length; i++) {
|
|
896
|
+
const op = ops[i];
|
|
897
|
+
const identity = op[0] === "t" ? "title" : op[1];
|
|
898
|
+
if (headOwned.has(identity)) continue;
|
|
899
|
+
if (op[0] === "t") setHeadTitle(op[1]);else if (op[0] === "r") {
|
|
900
|
+
const els = headMarkedElements(identity);
|
|
901
|
+
for (let j = 0; j < els.length; j++) els[j].remove();
|
|
902
|
+
} else {
|
|
903
|
+
const el = document.createElement(op[2]);
|
|
904
|
+
for (const name in op[3]) el.setAttribute(name, op[3][name]);
|
|
905
|
+
if (op[4] != null) el.textContent = op[4];
|
|
906
|
+
el.setAttribute("data-dh", identity);
|
|
907
|
+
document.head.appendChild(el);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
function headMarkedElements(identity) {
|
|
912
|
+
const nodes = document.head.querySelectorAll("[data-dh]");
|
|
913
|
+
const out = [];
|
|
914
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
915
|
+
if (nodes[i].getAttribute("data-dh") === identity) out.push(nodes[i]);
|
|
916
|
+
}
|
|
917
|
+
return out;
|
|
918
|
+
}
|
|
919
|
+
function setHeadTitle(text) {
|
|
920
|
+
let el = document.querySelector("title");
|
|
921
|
+
if (!el) {
|
|
922
|
+
el = document.createElement("title");
|
|
923
|
+
document.head.appendChild(el);
|
|
924
|
+
}
|
|
925
|
+
el.textContent = text;
|
|
926
|
+
el.setAttribute("data-dh", "title");
|
|
927
|
+
return el;
|
|
928
|
+
}
|
|
929
|
+
function scheduleHeadApply() {
|
|
930
|
+
if (headScheduled) return;
|
|
931
|
+
headScheduled = true;
|
|
932
|
+
queueMicrotask(flushHeadRegistry);
|
|
933
|
+
}
|
|
934
|
+
function flushHeadRegistry() {
|
|
935
|
+
if (sharedConfig.hydrating) {
|
|
936
|
+
setTimeout(flushHeadRegistry, 0);
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
headScheduled = false;
|
|
940
|
+
const winners = resolveHead(headRegistrations);
|
|
941
|
+
for (const [identity, els] of headOwned) {
|
|
942
|
+
if (winners.has(identity)) continue;
|
|
943
|
+
headOwned.delete(identity);
|
|
944
|
+
headApplied.delete(identity);
|
|
945
|
+
if (identity === "title") {
|
|
946
|
+
if (headFallbackTitle != null) setHeadTitle(headFallbackTitle).removeAttribute("data-dh");
|
|
947
|
+
} else {
|
|
948
|
+
for (let i = 0; i < els.length; i++) els[i].remove();
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
for (const [identity, winner] of winners) {
|
|
952
|
+
let sig = "";
|
|
953
|
+
for (let i = 0; i < winner.tags.length; i++) sig += winner.tags[i].tag + JSON.stringify(winner.tags[i].props) + "|";
|
|
954
|
+
if (headApplied.get(identity) === sig) continue;
|
|
955
|
+
headApplied.set(identity, sig);
|
|
956
|
+
if (identity === "base" || identity === "charset") {
|
|
957
|
+
continue;
|
|
958
|
+
}
|
|
959
|
+
if (identity === "title") {
|
|
960
|
+
const children = winner.tags[0].props.children;
|
|
961
|
+
setHeadTitle(children == null ? "" : String(children));
|
|
962
|
+
headOwned.set(identity, []);
|
|
963
|
+
continue;
|
|
964
|
+
}
|
|
965
|
+
const existing = headMarkedElements(identity);
|
|
966
|
+
const els = [];
|
|
967
|
+
for (let i = 0; i < winner.tags.length; i++) {
|
|
968
|
+
els.push(renderHeadElement(winner.tags[i], identity, existing));
|
|
969
|
+
}
|
|
970
|
+
for (let i = 0; i < existing.length; i++) {
|
|
971
|
+
if (els.indexOf(existing[i]) === -1) existing[i].remove();
|
|
972
|
+
}
|
|
973
|
+
headOwned.set(identity, els);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
function createHeadElement(tag, props) {
|
|
977
|
+
const el = document.createElement(tag);
|
|
978
|
+
for (const name in props) {
|
|
979
|
+
if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
|
|
980
|
+
if (!HEAD_ATTR_NAME.test(name)) {
|
|
981
|
+
continue;
|
|
982
|
+
}
|
|
983
|
+
const v = props[name];
|
|
984
|
+
if (v == null || v === false) continue;
|
|
985
|
+
el.setAttribute(name, v === true ? "" : String(v));
|
|
986
|
+
}
|
|
987
|
+
if (props.children != null) el.textContent = String(props.children);
|
|
988
|
+
return el;
|
|
989
|
+
}
|
|
990
|
+
function renderHeadElement(t, identity, existing) {
|
|
991
|
+
for (let i = 0; i < existing.length; i++) {
|
|
992
|
+
if (headElementMatches(existing[i], t)) return existing.splice(i, 1)[0];
|
|
993
|
+
}
|
|
994
|
+
const el = createHeadElement(t.tag, t.props);
|
|
995
|
+
el.setAttribute("data-dh", identity);
|
|
996
|
+
document.head.appendChild(el);
|
|
997
|
+
return el;
|
|
998
|
+
}
|
|
999
|
+
function headElementMatches(el, t) {
|
|
1000
|
+
if (el.tagName.toLowerCase() !== t.tag) return false;
|
|
1001
|
+
for (const name in t.props) {
|
|
1002
|
+
if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
|
|
1003
|
+
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1004
|
+
const v = t.props[name];
|
|
1005
|
+
if (v == null || v === false) {
|
|
1006
|
+
if (el.hasAttribute(name)) return false;
|
|
1007
|
+
} else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
|
|
1008
|
+
}
|
|
1009
|
+
const children = t.props.children;
|
|
1010
|
+
return (children == null ? "" : String(children)) === el.textContent;
|
|
1011
|
+
}
|
|
1012
|
+
function mountHeadResource(tag, props) {
|
|
1013
|
+
const identity = resourceIdentity(tag, props);
|
|
1014
|
+
if (headMountedResources.has(identity)) return;
|
|
1015
|
+
headMountedResources.add(identity);
|
|
1016
|
+
const url = props.href || props.src;
|
|
1017
|
+
let el = null;
|
|
1018
|
+
if (url != null) {
|
|
1019
|
+
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);
|
|
1020
|
+
}
|
|
1021
|
+
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
1022
|
+
}
|
|
1023
|
+
function gateHeadResource(props) {
|
|
1024
|
+
const descriptor = {
|
|
1025
|
+
type: props.rel === "stylesheet" ? "style" : "module",
|
|
1026
|
+
href: props.href
|
|
1027
|
+
};
|
|
1028
|
+
let gateable = props.rel === "stylesheet" && props.href != null;
|
|
1029
|
+
let attrs = null;
|
|
1030
|
+
for (const name in props) {
|
|
1031
|
+
if (name === "rel" || name === "href") continue;
|
|
1032
|
+
if (!STYLESHEET_FETCH_META.has(name)) gateable = false;
|
|
1033
|
+
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
1034
|
+
const v = props[name];
|
|
1035
|
+
if (v == null || v === false) continue;
|
|
1036
|
+
(attrs || (attrs = {}))[name] = v === true ? "" : String(v);
|
|
1037
|
+
}
|
|
1038
|
+
if (attrs) descriptor.attrs = attrs;
|
|
1039
|
+
effect(() => {
|
|
1040
|
+
const entry = warmAsset(descriptor);
|
|
1041
|
+
if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
|
|
1042
|
+
}, () => acquireAsset(descriptor));
|
|
1043
|
+
}
|
|
1044
|
+
function useHead(tags) {
|
|
1045
|
+
initHeadRegistry();
|
|
1046
|
+
const reg = {
|
|
1047
|
+
seq: -1,
|
|
1048
|
+
tags: null
|
|
1049
|
+
};
|
|
1050
|
+
const uid = ++headUid;
|
|
1051
|
+
effect(() => {
|
|
1052
|
+
let list = typeof tags === "function" ? tags() : tags;
|
|
1053
|
+
if (!Array.isArray(list)) list = [list];
|
|
1054
|
+
const replaceable = [];
|
|
1055
|
+
const resources = [];
|
|
1056
|
+
for (let i = 0; i < list.length; i++) {
|
|
1057
|
+
const desc = list[i];
|
|
1058
|
+
if (!desc || !HEAD_ELIGIBLE_TAGS.has(desc.tag)) {
|
|
1059
|
+
continue;
|
|
1060
|
+
}
|
|
1061
|
+
const cls = classifyHeadTag(desc);
|
|
1062
|
+
const props = evalHeadProps(desc.props || {}, cls.rel !== undefined ? {
|
|
1063
|
+
rel: cls.rel
|
|
1064
|
+
} : undefined);
|
|
1065
|
+
if (cls.resource) {
|
|
1066
|
+
if (desc.tag === "link" && (props.rel === "stylesheet" || props.rel === "modulepreload")) {
|
|
1067
|
+
gateHeadResource(props);
|
|
1068
|
+
} else if (desc.tag === "link") {
|
|
1069
|
+
mountHeadResource(desc.tag, props);
|
|
1070
|
+
} else {
|
|
1071
|
+
resources.push({
|
|
1072
|
+
tag: desc.tag,
|
|
1073
|
+
props
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
} else {
|
|
1077
|
+
const key = evalHeadValue(desc.key);
|
|
1078
|
+
replaceable.push({
|
|
1079
|
+
tag: desc.tag,
|
|
1080
|
+
props,
|
|
1081
|
+
identity: replaceableIdentity(desc.tag, props, key, "u:c" + uid + ":" + i)
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
return {
|
|
1086
|
+
replaceable,
|
|
1087
|
+
resources
|
|
1088
|
+
};
|
|
1089
|
+
}, evaluated => {
|
|
1090
|
+
for (let i = 0; i < evaluated.resources.length; i++) {
|
|
1091
|
+
mountHeadResource(evaluated.resources[i].tag, evaluated.resources[i].props);
|
|
1092
|
+
}
|
|
1093
|
+
reg.tags = evaluated.replaceable;
|
|
1094
|
+
if (reg.seq < 0) reg.seq = ++headSeq;
|
|
1095
|
+
if (headRegistrations.indexOf(reg) === -1) headRegistrations.push(reg);
|
|
1096
|
+
scheduleHeadApply();
|
|
1097
|
+
return () => {
|
|
1098
|
+
const idx = headRegistrations.indexOf(reg);
|
|
1099
|
+
if (idx > -1) headRegistrations.splice(idx, 1);
|
|
1100
|
+
scheduleHeadApply();
|
|
1101
|
+
};
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
function loadModuleAssets(mapping) {
|
|
1105
|
+
const hy = globalThis._$HY;
|
|
1106
|
+
if (!hy) return;
|
|
1107
|
+
const pending = [];
|
|
1108
|
+
for (const key in mapping) {
|
|
1109
|
+
if (hy.modules[key]) continue;
|
|
1110
|
+
const entryUrl = mapping[key];
|
|
1111
|
+
if (!hy.loading[key]) {
|
|
1112
|
+
hy.loading[key] = import(entryUrl).then(mod => {
|
|
1113
|
+
hy.modules[key] = mod;
|
|
1114
|
+
}, err => {
|
|
1115
|
+
delete hy.loading[key];
|
|
1116
|
+
throw err;
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
pending.push(hy.loading[key]);
|
|
1120
|
+
}
|
|
1121
|
+
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1122
|
+
}
|
|
251
1123
|
function hydrate$1(code, element, options = {}) {
|
|
252
|
-
|
|
1124
|
+
installHydrationRuntime();
|
|
1125
|
+
if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
|
|
253
1126
|
options.renderId ||= "";
|
|
1127
|
+
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1128
|
+
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
254
1129
|
sharedConfig.completed = globalThis._$HY.completed;
|
|
255
1130
|
sharedConfig.events = globalThis._$HY.events;
|
|
256
1131
|
sharedConfig.load = id => globalThis._$HY.r[id];
|
|
257
1132
|
sharedConfig.has = id => id in globalThis._$HY.r;
|
|
258
1133
|
sharedConfig.gather = root => gatherHydratable(element, root);
|
|
1134
|
+
sharedConfig.loadModuleAssets = loadModuleAssets;
|
|
1135
|
+
sharedConfig.cleanupFragment = id => {
|
|
1136
|
+
const tpl = document.getElementById("pl-" + id);
|
|
1137
|
+
if (tpl) {
|
|
1138
|
+
let node = tpl.nextSibling;
|
|
1139
|
+
while (node) {
|
|
1140
|
+
const next = node.nextSibling;
|
|
1141
|
+
if (node.nodeType === 8 && node.nodeValue === "pl-" + id) {
|
|
1142
|
+
node.remove();
|
|
1143
|
+
break;
|
|
1144
|
+
}
|
|
1145
|
+
node.remove();
|
|
1146
|
+
node = next;
|
|
1147
|
+
}
|
|
1148
|
+
tpl.remove();
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
259
1151
|
sharedConfig.registry = new Map();
|
|
1152
|
+
if (!sharedConfig.boundaryScopes) sharedConfig.boundaryScopes = new Map();
|
|
1153
|
+
sharedConfig.captureBoundaryScope = id => {
|
|
1154
|
+
if (sharedConfig.registry) sharedConfig.boundaryScopes.set(id, {
|
|
1155
|
+
registry: sharedConfig.registry,
|
|
1156
|
+
gather: sharedConfig.gather
|
|
1157
|
+
});
|
|
1158
|
+
};
|
|
260
1159
|
sharedConfig.hydrating = true;
|
|
1160
|
+
const hyr = globalThis._$HY.r;
|
|
1161
|
+
const rootMapping = hyr && (hyr[options.renderId + "_assets"] || hyr["_assets"]);
|
|
1162
|
+
if (rootMapping && typeof rootMapping === "object") {
|
|
1163
|
+
const p = loadModuleAssets(rootMapping);
|
|
1164
|
+
if (p) {
|
|
1165
|
+
gatherHydratable(element, options.renderId);
|
|
1166
|
+
const registry = sharedConfig.registry;
|
|
1167
|
+
const gather = sharedConfig.gather;
|
|
1168
|
+
let disposer;
|
|
1169
|
+
p.then(() => {
|
|
1170
|
+
sharedConfig.registry = registry;
|
|
1171
|
+
sharedConfig.gather = gather;
|
|
1172
|
+
sharedConfig.hydrating = true;
|
|
1173
|
+
try {
|
|
1174
|
+
disposer = render$1(code, element, [...element.childNodes], options);
|
|
1175
|
+
} finally {
|
|
1176
|
+
sharedConfig.hydrating = false;
|
|
1177
|
+
}
|
|
1178
|
+
}, err => {
|
|
1179
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1180
|
+
sharedConfig.hydrating = false;
|
|
1181
|
+
sharedConfig.registry = undefined;
|
|
1182
|
+
disposer = render$1(code, element, [...element.childNodes], options);
|
|
1183
|
+
});
|
|
1184
|
+
return () => disposer && disposer();
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
261
1187
|
try {
|
|
262
1188
|
gatherHydratable(element, options.renderId);
|
|
263
|
-
return render(code, element, [...element.childNodes], options);
|
|
1189
|
+
return render$1(code, element, [...element.childNodes], options);
|
|
264
1190
|
} finally {
|
|
265
1191
|
sharedConfig.hydrating = false;
|
|
266
1192
|
}
|
|
@@ -270,7 +1196,10 @@ function getNextElement(template) {
|
|
|
270
1196
|
key,
|
|
271
1197
|
hydrating = isHydrating();
|
|
272
1198
|
if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
273
|
-
|
|
1199
|
+
if (!template) {
|
|
1200
|
+
throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
|
|
1201
|
+
}
|
|
1202
|
+
return template(true);
|
|
274
1203
|
}
|
|
275
1204
|
if (sharedConfig.completed) sharedConfig.completed.add(node);
|
|
276
1205
|
sharedConfig.registry.delete(key);
|
|
@@ -299,6 +1228,14 @@ function getNextMarker(start) {
|
|
|
299
1228
|
}
|
|
300
1229
|
return [end, current];
|
|
301
1230
|
}
|
|
1231
|
+
function getFirstChild(node, expectedTag) {
|
|
1232
|
+
const child = node.firstChild;
|
|
1233
|
+
return child;
|
|
1234
|
+
}
|
|
1235
|
+
function getNextSibling(node, expectedTag) {
|
|
1236
|
+
const sibling = node.nextSibling;
|
|
1237
|
+
return sibling;
|
|
1238
|
+
}
|
|
302
1239
|
function runHydrationEvents() {
|
|
303
1240
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
304
1241
|
queueMicrotask(() => {
|
|
@@ -312,7 +1249,32 @@ function runHydrationEvents() {
|
|
|
312
1249
|
const [el, e] = events[0];
|
|
313
1250
|
if (!completed.has(el)) return;
|
|
314
1251
|
events.shift();
|
|
315
|
-
|
|
1252
|
+
let matchContainer, matchState, matchDistance, matches;
|
|
1253
|
+
for (const [container, state] of delegatedContainers) {
|
|
1254
|
+
if (!state.handlers.has(e.type)) continue;
|
|
1255
|
+
const entry = findOwner(e.target, state);
|
|
1256
|
+
if (!entry) continue;
|
|
1257
|
+
if (matchContainer) {
|
|
1258
|
+
if (!matches) matches = [{
|
|
1259
|
+
container: matchContainer,
|
|
1260
|
+
state: matchState,
|
|
1261
|
+
distance: matchDistance
|
|
1262
|
+
}];
|
|
1263
|
+
matches.push({
|
|
1264
|
+
container,
|
|
1265
|
+
state,
|
|
1266
|
+
distance: entry.distance
|
|
1267
|
+
});
|
|
1268
|
+
} else {
|
|
1269
|
+
matchContainer = container;
|
|
1270
|
+
matchState = state;
|
|
1271
|
+
matchDistance = entry.distance;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
if (matches) {
|
|
1275
|
+
matches.sort((a, b) => a.distance - b.distance);
|
|
1276
|
+
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
1277
|
+
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
316
1278
|
}
|
|
317
1279
|
if (sharedConfig.done) {
|
|
318
1280
|
sharedConfig.events = _$HY.events = null;
|
|
@@ -323,16 +1285,31 @@ function runHydrationEvents() {
|
|
|
323
1285
|
}
|
|
324
1286
|
}
|
|
325
1287
|
function isHydrating(node) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
1288
|
+
if (!sharedConfig.hydrating) return false;
|
|
1289
|
+
if (!node || node.isConnected) return true;
|
|
1290
|
+
const roots = sharedConfig.claimRoots;
|
|
1291
|
+
if (roots) {
|
|
1292
|
+
for (let i = 0; i < roots.length; i++) {
|
|
1293
|
+
if (roots[i].contains(node)) return true;
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
return false;
|
|
331
1297
|
}
|
|
332
1298
|
function classListToObject(classList) {
|
|
333
1299
|
if (Array.isArray(classList)) {
|
|
334
1300
|
const result = {};
|
|
335
1301
|
flattenClassList(classList, result);
|
|
1302
|
+
classList = result;
|
|
1303
|
+
}
|
|
1304
|
+
if (classList && typeof classList === "object") {
|
|
1305
|
+
const result = {},
|
|
1306
|
+
keys = Object.keys(classList);
|
|
1307
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
1308
|
+
const key = keys[i];
|
|
1309
|
+
if (!classList[key]) continue;
|
|
1310
|
+
const classNames = key.trim().split(/\s+/);
|
|
1311
|
+
for (let j = 0, nameLen = classNames.length; j < nameLen; j++) classNames[j] && (result[classNames[j]] = true);
|
|
1312
|
+
}
|
|
336
1313
|
return result;
|
|
337
1314
|
}
|
|
338
1315
|
return classList;
|
|
@@ -343,18 +1320,16 @@ function flattenClassList(list, result) {
|
|
|
343
1320
|
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;
|
|
344
1321
|
}
|
|
345
1322
|
}
|
|
346
|
-
function assignProp(node, prop, value, prev,
|
|
347
|
-
let forceProp;
|
|
1323
|
+
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
348
1324
|
if (prop === "style") return style(node, value, prev), value;
|
|
349
|
-
if (prop === "class") return className(node, value,
|
|
350
|
-
if (value === prev) return prev;
|
|
1325
|
+
if (prop === "class") return className(node, value, prev), value;
|
|
1326
|
+
if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
|
|
351
1327
|
if (prop === "ref") {
|
|
352
|
-
if (!skipRef) value
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
} else if (prop.slice(0, 2) === "on") {
|
|
1328
|
+
if (!skipRef && value) ref(() => value, node);
|
|
1329
|
+
return value;
|
|
1330
|
+
}
|
|
1331
|
+
const hasNamespace = prop.indexOf(":") > -1;
|
|
1332
|
+
if (!hasNamespace && prop.slice(0, 2) === "on") {
|
|
358
1333
|
const name = prop.slice(2).toLowerCase();
|
|
359
1334
|
const delegate = DelegatedEvents.has(name);
|
|
360
1335
|
if (!delegate && prev) {
|
|
@@ -362,26 +1337,35 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
362
1337
|
node.removeEventListener(name, h);
|
|
363
1338
|
}
|
|
364
1339
|
if (delegate || value) {
|
|
365
|
-
|
|
1340
|
+
addEvent(node, name, value, delegate);
|
|
366
1341
|
delegate && delegateEvents([name]);
|
|
367
1342
|
}
|
|
368
|
-
} else if (
|
|
369
|
-
if (
|
|
370
|
-
if (prop === "value" &&
|
|
1343
|
+
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1344
|
+
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
1345
|
+
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
|
|
1346
|
+
node[prop] = value ?? "";else node[prop] = value;
|
|
371
1347
|
} else {
|
|
372
|
-
const ns =
|
|
1348
|
+
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
373
1349
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
374
1350
|
}
|
|
375
1351
|
return value;
|
|
376
1352
|
}
|
|
377
|
-
function eventHandler(e) {
|
|
378
|
-
if (
|
|
379
|
-
|
|
1353
|
+
function eventHandler(e, container, state) {
|
|
1354
|
+
if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
|
|
1355
|
+
const prev = e[$$EVENT_OWNER];
|
|
1356
|
+
let resumeNode;
|
|
1357
|
+
if (prev) {
|
|
1358
|
+
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
1359
|
+
resumeNode = prev;
|
|
380
1360
|
}
|
|
381
|
-
|
|
1361
|
+
const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
|
|
1362
|
+
if (state && !owner) return;
|
|
1363
|
+
if (owner && owner === resumeNode) return;
|
|
1364
|
+
e[$$EVENT_OWNER] = owner || true;
|
|
1365
|
+
let node = resumeNode || e.target;
|
|
382
1366
|
const key = `$$${e.type}`;
|
|
383
1367
|
const oriTarget = e.target;
|
|
384
|
-
const
|
|
1368
|
+
const boundary = owner || container || e.currentTarget;
|
|
385
1369
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
386
1370
|
configurable: true,
|
|
387
1371
|
value
|
|
@@ -397,52 +1381,72 @@ function eventHandler(e) {
|
|
|
397
1381
|
return true;
|
|
398
1382
|
};
|
|
399
1383
|
const walkUpTree = () => {
|
|
400
|
-
while (
|
|
1384
|
+
while (node && handleNode()) {
|
|
1385
|
+
if (node === boundary || node.parentNode === boundary) break;
|
|
1386
|
+
node = node._$host || node.parentNode || node.host;
|
|
1387
|
+
}
|
|
401
1388
|
};
|
|
402
1389
|
Object.defineProperty(e, "currentTarget", {
|
|
403
1390
|
configurable: true,
|
|
404
1391
|
get() {
|
|
405
|
-
return node || document;
|
|
1392
|
+
return node || boundary || document;
|
|
406
1393
|
}
|
|
407
1394
|
});
|
|
408
|
-
if (
|
|
409
|
-
|
|
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) {
|
|
410
1399
|
const path = e.composedPath();
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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
|
+
}
|
|
422
1413
|
}
|
|
423
|
-
}
|
|
1414
|
+
} else walkUpTree();
|
|
424
1415
|
}
|
|
425
1416
|
else walkUpTree();
|
|
426
1417
|
retarget(oriTarget);
|
|
427
1418
|
}
|
|
428
1419
|
function insertExpression(parent, value, current, marker) {
|
|
429
|
-
if (isHydrating(parent))
|
|
430
|
-
|
|
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;
|
|
431
1425
|
const t = typeof value,
|
|
432
1426
|
multi = marker !== undefined;
|
|
433
1427
|
if (t === "string" || t === "number") {
|
|
434
1428
|
const tc = typeof current;
|
|
435
1429
|
if (tc === "string" || tc === "number") {
|
|
436
1430
|
parent.firstChild.data = value;
|
|
437
|
-
} else
|
|
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
|
+
}
|
|
438
1437
|
} else if (value === undefined) {
|
|
439
1438
|
cleanChildren(parent, current, marker);
|
|
440
1439
|
} else if (value.nodeType) {
|
|
441
1440
|
if (Array.isArray(current)) {
|
|
442
1441
|
cleanChildren(parent, current, multi ? marker : null, value);
|
|
443
|
-
} else if (current
|
|
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 {
|
|
444
1447
|
parent.appendChild(value);
|
|
445
|
-
}
|
|
1448
|
+
}
|
|
1449
|
+
if (marker) value[$$SLOT] = marker;
|
|
446
1450
|
} else if (Array.isArray(value)) {
|
|
447
1451
|
const currentArray = current && Array.isArray(current);
|
|
448
1452
|
if (value.length === 0) {
|
|
@@ -450,12 +1454,13 @@ function insertExpression(parent, value, current, marker) {
|
|
|
450
1454
|
} else if (currentArray) {
|
|
451
1455
|
if (current.length === 0) {
|
|
452
1456
|
appendNodes(parent, value, marker);
|
|
453
|
-
} else reconcileArrays(parent, current, value);
|
|
1457
|
+
} else reconcileArrays(parent, current, value, marker);
|
|
454
1458
|
} else {
|
|
455
|
-
current && cleanChildren(parent);
|
|
1459
|
+
current && cleanChildren(parent, current);
|
|
456
1460
|
appendNodes(parent, value);
|
|
457
1461
|
}
|
|
458
1462
|
} else ;
|
|
1463
|
+
return value;
|
|
459
1464
|
}
|
|
460
1465
|
function normalize(value, current, multi, doNotUnwrap) {
|
|
461
1466
|
value = flatten(value, {
|
|
@@ -469,44 +1474,87 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
469
1474
|
const item = value[i],
|
|
470
1475
|
prev = current && current[i],
|
|
471
1476
|
t = typeof item;
|
|
472
|
-
if (t === "string" || t === "number") value[i] = prev && prev.nodeType === 3 && prev.data === item ? prev : document.createTextNode(item);
|
|
1477
|
+
if (t === "string" || t === "number") value[i] = prev && prev.nodeType === 3 && (sharedConfig.hydrating || prev.data === "" + item) ? prev : document.createTextNode(item);
|
|
473
1478
|
}
|
|
474
1479
|
}
|
|
475
1480
|
return value;
|
|
476
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
|
+
}
|
|
477
1493
|
function appendNodes(parent, array, marker = null) {
|
|
478
|
-
for (let i = 0, len = array.length; i < len; i++)
|
|
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
|
+
}
|
|
479
1522
|
}
|
|
480
1523
|
function cleanChildren(parent, current, marker, replacement) {
|
|
481
|
-
if (marker === undefined)
|
|
1524
|
+
if (marker === undefined) {
|
|
1525
|
+
if (ownsAllChildren(parent, current)) return parent.textContent = "";
|
|
1526
|
+
return removeOwnedChildren(parent, current);
|
|
1527
|
+
}
|
|
482
1528
|
if (current.length) {
|
|
483
1529
|
let inserted = false;
|
|
484
1530
|
for (let i = current.length - 1; i >= 0; i--) {
|
|
485
1531
|
const el = current[i];
|
|
486
1532
|
if (replacement !== el) {
|
|
487
|
-
const
|
|
488
|
-
|
|
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();
|
|
489
1536
|
} else inserted = true;
|
|
490
1537
|
}
|
|
491
1538
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
1539
|
+
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
492
1540
|
}
|
|
493
1541
|
function gatherHydratable(element, root) {
|
|
494
1542
|
const templates = element.querySelectorAll(`*[_hk]`);
|
|
495
1543
|
for (let i = 0; i < templates.length; i++) {
|
|
496
1544
|
const node = templates[i];
|
|
497
1545
|
const key = node.getAttribute("_hk");
|
|
498
|
-
if (
|
|
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 (!sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
|
|
499
1553
|
}
|
|
500
1554
|
}
|
|
501
1555
|
function getHydrationKey() {
|
|
502
1556
|
return sharedConfig.getNextContextId();
|
|
503
1557
|
}
|
|
504
|
-
function NoHydration(props) {
|
|
505
|
-
return sharedConfig.hydrating ? undefined : props.children;
|
|
506
|
-
}
|
|
507
|
-
function Hydration(props) {
|
|
508
|
-
return props.children;
|
|
509
|
-
}
|
|
510
1558
|
const voidFn = () => undefined;
|
|
511
1559
|
const RequestContext = Symbol();
|
|
512
1560
|
|
|
@@ -517,88 +1565,295 @@ function throwInBrowser(func) {
|
|
|
517
1565
|
function renderToString(fn, options) {
|
|
518
1566
|
throwInBrowser(renderToString);
|
|
519
1567
|
}
|
|
520
|
-
function renderToStringAsync(fn, options) {
|
|
521
|
-
throwInBrowser(renderToStringAsync);
|
|
522
|
-
}
|
|
523
1568
|
function renderToStream(fn, options) {
|
|
524
1569
|
throwInBrowser(renderToStream);
|
|
525
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
|
+
}
|
|
526
1589
|
function ssr(template, ...nodes) {}
|
|
527
1590
|
function ssrElement(name, props, children, needsId) {}
|
|
528
|
-
function
|
|
1591
|
+
function ssrClassName(value) {}
|
|
529
1592
|
function ssrStyle(value) {}
|
|
1593
|
+
function ssrStyleProperty(name, value) {}
|
|
530
1594
|
function ssrAttribute(key, value) {}
|
|
1595
|
+
function ssrGroup(fn, n) {}
|
|
531
1596
|
function ssrHydrationKey() {}
|
|
532
|
-
function resolveSSRNode(node) {}
|
|
533
|
-
function escape(
|
|
1597
|
+
function resolveSSRNode(node, result, top) {}
|
|
1598
|
+
function escape(s, attr) {}
|
|
534
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 = merge;
|
|
535
1699
|
const isServer = false;
|
|
536
1700
|
const isDev = false;
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
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
|
+
flush();
|
|
1710
|
+
return dispose;
|
|
1711
|
+
} finally {
|
|
1712
|
+
}
|
|
542
1713
|
}
|
|
543
1714
|
const hydrate = (...args) => {
|
|
544
1715
|
enableHydration();
|
|
545
1716
|
return hydrate$1(...args);
|
|
546
1717
|
};
|
|
547
1718
|
function Portal(props) {
|
|
1719
|
+
return runWithOwner(createOwner(), () => portalImpl(props));
|
|
1720
|
+
}
|
|
1721
|
+
function portalImpl(props) {
|
|
548
1722
|
const treeMarker = document.createTextNode(""),
|
|
549
1723
|
startMarker = document.createTextNode(""),
|
|
550
1724
|
endMarker = document.createTextNode(""),
|
|
551
|
-
mount = () =>
|
|
552
|
-
|
|
553
|
-
|
|
1725
|
+
mount = () => props.mount || document.body,
|
|
1726
|
+
content = createMemo(() => [startMarker, props.children], {
|
|
1727
|
+
ssrSource: "client",
|
|
1728
|
+
loadingValue: undefined
|
|
1729
|
+
});
|
|
1730
|
+
createRenderEffect(
|
|
1731
|
+
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
1732
|
+
const m = untrack(mount);
|
|
554
1733
|
m.appendChild(endMarker);
|
|
555
|
-
|
|
1734
|
+
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
1735
|
+
insert(m, c, endMarker, undefined, {
|
|
1736
|
+
host: () => treeMarker.parentNode
|
|
1737
|
+
});
|
|
1738
|
+
return d;
|
|
1739
|
+
}));
|
|
556
1740
|
return () => {
|
|
1741
|
+
dispose();
|
|
557
1742
|
let c = startMarker;
|
|
558
|
-
while (c
|
|
1743
|
+
while (c) {
|
|
559
1744
|
const n = c.nextSibling;
|
|
560
1745
|
m.removeChild(c);
|
|
1746
|
+
if (c === endMarker) break;
|
|
561
1747
|
c = n;
|
|
562
1748
|
}
|
|
563
1749
|
};
|
|
1750
|
+
},
|
|
1751
|
+
{
|
|
1752
|
+
schedule: true,
|
|
1753
|
+
ssrSource: "client"
|
|
1754
|
+
});
|
|
1755
|
+
createEffect(mount, () => {
|
|
1756
|
+
const m = 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 (sharedConfig.hydrating) return createMemo(() => treeMarker, {
|
|
1765
|
+
ssrSource: "client",
|
|
1766
|
+
loadingValue: undefined
|
|
564
1767
|
});
|
|
565
1768
|
return treeMarker;
|
|
566
1769
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
if (prop === "appendChild" || prop === "insertBefore") {
|
|
571
|
-
return (...args) => {
|
|
572
|
-
Object.defineProperty(args[0], "_$host", {
|
|
573
|
-
get: () => marker.parentNode,
|
|
574
|
-
configurable: true
|
|
575
|
-
});
|
|
576
|
-
target[prop](...args);
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
const value = Reflect.get(target, prop);
|
|
580
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
581
|
-
}
|
|
582
|
-
});
|
|
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;
|
|
583
1773
|
}
|
|
584
|
-
function
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
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;
|
|
596
1786
|
}
|
|
1787
|
+
return next;
|
|
1788
|
+
};
|
|
1789
|
+
const cached = 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
|
|
597
1798
|
});
|
|
1799
|
+
return props => {
|
|
1800
|
+
return 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] = createSignal(deliveredAddress ?? binding.address);
|
|
1808
|
+
sites.add(setAddress);
|
|
1809
|
+
onCleanup(() => sites.delete(setAddress));
|
|
1810
|
+
return untrack(() => binding.component(props, address));
|
|
1811
|
+
}
|
|
1812
|
+
return untrack(() => component(props));
|
|
1813
|
+
}
|
|
1814
|
+
case "string":
|
|
1815
|
+
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
|
|
1816
|
+
spread(el, props);
|
|
1817
|
+
return el;
|
|
1818
|
+
}
|
|
1819
|
+
});
|
|
1820
|
+
};
|
|
598
1821
|
}
|
|
599
1822
|
function Dynamic(props) {
|
|
600
|
-
const
|
|
601
|
-
return
|
|
1823
|
+
const Comp = dynamic(() => props.component);
|
|
1824
|
+
return createComponent(Comp, 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, exportName) {
|
|
1832
|
+
fn().then(m => setComp(() => exportName ? m[exportName] : m.default));
|
|
1833
|
+
}
|
|
1834
|
+
function clientOnly(fn, options = {},
|
|
1835
|
+
_moduleUrl) {
|
|
1836
|
+
const [comp, setComp] = createSignal();
|
|
1837
|
+
let started = !options.lazy;
|
|
1838
|
+
started && loadClientOnly(fn, setComp, options.export);
|
|
1839
|
+
return props => {
|
|
1840
|
+
let Comp;
|
|
1841
|
+
let m;
|
|
1842
|
+
const rest = omit(props, "fallback");
|
|
1843
|
+
if (!started) {
|
|
1844
|
+
started = true;
|
|
1845
|
+
loadClientOnly(fn, setComp, options.export);
|
|
1846
|
+
}
|
|
1847
|
+
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
1848
|
+
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
|
1849
|
+
const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1850
|
+
const onHydrationEnd = sharedConfig.onHydrationEnd;
|
|
1851
|
+
const release = () => setMounted(true);
|
|
1852
|
+
onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
|
|
1853
|
+
return gate;
|
|
1854
|
+
};
|
|
602
1855
|
}
|
|
1856
|
+
function httpStatus(_code, _text) {}
|
|
1857
|
+
function httpHeader(_name, _value, _options) {}
|
|
603
1858
|
|
|
604
|
-
export {
|
|
1859
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, mergeProps, parseCookieHeader, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, warmAsset };
|