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