aptechka 0.33.2 → 0.33.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var xe=Object.defineProperty;var ce=Object.getOwnPropertySymbols;var ze=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable;var ae=u=>{throw TypeError(u)};var ue=(u,r,e)=>r in u?xe(u,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[r]=e,de=(u,r)=>{for(var e in r||(r={}))ze.call(r,e)&&ue(u,e,r[e]);if(ce)for(var e of ce(r))Le.call(r,e)&&ue(u,e,r[e]);return u};var te=(u,r,e)=>r.has(u)||ae("Cannot "+e);var t=(u,r,e)=>(te(u,r,"read from private field"),e?e.call(u):r.get(u)),s=(u,r,e)=>r.has(u)?ae("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(u):r.set(u,e),h=(u,r,e,i)=>(te(u,r,"write to private field"),i?i.call(u,e):r.set(u,e),e),d=(u,r,e)=>(te(u,r,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ke=require("../../Store-CDb6RMce.cjs"),Yt=require("../../browser-CpzFX2xg.cjs"),Ie=require("../../easings-GegIwET5.cjs"),ee=require("../../events-KVanG9sR.cjs"),pe=require("../../jss-GJLvaNfT.cjs"),Et=require("../../layout-8ryRAMGJ.cjs"),fe=require("../../math-GDWEqu7y.cjs");require("../../ticker/vanilla/index.cjs");const se=require("../../order/index.cjs"),Te=require("../../Damped-CTsV8tl_.cjs"),qe=require("../../Tweened-C0-UzxN-.cjs"),Kt=require("../../controls/index.cjs"),Qt=require("../../window-resizer/vanilla/index.cjs"),lt=require("../../scroll-entries/index.cjs"),Se=require("../../css-unit-parser/index.cjs"),p=require("../../css-property/index.cjs"),De=require("../../device/index.cjs"),Xt=require("../../element-resizer/vanilla/index.cjs"),Ae=require("../../gestures-DHLrn6Q8.cjs"),ge=require("../../dom-JBOkFLTh.cjs"),Re=require("../../function-MthRj-GJ.cjs"),Me=require("../../scroll-segment/index.cjs");var f,Vt,y,ct,R,N;class Oe{constructor(r,e,i){s(this,f);s(this,Vt);s(this,y);s(this,ct,0);s(this,R,0);s(this,N,null);h(this,f,r),h(this,Vt,e),h(this,y,i),lt.scrollEntries.register(t(this,f))}get index(){return t(this,Vt)}get size(){return t(this,ct)}get position(){return t(this,R)}destroy(){lt.scrollEntries.unregister(t(this,f)),this.unsetTransform()}unsetTransform(){t(this,f).style.transform="",this.mark(null)}setSize(r){r?(t(this,f).style.setProperty("--size",r+"px"),t(this,y).axisCSSProperty.current==="x"?(t(this,f).style.width=r+"px",t(this,f).style.height=""):(t(this,f).style.height=r+"px",t(this,f).style.width="")):(t(this,f).style.width="",t(this,f).style.height="",t(this,f).style.removeProperty("--size"))}resize(){h(this,ct,t(this,y).vertical?t(this,f).offsetHeight:t(this,f).offsetWidth),h(this,R,t(this,y).vertical?Et.getCumulativeOffsetTop(t(this,f)):Et.getCumulativeOffsetLeft(t(this,f))),h(this,R,t(this,R)-t(this,y).contentPosition)}transform(){let r=0;const e=t(this,y).viewportSize*t(this,y).sectionDistanceScaleCSSProperty.current;t(this,y).loopCSSProperty.current&&t(this,y).overscroll&&t(this,R)+t(this,ct)<t(this,y).currentScrollValue&&(r=t(this,y).distance*-1-t(this,y).gap),lt.scrollEntries.update(t(this,f),t(this,y).axisCSSProperty.current,r);const i=t(this,y).currentScrollValue+r,n=t(this,R)-t(this,y).viewportSize-e,c=t(this,R)+t(this,ct)+e,g=fe.clamp(i,n,c);t(this,y).vertical?t(this,f).style.transform=`translate3d(0px, ${g*-1}px, 0px)`:t(this,f).style.transform=`translate3d(${g*-1}px, 0px, 0px)`}mark(r){t(this,N)!==r&&(t(this,N)&&t(this,f).classList.remove(t(this,N)),r&&t(this,f).classList.add(r),h(this,N,r),ee.dispatchEvent(t(this,f),"scrollSectionMarkChange",{composed:!0,detail:{mark:t(this,N)},custom:!0}))}}f=new WeakMap,Vt=new WeakMap,y=new WeakMap,ct=new WeakMap,R=new WeakMap,N=new WeakMap;const Ve=pe.createStylesheet({":host":{position:"relative",width:"100%",height:"100%",display:"block",outline:"none"},':host([hibernated="true"])':{display:"contents"},".static":{position:"var(--static-position, absolute)",top:"var(--static-top, 0)",left:"var(--static-left, 0)",width:"var(--static-width, 100%)",height:"var(--static-height, 100%)"},".content-wrapper":{width:"100%",height:"100%",overflow:"var(--overflow, initial)"},".content":{position:"relative",display:"flex",width:"100%",height:"100%",gap:"var(--gap, 0px)",willChange:"var(--will-change, transform)"},':host([hibernated="true"]) .content':{display:"contents"},"::slotted(*)":{flexShrink:"0"}});var a,ut,x,M,O,V,I,G,j,B,K,at,T,C,dt,St,pt,ft,wt,k,gt,Z,q,J,_,Q,mt,bt,X,Y,S,xt,l,Bt,_t,v,b,z,D,tt,A,P,m,zt,et,H,st,yt,Lt,it,F,Ht,o,Ot,Pt,Zt,Jt,ie,re,L,kt,me,It,Ft,ne,he,ot,oe;class Mt extends HTMLElement{constructor(){super();s(this,o);s(this,a,null);s(this,ut,new p.CSSProperty(this,"--controls",!0));s(this,x,new p.CSSProperty(this,"--axis","y"));s(this,M,new p.CSSProperty(this,"--direction",0));s(this,O,new p.CSSProperty(this,"--pages",0,{validate:e=>Math.max(0,e-1)}));s(this,V,new p.CSSProperty(this,"--split",!1));s(this,I,new p.CSSProperty(this,"--sectional",!1));s(this,G,new p.CSSProperty(this,"--easing",!1));s(this,j,new p.CSSProperty(this,"--duration",!1));s(this,B,new p.CSSProperty(this,"--auto-size",!1));s(this,K,new p.CSSProperty(this,"--wheel-max-delta",!1));s(this,at,new p.CSSProperty(this,"--drag-inertion",1));s(this,T,new p.CSSProperty(this,"--sections-in-view",1));s(this,C,new p.CSSProperty(this,"--loop",!1));s(this,dt,new p.CSSProperty(this,"--damping",20));s(this,St,new p.CSSProperty(this,"--mass",0));s(this,pt,new p.CSSProperty(this,"--stiffness",0));s(this,ft,new p.CSSProperty(this,"--mouse-drag",!1));s(this,wt,new p.CSSProperty(this,"--section-distance-scale",.5));s(this,k,new p.CSSProperty(this,"--autoplay",0));s(this,gt,new p.CSSProperty(this,"--autoplay-pause-duration",0));s(this,Z,new p.CSSProperty(this,"--autoplay-user-direction",!1));s(this,q,new p.CSSProperty(this,"--classes",!1));s(this,J,new p.CSSProperty(this,"--current-index-start-offset",0));s(this,_,new p.CSSProperty(this,"--current-index-end-offset",0));s(this,Q,new p.CSSProperty(this,"--focus-delay",0));s(this,mt,new p.CSSProperty(this,"--focus-duration",3e3));s(this,bt,new p.CSSProperty(this,"--disabled",!1));s(this,X,new p.CSSProperty(this,"--hibernated",!1));s(this,Y,null);s(this,S,null);s(this,xt,null);s(this,l,[]);s(this,Bt,0);s(this,_t,0);s(this,v,0);s(this,b,0);s(this,z,0);s(this,D,null);s(this,tt,null);s(this,A,null);s(this,P,null);s(this,m,new ke.Store(0));s(this,zt,0);s(this,et,0);s(this,H,!1);s(this,st,!0);s(this,yt,!0);s(this,Lt);s(this,it);s(this,F,new qe.Tweened);s(this,Ht,!1);s(this,L,()=>{t(this,a).unlistenAnimationFrame();const e=this.currentScrollValue/t(this,b)||0,i=t(this,m).current;if(h(this,Bt,this.vertical?Et.getCumulativeOffsetTop(this):Et.getCumulativeOffsetLeft(this)),h(this,_t,this.vertical?Et.getCumulativeOffsetTop(t(this,S)):Et.getCumulativeOffsetLeft(t(this,S))),h(this,v,this.vertical?this.offsetHeight:this.offsetWidth),this.vertical?h(this,z,Se.cssUnitParser.parse(getComputedStyle(t(this,S)).rowGap)):h(this,z,Se.cssUnitParser.parse(getComputedStyle(t(this,S)).columnGap)),t(this,B).current&&t(this,l).length){const n=t(this,T).current,c=(t(this,v)-t(this,z)*(n-1))/n;t(this,l).forEach(g=>{g.setSize(c)})}else t(this,l).forEach(n=>{n.setSize()});if(t(this,l).forEach(n=>{n.resize()}),t(this,O).current){h(this,b,t(this,v)*t(this,O).current);const n=t(this,b)+t(this,v);this.vertical?(t(this,S).style.width=n+"px",t(this,S).style.height="100%"):(t(this,S).style.height=n+"px",t(this,S).style.width="100%")}else this.vertical?(t(this,S).style.width="100%",t(this,S).style.height="max-content",h(this,b,t(this,S).offsetHeight-t(this,v))):(t(this,S).style.width="max-content",t(this,S).style.height="100%",h(this,b,t(this,S).offsetWidth-t(this,v)));if(!t(this,C).current){const n=getComputedStyle(this),c=this.vertical?parseFloat(n.paddingBlockStart)+parseFloat(n.paddingBlockEnd):parseFloat(n.paddingInlineStart)+parseFloat(n.paddingInlineEnd);h(this,b,t(this,b)+c),t(this,a).max=t(this,b)}if(t(this,C).current&&t(this,l).length){const n=t(this,l)[t(this,l).length-1],c=n.position+n.size-t(this,v),g=t(this,b)-c;h(this,et,n.position+n.size+g)}else h(this,et,t(this,b));if(t(this,I).current&&t(this,l).length){const n=t(this,l)[i];t(this,a).set(n.position,{equalize:!0})}else t(this,a).set(e*t(this,b),{equalize:!0});h(this,H,(this.vertical?t(this,S).offsetHeight:t(this,S).offsetWidth)>t(this,v)),this.classList.toggle("has-overflow",t(this,H)),t(this,H)?d(this,o,Jt).call(this):d(this,o,Zt).call(this),t(this,kt).call(this)});s(this,kt,()=>{if(!t(this,H))return;const e=this.currentScrollValue;if(h(this,zt,Math.max(0,e-t(this,b))),t(this,l).length){let i=0;for(let n=0;n<t(this,l).length;n++){const c=t(this,l)[n];c.transform(),this.targetScrollValue+c.size/2>=c.position&&(i=n)}t(this,m).current=i,console.log(t(this,m).current)}else this.vertical?t(this,S).style.transform=`translate3d(0px, ${e*-1}px, 0px)`:t(this,S).style.transform=`translate3d(${e*-1}px, 0px, 0px)`;lt.scrollEntries.update(this,t(this,x).current,e)});s(this,It,(e,i)=>{t(this,ut).current&&(d(this,o,ne).call(this,Math.sign(i)||1),t(this,Ft).call(this,e,i))});s(this,Ft,(e,i)=>{if(t(this,M).current){if(t(this,M).current<0&&i>0)return;if(t(this,M).current>0&&i<0)return}if(t(this,it)||t(this,F).unlistenAnimationFrame(),!t(this,k).current&&t(this,Q).current&&(clearInterval(t(this,Lt)),h(this,Lt,setTimeout(()=>{const n=d(this,o,oe).call(this);n&&this.scrollToSection(n.index,{tween:{duration:t(this,mt).current,easing:Ie.easeInOutExpo}})},t(this,Q).current))),!(e.includes("drag")&&!De.device.isMobile&&!t(this,ft).current)){if(t(this,I).current&&e!=="drag"){const n=Math.sign(i);if(t(this,l).length){const c={tween:t(this,G).current||t(this,j).current?{easing:t(this,G).current||"easeInOutCubic",duration:t(this,j).current||500}:void 0};t(this,Ht)?this.scrollToSection(t(this,m).current,c):this.shiftSections(n,c)}else t(this,a).shift(n*t(this,v))}else t(this,a).shift(i);h(this,Ht,e==="drag")}});if(Yt.isBrowser){const e=this.attachShadow({mode:"open"});e.adoptedStyleSheets.push(Ve);const i=document.createElement("div");i.className="static",i.innerHTML='<slot name="static"></slot>',e.appendChild(i),h(this,Y,document.createElement("div")),t(this,Y).className="content-wrapper",h(this,S,document.createElement("div")),t(this,S).className="content",h(this,xt,document.createElement("slot")),t(this,S).appendChild(t(this,xt)),t(this,Y).appendChild(t(this,S)),e.appendChild(t(this,Y))}}get damped(){return t(this,a)}get controlsCSSProperty(){return t(this,ut)}get axisCSSProperty(){return t(this,x)}get directionCSSProperty(){return t(this,M)}get pagesCSSProperty(){return t(this,O)}get splitCSSProperty(){return t(this,V)}get sectionalCSSProperty(){return t(this,I)}get easingCSSProperty(){return t(this,G)}get durationCSSProperty(){return t(this,j)}get autoSizeCSSProperty(){return t(this,B)}get wheelMaxDeltaCSSProperty(){return t(this,K)}get dragInertionCSSProperty(){return t(this,at)}get sectionsInViewCSSProperty(){return t(this,T)}get loopCSSProperty(){return t(this,C)}get dampingCSSProperty(){return t(this,dt)}get massCSSProperty(){return t(this,St)}get stiffnessCSSProperty(){return t(this,pt)}get mouseDragCSSProperty(){return t(this,ft)}get sectionDistanceScaleCSSProperty(){return t(this,wt)}get autoplayCSSProperty(){return t(this,k)}get autoplayPauseDurationCSSProperty(){return t(this,gt)}get autoplayUserDirectionCSSProperty(){return t(this,Z)}get classesCSSProperty(){return t(this,q)}get currentIndexStartOffsetCSSProperty(){return t(this,J)}get currentIndexEndOffsetCSSProperty(){return t(this,_)}get focusDelayCSSProperty(){return t(this,Q)}get focusDurationCSSProperty(){return t(this,mt)}get disabledCSSProperty(){return t(this,bt)}get hibernatedCSSProperty(){return t(this,X)}get currentScrollValue(){return d(this,o,he).call(this,"current")}get targetScrollValue(){return d(this,o,he).call(this,"target")}get contentWrapperElement(){return t(this,Y)}get contentElement(){return t(this,S)}get sections(){return t(this,l)}get position(){return t(this,Bt)}get contentPosition(){return t(this,_t)}get viewportSize(){return t(this,v)}get scrollSize(){return t(this,b)}get gap(){return t(this,z)}get counter(){return t(this,m)}get limit(){return t(this,l).length-t(this,T).current}get distance(){return t(this,et)}get loopDistance(){return t(this,C).current?t(this,et)+t(this,z):t(this,et)}get hasOverflow(){return t(this,H)}get overscroll(){return t(this,zt)}get vertical(){return t(this,x).current==="y"}get currentProgress(){return this.currentScrollValue/this.loopDistance||0}get targetProgress(){return this.targetScrollValue/this.loopDistance||0}get scrollWidth(){return t(this,x).current==="y"?0:t(this,a).distance}get scrollHeight(){return t(this,x).current==="x"?0:t(this,a).distance}onScroll(...e){return t(this,a).subscribe(...e)}offScroll(...e){t(this,a).unsubscribe(...e)}range(e,i,n=0){const c=e-n,g=c+i+n*2;return this.currentProgress<c?0:this.currentProgress>g?1:(this.currentProgress-c)/(g-c)}curve(e,i,n=0){return Math.sin(this.range(e,i,n)*Math.PI)}visible(e,i,n=0){const c=e-n,g=c+i+n*2;return this.currentProgress>=c&&this.currentProgress<=g}scrollToSection(e,i){if(!t(this,l).length)return;const n=t(this,m).current;d(this,o,me).call(this,e);const c=t(this,l)[n],g=t(this,l)[t(this,m).current];if(c&&g){let w=0;const Ct=d(this,o,oe).call(this),we=Ct?this.targetScrollValue-Ct.position:0;t(this,C).current?t(this,m).current===0&&n===t(this,l).length-1?w=t(this,b)+t(this,v)-c.position+t(this,z):t(this,m).current===t(this,l).length-1&&n===0?w=g.position-(t(this,b)+t(this,v)+t(this,z)):w=g.position-c.position:w=g.position-c.position,this.shiftPosition(w-we,i)}}shiftSections(e,i){t(this,l).length&&this.scrollToSection(t(this,m).current+e,i)}setPosition(e,i){d(this,o,ne).call(this,Math.sign(e)||1),i!=null&&i.tween?t(this,it)||(t(this,F).set(t(this,a).current,{equalize:!0}),t(this,F).set(e,de({},i.tween)),h(this,it,setTimeout(()=>{h(this,it,void 0)},i.tween.duration))):t(this,a).set(e,{equalize:(i==null?void 0:i.behaviour)==="instant"})}shiftPosition(e,i){this.setPosition(t(this,a).target+e,i)}connectedCallback(){lt.scrollEntries.register(this),h(this,a,new Te.Damped(0,{damping:.01,min:0,order:se.TICK_ORDER.SCROLL})),this.setAttribute("tabindex","0"),h(this,D,new Kt.WheelControls({element:t(this,S)})),t(this,D).changeEvent.subscribe(t(this,It)),h(this,tt,new Kt.KeyboardControls({element:this})),t(this,tt).changeEvent.subscribe(t(this,It)),h(this,A,new Kt.DragControls({element:t(this,S)})),t(this,A).changeEvent.subscribe(t(this,It)),h(this,P,new Kt.AutoplayControls({culling:this})),t(this,P).changeEvent.subscribe(t(this,Ft)),t(this,x).subscribe(({current:e})=>{t(this,S).style.flexDirection=e==="x"?"row":"column",t(this,D).axis=t(this,K).current?"max":e,t(this,tt).dimension=e==="x"?"width":"height",t(this,A).axis=e,e==="x"?this.style.touchAction="pan-y":e==="y"&&(this.style.touchAction="pan-x"),this.isConnected&&t(this,L).call(this)}),t(this,K).subscribe(e=>{t(this,D).axis=e.current?"max":t(this,x).current}),t(this,at).subscribe(e=>{t(this,A).inertion=typeof e.current=="number"?e.current:1}),t(this,O).subscribe(()=>{this.isConnected&&t(this,L).call(this)}),t(this,V).subscribe(({current:e})=>{this.isConnected&&(e?d(this,o,Ot).call(this):d(this,o,Pt).call(this))}),t(this,I).subscribe(e=>{t(this,D).debounce=e.current,t(this,A).swipe=e.current,t(this,P).interval=e.current,this.isConnected&&(e.current&&!e.previous&&!t(this,l).length?d(this,o,Ot).call(this):!e.current&&e.previous&&t(this,l).length&&d(this,o,Pt).call(this))}),t(this,B).subscribe(e=>{this.isConnected&&(t(this,L).call(this),e.current&&!e.previous&&!t(this,l).length?d(this,o,Ot).call(this):!e.current&&e.previous&&t(this,l).length&&d(this,o,Pt).call(this))}),t(this,T).subscribe(e=>{this.isConnected&&(t(this,L).call(this),d(this,o,ot).call(this))}),t(this,C).subscribe(e=>{e.current?(this.isConnected&&(t(this,l).length||(t(this,V).current=!0)),t(this,l).length&&(t(this,a).max=1/0,t(this,a).min=-1/0)):(h(this,zt,0),t(this,a).max=t(this,b),t(this,a).min=0)}),t(this,dt).subscribe(e=>{t(this,a).damping=e.current}),t(this,St).subscribe(e=>{t(this,a).mass=e.current}),t(this,pt).subscribe(e=>{t(this,a).stiffness=e.current}),t(this,k).subscribe(e=>{t(this,P).speed=e.current,!t(this,st)&&e.current&&!e.previous?t(this,P).connect():!e.current&&e.previous&&t(this,P).disconnect()}),t(this,Z).subscribe(e=>{e.current||(t(this,P).direction=1)}),t(this,q).subscribe(e=>{this.isConnected&&d(this,o,ot).call(this)}),t(this,J).subscribe(e=>{this.isConnected&&t(this,q).current&&d(this,o,ot).call(this)}),t(this,_).subscribe(e=>{this.isConnected&&t(this,q).current&&d(this,o,ot).call(this)}),t(this,a).isRunning.subscribe(e=>{this.classList.toggle("active",e.current)}),t(this,m).subscribe(e=>{t(this,l).length&&d(this,o,ot).call(this)}),t(this,F).subscribe(e=>{t(this,F).isRunning.current&&t(this,a).set(e.current,{equalize:!0})}),t(this,bt).subscribe(e=>{e.current&&!e.previous?d(this,o,Zt).call(this):!e.current&&e.previous&&d(this,o,Jt).call(this)}),t(this,X).subscribe(e=>{e.current&&!e.previous?d(this,o,ie).call(this):!e.current&&e.previous&&d(this,o,re).call(this)}),t(this,ut).observe(),t(this,x).observe(),t(this,M).observe(),t(this,O).observe(),t(this,V).observe(),t(this,I).observe(),t(this,G).observe(),t(this,j).observe(),t(this,B).observe(),t(this,K).observe(),t(this,at).observe(),t(this,T).observe(),t(this,C).observe(),t(this,dt).observe(),t(this,St).observe(),t(this,pt).observe(),t(this,ft).observe(),t(this,wt).observe(),t(this,k).observe(),t(this,k).observe(),t(this,gt).observe(),t(this,Z).observe(),t(this,q).observe(),t(this,J).observe(),t(this,_).observe(),t(this,Q).observe(),t(this,mt).observe(),t(this,bt).observe(),t(this,X).observe(),t(this,X).current||d(this,o,re).call(this)}disconnectedCallback(){this.removeAttribute("tabindex"),this.classList.remove("has-overflow"),t(this,ut).unobserve(),t(this,x).unobserve(),t(this,M).unobserve(),t(this,O).unobserve(),t(this,V).unobserve(),t(this,I).unobserve(),t(this,G).unobserve(),t(this,j).unobserve(),t(this,B).unobserve(),t(this,K).unobserve(),t(this,at).unobserve(),t(this,T).unobserve(),t(this,C).unobserve(),t(this,dt).unobserve(),t(this,St).unobserve(),t(this,pt).unobserve(),t(this,ft).unobserve(),t(this,wt).unobserve(),t(this,k).unobserve(),t(this,gt).unobserve(),t(this,Z).unobserve(),t(this,q).unobserve(),t(this,J).unobserve(),t(this,_).unobserve(),t(this,Q).unobserve(),t(this,mt).unobserve(),t(this,bt).unobserve(),t(this,X).unobserve(),d(this,o,ie).call(this)}}a=new WeakMap,ut=new WeakMap,x=new WeakMap,M=new WeakMap,O=new WeakMap,V=new WeakMap,I=new WeakMap,G=new WeakMap,j=new WeakMap,B=new WeakMap,K=new WeakMap,at=new WeakMap,T=new WeakMap,C=new WeakMap,dt=new WeakMap,St=new WeakMap,pt=new WeakMap,ft=new WeakMap,wt=new WeakMap,k=new WeakMap,gt=new WeakMap,Z=new WeakMap,q=new WeakMap,J=new WeakMap,_=new WeakMap,Q=new WeakMap,mt=new WeakMap,bt=new WeakMap,X=new WeakMap,Y=new WeakMap,S=new WeakMap,xt=new WeakMap,l=new WeakMap,Bt=new WeakMap,_t=new WeakMap,v=new WeakMap,b=new WeakMap,z=new WeakMap,D=new WeakMap,tt=new WeakMap,A=new WeakMap,P=new WeakMap,m=new WeakMap,zt=new WeakMap,et=new WeakMap,H=new WeakMap,st=new WeakMap,yt=new WeakMap,Lt=new WeakMap,it=new WeakMap,F=new WeakMap,Ht=new WeakMap,o=new WeakSet,Ot=function(){d(this,o,Pt).call(this),t(this,xt).assignedElements().forEach((e,i)=>{e instanceof HTMLElement&&t(this,l).push(new Oe(e,i,this))}),t(this,S).style.transform="",ee.dispatchEvent(this,"scrollSectionsChange",{custom:!0,composed:!0}),t(this,L).call(this),d(this,o,ot).call(this)},Pt=function(){t(this,l).forEach(e=>{e.destroy()}),h(this,l,[]),t(this,m).reset(),t(this,a).reset(),ee.dispatchEvent(this,"scrollSectionsChange",{custom:!0,composed:!0})},Zt=function(){t(this,st)||(h(this,st,!0),t(this,a).unsubscribe(t(this,kt)),t(this,a).unlistenAnimationFrame(),clearInterval(t(this,Lt)),clearInterval(t(this,it)),t(this,F).unlistenAnimationFrame(),t(this,D).disconnect(),t(this,tt).disconnect(),t(this,A).disconnect(),t(this,P).disconnect(),t(this,H)||this.sections.forEach(e=>{e.unsetTransform()}))},Jt=function(){t(this,st)&&(h(this,st,!1),t(this,a).subscribe(t(this,kt)),t(this,D).connect(),t(this,tt).connect(),t(this,A).connect(),t(this,k).current&&t(this,P).connect())},ie=function(){t(this,yt)||(h(this,yt,!0),Qt.windowResizer.unsubscribe(t(this,L)),Xt.elementResizer.unsubscribe(t(this,L)),d(this,o,Zt).call(this),t(this,S).style.transform="",t(this,l).length?d(this,o,Pt).call(this):(t(this,m).reset(),t(this,a).reset()),lt.scrollEntries.unregister(this))},re=function(){t(this,yt)&&(h(this,yt,!1),lt.scrollEntries.register(this),(t(this,C).current||t(this,V).current||t(this,C).current||t(this,B).current||t(this,I).current)&&d(this,o,Ot).call(this),d(this,o,Jt).call(this),Qt.windowResizer.subscribe(t(this,L),se.RESIZE_ORDER.SCROLL),Xt.elementResizer.subscribe(this,t(this,L)))},L=new WeakMap,kt=new WeakMap,me=function(e){t(this,C).current?(t(this,m).current=e%t(this,l).length,t(this,m).current=t(this,m).current<0?t(this,l).length+t(this,m).current:t(this,m).current):t(this,m).current=fe.clamp(e,0,this.limit)},It=new WeakMap,Ft=new WeakMap,ne=function(e=1){t(this,Z).current&&(t(this,P).direction=e),t(this,k).current&&t(this,P).pauseAndContinue(t(this,gt).current,this.sectionalCSSProperty.current)},he=function(e="current"){if(t(this,C).current&&t(this,l).length){const i=t(this,a)[e]%(t(this,b)+t(this,v)+t(this,z));return i<0?t(this,b)+i+t(this,v)+t(this,z):i}else return t(this,a)[e]},ot=function(){if(t(this,q).current&&t(this,l).length){const e=t(this,m).current+t(this,J).current;e===0?this.classList.add("start"):this.classList.remove("start"),e===this.limit?this.classList.add("end"):this.classList.remove("end");const i=t(this,T).current+t(this,_).current;t(this,l).forEach((n,c)=>{const g=e-this.limit-1+t(this,_).current,w=e+i,Ct=this.sections.length-w;c>=e&&c<w||c<=g?n.mark("current"):c>=w&&c<w+Ct/2||c<=g+i?n.mark("next"):n.mark("previous")})}},oe=function(e=this.targetScrollValue){let i=null,n=1/0;for(let c=0;c<t(this,l).length;c++){const g=Math.abs(t(this,l)[c].position-e);g<n&&(n=g,i=c)}return i!==null?t(this,l)[i]:null};customElements.get("e-scroll")||customElements.define("e-scroll",Mt);var Wt;class le extends HTMLElement{constructor(){super(...arguments);s(this,Wt,null)}get scrollElement(){return t(this,Wt)}connectedCallback(){const e=ge.findParentElement(this,Mt);e instanceof Mt?h(this,Wt,e):console.error(this,"e-scroll not found")}}Wt=new WeakMap;var rt,E,W,U,Tt,qt,vt,Ut,$t,Nt;class be extends le{constructor(){super();s(this,rt,null);s(this,E,null);s(this,W,!1);s(this,U,0);s(this,Tt,0);s(this,qt,0);s(this,vt,()=>{h(this,W,this.offsetWidth>this.offsetHeight);const e=t(this,W)?this.offsetWidth:this.offsetHeight;h(this,U,e/((this.scrollElement.scrollSize+this.scrollElement.viewportSize)/e)),h(this,U,Math.max(t(this,U),30)),t(this,W)?(t(this,E).style.width=t(this,U)+"px",t(this,E).style.height="100%"):(t(this,E).style.width="100%",t(this,E).style.height=t(this,U)+"px"),h(this,Tt,e-t(this,U)),this.scrollElement.scrollSize||(this.style.display="none")});s(this,Ut,()=>{h(this,qt,this.scrollElement.currentProgress*t(this,Tt)),t(this,W)?t(this,E).style.transform=`translate3d(${t(this,qt)}px, 0px, 0px)`:t(this,E).style.transform=`translate3d(0px, ${t(this,qt)}px, 0px)`});s(this,$t,()=>{this.setAttribute("axis",this.scrollElement.axisCSSProperty.current)});s(this,Nt,e=>{document.documentElement.classList.add("grabbing"),Ae.setupDrag(c=>{const g=t(this,W)?c.x:c.y,w=this.scrollElement.distance/t(this,Tt),Ct=(g-n)*w;this.scrollElement.setPosition(i+Ct)},()=>{document.documentElement.classList.remove("grabbing")});const i=this.scrollElement.damped.target,n=t(this,W)?e.x:e.y});if(Yt.isBrowser){const e=this.attachShadow({mode:"open"});e.adoptedStyleSheets.push(pe.createStylesheet({":host":{display:"inline-block",zIndex:"1",backgroundColor:"#ebebeb"},':host([axis="y"])':{position:"absolute",right:"0",top:"0",width:"1vmin",height:"100%"},':host([axis="x"])':{position:"absolute",left:"0",bottom:"0",width:"100%",height:"1vmin"},".default-thumb":{backgroundColor:"black",borderRadius:"0.3vmin",touchAction:"none"},"::slotted(*)":{touchAction:"none"}})),h(this,rt,document.createElement("slot")),t(this,rt).innerHTML='<div class="default-thumb"></div>',e.appendChild(t(this,rt))}}get thumbElement(){return t(this,E)}connectedCallback(){super.connectedCallback(),this.setAttribute("drag-dead-zone","");const e=t(this,rt).assignedElements()[0]||t(this,rt).firstElementChild;h(this,E,e),t(this,E).addEventListener("pointerdown",t(this,Nt)),Qt.windowResizer.subscribe(t(this,vt),se.RESIZE_ORDER.SCROLL),Xt.elementResizer.subscribe(this,t(this,vt)),this.scrollElement.onScroll(t(this,Ut)),this.scrollElement.axisCSSProperty.subscribe(t(this,$t))}disconnectedCallback(){this.removeAttribute("drag-dead-zone"),t(this,E).removeEventListener("pointerdown",t(this,Nt)),Qt.windowResizer.unsubscribe(t(this,vt)),Xt.elementResizer.unsubscribe(t(this,vt)),this.scrollElement.offScroll(t(this,Ut)),this.scrollElement.axisCSSProperty.unsubscribe(t(this,$t))}}rt=new WeakMap,E=new WeakMap,W=new WeakMap,U=new WeakMap,Tt=new WeakMap,qt=new WeakMap,vt=new WeakMap,Ut=new WeakMap,$t=new WeakMap,Nt=new WeakMap;customElements.get("e-scrollbar")||customElements.define("e-scrollbar",be);class ye extends le{constructor(){super(),Yt.isBrowser&&this.addEventListener("click",()=>{const r=this.getAttribute("behaviour"),e=this.getAttribute("easing")||void 0,i=e?parseFloat(this.getAttribute("duration")||"0"):void 0;this.handleClick({behaviour:r,tween:e?{easing:e,duration:i}:void 0})})}}class ve extends ye{handleClick(r){const e=this.getAttribute("index");this.scrollElement.scrollToSection(parseInt(e||"0"),r)}}customElements.get("e-scroll-set-button")||customElements.define("e-scroll-set-button",ve);class Ce extends ye{handleClick(r){const e=this.getAttribute("step");this.scrollElement.shiftSections(parseInt(e||"1"),r)}}customElements.get("e-scroll-step-button")||customElements.define("e-scroll-step-button",Ce);var $,nt,Dt,Gt,jt,At;class Be{constructor(r,e,i){s(this,$,null);s(this,nt,null);s(this,Dt,null);s(this,Gt,null);s(this,jt,()=>{t(this,nt).scrollToSection(t(this,Dt),{behaviour:t(this,Gt)})});s(this,At,()=>{t(this,$).classList.toggle("current",t(this,nt).counter.current===t(this,Dt))});Yt.isBrowser&&(h(this,$,document.createElement("button")),h(this,nt,r),h(this,Gt,i),h(this,Dt,e),t(this,$).addEventListener("click",t(this,jt)),t(this,nt).counter.subscribe(t(this,At)),t(this,At).call(this))}get element(){return t(this,$)}destroy(){t(this,$).removeEventListener("click",t(this,jt)),t(this,nt).counter.unsubscribe(t(this,At)),t(this,$).remove()}}$=new WeakMap,nt=new WeakMap,Dt=new WeakMap,Gt=new WeakMap,jt=new WeakMap,At=new WeakMap;var ht,Rt;class Pe extends le{constructor(){super(...arguments);s(this,ht,[]);s(this,Rt,Re.debounce(()=>{t(this,ht).forEach(e=>e.destroy()),h(this,ht,[]);for(let e=0;e<this.scrollElement.sections.length;e++){const i=new Be(this.scrollElement,e,this.getAttribute("behaviour")||"smooth");this.appendChild(i.element),t(this,ht).push(i)}},0))}connectedCallback(){super.connectedCallback(),this.scrollElement.addEventListener("sectionsChange",t(this,Rt)),t(this,Rt).call(this)}disconnectedCallback(){this.scrollElement.removeEventListener("sectionsChange",t(this,Rt)),t(this,ht).forEach(e=>e.destroy()),h(this,ht,[])}}ht=new WeakMap,Rt=new WeakMap;customElements.get("e-scroll-bullet-buttons")||customElements.define("e-scroll-bullet-buttons",Pe);class Ee extends Me.ScrollSegmentElement{connectedCallback(){const r=ge.findParentElement(this,Mt);r instanceof Mt?(this.scrollContainer=r,this.scrollContainer.addEventListener("scrollSectionsChange",this.findAnotherScrollEntries)):console.error(this,"e-scroll not found")}}customElements.get("e-scroll-segment")||customElements.define("e-scroll-segment",Ee);exports.ScrollBulletButtonsElement=Pe;exports.ScrollElement=Mt;exports.ScrollSegmentElement=Ee;exports.ScrollSetButtonElement=ve;exports.ScrollStepButtonElement=Ce;exports.ScrollbarElement=be;
|
|
1
|
+
"use strict";var xe=Object.defineProperty;var ce=Object.getOwnPropertySymbols;var ze=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable;var ae=u=>{throw TypeError(u)};var ue=(u,r,e)=>r in u?xe(u,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[r]=e,de=(u,r)=>{for(var e in r||(r={}))ze.call(r,e)&&ue(u,e,r[e]);if(ce)for(var e of ce(r))Le.call(r,e)&&ue(u,e,r[e]);return u};var te=(u,r,e)=>r.has(u)||ae("Cannot "+e);var t=(u,r,e)=>(te(u,r,"read from private field"),e?e.call(u):r.get(u)),s=(u,r,e)=>r.has(u)?ae("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(u):r.set(u,e),h=(u,r,e,i)=>(te(u,r,"write to private field"),i?i.call(u,e):r.set(u,e),e),d=(u,r,e)=>(te(u,r,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ke=require("../../Store-CDb6RMce.cjs"),Yt=require("../../browser-CpzFX2xg.cjs"),Ie=require("../../easings-GegIwET5.cjs"),ee=require("../../events-KVanG9sR.cjs"),pe=require("../../jss-GJLvaNfT.cjs"),Et=require("../../layout-8ryRAMGJ.cjs"),fe=require("../../math-GDWEqu7y.cjs");require("../../ticker/vanilla/index.cjs");const se=require("../../order/index.cjs"),Te=require("../../Damped-CTsV8tl_.cjs"),qe=require("../../Tweened-C0-UzxN-.cjs"),Kt=require("../../controls/index.cjs"),Qt=require("../../window-resizer/vanilla/index.cjs"),lt=require("../../scroll-entries/index.cjs"),Se=require("../../css-unit-parser/index.cjs"),p=require("../../css-property/index.cjs"),De=require("../../device/index.cjs"),Xt=require("../../element-resizer/vanilla/index.cjs"),Ae=require("../../gestures-DHLrn6Q8.cjs"),ge=require("../../dom-JBOkFLTh.cjs"),Re=require("../../function-MthRj-GJ.cjs"),Me=require("../../scroll-segment/index.cjs");var f,Vt,y,ct,R,N;class Oe{constructor(r,e,i){s(this,f);s(this,Vt);s(this,y);s(this,ct,0);s(this,R,0);s(this,N,null);h(this,f,r),h(this,Vt,e),h(this,y,i),lt.scrollEntries.register(t(this,f))}get index(){return t(this,Vt)}get size(){return t(this,ct)}get position(){return t(this,R)}destroy(){lt.scrollEntries.unregister(t(this,f)),this.unsetTransform()}unsetTransform(){t(this,f).style.transform="",this.mark(null)}setSize(r){r?(t(this,f).style.setProperty("--size",r+"px"),t(this,y).axisCSSProperty.current==="x"?(t(this,f).style.width=r+"px",t(this,f).style.height=""):(t(this,f).style.height=r+"px",t(this,f).style.width="")):(t(this,f).style.width="",t(this,f).style.height="",t(this,f).style.removeProperty("--size"))}resize(){h(this,ct,t(this,y).vertical?t(this,f).offsetHeight:t(this,f).offsetWidth),h(this,R,t(this,y).vertical?Et.getCumulativeOffsetTop(t(this,f)):Et.getCumulativeOffsetLeft(t(this,f))),h(this,R,t(this,R)-t(this,y).contentPosition)}transform(){let r=0;const e=t(this,y).viewportSize*t(this,y).sectionDistanceScaleCSSProperty.current;t(this,y).loopCSSProperty.current&&t(this,y).overscroll&&t(this,R)+t(this,ct)<t(this,y).currentScrollValue&&(r=t(this,y).distance*-1-t(this,y).gap),lt.scrollEntries.update(t(this,f),t(this,y).axisCSSProperty.current,r);const i=t(this,y).currentScrollValue+r,n=t(this,R)-t(this,y).viewportSize-e,c=t(this,R)+t(this,ct)+e,g=fe.clamp(i,n,c);t(this,y).vertical?t(this,f).style.transform=`translate3d(0px, ${g*-1}px, 0px)`:t(this,f).style.transform=`translate3d(${g*-1}px, 0px, 0px)`}mark(r){t(this,N)!==r&&(t(this,N)&&t(this,f).classList.remove(t(this,N)),r&&t(this,f).classList.add(r),h(this,N,r),ee.dispatchEvent(t(this,f),"scrollSectionMarkChange",{composed:!0,detail:{mark:t(this,N)},custom:!0}))}}f=new WeakMap,Vt=new WeakMap,y=new WeakMap,ct=new WeakMap,R=new WeakMap,N=new WeakMap;const Ve=pe.createStylesheet({":host":{position:"relative",width:"100%",height:"100%",display:"block",outline:"none"},':host([hibernated="true"])':{display:"contents"},".static":{position:"var(--static-position, absolute)",top:"var(--static-top, 0)",left:"var(--static-left, 0)",width:"var(--static-width, 100%)",height:"var(--static-height, 100%)"},".content-wrapper":{width:"100%",height:"100%",overflow:"var(--overflow, initial)"},".content":{position:"relative",display:"flex",width:"100%",height:"100%",gap:"var(--gap, 0px)",willChange:"var(--will-change, transform)"},':host([hibernated="true"]) .content':{display:"contents"},"::slotted(*)":{flexShrink:"0"}});var a,ut,x,M,O,V,I,G,j,B,K,at,T,C,dt,St,pt,ft,wt,k,gt,Z,q,J,_,Q,mt,bt,X,Y,S,xt,l,Bt,_t,v,b,z,D,tt,A,P,m,zt,et,H,st,yt,Lt,it,F,Ht,o,Ot,Pt,Zt,Jt,ie,re,L,kt,me,It,Ft,ne,he,ot,oe;class Mt extends HTMLElement{constructor(){super();s(this,o);s(this,a,null);s(this,ut,new p.CSSProperty(this,"--controls",!0));s(this,x,new p.CSSProperty(this,"--axis","y"));s(this,M,new p.CSSProperty(this,"--direction",0));s(this,O,new p.CSSProperty(this,"--pages",0,{validate:e=>Math.max(0,e-1)}));s(this,V,new p.CSSProperty(this,"--split",!1));s(this,I,new p.CSSProperty(this,"--sectional",!1));s(this,G,new p.CSSProperty(this,"--easing",!1));s(this,j,new p.CSSProperty(this,"--duration",!1));s(this,B,new p.CSSProperty(this,"--auto-size",!1));s(this,K,new p.CSSProperty(this,"--wheel-max-delta",!1));s(this,at,new p.CSSProperty(this,"--drag-inertion",1));s(this,T,new p.CSSProperty(this,"--sections-in-view",1));s(this,C,new p.CSSProperty(this,"--loop",!1));s(this,dt,new p.CSSProperty(this,"--damping",20));s(this,St,new p.CSSProperty(this,"--mass",0));s(this,pt,new p.CSSProperty(this,"--stiffness",0));s(this,ft,new p.CSSProperty(this,"--mouse-drag",!1));s(this,wt,new p.CSSProperty(this,"--section-distance-scale",.5));s(this,k,new p.CSSProperty(this,"--autoplay",0));s(this,gt,new p.CSSProperty(this,"--autoplay-pause-duration",0));s(this,Z,new p.CSSProperty(this,"--autoplay-user-direction",!1));s(this,q,new p.CSSProperty(this,"--classes",!1));s(this,J,new p.CSSProperty(this,"--current-index-start-offset",0));s(this,_,new p.CSSProperty(this,"--current-index-end-offset",0));s(this,Q,new p.CSSProperty(this,"--focus-delay",0));s(this,mt,new p.CSSProperty(this,"--focus-duration",3e3));s(this,bt,new p.CSSProperty(this,"--disabled",!1));s(this,X,new p.CSSProperty(this,"--hibernated",!1));s(this,Y,null);s(this,S,null);s(this,xt,null);s(this,l,[]);s(this,Bt,0);s(this,_t,0);s(this,v,0);s(this,b,0);s(this,z,0);s(this,D,null);s(this,tt,null);s(this,A,null);s(this,P,null);s(this,m,new ke.Store(0));s(this,zt,0);s(this,et,0);s(this,H,!1);s(this,st,!0);s(this,yt,!0);s(this,Lt);s(this,it);s(this,F,new qe.Tweened);s(this,Ht,!1);s(this,L,()=>{t(this,a).unlistenAnimationFrame();const e=this.currentScrollValue/t(this,b)||0,i=t(this,m).current;if(h(this,Bt,this.vertical?Et.getCumulativeOffsetTop(this):Et.getCumulativeOffsetLeft(this)),h(this,_t,this.vertical?Et.getCumulativeOffsetTop(t(this,S)):Et.getCumulativeOffsetLeft(t(this,S))),h(this,v,this.vertical?this.offsetHeight:this.offsetWidth),this.vertical?h(this,z,Se.cssUnitParser.parse(getComputedStyle(t(this,S)).rowGap)):h(this,z,Se.cssUnitParser.parse(getComputedStyle(t(this,S)).columnGap)),t(this,B).current&&t(this,l).length){const n=t(this,T).current,c=(t(this,v)-t(this,z)*(n-1))/n;t(this,l).forEach(g=>{g.setSize(c)})}else t(this,l).forEach(n=>{n.setSize()});if(t(this,l).forEach(n=>{n.resize()}),t(this,O).current){h(this,b,t(this,v)*t(this,O).current);const n=t(this,b)+t(this,v);this.vertical?(t(this,S).style.width=n+"px",t(this,S).style.height="100%"):(t(this,S).style.height=n+"px",t(this,S).style.width="100%")}else this.vertical?(t(this,S).style.width="100%",t(this,S).style.height="max-content",h(this,b,t(this,S).offsetHeight-t(this,v))):(t(this,S).style.width="max-content",t(this,S).style.height="100%",h(this,b,t(this,S).offsetWidth-t(this,v)));if(!t(this,C).current){const n=getComputedStyle(this),c=this.vertical?parseFloat(n.paddingBlockStart)+parseFloat(n.paddingBlockEnd):parseFloat(n.paddingInlineStart)+parseFloat(n.paddingInlineEnd);h(this,b,t(this,b)+c),t(this,a).max=t(this,b)}if(t(this,C).current&&t(this,l).length){const n=t(this,l)[t(this,l).length-1],c=n.position+n.size-t(this,v),g=t(this,b)-c;h(this,et,n.position+n.size+g)}else h(this,et,t(this,b));if(t(this,I).current&&t(this,l).length){const n=t(this,l)[i];t(this,a).set(n.position,{equalize:!0})}else t(this,a).set(e*t(this,b),{equalize:!0});h(this,H,(this.vertical?t(this,S).offsetHeight:t(this,S).offsetWidth)>t(this,v)),this.classList.toggle("has-overflow",t(this,H)),t(this,H)?d(this,o,Jt).call(this):d(this,o,Zt).call(this),t(this,kt).call(this)});s(this,kt,()=>{if(!t(this,H))return;const e=this.currentScrollValue;if(h(this,zt,Math.max(0,e-t(this,b))),t(this,l).length){let i=0;for(let n=0;n<t(this,l).length;n++){const c=t(this,l)[n];c.transform(),this.targetScrollValue+c.size/2>=c.position&&(i=n)}t(this,m).current=i}else this.vertical?t(this,S).style.transform=`translate3d(0px, ${e*-1}px, 0px)`:t(this,S).style.transform=`translate3d(${e*-1}px, 0px, 0px)`;lt.scrollEntries.update(this,t(this,x).current,e)});s(this,It,(e,i)=>{t(this,ut).current&&(d(this,o,ne).call(this,Math.sign(i)||1),t(this,Ft).call(this,e,i))});s(this,Ft,(e,i)=>{if(t(this,M).current){if(t(this,M).current<0&&i>0)return;if(t(this,M).current>0&&i<0)return}if(t(this,it)||t(this,F).unlistenAnimationFrame(),!t(this,k).current&&t(this,Q).current&&(clearInterval(t(this,Lt)),h(this,Lt,setTimeout(()=>{const n=d(this,o,oe).call(this);n&&this.scrollToSection(n.index,{tween:{duration:t(this,mt).current,easing:Ie.easeInOutExpo}})},t(this,Q).current))),!(e.includes("drag")&&!De.device.isMobile&&!t(this,ft).current)){if(t(this,I).current&&e!=="drag"){const n=Math.sign(i);if(t(this,l).length){const c={tween:t(this,G).current||t(this,j).current?{easing:t(this,G).current||"easeInOutCubic",duration:t(this,j).current||500}:void 0};t(this,Ht)?this.scrollToSection(t(this,m).current,c):this.shiftSections(n,c)}else t(this,a).shift(n*t(this,v))}else t(this,a).shift(i);h(this,Ht,e==="drag")}});if(Yt.isBrowser){const e=this.attachShadow({mode:"open"});e.adoptedStyleSheets.push(Ve);const i=document.createElement("div");i.className="static",i.innerHTML='<slot name="static"></slot>',e.appendChild(i),h(this,Y,document.createElement("div")),t(this,Y).className="content-wrapper",h(this,S,document.createElement("div")),t(this,S).className="content",h(this,xt,document.createElement("slot")),t(this,S).appendChild(t(this,xt)),t(this,Y).appendChild(t(this,S)),e.appendChild(t(this,Y))}}get damped(){return t(this,a)}get controlsCSSProperty(){return t(this,ut)}get axisCSSProperty(){return t(this,x)}get directionCSSProperty(){return t(this,M)}get pagesCSSProperty(){return t(this,O)}get splitCSSProperty(){return t(this,V)}get sectionalCSSProperty(){return t(this,I)}get easingCSSProperty(){return t(this,G)}get durationCSSProperty(){return t(this,j)}get autoSizeCSSProperty(){return t(this,B)}get wheelMaxDeltaCSSProperty(){return t(this,K)}get dragInertionCSSProperty(){return t(this,at)}get sectionsInViewCSSProperty(){return t(this,T)}get loopCSSProperty(){return t(this,C)}get dampingCSSProperty(){return t(this,dt)}get massCSSProperty(){return t(this,St)}get stiffnessCSSProperty(){return t(this,pt)}get mouseDragCSSProperty(){return t(this,ft)}get sectionDistanceScaleCSSProperty(){return t(this,wt)}get autoplayCSSProperty(){return t(this,k)}get autoplayPauseDurationCSSProperty(){return t(this,gt)}get autoplayUserDirectionCSSProperty(){return t(this,Z)}get classesCSSProperty(){return t(this,q)}get currentIndexStartOffsetCSSProperty(){return t(this,J)}get currentIndexEndOffsetCSSProperty(){return t(this,_)}get focusDelayCSSProperty(){return t(this,Q)}get focusDurationCSSProperty(){return t(this,mt)}get disabledCSSProperty(){return t(this,bt)}get hibernatedCSSProperty(){return t(this,X)}get currentScrollValue(){return d(this,o,he).call(this,"current")}get targetScrollValue(){return d(this,o,he).call(this,"target")}get contentWrapperElement(){return t(this,Y)}get contentElement(){return t(this,S)}get sections(){return t(this,l)}get position(){return t(this,Bt)}get contentPosition(){return t(this,_t)}get viewportSize(){return t(this,v)}get scrollSize(){return t(this,b)}get gap(){return t(this,z)}get counter(){return t(this,m)}get limit(){return Math.ceil(t(this,l).length-t(this,T).current)}get distance(){return t(this,et)}get loopDistance(){return t(this,C).current?t(this,et)+t(this,z):t(this,et)}get hasOverflow(){return t(this,H)}get overscroll(){return t(this,zt)}get vertical(){return t(this,x).current==="y"}get currentProgress(){return this.currentScrollValue/this.loopDistance||0}get targetProgress(){return this.targetScrollValue/this.loopDistance||0}get scrollWidth(){return t(this,x).current==="y"?0:t(this,a).distance}get scrollHeight(){return t(this,x).current==="x"?0:t(this,a).distance}onScroll(...e){return t(this,a).subscribe(...e)}offScroll(...e){t(this,a).unsubscribe(...e)}range(e,i,n=0){const c=e-n,g=c+i+n*2;return this.currentProgress<c?0:this.currentProgress>g?1:(this.currentProgress-c)/(g-c)}curve(e,i,n=0){return Math.sin(this.range(e,i,n)*Math.PI)}visible(e,i,n=0){const c=e-n,g=c+i+n*2;return this.currentProgress>=c&&this.currentProgress<=g}scrollToSection(e,i){if(!t(this,l).length)return;const n=t(this,m).current;d(this,o,me).call(this,e);const c=t(this,l)[n],g=t(this,l)[t(this,m).current];if(c&&g){let w=0;const Ct=d(this,o,oe).call(this),we=Ct?this.targetScrollValue-Ct.position:0;t(this,C).current?t(this,m).current===0&&n===t(this,l).length-1?w=t(this,b)+t(this,v)-c.position+t(this,z):t(this,m).current===t(this,l).length-1&&n===0?w=g.position-(t(this,b)+t(this,v)+t(this,z)):w=g.position-c.position:w=g.position-c.position,this.shiftPosition(w-we,i)}}shiftSections(e,i){t(this,l).length&&this.scrollToSection(t(this,m).current+e,i)}setPosition(e,i){d(this,o,ne).call(this,Math.sign(e)||1),i!=null&&i.tween?t(this,it)||(t(this,F).set(t(this,a).current,{equalize:!0}),t(this,F).set(e,de({},i.tween)),h(this,it,setTimeout(()=>{h(this,it,void 0)},i.tween.duration))):t(this,a).set(e,{equalize:(i==null?void 0:i.behaviour)==="instant"})}shiftPosition(e,i){this.setPosition(t(this,a).target+e,i)}connectedCallback(){lt.scrollEntries.register(this),h(this,a,new Te.Damped(0,{damping:.01,min:0,order:se.TICK_ORDER.SCROLL})),this.setAttribute("tabindex","0"),h(this,D,new Kt.WheelControls({element:t(this,S)})),t(this,D).changeEvent.subscribe(t(this,It)),h(this,tt,new Kt.KeyboardControls({element:this})),t(this,tt).changeEvent.subscribe(t(this,It)),h(this,A,new Kt.DragControls({element:t(this,S)})),t(this,A).changeEvent.subscribe(t(this,It)),h(this,P,new Kt.AutoplayControls({culling:this})),t(this,P).changeEvent.subscribe(t(this,Ft)),t(this,x).subscribe(({current:e})=>{t(this,S).style.flexDirection=e==="x"?"row":"column",t(this,D).axis=t(this,K).current?"max":e,t(this,tt).dimension=e==="x"?"width":"height",t(this,A).axis=e,e==="x"?this.style.touchAction="pan-y":e==="y"&&(this.style.touchAction="pan-x"),this.isConnected&&t(this,L).call(this)}),t(this,K).subscribe(e=>{t(this,D).axis=e.current?"max":t(this,x).current}),t(this,at).subscribe(e=>{t(this,A).inertion=typeof e.current=="number"?e.current:1}),t(this,O).subscribe(()=>{this.isConnected&&t(this,L).call(this)}),t(this,V).subscribe(({current:e})=>{this.isConnected&&(e?d(this,o,Ot).call(this):d(this,o,Pt).call(this))}),t(this,I).subscribe(e=>{t(this,D).debounce=e.current,t(this,A).swipe=e.current,t(this,P).interval=e.current,this.isConnected&&(e.current&&!e.previous&&!t(this,l).length?d(this,o,Ot).call(this):!e.current&&e.previous&&t(this,l).length&&d(this,o,Pt).call(this))}),t(this,B).subscribe(e=>{this.isConnected&&(t(this,L).call(this),e.current&&!e.previous&&!t(this,l).length?d(this,o,Ot).call(this):!e.current&&e.previous&&t(this,l).length&&d(this,o,Pt).call(this))}),t(this,T).subscribe(e=>{this.isConnected&&(t(this,L).call(this),d(this,o,ot).call(this))}),t(this,C).subscribe(e=>{e.current?(this.isConnected&&(t(this,l).length||(t(this,V).current=!0)),t(this,l).length&&(t(this,a).max=1/0,t(this,a).min=-1/0)):(h(this,zt,0),t(this,a).max=t(this,b),t(this,a).min=0)}),t(this,dt).subscribe(e=>{t(this,a).damping=e.current}),t(this,St).subscribe(e=>{t(this,a).mass=e.current}),t(this,pt).subscribe(e=>{t(this,a).stiffness=e.current}),t(this,k).subscribe(e=>{t(this,P).speed=e.current,!t(this,st)&&e.current&&!e.previous?t(this,P).connect():!e.current&&e.previous&&t(this,P).disconnect()}),t(this,Z).subscribe(e=>{e.current||(t(this,P).direction=1)}),t(this,q).subscribe(e=>{this.isConnected&&d(this,o,ot).call(this)}),t(this,J).subscribe(e=>{this.isConnected&&t(this,q).current&&d(this,o,ot).call(this)}),t(this,_).subscribe(e=>{this.isConnected&&t(this,q).current&&d(this,o,ot).call(this)}),t(this,a).isRunning.subscribe(e=>{this.classList.toggle("active",e.current)}),t(this,m).subscribe(e=>{t(this,l).length&&d(this,o,ot).call(this)}),t(this,F).subscribe(e=>{t(this,F).isRunning.current&&t(this,a).set(e.current,{equalize:!0})}),t(this,bt).subscribe(e=>{e.current&&!e.previous?d(this,o,Zt).call(this):!e.current&&e.previous&&d(this,o,Jt).call(this)}),t(this,X).subscribe(e=>{e.current&&!e.previous?d(this,o,ie).call(this):!e.current&&e.previous&&d(this,o,re).call(this)}),t(this,ut).observe(),t(this,x).observe(),t(this,M).observe(),t(this,O).observe(),t(this,V).observe(),t(this,I).observe(),t(this,G).observe(),t(this,j).observe(),t(this,B).observe(),t(this,K).observe(),t(this,at).observe(),t(this,T).observe(),t(this,C).observe(),t(this,dt).observe(),t(this,St).observe(),t(this,pt).observe(),t(this,ft).observe(),t(this,wt).observe(),t(this,k).observe(),t(this,k).observe(),t(this,gt).observe(),t(this,Z).observe(),t(this,q).observe(),t(this,J).observe(),t(this,_).observe(),t(this,Q).observe(),t(this,mt).observe(),t(this,bt).observe(),t(this,X).observe(),t(this,X).current||d(this,o,re).call(this)}disconnectedCallback(){this.removeAttribute("tabindex"),this.classList.remove("has-overflow"),t(this,ut).unobserve(),t(this,x).unobserve(),t(this,M).unobserve(),t(this,O).unobserve(),t(this,V).unobserve(),t(this,I).unobserve(),t(this,G).unobserve(),t(this,j).unobserve(),t(this,B).unobserve(),t(this,K).unobserve(),t(this,at).unobserve(),t(this,T).unobserve(),t(this,C).unobserve(),t(this,dt).unobserve(),t(this,St).unobserve(),t(this,pt).unobserve(),t(this,ft).unobserve(),t(this,wt).unobserve(),t(this,k).unobserve(),t(this,gt).unobserve(),t(this,Z).unobserve(),t(this,q).unobserve(),t(this,J).unobserve(),t(this,_).unobserve(),t(this,Q).unobserve(),t(this,mt).unobserve(),t(this,bt).unobserve(),t(this,X).unobserve(),d(this,o,ie).call(this)}}a=new WeakMap,ut=new WeakMap,x=new WeakMap,M=new WeakMap,O=new WeakMap,V=new WeakMap,I=new WeakMap,G=new WeakMap,j=new WeakMap,B=new WeakMap,K=new WeakMap,at=new WeakMap,T=new WeakMap,C=new WeakMap,dt=new WeakMap,St=new WeakMap,pt=new WeakMap,ft=new WeakMap,wt=new WeakMap,k=new WeakMap,gt=new WeakMap,Z=new WeakMap,q=new WeakMap,J=new WeakMap,_=new WeakMap,Q=new WeakMap,mt=new WeakMap,bt=new WeakMap,X=new WeakMap,Y=new WeakMap,S=new WeakMap,xt=new WeakMap,l=new WeakMap,Bt=new WeakMap,_t=new WeakMap,v=new WeakMap,b=new WeakMap,z=new WeakMap,D=new WeakMap,tt=new WeakMap,A=new WeakMap,P=new WeakMap,m=new WeakMap,zt=new WeakMap,et=new WeakMap,H=new WeakMap,st=new WeakMap,yt=new WeakMap,Lt=new WeakMap,it=new WeakMap,F=new WeakMap,Ht=new WeakMap,o=new WeakSet,Ot=function(){d(this,o,Pt).call(this),t(this,xt).assignedElements().forEach((e,i)=>{e instanceof HTMLElement&&t(this,l).push(new Oe(e,i,this))}),t(this,S).style.transform="",ee.dispatchEvent(this,"scrollSectionsChange",{custom:!0,composed:!0}),t(this,L).call(this),d(this,o,ot).call(this)},Pt=function(){t(this,l).forEach(e=>{e.destroy()}),h(this,l,[]),t(this,m).reset(),t(this,a).reset(),ee.dispatchEvent(this,"scrollSectionsChange",{custom:!0,composed:!0})},Zt=function(){t(this,st)||(h(this,st,!0),t(this,a).unsubscribe(t(this,kt)),t(this,a).unlistenAnimationFrame(),clearInterval(t(this,Lt)),clearInterval(t(this,it)),t(this,F).unlistenAnimationFrame(),t(this,D).disconnect(),t(this,tt).disconnect(),t(this,A).disconnect(),t(this,P).disconnect(),t(this,H)||this.sections.forEach(e=>{e.unsetTransform()}))},Jt=function(){t(this,st)&&(h(this,st,!1),t(this,a).subscribe(t(this,kt)),t(this,D).connect(),t(this,tt).connect(),t(this,A).connect(),t(this,k).current&&t(this,P).connect())},ie=function(){t(this,yt)||(h(this,yt,!0),Qt.windowResizer.unsubscribe(t(this,L)),Xt.elementResizer.unsubscribe(t(this,L)),d(this,o,Zt).call(this),t(this,S).style.transform="",t(this,l).length?d(this,o,Pt).call(this):(t(this,m).reset(),t(this,a).reset()),lt.scrollEntries.unregister(this))},re=function(){t(this,yt)&&(h(this,yt,!1),lt.scrollEntries.register(this),(t(this,C).current||t(this,V).current||t(this,C).current||t(this,B).current||t(this,I).current)&&d(this,o,Ot).call(this),d(this,o,Jt).call(this),Qt.windowResizer.subscribe(t(this,L),se.RESIZE_ORDER.SCROLL),Xt.elementResizer.subscribe(this,t(this,L)))},L=new WeakMap,kt=new WeakMap,me=function(e){t(this,C).current?(t(this,m).current=e%t(this,l).length,t(this,m).current=t(this,m).current<0?t(this,l).length+t(this,m).current:t(this,m).current):t(this,m).current=fe.clamp(e,0,this.limit)},It=new WeakMap,Ft=new WeakMap,ne=function(e=1){t(this,Z).current&&(t(this,P).direction=e),t(this,k).current&&t(this,P).pauseAndContinue(t(this,gt).current,this.sectionalCSSProperty.current)},he=function(e="current"){if(t(this,C).current&&t(this,l).length){const i=t(this,a)[e]%(t(this,b)+t(this,v)+t(this,z));return i<0?t(this,b)+i+t(this,v)+t(this,z):i}else return t(this,a)[e]},ot=function(){if(t(this,q).current&&t(this,l).length){const e=t(this,m).current+t(this,J).current;e===0?this.classList.add("start"):this.classList.remove("start"),e===this.limit?this.classList.add("end"):this.classList.remove("end");const i=t(this,T).current+t(this,_).current;t(this,l).forEach((n,c)=>{const g=e-this.limit-1+t(this,_).current,w=e+i,Ct=this.sections.length-w;c>=e&&c<w||c<=g?n.mark("current"):c>=w&&c<w+Ct/2||c<=g+i?n.mark("next"):n.mark("previous")})}},oe=function(e=this.targetScrollValue){let i=null,n=1/0;for(let c=0;c<t(this,l).length;c++){const g=Math.abs(t(this,l)[c].position-e);g<n&&(n=g,i=c)}return i!==null?t(this,l)[i]:null};customElements.get("e-scroll")||customElements.define("e-scroll",Mt);var Wt;class le extends HTMLElement{constructor(){super(...arguments);s(this,Wt,null)}get scrollElement(){return t(this,Wt)}connectedCallback(){const e=ge.findParentElement(this,Mt);e instanceof Mt?h(this,Wt,e):console.error(this,"e-scroll not found")}}Wt=new WeakMap;var rt,E,W,U,Tt,qt,vt,Ut,$t,Nt;class be extends le{constructor(){super();s(this,rt,null);s(this,E,null);s(this,W,!1);s(this,U,0);s(this,Tt,0);s(this,qt,0);s(this,vt,()=>{h(this,W,this.offsetWidth>this.offsetHeight);const e=t(this,W)?this.offsetWidth:this.offsetHeight;h(this,U,e/((this.scrollElement.scrollSize+this.scrollElement.viewportSize)/e)),h(this,U,Math.max(t(this,U),30)),t(this,W)?(t(this,E).style.width=t(this,U)+"px",t(this,E).style.height="100%"):(t(this,E).style.width="100%",t(this,E).style.height=t(this,U)+"px"),h(this,Tt,e-t(this,U)),this.scrollElement.scrollSize||(this.style.display="none")});s(this,Ut,()=>{h(this,qt,this.scrollElement.currentProgress*t(this,Tt)),t(this,W)?t(this,E).style.transform=`translate3d(${t(this,qt)}px, 0px, 0px)`:t(this,E).style.transform=`translate3d(0px, ${t(this,qt)}px, 0px)`});s(this,$t,()=>{this.setAttribute("axis",this.scrollElement.axisCSSProperty.current)});s(this,Nt,e=>{document.documentElement.classList.add("grabbing"),Ae.setupDrag(c=>{const g=t(this,W)?c.x:c.y,w=this.scrollElement.distance/t(this,Tt),Ct=(g-n)*w;this.scrollElement.setPosition(i+Ct)},()=>{document.documentElement.classList.remove("grabbing")});const i=this.scrollElement.damped.target,n=t(this,W)?e.x:e.y});if(Yt.isBrowser){const e=this.attachShadow({mode:"open"});e.adoptedStyleSheets.push(pe.createStylesheet({":host":{display:"inline-block",zIndex:"1",backgroundColor:"#ebebeb"},':host([axis="y"])':{position:"absolute",right:"0",top:"0",width:"1vmin",height:"100%"},':host([axis="x"])':{position:"absolute",left:"0",bottom:"0",width:"100%",height:"1vmin"},".default-thumb":{backgroundColor:"black",borderRadius:"0.3vmin",touchAction:"none"},"::slotted(*)":{touchAction:"none"}})),h(this,rt,document.createElement("slot")),t(this,rt).innerHTML='<div class="default-thumb"></div>',e.appendChild(t(this,rt))}}get thumbElement(){return t(this,E)}connectedCallback(){super.connectedCallback(),this.setAttribute("drag-dead-zone","");const e=t(this,rt).assignedElements()[0]||t(this,rt).firstElementChild;h(this,E,e),t(this,E).addEventListener("pointerdown",t(this,Nt)),Qt.windowResizer.subscribe(t(this,vt),se.RESIZE_ORDER.SCROLL),Xt.elementResizer.subscribe(this,t(this,vt)),this.scrollElement.onScroll(t(this,Ut)),this.scrollElement.axisCSSProperty.subscribe(t(this,$t))}disconnectedCallback(){this.removeAttribute("drag-dead-zone"),t(this,E).removeEventListener("pointerdown",t(this,Nt)),Qt.windowResizer.unsubscribe(t(this,vt)),Xt.elementResizer.unsubscribe(t(this,vt)),this.scrollElement.offScroll(t(this,Ut)),this.scrollElement.axisCSSProperty.unsubscribe(t(this,$t))}}rt=new WeakMap,E=new WeakMap,W=new WeakMap,U=new WeakMap,Tt=new WeakMap,qt=new WeakMap,vt=new WeakMap,Ut=new WeakMap,$t=new WeakMap,Nt=new WeakMap;customElements.get("e-scrollbar")||customElements.define("e-scrollbar",be);class ye extends le{constructor(){super(),Yt.isBrowser&&this.addEventListener("click",()=>{const r=this.getAttribute("behaviour"),e=this.getAttribute("easing")||void 0,i=e?parseFloat(this.getAttribute("duration")||"0"):void 0;this.handleClick({behaviour:r,tween:e?{easing:e,duration:i}:void 0})})}}class ve extends ye{handleClick(r){const e=this.getAttribute("index");this.scrollElement.scrollToSection(parseInt(e||"0"),r)}}customElements.get("e-scroll-set-button")||customElements.define("e-scroll-set-button",ve);class Ce extends ye{handleClick(r){const e=this.getAttribute("step");this.scrollElement.shiftSections(parseInt(e||"1"),r)}}customElements.get("e-scroll-step-button")||customElements.define("e-scroll-step-button",Ce);var $,nt,Dt,Gt,jt,At;class Be{constructor(r,e,i){s(this,$,null);s(this,nt,null);s(this,Dt,null);s(this,Gt,null);s(this,jt,()=>{t(this,nt).scrollToSection(t(this,Dt),{behaviour:t(this,Gt)})});s(this,At,()=>{t(this,$).classList.toggle("current",t(this,nt).counter.current===t(this,Dt))});Yt.isBrowser&&(h(this,$,document.createElement("button")),h(this,nt,r),h(this,Gt,i),h(this,Dt,e),t(this,$).addEventListener("click",t(this,jt)),t(this,nt).counter.subscribe(t(this,At)),t(this,At).call(this))}get element(){return t(this,$)}destroy(){t(this,$).removeEventListener("click",t(this,jt)),t(this,nt).counter.unsubscribe(t(this,At)),t(this,$).remove()}}$=new WeakMap,nt=new WeakMap,Dt=new WeakMap,Gt=new WeakMap,jt=new WeakMap,At=new WeakMap;var ht,Rt;class Pe extends le{constructor(){super(...arguments);s(this,ht,[]);s(this,Rt,Re.debounce(()=>{t(this,ht).forEach(e=>e.destroy()),h(this,ht,[]);for(let e=0;e<this.scrollElement.sections.length;e++){const i=new Be(this.scrollElement,e,this.getAttribute("behaviour")||"smooth");this.appendChild(i.element),t(this,ht).push(i)}},0))}connectedCallback(){super.connectedCallback(),this.scrollElement.addEventListener("sectionsChange",t(this,Rt)),t(this,Rt).call(this)}disconnectedCallback(){this.scrollElement.removeEventListener("sectionsChange",t(this,Rt)),t(this,ht).forEach(e=>e.destroy()),h(this,ht,[])}}ht=new WeakMap,Rt=new WeakMap;customElements.get("e-scroll-bullet-buttons")||customElements.define("e-scroll-bullet-buttons",Pe);class Ee extends Me.ScrollSegmentElement{connectedCallback(){const r=ge.findParentElement(this,Mt);r instanceof Mt?(this.scrollContainer=r,this.scrollContainer.addEventListener("scrollSectionsChange",this.findAnotherScrollEntries)):console.error(this,"e-scroll not found")}}customElements.get("e-scroll-segment")||customElements.define("e-scroll-segment",Ee);exports.ScrollBulletButtonsElement=Pe;exports.ScrollElement=Mt;exports.ScrollSegmentElement=Ee;exports.ScrollSetButtonElement=ve;exports.ScrollStepButtonElement=Ce;exports.ScrollbarElement=be;
|
|
@@ -281,7 +281,7 @@ class Ot extends HTMLElement {
|
|
|
281
281
|
const c = t(this, l)[n];
|
|
282
282
|
c.transform(), this.targetScrollValue + c.size / 2 >= c.position && (i = n);
|
|
283
283
|
}
|
|
284
|
-
t(this, g).current = i
|
|
284
|
+
t(this, g).current = i;
|
|
285
285
|
} else
|
|
286
286
|
this.vertical ? t(this, f).style.transform = `translate3d(0px, ${e * -1}px, 0px)` : t(this, f).style.transform = `translate3d(${e * -1}px, 0px, 0px)`;
|
|
287
287
|
lt.update(
|
|
@@ -454,7 +454,9 @@ class Ot extends HTMLElement {
|
|
|
454
454
|
return t(this, g);
|
|
455
455
|
}
|
|
456
456
|
get limit() {
|
|
457
|
-
return
|
|
457
|
+
return Math.ceil(
|
|
458
|
+
t(this, l).length - t(this, D).current
|
|
459
|
+
);
|
|
458
460
|
}
|
|
459
461
|
get distance() {
|
|
460
462
|
return t(this, et);
|