@solidjs/web 2.0.0-beta.3 → 2.0.0-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -4
- package/dist/dev.cjs +1224 -205
- package/dist/dev.js +1188 -199
- package/dist/server.cjs +1429 -234
- package/dist/server.js +1391 -231
- package/dist/web.cjs +1207 -195
- package/dist/web.js +1171 -189
- package/frames/dist/client.cjs +1694 -0
- package/frames/dist/client.dev.cjs +1707 -0
- package/frames/dist/client.dev.js +1695 -0
- package/frames/dist/client.js +1682 -0
- package/frames/dist/server.cjs +2520 -0
- package/frames/dist/server.js +2508 -0
- package/frames/package.json +30 -0
- package/package.json +285 -37
- package/serialization/dist/serialization.cjs +169 -0
- package/serialization/dist/serialization.js +159 -0
- package/serialization/package.json +20 -0
- package/serialization/types/index.d.ts +157 -0
- package/serialization/types-cjs/index.d.cts +157 -0
- package/serialization/types-cjs/package.json +3 -0
- package/server-functions/dist/client.cjs +613 -0
- package/server-functions/dist/client.js +585 -0
- package/server-functions/dist/server.cjs +904 -0
- package/server-functions/dist/server.js +875 -0
- package/server-functions/package.json +30 -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 +127 -21
- package/types/core.d.ts +4 -3
- package/types/frames/client.d.ts +22 -0
- package/types/frames/frame-client.d.ts +282 -0
- package/types/frames/frame-sink.d.ts +171 -0
- package/types/frames/frame-transport.d.ts +190 -0
- package/types/frames/serializer.d.ts +157 -0
- package/types/frames/server.d.ts +30 -0
- package/types/index.d.ts +211 -26
- package/types/jsx-properties.d.ts +93 -0
- package/types/jsx.d.ts +4150 -1
- package/types/response.d.ts +129 -0
- package/types/serializer.d.ts +157 -0
- package/types/server-functions/client.d.ts +200 -0
- package/types/server-functions/flash.d.ts +38 -0
- package/types/server-functions/server.d.ts +490 -0
- package/types/server-functions/shared.d.ts +445 -0
- package/types/server-mock.d.ts +93 -0
- package/types/server.d.ts +223 -28
- package/types-cjs/client.d.cts +194 -0
- package/types-cjs/core.d.cts +4 -0
- package/types-cjs/frames/client.d.cts +22 -0
- package/types-cjs/frames/frame-client.d.cts +282 -0
- package/types-cjs/frames/frame-sink.d.cts +171 -0
- package/types-cjs/frames/frame-transport.d.cts +190 -0
- package/types-cjs/frames/serializer.d.cts +157 -0
- package/types-cjs/frames/server.d.cts +30 -0
- package/types-cjs/index.d.cts +231 -0
- package/types-cjs/jsx-properties.d.cts +93 -0
- package/types-cjs/jsx.d.cts +4150 -0
- package/types-cjs/package.json +3 -0
- package/types-cjs/response.d.cts +129 -0
- package/types-cjs/serializer.d.cts +157 -0
- package/types-cjs/server-functions/client.d.cts +200 -0
- package/types-cjs/server-functions/flash.d.cts +38 -0
- package/types-cjs/server-functions/server.d.cts +490 -0
- package/types-cjs/server-functions/shared.d.cts +445 -0
- package/types-cjs/server-mock.d.cts +165 -0
- package/types-cjs/server.d.cts +351 -0
- package/storage/types/src/client.d.ts +0 -1
- package/storage/types/src/index.d.ts +0 -46
- package/storage/types/src/server-mock.d.ts +0 -72
- package/storage/types/storage/src/index.d.ts +0 -2
package/dist/dev.js
CHANGED
|
@@ -1,39 +1,80 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Show, Switch, createComponent, getOwner,
|
|
3
|
-
import { createMemo } from '@solidjs/signals';
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createOwner, createSignal, $DEVCOMP, onCleanup, enableHydration, enforceLoadingBoundary, flush, getOwner, createEffect } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
|
|
4
3
|
|
|
5
|
-
const
|
|
6
|
-
|
|
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
|
+
};
|
|
7
32
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
33
|
+
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
34
|
+
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
8
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"]);
|
|
9
36
|
const SVGElements = /*#__PURE__*/new Set([
|
|
10
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",
|
|
11
38
|
"set", "stop",
|
|
12
39
|
"svg", "switch", "symbol", "text", "textPath",
|
|
13
40
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
14
|
-
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",
|
|
15
45
|
xlink: "http://www.w3.org/1999/xlink",
|
|
16
46
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
17
47
|
};
|
|
18
|
-
const
|
|
19
|
-
"
|
|
20
|
-
"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(","));
|
|
21
51
|
|
|
22
|
-
const
|
|
23
|
-
transparent: true
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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);
|
|
28
65
|
|
|
29
|
-
function reconcileArrays(parentNode, a, b) {
|
|
66
|
+
function reconcileArrays(parentNode, a, b, marker) {
|
|
30
67
|
let bLength = b.length,
|
|
31
68
|
aEnd = a.length,
|
|
32
69
|
bEnd = bLength,
|
|
33
70
|
aStart = 0,
|
|
34
71
|
bStart = 0,
|
|
35
|
-
|
|
36
|
-
|
|
72
|
+
tail = a[aEnd - 1],
|
|
73
|
+
tailTag = tail[$$SLOT],
|
|
74
|
+
after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
|
|
75
|
+
map = null,
|
|
76
|
+
anchor,
|
|
77
|
+
anchorTag;
|
|
37
78
|
while (aStart < aEnd || bStart < bEnd) {
|
|
38
79
|
if (a[aStart] === b[bStart]) {
|
|
39
80
|
aStart++;
|
|
@@ -45,18 +86,43 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
45
86
|
bEnd--;
|
|
46
87
|
}
|
|
47
88
|
if (aEnd === aStart) {
|
|
48
|
-
|
|
49
|
-
|
|
89
|
+
let node;
|
|
90
|
+
if (bEnd < bLength) {
|
|
91
|
+
if (bStart) {
|
|
92
|
+
const prev = b[bStart - 1];
|
|
93
|
+
const prevTag = prev[$$SLOT];
|
|
94
|
+
node = prev.parentNode === parentNode && (!prevTag || prevTag === marker) ? prev.nextSibling : after;
|
|
95
|
+
} else node = b[bEnd - bStart];
|
|
96
|
+
} else node = after;
|
|
97
|
+
while (bStart < bEnd) {
|
|
98
|
+
const n = b[bStart++];
|
|
99
|
+
parentNode.insertBefore(n, node);
|
|
100
|
+
if (marker) n[$$SLOT] = marker;
|
|
101
|
+
}
|
|
50
102
|
} else if (bEnd === bStart) {
|
|
51
103
|
while (aStart < aEnd) {
|
|
52
|
-
|
|
53
|
-
|
|
104
|
+
const n = a[aStart++];
|
|
105
|
+
if (!map || !map.has(n)) {
|
|
106
|
+
const tag = n[$$SLOT];
|
|
107
|
+
if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
|
|
111
|
+
if (marker) {
|
|
112
|
+
do {
|
|
113
|
+
const n = a[--aEnd];
|
|
114
|
+
parentNode.insertBefore(n, anchor);
|
|
115
|
+
n[$$SLOT] = marker;
|
|
116
|
+
bStart++;
|
|
117
|
+
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
118
|
+
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
119
|
+
} else {
|
|
120
|
+
do {
|
|
121
|
+
parentNode.insertBefore(a[--aEnd], anchor);
|
|
122
|
+
bStart++;
|
|
123
|
+
if (aStart >= aEnd - 1 || bStart >= bEnd) break;
|
|
124
|
+
} while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
54
125
|
}
|
|
55
|
-
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
56
|
-
const node = a[--aEnd].nextSibling;
|
|
57
|
-
parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
|
|
58
|
-
parentNode.insertBefore(b[--bEnd], node);
|
|
59
|
-
a[aEnd] = b[bEnd];
|
|
60
126
|
} else {
|
|
61
127
|
if (!map) {
|
|
62
128
|
map = new Map();
|
|
@@ -74,80 +140,279 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
74
140
|
sequence++;
|
|
75
141
|
}
|
|
76
142
|
if (sequence > index - bStart) {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
143
|
+
const head = a[aStart];
|
|
144
|
+
const headTag = head[$$SLOT];
|
|
145
|
+
const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
|
|
146
|
+
while (bStart < index) {
|
|
147
|
+
const n = b[bStart++];
|
|
148
|
+
parentNode.insertBefore(n, node);
|
|
149
|
+
if (marker) n[$$SLOT] = marker;
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
const oldNode = a[aStart++];
|
|
153
|
+
const newNode = b[bStart++];
|
|
154
|
+
const oldTag = oldNode[$$SLOT];
|
|
155
|
+
if (oldNode.parentNode === parentNode && (!oldTag || oldTag === marker)) {
|
|
156
|
+
parentNode.replaceChild(newNode, oldNode);
|
|
157
|
+
} else {
|
|
158
|
+
parentNode.insertBefore(newNode, after);
|
|
159
|
+
}
|
|
160
|
+
if (marker) newNode[$$SLOT] = marker;
|
|
161
|
+
}
|
|
80
162
|
} else aStart++;
|
|
81
|
-
} else
|
|
163
|
+
} else {
|
|
164
|
+
const n = a[aStart++];
|
|
165
|
+
const nTag = n[$$SLOT];
|
|
166
|
+
if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
|
|
167
|
+
}
|
|
82
168
|
}
|
|
83
169
|
}
|
|
84
170
|
}
|
|
85
171
|
|
|
86
|
-
const
|
|
172
|
+
const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
|
|
173
|
+
const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
|
|
174
|
+
const RESOURCE_LINK_RELS = new Set(["preload", "modulepreload", "prefetch", "preconnect", "dns-prefetch", "stylesheet"]);
|
|
175
|
+
const RESOURCE_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
|
|
176
|
+
function evalHeadValue(v) {
|
|
177
|
+
return typeof v === "function" ? v() : v;
|
|
178
|
+
}
|
|
179
|
+
function evalHeadProps(props, presets) {
|
|
180
|
+
const out = {};
|
|
181
|
+
for (const name in props) out[name] = presets && name in presets ? presets[name] : evalHeadValue(props[name]);
|
|
182
|
+
return out;
|
|
183
|
+
}
|
|
184
|
+
function classifyHeadTag(desc) {
|
|
185
|
+
const tag = desc.tag;
|
|
186
|
+
if (tag === "link") {
|
|
187
|
+
const rel = evalHeadValue(desc.props && desc.props.rel);
|
|
188
|
+
return {
|
|
189
|
+
resource: RESOURCE_LINK_RELS.has(rel),
|
|
190
|
+
rel
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
if (tag === "style") return {
|
|
194
|
+
resource: !!(desc.props && "href" in desc.props)
|
|
195
|
+
};
|
|
196
|
+
if (tag === "script") return {
|
|
197
|
+
resource: !!(desc.props && "src" in desc.props)
|
|
198
|
+
};
|
|
199
|
+
return {
|
|
200
|
+
resource: false
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function resourceIdentity(tag, props) {
|
|
204
|
+
let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
|
|
205
|
+
for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
|
|
206
|
+
const q = RESOURCE_QUALIFIERS[i];
|
|
207
|
+
if (props[q] != null) id += ":" + q + "=" + props[q];
|
|
208
|
+
}
|
|
209
|
+
return id;
|
|
210
|
+
}
|
|
211
|
+
function replaceableIdentity(tag, props, key, unique) {
|
|
212
|
+
if (tag === "title") return "title";
|
|
213
|
+
if (tag === "base") return "base";
|
|
214
|
+
if (tag === "meta" && props.charset != null) return "charset";
|
|
215
|
+
if (key != null) return tag + ":key:" + key;
|
|
216
|
+
if (tag === "meta") {
|
|
217
|
+
for (const ns of ["name", "property", "http-equiv"]) if (props[ns] != null) return "meta:" + ns + ":" + props[ns] + (props.media != null ? ":media=" + props.media : "");
|
|
218
|
+
return unique;
|
|
219
|
+
}
|
|
220
|
+
if (tag === "link") {
|
|
221
|
+
const rel = props.rel || "";
|
|
222
|
+
if (rel === "icon" || rel === "apple-touch-icon") return "link:" + rel + (props.sizes != null ? ":sizes=" + props.sizes : "") + (props.type != null ? ":type=" + props.type : "");
|
|
223
|
+
return "link:" + rel + ":" + (props.href || "");
|
|
224
|
+
}
|
|
225
|
+
return unique;
|
|
226
|
+
}
|
|
227
|
+
function resolveHead(groups) {
|
|
228
|
+
const winners = new Map();
|
|
229
|
+
const sorted = groups.slice().sort((a, b) => a.seq - b.seq);
|
|
230
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
231
|
+
const group = sorted[i];
|
|
232
|
+
const byIdentity = new Map();
|
|
233
|
+
for (let j = 0; j < group.tags.length; j++) {
|
|
234
|
+
const t = group.tags[j];
|
|
235
|
+
let list = byIdentity.get(t.identity);
|
|
236
|
+
if (!list) byIdentity.set(t.identity, list = []);
|
|
237
|
+
list.push(t);
|
|
238
|
+
}
|
|
239
|
+
for (const [identity, tags] of byIdentity) {
|
|
240
|
+
if (identity === "title") {
|
|
241
|
+
if (tags.length > 1) console.warn("Multiple <title> tags in one head group; the last one wins.");
|
|
242
|
+
winners.set(identity, {
|
|
243
|
+
seq: group.seq,
|
|
244
|
+
tags: [tags[tags.length - 1]]
|
|
245
|
+
});
|
|
246
|
+
} else {
|
|
247
|
+
winners.set(identity, {
|
|
248
|
+
seq: group.seq,
|
|
249
|
+
tags
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return winners;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
|
|
258
|
+
const INNER_OWNED = {};
|
|
259
|
+
const delegatedEvents = new Set();
|
|
260
|
+
const delegatedContainers = new Map();
|
|
87
261
|
function render$1(code, element, init, options = {}) {
|
|
88
262
|
if (!element) {
|
|
89
263
|
throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
|
|
90
264
|
}
|
|
91
265
|
let disposer;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
266
|
+
registerDelegatedRoot(element);
|
|
267
|
+
try {
|
|
268
|
+
createRoot(dispose => {
|
|
269
|
+
disposer = dispose;
|
|
270
|
+
if (element === document) {
|
|
271
|
+
const tree = code();
|
|
272
|
+
effect(() => flatten(tree), () => {});
|
|
273
|
+
} else {
|
|
274
|
+
const tree = code();
|
|
275
|
+
insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
|
|
276
|
+
}
|
|
277
|
+
}, {
|
|
278
|
+
id: options.renderId
|
|
279
|
+
});
|
|
280
|
+
} catch (err) {
|
|
281
|
+
if (disposer) disposer();
|
|
282
|
+
unregisterDelegatedRoot(element);
|
|
283
|
+
throw err;
|
|
284
|
+
}
|
|
98
285
|
return () => {
|
|
99
286
|
disposer();
|
|
287
|
+
unregisterDelegatedRoot(element);
|
|
100
288
|
element.textContent = "";
|
|
101
289
|
};
|
|
102
290
|
}
|
|
103
|
-
function
|
|
291
|
+
function create(html, bypassGuard, flag) {
|
|
292
|
+
if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
|
|
293
|
+
const t = document.createElement("template");
|
|
294
|
+
t.innerHTML = html;
|
|
295
|
+
return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
296
|
+
}
|
|
297
|
+
function template(html, flag) {
|
|
104
298
|
let node;
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
|
|
108
|
-
t.innerHTML = html;
|
|
109
|
-
return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
|
|
110
|
-
};
|
|
111
|
-
const fn = isImportNode ? bypassGuard => untrack(() => document.importNode(node || (node = create(bypassGuard)), true)) : bypassGuard => (node || (node = create(bypassGuard))).cloneNode(true);
|
|
112
|
-
fn._html = html;
|
|
299
|
+
const fn = flag === 1 ? bypassGuard => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : bypassGuard => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
|
|
300
|
+
fn._html = flag === 2 ? html.replace(/^<[^>]+>/, "") : html;
|
|
113
301
|
return fn;
|
|
114
302
|
}
|
|
115
|
-
function delegateEvents(eventNames
|
|
116
|
-
const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
|
|
303
|
+
function delegateEvents(eventNames) {
|
|
117
304
|
for (let i = 0, l = eventNames.length; i < l; i++) {
|
|
118
305
|
const name = eventNames[i];
|
|
119
|
-
if (!
|
|
120
|
-
|
|
121
|
-
|
|
306
|
+
if (!delegatedEvents.has(name)) {
|
|
307
|
+
delegatedEvents.add(name);
|
|
308
|
+
delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
|
|
122
309
|
}
|
|
123
310
|
}
|
|
124
311
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
312
|
+
function registerDelegatedRoot(root) {
|
|
313
|
+
const state = registerDelegatedContainer(root, root);
|
|
314
|
+
if (state) state.roots = (state.roots || 0) + 1;
|
|
315
|
+
}
|
|
316
|
+
function unregisterDelegatedRoot(root) {
|
|
317
|
+
const state = delegatedContainers.get(root);
|
|
318
|
+
if (state) state.roots > 1 ? state.roots-- : delete state.roots;
|
|
319
|
+
unregisterDelegatedContainer(root, root);
|
|
320
|
+
}
|
|
321
|
+
function registerDelegatedContainer(container, owner = container) {
|
|
322
|
+
if (!container || !owner) return;
|
|
323
|
+
let state = delegatedContainers.get(container);
|
|
324
|
+
if (!state) delegatedContainers.set(container, state = {
|
|
325
|
+
owners: new Map(),
|
|
326
|
+
handlers: new Map()
|
|
327
|
+
});
|
|
328
|
+
state.owners.set(owner, (state.owners.get(owner) || 0) + 1);
|
|
329
|
+
delegatedEvents.forEach(name => attachDelegatedEvent(name, container, state));
|
|
330
|
+
return state;
|
|
331
|
+
}
|
|
332
|
+
function unregisterDelegatedContainer(container, owner = container) {
|
|
333
|
+
const state = delegatedContainers.get(container);
|
|
334
|
+
if (!state) return;
|
|
335
|
+
const count = state.owners.get(owner);
|
|
336
|
+
if (count > 1) state.owners.set(owner, count - 1);else state.owners.delete(owner);
|
|
337
|
+
if (state.owners.size) return;
|
|
338
|
+
state.handlers.forEach((handler, name) => container.removeEventListener(name, handler));
|
|
339
|
+
delegatedContainers.delete(container);
|
|
340
|
+
}
|
|
341
|
+
function attachDelegatedEvent(name, container, state) {
|
|
342
|
+
if (state.handlers.has(name)) return;
|
|
343
|
+
const handler = e => eventHandler(e, container, state);
|
|
344
|
+
state.handlers.set(name, handler);
|
|
345
|
+
container.addEventListener(name, handler);
|
|
346
|
+
}
|
|
347
|
+
function getDelegatedRoot(node) {
|
|
348
|
+
while (node) {
|
|
349
|
+
if (delegatedContainers.get(node)?.roots) return node;
|
|
350
|
+
node = node._$host || node.parentNode || node.host;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function findOwner(target, state) {
|
|
354
|
+
let node = target;
|
|
355
|
+
let distance = 0;
|
|
356
|
+
while (node) {
|
|
357
|
+
if (state.owners.has(node)) return {
|
|
358
|
+
owner: node,
|
|
359
|
+
distance
|
|
360
|
+
};
|
|
361
|
+
distance++;
|
|
362
|
+
node = node._$host || node.parentNode || node.host;
|
|
129
363
|
}
|
|
130
364
|
}
|
|
131
365
|
function setProperty(node, name, value) {
|
|
132
366
|
if (isHydrating(node)) return;
|
|
133
367
|
node[name] = value;
|
|
134
368
|
}
|
|
369
|
+
let claimHandlers = null;
|
|
370
|
+
const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
|
|
371
|
+
function registerElementClaim(handler) {
|
|
372
|
+
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
373
|
+
return () => {
|
|
374
|
+
const index = claimHandlers.indexOf(handler);
|
|
375
|
+
index > -1 && claimHandlers.splice(index, 1);
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
const CLAIMED_ELEMENTS = "a[href], form[action]";
|
|
379
|
+
function claimElementTree(root) {
|
|
380
|
+
const handlers = globalThis[CLAIM_SEAM];
|
|
381
|
+
if (handlers === undefined || handlers.length === 0) return root;
|
|
382
|
+
const isElement = root.nodeType === 1;
|
|
383
|
+
if (!isElement && root.nodeType !== 11) return root;
|
|
384
|
+
if (isElement && root.matches(CLAIMED_ELEMENTS)) {
|
|
385
|
+
for (let i = 0; i < handlers.length; i++) handlers[i](root);
|
|
386
|
+
}
|
|
387
|
+
const found = root.querySelectorAll(CLAIMED_ELEMENTS);
|
|
388
|
+
for (let i = 0; i < found.length; i++) {
|
|
389
|
+
for (let j = 0; j < handlers.length; j++) handlers[j](found[i]);
|
|
390
|
+
}
|
|
391
|
+
return root;
|
|
392
|
+
}
|
|
393
|
+
function claimElement(node) {
|
|
394
|
+
if (claimHandlers !== null) {
|
|
395
|
+
for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
|
|
396
|
+
}
|
|
397
|
+
return node;
|
|
398
|
+
}
|
|
135
399
|
function setAttribute(node, name, value) {
|
|
136
400
|
if (isHydrating(node)) return;
|
|
137
401
|
if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
|
|
402
|
+
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
138
403
|
}
|
|
139
404
|
function setAttributeNS(node, namespace, name, value) {
|
|
140
405
|
if (isHydrating(node)) return;
|
|
141
|
-
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
406
|
+
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
142
407
|
}
|
|
143
|
-
function className(node, value,
|
|
408
|
+
function className(node, value, prev) {
|
|
144
409
|
if (isHydrating(node)) return;
|
|
145
410
|
if (value == null || value === false) {
|
|
146
411
|
prev && node.removeAttribute("class");
|
|
147
412
|
return;
|
|
148
413
|
}
|
|
149
414
|
if (typeof value === "string") {
|
|
150
|
-
value !== prev &&
|
|
415
|
+
value !== prev && node.setAttribute("class", value);
|
|
151
416
|
return;
|
|
152
417
|
}
|
|
153
418
|
if (typeof prev === "string") {
|
|
@@ -161,16 +426,16 @@ function className(node, value, isSVG, prev) {
|
|
|
161
426
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
162
427
|
const key = prevKeys[i];
|
|
163
428
|
if (!key || key === "undefined" || value[key]) continue;
|
|
164
|
-
|
|
429
|
+
node.classList.remove(key);
|
|
165
430
|
}
|
|
166
431
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
167
432
|
const key = classKeys[i],
|
|
168
433
|
classValue = !!value[key];
|
|
169
434
|
if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
|
|
170
|
-
|
|
435
|
+
node.classList.add(key);
|
|
171
436
|
}
|
|
172
437
|
}
|
|
173
|
-
function
|
|
438
|
+
function addEvent(node, name, handler, delegate) {
|
|
174
439
|
if (delegate) {
|
|
175
440
|
if (Array.isArray(handler)) {
|
|
176
441
|
node[`$$${name}`] = handler[0];
|
|
@@ -183,33 +448,48 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
183
448
|
}
|
|
184
449
|
function style(node, value, prev) {
|
|
185
450
|
if (!value) {
|
|
186
|
-
if (prev
|
|
451
|
+
if (prev || node._$styles) {
|
|
452
|
+
setAttribute(node, "style");
|
|
453
|
+
node._$styles = undefined;
|
|
454
|
+
}
|
|
187
455
|
return;
|
|
188
456
|
}
|
|
189
457
|
const nodeStyle = node.style;
|
|
190
|
-
if (typeof value === "string")
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
458
|
+
if (typeof value === "string") {
|
|
459
|
+
node._$styles = undefined;
|
|
460
|
+
return nodeStyle.cssText = value;
|
|
461
|
+
}
|
|
462
|
+
if (typeof prev === "string") {
|
|
463
|
+
nodeStyle.cssText = "";
|
|
464
|
+
prev = undefined;
|
|
465
|
+
}
|
|
466
|
+
let applied = node._$styles;
|
|
467
|
+
if (!applied) {
|
|
468
|
+
applied = node._$styles = prev ? {
|
|
469
|
+
...prev
|
|
470
|
+
} : {};
|
|
471
|
+
}
|
|
194
472
|
let v, s;
|
|
473
|
+
for (s in applied) {
|
|
474
|
+
if (value[s] == null) {
|
|
475
|
+
nodeStyle.removeProperty(s);
|
|
476
|
+
delete applied[s];
|
|
477
|
+
}
|
|
478
|
+
}
|
|
195
479
|
for (s in value) {
|
|
196
480
|
v = value[s];
|
|
197
|
-
if (v !==
|
|
198
|
-
|
|
481
|
+
if (v != null && v !== applied[s]) {
|
|
482
|
+
nodeStyle.setProperty(s, v);
|
|
483
|
+
applied[s] = v;
|
|
484
|
+
}
|
|
199
485
|
}
|
|
200
|
-
for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
|
|
201
486
|
}
|
|
202
487
|
function setStyleProperty(node, name, value) {
|
|
203
488
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
204
489
|
}
|
|
205
|
-
function spread(node, props = {},
|
|
490
|
+
function spread(node, props = {}, skipChildren) {
|
|
206
491
|
const prevProps = {};
|
|
207
|
-
if (!skipChildren)
|
|
208
|
-
effect(() => normalize(props.children, prevProps.children), value => {
|
|
209
|
-
insertExpression(node, value, prevProps.children);
|
|
210
|
-
prevProps.children = value;
|
|
211
|
-
});
|
|
212
|
-
}
|
|
492
|
+
if (!skipChildren) insert(node, () => props.children);
|
|
213
493
|
effect(() => {
|
|
214
494
|
const r = props.ref;
|
|
215
495
|
(typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
|
|
@@ -221,7 +501,7 @@ function spread(node, props = {}, isSVG, skipChildren) {
|
|
|
221
501
|
newProps[prop] = props[prop];
|
|
222
502
|
}
|
|
223
503
|
return newProps;
|
|
224
|
-
}, props => assign(node, props,
|
|
504
|
+
}, props => assign(node, props, true, prevProps, true));
|
|
225
505
|
return prevProps;
|
|
226
506
|
}
|
|
227
507
|
function dynamicProperty(props, key) {
|
|
@@ -241,49 +521,468 @@ function ref(fn, element) {
|
|
|
241
521
|
const resolved = untrack(fn);
|
|
242
522
|
runWithOwner(null, () => applyRef(resolved, element));
|
|
243
523
|
}
|
|
244
|
-
function
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
524
|
+
function scope(fn) {
|
|
525
|
+
fn.$s = true;
|
|
526
|
+
return fn;
|
|
527
|
+
}
|
|
528
|
+
const SCOPE_OPTIONS = {
|
|
529
|
+
scope: true
|
|
530
|
+
};
|
|
531
|
+
let hydrationRt = null;
|
|
532
|
+
function installHydrationRuntime() {
|
|
533
|
+
hydrationRt = {
|
|
534
|
+
claimInitial(parent, multi, initial) {
|
|
535
|
+
if (isHydrating(parent)) {
|
|
536
|
+
if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
|
|
537
|
+
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
253
538
|
}
|
|
254
|
-
initial
|
|
539
|
+
return initial;
|
|
540
|
+
},
|
|
541
|
+
reclaimRegion(current, parent, marker) {
|
|
542
|
+
if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
|
|
543
|
+
const first = Array.isArray(current) ? current[0] : current;
|
|
544
|
+
if (!first || !first.nodeType || first.isConnected) return current;
|
|
545
|
+
let nodes;
|
|
546
|
+
if (marker) {
|
|
547
|
+
nodes = [];
|
|
548
|
+
let node = marker.previousSibling,
|
|
549
|
+
depth = 0;
|
|
550
|
+
while (node) {
|
|
551
|
+
if (node.nodeType === 8) {
|
|
552
|
+
const v = node.nodeValue;
|
|
553
|
+
if (v === "/") depth++;else if (v === "$") {
|
|
554
|
+
if (depth === 0) break;
|
|
555
|
+
depth--;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
nodes.unshift(node);
|
|
559
|
+
node = node.previousSibling;
|
|
560
|
+
}
|
|
561
|
+
} else nodes = [...parent.childNodes];
|
|
562
|
+
return stripTextSeparators(nodes);
|
|
563
|
+
},
|
|
564
|
+
dedupEvent(e) {
|
|
565
|
+
return !!(sharedConfig.registry && sharedConfig.events && sharedConfig.events.find(([el, ev]) => ev === e));
|
|
255
566
|
}
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
function stripTextSeparators(nodes) {
|
|
570
|
+
let j = 0;
|
|
571
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
572
|
+
const node = nodes[i],
|
|
573
|
+
t = node.nodeType;
|
|
574
|
+
if (t === 8) {
|
|
575
|
+
const v = node.nodeValue;
|
|
576
|
+
if (v === "!$") {
|
|
577
|
+
node.remove();
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
if (v.startsWith("pl-")) continue;
|
|
581
|
+
} else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
|
|
582
|
+
nodes[j++] = node;
|
|
256
583
|
}
|
|
584
|
+
nodes.length = j;
|
|
585
|
+
return nodes;
|
|
586
|
+
}
|
|
587
|
+
function insert(parent, accessor, marker, initial, options) {
|
|
588
|
+
const multi = marker !== undefined;
|
|
589
|
+
const host = options && options.host;
|
|
590
|
+
if (multi && !initial) initial = [];
|
|
591
|
+
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
257
592
|
if (typeof accessor !== "function") {
|
|
258
593
|
accessor = normalize(accessor, initial, multi, true);
|
|
259
|
-
if (typeof accessor !== "function")
|
|
594
|
+
if (typeof accessor !== "function") {
|
|
595
|
+
insertExpression(parent, accessor, initial, marker);
|
|
596
|
+
host && tagHost(accessor, host);
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
260
599
|
}
|
|
261
|
-
|
|
262
|
-
if (multi && initial.length === 0 && !isHydrating(parent)) {
|
|
600
|
+
if (multi && initial.length === 0) {
|
|
263
601
|
const placeholder = document.createTextNode("");
|
|
264
602
|
parent.insertBefore(placeholder, marker);
|
|
265
603
|
initial = [placeholder];
|
|
266
604
|
}
|
|
267
|
-
|
|
605
|
+
let current = initial;
|
|
606
|
+
effect(prev => {
|
|
607
|
+
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
608
|
+
const value = normalize(accessor(), current, multi, true);
|
|
609
|
+
if (typeof value !== "function") return value;
|
|
610
|
+
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
611
|
+
insertExpression(parent, inner, current, marker);
|
|
612
|
+
current = inner;
|
|
613
|
+
host && tagHost(current, host);
|
|
614
|
+
}, prev !== undefined && !(options && options.schedule) ? {
|
|
615
|
+
...options,
|
|
616
|
+
schedule: true
|
|
617
|
+
} : options);
|
|
618
|
+
return INNER_OWNED;
|
|
619
|
+
}, value => {
|
|
620
|
+
if (value === INNER_OWNED) return;
|
|
621
|
+
insertExpression(parent, value, current, marker);
|
|
622
|
+
current = value;
|
|
623
|
+
host && tagHost(current, host);
|
|
624
|
+
},
|
|
625
|
+
accessor.$s ? options ? {
|
|
626
|
+
...options,
|
|
627
|
+
scope: true
|
|
628
|
+
} : SCOPE_OPTIONS : options);
|
|
268
629
|
}
|
|
269
|
-
function assign(node, props,
|
|
630
|
+
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
631
|
+
const nodeName = node.nodeName;
|
|
270
632
|
props || (props = {});
|
|
271
633
|
for (const prop in prevProps) {
|
|
272
634
|
if (!(prop in props)) {
|
|
273
635
|
if (prop === "children") continue;
|
|
274
|
-
prevProps[prop] = assignProp(node, prop, null, prevProps[prop],
|
|
636
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
|
|
275
637
|
}
|
|
276
638
|
}
|
|
277
639
|
for (const prop in props) {
|
|
278
640
|
if (prop === "children") {
|
|
279
|
-
if (!skipChildren) insertExpression(node, props.children);
|
|
641
|
+
if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
|
|
280
642
|
continue;
|
|
281
643
|
}
|
|
282
|
-
|
|
283
|
-
prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
|
|
644
|
+
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
|
|
284
645
|
}
|
|
285
646
|
}
|
|
647
|
+
const ASSET_REMOVAL_GRACE = 100;
|
|
648
|
+
const assetRegistry = new Map();
|
|
649
|
+
function assetEntryKey(descriptor) {
|
|
650
|
+
if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
|
|
651
|
+
return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
|
|
652
|
+
}
|
|
653
|
+
function findAssetElement(selector, attr, value) {
|
|
654
|
+
const nodes = document.querySelectorAll(selector);
|
|
655
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
656
|
+
if (nodes[i].getAttribute(attr) === value) return nodes[i];
|
|
657
|
+
}
|
|
658
|
+
return null;
|
|
659
|
+
}
|
|
660
|
+
function mountAssetElement(descriptor) {
|
|
661
|
+
let el;
|
|
662
|
+
if (descriptor.type === "inline-style") {
|
|
663
|
+
el = findAssetElement("style[data-asset]", "data-asset", descriptor.id);
|
|
664
|
+
if (!el) {
|
|
665
|
+
el = document.createElement("style");
|
|
666
|
+
el.setAttribute("data-asset", descriptor.id);
|
|
667
|
+
el.textContent = descriptor.content || "";
|
|
668
|
+
}
|
|
669
|
+
} else {
|
|
670
|
+
const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
|
|
671
|
+
el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
|
|
672
|
+
if (!el) {
|
|
673
|
+
el = document.createElement("link");
|
|
674
|
+
el.rel = rel;
|
|
675
|
+
el.href = descriptor.href;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
if (descriptor.attrs) {
|
|
679
|
+
for (const name in descriptor.attrs) el.setAttribute(name, descriptor.attrs[name]);
|
|
680
|
+
}
|
|
681
|
+
if (!el.isConnected) document.head.appendChild(el);
|
|
682
|
+
return el;
|
|
683
|
+
}
|
|
684
|
+
function acquireAsset(descriptor) {
|
|
685
|
+
const key = assetEntryKey(descriptor);
|
|
686
|
+
let entry = assetRegistry.get(key);
|
|
687
|
+
if (descriptor.policy === "exclusive") {
|
|
688
|
+
if (!entry) {
|
|
689
|
+
entry = {
|
|
690
|
+
original: descriptor.get(),
|
|
691
|
+
set: descriptor.set,
|
|
692
|
+
writers: []
|
|
693
|
+
};
|
|
694
|
+
assetRegistry.set(key, entry);
|
|
695
|
+
}
|
|
696
|
+
const writer = {
|
|
697
|
+
value: descriptor.value
|
|
698
|
+
};
|
|
699
|
+
entry.writers.push(writer);
|
|
700
|
+
entry.set(writer.value);
|
|
701
|
+
let released = false;
|
|
702
|
+
return () => {
|
|
703
|
+
if (released) return;
|
|
704
|
+
released = true;
|
|
705
|
+
const index = entry.writers.indexOf(writer);
|
|
706
|
+
const wasTop = index === entry.writers.length - 1;
|
|
707
|
+
entry.writers.splice(index, 1);
|
|
708
|
+
if (!wasTop) return;
|
|
709
|
+
if (entry.writers.length) {
|
|
710
|
+
entry.set(entry.writers[entry.writers.length - 1].value);
|
|
711
|
+
} else {
|
|
712
|
+
entry.set(entry.original);
|
|
713
|
+
assetRegistry.delete(key);
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
if (!entry) {
|
|
718
|
+
entry = {
|
|
719
|
+
count: 0,
|
|
720
|
+
element: null,
|
|
721
|
+
timer: null
|
|
722
|
+
};
|
|
723
|
+
assetRegistry.set(key, entry);
|
|
724
|
+
}
|
|
725
|
+
if (entry.timer) {
|
|
726
|
+
clearTimeout(entry.timer);
|
|
727
|
+
entry.timer = null;
|
|
728
|
+
}
|
|
729
|
+
entry.count++;
|
|
730
|
+
if (!entry.element || !entry.element.isConnected) entry.element = mountAssetElement(descriptor);
|
|
731
|
+
let released = false;
|
|
732
|
+
return () => {
|
|
733
|
+
if (released) return;
|
|
734
|
+
released = true;
|
|
735
|
+
if (--entry.count > 0) return;
|
|
736
|
+
entry.timer = setTimeout(() => {
|
|
737
|
+
assetRegistry.delete(key);
|
|
738
|
+
entry.element && entry.element.remove();
|
|
739
|
+
}, ASSET_REMOVAL_GRACE);
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
let headRegistrations = null;
|
|
743
|
+
let headSeq = 0;
|
|
744
|
+
let headUid = 0;
|
|
745
|
+
let headOwned = null;
|
|
746
|
+
let headApplied = null;
|
|
747
|
+
let headFallbackTitle = null;
|
|
748
|
+
let headScheduled = false;
|
|
749
|
+
const headMountedResources = new Set();
|
|
750
|
+
function initHeadRegistry() {
|
|
751
|
+
if (headRegistrations) return;
|
|
752
|
+
headRegistrations = [];
|
|
753
|
+
headOwned = new Map();
|
|
754
|
+
headApplied = new Map();
|
|
755
|
+
const t = document.querySelector("title");
|
|
756
|
+
headFallbackTitle = t && !t.hasAttribute("data-dh") ? t.textContent : null;
|
|
757
|
+
if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
|
|
758
|
+
}
|
|
759
|
+
function applyServerHeadOps(ops) {
|
|
760
|
+
for (let i = 0; i < ops.length; i++) {
|
|
761
|
+
const op = ops[i];
|
|
762
|
+
const identity = op[0] === "t" ? "title" : op[1];
|
|
763
|
+
if (headOwned.has(identity)) continue;
|
|
764
|
+
if (op[0] === "t") setHeadTitle(op[1]);else if (op[0] === "r") {
|
|
765
|
+
const els = headMarkedElements(identity);
|
|
766
|
+
for (let j = 0; j < els.length; j++) els[j].remove();
|
|
767
|
+
} else {
|
|
768
|
+
const el = document.createElement(op[2]);
|
|
769
|
+
for (const name in op[3]) el.setAttribute(name, op[3][name]);
|
|
770
|
+
if (op[4] != null) el.textContent = op[4];
|
|
771
|
+
el.setAttribute("data-dh", identity);
|
|
772
|
+
document.head.appendChild(el);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
function headMarkedElements(identity) {
|
|
777
|
+
const nodes = document.head.querySelectorAll("[data-dh]");
|
|
778
|
+
const out = [];
|
|
779
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
780
|
+
if (nodes[i].getAttribute("data-dh") === identity) out.push(nodes[i]);
|
|
781
|
+
}
|
|
782
|
+
return out;
|
|
783
|
+
}
|
|
784
|
+
function setHeadTitle(text) {
|
|
785
|
+
let el = document.querySelector("title");
|
|
786
|
+
if (!el) {
|
|
787
|
+
el = document.createElement("title");
|
|
788
|
+
document.head.appendChild(el);
|
|
789
|
+
}
|
|
790
|
+
el.textContent = text;
|
|
791
|
+
el.setAttribute("data-dh", "title");
|
|
792
|
+
return el;
|
|
793
|
+
}
|
|
794
|
+
function scheduleHeadApply() {
|
|
795
|
+
if (headScheduled) return;
|
|
796
|
+
headScheduled = true;
|
|
797
|
+
queueMicrotask(flushHeadRegistry);
|
|
798
|
+
}
|
|
799
|
+
function flushHeadRegistry() {
|
|
800
|
+
if (sharedConfig.hydrating) {
|
|
801
|
+
setTimeout(flushHeadRegistry, 0);
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
headScheduled = false;
|
|
805
|
+
const winners = resolveHead(headRegistrations);
|
|
806
|
+
for (const [identity, els] of headOwned) {
|
|
807
|
+
if (winners.has(identity)) continue;
|
|
808
|
+
headOwned.delete(identity);
|
|
809
|
+
headApplied.delete(identity);
|
|
810
|
+
if (identity === "title") {
|
|
811
|
+
if (headFallbackTitle != null) setHeadTitle(headFallbackTitle).removeAttribute("data-dh");
|
|
812
|
+
} else {
|
|
813
|
+
for (let i = 0; i < els.length; i++) els[i].remove();
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
for (const [identity, winner] of winners) {
|
|
817
|
+
let sig = "";
|
|
818
|
+
for (let i = 0; i < winner.tags.length; i++) sig += winner.tags[i].tag + JSON.stringify(winner.tags[i].props) + "|";
|
|
819
|
+
if (headApplied.get(identity) === sig) continue;
|
|
820
|
+
headApplied.set(identity, sig);
|
|
821
|
+
if (identity === "base" || identity === "charset") {
|
|
822
|
+
console.warn(`useHead: <${winner.tags[0].tag}> (${identity}) is shell-only and ignored on the client`);
|
|
823
|
+
continue;
|
|
824
|
+
}
|
|
825
|
+
if (identity === "title") {
|
|
826
|
+
const children = winner.tags[0].props.children;
|
|
827
|
+
setHeadTitle(children == null ? "" : String(children));
|
|
828
|
+
headOwned.set(identity, []);
|
|
829
|
+
continue;
|
|
830
|
+
}
|
|
831
|
+
const existing = headMarkedElements(identity);
|
|
832
|
+
const els = [];
|
|
833
|
+
for (let i = 0; i < winner.tags.length; i++) {
|
|
834
|
+
els.push(renderHeadElement(winner.tags[i], identity, existing));
|
|
835
|
+
}
|
|
836
|
+
for (let i = 0; i < existing.length; i++) {
|
|
837
|
+
if (els.indexOf(existing[i]) === -1) existing[i].remove();
|
|
838
|
+
}
|
|
839
|
+
headOwned.set(identity, els);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
function createHeadElement(tag, props) {
|
|
843
|
+
const el = document.createElement(tag);
|
|
844
|
+
for (const name in props) {
|
|
845
|
+
if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
|
|
846
|
+
if (!HEAD_ATTR_NAME.test(name)) {
|
|
847
|
+
console.warn(`useHead: ignoring invalid attribute name "${name}"`);
|
|
848
|
+
continue;
|
|
849
|
+
}
|
|
850
|
+
const v = props[name];
|
|
851
|
+
if (v == null || v === false) continue;
|
|
852
|
+
el.setAttribute(name, v === true ? "" : String(v));
|
|
853
|
+
}
|
|
854
|
+
if (props.children != null) el.textContent = String(props.children);
|
|
855
|
+
return el;
|
|
856
|
+
}
|
|
857
|
+
function renderHeadElement(t, identity, existing) {
|
|
858
|
+
for (let i = 0; i < existing.length; i++) {
|
|
859
|
+
if (headElementMatches(existing[i], t)) return existing.splice(i, 1)[0];
|
|
860
|
+
}
|
|
861
|
+
const el = createHeadElement(t.tag, t.props);
|
|
862
|
+
el.setAttribute("data-dh", identity);
|
|
863
|
+
document.head.appendChild(el);
|
|
864
|
+
return el;
|
|
865
|
+
}
|
|
866
|
+
function headElementMatches(el, t) {
|
|
867
|
+
if (el.tagName.toLowerCase() !== t.tag) return false;
|
|
868
|
+
for (const name in t.props) {
|
|
869
|
+
if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
|
|
870
|
+
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
871
|
+
const v = t.props[name];
|
|
872
|
+
if (v == null || v === false) {
|
|
873
|
+
if (el.hasAttribute(name)) return false;
|
|
874
|
+
} else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
|
|
875
|
+
}
|
|
876
|
+
const children = t.props.children;
|
|
877
|
+
return (children == null ? "" : String(children)) === el.textContent;
|
|
878
|
+
}
|
|
879
|
+
function acquireHeadResource(tag, props) {
|
|
880
|
+
if (tag === "link" && (props.rel === "stylesheet" || props.rel === "modulepreload")) {
|
|
881
|
+
const descriptor = {
|
|
882
|
+
type: props.rel === "stylesheet" ? "style" : "module",
|
|
883
|
+
href: props.href
|
|
884
|
+
};
|
|
885
|
+
let attrs = null;
|
|
886
|
+
for (const name in props) {
|
|
887
|
+
if (name === "rel" || name === "href") continue;
|
|
888
|
+
if (!HEAD_ATTR_NAME.test(name)) continue;
|
|
889
|
+
const v = props[name];
|
|
890
|
+
if (v == null || v === false) continue;
|
|
891
|
+
(attrs || (attrs = {}))[name] = v === true ? "" : String(v);
|
|
892
|
+
}
|
|
893
|
+
if (attrs) descriptor.attrs = attrs;
|
|
894
|
+
return acquireAsset(descriptor);
|
|
895
|
+
}
|
|
896
|
+
const identity = resourceIdentity(tag, props);
|
|
897
|
+
if (headMountedResources.has(identity)) return noopFn;
|
|
898
|
+
headMountedResources.add(identity);
|
|
899
|
+
const url = props.href || props.src;
|
|
900
|
+
let el = null;
|
|
901
|
+
if (url != null) {
|
|
902
|
+
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);
|
|
903
|
+
}
|
|
904
|
+
if (!el) document.head.appendChild(createHeadElement(tag, props));
|
|
905
|
+
return noopFn;
|
|
906
|
+
}
|
|
907
|
+
function noopFn() {}
|
|
908
|
+
function useHead(tags) {
|
|
909
|
+
initHeadRegistry();
|
|
910
|
+
const reg = {
|
|
911
|
+
seq: -1,
|
|
912
|
+
tags: null
|
|
913
|
+
};
|
|
914
|
+
const uid = ++headUid;
|
|
915
|
+
effect(() => {
|
|
916
|
+
let list = typeof tags === "function" ? tags() : tags;
|
|
917
|
+
if (!Array.isArray(list)) list = [list];
|
|
918
|
+
const replaceable = [];
|
|
919
|
+
const resources = [];
|
|
920
|
+
for (let i = 0; i < list.length; i++) {
|
|
921
|
+
const desc = list[i];
|
|
922
|
+
if (!desc || !HEAD_ELIGIBLE_TAGS.has(desc.tag)) {
|
|
923
|
+
console.warn(`useHead: ignoring non-head tag`, desc);
|
|
924
|
+
continue;
|
|
925
|
+
}
|
|
926
|
+
const cls = classifyHeadTag(desc);
|
|
927
|
+
const props = evalHeadProps(desc.props || {}, cls.rel !== undefined ? {
|
|
928
|
+
rel: cls.rel
|
|
929
|
+
} : undefined);
|
|
930
|
+
if (cls.resource) {
|
|
931
|
+
resources.push({
|
|
932
|
+
tag: desc.tag,
|
|
933
|
+
props
|
|
934
|
+
});
|
|
935
|
+
} else {
|
|
936
|
+
const key = evalHeadValue(desc.key);
|
|
937
|
+
replaceable.push({
|
|
938
|
+
tag: desc.tag,
|
|
939
|
+
props,
|
|
940
|
+
identity: replaceableIdentity(desc.tag, props, key, "u:c" + uid + ":" + i)
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
return {
|
|
945
|
+
replaceable,
|
|
946
|
+
resources
|
|
947
|
+
};
|
|
948
|
+
}, evaluated => {
|
|
949
|
+
const releases = [];
|
|
950
|
+
for (let i = 0; i < evaluated.resources.length; i++) {
|
|
951
|
+
releases.push(acquireHeadResource(evaluated.resources[i].tag, evaluated.resources[i].props));
|
|
952
|
+
}
|
|
953
|
+
reg.tags = evaluated.replaceable;
|
|
954
|
+
if (reg.seq < 0) reg.seq = ++headSeq;
|
|
955
|
+
if (headRegistrations.indexOf(reg) === -1) headRegistrations.push(reg);
|
|
956
|
+
scheduleHeadApply();
|
|
957
|
+
return () => {
|
|
958
|
+
const idx = headRegistrations.indexOf(reg);
|
|
959
|
+
if (idx > -1) headRegistrations.splice(idx, 1);
|
|
960
|
+
for (let i = 0; i < releases.length; i++) releases[i]();
|
|
961
|
+
scheduleHeadApply();
|
|
962
|
+
};
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
function loadModuleAssets(mapping) {
|
|
966
|
+
const hy = globalThis._$HY;
|
|
967
|
+
if (!hy) return;
|
|
968
|
+
const pending = [];
|
|
969
|
+
for (const key in mapping) {
|
|
970
|
+
if (hy.modules[key]) continue;
|
|
971
|
+
const entryUrl = mapping[key];
|
|
972
|
+
if (!hy.loading[key]) {
|
|
973
|
+
hy.loading[key] = import(entryUrl).then(mod => {
|
|
974
|
+
hy.modules[key] = mod;
|
|
975
|
+
}, err => {
|
|
976
|
+
delete hy.loading[key];
|
|
977
|
+
throw err;
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
pending.push(hy.loading[key]);
|
|
981
|
+
}
|
|
982
|
+
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
983
|
+
}
|
|
286
984
|
function hydrate$1(code, element, options = {}) {
|
|
985
|
+
installHydrationRuntime();
|
|
287
986
|
if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
|
|
288
987
|
options.renderId ||= "";
|
|
289
988
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
@@ -293,6 +992,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
293
992
|
sharedConfig.load = id => globalThis._$HY.r[id];
|
|
294
993
|
sharedConfig.has = id => id in globalThis._$HY.r;
|
|
295
994
|
sharedConfig.gather = root => gatherHydratable(element, root);
|
|
995
|
+
sharedConfig.loadModuleAssets = loadModuleAssets;
|
|
296
996
|
sharedConfig.cleanupFragment = id => {
|
|
297
997
|
const tpl = document.getElementById("pl-" + id);
|
|
298
998
|
if (tpl) {
|
|
@@ -310,15 +1010,45 @@ function hydrate$1(code, element, options = {}) {
|
|
|
310
1010
|
}
|
|
311
1011
|
};
|
|
312
1012
|
sharedConfig.registry = new Map();
|
|
1013
|
+
if (!sharedConfig.boundaryScopes) sharedConfig.boundaryScopes = new Map();
|
|
1014
|
+
sharedConfig.captureBoundaryScope = id => {
|
|
1015
|
+
if (sharedConfig.registry) sharedConfig.boundaryScopes.set(id, {
|
|
1016
|
+
registry: sharedConfig.registry,
|
|
1017
|
+
gather: sharedConfig.gather
|
|
1018
|
+
});
|
|
1019
|
+
};
|
|
313
1020
|
sharedConfig.hydrating = true;
|
|
314
1021
|
{
|
|
315
1022
|
sharedConfig.verifyHydration = () => {
|
|
316
1023
|
if (sharedConfig.registry && sharedConfig.registry.size) {
|
|
317
|
-
const orphaned = [...sharedConfig.registry.values()];
|
|
1024
|
+
const orphaned = [...sharedConfig.registry.values()].filter(node => node.isConnected);
|
|
1025
|
+
sharedConfig.registry.clear();
|
|
1026
|
+
if (!orphaned.length) return;
|
|
318
1027
|
console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
|
|
319
1028
|
}
|
|
320
1029
|
};
|
|
321
1030
|
}
|
|
1031
|
+
const rootMapping = globalThis._$HY.r && globalThis._$HY.r["_assets"];
|
|
1032
|
+
if (rootMapping && typeof rootMapping === "object") {
|
|
1033
|
+
const p = loadModuleAssets(rootMapping);
|
|
1034
|
+
if (p) {
|
|
1035
|
+
gatherHydratable(element, options.renderId);
|
|
1036
|
+
let disposer;
|
|
1037
|
+
p.then(() => {
|
|
1038
|
+
try {
|
|
1039
|
+
disposer = render$1(code, element, [...element.childNodes], options);
|
|
1040
|
+
} finally {
|
|
1041
|
+
sharedConfig.hydrating = false;
|
|
1042
|
+
}
|
|
1043
|
+
}, err => {
|
|
1044
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1045
|
+
sharedConfig.hydrating = false;
|
|
1046
|
+
sharedConfig.registry = undefined;
|
|
1047
|
+
disposer = render$1(code, element, [...element.childNodes], options);
|
|
1048
|
+
});
|
|
1049
|
+
return () => disposer && disposer();
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
322
1052
|
try {
|
|
323
1053
|
gatherHydratable(element, options.renderId);
|
|
324
1054
|
return render$1(code, element, [...element.childNodes], options);
|
|
@@ -380,20 +1110,21 @@ function getFirstChild(node, expectedTag) {
|
|
|
380
1110
|
function getNextSibling(node, expectedTag) {
|
|
381
1111
|
const sibling = node.nextSibling;
|
|
382
1112
|
if (isHydrating() && expectedTag && sibling?.localName !== expectedTag) {
|
|
383
|
-
const parent = node.
|
|
1113
|
+
const parent = node.parentNode;
|
|
384
1114
|
const isMissing = !sibling || sibling.nodeType !== 1;
|
|
385
1115
|
console.warn("Hydration structure mismatch: expected <" + expectedTag + "> after", node, "in", parent, "\n " + describeSiblings(parent, sibling, expectedTag, isMissing));
|
|
386
1116
|
}
|
|
387
1117
|
return sibling;
|
|
388
1118
|
}
|
|
389
1119
|
function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
|
|
1120
|
+
if (!parent) return `<${expectedTag} \u2190 parent unavailable>`;
|
|
390
1121
|
const children = [];
|
|
391
1122
|
let child = parent.firstChild;
|
|
392
1123
|
while (child) {
|
|
393
1124
|
if (child.nodeType === 1) children.push(child);
|
|
394
1125
|
child = child.nextSibling;
|
|
395
1126
|
}
|
|
396
|
-
const pTag = parent.localName;
|
|
1127
|
+
const pTag = parent.localName || "#fragment";
|
|
397
1128
|
if (isMissing) {
|
|
398
1129
|
const tags = children.map(c => `<${c.localName}>`).join("");
|
|
399
1130
|
return `<${pTag}>${tags}<${expectedTag} \u2190 missing></${pTag}>`;
|
|
@@ -425,7 +1156,32 @@ function runHydrationEvents() {
|
|
|
425
1156
|
const [el, e] = events[0];
|
|
426
1157
|
if (!completed.has(el)) return;
|
|
427
1158
|
events.shift();
|
|
428
|
-
|
|
1159
|
+
let matchContainer, matchState, matchDistance, matches;
|
|
1160
|
+
for (const [container, state] of delegatedContainers) {
|
|
1161
|
+
if (!state.handlers.has(e.type)) continue;
|
|
1162
|
+
const entry = findOwner(e.target, state);
|
|
1163
|
+
if (!entry) continue;
|
|
1164
|
+
if (matchContainer) {
|
|
1165
|
+
if (!matches) matches = [{
|
|
1166
|
+
container: matchContainer,
|
|
1167
|
+
state: matchState,
|
|
1168
|
+
distance: matchDistance
|
|
1169
|
+
}];
|
|
1170
|
+
matches.push({
|
|
1171
|
+
container,
|
|
1172
|
+
state,
|
|
1173
|
+
distance: entry.distance
|
|
1174
|
+
});
|
|
1175
|
+
} else {
|
|
1176
|
+
matchContainer = container;
|
|
1177
|
+
matchState = state;
|
|
1178
|
+
matchDistance = entry.distance;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
if (matches) {
|
|
1182
|
+
matches.sort((a, b) => a.distance - b.distance);
|
|
1183
|
+
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
1184
|
+
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
429
1185
|
}
|
|
430
1186
|
if (sharedConfig.done) {
|
|
431
1187
|
sharedConfig.events = _$HY.events = null;
|
|
@@ -436,16 +1192,31 @@ function runHydrationEvents() {
|
|
|
436
1192
|
}
|
|
437
1193
|
}
|
|
438
1194
|
function isHydrating(node) {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
1195
|
+
if (!sharedConfig.hydrating) return false;
|
|
1196
|
+
if (!node || node.isConnected) return true;
|
|
1197
|
+
const roots = sharedConfig.claimRoots;
|
|
1198
|
+
if (roots) {
|
|
1199
|
+
for (let i = 0; i < roots.length; i++) {
|
|
1200
|
+
if (roots[i].contains(node)) return true;
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
return false;
|
|
444
1204
|
}
|
|
445
1205
|
function classListToObject(classList) {
|
|
446
1206
|
if (Array.isArray(classList)) {
|
|
447
1207
|
const result = {};
|
|
448
1208
|
flattenClassList(classList, result);
|
|
1209
|
+
classList = result;
|
|
1210
|
+
}
|
|
1211
|
+
if (classList && typeof classList === "object") {
|
|
1212
|
+
const result = {},
|
|
1213
|
+
keys = Object.keys(classList);
|
|
1214
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
1215
|
+
const key = keys[i];
|
|
1216
|
+
if (!classList[key]) continue;
|
|
1217
|
+
const classNames = key.trim().split(/\s+/);
|
|
1218
|
+
for (let j = 0, nameLen = classNames.length; j < nameLen; j++) classNames[j] && (result[classNames[j]] = true);
|
|
1219
|
+
}
|
|
449
1220
|
return result;
|
|
450
1221
|
}
|
|
451
1222
|
return classList;
|
|
@@ -456,18 +1227,16 @@ function flattenClassList(list, result) {
|
|
|
456
1227
|
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;
|
|
457
1228
|
}
|
|
458
1229
|
}
|
|
459
|
-
function assignProp(node, prop, value, prev,
|
|
460
|
-
let forceProp;
|
|
1230
|
+
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
461
1231
|
if (prop === "style") return style(node, value, prev), value;
|
|
462
|
-
if (prop === "class") return className(node, value,
|
|
463
|
-
if (value === prev) return prev;
|
|
1232
|
+
if (prop === "class") return className(node, value, prev), value;
|
|
1233
|
+
if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
|
|
464
1234
|
if (prop === "ref") {
|
|
465
1235
|
if (!skipRef && value) ref(() => value, node);
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
} else if (prop.slice(0, 2) === "on") {
|
|
1236
|
+
return value;
|
|
1237
|
+
}
|
|
1238
|
+
const hasNamespace = prop.indexOf(":") > -1;
|
|
1239
|
+
if (!hasNamespace && prop.slice(0, 2) === "on") {
|
|
471
1240
|
const name = prop.slice(2).toLowerCase();
|
|
472
1241
|
const delegate = DelegatedEvents.has(name);
|
|
473
1242
|
if (!delegate && prev) {
|
|
@@ -475,26 +1244,34 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
475
1244
|
node.removeEventListener(name, h);
|
|
476
1245
|
}
|
|
477
1246
|
if (delegate || value) {
|
|
478
|
-
|
|
1247
|
+
addEvent(node, name, value, delegate);
|
|
479
1248
|
delegate && delegateEvents([name]);
|
|
480
1249
|
}
|
|
481
|
-
} else if (
|
|
482
|
-
if (
|
|
483
|
-
if (prop === "value" &&
|
|
1250
|
+
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1251
|
+
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
1252
|
+
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
|
|
1253
|
+
node[prop] = value ?? "";else node[prop] = value;
|
|
484
1254
|
} else {
|
|
485
|
-
const ns =
|
|
1255
|
+
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
486
1256
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
487
1257
|
}
|
|
488
1258
|
return value;
|
|
489
1259
|
}
|
|
490
|
-
function eventHandler(e) {
|
|
491
|
-
if (
|
|
492
|
-
|
|
1260
|
+
function eventHandler(e, container, state) {
|
|
1261
|
+
if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
|
|
1262
|
+
const prev = e[$$EVENT_OWNER];
|
|
1263
|
+
let resumeNode;
|
|
1264
|
+
if (prev) {
|
|
1265
|
+
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
1266
|
+
resumeNode = prev;
|
|
493
1267
|
}
|
|
494
|
-
|
|
1268
|
+
const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
|
|
1269
|
+
if (state && !owner) return;
|
|
1270
|
+
e[$$EVENT_OWNER] = owner || true;
|
|
1271
|
+
let node = resumeNode || e.target;
|
|
495
1272
|
const key = `$$${e.type}`;
|
|
496
1273
|
const oriTarget = e.target;
|
|
497
|
-
const
|
|
1274
|
+
const boundary = owner || container || e.currentTarget;
|
|
498
1275
|
const retarget = value => Object.defineProperty(e, "target", {
|
|
499
1276
|
configurable: true,
|
|
500
1277
|
value
|
|
@@ -510,35 +1287,43 @@ function eventHandler(e) {
|
|
|
510
1287
|
return true;
|
|
511
1288
|
};
|
|
512
1289
|
const walkUpTree = () => {
|
|
513
|
-
while (handleNode()
|
|
1290
|
+
while (handleNode()) {
|
|
1291
|
+
if (node === boundary || node.parentNode === boundary) break;
|
|
1292
|
+
node = node._$host || node.parentNode || node.host;
|
|
1293
|
+
}
|
|
514
1294
|
};
|
|
515
1295
|
Object.defineProperty(e, "currentTarget", {
|
|
516
1296
|
configurable: true,
|
|
517
1297
|
get() {
|
|
518
|
-
return node || document;
|
|
1298
|
+
return node || boundary || document;
|
|
519
1299
|
}
|
|
520
1300
|
});
|
|
521
|
-
if (
|
|
1301
|
+
if (resumeNode) {
|
|
1302
|
+
if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
|
|
1303
|
+
if (node && node !== boundary) walkUpTree();
|
|
1304
|
+
} else if (e.composedPath) {
|
|
522
1305
|
const path = e.composedPath();
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
1306
|
+
if (path.length) {
|
|
1307
|
+
retarget(path[0]);
|
|
1308
|
+
for (let i = 0; i < path.length; i++) {
|
|
1309
|
+
node = path[i];
|
|
1310
|
+
if (!handleNode()) break;
|
|
1311
|
+
if (node._$host) {
|
|
1312
|
+
node = node._$host;
|
|
1313
|
+
walkUpTree();
|
|
1314
|
+
break;
|
|
1315
|
+
}
|
|
1316
|
+
if (node === boundary || node.parentNode === boundary) {
|
|
1317
|
+
break;
|
|
1318
|
+
}
|
|
534
1319
|
}
|
|
535
|
-
}
|
|
1320
|
+
} else walkUpTree();
|
|
536
1321
|
}
|
|
537
1322
|
else walkUpTree();
|
|
538
1323
|
retarget(oriTarget);
|
|
539
1324
|
}
|
|
540
1325
|
function insertExpression(parent, value, current, marker) {
|
|
541
|
-
if (isHydrating(parent)) return;
|
|
1326
|
+
if (hydrationRt !== null && isHydrating(parent)) return;
|
|
542
1327
|
if (value === current) return;
|
|
543
1328
|
const t = typeof value,
|
|
544
1329
|
multi = marker !== undefined;
|
|
@@ -546,15 +1331,25 @@ function insertExpression(parent, value, current, marker) {
|
|
|
546
1331
|
const tc = typeof current;
|
|
547
1332
|
if (tc === "string" || tc === "number") {
|
|
548
1333
|
parent.firstChild.data = value;
|
|
549
|
-
} else
|
|
1334
|
+
} else {
|
|
1335
|
+
if (ownsAllChildren(parent, current)) parent.textContent = value;else {
|
|
1336
|
+
removeOwnedChildren(parent, current);
|
|
1337
|
+
parent.insertBefore(document.createTextNode(value), parent.firstChild);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
550
1340
|
} else if (value === undefined) {
|
|
551
1341
|
cleanChildren(parent, current, marker);
|
|
552
1342
|
} else if (value.nodeType) {
|
|
553
1343
|
if (Array.isArray(current)) {
|
|
554
1344
|
cleanChildren(parent, current, multi ? marker : null, value);
|
|
555
|
-
} else if (current
|
|
1345
|
+
} else if (current && current.nodeType) {
|
|
1346
|
+
current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
|
|
1347
|
+
} else if (current && parent.firstChild) {
|
|
1348
|
+
parent.replaceChild(value, parent.firstChild);
|
|
1349
|
+
} else {
|
|
556
1350
|
parent.appendChild(value);
|
|
557
|
-
}
|
|
1351
|
+
}
|
|
1352
|
+
if (marker) value[$$SLOT] = marker;
|
|
558
1353
|
} else if (Array.isArray(value)) {
|
|
559
1354
|
const currentArray = current && Array.isArray(current);
|
|
560
1355
|
if (value.length === 0) {
|
|
@@ -562,9 +1357,9 @@ function insertExpression(parent, value, current, marker) {
|
|
|
562
1357
|
} else if (currentArray) {
|
|
563
1358
|
if (current.length === 0) {
|
|
564
1359
|
appendNodes(parent, value, marker);
|
|
565
|
-
} else reconcileArrays(parent, current, value);
|
|
1360
|
+
} else reconcileArrays(parent, current, value, marker);
|
|
566
1361
|
} else {
|
|
567
|
-
current && cleanChildren(parent);
|
|
1362
|
+
current && cleanChildren(parent, current);
|
|
568
1363
|
appendNodes(parent, value);
|
|
569
1364
|
}
|
|
570
1365
|
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
@@ -586,21 +1381,64 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
586
1381
|
}
|
|
587
1382
|
return value;
|
|
588
1383
|
}
|
|
1384
|
+
function tagHost(value, host) {
|
|
1385
|
+
if (Array.isArray(value)) {
|
|
1386
|
+
for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
|
|
1387
|
+
} else if (value && value.nodeType && value[$$HOST] !== host) {
|
|
1388
|
+
value[$$HOST] = host;
|
|
1389
|
+
Object.defineProperty(value, "_$host", {
|
|
1390
|
+
get: host,
|
|
1391
|
+
configurable: true
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
589
1395
|
function appendNodes(parent, array, marker = null) {
|
|
590
|
-
for (let i = 0, len = array.length; i < len; i++)
|
|
1396
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
1397
|
+
const n = array[i];
|
|
1398
|
+
parent.insertBefore(n, marker);
|
|
1399
|
+
if (marker) n[$$SLOT] = marker;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
function ownsAllChildren(parent, current) {
|
|
1403
|
+
if (current == null) return true;
|
|
1404
|
+
if (Array.isArray(current)) {
|
|
1405
|
+
return current.length ? parent.firstChild === current[0] && parent.lastChild === current[current.length - 1] : parent.firstChild === null;
|
|
1406
|
+
}
|
|
1407
|
+
if (current === "") return parent.firstChild === null;
|
|
1408
|
+
if (current.nodeType) return parent.firstChild === current && parent.lastChild === current;
|
|
1409
|
+
const first = parent.firstChild;
|
|
1410
|
+
return first !== null && first.nodeType === 3 && parent.lastChild === first;
|
|
1411
|
+
}
|
|
1412
|
+
function removeOwnedChildren(parent, current) {
|
|
1413
|
+
if (Array.isArray(current)) {
|
|
1414
|
+
for (let i = 0; i < current.length; i++) {
|
|
1415
|
+
const el = current[i];
|
|
1416
|
+
if (el.parentNode === parent) el.remove();
|
|
1417
|
+
}
|
|
1418
|
+
} else if (current.nodeType) {
|
|
1419
|
+
if (current.parentNode === parent) current.remove();
|
|
1420
|
+
} else {
|
|
1421
|
+
const first = parent.firstChild;
|
|
1422
|
+
if (first && first.nodeType === 3) first.remove();
|
|
1423
|
+
}
|
|
591
1424
|
}
|
|
592
1425
|
function cleanChildren(parent, current, marker, replacement) {
|
|
593
|
-
if (marker === undefined)
|
|
1426
|
+
if (marker === undefined) {
|
|
1427
|
+
if (ownsAllChildren(parent, current)) return parent.textContent = "";
|
|
1428
|
+
return removeOwnedChildren(parent, current);
|
|
1429
|
+
}
|
|
594
1430
|
if (current.length) {
|
|
595
1431
|
let inserted = false;
|
|
596
1432
|
for (let i = current.length - 1; i >= 0; i--) {
|
|
597
1433
|
const el = current[i];
|
|
598
1434
|
if (replacement !== el) {
|
|
599
|
-
const
|
|
600
|
-
|
|
1435
|
+
const tag = el[$$SLOT];
|
|
1436
|
+
const owns = el.parentNode === parent && (!tag || tag === marker);
|
|
1437
|
+
if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
|
|
601
1438
|
} else inserted = true;
|
|
602
1439
|
}
|
|
603
1440
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
1441
|
+
if (replacement && marker) replacement[$$SLOT] = marker;
|
|
604
1442
|
}
|
|
605
1443
|
function gatherHydratable(element, root) {
|
|
606
1444
|
const templates = element.querySelectorAll(`*[_hk]`);
|
|
@@ -638,82 +1476,233 @@ function ssrHydrationKey() {}
|
|
|
638
1476
|
function resolveSSRNode(node) {}
|
|
639
1477
|
function escape(html) {}
|
|
640
1478
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
1479
|
+
const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
|
|
1480
|
+
class ResponseEnvelope {
|
|
1481
|
+
constructor(response, value) {
|
|
1482
|
+
this.response = response;
|
|
1483
|
+
this.value = value;
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
1487
|
+
function isResponseEnvelope(value) {
|
|
1488
|
+
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1489
|
+
}
|
|
1490
|
+
const HREF = Symbol.for("solid.Href");
|
|
1491
|
+
function isHref(value) {
|
|
1492
|
+
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1493
|
+
}
|
|
1494
|
+
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1495
|
+
function initWithRevalidate(init) {
|
|
1496
|
+
const {
|
|
1497
|
+
revalidate,
|
|
1498
|
+
...responseInit
|
|
1499
|
+
} = init;
|
|
1500
|
+
const headers = new Headers(responseInit.headers);
|
|
1501
|
+
revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
|
|
1502
|
+
return {
|
|
1503
|
+
responseInit,
|
|
1504
|
+
headers
|
|
1505
|
+
};
|
|
646
1506
|
}
|
|
1507
|
+
function redirect(url, init = 302) {
|
|
1508
|
+
if (typeof url !== "string" && !isHref(url)) {
|
|
1509
|
+
throw new TypeError("redirect() expects a string URL or an Href-branded value (Symbol.for('solid.Href')).");
|
|
1510
|
+
}
|
|
1511
|
+
const {
|
|
1512
|
+
responseInit,
|
|
1513
|
+
headers
|
|
1514
|
+
} = initWithRevalidate(typeof init === "number" ? {
|
|
1515
|
+
status: init
|
|
1516
|
+
} : init);
|
|
1517
|
+
if (responseInit.status === undefined) {
|
|
1518
|
+
responseInit.status = 302;
|
|
1519
|
+
}
|
|
1520
|
+
headers.set("Location", String(url));
|
|
1521
|
+
return new Response(null, {
|
|
1522
|
+
...responseInit,
|
|
1523
|
+
headers
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
function reload(init = {}) {
|
|
1527
|
+
const {
|
|
1528
|
+
responseInit,
|
|
1529
|
+
headers
|
|
1530
|
+
} = initWithRevalidate(init);
|
|
1531
|
+
return new Response(null, {
|
|
1532
|
+
...responseInit,
|
|
1533
|
+
headers
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
function respond(value, init = {}) {
|
|
1537
|
+
const {
|
|
1538
|
+
responseInit,
|
|
1539
|
+
headers
|
|
1540
|
+
} = initWithRevalidate(init);
|
|
1541
|
+
headers.set("Content-Type", "application/json");
|
|
1542
|
+
return new ResponseEnvelope(new Response(JSON.stringify(value), {
|
|
1543
|
+
...responseInit,
|
|
1544
|
+
headers
|
|
1545
|
+
}), value);
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
const mergeProps = merge;
|
|
647
1549
|
const isServer = false;
|
|
648
1550
|
const isDev = true;
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
1551
|
+
function render(code, element, init, options = {}) {
|
|
1552
|
+
enforceLoadingBoundary(true);
|
|
1553
|
+
try {
|
|
1554
|
+
const dispose = render$1(code, element, init, {
|
|
1555
|
+
...options,
|
|
1556
|
+
insertOptions: {
|
|
1557
|
+
schedule: true
|
|
1558
|
+
}
|
|
1559
|
+
});
|
|
1560
|
+
flush();
|
|
1561
|
+
return dispose;
|
|
1562
|
+
} finally {
|
|
1563
|
+
enforceLoadingBoundary(false);
|
|
1564
|
+
}
|
|
654
1565
|
}
|
|
655
1566
|
const hydrate = (...args) => {
|
|
656
1567
|
enableHydration();
|
|
657
1568
|
return hydrate$1(...args);
|
|
658
1569
|
};
|
|
659
1570
|
function Portal(props) {
|
|
1571
|
+
return runWithOwner(createOwner(), () => portalImpl(props));
|
|
1572
|
+
}
|
|
1573
|
+
function portalImpl(props) {
|
|
660
1574
|
const treeMarker = document.createTextNode(""),
|
|
661
1575
|
startMarker = document.createTextNode(""),
|
|
662
1576
|
endMarker = document.createTextNode(""),
|
|
663
|
-
mount = () =>
|
|
664
|
-
|
|
665
|
-
|
|
1577
|
+
mount = () => props.mount || document.body,
|
|
1578
|
+
content = createMemo(() => [startMarker, props.children], {
|
|
1579
|
+
ssrSource: "client"
|
|
1580
|
+
});
|
|
1581
|
+
createRenderEffect(
|
|
1582
|
+
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
1583
|
+
const m = untrack(mount);
|
|
666
1584
|
m.appendChild(endMarker);
|
|
667
|
-
|
|
1585
|
+
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
1586
|
+
insert(m, c, endMarker, undefined, {
|
|
1587
|
+
host: () => treeMarker.parentNode
|
|
1588
|
+
});
|
|
1589
|
+
return d;
|
|
1590
|
+
}));
|
|
668
1591
|
return () => {
|
|
1592
|
+
dispose();
|
|
669
1593
|
let c = startMarker;
|
|
670
|
-
while (c
|
|
1594
|
+
while (c) {
|
|
671
1595
|
const n = c.nextSibling;
|
|
672
1596
|
m.removeChild(c);
|
|
1597
|
+
if (c === endMarker) break;
|
|
673
1598
|
c = n;
|
|
674
1599
|
}
|
|
675
1600
|
};
|
|
1601
|
+
},
|
|
1602
|
+
{
|
|
1603
|
+
schedule: true,
|
|
1604
|
+
ssrSource: "client"
|
|
1605
|
+
});
|
|
1606
|
+
createEffect(mount, () => {
|
|
1607
|
+
const m = untrack(mount);
|
|
1608
|
+
const ownerRoot = getDelegatedRoot(treeMarker);
|
|
1609
|
+
if (!ownerRoot || ownerRoot.contains(m)) return;
|
|
1610
|
+
registerDelegatedContainer(m, ownerRoot);
|
|
1611
|
+
return () => unregisterDelegatedContainer(m, ownerRoot);
|
|
1612
|
+
}, {
|
|
1613
|
+
ssrSource: "client"
|
|
1614
|
+
});
|
|
1615
|
+
if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
|
|
1616
|
+
ssrSource: "client"
|
|
676
1617
|
});
|
|
677
1618
|
return treeMarker;
|
|
678
1619
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
if (prop === "appendChild" || prop === "insertBefore") {
|
|
683
|
-
return (...args) => {
|
|
684
|
-
Object.defineProperty(args[0], "_$host", {
|
|
685
|
-
get: () => marker.parentNode,
|
|
686
|
-
configurable: true
|
|
687
|
-
});
|
|
688
|
-
target[prop](...args);
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
const value = Reflect.get(target, prop);
|
|
692
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
693
|
-
}
|
|
694
|
-
});
|
|
1620
|
+
const COMPONENT_BINDING = Symbol.for("dom-expressions.component-binding");
|
|
1621
|
+
function bindingOf(value) {
|
|
1622
|
+
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
695
1623
|
}
|
|
696
|
-
function
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
case "string":
|
|
707
|
-
const isSvg = SVGElements.has(component);
|
|
708
|
-
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, untrack(() => props.is));
|
|
709
|
-
spread(el, props, isSvg);
|
|
710
|
-
return el;
|
|
1624
|
+
function dynamic(source) {
|
|
1625
|
+
let latest = 0;
|
|
1626
|
+
const sites = new Set();
|
|
1627
|
+
const resolveBinding = (next, prev) => {
|
|
1628
|
+
const binding = bindingOf(next);
|
|
1629
|
+
if (!binding) return next;
|
|
1630
|
+
const prevBinding = bindingOf(prev);
|
|
1631
|
+
if (prevBinding && prevBinding.component === binding.component) {
|
|
1632
|
+
for (const deliver of sites) deliver(binding.address);
|
|
1633
|
+
return prev;
|
|
711
1634
|
}
|
|
1635
|
+
return next;
|
|
1636
|
+
};
|
|
1637
|
+
const cached = createMemo(prev => {
|
|
1638
|
+
const next = source();
|
|
1639
|
+
if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
|
|
1640
|
+
const token = ++latest;
|
|
1641
|
+
return {
|
|
1642
|
+
then: (onFulfilled, onRejected) => next.then(resolved => onFulfilled(token === latest ? resolveBinding(resolved, prev) : resolved), onRejected)
|
|
1643
|
+
};
|
|
1644
|
+
}, {
|
|
1645
|
+
lazy: true
|
|
712
1646
|
});
|
|
1647
|
+
return props => {
|
|
1648
|
+
return createMemo(() => {
|
|
1649
|
+
const component = cached();
|
|
1650
|
+
switch (typeof component) {
|
|
1651
|
+
case "function":
|
|
1652
|
+
{
|
|
1653
|
+
Object.assign(component, {
|
|
1654
|
+
[$DEVCOMP]: true
|
|
1655
|
+
});
|
|
1656
|
+
const binding = bindingOf(component);
|
|
1657
|
+
if (binding) {
|
|
1658
|
+
const [address, setAddress] = createSignal(binding.address);
|
|
1659
|
+
sites.add(setAddress);
|
|
1660
|
+
onCleanup(() => sites.delete(setAddress));
|
|
1661
|
+
return untrack(() => binding.component(props, address));
|
|
1662
|
+
}
|
|
1663
|
+
return untrack(() => component(props));
|
|
1664
|
+
}
|
|
1665
|
+
case "string":
|
|
1666
|
+
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
|
|
1667
|
+
spread(el, props);
|
|
1668
|
+
return el;
|
|
1669
|
+
}
|
|
1670
|
+
});
|
|
1671
|
+
};
|
|
713
1672
|
}
|
|
714
1673
|
function Dynamic(props) {
|
|
715
|
-
const
|
|
716
|
-
return
|
|
1674
|
+
const Comp = dynamic(() => props.component);
|
|
1675
|
+
return createComponent(Comp, omit(props, "component"));
|
|
1676
|
+
}
|
|
1677
|
+
function createElement(tagName, is = undefined) {
|
|
1678
|
+
return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
1679
|
+
is
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1682
|
+
function loadClientOnly(fn, setComp) {
|
|
1683
|
+
fn().then(m => setComp(() => m.default));
|
|
1684
|
+
}
|
|
1685
|
+
function clientOnly(fn, options = {},
|
|
1686
|
+
_moduleUrl) {
|
|
1687
|
+
const [comp, setComp] = createSignal();
|
|
1688
|
+
let started = !options.lazy;
|
|
1689
|
+
started && loadClientOnly(fn, setComp);
|
|
1690
|
+
return props => {
|
|
1691
|
+
let Comp;
|
|
1692
|
+
let m;
|
|
1693
|
+
const rest = omit(props, "fallback");
|
|
1694
|
+
if (!started) {
|
|
1695
|
+
started = true;
|
|
1696
|
+
loadClientOnly(fn, setComp);
|
|
1697
|
+
}
|
|
1698
|
+
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
1699
|
+
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
|
1700
|
+
const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1701
|
+
sharedConfig.onHydrationEnd(() => setMounted(true));
|
|
1702
|
+
return gate;
|
|
1703
|
+
};
|
|
717
1704
|
}
|
|
1705
|
+
function httpStatus(_code, _text) {}
|
|
1706
|
+
function httpHeader(_name, _value, _options) {}
|
|
718
1707
|
|
|
719
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, voidFn as HydrationScript, Portal,
|
|
1708
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clientOnly, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets, useHead };
|