aptechka 0.69.3 → 0.69.5
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/PopoverElement.d.ts +1 -0
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +141 -138
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +1 -1
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ export declare class PopoverElement extends HTMLElement {
|
|
|
15
15
|
urlValue: string;
|
|
16
16
|
constructor();
|
|
17
17
|
get openClass(): string | null;
|
|
18
|
+
get closingClass(): string | null;
|
|
18
19
|
get history(): CSSProperty<false>;
|
|
19
20
|
get restore(): CSSProperty<false>;
|
|
20
21
|
get closeRest(): CSSProperty<boolean>;
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var re=c=>{throw TypeError(c)};var _=(c,n,t)=>n.has(c)||re("Cannot "+t);var e=(c,n,t)=>(_(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?re("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(_(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),y=(c,n,t)=>(_(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ae=require("../element-linked-store/index.cjs"),g=require("../css-property/index.cjs"),se=require("../index-DekP7OZe.cjs"),J=require("../events-KVanG9sR.cjs"),ue=require("../function-MthRj-GJ.cjs"),oe=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ne=require("../url-BT4fssbO.cjs"),he=require("../window-resizer/index.cjs"),K=require("../Viewport-DB0qAZPJ.cjs");var u,b,Z,N;class pe{constructor(){r(this,u,new Map);r(this,b,[]);r(this,Z,n=>{var s;const t=[...e(this,b)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(ie=>ie instanceof HTMLElement&&ie.hasAttribute("data-popover-content")))return;const l=i[0],p=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),G=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!p||G)&&t.close()}});r(this,N,n=>{if(n.code==="Escape"){const t=[...e(this,b)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,Z)),addEventListener("keydown",e(this,N))}get groups(){return e(this,u)}get stack(){return e(this,b)}add(n,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,u).get(n);s!=null&&s.length||(s=[],e(this,u).set(n,s)),e(this,b).push(t),s.push(t)}remove(n,t){if(o(this,b,e(this,b).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(n);e(this,u).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(n);s&&(s=s.filter(i=>i!==t),e(this,u).set(n,s))}}}u=new WeakMap,b=new WeakMap,Z=new WeakMap,N=new WeakMap;var f,M,B,C,H,v,w,A,x,m,R,q,L,S,$,a,O,z,P,ce,Q,V,T,U,j,W;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,M);r(this,B);r(this,C);r(this,H);r(this,v);r(this,w);r(this,A);r(this,x);r(this,m);r(this,R);r(this,q);r(this,L);r(this,S);r(this,$);r(this,a);r(this,O);r(this,z);r(this,V);r(this,T);r(this,U);r(this,j);r(this,W);this.urlValue="",o(this,f,!1),o(this,v,new g.CSSProperty(this,"--history",!1)),o(this,w,new g.CSSProperty(this,"--restore",!1)),o(this,A,new g.CSSProperty(this,"--close-rest",!1)),o(this,x,new g.CSSProperty(this,"--close-rest-in-group",!1)),o(this,m,new g.CSSProperty(this,"--group","")),o(this,R,new g.CSSProperty(this,"--click-outside",!1)),o(this,q,new g.CSSProperty(this,"--escape",!1)),o(this,L,new g.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,S,!1),o(this,a,new ae.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),o(this,O,[]),o(this,z,[]),o(this,V,()=>{o(this,S,!1),e(this,f)&&e(this,v).current&&!location.search.includes(this.id)?this.close():!e(this,f)&&e(this,v).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,S,!0)}),o(this,T,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,U).call(this)}),o(this,U,ue.debounce(()=>{e(this,j).call(this)},10)),o(this,j,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,L).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>K.viewport.width?s=K.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>K.viewport.height?i=K.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,W,()=>{this.close()}),e(this,m).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),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get history(){return e(this,v)}get restore(){return e(this,w)}get closeRest(){return e(this,A)}get closeRestInGroup(){return e(this,x)}get group(){return e(this,m)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,f)}get lastTrigger(){return e(this,$)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,f)&&ne.updateSearchParameter(this.id,t)}open(t){if(e(this,f))return;o(this,$,t==null?void 0:t.trigger),clearTimeout(e(this,M)),clearTimeout(e(this,B)),this.openClass&&this.openClass.split(" ").map(i=>{document.documentElement.classList.add(i.trim())}),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),J.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,$)}}),e(this,v).current&&e(this,S)&&history.pushState(history.state,"",e(this,P,ce)),o(this,f,!0);const s=()=>{E.stack.add(e(this,m).current,this),e(this,z).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),e(this,T).call(this),e(this,a).set("opened",!0),J.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,$)},bubbles:!0}),o(this,C,void 0),o(this,H,setTimeout(()=>{e(this,a).set("transitionend",!0)},oe.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,C,setTimeout(s,10))}close(){e(this,f)&&(o(this,f,!1),clearTimeout(e(this,C)),clearTimeout(e(this,H)),E.stack.remove(e(this,m).current,this),y(this,P,Q).call(this),this.openClass&&this.openClass.split(" ").map(t=>{document.documentElement.classList.remove(t.trim())}),e(this,a).set("transitionend",!1),o(this,M,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),J.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,B,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),J.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},oe.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,O,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,O).forEach(t=>{t.addEventListener("click",e(this,W))}),o(this,z,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,v).observe(),e(this,w).observe(),e(this,A).observe(),e(this,x).observe(),e(this,m).observe(),e(this,R).observe(),e(this,q).observe(),e(this,L).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,V)),setTimeout(()=>{e(this,w).current?(this.urlValue=ne.parseSearchParameters(location.search)[this.id],e(this,V).call(this)):(y(this,P,Q).call(this),o(this,S,!0))},0),e(this,L).subscribe(()=>{e(this,T).call(this)}),he.windowResizer.subscribe(e(this,T))}disconnectedCallback(){e(this,O).forEach(t=>{t.removeEventListener("click",e(this,W))}),E.stack.remove(e(this,m).current,this),he.windowResizer.unsubscribe(e(this,T)),e(this,a).close(),e(this,v).close(),e(this,w).close(),e(this,A).close(),e(this,x).close(),e(this,m).close(),e(this,R).close(),e(this,q).close(),e(this,L).close(),this.removeAttribute("role"),clearTimeout(e(this,M)),clearTimeout(e(this,B)),clearTimeout(e(this,C)),clearTimeout(e(this,H)),removeEventListener("popstate",e(this,V)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),y(this,P,Q).call(this)}};f=new WeakMap,M=new WeakMap,B=new WeakMap,C=new WeakMap,H=new WeakMap,v=new WeakMap,w=new WeakMap,A=new WeakMap,x=new WeakMap,m=new WeakMap,R=new WeakMap,q=new WeakMap,L=new WeakMap,S=new WeakMap,$=new WeakMap,a=new WeakMap,O=new WeakMap,z=new WeakMap,P=new WeakSet,ce=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},Q=function(){if(e(this,v).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},V=new WeakMap,T=new WeakMap,U=new WeakMap,j=new WeakMap,W=new WeakMap,E.stack=new pe;let D=E;se.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",D);var h,d,k,ee,X,Y,F,I,te;class le extends HTMLElement{constructor(){super();r(this,k);r(this,h);r(this,d,new g.CSSProperty(this,"--type","open"));r(this,X,()=>{e(this,d).current!=="close"&&this.classList.add("triggered")});r(this,Y,()=>{e(this,d).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,F,()=>{e(this,d).current!=="close"&&this.classList.remove("opened")});r(this,I,()=>{e(this,d).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});se.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"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,d)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(y(this,k,ee).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const p=this.getRootNode();p instanceof ShadowRoot?i=p.host.closest("[data-popover]"):p instanceof HTMLElement&&(i=p.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=p=>{if(!p)return null;let G=p.querySelector("[data-popover]");return!G&&(p!=null&&p.parentElement)&&(G=l(p.parentElement)),G};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,X)),e(this,h).addEventListener("popoverOpened",e(this,Y)),e(this,h).addEventListener("popoverClosing",e(this,F)),e(this,h).addEventListener("popoverClosed",e(this,I))):console.warn(this,`target ${t} not found`)}y(this,k,te).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{y(this,k,te).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");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"),this.removeAttribute("role"),this.removeAttribute("tabindex"),y(this,k,ee).call(this)}}h=new WeakMap,d=new WeakMap,k=new WeakSet,ee=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,X)),e(this,h).removeEventListener("popoverOpened",e(this,Y)),e(this,h).removeEventListener("popoverClosing",e(this,F)),e(this,h).removeEventListener("popoverClosed",e(this,I)))},X=new WeakMap,Y=new WeakMap,F=new WeakMap,I=new WeakMap,te=function(t){e(this,h)instanceof D&&(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")))};se.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",le);exports.PopoverButtonElement=le;exports.PopoverElement=D;
|
|
1
|
+
"use strict";var oe=c=>{throw TypeError(c)};var ee=(c,n,t)=>n.has(c)||oe("Cannot "+t);var e=(c,n,t)=>(ee(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?oe("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(ee(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),f=(c,n,t)=>(ee(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ue=require("../element-linked-store/index.cjs"),y=require("../css-property/index.cjs"),ie=require("../index-DekP7OZe.cjs"),K=require("../events-KVanG9sR.cjs"),pe=require("../function-MthRj-GJ.cjs"),ne=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const he=require("../url-BT4fssbO.cjs"),ce=require("../window-resizer/index.cjs"),Q=require("../Viewport-DB0qAZPJ.cjs");var u,E,_,N;class de{constructor(){r(this,u,new Map);r(this,E,[]);r(this,_,n=>{var s;const t=[...e(this,E)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(re=>re instanceof HTMLElement&&re.hasAttribute("data-popover-content")))return;const l=i[0],d=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),D=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!d||D)&&t.close()}});r(this,N,n=>{if(n.code==="Escape"){const t=[...e(this,E)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,_)),addEventListener("keydown",e(this,N))}get groups(){return e(this,u)}get stack(){return e(this,E)}add(n,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,u).get(n);s!=null&&s.length||(s=[],e(this,u).set(n,s)),e(this,E).push(t),s.push(t)}remove(n,t){if(o(this,E,e(this,E).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(n);e(this,u).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(n);s&&(s=s.filter(i=>i!==t),e(this,u).set(n,s))}}}u=new WeakMap,E=new WeakMap,_=new WeakMap,N=new WeakMap;var v,B,H,k,z,m,L,A,x,b,R,q,S,T,$,a,O,G,p,le,M,Z,V,P,j,X,W;const w=class w extends HTMLElement{constructor(){super();r(this,p);r(this,v);r(this,B);r(this,H);r(this,k);r(this,z);r(this,m);r(this,L);r(this,A);r(this,x);r(this,b);r(this,R);r(this,q);r(this,S);r(this,T);r(this,$);r(this,a);r(this,O);r(this,G);r(this,V);r(this,P);r(this,j);r(this,X);r(this,W);this.urlValue="",o(this,v,!1),o(this,m,new y.CSSProperty(this,"--history",!1)),o(this,L,new y.CSSProperty(this,"--restore",!1)),o(this,A,new y.CSSProperty(this,"--close-rest",!1)),o(this,x,new y.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new y.CSSProperty(this,"--group","")),o(this,R,new y.CSSProperty(this,"--click-outside",!1)),o(this,q,new y.CSSProperty(this,"--escape",!1)),o(this,S,new y.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,T,!1),o(this,a,new ue.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),o(this,O,[]),o(this,G,[]),o(this,V,()=>{o(this,T,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,T,!0)}),o(this,P,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,j).call(this)}),o(this,j,pe.debounce(()=>{e(this,X).call(this)},10)),o(this,X,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,S).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Q.viewport.width?s=Q.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Q.viewport.height?i=Q.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,W,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(w.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=w.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,L)}get closeRest(){return e(this,A)}get closeRestInGroup(){return e(this,x)}get group(){return e(this,b)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,v)}get lastTrigger(){return e(this,$)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&he.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,$,t==null?void 0:t.trigger),clearTimeout(e(this,B)),clearTimeout(e(this,H)),f(this,p,M).call(this,!0,this.openClass),f(this,p,M).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),K.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,$)}}),e(this,m).current&&e(this,T)&&history.pushState(history.state,"",e(this,p,le)),o(this,v,!0);const s=()=>{w.stack.add(e(this,b).current,this),e(this,G).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),e(this,P).call(this),e(this,a).set("opened",!0),K.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,$)},bubbles:!0}),o(this,k,void 0),o(this,z,setTimeout(()=>{e(this,a).set("transitionend",!0)},ne.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,k,setTimeout(s,10))}close(){e(this,v)&&(o(this,v,!1),clearTimeout(e(this,k)),clearTimeout(e(this,z)),w.stack.remove(e(this,b).current,this),f(this,p,Z).call(this),f(this,p,M).call(this,!1,this.openClass),e(this,a).set("transitionend",!1),o(this,B,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),f(this,p,M).call(this,!0,this.closingClass),K.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,H,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),f(this,p,M).call(this,!1,this.closingClass),K.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},ne.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,O,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,O).forEach(t=>{t.addEventListener("click",e(this,W))}),o(this,G,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,L).observe(),e(this,A).observe(),e(this,x).observe(),e(this,b).observe(),e(this,R).observe(),e(this,q).observe(),e(this,S).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,V)),setTimeout(()=>{e(this,L).current?(this.urlValue=he.parseSearchParameters(location.search)[this.id],e(this,V).call(this)):(f(this,p,Z).call(this),o(this,T,!0))},0),e(this,S).subscribe(()=>{e(this,P).call(this)}),ce.windowResizer.subscribe(e(this,P))}disconnectedCallback(){e(this,O).forEach(t=>{t.removeEventListener("click",e(this,W))}),w.stack.remove(e(this,b).current,this),ce.windowResizer.unsubscribe(e(this,P)),e(this,a).close(),e(this,m).close(),e(this,L).close(),e(this,A).close(),e(this,x).close(),e(this,b).close(),e(this,R).close(),e(this,q).close(),e(this,S).close(),this.removeAttribute("role"),clearTimeout(e(this,B)),clearTimeout(e(this,H)),clearTimeout(e(this,k)),clearTimeout(e(this,z)),removeEventListener("popstate",e(this,V)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),f(this,p,Z).call(this)}};v=new WeakMap,B=new WeakMap,H=new WeakMap,k=new WeakMap,z=new WeakMap,m=new WeakMap,L=new WeakMap,A=new WeakMap,x=new WeakMap,b=new WeakMap,R=new WeakMap,q=new WeakMap,S=new WeakMap,T=new WeakMap,$=new WeakMap,a=new WeakMap,O=new WeakMap,G=new WeakMap,p=new WeakSet,le=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},M=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},Z=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},V=new WeakMap,P=new WeakMap,j=new WeakMap,X=new WeakMap,W=new WeakMap,w.stack=new de;let U=w;ie.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",U);var h,g,C,te,Y,F,I,J,se;class ae extends HTMLElement{constructor(){super();r(this,C);r(this,h);r(this,g,new y.CSSProperty(this,"--type","open"));r(this,Y,()=>{e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,F,()=>{e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,I,()=>{e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,J,()=>{e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});ie.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).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"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(f(this,C,te).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const d=this.getRootNode();d instanceof ShadowRoot?i=d.host.closest("[data-popover]"):d instanceof HTMLElement&&(i=d.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=d=>{if(!d)return null;let D=d.querySelector("[data-popover]");return!D&&(d!=null&&d.parentElement)&&(D=l(d.parentElement)),D};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,Y)),e(this,h).addEventListener("popoverOpened",e(this,F)),e(this,h).addEventListener("popoverClosing",e(this,I)),e(this,h).addEventListener("popoverClosed",e(this,J))):console.warn(this,`target ${t} not found`)}f(this,C,se).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{f(this,C,se).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),f(this,C,te).call(this)}}h=new WeakMap,g=new WeakMap,C=new WeakSet,te=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,Y)),e(this,h).removeEventListener("popoverOpened",e(this,F)),e(this,h).removeEventListener("popoverClosing",e(this,I)),e(this,h).removeEventListener("popoverClosed",e(this,J)))},Y=new WeakMap,F=new WeakMap,I=new WeakMap,J=new WeakMap,se=function(t){e(this,h)instanceof U&&(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")))};ie.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ae);exports.PopoverButtonElement=ae;exports.PopoverElement=U;
|
package/lib/popover/index.js
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var ot = (l) => {
|
|
2
|
+
throw TypeError(l);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var t = (
|
|
4
|
+
var tt = (l, h, e) => h.has(l) || ot("Cannot " + e);
|
|
5
|
+
var t = (l, h, e) => (tt(l, h, "read from private field"), e ? e.call(l) : h.get(l)), r = (l, h, e) => h.has(l) ? ot("Cannot add the same private member more than once") : h instanceof WeakSet ? h.add(l) : h.set(l, e), o = (l, h, e, s) => (tt(l, h, "write to private field"), s ? s.call(l, e) : h.set(l, e), e), f = (l, h, e) => (tt(l, h, "access private method"), e);
|
|
6
6
|
import { ElementLinkedStore as ct } from "../element-linked-store/index.js";
|
|
7
|
-
import { CSSProperty as
|
|
8
|
-
import { i as
|
|
9
|
-
import { d as
|
|
10
|
-
import { d as
|
|
11
|
-
import { g as
|
|
7
|
+
import { CSSProperty as E } from "../css-property/index.js";
|
|
8
|
+
import { i as it } from "../index-Bv9zgfdb.js";
|
|
9
|
+
import { d as J } from "../events-CsVF98U6.js";
|
|
10
|
+
import { d as at } from "../function-C10DGppn.js";
|
|
11
|
+
import { g as ht } from "../style-j2TwriJ_.js";
|
|
12
12
|
import "construct-style-sheets-polyfill";
|
|
13
|
-
import { u as
|
|
14
|
-
import { windowResizer as
|
|
15
|
-
import { v as
|
|
16
|
-
var u,
|
|
17
|
-
class
|
|
13
|
+
import { u as ut, p as pt } from "../url-Cb0SFRMc.js";
|
|
14
|
+
import { windowResizer as nt } from "../window-resizer/index.js";
|
|
15
|
+
import { v as K } from "../Viewport-DA10iWAO.js";
|
|
16
|
+
var u, y, N, _;
|
|
17
|
+
class dt {
|
|
18
18
|
constructor() {
|
|
19
19
|
r(this, u, /* @__PURE__ */ new Map());
|
|
20
|
-
r(this,
|
|
21
|
-
r(this,
|
|
20
|
+
r(this, y, []);
|
|
21
|
+
r(this, N, (h) => {
|
|
22
22
|
var s;
|
|
23
|
-
const e = [...t(this,
|
|
23
|
+
const e = [...t(this, y)].reverse().find((i) => i.clickOutside.current);
|
|
24
24
|
if (e) {
|
|
25
25
|
const i = h.composedPath();
|
|
26
26
|
if (i.find(
|
|
27
|
-
(
|
|
27
|
+
(rt) => rt instanceof HTMLElement && rt.hasAttribute("data-popover-content")
|
|
28
28
|
))
|
|
29
29
|
return;
|
|
30
|
-
const
|
|
31
|
-
(!
|
|
30
|
+
const c = i[0], d = c instanceof Node && (e.contains(c) || ((s = e.shadowRoot) == null ? void 0 : s.contains(c))), D = c instanceof HTMLElement && c.hasAttribute("data-outside");
|
|
31
|
+
(!d || D) && e.close();
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
r(this,
|
|
34
|
+
r(this, _, (h) => {
|
|
35
35
|
if (h.code === "Escape") {
|
|
36
|
-
const e = [...t(this,
|
|
36
|
+
const e = [...t(this, y)].reverse().find((s) => s.escape.current);
|
|
37
37
|
e && e.close();
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
document.documentElement.addEventListener(
|
|
41
41
|
"click",
|
|
42
|
-
t(this,
|
|
43
|
-
), addEventListener("keydown", t(this,
|
|
42
|
+
t(this, N)
|
|
43
|
+
), addEventListener("keydown", t(this, _));
|
|
44
44
|
}
|
|
45
45
|
get groups() {
|
|
46
46
|
return t(this, u);
|
|
47
47
|
}
|
|
48
48
|
get stack() {
|
|
49
|
-
return t(this,
|
|
49
|
+
return t(this, y);
|
|
50
50
|
}
|
|
51
51
|
add(h, e) {
|
|
52
52
|
if (e.closeRest.current)
|
|
53
53
|
t(this, u).forEach((i) => {
|
|
54
|
-
i.forEach((
|
|
55
|
-
|
|
54
|
+
i.forEach((c) => {
|
|
55
|
+
c.close();
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
58
|
else if (e.closeRestInGroup.current) {
|
|
59
59
|
let i = t(this, u).get(h);
|
|
60
|
-
i == null || i.forEach((
|
|
61
|
-
|
|
60
|
+
i == null || i.forEach((c) => {
|
|
61
|
+
c.close();
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
let s = t(this, u).get(h);
|
|
65
|
-
s != null && s.length || (s = [], t(this, u).set(h, s)), t(this,
|
|
65
|
+
s != null && s.length || (s = [], t(this, u).set(h, s)), t(this, y).push(e), s.push(e);
|
|
66
66
|
}
|
|
67
67
|
remove(h, e) {
|
|
68
|
-
if (o(this,
|
|
68
|
+
if (o(this, y, t(this, y).filter((s) => s !== e)), e.closeRest.current) {
|
|
69
69
|
let s = [];
|
|
70
70
|
t(this, u).forEach((i) => {
|
|
71
|
-
i.forEach((
|
|
71
|
+
i.forEach((c) => s.push(c));
|
|
72
72
|
}), t(this, u).clear(), s.forEach((i) => i.close());
|
|
73
73
|
} else if (e.closeRestInGroup.current) {
|
|
74
74
|
const s = t(this, u).get(h);
|
|
@@ -81,60 +81,60 @@ class pt {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
u = new WeakMap(),
|
|
85
|
-
var
|
|
86
|
-
const
|
|
84
|
+
u = new WeakMap(), y = new WeakMap(), N = new WeakMap(), _ = new WeakMap();
|
|
85
|
+
var m, q, G, P, W, v, w, x, S, b, R, $, T, k, O, a, V, z, p, lt, H, Q, M, A, U, X, B;
|
|
86
|
+
const L = class L extends HTMLElement {
|
|
87
87
|
constructor() {
|
|
88
88
|
super();
|
|
89
|
-
r(this,
|
|
90
|
-
r(this,
|
|
91
|
-
r(this, H);
|
|
89
|
+
r(this, p);
|
|
90
|
+
r(this, m);
|
|
92
91
|
r(this, q);
|
|
92
|
+
r(this, G);
|
|
93
93
|
r(this, P);
|
|
94
94
|
r(this, W);
|
|
95
|
-
r(this,
|
|
96
|
-
r(this,
|
|
95
|
+
r(this, v);
|
|
96
|
+
r(this, w);
|
|
97
97
|
r(this, x);
|
|
98
98
|
r(this, S);
|
|
99
|
-
r(this,
|
|
99
|
+
r(this, b);
|
|
100
100
|
r(this, R);
|
|
101
101
|
r(this, $);
|
|
102
|
-
r(this, w);
|
|
103
102
|
r(this, T);
|
|
103
|
+
r(this, k);
|
|
104
104
|
r(this, O);
|
|
105
105
|
r(this, a);
|
|
106
106
|
r(this, V);
|
|
107
|
-
r(this,
|
|
107
|
+
r(this, z);
|
|
108
108
|
r(this, M);
|
|
109
|
-
r(this,
|
|
110
|
-
r(this, D);
|
|
109
|
+
r(this, A);
|
|
111
110
|
r(this, U);
|
|
112
|
-
r(this,
|
|
113
|
-
|
|
111
|
+
r(this, X);
|
|
112
|
+
r(this, B);
|
|
113
|
+
this.urlValue = "", o(this, m, !1), o(this, v, new E(this, "--history", !1)), o(this, w, new E(this, "--restore", !1)), o(this, x, new E(this, "--close-rest", !1)), o(this, S, new E(
|
|
114
114
|
this,
|
|
115
115
|
"--close-rest-in-group",
|
|
116
116
|
!1
|
|
117
|
-
)), o(this,
|
|
117
|
+
)), o(this, b, new E(this, "--group", "")), o(this, R, new E(this, "--click-outside", !1)), o(this, $, new E(this, "--escape", !1)), o(this, T, new E(this, "--check-viewport-bounds", !1)), o(this, k, !1), o(this, a, new ct(this, {
|
|
118
118
|
opened: !1,
|
|
119
119
|
closing: !1,
|
|
120
120
|
triggered: !1,
|
|
121
121
|
transitionend: !1
|
|
122
|
-
})), o(this, V, []), o(this,
|
|
123
|
-
o(this,
|
|
124
|
-
}), o(this,
|
|
125
|
-
this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), this.style.setProperty("--viewport-offset-x", "0px"), this.style.setProperty("--viewport-offset-y", "0px"), t(this,
|
|
126
|
-
}), o(this,
|
|
127
|
-
t(this,
|
|
128
|
-
}, 10)), o(this,
|
|
129
|
-
if (this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px"), t(this,
|
|
122
|
+
})), o(this, V, []), o(this, z, []), o(this, M, () => {
|
|
123
|
+
o(this, k, !1), t(this, m) && t(this, v).current && !location.search.includes(this.id) ? this.close() : !t(this, m) && t(this, v).current && location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), o(this, k, !0);
|
|
124
|
+
}), o(this, A, () => {
|
|
125
|
+
this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), this.style.setProperty("--viewport-offset-x", "0px"), this.style.setProperty("--viewport-offset-y", "0px"), t(this, U).call(this);
|
|
126
|
+
}), o(this, U, at(() => {
|
|
127
|
+
t(this, X).call(this);
|
|
128
|
+
}, 10)), o(this, X, () => {
|
|
129
|
+
if (this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px"), t(this, T).current) {
|
|
130
130
|
const e = this.getBoundingClientRect();
|
|
131
131
|
let s = 0, i = 0;
|
|
132
|
-
e.right >
|
|
132
|
+
e.right > K.width ? s = K.width - e.right : e.left < 0 && (s = e.left * -1), e.bottom > K.height ? i = K.height - e.bottom : e.top < 0 && (i = e.top * -1), this.style.setProperty("--viewport-offset-x", s + "px"), this.style.setProperty("--viewport-offset-y", i + "px");
|
|
133
133
|
}
|
|
134
|
-
}), o(this,
|
|
134
|
+
}), o(this, B, () => {
|
|
135
135
|
this.close();
|
|
136
|
-
}), t(this,
|
|
137
|
-
e.previous && (
|
|
136
|
+
}), t(this, b).subscribe((e) => {
|
|
137
|
+
e.previous && (L.stack.remove(e.previous, this), e.current || (document.documentElement.classList.remove(
|
|
138
138
|
`${this.group.previous}-closing`
|
|
139
139
|
), document.documentElement.classList.remove(
|
|
140
140
|
`${this.group.previous}-opened`
|
|
@@ -145,7 +145,7 @@ const y = class y extends HTMLElement {
|
|
|
145
145
|
`${this.group.current}-closing`,
|
|
146
146
|
e.current.closing
|
|
147
147
|
);
|
|
148
|
-
const s =
|
|
148
|
+
const s = L.stack.groups.get(this.group.current), i = s == null ? void 0 : s.find((c) => c.opened);
|
|
149
149
|
document.documentElement.classList.toggle(
|
|
150
150
|
`${this.group.current}-opened`,
|
|
151
151
|
!!i
|
|
@@ -156,11 +156,14 @@ const y = class y extends HTMLElement {
|
|
|
156
156
|
get openClass() {
|
|
157
157
|
return this.getAttribute("data-open-global-class");
|
|
158
158
|
}
|
|
159
|
+
get closingClass() {
|
|
160
|
+
return this.getAttribute("data-closing-global-class");
|
|
161
|
+
}
|
|
159
162
|
get history() {
|
|
160
|
-
return t(this,
|
|
163
|
+
return t(this, v);
|
|
161
164
|
}
|
|
162
165
|
get restore() {
|
|
163
|
-
return t(this,
|
|
166
|
+
return t(this, w);
|
|
164
167
|
}
|
|
165
168
|
get closeRest() {
|
|
166
169
|
return t(this, x);
|
|
@@ -169,7 +172,7 @@ const y = class y extends HTMLElement {
|
|
|
169
172
|
return t(this, S);
|
|
170
173
|
}
|
|
171
174
|
get group() {
|
|
172
|
-
return t(this,
|
|
175
|
+
return t(this, b);
|
|
173
176
|
}
|
|
174
177
|
get clickOutside() {
|
|
175
178
|
return t(this, R);
|
|
@@ -178,7 +181,7 @@ const y = class y extends HTMLElement {
|
|
|
178
181
|
return t(this, $);
|
|
179
182
|
}
|
|
180
183
|
get opened() {
|
|
181
|
-
return t(this,
|
|
184
|
+
return t(this, m);
|
|
182
185
|
}
|
|
183
186
|
get lastTrigger() {
|
|
184
187
|
return t(this, O);
|
|
@@ -187,27 +190,25 @@ const y = class y extends HTMLElement {
|
|
|
187
190
|
return `${this.id}${this.urlValue ? "=" + this.urlValue : ""}`;
|
|
188
191
|
}
|
|
189
192
|
updateUrlValue(e) {
|
|
190
|
-
this.urlValue = (e == null ? void 0 : e.toString()) || "", t(this,
|
|
193
|
+
this.urlValue = (e == null ? void 0 : e.toString()) || "", t(this, m) && ut(this.id, e);
|
|
191
194
|
}
|
|
192
195
|
open(e) {
|
|
193
|
-
if (t(this,
|
|
196
|
+
if (t(this, m))
|
|
194
197
|
return;
|
|
195
|
-
o(this, O, e == null ? void 0 : e.trigger), clearTimeout(t(this,
|
|
196
|
-
document.documentElement.classList.add(i.trim());
|
|
197
|
-
}), t(this, a).set("closing", !1), t(this, a).set("triggered", !0), I(this, "popoverTriggered", {
|
|
198
|
+
o(this, O, e == null ? void 0 : e.trigger), clearTimeout(t(this, q)), clearTimeout(t(this, G)), f(this, p, H).call(this, !0, this.openClass), f(this, p, H).call(this, !1, this.closingClass), t(this, a).set("closing", !1), t(this, a).set("triggered", !0), J(this, "popoverTriggered", {
|
|
198
199
|
custom: !0,
|
|
199
200
|
detail: {
|
|
200
201
|
trigger: t(this, O)
|
|
201
202
|
}
|
|
202
|
-
}), t(this,
|
|
203
|
+
}), t(this, v).current && t(this, k) && history.pushState(history.state, "", t(this, p, lt)), o(this, m, !0);
|
|
203
204
|
const s = () => {
|
|
204
|
-
|
|
205
|
+
L.stack.add(t(this, b).current, this), t(this, z).forEach((i) => {
|
|
205
206
|
i.scroll({
|
|
206
207
|
top: 0,
|
|
207
208
|
left: 0,
|
|
208
209
|
behavior: "instant"
|
|
209
210
|
});
|
|
210
|
-
}), t(this,
|
|
211
|
+
}), t(this, A).call(this), t(this, a).set("opened", !0), J(this, "popoverOpened", {
|
|
211
212
|
custom: !0,
|
|
212
213
|
detail: {
|
|
213
214
|
trigger: t(this, O)
|
|
@@ -215,23 +216,21 @@ const y = class y extends HTMLElement {
|
|
|
215
216
|
bubbles: !0
|
|
216
217
|
}), o(this, P, void 0), o(this, W, setTimeout(() => {
|
|
217
218
|
t(this, a).set("transitionend", !0);
|
|
218
|
-
},
|
|
219
|
+
}, ht(this) + 10));
|
|
219
220
|
};
|
|
220
221
|
e != null && e.skipTransition ? s() : o(this, P, setTimeout(s, 10));
|
|
221
222
|
}
|
|
222
223
|
close() {
|
|
223
|
-
t(this,
|
|
224
|
-
|
|
225
|
-
}), t(this, a).set("transitionend", !1), o(this, H, setTimeout(() => {
|
|
226
|
-
t(this, a).set("opened", !1), t(this, a).set("closing", !0), I(this, "popoverClosing", {
|
|
224
|
+
t(this, m) && (o(this, m, !1), clearTimeout(t(this, P)), clearTimeout(t(this, W)), L.stack.remove(t(this, b).current, this), f(this, p, Q).call(this), f(this, p, H).call(this, !1, this.openClass), t(this, a).set("transitionend", !1), o(this, q, setTimeout(() => {
|
|
225
|
+
t(this, a).set("opened", !1), t(this, a).set("closing", !0), f(this, p, H).call(this, !0, this.closingClass), J(this, "popoverClosing", {
|
|
227
226
|
custom: !0,
|
|
228
227
|
bubbles: !0
|
|
229
|
-
}), o(this,
|
|
230
|
-
t(this, a).set("triggered", !1), t(this, a).set("closing", !1),
|
|
228
|
+
}), o(this, G, setTimeout(() => {
|
|
229
|
+
t(this, a).set("triggered", !1), t(this, a).set("closing", !1), f(this, p, H).call(this, !1, this.closingClass), J(this, "popoverClosed", {
|
|
231
230
|
custom: !0,
|
|
232
231
|
bubbles: !0
|
|
233
232
|
});
|
|
234
|
-
},
|
|
233
|
+
}, ht(this) + 10));
|
|
235
234
|
}, 10)));
|
|
236
235
|
}
|
|
237
236
|
connectedCallback() {
|
|
@@ -240,55 +239,59 @@ const y = class y extends HTMLElement {
|
|
|
240
239
|
`[data-popover-close${this.id ? `="${this.id}"` : ""}]`
|
|
241
240
|
)
|
|
242
241
|
]), t(this, V).forEach((e) => {
|
|
243
|
-
e.addEventListener("click", t(this,
|
|
244
|
-
}), o(this,
|
|
242
|
+
e.addEventListener("click", t(this, B));
|
|
243
|
+
}), o(this, z, [
|
|
245
244
|
...this.querySelectorAll(
|
|
246
245
|
`[data-popover-reset-scroll${this.id ? `="${this.id}"` : ""}]`
|
|
247
246
|
)
|
|
248
|
-
]), t(this,
|
|
249
|
-
t(this,
|
|
250
|
-
}, 0), t(this,
|
|
251
|
-
t(this,
|
|
252
|
-
}),
|
|
247
|
+
]), t(this, v).observe(), t(this, w).observe(), t(this, x).observe(), t(this, S).observe(), t(this, b).observe(), t(this, R).observe(), t(this, $).observe(), t(this, T).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", t(this, M)), setTimeout(() => {
|
|
248
|
+
t(this, w).current ? (this.urlValue = pt(location.search)[this.id], t(this, M).call(this)) : (f(this, p, Q).call(this), o(this, k, !0));
|
|
249
|
+
}, 0), t(this, T).subscribe(() => {
|
|
250
|
+
t(this, A).call(this);
|
|
251
|
+
}), nt.subscribe(t(this, A));
|
|
253
252
|
}
|
|
254
253
|
disconnectedCallback() {
|
|
255
254
|
t(this, V).forEach((e) => {
|
|
256
|
-
e.removeEventListener("click", t(this,
|
|
257
|
-
}),
|
|
255
|
+
e.removeEventListener("click", t(this, B));
|
|
256
|
+
}), L.stack.remove(t(this, b).current, this), nt.unsubscribe(t(this, A)), t(this, a).close(), t(this, v).close(), t(this, w).close(), t(this, x).close(), t(this, S).close(), t(this, b).close(), t(this, R).close(), t(this, $).close(), t(this, T).close(), this.removeAttribute("role"), clearTimeout(t(this, q)), clearTimeout(t(this, G)), clearTimeout(t(this, P)), clearTimeout(t(this, W)), removeEventListener("popstate", t(this, M)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), this.style.removeProperty("--viewport-offset-x"), this.style.removeProperty("--viewport-offset-y"), f(this, p, Q).call(this);
|
|
258
257
|
}
|
|
259
258
|
};
|
|
260
|
-
|
|
259
|
+
m = new WeakMap(), q = new WeakMap(), G = new WeakMap(), P = new WeakMap(), W = new WeakMap(), v = new WeakMap(), w = new WeakMap(), x = new WeakMap(), S = new WeakMap(), b = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), T = new WeakMap(), k = new WeakMap(), O = new WeakMap(), a = new WeakMap(), V = new WeakMap(), z = new WeakMap(), p = new WeakSet(), lt = function() {
|
|
261
260
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
|
|
262
|
-
},
|
|
263
|
-
|
|
261
|
+
}, H = function(e, s) {
|
|
262
|
+
s && s.split(" ").map((i) => {
|
|
263
|
+
document.documentElement.classList.toggle(i.trim(), e);
|
|
264
|
+
});
|
|
265
|
+
}, Q = function() {
|
|
266
|
+
if (t(this, v).current) {
|
|
264
267
|
const e = new URL(location.href);
|
|
265
268
|
e.searchParams.delete(this.id), history.replaceState(history.state, "", e.href);
|
|
266
269
|
}
|
|
267
|
-
}, M = new WeakMap(),
|
|
268
|
-
let
|
|
269
|
-
|
|
270
|
-
var n,
|
|
271
|
-
class
|
|
270
|
+
}, M = new WeakMap(), A = new WeakMap(), U = new WeakMap(), X = new WeakMap(), B = new WeakMap(), L.stack = new dt();
|
|
271
|
+
let Z = L;
|
|
272
|
+
it && !customElements.get("e-popover") && customElements.define("e-popover", Z);
|
|
273
|
+
var n, g, C, et, Y, j, F, I, st;
|
|
274
|
+
class ft extends HTMLElement {
|
|
272
275
|
constructor() {
|
|
273
276
|
super();
|
|
274
277
|
r(this, C);
|
|
275
278
|
r(this, n);
|
|
276
|
-
r(this,
|
|
277
|
-
r(this, X, () => {
|
|
278
|
-
t(this, d).current !== "close" && this.classList.add("triggered");
|
|
279
|
-
});
|
|
279
|
+
r(this, g, new E(this, "--type", "open"));
|
|
280
280
|
r(this, Y, () => {
|
|
281
|
-
t(this,
|
|
281
|
+
t(this, g).current !== "close" && this.classList.add("triggered");
|
|
282
282
|
});
|
|
283
283
|
r(this, j, () => {
|
|
284
|
-
t(this,
|
|
284
|
+
t(this, g).current !== "close" && (this.classList.add("opened"), this.setAttribute("aria-expanded", "true"));
|
|
285
285
|
});
|
|
286
286
|
r(this, F, () => {
|
|
287
|
-
t(this,
|
|
287
|
+
t(this, g).current !== "close" && this.classList.remove("opened");
|
|
288
288
|
});
|
|
289
|
-
|
|
289
|
+
r(this, I, () => {
|
|
290
|
+
t(this, g).current !== "close" && (this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false"));
|
|
291
|
+
});
|
|
292
|
+
it && (this.addEventListener("click", () => {
|
|
290
293
|
if (t(this, n)) {
|
|
291
|
-
const e = t(this,
|
|
294
|
+
const e = t(this, g).current;
|
|
292
295
|
e === "open" || e === "toggle" && !t(this, n).opened ? t(this, n).open({ trigger: this }) : (e === "close" || e === "toggle" && t(this, n).opened) && t(this, n).close();
|
|
293
296
|
}
|
|
294
297
|
}), this.addEventListener("keydown", (e) => {
|
|
@@ -296,84 +299,84 @@ class dt extends HTMLElement {
|
|
|
296
299
|
}));
|
|
297
300
|
}
|
|
298
301
|
get type() {
|
|
299
|
-
return t(this,
|
|
302
|
+
return t(this, g);
|
|
300
303
|
}
|
|
301
304
|
get popoverElement() {
|
|
302
305
|
return t(this, n);
|
|
303
306
|
}
|
|
304
307
|
changePopover(e) {
|
|
305
308
|
var s;
|
|
306
|
-
if (
|
|
309
|
+
if (f(this, C, et).call(this), e) {
|
|
307
310
|
let i = null;
|
|
308
311
|
if (e === "parent") {
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
311
|
-
i =
|
|
312
|
+
const c = this.closest("[data-popover]");
|
|
313
|
+
if (c)
|
|
314
|
+
i = c;
|
|
312
315
|
else {
|
|
313
|
-
const
|
|
314
|
-
|
|
316
|
+
const d = this.getRootNode();
|
|
317
|
+
d instanceof ShadowRoot ? i = d.host.closest("[data-popover]") : d instanceof HTMLElement && (i = d.closest("[data-popover]"));
|
|
315
318
|
}
|
|
316
319
|
} else if (e === "sibling")
|
|
317
320
|
i = (s = this.parentElement) == null ? void 0 : s.querySelector("[data-popover]");
|
|
318
321
|
else if (e === "ancestor-child") {
|
|
319
|
-
const
|
|
320
|
-
if (!
|
|
322
|
+
const c = (d) => {
|
|
323
|
+
if (!d)
|
|
321
324
|
return null;
|
|
322
|
-
let
|
|
323
|
-
return !
|
|
325
|
+
let D = d.querySelector("[data-popover]");
|
|
326
|
+
return !D && (d != null && d.parentElement) && (D = c(d.parentElement)), D;
|
|
324
327
|
};
|
|
325
|
-
i =
|
|
328
|
+
i = c(this.parentElement) || null;
|
|
326
329
|
} else
|
|
327
330
|
!e.startsWith(".") && !e.startsWith("[") && (e = `#${e}`), i = document.querySelector(e) || this.getRootNode().querySelector(e);
|
|
328
331
|
i instanceof HTMLElement ? (o(this, n, i), t(this, n).addEventListener(
|
|
329
332
|
"popoverTriggered",
|
|
330
|
-
t(this,
|
|
333
|
+
t(this, Y)
|
|
331
334
|
), t(this, n).addEventListener(
|
|
332
335
|
"popoverOpened",
|
|
333
|
-
t(this,
|
|
336
|
+
t(this, j)
|
|
334
337
|
), t(this, n).addEventListener(
|
|
335
338
|
"popoverClosing",
|
|
336
|
-
t(this,
|
|
339
|
+
t(this, F)
|
|
337
340
|
), t(this, n).addEventListener(
|
|
338
341
|
"popoverClosed",
|
|
339
|
-
t(this,
|
|
342
|
+
t(this, I)
|
|
340
343
|
)) : console.warn(this, `target ${e} not found`);
|
|
341
344
|
}
|
|
342
|
-
|
|
345
|
+
f(this, C, st).call(this, t(this, g).current);
|
|
343
346
|
}
|
|
344
347
|
connectedCallback() {
|
|
345
|
-
t(this,
|
|
346
|
-
|
|
348
|
+
t(this, g).subscribe((s) => {
|
|
349
|
+
f(this, C, st).call(this, s.current);
|
|
347
350
|
}), this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("role") || this.setAttribute("role", "button");
|
|
348
351
|
const e = this.getAttribute("target");
|
|
349
|
-
e && this.changePopover(e), this.isConnected && t(this,
|
|
352
|
+
e && this.changePopover(e), this.isConnected && t(this, g).observe();
|
|
350
353
|
}
|
|
351
354
|
disconnectedCallback() {
|
|
352
|
-
t(this,
|
|
355
|
+
t(this, g).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), this.removeAttribute("role"), this.removeAttribute("tabindex"), f(this, C, et).call(this);
|
|
353
356
|
}
|
|
354
357
|
}
|
|
355
|
-
n = new WeakMap(),
|
|
358
|
+
n = new WeakMap(), g = new WeakMap(), C = new WeakSet(), et = function() {
|
|
356
359
|
t(this, n) && (t(this, n).removeEventListener(
|
|
357
360
|
"popoverTriggered",
|
|
358
|
-
t(this,
|
|
361
|
+
t(this, Y)
|
|
359
362
|
), t(this, n).removeEventListener(
|
|
360
363
|
"popoverOpened",
|
|
361
|
-
t(this,
|
|
364
|
+
t(this, j)
|
|
362
365
|
), t(this, n).removeEventListener(
|
|
363
366
|
"popoverClosing",
|
|
364
|
-
t(this,
|
|
367
|
+
t(this, F)
|
|
365
368
|
), t(this, n).removeEventListener(
|
|
366
369
|
"popoverClosed",
|
|
367
|
-
t(this,
|
|
370
|
+
t(this, I)
|
|
368
371
|
));
|
|
369
|
-
},
|
|
370
|
-
t(this, n) instanceof
|
|
372
|
+
}, Y = new WeakMap(), j = new WeakMap(), F = new WeakMap(), I = new WeakMap(), st = function(e) {
|
|
373
|
+
t(this, n) instanceof Z && (e !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
|
|
371
374
|
"aria-expanded",
|
|
372
375
|
t(this, n).opened ? "true" : "false"
|
|
373
376
|
), this.setAttribute("aria-controls", t(this, n).id || "")) : (this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
|
|
374
377
|
};
|
|
375
|
-
|
|
378
|
+
it && !customElements.get("e-popover-button") && customElements.define("e-popover-button", ft);
|
|
376
379
|
export {
|
|
377
|
-
|
|
378
|
-
|
|
380
|
+
ft as PopoverButtonElement,
|
|
381
|
+
Z as PopoverElement
|
|
379
382
|
};
|
package/lib/video/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var h=e=>{throw TypeError(e)};var m=(e,s,t)=>s.has(e)||h("Cannot "+t);var i=(e,s,t)=>(m(e,s,"read from private field"),t?t.call(e):s.get(e)),u=(e,s,t)=>s.has(e)?h("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,t),c=(e,s,t,l)=>(m(e,s,"write to private field"),l?l.call(e,t):s.set(e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../SourceElement-D_YeNqsI.cjs");require("../window-resizer/index.cjs");require("../Store-Cd1GlEmZ.cjs");const p=require("../index-DekP7OZe.cjs"),b=require("../events-KVanG9sR.cjs");require("construct-style-sheets-polyfill");const o=require("../ticker/index.cjs");var r,n,a;class d extends E.SourceElement{constructor(){super(...arguments);u(this,r,0);u(this,n,!1);u(this,a,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>i(this,r)&&c(this,r,t),b.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:i(this,r)}}),this.consumerElement.readyState===4&&(o.ticker.unsubscribe(i(this,a)),i(this,n)&&this.sourceManager.current&&this.consumerElement.play())})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{c(this,n,!1),this.hasAttribute("capture-autoplay")&&(this.sourceManager.current?this.consumerElement.play():c(this,n,!0)),o.ticker.subscribe(i(this,a))}),this.addEventListener("sourceRelease",()=>{this.hasAttribute("capture-autoplay")&&(this.consumerElement.pause(),this.hasAttribute("
|
|
1
|
+
"use strict";var h=e=>{throw TypeError(e)};var m=(e,s,t)=>s.has(e)||h("Cannot "+t);var i=(e,s,t)=>(m(e,s,"read from private field"),t?t.call(e):s.get(e)),u=(e,s,t)=>s.has(e)?h("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,t),c=(e,s,t,l)=>(m(e,s,"write to private field"),l?l.call(e,t):s.set(e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../SourceElement-D_YeNqsI.cjs");require("../window-resizer/index.cjs");require("../Store-Cd1GlEmZ.cjs");const p=require("../index-DekP7OZe.cjs"),b=require("../events-KVanG9sR.cjs");require("construct-style-sheets-polyfill");const o=require("../ticker/index.cjs");var r,n,a;class d extends E.SourceElement{constructor(){super(...arguments);u(this,r,0);u(this,n,!1);u(this,a,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>i(this,r)&&c(this,r,t),b.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:i(this,r)}}),this.consumerElement.readyState===4&&(o.ticker.unsubscribe(i(this,a)),i(this,n)&&this.sourceManager.current&&this.consumerElement.play())})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{c(this,n,!1),this.hasAttribute("capture-autoplay")&&(this.sourceManager.current?this.consumerElement.play():c(this,n,!0)),o.ticker.subscribe(i(this,a))}),this.addEventListener("sourceRelease",()=>{this.hasAttribute("capture-autoplay")&&this.consumerElement.pause(),this.hasAttribute("release-pause")&&this.consumerElement.pause(),this.hasAttribute("release-stop")&&(this.consumerElement.pause(),this.consumerElement.currentTime=0),this.hasAttribute("replay")&&(this.consumerElement.currentTime=0),this.hasAttribute("reload-source")&&this.classList.remove("state-0","state-1","state-2","state-3","state-4")}),this.addEventListener("click",()=>{this.hasAttribute("click-controls")&&(this.consumerElement.paused?this.consumerElement.play():this.consumerElement.pause())})}disconnectedCallback(){super.disconnectedCallback(),o.ticker.unsubscribe(i(this,a)),c(this,r,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||"",this.hasAttribute("volume")&&(this.consumerElement.volume=parseFloat(this.getAttribute("volume")||"1"))}}r=new WeakMap,n=new WeakMap,a=new WeakMap;p.isBrowser&&!customElements.get("e-video")&&customElements.define("e-video",d);exports.VideoElement=d;
|
package/lib/video/index.js
CHANGED
|
@@ -31,7 +31,7 @@ class f extends d {
|
|
|
31
31
|
super.connectedCallback(), this.addEventListener("sourceCapture", () => {
|
|
32
32
|
o(this, a, !1), this.hasAttribute("capture-autoplay") && (this.sourceManager.current ? this.consumerElement.play() : o(this, a, !0)), u.subscribe(i(this, n));
|
|
33
33
|
}), this.addEventListener("sourceRelease", () => {
|
|
34
|
-
this.hasAttribute("capture-autoplay") && (this.consumerElement.pause(), this.hasAttribute("
|
|
34
|
+
this.hasAttribute("capture-autoplay") && this.consumerElement.pause(), this.hasAttribute("release-pause") && this.consumerElement.pause(), this.hasAttribute("release-stop") && (this.consumerElement.pause(), this.consumerElement.currentTime = 0), this.hasAttribute("replay") && (this.consumerElement.currentTime = 0), this.hasAttribute("reload-source") && this.classList.remove(
|
|
35
35
|
"state-0",
|
|
36
36
|
"state-1",
|
|
37
37
|
"state-2",
|