inclusive-elements 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
var c = Object.defineProperty;
|
|
2
2
|
var m = (a, s, t) => s in a ? c(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
|
|
3
3
|
var o = (a, s, t) => (m(a, typeof s != "symbol" ? s + "" : s, t), t);
|
|
4
|
-
import { move as
|
|
5
|
-
const
|
|
4
|
+
import { move as n, hello as u, goodbye as f } from "hello-goodbye";
|
|
5
|
+
const h = class extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
|
+
o(this, "added", /* @__PURE__ */ new Set());
|
|
8
9
|
o(this, "timeouts", /* @__PURE__ */ new Map());
|
|
9
10
|
o(this, "index", 0);
|
|
10
11
|
new MutationObserver((i) => {
|
|
11
12
|
i.forEach((r) => {
|
|
12
13
|
r.addedNodes.forEach((e) => {
|
|
13
|
-
e instanceof HTMLElement && this.show(e);
|
|
14
|
+
e instanceof HTMLElement && !this.added.has(e) && this.show(e);
|
|
14
15
|
});
|
|
15
16
|
});
|
|
16
17
|
}).observe(this, { childList: !0 });
|
|
@@ -22,11 +23,11 @@ const n = class extends HTMLElement {
|
|
|
22
23
|
}
|
|
23
24
|
show(t, i = {}) {
|
|
24
25
|
const r = i.key || t.dataset.key || String(this.index++);
|
|
25
|
-
this.dismiss(r), t.dataset.key = r, this.contains(t) ? u(t) : i.animate === !1 ? this.append(t) :
|
|
26
|
+
this.dismiss(r), t.dataset.key = r, this.contains(t) ? u(t) : i.animate === !1 ? this.append(t) : n(this.children, () => {
|
|
26
27
|
this.append(t), u(t);
|
|
27
|
-
});
|
|
28
|
+
}), this.added.add(t);
|
|
28
29
|
const e = Number(
|
|
29
|
-
i.duration !== void 0 ? i.duration : t.dataset.duration ||
|
|
30
|
+
i.duration !== void 0 ? i.duration : t.dataset.duration || h.duration
|
|
30
31
|
);
|
|
31
32
|
return e > 0 && (this.startTimeout(t, e), t.addEventListener("mouseenter", this.clearTimeout.bind(this, t)), t.addEventListener("focusin", this.clearTimeout.bind(this, t)), t.addEventListener(
|
|
32
33
|
"mouseleave",
|
|
@@ -40,14 +41,13 @@ const n = class extends HTMLElement {
|
|
|
40
41
|
if (typeof t == "string") {
|
|
41
42
|
this.querySelectorAll(
|
|
42
43
|
`[data-key="${t}"]`
|
|
43
|
-
).forEach((i) =>
|
|
44
|
-
this.dismiss(i);
|
|
45
|
-
});
|
|
44
|
+
).forEach((i) => this.dismiss(i));
|
|
46
45
|
return;
|
|
47
46
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
this.added.delete(t), n(
|
|
48
|
+
this.children,
|
|
49
|
+
() => f(t).then(() => t.remove())
|
|
50
|
+
), this.clearTimeout(t);
|
|
51
51
|
}
|
|
52
52
|
clear() {
|
|
53
53
|
Array.from(this.children).forEach((t) => {
|
|
@@ -78,8 +78,8 @@ const n = class extends HTMLElement {
|
|
|
78
78
|
this.timeouts.has(t) && clearTimeout(this.timeouts.get(t));
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
let
|
|
82
|
-
o(
|
|
81
|
+
let d = h;
|
|
82
|
+
o(d, "duration", 1e4);
|
|
83
83
|
export {
|
|
84
|
-
|
|
84
|
+
d as default
|
|
85
85
|
};
|