2023-09-05 09:25:47 +02:00
|
|
|
// src/helpers.js
|
2023-09-06 14:54:28 +02:00
|
|
|
function y(e) {
|
2023-09-05 09:25:47 +02:00
|
|
|
let t = typeof e;
|
|
|
|
return t !== "object" ? t : e === null ? "null" : Object.prototype.toString.call(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
// src/signals-common.js
|
2023-09-06 14:54:28 +02:00
|
|
|
var p = {
|
2023-09-05 09:25:47 +02:00
|
|
|
isReactiveAtrribute(e, t) {
|
|
|
|
return !1;
|
|
|
|
},
|
|
|
|
isTextContent(e) {
|
2023-09-06 14:54:28 +02:00
|
|
|
return y(e) !== "[object Object]";
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-09-06 14:54:28 +02:00
|
|
|
processReactiveAttribute(e, t, n, r) {
|
2023-09-05 09:25:47 +02:00
|
|
|
return !1;
|
|
|
|
},
|
|
|
|
reactiveElement(e, ...t) {
|
|
|
|
return document.createDocumentFragment();
|
|
|
|
}
|
|
|
|
};
|
2023-09-06 14:54:28 +02:00
|
|
|
function D(e, t = !0) {
|
|
|
|
return t ? Object.assign(p, e) : (Object.setPrototypeOf(e, p), e);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function O(e) {
|
|
|
|
return p.isPrototypeOf(e) && e !== p ? e : p;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// src/dom.js
|
2023-09-06 14:54:28 +02:00
|
|
|
var m = "html";
|
|
|
|
function z(e) {
|
|
|
|
return m = e === "svg" ? "http://www.w3.org/2000/svg" : e, {
|
2023-09-05 09:25:47 +02:00
|
|
|
append(t) {
|
2023-09-06 14:54:28 +02:00
|
|
|
return m = "html", t;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function I(e, t, ...n) {
|
|
|
|
let r = O(this), i;
|
2023-09-05 09:25:47 +02:00
|
|
|
if (e === "<>") {
|
2023-09-06 14:54:28 +02:00
|
|
|
if (r.isReactiveAtrribute(t))
|
|
|
|
return r.reactiveElement(t, ...n);
|
|
|
|
i = document.createDocumentFragment();
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
switch (r.isTextContent(t) && (t = { textContent: t }), !0) {
|
2023-09-05 09:25:47 +02:00
|
|
|
case typeof e == "function":
|
2023-09-06 14:54:28 +02:00
|
|
|
i = e(t || void 0);
|
2023-09-05 09:25:47 +02:00
|
|
|
break;
|
|
|
|
case e === "#text":
|
2023-09-06 14:54:28 +02:00
|
|
|
i = C(document.createTextNode(""), t);
|
2023-09-05 09:25:47 +02:00
|
|
|
break;
|
2023-09-06 14:54:28 +02:00
|
|
|
case m !== "html":
|
|
|
|
i = C(document.createElementNS(m, e), t);
|
2023-09-05 09:25:47 +02:00
|
|
|
break;
|
2023-09-06 14:54:28 +02:00
|
|
|
case !i:
|
|
|
|
i = C(document.createElement(e), t);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
return n.forEach((d) => d(i)), i;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
var w = /* @__PURE__ */ new Map();
|
|
|
|
function C(e, ...t) {
|
|
|
|
let n = O(this);
|
2023-09-05 09:25:47 +02:00
|
|
|
if (!t.length)
|
|
|
|
return e;
|
2023-09-06 14:54:28 +02:00
|
|
|
let r = e instanceof SVGElement, i = (r ? S : R).bind(null, e, "Attribute");
|
|
|
|
return Object.entries(Object.assign({}, ...t)).forEach(function d([u, f]) {
|
|
|
|
n.isReactiveAtrribute(f, u) && (f = n.processReactiveAttribute(el, u, f, d));
|
|
|
|
let [l] = u;
|
|
|
|
if (l === "=")
|
|
|
|
return i(u.slice(1), f);
|
|
|
|
if (l === ".")
|
|
|
|
return j(e, u.slice(1), f);
|
2023-09-05 09:25:47 +02:00
|
|
|
if (typeof f == "object")
|
2023-09-06 14:54:28 +02:00
|
|
|
switch (u) {
|
2023-09-05 09:25:47 +02:00
|
|
|
case "style":
|
2023-09-06 14:54:28 +02:00
|
|
|
return b(f, R.bind(null, e.style, "Property"));
|
2023-09-05 09:25:47 +02:00
|
|
|
case "dataset":
|
2023-09-06 14:54:28 +02:00
|
|
|
return b(f, j.bind(null, e.dataset));
|
2023-09-05 09:25:47 +02:00
|
|
|
case "ariaset":
|
2023-09-06 14:54:28 +02:00
|
|
|
return b(f, (h, g) => i("aria-" + h, g));
|
2023-09-05 09:25:47 +02:00
|
|
|
case "classList":
|
2023-09-06 14:54:28 +02:00
|
|
|
return L(e, f);
|
2023-09-05 09:25:47 +02:00
|
|
|
default:
|
2023-09-06 14:54:28 +02:00
|
|
|
return Reflect.set(e, u, f);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
if (/(aria|data)([A-Z])/.test(u))
|
|
|
|
return u = u.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), i(u, f);
|
|
|
|
switch (u) {
|
2023-09-05 09:25:47 +02:00
|
|
|
case "xlink:href":
|
2023-09-06 14:54:28 +02:00
|
|
|
return i(u, f, "http://www.w3.org/1999/xlink");
|
2023-09-05 09:25:47 +02:00
|
|
|
case "textContent":
|
2023-09-06 14:54:28 +02:00
|
|
|
if (!r)
|
2023-09-05 09:25:47 +02:00
|
|
|
break;
|
|
|
|
return e.appendChild(document.createTextNode(f));
|
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
return P(e, u) ? j(e, u, f) : i(u, f);
|
2023-09-05 09:25:47 +02:00
|
|
|
}), e;
|
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function L(e, t) {
|
|
|
|
return typeof t != "object" || b(
|
2023-09-05 09:25:47 +02:00
|
|
|
t,
|
2023-09-06 14:54:28 +02:00
|
|
|
(n, r) => e.classList.toggle(n, r === -1 ? void 0 : !!r)
|
2023-09-05 09:25:47 +02:00
|
|
|
), e;
|
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function Z(e) {
|
2023-09-05 09:25:47 +02:00
|
|
|
return Array.from(e.children).forEach((t) => t.remove()), e;
|
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function P(e, t) {
|
|
|
|
let n = e.nodeName + "," + t;
|
|
|
|
if (w.has(n))
|
|
|
|
return w.get(n);
|
|
|
|
let r = A(e, t), i = !x(r.set);
|
|
|
|
return w.set(n, i), i;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function A(e, t) {
|
|
|
|
if (e = Object.getPrototypeOf(e), !e)
|
|
|
|
return {};
|
|
|
|
let n = Object.getOwnPropertyDescriptor(e, t);
|
|
|
|
return n || A(e, t);
|
|
|
|
}
|
|
|
|
function b(e, t) {
|
|
|
|
return Object.entries(e).forEach(([n, r]) => t(n, r));
|
|
|
|
}
|
|
|
|
function x(e) {
|
2023-09-05 09:25:47 +02:00
|
|
|
return typeof e > "u";
|
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function R(e, t, n, r) {
|
|
|
|
return e[(x(r) ? "remove" : "set") + t](n, r);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function S(e, t, n, r, i = null) {
|
|
|
|
return e[(x(r) ? "remove" : "set") + t + "NS"](i, n, r);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function j(e, t, n) {
|
|
|
|
return Reflect[x(n) ? "deleteProperty" : "set"](e, t, n);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// src/events.js
|
2023-09-06 14:54:28 +02:00
|
|
|
function N(e, t, n) {
|
|
|
|
return (r) => (r.addEventListener(e, t, n), r);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
var v = T();
|
|
|
|
N.connected = function(e, t) {
|
|
|
|
return function(r) {
|
|
|
|
v.onConnected(r, e), t && t.signal && t.signal.addEventListener("abort", () => v.offConnected(r, e));
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
};
|
2023-09-06 14:54:28 +02:00
|
|
|
N.disconnected = function(e, t) {
|
|
|
|
return function(r) {
|
|
|
|
v.onDisconnected(r, e), t && t.signal && t.signal.addEventListener("abort", () => v.offDisconnected(r, e));
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
};
|
2023-09-06 14:54:28 +02:00
|
|
|
function T() {
|
|
|
|
let e = /* @__PURE__ */ new Map(), t = !1, n = new MutationObserver(function(o) {
|
|
|
|
for (let c of o)
|
2023-09-05 09:25:47 +02:00
|
|
|
if (c.type === "childList") {
|
|
|
|
if (h(c.addedNodes, !0)) {
|
2023-09-06 14:54:28 +02:00
|
|
|
u();
|
2023-09-05 09:25:47 +02:00
|
|
|
continue;
|
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
g(c.removedNodes, !0) && u();
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return {
|
2023-09-06 14:54:28 +02:00
|
|
|
onConnected(o, c) {
|
|
|
|
d(), i(o).connected.push(c);
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-09-06 14:54:28 +02:00
|
|
|
offConnected(o, c) {
|
|
|
|
if (!e.has(o))
|
2023-09-05 09:25:47 +02:00
|
|
|
return;
|
2023-09-06 14:54:28 +02:00
|
|
|
let s = e.get(o), a = s.connected;
|
|
|
|
a.splice(a.indexOf(c), 1), r(o, s);
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-09-06 14:54:28 +02:00
|
|
|
onDisconnected(o, c) {
|
|
|
|
d(), i(o).disconnected.push(c);
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-09-06 14:54:28 +02:00
|
|
|
offDisconnected(o, c) {
|
|
|
|
if (!e.has(o))
|
2023-09-05 09:25:47 +02:00
|
|
|
return;
|
2023-09-06 14:54:28 +02:00
|
|
|
let s = e.get(o), a = s.disconnected;
|
|
|
|
a.splice(a.indexOf(c), 1), r(o, s);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
};
|
2023-09-06 14:54:28 +02:00
|
|
|
function r(o, c) {
|
|
|
|
c.connected.length || c.disconnect.length || (e.delete(o), u());
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function i(o) {
|
|
|
|
if (e.has(o))
|
|
|
|
return e.get(o);
|
2023-09-05 09:25:47 +02:00
|
|
|
let c = { connected: [], disconnected: [] };
|
2023-09-06 14:54:28 +02:00
|
|
|
return e.set(o, c), c;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
function d() {
|
2023-09-06 14:54:28 +02:00
|
|
|
t || (t = !0, n.observe(document.body, { childList: !0, subtree: !0 }));
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function u() {
|
|
|
|
!t || e.size || (t = !1, n.disconnect());
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
function f() {
|
2023-09-06 14:54:28 +02:00
|
|
|
return new Promise(function(o) {
|
|
|
|
(requestIdleCallback || requestAnimationFrame)(o);
|
2023-09-05 09:25:47 +02:00
|
|
|
});
|
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
async function l(o) {
|
2023-09-05 09:25:47 +02:00
|
|
|
e.size > 30 && await f();
|
|
|
|
let c = [];
|
2023-09-06 14:54:28 +02:00
|
|
|
if (!(o instanceof Node))
|
2023-09-05 09:25:47 +02:00
|
|
|
return c;
|
|
|
|
for (let s of e.keys())
|
2023-09-06 14:54:28 +02:00
|
|
|
s === o || !(s instanceof Node) || o.contains(s) && c.push(s);
|
2023-09-05 09:25:47 +02:00
|
|
|
return c;
|
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function h(o, c) {
|
|
|
|
for (let s of o) {
|
|
|
|
if (c && l(s).then(h), !e.has(s))
|
2023-09-05 09:25:47 +02:00
|
|
|
return !1;
|
|
|
|
let a = e.get(s);
|
2023-09-06 14:54:28 +02:00
|
|
|
return a.connected.forEach((E) => E(s)), a.connected.length = 0, a.disconnected.length || e.delete(s), !0;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
}
|
2023-09-06 14:54:28 +02:00
|
|
|
function g(o, c) {
|
|
|
|
for (let s of o) {
|
|
|
|
if (c && l(s).then(g), !e.has(s))
|
2023-09-05 09:25:47 +02:00
|
|
|
return !1;
|
|
|
|
let a = e.get(s);
|
2023-09-06 14:54:28 +02:00
|
|
|
return a.disconnected.forEach((E) => E(s)), a.connected.length = 0, a.disconnected.length = 0, e.delete(s), !0;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// index.js
|
|
|
|
[HTMLElement, DocumentFragment].forEach((e) => {
|
|
|
|
let { append: t } = e.prototype;
|
2023-09-06 14:54:28 +02:00
|
|
|
e.prototype.append = function(...n) {
|
|
|
|
return t.apply(this, n), this;
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
});
|
|
|
|
export {
|
2023-09-06 14:54:28 +02:00
|
|
|
C as assign,
|
|
|
|
L as classListDeclartive,
|
|
|
|
I as createElement,
|
|
|
|
I as el,
|
|
|
|
Z as empty,
|
|
|
|
z as namespace,
|
|
|
|
N as on,
|
|
|
|
D as registerReactivity
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|