aptechka 0.32.5 → 0.33.0
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.
- package/lib/popover/PopoverElement.d.ts +6 -4
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +96 -88
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CSSProperty } from '../css-property';
|
|
2
2
|
import { Store } from '../store/vanilla';
|
|
3
3
|
|
|
4
4
|
export interface PopoverEvents {
|
|
@@ -14,9 +14,11 @@ export interface PopoverEvents {
|
|
|
14
14
|
export declare class PopoverElement extends HTMLElement {
|
|
15
15
|
#private;
|
|
16
16
|
private static __opened;
|
|
17
|
-
get history():
|
|
18
|
-
get restore():
|
|
19
|
-
get dominance():
|
|
17
|
+
get history(): CSSProperty<false>;
|
|
18
|
+
get restore(): CSSProperty<false>;
|
|
19
|
+
get dominance(): CSSProperty<0>;
|
|
20
|
+
get clickOutside(): CSSProperty<false>;
|
|
21
|
+
get escape(): CSSProperty<false>;
|
|
20
22
|
get opened(): Store<boolean>;
|
|
21
23
|
get lastTrigger(): any;
|
|
22
24
|
open: (options?: {
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var D=o=>{throw TypeError(o)};var $=(o,n,t)=>n.has(o)||D("Cannot "+t);var e=(o,n,t)=>($(o,n,"read from private field"),t?t.call(o):n.get(o)),s=(o,n,t)=>n.has(o)?D("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,t),i=(o,n,t,c)=>($(o,n,"write to private field"),c?c.call(o,t):n.set(o,t),t),C=(o,n,t)=>($(o,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("../css-property/index.cjs"),G=require("../Store-CDb6RMce.cjs"),H=require("../events-KVanG9sR.cjs"),J=require("../function-MthRj-GJ.cjs"),K=require("../style-At6aDoqG.cjs"),U=require("../window-resizer/vanilla/index.cjs"),Q=require("../browser-CpzFX2xg.cjs");var b,a,_,d,v,p,g,m,f,y,u,W,w,I,T,B,L,S,q,k;const l=class l extends HTMLElement{constructor(){super(...arguments);s(this,u);s(this,b);s(this,a);s(this,_);s(this,d);s(this,v);s(this,p);s(this,g);s(this,m);s(this,f);s(this,y);s(this,w);s(this,T);s(this,L);s(this,S);s(this,q);s(this,k);i(this,b,-1),i(this,a,new G.Store(!1)),i(this,d,new P.CSSProperty(this,"--history",!1)),i(this,v,new P.CSSProperty(this,"--restore",!1)),i(this,p,new P.CSSProperty(this,"--dominance",0)),i(this,g,new P.CSSProperty(this,"--click-outside",!1)),i(this,m,new P.CSSProperty(this,"--escape",!1)),i(this,f,!1),this.open=t=>{if(e(this,a).current)return;i(this,y,t==null?void 0:t.trigger),e(this,a).current=!0,e(this,p).current&&(l.__opened=l.__opened.filter(h=>this.dominance.current>=h.dominance.current?(h.close(),!1):!0)),l.__opened.push(this),i(this,b,l.__opened.length-1),e(this,d).current&&e(this,f)&&history.pushState("","",e(this,u,W)),clearTimeout(e(this,_)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",H.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,y)}});const c=()=>{addEventListener("click",e(this,w)),addEventListener("keydown",e(this,T)),e(this,k).call(this),this.style.opacity="1",this.classList.add("opened"),H.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,y)}})};t!=null&&t.skipTransition?c():setTimeout(c,10)},this.close=()=>{e(this,a).current&&(e(this,a).current=!1,l.__opened=l.__opened.filter(t=>t===this?!1:e(t,p).current<this.dominance.current?(t.close(),!1):!0),C(this,u,I).call(this),this.classList.remove("opened"),this.classList.add("closing"),this.style.opacity="0",H.dispatchEvent(this,"popoverClosing",{custom:!0}),removeEventListener("click",e(this,w)),removeEventListener("keydown",e(this,T)),setTimeout(()=>{this.classList.remove("triggered"),this.classList.remove("closing"),this.style.display="none",H.dispatchEvent(this,"popoverClosed",{custom:!0})},K.getElementTransitionDurationMS(this)+10))},i(this,w,t=>{e(this,g).current&&C(this,u,B).call(this,()=>{var N;const c=t.composedPath();if(c.find(j=>j instanceof HTMLElement&&j.hasAttribute("data-popover-content")))return;const h=c[0],A=h instanceof HTMLElement&&(this.contains(h)||((N=this.shadowRoot)==null?void 0:N.contains(h))),E=h instanceof HTMLElement&&h.hasAttribute("data-outside");(!A||E)&&this.close()})}),i(this,T,t=>{e(this,m).current&&C(this,u,B).call(this,()=>{t.code==="Escape"&&this.close()})}),i(this,L,()=>{i(this,f,!1),e(this,a).current&&e(this,d).current&&!location.search.includes(this.id)?this.close():!e(this,a).current&&e(this,d).current&&location.search.includes(this.id)&&this.open(),i(this,f,!0)}),i(this,S,()=>{this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),e(this,q).call(this)}),i(this,q,J.debounce(()=>{e(this,k).call(this)},20)),i(this,k,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")})}get history(){return e(this,d)}get restore(){return e(this,v)}get dominance(){return e(this,p)}get clickOutside(){return e(this,g)}get escape(){return e(this,m)}get opened(){return e(this,a)}get lastTrigger(){return e(this,y)}connectedCallback(){e(this,d).observe(),e(this,v).observe(),e(this,p).observe(),e(this,g).observe(),e(this,m).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,L)),setTimeout(()=>{e(this,v).current?e(this,L).call(this):(C(this,u,I).call(this),i(this,f,!0))},0),U.windowResizer.subscribe(e(this,S))}disconnectedCallback(){U.windowResizer.unsubscribe(e(this,S)),e(this,d).unobserve(),e(this,v).unobserve(),e(this,p).unobserve(),e(this,g).unobserve(),e(this,m).unobserve(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),l.__opened=l.__opened.filter(t=>t!==this),clearTimeout(e(this,_)),removeEventListener("popstate",e(this,L)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height")}};b=new WeakMap,a=new WeakMap,_=new WeakMap,d=new WeakMap,v=new WeakMap,p=new WeakMap,g=new WeakMap,m=new WeakMap,f=new WeakMap,y=new WeakMap,u=new WeakSet,W=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},w=new WeakMap,I=function(){if(e(this,d).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(null,"",t.href)}},T=new WeakMap,B=function(t){(l.__opened[e(this,b)-1]||l.__opened.length===1||l.__opened.filter(c=>c!==this).every(c=>e(this,p).current>c.dominance.current))&&t()},L=new WeakMap,S=new WeakMap,q=new WeakMap,k=new WeakMap,l.__opened=[];let z=l;customElements.get("e-popover")||customElements.define("e-popover",z);var r,x,M,O,R;class F extends HTMLElement{constructor(){super();s(this,r);s(this,x,()=>{this.classList.add("triggered")});s(this,M,()=>{this.classList.add("opened")});s(this,O,()=>{this.classList.remove("opened")});s(this,R,()=>{this.classList.remove("triggered")});Q.isBrowser&&(this.addEventListener("click",()=>{if(e(this,r)){const t=this.getAttribute("type")||"open";t==="open"||t==="toggle"&&!e(this,r).opened.current?e(this,r).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,r).opened.current)&&e(this,r).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get popoverElement(){return e(this,r)}connectedCallback(){var c;this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let h=null;if(t==="parent"){const A=this.closest("[popover-target]");if(A)h=A;else{const E=this.getRootNode();E instanceof ShadowRoot?h=E.host.closest("[popover-target]"):E instanceof HTMLElement&&(h=E.closest("[popover-target]"))}}else t==="sibling"?h=(c=this.parentElement)==null?void 0:c.querySelector("[popover-target]"):h=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);h instanceof HTMLElement?(i(this,r,h),e(this,r).addEventListener("popoverTriggered",e(this,x)),e(this,r).addEventListener("popoverOpened",e(this,M)),e(this,r).addEventListener("popoverClosing",e(this,O)),e(this,r).addEventListener("popoverClosed",e(this,R))):console.warn(this,`target ${t} not found`)}}disconnectedCallback(){e(this,r)&&(e(this,r).removeEventListener("popoverTriggered",e(this,x)),e(this,r).removeEventListener("popoverOpened",e(this,M)),e(this,r).removeEventListener("popoverClosing",e(this,O)),e(this,r).removeEventListener("popoverClosed",e(this,R)))}}r=new WeakMap,x=new WeakMap,M=new WeakMap,O=new WeakMap,R=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",F);exports.PopoverButtonElement=F;exports.PopoverElement=z;
|
package/lib/popover/index.js
CHANGED
|
@@ -1,82 +1,84 @@
|
|
|
1
|
-
var
|
|
1
|
+
var U = (o) => {
|
|
2
2
|
throw TypeError(o);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (o, n, t) => (
|
|
6
|
-
import {
|
|
7
|
-
import { S as
|
|
8
|
-
import { d as
|
|
9
|
-
import { d as
|
|
10
|
-
import { g as
|
|
11
|
-
import { windowResizer as
|
|
12
|
-
import { i as
|
|
13
|
-
var
|
|
14
|
-
const
|
|
4
|
+
var z = (o, n, t) => n.has(o) || U("Cannot " + t);
|
|
5
|
+
var e = (o, n, t) => (z(o, n, "read from private field"), t ? t.call(o) : n.get(o)), s = (o, n, t) => n.has(o) ? U("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(o) : n.set(o, t), i = (o, n, t, c) => (z(o, n, "write to private field"), c ? c.call(o, t) : n.set(o, t), t), C = (o, n, t) => (z(o, n, "access private method"), t);
|
|
6
|
+
import { CSSProperty as _ } from "../css-property/index.js";
|
|
7
|
+
import { S as F } from "../Store-OTdcl6SX.js";
|
|
8
|
+
import { d as $ } from "../events-CsVF98U6.js";
|
|
9
|
+
import { d as G } from "../function-C10DGppn.js";
|
|
10
|
+
import { g as J } from "../style-j2TwriJ_.js";
|
|
11
|
+
import { windowResizer as W } from "../window-resizer/vanilla/index.js";
|
|
12
|
+
import { i as K } from "../browser-0zX67oeU.js";
|
|
13
|
+
var E, a, P, d, g, p, v, m, f, L, u, j, T, q, w, N, y, k, x, S;
|
|
14
|
+
const l = class l extends HTMLElement {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
|
-
s(this,
|
|
18
|
-
s(this,
|
|
17
|
+
s(this, u);
|
|
18
|
+
s(this, E);
|
|
19
19
|
s(this, a);
|
|
20
|
-
s(this,
|
|
20
|
+
s(this, P);
|
|
21
21
|
s(this, d);
|
|
22
|
-
s(this, u);
|
|
23
22
|
s(this, g);
|
|
24
|
-
s(this,
|
|
23
|
+
s(this, p);
|
|
25
24
|
s(this, v);
|
|
26
|
-
s(this,
|
|
27
|
-
s(this, b);
|
|
25
|
+
s(this, m);
|
|
28
26
|
s(this, f);
|
|
27
|
+
s(this, L);
|
|
29
28
|
s(this, T);
|
|
30
|
-
s(this, S);
|
|
31
29
|
s(this, w);
|
|
32
|
-
|
|
30
|
+
s(this, y);
|
|
31
|
+
s(this, k);
|
|
32
|
+
s(this, x);
|
|
33
|
+
s(this, S);
|
|
34
|
+
i(this, E, -1), i(this, a, new F(!1)), i(this, d, new _(this, "--history", !1)), i(this, g, new _(this, "--restore", !1)), i(this, p, new _(this, "--dominance", 0)), i(this, v, new _(this, "--click-outside", !1)), i(this, m, new _(this, "--escape", !1)), i(this, f, !1), this.open = (t) => {
|
|
33
35
|
if (e(this, a).current)
|
|
34
36
|
return;
|
|
35
|
-
i(this,
|
|
37
|
+
i(this, L, t == null ? void 0 : t.trigger), e(this, a).current = !0, e(this, p).current && (l.__opened = l.__opened.filter((h) => this.dominance.current >= h.dominance.current ? (h.close(), !1) : !0)), l.__opened.push(this), i(this, E, l.__opened.length - 1), e(this, d).current && e(this, f) && history.pushState("", "", e(this, u, j)), clearTimeout(e(this, P)), this.classList.remove("closing"), this.classList.add("triggered"), this.style.display = "block", $(this, "popoverTriggered", {
|
|
36
38
|
custom: !0,
|
|
37
39
|
detail: {
|
|
38
|
-
trigger: e(this,
|
|
40
|
+
trigger: e(this, L)
|
|
39
41
|
}
|
|
40
42
|
});
|
|
41
|
-
const
|
|
42
|
-
addEventListener("click", e(this,
|
|
43
|
+
const c = () => {
|
|
44
|
+
addEventListener("click", e(this, T)), addEventListener("keydown", e(this, w)), e(this, S).call(this), this.style.opacity = "1", this.classList.add("opened"), $(this, "popoverOpened", {
|
|
43
45
|
custom: !0,
|
|
44
46
|
detail: {
|
|
45
|
-
trigger: e(this,
|
|
47
|
+
trigger: e(this, L)
|
|
46
48
|
}
|
|
47
49
|
});
|
|
48
50
|
};
|
|
49
|
-
t != null && t.skipTransition ?
|
|
51
|
+
t != null && t.skipTransition ? c() : setTimeout(c, 10);
|
|
50
52
|
}, this.close = () => {
|
|
51
|
-
e(this, a).current && (e(this, a).current = !1,
|
|
53
|
+
e(this, a).current && (e(this, a).current = !1, l.__opened = l.__opened.filter((t) => t === this ? !1 : e(t, p).current < this.dominance.current ? (t.close(), !1) : !0), C(this, u, q).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.style.opacity = "0", $(this, "popoverClosing", {
|
|
52
54
|
custom: !0
|
|
53
|
-
}), removeEventListener("click", e(this,
|
|
54
|
-
this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none",
|
|
55
|
+
}), removeEventListener("click", e(this, T)), removeEventListener("keydown", e(this, w)), setTimeout(() => {
|
|
56
|
+
this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none", $(this, "popoverClosed", {
|
|
55
57
|
custom: !0
|
|
56
58
|
});
|
|
57
|
-
},
|
|
58
|
-
}, i(this,
|
|
59
|
-
|
|
60
|
-
var
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
(
|
|
59
|
+
}, J(this) + 10));
|
|
60
|
+
}, i(this, T, (t) => {
|
|
61
|
+
e(this, v).current && C(this, u, N).call(this, () => {
|
|
62
|
+
var B;
|
|
63
|
+
const c = t.composedPath();
|
|
64
|
+
if (c.find(
|
|
65
|
+
(D) => D instanceof HTMLElement && D.hasAttribute("data-popover-content")
|
|
64
66
|
))
|
|
65
67
|
return;
|
|
66
|
-
const h =
|
|
67
|
-
(!
|
|
68
|
+
const h = c[0], R = h instanceof HTMLElement && (this.contains(h) || ((B = this.shadowRoot) == null ? void 0 : B.contains(h))), b = h instanceof HTMLElement && h.hasAttribute("data-outside");
|
|
69
|
+
(!R || b) && this.close();
|
|
68
70
|
});
|
|
69
|
-
}), i(this,
|
|
70
|
-
|
|
71
|
+
}), i(this, w, (t) => {
|
|
72
|
+
e(this, m).current && C(this, u, N).call(this, () => {
|
|
71
73
|
t.code === "Escape" && this.close();
|
|
72
74
|
});
|
|
73
|
-
}), i(this,
|
|
74
|
-
i(this,
|
|
75
|
-
}), i(this,
|
|
76
|
-
this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), e(this,
|
|
77
|
-
}), i(this,
|
|
78
|
-
e(this,
|
|
79
|
-
}, 20)), i(this,
|
|
75
|
+
}), i(this, y, () => {
|
|
76
|
+
i(this, f, !1), e(this, a).current && e(this, d).current && !location.search.includes(this.id) ? this.close() : !e(this, a).current && e(this, d).current && location.search.includes(this.id) && this.open(), i(this, f, !0);
|
|
77
|
+
}), i(this, k, () => {
|
|
78
|
+
this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), e(this, x).call(this);
|
|
79
|
+
}), i(this, x, G(() => {
|
|
80
|
+
e(this, S).call(this);
|
|
81
|
+
}, 20)), i(this, S, () => {
|
|
80
82
|
this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px");
|
|
81
83
|
});
|
|
82
84
|
}
|
|
@@ -84,56 +86,62 @@ const c = class c extends HTMLElement {
|
|
|
84
86
|
return e(this, d);
|
|
85
87
|
}
|
|
86
88
|
get restore() {
|
|
87
|
-
return e(this,
|
|
89
|
+
return e(this, g);
|
|
88
90
|
}
|
|
89
91
|
get dominance() {
|
|
90
|
-
return e(this,
|
|
92
|
+
return e(this, p);
|
|
93
|
+
}
|
|
94
|
+
get clickOutside() {
|
|
95
|
+
return e(this, v);
|
|
96
|
+
}
|
|
97
|
+
get escape() {
|
|
98
|
+
return e(this, m);
|
|
91
99
|
}
|
|
92
100
|
get opened() {
|
|
93
101
|
return e(this, a);
|
|
94
102
|
}
|
|
95
103
|
get lastTrigger() {
|
|
96
|
-
return e(this,
|
|
104
|
+
return e(this, L);
|
|
97
105
|
}
|
|
98
106
|
connectedCallback() {
|
|
99
|
-
e(this, d).observe(), e(this,
|
|
100
|
-
e(this,
|
|
101
|
-
}, 0),
|
|
107
|
+
e(this, d).observe(), e(this, g).observe(), e(this, p).observe(), e(this, v).observe(), e(this, m).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("popover-target", ""), this.classList.remove("closing"), this.classList.remove("closed"), this.classList.remove("triggered"), this.classList.remove("opened"), addEventListener("popstate", e(this, y)), setTimeout(() => {
|
|
108
|
+
e(this, g).current ? e(this, y).call(this) : (C(this, u, q).call(this), i(this, f, !0));
|
|
109
|
+
}, 0), W.subscribe(e(this, k));
|
|
102
110
|
}
|
|
103
111
|
disconnectedCallback() {
|
|
104
|
-
|
|
112
|
+
W.unsubscribe(e(this, k)), e(this, d).unobserve(), e(this, g).unobserve(), e(this, p).unobserve(), e(this, v).unobserve(), e(this, m).unobserve(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), l.__opened = l.__opened.filter((t) => t !== this), clearTimeout(e(this, P)), removeEventListener("popstate", e(this, y)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height");
|
|
105
113
|
}
|
|
106
114
|
};
|
|
107
|
-
|
|
115
|
+
E = new WeakMap(), a = new WeakMap(), P = new WeakMap(), d = new WeakMap(), g = new WeakMap(), p = new WeakMap(), v = new WeakMap(), m = new WeakMap(), f = new WeakMap(), L = new WeakMap(), u = new WeakSet(), j = function() {
|
|
108
116
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.id}`;
|
|
109
|
-
},
|
|
117
|
+
}, T = new WeakMap(), q = function() {
|
|
110
118
|
if (e(this, d).current) {
|
|
111
119
|
const t = new URL(location.href);
|
|
112
120
|
t.searchParams.delete(this.id), history.replaceState(null, "", t.href);
|
|
113
121
|
}
|
|
114
|
-
},
|
|
115
|
-
(
|
|
116
|
-
},
|
|
117
|
-
let
|
|
118
|
-
customElements.get("e-popover") || customElements.define("e-popover",
|
|
119
|
-
var r,
|
|
120
|
-
class
|
|
122
|
+
}, w = new WeakMap(), N = function(t) {
|
|
123
|
+
(l.__opened[e(this, E) - 1] || l.__opened.length === 1 || l.__opened.filter((c) => c !== this).every((c) => e(this, p).current > c.dominance.current)) && t();
|
|
124
|
+
}, y = new WeakMap(), k = new WeakMap(), x = new WeakMap(), S = new WeakMap(), l.__opened = [];
|
|
125
|
+
let I = l;
|
|
126
|
+
customElements.get("e-popover") || customElements.define("e-popover", I);
|
|
127
|
+
var r, A, H, M, O;
|
|
128
|
+
class Q extends HTMLElement {
|
|
121
129
|
constructor() {
|
|
122
130
|
super();
|
|
123
131
|
s(this, r);
|
|
124
|
-
s(this,
|
|
132
|
+
s(this, A, () => {
|
|
125
133
|
this.classList.add("triggered");
|
|
126
134
|
});
|
|
127
|
-
s(this,
|
|
135
|
+
s(this, H, () => {
|
|
128
136
|
this.classList.add("opened");
|
|
129
137
|
});
|
|
130
|
-
s(this,
|
|
138
|
+
s(this, M, () => {
|
|
131
139
|
this.classList.remove("opened");
|
|
132
140
|
});
|
|
133
|
-
s(this,
|
|
141
|
+
s(this, O, () => {
|
|
134
142
|
this.classList.remove("triggered");
|
|
135
143
|
});
|
|
136
|
-
|
|
144
|
+
K && (this.addEventListener("click", () => {
|
|
137
145
|
if (e(this, r)) {
|
|
138
146
|
const t = this.getAttribute("type") || "open";
|
|
139
147
|
t === "open" || t === "toggle" && !e(this, r).opened.current ? e(this, r).open({ trigger: this }) : (t === "close" || t === "toggle" && e(this, r).opened.current) && e(this, r).close();
|
|
@@ -146,54 +154,54 @@ class J extends HTMLElement {
|
|
|
146
154
|
return e(this, r);
|
|
147
155
|
}
|
|
148
156
|
connectedCallback() {
|
|
149
|
-
var
|
|
157
|
+
var c;
|
|
150
158
|
this.hasAttribute("tabindex") || (this.tabIndex = 0);
|
|
151
159
|
const t = this.getAttribute("target");
|
|
152
160
|
if (t) {
|
|
153
161
|
let h = null;
|
|
154
162
|
if (t === "parent") {
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
h =
|
|
163
|
+
const R = this.closest("[popover-target]");
|
|
164
|
+
if (R)
|
|
165
|
+
h = R;
|
|
158
166
|
else {
|
|
159
|
-
const
|
|
160
|
-
|
|
167
|
+
const b = this.getRootNode();
|
|
168
|
+
b instanceof ShadowRoot ? h = b.host.closest("[popover-target]") : b instanceof HTMLElement && (h = b.closest("[popover-target]"));
|
|
161
169
|
}
|
|
162
|
-
} else t === "sibling" ? h = (
|
|
170
|
+
} else t === "sibling" ? h = (c = this.parentElement) == null ? void 0 : c.querySelector("[popover-target]") : h = document.querySelector(`#${t}`) || this.getRootNode().querySelector(`#${t}`);
|
|
163
171
|
h instanceof HTMLElement ? (i(this, r, h), e(this, r).addEventListener(
|
|
164
172
|
"popoverTriggered",
|
|
165
|
-
e(this,
|
|
173
|
+
e(this, A)
|
|
166
174
|
), e(this, r).addEventListener(
|
|
167
175
|
"popoverOpened",
|
|
168
|
-
e(this,
|
|
176
|
+
e(this, H)
|
|
169
177
|
), e(this, r).addEventListener(
|
|
170
178
|
"popoverClosing",
|
|
171
|
-
e(this,
|
|
179
|
+
e(this, M)
|
|
172
180
|
), e(this, r).addEventListener(
|
|
173
181
|
"popoverClosed",
|
|
174
|
-
e(this,
|
|
182
|
+
e(this, O)
|
|
175
183
|
)) : console.warn(this, `target ${t} not found`);
|
|
176
184
|
}
|
|
177
185
|
}
|
|
178
186
|
disconnectedCallback() {
|
|
179
187
|
e(this, r) && (e(this, r).removeEventListener(
|
|
180
188
|
"popoverTriggered",
|
|
181
|
-
e(this,
|
|
189
|
+
e(this, A)
|
|
182
190
|
), e(this, r).removeEventListener(
|
|
183
191
|
"popoverOpened",
|
|
184
|
-
e(this,
|
|
192
|
+
e(this, H)
|
|
185
193
|
), e(this, r).removeEventListener(
|
|
186
194
|
"popoverClosing",
|
|
187
|
-
e(this,
|
|
195
|
+
e(this, M)
|
|
188
196
|
), e(this, r).removeEventListener(
|
|
189
197
|
"popoverClosed",
|
|
190
|
-
e(this,
|
|
198
|
+
e(this, O)
|
|
191
199
|
));
|
|
192
200
|
}
|
|
193
201
|
}
|
|
194
|
-
r = new WeakMap(),
|
|
195
|
-
customElements.get("e-popover-button") || customElements.define("e-popover-button",
|
|
202
|
+
r = new WeakMap(), A = new WeakMap(), H = new WeakMap(), M = new WeakMap(), O = new WeakMap();
|
|
203
|
+
customElements.get("e-popover-button") || customElements.define("e-popover-button", Q);
|
|
196
204
|
export {
|
|
197
|
-
|
|
198
|
-
|
|
205
|
+
Q as PopoverButtonElement,
|
|
206
|
+
I as PopoverElement
|
|
199
207
|
};
|