aptechka 0.64.8 → 0.64.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/billboard/index.cjs +1 -1
- package/lib/billboard/index.js +25 -25
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +27 -27
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +149 -149
- package/package.json +1 -1
package/lib/billboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Q=i=>{throw TypeError(i)};var O=(i,r,e)=>r.has(i)||Q("Cannot "+e);var t=(i,r,e)=>(O(i,r,"read from private field"),e?e.call(i):r.get(i)),s=(i,r,e)=>r.has(i)?Q("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,e),d=(i,r,e,n)=>(O(i,r,"write to private field"),n?n.call(i,e):r.set(i,e),e),m=(i,r,e)=>(O(i,r,"access private method"),e);var J=(i,r,e)=>new Promise((n,l)=>{var a=y=>{try{G(e.next(y))}catch(N){l(N)}},x=y=>{try{G(e.throw(y))}catch(N){l(N)}},G=y=>y.done?n(y.value):Promise.resolve(y.value).then(a,x);G((e=e.apply(i,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";var Q=i=>{throw TypeError(i)};var O=(i,r,e)=>r.has(i)||Q("Cannot "+e);var t=(i,r,e)=>(O(i,r,"read from private field"),e?e.call(i):r.get(i)),s=(i,r,e)=>r.has(i)?Q("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,e),d=(i,r,e,n)=>(O(i,r,"write to private field"),n?n.call(i,e):r.set(i,e),e),m=(i,r,e)=>(O(i,r,"access private method"),e);var J=(i,r,e)=>new Promise((n,l)=>{var a=y=>{try{G(e.next(y))}catch(N){l(N)}},x=y=>{try{G(e.throw(y))}catch(N){l(N)}},G=y=>y.done?n(y.value):Promise.resolve(y.value).then(a,x);G((e=e.apply(i,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("../index-DekP7OZe.cjs"),K=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");const B=require("../css-property/index.cjs"),W=require("../events-KVanG9sR.cjs"),X=require("../gestures-C7gbKx11.cjs"),Y=require("../math-GDWEqu7y.cjs"),Z=require("../number-DyefJ5a1.cjs");var P,k,f,E,L,S,o,h,b,$,I,_,A,j,F;class z extends HTMLElement{constructor(){super(...arguments);s(this,b);s(this,P,new B.CSSProperty(this,"--resize",!0));s(this,k,new B.CSSProperty(this,"--loop",!0));s(this,f,new B.CSSProperty(this,"--autoplay",!1));s(this,E,new B.CSSProperty(this,"--swipe","x"));s(this,L);s(this,S,!1);s(this,o,[]);s(this,h,0);s(this,I,e=>{d(this,S,e.isIntersecting),t(this,S)?m(this,b,$).call(this):clearInterval(t(this,L))});s(this,_,()=>{clearInterval(t(this,L)),t(this,S)&&d(this,L,setInterval(t(this,j),parseFloat(t(this,f).current||"0")*1e3))});s(this,j,()=>{m(this,b,A).call(this,t(this,h)+1)});s(this,F,e=>{if(!t(this,E).current)return;let n=0;X.setupDrag(l=>{const a=e.x-l.x,x=e.y-l.y;t(this,E).current==="x"?Math.abs(a)>Math.abs(x)&&Math.abs(a)>10&&(n=Math.sign(a)):t(this,E).current==="y"&&Math.abs(x)>Math.abs(a)&&Math.abs(x)>10&&(n=Math.sign(x))},()=>{n&&this.shift(n)})})}get counter(){return t(this,h)}get loop(){return t(this,k)}get autoplay(){return t(this,f)}get swipe(){return t(this,E)}get itemElements(){return t(this,o)}addItem(e){t(this,o).push(e),m(this,b,A).call(this)}set(e){(!this.handleSet||this.handleSet(e))&&(m(this,b,A).call(this,e),m(this,b,$).call(this))}shift(e){this.set(t(this,h)+e)}connectedCallback(){var e;d(this,o,[...this.querySelectorAll(`[data-billboard-item${this.id?`="${this.id}"`:""}]`)]),(e=t(this,o)[0])==null||e.classList.add("current"),t(this,f).subscribe(n=>{n.current?(M.intersector.subscribe(this,t(this,I)),m(this,b,$).call(this)):(d(this,S,!0),M.intersector.unsubscribe(t(this,I)),clearInterval(t(this,L)),m(this,b,A).call(this,0))}),t(this,f).observe(),t(this,E).observe(),t(this,k).observe(),t(this,P).observe(),m(this,b,A).call(this,0),this.addEventListener("pointerdown",t(this,F))}disconnectedCallback(){t(this,f).unobserve(),t(this,E).unobserve(),t(this,k).unobserve(),t(this,P).unobserve(),M.intersector.unsubscribe(t(this,I)),clearInterval(t(this,L))}}P=new WeakMap,k=new WeakMap,f=new WeakMap,E=new WeakMap,L=new WeakMap,S=new WeakMap,o=new WeakMap,h=new WeakMap,b=new WeakSet,$=function(){t(this,f).current!==!1&&t(this,_).call(this)},I=new WeakMap,_=new WeakMap,A=function(e=t(this,h)){const n=t(this,h);t(this,k).current?d(this,h,Z.loopNumber(e,t(this,o).length)):d(this,h,Y.clamp(e,0,t(this,o).length-1)),this.classList.remove("forward","backward"),t(this,h)-n>=0?this.classList.add("forward"):t(this,h)-n<0&&this.classList.add("backward"),t(this,o).forEach((l,a)=>{l.classList.remove("current","previous","next"),a===t(this,h)?l.classList.add("current"):a<t(this,h)?l.classList.add("previous"):a>t(this,h)&&l.classList.add("next")}),this.classList.toggle("has-length",t(this,o).length>1),this.classList.toggle("start",t(this,h)===0),this.classList.toggle("end",t(this,h)===t(this,o).length-1),this.style.setProperty("--counter",t(this,h).toString()),this.style.setProperty("--sections",t(this,o).length.toString()),t(this,h)!==n&&(W.dispatchEvent(this,"billboardChange",{detail:{counter:t(this,h)}}),t(this,P).current&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},0))},j=new WeakMap,F=new WeakMap;customElements.get("e-billboard")||customElements.define("e-billboard",z);var u,T,p,H,q;class R extends HTMLElement{constructor(){super(...arguments);s(this,u,null);s(this,T,null);s(this,p,[]);s(this,H,e=>{const n=e.currentTarget,l=t(this,p).findIndex(a=>a===n);l>=0&&t(this,u).set(l)});s(this,q,()=>{t(this,p).forEach((e,n)=>{n===t(this,u).counter?e.classList.add("current"):e.classList.remove("current")})})}connectedCallback(){return J(this,null,function*(){var e;if(d(this,u,K.findParentElement(this,z)),t(this,u)&&(yield customElements.whenDefined("e-billboard"),this.isConnected)){this.innerHTML="";const n=t(this,u).itemElements.length;d(this,T,document.createElement("div"));for(let l=0;l<n;l++){const a=document.createElement("button");a.setAttribute("aria-label",`Go to item ${l+1}`),t(this,p).push(a),t(this,T).appendChild(a)}this.appendChild(t(this,T)),t(this,p).forEach(l=>{l.addEventListener("click",t(this,H))}),(e=t(this,u))==null||e.addEventListener("billboardChange",t(this,q)),t(this,q).call(this)}})}disconnectedCallback(){var e;t(this,p).forEach(n=>{n.removeEventListener("click",t(this,H))}),(e=t(this,u))==null||e.removeEventListener("billboardChange",t(this,q)),this.innerHTML="",d(this,p,[])}}u=new WeakMap,T=new WeakMap,p=new WeakMap,H=new WeakMap,q=new WeakMap;M.isBrowser&&!customElements.get("e-billboard-bullets")&&customElements.define("e-billboard-bullets",R);var v,g,w;class U extends HTMLElement{constructor(){super();s(this,v,new B.CSSProperty(this,"--index",0));s(this,g,null);s(this,w,()=>{var e;t(this,v).current===((e=t(this,g))==null?void 0:e.counter)?this.classList.add("current"):this.classList.remove("current")});this.addEventListener("click",e=>{t(this,g)&&(!this.handleClick||this.handleClick(e))&&t(this,g).set(t(this,v).current)}),this.addEventListener("keydown",e=>{e.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(e.preventDefault(),this.click())})}connectedCallback(){var e;this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button"),d(this,g,K.findParentElement(this,z)),(e=t(this,g))==null||e.addEventListener("billboardChange",t(this,w)),customElements.whenDefined("e-billboard").then(()=>{this.isConnected&&t(this,w).call(this)}),t(this,v).subscribe(t(this,w)),t(this,v).observe()}disconnectedCallback(){var e;this.removeAttribute("tabindex"),this.removeAttribute("role"),t(this,v).unsubscribe(t(this,w)),t(this,v).unobserve(),(e=t(this,g))==null||e.removeEventListener("billboardChange",t(this,w))}}v=new WeakMap,g=new WeakMap,w=new WeakMap;M.isBrowser&&!customElements.get("e-billboard-set-button")&&customElements.define("e-billboard-set-button",U);var C,c,D;class V extends HTMLElement{constructor(){super();s(this,C,new B.CSSProperty(this,"--step",1));s(this,c,null);s(this,D,()=>{t(this,c)&&(!t(this,c).loop.current&&(t(this,c).counter===0&&t(this,C).current<=0||t(this,c).counter===t(this,c).itemElements.length-1&&t(this,C).current>=0)?this.setAttribute("disabled",""):this.removeAttribute("disabled"))});this.addEventListener("click",e=>{t(this,c)&&(!this.handleClick||this.handleClick(e))&&t(this,c).shift(t(this,C).current)}),this.addEventListener("keydown",e=>{e.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(e.preventDefault(),this.click())})}connectedCallback(){return J(this,null,function*(){var e;yield customElements.whenDefined("e-billboard"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button"),t(this,C).observe(),this.tabIndex=0,d(this,c,K.findParentElement(this,z)),(e=t(this,c))==null||e.addEventListener("billboardChange",t(this,D)),setTimeout(()=>{t(this,D).call(this)},0)})}disconnectedCallback(){var e;this.removeAttribute("tabindex"),this.removeAttribute("role"),t(this,C).unobserve(),(e=t(this,c))==null||e.removeEventListener("billboardChange",t(this,D))}}C=new WeakMap,c=new WeakMap,D=new WeakMap;M.isBrowser&&!customElements.get("e-billboard-step-button")&&customElements.define("e-billboard-step-button",V);exports.BillboardBulletsElement=R;exports.BillboardElement=z;exports.BillboardSetButtonElement=U;exports.BillboardStepButtonElement=V;
|
package/lib/billboard/index.js
CHANGED
|
@@ -10,32 +10,32 @@ var K = (i, r, e) => new Promise((n, l) => {
|
|
|
10
10
|
} catch (j) {
|
|
11
11
|
l(j);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, A = (C) => {
|
|
14
14
|
try {
|
|
15
15
|
N(e.throw(C));
|
|
16
16
|
} catch (j) {
|
|
17
17
|
l(j);
|
|
18
18
|
}
|
|
19
|
-
}, N = (C) => C.done ? n(C.value) : Promise.resolve(C.value).then(a,
|
|
19
|
+
}, N = (C) => C.done ? n(C.value) : Promise.resolve(C.value).then(a, A);
|
|
20
20
|
N((e = e.apply(i, r)).next());
|
|
21
21
|
});
|
|
22
22
|
import { a as O, i as Q } from "../index-Bv9zgfdb.js";
|
|
23
23
|
import { b as R } from "../dom-CVWzyXPH.js";
|
|
24
24
|
import "construct-style-sheets-polyfill";
|
|
25
|
-
import { CSSProperty as
|
|
25
|
+
import { CSSProperty as I } from "../css-property/index.js";
|
|
26
26
|
import { d as V } from "../events-CsVF98U6.js";
|
|
27
27
|
import { s as W } from "../gestures-CcXV6fCp.js";
|
|
28
28
|
import { c as X } from "../math-BOBiC4TN.js";
|
|
29
29
|
import { l as Y } from "../number-CbdpfO3u.js";
|
|
30
|
-
var
|
|
30
|
+
var S, x, f, p, L, y, o, h, b, z, T, $, M, q, F;
|
|
31
31
|
class G extends HTMLElement {
|
|
32
32
|
constructor() {
|
|
33
33
|
super(...arguments);
|
|
34
34
|
s(this, b);
|
|
35
|
-
s(this,
|
|
36
|
-
s(this, x, new
|
|
37
|
-
s(this, f, new
|
|
38
|
-
s(this, p, new
|
|
35
|
+
s(this, S, new I(this, "--resize", !0));
|
|
36
|
+
s(this, x, new I(this, "--loop", !0));
|
|
37
|
+
s(this, f, new I(this, "--autoplay", !1));
|
|
38
|
+
s(this, p, new I(this, "--swipe", "x"));
|
|
39
39
|
s(this, L);
|
|
40
40
|
s(this, y, !1);
|
|
41
41
|
s(this, o, []);
|
|
@@ -50,7 +50,7 @@ class G extends HTMLElement {
|
|
|
50
50
|
));
|
|
51
51
|
});
|
|
52
52
|
s(this, q, () => {
|
|
53
|
-
m(this, b,
|
|
53
|
+
m(this, b, M).call(this, t(this, h) + 1);
|
|
54
54
|
});
|
|
55
55
|
s(this, F, (e) => {
|
|
56
56
|
if (!t(this, p).current)
|
|
@@ -58,8 +58,8 @@ class G extends HTMLElement {
|
|
|
58
58
|
let n = 0;
|
|
59
59
|
W(
|
|
60
60
|
(l) => {
|
|
61
|
-
const a = e.x - l.x,
|
|
62
|
-
t(this, p).current === "x" ? Math.abs(a) > Math.abs(
|
|
61
|
+
const a = e.x - l.x, A = e.y - l.y;
|
|
62
|
+
t(this, p).current === "x" ? Math.abs(a) > Math.abs(A) && Math.abs(a) > 10 && (n = Math.sign(a)) : t(this, p).current === "y" && Math.abs(A) > Math.abs(a) && Math.abs(A) > 10 && (n = Math.sign(A));
|
|
63
63
|
},
|
|
64
64
|
() => {
|
|
65
65
|
n && this.shift(n);
|
|
@@ -83,10 +83,10 @@ class G extends HTMLElement {
|
|
|
83
83
|
return t(this, o);
|
|
84
84
|
}
|
|
85
85
|
addItem(e) {
|
|
86
|
-
t(this, o).push(e), m(this, b,
|
|
86
|
+
t(this, o).push(e), m(this, b, M).call(this);
|
|
87
87
|
}
|
|
88
88
|
set(e) {
|
|
89
|
-
(!this.handleSet || this.handleSet(e)) && (m(this, b,
|
|
89
|
+
(!this.handleSet || this.handleSet(e)) && (m(this, b, M).call(this, e), m(this, b, z).call(this));
|
|
90
90
|
}
|
|
91
91
|
shift(e) {
|
|
92
92
|
this.set(t(this, h) + e);
|
|
@@ -98,16 +98,16 @@ class G extends HTMLElement {
|
|
|
98
98
|
`[data-billboard-item${this.id ? `="${this.id}"` : ""}]`
|
|
99
99
|
)
|
|
100
100
|
]), (e = t(this, o)[0]) == null || e.classList.add("current"), t(this, f).subscribe((n) => {
|
|
101
|
-
n.current ? (O.subscribe(this, t(this, T)), m(this, b, z).call(this)) : (d(this, y, !0), O.unsubscribe(t(this, T)), clearInterval(t(this, L)), m(this, b,
|
|
102
|
-
}), t(this, f).observe(), t(this, p).observe(), t(this, x).observe(), t(this,
|
|
101
|
+
n.current ? (O.subscribe(this, t(this, T)), m(this, b, z).call(this)) : (d(this, y, !0), O.unsubscribe(t(this, T)), clearInterval(t(this, L)), m(this, b, M).call(this, 0));
|
|
102
|
+
}), t(this, f).observe(), t(this, p).observe(), t(this, x).observe(), t(this, S).observe(), m(this, b, M).call(this, 0), this.addEventListener("pointerdown", t(this, F));
|
|
103
103
|
}
|
|
104
104
|
disconnectedCallback() {
|
|
105
|
-
t(this, f).unobserve(), t(this, p).unobserve(), t(this, x).unobserve(), t(this,
|
|
105
|
+
t(this, f).unobserve(), t(this, p).unobserve(), t(this, x).unobserve(), t(this, S).unobserve(), O.unsubscribe(t(this, T)), clearInterval(t(this, L));
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
S = new WeakMap(), x = new WeakMap(), f = new WeakMap(), p = new WeakMap(), L = new WeakMap(), y = new WeakMap(), o = new WeakMap(), h = new WeakMap(), b = new WeakSet(), z = function() {
|
|
109
109
|
t(this, f).current !== !1 && t(this, $).call(this);
|
|
110
|
-
}, T = new WeakMap(), $ = new WeakMap(),
|
|
110
|
+
}, T = new WeakMap(), $ = new WeakMap(), M = function(e = t(this, h)) {
|
|
111
111
|
const n = t(this, h);
|
|
112
112
|
t(this, x).current ? d(this, h, Y(e, t(this, o).length)) : d(this, h, X(e, 0, t(this, o).length - 1)), this.classList.remove("forward", "backward"), t(this, h) - n >= 0 ? this.classList.add("forward") : t(this, h) - n < 0 && this.classList.add("backward"), t(this, o).forEach((l, a) => {
|
|
113
113
|
l.classList.remove("current", "previous", "next"), a === t(this, h) ? l.classList.add("current") : a < t(this, h) ? l.classList.add("previous") : a > t(this, h) && l.classList.add("next");
|
|
@@ -118,7 +118,7 @@ A = new WeakMap(), x = new WeakMap(), f = new WeakMap(), p = new WeakMap(), L =
|
|
|
118
118
|
detail: {
|
|
119
119
|
counter: t(this, h)
|
|
120
120
|
}
|
|
121
|
-
}), t(this,
|
|
121
|
+
}), t(this, S).current && setTimeout(() => {
|
|
122
122
|
window.dispatchEvent(new Event("resize"));
|
|
123
123
|
}, 0));
|
|
124
124
|
}, q = new WeakMap(), F = new WeakMap();
|
|
@@ -176,7 +176,7 @@ var E, g, w;
|
|
|
176
176
|
class _ extends HTMLElement {
|
|
177
177
|
constructor() {
|
|
178
178
|
super();
|
|
179
|
-
s(this, E, new
|
|
179
|
+
s(this, E, new I(this, "--index", 0));
|
|
180
180
|
s(this, g, null);
|
|
181
181
|
s(this, w, () => {
|
|
182
182
|
var e;
|
|
@@ -190,7 +190,7 @@ class _ extends HTMLElement {
|
|
|
190
190
|
}
|
|
191
191
|
connectedCallback() {
|
|
192
192
|
var e;
|
|
193
|
-
this.
|
|
193
|
+
this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.hasAttribute("role") || this.setAttribute("role", "button"), d(this, g, R(this, G)), (e = t(this, g)) == null || e.addEventListener(
|
|
194
194
|
"billboardChange",
|
|
195
195
|
t(this, w)
|
|
196
196
|
), customElements.whenDefined("e-billboard").then(() => {
|
|
@@ -199,7 +199,7 @@ class _ extends HTMLElement {
|
|
|
199
199
|
}
|
|
200
200
|
disconnectedCallback() {
|
|
201
201
|
var e;
|
|
202
|
-
this.removeAttribute("tabindex"), t(this, E).unsubscribe(t(this, w)), t(this, E).unobserve(), (e = t(this, g)) == null || e.removeEventListener(
|
|
202
|
+
this.removeAttribute("tabindex"), this.removeAttribute("role"), t(this, E).unsubscribe(t(this, w)), t(this, E).unobserve(), (e = t(this, g)) == null || e.removeEventListener(
|
|
203
203
|
"billboardChange",
|
|
204
204
|
t(this, w)
|
|
205
205
|
);
|
|
@@ -211,7 +211,7 @@ var k, c, H;
|
|
|
211
211
|
class tt extends HTMLElement {
|
|
212
212
|
constructor() {
|
|
213
213
|
super();
|
|
214
|
-
s(this, k, new
|
|
214
|
+
s(this, k, new I(this, "--step", 1));
|
|
215
215
|
s(this, c, null);
|
|
216
216
|
s(this, H, () => {
|
|
217
217
|
t(this, c) && (!t(this, c).loop.current && (t(this, c).counter === 0 && t(this, k).current <= 0 || t(this, c).counter === t(this, c).itemElements.length - 1 && t(this, k).current >= 0) ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"));
|
|
@@ -225,7 +225,7 @@ class tt extends HTMLElement {
|
|
|
225
225
|
connectedCallback() {
|
|
226
226
|
return K(this, null, function* () {
|
|
227
227
|
var e;
|
|
228
|
-
yield customElements.whenDefined("e-billboard"), t(this, k).observe(), this.tabIndex = 0, d(this, c, R(this, G)), (e = t(this, c)) == null || e.addEventListener(
|
|
228
|
+
yield customElements.whenDefined("e-billboard"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.hasAttribute("role") || this.setAttribute("role", "button"), t(this, k).observe(), this.tabIndex = 0, d(this, c, R(this, G)), (e = t(this, c)) == null || e.addEventListener(
|
|
229
229
|
"billboardChange",
|
|
230
230
|
t(this, H)
|
|
231
231
|
), setTimeout(() => {
|
|
@@ -235,7 +235,7 @@ class tt extends HTMLElement {
|
|
|
235
235
|
}
|
|
236
236
|
disconnectedCallback() {
|
|
237
237
|
var e;
|
|
238
|
-
this.removeAttribute("tabindex"), t(this, k).unobserve(), (e = t(this, c)) == null || e.removeEventListener(
|
|
238
|
+
this.removeAttribute("tabindex"), this.removeAttribute("role"), t(this, k).unobserve(), (e = t(this, c)) == null || e.removeEventListener(
|
|
239
239
|
"billboardChange",
|
|
240
240
|
t(this, H)
|
|
241
241
|
);
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var te=c=>{throw TypeError(c)};var Q=(c,o,t)=>o.has(c)||te("Cannot "+t);var e=(c,o,t)=>(Q(c,o,"read from private field"),t?t.call(c):o.get(c)),r=(c,o,t)=>o.has(c)?te("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(c):o.set(c,t),n=(c,o,t,s)=>(Q(c,o,"write to private field"),s?s.call(c,t):o.set(c,t),t),b=(c,o,t)=>(Q(c,o,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const he=require("../element-linked-store/index.cjs"),m=require("../css-property/index.cjs"),_=require("../index-DekP7OZe.cjs"),Y=require("../events-KVanG9sR.cjs"),ce=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ie=require("../url-lnBE_6yf.cjs"),re=require("../window-resizer/index.cjs"),F=require("../Viewport-DB0qAZPJ.cjs");var u,y,J,K;class le{constructor(){r(this,u,new Map);r(this,y,[]);r(this,J,o=>{var s;const t=[...e(this,y)].reverse().find(i=>i.clickOutside.current);if(t){const i=o.composedPath();if(i.find(ee=>ee instanceof HTMLElement&&ee.hasAttribute("data-popover-content")))return;const l=i[0],p=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),H=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!p||H)&&t.close()}});r(this,K,o=>{if(o.code==="Escape"){const t=[...e(this,y)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,J)),addEventListener("keydown",e(this,K))}get groups(){return e(this,u)}get stack(){return e(this,y)}add(o,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(o);i==null||i.forEach(l=>{l.close()})}let s=e(this,u).get(o);s!=null&&s.length||(s=[],e(this,u).set(o,s)),e(this,y).push(t),s.push(t)}remove(o,t){if(n(this,y,e(this,y).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(o);e(this,u).delete(o),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(o);s&&(s=s.filter(i=>i!==t),e(this,u).set(o,s))}}}u=new WeakMap,y=new WeakMap,J=new WeakMap,K=new WeakMap;var f,$,M,C,B,v,w,x,A,g,R,q,L,T,O,a,P,oe,I,V,S,W,G;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,$);r(this,M);r(this,C);r(this,B);r(this,v);r(this,w);r(this,x);r(this,A);r(this,g);r(this,R);r(this,q);r(this,L);r(this,T);r(this,O);r(this,a);r(this,V);r(this,S);r(this,W);r(this,G);this.urlValue="",n(this,f,!1),n(this,v,new m.CSSProperty(this,"--history",!1)),n(this,w,new m.CSSProperty(this,"--restore",!1)),n(this,x,new m.CSSProperty(this,"--close-rest",!1)),n(this,A,new m.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new m.CSSProperty(this,"--group","")),n(this,R,new m.CSSProperty(this,"--click-outside",!1)),n(this,q,new m.CSSProperty(this,"--escape",!1)),n(this,L,new m.CSSProperty(this,"--check-viewport-bounds",!1)),n(this,T,!1),n(this,a,new he.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),n(this,V,()=>{n(this,T,!1),e(this,f)&&e(this,v).current&&!location.search.includes(this.id)?this.close():!e(this,f)&&e(this,v).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,T,!0)}),n(this,S,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,W).call(this)}),n(this,W,ce.debounce(()=>{e(this,G).call(this)},10)),n(this,G,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,L).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>F.viewport.width?s=F.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>F.viewport.height?i=F.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"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,a).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),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get history(){return e(this,v)}get restore(){return e(this,w)}get closeRest(){return e(this,x)}get closeRestInGroup(){return e(this,A)}get group(){return e(this,g)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,f)}get lastTrigger(){return e(this,O)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,f)&&ie.updateSearchParameter(this.id,t)}open(t){if(e(this,f))return;n(this,O,t==null?void 0:t.trigger),clearTimeout(e(this,$)),clearTimeout(e(this,M)),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),Y.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,O)}}),e(this,v).current&&e(this,T)&&history.pushState(history.state,"",e(this,P,oe)),n(this,f,!0);const s=()=>{E.stack.add(e(this,g).current,this),e(this,S).call(this),e(this,a).set("opened",!0),Y.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,O)}}),n(this,C,void 0),n(this,B,setTimeout(()=>{e(this,a).set("transitionend",!0)},se.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():n(this,C,setTimeout(s,10))}close(){e(this,f)&&(clearTimeout(e(this,C)),clearTimeout(e(this,B)),E.stack.remove(e(this,g).current,this),n(this,f,!1),b(this,P,I).call(this),e(this,a).set("transitionend",!1),n(this,$,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),Y.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,M,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),Y.dispatchEvent(this,"popoverClosed",{custom:!0})},se.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){e(this,v).observe(),e(this,w).observe(),e(this,x).observe(),e(this,A).observe(),e(this,g).observe(),e(this,R).observe(),e(this,q).observe(),e(this,L).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,V)),setTimeout(()=>{e(this,w).current?(this.urlValue=ie.parseSearchParameters(location.search)[this.id],e(this,V).call(this)):(b(this,P,I).call(this),n(this,T,!0))},0),e(this,L).subscribe(()=>{e(this,S).call(this)}),re.windowResizer.subscribe(e(this,S))}disconnectedCallback(){E.stack.remove(e(this,g).current,this),re.windowResizer.unsubscribe(e(this,S)),e(this,a).close(),e(this,v).close(),e(this,w).close(),e(this,x).close(),e(this,A).close(),e(this,g).close(),e(this,R).close(),e(this,q).close(),e(this,L).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,M)),clearTimeout(e(this,C)),clearTimeout(e(this,B)),removeEventListener("popstate",e(this,V)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),b(this,P,I).call(this)}};f=new WeakMap,$=new WeakMap,M=new WeakMap,C=new WeakMap,B=new WeakMap,v=new WeakMap,w=new WeakMap,x=new WeakMap,A=new WeakMap,g=new WeakMap,R=new WeakMap,q=new WeakMap,L=new WeakMap,T=new WeakMap,O=new WeakMap,a=new WeakMap,P=new WeakSet,oe=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},I=function(){if(e(this,v).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},V=new WeakMap,S=new WeakMap,W=new WeakMap,G=new WeakMap,E.stack=new le;let z=E;_.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,d,k,Z,D,U,j,X,N;class ne extends HTMLElement{constructor(){super();r(this,k);r(this,h);r(this,d,new m.CSSProperty(this,"--type","open"));r(this,D,()=>{e(this,d).current!=="close"&&this.classList.add("triggered")});r(this,U,()=>{e(this,d).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,j,()=>{e(this,d).current!=="close"&&this.classList.remove("opened")});r(this,X,()=>{e(this,d).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});_.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,d).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"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,d)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(b(this,k,Z).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const p=this.getRootNode();p instanceof ShadowRoot?i=p.host.closest("[data-popover]"):p instanceof HTMLElement&&(i=p.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=p=>{if(!p)return null;let H=p.querySelector("[data-popover]");return!H&&(p!=null&&p.parentElement)&&(H=l(p.parentElement)),H};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(n(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,D)),e(this,h).addEventListener("popoverOpened",e(this,U)),e(this,h).addEventListener("popoverClosing",e(this,j)),e(this,h).addEventListener("popoverClosed",e(this,X))):console.warn(this,`target ${t} not found`)}b(this,k,N).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{b(this,k,N).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,d).observe()}disconnectedCallback(){e(this,d).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),b(this,k,Z).call(this)}}h=new WeakMap,d=new WeakMap,k=new WeakSet,Z=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,D)),e(this,h).removeEventListener("popoverOpened",e(this,U)),e(this,h).removeEventListener("popoverClosing",e(this,j)),e(this,h).removeEventListener("popoverClosed",e(this,X)))},D=new WeakMap,U=new WeakMap,j=new WeakMap,X=new WeakMap,N=function(t){e(this,h)instanceof z&&(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")))};_.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ne);exports.PopoverButtonElement=ne;exports.PopoverElement=z;
|
|
1
|
+
"use strict";var te=c=>{throw TypeError(c)};var Q=(c,o,t)=>o.has(c)||te("Cannot "+t);var e=(c,o,t)=>(Q(c,o,"read from private field"),t?t.call(c):o.get(c)),r=(c,o,t)=>o.has(c)?te("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(c):o.set(c,t),n=(c,o,t,s)=>(Q(c,o,"write to private field"),s?s.call(c,t):o.set(c,t),t),y=(c,o,t)=>(Q(c,o,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const he=require("../element-linked-store/index.cjs"),m=require("../css-property/index.cjs"),_=require("../index-DekP7OZe.cjs"),Y=require("../events-KVanG9sR.cjs"),ce=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ie=require("../url-lnBE_6yf.cjs"),re=require("../window-resizer/index.cjs"),F=require("../Viewport-DB0qAZPJ.cjs");var u,b,J,K;class le{constructor(){r(this,u,new Map);r(this,b,[]);r(this,J,o=>{var s;const t=[...e(this,b)].reverse().find(i=>i.clickOutside.current);if(t){const i=o.composedPath();if(i.find(ee=>ee instanceof HTMLElement&&ee.hasAttribute("data-popover-content")))return;const l=i[0],p=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),H=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!p||H)&&t.close()}});r(this,K,o=>{if(o.code==="Escape"){const t=[...e(this,b)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,J)),addEventListener("keydown",e(this,K))}get groups(){return e(this,u)}get stack(){return e(this,b)}add(o,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(o);i==null||i.forEach(l=>{l.close()})}let s=e(this,u).get(o);s!=null&&s.length||(s=[],e(this,u).set(o,s)),e(this,b).push(t),s.push(t)}remove(o,t){if(n(this,b,e(this,b).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(o);e(this,u).delete(o),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(o);s&&(s=s.filter(i=>i!==t),e(this,u).set(o,s))}}}u=new WeakMap,b=new WeakMap,J=new WeakMap,K=new WeakMap;var f,$,M,C,B,v,w,x,A,g,R,q,L,T,O,a,P,oe,I,V,S,W,G;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,$);r(this,M);r(this,C);r(this,B);r(this,v);r(this,w);r(this,x);r(this,A);r(this,g);r(this,R);r(this,q);r(this,L);r(this,T);r(this,O);r(this,a);r(this,V);r(this,S);r(this,W);r(this,G);this.urlValue="",n(this,f,!1),n(this,v,new m.CSSProperty(this,"--history",!1)),n(this,w,new m.CSSProperty(this,"--restore",!1)),n(this,x,new m.CSSProperty(this,"--close-rest",!1)),n(this,A,new m.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new m.CSSProperty(this,"--group","")),n(this,R,new m.CSSProperty(this,"--click-outside",!1)),n(this,q,new m.CSSProperty(this,"--escape",!1)),n(this,L,new m.CSSProperty(this,"--check-viewport-bounds",!1)),n(this,T,!1),n(this,a,new he.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),n(this,V,()=>{n(this,T,!1),e(this,f)&&e(this,v).current&&!location.search.includes(this.id)?this.close():!e(this,f)&&e(this,v).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,T,!0)}),n(this,S,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,W).call(this)}),n(this,W,ce.debounce(()=>{e(this,G).call(this)},10)),n(this,G,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,L).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>F.viewport.width?s=F.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>F.viewport.height?i=F.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"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,a).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),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get history(){return e(this,v)}get restore(){return e(this,w)}get closeRest(){return e(this,x)}get closeRestInGroup(){return e(this,A)}get group(){return e(this,g)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,f)}get lastTrigger(){return e(this,O)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,f)&&ie.updateSearchParameter(this.id,t)}open(t){if(e(this,f))return;n(this,O,t==null?void 0:t.trigger),clearTimeout(e(this,$)),clearTimeout(e(this,M)),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),Y.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,O)}}),e(this,v).current&&e(this,T)&&history.pushState(history.state,"",e(this,P,oe)),n(this,f,!0);const s=()=>{E.stack.add(e(this,g).current,this),e(this,S).call(this),e(this,a).set("opened",!0),Y.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,O)}}),n(this,C,void 0),n(this,B,setTimeout(()=>{e(this,a).set("transitionend",!0)},se.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():n(this,C,setTimeout(s,10))}close(){e(this,f)&&(clearTimeout(e(this,C)),clearTimeout(e(this,B)),E.stack.remove(e(this,g).current,this),n(this,f,!1),y(this,P,I).call(this),e(this,a).set("transitionend",!1),n(this,$,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),Y.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,M,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),Y.dispatchEvent(this,"popoverClosed",{custom:!0})},se.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){e(this,v).observe(),e(this,w).observe(),e(this,x).observe(),e(this,A).observe(),e(this,g).observe(),e(this,R).observe(),e(this,q).observe(),e(this,L).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,V)),setTimeout(()=>{e(this,w).current?(this.urlValue=ie.parseSearchParameters(location.search)[this.id],e(this,V).call(this)):(y(this,P,I).call(this),n(this,T,!0))},0),e(this,L).subscribe(()=>{e(this,S).call(this)}),re.windowResizer.subscribe(e(this,S))}disconnectedCallback(){E.stack.remove(e(this,g).current,this),re.windowResizer.unsubscribe(e(this,S)),e(this,a).close(),e(this,v).close(),e(this,w).close(),e(this,x).close(),e(this,A).close(),e(this,g).close(),e(this,R).close(),e(this,q).close(),e(this,L).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,M)),clearTimeout(e(this,C)),clearTimeout(e(this,B)),removeEventListener("popstate",e(this,V)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),y(this,P,I).call(this)}};f=new WeakMap,$=new WeakMap,M=new WeakMap,C=new WeakMap,B=new WeakMap,v=new WeakMap,w=new WeakMap,x=new WeakMap,A=new WeakMap,g=new WeakMap,R=new WeakMap,q=new WeakMap,L=new WeakMap,T=new WeakMap,O=new WeakMap,a=new WeakMap,P=new WeakSet,oe=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},I=function(){if(e(this,v).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},V=new WeakMap,S=new WeakMap,W=new WeakMap,G=new WeakMap,E.stack=new le;let z=E;_.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,d,k,Z,D,U,j,X,N;class ne extends HTMLElement{constructor(){super();r(this,k);r(this,h);r(this,d,new m.CSSProperty(this,"--type","open"));r(this,D,()=>{e(this,d).current!=="close"&&this.classList.add("triggered")});r(this,U,()=>{e(this,d).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,j,()=>{e(this,d).current!=="close"&&this.classList.remove("opened")});r(this,X,()=>{e(this,d).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});_.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,d).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"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,d)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(y(this,k,Z).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const p=this.getRootNode();p instanceof ShadowRoot?i=p.host.closest("[data-popover]"):p instanceof HTMLElement&&(i=p.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=p=>{if(!p)return null;let H=p.querySelector("[data-popover]");return!H&&(p!=null&&p.parentElement)&&(H=l(p.parentElement)),H};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(n(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,D)),e(this,h).addEventListener("popoverOpened",e(this,U)),e(this,h).addEventListener("popoverClosing",e(this,j)),e(this,h).addEventListener("popoverClosed",e(this,X))):console.warn(this,`target ${t} not found`)}y(this,k,N).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{y(this,k,N).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,d).observe()}disconnectedCallback(){e(this,d).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),y(this,k,Z).call(this)}}h=new WeakMap,d=new WeakMap,k=new WeakSet,Z=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,D)),e(this,h).removeEventListener("popoverOpened",e(this,U)),e(this,h).removeEventListener("popoverClosing",e(this,j)),e(this,h).removeEventListener("popoverClosed",e(this,X)))},D=new WeakMap,U=new WeakMap,j=new WeakMap,X=new WeakMap,N=function(t){e(this,h)instanceof z&&(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")))};_.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ne);exports.PopoverButtonElement=ne;exports.PopoverElement=z;
|
package/lib/popover/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var et = (c) => {
|
|
|
4
4
|
var Q = (c, o, e) => o.has(c) || et("Cannot " + e);
|
|
5
5
|
var t = (c, o, e) => (Q(c, o, "read from private field"), e ? e.call(c) : o.get(c)), r = (c, o, e) => o.has(c) ? et("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(c) : o.set(c, e), h = (c, o, e, s) => (Q(c, o, "write to private field"), s ? s.call(c, e) : o.set(c, e), e), y = (c, o, e) => (Q(c, o, "access private method"), e);
|
|
6
6
|
import { ElementLinkedStore as ot } from "../element-linked-store/index.js";
|
|
7
|
-
import { CSSProperty as
|
|
7
|
+
import { CSSProperty as g } from "../css-property/index.js";
|
|
8
8
|
import { i as _ } from "../index-Bv9zgfdb.js";
|
|
9
9
|
import { d as Y } from "../events-CsVF98U6.js";
|
|
10
10
|
import { d as ht } from "../function-C10DGppn.js";
|
|
@@ -82,21 +82,21 @@ class lt {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
u = new WeakMap(), b = new WeakMap(), J = new WeakMap(), K = new WeakMap();
|
|
85
|
-
var f, M, H,
|
|
85
|
+
var f, M, H, x, W, m, w, S, C, v, R, $, L, T, O, a, A, rt, F, V, k, q, z;
|
|
86
86
|
const E = class E extends HTMLElement {
|
|
87
87
|
constructor() {
|
|
88
88
|
super();
|
|
89
|
-
r(this,
|
|
89
|
+
r(this, A);
|
|
90
90
|
r(this, f);
|
|
91
91
|
r(this, M);
|
|
92
92
|
r(this, H);
|
|
93
|
-
r(this,
|
|
93
|
+
r(this, x);
|
|
94
94
|
r(this, W);
|
|
95
95
|
r(this, m);
|
|
96
96
|
r(this, w);
|
|
97
97
|
r(this, S);
|
|
98
98
|
r(this, C);
|
|
99
|
-
r(this,
|
|
99
|
+
r(this, v);
|
|
100
100
|
r(this, R);
|
|
101
101
|
r(this, $);
|
|
102
102
|
r(this, L);
|
|
@@ -107,11 +107,11 @@ const E = class E extends HTMLElement {
|
|
|
107
107
|
r(this, k);
|
|
108
108
|
r(this, q);
|
|
109
109
|
r(this, z);
|
|
110
|
-
this.urlValue = "", h(this, f, !1), h(this, m, new
|
|
110
|
+
this.urlValue = "", h(this, f, !1), h(this, m, new g(this, "--history", !1)), h(this, w, new g(this, "--restore", !1)), h(this, S, new g(this, "--close-rest", !1)), h(this, C, new g(
|
|
111
111
|
this,
|
|
112
112
|
"--close-rest-in-group",
|
|
113
113
|
!1
|
|
114
|
-
)), h(this,
|
|
114
|
+
)), h(this, v, new g(this, "--group", "")), h(this, R, new g(this, "--click-outside", !1)), h(this, $, new g(this, "--escape", !1)), h(this, L, new g(this, "--check-viewport-bounds", !1)), h(this, T, !1), h(this, a, new ot(this, {
|
|
115
115
|
opened: !1,
|
|
116
116
|
closing: !1,
|
|
117
117
|
triggered: !1,
|
|
@@ -128,7 +128,7 @@ const E = class E extends HTMLElement {
|
|
|
128
128
|
let s = 0, i = 0;
|
|
129
129
|
e.right > j.width ? s = j.width - e.right : e.left < 0 && (s = e.left * -1), e.bottom > j.height ? i = j.height - e.bottom : e.top < 0 && (i = e.top * -1), this.style.setProperty("--viewport-offset-x", s + "px"), this.style.setProperty("--viewport-offset-y", i + "px");
|
|
130
130
|
}
|
|
131
|
-
}), t(this,
|
|
131
|
+
}), t(this, v).subscribe((e) => {
|
|
132
132
|
e.previous && (E.stack.remove(e.previous, this), e.current || (document.documentElement.classList.remove(
|
|
133
133
|
`${this.group.previous}-closing`
|
|
134
134
|
), document.documentElement.classList.remove(
|
|
@@ -161,7 +161,7 @@ const E = class E extends HTMLElement {
|
|
|
161
161
|
return t(this, C);
|
|
162
162
|
}
|
|
163
163
|
get group() {
|
|
164
|
-
return t(this,
|
|
164
|
+
return t(this, v);
|
|
165
165
|
}
|
|
166
166
|
get clickOutside() {
|
|
167
167
|
return t(this, R);
|
|
@@ -189,21 +189,21 @@ const E = class E extends HTMLElement {
|
|
|
189
189
|
detail: {
|
|
190
190
|
trigger: t(this, O)
|
|
191
191
|
}
|
|
192
|
-
}), t(this, m).current && t(this, T) && history.pushState(history.state, "", t(this,
|
|
192
|
+
}), t(this, m).current && t(this, T) && history.pushState(history.state, "", t(this, A, rt)), h(this, f, !0);
|
|
193
193
|
const s = () => {
|
|
194
|
-
E.stack.add(t(this,
|
|
194
|
+
E.stack.add(t(this, v).current, this), t(this, k).call(this), t(this, a).set("opened", !0), Y(this, "popoverOpened", {
|
|
195
195
|
custom: !0,
|
|
196
196
|
detail: {
|
|
197
197
|
trigger: t(this, O)
|
|
198
198
|
}
|
|
199
|
-
}), h(this,
|
|
199
|
+
}), h(this, x, void 0), h(this, W, setTimeout(() => {
|
|
200
200
|
t(this, a).set("transitionend", !0);
|
|
201
201
|
}, st(this) + 10));
|
|
202
202
|
};
|
|
203
|
-
e != null && e.skipTransition ? s() : h(this,
|
|
203
|
+
e != null && e.skipTransition ? s() : h(this, x, setTimeout(s, 10));
|
|
204
204
|
}
|
|
205
205
|
close() {
|
|
206
|
-
t(this, f) && (clearTimeout(t(this,
|
|
206
|
+
t(this, f) && (clearTimeout(t(this, x)), clearTimeout(t(this, W)), E.stack.remove(t(this, v).current, this), h(this, f, !1), y(this, A, F).call(this), t(this, a).set("transitionend", !1), h(this, M, setTimeout(() => {
|
|
207
207
|
t(this, a).set("opened", !1), t(this, a).set("closing", !0), Y(this, "popoverClosing", {
|
|
208
208
|
custom: !0
|
|
209
209
|
}), h(this, H, setTimeout(() => {
|
|
@@ -214,17 +214,17 @@ const E = class E extends HTMLElement {
|
|
|
214
214
|
}, 10)));
|
|
215
215
|
}
|
|
216
216
|
connectedCallback() {
|
|
217
|
-
t(this, m).observe(), t(this, w).observe(), t(this, S).observe(), t(this, C).observe(), t(this,
|
|
218
|
-
t(this, w).current ? (this.urlValue = ct(location.search)[this.id], t(this, V).call(this)) : (y(this,
|
|
217
|
+
t(this, m).observe(), t(this, w).observe(), t(this, S).observe(), t(this, C).observe(), t(this, v).observe(), t(this, R).observe(), t(this, $).observe(), t(this, L).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", t(this, V)), setTimeout(() => {
|
|
218
|
+
t(this, w).current ? (this.urlValue = ct(location.search)[this.id], t(this, V).call(this)) : (y(this, A, F).call(this), h(this, T, !0));
|
|
219
219
|
}, 0), t(this, L).subscribe(() => {
|
|
220
220
|
t(this, k).call(this);
|
|
221
221
|
}), it.subscribe(t(this, k));
|
|
222
222
|
}
|
|
223
223
|
disconnectedCallback() {
|
|
224
|
-
E.stack.remove(t(this,
|
|
224
|
+
E.stack.remove(t(this, v).current, this), it.unsubscribe(t(this, k)), t(this, a).close(), t(this, m).close(), t(this, w).close(), t(this, S).close(), t(this, C).close(), t(this, v).close(), t(this, R).close(), t(this, $).close(), t(this, L).close(), this.removeAttribute("role"), clearTimeout(t(this, M)), clearTimeout(t(this, H)), clearTimeout(t(this, x)), clearTimeout(t(this, W)), removeEventListener("popstate", t(this, V)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), this.style.removeProperty("--viewport-offset-x"), this.style.removeProperty("--viewport-offset-y"), y(this, A, F).call(this);
|
|
225
225
|
}
|
|
226
226
|
};
|
|
227
|
-
f = new WeakMap(), M = new WeakMap(), H = new WeakMap(),
|
|
227
|
+
f = new WeakMap(), M = new WeakMap(), H = new WeakMap(), x = new WeakMap(), W = new WeakMap(), m = new WeakMap(), w = new WeakMap(), S = new WeakMap(), C = new WeakMap(), v = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), L = new WeakMap(), T = new WeakMap(), O = new WeakMap(), a = new WeakMap(), A = new WeakSet(), rt = function() {
|
|
228
228
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
|
|
229
229
|
}, F = function() {
|
|
230
230
|
if (t(this, m).current) {
|
|
@@ -234,13 +234,13 @@ f = new WeakMap(), M = new WeakMap(), H = new WeakMap(), A = new WeakMap(), W =
|
|
|
234
234
|
}, V = new WeakMap(), k = new WeakMap(), q = new WeakMap(), z = new WeakMap(), E.stack = new lt();
|
|
235
235
|
let I = E;
|
|
236
236
|
_ && !customElements.get("e-popover") && customElements.define("e-popover", I);
|
|
237
|
-
var n, d,
|
|
237
|
+
var n, d, P, Z, B, D, U, X, N;
|
|
238
238
|
class at extends HTMLElement {
|
|
239
239
|
constructor() {
|
|
240
240
|
super();
|
|
241
|
-
r(this,
|
|
241
|
+
r(this, P);
|
|
242
242
|
r(this, n);
|
|
243
|
-
r(this, d, new
|
|
243
|
+
r(this, d, new g(this, "--type", "open"));
|
|
244
244
|
r(this, B, () => {
|
|
245
245
|
t(this, d).current !== "close" && this.classList.add("triggered");
|
|
246
246
|
});
|
|
@@ -270,7 +270,7 @@ class at extends HTMLElement {
|
|
|
270
270
|
}
|
|
271
271
|
changePopover(e) {
|
|
272
272
|
var s;
|
|
273
|
-
if (y(this,
|
|
273
|
+
if (y(this, P, Z).call(this), e) {
|
|
274
274
|
let i = null;
|
|
275
275
|
if (e === "parent") {
|
|
276
276
|
const l = this.closest("[data-popover]");
|
|
@@ -306,20 +306,20 @@ class at extends HTMLElement {
|
|
|
306
306
|
t(this, X)
|
|
307
307
|
)) : console.warn(this, `target ${e} not found`);
|
|
308
308
|
}
|
|
309
|
-
y(this,
|
|
309
|
+
y(this, P, N).call(this, t(this, d).current);
|
|
310
310
|
}
|
|
311
311
|
connectedCallback() {
|
|
312
312
|
t(this, d).subscribe((s) => {
|
|
313
|
-
y(this,
|
|
314
|
-
}), this.hasAttribute("tabindex") || (this.tabIndex = 0);
|
|
313
|
+
y(this, P, N).call(this, s.current);
|
|
314
|
+
}), this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("role") || this.setAttribute("role", "button");
|
|
315
315
|
const e = this.getAttribute("target");
|
|
316
316
|
e && this.changePopover(e), this.isConnected && t(this, d).observe();
|
|
317
317
|
}
|
|
318
318
|
disconnectedCallback() {
|
|
319
|
-
t(this, d).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), y(this,
|
|
319
|
+
t(this, d).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), this.removeAttribute("role"), this.removeAttribute("tabindex"), y(this, P, Z).call(this);
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
n = new WeakMap(), d = new WeakMap(),
|
|
322
|
+
n = new WeakMap(), d = new WeakMap(), P = new WeakSet(), Z = function() {
|
|
323
323
|
t(this, n) && (t(this, n).removeEventListener(
|
|
324
324
|
"popoverTriggered",
|
|
325
325
|
t(this, B)
|