2023-09-13 13:20:00 +02:00
|
|
|
// src/signals-common.js
|
2023-10-09 13:49:38 +02:00
|
|
|
var E = {
|
2023-09-21 12:35:27 +02:00
|
|
|
isSignal(e) {
|
|
|
|
return !1;
|
2023-09-13 13:20:00 +02:00
|
|
|
},
|
2023-10-09 13:49:38 +02:00
|
|
|
processReactiveAttribute(e, t, r, n) {
|
|
|
|
return r;
|
2023-09-13 13:20:00 +02:00
|
|
|
}
|
|
|
|
};
|
2023-10-09 13:49:38 +02:00
|
|
|
function N(e, t = !0) {
|
|
|
|
return t ? Object.assign(E, e) : (Object.setPrototypeOf(e, E), e);
|
2023-09-13 13:20:00 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
function m(e) {
|
|
|
|
return E.isPrototypeOf(e) && e !== E ? e : E;
|
2023-09-13 13:20:00 +02:00
|
|
|
}
|
|
|
|
|
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-10-09 13:49:38 +02:00
|
|
|
function _(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-10-09 13:49:38 +02:00
|
|
|
var O = { setDeleteAttr: P };
|
|
|
|
function P(e, t, r) {
|
|
|
|
if (Reflect.set(e, t, r), !!p(r)) {
|
2023-09-21 16:27:00 +02:00
|
|
|
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-10-09 13:49:38 +02:00
|
|
|
var h = "html", S = {
|
|
|
|
elNamespace(e) {
|
|
|
|
return h = e === "svg" ? "http://www.w3.org/2000/svg" : e, {
|
|
|
|
append(...t) {
|
|
|
|
return h = "html", t.length === 1 ? t[0] : document.createDocumentFragment().append(...t);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
get namespace() {
|
|
|
|
return h;
|
|
|
|
},
|
|
|
|
set namespace(e) {
|
|
|
|
return h = e;
|
|
|
|
}
|
|
|
|
}, H = Object.assign((e) => e ? e(document.body) : document.body, S);
|
|
|
|
function I(e, t, ...r) {
|
|
|
|
let n = this, u = m(this), i;
|
2023-09-21 17:04:40 +02:00
|
|
|
switch ((Object(t) !== t || u.isSignal(t)) && (t = { textContent: t }), !0) {
|
2023-09-09 21:15:43 +02:00
|
|
|
case typeof e == "function": {
|
2023-10-09 13:49:38 +02:00
|
|
|
let a = Object.assign((f) => f ? (r.unshift(f), void 0) : i, S);
|
|
|
|
i = e(t || void 0, a), h = "html";
|
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-10-09 13:49:38 +02:00
|
|
|
i = w.call(n, document.createTextNode(""), t);
|
2023-09-05 09:25:47 +02:00
|
|
|
break;
|
2023-09-08 20:18:58 +02:00
|
|
|
case e === "<>":
|
2023-10-09 13:49:38 +02:00
|
|
|
i = w.call(n, document.createDocumentFragment(), t);
|
2023-09-05 09:25:47 +02:00
|
|
|
break;
|
2023-10-09 13:49:38 +02:00
|
|
|
case h !== "html":
|
|
|
|
i = w.call(n, document.createElementNS(h, e), t);
|
2023-09-08 20:18:58 +02:00
|
|
|
break;
|
2023-09-21 17:04:40 +02:00
|
|
|
case !i:
|
2023-10-09 13:49:38 +02:00
|
|
|
i = w.call(n, document.createElement(e), t);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
return r.forEach((a) => a(i)), i;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
var { setDeleteAttr: R } = O;
|
|
|
|
function w(e, ...t) {
|
|
|
|
let r = this, n = m(this);
|
2023-09-05 09:25:47 +02:00
|
|
|
if (!t.length)
|
|
|
|
return e;
|
2023-10-09 13:49:38 +02:00
|
|
|
let i = (e instanceof SVGElement ? T : M).bind(null, e, "Attribute");
|
|
|
|
return Object.entries(Object.assign({}, ...t)).forEach(function a([f, d]) {
|
|
|
|
d = n.processReactiveAttribute(e, f, d, a);
|
|
|
|
let [g] = f;
|
|
|
|
if (g === "=")
|
2023-09-21 17:04:40 +02:00
|
|
|
return i(f.slice(1), d);
|
2023-10-09 13:49:38 +02:00
|
|
|
if (g === ".")
|
|
|
|
return C(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-10-09 13:49:38 +02:00
|
|
|
return R(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-10-09 13:49:38 +02:00
|
|
|
return A(n, d, C.bind(null, e[f]));
|
2023-09-21 14:37:20 +02:00
|
|
|
case "ariaset":
|
2023-10-09 13:49:38 +02:00
|
|
|
return A(n, d, (b, c) => i("aria-" + b, c));
|
2023-09-21 14:37:20 +02:00
|
|
|
case "classList":
|
2023-10-09 13:49:38 +02:00
|
|
|
return j.call(r, e, d);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
return F(e, f) ? R(e, f, d) : i(f, d);
|
2023-09-05 09:25:47 +02:00
|
|
|
}), e;
|
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
function j(e, t) {
|
|
|
|
let r = m(this);
|
|
|
|
return A(
|
|
|
|
r,
|
2023-09-05 09:25:47 +02:00
|
|
|
t,
|
2023-10-09 13:49:38 +02:00
|
|
|
(n, u) => e.classList.toggle(n, 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-10-09 13:49:38 +02:00
|
|
|
function F(e, t) {
|
2023-09-21 12:35:27 +02:00
|
|
|
if (!Reflect.has(e, t))
|
|
|
|
return !1;
|
2023-10-09 13:49:38 +02:00
|
|
|
let r = y(e, t);
|
|
|
|
return !p(r.set);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
function y(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-10-09 13:49:38 +02:00
|
|
|
let r = Object.getOwnPropertyDescriptor(e, t);
|
|
|
|
return r || y(e, t);
|
2023-09-21 12:35:27 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
function A(e, t, r) {
|
2023-09-21 16:27:00 +02:00
|
|
|
if (!(typeof t != "object" || t === null))
|
2023-09-21 17:04:40 +02:00
|
|
|
return Object.entries(t).forEach(function([u, i]) {
|
2023-10-09 13:49:38 +02:00
|
|
|
u && (i = e.processReactiveAttribute(t, u, i, (a) => r(...a)), r(u, i));
|
2023-09-21 14:37:20 +02:00
|
|
|
});
|
2023-09-06 14:54:28 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
function D(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-10-09 13:49:38 +02:00
|
|
|
function M(e, t, r, n) {
|
|
|
|
return e[(p(n) ? "remove" : "set") + t](r, D(n));
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
function T(e, t, r, n, u = null) {
|
|
|
|
return e[(p(n) ? "remove" : "set") + t + "NS"](u, r, D(n));
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
function C(e, t, r) {
|
|
|
|
if (Reflect.set(e, t, r), !!p(r))
|
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-10-09 13:49:38 +02:00
|
|
|
function K(e, t, ...r) {
|
|
|
|
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-10-09 13:49:38 +02:00
|
|
|
function L(e, t, r) {
|
2023-09-21 17:04:40 +02:00
|
|
|
return function(u) {
|
2023-10-09 13:49:38 +02:00
|
|
|
return u.addEventListener(e, t, r), u;
|
2023-09-09 21:15:43 +02:00
|
|
|
};
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
var x = U();
|
|
|
|
L.connected = function(e, t) {
|
|
|
|
return typeof t != "object" && (t = {}), t.once = !0, function(n) {
|
|
|
|
return n.addEventListener("dde:connected", e, t), typeof n.connectedCallback == "function" ? n : n.isConnected ? (n.dispatchEvent(new Event("dde:connected")), n) : (_(t.signal, () => x.offConnected(n, e)) && x.onConnected(n, e), n);
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
};
|
2023-10-09 13:49:38 +02:00
|
|
|
L.disconnected = function(e, t) {
|
|
|
|
return typeof t != "object" && (t = {}), t.once = !0, function(n) {
|
|
|
|
return n.addEventListener("dde:disconnected", e, t), typeof n.disconnectedCallback == "function" || _(t.signal, () => x.offDisconnected(n, e)) && x.onDisconnected(n, e), n;
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
};
|
2023-10-09 13:49:38 +02:00
|
|
|
function U() {
|
|
|
|
let e = /* @__PURE__ */ new Map(), t = !1, r = new MutationObserver(function(c) {
|
|
|
|
for (let o of c)
|
|
|
|
if (o.type === "childList") {
|
|
|
|
if (g(o.addedNodes, !0)) {
|
|
|
|
a();
|
2023-09-05 09:25:47 +02:00
|
|
|
continue;
|
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
b(o.removedNodes, !0) && a();
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return {
|
2023-10-09 13:49:38 +02:00
|
|
|
onConnected(c, o) {
|
|
|
|
i();
|
|
|
|
let s = u(c);
|
|
|
|
s.connected.has(o) || (s.connected.add(o), s.length_c += 1);
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-10-09 13:49:38 +02:00
|
|
|
offConnected(c, o) {
|
|
|
|
if (!e.has(c))
|
2023-09-05 09:25:47 +02:00
|
|
|
return;
|
2023-10-09 13:49:38 +02:00
|
|
|
let s = e.get(c);
|
|
|
|
s.connected.has(o) && (s.connected.delete(o), s.length_c -= 1, n(c, s));
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-10-09 13:49:38 +02:00
|
|
|
onDisconnected(c, o) {
|
|
|
|
i();
|
|
|
|
let s = u(c);
|
|
|
|
s.disconnected.has(o) || (s.disconnected.add(o), s.length_d += 1);
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-10-09 13:49:38 +02:00
|
|
|
offDisconnected(c, o) {
|
|
|
|
if (!e.has(c))
|
2023-09-05 09:25:47 +02:00
|
|
|
return;
|
2023-10-09 13:49:38 +02:00
|
|
|
let s = e.get(c);
|
|
|
|
s.disconnected.has(o) && (s.disconnected.delete(o), s.length_d -= 1, n(c, s));
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
};
|
2023-10-09 13:49:38 +02:00
|
|
|
function n(c, o) {
|
|
|
|
o.length_c || o.length_d || (e.delete(c), a());
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
function u(c) {
|
|
|
|
if (e.has(c))
|
|
|
|
return e.get(c);
|
|
|
|
let o = {
|
|
|
|
connected: /* @__PURE__ */ new WeakSet(),
|
|
|
|
length_c: 0,
|
|
|
|
disconnected: /* @__PURE__ */ new WeakSet(),
|
|
|
|
length_d: 0
|
|
|
|
};
|
|
|
|
return e.set(c, o), o;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-09-21 17:04:40 +02:00
|
|
|
function i() {
|
2023-10-09 13:49:38 +02:00
|
|
|
t || (t = !0, r.observe(document.body, { childList: !0, subtree: !0 }));
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
function a() {
|
|
|
|
!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-10-09 13:49:38 +02:00
|
|
|
return new Promise(function(c) {
|
|
|
|
(requestIdleCallback || requestAnimationFrame)(c);
|
2023-09-05 09:25:47 +02:00
|
|
|
});
|
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
async function d(c) {
|
2023-09-08 20:18:58 +02:00
|
|
|
e.size > 30 && await f();
|
2023-10-09 13:49:38 +02:00
|
|
|
let o = [];
|
|
|
|
if (!(c instanceof Node))
|
|
|
|
return o;
|
2023-09-21 17:04:40 +02:00
|
|
|
for (let s of e.keys())
|
2023-10-09 13:49:38 +02:00
|
|
|
s === c || !(s instanceof Node) || c.contains(s) && o.push(s);
|
|
|
|
return o;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
function g(c, o) {
|
|
|
|
let s = !1;
|
|
|
|
for (let l of c) {
|
|
|
|
if (o && d(l).then(g), !e.has(l))
|
2023-09-09 21:15:43 +02:00
|
|
|
continue;
|
2023-10-09 13:49:38 +02:00
|
|
|
let v = e.get(l);
|
|
|
|
v.length_c && (l.dispatchEvent(new Event("dde:connected")), v.connected = /* @__PURE__ */ new WeakSet(), v.length_c = 0, v.length_d || e.delete(l), s = !0);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
return s;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
function b(c, o) {
|
|
|
|
let s = !1;
|
|
|
|
for (let l of c)
|
|
|
|
o && d(l).then(b), !(!e.has(l) || !e.get(l).length_d) && (l.dispatchEvent(new Event("dde:disconnected")), e.delete(l), s = !0);
|
|
|
|
return s;
|
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-10-09 13:49:38 +02:00
|
|
|
e.prototype.append = function(...r) {
|
|
|
|
return t.apply(this, r), this;
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
});
|
|
|
|
export {
|
2023-10-09 13:49:38 +02:00
|
|
|
w as assign,
|
|
|
|
j as classListDeclarative,
|
2023-09-21 16:27:00 +02:00
|
|
|
I as createElement,
|
2023-10-09 13:49:38 +02:00
|
|
|
K as dispatchEvent,
|
2023-09-21 16:27:00 +02:00
|
|
|
I as el,
|
|
|
|
Z as empty,
|
2023-10-09 13:49:38 +02:00
|
|
|
L as on,
|
|
|
|
N as registerReactivity,
|
|
|
|
H as scope
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|