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