aptechka 0.70.12 → 0.70.13
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 +25 -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,r,e)=>r.has(h)||ht("Cannot "+e);var t=(h,r,e)=>(st(h,r,"read from private field"),e?e.call(h):r.get(h)),s=(h,r,e)=>r.has(h)?ht("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(h):r.set(h,e),l=(h,r,e,i)=>(st(h,r,"write to private field"),i?i.call(h,e):r.set(h,e),e),c=(h,r,e)=>(st(h,r,"access private method"),e);var z=(h,r,e)=>new Promise((i,n)=>{var a=B=>{try{tt(e.next(B))}catch(et){n(et)}},y=B=>{try{tt(e.throw(B))}catch(et){n(et)}},tt=B=>B.done?i(B.value):Promise.resolve(B.value).then(a,y);tt((e=e.apply(h,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("../index-DekP7OZe.cjs"),nt=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"),Et=require("../math-GDWEqu7y.cjs"),lt=require("../number-ChAm68cm.cjs");var m,I,R,f,ot,ct,ut,it;class at{constructor(r,e){s(this,f);s(this,m);s(this,I,null);s(this,R,!1);this.element=r,l(this,m,e)}destroy(){c(this,f,it).call(this)}updateClasses(r){const e=r===t(this,m).counter;t(this,R)&&!e?this.element.classList.add("was-current"):this.element.classList.remove("was-current"),c(this,f,ut).call(this),c(this,f,it).call(this),r===t(this,m).counter?c(this,f,ot).call(this):r<t(this,m).counter?this.element.classList.add("previous"):this.element.classList.add("next"),c(this,f,ct).call(this,r)}}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(r){r===lt.loopNumber(t(this,m).counter-1,t(this,m).length)?this.element.classList.add("previous-sibling"):r===(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")},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,rt,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(n=>{const a=e.x-n.x,y=e.y-n.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 n=e.getAttribute("data-billboard-item-group")||"default";let a=t(this,p).get(n);a||(a=[],t(this,p).set(n,a)),a.push(i),c(this,u,rt).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 n;(n=i[0])==null||n.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,rt).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,rt=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,Et.clamp(e,0,t(this,d)-1)),i!==t(this,o)&&(t(this,D).forEach(n=>{clearTimeout(n)}),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(n=>{n.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,E,U,_;class dt extends HTMLElement{constructor(){super(...arguments);s(this,g,null);s(this,O,null);s(this,E,[]);s(this,U,e=>{const i=e.currentTarget,n=t(this,E).findIndex(a=>a===i);n>=0&&t(this,g).set(n)});s(this,_,()=>{t(this,E).forEach((e,i)=>{i===t(this,g).counter?e.classList.add("current"):e.classList.remove("current")})})}get buttonElements(){return t(this,E)}connectedCallback(){return z(this,null,function*(){var e;if(yield nt.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 n=0;n<i;n++){const a=document.createElement("button");a.setAttribute("aria-label",`Go to item ${n+1}`),t(this,E).push(a),t(this,O).appendChild(a)}this.appendChild(t(this,O)),t(this,E).forEach(n=>{n.addEventListener("click",t(this,U))}),(e=t(this,g))==null||e.addEventListener("billboardChange",t(this,_)),t(this,_).call(this)}})}disconnectedCallback(){var e;t(this,E).forEach(i=>{i.removeEventListener("click",t(this,U))}),(e=t(this,g))==null||e.removeEventListener("billboardChange",t(this,_)),this.innerHTML="",l(this,E,[])}}g=new WeakMap,O=new WeakMap,E=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 n;const e=(((n=t(this,H))==null?void 0:n.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 nt.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,v,x;class mt extends HTMLElement{constructor(){super();s(this,G,null);s(this,w,new M.CSSProperty(this,"--index",0));s(this,v,null);s(this,x,()=>{t(this,G).updateClasses(t(this,w).current)});this.addEventListener("click",e=>{t(this,v)&&(!this.handleClick||this.handleClick(e))&&t(this,v).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 nt.whenDefined("e-billboard"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button"),l(this,v,Z.findParentElement(this,K)),t(this,v)&&(l(this,G,new at(this,t(this,v))),t(this,v).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,v))==null||e.removeEventListener("billboardChange",t(this,x)),t(this,G).destroy()}}G=new WeakMap,w=new WeakMap,v=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",!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;
|
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, ut, dt, nt;
|
|
32
32
|
class ot {
|
|
33
33
|
constructor(n, e) {
|
|
34
34
|
s(this, f);
|
|
@@ -42,32 +42,35 @@ class ot {
|
|
|
42
42
|
}
|
|
43
43
|
updateClasses(n) {
|
|
44
44
|
const e = n === t(this, m).counter;
|
|
45
|
-
t(this, Q) && !e ? this.element.classList.add("was-current") : this.element.classList.remove("was-current")
|
|
45
|
+
t(this, Q) && !e ? this.element.classList.add("was-current") : this.element.classList.remove("was-current");
|
|
46
|
+
const i = this.element.classList.contains("current-active");
|
|
47
|
+
c(this, f, dt).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, ut).call(this, n);
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
m = new WeakMap(), T = new WeakMap(), Q = new WeakMap(), f = new WeakSet(), ct = function() {
|
|
49
51
|
l(this, Q, !0), this.element.classList.add("current"), l(this, T, requestAnimationFrame(() => {
|
|
50
52
|
this.element.classList.add("current-active");
|
|
51
53
|
}));
|
|
52
|
-
},
|
|
54
|
+
}, ut = function(n) {
|
|
53
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");
|
|
54
|
-
},
|
|
56
|
+
}, dt = function() {
|
|
55
57
|
this.element.classList.remove(
|
|
56
58
|
"current",
|
|
57
59
|
"previous",
|
|
58
60
|
"next",
|
|
59
61
|
"previous-sibling",
|
|
60
62
|
"next-sibling",
|
|
61
|
-
"current-active"
|
|
63
|
+
"current-active",
|
|
64
|
+
"previous-active"
|
|
62
65
|
);
|
|
63
66
|
}, nt = function() {
|
|
64
67
|
t(this, T) && (cancelAnimationFrame(t(this, T)), l(this, T, null));
|
|
65
68
|
};
|
|
66
|
-
var $, B, L, C, k, x, D, H, p, o,
|
|
69
|
+
var $, B, L, C, k, x, D, H, p, o, d, P, u, rt, V, q, W, K, X, Y;
|
|
67
70
|
class U extends HTMLElement {
|
|
68
71
|
constructor() {
|
|
69
72
|
super(...arguments);
|
|
70
|
-
s(this,
|
|
73
|
+
s(this, u);
|
|
71
74
|
s(this, $, new S(this, "--resize", !0));
|
|
72
75
|
s(this, B, new S(this, "--loop", !0));
|
|
73
76
|
s(this, L, new S(this, "--autoplay", !1));
|
|
@@ -78,16 +81,16 @@ class U extends HTMLElement {
|
|
|
78
81
|
s(this, H, []);
|
|
79
82
|
s(this, p, /* @__PURE__ */ new Map());
|
|
80
83
|
s(this, o, -1);
|
|
81
|
-
s(this,
|
|
84
|
+
s(this, d, 0);
|
|
82
85
|
s(this, P, []);
|
|
83
86
|
s(this, q, (e) => {
|
|
84
|
-
l(this, D, e.isIntersecting), t(this, D) ? c(this,
|
|
87
|
+
l(this, D, e.isIntersecting), t(this, D) ? c(this, u, V).call(this) : clearInterval(t(this, x));
|
|
85
88
|
});
|
|
86
89
|
s(this, W, () => {
|
|
87
90
|
clearInterval(t(this, x)), t(this, D) && l(this, x, setInterval(t(this, X), this.autoplayDuration));
|
|
88
91
|
});
|
|
89
92
|
s(this, X, () => {
|
|
90
|
-
c(this,
|
|
93
|
+
c(this, u, K).call(this, t(this, o) + 1);
|
|
91
94
|
});
|
|
92
95
|
s(this, Y, (e) => {
|
|
93
96
|
if (!t(this, C).current)
|
|
@@ -129,17 +132,17 @@ class U extends HTMLElement {
|
|
|
129
132
|
return t(this, p);
|
|
130
133
|
}
|
|
131
134
|
get length() {
|
|
132
|
-
return t(this,
|
|
135
|
+
return t(this, d);
|
|
133
136
|
}
|
|
134
137
|
addItem(e) {
|
|
135
138
|
const i = new ot(e, this);
|
|
136
139
|
t(this, H).push(i);
|
|
137
140
|
const r = e.getAttribute("data-billboard-item-group") || "default";
|
|
138
141
|
let a = t(this, p).get(r);
|
|
139
|
-
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, u, rt).call(this);
|
|
140
143
|
}
|
|
141
144
|
set(e) {
|
|
142
|
-
(!this.handleSet || this.handleSet(e)) && (c(this,
|
|
145
|
+
(!this.handleSet || this.handleSet(e)) && (c(this, u, K).call(this, e), c(this, u, V).call(this));
|
|
143
146
|
}
|
|
144
147
|
shift(e) {
|
|
145
148
|
this.set(t(this, o) + e);
|
|
@@ -155,10 +158,10 @@ class U extends HTMLElement {
|
|
|
155
158
|
var r;
|
|
156
159
|
(r = i[0]) == null || r.element.classList.add("current");
|
|
157
160
|
}), t(this, L).subscribe((i) => {
|
|
158
|
-
i.current ? (it.subscribe(this, t(this, q)), c(this,
|
|
161
|
+
i.current ? (it.subscribe(this, t(this, q)), c(this, u, V).call(this)) : (l(this, D, !0), it.unsubscribe(t(this, q)), clearInterval(t(this, x)), c(this, u, K).call(this, 0));
|
|
159
162
|
}), t(this, k).subscribe(() => {
|
|
160
|
-
c(this,
|
|
161
|
-
}), t(this, L).observe(), t(this, C).observe(), t(this, k).observe(), t(this, B).observe(), t(this, $).observe(), c(this,
|
|
163
|
+
c(this, u, 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, u, K).call(this, 0), this.addEventListener("pointerdown", t(this, Y));
|
|
162
165
|
}
|
|
163
166
|
disconnectedCallback() {
|
|
164
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) => {
|
|
@@ -166,22 +169,22 @@ class U extends HTMLElement {
|
|
|
166
169
|
});
|
|
167
170
|
}
|
|
168
171
|
}
|
|
169
|
-
$ = 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(),
|
|
170
|
-
l(this,
|
|
171
|
-
e.length > t(this,
|
|
172
|
-
}), 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(), d = new WeakMap(), P = new WeakMap(), u = new WeakSet(), rt = function() {
|
|
173
|
+
l(this, d, 0), t(this, p).forEach((e) => {
|
|
174
|
+
e.length > t(this, d) && l(this, d, e.length);
|
|
175
|
+
}), l(this, d, t(this, d) + t(this, k).current);
|
|
173
176
|
}, V = function() {
|
|
174
177
|
t(this, L).current !== !1 && t(this, W).call(this);
|
|
175
178
|
}, q = new WeakMap(), W = new WeakMap(), K = function() {
|
|
176
179
|
return F(this, arguments, function* (e = t(this, o)) {
|
|
177
180
|
const i = t(this, o);
|
|
178
|
-
t(this, B).current ? l(this, o, at(e, t(this,
|
|
181
|
+
t(this, B).current ? l(this, o, at(e, t(this, d))) : l(this, o, ft(e, 0, t(this, d) - 1)), i !== t(this, o) && (t(this, P).forEach((r) => {
|
|
179
182
|
clearTimeout(r);
|
|
180
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) => {
|
|
181
184
|
r.forEach((a, y) => {
|
|
182
185
|
a.updateClasses(y);
|
|
183
186
|
});
|
|
184
|
-
}), this.classList.toggle("has-length", t(this,
|
|
187
|
+
}), 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()), bt(this, "billboardChange", {
|
|
185
188
|
detail: {
|
|
186
189
|
counter: t(this, o)
|
|
187
190
|
}
|