@ssgoi/core 2.1.2 → 2.3.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.
Files changed (60) hide show
  1. package/README.md +10 -11
  2. package/dist/animator.d.ts.map +1 -1
  3. package/dist/create-ssgoi-transition-context.d.ts.map +1 -1
  4. package/dist/create-transition-callback.d.ts.map +1 -1
  5. package/dist/index.cjs +2 -1
  6. package/dist/index.js +326 -212
  7. package/dist/transition-strategy.d.ts +5 -0
  8. package/dist/transition-strategy.d.ts.map +1 -1
  9. package/dist/transition.d.ts.map +1 -1
  10. package/dist/transitions/blur.d.ts.map +1 -1
  11. package/dist/transitions/bounce.d.ts +1 -1
  12. package/dist/transitions/bounce.d.ts.map +1 -1
  13. package/dist/transitions/fly.d.ts.map +1 -1
  14. package/dist/transitions/index.cjs +1 -1
  15. package/dist/transitions/index.d.ts +1 -0
  16. package/dist/transitions/index.d.ts.map +1 -1
  17. package/dist/transitions/index.js +199 -142
  18. package/dist/transitions/mask.d.ts +31 -0
  19. package/dist/transitions/mask.d.ts.map +1 -0
  20. package/dist/transitions/none.d.ts +4 -4
  21. package/dist/transitions/none.d.ts.map +1 -1
  22. package/dist/transitions/rotate.d.ts +1 -1
  23. package/dist/transitions/scale.d.ts +1 -1
  24. package/dist/transitions/slide.d.ts +2 -2
  25. package/dist/transitions/slide.d.ts.map +1 -1
  26. package/dist/types.d.ts +31 -0
  27. package/dist/types.d.ts.map +1 -1
  28. package/dist/utils/get-positioned-parent.d.ts +7 -0
  29. package/dist/utils/get-positioned-parent.d.ts.map +1 -0
  30. package/dist/utils/get-rect.d.ts +7 -0
  31. package/dist/utils/get-rect.d.ts.map +1 -0
  32. package/dist/utils/get-scrolling-element.d.ts +6 -0
  33. package/dist/utils/get-scrolling-element.d.ts.map +1 -0
  34. package/dist/utils/index.d.ts +7 -0
  35. package/dist/utils/index.d.ts.map +1 -0
  36. package/dist/utils/parse-caller-location.d.ts +6 -0
  37. package/dist/utils/parse-caller-location.d.ts.map +1 -0
  38. package/dist/utils/prepare-outgoing.d.ts +6 -0
  39. package/dist/utils/prepare-outgoing.d.ts.map +1 -0
  40. package/dist/utils/sleep.d.ts +7 -0
  41. package/dist/utils/sleep.d.ts.map +1 -0
  42. package/dist/utils.d.ts.map +1 -1
  43. package/dist/view-transitions/blind.d.ts +13 -0
  44. package/dist/view-transitions/blind.d.ts.map +1 -0
  45. package/dist/view-transitions/fade.d.ts.map +1 -1
  46. package/dist/view-transitions/film.d.ts +8 -0
  47. package/dist/view-transitions/film.d.ts.map +1 -0
  48. package/dist/view-transitions/hero.d.ts.map +1 -1
  49. package/dist/view-transitions/index.cjs +35 -1
  50. package/dist/view-transitions/index.d.ts +3 -0
  51. package/dist/view-transitions/index.d.ts.map +1 -1
  52. package/dist/view-transitions/index.js +448 -202
  53. package/dist/view-transitions/pinterest.d.ts.map +1 -1
  54. package/dist/view-transitions/slide.d.ts +8 -0
  55. package/dist/view-transitions/slide.d.ts.map +1 -0
  56. package/package.json +15 -8
  57. package/dist/utils-8Eptbv7c.cjs +0 -2
  58. package/dist/utils-DTRMUQW4.js +0 -31
  59. package/dist/view-transitions/ripple.d.ts +0 -7
  60. package/dist/view-transitions/ripple.d.ts.map +0 -1
