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