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