@ssgoi/core 6.2.1 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -8
- package/dist/index.js +888 -825
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +38 -36
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/transitions/axis/provider/index.d.ts.map +1 -1
- package/dist/transitions/axis/provider/z/directional.d.ts +3 -0
- package/dist/transitions/axis/provider/z/directional.d.ts.map +1 -0
- package/dist/transitions/axis/provider/z/index.d.ts +5 -0
- package/dist/transitions/axis/provider/z/index.d.ts.map +1 -0
- package/dist/transitions/axis/provider/z/non-directional.d.ts +3 -0
- package/dist/transitions/axis/provider/z/non-directional.d.ts.map +1 -0
- package/dist/transitions/axis/transition.d.ts.map +1 -1
- package/dist/transitions/hero/index.d.ts +2 -2
- package/dist/transitions/hero/provider/chrome/fade.d.ts +3 -0
- package/dist/transitions/hero/provider/chrome/fade.d.ts.map +1 -0
- package/dist/transitions/hero/provider/chrome/index.d.ts +8 -0
- package/dist/transitions/hero/provider/chrome/index.d.ts.map +1 -0
- package/dist/transitions/hero/provider/chrome/static.d.ts +3 -0
- package/dist/transitions/hero/provider/chrome/static.d.ts.map +1 -0
- package/dist/transitions/hero/provider/index.d.ts +2 -7
- package/dist/transitions/hero/provider/index.d.ts.map +1 -1
- package/dist/transitions/hero/provider/variant/default.d.ts +9 -0
- package/dist/transitions/hero/provider/variant/default.d.ts.map +1 -0
- package/dist/transitions/hero/provider/variant/index.d.ts +11 -0
- package/dist/transitions/hero/provider/variant/index.d.ts.map +1 -0
- package/dist/transitions/hero/provider/variant/smooth.d.ts +9 -0
- package/dist/transitions/hero/provider/variant/smooth.d.ts.map +1 -0
- package/dist/transitions/hero/transition.d.ts.map +1 -1
- package/dist/transitions/hero/types.d.ts +15 -7
- package/dist/transitions/hero/types.d.ts.map +1 -1
- package/dist/transitions/zoom/provider/blur.d.ts.map +1 -1
- package/dist/transitions/zoom/provider/expand.d.ts.map +1 -1
- package/dist/transitions/zoom/transition.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/transitions/axis/provider/z.d.ts +0 -3
- package/dist/transitions/axis/provider/z.d.ts.map +0 -1
- package/dist/transitions/hero/provider/fade.d.ts +0 -3
- package/dist/transitions/hero/provider/fade.d.ts.map +0 -1
- package/dist/transitions/hero/provider/static.d.ts +0 -3
- package/dist/transitions/hero/provider/static.d.ts.map +0 -1
package/dist/internal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ue=Object.defineProperty;var fe=(e,n,t)=>n in e?ue(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var W=(e,n,t)=>fe(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./multi-animation-Dw2JTJI2.cjs");class se extends H.Animation{constructor(){super(...arguments);W(this,"child",null);W(this,"_state","idle");W(this,"_settled",!1);W(this,"listeners",new Set)}attach(t){const o=this.child;if(this.child=t,this._settled=!1,o){const m=o.getPose();o.complete(),t.matchInto(m)}t.playbackRate=this.playbackRate;const c=t.onComplete;t.onComplete=()=>{c==null||c(),this.child===t&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const d=t.onUpdate;t.onUpdate=m=>{var w;d==null||d(m),(w=this.onUpdate)==null||w.call(this,m),this.notify()},this._state==="paused"?t.pause():this._state==="reversing"?t.reverse():(this._state="playing",t.play()),this.notify()}play(){var t;this._state="playing",this._settled=!1,(t=this.child)==null||t.play(),this.notify()}reverse(){var t;this._state="reversing",this._settled=!1,(t=this.child)==null||t.reverse(),this.notify()}pause(){var t;this._state="paused",(t=this.child)==null||t.pause(),this.notify()}complete(){var t;(t=this.child)==null||t.complete(),this.notify()}get isAnimating(){var t;return((t=this.child)==null?void 0:t.isAnimating)??!1}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child}get isReversing(){var t;return((t=this.child)==null?void 0:t.isReversing)??this._state==="reversing"}get progress(){var t;return((t=this.child)==null?void 0:t.progress)??0}findTimeForProgress(t){var o;return((o=this.child)==null?void 0:o.findTimeForProgress(t))??null}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t,this.child&&(this.child.playbackRate=t),this.notify()}getPose(){var t;return((t=this.child)==null?void 0:t.getPose())??[]}getTimeline(){var t;return((t=this.child)==null?void 0:t.getTimeline())??[]}matchInto(t){var o;(o=this.child)==null||o.matchInto(t)}get activeChild(){return this.child}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(const t of this.listeners)t()}}const de=(e,n)=>{var t;e.style.position="absolute",e.style.width="100%",e.style.top=`${-1*(((t=n==null?void 0:n.scrollOffset)==null?void 0:t.y)??0)}px`,e.style.left="0"},Q=new Set(["auto","scroll","overlay"]),me=e=>{let n=e.parentElement;for(;n&&n!==document.body;){const t=window.getComputedStyle(n);if(Q.has(t.overflowY)||Q.has(t.overflowX))return n;n=n.parentElement}return document.documentElement},he=e=>{let n=e.parentElement;for(;n&&n!==document.body;){const t=window.getComputedStyle(n).position;if(t==="relative"||t==="absolute"||t==="fixed"||t==="sticky")return n;n=n.parentElement}return document.body};function ge(e){const n=Object.keys(e);return Promise.all(n.map(t=>e[t])).then(t=>{const o={};return n.forEach((c,d)=>{o[c]=t[d]}),o})}function ye(e){const n=e.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...e,...n]}function F(e,n){if(n==="*")return!0;if(n.endsWith("/*")){const t=n.slice(0,-1);return e.startsWith(t)&&e.length>t.length}return e===n}function pe(e,n,t){for(const o of t)if(F(e,o.from)&&F(n,o.to))return o.transition;for(const o of t)if((o.from==="*"||F(e,o.from))&&(o.to==="*"||F(n,o.to)))return o.transition;return null}const ve=768,Ee=10,we=10;function Se(e={}){const{preserveScroll:n=i=>i}=e,t=typeof n=="function"?n:()=>n;let o=null,c=!1,d=!1;const m=()=>{const i=(o==null?void 0:o.clientWidth)??0,l=i>0?i:typeof window<"u"?window.innerWidth:0;return l>0&&l<ve},w=()=>(d||(c=m(),d=!0),c),y=i=>{var v;const l=t(w());if(l===!1)return{preserves:!1,shared:!1,storageKey:`path:${i}`};if(l===!0)return{preserves:!0,shared:!1,storageKey:`path:${i}`};const g=((v=l.exclude)==null?void 0:v.some(r=>F(i,r)))??!1,p=!g&&!!l.key;return{preserves:!g,shared:p,storageKey:p?`shared:${l.key}`:`path:${i}`}},x=i=>y(i).preserves;let R=null;const h=new Map;let T=null,A=!1,O=0;const I=()=>{o&&T&&!A&&h.set(y(T).storageKey,{x:o.scrollLeft,y:o.scrollTop})},L=i=>{if(!o)return;const l=y(i);if(l.preserves&&l.shared&&!h.has(l.storageKey))return;const g=l.preserves&&h.has(l.storageKey)?h.get(l.storageKey):{x:0,y:0};let p=0;const v=()=>{if(!o)return;o.scrollTo({top:g.y,left:g.x}),!(Math.abs(o.scrollTop-g.y)<1&&Math.abs(o.scrollLeft-g.x)<1)&&p<Ee&&(p++,requestAnimationFrame(v))};requestAnimationFrame(v)};return{initializeContext:(i,l)=>{A=!0;const g=++O;R=i,o||(o=me(i),c=m(),d=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{c=m()}).observe(o),(o===document.documentElement?window:o).addEventListener("scroll",I,{passive:!0})),T=l,L(l);let p=0;const v=()=>{g===O&&(p++,p>=we?A=!1:requestAnimationFrame(v))};requestAnimationFrame(v)},calculateScrollOffset:(i,l)=>{const g=i?y(i).storageKey:null,p=g&&h.has(g)?h.get(g):{x:0,y:0},v=l?y(l):null,r=v!=null&&v.preserves?v.storageKey:null,s=r&&h.has(r)?h.get(r):{x:0,y:0};return{x:-s.x+p.x,y:-s.y+p.y}},evictScrollPosition:i=>{h.delete(y(i).storageKey)},shouldPreserve:x,getScrollContainer:()=>o,getPositionedParentElement:()=>R?he(R):document.body,getScrollPosition:i=>{const l=i?y(i).storageKey:null;return l&&h.has(l)?h.get(l):{x:0,y:0}}}}const ee=30,te=8,ne=1.2,oe=30,be=600;function Te(){let e=null,n=!1,t=!1,o=null,c=null,d=!1;const m=(a,u)=>{for(let f=0;f<a.length;f++){const E=a.item(f);if(E&&E.identifier===u)return E}return null},w=()=>{o!==null&&(clearTimeout(o),o=null)},y=()=>{c!==null&&(clearTimeout(c),c=null)},x=()=>{n=!0,t=!0,w(),y(),o=setTimeout(()=>{n=!1,t=!1,o=null},be)},R=a=>{if(a.touches.length!==1){e=null;return}const u=a.touches.item(0);if(!u){e=null;return}const f=window.innerWidth,E=u.clientX<=ee,P=u.clientX>=f-ee;if(!E&&!P){e=null;return}e={identifier:u.identifier,startX:u.clientX,startY:u.clientY,fromLeftEdge:E,moved:!1}},h=a=>{if(!e)return;if(a.touches.length!==1){e=null;return}const u=m(a.touches,e.identifier);if(!u){e=null;return}const f=u.clientX-e.startX,E=u.clientY-e.startY,P=Math.abs(f),i=Math.abs(E);if(i>te&&i>P*ne){e=null;return}const l=e.fromLeftEdge?f>0:f<0;P>te&&P>i*ne&&l&&(e.moved=!0)},T=a=>{if(!e)return;const u=m(a.changedTouches,e.identifier);if(!u){e=null;return}const f=u.clientX-e.startX,E=e.fromLeftEdge?f>0:f<0;if(e.moved&&E&&Math.abs(f)>=oe){x(),e=null;return}e.moved&&Math.abs(f)>=oe&&x(),e=null},A=()=>{e&&(e.moved&&x(),e=null)};return{initialize:()=>{if(typeof window>"u"||d)return;d=!0;const a={passive:!0,capture:!0};window.addEventListener("touchstart",R,a),window.addEventListener("touchmove",h,a),window.addEventListener("touchend",T,a),window.addEventListener("touchcancel",A,a)},destroy:()=>{if(typeof window>"u"||!d)return;d=!1;const a={capture:!0};window.removeEventListener("touchstart",R,a),window.removeEventListener("touchmove",h,a),window.removeEventListener("touchend",T,a),window.removeEventListener("touchcancel",A,a),w(),y(),e=null,n=!1,t=!1},isSwipeBack:()=>{const a=n||t;return a&&w(),a},onPageEnter:()=>{n=!1,w(),y(),c=setTimeout(()=>{t=!1,c=null},0)}}}function Pe(){let e=null;function n(){var o,c;e&&((o=e.outResolve)==null||o.call(e,null),(c=e.inResolve)==null||c.call(e,null),e=null)}function t(){if(e!=null&&e.from&&(e!=null&&e.to)&&(e!=null&&e.outResolve)&&(e!=null&&e.inResolve)){if(e.from===e.to){n();return}const o={from:e.from,to:e.to};e.outResolve(o),e.inResolve(o),e=null}}return{trigger(o,c){var m;c==="out"&&(e==null?void 0:e.to)===o&&!e.from&&((m=e.inResolve)==null||m.call(e,null),e={}),e&&(c==="out"&&e.from&&e.from!==o||c==="in"&&e.to&&e.to!==o)&&n(),e||(e={}),c==="out"?e.from=o:e.to=o},get(o){return new Promise(c=>{e||(e={}),o==="out"?e.outResolve=c:e.inResolve=c,t()})}}}const X=new Map;let z=null,re=!1;function ie(e){if(e instanceof HTMLElement&&X.has(e)){const n=X.get(e);X.delete(e),queueMicrotask(n)}for(const n of Array.from(e.childNodes))ie(n)}function Re(){if(re||typeof document>"u")return;re=!0,z=new MutationObserver(n=>{for(const t of n)for(const o of Array.from(t.removedNodes))ie(o)});const e=()=>{z==null||z.observe(document.body,{childList:!0,subtree:!0})};document.body?e():document.addEventListener("DOMContentLoaded",e,{once:!0})}function Ae(e,n){return Re(),X.set(e,n),()=>{X.delete(e)}}function xe(e){return Array.isArray(e)}function le(e){const n=[];for(const t of e)xe(t)?n.push(...le(t)):n.push(t);return n}function Le(e,n={}){const{transitions:t=[],middleware:o=(r,s)=>({from:r,to:s}),preserveScroll:c=r=>r}=e,d=n.host??new se,m=Pe(),w=ye(le(t)),y=Te();y.initialize();const{initializeContext:x,calculateScrollOffset:R,evictScrollPosition:h,shouldPreserve:T,getScrollContainer:A,getPositionedParentElement:O,getScrollPosition:I}=Se({preserveScroll:c});let L=null,k=null;const a=new WeakMap,u=r=>{a.set(r,{parent:r.parentElement,nextSibling:r.nextElementSibling})},f=r=>{const s=a.get(r);return s||{parent:r.parentElement,nextSibling:r.nextElementSibling}},E=(r,s,b,S,B)=>{const K=S.element,D=B.element,{parent:M,nextSibling:C}=S.parent?{parent:S.parent,nextSibling:S.nextSibling}:f(K),_=K.cloneNode(!0),q={scrollOffset:R(s,b),from:{scroll:I(s)},to:{scroll:I(b)},get scrollingElement(){return A()||document.documentElement},get positionedParent(){return O()}};de(_,q),T(s)||h(s);const j=Promise.resolve(_),Z=Promise.resolve(D),J=[],ce={from:j,to:Z,context:q,createElement:((Y,$="div")=>{const N=document.createElement($);return N.setAttribute("data-ssgoi-id",Y),J.push(N),N})},ae=Promise.resolve(r.prepare?r.prepare(ce):{});ge({from:j,to:Z,extras:ae}).then(({from:Y,to:$,extras:N})=>{M&&(C&&M.contains(C)?M.insertBefore(_,C):M.appendChild(_));const G=r.animation({from:Y,to:$,context:q,...N}),U=G.onComplete;G.onComplete=()=>{U==null||U(),_.parentElement&&_.parentElement.removeChild(_);for(const V of J)V.parentElement&&V.parentElement.removeChild(V)},d.attach(G)})},P=(r,s)=>{const b=y.isSwipeBack();m.trigger(r,s),m.get(s).then(S=>{if(s==="in"&&y.onPageEnter(),!S)return;if(b){s==="out"&&S.from&&!T(S.from)&&h(S.from),L=null,k=null;return}if(s!=="in")return;const{from:B,to:K}=o(S.from,S.to),D=pe(B,K,w),M=L,C=k;L=null,k=null,!(!D||!M||!C)&&E(D,B,K,M,C)})},i=(r,s)=>{const b=f(r);L={element:r,parent:b.parent,nextSibling:b.nextSibling},P(s,"out")},l=new WeakSet,g=(r,s)=>{l.has(s)||(l.add(s),u(s),x(s,r),k={element:s,parent:s.parentElement,nextSibling:s.nextElementSibling},P(r,"in"),Ae(s,()=>i(s,r)))},p=new Map;return{register:g,refFor:r=>{let s=p.get(r);return s||(s=b=>{b&&g(r,b)},p.set(r,s)),s}}}exports.Animation=H.Animation;exports.MultiAnimation=H.MultiAnimation;exports.WebAnimation=H.WebAnimation;exports.HostAnimation=se;exports.createSggoiTransitionContext=Le;
|
|
1
|
+
"use strict";var ut=Object.defineProperty;var ft=(t,n,e)=>n in t?ut(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var W=(t,n,e)=>ft(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./multi-animation-Dw2JTJI2.cjs");class st 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 c=e.onComplete;e.onComplete=()=>{c==null||c(),this.child===e&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const d=e.onUpdate;e.onUpdate=m=>{var S;d==null||d(m),(S=this.onUpdate)==null||S.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 progress(){var e;return((e=this.child)==null?void 0:e.progress)??0}findTimeForProgress(e){var o;return((o=this.child)==null?void 0:o.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 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 dt=(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"},Q=new Set(["auto","scroll","overlay"]),mt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n);if(Q.has(e.overflowY)||Q.has(e.overflowX))return n;n=n.parentElement}return document.documentElement},ht=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 gt(t){const n=Object.keys(t);return Promise.all(n.map(e=>t[e])).then(e=>{const o={};return n.forEach((c,d)=>{o[c]=e[d]}),o})}function yt(t){const n=t.filter(e=>e.symmetric).map(e=>({from:e.to,to:e.from,transition:e.transition}));return[...t,...n]}function F(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(F(t,o.from)&&F(n,o.to))return o.transition;for(const o of e)if((o.from==="*"||F(t,o.from))&&(o.to==="*"||F(n,o.to)))return o.transition;return null}const vt=768,Et=10,wt=10;function St(t={}){const{preserveScroll:n=i=>i}=t,e=typeof n=="function"?n:()=>n;let o=null,c=!1,d=!1;const m=()=>{const i=(o==null?void 0:o.clientWidth)??0,l=i>0?i:typeof window<"u"?window.innerWidth:0;return l>0&&l<vt},S=()=>(d||(c=m(),d=!0),c),y=i=>{var v;const l=e(S());if(l===!1)return{preserves:!1,shared:!1,storageKey:`path:${i}`};if(l===!0)return{preserves:!0,shared:!1,storageKey:`path:${i}`};const g=((v=l.exclude)==null?void 0:v.some(r=>F(i,r)))??!1,p=!g&&!!l.key;return{preserves:!g,shared:p,storageKey:p?`shared:${l.key}`:`path:${i}`}},x=i=>y(i).preserves;let R=null;const h=new Map;let T=null,A=!1,O=0;const I=()=>{o&&T&&!A&&h.set(y(T).storageKey,{x:o.scrollLeft,y:o.scrollTop})},L=i=>{if(!o)return;const l=y(i);if(l.preserves&&l.shared&&!h.has(l.storageKey))return;const g=l.preserves&&h.has(l.storageKey)?h.get(l.storageKey):{x:0,y:0};let p=0;const v=()=>{if(!o)return;o.scrollTo({top:g.y,left:g.x}),!(Math.abs(o.scrollTop-g.y)<1&&Math.abs(o.scrollLeft-g.x)<1)&&p<Et&&(p++,requestAnimationFrame(v))};requestAnimationFrame(v)};return{initializeContext:(i,l)=>{A=!0;const g=++O;R=i,o||(o=mt(i),c=m(),d=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{c=m()}).observe(o),(o===document.documentElement?window:o).addEventListener("scroll",I,{passive:!0})),T=l,L(l);let p=0;const v=()=>{g===O&&(p++,p>=wt?A=!1:requestAnimationFrame(v))};requestAnimationFrame(v)},calculateScrollOffset:(i,l)=>{const g=i?y(i).storageKey:null,p=g&&h.has(g)?h.get(g):{x:0,y:0},v=l?y(l):null,r=v!=null&&v.preserves?v.storageKey:null,s=r&&h.has(r)?h.get(r):{x:0,y:0};return{x:-s.x+p.x,y:-s.y+p.y}},evictScrollPosition:i=>{h.delete(y(i).storageKey)},shouldPreserve:x,getScrollContainer:()=>o,getPositionedParentElement:()=>R?ht(R):document.body,getScrollPosition:i=>{const l=i?y(i).storageKey:null;return l&&h.has(l)?h.get(l):{x:0,y:0}}}}const tt=30,et=8,nt=1.2,ot=30,bt=600;function Tt(){let t=null,n=!1,e=!1,o=null,c=null,d=!1;const m=(a,u)=>{for(let f=0;f<a.length;f++){const E=a.item(f);if(E&&E.identifier===u)return E}return null},S=()=>{o!==null&&(clearTimeout(o),o=null)},y=()=>{c!==null&&(clearTimeout(c),c=null)},x=()=>{n=!0,e=!0,S(),y(),o=setTimeout(()=>{n=!1,e=!1,o=null},bt)},R=a=>{if(a.touches.length!==1){t=null;return}const u=a.touches.item(0);if(!u){t=null;return}const f=window.innerWidth,E=u.clientX<=tt,P=u.clientX>=f-tt;if(!E&&!P){t=null;return}t={identifier:u.identifier,startX:u.clientX,startY:u.clientY,fromLeftEdge:E,moved:!1}},h=a=>{if(!t)return;if(a.touches.length!==1){t=null;return}const u=m(a.touches,t.identifier);if(!u){t=null;return}const f=u.clientX-t.startX,E=u.clientY-t.startY,P=Math.abs(f),i=Math.abs(E);if(i>et&&i>P*nt){t=null;return}const l=t.fromLeftEdge?f>0:f<0;P>et&&P>i*nt&&l&&(t.moved=!0)},T=a=>{if(!t)return;const u=m(a.changedTouches,t.identifier);if(!u){t=null;return}const f=u.clientX-t.startX,E=t.fromLeftEdge?f>0:f<0;if(t.moved&&E&&Math.abs(f)>=ot){x(),t=null;return}t.moved&&Math.abs(f)>=ot&&x(),t=null},A=()=>{t&&(t.moved&&x(),t=null)};return{initialize:()=>{if(typeof window>"u"||d)return;d=!0;const a={passive:!0,capture:!0};window.addEventListener("touchstart",R,a),window.addEventListener("touchmove",h,a),window.addEventListener("touchend",T,a),window.addEventListener("touchcancel",A,a)},destroy:()=>{if(typeof window>"u"||!d)return;d=!1;const a={capture:!0};window.removeEventListener("touchstart",R,a),window.removeEventListener("touchmove",h,a),window.removeEventListener("touchend",T,a),window.removeEventListener("touchcancel",A,a),S(),y(),t=null,n=!1,e=!1},isSwipeBack:()=>{const a=n||e;return a&&S(),a},onPageEnter:()=>{n=!1,S(),y(),c=setTimeout(()=>{e=!1,c=null},0)}}}function Pt(){let t=null;function n(){var o,c;t&&((o=t.outResolve)==null||o.call(t,null),(c=t.inResolve)==null||c.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,c){var m;c==="out"&&(t==null?void 0:t.to)===o&&!t.from&&((m=t.inResolve)==null||m.call(t,null),t={}),t&&(c==="out"&&t.from&&t.from!==o||c==="in"&&t.to&&t.to!==o)&&n(),t||(t={}),c==="out"?t.from=o:t.to=o},get(o){return new Promise(c=>{t||(t={}),o==="out"?t.outResolve=c:t.inResolve=c,e()})}}}const X=new Map;let z=null,rt=!1;function it(t){if(t instanceof HTMLElement&&X.has(t)){const n=X.get(t);X.delete(t),queueMicrotask(n)}for(const n of Array.from(t.childNodes))it(n)}function Rt(){if(rt||typeof document>"u")return;rt=!0,z=new MutationObserver(n=>{for(const e of n)for(const o of Array.from(e.removedNodes))it(o)});const t=()=>{z==null||z.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function At(t,n){return Rt(),X.set(t,n),()=>{X.delete(t)}}function xt(t){return Array.isArray(t)}function lt(t){const n=[];for(const e of t)xt(e)?n.push(...lt(e)):n.push(e);return n}function Lt(t,n={}){const{transitions:e=[],middleware:o=(r,s)=>({from:r,to:s}),preserveScroll:c=r=>r}=t,d=n.host??new st,m=Pt(),S=yt(lt(e)),y=Tt();y.initialize();const{initializeContext:x,calculateScrollOffset:R,evictScrollPosition:h,shouldPreserve:T,getScrollContainer:A,getPositionedParentElement:O,getScrollPosition:I}=St({preserveScroll:c});let L=null,k=null;const a=new WeakMap,u=r=>{a.set(r,{parent:r.parentElement,nextSibling:r.nextElementSibling})},f=r=>{const s=a.get(r);return s||{parent:r.parentElement,nextSibling:r.nextElementSibling}},E=(r,s,b,w,B)=>{const K=w.element,D=B.element,{parent:M,nextSibling:C}=w.parent?{parent:w.parent,nextSibling:w.nextSibling}:f(K),_=K.cloneNode(!0),q={scrollOffset:R(s,b),from:{scroll:I(s)},to:{scroll:I(b)},get scrollingElement(){return A()||document.documentElement},get positionedParent(){return O()}};dt(_,q),T(s)||h(s);const j=Promise.resolve(_),Z=Promise.resolve(D),J=[],ct={from:j,to:Z,context:q,createElement:((Y,$="div")=>{const N=document.createElement($);return N.setAttribute("data-ssgoi-id",Y),J.push(N),N})},at=Promise.resolve(r.prepare?r.prepare(ct):{});gt({from:j,to:Z,extras:at}).then(({from:Y,to:$,extras:N})=>{M&&(C&&M.contains(C)?M.insertBefore(_,C):M.appendChild(_));const G=r.animation({from:Y,to:$,context:q,...N}),U=G.onComplete;G.onComplete=()=>{U==null||U(),_.parentElement&&_.parentElement.removeChild(_);for(const V of J)V.parentElement&&V.parentElement.removeChild(V)},d.attach(G)})},P=(r,s)=>{const b=y.isSwipeBack();m.trigger(r,s),m.get(s).then(w=>{if(s==="in"&&y.onPageEnter(),!w)return;if(b){s==="out"&&w.from&&!T(w.from)&&h(w.from),L=null,k=null;return}if(s!=="in")return;const{from:B,to:K}=o(w.from,w.to),D=pt(B,K,S),M=L,C=k;L=null,k=null,!(!D||!M||!C)&&E(D,B,K,M,C)})},i=(r,s)=>{const b=f(r);L={element:r,parent:b.parent,nextSibling:b.nextSibling};const w=r.getAttribute("data-ssgoi-transition")??s;P(w,"out")},l=new WeakSet,g=(r,s)=>{l.has(s)||(l.add(s),u(s),x(s,r),k={element:s,parent:s.parentElement,nextSibling:s.nextElementSibling},P(r,"in"),At(s,()=>i(s,r)))},p=new Map;return{register:g,refFor:r=>{let s=p.get(r);return s||(s=b=>{b&&g(r,b)},p.set(r,s)),s}}}exports.Animation=H.Animation;exports.MultiAnimation=H.MultiAnimation;exports.WebAnimation=H.WebAnimation;exports.HostAnimation=st;exports.createSggoiTransitionContext=Lt;
|
package/dist/internal.js
CHANGED
|
@@ -24,8 +24,8 @@ class fe extends ue {
|
|
|
24
24
|
};
|
|
25
25
|
const d = t.onUpdate;
|
|
26
26
|
t.onUpdate = (h) => {
|
|
27
|
-
var
|
|
28
|
-
d == null || d(h), (
|
|
27
|
+
var S;
|
|
28
|
+
d == null || d(h), (S = this.onUpdate) == null || S.call(this, h), this.notify();
|
|
29
29
|
}, this._state === "paused" ? t.pause() : this._state === "reversing" ? t.reverse() : (this._state = "playing", t.play()), this.notify();
|
|
30
30
|
}
|
|
31
31
|
play() {
|
|
@@ -162,9 +162,9 @@ function Se(e = {}) {
|
|
|
162
162
|
const h = () => {
|
|
163
163
|
const i = (o == null ? void 0 : o.clientWidth) ?? 0, l = i > 0 ? i : typeof window < "u" ? window.innerWidth : 0;
|
|
164
164
|
return l > 0 && l < ve;
|
|
165
|
-
},
|
|
165
|
+
}, S = () => (d || (c = h(), d = !0), c), y = (i) => {
|
|
166
166
|
var v;
|
|
167
|
-
const l = t(
|
|
167
|
+
const l = t(S());
|
|
168
168
|
if (l === !1)
|
|
169
169
|
return { preserves: !1, shared: !1, storageKey: `path:${i}` };
|
|
170
170
|
if (l === !0)
|
|
@@ -176,7 +176,7 @@ function Se(e = {}) {
|
|
|
176
176
|
storageKey: p ? `shared:${l.key}` : `path:${i}`
|
|
177
177
|
};
|
|
178
178
|
}, x = (i) => y(i).preserves;
|
|
179
|
-
let
|
|
179
|
+
let R = null;
|
|
180
180
|
const m = /* @__PURE__ */ new Map();
|
|
181
181
|
let T = null, A = !1, O = 0;
|
|
182
182
|
const I = () => {
|
|
@@ -204,7 +204,7 @@ function Se(e = {}) {
|
|
|
204
204
|
initializeContext: (i, l) => {
|
|
205
205
|
A = !0;
|
|
206
206
|
const g = ++O;
|
|
207
|
-
|
|
207
|
+
R = i, o || (o = he(i), c = h(), d = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
|
|
208
208
|
c = h();
|
|
209
209
|
}).observe(o), (o === document.documentElement ? window : o).addEventListener("scroll", I, {
|
|
210
210
|
passive: !0
|
|
@@ -227,7 +227,7 @@ function Se(e = {}) {
|
|
|
227
227
|
},
|
|
228
228
|
shouldPreserve: x,
|
|
229
229
|
getScrollContainer: () => o,
|
|
230
|
-
getPositionedParentElement: () =>
|
|
230
|
+
getPositionedParentElement: () => R ? me(R) : document.body,
|
|
231
231
|
getScrollPosition: (i) => {
|
|
232
232
|
const l = i ? y(i).storageKey : null;
|
|
233
233
|
return l && m.has(l) ? m.get(l) : { x: 0, y: 0 };
|
|
@@ -243,15 +243,15 @@ function Te() {
|
|
|
243
243
|
if (E && E.identifier === u) return E;
|
|
244
244
|
}
|
|
245
245
|
return null;
|
|
246
|
-
},
|
|
246
|
+
}, S = () => {
|
|
247
247
|
o !== null && (clearTimeout(o), o = null);
|
|
248
248
|
}, y = () => {
|
|
249
249
|
c !== null && (clearTimeout(c), c = null);
|
|
250
250
|
}, x = () => {
|
|
251
|
-
n = !0, t = !0,
|
|
251
|
+
n = !0, t = !0, S(), y(), o = setTimeout(() => {
|
|
252
252
|
n = !1, t = !1, o = null;
|
|
253
253
|
}, be);
|
|
254
|
-
},
|
|
254
|
+
}, R = (a) => {
|
|
255
255
|
if (a.touches.length !== 1) {
|
|
256
256
|
e = null;
|
|
257
257
|
return;
|
|
@@ -261,8 +261,8 @@ function Te() {
|
|
|
261
261
|
e = null;
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
|
-
const f = window.innerWidth, E = u.clientX <= Q,
|
|
265
|
-
if (!E && !
|
|
264
|
+
const f = window.innerWidth, E = u.clientX <= Q, P = u.clientX >= f - Q;
|
|
265
|
+
if (!E && !P) {
|
|
266
266
|
e = null;
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
@@ -284,13 +284,13 @@ function Te() {
|
|
|
284
284
|
e = null;
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
|
-
const f = u.clientX - e.startX, E = u.clientY - e.startY,
|
|
288
|
-
if (i > ee && i >
|
|
287
|
+
const f = u.clientX - e.startX, E = u.clientY - e.startY, P = Math.abs(f), i = Math.abs(E);
|
|
288
|
+
if (i > ee && i > P * te) {
|
|
289
289
|
e = null;
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
292
292
|
const l = e.fromLeftEdge ? f > 0 : f < 0;
|
|
293
|
-
|
|
293
|
+
P > ee && P > i * te && l && (e.moved = !0);
|
|
294
294
|
}, T = (a) => {
|
|
295
295
|
if (!e) return;
|
|
296
296
|
const u = h(a.changedTouches, e.identifier);
|
|
@@ -311,22 +311,22 @@ function Te() {
|
|
|
311
311
|
if (typeof window > "u" || d) return;
|
|
312
312
|
d = !0;
|
|
313
313
|
const a = { passive: !0, capture: !0 };
|
|
314
|
-
window.addEventListener("touchstart",
|
|
314
|
+
window.addEventListener("touchstart", R, a), window.addEventListener("touchmove", m, a), window.addEventListener("touchend", T, a), window.addEventListener("touchcancel", A, a);
|
|
315
315
|
}, destroy: () => {
|
|
316
316
|
if (typeof window > "u" || !d) return;
|
|
317
317
|
d = !1;
|
|
318
318
|
const a = { capture: !0 };
|
|
319
|
-
window.removeEventListener("touchstart",
|
|
319
|
+
window.removeEventListener("touchstart", R, a), window.removeEventListener("touchmove", m, a), window.removeEventListener("touchend", T, a), window.removeEventListener("touchcancel", A, a), S(), y(), e = null, n = !1, t = !1;
|
|
320
320
|
}, isSwipeBack: () => {
|
|
321
321
|
const a = n || t;
|
|
322
|
-
return a &&
|
|
322
|
+
return a && S(), a;
|
|
323
323
|
}, onPageEnter: () => {
|
|
324
|
-
n = !1,
|
|
324
|
+
n = !1, S(), y(), c = setTimeout(() => {
|
|
325
325
|
t = !1, c = null;
|
|
326
326
|
}, 0);
|
|
327
327
|
} };
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function Pe() {
|
|
330
330
|
let e = null;
|
|
331
331
|
function n() {
|
|
332
332
|
var o, c;
|
|
@@ -364,7 +364,7 @@ function re(e) {
|
|
|
364
364
|
for (const n of Array.from(e.childNodes))
|
|
365
365
|
re(n);
|
|
366
366
|
}
|
|
367
|
-
function
|
|
367
|
+
function Re() {
|
|
368
368
|
if (oe || typeof document > "u") return;
|
|
369
369
|
oe = !0, z = new MutationObserver((n) => {
|
|
370
370
|
for (const t of n)
|
|
@@ -377,7 +377,7 @@ function Pe() {
|
|
|
377
377
|
document.body ? e() : document.addEventListener("DOMContentLoaded", e, { once: !0 });
|
|
378
378
|
}
|
|
379
379
|
function Ae(e, n) {
|
|
380
|
-
return
|
|
380
|
+
return Re(), X.set(e, n), () => {
|
|
381
381
|
X.delete(e);
|
|
382
382
|
};
|
|
383
383
|
}
|
|
@@ -395,13 +395,13 @@ function Ce(e, n = {}) {
|
|
|
395
395
|
transitions: t = [],
|
|
396
396
|
middleware: o = (r, s) => ({ from: r, to: s }),
|
|
397
397
|
preserveScroll: c = (r) => r
|
|
398
|
-
} = e, d = n.host ?? new fe(), h =
|
|
398
|
+
} = e, d = n.host ?? new fe(), h = Pe(), S = ye(
|
|
399
399
|
se(t)
|
|
400
400
|
), y = Te();
|
|
401
401
|
y.initialize();
|
|
402
402
|
const {
|
|
403
403
|
initializeContext: x,
|
|
404
|
-
calculateScrollOffset:
|
|
404
|
+
calculateScrollOffset: R,
|
|
405
405
|
evictScrollPosition: m,
|
|
406
406
|
shouldPreserve: T,
|
|
407
407
|
getScrollContainer: A,
|
|
@@ -420,9 +420,9 @@ function Ce(e, n = {}) {
|
|
|
420
420
|
parent: r.parentElement,
|
|
421
421
|
nextSibling: r.nextElementSibling
|
|
422
422
|
};
|
|
423
|
-
}, E = (r, s, b,
|
|
424
|
-
const K =
|
|
425
|
-
scrollOffset:
|
|
423
|
+
}, E = (r, s, b, w, B) => {
|
|
424
|
+
const K = w.element, D = B.element, { parent: _, nextSibling: C } = w.parent ? { parent: w.parent, nextSibling: w.nextSibling } : f(K), M = K.cloneNode(!0), H = {
|
|
425
|
+
scrollOffset: R(s, b),
|
|
426
426
|
from: { scroll: I(s) },
|
|
427
427
|
to: { scroll: I(b) },
|
|
428
428
|
get scrollingElement() {
|
|
@@ -462,22 +462,22 @@ function Ce(e, n = {}) {
|
|
|
462
462
|
U.parentElement && U.parentElement.removeChild(U);
|
|
463
463
|
}, d.attach($);
|
|
464
464
|
});
|
|
465
|
-
},
|
|
465
|
+
}, P = (r, s) => {
|
|
466
466
|
const b = y.isSwipeBack();
|
|
467
|
-
h.trigger(r, s), h.get(s).then((
|
|
468
|
-
if (s === "in" && y.onPageEnter(), !
|
|
467
|
+
h.trigger(r, s), h.get(s).then((w) => {
|
|
468
|
+
if (s === "in" && y.onPageEnter(), !w) return;
|
|
469
469
|
if (b) {
|
|
470
|
-
s === "out" &&
|
|
470
|
+
s === "out" && w.from && !T(w.from) && m(w.from), L = null, k = null;
|
|
471
471
|
return;
|
|
472
472
|
}
|
|
473
473
|
if (s !== "in") return;
|
|
474
474
|
const { from: B, to: K } = o(
|
|
475
|
-
|
|
476
|
-
|
|
475
|
+
w.from,
|
|
476
|
+
w.to
|
|
477
477
|
), D = pe(
|
|
478
478
|
B,
|
|
479
479
|
K,
|
|
480
|
-
|
|
480
|
+
S
|
|
481
481
|
), _ = L, C = k;
|
|
482
482
|
L = null, k = null, !(!D || !_ || !C) && E(D, B, K, _, C);
|
|
483
483
|
});
|
|
@@ -487,13 +487,15 @@ function Ce(e, n = {}) {
|
|
|
487
487
|
element: r,
|
|
488
488
|
parent: b.parent,
|
|
489
489
|
nextSibling: b.nextSibling
|
|
490
|
-
}
|
|
490
|
+
};
|
|
491
|
+
const w = r.getAttribute("data-ssgoi-transition") ?? s;
|
|
492
|
+
P(w, "out");
|
|
491
493
|
}, l = /* @__PURE__ */ new WeakSet(), g = (r, s) => {
|
|
492
494
|
l.has(s) || (l.add(s), u(s), x(s, r), k = {
|
|
493
495
|
element: s,
|
|
494
496
|
parent: s.parentElement,
|
|
495
497
|
nextSibling: s.nextElementSibling
|
|
496
|
-
},
|
|
498
|
+
}, P(r, "in"), Ae(s, () => i(s, r)));
|
|
497
499
|
}, p = /* @__PURE__ */ new Map();
|
|
498
500
|
return { register: g, refFor: (r) => {
|
|
499
501
|
let s = p.get(r);
|
|
@@ -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,EAMb,MAAM,QAAQ,CAAC;AAQhB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAiC5D;;;;;;;;;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,EAMb,MAAM,QAAQ,CAAC;AAQhB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAiC5D;;;;;;;;;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,CA2Pd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/transitions/axis/provider/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAKjE,KAAK,eAAe,GAAG;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG,OAAO,CACvD,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,CAC/B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/transitions/axis/provider/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAKjE,KAAK,eAAe,GAAG;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG,OAAO,CACvD,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,CAC/B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,QAAQ,EAAE,eAAe,CAI5D,CAAC;AAEF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,QAAQ,GACb,YAAY,CAGd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directional.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transitions/axis/provider/z/directional.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,YAAY,EAEb,MAAM,aAAa,CAAC;AAiDrB,wBAAgB,0BAA0B,IAAI,YAAY,CASzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transitions/axis/provider/z/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAU1D,eAAO,MAAM,WAAW,EAAE;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG,OAAO,CAC1D,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,CAK/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"non-directional.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transitions/axis/provider/z/non-directional.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,YAAY,EAAE,MAAM,aAAa,CAAC;AAuCrE,wBAAgB,6BAA6B,IAAI,YAAY,CAO5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../src/lib/transitions/axis/transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../src/lib/transitions/axis/transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAQ/C,OAAO,KAAK,EAAY,WAAW,EAA4B,MAAM,SAAS,CAAC;AAE/E,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAwB/D,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB,KAAG,gBAsDhD,CAAC"}
|
|
@@ -5,8 +5,8 @@ export type { HeroOptions, HeroType, HeroVariant } from './types';
|
|
|
5
5
|
/**
|
|
6
6
|
* Hero preset configuration.
|
|
7
7
|
*
|
|
8
|
-
* - `type: "static"` (default) — incoming-page chrome snaps in;
|
|
9
|
-
* element morphs
|
|
8
|
+
* - `type: "static"` (default) — incoming-page chrome snaps in; a temporary
|
|
9
|
+
* shared-element clone morphs via clip-path inset + uniform scale.
|
|
10
10
|
* - `type: "fade"` — both pages cross-fade as whole surfaces while a
|
|
11
11
|
* temporary shared-element clone morphs above them. Use when each side has
|
|
12
12
|
* its own chrome (e.g., a detail screen with its own back button / app bar).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fade.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transitions/hero/provider/chrome/fade.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAqB,YAAY,EAAE,MAAM,aAAa,CAAC;AA6CnE,eAAO,MAAM,wBAAwB,QAAO,YACT,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HeroStrategy, HeroType } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Chrome-handling strategy keyed on `HeroType`. The dispatcher in
|
|
4
|
+
* transition.ts looks the factory up here and assembles it next to the
|
|
5
|
+
* always-on TileStrategy — never branches on the type itself.
|
|
6
|
+
*/
|
|
7
|
+
export declare const HERO_CHROME_PROVIDERS: Record<HeroType, () => HeroStrategy>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transitions/hero/provider/chrome/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI1D;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,YAAY,CAGtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transitions/hero/provider/chrome/static.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,aAAa,CAAC;AAmBhE,eAAO,MAAM,0BAA0B,QAAO,YAChB,CAAC"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Chrome-handling strategy keyed on `HeroType`. The dispatcher in
|
|
4
|
-
* transition.ts looks the factory up here and assembles it next to the
|
|
5
|
-
* always-on TileStrategy — never branches on the type itself.
|
|
6
|
-
*/
|
|
7
|
-
export declare const HERO_CHROME_PROVIDERS: Record<HeroType, () => HeroStrategy>;
|
|
1
|
+
export { HERO_CHROME_PROVIDERS } from './chrome';
|
|
2
|
+
export { HERO_VARIANT_PROVIDERS } from './variant';
|
|
8
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/transitions/hero/provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/transitions/hero/provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PhysicsOptions } from '../../../../types/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Default hero physics. Single spring, no follower stage — crisp arrival.
|
|
4
|
+
* Shared by every strategy in the same transition so progress stays locked
|
|
5
|
+
* across the parallel animation set.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_HERO_PHYSICS: PhysicsOptions;
|
|
8
|
+
export declare const createDefaultVariantProvider: () => PhysicsOptions;
|
|
9
|
+
//# sourceMappingURL=default.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transitions/hero/provider/variant/default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,cAElC,CAAC;AAEF,eAAO,MAAM,4BAA4B,QAAO,cAC1B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PhysicsOptions } from '../../../../types/index.ts';
|
|
2
|
+
import { HeroVariant } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Physics provider keyed on `HeroVariant`. The dispatcher in transition.ts
|
|
5
|
+
* looks the factory up here so swapping variants never needs an `if/switch`
|
|
6
|
+
* on the variant name. Each provider returns a single `PhysicsOptions` that
|
|
7
|
+
* is shared by every strategy in the same transition — keeping the tile,
|
|
8
|
+
* chrome, and any future contributor locked to one spring.
|
|
9
|
+
*/
|
|
10
|
+
export declare const HERO_VARIANT_PROVIDERS: Record<HeroVariant, () => PhysicsOptions>;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transitions/hero/provider/variant/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,cAAc,CAI1E,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PhysicsOptions } from '../../../../types/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Smooth hero physics. Same base spring as `default` (so curated speed stays
|
|
4
|
+
* shared across variants) plus `doubleSpring: 1` for a soft follower stage —
|
|
5
|
+
* the tile glides into rest instead of snapping.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SMOOTH_HERO_PHYSICS: PhysicsOptions;
|
|
8
|
+
export declare const createSmoothVariantProvider: () => PhysicsOptions;
|
|
9
|
+
//# sourceMappingURL=smooth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smooth.d.ts","sourceRoot":"","sources":["../../../../../src/lib/transitions/hero/provider/variant/smooth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,cAEjC,CAAC;AAEF,eAAO,MAAM,2BAA2B,QAAO,cAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../src/lib/transitions/hero/transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../src/lib/transitions/hero/transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAU/C,OAAO,KAAK,EAKV,YAAY,EAEZ,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AA8a5E,KAAK,UAAU,GAAG;IAAE,QAAQ,EAAE,YAAY,CAAA;CAAE,CAAC;AAE7C,eAAO,MAAM,IAAI,GACf,SAAS,qBAAqB,KAC7B,gBAAgB,CAAC,UAAU,CA0E7B,CAAC"}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { PhysicsOptions } from '../../types/index.ts';
|
|
2
2
|
import { Animation } from '../../animation';
|
|
3
3
|
/**
|
|
4
|
-
* - `static` —
|
|
5
|
-
* snaps
|
|
4
|
+
* - `static` — a temporary shared-element clone morphs above the incoming
|
|
5
|
+
* page while page chrome snaps to its final state. Default.
|
|
6
6
|
* - `fade` — both pages cross-fade as whole surfaces while a temporary hero
|
|
7
7
|
* clone morphs above them.
|
|
8
8
|
*/
|
|
9
9
|
export type HeroType = "static" | "fade";
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* - `default` — single-spring physics shared between every strategy in the
|
|
12
|
+
* transition (300/30). Crisp, traditional spring feel.
|
|
13
|
+
* - `smooth` — same base spring with `doubleSpring: 1` so the tile motion
|
|
14
|
+
* trails through a soft follower stage; gentler arrival, no hard stop.
|
|
15
|
+
*
|
|
16
|
+
* The variant only swaps the physics provider — chrome handling is owned by
|
|
17
|
+
* `HeroType` and stays orthogonal.
|
|
18
|
+
*/
|
|
19
|
+
export type HeroVariant = "default" | "smooth";
|
|
11
20
|
export type HeroOptions = Record<string, never>;
|
|
21
|
+
export type HeroFit = "contain" | "cover";
|
|
12
22
|
export interface NormalizedHeroOptions {
|
|
13
23
|
type: HeroType;
|
|
14
24
|
variant: HeroVariant;
|
|
@@ -17,6 +27,8 @@ export interface HeroPair {
|
|
|
17
27
|
key: string;
|
|
18
28
|
fromEl: HTMLElement;
|
|
19
29
|
toEl: HTMLElement;
|
|
30
|
+
fromFit: HeroFit;
|
|
31
|
+
toFit: HeroFit;
|
|
20
32
|
}
|
|
21
33
|
export interface HeroResolved {
|
|
22
34
|
pairs: HeroPair[];
|
|
@@ -31,10 +43,6 @@ export interface HeroContributeCtx {
|
|
|
31
43
|
to: HTMLElement;
|
|
32
44
|
resolved: HeroResolved;
|
|
33
45
|
physics: PhysicsOptions;
|
|
34
|
-
scrollOffset: {
|
|
35
|
-
x: number;
|
|
36
|
-
y: number;
|
|
37
|
-
};
|
|
38
46
|
positionedParent: HTMLElement;
|
|
39
47
|
maxDistance: number;
|
|
40
48
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/transitions/hero/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAMjD;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AACzC,MAAM,MAAM,WAAW,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/transitions/hero/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAMjD;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AACzC;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC/C,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEhD,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAO1C,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,WAAW,CAAC;CACtB;AAMD,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAUD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3B,EAAE,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,EAAE,EAAE,WAAW,CAAC;IAChB,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,cAAc,CAAC;IACxB,gBAAgB,EAAE,WAAW,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACtC;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,SAAS,EAAE,CAAC;CACtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../../../src/lib/transitions/zoom/provider/blur.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAEV,iBAAiB,EACjB,UAAU,EAEV,cAAc,EACd,YAAY,EACZ,YAAY,EACb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EAGV,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,YAAY,EAAE,cAM1B,CAAC;
|
|
1
|
+
{"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../../../src/lib/transitions/zoom/provider/blur.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAEV,iBAAiB,EACjB,UAAU,EAEV,cAAc,EACd,YAAY,EACZ,YAAY,EACb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EAGV,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,YAAY,EAAE,cAM1B,CAAC;AAsEF,qBAAa,sBAAuB,YAAW,YAAY;IACzD,QAAQ,CAAC,OAAO,iBAAgB;IAEhC,UAAU,CAAC,GAAG,EAAE,iBAAiB,GAAG,SAAS,EAAE;CAkBhD;AAQD,qBAAa,eAAgB,YAAW,YAAY;IAClD,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAQjD,UAAU,CAAC,GAAG,EAAE,iBAAiB,GAAG,SAAS,EAAE;CAehD;AAMD,wBAAgB,kBAAkB,IAAI,YAAY,CASjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../../src/lib/transitions/zoom/provider/expand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAGV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACb,MAAM,UAAU,CAAC;AAClB,OAAO,
|
|
1
|
+
{"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../../src/lib/transitions/zoom/provider/expand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAGV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EAGV,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,cAAc,EAAE,cAM5B,CAAC;AAqFF,qBAAa,wBAAyB,YAAW,YAAY;IAC3D,QAAQ,CAAC,OAAO,iBAAkB;IAElC,UAAU,CAAC,GAAG,EAAE,iBAAiB,GAAG,SAAS,EAAE;CAoBhD;AAUD,wBAAgB,oBAAoB,IAAI,YAAY,CAQnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../src/lib/transitions/zoom/transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,gBAAgB,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../src/lib/transitions/zoom/transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAU/D,OAAO,KAAK,EACV,qBAAqB,EAGrB,UAAU,EAKX,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAqR5E,eAAO,MAAM,IAAI,GACf,SAAS,qBAAqB,KAC7B,gBAAgB,CAAC,UAAU,CAoF7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"z.d.ts","sourceRoot":"","sources":["../../../../src/lib/transitions/axis/provider/z.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,YAAY,EAAE,MAAM,UAAU,CAAC;AAqClE,wBAAgB,eAAe,IAAI,YAAY,CAU9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fade.d.ts","sourceRoot":"","sources":["../../../../src/lib/transitions/hero/provider/fade.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAqB,YAAY,EAAE,MAAM,UAAU,CAAC;AA4ChE,eAAO,MAAM,wBAAwB,QAAO,YACT,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../../../src/lib/transitions/hero/provider/static.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,UAAU,CAAC;AAoB7D,eAAO,MAAM,0BAA0B,QAAO,YAChB,CAAC"}
|