aptechka 0.64.7 → 0.64.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/accordion/index.cjs +1 -1
- package/lib/accordion/index.js +60 -58
- package/lib/billboard/index.cjs +1 -1
- package/lib/billboard/index.js +25 -25
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +27 -27
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +149 -149
- package/package.json +1 -1
package/lib/accordion/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var z=s=>{throw TypeError(s)};var p=(s,i,t)=>i.has(s)||z("Cannot "+t);var e=(s,i,t)=>(p(s,i,"read from private field"),t?t.call(s):i.get(s)),o=(s,i,t)=>i.has(s)?z("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(s):i.set(s,t),c=(s,i,t,r)=>(p(s,i,"write to private field"),r?r.call(s,t):i.set(s,t),t),d=(s,i,t)=>(p(s,i,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("../attribute/index.cjs"),q=require("../index-DekP7OZe.cjs"),S=require("../events-KVanG9sR.cjs"),O=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");var u,h,f,l,v,m,n,x,w,y,E,C,I;class k{constructor(i,t){o(this,n);o(this,u,null);o(this,h,null);o(this,f,null);o(this,l,null);o(this,v);o(this,m,!1);o(this,w,()=>{e(this,m)?this.close():this.open()});o(this,y,i=>{e(this,m)&&!(i instanceof CustomEvent)&&(d(this,n,E).call(this,0,!0),d(this,n,E).call(this,e(this,n,x)))});t.firstElementChild instanceof HTMLElement&&t.lastElementChild instanceof HTMLElement?(c(this,u,i),c(this,h,t),c(this,f,t.firstElementChild),c(this,l,t.lastElementChild),e(this,l).style.overflow="hidden",e(this,u).axisAttribute.current==="y"?e(this,l).style.height="0px":e(this,l).style.width="0px",addEventListener("resize",e(this,y)),e(this,f).addEventListener("click",e(this,w)),e(this,h).hasAttribute("data-opened")&&this.open({skipTransition:!0})):i.removeItem(e(this,h))}get element(){return e(this,h)}destroy(){e(this,f)&&(e(this,h).classList.remove("opened","triggered"),e(this,h).removeAttribute("data-opened"),e(this,f).style.cursor="",d(this,n,E).call(this,void 0),removeEventListener("resize",e(this,y)),e(this,f).removeEventListener("click",e(this,w)),clearTimeout(e(this,v)))}open(i){i!=null&&i.skipTransition&&d(this,n,C).call(this),e(this,u).multipleAttribute.current||e(this,u).closeAll({exclude:e(this,h)}),c(this,m,!0),clearTimeout(e(this,v)),e(this,h).classList.add("triggered"),d(this,n,E).call(this,e(this,n,x)),setTimeout(()=>{e(this,h).classList.add("opened"),e(this,h).setAttribute("data-opened",""),d(this,n,I).call(this)},0),S.dispatchEvent(this.element,"accordionItemToggle",{bubbles:!0,composed:!0,detail:{opened:e(this,m),element:e(this,h)}})}close(i){i!=null&&i.skipTransition&&d(this,n,C).call(this),clearTimeout(e(this,v)),c(this,m,!1),e(this,h).classList.remove("opened"),d(this,n,E).call(this,0),d(this,n,I).call(this,()=>{e(this,h).classList.remove("triggered")}),S.dispatchEvent(this.element,"accordionItemToggle",{bubbles:!0,composed:!0,detail:{opened:e(this,m),element:e(this,h)}})}}u=new WeakMap,h=new WeakMap,f=new WeakMap,l=new WeakMap,v=new WeakMap,m=new WeakMap,n=new WeakSet,x=function(){return e(this,u).axisAttribute.current==="x"?e(this,l).scrollWidth:e(this,l).scrollHeight},w=new WeakMap,y=new WeakMap,E=function(i,t=!1){t&&(e(this,l).style.transition="all 0s",setTimeout(()=>{e(this,l).style.transition=""}));const r=e(this,u).axisAttribute.current==="x"?"width":"height";i!=null?e(this,l).style[r]=`${i}px`:e(this,l).style[r]=""},C=function(){e(this,l).style.transition="all 0s",setTimeout(()=>{e(this,l).style.transition=""},50)},I=function(i){e(this,u).hasAttribute("no-window-resize")||c(this,v,setTimeout(()=>{i==null||i(),window.dispatchEvent(new CustomEvent("resize"))},O.getElementTransitionDurationMS(e(this,l))))};var b,g,a,T,L,M;class R extends HTMLElement{constructor(){super();o(this,L);o(this,b,new H.Attribute(this,"axis","y"));o(this,g,new H.Attribute(this,"multiple",!1));o(this,a,[]);o(this,T,null);q.isBrowser&&c(this,T,new MutationObserver(t=>{t.forEach(r=>{r.removedNodes.forEach(A=>{A instanceof HTMLElement&&this.removeItem(A)}),r.addedNodes.forEach(A=>{A instanceof HTMLElement&&this.createItem(A)})})}))}get axisAttribute(){return e(this,b)}get multipleAttribute(){return e(this,g)}createItem(t){e(this,a).find(r=>r.element===t)||e(this,a).push(new k(this,t))}removeItem(t){c(this,a,e(this,a).filter(r=>{if(r.element!==t)return!0;r.destroy()}))}closeAll(t){e(this,a).forEach(r=>{(t==null?void 0:t.exclude)!==r.element&&r.close(t)})}openAll(t){e(this,a).forEach(r=>{(t==null?void 0:t.exclude)!==r.element&&r.open(t)})}connectedCallback(){e(this,b).observe(),e(this,g).observe(),e(this,T).observe(e(this,L,M),{childList:!0}),c(this,a,[...e(this,L,M).children].map(t=>{if(t instanceof HTMLElement)return new k(this,t)}).filter(t=>!!t))}disconnectedCallback(){e(this,b).unobserve(),e(this,g).unobserve(),e(this,T).disconnect()}}b=new WeakMap,g=new WeakMap,a=new WeakMap,T=new WeakMap,L=new WeakSet,M=function(){return this.shadowRoot?this.shadowRoot:this};q.isBrowser&&!customElements.get("e-accordion")&&customElements.define("e-accordion",R);exports.AccordionElement=R;
|
package/lib/accordion/index.js
CHANGED
|
@@ -1,92 +1,94 @@
|
|
|
1
|
-
var
|
|
1
|
+
var M = (s) => {
|
|
2
2
|
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var x = (s, i, t) => i.has(s) ||
|
|
5
|
-
var e = (s, i, t) => (x(s, i, "read from private field"), t ? t.call(s) : i.get(s)),
|
|
6
|
-
import { Attribute as
|
|
7
|
-
import { i as
|
|
8
|
-
import { d as
|
|
9
|
-
import { g as
|
|
4
|
+
var x = (s, i, t) => i.has(s) || M("Cannot " + t);
|
|
5
|
+
var e = (s, i, t) => (x(s, i, "read from private field"), t ? t.call(s) : i.get(s)), o = (s, i, t) => i.has(s) ? M("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, t), a = (s, i, t, r) => (x(s, i, "write to private field"), r ? r.call(s, t) : i.set(s, t), t), d = (s, i, t) => (x(s, i, "access private method"), t);
|
|
6
|
+
import { Attribute as H } from "../attribute/index.js";
|
|
7
|
+
import { i as S } from "../index-Bv9zgfdb.js";
|
|
8
|
+
import { d as k } from "../events-CsVF98U6.js";
|
|
9
|
+
import { g as D } from "../style-j2TwriJ_.js";
|
|
10
10
|
import "construct-style-sheets-polyfill";
|
|
11
|
-
var
|
|
12
|
-
class
|
|
11
|
+
var c, h, f, l, E, m, n, y, w, A, v, C, I;
|
|
12
|
+
class R {
|
|
13
13
|
constructor(i, t) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
e(this,
|
|
14
|
+
o(this, n);
|
|
15
|
+
o(this, c, null);
|
|
16
|
+
o(this, h, null);
|
|
17
|
+
o(this, f, null);
|
|
18
|
+
o(this, l, null);
|
|
19
|
+
o(this, E);
|
|
20
|
+
o(this, m, !1);
|
|
21
|
+
o(this, w, () => {
|
|
22
|
+
e(this, m) ? this.close() : this.open();
|
|
23
23
|
});
|
|
24
|
-
|
|
25
|
-
e(this,
|
|
24
|
+
o(this, A, (i) => {
|
|
25
|
+
e(this, m) && !(i instanceof CustomEvent) && (d(this, n, v).call(this, 0, !0), d(this, n, v).call(this, e(this, n, y)));
|
|
26
26
|
});
|
|
27
|
-
t.firstElementChild instanceof HTMLElement && t.lastElementChild instanceof HTMLElement ? (a(this,
|
|
27
|
+
t.firstElementChild instanceof HTMLElement && t.lastElementChild instanceof HTMLElement ? (a(this, c, i), a(this, h, t), a(this, f, t.firstElementChild), a(this, l, t.lastElementChild), e(this, l).style.overflow = "hidden", e(this, c).axisAttribute.current === "y" ? e(this, l).style.height = "0px" : e(this, l).style.width = "0px", addEventListener("resize", e(this, A)), e(this, f).addEventListener("click", e(this, w)), e(this, h).hasAttribute("data-opened") && this.open({ skipTransition: !0 })) : i.removeItem(e(this, h));
|
|
28
28
|
}
|
|
29
29
|
get element() {
|
|
30
30
|
return e(this, h);
|
|
31
31
|
}
|
|
32
32
|
destroy() {
|
|
33
|
-
e(this, f) && (e(this, h).classList.remove("opened", "triggered"), e(this, h).removeAttribute("data-opened"), e(this, f).style.cursor = "",
|
|
33
|
+
e(this, f) && (e(this, h).classList.remove("opened", "triggered"), e(this, h).removeAttribute("data-opened"), e(this, f).style.cursor = "", d(this, n, v).call(this, void 0), removeEventListener("resize", e(this, A)), e(this, f).removeEventListener("click", e(this, w)), clearTimeout(e(this, E)));
|
|
34
34
|
}
|
|
35
35
|
open(i) {
|
|
36
|
-
i != null && i.skipTransition &&
|
|
37
|
-
e(this, h).classList.add("opened"), e(this, h).setAttribute("data-opened", ""),
|
|
38
|
-
|
|
39
|
-
}, H(e(this, l))));
|
|
40
|
-
}, 0), z(this.element, "accordionItemToggle", {
|
|
36
|
+
i != null && i.skipTransition && d(this, n, C).call(this), e(this, c).multipleAttribute.current || e(this, c).closeAll({ exclude: e(this, h) }), a(this, m, !0), clearTimeout(e(this, E)), e(this, h).classList.add("triggered"), d(this, n, v).call(this, e(this, n, y)), setTimeout(() => {
|
|
37
|
+
e(this, h).classList.add("opened"), e(this, h).setAttribute("data-opened", ""), d(this, n, I).call(this);
|
|
38
|
+
}, 0), k(this.element, "accordionItemToggle", {
|
|
41
39
|
bubbles: !0,
|
|
42
40
|
composed: !0,
|
|
43
41
|
detail: {
|
|
44
|
-
opened: e(this,
|
|
42
|
+
opened: e(this, m),
|
|
45
43
|
element: e(this, h)
|
|
46
44
|
}
|
|
47
45
|
});
|
|
48
46
|
}
|
|
49
47
|
close(i) {
|
|
50
|
-
i != null && i.skipTransition &&
|
|
51
|
-
e(this, h).classList.remove("triggered")
|
|
52
|
-
}
|
|
48
|
+
i != null && i.skipTransition && d(this, n, C).call(this), clearTimeout(e(this, E)), a(this, m, !1), e(this, h).classList.remove("opened"), d(this, n, v).call(this, 0), d(this, n, I).call(this, () => {
|
|
49
|
+
e(this, h).classList.remove("triggered");
|
|
50
|
+
}), k(this.element, "accordionItemToggle", {
|
|
53
51
|
bubbles: !0,
|
|
54
52
|
composed: !0,
|
|
55
53
|
detail: {
|
|
56
|
-
opened: e(this,
|
|
54
|
+
opened: e(this, m),
|
|
57
55
|
element: e(this, h)
|
|
58
56
|
}
|
|
59
57
|
});
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
|
-
|
|
63
|
-
return e(this,
|
|
64
|
-
}, w = new WeakMap(),
|
|
60
|
+
c = new WeakMap(), h = new WeakMap(), f = new WeakMap(), l = new WeakMap(), E = new WeakMap(), m = new WeakMap(), n = new WeakSet(), y = function() {
|
|
61
|
+
return e(this, c).axisAttribute.current === "x" ? e(this, l).scrollWidth : e(this, l).scrollHeight;
|
|
62
|
+
}, w = new WeakMap(), A = new WeakMap(), v = function(i, t = !1) {
|
|
65
63
|
t && (e(this, l).style.transition = "all 0s", setTimeout(() => {
|
|
66
64
|
e(this, l).style.transition = "";
|
|
67
65
|
}));
|
|
68
|
-
const r = e(this,
|
|
66
|
+
const r = e(this, c).axisAttribute.current === "x" ? "width" : "height";
|
|
69
67
|
i != null ? e(this, l).style[r] = `${i}px` : e(this, l).style[r] = "";
|
|
70
68
|
}, C = function() {
|
|
71
69
|
e(this, l).style.transition = "all 0s", setTimeout(() => {
|
|
72
70
|
e(this, l).style.transition = "";
|
|
73
71
|
}, 50);
|
|
72
|
+
}, I = function(i) {
|
|
73
|
+
e(this, c).hasAttribute("no-window-resize") || a(this, E, setTimeout(() => {
|
|
74
|
+
i == null || i(), window.dispatchEvent(new CustomEvent("resize"));
|
|
75
|
+
}, D(e(this, l))));
|
|
74
76
|
};
|
|
75
|
-
var b,
|
|
77
|
+
var b, g, u, p, L, z;
|
|
76
78
|
class N extends HTMLElement {
|
|
77
79
|
constructor() {
|
|
78
80
|
super();
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
o(this, L);
|
|
82
|
+
o(this, b, new H(this, "axis", "y"));
|
|
83
|
+
o(this, g, new H(this, "multiple", !1));
|
|
84
|
+
o(this, u, []);
|
|
85
|
+
o(this, p, null);
|
|
86
|
+
S && a(this, p, new MutationObserver((t) => {
|
|
85
87
|
t.forEach((r) => {
|
|
86
|
-
r.removedNodes.forEach((
|
|
87
|
-
|
|
88
|
-
}), r.addedNodes.forEach((
|
|
89
|
-
|
|
88
|
+
r.removedNodes.forEach((T) => {
|
|
89
|
+
T instanceof HTMLElement && this.removeItem(T);
|
|
90
|
+
}), r.addedNodes.forEach((T) => {
|
|
91
|
+
T instanceof HTMLElement && this.createItem(T);
|
|
90
92
|
});
|
|
91
93
|
});
|
|
92
94
|
}));
|
|
@@ -95,44 +97,44 @@ class N extends HTMLElement {
|
|
|
95
97
|
return e(this, b);
|
|
96
98
|
}
|
|
97
99
|
get multipleAttribute() {
|
|
98
|
-
return e(this,
|
|
100
|
+
return e(this, g);
|
|
99
101
|
}
|
|
100
102
|
createItem(t) {
|
|
101
|
-
e(this,
|
|
103
|
+
e(this, u).find((r) => r.element === t) || e(this, u).push(new R(this, t));
|
|
102
104
|
}
|
|
103
105
|
removeItem(t) {
|
|
104
|
-
a(this,
|
|
106
|
+
a(this, u, e(this, u).filter((r) => {
|
|
105
107
|
if (r.element !== t)
|
|
106
108
|
return !0;
|
|
107
109
|
r.destroy();
|
|
108
110
|
}));
|
|
109
111
|
}
|
|
110
112
|
closeAll(t) {
|
|
111
|
-
e(this,
|
|
113
|
+
e(this, u).forEach((r) => {
|
|
112
114
|
(t == null ? void 0 : t.exclude) !== r.element && r.close(t);
|
|
113
115
|
});
|
|
114
116
|
}
|
|
115
117
|
openAll(t) {
|
|
116
|
-
e(this,
|
|
118
|
+
e(this, u).forEach((r) => {
|
|
117
119
|
(t == null ? void 0 : t.exclude) !== r.element && r.open(t);
|
|
118
120
|
});
|
|
119
121
|
}
|
|
120
122
|
connectedCallback() {
|
|
121
|
-
e(this, b).observe(), e(this,
|
|
123
|
+
e(this, b).observe(), e(this, g).observe(), e(this, p).observe(e(this, L, z), {
|
|
122
124
|
childList: !0
|
|
123
|
-
}), a(this,
|
|
125
|
+
}), a(this, u, [...e(this, L, z).children].map((t) => {
|
|
124
126
|
if (t instanceof HTMLElement)
|
|
125
|
-
return new
|
|
127
|
+
return new R(this, t);
|
|
126
128
|
}).filter((t) => !!t));
|
|
127
129
|
}
|
|
128
130
|
disconnectedCallback() {
|
|
129
|
-
e(this, b).unobserve(), e(this,
|
|
131
|
+
e(this, b).unobserve(), e(this, g).unobserve(), e(this, p).disconnect();
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
|
-
b = new WeakMap(),
|
|
134
|
+
b = new WeakMap(), g = new WeakMap(), u = new WeakMap(), p = new WeakMap(), L = new WeakSet(), z = function() {
|
|
133
135
|
return this.shadowRoot ? this.shadowRoot : this;
|
|
134
136
|
};
|
|
135
|
-
|
|
137
|
+
S && !customElements.get("e-accordion") && customElements.define("e-accordion", N);
|
|
136
138
|
export {
|
|
137
139
|
N as AccordionElement
|
|
138
140
|
};
|
package/lib/billboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Q=i=>{throw TypeError(i)};var O=(i,r,e)=>r.has(i)||Q("Cannot "+e);var t=(i,r,e)=>(O(i,r,"read from private field"),e?e.call(i):r.get(i)),s=(i,r,e)=>r.has(i)?Q("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,e),d=(i,r,e,n)=>(O(i,r,"write to private field"),n?n.call(i,e):r.set(i,e),e),m=(i,r,e)=>(O(i,r,"access private method"),e);var J=(i,r,e)=>new Promise((n,l)=>{var a=y=>{try{G(e.next(y))}catch(N){l(N)}},x=y=>{try{G(e.throw(y))}catch(N){l(N)}},G=y=>y.done?n(y.value):Promise.resolve(y.value).then(a,x);G((e=e.apply(i,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";var Q=i=>{throw TypeError(i)};var O=(i,r,e)=>r.has(i)||Q("Cannot "+e);var t=(i,r,e)=>(O(i,r,"read from private field"),e?e.call(i):r.get(i)),s=(i,r,e)=>r.has(i)?Q("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,e),d=(i,r,e,n)=>(O(i,r,"write to private field"),n?n.call(i,e):r.set(i,e),e),m=(i,r,e)=>(O(i,r,"access private method"),e);var J=(i,r,e)=>new Promise((n,l)=>{var a=y=>{try{G(e.next(y))}catch(N){l(N)}},x=y=>{try{G(e.throw(y))}catch(N){l(N)}},G=y=>y.done?n(y.value):Promise.resolve(y.value).then(a,x);G((e=e.apply(i,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("../index-DekP7OZe.cjs"),K=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");const B=require("../css-property/index.cjs"),W=require("../events-KVanG9sR.cjs"),X=require("../gestures-C7gbKx11.cjs"),Y=require("../math-GDWEqu7y.cjs"),Z=require("../number-DyefJ5a1.cjs");var P,k,f,E,L,S,o,h,b,$,I,_,A,j,F;class z extends HTMLElement{constructor(){super(...arguments);s(this,b);s(this,P,new B.CSSProperty(this,"--resize",!0));s(this,k,new B.CSSProperty(this,"--loop",!0));s(this,f,new B.CSSProperty(this,"--autoplay",!1));s(this,E,new B.CSSProperty(this,"--swipe","x"));s(this,L);s(this,S,!1);s(this,o,[]);s(this,h,0);s(this,I,e=>{d(this,S,e.isIntersecting),t(this,S)?m(this,b,$).call(this):clearInterval(t(this,L))});s(this,_,()=>{clearInterval(t(this,L)),t(this,S)&&d(this,L,setInterval(t(this,j),parseFloat(t(this,f).current||"0")*1e3))});s(this,j,()=>{m(this,b,A).call(this,t(this,h)+1)});s(this,F,e=>{if(!t(this,E).current)return;let n=0;X.setupDrag(l=>{const a=e.x-l.x,x=e.y-l.y;t(this,E).current==="x"?Math.abs(a)>Math.abs(x)&&Math.abs(a)>10&&(n=Math.sign(a)):t(this,E).current==="y"&&Math.abs(x)>Math.abs(a)&&Math.abs(x)>10&&(n=Math.sign(x))},()=>{n&&this.shift(n)})})}get counter(){return t(this,h)}get loop(){return t(this,k)}get autoplay(){return t(this,f)}get swipe(){return t(this,E)}get itemElements(){return t(this,o)}addItem(e){t(this,o).push(e),m(this,b,A).call(this)}set(e){(!this.handleSet||this.handleSet(e))&&(m(this,b,A).call(this,e),m(this,b,$).call(this))}shift(e){this.set(t(this,h)+e)}connectedCallback(){var e;d(this,o,[...this.querySelectorAll(`[data-billboard-item${this.id?`="${this.id}"`:""}]`)]),(e=t(this,o)[0])==null||e.classList.add("current"),t(this,f).subscribe(n=>{n.current?(M.intersector.subscribe(this,t(this,I)),m(this,b,$).call(this)):(d(this,S,!0),M.intersector.unsubscribe(t(this,I)),clearInterval(t(this,L)),m(this,b,A).call(this,0))}),t(this,f).observe(),t(this,E).observe(),t(this,k).observe(),t(this,P).observe(),m(this,b,A).call(this,0),this.addEventListener("pointerdown",t(this,F))}disconnectedCallback(){t(this,f).unobserve(),t(this,E).unobserve(),t(this,k).unobserve(),t(this,P).unobserve(),M.intersector.unsubscribe(t(this,I)),clearInterval(t(this,L))}}P=new WeakMap,k=new WeakMap,f=new WeakMap,E=new WeakMap,L=new WeakMap,S=new WeakMap,o=new WeakMap,h=new WeakMap,b=new WeakSet,$=function(){t(this,f).current!==!1&&t(this,_).call(this)},I=new WeakMap,_=new WeakMap,A=function(e=t(this,h)){const n=t(this,h);t(this,k).current?d(this,h,Z.loopNumber(e,t(this,o).length)):d(this,h,Y.clamp(e,0,t(this,o).length-1)),this.classList.remove("forward","backward"),t(this,h)-n>=0?this.classList.add("forward"):t(this,h)-n<0&&this.classList.add("backward"),t(this,o).forEach((l,a)=>{l.classList.remove("current","previous","next"),a===t(this,h)?l.classList.add("current"):a<t(this,h)?l.classList.add("previous"):a>t(this,h)&&l.classList.add("next")}),this.classList.toggle("has-length",t(this,o).length>1),this.classList.toggle("start",t(this,h)===0),this.classList.toggle("end",t(this,h)===t(this,o).length-1),this.style.setProperty("--counter",t(this,h).toString()),this.style.setProperty("--sections",t(this,o).length.toString()),t(this,h)!==n&&(W.dispatchEvent(this,"billboardChange",{detail:{counter:t(this,h)}}),t(this,P).current&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},0))},j=new WeakMap,F=new WeakMap;customElements.get("e-billboard")||customElements.define("e-billboard",z);var u,T,p,H,q;class R extends HTMLElement{constructor(){super(...arguments);s(this,u,null);s(this,T,null);s(this,p,[]);s(this,H,e=>{const n=e.currentTarget,l=t(this,p).findIndex(a=>a===n);l>=0&&t(this,u).set(l)});s(this,q,()=>{t(this,p).forEach((e,n)=>{n===t(this,u).counter?e.classList.add("current"):e.classList.remove("current")})})}connectedCallback(){return J(this,null,function*(){var e;if(d(this,u,K.findParentElement(this,z)),t(this,u)&&(yield customElements.whenDefined("e-billboard"),this.isConnected)){this.innerHTML="";const n=t(this,u).itemElements.length;d(this,T,document.createElement("div"));for(let l=0;l<n;l++){const a=document.createElement("button");a.setAttribute("aria-label",`Go to item ${l+1}`),t(this,p).push(a),t(this,T).appendChild(a)}this.appendChild(t(this,T)),t(this,p).forEach(l=>{l.addEventListener("click",t(this,H))}),(e=t(this,u))==null||e.addEventListener("billboardChange",t(this,q)),t(this,q).call(this)}})}disconnectedCallback(){var e;t(this,p).forEach(n=>{n.removeEventListener("click",t(this,H))}),(e=t(this,u))==null||e.removeEventListener("billboardChange",t(this,q)),this.innerHTML="",d(this,p,[])}}u=new WeakMap,T=new WeakMap,p=new WeakMap,H=new WeakMap,q=new WeakMap;M.isBrowser&&!customElements.get("e-billboard-bullets")&&customElements.define("e-billboard-bullets",R);var v,g,w;class U extends HTMLElement{constructor(){super();s(this,v,new B.CSSProperty(this,"--index",0));s(this,g,null);s(this,w,()=>{var e;t(this,v).current===((e=t(this,g))==null?void 0:e.counter)?this.classList.add("current"):this.classList.remove("current")});this.addEventListener("click",e=>{t(this,g)&&(!this.handleClick||this.handleClick(e))&&t(this,g).set(t(this,v).current)}),this.addEventListener("keydown",e=>{e.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(e.preventDefault(),this.click())})}connectedCallback(){var e;this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button"),d(this,g,K.findParentElement(this,z)),(e=t(this,g))==null||e.addEventListener("billboardChange",t(this,w)),customElements.whenDefined("e-billboard").then(()=>{this.isConnected&&t(this,w).call(this)}),t(this,v).subscribe(t(this,w)),t(this,v).observe()}disconnectedCallback(){var e;this.removeAttribute("tabindex"),this.removeAttribute("role"),t(this,v).unsubscribe(t(this,w)),t(this,v).unobserve(),(e=t(this,g))==null||e.removeEventListener("billboardChange",t(this,w))}}v=new WeakMap,g=new WeakMap,w=new WeakMap;M.isBrowser&&!customElements.get("e-billboard-set-button")&&customElements.define("e-billboard-set-button",U);var C,c,D;class V extends HTMLElement{constructor(){super();s(this,C,new B.CSSProperty(this,"--step",1));s(this,c,null);s(this,D,()=>{t(this,c)&&(!t(this,c).loop.current&&(t(this,c).counter===0&&t(this,C).current<=0||t(this,c).counter===t(this,c).itemElements.length-1&&t(this,C).current>=0)?this.setAttribute("disabled",""):this.removeAttribute("disabled"))});this.addEventListener("click",e=>{t(this,c)&&(!this.handleClick||this.handleClick(e))&&t(this,c).shift(t(this,C).current)}),this.addEventListener("keydown",e=>{e.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(e.preventDefault(),this.click())})}connectedCallback(){return J(this,null,function*(){var e;yield customElements.whenDefined("e-billboard"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button"),t(this,C).observe(),this.tabIndex=0,d(this,c,K.findParentElement(this,z)),(e=t(this,c))==null||e.addEventListener("billboardChange",t(this,D)),setTimeout(()=>{t(this,D).call(this)},0)})}disconnectedCallback(){var e;this.removeAttribute("tabindex"),this.removeAttribute("role"),t(this,C).unobserve(),(e=t(this,c))==null||e.removeEventListener("billboardChange",t(this,D))}}C=new WeakMap,c=new WeakMap,D=new WeakMap;M.isBrowser&&!customElements.get("e-billboard-step-button")&&customElements.define("e-billboard-step-button",V);exports.BillboardBulletsElement=R;exports.BillboardElement=z;exports.BillboardSetButtonElement=U;exports.BillboardStepButtonElement=V;
|
package/lib/billboard/index.js
CHANGED
|
@@ -10,32 +10,32 @@ var K = (i, r, e) => new Promise((n, l) => {
|
|
|
10
10
|
} catch (j) {
|
|
11
11
|
l(j);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, A = (C) => {
|
|
14
14
|
try {
|
|
15
15
|
N(e.throw(C));
|
|
16
16
|
} catch (j) {
|
|
17
17
|
l(j);
|
|
18
18
|
}
|
|
19
|
-
}, N = (C) => C.done ? n(C.value) : Promise.resolve(C.value).then(a,
|
|
19
|
+
}, N = (C) => C.done ? n(C.value) : Promise.resolve(C.value).then(a, A);
|
|
20
20
|
N((e = e.apply(i, r)).next());
|
|
21
21
|
});
|
|
22
22
|
import { a as O, i as Q } from "../index-Bv9zgfdb.js";
|
|
23
23
|
import { b as R } from "../dom-CVWzyXPH.js";
|
|
24
24
|
import "construct-style-sheets-polyfill";
|
|
25
|
-
import { CSSProperty as
|
|
25
|
+
import { CSSProperty as I } from "../css-property/index.js";
|
|
26
26
|
import { d as V } from "../events-CsVF98U6.js";
|
|
27
27
|
import { s as W } from "../gestures-CcXV6fCp.js";
|
|
28
28
|
import { c as X } from "../math-BOBiC4TN.js";
|
|
29
29
|
import { l as Y } from "../number-CbdpfO3u.js";
|
|
30
|
-
var
|
|
30
|
+
var S, x, f, p, L, y, o, h, b, z, T, $, M, q, F;
|
|
31
31
|
class G extends HTMLElement {
|
|
32
32
|
constructor() {
|
|
33
33
|
super(...arguments);
|
|
34
34
|
s(this, b);
|
|
35
|
-
s(this,
|
|
36
|
-
s(this, x, new
|
|
37
|
-
s(this, f, new
|
|
38
|
-
s(this, p, new
|
|
35
|
+
s(this, S, new I(this, "--resize", !0));
|
|
36
|
+
s(this, x, new I(this, "--loop", !0));
|
|
37
|
+
s(this, f, new I(this, "--autoplay", !1));
|
|
38
|
+
s(this, p, new I(this, "--swipe", "x"));
|
|
39
39
|
s(this, L);
|
|
40
40
|
s(this, y, !1);
|
|
41
41
|
s(this, o, []);
|
|
@@ -50,7 +50,7 @@ class G extends HTMLElement {
|
|
|
50
50
|
));
|
|
51
51
|
});
|
|
52
52
|
s(this, q, () => {
|
|
53
|
-
m(this, b,
|
|
53
|
+
m(this, b, M).call(this, t(this, h) + 1);
|
|
54
54
|
});
|
|
55
55
|
s(this, F, (e) => {
|
|
56
56
|
if (!t(this, p).current)
|
|
@@ -58,8 +58,8 @@ class G extends HTMLElement {
|
|
|
58
58
|
let n = 0;
|
|
59
59
|
W(
|
|
60
60
|
(l) => {
|
|
61
|
-
const a = e.x - l.x,
|
|
62
|
-
t(this, p).current === "x" ? Math.abs(a) > Math.abs(
|
|
61
|
+
const a = e.x - l.x, A = e.y - l.y;
|
|
62
|
+
t(this, p).current === "x" ? Math.abs(a) > Math.abs(A) && Math.abs(a) > 10 && (n = Math.sign(a)) : t(this, p).current === "y" && Math.abs(A) > Math.abs(a) && Math.abs(A) > 10 && (n = Math.sign(A));
|
|
63
63
|
},
|
|
64
64
|
() => {
|
|
65
65
|
n && this.shift(n);
|
|
@@ -83,10 +83,10 @@ class G extends HTMLElement {
|
|
|
83
83
|
return t(this, o);
|
|
84
84
|
}
|
|
85
85
|
addItem(e) {
|
|
86
|
-
t(this, o).push(e), m(this, b,
|
|
86
|
+
t(this, o).push(e), m(this, b, M).call(this);
|
|
87
87
|
}
|
|
88
88
|
set(e) {
|
|
89
|
-
(!this.handleSet || this.handleSet(e)) && (m(this, b,
|
|
89
|
+
(!this.handleSet || this.handleSet(e)) && (m(this, b, M).call(this, e), m(this, b, z).call(this));
|
|
90
90
|
}
|
|
91
91
|
shift(e) {
|
|
92
92
|
this.set(t(this, h) + e);
|
|
@@ -98,16 +98,16 @@ class G extends HTMLElement {
|
|
|
98
98
|
`[data-billboard-item${this.id ? `="${this.id}"` : ""}]`
|
|
99
99
|
)
|
|
100
100
|
]), (e = t(this, o)[0]) == null || e.classList.add("current"), t(this, f).subscribe((n) => {
|
|
101
|
-
n.current ? (O.subscribe(this, t(this, T)), m(this, b, z).call(this)) : (d(this, y, !0), O.unsubscribe(t(this, T)), clearInterval(t(this, L)), m(this, b,
|
|
102
|
-
}), t(this, f).observe(), t(this, p).observe(), t(this, x).observe(), t(this,
|
|
101
|
+
n.current ? (O.subscribe(this, t(this, T)), m(this, b, z).call(this)) : (d(this, y, !0), O.unsubscribe(t(this, T)), clearInterval(t(this, L)), m(this, b, M).call(this, 0));
|
|
102
|
+
}), t(this, f).observe(), t(this, p).observe(), t(this, x).observe(), t(this, S).observe(), m(this, b, M).call(this, 0), this.addEventListener("pointerdown", t(this, F));
|
|
103
103
|
}
|
|
104
104
|
disconnectedCallback() {
|
|
105
|
-
t(this, f).unobserve(), t(this, p).unobserve(), t(this, x).unobserve(), t(this,
|
|
105
|
+
t(this, f).unobserve(), t(this, p).unobserve(), t(this, x).unobserve(), t(this, S).unobserve(), O.unsubscribe(t(this, T)), clearInterval(t(this, L));
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
S = new WeakMap(), x = new WeakMap(), f = new WeakMap(), p = new WeakMap(), L = new WeakMap(), y = new WeakMap(), o = new WeakMap(), h = new WeakMap(), b = new WeakSet(), z = function() {
|
|
109
109
|
t(this, f).current !== !1 && t(this, $).call(this);
|
|
110
|
-
}, T = new WeakMap(), $ = new WeakMap(),
|
|
110
|
+
}, T = new WeakMap(), $ = new WeakMap(), M = function(e = t(this, h)) {
|
|
111
111
|
const n = t(this, h);
|
|
112
112
|
t(this, x).current ? d(this, h, Y(e, t(this, o).length)) : d(this, h, X(e, 0, t(this, o).length - 1)), this.classList.remove("forward", "backward"), t(this, h) - n >= 0 ? this.classList.add("forward") : t(this, h) - n < 0 && this.classList.add("backward"), t(this, o).forEach((l, a) => {
|
|
113
113
|
l.classList.remove("current", "previous", "next"), a === t(this, h) ? l.classList.add("current") : a < t(this, h) ? l.classList.add("previous") : a > t(this, h) && l.classList.add("next");
|
|
@@ -118,7 +118,7 @@ A = new WeakMap(), x = new WeakMap(), f = new WeakMap(), p = new WeakMap(), L =
|
|
|
118
118
|
detail: {
|
|
119
119
|
counter: t(this, h)
|
|
120
120
|
}
|
|
121
|
-
}), t(this,
|
|
121
|
+
}), t(this, S).current && setTimeout(() => {
|
|
122
122
|
window.dispatchEvent(new Event("resize"));
|
|
123
123
|
}, 0));
|
|
124
124
|
}, q = new WeakMap(), F = new WeakMap();
|
|
@@ -176,7 +176,7 @@ var E, g, w;
|
|
|
176
176
|
class _ extends HTMLElement {
|
|
177
177
|
constructor() {
|
|
178
178
|
super();
|
|
179
|
-
s(this, E, new
|
|
179
|
+
s(this, E, new I(this, "--index", 0));
|
|
180
180
|
s(this, g, null);
|
|
181
181
|
s(this, w, () => {
|
|
182
182
|
var e;
|
|
@@ -190,7 +190,7 @@ class _ extends HTMLElement {
|
|
|
190
190
|
}
|
|
191
191
|
connectedCallback() {
|
|
192
192
|
var e;
|
|
193
|
-
this.
|
|
193
|
+
this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.hasAttribute("role") || this.setAttribute("role", "button"), d(this, g, R(this, G)), (e = t(this, g)) == null || e.addEventListener(
|
|
194
194
|
"billboardChange",
|
|
195
195
|
t(this, w)
|
|
196
196
|
), customElements.whenDefined("e-billboard").then(() => {
|
|
@@ -199,7 +199,7 @@ class _ extends HTMLElement {
|
|
|
199
199
|
}
|
|
200
200
|
disconnectedCallback() {
|
|
201
201
|
var e;
|
|
202
|
-
this.removeAttribute("tabindex"), t(this, E).unsubscribe(t(this, w)), t(this, E).unobserve(), (e = t(this, g)) == null || e.removeEventListener(
|
|
202
|
+
this.removeAttribute("tabindex"), this.removeAttribute("role"), t(this, E).unsubscribe(t(this, w)), t(this, E).unobserve(), (e = t(this, g)) == null || e.removeEventListener(
|
|
203
203
|
"billboardChange",
|
|
204
204
|
t(this, w)
|
|
205
205
|
);
|
|
@@ -211,7 +211,7 @@ var k, c, H;
|
|
|
211
211
|
class tt extends HTMLElement {
|
|
212
212
|
constructor() {
|
|
213
213
|
super();
|
|
214
|
-
s(this, k, new
|
|
214
|
+
s(this, k, new I(this, "--step", 1));
|
|
215
215
|
s(this, c, null);
|
|
216
216
|
s(this, H, () => {
|
|
217
217
|
t(this, c) && (!t(this, c).loop.current && (t(this, c).counter === 0 && t(this, k).current <= 0 || t(this, c).counter === t(this, c).itemElements.length - 1 && t(this, k).current >= 0) ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"));
|
|
@@ -225,7 +225,7 @@ class tt extends HTMLElement {
|
|
|
225
225
|
connectedCallback() {
|
|
226
226
|
return K(this, null, function* () {
|
|
227
227
|
var e;
|
|
228
|
-
yield customElements.whenDefined("e-billboard"), t(this, k).observe(), this.tabIndex = 0, d(this, c, R(this, G)), (e = t(this, c)) == null || e.addEventListener(
|
|
228
|
+
yield customElements.whenDefined("e-billboard"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.hasAttribute("role") || this.setAttribute("role", "button"), t(this, k).observe(), this.tabIndex = 0, d(this, c, R(this, G)), (e = t(this, c)) == null || e.addEventListener(
|
|
229
229
|
"billboardChange",
|
|
230
230
|
t(this, H)
|
|
231
231
|
), setTimeout(() => {
|
|
@@ -235,7 +235,7 @@ class tt extends HTMLElement {
|
|
|
235
235
|
}
|
|
236
236
|
disconnectedCallback() {
|
|
237
237
|
var e;
|
|
238
|
-
this.removeAttribute("tabindex"), t(this, k).unobserve(), (e = t(this, c)) == null || e.removeEventListener(
|
|
238
|
+
this.removeAttribute("tabindex"), this.removeAttribute("role"), t(this, k).unobserve(), (e = t(this, c)) == null || e.removeEventListener(
|
|
239
239
|
"billboardChange",
|
|
240
240
|
t(this, H)
|
|
241
241
|
);
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var te=c=>{throw TypeError(c)};var Q=(c,o,t)=>o.has(c)||te("Cannot "+t);var e=(c,o,t)=>(Q(c,o,"read from private field"),t?t.call(c):o.get(c)),r=(c,o,t)=>o.has(c)?te("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(c):o.set(c,t),n=(c,o,t,s)=>(Q(c,o,"write to private field"),s?s.call(c,t):o.set(c,t),t),b=(c,o,t)=>(Q(c,o,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const he=require("../element-linked-store/index.cjs"),m=require("../css-property/index.cjs"),_=require("../index-DekP7OZe.cjs"),Y=require("../events-KVanG9sR.cjs"),ce=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ie=require("../url-lnBE_6yf.cjs"),re=require("../window-resizer/index.cjs"),F=require("../Viewport-DB0qAZPJ.cjs");var u,y,J,K;class le{constructor(){r(this,u,new Map);r(this,y,[]);r(this,J,o=>{var s;const t=[...e(this,y)].reverse().find(i=>i.clickOutside.current);if(t){const i=o.composedPath();if(i.find(ee=>ee instanceof HTMLElement&&ee.hasAttribute("data-popover-content")))return;const l=i[0],p=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),H=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!p||H)&&t.close()}});r(this,K,o=>{if(o.code==="Escape"){const t=[...e(this,y)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,J)),addEventListener("keydown",e(this,K))}get groups(){return e(this,u)}get stack(){return e(this,y)}add(o,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(o);i==null||i.forEach(l=>{l.close()})}let s=e(this,u).get(o);s!=null&&s.length||(s=[],e(this,u).set(o,s)),e(this,y).push(t),s.push(t)}remove(o,t){if(n(this,y,e(this,y).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(o);e(this,u).delete(o),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(o);s&&(s=s.filter(i=>i!==t),e(this,u).set(o,s))}}}u=new WeakMap,y=new WeakMap,J=new WeakMap,K=new WeakMap;var f,$,M,C,B,v,w,x,A,g,R,q,L,T,O,a,P,oe,I,V,S,W,G;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,$);r(this,M);r(this,C);r(this,B);r(this,v);r(this,w);r(this,x);r(this,A);r(this,g);r(this,R);r(this,q);r(this,L);r(this,T);r(this,O);r(this,a);r(this,V);r(this,S);r(this,W);r(this,G);this.urlValue="",n(this,f,!1),n(this,v,new m.CSSProperty(this,"--history",!1)),n(this,w,new m.CSSProperty(this,"--restore",!1)),n(this,x,new m.CSSProperty(this,"--close-rest",!1)),n(this,A,new m.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new m.CSSProperty(this,"--group","")),n(this,R,new m.CSSProperty(this,"--click-outside",!1)),n(this,q,new m.CSSProperty(this,"--escape",!1)),n(this,L,new m.CSSProperty(this,"--check-viewport-bounds",!1)),n(this,T,!1),n(this,a,new he.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),n(this,V,()=>{n(this,T,!1),e(this,f)&&e(this,v).current&&!location.search.includes(this.id)?this.close():!e(this,f)&&e(this,v).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,T,!0)}),n(this,S,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,W).call(this)}),n(this,W,ce.debounce(()=>{e(this,G).call(this)},10)),n(this,G,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,L).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>F.viewport.width?s=F.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>F.viewport.height?i=F.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),e(this,g).subscribe(t=>{t.previous&&(E.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=E.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get history(){return e(this,v)}get restore(){return e(this,w)}get closeRest(){return e(this,x)}get closeRestInGroup(){return e(this,A)}get group(){return e(this,g)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,f)}get lastTrigger(){return e(this,O)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,f)&&ie.updateSearchParameter(this.id,t)}open(t){if(e(this,f))return;n(this,O,t==null?void 0:t.trigger),clearTimeout(e(this,$)),clearTimeout(e(this,M)),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),Y.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,O)}}),e(this,v).current&&e(this,T)&&history.pushState(history.state,"",e(this,P,oe)),n(this,f,!0);const s=()=>{E.stack.add(e(this,g).current,this),e(this,S).call(this),e(this,a).set("opened",!0),Y.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,O)}}),n(this,C,void 0),n(this,B,setTimeout(()=>{e(this,a).set("transitionend",!0)},se.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():n(this,C,setTimeout(s,10))}close(){e(this,f)&&(clearTimeout(e(this,C)),clearTimeout(e(this,B)),E.stack.remove(e(this,g).current,this),n(this,f,!1),b(this,P,I).call(this),e(this,a).set("transitionend",!1),n(this,$,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),Y.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,M,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),Y.dispatchEvent(this,"popoverClosed",{custom:!0})},se.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){e(this,v).observe(),e(this,w).observe(),e(this,x).observe(),e(this,A).observe(),e(this,g).observe(),e(this,R).observe(),e(this,q).observe(),e(this,L).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,V)),setTimeout(()=>{e(this,w).current?(this.urlValue=ie.parseSearchParameters(location.search)[this.id],e(this,V).call(this)):(b(this,P,I).call(this),n(this,T,!0))},0),e(this,L).subscribe(()=>{e(this,S).call(this)}),re.windowResizer.subscribe(e(this,S))}disconnectedCallback(){E.stack.remove(e(this,g).current,this),re.windowResizer.unsubscribe(e(this,S)),e(this,a).close(),e(this,v).close(),e(this,w).close(),e(this,x).close(),e(this,A).close(),e(this,g).close(),e(this,R).close(),e(this,q).close(),e(this,L).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,M)),clearTimeout(e(this,C)),clearTimeout(e(this,B)),removeEventListener("popstate",e(this,V)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),b(this,P,I).call(this)}};f=new WeakMap,$=new WeakMap,M=new WeakMap,C=new WeakMap,B=new WeakMap,v=new WeakMap,w=new WeakMap,x=new WeakMap,A=new WeakMap,g=new WeakMap,R=new WeakMap,q=new WeakMap,L=new WeakMap,T=new WeakMap,O=new WeakMap,a=new WeakMap,P=new WeakSet,oe=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},I=function(){if(e(this,v).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},V=new WeakMap,S=new WeakMap,W=new WeakMap,G=new WeakMap,E.stack=new le;let z=E;_.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,d,k,Z,D,U,j,X,N;class ne extends HTMLElement{constructor(){super();r(this,k);r(this,h);r(this,d,new m.CSSProperty(this,"--type","open"));r(this,D,()=>{e(this,d).current!=="close"&&this.classList.add("triggered")});r(this,U,()=>{e(this,d).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,j,()=>{e(this,d).current!=="close"&&this.classList.remove("opened")});r(this,X,()=>{e(this,d).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});_.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,d).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,d)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(b(this,k,Z).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const p=this.getRootNode();p instanceof ShadowRoot?i=p.host.closest("[data-popover]"):p instanceof HTMLElement&&(i=p.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=p=>{if(!p)return null;let H=p.querySelector("[data-popover]");return!H&&(p!=null&&p.parentElement)&&(H=l(p.parentElement)),H};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(n(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,D)),e(this,h).addEventListener("popoverOpened",e(this,U)),e(this,h).addEventListener("popoverClosing",e(this,j)),e(this,h).addEventListener("popoverClosed",e(this,X))):console.warn(this,`target ${t} not found`)}b(this,k,N).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{b(this,k,N).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,d).observe()}disconnectedCallback(){e(this,d).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),b(this,k,Z).call(this)}}h=new WeakMap,d=new WeakMap,k=new WeakSet,Z=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,D)),e(this,h).removeEventListener("popoverOpened",e(this,U)),e(this,h).removeEventListener("popoverClosing",e(this,j)),e(this,h).removeEventListener("popoverClosed",e(this,X)))},D=new WeakMap,U=new WeakMap,j=new WeakMap,X=new WeakMap,N=function(t){e(this,h)instanceof z&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};_.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ne);exports.PopoverButtonElement=ne;exports.PopoverElement=z;
|
|
1
|
+
"use strict";var te=c=>{throw TypeError(c)};var Q=(c,o,t)=>o.has(c)||te("Cannot "+t);var e=(c,o,t)=>(Q(c,o,"read from private field"),t?t.call(c):o.get(c)),r=(c,o,t)=>o.has(c)?te("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(c):o.set(c,t),n=(c,o,t,s)=>(Q(c,o,"write to private field"),s?s.call(c,t):o.set(c,t),t),y=(c,o,t)=>(Q(c,o,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const he=require("../element-linked-store/index.cjs"),m=require("../css-property/index.cjs"),_=require("../index-DekP7OZe.cjs"),Y=require("../events-KVanG9sR.cjs"),ce=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ie=require("../url-lnBE_6yf.cjs"),re=require("../window-resizer/index.cjs"),F=require("../Viewport-DB0qAZPJ.cjs");var u,b,J,K;class le{constructor(){r(this,u,new Map);r(this,b,[]);r(this,J,o=>{var s;const t=[...e(this,b)].reverse().find(i=>i.clickOutside.current);if(t){const i=o.composedPath();if(i.find(ee=>ee instanceof HTMLElement&&ee.hasAttribute("data-popover-content")))return;const l=i[0],p=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),H=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!p||H)&&t.close()}});r(this,K,o=>{if(o.code==="Escape"){const t=[...e(this,b)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,J)),addEventListener("keydown",e(this,K))}get groups(){return e(this,u)}get stack(){return e(this,b)}add(o,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(o);i==null||i.forEach(l=>{l.close()})}let s=e(this,u).get(o);s!=null&&s.length||(s=[],e(this,u).set(o,s)),e(this,b).push(t),s.push(t)}remove(o,t){if(n(this,b,e(this,b).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(o);e(this,u).delete(o),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(o);s&&(s=s.filter(i=>i!==t),e(this,u).set(o,s))}}}u=new WeakMap,b=new WeakMap,J=new WeakMap,K=new WeakMap;var f,$,M,C,B,v,w,x,A,g,R,q,L,T,O,a,P,oe,I,V,S,W,G;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,$);r(this,M);r(this,C);r(this,B);r(this,v);r(this,w);r(this,x);r(this,A);r(this,g);r(this,R);r(this,q);r(this,L);r(this,T);r(this,O);r(this,a);r(this,V);r(this,S);r(this,W);r(this,G);this.urlValue="",n(this,f,!1),n(this,v,new m.CSSProperty(this,"--history",!1)),n(this,w,new m.CSSProperty(this,"--restore",!1)),n(this,x,new m.CSSProperty(this,"--close-rest",!1)),n(this,A,new m.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new m.CSSProperty(this,"--group","")),n(this,R,new m.CSSProperty(this,"--click-outside",!1)),n(this,q,new m.CSSProperty(this,"--escape",!1)),n(this,L,new m.CSSProperty(this,"--check-viewport-bounds",!1)),n(this,T,!1),n(this,a,new he.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),n(this,V,()=>{n(this,T,!1),e(this,f)&&e(this,v).current&&!location.search.includes(this.id)?this.close():!e(this,f)&&e(this,v).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,T,!0)}),n(this,S,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,W).call(this)}),n(this,W,ce.debounce(()=>{e(this,G).call(this)},10)),n(this,G,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,L).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>F.viewport.width?s=F.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>F.viewport.height?i=F.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),e(this,g).subscribe(t=>{t.previous&&(E.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=E.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get history(){return e(this,v)}get restore(){return e(this,w)}get closeRest(){return e(this,x)}get closeRestInGroup(){return e(this,A)}get group(){return e(this,g)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,f)}get lastTrigger(){return e(this,O)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,f)&&ie.updateSearchParameter(this.id,t)}open(t){if(e(this,f))return;n(this,O,t==null?void 0:t.trigger),clearTimeout(e(this,$)),clearTimeout(e(this,M)),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),Y.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,O)}}),e(this,v).current&&e(this,T)&&history.pushState(history.state,"",e(this,P,oe)),n(this,f,!0);const s=()=>{E.stack.add(e(this,g).current,this),e(this,S).call(this),e(this,a).set("opened",!0),Y.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,O)}}),n(this,C,void 0),n(this,B,setTimeout(()=>{e(this,a).set("transitionend",!0)},se.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():n(this,C,setTimeout(s,10))}close(){e(this,f)&&(clearTimeout(e(this,C)),clearTimeout(e(this,B)),E.stack.remove(e(this,g).current,this),n(this,f,!1),y(this,P,I).call(this),e(this,a).set("transitionend",!1),n(this,$,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),Y.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,M,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),Y.dispatchEvent(this,"popoverClosed",{custom:!0})},se.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){e(this,v).observe(),e(this,w).observe(),e(this,x).observe(),e(this,A).observe(),e(this,g).observe(),e(this,R).observe(),e(this,q).observe(),e(this,L).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,V)),setTimeout(()=>{e(this,w).current?(this.urlValue=ie.parseSearchParameters(location.search)[this.id],e(this,V).call(this)):(y(this,P,I).call(this),n(this,T,!0))},0),e(this,L).subscribe(()=>{e(this,S).call(this)}),re.windowResizer.subscribe(e(this,S))}disconnectedCallback(){E.stack.remove(e(this,g).current,this),re.windowResizer.unsubscribe(e(this,S)),e(this,a).close(),e(this,v).close(),e(this,w).close(),e(this,x).close(),e(this,A).close(),e(this,g).close(),e(this,R).close(),e(this,q).close(),e(this,L).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,M)),clearTimeout(e(this,C)),clearTimeout(e(this,B)),removeEventListener("popstate",e(this,V)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),y(this,P,I).call(this)}};f=new WeakMap,$=new WeakMap,M=new WeakMap,C=new WeakMap,B=new WeakMap,v=new WeakMap,w=new WeakMap,x=new WeakMap,A=new WeakMap,g=new WeakMap,R=new WeakMap,q=new WeakMap,L=new WeakMap,T=new WeakMap,O=new WeakMap,a=new WeakMap,P=new WeakSet,oe=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},I=function(){if(e(this,v).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},V=new WeakMap,S=new WeakMap,W=new WeakMap,G=new WeakMap,E.stack=new le;let z=E;_.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,d,k,Z,D,U,j,X,N;class ne extends HTMLElement{constructor(){super();r(this,k);r(this,h);r(this,d,new m.CSSProperty(this,"--type","open"));r(this,D,()=>{e(this,d).current!=="close"&&this.classList.add("triggered")});r(this,U,()=>{e(this,d).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,j,()=>{e(this,d).current!=="close"&&this.classList.remove("opened")});r(this,X,()=>{e(this,d).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});_.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,d).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,d)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(y(this,k,Z).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const p=this.getRootNode();p instanceof ShadowRoot?i=p.host.closest("[data-popover]"):p instanceof HTMLElement&&(i=p.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=p=>{if(!p)return null;let H=p.querySelector("[data-popover]");return!H&&(p!=null&&p.parentElement)&&(H=l(p.parentElement)),H};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(n(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,D)),e(this,h).addEventListener("popoverOpened",e(this,U)),e(this,h).addEventListener("popoverClosing",e(this,j)),e(this,h).addEventListener("popoverClosed",e(this,X))):console.warn(this,`target ${t} not found`)}y(this,k,N).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{y(this,k,N).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,d).observe()}disconnectedCallback(){e(this,d).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),y(this,k,Z).call(this)}}h=new WeakMap,d=new WeakMap,k=new WeakSet,Z=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,D)),e(this,h).removeEventListener("popoverOpened",e(this,U)),e(this,h).removeEventListener("popoverClosing",e(this,j)),e(this,h).removeEventListener("popoverClosed",e(this,X)))},D=new WeakMap,U=new WeakMap,j=new WeakMap,X=new WeakMap,N=function(t){e(this,h)instanceof z&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};_.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ne);exports.PopoverButtonElement=ne;exports.PopoverElement=z;
|