aptechka 0.50.0 → 0.50.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,5 +1,4 @@
1
1
  import { CSSProperty } from '../css-property';
2
- import { Store } from '../store';
3
2
  export interface PopoverEvents {
4
3
  popoverTriggered: CustomEvent<{
5
4
  trigger: any;
@@ -22,7 +21,7 @@ export declare class PopoverElement extends HTMLElement {
22
21
  get group(): CSSProperty<"">;
23
22
  get clickOutside(): CSSProperty<false>;
24
23
  get escape(): CSSProperty<false>;
25
- get opened(): Store<boolean>;
24
+ get opened(): boolean;
26
25
  get lastTrigger(): any;
27
26
  get idWithValue(): string;
28
27
  updateUrlValue(value?: string | number): void;
@@ -1 +1 @@
1
- "use strict";var K=c=>{throw TypeError(c)};var D=(c,i,t)=>i.has(c)||K("Cannot "+t);var e=(c,i,t)=>(D(c,i,"read from private field"),t?t.call(c):i.get(c)),r=(c,i,t)=>i.has(c)?K("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(c):i.set(c,t),n=(c,i,t,s)=>(D(c,i,"write to private field"),s?s.call(c,t):i.set(c,t),t),B=(c,i,t)=>(D(c,i,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("../class-linked-status/index.cjs"),f=require("../css-property/index.cjs"),ee=require("../Store-DRp_K37w.cjs"),F=require("../index-Cqw2NKev.cjs"),G=require("../events-KVanG9sR.cjs"),te=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs"),Q=require("../url-CLvdjbII.cjs"),X=require("../window-resizer/index.cjs");var l,v,U,j;class ie{constructor(){r(this,l,new Map);r(this,v,[]);r(this,U,i=>{var s;const t=[...e(this,v)].reverse().find(o=>o.clickOutside.current);if(t){const o=i.composedPath();if(o.find(J=>J instanceof HTMLElement&&J.hasAttribute("data-popover-content")))return;const a=o[0],R=a instanceof Node&&(t.contains(a)||((s=t.shadowRoot)==null?void 0:s.contains(a))),_=a instanceof HTMLElement&&a.hasAttribute("data-outside");(!R||_)&&t.close()}});r(this,j,i=>{if(i.code==="Escape"){const t=[...e(this,v)].reverse().find(s=>s.escape.current);t&&t.close()}});addEventListener("click",e(this,U)),addEventListener("keydown",e(this,j))}add(i,t){if(t.closeRest.current)e(this,l).forEach(o=>{o.forEach(a=>{a.close()})});else if(t.closeRestInGroup.current){let o=e(this,l).get(i);o==null||o.forEach(a=>{a.close()})}let s=e(this,l).get(i);s!=null&&s.length||(s=[],e(this,l).set(i,s)),e(this,v).push(t),s.push(t)}remove(i,t){if(n(this,v,e(this,v).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,l).forEach(o=>{o.forEach(a=>s.push(a))}),e(this,l).clear(),s.forEach(o=>o.close())}else if(t.closeRestInGroup.current){const s=e(this,l).get(i);e(this,l).delete(i),s==null||s.forEach(o=>{o.close()})}else{let s=e(this,l).get(i);s&&(s=s.filter(o=>o!==t),e(this,l).set(i,s))}}}l=new WeakMap,v=new WeakMap,U=new WeakMap,j=new WeakMap;var u,x,S,p,m,w,T,g,P,k,b,C,d,E,Y,W,A,q,V,M;const L=class L extends HTMLElement{constructor(){super();r(this,E);r(this,u);r(this,x);r(this,S);r(this,p);r(this,m);r(this,w);r(this,T);r(this,g);r(this,P);r(this,k);r(this,b);r(this,C);r(this,d);r(this,A);r(this,q);r(this,V);r(this,M);this.urlValue="",n(this,u,new ee.Store(!1)),n(this,p,new f.CSSProperty(this,"--history",!1)),n(this,m,new f.CSSProperty(this,"--restore",!1)),n(this,w,new f.CSSProperty(this,"--close-rest",!1)),n(this,T,new f.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new f.CSSProperty(this,"--group","")),n(this,P,new f.CSSProperty(this,"--click-outside",!1)),n(this,k,new f.CSSProperty(this,"--escape",!1)),n(this,b,!1),n(this,d,new N.ClassLinkedStatus(this,{opened:!1,closing:!1,closed:!1,triggered:!1})),n(this,A,()=>{n(this,b,!1),e(this,u).current&&e(this,p).current&&!location.search.includes(this.id)?this.close():!e(this,u).current&&e(this,p).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,b,!0)}),n(this,q,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,V).call(this)}),n(this,V,te.debounce(()=>{e(this,M).call(this)},10)),n(this,M,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")}),e(this,g).subscribe(t=>{t.previous&&L.stack.remove(t.previous,this)})}get history(){return e(this,p)}get restore(){return e(this,m)}get closeRest(){return e(this,w)}get closeRestInGroup(){return e(this,T)}get group(){return e(this,g)}get clickOutside(){return e(this,P)}get escape(){return e(this,k)}get opened(){return e(this,u)}get lastTrigger(){return e(this,C)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,u).current&&Q.updateSearchParameter(this.id,t)}open(t){if(e(this,u).current)return;n(this,C,t==null?void 0:t.trigger),clearTimeout(e(this,x)),e(this,d).set("closing",!1),e(this,d).set("triggered",!0),G.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,C)}}),e(this,p).current&&e(this,b)&&history.pushState(history.state,"",e(this,E,Y)),e(this,u).current=!0;const s=()=>{L.stack.add(e(this,g).current,this),e(this,M).call(this),e(this,d).set("opened",!0),G.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,C)}}),n(this,S,void 0)};t!=null&&t.skipTransition?s():n(this,S,setTimeout(s,10))}close(){e(this,u).current&&(clearTimeout(e(this,S)),L.stack.remove(e(this,g).current,this),e(this,u).current=!1,B(this,E,W).call(this),e(this,d).set("opened",!1),e(this,d).set("closing",!0),G.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,x,setTimeout(()=>{e(this,d).set("triggered",!1),e(this,d).set("closing",!1),G.dispatchEvent(this,"popoverClosed",{custom:!0})},se.getElementTransitionDurationMS(this)+10)))}connectedCallback(){e(this,p).observe(),e(this,m).observe(),e(this,w).observe(),e(this,T).observe(),e(this,g).observe(),e(this,P).observe(),e(this,k).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,A)),setTimeout(()=>{e(this,m).current?(this.urlValue=Q.parseSearchParameters(location.search)[this.id],e(this,A).call(this)):(B(this,E,W).call(this),n(this,b,!0))},0),X.windowResizer.subscribe(e(this,q))}disconnectedCallback(){L.stack.remove(e(this,g).current,this),X.windowResizer.unsubscribe(e(this,q)),e(this,d).close(),e(this,p).close(),e(this,m).close(),e(this,w).close(),e(this,T).close(),e(this,g).close(),e(this,P).close(),e(this,k).close(),this.removeAttribute("role"),clearTimeout(e(this,x)),clearTimeout(e(this,S)),removeEventListener("popstate",e(this,A)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),B(this,E,W).call(this)}};u=new WeakMap,x=new WeakMap,S=new WeakMap,p=new WeakMap,m=new WeakMap,w=new WeakMap,T=new WeakMap,g=new WeakMap,P=new WeakMap,k=new WeakMap,b=new WeakMap,C=new WeakMap,d=new WeakMap,E=new WeakSet,Y=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},W=function(){if(e(this,p).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},A=new WeakMap,q=new WeakMap,V=new WeakMap,M=new WeakMap,L.stack=new ie;let O=L;F.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",O);var h,y,I,$,H,z;class Z extends HTMLElement{constructor(){super();r(this,h);r(this,y,new f.CSSProperty(this,"--type","open"));r(this,I,()=>{this.classList.add("triggered")});r(this,$,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});r(this,H,()=>{this.classList.remove("opened")});r(this,z,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});F.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,y).current;t==="open"||t==="toggle"&&!e(this,h).opened.current?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened.current)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,y)}get popoverElement(){return e(this,h)}connectedCallback(){var s;e(this,y).subscribe(o=>{e(this,h)instanceof O&&(o.current!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened.current?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),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 a=this.closest("[popover-target]");if(a)o=a;else{const R=this.getRootNode();R instanceof ShadowRoot?o=R.host.closest("[popover-target]"):R instanceof HTMLElement&&(o=R.closest("[popover-target]"))}}else t==="sibling"?o=(s=this.parentElement)==null?void 0:s.querySelector("[popover-target]"):o=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);o instanceof HTMLElement?(n(this,h,o),e(this,h).addEventListener("popoverTriggered",e(this,I)),e(this,h).addEventListener("popoverOpened",e(this,$)),e(this,h).addEventListener("popoverClosing",e(this,H)),e(this,h).addEventListener("popoverClosed",e(this,z))):console.warn(this,`target ${t} not found`)}this.isConnected&&e(this,y).observe()}disconnectedCallback(){e(this,y).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,I)),e(this,h).removeEventListener("popoverOpened",e(this,$)),e(this,h).removeEventListener("popoverClosing",e(this,H)),e(this,h).removeEventListener("popoverClosed",e(this,z)))}}h=new WeakMap,y=new WeakMap,I=new WeakMap,$=new WeakMap,H=new WeakMap,z=new WeakMap;F.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",Z);exports.PopoverButtonElement=Z;exports.PopoverElement=O;
1
+ "use strict";var K=c=>{throw TypeError(c)};var D=(c,r,t)=>r.has(c)||K("Cannot "+t);var e=(c,r,t)=>(D(c,r,"read from private field"),t?t.call(c):r.get(c)),o=(c,r,t)=>r.has(c)?K("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(c):r.set(c,t),n=(c,r,t,s)=>(D(c,r,"write to private field"),s?s.call(c,t):r.set(c,t),t),B=(c,r,t)=>(D(c,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../class-linked-status/index.cjs"),v=require("../css-property/index.cjs"),F=require("../index-Cqw2NKev.cjs"),G=require("../events-KVanG9sR.cjs"),ee=require("../function-MthRj-GJ.cjs"),te=require("../style-At6aDoqG.cjs"),Q=require("../url-CLvdjbII.cjs"),X=require("../window-resizer/index.cjs");var l,f,U,j;class se{constructor(){o(this,l,new Map);o(this,f,[]);o(this,U,r=>{var s;const t=[...e(this,f)].reverse().find(i=>i.clickOutside.current);if(t){const i=r.composedPath();if(i.find(J=>J instanceof HTMLElement&&J.hasAttribute("data-popover-content")))return;const a=i[0],R=a instanceof Node&&(t.contains(a)||((s=t.shadowRoot)==null?void 0:s.contains(a))),N=a instanceof HTMLElement&&a.hasAttribute("data-outside");(!R||N)&&t.close()}});o(this,j,r=>{if(r.code==="Escape"){const t=[...e(this,f)].reverse().find(s=>s.escape.current);t&&t.close()}});addEventListener("click",e(this,U)),addEventListener("keydown",e(this,j))}get groups(){return e(this,l)}get stack(){return e(this,f)}add(r,t){if(t.closeRest.current)e(this,l).forEach(i=>{i.forEach(a=>{a.close()})});else if(t.closeRestInGroup.current){let i=e(this,l).get(r);i==null||i.forEach(a=>{a.close()})}let s=e(this,l).get(r);s!=null&&s.length||(s=[],e(this,l).set(r,s)),e(this,f).push(t),s.push(t)}remove(r,t){if(n(this,f,e(this,f).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,l).forEach(i=>{i.forEach(a=>s.push(a))}),e(this,l).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,l).get(r);e(this,l).delete(r),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,l).get(r);s&&(s=s.filter(i=>i!==t),e(this,l).set(r,s))}}}l=new WeakMap,f=new WeakMap,U=new WeakMap,j=new WeakMap;var d,x,S,p,b,w,T,g,k,P,E,C,u,L,Y,W,A,$,O,q;const m=class m extends HTMLElement{constructor(){super();o(this,L);o(this,d);o(this,x);o(this,S);o(this,p);o(this,b);o(this,w);o(this,T);o(this,g);o(this,k);o(this,P);o(this,E);o(this,C);o(this,u);o(this,A);o(this,$);o(this,O);o(this,q);this.urlValue="",n(this,d,!1),n(this,p,new v.CSSProperty(this,"--history",!1)),n(this,b,new v.CSSProperty(this,"--restore",!1)),n(this,w,new v.CSSProperty(this,"--close-rest",!1)),n(this,T,new v.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new v.CSSProperty(this,"--group","")),n(this,k,new v.CSSProperty(this,"--click-outside",!1)),n(this,P,new v.CSSProperty(this,"--escape",!1)),n(this,E,!1),n(this,u,new _.ClassLinkedStatus(this,{opened:!1,closing:!1,triggered:!1})),n(this,A,()=>{n(this,E,!1),e(this,d)&&e(this,p).current&&!location.search.includes(this.id)?this.close():!e(this,d)&&e(this,p).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,E,!0)}),n(this,$,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,O).call(this)}),n(this,O,ee.debounce(()=>{e(this,q).call(this)},10)),n(this,q,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")}),e(this,g).subscribe(t=>{t.previous&&(m.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,u).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=m.stack.groups.get(this.group.current),i=s==null?void 0:s.find(a=>a.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get history(){return e(this,p)}get restore(){return e(this,b)}get closeRest(){return e(this,w)}get closeRestInGroup(){return e(this,T)}get group(){return e(this,g)}get clickOutside(){return e(this,k)}get escape(){return e(this,P)}get opened(){return e(this,d)}get lastTrigger(){return e(this,C)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,d)&&Q.updateSearchParameter(this.id,t)}open(t){if(e(this,d))return;n(this,C,t==null?void 0:t.trigger),clearTimeout(e(this,x)),e(this,u).set("closing",!1),e(this,u).set("triggered",!0),G.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,C)}}),e(this,p).current&&e(this,E)&&history.pushState(history.state,"",e(this,L,Y)),n(this,d,!0);const s=()=>{m.stack.add(e(this,g).current,this),e(this,q).call(this),e(this,u).set("opened",!0),G.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,C)}}),n(this,S,void 0)};t!=null&&t.skipTransition?s():n(this,S,setTimeout(s,10))}close(){e(this,d)&&(clearTimeout(e(this,S)),m.stack.remove(e(this,g).current,this),n(this,d,!1),B(this,L,W).call(this),e(this,u).set("opened",!1),e(this,u).set("closing",!0),G.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,x,setTimeout(()=>{e(this,u).set("triggered",!1),e(this,u).set("closing",!1),G.dispatchEvent(this,"popoverClosed",{custom:!0})},te.getElementTransitionDurationMS(this)+10)))}connectedCallback(){e(this,p).observe(),e(this,b).observe(),e(this,w).observe(),e(this,T).observe(),e(this,g).observe(),e(this,k).observe(),e(this,P).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,A)),setTimeout(()=>{e(this,b).current?(this.urlValue=Q.parseSearchParameters(location.search)[this.id],e(this,A).call(this)):(B(this,L,W).call(this),n(this,E,!0))},0),X.windowResizer.subscribe(e(this,$))}disconnectedCallback(){m.stack.remove(e(this,g).current,this),X.windowResizer.unsubscribe(e(this,$)),e(this,u).close(),e(this,p).close(),e(this,b).close(),e(this,w).close(),e(this,T).close(),e(this,g).close(),e(this,k).close(),e(this,P).close(),this.removeAttribute("role"),clearTimeout(e(this,x)),clearTimeout(e(this,S)),removeEventListener("popstate",e(this,A)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),B(this,L,W).call(this)}};d=new WeakMap,x=new WeakMap,S=new WeakMap,p=new WeakMap,b=new WeakMap,w=new WeakMap,T=new WeakMap,g=new WeakMap,k=new WeakMap,P=new WeakMap,E=new WeakMap,C=new WeakMap,u=new WeakMap,L=new WeakSet,Y=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},W=function(){if(e(this,p).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},A=new WeakMap,$=new WeakMap,O=new WeakMap,q=new WeakMap,m.stack=new se;let M=m;F.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",M);var h,y,V,I,H,z;class Z extends HTMLElement{constructor(){super();o(this,h);o(this,y,new v.CSSProperty(this,"--type","open"));o(this,V,()=>{this.classList.add("triggered")});o(this,I,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});o(this,H,()=>{this.classList.remove("opened")});o(this,z,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});F.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,y).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,y)}get popoverElement(){return e(this,h)}connectedCallback(){var s;e(this,y).subscribe(i=>{e(this,h)instanceof M&&(i.current!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let i=null;if(t==="parent"){const a=this.closest("[popover-target]");if(a)i=a;else{const R=this.getRootNode();R instanceof ShadowRoot?i=R.host.closest("[popover-target]"):R instanceof HTMLElement&&(i=R.closest("[popover-target]"))}}else t==="sibling"?i=(s=this.parentElement)==null?void 0:s.querySelector("[popover-target]"):i=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);i instanceof HTMLElement?(n(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,V)),e(this,h).addEventListener("popoverOpened",e(this,I)),e(this,h).addEventListener("popoverClosing",e(this,H)),e(this,h).addEventListener("popoverClosed",e(this,z))):console.warn(this,`target ${t} not found`)}this.isConnected&&e(this,y).observe()}disconnectedCallback(){e(this,y).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,V)),e(this,h).removeEventListener("popoverOpened",e(this,I)),e(this,h).removeEventListener("popoverClosing",e(this,H)),e(this,h).removeEventListener("popoverClosed",e(this,z)))}}h=new WeakMap,y=new WeakMap,V=new WeakMap,I=new WeakMap,H=new WeakMap,z=new WeakMap;F.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",Z);exports.PopoverButtonElement=Z;exports.PopoverElement=M;
@@ -1,134 +1,154 @@
1
1
  var K = (c) => {
2
2
  throw TypeError(c);
3
3
  };
