1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2024-11-23 17:19:37 +01:00
deka-dom-el/dist/esm-with-signals.js

667 lines
17 KiB
JavaScript
Raw Normal View History

// src/signals-common.js
2024-05-17 22:13:16 +02:00
var k = {
isSignal(t) {
2024-05-17 22:13:16 +02:00
return !1;
},
processReactiveAttribute(t, e, n, r) {
return n;
}
};
function B(t, e = !0) {
return e ? Object.assign(k, t) : (Object.setPrototypeOf(t, k), t);
}
function W(t) {
return k.isPrototypeOf(t) && t !== k ? t : k;
}
// src/helpers.js
var T = (...t) => Object.prototype.hasOwnProperty.call(...t);
function S(t) {
2024-05-17 22:13:16 +02:00
return typeof t > "u";
}
function X(t) {
let e = typeof t;
return e !== "object" ? e : t === null ? "null" : Object.prototype.toString.call(t);
}
function q(t, e) {
if (!t || !(t instanceof AbortSignal))
return !0;
if (!t.aborted)
return t.addEventListener("abort", e), function() {
t.removeEventListener("abort", e);
};
}
function F(t, e) {
let { observedAttributes: n = [] } = t.constructor;
return n.reduce(function(r, o) {
return r[pt(o)] = e(t, o), r;
}, {});
}
function pt(t) {
return t.replace(/-./g, (e) => e[1].toUpperCase());
}
// src/dom-common.js
var d = {
setDeleteAttr: lt,
ssr: "",
D: globalThis.document,
F: globalThis.DocumentFragment,
H: globalThis.HTMLElement,
S: globalThis.SVGElement,
M: globalThis.MutationObserver
};
function lt(t, e, n) {
if (Reflect.set(t, e, n), !!S(n)) {
2024-05-17 22:13:16 +02:00
if (Reflect.deleteProperty(t, e), t instanceof d.H && t.getAttribute(e) === "undefined")
return t.removeAttribute(e);
if (Reflect.get(t, e) === "undefined")
return Reflect.set(t, e, "");
}
}
var O = "__dde_lifecyclesToEvents", _ = "dde:connected", C = "dde:disconnected", M = "dde:attributeChanged";
2024-05-17 22:13:16 +02:00
// src/dom.js
var A = [{
2024-05-17 22:13:16 +02:00
get scope() {
return d.D.body;
},
host: (t) => t ? t(d.D.body) : d.D.body,
prevent: !0
}], m = {
get current() {
return A[A.length - 1];
2024-05-17 22:13:16 +02:00
},
get host() {
return this.current.host;
},
preventDefault() {
let { current: t } = this;
return t.prevent = !0, t;
},
get state() {
return [...A];
2024-05-17 22:13:16 +02:00
},
push(t = {}) {
return A.push(Object.assign({}, this.current, { prevent: !1 }, t));
2024-05-17 22:13:16 +02:00
},
pushRoot() {
return A.push(A[0]);
2024-05-17 22:13:16 +02:00
},
pop() {
if (A.length !== 1)
return A.pop();
2024-05-17 22:13:16 +02:00
}
};
function Y(...t) {
return this.appendOriginal(...t), this;
}
function ht(t) {
return t.append === Y || (t.appendOriginal = t.append, t.append = Y), t;
}
var $;
function P(t, e, ...n) {
let r = W(this), o = 0, c, i;
switch ((Object(e) !== e || r.isSignal(e)) && (e = { textContent: e }), !0) {
2024-05-17 22:13:16 +02:00
case typeof t == "function": {
o = 1, m.push({ scope: t, host: (...v) => v.length ? (o === 1 ? n.unshift(...v) : v.forEach((h) => h(i)), void 0) : i }), c = t(e || void 0);
2024-05-17 22:13:16 +02:00
let a = c instanceof d.F;
if (c.nodeName === "#comment") break;
let l = P.mark({
2024-05-17 22:13:16 +02:00
type: "component",
name: t.name,
host: a ? "this" : "parentElement"
});
c.prepend(l), a && (i = l);
2024-05-17 22:13:16 +02:00
break;
}
case t === "#text":
c = j.call(this, d.D.createTextNode(""), e);
2024-05-17 22:13:16 +02:00
break;
case (t === "<>" || !t):
c = j.call(this, d.D.createDocumentFragment(), e);
2024-05-17 22:13:16 +02:00
break;
case !!$:
c = j.call(this, d.D.createElementNS($, t), e);
2024-05-17 22:13:16 +02:00
break;
case !c:
c = j.call(this, d.D.createElement(t), e);
2024-05-17 22:13:16 +02:00
}
return ht(c), i || (i = c), n.forEach((a) => a(i)), o && m.pop(), o = 2, c;
2024-05-17 22:13:16 +02:00
}
function Wt(t, e, n) {
typeof e != "object" && (n = e, e = t);
let r = Symbol.for("default"), o = Array.from(e.querySelectorAll("slot")).reduce((i, a) => Reflect.set(i, a.name || r, a) && i, {}), c = T(o, r);
2024-05-17 22:13:16 +02:00
if (t.append = new Proxy(t.append, {
apply(i, a, l) {
if (l[0] === e) return i.apply(t, l);
if (!l.length) return t;
let v = d.D.createDocumentFragment();
for (let h of l) {
if (!h || !h.slot) {
c && v.append(h);
2024-05-17 22:13:16 +02:00
continue;
}
let x = h.slot, w = o[x];
vt(h, "remove", "slot"), w && (bt(w, h, n), Reflect.deleteProperty(o, x));
2024-05-17 22:13:16 +02:00
}
return c && (o[r].replaceWith(v), Reflect.deleteProperty(o, r)), t.append = i, t;
2024-05-17 22:13:16 +02:00
}
}), t !== e) {
let i = Array.from(t.childNodes);
i.forEach((a) => a.remove()), t.append(...i);
2024-05-17 22:13:16 +02:00
}
return e;
}
function bt(t, e, n) {
n && n(t, e);
try {
t.replaceWith(j(e, { className: [e.className, t.className], dataset: { ...t.dataset } }));
2024-05-17 22:13:16 +02:00
} catch {
t.replaceWith(e);
}
}
P.mark = function(t, e = !1) {
2024-05-17 22:13:16 +02:00
t = Object.entries(t).map(([o, c]) => o + `="${c}"`).join(" ");
let n = e ? "" : "/", r = d.D.createComment(`<dde:mark ${t}${d.ssr}${n}>`);
return e && (r.end = d.D.createComment("</dde:mark>")), r;
};
function qt(t) {
let e = this;
return function(...r) {
$ = t;
let o = P.call(e, ...r);
2024-05-17 22:13:16 +02:00
return $ = void 0, o;
};
}
var U = /* @__PURE__ */ new WeakMap(), { setDeleteAttr: tt } = d;
function j(t, ...e) {
if (!e.length) return t;
2024-05-17 22:13:16 +02:00
U.set(t, rt(t, this));
for (let [n, r] of Object.entries(Object.assign({}, ...e)))
nt.call(this, t, n, r);
return U.delete(t), t;
}
function nt(t, e, n) {
let { setRemoveAttr: r, s: o } = rt(t, this), c = this;
n = o.processReactiveAttribute(
t,
e,
n,
(a, l) => nt.call(c, t, a, l)
2024-05-17 22:13:16 +02:00
);
let [i] = e;
if (i === "=") return r(e.slice(1), n);
if (i === ".") return et(t, e.slice(1), n);
2024-05-17 22:13:16 +02:00
if (/(aria|data)([A-Z])/.test(e))
return e = e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), r(e, n);
switch (e === "className" && (e = "class"), e) {
case "xlink:href":
return r(e, n, "http://www.w3.org/1999/xlink");
case "textContent":
return tt(t, e, n);
case "style":
if (typeof n != "object") break;
/* falls through */
2024-05-17 22:13:16 +02:00
case "dataset":
return I(o, n, et.bind(null, t[e]));
case "ariaset":
return I(o, n, (a, l) => r("aria-" + a, l));
2024-05-17 22:13:16 +02:00
case "classList":
return gt.call(c, t, n);
2024-05-17 22:13:16 +02:00
}
return Et(t, e) ? tt(t, e, n) : r(e, n);
}
function rt(t, e) {
if (U.has(t)) return U.get(t);
2024-05-17 22:13:16 +02:00
let r = (t instanceof d.S ? xt : mt).bind(null, t, "Attribute"), o = W(e);
return { setRemoveAttr: r, s: o };
}
function gt(t, e) {
2024-05-17 22:13:16 +02:00
let n = W(this);
return I(
n,
e,
(r, o) => t.classList.toggle(r, o === -1 ? void 0 : !!o)
), t;
}
function Ft(t) {
return Array.from(t.children).forEach((e) => e.remove()), t;
}
function vt(t, e, n, r) {
2024-05-17 22:13:16 +02:00
return t instanceof d.H ? t[e + "Attribute"](n, r) : t[e + "AttributeNS"](null, n, r);
}
function Et(t, e) {
if (!(e in t)) return !1;
2024-05-17 22:13:16 +02:00
let n = ot(t, e);
return !S(n.set);
2024-05-17 22:13:16 +02:00
}
function ot(t, e) {
if (t = Object.getPrototypeOf(t), !t) return {};
2024-05-17 22:13:16 +02:00
let n = Object.getOwnPropertyDescriptor(t, e);
return n || ot(t, e);
}
function I(t, e, n) {
if (!(typeof e != "object" || e === null))
return Object.entries(e).forEach(function([o, c]) {
o && (c = t.processReactiveAttribute(e, o, c, n), n(o, c));
});
}
function ct(t) {
return Array.isArray(t) ? t.filter(Boolean).join(" ") : t;
}
function mt(t, e, n, r) {
return t[(S(r) ? "remove" : "set") + e](n, ct(r));
2024-05-17 22:13:16 +02:00
}
function xt(t, e, n, r, o = null) {
return t[(S(r) ? "remove" : "set") + e + "NS"](o, n, ct(r));
2024-05-17 22:13:16 +02:00
}
function et(t, e, n) {
if (Reflect.set(t, e, n), !!S(n))
2024-05-17 22:13:16 +02:00
return Reflect.deleteProperty(t, e);
}
// src/events-observer.js
var D = d.M ? yt() : new Proxy({}, {
2024-05-17 22:13:16 +02:00
get() {
return () => {
};
}
});
function yt() {
let t = /* @__PURE__ */ new Map(), e = !1, n = (s) => function(u) {
2024-05-17 22:13:16 +02:00
for (let f of u)
if (f.type === "childList") {
if (h(f.addedNodes, !0)) {
s();
2024-05-17 22:13:16 +02:00
continue;
}
x(f.removedNodes, !0) && s();
2024-05-17 22:13:16 +02:00
}
}, r = new d.M(n(a));
return {
observe(s) {
2024-05-17 22:13:16 +02:00
let u = new d.M(n(() => {
}));
return u.observe(s, { childList: !0, subtree: !0 }), () => u.disconnect();
2024-05-17 22:13:16 +02:00
},
onConnected(s, u) {
i();
let f = c(s);
2024-05-17 22:13:16 +02:00
f.connected.has(u) || (f.connected.add(u), f.length_c += 1);
},
offConnected(s, u) {
if (!t.has(s)) return;
let f = t.get(s);
f.connected.has(u) && (f.connected.delete(u), f.length_c -= 1, o(s, f));
2024-05-17 22:13:16 +02:00
},
onDisconnected(s, u) {
i();
let f = c(s);
2024-05-17 22:13:16 +02:00
f.disconnected.has(u) || (f.disconnected.add(u), f.length_d += 1);
},
offDisconnected(s, u) {
if (!t.has(s)) return;
let f = t.get(s);
f.disconnected.has(u) && (f.disconnected.delete(u), f.length_d -= 1, o(s, f));
2024-05-17 22:13:16 +02:00
}
};
function o(s, u) {
u.length_c || u.length_d || (t.delete(s), a());
2024-05-17 22:13:16 +02:00
}
function c(s) {
if (t.has(s)) return t.get(s);
2024-05-17 22:13:16 +02:00
let u = {
connected: /* @__PURE__ */ new WeakSet(),
length_c: 0,
disconnected: /* @__PURE__ */ new WeakSet(),
length_d: 0
};
return t.set(s, u), u;
2024-05-17 22:13:16 +02:00
}
function i() {
2024-05-17 22:13:16 +02:00
e || (e = !0, r.observe(d.D.body, { childList: !0, subtree: !0 }));
}
function a() {
!e || t.size || (e = !1, r.disconnect());
}
function l() {
return new Promise(function(s) {
(requestIdleCallback || requestAnimationFrame)(s);
2024-05-17 22:13:16 +02:00
});
}
async function v(s) {
t.size > 30 && await l();
2024-05-17 22:13:16 +02:00
let u = [];
if (!(s instanceof Node)) return u;
2024-05-17 22:13:16 +02:00
for (let f of t.keys())
f === s || !(f instanceof Node) || s.contains(f) && u.push(f);
2024-05-17 22:13:16 +02:00
return u;
}
function h(s, u) {
2024-05-17 22:13:16 +02:00
let f = !1;
for (let b of s) {
if (u && v(b).then(h), !t.has(b)) continue;
2024-05-17 22:13:16 +02:00
let N = t.get(b);
N.length_c && (b.dispatchEvent(new Event(_)), N.connected = /* @__PURE__ */ new WeakSet(), N.length_c = 0, N.length_d || t.delete(b), f = !0);
2024-05-17 22:13:16 +02:00
}
return f;
}
function x(s, u) {
2024-05-17 22:13:16 +02:00
let f = !1;
for (let b of s)
u && v(b).then(x), !(!t.has(b) || !t.get(b).length_d) && ((globalThis.queueMicrotask || setTimeout)(w(b)), f = !0);
2024-05-17 22:13:16 +02:00
return f;
}
function w(s) {
2024-05-17 22:13:16 +02:00
return () => {
s.isConnected || (s.dispatchEvent(new Event(C)), t.delete(s));
2024-05-17 22:13:16 +02:00
};
}
}
// src/customElement.js
function Zt(t, e, n, r = _t) {
2024-05-17 22:13:16 +02:00
m.push({
scope: t,
host: (...i) => i.length ? i.forEach((a) => a(t)) : t
2024-05-17 22:13:16 +02:00
}), typeof r == "function" && (r = r.call(t, t));
let o = t[O];
o || wt(t);
2024-05-17 22:13:16 +02:00
let c = n.call(t, r);
return o || t.dispatchEvent(new Event(_)), e.nodeType === 11 && typeof e.mode == "string" && t.addEventListener(C, D.observe(e), { once: !0 }), m.pop(), e.append(c);
2024-05-17 22:13:16 +02:00
}
function wt(t) {
2024-05-17 22:13:16 +02:00
return J(t.prototype, "connectedCallback", function(e, n, r) {
e.apply(n, r), n.dispatchEvent(new Event(_));
2024-05-17 22:13:16 +02:00
}), J(t.prototype, "disconnectedCallback", function(e, n, r) {
e.apply(n, r), (globalThis.queueMicrotask || setTimeout)(
() => !n.isConnected && n.dispatchEvent(new Event(C))
2024-05-17 22:13:16 +02:00
);
}), J(t.prototype, "attributeChangedCallback", function(e, n, r) {
let [o, , c] = r;
n.dispatchEvent(new CustomEvent(M, {
2024-05-17 22:13:16 +02:00
detail: [o, c]
})), e.apply(n, r);
}), t.prototype[O] = !0, t;
2024-05-17 22:13:16 +02:00
}
function J(t, e, n) {
t[e] = new Proxy(t[e] || (() => {
}), { apply: n });
}
function _t(t) {
2024-05-17 22:13:16 +02:00
return F(t, (e, n) => e.getAttribute(n));
}
// src/events.js
function Qt(t, e, n) {
return e || (e = {}), function(o, ...c) {
n && (c.unshift(o), o = typeof n == "function" ? n() : n);
let i = c.length ? new CustomEvent(t, Object.assign({ detail: c[0] }, e)) : new Event(t, e);
return o.dispatchEvent(i);
2024-05-17 22:13:16 +02:00
};
}
function y(t, e, n) {
2024-05-17 22:13:16 +02:00
return function(o) {
return o.addEventListener(t, e, n), o;
};
}
var it = (t) => Object.assign({}, typeof t == "object" ? t : null, { once: !0 });
y.connected = function(t, e) {
return e = it(e), function(r) {
return r.addEventListener(_, t, e), r[O] ? r : r.isConnected ? (r.dispatchEvent(new Event(_)), r) : (q(e.signal, () => D.offConnected(r, t)) && D.onConnected(r, t), r);
2024-05-17 22:13:16 +02:00
};
};
y.disconnected = function(t, e) {
return e = it(e), function(r) {
return r.addEventListener(C, t, e), r[O] || q(e.signal, () => D.offDisconnected(r, t)) && D.onDisconnected(r, t), r;
2024-05-17 22:13:16 +02:00
};
};
var Z = /* @__PURE__ */ new WeakMap();
y.disconnectedAsAbort = function(t) {
if (Z.has(t)) return Z.get(t);
2024-05-17 22:13:16 +02:00
let e = new AbortController();
return Z.set(t, e), t(y.disconnected(() => e.abort())), e;
2024-05-17 22:13:16 +02:00
};
var At = /* @__PURE__ */ new WeakSet();
y.attributeChanged = function(t, e) {
2024-05-17 22:13:16 +02:00
return typeof e != "object" && (e = {}), function(r) {
if (r.addEventListener(M, t, e), r[O] || At.has(r) || !d.M) return r;
let o = new d.M(function(i) {
for (let { attributeName: a, target: l } of i)
l.dispatchEvent(
new CustomEvent(M, { detail: [a, l.getAttribute(a)] })
2024-05-17 22:13:16 +02:00
);
});
return q(e.signal, () => o.disconnect()) && o.observe(r, { attributes: !0 }), r;
};
};
// src/signals-lib.js
var p = "__dde_signal";
2024-05-17 22:13:16 +02:00
function z(t) {
try {
return T(t, p);
} catch {
return !1;
}
}
var H = [], g = /* @__PURE__ */ new WeakMap();
2024-05-17 22:13:16 +02:00
function E(t, e) {
if (typeof t != "function")
return st(!1, t, e);
if (z(t)) return t;
let n = st(!0), r = function() {
let [o, ...c] = g.get(r);
if (g.set(r, /* @__PURE__ */ new Set([o])), H.push(r), dt(n, t()), H.pop(), !c.length) return;
let i = g.get(r);
2024-05-17 22:13:16 +02:00
for (let a of c)
i.has(a) || L(a, r);
2024-05-17 22:13:16 +02:00
};
return g.set(n[p], r), g.set(r, /* @__PURE__ */ new Set([n])), r(), n;
2024-05-17 22:13:16 +02:00
}
E.action = function(t, e, ...n) {
let r = t[p], { actions: o } = r;
if (!o || !(e in o))
throw new Error(`'${t}' has no action with name '${e}'!`);
if (o[e].apply(r, n), r.skip) return delete r.skip;
2024-05-17 22:13:16 +02:00
r.listeners.forEach((c) => c(r.value));
};
E.on = function t(e, n, r = {}) {
let { signal: o } = r;
if (!(o && o.aborted)) {
if (Array.isArray(e)) return e.forEach((c) => t(c, n, r));
2024-05-17 22:13:16 +02:00
Q(e, n), o && o.addEventListener("abort", () => L(e, n));
}
};
E.symbols = {
//signal: mark,
onclear: Symbol.for("Signal.onclear")
2024-05-17 22:13:16 +02:00
};
E.clear = function(...t) {
for (let n of t) {
let r = n[p];
r && (delete n.toJSON, r.onclear.forEach((o) => o.call(r)), e(n, r), delete n[p]);
}
function e(n, r) {
r.listeners.forEach((o) => {
if (r.listeners.delete(o), !g.has(o)) return;
let c = g.get(o);
c.delete(n), !(c.size > 1) && (n.clear(...c), g.delete(o));
2024-05-17 22:13:16 +02:00
});
}
};
var R = "__dde_reactive";
E.el = function(t, e) {
let n = P.mark({ type: "reactive" }, !0), r = n.end, o = d.D.createDocumentFragment();
2024-05-17 22:13:16 +02:00
o.append(n, r);
let { current: c } = m, i = {}, a = (l) => {
2024-05-17 22:13:16 +02:00
if (!n.parentNode || !r.parentNode)
return L(t, a);
let v = i;
i = {}, m.push(c);
let h = e(l, function(u, f) {
2024-05-17 22:13:16 +02:00
let b;
return T(v, u) ? (b = v[u], delete v[u]) : b = f(), i[u] = b, b;
2024-05-17 22:13:16 +02:00
});
m.pop(), Array.isArray(h) || (h = [h]);
2024-05-17 22:13:16 +02:00
let x = document.createComment("");
h.push(x), n.after(...h);
let w;
for (; (w = x.nextSibling) && w !== r; )
w.remove();
x.remove(), n.isConnected && St(c.host());
2024-05-17 22:13:16 +02:00
};
return Q(t, a), ft(t, a, n, e), a(t()), o;
};
function St(t) {
2024-05-17 22:13:16 +02:00
!t || !t[R] || (requestIdleCallback || setTimeout)(function() {
t[R] = t[R].filter(([e, n]) => n.isConnected ? !0 : (L(...e), !1));
});
}
var Ot = {
2024-05-17 22:13:16 +02:00
_set(t) {
this.value = t;
}
};
function Ct(t) {
2024-05-17 22:13:16 +02:00
return function(e, n) {
let r = (...c) => c.length ? e.setAttribute(n, ...c) : K(r), o = at(r, e.getAttribute(n), Ot);
2024-05-17 22:13:16 +02:00
return t[n] = o, o;
};
}
var G = "__dde_attributes";
E.observedAttributes = function(t) {
let e = t[G] = {}, n = F(t, Ct(e));
return y.attributeChanged(function({ detail: o }) {
/*! This maps attributes to signals (`S.observedAttributes`).
2024-05-17 22:13:16 +02:00
* Investigate `__dde_attributes` key of the element.*/
let [c, i] = o, a = this[G][c];
if (a) return E.action(a, "_set", i);
})(t), y.disconnected(function() {
/*! This removes all signals mapped to attributes (`S.observedAttributes`).
2024-05-17 22:13:16 +02:00
* Investigate `__dde_attributes` key of the element.*/
E.clear(...Object.values(this[G]));
})(t), n;
};
var ut = {
isSignal: z,
2024-05-17 22:13:16 +02:00
processReactiveAttribute(t, e, n, r) {
if (!z(n)) return n;
2024-05-17 22:13:16 +02:00
let o = (c) => {
if (!t.isConnected)
return L(n, o);
r(e, c);
};
return Q(n, o), ft(n, o, t, e), n();
}
};
function ft(t, e, ...n) {
let { current: r } = m;
r.prevent || r.host(function(o) {
o[R] || (o[R] = [], y.disconnected(
2024-05-17 22:13:16 +02:00
() => (
/*!
* Clears all Signals listeners added in the current scope/host (`S.el`, `assign`, ?).
2024-05-17 22:13:16 +02:00
* You can investigate the `__dde_reactive` key of the element.
* */
o[R].forEach(([[c, i]]) => L(c, i, c[p] && c[p].host && c[p].host() === o))
2024-05-17 22:13:16 +02:00
)
)(o)), o[R].push([[t, e], ...n]);
});
}
function st(t, e, n) {
2024-05-17 22:13:16 +02:00
let r = t ? () => K(r) : (...o) => o.length ? dt(r, ...o) : K(r);
return at(r, e, n, t);
}
var Dt = Object.assign(/* @__PURE__ */ Object.create(null), {
stopPropagation() {
this.skip = !0;
}
}), V = class extends Error {
constructor() {
super();
let [e, ...n] = this.stack.split(`
`), r = e.slice(e.indexOf("@"), e.indexOf(".js:") + 4);
this.stack = n.find((o) => !o.includes(r));
}
};
function at(t, e, n, r = !1) {
let o = [];
X(n) !== "[object Object]" && (n = {});
let { onclear: c } = E.symbols;
n[c] && (o.push(n[c]), delete n[c]);
let { host: i } = m;
2024-05-17 22:13:16 +02:00
return Reflect.defineProperty(t, p, {
value: {
value: e,
actions: n,
onclear: o,
host: i,
2024-05-17 22:13:16 +02:00
listeners: /* @__PURE__ */ new Set(),
defined: new V().stack,
readonly: r
},
enumerable: !1,
writable: !1,
configurable: !0
}), t.toJSON = () => t(), t.valueOf = () => t[p] && t[p].value, Object.setPrototypeOf(t[p], Dt), t;
}
function Rt() {
return H[H.length - 1];
}
function K(t) {
if (!t[p]) return;
2024-05-17 22:13:16 +02:00
let { value: e, listeners: n } = t[p], r = Rt();
return r && n.add(r), g.has(r) && g.get(r).add(t), e;
2024-05-17 22:13:16 +02:00
}
function dt(t, e, n) {
if (!t[p]) return;
2024-05-17 22:13:16 +02:00
let r = t[p];
if (!(!n && r.value === e))
return r.value = e, r.listeners.forEach((o) => o(e)), e;
}
function Q(t, e) {
if (t[p])
return t[p].listeners.add(e);
}
function L(t, e, n) {
let r = t[p];
if (!r) return;
2024-05-17 22:13:16 +02:00
let o = r.listeners.delete(e);
if (n && !r.listeners.size) {
if (E.clear(t), !g.has(r)) return o;
let c = g.get(r);
if (!g.has(c)) return o;
g.get(c).forEach((i) => L(i, c, !0));
2024-05-17 22:13:16 +02:00
}
return o;
}
// signals.js
2024-05-17 22:13:16 +02:00
B(ut);
export {
E as S,
j as assign,
2024-05-17 22:13:16 +02:00
nt as assignAttribute,
ht as chainableAppend,
gt as classListDeclarative,
P as createElement,
2024-05-17 22:13:16 +02:00
qt as createElementNS,
Zt as customElementRender,
wt as customElementWithDDE,
2024-05-17 22:13:16 +02:00
Qt as dispatchEvent,
P as el,
2024-05-17 22:13:16 +02:00
qt as elNS,
vt as elementAttribute,
2024-05-17 22:13:16 +02:00
Ft as empty,
z as isSignal,
wt as lifecyclesToEvents,
_t as observedAttributes,
y as on,
2024-05-17 22:13:16 +02:00
B as registerReactivity,
m as scope,
E as signal,
2024-05-17 22:13:16 +02:00
Wt as simulateSlots
};