masoneffect 2.0.8 → 2.0.11
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/README.md +23 -25
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/scrollFadeIn/index.d.ts +4 -11
- package/dist/core/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/core/typing/index.d.ts +2 -0
- package/dist/core/typing/index.d.ts.map +1 -1
- package/dist/core/utils/visibilityManager.d.ts +1 -0
- package/dist/core/utils/visibilityManager.d.ts.map +1 -1
- package/dist/count/core/index.d.ts +0 -1
- package/dist/count/core/index.d.ts.map +1 -1
- package/dist/count/core/scrollFadeIn/index.d.ts +4 -11
- package/dist/count/core/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/count/core/typing/index.d.ts +2 -0
- package/dist/count/core/typing/index.d.ts.map +1 -1
- package/dist/count/core/utils/visibilityManager.d.ts +1 -0
- package/dist/count/core/utils/visibilityManager.d.ts.map +1 -1
- package/dist/count/index.cjs +1 -1
- package/dist/count/index.d.ts +0 -1
- package/dist/count/index.d.ts.map +1 -1
- package/dist/count/index.mjs +1 -1
- package/dist/count/react/index.d.ts +0 -1
- package/dist/count/react/index.d.ts.map +1 -1
- package/dist/count/react/scrollFadeIn/index.d.ts +0 -1
- package/dist/count/react/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/react/core/index.d.ts +0 -1
- package/dist/react/core/scrollFadeIn/index.d.ts +4 -11
- package/dist/react/core/typing/index.d.ts +2 -0
- package/dist/react/core/utils/visibilityManager.d.ts +1 -0
- package/dist/react/count/core/index.d.ts +0 -1
- package/dist/react/count/core/index.d.ts.map +1 -1
- package/dist/react/count/core/scrollFadeIn/index.d.ts +4 -11
- package/dist/react/count/core/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/react/count/core/typing/index.d.ts +2 -0
- package/dist/react/count/core/typing/index.d.ts.map +1 -1
- package/dist/react/count/core/utils/visibilityManager.d.ts +1 -0
- package/dist/react/count/core/utils/visibilityManager.d.ts.map +1 -1
- package/dist/react/count/index.cjs +1 -1
- package/dist/react/count/index.d.ts +0 -1
- package/dist/react/count/index.d.ts.map +1 -1
- package/dist/react/count/index.mjs +1 -1
- package/dist/react/count/react/index.d.ts +0 -1
- package/dist/react/count/react/index.d.ts.map +1 -1
- package/dist/react/count/react/scrollFadeIn/index.d.ts +0 -1
- package/dist/react/count/react/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/react/index.cjs +0 -4
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.mjs +1 -1
- package/dist/react/react/index.d.ts +0 -1
- package/dist/react/react/scrollFadeIn/index.d.ts +0 -1
- package/dist/react/scrollFadeIn/core/index.d.ts +0 -1
- package/dist/react/scrollFadeIn/core/index.d.ts.map +1 -1
- package/dist/react/scrollFadeIn/core/scrollFadeIn/index.d.ts +4 -11
- package/dist/react/scrollFadeIn/core/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/react/scrollFadeIn/core/typing/index.d.ts +2 -0
- package/dist/react/scrollFadeIn/core/typing/index.d.ts.map +1 -1
- package/dist/react/scrollFadeIn/core/utils/visibilityManager.d.ts +1 -0
- package/dist/react/scrollFadeIn/core/utils/visibilityManager.d.ts.map +1 -1
- package/dist/react/scrollFadeIn/index.cjs +1 -1
- package/dist/react/scrollFadeIn/index.d.ts +0 -1
- package/dist/react/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/react/scrollFadeIn/index.mjs +1 -1
- package/dist/react/scrollFadeIn/react/index.d.ts +0 -1
- package/dist/react/scrollFadeIn/react/index.d.ts.map +1 -1
- package/dist/react/scrollFadeIn/react/scrollFadeIn/index.d.ts +0 -1
- package/dist/react/scrollFadeIn/react/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/react/textToParticle/core/index.d.ts +0 -1
- package/dist/react/textToParticle/core/index.d.ts.map +1 -1
- package/dist/react/textToParticle/core/scrollFadeIn/index.d.ts +4 -11
- package/dist/react/textToParticle/core/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/react/textToParticle/core/typing/index.d.ts +2 -0
- package/dist/react/textToParticle/core/typing/index.d.ts.map +1 -1
- package/dist/react/textToParticle/core/utils/visibilityManager.d.ts +1 -0
- package/dist/react/textToParticle/core/utils/visibilityManager.d.ts.map +1 -1
- package/dist/react/textToParticle/index.cjs +1 -1
- package/dist/react/textToParticle/index.d.ts +0 -1
- package/dist/react/textToParticle/index.d.ts.map +1 -1
- package/dist/react/textToParticle/index.mjs +1 -1
- package/dist/react/textToParticle/react/index.d.ts +0 -1
- package/dist/react/textToParticle/react/index.d.ts.map +1 -1
- package/dist/react/textToParticle/react/scrollFadeIn/index.d.ts +0 -1
- package/dist/react/textToParticle/react/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/react/typing/core/index.d.ts +0 -1
- package/dist/react/typing/core/index.d.ts.map +1 -1
- package/dist/react/typing/core/scrollFadeIn/index.d.ts +4 -11
- package/dist/react/typing/core/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/react/typing/core/typing/index.d.ts +2 -0
- package/dist/react/typing/core/typing/index.d.ts.map +1 -1
- package/dist/react/typing/core/utils/visibilityManager.d.ts +1 -0
- package/dist/react/typing/core/utils/visibilityManager.d.ts.map +1 -1
- package/dist/react/typing/index.cjs +1 -1
- package/dist/react/typing/index.d.ts +0 -1
- package/dist/react/typing/index.d.ts.map +1 -1
- package/dist/react/typing/index.mjs +1 -1
- package/dist/react/typing/react/index.d.ts +0 -1
- package/dist/react/typing/react/index.d.ts.map +1 -1
- package/dist/react/typing/react/scrollFadeIn/index.d.ts +0 -1
- package/dist/react/typing/react/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/scrollFadeIn/core/index.d.ts +0 -1
- package/dist/scrollFadeIn/core/index.d.ts.map +1 -1
- package/dist/scrollFadeIn/core/scrollFadeIn/index.d.ts +4 -11
- package/dist/scrollFadeIn/core/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/scrollFadeIn/core/typing/index.d.ts +2 -0
- package/dist/scrollFadeIn/core/typing/index.d.ts.map +1 -1
- package/dist/scrollFadeIn/core/utils/visibilityManager.d.ts +1 -0
- package/dist/scrollFadeIn/core/utils/visibilityManager.d.ts.map +1 -1
- package/dist/scrollFadeIn/index.cjs +1 -1
- package/dist/scrollFadeIn/index.d.ts +0 -1
- package/dist/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/scrollFadeIn/index.mjs +1 -1
- package/dist/scrollFadeIn/react/index.d.ts +0 -1
- package/dist/scrollFadeIn/react/index.d.ts.map +1 -1
- package/dist/scrollFadeIn/react/scrollFadeIn/index.d.ts +0 -1
- package/dist/scrollFadeIn/react/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/svelte/count/index.cjs +1 -1
- package/dist/svelte/count/index.d.ts +8 -6
- package/dist/svelte/count/index.mjs +5 -1
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.d.ts +8 -6
- package/dist/svelte/index.mjs +88 -27
- package/dist/svelte/scrollFadeIn/index.cjs +1 -1
- package/dist/svelte/scrollFadeIn/index.d.ts +8 -6
- package/dist/svelte/scrollFadeIn/index.mjs +35 -24
- package/dist/svelte/textToParticle/index.cjs +1 -1
- package/dist/svelte/textToParticle/index.d.ts +8 -6
- package/dist/svelte/textToParticle/index.mjs +5 -1
- package/dist/svelte/typing/index.cjs +1 -1
- package/dist/svelte/typing/index.d.ts +8 -6
- package/dist/svelte/typing/index.mjs +56 -2
- package/dist/textToParticle/core/index.d.ts +0 -1
- package/dist/textToParticle/core/index.d.ts.map +1 -1
- package/dist/textToParticle/core/scrollFadeIn/index.d.ts +4 -11
- package/dist/textToParticle/core/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/textToParticle/core/typing/index.d.ts +2 -0
- package/dist/textToParticle/core/typing/index.d.ts.map +1 -1
- package/dist/textToParticle/core/utils/visibilityManager.d.ts +1 -0
- package/dist/textToParticle/core/utils/visibilityManager.d.ts.map +1 -1
- package/dist/textToParticle/index.cjs +1 -1
- package/dist/textToParticle/index.d.ts +0 -1
- package/dist/textToParticle/index.d.ts.map +1 -1
- package/dist/textToParticle/index.mjs +1 -1
- package/dist/textToParticle/react/index.d.ts +0 -1
- package/dist/textToParticle/react/index.d.ts.map +1 -1
- package/dist/textToParticle/react/scrollFadeIn/index.d.ts +0 -1
- package/dist/textToParticle/react/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/typing/core/index.d.ts +0 -1
- package/dist/typing/core/index.d.ts.map +1 -1
- package/dist/typing/core/scrollFadeIn/index.d.ts +4 -11
- package/dist/typing/core/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/typing/core/typing/index.d.ts +2 -0
- package/dist/typing/core/typing/index.d.ts.map +1 -1
- package/dist/typing/core/utils/visibilityManager.d.ts +1 -0
- package/dist/typing/core/utils/visibilityManager.d.ts.map +1 -1
- package/dist/typing/index.cjs +1 -1
- package/dist/typing/index.d.ts +0 -1
- package/dist/typing/index.d.ts.map +1 -1
- package/dist/typing/index.mjs +1 -1
- package/dist/typing/react/index.d.ts +0 -1
- package/dist/typing/react/index.d.ts.map +1 -1
- package/dist/typing/react/scrollFadeIn/index.d.ts +0 -1
- package/dist/typing/react/scrollFadeIn/index.d.ts.map +1 -1
- package/dist/vue/count/index.cjs +1 -1
- package/dist/vue/count/index.d.ts +8 -6
- package/dist/vue/count/index.mjs +5 -1
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.d.ts +8 -6
- package/dist/vue/index.mjs +81 -20
- package/dist/vue/scrollFadeIn/index.cjs +1 -1
- package/dist/vue/scrollFadeIn/index.d.ts +8 -6
- package/dist/vue/scrollFadeIn/index.mjs +28 -17
- package/dist/vue/textToParticle/index.cjs +1 -1
- package/dist/vue/textToParticle/index.d.ts +8 -6
- package/dist/vue/textToParticle/index.mjs +5 -1
- package/dist/vue/typing/index.cjs +1 -1
- package/dist/vue/typing/index.d.ts +8 -6
- package/dist/vue/typing/index.mjs +56 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"t",{value:!0});var t=require("react");class s{constructor(t,s={}){this.container=t,this.options={threshold:s.threshold??.1,rootMargin:s.rootMargin??"0px",onVisible:s.onVisible,onHidden:s.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const s of t)s.target===this.container&&(s.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}function i(t){const s=t.charCodeAt(0);if(s<44032||s>55203)return[t];const i=s-44032,e=Math.floor(i/588),
|
|
1
|
+
Object.defineProperty(exports,"t",{value:!0});var t=require("react");class s{constructor(t,s={}){this.container=t,this.options={threshold:s.threshold??.1,rootMargin:s.rootMargin??"0px",root:s.root??null,onVisible:s.onVisible,onHidden:s.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const s of t)s.target===this.container&&(s.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin,root:this.options.root||null}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}function i(t){const s=t.charCodeAt(0);if(s<44032||s>55203)return[t];const i=s-44032,e=Math.floor(i/588),n=Math.floor(i%588/28),h=i%28,o=[];return o.push(["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"][e]),o.push(["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"][n]),h>0&&o.push(["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"][h]),o}function e(t,s,i){const e=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"].indexOf(t),n=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"].indexOf(s),h=i?["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"].indexOf(i):0;if(-1===e||-1===n)return t+(s||"")+(i||"");const o=44032+21*e*28+28*n+h;return String.fromCharCode(o)}function n(t){const s=[],e=[];for(let n=0;n<t.length;n++){const h=t[n],o=h.charCodeAt(0),r=s.length;if(o>=44032&&o<=55203){const t=i(h);s.push(...t),e.push({start:r,end:s.length,isHangul:!0})}else s.push(h),e.push({start:r,end:s.length,isHangul:!1})}return{units:s,charUnitRanges:e}}class h{constructor(t,s){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.originalText=s.text,this.config={text:s.text,speed:s.speed??50,delay:s.delay??0,enabled:s.enabled??!0,threshold:s.threshold??.2,rootMargin:s.rootMargin??"0px 0px -100px 0px",triggerOnce:s.triggerOnce??!1,showCursor:s.showCursor??!0,cursorChar:s.cursorChar??"|",onUpdate:s.onUpdate||null,onComplete:s.onComplete||null};const i=n(this.config.text);this.textUnits=i.units,this.charUnitRanges=i.charUnitRanges,this.currentIndex=0,this.displayedText="",this.timeoutId=null,this.visibilityManager=null,this.isRunning=!1,this.hasTriggered=!1,this.init()}init(){this.updateDisplay(""),this.injectStyles(),this.setupVisibilityManager()}injectStyles(){if(document.getElementById("masoneffect-typing-styles"))return;const t=document.createElement("style");t.id="masoneffect-typing-styles",t.textContent="\n .typing-char {\n transition: opacity 0.2s ease-in;\n display: inline-block;\n }\n .typing-cursor {\n display: inline-block;\n }\n ",document.head.appendChild(t)}setupVisibilityManager(){this.visibilityManager=new s(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,onVisible:()=>{!this.hasTriggered&&this.config.enabled&&(this.hasTriggered=!0,setTimeout(()=>this.start(),this.config.delay))},onHidden:()=>{}})}buildTextFromUnits(t){if(0===t)return"";let s="";for(let i=0;i<this.charUnitRanges.length;i++){const n=this.charUnitRanges[i];if(n.start>=t)break;const h=Math.min(t-n.start,n.end-n.start);if(h<=0)break;if(n.isHangul){const t=this.textUnits.slice(n.start,n.start+h);1===t.length?s+=t[0]:2===t.length?s+=e(t[0],t[1]):t.length>=3&&(s+=e(t[0],t[1],t[2]))}else h>0&&(s+=this.textUnits[n.start])}return s}start(){this.isRunning||(this.isRunning=!0,this.currentIndex=0,this.displayedText="",this.typeNext())}typeNext(){if(this.currentIndex>=this.textUnits.length)return this.isRunning=!1,this.config.showCursor&&this.updateDisplay(this.originalText),void(this.config.onComplete&&this.config.onComplete());this.displayedText=this.buildTextFromUnits(this.currentIndex+1);let t=this.displayedText;this.config.showCursor&&(t+=this.config.cursorChar),this.updateDisplay(t),this.config.onUpdate&&this.config.onUpdate(this.displayedText),this.currentIndex++,this.timeoutId=setTimeout(()=>{this.typeNext()},this.config.speed)}stop(){this.isRunning=!1,this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}reset(){this.stop(),this.currentIndex=0,this.displayedText="",this.hasTriggered=!1,this.updateDisplay("")}updateDisplay(t){const s=t.replace(new RegExp(this.escapeHtml(this.config.cursorChar)+"$"),""),i=t.endsWith(this.config.cursorChar),e=(this.container.textContent||"").replace(new RegExp(this.config.cursorChar+"$"),"");let n="";for(let t=0;t<s.length;t++){const i=s[t];n+=t>=e.length?`<span class="typing-char typing-fade-in" style="opacity: 0;">${this.escapeHtml(i)}</span>`:`<span class="typing-char" style="opacity: 1;">${this.escapeHtml(i)}</span>`}i&&(n+=`<span class="typing-cursor">${this.escapeHtml(this.config.cursorChar)}</span>`),this.container.innerHTML=n;const h=this.container.querySelectorAll(".typing-fade-in");h.length>0&&requestAnimationFrame(()=>{h.forEach(t=>{t.style.opacity="1",t.classList.remove("typing-fade-in")})})}escapeHtml(t){const s=document.createElement("div");return s.textContent=t,s.innerHTML}setText(t){this.originalText=t,this.config.text=t;const s=n(t);this.textUnits=s.units,this.charUnitRanges=s.charUnitRanges,this.reset(),this.config.enabled&&setTimeout(()=>this.start(),this.config.delay)}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null)}}const o=t.forwardRef((s,i)=>{const e=t.useRef(null),n=t.useRef(null);return t.useEffect(()=>{if(!e.current)return;if(n.current)return;const{className:t,style:i,text:o,speed:r,delay:l,enabled:c,threshold:u,rootMargin:a,triggerOnce:d,showCursor:p,cursorChar:y,onUpdate:g,onComplete:f}=s,m={text:o,speed:r,delay:l,enabled:c,threshold:u,rootMargin:a,triggerOnce:d,showCursor:p,cursorChar:y,onUpdate:g,onComplete:f};return n.current=new h(e.current,m),()=>{n.current&&(n.current.destroy(),n.current=null)}},[]),t.useEffect(()=>{if(!n.current)return;const{text:t,speed:i,delay:e,enabled:h,threshold:o,rootMargin:r,triggerOnce:l,showCursor:c,cursorChar:u,onUpdate:a,onComplete:d}=s;void 0!==t&&t!==n.current.originalText&&n.current.setText(t)},[s.text,s.speed,s.delay,s.enabled,s.threshold,s.rootMargin,s.triggerOnce,s.showCursor,s.cursorChar,s.onUpdate,s.onComplete]),t.useImperativeHandle(i,()=>({start:()=>{n.current?n.current.start():console.warn("Typing: 인스턴스가 아직 초기화되지 않았습니다.")},stop:()=>{n.current?n.current.stop():console.warn("Typing: 인스턴스가 아직 초기화되지 않았습니다.")},reset:()=>{n.current?n.current.reset():console.warn("Typing: 인스턴스가 아직 초기화되지 않았습니다.")},setText:t=>{n.current?n.current.setText(t):console.warn("Typing: 인스턴스가 아직 초기화되지 않았습니다.")},destroy:()=>{n.current&&(n.current.destroy(),n.current=null)}})),t.createElement("div",{ref:e,className:s.className,style:s.style})});o.displayName="Typing",exports.default=o;
|
|
@@ -16,6 +16,5 @@ export { Typing } from './core/index.js';
|
|
|
16
16
|
export type { TypingOptions } from './core/index.js';
|
|
17
17
|
export { ScrollFadeIn } from './core/index.js';
|
|
18
18
|
export type { ScrollFadeInOptions } from './core/index.js';
|
|
19
|
-
export { easingFunctions as scrollFadeInEasingFunctions } from './core/index.js';
|
|
20
19
|
export { default } from './core/index.js';
|
|
21
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3F,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3F,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t,{useRef as s,useEffect as i}from"react";class e{constructor(t,s={}){this.container=t,this.options={threshold:s.threshold??.1,rootMargin:s.rootMargin??"0px",onVisible:s.onVisible,onHidden:s.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const s of t)s.target===this.container&&(s.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}function
|
|
1
|
+
import t,{useRef as s,useEffect as i}from"react";class e{constructor(t,s={}){this.container=t,this.options={threshold:s.threshold??.1,rootMargin:s.rootMargin??"0px",root:s.root??null,onVisible:s.onVisible,onHidden:s.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const s of t)s.target===this.container&&(s.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin,root:this.options.root||null}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}function n(t){const s=t.charCodeAt(0);if(s<44032||s>55203)return[t];const i=s-44032,e=Math.floor(i/588),n=Math.floor(i%588/28),h=i%28,o=[];return o.push(["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"][e]),o.push(["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"][n]),h>0&&o.push(["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"][h]),o}function h(t,s,i){const e=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"].indexOf(t),n=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"].indexOf(s),h=i?["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"].indexOf(i):0;if(-1===e||-1===n)return t+(s||"")+(i||"");const o=44032+21*e*28+28*n+h;return String.fromCharCode(o)}function o(t){const s=[],i=[];for(let e=0;e<t.length;e++){const h=t[e],o=h.charCodeAt(0),r=s.length;if(o>=44032&&o<=55203){const t=n(h);s.push(...t),i.push({start:r,end:s.length,isHangul:!0})}else s.push(h),i.push({start:r,end:s.length,isHangul:!1})}return{units:s,charUnitRanges:i}}class r{constructor(t,s){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.originalText=s.text,this.config={text:s.text,speed:s.speed??50,delay:s.delay??0,enabled:s.enabled??!0,threshold:s.threshold??.2,rootMargin:s.rootMargin??"0px 0px -100px 0px",triggerOnce:s.triggerOnce??!1,showCursor:s.showCursor??!0,cursorChar:s.cursorChar??"|",onUpdate:s.onUpdate||null,onComplete:s.onComplete||null};const i=o(this.config.text);this.textUnits=i.units,this.charUnitRanges=i.charUnitRanges,this.currentIndex=0,this.displayedText="",this.timeoutId=null,this.visibilityManager=null,this.isRunning=!1,this.hasTriggered=!1,this.init()}init(){this.updateDisplay(""),this.injectStyles(),this.setupVisibilityManager()}injectStyles(){if(document.getElementById("masoneffect-typing-styles"))return;const t=document.createElement("style");t.id="masoneffect-typing-styles",t.textContent="\n .typing-char {\n transition: opacity 0.2s ease-in;\n display: inline-block;\n }\n .typing-cursor {\n display: inline-block;\n }\n ",document.head.appendChild(t)}setupVisibilityManager(){this.visibilityManager=new e(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,onVisible:()=>{!this.hasTriggered&&this.config.enabled&&(this.hasTriggered=!0,setTimeout(()=>this.start(),this.config.delay))},onHidden:()=>{}})}buildTextFromUnits(t){if(0===t)return"";let s="";for(let i=0;i<this.charUnitRanges.length;i++){const e=this.charUnitRanges[i];if(e.start>=t)break;const n=Math.min(t-e.start,e.end-e.start);if(n<=0)break;if(e.isHangul){const t=this.textUnits.slice(e.start,e.start+n);1===t.length?s+=t[0]:2===t.length?s+=h(t[0],t[1]):t.length>=3&&(s+=h(t[0],t[1],t[2]))}else n>0&&(s+=this.textUnits[e.start])}return s}start(){this.isRunning||(this.isRunning=!0,this.currentIndex=0,this.displayedText="",this.typeNext())}typeNext(){if(this.currentIndex>=this.textUnits.length)return this.isRunning=!1,this.config.showCursor&&this.updateDisplay(this.originalText),void(this.config.onComplete&&this.config.onComplete());this.displayedText=this.buildTextFromUnits(this.currentIndex+1);let t=this.displayedText;this.config.showCursor&&(t+=this.config.cursorChar),this.updateDisplay(t),this.config.onUpdate&&this.config.onUpdate(this.displayedText),this.currentIndex++,this.timeoutId=setTimeout(()=>{this.typeNext()},this.config.speed)}stop(){this.isRunning=!1,this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}reset(){this.stop(),this.currentIndex=0,this.displayedText="",this.hasTriggered=!1,this.updateDisplay("")}updateDisplay(t){const s=t.replace(new RegExp(this.escapeHtml(this.config.cursorChar)+"$"),""),i=t.endsWith(this.config.cursorChar),e=(this.container.textContent||"").replace(new RegExp(this.config.cursorChar+"$"),"");let n="";for(let t=0;t<s.length;t++){const i=s[t];n+=t>=e.length?`<span class="typing-char typing-fade-in" style="opacity: 0;">${this.escapeHtml(i)}</span>`:`<span class="typing-char" style="opacity: 1;">${this.escapeHtml(i)}</span>`}i&&(n+=`<span class="typing-cursor">${this.escapeHtml(this.config.cursorChar)}</span>`),this.container.innerHTML=n;const h=this.container.querySelectorAll(".typing-fade-in");h.length>0&&requestAnimationFrame(()=>{h.forEach(t=>{t.style.opacity="1",t.classList.remove("typing-fade-in")})})}escapeHtml(t){const s=document.createElement("div");return s.textContent=t,s.innerHTML}setText(t){this.originalText=t,this.config.text=t;const s=o(t);this.textUnits=s.units,this.charUnitRanges=s.charUnitRanges,this.reset(),this.config.enabled&&setTimeout(()=>this.start(),this.config.delay)}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null)}}const l=t.forwardRef((e,n)=>{const h=s(null),o=s(null);return i(()=>{if(!h.current)return;if(o.current)return;const{className:t,style:s,text:i,speed:n,delay:l,enabled:c,threshold:u,rootMargin:a,triggerOnce:d,showCursor:p,cursorChar:y,onUpdate:f,onComplete:g}=e,m={text:i,speed:n,delay:l,enabled:c,threshold:u,rootMargin:a,triggerOnce:d,showCursor:p,cursorChar:y,onUpdate:f,onComplete:g};return o.current=new r(h.current,m),()=>{o.current&&(o.current.destroy(),o.current=null)}},[]),i(()=>{if(!o.current)return;const{text:t,speed:s,delay:i,enabled:n,threshold:h,rootMargin:r,triggerOnce:l,showCursor:c,cursorChar:u,onUpdate:a,onComplete:d}=e;void 0!==t&&t!==o.current.originalText&&o.current.setText(t)},[e.text,e.speed,e.delay,e.enabled,e.threshold,e.rootMargin,e.triggerOnce,e.showCursor,e.cursorChar,e.onUpdate,e.onComplete]),t.useImperativeHandle(n,()=>({start:()=>{o.current?o.current.start():console.warn("Typing: 인스턴스가 아직 초기화되지 않았습니다.")},stop:()=>{o.current?o.current.stop():console.warn("Typing: 인스턴스가 아직 초기화되지 않았습니다.")},reset:()=>{o.current?o.current.reset():console.warn("Typing: 인스턴스가 아직 초기화되지 않았습니다.")},setText:t=>{o.current?o.current.setText(t):console.warn("Typing: 인스턴스가 아직 초기화되지 않았습니다.")},destroy:()=>{o.current&&(o.current.destroy(),o.current=null)}})),t.createElement("div",{ref:h,className:e.className,style:e.style})});l.displayName="Typing";export{l as default};
|
|
@@ -10,7 +10,6 @@ export { default as Typing } from './typing/index.js';
|
|
|
10
10
|
export type { TypingRef, TypingOptions } from './typing/index.js';
|
|
11
11
|
export { default as ScrollFadeIn } from './scrollFadeIn/index.js';
|
|
12
12
|
export type { ScrollFadeInRef, ScrollFadeInOptions } from './scrollFadeIn/index.js';
|
|
13
|
-
export { easingFunctions as scrollFadeInEasingFunctions } from './scrollFadeIn/index.js';
|
|
14
13
|
export { default as MasonEffect } from './textToParticle/index.js';
|
|
15
14
|
export type { TextToParticleRef as MasonEffectRef, TextToParticleOptions as MasonEffectOptions } from './textToParticle/index.js';
|
|
16
15
|
export { default } from './textToParticle/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAG1F,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAG1F,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGpF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnE,YAAY,EAAE,iBAAiB,IAAI,cAAc,EAAE,qBAAqB,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAGlI,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default } from './ScrollFadeIn';
|
|
2
2
|
export type { ScrollFadeInRef } from './ScrollFadeIn';
|
|
3
3
|
export type { ScrollFadeInOptions } from '../../core/scrollFadeIn/index.js';
|
|
4
|
-
export { easingFunctions } from '../../core/scrollFadeIn/index.js';
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/react/scrollFadeIn/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/react/scrollFadeIn/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -16,7 +16,6 @@ export { Typing, default as TypingDefault } from './typing/index.js';
|
|
|
16
16
|
export type { TypingOptions } from './typing/index.js';
|
|
17
17
|
export { ScrollFadeIn, default as ScrollFadeInDefault } from './scrollFadeIn/index.js';
|
|
18
18
|
export type { ScrollFadeInOptions } from './scrollFadeIn/index.js';
|
|
19
|
-
export { easingFunctions as scrollFadeInEasingFunctions } from './scrollFadeIn/index.js';
|
|
20
19
|
export { TextToParticle as MasonEffect } from './textToParticle/index.js';
|
|
21
20
|
export type { TextToParticleOptions as MasonEffectOptions } from './textToParticle/index.js';
|
|
22
21
|
export { default } from './textToParticle/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC7F,YAAY,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGjF,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACrE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACvF,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC7F,YAAY,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGjF,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACrE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACvF,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,OAAO,EAAE,cAAc,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC1E,YAAY,EAAE,qBAAqB,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG7F,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -10,29 +10,22 @@ export interface ScrollFadeInOptions {
|
|
|
10
10
|
direction?: 'top' | 'right' | 'bottom' | 'left';
|
|
11
11
|
distance?: string;
|
|
12
12
|
duration?: number;
|
|
13
|
-
easing?: (t: number) => number;
|
|
14
13
|
threshold?: number;
|
|
15
14
|
rootMargin?: string;
|
|
15
|
+
root?: HTMLElement | null;
|
|
16
16
|
triggerOnce?: boolean;
|
|
17
17
|
enabled?: boolean;
|
|
18
18
|
onStart?: () => void;
|
|
19
19
|
onComplete?: () => void;
|
|
20
20
|
}
|
|
21
|
-
export declare const easingFunctions: {
|
|
22
|
-
linear: (t: number) => number;
|
|
23
|
-
easeInQuad: (t: number) => number;
|
|
24
|
-
easeOutQuad: (t: number) => number;
|
|
25
|
-
easeInOutQuad: (t: number) => number;
|
|
26
|
-
easeOutCubic: (t: number) => number;
|
|
27
|
-
easeInOutCubic: (t: number) => number;
|
|
28
|
-
};
|
|
29
21
|
export declare class ScrollFadeIn {
|
|
30
22
|
container: HTMLElement;
|
|
31
|
-
config: Required<Omit<ScrollFadeInOptions, 'onStart' | 'onComplete' | '
|
|
32
|
-
|
|
23
|
+
config: Required<Omit<ScrollFadeInOptions, 'onStart' | 'onComplete' | 'root'>> & {
|
|
24
|
+
root: HTMLElement | null;
|
|
33
25
|
onStart: ScrollFadeInOptions['onStart'];
|
|
34
26
|
onComplete: ScrollFadeInOptions['onComplete'];
|
|
35
27
|
};
|
|
28
|
+
private easing;
|
|
36
29
|
visibilityManager: VisibilityManager | null;
|
|
37
30
|
animationFrameId: number | null;
|
|
38
31
|
startTime: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/scrollFadeIn/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/scrollFadeIn/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAKD,qBAAa,YAAY;IACvB,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,mBAAmB,EAAE,SAAS,GAAG,YAAY,GAAG,MAAM,CAAC,CAAC,GAAG;QAC/E,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;QACzB,OAAO,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACxC,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;KAC/C,CAAC;IACF,OAAO,CAAC,MAAM,CAAwB;IACtC,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC5C,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;gBAEX,SAAS,EAAE,WAAW,GAAG,MAAM,EAAE,OAAO,GAAE,mBAAwB;IAwC9E,IAAI,IAAI,IAAI;IAiBZ,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAoCvC,kBAAkB,IAAI,IAAI;IAqC1B,sBAAsB,IAAI,IAAI;IA8B9B,KAAK,IAAI,IAAI;IAeb,OAAO,IAAI,IAAI;IAmDf,QAAQ,IAAI,IAAI;IAqBhB,KAAK,IAAI,IAAI;IAMb,IAAI,IAAI,IAAI;IASZ,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,IAAI;IAmC3D,OAAO,IAAI,IAAI;CAWhB;AAGD,eAAe,YAAY,CAAC"}
|
|
@@ -40,6 +40,7 @@ export declare class Typing {
|
|
|
40
40
|
originalText: string;
|
|
41
41
|
constructor(container: HTMLElement | string, options: TypingOptions);
|
|
42
42
|
init(): void;
|
|
43
|
+
private injectStyles;
|
|
43
44
|
setupVisibilityManager(): void;
|
|
44
45
|
private buildTextFromUnits;
|
|
45
46
|
start(): void;
|
|
@@ -47,6 +48,7 @@ export declare class Typing {
|
|
|
47
48
|
stop(): void;
|
|
48
49
|
reset(): void;
|
|
49
50
|
updateDisplay(text: string): void;
|
|
51
|
+
private escapeHtml;
|
|
50
52
|
setText(newText: string): void;
|
|
51
53
|
destroy(): void;
|
|
52
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/typing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAyFD,qBAAa,MAAM;IACjB,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,YAAY,CAAC,CAAC,GAAG;QACjE,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;QACpC,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;KACzC,CAAC;IACF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACzE,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,IAAI,CAAC;IAChD,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC5C,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;gBAET,SAAS,EAAE,WAAW,GAAG,MAAM,EAAE,OAAO,EAAE,aAAa;IA6CnE,IAAI,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/typing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAyFD,qBAAa,MAAM;IACjB,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,YAAY,CAAC,CAAC,GAAG;QACjE,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;QACpC,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;KACzC,CAAC;IACF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACzE,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,IAAI,CAAC;IAChD,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC5C,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;gBAET,SAAS,EAAE,WAAW,GAAG,MAAM,EAAE,OAAO,EAAE,aAAa;IA6CnE,IAAI,IAAI,IAAI;IAWZ,OAAO,CAAC,YAAY;IAoBpB,sBAAsB,IAAI,IAAI;IAmB9B,OAAO,CAAC,kBAAkB;IAgD1B,KAAK,IAAI,IAAI;IASb,QAAQ,IAAI,IAAI;IAuChB,IAAI,IAAI,IAAI;IAQZ,KAAK,IAAI,IAAI;IAQb,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IA8CjC,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAa9B,OAAO,IAAI,IAAI;CAOhB;AAGD,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visibilityManager.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/visibilityManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,oBAAoB,CAA8B;IAC1D,OAAO,CAAC,uBAAuB,CAAsB;IACrD,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,aAAa,CAAU;gBAEnB,SAAS,EAAE,WAAW,EAAE,OAAO,GAAE,wBAA6B;
|
|
1
|
+
{"version":3,"file":"visibilityManager.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/visibilityManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,oBAAoB,CAA8B;IAC1D,OAAO,CAAC,uBAAuB,CAAsB;IACrD,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,aAAa,CAAU;gBAEnB,SAAS,EAAE,WAAW,EAAE,OAAO,GAAE,wBAA6B;IAkB1E,OAAO,CAAC,yBAAyB;IAuCjC,OAAO,CAAC,mBAAmB;IA+B3B;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,IAAI;IAWlE;;OAEG;IACH,OAAO,IAAI,IAAI;CAUhB;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"t",{value:!0});class t{constructor(t,
|
|
1
|
+
Object.defineProperty(exports,"t",{value:!0});class t{constructor(t,i={}){this.container=t,this.options={threshold:i.threshold??.1,rootMargin:i.rootMargin??"0px",root:i.root??null,onVisible:i.onVisible,onHidden:i.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const i of t)i.target===this.container&&(i.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin,root:this.options.root||null}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}const i=t=>--t*t*t+1;class s{constructor(t,s={}){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.config={direction:s.direction??"bottom",distance:s.distance??"50px",duration:s.duration??800,threshold:s.threshold??.1,rootMargin:s.rootMargin??"0px",root:s.root??null,triggerOnce:s.triggerOnce??!1,enabled:s.enabled??!0,onStart:s.onStart||null,onComplete:s.onComplete||null},this.easing=i,this.visibilityManager=null,this.animationFrameId=null,this.startTime=null,this.isRunning=!1,this.hasTriggered=!1,this.initialTransform="",this.targetDistance=0,this.init()}init(){const t=window.getComputedStyle(this.container);this.initialTransform="none"!==t.transform?t.transform:this.container.style.transform||"",this.targetDistance=this.parseDistance(this.config.distance),this.setInitialPosition(),this.setupVisibilityManager()}parseDistance(t){const i=t.match(/^(-?\d+\.?\d*)(px|rem|em|%|vh|vw)$/);if(!i)return parseFloat(t)||50;const s=parseFloat(i[1]);switch(i[2]){case"px":default:return s;case"rem":case"em":return s*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16);case"%":const t=this.container.getBoundingClientRect();return s/100*("top"===this.config.direction||"bottom"===this.config.direction?t.height:t.width);case"vh":return s/100*window.innerHeight;case"vw":return s/100*window.innerWidth}}setInitialPosition(){let t=0,i=0;switch(this.config.direction){case"top":i=-this.targetDistance;break;case"right":t=this.targetDistance;break;case"bottom":i=this.targetDistance;break;case"left":t=-this.targetDistance}const s=this.initialTransform||"",h=`translate(${t}px, ${i}px)`;this.container.style.transform=s&&"none"!==s?`${h} ${s}`:h,this.container.style.opacity="0",this.container.style.transition="none"}setupVisibilityManager(){this.visibilityManager=new t(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,root:this.config.root,onVisible:()=>{this.config.enabled&&(this.config.triggerOnce&&this.hasTriggered||(this.hasTriggered=!0,this.start()))},onHidden:()=>{this.config.enabled&&(this.stop(),this.config.triggerOnce||(this.hasTriggered=!1),this.setInitialPosition())}})}start(){this.isRunning||(this.isRunning=!0,this.startTime=performance.now(),this.config.onStart&&this.config.onStart(),this.container.style.transition="none",this.animate())}animate(){if(!this.isRunning)return;const t=performance.now()-(this.startTime||0),i=Math.min(t/this.config.duration,1),s=this.easing(i);let h=0,e=0;switch(this.config.direction){case"top":e=-this.targetDistance*(1-s);break;case"right":h=this.targetDistance*(1-s);break;case"bottom":e=this.targetDistance*(1-s);break;case"left":h=-this.targetDistance*(1-s)}const n=this.initialTransform||"",o=`translate(${h}px, ${e}px)`;this.container.style.transform=n&&"none"!==n?`${o} ${n}`:o,this.container.style.opacity=String(s),i<1?this.animationFrameId=requestAnimationFrame(()=>this.animate()):this.complete()}complete(){this.isRunning=!1,this.initialTransform&&"none"!==this.initialTransform?this.container.style.transform=this.initialTransform:this.container.style.transform="",this.container.style.opacity="1",this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.config.onComplete&&this.config.onComplete()}reset(){this.stop(),this.hasTriggered=!1,this.setInitialPosition()}stop(){this.isRunning=!1,this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}updateConfig(t){const i=this.isRunning;this.stop(),this.config={...this.config,...t,onStart:t.onStart??this.config.onStart,onComplete:t.onComplete??this.config.onComplete},t.distance&&(this.targetDistance=this.parseDistance(this.config.distance)),this.setInitialPosition(),void 0===t.threshold&&void 0===t.rootMargin&&void 0===t.root||(this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.setupVisibilityManager()),i&&this.config.enabled&&this.start()}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.container.style.transform=this.initialTransform||"",this.container.style.opacity="",this.container.style.transition=""}}exports.ScrollFadeIn=s,exports.default=s;
|
|
@@ -16,6 +16,5 @@ export { Typing } from './core/index.js';
|
|
|
16
16
|
export type { TypingOptions } from './core/index.js';
|
|
17
17
|
export { ScrollFadeIn } from './core/index.js';
|
|
18
18
|
export type { ScrollFadeInOptions } from './core/index.js';
|
|
19
|
-
export { easingFunctions as scrollFadeInEasingFunctions } from './core/index.js';
|
|
20
19
|
export { default } from './core/index.js';
|
|
21
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3F,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3F,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
class t{constructor(t,i={}){this.container=t,this.options={threshold:i.threshold??.1,rootMargin:i.rootMargin??"0px",onVisible:i.onVisible,onHidden:i.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const i of t)i.target===this.container&&(i.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}const i=
|
|
1
|
+
class t{constructor(t,i={}){this.container=t,this.options={threshold:i.threshold??.1,rootMargin:i.rootMargin??"0px",root:i.root??null,onVisible:i.onVisible,onHidden:i.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const i of t)i.target===this.container&&(i.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin,root:this.options.root||null}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}const i=t=>--t*t*t+1;class s{constructor(t,s={}){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.config={direction:s.direction??"bottom",distance:s.distance??"50px",duration:s.duration??800,threshold:s.threshold??.1,rootMargin:s.rootMargin??"0px",root:s.root??null,triggerOnce:s.triggerOnce??!1,enabled:s.enabled??!0,onStart:s.onStart||null,onComplete:s.onComplete||null},this.easing=i,this.visibilityManager=null,this.animationFrameId=null,this.startTime=null,this.isRunning=!1,this.hasTriggered=!1,this.initialTransform="",this.targetDistance=0,this.init()}init(){const t=window.getComputedStyle(this.container);this.initialTransform="none"!==t.transform?t.transform:this.container.style.transform||"",this.targetDistance=this.parseDistance(this.config.distance),this.setInitialPosition(),this.setupVisibilityManager()}parseDistance(t){const i=t.match(/^(-?\d+\.?\d*)(px|rem|em|%|vh|vw)$/);if(!i)return parseFloat(t)||50;const s=parseFloat(i[1]);switch(i[2]){case"px":default:return s;case"rem":case"em":return s*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16);case"%":const t=this.container.getBoundingClientRect();return s/100*("top"===this.config.direction||"bottom"===this.config.direction?t.height:t.width);case"vh":return s/100*window.innerHeight;case"vw":return s/100*window.innerWidth}}setInitialPosition(){let t=0,i=0;switch(this.config.direction){case"top":i=-this.targetDistance;break;case"right":t=this.targetDistance;break;case"bottom":i=this.targetDistance;break;case"left":t=-this.targetDistance}const s=this.initialTransform||"",h=`translate(${t}px, ${i}px)`;this.container.style.transform=s&&"none"!==s?`${h} ${s}`:h,this.container.style.opacity="0",this.container.style.transition="none"}setupVisibilityManager(){this.visibilityManager=new t(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,root:this.config.root,onVisible:()=>{this.config.enabled&&(this.config.triggerOnce&&this.hasTriggered||(this.hasTriggered=!0,this.start()))},onHidden:()=>{this.config.enabled&&(this.stop(),this.config.triggerOnce||(this.hasTriggered=!1),this.setInitialPosition())}})}start(){this.isRunning||(this.isRunning=!0,this.startTime=performance.now(),this.config.onStart&&this.config.onStart(),this.container.style.transition="none",this.animate())}animate(){if(!this.isRunning)return;const t=performance.now()-(this.startTime||0),i=Math.min(t/this.config.duration,1),s=this.easing(i);let h=0,e=0;switch(this.config.direction){case"top":e=-this.targetDistance*(1-s);break;case"right":h=this.targetDistance*(1-s);break;case"bottom":e=this.targetDistance*(1-s);break;case"left":h=-this.targetDistance*(1-s)}const n=this.initialTransform||"",o=`translate(${h}px, ${e}px)`;this.container.style.transform=n&&"none"!==n?`${o} ${n}`:o,this.container.style.opacity=String(s),i<1?this.animationFrameId=requestAnimationFrame(()=>this.animate()):this.complete()}complete(){this.isRunning=!1,this.initialTransform&&"none"!==this.initialTransform?this.container.style.transform=this.initialTransform:this.container.style.transform="",this.container.style.opacity="1",this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.config.onComplete&&this.config.onComplete()}reset(){this.stop(),this.hasTriggered=!1,this.setInitialPosition()}stop(){this.isRunning=!1,this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}updateConfig(t){const i=this.isRunning;this.stop(),this.config={...this.config,...t,onStart:t.onStart??this.config.onStart,onComplete:t.onComplete??this.config.onComplete},t.distance&&(this.targetDistance=this.parseDistance(this.config.distance)),this.setInitialPosition(),void 0===t.threshold&&void 0===t.rootMargin&&void 0===t.root||(this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.setupVisibilityManager()),i&&this.config.enabled&&this.start()}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.container.style.transform=this.initialTransform||"",this.container.style.opacity="",this.container.style.transition=""}}export{s as ScrollFadeIn,s as default};
|
|
@@ -10,7 +10,6 @@ export { default as Typing } from './typing/index.js';
|
|
|
10
10
|
export type { TypingRef, TypingOptions } from './typing/index.js';
|
|
11
11
|
export { default as ScrollFadeIn } from './scrollFadeIn/index.js';
|
|
12
12
|
export type { ScrollFadeInRef, ScrollFadeInOptions } from './scrollFadeIn/index.js';
|
|
13
|
-
export { easingFunctions as scrollFadeInEasingFunctions } from './scrollFadeIn/index.js';
|
|
14
13
|
export { default as MasonEffect } from './textToParticle/index.js';
|
|
15
14
|
export type { TextToParticleRef as MasonEffectRef, TextToParticleOptions as MasonEffectOptions } from './textToParticle/index.js';
|
|
16
15
|
export { default } from './textToParticle/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAG1F,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAG1F,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGpF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnE,YAAY,EAAE,iBAAiB,IAAI,cAAc,EAAE,qBAAqB,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAGlI,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default } from './ScrollFadeIn';
|
|
2
2
|
export type { ScrollFadeInRef } from './ScrollFadeIn';
|
|
3
3
|
export type { ScrollFadeInOptions } from '../../core/scrollFadeIn/index.js';
|
|
4
|
-
export { easingFunctions } from '../../core/scrollFadeIn/index.js';
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react/scrollFadeIn/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react/scrollFadeIn/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=Object.defineProperty,e=(e,i,n)=>((e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n)(e,"symbol"!=typeof i?i+"":i,n);const i=require("svelte");function n(){}function s(t){return t()}function o(){return Object.create(null)}function r(t){t.forEach(s)}function a(t){return"function"==typeof t}function l(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function u(t){t.parentNode&&t.parentNode.removeChild(t)}function h(t,e,i){null==i?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}let c;function d(t){c=t}const g=[],p=[];let f=[];const b=[],m=Promise.resolve();let y=!1;function V(t){f.push(t)}const $=new Set;let v=0;function x(){if(0!==v)return;const t=c;do{try{for(;v<g.length;){const t=g[v];v++,d(t),O(t.$$)}}catch(e){throw g.length=0,v=0,e}for(d(null),g.length=0,v=0;p.length;)p.pop()();for(let t=0;t<f.length;t+=1){const e=f[t];$.has(e)||($.add(e),e())}f.length=0}while(g.length);for(;b.length;)b.pop()();y=!1,$.clear(),d(t)}function O(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(V)}}const M=new Set;function _(t,e){const i=t.$$;null!==i.fragment&&(!function(t){const e=[],i=[];f.forEach(n=>-1===t.indexOf(n)?e.push(n):i.push(n)),i.forEach(t=>t()),f=e}(i.after_update),r(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function C(t,e){-1===t.$$.dirty[0]&&(g.push(t),y||(y=!0,m.then(x)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function w(t,e,i,l,h,g,p=null,f=[-1]){const b=c;d(t);const m=t.$$={fragment:null,ctx:[],props:g,update:n,not_equal:h,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(b?b.$$.context:[])),callbacks:o(),dirty:f,skip_bound:!1,root:e.target||b.$$.root};p&&p(m.root);let y=!1;if(m.ctx=i?i(t,e.props||{},(e,i,...n)=>{const s=n.length?n[0]:i;return m.ctx&&h(m.ctx[e],m.ctx[e]=s)&&(!m.skip_bound&&m.bound[e]&&m.bound[e](s),y&&C(t,e)),i}):[],m.update(),y=!0,r(m.before_update),m.fragment=!!l&&l(m.ctx),e.target){if(e.hydrate){const t=(O=e.target,Array.from(O.childNodes));m.fragment&&m.fragment.l(t),t.forEach(u)}else m.fragment&&m.fragment.c();e.intro&&(($=t.$$.fragment)&&$.i&&(M.delete($),$.i(v))),function(t,e,i){const{fragment:n,after_update:o}=t.$$;n&&n.m(e,i),V(()=>{const e=t.$$.on_mount.map(s).filter(a);t.$$.on_destroy?t.$$.on_destroy.push(...e):r(e),t.$$.on_mount=[]}),o.forEach(V)}(t,e.target,e.anchor),x()}var $,v,O;d(b)}class H{constructor(){e(this,"$$"),e(this,"$$set")}$destroy(){_(this,1),this.$destroy=n}$on(t,e){if(!a(e))return n;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(e),()=>{const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class I{constructor(t,e={}){this.container=t,this.options={threshold:e.threshold??.1,rootMargin:e.rootMargin??"0px",onVisible:e.onVisible,onHidden:e.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const e of t)e.target===this.container&&(e.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}const E={linear:t=>t};class P{constructor(t,e){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.config={targetValue:e.targetValue,duration:e.duration??2e3,startValue:e.startValue??0,enabled:e.enabled??!0,easing:e.easing??E.linear,threshold:e.threshold??.2,rootMargin:e.rootMargin??"0px 0px -100px 0px",triggerOnce:e.triggerOnce??!1,onUpdate:e.onUpdate||null,onComplete:e.onComplete||null},this.currentValue=this.config.startValue,this.startTime=null,this.animationFrameId=null,this.visibilityManager=null,this.isRunning=!1,this.hasTriggered=!1,this.init()}init(){this.updateDisplay(this.config.startValue),this.setupVisibilityManager()}setupVisibilityManager(){this.visibilityManager=new I(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,onVisible:()=>{!this.hasTriggered&&this.config.enabled&&(this.hasTriggered=!0,this.start())},onHidden:()=>{!this.config.triggerOnce&&this.isRunning&&this.reset()}})}start(){if(this.isRunning)return;if(!this.config.enabled)return;this.isRunning=!0,this.startTime=null,this.currentValue=this.config.startValue,this.updateDisplay(this.currentValue);const t=e=>{null===this.startTime&&(this.startTime=e);const i=e-this.startTime,n=Math.min(i/this.config.duration,1),s=this.config.easing(n);this.currentValue=Math.floor(this.config.startValue+(this.config.targetValue-this.config.startValue)*s),this.updateDisplay(this.currentValue),this.config.onUpdate&&this.config.onUpdate(this.currentValue),n<1?this.animationFrameId=requestAnimationFrame(t):(this.currentValue=this.config.targetValue,this.updateDisplay(this.currentValue),this.isRunning=!1,this.config.onComplete&&this.config.onComplete())};this.animationFrameId=requestAnimationFrame(t)}stop(){this.isRunning=!1,null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}reset(){this.stop(),this.currentValue=this.config.startValue,this.updateDisplay(this.currentValue),this.hasTriggered=!1,this.startTime=null}updateDisplay(t){this.container.textContent=this.formatNumber(t)}formatNumber(t){return Math.floor(t).toLocaleString()}updateConfig(t){const e=this.isRunning;this.stop(),this.config={...this.config,...t,onUpdate:void 0!==t.onUpdate?t.onUpdate:this.config.onUpdate,onComplete:void 0!==t.onComplete?t.onComplete:this.config.onComplete},void 0!==t.targetValue?(this.reset(),e&&this.config.enabled&&this.start()):e&&this.config.enabled&&this.start()}getValue(){return this.currentValue}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null)}}function T(t){let e;return{c(){var i;i="div",e=document.createElement(i),h(e,"class",t[0]),h(e,"style",t[1])},m(i,n){!function(t,e,i){t.insertBefore(e,i||null)}(i,e,n),t[18](e)},p(t,[i]){1&i&&h(e,"class",t[0]),2&i&&h(e,"style",t[1])},i:n,o:n,d(i){i&&u(e),t[18](null)}}}function U(t,e,n){let{targetValue:s=0}=e,{duration:o=2e3}=e,{startValue:r=0}=e,{enabled:a=!0}=e,{easing:l=t=>t}=e,{threshold:u=.2}=e,{rootMargin:h="0px 0px -100px 0px"}=e,{triggerOnce:c=!1}=e,{className:d=""}=e,{style:g={}}=e;const f=i.createEventDispatcher();let b,m=null;return i.onMount(()=>{if(!b)return;n(17,m=new P(b,{targetValue:s,duration:o,startValue:r,enabled:a,easing:l,threshold:u,rootMargin:h,triggerOnce:c,onUpdate:t=>{f("update",t)},onComplete:()=>{f("complete")}}))}),i.onDestroy(()=>{m&&(m.destroy(),n(17,m=null))}),t.$$set=t=>{"targetValue"in t&&n(3,s=t.targetValue),"duration"in t&&n(4,o=t.duration),"startValue"in t&&n(5,r=t.startValue),"enabled"in t&&n(6,a=t.enabled),"easing"in t&&n(7,l=t.easing),"threshold"in t&&n(8,u=t.threshold),"rootMargin"in t&&n(9,h=t.rootMargin),"triggerOnce"in t&&n(10,c=t.triggerOnce),"className"in t&&n(0,d=t.className),"style"in t&&n(1,g=t.style)},t.$$.update=()=>{133112&t.$$.dirty&&m&&m.updateConfig({targetValue:s,duration:o,startValue:r,enabled:a,easing:l,threshold:u,rootMargin:h,triggerOnce:c,onUpdate:t=>{f("update",t)},onComplete:()=>{f("complete")}})},[d,g,b,s,o,r,a,l,u,h,c,function(){m&&m.start()},function(){m&&m.stop()},function(){m&&m.reset()},function(){return m?m.getValue():0},function(t){m&&m.updateConfig(t)},function(){m&&(m.destroy(),n(17,m=null))},m,function(t){p[t?"unshift":"push"](()=>{b=t,n(2,b)})}]}module.exports=class extends H{constructor(t){super(),w(this,t,U,T,l,{targetValue:3,duration:4,startValue:5,enabled:6,easing:7,threshold:8,rootMargin:9,triggerOnce:10,className:0,style:1,start:11,stop:12,reset:13,getValue:14,updateConfig:15,destroy:16})}get start(){return this.$$.ctx[11]}get stop(){return this.$$.ctx[12]}get reset(){return this.$$.ctx[13]}get getValue(){return this.$$.ctx[14]}get updateConfig(){return this.$$.ctx[15]}get destroy(){return this.$$.ctx[16]}};
|
|
1
|
+
"use strict";var t=Object.defineProperty,e=(e,i,n)=>((e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n)(e,"symbol"!=typeof i?i+"":i,n);const i=require("svelte");function n(){}function s(t){return t()}function o(){return Object.create(null)}function r(t){t.forEach(s)}function a(t){return"function"==typeof t}function l(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function u(t){t.parentNode&&t.parentNode.removeChild(t)}function h(t,e,i){null==i?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}let c;function d(t){c=t}const g=[],p=[];let f=[];const b=[],m=Promise.resolve();let y=!1;function V(t){f.push(t)}const $=new Set;let v=0;function x(){if(0!==v)return;const t=c;do{try{for(;v<g.length;){const t=g[v];v++,d(t),O(t.$$)}}catch(e){throw g.length=0,v=0,e}for(d(null),g.length=0,v=0;p.length;)p.pop()();for(let t=0;t<f.length;t+=1){const e=f[t];$.has(e)||($.add(e),e())}f.length=0}while(g.length);for(;b.length;)b.pop()();y=!1,$.clear(),d(t)}function O(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(V)}}const M=new Set;function _(t,e){const i=t.$$;null!==i.fragment&&(!function(t){const e=[],i=[];f.forEach(n=>-1===t.indexOf(n)?e.push(n):i.push(n)),i.forEach(t=>t()),f=e}(i.after_update),r(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function C(t,e){-1===t.$$.dirty[0]&&(g.push(t),y||(y=!0,m.then(x)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function w(t,e,i,l,h,g,p=null,f=[-1]){const b=c;d(t);const m=t.$$={fragment:null,ctx:[],props:g,update:n,not_equal:h,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(b?b.$$.context:[])),callbacks:o(),dirty:f,skip_bound:!1,root:e.target||b.$$.root};p&&p(m.root);let y=!1;if(m.ctx=i?i(t,e.props||{},(e,i,...n)=>{const s=n.length?n[0]:i;return m.ctx&&h(m.ctx[e],m.ctx[e]=s)&&(!m.skip_bound&&m.bound[e]&&m.bound[e](s),y&&C(t,e)),i}):[],m.update(),y=!0,r(m.before_update),m.fragment=!!l&&l(m.ctx),e.target){if(e.hydrate){const t=(O=e.target,Array.from(O.childNodes));m.fragment&&m.fragment.l(t),t.forEach(u)}else m.fragment&&m.fragment.c();e.intro&&(($=t.$$.fragment)&&$.i&&(M.delete($),$.i(v))),function(t,e,i){const{fragment:n,after_update:o}=t.$$;n&&n.m(e,i),V(()=>{const e=t.$$.on_mount.map(s).filter(a);t.$$.on_destroy?t.$$.on_destroy.push(...e):r(e),t.$$.on_mount=[]}),o.forEach(V)}(t,e.target,e.anchor),x()}var $,v,O;d(b)}class H{constructor(){e(this,"$$"),e(this,"$$set")}$destroy(){_(this,1),this.$destroy=n}$on(t,e){if(!a(e))return n;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(e),()=>{const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class I{constructor(t,e={}){this.container=t,this.options={threshold:e.threshold??.1,rootMargin:e.rootMargin??"0px",root:e.root??null,onVisible:e.onVisible,onHidden:e.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const e of t)e.target===this.container&&(e.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin,root:this.options.root||null}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}const E={linear:t=>t};class P{constructor(t,e){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.config={targetValue:e.targetValue,duration:e.duration??2e3,startValue:e.startValue??0,enabled:e.enabled??!0,easing:e.easing??E.linear,threshold:e.threshold??.2,rootMargin:e.rootMargin??"0px 0px -100px 0px",triggerOnce:e.triggerOnce??!1,onUpdate:e.onUpdate||null,onComplete:e.onComplete||null},this.currentValue=this.config.startValue,this.startTime=null,this.animationFrameId=null,this.visibilityManager=null,this.isRunning=!1,this.hasTriggered=!1,this.init()}init(){this.updateDisplay(this.config.startValue),this.setupVisibilityManager()}setupVisibilityManager(){this.visibilityManager=new I(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,onVisible:()=>{!this.hasTriggered&&this.config.enabled&&(this.hasTriggered=!0,this.start())},onHidden:()=>{!this.config.triggerOnce&&this.isRunning&&this.reset()}})}start(){if(this.isRunning)return;if(!this.config.enabled)return;this.isRunning=!0,this.startTime=null,this.currentValue=this.config.startValue,this.updateDisplay(this.currentValue);const t=e=>{null===this.startTime&&(this.startTime=e);const i=e-this.startTime,n=Math.min(i/this.config.duration,1),s=this.config.easing(n);this.currentValue=Math.floor(this.config.startValue+(this.config.targetValue-this.config.startValue)*s),this.updateDisplay(this.currentValue),this.config.onUpdate&&this.config.onUpdate(this.currentValue),n<1?this.animationFrameId=requestAnimationFrame(t):(this.currentValue=this.config.targetValue,this.updateDisplay(this.currentValue),this.isRunning=!1,this.config.onComplete&&this.config.onComplete())};this.animationFrameId=requestAnimationFrame(t)}stop(){this.isRunning=!1,null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}reset(){this.stop(),this.currentValue=this.config.startValue,this.updateDisplay(this.currentValue),this.hasTriggered=!1,this.startTime=null}updateDisplay(t){this.container.textContent=this.formatNumber(t)}formatNumber(t){return Math.floor(t).toLocaleString()}updateConfig(t){const e=this.isRunning;this.stop(),this.config={...this.config,...t,onUpdate:void 0!==t.onUpdate?t.onUpdate:this.config.onUpdate,onComplete:void 0!==t.onComplete?t.onComplete:this.config.onComplete},void 0!==t.targetValue?(this.reset(),e&&this.config.enabled&&this.start()):e&&this.config.enabled&&this.start()}getValue(){return this.currentValue}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null)}}function T(t){let e;return{c(){var i;i="div",e=document.createElement(i),h(e,"class",t[0]),h(e,"style",t[1])},m(i,n){!function(t,e,i){t.insertBefore(e,i||null)}(i,e,n),t[18](e)},p(t,[i]){1&i&&h(e,"class",t[0]),2&i&&h(e,"style",t[1])},i:n,o:n,d(i){i&&u(e),t[18](null)}}}function U(t,e,n){let{targetValue:s=0}=e,{duration:o=2e3}=e,{startValue:r=0}=e,{enabled:a=!0}=e,{easing:l=t=>t}=e,{threshold:u=.2}=e,{rootMargin:h="0px 0px -100px 0px"}=e,{triggerOnce:c=!1}=e,{className:d=""}=e,{style:g={}}=e;const f=i.createEventDispatcher();let b,m=null;return i.onMount(()=>{if(!b)return;n(17,m=new P(b,{targetValue:s,duration:o,startValue:r,enabled:a,easing:l,threshold:u,rootMargin:h,triggerOnce:c,onUpdate:t=>{f("update",t)},onComplete:()=>{f("complete")}}))}),i.onDestroy(()=>{m&&(m.destroy(),n(17,m=null))}),t.$$set=t=>{"targetValue"in t&&n(3,s=t.targetValue),"duration"in t&&n(4,o=t.duration),"startValue"in t&&n(5,r=t.startValue),"enabled"in t&&n(6,a=t.enabled),"easing"in t&&n(7,l=t.easing),"threshold"in t&&n(8,u=t.threshold),"rootMargin"in t&&n(9,h=t.rootMargin),"triggerOnce"in t&&n(10,c=t.triggerOnce),"className"in t&&n(0,d=t.className),"style"in t&&n(1,g=t.style)},t.$$.update=()=>{133112&t.$$.dirty&&m&&m.updateConfig({targetValue:s,duration:o,startValue:r,enabled:a,easing:l,threshold:u,rootMargin:h,triggerOnce:c,onUpdate:t=>{f("update",t)},onComplete:()=>{f("complete")}})},[d,g,b,s,o,r,a,l,u,h,c,function(){m&&m.start()},function(){m&&m.stop()},function(){m&&m.reset()},function(){return m?m.getValue():0},function(t){m&&m.updateConfig(t)},function(){m&&(m.destroy(),n(17,m=null))},m,function(t){p[t?"unshift":"push"](()=>{b=t,n(2,b)})}]}module.exports=class extends H{constructor(t){super(),w(this,t,U,T,l,{targetValue:3,duration:4,startValue:5,enabled:6,easing:7,threshold:8,rootMargin:9,triggerOnce:10,className:0,style:1,start:11,stop:12,reset:13,getValue:14,updateConfig:15,destroy:16})}get start(){return this.$$.ctx[11]}get stop(){return this.$$.ctx[12]}get reset(){return this.$$.ctx[13]}get getValue(){return this.$$.ctx[14]}get updateConfig(){return this.$$.ctx[15]}get destroy(){return this.$$.ctx[16]}};
|
|
@@ -36,15 +36,13 @@ export declare interface CountOptions {
|
|
|
36
36
|
onComplete?: () => void;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
declare const easingFunctions: {
|
|
39
|
+
export declare const easingFunctions: {
|
|
40
40
|
linear: (t: number) => number;
|
|
41
41
|
easeInQuad: (t: number) => number;
|
|
42
42
|
easeOutQuad: (t: number) => number;
|
|
43
43
|
easeInOutQuad: (t: number) => number;
|
|
44
44
|
easeOutCubic: (t: number) => number;
|
|
45
45
|
};
|
|
46
|
-
export { easingFunctions }
|
|
47
|
-
export { easingFunctions as scrollFadeInEasingFunctions }
|
|
48
46
|
|
|
49
47
|
export declare interface Particle {
|
|
50
48
|
x: number;
|
|
@@ -60,11 +58,12 @@ export declare interface Particle {
|
|
|
60
58
|
|
|
61
59
|
export declare class ScrollFadeIn {
|
|
62
60
|
container: HTMLElement;
|
|
63
|
-
config: Required<Omit<ScrollFadeInOptions, 'onStart' | 'onComplete' | '
|
|
64
|
-
|
|
61
|
+
config: Required<Omit<ScrollFadeInOptions, 'onStart' | 'onComplete' | 'root'>> & {
|
|
62
|
+
root: HTMLElement | null;
|
|
65
63
|
onStart: ScrollFadeInOptions['onStart'];
|
|
66
64
|
onComplete: ScrollFadeInOptions['onComplete'];
|
|
67
65
|
};
|
|
66
|
+
private easing;
|
|
68
67
|
visibilityManager: VisibilityManager | null;
|
|
69
68
|
animationFrameId: number | null;
|
|
70
69
|
startTime: number | null;
|
|
@@ -90,9 +89,9 @@ export declare interface ScrollFadeInOptions {
|
|
|
90
89
|
direction?: 'top' | 'right' | 'bottom' | 'left';
|
|
91
90
|
distance?: string;
|
|
92
91
|
duration?: number;
|
|
93
|
-
easing?: (t: number) => number;
|
|
94
92
|
threshold?: number;
|
|
95
93
|
rootMargin?: string;
|
|
94
|
+
root?: HTMLElement | null;
|
|
96
95
|
triggerOnce?: boolean;
|
|
97
96
|
enabled?: boolean;
|
|
98
97
|
onStart?: () => void;
|
|
@@ -209,6 +208,7 @@ declare class TextToParticle {
|
|
|
209
208
|
originalText: string;
|
|
210
209
|
constructor(container: HTMLElement | string, options: TypingOptions);
|
|
211
210
|
init(): void;
|
|
211
|
+
private injectStyles;
|
|
212
212
|
setupVisibilityManager(): void;
|
|
213
213
|
private buildTextFromUnits;
|
|
214
214
|
start(): void;
|
|
@@ -216,6 +216,7 @@ declare class TextToParticle {
|
|
|
216
216
|
stop(): void;
|
|
217
217
|
reset(): void;
|
|
218
218
|
updateDisplay(text: string): void;
|
|
219
|
+
private escapeHtml;
|
|
219
220
|
setText(newText: string): void;
|
|
220
221
|
destroy(): void;
|
|
221
222
|
}
|
|
@@ -265,6 +266,7 @@ declare class TextToParticle {
|
|
|
265
266
|
declare interface VisibilityManagerOptions {
|
|
266
267
|
threshold?: number;
|
|
267
268
|
rootMargin?: string;
|
|
269
|
+
root?: HTMLElement | null;
|
|
268
270
|
onVisible?: () => void;
|
|
269
271
|
onHidden?: () => void;
|
|
270
272
|
}
|
|
@@ -269,6 +269,8 @@ class VisibilityManager {
|
|
|
269
269
|
this.options = {
|
|
270
270
|
threshold: options.threshold ?? 0.1,
|
|
271
271
|
rootMargin: options.rootMargin ?? "0px",
|
|
272
|
+
root: options.root ?? null,
|
|
273
|
+
// 기본값은 null (viewport 기준)
|
|
272
274
|
onVisible: options.onVisible,
|
|
273
275
|
onHidden: options.onHidden
|
|
274
276
|
};
|
|
@@ -306,7 +308,9 @@ class VisibilityManager {
|
|
|
306
308
|
},
|
|
307
309
|
{
|
|
308
310
|
threshold: this.options.threshold,
|
|
309
|
-
rootMargin: this.options.rootMargin
|
|
311
|
+
rootMargin: this.options.rootMargin,
|
|
312
|
+
root: this.options.root || null
|
|
313
|
+
// null이면 viewport 기준, HTMLElement면 해당 요소 기준
|
|
310
314
|
}
|
|
311
315
|
);
|
|
312
316
|
this.intersectionObserver.observe(this.container);
|