package/README.md CHANGED
@@ -73,12 +73,12 @@ Define different transitions for different routes:
73
73
  ```tsx
74
74
  const config = {
75
75
  transitions: [
76
- // Slide between tabs
77
- { from: '/home', to: '/about', transition: slide({ direction: 'left' }) },
78
- { from: '/about', to: '/home', transition: slide({ direction: 'right' }) },
76
+ // Scroll between tabs
77
+ { from: '/home', to: '/about', transition: scroll({ direction: 'up' }) },
78
+ { from: '/about', to: '/home', transition: scroll({ direction: 'down' }) },
79
79
 
80
- // Scale up when entering details
81
- { from: '/products', to: '/products/*', transition: scale() },
80
+ // Drill in when entering details
81
+ { from: '/products', to: '/products/*', transition: drill({ direction: 'enter' }) },
82
82
 
83
83
  // Pinterest-style image transitions
84
84
  { from: '/gallery', to: '/photo/*', transition: pinterest() }
@@ -95,7 +95,7 @@ Automatically create bidirectional transitions:
95
95
  {
96
96
  from: '/home',
97
97
  to: '/about',
98
- transition: slide({ direction: 'left' }),
98
+ transition: scroll({ direction: 'up' }),
99
99
  symmetric: true // Automatically creates reverse transition
100
100
  }
101
101
  ```
