aptechka 0.78.3 → 0.78.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/scroll-kit/index.cjs +1 -1
- package/lib/scroll-kit/index.js +165 -155
- package/lib/slicer/index.cjs +1 -1
- package/lib/slicer/index.js +31 -28
- package/package.json +1 -1
package/lib/scroll-kit/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ft=n=>{throw TypeError(n)};var ot=(n,c,e)=>c.has(n)||ft("Cannot "+e);var t=(n,c,e)=>(ot(n,c,"read from private field"),e?e.call(n):c.get(n)),s=(n,c,e)=>c.has(n)?ft("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,e),r=(n,c,e,i)=>(ot(n,c,"write to private field"),i?i.call(n,e):c.set(n,e),e),d=(n,c,e)=>(ot(n,c,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ct=require("../index-DekP7OZe.cjs"),kt=require("../dom-JBOkFLTh.cjs"),zt=require("../gestures-C7gbKx11.cjs");require("construct-style-sheets-polyfill");const j=require("../ticker/index.cjs"),lt=require("../scroll-entries/index.cjs");require("../Store-Cd1GlEmZ.cjs");const Ht=require("../Damped-z9Uaw2MJ.cjs"),g=require("../css-property/index.cjs"),qt=require("../element-linked-store/index.cjs"),bt=require("../element-resizer/index.cjs"),ht=require("../events-KVanG9sR.cjs"),gt=require("../layout-Ctc2p3uz.cjs"),Mt=require("../math-GDWEqu7y.cjs"),pt=require("../window-resizer/index.cjs");var o,f,W,x,a,O,E,at,yt,Et,B,nt,K,k,J;class St extends HTMLElement{constructor(){super(...arguments);s(this,E);s(this,o,null);s(this,f,null);s(this,W,0);s(this,x,0);s(this,a,!1);s(this,O);s(this,B,()=>{this.classList.add("active"),clearTimeout(t(this,O));const i=t(this,E,at)/t(this,x)*t(this,W);t(this,a)?t(this,f).style.transform=`translate3d(${i}px, 0px, 0px)`:t(this,f).style.transform=`translate3d(0px, ${i}px, 0px)`,r(this,O,setTimeout(()=>{this.classList.remove("active")},1e3))});s(this,nt,()=>{const e=t(this,a)?this.offsetWidth:this.offsetHeight,i=t(this,E,yt),b=t(this,E,Et);r(this,x,i-b);let v=e*e/(t(this,x)+e);v=Math.max(v,30),t(this,a)?(t(this,f).style.width=v+"px",t(this,f).style.height="100%"):(t(this,f).style.width="100%",t(this,f).style.height=v+"px"),r(this,W,e-v),i<=b?this.style.display="none":this.style.display="block"});s(this,K,e=>{document.documentElement.classList.add("grabbing");const i=t(this,E,at),b=t(this,a)?e.x:e.y;zt.setupDrag(v=>{const xt=t(this,x)/t(this,W),mt=(t(this,a)?v.x-b:v.y-b)*xt;t(this,a)?t(this,o).scroll({left:i+mt,behavior:"instant"}):t(this,o).scroll({top:i+mt,behavior:"instant"})},()=>{document.documentElement.classList.remove("grabbing")})});s(this,k,()=>{t(this,nt).call(this)});s(this,J,e=>{e.isIntersecting?(j.ticker.subscribe(t(this,k),{maxFPS:5}),t(this,k).call(this)):j.ticker.unsubscribe(t(this,k))})}connectedCallback(){const e=this.getAttribute("data-scroll");let i=null;e&&(e==="parent"?i=this.parentElement:i=document.querySelector(e)),i||(i=kt.findScrollParentElement(this),i===document.body&&(i=window)),r(this,a,this.hasAttribute("horisontal"));const b=this.querySelector("[data-thumb]");i&&b&&(r(this,o,i),r(this,f,b),t(this,o).addEventListener("scroll",t(this,B)),t(this,f).addEventListener("pointerdown",t(this,K)),ct.intersector.subscribe(this.parentElement===document.body?this:this.parentElement,t(this,J)))}disconnectedCallback(){t(this,o).removeEventListener("scroll",t(this,B)),t(this,f).removeEventListener("pointerdown",t(this,K)),clearTimeout(t(this,O)),ct.intersector.unsubscribe(t(this,J)),j.ticker.unsubscribe(t(this,k))}}o=new WeakMap,f=new WeakMap,W=new WeakMap,x=new WeakMap,a=new WeakMap,O=new WeakMap,E=new WeakSet,at=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).scrollLeft:t(this,o).scrollTop:t(this,a)?t(this,o).scrollX:t(this,o).scrollY},yt=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).scrollWidth:t(this,o).scrollHeight:t(this,a)?Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth):Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},Et=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).offsetWidth:t(this,o).offsetHeight:t(this,a)?innerWidth:innerHeight},B=new WeakMap,nt=new WeakMap,K=new WeakMap,k=new WeakMap,J=new WeakMap;ct.isBrowser&&!customElements.get("e-scrollbar")&&customElements.define("e-scrollbar",St);const Vt=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Space"]);var D,_,l,N,Y,z,X,Q,Z,tt,et,st;class vt extends HTMLElement{constructor(){super(...arguments);s(this,z);s(this,D,new g.CSSProperty(this,"--smooth-scroll-disabled",!1));s(this,_,new g.CSSProperty(this,"--smooth-scroll-damping",10));s(this,l,new Ht.Damped(0));s(this,N,0);s(this,Y,!1);s(this,Q,e=>{if(!d(this,z,X).call(this)){if(Math.sign(e.deltaY)<0&&t(this,l).target===0&&t(this,l).direction<0||Math.sign(e.deltaY)>0&&t(this,l).target===t(this,l).max&&t(this,l).direction>0||e.stopPropagation(),e.target instanceof Element){const i=e.target.closest("[data-prevent-smooth-scroll]");if(i){const b=i.getAttribute("data-prevent-smooth-scroll");if(b){if(matchMedia(b).matches)return}else return}}Math.abs(e.deltaX)>Math.abs(e.deltaY)||(e.preventDefault(),this.shiftPosition(e.deltaY))}});s(this,Z,()=>{d(this,z,X).call(this)||this.stop()});s(this,tt,e=>{d(this,z,X).call(this)||e.target instanceof Element&&e.target.closest("a")&&this.stop()});s(this,et,()=>{this.resize()});s(this,st,e=>{d(this,z,X).call(this)||Vt.has(e.code)&&this.stop()})}resize(){t(this,l).min=0,t(this,l).max=this.scrollHeight-this.offsetHeight}stop(){t(this,l).unlistenAnimationFrame(),r(this,Y,!0)}sync(){const e=this.scrollTop;(t(this,Y)||Math.abs(e-t(this,l).current)>100)&&(r(this,Y,!1),t(this,l).set(e,{equalize:!0}))}shiftPosition(e){this.resize(),this.sync(),t(this,l).shift(e)}setPosition(e,i){this.resize(),this.sync(),t(this,l).set(e,i)}connectedCallback(){window.addEventListener("resize",t(this,et)),this.addEventListener("keydown",t(this,st)),this.addEventListener("pointerdown",t(this,tt)),this.addEventListener("touchstart",t(this,Z)),this.addEventListener("wheel",t(this,Q),{passive:!1}),t(this,l).subscribe(e=>{const i=Math.round(e.current);lt.scrollEntries.update(this,"y",e.current),i!==t(this,N)&&this.scroll({top:i,behavior:"instant"}),r(this,N,i)}),t(this,_).observe(),t(this,D).observe(),t(this,_).subscribe(e=>{t(this,l).damping=e.current}),lt.scrollEntries.register(this),this.resize()}disconnectedCallback(){t(this,l).close(),t(this,_).close(),t(this,D).close(),lt.scrollEntries.unregister(this),window.removeEventListener("resize",t(this,et)),this.removeEventListener("keydown",t(this,st)),this.removeEventListener("pointerdown",t(this,tt)),this.removeEventListener("touchstart",t(this,Z)),this.removeEventListener("wheel",t(this,Q))}}D=new WeakMap,_=new WeakMap,l=new WeakMap,N=new WeakMap,Y=new WeakMap,z=new WeakSet,X=function(){return t(this,D).current||getComputedStyle(this).getPropertyValue("overflow")==="hidden"},Q=new WeakMap,Z=new WeakMap,tt=new WeakMap,et=new WeakMap,st=new WeakMap;customElements.get("e-smooth-scroll")||customElements.define("e-smooth-scroll",vt);var S,H,F,w,q,M,$,L,G,y,V,u,it,m,p,T,A,P,I,h,Lt,dt,Pt,C,R,ut,Ct,rt,U;class wt extends HTMLElement{constructor(){super(...arguments);s(this,h);s(this,S,this);s(this,H,null);s(this,F,new g.CSSProperty(this,"--scroll-region-status-holder",!1));s(this,w,new g.CSSProperty(this,"--scroll-region-disabled",!1));s(this,q,new g.CSSProperty(this,"--scroll-region-start-offset",0,{rawValueCheck:!1}));s(this,M,new g.CSSProperty(this,"--scroll-region-start-offset-min",!1,{rawValueCheck:!1}));s(this,$,new g.CSSProperty(this,"--scroll-region-start-extra-offset",0,{rawValueCheck:!1}));s(this,L,new g.CSSProperty(this,"--scroll-region-distance",0,{rawValueCheck:!1}));s(this,G,new g.CSSProperty(this,"--scroll-region-distance-offset",0,{rawValueCheck:!1}));s(this,y,new g.CSSProperty(this,"--scroll-region-progress-var",""));s(this,V,new g.CSSProperty(this,"--scroll-region-enter-once",!1));s(this,u,new qt.ElementLinkedStore(this,{enabled:!1,entered:!1,enteredOnLoad:!1,activated:!1}));s(this,it,0);s(this,m,0);s(this,p,0);s(this,T,0);s(this,A,0);s(this,P,0);s(this,I,!1);s(this,C,()=>{this.resize()});s(this,R,()=>{this.tick()});s(this,U,()=>{document.readyState==="complete"&&d(this,h,Pt).call(this)})}get start(){return t(this,m)}get finish(){return t(this,p)}get distance(){return t(this,T)}get scrolled(){return t(this,A)}get progress(){return t(this,P)}get status(){return t(this,u)}get scrollValue(){return t(this,H)instanceof HTMLElement?t(this,H).scrollTop:t(this,H).scrollY}resize(){t(this,w).current||(r(this,it,gt.getCumulativeOffsetTop(this)),r(this,m,t(this,it)),typeof t(this,M).current=="number"?r(this,m,t(this,m)+Math.max(t(this,q).current,t(this,M).current)):r(this,m,t(this,m)+t(this,q).current),r(this,m,t(this,m)+t(this,$).current),r(this,m,t(this,m)-gt.getStickyOffset(this,"top")),r(this,p,t(this,m)),t(this,L).current?r(this,p,t(this,p)+t(this,L).current):r(this,p,t(this,p)+this.offsetHeight),r(this,p,t(this,p)+t(this,G).current),r(this,T,t(this,p)-t(this,m)),r(this,I,this.offsetWidth!==0&&this.offsetHeight!==0),this.tick())}tick(){if(t(this,w).current)return;const e=this.scrollValue;r(this,A,Mt.clamp(e-t(this,m),0,t(this,T))),r(this,P,t(this,A)/t(this,T)||0),t(this,y).current&&t(this,S).style.setProperty(d(this,h,rt).call(this,t(this,y).current),t(this,P).toFixed(6)),t(this,u).set("activated",e>=t(this,m)),t(this,I)&&t(this,u).isFalse("entered")&&e>=t(this,m)&&e<=t(this,p)?d(this,h,ut).call(this):t(this,I)&&!t(this,V).current&&t(this,u).isTrue("entered")&&(e<t(this,m)||e>t(this,p))&&d(this,h,Ct).call(this),t(this,V).current&&t(this,P)===1&&(t(this,u).current.entered||d(this,h,ut).call(this),this.destroy()),ht.dispatchEvent(this,"scrollRegionProgress",{detail:{progress:t(this,P),scrolled:t(this,A)}})}destroy(){document.removeEventListener("readystatechange",t(this,U)),this.disable(!1),t(this,F).close(),t(this,w).close(),t(this,q).close(),t(this,M).close(),t(this,$).close(),t(this,L).close(),t(this,G).close(),t(this,y).close(),t(this,V).close()}enable(){j.ticker.subscribe(t(this,R),{culling:this}),bt.elementResizer.subscribe(this,t(this,C)),pt.windowResizer.subscribe(t(this,C)),t(this,R).call(this),t(this,u).set("enabled",!0)}disable(e=!0){j.ticker.unsubscribe(t(this,R)),bt.elementResizer.unsubscribe(t(this,C)),pt.windowResizer.unsubscribe(t(this,C)),e&&t(this,u).reset(),d(this,h,dt).call(this)}connectedCallback(){const e=this.getAttribute("data-scroll")||".page-scroll";r(this,H,document.querySelector(e)),document.readyState==="complete"?t(this,U).call(this):document.addEventListener("readystatechange",t(this,U))}disconnectedCallback(){this.destroy()}}S=new WeakMap,H=new WeakMap,F=new WeakMap,w=new WeakMap,q=new WeakMap,M=new WeakMap,$=new WeakMap,L=new WeakMap,G=new WeakMap,y=new WeakMap,V=new WeakMap,u=new WeakMap,it=new WeakMap,m=new WeakMap,p=new WeakMap,T=new WeakMap,A=new WeakMap,P=new WeakMap,I=new WeakMap,h=new WeakSet,Lt=function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.add(this.getAttribute("data-global-class"))},dt=function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.remove(this.getAttribute("data-global-class"))},Pt=function(){t(this,F).subscribe(e=>{t(this,S)&&(t(this,u).removeElement(t(this,S)),t(this,S).style.removeProperty(d(this,h,rt).call(this,t(this,y).current))),r(this,S,e.current?document.querySelector(e.current)||this:this),t(this,u).addElement(t(this,S))}),t(this,w).subscribe(e=>{e.current&&!e.previous?this.disable():this.enable()}),t(this,y).subscribe(e=>{e.current?t(this,R).call(this):e.previous&&t(this,S).style.removeProperty(d(this,h,rt).call(this,e.previous))}),t(this,L).subscribe(()=>{t(this,C).call(this)}),t(this,F).observe(),t(this,w).observe(),t(this,q).observe(),t(this,M).observe(),t(this,$).observe(),t(this,L).observe(),t(this,G).observe(),t(this,y).observe(),t(this,V).observe()},C=new WeakMap,R=new WeakMap,ut=function(){const e=this.scrollValue;t(this,u).set("entered",!0),e===0&&t(this,u).set("enteredOnLoad",!0),d(this,h,Lt).call(this),ht.dispatchEvent(this,"scrollRegionEnter")},Ct=function(){t(this,u).set("entered",!1),d(this,h,dt).call(this),ht.dispatchEvent(this,"scrollRegionExit")},rt=function(e){return`--${e}`},U=new WeakMap;customElements.get("e-scroll-region")||customElements.define("e-scroll-region",wt);exports.ScrollRegionElement=wt;exports.ScrollbarElement=St;exports.SmoothScrollElement=vt;
|
|
1
|
+
"use strict";var gt=n=>{throw TypeError(n)};var lt=(n,c,e)=>c.has(n)||gt("Cannot "+e);var t=(n,c,e)=>(lt(n,c,"read from private field"),e?e.call(n):c.get(n)),s=(n,c,e)=>c.has(n)?gt("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,e),r=(n,c,e,i)=>(lt(n,c,"write to private field"),i?i.call(n,e):c.set(n,e),e),d=(n,c,e)=>(lt(n,c,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const dt=require("../index-DekP7OZe.cjs"),Ht=require("../dom-JBOkFLTh.cjs"),qt=require("../gestures-C7gbKx11.cjs");require("construct-style-sheets-polyfill");const K=require("../ticker/index.cjs"),ct=require("../scroll-entries/index.cjs");require("../Store-Cd1GlEmZ.cjs");const Mt=require("../Damped-z9Uaw2MJ.cjs"),f=require("../css-property/index.cjs"),Vt=require("../element-linked-store/index.cjs"),pt=require("../element-resizer/index.cjs"),at=require("../events-KVanG9sR.cjs"),St=require("../layout-Ctc2p3uz.cjs"),Tt=require("../math-GDWEqu7y.cjs"),yt=require("../window-resizer/index.cjs");var o,b,O,x,a,D,y,ut,vt,wt,J,ht,N,k,Q;class Et extends HTMLElement{constructor(){super(...arguments);s(this,y);s(this,o,null);s(this,b,null);s(this,O,0);s(this,x,0);s(this,a,!1);s(this,D);s(this,J,()=>{this.classList.add("active"),clearTimeout(t(this,D));const i=t(this,y,ut)/t(this,x)*t(this,O);t(this,a)?t(this,b).style.transform=`translate3d(${i}px, 0px, 0px)`:t(this,b).style.transform=`translate3d(0px, ${i}px, 0px)`,r(this,D,setTimeout(()=>{this.classList.remove("active")},1e3))});s(this,ht,()=>{const e=t(this,a)?this.offsetWidth:this.offsetHeight,i=t(this,y,vt),g=t(this,y,wt);r(this,x,i-g);let E=e*e/(t(this,x)+e);E=Math.max(E,30),t(this,a)?(t(this,b).style.width=E+"px",t(this,b).style.height="100%"):(t(this,b).style.width="100%",t(this,b).style.height=E+"px"),r(this,O,e-E),i<=g?this.style.display="none":this.style.display="block"});s(this,N,e=>{document.documentElement.classList.add("grabbing");const i=t(this,y,ut),g=t(this,a)?e.x:e.y;qt.setupDrag(E=>{const zt=t(this,x)/t(this,O),bt=(t(this,a)?E.x-g:E.y-g)*zt;t(this,a)?t(this,o).scroll({left:i+bt,behavior:"instant"}):t(this,o).scroll({top:i+bt,behavior:"instant"})},()=>{document.documentElement.classList.remove("grabbing")})});s(this,k,()=>{t(this,ht).call(this)});s(this,Q,e=>{e.isIntersecting?(K.ticker.subscribe(t(this,k),{maxFPS:5}),t(this,k).call(this)):K.ticker.unsubscribe(t(this,k))})}connectedCallback(){const e=this.getAttribute("data-scroll");let i=null;e&&(e==="parent"?i=this.parentElement:i=document.querySelector(e)),i||(i=Ht.findScrollParentElement(this),i===document.body&&(i=window)),r(this,a,this.hasAttribute("horisontal"));const g=this.querySelector("[data-thumb]");i&&g&&(r(this,o,i),r(this,b,g),t(this,o).addEventListener("scroll",t(this,J)),t(this,b).addEventListener("pointerdown",t(this,N)),dt.intersector.subscribe(this.parentElement===document.body?this:this.parentElement,t(this,Q)))}disconnectedCallback(){t(this,o).removeEventListener("scroll",t(this,J)),t(this,b).removeEventListener("pointerdown",t(this,N)),clearTimeout(t(this,D)),dt.intersector.unsubscribe(t(this,Q)),K.ticker.unsubscribe(t(this,k))}}o=new WeakMap,b=new WeakMap,O=new WeakMap,x=new WeakMap,a=new WeakMap,D=new WeakMap,y=new WeakSet,ut=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).scrollLeft:t(this,o).scrollTop:t(this,a)?t(this,o).scrollX:t(this,o).scrollY},vt=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).scrollWidth:t(this,o).scrollHeight:t(this,a)?Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth):Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},wt=function(){return t(this,o)instanceof HTMLElement?t(this,a)?t(this,o).offsetWidth:t(this,o).offsetHeight:t(this,a)?innerWidth:innerHeight},J=new WeakMap,ht=new WeakMap,N=new WeakMap,k=new WeakMap,Q=new WeakMap;dt.isBrowser&&!customElements.get("e-scrollbar")&&customElements.define("e-scrollbar",Et);const At=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Space"]);var _,Y,h,Z,F,z,B,tt,et,st,it,rt;class Lt extends HTMLElement{constructor(){super(...arguments);s(this,z);s(this,_,new f.CSSProperty(this,"--smooth-scroll-disabled",!1));s(this,Y,new f.CSSProperty(this,"--smooth-scroll-damping",10));s(this,h,new Mt.Damped(0));s(this,Z,0);s(this,F,!1);s(this,tt,e=>{if(!d(this,z,B).call(this)){if(Math.sign(e.deltaY)<0&&t(this,h).target===0&&t(this,h).direction<0||Math.sign(e.deltaY)>0&&t(this,h).target===t(this,h).max&&t(this,h).direction>0||e.stopPropagation(),e.target instanceof Element){const i=e.target.closest("[data-prevent-smooth-scroll]");if(i){const g=i.getAttribute("data-prevent-smooth-scroll");if(g){if(matchMedia(g).matches)return}else return}}Math.abs(e.deltaX)>Math.abs(e.deltaY)||(e.preventDefault(),this.shiftPosition(e.deltaY))}});s(this,et,()=>{d(this,z,B).call(this)||this.stop()});s(this,st,e=>{d(this,z,B).call(this)||e.target instanceof Element&&e.target.closest("a")&&this.stop()});s(this,it,()=>{this.resize()});s(this,rt,e=>{d(this,z,B).call(this)||At.has(e.code)&&this.stop()})}resize(){t(this,h).min=0,t(this,h).max=this.scrollHeight-this.offsetHeight}stop(){t(this,h).unlistenAnimationFrame(),r(this,F,!0)}sync(){const e=this.scrollTop;(t(this,F)||Math.abs(e-t(this,h).current)>100)&&(r(this,F,!1),t(this,h).set(e,{equalize:!0}))}shiftPosition(e){this.resize(),this.sync(),t(this,h).shift(e)}setPosition(e,i){this.resize(),this.sync(),t(this,h).set(e,i)}connectedCallback(){window.addEventListener("resize",t(this,it)),this.addEventListener("keydown",t(this,rt)),this.addEventListener("pointerdown",t(this,st)),this.addEventListener("touchstart",t(this,et)),this.addEventListener("wheel",t(this,tt),{passive:!1}),t(this,h).subscribe(e=>{const i=Math.round(e.current);ct.scrollEntries.update(this,"y",e.current),i!==t(this,Z)&&this.scroll({top:i,behavior:"instant"}),r(this,Z,i)}),t(this,Y).observe(),t(this,_).observe(),t(this,Y).subscribe(e=>{t(this,h).damping=e.current}),ct.scrollEntries.register(this),this.resize()}disconnectedCallback(){t(this,h).close(),t(this,Y).close(),t(this,_).close(),ct.scrollEntries.unregister(this),window.removeEventListener("resize",t(this,it)),this.removeEventListener("keydown",t(this,rt)),this.removeEventListener("pointerdown",t(this,st)),this.removeEventListener("touchstart",t(this,et)),this.removeEventListener("wheel",t(this,tt))}}_=new WeakMap,Y=new WeakMap,h=new WeakMap,Z=new WeakMap,F=new WeakMap,z=new WeakSet,B=function(){return t(this,_).current||getComputedStyle(this).getPropertyValue("overflow")==="hidden"},tt=new WeakMap,et=new WeakMap,st=new WeakMap,it=new WeakMap,rt=new WeakMap;customElements.get("e-smooth-scroll")||customElements.define("e-smooth-scroll",Lt);var H,v,q,$,G,w,M,V,I,L,U,S,T,u,nt,m,p,A,R,P,X,l,Ct,mt,xt,C,W,ft,kt,ot,j;class Pt extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,H,this);s(this,v,this);s(this,q,null);s(this,$,new f.CSSProperty(this,"--scroll-region-status-holder",!1));s(this,G,new f.CSSProperty(this,"--scroll-region-progress-holder",!1));s(this,w,new f.CSSProperty(this,"--scroll-region-disabled",!1));s(this,M,new f.CSSProperty(this,"--scroll-region-start-offset",0,{rawValueCheck:!1}));s(this,V,new f.CSSProperty(this,"--scroll-region-start-offset-min",!1,{rawValueCheck:!1}));s(this,I,new f.CSSProperty(this,"--scroll-region-start-extra-offset",0,{rawValueCheck:!1}));s(this,L,new f.CSSProperty(this,"--scroll-region-distance",0,{rawValueCheck:!1}));s(this,U,new f.CSSProperty(this,"--scroll-region-distance-offset",0,{rawValueCheck:!1}));s(this,S,new f.CSSProperty(this,"--scroll-region-progress-var",""));s(this,T,new f.CSSProperty(this,"--scroll-region-enter-once",!1));s(this,u,new Vt.ElementLinkedStore(this,{enabled:!1,entered:!1,enteredOnLoad:!1,activated:!1}));s(this,nt,0);s(this,m,0);s(this,p,0);s(this,A,0);s(this,R,0);s(this,P,0);s(this,X,!1);s(this,C,()=>{this.resize()});s(this,W,()=>{this.tick()});s(this,j,()=>{document.readyState==="complete"&&d(this,l,xt).call(this)})}get start(){return t(this,m)}get finish(){return t(this,p)}get distance(){return t(this,A)}get scrolled(){return t(this,R)}get progress(){return t(this,P)}get status(){return t(this,u)}get scrollValue(){return t(this,q)instanceof HTMLElement?t(this,q).scrollTop:t(this,q).scrollY}resize(){t(this,w).current||(r(this,nt,St.getCumulativeOffsetTop(this)),r(this,m,t(this,nt)),typeof t(this,V).current=="number"?r(this,m,t(this,m)+Math.max(t(this,M).current,t(this,V).current)):r(this,m,t(this,m)+t(this,M).current),r(this,m,t(this,m)+t(this,I).current),r(this,m,t(this,m)-St.getStickyOffset(this,"top")),r(this,p,t(this,m)),t(this,L).current?r(this,p,t(this,p)+t(this,L).current):r(this,p,t(this,p)+this.offsetHeight),r(this,p,t(this,p)+t(this,U).current),r(this,A,t(this,p)-t(this,m)),r(this,X,this.offsetWidth!==0&&this.offsetHeight!==0),this.tick())}tick(){if(t(this,w).current)return;const e=this.scrollValue;r(this,R,Tt.clamp(e-t(this,m),0,t(this,A))),r(this,P,t(this,R)/t(this,A)||0),t(this,S).current&&t(this,v).style.setProperty(d(this,l,ot).call(this,t(this,S).current),t(this,P).toFixed(6)),t(this,u).set("activated",e>=t(this,m)),t(this,X)&&t(this,u).isFalse("entered")&&e>=t(this,m)&&e<=t(this,p)?d(this,l,ft).call(this):t(this,X)&&!t(this,T).current&&t(this,u).isTrue("entered")&&(e<t(this,m)||e>t(this,p))&&d(this,l,kt).call(this),t(this,T).current&&t(this,P)===1&&(t(this,u).current.entered||d(this,l,ft).call(this),this.destroy()),at.dispatchEvent(this,"scrollRegionProgress",{detail:{progress:t(this,P),scrolled:t(this,R)}})}destroy(){document.removeEventListener("readystatechange",t(this,j)),this.disable(!1),t(this,$).close(),t(this,G).close(),t(this,w).close(),t(this,M).close(),t(this,V).close(),t(this,I).close(),t(this,L).close(),t(this,U).close(),t(this,S).close(),t(this,T).close()}enable(){K.ticker.subscribe(t(this,W),{culling:this}),pt.elementResizer.subscribe(this,t(this,C)),yt.windowResizer.subscribe(t(this,C)),t(this,W).call(this),t(this,u).set("enabled",!0)}disable(e=!0){K.ticker.unsubscribe(t(this,W)),pt.elementResizer.unsubscribe(t(this,C)),yt.windowResizer.unsubscribe(t(this,C)),e&&t(this,u).reset(),d(this,l,mt).call(this)}connectedCallback(){const e=this.getAttribute("data-scroll")||".page-scroll";r(this,q,document.querySelector(e)),document.readyState==="complete"?t(this,j).call(this):document.addEventListener("readystatechange",t(this,j))}disconnectedCallback(){this.destroy()}}H=new WeakMap,v=new WeakMap,q=new WeakMap,$=new WeakMap,G=new WeakMap,w=new WeakMap,M=new WeakMap,V=new WeakMap,I=new WeakMap,L=new WeakMap,U=new WeakMap,S=new WeakMap,T=new WeakMap,u=new WeakMap,nt=new WeakMap,m=new WeakMap,p=new WeakMap,A=new WeakMap,R=new WeakMap,P=new WeakMap,X=new WeakMap,l=new WeakSet,Ct=function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.add(this.getAttribute("data-global-class"))},mt=function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.remove(this.getAttribute("data-global-class"))},xt=function(){t(this,$).subscribe(e=>{t(this,H)&&t(this,u).removeElement(t(this,H)),r(this,H,e.current?document.querySelector(e.current)||this:this),t(this,u).addElement(t(this,H))}),t(this,G).subscribe(e=>{t(this,v)&&t(this,v).style.removeProperty(d(this,l,ot).call(this,t(this,S).current)),r(this,v,e.current?document.querySelector(e.current)||this:this)}),t(this,w).subscribe(e=>{e.current&&!e.previous?this.disable():this.enable()}),t(this,S).subscribe(e=>{e.current?t(this,W).call(this):e.previous&&t(this,v).style.removeProperty(d(this,l,ot).call(this,e.previous))}),t(this,L).subscribe(()=>{t(this,C).call(this)}),t(this,$).observe(),t(this,G).observe(),t(this,w).observe(),t(this,M).observe(),t(this,V).observe(),t(this,I).observe(),t(this,L).observe(),t(this,U).observe(),t(this,S).observe(),t(this,T).observe()},C=new WeakMap,W=new WeakMap,ft=function(){const e=this.scrollValue;t(this,u).set("entered",!0),e===0&&t(this,u).set("enteredOnLoad",!0),d(this,l,Ct).call(this),at.dispatchEvent(this,"scrollRegionEnter")},kt=function(){t(this,u).set("entered",!1),d(this,l,mt).call(this),at.dispatchEvent(this,"scrollRegionExit")},ot=function(e){return`--${e}`},j=new WeakMap;customElements.get("e-scroll-region")||customElements.define("e-scroll-region",Pt);exports.ScrollRegionElement=Pt;exports.ScrollbarElement=Et;exports.SmoothScrollElement=Lt;
|
package/lib/scroll-kit/index.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
var
|
|
1
|
+
var bt = (o) => {
|
|
2
2
|
throw TypeError(o);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var t = (o, c, e) => (
|
|
6
|
-
import { i as
|
|
7
|
-
import { f as
|
|
8
|
-
import { s as
|
|
4
|
+
var lt = (o, c, e) => c.has(o) || bt("Cannot " + e);
|
|
5
|
+
var t = (o, c, e) => (lt(o, c, "read from private field"), e ? e.call(o) : c.get(o)), s = (o, c, e) => c.has(o) ? bt("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(o) : c.set(o, e), r = (o, c, e, i) => (lt(o, c, "write to private field"), i ? i.call(o, e) : c.set(o, e), e), d = (o, c, e) => (lt(o, c, "access private method"), e);
|
|
6
|
+
import { i as Pt, a as pt } from "../index-Bv9zgfdb.js";
|
|
7
|
+
import { f as Ht } from "../dom-CVWzyXPH.js";
|
|
8
|
+
import { s as xt } from "../gestures-CcXV6fCp.js";
|
|
9
9
|
import "construct-style-sheets-polyfill";
|
|
10
|
-
import { ticker as
|
|
11
|
-
import { scrollEntries as
|
|
10
|
+
import { ticker as J } from "../ticker/index.js";
|
|
11
|
+
import { scrollEntries as ct } from "../scroll-entries/index.js";
|
|
12
12
|
import "../Store-0BVty6AZ.js";
|
|
13
|
-
import { D as
|
|
14
|
-
import { CSSProperty as
|
|
15
|
-
import { ElementLinkedStore as
|
|
16
|
-
import { elementResizer as
|
|
17
|
-
import { d as
|
|
18
|
-
import { a as
|
|
19
|
-
import { c as
|
|
20
|
-
import { windowResizer as
|
|
21
|
-
var
|
|
22
|
-
class
|
|
13
|
+
import { D as kt } from "../Damped-CtQmJ52v.js";
|
|
14
|
+
import { CSSProperty as f } from "../css-property/index.js";
|
|
15
|
+
import { ElementLinkedStore as zt } from "../element-linked-store/index.js";
|
|
16
|
+
import { elementResizer as gt } from "../element-resizer/index.js";
|
|
17
|
+
import { d as at } from "../events-CsVF98U6.js";
|
|
18
|
+
import { a as Mt, b as Vt } from "../layout-BSMtwCga.js";
|
|
19
|
+
import { c as Tt } from "../math-BOBiC4TN.js";
|
|
20
|
+
import { windowResizer as Et } from "../window-resizer/index.js";
|
|
21
|
+
var h, b, R, H, a, q, v, dt, vt, yt, N, nt, Q, x, Z;
|
|
22
|
+
class At extends HTMLElement {
|
|
23
23
|
constructor() {
|
|
24
24
|
super(...arguments);
|
|
25
|
-
s(this,
|
|
26
|
-
s(this,
|
|
27
|
-
s(this,
|
|
28
|
-
s(this,
|
|
29
|
-
s(this,
|
|
25
|
+
s(this, v);
|
|
26
|
+
s(this, h, null);
|
|
27
|
+
s(this, b, null);
|
|
28
|
+
s(this, R, 0);
|
|
29
|
+
s(this, H, 0);
|
|
30
30
|
s(this, a, !1);
|
|
31
|
-
s(this,
|
|
32
|
-
s(this,
|
|
33
|
-
this.classList.add("active"), clearTimeout(t(this,
|
|
34
|
-
const i = t(this,
|
|
35
|
-
t(this, a) ? t(this,
|
|
31
|
+
s(this, q);
|
|
32
|
+
s(this, N, () => {
|
|
33
|
+
this.classList.add("active"), clearTimeout(t(this, q));
|
|
34
|
+
const i = t(this, v, dt) / t(this, H) * t(this, R);
|
|
35
|
+
t(this, a) ? t(this, b).style.transform = `translate3d(${i}px, 0px, 0px)` : t(this, b).style.transform = `translate3d(0px, ${i}px, 0px)`, r(this, q, setTimeout(() => {
|
|
36
36
|
this.classList.remove("active");
|
|
37
37
|
}, 1e3));
|
|
38
38
|
});
|
|
39
|
-
s(this,
|
|
40
|
-
const e = t(this, a) ? this.offsetWidth : this.offsetHeight, i = t(this,
|
|
41
|
-
r(this,
|
|
42
|
-
let
|
|
43
|
-
|
|
39
|
+
s(this, nt, () => {
|
|
40
|
+
const e = t(this, a) ? this.offsetWidth : this.offsetHeight, i = t(this, v, vt), p = t(this, v, yt);
|
|
41
|
+
r(this, H, i - p);
|
|
42
|
+
let y = e * e / (t(this, H) + e);
|
|
43
|
+
y = Math.max(y, 30), t(this, a) ? (t(this, b).style.width = y + "px", t(this, b).style.height = "100%") : (t(this, b).style.width = "100%", t(this, b).style.height = y + "px"), r(this, R, e - y), i <= p ? this.style.display = "none" : this.style.display = "block";
|
|
44
44
|
});
|
|
45
|
-
s(this,
|
|
45
|
+
s(this, Q, (e) => {
|
|
46
46
|
document.documentElement.classList.add("grabbing");
|
|
47
|
-
const i = t(this,
|
|
48
|
-
|
|
49
|
-
(
|
|
50
|
-
const
|
|
51
|
-
t(this, a) ? t(this,
|
|
52
|
-
left: i +
|
|
47
|
+
const i = t(this, v, dt), p = t(this, a) ? e.x : e.y;
|
|
48
|
+
xt(
|
|
49
|
+
(y) => {
|
|
50
|
+
const Ct = t(this, H) / t(this, R), ft = (t(this, a) ? y.x - p : y.y - p) * Ct;
|
|
51
|
+
t(this, a) ? t(this, h).scroll({
|
|
52
|
+
left: i + ft,
|
|
53
53
|
behavior: "instant"
|
|
54
|
-
}) : t(this,
|
|
55
|
-
top: i +
|
|
54
|
+
}) : t(this, h).scroll({
|
|
55
|
+
top: i + ft,
|
|
56
56
|
behavior: "instant"
|
|
57
57
|
});
|
|
58
58
|
},
|
|
@@ -61,31 +61,31 @@ class Vt extends HTMLElement {
|
|
|
61
61
|
}
|
|
62
62
|
);
|
|
63
63
|
});
|
|
64
|
-
s(this,
|
|
65
|
-
t(this,
|
|
64
|
+
s(this, x, () => {
|
|
65
|
+
t(this, nt).call(this);
|
|
66
66
|
});
|
|
67
|
-
s(this,
|
|
68
|
-
e.isIntersecting ? (
|
|
67
|
+
s(this, Z, (e) => {
|
|
68
|
+
e.isIntersecting ? (J.subscribe(t(this, x), { maxFPS: 5 }), t(this, x).call(this)) : J.unsubscribe(t(this, x));
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
connectedCallback() {
|
|
72
72
|
const e = this.getAttribute("data-scroll");
|
|
73
73
|
let i = null;
|
|
74
|
-
e && (e === "parent" ? i = this.parentElement : i = document.querySelector(e)), i || (i =
|
|
75
|
-
const
|
|
76
|
-
i &&
|
|
74
|
+
e && (e === "parent" ? i = this.parentElement : i = document.querySelector(e)), i || (i = Ht(this), i === document.body && (i = window)), r(this, a, this.hasAttribute("horisontal"));
|
|
75
|
+
const p = this.querySelector("[data-thumb]");
|
|
76
|
+
i && p && (r(this, h, i), r(this, b, p), t(this, h).addEventListener("scroll", t(this, N)), t(this, b).addEventListener("pointerdown", t(this, Q)), pt.subscribe(
|
|
77
77
|
this.parentElement === document.body ? this : this.parentElement,
|
|
78
|
-
t(this,
|
|
78
|
+
t(this, Z)
|
|
79
79
|
));
|
|
80
80
|
}
|
|
81
81
|
disconnectedCallback() {
|
|
82
|
-
t(this,
|
|
82
|
+
t(this, h).removeEventListener("scroll", t(this, N)), t(this, b).removeEventListener("pointerdown", t(this, Q)), clearTimeout(t(this, q)), pt.unsubscribe(t(this, Z)), J.unsubscribe(t(this, x));
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
return t(this,
|
|
87
|
-
},
|
|
88
|
-
return t(this,
|
|
85
|
+
h = new WeakMap(), b = new WeakMap(), R = new WeakMap(), H = new WeakMap(), a = new WeakMap(), q = new WeakMap(), v = new WeakSet(), dt = function() {
|
|
86
|
+
return t(this, h) instanceof HTMLElement ? t(this, a) ? t(this, h).scrollLeft : t(this, h).scrollTop : t(this, a) ? t(this, h).scrollX : t(this, h).scrollY;
|
|
87
|
+
}, vt = function() {
|
|
88
|
+
return t(this, h) instanceof HTMLElement ? t(this, a) ? t(this, h).scrollWidth : t(this, h).scrollHeight : t(this, a) ? Math.max(
|
|
89
89
|
document.body.scrollWidth,
|
|
90
90
|
document.documentElement.scrollWidth,
|
|
91
91
|
document.body.offsetWidth,
|
|
@@ -100,11 +100,11 @@ n = new WeakMap(), f = new WeakMap(), O = new WeakMap(), x = new WeakMap(), a =
|
|
|
100
100
|
document.body.clientHeight,
|
|
101
101
|
document.documentElement.clientHeight
|
|
102
102
|
);
|
|
103
|
-
},
|
|
104
|
-
return t(this,
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
const
|
|
103
|
+
}, yt = function() {
|
|
104
|
+
return t(this, h) instanceof HTMLElement ? t(this, a) ? t(this, h).offsetWidth : t(this, h).offsetHeight : t(this, a) ? innerWidth : innerHeight;
|
|
105
|
+
}, N = new WeakMap(), nt = new WeakMap(), Q = new WeakMap(), x = new WeakMap(), Z = new WeakMap();
|
|
106
|
+
Pt && !customElements.get("e-scrollbar") && customElements.define("e-scrollbar", At);
|
|
107
|
+
const Wt = /* @__PURE__ */ new Set([
|
|
108
108
|
"ArrowUp",
|
|
109
109
|
"ArrowDown",
|
|
110
110
|
"ArrowLeft",
|
|
@@ -115,26 +115,26 @@ const Tt = /* @__PURE__ */ new Set([
|
|
|
115
115
|
"End",
|
|
116
116
|
"Space"
|
|
117
117
|
]);
|
|
118
|
-
var Y,
|
|
119
|
-
class
|
|
118
|
+
var Y, F, n, _, $, k, j, tt, et, st, it, rt;
|
|
119
|
+
class Dt extends HTMLElement {
|
|
120
120
|
constructor() {
|
|
121
121
|
super(...arguments);
|
|
122
122
|
s(this, k);
|
|
123
|
-
s(this, Y, new
|
|
124
|
-
s(this,
|
|
125
|
-
s(this,
|
|
126
|
-
s(this,
|
|
127
|
-
s(this,
|
|
128
|
-
s(this,
|
|
129
|
-
if (!d(this, k,
|
|
130
|
-
if (Math.sign(e.deltaY) < 0 && t(this,
|
|
123
|
+
s(this, Y, new f(this, "--smooth-scroll-disabled", !1));
|
|
124
|
+
s(this, F, new f(this, "--smooth-scroll-damping", 10));
|
|
125
|
+
s(this, n, new kt(0));
|
|
126
|
+
s(this, _, 0);
|
|
127
|
+
s(this, $, !1);
|
|
128
|
+
s(this, tt, (e) => {
|
|
129
|
+
if (!d(this, k, j).call(this)) {
|
|
130
|
+
if (Math.sign(e.deltaY) < 0 && t(this, n).target === 0 && t(this, n).direction < 0 || Math.sign(e.deltaY) > 0 && t(this, n).target === t(this, n).max && t(this, n).direction > 0 || e.stopPropagation(), e.target instanceof Element) {
|
|
131
131
|
const i = e.target.closest("[data-prevent-smooth-scroll]");
|
|
132
132
|
if (i) {
|
|
133
|
-
const
|
|
133
|
+
const p = i.getAttribute(
|
|
134
134
|
"data-prevent-smooth-scroll"
|
|
135
135
|
);
|
|
136
|
-
if (
|
|
137
|
-
if (matchMedia(
|
|
136
|
+
if (p) {
|
|
137
|
+
if (matchMedia(p).matches)
|
|
138
138
|
return;
|
|
139
139
|
} else return;
|
|
140
140
|
}
|
|
@@ -142,74 +142,80 @@ class At extends HTMLElement {
|
|
|
142
142
|
Math.abs(e.deltaX) > Math.abs(e.deltaY) || (e.preventDefault(), this.shiftPosition(e.deltaY));
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
|
-
s(this,
|
|
146
|
-
d(this, k,
|
|
145
|
+
s(this, et, () => {
|
|
146
|
+
d(this, k, j).call(this) || this.stop();
|
|
147
147
|
});
|
|
148
|
-
s(this,
|
|
149
|
-
d(this, k,
|
|
148
|
+
s(this, st, (e) => {
|
|
149
|
+
d(this, k, j).call(this) || e.target instanceof Element && e.target.closest("a") && this.stop();
|
|
150
150
|
});
|
|
151
|
-
s(this,
|
|
151
|
+
s(this, it, () => {
|
|
152
152
|
this.resize();
|
|
153
153
|
});
|
|
154
|
-
s(this,
|
|
155
|
-
d(this, k,
|
|
154
|
+
s(this, rt, (e) => {
|
|
155
|
+
d(this, k, j).call(this) || Wt.has(e.code) && this.stop();
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
resize() {
|
|
159
|
-
t(this,
|
|
159
|
+
t(this, n).min = 0, t(this, n).max = this.scrollHeight - this.offsetHeight;
|
|
160
160
|
}
|
|
161
161
|
stop() {
|
|
162
|
-
t(this,
|
|
162
|
+
t(this, n).unlistenAnimationFrame(), r(this, $, !0);
|
|
163
163
|
}
|
|
164
164
|
sync() {
|
|
165
165
|
const e = this.scrollTop;
|
|
166
|
-
(t(this,
|
|
166
|
+
(t(this, $) || Math.abs(e - t(this, n).current) > 100) && (r(this, $, !1), t(this, n).set(e, { equalize: !0 }));
|
|
167
167
|
}
|
|
168
168
|
shiftPosition(e) {
|
|
169
|
-
this.resize(), this.sync(), t(this,
|
|
169
|
+
this.resize(), this.sync(), t(this, n).shift(e);
|
|
170
170
|
}
|
|
171
171
|
setPosition(e, i) {
|
|
172
|
-
this.resize(), this.sync(), t(this,
|
|
172
|
+
this.resize(), this.sync(), t(this, n).set(e, i);
|
|
173
173
|
}
|
|
174
174
|
connectedCallback() {
|
|
175
|
-
window.addEventListener("resize", t(this,
|
|
175
|
+
window.addEventListener("resize", t(this, it)), this.addEventListener("keydown", t(this, rt)), this.addEventListener("pointerdown", t(this, st)), this.addEventListener("touchstart", t(this, et)), this.addEventListener("wheel", t(this, tt), {
|
|
176
176
|
passive: !1
|
|
177
|
-
}), t(this,
|
|
177
|
+
}), t(this, n).subscribe((e) => {
|
|
178
178
|
const i = Math.round(e.current);
|
|
179
|
-
|
|
179
|
+
ct.update(this, "y", e.current), i !== t(this, _) && this.scroll({
|
|
180
180
|
top: i,
|
|
181
181
|
behavior: "instant"
|
|
182
|
-
}), r(this,
|
|
183
|
-
}), t(this,
|
|
184
|
-
t(this,
|
|
185
|
-
}),
|
|
182
|
+
}), r(this, _, i);
|
|
183
|
+
}), t(this, F).observe(), t(this, Y).observe(), t(this, F).subscribe((e) => {
|
|
184
|
+
t(this, n).damping = e.current;
|
|
185
|
+
}), ct.register(this), this.resize();
|
|
186
186
|
}
|
|
187
187
|
disconnectedCallback() {
|
|
188
|
-
t(this,
|
|
188
|
+
t(this, n).close(), t(this, F).close(), t(this, Y).close(), ct.unregister(this), window.removeEventListener("resize", t(this, it)), this.removeEventListener("keydown", t(this, rt)), this.removeEventListener("pointerdown", t(this, st)), this.removeEventListener("touchstart", t(this, et)), this.removeEventListener("wheel", t(this, tt));
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
Y = new WeakMap(),
|
|
191
|
+
Y = new WeakMap(), F = new WeakMap(), n = new WeakMap(), _ = new WeakMap(), $ = new WeakMap(), k = new WeakSet(), j = function() {
|
|
192
192
|
return t(this, Y).current || getComputedStyle(this).getPropertyValue("overflow") === "hidden";
|
|
193
|
-
},
|
|
194
|
-
customElements.get("e-smooth-scroll") || customElements.define("e-smooth-scroll",
|
|
195
|
-
var
|
|
196
|
-
class
|
|
193
|
+
}, tt = new WeakMap(), et = new WeakMap(), st = new WeakMap(), it = new WeakMap(), rt = new WeakMap();
|
|
194
|
+
customElements.get("e-smooth-scroll") || customElements.define("e-smooth-scroll", Dt);
|
|
195
|
+
var z, S, M, G, I, w, V, T, U, L, X, E, A, u, ot, m, g, W, D, C, B, l, St, ut, wt, P, O, mt, Lt, ht, K;
|
|
196
|
+
class Ot extends HTMLElement {
|
|
197
197
|
constructor() {
|
|
198
198
|
super(...arguments);
|
|
199
199
|
s(this, l);
|
|
200
|
-
s(this,
|
|
201
|
-
s(this,
|
|
202
|
-
s(this,
|
|
200
|
+
s(this, z, this);
|
|
201
|
+
s(this, S, this);
|
|
202
|
+
s(this, M, null);
|
|
203
|
+
s(this, G, new f(
|
|
203
204
|
this,
|
|
204
205
|
"--scroll-region-status-holder",
|
|
205
206
|
!1
|
|
206
207
|
));
|
|
207
|
-
s(this,
|
|
208
|
+
s(this, I, new f(
|
|
209
|
+
this,
|
|
210
|
+
"--scroll-region-progress-holder",
|
|
211
|
+
!1
|
|
212
|
+
));
|
|
213
|
+
s(this, w, new f(
|
|
208
214
|
this,
|
|
209
215
|
"--scroll-region-disabled",
|
|
210
216
|
!1
|
|
211
217
|
));
|
|
212
|
-
s(this,
|
|
218
|
+
s(this, V, new f(
|
|
213
219
|
this,
|
|
214
220
|
"--scroll-region-start-offset",
|
|
215
221
|
0,
|
|
@@ -217,7 +223,7 @@ class Wt extends HTMLElement {
|
|
|
217
223
|
rawValueCheck: !1
|
|
218
224
|
}
|
|
219
225
|
));
|
|
220
|
-
s(this,
|
|
226
|
+
s(this, T, new f(
|
|
221
227
|
this,
|
|
222
228
|
"--scroll-region-start-offset-min",
|
|
223
229
|
!1,
|
|
@@ -225,7 +231,7 @@ class Wt extends HTMLElement {
|
|
|
225
231
|
rawValueCheck: !1
|
|
226
232
|
}
|
|
227
233
|
));
|
|
228
|
-
s(this,
|
|
234
|
+
s(this, U, new f(
|
|
229
235
|
this,
|
|
230
236
|
"--scroll-region-start-extra-offset",
|
|
231
237
|
0,
|
|
@@ -233,7 +239,7 @@ class Wt extends HTMLElement {
|
|
|
233
239
|
rawValueCheck: !1
|
|
234
240
|
}
|
|
235
241
|
));
|
|
236
|
-
s(this, L, new
|
|
242
|
+
s(this, L, new f(
|
|
237
243
|
this,
|
|
238
244
|
"--scroll-region-distance",
|
|
239
245
|
0,
|
|
@@ -241,7 +247,7 @@ class Wt extends HTMLElement {
|
|
|
241
247
|
rawValueCheck: !1
|
|
242
248
|
}
|
|
243
249
|
));
|
|
244
|
-
s(this,
|
|
250
|
+
s(this, X, new f(
|
|
245
251
|
this,
|
|
246
252
|
"--scroll-region-distance-offset",
|
|
247
253
|
0,
|
|
@@ -249,37 +255,37 @@ class Wt extends HTMLElement {
|
|
|
249
255
|
rawValueCheck: !1
|
|
250
256
|
}
|
|
251
257
|
));
|
|
252
|
-
s(this,
|
|
258
|
+
s(this, E, new f(
|
|
253
259
|
this,
|
|
254
260
|
"--scroll-region-progress-var",
|
|
255
261
|
""
|
|
256
262
|
));
|
|
257
|
-
s(this,
|
|
263
|
+
s(this, A, new f(
|
|
258
264
|
this,
|
|
259
265
|
"--scroll-region-enter-once",
|
|
260
266
|
!1
|
|
261
267
|
));
|
|
262
|
-
s(this, u, new
|
|
268
|
+
s(this, u, new zt(this, {
|
|
263
269
|
enabled: !1,
|
|
264
270
|
entered: !1,
|
|
265
271
|
enteredOnLoad: !1,
|
|
266
272
|
activated: !1
|
|
267
273
|
}));
|
|
268
|
-
s(this,
|
|
274
|
+
s(this, ot, 0);
|
|
269
275
|
s(this, m, 0);
|
|
270
276
|
s(this, g, 0);
|
|
271
|
-
s(this, A, 0);
|
|
272
277
|
s(this, W, 0);
|
|
278
|
+
s(this, D, 0);
|
|
273
279
|
s(this, C, 0);
|
|
274
|
-
s(this,
|
|
280
|
+
s(this, B, !1);
|
|
275
281
|
s(this, P, () => {
|
|
276
282
|
this.resize();
|
|
277
283
|
});
|
|
278
|
-
s(this,
|
|
284
|
+
s(this, O, () => {
|
|
279
285
|
this.tick();
|
|
280
286
|
});
|
|
281
|
-
s(this,
|
|
282
|
-
document.readyState === "complete" && d(this, l,
|
|
287
|
+
s(this, K, () => {
|
|
288
|
+
document.readyState === "complete" && d(this, l, wt).call(this);
|
|
283
289
|
});
|
|
284
290
|
}
|
|
285
291
|
get start() {
|
|
@@ -289,10 +295,10 @@ class Wt extends HTMLElement {
|
|
|
289
295
|
return t(this, g);
|
|
290
296
|
}
|
|
291
297
|
get distance() {
|
|
292
|
-
return t(this,
|
|
298
|
+
return t(this, W);
|
|
293
299
|
}
|
|
294
300
|
get scrolled() {
|
|
295
|
-
return t(this,
|
|
301
|
+
return t(this, D);
|
|
296
302
|
}
|
|
297
303
|
get progress() {
|
|
298
304
|
return t(this, C);
|
|
@@ -301,82 +307,86 @@ class Wt extends HTMLElement {
|
|
|
301
307
|
return t(this, u);
|
|
302
308
|
}
|
|
303
309
|
get scrollValue() {
|
|
304
|
-
return t(this,
|
|
310
|
+
return t(this, M) instanceof HTMLElement ? t(this, M).scrollTop : t(this, M).scrollY;
|
|
305
311
|
}
|
|
306
312
|
resize() {
|
|
307
|
-
t(this,
|
|
308
|
-
t(this,
|
|
309
|
-
t(this,
|
|
310
|
-
)) : r(this, m, t(this, m) + t(this,
|
|
313
|
+
t(this, w).current || (r(this, ot, Mt(this)), r(this, m, t(this, ot)), typeof t(this, T).current == "number" ? r(this, m, t(this, m) + Math.max(
|
|
314
|
+
t(this, V).current,
|
|
315
|
+
t(this, T).current
|
|
316
|
+
)) : r(this, m, t(this, m) + t(this, V).current), r(this, m, t(this, m) + t(this, U).current), r(this, m, t(this, m) - Vt(this, "top")), r(this, g, t(this, m)), t(this, L).current ? r(this, g, t(this, g) + t(this, L).current) : r(this, g, t(this, g) + this.offsetHeight), r(this, g, t(this, g) + t(this, X).current), r(this, W, t(this, g) - t(this, m)), r(this, B, this.offsetWidth !== 0 && this.offsetHeight !== 0), this.tick());
|
|
311
317
|
}
|
|
312
318
|
tick() {
|
|
313
|
-
if (t(this,
|
|
319
|
+
if (t(this, w).current)
|
|
314
320
|
return;
|
|
315
321
|
const e = this.scrollValue;
|
|
316
|
-
r(this,
|
|
317
|
-
d(this, l,
|
|
322
|
+
r(this, D, Tt(e - t(this, m), 0, t(this, W))), r(this, C, t(this, D) / t(this, W) || 0), t(this, E).current && t(this, S).style.setProperty(
|
|
323
|
+
d(this, l, ht).call(this, t(this, E).current),
|
|
318
324
|
t(this, C).toFixed(6)
|
|
319
|
-
), t(this, u).set("activated", e >= t(this, m)), t(this,
|
|
325
|
+
), t(this, u).set("activated", e >= t(this, m)), t(this, B) && t(this, u).isFalse("entered") && e >= t(this, m) && e <= t(this, g) ? d(this, l, mt).call(this) : t(this, B) && !t(this, A).current && t(this, u).isTrue("entered") && (e < t(this, m) || e > t(this, g)) && d(this, l, Lt).call(this), t(this, A).current && t(this, C) === 1 && (t(this, u).current.entered || d(this, l, mt).call(this), this.destroy()), at(this, "scrollRegionProgress", {
|
|
320
326
|
detail: {
|
|
321
327
|
progress: t(this, C),
|
|
322
|
-
scrolled: t(this,
|
|
328
|
+
scrolled: t(this, D)
|
|
323
329
|
}
|
|
324
330
|
});
|
|
325
331
|
}
|
|
326
332
|
destroy() {
|
|
327
333
|
document.removeEventListener(
|
|
328
334
|
"readystatechange",
|
|
329
|
-
t(this,
|
|
330
|
-
), this.disable(!1), t(this,
|
|
335
|
+
t(this, K)
|
|
336
|
+
), this.disable(!1), t(this, G).close(), t(this, I).close(), t(this, w).close(), t(this, V).close(), t(this, T).close(), t(this, U).close(), t(this, L).close(), t(this, X).close(), t(this, E).close(), t(this, A).close();
|
|
331
337
|
}
|
|
332
338
|
enable() {
|
|
333
|
-
|
|
339
|
+
J.subscribe(t(this, O), { culling: this }), gt.subscribe(this, t(this, P)), Et.subscribe(t(this, P)), t(this, O).call(this), t(this, u).set("enabled", !0);
|
|
334
340
|
}
|
|
335
341
|
disable(e = !0) {
|
|
336
|
-
|
|
342
|
+
J.unsubscribe(t(this, O)), gt.unsubscribe(t(this, P)), Et.unsubscribe(t(this, P)), e && t(this, u).reset(), d(this, l, ut).call(this);
|
|
337
343
|
}
|
|
338
344
|
connectedCallback() {
|
|
339
345
|
const e = this.getAttribute("data-scroll") || ".page-scroll";
|
|
340
|
-
r(this,
|
|
346
|
+
r(this, M, document.querySelector(e)), document.readyState === "complete" ? t(this, K).call(this) : document.addEventListener(
|
|
341
347
|
"readystatechange",
|
|
342
|
-
t(this,
|
|
348
|
+
t(this, K)
|
|
343
349
|
);
|
|
344
350
|
}
|
|
345
351
|
disconnectedCallback() {
|
|
346
352
|
this.destroy();
|
|
347
353
|
}
|
|
348
354
|
}
|
|
349
|
-
|
|
355
|
+
z = new WeakMap(), S = new WeakMap(), M = new WeakMap(), G = new WeakMap(), I = new WeakMap(), w = new WeakMap(), V = new WeakMap(), T = new WeakMap(), U = new WeakMap(), L = new WeakMap(), X = new WeakMap(), E = new WeakMap(), A = new WeakMap(), u = new WeakMap(), ot = new WeakMap(), m = new WeakMap(), g = new WeakMap(), W = new WeakMap(), D = new WeakMap(), C = new WeakMap(), B = new WeakMap(), l = new WeakSet(), St = function() {
|
|
350
356
|
this.hasAttribute("data-global-class") && document.documentElement.classList.add(
|
|
351
357
|
this.getAttribute("data-global-class")
|
|
352
358
|
);
|
|
353
|
-
},
|
|
359
|
+
}, ut = function() {
|
|
354
360
|
this.hasAttribute("data-global-class") && document.documentElement.classList.remove(
|
|
355
361
|
this.getAttribute("data-global-class")
|
|
356
362
|
);
|
|
357
|
-
},
|
|
358
|
-
t(this,
|
|
359
|
-
t(this,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
+
}, wt = function() {
|
|
364
|
+
t(this, G).subscribe((e) => {
|
|
365
|
+
t(this, z) && t(this, u).removeElement(t(this, z)), r(this, z, e.current ? document.querySelector(e.current) || this : this), t(this, u).addElement(t(this, z));
|
|
366
|
+
}), t(this, I).subscribe((e) => {
|
|
367
|
+
t(this, S) && t(this, S).style.removeProperty(
|
|
368
|
+
d(this, l, ht).call(this, t(this, E).current)
|
|
369
|
+
), r(this, S, e.current ? document.querySelector(e.current) || this : this);
|
|
370
|
+
}), t(this, w).subscribe((e) => {
|
|
363
371
|
e.current && !e.previous ? this.disable() : this.enable();
|
|
364
|
-
}), t(this,
|
|
365
|
-
e.current ? t(this,
|
|
372
|
+
}), t(this, E).subscribe((e) => {
|
|
373
|
+
e.current ? t(this, O).call(this) : e.previous && t(this, S).style.removeProperty(
|
|
374
|
+
d(this, l, ht).call(this, e.previous)
|
|
375
|
+
);
|
|
366
376
|
}), t(this, L).subscribe(() => {
|
|
367
377
|
t(this, P).call(this);
|
|
368
|
-
}), t(this,
|
|
369
|
-
}, P = new WeakMap(),
|
|
378
|
+
}), t(this, G).observe(), t(this, I).observe(), t(this, w).observe(), t(this, V).observe(), t(this, T).observe(), t(this, U).observe(), t(this, L).observe(), t(this, X).observe(), t(this, E).observe(), t(this, A).observe();
|
|
379
|
+
}, P = new WeakMap(), O = new WeakMap(), mt = function() {
|
|
370
380
|
const e = this.scrollValue;
|
|
371
|
-
t(this, u).set("entered", !0), e === 0 && t(this, u).set("enteredOnLoad", !0), d(this, l,
|
|
372
|
-
},
|
|
373
|
-
t(this, u).set("entered", !1), d(this, l,
|
|
374
|
-
},
|
|
381
|
+
t(this, u).set("entered", !0), e === 0 && t(this, u).set("enteredOnLoad", !0), d(this, l, St).call(this), at(this, "scrollRegionEnter");
|
|
382
|
+
}, Lt = function() {
|
|
383
|
+
t(this, u).set("entered", !1), d(this, l, ut).call(this), at(this, "scrollRegionExit");
|
|
384
|
+
}, ht = function(e) {
|
|
375
385
|
return `--${e}`;
|
|
376
|
-
},
|
|
377
|
-
customElements.get("e-scroll-region") || customElements.define("e-scroll-region",
|
|
386
|
+
}, K = new WeakMap();
|
|
387
|
+
customElements.get("e-scroll-region") || customElements.define("e-scroll-region", Ot);
|
|
378
388
|
export {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
389
|
+
Ot as ScrollRegionElement,
|
|
390
|
+
At as ScrollbarElement,
|
|
391
|
+
Dt as SmoothScrollElement
|
|
382
392
|
};
|
package/lib/slicer/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var O=n=>{throw TypeError(n)};var C=(n,e,s)=>e.has(n)||O("Cannot "+s);var t=(n,e,s)=>(C(n,e,"read from private field"),s?s.call(n):e.get(n)),l=(n,e,s)=>e.has(n)?O("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,s),o=(n,e,s,p)=>(C(n,e,"write to private field"),p?p.call(n,s):e.set(n,s),s),m=(n,e,s)=>(C(n,e,"access private method"),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../media/index.cjs"),q=require("../index-DekP7OZe.cjs");require("construct-style-sheets-polyfill");var y,d;class F{constructor(e){l(this,y);l(this,d);o(this,y,e.index),o(this,d,document.createElement("span")),t(this,d).classList.add("letter"),e.clone?t(this,d).innerHTML=`<span class="original"><span class="value">${e.text}</span></span><span class="clone" aria-hidden><span class="value">${e.text}</span></span>`:t(this,d).innerHTML=`<span class="original"><span class="value">${e.text}</span></span>`}get index(){return t(this,y)}get element(){return t(this,d)}}y=new WeakMap,d=new WeakMap;var A,h,f,E;class S{constructor(e){l(this,A);l(this,h);l(this,f);l(this,E);if(o(this,A,e.index),o(this,h,document.createElement("span")),o(this,f,[]),o(this,E,e.text.endsWith("\\n")),t(this,E)&&(e.text=e.text.replace("\\n","")),e.letters&&e.lettersAcc!==void 0){let s=0;const p=e.text.split("").map(c=>{if(c!==" ")return new F({index:e.lettersAcc+s++,text:c,clone:e.clone})});o(this,f,p.filter(c=>c instanceof F)),t(this,h).append(...t(this,f).map(c=>c.element))}else e.clone?t(this,h).innerHTML=`<span class="original"><span class="value">${e.text}</span></span><span class="clone" aria-hidden><span class="value">${e.text}</span></span>`:t(this,h).innerHTML=`<span class="original"><span class="value">${e.text}</span></span>`;t(this,h).classList.add("word")}get index(){return t(this,A)}get element(){return t(this,h)}get letters(){return t(this,f)}get hasNewLine(){return t(this,E)}}A=new WeakMap,h=new WeakMap,f=new WeakMap,E=new WeakMap;var N,a,x,T,u,H,D;class P extends HTMLElement{constructor(){super(...arguments);l(this,u);l(this,N,"");l(this,a,[]);l(this,x,[]);l(this,T,null)}get wordsArray(){return t(this,a)}get lettersArray(){return t(this,x)}get originalHTML(){return t(this,N)}connectedCallback(){o(this,N,this.innerHTML.trim()),this.hasAttribute("media")?(o(this,T,new k.Media(this.getAttribute("media"))),t(this,T).subscribe(s=>{s.current?m(this,u,H).call(this):!s.current&&s.previous&&m(this,u,D).call(this)})):m(this,u,H).call(this)}disconnectedCallback(){var s;m(this,u,D).call(this),(s=t(this,T))==null||s.close()}}N=new WeakMap,a=new WeakMap,x=new WeakMap,T=new WeakMap,u=new WeakSet,H=function(){const s=[];o(this,a,[]);let p=0,c=0;const $=i=>{var g;const r=(g=i.textContent)==null?void 0:g.trim();if(!r)return document.createDocumentFragment();const L=document.createDocumentFragment();return r.replace(/[\s\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u3000\uFEFF]+/g," ").split(" ").forEach((M,b,v)=>{if(!M)return;const w=new S({index:p,text:M+(b<v.length-1?" ":""),letters:this.hasAttribute("letters"),lettersAcc:c,clone:this.hasAttribute("clone")});c+=w.letters.length,p+=1,t(this,x).push(...w.letters),t(this,a).push(w),L.appendChild(w.element)}),L},_=i=>{if(i.nodeType===Node.TEXT_NODE)return $(i);if(i.nodeType===Node.ELEMENT_NODE){const r=i.cloneNode(!1);return Array.from(i.childNodes).forEach(L=>{const g=_(L);g&&(g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?Array.from(g.childNodes).forEach((M,b,v)=>{r.append(M),b!==v.length-1&&r.append(new Text(" "))}):r.appendChild(g))}),r}return i.cloneNode()};Array.from(this.childNodes).forEach(i=>{const r=_(i);r.nodeType===Node.DOCUMENT_FRAGMENT_NODE?s.push(...Array.from(r.childNodes)):s.push(r)}),this.hasAttribute("index")&&(t(this,a).forEach(i=>{i.element.style.setProperty("--word-index",i.index.toString())}),t(this,x).forEach(i=>{i.element.style.setProperty("--letter-index",i.index.toString())})),this.innerHTML="",s.forEach((i,r)=>{this.appendChild(i),r<s.length-1&&i.nodeType===Node.ELEMENT_NODE&&this.appendChild(new Text(" "))}),this.style.setProperty("--words-length",t(this,a).length.toString()),this.style.setProperty("--letters-length",t(this,x).length.toString())},D=function(){o(this,a,[]),this.innerHTML=t(this,N),this.style.removeProperty("--words-length"),this.style.removeProperty("--letters-length")};q.isBrowser&&!customElements.get("e-slicer")&&customElements.define("e-slicer",P);exports.Letter=F;exports.SlicerElement=P;exports.Word=S;
|
package/lib/slicer/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var O = (n) => {
|
|
2
2
|
throw TypeError(n);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var t = (n, e, s) => (
|
|
6
|
-
import { Media as
|
|
7
|
-
import { i as
|
|
4
|
+
var F = (n, e, s) => e.has(n) || O("Cannot " + s);
|
|
5
|
+
var t = (n, e, s) => (F(n, e, "read from private field"), s ? s.call(n) : e.get(n)), r = (n, e, s) => e.has(n) ? O("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, s), o = (n, e, s, p) => (F(n, e, "write to private field"), p ? p.call(n, s) : e.set(n, s), s), T = (n, e, s) => (F(n, e, "access private method"), s);
|
|
6
|
+
import { Media as $ } from "../media/index.js";
|
|
7
|
+
import { i as S } from "../index-Bv9zgfdb.js";
|
|
8
8
|
import "construct-style-sheets-polyfill";
|
|
9
9
|
var y, d;
|
|
10
|
-
class
|
|
10
|
+
class _ {
|
|
11
11
|
constructor(e) {
|
|
12
12
|
r(this, y);
|
|
13
13
|
r(this, d);
|
|
@@ -30,15 +30,15 @@ class k {
|
|
|
30
30
|
r(this, E);
|
|
31
31
|
if (o(this, A, e.index), o(this, c, document.createElement("span")), o(this, g, []), o(this, E, e.text.endsWith("\\n")), t(this, E) && (e.text = e.text.replace("\\n", "")), e.letters && e.lettersAcc !== void 0) {
|
|
32
32
|
let s = 0;
|
|
33
|
-
const
|
|
33
|
+
const p = e.text.split("").map((h) => {
|
|
34
34
|
if (h !== " ")
|
|
35
|
-
return new
|
|
35
|
+
return new _({
|
|
36
36
|
index: e.lettersAcc + s++,
|
|
37
37
|
text: h,
|
|
38
38
|
clone: e.clone
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
|
-
o(this, g,
|
|
41
|
+
o(this, g, p.filter((h) => h instanceof _)), t(this, c).append(
|
|
42
42
|
...t(this, g).map((h) => h.element)
|
|
43
43
|
);
|
|
44
44
|
} else
|
|
@@ -59,11 +59,11 @@ class k {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
A = new WeakMap(), c = new WeakMap(), g = new WeakMap(), E = new WeakMap();
|
|
62
|
-
var m, a, x, N,
|
|
62
|
+
var m, a, x, N, u, H, b;
|
|
63
63
|
class G extends HTMLElement {
|
|
64
64
|
constructor() {
|
|
65
65
|
super(...arguments);
|
|
66
|
-
r(this,
|
|
66
|
+
r(this, u);
|
|
67
67
|
r(this, m, "");
|
|
68
68
|
r(this, a, []);
|
|
69
69
|
r(this, x, []);
|
|
@@ -79,42 +79,45 @@ class G extends HTMLElement {
|
|
|
79
79
|
return t(this, m);
|
|
80
80
|
}
|
|
81
81
|
connectedCallback() {
|
|
82
|
-
o(this, m, this.innerHTML.trim()), this.hasAttribute("media") ? (o(this, N, new
|
|
83
|
-
s.current ? T(this,
|
|
84
|
-
})) : T(this,
|
|
82
|
+
o(this, m, this.innerHTML.trim()), this.hasAttribute("media") ? (o(this, N, new $(this.getAttribute("media"))), t(this, N).subscribe((s) => {
|
|
83
|
+
s.current ? T(this, u, H).call(this) : !s.current && s.previous && T(this, u, b).call(this);
|
|
84
|
+
})) : T(this, u, H).call(this);
|
|
85
85
|
}
|
|
86
86
|
disconnectedCallback() {
|
|
87
87
|
var s;
|
|
88
|
-
T(this,
|
|
88
|
+
T(this, u, b).call(this), (s = t(this, N)) == null || s.close();
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
m = new WeakMap(), a = new WeakMap(), x = new WeakMap(), N = new WeakMap(),
|
|
91
|
+
m = new WeakMap(), a = new WeakMap(), x = new WeakMap(), N = new WeakMap(), u = new WeakSet(), H = function() {
|
|
92
92
|
const s = [];
|
|
93
93
|
o(this, a, []);
|
|
94
|
-
let
|
|
95
|
-
const
|
|
94
|
+
let p = 0, h = 0;
|
|
95
|
+
const P = (i) => {
|
|
96
96
|
var f;
|
|
97
97
|
const l = (f = i.textContent) == null ? void 0 : f.trim();
|
|
98
98
|
if (!l) return document.createDocumentFragment();
|
|
99
99
|
const L = document.createDocumentFragment();
|
|
100
|
-
return l.replace(
|
|
100
|
+
return l.replace(
|
|
101
|
+
/[\s\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u3000\uFEFF]+/g,
|
|
102
|
+
" "
|
|
103
|
+
).split(" ").forEach((M, v, C) => {
|
|
101
104
|
if (!M) return;
|
|
102
105
|
const w = new k({
|
|
103
|
-
index:
|
|
106
|
+
index: p,
|
|
104
107
|
text: M + (v < C.length - 1 ? " " : ""),
|
|
105
108
|
letters: this.hasAttribute("letters"),
|
|
106
109
|
lettersAcc: h,
|
|
107
110
|
clone: this.hasAttribute("clone")
|
|
108
111
|
});
|
|
109
|
-
h += w.letters.length,
|
|
112
|
+
h += w.letters.length, p += 1, t(this, x).push(...w.letters), t(this, a).push(w), L.appendChild(w.element);
|
|
110
113
|
}), L;
|
|
111
|
-
},
|
|
114
|
+
}, D = (i) => {
|
|
112
115
|
if (i.nodeType === Node.TEXT_NODE)
|
|
113
|
-
return
|
|
116
|
+
return P(i);
|
|
114
117
|
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
115
118
|
const l = i.cloneNode(!1);
|
|
116
119
|
return Array.from(i.childNodes).forEach((L) => {
|
|
117
|
-
const f =
|
|
120
|
+
const f = D(L);
|
|
118
121
|
f && (f.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? Array.from(f.childNodes).forEach((M, v, C) => {
|
|
119
122
|
l.append(M), v !== C.length - 1 && l.append(new Text(" "));
|
|
120
123
|
}) : l.appendChild(f));
|
|
@@ -123,7 +126,7 @@ m = new WeakMap(), a = new WeakMap(), x = new WeakMap(), N = new WeakMap(), p =
|
|
|
123
126
|
return i.cloneNode();
|
|
124
127
|
};
|
|
125
128
|
Array.from(this.childNodes).forEach((i) => {
|
|
126
|
-
const l =
|
|
129
|
+
const l = D(i);
|
|
127
130
|
l.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? s.push(...Array.from(l.childNodes)) : s.push(l);
|
|
128
131
|
}), this.hasAttribute("index") && (t(this, a).forEach((i) => {
|
|
129
132
|
i.element.style.setProperty("--word-index", i.index.toString());
|
|
@@ -135,12 +138,12 @@ m = new WeakMap(), a = new WeakMap(), x = new WeakMap(), N = new WeakMap(), p =
|
|
|
135
138
|
})), this.innerHTML = "", s.forEach((i, l) => {
|
|
136
139
|
this.appendChild(i), l < s.length - 1 && i.nodeType === Node.ELEMENT_NODE && this.appendChild(new Text(" "));
|
|
137
140
|
}), this.style.setProperty("--words-length", t(this, a).length.toString()), this.style.setProperty("--letters-length", t(this, x).length.toString());
|
|
138
|
-
},
|
|
141
|
+
}, b = function() {
|
|
139
142
|
o(this, a, []), this.innerHTML = t(this, m), this.style.removeProperty("--words-length"), this.style.removeProperty("--letters-length");
|
|
140
143
|
};
|
|
141
|
-
|
|
144
|
+
S && !customElements.get("e-slicer") && customElements.define("e-slicer", G);
|
|
142
145
|
export {
|
|
143
|
-
|
|
146
|
+
_ as Letter,
|
|
144
147
|
G as SlicerElement,
|
|
145
148
|
k as Word
|
|
146
149
|
};
|