Version not found. Please check the version and try again.

@ssgoi/core 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"create-ssgoi-transition-context.d.ts","sourceRoot":"","sources":["../src/lib/create-ssgoi-transition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAGb,MAAM,SAAS,CAAC;AAyJjB;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,GACnB,YAAY,CAwId"}
1
+ {"version":3,"file":"create-ssgoi-transition-context.d.ts","sourceRoot":"","sources":["../src/lib/create-ssgoi-transition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAGb,MAAM,SAAS,CAAC;AAmNjB;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,GACnB,YAAY,CAkJd"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var I=Object.defineProperty;var N=(o,t,n)=>t in o?I(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n;var g=(o,t,n)=>N(o,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("popmotion");class E{constructor(t){g(this,"options");g(this,"currentValue");g(this,"velocity");g(this,"isAnimating",!1);g(this,"controls",null);g(this,"animationMap",null);g(this,"activeAnimations",new Set);g(this,"completedAnimations",new Set);g(this,"updatedProperties",new Set);g(this,"animate",(t=!1)=>{!this.isAnimating&&this.options.onStart&&this.options.onStart(),this.isAnimating=!0;const n=t?this.options.from:this.options.to;if(typeof this.currentValue=="object"&&this.currentValue!==null){this.animateObject(n);return}let e=this.currentValue,i=performance.now();const f={from:this.currentValue,to:n,stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="number"&&(f.velocity=this.velocity*1e3),this.controls=R.animate({...f,onUpdate:l=>{const h=performance.now(),a=(h-i)/1e3;if(a>0){if(typeof l=="number"&&typeof e=="number"){const p=(l-e)/a;this.velocity=p/1e3}else if(typeof l=="object"&&l!==null){const p={};Object.keys(l).forEach(c=>{const s=l[c],u=e[c];if(typeof s=="number"&&typeof u=="number"){const d=(s-u)/a;p[c]=d/1e3}}),this.velocity=p}e=l,i=h}this.currentValue=l,this.options.onUpdate(l)},onComplete:()=>{this.currentValue=n,this.isAnimating=!1,this.controls=null,typeof this.velocity=="object"&&this.velocity!==null?Object.keys(this.velocity).forEach(l=>{this.velocity[l]=0}):this.velocity=0,this.options.onComplete()}})});g(this,"animateObject",t=>{const n=this.currentValue,e=Object.keys(n);this.animationMap=new Map,this.activeAnimations.clear(),this.completedAnimations.clear(),this.updatedProperties.clear();const i={...n},f={};let l=!1;const h=()=>{const a=e.filter(c=>!this.completedAnimations.has(c));if(a.every(c=>this.updatedProperties.has(c))&&a.length>0){if(typeof this.velocity=="object"&&this.velocity){const c=performance.now();Object.keys(i).forEach(s=>{if(f[s]){const u=(c-f[s])/1e3,d=this.currentValue[s],r=i[s];typeof d=="number"&&typeof r=="number"&&u>0&&(this.velocity[s]=(r-d)/u/1e3)}f[s]=c})}this.currentValue={...i},this.options.onUpdate(this.currentValue),this.updatedProperties.clear(),!l&&this.options.onStart&&(l=!0,this.options.onStart())}};e.forEach(a=>{this.activeAnimations.add(a);const p={from:n[a],to:t[a],stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="object"&&this.velocity&&a in this.velocity&&(p.velocity=this.velocity[a]*1e3);const c=R.animate({...p,onUpdate:s=>{i[a]=s,this.updatedProperties.add(a),h()},onComplete:()=>{this.completedAnimations.add(a),this.updatedProperties.delete(a),this.completedAnimations.size===e.length&&(this.currentValue=t,this.isAnimating=!1,this.animationMap=null,typeof this.velocity=="object"&&this.velocity&&Object.keys(this.velocity).forEach(s=>{this.velocity[s]=0}),this.options.onComplete())}});this.animationMap.set(a,c)})});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 n={};Object.keys(this.options.from).forEach(e=>{n[e]=0}),this.velocity=n}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 n=this.shouldReverse();this.stop(),this.animate(!n)}}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{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 n=this.shouldReverse();this.stop(),this.animate(!n)}}static fromState(t,n){const e=new E(n);return e.setValue(t.position),e.setVelocity(t.velocity),e}}const V=Symbol.for("TRANSITION_STRATEGY"),j=o=>({runIn:async t=>{const{currentAnimation:n}=o;if(n&&n.direction==="out"){const l=n.animator.getCurrentState();if(n.animator.stop(),t.out){const h=await t.out,{from:a=1,to:p=0}=h;return{config:h,state:l,from:a,to:p,direction:"backward"}}}const e=await t.in;if(!e)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:i=0,to:f=1}=e;return{config:e,state:{position:i,velocity:0},from:i,to:f,direction:"forward"}},runOut:async t=>{const{currentAnimation:n}=o;if(n&&n.direction==="in"){const l=n.animator.getCurrentState();if(n.animator.stop(),t.in){const h=await t.in,{from:a=0,to:p=1}=h;return{config:h,state:{position:l.position,velocity:l.velocity},from:a,to:p,direction:"backward"}}}const e=await t.out;if(!e)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:i=1,to:f=0}=e;return{config:e,state:{position:i,velocity:0},from:i,to:f,direction:"forward"}}}),M=()=>({runIn:async o=>{const t=await o.in;if(!t)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:n=0,to:e=1}=t;return{config:t,state:{position:n,velocity:0},from:n,to:e,direction:"forward"}},runOut:async o=>{const t=await o.out;if(!t)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:n=1,to:e=0}=t;return{config:t,state:{position:n,velocity:0},from:n,to:e,direction:"forward"}}});function D(o,t){var c;let n=null,e=null,i=null,f=null;const l={get currentAnimation(){return n}},h=((c=t==null?void 0:t.strategy)==null?void 0:c.call(t,l))||j(l),a=async s=>{var y,v;e&&(e.remove(),e=null);const u=o(),d={in:u.in&&Promise.resolve(u.in(s)),out:u.out&&Promise.resolve(u.out(s))},r=await h.runIn(d);if(!r.config)return;(v=(y=r.config).prepare)==null||v.call(y,s),r.config.wait&&await r.config.wait();const m=E.fromState(r.state,{from:r.from,to:r.to,spring:r.config.spring,onStart:r.config.onStart,onUpdate:r.config.tick,onComplete:()=>{var w,S;n=null,(S=(w=r.config)==null?void 0:w.onEnd)==null||S.call(w)}});n={animator:m,direction:"in"},r.direction==="forward"?m.forward():m.backward()},p=async s=>{var v,w;e=s;const u=o(),d={in:u.in&&Promise.resolve(u.in(s)),out:u.out&&Promise.resolve(u.out(s))},r=await h.runOut(d);if(!r.config)return;(w=(v=r.config).prepare)==null||w.call(v,s),y(),r.config.wait&&await r.config.wait();const m=E.fromState(r.state,{from:r.from,to:r.to,spring:r.config.spring,onStart:r.config.onStart,onUpdate:r.config.tick,onComplete:()=>{var S,C,b;(C=(S=r.config)==null?void 0:S.onEnd)==null||C.call(S),e&&(e.remove(),e=null),n=null,(b=t==null?void 0:t.onCleanupEnd)==null||b.call(t)}});n={animator:m,direction:"out"},r.direction==="forward"?m.forward():m.backward();function y(){!i||!e||(f&&i.contains(f)?i.insertBefore(e,f):i.appendChild(e))}};return s=>{if(s)return i=s.parentElement,f=s.nextElementSibling,a(s),()=>{const u=s.cloneNode(!0);p(u)}}}const z=3,K=o=>{if(!o)return null;const t=o.split(`
2
- `).map(n=>n.trim());for(let n=z;n<Math.min(t.length,6);n++){const e=t[n],i=e==null?void 0:e.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!i)continue;const f=i[1]??"",l=i[2]??"0",h=i[3]??"0";return{file:f.split(/[\\/]/).pop()||f,line:l,column:h}}return null},T=new Map,P=new Map;function $(o,t,n){T.set(o,t);let e=P.get(o);return e||(e=D(()=>{const i=T.get(o);return i||(console.warn(`Transition "${String(o)}" not found`),{})},{strategy:n,onCleanupEnd:()=>U(o)}),P.set(o,e),e)}function U(o){T.delete(o),P.delete(o)}function _(){const o=K(new Error().stack);return o?`auto_${o.file}_${o.line}_${o.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const O=globalThis.FinalizationRegistry,x=O?new O(o=>{try{U(o)}catch{}}):void 0;function F(o){const t=o.key??_();if(o.ref&&x)try{x.register(o.ref,t)}catch{}return $(t,{in:o.in,out:o.out},o[V])}const W=o=>{let t=o.parentElement;for(;t&&t!==document.body;){const n=window.getComputedStyle(t),e=n.overflow+n.overflowY+n.overflowX;if(e.includes("auto")||e.includes("scroll")||t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.parentElement}return document.documentElement},k=o=>{let t=o.parentElement;for(;t&&t!==document.body;){const n=window.getComputedStyle(t).position;if(n==="relative"||n==="absolute"||n==="fixed"||n==="sticky")return t;t=t.parentElement}return document.body};function L(o){const t=o.filter(n=>n.symmetric).map(n=>({from:n.to,to:n.from,transition:n.transition}));return[...o,...t]}function Y(){let o=null,t=null;const n=new Map;let e=null;const i=()=>{o&&e&&n.set(e,{x:o.scrollLeft,y:o.scrollTop})};return{initializeContext:(c,s)=>{t=c,o||(o=W(c),(o===document.documentElement?window:o).addEventListener("scroll",i,{passive:!0})),e=s},calculateScrollOffset:(c,s)=>{const u=c&&n.has(c)?n.get(c):{x:0,y:0},d=s&&n.has(s)?n.get(s):{x:0,y:0};return{x:-d.x+u.x,y:-d.y+u.y}},getScrollContainer:()=>o,getPositionedParentElement:()=>t?k(t):document.body,getScrollPosition:c=>c&&n.has(c)?n.get(c):{x:0,y:0}}}function G(o){const{transitions:t=[],defaultTransition:n,middleware:e=(r,m)=>({from:r,to:m})}=o;let i=null;const f=L(t),{initializeContext:l,calculateScrollOffset:h,getScrollContainer:a,getPositionedParentElement:p,getScrollPosition:c}=Y();function s(){if(i!=null&&i.from&&(i!=null&&i.to)){const{from:r,to:m}=e(i.from,i.to),v=H(r,m,f)||n,w=h(i.from,i.to),S={scrollOffset:w,scroll:c(i.from),get scrollingElement(){return a()||document.documentElement},get positionedParent(){return p()}},C={scrollOffset:w,get scroll(){return i?c(i.to):{x:0,y:0}},get scrollingElement(){return a()||document.documentElement},get positionedParent(){return p()}};v&&(v.out&&i.outResolve&&i.outResolve(b=>v.out(b,S)),v.in&&i.inResolve&&i.inResolve(b=>v.in(b,C))),i=null}}const u=async(r,m)=>m==="in"&&(!i||!i.from)?()=>({}):(i||(i={}),m==="out"?(i.from=r,new Promise(y=>{i.outResolve=y,s()})):(i.to=r,new Promise(y=>{i.inResolve=y,s()})));return r=>({key:r,in:async m=>(l(m,r),(await u(r,"in"))(m)),out:async m=>(await u(r,"out"))(m),[V]:M})}function H(o,t,n){for(const e of n)if(A(o,e.from)&&A(t,e.to))return e.transition;for(const e of n)if((e.from==="*"||A(o,e.from))&&(e.to==="*"||A(t,e.to)))return e.transition;return null}function A(o,t){if(t==="*")return!0;if(t.endsWith("/*")){const n=t.slice(0,-2);return o===n||o.startsWith(n+"/")}return o===t}exports.TRANSITION_STRATEGY=V;exports.createDefaultStrategy=j;exports.createPageTransitionStrategy=M;exports.createSggoiTransitionContext=G;exports.generateAutoKey=_;exports.transition=F;
1
+ "use strict";var N=Object.defineProperty;var z=(n,t,e)=>t in n?N(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var v=(n,t,e)=>z(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("popmotion"),L=require("./jaemin-DL1-g_B5.cjs");class T{constructor(t){v(this,"options");v(this,"currentValue");v(this,"velocity");v(this,"isAnimating",!1);v(this,"controls",null);v(this,"animationMap",null);v(this,"activeAnimations",new Set);v(this,"completedAnimations",new Set);v(this,"updatedProperties",new Set);v(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,s=performance.now();const o={from:this.currentValue,to:e,stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="number"&&(o.velocity=this.velocity*1e3),this.controls=R.animate({...o,onUpdate:u=>{const d=performance.now(),a=(d-s)/1e3;if(a>0){if(typeof u=="number"&&typeof i=="number"){const m=(u-i)/a;this.velocity=m/1e3}else if(typeof u=="object"&&u!==null){const m={};Object.keys(u).forEach(l=>{const r=u[l],f=i[l];if(typeof r=="number"&&typeof f=="number"){const g=(r-f)/a;m[l]=g/1e3}}),this.velocity=m}i=u,s=d}this.currentValue=u,this.options.onUpdate(u)},onComplete:()=>{this.currentValue=e,this.isAnimating=!1,this.controls=null,typeof this.velocity=="object"&&this.velocity!==null?Object.keys(this.velocity).forEach(u=>{this.velocity[u]=0}):this.velocity=0,this.options.onComplete()}})});v(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 s={...e},o={};let u=!1;const d=()=>{const a=i.filter(l=>!this.completedAnimations.has(l));if(a.every(l=>this.updatedProperties.has(l))&&a.length>0){if(typeof this.velocity=="object"&&this.velocity){const l=performance.now();Object.keys(s).forEach(r=>{if(o[r]){const f=(l-o[r])/1e3,g=this.currentValue[r],c=s[r];typeof g=="number"&&typeof c=="number"&&f>0&&(this.velocity[r]=(c-g)/f/1e3)}o[r]=l})}this.currentValue={...s},this.options.onUpdate(this.currentValue),this.updatedProperties.clear(),!u&&this.options.onStart&&(u=!0,this.options.onStart())}};i.forEach(a=>{this.activeAnimations.add(a);const m={from:e[a],to:t[a],stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="object"&&this.velocity&&a in this.velocity&&(m.velocity=this.velocity[a]*1e3);const l=R.animate({...m,onUpdate:r=>{s[a]=r,this.updatedProperties.add(a),d()},onComplete:()=>{this.completedAnimations.add(a),this.updatedProperties.delete(a),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(r=>{this.velocity[r]=0}),this.options.onComplete())}});this.animationMap.set(a,l)})});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{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 T(e);return i.setValue(t.position),i.setVelocity(t.velocity),i}}const O=Symbol.for("TRANSITION_STRATEGY"),M=n=>({runIn:async t=>{const{currentAnimation:e}=n;if(e&&e.direction==="out"){const u=e.animator.getCurrentState();if(e.animator.stop(),t.out){const d=await t.out,{from:a=1,to:m=0}=d;return{config:d,state:u,from:a,to:m,direction:"backward"}}}const i=await t.in;if(!i)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:s=0,to:o=1}=i;return{config:i,state:{position:s,velocity:0},from:s,to:o,direction:"forward"}},runOut:async t=>{const{currentAnimation:e}=n;if(e&&e.direction==="in"){const u=e.animator.getCurrentState();if(e.animator.stop(),t.in){const d=await t.in,{from:a=0,to:m=1}=d;return{config:d,state:{position:u.position,velocity:u.velocity},from:a,to:m,direction:"backward"}}}const i=await t.out;if(!i)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:s=1,to:o=0}=i;return{config:i,state:{position:s,velocity:0},from:s,to:o,direction:"forward"}}}),I=()=>({runIn:async n=>{const t=await n.in;if(!t)return{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"};const{from:e=1,to:i=0}=t;return{config:t,state:{position:e,velocity:0},from:e,to:i,direction:"forward"}}});function K(n,t){var l;let e=null,i=null,s=null,o=null;const u={get currentAnimation(){return e}},d=((l=t==null?void 0:t.strategy)==null?void 0:l.call(t,u))||M(u),a=async r=>{var p,h;i&&(i.remove(),i=null);const f=n(),g={in:f.in&&Promise.resolve(f.in(r)),out:f.out&&Promise.resolve(f.out(r))},c=await d.runIn(g);if(!c.config)return;(h=(p=c.config).prepare)==null||h.call(p,r),c.config.wait&&await c.config.wait();const S=T.fromState(c.state,{from:c.from,to:c.to,spring:c.config.spring,onStart:c.config.onStart,onUpdate:c.config.tick,onComplete:()=>{var y,w;e=null,(w=(y=c.config)==null?void 0:y.onEnd)==null||w.call(y)}});e={animator:S,direction:"in"},c.direction==="forward"?S.forward():S.backward()},m=async r=>{var h,y;i=r;const f=n(),g={in:f.in&&Promise.resolve(f.in(r)),out:f.out&&Promise.resolve(f.out(r))},c=await d.runOut(g);if(!c.config)return;(y=(h=c.config).prepare)==null||y.call(h,r),p(),c.config.wait&&await c.config.wait();const S=T.fromState(c.state,{from:c.from,to:c.to,spring:c.config.spring,onStart:c.config.onStart,onUpdate:c.config.tick,onComplete:()=>{var w,b,C;(b=(w=c.config)==null?void 0:w.onEnd)==null||b.call(w),i&&(i.remove(),i=null),e=null,(C=t==null?void 0:t.onCleanupEnd)==null||C.call(t)}});e={animator:S,direction:"out"},c.direction==="forward"?S.forward():S.backward();function p(){!s||!i||(o&&s.contains(o)?s.insertBefore(i,o):s.appendChild(i))}};return r=>{if(r)return s=r.parentElement,o=r.nextElementSibling,a(r),()=>{const f=r.cloneNode(!0);m(f)}}}const $=3,k=n=>{if(!n)return null;const t=n.split(`
2
+ `).map(e=>e.trim());for(let e=$;e<Math.min(t.length,6);e++){const i=t[e],s=i==null?void 0:i.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!s)continue;const o=s[1]??"",u=s[2]??"0",d=s[3]??"0";return{file:o.split(/[\\/]/).pop()||o,line:u,column:d}}return null},P=new Map,V=new Map;function F(n,t,e){P.set(n,t);let i=V.get(n);return i||(i=K(()=>{const s=P.get(n);return s||(console.warn(`Transition "${String(n)}" not found`),{})},{strategy:e,onCleanupEnd:()=>U(n)}),V.set(n,i),i)}function U(n){P.delete(n),V.delete(n)}function _(){const n=k(new Error().stack);return n?`auto_${n.file}_${n.line}_${n.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const x=globalThis.FinalizationRegistry,j=x?new x(n=>{try{U(n)}catch{}}):void 0;function W(n){const t=n.key??_();if(n.ref&&j)try{j.register(n.ref,t)}catch{}return F(t,{in:n.in,out:n.out},n[O])}const Y=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},G=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 X(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=!1;const i=a=>{if(!n)return;const m=a.touches[0];m&&(e=m.clientX<50)},s=()=>{n&&(e&&(t=!0,setTimeout(()=>{t=!1},500)),e=!1)};return{initialize:()=>{typeof window>"u"||n&&(window.addEventListener("touchstart",i,{passive:!0}),window.addEventListener("touchend",s,{passive:!0}))},cleanup:()=>{typeof window>"u"||(window.removeEventListener("touchstart",i),window.removeEventListener("touchend",s))},isSwipePending:()=>t}}function H(){let n=null,t=null;const e=new Map;let i=null;const s=()=>{n&&i&&e.set(i,{x:n.scrollLeft,y:n.scrollTop})};return{initializeContext:(l,r)=>{t=l,n||(n=Y(l),(n===document.documentElement?window:n).addEventListener("scroll",s,{passive:!0})),i=r},calculateScrollOffset:(l,r)=>{const f=l&&e.has(l)?e.get(l):{x:0,y:0},g=r&&e.has(r)?e.get(r):{x:0,y:0};return{x:-g.x+f.x,y:-g.y+f.y}},getScrollContainer:()=>n,getPositionedParentElement:()=>t?G(t):document.body,getScrollPosition:l=>l&&e.has(l)?e.get(l):{x:0,y:0}}}function B(n){const{transitions:t=[],defaultTransition:e,middleware:i=(p,h)=>({from:p,to:h}),skipOnIosSwipe:s=!0}=n;let o=null;const u=X(t),{initializeContext:d,calculateScrollOffset:a,getScrollContainer:m,getPositionedParentElement:l,getScrollPosition:r}=H(),f=q(s);f.initialize();function g(){if(o!=null&&o.from&&(o!=null&&o.to)){const{from:p,to:h}=i(o.from,o.to),w=J(p,h,u)||e,b=a(o.from,o.to),C={scrollOffset:b,scroll:r(o.from),get scrollingElement(){return m()||document.documentElement},get positionedParent(){return l()}},D={scrollOffset:b,get scroll(){return o?r(o.to):{x:0,y:0}},get scrollingElement(){return m()||document.documentElement},get positionedParent(){return l()}};w&&(w.out&&o.outResolve&&o.outResolve(A=>w.out(A,C)),w.in&&o.inResolve&&o.inResolve(A=>w.in(A,D))),o=null}}const c=async(p,h)=>f.isSwipePending()?()=>({}):h==="in"&&(!o||!o.from)?()=>({}):(o||(o={}),h==="out"?(o.from=p,new Promise(y=>{o.outResolve=y,g()})):(o.to=p,new Promise(y=>{o.inResolve=y,g()})));return p=>({key:p,in:async h=>(d(h,p),(await c(p,"in"))(h)),out:async h=>(await c(p,"out"))(h),[O]:I})}function J(n,t,e){for(const i of e)if(E(n,i.from)&&E(t,i.to))return i.transition;for(const i of e)if((i.from==="*"||E(n,i.from))&&(i.to==="*"||E(t,i.to)))return i.transition;return null}function E(n,t){if(t==="*")return!0;if(t.endsWith("/*")){const e=t.slice(0,-2);return n===e||n.startsWith(e+"/")}return n===t}exports.jaeminInternal=L.jaeminInternal;exports.TRANSITION_STRATEGY=O;exports.createDefaultStrategy=M;exports.createPageTransitionStrategy=I;exports.createSggoiTransitionContext=B;exports.generateAutoKey=_;exports.transition=W;
package/dist/index.d.ts CHANGED
@@ -2,4 +2,5 @@ export * from './types';
2
2
  export * from './transition';
3
3
  export * from './create-ssgoi-transition-context';
4
4
  export * from './transition-strategy';
5
+ export { jaeminInternal } from './view-transitions/jaemin';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}