@ssgoi/core 2.5.3 → 2.5.4
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.cjs +1 -1
- package/dist/index.js +32 -29
- package/dist/presets/index.cjs +1 -1
- package/dist/presets/index.js +2 -2
- package/dist/transition/create-transition-callback.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/number.d.ts +46 -0
- package/dist/utils/number.d.ts.map +1 -0
- package/dist/view-transitions/drill.d.ts.map +1 -1
- package/dist/view-transitions/fade.d.ts.map +1 -1
- package/dist/view-transitions/hero.d.ts.map +1 -1
- package/dist/view-transitions/index.cjs +17 -17
- package/dist/view-transitions/index.js +455 -420
- package/dist/view-transitions/scroll.d.ts.map +1 -1
- package/dist/view-transitions/slide.d.ts.map +1 -1
- package/dist/view-transitions/strip.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/utils.d.ts +0 -17
- package/dist/utils.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var N=Object.defineProperty;var F=(n,t,e)=>t in n?N(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var m=(n,t,e)=>F(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./types.cjs"),Y=require("./jaemin-DL1-g_B5.cjs");class W{constructor(){m(this,"listeners",new Set);m(this,"rafId",null);m(this,"isRunning",!1);m(this,"startTime",Date.now());m(this,"lastUpdate",this.startTime);m(this,"elapsed",0);m(this,"lagThreshold",500);m(this,"adjustedLag",33);m(this,"gap",1e3/240);m(this,"nextTime",this.gap);m(this,"tick",()=>{const t=Date.now();let e=t-this.lastUpdate;(e>this.lagThreshold||e<0)&&(this.startTime+=e-this.adjustedLag,e=this.adjustedLag),this.lastUpdate=t;const i=t-this.startTime,o=i-this.nextTime;if(o>0){const r=e/1e3;this.elapsed=i/1e3,this.nextTime+=o+(o>=this.gap?4:this.gap-o),this.listeners.forEach(s=>{s(r,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(t){return this.listeners.add(t),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(t)}}unsubscribe(t){this.listeners.delete(t),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(t,e){this.lagThreshold=t,this.adjustedLag=Math.min(e,t)}fps(t){this.gap=1e3/t,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const R=new W;function k(n){const{from:t,to:e,stiffness:i,damping:o,mass:r,velocity:s=0,onUpdate:d,onComplete:l}=n;let h=t,u=s,a=!0;const p=Math.sqrt(i/r),c=o/(2*Math.sqrt(i*r)),g=.01,w=.01;let f=0;const y=.05,S=T=>{if(!a)return;const A=Math.min(T,.033),v=-2*A*c*p*u,b=A*p*p*(e-h);u+=v+b,h+=A*u;const E=Math.abs(e-h),C=Math.abs(u);if(E<g&&C<w){if(f+=A,f>=y){h=e,u=0,a=!1,d(h),R.unsubscribe(S),l();return}}else f=0;d(h)};return R.subscribe(S),{stop:()=>{a&&(a=!1,R.unsubscribe(S))}}}class O{constructor(t){m(this,"options");m(this,"currentValue");m(this,"velocity");m(this,"isAnimating",!1);m(this,"controls",null);m(this,"animationMap",null);m(this,"activeAnimations",new Set);m(this,"completedAnimations",new Set);m(this,"updatedProperties",new Set);m(this,"animate",(t=!1)=>{!this.isAnimating&&this.options.onStart&&this.options.onStart(),this.isAnimating=!0;const e=t?this.options.from:this.options.to;if(typeof this.currentValue=="object"&&this.currentValue!==null){this.animateObject(e);return}let i=this.currentValue,o=performance.now();const r={from:this.currentValue,to:e,stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="number"&&(r.velocity=this.velocity*1e3),this.controls=k({...r,onUpdate:s=>{const d=performance.now(),l=(d-o)/1e3;if(l>0){if(typeof s=="number"&&typeof i=="number"){const h=(s-i)/l;this.velocity=h/1e3}else if(typeof s=="object"&&s!==null){const h={};Object.keys(s).forEach(u=>{const a=s[u],p=i[u];if(typeof a=="number"&&typeof p=="number"){const c=(a-p)/l;h[u]=c/1e3}}),this.velocity=h}i=s,o=d}this.currentValue=s,this.options.onUpdate(s)},onComplete:()=>{this.currentValue=e,this.isAnimating=!1,this.controls=null,typeof this.velocity=="object"&&this.velocity!==null?Object.keys(this.velocity).forEach(s=>{this.velocity[s]=0}):this.velocity=0,this.options.onComplete()}})});m(this,"animateObject",t=>{const e=this.currentValue,i=Object.keys(e);this.animationMap=new Map,this.activeAnimations.clear(),this.completedAnimations.clear(),this.updatedProperties.clear();const o={...e},r={};let s=!1;const d=()=>{const l=i.filter(u=>!this.completedAnimations.has(u));if(l.every(u=>this.updatedProperties.has(u))&&l.length>0){if(typeof this.velocity=="object"&&this.velocity){const u=performance.now();Object.keys(o).forEach(a=>{if(r[a]){const p=(u-r[a])/1e3,c=this.currentValue[a],g=o[a];typeof c=="number"&&typeof g=="number"&&p>0&&(this.velocity[a]=(g-c)/p/1e3)}r[a]=u})}this.currentValue={...o},this.options.onUpdate(this.currentValue),this.updatedProperties.clear(),!s&&this.options.onStart&&(s=!0,this.options.onStart())}};i.forEach(l=>{this.activeAnimations.add(l);const h={from:e[l],to:t[l],stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="object"&&this.velocity&&l in this.velocity&&(h.velocity=this.velocity[l]*1e3);const u=k({...h,onUpdate:a=>{o[l]=a,this.updatedProperties.add(l),d()},onComplete:()=>{this.completedAnimations.add(l),this.updatedProperties.delete(l),this.completedAnimations.size===i.length&&(this.currentValue=t,this.isAnimating=!1,this.animationMap=null,typeof this.velocity=="object"&&this.velocity&&Object.keys(this.velocity).forEach(a=>{this.velocity[a]=0}),this.options.onComplete())}});this.animationMap.set(l,u)})});if(this.options={from:t.from??0,to:t.to??1,spring:t.spring??{stiffness:100,damping:10},onUpdate:t.onUpdate??(()=>{}),onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from,typeof this.options.from=="object"&&this.options.from!==null){const e={};Object.keys(this.options.from).forEach(i=>{e[i]=0}),this.velocity=e}else this.velocity=0}forward(){this.stop(),this.animate(!1)}backward(){this.stop(),this.animate(!0)}reverse(){const t=this.options.from;if(this.options.from=this.options.to,this.options.to=t,this.isAnimating){const e=this.shouldReverse();this.stop(),this.animate(!e)}}shouldReverse(){return typeof this.currentValue=="number"&&typeof this.options.from=="number"&&typeof this.options.to=="number"?this.currentValue>(this.options.from+this.options.to)/2:!1}stop(){this.isAnimating=!1,this.controls&&(this.controls.stop(),this.controls=null),this.animationMap&&(this.animationMap.forEach(t=>{t.stop()}),this.animationMap.clear(),this.animationMap=null),this.updatedProperties.clear()}getVelocity(){return this.velocity}getCurrentValue(){return this.currentValue}getIsAnimating(){return this.isAnimating}getCurrentState(){return{type:"single",position:this.currentValue,velocity:this.velocity,from:this.options.from,to:this.options.to}}setVelocity(t){this.velocity=t}setValue(t){this.currentValue=t}updateOptions(t){if(this.options={...this.options,...t},this.isAnimating&&this.controls){const e=this.shouldReverse();this.stop(),this.animate(!e)}}static fromState(t,e){const i=new O(e);return i.setValue(t.position),i.setVelocity(t.velocity),i}}class L{constructor(t){m(this,"config");m(this,"animators",new Map);m(this,"springOrder",[]);m(this,"completedCount",0);m(this,"completedAnimators",new Set);m(this,"direction","forward");m(this,"idCounter",0);m(this,"timeoutIds",[]);this.config=t,this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.springs.forEach(t=>{const e=this.generateId(),i=new O({from:t.from,to:t.to,spring:t.spring,onUpdate:t.tick,onComplete:()=>this.onAnimatorComplete(e),onStart:t.onStart});this.animators.set(e,{id:e,item:t,animator:i,startTime:null}),this.springOrder.push(e)})}normalizeSchedule(t){const e=this.config.schedule??"overlap";return this.springOrder.map((i,o)=>{const r=this.animators.get(i);if(!r)throw new Error(`AnimationScheduler: animator with id "${i}" not found during normalization`);if(e==="overlap")return{type:"offset",id:i,delay:0};if(e==="wait")return t==="forward"&&o===0?{type:"offset",id:i,delay:0}:t==="backward"&&o===this.springOrder.length-1?{type:"offset",id:i,delay:0}:{type:"wait",id:i};const s=r.item.offset??0;if(t==="forward")return{type:"offset",id:i,delay:s};const d=this.animators.size===0?0:Math.max(...Array.from(this.animators.values()).map(l=>l.item.offset??0));return{type:"offset",id:i,delay:d-s}})}onAnimatorComplete(t){var i,o,r,s,d,l;const e=this.animators.get(t);if(!e){console.warn(`AnimationScheduler: animator with id "${t}" not found on completion`);return}this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(o=(i=e.item).onComplete)==null||o.call(i),(s=(r=this.config).onProgress)==null||s.call(r,this.completedCount,this.config.springs.length),this.handleWaitModeChaining(t),this.completedCount===this.config.springs.length&&((l=(d=this.config).onEnd)==null||l.call(d)))}handleWaitModeChaining(t){if(this.config.schedule!=="wait")return;const e=this.springOrder.indexOf(t);if(this.direction==="forward"){const r=this.springOrder[e+1];if(!r)return;const s=this.animators.get(r);s&&s.startTime===null&&this.startAnimator(r);return}const i=this.springOrder[e-1];if(!i)return;const o=this.animators.get(i);o&&o.startTime===null&&this.startBackwardAnimator(i)}startAnimator(t){const e=this.animators.get(t);if(!e){console.warn(`AnimationScheduler: animator with id "${t}" not found on start`);return}if(e.startTime!==null){console.warn(`AnimationScheduler: animator with id "${t}" already started`);return}e.startTime=Date.now(),e.animator.forward()}startBackwardAnimator(t){const e=this.animators.get(t);if(!e){console.warn(`AnimationScheduler: animator with id "${t}" not found on backward start`);return}if(e.startTime!==null){console.warn(`AnimationScheduler: animator with id "${t}" already started`);return}e.startTime=Date.now(),e.animator.backward()}forward(){var e,i;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),(i=(e=this.config).onStart)==null||i.call(e),this.normalizeSchedule("forward").forEach(o=>{if(o.type==="wait")return;if(o.delay===0){this.startAnimator(o.id);return}const r=window.setTimeout(()=>this.startAnimator(o.id),o.delay);this.timeoutIds.push(r)})}backward(){var e,i;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),(i=(e=this.config).onStart)==null||i.call(e),this.normalizeSchedule("backward").forEach(o=>{if(o.type==="wait")return;if(o.delay===0){this.startBackwardAnimator(o.id);return}const r=window.setTimeout(()=>this.startBackwardAnimator(o.id),o.delay);this.timeoutIds.push(r)})}stop(){this.timeoutIds.forEach(t=>clearTimeout(t)),this.timeoutIds=[],this.animators.forEach(t=>{t.animator.stop(),t.startTime=null})}reverse(t){((t==null?void 0:t.offsetMode)??"immediate")!=="immediate"&&console.warn('AnimationScheduler.reverse(): Only "immediate" offsetMode is currently supported. Falling back to "immediate".'),this.direction=this.direction==="forward"?"backward":"forward",this.animators.forEach(i=>{if(i.startTime===null)return;const o=i.animator.getCurrentState();if(o.type!=="single")return;if(o.position===o.to){const s=O.fromState({position:1,velocity:0},{from:i.item.to??1,to:i.item.from??0,spring:i.item.spring,onUpdate:i.item.tick,onComplete:()=>this.onAnimatorComplete(i.id),onStart:i.item.onStart});s.forward(),i.animator=s;return}i.animator.reverse()})}getCurrentState(){return{type:"multi",completed:this.completedCount,total:this.config.springs.length,direction:this.direction}}}const j=Symbol.for("TRANSITION_STRATEGY"),z=n=>({runIn:async t=>{const{currentAnimation:e}=n;if(e&&e.direction==="out"){const s=e.controller.getCurrentState();if(e.controller.stop(),s.type==="multi")return e.controller.reverse(),{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};if(t.out){const d=await t.out,{from:l=1,to:h=0}=d;return{config:d,state:{position:s.position,velocity:s.velocity},from:l,to:h,direction:"backward"}}}const i=await t.in;if(!i)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};if("springs"in i)return{config:i,state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:o=0,to:r=1}=i;return{config:i,state:{position:o,velocity:0},from:o,to:r,direction:"forward"}},runOut:async t=>{const{currentAnimation:e}=n;if(e&&e.direction==="in"){const s=e.controller.getCurrentState();if(e.controller.stop(),s.type==="multi")return e.controller.reverse(),{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};if(t.in){const d=await t.in,{from:l=0,to:h=1}=d;return{config:d,state:{position:s.position,velocity:s.velocity},from:l,to:h,direction:"backward"}}}const i=await t.out;if(!i)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};if("springs"in i)return{config:i,state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:o=1,to:r=0}=i;return{config:i,state:{position:o,velocity:0},from:o,to:r,direction:"forward"}}}),_=()=>({runIn:async n=>{const t=await n.in;if(!t)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};if("springs"in t)return{config:t,state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:e=0,to:i=1}=t;return{config:t,state:{position:e,velocity:0},from:e,to:i,direction:"forward"}},runOut:async n=>{const t=await n.out;if(!t)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};if("springs"in t)return{config:t,state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:e=1,to:i=0}=t;return{config:t,state:{position:e,velocity:0},from:e,to:i,direction:"forward"}}});function X(n,t){var u;let e=null,i=null,o=null,r=null;const s={get currentAnimation(){return e}},d=((u=t==null?void 0:t.strategy)==null?void 0:u.call(t,s))||z(s),l=async a=>{var S,T,A;i&&(i.remove(),i=null);const p=n(),c=p.in&&await p.in(a),g=!(t!=null&&t.strategy)&&p.out?p.out(a):void 0;if(!c)return;if(M.isMultiSpring(c)){const v={in:Promise.resolve(c),out:g&&Promise.resolve(g)};if(!(await d.runIn(v)).config){e&&(e.direction="in");return}(S=c.prepare)==null||S.call(c,a),c.wait&&await c.wait();const E=new L({...c,onEnd:()=>{var C;e=null,(C=c.onEnd)==null||C.call(c)}});e={controller:E,direction:"in"},E.forward();return}const w={in:Promise.resolve(c),out:g&&Promise.resolve(g)},f=await d.runIn(w);if(!f.config)return;if("springs"in f.config){console.error("Unexpected MultiSpringConfig in single-spring path");return}(A=(T=f.config).prepare)==null||A.call(T,a),f.config.wait&&await f.config.wait();const y=O.fromState(f.state,{from:f.from,to:f.to,spring:f.config.spring,onStart:f.config.onStart,onUpdate:f.config.tick,onComplete:()=>{var v,b;e=null,(b=(v=f.config)==null?void 0:v.onEnd)==null||b.call(v)}});e={controller:y,direction:"in"},f.direction==="forward"?y.forward():y.backward()},h=async a=>{var S,T,A;i=a;const p=n(),c=p.out&&await p.out(a);if(!c)return;if(M.isMultiSpring(c)){const v={in:void 0,out:Promise.resolve(c)};if(!(await d.runOut(v)).config){e&&(e.direction="out"),i&&(i.remove(),i=null);return}(S=c.prepare)==null||S.call(c,a),y(),c.wait&&await c.wait();const E=new L({...c,onEnd:()=>{var C,I;(C=c.onEnd)==null||C.call(c),i&&(i.remove(),i=null),e=null,(I=t==null?void 0:t.onCleanupEnd)==null||I.call(t)}});e={controller:E,direction:"out"},E.forward();return}const g={in:void 0,out:Promise.resolve(c)},w=await d.runOut(g);if(!w.config)return;if("springs"in w.config){console.error("Unexpected MultiSpringConfig in single-spring path");return}(A=(T=w.config).prepare)==null||A.call(T,a),y(),w.config.wait&&await w.config.wait();const f=O.fromState(w.state,{from:w.from,to:w.to,spring:w.config.spring,onStart:w.config.onStart,onUpdate:w.config.tick,onComplete:()=>{var v,b,E;(b=(v=w.config)==null?void 0:v.onEnd)==null||b.call(v),i&&(i.remove(),i=null),e=null,(E=t==null?void 0:t.onCleanupEnd)==null||E.call(t)}});e={controller:f,direction:"out"},w.direction==="forward"?f.forward():f.backward();function y(){!o||!i||(r&&o.contains(r)?o.insertBefore(i,r):o.appendChild(i))}};return a=>{if(a)return o=a.parentElement,r=a.nextElementSibling,l(a),()=>{const p=a.cloneNode(!0);h(p)}}}const q=3,K=n=>{if(!n)return null;const t=n.split(`
|
|
1
|
+
"use strict";var N=Object.defineProperty;var F=(n,t,e)=>t in n?N(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var m=(n,t,e)=>F(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./types.cjs"),Y=require("./jaemin-DL1-g_B5.cjs");class W{constructor(){m(this,"listeners",new Set);m(this,"rafId",null);m(this,"isRunning",!1);m(this,"startTime",Date.now());m(this,"lastUpdate",this.startTime);m(this,"elapsed",0);m(this,"lagThreshold",500);m(this,"adjustedLag",33);m(this,"gap",1e3/240);m(this,"nextTime",this.gap);m(this,"tick",()=>{const t=Date.now();let e=t-this.lastUpdate;(e>this.lagThreshold||e<0)&&(this.startTime+=e-this.adjustedLag,e=this.adjustedLag),this.lastUpdate=t;const i=t-this.startTime,o=i-this.nextTime;if(o>0){const r=e/1e3;this.elapsed=i/1e3,this.nextTime+=o+(o>=this.gap?4:this.gap-o),this.listeners.forEach(s=>{s(r,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(t){return this.listeners.add(t),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(t)}}unsubscribe(t){this.listeners.delete(t),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(t,e){this.lagThreshold=t,this.adjustedLag=Math.min(e,t)}fps(t){this.gap=1e3/t,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const R=new W;function k(n){const{from:t,to:e,stiffness:i,damping:o,mass:r,velocity:s=0,onUpdate:d,onComplete:l}=n;let h=t,u=s,a=!0;const p=Math.sqrt(i/r),c=o/(2*Math.sqrt(i*r)),g=.01,w=.01;let f=0;const y=.05,S=T=>{if(!a)return;const A=Math.min(T,.033),v=-2*A*c*p*u,b=A*p*p*(e-h);u+=v+b,h+=A*u;const E=Math.abs(e-h),C=Math.abs(u);if(E<g&&C<w){if(f+=A,f>=y){h=e,u=0,a=!1,d(h),R.unsubscribe(S),l();return}}else f=0;d(h)};return R.subscribe(S),{stop:()=>{a&&(a=!1,R.unsubscribe(S))}}}class O{constructor(t){m(this,"options");m(this,"currentValue");m(this,"velocity");m(this,"isAnimating",!1);m(this,"controls",null);m(this,"animationMap",null);m(this,"activeAnimations",new Set);m(this,"completedAnimations",new Set);m(this,"updatedProperties",new Set);m(this,"animate",(t=!1)=>{!this.isAnimating&&this.options.onStart&&this.options.onStart(),this.isAnimating=!0;const e=t?this.options.from:this.options.to;if(typeof this.currentValue=="object"&&this.currentValue!==null){this.animateObject(e);return}let i=this.currentValue,o=performance.now();const r={from:this.currentValue,to:e,stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="number"&&(r.velocity=this.velocity*1e3),this.controls=k({...r,onUpdate:s=>{const d=performance.now(),l=(d-o)/1e3;if(l>0){if(typeof s=="number"&&typeof i=="number"){const h=(s-i)/l;this.velocity=h/1e3}else if(typeof s=="object"&&s!==null){const h={};Object.keys(s).forEach(u=>{const a=s[u],p=i[u];if(typeof a=="number"&&typeof p=="number"){const c=(a-p)/l;h[u]=c/1e3}}),this.velocity=h}i=s,o=d}this.currentValue=s,this.options.onUpdate(s)},onComplete:()=>{this.currentValue=e,this.isAnimating=!1,this.controls=null,typeof this.velocity=="object"&&this.velocity!==null?Object.keys(this.velocity).forEach(s=>{this.velocity[s]=0}):this.velocity=0,this.options.onComplete()}})});m(this,"animateObject",t=>{const e=this.currentValue,i=Object.keys(e);this.animationMap=new Map,this.activeAnimations.clear(),this.completedAnimations.clear(),this.updatedProperties.clear();const o={...e},r={};let s=!1;const d=()=>{const l=i.filter(u=>!this.completedAnimations.has(u));if(l.every(u=>this.updatedProperties.has(u))&&l.length>0){if(typeof this.velocity=="object"&&this.velocity){const u=performance.now();Object.keys(o).forEach(a=>{if(r[a]){const p=(u-r[a])/1e3,c=this.currentValue[a],g=o[a];typeof c=="number"&&typeof g=="number"&&p>0&&(this.velocity[a]=(g-c)/p/1e3)}r[a]=u})}this.currentValue={...o},this.options.onUpdate(this.currentValue),this.updatedProperties.clear(),!s&&this.options.onStart&&(s=!0,this.options.onStart())}};i.forEach(l=>{this.activeAnimations.add(l);const h={from:e[l],to:t[l],stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="object"&&this.velocity&&l in this.velocity&&(h.velocity=this.velocity[l]*1e3);const u=k({...h,onUpdate:a=>{o[l]=a,this.updatedProperties.add(l),d()},onComplete:()=>{this.completedAnimations.add(l),this.updatedProperties.delete(l),this.completedAnimations.size===i.length&&(this.currentValue=t,this.isAnimating=!1,this.animationMap=null,typeof this.velocity=="object"&&this.velocity&&Object.keys(this.velocity).forEach(a=>{this.velocity[a]=0}),this.options.onComplete())}});this.animationMap.set(l,u)})});if(this.options={from:t.from??0,to:t.to??1,spring:t.spring??{stiffness:100,damping:10},onUpdate:t.onUpdate??(()=>{}),onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from,typeof this.options.from=="object"&&this.options.from!==null){const e={};Object.keys(this.options.from).forEach(i=>{e[i]=0}),this.velocity=e}else this.velocity=0}forward(){this.stop(),this.animate(!1)}backward(){this.stop(),this.animate(!0)}reverse(){const t=this.options.from;if(this.options.from=this.options.to,this.options.to=t,this.isAnimating){const e=this.shouldReverse();this.stop(),this.animate(!e)}}shouldReverse(){return typeof this.currentValue=="number"&&typeof this.options.from=="number"&&typeof this.options.to=="number"?this.currentValue>(this.options.from+this.options.to)/2:!1}stop(){this.isAnimating=!1,this.controls&&(this.controls.stop(),this.controls=null),this.animationMap&&(this.animationMap.forEach(t=>{t.stop()}),this.animationMap.clear(),this.animationMap=null),this.updatedProperties.clear()}getVelocity(){return this.velocity}getCurrentValue(){return this.currentValue}getIsAnimating(){return this.isAnimating}getCurrentState(){return{type:"single",position:this.currentValue,velocity:this.velocity,from:this.options.from,to:this.options.to}}setVelocity(t){this.velocity=t}setValue(t){this.currentValue=t}updateOptions(t){if(this.options={...this.options,...t},this.isAnimating&&this.controls){const e=this.shouldReverse();this.stop(),this.animate(!e)}}static fromState(t,e){const i=new O(e);return i.setValue(t.position),i.setVelocity(t.velocity),i}}class L{constructor(t){m(this,"config");m(this,"animators",new Map);m(this,"springOrder",[]);m(this,"completedCount",0);m(this,"completedAnimators",new Set);m(this,"direction","forward");m(this,"idCounter",0);m(this,"timeoutIds",[]);this.config=t,this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.springs.forEach(t=>{const e=this.generateId(),i=new O({from:t.from,to:t.to,spring:t.spring,onUpdate:t.tick,onComplete:()=>this.onAnimatorComplete(e),onStart:t.onStart});this.animators.set(e,{id:e,item:t,animator:i,startTime:null}),this.springOrder.push(e)})}normalizeSchedule(t){const e=this.config.schedule??"overlap";return this.springOrder.map((i,o)=>{const r=this.animators.get(i);if(!r)throw new Error(`AnimationScheduler: animator with id "${i}" not found during normalization`);if(e==="overlap")return{type:"offset",id:i,delay:0};if(e==="wait")return t==="forward"&&o===0?{type:"offset",id:i,delay:0}:t==="backward"&&o===this.springOrder.length-1?{type:"offset",id:i,delay:0}:{type:"wait",id:i};const s=r.item.offset??0;if(t==="forward")return{type:"offset",id:i,delay:s};const d=this.animators.size===0?0:Math.max(...Array.from(this.animators.values()).map(l=>l.item.offset??0));return{type:"offset",id:i,delay:d-s}})}onAnimatorComplete(t){var i,o,r,s,d,l;const e=this.animators.get(t);if(!e){console.warn(`AnimationScheduler: animator with id "${t}" not found on completion`);return}this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(o=(i=e.item).onComplete)==null||o.call(i),(s=(r=this.config).onProgress)==null||s.call(r,this.completedCount,this.config.springs.length),this.handleWaitModeChaining(t),this.completedCount===this.config.springs.length&&((l=(d=this.config).onEnd)==null||l.call(d)))}handleWaitModeChaining(t){if(this.config.schedule!=="wait")return;const e=this.springOrder.indexOf(t);if(this.direction==="forward"){const r=this.springOrder[e+1];if(!r)return;const s=this.animators.get(r);s&&s.startTime===null&&this.startAnimator(r);return}const i=this.springOrder[e-1];if(!i)return;const o=this.animators.get(i);o&&o.startTime===null&&this.startBackwardAnimator(i)}startAnimator(t){const e=this.animators.get(t);if(!e){console.warn(`AnimationScheduler: animator with id "${t}" not found on start`);return}if(e.startTime!==null){console.warn(`AnimationScheduler: animator with id "${t}" already started`);return}e.startTime=Date.now(),e.animator.forward()}startBackwardAnimator(t){const e=this.animators.get(t);if(!e){console.warn(`AnimationScheduler: animator with id "${t}" not found on backward start`);return}if(e.startTime!==null){console.warn(`AnimationScheduler: animator with id "${t}" already started`);return}e.startTime=Date.now(),e.animator.backward()}forward(){var e,i;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),(i=(e=this.config).onStart)==null||i.call(e),this.normalizeSchedule("forward").forEach(o=>{if(o.type==="wait")return;if(o.delay===0){this.startAnimator(o.id);return}const r=window.setTimeout(()=>this.startAnimator(o.id),o.delay);this.timeoutIds.push(r)})}backward(){var e,i;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),(i=(e=this.config).onStart)==null||i.call(e),this.normalizeSchedule("backward").forEach(o=>{if(o.type==="wait")return;if(o.delay===0){this.startBackwardAnimator(o.id);return}const r=window.setTimeout(()=>this.startBackwardAnimator(o.id),o.delay);this.timeoutIds.push(r)})}stop(){this.timeoutIds.forEach(t=>clearTimeout(t)),this.timeoutIds=[],this.animators.forEach(t=>{t.animator.stop(),t.startTime=null})}reverse(t){((t==null?void 0:t.offsetMode)??"immediate")!=="immediate"&&console.warn('AnimationScheduler.reverse(): Only "immediate" offsetMode is currently supported. Falling back to "immediate".'),this.direction=this.direction==="forward"?"backward":"forward",this.animators.forEach(i=>{if(i.startTime===null)return;const o=i.animator.getCurrentState();if(o.type!=="single")return;if(o.position===o.to){const s=O.fromState({position:1,velocity:0},{from:i.item.to??1,to:i.item.from??0,spring:i.item.spring,onUpdate:i.item.tick,onComplete:()=>this.onAnimatorComplete(i.id),onStart:i.item.onStart});s.forward(),i.animator=s;return}i.animator.reverse()})}getCurrentState(){return{type:"multi",completed:this.completedCount,total:this.config.springs.length,direction:this.direction}}}const j=Symbol.for("TRANSITION_STRATEGY"),z=n=>({runIn:async t=>{const{currentAnimation:e}=n;if(e&&e.direction==="out"){const s=e.controller.getCurrentState();if(e.controller.stop(),s.type==="multi")return e.controller.reverse(),{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};if(t.out){const d=await t.out,{from:l=1,to:h=0}=d;return{config:d,state:{position:s.position,velocity:s.velocity},from:l,to:h,direction:"backward"}}}const i=await t.in;if(!i)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};if("springs"in i)return{config:i,state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:o=0,to:r=1}=i;return{config:i,state:{position:o,velocity:0},from:o,to:r,direction:"forward"}},runOut:async t=>{const{currentAnimation:e}=n;if(e&&e.direction==="in"){const s=e.controller.getCurrentState();if(e.controller.stop(),s.type==="multi")return e.controller.reverse(),{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};if(t.in){const d=await t.in,{from:l=0,to:h=1}=d;return{config:d,state:{position:s.position,velocity:s.velocity},from:l,to:h,direction:"backward"}}}const i=await t.out;if(!i)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};if("springs"in i)return{config:i,state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:o=1,to:r=0}=i;return{config:i,state:{position:o,velocity:0},from:o,to:r,direction:"forward"}}}),_=()=>({runIn:async n=>{const t=await n.in;if(!t)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};if("springs"in t)return{config:t,state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:e=0,to:i=1}=t;return{config:t,state:{position:e,velocity:0},from:e,to:i,direction:"forward"}},runOut:async n=>{const t=await n.out;if(!t)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};if("springs"in t)return{config:t,state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:e=1,to:i=0}=t;return{config:t,state:{position:e,velocity:0},from:e,to:i,direction:"forward"}}});function X(n,t){var u;let e=null,i=null,o=null,r=null;const s={get currentAnimation(){return e}},d=((u=t==null?void 0:t.strategy)==null?void 0:u.call(t,s))||z(s),l=async a=>{var S,T,A;i&&(i.remove(),i=null);const p=n(),c=p.in&&await p.in(a),g=!(t!=null&&t.strategy)&&p.out?p.out(a):void 0;if(!c)return;if(M.isMultiSpring(c)){const v={in:Promise.resolve(c),out:g&&Promise.resolve(g)};if(!(await d.runIn(v)).config){e&&(e.direction="in");return}(S=c.prepare)==null||S.call(c,a),c.wait&&await c.wait();const E=new L({...c,onEnd:()=>{var C;e=null,(C=c.onEnd)==null||C.call(c)}});e={controller:E,direction:"in"},E.forward();return}const w={in:Promise.resolve(c),out:g&&Promise.resolve(g)},f=await d.runIn(w);if(!f.config)return;if("springs"in f.config){console.error("Unexpected MultiSpringConfig in single-spring path");return}(A=(T=f.config).prepare)==null||A.call(T,a),f.config.wait&&await f.config.wait();const y=O.fromState(f.state,{from:f.from,to:f.to,spring:f.config.spring,onStart:f.config.onStart,onUpdate:f.config.tick,onComplete:()=>{var v,b;e=null,(b=(v=f.config)==null?void 0:v.onEnd)==null||b.call(v)}});e={controller:y,direction:"in"},f.direction==="forward"?y.forward():y.backward()},h=async a=>{var S,T,A;i=a;const p=n(),c=p.out&&await p.out(a);if(!c)return;if(M.isMultiSpring(c)){const v={in:void 0,out:Promise.resolve(c)};if(!(await d.runOut(v)).config){e&&(e.direction="out"),i&&(i.remove(),i=null);return}(S=c.prepare)==null||S.call(c,a),y(),c.wait&&await c.wait();const E=new L({...c,onEnd:()=>{var C,I;(C=c.onEnd)==null||C.call(c),i&&(i.remove(),i=null),e=null,(I=t==null?void 0:t.onCleanupEnd)==null||I.call(t)}});e={controller:E,direction:"out"},E.forward();return}const g={in:void 0,out:Promise.resolve(c)},w=await d.runOut(g);if(!w.config)return;if("springs"in w.config){console.error("Unexpected MultiSpringConfig in single-spring path");return}(A=(T=w.config).prepare)==null||A.call(T,a),y(),w.config.wait&&await w.config.wait();const f=O.fromState(w.state,{from:w.from,to:w.to,spring:w.config.spring,onStart:w.config.onStart,onUpdate:w.config.tick,onComplete:()=>{var v,b,E;(b=(v=w.config)==null?void 0:v.onEnd)==null||b.call(v),i&&(i.remove(),i=null),e=null,(E=t==null?void 0:t.onCleanupEnd)==null||E.call(t)}});e={controller:f,direction:"out"},w.direction==="forward"?f.forward():f.backward();function y(){!o||!i||(r&&o.contains(r)?o.insertBefore(i,r):o.appendChild(i))}};return a=>{if(a)return o=a.parentElement,r=a.nextElementSibling,l(a),()=>{if(a.isConnected){const p=a.cloneNode(!0);h(p)}else h(a)}}}const q=3,K=n=>{if(!n)return null;const t=n.split(`
|
|
2
2
|
`).map(e=>e.trim());for(let e=q;e<Math.min(t.length,6);e++){const i=t[e],o=i==null?void 0:i.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!o)continue;const r=o[1]??"",s=o[2]??"0",d=o[3]??"0";return{file:r.split(/[\\/]/).pop()||r,line:s,column:d}}return null},x=new Map,V=new Map;function B(n,t,e){x.set(n,t);let i=V.get(n);return i||(i=X(()=>{const o=x.get(n);return o||(console.warn(`Transition "${String(n)}" not found`),{})},{strategy:e,onCleanupEnd:()=>$(n)}),V.set(n,i),i)}function $(n){x.delete(n),V.delete(n)}function H(){const n=K(new Error().stack);return n?`auto_${n.file}_${n.line}_${n.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const D=globalThis.FinalizationRegistry,U=D?new D(n=>{try{$(n)}catch{}}):void 0;function G(n){const t=n.key??H();if(n.ref&&U)try{U.register(n.ref,t)}catch{}return B(t,{in:n.in,out:n.out},n[j])}function J(n){const t=n.filter(e=>e.symmetric).map(e=>({from:e.to,to:e.from,transition:e.transition}));return[...n,...t]}function Q(n){let t=!1,e=0,i=0,o=!1;const r=50,s=50,d=c=>{if(!n)return;const g=c.touches[0];g&&(o=g.clientX<s,o&&(e=g.clientX,i=g.clientY))},l=c=>{if(!n||!o||t)return;const g=c.touches[0];if(!g)return;const w=g.clientX-e,f=g.clientY-i;w>r&&Math.abs(w)>Math.abs(f)&&(t=!0,setTimeout(()=>{t=!1},500))},h=()=>{n&&(o=!1,e=0,i=0)};return{initialize:()=>{typeof window>"u"||n&&(window.addEventListener("touchstart",d,{passive:!0}),window.addEventListener("touchmove",l,{passive:!0}),window.addEventListener("touchend",h,{passive:!0}))},cleanup:()=>{typeof window>"u"||(window.removeEventListener("touchstart",d),window.removeEventListener("touchmove",l),window.removeEventListener("touchend",h))},isSwipePending:()=>t}}const Z=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const e=window.getComputedStyle(t),i=e.overflow+e.overflowY+e.overflowX;if(i.includes("auto")||i.includes("scroll")||t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.parentElement}return document.documentElement},tt=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const e=window.getComputedStyle(t).position;if(e==="relative"||e==="absolute"||e==="fixed"||e==="sticky")return t;t=t.parentElement}return document.body};function et(){let n=null,t=null;const e=new Map;let i=null;const o=()=>{n&&i&&e.set(i,{x:n.scrollLeft,y:n.scrollTop})};return{initializeContext:(u,a)=>{t=u,n||(n=Z(u),(n===document.documentElement?window:n).addEventListener("scroll",o,{passive:!0})),i=a},calculateScrollOffset:(u,a)=>{const p=u&&e.has(u)?e.get(u):{x:0,y:0},c=a&&e.has(a)?e.get(a):{x:0,y:0};return{x:-c.x+p.x,y:-c.y+p.y}},getScrollContainer:()=>n,getPositionedParentElement:()=>t?tt(t):document.body,getScrollPosition:u=>u&&e.has(u)?e.get(u):{x:0,y:0}}}function P(n,t){if(t==="*")return!0;if(t.endsWith("/*")){const e=t.slice(0,-2);return n===e||n.startsWith(e+"/")}return n===t}function it(n,t,e){for(const i of e)if(P(n,i.from)&&P(t,i.to))return i.transition;for(const i of e)if((i.from==="*"||P(n,i.from))&&(i.to==="*"||P(t,i.to)))return i.transition;return null}function nt(n){const{transitions:t=[],defaultTransition:e,middleware:i=(f,y)=>({from:f,to:y}),skipOnIosSwipe:o=!0}=n;let r=null;const s=J(t),{initializeContext:d,calculateScrollOffset:l,getScrollContainer:h,getPositionedParentElement:u,getScrollPosition:a}=et(),p=Q(o);p.initialize();function c(){if(r!=null&&r.from&&(r!=null&&r.to)){const{from:f,to:y}=i(r.from,r.to),T=it(f,y,s)||e,A=l(r.from,r.to),v={scrollOffset:A,scroll:a(r.from),get scrollingElement(){return h()||document.documentElement},get positionedParent(){return u()}},b={scrollOffset:A,get scroll(){return r?a(r.to):{x:0,y:0}},get scrollingElement(){return h()||document.documentElement},get positionedParent(){return u()}};T&&(T.out&&r.outResolve&&r.outResolve(E=>T.out(E,v)),T.in&&r.inResolve&&r.inResolve(E=>T.in(E,b))),r=null}}const g=async(f,y)=>p.isSwipePending()?()=>({}):y==="in"&&(!r||!r.from)?()=>({}):(r||(r={}),y==="out"?(r.from=f,new Promise(S=>{r.outResolve=S,c()})):(r.to=f,new Promise(S=>{r.inResolve=S,c()})));return f=>({key:f,in:async y=>(d(y,f),(await g(f,"in"))(y)),out:async y=>(await g(f,"out"))(y),[j]:_})}exports.isMultiSpring=M.isMultiSpring;exports.isSingleSpring=M.isSingleSpring;exports.jaeminInternal=Y.jaeminInternal;exports.TRANSITION_STRATEGY=j;exports.createDefaultStrategy=z;exports.createPageTransitionStrategy=_;exports.createSggoiTransitionContext=nt;exports.generateAutoKey=H;exports.transition=G;
|
package/dist/index.js
CHANGED
|
@@ -81,13 +81,13 @@ function k(n) {
|
|
|
81
81
|
let h = t, u = s, a = !0;
|
|
82
82
|
const p = Math.sqrt(i / r), c = o / (2 * Math.sqrt(i * r)), g = 0.01, w = 0.01;
|
|
83
83
|
let f = 0;
|
|
84
|
-
const y = 0.05, S = (
|
|
84
|
+
const y = 0.05, S = (C) => {
|
|
85
85
|
if (!a) return;
|
|
86
|
-
const
|
|
87
|
-
u += v +
|
|
88
|
-
const E = Math.abs(e - h),
|
|
89
|
-
if (E < g &&
|
|
90
|
-
if (f +=
|
|
86
|
+
const T = Math.min(C, 0.033), v = -2 * T * c * p * u, b = T * p * p * (e - h);
|
|
87
|
+
u += v + b, h += T * u;
|
|
88
|
+
const E = Math.abs(e - h), A = Math.abs(u);
|
|
89
|
+
if (E < g && A < w) {
|
|
90
|
+
if (f += T, f >= y) {
|
|
91
91
|
h = e, u = 0, a = !1, d(h), I.unsubscribe(S), l();
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
@@ -718,7 +718,7 @@ function W(n, t) {
|
|
|
718
718
|
return e;
|
|
719
719
|
}
|
|
720
720
|
}, d = ((u = t == null ? void 0 : t.strategy) == null ? void 0 : u.call(t, s)) || F(s), l = async (a) => {
|
|
721
|
-
var S,
|
|
721
|
+
var S, C, T;
|
|
722
722
|
i && (i.remove(), i = null);
|
|
723
723
|
const p = n(), c = p.in && await p.in(a), g = !(t != null && t.strategy) && p.out ? p.out(a) : void 0;
|
|
724
724
|
if (!c)
|
|
@@ -736,8 +736,8 @@ function W(n, t) {
|
|
|
736
736
|
const E = new j({
|
|
737
737
|
...c,
|
|
738
738
|
onEnd: () => {
|
|
739
|
-
var
|
|
740
|
-
e = null, (
|
|
739
|
+
var A;
|
|
740
|
+
e = null, (A = c.onEnd) == null || A.call(c);
|
|
741
741
|
}
|
|
742
742
|
});
|
|
743
743
|
e = {
|
|
@@ -756,7 +756,7 @@ function W(n, t) {
|
|
|
756
756
|
console.error("Unexpected MultiSpringConfig in single-spring path");
|
|
757
757
|
return;
|
|
758
758
|
}
|
|
759
|
-
(
|
|
759
|
+
(T = (C = f.config).prepare) == null || T.call(C, a), f.config.wait && await f.config.wait();
|
|
760
760
|
const y = O.fromState(f.state, {
|
|
761
761
|
from: f.from,
|
|
762
762
|
to: f.to,
|
|
@@ -764,13 +764,13 @@ function W(n, t) {
|
|
|
764
764
|
onStart: f.config.onStart,
|
|
765
765
|
onUpdate: f.config.tick,
|
|
766
766
|
onComplete: () => {
|
|
767
|
-
var v,
|
|
768
|
-
e = null, (
|
|
767
|
+
var v, b;
|
|
768
|
+
e = null, (b = (v = f.config) == null ? void 0 : v.onEnd) == null || b.call(v);
|
|
769
769
|
}
|
|
770
770
|
});
|
|
771
771
|
e = { controller: y, direction: "in" }, f.direction === "forward" ? y.forward() : y.backward();
|
|
772
772
|
}, h = async (a) => {
|
|
773
|
-
var S,
|
|
773
|
+
var S, C, T;
|
|
774
774
|
i = a;
|
|
775
775
|
const p = n(), c = p.out && await p.out(a);
|
|
776
776
|
if (!c)
|
|
@@ -789,8 +789,8 @@ function W(n, t) {
|
|
|
789
789
|
const E = new j({
|
|
790
790
|
...c,
|
|
791
791
|
onEnd: () => {
|
|
792
|
-
var
|
|
793
|
-
(
|
|
792
|
+
var A, x;
|
|
793
|
+
(A = c.onEnd) == null || A.call(c), i && (i.remove(), i = null), e = null, (x = t == null ? void 0 : t.onCleanupEnd) == null || x.call(t);
|
|
794
794
|
}
|
|
795
795
|
});
|
|
796
796
|
e = {
|
|
@@ -810,7 +810,7 @@ function W(n, t) {
|
|
|
810
810
|
console.error("Unexpected MultiSpringConfig in single-spring path");
|
|
811
811
|
return;
|
|
812
812
|
}
|
|
813
|
-
(
|
|
813
|
+
(T = (C = w.config).prepare) == null || T.call(C, a), y(), w.config.wait && await w.config.wait();
|
|
814
814
|
const f = O.fromState(w.state, {
|
|
815
815
|
from: w.from,
|
|
816
816
|
to: w.to,
|
|
@@ -818,8 +818,8 @@ function W(n, t) {
|
|
|
818
818
|
onStart: w.config.onStart,
|
|
819
819
|
onUpdate: w.config.tick,
|
|
820
820
|
onComplete: () => {
|
|
821
|
-
var v,
|
|
822
|
-
(
|
|
821
|
+
var v, b, E;
|
|
822
|
+
(b = (v = w.config) == null ? void 0 : v.onEnd) == null || b.call(v), i && (i.remove(), i = null), e = null, (E = t == null ? void 0 : t.onCleanupEnd) == null || E.call(t);
|
|
823
823
|
}
|
|
824
824
|
});
|
|
825
825
|
e = { controller: f, direction: "out" }, w.direction === "forward" ? f.forward() : f.backward();
|
|
@@ -830,8 +830,11 @@ function W(n, t) {
|
|
|
830
830
|
return (a) => {
|
|
831
831
|
if (a)
|
|
832
832
|
return o = a.parentElement, r = a.nextElementSibling, l(a), () => {
|
|
833
|
-
|
|
834
|
-
|
|
833
|
+
if (a.isConnected) {
|
|
834
|
+
const p = a.cloneNode(!0);
|
|
835
|
+
h(p);
|
|
836
|
+
} else
|
|
837
|
+
h(a);
|
|
835
838
|
};
|
|
836
839
|
};
|
|
837
840
|
}
|
|
@@ -1017,15 +1020,15 @@ function ot(n) {
|
|
|
1017
1020
|
const { from: f, to: y } = i(
|
|
1018
1021
|
r.from,
|
|
1019
1022
|
r.to
|
|
1020
|
-
),
|
|
1023
|
+
), C = tt(
|
|
1021
1024
|
f,
|
|
1022
1025
|
y,
|
|
1023
1026
|
s
|
|
1024
|
-
) || e,
|
|
1027
|
+
) || e, T = l(
|
|
1025
1028
|
r.from,
|
|
1026
1029
|
r.to
|
|
1027
1030
|
), v = {
|
|
1028
|
-
scrollOffset:
|
|
1031
|
+
scrollOffset: T,
|
|
1029
1032
|
scroll: a(r.from),
|
|
1030
1033
|
get scrollingElement() {
|
|
1031
1034
|
return h() || document.documentElement;
|
|
@@ -1033,8 +1036,8 @@ function ot(n) {
|
|
|
1033
1036
|
get positionedParent() {
|
|
1034
1037
|
return u();
|
|
1035
1038
|
}
|
|
1036
|
-
},
|
|
1037
|
-
scrollOffset:
|
|
1039
|
+
}, b = {
|
|
1040
|
+
scrollOffset: T,
|
|
1038
1041
|
get scroll() {
|
|
1039
1042
|
return r ? a(r.to) : { x: 0, y: 0 };
|
|
1040
1043
|
},
|
|
@@ -1045,10 +1048,10 @@ function ot(n) {
|
|
|
1045
1048
|
return u();
|
|
1046
1049
|
}
|
|
1047
1050
|
};
|
|
1048
|
-
|
|
1049
|
-
(E) =>
|
|
1050
|
-
),
|
|
1051
|
-
(E) =>
|
|
1051
|
+
C && (C.out && r.outResolve && r.outResolve(
|
|
1052
|
+
(E) => C.out(E, v)
|
|
1053
|
+
), C.in && r.inResolve && r.inResolve(
|
|
1054
|
+
(E) => C.in(E, b)
|
|
1052
1055
|
)), r = null;
|
|
1053
1056
|
}
|
|
1054
1057
|
}
|
package/dist/presets/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={stiffness:170,damping:26},n={stiffness:120,damping:14},t={stiffness:180,damping:12},e={stiffness:210,damping:20},f={stiffness:280,damping:60},i={stiffness:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={stiffness:170,damping:26},n={stiffness:120,damping:14},t={stiffness:180,damping:12},e={stiffness:210,damping:20},f={stiffness:280,damping:60},i={stiffness:150,damping:60},o={default:s,gentle:n,wobbly:t,stiff:e,slow:f,molasses:i};exports.config=o;exports.defaultSpring=s;exports.gentle=n;exports.molasses=i;exports.slow=f;exports.stiff=e;exports.wobbly=t;
|
package/dist/presets/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-transition-callback.d.ts","sourceRoot":"","sources":["../../src/lib/transition/create-transition-callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAEnB,MAAM,UAAU,CAAC;AAIlB,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAExB,MAAM,uBAAuB,CAAC;AAE/B,wBAAgB,wBAAwB,CAAC,eAAe,GAAG,MAAM,EAC/D,aAAa,EAAE,MAAM,UAAU,CAAC,SAAS,EAAE,eAAe,CAAC,EAC3D,OAAO,CAAC,EAAE;IACR,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,CACT,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,KACtC,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAC1C,GACA,kBAAkB,
|
|
1
|
+
{"version":3,"file":"create-transition-callback.d.ts","sourceRoot":"","sources":["../../src/lib/transition/create-transition-callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAEnB,MAAM,UAAU,CAAC;AAIlB,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAExB,MAAM,uBAAuB,CAAC;AAE/B,wBAAgB,wBAAwB,CAAC,eAAe,GAAG,MAAM,EAC/D,aAAa,EAAE,MAAM,UAAU,CAAC,SAAS,EAAE,eAAe,CAAC,EAC3D,OAAO,CAAC,EAAE;IACR,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,CACT,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,KACtC,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAC1C,GACA,kBAAkB,CA0RpB"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { getPositionedParent } from './get-positioned-parent';
|
|
|
4
4
|
export { parseCallerLocation } from './parse-caller-location';
|
|
5
5
|
export { sleep } from './sleep';
|
|
6
6
|
export { getRect } from './get-rect';
|
|
7
|
+
export { round, floor, ceil, toFixed } from './number';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rounds a number to a specified number of decimal places
|
|
3
|
+
* @param num - The number to round
|
|
4
|
+
* @param decimals - Number of decimal places (default: 0)
|
|
5
|
+
* @returns The rounded number
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* round(3.14159, 2) // 3.14
|
|
9
|
+
* round(3.14159, 0) // 3
|
|
10
|
+
* round(3.6) // 4
|
|
11
|
+
*/
|
|
12
|
+
export declare function round(num: number, decimals?: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* Floors a number to a specified number of decimal places
|
|
15
|
+
* @param num - The number to floor
|
|
16
|
+
* @param decimals - Number of decimal places (default: 0)
|
|
17
|
+
* @returns The floored number
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* floor(3.99, 1) // 3.9
|
|
21
|
+
* floor(3.99) // 3
|
|
22
|
+
*/
|
|
23
|
+
export declare function floor(num: number, decimals?: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* Ceils a number to a specified number of decimal places
|
|
26
|
+
* @param num - The number to ceil
|
|
27
|
+
* @param decimals - Number of decimal places (default: 0)
|
|
28
|
+
* @returns The ceiled number
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ceil(3.01, 1) // 3.1
|
|
32
|
+
* ceil(3.01) // 4
|
|
33
|
+
*/
|
|
34
|
+
export declare function ceil(num: number, decimals?: number): number;
|
|
35
|
+
/**
|
|
36
|
+
* Formats a number to a fixed number of decimal places
|
|
37
|
+
* @param num - The number to format
|
|
38
|
+
* @param decimals - Number of decimal places (default: 0)
|
|
39
|
+
* @returns The formatted number as a string
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* toFixed(3.14159, 2) // "3.14"
|
|
43
|
+
* toFixed(3, 2) // "3.00"
|
|
44
|
+
*/
|
|
45
|
+
export declare function toFixed(num: number, decimals?: number): string;
|
|
46
|
+
//# sourceMappingURL=number.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/lib/utils/number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,GAAG,MAAM,CAG/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,GAAG,MAAM,CAG/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,GAAG,MAAM,CAG9D;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,GAAG,MAAM,CAEjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drill.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/drill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"drill.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/drill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAa9D,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,KAAK,GAAI,UAAS,YAAiB,KAAG,eAuFlD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fade.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/fade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAQ9D,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB,KAAG,
|
|
1
|
+
{"version":3,"file":"fade.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/fade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAQ9D,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB,KAAG,eA6DhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/hero.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI9D,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB,KAAG,
|
|
1
|
+
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions/hero.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI9D,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB,KAAG,eA2KhD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../jaemin-DL1-g_B5.cjs"),Y=t=>new Promise(n=>setTimeout(n,t));function q(t,n=0){const i=Math.pow(10,n);return Math.round(t*i)/i}const G={stiffness:80,damping:25},V={stiffness:75,damping:25},j=300,K=10,Z="horizontal",J="#000000",Q=(t={})=>{const{inSpring:n=V,outSpring:i=G,transitionDelay:d=j,blindCount:r=K,direction:s=Z,staggerDelay:c=100,blindColor:e=J}=t;let a,o=null;const l=(p,g,y="left")=>{window.getComputedStyle(p).position==="static"&&(p.style.position="relative");const h=document.createElement("div");h.className="blind-container",h.style.cssText=`
|
|
2
2
|
position: absolute;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -7,29 +7,29 @@
|
|
|
7
7
|
pointer-events: none;
|
|
8
8
|
z-index: 9999;
|
|
9
9
|
overflow: hidden;
|
|
10
|
-
`;const f=[];for(let $=0;$<r;$++){const x=document.createElement("div");if(
|
|
10
|
+
`;const f=[];for(let $=0;$<r;$++){const x=document.createElement("div");if(s==="horizontal"){const w=100/r,C=`calc(${w}% + 1px)`;x.style.cssText=`
|
|
11
11
|
position: absolute;
|
|
12
|
-
top: ${
|
|
12
|
+
top: ${w*$}%;
|
|
13
13
|
left: 0;
|
|
14
14
|
width: 100%;
|
|
15
|
-
height: ${
|
|
16
|
-
background: ${
|
|
15
|
+
height: ${C};
|
|
16
|
+
background: ${e};
|
|
17
17
|
transform: scaleX(${g==="hidden"?0:1});
|
|
18
|
-
transform-origin: ${
|
|
18
|
+
transform-origin: ${y} center;
|
|
19
19
|
will-change: transform;
|
|
20
|
-
`}else{const
|
|
20
|
+
`}else{const w=100/r,C=`calc(${w}% + 1px)`;x.style.cssText=`
|
|
21
21
|
position: absolute;
|
|
22
22
|
top: 0;
|
|
23
|
-
left: ${
|
|
24
|
-
width: ${
|
|
23
|
+
left: ${w*$}%;
|
|
24
|
+
width: ${C};
|
|
25
25
|
height: 100%;
|
|
26
|
-
background: ${
|
|
26
|
+
background: ${e};
|
|
27
27
|
transform: scaleY(${g==="hidden"?0:1});
|
|
28
|
-
transform-origin: ${
|
|
28
|
+
transform-origin: ${y==="left"?"top":"bottom"} center;
|
|
29
29
|
will-change: transform;
|
|
30
|
-
`}f.push(x),h.appendChild(x)}return p.appendChild(h),{container:h,blinds:f}};return{out:()=>{let p=null;return a=new Promise(
|
|
31
|
-
${
|
|
32
|
-
${
|
|
33
|
-
${
|
|
34
|
-
${
|
|
35
|
-
)`}function dt(t,e){t.style.transform=`translateY(${-e.top}px)`}function L(t,e,s){return t<=e?0:t>=s?1:(t-e)/(s-e)}function ct(t,e){return t.querySelector(`[data-hero-key="${e}"]`)}const ht=(t={})=>{var o,n;const e={stiffness:((o=t.spring)==null?void 0:o.stiffness)??300,damping:((n=t.spring)==null?void 0:n.damping)??30},s=t.timeout??300,d=t.maxDistance??700;let r=null,i=null;return{in:async(a,c)=>{const l=a,p=Array.from(l.querySelectorAll("[data-hero-key]"));if(p.length===0)return{spring:e,tick:()=>{}};if(!await new Promise(y=>{r?y(!0):(i=y,setTimeout(()=>{i=null,y(!1)},s))})||!r)return r=null,{spring:e,tick:()=>{}};const u=p.map(y=>{const h=y.getAttribute("data-hero-key");if(!h)return null;const f=ct(r,h);if(!f)return null;const $=y,x=w.getRect(r,f),m=w.getRect(l,$),T=x.left-m.left-c.scrollOffset.x,Y=x.top-m.top-c.scrollOffset.y,U=x.width/m.width,X=x.height/m.height,W=$.style.transform,z=$.style.position,B=$.style.transformOrigin,H=$.style.zIndex;return{toEl:$,dx:T,dy:Y,dw:U,dh:X,originalTransform:W,originalPosition:z,originalTransformOrigin:B,originalZIndex:H}}).filter(y=>y!==null&&Math.abs(y.dy)<=d);return r=null,u.length===0?{spring:e,tick:()=>{}}:{spring:e,prepare:()=>{u.forEach(({toEl:y})=>{y.style.position="relative",y.style.transformOrigin="top left",y.style.zIndex="1000"})},tick:y=>{u.forEach(({toEl:h,dx:f,dy:$,dw:x,dh:m})=>{h.style.transform=`translate(${(1-y)*f}px,${(1-y)*$}px) scale(${y+(1-y)*x}, ${y+(1-y)*m})`})},onEnd:()=>{u.forEach(({toEl:y,originalTransform:h,originalPosition:f,originalTransformOrigin:$,originalZIndex:x})=>{y.style.transform=h,y.style.position=f,y.style.transformOrigin=$,y.style.zIndex=x})}}},out:async a=>({onStart:()=>{r=a,i&&(i(!0),i=null)},prepare:c=>{w.prepareOutgoing(c),c.style.opacity="0"}})}};function pt({detailRect:t,galleryRect:e,pageRect:s,scrollOffset:d},r){const i=e.left-t.left+(e.width-t.width)/2-d.x,o=e.top-t.top+(e.height-t.height)/2-d.y,n=e.width/t.width,a=e.height/t.height,c=Math.max(n,a),l=t.top/s.height*100,p=(s.width-(t.left+t.width))/s.width*100,g=(s.height-(t.top+t.height))/s.height*100,u=t.left/s.width*100;return r.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,y=>{const h=1-y,f=l*h,$=p*h,x=g*h,m=u*h;r.style.clipPath=`inset(${f}% ${$}% ${x}% ${m}%)`,r.style.transform=`translate(${i*h}px, ${o*h}px) scale(${1+(c-1)*h})`}}function ut({detailRect:t,galleryRect:e,pageRect:s,scrollOffset:d},r){const i=e.left-t.left+(e.width-t.width)/2+d.x,o=e.top-t.top+(e.height-t.height)/2+d.y,n=e.width/t.width,a=e.height/t.height,c=Math.min(n,a),l=t.top/s.height*100,p=(s.width-(t.left+t.width))/s.width*100,g=(s.height-(t.top+t.height))/s.height*100,u=t.left/s.width*100;return r.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,y=>{const h=1-y,f=l*h,$=p*h,x=g*h,m=u*h;r.style.clipPath=`inset(${f}% ${$}% ${x}% ${m}%)`,r.style.transform=`translate(${i*h-d.x}px, ${o*h-d.y}px) scale(${1+(c-1)*h})`}}function yt(t,e,s){const d=t.querySelector("[data-instagram-detail-key]"),r=e.querySelector("[data-instagram-detail-key]");if(t.querySelectorAll("[data-instagram-detail-key]").length>1||e.querySelectorAll("[data-instagram-detail-key]").length>1)return null;let i=null,o=null,n=!1;if(!d&&r){o=r;const l=o.getAttribute("data-instagram-detail-key");if(!l)return null;i=t.querySelector(`[data-instagram-gallery-key="${l}"]`),i&&(n=!0)}else if(d&&!r){o=d;const l=o.getAttribute("data-instagram-detail-key");if(!l)return null;i=e.querySelector(`[data-instagram-gallery-key="${l}"]`),i&&(n=!1)}if(!i||!o)return null;const a=w.getRect(n?t:e,i),c=w.getRect(n?e:t,o);return n?{isEnterMode:!0,inAnimation:pt({detailRect:c,galleryRect:a,pageRect:e.getBoundingClientRect(),scrollOffset:s},e)}:{isEnterMode:!1,outAnimation:ut({detailRect:c,galleryRect:a,pageRect:t.getBoundingClientRect(),scrollOffset:s},t)}}const gt=(t={})=>{var o,n;const e={stiffness:((o=t.spring)==null?void 0:o.stiffness)??150,damping:((n=t.spring)==null?void 0:n.damping)??20},s=t.timeout??300;let d=null,r=null,i=null;return{in:async(a,{scrollOffset:c})=>{const l=a;return!await new Promise(g=>{d?g(!0):(r=g,setTimeout(()=>{r=null,g(!1)},s))})||!d?(d=null,{spring:e,tick:()=>{}}):(i=yt(d,l,c),i?(d=null,{spring:e,tick:g=>{i!=null&&i.inAnimation&&i.inAnimation(g)}}):{spring:e,tick:()=>{}})},out:async(a,c)=>({spring:e,onStart:()=>{d=a,r&&(r(!0),r=null)},prepare:l=>{w.prepareOutgoing(l,c),i!=null&&i.isEnterMode||(l.style.zIndex="-1")},tick:l=>{i!=null&&i.outAnimation&&i.outAnimation(l)}})}};function ft({detailRect:t,galleryRect:e,pageRect:s,scrollOffset:d},r){const i=e.left-t.left+(e.width-t.width)/2-d.x,o=e.top-t.top+(e.height-t.height)/2-d.y,n=e.width/t.width,a=e.height/t.height,c=Math.max(n,a),l=t.top/s.height*100,p=(s.width-(t.left+t.width))/s.width*100,g=(s.height-(t.top+t.height))/s.height*100,u=t.left/s.width*100;return r.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,y=>{const h=1-y,f=l*h,$=p*h,x=g*h,m=u*h;r.style.clipPath=`inset(${f}% ${$}% ${x}% ${m}%)`,r.style.transform=`translate(${i*h}px, ${o*h}px) scale(${1+(c-1)*h})`}}function $t({galleryRect:t,detailRect:e,scrollOffset:s},d){const r=e.left-t.left+(e.width-t.width)/2+s.x,i=e.top-t.top+(e.height-t.height)/2+s.y,o=e.width/t.width,n=e.height/t.height,a=Math.max(o,n);return c=>{d.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`;const l=1-c;d.style.transform=`translate(${r*l-s.x}px, ${i*l-s.y}px) scale(${1+(a-1)*l})`,d.style.opacity=`${1-l}`}}function xt({galleryRect:t,detailRect:e,scrollOffset:s},d){const r=e.left-t.left+(e.width-t.width)/2-s.x,i=e.top-t.top+(e.height-t.height)/2-s.y,o=e.width/t.width,n=e.height/t.height,a=Math.max(o,n);return c=>{const l=1-c,p=c;d.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,d.style.transform=`translate(${r*l}px, ${i*l}px) scale(${1+(a-1)*l})`,d.style.opacity=`${p}`}}function mt({detailRect:t,galleryRect:e,pageRect:s,scrollOffset:d},r){const i=e.left-t.left+(e.width-t.width)/2+d.x,o=e.top-t.top+(e.height-t.height)/2+d.y,n=e.width/t.width,a=e.height/t.height,c=Math.min(n,a),l=t.top/s.height*100,p=(s.width-(t.left+t.width))/s.width*100,g=(s.height-(t.top+t.height))/s.height*100,u=t.left/s.width*100;return r.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,y=>{const h=1-y,f=l*h,$=p*h,x=g*h,m=u*h;r.style.clipPath=`inset(${f}% ${$}% ${x}% ${m}%)`,r.style.transform=`translate(${i*h-d.x}px, ${o*h-d.y}px) scale(${1+(c-1)*h})`}}function wt(t,e,s){const d=t.querySelector("[data-pinterest-detail-key]"),r=e.querySelector("[data-pinterest-detail-key]");if(t.querySelectorAll("[data-pinterest-detail-key]").length>1||e.querySelectorAll("[data-pinterest-detail-key]").length>1)return null;let i=null,o=null,n=!1;if(!d&&r){o=r;const l=o.getAttribute("data-pinterest-detail-key");if(!l)return null;i=t.querySelector(`[data-pinterest-gallery-key="${l}"]`),i&&(n=!0)}else if(d&&!r){o=d;const l=o.getAttribute("data-pinterest-detail-key");if(!l)return null;i=e.querySelector(`[data-pinterest-gallery-key="${l}"]`),i&&(n=!1)}if(!i||!o)return null;const a=w.getRect(n?t:e,i),c=w.getRect(n?e:t,o);return n?{inAnimation:ft({detailRect:c,galleryRect:a,pageRect:e.getBoundingClientRect(),scrollOffset:s},e),outAnimation:$t({galleryRect:a,detailRect:c,scrollOffset:s},t)}:{inAnimation:xt({galleryRect:a,detailRect:c,scrollOffset:s},e),outAnimation:mt({detailRect:c,galleryRect:a,pageRect:t.getBoundingClientRect(),scrollOffset:s},t)}}const bt=(t={})=>{var o,n;const e={stiffness:((o=t.spring)==null?void 0:o.stiffness)??30,damping:((n=t.spring)==null?void 0:n.damping)??10},s=t.timeout??300;let d=null,r=null,i=null;return{in:async(a,{scrollOffset:c})=>{const l=a;return!await new Promise(g=>{d?g(!0):(r=g,setTimeout(()=>{r=null,g(!1)},s))})||!d?(d=null,{spring:e,tick:()=>{}}):(i=wt(d,l,c),i?(d=null,{spring:e,tick:g=>{i&&i.inAnimation(g)}}):{spring:e,tick:()=>{}})},out:async a=>({spring:e,onStart:()=>{d=a,r&&(r(!0),r=null)},prepare:c=>{w.prepareOutgoing(c),c.style.zIndex="-1"},tick:c=>{i&&i.outAnimation(c)}})}},D={stiffness:5,damping:4},Et=(t={})=>{var a,c;const e=t.direction??"up",s={stiffness:((a=t.spring)==null?void 0:a.stiffness)??D.stiffness,damping:((c=t.spring)==null?void 0:c.damping)??D.damping},d=e==="up";let r=null,i=null,o=null;const n=()=>{if(r===null||i===null)return null;const l=Math.min(r,i),p=window.innerHeight;return Math.max(l,p)};return{in:l=>(i=l.offsetHeight,r!==null&&(o=n()),{spring:s,tick:p=>{if(o===null&&(o=n(),o===null))return;const g=d?(1-p)*o:(1-p)*-o;l.style.transform=`translateY(${g}px)`}}),out:l=>({spring:s,onStart:()=>{r=l.offsetHeight,i!==null&&(o=n())},tick:p=>{if(o===null&&(o=n(),o===null))return;const g=d?(1-p)*-o:(1-p)*o;l.style.transform=`translateY(${g}px)`},prepare:p=>{w.prepareOutgoing(p),p.style.zIndex=d?"-1":"1"}})}},O={stiffness:15,damping:7},At=(t={})=>{var r,i;const e=t.direction??"left",s={stiffness:((r=t.spring)==null?void 0:r.stiffness)??O.stiffness,damping:((i=t.spring)==null?void 0:i.damping)??O.damping},d=e==="left";return{in:o=>({spring:s,tick:n=>{const a=d?(1-n)*100:(1-n)*-100;o.style.transform=`translateX(${a}%)`}}),out:(o,n)=>({spring:s,tick:a=>{const c=d?(1-a)*-100:(1-a)*100;o.style.transform=`translateX(${c}%)`},prepare:a=>{w.prepareOutgoing(a,n),a.style.zIndex=d?"-1":"1"}})}},v={stiffness:17,damping:6},k=20,C=800,Lt=()=>{let t,e=null;return{in:s=>({spring:v,prepare:d=>{d.style.transform=`perspective(${C}px) rotateY(${k}deg) translateX(-100%)`},wait:async()=>{t&&await t},tick:d=>{const r=(1-d)*k,i=-(1-d)*100;s.style.transform=`perspective(${C}px) rotateY(${r}deg) translateX(${i}%)`},onEnd:()=>{s.style.transform=""}}),out:(s,d)=>(t=new Promise(r=>{e=r}),{spring:v,prepare:r=>{w.prepareOutgoing(r,d)},tick:r=>{const i=1-r,o=i*k,n=i*100;s.style.transform=`perspective(${C}px) rotateY(${-o}deg) translateX(${n}%)`},onEnd:()=>{e&&e(),s.style.transform=""}})}},Tt={stiffness:1,damping:1},St={stiffness:20,damping:25},kt="#000000",Ct="circle",F="CURTAIN_REVEAL_OVERLAY_ID",Pt={position:"fixed",inset:"0",width:"100vw",height:"100%",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},_t={position:"relative",display:"inline-block",height:"5.5rem",overflow:"hidden"},It={display:"flex",height:"100%",willChange:"transform",transition:"transform 0.3s ease"},Dt={display:"inline-flex",alignItems:"center",justifyContent:"center",whiteSpace:"nowrap",fontSize:"5.5rem",fontWeight:"900",letterSpacing:"0.02em",color:"#FFFFFF"},Ot=.4,S=.5,vt=.2;function Ft(t,e){switch(t){case"circle":return`circle(${e*100}% at 50% 50%)`;case"square":return`inset(${(1-e)*50}% round ${10*e}%)`;case"triangle":{const s=e*100;return`polygon(50% ${50-s}%, ${50-s}% ${50+s}%, ${50+s}% ${50+s}%)`}}}const Yt=t=>t.reduce((e,s)=>e+s,0),Ut=(t={})=>{const{background:e=kt,texts:s=[],shape:d=Ct,inSpring:r=St,outSpring:i=Tt,textStyle:o={}}=t;return{out:(n,a)=>{const c=n.style.opacity;return{spring:i,from:1,to:0,prepare:l=>{w.prepareOutgoing(l,a),l.style.opacity="1"},tick:l=>{const p=Math.max(0,l-Ot);n.style.opacity=String(p)},onEnd:()=>{n.style.opacity=c}}},in:n=>{let a=null,c=null,l=null;const p=document.body.style.overflow,g=document.getElementById(F);let u=[];const y=()=>{a=document.createElement("div"),a.id=F,Object.assign(a.style,Pt,{background:e}),document.body.appendChild(a),c=document.createElement("div"),Object.assign(c.style,_t),a.appendChild(c),l=document.createElement("div"),Object.assign(l.style,It),c.appendChild(l),s.forEach(h=>{const f=document.createElement("div");f.textContent=h,Object.assign(f.style,Dt,o),l.appendChild(f)}),u=Array.from(l.children).map(h=>h.getBoundingClientRect().width)};return{spring:r,from:0,to:1,prepare:()=>{document.body.style.overflow="hidden",n.style.opacity="1",g==null||g.remove(),y(),a&&c&&(a.style.clipPath="none",c.style.transform="scale(1)")},tick:h=>{if(!(!a||!c||!l)){if(h<=S&&s.length>0){const f=h/S,$=Math.min(Math.floor(f*s.length),s.length-1),x=u[$]??0,m=Yt(u.slice(0,$));c.style.width=`${x}px`,l.style.transform=`translateX(-${m}px)`}if(h>S){const $=1-Math.max(0,Math.min(1,(h-S)/vt));a.style.clipPath=Ft(d,$),c.style.transform=`scale(${$})`}}},onEnd:()=>{a==null||a.remove(),a=c=l=null,document.body.style.overflow=p}}}}};exports.jaemin=w.jaemin;exports.blind=Z;exports.curtainReveal=Ut;exports.drill=J;exports.fade=nt;exports.film=lt;exports.hero=ht;exports.instagram=gt;exports.pinterest=bt;exports.scroll=Et;exports.slide=At;exports.strip=Lt;
|
|
30
|
+
`}f.push(x),h.appendChild(x)}return p.appendChild(h),{container:h,blinds:f}};return{out:()=>{let p=null;return a=new Promise(y=>{o=y}),{springs:Array.from({length:r},(y,u)=>({from:0,to:1,spring:i,offset:u*c,tick:h=>{if(!p)return;const f=p.blinds[u];f&&(s==="horizontal"?f.style.transform=`scaleX(${h})`:f.style.transform=`scaleY(${h})`)}})),schedule:"chain",prepare:y=>{m.prepareOutgoing(y),y.style.zIndex="1000",p=l(y,"hidden","left")},onStart:()=>{},onEnd:()=>{o&&o()}}},in:()=>{let p=null;return{springs:Array.from({length:r},(y,u)=>({from:1,to:0,spring:n,offset:u*c,tick:h=>{if(!p)return;const f=p.blinds[u];f&&(s==="horizontal"?f.style.transform=`scaleX(${h})`:f.style.transform=`scaleY(${h})`)}})),schedule:"chain",prepare:y=>{y.style.position="relative",y.style.zIndex="0",p=l(y,"closed","right")},onStart:()=>{},wait:async()=>{a&&await a,await Y(d)},onEnd:()=>{p&&p.container&&p.container.remove()}}}}},R={stiffness:150,damping:20},tt={stiffness:100,damping:20},nt=(t={})=>{var s,c;const{opacity:n=!1,direction:i="enter"}=t,d=i==="enter"?R:tt,r={stiffness:((s=t.spring)==null?void 0:s.stiffness)??d.stiffness,damping:((c=t.spring)==null?void 0:c.damping)??d.damping};return i==="enter"?{in:e=>({spring:r,prepare:()=>{e.style.willChange=n?"transform, opacity":"transform"},tick:a=>{e.style.transform=`translateX(${(1-a)*100}%)`,n&&(e.style.opacity=a.toString())},onEnd:()=>{e.style.willChange="auto"}}),out:(e,a)=>({spring:r,prepare:o=>{m.prepareOutgoing(o,a),o.style.zIndex="-1",o.style.willChange=n?"transform, opacity":"transform"},tick:o=>{e.style.transform=`translateX(${-(1-o)*20}%)`,n&&(e.style.opacity=o.toString())}})}:{in:e=>({spring:r,prepare:()=>{e.style.willChange=n?"transform, opacity":"transform"},tick:a=>{e.style.transform=`translateX(${-(1-a)*20}%)`,n&&(e.style.opacity=a.toString())},onEnd:()=>{e.style.willChange="auto"}}),out:(e,a)=>({spring:r,prepare:o=>{m.prepareOutgoing(o,a),o.style.willChange=n?"transform, opacity":"transform",o.style.zIndex="100"},tick:o=>{e.style.transform=`translateX(${(1-o)*100}%)`,n&&(e.style.opacity=o.toString())}})}},et={stiffness:65,damping:16},it={stiffness:65,damping:14},st=0,rt=(t={})=>{const{inSpring:n=it,outSpring:i=et,transitionDelay:d=st}=t;let r,s=null;return{in:c=>({spring:n,prepare:e=>{e.style.opacity="0",e.style.willChange="opacity"},wait:async()=>{r&&(await r,await Y(d))},tick:e=>{const a=q(e,2);c.style.opacity=a.toString()},onEnd:()=>{c.style.willChange="auto"}}),out:(c,e)=>(r=new Promise(a=>{s=a}),{spring:i,tick:a=>{c.style.opacity=a.toString()},prepare:()=>{m.prepareOutgoing(c,e),c.style.willChange="opacity"},onEnd:()=>{s&&s(),c.style.willChange="auto"}})}},lt={stiffness:5,damping:3.5},at=.8,ot="white",b={start:0,end:.45},E={start:.85,end:1},A={start:.2,end:.9},ct=t=>{var r;const n=(t==null?void 0:t.spring)??lt,i=(t==null?void 0:t.scale)??at,d=((r=t==null?void 0:t.border)==null?void 0:r.color)??ot;return{out:async(s,c)=>{const e=P(c),a=m.getRect(document.body,c.positionedParent),o=ht(d,{...e,top:a.top});let l=1,p=-e.top;return{spring:n,prepare:()=>{m.prepareOutgoing(s),_(s,e),I(s,e),pt(s,e);for(const g of o)c.positionedParent.appendChild(g)},onEnd:()=>{s.style.clipPath="",s.style.transformOrigin="",setTimeout(()=>{for(const g of o)c.positionedParent.removeChild(g)},1e3)},tick:g=>{const y=1-g;if(b.start<=y&&y<=b.end){const f=L(y,b.start,b.end);l=1-(1-i)*f}if(E.start<=y&&y<=E.end){const f=L(y,E.start,E.end);l=i+(1-i)*f}if(A.start<=y&&y<=A.end){const f=L(y,A.start,A.end);p=-e.top-e.height*f}s.style.transform=`translateY(${p}px) scale(${l})`;const u=(e.width-e.width*l)/2,h=(e.height-e.height*l)/2;dt(o,u,h)}}},in:async(s,c)=>{const e=P(c);let a=i,o=-e.top+e.height;return{spring:n,prepare:()=>{_(s,e),I(s,e),s.style.transform=`translateY(${-e.top+e.height}px) scale(${i})`},onEnd:()=>{s.style.clipPath="",s.style.transformOrigin="",s.style.transform=""},tick:l=>{if(b.start<=l&&l<=b.end){const p=L(l,b.start,b.end);a=1-(1-i)*p}if(E.start<=l&&l<=E.end){const p=L(l,E.start,E.end);a=i+(1-i)*p}if(A.start<=l&&l<=A.end){const p=L(l,A.start,A.end);o=-e.top+e.height*(1-p)}s.style.transform=`translateY(${o}px) scale(${a})`}}}}};function dt(t,n,i){const d=n*.7,r=i*.7;t.topLeft.style.transform=`translate(${d}px, ${r}px)`,t.topRight.style.transform=`translate(${-d}px, ${r}px)`,t.bottomLeft.style.transform=`translate(${d}px, ${-r}px)`,t.bottomRight.style.transform=`translate(${-d}px, ${-r}px)`}function ht(t="white",n){const r=document.createElement("div");r.style.position="fixed",r.style.pointerEvents="none",r.style.zIndex="9999",r.style.top=`${n.top-1}px`,r.style.left=`${n.left-1}px`,r.style.width="15px",r.style.height="15px";const s=document.createElement("div");s.style.position="absolute",s.style.width="15px",s.style.height="1px",s.style.backgroundColor=t,s.style.top="0",s.style.left="0";const c=document.createElement("div");c.style.position="absolute",c.style.width="1px",c.style.height="15px",c.style.backgroundColor=t,c.style.top="0",c.style.left="0",r.appendChild(s),r.appendChild(c);const e=document.createElement("div");e.style.position="fixed",e.style.pointerEvents="none",e.style.zIndex="9999",e.style.top=`${n.top-1}px`,e.style.left=`${n.left+n.width-15+1}px`,e.style.width="15px",e.style.height="15px";const a=document.createElement("div");a.style.position="absolute",a.style.width="15px",a.style.height="1px",a.style.backgroundColor=t,a.style.top="0",a.style.right="0";const o=document.createElement("div");o.style.position="absolute",o.style.width="1px",o.style.height="15px",o.style.backgroundColor=t,o.style.top="0",o.style.right="0",e.appendChild(a),e.appendChild(o);const l=document.createElement("div");l.style.position="fixed",l.style.pointerEvents="none",l.style.zIndex="9999",l.style.top=`${n.top+n.height-15+1}px`,l.style.left=`${n.left-1}px`,l.style.width="15px",l.style.height="15px";const p=document.createElement("div");p.style.position="absolute",p.style.width="15px",p.style.height="1px",p.style.backgroundColor=t,p.style.bottom="0",p.style.left="0";const g=document.createElement("div");g.style.position="absolute",g.style.width="1px",g.style.height="15px",g.style.backgroundColor=t,g.style.bottom="0",g.style.left="0",l.appendChild(p),l.appendChild(g);const y=document.createElement("div");y.style.position="fixed",y.style.pointerEvents="none",y.style.zIndex="9999",y.style.top=`${n.top+n.height-15+1}px`,y.style.left=`${n.left+n.width-15+1}px`,y.style.width="15px",y.style.height="15px";const u=document.createElement("div");u.style.position="absolute",u.style.width="15px",u.style.height="1px",u.style.backgroundColor=t,u.style.bottom="0",u.style.right="0";const h=document.createElement("div");return h.style.position="absolute",h.style.width="1px",h.style.height="15px",h.style.backgroundColor=t,h.style.bottom="0",h.style.right="0",y.appendChild(u),y.appendChild(h),{topLeft:r,topRight:e,bottomLeft:l,bottomRight:y,*[Symbol.iterator](){yield r,yield e,yield l,yield y}}}function P(t){const n=m.getRect(document.body,t.positionedParent);return{top:t.scroll.y,left:0,width:n.width,height:window.innerHeight-n.top}}function _(t,n){const i=n.left+n.width/2,d=n.top+n.height/2;t.style.transformOrigin=`${i}px ${d}px`}function I(t,n){t.style.clipPath=`polygon(
|
|
31
|
+
${n.left}px ${n.top}px,
|
|
32
|
+
${n.left+n.width}px ${n.top}px,
|
|
33
|
+
${n.left+n.width}px ${n.top+n.height}px,
|
|
34
|
+
${n.left}px ${n.top+n.height}px
|
|
35
|
+
)`}function pt(t,n){t.style.transform=`translateY(${-n.top}px)`}function L(t,n,i){return t<=n?0:t>=i?1:(t-n)/(i-n)}function ut(t,n){return t.querySelector(`[data-hero-key="${n}"]`)}const yt=(t={})=>{var c,e;const n={stiffness:((c=t.spring)==null?void 0:c.stiffness)??300,damping:((e=t.spring)==null?void 0:e.damping)??30},i=t.timeout??300,d=t.maxDistance??700;let r=null,s=null;return{in:async(a,o)=>{const l=a,p=Array.from(l.querySelectorAll("[data-hero-key]"));if(p.length===0)return{spring:n,tick:()=>{}};if(!await new Promise(u=>{r?u(!0):(s=u,setTimeout(()=>{s=null,u(!1)},i))})||!r)return r=null,{spring:n,tick:()=>{}};const y=p.map(u=>{const h=u.getAttribute("data-hero-key");if(!h)return null;const f=ut(r,h);if(!f)return null;const $=u,x=m.getRect(r,f),w=m.getRect(l,$),C=x.left-w.left-o.scrollOffset.x,U=x.top-w.top-o.scrollOffset.y,X=x.width/w.width,W=x.height/w.height,z=$.style.transform,B=$.style.position,M=$.style.transformOrigin,H=$.style.zIndex,N=$.style.willChange;return{toEl:$,dx:C,dy:U,dw:X,dh:W,originalTransform:z,originalPosition:B,originalTransformOrigin:M,originalZIndex:H,originalWillChange:N}}).filter(u=>u!==null&&Math.abs(u.dy)<=d);return r=null,y.length===0?{spring:n,tick:()=>{}}:{spring:n,prepare:()=>{y.forEach(({toEl:u})=>{u.style.position="relative",u.style.transformOrigin="top left",u.style.zIndex="1000",u.style.willChange="transform"})},tick:u=>{y.forEach(({toEl:h,dx:f,dy:$,dw:x,dh:w})=>{h.style.transform=`translate(${(1-u)*f}px,${(1-u)*$}px) scale(${u+(1-u)*x}, ${u+(1-u)*w})`})},onEnd:()=>{y.forEach(({toEl:u,originalTransform:h,originalPosition:f,originalTransformOrigin:$,originalZIndex:x,originalWillChange:w})=>{u.style.transform=h,u.style.position=f,u.style.transformOrigin=$,u.style.zIndex=x,u.style.willChange=w})}}},out:async a=>({onStart:()=>{r=a,s&&(s(!0),s=null)},prepare:o=>{m.prepareOutgoing(o),o.style.opacity="0"}})}};function gt({detailRect:t,galleryRect:n,pageRect:i,scrollOffset:d},r){const s=n.left-t.left+(n.width-t.width)/2-d.x,c=n.top-t.top+(n.height-t.height)/2-d.y,e=n.width/t.width,a=n.height/t.height,o=Math.max(e,a),l=t.top/i.height*100,p=(i.width-(t.left+t.width))/i.width*100,g=(i.height-(t.top+t.height))/i.height*100,y=t.left/i.width*100;return r.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,u=>{const h=1-u,f=l*h,$=p*h,x=g*h,w=y*h;r.style.clipPath=`inset(${f}% ${$}% ${x}% ${w}%)`,r.style.transform=`translate(${s*h}px, ${c*h}px) scale(${1+(o-1)*h})`}}function ft({detailRect:t,galleryRect:n,pageRect:i,scrollOffset:d},r){const s=n.left-t.left+(n.width-t.width)/2+d.x,c=n.top-t.top+(n.height-t.height)/2+d.y,e=n.width/t.width,a=n.height/t.height,o=Math.min(e,a),l=t.top/i.height*100,p=(i.width-(t.left+t.width))/i.width*100,g=(i.height-(t.top+t.height))/i.height*100,y=t.left/i.width*100;return r.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,u=>{const h=1-u,f=l*h,$=p*h,x=g*h,w=y*h;r.style.clipPath=`inset(${f}% ${$}% ${x}% ${w}%)`,r.style.transform=`translate(${s*h-d.x}px, ${c*h-d.y}px) scale(${1+(o-1)*h})`}}function $t(t,n,i){const d=t.querySelector("[data-instagram-detail-key]"),r=n.querySelector("[data-instagram-detail-key]");if(t.querySelectorAll("[data-instagram-detail-key]").length>1||n.querySelectorAll("[data-instagram-detail-key]").length>1)return null;let s=null,c=null,e=!1;if(!d&&r){c=r;const l=c.getAttribute("data-instagram-detail-key");if(!l)return null;s=t.querySelector(`[data-instagram-gallery-key="${l}"]`),s&&(e=!0)}else if(d&&!r){c=d;const l=c.getAttribute("data-instagram-detail-key");if(!l)return null;s=n.querySelector(`[data-instagram-gallery-key="${l}"]`),s&&(e=!1)}if(!s||!c)return null;const a=m.getRect(e?t:n,s),o=m.getRect(e?n:t,c);return e?{isEnterMode:!0,inAnimation:gt({detailRect:o,galleryRect:a,pageRect:n.getBoundingClientRect(),scrollOffset:i},n)}:{isEnterMode:!1,outAnimation:ft({detailRect:o,galleryRect:a,pageRect:t.getBoundingClientRect(),scrollOffset:i},t)}}const wt=(t={})=>{var c,e;const n={stiffness:((c=t.spring)==null?void 0:c.stiffness)??150,damping:((e=t.spring)==null?void 0:e.damping)??20},i=t.timeout??300;let d=null,r=null,s=null;return{in:async(a,{scrollOffset:o})=>{const l=a;return!await new Promise(g=>{d?g(!0):(r=g,setTimeout(()=>{r=null,g(!1)},i))})||!d?(d=null,{spring:n,tick:()=>{}}):(s=$t(d,l,o),s?(d=null,{spring:n,tick:g=>{s!=null&&s.inAnimation&&s.inAnimation(g)}}):{spring:n,tick:()=>{}})},out:async(a,o)=>({spring:n,onStart:()=>{d=a,r&&(r(!0),r=null)},prepare:l=>{m.prepareOutgoing(l,o),s!=null&&s.isEnterMode||(l.style.zIndex="-1")},tick:l=>{s!=null&&s.outAnimation&&s.outAnimation(l)}})}};function xt({detailRect:t,galleryRect:n,pageRect:i,scrollOffset:d},r){const s=n.left-t.left+(n.width-t.width)/2-d.x,c=n.top-t.top+(n.height-t.height)/2-d.y,e=n.width/t.width,a=n.height/t.height,o=Math.max(e,a),l=t.top/i.height*100,p=(i.width-(t.left+t.width))/i.width*100,g=(i.height-(t.top+t.height))/i.height*100,y=t.left/i.width*100;return r.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,u=>{const h=1-u,f=l*h,$=p*h,x=g*h,w=y*h;r.style.clipPath=`inset(${f}% ${$}% ${x}% ${w}%)`,r.style.transform=`translate(${s*h}px, ${c*h}px) scale(${1+(o-1)*h})`}}function mt({galleryRect:t,detailRect:n,scrollOffset:i},d){const r=n.left-t.left+(n.width-t.width)/2+i.x,s=n.top-t.top+(n.height-t.height)/2+i.y,c=n.width/t.width,e=n.height/t.height,a=Math.max(c,e);return o=>{d.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`;const l=1-o;d.style.transform=`translate(${r*l-i.x}px, ${s*l-i.y}px) scale(${1+(a-1)*l})`,d.style.opacity=`${1-l}`}}function bt({galleryRect:t,detailRect:n,scrollOffset:i},d){const r=n.left-t.left+(n.width-t.width)/2-i.x,s=n.top-t.top+(n.height-t.height)/2-i.y,c=n.width/t.width,e=n.height/t.height,a=Math.max(c,e);return o=>{const l=1-o,p=o;d.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,d.style.transform=`translate(${r*l}px, ${s*l}px) scale(${1+(a-1)*l})`,d.style.opacity=`${p}`}}function Et({detailRect:t,galleryRect:n,pageRect:i,scrollOffset:d},r){const s=n.left-t.left+(n.width-t.width)/2+d.x,c=n.top-t.top+(n.height-t.height)/2+d.y,e=n.width/t.width,a=n.height/t.height,o=Math.min(e,a),l=t.top/i.height*100,p=(i.width-(t.left+t.width))/i.width*100,g=(i.height-(t.top+t.height))/i.height*100,y=t.left/i.width*100;return r.style.transformOrigin=`${t.left+t.width/2}px ${t.top+t.height/2}px`,u=>{const h=1-u,f=l*h,$=p*h,x=g*h,w=y*h;r.style.clipPath=`inset(${f}% ${$}% ${x}% ${w}%)`,r.style.transform=`translate(${s*h-d.x}px, ${c*h-d.y}px) scale(${1+(o-1)*h})`}}function At(t,n,i){const d=t.querySelector("[data-pinterest-detail-key]"),r=n.querySelector("[data-pinterest-detail-key]");if(t.querySelectorAll("[data-pinterest-detail-key]").length>1||n.querySelectorAll("[data-pinterest-detail-key]").length>1)return null;let s=null,c=null,e=!1;if(!d&&r){c=r;const l=c.getAttribute("data-pinterest-detail-key");if(!l)return null;s=t.querySelector(`[data-pinterest-gallery-key="${l}"]`),s&&(e=!0)}else if(d&&!r){c=d;const l=c.getAttribute("data-pinterest-detail-key");if(!l)return null;s=n.querySelector(`[data-pinterest-gallery-key="${l}"]`),s&&(e=!1)}if(!s||!c)return null;const a=m.getRect(e?t:n,s),o=m.getRect(e?n:t,c);return e?{inAnimation:xt({detailRect:o,galleryRect:a,pageRect:n.getBoundingClientRect(),scrollOffset:i},n),outAnimation:mt({galleryRect:a,detailRect:o,scrollOffset:i},t)}:{inAnimation:bt({galleryRect:a,detailRect:o,scrollOffset:i},n),outAnimation:Et({detailRect:o,galleryRect:a,pageRect:t.getBoundingClientRect(),scrollOffset:i},t)}}const Lt=(t={})=>{var c,e;const n={stiffness:((c=t.spring)==null?void 0:c.stiffness)??30,damping:((e=t.spring)==null?void 0:e.damping)??10},i=t.timeout??300;let d=null,r=null,s=null;return{in:async(a,{scrollOffset:o})=>{const l=a;return!await new Promise(g=>{d?g(!0):(r=g,setTimeout(()=>{r=null,g(!1)},i))})||!d?(d=null,{spring:n,tick:()=>{}}):(s=At(d,l,o),s?(d=null,{spring:n,tick:g=>{s&&s.inAnimation(g)}}):{spring:n,tick:()=>{}})},out:async a=>({spring:n,onStart:()=>{d=a,r&&(r(!0),r=null)},prepare:o=>{m.prepareOutgoing(o),o.style.zIndex="-1"},tick:o=>{s&&s.outAnimation(o)}})}},D={stiffness:5,damping:4},Ct=(t={})=>{var a,o;const n=t.direction??"up",i={stiffness:((a=t.spring)==null?void 0:a.stiffness)??D.stiffness,damping:((o=t.spring)==null?void 0:o.damping)??D.damping},d=n==="up";let r=null,s=null,c=null;const e=()=>{if(r===null||s===null)return null;const l=Math.min(r,s),p=window.innerHeight;return Math.max(l,p)};return{in:l=>(s=l.offsetHeight,r!==null&&(c=e()),{spring:i,prepare:()=>{l.style.willChange="transform"},tick:p=>{if(c===null&&(c=e(),c===null))return;const g=d?(1-p)*c:(1-p)*-c;l.style.transform=`translateY(${g}px)`},onEnd:()=>{l.style.willChange="auto"}}),out:l=>({spring:i,onStart:()=>{r=l.offsetHeight,s!==null&&(c=e())},tick:p=>{if(c===null&&(c=e(),c===null))return;const g=d?(1-p)*-c:(1-p)*c;l.style.transform=`translateY(${g}px)`},prepare:p=>{m.prepareOutgoing(p),p.style.zIndex=d?"-1":"1",p.style.willChange="transform"}})}},O={stiffness:15,damping:7},Tt=(t={})=>{var r,s;const n=t.direction??"left",i={stiffness:((r=t.spring)==null?void 0:r.stiffness)??O.stiffness,damping:((s=t.spring)==null?void 0:s.damping)??O.damping},d=n==="left";return{in:c=>({spring:i,prepare:()=>{c.style.willChange="transform"},tick:e=>{const a=d?(1-e)*100:(1-e)*-100;c.style.transform=`translateX(${a}%)`},onEnd:()=>{c.style.willChange="auto"}}),out:(c,e)=>({spring:i,tick:a=>{const o=d?(1-a)*-100:(1-a)*100;c.style.transform=`translateX(${o}%)`},prepare:a=>{m.prepareOutgoing(a,e),a.style.zIndex=d?"-1":"1",a.style.willChange="transform"}})}},v={stiffness:17,damping:6},S=20,k=800,St=()=>{let t,n=null;return{in:i=>({spring:v,prepare:d=>{d.style.willChange="transform",d.style.transform=`perspective(${k}px) rotateY(${S}deg) translateX(-100%)`},wait:async()=>{t&&await t},tick:d=>{const r=(1-d)*S,s=-(1-d)*100;i.style.transform=`perspective(${k}px) rotateY(${r}deg) translateX(${s}%)`},onEnd:()=>{i.style.transform="",i.style.willChange="auto"}}),out:(i,d)=>(t=new Promise(r=>{n=r}),{spring:v,prepare:r=>{m.prepareOutgoing(r,d),r.style.willChange="transform"},tick:r=>{const s=1-r,c=s*S,e=s*100;i.style.transform=`perspective(${k}px) rotateY(${-c}deg) translateX(${e}%)`},onEnd:()=>{n&&n(),i.style.transform=""}})}},kt={stiffness:1,damping:1},Pt={stiffness:20,damping:25},_t="#000000",It="circle",F="CURTAIN_REVEAL_OVERLAY_ID",Dt={position:"fixed",inset:"0",width:"100vw",height:"100%",zIndex:"9999",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},Ot={position:"relative",display:"inline-block",height:"5.5rem",overflow:"hidden"},vt={display:"flex",height:"100%",willChange:"transform",transition:"transform 0.3s ease"},Ft={display:"inline-flex",alignItems:"center",justifyContent:"center",whiteSpace:"nowrap",fontSize:"5.5rem",fontWeight:"900",letterSpacing:"0.02em",color:"#FFFFFF"},Yt=.4,T=.5,Ut=.2;function Xt(t,n){switch(t){case"circle":return`circle(${n*100}% at 50% 50%)`;case"square":return`inset(${(1-n)*50}% round ${10*n}%)`;case"triangle":{const i=n*100;return`polygon(50% ${50-i}%, ${50-i}% ${50+i}%, ${50+i}% ${50+i}%)`}}}const Wt=t=>t.reduce((n,i)=>n+i,0),zt=(t={})=>{const{background:n=_t,texts:i=[],shape:d=It,inSpring:r=Pt,outSpring:s=kt,textStyle:c={}}=t;return{out:(e,a)=>{const o=e.style.opacity;return{spring:s,from:1,to:0,prepare:l=>{m.prepareOutgoing(l,a),l.style.opacity="1"},tick:l=>{const p=Math.max(0,l-Yt);e.style.opacity=String(p)},onEnd:()=>{e.style.opacity=o}}},in:e=>{let a=null,o=null,l=null;const p=document.body.style.overflow,g=document.getElementById(F);let y=[];const u=()=>{a=document.createElement("div"),a.id=F,Object.assign(a.style,Dt,{background:n}),document.body.appendChild(a),o=document.createElement("div"),Object.assign(o.style,Ot),a.appendChild(o),l=document.createElement("div"),Object.assign(l.style,vt),o.appendChild(l),i.forEach(h=>{const f=document.createElement("div");f.textContent=h,Object.assign(f.style,Ft,c),l.appendChild(f)}),y=Array.from(l.children).map(h=>h.getBoundingClientRect().width)};return{spring:r,from:0,to:1,prepare:()=>{document.body.style.overflow="hidden",e.style.opacity="1",g==null||g.remove(),u(),a&&o&&(a.style.clipPath="none",o.style.transform="scale(1)")},tick:h=>{if(!(!a||!o||!l)){if(h<=T&&i.length>0){const f=h/T,$=Math.min(Math.floor(f*i.length),i.length-1),x=y[$]??0,w=Wt(y.slice(0,$));o.style.width=`${x}px`,l.style.transform=`translateX(-${w}px)`}if(h>T){const $=1-Math.max(0,Math.min(1,(h-T)/Ut));a.style.clipPath=Xt(d,$),o.style.transform=`scale(${$})`}}},onEnd:()=>{a==null||a.remove(),a=o=l=null,document.body.style.overflow=p}}}}};exports.jaemin=m.jaemin;exports.blind=Q;exports.curtainReveal=zt;exports.drill=nt;exports.fade=rt;exports.film=ct;exports.hero=yt;exports.instagram=wt;exports.pinterest=Lt;exports.scroll=Ct;exports.slide=Tt;exports.strip=St;
|