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