799 lines
25 KiB
JavaScript
799 lines
25 KiB
JavaScript
import {
|
|
$DEVCOMP,
|
|
createMemo,
|
|
createRenderEffect,
|
|
createRoot,
|
|
createSignal,
|
|
enableHydration,
|
|
onCleanup,
|
|
sharedConfig,
|
|
splitProps,
|
|
untrack
|
|
} from "./chunk-R2HWYFCB.js";
|
|
|
|
// node_modules/.pnpm/solid-js@1.4.7/node_modules/solid-js/web/dist/dev.js
|
|
var booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
|
|
var Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
var ChildProperties = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
var Aliases = {
|
|
className: "class",
|
|
htmlFor: "for"
|
|
};
|
|
var PropAliases = {
|
|
class: "className",
|
|
formnovalidate: "formNoValidate",
|
|
ismap: "isMap",
|
|
nomodule: "noModule",
|
|
playsinline: "playsInline",
|
|
readonly: "readOnly"
|
|
};
|
|
var 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"]);
|
|
var SVGElements = /* @__PURE__ */ new Set([
|
|
"altGlyph",
|
|
"altGlyphDef",
|
|
"altGlyphItem",
|
|
"animate",
|
|
"animateColor",
|
|
"animateMotion",
|
|
"animateTransform",
|
|
"circle",
|
|
"clipPath",
|
|
"color-profile",
|
|
"cursor",
|
|
"defs",
|
|
"desc",
|
|
"ellipse",
|
|
"feBlend",
|
|
"feColorMatrix",
|
|
"feComponentTransfer",
|
|
"feComposite",
|
|
"feConvolveMatrix",
|
|
"feDiffuseLighting",
|
|
"feDisplacementMap",
|
|
"feDistantLight",
|
|
"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",
|
|
"set",
|
|
"stop",
|
|
"svg",
|
|
"switch",
|
|
"symbol",
|
|
"text",
|
|
"textPath",
|
|
"tref",
|
|
"tspan",
|
|
"use",
|
|
"view",
|
|
"vkern"
|
|
]);
|
|
var SVGNamespace = {
|
|
xlink: "http://www.w3.org/1999/xlink",
|
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
};
|
|
var 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"]);
|
|
function memo(fn, equals) {
|
|
return createMemo(fn, void 0, !equals ? {
|
|
equals
|
|
} : void 0);
|
|
}
|
|
function reconcileArrays(parentNode, a, b) {
|
|
let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
|
|
while (aStart < aEnd || bStart < bEnd) {
|
|
if (a[aStart] === b[bStart]) {
|
|
aStart++;
|
|
bStart++;
|
|
continue;
|
|
}
|
|
while (a[aEnd - 1] === b[bEnd - 1]) {
|
|
aEnd--;
|
|
bEnd--;
|
|
}
|
|
if (aEnd === aStart) {
|
|
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
while (bStart < bEnd)
|
|
parentNode.insertBefore(b[bStart++], node);
|
|
} else if (bEnd === bStart) {
|
|
while (aStart < aEnd) {
|
|
if (!map || !map.has(a[aStart]))
|
|
a[aStart].remove();
|
|
aStart++;
|
|
}
|
|
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
const node = a[--aEnd].nextSibling;
|
|
parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
|
|
parentNode.insertBefore(b[--bEnd], node);
|
|
a[aEnd] = b[bEnd];
|
|
} else {
|
|
if (!map) {
|
|
map = /* @__PURE__ */ new Map();
|
|
let i = bStart;
|
|
while (i < bEnd)
|
|
map.set(b[i], i++);
|
|
}
|
|
const index = map.get(a[aStart]);
|
|
if (index != null) {
|
|
if (bStart < index && index < bEnd) {
|
|
let i = aStart, sequence = 1, t;
|
|
while (++i < aEnd && i < bEnd) {
|
|
if ((t = map.get(a[i])) == null || t !== index + sequence)
|
|
break;
|
|
sequence++;
|
|
}
|
|
if (sequence > index - bStart) {
|
|
const node = a[aStart];
|
|
while (bStart < index)
|
|
parentNode.insertBefore(b[bStart++], node);
|
|
} else
|
|
parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
} else
|
|
aStart++;
|
|
} else
|
|
a[aStart++].remove();
|
|
}
|
|
}
|
|
}
|
|
var $$EVENTS = "_$DX_DELEGATE";
|
|
function render(code, element, init) {
|
|
let disposer;
|
|
createRoot((dispose) => {
|
|
disposer = dispose;
|
|
element === document ? code() : insert(element, code(), element.firstChild ? null : void 0, init);
|
|
});
|
|
return () => {
|
|
disposer();
|
|
element.textContent = "";
|
|
};
|
|
}
|
|
function template(html, check, isSVG) {
|
|
const t = document.createElement("template");
|
|
t.innerHTML = html;
|
|
if (check && t.innerHTML.split("<").length - 1 !== check)
|
|
throw `The browser resolved template HTML does not match JSX input:
|
|
${t.innerHTML}
|
|
|
|
${html}. Is your HTML properly formed?`;
|
|
let node = t.content.firstChild;
|
|
if (isSVG)
|
|
node = node.firstChild;
|
|
return node;
|
|
}
|
|
function delegateEvents(eventNames, document2 = window.document) {
|
|
const e = document2[$$EVENTS] || (document2[$$EVENTS] = /* @__PURE__ */ new Set());
|
|
for (let i = 0, l = eventNames.length; i < l; i++) {
|
|
const name = eventNames[i];
|
|
if (!e.has(name)) {
|
|
e.add(name);
|
|
document2.addEventListener(name, eventHandler);
|
|
}
|
|
}
|
|
}
|
|
function clearDelegatedEvents(document2 = window.document) {
|
|
if (document2[$$EVENTS]) {
|
|
for (let name of document2[$$EVENTS].keys())
|
|
document2.removeEventListener(name, eventHandler);
|
|
delete document2[$$EVENTS];
|
|
}
|
|
}
|
|
function setAttribute(node, name, value) {
|
|
if (value == null)
|
|
node.removeAttribute(name);
|
|
else
|
|
node.setAttribute(name, value);
|
|
}
|
|
function setAttributeNS(node, namespace, name, value) {
|
|
if (value == null)
|
|
node.removeAttributeNS(namespace, name);
|
|
else
|
|
node.setAttributeNS(namespace, name, value);
|
|
}
|
|
function className(node, value) {
|
|
if (value == null)
|
|
node.removeAttribute("class");
|
|
else
|
|
node.className = value;
|
|
}
|
|
function addEventListener(node, name, handler, delegate) {
|
|
if (delegate) {
|
|
if (Array.isArray(handler)) {
|
|
node[`$$${name}`] = handler[0];
|
|
node[`$$${name}Data`] = handler[1];
|
|
} else
|
|
node[`$$${name}`] = handler;
|
|
} else if (Array.isArray(handler)) {
|
|
const handlerFn = handler[0];
|
|
node.addEventListener(name, handler[0] = (e) => handlerFn.call(node, handler[1], e));
|
|
} else
|
|
node.addEventListener(name, handler);
|
|
}
|
|
function classList(node, value, prev = {}) {
|
|
const classKeys = Object.keys(value || {}), prevKeys = Object.keys(prev);
|
|
let i, len;
|
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
const key = prevKeys[i];
|
|
if (!key || key === "undefined" || value[key])
|
|
continue;
|
|
toggleClassKey(node, key, false);
|
|
delete prev[key];
|
|
}
|
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
const key = classKeys[i], classValue = !!value[key];
|
|
if (!key || key === "undefined" || prev[key] === classValue || !classValue)
|
|
continue;
|
|
toggleClassKey(node, key, true);
|
|
prev[key] = classValue;
|
|
}
|
|
return prev;
|
|
}
|
|
function style(node, value, prev = {}) {
|
|
const nodeStyle = node.style;
|
|
const prevString = typeof prev === "string";
|
|
if (value == null && prevString || typeof value === "string")
|
|
return nodeStyle.cssText = value;
|
|
prevString && (nodeStyle.cssText = void 0, prev = {});
|
|
value || (value = {});
|
|
let v, s;
|
|
for (s in prev) {
|
|
value[s] == null && nodeStyle.removeProperty(s);
|
|
delete prev[s];
|
|
}
|
|
for (s in value) {
|
|
v = value[s];
|
|
if (v !== prev[s]) {
|
|
nodeStyle.setProperty(s, v);
|
|
prev[s] = v;
|
|
}
|
|
}
|
|
return prev;
|
|
}
|
|
function spread(node, accessor, isSVG, skipChildren) {
|
|
if (typeof accessor === "function") {
|
|
createRenderEffect((current) => spreadExpression(node, accessor(), current, isSVG, skipChildren));
|
|
} else
|
|
spreadExpression(node, accessor, void 0, isSVG, skipChildren);
|
|
}
|
|
function dynamicProperty(props, key) {
|
|
const src = props[key];
|
|
Object.defineProperty(props, key, {
|
|
get() {
|
|
return src();
|
|
},
|
|
enumerable: true
|
|
});
|
|
return props;
|
|
}
|
|
function innerHTML(parent, content) {
|
|
!sharedConfig.context && (parent.innerHTML = content);
|
|
}
|
|
function insert(parent, accessor, marker, initial) {
|
|
if (marker !== void 0 && !initial)
|
|
initial = [];
|
|
if (typeof accessor !== "function")
|
|
return insertExpression(parent, accessor, initial, marker);
|
|
createRenderEffect((current) => insertExpression(parent, accessor(), current, marker), initial);
|
|
}
|
|
function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
|
|
props || (props = {});
|
|
for (const prop in prevProps) {
|
|
if (!(prop in props)) {
|
|
if (prop === "children")
|
|
continue;
|
|
assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
|
|
}
|
|
}
|
|
for (const prop in props) {
|
|
if (prop === "children") {
|
|
if (!skipChildren)
|
|
insertExpression(node, props.children);
|
|
continue;
|
|
}
|
|
const value = props[prop];
|
|
prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
|
|
}
|
|
}
|
|
function hydrate$1(code, element, options = {}) {
|
|
sharedConfig.completed = globalThis._$HY.completed;
|
|
sharedConfig.events = globalThis._$HY.events;
|
|
sharedConfig.load = globalThis._$HY.load;
|
|
sharedConfig.gather = (root) => gatherHydratable(element, root);
|
|
sharedConfig.registry = /* @__PURE__ */ new Map();
|
|
sharedConfig.context = {
|
|
id: options.renderId || "",
|
|
count: 0
|
|
};
|
|
gatherHydratable(element, options.renderId);
|
|
const dispose = render(code, element, [...element.childNodes]);
|
|
sharedConfig.context = null;
|
|
return dispose;
|
|
}
|
|
function getNextElement(template2) {
|
|
let node, key;
|
|
if (!sharedConfig.context || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
|
|
return template2.cloneNode(true);
|
|
}
|
|
if (sharedConfig.completed)
|
|
sharedConfig.completed.add(node);
|
|
sharedConfig.registry.delete(key);
|
|
return node;
|
|
}
|
|
function getNextMatch(el, nodeName) {
|
|
while (el && el.localName !== nodeName)
|
|
el = el.nextSibling;
|
|
return el;
|
|
}
|
|
function getNextMarker(start) {
|
|
let end = start, count = 0, current = [];
|
|
if (sharedConfig.context) {
|
|
while (end) {
|
|
if (end.nodeType === 8) {
|
|
const v = end.nodeValue;
|
|
if (v === "#")
|
|
count++;
|
|
else if (v === "/") {
|
|
if (count === 0)
|
|
return [end, current];
|
|
count--;
|
|
}
|
|
}
|
|
current.push(end);
|
|
end = end.nextSibling;
|
|
}
|
|
}
|
|
return [end, current];
|
|
}
|
|
function runHydrationEvents() {
|
|
if (sharedConfig.events && !sharedConfig.events.queued) {
|
|
queueMicrotask(() => {
|
|
const {
|
|
completed,
|
|
events
|
|
} = sharedConfig;
|
|
events.queued = false;
|
|
while (events.length) {
|
|
const [el, e] = events[0];
|
|
if (!completed.has(el))
|
|
return;
|
|
eventHandler(e);
|
|
events.shift();
|
|
}
|
|
});
|
|
sharedConfig.events.queued = true;
|
|
}
|
|
}
|
|
function toPropertyName(name) {
|
|
return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
|
|
}
|
|
function toggleClassKey(node, key, value) {
|
|
const classNames = key.trim().split(/\s+/);
|
|
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
node.classList.toggle(classNames[i], value);
|
|
}
|
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
let isCE, isProp, isChildProp;
|
|
if (prop === "style")
|
|
return style(node, value, prev);
|
|
if (prop === "classList")
|
|
return classList(node, value, prev);
|
|
if (value === prev)
|
|
return prev;
|
|
if (prop === "ref") {
|
|
if (!skipRef) {
|
|
value(node);
|
|
}
|
|
} else if (prop.slice(0, 3) === "on:") {
|
|
const e = prop.slice(3);
|
|
prev && node.removeEventListener(e, prev);
|
|
value && node.addEventListener(e, value);
|
|
} else if (prop.slice(0, 10) === "oncapture:") {
|
|
const e = prop.slice(10);
|
|
prev && node.removeEventListener(e, prev, true);
|
|
value && node.addEventListener(e, value, true);
|
|
} else if (prop.slice(0, 2) === "on") {
|
|
const name = prop.slice(2).toLowerCase();
|
|
const delegate = DelegatedEvents.has(name);
|
|
if (!delegate && prev) {
|
|
const h = Array.isArray(prev) ? prev[0] : prev;
|
|
node.removeEventListener(name, h);
|
|
}
|
|
if (delegate || value) {
|
|
addEventListener(node, name, value, delegate);
|
|
delegate && delegateEvents([name]);
|
|
}
|
|
} else if ((isChildProp = ChildProperties.has(prop)) || !isSVG && (PropAliases[prop] || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
|
|
if (prop === "class" || prop === "className")
|
|
className(node, value);
|
|
else if (isCE && !isProp && !isChildProp)
|
|
node[toPropertyName(prop)] = value;
|
|
else
|
|
node[PropAliases[prop] || prop] = value;
|
|
} else {
|
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
if (ns)
|
|
setAttributeNS(node, ns, prop, value);
|
|
else
|
|
setAttribute(node, Aliases[prop] || prop, value);
|
|
}
|
|
return value;
|
|
}
|
|
function eventHandler(e) {
|
|
const key = `$$${e.type}`;
|
|
let node = e.composedPath && e.composedPath()[0] || e.target;
|
|
if (e.target !== node) {
|
|
Object.defineProperty(e, "target", {
|
|
configurable: true,
|
|
value: node
|
|
});
|
|
}
|
|
Object.defineProperty(e, "currentTarget", {
|
|
configurable: true,
|
|
get() {
|
|
return node || document;
|
|
}
|
|
});
|
|
if (sharedConfig.registry && !sharedConfig.done) {
|
|
sharedConfig.done = true;
|
|
document.querySelectorAll("[id^=pl-]").forEach((elem) => elem.remove());
|
|
}
|
|
while (node !== null) {
|
|
const handler = node[key];
|
|
if (handler && !node.disabled) {
|
|
const data = node[`${key}Data`];
|
|
data !== void 0 ? handler.call(node, data, e) : handler.call(node, e);
|
|
if (e.cancelBubble)
|
|
return;
|
|
}
|
|
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
}
|
|
}
|
|
function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
props || (props = {});
|
|
if (!skipChildren && "children" in props) {
|
|
createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
}
|
|
props.ref && props.ref(node);
|
|
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
return prevProps;
|
|
}
|
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
if (sharedConfig.context && !current)
|
|
current = [...parent.childNodes];
|
|
while (typeof current === "function")
|
|
current = current();
|
|
if (value === current)
|
|
return current;
|
|
const t = typeof value, multi = marker !== void 0;
|
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
if (t === "string" || t === "number") {
|
|
if (sharedConfig.context)
|
|
return current;
|
|
if (t === "number")
|
|
value = value.toString();
|
|
if (multi) {
|
|
let node = current[0];
|
|
if (node && node.nodeType === 3) {
|
|
node.data = value;
|
|
} else
|
|
node = document.createTextNode(value);
|
|
current = cleanChildren(parent, current, marker, node);
|
|
} else {
|
|
if (current !== "" && typeof current === "string") {
|
|
current = parent.firstChild.data = value;
|
|
} else
|
|
current = parent.textContent = value;
|
|
}
|
|
} else if (value == null || t === "boolean") {
|
|
if (sharedConfig.context)
|
|
return current;
|
|
current = cleanChildren(parent, current, marker);
|
|
} else if (t === "function") {
|
|
createRenderEffect(() => {
|
|
let v = value();
|
|
while (typeof v === "function")
|
|
v = v();
|
|
current = insertExpression(parent, v, current, marker);
|
|
});
|
|
return () => current;
|
|
} else if (Array.isArray(value)) {
|
|
const array = [];
|
|
const currentArray = current && Array.isArray(current);
|
|
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
return () => current;
|
|
}
|
|
if (sharedConfig.context) {
|
|
for (let i = 0; i < array.length; i++) {
|
|
if (array[i].parentNode)
|
|
return current = array;
|
|
}
|
|
}
|
|
if (array.length === 0) {
|
|
current = cleanChildren(parent, current, marker);
|
|
if (multi)
|
|
return current;
|
|
} else if (currentArray) {
|
|
if (current.length === 0) {
|
|
appendNodes(parent, array, marker);
|
|
} else
|
|
reconcileArrays(parent, current, array);
|
|
} else {
|
|
current && cleanChildren(parent);
|
|
appendNodes(parent, array);
|
|
}
|
|
current = array;
|
|
} else if (value instanceof Node) {
|
|
if (sharedConfig.context && value.parentNode)
|
|
return current = multi ? [value] : value;
|
|
if (Array.isArray(current)) {
|
|
if (multi)
|
|
return current = cleanChildren(parent, current, marker, value);
|
|
cleanChildren(parent, current, null, value);
|
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
parent.appendChild(value);
|
|
} else
|
|
parent.replaceChild(value, parent.firstChild);
|
|
current = value;
|
|
} else
|
|
console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
return current;
|
|
}
|
|
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
let dynamic = false;
|
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
let item = array[i], prev = current && current[i];
|
|
if (item instanceof Node) {
|
|
normalized.push(item);
|
|
} else if (item == null || item === true || item === false)
|
|
;
|
|
else if (Array.isArray(item)) {
|
|
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
} else if (typeof item === "function") {
|
|
if (unwrap) {
|
|
while (typeof item === "function")
|
|
item = item();
|
|
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
|
|
} else {
|
|
normalized.push(item);
|
|
dynamic = true;
|
|
}
|
|
} else {
|
|
const value = String(item);
|
|
if (prev && prev.nodeType === 3 && prev.data === value) {
|
|
normalized.push(prev);
|
|
} else
|
|
normalized.push(document.createTextNode(value));
|
|
}
|
|
}
|
|
return dynamic;
|
|
}
|
|
function appendNodes(parent, array, marker) {
|
|
for (let i = 0, len = array.length; i < len; i++)
|
|
parent.insertBefore(array[i], marker);
|
|
}
|
|
function cleanChildren(parent, current, marker, replacement) {
|
|
if (marker === void 0)
|
|
return parent.textContent = "";
|
|
const node = replacement || document.createTextNode("");
|
|
if (current.length) {
|
|
let inserted = false;
|
|
for (let i = current.length - 1; i >= 0; i--) {
|
|
const el = current[i];
|
|
if (node !== el) {
|
|
const isParent = el.parentNode === parent;
|
|
if (!inserted && !i)
|
|
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
else
|
|
isParent && el.remove();
|
|
} else
|
|
inserted = true;
|
|
}
|
|
} else
|
|
parent.insertBefore(node, marker);
|
|
return [node];
|
|
}
|
|
function gatherHydratable(element, root) {
|
|
const templates = element.querySelectorAll(`*[data-hk]`);
|
|
for (let i = 0; i < templates.length; i++) {
|
|
const node = templates[i];
|
|
const key = node.getAttribute("data-hk");
|
|
if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key))
|
|
sharedConfig.registry.set(key, node);
|
|
}
|
|
}
|
|
function getHydrationKey() {
|
|
const hydrate2 = sharedConfig.context;
|
|
return `${hydrate2.id}${hydrate2.count++}`;
|
|
}
|
|
function Assets() {
|
|
return;
|
|
}
|
|
function NoHydration(props) {
|
|
return sharedConfig.context ? void 0 : props.children;
|
|
}
|
|
function throwInBrowser(func) {
|
|
const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
|
|
console.error(err);
|
|
}
|
|
function renderToString(fn, options) {
|
|
throwInBrowser(renderToString);
|
|
}
|
|
function renderToStringAsync(fn, options) {
|
|
throwInBrowser(renderToStringAsync);
|
|
}
|
|
function renderToStream(fn, options) {
|
|
throwInBrowser(renderToStream);
|
|
}
|
|
function ssr(template2, ...nodes) {
|
|
}
|
|
function resolveSSRNode(node) {
|
|
}
|
|
function ssrClassList(value) {
|
|
}
|
|
function ssrStyle(value) {
|
|
}
|
|
function ssrSpread(accessor) {
|
|
}
|
|
function ssrAttribute(key, value) {
|
|
}
|
|
function ssrHydrationKey() {
|
|
}
|
|
function escape(html) {
|
|
}
|
|
function generateHydrationScript() {
|
|
}
|
|
var isServer = false;
|
|
var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
function createElement(tagName, isSVG = false) {
|
|
return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
|
|
}
|
|
var hydrate = (...args) => {
|
|
enableHydration();
|
|
return hydrate$1(...args);
|
|
};
|
|
function Portal(props) {
|
|
const {
|
|
useShadow
|
|
} = props, marker = document.createTextNode(""), mount = props.mount || document.body;
|
|
function renderPortal() {
|
|
if (sharedConfig.context) {
|
|
const [s, set] = createSignal(false);
|
|
queueMicrotask(() => set(true));
|
|
return () => s() && props.children;
|
|
} else
|
|
return () => props.children;
|
|
}
|
|
if (mount instanceof HTMLHeadElement) {
|
|
const [clean, setClean] = createSignal(false);
|
|
const cleanup = () => setClean(true);
|
|
createRoot((dispose) => insert(mount, () => !clean() ? renderPortal()() : dispose(), null));
|
|
onCleanup(() => {
|
|
if (sharedConfig.context)
|
|
queueMicrotask(cleanup);
|
|
else
|
|
cleanup();
|
|
});
|
|
} else {
|
|
const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
|
|
mode: "open"
|
|
}) : container;
|
|
Object.defineProperty(container, "host", {
|
|
get() {
|
|
return marker.parentNode;
|
|
}
|
|
});
|
|
insert(renderRoot, renderPortal());
|
|
mount.appendChild(container);
|
|
props.ref && props.ref(container);
|
|
onCleanup(() => mount.removeChild(container));
|
|
}
|
|
return marker;
|
|
}
|
|
function Dynamic(props) {
|
|
const [p, others] = splitProps(props, ["component"]);
|
|
const cached = createMemo(() => p.component);
|
|
return createMemo(() => {
|
|
const component = cached();
|
|
switch (typeof component) {
|
|
case "function":
|
|
Object.assign(component, {
|
|
[$DEVCOMP]: true
|
|
});
|
|
return untrack(() => component(others));
|
|
case "string":
|
|
const isSvg = SVGElements.has(component);
|
|
const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg);
|
|
spread(el, others, isSvg);
|
|
return el;
|
|
}
|
|
});
|
|
}
|
|
|
|
export {
|
|
Properties,
|
|
ChildProperties,
|
|
Aliases,
|
|
PropAliases,
|
|
DelegatedEvents,
|
|
SVGElements,
|
|
SVGNamespace,
|
|
DOMElements,
|
|
memo,
|
|
render,
|
|
template,
|
|
delegateEvents,
|
|
clearDelegatedEvents,
|
|
setAttribute,
|
|
setAttributeNS,
|
|
className,
|
|
addEventListener,
|
|
classList,
|
|
style,
|
|
spread,
|
|
dynamicProperty,
|
|
innerHTML,
|
|
insert,
|
|
assign,
|
|
getNextElement,
|
|
getNextMatch,
|
|
getNextMarker,
|
|
runHydrationEvents,
|
|
getHydrationKey,
|
|
Assets,
|
|
NoHydration,
|
|
renderToString,
|
|
renderToStringAsync,
|
|
renderToStream,
|
|
ssr,
|
|
resolveSSRNode,
|
|
ssrClassList,
|
|
ssrStyle,
|
|
ssrSpread,
|
|
ssrAttribute,
|
|
ssrHydrationKey,
|
|
escape,
|
|
generateHydrationScript,
|
|
isServer,
|
|
hydrate,
|
|
Portal,
|
|
Dynamic
|
|
};
|
|
//# sourceMappingURL=chunk-4XRXA77J.js.map
|