aptechka 0.4.19 → 0.4.20

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.
@@ -7,6 +7,7 @@ export declare class PopoverButtonElement extends CustomElement {
7
7
  constructor();
8
8
  get popoverElement(): PopoverElement | undefined;
9
9
  protected connectedCallback(): void;
10
+ protected disconnectedCallback(): void;
10
11
  }
11
12
  declare global {
12
13
  interface HTMLElementTagNameMap {
@@ -17,4 +17,10 @@ declare global {
17
17
  interface HTMLElementTagNameMap {
18
18
  'e-popover': PopoverElement;
19
19
  }
20
+ interface HTMLElementEventMap {
21
+ popoverTriggered: CustomEvent;
22
+ popoverOpened: CustomEvent;
23
+ popoverClosing: CustomEvent;
24
+ popoverClosed: CustomEvent;
25
+ }
20
26
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../attribute/index.cjs"),S=require("../custom-element/index.cjs"),A=require("../Store-BQGNOHlY.cjs"),b=require("../style-At6aDoqG.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");const x=require("../browser-CpzFX2xg.cjs"),k=require("../tags-CueX-JLX.cjs"),B=require("../createStylesheet-C8aQQ4hd.cjs");var D=Object.defineProperty,I=Object.getOwnPropertyDescriptor,N=(t,e,s,i)=>{for(var n=i>1?void 0:i?I(e,s):e,c=t.length-1,p;c>=0;c--)(p=t[c])&&(n=(i?p(e,s,n):p(n))||n);return i&&n&&D(e,s,n),n},C=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},r=(t,e,s)=>(C(t,e,"read from private field"),s?s.call(t):e.get(t)),o=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},L=(t,e,s,i)=>(C(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),$=(t,e,s)=>(C(t,e,"access private method"),s),P,a,E,h,u,_,M,O,v,m,w,y,g,W,f;exports.PopoverElement=class extends S.CustomElement{constructor(){super(...arguments),o(this,M),o(this,v),o(this,g),o(this,P,-1),o(this,a,new A.Store(!1)),o(this,E,void 0),o(this,h,new T.Attribute(this,"history",!1)),o(this,u,new T.Attribute(this,"single",!1)),o(this,_,!1),this.open=()=>{r(this,a).current||(r(this,a).current=!0,r(this,u).current&&(exports.PopoverElement.__opened.forEach(e=>e.close()),exports.PopoverElement.__opened=[]),exports.PopoverElement.__opened.push(this),L(this,P,exports.PopoverElement.__opened.length-1),r(this,h).current&&r(this,_)&&history.pushState("","",r(this,M,O)),clearTimeout(r(this,E)),this.classList.add("triggered"),this.style.display="block",setTimeout(()=>{addEventListener("click",r(this,w)),addEventListener("keydown",r(this,y)),this.style.opacity="1",this.classList.add("opened")}))},this.close=()=>{if(r(this,a).current){if(r(this,a).current=!1,exports.PopoverElement.__opened=exports.PopoverElement.__opened.filter(e=>e!==this),r(this,h).current){const e=new URL(location.href);e.searchParams.delete(r(this,v,m)),history.replaceState(null,"",e.href)}this.classList.remove("opened"),this.style.opacity="0",removeEventListener("click",r(this,w)),removeEventListener("keydown",r(this,y)),setTimeout(()=>{this.classList.remove("triggered"),this.style.display="none"},b.getElementTransitionDurationMS(this))}},o(this,w,e=>{$(this,g,W).call(this,()=>{const s=e.composedPath();(!s.find(i=>i===this)&&!s.find(i=>i instanceof HTMLElement&&i.closest("e-popover-button"))||s[0]instanceof HTMLElement&&s[0].hasAttribute("outside"))&&this.close()})}),o(this,y,e=>{$(this,g,W).call(this,()=>{e.code==="Escape"&&this.close()})}),o(this,f,()=>{L(this,_,!1),r(this,a).current&&r(this,h).current&&!location.search.includes(r(this,v,m))?this.close():!r(this,a).current&&r(this,h).current&&location.search.includes(r(this,v,m))&&this.open(),L(this,_,!0)})}get history(){return r(this,h)}get single(){return r(this,u)}get opened(){return r(this,a)}connectedCallback(){r(this,h).observe(),r(this,u).observe(),this.style.opacity="0",this.style.display="none",addEventListener("popstate",r(this,f)),setTimeout(()=>{r(this,f).call(this)},0)}disconnectedCallback(){r(this,h).unobserve(),r(this,u).unobserve(),clearTimeout(r(this,E)),removeEventListener("popstate",r(this,f))}};P=new WeakMap;a=new WeakMap;E=new WeakMap;h=new WeakMap;u=new WeakMap;_=new WeakMap;M=new WeakSet;O=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${r(this,v,m)}`};v=new WeakSet;m=function(){return`modal-${this.id}`};w=new WeakMap;y=new WeakMap;g=new WeakSet;W=function(t){(exports.PopoverElement.__opened[r(this,P)-1]||exports.PopoverElement.__opened.length===1)&&t()};f=new WeakMap;exports.PopoverElement.__opened=[];exports.PopoverElement=N([S.define("e-popover")],exports.PopoverElement);var G=Object.defineProperty,H=Object.getOwnPropertyDescriptor,R=(t,e,s,i)=>{for(var n=i>1?void 0:i?H(e,s):e,c=t.length-1,p;c>=0;c--)(p=t[c])&&(n=(i?p(e,s,n):p(n))||n);return i&&n&&G(e,s,n),n},q=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},d=(t,e,s)=>(q(t,e,"read from private field"),s?s.call(t):e.get(t)),U=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},z=(t,e,s,i)=>(q(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),l;const F=B.createStylesheet({button:{all:"inherit"}});exports.PopoverButtonElement=class extends S.CustomElement{constructor(){super(),U(this,l,void 0),this.openShadow(F),x.isBrowser&&k.element(this,{children:[k.button({onClick:()=>{if(d(this,l)){const e=this.getAttribute("type")||"open";e==="open"||e==="toggle"&&!d(this,l).opened.current?d(this,l).open():(e==="close"||e==="toggle"&&d(this,l).opened.current)&&d(this,l).close()}},children:[k.slot()]})]})}get popoverElement(){return d(this,l)}connectedCallback(){const e=this.getAttribute("target");if(e){const s=document.querySelector(`#${e}`)||this.getRootNode().querySelector(`#${e}`);s?z(this,l,s):console.warn(this,`target ${e} not found`)}}};l=new WeakMap;exports.PopoverButtonElement=R([S.define("e-popover-button")],exports.PopoverButtonElement);
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../attribute/index.cjs"),W=require("../custom-element/index.cjs"),I=require("../Store-BQGNOHlY.cjs"),N=require("../style-At6aDoqG.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");const G=require("../browser-CpzFX2xg.cjs"),T=require("../tags-CueX-JLX.cjs"),H=require("../createStylesheet-C8aQQ4hd.cjs");var R=Object.defineProperty,U=Object.getOwnPropertyDescriptor,z=(t,e,s,n)=>{for(var a=n>1?void 0:n?U(e,s):e,c=t.length-1,d;c>=0;c--)(d=t[c])&&(a=(n?d(e,s,a):d(a))||a);return n&&a&&R(e,s,a),a},A=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},i=(t,e,s)=>(A(t,e,"read from private field"),s?s.call(t):e.get(t)),h=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},O=(t,e,s,n)=>(A(t,e,"write to private field"),n?n.call(t,s):e.set(t,s),s),x=(t,e,s)=>(A(t,e,"access private method"),s),M,p,g,l,v,f,$,B,u,m,w,y,L,q,E;exports.PopoverElement=class extends W.CustomElement{constructor(){super(...arguments),h(this,$),h(this,u),h(this,L),h(this,M,-1),h(this,p,new I.Store(!1)),h(this,g,void 0),h(this,l,new b.Attribute(this,"history",!1)),h(this,v,new b.Attribute(this,"single",!1)),h(this,f,!1),this.open=()=>{i(this,p).current||(i(this,p).current=!0,i(this,v).current&&(exports.PopoverElement.__opened.forEach(e=>e.close()),exports.PopoverElement.__opened=[]),exports.PopoverElement.__opened.push(this),O(this,M,exports.PopoverElement.__opened.length-1),i(this,l).current&&i(this,f)&&history.pushState("","",i(this,$,B)),clearTimeout(i(this,g)),this.classList.add("triggered"),this.style.display="block",this.dispatchEvent(new CustomEvent("popoverTriggered")),setTimeout(()=>{addEventListener("click",i(this,w)),addEventListener("keydown",i(this,y)),this.style.opacity="1",this.classList.add("opened"),this.dispatchEvent(new CustomEvent("popoverOpened"))}))},this.close=()=>{if(i(this,p).current){if(i(this,p).current=!1,exports.PopoverElement.__opened=exports.PopoverElement.__opened.filter(e=>e!==this),i(this,l).current){const e=new URL(location.href);e.searchParams.delete(i(this,u,m)),history.replaceState(null,"",e.href)}this.classList.remove("opened"),this.style.opacity="0",this.dispatchEvent(new CustomEvent("popoverClosing")),removeEventListener("click",i(this,w)),removeEventListener("keydown",i(this,y)),setTimeout(()=>{this.classList.remove("triggered"),this.style.display="none",this.dispatchEvent(new CustomEvent("popoverClosed"))},N.getElementTransitionDurationMS(this))}},h(this,w,e=>{x(this,L,q).call(this,()=>{const s=e.composedPath();(!s.find(n=>n===this)&&!s.find(n=>n instanceof HTMLElement&&n.closest("e-popover-button"))||s[0]instanceof HTMLElement&&s[0].hasAttribute("outside"))&&this.close()})}),h(this,y,e=>{x(this,L,q).call(this,()=>{e.code==="Escape"&&this.close()})}),h(this,E,()=>{O(this,f,!1),i(this,p).current&&i(this,l).current&&!location.search.includes(i(this,u,m))?this.close():!i(this,p).current&&i(this,l).current&&location.search.includes(i(this,u,m))&&this.open(),O(this,f,!0)})}get history(){return i(this,l)}get single(){return i(this,v)}get opened(){return i(this,p)}connectedCallback(){i(this,l).observe(),i(this,v).observe(),this.style.opacity="0",this.style.display="none",addEventListener("popstate",i(this,E)),setTimeout(()=>{i(this,E).call(this)},0)}disconnectedCallback(){i(this,l).unobserve(),i(this,v).unobserve(),clearTimeout(i(this,g)),removeEventListener("popstate",i(this,E))}};M=new WeakMap;p=new WeakMap;g=new WeakMap;l=new WeakMap;v=new WeakMap;f=new WeakMap;$=new WeakSet;B=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${i(this,u,m)}`};u=new WeakSet;m=function(){return`modal-${this.id}`};w=new WeakMap;y=new WeakMap;L=new WeakSet;q=function(t){(exports.PopoverElement.__opened[i(this,M)-1]||exports.PopoverElement.__opened.length===1)&&t()};E=new WeakMap;exports.PopoverElement.__opened=[];exports.PopoverElement=z([W.define("e-popover")],exports.PopoverElement);var F=Object.defineProperty,J=Object.getOwnPropertyDescriptor,K=(t,e,s,n)=>{for(var a=n>1?void 0:n?J(e,s):e,c=t.length-1,d;c>=0;c--)(d=t[c])&&(a=(n?d(e,s,a):d(a))||a);return n&&a&&F(e,s,a),a},D=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},r=(t,e,s)=>(D(t,e,"read from private field"),s?s.call(t):e.get(t)),_=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},Q=(t,e,s,n)=>(D(t,e,"write to private field"),n?n.call(t,s):e.set(t,s),s),o,P,C,k,S;const V=H.createStylesheet({button:{all:"inherit"}});exports.PopoverButtonElement=class extends W.CustomElement{constructor(){super(),_(this,o,void 0),_(this,P,()=>{this.classList.add("triggered")}),_(this,C,()=>{this.classList.add("opened")}),_(this,k,()=>{this.classList.remove("opened")}),_(this,S,()=>{this.classList.remove("triggered")}),this.openShadow(V),G.isBrowser&&T.element(this,{children:[T.button({onClick:()=>{if(r(this,o)){const e=this.getAttribute("type")||"open";e==="open"||e==="toggle"&&!r(this,o).opened.current?r(this,o).open():(e==="close"||e==="toggle"&&r(this,o).opened.current)&&r(this,o).close()}},children:[T.slot()]})]})}get popoverElement(){return r(this,o)}connectedCallback(){const e=this.getAttribute("target");if(e){const s=document.querySelector(`#${e}`)||this.getRootNode().querySelector(`#${e}`);s?(Q(this,o,s),r(this,o).addEventListener("popoverTriggered",r(this,P)),r(this,o).addEventListener("popoverOpened",r(this,C)),r(this,o).addEventListener("popoverClosing",r(this,k)),r(this,o).addEventListener("popoverClosed",r(this,S))):console.warn(this,`target ${e} not found`)}}disconnectedCallback(){r(this,o)&&(r(this,o).removeEventListener("popoverTriggered",r(this,P)),r(this,o).removeEventListener("popoverOpened",r(this,C)),r(this,o).removeEventListener("popoverClosing",r(this,k)),r(this,o).removeEventListener("popoverClosed",r(this,S)))}};o=new WeakMap;P=new WeakMap;C=new WeakMap;k=new WeakMap;S=new WeakMap;exports.PopoverButtonElement=K([W.define("e-popover-button")],exports.PopoverButtonElement);
@@ -1,146 +1,185 @@
1
- import { Attribute as C } from "../attribute/index.js";
2
- import { CustomElement as O, define as A } from "../custom-element/index.js";
3
- import { S as I } from "../Store-Cd-E5W1z.js";
4
- import { g as N } from "../style-j2TwriJ_.js";
1
+ import { Attribute as D } from "../attribute/index.js";
2
+ import { CustomElement as N, define as q } from "../custom-element/index.js";
3
+ import { S as H } from "../Store-Cd-E5W1z.js";
4
+ import { g as R } from "../style-j2TwriJ_.js";
5
5
  import "../path-data-polyfill-DgeDWYeI.js";
6
- import { i as q } from "../browser-0zX67oeU.js";
7
- import { e as B, p as G, ay as H } from "../tags-BoPv9fDr.js";
8
- import { c as R } from "../createStylesheet-KMRQhSa-.js";
9
- var U = Object.defineProperty, b = Object.getOwnPropertyDescriptor, z = (e, t, s, r) => {
10
- for (var n = r > 1 ? void 0 : r ? b(t, s) : t, p = e.length - 1, d; p >= 0; p--)
11
- (d = e[p]) && (n = (r ? d(t, s, n) : d(n)) || n);
12
- return r && n && U(t, s, n), n;
13
- }, $ = (e, t, s) => {
6
+ import { i as b } from "../browser-0zX67oeU.js";
7
+ import { e as U, p as z, ay as F } from "../tags-BoPv9fDr.js";
8
+ import { c as J } from "../createStylesheet-KMRQhSa-.js";
9
+ var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, V = (e, t, s, o) => {
10
+ for (var a = o > 1 ? void 0 : o ? Q(t, s) : t, d = e.length - 1, v; d >= 0; d--)
11
+ (v = e[d]) && (a = (o ? v(t, s, a) : v(a)) || a);
12
+ return o && a && K(t, s, a), a;
13
+ }, A = (e, t, s) => {
14
14
  if (!t.has(e))
15
15
  throw TypeError("Cannot " + s);
16
- }, i = (e, t, s) => ($(e, t, "read from private field"), s ? s.call(e) : t.get(e)), o = (e, t, s) => {
16
+ }, i = (e, t, s) => (A(e, t, "read from private field"), s ? s.call(e) : t.get(e)), h = (e, t, s) => {
17
17
  if (t.has(e))
18
18
  throw TypeError("Cannot add the same private member more than once");
19
19
  t instanceof WeakSet ? t.add(e) : t.set(e, s);
20
- }, L = (e, t, s, r) => ($(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), T = (e, t, s) => ($(e, t, "access private method"), s), S, h, y, c, f, v, W, D, _, w, g, E, k, M, m;
21
- let a = class extends O {
20
+ }, O = (e, t, s, o) => (A(e, t, "write to private field"), o ? o.call(e, s) : t.set(e, s), s), x = (e, t, s) => (A(e, t, "access private method"), s), T, c, E, l, u, m, $, B, _, w, y, L, C, P, g;
21
+ let p = class extends N {
22
22
  constructor() {
23
- super(...arguments), o(this, W), o(this, _), o(this, k), o(this, S, -1), o(this, h, new I(!1)), o(this, y, void 0), o(this, c, new C(this, "history", !1)), o(this, f, new C(this, "single", !1)), o(this, v, !1), this.open = () => {
24
- i(this, h).current || (i(this, h).current = !0, i(this, f).current && (a.__opened.forEach((e) => e.close()), a.__opened = []), a.__opened.push(this), L(this, S, a.__opened.length - 1), i(this, c).current && i(this, v) && history.pushState("", "", i(this, W, D)), clearTimeout(i(this, y)), this.classList.add("triggered"), this.style.display = "block", setTimeout(() => {
25
- addEventListener("click", i(this, g)), addEventListener("keydown", i(this, E)), this.style.opacity = "1", this.classList.add("opened");
23
+ super(...arguments), h(this, $), h(this, _), h(this, C), h(this, T, -1), h(this, c, new H(!1)), h(this, E, void 0), h(this, l, new D(this, "history", !1)), h(this, u, new D(this, "single", !1)), h(this, m, !1), this.open = () => {
24
+ i(this, c).current || (i(this, c).current = !0, i(this, u).current && (p.__opened.forEach((e) => e.close()), p.__opened = []), p.__opened.push(this), O(this, T, p.__opened.length - 1), i(this, l).current && i(this, m) && history.pushState("", "", i(this, $, B)), clearTimeout(i(this, E)), this.classList.add("triggered"), this.style.display = "block", this.dispatchEvent(new CustomEvent("popoverTriggered")), setTimeout(() => {
25
+ addEventListener("click", i(this, y)), addEventListener("keydown", i(this, L)), this.style.opacity = "1", this.classList.add("opened"), this.dispatchEvent(new CustomEvent("popoverOpened"));
26
26
  }));
27
27
  }, this.close = () => {
28
- if (i(this, h).current) {
29
- if (i(this, h).current = !1, a.__opened = a.__opened.filter((e) => e !== this), i(this, c).current) {
28
+ if (i(this, c).current) {
29
+ if (i(this, c).current = !1, p.__opened = p.__opened.filter((e) => e !== this), i(this, l).current) {
30
30
  const e = new URL(location.href);
31
31
  e.searchParams.delete(i(this, _, w)), history.replaceState(null, "", e.href);
32
32
  }
33
- this.classList.remove("opened"), this.style.opacity = "0", removeEventListener("click", i(this, g)), removeEventListener("keydown", i(this, E)), setTimeout(() => {
34
- this.classList.remove("triggered"), this.style.display = "none";
35
- }, N(this));
33
+ this.classList.remove("opened"), this.style.opacity = "0", this.dispatchEvent(new CustomEvent("popoverClosing")), removeEventListener("click", i(this, y)), removeEventListener("keydown", i(this, L)), setTimeout(() => {
34
+ this.classList.remove("triggered"), this.style.display = "none", this.dispatchEvent(new CustomEvent("popoverClosed"));
35
+ }, R(this));
36
36
  }
37
- }, o(this, g, (e) => {
38
- T(this, k, M).call(this, () => {
37
+ }, h(this, y, (e) => {
38
+ x(this, C, P).call(this, () => {
39
39
  const t = e.composedPath();
40
40
  (!t.find((s) => s === this) && !t.find(
41
41
  (s) => s instanceof HTMLElement && s.closest("e-popover-button")
42
42
  ) || t[0] instanceof HTMLElement && t[0].hasAttribute("outside")) && this.close();
43
43
  });
44
- }), o(this, E, (e) => {
45
- T(this, k, M).call(this, () => {
44
+ }), h(this, L, (e) => {
45
+ x(this, C, P).call(this, () => {
46
46
  e.code === "Escape" && this.close();
47
47
  });
48
- }), o(this, m, () => {
49
- L(this, v, !1), i(this, h).current && i(this, c).current && !location.search.includes(i(this, _, w)) ? this.close() : !i(this, h).current && i(this, c).current && location.search.includes(i(this, _, w)) && this.open(), L(this, v, !0);
48
+ }), h(this, g, () => {
49
+ O(this, m, !1), i(this, c).current && i(this, l).current && !location.search.includes(i(this, _, w)) ? this.close() : !i(this, c).current && i(this, l).current && location.search.includes(i(this, _, w)) && this.open(), O(this, m, !0);
50
50
  });
51
51
  }
52
52
  get history() {
53
- return i(this, c);
53
+ return i(this, l);
54
54
  }
55
55
  get single() {
56
- return i(this, f);
56
+ return i(this, u);
57
57
  }
58
58
  get opened() {
59
- return i(this, h);
59
+ return i(this, c);
60
60
  }
61
61
  connectedCallback() {
62
- i(this, c).observe(), i(this, f).observe(), this.style.opacity = "0", this.style.display = "none", addEventListener("popstate", i(this, m)), setTimeout(() => {
63
- i(this, m).call(this);
62
+ i(this, l).observe(), i(this, u).observe(), this.style.opacity = "0", this.style.display = "none", addEventListener("popstate", i(this, g)), setTimeout(() => {
63
+ i(this, g).call(this);
64
64
  }, 0);
65
65
  }
66
66
  disconnectedCallback() {
67
- i(this, c).unobserve(), i(this, f).unobserve(), clearTimeout(i(this, y)), removeEventListener("popstate", i(this, m));
67
+ i(this, l).unobserve(), i(this, u).unobserve(), clearTimeout(i(this, E)), removeEventListener("popstate", i(this, g));
68
68
  }
69
69
  };
70
- S = /* @__PURE__ */ new WeakMap();
71
- h = /* @__PURE__ */ new WeakMap();
72
- y = /* @__PURE__ */ new WeakMap();
70
+ T = /* @__PURE__ */ new WeakMap();
73
71
  c = /* @__PURE__ */ new WeakMap();
74
- f = /* @__PURE__ */ new WeakMap();
75
- v = /* @__PURE__ */ new WeakMap();
76
- W = /* @__PURE__ */ new WeakSet();
77
- D = function() {
72
+ E = /* @__PURE__ */ new WeakMap();
73
+ l = /* @__PURE__ */ new WeakMap();
74
+ u = /* @__PURE__ */ new WeakMap();
75
+ m = /* @__PURE__ */ new WeakMap();
76
+ $ = /* @__PURE__ */ new WeakSet();
77
+ B = function() {
78
78
  return `${location.pathname}${location.search ? location.search + "&" : "?"}${i(this, _, w)}`;
79
79
  };
80
80
  _ = /* @__PURE__ */ new WeakSet();
81
81
  w = function() {
82
82
  return `modal-${this.id}`;
83
83
  };
84
- g = /* @__PURE__ */ new WeakMap();
85
- E = /* @__PURE__ */ new WeakMap();
86
- k = /* @__PURE__ */ new WeakSet();
87
- M = function(e) {
88
- (a.__opened[i(this, S) - 1] || a.__opened.length === 1) && e();
84
+ y = /* @__PURE__ */ new WeakMap();
85
+ L = /* @__PURE__ */ new WeakMap();
86
+ C = /* @__PURE__ */ new WeakSet();
87
+ P = function(e) {
88
+ (p.__opened[i(this, T) - 1] || p.__opened.length === 1) && e();
89
89
  };
90
- m = /* @__PURE__ */ new WeakMap();
91
- a.__opened = [];
92
- a = z([
93
- A("e-popover")
94
- ], a);
95
- var F = Object.defineProperty, J = Object.getOwnPropertyDescriptor, K = (e, t, s, r) => {
96
- for (var n = r > 1 ? void 0 : r ? J(t, s) : t, p = e.length - 1, d; p >= 0; p--)
97
- (d = e[p]) && (n = (r ? d(t, s, n) : d(n)) || n);
98
- return r && n && F(t, s, n), n;
99
- }, x = (e, t, s) => {
90
+ g = /* @__PURE__ */ new WeakMap();
91
+ p.__opened = [];
92
+ p = V([
93
+ q("e-popover")
94
+ ], p);
95
+ var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, Z = (e, t, s, o) => {
96
+ for (var a = o > 1 ? void 0 : o ? Y(t, s) : t, d = e.length - 1, v; d >= 0; d--)
97
+ (v = e[d]) && (a = (o ? v(t, s, a) : v(a)) || a);
98
+ return o && a && X(t, s, a), a;
99
+ }, G = (e, t, s) => {
100
100
  if (!t.has(e))
101
101
  throw TypeError("Cannot " + s);
102
- }, u = (e, t, s) => (x(e, t, "read from private field"), s ? s.call(e) : t.get(e)), Q = (e, t, s) => {
102
+ }, r = (e, t, s) => (G(e, t, "read from private field"), s ? s.call(e) : t.get(e)), f = (e, t, s) => {
103
103
  if (t.has(e))
104
104
  throw TypeError("Cannot add the same private member more than once");
105
105
  t instanceof WeakSet ? t.add(e) : t.set(e, s);
106
- }, V = (e, t, s, r) => (x(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), l;
107
- const X = R({
106
+ }, j = (e, t, s, o) => (G(e, t, "write to private field"), o ? o.call(e, s) : t.set(e, s), s), n, k, W, M, S;
107
+ const ee = J({
108
108
  button: {
109
109
  all: "inherit"
110
110
  }
111
111
  });
112
- let P = class extends O {
112
+ let I = class extends N {
113
113
  constructor() {
114
- super(), Q(this, l, void 0), this.openShadow(X), q && B(this, {
114
+ super(), f(this, n, void 0), f(this, k, () => {
115
+ this.classList.add("triggered");
116
+ }), f(this, W, () => {
117
+ this.classList.add("opened");
118
+ }), f(this, M, () => {
119
+ this.classList.remove("opened");
120
+ }), f(this, S, () => {
121
+ this.classList.remove("triggered");
122
+ }), this.openShadow(ee), b && U(this, {
115
123
  children: [
116
- G({
124
+ z({
117
125
  onClick: () => {
118
- if (u(this, l)) {
126
+ if (r(this, n)) {
119
127
  const e = this.getAttribute("type") || "open";
120
- e === "open" || e === "toggle" && !u(this, l).opened.current ? u(this, l).open() : (e === "close" || e === "toggle" && u(this, l).opened.current) && u(this, l).close();
128
+ e === "open" || e === "toggle" && !r(this, n).opened.current ? r(this, n).open() : (e === "close" || e === "toggle" && r(this, n).opened.current) && r(this, n).close();
121
129
  }
122
130
  },
123
- children: [H()]
131
+ children: [F()]
124
132
  })
125
133
  ]
126
134
  });
127
135
  }
128
136
  get popoverElement() {
129
- return u(this, l);
137
+ return r(this, n);
130
138
  }
131
139
  connectedCallback() {
132
140
  const e = this.getAttribute("target");
133
141
  if (e) {
134
142
  const t = document.querySelector(`#${e}`) || this.getRootNode().querySelector(`#${e}`);
135
- t ? V(this, l, t) : console.warn(this, `target ${e} not found`);
143
+ t ? (j(this, n, t), r(this, n).addEventListener(
144
+ "popoverTriggered",
145
+ r(this, k)
146
+ ), r(this, n).addEventListener(
147
+ "popoverOpened",
148
+ r(this, W)
149
+ ), r(this, n).addEventListener(
150
+ "popoverClosing",
151
+ r(this, M)
152
+ ), r(this, n).addEventListener(
153
+ "popoverClosed",
154
+ r(this, S)
155
+ )) : console.warn(this, `target ${e} not found`);
136
156
  }
137
157
  }
158
+ disconnectedCallback() {
159
+ r(this, n) && (r(this, n).removeEventListener(
160
+ "popoverTriggered",
161
+ r(this, k)
162
+ ), r(this, n).removeEventListener(
163
+ "popoverOpened",
164
+ r(this, W)
165
+ ), r(this, n).removeEventListener(
166
+ "popoverClosing",
167
+ r(this, M)
168
+ ), r(this, n).removeEventListener(
169
+ "popoverClosed",
170
+ r(this, S)
171
+ ));
172
+ }
138
173
  };
139
- l = /* @__PURE__ */ new WeakMap();
140
- P = K([
141
- A("e-popover-button")
142
- ], P);
174
+ n = /* @__PURE__ */ new WeakMap();
175
+ k = /* @__PURE__ */ new WeakMap();
176
+ W = /* @__PURE__ */ new WeakMap();
177
+ M = /* @__PURE__ */ new WeakMap();
178
+ S = /* @__PURE__ */ new WeakMap();
179
+ I = Z([
180
+ q("e-popover-button")
181
+ ], I);
143
182
  export {
144
- P as PopoverButtonElement,
145
- a as PopoverElement
183
+ I as PopoverButtonElement,
184
+ p as PopoverElement
146
185
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.4.19",
3
+ "version": "0.4.20",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"