aptechka 0.63.2 → 0.64.0
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/{Tweened-C4xgzPkR.js → Tweened-DzZwfKNm.js} +1 -1
- package/lib/animation/index.js +1 -1
- package/lib/billboard/index.cjs +1 -1
- package/lib/billboard/index.js +56 -52
- package/lib/controls/index.js +20 -20
- package/lib/{easings-Bni3YAAW.js → easings-BEmRlrDd.js} +15 -15
- package/lib/element-CGVl1jA-.js +7 -0
- package/lib/element-yhcBhsho.cjs +1 -0
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +15 -15
- package/lib/scroll/ScrollElement.d.ts +1 -0
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +450 -440
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +123 -126
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ var c = (a, r, e) => r in a ? O(a, r, { enumerable: !0, configurable: !0, writab
|
|
|
15
15
|
}, g = (a, r) => b(a, x(r));
|
|
16
16
|
var A = (a, r, e) => r.has(a) || f("Cannot " + e);
|
|
17
17
|
var m = (a, r, e) => (A(a, r, "read from private field"), e ? e.call(a) : r.get(a)), n = (a, r, e) => r.has(a) ? f("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(a) : r.set(a, e), u = (a, r, e, i) => (A(a, r, "write to private field"), i ? i.call(a, e) : r.set(a, e), e);
|
|
18
|
-
import { l as h, e as T } from "./easings-
|
|
18
|
+
import { l as h, e as T } from "./easings-BEmRlrDd.js";
|
|
19
19
|
import { c as q } from "./math-BOBiC4TN.js";
|
|
20
20
|
import { p as w } from "./number-CbdpfO3u.js";
|
|
21
21
|
import { n as z } from "./polyfills-DJrTJQky.js";
|
package/lib/animation/index.js
CHANGED
package/lib/billboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Q=i=>{throw TypeError(i)};var O=(i,r,e)=>r.has(i)||Q("Cannot "+e);var t=(i,r,e)=>(O(i,r,"read from private field"),e?e.call(i):r.get(i)),s=(i,r,e)=>r.has(i)?Q("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,e),d=(i,r,e,n)=>(O(i,r,"write to private field"),n?n.call(i,e):r.set(i,e),e),m=(i,r,e)=>(O(i,r,"access private method"),e);var J=(i,r,e)=>new Promise((n,
|
|
1
|
+
"use strict";var Q=i=>{throw TypeError(i)};var O=(i,r,e)=>r.has(i)||Q("Cannot "+e);var t=(i,r,e)=>(O(i,r,"read from private field"),e?e.call(i):r.get(i)),s=(i,r,e)=>r.has(i)?Q("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,e),d=(i,r,e,n)=>(O(i,r,"write to private field"),n?n.call(i,e):r.set(i,e),e),m=(i,r,e)=>(O(i,r,"access private method"),e);var J=(i,r,e)=>new Promise((n,l)=>{var a=y=>{try{G(e.next(y))}catch(N){l(N)}},x=y=>{try{G(e.throw(y))}catch(N){l(N)}},G=y=>y.done?n(y.value):Promise.resolve(y.value).then(a,x);G((e=e.apply(i,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const 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,k,f,E,L,S,o,h,u,$,A,_,B,j,F;class z extends HTMLElement{constructor(){super(...arguments);s(this,u);s(this,P,new M.CSSProperty(this,"--resize",!0));s(this,k,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,S,!1);s(this,o,[]);s(this,h,0);s(this,A,e=>{d(this,S,e.isIntersecting),t(this,S)?m(this,u,$).call(this):clearInterval(t(this,L))});s(this,_,()=>{clearInterval(t(this,L)),t(this,S)&&d(this,L,setInterval(t(this,j),parseFloat(t(this,f).current||"0")*1e3))});s(this,j,()=>{m(this,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,x=e.y-l.y;t(this,E).current==="x"?Math.abs(a)>Math.abs(x)&&Math.abs(a)>10&&(n=Math.sign(a)):t(this,E).current==="y"&&Math.abs(x)>Math.abs(a)&&Math.abs(x)>10&&(n=Math.sign(x))},()=>{n&&this.shift(n)})})}get counter(){return t(this,h)}get loop(){return t(this,k)}get autoplay(){return t(this,f)}get swipe(){return t(this,E)}get itemElements(){return t(this,o)}addItem(e){t(this,o).push(e),m(this,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,A)),m(this,u,$).call(this)):(d(this,S,!0),I.intersector.unsubscribe(t(this,A)),clearInterval(t(this,L)),m(this,u,B).call(this,0))}),t(this,f).observe(),t(this,E).observe(),t(this,k).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,k).unobserve(),t(this,P).unobserve(),I.intersector.unsubscribe(t(this,A)),clearInterval(t(this,L))}}P=new WeakMap,k=new WeakMap,f=new WeakMap,E=new WeakMap,L=new WeakMap,S=new WeakMap,o=new WeakMap,h=new WeakMap,u=new WeakSet,$=function(){t(this,f).current!==!1&&t(this,_).call(this)},A=new WeakMap,_=new WeakMap,B=function(e=t(this,h)){const n=t(this,h);t(this,k).current?d(this,h,Z.loopNumber(e,t(this,o).length)):d(this,h,Y.clamp(e,0,t(this,o).length-1)),this.classList.remove("forward","backward"),t(this,h)-n>=0?this.classList.add("forward"):t(this,h)-n<0&&this.classList.add("backward"),t(this,o).forEach((l,a)=>{l.classList.remove("current","previous","next"),a===t(this,h)?l.classList.add("current"):a<t(this,h)?l.classList.add("previous"):a>t(this,h)&&l.classList.add("next")}),this.classList.toggle("has-length",t(this,o).length>1),this.classList.toggle("start",t(this,h)===0),this.classList.toggle("end",t(this,h)===t(this,o).length-1),this.style.setProperty("--counter",t(this,h).toString()),this.style.setProperty("--sections",t(this,o).length.toString()),t(this,h)!==n&&(W.dispatchEvent(this,"billboardChange",{detail:{counter:t(this,h)}}),t(this,P).current&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},0))},j=new WeakMap,F=new WeakMap;customElements.get("e-billboard")||customElements.define("e-billboard",z);var b,T,p,H,q;class R extends HTMLElement{constructor(){super(...arguments);s(this,b,null);s(this,T,null);s(this,p,[]);s(this,H,e=>{const n=e.currentTarget,l=t(this,p).findIndex(a=>a===n);l>=0&&t(this,b).set(l)});s(this,q,()=>{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,T,document.createElement("div"));for(let l=0;l<n;l++){const a=document.createElement("button");a.setAttribute("aria-label",`Go to item ${l+1}`),t(this,p).push(a),t(this,T).appendChild(a)}this.appendChild(t(this,T)),t(this,p).forEach(l=>{l.addEventListener("click",t(this,H))}),(e=t(this,b))==null||e.addEventListener("billboardChange",t(this,q)),t(this,q).call(this)}})}disconnectedCallback(){var e;t(this,p).forEach(n=>{n.removeEventListener("click",t(this,H))}),(e=t(this,b))==null||e.removeEventListener("billboardChange",t(this,q)),this.innerHTML="",d(this,p,[])}}b=new WeakMap,T=new WeakMap,p=new WeakMap,H=new WeakMap,q=new WeakMap;I.isBrowser&&!customElements.get("e-billboard-bullets")&&customElements.define("e-billboard-bullets",R);var v,g,w;class U extends HTMLElement{constructor(){super();s(this,v,new M.CSSProperty(this,"--index",0));s(this,g,null);s(this,w,()=>{var e;t(this,v).current===((e=t(this,g))==null?void 0:e.counter)?this.classList.add("current"):this.classList.remove("current")});this.addEventListener("click",e=>{t(this,g)&&(!this.handleClick||this.handleClick(e))&&t(this,g).set(t(this,v).current)}),this.addEventListener("keydown",e=>{e.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(e.preventDefault(),this.click())})}connectedCallback(){var e;this.tabIndex=0,d(this,g,K.findParentElement(this,z)),(e=t(this,g))==null||e.addEventListener("billboardChange",t(this,w)),customElements.whenDefined("e-billboard").then(()=>{this.isConnected&&t(this,w).call(this)}),t(this,v).subscribe(t(this,w)),t(this,v).observe()}disconnectedCallback(){var e;this.removeAttribute("tabindex"),t(this,v).unsubscribe(t(this,w)),t(this,v).unobserve(),(e=t(this,g))==null||e.removeEventListener("billboardChange",t(this,w))}}v=new WeakMap,g=new WeakMap,w=new WeakMap;I.isBrowser&&!customElements.get("e-billboard-set-button")&&customElements.define("e-billboard-set-button",U);var C,c,D;class V extends HTMLElement{constructor(){super();s(this,C,new M.CSSProperty(this,"--step",1));s(this,c,null);s(this,D,()=>{t(this,c)&&(!t(this,c).loop.current&&(t(this,c).counter===0&&t(this,C).current<=0||t(this,c).counter===t(this,c).itemElements.length-1&&t(this,C).current>=0)?this.setAttribute("disabled",""):this.removeAttribute("disabled"))});this.addEventListener("click",e=>{t(this,c)&&(!this.handleClick||this.handleClick(e))&&t(this,c).shift(t(this,C).current)}),this.addEventListener("keydown",e=>{e.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(e.preventDefault(),this.click())})}connectedCallback(){return J(this,null,function*(){var e;yield customElements.whenDefined("e-billboard"),t(this,C).observe(),this.tabIndex=0,d(this,c,K.findParentElement(this,z)),(e=t(this,c))==null||e.addEventListener("billboardChange",t(this,D)),setTimeout(()=>{t(this,D).call(this)},0)})}disconnectedCallback(){var e;this.removeAttribute("tabindex"),t(this,C).unobserve(),(e=t(this,c))==null||e.removeEventListener("billboardChange",t(this,D))}}C=new WeakMap,c=new WeakMap,D=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
|
@@ -4,19 +4,19 @@ var U = (i) => {
|
|
|
4
4
|
var J = (i, r, e) => r.has(i) || U("Cannot " + e);
|
|
5
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
6
|
var K = (i, r, e) => new Promise((n, l) => {
|
|
7
|
-
var a = (
|
|
7
|
+
var a = (C) => {
|
|
8
8
|
try {
|
|
9
|
-
N(e.next(
|
|
9
|
+
N(e.next(C));
|
|
10
10
|
} catch (j) {
|
|
11
11
|
l(j);
|
|
12
12
|
}
|
|
13
|
-
}, M = (
|
|
13
|
+
}, M = (C) => {
|
|
14
14
|
try {
|
|
15
|
-
N(e.throw(
|
|
15
|
+
N(e.throw(C));
|
|
16
16
|
} catch (j) {
|
|
17
17
|
l(j);
|
|
18
18
|
}
|
|
19
|
-
}, N = (
|
|
19
|
+
}, N = (C) => C.done ? n(C.value) : Promise.resolve(C.value).then(a, M);
|
|
20
20
|
N((e = e.apply(i, r)).next());
|
|
21
21
|
});
|
|
22
22
|
import { a as O, i as Q } from "../index-euf5anj6.js";
|
|
@@ -26,20 +26,20 @@ 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
|
|
29
|
+
var A, x, f, p, L, y, o, h, b, z, T, $, I, q, F;
|
|
30
30
|
class G extends HTMLElement {
|
|
31
31
|
constructor() {
|
|
32
32
|
super(...arguments);
|
|
33
33
|
s(this, b);
|
|
34
|
-
s(this,
|
|
35
|
-
s(this,
|
|
34
|
+
s(this, A, new S(this, "--resize", !0));
|
|
35
|
+
s(this, x, new S(this, "--loop", !0));
|
|
36
36
|
s(this, f, new S(this, "--autoplay", !1));
|
|
37
37
|
s(this, p, new S(this, "--swipe", "x"));
|
|
38
38
|
s(this, L);
|
|
39
39
|
s(this, y, !1);
|
|
40
40
|
s(this, o, []);
|
|
41
41
|
s(this, h, 0);
|
|
42
|
-
s(this,
|
|
42
|
+
s(this, T, (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, $, () => {
|
|
@@ -70,7 +70,7 @@ class G extends HTMLElement {
|
|
|
70
70
|
return t(this, h);
|
|
71
71
|
}
|
|
72
72
|
get loop() {
|
|
73
|
-
return t(this,
|
|
73
|
+
return t(this, x);
|
|
74
74
|
}
|
|
75
75
|
get autoplay() {
|
|
76
76
|
return t(this, f);
|
|
@@ -97,18 +97,18 @@ class G 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,
|
|
101
|
-
}), t(this, f).observe(), t(this, p).observe(), t(this,
|
|
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, x).observe(), t(this, A).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,
|
|
104
|
+
t(this, f).unobserve(), t(this, p).unobserve(), t(this, x).unobserve(), t(this, A).unobserve(), O.unsubscribe(t(this, T)), clearInterval(t(this, L));
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
A = new WeakMap(), x = new WeakMap(), f = new WeakMap(), p = new WeakMap(), L = new WeakMap(), y = new WeakMap(), o = new WeakMap(), h = new WeakMap(), b = new WeakSet(), z = function() {
|
|
108
108
|
t(this, f).current !== !1 && t(this, $).call(this);
|
|
109
|
-
},
|
|
109
|
+
}, T = new WeakMap(), $ = new WeakMap(), I = function(e = t(this, h)) {
|
|
110
110
|
const n = t(this, h);
|
|
111
|
-
t(this,
|
|
111
|
+
t(this, x).current ? d(this, h, Y(e, t(this, o).length)) : d(this, h, X(e, 0, t(this, o).length - 1)), this.classList.remove("forward", "backward"), t(this, h) - n >= 0 ? this.classList.add("forward") : t(this, h) - n < 0 && this.classList.add("backward"), t(this, o).forEach((l, a) => {
|
|
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");
|
|
113
113
|
}), this.classList.toggle("has-length", t(this, o).length > 1), this.classList.toggle("start", t(this, h) === 0), this.classList.toggle(
|
|
114
114
|
"end",
|
|
@@ -117,24 +117,24 @@ T = new WeakMap(), k = new WeakMap(), f = new WeakMap(), p = new WeakMap(), L =
|
|
|
117
117
|
detail: {
|
|
118
118
|
counter: t(this, h)
|
|
119
119
|
}
|
|
120
|
-
}), t(this,
|
|
120
|
+
}), t(this, A).current && setTimeout(() => {
|
|
121
121
|
window.dispatchEvent(new Event("resize"));
|
|
122
122
|
}, 0));
|
|
123
123
|
}, q = new WeakMap(), F = new WeakMap();
|
|
124
124
|
customElements.get("e-billboard") || customElements.define("e-billboard", G);
|
|
125
|
-
var u, B,
|
|
125
|
+
var u, B, v, P, D;
|
|
126
126
|
class Z extends HTMLElement {
|
|
127
127
|
constructor() {
|
|
128
128
|
super(...arguments);
|
|
129
129
|
s(this, u, null);
|
|
130
130
|
s(this, B, null);
|
|
131
|
-
s(this,
|
|
131
|
+
s(this, v, []);
|
|
132
132
|
s(this, P, (e) => {
|
|
133
|
-
const n = e.currentTarget, l = t(this,
|
|
133
|
+
const n = e.currentTarget, l = t(this, v).findIndex((a) => a === n);
|
|
134
134
|
l >= 0 && t(this, u).set(l);
|
|
135
135
|
});
|
|
136
|
-
s(this,
|
|
137
|
-
t(this,
|
|
136
|
+
s(this, D, () => {
|
|
137
|
+
t(this, v).forEach((e, n) => {
|
|
138
138
|
n === t(this, u).counter ? e.classList.add("current") : e.classList.remove("current");
|
|
139
139
|
});
|
|
140
140
|
});
|
|
@@ -148,95 +148,99 @@ class Z extends HTMLElement {
|
|
|
148
148
|
d(this, B, document.createElement("div"));
|
|
149
149
|
for (let l = 0; l < n; l++) {
|
|
150
150
|
const a = document.createElement("button");
|
|
151
|
-
a.setAttribute("aria-label", `Go to item ${l + 1}`), t(this,
|
|
151
|
+
a.setAttribute("aria-label", `Go to item ${l + 1}`), t(this, v).push(a), t(this, B).appendChild(a);
|
|
152
152
|
}
|
|
153
|
-
this.appendChild(t(this, B)), t(this,
|
|
153
|
+
this.appendChild(t(this, B)), t(this, v).forEach((l) => {
|
|
154
154
|
l.addEventListener("click", t(this, P));
|
|
155
155
|
}), (e = t(this, u)) == null || e.addEventListener(
|
|
156
156
|
"billboardChange",
|
|
157
|
-
t(this,
|
|
158
|
-
), t(this,
|
|
157
|
+
t(this, D)
|
|
158
|
+
), t(this, D).call(this);
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
disconnectedCallback() {
|
|
163
163
|
var e;
|
|
164
|
-
t(this,
|
|
164
|
+
t(this, v).forEach((n) => {
|
|
165
165
|
n.removeEventListener("click", t(this, P));
|
|
166
166
|
}), (e = t(this, u)) == null || e.removeEventListener(
|
|
167
167
|
"billboardChange",
|
|
168
|
-
t(this,
|
|
169
|
-
), this.innerHTML = "", d(this,
|
|
168
|
+
t(this, D)
|
|
169
|
+
), this.innerHTML = "", d(this, v, []);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
u = new WeakMap(), B = new WeakMap(),
|
|
172
|
+
u = new WeakMap(), B = new WeakMap(), v = new WeakMap(), P = new WeakMap(), D = new WeakMap();
|
|
173
173
|
Q && !customElements.get("e-billboard-bullets") && customElements.define("e-billboard-bullets", Z);
|
|
174
|
-
var
|
|
174
|
+
var E, g, w;
|
|
175
175
|
class _ extends HTMLElement {
|
|
176
176
|
constructor() {
|
|
177
177
|
super();
|
|
178
|
-
s(this,
|
|
178
|
+
s(this, E, new S(this, "--index", 0));
|
|
179
179
|
s(this, g, null);
|
|
180
|
-
s(this,
|
|
180
|
+
s(this, w, () => {
|
|
181
181
|
var e;
|
|
182
|
-
t(this,
|
|
182
|
+
t(this, E).current === ((e = t(this, g)) == null ? void 0 : e.counter) ? this.classList.add("current") : this.classList.remove("current");
|
|
183
183
|
});
|
|
184
184
|
this.addEventListener("click", (e) => {
|
|
185
|
-
t(this, g) && (!this.handleClick || this.handleClick(e)) && t(this, g).set(t(this,
|
|
185
|
+
t(this, g) && (!this.handleClick || this.handleClick(e)) && t(this, g).set(t(this, E).current);
|
|
186
|
+
}), this.addEventListener("keydown", (e) => {
|
|
187
|
+
e.code === "Space" && !this.hasAttribute("keydown-disabled") && (e.preventDefault(), this.click());
|
|
186
188
|
});
|
|
187
189
|
}
|
|
188
190
|
connectedCallback() {
|
|
189
191
|
var e;
|
|
190
192
|
this.tabIndex = 0, d(this, g, R(this, G)), (e = t(this, g)) == null || e.addEventListener(
|
|
191
193
|
"billboardChange",
|
|
192
|
-
t(this,
|
|
194
|
+
t(this, w)
|
|
193
195
|
), customElements.whenDefined("e-billboard").then(() => {
|
|
194
|
-
this.isConnected && t(this,
|
|
195
|
-
}), t(this,
|
|
196
|
+
this.isConnected && t(this, w).call(this);
|
|
197
|
+
}), t(this, E).subscribe(t(this, w)), t(this, E).observe();
|
|
196
198
|
}
|
|
197
199
|
disconnectedCallback() {
|
|
198
200
|
var e;
|
|
199
|
-
this.removeAttribute("tabindex"), t(this,
|
|
201
|
+
this.removeAttribute("tabindex"), t(this, E).unsubscribe(t(this, w)), t(this, E).unobserve(), (e = t(this, g)) == null || e.removeEventListener(
|
|
200
202
|
"billboardChange",
|
|
201
|
-
t(this,
|
|
203
|
+
t(this, w)
|
|
202
204
|
);
|
|
203
205
|
}
|
|
204
206
|
}
|
|
205
|
-
|
|
207
|
+
E = new WeakMap(), g = new WeakMap(), w = new WeakMap();
|
|
206
208
|
Q && !customElements.get("e-billboard-set-button") && customElements.define("e-billboard-set-button", _);
|
|
207
|
-
var
|
|
209
|
+
var k, c, H;
|
|
208
210
|
class tt extends HTMLElement {
|
|
209
211
|
constructor() {
|
|
210
212
|
super();
|
|
211
|
-
s(this,
|
|
213
|
+
s(this, k, new S(this, "--step", 1));
|
|
212
214
|
s(this, c, null);
|
|
213
|
-
s(this,
|
|
214
|
-
t(this, c) && (!t(this, c).loop.current && (t(this, c).counter === 0 && t(this,
|
|
215
|
+
s(this, H, () => {
|
|
216
|
+
t(this, c) && (!t(this, c).loop.current && (t(this, c).counter === 0 && t(this, k).current <= 0 || t(this, c).counter === t(this, c).itemElements.length - 1 && t(this, k).current >= 0) ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"));
|
|
215
217
|
});
|
|
216
218
|
this.addEventListener("click", (e) => {
|
|
217
|
-
t(this, c) && (!this.handleClick || this.handleClick(e)) && t(this, c).shift(t(this,
|
|
219
|
+
t(this, c) && (!this.handleClick || this.handleClick(e)) && t(this, c).shift(t(this, k).current);
|
|
220
|
+
}), this.addEventListener("keydown", (e) => {
|
|
221
|
+
e.code === "Space" && !this.hasAttribute("keydown-disabled") && (e.preventDefault(), this.click());
|
|
218
222
|
});
|
|
219
223
|
}
|
|
220
224
|
connectedCallback() {
|
|
221
225
|
return K(this, null, function* () {
|
|
222
226
|
var e;
|
|
223
|
-
yield customElements.whenDefined("e-billboard"), t(this,
|
|
227
|
+
yield customElements.whenDefined("e-billboard"), t(this, k).observe(), this.tabIndex = 0, d(this, c, R(this, G)), (e = t(this, c)) == null || e.addEventListener(
|
|
224
228
|
"billboardChange",
|
|
225
|
-
t(this,
|
|
229
|
+
t(this, H)
|
|
226
230
|
), setTimeout(() => {
|
|
227
|
-
t(this,
|
|
231
|
+
t(this, H).call(this);
|
|
228
232
|
}, 0);
|
|
229
233
|
});
|
|
230
234
|
}
|
|
231
235
|
disconnectedCallback() {
|
|
232
236
|
var e;
|
|
233
|
-
this.removeAttribute("tabindex"), t(this,
|
|
237
|
+
this.removeAttribute("tabindex"), t(this, k).unobserve(), (e = t(this, c)) == null || e.removeEventListener(
|
|
234
238
|
"billboardChange",
|
|
235
|
-
t(this,
|
|
239
|
+
t(this, H)
|
|
236
240
|
);
|
|
237
241
|
}
|
|
238
242
|
}
|
|
239
|
-
|
|
243
|
+
k = new WeakMap(), c = new WeakMap(), H = new WeakMap();
|
|
240
244
|
Q && !customElements.get("e-billboard-step-button") && customElements.define("e-billboard-step-button", tt);
|
|
241
245
|
export {
|
|
242
246
|
Z as BillboardBulletsElement,
|
package/lib/controls/index.js
CHANGED
|
@@ -4,12 +4,12 @@ var _ = (n) => {
|
|
|
4
4
|
var G = (n, r, e) => r.has(n) || _("Cannot " + e);
|
|
5
5
|
var t = (n, r, e) => (G(n, r, "read from private field"), e ? e.call(n) : r.get(n)), s = (n, r, e) => r.has(n) ? _("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(n) : r.set(n, e), i = (n, r, e, h) => (G(n, r, "write to private field"), h ? h.call(n, e) : r.set(n, e), e), A = (n, r, e) => (G(n, r, "access private method"), e);
|
|
6
6
|
import { Notifier as ee } from "../notifier/index.js";
|
|
7
|
-
import { i as
|
|
7
|
+
import { i as w } from "../index-euf5anj6.js";
|
|
8
8
|
import { g as Z } from "../dom-CVWzyXPH.js";
|
|
9
9
|
import { ticker as D } from "../ticker/index.js";
|
|
10
10
|
import "../Store-swP_0ymB.js";
|
|
11
|
-
import {
|
|
12
|
-
import { T as ie } from "../Tweened-
|
|
11
|
+
import { a as te } from "../easings-BEmRlrDd.js";
|
|
12
|
+
import { T as ie } from "../Tweened-DzZwfKNm.js";
|
|
13
13
|
import { s as se } from "../gestures-CcXV6fCp.js";
|
|
14
14
|
import { p as he } from "../number-CbdpfO3u.js";
|
|
15
15
|
import { TICK_ORDER as ne } from "../order/index.js";
|
|
@@ -35,30 +35,30 @@ class ge extends j {
|
|
|
35
35
|
let a;
|
|
36
36
|
e.code === "Space" ? a = h * t(this, c)[t(this, u)] * 0.4 : e.code === "ArrowLeft" ? a = -1 * t(this, c)[t(this, u)] * 0.2 : e.code === "ArrowRight" ? a = 1 * t(this, c)[t(this, u)] * 0.2 : e.code === "ArrowUp" ? a = -1 * t(this, c)[t(this, u)] * 0.2 : e.code === "ArrowDown" ? a = 1 * t(this, c)[t(this, u)] * 0.2 : e.code === "PageUp" ? a = -1 * t(this, c)[t(this, u)] : e.code === "PageDown" ? a = 1 * t(this, c)[t(this, u)] : e.code === "Home" ? a = 0 : e.code === "End" && (a = t(this, u) === "offsetWidth" ? t(this, c).scrollWidth : t(this, c).scrollHeight), a && (e.stopPropagation(), this.changeEvent.notify("keyboard", a, e));
|
|
37
37
|
});
|
|
38
|
-
|
|
38
|
+
w && (i(this, y, e != null && e.element && Z(e.element) || window), i(this, c, t(this, y) instanceof HTMLElement ? t(this, y) : document.documentElement), this.dimension = e == null ? void 0 : e.dimension);
|
|
39
39
|
}
|
|
40
40
|
set dimension(e) {
|
|
41
41
|
i(this, u, e === "width" ? "offsetWidth" : "offsetHeight");
|
|
42
42
|
}
|
|
43
43
|
connect() {
|
|
44
|
-
|
|
44
|
+
w && t(this, y).addEventListener(
|
|
45
45
|
"keydown",
|
|
46
46
|
t(this, Y)
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
disconnect() {
|
|
50
|
-
|
|
50
|
+
w && t(this, y).removeEventListener(
|
|
51
51
|
"keydown",
|
|
52
52
|
t(this, Y)
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
y = new WeakMap(), c = new WeakMap(), u = new WeakMap(), Y = new WeakMap();
|
|
57
|
-
var E, M, K, O, d, I, m,
|
|
57
|
+
var E, M, K, O, d, I, m, b, Q, J, H, S, q;
|
|
58
58
|
class ye extends j {
|
|
59
59
|
constructor(e) {
|
|
60
60
|
super();
|
|
61
|
-
s(this,
|
|
61
|
+
s(this, b);
|
|
62
62
|
s(this, E);
|
|
63
63
|
s(this, M);
|
|
64
64
|
s(this, K);
|
|
@@ -86,16 +86,16 @@ class ye extends j {
|
|
|
86
86
|
}), i(this, E, (e == null ? void 0 : e.speed) || 1), i(this, M, (e == null ? void 0 : e.interval) || !1), i(this, K, e);
|
|
87
87
|
}
|
|
88
88
|
set interval(e) {
|
|
89
|
-
i(this, M, e), t(this, m) && A(this,
|
|
89
|
+
i(this, M, e), t(this, m) && A(this, b, Q).call(this);
|
|
90
90
|
}
|
|
91
91
|
set speed(e) {
|
|
92
|
-
i(this, E, e), t(this, m) && A(this,
|
|
92
|
+
i(this, E, e), t(this, m) && A(this, b, Q).call(this);
|
|
93
93
|
}
|
|
94
94
|
connect() {
|
|
95
|
-
t(this, m) || (i(this, m, !0), A(this,
|
|
95
|
+
t(this, m) || (i(this, m, !0), A(this, b, Q).call(this));
|
|
96
96
|
}
|
|
97
97
|
disconnect() {
|
|
98
|
-
t(this, m) && (i(this, m, !1), A(this,
|
|
98
|
+
t(this, m) && (i(this, m, !1), A(this, b, J).call(this));
|
|
99
99
|
}
|
|
100
100
|
pauseAndContinue(e, h) {
|
|
101
101
|
t(this, m) && e && (clearTimeout(t(this, I)), t(this, d).set(1, {
|
|
@@ -109,8 +109,8 @@ class ye extends j {
|
|
|
109
109
|
}, e)));
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
E = new WeakMap(), M = new WeakMap(), K = new WeakMap(), O = new WeakMap(), d = new WeakMap(), I = new WeakMap(), m = new WeakMap(),
|
|
113
|
-
A(this,
|
|
112
|
+
E = new WeakMap(), M = new WeakMap(), K = new WeakMap(), O = new WeakMap(), d = new WeakMap(), I = new WeakMap(), m = new WeakMap(), b = new WeakSet(), Q = function() {
|
|
113
|
+
A(this, b, J).call(this), t(this, M) ? i(this, O, setInterval(
|
|
114
114
|
t(this, S),
|
|
115
115
|
Math.abs(t(this, E))
|
|
116
116
|
)) : D.subscribe(t(this, H), t(this, K)), document.addEventListener(
|
|
@@ -144,10 +144,10 @@ class Ee extends j {
|
|
|
144
144
|
} else
|
|
145
145
|
this.changeEvent.notify("wheel", h, e);
|
|
146
146
|
});
|
|
147
|
-
this.axis = (e == null ? void 0 : e.axis) || "y", this.speed = (e == null ? void 0 : e.speed) || 1, this.debounce = (e == null ? void 0 : e.debounce) || !1, i(this, P, Date.now()),
|
|
147
|
+
this.axis = (e == null ? void 0 : e.axis) || "y", this.speed = (e == null ? void 0 : e.speed) || 1, this.debounce = (e == null ? void 0 : e.debounce) || !1, i(this, P, Date.now()), w && i(this, z, e != null && e.element && Z(e.element) || window);
|
|
148
148
|
}
|
|
149
149
|
connect() {
|
|
150
|
-
|
|
150
|
+
w && t(this, z).addEventListener(
|
|
151
151
|
"wheel",
|
|
152
152
|
t(this, B),
|
|
153
153
|
{
|
|
@@ -156,7 +156,7 @@ class Ee extends j {
|
|
|
156
156
|
);
|
|
157
157
|
}
|
|
158
158
|
disconnect() {
|
|
159
|
-
|
|
159
|
+
w && (t(this, z).removeEventListener(
|
|
160
160
|
"wheel",
|
|
161
161
|
t(this, B)
|
|
162
162
|
), clearTimeout(t(this, k)));
|
|
@@ -198,15 +198,15 @@ const v = class v extends j {
|
|
|
198
198
|
);
|
|
199
199
|
}), i(this, L, () => {
|
|
200
200
|
Math.floor(Math.abs(t(this, l))) || D.unsubscribe(t(this, L)), i(this, l, t(this, l) * 0.95), i(this, l, he(t(this, l), 3)), this.changeEvent.notify("drag", t(this, l), null);
|
|
201
|
-
}), this.axis = (e == null ? void 0 : e.axis) || "y", this.swipe = (e == null ? void 0 : e.swipe) || !1,
|
|
201
|
+
}), this.axis = (e == null ? void 0 : e.axis) || "y", this.swipe = (e == null ? void 0 : e.swipe) || !1, w && (i(this, o, e != null && e.element && Z(e.element) || document.documentElement), i(this, N, (e == null ? void 0 : e.rootElement) || t(this, o)));
|
|
202
202
|
}
|
|
203
203
|
connect() {
|
|
204
|
-
|
|
204
|
+
w && (i(this, C, [...t(this, N).querySelectorAll("a")]), t(this, C).forEach((e) => {
|
|
205
205
|
e.addEventListener("click", t(this, R));
|
|
206
206
|
}), t(this, o).addEventListener("pointerdown", t(this, W)));
|
|
207
207
|
}
|
|
208
208
|
disconnect() {
|
|
209
|
-
|
|
209
|
+
w && (t(this, C).forEach((e) => {
|
|
210
210
|
e.removeEventListener("click", t(this, R));
|
|
211
211
|
}), t(this, o).removeEventListener(
|
|
212
212
|
"pointerdown",
|
|
@@ -18,21 +18,21 @@ const n = (e) => e, s = (e) => e * e, a = (e) => e * (2 - e), r = (e) => e < 0.5
|
|
|
18
18
|
linear: n
|
|
19
19
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
20
20
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
s as a,
|
|
22
|
+
a as b,
|
|
23
|
+
r as c,
|
|
24
|
+
u as d,
|
|
25
25
|
x as e,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
o as f,
|
|
27
|
+
c as g,
|
|
28
|
+
O as h,
|
|
29
|
+
i,
|
|
30
|
+
I as j,
|
|
31
|
+
Q as k,
|
|
32
32
|
n as l,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
p,
|
|
37
|
-
|
|
33
|
+
b as m,
|
|
34
|
+
l as n,
|
|
35
|
+
p as o,
|
|
36
|
+
d as p,
|
|
37
|
+
g as q
|
|
38
38
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function t(e){const i=window.getComputedStyle(e);return i.display!=="none"&&i.visibility!=="hidden"}exports.isElementVisible=t;
|
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-lnBE_6yf.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;
|
|
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-lnBE_6yf.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;
|