@ssgoi/core 6.6.1 → 6.6.2

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/README.md CHANGED
@@ -42,11 +42,12 @@ npm install @ssgoi/react
42
42
 
43
43
  ### Add Transitions in 30 Seconds
44
44
 
45
- #### 1. Wrap your app
45
+ #### 1. Wrap your React app
46
46
 
47
47
  ```tsx
48
48
  import { Ssgoi } from "@ssgoi/react";
49
49
  import { fade } from "@ssgoi/react/view-transitions";
50
+ import { SsgoiTransitionBoundary } from "./ssgoi-transition-boundary";
50
51
 
51
52
  const config = {
52
53
  transitions: [fade({ paths: ["/", "/about"] })],
@@ -55,19 +56,20 @@ const config = {
55
56
  export default function App() {
56
57
  return (
57
58
  <Ssgoi config={config}>
58
- {/* relative + z-0: the outgoing page is cloned with position:absolute */}
59
- <div className="relative z-0">{/* Your app */}</div>
59
+ <SsgoiTransitionBoundary className="relative z-0 min-h-dvh bg-white">
60
+ {/* Your app */}
61
+ </SsgoiTransitionBoundary>
60
62
  </Ssgoi>
61
63
  );
62
64
  }
63
65
  ```
64
66
 
65
- #### 2. Mark your pages
67
+ #### 2. Keep React pages unmarked
66
68
 
67
69
  ```tsx
68
70
  export default function HomePage() {
69
71
  return (
70
- <main data-ssgoi-transition="/">
72
+ <main>
71
73
  <h1>Welcome</h1>
72
74
  {/* Page content */}
73
75
  </main>
@@ -75,6 +77,50 @@ export default function HomePage() {
75
77
  }
76
78
  ```
77
79
 
80
+ For React adapters, create one router-specific `SsgoiTransitionBoundary` utility in your layout.
81
+ It reads the current pathname internally, sets the transition boundary key, and
82
+ uses that pathname as a logical page id matched by config such as
83
+ `/products/*`. Use `/products/**` when the parent path itself should match too.
84
+
85
+ Next.js implementation:
86
+
87
+ ```tsx
88
+ "use client";
89
+
90
+ import { type ElementType, type ReactNode } from "react";
91
+ import { usePathname } from "next/navigation";
92
+
93
+ export function SsgoiTransitionBoundary({
94
+ children,
95
+ as,
96
+ className,
97
+ }: {
98
+ children: ReactNode;
99
+ as?: ElementType;
100
+ className?: string;
101
+ }) {
102
+ const pathname = usePathname();
103
+ const Component = as ?? "div";
104
+
105
+ return (
106
+ <Component
107
+ key={pathname}
108
+ data-ssgoi-transition={pathname}
109
+ className={className}
110
+ >
111
+ {children}
112
+ </Component>
113
+ );
114
+ }
115
+ ```
116
+
117
+ React Router and TanStack Router use the same component body with their own
118
+ pathname hook.
119
+
120
+ For SvelteKit, Nuxt/Vue, Solid, and Angular, mark each routed page boundary
121
+ directly with `data-ssgoi-transition` instead of using a layout-level utility.
122
+ The value can be a hard-coded logical id; it only has to match your config.
123
+
78
124
  **That's it!** Your configured pages now transition smoothly with a fade effect.
79
125
 
