2023-09-05 09:25:47 +02:00
|
|
|
//deka-dom-el library is available via global namespace `dde`
|
|
|
|
(()=> {
|
2023-09-13 13:20:00 +02:00
|
|
|
// src/signals-common.js
|
2023-10-13 16:51:43 +02:00
|
|
|
var w = {
|
2023-09-21 12:35:27 +02:00
|
|
|
isSignal(e) {
|
|
|
|
return !1;
|
2023-09-13 13:20:00 +02:00
|
|
|
},
|
2023-09-19 12:34:42 +02:00
|
|
|
processReactiveAttribute(e, t, n, r) {
|
|
|
|
return n;
|
2023-09-13 13:20:00 +02:00
|
|
|
}
|
|
|
|
};
|
2023-10-13 16:37:04 +02:00
|
|
|
function N(e, t = !0) {
|
2023-10-13 16:51:43 +02:00
|
|
|
return t ? Object.assign(w, e) : (Object.setPrototypeOf(e, w), e);
|
2023-09-13 13:20:00 +02:00
|
|
|
}
|
2023-10-13 16:51:43 +02:00
|
|
|
function x(e) {
|
|
|
|
return w.isPrototypeOf(e) && e !== w ? e : w;
|
2023-09-13 13:20:00 +02:00
|
|
|
}
|
|
|
|
|
2023-09-05 09:25:47 +02:00
|
|
|
// src/helpers.js
|
2023-10-13 16:37:04 +02:00
|
|
|
function v(e) {
|
2023-09-13 13:20:00 +02:00
|
|
|
return typeof e > "u";
|
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
function j(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);
|
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
function A(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-13 16:51:43 +02:00
|
|
|
var T = { setDeleteAttr: k };
|
|
|
|
function k(e, t, n) {
|
2023-10-13 16:37:04 +02:00
|
|
|
if (Reflect.set(e, t, n), !!v(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-13 16:51:43 +02:00
|
|
|
var y = [{ scope: document.body, namespace: "html", host: (e) => e ? e(document.body) : document.body }], W = (e) => e === "svg" ? "http://www.w3.org/2000/svg" : e, E = {
|
2023-10-10 10:55:00 +02:00
|
|
|
get current() {
|
2023-10-13 16:51:43 +02:00
|
|
|
return y[y.length - 1];
|
2023-10-10 10:55:00 +02:00
|
|
|
},
|
|
|
|
get state() {
|
2023-10-13 16:51:43 +02:00
|
|
|
return [...y];
|
2023-10-10 10:55:00 +02:00
|
|
|
},
|
|
|
|
get host() {
|
|
|
|
return this.current.host;
|
|
|
|
},
|
|
|
|
get namespace() {
|
|
|
|
return this.current.namespace;
|
|
|
|
},
|
|
|
|
set namespace(e) {
|
2023-10-13 16:51:43 +02:00
|
|
|
return this.current.namespace = W(e);
|
2023-10-10 10:55:00 +02:00
|
|
|
},
|
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) {
|
2023-10-13 16:37:04 +02:00
|
|
|
return E.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 = {}) {
|
2023-10-13 16:51:43 +02:00
|
|
|
return e.namespace && (e.namespace = W(e.namespace)), y.push(Object.assign({}, this.current, e));
|
2023-10-09 13:49:38 +02:00
|
|
|
},
|
2023-10-10 10:55:00 +02:00
|
|
|
pop() {
|
2023-10-13 16:51:43 +02:00
|
|
|
return y.pop();
|
2023-10-09 13:49:38 +02:00
|
|
|
}
|
2023-10-10 10:55:00 +02:00
|
|
|
};
|
2023-10-13 16:37:04 +02:00
|
|
|
function ie(e, t, ...n) {
|
2023-10-13 17:13:03 +02:00
|
|
|
let r = this, o = x(this), { namespace: c } = E, d = !1, s;
|
2023-09-21 17:04:40 +02:00
|
|
|
switch ((Object(t) !== t || o.isSignal(t)) && (t = { textContent: t }), !0) {
|
2023-09-09 21:15:43 +02:00
|
|
|
case typeof e == "function": {
|
2023-10-13 17:13:03 +02:00
|
|
|
d = !0, E.push({ scope: e, host: (f) => f ? (n.unshift(f), void 0) : s }), s = e(t || void 0);
|
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-13 17:13:03 +02:00
|
|
|
s = O.call(r, document.createTextNode(""), t);
|
2023-09-08 20:18:58 +02:00
|
|
|
break;
|
|
|
|
case e === "<>":
|
2023-10-13 17:13:03 +02:00
|
|
|
s = O.call(r, document.createDocumentFragment(), t);
|
2023-09-05 09:25:47 +02:00
|
|
|
break;
|
2023-10-13 16:37:04 +02:00
|
|
|
case c !== "html":
|
2023-10-13 17:13:03 +02:00
|
|
|
s = O.call(r, document.createElementNS(c, e), t);
|
2023-09-05 09:25:47 +02:00
|
|
|
break;
|
2023-10-13 17:13:03 +02:00
|
|
|
case !s:
|
|
|
|
s = O.call(r, document.createElement(e), t);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 17:13:03 +02:00
|
|
|
return n.forEach((f) => f(s)), d && E.pop(), s;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:51:43 +02:00
|
|
|
var { setDeleteAttr: M } = T;
|
2023-10-13 16:37:04 +02:00
|
|
|
function O(e, ...t) {
|
2023-10-13 16:51:43 +02:00
|
|
|
let n = this, r = x(this);
|
2023-09-05 09:25:47 +02:00
|
|
|
if (!t.length)
|
|
|
|
return e;
|
2023-10-13 16:37:04 +02:00
|
|
|
let c = (e instanceof SVGElement ? J : I).bind(null, e, "Attribute");
|
2023-10-13 17:13:03 +02:00
|
|
|
return Object.entries(Object.assign({}, ...t)).forEach(function d([s, f]) {
|
|
|
|
f = r.processReactiveAttribute(e, s, f, d);
|
2023-10-13 16:37:04 +02:00
|
|
|
let [m] = s;
|
|
|
|
if (m === "=")
|
2023-10-13 17:13:03 +02:00
|
|
|
return c(s.slice(1), f);
|
2023-10-13 16:37:04 +02:00
|
|
|
if (m === ".")
|
2023-10-13 17:13:03 +02:00
|
|
|
return F(e, s.slice(1), f);
|
2023-10-10 10:55:00 +02:00
|
|
|
if (/(aria|data)([A-Z])/.test(s))
|
2023-10-13 17:13:03 +02:00
|
|
|
return s = s.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), c(s, f);
|
2023-10-10 10:55:00 +02:00
|
|
|
switch (s === "className" && (s = "class"), s) {
|
2023-09-21 13:14:55 +02:00
|
|
|
case "xlink:href":
|
2023-10-13 17:13:03 +02:00
|
|
|
return c(s, f, "http://www.w3.org/1999/xlink");
|
2023-09-05 09:25:47 +02:00
|
|
|
case "textContent":
|
2023-10-13 17:13:03 +02:00
|
|
|
return M(e, s, f);
|
2023-09-21 14:37:20 +02:00
|
|
|
case "style":
|
2023-10-13 17:13:03 +02:00
|
|
|
if (typeof f != "object")
|
2023-09-21 16:27:00 +02:00
|
|
|
break;
|
2023-09-21 14:37:20 +02:00
|
|
|
case "dataset":
|
2023-10-13 17:13:03 +02:00
|
|
|
return D(r, f, F.bind(null, e[s]));
|
2023-09-21 14:37:20 +02:00
|
|
|
case "ariaset":
|
2023-10-13 17:13:03 +02:00
|
|
|
return D(r, f, (b, i) => c("aria-" + b, i));
|
2023-09-21 14:37:20 +02:00
|
|
|
case "classList":
|
2023-10-13 17:13:03 +02:00
|
|
|
return B.call(n, e, f);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 17:13:03 +02:00
|
|
|
return G(e, s) ? M(e, s, f) : c(s, f);
|
2023-09-05 09:25:47 +02:00
|
|
|
}), e;
|
|
|
|
}
|
2023-09-21 12:35:27 +02:00
|
|
|
function B(e, t) {
|
2023-10-13 16:51:43 +02:00
|
|
|
let n = x(this);
|
2023-10-13 16:37:04 +02:00
|
|
|
return D(
|
2023-09-21 12:35:27 +02:00
|
|
|
n,
|
2023-09-05 09:25:47 +02:00
|
|
|
t,
|
2023-09-21 12:35:27 +02:00
|
|
|
(r, o) => e.classList.toggle(r, o === -1 ? void 0 : !!o)
|
2023-09-05 09:25:47 +02:00
|
|
|
), e;
|
|
|
|
}
|
2023-10-09 13:49:38 +02:00
|
|
|
function fe(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 G(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 = z(e, t);
|
2023-10-13 16:37:04 +02:00
|
|
|
return !v(n.set);
|
2023-09-06 14:54:28 +02:00
|
|
|
}
|
2023-10-10 10:55:00 +02:00
|
|
|
function z(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-21 16:27:00 +02:00
|
|
|
let n = Object.getOwnPropertyDescriptor(e, t);
|
2023-10-10 10:55:00 +02:00
|
|
|
return n || z(e, t);
|
2023-09-06 14:54:28 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
function D(e, t, n) {
|
2023-09-21 16:27:00 +02:00
|
|
|
if (!(typeof t != "object" || t === null))
|
2023-10-13 16:37:04 +02:00
|
|
|
return Object.entries(t).forEach(function([o, c]) {
|
2023-10-13 17:13:03 +02:00
|
|
|
o && (c = e.processReactiveAttribute(t, o, c, (d) => n(...d)), n(o, c));
|
2023-09-21 14:37:20 +02:00
|
|
|
});
|
2023-09-21 12:35:27 +02:00
|
|
|
}
|
2023-10-13 16:51:43 +02:00
|
|
|
function U(e) {
|
2023-09-21 12:35:27 +02:00
|
|
|
return Array.isArray(e) ? e.filter(Boolean).join(" ") : e;
|
2023-09-19 12:34:42 +02:00
|
|
|
}
|
2023-10-10 10:55:00 +02:00
|
|
|
function I(e, t, n, r) {
|
2023-10-13 16:51:43 +02:00
|
|
|
return e[(v(r) ? "remove" : "set") + t](n, U(r));
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-10 10:55:00 +02:00
|
|
|
function J(e, t, n, r, o = null) {
|
2023-10-13 16:51:43 +02:00
|
|
|
return e[(v(r) ? "remove" : "set") + t + "NS"](o, n, U(r));
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
function F(e, t, n) {
|
|
|
|
if (Reflect.set(e, t, n), !!v(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-13 16:37:04 +02:00
|
|
|
function le(e, t, ...n) {
|
2023-09-19 12:34:42 +02:00
|
|
|
let r = n.length ? new CustomEvent(t, { detail: n[0] }) : new Event(t);
|
|
|
|
return e.dispatchEvent(r);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:51:43 +02:00
|
|
|
function S(e, t, n) {
|
2023-09-09 21:15:43 +02:00
|
|
|
return function(o) {
|
2023-09-19 12:34:42 +02:00
|
|
|
return o.addEventListener(e, t, n), o;
|
2023-09-09 21:15:43 +02:00
|
|
|
};
|
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
var R = Z(), V = /* @__PURE__ */ new WeakSet();
|
2023-10-13 16:51:43 +02:00
|
|
|
S.connected = function(e, t) {
|
2023-10-13 16:37:04 +02:00
|
|
|
let n = "connected";
|
|
|
|
return typeof t != "object" && (t = {}), t.once = !0, function(o) {
|
|
|
|
let c = "dde:" + n;
|
2023-10-13 16:51:43 +02:00
|
|
|
return o.addEventListener(c, e, t), o.__dde_lifecycleToEvents ? o : o.isConnected ? (o.dispatchEvent(new Event(c)), o) : (A(t.signal, () => R.offConnected(o, e)) && R.onConnected(o, e), o);
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
};
|
2023-10-13 16:51:43 +02:00
|
|
|
S.disconnected = function(e, t) {
|
2023-10-13 16:37:04 +02:00
|
|
|
let n = "disconnected";
|
|
|
|
return typeof t != "object" && (t = {}), t.once = !0, function(o) {
|
|
|
|
let c = "dde:" + n;
|
2023-10-13 16:51:43 +02:00
|
|
|
return o.addEventListener(c, e, t), o.__dde_lifecycleToEvents || A(t.signal, () => R.offDisconnected(o, e)) && R.onDisconnected(o, e), o;
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
};
|
2023-10-13 16:51:43 +02:00
|
|
|
S.attributeChanged = function(e, t) {
|
2023-10-13 16:37:04 +02:00
|
|
|
let n = "attributeChanged";
|
|
|
|
return typeof t != "object" && (t = {}), function(o) {
|
|
|
|
let c = "dde:" + n;
|
2023-10-13 16:51:43 +02:00
|
|
|
if (o.addEventListener(c, e, t), o.__dde_lifecycleToEvents || V.has(o))
|
2023-10-13 16:37:04 +02:00
|
|
|
return o;
|
2023-10-13 17:13:03 +02:00
|
|
|
let d = new MutationObserver(function(f) {
|
|
|
|
for (let { attributeName: m, target: b } of f)
|
2023-10-13 16:37:04 +02:00
|
|
|
b.dispatchEvent(
|
|
|
|
new CustomEvent(c, { detail: [m, b.getAttribute(m)] })
|
|
|
|
);
|
|
|
|
});
|
2023-10-13 17:13:03 +02:00
|
|
|
return A(t.signal, () => d.disconnect()) && d.observe(o, { attributes: !0 }), o;
|
2023-10-13 16:37:04 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
function Z() {
|
|
|
|
let e = /* @__PURE__ */ new Map(), t = !1, n = new MutationObserver(function(i) {
|
|
|
|
for (let u of i)
|
|
|
|
if (u.type === "childList") {
|
|
|
|
if (m(u.addedNodes, !0)) {
|
2023-10-13 17:13:03 +02:00
|
|
|
d();
|
2023-09-05 09:25:47 +02:00
|
|
|
continue;
|
|
|
|
}
|
2023-10-13 17:13:03 +02:00
|
|
|
b(u.removedNodes, !0) && d();
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return {
|
2023-10-13 16:37:04 +02:00
|
|
|
onConnected(i, u) {
|
|
|
|
c();
|
2023-10-13 17:13:03 +02:00
|
|
|
let a = o(i);
|
|
|
|
a.connected.has(u) || (a.connected.add(u), a.length_c += 1);
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-10-13 16:37:04 +02:00
|
|
|
offConnected(i, u) {
|
|
|
|
if (!e.has(i))
|
2023-09-05 09:25:47 +02:00
|
|
|
return;
|
2023-10-13 17:13:03 +02:00
|
|
|
let a = e.get(i);
|
|
|
|
a.connected.has(u) && (a.connected.delete(u), a.length_c -= 1, r(i, a));
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-10-13 16:37:04 +02:00
|
|
|
onDisconnected(i, u) {
|
|
|
|
c();
|
2023-10-13 17:13:03 +02:00
|
|
|
let a = o(i);
|
|
|
|
a.disconnected.has(u) || (a.disconnected.add(u), a.length_d += 1);
|
2023-09-05 09:25:47 +02:00
|
|
|
},
|
2023-10-13 16:37:04 +02:00
|
|
|
offDisconnected(i, u) {
|
|
|
|
if (!e.has(i))
|
2023-09-05 09:25:47 +02:00
|
|
|
return;
|
2023-10-13 17:13:03 +02:00
|
|
|
let a = e.get(i);
|
|
|
|
a.disconnected.has(u) && (a.disconnected.delete(u), a.length_d -= 1, r(i, a));
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
};
|
2023-10-13 16:37:04 +02:00
|
|
|
function r(i, u) {
|
2023-10-13 17:13:03 +02:00
|
|
|
u.length_c || u.length_d || (e.delete(i), d());
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
function o(i) {
|
|
|
|
if (e.has(i))
|
|
|
|
return e.get(i);
|
|
|
|
let u = {
|
2023-10-09 13:49:38 +02:00
|
|
|
connected: /* @__PURE__ */ new WeakSet(),
|
|
|
|
length_c: 0,
|
|
|
|
disconnected: /* @__PURE__ */ new WeakSet(),
|
|
|
|
length_d: 0
|
|
|
|
};
|
2023-10-13 16:37:04 +02:00
|
|
|
return e.set(i, u), u;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
function c() {
|
2023-09-19 12:34:42 +02:00
|
|
|
t || (t = !0, n.observe(document.body, { childList: !0, subtree: !0 }));
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 17:13:03 +02:00
|
|
|
function d() {
|
2023-09-19 12:34:42 +02:00
|
|
|
!t || e.size || (t = !1, n.disconnect());
|
2023-09-11 18:32:05 +02:00
|
|
|
}
|
2023-10-10 10:55:00 +02:00
|
|
|
function s() {
|
2023-10-13 16:37:04 +02:00
|
|
|
return new Promise(function(i) {
|
|
|
|
(requestIdleCallback || requestAnimationFrame)(i);
|
2023-09-05 09:25:47 +02:00
|
|
|
});
|
|
|
|
}
|
2023-10-13 17:13:03 +02:00
|
|
|
async function f(i) {
|
2023-10-10 10:55:00 +02:00
|
|
|
e.size > 30 && await s();
|
2023-10-13 16:37:04 +02:00
|
|
|
let u = [];
|
|
|
|
if (!(i instanceof Node))
|
|
|
|
return u;
|
2023-10-13 17:13:03 +02:00
|
|
|
for (let a of e.keys())
|
|
|
|
a === i || !(a instanceof Node) || i.contains(a) && u.push(a);
|
2023-10-13 16:37:04 +02:00
|
|
|
return u;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
function m(i, u) {
|
2023-10-13 17:13:03 +02:00
|
|
|
let a = !1;
|
2023-10-13 16:37:04 +02:00
|
|
|
for (let p of i) {
|
2023-10-13 17:13:03 +02:00
|
|
|
if (u && f(p).then(m), !e.has(p))
|
2023-09-09 21:15:43 +02:00
|
|
|
continue;
|
2023-10-13 16:51:43 +02:00
|
|
|
let _ = e.get(p);
|
2023-10-13 17:13:03 +02:00
|
|
|
_.length_c && (p.dispatchEvent(new Event("dde:connected")), _.connected = /* @__PURE__ */ new WeakSet(), _.length_c = 0, _.length_d || e.delete(p), a = !0);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 17:13:03 +02:00
|
|
|
return a;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
function b(i, u) {
|
2023-10-13 17:13:03 +02:00
|
|
|
let a = !1;
|
2023-10-13 16:37:04 +02:00
|
|
|
for (let p of i)
|
2023-10-13 17:13:03 +02:00
|
|
|
u && f(p).then(b), !(!e.has(p) || !e.get(p).length_d) && (p.dispatchEvent(new Event("dde:disconnected")), e.delete(p), a = !0);
|
|
|
|
return a;
|
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-19 12:34:42 +02:00
|
|
|
e.prototype.append = function(...n) {
|
|
|
|
return t.apply(this, n), this;
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
// src/signals-lib.js
|
2023-10-13 16:37:04 +02:00
|
|
|
var l = Symbol.for("Signal");
|
|
|
|
function C(e) {
|
2023-09-05 09:25:47 +02:00
|
|
|
try {
|
2023-10-13 16:37:04 +02:00
|
|
|
return Reflect.has(e, l);
|
2023-09-05 09:25:47 +02:00
|
|
|
} catch {
|
|
|
|
return !1;
|
|
|
|
}
|
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
var g = /* @__PURE__ */ new WeakMap();
|
|
|
|
function h(e, t) {
|
2023-09-05 09:25:47 +02:00
|
|
|
if (typeof e != "function")
|
2023-10-13 16:51:43 +02:00
|
|
|
return $(e, t);
|
2023-10-13 16:37:04 +02:00
|
|
|
if (C(e))
|
2023-09-05 09:25:47 +02:00
|
|
|
return e;
|
2023-10-13 16:51:43 +02:00
|
|
|
let n = $(""), r = () => n(e());
|
2023-10-13 16:37:04 +02:00
|
|
|
return g.set(r, /* @__PURE__ */ new Set([n])), X(r), n;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
h.action = function(e, t, ...n) {
|
|
|
|
let r = e[l], { actions: o } = r;
|
2023-09-05 09:25:47 +02:00
|
|
|
if (!o || !Reflect.has(o, t))
|
|
|
|
throw new Error(`'${e}' has no action with name '${t}'!`);
|
2023-09-19 12:34:42 +02:00
|
|
|
if (o[t].apply(r, n), r.skip)
|
|
|
|
return Reflect.deleteProperty(r, "skip");
|
2023-10-13 16:37:04 +02:00
|
|
|
r.listeners.forEach((c) => c(r.value));
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
2023-10-13 16:37:04 +02:00
|
|
|
h.on = function e(t, n, r = {}) {
|
2023-09-19 12:34:42 +02:00
|
|
|
let { signal: o } = r;
|
2023-09-07 17:35:23 +02:00
|
|
|
if (!(o && o.aborted)) {
|
|
|
|
if (Array.isArray(t))
|
2023-10-13 16:37:04 +02:00
|
|
|
return t.forEach((c) => e(c, n, r));
|
2023-10-13 16:51:43 +02:00
|
|
|
P(t, n), o && o.addEventListener("abort", () => H(t, n));
|
2023-09-07 17:35:23 +02:00
|
|
|
}
|
|
|
|
};
|
2023-10-13 16:37:04 +02:00
|
|
|
h.symbols = {
|
|
|
|
signal: l,
|
2023-09-07 17:35:23 +02:00
|
|
|
onclear: Symbol.for("Signal.onclear")
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
2023-10-13 16:37:04 +02:00
|
|
|
h.attribute = function(e, t = void 0) {
|
|
|
|
let { host: n } = E, r = n() && n().hasAttribute(e) ? n().getAttribute(e) : t, o = new AbortController(), c = h(r, {
|
|
|
|
[h.symbols.onclear]() {
|
|
|
|
o.abort();
|
|
|
|
}
|
|
|
|
});
|
2023-10-13 17:13:03 +02:00
|
|
|
return E.host(S.attributeChanged(function({ detail: d }) {
|
|
|
|
let [s, f] = d;
|
|
|
|
s === e && c(f);
|
2023-10-13 16:37:04 +02:00
|
|
|
}, { signal: o.signal })), c;
|
|
|
|
};
|
|
|
|
h.clear = function(...e) {
|
2023-09-19 12:34:42 +02:00
|
|
|
for (let n of e) {
|
|
|
|
Reflect.deleteProperty(n, "toJSON");
|
2023-10-13 16:37:04 +02:00
|
|
|
let r = n[l], { onclear: o } = h.symbols;
|
|
|
|
r.actions && r.actions[o] && r.actions[o].call(r), t(n, r), Reflect.deleteProperty(n, l);
|
2023-09-08 10:52:45 +02:00
|
|
|
}
|
2023-09-19 12:34:42 +02:00
|
|
|
function t(n, r) {
|
|
|
|
r.listeners.forEach((o) => {
|
2023-10-13 16:37:04 +02:00
|
|
|
if (r.listeners.delete(o), !g.has(o))
|
2023-09-08 10:52:45 +02:00
|
|
|
return;
|
2023-10-13 16:37:04 +02:00
|
|
|
let c = g.get(o);
|
|
|
|
c.delete(n), !(c.size > 1) && (h.clear(...c), g.delete(o));
|
2023-09-08 10:52:45 +02:00
|
|
|
});
|
2023-09-07 17:35:23 +02:00
|
|
|
}
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
2023-10-13 16:37:04 +02:00
|
|
|
h.el = function(e, t) {
|
2023-09-19 12:34:42 +02:00
|
|
|
let n = document.createComment("<#reactive>"), r = document.createComment("</#reactive>"), o = document.createDocumentFragment();
|
|
|
|
o.append(n, r);
|
2023-10-13 17:13:03 +02:00
|
|
|
let c = (d) => {
|
2023-09-19 12:34:42 +02:00
|
|
|
if (!n.parentNode || !r.parentNode)
|
2023-10-13 16:51:43 +02:00
|
|
|
return H(e, c);
|
2023-10-13 17:13:03 +02:00
|
|
|
let s = t(d);
|
2023-10-10 10:55:00 +02:00
|
|
|
Array.isArray(s) || (s = [s]);
|
2023-10-13 17:13:03 +02:00
|
|
|
let f = n;
|
|
|
|
for (; (f = n.nextSibling) !== r; )
|
|
|
|
f.remove();
|
2023-10-10 10:55:00 +02:00
|
|
|
n.after(...s);
|
2023-09-08 20:18:58 +02:00
|
|
|
};
|
2023-10-13 16:37:04 +02:00
|
|
|
return P(e, c), c(e()), o;
|
2023-09-08 20:18:58 +02:00
|
|
|
};
|
2023-10-13 16:51:43 +02:00
|
|
|
var q = {
|
2023-10-13 16:37:04 +02:00
|
|
|
isSignal: C,
|
2023-09-19 12:34:42 +02:00
|
|
|
processReactiveAttribute(e, t, n, r) {
|
2023-10-13 16:37:04 +02:00
|
|
|
return C(n) ? (P(n, (o) => r([t, o])), n()) : n;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
};
|
2023-10-13 16:51:43 +02:00
|
|
|
function $(e, t) {
|
2023-10-13 16:37:04 +02:00
|
|
|
let n = (...r) => r.length ? te(n, ...r) : ee(n);
|
|
|
|
return Q(n, e, t);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
var K = Object.assign(/* @__PURE__ */ Object.create(null), {
|
2023-09-05 09:25:47 +02:00
|
|
|
stopPropagation() {
|
|
|
|
this.skip = !0;
|
|
|
|
}
|
|
|
|
});
|
2023-10-13 16:37:04 +02:00
|
|
|
function Q(e, t, n) {
|
|
|
|
return j(n) !== "[object Object]" && (n = {}), e[l] = {
|
2023-09-05 09:25:47 +02:00
|
|
|
value: t,
|
2023-09-19 12:34:42 +02:00
|
|
|
actions: n,
|
2023-09-05 09:25:47 +02:00
|
|
|
listeners: /* @__PURE__ */ new Set()
|
2023-10-13 16:37:04 +02:00
|
|
|
}, e.toJSON = () => e(), Object.setPrototypeOf(e[l], K), e;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
var L = [];
|
|
|
|
function X(e) {
|
2023-09-05 09:25:47 +02:00
|
|
|
let t = function() {
|
2023-10-13 16:37:04 +02:00
|
|
|
L.push(t), e(), L.pop();
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
2023-10-13 16:37:04 +02:00
|
|
|
g.has(e) && (g.set(t, g.get(e)), g.delete(e)), t();
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
function Y() {
|
|
|
|
return L[L.length - 1];
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
function ee(e) {
|
|
|
|
if (!e[l])
|
2023-09-05 09:25:47 +02:00
|
|
|
return;
|
2023-10-13 16:37:04 +02:00
|
|
|
let { value: t, listeners: n } = e[l], r = Y();
|
|
|
|
return r && n.add(r), g.has(r) && g.get(r).add(e), t;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
function te(e, t, n) {
|
|
|
|
if (!e[l])
|
2023-09-05 09:25:47 +02:00
|
|
|
return;
|
2023-10-13 16:37:04 +02:00
|
|
|
let r = e[l];
|
|
|
|
if (!(!n && r.value === t))
|
|
|
|
return r.value = t, r.listeners.forEach((o) => o(t)), t;
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:37:04 +02:00
|
|
|
function P(e, t) {
|
|
|
|
if (e[l])
|
|
|
|
return e[l].listeners.add(t);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
2023-10-13 16:51:43 +02:00
|
|
|
function H(e, t) {
|
2023-10-13 16:37:04 +02:00
|
|
|
if (e[l])
|
|
|
|
return e[l].listeners.delete(t);
|
2023-09-05 09:25:47 +02:00
|
|
|
}
|
|
|
|
|
2023-09-19 09:30:21 +02:00
|
|
|
// signals.js
|
2023-10-13 16:51:43 +02:00
|
|
|
N(q);
|
2023-09-05 09:25:47 +02:00
|
|
|
|
|
|
|
globalThis.dde= {
|
2023-10-13 16:37:04 +02:00
|
|
|
S: h,
|
|
|
|
assign: O,
|
2023-09-21 12:35:27 +02:00
|
|
|
classListDeclarative: B,
|
2023-10-13 16:37:04 +02:00
|
|
|
createElement: ie,
|
|
|
|
dispatchEvent: le,
|
|
|
|
el: ie,
|
2023-10-09 13:49:38 +02:00
|
|
|
empty: fe,
|
2023-10-13 16:37:04 +02:00
|
|
|
isSignal: C,
|
2023-10-13 16:51:43 +02:00
|
|
|
on: S,
|
2023-10-13 16:37:04 +02:00
|
|
|
registerReactivity: N,
|
|
|
|
scope: E
|
2023-09-05 09:25:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
})();
|