aptechka 0.33.0 → 0.33.1

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