@ssgoi/core 6.6.0 → 6.6.1
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/internal.cjs +1 -1
- package/dist/internal.js +179 -174
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts +4 -4
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/ssgoi-transition/unmount-observer.d.ts +5 -1
- package/dist/ssgoi-transition/unmount-observer.d.ts.map +1 -1
- package/package.json +14 -13
package/dist/internal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Ot=Object.defineProperty;var _t=(t,s,e)=>s in t?Ot(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e;var F=(t,s,e)=>_t(t,typeof s!="symbol"?s+"":s,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("./multi-animation-uzEnQnrG.cjs");class St extends J.Animation{constructor(){super(...arguments);F(this,"child",null);F(this,"_state","idle");F(this,"_settled",!1);F(this,"listeners",new Set)}attach(e){const n=this.child;if(this.child=e,this._settled=!1,n){const a=n.getPose();n.complete(),e.matchInto(a)}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 y=e.onUpdate;e.onUpdate=a=>{var p;y==null||y(a),(p=this.onUpdate)==null||p.call(this,a),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 progress(){var e;return((e=this.child)==null?void 0:e.progress)??0}findTimeForProgress(e){var n;return((n=this.child)==null?void 0:n.findTimeForProgress(e))??null}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 n;(n=this.child)==null||n.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 kt=(t,s)=>{var e;t.style.position="absolute",t.style.width="100%",t.style.top=`${-1*(((e=s==null?void 0:s.scrollOffset)==null?void 0:e.y)??0)}px`,t.style.left="0"},yt=new Set(["auto","scroll","overlay"]),Dt=t=>{let s=t.parentElement;for(;s&&s!==document.body;){const e=window.getComputedStyle(s);if(yt.has(e.overflowY)||yt.has(e.overflowX))return s;s=s.parentElement}return document.documentElement},Ht=t=>{let s=t.parentElement;for(;s&&s!==document.body;){const e=window.getComputedStyle(s).position;if(e==="relative"||e==="absolute"||e==="fixed"||e==="sticky")return s;s=s.parentElement}return document.body};function It(t){const s=Object.keys(t);return Promise.all(s.map(e=>t[e])).then(e=>{const n={};return s.forEach((l,y)=>{n[l]=e[y]}),n})}function Nt(t){const s=t.filter(e=>e.symmetric).map(e=>({from:e.to,to:e.from,transition:e.transition}));return[...t,...s]}function K(t,s){if(s==="*")return!0;if(s.endsWith("/*")){const e=s.slice(0,-1);return t.startsWith(e)&&t.length>e.length}return t===s}function Wt(t,s,e){for(const n of e)if(K(t,n.from)&&K(s,n.to))return n.transition;for(const n of e)if((n.from==="*"||K(t,n.from))&&(n.to==="*"||K(s,n.to)))return n.transition;return null}const Ft=768,Kt=10,Bt=10;function Xt(t={}){const{preserveScroll:s=u=>u}=t,e=typeof s=="function"?s:()=>s;let n=null,l=!1,y=!1;const a=()=>{const u=(n==null?void 0:n.clientWidth)??0,c=u>0?u:typeof window<"u"?window.innerWidth:0;return c>0&&c<Ft},p=()=>(y||(l=a(),y=!0),l),v=u=>{var E;const c=e(p());if(c===!1)return{preserves:!1,shared:!1,storageKey:`path:${u}`};if(c===!0)return{preserves:!0,shared:!1,storageKey:`path:${u}`};const g=((E=c.exclude)==null?void 0:E.some(T=>K(u,T)))??!1,w=!g&&!!c.key;return{preserves:!g,shared:w,storageKey:w?`shared:${c.key}`:`path:${u}`}},C=u=>v(u).preserves;let x=null;const b=new Map;let A=null,L=!1,I=0;const N=()=>{n&&A&&!L&&b.set(v(A).storageKey,{x:n.scrollLeft,y:n.scrollTop})},z=u=>{if(!n)return;const c=v(u);if(c.preserves&&c.shared&&!b.has(c.storageKey))return;const g=c.preserves&&b.has(c.storageKey)?b.get(c.storageKey):{x:0,y:0};let w=0;const E=()=>{if(!n)return;n.scrollTo({top:g.y,left:g.x}),!(Math.abs(n.scrollTop-g.y)<1&&Math.abs(n.scrollLeft-g.x)<1)&&w<Kt&&(w++,requestAnimationFrame(E))};requestAnimationFrame(E)};return{initializeContext:(u,c)=>{L=!0;const g=++I;x=u,n||(n=Dt(u),l=a(),y=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{l=a()}).observe(n),(n===document.documentElement?window:n).addEventListener("scroll",N,{passive:!0})),A=c,z(c);let w=0;const E=()=>{g===I&&(w++,w>=Bt?L=!1:requestAnimationFrame(E))};requestAnimationFrame(E)},calculateScrollOffset:(u,c)=>{const g=u?v(u).storageKey:null,w=g&&b.has(g)?b.get(g):{x:0,y:0},E=c?v(c):null,T=E!=null&&E.preserves?E.storageKey:null,H=T&&b.has(T)?b.get(T):{x:0,y:0};return{x:-H.x+w.x,y:-H.y+w.y}},evictScrollPosition:u=>{b.delete(v(u).storageKey)},shouldPreserve:C,getScrollContainer:()=>n,getPositionedParentElement:()=>x?Ht(x):document.body,getScrollPosition:u=>{const c=u?v(u).storageKey:null;return c&&b.has(c)?b.get(c):{x:0,y:0}},getIsMobile:p}}const mt=30,pt=8,gt=1.2,vt=30,zt=600;function $t(){let t=null,s=!1,e=!1,n=null,l=null,y=!1;const a=(f,d)=>{for(let h=0;h<f.length;h++){const S=f.item(h);if(S&&S.identifier===d)return S}return null},p=()=>{n!==null&&(clearTimeout(n),n=null)},v=()=>{l!==null&&(clearTimeout(l),l=null)},C=()=>{s=!0,e=!0,p(),v(),n=setTimeout(()=>{s=!1,e=!1,n=null},zt)},x=f=>{if(f.touches.length!==1){t=null;return}const d=f.touches.item(0);if(!d){t=null;return}const h=window.innerWidth,S=d.clientX<=mt,O=d.clientX>=h-mt;if(!S&&!O){t=null;return}t={identifier:d.identifier,startX:d.clientX,startY:d.clientY,fromLeftEdge:S,moved:!1}},b=f=>{if(!t)return;if(f.touches.length!==1){t=null;return}const d=a(f.touches,t.identifier);if(!d){t=null;return}const h=d.clientX-t.startX,S=d.clientY-t.startY,O=Math.abs(h),u=Math.abs(S);if(u>pt&&u>O*gt){t=null;return}const c=t.fromLeftEdge?h>0:h<0;O>pt&&O>u*gt&&c&&(t.moved=!0)},A=f=>{if(!t)return;const d=a(f.changedTouches,t.identifier);if(!d){t=null;return}const h=d.clientX-t.startX,S=t.fromLeftEdge?h>0:h<0;if(t.moved&&S&&Math.abs(h)>=vt){C(),t=null;return}t.moved&&Math.abs(h)>=vt&&C(),t=null},L=()=>{t&&(t.moved&&C(),t=null)};return{initialize:()=>{if(typeof window>"u"||y)return;y=!0;const f={passive:!0,capture:!0};window.addEventListener("touchstart",x,f),window.addEventListener("touchmove",b,f),window.addEventListener("touchend",A,f),window.addEventListener("touchcancel",L,f)},destroy:()=>{if(typeof window>"u"||!y)return;y=!1;const f={capture:!0};window.removeEventListener("touchstart",x,f),window.removeEventListener("touchmove",b,f),window.removeEventListener("touchend",A,f),window.removeEventListener("touchcancel",L,f),p(),v(),t=null,s=!1,e=!1},isSwipeBack:()=>{const f=s||e;return f&&p(),f},onPageEnter:()=>{s=!1,p(),v(),l=setTimeout(()=>{e=!1,l=null},0)}}}function qt(){let t=null;function s(){var n,l;t&&((n=t.outResolve)==null||n.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){s();return}const n={from:t.from,to:t.to};t.outResolve(n),t.inResolve(n),t=null}}return{trigger(n,l){var a;l==="out"&&(t==null?void 0:t.to)===n&&!t.from&&((a=t.inResolve)==null||a.call(t,null),t={}),t&&(l==="out"&&t.from&&t.from!==n||l==="in"&&t.to&&t.to!==n)&&s(),t||(t={}),l==="out"?t.from=n:t.to=n},get(n){return new Promise(l=>{t||(t={}),n==="out"?t.outResolve=l:t.inResolve=l,e()})}}}const X=new Map;let G=null,bt=!1;function wt(t){if(t instanceof HTMLElement&&X.has(t)&&!t.isConnected){const s=X.get(t);X.delete(t),queueMicrotask(s)}for(const s of Array.from(t.childNodes))wt(s)}function Vt(){if(bt||typeof document>"u")return;bt=!0,G=new MutationObserver(s=>{for(const e of s)for(const n of Array.from(e.removedNodes))wt(n)});const t=()=>{G==null||G.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function Ut(t,s){return Vt(),X.set(t,s),()=>{X.delete(t)}}const rt=new WeakMap;let j=null;const Z="none !important";function B(t){const s=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${s} !important`:s}function Yt(){return j||(j=new MutationObserver(t=>{for(const s of t){const e=s.target,n=rt.get(e);if(!n)continue;const l=B(e);l!==n.accounted&&(n.accounted=l,l===Z?(n.reactHidden=!0,n.onHide()):l!=="none"&&n.reactHidden&&(n.reactHidden=!1,n.onShow()))}}),j)}function Gt(t,s){const e=B(t),n={accounted:e,reactHidden:e===Z,onHide:s.onHide,onShow:s.onShow};return rt.set(t,n),Yt().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return B(t)===Z},setDisplay(l,y=!1){l===null?t.style.removeProperty("display"):t.style.setProperty("display",l,y?"important":""),n.accounted=B(t)},sync(){n.accounted=B(t),n.reactHidden=n.accounted===Z},stop(){rt.delete(t)}}}function jt(t){return Array.isArray(t)}function Tt(t){const s=[];for(const e of t)jt(e)?s.push(...Tt(e)):s.push(e);return s}function Zt(t,s={}){const{transitions:e=[],middleware:n=(o,i)=>({from:o,to:i}),preserveScroll:l=o=>o}=t,y=s.host??new St,a=qt(),p=typeof e=="function"?e:()=>e,v=$t();v.initialize();const{initializeContext:C,calculateScrollOffset:x,evictScrollPosition:b,shouldPreserve:A,getScrollContainer:L,getPositionedParentElement:I,getScrollPosition:N,getIsMobile:z}=Xt({preserveScroll:l}),$=new Map,f=()=>{const o=z();let i=$.get(o);return i||(i=Nt(Tt(p({isMobile:o}))),$.set(o,i)),i};let d=null,h=null;const S=new WeakMap,O=o=>{S.set(o,{parent:o.parentElement,nextSibling:o.nextElementSibling})},u=o=>{const i=S.get(o);return i||{parent:o.parentElement,nextSibling:o.nextElementSibling}},c=new WeakMap,g=new WeakMap;let w=0;const E=o=>{const i=typeof getComputedStyle<"u"?getComputedStyle(o).display:"";return i&&i!=="none"?i:"block"},T=(o,i)=>{i.visibleDisplay=o.style.getPropertyValue("display"),i.computedDisplay=E(o)},H=(o,i)=>{if(g.get(o)!==i)return;g.delete(o);const r=c.get(o);r&&(r.savedCss!==null&&(o.style.cssText=r.savedCss,r.savedCss=null),r.intent==="hidden"?r.vis.setDisplay("none",!0):r.visibleDisplay?(r.vis.setDisplay(r.visibleDisplay,!1),T(o,r)):(r.vis.setDisplay(null),T(o,r)))},Rt=(o,i,r,m,M)=>{const R=m.element,_=M.element,k=(m.mode??"unmount")==="hidden",{parent:V,nextSibling:tt}=m.parent?{parent:m.parent,nextSibling:m.nextSibling}:u(R),U=x(i,r),et={scrollOffset:U,from:{scroll:N(i)},to:{scroll:N(r)},get scrollingElement(){return L()||document.documentElement},get positionedParent(){return I()}};let P;if(k){P=R,P.style.top=`${-1*((U==null?void 0:U.y)??0)}px`;const D=c.get(_);D&&D.savedCss===null&&(D.savedCss=_.style.cssText)}else P=R.cloneNode(!0),P.setAttribute("data-ssgoi-clone",""),kt(P,et);A(i)||b(i);const Y=k?++w:0;k&&(g.set(_,Y),g.set(R,Y));const ft=Promise.resolve(P),dt=Promise.resolve(_),ht=[],xt={from:ft,to:dt,context:et,createElement:((D,nt="div")=>{const W=document.createElement(nt);return W.setAttribute("data-ssgoi-id",D),ht.push(W),W})},Lt=Promise.resolve(o.prepare?o.prepare(xt):{});It({from:ft,to:dt,extras:Lt}).then(({from:D,to:nt,extras:W})=>{!k&&V&&(tt&&V.contains(tt)?V.insertBefore(P,tt):V.appendChild(P));const st=o.animation({from:D,to:nt,context:et,...W}),ot=st.onComplete;st.onComplete=()=>{ot==null||ot(),k?(H(R,Y),H(_,Y)):P.parentElement&&P.parentElement.removeChild(P);for(const it of ht)it.parentElement&&it.parentElement.removeChild(it)},y.attach(st)})},q=(o,i)=>{const r=v.isSwipeBack();a.trigger(o,i),a.get(i).then(m=>{if(i==="in"&&v.onPageEnter(),!m)return;if(r){i==="out"&&m.from&&!A(m.from)&&b(m.from),d=null,h=null;return}if(i!=="in")return;const{from:M,to:R}=n(m.from,m.to),_=Wt(M,R,f()),Q=d,k=h;d=null,h=null,!(!_||!Q||!k)&&Rt(_,M,R,Q,k)})},At=(o,i)=>{const r=c.get(o);if(!r)return;const m=r.intent==="hidden";if(r.intent="hidden",r.savedCss===null&&(r.savedCss=o.style.cssText),r.vis.setDisplay(r.computedDisplay||"block",!0),o.style.position="absolute",o.style.width="100%",o.style.left="0",m)return;const M=u(o);d={element:o,parent:M.parent,nextSibling:M.nextSibling,mode:"hidden"};const R=o.getAttribute("data-ssgoi-transition")??i;q(R,"out")},Mt=(o,i)=>{const r=c.get(o);if(!r||r.intent==="visible")return;r.intent="visible",T(o,r),r.savedCss!==null&&(o.style.cssText=r.savedCss,r.visibleDisplay?r.vis.setDisplay(r.visibleDisplay,!1):r.vis.setDisplay(null)),C(o,i),h={element:o,parent:o.parentElement,nextSibling:o.nextElementSibling};const m=o.getAttribute("data-ssgoi-transition")??i;q(m,"in")},Ct=(o,i)=>{const r=c.get(o);if(r&&(r.vis.stop(),c.delete(o),g.delete(o),r.intent==="hidden")){(d==null?void 0:d.element)===o&&(d=null),(h==null?void 0:h.element)===o&&(h=null);return}const m=u(o);d={element:o,parent:m.parent,nextSibling:m.nextSibling,mode:"unmount"};const M=o.getAttribute("data-ssgoi-transition")??i;q(M,"out")},ct=new WeakSet,at=(o,i)=>{if(ct.has(i))return;ct.add(i),O(i);const r=Gt(i,{onHide:()=>At(i,o),onShow:()=>Mt(i,o)}),m={vis:r,savedCss:null,intent:r.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block"};c.set(i,m),r.isHidden||(T(i,m),C(i,o),h={element:i,parent:i.parentElement,nextSibling:i.nextElementSibling},q(o,"in")),Ut(i,()=>Ct(i,o))},ut=new Map;return{register:at,refFor:o=>{let i=ut.get(o);return i||(i=r=>{r&&at(o,r)},ut.set(o,i)),i}}}const Pt="data-ssgoi-root",Jt=`[${Pt}]`,lt="data-ssgoi-transition",Et=`[${lt}]`,Qt="[data-ssgoi-clone]";function te(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function ee(t){return t.nodeType===Node.ELEMENT_NODE}function ne(t){return t instanceof HTMLElement}function se(t,s){if(!te())return()=>{};t.setAttribute(Pt,"");const e=a=>a.closest(Jt)===t,n=a=>{if(!ne(a)||!e(a)||a.closest(Qt))return;const p=a.getAttribute(lt);p!==null&&s.register(p,a)},l=a=>{if(ee(a)){a.matches(Et)&&n(a);for(const p of a.querySelectorAll(Et))n(p)}},y=new MutationObserver(a=>{for(const p of a){if(p.type==="attributes"){n(p.target);continue}for(const v of p.addedNodes)l(v)}});return y.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[lt]}),l(t),()=>y.disconnect()}exports.Animation=J.Animation;exports.MultiAnimation=J.MultiAnimation;exports.WebAnimation=J.WebAnimation;exports.HostAnimation=St;exports.createSggoiTransitionContext=Zt;exports.observeSsgoiTransitions=se;
|
|
1
|
+
"use strict";var Ot=Object.defineProperty;var _t=(t,s,e)=>s in t?Ot(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e;var F=(t,s,e)=>_t(t,typeof s!="symbol"?s+"":s,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("./multi-animation-uzEnQnrG.cjs");class St extends J.Animation{constructor(){super(...arguments);F(this,"child",null);F(this,"_state","idle");F(this,"_settled",!1);F(this,"listeners",new Set)}attach(e){const n=this.child;if(this.child=e,this._settled=!1,n){const a=n.getPose();n.complete(),e.matchInto(a)}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 p=e.onUpdate;e.onUpdate=a=>{var g;p==null||p(a),(g=this.onUpdate)==null||g.call(this,a),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 progress(){var e;return((e=this.child)==null?void 0:e.progress)??0}findTimeForProgress(e){var n;return((n=this.child)==null?void 0:n.findTimeForProgress(e))??null}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 n;(n=this.child)==null||n.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 kt=(t,s)=>{var e;t.style.position="absolute",t.style.width="100%",t.style.top=`${-1*(((e=s==null?void 0:s.scrollOffset)==null?void 0:e.y)??0)}px`,t.style.left="0"},yt=new Set(["auto","scroll","overlay"]),Dt=t=>{let s=t.parentElement;for(;s&&s!==document.body;){const e=window.getComputedStyle(s);if(yt.has(e.overflowY)||yt.has(e.overflowX))return s;s=s.parentElement}return document.documentElement},Nt=t=>{let s=t.parentElement;for(;s&&s!==document.body;){const e=window.getComputedStyle(s).position;if(e==="relative"||e==="absolute"||e==="fixed"||e==="sticky")return s;s=s.parentElement}return document.body};function Ht(t){const s=Object.keys(t);return Promise.all(s.map(e=>t[e])).then(e=>{const n={};return s.forEach((l,p)=>{n[l]=e[p]}),n})}function It(t){const s=t.filter(e=>e.symmetric).map(e=>({from:e.to,to:e.from,transition:e.transition}));return[...t,...s]}function K(t,s){if(s==="*")return!0;if(s.endsWith("/*")){const e=s.slice(0,-1);return t.startsWith(e)&&t.length>e.length}return t===s}function Wt(t,s,e){for(const n of e)if(K(t,n.from)&&K(s,n.to))return n.transition;for(const n of e)if((n.from==="*"||K(t,n.from))&&(n.to==="*"||K(s,n.to)))return n.transition;return null}const Ft=768,Kt=10,Bt=10;function Xt(t={}){const{preserveScroll:s=u=>u}=t,e=typeof s=="function"?s:()=>s;let n=null,l=!1,p=!1;const a=()=>{const u=(n==null?void 0:n.clientWidth)??0,c=u>0?u:typeof window<"u"?window.innerWidth:0;return c>0&&c<Ft},g=()=>(p||(l=a(),p=!0),l),v=u=>{var E;const c=e(g());if(c===!1)return{preserves:!1,shared:!1,storageKey:`path:${u}`};if(c===!0)return{preserves:!0,shared:!1,storageKey:`path:${u}`};const m=((E=c.exclude)==null?void 0:E.some(T=>K(u,T)))??!1,w=!m&&!!c.key;return{preserves:!m,shared:w,storageKey:w?`shared:${c.key}`:`path:${u}`}},C=u=>v(u).preserves;let x=null;const b=new Map;let M=null,L=!1,H=0;const I=()=>{n&&M&&!L&&b.set(v(M).storageKey,{x:n.scrollLeft,y:n.scrollTop})},z=u=>{if(!n)return;const c=v(u);if(c.preserves&&c.shared&&!b.has(c.storageKey))return;const m=c.preserves&&b.has(c.storageKey)?b.get(c.storageKey):{x:0,y:0};let w=0;const E=()=>{if(!n)return;n.scrollTo({top:m.y,left:m.x}),!(Math.abs(n.scrollTop-m.y)<1&&Math.abs(n.scrollLeft-m.x)<1)&&w<Kt&&(w++,requestAnimationFrame(E))};requestAnimationFrame(E)};return{initializeContext:(u,c)=>{L=!0;const m=++H;x=u,n||(n=Dt(u),l=a(),p=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{l=a()}).observe(n),(n===document.documentElement?window:n).addEventListener("scroll",I,{passive:!0})),M=c,z(c);let w=0;const E=()=>{m===H&&(w++,w>=Bt?L=!1:requestAnimationFrame(E))};requestAnimationFrame(E)},calculateScrollOffset:(u,c)=>{const m=u?v(u).storageKey:null,w=m&&b.has(m)?b.get(m):{x:0,y:0},E=c?v(c):null,T=E!=null&&E.preserves?E.storageKey:null,N=T&&b.has(T)?b.get(T):{x:0,y:0};return{x:-N.x+w.x,y:-N.y+w.y}},evictScrollPosition:u=>{b.delete(v(u).storageKey)},shouldPreserve:C,getScrollContainer:()=>n,getPositionedParentElement:()=>x?Nt(x):document.body,getScrollPosition:u=>{const c=u?v(u).storageKey:null;return c&&b.has(c)?b.get(c):{x:0,y:0}},getIsMobile:g}}const pt=30,gt=8,mt=1.2,vt=30,zt=600;function $t(){let t=null,s=!1,e=!1,n=null,l=null,p=!1;const a=(d,f)=>{for(let h=0;h<d.length;h++){const S=d.item(h);if(S&&S.identifier===f)return S}return null},g=()=>{n!==null&&(clearTimeout(n),n=null)},v=()=>{l!==null&&(clearTimeout(l),l=null)},C=()=>{s=!0,e=!0,g(),v(),n=setTimeout(()=>{s=!1,e=!1,n=null},zt)},x=d=>{if(d.touches.length!==1){t=null;return}const f=d.touches.item(0);if(!f){t=null;return}const h=window.innerWidth,S=f.clientX<=pt,O=f.clientX>=h-pt;if(!S&&!O){t=null;return}t={identifier:f.identifier,startX:f.clientX,startY:f.clientY,fromLeftEdge:S,moved:!1}},b=d=>{if(!t)return;if(d.touches.length!==1){t=null;return}const f=a(d.touches,t.identifier);if(!f){t=null;return}const h=f.clientX-t.startX,S=f.clientY-t.startY,O=Math.abs(h),u=Math.abs(S);if(u>gt&&u>O*mt){t=null;return}const c=t.fromLeftEdge?h>0:h<0;O>gt&&O>u*mt&&c&&(t.moved=!0)},M=d=>{if(!t)return;const f=a(d.changedTouches,t.identifier);if(!f){t=null;return}const h=f.clientX-t.startX,S=t.fromLeftEdge?h>0:h<0;if(t.moved&&S&&Math.abs(h)>=vt){C(),t=null;return}t.moved&&Math.abs(h)>=vt&&C(),t=null},L=()=>{t&&(t.moved&&C(),t=null)};return{initialize:()=>{if(typeof window>"u"||p)return;p=!0;const d={passive:!0,capture:!0};window.addEventListener("touchstart",x,d),window.addEventListener("touchmove",b,d),window.addEventListener("touchend",M,d),window.addEventListener("touchcancel",L,d)},destroy:()=>{if(typeof window>"u"||!p)return;p=!1;const d={capture:!0};window.removeEventListener("touchstart",x,d),window.removeEventListener("touchmove",b,d),window.removeEventListener("touchend",M,d),window.removeEventListener("touchcancel",L,d),g(),v(),t=null,s=!1,e=!1},isSwipeBack:()=>{const d=s||e;return d&&g(),d},onPageEnter:()=>{s=!1,g(),v(),l=setTimeout(()=>{e=!1,l=null},0)}}}function qt(){let t=null;function s(){var n,l;t&&((n=t.outResolve)==null||n.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){s();return}const n={from:t.from,to:t.to};t.outResolve(n),t.inResolve(n),t=null}}return{trigger(n,l){var a;l==="out"&&(t==null?void 0:t.to)===n&&!t.from&&((a=t.inResolve)==null||a.call(t,null),t={}),t&&(l==="out"&&t.from&&t.from!==n||l==="in"&&t.to&&t.to!==n)&&s(),t||(t={}),l==="out"?t.from=n:t.to=n},get(n){return new Promise(l=>{t||(t={}),n==="out"?t.outResolve=l:t.inResolve=l,e()})}}}const X=new Map;let G=null,bt=!1;function wt(t,s){if(t instanceof HTMLElement&&X.has(t)&&!t.isConnected){const e=X.get(t);X.delete(t),queueMicrotask(()=>e(s))}for(const e of Array.from(t.childNodes))wt(e,s)}function Vt(){if(bt||typeof document>"u")return;bt=!0,G=new MutationObserver(s=>{for(const e of s){const n={parent:e.target,nextSibling:e.nextSibling};for(const l of Array.from(e.removedNodes))wt(l,n)}});const t=()=>{G==null||G.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function Ut(t,s){return Vt(),X.set(t,s),()=>{X.delete(t)}}const rt=new WeakMap;let j=null;const Z="none !important";function B(t){const s=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${s} !important`:s}function Yt(){return j||(j=new MutationObserver(t=>{for(const s of t){const e=s.target,n=rt.get(e);if(!n)continue;const l=B(e);l!==n.accounted&&(n.accounted=l,l===Z?(n.reactHidden=!0,n.onHide()):l!=="none"&&n.reactHidden&&(n.reactHidden=!1,n.onShow()))}}),j)}function Gt(t,s){const e=B(t),n={accounted:e,reactHidden:e===Z,onHide:s.onHide,onShow:s.onShow};return rt.set(t,n),Yt().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return B(t)===Z},setDisplay(l,p=!1){l===null?t.style.removeProperty("display"):t.style.setProperty("display",l,p?"important":""),n.accounted=B(t)},sync(){n.accounted=B(t),n.reactHidden=n.accounted===Z},stop(){rt.delete(t)}}}function jt(t){return Array.isArray(t)}function Tt(t){const s=[];for(const e of t)jt(e)?s.push(...Tt(e)):s.push(e);return s}function Zt(t,s={}){const{transitions:e=[],middleware:n=(o,i)=>({from:o,to:i}),preserveScroll:l=o=>o}=t,p=s.host??new St,a=qt(),g=typeof e=="function"?e:()=>e,v=$t();v.initialize();const{initializeContext:C,calculateScrollOffset:x,evictScrollPosition:b,shouldPreserve:M,getScrollContainer:L,getPositionedParentElement:H,getScrollPosition:I,getIsMobile:z}=Xt({preserveScroll:l}),$=new Map,d=()=>{const o=z();let i=$.get(o);return i||(i=It(Tt(g({isMobile:o}))),$.set(o,i)),i};let f=null,h=null;const S=new WeakMap,O=o=>{S.set(o,{parent:o.parentNode,nextSibling:o.nextSibling})},u=o=>{const i=S.get(o);return i||{parent:o.parentNode,nextSibling:o.nextSibling}},c=new WeakMap,m=new WeakMap;let w=0;const E=o=>{const i=typeof getComputedStyle<"u"?getComputedStyle(o).display:"";return i&&i!=="none"?i:"block"},T=(o,i)=>{i.visibleDisplay=o.style.getPropertyValue("display"),i.computedDisplay=E(o)},N=(o,i)=>{if(m.get(o)!==i)return;m.delete(o);const r=c.get(o);r&&(r.savedCss!==null&&(o.style.cssText=r.savedCss,r.savedCss=null),r.intent==="hidden"?r.vis.setDisplay("none",!0):r.visibleDisplay?(r.vis.setDisplay(r.visibleDisplay,!1),T(o,r)):(r.vis.setDisplay(null),T(o,r)))},Rt=(o,i,r,y,P)=>{const R=y.element,_=P.element,k=(y.mode??"unmount")==="hidden",{parent:V,nextSibling:tt}=y.parent?{parent:y.parent,nextSibling:y.nextSibling}:u(R),U=x(i,r),et={scrollOffset:U,from:{scroll:I(i)},to:{scroll:I(r)},get scrollingElement(){return L()||document.documentElement},get positionedParent(){return H()}};let A;if(k){A=R,A.style.top=`${-1*((U==null?void 0:U.y)??0)}px`;const D=c.get(_);D&&D.savedCss===null&&(D.savedCss=_.style.cssText)}else A=R,kt(A,et);M(i)||b(i);const Y=k?++w:0;k&&(m.set(_,Y),m.set(R,Y));const dt=Promise.resolve(A),ft=Promise.resolve(_),ht=[],xt={from:dt,to:ft,context:et,createElement:((D,nt="div")=>{const W=document.createElement(nt);return W.setAttribute("data-ssgoi-id",D),ht.push(W),W})},Lt=Promise.resolve(o.prepare?o.prepare(xt):{});Ht({from:dt,to:ft,extras:Lt}).then(({from:D,to:nt,extras:W})=>{!k&&V&&(tt&&V.contains(tt)?V.insertBefore(A,tt):V.appendChild(A));const st=o.animation({from:D,to:nt,context:et,...W}),ot=st.onComplete;st.onComplete=()=>{ot==null||ot(),k?(N(R,Y),N(_,Y)):A.parentNode&&A.parentNode.removeChild(A);for(const it of ht)it.parentNode&&it.parentNode.removeChild(it)},p.attach(st)})},q=(o,i)=>{const r=v.isSwipeBack();a.trigger(o,i),a.get(i).then(y=>{if(i==="in"&&v.onPageEnter(),!y)return;if(r){i==="out"&&y.from&&!M(y.from)&&b(y.from),f=null,h=null;return}if(i!=="in")return;const{from:P,to:R}=n(y.from,y.to),_=Wt(P,R,d()),Q=f,k=h;f=null,h=null,!(!_||!Q||!k)&&Rt(_,P,R,Q,k)})},At=(o,i)=>{const r=c.get(o);if(!r)return;const y=r.intent==="hidden";if(r.intent="hidden",r.savedCss===null&&(r.savedCss=o.style.cssText),r.vis.setDisplay(r.computedDisplay||"block",!0),o.style.position="absolute",o.style.width="100%",o.style.left="0",y)return;const P=u(o);f={element:o,parent:P.parent,nextSibling:P.nextSibling,mode:"hidden"};const R=o.getAttribute("data-ssgoi-transition")??i;q(R,"out")},Mt=(o,i)=>{const r=c.get(o);if(!r||r.intent==="visible")return;r.intent="visible",T(o,r),r.savedCss!==null&&(o.style.cssText=r.savedCss,r.visibleDisplay?r.vis.setDisplay(r.visibleDisplay,!1):r.vis.setDisplay(null)),C(o,i),h={element:o,parent:o.parentElement,nextSibling:o.nextElementSibling};const y=o.getAttribute("data-ssgoi-transition")??i;q(y,"in")},Ct=(o,i,r)=>{const y=c.get(o);if(y&&(y.vis.stop(),c.delete(o),m.delete(o),y.intent==="hidden")){(f==null?void 0:f.element)===o&&(f=null),(h==null?void 0:h.element)===o&&(h=null);return}const P=r??u(o);f={element:o,parent:P.parent,nextSibling:P.nextSibling,mode:"unmount"};const R=o.getAttribute("data-ssgoi-transition")??i;q(R,"out")},ct=new WeakSet,at=(o,i)=>{if(ct.has(i))return;ct.add(i),O(i);const r=Gt(i,{onHide:()=>At(i,o),onShow:()=>Mt(i,o)}),y={vis:r,savedCss:null,intent:r.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block"};c.set(i,y),r.isHidden||(T(i,y),C(i,o),h={element:i,parent:i.parentElement,nextSibling:i.nextElementSibling},q(o,"in")),Ut(i,P=>Ct(i,o,P))},ut=new Map;return{register:at,refFor:o=>{let i=ut.get(o);return i||(i=r=>{r&&at(o,r)},ut.set(o,i)),i}}}const Pt="data-ssgoi-root",Jt=`[${Pt}]`,lt="data-ssgoi-transition",Et=`[${lt}]`,Qt="[data-ssgoi-clone]";function te(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function ee(t){return t.nodeType===Node.ELEMENT_NODE}function ne(t){return t instanceof HTMLElement}function se(t,s){if(!te())return()=>{};t.setAttribute(Pt,"");const e=a=>a.closest(Jt)===t,n=a=>{if(!ne(a)||!e(a)||a.closest(Qt))return;const g=a.getAttribute(lt);g!==null&&s.register(g,a)},l=a=>{if(ee(a)){a.matches(Et)&&n(a);for(const g of a.querySelectorAll(Et))n(g)}},p=new MutationObserver(a=>{for(const g of a){if(g.type==="attributes"){n(g.target);continue}for(const v of g.addedNodes)l(v)}});return p.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[lt]}),l(t),()=>p.disconnect()}exports.Animation=J.Animation;exports.MultiAnimation=J.MultiAnimation;exports.WebAnimation=J.WebAnimation;exports.HostAnimation=St;exports.createSggoiTransitionContext=Zt;exports.observeSsgoiTransitions=se;
|
package/dist/internal.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Lt = (t, s, e) => s in t ?
|
|
1
|
+
var Ct = Object.defineProperty;
|
|
2
|
+
var Lt = (t, s, e) => s in t ? Ct(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
3
3
|
var F = (t, s, e) => Lt(t, typeof s != "symbol" ? s + "" : s, e);
|
|
4
4
|
import { A as Ot } from "./multi-animation-Ch5rI3rB.js";
|
|
5
|
-
import { M as ue, W as
|
|
5
|
+
import { M as ue, W as de } from "./multi-animation-Ch5rI3rB.js";
|
|
6
6
|
class _t extends Ot {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
@@ -22,10 +22,10 @@ class _t extends Ot {
|
|
|
22
22
|
e.onComplete = () => {
|
|
23
23
|
l == null || l(), this.child === e && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const p = e.onUpdate;
|
|
26
26
|
e.onUpdate = (a) => {
|
|
27
|
-
var
|
|
28
|
-
|
|
27
|
+
var g;
|
|
28
|
+
p == null || p(a), (g = this.onUpdate) == null || g.call(this, a), this.notify();
|
|
29
29
|
}, this._state === "paused" ? e.pause() : this._state === "reversing" ? e.reverse() : (this._state = "playing", e.play()), this.notify();
|
|
30
30
|
}
|
|
31
31
|
play() {
|
|
@@ -110,7 +110,7 @@ const kt = (t, s) => {
|
|
|
110
110
|
s = s.parentElement;
|
|
111
111
|
}
|
|
112
112
|
return document.documentElement;
|
|
113
|
-
},
|
|
113
|
+
}, Nt = (t) => {
|
|
114
114
|
let s = t.parentElement;
|
|
115
115
|
for (; s && s !== document.body; ) {
|
|
116
116
|
const e = window.getComputedStyle(s).position;
|
|
@@ -120,16 +120,16 @@ const kt = (t, s) => {
|
|
|
120
120
|
}
|
|
121
121
|
return document.body;
|
|
122
122
|
};
|
|
123
|
-
function
|
|
123
|
+
function Ht(t) {
|
|
124
124
|
const s = Object.keys(t);
|
|
125
125
|
return Promise.all(s.map((e) => t[e])).then((e) => {
|
|
126
126
|
const n = {};
|
|
127
|
-
return s.forEach((l,
|
|
128
|
-
n[l] = e[
|
|
127
|
+
return s.forEach((l, p) => {
|
|
128
|
+
n[l] = e[p];
|
|
129
129
|
}), n;
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function It(t) {
|
|
133
133
|
const s = t.filter((e) => e.symmetric).map((e) => ({
|
|
134
134
|
from: e.to,
|
|
135
135
|
to: e.from,
|
|
@@ -158,29 +158,29 @@ function Wt(t, s, e) {
|
|
|
158
158
|
const Ft = 768, Kt = 10, Bt = 10;
|
|
159
159
|
function Xt(t = {}) {
|
|
160
160
|
const { preserveScroll: s = (u) => u } = t, e = typeof s == "function" ? s : () => s;
|
|
161
|
-
let n = null, l = !1,
|
|
161
|
+
let n = null, l = !1, p = !1;
|
|
162
162
|
const a = () => {
|
|
163
163
|
const u = (n == null ? void 0 : n.clientWidth) ?? 0, c = u > 0 ? u : typeof window < "u" ? window.innerWidth : 0;
|
|
164
164
|
return c > 0 && c < Ft;
|
|
165
|
-
},
|
|
165
|
+
}, g = () => (p || (l = a(), p = !0), l), v = (u) => {
|
|
166
166
|
var E;
|
|
167
|
-
const c = e(
|
|
167
|
+
const c = e(g());
|
|
168
168
|
if (c === !1)
|
|
169
169
|
return { preserves: !1, shared: !1, storageKey: `path:${u}` };
|
|
170
170
|
if (c === !0)
|
|
171
171
|
return { preserves: !0, shared: !1, storageKey: `path:${u}` };
|
|
172
|
-
const
|
|
172
|
+
const m = ((E = c.exclude) == null ? void 0 : E.some((T) => K(u, T))) ?? !1, S = !m && !!c.key;
|
|
173
173
|
return {
|
|
174
|
-
preserves: !
|
|
174
|
+
preserves: !m,
|
|
175
175
|
shared: S,
|
|
176
176
|
storageKey: S ? `shared:${c.key}` : `path:${u}`
|
|
177
177
|
};
|
|
178
|
-
},
|
|
179
|
-
let
|
|
178
|
+
}, A = (u) => v(u).preserves;
|
|
179
|
+
let C = null;
|
|
180
180
|
const b = /* @__PURE__ */ new Map();
|
|
181
|
-
let
|
|
182
|
-
const
|
|
183
|
-
n &&
|
|
181
|
+
let x = null, L = !1, H = 0;
|
|
182
|
+
const I = () => {
|
|
183
|
+
n && x && !L && b.set(v(x).storageKey, {
|
|
184
184
|
x: n.scrollLeft,
|
|
185
185
|
y: n.scrollTop
|
|
186
186
|
});
|
|
@@ -189,142 +189,142 @@ function Xt(t = {}) {
|
|
|
189
189
|
const c = v(u);
|
|
190
190
|
if (c.preserves && c.shared && !b.has(c.storageKey))
|
|
191
191
|
return;
|
|
192
|
-
const
|
|
192
|
+
const m = c.preserves && b.has(c.storageKey) ? b.get(c.storageKey) : { x: 0, y: 0 };
|
|
193
193
|
let S = 0;
|
|
194
194
|
const E = () => {
|
|
195
195
|
if (!n) return;
|
|
196
196
|
n.scrollTo({
|
|
197
|
-
top:
|
|
198
|
-
left:
|
|
199
|
-
}), !(Math.abs(n.scrollTop -
|
|
197
|
+
top: m.y,
|
|
198
|
+
left: m.x
|
|
199
|
+
}), !(Math.abs(n.scrollTop - m.y) < 1 && Math.abs(n.scrollLeft - m.x) < 1) && S < Kt && (S++, requestAnimationFrame(E));
|
|
200
200
|
};
|
|
201
201
|
requestAnimationFrame(E);
|
|
202
202
|
};
|
|
203
203
|
return {
|
|
204
204
|
initializeContext: (u, c) => {
|
|
205
205
|
L = !0;
|
|
206
|
-
const
|
|
207
|
-
|
|
206
|
+
const m = ++H;
|
|
207
|
+
C = u, n || (n = Dt(u), l = a(), p = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
|
|
208
208
|
l = a();
|
|
209
|
-
}).observe(n), (n === document.documentElement ? window : n).addEventListener("scroll",
|
|
209
|
+
}).observe(n), (n === document.documentElement ? window : n).addEventListener("scroll", I, {
|
|
210
210
|
passive: !0
|
|
211
|
-
})),
|
|
211
|
+
})), x = c, z(c);
|
|
212
212
|
let S = 0;
|
|
213
213
|
const E = () => {
|
|
214
|
-
|
|
214
|
+
m === H && (S++, S >= Bt ? L = !1 : requestAnimationFrame(E));
|
|
215
215
|
};
|
|
216
216
|
requestAnimationFrame(E);
|
|
217
217
|
},
|
|
218
218
|
calculateScrollOffset: (u, c) => {
|
|
219
|
-
const
|
|
219
|
+
const m = u ? v(u).storageKey : null, S = m && b.has(m) ? b.get(m) : { x: 0, y: 0 }, E = c ? v(c) : null, T = E != null && E.preserves ? E.storageKey : null, N = T && b.has(T) ? b.get(T) : { x: 0, y: 0 };
|
|
220
220
|
return {
|
|
221
|
-
x: -
|
|
222
|
-
y: -
|
|
221
|
+
x: -N.x + S.x,
|
|
222
|
+
y: -N.y + S.y
|
|
223
223
|
};
|
|
224
224
|
},
|
|
225
225
|
evictScrollPosition: (u) => {
|
|
226
226
|
b.delete(v(u).storageKey);
|
|
227
227
|
},
|
|
228
|
-
shouldPreserve:
|
|
228
|
+
shouldPreserve: A,
|
|
229
229
|
getScrollContainer: () => n,
|
|
230
|
-
getPositionedParentElement: () =>
|
|
230
|
+
getPositionedParentElement: () => C ? Nt(C) : document.body,
|
|
231
231
|
getScrollPosition: (u) => {
|
|
232
232
|
const c = u ? v(u).storageKey : null;
|
|
233
233
|
return c && b.has(c) ? b.get(c) : { x: 0, y: 0 };
|
|
234
234
|
},
|
|
235
235
|
// Same measurement that drives `preserveScroll`'s `isMobile`, exposed so a
|
|
236
236
|
// functional `transitions` config can branch on it too.
|
|
237
|
-
getIsMobile:
|
|
237
|
+
getIsMobile: g
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
|
-
const yt = 30, pt = 8,
|
|
240
|
+
const yt = 30, pt = 8, gt = 1.2, mt = 30, zt = 600;
|
|
241
241
|
function $t() {
|
|
242
|
-
let t = null, s = !1, e = !1, n = null, l = null,
|
|
243
|
-
const a = (
|
|
244
|
-
for (let h = 0; h <
|
|
245
|
-
const w =
|
|
246
|
-
if (w && w.identifier ===
|
|
242
|
+
let t = null, s = !1, e = !1, n = null, l = null, p = !1;
|
|
243
|
+
const a = (d, f) => {
|
|
244
|
+
for (let h = 0; h < d.length; h++) {
|
|
245
|
+
const w = d.item(h);
|
|
246
|
+
if (w && w.identifier === f) return w;
|
|
247
247
|
}
|
|
248
248
|
return null;
|
|
249
|
-
},
|
|
249
|
+
}, g = () => {
|
|
250
250
|
n !== null && (clearTimeout(n), n = null);
|
|
251
251
|
}, v = () => {
|
|
252
252
|
l !== null && (clearTimeout(l), l = null);
|
|
253
|
-
},
|
|
254
|
-
s = !0, e = !0,
|
|
253
|
+
}, A = () => {
|
|
254
|
+
s = !0, e = !0, g(), v(), n = setTimeout(() => {
|
|
255
255
|
s = !1, e = !1, n = null;
|
|
256
256
|
}, zt);
|
|
257
|
-
},
|
|
258
|
-
if (
|
|
257
|
+
}, C = (d) => {
|
|
258
|
+
if (d.touches.length !== 1) {
|
|
259
259
|
t = null;
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
|
-
const
|
|
263
|
-
if (!
|
|
262
|
+
const f = d.touches.item(0);
|
|
263
|
+
if (!f) {
|
|
264
264
|
t = null;
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
|
-
const h = window.innerWidth, w =
|
|
267
|
+
const h = window.innerWidth, w = f.clientX <= yt, O = f.clientX >= h - yt;
|
|
268
268
|
if (!w && !O) {
|
|
269
269
|
t = null;
|
|
270
270
|
return;
|
|
271
271
|
}
|
|
272
272
|
t = {
|
|
273
|
-
identifier:
|
|
274
|
-
startX:
|
|
275
|
-
startY:
|
|
273
|
+
identifier: f.identifier,
|
|
274
|
+
startX: f.clientX,
|
|
275
|
+
startY: f.clientY,
|
|
276
276
|
fromLeftEdge: w,
|
|
277
277
|
moved: !1
|
|
278
278
|
};
|
|
279
|
-
}, b = (
|
|
279
|
+
}, b = (d) => {
|
|
280
280
|
if (!t) return;
|
|
281
|
-
if (
|
|
281
|
+
if (d.touches.length !== 1) {
|
|
282
282
|
t = null;
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
|
-
const
|
|
286
|
-
if (!
|
|
285
|
+
const f = a(d.touches, t.identifier);
|
|
286
|
+
if (!f) {
|
|
287
287
|
t = null;
|
|
288
288
|
return;
|
|
289
289
|
}
|
|
290
|
-
const h =
|
|
291
|
-
if (u > pt && u > O *
|
|
290
|
+
const h = f.clientX - t.startX, w = f.clientY - t.startY, O = Math.abs(h), u = Math.abs(w);
|
|
291
|
+
if (u > pt && u > O * gt) {
|
|
292
292
|
t = null;
|
|
293
293
|
return;
|
|
294
294
|
}
|
|
295
295
|
const c = t.fromLeftEdge ? h > 0 : h < 0;
|
|
296
|
-
O > pt && O > u *
|
|
297
|
-
},
|
|
296
|
+
O > pt && O > u * gt && c && (t.moved = !0);
|
|
297
|
+
}, x = (d) => {
|
|
298
298
|
if (!t) return;
|
|
299
|
-
const
|
|
300
|
-
if (!
|
|
299
|
+
const f = a(d.changedTouches, t.identifier);
|
|
300
|
+
if (!f) {
|
|
301
301
|
t = null;
|
|
302
302
|
return;
|
|
303
303
|
}
|
|
304
|
-
const h =
|
|
305
|
-
if (t.moved && w && Math.abs(h) >=
|
|
306
|
-
|
|
304
|
+
const h = f.clientX - t.startX, w = t.fromLeftEdge ? h > 0 : h < 0;
|
|
305
|
+
if (t.moved && w && Math.abs(h) >= mt) {
|
|
306
|
+
A(), t = null;
|
|
307
307
|
return;
|
|
308
308
|
}
|
|
309
|
-
t.moved && Math.abs(h) >=
|
|
309
|
+
t.moved && Math.abs(h) >= mt && A(), t = null;
|
|
310
310
|
}, L = () => {
|
|
311
|
-
t && (t.moved &&
|
|
311
|
+
t && (t.moved && A(), t = null);
|
|
312
312
|
};
|
|
313
313
|
return { initialize: () => {
|
|
314
|
-
if (typeof window > "u" ||
|
|
315
|
-
|
|
316
|
-
const
|
|
317
|
-
window.addEventListener("touchstart",
|
|
314
|
+
if (typeof window > "u" || p) return;
|
|
315
|
+
p = !0;
|
|
316
|
+
const d = { passive: !0, capture: !0 };
|
|
317
|
+
window.addEventListener("touchstart", C, d), window.addEventListener("touchmove", b, d), window.addEventListener("touchend", x, d), window.addEventListener("touchcancel", L, d);
|
|
318
318
|
}, destroy: () => {
|
|
319
|
-
if (typeof window > "u" || !
|
|
320
|
-
|
|
321
|
-
const
|
|
322
|
-
window.removeEventListener("touchstart",
|
|
319
|
+
if (typeof window > "u" || !p) return;
|
|
320
|
+
p = !1;
|
|
321
|
+
const d = { capture: !0 };
|
|
322
|
+
window.removeEventListener("touchstart", C, d), window.removeEventListener("touchmove", b, d), window.removeEventListener("touchend", x, d), window.removeEventListener("touchcancel", L, d), g(), v(), t = null, s = !1, e = !1;
|
|
323
323
|
}, isSwipeBack: () => {
|
|
324
|
-
const
|
|
325
|
-
return
|
|
324
|
+
const d = s || e;
|
|
325
|
+
return d && g(), d;
|
|
326
326
|
}, onPageEnter: () => {
|
|
327
|
-
s = !1,
|
|
327
|
+
s = !1, g(), v(), l = setTimeout(() => {
|
|
328
328
|
e = !1, l = null;
|
|
329
329
|
}, 0);
|
|
330
330
|
} };
|
|
@@ -359,20 +359,25 @@ function Vt() {
|
|
|
359
359
|
}
|
|
360
360
|
const X = /* @__PURE__ */ new Map();
|
|
361
361
|
let G = null, vt = !1;
|
|
362
|
-
function Et(t) {
|
|
362
|
+
function Et(t, s) {
|
|
363
363
|
if (t instanceof HTMLElement && X.has(t) && !t.isConnected) {
|
|
364
|
-
const
|
|
365
|
-
X.delete(t), queueMicrotask(s);
|
|
364
|
+
const e = X.get(t);
|
|
365
|
+
X.delete(t), queueMicrotask(() => e(s));
|
|
366
366
|
}
|
|
367
|
-
for (const
|
|
368
|
-
Et(s);
|
|
367
|
+
for (const e of Array.from(t.childNodes))
|
|
368
|
+
Et(e, s);
|
|
369
369
|
}
|
|
370
370
|
function qt() {
|
|
371
371
|
if (vt || typeof document > "u") return;
|
|
372
372
|
vt = !0, G = new MutationObserver((s) => {
|
|
373
|
-
for (const e of s)
|
|
374
|
-
|
|
375
|
-
|
|
373
|
+
for (const e of s) {
|
|
374
|
+
const n = {
|
|
375
|
+
parent: e.target,
|
|
376
|
+
nextSibling: e.nextSibling
|
|
377
|
+
};
|
|
378
|
+
for (const l of Array.from(e.removedNodes))
|
|
379
|
+
Et(l, n);
|
|
380
|
+
}
|
|
376
381
|
});
|
|
377
382
|
const t = () => {
|
|
378
383
|
G == null || G.observe(document.body, { childList: !0, subtree: !0 });
|
|
@@ -415,11 +420,11 @@ function Gt(t, s) {
|
|
|
415
420
|
get isHidden() {
|
|
416
421
|
return B(t) === j;
|
|
417
422
|
},
|
|
418
|
-
setDisplay(l,
|
|
423
|
+
setDisplay(l, p = !1) {
|
|
419
424
|
l === null ? t.style.removeProperty("display") : t.style.setProperty(
|
|
420
425
|
"display",
|
|
421
426
|
l,
|
|
422
|
-
|
|
427
|
+
p ? "important" : ""
|
|
423
428
|
), n.accounted = B(t);
|
|
424
429
|
},
|
|
425
430
|
sync() {
|
|
@@ -444,87 +449,87 @@ function re(t, s = {}) {
|
|
|
444
449
|
transitions: e = [],
|
|
445
450
|
middleware: n = (o, i) => ({ from: o, to: i }),
|
|
446
451
|
preserveScroll: l = (o) => o
|
|
447
|
-
} = t,
|
|
452
|
+
} = t, p = s.host ?? new _t(), a = Vt(), g = typeof e == "function" ? e : () => e, v = $t();
|
|
448
453
|
v.initialize();
|
|
449
454
|
const {
|
|
450
|
-
initializeContext:
|
|
451
|
-
calculateScrollOffset:
|
|
455
|
+
initializeContext: A,
|
|
456
|
+
calculateScrollOffset: C,
|
|
452
457
|
evictScrollPosition: b,
|
|
453
|
-
shouldPreserve:
|
|
458
|
+
shouldPreserve: x,
|
|
454
459
|
getScrollContainer: L,
|
|
455
|
-
getPositionedParentElement:
|
|
456
|
-
getScrollPosition:
|
|
460
|
+
getPositionedParentElement: H,
|
|
461
|
+
getScrollPosition: I,
|
|
457
462
|
getIsMobile: z
|
|
458
|
-
} = Xt({ preserveScroll: l }), $ = /* @__PURE__ */ new Map(),
|
|
463
|
+
} = Xt({ preserveScroll: l }), $ = /* @__PURE__ */ new Map(), d = () => {
|
|
459
464
|
const o = z();
|
|
460
465
|
let i = $.get(o);
|
|
461
|
-
return i || (i =
|
|
462
|
-
wt(
|
|
466
|
+
return i || (i = It(
|
|
467
|
+
wt(g({ isMobile: o }))
|
|
463
468
|
), $.set(o, i)), i;
|
|
464
469
|
};
|
|
465
|
-
let
|
|
470
|
+
let f = null, h = null;
|
|
466
471
|
const w = /* @__PURE__ */ new WeakMap(), O = (o) => {
|
|
467
472
|
w.set(o, {
|
|
468
|
-
parent: o.
|
|
469
|
-
nextSibling: o.
|
|
473
|
+
parent: o.parentNode,
|
|
474
|
+
nextSibling: o.nextSibling
|
|
470
475
|
});
|
|
471
476
|
}, u = (o) => {
|
|
472
477
|
const i = w.get(o);
|
|
473
478
|
return i || {
|
|
474
|
-
parent: o.
|
|
475
|
-
nextSibling: o.
|
|
479
|
+
parent: o.parentNode,
|
|
480
|
+
nextSibling: o.nextSibling
|
|
476
481
|
};
|
|
477
|
-
}, c = /* @__PURE__ */ new WeakMap(),
|
|
482
|
+
}, c = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap();
|
|
478
483
|
let S = 0;
|
|
479
484
|
const E = (o) => {
|
|
480
485
|
const i = typeof getComputedStyle < "u" ? getComputedStyle(o).display : "";
|
|
481
486
|
return i && i !== "none" ? i : "block";
|
|
482
487
|
}, T = (o, i) => {
|
|
483
488
|
i.visibleDisplay = o.style.getPropertyValue("display"), i.computedDisplay = E(o);
|
|
484
|
-
},
|
|
485
|
-
if (
|
|
486
|
-
|
|
489
|
+
}, N = (o, i) => {
|
|
490
|
+
if (m.get(o) !== i) return;
|
|
491
|
+
m.delete(o);
|
|
487
492
|
const r = c.get(o);
|
|
488
493
|
r && (r.savedCss !== null && (o.style.cssText = r.savedCss, r.savedCss = null), r.intent === "hidden" ? r.vis.setDisplay("none", !0) : r.visibleDisplay ? (r.vis.setDisplay(r.visibleDisplay, !1), T(o, r)) : (r.vis.setDisplay(null), T(o, r)));
|
|
489
|
-
}, Tt = (o, i, r,
|
|
490
|
-
const P =
|
|
494
|
+
}, Tt = (o, i, r, y, R) => {
|
|
495
|
+
const P = y.element, _ = R.element, k = (y.mode ?? "unmount") === "hidden", { parent: q, nextSibling: Q } = y.parent ? { parent: y.parent, nextSibling: y.nextSibling } : u(P), U = C(i, r), tt = {
|
|
491
496
|
scrollOffset: U,
|
|
492
|
-
from: { scroll:
|
|
493
|
-
to: { scroll:
|
|
497
|
+
from: { scroll: I(i) },
|
|
498
|
+
to: { scroll: I(r) },
|
|
494
499
|
get scrollingElement() {
|
|
495
500
|
return L() || document.documentElement;
|
|
496
501
|
},
|
|
497
502
|
get positionedParent() {
|
|
498
|
-
return
|
|
503
|
+
return H();
|
|
499
504
|
}
|
|
500
505
|
};
|
|
501
|
-
let
|
|
506
|
+
let M;
|
|
502
507
|
if (k) {
|
|
503
|
-
|
|
508
|
+
M = P, M.style.top = `${-1 * ((U == null ? void 0 : U.y) ?? 0)}px`;
|
|
504
509
|
const D = c.get(_);
|
|
505
510
|
D && D.savedCss === null && (D.savedCss = _.style.cssText);
|
|
506
511
|
} else
|
|
507
|
-
|
|
508
|
-
|
|
512
|
+
M = P, kt(M, tt);
|
|
513
|
+
x(i) || b(i);
|
|
509
514
|
const Y = k ? ++S : 0;
|
|
510
|
-
k && (
|
|
511
|
-
const ut = Promise.resolve(
|
|
515
|
+
k && (m.set(_, Y), m.set(P, Y));
|
|
516
|
+
const ut = Promise.resolve(M), dt = Promise.resolve(_), ft = [], xt = {
|
|
512
517
|
from: ut,
|
|
513
|
-
to:
|
|
518
|
+
to: dt,
|
|
514
519
|
context: tt,
|
|
515
520
|
createElement: ((D, et = "div") => {
|
|
516
521
|
const W = document.createElement(et);
|
|
517
|
-
return W.setAttribute("data-ssgoi-id", D),
|
|
522
|
+
return W.setAttribute("data-ssgoi-id", D), ft.push(W), W;
|
|
518
523
|
})
|
|
519
|
-
},
|
|
520
|
-
o.prepare ? o.prepare(
|
|
524
|
+
}, At = Promise.resolve(
|
|
525
|
+
o.prepare ? o.prepare(xt) : {}
|
|
521
526
|
);
|
|
522
|
-
|
|
527
|
+
Ht({
|
|
523
528
|
from: ut,
|
|
524
|
-
to:
|
|
525
|
-
extras:
|
|
529
|
+
to: dt,
|
|
530
|
+
extras: At
|
|
526
531
|
}).then(({ from: D, to: et, extras: W }) => {
|
|
527
|
-
!k && q && (Q && q.contains(Q) ? q.insertBefore(
|
|
532
|
+
!k && q && (Q && q.contains(Q) ? q.insertBefore(M, Q) : q.appendChild(M));
|
|
528
533
|
const nt = o.animation({
|
|
529
534
|
from: D,
|
|
530
535
|
to: et,
|
|
@@ -532,40 +537,40 @@ function re(t, s = {}) {
|
|
|
532
537
|
...W
|
|
533
538
|
}), st = nt.onComplete;
|
|
534
539
|
nt.onComplete = () => {
|
|
535
|
-
st == null || st(), k ? (
|
|
536
|
-
for (const ot of
|
|
537
|
-
ot.
|
|
538
|
-
},
|
|
540
|
+
st == null || st(), k ? (N(P, Y), N(_, Y)) : M.parentNode && M.parentNode.removeChild(M);
|
|
541
|
+
for (const ot of ft)
|
|
542
|
+
ot.parentNode && ot.parentNode.removeChild(ot);
|
|
543
|
+
}, p.attach(nt);
|
|
539
544
|
});
|
|
540
545
|
}, V = (o, i) => {
|
|
541
546
|
const r = v.isSwipeBack();
|
|
542
|
-
a.trigger(o, i), a.get(i).then((
|
|
543
|
-
if (i === "in" && v.onPageEnter(), !
|
|
547
|
+
a.trigger(o, i), a.get(i).then((y) => {
|
|
548
|
+
if (i === "in" && v.onPageEnter(), !y) return;
|
|
544
549
|
if (r) {
|
|
545
|
-
i === "out" &&
|
|
550
|
+
i === "out" && y.from && !x(y.from) && b(y.from), f = null, h = null;
|
|
546
551
|
return;
|
|
547
552
|
}
|
|
548
553
|
if (i !== "in") return;
|
|
549
|
-
const { from:
|
|
550
|
-
|
|
551
|
-
|
|
554
|
+
const { from: R, to: P } = n(
|
|
555
|
+
y.from,
|
|
556
|
+
y.to
|
|
552
557
|
), _ = Wt(
|
|
553
|
-
|
|
558
|
+
R,
|
|
554
559
|
P,
|
|
555
|
-
|
|
556
|
-
), J =
|
|
557
|
-
|
|
560
|
+
d()
|
|
561
|
+
), J = f, k = h;
|
|
562
|
+
f = null, h = null, !(!_ || !J || !k) && Tt(_, R, P, J, k);
|
|
558
563
|
});
|
|
559
564
|
}, Rt = (o, i) => {
|
|
560
565
|
const r = c.get(o);
|
|
561
566
|
if (!r) return;
|
|
562
|
-
const
|
|
563
|
-
if (r.intent = "hidden", r.savedCss === null && (r.savedCss = o.style.cssText), r.vis.setDisplay(r.computedDisplay || "block", !0), o.style.position = "absolute", o.style.width = "100%", o.style.left = "0",
|
|
564
|
-
const
|
|
565
|
-
|
|
567
|
+
const y = r.intent === "hidden";
|
|
568
|
+
if (r.intent = "hidden", r.savedCss === null && (r.savedCss = o.style.cssText), r.vis.setDisplay(r.computedDisplay || "block", !0), o.style.position = "absolute", o.style.width = "100%", o.style.left = "0", y) return;
|
|
569
|
+
const R = u(o);
|
|
570
|
+
f = {
|
|
566
571
|
element: o,
|
|
567
|
-
parent:
|
|
568
|
-
nextSibling:
|
|
572
|
+
parent: R.parent,
|
|
573
|
+
nextSibling: R.nextSibling,
|
|
569
574
|
mode: "hidden"
|
|
570
575
|
};
|
|
571
576
|
const P = o.getAttribute("data-ssgoi-transition") ?? i;
|
|
@@ -573,46 +578,46 @@ function re(t, s = {}) {
|
|
|
573
578
|
}, Pt = (o, i) => {
|
|
574
579
|
const r = c.get(o);
|
|
575
580
|
if (!r || r.intent === "visible") return;
|
|
576
|
-
r.intent = "visible", T(o, r), r.savedCss !== null && (o.style.cssText = r.savedCss, r.visibleDisplay ? r.vis.setDisplay(r.visibleDisplay, !1) : r.vis.setDisplay(null)),
|
|
581
|
+
r.intent = "visible", T(o, r), r.savedCss !== null && (o.style.cssText = r.savedCss, r.visibleDisplay ? r.vis.setDisplay(r.visibleDisplay, !1) : r.vis.setDisplay(null)), A(o, i), h = {
|
|
577
582
|
element: o,
|
|
578
583
|
parent: o.parentElement,
|
|
579
584
|
nextSibling: o.nextElementSibling
|
|
580
585
|
};
|
|
581
|
-
const
|
|
582
|
-
V(
|
|
583
|
-
}, Mt = (o, i) => {
|
|
584
|
-
const
|
|
585
|
-
if (
|
|
586
|
-
(
|
|
586
|
+
const y = o.getAttribute("data-ssgoi-transition") ?? i;
|
|
587
|
+
V(y, "in");
|
|
588
|
+
}, Mt = (o, i, r) => {
|
|
589
|
+
const y = c.get(o);
|
|
590
|
+
if (y && (y.vis.stop(), c.delete(o), m.delete(o), y.intent === "hidden")) {
|
|
591
|
+
(f == null ? void 0 : f.element) === o && (f = null), (h == null ? void 0 : h.element) === o && (h = null);
|
|
587
592
|
return;
|
|
588
593
|
}
|
|
589
|
-
const
|
|
590
|
-
|
|
594
|
+
const R = r ?? u(o);
|
|
595
|
+
f = {
|
|
591
596
|
element: o,
|
|
592
|
-
parent:
|
|
593
|
-
nextSibling:
|
|
597
|
+
parent: R.parent,
|
|
598
|
+
nextSibling: R.nextSibling,
|
|
594
599
|
mode: "unmount"
|
|
595
600
|
};
|
|
596
|
-
const
|
|
597
|
-
V(
|
|
601
|
+
const P = o.getAttribute("data-ssgoi-transition") ?? i;
|
|
602
|
+
V(P, "out");
|
|
598
603
|
}, lt = /* @__PURE__ */ new WeakSet(), ct = (o, i) => {
|
|
599
604
|
if (lt.has(i)) return;
|
|
600
605
|
lt.add(i), O(i);
|
|
601
606
|
const r = Gt(i, {
|
|
602
607
|
onHide: () => Rt(i, o),
|
|
603
608
|
onShow: () => Pt(i, o)
|
|
604
|
-
}),
|
|
609
|
+
}), y = {
|
|
605
610
|
vis: r,
|
|
606
611
|
savedCss: null,
|
|
607
612
|
intent: r.isHidden ? "hidden" : "visible",
|
|
608
613
|
visibleDisplay: "",
|
|
609
614
|
computedDisplay: "block"
|
|
610
615
|
};
|
|
611
|
-
c.set(i,
|
|
616
|
+
c.set(i, y), r.isHidden || (T(i, y), A(i, o), h = {
|
|
612
617
|
element: i,
|
|
613
618
|
parent: i.parentElement,
|
|
614
619
|
nextSibling: i.nextElementSibling
|
|
615
|
-
}, V(o, "in")), Ut(i, () => Mt(i, o));
|
|
620
|
+
}, V(o, "in")), Ut(i, (R) => Mt(i, o, R));
|
|
616
621
|
}, at = /* @__PURE__ */ new Map();
|
|
617
622
|
return { register: ct, refFor: (o) => {
|
|
618
623
|
let i = at.get(o);
|
|
@@ -638,36 +643,36 @@ function le(t, s) {
|
|
|
638
643
|
const e = (a) => a.closest(jt) === t, n = (a) => {
|
|
639
644
|
if (!ee(a) || !e(a) || a.closest(Jt))
|
|
640
645
|
return;
|
|
641
|
-
const
|
|
642
|
-
|
|
646
|
+
const g = a.getAttribute(rt);
|
|
647
|
+
g !== null && s.register(g, a);
|
|
643
648
|
}, l = (a) => {
|
|
644
649
|
if (te(a)) {
|
|
645
650
|
a.matches(bt) && n(a);
|
|
646
|
-
for (const
|
|
647
|
-
n(
|
|
651
|
+
for (const g of a.querySelectorAll(bt))
|
|
652
|
+
n(g);
|
|
648
653
|
}
|
|
649
|
-
},
|
|
650
|
-
for (const
|
|
651
|
-
if (
|
|
652
|
-
n(
|
|
654
|
+
}, p = new MutationObserver((a) => {
|
|
655
|
+
for (const g of a) {
|
|
656
|
+
if (g.type === "attributes") {
|
|
657
|
+
n(g.target);
|
|
653
658
|
continue;
|
|
654
659
|
}
|
|
655
|
-
for (const v of
|
|
660
|
+
for (const v of g.addedNodes)
|
|
656
661
|
l(v);
|
|
657
662
|
}
|
|
658
663
|
});
|
|
659
|
-
return
|
|
664
|
+
return p.observe(t, {
|
|
660
665
|
childList: !0,
|
|
661
666
|
subtree: !0,
|
|
662
667
|
attributes: !0,
|
|
663
668
|
attributeFilter: [rt]
|
|
664
|
-
}), l(t), () =>
|
|
669
|
+
}), l(t), () => p.disconnect();
|
|
665
670
|
}
|
|
666
671
|
export {
|
|
667
672
|
Ot as Animation,
|
|
668
673
|
_t as HostAnimation,
|
|
669
674
|
ue as MultiAnimation,
|
|
670
|
-
|
|
675
|
+
de as WebAnimation,
|
|
671
676
|
re as createSggoiTransitionContext,
|
|
672
677
|
le as observeSsgoiTransitions
|
|
673
678
|
};
|
|
@@ -5,10 +5,10 @@ import { HostAnimation } from '../animation/host-animation';
|
|
|
5
5
|
*
|
|
6
6
|
* Pure promise plumbing: the framework adapter calls `in(element)` on mount
|
|
7
7
|
* and `out(element)` on unmount; the dispatcher pairs them by path via
|
|
8
|
-
* NavigationDetector, then `.then`-chains the prepare result, the
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* NavigationDetector, then `.then`-chains the prepare result, the `from`
|
|
9
|
+
* element, and the `to` element. `animation()` runs once the chain resolves —
|
|
10
|
+
* never via blocking `await` — so a follow-up navigation can start its own pair
|
|
11
|
+
* while a prior one is still building.
|
|
12
12
|
*/
|
|
13
13
|
export interface CreateSsgoiTransitionContextOptions {
|
|
14
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-ssgoi-transition-context.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-ssgoi-transition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACX,YAAY,EAOb,MAAM,QAAQ,CAAC;AAShB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AA8C5D;;;;;;;;;GASG;AACH,MAAM,WAAW,mCAAmC;IAClD;;;;OAIG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,EACpB,cAAc,GAAE,mCAAwC,GACvD,YAAY,
|
|
1
|
+
{"version":3,"file":"create-ssgoi-transition-context.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-ssgoi-transition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACX,YAAY,EAOb,MAAM,QAAQ,CAAC;AAShB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AA8C5D;;;;;;;;;GASG;AACH,MAAM,WAAW,mCAAmC;IAClD;;;;OAIG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,EACpB,cAAc,GAAE,mCAAwC,GACvD,YAAY,CAwgBd"}
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
* - parent re-mounts that detach the watched node also fire
|
|
11
11
|
* - lower memory / browser overhead than dozens of observers
|
|
12
12
|
*/
|
|
13
|
-
type
|
|
13
|
+
export type UnmountAnchor = {
|
|
14
|
+
parent: Node;
|
|
15
|
+
nextSibling: Node | null;
|
|
16
|
+
};
|
|
17
|
+
type UnmountCallback = (anchor?: UnmountAnchor) => void;
|
|
14
18
|
/** Register `cb` to fire when `element` is removed from the DOM. */
|
|
15
19
|
export declare function watchUnmount(element: HTMLElement, cb: UnmountCallback): () => void;
|
|
16
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unmount-observer.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/unmount-observer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,KAAK,eAAe,GAAG,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"unmount-observer.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/unmount-observer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,IAAI,CAAC;IACb,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,MAAM,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;AAuDxD,oEAAoE;AACpE,wBAAgB,YAAY,CAC1B,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,eAAe,GAClB,MAAM,IAAI,CAMZ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ssgoi/core",
|
|
3
|
-
"version": "6.6.
|
|
3
|
+
"version": "6.6.1",
|
|
4
4
|
"description": "Core animation engine for SSGOI - Native app-like page transitions with spring physics",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -32,6 +32,18 @@
|
|
|
32
32
|
"!dist/**/*.test.*",
|
|
33
33
|
"!dist/**/*.spec.*"
|
|
34
34
|
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"dev": "vite",
|
|
37
|
+
"watch": "vite build --watch",
|
|
38
|
+
"build": "tsc && vite build",
|
|
39
|
+
"preview": "vite preview",
|
|
40
|
+
"prepare": "pnpm run build",
|
|
41
|
+
"lint": "eslint .",
|
|
42
|
+
"test": "vitest",
|
|
43
|
+
"test:ui": "vitest --ui",
|
|
44
|
+
"test:run": "vitest run",
|
|
45
|
+
"test:coverage": "vitest run --coverage"
|
|
46
|
+
},
|
|
35
47
|
"keywords": [
|
|
36
48
|
"page-transition",
|
|
37
49
|
"page-transitions",
|
|
@@ -76,16 +88,5 @@
|
|
|
76
88
|
"vite": "^6.0.7",
|
|
77
89
|
"vite-plugin-dts": "^4.5.0",
|
|
78
90
|
"vitest": "^3.2.4"
|
|
79
|
-
},
|
|
80
|
-
"scripts": {
|
|
81
|
-
"dev": "vite",
|
|
82
|
-
"watch": "vite build --watch",
|
|
83
|
-
"build": "tsc && vite build",
|
|
84
|
-
"preview": "vite preview",
|
|
85
|
-
"lint": "eslint .",
|
|
86
|
-
"test": "vitest",
|
|
87
|
-
"test:ui": "vitest --ui",
|
|
88
|
-
"test:run": "vitest run",
|
|
89
|
-
"test:coverage": "vitest run --coverage"
|
|
90
91
|
}
|
|
91
|
-
}
|
|
92
|
+
}
|