aptechka 0.62.3 → 0.62.4
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/custom-scrollbar/index.cjs +1 -1
- package/lib/custom-scrollbar/index.js +20 -20
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +15 -15
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +165 -165
- package/package.json +1 -1
package/lib/billboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Q=i=>{throw TypeError(i)};var
|
|
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,h)=>{var a=y=>{try{G(e.next(y))}catch(N){h(N)}},k=y=>{try{G(e.throw(y))}catch(N){h(N)}},G=y=>y.done?n(y.value):Promise.resolve(y.value).then(a,k);G((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,l,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,l,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,l)+1)});s(this,F,e=>{if(!t(this,E).current)return;let n=0;X.setupDrag(h=>{const a=e.x-h.x,k=e.y-h.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,l)}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,l)+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,l=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,l)){const n=t(this,l);t(this,S).current?d(this,l,Z.loopNumber(e,t(this,o).length)):d(this,l,Y.clamp(e,0,t(this,o).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,o).forEach((h,a)=>{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")}),this.classList.toggle("has-length",t(this,o).length>1),this.classList.toggle("start",t(this,l)===0),this.classList.toggle("end",t(this,l)===t(this,o).length-1),this.style.setProperty("--counter",t(this,l).toString()),this.style.setProperty("--sections",t(this,o).length.toString()),t(this,l)!==n&&(W.dispatchEvent(this,"billboardChange",{detail:{counter:t(this,l)}}),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,h=t(this,p).findIndex(a=>a===n);h>=0&&t(this,b).set(h)});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 h=0;h<n;h++){const a=document.createElement("button");a.setAttribute("aria-label",`Go to item ${h+1}`),t(this,p).push(a),t(this,q).appendChild(a)}this.appendChild(t(this,q)),t(this,p).forEach(h=>{h.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)),setTimeout(()=>{t(this,H).call(this)},0)})}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
|
@@ -6,18 +6,18 @@ var t = (i, r, e) => (J(i, r, "read from private field"), e ? e.call(i) : r.get(
|
|
|
6
6
|
var K = (i, r, e) => new Promise((n, l) => {
|
|
7
7
|
var a = (x) => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
10
|
-
} catch (
|
|
11
|
-
l(
|
|
9
|
+
N(e.next(x));
|
|
10
|
+
} catch (j) {
|
|
11
|
+
l(j);
|
|
12
12
|
}
|
|
13
13
|
}, M = (x) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
l(
|
|
15
|
+
N(e.throw(x));
|
|
16
|
+
} catch (j) {
|
|
17
|
+
l(j);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
19
|
+
}, N = (x) => x.done ? n(x.value) : Promise.resolve(x.value).then(a, M);
|
|
20
|
+
N((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";
|
|
@@ -26,8 +26,8 @@ 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 T, k, f, p, L, y, o, h, b, z,
|
|
30
|
-
class
|
|
29
|
+
var T, k, f, p, L, y, o, h, b, z, A, $, I, q, F;
|
|
30
|
+
class G extends HTMLElement {
|
|
31
31
|
constructor() {
|
|
32
32
|
super(...arguments);
|
|
33
33
|
s(this, b);
|
|
@@ -39,7 +39,7 @@ class N extends HTMLElement {
|
|
|
39
39
|
s(this, y, !1);
|
|
40
40
|
s(this, o, []);
|
|
41
41
|
s(this, h, 0);
|
|
42
|
-
s(this,
|
|
42
|
+
s(this, A, (e) => {
|
|
43
43
|
d(this, y, e.isIntersecting), t(this, y) ? m(this, b, z).call(this) : clearInterval(t(this, L));
|
|
44
44
|
});
|
|
45
45
|
s(this, $, () => {
|
|
@@ -97,16 +97,16 @@ class N extends HTMLElement {
|
|
|
97
97
|
`[data-billboard-item${this.id ? `="${this.id}"` : ""}]`
|
|
98
98
|
)
|
|
99
99
|
]), (e = t(this, o)[0]) == null || e.classList.add("current"), t(this, f).subscribe((n) => {
|
|
100
|
-
n.current ? (O.subscribe(this, t(this,
|
|
100
|
+
n.current ? (O.subscribe(this, t(this, A)), m(this, b, z).call(this)) : (d(this, y, !0), O.unsubscribe(t(this, A)), clearInterval(t(this, L)), m(this, b, I).call(this, 0));
|
|
101
101
|
}), t(this, f).observe(), t(this, p).observe(), t(this, k).observe(), t(this, T).observe(), m(this, b, I).call(this, 0), this.addEventListener("pointerdown", t(this, F));
|
|
102
102
|
}
|
|
103
103
|
disconnectedCallback() {
|
|
104
|
-
t(this, f).unobserve(), t(this, p).unobserve(), t(this, k).unobserve(), t(this, T).unobserve(), O.unsubscribe(t(this,
|
|
104
|
+
t(this, f).unobserve(), t(this, p).unobserve(), t(this, k).unobserve(), t(this, T).unobserve(), O.unsubscribe(t(this, A)), clearInterval(t(this, L));
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
T = 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
108
|
t(this, f).current !== !1 && t(this, $).call(this);
|
|
109
|
-
},
|
|
109
|
+
}, A = new WeakMap(), $ = new WeakMap(), I = function(e = t(this, h)) {
|
|
110
110
|
const n = t(this, h);
|
|
111
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
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");
|
|
@@ -121,13 +121,13 @@ T = new WeakMap(), k = new WeakMap(), f = new WeakMap(), p = new WeakMap(), L =
|
|
|
121
121
|
window.dispatchEvent(new Event("resize"));
|
|
122
122
|
}, 0));
|
|
123
123
|
}, q = new WeakMap(), F = new WeakMap();
|
|
124
|
-
customElements.get("e-billboard") || customElements.define("e-billboard",
|
|
125
|
-
var u,
|
|
124
|
+
customElements.get("e-billboard") || customElements.define("e-billboard", G);
|
|
125
|
+
var u, B, E, P, H;
|
|
126
126
|
class Z extends HTMLElement {
|
|
127
127
|
constructor() {
|
|
128
128
|
super(...arguments);
|
|
129
129
|
s(this, u, null);
|
|
130
|
-
s(this,
|
|
130
|
+
s(this, B, null);
|
|
131
131
|
s(this, E, []);
|
|
132
132
|
s(this, P, (e) => {
|
|
133
133
|
const n = e.currentTarget, l = t(this, E).findIndex((a) => a === n);
|
|
@@ -142,15 +142,15 @@ class Z extends HTMLElement {
|
|
|
142
142
|
connectedCallback() {
|
|
143
143
|
return K(this, null, function* () {
|
|
144
144
|
var e;
|
|
145
|
-
if (d(this, u, R(this,
|
|
145
|
+
if (d(this, u, R(this, G)), t(this, u) && (yield customElements.whenDefined("e-billboard"), this.isConnected)) {
|
|
146
146
|
this.innerHTML = "";
|
|
147
147
|
const n = t(this, u).itemElements.length;
|
|
148
|
-
d(this,
|
|
148
|
+
d(this, B, document.createElement("div"));
|
|
149
149
|
for (let l = 0; l < n; l++) {
|
|
150
150
|
const a = document.createElement("button");
|
|
151
|
-
t(this, E).push(a), t(this,
|
|
151
|
+
a.setAttribute("aria-label", `Go to item ${l + 1}`), t(this, E).push(a), t(this, B).appendChild(a);
|
|
152
152
|
}
|
|
153
|
-
this.appendChild(t(this,
|
|
153
|
+
this.appendChild(t(this, B)), t(this, E).forEach((l) => {
|
|
154
154
|
l.addEventListener("click", t(this, P));
|
|
155
155
|
}), (e = t(this, u)) == null || e.addEventListener(
|
|
156
156
|
"billboardChange",
|
|
@@ -169,7 +169,7 @@ class Z extends HTMLElement {
|
|
|
169
169
|
), this.innerHTML = "", d(this, E, []);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
u = new WeakMap(),
|
|
172
|
+
u = new WeakMap(), B = new WeakMap(), E = new WeakMap(), P = new WeakMap(), H = new WeakMap();
|
|
173
173
|
Q && !customElements.get("e-billboard-bullets") && customElements.define("e-billboard-bullets", Z);
|
|
174
174
|
var v, g, C;
|
|
175
175
|
class _ extends HTMLElement {
|
|
@@ -187,7 +187,7 @@ class _ extends HTMLElement {
|
|
|
187
187
|
}
|
|
188
188
|
connectedCallback() {
|
|
189
189
|
var e;
|
|
190
|
-
this.tabIndex = 0, d(this, g, R(this,
|
|
190
|
+
this.tabIndex = 0, d(this, g, R(this, G)), (e = t(this, g)) == null || e.addEventListener(
|
|
191
191
|
"billboardChange",
|
|
192
192
|
t(this, C)
|
|
193
193
|
), customElements.whenDefined("e-billboard").then(() => {
|
|
@@ -220,7 +220,7 @@ class tt extends HTMLElement {
|
|
|
220
220
|
connectedCallback() {
|
|
221
221
|
return K(this, null, function* () {
|
|
222
222
|
var e;
|
|
223
|
-
yield customElements.whenDefined("e-billboard"), t(this, w).observe(), this.tabIndex = 0, d(this, c, R(this,
|
|
223
|
+
yield customElements.whenDefined("e-billboard"), t(this, w).observe(), this.tabIndex = 0, d(this, c, R(this, G)), (e = t(this, c)) == null || e.addEventListener(
|
|
224
224
|
"billboardChange",
|
|
225
225
|
t(this, D)
|
|
226
226
|
), setTimeout(() => {
|
|
@@ -240,7 +240,7 @@ w = new WeakMap(), c = new WeakMap(), D = new WeakMap();
|
|
|
240
240
|
Q && !customElements.get("e-billboard-step-button") && customElements.define("e-billboard-step-button", tt);
|
|
241
241
|
export {
|
|
242
242
|
Z as BillboardBulletsElement,
|
|
243
|
-
|
|
243
|
+
G as BillboardElement,
|
|
244
244
|
_ as BillboardSetButtonElement,
|
|
245
245
|
tt as BillboardStepButtonElement
|
|
246
246
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=l=>{throw TypeError(l)};var k=(l,o,s)=>o.has(l)||v("Cannot "+s);var t=(l,o,s)=>(k(l,o,"read from private field"),s?s.call(l):o.get(l)),h=(l,o,s)=>o.has(l)?v("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(l):o.set(l,s),c=(l,o,s,e)=>(k(l,o,"write to private field"),e?e.call(l,s):o.set(l,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("../index-Cqw2NKev.cjs"),q=require("../dom-JBOkFLTh.cjs"),w=require("../gestures-C7gbKx11.cjs"),E=require("../ticker/index.cjs");var i,n,
|
|
1
|
+
"use strict";var v=l=>{throw TypeError(l)};var k=(l,o,s)=>o.has(l)||v("Cannot "+s);var t=(l,o,s)=>(k(l,o,"read from private field"),s?s.call(l):o.get(l)),h=(l,o,s)=>o.has(l)?v("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(l):o.set(l,s),c=(l,o,s,e)=>(k(l,o,"write to private field"),e?e.call(l,s):o.set(l,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("../index-Cqw2NKev.cjs"),q=require("../dom-JBOkFLTh.cjs"),w=require("../gestures-C7gbKx11.cjs"),E=require("../ticker/index.cjs");var i,n,m,a,r,d,f,y,p,u,g;class T extends HTMLElement{constructor(){super(...arguments);h(this,i,null);h(this,n,null);h(this,m,0);h(this,a,0);h(this,r,!1);h(this,d);h(this,f,()=>{this.classList.add("active"),clearTimeout(t(this,d));const e=(t(this,r)?t(this,i).scrollLeft:t(this,i).scrollTop)/t(this,a)*t(this,m);t(this,r)?t(this,n).style.transform=`translate3d(${e}px, 0px, 0px)`:t(this,n).style.transform=`translate3d(0px, ${e}px, 0px)`,c(this,d,setTimeout(()=>{this.classList.remove("active")},1e3))});h(this,y,()=>{const s=t(this,r)?this.offsetWidth:this.offsetHeight;c(this,a,t(this,r)?t(this,i).scrollWidth-t(this,i).offsetWidth:t(this,i).scrollHeight-t(this,i).offsetHeight);let e=s*s/(t(this,a)+s);e=Math.max(e,30),t(this,r)?(t(this,n).style.width=e+"px",t(this,n).style.height="100%"):(t(this,n).style.width="100%",t(this,n).style.height=e+"px"),c(this,m,s-e),t(this,r)&&!(t(this,i).scrollWidth>t(this,i).offsetWidth)||!t(this,r)&&!(t(this,i).scrollHeight>t(this,i).offsetHeight)?this.style.display="none":this.style.display="block"});h(this,p,s=>{document.documentElement.classList.add("grabbing");const e=t(this,r)?t(this,i).scrollLeft:t(this,i).scrollTop,b=t(this,r)?s.x:s.y;w.setupDrag(x=>{const H=t(this,a)/t(this,m),S=(t(this,r)?x.x-b:x.y-b)*H;t(this,r)?t(this,i).scroll({left:e+S,behavior:"instant"}):t(this,i).scroll({top:e+S,behavior:"instant"})},()=>{document.documentElement.classList.remove("grabbing")})});h(this,u,()=>{t(this,y).call(this)});h(this,g,s=>{s.isIntersecting?(E.ticker.subscribe(t(this,u),{maxFPS:5}),t(this,u).call(this)):E.ticker.unsubscribe(t(this,u))})}connectedCallback(){const s=this.getAttribute("data-scroll");c(this,r,this.hasAttribute("horisontal"));let e=null;s&&(s==="parent"?e=this.parentElement:e=document.querySelector(s)),e||(e=q.findScrollParentElement(this));const b=this.querySelector("[data-thumb]");e&&b&&(c(this,i,e),c(this,n,b),t(this,i).addEventListener("scroll",t(this,f)),t(this,n).addEventListener("pointerdown",t(this,p)),L.intersector.subscribe(this.parentElement,t(this,g)))}disconnectedCallback(){t(this,i).removeEventListener("scroll",t(this,f)),t(this,n).removeEventListener("pointerdown",t(this,p)),clearTimeout(t(this,d)),L.intersector.unsubscribe(t(this,g)),E.ticker.unsubscribe(t(this,u))}}i=new WeakMap,n=new WeakMap,m=new WeakMap,a=new WeakMap,r=new WeakMap,d=new WeakMap,f=new WeakMap,y=new WeakMap,p=new WeakMap,u=new WeakMap,g=new WeakMap;L.isBrowser&&!customElements.get("e-custom-scrollbar")&&customElements.define("e-custom-scrollbar",T);exports.CustomScrollbarElement=T;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
var v = (l) => {
|
|
2
2
|
throw TypeError(l);
|
|
3
3
|
};
|
|
4
|
-
var S = (l,
|
|
5
|
-
var t = (l,
|
|
4
|
+
var S = (l, o, s) => o.has(l) || v("Cannot " + s);
|
|
5
|
+
var t = (l, o, s) => (S(l, o, "read from private field"), s ? s.call(l) : o.get(l)), r = (l, o, s) => o.has(l) ? v("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(l) : o.set(l, s), c = (l, o, s, e) => (S(l, o, "write to private field"), e ? e.call(l, s) : o.set(l, s), s);
|
|
6
6
|
import { i as k, a as H } from "../index-euf5anj6.js";
|
|
7
7
|
import { f as w } from "../dom-CVWzyXPH.js";
|
|
8
8
|
import { s as z } from "../gestures-CcXV6fCp.js";
|
|
9
9
|
import { ticker as E } from "../ticker/index.js";
|
|
10
|
-
var i, n,
|
|
10
|
+
var i, n, u, a, h, d, b, L, p, m, g;
|
|
11
11
|
class W extends HTMLElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
14
|
r(this, i, null);
|
|
15
15
|
r(this, n, null);
|
|
16
|
-
r(this,
|
|
16
|
+
r(this, u, 0);
|
|
17
17
|
r(this, a, 0);
|
|
18
|
-
r(this,
|
|
19
|
-
r(this,
|
|
18
|
+
r(this, h, !1);
|
|
19
|
+
r(this, d);
|
|
20
20
|
r(this, b, () => {
|
|
21
|
-
this.classList.add("active"), clearTimeout(t(this,
|
|
22
|
-
const e = (t(this,
|
|
23
|
-
t(this,
|
|
21
|
+
this.classList.add("active"), clearTimeout(t(this, d));
|
|
22
|
+
const e = (t(this, h) ? t(this, i).scrollLeft : t(this, i).scrollTop) / t(this, a) * t(this, u);
|
|
23
|
+
t(this, h) ? t(this, n).style.transform = `translate3d(${e}px, 0px, 0px)` : t(this, n).style.transform = `translate3d(0px, ${e}px, 0px)`, c(this, d, setTimeout(() => {
|
|
24
24
|
this.classList.remove("active");
|
|
25
25
|
}, 1e3));
|
|
26
26
|
});
|
|
27
27
|
r(this, L, () => {
|
|
28
|
-
const s = t(this,
|
|
29
|
-
c(this, a, t(this,
|
|
28
|
+
const s = t(this, h) ? this.offsetWidth : this.offsetHeight;
|
|
29
|
+
c(this, a, t(this, h) ? t(this, i).scrollWidth - t(this, i).offsetWidth : t(this, i).scrollHeight - t(this, i).offsetHeight);
|
|
30
30
|
let e = s * s / (t(this, a) + s);
|
|
31
|
-
e = Math.max(e, 30), t(this,
|
|
31
|
+
e = Math.max(e, 30), t(this, h) ? (t(this, n).style.width = e + "px", t(this, n).style.height = "100%") : (t(this, n).style.width = "100%", t(this, n).style.height = e + "px"), c(this, u, s - e), t(this, h) && !(t(this, i).scrollWidth > t(this, i).offsetWidth) || !t(this, h) && !(t(this, i).scrollHeight > t(this, i).offsetHeight) ? this.style.display = "none" : this.style.display = "block";
|
|
32
32
|
});
|
|
33
33
|
r(this, p, (s) => {
|
|
34
34
|
document.documentElement.classList.add("grabbing");
|
|
35
|
-
const e = t(this,
|
|
35
|
+
const e = t(this, h) ? t(this, i).scrollLeft : t(this, i).scrollTop, f = t(this, h) ? s.x : s.y;
|
|
36
36
|
z(
|
|
37
37
|
(x) => {
|
|
38
|
-
const T = t(this, a) / t(this,
|
|
39
|
-
t(this,
|
|
38
|
+
const T = t(this, a) / t(this, u), y = (t(this, h) ? x.x - f : x.y - f) * T;
|
|
39
|
+
t(this, h) ? t(this, i).scroll({
|
|
40
40
|
left: e + y,
|
|
41
41
|
behavior: "instant"
|
|
42
42
|
}) : t(this, i).scroll({
|
|
@@ -49,26 +49,26 @@ class W extends HTMLElement {
|
|
|
49
49
|
}
|
|
50
50
|
);
|
|
51
51
|
});
|
|
52
|
-
r(this,
|
|
52
|
+
r(this, m, () => {
|
|
53
53
|
t(this, L).call(this);
|
|
54
54
|
});
|
|
55
55
|
r(this, g, (s) => {
|
|
56
|
-
s.isIntersecting ? E.subscribe(t(this,
|
|
56
|
+
s.isIntersecting ? (E.subscribe(t(this, m), { maxFPS: 5 }), t(this, m).call(this)) : E.unsubscribe(t(this, m));
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
connectedCallback() {
|
|
60
60
|
const s = this.getAttribute("data-scroll");
|
|
61
|
-
c(this,
|
|
61
|
+
c(this, h, this.hasAttribute("horisontal"));
|
|
62
62
|
let e = null;
|
|
63
63
|
s && (s === "parent" ? e = this.parentElement : e = document.querySelector(s)), e || (e = w(this));
|
|
64
64
|
const f = this.querySelector("[data-thumb]");
|
|
65
65
|
e && f && (c(this, i, e), c(this, n, f), t(this, i).addEventListener("scroll", t(this, b)), t(this, n).addEventListener("pointerdown", t(this, p)), H.subscribe(this.parentElement, t(this, g)));
|
|
66
66
|
}
|
|
67
67
|
disconnectedCallback() {
|
|
68
|
-
t(this, i).removeEventListener("scroll", t(this, b)), t(this, n).removeEventListener("pointerdown", t(this, p)), clearTimeout(t(this,
|
|
68
|
+
t(this, i).removeEventListener("scroll", t(this, b)), t(this, n).removeEventListener("pointerdown", t(this, p)), clearTimeout(t(this, d)), H.unsubscribe(t(this, g)), E.unsubscribe(t(this, m));
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
i = new WeakMap(), n = new WeakMap(),
|
|
71
|
+
i = new WeakMap(), n = new WeakMap(), u = new WeakMap(), a = new WeakMap(), h = new WeakMap(), d = new WeakMap(), b = new WeakMap(), L = new WeakMap(), p = new WeakMap(), m = new WeakMap(), g = new WeakMap();
|
|
72
72
|
k && !customElements.get("e-custom-scrollbar") && customElements.define("e-custom-scrollbar", W);
|
|
73
73
|
export {
|
|
74
74
|
W as CustomScrollbarElement
|
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"),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"&&!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,_).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=>{console.log(this.hasAttribute("keydown-disabled")),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,_).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
|
@@ -81,7 +81,7 @@ class lt {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
u = new WeakMap(), b = new WeakMap(), J = new WeakMap(), K = new WeakMap();
|
|
84
|
-
var f, M, H,
|
|
84
|
+
var f, M, H, x, W, m, w, S, C, g, R, $, L, T, O, a, P, rt, F, V, k, q, z;
|
|
85
85
|
const E = class E extends HTMLElement {
|
|
86
86
|
constructor() {
|
|
87
87
|
super();
|
|
@@ -89,7 +89,7 @@ const E = class E extends HTMLElement {
|
|
|
89
89
|
r(this, f);
|
|
90
90
|
r(this, M);
|
|
91
91
|
r(this, H);
|
|
92
|
-
r(this,
|
|
92
|
+
r(this, x);
|
|
93
93
|
r(this, W);
|
|
94
94
|
r(this, m);
|
|
95
95
|
r(this, w);
|
|
@@ -195,14 +195,14 @@ const E = class E extends HTMLElement {
|
|
|
195
195
|
detail: {
|
|
196
196
|
trigger: t(this, O)
|
|
197
197
|
}
|
|
198
|
-
}), h(this,
|
|
198
|
+
}), h(this, x, void 0), h(this, W, setTimeout(() => {
|
|
199
199
|
t(this, a).set("transitionend", !0);
|
|
200
200
|
}, st(this) + 10));
|
|
201
201
|
};
|
|
202
|
-
e != null && e.skipTransition ? s() : h(this,
|
|
202
|
+
e != null && e.skipTransition ? s() : h(this, x, setTimeout(s, 10));
|
|
203
203
|
}
|
|
204
204
|
close() {
|
|
205
|
-
t(this, f) && (clearTimeout(t(this,
|
|
205
|
+
t(this, f) && (clearTimeout(t(this, x)), 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(() => {
|
|
206
206
|
t(this, a).set("opened", !1), t(this, a).set("closing", !0), Y(this, "popoverClosing", {
|
|
207
207
|
custom: !0
|
|
208
208
|
}), h(this, H, setTimeout(() => {
|
|
@@ -220,10 +220,10 @@ const E = class E extends HTMLElement {
|
|
|
220
220
|
}), it.subscribe(t(this, k));
|
|
221
221
|
}
|
|
222
222
|
disconnectedCallback() {
|
|
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,
|
|
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, 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, P, F).call(this);
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
|
-
f = new WeakMap(), M = new WeakMap(), H = new WeakMap(),
|
|
226
|
+
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(), 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() {
|
|
227
227
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
|
|
228
228
|
}, F = function() {
|
|
229
229
|
if (t(this, m).current) {
|
|
@@ -233,11 +233,11 @@ f = new WeakMap(), M = new WeakMap(), H = new WeakMap(), A = new WeakMap(), W =
|
|
|
233
233
|
}, V = new WeakMap(), k = new WeakMap(), q = new WeakMap(), z = new WeakMap(), E.stack = new lt();
|
|
234
234
|
let I = E;
|
|
235
235
|
_ && !customElements.get("e-popover") && customElements.define("e-popover", I);
|
|
236
|
-
var n, d,
|
|
236
|
+
var n, d, A, Z, B, D, U, X, N;
|
|
237
237
|
class at extends HTMLElement {
|
|
238
238
|
constructor() {
|
|
239
239
|
super();
|
|
240
|
-
r(this,
|
|
240
|
+
r(this, A);
|
|
241
241
|
r(this, n);
|
|
242
242
|
r(this, d, new v(this, "--type", "open"));
|
|
243
243
|
r(this, B, () => {
|
|
@@ -258,7 +258,7 @@ class at extends HTMLElement {
|
|
|
258
258
|
e === "open" || e === "toggle" && !t(this, n).opened ? t(this, n).open({ trigger: this }) : (e === "close" || e === "toggle" && t(this, n).opened) && t(this, n).close();
|
|
259
259
|
}
|
|
260
260
|
}), this.addEventListener("keydown", (e) => {
|
|
261
|
-
e.code === "Space" && !this.hasAttribute("keydown-disabled") && (e.preventDefault(), this.click());
|
|
261
|
+
console.log(this.hasAttribute("keydown-disabled")), e.code === "Space" && !this.hasAttribute("keydown-disabled") && (e.preventDefault(), this.click());
|
|
262
262
|
}));
|
|
263
263
|
}
|
|
264
264
|
get type() {
|
|
@@ -269,7 +269,7 @@ class at extends HTMLElement {
|
|
|
269
269
|
}
|
|
270
270
|
changePopover(e) {
|
|
271
271
|
var s;
|
|
272
|
-
if (y(this,
|
|
272
|
+
if (y(this, A, Z).call(this), e) {
|
|
273
273
|
let i = null;
|
|
274
274
|
if (e === "parent") {
|
|
275
275
|
const l = this.closest("[data-popover]");
|
|
@@ -305,20 +305,20 @@ class at extends HTMLElement {
|
|
|
305
305
|
t(this, X)
|
|
306
306
|
)) : console.warn(this, `target ${e} not found`);
|
|
307
307
|
}
|
|
308
|
-
y(this,
|
|
308
|
+
y(this, A, N).call(this, t(this, d).current);
|
|
309
309
|
}
|
|
310
310
|
connectedCallback() {
|
|
311
311
|
t(this, d).subscribe((s) => {
|
|
312
|
-
y(this,
|
|
312
|
+
y(this, A, N).call(this, s.current);
|
|
313
313
|
}), this.hasAttribute("tabindex") || (this.tabIndex = 0);
|
|
314
314
|
const e = this.getAttribute("target");
|
|
315
315
|
e && this.changePopover(e), this.isConnected && t(this, d).observe();
|
|
316
316
|
}
|
|
317
317
|
disconnectedCallback() {
|
|
318
|
-
t(this, d).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), y(this,
|
|
318
|
+
t(this, d).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), y(this, A, Z).call(this);
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
n = new WeakMap(), d = new WeakMap(),
|
|
321
|
+
n = new WeakMap(), d = new WeakMap(), A = new WeakSet(), Z = function() {
|
|
322
322
|
t(this, n) && (t(this, n).removeEventListener(
|
|
323
323
|
"popoverTriggered",
|
|
324
324
|
t(this, B)
|