@solidjs/web 2.0.0-experimental.0
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/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/dev.cjs +732 -0
- package/dist/dev.js +1175 -0
- package/dist/server.cjs +714 -0
- package/dist/server.js +1127 -0
- package/dist/web.cjs +721 -0
- package/dist/web.js +1154 -0
- package/package.json +97 -0
- package/storage/dist/storage.cjs +12 -0
- package/storage/dist/storage.js +10 -0
- package/storage/package.json +15 -0
- package/storage/types/index.d.ts +2 -0
- package/types/client.d.ts +85 -0
- package/types/core.d.ts +11 -0
- package/types/index.d.ts +32 -0
- package/types/jsx.d.ts +1 -0
- package/types/server-mock.d.ts +47 -0
- package/types/server.d.ts +151 -0
package/dist/web.cjs
ADDED
|
@@ -0,0 +1,721 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var solidJs = require('solid-js');
|
|
4
|
+
|
|
5
|
+
const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
|
|
6
|
+
const Properties = /*#__PURE__*/new Set(["value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
7
|
+
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
8
|
+
const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
9
|
+
class: "className",
|
|
10
|
+
formnovalidate: {
|
|
11
|
+
$: "formNoValidate",
|
|
12
|
+
BUTTON: 1,
|
|
13
|
+
INPUT: 1
|
|
14
|
+
},
|
|
15
|
+
ismap: {
|
|
16
|
+
$: "isMap",
|
|
17
|
+
IMG: 1
|
|
18
|
+
},
|
|
19
|
+
nomodule: {
|
|
20
|
+
$: "noModule",
|
|
21
|
+
SCRIPT: 1
|
|
22
|
+
},
|
|
23
|
+
playsinline: {
|
|
24
|
+
$: "playsInline",
|
|
25
|
+
VIDEO: 1
|
|
26
|
+
},
|
|
27
|
+
readonly: {
|
|
28
|
+
$: "readOnly",
|
|
29
|
+
INPUT: 1,
|
|
30
|
+
TEXTAREA: 1
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
function getPropAlias(prop, tagName) {
|
|
34
|
+
const a = PropAliases[prop];
|
|
35
|
+
return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
|
|
36
|
+
}
|
|
37
|
+
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"]);
|
|
38
|
+
const SVGElements = /*#__PURE__*/new Set([
|
|
39
|
+
"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",
|
|
40
|
+
"set", "stop",
|
|
41
|
+
"svg", "switch", "symbol", "text", "textPath",
|
|
42
|
+
"tref", "tspan", "use", "view", "vkern"]);
|
|
43
|
+
const SVGNamespace = {
|
|
44
|
+
xlink: "http://www.w3.org/1999/xlink",
|
|
45
|
+
xml: "http://www.w3.org/XML/1998/namespace"
|
|
46
|
+
};
|
|
47
|
+
const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "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", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input", "h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
48
|
+
|
|
49
|
+
function reconcileArrays(parentNode, a, b) {
|
|
50
|
+
let bLength = b.length,
|
|
51
|
+
aEnd = a.length,
|
|
52
|
+
bEnd = bLength,
|
|
53
|
+
aStart = 0,
|
|
54
|
+
bStart = 0,
|
|
55
|
+
after = a[aEnd - 1].nextSibling,
|
|
56
|
+
map = null;
|
|
57
|
+
while (aStart < aEnd || bStart < bEnd) {
|
|
58
|
+
if (a[aStart] === b[bStart]) {
|
|
59
|
+
aStart++;
|
|
60
|
+
bStart++;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
while (a[aEnd - 1] === b[bEnd - 1]) {
|
|
64
|
+
aEnd--;
|
|
65
|
+
bEnd--;
|
|
66
|
+
}
|
|
67
|
+
if (aEnd === aStart) {
|
|
68
|
+
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
69
|
+
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
70
|
+
} else if (bEnd === bStart) {
|
|
71
|
+
while (aStart < aEnd) {
|
|
72
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
73
|
+
aStart++;
|
|
74
|
+
}
|
|
75
|
+
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
76
|
+
const node = a[--aEnd].nextSibling;
|
|
77
|
+
parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
|
|
78
|
+
parentNode.insertBefore(b[--bEnd], node);
|
|
79
|
+
a[aEnd] = b[bEnd];
|
|
80
|
+
} else {
|
|
81
|
+
if (!map) {
|
|
82
|
+
map = new Map();
|
|
83
|
+
let i = bStart;
|
|
84
|
+
while (i < bEnd) map.set(b[i], i++);
|
|
85
|
+
}
|
|
86
|
+
const index = map.get(a[aStart]);
|
|
87
|
+
if (index != null) {
|
|
88
|
+
if (bStart < index && index < bEnd) {
|
|
89
|
+
let i = aStart,
|
|
90
|
+
sequence = 1,
|
|
91
|
+
t;
|
|
92
|
+
while (++i < aEnd && i < bEnd) {
|
|
93
|
+
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
94
|
+
sequence++;
|
|
95
|
+
}
|
|
96
|
+
if (sequence > index - bStart) {
|
|
97
|
+
const node = a[aStart];
|
|
98
|
+
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
99
|
+
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
100
|
+
} else aStart++;
|
|
101
|
+
} else a[aStart++].remove();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const $$EVENTS = "_$DX_DELEGATE";
|
|
107
|
+
function render(code, element, init, options = {}) {
|
|
108
|
+
let disposer;
|
|
109
|
+
solidJs.createRoot(dispose => {
|
|
110
|
+
disposer = dispose;
|
|
111
|
+
element === document ? code() : insert(element, code(), element.firstChild ? null : undefined, init);
|
|
112
|
+
}, options.owner);
|
|
113
|
+
return () => {
|
|
114
|
+
disposer();
|
|
115
|
+
element.textContent = "";
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function template(html, isImportNode, isSVG, isMathML) {
|
|
119
|
+
let node;
|
|
120
|
+
const create = () => {
|
|
121
|
+
const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
|
|
122
|
+
t.innerHTML = html;
|
|
123
|
+
return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
|
|
124
|
+
};
|
|
125
|
+
return isImportNode ? () => solidJs.untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
|
|
126
|
+
}
|
|
127
|
+
function delegateEvents(eventNames, document = window.document) {
|
|
128
|
+
const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
|
|
129
|
+
for (let i = 0, l = eventNames.length; i < l; i++) {
|
|
130
|
+
const name = eventNames[i];
|
|
131
|
+
if (!e.has(name)) {
|
|
132
|
+
e.add(name);
|
|
133
|
+
document.addEventListener(name, eventHandler);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function clearDelegatedEvents(document = window.document) {
|
|
138
|
+
if (document[$$EVENTS]) {
|
|
139
|
+
for (let name of document[$$EVENTS].keys()) document.removeEventListener(name, eventHandler);
|
|
140
|
+
delete document[$$EVENTS];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function setProperty(node, name, value) {
|
|
144
|
+
node[name] = value;
|
|
145
|
+
}
|
|
146
|
+
function setAttribute(node, name, value) {
|
|
147
|
+
if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
|
|
148
|
+
}
|
|
149
|
+
function setAttributeNS(node, namespace, name, value) {
|
|
150
|
+
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
151
|
+
}
|
|
152
|
+
function setBoolAttribute(node, name, value) {
|
|
153
|
+
if (isHydrating(node)) return;
|
|
154
|
+
value ? node.setAttribute(name, "") : node.removeAttribute(name);
|
|
155
|
+
}
|
|
156
|
+
function className(node, value, isSVG, prev) {
|
|
157
|
+
if (value == null) {
|
|
158
|
+
prev && node.removeAttribute("class");
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (typeof value === "string") {
|
|
162
|
+
value !== prev && (isSVG ? node.setAttribute("class", value) : node.className = value);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (typeof prev === "string") {
|
|
166
|
+
prev = {};
|
|
167
|
+
node.removeAttribute("class");
|
|
168
|
+
} else prev = classListToObject(prev || {});
|
|
169
|
+
value = classListToObject(value);
|
|
170
|
+
const classKeys = Object.keys(value || {});
|
|
171
|
+
const prevKeys = Object.keys(prev);
|
|
172
|
+
let i, len;
|
|
173
|
+
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
174
|
+
const key = prevKeys[i];
|
|
175
|
+
if (!key || key === "undefined" || value[key]) continue;
|
|
176
|
+
toggleClassKey(node, key, false);
|
|
177
|
+
}
|
|
178
|
+
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
179
|
+
const key = classKeys[i],
|
|
180
|
+
classValue = !!value[key];
|
|
181
|
+
if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
|
|
182
|
+
toggleClassKey(node, key, true);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function addEventListener(node, name, handler, delegate) {
|
|
186
|
+
if (delegate) {
|
|
187
|
+
if (Array.isArray(handler)) {
|
|
188
|
+
node[`$$${name}`] = handler[0];
|
|
189
|
+
node[`$$${name}Data`] = handler[1];
|
|
190
|
+
} else node[`$$${name}`] = handler;
|
|
191
|
+
} else if (Array.isArray(handler)) {
|
|
192
|
+
const handlerFn = handler[0];
|
|
193
|
+
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
194
|
+
} else node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
195
|
+
}
|
|
196
|
+
function style(node, value, prev) {
|
|
197
|
+
if (!value) {
|
|
198
|
+
prev ? setAttribute(node, "style") : value;
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const nodeStyle = node.style;
|
|
202
|
+
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
203
|
+
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
204
|
+
prev || (prev = {});
|
|
205
|
+
value || (value = {});
|
|
206
|
+
let v, s;
|
|
207
|
+
for (s in value) {
|
|
208
|
+
v = value[s];
|
|
209
|
+
if (v !== prev[s]) nodeStyle.setProperty(s, v);
|
|
210
|
+
delete prev[s];
|
|
211
|
+
}
|
|
212
|
+
for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
|
|
213
|
+
}
|
|
214
|
+
function spread(node, props = {}, isSVG, skipChildren) {
|
|
215
|
+
const prevProps = {};
|
|
216
|
+
if (!skipChildren) {
|
|
217
|
+
solidJs.createRenderEffect(() => normalize(props.children, prevProps.children), value => {
|
|
218
|
+
insertExpression(node, value, prevProps.children);
|
|
219
|
+
prevProps.children = value;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
solidJs.createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node), () => {});
|
|
223
|
+
solidJs.createRenderEffect(() => {
|
|
224
|
+
const newProps = {};
|
|
225
|
+
for (const prop in props) {
|
|
226
|
+
if (prop === "children" || prop === "ref") continue;
|
|
227
|
+
newProps[prop] = props[prop];
|
|
228
|
+
}
|
|
229
|
+
return newProps;
|
|
230
|
+
}, props => assign(node, props, isSVG, true, prevProps, true));
|
|
231
|
+
return prevProps;
|
|
232
|
+
}
|
|
233
|
+
function dynamicProperty(props, key) {
|
|
234
|
+
const src = props[key];
|
|
235
|
+
Object.defineProperty(props, key, {
|
|
236
|
+
get() {
|
|
237
|
+
return src();
|
|
238
|
+
},
|
|
239
|
+
enumerable: true
|
|
240
|
+
});
|
|
241
|
+
return props;
|
|
242
|
+
}
|
|
243
|
+
function use(fn, element, arg) {
|
|
244
|
+
solidJs.untrack(() => fn(element, arg));
|
|
245
|
+
}
|
|
246
|
+
function insert(parent, accessor, marker, initial) {
|
|
247
|
+
const multi = marker !== undefined;
|
|
248
|
+
if (multi && !initial) initial = [];
|
|
249
|
+
if (typeof accessor !== "function") {
|
|
250
|
+
accessor = normalize(accessor, initial, multi, true);
|
|
251
|
+
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
252
|
+
}
|
|
253
|
+
solidJs.createRenderEffect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
|
|
254
|
+
}
|
|
255
|
+
function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
|
|
256
|
+
props || (props = {});
|
|
257
|
+
for (const prop in prevProps) {
|
|
258
|
+
if (!(prop in props)) {
|
|
259
|
+
if (prop === "children") continue;
|
|
260
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
for (const prop in props) {
|
|
264
|
+
if (prop === "children") {
|
|
265
|
+
if (!skipChildren) insertExpression(node, props.children);
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
const value = props[prop];
|
|
269
|
+
prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function hydrate$1(code, element, options = {}) {
|
|
273
|
+
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
274
|
+
solidJs.sharedConfig.completed = globalThis._$HY.completed;
|
|
275
|
+
solidJs.sharedConfig.events = globalThis._$HY.events;
|
|
276
|
+
solidJs.sharedConfig.load = id => globalThis._$HY.r[id];
|
|
277
|
+
solidJs.sharedConfig.has = id => id in globalThis._$HY.r;
|
|
278
|
+
solidJs.sharedConfig.gather = root => gatherHydratable(element, root);
|
|
279
|
+
solidJs.sharedConfig.registry = new Map();
|
|
280
|
+
solidJs.sharedConfig.context = {
|
|
281
|
+
id: options.renderId || "",
|
|
282
|
+
count: 0
|
|
283
|
+
};
|
|
284
|
+
try {
|
|
285
|
+
gatherHydratable(element, options.renderId);
|
|
286
|
+
return render(code, element, [...element.childNodes], options);
|
|
287
|
+
} finally {
|
|
288
|
+
solidJs.sharedConfig.context = null;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function getNextElement(template) {
|
|
292
|
+
let node,
|
|
293
|
+
key,
|
|
294
|
+
hydrating = isHydrating();
|
|
295
|
+
if (!hydrating || !(node = solidJs.sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
296
|
+
return template();
|
|
297
|
+
}
|
|
298
|
+
if (solidJs.sharedConfig.completed) solidJs.sharedConfig.completed.add(node);
|
|
299
|
+
solidJs.sharedConfig.registry.delete(key);
|
|
300
|
+
return node;
|
|
301
|
+
}
|
|
302
|
+
function getNextMatch(el, nodeName) {
|
|
303
|
+
while (el && el.localName !== nodeName) el = el.nextSibling;
|
|
304
|
+
return el;
|
|
305
|
+
}
|
|
306
|
+
function getNextMarker(start) {
|
|
307
|
+
let end = start,
|
|
308
|
+
count = 0,
|
|
309
|
+
current = [];
|
|
310
|
+
if (isHydrating(start)) {
|
|
311
|
+
while (end) {
|
|
312
|
+
if (end.nodeType === 8) {
|
|
313
|
+
const v = end.nodeValue;
|
|
314
|
+
if (v === "$") count++;else if (v === "/") {
|
|
315
|
+
if (count === 0) return [end, current];
|
|
316
|
+
count--;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
current.push(end);
|
|
320
|
+
end = end.nextSibling;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return [end, current];
|
|
324
|
+
}
|
|
325
|
+
function runHydrationEvents() {
|
|
326
|
+
if (solidJs.sharedConfig.events && !solidJs.sharedConfig.events.queued) {
|
|
327
|
+
queueMicrotask(() => {
|
|
328
|
+
const {
|
|
329
|
+
completed,
|
|
330
|
+
events
|
|
331
|
+
} = solidJs.sharedConfig;
|
|
332
|
+
if (!events) return;
|
|
333
|
+
events.queued = false;
|
|
334
|
+
while (events.length) {
|
|
335
|
+
const [el, e] = events[0];
|
|
336
|
+
if (!completed.has(el)) return;
|
|
337
|
+
events.shift();
|
|
338
|
+
eventHandler(e);
|
|
339
|
+
}
|
|
340
|
+
if (solidJs.sharedConfig.done) {
|
|
341
|
+
solidJs.sharedConfig.events = _$HY.events = null;
|
|
342
|
+
solidJs.sharedConfig.completed = _$HY.completed = null;
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
solidJs.sharedConfig.events.queued = true;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function isHydrating(node) {
|
|
349
|
+
return !!solidJs.sharedConfig.context && !solidJs.sharedConfig.done && (!node || node.isConnected);
|
|
350
|
+
}
|
|
351
|
+
function toggleClassKey(node, key, value) {
|
|
352
|
+
const classNames = key.trim().split(/\s+/);
|
|
353
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
|
|
354
|
+
}
|
|
355
|
+
function classListToObject(classList) {
|
|
356
|
+
if (Array.isArray(classList)) {
|
|
357
|
+
const result = {};
|
|
358
|
+
for (let i = 0, len = classList.length; i < len; i++) {
|
|
359
|
+
const key = classList[i];
|
|
360
|
+
if (typeof key === "object" && key != null) Object.assign(result, key);else if (key || key === 0) result[key] = true;
|
|
361
|
+
}
|
|
362
|
+
return result;
|
|
363
|
+
}
|
|
364
|
+
return classList;
|
|
365
|
+
}
|
|
366
|
+
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
367
|
+
let propAlias, forceProp;
|
|
368
|
+
if (prop === "style") return style(node, value, prev), value;
|
|
369
|
+
if (prop === "class") return className(node, value, isSVG, prev), value;
|
|
370
|
+
if (value === prev) return prev;
|
|
371
|
+
if (prop === "ref") {
|
|
372
|
+
if (!skipRef) value(node);
|
|
373
|
+
} else if (prop.slice(0, 3) === "on:") {
|
|
374
|
+
const e = prop.slice(3);
|
|
375
|
+
prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
|
|
376
|
+
value && node.addEventListener(e, value, typeof value !== "function" && value);
|
|
377
|
+
} else if (prop.slice(0, 2) === "on") {
|
|
378
|
+
const name = prop.slice(2).toLowerCase();
|
|
379
|
+
const delegate = DelegatedEvents.has(name);
|
|
380
|
+
if (!delegate && prev) {
|
|
381
|
+
const h = Array.isArray(prev) ? prev[0] : prev;
|
|
382
|
+
node.removeEventListener(name, h);
|
|
383
|
+
}
|
|
384
|
+
if (delegate || value) {
|
|
385
|
+
addEventListener(node, name, value, delegate);
|
|
386
|
+
delegate && delegateEvents([name]);
|
|
387
|
+
}
|
|
388
|
+
} else if (prop.slice(0, 5) === "attr:") {
|
|
389
|
+
setAttribute(node, prop.slice(5), value);
|
|
390
|
+
} else if (prop.slice(0, 5) === "bool:") {
|
|
391
|
+
setBoolAttribute(node, prop.slice(5), value);
|
|
392
|
+
} else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && (propAlias = getPropAlias(prop, node.tagName)) || Properties.has(prop)) {
|
|
393
|
+
if (forceProp) prop = prop.slice(5);else node[propAlias || prop] = value;
|
|
394
|
+
} else {
|
|
395
|
+
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
396
|
+
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
397
|
+
}
|
|
398
|
+
return value;
|
|
399
|
+
}
|
|
400
|
+
function eventHandler(e) {
|
|
401
|
+
if (solidJs.sharedConfig.registry && solidJs.sharedConfig.events) {
|
|
402
|
+
if (solidJs.sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
403
|
+
}
|
|
404
|
+
let node = e.target;
|
|
405
|
+
const key = `$$${e.type}`;
|
|
406
|
+
const oriTarget = e.target;
|
|
407
|
+
const oriCurrentTarget = e.currentTarget;
|
|
408
|
+
const retarget = value => Object.defineProperty(e, "target", {
|
|
409
|
+
configurable: true,
|
|
410
|
+
value
|
|
411
|
+
});
|
|
412
|
+
const handleNode = () => {
|
|
413
|
+
const handler = node[key];
|
|
414
|
+
if (handler && !node.disabled) {
|
|
415
|
+
const data = node[`${key}Data`];
|
|
416
|
+
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
417
|
+
if (e.cancelBubble) return;
|
|
418
|
+
}
|
|
419
|
+
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
420
|
+
return true;
|
|
421
|
+
};
|
|
422
|
+
const walkUpTree = () => {
|
|
423
|
+
while (handleNode() && (node = node._$host || node.parentNode || node.host));
|
|
424
|
+
};
|
|
425
|
+
Object.defineProperty(e, "currentTarget", {
|
|
426
|
+
configurable: true,
|
|
427
|
+
get() {
|
|
428
|
+
return node || document;
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) solidJs.sharedConfig.done = _$HY.done = true;
|
|
432
|
+
if (e.composedPath) {
|
|
433
|
+
const path = e.composedPath();
|
|
434
|
+
retarget(path[0]);
|
|
435
|
+
for (let i = 0; i < path.length - 2; i++) {
|
|
436
|
+
node = path[i];
|
|
437
|
+
if (!handleNode()) break;
|
|
438
|
+
if (node._$host) {
|
|
439
|
+
node = node._$host;
|
|
440
|
+
walkUpTree();
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
if (node.parentNode === oriCurrentTarget) {
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
else walkUpTree();
|
|
449
|
+
retarget(oriTarget);
|
|
450
|
+
}
|
|
451
|
+
function insertExpression(parent, value, current, marker) {
|
|
452
|
+
if (value === current) return;
|
|
453
|
+
const t = typeof value,
|
|
454
|
+
multi = marker !== undefined;
|
|
455
|
+
if (t === "string" || t === "number") {
|
|
456
|
+
const tc = typeof current;
|
|
457
|
+
if (tc === "string" || tc === "number") {
|
|
458
|
+
parent.firstChild.data = value;
|
|
459
|
+
} else parent.textContent = value;
|
|
460
|
+
} else if (value === undefined) {
|
|
461
|
+
cleanChildren(parent, current, marker);
|
|
462
|
+
} else if (value.nodeType) {
|
|
463
|
+
if (Array.isArray(current)) {
|
|
464
|
+
cleanChildren(parent, current, multi ? marker : null, value);
|
|
465
|
+
} else if (current === undefined || !parent.firstChild) {
|
|
466
|
+
parent.appendChild(value);
|
|
467
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
468
|
+
} else if (Array.isArray(value)) {
|
|
469
|
+
const currentArray = current && Array.isArray(current);
|
|
470
|
+
if (value.length === 0) {
|
|
471
|
+
cleanChildren(parent, current, marker);
|
|
472
|
+
} else if (currentArray) {
|
|
473
|
+
if (current.length === 0) {
|
|
474
|
+
appendNodes(parent, value, marker);
|
|
475
|
+
} else reconcileArrays(parent, current, value);
|
|
476
|
+
} else {
|
|
477
|
+
current && cleanChildren(parent);
|
|
478
|
+
appendNodes(parent, value);
|
|
479
|
+
}
|
|
480
|
+
} else ;
|
|
481
|
+
}
|
|
482
|
+
function normalize(value, current, multi, doNotUnwrap) {
|
|
483
|
+
value = solidJs.flatten(value, {
|
|
484
|
+
skipNonRendered: true,
|
|
485
|
+
doNotUnwrap
|
|
486
|
+
});
|
|
487
|
+
if (doNotUnwrap && typeof value === "function") return value;
|
|
488
|
+
if (multi && value != null && !Array.isArray(value)) value = [value];
|
|
489
|
+
if (Array.isArray(value)) {
|
|
490
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
491
|
+
const item = value[i],
|
|
492
|
+
prev = current && current[i],
|
|
493
|
+
t = typeof item;
|
|
494
|
+
if (t === "string" || t === "number") value[i] = prev && prev.nodeType === 3 && prev.data === item ? prev : document.createTextNode(item);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return value;
|
|
498
|
+
}
|
|
499
|
+
function appendNodes(parent, array, marker = null) {
|
|
500
|
+
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
501
|
+
}
|
|
502
|
+
function cleanChildren(parent, current, marker, replacement) {
|
|
503
|
+
if (marker === undefined) return parent.textContent = "";
|
|
504
|
+
if (current.length) {
|
|
505
|
+
let inserted = false;
|
|
506
|
+
for (let i = current.length - 1; i >= 0; i--) {
|
|
507
|
+
const el = current[i];
|
|
508
|
+
if (replacement !== el) {
|
|
509
|
+
const isParent = el.parentNode === parent;
|
|
510
|
+
if (replacement && !inserted && !i) isParent ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else isParent && el.remove();
|
|
511
|
+
} else inserted = true;
|
|
512
|
+
}
|
|
513
|
+
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
514
|
+
}
|
|
515
|
+
function gatherHydratable(element, root) {
|
|
516
|
+
const templates = element.querySelectorAll(`*[data-hk]`);
|
|
517
|
+
for (let i = 0; i < templates.length; i++) {
|
|
518
|
+
const node = templates[i];
|
|
519
|
+
const key = node.getAttribute("data-hk");
|
|
520
|
+
if ((!root || key.startsWith(root)) && !solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
function getHydrationKey() {
|
|
524
|
+
return solidJs.sharedConfig.getNextContextId();
|
|
525
|
+
}
|
|
526
|
+
function NoHydration(props) {
|
|
527
|
+
return solidJs.sharedConfig.context ? undefined : props.children;
|
|
528
|
+
}
|
|
529
|
+
function Hydration(props) {
|
|
530
|
+
return props.children;
|
|
531
|
+
}
|
|
532
|
+
const voidFn = () => undefined;
|
|
533
|
+
const RequestContext = Symbol();
|
|
534
|
+
|
|
535
|
+
function throwInBrowser(func) {
|
|
536
|
+
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
537
|
+
console.error(err);
|
|
538
|
+
}
|
|
539
|
+
function renderToString(fn, options) {
|
|
540
|
+
throwInBrowser(renderToString);
|
|
541
|
+
}
|
|
542
|
+
function renderToStringAsync(fn, options) {
|
|
543
|
+
throwInBrowser(renderToStringAsync);
|
|
544
|
+
}
|
|
545
|
+
function renderToStream(fn, options) {
|
|
546
|
+
throwInBrowser(renderToStream);
|
|
547
|
+
}
|
|
548
|
+
function ssr(template, ...nodes) {}
|
|
549
|
+
function ssrElement(name, props, children, needsId) {}
|
|
550
|
+
function ssrClassList(value) {}
|
|
551
|
+
function ssrStyle(value) {}
|
|
552
|
+
function ssrAttribute(key, value) {}
|
|
553
|
+
function ssrHydrationKey() {}
|
|
554
|
+
function resolveSSRNode(node) {}
|
|
555
|
+
function escape(html) {}
|
|
556
|
+
|
|
557
|
+
const isServer = false;
|
|
558
|
+
const isDev = false;
|
|
559
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
560
|
+
function createElement(tagName, isSVG = false) {
|
|
561
|
+
return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
|
|
562
|
+
}
|
|
563
|
+
const hydrate = (...args) => {
|
|
564
|
+
solidJs.enableHydration();
|
|
565
|
+
return hydrate$1(...args);
|
|
566
|
+
};
|
|
567
|
+
function Portal(props) {
|
|
568
|
+
const treeMarker = document.createTextNode(""),
|
|
569
|
+
startMarker = document.createTextNode(""),
|
|
570
|
+
endMarker = document.createTextNode(""),
|
|
571
|
+
mount = () => createElementProxy(props.mount || document.body, treeMarker);
|
|
572
|
+
let content = solidJs.createMemo(() => [startMarker, props.children]);
|
|
573
|
+
solidJs.createRenderEffect(() => [mount(), content()], ([m, c]) => {
|
|
574
|
+
m.appendChild(endMarker);
|
|
575
|
+
insert(m, c, endMarker);
|
|
576
|
+
return () => {
|
|
577
|
+
let c = startMarker;
|
|
578
|
+
while (c && c !== endMarker) {
|
|
579
|
+
const n = c.nextSibling;
|
|
580
|
+
m.removeChild(c);
|
|
581
|
+
c = n;
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
});
|
|
585
|
+
return treeMarker;
|
|
586
|
+
}
|
|
587
|
+
function createElementProxy(el, marker) {
|
|
588
|
+
return new Proxy(el, {
|
|
589
|
+
get(target, prop) {
|
|
590
|
+
if (prop === "appendChild" || prop === "insertBefore") {
|
|
591
|
+
return (...args) => {
|
|
592
|
+
Object.defineProperty(args[0], "_$host", {
|
|
593
|
+
get: () => marker.parentNode,
|
|
594
|
+
configurable: true
|
|
595
|
+
});
|
|
596
|
+
target[prop](...args);
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
const value = Reflect.get(target, prop);
|
|
600
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
function Dynamic(props) {
|
|
605
|
+
const others = solidJs.omit(props, "component");
|
|
606
|
+
const cached = solidJs.createMemo(() => props.component);
|
|
607
|
+
return solidJs.createMemo(() => {
|
|
608
|
+
const component = cached();
|
|
609
|
+
switch (typeof component) {
|
|
610
|
+
case "function":
|
|
611
|
+
return solidJs.untrack(() => component(others));
|
|
612
|
+
case "string":
|
|
613
|
+
const isSvg = SVGElements.has(component);
|
|
614
|
+
const el = solidJs.sharedConfig.context ? getNextElement() : createElement(component, isSvg);
|
|
615
|
+
spread(el, others, isSvg);
|
|
616
|
+
return el;
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
Object.defineProperty(exports, "ErrorBoundary", {
|
|
622
|
+
enumerable: true,
|
|
623
|
+
get: function () { return solidJs.ErrorBoundary; }
|
|
624
|
+
});
|
|
625
|
+
Object.defineProperty(exports, "For", {
|
|
626
|
+
enumerable: true,
|
|
627
|
+
get: function () { return solidJs.For; }
|
|
628
|
+
});
|
|
629
|
+
Object.defineProperty(exports, "Match", {
|
|
630
|
+
enumerable: true,
|
|
631
|
+
get: function () { return solidJs.Match; }
|
|
632
|
+
});
|
|
633
|
+
Object.defineProperty(exports, "Show", {
|
|
634
|
+
enumerable: true,
|
|
635
|
+
get: function () { return solidJs.Show; }
|
|
636
|
+
});
|
|
637
|
+
Object.defineProperty(exports, "Suspense", {
|
|
638
|
+
enumerable: true,
|
|
639
|
+
get: function () { return solidJs.Suspense; }
|
|
640
|
+
});
|
|
641
|
+
Object.defineProperty(exports, "Switch", {
|
|
642
|
+
enumerable: true,
|
|
643
|
+
get: function () { return solidJs.Switch; }
|
|
644
|
+
});
|
|
645
|
+
Object.defineProperty(exports, "createComponent", {
|
|
646
|
+
enumerable: true,
|
|
647
|
+
get: function () { return solidJs.createComponent; }
|
|
648
|
+
});
|
|
649
|
+
Object.defineProperty(exports, "effect", {
|
|
650
|
+
enumerable: true,
|
|
651
|
+
get: function () { return solidJs.createRenderEffect; }
|
|
652
|
+
});
|
|
653
|
+
Object.defineProperty(exports, "getOwner", {
|
|
654
|
+
enumerable: true,
|
|
655
|
+
get: function () { return solidJs.getOwner; }
|
|
656
|
+
});
|
|
657
|
+
Object.defineProperty(exports, "memo", {
|
|
658
|
+
enumerable: true,
|
|
659
|
+
get: function () { return solidJs.createMemo; }
|
|
660
|
+
});
|
|
661
|
+
Object.defineProperty(exports, "mergeProps", {
|
|
662
|
+
enumerable: true,
|
|
663
|
+
get: function () { return solidJs.merge; }
|
|
664
|
+
});
|
|
665
|
+
Object.defineProperty(exports, "untrack", {
|
|
666
|
+
enumerable: true,
|
|
667
|
+
get: function () { return solidJs.untrack; }
|
|
668
|
+
});
|
|
669
|
+
exports.Assets = voidFn;
|
|
670
|
+
exports.ChildProperties = ChildProperties;
|
|
671
|
+
exports.DOMElements = DOMElements;
|
|
672
|
+
exports.DelegatedEvents = DelegatedEvents;
|
|
673
|
+
exports.Dynamic = Dynamic;
|
|
674
|
+
exports.Hydration = Hydration;
|
|
675
|
+
exports.HydrationScript = voidFn;
|
|
676
|
+
exports.NoHydration = NoHydration;
|
|
677
|
+
exports.Portal = Portal;
|
|
678
|
+
exports.Properties = Properties;
|
|
679
|
+
exports.RequestContext = RequestContext;
|
|
680
|
+
exports.SVGElements = SVGElements;
|
|
681
|
+
exports.SVGNamespace = SVGNamespace;
|
|
682
|
+
exports.addEventListener = addEventListener;
|
|
683
|
+
exports.assign = assign;
|
|
684
|
+
exports.className = className;
|
|
685
|
+
exports.clearDelegatedEvents = clearDelegatedEvents;
|
|
686
|
+
exports.delegateEvents = delegateEvents;
|
|
687
|
+
exports.dynamicProperty = dynamicProperty;
|
|
688
|
+
exports.escape = escape;
|
|
689
|
+
exports.generateHydrationScript = voidFn;
|
|
690
|
+
exports.getAssets = voidFn;
|
|
691
|
+
exports.getHydrationKey = getHydrationKey;
|
|
692
|
+
exports.getNextElement = getNextElement;
|
|
693
|
+
exports.getNextMarker = getNextMarker;
|
|
694
|
+
exports.getNextMatch = getNextMatch;
|
|
695
|
+
exports.getPropAlias = getPropAlias;
|
|
696
|
+
exports.getRequestEvent = voidFn;
|
|
697
|
+
exports.hydrate = hydrate;
|
|
698
|
+
exports.insert = insert;
|
|
699
|
+
exports.isDev = isDev;
|
|
700
|
+
exports.isServer = isServer;
|
|
701
|
+
exports.render = render;
|
|
702
|
+
exports.renderToStream = renderToStream;
|
|
703
|
+
exports.renderToString = renderToString;
|
|
704
|
+
exports.renderToStringAsync = renderToStringAsync;
|
|
705
|
+
exports.resolveSSRNode = resolveSSRNode;
|
|
706
|
+
exports.runHydrationEvents = runHydrationEvents;
|
|
707
|
+
exports.setAttribute = setAttribute;
|
|
708
|
+
exports.setAttributeNS = setAttributeNS;
|
|
709
|
+
exports.setBoolAttribute = setBoolAttribute;
|
|
710
|
+
exports.setProperty = setProperty;
|
|
711
|
+
exports.spread = spread;
|
|
712
|
+
exports.ssr = ssr;
|
|
713
|
+
exports.ssrAttribute = ssrAttribute;
|
|
714
|
+
exports.ssrClassList = ssrClassList;
|
|
715
|
+
exports.ssrElement = ssrElement;
|
|
716
|
+
exports.ssrHydrationKey = ssrHydrationKey;
|
|
717
|
+
exports.ssrStyle = ssrStyle;
|
|
718
|
+
exports.style = style;
|
|
719
|
+
exports.template = template;
|
|
720
|
+
exports.use = use;
|
|
721
|
+
exports.useAssets = voidFn;
|