@ndgmnt/client--nudgemoment 0.0.19 → 0.0.20
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/dist/index.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
* @license
|
3
|
-
* NudgeMoment v0.0.
|
3
|
+
* NudgeMoment v0.0.19
|
4
4
|
* Copyright (c) 2025 NudgeMoment. All Rights Reserved.
|
5
5
|
*
|
6
6
|
* This source code is licensed under a proprietary license (All Rights Reserved).
|
@@ -46,8 +46,8 @@
|
|
46
46
|
</div>
|
47
47
|
</div>
|
48
48
|
`,n=document.querySelector(`.${e}`);if(n){let s=function(){let r=n.querySelector(".NDGMNT__mobile-hero-section__tooltip-wrapper");r.classList.remove("NDGMNT__mobile-hero-section__tooltip--bounce"),setTimeout(()=>{r.classList.add("NDGMNT__mobile-hero-section__tooltip--bounce")},100)};var i=s;n.style.position="relative",n.insertAdjacentHTML("beforeend",t),setInterval(s,1e4)}}x(()=>{Ho()});var Go={ANIMATE:"animate"},Wo={CANCEL:".cancel-line"};function qo(){let e=document.querySelectorAll(Wo.CANCEL),t=e[0];K(t,n=>{n.isIntersecting&&e.forEach((i,s)=>{setTimeout(()=>{i.classList.add(Go.ANIMATE)},s*1e3)})},{margin:"-40% 0px -40% 0px"})}x(()=>{qo()});var Ni={BLUR:".NDGMNT__strong-blur"};function Ko(){let e=Ni.BLUR;K(e,()=>{let t=document.querySelector(e);P(!t,`${Ni.BLUR} \uC120\uD0DD\uC790\uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4`),t.style.filter="blur(0px)"},{margin:"-50% 0px -30% 0px"})}x(()=>{Ko()});var Wt=class{constructor(t={}){this.text=t.text||"Default text for animation",this.container=document.getElementById("text-content"),this.words=this.text.split(""),this.init(),this.setupScrollHandler()}init(){let t=this.text.split(`
|
49
|
-
`);this.totalCharCount=0,t.forEach((n,i)=>{let s=Array.from(n);this.totalCharCount+=s.length;let r=document.createElement("span");r.className="word-container";let o=document.createElement("span");o.className="word-shadow";let a=document.createElement("span");a.className="word-reveal",s.forEach((l,c)=>{let u=document.createElement("span");u.textContent=l,u.style.opacity="0",u.dataset.index=String(this.totalCharCount-s.length+c),a.appendChild(u);let h=document.createElement("span");h.textContent=l,o.appendChild(h)}),r.appendChild(o),r.appendChild(a),this.container.appendChild(r),i<t.length-1&&this.container.appendChild(document.createElement("br"))})}setupScrollHandler(){window.addEventListener("scroll",()=>{requestAnimationFrame(()=>this.handleScroll())})}handleScroll(){let n=document.getElementById("text-reveal-container").getBoundingClientRect(),i=window.innerHeight/2,s=n.top+n.height/2,r=Math.max(0,Math.min(1,(i-s)/(i/2)));document.querySelectorAll(".word-reveal span").forEach(a=>{let c=parseInt(a.dataset.index)/this.totalCharCount,u=this.totalCharCount/2,h=Math.max(0,Math.min(1,(r-c)*u));B(a,{opacity:h},{duration:.4,ease:"easeOut"})})}};x(()=>{new Wt({text:`\uACE0\uAC1D\uC758 \uC2DC\uC120\uC774 \uBA38\uBB34\uB294 \uD648\uD398\uC774\uC9C0 \uC81C\uC791\uC744 \uC704\uD574
|
50
|
-
\uC5B4\uB5BB\uAC8C \uB9CC\uB4E4\uC5B4\uC57C \uD560\uAE4C\uC694?`})});var Di={CONTAINER:"scratch-container"},qt=class{constructor(t={}){A(this,"width");A(this,"height");A(this,"minScratchPercentage");A(this,"gradientColors");A(this,"canvas");A(this,"container");A(this,"ctx");A(this,"onComplete");A(this,"isScratching");A(this,"isComplete");this.width=t.width||300,this.height=t.height||300,this.minScratchPercentage=t.minScratchPercentage||50,this.gradientColors=t.gradientColors||["#A97CF8","#F38CB8","#FDCC92"],this.onComplete=t.onComplete||(()=>{});let n=document.getElementById("scratch-canvas");P(!(n instanceof HTMLCanvasElement),"Canvas \uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."),this.canvas=n;let i=document.getElementById(Di.CONTAINER);P(!i,`${Di.CONTAINER}\uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.`),this.container=i;let s=this.canvas.getContext("2d");P(!s,"2D Context\uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."),this.ctx=s,this.isScratching=!1,this.isComplete=!1,this.onComplete=()=>{let r=document.querySelector("#content");r instanceof HTMLElement&&(r.style.filter="blur(0)",r.style.color="rgba(0,0,0,1)",r.style.zIndex="10"),t.onComplete&&t.onComplete()},this.init(),this.setupEventListeners()}init(){this.canvas.width=this.width,this.canvas.height=this.height,this.container.style.width=`${this.width}px`,this.container.style.height=`${this.height}px`,this.ctx.fillStyle="#ccc",this.ctx.fillRect(0,0,this.width,this.height);let t=this.ctx.createLinearGradient(0,0,this.width,this.height);t.addColorStop(0,this.gradientColors[0]),t.addColorStop(.5,this.gradientColors[1]),t.addColorStop(1,this.gradientColors[2]),this.ctx.fillStyle=t,this.ctx.fillRect(0,0,this.width,this.height);let n=document.querySelector("#content");n instanceof HTMLElement&&(n.style.visibility="visible")}setupEventListeners(){this.canvas.addEventListener("mousedown",()=>this.isScratching=!0),this.canvas.addEventListener("touchstart",t=>{this.isScratching=!0,t.preventDefault()}),document.addEventListener("mousemove",t=>this.handleScratch(t)),document.addEventListener("touchmove",t=>this.handleScratch(t.touches[0])),document.addEventListener("mouseup",()=>this.handleScratchEnd()),document.addEventListener("touchend",()=>this.handleScratchEnd()),document.addEventListener("touchcancel",()=>this.handleScratchEnd())}handleScratch(t){if(!this.isScratching)return;let n=this.canvas.getBoundingClientRect(),i=t.clientX-n.left+16,s=t.clientY-n.top+16;this.ctx.globalCompositeOperation="destination-out",this.ctx.beginPath(),this.ctx.arc(i,s,30,0,Math.PI*2),this.ctx.fill()}handleScratchEnd(){this.isScratching&&(this.isScratching=!1,this.checkCompletion())}checkCompletion(){if(this.isComplete)return;let n=this.ctx.getImageData(0,0,this.width,this.height).data,i=n.length/4,s=0;for(let o=3;o<n.length;o+=4)n[o]===0&&s++;s/i*100>=this.minScratchPercentage&&(this.isComplete=!0,this.ctx.clearRect(0,0,this.width,this.height),this.startAnimation())}async startAnimation(){await B(this.container,{scale:[.95,1]},{duration:.4,ease:"easeOut"}),this.onComplete()}};x(()=>{let e=new qt({width:300,height:300,minScratchPercentage:20,gradientColors:["#FFF1E6","#FD9A36","#FFBD6F"]})});var $o="details.NDGMNT__faq-section__details summary h2",Uo="NDGMNT__faq-section__toggle-svg";function zo(){$($o).after(`
|
49
|
+
`);this.totalCharCount=0,t.forEach((n,i)=>{let s=Array.from(n);this.totalCharCount+=s.length;let r=document.createElement("span");r.className="word-container";let o=document.createElement("span");o.className="word-shadow";let a=document.createElement("span");a.className="word-reveal",s.forEach((l,c)=>{let u=document.createElement("span");u.textContent=l,u.style.opacity="0",u.dataset.index=String(this.totalCharCount-s.length+c),a.appendChild(u);let h=document.createElement("span");h.textContent=l,o.appendChild(h)}),r.appendChild(o),r.appendChild(a),this.container.appendChild(r),i<t.length-1&&this.container.appendChild(document.createElement("br"))})}setupScrollHandler(){window.addEventListener("scroll",()=>{requestAnimationFrame(()=>this.handleScroll())})}handleScroll(){let n=document.getElementById("text-reveal-container").getBoundingClientRect(),i=window.innerHeight/2,s=n.top+n.height/2,r=Math.max(0,Math.min(1,(i-s)/(i/2)));document.querySelectorAll(".word-reveal span").forEach(a=>{let c=parseInt(a.dataset.index)/this.totalCharCount,u=this.totalCharCount/2,h=Math.max(0,Math.min(1,(r-c)*u));B(a,{opacity:h},{duration:.4,ease:"easeOut"})})}};x(()=>{try{new Wt({text:`\uACE0\uAC1D\uC758 \uC2DC\uC120\uC774 \uBA38\uBB34\uB294 \uD648\uD398\uC774\uC9C0 \uC81C\uC791\uC744 \uC704\uD574
|
50
|
+
\uC5B4\uB5BB\uAC8C \uB9CC\uB4E4\uC5B4\uC57C \uD560\uAE4C\uC694?`})}catch(e){console.error(e)}});var Di={CONTAINER:"scratch-container"},qt=class{constructor(t={}){A(this,"width");A(this,"height");A(this,"minScratchPercentage");A(this,"gradientColors");A(this,"canvas");A(this,"container");A(this,"ctx");A(this,"onComplete");A(this,"isScratching");A(this,"isComplete");this.width=t.width||300,this.height=t.height||300,this.minScratchPercentage=t.minScratchPercentage||50,this.gradientColors=t.gradientColors||["#A97CF8","#F38CB8","#FDCC92"],this.onComplete=t.onComplete||(()=>{});let n=document.getElementById("scratch-canvas");P(!(n instanceof HTMLCanvasElement),"Canvas \uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."),this.canvas=n;let i=document.getElementById(Di.CONTAINER);P(!i,`${Di.CONTAINER}\uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.`),this.container=i;let s=this.canvas.getContext("2d");P(!s,"2D Context\uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4."),this.ctx=s,this.isScratching=!1,this.isComplete=!1,this.onComplete=()=>{let r=document.querySelector("#content");r instanceof HTMLElement&&(r.style.filter="blur(0)",r.style.color="rgba(0,0,0,1)",r.style.zIndex="10"),t.onComplete&&t.onComplete()},this.init(),this.setupEventListeners()}init(){this.canvas.width=this.width,this.canvas.height=this.height,this.container.style.width=`${this.width}px`,this.container.style.height=`${this.height}px`,this.ctx.fillStyle="#ccc",this.ctx.fillRect(0,0,this.width,this.height);let t=this.ctx.createLinearGradient(0,0,this.width,this.height);t.addColorStop(0,this.gradientColors[0]),t.addColorStop(.5,this.gradientColors[1]),t.addColorStop(1,this.gradientColors[2]),this.ctx.fillStyle=t,this.ctx.fillRect(0,0,this.width,this.height);let n=document.querySelector("#content");n instanceof HTMLElement&&(n.style.visibility="visible")}setupEventListeners(){this.canvas.addEventListener("mousedown",()=>this.isScratching=!0),this.canvas.addEventListener("touchstart",t=>{this.isScratching=!0,t.preventDefault()}),document.addEventListener("mousemove",t=>this.handleScratch(t)),document.addEventListener("touchmove",t=>this.handleScratch(t.touches[0])),document.addEventListener("mouseup",()=>this.handleScratchEnd()),document.addEventListener("touchend",()=>this.handleScratchEnd()),document.addEventListener("touchcancel",()=>this.handleScratchEnd())}handleScratch(t){if(!this.isScratching)return;let n=this.canvas.getBoundingClientRect(),i=t.clientX-n.left+16,s=t.clientY-n.top+16;this.ctx.globalCompositeOperation="destination-out",this.ctx.beginPath(),this.ctx.arc(i,s,30,0,Math.PI*2),this.ctx.fill()}handleScratchEnd(){this.isScratching&&(this.isScratching=!1,this.checkCompletion())}checkCompletion(){if(this.isComplete)return;let n=this.ctx.getImageData(0,0,this.width,this.height).data,i=n.length/4,s=0;for(let o=3;o<n.length;o+=4)n[o]===0&&s++;s/i*100>=this.minScratchPercentage&&(this.isComplete=!0,this.ctx.clearRect(0,0,this.width,this.height),this.startAnimation())}async startAnimation(){await B(this.container,{scale:[.95,1]},{duration:.4,ease:"easeOut"}),this.onComplete()}};x(()=>{let e=new qt({width:300,height:300,minScratchPercentage:20,gradientColors:["#FFF1E6","#FD9A36","#FFBD6F"]})});var $o="details.NDGMNT__faq-section__details summary h2",Uo="NDGMNT__faq-section__toggle-svg";function zo(){$($o).after(`
|
51
51
|
<svg class="${Uo}" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" style="width: 20px; height: 20px; flex-shrink: 0; transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter; transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 300ms;">
|
52
52
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
|
53
53
|
</svg>
|
@@ -55,4 +55,4 @@
|
|
55
55
|
`);this.totalCharCount=0,n.forEach((i,s)=>{let r=Array.from(i);this.totalCharCount+=r.length;let o=document.createElement("span");o.className="mobile__word-container";let a=document.createElement("span");a.className="mobile__word-shadow";let l=document.createElement("span");l.className="mobile__word-reveal",r.forEach((c,u)=>{let h=document.createElement("span");h.textContent=c,h.style.opacity="0",h.dataset.index=String(this.totalCharCount-r.length+u),l.appendChild(h);let d=document.createElement("span");d.textContent=c,a.appendChild(d)}),o.appendChild(a),o.appendChild(l),this.container.appendChild(o),s<n.length-1&&this.container.appendChild(document.createElement("br"))})}setupScrollHandler(){window.addEventListener("scroll",()=>{requestAnimationFrame(()=>this.handleScroll())})}handleScroll(){let i=document.getElementById("mobile__text-reveal-container").getBoundingClientRect(),s=window.innerHeight/2,r=i.top+i.height/2,o=Math.max(0,Math.min(1,(s-r)/(s/2)));document.querySelectorAll(".mobile__word-reveal span").forEach(l=>{let u=parseInt(l.dataset.index)/this.totalCharCount,h=this.totalCharCount/2,d=Math.max(0,Math.min(1,(o-u)*h));B(l,{opacity:d},{duration:.4,ease:"easeOut"})})}}new e({text:`\uACE0\uAC1D\uC758 \uC2DC\uC120\uC774
|
56
56
|
\uBA38\uBB34\uB294 \uD648\uD398\uC774\uC9C0
|
57
57
|
\uC81C\uC791\uC744 \uC704\uD574
|
58
|
-
\uC5B4\uB5BB\uAC8C \uB9CC\uB4E4\uC5B4\uC57C \uD560\uAE4C\uC694?`})}x(()=>{jo(),Yo(),Xo()});})();
|
58
|
+
\uC5B4\uB5BB\uAC8C \uB9CC\uB4E4\uC5B4\uC57C \uD560\uAE4C\uC694?`})}x(()=>{try{jo(),Yo(),Xo()}catch(e){console.error(e)}});})();
|
package/dist/style.css
CHANGED