80
126
  ## Advanced Transitions
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 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;
1
+ "use strict";var Nt=Object.defineProperty;var kt=(t,s,e)=>s in t?Nt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e;var z=(t,s,e)=>kt(t,typeof s!="symbol"?s+"":s,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./multi-animation-uzEnQnrG.cjs");class Pt extends j.Animation{constructor(){super(...arguments);z(this,"child",null);z(this,"_state","idle");z(this,"_settled",!1);z(this,"listeners",new Set)}attach(e){const n=this.child;if(this.child=e,this._settled=!1,n){const l=n.getPose();n.complete(),e.matchInto(l)}e.playbackRate=this.playbackRate;const r=e.onComplete;e.onComplete=()=>{r==null||r(),this.child===e&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const u=e.onUpdate;e.onUpdate=l=>{var d;u==null||u(l),(d=this.onUpdate)==null||d.call(this,l),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 It=(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"},mt=new Set(["auto","scroll","overlay"]),Ht=t=>{let s=t.parentElement;for(;s&&s!==document.body;){const e=window.getComputedStyle(s);if(mt.has(e.overflowY)||mt.has(e.overflowX))return s;s=s.parentElement}return document.documentElement},Wt=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 zt(t){const s=Object.keys(t);return Promise.all(s.map(e=>t[e])).then(e=>{const n={};return s.forEach((r,u)=>{n[r]=e[u]}),n})}function Bt(t){const s=t.filter(e=>e.symmetric).map(e=>({from:e.to,to:e.from,transition:e.transition}));return[...t,...s]}const Ft=1e6,gt=100,Kt=10;function Xt(t){const s=t.trim(),e=s.indexOf("#"),n=s.indexOf("?"),r=[e,n].filter(u=>u>=0).reduce((u,l)=>Math.min(u,l),s.length);return s.slice(0,r)}function at(t){const s=Xt(t);try{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(s))return at(new URL(s).pathname)}catch{}const n=(s.startsWith("/")?s:`/${s}`).replace(/\/+/g,"/");return(n.length>1?n.replace(/\/+$/g,""):n)||"/"}function $t(t){const s=t.trim();return s==="*"?"*":at(s)}function ot(t){return t==="/"?[]:t.slice(1).split("/")}function qt(t){return t.startsWith(":")||t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}")}function rt(t,s){const e=at(t),n=$t(s);if(n==="*")return{matched:!0,specificity:0};if(e===n)return{matched:!0,specificity:Ft+ot(n).length*gt};const r=ot(e),u=ot(n);let l=0;for(let d=0;d<u.length;d++){const y=u[d],M=r[d],R=d===u.length-1;if(y===void 0)return{matched:!1,specificity:0};if((y==="*"||y==="**")&&R)return{matched:y==="**"?r.length>=d:r.length>d,specificity:l};if(M===void 0)return{matched:!1,specificity:0};if(y==="*"||qt(y)){l+=Kt;continue}if(y!==M)return{matched:!1,specificity:0};l+=gt}return{matched:r.length===u.length,specificity:l}}function Ut(t,s){return rt(t,s).matched}function Vt(t,s,e){let n;for(const r of e){const u=rt(t,r.from);if(!u.matched)continue;const l=rt(s,r.to);if(!l.matched)continue;const d=u.specificity+l.specificity;(!n||d>n.specificity)&&(n={transition:r.transition,specificity:d})}return(n==null?void 0:n.transition)??null}const Gt=768,Yt=10,Zt=10;function jt(t={}){const{preserveScroll:s=f=>f}=t,e=typeof s=="function"?s:()=>s;let n=null,r=!1,u=!1;const l=()=>{const f=(n==null?void 0:n.clientWidth)??0,a=f>0?f:typeof window<"u"?window.innerWidth:0;return a>0&&a<Gt},d=()=>(u||(r=l(),u=!0),r),y=f=>{var S;const a=e(d());if(a===!1)return{preserves:!1,shared:!1,storageKey:`path:${f}`};if(a===!0)return{preserves:!0,shared:!1,storageKey:`path:${f}`};const v=((S=a.exclude)==null?void 0:S.some(w=>Ut(f,w)))??!1,T=!v&&!!a.key;return{preserves:!v,shared:T,storageKey:T?`shared:${a.key}`:`path:${f}`}},M=f=>y(f).preserves;let R=null;const b=new Map;let x=null,O=!1,I=0;const H=()=>{n&&x&&!O&&b.set(y(x).storageKey,{x:n.scrollLeft,y:n.scrollTop})},K=f=>{if(!n)return;const a=y(f);if(a.preserves&&a.shared&&!b.has(a.storageKey))return;const v=a.preserves&&b.has(a.storageKey)?b.get(a.storageKey):{x:0,y:0};let T=0;const S=()=>{if(!n)return;n.scrollTo({top:v.y,left:v.x}),!(Math.abs(n.scrollTop-v.y)<1&&Math.abs(n.scrollLeft-v.x)<1)&&T<Yt&&(T++,requestAnimationFrame(S))};requestAnimationFrame(S)};return{initializeContext:(f,a)=>{O=!0;const v=++I;R=f,n||(n=Ht(f),r=l(),u=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{r=l()}).observe(n),(n===document.documentElement?window:n).addEventListener("scroll",H,{passive:!0})),x=a,K(a);let T=0;const S=()=>{v===I&&(T++,T>=Zt?O=!1:requestAnimationFrame(S))};requestAnimationFrame(S)},calculateScrollOffset:(f,a)=>{const v=f?y(f).storageKey:null,T=v&&b.has(v)?b.get(v):{x:0,y:0},S=a?y(a):null,w=S!=null&&S.preserves?S.storageKey:null,k=w&&b.has(w)?b.get(w):{x:0,y:0};return{x:-k.x+T.x,y:-k.y+T.y}},evictScrollPosition:f=>{b.delete(y(f).storageKey)},shouldPreserve:M,getScrollContainer:()=>n,getPositionedParentElement:()=>R?Wt(R):document.body,getScrollPosition:f=>{const a=f?y(f).storageKey:null;return a&&b.has(a)?b.get(a):{x:0,y:0}},getIsMobile:d}}const vt=30,bt=8,St=1.2,Et=30,Qt=600;function Jt(){let t=null,s=!1,e=!1,n=null,r=null,u=!1;const l=(h,p)=>{for(let m=0;m<h.length;m++){const E=h.item(m);if(E&&E.identifier===p)return E}return null},d=()=>{n!==null&&(clearTimeout(n),n=null)},y=()=>{r!==null&&(clearTimeout(r),r=null)},M=()=>{s=!0,e=!0,d(),y(),n=setTimeout(()=>{s=!1,e=!1,n=null},Qt)},R=h=>{if(h.touches.length!==1){t=null;return}const p=h.touches.item(0);if(!p){t=null;return}const m=window.innerWidth,E=p.clientX<=vt,L=p.clientX>=m-vt;if(!E&&!L){t=null;return}t={identifier:p.identifier,startX:p.clientX,startY:p.clientY,fromLeftEdge:E,moved:!1}},b=h=>{if(!t)return;if(h.touches.length!==1){t=null;return}const p=l(h.touches,t.identifier);if(!p){t=null;return}const m=p.clientX-t.startX,E=p.clientY-t.startY,L=Math.abs(m),f=Math.abs(E);if(f>bt&&f>L*St){t=null;return}const a=t.fromLeftEdge?m>0:m<0;L>bt&&L>f*St&&a&&(t.moved=!0)},x=h=>{if(!t)return;const p=l(h.changedTouches,t.identifier);if(!p){t=null;return}const m=p.clientX-t.startX,E=t.fromLeftEdge?m>0:m<0;if(t.moved&&E&&Math.abs(m)>=Et){M(),t=null;return}t.moved&&Math.abs(m)>=Et&&M(),t=null},O=()=>{t&&(t.moved&&M(),t=null)};return{initialize:()=>{if(typeof window>"u"||u)return;u=!0;const h={passive:!0,capture:!0};window.addEventListener("touchstart",R,h),window.addEventListener("touchmove",b,h),window.addEventListener("touchend",x,h),window.addEventListener("touchcancel",O,h)},destroy:()=>{if(typeof window>"u"||!u)return;u=!1;const h={capture:!0};window.removeEventListener("touchstart",R,h),window.removeEventListener("touchmove",b,h),window.removeEventListener("touchend",x,h),window.removeEventListener("touchcancel",O,h),d(),y(),t=null,s=!1,e=!1},isSwipeBack:()=>{const h=s||e;return h&&d(),h},onPageEnter:()=>{s=!1,d(),y(),r=setTimeout(()=>{e=!1,r=null},0)}}}function te(){let t=null;function s(){var n,r;t&&((n=t.outResolve)==null||n.call(t,null),(r=t.inResolve)==null||r.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,r){var l;r==="out"&&(t==null?void 0:t.to)===n&&!t.from&&((l=t.inResolve)==null||l.call(t,null),t={}),t&&(r==="out"&&t.from&&t.from!==n||r==="in"&&t.to&&t.to!==n)&&s(),t||(t={}),r==="out"?t.from=n:t.to=n},get(n){return new Promise(r=>{t||(t={}),n==="out"?t.outResolve=r:t.inResolve=r,e()})}}}const F=new Map;let G=null,Tt=!1;function At(t,s){if(t instanceof HTMLElement&&F.has(t)&&!t.isConnected){const e=F.get(t);F.delete(t),queueMicrotask(()=>e(s))}for(const e of Array.from(t.childNodes))At(e,s)}function ee(){if(Tt||typeof document>"u")return;Tt=!0,G=new MutationObserver(s=>{for(const e of s){const n={parent:e.target,nextSibling:e.nextSibling};for(const r of Array.from(e.removedNodes))At(r,n)}});const t=()=>{G==null||G.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function ne(t,s){return ee(),F.set(t,s),()=>{F.delete(t)}}const ct=new WeakMap;let Y=null;const Z="none !important";function B(t){const s=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${s} !important`:s}function se(){return Y||(Y=new MutationObserver(t=>{for(const s of t){const e=s.target,n=ct.get(e);if(!n)continue;const r=B(e);r!==n.accounted&&(n.accounted=r,r===Z?(n.reactHidden=!0,n.onHide()):r!=="none"&&n.reactHidden&&(n.reactHidden=!1,n.onShow()))}}),Y)}function ie(t,s){const e=B(t),n={accounted:e,reactHidden:e===Z,onHide:s.onHide,onShow:s.onShow};return ct.set(t,n),se().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return B(t)===Z},setDisplay(r,u=!1){r===null?t.style.removeProperty("display"):t.style.setProperty("display",r,u?"important":""),n.accounted=B(t)},sync(){n.accounted=B(t),n.reactHidden=n.accounted===Z},stop(){ct.delete(t)}}}function oe(t){return Array.isArray(t)}function Mt(t){const s=[];for(const e of t)oe(e)?s.push(...Mt(e)):s.push(e);return s}function re(t,s={}){const{transitions:e=[],middleware:n=(i,o)=>({from:i,to:o}),preserveScroll:r=i=>i}=t,u=s.host??new Pt,l=te(),d=typeof e=="function"?e:()=>e,y=Jt();y.initialize();const{initializeContext:M,calculateScrollOffset:R,evictScrollPosition:b,shouldPreserve:x,getScrollContainer:O,getPositionedParentElement:I,getScrollPosition:H,getIsMobile:K}=jt({preserveScroll:r}),X=new Map,h=()=>{const i=K();let o=X.get(i);return o||(o=Bt(Mt(d({isMobile:i}))),X.set(i,o)),o};let p=null,m=null;const E=new WeakMap,L=i=>{E.set(i,{parent:i.parentNode,nextSibling:i.nextSibling})},f=i=>{const o=E.get(i);return o||{parent:i.parentNode,nextSibling:i.nextSibling}},a=new WeakMap,v=new WeakMap;let T=0;const S=i=>{const o=typeof getComputedStyle<"u"?getComputedStyle(i).display:"";return o&&o!=="none"?o:"block"},w=(i,o)=>{o.visibleDisplay=i.style.getPropertyValue("display"),o.computedDisplay=S(i)},k=(i,o)=>{if(v.get(i)!==o)return;v.delete(i);const c=a.get(i);c&&(c.savedCss!==null&&(i.style.cssText=c.savedCss,c.savedCss=null),c.intent==="hidden"?c.vis.setDisplay("none",!0):c.visibleDisplay?(c.vis.setDisplay(c.visibleDisplay,!1),w(i,c)):(c.vis.setDisplay(null),w(i,c)))},Ct=(i,o,c,g,P)=>{const A=g.element,_=P.element,D=(g.mode??"unmount")==="hidden",{parent:q,nextSibling:J}=g.parent?{parent:g.parent,nextSibling:g.nextSibling}:f(A),U=R(o,c),tt={scrollOffset:U,from:{scroll:H(o)},to:{scroll:H(c)},get scrollingElement(){return O()||document.documentElement},get positionedParent(){return I()}};let C;if(D){C=A,C.style.top=`${-1*((U==null?void 0:U.y)??0)}px`;const N=a.get(_);N&&N.savedCss===null&&(N.savedCss=_.style.cssText)}else C=A,It(C,tt);x(o)||b(o);const V=D?++T:0;D&&(v.set(_,V),v.set(A,V));const ht=Promise.resolve(C),pt=Promise.resolve(_),yt=[],_t={from:ht,to:pt,context:tt,createElement:((N,et="div")=>{const W=document.createElement(et);return W.setAttribute("data-ssgoi-id",N),yt.push(W),W})},Dt=Promise.resolve(i.prepare?i.prepare(_t):{});zt({from:ht,to:pt,extras:Dt}).then(({from:N,to:et,extras:W})=>{!D&&q&&(J&&q.contains(J)?q.insertBefore(C,J):q.appendChild(C));const nt=i.animation({from:N,to:et,context:tt,...W}),st=nt.onComplete;nt.onComplete=()=>{st==null||st(),D?(k(A,V),k(_,V)):C.parentNode&&C.parentNode.removeChild(C);for(const it of yt)it.parentNode&&it.parentNode.removeChild(it)},u.attach(nt)})},$=(i,o)=>{const c=y.isSwipeBack();l.trigger(i,o),l.get(o).then(g=>{if(o==="in"&&y.onPageEnter(),!g)return;if(c){o==="out"&&g.from&&!x(g.from)&&b(g.from),p=null,m=null;return}if(o!=="in")return;const{from:P,to:A}=n(g.from,g.to),_=Vt(P,A,h()),Q=p,D=m;p=null,m=null,!(!_||!Q||!D)&&Ct(_,P,A,Q,D)})},xt=(i,o)=>{const c=a.get(i);if(!c)return;const g=c.intent==="hidden";if(c.intent="hidden",c.savedCss===null&&(c.savedCss=i.style.cssText),c.vis.setDisplay(c.computedDisplay||"block",!0),i.style.position="absolute",i.style.width="100%",i.style.left="0",g)return;const P=f(i);p={element:i,parent:P.parent,nextSibling:P.nextSibling,mode:"hidden"};const A=i.getAttribute("data-ssgoi-transition")??o;$(A,"out")},Ot=(i,o)=>{const c=a.get(i);if(!c||c.intent==="visible")return;c.intent="visible",w(i,c),c.savedCss!==null&&(i.style.cssText=c.savedCss,c.visibleDisplay?c.vis.setDisplay(c.visibleDisplay,!1):c.vis.setDisplay(null)),M(i,o),m={element:i,parent:i.parentElement,nextSibling:i.nextElementSibling};const g=i.getAttribute("data-ssgoi-transition")??o;$(g,"in")},Lt=(i,o,c)=>{const g=a.get(i);if(g&&(g.vis.stop(),a.delete(i),v.delete(i),g.intent==="hidden")){(p==null?void 0:p.element)===i&&(p=null),(m==null?void 0:m.element)===i&&(m=null);return}const P=c??f(i);p={element:i,parent:P.parent,nextSibling:P.nextSibling,mode:"unmount"};const A=i.getAttribute("data-ssgoi-transition")??o;$(A,"out")},ut=new WeakSet,dt=(i,o)=>{if(ut.has(o))return;ut.add(o),L(o);const c=ie(o,{onHide:()=>xt(o,i),onShow:()=>Ot(o,i)}),g={vis:c,savedCss:null,intent:c.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block"};a.set(o,g),c.isHidden||(w(o,g),M(o,i),m={element:o,parent:o.parentElement,nextSibling:o.nextElementSibling},$(i,"in")),ne(o,P=>Lt(o,i,P))},ft=new Map;return{register:dt,refFor:i=>{let o=ft.get(i);return o||(o=c=>{c&&dt(i,c)},ft.set(i,o)),o}}}const Rt="data-ssgoi-root",ce=`[${Rt}]`,lt="data-ssgoi-transition",wt=`[${lt}]`,le="[data-ssgoi-clone]";function ae(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function ue(t){return t.nodeType===Node.ELEMENT_NODE}function de(t){return t instanceof HTMLElement}function fe(t,s){if(!ae())return()=>{};t.setAttribute(Rt,"");const e=l=>l.closest(ce)===t,n=l=>{if(!de(l)||!e(l)||l.closest(le))return;const d=l.getAttribute(lt);d!==null&&s.register(d,l)},r=l=>{if(ue(l)){l.matches(wt)&&n(l);for(const d of l.querySelectorAll(wt))n(d)}},u=new MutationObserver(l=>{for(const d of l){if(d.type==="attributes"){n(d.target);continue}for(const y of d.addedNodes)r(y)}});return u.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[lt]}),r(t),()=>u.disconnect()}exports.Animation=j.Animation;exports.MultiAnimation=j.MultiAnimation;exports.WebAnimation=j.WebAnimation;exports.HostAnimation=Pt;exports.createSggoiTransitionContext=re;exports.observeSsgoiTransitions=fe;
package/dist/internal.js CHANGED
@@ -1,31 +1,31 @@
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
- var F = (t, s, e) => Lt(t, typeof s != "symbol" ? s + "" : s, e);
4
- import { A as Ot } from "./multi-animation-Ch5rI3rB.js";
5
- import { M as ue, W as de } from "./multi-animation-Ch5rI3rB.js";
6
- class _t extends Ot {
1
+ var _t = Object.defineProperty;
2
+ var Dt = (t, s, e) => s in t ? _t(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
+ var z = (t, s, e) => Dt(t, typeof s != "symbol" ? s + "" : s, e);
4
+ import { A as Nt } from "./multi-animation-Ch5rI3rB.js";
5
+ import { M as be, W as Se } from "./multi-animation-Ch5rI3rB.js";
6
+ class kt extends Nt {
7
7
  constructor() {
8
8
  super(...arguments);
9
- F(this, "child", null);
10
- F(this, "_state", "idle");
11
- F(this, "_settled", !1);
12
- F(this, "listeners", /* @__PURE__ */ new Set());
9
+ z(this, "child", null);
10
+ z(this, "_state", "idle");
11
+ z(this, "_settled", !1);
12
+ z(this, "listeners", /* @__PURE__ */ new Set());
13
13
  }
14
14
  attach(e) {
15
15
  const n = this.child;
16
16
  if (this.child = e, this._settled = !1, n) {
17
- const a = n.getPose();
18
- n.complete(), e.matchInto(a);
17
+ const l = n.getPose();
18
+ n.complete(), e.matchInto(l);
19
19
  }
20
20
  e.playbackRate = this.playbackRate;
21
- const l = e.onComplete;
21
+ const r = e.onComplete;
22
22
  e.onComplete = () => {
23
- l == null || l(), this.child === e && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
23
+ r == null || r(), this.child === e && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
24
24
  };
25
- const p = e.onUpdate;
26
- e.onUpdate = (a) => {
27
- var g;
28
- p == null || p(a), (g = this.onUpdate) == null || g.call(this, a), this.notify();
25
+ const u = e.onUpdate;
26
+ e.onUpdate = (l) => {
27
+ var d;
28
+ u == null || u(l), (d = this.onUpdate) == null || d.call(this, l), 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() {
@@ -98,19 +98,19 @@ class _t extends Ot {
98
98
  for (const e of this.listeners) e();
99
99
  }
100
100
  }
101
- const kt = (t, s) => {
101
+ const It = (t, s) => {
102
102
  var e;
103
103
  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";
104
- }, ht = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), Dt = (t) => {
104
+ }, yt = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), Ht = (t) => {
105
105
  let s = t.parentElement;
106
106
  for (; s && s !== document.body; ) {
107
107
  const e = window.getComputedStyle(s);
108
- if (ht.has(e.overflowY) || ht.has(e.overflowX))
108
+ if (yt.has(e.overflowY) || yt.has(e.overflowX))
109
109
  return s;
110
110
  s = s.parentElement;
111
111
  }
112
112
  return document.documentElement;
113
- }, Nt = (t) => {
113
+ }, Wt = (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 Ht(t) {
123
+ function zt(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, p) => {
128
- n[l] = e[p];
127
+ return s.forEach((r, u) => {
128
+ n[r] = e[u];
129
129
  }), n;
130
130
  });
131
131
  }
132
- function It(t) {
132
+ function Bt(t) {
133
133
  const s = t.filter((e) => e.symmetric).map((e) => ({
134
134
  from: e.to,
135
135
  to: e.from,
@@ -137,203 +137,260 @@ function It(t) {
137
137
  }));
138
138
  return [...t, ...s];
139
139
  }
140
- function K(t, s) {
141
- if (s === "*")
142
- return !0;
143
- if (s.endsWith("/*")) {
144
- const e = s.slice(0, -1);
145
- return t.startsWith(e) && t.length > e.length;
140
+ const Ft = 1e6, mt = 100, Kt = 10;
141
+ function Xt(t) {
142
+ const s = t.trim(), e = s.indexOf("#"), n = s.indexOf("?"), r = [e, n].filter((u) => u >= 0).reduce((u, l) => Math.min(u, l), s.length);
143
+ return s.slice(0, r);
144
+ }
145
+ function lt(t) {
146
+ const s = Xt(t);
147
+ try {
148
+ if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(s))
149
+ return lt(new URL(s).pathname);
150
+ } catch {
151
+ }
152
+ const n = (s.startsWith("/") ? s : `/${s}`).replace(/\/+/g, "/");
153
+ return (n.length > 1 ? n.replace(/\/+$/g, "") : n) || "/";
154
+ }
155
+ function $t(t) {
156
+ const s = t.trim();
157
+ return s === "*" ? "*" : lt(s);
158
+ }
159
+ function it(t) {
160
+ return t === "/" ? [] : t.slice(1).split("/");
161
+ }
162
+ function Ut(t) {
163
+ return t.startsWith(":") || t.startsWith("[") && t.endsWith("]") || t.startsWith("{") && t.endsWith("}");
164
+ }
165
+ function ot(t, s) {
166
+ const e = lt(t), n = $t(s);
167
+ if (n === "*")
168
+ return { matched: !0, specificity: 0 };
169
+ if (e === n)
170
+ return {
171
+ matched: !0,
172
+ specificity: Ft + it(n).length * mt
173
+ };
174
+ const r = it(e), u = it(n);
175
+ let l = 0;
176
+ for (let d = 0; d < u.length; d++) {
177
+ const y = u[d], R = r[d], A = d === u.length - 1;
178
+ if (y === void 0)
179
+ return { matched: !1, specificity: 0 };
180
+ if ((y === "*" || y === "**") && A)
181
+ return {
182
+ matched: y === "**" ? r.length >= d : r.length > d,
183
+ specificity: l
184
+ };
185
+ if (R === void 0)
186
+ return { matched: !1, specificity: 0 };
187
+ if (y === "*" || Ut(y)) {
188
+ l += Kt;
189
+ continue;
190
+ }
191
+ if (y !== R)
192
+ return { matched: !1, specificity: 0 };
193
+ l += mt;
146
194
  }
147
- return t === s;
195
+ return {
196
+ matched: r.length === u.length,
197
+ specificity: l
198
+ };
199
+ }
200
+ function qt(t, s) {
201
+ return ot(t, s).matched;
148
202
  }
149
- function Wt(t, s, e) {
150
- for (const n of e)
151
- if (K(t, n.from) && K(s, n.to))
152
- return n.transition;
153
- for (const n of e)
154
- if ((n.from === "*" || K(t, n.from)) && (n.to === "*" || K(s, n.to)))
155
- return n.transition;
156
- return null;
203
+ function Vt(t, s, e) {
204
+ let n;
205
+ for (const r of e) {
206
+ const u = ot(t, r.from);
207
+ if (!u.matched) continue;
208
+ const l = ot(s, r.to);
209
+ if (!l.matched) continue;
210
+ const d = u.specificity + l.specificity;
211
+ (!n || d > n.specificity) && (n = { transition: r.transition, specificity: d });
212
+ }
213
+ return (n == null ? void 0 : n.transition) ?? null;
157
214
  }
158
- const Ft = 768, Kt = 10, Bt = 10;
159
- function Xt(t = {}) {
160
- const { preserveScroll: s = (u) => u } = t, e = typeof s == "function" ? s : () => s;
161
- let n = null, l = !1, p = !1;
162
- const a = () => {
163
- const u = (n == null ? void 0 : n.clientWidth) ?? 0, c = u > 0 ? u : typeof window < "u" ? window.innerWidth : 0;
164
- return c > 0 && c < Ft;
165
- }, g = () => (p || (l = a(), p = !0), l), v = (u) => {
166
- var E;
167
- const c = e(g());
168
- if (c === !1)
169
- return { preserves: !1, shared: !1, storageKey: `path:${u}` };
170
- if (c === !0)
171
- return { preserves: !0, shared: !1, storageKey: `path:${u}` };
172
- const m = ((E = c.exclude) == null ? void 0 : E.some((T) => K(u, T))) ?? !1, S = !m && !!c.key;
215
+ const Gt = 768, Yt = 10, Zt = 10;
216
+ function Qt(t = {}) {
217
+ const { preserveScroll: s = (f) => f } = t, e = typeof s == "function" ? s : () => s;
218
+ let n = null, r = !1, u = !1;
219
+ const l = () => {
220
+ const f = (n == null ? void 0 : n.clientWidth) ?? 0, a = f > 0 ? f : typeof window < "u" ? window.innerWidth : 0;
221
+ return a > 0 && a < Gt;
222
+ }, d = () => (u || (r = l(), u = !0), r), y = (f) => {
223
+ var S;
224
+ const a = e(d());
225
+ if (a === !1)
226
+ return { preserves: !1, shared: !1, storageKey: `path:${f}` };
227
+ if (a === !0)
228
+ return { preserves: !0, shared: !1, storageKey: `path:${f}` };
229
+ const v = ((S = a.exclude) == null ? void 0 : S.some((T) => qt(f, T))) ?? !1, w = !v && !!a.key;
173
230
  return {
174
- preserves: !m,
175
- shared: S,
176
- storageKey: S ? `shared:${c.key}` : `path:${u}`
231
+ preserves: !v,
232
+ shared: w,
233
+ storageKey: w ? `shared:${a.key}` : `path:${f}`
177
234
  };
178
- }, A = (u) => v(u).preserves;
179
- let C = null;
235
+ }, R = (f) => y(f).preserves;
236
+ let A = null;
180
237
  const b = /* @__PURE__ */ new Map();
181
- let x = null, L = !1, H = 0;
182
- const I = () => {
183
- n && x && !L && b.set(v(x).storageKey, {
238
+ let x = null, L = !1, I = 0;
239
+ const H = () => {
240
+ n && x && !L && b.set(y(x).storageKey, {
184
241
  x: n.scrollLeft,
185
242
  y: n.scrollTop
186
243
  });
187
- }, z = (u) => {
244
+ }, K = (f) => {
188
245
  if (!n) return;
189
- const c = v(u);
190
- if (c.preserves && c.shared && !b.has(c.storageKey))
246
+ const a = y(f);
247
+ if (a.preserves && a.shared && !b.has(a.storageKey))
191
248
  return;
192
- const m = c.preserves && b.has(c.storageKey) ? b.get(c.storageKey) : { x: 0, y: 0 };
193
- let S = 0;
194
- const E = () => {
249
+ const v = a.preserves && b.has(a.storageKey) ? b.get(a.storageKey) : { x: 0, y: 0 };
250
+ let w = 0;
251
+ const S = () => {
195
252
  if (!n) return;
196
253
  n.scrollTo({
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));
254
+ top: v.y,
255
+ left: v.x
256
+ }), !(Math.abs(n.scrollTop - v.y) < 1 && Math.abs(n.scrollLeft - v.x) < 1) && w < Yt && (w++, requestAnimationFrame(S));
200
257
  };
201
- requestAnimationFrame(E);
258
+ requestAnimationFrame(S);
202
259
  };
203
260
  return {
204
- initializeContext: (u, c) => {
261
+ initializeContext: (f, a) => {
205
262
  L = !0;
206
- const m = ++H;
207
- C = u, n || (n = Dt(u), l = a(), p = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
208
- l = a();
209
- }).observe(n), (n === document.documentElement ? window : n).addEventListener("scroll", I, {
263
+ const v = ++I;
264
+ A = f, n || (n = Ht(f), r = l(), u = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
265
+ r = l();
266
+ }).observe(n), (n === document.documentElement ? window : n).addEventListener("scroll", H, {
210
267
  passive: !0
211
- })), x = c, z(c);
212
- let S = 0;
213
- const E = () => {
214
- m === H && (S++, S >= Bt ? L = !1 : requestAnimationFrame(E));
268
+ })), x = a, K(a);
269
+ let w = 0;
270
+ const S = () => {
271
+ v === I && (w++, w >= Zt ? L = !1 : requestAnimationFrame(S));
215
272
  };
216
- requestAnimationFrame(E);
273
+ requestAnimationFrame(S);
217
274
  },
218
- calculateScrollOffset: (u, c) => {
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 };
275
+ calculateScrollOffset: (f, a) => {
276
+ const v = f ? y(f).storageKey : null, w = v && b.has(v) ? b.get(v) : { x: 0, y: 0 }, S = a ? y(a) : null, T = S != null && S.preserves ? S.storageKey : null, k = T && b.has(T) ? b.get(T) : { x: 0, y: 0 };
220
277
  return {
221
- x: -N.x + S.x,
222
- y: -N.y + S.y
278
+ x: -k.x + w.x,
279
+ y: -k.y + w.y
223
280
  };
224
281
  },
225
- evictScrollPosition: (u) => {
226
- b.delete(v(u).storageKey);
282
+ evictScrollPosition: (f) => {
283
+ b.delete(y(f).storageKey);
227
284
  },
228
- shouldPreserve: A,
285
+ shouldPreserve: R,
229
286
  getScrollContainer: () => n,
230
- getPositionedParentElement: () => C ? Nt(C) : document.body,
231
- getScrollPosition: (u) => {
232
- const c = u ? v(u).storageKey : null;
233
- return c && b.has(c) ? b.get(c) : { x: 0, y: 0 };
287
+ getPositionedParentElement: () => A ? Wt(A) : document.body,
288
+ getScrollPosition: (f) => {
289
+ const a = f ? y(f).storageKey : null;
290
+ return a && b.has(a) ? b.get(a) : { x: 0, y: 0 };
234
291
  },
235
292
  // Same measurement that drives `preserveScroll`'s `isMobile`, exposed so a
236
293
  // functional `transitions` config can branch on it too.
237
- getIsMobile: g
294
+ getIsMobile: d
238
295
  };
239
296
  }
240
- const yt = 30, pt = 8, gt = 1.2, mt = 30, zt = 600;
241
- function $t() {
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;
297
+ const gt = 30, vt = 8, bt = 1.2, St = 30, jt = 600;
298
+ function Jt() {
299
+ let t = null, s = !1, e = !1, n = null, r = null, u = !1;
300
+ const l = (h, p) => {
301
+ for (let m = 0; m < h.length; m++) {
302
+ const E = h.item(m);
303
+ if (E && E.identifier === p) return E;
247
304
  }
248
305
  return null;
249
- }, g = () => {
306
+ }, d = () => {
250
307
  n !== null && (clearTimeout(n), n = null);
251
- }, v = () => {
252
- l !== null && (clearTimeout(l), l = null);
253
- }, A = () => {
254
- s = !0, e = !0, g(), v(), n = setTimeout(() => {
308
+ }, y = () => {
309
+ r !== null && (clearTimeout(r), r = null);
310
+ }, R = () => {
311
+ s = !0, e = !0, d(), y(), n = setTimeout(() => {
255
312
  s = !1, e = !1, n = null;
256
- }, zt);
257
- }, C = (d) => {
258
- if (d.touches.length !== 1) {
313
+ }, jt);
314
+ }, A = (h) => {
315
+ if (h.touches.length !== 1) {
259
316
  t = null;
260
317
  return;
261
318
  }
262
- const f = d.touches.item(0);
263
- if (!f) {
319
+ const p = h.touches.item(0);
320
+ if (!p) {
264
321
  t = null;
265
322
  return;
266
323
  }
267
- const h = window.innerWidth, w = f.clientX <= yt, O = f.clientX >= h - yt;
268
- if (!w && !O) {
324
+ const m = window.innerWidth, E = p.clientX <= gt, O = p.clientX >= m - gt;
325
+ if (!E && !O) {
269
326
  t = null;
270
327
  return;
271
328
  }
272
329
  t = {
273
- identifier: f.identifier,
274
- startX: f.clientX,
275
- startY: f.clientY,
276
- fromLeftEdge: w,
330
+ identifier: p.identifier,
331
+ startX: p.clientX,
332
+ startY: p.clientY,
333
+ fromLeftEdge: E,
277
334
  moved: !1
278
335
  };
279
- }, b = (d) => {
336
+ }, b = (h) => {
280
337
  if (!t) return;
281
- if (d.touches.length !== 1) {
338
+ if (h.touches.length !== 1) {
282
339
  t = null;
283
340
  return;
284
341
  }
285
- const f = a(d.touches, t.identifier);
286
- if (!f) {
342
+ const p = l(h.touches, t.identifier);
343
+ if (!p) {
287
344
  t = null;
288
345
  return;
289
346
  }
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) {
347
+ const m = p.clientX - t.startX, E = p.clientY - t.startY, O = Math.abs(m), f = Math.abs(E);
348
+ if (f > vt && f > O * bt) {
292
349
  t = null;
293
350
  return;
294
351
  }
295
- const c = t.fromLeftEdge ? h > 0 : h < 0;
296
- O > pt && O > u * gt && c && (t.moved = !0);
297
- }, x = (d) => {
352
+ const a = t.fromLeftEdge ? m > 0 : m < 0;
353
+ O > vt && O > f * bt && a && (t.moved = !0);
354
+ }, x = (h) => {
298
355
  if (!t) return;
299
- const f = a(d.changedTouches, t.identifier);
300
- if (!f) {
356
+ const p = l(h.changedTouches, t.identifier);
357
+ if (!p) {
301
358
  t = null;
302
359
  return;
303
360
  }
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;
361
+ const m = p.clientX - t.startX, E = t.fromLeftEdge ? m > 0 : m < 0;
362
+ if (t.moved && E && Math.abs(m) >= St) {
363
+ R(), t = null;
307
364
  return;
308
365
  }
309
- t.moved && Math.abs(h) >= mt && A(), t = null;
366
+ t.moved && Math.abs(m) >= St && R(), t = null;
310
367
  }, L = () => {
311
- t && (t.moved && A(), t = null);
368
+ t && (t.moved && R(), t = null);
312
369
  };
313
370
  return { initialize: () => {
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);
371
+ if (typeof window > "u" || u) return;
372
+ u = !0;
373
+ const h = { passive: !0, capture: !0 };
374
+ window.addEventListener("touchstart", A, h), window.addEventListener("touchmove", b, h), window.addEventListener("touchend", x, h), window.addEventListener("touchcancel", L, h);
318
375
  }, destroy: () => {
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;
376
+ if (typeof window > "u" || !u) return;
377
+ u = !1;
378
+ const h = { capture: !0 };
379
+ window.removeEventListener("touchstart", A, h), window.removeEventListener("touchmove", b, h), window.removeEventListener("touchend", x, h), window.removeEventListener("touchcancel", L, h), d(), y(), t = null, s = !1, e = !1;
323
380
  }, isSwipeBack: () => {
324
- const d = s || e;
325
- return d && g(), d;
381
+ const h = s || e;
382
+ return h && d(), h;
326
383
  }, onPageEnter: () => {
327
- s = !1, g(), v(), l = setTimeout(() => {
328
- e = !1, l = null;
384
+ s = !1, d(), y(), r = setTimeout(() => {
385
+ e = !1, r = null;
329
386
  }, 0);
330
387
  } };
331
388
  }
332
- function Vt() {
389
+ function te() {
333
390
  let t = null;
334
391
  function s() {
335
- var n, l;
336
- t && ((n = t.outResolve) == null || n.call(t, null), (l = t.inResolve) == null || l.call(t, null), t = null);
392
+ var n, r;
393
+ t && ((n = t.outResolve) == null || n.call(t, null), (r = t.inResolve) == null || r.call(t, null), t = null);
337
394
  }
338
395
  function e() {
339
396
  if (t != null && t.from && (t != null && t.to) && (t != null && t.outResolve) && (t != null && t.inResolve)) {
@@ -346,37 +403,37 @@ function Vt() {
346
403
  }
347
404
  }
348
405
  return {
349
- trigger(n, l) {
350
- var a;
351
- 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;
406
+ trigger(n, r) {
407
+ var l;
408
+ r === "out" && (t == null ? void 0 : t.to) === n && !t.from && ((l = t.inResolve) == null || l.call(t, null), t = {}), t && (r === "out" && t.from && t.from !== n || r === "in" && t.to && t.to !== n) && s(), t || (t = {}), r === "out" ? t.from = n : t.to = n;
352
409
  },
353
410
  get(n) {
354
- return new Promise((l) => {
355
- t || (t = {}), n === "out" ? t.outResolve = l : t.inResolve = l, e();
411
+ return new Promise((r) => {
412
+ t || (t = {}), n === "out" ? t.outResolve = r : t.inResolve = r, e();
356
413
  });
357
414
  }
358
415
  };
359
416
  }
360
- const X = /* @__PURE__ */ new Map();
361
- let G = null, vt = !1;
362
- function Et(t, s) {
363
- if (t instanceof HTMLElement && X.has(t) && !t.isConnected) {
364
- const e = X.get(t);
365
- X.delete(t), queueMicrotask(() => e(s));
417
+ const F = /* @__PURE__ */ new Map();
418
+ let G = null, Et = !1;
419
+ function Tt(t, s) {
420
+ if (t instanceof HTMLElement && F.has(t) && !t.isConnected) {
421
+ const e = F.get(t);
422
+ F.delete(t), queueMicrotask(() => e(s));
366
423
  }
367
424
  for (const e of Array.from(t.childNodes))
368
- Et(e, s);
425
+ Tt(e, s);
369
426
  }
370
- function qt() {
371
- if (vt || typeof document > "u") return;
372
- vt = !0, G = new MutationObserver((s) => {
427
+ function ee() {
428
+ if (Et || typeof document > "u") return;
429
+ Et = !0, G = new MutationObserver((s) => {
373
430
  for (const e of s) {
374
431
  const n = {
375
432
  parent: e.target,
376
433
  nextSibling: e.nextSibling
377
434
  };
378
- for (const l of Array.from(e.removedNodes))
379
- Et(l, n);
435
+ for (const r of Array.from(e.removedNodes))
436
+ Tt(r, n);
380
437
  }
381
438
  });
382
439
  const t = () => {
@@ -384,295 +441,295 @@ function qt() {
384
441
  };
385
442
  document.body ? t() : document.addEventListener("DOMContentLoaded", t, { once: !0 });
386
443
  }
387
- function Ut(t, s) {
388
- return qt(), X.set(t, s), () => {
389
- X.delete(t);
444
+ function ne(t, s) {
445
+ return ee(), F.set(t, s), () => {
446
+ F.delete(t);
390
447
  };
391
448
  }
392
- const it = /* @__PURE__ */ new WeakMap();
393
- let Z = null;
394
- const j = "none !important";
449
+ const rt = /* @__PURE__ */ new WeakMap();
450
+ let Y = null;
451
+ const Z = "none !important";
395
452
  function B(t) {
396
453
  const s = t.style.getPropertyValue("display");
397
454
  return t.style.getPropertyPriority("display") ? `${s} !important` : s;
398
455
  }
399
- function Yt() {
400
- return Z || (Z = new MutationObserver((t) => {
456
+ function se() {
457
+ return Y || (Y = new MutationObserver((t) => {
401
458
  for (const s of t) {
402
- const e = s.target, n = it.get(e);
459
+ const e = s.target, n = rt.get(e);
403
460
  if (!n) continue;
404
- const l = B(e);
405
- l !== n.accounted && (n.accounted = l, l === j ? (n.reactHidden = !0, n.onHide()) : l !== "none" && n.reactHidden && (n.reactHidden = !1, n.onShow()));
461
+ const r = B(e);
462
+ r !== n.accounted && (n.accounted = r, r === Z ? (n.reactHidden = !0, n.onHide()) : r !== "none" && n.reactHidden && (n.reactHidden = !1, n.onShow()));
406
463
  }
407
- }), Z);
464
+ }), Y);
408
465
  }
409
- function Gt(t, s) {
466
+ function ie(t, s) {
410
467
  const e = B(t), n = {
411
468
  accounted: e,
412
- reactHidden: e === j,
469
+ reactHidden: e === Z,
413
470
  onHide: s.onHide,
414
471
  onShow: s.onShow
415
472
  };
416
- return it.set(t, n), Yt().observe(t, {
473
+ return rt.set(t, n), se().observe(t, {
417
474
  attributes: !0,
418
475
  attributeFilter: ["style"]
419
476
  }), {
420
477
  get isHidden() {
421
- return B(t) === j;
478
+ return B(t) === Z;
422
479
  },
423
- setDisplay(l, p = !1) {
424
- l === null ? t.style.removeProperty("display") : t.style.setProperty(
480
+ setDisplay(r, u = !1) {
481
+ r === null ? t.style.removeProperty("display") : t.style.setProperty(
425
482
  "display",
426
- l,
427
- p ? "important" : ""
483
+ r,
484
+ u ? "important" : ""
428
485
  ), n.accounted = B(t);
429
486
  },
430
487
  sync() {
431
- n.accounted = B(t), n.reactHidden = n.accounted === j;
488
+ n.accounted = B(t), n.reactHidden = n.accounted === Z;
432
489
  },
433
490
  stop() {
434
- it.delete(t);
491
+ rt.delete(t);
435
492
  }
436
493
  };
437
494
  }
438
- function Zt(t) {
495
+ function oe(t) {
439
496
  return Array.isArray(t);
440
497
  }
441
- function wt(t) {
498
+ function Pt(t) {
442
499
  const s = [];
443
500
  for (const e of t)
444
- Zt(e) ? s.push(...wt(e)) : s.push(e);
501
+ oe(e) ? s.push(...Pt(e)) : s.push(e);
445
502
  return s;
446
503
  }
447
- function re(t, s = {}) {
504
+ function ye(t, s = {}) {
448
505
  const {
449
506
  transitions: e = [],
450
- middleware: n = (o, i) => ({ from: o, to: i }),
451
- preserveScroll: l = (o) => o
452
- } = t, p = s.host ?? new _t(), a = Vt(), g = typeof e == "function" ? e : () => e, v = $t();
453
- v.initialize();
507
+ middleware: n = (i, o) => ({ from: i, to: o }),
508
+ preserveScroll: r = (i) => i
509
+ } = t, u = s.host ?? new kt(), l = te(), d = typeof e == "function" ? e : () => e, y = Jt();
510
+ y.initialize();
454
511
  const {
455
- initializeContext: A,
456
- calculateScrollOffset: C,
512
+ initializeContext: R,
513
+ calculateScrollOffset: A,
457
514
  evictScrollPosition: b,
458
515
  shouldPreserve: x,
459
516
  getScrollContainer: L,
460
- getPositionedParentElement: H,
461
- getScrollPosition: I,
462
- getIsMobile: z
463
- } = Xt({ preserveScroll: l }), $ = /* @__PURE__ */ new Map(), d = () => {
464
- const o = z();
465
- let i = $.get(o);
466
- return i || (i = It(
467
- wt(g({ isMobile: o }))
468
- ), $.set(o, i)), i;
517
+ getPositionedParentElement: I,
518
+ getScrollPosition: H,
519
+ getIsMobile: K
520
+ } = Qt({ preserveScroll: r }), X = /* @__PURE__ */ new Map(), h = () => {
521
+ const i = K();
522
+ let o = X.get(i);
523
+ return o || (o = Bt(
524
+ Pt(d({ isMobile: i }))
525
+ ), X.set(i, o)), o;
469
526
  };
470
- let f = null, h = null;
471
- const w = /* @__PURE__ */ new WeakMap(), O = (o) => {
472
- w.set(o, {
473
- parent: o.parentNode,
474
- nextSibling: o.nextSibling
527
+ let p = null, m = null;
528
+ const E = /* @__PURE__ */ new WeakMap(), O = (i) => {
529
+ E.set(i, {
530
+ parent: i.parentNode,
531
+ nextSibling: i.nextSibling
475
532
  });
476
- }, u = (o) => {
477
- const i = w.get(o);
478
- return i || {
479
- parent: o.parentNode,
480
- nextSibling: o.nextSibling
533
+ }, f = (i) => {
534
+ const o = E.get(i);
535
+ return o || {
536
+ parent: i.parentNode,
537
+ nextSibling: i.nextSibling
481
538
  };
482
- }, c = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap();
483
- let S = 0;
484
- const E = (o) => {
485
- const i = typeof getComputedStyle < "u" ? getComputedStyle(o).display : "";
486
- return i && i !== "none" ? i : "block";
487
- }, T = (o, i) => {
488
- i.visibleDisplay = o.style.getPropertyValue("display"), i.computedDisplay = E(o);
489
- }, N = (o, i) => {
490
- if (m.get(o) !== i) return;
491
- m.delete(o);
492
- const r = c.get(o);
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)));
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 = {
496
- scrollOffset: U,
497
- from: { scroll: I(i) },
498
- to: { scroll: I(r) },
539
+ }, a = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap();
540
+ let w = 0;
541
+ const S = (i) => {
542
+ const o = typeof getComputedStyle < "u" ? getComputedStyle(i).display : "";
543
+ return o && o !== "none" ? o : "block";
544
+ }, T = (i, o) => {
545
+ o.visibleDisplay = i.style.getPropertyValue("display"), o.computedDisplay = S(i);
546
+ }, k = (i, o) => {
547
+ if (v.get(i) !== o) return;
548
+ v.delete(i);
549
+ const c = a.get(i);
550
+ c && (c.savedCss !== null && (i.style.cssText = c.savedCss, c.savedCss = null), c.intent === "hidden" ? c.vis.setDisplay("none", !0) : c.visibleDisplay ? (c.vis.setDisplay(c.visibleDisplay, !1), T(i, c)) : (c.vis.setDisplay(null), T(i, c)));
551
+ }, Rt = (i, o, c, g, P) => {
552
+ const M = g.element, _ = P.element, D = (g.mode ?? "unmount") === "hidden", { parent: U, nextSibling: j } = g.parent ? { parent: g.parent, nextSibling: g.nextSibling } : f(M), q = A(o, c), J = {
553
+ scrollOffset: q,
554
+ from: { scroll: H(o) },
555
+ to: { scroll: H(c) },
499
556
  get scrollingElement() {
500
557
  return L() || document.documentElement;
501
558
  },
502
559
  get positionedParent() {
503
- return H();
560
+ return I();
504
561
  }
505
562
  };
506
- let M;
507
- if (k) {
508
- M = P, M.style.top = `${-1 * ((U == null ? void 0 : U.y) ?? 0)}px`;
509
- const D = c.get(_);
510
- D && D.savedCss === null && (D.savedCss = _.style.cssText);
563
+ let C;
564
+ if (D) {
565
+ C = M, C.style.top = `${-1 * ((q == null ? void 0 : q.y) ?? 0)}px`;
566
+ const N = a.get(_);
567
+ N && N.savedCss === null && (N.savedCss = _.style.cssText);
511
568
  } else
512
- M = P, kt(M, tt);
513
- x(i) || b(i);
514
- const Y = k ? ++S : 0;
515
- k && (m.set(_, Y), m.set(P, Y));
516
- const ut = Promise.resolve(M), dt = Promise.resolve(_), ft = [], xt = {
517
- from: ut,
518
- to: dt,
519
- context: tt,
520
- createElement: ((D, et = "div") => {
521
- const W = document.createElement(et);
522
- return W.setAttribute("data-ssgoi-id", D), ft.push(W), W;
569
+ C = M, It(C, J);
570
+ x(o) || b(o);
571
+ const V = D ? ++w : 0;
572
+ D && (v.set(_, V), v.set(M, V));
573
+ const ft = Promise.resolve(C), ht = Promise.resolve(_), pt = [], Lt = {
574
+ from: ft,
575
+ to: ht,
576
+ context: J,
577
+ createElement: ((N, tt = "div") => {
578
+ const W = document.createElement(tt);
579
+ return W.setAttribute("data-ssgoi-id", N), pt.push(W), W;
523
580
  })
524
- }, At = Promise.resolve(
525
- o.prepare ? o.prepare(xt) : {}
581
+ }, Ot = Promise.resolve(
582
+ i.prepare ? i.prepare(Lt) : {}
526
583
  );
527
- Ht({
528
- from: ut,
529
- to: dt,
530
- extras: At
531
- }).then(({ from: D, to: et, extras: W }) => {
532
- !k && q && (Q && q.contains(Q) ? q.insertBefore(M, Q) : q.appendChild(M));
533
- const nt = o.animation({
534
- from: D,
535
- to: et,
536
- context: tt,
584
+ zt({
585
+ from: ft,
586
+ to: ht,
587
+ extras: Ot
588
+ }).then(({ from: N, to: tt, extras: W }) => {
589
+ !D && U && (j && U.contains(j) ? U.insertBefore(C, j) : U.appendChild(C));
590
+ const et = i.animation({
591
+ from: N,
592
+ to: tt,
593
+ context: J,
537
594
  ...W
538
- }), st = nt.onComplete;
539
- nt.onComplete = () => {
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);
595
+ }), nt = et.onComplete;
596
+ et.onComplete = () => {
597
+ nt == null || nt(), D ? (k(M, V), k(_, V)) : C.parentNode && C.parentNode.removeChild(C);
598
+ for (const st of pt)
599
+ st.parentNode && st.parentNode.removeChild(st);
600
+ }, u.attach(et);
544
601
  });
545
- }, V = (o, i) => {
546
- const r = v.isSwipeBack();
547
- a.trigger(o, i), a.get(i).then((y) => {
548
- if (i === "in" && v.onPageEnter(), !y) return;
549
- if (r) {
550
- i === "out" && y.from && !x(y.from) && b(y.from), f = null, h = null;
602
+ }, $ = (i, o) => {
603
+ const c = y.isSwipeBack();
604
+ l.trigger(i, o), l.get(o).then((g) => {
605
+ if (o === "in" && y.onPageEnter(), !g) return;
606
+ if (c) {
607
+ o === "out" && g.from && !x(g.from) && b(g.from), p = null, m = null;
551
608
  return;
552
609
  }
553
- if (i !== "in") return;
554
- const { from: R, to: P } = n(
555
- y.from,
556
- y.to
557
- ), _ = Wt(
558
- R,
610
+ if (o !== "in") return;
611
+ const { from: P, to: M } = n(
612
+ g.from,
613
+ g.to
614
+ ), _ = Vt(
559
615
  P,
560
- d()
561
- ), J = f, k = h;
562
- f = null, h = null, !(!_ || !J || !k) && Tt(_, R, P, J, k);
616
+ M,
617
+ h()
618
+ ), Q = p, D = m;
619
+ p = null, m = null, !(!_ || !Q || !D) && Rt(_, P, M, Q, D);
563
620
  });
564
- }, Rt = (o, i) => {
565
- const r = c.get(o);
566
- if (!r) return;
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 = {
571
- element: o,
572
- parent: R.parent,
573
- nextSibling: R.nextSibling,
621
+ }, At = (i, o) => {
622
+ const c = a.get(i);
623
+ if (!c) return;
624
+ const g = c.intent === "hidden";
625
+ if (c.intent = "hidden", c.savedCss === null && (c.savedCss = i.style.cssText), c.vis.setDisplay(c.computedDisplay || "block", !0), i.style.position = "absolute", i.style.width = "100%", i.style.left = "0", g) return;
626
+ const P = f(i);
627
+ p = {
628
+ element: i,
629
+ parent: P.parent,
630
+ nextSibling: P.nextSibling,
574
631
  mode: "hidden"
575
632
  };
576
- const P = o.getAttribute("data-ssgoi-transition") ?? i;
577
- V(P, "out");
578
- }, Pt = (o, i) => {
579
- const r = c.get(o);
580
- if (!r || r.intent === "visible") return;
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 = {
582
- element: o,
583
- parent: o.parentElement,
584
- nextSibling: o.nextElementSibling
633
+ const M = i.getAttribute("data-ssgoi-transition") ?? o;
634
+ $(M, "out");
635
+ }, Ct = (i, o) => {
636
+ const c = a.get(i);
637
+ if (!c || c.intent === "visible") return;
638
+ c.intent = "visible", T(i, c), c.savedCss !== null && (i.style.cssText = c.savedCss, c.visibleDisplay ? c.vis.setDisplay(c.visibleDisplay, !1) : c.vis.setDisplay(null)), R(i, o), m = {
639
+ element: i,
640
+ parent: i.parentElement,
641
+ nextSibling: i.nextElementSibling
585
642
  };
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);
643
+ const g = i.getAttribute("data-ssgoi-transition") ?? o;
644
+ $(g, "in");
645
+ }, xt = (i, o, c) => {
646
+ const g = a.get(i);
647
+ if (g && (g.vis.stop(), a.delete(i), v.delete(i), g.intent === "hidden")) {
648
+ (p == null ? void 0 : p.element) === i && (p = null), (m == null ? void 0 : m.element) === i && (m = null);
592
649
  return;
593
650
  }
594
- const R = r ?? u(o);
595
- f = {
596
- element: o,
597
- parent: R.parent,
598
- nextSibling: R.nextSibling,
651
+ const P = c ?? f(i);
652
+ p = {
653
+ element: i,
654
+ parent: P.parent,
655
+ nextSibling: P.nextSibling,
599
656
  mode: "unmount"
600
657
  };
601
- const P = o.getAttribute("data-ssgoi-transition") ?? i;
602
- V(P, "out");
603
- }, lt = /* @__PURE__ */ new WeakSet(), ct = (o, i) => {
604
- if (lt.has(i)) return;
605
- lt.add(i), O(i);
606
- const r = Gt(i, {
607
- onHide: () => Rt(i, o),
608
- onShow: () => Pt(i, o)
609
- }), y = {
610
- vis: r,
658
+ const M = i.getAttribute("data-ssgoi-transition") ?? o;
659
+ $(M, "out");
660
+ }, at = /* @__PURE__ */ new WeakSet(), ut = (i, o) => {
661
+ if (at.has(o)) return;
662
+ at.add(o), O(o);
663
+ const c = ie(o, {
664
+ onHide: () => At(o, i),
665
+ onShow: () => Ct(o, i)
666
+ }), g = {
667
+ vis: c,
611
668
  savedCss: null,
612
- intent: r.isHidden ? "hidden" : "visible",
669
+ intent: c.isHidden ? "hidden" : "visible",
613
670
  visibleDisplay: "",
614
671
  computedDisplay: "block"
615
672
  };
616
- c.set(i, y), r.isHidden || (T(i, y), A(i, o), h = {
617
- element: i,
618
- parent: i.parentElement,
619
- nextSibling: i.nextElementSibling
620
- }, V(o, "in")), Ut(i, (R) => Mt(i, o, R));
621
- }, at = /* @__PURE__ */ new Map();
622
- return { register: ct, refFor: (o) => {
623
- let i = at.get(o);
624
- return i || (i = (r) => {
625
- r && ct(o, r);
626
- }, at.set(o, i)), i;
673
+ a.set(o, g), c.isHidden || (T(o, g), R(o, i), m = {
674
+ element: o,
675
+ parent: o.parentElement,
676
+ nextSibling: o.nextElementSibling
677
+ }, $(i, "in")), ne(o, (P) => xt(o, i, P));
678
+ }, dt = /* @__PURE__ */ new Map();
679
+ return { register: ut, refFor: (i) => {
680
+ let o = dt.get(i);
681
+ return o || (o = (c) => {
682
+ c && ut(i, c);
683
+ }, dt.set(i, o)), o;
627
684
  } };
628
685
  }
629
- const St = "data-ssgoi-root", jt = `[${St}]`, rt = "data-ssgoi-transition", bt = `[${rt}]`, Jt = "[data-ssgoi-clone]";
630
- function Qt() {
686
+ const Mt = "data-ssgoi-root", re = `[${Mt}]`, ct = "data-ssgoi-transition", wt = `[${ct}]`, ce = "[data-ssgoi-clone]";
687
+ function le() {
631
688
  return typeof MutationObserver < "u" && typeof HTMLElement < "u" && typeof Node < "u";
632
689
  }
633
- function te(t) {
690
+ function ae(t) {
634
691
  return t.nodeType === Node.ELEMENT_NODE;
635
692
  }
636
- function ee(t) {
693
+ function ue(t) {
637
694
  return t instanceof HTMLElement;
638
695
  }
639
- function le(t, s) {
640
- if (!Qt()) return () => {
696
+ function me(t, s) {
697
+ if (!le()) return () => {
641
698
  };
642
- t.setAttribute(St, "");
643
- const e = (a) => a.closest(jt) === t, n = (a) => {
644
- if (!ee(a) || !e(a) || a.closest(Jt))
699
+ t.setAttribute(Mt, "");
700
+ const e = (l) => l.closest(re) === t, n = (l) => {
701
+ if (!ue(l) || !e(l) || l.closest(ce))
645
702
  return;
646
- const g = a.getAttribute(rt);
647
- g !== null && s.register(g, a);
648
- }, l = (a) => {
649
- if (te(a)) {
650
- a.matches(bt) && n(a);
651
- for (const g of a.querySelectorAll(bt))
652
- n(g);
703
+ const d = l.getAttribute(ct);
704
+ d !== null && s.register(d, l);
705
+ }, r = (l) => {
706
+ if (ae(l)) {
707
+ l.matches(wt) && n(l);
708
+ for (const d of l.querySelectorAll(wt))
709
+ n(d);
653
710
  }
654
- }, p = new MutationObserver((a) => {
655
- for (const g of a) {
656
- if (g.type === "attributes") {
657
- n(g.target);
711
+ }, u = new MutationObserver((l) => {
712
+ for (const d of l) {
713
+ if (d.type === "attributes") {
714
+ n(d.target);
658
715
  continue;
659
716
  }
660
- for (const v of g.addedNodes)
661
- l(v);
717
+ for (const y of d.addedNodes)
718
+ r(y);
662
719
  }
663
720
  });
664
- return p.observe(t, {
721
+ return u.observe(t, {
665
722
  childList: !0,
666
723
  subtree: !0,
667
724
  attributes: !0,
668
- attributeFilter: [rt]
669
- }), l(t), () => p.disconnect();
725
+ attributeFilter: [ct]
726
+ }), r(t), () => u.disconnect();
670
727
  }
671
728
  export {
672
- Ot as Animation,
673
- _t as HostAnimation,
674
- ue as MultiAnimation,
675
- de as WebAnimation,
676
- re as createSggoiTransitionContext,
677
- le as observeSsgoiTransitions
729
+ Nt as Animation,
730
+ kt as HostAnimation,
731
+ be as MultiAnimation,
732
+ Se as WebAnimation,
733
+ ye as createSggoiTransitionContext,
734
+ me as observeSsgoiTransitions
678
735
  };
@@ -1,11 +1,16 @@
1
1
  import { TransitionConfig } from '../types/index.ts';
2
2
  /**
3
3
  * Matches a path against a pattern
4
- * Supports exact matches and wildcard patterns
4
+ * Supports exact matches, wildcard patterns, and common route segment params
5
5
  *
6
6
  * @example
7
7
  * matchPath('/products', '/products') // true
8
8
  * matchPath('/products/123', '/products/*') // true
9
+ * matchPath('/products', '/products/**') // true
10
+ * matchPath('/products/123/reviews', '/products/**') // true
11
+ * matchPath('/products/123', '/products/:id') // true
12
+ * matchPath('/products/123', '/products/[id]') // true
13
+ * matchPath('/products/123', '/products/{id}') // true
9
14
  * matchPath('/products/123', '/products') // false
10
15
  * matchPath('/anything', '*') // true
11
16
  */
@@ -13,8 +18,9 @@ export declare function matchPath(path: string, pattern: string): boolean;
13
18
  /**
14
19
  * Finds a matching transition configuration for the given from and to paths
15
20
  *
16
- * First tries to find exact match for both from and to paths,
17
- * then falls back to wildcard matches if no exact match is found.
21
+ * Chooses the most specific matching config. Exact paths outrank wildcard
22
+ * paths, deeper static wildcard prefixes outrank broader fallbacks, and equal
23
+ * specificity preserves the original config order.
18
24
  */
19
25
  export declare function findMatchingTransition(from: string, to: string, transitions: Array<{
20
26
  from: string;
@@ -1 +1 @@
1
- {"version":3,"file":"find-matching-transition.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/find-matching-transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE/C;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAehE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,gBAAgB,CAAC;CAC9B,CAAC,GACD,gBAAgB,GAAG,IAAI,CAmBzB"}
1
+ {"version":3,"file":"find-matching-transition.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/find-matching-transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AA6H/C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,gBAAgB,CAAC;CAC9B,CAAC,GACD,gBAAgB,GAAG,IAAI,CAsBzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssgoi/core",
3
- "version": "6.6.1",
3
+ "version": "6.6.2",
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,18 +32,6 @@
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
- },
47
35
  "keywords": [
48
36
  "page-transition",
49
37
  "page-transitions",
@@ -88,5 +76,16 @@
88
76
  "vite": "^6.0.7",
89
77
  "vite-plugin-dts": "^4.5.0",
90
78
  "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"
91
90
  }
92
- }
91
+ }