aptechka 0.63.2 → 0.63.3
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 +56 -52
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +15 -15
- package/package.json +1 -1
package/lib/billboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Q=i=>{throw TypeError(i)};var O=(i,r,e)=>r.has(i)||Q("Cannot "+e);var t=(i,r,e)=>(O(i,r,"read from private field"),e?e.call(i):r.get(i)),s=(i,r,e)=>r.has(i)?Q("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,e),d=(i,r,e,n)=>(O(i,r,"write to private field"),n?n.call(i,e):r.set(i,e),e),m=(i,r,e)=>(O(i,r,"access private method"),e);var J=(i,r,e)=>new Promise((n,
|
|
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/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;
|
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, A, 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, A);
|
|
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, A, 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, A, setTimeout(s, 10));
|
|
203
203
|
}
|
|
204
204
|
close() {
|
|
205
|
-
t(this, f) && (clearTimeout(t(this,
|
|
205
|
+
t(this, f) && (clearTimeout(t(this, A)), clearTimeout(t(this, W)), E.stack.remove(t(this, g).current, this), h(this, f, !1), y(this, P, F).call(this), t(this, a).set("transitionend", !1), h(this, M, setTimeout(() => {
|
|
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, A)), clearTimeout(t(this, W)), removeEventListener("popstate", t(this, V)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), this.style.removeProperty("--viewport-offset-x"), this.style.removeProperty("--viewport-offset-y"), y(this, P, F).call(this);
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
|
-
f = new WeakMap(), M = new WeakMap(), H = new WeakMap(),
|
|
226
|
+
f = new WeakMap(), M = new WeakMap(), H = new WeakMap(), A = new WeakMap(), W = new WeakMap(), m = new WeakMap(), w = new WeakMap(), S = new WeakMap(), C = new WeakMap(), g = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), L = new WeakMap(), T = new WeakMap(), O = new WeakMap(), a = new WeakMap(), P = new WeakSet(), rt = function() {
|
|
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(), x = 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, x, Z, B, D, U, X, N;
|
|
237
237
|
class at extends HTMLElement {
|
|
238
238
|
constructor() {
|
|
239
239
|
super();
|
|
240
|
-
r(this,
|
|
240
|
+
r(this, x);
|
|
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
|
-
|
|
261
|
+
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, x, 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, x, 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, x, 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, x, Z).call(this);
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
n = new WeakMap(), d = new WeakMap(),
|
|
321
|
+
n = new WeakMap(), d = new WeakMap(), x = new WeakSet(), Z = function() {
|
|
322
322
|
t(this, n) && (t(this, n).removeEventListener(
|
|
323
323
|
"popoverTriggered",
|
|
324
324
|
t(this, B)
|