aptechka 0.61.10 → 0.61.12
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 +79 -80
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +31 -28
- package/package.json +1 -1
package/lib/billboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Q=i=>{throw TypeError(i)};var G=(i,r,e)=>r.has(i)||Q("Cannot "+e);var t=(i,r,e)=>(G(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)=>(G(i,r,"write to private field"),n?n.call(i,e):r.set(i,e),e),
|
|
1
|
+
"use strict";var Q=i=>{throw TypeError(i)};var G=(i,r,e)=>r.has(i)||Q("Cannot "+e);var t=(i,r,e)=>(G(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)=>(G(i,r,"write to private field"),n?n.call(i,e):r.set(i,e),e),m=(i,r,e)=>(G(i,r,"access private method"),e);var J=(i,r,e)=>new Promise((n,l)=>{var a=y=>{try{N(e.next(y))}catch(O){l(O)}},k=y=>{try{N(e.throw(y))}catch(O){l(O)}},N=y=>y.done?n(y.value):Promise.resolve(y.value).then(a,k);N((e=e.apply(i,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../index-Cqw2NKev.cjs"),K=require("../dom-JBOkFLTh.cjs"),M=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,S,f,E,L,x,o,h,u,_,T,$,B,j,F;class z extends HTMLElement{constructor(){super(...arguments);s(this,u);s(this,P,new M.CSSProperty(this,"--resize",!0));s(this,S,new M.CSSProperty(this,"--loop",!0));s(this,f,new M.CSSProperty(this,"--autoplay",!1));s(this,E,new M.CSSProperty(this,"--swipe","x"));s(this,L);s(this,x,!1);s(this,o,[]);s(this,h,0);s(this,T,e=>{d(this,x,e.isIntersecting),t(this,x)?m(this,u,_).call(this):clearInterval(t(this,L))});s(this,$,()=>{clearInterval(t(this,L)),t(this,x)&&d(this,L,setInterval(t(this,j),parseFloat(t(this,f).current||"0")*1e3))});s(this,j,()=>{m(this,u,B).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,k=e.y-l.y;t(this,E).current==="x"?Math.abs(a)>Math.abs(k)&&Math.abs(a)>10&&(n=Math.sign(a)):t(this,E).current==="y"&&Math.abs(k)>Math.abs(a)&&Math.abs(k)>10&&(n=Math.sign(k))},()=>{n&&this.shift(n)})})}get counter(){return t(this,h)}get loop(){return t(this,S)}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,u,B).call(this)}set(e){(!this.handleSet||this.handleSet(e))&&(m(this,u,B).call(this,e),m(this,u,_).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?(I.intersector.subscribe(this,t(this,T)),m(this,u,_).call(this)):(d(this,x,!0),I.intersector.unsubscribe(t(this,T)),clearInterval(t(this,L)),m(this,u,B).call(this,0))}),t(this,f).observe(),t(this,E).observe(),t(this,S).observe(),t(this,P).observe(),m(this,u,B).call(this,0),this.addEventListener("pointerdown",t(this,F))}disconnectedCallback(){t(this,f).unobserve(),t(this,E).unobserve(),t(this,S).unobserve(),t(this,P).unobserve(),I.intersector.unsubscribe(t(this,T)),clearInterval(t(this,L))}}P=new WeakMap,S=new WeakMap,f=new WeakMap,E=new WeakMap,L=new WeakMap,x=new WeakMap,o=new WeakMap,h=new WeakMap,u=new WeakSet,_=function(){t(this,f).current!==!1&&t(this,$).call(this)},T=new WeakMap,$=new WeakMap,B=function(e=t(this,h)){const n=t(this,h);t(this,S).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 b,q,p,D,A;class R extends HTMLElement{constructor(){super(...arguments);s(this,b,null);s(this,q,null);s(this,p,[]);s(this,D,e=>{const n=e.currentTarget,l=t(this,p).findIndex(a=>a===n);l>=0&&t(this,b).set(l)});s(this,A,()=>{t(this,p).forEach((e,n)=>{n===t(this,b).counter?e.classList.add("current"):e.classList.remove("current")})})}connectedCallback(){return J(this,null,function*(){var e;if(d(this,b,K.findParentElement(this,z)),t(this,b)&&(yield customElements.whenDefined("e-billboard"),this.isConnected)){this.innerHTML="";const n=t(this,b).itemElements.length;d(this,q,document.createElement("div"));for(let l=0;l<n;l++){const a=document.createElement("button");t(this,p).push(a),t(this,q).appendChild(a)}this.appendChild(t(this,q)),t(this,p).forEach(l=>{l.addEventListener("click",t(this,D))}),(e=t(this,b))==null||e.addEventListener("billboardChange",t(this,A)),t(this,A).call(this)}})}disconnectedCallback(){var e;t(this,p).forEach(n=>{n.removeEventListener("click",t(this,D))}),(e=t(this,b))==null||e.removeEventListener("billboardChange",t(this,A)),this.innerHTML="",d(this,p,[])}}b=new WeakMap,q=new WeakMap,p=new WeakMap,D=new WeakMap,A=new WeakMap;I.isBrowser&&!customElements.get("e-billboard-bullets")&&customElements.define("e-billboard-bullets",R);var v,g,C;class U extends HTMLElement{constructor(){super();s(this,v,new M.CSSProperty(this,"--index",0));s(this,g,null);s(this,C,()=>{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)})}connectedCallback(){var e;this.tabIndex=0,d(this,g,K.findParentElement(this,z)),(e=t(this,g))==null||e.addEventListener("billboardChange",t(this,C)),customElements.whenDefined("e-billboard").then(()=>{this.isConnected&&t(this,C).call(this)}),t(this,v).subscribe(t(this,C)),t(this,v).observe()}disconnectedCallback(){var e;this.removeAttribute("tabindex"),t(this,v).unsubscribe(t(this,C)),t(this,v).unobserve(),(e=t(this,g))==null||e.removeEventListener("billboardChange",t(this,C))}}v=new WeakMap,g=new WeakMap,C=new WeakMap;I.isBrowser&&!customElements.get("e-billboard-set-button")&&customElements.define("e-billboard-set-button",U);var w,c,H;class V extends HTMLElement{constructor(){super();s(this,w,new M.CSSProperty(this,"--step",1));s(this,c,null);s(this,H,()=>{t(this,c)&&(!t(this,c).loop.current&&(t(this,c).counter===0&&t(this,w).current<=0||t(this,c).counter===t(this,c).itemElements.length-1&&t(this,w).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,w).current)})}connectedCallback(){return J(this,null,function*(){var e;yield customElements.whenDefined("e-billboard"),t(this,w).observe(),this.tabIndex=0,d(this,c,K.findParentElement(this,z)),(e=t(this,c))==null||e.addEventListener("billboardChange",t(this,H)),t(this,H).call(this)})}disconnectedCallback(){var e;this.removeAttribute("tabindex"),t(this,w).unobserve(),(e=t(this,c))==null||e.removeEventListener("billboardChange",t(this,H))}}w=new WeakMap,c=new WeakMap,H=new WeakMap;I.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
|
@@ -2,62 +2,63 @@ var U = (i) => {
|
|
|
2
2
|
throw TypeError(i);
|
|
3
3
|
};
|
|
4
4
|
var J = (i, r, e) => r.has(i) || U("Cannot " + e);
|
|
5
|
-
var t = (i, r, e) => (J(i, r, "read from private field"), e ? e.call(i) : r.get(i)), s = (i, r, e) => r.has(i) ? U("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(i) : r.set(i, e), d = (i, r, e, n) => (J(i, r, "write to private field"), n ? n.call(i, e) : r.set(i, e), e),
|
|
6
|
-
var K = (i, r, e) => new Promise((n,
|
|
5
|
+
var t = (i, r, e) => (J(i, r, "read from private field"), e ? e.call(i) : r.get(i)), s = (i, r, e) => r.has(i) ? U("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(i) : r.set(i, e), d = (i, r, e, n) => (J(i, r, "write to private field"), n ? n.call(i, e) : r.set(i, e), e), m = (i, r, e) => (J(i, r, "access private method"), e);
|
|
6
|
+
var K = (i, r, e) => new Promise((n, l) => {
|
|
7
7
|
var a = (x) => {
|
|
8
8
|
try {
|
|
9
9
|
j(e.next(x));
|
|
10
10
|
} catch (G) {
|
|
11
|
-
|
|
11
|
+
l(G);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, M = (x) => {
|
|
14
14
|
try {
|
|
15
15
|
j(e.throw(x));
|
|
16
16
|
} catch (G) {
|
|
17
|
-
|
|
17
|
+
l(G);
|
|
18
18
|
}
|
|
19
|
-
}, j = (x) => x.done ? n(x.value) : Promise.resolve(x.value).then(a,
|
|
19
|
+
}, j = (x) => x.done ? n(x.value) : Promise.resolve(x.value).then(a, M);
|
|
20
20
|
j((e = e.apply(i, r)).next());
|
|
21
21
|
});
|
|
22
22
|
import { a as O, i as Q } from "../index-euf5anj6.js";
|
|
23
23
|
import { b as R } from "../dom-CVWzyXPH.js";
|
|
24
|
-
import { CSSProperty as
|
|
24
|
+
import { CSSProperty as S } from "../css-property/index.js";
|
|
25
25
|
import { d as V } from "../events-CsVF98U6.js";
|
|
26
26
|
import { s as W } from "../gestures-CcXV6fCp.js";
|
|
27
27
|
import { c as X } from "../math-BOBiC4TN.js";
|
|
28
28
|
import { l as Y } from "../number-CbdpfO3u.js";
|
|
29
|
-
var k, f, p, L,
|
|
29
|
+
var B, k, f, p, L, y, o, h, b, z, T, $, I, q, F;
|
|
30
30
|
class N extends HTMLElement {
|
|
31
31
|
constructor() {
|
|
32
32
|
super(...arguments);
|
|
33
|
-
s(this,
|
|
34
|
-
s(this,
|
|
35
|
-
s(this,
|
|
36
|
-
s(this,
|
|
33
|
+
s(this, b);
|
|
34
|
+
s(this, B, new S(this, "--resize", !0));
|
|
35
|
+
s(this, k, new S(this, "--loop", !0));
|
|
36
|
+
s(this, f, new S(this, "--autoplay", !1));
|
|
37
|
+
s(this, p, new S(this, "--swipe", "x"));
|
|
37
38
|
s(this, L);
|
|
38
|
-
s(this,
|
|
39
|
-
s(this,
|
|
40
|
-
s(this,
|
|
41
|
-
s(this,
|
|
42
|
-
d(this,
|
|
39
|
+
s(this, y, !1);
|
|
40
|
+
s(this, o, []);
|
|
41
|
+
s(this, h, 0);
|
|
42
|
+
s(this, T, (e) => {
|
|
43
|
+
d(this, y, e.isIntersecting), t(this, y) ? m(this, b, z).call(this) : clearInterval(t(this, L));
|
|
43
44
|
});
|
|
44
|
-
s(this,
|
|
45
|
-
clearInterval(t(this, L)), t(this,
|
|
46
|
-
t(this,
|
|
45
|
+
s(this, $, () => {
|
|
46
|
+
clearInterval(t(this, L)), t(this, y) && d(this, L, setInterval(
|
|
47
|
+
t(this, q),
|
|
47
48
|
parseFloat(t(this, f).current || "0") * 1e3
|
|
48
49
|
));
|
|
49
50
|
});
|
|
50
|
-
s(this,
|
|
51
|
-
|
|
51
|
+
s(this, q, () => {
|
|
52
|
+
m(this, b, I).call(this, t(this, h) + 1);
|
|
52
53
|
});
|
|
53
54
|
s(this, F, (e) => {
|
|
54
55
|
if (!t(this, p).current)
|
|
55
56
|
return;
|
|
56
57
|
let n = 0;
|
|
57
58
|
W(
|
|
58
|
-
(
|
|
59
|
-
const a = e.x -
|
|
60
|
-
t(this, p).current === "x" ? Math.abs(a) > Math.abs(
|
|
59
|
+
(l) => {
|
|
60
|
+
const a = e.x - l.x, M = e.y - l.y;
|
|
61
|
+
t(this, p).current === "x" ? Math.abs(a) > Math.abs(M) && Math.abs(a) > 10 && (n = Math.sign(a)) : t(this, p).current === "y" && Math.abs(M) > Math.abs(a) && Math.abs(M) > 10 && (n = Math.sign(M));
|
|
61
62
|
},
|
|
62
63
|
() => {
|
|
63
64
|
n && this.shift(n);
|
|
@@ -66,7 +67,7 @@ class N extends HTMLElement {
|
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
69
|
get counter() {
|
|
69
|
-
return t(this,
|
|
70
|
+
return t(this, h);
|
|
70
71
|
}
|
|
71
72
|
get loop() {
|
|
72
73
|
return t(this, k);
|
|
@@ -78,105 +79,103 @@ class N extends HTMLElement {
|
|
|
78
79
|
return t(this, p);
|
|
79
80
|
}
|
|
80
81
|
get itemElements() {
|
|
81
|
-
return t(this,
|
|
82
|
+
return t(this, o);
|
|
82
83
|
}
|
|
83
84
|
addItem(e) {
|
|
84
|
-
t(this,
|
|
85
|
+
t(this, o).push(e), m(this, b, I).call(this);
|
|
85
86
|
}
|
|
86
87
|
set(e) {
|
|
87
|
-
(!this.handleSet || this.handleSet(e)) && (
|
|
88
|
+
(!this.handleSet || this.handleSet(e)) && (m(this, b, I).call(this, e), m(this, b, z).call(this));
|
|
88
89
|
}
|
|
89
90
|
shift(e) {
|
|
90
|
-
this.set(t(this,
|
|
91
|
+
this.set(t(this, h) + e);
|
|
91
92
|
}
|
|
92
93
|
connectedCallback() {
|
|
93
94
|
var e;
|
|
94
|
-
d(this,
|
|
95
|
+
d(this, o, [
|
|
95
96
|
...this.querySelectorAll(
|
|
96
97
|
`[data-billboard-item${this.id ? `="${this.id}"` : ""}]`
|
|
97
98
|
)
|
|
98
|
-
]), (e = t(this,
|
|
99
|
-
n.current ? (O.subscribe(this, t(this,
|
|
100
|
-
}), t(this, f).observe(), t(this, p).observe(), t(this, k).observe(), this.addEventListener("pointerdown", t(this, F));
|
|
99
|
+
]), (e = t(this, o)[0]) == null || e.classList.add("current"), t(this, f).subscribe((n) => {
|
|
100
|
+
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, I).call(this, 0));
|
|
101
|
+
}), t(this, f).observe(), t(this, p).observe(), t(this, k).observe(), t(this, B).observe(), m(this, b, I).call(this, 0), this.addEventListener("pointerdown", t(this, F));
|
|
101
102
|
}
|
|
102
103
|
disconnectedCallback() {
|
|
103
|
-
t(this, f).unobserve(), t(this, p).unobserve(), t(this, k).unobserve(), O.unsubscribe(t(this,
|
|
104
|
+
t(this, f).unobserve(), t(this, p).unobserve(), t(this, k).unobserve(), t(this, B).unobserve(), O.unsubscribe(t(this, T)), clearInterval(t(this, L));
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
|
-
k = new WeakMap(), f = new WeakMap(), p = new WeakMap(), L = new WeakMap(),
|
|
107
|
-
t(this, f).current !== !1 && t(this,
|
|
108
|
-
},
|
|
109
|
-
|
|
107
|
+
B = new WeakMap(), k = 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() {
|
|
108
|
+
t(this, f).current !== !1 && t(this, $).call(this);
|
|
109
|
+
}, T = new WeakMap(), $ = new WeakMap(), I = function(e = t(this, h)) {
|
|
110
|
+
const n = t(this, h);
|
|
111
|
+
t(this, k).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) => {
|
|
112
|
+
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");
|
|
113
|
+
}), this.classList.toggle("has-length", t(this, o).length > 1), this.classList.toggle("start", t(this, h) === 0), this.classList.toggle(
|
|
110
114
|
"end",
|
|
111
|
-
t(this,
|
|
112
|
-
)
|
|
113
|
-
}, $ = function(e) {
|
|
114
|
-
const n = t(this, l);
|
|
115
|
-
t(this, k).current ? d(this, l, Y(e, t(this, b).length)) : d(this, l, X(e, 0, t(this, b).length - 1)), this.classList.remove("forward", "backward"), t(this, l) - n >= 0 ? this.classList.add("forward") : t(this, l) - n < 0 && this.classList.add("backward"), t(this, b).forEach((h, a) => {
|
|
116
|
-
h.classList.remove("current", "previous", "next"), a === t(this, l) ? h.classList.add("current") : a < t(this, l) ? h.classList.add("previous") : a > t(this, l) && h.classList.add("next");
|
|
117
|
-
}), u(this, o, P).call(this), V(this, "billboardChange", {
|
|
115
|
+
t(this, h) === t(this, o).length - 1
|
|
116
|
+
), this.style.setProperty("--counter", t(this, h).toString()), this.style.setProperty("--sections", t(this, o).length.toString()), t(this, h) !== n && (V(this, "billboardChange", {
|
|
118
117
|
detail: {
|
|
119
|
-
counter: t(this,
|
|
118
|
+
counter: t(this, h)
|
|
120
119
|
}
|
|
121
|
-
}), setTimeout(() => {
|
|
120
|
+
}), t(this, B).current && setTimeout(() => {
|
|
122
121
|
window.dispatchEvent(new Event("resize"));
|
|
123
|
-
}, 0);
|
|
124
|
-
},
|
|
122
|
+
}, 0));
|
|
123
|
+
}, q = new WeakMap(), F = new WeakMap();
|
|
125
124
|
customElements.get("e-billboard") || customElements.define("e-billboard", N);
|
|
126
|
-
var
|
|
125
|
+
var u, A, E, P, H;
|
|
127
126
|
class Z extends HTMLElement {
|
|
128
127
|
constructor() {
|
|
129
128
|
super(...arguments);
|
|
130
|
-
s(this,
|
|
131
|
-
s(this,
|
|
129
|
+
s(this, u, null);
|
|
130
|
+
s(this, A, null);
|
|
132
131
|
s(this, E, []);
|
|
133
|
-
s(this,
|
|
134
|
-
const n = e.currentTarget,
|
|
135
|
-
|
|
132
|
+
s(this, P, (e) => {
|
|
133
|
+
const n = e.currentTarget, l = t(this, E).findIndex((a) => a === n);
|
|
134
|
+
l >= 0 && t(this, u).set(l);
|
|
136
135
|
});
|
|
137
|
-
s(this,
|
|
136
|
+
s(this, H, () => {
|
|
138
137
|
t(this, E).forEach((e, n) => {
|
|
139
|
-
n === t(this,
|
|
138
|
+
n === t(this, u).counter ? e.classList.add("current") : e.classList.remove("current");
|
|
140
139
|
});
|
|
141
140
|
});
|
|
142
141
|
}
|
|
143
142
|
connectedCallback() {
|
|
144
143
|
return K(this, null, function* () {
|
|
145
144
|
var e;
|
|
146
|
-
if (d(this,
|
|
145
|
+
if (d(this, u, R(this, N)), t(this, u) && (yield customElements.whenDefined("e-billboard"), this.isConnected)) {
|
|
147
146
|
this.innerHTML = "";
|
|
148
|
-
const n = t(this,
|
|
149
|
-
d(this,
|
|
150
|
-
for (let
|
|
147
|
+
const n = t(this, u).itemElements.length;
|
|
148
|
+
d(this, A, document.createElement("div"));
|
|
149
|
+
for (let l = 0; l < n; l++) {
|
|
151
150
|
const a = document.createElement("button");
|
|
152
|
-
t(this, E).push(a), t(this,
|
|
151
|
+
t(this, E).push(a), t(this, A).appendChild(a);
|
|
153
152
|
}
|
|
154
|
-
this.appendChild(t(this,
|
|
155
|
-
|
|
156
|
-
}), (e = t(this,
|
|
153
|
+
this.appendChild(t(this, A)), t(this, E).forEach((l) => {
|
|
154
|
+
l.addEventListener("click", t(this, P));
|
|
155
|
+
}), (e = t(this, u)) == null || e.addEventListener(
|
|
157
156
|
"billboardChange",
|
|
158
|
-
t(this,
|
|
159
|
-
), t(this,
|
|
157
|
+
t(this, H)
|
|
158
|
+
), t(this, H).call(this);
|
|
160
159
|
}
|
|
161
160
|
});
|
|
162
161
|
}
|
|
163
162
|
disconnectedCallback() {
|
|
164
163
|
var e;
|
|
165
164
|
t(this, E).forEach((n) => {
|
|
166
|
-
n.removeEventListener("click", t(this,
|
|
167
|
-
}), (e = t(this,
|
|
165
|
+
n.removeEventListener("click", t(this, P));
|
|
166
|
+
}), (e = t(this, u)) == null || e.removeEventListener(
|
|
168
167
|
"billboardChange",
|
|
169
|
-
t(this,
|
|
168
|
+
t(this, H)
|
|
170
169
|
), this.innerHTML = "", d(this, E, []);
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
|
-
|
|
172
|
+
u = new WeakMap(), A = new WeakMap(), E = new WeakMap(), P = new WeakMap(), H = new WeakMap();
|
|
174
173
|
Q && !customElements.get("e-billboard-bullets") && customElements.define("e-billboard-bullets", Z);
|
|
175
174
|
var v, g, C;
|
|
176
175
|
class _ extends HTMLElement {
|
|
177
176
|
constructor() {
|
|
178
177
|
super();
|
|
179
|
-
s(this, v, new
|
|
178
|
+
s(this, v, new S(this, "--index", 0));
|
|
180
179
|
s(this, g, null);
|
|
181
180
|
s(this, C, () => {
|
|
182
181
|
var e;
|
|
@@ -205,13 +204,13 @@ class _ extends HTMLElement {
|
|
|
205
204
|
}
|
|
206
205
|
v = new WeakMap(), g = new WeakMap(), C = new WeakMap();
|
|
207
206
|
Q && !customElements.get("e-billboard-set-button") && customElements.define("e-billboard-set-button", _);
|
|
208
|
-
var w, c,
|
|
207
|
+
var w, c, D;
|
|
209
208
|
class tt extends HTMLElement {
|
|
210
209
|
constructor() {
|
|
211
210
|
super();
|
|
212
|
-
s(this, w, new
|
|
211
|
+
s(this, w, new S(this, "--step", 1));
|
|
213
212
|
s(this, c, null);
|
|
214
|
-
s(this,
|
|
213
|
+
s(this, D, () => {
|
|
215
214
|
t(this, c) && (!t(this, c).loop.current && (t(this, c).counter === 0 && t(this, w).current <= 0 || t(this, c).counter === t(this, c).itemElements.length - 1 && t(this, w).current >= 0) ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"));
|
|
216
215
|
});
|
|
217
216
|
this.addEventListener("click", (e) => {
|
|
@@ -223,19 +222,19 @@ class tt extends HTMLElement {
|
|
|
223
222
|
var e;
|
|
224
223
|
yield customElements.whenDefined("e-billboard"), t(this, w).observe(), this.tabIndex = 0, d(this, c, R(this, N)), (e = t(this, c)) == null || e.addEventListener(
|
|
225
224
|
"billboardChange",
|
|
226
|
-
t(this,
|
|
227
|
-
), t(this,
|
|
225
|
+
t(this, D)
|
|
226
|
+
), t(this, D).call(this);
|
|
228
227
|
});
|
|
229
228
|
}
|
|
230
229
|
disconnectedCallback() {
|
|
231
230
|
var e;
|
|
232
231
|
this.removeAttribute("tabindex"), t(this, w).unobserve(), (e = t(this, c)) == null || e.removeEventListener(
|
|
233
232
|
"billboardChange",
|
|
234
|
-
t(this,
|
|
233
|
+
t(this, D)
|
|
235
234
|
);
|
|
236
235
|
}
|
|
237
236
|
}
|
|
238
|
-
w = new WeakMap(), c = new WeakMap(),
|
|
237
|
+
w = new WeakMap(), c = new WeakMap(), D = new WeakMap();
|
|
239
238
|
Q && !customElements.get("e-billboard-step-button") && customElements.define("e-billboard-step-button", tt);
|
|
240
239
|
export {
|
|
241
240
|
Z as BillboardBulletsElement,
|
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"),y=require("../css-property/index.cjs"),N=require("../index-Cqw2NKev.cjs"),Y=require("../events-KVanG9sR.cjs"),ce=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs"),ie=require("../url-D1CgmwZ_.cjs"),re=require("../window-resizer/index.cjs"),F=require("../device/index.cjs");var u,m,J,K;class le{constructor(){r(this,u,new Map);r(this,m,[]);r(this,J,o=>{var s;const t=[...e(this,m)].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,m)].reverse().find(s=>s.escape.current);console.log(e(this,m)),t&&t.close()}});addEventListener("click",e(this,J)),addEventListener("keydown",e(this,K))}get groups(){return e(this,u)}get stack(){return e(this,m)}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,m).push(t),s.push(t)}remove(o,t){if(n(this,m,e(this,m).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,m=new WeakMap,J=new WeakMap,K=new WeakMap;var f,M,V,C,B,v,w,x,A,g,R,q,L,T,O,a,P,oe,I,$,S,W,G;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,M);r(this,V);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,$);r(this,S);r(this,W);r(this,G);this.urlValue="",n(this,f,!1),n(this,v,new y.CSSProperty(this,"--history",!1)),n(this,w,new y.CSSProperty(this,"--restore",!1)),n(this,x,new y.CSSProperty(this,"--close-rest",!1)),n(this,A,new y.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new y.CSSProperty(this,"--group","")),n(this,R,new y.CSSProperty(this,"--click-outside",!1)),n(this,q,new y.CSSProperty(this,"--escape",!1)),n(this,L,new y.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,$,()=>{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,M)),clearTimeout(e(this,V)),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,M,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),Y.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,V,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,$)),setTimeout(()=>{e(this,w).current?(this.urlValue=ie.parseSearchParameters(location.search)[this.id],e(this,$).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,M)),clearTimeout(e(this,V)),clearTimeout(e(this,C)),clearTimeout(e(this,B)),removeEventListener("popstate",e(this,$)),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,M=new WeakMap,V=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)}},$=new WeakMap,S=new WeakMap,W=new WeakMap,G=new WeakMap,E.stack=new le;let z=E;N.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,d,k,Z,D,U,j,X,_;class ne extends HTMLElement{constructor(){super();r(this,k);r(this,h);r(this,d,new y.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"))});N.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"&&t.currentTarget.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,_).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{b(this,k,_).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,_=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")))};N.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),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"),N=require("../index-Cqw2NKev.cjs"),Y=require("../events-KVanG9sR.cjs"),ce=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs"),ie=require("../url-D1CgmwZ_.cjs"),re=require("../window-resizer/index.cjs"),F=require("../device/index.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,V,C,B,v,w,x,A,g,R,q,L,T,O,a,P,oe,I,$,S,W,G;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,M);r(this,V);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,$);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,$,()=>{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,M)),clearTimeout(e(this,V)),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,M,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),Y.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,V,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,$)),setTimeout(()=>{e(this,w).current?(this.urlValue=ie.parseSearchParameters(location.search)[this.id],e(this,$).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,M)),clearTimeout(e(this,V)),clearTimeout(e(this,C)),clearTimeout(e(this,B)),removeEventListener("popstate",e(this,$)),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,M=new WeakMap,V=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)}},$=new WeakMap,S=new WeakMap,W=new WeakMap,G=new WeakMap,E.stack=new le;let z=E;N.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,d,k,Z,D,U,j,X,_;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"))});N.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"&&t.currentTarget.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,_).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{b(this,k,_).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,_=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")))};N.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 v } from "../css-property/index.js";
|
|
8
8
|
import { i as _ } from "../index-euf5anj6.js";
|
|
9
9
|
import { d as Y } from "../events-CsVF98U6.js";
|
|
10
10
|
import { d as ht } from "../function-C10DGppn.js";
|
|
@@ -12,14 +12,14 @@ import { g as st } from "../style-j2TwriJ_.js";
|
|
|
12
12
|
import { u as nt, p as ct } from "../url-B6BNcw6_.js";
|
|
13
13
|
import { windowResizer as it } from "../window-resizer/index.js";
|
|
14
14
|
import { viewport as j } from "../device/index.js";
|
|
15
|
-
var u,
|
|
15
|
+
var u, b, J, K;
|
|
16
16
|
class lt {
|
|
17
17
|
constructor() {
|
|
18
18
|
r(this, u, /* @__PURE__ */ new Map());
|
|
19
|
-
r(this,
|
|
19
|
+
r(this, b, []);
|
|
20
20
|
r(this, J, (o) => {
|
|
21
21
|
var s;
|
|
22
|
-
const e = [...t(this,
|
|
22
|
+
const e = [...t(this, b)].reverse().find((i) => i.clickOutside.current);
|
|
23
23
|
if (e) {
|
|
24
24
|
const i = o.composedPath();
|
|
25
25
|
if (i.find(
|
|
@@ -32,17 +32,20 @@ class lt {
|
|
|
32
32
|
});
|
|
33
33
|
r(this, K, (o) => {
|
|
34
34
|
if (o.code === "Escape") {
|
|
35
|
-
const e = [...t(this,
|
|
36
|
-
|
|
35
|
+
const e = [...t(this, b)].reverse().find((s) => s.escape.current);
|
|
36
|
+
e && e.close();
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
-
addEventListener(
|
|
39
|
+
document.documentElement.addEventListener(
|
|
40
|
+
"click",
|
|
41
|
+
t(this, J)
|
|
42
|
+
), addEventListener("keydown", t(this, K));
|
|
40
43
|
}
|
|
41
44
|
get groups() {
|
|
42
45
|
return t(this, u);
|
|
43
46
|
}
|
|
44
47
|
get stack() {
|
|
45
|
-
return t(this,
|
|
48
|
+
return t(this, b);
|
|
46
49
|
}
|
|
47
50
|
add(o, e) {
|
|
48
51
|
if (e.closeRest.current)
|
|
@@ -58,10 +61,10 @@ class lt {
|
|
|
58
61
|
});
|
|
59
62
|
}
|
|
60
63
|
let s = t(this, u).get(o);
|
|
61
|
-
s != null && s.length || (s = [], t(this, u).set(o, s)), t(this,
|
|
64
|
+
s != null && s.length || (s = [], t(this, u).set(o, s)), t(this, b).push(e), s.push(e);
|
|
62
65
|
}
|
|
63
66
|
remove(o, e) {
|
|
64
|
-
if (h(this,
|
|
67
|
+
if (h(this, b, t(this, b).filter((s) => s !== e)), e.closeRest.current) {
|
|
65
68
|
let s = [];
|
|
66
69
|
t(this, u).forEach((i) => {
|
|
67
70
|
i.forEach((l) => s.push(l));
|
|
@@ -77,8 +80,8 @@ class lt {
|
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
|
-
u = new WeakMap(),
|
|
81
|
-
var f, M, H, A, W,
|
|
83
|
+
u = new WeakMap(), b = new WeakMap(), J = new WeakMap(), K = new WeakMap();
|
|
84
|
+
var f, M, H, A, W, m, w, S, C, g, R, $, L, T, O, a, P, rt, F, V, k, q, z;
|
|
82
85
|
const E = class E extends HTMLElement {
|
|
83
86
|
constructor() {
|
|
84
87
|
super();
|
|
@@ -88,11 +91,11 @@ const E = class E extends HTMLElement {
|
|
|
88
91
|
r(this, H);
|
|
89
92
|
r(this, A);
|
|
90
93
|
r(this, W);
|
|
91
|
-
r(this,
|
|
94
|
+
r(this, m);
|
|
92
95
|
r(this, w);
|
|
93
96
|
r(this, S);
|
|
94
97
|
r(this, C);
|
|
95
|
-
r(this,
|
|
98
|
+
r(this, g);
|
|
96
99
|
r(this, R);
|
|
97
100
|
r(this, $);
|
|
98
101
|
r(this, L);
|
|
@@ -103,17 +106,17 @@ const E = class E extends HTMLElement {
|
|
|
103
106
|
r(this, k);
|
|
104
107
|
r(this, q);
|
|
105
108
|
r(this, z);
|
|
106
|
-
this.urlValue = "", h(this, f, !1), h(this,
|
|
109
|
+
this.urlValue = "", h(this, f, !1), h(this, m, new v(this, "--history", !1)), h(this, w, new v(this, "--restore", !1)), h(this, S, new v(this, "--close-rest", !1)), h(this, C, new v(
|
|
107
110
|
this,
|
|
108
111
|
"--close-rest-in-group",
|
|
109
112
|
!1
|
|
110
|
-
)), h(this,
|
|
113
|
+
)), h(this, g, new v(this, "--group", "")), h(this, R, new v(this, "--click-outside", !1)), h(this, $, new v(this, "--escape", !1)), h(this, L, new v(this, "--check-viewport-bounds", !1)), h(this, T, !1), h(this, a, new ot(this, {
|
|
111
114
|
opened: !1,
|
|
112
115
|
closing: !1,
|
|
113
116
|
triggered: !1,
|
|
114
117
|
transitionend: !1
|
|
115
118
|
})), h(this, V, () => {
|
|
116
|
-
h(this, T, !1), t(this, f) && t(this,
|
|
119
|
+
h(this, T, !1), t(this, f) && t(this, m).current && !location.search.includes(this.id) ? this.close() : !t(this, f) && t(this, m).current && location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), h(this, T, !0);
|
|
117
120
|
}), h(this, k, () => {
|
|
118
121
|
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"), t(this, q).call(this);
|
|
119
122
|
}), h(this, q, ht(() => {
|
|
@@ -124,7 +127,7 @@ const E = class E extends HTMLElement {
|
|
|
124
127
|
let s = 0, i = 0;
|
|
125
128
|
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");
|
|
126
129
|
}
|
|
127
|
-
}), t(this,
|
|
130
|
+
}), t(this, g).subscribe((e) => {
|
|
128
131
|
e.previous && (E.stack.remove(e.previous, this), e.current || (document.documentElement.classList.remove(
|
|
129
132
|
`${this.group.previous}-closing`
|
|
130
133
|
), document.documentElement.classList.remove(
|
|
@@ -145,7 +148,7 @@ const E = class E extends HTMLElement {
|
|
|
145
148
|
});
|
|
146
149
|
}
|
|
147
150
|
get history() {
|
|
148
|
-
return t(this,
|
|
151
|
+
return t(this, m);
|
|
149
152
|
}
|
|
150
153
|
get restore() {
|
|
151
154
|
return t(this, w);
|
|
@@ -157,7 +160,7 @@ const E = class E extends HTMLElement {
|
|
|
157
160
|
return t(this, C);
|
|
158
161
|
}
|
|
159
162
|
get group() {
|
|
160
|
-
return t(this,
|
|
163
|
+
return t(this, g);
|
|
161
164
|
}
|
|
162
165
|
get clickOutside() {
|
|
163
166
|
return t(this, R);
|
|
@@ -185,9 +188,9 @@ const E = class E extends HTMLElement {
|
|
|
185
188
|
detail: {
|
|
186
189
|
trigger: t(this, O)
|
|
187
190
|
}
|
|
188
|
-
}), t(this,
|
|
191
|
+
}), t(this, m).current && t(this, T) && history.pushState(history.state, "", t(this, P, rt)), h(this, f, !0);
|
|
189
192
|
const s = () => {
|
|
190
|
-
E.stack.add(t(this,
|
|
193
|
+
E.stack.add(t(this, g).current, this), t(this, k).call(this), t(this, a).set("opened", !0), Y(this, "popoverOpened", {
|
|
191
194
|
custom: !0,
|
|
192
195
|
detail: {
|
|
193
196
|
trigger: t(this, O)
|
|
@@ -199,7 +202,7 @@ const E = class E extends HTMLElement {
|
|
|
199
202
|
e != null && e.skipTransition ? s() : h(this, A, setTimeout(s, 10));
|
|
200
203
|
}
|
|
201
204
|
close() {
|
|
202
|
-
t(this, f) && (clearTimeout(t(this, A)), clearTimeout(t(this, W)), E.stack.remove(t(this,
|
|
205
|
+
t(this, f) && (clearTimeout(t(this, A)), clearTimeout(t(this, W)), E.stack.remove(t(this, g).current, this), h(this, f, !1), y(this, P, F).call(this), t(this, a).set("transitionend", !1), h(this, M, setTimeout(() => {
|
|
203
206
|
t(this, a).set("opened", !1), t(this, a).set("closing", !0), Y(this, "popoverClosing", {
|
|
204
207
|
custom: !0
|
|
205
208
|
}), h(this, H, setTimeout(() => {
|
|
@@ -210,20 +213,20 @@ const E = class E extends HTMLElement {
|
|
|
210
213
|
}, 10)));
|
|
211
214
|
}
|
|
212
215
|
connectedCallback() {
|
|
213
|
-
t(this,
|
|
216
|
+
t(this, m).observe(), t(this, w).observe(), t(this, S).observe(), t(this, C).observe(), t(this, g).observe(), t(this, R).observe(), t(this, $).observe(), t(this, L).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", t(this, V)), setTimeout(() => {
|
|
214
217
|
t(this, w).current ? (this.urlValue = ct(location.search)[this.id], t(this, V).call(this)) : (y(this, P, F).call(this), h(this, T, !0));
|
|
215
218
|
}, 0), t(this, L).subscribe(() => {
|
|
216
219
|
t(this, k).call(this);
|
|
217
220
|
}), it.subscribe(t(this, k));
|
|
218
221
|
}
|
|
219
222
|
disconnectedCallback() {
|
|
220
|
-
E.stack.remove(t(this,
|
|
223
|
+
E.stack.remove(t(this, g).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, g).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, A)), 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, P, F).call(this);
|
|
221
224
|
}
|
|
222
225
|
};
|
|
223
|
-
f = new WeakMap(), M = new WeakMap(), H = new WeakMap(), A = new WeakMap(), W = new WeakMap(),
|
|
226
|
+
f = new WeakMap(), M = new WeakMap(), H = new WeakMap(), A = new WeakMap(), W = new WeakMap(), m = new WeakMap(), w = new WeakMap(), S = new WeakMap(), C = new WeakMap(), g = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), L = new WeakMap(), T = new WeakMap(), O = new WeakMap(), a = new WeakMap(), P = new WeakSet(), rt = function() {
|
|
224
227
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
|
|
225
228
|
}, F = function() {
|
|
226
|
-
if (t(this,
|
|
229
|
+
if (t(this, m).current) {
|
|
227
230
|
const e = new URL(location.href);
|
|
228
231
|
e.searchParams.delete(this.id), history.replaceState(history.state, "", e.href);
|
|
229
232
|
}
|
|
@@ -236,7 +239,7 @@ class at extends HTMLElement {
|
|
|
236
239
|
super();
|
|
237
240
|
r(this, x);
|
|
238
241
|
r(this, n);
|
|
239
|
-
r(this, d, new
|
|
242
|
+
r(this, d, new v(this, "--type", "open"));
|
|
240
243
|
r(this, B, () => {
|
|
241
244
|
t(this, d).current !== "close" && this.classList.add("triggered");
|
|
242
245
|
});
|