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