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