@ssgoi/core 5.2.2 → 6.1.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 (274) hide show
  1. package/README.md +5 -6
  2. package/dist/animation/animation.d.ts +68 -0
  3. package/dist/animation/animation.d.ts.map +1 -0
  4. package/dist/animation/host-animation.d.ts +45 -0
  5. package/dist/animation/host-animation.d.ts.map +1 -0
  6. package/dist/animation/index.d.ts +6 -0
  7. package/dist/animation/index.d.ts.map +1 -0
  8. package/dist/animation/integrator/double-spring-integrator.d.ts.map +1 -0
  9. package/dist/{animator → animation}/integrator/index.d.ts +1 -0
  10. package/dist/animation/integrator/index.d.ts.map +1 -0
  11. package/dist/animation/integrator/inertia-integrator.d.ts.map +1 -0
  12. package/dist/animation/integrator/linear-integrator.d.ts +23 -0
  13. package/dist/animation/integrator/linear-integrator.d.ts.map +1 -0
  14. package/dist/{animator → animation}/integrator/provider.d.ts +1 -1
  15. package/dist/animation/integrator/provider.d.ts.map +1 -0
  16. package/dist/animation/integrator/spring-integrator.d.ts.map +1 -0
  17. package/dist/animation/integrator/types.d.ts.map +1 -0
  18. package/dist/animation/multi-animation.d.ts +55 -0
  19. package/dist/animation/multi-animation.d.ts.map +1 -0
  20. package/dist/animation/web-animation.d.ts +65 -0
  21. package/dist/animation/web-animation.d.ts.map +1 -0
  22. package/dist/index.cjs +35 -1
  23. package/dist/index.d.ts +4 -7
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +1702 -1186
  26. package/dist/internal.cjs +1 -0
  27. package/dist/internal.d.ts +4 -0
  28. package/dist/internal.d.ts.map +1 -0
  29. package/dist/internal.js +511 -0
  30. package/dist/multi-animation-CnxqLEka.js +322 -0
  31. package/dist/multi-animation-Dw2JTJI2.cjs +1 -0
  32. package/dist/ssgoi-transition/create-context-manager.d.ts +1 -1
  33. package/dist/ssgoi-transition/create-context-manager.d.ts.map +1 -1
  34. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts +18 -31
  35. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
  36. package/dist/ssgoi-transition/find-matching-transition.d.ts +4 -4
  37. package/dist/ssgoi-transition/find-matching-transition.d.ts.map +1 -1
  38. package/dist/ssgoi-transition/navigation-detector-strategy.d.ts +5 -15
  39. package/dist/ssgoi-transition/navigation-detector-strategy.d.ts.map +1 -1
  40. package/dist/ssgoi-transition/process-symmetric-transitions.d.ts +2 -2
  41. package/dist/ssgoi-transition/process-symmetric-transitions.d.ts.map +1 -1
  42. package/dist/ssgoi-transition/unmount-observer.d.ts +17 -0
  43. package/dist/ssgoi-transition/unmount-observer.d.ts.map +1 -0
  44. package/dist/transitions/axis/index.d.ts +43 -0
  45. package/dist/transitions/axis/index.d.ts.map +1 -0
  46. package/dist/transitions/axis/provider/index.d.ts +8 -0
  47. package/dist/transitions/axis/provider/index.d.ts.map +1 -0
  48. package/dist/transitions/axis/provider/x/fluid.d.ts +3 -0
  49. package/dist/transitions/axis/provider/x/fluid.d.ts.map +1 -0
  50. package/dist/transitions/axis/provider/x/index.d.ts +3 -0
  51. package/dist/transitions/axis/provider/x/index.d.ts.map +1 -0
  52. package/dist/transitions/axis/provider/x/snappy.d.ts +3 -0
  53. package/dist/transitions/axis/provider/x/snappy.d.ts.map +1 -0
  54. package/dist/transitions/axis/provider/y.d.ts +3 -0
  55. package/dist/transitions/axis/provider/y.d.ts.map +1 -0
  56. package/dist/transitions/axis/provider/z.d.ts +3 -0
  57. package/dist/transitions/axis/provider/z.d.ts.map +1 -0
  58. package/dist/transitions/axis/transition.d.ts +5 -0
  59. package/dist/transitions/axis/transition.d.ts.map +1 -0
  60. package/dist/transitions/axis/types.d.ts +52 -0
  61. package/dist/transitions/axis/types.d.ts.map +1 -0
  62. package/dist/transitions/blind/index.d.ts +15 -0
  63. package/dist/transitions/blind/index.d.ts.map +1 -0
  64. package/dist/transitions/blind/transition.d.ts +16 -0
  65. package/dist/transitions/blind/transition.d.ts.map +1 -0
  66. package/dist/transitions/drill/index.d.ts +40 -0
  67. package/dist/transitions/drill/index.d.ts.map +1 -0
  68. package/dist/transitions/drill/provider/crossfade.d.ts +3 -0
  69. package/dist/transitions/drill/provider/crossfade.d.ts.map +1 -0
  70. package/dist/transitions/drill/provider/index.d.ts +3 -0
  71. package/dist/transitions/drill/provider/index.d.ts.map +1 -0
  72. package/dist/transitions/drill/provider/parallax.d.ts +3 -0
  73. package/dist/transitions/drill/provider/parallax.d.ts.map +1 -0
  74. package/dist/transitions/drill/transition.d.ts +5 -0
  75. package/dist/transitions/drill/transition.d.ts.map +1 -0
  76. package/dist/transitions/drill/types.d.ts +33 -0
  77. package/dist/transitions/drill/types.d.ts.map +1 -0
  78. package/dist/transitions/fade/index.d.ts +16 -0
  79. package/dist/transitions/fade/index.d.ts.map +1 -0
  80. package/dist/transitions/fade/transition.d.ts +6 -0
  81. package/dist/transitions/fade/transition.d.ts.map +1 -0
  82. package/dist/transitions/fade/types.d.ts +14 -0
  83. package/dist/transitions/fade/types.d.ts.map +1 -0
  84. package/dist/transitions/film/index.d.ts +16 -0
  85. package/dist/transitions/film/index.d.ts.map +1 -0
  86. package/dist/transitions/film/transition.d.ts +27 -0
  87. package/dist/transitions/film/transition.d.ts.map +1 -0
  88. package/dist/transitions/film/types.d.ts +16 -0
  89. package/dist/transitions/film/types.d.ts.map +1 -0
  90. package/dist/transitions/hero/index.d.ts +17 -0
  91. package/dist/transitions/hero/index.d.ts.map +1 -0
  92. package/dist/transitions/hero/transition.d.ts +7 -0
  93. package/dist/transitions/hero/transition.d.ts.map +1 -0
  94. package/dist/transitions/hero/types.d.ts +12 -0
  95. package/dist/transitions/hero/types.d.ts.map +1 -0
  96. package/dist/transitions/index.d.ts +11 -12
  97. package/dist/transitions/index.d.ts.map +1 -1
  98. package/dist/transitions/jaemin/index.d.ts +16 -0
  99. package/dist/transitions/jaemin/index.d.ts.map +1 -0
  100. package/dist/transitions/jaemin/transition.d.ts +18 -0
  101. package/dist/transitions/jaemin/transition.d.ts.map +1 -0
  102. package/dist/transitions/jaemin/types.d.ts +9 -0
  103. package/dist/transitions/jaemin/types.d.ts.map +1 -0
  104. package/dist/transitions/rotate/index.d.ts +15 -0
  105. package/dist/transitions/rotate/index.d.ts.map +1 -0
  106. package/dist/transitions/rotate/transition.d.ts +6 -0
  107. package/dist/transitions/rotate/transition.d.ts.map +1 -0
  108. package/dist/transitions/rotate/types.d.ts +9 -0
  109. package/dist/transitions/rotate/types.d.ts.map +1 -0
  110. package/dist/transitions/scroll/index.d.ts +15 -0
  111. package/dist/transitions/scroll/index.d.ts.map +1 -0
  112. package/dist/transitions/scroll/transition.d.ts +7 -0
  113. package/dist/transitions/scroll/transition.d.ts.map +1 -0
  114. package/dist/transitions/sheet/index.d.ts +41 -0
  115. package/dist/transitions/sheet/index.d.ts.map +1 -0
  116. package/dist/transitions/sheet/provider/background-scale.d.ts +3 -0
  117. package/dist/transitions/sheet/provider/background-scale.d.ts.map +1 -0
  118. package/dist/transitions/sheet/provider/index.d.ts +3 -0
  119. package/dist/transitions/sheet/provider/index.d.ts.map +1 -0
  120. package/dist/transitions/sheet/provider/static.d.ts +3 -0
  121. package/dist/transitions/sheet/provider/static.d.ts.map +1 -0
  122. package/dist/transitions/sheet/transition.d.ts +5 -0
  123. package/dist/transitions/sheet/transition.d.ts.map +1 -0
  124. package/dist/transitions/sheet/types.d.ts +29 -0
  125. package/dist/transitions/sheet/types.d.ts.map +1 -0
  126. package/dist/transitions/slide/index.d.ts +16 -0
  127. package/dist/transitions/slide/index.d.ts.map +1 -0
  128. package/dist/transitions/slide/transition.d.ts +7 -0
  129. package/dist/transitions/slide/transition.d.ts.map +1 -0
  130. package/dist/transitions/slide/types.d.ts +10 -0
  131. package/dist/transitions/slide/types.d.ts.map +1 -0
  132. package/dist/transitions/strip/index.d.ts +16 -0
  133. package/dist/transitions/strip/index.d.ts.map +1 -0
  134. package/dist/transitions/strip/transition.d.ts +6 -0
  135. package/dist/transitions/strip/transition.d.ts.map +1 -0
  136. package/dist/transitions/strip/types.d.ts +9 -0
  137. package/dist/transitions/strip/types.d.ts.map +1 -0
  138. package/dist/transitions/utils.d.ts +25 -5
  139. package/dist/transitions/utils.d.ts.map +1 -1
  140. package/dist/transitions/zoom/index.d.ts +22 -0
  141. package/dist/transitions/zoom/index.d.ts.map +1 -0
  142. package/dist/transitions/zoom/provider/blur.d.ts +14 -0
  143. package/dist/transitions/zoom/provider/blur.d.ts.map +1 -0
  144. package/dist/transitions/zoom/provider/expand.d.ts +10 -0
  145. package/dist/transitions/zoom/provider/expand.d.ts.map +1 -0
  146. package/dist/transitions/zoom/provider/index.d.ts +12 -0
  147. package/dist/transitions/zoom/provider/index.d.ts.map +1 -0
  148. package/dist/transitions/zoom/provider/static.d.ts +10 -0
  149. package/dist/transitions/zoom/provider/static.d.ts.map +1 -0
  150. package/dist/transitions/zoom/transition.d.ts +5 -0
  151. package/dist/transitions/zoom/transition.d.ts.map +1 -0
  152. package/dist/transitions/zoom/types.d.ts +109 -0
  153. package/dist/transitions/zoom/types.d.ts.map +1 -0
  154. package/dist/transitions/zoom/zoom-element.d.ts +4 -0
  155. package/dist/transitions/zoom/zoom-element.d.ts.map +1 -0
  156. package/dist/types/index.d.ts +174 -0
  157. package/dist/types/index.d.ts.map +1 -0
  158. package/dist/types.cjs +1 -1
  159. package/dist/types.d.ts +2 -504
  160. package/dist/types.js +3 -77
  161. package/dist/utils/get-viewport-rect.d.ts +17 -0
  162. package/dist/utils/get-viewport-rect.d.ts.map +1 -0
  163. package/dist/utils/index.d.ts +2 -0
  164. package/dist/utils/index.d.ts.map +1 -1
  165. package/dist/utils/prepare-outgoing.d.ts +2 -2
  166. package/dist/utils/prepare-outgoing.d.ts.map +1 -1
  167. package/dist/utils/promise-all.d.ts +18 -0
  168. package/dist/utils/promise-all.d.ts.map +1 -0
  169. package/package.json +7 -19
  170. package/dist/animator/integrator/double-spring-integrator.d.ts.map +0 -1
  171. package/dist/animator/integrator/index.d.ts.map +0 -1
  172. package/dist/animator/integrator/inertia-integrator.d.ts.map +0 -1
  173. package/dist/animator/integrator/provider.d.ts.map +0 -1
  174. package/dist/animator/integrator/spring-integrator.d.ts.map +0 -1
  175. package/dist/animator/integrator/types.d.ts.map +0 -1
  176. package/dist/animator/multi-animator.d.ts +0 -101
  177. package/dist/animator/multi-animator.d.ts.map +0 -1
  178. package/dist/animator/runner/css-runner.d.ts +0 -17
  179. package/dist/animator/runner/css-runner.d.ts.map +0 -1
  180. package/dist/animator/runner/keyframes-runner.d.ts +0 -14
  181. package/dist/animator/runner/keyframes-runner.d.ts.map +0 -1
  182. package/dist/animator/runner/provider.d.ts +0 -44
  183. package/dist/animator/runner/provider.d.ts.map +0 -1
  184. package/dist/animator/runner/tick-runner.d.ts +0 -16
  185. package/dist/animator/runner/tick-runner.d.ts.map +0 -1
  186. package/dist/animator/runner/ticker.d.ts +0 -38
  187. package/dist/animator/runner/ticker.d.ts.map +0 -1
  188. package/dist/animator/runner/types.d.ts +0 -34
  189. package/dist/animator/runner/types.d.ts.map +0 -1
  190. package/dist/animator/single-animator.d.ts +0 -65
  191. package/dist/animator/single-animator.d.ts.map +0 -1
  192. package/dist/animator/types.d.ts +0 -57
  193. package/dist/animator/types.d.ts.map +0 -1
  194. package/dist/presets/index.cjs +0 -1
  195. package/dist/presets/index.d.ts +0 -22
  196. package/dist/presets/index.d.ts.map +0 -1
  197. package/dist/presets/index.js +0 -50
  198. package/dist/provider-B2B8CK6H.js +0 -142
  199. package/dist/provider-BKaONTeg.cjs +0 -1
  200. package/dist/spring-integrator-95Mh7mdw.cjs +0 -1
  201. package/dist/spring-integrator-BM4a-82c.js +0 -33
  202. package/dist/transition/create-transition-callback.d.ts +0 -8
  203. package/dist/transition/create-transition-callback.d.ts.map +0 -1
  204. package/dist/transition/transition-scope.d.ts +0 -36
  205. package/dist/transition/transition-scope.d.ts.map +0 -1
  206. package/dist/transition/transition-strategy.d.ts +0 -75
  207. package/dist/transition/transition-strategy.d.ts.map +0 -1
  208. package/dist/transition/transition.d.ts +0 -51
  209. package/dist/transition/transition.d.ts.map +0 -1
  210. package/dist/transition/unmount-observer.d.ts +0 -43
  211. package/dist/transition/unmount-observer.d.ts.map +0 -1
  212. package/dist/transitions/blur.d.ts +0 -12
  213. package/dist/transitions/blur.d.ts.map +0 -1
  214. package/dist/transitions/bounce.d.ts +0 -13
  215. package/dist/transitions/bounce.d.ts.map +0 -1
  216. package/dist/transitions/fade.d.ts +0 -10
  217. package/dist/transitions/fade.d.ts.map +0 -1
  218. package/dist/transitions/fly.d.ts +0 -11
  219. package/dist/transitions/fly.d.ts.map +0 -1
  220. package/dist/transitions/index.cjs +0 -1
  221. package/dist/transitions/index.js +0 -285
  222. package/dist/transitions/mask.d.ts +0 -12
  223. package/dist/transitions/mask.d.ts.map +0 -1
  224. package/dist/transitions/none.d.ts +0 -8
  225. package/dist/transitions/none.d.ts.map +0 -1
  226. package/dist/transitions/rotate.d.ts +0 -15
  227. package/dist/transitions/rotate.d.ts.map +0 -1
  228. package/dist/transitions/scale.d.ts +0 -11
  229. package/dist/transitions/scale.d.ts.map +0 -1
  230. package/dist/transitions/slide.d.ts +0 -13
  231. package/dist/transitions/slide.d.ts.map +0 -1
  232. package/dist/types.d.ts.map +0 -1
  233. package/dist/view-transitions/blind.d.ts +0 -11
  234. package/dist/view-transitions/blind.d.ts.map +0 -1
  235. package/dist/view-transitions/curtain-reveal.d.ts +0 -18
  236. package/dist/view-transitions/curtain-reveal.d.ts.map +0 -1
  237. package/dist/view-transitions/depth.d.ts +0 -21
  238. package/dist/view-transitions/depth.d.ts.map +0 -1
  239. package/dist/view-transitions/drill.d.ts +0 -9
  240. package/dist/view-transitions/drill.d.ts.map +0 -1
  241. package/dist/view-transitions/fade.d.ts +0 -8
  242. package/dist/view-transitions/fade.d.ts.map +0 -1
  243. package/dist/view-transitions/film.d.ts +0 -10
  244. package/dist/view-transitions/film.d.ts.map +0 -1
  245. package/dist/view-transitions/hero.d.ts +0 -9
  246. package/dist/view-transitions/hero.d.ts.map +0 -1
  247. package/dist/view-transitions/index.cjs +0 -35
  248. package/dist/view-transitions/index.d.ts +0 -18
  249. package/dist/view-transitions/index.d.ts.map +0 -1
  250. package/dist/view-transitions/index.js +0 -1614
  251. package/dist/view-transitions/instagram.d.ts +0 -8
  252. package/dist/view-transitions/instagram.d.ts.map +0 -1
  253. package/dist/view-transitions/jaemin.d.ts +0 -21
  254. package/dist/view-transitions/jaemin.d.ts.map +0 -1
  255. package/dist/view-transitions/pinterest.d.ts +0 -8
  256. package/dist/view-transitions/pinterest.d.ts.map +0 -1
  257. package/dist/view-transitions/rotate.d.ts +0 -6
  258. package/dist/view-transitions/rotate.d.ts.map +0 -1
  259. package/dist/view-transitions/scroll.d.ts +0 -8
  260. package/dist/view-transitions/scroll.d.ts.map +0 -1
  261. package/dist/view-transitions/sheet.d.ts +0 -21
  262. package/dist/view-transitions/sheet.d.ts.map +0 -1
  263. package/dist/view-transitions/slide.d.ts +0 -8
  264. package/dist/view-transitions/slide.d.ts.map +0 -1
  265. package/dist/view-transitions/snap.d.ts +0 -16
  266. package/dist/view-transitions/snap.d.ts.map +0 -1
  267. package/dist/view-transitions/strip.d.ts +0 -7
  268. package/dist/view-transitions/strip.d.ts.map +0 -1
  269. package/dist/view-transitions/swap.d.ts +0 -15
  270. package/dist/view-transitions/swap.d.ts.map +0 -1
  271. /package/dist/{animator → animation}/integrator/double-spring-integrator.d.ts +0 -0
  272. /package/dist/{animator → animation}/integrator/inertia-integrator.d.ts +0 -0
  273. /package/dist/{animator → animation}/integrator/spring-integrator.d.ts +0 -0
  274. /package/dist/{animator → animation}/integrator/types.d.ts +0 -0
