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