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