4
- var j = (c, i, t) => i.has(c) || K("Cannot " + t);
5
- var e = (c, i, t) => (j(c, i, "read from private field"), t ? t.call(c) : i.get(c)), r = (c, i, t) => i.has(c) ? K("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(c) : i.set(c, t), h = (c, i, t, s) => (j(c, i, "write to private field"), s ? s.call(c, t) : i.set(c, t), t), z = (c, i, t) => (j(c, i, "access private method"), t);
4
+ var j = (c, r, t) => r.has(c) || K("Cannot " + t);
5
+ var e = (c, r, t) => (j(c, r, "read from private field"), t ? t.call(c) : r.get(c)), o = (c, r, t) => r.has(c) ? K("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(c) : r.set(c, t), h = (c, r, t, s) => (j(c, r, "write to private field"), s ? s.call(c, t) : r.set(c, t), t), z = (c, r, t) => (j(c, r, "access private method"), t);
6
6
  import { ClassLinkedStatus as Z } from "../class-linked-status/index.js";
7
- import { CSSProperty as g } from "../css-property/index.js";
8
- import { S as N } from "../Store-D2xCXENW.js";
7
+ import { CSSProperty as m } from "../css-property/index.js";
9
8
  import { i as F } from "../index-euf5anj6.js";
10
9
  import { d as W } from "../events-CsVF98U6.js";
11
- import { d as _ } from "../function-C10DGppn.js";
12
- import { g as ee } from "../style-j2TwriJ_.js";
13
- import { u as te, p as se } from "../url-CfcHdBT6.js";
10
+ import { d as N } from "../function-C10DGppn.js";
11
+ import { g as _ } from "../style-j2TwriJ_.js";
12
+ import { u as ee, p as te } from "../url-CfcHdBT6.js";
14
13
  import { windowResizer as Q } from "../window-resizer/index.js";
15
- var l, v, U, D;
16
- class ie {
14
+ var l, f, U, D;
15
+ class se {
17
16
  constructor() {
18
- r(this, l, /* @__PURE__ */ new Map());
19
- r(this, v, []);
20
- r(this, U, (i) => {
17
+ o(this, l, /* @__PURE__ */ new Map());
18
+ o(this, f, []);
19
+ o(this, U, (r) => {
21
20
  var s;
22
- const t = [...e(this, v)].reverse().find((o) => o.clickOutside.current);
21
+ const t = [...e(this, f)].reverse().find((i) => i.clickOutside.current);
23
22
  if (t) {
24
- const o = i.composedPath();
25
- if (o.find(
23
+ const i = r.composedPath();
24
+ if (i.find(
26
25
  (J) => J instanceof HTMLElement && J.hasAttribute("data-popover-content")
27
26
  ))
28
27
  return;
29
- const a = o[0], P = a instanceof Node && (t.contains(a) || ((s = t.shadowRoot) == null ? void 0 : s.contains(a))), Y = a instanceof HTMLElement && a.hasAttribute("data-outside");
28
+ const a = i[0], P = a instanceof Node && (t.contains(a) || ((s = t.shadowRoot) == null ? void 0 : s.contains(a))), Y = a instanceof HTMLElement && a.hasAttribute("data-outside");
30
29
  (!P || Y) && t.close();
31
30
  }
32
31
  });
33
- r(this, D, (i) => {
34
- if (i.code === "Escape") {
35
- const t = [...e(this, v)].reverse().find((s) => s.escape.current);
32
+ o(this, D, (r) => {
33
+ if (r.code === "Escape") {
34
+ const t = [...e(this, f)].reverse().find((s) => s.escape.current);
36
35
  t && t.close();
37
36
  }
38
37
  });
39
38
  addEventListener("click", e(this, U)), addEventListener("keydown", e(this, D));
40
39
  }
41
- add(i, t) {
40
+ get groups() {
41
+ return e(this, l);
42
+ }
43
+ get stack() {
44
+ return e(this, f);
45
+ }
46
+ add(r, t) {
42
47
  if (t.closeRest.current)
43
- e(this, l).forEach((o) => {
44
- o.forEach((a) => {
48
+ e(this, l).forEach((i) => {
49
+ i.forEach((a) => {
45
50
  a.close();
46
51
  });
47
52
  });
48
53
  else if (t.closeRestInGroup.current) {
49
- let o = e(this, l).get(i);
50
- o == null || o.forEach((a) => {
54
+ let i = e(this, l).get(r);
55
+ i == null || i.forEach((a) => {
51
56
  a.close();
52
57
  });
53
58
  }
54
- let s = e(this, l).get(i);
55
- s != null && s.length || (s = [], e(this, l).set(i, s)), e(this, v).push(t), s.push(t);
59
+ let s = e(this, l).get(r);
60
+ s != null && s.length || (s = [], e(this, l).set(r, s)), e(this, f).push(t), s.push(t);
56
61
  }
57
- remove(i, t) {
58
- if (h(this, v, e(this, v).filter((s) => s !== t)), t.closeRest.current) {
62
+ remove(r, t) {
63
+ if (h(this, f, e(this, f).filter((s) => s !== t)), t.closeRest.current) {
59
64
  let s = [];
60
- e(this, l).forEach((o) => {
61
- o.forEach((a) => s.push(a));
62
- }), e(this, l).clear(), s.forEach((o) => o.close());
65
+ e(this, l).forEach((i) => {
66
+ i.forEach((a) => s.push(a));
67
+ }), e(this, l).clear(), s.forEach((i) => i.close());
63
68
  } else if (t.closeRestInGroup.current) {
64
- const s = e(this, l).get(i);
65
- e(this, l).delete(i), s == null || s.forEach((o) => {
66
- o.close();
69
+ const s = e(this, l).get(r);
70
+ e(this, l).delete(r), s == null || s.forEach((i) => {
71
+ i.close();
67
72
  });
68
73
  } else {
69
- let s = e(this, l).get(i);
70
- s && (s = s.filter((o) => o !== t), e(this, l).set(i, s));
74
+ let s = e(this, l).get(r);
75
+ s && (s = s.filter((i) => i !== t), e(this, l).set(r, s));
71
76
  }
72
77
  }
73
78
  }
74
- l = new WeakMap(), v = new WeakMap(), U = new WeakMap(), D = new WeakMap();
75
- var u, x, T, d, m, w, k, f, A, S, b, C, p, L, X, q, R, V, M, I;
76
- const y = class y extends HTMLElement {
79
+ l = new WeakMap(), f = new WeakMap(), U = new WeakMap(), D = new WeakMap();
80
+ var p, x, T, d, b, k, w, g, A, S, E, C, u, y, X, q, R, $, I, V;
81
+ const v = class v extends HTMLElement {
77
82
  constructor() {
78
83
  super();
79
- r(this, L);
80
- r(this, u);
81
- r(this, x);
82
- r(this, T);
83
- r(this, d);
84
- r(this, m);
85
- r(this, w);
86
- r(this, k);
87
- r(this, f);
88
- r(this, A);
89
- r(this, S);
90
- r(this, b);
91
- r(this, C);
92
- r(this, p);
93
- r(this, R);
94
- r(this, V);
95
- r(this, M);
96
- r(this, I);
97
- this.urlValue = "", h(this, u, new N(!1)), h(this, d, new g(this, "--history", !1)), h(this, m, new g(this, "--restore", !1)), h(this, w, new g(this, "--close-rest", !1)), h(this, k, new g(
84
+ o(this, y);
85
+ o(this, p);
86
+ o(this, x);
87
+ o(this, T);
88
+ o(this, d);
89
+ o(this, b);
90
+ o(this, k);
91
+ o(this, w);
92
+ o(this, g);
93
+ o(this, A);
94
+ o(this, S);
95
+ o(this, E);
96
+ o(this, C);
97
+ o(this, u);
98
+ o(this, R);
99
+ o(this, $);
100
+ o(this, I);
101
+ o(this, V);
102
+ this.urlValue = "", h(this, p, !1), h(this, d, new m(this, "--history", !1)), h(this, b, new m(this, "--restore", !1)), h(this, k, new m(this, "--close-rest", !1)), h(this, w, new m(
98
103
  this,
99
104
  "--close-rest-in-group",
100
105
  !1
101
- )), h(this, f, new g(this, "--group", "")), h(this, A, new g(this, "--click-outside", !1)), h(this, S, new g(this, "--escape", !1)), h(this, b, !1), h(this, p, new Z(this, {
106
+ )), h(this, g, new m(this, "--group", "")), h(this, A, new m(this, "--click-outside", !1)), h(this, S, new m(this, "--escape", !1)), h(this, E, !1), h(this, u, new Z(this, {
102
107
  opened: !1,
103
108
  closing: !1,
104
- closed: !1,
105
109
  triggered: !1
106
110
  })), h(this, R, () => {
107
- h(this, b, !1), e(this, u).current && e(this, d).current && !location.search.includes(this.id) ? this.close() : !e(this, u).current && e(this, d).current && location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), h(this, b, !0);
108
- }), h(this, V, () => {
109
- this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this, M).call(this);
110
- }), h(this, M, _(() => {
111
- e(this, I).call(this);
112
- }, 10)), h(this, I, () => {
111
+ h(this, E, !1), e(this, p) && e(this, d).current && !location.search.includes(this.id) ? this.close() : !e(this, p) && e(this, d).current && location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), h(this, E, !0);
112
+ }), h(this, $, () => {
113
+ this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this, I).call(this);
114
+ }), h(this, I, N(() => {
115
+ e(this, V).call(this);
116
+ }, 10)), h(this, V, () => {
113
117
  this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px");
114
- }), e(this, f).subscribe((t) => {
115
- t.previous && y.stack.remove(t.previous, this);
118
+ }), e(this, g).subscribe((t) => {
119
+ t.previous && (v.stack.remove(t.previous, this), t.current || (document.documentElement.classList.remove(
120
+ `${this.group.previous}-closing`
121
+ ), document.documentElement.classList.remove(
122
+ `${this.group.previous}-opened`
123
+ )));
124
+ }), e(this, u).subscribe((t) => {
125
+ if (this.group.current) {
126
+ document.documentElement.classList.toggle(
127
+ `${this.group.current}-closing`,
128
+ t.current.closing
129
+ );
130
+ const s = v.stack.groups.get(this.group.current), i = s == null ? void 0 : s.find((a) => a.opened);
131
+ document.documentElement.classList.toggle(
132
+ `${this.group.current}-opened`,
133
+ !!i
134
+ );
135
+ }
116
136
  });
117
137
  }
118
138
  get history() {
119
139
  return e(this, d);
120
140
  }
121
141
  get restore() {
122
- return e(this, m);
142
+ return e(this, b);
123
143
  }
124
144
  get closeRest() {
125
- return e(this, w);
145
+ return e(this, k);
126
146
  }
127
147
  get closeRestInGroup() {
128
- return e(this, k);
148
+ return e(this, w);
129
149
  }
130
150
  get group() {
131
- return e(this, f);
151
+ return e(this, g);
132
152
  }
133
153
  get clickOutside() {
134
154
  return e(this, A);
@@ -137,7 +157,7 @@ const y = class y extends HTMLElement {
137
157
  return e(this, S);
138
158
  }
139
159
  get opened() {
140
- return e(this, u);
160
+ return e(this, p);
141
161
  }
142
162
  get lastTrigger() {
143
163
  return e(this, C);
@@ -146,19 +166,19 @@ const y = class y extends HTMLElement {
146
166
  return `${this.id}${this.urlValue ? "=" + this.urlValue : ""}`;
147
167
  }
148
168
  updateUrlValue(t) {
149
- this.urlValue = (t == null ? void 0 : t.toString()) || "", e(this, u).current && te(this.id, t);
169
+ this.urlValue = (t == null ? void 0 : t.toString()) || "", e(this, p) && ee(this.id, t);
150
170
  }
151
171
  open(t) {
152
- if (e(this, u).current)
172
+ if (e(this, p))
153
173
  return;
154
- h(this, C, t == null ? void 0 : t.trigger), clearTimeout(e(this, x)), e(this, p).set("closing", !1), e(this, p).set("triggered", !0), W(this, "popoverTriggered", {
174
+ h(this, C, t == null ? void 0 : t.trigger), clearTimeout(e(this, x)), e(this, u).set("closing", !1), e(this, u).set("triggered", !0), W(this, "popoverTriggered", {
155
175
  custom: !0,
156
176
  detail: {
157
177
  trigger: e(this, C)
158
178
  }
159
- }), e(this, d).current && e(this, b) && history.pushState(history.state, "", e(this, L, X)), e(this, u).current = !0;
179
+ }), e(this, d).current && e(this, E) && history.pushState(history.state, "", e(this, y, X)), h(this, p, !0);
160
180
  const s = () => {
161
- y.stack.add(e(this, f).current, this), e(this, I).call(this), e(this, p).set("opened", !0), W(this, "popoverOpened", {
181
+ v.stack.add(e(this, g).current, this), e(this, V).call(this), e(this, u).set("opened", !0), W(this, "popoverOpened", {
162
182
  custom: !0,
163
183
  detail: {
164
184
  trigger: e(this, C)
@@ -168,92 +188,92 @@ const y = class y extends HTMLElement {
168
188
  t != null && t.skipTransition ? s() : h(this, T, setTimeout(s, 10));
169
189
  }
170
190
  close() {
171
- e(this, u).current && (clearTimeout(e(this, T)), y.stack.remove(e(this, f).current, this), e(this, u).current = !1, z(this, L, q).call(this), e(this, p).set("opened", !1), e(this, p).set("closing", !0), W(this, "popoverClosing", {
191
+ e(this, p) && (clearTimeout(e(this, T)), v.stack.remove(e(this, g).current, this), h(this, p, !1), z(this, y, q).call(this), e(this, u).set("opened", !1), e(this, u).set("closing", !0), W(this, "popoverClosing", {
172
192
  custom: !0
173
193
  }), h(this, x, setTimeout(() => {
174
- e(this, p).set("triggered", !1), e(this, p).set("closing", !1), W(this, "popoverClosed", {
194
+ e(this, u).set("triggered", !1), e(this, u).set("closing", !1), W(this, "popoverClosed", {
175
195
  custom: !0
176
196
  });
177
- }, ee(this) + 10)));
197
+ }, _(this) + 10)));
178
198
  }
179
199
  connectedCallback() {
180
- e(this, d).observe(), e(this, m).observe(), e(this, w).observe(), e(this, k).observe(), e(this, f).observe(), e(this, A).observe(), e(this, S).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", e(this, R)), setTimeout(() => {
181
- e(this, m).current ? (this.urlValue = se(location.search)[this.id], e(this, R).call(this)) : (z(this, L, q).call(this), h(this, b, !0));
182
- }, 0), Q.subscribe(e(this, V));
200
+ e(this, d).observe(), e(this, b).observe(), e(this, k).observe(), e(this, w).observe(), e(this, g).observe(), e(this, A).observe(), e(this, S).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", e(this, R)), setTimeout(() => {
201
+ e(this, b).current ? (this.urlValue = te(location.search)[this.id], e(this, R).call(this)) : (z(this, y, q).call(this), h(this, E, !0));
202
+ }, 0), Q.subscribe(e(this, $));
183
203
  }
184
204
  disconnectedCallback() {
185
- y.stack.remove(e(this, f).current, this), Q.unsubscribe(e(this, V)), e(this, p).close(), e(this, d).close(), e(this, m).close(), e(this, w).close(), e(this, k).close(), e(this, f).close(), e(this, A).close(), e(this, S).close(), this.removeAttribute("role"), clearTimeout(e(this, x)), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, R)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), z(this, L, q).call(this);
205
+ v.stack.remove(e(this, g).current, this), Q.unsubscribe(e(this, $)), e(this, u).close(), e(this, d).close(), e(this, b).close(), e(this, k).close(), e(this, w).close(), e(this, g).close(), e(this, A).close(), e(this, S).close(), this.removeAttribute("role"), clearTimeout(e(this, x)), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, R)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), z(this, y, q).call(this);
186
206
  }
187
207
  };
188
- u = new WeakMap(), x = new WeakMap(), T = new WeakMap(), d = new WeakMap(), m = new WeakMap(), w = new WeakMap(), k = new WeakMap(), f = new WeakMap(), A = new WeakMap(), S = new WeakMap(), b = new WeakMap(), C = new WeakMap(), p = new WeakMap(), L = new WeakSet(), X = function() {
208
+ p = new WeakMap(), x = new WeakMap(), T = new WeakMap(), d = new WeakMap(), b = new WeakMap(), k = new WeakMap(), w = new WeakMap(), g = new WeakMap(), A = new WeakMap(), S = new WeakMap(), E = new WeakMap(), C = new WeakMap(), u = new WeakMap(), y = new WeakSet(), X = function() {
189
209
  return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
190
210
  }, q = function() {
191
211
  if (e(this, d).current) {
192
212
  const t = new URL(location.href);
193
213
  t.searchParams.delete(this.id), history.replaceState(history.state, "", t.href);
194
214
  }
195
- }, R = new WeakMap(), V = new WeakMap(), M = new WeakMap(), I = new WeakMap(), y.stack = new ie();
196
- let B = y;
215
+ }, R = new WeakMap(), $ = new WeakMap(), I = new WeakMap(), V = new WeakMap(), v.stack = new se();
216
+ let B = v;
197
217
  F && !customElements.get("e-popover") && customElements.define("e-popover", B);
198
- var n, E, O, $, H, G;
199
- class re extends HTMLElement {
218
+ var n, L, M, O, H, G;
219
+ class ie extends HTMLElement {
200
220
  constructor() {
201
221
  super();
202
- r(this, n);
203
- r(this, E, new g(this, "--type", "open"));
204
- r(this, O, () => {
222
+ o(this, n);
223
+ o(this, L, new m(this, "--type", "open"));
224
+ o(this, M, () => {
205
225
  this.classList.add("triggered");
206
226
  });
207
- r(this, $, () => {
227
+ o(this, O, () => {
208
228
  this.classList.add("opened"), this.setAttribute("aria-expanded", "true");
209
229
  });
210
- r(this, H, () => {
230
+ o(this, H, () => {
211
231
  this.classList.remove("opened");
212
232
  });
213
- r(this, G, () => {
233
+ o(this, G, () => {
214
234
  this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false");
215
235
  });
216
236
  F && (this.addEventListener("click", () => {
217
237
  if (e(this, n)) {
218
- const t = e(this, E).current;
219
- t === "open" || t === "toggle" && !e(this, n).opened.current ? e(this, n).open({ trigger: this }) : (t === "close" || t === "toggle" && e(this, n).opened.current) && e(this, n).close();
238
+ const t = e(this, L).current;
239
+ t === "open" || t === "toggle" && !e(this, n).opened ? e(this, n).open({ trigger: this }) : (t === "close" || t === "toggle" && e(this, n).opened) && e(this, n).close();
220
240
  }
221
241
  }), this.addEventListener("keydown", (t) => {
222
242
  t.code === "Space" && t.currentTarget.click();
223
243
  }));
224
244
  }
225
245
  get type() {
226
- return e(this, E);
246
+ return e(this, L);
227
247
  }
228
248
  get popoverElement() {
229
249
  return e(this, n);
230
250
  }
231
251
  connectedCallback() {
232
252
  var s;
233
- e(this, E).subscribe((o) => {
234
- e(this, n) instanceof B && (o.current !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
253
+ e(this, L).subscribe((i) => {
254
+ e(this, n) instanceof B && (i.current !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
235
255
  "aria-expanded",
236
- e(this, n).opened.current ? "true" : "false"
256
+ e(this, n).opened ? "true" : "false"
237
257
  ), this.setAttribute("aria-controls", e(this, n).id || "")) : (this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
238
258
  }), this.hasAttribute("tabindex") || (this.tabIndex = 0);
239
259
  const t = this.getAttribute("target");
240
260
  if (t) {
241
- let o = null;
261
+ let i = null;
242
262
  if (t === "parent") {
243
263
  const a = this.closest("[popover-target]");
244
264
  if (a)
245
- o = a;
265
+ i = a;
246
266
  else {
247
267
  const P = this.getRootNode();
248
- P instanceof ShadowRoot ? o = P.host.closest("[popover-target]") : P instanceof HTMLElement && (o = P.closest("[popover-target]"));
268
+ P instanceof ShadowRoot ? i = P.host.closest("[popover-target]") : P instanceof HTMLElement && (i = P.closest("[popover-target]"));
249
269
  }
250
- } else t === "sibling" ? o = (s = this.parentElement) == null ? void 0 : s.querySelector("[popover-target]") : o = document.querySelector(`#${t}`) || this.getRootNode().querySelector(`#${t}`);
251
- o instanceof HTMLElement ? (h(this, n, o), e(this, n).addEventListener(
270
+ } else t === "sibling" ? i = (s = this.parentElement) == null ? void 0 : s.querySelector("[popover-target]") : i = document.querySelector(`#${t}`) || this.getRootNode().querySelector(`#${t}`);
271
+ i instanceof HTMLElement ? (h(this, n, i), e(this, n).addEventListener(
252
272
  "popoverTriggered",
253
- e(this, O)
273
+ e(this, M)
254
274
  ), e(this, n).addEventListener(
255
275
  "popoverOpened",
256
- e(this, $)
276
+ e(this, O)
257
277
  ), e(this, n).addEventListener(
258
278
  "popoverClosing",
259
279
  e(this, H)
@@ -262,15 +282,15 @@ class re extends HTMLElement {
262
282
  e(this, G)
263
283
  )) : console.warn(this, `target ${t} not found`);
264
284
  }
265
- this.isConnected && e(this, E).observe();
285
+ this.isConnected && e(this, L).observe();
266
286
  }
267
287
  disconnectedCallback() {
268
- e(this, E).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), e(this, n) && (e(this, n).removeEventListener(
288
+ e(this, L).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), e(this, n) && (e(this, n).removeEventListener(
269
289
  "popoverTriggered",
270
- e(this, O)
290
+ e(this, M)
271
291
  ), e(this, n).removeEventListener(
272
292
  "popoverOpened",
273
- e(this, $)
293
+ e(this, O)
274
294
  ), e(this, n).removeEventListener(
275
295
  "popoverClosing",
276
296
  e(this, H)
@@ -280,9 +300,9 @@ class re extends HTMLElement {
280
300
  ));
281
301
  }
282
302
  }
283
- n = new WeakMap(), E = new WeakMap(), O = new WeakMap(), $ = new WeakMap(), H = new WeakMap(), G = new WeakMap();
284
- F && !customElements.get("e-popover-button") && customElements.define("e-popover-button", re);
303
+ n = new WeakMap(), L = new WeakMap(), M = new WeakMap(), O = new WeakMap(), H = new WeakMap(), G = new WeakMap();
304
+ F && !customElements.get("e-popover-button") && customElements.define("e-popover-button", ie);
285
305
  export {
286
- re as PopoverButtonElement,
306
+ ie as PopoverButtonElement,
287
307
  B as PopoverElement
288
308
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.50.0",
3
+ "version": "0.50.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"