aptechka 0.30.15 → 0.30.16

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