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