@@ -125,11 +125,10 @@ function Card() {
125
125
 
126
126
  ### Page Transitions
127
127
  - `fade` - Smooth opacity transition
128
- - `slide` - Directional sliding (left/right/up/down)
129
- - `scale` - Zoom in/out effect
128
+ - `scroll` - Vertical scrolling (up/down)
129
+ - `drill` - Drill in/out effect (enter/exit)
130
130
  - `hero` - Shared element transitions
131
131
  - `pinterest` - Pinterest-style expand effect
132
- - `ripple` - Material Design ripple effect
133
132
 
134
133
  ### Element Transitions
135
134
  - `fadeIn` / `fadeOut`
@@ -146,14 +145,14 @@ function Card() {
146
145
  ```tsx
147
146
  // app/layout.tsx
148
147
  import { Ssgoi } from '@ssgoi/react';
149
- import { slide } from '@ssgoi/react/view-transitions';
148
+ import { scroll } from '@ssgoi/react/view-transitions';
150
149
 
151
150
  export default function RootLayout({ children }) {
152
151
  return (
153
152
  <html>
154
153
  <body>
155
154
  <Ssgoi config={{
156
- defaultTransition: slide({ direction: 'left' })
155
+ defaultTransition: scroll({ direction: 'up' })
157
156
  }}>
158
157
  <div style={{ position: 'relative', minHeight: '100vh' }}>
159
158
  {children}
@@ -1 +1 @@
1
- {"version":3,"file":"animator.d.ts","sourceRoot":"","sources":["../src/lib/animator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,gBAAgB,CAAC,eAAe,GAAG,MAAM;IACxD,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,EAAE,eAAe,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C,UAAU,EAAE,MAAM,IAAI,C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B;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,GACnB,YAAY,CA6Fd"}
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;AA6IjB;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,GACnB,YAAY,CAwId"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-transition-callback.d.ts","sourceRoot":"","sources":["../src/lib/create-transition-callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE9D,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,CAAC,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,KAAK,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAC/F,GACA,kBAAkB,CAuIpB"}
1
+ {"version":3,"file":"create-transition-callback.d.ts","sourceRoot":"","sources":["../src/lib/create-transition-callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE9D,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,CA0IpB"}
package/dist/index.cjs CHANGED
@@ -1 +1,2 @@
1
- "use strict";var I=Object.defineProperty;var k=(i,t,o)=>t in i?I(i,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[t]=o;var g=(i,t,o)=>k(i,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("popmotion"),P=require("./utils-8Eptbv7c.cjs");class A{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 o=t?this.options.from:this.options.to;if(typeof this.currentValue=="object"&&this.currentValue!==null){this.animateObject(o,t);return}let n=this.currentValue,e=performance.now();const m={from:this.currentValue,to:o,stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="number"&&(m.velocity=this.velocity*1e3),this.controls=R.animate({...m,onUpdate:a=>{const f=performance.now(),h=(f-e)/1e3;if(h>0){if(typeof a=="number"&&typeof n=="number"){const c=(a-n)/h;this.velocity=c/1e3}else if(typeof a=="object"&&a!==null){const c={};Object.keys(a).forEach(u=>{const r=a[u],s=n[u];if(typeof r=="number"&&typeof s=="number"){const p=(r-s)/h;c[u]=p/1e3}}),this.velocity=c}n=a,e=f}this.currentValue=a,this.options.onUpdate(a)},onComplete:()=>{this.currentValue=o,this.isAnimating=!1,this.controls=null,typeof this.velocity=="object"&&this.velocity!==null?Object.keys(this.velocity).forEach(a=>{this.velocity[a]=0}):this.velocity=0,this.options.onComplete()}})});g(this,"animateObject",(t,o)=>{const n=this.currentValue,e=Object.keys(n);this.animationMap=new Map,this.activeAnimations.clear(),this.completedAnimations.clear(),this.updatedProperties.clear();const m={...n},a={};let f=!1;const h=()=>{const c=e.filter(r=>!this.completedAnimations.has(r));if(c.every(r=>this.updatedProperties.has(r))&&c.length>0){if(typeof this.velocity=="object"&&this.velocity){const r=performance.now();Object.keys(m).forEach(s=>{if(a[s]){const p=(r-a[s])/1e3,l=this.currentValue[s],d=m[s];typeof l=="number"&&typeof d=="number"&&p>0&&(this.velocity[s]=(d-l)/p/1e3)}a[s]=r})}this.currentValue={...m},this.options.onUpdate(this.currentValue),this.updatedProperties.clear(),!f&&this.options.onStart&&(f=!0,this.options.onStart())}};e.forEach(c=>{this.activeAnimations.add(c);const u={from:n[c],to:t[c],stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="object"&&this.velocity&&c in this.velocity&&(u.velocity=this.velocity[c]*1e3);const r=R.animate({...u,onUpdate:s=>{m[c]=s,this.updatedProperties.add(c),h()},onComplete:()=>{this.completedAnimations.add(c),this.updatedProperties.delete(c),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(c,r)})});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 o={};Object.keys(this.options.from).forEach(n=>{o[n]=0}),this.velocity=o}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 o=this.shouldReverse();this.stop(),this.animate(!o)}}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 o=this.shouldReverse();this.stop(),this.animate(!o)}}static fromState(t,o){const n=new A(o);return n.setValue(t.position),n.setVelocity(t.velocity),n}}const M=Symbol.for("TRANSITION_STRATEGY"),x=i=>({runIn:async t=>{const{currentAnimation:o}=i;if(o&&o.direction==="out"){const a=o.animator.getCurrentState();if(o.animator.stop(),t.out){const f=await t.out,{from:h=1,to:c=0}=f;return{config:f,state:a,from:h,to:c,direction:"backward"}}}const n=await t.in;if(!n)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:e=0,to:m=1}=n;return{config:n,state:{position:e,velocity:0},from:e,to:m,direction:"forward"}},runOut:async t=>{const{currentAnimation:o}=i;if(o&&o.direction==="in"){const a=o.animator.getCurrentState();if(o.animator.stop(),t.in){const f=await t.in,{from:h=0,to:c=1}=f;return{config:f,state:{position:a.position,velocity:a.velocity},from:h,to:c,direction:"backward"}}}const n=await t.out;if(!n)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:e=1,to:m=0}=n;return{config:n,state:{position:e,velocity:0},from:e,to:m,direction:"forward"}}});function D(i,t){var u;let o=null,n=null,e=null,m=null;const a={get currentAnimation(){return o}},f=((u=t==null?void 0:t.strategy)==null?void 0:u.call(t,a))||x(a),h=async r=>{var y,S;n&&(n.remove(),n=null);const s=i(),p={in:s.in&&Promise.resolve(s.in(r)),out:s.out&&Promise.resolve(s.out(r))},l=await f.runIn(p);if(!l.config)return;(S=(y=l.config).prepare)==null||S.call(y,r),l.config.wait&&await l.config.wait();const d=A.fromState(l.state,{from:l.from,to:l.to,spring:l.config.spring,onStart:l.config.onStart,onUpdate:l.config.tick,onComplete:()=>{var v,w;o=null,(w=(v=l.config)==null?void 0:v.onEnd)==null||w.call(v)}});o={animator:d,direction:"in"},l.direction==="forward"?d.forward():d.backward()},c=async r=>{var S,v;n=r;const s=i(),p={in:s.in&&Promise.resolve(s.in(r)),out:s.out&&Promise.resolve(s.out(r))},l=await f.runOut(p);if(!l.config)return;(v=(S=l.config).prepare)==null||v.call(S,r),y(),l.config.wait&&await l.config.wait();const d=A.fromState(l.state,{from:l.from,to:l.to,spring:l.config.spring,onStart:l.config.onStart,onUpdate:l.config.tick,onComplete:()=>{var w,C,O;(C=(w=l.config)==null?void 0:w.onEnd)==null||C.call(w),n&&(n.remove(),n=null),o=null,(O=t==null?void 0:t.onCleanupEnd)==null||O.call(t)}});o={animator:d,direction:"out"},l.direction==="forward"?d.forward():d.backward();function y(){!e||!n||(m&&e.contains(m)?e.insertBefore(n,m):e.appendChild(n))}};return r=>{if(r)return e=r.parentElement,m=r.nextElementSibling,h(r),()=>{const s=r.cloneNode(!0);c(s)}}}const T=new Map,V=new Map;function N(i,t,o){T.set(i,t);let n=V.get(i);return n||(n=D(()=>{const e=T.get(i);return e||(console.warn(`Transition "${String(i)}" not found`),{})},{strategy:o,onCleanupEnd:()=>U(i)}),V.set(i,n),n)}function U(i){T.delete(i),V.delete(i)}function _(){const i=P.parseCallerLocation(new Error().stack);return i?`auto_${i.file}_${i.line}_${i.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const E=globalThis.FinalizationRegistry,j=E?new E(i=>{try{U(i)}catch{}}):void 0;function $(i){const t=i.key??_();if(i.ref&&j)try{j.register(i.ref,t)}catch{}return N(t,{in:i.in,out:i.out},i[M])}function F(i){const t=i.filter(o=>o.symmetric).map(o=>({from:o.to,to:o.from,transition:o.transition}));return[...i,...t]}function K(){let i=null;const t=new Map;let o=null;const n=()=>{i&&o&&t.set(o,{x:i.scrollLeft,y:i.scrollTop})};return{startScrollTracking:(a,f)=>{i||(i=P.getScrollingElement(a),(i===document.documentElement?window:i).addEventListener("scroll",n,{passive:!0})),o=f},calculateScrollOffset:(a,f)=>{const h=a&&t.has(a)?t.get(a):{x:0,y:0},c=f&&t.has(f)?t.get(f):{x:0,y:0};return{x:-c.x+h.x,y:-c.y+h.y}}}}function L(i){const{transitions:t=[],defaultTransition:o,middleware:n=(u,r)=>({from:u,to:r})}=i;let e=null;const m=F(t),{startScrollTracking:a,calculateScrollOffset:f}=K();function h(){if(e!=null&&e.from&&(e!=null&&e.to)){const{from:u,to:r}=n(e.from,e.to),p=z(u,r,m)||o,d={scrollOffset:f(e.from,e.to)};p&&(p.out&&e.outResolve&&e.outResolve(y=>p.out(y,d)),p.in&&e.inResolve&&e.inResolve(y=>p.in(y,d))),e=null}}const c=async(u,r)=>r==="in"&&(!e||!e.from)?()=>({}):(e||(e={}),r==="out"?(e.from=u,new Promise(s=>{e.outResolve=s,h()})):(e.to=u,new Promise(s=>{e.inResolve=s,h()})));return u=>({key:u,in:async r=>(a(r,u),(await c(u,"in"))(r)),out:async r=>(await c(u,"out"))(r)})}function z(i,t,o){for(const n of o)if(b(i,n.from)&&b(t,n.to))return n.transition;for(const n of o)if((n.from==="*"||b(i,n.from))&&(n.to==="*"||b(t,n.to)))return n.transition;return null}function b(i,t){if(t==="*")return!0;if(t.endsWith("/*")){const o=t.slice(0,-2);return i===o||i.startsWith(o+"/")}return i===t}exports.TRANSITION_STRATEGY=M;exports.createDefaultStrategy=x;exports.createSggoiTransitionContext=L;exports.generateAutoKey=_;exports.transition=$;
1
+ "use strict";var N=Object.defineProperty;var D=(n,t,o)=>t in n?N(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o;var y=(n,t,o)=>D(n,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("popmotion");class C{constructor(t){y(this,"options");y(this,"currentValue");y(this,"velocity");y(this,"isAnimating",!1);y(this,"controls",null);y(this,"animationMap",null);y(this,"activeAnimations",new Set);y(this,"completedAnimations",new Set);y(this,"updatedProperties",new Set);y(this,"animate",(t=!1)=>{!this.isAnimating&&this.options.onStart&&this.options.onStart(),this.isAnimating=!0;const o=t?this.options.from:this.options.to;if(typeof this.currentValue=="object"&&this.currentValue!==null){this.animateObject(o);return}let e=this.currentValue,i=performance.now();const m={from:this.currentValue,to:o,stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="number"&&(m.velocity=this.velocity*1e3),this.controls=R.animate({...m,onUpdate:l=>{const p=performance.now(),r=(p-i)/1e3;if(r>0){if(typeof l=="number"&&typeof e=="number"){const u=(l-e)/r;this.velocity=u/1e3}else if(typeof l=="object"&&l!==null){const u={};Object.keys(l).forEach(f=>{const c=l[f],a=e[f];if(typeof c=="number"&&typeof a=="number"){const h=(c-a)/r;u[f]=h/1e3}}),this.velocity=u}e=l,i=p}this.currentValue=l,this.options.onUpdate(l)},onComplete:()=>{this.currentValue=o,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()}})});y(this,"animateObject",t=>{const o=this.currentValue,e=Object.keys(o);this.animationMap=new Map,this.activeAnimations.clear(),this.completedAnimations.clear(),this.updatedProperties.clear();const i={...o},m={};let l=!1;const p=()=>{const r=e.filter(f=>!this.completedAnimations.has(f));if(r.every(f=>this.updatedProperties.has(f))&&r.length>0){if(typeof this.velocity=="object"&&this.velocity){const f=performance.now();Object.keys(i).forEach(c=>{if(m[c]){const a=(f-m[c])/1e3,h=this.currentValue[c],s=i[c];typeof h=="number"&&typeof s=="number"&&a>0&&(this.velocity[c]=(s-h)/a/1e3)}m[c]=f})}this.currentValue={...i},this.options.onUpdate(this.currentValue),this.updatedProperties.clear(),!l&&this.options.onStart&&(l=!0,this.options.onStart())}};e.forEach(r=>{this.activeAnimations.add(r);const u={from:o[r],to:t[r],stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="object"&&this.velocity&&r in this.velocity&&(u.velocity=this.velocity[r]*1e3);const f=R.animate({...u,onUpdate:c=>{i[r]=c,this.updatedProperties.add(r),p()},onComplete:()=>{this.completedAnimations.add(r),this.updatedProperties.delete(r),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(c=>{this.velocity[c]=0}),this.options.onComplete())}});this.animationMap.set(r,f)})});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 o={};Object.keys(this.options.from).forEach(e=>{o[e]=0}),this.velocity=o}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 o=this.shouldReverse();this.stop(),this.animate(!o)}}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 o=this.shouldReverse();this.stop(),this.animate(!o)}}static fromState(t,o){const e=new C(o);return e.setValue(t.position),e.setVelocity(t.velocity),e}}const E=Symbol.for("TRANSITION_STRATEGY"),x=n=>({runIn:async t=>{const{currentAnimation:o}=n;if(o&&o.direction==="out"){const l=o.animator.getCurrentState();if(o.animator.stop(),t.out){const p=await t.out,{from:r=1,to:u=0}=p;return{config:p,state:l,from:r,to:u,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:m=1}=e;return{config:e,state:{position:i,velocity:0},from:i,to:m,direction:"forward"}},runOut:async t=>{const{currentAnimation:o}=n;if(o&&o.direction==="in"){const l=o.animator.getCurrentState();if(o.animator.stop(),t.in){const p=await t.in,{from:r=0,to:u=1}=p;return{config:p,state:{position:l.position,velocity:l.velocity},from:r,to:u,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:m=0}=e;return{config:e,state:{position:i,velocity:0},from:i,to:m,direction:"forward"}}}),U=()=>({runIn:async n=>{const t=await n.in;if(!t)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:o=0,to:e=1}=t;return{config:t,state:{position:o,velocity:0},from:o,to:e,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:o=1,to:e=0}=t;return{config:t,state:{position:o,velocity:0},from:o,to:e,direction:"forward"}}});function k(n,t){var f;let o=null,e=null,i=null,m=null;const l={get currentAnimation(){return o}},p=((f=t==null?void 0:t.strategy)==null?void 0:f.call(t,l))||x(l),r=async c=>{var w,S;e&&(e.remove(),e=null);const a=n(),h={in:a.in&&Promise.resolve(a.in(c)),out:a.out&&Promise.resolve(a.out(c))},s=await p.runIn(h);if(!s.config)return;(S=(w=s.config).prepare)==null||S.call(w,c),s.config.wait&&await s.config.wait();const g=C.fromState(s.state,{from:s.from,to:s.to,spring:s.config.spring,onStart:s.config.onStart,onUpdate:s.config.tick,onComplete:()=>{var v,d;o=null,(d=(v=s.config)==null?void 0:v.onEnd)==null||d.call(v)}});o={animator:g,direction:"in"},s.direction==="forward"?g.forward():g.backward()},u=async c=>{var S,v;e=c;const a=n(),h={in:a.in&&Promise.resolve(a.in(c)),out:a.out&&Promise.resolve(a.out(c))},s=await p.runOut(h);if(!s.config)return;(v=(S=s.config).prepare)==null||v.call(S,c),w(),s.config.wait&&await s.config.wait();const g=C.fromState(s.state,{from:s.from,to:s.to,spring:s.config.spring,onStart:s.config.onStart,onUpdate:s.config.tick,onComplete:()=>{var d,V,P;(V=(d=s.config)==null?void 0:d.onEnd)==null||V.call(d),e&&(e.remove(),e=null),o=null,(P=t==null?void 0:t.onCleanupEnd)==null||P.call(t)}});o={animator:g,direction:"out"},s.direction==="forward"?g.forward():g.backward();function w(){!i||!e||(m&&i.contains(m)?i.insertBefore(e,m):i.appendChild(e))}};return c=>{if(c)return i=c.parentElement,m=c.nextElementSibling,r(c),()=>{const a=c.cloneNode(!0);u(a)}}}const K=3,$=n=>{if(!n)return null;const t=n.split(`
2
+ `).map(o=>o.trim());for(let o=K;o<Math.min(t.length,6);o++){const e=t[o],i=e==null?void 0:e.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!i)continue;const m=i[1]??"",l=i[2]??"0",p=i[3]??"0";return{file:m.split(/[\\/]/).pop()||m,line:l,column:p}}return null},A=new Map,T=new Map;function F(n,t,o){A.set(n,t);let e=T.get(n);return e||(e=k(()=>{const i=A.get(n);return i||(console.warn(`Transition "${String(n)}" not found`),{})},{strategy:o,onCleanupEnd:()=>_(n)}),T.set(n,e),e)}function _(n){A.delete(n),T.delete(n)}function I(){const n=$(new Error().stack);return n?`auto_${n.file}_${n.line}_${n.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const O=globalThis.FinalizationRegistry,j=O?new O(n=>{try{_(n)}catch{}}):void 0;function W(n){const t=n.key??I();if(n.ref&&j)try{j.register(n.ref,t)}catch{}return F(t,{in:n.in,out:n.out},n[E])}const L=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const o=window.getComputedStyle(t),e=o.overflow+o.overflowY+o.overflowX;if(e.includes("auto")||e.includes("scroll")||t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.parentElement}return document.documentElement},M=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const o=window.getComputedStyle(t).position;if(o==="relative"||o==="absolute"||o==="fixed"||o==="sticky")return t;t=t.parentElement}return document.body};function Y(n){const t=n.filter(o=>o.symmetric).map(o=>({from:o.to,to:o.from,transition:o.transition}));return[...n,...t]}function z(){let n=null;const t=new Map;let o=null;const e=()=>{n&&o&&t.set(o,{x:n.scrollLeft,y:n.scrollTop})};return{startScrollTracking:(r,u)=>{n||(n=L(r),(n===document.documentElement?window:n).addEventListener("scroll",e,{passive:!0})),o=u},calculateScrollOffset:(r,u)=>{const f=r&&t.has(r)?t.get(r):{x:0,y:0},c=u&&t.has(u)?t.get(u):{x:0,y:0};return{x:-c.x+f.x,y:-c.y+f.y}},getScrollContainer:()=>n,getScrollPosition:r=>r&&t.has(r)?t.get(r):{x:0,y:0}}}function G(n){const{transitions:t=[],defaultTransition:o,middleware:e=(a,h)=>({from:a,to:h})}=n;let i=null;const m=Y(t),{startScrollTracking:l,calculateScrollOffset:p,getScrollContainer:r,getScrollPosition:u}=z();function f(){if(i!=null&&i.from&&(i!=null&&i.to)){const{from:a,to:h}=e(i.from,i.to),g=H(a,h,m)||o,w=p(i.from,i.to),S={scrollOffset:w,scroll:u(i.from),get scrollingElement(){return r()||document.documentElement},get positionedParent(){const d=r();return d?M(d):document.body}},v={scrollOffset:w,scroll:u(i.to),get scrollingElement(){return r()||document.documentElement},get positionedParent(){const d=r();return d?M(d):document.body}};g&&(g.out&&i.outResolve&&i.outResolve(d=>g.out(d,S)),g.in&&i.inResolve&&i.inResolve(d=>g.in(d,v))),i=null}}const c=async(a,h)=>h==="in"&&(!i||!i.from)?()=>({}):(i||(i={}),h==="out"?(i.from=a,new Promise(s=>{i.outResolve=s,f()})):(i.to=a,new Promise(s=>{i.inResolve=s,f()})));return a=>({key:a,in:async h=>(l(h,a),(await c(a,"in"))(h)),out:async h=>(await c(a,"out"))(h),[E]:U})}function H(n,t,o){for(const e of o)if(b(n,e.from)&&b(t,e.to))return e.transition;for(const e of o)if((e.from==="*"||b(n,e.from))&&(e.to==="*"||b(t,e.to)))return e.transition;return null}function b(n,t){if(t==="*")return!0;if(t.endsWith("/*")){const o=t.slice(0,-2);return n===o||n.startsWith(o+"/")}return n===t}exports.TRANSITION_STRATEGY=E;exports.createDefaultStrategy=x;exports.createPageTransitionStrategy=U;exports.createSggoiTransitionContext=G;exports.generateAutoKey=I;exports.transition=W;