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