aptechka 0.28.1 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/accordion/index.cjs +1 -0
- package/lib/accordion/index.d.ts +31 -0
- package/lib/accordion/index.js +135 -0
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +69 -70
- package/package.json +9 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var M=s=>{throw TypeError(s)};var p=(s,i,t)=>i.has(s)||M("Cannot "+t);var e=(s,i,t)=>(p(s,i,"read from private field"),t?t.call(s):i.get(s)),h=(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),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 C=require("../attribute/index.cjs"),q=require("../browser-CpzFX2xg.cjs"),H=require("../events-KVanG9sR.cjs"),R=require("../style-At6aDoqG.cjs");var d,n,f,l,E,u,o,N,w,L,A,b,k;class S{constructor(i,t){h(this,o);h(this,d,null);h(this,n,null);h(this,f,null);h(this,l,null);h(this,E);h(this,u,!1);h(this,L,()=>{e(this,u)?this.close():this.open()});h(this,A,()=>{e(this,u)&&(m(this,o,b).call(this,0,!0),m(this,o,b).call(this,e(this,o,w)))});t.firstElementChild instanceof HTMLElement&&t.lastElementChild instanceof HTMLElement?(c(this,d,i),c(this,n,t),c(this,f,t.firstElementChild),c(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,A)),e(this,f).addEventListener("click",e(this,L)),e(this,n).hasAttribute("data-opened")&&this.open({skipTransition:!0})):i.removeItem(e(this,n))}get element(){return e(this,n)}destroy(){e(this,f)&&(e(this,n).classList.remove("opened","triggered"),e(this,f).style.cursor="",m(this,o,b).call(this,void 0),removeEventListener("resize",e(this,A)),e(this,f).removeEventListener("click",e(this,L)),clearTimeout(e(this,E)))}open(i){i!=null&&i.skipTransition&&m(this,o,k).call(this),e(this,d).multipleAttribute.current||e(this,d).closeAll({exclude:e(this,n)}),c(this,u,!0),clearTimeout(e(this,E)),e(this,n).classList.add("triggered"),m(this,o,b).call(this,e(this,o,w)),setTimeout(()=>{e(this,n).classList.add("opened")},0),H.dispatchEvent(this.element,"accordionItemToggle",{bubbles:!0,composed:!0,detail:{opened:e(this,u)}})}close(i){i!=null&&i.skipTransition&&m(this,o,k).call(this),c(this,u,!1),e(this,n).classList.remove("opened"),m(this,o,b).call(this,0),c(this,E,setTimeout(()=>{e(this,n).classList.remove("triggered")},R.getElementTransitionDurationMS(e(this,l)))),H.dispatchEvent(this.element,"accordionItemToggle",{bubbles:!0,composed:!0,detail:{opened:e(this,u)}})}}d=new WeakMap,n=new WeakMap,f=new WeakMap,l=new WeakMap,E=new WeakMap,u=new WeakMap,o=new WeakSet,N=function(){return e(this,n).parentElement||e(this,n).getRootNode()},w=function(){return e(this,d).axisAttribute.current==="x"?e(this,l).scrollWidth:e(this,l).scrollHeight},L=new WeakMap,A=new WeakMap,b=function(i,t=!1){t&&(e(this,l).style.transition="all 0s",setTimeout(()=>{e(this,l).style.transition=""}));const r=e(this,d).axisAttribute.current==="x"?"width":"height";i!=null?e(this,l).style[r]=`${i}px`:e(this,l).style[r]=""},k=function(){e(this,l).style.transition="all 0s",setTimeout(()=>{e(this,l).style.transition=""},50)};var v,g,a,T,x,I;class z extends HTMLElement{constructor(){super();h(this,x);h(this,v,new C.Attribute(this,"axis","y"));h(this,g,new C.Attribute(this,"multiple",!1));h(this,a,[]);h(this,T,null);q.isBrowser&&c(this,T,new MutationObserver(t=>{t.forEach(r=>{r.removedNodes.forEach(y=>{y instanceof HTMLElement&&this.removeItem(y)}),r.addedNodes.forEach(y=>{y instanceof HTMLElement&&this.createItem(y)})})}))}get axisAttribute(){return e(this,v)}get multipleAttribute(){return e(this,g)}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,g).observe(),e(this,T).observe(e(this,x,I),{childList:!0}),c(this,a,[...e(this,x,I).children].map(t=>{if(t instanceof HTMLElement)return new S(this,t)}).filter(t=>!!t))}disconnectedCallback(){e(this,v).unobserve(),e(this,g).unobserve(),e(this,T).disconnect()}}v=new WeakMap,g=new WeakMap,a=new WeakMap,T=new WeakMap,x=new WeakSet,I=function(){return this.shadowRoot?this.shadowRoot:this};customElements.get("e-accordion")||customElements.define("e-accordion",z);exports.AccordionElement=z;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Attribute } from '../attribute';
|
|
2
|
+
import { Axes2D } from '../utils';
|
|
3
|
+
|
|
4
|
+
export interface AccordionToggleOptions {
|
|
5
|
+
skipTransition?: boolean;
|
|
6
|
+
exclude?: HTMLElement;
|
|
7
|
+
}
|
|
8
|
+
export interface AccordionEvents {
|
|
9
|
+
accordionItemToggle: CustomEvent<{
|
|
10
|
+
opened: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
export declare class AccordionElement extends HTMLElement {
|
|
14
|
+
#private;
|
|
15
|
+
constructor();
|
|
16
|
+
get axisAttribute(): Attribute<Axes2D>;
|
|
17
|
+
get multipleAttribute(): Attribute<false>;
|
|
18
|
+
createItem(element: HTMLElement): void;
|
|
19
|
+
removeItem(element: HTMLElement): void;
|
|
20
|
+
closeAll(options?: AccordionToggleOptions): void;
|
|
21
|
+
openAll(options?: AccordionToggleOptions): void;
|
|
22
|
+
protected connectedCallback(): void;
|
|
23
|
+
protected disconnectedCallback(): void;
|
|
24
|
+
}
|
|
25
|
+
declare global {
|
|
26
|
+
interface HTMLElementTagNameMap {
|
|
27
|
+
'e-accordion': AccordionElement;
|
|
28
|
+
}
|
|
29
|
+
interface HTMLElementEventMap extends AccordionEvents {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
var M = (s) => {
|
|
2
|
+
throw TypeError(s);
|
|
3
|
+
};
|
|
4
|
+
var A = (s, i, t) => i.has(s) || M("Cannot " + t);
|
|
5
|
+
var e = (s, i, t) => (A(s, i, "read from private field"), t ? t.call(s) : i.get(s)), l = (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) => (A(s, i, "write to private field"), r ? r.call(s, t) : i.set(s, t), t), m = (s, i, t) => (A(s, i, "access private method"), t);
|
|
6
|
+
import { Attribute as C } from "../attribute/index.js";
|
|
7
|
+
import { i as R } from "../browser-0zX67oeU.js";
|
|
8
|
+
import { d as H } from "../events-CsVF98U6.js";
|
|
9
|
+
import { g as S } from "../style-j2TwriJ_.js";
|
|
10
|
+
var d, n, f, h, b, u, o, N, w, p, x, E, k;
|
|
11
|
+
class z {
|
|
12
|
+
constructor(i, t) {
|
|
13
|
+
l(this, o);
|
|
14
|
+
l(this, d, null);
|
|
15
|
+
l(this, n, null);
|
|
16
|
+
l(this, f, null);
|
|
17
|
+
l(this, h, null);
|
|
18
|
+
l(this, b);
|
|
19
|
+
l(this, u, !1);
|
|
20
|
+
l(this, p, () => {
|
|
21
|
+
e(this, u) ? this.close() : this.open();
|
|
22
|
+
});
|
|
23
|
+
l(this, x, () => {
|
|
24
|
+
e(this, u) && (m(this, o, E).call(this, 0, !0), m(this, o, E).call(this, e(this, o, w)));
|
|
25
|
+
});
|
|
26
|
+
t.firstElementChild instanceof HTMLElement && t.lastElementChild instanceof HTMLElement ? (a(this, d, i), a(this, n, t), a(this, f, t.firstElementChild), a(this, h, t.lastElementChild), e(this, h).style.overflow = "hidden", e(this, d).axisAttribute.current === "y" ? e(this, h).style.height = "0px" : e(this, h).style.width = "0px", addEventListener("resize", e(this, x)), e(this, f).addEventListener("click", e(this, p)), e(this, n).hasAttribute("data-opened") && this.open({ skipTransition: !0 })) : i.removeItem(e(this, n));
|
|
27
|
+
}
|
|
28
|
+
get element() {
|
|
29
|
+
return e(this, n);
|
|
30
|
+
}
|
|
31
|
+
destroy() {
|
|
32
|
+
e(this, f) && (e(this, n).classList.remove("opened", "triggered"), e(this, f).style.cursor = "", m(this, o, E).call(this, void 0), removeEventListener("resize", e(this, x)), e(this, f).removeEventListener("click", e(this, p)), clearTimeout(e(this, b)));
|
|
33
|
+
}
|
|
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, n) }), a(this, u, !0), clearTimeout(e(this, b)), e(this, n).classList.add("triggered"), m(this, o, E).call(this, e(this, o, w)), setTimeout(() => {
|
|
36
|
+
e(this, n).classList.add("opened");
|
|
37
|
+
}, 0), H(this.element, "accordionItemToggle", {
|
|
38
|
+
bubbles: !0,
|
|
39
|
+
composed: !0,
|
|
40
|
+
detail: {
|
|
41
|
+
opened: e(this, u)
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
close(i) {
|
|
46
|
+
i != null && i.skipTransition && m(this, o, k).call(this), a(this, u, !1), e(this, n).classList.remove("opened"), m(this, o, E).call(this, 0), a(this, b, setTimeout(() => {
|
|
47
|
+
e(this, n).classList.remove("triggered");
|
|
48
|
+
}, S(e(this, h)))), H(this.element, "accordionItemToggle", {
|
|
49
|
+
bubbles: !0,
|
|
50
|
+
composed: !0,
|
|
51
|
+
detail: {
|
|
52
|
+
opened: e(this, u)
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
d = new WeakMap(), n = new WeakMap(), f = new WeakMap(), h = new WeakMap(), b = new WeakMap(), u = new WeakMap(), o = new WeakSet(), N = function() {
|
|
58
|
+
return e(this, n).parentElement || e(this, n).getRootNode();
|
|
59
|
+
}, w = function() {
|
|
60
|
+
return e(this, d).axisAttribute.current === "x" ? e(this, h).scrollWidth : e(this, h).scrollHeight;
|
|
61
|
+
}, p = new WeakMap(), x = new WeakMap(), E = function(i, t = !1) {
|
|
62
|
+
t && (e(this, h).style.transition = "all 0s", setTimeout(() => {
|
|
63
|
+
e(this, h).style.transition = "";
|
|
64
|
+
}));
|
|
65
|
+
const r = e(this, d).axisAttribute.current === "x" ? "width" : "height";
|
|
66
|
+
i != null ? e(this, h).style[r] = `${i}px` : e(this, h).style[r] = "";
|
|
67
|
+
}, k = function() {
|
|
68
|
+
e(this, h).style.transition = "all 0s", setTimeout(() => {
|
|
69
|
+
e(this, h).style.transition = "";
|
|
70
|
+
}, 50);
|
|
71
|
+
};
|
|
72
|
+
var v, g, c, T, y, I;
|
|
73
|
+
class O extends HTMLElement {
|
|
74
|
+
constructor() {
|
|
75
|
+
super();
|
|
76
|
+
l(this, y);
|
|
77
|
+
l(this, v, new C(this, "axis", "y"));
|
|
78
|
+
l(this, g, new C(this, "multiple", !1));
|
|
79
|
+
l(this, c, []);
|
|
80
|
+
l(this, T, null);
|
|
81
|
+
R && a(this, T, new MutationObserver((t) => {
|
|
82
|
+
t.forEach((r) => {
|
|
83
|
+
r.removedNodes.forEach((L) => {
|
|
84
|
+
L instanceof HTMLElement && this.removeItem(L);
|
|
85
|
+
}), r.addedNodes.forEach((L) => {
|
|
86
|
+
L instanceof HTMLElement && this.createItem(L);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
get axisAttribute() {
|
|
92
|
+
return e(this, v);
|
|
93
|
+
}
|
|
94
|
+
get multipleAttribute() {
|
|
95
|
+
return e(this, g);
|
|
96
|
+
}
|
|
97
|
+
createItem(t) {
|
|
98
|
+
e(this, c).find((r) => r.element === t) || e(this, c).push(new z(this, t));
|
|
99
|
+
}
|
|
100
|
+
removeItem(t) {
|
|
101
|
+
a(this, c, e(this, c).filter((r) => {
|
|
102
|
+
if (r.element !== t)
|
|
103
|
+
return !0;
|
|
104
|
+
r.destroy();
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
closeAll(t) {
|
|
108
|
+
e(this, c).forEach((r) => {
|
|
109
|
+
(t == null ? void 0 : t.exclude) !== r.element && r.close(t);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
openAll(t) {
|
|
113
|
+
e(this, c).forEach((r) => {
|
|
114
|
+
(t == null ? void 0 : t.exclude) !== r.element && r.open(t);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
connectedCallback() {
|
|
118
|
+
e(this, v).observe(), e(this, g).observe(), e(this, T).observe(e(this, y, I), {
|
|
119
|
+
childList: !0
|
|
120
|
+
}), a(this, c, [...e(this, y, I).children].map((t) => {
|
|
121
|
+
if (t instanceof HTMLElement)
|
|
122
|
+
return new z(this, t);
|
|
123
|
+
}).filter((t) => !!t));
|
|
124
|
+
}
|
|
125
|
+
disconnectedCallback() {
|
|
126
|
+
e(this, v).unobserve(), e(this, g).unobserve(), e(this, T).disconnect();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
v = new WeakMap(), g = new WeakMap(), c = new WeakMap(), T = new WeakMap(), y = new WeakSet(), I = function() {
|
|
130
|
+
return this.shadowRoot ? this.shadowRoot : this;
|
|
131
|
+
};
|
|
132
|
+
customElements.get("e-accordion") || customElements.define("e-accordion", O);
|
|
133
|
+
export {
|
|
134
|
+
O as AccordionElement
|
|
135
|
+
};
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var P=i=>{throw TypeError(i)};var M=(i,r,t)=>r.has(i)||P("Cannot "+t);var e=(i,r,t)=>(M(i,r,"read from private field"),t?t.call(i):r.get(i)),o=(i,r,t)=>r.has(i)?P("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,t),h=(i,r,t,d)=>(M(i,r,"write to private field"),d?d.call(i,t):r.set(i,t),t),b=(i,r,t)=>(M(i,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("../attribute/index.cjs"),B=require("../Store-CDb6RMce.cjs"),A=require("../events-KVanG9sR.cjs"),N=require("../style-At6aDoqG.cjs"),j=require("../browser-CpzFX2xg.cjs");var E,l,T,p,u,v,g,a,R,L,x,y,H,f;const c=class c extends HTMLElement{constructor(){super(...arguments);o(this,a);o(this,E);o(this,l);o(this,T);o(this,p);o(this,u);o(this,v);o(this,g);o(this,L);o(this,y);o(this,f);h(this,E,-1),h(this,l,new B.Store(!1)),h(this,p,new O.Attribute(this,"history",!1)),h(this,u,new O.Attribute(this,"restore",!1)),h(this,v,new O.Attribute(this,"single",!1)),h(this,g,!1),this.open=(t=!0)=>{if(e(this,l).current)return;e(this,l).current=!0,e(this,v).current&&(c.__opened.forEach(n=>n.close()),c.__opened=[]),c.__opened.push(this),h(this,E,c.__opened.length-1),e(this,p).current&&e(this,g)&&history.pushState("","",e(this,a,R)),clearTimeout(e(this,T)),this.classList.add("triggered"),this.style.display="block",A.dispatchEvent(this,"popoverTriggered",{custom:!0});const d=()=>{addEventListener("click",e(this,L)),addEventListener("keydown",e(this,y)),this.style.opacity="1",this.classList.add("opened"),A.dispatchEvent(this,"popoverOpened",{custom:!0})};t?setTimeout(d):d()},this.close=()=>{e(this,l).current&&(e(this,l).current=!1,c.__opened=c.__opened.filter(t=>t!==this),b(this,a,x).call(this),this.classList.remove("opened"),this.style.opacity="0",A.dispatchEvent(this,"popoverClosing",{custom:!0}),removeEventListener("click",e(this,L)),removeEventListener("keydown",e(this,y)),setTimeout(()=>{this.classList.remove("triggered"),this.style.display="none",A.dispatchEvent(this,"popoverClosed",{custom:!0})},N.getElementTransitionDurationMS(this)+10))},h(this,L,t=>{b(this,a,H).call(this,()=>{var $;const n=t.composedPath()[0],_=n instanceof HTMLElement&&(this.contains(n)||(($=this.shadowRoot)==null?void 0:$.contains(n))),m=n instanceof HTMLElement&&n.hasAttribute("outside");(!_||m)&&this.close()})}),h(this,y,t=>{b(this,a,H).call(this,()=>{t.code==="Escape"&&this.close()})}),h(this,f,()=>{h(this,g,!1),e(this,l).current&&e(this,p).current&&!location.search.includes(this.id)?this.close():!e(this,l).current&&e(this,p).current&&location.search.includes(this.id)&&this.open(),h(this,g,!0)})}get history(){return e(this,p)}get restore(){return e(this,u)}get single(){return e(this,v)}get opened(){return e(this,l)}connectedCallback(){e(this,p).observe(),e(this,u).observe(),e(this,v).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),addEventListener("popstate",e(this,f)),setTimeout(()=>{e(this,u).current?e(this,f).call(this):(b(this,a,x).call(this),h(this,g,!0))},0)}disconnectedCallback(){e(this,p).unobserve(),e(this,u).unobserve(),e(this,v).unobserve(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),c.__opened=c.__opened.filter(t=>t!==this),clearTimeout(e(this,T)),removeEventListener("popstate",e(this,f))}};E=new WeakMap,l=new WeakMap,T=new WeakMap,p=new WeakMap,u=new WeakMap,v=new WeakMap,g=new WeakMap,a=new WeakSet,R=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},L=new WeakMap,x=function(){if(e(this,p).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(null,"",t.href)}},y=new WeakMap,H=function(t){(c.__opened[e(this,E)-1]||c.__opened.length===1)&&t()},f=new WeakMap,c.__opened=[];let q=c;customElements.get("e-popover")||customElements.define("e-popover",q);var s,w,k,S,C;class I extends HTMLElement{constructor(){super();o(this,s);o(this,w,()=>{this.classList.add("triggered")});o(this,k,()=>{this.classList.add("opened")});o(this,S,()=>{this.classList.remove("opened")});o(this,C,()=>{this.classList.remove("triggered")});j.isBrowser&&(this.addEventListener("click",()=>{if(e(this,s)){const t=this.getAttribute("type")||"open";t==="open"||t==="toggle"&&!e(this,s).opened.current?e(this,s).open():(t==="close"||t==="toggle"&&e(this,s).opened.current)&&e(this,s).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get popoverElement(){return e(this,s)}connectedCallback(){var d;this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let n=null;if(t==="parent"){const _=this.closest("[popover-target]");if(_)n=_;else{const m=this.getRootNode();m instanceof ShadowRoot?n=m.host.closest("[popover-target]"):m instanceof HTMLElement&&(n=m.closest("[popover-target]"))}}else t==="sibling"?n=(d=this.parentElement)==null?void 0:d.querySelector("[popover-target]"):n=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);n instanceof HTMLElement?(h(this,s,n),e(this,s).addEventListener("popoverTriggered",e(this,w)),e(this,s).addEventListener("popoverOpened",e(this,k)),e(this,s).addEventListener("popoverClosing",e(this,S)),e(this,s).addEventListener("popoverClosed",e(this,C))):console.warn(this,`target ${t} not found`)}}disconnectedCallback(){e(this,s)&&(e(this,s).removeEventListener("popoverTriggered",e(this,w)),e(this,s).removeEventListener("popoverOpened",e(this,k)),e(this,s).removeEventListener("popoverClosing",e(this,S)),e(this,s).removeEventListener("popoverClosed",e(this,C)))}}s=new WeakMap,w=new WeakMap,k=new WeakMap,S=new WeakMap,C=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",I);exports.PopoverButtonElement=I;exports.PopoverElement=q;
|
package/lib/popover/index.js
CHANGED
|
@@ -1,114 +1,113 @@
|
|
|
1
|
-
var
|
|
1
|
+
var I = (i) => {
|
|
2
2
|
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (i, r, t) => (
|
|
4
|
+
var M = (i, r, t) => r.has(i) || I("Cannot " + t);
|
|
5
|
+
var e = (i, r, t) => (M(i, r, "read from private field"), t ? t.call(i) : r.get(i)), o = (i, r, t) => r.has(i) ? I("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(i) : r.set(i, t), h = (i, r, t, d) => (M(i, r, "write to private field"), d ? d.call(i, t) : r.set(i, t), t), b = (i, r, t) => (M(i, r, "access private method"), t);
|
|
6
6
|
import { Attribute as x } from "../attribute/index.js";
|
|
7
|
-
import { S as
|
|
8
|
-
import { d as
|
|
9
|
-
import { g as
|
|
10
|
-
import { i as
|
|
11
|
-
var L,
|
|
12
|
-
const
|
|
7
|
+
import { S as N } from "../Store-OTdcl6SX.js";
|
|
8
|
+
import { d as A } from "../events-CsVF98U6.js";
|
|
9
|
+
import { g as B } from "../style-j2TwriJ_.js";
|
|
10
|
+
import { i as P } from "../browser-0zX67oeU.js";
|
|
11
|
+
var L, p, T, l, u, v, g, a, q, E, O, y, $, m;
|
|
12
|
+
const c = class c extends HTMLElement {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
|
-
o(this,
|
|
15
|
+
o(this, a);
|
|
16
16
|
o(this, L);
|
|
17
|
-
o(this,
|
|
18
|
-
o(this,
|
|
17
|
+
o(this, p);
|
|
18
|
+
o(this, T);
|
|
19
19
|
o(this, l);
|
|
20
|
-
o(this, d);
|
|
21
20
|
o(this, u);
|
|
22
21
|
o(this, v);
|
|
22
|
+
o(this, g);
|
|
23
23
|
o(this, E);
|
|
24
24
|
o(this, y);
|
|
25
|
-
o(this,
|
|
26
|
-
h(this, L, -1), h(this,
|
|
27
|
-
if (e(this,
|
|
25
|
+
o(this, m);
|
|
26
|
+
h(this, L, -1), h(this, p, new N(!1)), h(this, l, new x(this, "history", !1)), h(this, u, new x(this, "restore", !1)), h(this, v, new x(this, "single", !1)), h(this, g, !1), this.open = (t = !0) => {
|
|
27
|
+
if (e(this, p).current)
|
|
28
28
|
return;
|
|
29
|
-
e(this,
|
|
29
|
+
e(this, p).current = !0, e(this, v).current && (c.__opened.forEach((n) => n.close()), c.__opened = []), c.__opened.push(this), h(this, L, c.__opened.length - 1), e(this, l).current && e(this, g) && history.pushState("", "", e(this, a, q)), clearTimeout(e(this, T)), this.classList.add("triggered"), this.style.display = "block", A(this, "popoverTriggered", {
|
|
30
30
|
custom: !0
|
|
31
31
|
});
|
|
32
|
-
const
|
|
33
|
-
addEventListener("click", e(this, E)), addEventListener("keydown", e(this, y)), this.style.opacity = "1", this.classList.add("opened"),
|
|
32
|
+
const d = () => {
|
|
33
|
+
addEventListener("click", e(this, E)), addEventListener("keydown", e(this, y)), this.style.opacity = "1", this.classList.add("opened"), A(this, "popoverOpened", {
|
|
34
34
|
custom: !0
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
-
t ? setTimeout(
|
|
37
|
+
t ? setTimeout(d) : d();
|
|
38
38
|
}, this.close = () => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
this.classList.remove("opened"), this.style.opacity = "0", _(this, "popoverClosing", {
|
|
39
|
+
e(this, p).current && (e(this, p).current = !1, c.__opened = c.__opened.filter((t) => t !== this), b(this, a, O).call(this), this.classList.remove("opened"), this.style.opacity = "0", A(this, "popoverClosing", {
|
|
40
|
+
custom: !0
|
|
41
|
+
}), removeEventListener("click", e(this, E)), removeEventListener("keydown", e(this, y)), setTimeout(() => {
|
|
42
|
+
this.classList.remove("triggered"), this.style.display = "none", A(this, "popoverClosed", {
|
|
45
43
|
custom: !0
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
custom: !0
|
|
49
|
-
});
|
|
50
|
-
}, N(this) + 10);
|
|
51
|
-
}
|
|
44
|
+
});
|
|
45
|
+
}, B(this) + 10));
|
|
52
46
|
}, h(this, E, (t) => {
|
|
53
|
-
|
|
54
|
-
var
|
|
55
|
-
const n = t.composedPath()[0],
|
|
56
|
-
(!
|
|
47
|
+
b(this, a, $).call(this, () => {
|
|
48
|
+
var R;
|
|
49
|
+
const n = t.composedPath()[0], _ = n instanceof HTMLElement && (this.contains(n) || ((R = this.shadowRoot) == null ? void 0 : R.contains(n))), f = n instanceof HTMLElement && n.hasAttribute("outside");
|
|
50
|
+
(!_ || f) && this.close();
|
|
57
51
|
});
|
|
58
52
|
}), h(this, y, (t) => {
|
|
59
|
-
|
|
53
|
+
b(this, a, $).call(this, () => {
|
|
60
54
|
t.code === "Escape" && this.close();
|
|
61
55
|
});
|
|
62
|
-
}), h(this,
|
|
63
|
-
h(this,
|
|
56
|
+
}), h(this, m, () => {
|
|
57
|
+
h(this, g, !1), e(this, p).current && e(this, l).current && !location.search.includes(this.id) ? this.close() : !e(this, p).current && e(this, l).current && location.search.includes(this.id) && this.open(), h(this, g, !0);
|
|
64
58
|
});
|
|
65
59
|
}
|
|
66
60
|
get history() {
|
|
67
61
|
return e(this, l);
|
|
68
62
|
}
|
|
69
63
|
get restore() {
|
|
70
|
-
return e(this,
|
|
64
|
+
return e(this, u);
|
|
71
65
|
}
|
|
72
66
|
get single() {
|
|
73
|
-
return e(this,
|
|
67
|
+
return e(this, v);
|
|
74
68
|
}
|
|
75
69
|
get opened() {
|
|
76
|
-
return e(this,
|
|
70
|
+
return e(this, p);
|
|
77
71
|
}
|
|
78
72
|
connectedCallback() {
|
|
79
|
-
e(this, l).observe(), e(this,
|
|
80
|
-
e(this,
|
|
73
|
+
e(this, l).observe(), e(this, u).observe(), e(this, v).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("popover-target", ""), addEventListener("popstate", e(this, m)), setTimeout(() => {
|
|
74
|
+
e(this, u).current ? e(this, m).call(this) : (b(this, a, O).call(this), h(this, g, !0));
|
|
81
75
|
}, 0);
|
|
82
76
|
}
|
|
83
77
|
disconnectedCallback() {
|
|
84
|
-
e(this, l).unobserve(), e(this,
|
|
78
|
+
e(this, l).unobserve(), e(this, u).unobserve(), e(this, v).unobserve(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), c.__opened = c.__opened.filter((t) => t !== this), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, m));
|
|
85
79
|
}
|
|
86
80
|
};
|
|
87
|
-
L = new WeakMap(),
|
|
81
|
+
L = new WeakMap(), p = new WeakMap(), T = new WeakMap(), l = new WeakMap(), u = new WeakMap(), v = new WeakMap(), g = new WeakMap(), a = new WeakSet(), q = function() {
|
|
88
82
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.id}`;
|
|
89
|
-
}, E = new WeakMap(),
|
|
90
|
-
(
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
}, E = new WeakMap(), O = function() {
|
|
84
|
+
if (e(this, l).current) {
|
|
85
|
+
const t = new URL(location.href);
|
|
86
|
+
t.searchParams.delete(this.id), history.replaceState(null, "", t.href);
|
|
87
|
+
}
|
|
88
|
+
}, y = new WeakMap(), $ = function(t) {
|
|
89
|
+
(c.__opened[e(this, L) - 1] || c.__opened.length === 1) && t();
|
|
90
|
+
}, m = new WeakMap(), c.__opened = [];
|
|
91
|
+
let H = c;
|
|
93
92
|
customElements.get("e-popover") || customElements.define("e-popover", H);
|
|
94
|
-
var s,
|
|
93
|
+
var s, w, k, C, S;
|
|
95
94
|
class D extends HTMLElement {
|
|
96
95
|
constructor() {
|
|
97
96
|
super();
|
|
98
97
|
o(this, s);
|
|
99
|
-
o(this,
|
|
98
|
+
o(this, w, () => {
|
|
100
99
|
this.classList.add("triggered");
|
|
101
100
|
});
|
|
102
|
-
o(this,
|
|
101
|
+
o(this, k, () => {
|
|
103
102
|
this.classList.add("opened");
|
|
104
103
|
});
|
|
105
|
-
o(this,
|
|
104
|
+
o(this, C, () => {
|
|
106
105
|
this.classList.remove("opened");
|
|
107
106
|
});
|
|
108
|
-
o(this,
|
|
107
|
+
o(this, S, () => {
|
|
109
108
|
this.classList.remove("triggered");
|
|
110
109
|
});
|
|
111
|
-
|
|
110
|
+
P && (this.addEventListener("click", () => {
|
|
112
111
|
if (e(this, s)) {
|
|
113
112
|
const t = this.getAttribute("type") || "open";
|
|
114
113
|
t === "open" || t === "toggle" && !e(this, s).opened.current ? e(this, s).open() : (t === "close" || t === "toggle" && e(this, s).opened.current) && e(this, s).close();
|
|
@@ -121,52 +120,52 @@ class D extends HTMLElement {
|
|
|
121
120
|
return e(this, s);
|
|
122
121
|
}
|
|
123
122
|
connectedCallback() {
|
|
124
|
-
var
|
|
123
|
+
var d;
|
|
125
124
|
this.hasAttribute("tabindex") || (this.tabIndex = 0);
|
|
126
125
|
const t = this.getAttribute("target");
|
|
127
126
|
if (t) {
|
|
128
127
|
let n = null;
|
|
129
128
|
if (t === "parent") {
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
n =
|
|
129
|
+
const _ = this.closest("[popover-target]");
|
|
130
|
+
if (_)
|
|
131
|
+
n = _;
|
|
133
132
|
else {
|
|
134
133
|
const f = this.getRootNode();
|
|
135
134
|
f instanceof ShadowRoot ? n = f.host.closest("[popover-target]") : f instanceof HTMLElement && (n = f.closest("[popover-target]"));
|
|
136
135
|
}
|
|
137
|
-
} else t === "sibling" ? n = (
|
|
136
|
+
} else t === "sibling" ? n = (d = this.parentElement) == null ? void 0 : d.querySelector("[popover-target]") : n = document.querySelector(`#${t}`) || this.getRootNode().querySelector(`#${t}`);
|
|
138
137
|
n instanceof HTMLElement ? (h(this, s, n), e(this, s).addEventListener(
|
|
139
138
|
"popoverTriggered",
|
|
140
|
-
e(this,
|
|
139
|
+
e(this, w)
|
|
141
140
|
), e(this, s).addEventListener(
|
|
142
141
|
"popoverOpened",
|
|
143
|
-
e(this,
|
|
142
|
+
e(this, k)
|
|
144
143
|
), e(this, s).addEventListener(
|
|
145
144
|
"popoverClosing",
|
|
146
|
-
e(this,
|
|
145
|
+
e(this, C)
|
|
147
146
|
), e(this, s).addEventListener(
|
|
148
147
|
"popoverClosed",
|
|
149
|
-
e(this,
|
|
148
|
+
e(this, S)
|
|
150
149
|
)) : console.warn(this, `target ${t} not found`);
|
|
151
150
|
}
|
|
152
151
|
}
|
|
153
152
|
disconnectedCallback() {
|
|
154
153
|
e(this, s) && (e(this, s).removeEventListener(
|
|
155
154
|
"popoverTriggered",
|
|
156
|
-
e(this,
|
|
155
|
+
e(this, w)
|
|
157
156
|
), e(this, s).removeEventListener(
|
|
158
157
|
"popoverOpened",
|
|
159
|
-
e(this,
|
|
158
|
+
e(this, k)
|
|
160
159
|
), e(this, s).removeEventListener(
|
|
161
160
|
"popoverClosing",
|
|
162
|
-
e(this,
|
|
161
|
+
e(this, C)
|
|
163
162
|
), e(this, s).removeEventListener(
|
|
164
163
|
"popoverClosed",
|
|
165
|
-
e(this,
|
|
164
|
+
e(this, S)
|
|
166
165
|
));
|
|
167
166
|
}
|
|
168
167
|
}
|
|
169
|
-
s = new WeakMap(),
|
|
168
|
+
s = new WeakMap(), w = new WeakMap(), k = new WeakMap(), C = new WeakMap(), S = new WeakMap();
|
|
170
169
|
customElements.get("e-popover-button") || customElements.define("e-popover-button", D);
|
|
171
170
|
export {
|
|
172
171
|
D as PopoverButtonElement,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aptechka",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/denisavitski/aptechka.git"
|
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
20
|
"exports": {
|
|
21
|
+
"./accordion": {
|
|
22
|
+
"require": "./lib/accordion/index.cjs",
|
|
23
|
+
"default": "./lib/accordion/index.js",
|
|
24
|
+
"types": "./lib/accordion/index.d.ts"
|
|
25
|
+
},
|
|
21
26
|
"./animation": {
|
|
22
27
|
"require": "./lib/animation/index.cjs",
|
|
23
28
|
"default": "./lib/animation/index.js",
|
|
@@ -226,6 +231,9 @@
|
|
|
226
231
|
},
|
|
227
232
|
"typesVersions": {
|
|
228
233
|
"*": {
|
|
234
|
+
"accordion": [
|
|
235
|
+
"lib/accordion/index.d.ts"
|
|
236
|
+
],
|
|
229
237
|
"animation": [
|
|
230
238
|
"lib/animation/index.d.ts"
|
|
231
239
|
],
|