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