aptechka 0.51.4 → 0.51.5
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 +103 -89
- package/package.json +1 -1
package/lib/billboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var F=s=>{throw TypeError(s)};var _=(s,r,t)=>r.has(s)||F("Cannot "+t);var e=(s,r,t)=>(_(s,r,"read from private field"),t?t.call(s):r.get(s)),i=(s,r,t)=>r.has(s)?F("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(s):r.set(s,t),a=(s,r,t,n)=>(_(s,r,"write to private field"),n?n.call(s,t):r.set(s,t),t),d=(s,r,t)=>(_(s,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../index-Cqw2NKev.cjs"),z=require("../dom-JBOkFLTh.cjs"),T=require("../css-property/index.cjs"),J=require("../events-KVanG9sR.cjs"),K=require("../gestures-C7gbKx11.cjs"),Q=require("../number-0243DApo.cjs");var v,L,p,C,o,b,l,j,M,w,q,P,A,H;class I extends HTMLElement{constructor(){super(...arguments);i(this,l);i(this,v,new T.CSSProperty(this,"--autoplay",!1));i(this,L,new T.CSSProperty(this,"--swipe","x"));i(this,p);i(this,C,!1);i(this,o,[]);i(this,b,0);i(this,w,t=>{a(this,C,t.isIntersecting),e(this,C)?d(this,l,M).call(this):clearInterval(e(this,p))});i(this,q,()=>{clearInterval(e(this,p)),e(this,C)&&a(this,p,setInterval(e(this,A),parseFloat(e(this,v).current||"0")*1e3))});i(this,A,()=>{d(this,l,P).call(this,e(this,b)+1)});i(this,H,t=>{let n=0;K.setupDrag(h=>{const f=t.x-h.x,D=t.y-h.y;e(this,L).current==="x"?Math.abs(f)>Math.abs(D)&&(n=Math.sign(f)):e(this,L).current==="y"&&Math.abs(D)>Math.abs(f)&&(n=Math.sign(D))},()=>{this.shift(n)})})}get counter(){return e(this,b)}get itemElements(){return e(this,o)}addItem(t){e(this,o).push(t),d(this,l,j).call(this)}set(t){d(this,l,P).call(this,t),d(this,l,M).call(this)}shift(t){this.set(e(this,b)+t)}connectedCallback(){var t;a(this,o,[...this.querySelectorAll("[data-billboard-item]")]),(t=e(this,o)[0])==null||t.classList.add("current"),d(this,l,j).call(this),e(this,v).subscribe(n=>{n.current?(x.intersector.subscribe(this,e(this,w)),d(this,l,M).call(this)):(a(this,C,!0),x.intersector.unsubscribe(e(this,w)),clearInterval(e(this,p)),d(this,l,P).call(this,0))}),e(this,v).observe(),e(this,L).observe(),this.addEventListener("pointerdown",e(this,H))}disconnectedCallback(){e(this,v).unobserve(),e(this,L).unobserve(),x.intersector.unsubscribe(e(this,w)),clearInterval(e(this,p))}}v=new WeakMap,L=new WeakMap,p=new WeakMap,C=new WeakMap,o=new WeakMap,b=new WeakMap,l=new WeakSet,j=function(){e(this,o).length>1?this.classList.add("has-length"):this.classList.remove("has-length")},M=function(){e(this,v).current!==!1&&e(this,q).call(this)},w=new WeakMap,q=new WeakMap,P=function(t){a(this,b,Q.loopNumber(t,e(this,o).length)),e(this,o).forEach((n,h)=>{h===e(this,b)?n.classList.add("current"):n.classList.remove("current")}),J.dispatchEvent(this,"billboardChange",{detail:{counter:e(this,b)}}),setTimeout(()=>{window.dispatchEvent(new Event("resize"))},0)},A=new WeakMap,H=new WeakMap;customElements.get("e-billboard")||customElements.define("e-billboard",I);var c,u,k,B;class N extends HTMLElement{constructor(){super(...arguments);i(this,c,null);i(this,u,[]);i(this,k,t=>{const n=t.currentTarget,h=e(this,u).findIndex(f=>f===n);h>=0&&e(this,c).set(h)});i(this,B,()=>{e(this,u).forEach((t,n)=>{n===e(this,c).counter?t.classList.add("current"):t.classList.remove("current")})})}connectedCallback(){a(this,c,z.findParentElement(this,I)),e(this,c)&&customElements.whenDefined("e-billboard").then(()=>{var t;if(this.isConnected){const n=e(this,c).itemElements.length;for(let h=0;h<n;h++){const f=document.createElement("button");e(this,u).push(f),this.appendChild(f)}e(this,u).forEach(h=>{h.addEventListener("click",e(this,k))}),(t=e(this,c))==null||t.addEventListener("billboardChange",e(this,B)),e(this,B).call(this)}})}disconnectedCallback(){var t;e(this,u).forEach(n=>{n.removeEventListener("click",e(this,k))}),(t=e(this,c))==null||t.removeEventListener("billboardChange",e(this,B)),this.innerHTML="",a(this,u,[])}}c=new WeakMap,u=new WeakMap,k=new WeakMap,B=new WeakMap;x.isBrowser&&!customElements.get("e-billboard-bullets")&&customElements.define("e-billboard-bullets",N);var m,E,g;class O extends HTMLElement{constructor(){super();i(this,m,new T.CSSProperty(this,"--index",0));i(this,E,null);i(this,g,()=>{var t;e(this,m).current===((t=e(this,E))==null?void 0:t.counter)?this.classList.add("current"):this.classList.remove("current")});this.addEventListener("click",()=>{e(this,E)&&e(this,E).set(e(this,m).current)})}connectedCallback(){var t;this.tabIndex=0,a(this,E,z.findParentElement(this,I)),(t=e(this,E))==null||t.addEventListener("billboardChange",e(this,g)),customElements.whenDefined("e-billboard").then(()=>{this.isConnected&&e(this,g).call(this)}),e(this,m).subscribe(e(this,g)),e(this,m).observe()}disconnectedCallback(){var t;this.removeAttribute("tabindex"),e(this,m).unsubscribe(e(this,g)),e(this,m).unobserve(),(t=e(this,E))==null||t.removeEventListener("billboardChange",e(this,g))}}m=new WeakMap,E=new WeakMap,g=new WeakMap;x.isBrowser&&!customElements.get("e-billboard-set-button")&&customElements.define("e-billboard-set-button",O);var y,S;class G extends HTMLElement{constructor(){super();i(this,y,new T.CSSProperty(this,"--step",1));i(this,S,null);this.addEventListener("click",()=>{e(this,S)&&e(this,S).shift(e(this,y).current)})}connectedCallback(){this.tabIndex=0,a(this,S,z.findParentElement(this,I)),e(this,y).observe()}disconnectedCallback(){this.removeAttribute("tabindex"),e(this,y).unobserve()}}y=new WeakMap,S=new WeakMap;x.isBrowser&&!customElements.get("e-billboard-step-button")&&customElements.define("e-billboard-step-button",G);exports.BillboardBulletsElement=N;exports.BillboardElement=I;exports.BillboardSetButtonElement=O;exports.BillboardStepButtonElement=G;
|
package/lib/billboard/index.js
CHANGED
|
@@ -1,132 +1,146 @@
|
|
|
1
|
-
var
|
|
1
|
+
var G = (s) => {
|
|
2
2
|
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var t = (s,
|
|
6
|
-
import { a as
|
|
7
|
-
import { b as
|
|
8
|
-
import { CSSProperty as
|
|
9
|
-
import { d as
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
var q = (s, r, e) => r.has(s) || G("Cannot " + e);
|
|
5
|
+
var t = (s, r, e) => (q(s, r, "read from private field"), e ? e.call(s) : r.get(s)), i = (s, r, e) => r.has(s) ? G("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(s) : r.set(s, e), a = (s, r, e, n) => (q(s, r, "write to private field"), n ? n.call(s, e) : r.set(s, e), e), d = (s, r, e) => (q(s, r, "access private method"), e);
|
|
6
|
+
import { a as z, i as N } from "../index-euf5anj6.js";
|
|
7
|
+
import { b as j } from "../dom-CVWzyXPH.js";
|
|
8
|
+
import { CSSProperty as T } from "../css-property/index.js";
|
|
9
|
+
import { d as J } from "../events-CsVF98U6.js";
|
|
10
|
+
import { s as K } from "../gestures-CcXV6fCp.js";
|
|
11
|
+
import { l as O } from "../number-DwCxt_Ck.js";
|
|
12
|
+
var v, g, p, x, o, b, l, F, y, C, S, B, A, H;
|
|
13
|
+
class D extends HTMLElement {
|
|
13
14
|
constructor() {
|
|
14
15
|
super(...arguments);
|
|
15
|
-
i(this,
|
|
16
|
-
i(this,
|
|
17
|
-
i(this,
|
|
18
|
-
i(this,
|
|
19
|
-
i(this,
|
|
16
|
+
i(this, l);
|
|
17
|
+
i(this, v, new T(this, "--autoplay", !1));
|
|
18
|
+
i(this, g, new T(this, "--swipe", "x"));
|
|
19
|
+
i(this, p);
|
|
20
|
+
i(this, x, !1);
|
|
21
|
+
i(this, o, []);
|
|
20
22
|
i(this, b, 0);
|
|
21
|
-
i(this,
|
|
22
|
-
|
|
23
|
+
i(this, C, (e) => {
|
|
24
|
+
a(this, x, e.isIntersecting), t(this, x) ? d(this, l, y).call(this) : clearInterval(t(this, p));
|
|
23
25
|
});
|
|
24
|
-
i(this,
|
|
25
|
-
clearInterval(t(this,
|
|
26
|
-
t(this,
|
|
27
|
-
parseFloat(t(this,
|
|
26
|
+
i(this, S, () => {
|
|
27
|
+
clearInterval(t(this, p)), t(this, x) && a(this, p, setInterval(
|
|
28
|
+
t(this, A),
|
|
29
|
+
parseFloat(t(this, v).current || "0") * 1e3
|
|
28
30
|
));
|
|
29
31
|
});
|
|
30
|
-
i(this,
|
|
31
|
-
d(this,
|
|
32
|
+
i(this, A, () => {
|
|
33
|
+
d(this, l, B).call(this, t(this, b) + 1);
|
|
34
|
+
});
|
|
35
|
+
i(this, H, (e) => {
|
|
36
|
+
let n = 0;
|
|
37
|
+
K(
|
|
38
|
+
(h) => {
|
|
39
|
+
const E = e.x - h.x, P = e.y - h.y;
|
|
40
|
+
t(this, g).current === "x" ? Math.abs(E) > Math.abs(P) && (n = Math.sign(E)) : t(this, g).current === "y" && Math.abs(P) > Math.abs(E) && (n = Math.sign(P));
|
|
41
|
+
},
|
|
42
|
+
() => {
|
|
43
|
+
this.shift(n);
|
|
44
|
+
}
|
|
45
|
+
);
|
|
32
46
|
});
|
|
33
47
|
}
|
|
34
48
|
get counter() {
|
|
35
49
|
return t(this, b);
|
|
36
50
|
}
|
|
37
51
|
get itemElements() {
|
|
38
|
-
return t(this,
|
|
52
|
+
return t(this, o);
|
|
39
53
|
}
|
|
40
54
|
addItem(e) {
|
|
41
|
-
t(this,
|
|
55
|
+
t(this, o).push(e), d(this, l, F).call(this);
|
|
42
56
|
}
|
|
43
57
|
set(e) {
|
|
44
|
-
d(this,
|
|
58
|
+
d(this, l, B).call(this, e), d(this, l, y).call(this);
|
|
45
59
|
}
|
|
46
60
|
shift(e) {
|
|
47
61
|
this.set(t(this, b) + e);
|
|
48
62
|
}
|
|
49
63
|
connectedCallback() {
|
|
50
64
|
var e;
|
|
51
|
-
|
|
65
|
+
a(this, o, [
|
|
52
66
|
...this.querySelectorAll("[data-billboard-item]")
|
|
53
|
-
]), (e = t(this,
|
|
54
|
-
|
|
55
|
-
}), t(this,
|
|
67
|
+
]), (e = t(this, o)[0]) == null || e.classList.add("current"), d(this, l, F).call(this), t(this, v).subscribe((n) => {
|
|
68
|
+
n.current ? (z.subscribe(this, t(this, C)), d(this, l, y).call(this)) : (a(this, x, !0), z.unsubscribe(t(this, C)), clearInterval(t(this, p)), d(this, l, B).call(this, 0));
|
|
69
|
+
}), t(this, v).observe(), t(this, g).observe(), this.addEventListener("pointerdown", t(this, H));
|
|
56
70
|
}
|
|
57
71
|
disconnectedCallback() {
|
|
58
|
-
t(this,
|
|
72
|
+
t(this, v).unobserve(), t(this, g).unobserve(), z.unsubscribe(t(this, C)), clearInterval(t(this, p));
|
|
59
73
|
}
|
|
60
74
|
}
|
|
61
|
-
|
|
62
|
-
t(this,
|
|
63
|
-
},
|
|
64
|
-
t(this,
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}),
|
|
75
|
+
v = new WeakMap(), g = new WeakMap(), p = new WeakMap(), x = new WeakMap(), o = new WeakMap(), b = new WeakMap(), l = new WeakSet(), F = function() {
|
|
76
|
+
t(this, o).length > 1 ? this.classList.add("has-length") : this.classList.remove("has-length");
|
|
77
|
+
}, y = function() {
|
|
78
|
+
t(this, v).current !== !1 && t(this, S).call(this);
|
|
79
|
+
}, C = new WeakMap(), S = new WeakMap(), B = function(e) {
|
|
80
|
+
a(this, b, O(e, t(this, o).length)), t(this, o).forEach((n, h) => {
|
|
81
|
+
h === t(this, b) ? n.classList.add("current") : n.classList.remove("current");
|
|
82
|
+
}), J(this, "billboardChange", {
|
|
69
83
|
detail: {
|
|
70
84
|
counter: t(this, b)
|
|
71
85
|
}
|
|
72
86
|
}), setTimeout(() => {
|
|
73
87
|
window.dispatchEvent(new Event("resize"));
|
|
74
88
|
}, 0);
|
|
75
|
-
},
|
|
76
|
-
customElements.get("e-billboard") || customElements.define("e-billboard",
|
|
77
|
-
var c, u,
|
|
78
|
-
class
|
|
89
|
+
}, A = new WeakMap(), H = new WeakMap();
|
|
90
|
+
customElements.get("e-billboard") || customElements.define("e-billboard", D);
|
|
91
|
+
var c, u, M, k;
|
|
92
|
+
class Q extends HTMLElement {
|
|
79
93
|
constructor() {
|
|
80
94
|
super(...arguments);
|
|
81
95
|
i(this, c, null);
|
|
82
96
|
i(this, u, []);
|
|
83
|
-
i(this,
|
|
84
|
-
const
|
|
85
|
-
|
|
97
|
+
i(this, M, (e) => {
|
|
98
|
+
const n = e.currentTarget, h = t(this, u).findIndex((E) => E === n);
|
|
99
|
+
h >= 0 && t(this, c).set(h);
|
|
86
100
|
});
|
|
87
|
-
i(this,
|
|
88
|
-
t(this, u).forEach((e,
|
|
89
|
-
|
|
101
|
+
i(this, k, () => {
|
|
102
|
+
t(this, u).forEach((e, n) => {
|
|
103
|
+
n === t(this, c).counter ? e.classList.add("current") : e.classList.remove("current");
|
|
90
104
|
});
|
|
91
105
|
});
|
|
92
106
|
}
|
|
93
107
|
connectedCallback() {
|
|
94
|
-
|
|
108
|
+
a(this, c, j(this, D)), t(this, c) && customElements.whenDefined("e-billboard").then(() => {
|
|
95
109
|
var e;
|
|
96
110
|
if (this.isConnected) {
|
|
97
|
-
const
|
|
98
|
-
for (let
|
|
99
|
-
const
|
|
100
|
-
t(this, u).push(
|
|
111
|
+
const n = t(this, c).itemElements.length;
|
|
112
|
+
for (let h = 0; h < n; h++) {
|
|
113
|
+
const E = document.createElement("button");
|
|
114
|
+
t(this, u).push(E), this.appendChild(E);
|
|
101
115
|
}
|
|
102
|
-
t(this, u).forEach((
|
|
103
|
-
|
|
116
|
+
t(this, u).forEach((h) => {
|
|
117
|
+
h.addEventListener("click", t(this, M));
|
|
104
118
|
}), (e = t(this, c)) == null || e.addEventListener(
|
|
105
119
|
"billboardChange",
|
|
106
|
-
t(this,
|
|
107
|
-
), t(this,
|
|
120
|
+
t(this, k)
|
|
121
|
+
), t(this, k).call(this);
|
|
108
122
|
}
|
|
109
123
|
});
|
|
110
124
|
}
|
|
111
125
|
disconnectedCallback() {
|
|
112
126
|
var e;
|
|
113
|
-
t(this, u).forEach((
|
|
114
|
-
|
|
127
|
+
t(this, u).forEach((n) => {
|
|
128
|
+
n.removeEventListener("click", t(this, M));
|
|
115
129
|
}), (e = t(this, c)) == null || e.removeEventListener(
|
|
116
130
|
"billboardChange",
|
|
117
|
-
t(this,
|
|
118
|
-
), this.innerHTML = "",
|
|
131
|
+
t(this, k)
|
|
132
|
+
), this.innerHTML = "", a(this, u, []);
|
|
119
133
|
}
|
|
120
134
|
}
|
|
121
|
-
c = new WeakMap(), u = new WeakMap(),
|
|
122
|
-
|
|
123
|
-
var m, f,
|
|
124
|
-
class
|
|
135
|
+
c = new WeakMap(), u = new WeakMap(), M = new WeakMap(), k = new WeakMap();
|
|
136
|
+
N && !customElements.get("e-billboard-bullets") && customElements.define("e-billboard-bullets", Q);
|
|
137
|
+
var m, f, L;
|
|
138
|
+
class R extends HTMLElement {
|
|
125
139
|
constructor() {
|
|
126
140
|
super();
|
|
127
|
-
i(this, m, new
|
|
141
|
+
i(this, m, new T(this, "--index", 0));
|
|
128
142
|
i(this, f, null);
|
|
129
|
-
i(this,
|
|
143
|
+
i(this, L, () => {
|
|
130
144
|
var e;
|
|
131
145
|
t(this, m).current === ((e = t(this, f)) == null ? void 0 : e.counter) ? this.classList.add("current") : this.classList.remove("current");
|
|
132
146
|
});
|
|
@@ -136,45 +150,45 @@ class J extends HTMLElement {
|
|
|
136
150
|
}
|
|
137
151
|
connectedCallback() {
|
|
138
152
|
var e;
|
|
139
|
-
this.tabIndex = 0,
|
|
153
|
+
this.tabIndex = 0, a(this, f, j(this, D)), (e = t(this, f)) == null || e.addEventListener(
|
|
140
154
|
"billboardChange",
|
|
141
|
-
t(this,
|
|
155
|
+
t(this, L)
|
|
142
156
|
), customElements.whenDefined("e-billboard").then(() => {
|
|
143
|
-
this.isConnected && t(this,
|
|
144
|
-
}), t(this, m).subscribe(t(this,
|
|
157
|
+
this.isConnected && t(this, L).call(this);
|
|
158
|
+
}), t(this, m).subscribe(t(this, L)), t(this, m).observe();
|
|
145
159
|
}
|
|
146
160
|
disconnectedCallback() {
|
|
147
161
|
var e;
|
|
148
|
-
this.removeAttribute("tabindex"), t(this, m).unsubscribe(t(this,
|
|
162
|
+
this.removeAttribute("tabindex"), t(this, m).unsubscribe(t(this, L)), t(this, m).unobserve(), (e = t(this, f)) == null || e.removeEventListener(
|
|
149
163
|
"billboardChange",
|
|
150
|
-
t(this,
|
|
164
|
+
t(this, L)
|
|
151
165
|
);
|
|
152
166
|
}
|
|
153
167
|
}
|
|
154
|
-
m = new WeakMap(), f = new WeakMap(),
|
|
155
|
-
|
|
156
|
-
var
|
|
157
|
-
class
|
|
168
|
+
m = new WeakMap(), f = new WeakMap(), L = new WeakMap();
|
|
169
|
+
N && !customElements.get("e-billboard-set-button") && customElements.define("e-billboard-set-button", R);
|
|
170
|
+
var w, I;
|
|
171
|
+
class U extends HTMLElement {
|
|
158
172
|
constructor() {
|
|
159
173
|
super();
|
|
160
|
-
i(this,
|
|
161
|
-
i(this,
|
|
174
|
+
i(this, w, new T(this, "--step", 1));
|
|
175
|
+
i(this, I, null);
|
|
162
176
|
this.addEventListener("click", () => {
|
|
163
|
-
t(this,
|
|
177
|
+
t(this, I) && t(this, I).shift(t(this, w).current);
|
|
164
178
|
});
|
|
165
179
|
}
|
|
166
180
|
connectedCallback() {
|
|
167
|
-
this.tabIndex = 0,
|
|
181
|
+
this.tabIndex = 0, a(this, I, j(this, D)), t(this, w).observe();
|
|
168
182
|
}
|
|
169
183
|
disconnectedCallback() {
|
|
170
|
-
this.removeAttribute("tabindex"), t(this,
|
|
184
|
+
this.removeAttribute("tabindex"), t(this, w).unobserve();
|
|
171
185
|
}
|
|
172
186
|
}
|
|
173
|
-
|
|
174
|
-
|
|
187
|
+
w = new WeakMap(), I = new WeakMap();
|
|
188
|
+
N && !customElements.get("e-billboard-step-button") && customElements.define("e-billboard-step-button", U);
|
|
175
189
|
export {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
190
|
+
Q as BillboardBulletsElement,
|
|
191
|
+
D as BillboardElement,
|
|
192
|
+
R as BillboardSetButtonElement,
|
|
193
|
+
U as BillboardStepButtonElement
|
|
180
194
|
};
|