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