2023-09-13 13:20:00 +02:00
|
|
|
// src/signals-common.js
|
|
|
|
var g = {
|
2023-09-21 12:35:27 +02:00
|
|
|
isSignal(e) {
|
|
|
|
return !1;
|
2023-09-13 13:20:00 +02:00
|
|
|
},
|
|
|
|
processReactiveAttribute(e, t, r, n) {
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
};
|
2023-09-21 14:37:20 +02:00
|
|
|
function P(e, t = !0) {
|
2023-09-13 13:20:00 +02:00
|
|
|
return t ? Object.assign(g, e) : (Object.setPrototypeOf(e, g), e);
|
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function v(e) {
|
2023-09-13 13:20:00 +02:00
|
|
|
return g.isPrototypeOf(e) && e !== g ? e : g;
|
|
|
|
}
|
|
|
|
|
2023-09-05 09:25:47 +02:00
|
|
|
// src/helpers.js
|
2023-09-13 13:20:00 +02:00
|
|
|
function p(e) {
|
|
|
|
return typeof e > "u";
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function w(e, t) {
|
2023-09-09 21:15:43 +02:00
|
|
|
if (!e || !(e instanceof AbortSignal))
|
|
|
|
return !0;
|
|
|
|
if (!e.aborted)
|
|
|
|
return e.addEventListener("abort", t), function() {
|
|
|
|
e.removeEventListener("abort", t);
|
|
|
|
};
|
|
|
|
}
|
2023-09-05 09:25:47 +02:00
|
|
|
|
2023-09-13 13:20:00 +02:00
|
|
|
// src/dom-common.js
|
2023-09-21 14:37:20 +02:00
|
|
|
var C = { setDeleteAttr: y };
|
|
|
|
function y(e, t, r) {
|
2023-09-21 12:35:27 +02:00
|
|
|
if (Reflect.set(e, t, r), !!p(r)) {
|
|
|
|
if (e instanceof HTMLElement && e.getAttribute(t) === "undefined")
|
|
|
|
return e.removeAttribute(t);
|
|
|
|
if (Reflect.get(e, t) === "undefined")
|
|
|
|
return Reflect.set(e, t, "");
|
|
|
|
}
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// src/dom.js
|
2023-09-21 14:37:20 +02:00
|
|
|
var m = "html";
|
2023-09-21 12:35:27 +02:00
|
|
|
function I(e) {
|
2023-09-21 14:37:20 +02:00
|
|
|
return m = e === "svg" ? "http://www.w3.org/2000/svg" : e, {
|
2023-09-19 09:30:21 +02:00
|
|
|
append(...t) {
|
2023-09-21 14:37:20 +02:00
|
|
|
return m = "html", t.length === 1 ? t[0] : document.createDocumentFragment().append(...t);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function Z(e, t, ...r) {
|
|
|
|
let n = v(this), c;
|
|
|
|
switch ((Object(t) !== t || n.isSignal(t)) && (t = { textContent: t }), !0) {
|
2023-09-09 21:15:43 +02:00
|
|
|
case typeof e == "function": {
|
2023-09-21 12:35:27 +02:00
|
|
|
c = e(t || void 0, (l) => l ? (r.unshift(l), void 0) : c);
|
2023-09-05 09:25:47 +02:00
|
|
|
break;
|
2023-09-09 21:15:43 +02:00
|
|
|
}
|
2023-09-05 09:25:47 +02:00
|
|
|
case e === "#text":
|
2023-09-21 12:35:27 +02:00
|
|
|
c = x(document.createTextNode(""), t);
|
2023-09-05 09:25:47 +02:00
|
|
|
break;
|
2023-09-08 20:18:58 +02:00
|
|
|
case e === "<>":
|
2023-09-21 12:35:27 +02:00
|
|
|
c = x(document.createDocumentFragment(), t);
|
2023-09-05 09:25:47 +02:00
|
|
|
break;
|
2023-09-21 14:37:20 +02:00
|
|
|
case m !== "html":
|
|
|
|
c = x(document.createElementNS(m, e), t);
|
2023-09-08 20:18:58 +02:00
|
|
|
break;
|
2023-09-09 21:15:43 +02:00
|
|
|
case !c:
|
2023-09-21 12:35:27 +02:00
|
|
|
c = x(document.createElement(e), t);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
return r.forEach((d) => d(c)), c;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
var { setDeleteAttr: R } = C;
|
|
|
|
function x(e, ...t) {
|
|
|
|
let r = this, n = v(this);
|
2023-09-05 09:25:47 +02:00
|
|
|
if (!t.length)
|
|
|
|
return e;
|
2023-09-21 14:37:20 +02:00
|
|
|
let c = e instanceof SVGElement, d = (c ? F : j).bind(null, e, "Attribute");
|
2023-09-21 12:35:27 +02:00
|
|
|
return Object.entries(Object.assign({}, ...t)).forEach(function l([f, u]) {
|
|
|
|
u = n.processReactiveAttribute(e, f, u, l);
|
|
|
|
let [h] = f;
|
2023-09-19 12:34:42 +02:00
|
|
|
if (h === "=")
|
2023-09-21 12:35:27 +02:00
|
|
|
return d(f.slice(1), u);
|
2023-09-19 12:34:42 +02:00
|
|
|
if (h === ".")
|
2023-09-21 12:35:27 +02:00
|
|
|
return D(e, f.slice(1), u);
|
|
|
|
if (/(aria|data)([A-Z])/.test(f))
|
|
|
|
return f = f.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), d(f, u);
|
|
|
|
switch (f === "className" && (f = "class"), f) {
|
2023-09-08 15:57:51 +02:00
|
|
|
case "href":
|
2023-09-21 13:14:55 +02:00
|
|
|
case "src":
|
|
|
|
case "class":
|
|
|
|
case "xlink:href":
|
2023-09-21 12:35:27 +02:00
|
|
|
return d(f, u, "http://www.w3.org/1999/xlink");
|
2023-09-05 09:25:47 +02:00
|
|
|
case "textContent":
|
2023-09-21 13:14:55 +02:00
|
|
|
case "innerText":
|
2023-09-21 12:35:27 +02:00
|
|
|
return c ? e.appendChild(document.createTextNode(u)) : R(e, f, u);
|
2023-09-21 14:37:20 +02:00
|
|
|
case "style":
|
|
|
|
case "dataset":
|
|
|
|
return O(n, u, D.bind(null, e[f]));
|
|
|
|
case "ariaset":
|
|
|
|
return O(n, u, (E, o) => d("aria-" + E, o));
|
|
|
|
case "classList":
|
|
|
|
return _.call(r, e, u);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 14:37:20 +02:00
|
|
|
return T(e, f) ? R(e, f, u) : d(f, u);
|
2023-09-05 09:25:47 +02:00
|
|
|
}), e;
|
|
|
|
}
|
2023-09-21 14:37:20 +02:00
|
|
|
function _(e, t) {
|
2023-09-21 12:35:27 +02:00
|
|
|
let r = v(this);
|
2023-09-21 14:37:20 +02:00
|
|
|
return O(
|
2023-09-21 12:35:27 +02:00
|
|
|
r,
|
2023-09-05 09:25:47 +02:00
|
|
|
t,
|
2023-09-21 12:35:27 +02:00
|
|
|
(n, c) => e.classList.toggle(n, c === -1 ? void 0 : !!c)
|
2023-09-05 09:25:47 +02:00
|
|
|
), e;
|
|
|
|
}
|
2023-09-19 12:34:42 +02:00
|
|
|
function G(e) {
|
2023-09-05 09:25:47 +02:00
|
|
|
return Array.from(e.children).forEach((t) => t.remove()), e;
|
|
|
|
}
|
2023-09-21 14:37:20 +02:00
|
|
|
function T(e, t) {
|
2023-09-21 12:35:27 +02:00
|
|
|
if (!Reflect.has(e, t))
|
|
|
|
return !1;
|
|
|
|
let r = L(e, t);
|
|
|
|
return !p(r.set);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function L(e, t, r = 0) {
|
2023-09-06 14:54:28 +02:00
|
|
|
if (e = Object.getPrototypeOf(e), !e)
|
2023-09-21 12:35:27 +02:00
|
|
|
return {};
|
2023-09-11 18:32:05 +02:00
|
|
|
let n = Object.getOwnPropertyDescriptor(e, t);
|
2023-09-21 12:35:27 +02:00
|
|
|
return n || L(e, t, r + 1);
|
|
|
|
}
|
|
|
|
function O(e, t, r) {
|
2023-09-21 14:37:20 +02:00
|
|
|
if (typeof t == "object")
|
|
|
|
return Object.entries(t).forEach(function([c, d]) {
|
|
|
|
c && (d = e.processReactiveAttribute(t, c, d, (l) => r(...l)), r(c, d));
|
|
|
|
});
|
2023-09-06 14:54:28 +02:00
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function N(e) {
|
|
|
|
return Array.isArray(e) ? e.filter(Boolean).join(" ") : e;
|
2023-09-06 14:54:28 +02:00
|
|
|
}
|
2023-09-21 14:37:20 +02:00
|
|
|
function j(e, t, r, n) {
|
2023-09-21 12:35:27 +02:00
|
|
|
return e[(p(n) ? "remove" : "set") + t](r, N(n));
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function F(e, t, r, n, c = null) {
|
|
|
|
return e[(p(n) ? "remove" : "set") + t + "NS"](c, r, N(n));
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function D(e, t, r) {
|
2023-09-19 12:34:42 +02:00
|
|
|
if (Reflect.set(e, t, r), !!p(r))
|
|
|
|
return Reflect.deleteProperty(e, t);
|
|
|
|
}
|
2023-09-05 09:25:47 +02:00
|
|
|
|
|
|
|
// src/events.js
|
2023-09-21 12:35:27 +02:00
|
|
|
function J(e, t, ...r) {
|
2023-09-11 18:32:05 +02:00
|
|
|
let n = r.length ? new CustomEvent(t, { detail: r[0] }) : new Event(t);
|
|
|
|
return e.dispatchEvent(n);
|
2023-09-09 21:15:43 +02:00
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function S(e, t, r) {
|
2023-09-09 21:15:43 +02:00
|
|
|
return function(c) {
|
2023-09-11 18:32:05 +02:00
|
|
|
return c.addEventListener(e, t, r), c;
|
2023-09-09 21:15:43 +02:00
|
|
|
};
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 14:37:20 +02:00
|
|
|
var b = M();
|
2023-09-21 12:35:27 +02:00
|
|
|
S.connected = function(e, t) {
|
2023-09-11 18:32:05 +02:00
|
|
|
return function(n) {
|
2023-09-21 14:37:20 +02:00
|
|
|
return typeof n.connectedCallback == "function" ? (n.addEventListener("dde:connected", e, t), n) : (w(t && t.signal, () => b.offConnected(n, e)) && (n.isConnected ? e(new Event("dde:connected")) : b.onConnected(n, e)), n);
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
};
|
2023-09-21 12:35:27 +02:00
|
|
|
S.disconnected = function(e, t) {
|
2023-09-11 18:32:05 +02:00
|
|
|
return function(n) {
|
2023-09-21 14:37:20 +02:00
|
|
|
return typeof n.disconnectedCallback == "function" ? (n.addEventListener("dde:disconnected", e, t), n) : (w(t && t.signal, () => b.offDisconnected(n, e)) && b.onDisconnected(n, e), n);
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
};
|
2023-09-21 12:35:27 +02:00
|
|
|
function M() {
|
2023-09-11 18:32:05 +02:00
|
|
|
let e = /* @__PURE__ */ new Map(), t = !1, r = new MutationObserver(function(o) {
|
2023-09-21 12:35:27 +02:00
|
|
|
for (let s of o)
|
|
|
|
if (s.type === "childList") {
|
|
|
|
if (h(s.addedNodes, !0)) {
|
|
|
|
l();
|
2023-09-05 09:25:47 +02:00
|
|
|
continue;
|
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
E(s.removedNodes, !0) && l();
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return {
|
2023-09-21 12:35:27 +02:00
|
|
|
onConnected(o, s) {
|
|
|
|
d(), c(o).connected.push(s);
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-09-21 12:35:27 +02:00
|
|
|
offConnected(o, s) {
|
2023-09-06 14:54:28 +02:00
|
|
|
if (!e.has(o))
|
2023-09-05 09:25:47 +02:00
|
|
|
return;
|
2023-09-21 12:35:27 +02:00
|
|
|
let i = e.get(o), a = i.connected;
|
|
|
|
a.splice(a.indexOf(s), 1), n(o, i);
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-09-21 12:35:27 +02:00
|
|
|
onDisconnected(o, s) {
|
|
|
|
d(), c(o).disconnected.push(s);
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-09-21 12:35:27 +02:00
|
|
|
offDisconnected(o, s) {
|
2023-09-06 14:54:28 +02:00
|
|
|
if (!e.has(o))
|
2023-09-05 09:25:47 +02:00
|
|
|
return;
|
2023-09-21 12:35:27 +02:00
|
|
|
let i = e.get(o), a = i.disconnected;
|
|
|
|
a.splice(a.indexOf(s), 1), n(o, i);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
};
|
2023-09-21 12:35:27 +02:00
|
|
|
function n(o, s) {
|
|
|
|
s.connected.length || s.disconnected.length || (e.delete(o), l());
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-09 21:15:43 +02:00
|
|
|
function c(o) {
|
2023-09-06 14:54:28 +02:00
|
|
|
if (e.has(o))
|
|
|
|
return e.get(o);
|
2023-09-21 12:35:27 +02:00
|
|
|
let s = { connected: [], disconnected: [] };
|
|
|
|
return e.set(o, s), s;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function d() {
|
2023-09-11 18:32:05 +02:00
|
|
|
t || (t = !0, r.observe(document.body, { childList: !0, subtree: !0 }));
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function l() {
|
2023-09-11 18:32:05 +02:00
|
|
|
!t || e.size || (t = !1, r.disconnect());
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-08 20:18:58 +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-21 12:35:27 +02:00
|
|
|
async function u(o) {
|
2023-09-08 20:18:58 +02:00
|
|
|
e.size > 30 && await f();
|
2023-09-21 12:35:27 +02:00
|
|
|
let s = [];
|
2023-09-06 14:54:28 +02:00
|
|
|
if (!(o instanceof Node))
|
2023-09-21 12:35:27 +02:00
|
|
|
return s;
|
|
|
|
for (let i of e.keys())
|
|
|
|
i === o || !(i instanceof Node) || o.contains(i) && s.push(i);
|
|
|
|
return s;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function h(o, s) {
|
|
|
|
for (let i of o) {
|
|
|
|
if (s && u(i).then(h), !e.has(i))
|
2023-09-09 21:15:43 +02:00
|
|
|
continue;
|
2023-09-21 12:35:27 +02:00
|
|
|
let a = e.get(i);
|
|
|
|
return a.connected.forEach((A) => A(i)), a.connected.length = 0, a.disconnected.length || e.delete(i), !0;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-09 21:15:43 +02:00
|
|
|
return !1;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function E(o, s) {
|
|
|
|
for (let i of o) {
|
|
|
|
if (s && u(i).then(E), !e.has(i))
|
2023-09-09 21:15:43 +02:00
|
|
|
continue;
|
2023-09-21 12:35:27 +02:00
|
|
|
let a = e.get(i);
|
|
|
|
return a.disconnected.forEach((A) => A(i)), a.connected.length = 0, a.disconnected.length = 0, e.delete(i), !0;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-09 21:15:43 +02:00
|
|
|
return !1;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// index.js
|
|
|
|
[HTMLElement, DocumentFragment].forEach((e) => {
|
|
|
|
let { append: t } = e.prototype;
|
2023-09-11 18:32:05 +02:00
|
|
|
e.prototype.append = function(...r) {
|
|
|
|
return t.apply(this, r), this;
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
});
|
|
|
|
export {
|
2023-09-21 12:35:27 +02:00
|
|
|
x as assign,
|
2023-09-21 14:37:20 +02:00
|
|
|
_ as classListDeclarative,
|
2023-09-21 12:35:27 +02:00
|
|
|
Z as createElement,
|
|
|
|
J as dispatchEvent,
|
|
|
|
Z as el,
|
2023-09-19 12:34:42 +02:00
|
|
|
G as empty,
|
2023-09-21 12:35:27 +02:00
|
|
|
I as namespace,
|
|
|
|
S as on,
|
2023-09-21 14:37:20 +02:00
|
|
|
P as registerReactivity
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|