mirror of
https://github.com/jaandrle/deka-dom-el
synced 2024-11-22 07:49:38 +01:00
📦
This commit is contained in:
parent
f632be61cf
commit
8e588b4e41
104
dist/dde-with-signals.js
vendored
104
dist/dde-with-signals.js
vendored
@ -65,15 +65,15 @@
|
|||||||
if (!t.length)
|
if (!t.length)
|
||||||
return e;
|
return e;
|
||||||
let n = e instanceof SVGElement, o = (n ? q : P).bind(null, e, "Attribute");
|
let n = e instanceof SVGElement, o = (n ? q : P).bind(null, e, "Attribute");
|
||||||
return Object.entries(Object.assign({}, ...t)).forEach(function a([f, s]) {
|
return Object.entries(Object.assign({}, ...t)).forEach(function a([i, s]) {
|
||||||
r.isReactiveAtrribute(s, f) && (s = r.processReactiveAttribute(e, f, s, a));
|
r.isReactiveAtrribute(s, i) && (s = r.processReactiveAttribute(e, i, s, a));
|
||||||
let [h] = f;
|
let [h] = i;
|
||||||
if (h === "=")
|
if (h === "=")
|
||||||
return o(f.slice(1), s);
|
return o(i.slice(1), s);
|
||||||
if (h === ".")
|
if (h === ".")
|
||||||
return N(e, f.slice(1), s);
|
return N(e, i.slice(1), s);
|
||||||
if (typeof s == "object")
|
if (typeof s == "object")
|
||||||
switch (f) {
|
switch (i) {
|
||||||
case "style":
|
case "style":
|
||||||
return y(s, P.bind(null, e.style, "Property"));
|
return y(s, P.bind(null, e.style, "Property"));
|
||||||
case "dataset":
|
case "dataset":
|
||||||
@ -81,24 +81,26 @@
|
|||||||
case "ariaset":
|
case "ariaset":
|
||||||
return y(s, (E, v) => o("aria-" + E, v));
|
return y(s, (E, v) => o("aria-" + E, v));
|
||||||
case "classList":
|
case "classList":
|
||||||
return F(e, s);
|
return $(e, s);
|
||||||
default:
|
default:
|
||||||
return Reflect.set(e, f, s);
|
return Reflect.set(e, i, s);
|
||||||
}
|
}
|
||||||
if (/(aria|data)([A-Z])/.test(f))
|
if (/(aria|data)([A-Z])/.test(i))
|
||||||
return f = f.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), o(f, s);
|
return i = i.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), o(i, s);
|
||||||
switch (f) {
|
switch (i) {
|
||||||
|
case "href":
|
||||||
|
return o(i, s);
|
||||||
case "xlink:href":
|
case "xlink:href":
|
||||||
return o(f, s, "http://www.w3.org/1999/xlink");
|
return o(i, s, "http://www.w3.org/1999/xlink");
|
||||||
case "textContent":
|
case "textContent":
|
||||||
if (!n)
|
if (!n)
|
||||||
break;
|
break;
|
||||||
return e.appendChild(document.createTextNode(s));
|
return e.appendChild(document.createTextNode(s));
|
||||||
}
|
}
|
||||||
return $(e, f) ? N(e, f, s) : o(f, s);
|
return k(e, i) ? N(e, i, s) : o(i, s);
|
||||||
}), e;
|
}), e;
|
||||||
}
|
}
|
||||||
function F(e, t) {
|
function $(e, t) {
|
||||||
return typeof t != "object" || y(
|
return typeof t != "object" || y(
|
||||||
t,
|
t,
|
||||||
(r, n) => e.classList.toggle(r, n === -1 ? void 0 : !!n)
|
(r, n) => e.classList.toggle(r, n === -1 ? void 0 : !!n)
|
||||||
@ -107,15 +109,15 @@
|
|||||||
function ne(e) {
|
function ne(e) {
|
||||||
return Array.from(e.children).forEach((t) => t.remove()), e;
|
return Array.from(e.children).forEach((t) => t.remove()), e;
|
||||||
}
|
}
|
||||||
function $(e, t) {
|
function k(e, t) {
|
||||||
let r = "HTMLElement," + t;
|
let r = "HTMLElement," + t;
|
||||||
if (e instanceof HTMLElement && x.has(r))
|
if (e instanceof HTMLElement && x.has(r))
|
||||||
return x.get(r);
|
return x.get(r);
|
||||||
let n = e.nodeName + "," + t;
|
let n = e.nodeName + "," + t;
|
||||||
if (x.has(n))
|
if (x.has(n))
|
||||||
return x.get(n);
|
return x.get(n);
|
||||||
let [o, a, f] = T(e, t), s = !_(o.set);
|
let [o, a, i] = T(e, t), s = !_(o.set);
|
||||||
return (!s || a) && x.set(f === HTMLElement.prototype ? r : n, s), s;
|
return (!s || a) && x.set(i === HTMLElement.prototype ? r : n, s), s;
|
||||||
}
|
}
|
||||||
function T(e, t, r = 0) {
|
function T(e, t, r = 0) {
|
||||||
if (e = Object.getPrototypeOf(e), !e)
|
if (e = Object.getPrototypeOf(e), !e)
|
||||||
@ -156,48 +158,48 @@
|
|||||||
};
|
};
|
||||||
function W() {
|
function W() {
|
||||||
let e = /* @__PURE__ */ new Map(), t = !1, r = new MutationObserver(function(c) {
|
let e = /* @__PURE__ */ new Map(), t = !1, r = new MutationObserver(function(c) {
|
||||||
for (let i of c)
|
for (let f of c)
|
||||||
if (i.type === "childList") {
|
if (f.type === "childList") {
|
||||||
if (E(i.addedNodes, !0)) {
|
if (E(f.addedNodes, !0)) {
|
||||||
f();
|
i();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
v(i.removedNodes, !0) && f();
|
v(f.removedNodes, !0) && i();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
onConnected(c, i) {
|
onConnected(c, f) {
|
||||||
a(), o(c).connected.push(i);
|
a(), o(c).connected.push(f);
|
||||||
},
|
},
|
||||||
offConnected(c, i) {
|
offConnected(c, f) {
|
||||||
if (!e.has(c))
|
if (!e.has(c))
|
||||||
return;
|
return;
|
||||||
let u = e.get(c), l = u.connected;
|
let u = e.get(c), l = u.connected;
|
||||||
l.splice(l.indexOf(i), 1), n(c, u);
|
l.splice(l.indexOf(f), 1), n(c, u);
|
||||||
},
|
},
|
||||||
onDisconnected(c, i) {
|
onDisconnected(c, f) {
|
||||||
a(), o(c).disconnected.push(i);
|
a(), o(c).disconnected.push(f);
|
||||||
},
|
},
|
||||||
offDisconnected(c, i) {
|
offDisconnected(c, f) {
|
||||||
if (!e.has(c))
|
if (!e.has(c))
|
||||||
return;
|
return;
|
||||||
let u = e.get(c), l = u.disconnected;
|
let u = e.get(c), l = u.disconnected;
|
||||||
l.splice(l.indexOf(i), 1), n(c, u);
|
l.splice(l.indexOf(f), 1), n(c, u);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function n(c, i) {
|
function n(c, f) {
|
||||||
i.connected.length || i.disconnect.length || (e.delete(c), f());
|
f.connected.length || f.disconnect.length || (e.delete(c), i());
|
||||||
}
|
}
|
||||||
function o(c) {
|
function o(c) {
|
||||||
if (e.has(c))
|
if (e.has(c))
|
||||||
return e.get(c);
|
return e.get(c);
|
||||||
let i = { connected: [], disconnected: [] };
|
let f = { connected: [], disconnected: [] };
|
||||||
return e.set(c, i), i;
|
return e.set(c, f), f;
|
||||||
}
|
}
|
||||||
function a() {
|
function a() {
|
||||||
t || (t = !0, r.observe(document.body, { childList: !0, subtree: !0 }));
|
t || (t = !0, r.observe(document.body, { childList: !0, subtree: !0 }));
|
||||||
}
|
}
|
||||||
function f() {
|
function i() {
|
||||||
!t || e.size || (t = !1, r.disconnect());
|
!t || e.size || (t = !1, r.disconnect());
|
||||||
}
|
}
|
||||||
function s() {
|
function s() {
|
||||||
@ -207,24 +209,24 @@
|
|||||||
}
|
}
|
||||||
async function h(c) {
|
async function h(c) {
|
||||||
e.size > 30 && await s();
|
e.size > 30 && await s();
|
||||||
let i = [];
|
let f = [];
|
||||||
if (!(c instanceof Node))
|
if (!(c instanceof Node))
|
||||||
return i;
|
return f;
|
||||||
for (let u of e.keys())
|
for (let u of e.keys())
|
||||||
u === c || !(u instanceof Node) || c.contains(u) && i.push(u);
|
u === c || !(u instanceof Node) || c.contains(u) && f.push(u);
|
||||||
return i;
|
return f;
|
||||||
}
|
}
|
||||||
function E(c, i) {
|
function E(c, f) {
|
||||||
for (let u of c) {
|
for (let u of c) {
|
||||||
if (i && h(u).then(E), !e.has(u))
|
if (f && h(u).then(E), !e.has(u))
|
||||||
return !1;
|
return !1;
|
||||||
let l = e.get(u);
|
let l = e.get(u);
|
||||||
return l.connected.forEach((C) => C(u)), l.connected.length = 0, l.disconnected.length || e.delete(u), !0;
|
return l.connected.forEach((C) => C(u)), l.connected.length = 0, l.disconnected.length || e.delete(u), !0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function v(c, i) {
|
function v(c, f) {
|
||||||
for (let u of c) {
|
for (let u of c) {
|
||||||
if (i && h(u).then(v), !e.has(u))
|
if (f && h(u).then(v), !e.has(u))
|
||||||
return !1;
|
return !1;
|
||||||
let l = e.get(u);
|
let l = e.get(u);
|
||||||
return l.disconnected.forEach((C) => C(u)), l.connected.length = 0, l.disconnected.length = 0, e.delete(u), !0;
|
return l.disconnected.forEach((C) => C(u)), l.connected.length = 0, l.disconnected.length = 0, e.delete(u), !0;
|
||||||
@ -271,7 +273,7 @@
|
|||||||
if (!(o && o.aborted)) {
|
if (!(o && o.aborted)) {
|
||||||
if (Array.isArray(t))
|
if (Array.isArray(t))
|
||||||
return t.forEach((a) => e(a, r, n));
|
return t.forEach((a) => e(a, r, n));
|
||||||
D(t, r), o && o.addEventListener("abort", () => z(t, r));
|
D(t, r), o && o.addEventListener("abort", () => F(t, r));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
g.symbols = {
|
g.symbols = {
|
||||||
@ -292,7 +294,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var k = {
|
var z = {
|
||||||
isReactiveAtrribute(e, t) {
|
isReactiveAtrribute(e, t) {
|
||||||
return R(e);
|
return R(e);
|
||||||
},
|
},
|
||||||
@ -305,10 +307,10 @@
|
|||||||
reactiveElement(e, t) {
|
reactiveElement(e, t) {
|
||||||
let r = document.createComment("<#reactive>"), n = document.createComment("</#reactive>"), o = document.createDocumentFragment();
|
let r = document.createComment("<#reactive>"), n = document.createComment("</#reactive>"), o = document.createDocumentFragment();
|
||||||
o.append(r, n);
|
o.append(r, n);
|
||||||
let a = (f) => {
|
let a = (i) => {
|
||||||
if (!r.parentNode || !n.parentNode)
|
if (!r.parentNode || !n.parentNode)
|
||||||
return z(e, a);
|
return F(e, a);
|
||||||
let s = t(f);
|
let s = t(i);
|
||||||
Array.isArray(s) || (s = [s]);
|
Array.isArray(s) || (s = [s]);
|
||||||
let h = r;
|
let h = r;
|
||||||
for (; (h = r.nextSibling) !== n; )
|
for (; (h = r.nextSibling) !== n; )
|
||||||
@ -363,17 +365,17 @@
|
|||||||
function D(e, t) {
|
function D(e, t) {
|
||||||
return e[d].listeners.add(t);
|
return e[d].listeners.add(t);
|
||||||
}
|
}
|
||||||
function z(e, t) {
|
function F(e, t) {
|
||||||
return e[d].listeners.delete(t);
|
return e[d].listeners.delete(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// src/signals.js
|
// src/signals.js
|
||||||
L(k);
|
L(z);
|
||||||
|
|
||||||
globalThis.dde= {
|
globalThis.dde= {
|
||||||
S: g,
|
S: g,
|
||||||
assign: A,
|
assign: A,
|
||||||
classListDeclartive: F,
|
classListDeclarative: $,
|
||||||
createElement: te,
|
createElement: te,
|
||||||
el: te,
|
el: te,
|
||||||
empty: ne,
|
empty: ne,
|
||||||
|
22
dist/dde.js
vendored
22
dist/dde.js
vendored
@ -88,6 +88,8 @@
|
|||||||
if (/(aria|data)([A-Z])/.test(i))
|
if (/(aria|data)([A-Z])/.test(i))
|
||||||
return i = i.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), f(i, u);
|
return i = i.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), f(i, u);
|
||||||
switch (i) {
|
switch (i) {
|
||||||
|
case "href":
|
||||||
|
return f(i, u);
|
||||||
case "xlink:href":
|
case "xlink:href":
|
||||||
return f(i, u, "http://www.w3.org/1999/xlink");
|
return f(i, u, "http://www.w3.org/1999/xlink");
|
||||||
case "textContent":
|
case "textContent":
|
||||||
@ -114,14 +116,14 @@
|
|||||||
let n = e.nodeName + "," + t;
|
let n = e.nodeName + "," + t;
|
||||||
if (h.has(n))
|
if (h.has(n))
|
||||||
return h.get(n);
|
return h.get(n);
|
||||||
let [f, d, i] = y(e, t), u = !L(f.set);
|
let [f, d, i] = R(e, t), u = !L(f.set);
|
||||||
return (!u || d) && h.set(i === HTMLElement.prototype ? r : n, u), u;
|
return (!u || d) && h.set(i === HTMLElement.prototype ? r : n, u), u;
|
||||||
}
|
}
|
||||||
function y(e, t, r = 0) {
|
function R(e, t, r = 0) {
|
||||||
if (e = Object.getPrototypeOf(e), !e)
|
if (e = Object.getPrototypeOf(e), !e)
|
||||||
return [{}, r, e];
|
return [{}, r, e];
|
||||||
let n = Object.getOwnPropertyDescriptor(e, t);
|
let n = Object.getOwnPropertyDescriptor(e, t);
|
||||||
return n ? [n, r, e] : y(e, t, r + 1);
|
return n ? [n, r, e] : R(e, t, r + 1);
|
||||||
}
|
}
|
||||||
function m(e, t) {
|
function m(e, t) {
|
||||||
return Object.entries(e).forEach(([r, n]) => t(r, n));
|
return Object.entries(e).forEach(([r, n]) => t(r, n));
|
||||||
@ -140,21 +142,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// src/events.js
|
// src/events.js
|
||||||
function R(e, t, r) {
|
function y(e, t, r) {
|
||||||
return (n) => (n.addEventListener(e, t, r), n);
|
return (n) => (n.addEventListener(e, t, r), n);
|
||||||
}
|
}
|
||||||
var E = P();
|
var E = _();
|
||||||
R.connected = function(e, t) {
|
y.connected = function(e, t) {
|
||||||
return function(n) {
|
return function(n) {
|
||||||
E.onConnected(n, e), t && t.signal && t.signal.addEventListener("abort", () => E.offConnected(n, e));
|
E.onConnected(n, e), t && t.signal && t.signal.addEventListener("abort", () => E.offConnected(n, e));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
R.disconnected = function(e, t) {
|
y.disconnected = function(e, t) {
|
||||||
return function(n) {
|
return function(n) {
|
||||||
E.onDisconnected(n, e), t && t.signal && t.signal.addEventListener("abort", () => E.offDisconnected(n, e));
|
E.onDisconnected(n, e), t && t.signal && t.signal.addEventListener("abort", () => E.offDisconnected(n, e));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
function P() {
|
function _() {
|
||||||
let e = /* @__PURE__ */ new Map(), t = !1, r = new MutationObserver(function(o) {
|
let e = /* @__PURE__ */ new Map(), t = !1, r = new MutationObserver(function(o) {
|
||||||
for (let c of o)
|
for (let c of o)
|
||||||
if (c.type === "childList") {
|
if (c.type === "childList") {
|
||||||
@ -242,12 +244,12 @@
|
|||||||
|
|
||||||
globalThis.dde= {
|
globalThis.dde= {
|
||||||
assign: w,
|
assign: w,
|
||||||
classListDeclartive: T,
|
classListDeclarative: T,
|
||||||
createElement: F,
|
createElement: F,
|
||||||
el: F,
|
el: F,
|
||||||
empty: I,
|
empty: I,
|
||||||
namespace: z,
|
namespace: z,
|
||||||
on: R,
|
on: y,
|
||||||
registerReactivity: A
|
registerReactivity: A
|
||||||
};
|
};
|
||||||
|
|
||||||
|
104
dist/esm-with-signals.js
vendored
104
dist/esm-with-signals.js
vendored
@ -63,15 +63,15 @@ function A(e, ...t) {
|
|||||||
if (!t.length)
|
if (!t.length)
|
||||||
return e;
|
return e;
|
||||||
let n = e instanceof SVGElement, o = (n ? q : P).bind(null, e, "Attribute");
|
let n = e instanceof SVGElement, o = (n ? q : P).bind(null, e, "Attribute");
|
||||||
return Object.entries(Object.assign({}, ...t)).forEach(function a([f, s]) {
|
return Object.entries(Object.assign({}, ...t)).forEach(function a([i, s]) {
|
||||||
r.isReactiveAtrribute(s, f) && (s = r.processReactiveAttribute(e, f, s, a));
|
r.isReactiveAtrribute(s, i) && (s = r.processReactiveAttribute(e, i, s, a));
|
||||||
let [h] = f;
|
let [h] = i;
|
||||||
if (h === "=")
|
if (h === "=")
|
||||||
return o(f.slice(1), s);
|
return o(i.slice(1), s);
|
||||||
if (h === ".")
|
if (h === ".")
|
||||||
return N(e, f.slice(1), s);
|
return N(e, i.slice(1), s);
|
||||||
if (typeof s == "object")
|
if (typeof s == "object")
|
||||||
switch (f) {
|
switch (i) {
|
||||||
case "style":
|
case "style":
|
||||||
return y(s, P.bind(null, e.style, "Property"));
|
return y(s, P.bind(null, e.style, "Property"));
|
||||||
case "dataset":
|
case "dataset":
|
||||||
@ -79,24 +79,26 @@ function A(e, ...t) {
|
|||||||
case "ariaset":
|
case "ariaset":
|
||||||
return y(s, (E, v) => o("aria-" + E, v));
|
return y(s, (E, v) => o("aria-" + E, v));
|
||||||
case "classList":
|
case "classList":
|
||||||
return F(e, s);
|
return $(e, s);
|
||||||
default:
|
default:
|
||||||
return Reflect.set(e, f, s);
|
return Reflect.set(e, i, s);
|
||||||
}
|
}
|
||||||
if (/(aria|data)([A-Z])/.test(f))
|
if (/(aria|data)([A-Z])/.test(i))
|
||||||
return f = f.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), o(f, s);
|
return i = i.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), o(i, s);
|
||||||
switch (f) {
|
switch (i) {
|
||||||
|
case "href":
|
||||||
|
return o(i, s);
|
||||||
case "xlink:href":
|
case "xlink:href":
|
||||||
return o(f, s, "http://www.w3.org/1999/xlink");
|
return o(i, s, "http://www.w3.org/1999/xlink");
|
||||||
case "textContent":
|
case "textContent":
|
||||||
if (!n)
|
if (!n)
|
||||||
break;
|
break;
|
||||||
return e.appendChild(document.createTextNode(s));
|
return e.appendChild(document.createTextNode(s));
|
||||||
}
|
}
|
||||||
return $(e, f) ? N(e, f, s) : o(f, s);
|
return k(e, i) ? N(e, i, s) : o(i, s);
|
||||||
}), e;
|
}), e;
|
||||||
}
|
}
|
||||||
function F(e, t) {
|
function $(e, t) {
|
||||||
return typeof t != "object" || y(
|
return typeof t != "object" || y(
|
||||||
t,
|
t,
|
||||||
(r, n) => e.classList.toggle(r, n === -1 ? void 0 : !!n)
|
(r, n) => e.classList.toggle(r, n === -1 ? void 0 : !!n)
|
||||||
@ -105,15 +107,15 @@ function F(e, t) {
|
|||||||
function ne(e) {
|
function ne(e) {
|
||||||
return Array.from(e.children).forEach((t) => t.remove()), e;
|
return Array.from(e.children).forEach((t) => t.remove()), e;
|
||||||
}
|
}
|
||||||
function $(e, t) {
|
function k(e, t) {
|
||||||
let r = "HTMLElement," + t;
|
let r = "HTMLElement," + t;
|
||||||
if (e instanceof HTMLElement && x.has(r))
|
if (e instanceof HTMLElement && x.has(r))
|
||||||
return x.get(r);
|
return x.get(r);
|
||||||
let n = e.nodeName + "," + t;
|
let n = e.nodeName + "," + t;
|
||||||
if (x.has(n))
|
if (x.has(n))
|
||||||
return x.get(n);
|
return x.get(n);
|
||||||
let [o, a, f] = T(e, t), s = !_(o.set);
|
let [o, a, i] = T(e, t), s = !_(o.set);
|
||||||
return (!s || a) && x.set(f === HTMLElement.prototype ? r : n, s), s;
|
return (!s || a) && x.set(i === HTMLElement.prototype ? r : n, s), s;
|
||||||
}
|
}
|
||||||
function T(e, t, r = 0) {
|
function T(e, t, r = 0) {
|
||||||
if (e = Object.getPrototypeOf(e), !e)
|
if (e = Object.getPrototypeOf(e), !e)
|
||||||
@ -154,48 +156,48 @@ M.disconnected = function(e, t) {
|
|||||||
};
|
};
|
||||||
function W() {
|
function W() {
|
||||||
let e = /* @__PURE__ */ new Map(), t = !1, r = new MutationObserver(function(c) {
|
let e = /* @__PURE__ */ new Map(), t = !1, r = new MutationObserver(function(c) {
|
||||||
for (let i of c)
|
for (let f of c)
|
||||||
if (i.type === "childList") {
|
if (f.type === "childList") {
|
||||||
if (E(i.addedNodes, !0)) {
|
if (E(f.addedNodes, !0)) {
|
||||||
f();
|
i();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
v(i.removedNodes, !0) && f();
|
v(f.removedNodes, !0) && i();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
onConnected(c, i) {
|
onConnected(c, f) {
|
||||||
a(), o(c).connected.push(i);
|
a(), o(c).connected.push(f);
|
||||||
},
|
},
|
||||||
offConnected(c, i) {
|
offConnected(c, f) {
|
||||||
if (!e.has(c))
|
if (!e.has(c))
|
||||||
return;
|
return;
|
||||||
let u = e.get(c), l = u.connected;
|
let u = e.get(c), l = u.connected;
|
||||||
l.splice(l.indexOf(i), 1), n(c, u);
|
l.splice(l.indexOf(f), 1), n(c, u);
|
||||||
},
|
},
|
||||||
onDisconnected(c, i) {
|
onDisconnected(c, f) {
|
||||||
a(), o(c).disconnected.push(i);
|
a(), o(c).disconnected.push(f);
|
||||||
},
|
},
|
||||||
offDisconnected(c, i) {
|
offDisconnected(c, f) {
|
||||||
if (!e.has(c))
|
if (!e.has(c))
|
||||||
return;
|
return;
|
||||||
let u = e.get(c), l = u.disconnected;
|
let u = e.get(c), l = u.disconnected;
|
||||||
l.splice(l.indexOf(i), 1), n(c, u);
|
l.splice(l.indexOf(f), 1), n(c, u);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function n(c, i) {
|
function n(c, f) {
|
||||||
i.connected.length || i.disconnect.length || (e.delete(c), f());
|
f.connected.length || f.disconnect.length || (e.delete(c), i());
|
||||||
}
|
}
|
||||||
function o(c) {
|
function o(c) {
|
||||||
if (e.has(c))
|
if (e.has(c))
|
||||||
return e.get(c);
|
return e.get(c);
|
||||||
let i = { connected: [], disconnected: [] };
|
let f = { connected: [], disconnected: [] };
|
||||||
return e.set(c, i), i;
|
return e.set(c, f), f;
|
||||||
}
|
}
|
||||||
function a() {
|
function a() {
|
||||||
t || (t = !0, r.observe(document.body, { childList: !0, subtree: !0 }));
|
t || (t = !0, r.observe(document.body, { childList: !0, subtree: !0 }));
|
||||||
}
|
}
|
||||||
function f() {
|
function i() {
|
||||||
!t || e.size || (t = !1, r.disconnect());
|
!t || e.size || (t = !1, r.disconnect());
|
||||||
}
|
}
|
||||||
function s() {
|
function s() {
|
||||||
@ -205,24 +207,24 @@ function W() {
|
|||||||
}
|
}
|
||||||
async function h(c) {
|
async function h(c) {
|
||||||
e.size > 30 && await s();
|
e.size > 30 && await s();
|
||||||
let i = [];
|
let f = [];
|
||||||
if (!(c instanceof Node))
|
if (!(c instanceof Node))
|
||||||
return i;
|
return f;
|
||||||
for (let u of e.keys())
|
for (let u of e.keys())
|
||||||
u === c || !(u instanceof Node) || c.contains(u) && i.push(u);
|
u === c || !(u instanceof Node) || c.contains(u) && f.push(u);
|
||||||
return i;
|
return f;
|
||||||
}
|
}
|
||||||
function E(c, i) {
|
function E(c, f) {
|
||||||
for (let u of c) {
|
for (let u of c) {
|
||||||
if (i && h(u).then(E), !e.has(u))
|
if (f && h(u).then(E), !e.has(u))
|
||||||
return !1;
|
return !1;
|
||||||
let l = e.get(u);
|
let l = e.get(u);
|
||||||
return l.connected.forEach((C) => C(u)), l.connected.length = 0, l.disconnected.length || e.delete(u), !0;
|
return l.connected.forEach((C) => C(u)), l.connected.length = 0, l.disconnected.length || e.delete(u), !0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function v(c, i) {
|
function v(c, f) {
|
||||||
for (let u of c) {
|
for (let u of c) {
|
||||||
if (i && h(u).then(v), !e.has(u))
|
if (f && h(u).then(v), !e.has(u))
|
||||||
return !1;
|
return !1;
|
||||||
let l = e.get(u);
|
let l = e.get(u);
|
||||||
return l.disconnected.forEach((C) => C(u)), l.connected.length = 0, l.disconnected.length = 0, e.delete(u), !0;
|
return l.disconnected.forEach((C) => C(u)), l.connected.length = 0, l.disconnected.length = 0, e.delete(u), !0;
|
||||||
@ -269,7 +271,7 @@ g.on = function e(t, r, n = {}) {
|
|||||||
if (!(o && o.aborted)) {
|
if (!(o && o.aborted)) {
|
||||||
if (Array.isArray(t))
|
if (Array.isArray(t))
|
||||||
return t.forEach((a) => e(a, r, n));
|
return t.forEach((a) => e(a, r, n));
|
||||||
D(t, r), o && o.addEventListener("abort", () => z(t, r));
|
D(t, r), o && o.addEventListener("abort", () => F(t, r));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
g.symbols = {
|
g.symbols = {
|
||||||
@ -290,7 +292,7 @@ g.clear = function(...e) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var k = {
|
var z = {
|
||||||
isReactiveAtrribute(e, t) {
|
isReactiveAtrribute(e, t) {
|
||||||
return R(e);
|
return R(e);
|
||||||
},
|
},
|
||||||
@ -303,10 +305,10 @@ var k = {
|
|||||||
reactiveElement(e, t) {
|
reactiveElement(e, t) {
|
||||||
let r = document.createComment("<#reactive>"), n = document.createComment("</#reactive>"), o = document.createDocumentFragment();
|
let r = document.createComment("<#reactive>"), n = document.createComment("</#reactive>"), o = document.createDocumentFragment();
|
||||||
o.append(r, n);
|
o.append(r, n);
|
||||||
let a = (f) => {
|
let a = (i) => {
|
||||||
if (!r.parentNode || !n.parentNode)
|
if (!r.parentNode || !n.parentNode)
|
||||||
return z(e, a);
|
return F(e, a);
|
||||||
let s = t(f);
|
let s = t(i);
|
||||||
Array.isArray(s) || (s = [s]);
|
Array.isArray(s) || (s = [s]);
|
||||||
let h = r;
|
let h = r;
|
||||||
for (; (h = r.nextSibling) !== n; )
|
for (; (h = r.nextSibling) !== n; )
|
||||||
@ -361,16 +363,16 @@ function V(e) {
|
|||||||
function D(e, t) {
|
function D(e, t) {
|
||||||
return e[d].listeners.add(t);
|
return e[d].listeners.add(t);
|
||||||
}
|
}
|
||||||
function z(e, t) {
|
function F(e, t) {
|
||||||
return e[d].listeners.delete(t);
|
return e[d].listeners.delete(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// src/signals.js
|
// src/signals.js
|
||||||
L(k);
|
L(z);
|
||||||
export {
|
export {
|
||||||
g as S,
|
g as S,
|
||||||
A as assign,
|
A as assign,
|
||||||
F as classListDeclartive,
|
$ as classListDeclarative,
|
||||||
te as createElement,
|
te as createElement,
|
||||||
te as el,
|
te as el,
|
||||||
ne as empty,
|
ne as empty,
|
||||||
|
22
dist/esm.js
vendored
22
dist/esm.js
vendored
@ -86,6 +86,8 @@ function w(e, ...t) {
|
|||||||
if (/(aria|data)([A-Z])/.test(i))
|
if (/(aria|data)([A-Z])/.test(i))
|
||||||
return i = i.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), f(i, u);
|
return i = i.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), f(i, u);
|
||||||
switch (i) {
|
switch (i) {
|
||||||
|
case "href":
|
||||||
|
return f(i, u);
|
||||||
case "xlink:href":
|
case "xlink:href":
|
||||||
return f(i, u, "http://www.w3.org/1999/xlink");
|
return f(i, u, "http://www.w3.org/1999/xlink");
|
||||||
case "textContent":
|
case "textContent":
|
||||||
@ -112,14 +114,14 @@ function D(e, t) {
|
|||||||
let n = e.nodeName + "," + t;
|
let n = e.nodeName + "," + t;
|
||||||
if (h.has(n))
|
if (h.has(n))
|
||||||
return h.get(n);
|
return h.get(n);
|
||||||
let [f, d, i] = y(e, t), u = !L(f.set);
|
let [f, d, i] = R(e, t), u = !L(f.set);
|
||||||
return (!u || d) && h.set(i === HTMLElement.prototype ? r : n, u), u;
|
return (!u || d) && h.set(i === HTMLElement.prototype ? r : n, u), u;
|
||||||
}
|
}
|
||||||
function y(e, t, r = 0) {
|
function R(e, t, r = 0) {
|
||||||
if (e = Object.getPrototypeOf(e), !e)
|
if (e = Object.getPrototypeOf(e), !e)
|
||||||
return [{}, r, e];
|
return [{}, r, e];
|
||||||
let n = Object.getOwnPropertyDescriptor(e, t);
|
let n = Object.getOwnPropertyDescriptor(e, t);
|
||||||
return n ? [n, r, e] : y(e, t, r + 1);
|
return n ? [n, r, e] : R(e, t, r + 1);
|
||||||
}
|
}
|
||||||
function m(e, t) {
|
function m(e, t) {
|
||||||
return Object.entries(e).forEach(([r, n]) => t(r, n));
|
return Object.entries(e).forEach(([r, n]) => t(r, n));
|
||||||
@ -138,21 +140,21 @@ function C(e, t, r) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// src/events.js
|
// src/events.js
|
||||||
function R(e, t, r) {
|
function y(e, t, r) {
|
||||||
return (n) => (n.addEventListener(e, t, r), n);
|
return (n) => (n.addEventListener(e, t, r), n);
|
||||||
}
|
}
|
||||||
var E = P();
|
var E = _();
|
||||||
R.connected = function(e, t) {
|
y.connected = function(e, t) {
|
||||||
return function(n) {
|
return function(n) {
|
||||||
E.onConnected(n, e), t && t.signal && t.signal.addEventListener("abort", () => E.offConnected(n, e));
|
E.onConnected(n, e), t && t.signal && t.signal.addEventListener("abort", () => E.offConnected(n, e));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
R.disconnected = function(e, t) {
|
y.disconnected = function(e, t) {
|
||||||
return function(n) {
|
return function(n) {
|
||||||
E.onDisconnected(n, e), t && t.signal && t.signal.addEventListener("abort", () => E.offDisconnected(n, e));
|
E.onDisconnected(n, e), t && t.signal && t.signal.addEventListener("abort", () => E.offDisconnected(n, e));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
function P() {
|
function _() {
|
||||||
let e = /* @__PURE__ */ new Map(), t = !1, r = new MutationObserver(function(o) {
|
let e = /* @__PURE__ */ new Map(), t = !1, r = new MutationObserver(function(o) {
|
||||||
for (let c of o)
|
for (let c of o)
|
||||||
if (c.type === "childList") {
|
if (c.type === "childList") {
|
||||||
@ -239,11 +241,11 @@ function P() {
|
|||||||
});
|
});
|
||||||
export {
|
export {
|
||||||
w as assign,
|
w as assign,
|
||||||
T as classListDeclartive,
|
T as classListDeclarative,
|
||||||
F as createElement,
|
F as createElement,
|
||||||
F as el,
|
F as el,
|
||||||
I as empty,
|
I as empty,
|
||||||
z as namespace,
|
z as namespace,
|
||||||
R as on,
|
y as on,
|
||||||
A as registerReactivity
|
A as registerReactivity
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user