aptechka 0.51.10 → 0.51.11
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.d.ts +1 -0
- package/lib/accordion/index.js +36 -34
- package/package.json +1 -1
package/lib/accordion/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var I=s=>{throw TypeError(s)};var p=(s,i,t)=>i.has(s)||I("Cannot "+t);var e=(s,i,t)=>(p(s,i,"read from private field"),t?t.call(s):i.get(s)),
|
|
1
|
+
"use strict";var I=s=>{throw TypeError(s)};var p=(s,i,t)=>i.has(s)||I("Cannot "+t);var e=(s,i,t)=>(p(s,i,"read from private field"),t?t.call(s):i.get(s)),l=(s,i,t)=>i.has(s)?I("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),m=(s,i,t)=>(p(s,i,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("../attribute/index.cjs"),q=require("../index-Cqw2NKev.cjs"),C=require("../events-KVanG9sR.cjs"),H=require("../style-At6aDoqG.cjs");var d,h,f,n,E,u,o,x,A,y,b,M;class S{constructor(i,t){l(this,o);l(this,d,null);l(this,h,null);l(this,f,null);l(this,n,null);l(this,E);l(this,u,!1);l(this,A,()=>{e(this,u)?this.close():this.open()});l(this,y,()=>{e(this,u)&&(m(this,o,b).call(this,0,!0),m(this,o,b).call(this,e(this,o,x)))});t.firstElementChild instanceof HTMLElement&&t.lastElementChild instanceof HTMLElement?(c(this,d,i),c(this,h,t),c(this,f,t.firstElementChild),c(this,n,t.lastElementChild),e(this,n).style.overflow="hidden",e(this,d).axisAttribute.current==="y"?e(this,n).style.height="0px":e(this,n).style.width="0px",addEventListener("resize",e(this,y)),e(this,f).addEventListener("click",e(this,A)),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="",m(this,o,b).call(this,void 0),removeEventListener("resize",e(this,y)),e(this,f).removeEventListener("click",e(this,A)),clearTimeout(e(this,E)))}open(i){i!=null&&i.skipTransition&&m(this,o,M).call(this),e(this,d).multipleAttribute.current||e(this,d).closeAll({exclude:e(this,h)}),c(this,u,!0),clearTimeout(e(this,E)),e(this,h).classList.add("triggered"),m(this,o,b).call(this,e(this,o,x)),setTimeout(()=>{e(this,h).classList.add("opened"),e(this,h).setAttribute("data-opened",""),c(this,E,setTimeout(()=>{window.dispatchEvent(new Event("resize"))},H.getElementTransitionDurationMS(e(this,n))))},0),C.dispatchEvent(this.element,"accordionItemToggle",{bubbles:!0,composed:!0,detail:{opened:e(this,u),element:e(this,h)}})}close(i){i!=null&&i.skipTransition&&m(this,o,M).call(this),clearTimeout(e(this,E)),c(this,u,!1),e(this,h).classList.remove("opened"),m(this,o,b).call(this,0),c(this,E,setTimeout(()=>{e(this,h).classList.remove("triggered"),window.dispatchEvent(new Event("resize"))},H.getElementTransitionDurationMS(e(this,n)))),C.dispatchEvent(this.element,"accordionItemToggle",{bubbles:!0,composed:!0,detail:{opened:e(this,u),element:e(this,h)}})}}d=new WeakMap,h=new WeakMap,f=new WeakMap,n=new WeakMap,E=new WeakMap,u=new WeakMap,o=new WeakSet,x=function(){return e(this,d).axisAttribute.current==="x"?e(this,n).scrollWidth:e(this,n).scrollHeight},A=new WeakMap,y=new WeakMap,b=function(i,t=!1){t&&(e(this,n).style.transition="all 0s",setTimeout(()=>{e(this,n).style.transition=""}));const r=e(this,d).axisAttribute.current==="x"?"width":"height";i!=null?e(this,n).style[r]=`${i}px`:e(this,n).style[r]=""},M=function(){e(this,n).style.transition="all 0s",setTimeout(()=>{e(this,n).style.transition=""},50)};var v,T,a,g,L,k;class O extends HTMLElement{constructor(){super();l(this,L);l(this,v,new z.Attribute(this,"axis","y"));l(this,T,new z.Attribute(this,"multiple",!1));l(this,a,[]);l(this,g,null);q.isBrowser&&c(this,g,new MutationObserver(t=>{t.forEach(r=>{r.removedNodes.forEach(w=>{w instanceof HTMLElement&&this.removeItem(w)}),r.addedNodes.forEach(w=>{w instanceof HTMLElement&&this.createItem(w)})})}))}get axisAttribute(){return e(this,v)}get multipleAttribute(){return e(this,T)}createItem(t){e(this,a).find(r=>r.element===t)||e(this,a).push(new S(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,v).observe(),e(this,T).observe(),e(this,g).observe(e(this,L,k),{childList:!0}),c(this,a,[...e(this,L,k).children].map(t=>{if(t instanceof HTMLElement)return new S(this,t)}).filter(t=>!!t))}disconnectedCallback(){e(this,v).unobserve(),e(this,T).unobserve(),e(this,g).disconnect()}}v=new WeakMap,T=new WeakMap,a=new WeakMap,g=new WeakMap,L=new WeakSet,k=function(){return this.shadowRoot?this.shadowRoot:this};q.isBrowser&&!customElements.get("e-accordion")&&customElements.define("e-accordion",O);exports.AccordionElement=O;
|
package/lib/accordion/index.d.ts
CHANGED
package/lib/accordion/index.js
CHANGED
|
@@ -2,82 +2,84 @@ var M = (s) => {
|
|
|
2
2
|
throw TypeError(s);
|
|
3
3
|
};
|
|
4
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)),
|
|
5
|
+
var e = (s, i, t) => (x(s, i, "read from private field"), t ? t.call(s) : i.get(s)), n = (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), m = (s, i, t) => (x(s, i, "access private method"), t);
|
|
6
6
|
import { Attribute as z } from "../attribute/index.js";
|
|
7
7
|
import { i as R } from "../index-euf5anj6.js";
|
|
8
8
|
import { d as C } from "../events-CsVF98U6.js";
|
|
9
9
|
import { g as H } from "../style-j2TwriJ_.js";
|
|
10
|
-
var d,
|
|
10
|
+
var d, h, f, l, E, u, o, y, w, L, v, k;
|
|
11
11
|
class S {
|
|
12
12
|
constructor(i, t) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
n(this, o);
|
|
14
|
+
n(this, d, null);
|
|
15
|
+
n(this, h, null);
|
|
16
|
+
n(this, f, null);
|
|
17
|
+
n(this, l, null);
|
|
18
|
+
n(this, E);
|
|
19
|
+
n(this, u, !1);
|
|
20
|
+
n(this, w, () => {
|
|
21
21
|
e(this, u) ? this.close() : this.open();
|
|
22
22
|
});
|
|
23
|
-
|
|
23
|
+
n(this, L, () => {
|
|
24
24
|
e(this, u) && (m(this, o, v).call(this, 0, !0), m(this, o, v).call(this, e(this, o, y)));
|
|
25
25
|
});
|
|
26
|
-
t.firstElementChild instanceof HTMLElement && t.lastElementChild instanceof HTMLElement ? (a(this, d, i), a(this,
|
|
26
|
+
t.firstElementChild instanceof HTMLElement && t.lastElementChild instanceof HTMLElement ? (a(this, d, i), a(this, h, t), a(this, f, t.firstElementChild), a(this, l, t.lastElementChild), e(this, l).style.overflow = "hidden", e(this, d).axisAttribute.current === "y" ? e(this, l).style.height = "0px" : e(this, l).style.width = "0px", addEventListener("resize", e(this, L)), e(this, f).addEventListener("click", e(this, w)), e(this, h).hasAttribute("data-opened") && this.open({ skipTransition: !0 })) : i.removeItem(e(this, h));
|
|
27
27
|
}
|
|
28
28
|
get element() {
|
|
29
|
-
return e(this,
|
|
29
|
+
return e(this, h);
|
|
30
30
|
}
|
|
31
31
|
destroy() {
|
|
32
|
-
e(this, f) && (e(this,
|
|
32
|
+
e(this, f) && (e(this, h).classList.remove("opened", "triggered"), e(this, h).removeAttribute("data-opened"), e(this, f).style.cursor = "", m(this, o, v).call(this, void 0), removeEventListener("resize", e(this, L)), e(this, f).removeEventListener("click", e(this, w)), clearTimeout(e(this, E)));
|
|
33
33
|
}
|
|
34
34
|
open(i) {
|
|
35
|
-
i != null && i.skipTransition && m(this, o, k).call(this), e(this, d).multipleAttribute.current || e(this, d).closeAll({ exclude: e(this,
|
|
36
|
-
e(this,
|
|
35
|
+
i != null && i.skipTransition && m(this, o, k).call(this), e(this, d).multipleAttribute.current || e(this, d).closeAll({ exclude: e(this, h) }), a(this, u, !0), clearTimeout(e(this, E)), e(this, h).classList.add("triggered"), m(this, o, v).call(this, e(this, o, y)), setTimeout(() => {
|
|
36
|
+
e(this, h).classList.add("opened"), e(this, h).setAttribute("data-opened", ""), a(this, E, setTimeout(() => {
|
|
37
37
|
window.dispatchEvent(new Event("resize"));
|
|
38
|
-
}, H(e(this,
|
|
38
|
+
}, H(e(this, l))));
|
|
39
39
|
}, 0), C(this.element, "accordionItemToggle", {
|
|
40
40
|
bubbles: !0,
|
|
41
41
|
composed: !0,
|
|
42
42
|
detail: {
|
|
43
|
-
opened: e(this, u)
|
|
43
|
+
opened: e(this, u),
|
|
44
|
+
element: e(this, h)
|
|
44
45
|
}
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
close(i) {
|
|
48
|
-
i != null && i.skipTransition && m(this, o, k).call(this), clearTimeout(e(this, E)), a(this, u, !1), e(this,
|
|
49
|
-
e(this,
|
|
50
|
-
}, H(e(this,
|
|
49
|
+
i != null && i.skipTransition && m(this, o, k).call(this), clearTimeout(e(this, E)), a(this, u, !1), e(this, h).classList.remove("opened"), m(this, o, v).call(this, 0), a(this, E, setTimeout(() => {
|
|
50
|
+
e(this, h).classList.remove("triggered"), window.dispatchEvent(new Event("resize"));
|
|
51
|
+
}, H(e(this, l)))), C(this.element, "accordionItemToggle", {
|
|
51
52
|
bubbles: !0,
|
|
52
53
|
composed: !0,
|
|
53
54
|
detail: {
|
|
54
|
-
opened: e(this, u)
|
|
55
|
+
opened: e(this, u),
|
|
56
|
+
element: e(this, h)
|
|
55
57
|
}
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
|
-
d = new WeakMap(),
|
|
60
|
-
return e(this, d).axisAttribute.current === "x" ? e(this,
|
|
61
|
+
d = new WeakMap(), h = new WeakMap(), f = new WeakMap(), l = new WeakMap(), E = new WeakMap(), u = new WeakMap(), o = new WeakSet(), y = function() {
|
|
62
|
+
return e(this, d).axisAttribute.current === "x" ? e(this, l).scrollWidth : e(this, l).scrollHeight;
|
|
61
63
|
}, w = new WeakMap(), L = new WeakMap(), v = function(i, t = !1) {
|
|
62
|
-
t && (e(this,
|
|
63
|
-
e(this,
|
|
64
|
+
t && (e(this, l).style.transition = "all 0s", setTimeout(() => {
|
|
65
|
+
e(this, l).style.transition = "";
|
|
64
66
|
}));
|
|
65
67
|
const r = e(this, d).axisAttribute.current === "x" ? "width" : "height";
|
|
66
|
-
i != null ? e(this,
|
|
68
|
+
i != null ? e(this, l).style[r] = `${i}px` : e(this, l).style[r] = "";
|
|
67
69
|
}, k = function() {
|
|
68
|
-
e(this,
|
|
69
|
-
e(this,
|
|
70
|
+
e(this, l).style.transition = "all 0s", setTimeout(() => {
|
|
71
|
+
e(this, l).style.transition = "";
|
|
70
72
|
}, 50);
|
|
71
73
|
};
|
|
72
74
|
var b, T, c, g, A, I;
|
|
73
75
|
class N extends HTMLElement {
|
|
74
76
|
constructor() {
|
|
75
77
|
super();
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
n(this, A);
|
|
79
|
+
n(this, b, new z(this, "axis", "y"));
|
|
80
|
+
n(this, T, new z(this, "multiple", !1));
|
|
81
|
+
n(this, c, []);
|
|
82
|
+
n(this, g, null);
|
|
81
83
|
R && a(this, g, new MutationObserver((t) => {
|
|
82
84
|
t.forEach((r) => {
|
|
83
85
|
r.removedNodes.forEach((p) => {
|