aptechka 0.73.2 → 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/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
|
}
|