@@ -0,0 +1 @@
1
+ "use strict";var ue=Object.defineProperty;var fe=(e,n,t)=>n in e?ue(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var W=(e,n,t)=>fe(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./multi-animation-Dw2JTJI2.cjs");class se extends H.Animation{constructor(){super(...arguments);W(this,"child",null);W(this,"_state","idle");W(this,"_settled",!1);W(this,"listeners",new Set)}attach(t){const o=this.child;if(this.child=t,this._settled=!1,o){const m=o.getPose();o.complete(),t.matchInto(m)}t.playbackRate=this.playbackRate;const c=t.onComplete;t.onComplete=()=>{c==null||c(),this.child===t&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const d=t.onUpdate;t.onUpdate=m=>{var w;d==null||d(m),(w=this.onUpdate)==null||w.call(this,m),this.notify()},this._state==="paused"?t.pause():this._state==="reversing"?t.reverse():(this._state="playing",t.play()),this.notify()}play(){var t;this._state="playing",this._settled=!1,(t=this.child)==null||t.play(),this.notify()}reverse(){var t;this._state="reversing",this._settled=!1,(t=this.child)==null||t.reverse(),this.notify()}pause(){var t;this._state="paused",(t=this.child)==null||t.pause(),this.notify()}complete(){var t;(t=this.child)==null||t.complete(),this.notify()}get isAnimating(){var t;return((t=this.child)==null?void 0:t.isAnimating)??!1}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child}get isReversing(){var t;return((t=this.child)==null?void 0:t.isReversing)??this._state==="reversing"}get progress(){var t;return((t=this.child)==null?void 0:t.progress)??0}findTimeForProgress(t){var o;return((o=this.child)==null?void 0:o.findTimeForProgress(t))??null}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t,this.child&&(this.child.playbackRate=t),this.notify()}getPose(){var t;return((t=this.child)==null?void 0:t.getPose())??[]}getTimeline(){var t;return((t=this.child)==null?void 0:t.getTimeline())??[]}matchInto(t){var o;(o=this.child)==null||o.matchInto(t)}get activeChild(){return this.child}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(const t of this.listeners)t()}}const de=(e,n)=>{var t;e.style.position="absolute",e.style.width="100%",e.style.top=`${-1*(((t=n==null?void 0:n.scrollOffset)==null?void 0:t.y)??0)}px`,e.style.left="0"},Q=new Set(["auto","scroll","overlay"]),me=e=>{let n=e.parentElement;for(;n&&n!==document.body;){const t=window.getComputedStyle(n);if(Q.has(t.overflowY)||Q.has(t.overflowX))return n;n=n.parentElement}return document.documentElement},he=e=>{let n=e.parentElement;for(;n&&n!==document.body;){const t=window.getComputedStyle(n).position;if(t==="relative"||t==="absolute"||t==="fixed"||t==="sticky")return n;n=n.parentElement}return document.body};function ge(e){const n=Object.keys(e);return Promise.all(n.map(t=>e[t])).then(t=>{const o={};return n.forEach((c,d)=>{o[c]=t[d]}),o})}function ye(e){const n=e.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...e,...n]}function F(e,n){if(n==="*")return!0;if(n.endsWith("/*")){const t=n.slice(0,-1);return e.startsWith(t)&&e.length>t.length}return e===n}function pe(e,n,t){for(const o of t)if(F(e,o.from)&&F(n,o.to))return o.transition;for(const o of t)if((o.from==="*"||F(e,o.from))&&(o.to==="*"||F(n,o.to)))return o.transition;return null}const ve=768,Ee=10,we=10;function Se(e={}){const{preserveScroll:n=i=>i}=e,t=typeof n=="function"?n:()=>n;let o=null,c=!1,d=!1;const m=()=>{const i=(o==null?void 0:o.clientWidth)??0,l=i>0?i:typeof window<"u"?window.innerWidth:0;return l>0&&l<ve},w=()=>(d||(c=m(),d=!0),c),y=i=>{var v;const l=t(w());if(l===!1)return{preserves:!1,shared:!1,storageKey:`path:${i}`};if(l===!0)return{preserves:!0,shared:!1,storageKey:`path:${i}`};const g=((v=l.exclude)==null?void 0:v.some(r=>F(i,r)))??!1,p=!g&&!!l.key;return{preserves:!g,shared:p,storageKey:p?`shared:${l.key}`:`path:${i}`}},x=i=>y(i).preserves;let R=null;const h=new Map;let T=null,A=!1,O=0;const I=()=>{o&&T&&!A&&h.set(y(T).storageKey,{x:o.scrollLeft,y:o.scrollTop})},L=i=>{if(!o)return;const l=y(i);if(l.preserves&&l.shared&&!h.has(l.storageKey))return;const g=l.preserves&&h.has(l.storageKey)?h.get(l.storageKey):{x:0,y:0};let p=0;const v=()=>{if(!o)return;o.scrollTo({top:g.y,left:g.x}),!(Math.abs(o.scrollTop-g.y)<1&&Math.abs(o.scrollLeft-g.x)<1)&&p<Ee&&(p++,requestAnimationFrame(v))};requestAnimationFrame(v)};return{initializeContext:(i,l)=>{A=!0;const g=++O;R=i,o||(o=me(i),c=m(),d=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{c=m()}).observe(o),(o===document.documentElement?window:o).addEventListener("scroll",I,{passive:!0})),T=l,L(l);let p=0;const v=()=>{g===O&&(p++,p>=we?A=!1:requestAnimationFrame(v))};requestAnimationFrame(v)},calculateScrollOffset:(i,l)=>{const g=i?y(i).storageKey:null,p=g&&h.has(g)?h.get(g):{x:0,y:0},v=l?y(l):null,r=v!=null&&v.preserves?v.storageKey:null,s=r&&h.has(r)?h.get(r):{x:0,y:0};return{x:-s.x+p.x,y:-s.y+p.y}},evictScrollPosition:i=>{h.delete(y(i).storageKey)},shouldPreserve:x,getScrollContainer:()=>o,getPositionedParentElement:()=>R?he(R):document.body,getScrollPosition:i=>{const l=i?y(i).storageKey:null;return l&&h.has(l)?h.get(l):{x:0,y:0}}}}const ee=30,te=8,ne=1.2,oe=30,be=600;function Te(){let e=null,n=!1,t=!1,o=null,c=null,d=!1;const m=(a,u)=>{for(let f=0;f<a.length;f++){const E=a.item(f);if(E&&E.identifier===u)return E}return null},w=()=>{o!==null&&(clearTimeout(o),o=null)},y=()=>{c!==null&&(clearTimeout(c),c=null)},x=()=>{n=!0,t=!0,w(),y(),o=setTimeout(()=>{n=!1,t=!1,o=null},be)},R=a=>{if(a.touches.length!==1){e=null;return}const u=a.touches.item(0);if(!u){e=null;return}const f=window.innerWidth,E=u.clientX<=ee,P=u.clientX>=f-ee;if(!E&&!P){e=null;return}e={identifier:u.identifier,startX:u.clientX,startY:u.clientY,fromLeftEdge:E,moved:!1}},h=a=>{if(!e)return;if(a.touches.length!==1){e=null;return}const u=m(a.touches,e.identifier);if(!u){e=null;return}const f=u.clientX-e.startX,E=u.clientY-e.startY,P=Math.abs(f),i=Math.abs(E);if(i>te&&i>P*ne){e=null;return}const l=e.fromLeftEdge?f>0:f<0;P>te&&P>i*ne&&l&&(e.moved=!0)},T=a=>{if(!e)return;const u=m(a.changedTouches,e.identifier);if(!u){e=null;return}const f=u.clientX-e.startX,E=e.fromLeftEdge?f>0:f<0;if(e.moved&&E&&Math.abs(f)>=oe){x(),e=null;return}e.moved&&Math.abs(f)>=oe&&x(),e=null},A=()=>{e&&(e.moved&&x(),e=null)};return{initialize:()=>{if(typeof window>"u"||d)return;d=!0;const a={passive:!0,capture:!0};window.addEventListener("touchstart",R,a),window.addEventListener("touchmove",h,a),window.addEventListener("touchend",T,a),window.addEventListener("touchcancel",A,a)},destroy:()=>{if(typeof window>"u"||!d)return;d=!1;const a={capture:!0};window.removeEventListener("touchstart",R,a),window.removeEventListener("touchmove",h,a),window.removeEventListener("touchend",T,a),window.removeEventListener("touchcancel",A,a),w(),y(),e=null,n=!1,t=!1},isSwipeBack:()=>{const a=n||t;return a&&w(),a},onPageEnter:()=>{n=!1,w(),y(),c=setTimeout(()=>{t=!1,c=null},0)}}}function Pe(){let e=null;function n(){var o,c;e&&((o=e.outResolve)==null||o.call(e,null),(c=e.inResolve)==null||c.call(e,null),e=null)}function t(){if(e!=null&&e.from&&(e!=null&&e.to)&&(e!=null&&e.outResolve)&&(e!=null&&e.inResolve)){if(e.from===e.to){n();return}const o={from:e.from,to:e.to};e.outResolve(o),e.inResolve(o),e=null}}return{trigger(o,c){var m;c==="out"&&(e==null?void 0:e.to)===o&&!e.from&&((m=e.inResolve)==null||m.call(e,null),e={}),e&&(c==="out"&&e.from&&e.from!==o||c==="in"&&e.to&&e.to!==o)&&n(),e||(e={}),c==="out"?e.from=o:e.to=o},get(o){return new Promise(c=>{e||(e={}),o==="out"?e.outResolve=c:e.inResolve=c,t()})}}}const X=new Map;let z=null,re=!1;function ie(e){if(e instanceof HTMLElement&&X.has(e)){const n=X.get(e);X.delete(e),queueMicrotask(n)}for(const n of Array.from(e.childNodes))ie(n)}function Re(){if(re||typeof document>"u")return;re=!0,z=new MutationObserver(n=>{for(const t of n)for(const o of Array.from(t.removedNodes))ie(o)});const e=()=>{z==null||z.observe(document.body,{childList:!0,subtree:!0})};document.body?e():document.addEventListener("DOMContentLoaded",e,{once:!0})}function Ae(e,n){return Re(),X.set(e,n),()=>{X.delete(e)}}function xe(e){return Array.isArray(e)}function le(e){const n=[];for(const t of e)xe(t)?n.push(...le(t)):n.push(t);return n}function Le(e,n={}){const{transitions:t=[],middleware:o=(r,s)=>({from:r,to:s}),preserveScroll:c=r=>r}=e,d=n.host??new se,m=Pe(),w=ye(le(t)),y=Te();y.initialize();const{initializeContext:x,calculateScrollOffset:R,evictScrollPosition:h,shouldPreserve:T,getScrollContainer:A,getPositionedParentElement:O,getScrollPosition:I}=Se({preserveScroll:c});let L=null,k=null;const a=new WeakMap,u=r=>{a.set(r,{parent:r.parentElement,nextSibling:r.nextElementSibling})},f=r=>{const s=a.get(r);return s||{parent:r.parentElement,nextSibling:r.nextElementSibling}},E=(r,s,b,S,B)=>{const K=S.element,D=B.element,{parent:M,nextSibling:C}=S.parent?{parent:S.parent,nextSibling:S.nextSibling}:f(K),_=K.cloneNode(!0),q={scrollOffset:R(s,b),from:{scroll:I(s)},to:{scroll:I(b)},get scrollingElement(){return A()||document.documentElement},get positionedParent(){return O()}};de(_,q),T(s)||h(s);const j=Promise.resolve(_),Z=Promise.resolve(D),J=[],ce={from:j,to:Z,context:q,createElement:((Y,$="div")=>{const N=document.createElement($);return N.setAttribute("data-ssgoi-id",Y),J.push(N),N})},ae=Promise.resolve(r.prepare?r.prepare(ce):{});ge({from:j,to:Z,extras:ae}).then(({from:Y,to:$,extras:N})=>{M&&(C&&M.contains(C)?M.insertBefore(_,C):M.appendChild(_));const G=r.animation({from:Y,to:$,context:q,...N}),U=G.onComplete;G.onComplete=()=>{U==null||U(),_.parentElement&&_.parentElement.removeChild(_);for(const V of J)V.parentElement&&V.parentElement.removeChild(V)},d.attach(G)})},P=(r,s)=>{const b=y.isSwipeBack();m.trigger(r,s),m.get(s).then(S=>{if(s==="in"&&y.onPageEnter(),!S)return;if(b){s==="out"&&S.from&&!T(S.from)&&h(S.from),L=null,k=null;return}if(s!=="in")return;const{from:B,to:K}=o(S.from,S.to),D=pe(B,K,w),M=L,C=k;L=null,k=null,!(!D||!M||!C)&&E(D,B,K,M,C)})},i=(r,s)=>{const b=f(r);L={element:r,parent:b.parent,nextSibling:b.nextSibling},P(s,"out")},l=new WeakSet,g=(r,s)=>{l.has(s)||(l.add(s),u(s),x(s,r),k={element:s,parent:s.parentElement,nextSibling:s.nextElementSibling},P(r,"in"),Ae(s,()=>i(s,r)))},p=new Map;return{register:g,refFor:r=>{let s=p.get(r);return s||(s=b=>{b&&g(r,b)},p.set(r,s)),s}}}exports.Animation=H.Animation;exports.MultiAnimation=H.MultiAnimation;exports.WebAnimation=H.WebAnimation;exports.HostAnimation=se;exports.createSggoiTransitionContext=Le;
@@ -0,0 +1,4 @@
1
+ export { createSggoiTransitionContext } from './ssgoi-transition/create-ssgoi-transition-context';
2
+ export { Animation, WebAnimation, MultiAnimation, HostAnimation, } from './animation';
3
+ export type { SsgoiConfig, SsgoiContext, SsgoiPathTransition, SsgoiPathTransitionInput, TransitionConfig, PrepareArgs, AnimationFactoryArgs, CreateElement, SsgoiTransitionContext, Pose, Timeline, } from './types/index.ts';
4
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/lib/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAClG,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EACtB,IAAI,EACJ,QAAQ,GACT,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,511 @@
1
+ var ce = Object.defineProperty;
2
+ var ae = (e, n, t) => n in e ? ce(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
+ var W = (e, n, t) => ae(e, typeof n != "symbol" ? n + "" : n, t);
4
+ import { A as ue } from "./multi-animation-CnxqLEka.js";
5
+ import { M as Ke, W as Ne } from "./multi-animation-CnxqLEka.js";
6
+ class fe extends ue {
7
+ constructor() {
8
+ super(...arguments);
9
+ W(this, "child", null);
10
+ W(this, "_state", "idle");
11
+ W(this, "_settled", !1);
12
+ W(this, "listeners", /* @__PURE__ */ new Set());
13
+ }
14
+ attach(t) {
15
+ const o = this.child;
16
+ if (this.child = t, this._settled = !1, o) {
17
+ const h = o.getPose();
18
+ o.complete(), t.matchInto(h);
19
+ }
20
+ t.playbackRate = this.playbackRate;
21
+ const c = t.onComplete;
22
+ t.onComplete = () => {
23
+ c == null || c(), this.child === t && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
24
+ };
25
+ const d = t.onUpdate;
26
+ t.onUpdate = (h) => {
27
+ var w;
28
+ d == null || d(h), (w = this.onUpdate) == null || w.call(this, h), this.notify();
29
+ }, this._state === "paused" ? t.pause() : this._state === "reversing" ? t.reverse() : (this._state = "playing", t.play()), this.notify();
30
+ }
31
+ play() {
32
+ var t;
33
+ this._state = "playing", this._settled = !1, (t = this.child) == null || t.play(), this.notify();
34
+ }
35
+ reverse() {
36
+ var t;
37
+ this._state = "reversing", this._settled = !1, (t = this.child) == null || t.reverse(), this.notify();
38
+ }
39
+ pause() {
40
+ var t;
41
+ this._state = "paused", (t = this.child) == null || t.pause(), this.notify();
42
+ }
43
+ complete() {
44
+ var t;
45
+ (t = this.child) == null || t.complete(), this.notify();
46
+ }
47
+ get isAnimating() {
48
+ var t;
49
+ return ((t = this.child) == null ? void 0 : t.isAnimating) ?? !1;
50
+ }
51
+ get isPaused() {
52
+ return this._state === "paused";
53
+ }
54
+ get isComplete() {
55
+ return this._settled && !this.child;
56
+ }
57
+ get isReversing() {
58
+ var t;
59
+ return ((t = this.child) == null ? void 0 : t.isReversing) ?? this._state === "reversing";
60
+ }
61
+ get progress() {
62
+ var t;
63
+ return ((t = this.child) == null ? void 0 : t.progress) ?? 0;
64
+ }
65
+ findTimeForProgress(t) {
66
+ var o;
67
+ return ((o = this.child) == null ? void 0 : o.findTimeForProgress(t)) ?? null;
68
+ }
69
+ get playbackRate() {
70
+ return super.playbackRate;
71
+ }
72
+ set playbackRate(t) {
73
+ super.playbackRate = t, this.child && (this.child.playbackRate = t), this.notify();
74
+ }
75
+ getPose() {
76
+ var t;
77
+ return ((t = this.child) == null ? void 0 : t.getPose()) ?? [];
78
+ }
79
+ getTimeline() {
80
+ var t;
81
+ return ((t = this.child) == null ? void 0 : t.getTimeline()) ?? [];
82
+ }
83
+ matchInto(t) {
84
+ var o;
85
+ (o = this.child) == null || o.matchInto(t);
86
+ }
87
+ /** Currently attached child, or null when nothing is playing. */
88
+ get activeChild() {
89
+ return this.child;
90
+ }
91
+ /** Subscribe to host state changes. Returns an unsubscribe fn. */
92
+ subscribe(t) {
93
+ return this.listeners.add(t), () => {
94
+ this.listeners.delete(t);
95
+ };
96
+ }
97
+ notify() {
98
+ for (const t of this.listeners) t();
99
+ }
100
+ }
101
+ const de = (e, n) => {
102
+ var t;
103
+ e.style.position = "absolute", e.style.width = "100%", e.style.top = `${-1 * (((t = n == null ? void 0 : n.scrollOffset) == null ? void 0 : t.y) ?? 0)}px`, e.style.left = "0";
104
+ }, J = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), he = (e) => {
105
+ let n = e.parentElement;
106
+ for (; n && n !== document.body; ) {
107
+ const t = window.getComputedStyle(n);
108
+ if (J.has(t.overflowY) || J.has(t.overflowX))
109
+ return n;
110
+ n = n.parentElement;
111
+ }
112
+ return document.documentElement;
113
+ }, me = (e) => {
114
+ let n = e.parentElement;
115
+ for (; n && n !== document.body; ) {
116
+ const t = window.getComputedStyle(n).position;
117
+ if (t === "relative" || t === "absolute" || t === "fixed" || t === "sticky")
118
+ return n;
119
+ n = n.parentElement;
120
+ }
121
+ return document.body;
122
+ };
123
+ function ge(e) {
124
+ const n = Object.keys(e);
125
+ return Promise.all(n.map((t) => e[t])).then((t) => {
126
+ const o = {};
127
+ return n.forEach((c, d) => {
128
+ o[c] = t[d];
129
+ }), o;
130
+ });
131
+ }
132
+ function ye(e) {
133
+ const n = e.filter((t) => t.symmetric).map((t) => ({
134
+ from: t.to,
135
+ to: t.from,
136
+ transition: t.transition
137
+ }));
138
+ return [...e, ...n];
139
+ }
140
+ function F(e, n) {
141
+ if (n === "*")
142
+ return !0;
143
+ if (n.endsWith("/*")) {
144
+ const t = n.slice(0, -1);
145
+ return e.startsWith(t) && e.length > t.length;
146
+ }
147
+ return e === n;
148
+ }
149
+ function pe(e, n, t) {
150
+ for (const o of t)
151
+ if (F(e, o.from) && F(n, o.to))
152
+ return o.transition;
153
+ for (const o of t)
154
+ if ((o.from === "*" || F(e, o.from)) && (o.to === "*" || F(n, o.to)))
155
+ return o.transition;
156
+ return null;
157
+ }
158
+ const ve = 768, Ee = 10, we = 10;
159
+ function Se(e = {}) {
160
+ const { preserveScroll: n = (i) => i } = e, t = typeof n == "function" ? n : () => n;
161
+ let o = null, c = !1, d = !1;
162
+ const h = () => {
163
+ const i = (o == null ? void 0 : o.clientWidth) ?? 0, l = i > 0 ? i : typeof window < "u" ? window.innerWidth : 0;
164
+ return l > 0 && l < ve;
165
+ }, w = () => (d || (c = h(), d = !0), c), y = (i) => {
166
+ var v;
167
+ const l = t(w());
168
+ if (l === !1)
169
+ return { preserves: !1, shared: !1, storageKey: `path:${i}` };
170
+ if (l === !0)
171
+ return { preserves: !0, shared: !1, storageKey: `path:${i}` };
172
+ const g = ((v = l.exclude) == null ? void 0 : v.some((r) => F(i, r))) ?? !1, p = !g && !!l.key;
173
+ return {
174
+ preserves: !g,
175
+ shared: p,
176
+ storageKey: p ? `shared:${l.key}` : `path:${i}`
177
+ };
178
+ }, x = (i) => y(i).preserves;
179
+ let P = null;
180
+ const m = /* @__PURE__ */ new Map();
181
+ let T = null, A = !1, O = 0;
182
+ const I = () => {
183
+ o && T && !A && m.set(y(T).storageKey, {
184
+ x: o.scrollLeft,
185
+ y: o.scrollTop
186
+ });
187
+ }, L = (i) => {
188
+ if (!o) return;
189
+ const l = y(i);
190
+ if (l.preserves && l.shared && !m.has(l.storageKey))
191
+ return;
192
+ const g = l.preserves && m.has(l.storageKey) ? m.get(l.storageKey) : { x: 0, y: 0 };
193
+ let p = 0;
194
+ const v = () => {
195
+ if (!o) return;
196
+ o.scrollTo({
197
+ top: g.y,
198
+ left: g.x
199
+ }), !(Math.abs(o.scrollTop - g.y) < 1 && Math.abs(o.scrollLeft - g.x) < 1) && p < Ee && (p++, requestAnimationFrame(v));
200
+ };
201
+ requestAnimationFrame(v);
202
+ };
203
+ return {
204
+ initializeContext: (i, l) => {
205
+ A = !0;
206
+ const g = ++O;
207
+ P = i, o || (o = he(i), c = h(), d = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
208
+ c = h();
209
+ }).observe(o), (o === document.documentElement ? window : o).addEventListener("scroll", I, {
210
+ passive: !0
211
+ })), T = l, L(l);
212
+ let p = 0;
213
+ const v = () => {
214
+ g === O && (p++, p >= we ? A = !1 : requestAnimationFrame(v));
215
+ };
216
+ requestAnimationFrame(v);
217
+ },
218
+ calculateScrollOffset: (i, l) => {
219
+ const g = i ? y(i).storageKey : null, p = g && m.has(g) ? m.get(g) : { x: 0, y: 0 }, v = l ? y(l) : null, r = v != null && v.preserves ? v.storageKey : null, s = r && m.has(r) ? m.get(r) : { x: 0, y: 0 };
220
+ return {
221
+ x: -s.x + p.x,
222
+ y: -s.y + p.y
223
+ };
224
+ },
225
+ evictScrollPosition: (i) => {
226
+ m.delete(y(i).storageKey);
227
+ },
228
+ shouldPreserve: x,
229
+ getScrollContainer: () => o,
230
+ getPositionedParentElement: () => P ? me(P) : document.body,
231
+ getScrollPosition: (i) => {
232
+ const l = i ? y(i).storageKey : null;
233
+ return l && m.has(l) ? m.get(l) : { x: 0, y: 0 };
234
+ }
235
+ };
236
+ }
237
+ const Q = 30, ee = 8, te = 1.2, ne = 30, be = 600;
238
+ function Te() {
239
+ let e = null, n = !1, t = !1, o = null, c = null, d = !1;
240
+ const h = (a, u) => {
241
+ for (let f = 0; f < a.length; f++) {
242
+ const E = a.item(f);
243
+ if (E && E.identifier === u) return E;
244
+ }
245
+ return null;
246
+ }, w = () => {
247
+ o !== null && (clearTimeout(o), o = null);
248
+ }, y = () => {
249
+ c !== null && (clearTimeout(c), c = null);
250
+ }, x = () => {
251
+ n = !0, t = !0, w(), y(), o = setTimeout(() => {
252
+ n = !1, t = !1, o = null;
253
+ }, be);
254
+ }, P = (a) => {
255
+ if (a.touches.length !== 1) {
256
+ e = null;
257
+ return;
258
+ }
259
+ const u = a.touches.item(0);
260
+ if (!u) {
261
+ e = null;
262
+ return;
263
+ }
264
+ const f = window.innerWidth, E = u.clientX <= Q, R = u.clientX >= f - Q;
265
+ if (!E && !R) {
266
+ e = null;
267
+ return;
268
+ }
269
+ e = {
270
+ identifier: u.identifier,
271
+ startX: u.clientX,
272
+ startY: u.clientY,
273
+ fromLeftEdge: E,
274
+ moved: !1
275
+ };
276
+ }, m = (a) => {
277
+ if (!e) return;
278
+ if (a.touches.length !== 1) {
279
+ e = null;
280
+ return;
281
+ }
282
+ const u = h(a.touches, e.identifier);
283
+ if (!u) {
284
+ e = null;
285
+ return;
286
+ }
287
+ const f = u.clientX - e.startX, E = u.clientY - e.startY, R = Math.abs(f), i = Math.abs(E);
288
+ if (i > ee && i > R * te) {
289
+ e = null;
290
+ return;
291
+ }
292
+ const l = e.fromLeftEdge ? f > 0 : f < 0;
293
+ R > ee && R > i * te && l && (e.moved = !0);
294
+ }, T = (a) => {
295
+ if (!e) return;
296
+ const u = h(a.changedTouches, e.identifier);
297
+ if (!u) {
298
+ e = null;
299
+ return;
300
+ }
301
+ const f = u.clientX - e.startX, E = e.fromLeftEdge ? f > 0 : f < 0;
302
+ if (e.moved && E && Math.abs(f) >= ne) {
303
+ x(), e = null;
304
+ return;
305
+ }
306
+ e.moved && Math.abs(f) >= ne && x(), e = null;
307
+ }, A = () => {
308
+ e && (e.moved && x(), e = null);
309
+ };
310
+ return { initialize: () => {
311
+ if (typeof window > "u" || d) return;
312
+ d = !0;
313
+ const a = { passive: !0, capture: !0 };
314
+ window.addEventListener("touchstart", P, a), window.addEventListener("touchmove", m, a), window.addEventListener("touchend", T, a), window.addEventListener("touchcancel", A, a);
315
+ }, destroy: () => {
316
+ if (typeof window > "u" || !d) return;
317
+ d = !1;
318
+ const a = { capture: !0 };
319
+ window.removeEventListener("touchstart", P, a), window.removeEventListener("touchmove", m, a), window.removeEventListener("touchend", T, a), window.removeEventListener("touchcancel", A, a), w(), y(), e = null, n = !1, t = !1;
320
+ }, isSwipeBack: () => {
321
+ const a = n || t;
322
+ return a && w(), a;
323
+ }, onPageEnter: () => {
324
+ n = !1, w(), y(), c = setTimeout(() => {
325
+ t = !1, c = null;
326
+ }, 0);
327
+ } };
328
+ }
329
+ function Re() {
330
+ let e = null;
331
+ function n() {
332
+ var o, c;
333
+ e && ((o = e.outResolve) == null || o.call(e, null), (c = e.inResolve) == null || c.call(e, null), e = null);
334
+ }
335
+ function t() {
336
+ if (e != null && e.from && (e != null && e.to) && (e != null && e.outResolve) && (e != null && e.inResolve)) {
337
+ if (e.from === e.to) {
338
+ n();
339
+ return;
340
+ }
341
+ const o = { from: e.from, to: e.to };
342
+ e.outResolve(o), e.inResolve(o), e = null;
343
+ }
344
+ }
345
+ return {
346
+ trigger(o, c) {
347
+ var h;
348
+ c === "out" && (e == null ? void 0 : e.to) === o && !e.from && ((h = e.inResolve) == null || h.call(e, null), e = {}), e && (c === "out" && e.from && e.from !== o || c === "in" && e.to && e.to !== o) && n(), e || (e = {}), c === "out" ? e.from = o : e.to = o;
349
+ },
350
+ get(o) {
351
+ return new Promise((c) => {
352
+ e || (e = {}), o === "out" ? e.outResolve = c : e.inResolve = c, t();
353
+ });
354
+ }
355
+ };
356
+ }
357
+ const X = /* @__PURE__ */ new Map();
358
+ let z = null, oe = !1;
359
+ function re(e) {
360
+ if (e instanceof HTMLElement && X.has(e)) {
361
+ const n = X.get(e);
362
+ X.delete(e), queueMicrotask(n);
363
+ }
364
+ for (const n of Array.from(e.childNodes))
365
+ re(n);
366
+ }
367
+ function Pe() {
368
+ if (oe || typeof document > "u") return;
369
+ oe = !0, z = new MutationObserver((n) => {
370
+ for (const t of n)
371
+ for (const o of Array.from(t.removedNodes))
372
+ re(o);
373
+ });
374
+ const e = () => {
375
+ z == null || z.observe(document.body, { childList: !0, subtree: !0 });
376
+ };
377
+ document.body ? e() : document.addEventListener("DOMContentLoaded", e, { once: !0 });
378
+ }
379
+ function Ae(e, n) {
380
+ return Pe(), X.set(e, n), () => {
381
+ X.delete(e);
382
+ };
383
+ }
384
+ function xe(e) {
385
+ return Array.isArray(e);
386
+ }
387
+ function se(e) {
388
+ const n = [];
389
+ for (const t of e)
390
+ xe(t) ? n.push(...se(t)) : n.push(t);
391
+ return n;
392
+ }
393
+ function Ce(e, n = {}) {
394
+ const {
395
+ transitions: t = [],
396
+ middleware: o = (r, s) => ({ from: r, to: s }),
397
+ preserveScroll: c = (r) => r
398
+ } = e, d = n.host ?? new fe(), h = Re(), w = ye(
399
+ se(t)
400
+ ), y = Te();
401
+ y.initialize();
402
+ const {
403
+ initializeContext: x,
404
+ calculateScrollOffset: P,
405
+ evictScrollPosition: m,
406
+ shouldPreserve: T,
407
+ getScrollContainer: A,
408
+ getPositionedParentElement: O,
409
+ getScrollPosition: I
410
+ } = Se({ preserveScroll: c });
411
+ let L = null, k = null;
412
+ const a = /* @__PURE__ */ new WeakMap(), u = (r) => {
413
+ a.set(r, {
414
+ parent: r.parentElement,
415
+ nextSibling: r.nextElementSibling
416
+ });
417
+ }, f = (r) => {
418
+ const s = a.get(r);
419
+ return s || {
420
+ parent: r.parentElement,
421
+ nextSibling: r.nextElementSibling
422
+ };
423
+ }, E = (r, s, b, S, B) => {
424
+ const K = S.element, D = B.element, { parent: _, nextSibling: C } = S.parent ? { parent: S.parent, nextSibling: S.nextSibling } : f(K), M = K.cloneNode(!0), H = {
425
+ scrollOffset: P(s, b),
426
+ from: { scroll: I(s) },
427
+ to: { scroll: I(b) },
428
+ get scrollingElement() {
429
+ return A() || document.documentElement;
430
+ },
431
+ get positionedParent() {
432
+ return O();
433
+ }
434
+ };
435
+ de(M, H), T(s) || m(s);
436
+ const V = Promise.resolve(M), Z = Promise.resolve(D), j = [], ie = {
437
+ from: V,
438
+ to: Z,
439
+ context: H,
440
+ createElement: ((q, Y = "div") => {
441
+ const N = document.createElement(Y);
442
+ return N.setAttribute("data-ssgoi-id", q), j.push(N), N;
443
+ })
444
+ }, le = Promise.resolve(
445
+ r.prepare ? r.prepare(ie) : {}
446
+ );
447
+ ge({
448
+ from: V,
449
+ to: Z,
450
+ extras: le
451
+ }).then(({ from: q, to: Y, extras: N }) => {
452
+ _ && (C && _.contains(C) ? _.insertBefore(M, C) : _.appendChild(M));
453
+ const $ = r.animation({
454
+ from: q,
455
+ to: Y,
456
+ context: H,
457
+ ...N
458
+ }), G = $.onComplete;
459
+ $.onComplete = () => {
460
+ G == null || G(), M.parentElement && M.parentElement.removeChild(M);
461
+ for (const U of j)
462
+ U.parentElement && U.parentElement.removeChild(U);
463
+ }, d.attach($);
464
+ });
465
+ }, R = (r, s) => {
466
+ const b = y.isSwipeBack();
467
+ h.trigger(r, s), h.get(s).then((S) => {
468
+ if (s === "in" && y.onPageEnter(), !S) return;
469
+ if (b) {
470
+ s === "out" && S.from && !T(S.from) && m(S.from), L = null, k = null;
471
+ return;
472
+ }
473
+ if (s !== "in") return;
474
+ const { from: B, to: K } = o(
475
+ S.from,
476
+ S.to
477
+ ), D = pe(
478
+ B,
479
+ K,
480
+ w
481
+ ), _ = L, C = k;
482
+ L = null, k = null, !(!D || !_ || !C) && E(D, B, K, _, C);
483
+ });
484
+ }, i = (r, s) => {
485
+ const b = f(r);
486
+ L = {
487
+ element: r,
488
+ parent: b.parent,
489
+ nextSibling: b.nextSibling
490
+ }, R(s, "out");
491
+ }, l = /* @__PURE__ */ new WeakSet(), g = (r, s) => {
492
+ l.has(s) || (l.add(s), u(s), x(s, r), k = {
493
+ element: s,
494
+ parent: s.parentElement,
495
+ nextSibling: s.nextElementSibling
496
+ }, R(r, "in"), Ae(s, () => i(s, r)));
497
+ }, p = /* @__PURE__ */ new Map();
498
+ return { register: g, refFor: (r) => {
499
+ let s = p.get(r);
500
+ return s || (s = (b) => {
501
+ b && g(r, b);
502
+ }, p.set(r, s)), s;
503
+ } };
504
+ }
505
+ export {
506
+ ue as Animation,
507
+ fe as HostAnimation,
508
+ Ke as MultiAnimation,
509
+ Ne as WebAnimation,
510
+ Ce as createSggoiTransitionContext
511
+ };