@ssgoi/core 6.3.1 → 6.4.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/README.md +48 -43
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +366 -321
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/ssgoi-transition/observe-ssgoi-transitions.d.ts +3 -0
- package/dist/ssgoi-transition/observe-ssgoi-transitions.d.ts.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,31 +33,27 @@ npm install @ssgoi/svelte
|
|
|
33
33
|
#### 1. Wrap your app
|
|
34
34
|
|
|
35
35
|
```tsx
|
|
36
|
-
import { Ssgoi } from
|
|
37
|
-
import { fade } from
|
|
36
|
+
import { Ssgoi } from "@ssgoi/react";
|
|
37
|
+
import { fade } from "@ssgoi/react/view-transitions";
|
|
38
38
|
|
|
39
39
|
export default function App() {
|
|
40
40
|
return (
|
|
41
|
-
<Ssgoi config={{ transitions: fade({ paths: [
|
|
42
|
-
<div style={{ position:
|
|
43
|
-
{/* Your app */}
|
|
44
|
-
</div>
|
|
41
|
+
<Ssgoi config={{ transitions: fade({ paths: ["/", "/about"] }) }}>
|
|
42
|
+
<div style={{ position: "relative" }}>{/* Your app */}</div>
|
|
45
43
|
</Ssgoi>
|
|
46
44
|
);
|
|
47
45
|
}
|
|
48
46
|
```
|
|
49
47
|
|
|
50
|
-
#### 2.
|
|
48
|
+
#### 2. Mark your pages
|
|
51
49
|
|
|
52
50
|
```tsx
|
|
53
|
-
import { SsgoiTransition } from '@ssgoi/react';
|
|
54
|
-
|
|
55
51
|
export default function HomePage() {
|
|
56
52
|
return (
|
|
57
|
-
<
|
|
53
|
+
<main data-ssgoi-transition="/">
|
|
58
54
|
<h1>Welcome</h1>
|
|
59
55
|
{/* Page content */}
|
|
60
|
-
</
|
|
56
|
+
</main>
|
|
61
57
|
);
|
|
62
58
|
}
|
|
63
59
|
```
|
|
@@ -74,15 +70,19 @@ Define different transitions for different routes:
|
|
|
74
70
|
const config = {
|
|
75
71
|
transitions: [
|
|
76
72
|
// Scroll between tabs
|
|
77
|
-
{ from:
|
|
78
|
-
{ from:
|
|
79
|
-
|
|
73
|
+
{ from: "/home", to: "/about", transition: scroll({ direction: "up" }) },
|
|
74
|
+
{ from: "/about", to: "/home", transition: scroll({ direction: "down" }) },
|
|
75
|
+
|
|
80
76
|
// Drill in when entering details
|
|
81
|
-
{
|
|
82
|
-
|
|
77
|
+
{
|
|
78
|
+
from: "/products",
|
|
79
|
+
to: "/products/*",
|
|
80
|
+
transition: drill({ direction: "enter" }),
|
|
81
|
+
},
|
|
82
|
+
|
|
83
83
|
// Pinterest-style image transitions
|
|
84
|
-
{ from:
|
|
85
|
-
]
|
|
84
|
+
{ from: "/gallery", to: "/photo/*", transition: pinterest() },
|
|
85
|
+
],
|
|
86
86
|
};
|
|
87
87
|
```
|
|
88
88
|
|
|
@@ -93,7 +93,7 @@ Automatically create bidirectional transitions:
|
|
|
93
93
|
```tsx
|
|
94
94
|
{
|
|
95
95
|
from: '/home',
|
|
96
|
-
to: '/about',
|
|
96
|
+
to: '/about',
|
|
97
97
|
transition: scroll({ direction: 'up' }),
|
|
98
98
|
symmetric: true // Automatically creates reverse transition
|
|
99
99
|
}
|
|
@@ -104,16 +104,18 @@ Automatically create bidirectional transitions:
|
|
|
104
104
|
Animate specific elements during mount/unmount:
|
|
105
105
|
|
|
106
106
|
```tsx
|
|
107
|
-
import { transition } from
|
|
108
|
-
import { fade, slide } from
|
|
107
|
+
import { transition } from "@ssgoi/react";
|
|
108
|
+
import { fade, slide } from "@ssgoi/react/transitions";
|
|
109
109
|
|
|
110
110
|
function Card() {
|
|
111
111
|
return (
|
|
112
|
-
<div
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
<div
|
|
113
|
+
ref={transition({
|
|
114
|
+
key: "card",
|
|
115
|
+
in: fade(),
|
|
116
|
+
out: slide({ direction: "up" }),
|
|
117
|
+
})}
|
|
118
|
+
>
|
|
117
119
|
<h2>Animated Card</h2>
|
|
118
120
|
</div>
|
|
119
121
|
);
|
|
@@ -123,6 +125,7 @@ function Card() {
|
|
|
123
125
|
## Built-in Transitions
|
|
124
126
|
|
|
125
127
|
### Page Transitions
|
|
128
|
+
|
|
126
129
|
- `fade` - Smooth opacity transition
|
|
127
130
|
- `scroll` - Vertical scrolling (up/down)
|
|
128
131
|
- `drill` - Drill in/out effect (enter/exit)
|
|
@@ -130,6 +133,7 @@ function Card() {
|
|
|
130
133
|
- `pinterest` - Pinterest-style expand effect
|
|
131
134
|
|
|
132
135
|
### Element Transitions
|
|
136
|
+
|
|
133
137
|
- `fade` - Fade in/out
|
|
134
138
|
- `scale` - Scale in/out
|
|
135
139
|
- `slide` - Slide (direction: up/down/left/right)
|
|
@@ -144,17 +148,19 @@ function Card() {
|
|
|
144
148
|
|
|
145
149
|
```tsx
|
|
146
150
|
// app/layout.tsx
|
|
147
|
-
import { Ssgoi } from
|
|
148
|
-
import { scroll } from
|
|
151
|
+
import { Ssgoi } from "@ssgoi/react";
|
|
152
|
+
import { scroll } from "@ssgoi/react/view-transitions";
|
|
149
153
|
|
|
150
154
|
export default function RootLayout({ children }) {
|
|
151
155
|
return (
|
|
152
156
|
<html>
|
|
153
157
|
<body>
|
|
154
|
-
<Ssgoi
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
<Ssgoi
|
|
159
|
+
config={{
|
|
160
|
+
transitions: scroll({ paths: ["/", "/about"] }),
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
<div style={{ position: "relative", minHeight: "100vh" }}>
|
|
158
164
|
{children}
|
|
159
165
|
</div>
|
|
160
166
|
</Ssgoi>
|
|
@@ -163,15 +169,8 @@ export default function RootLayout({ children }) {
|
|
|
163
169
|
);
|
|
164
170
|
}
|
|
165
171
|
|
|
166
|
-
// app/page.tsx
|
|
167
|
-
import { SsgoiTransition } from '@ssgoi/react';
|
|
168
|
-
|
|
169
172
|
export default function Page() {
|
|
170
|
-
return
|
|
171
|
-
<SsgoiTransition id="/">
|
|
172
|
-
{/* Your page content */}
|
|
173
|
-
</SsgoiTransition>
|
|
174
|
-
);
|
|
173
|
+
return <main data-ssgoi-transition="/">{/* Your page content */}</main>;
|
|
175
174
|
}
|
|
176
175
|
```
|
|
177
176
|
|
|
@@ -192,23 +191,24 @@ export default function Page() {
|
|
|
192
191
|
|
|
193
192
|
<!-- +page.svelte -->
|
|
194
193
|
<script>
|
|
195
|
-
import { SsgoiTransition } from '@ssgoi/svelte';
|
|
196
194
|
import { page } from '$app/stores';
|
|
197
195
|
</script>
|
|
198
196
|
|
|
199
|
-
<
|
|
197
|
+
<main data-ssgoi-transition={$page.url.pathname}>
|
|
200
198
|
<!-- Your page content -->
|
|
201
|
-
</
|
|
199
|
+
</main>
|
|
202
200
|
```
|
|
203
201
|
|
|
204
202
|
## Why SSGOI?
|
|
205
203
|
|
|
206
204
|
### vs View Transition API
|
|
205
|
+
|
|
207
206
|
- ✅ Works in all browsers, not just Chrome
|
|
208
207
|
- ✅ More animation options with spring physics
|
|
209
208
|
- ✅ Better developer experience
|
|
210
209
|
|
|
211
210
|
### vs Other Animation Libraries
|
|
211
|
+
|
|
212
212
|
- ✅ Built specifically for page transitions
|
|
213
213
|
- ✅ SSR-first design
|
|
214
214
|
- ✅ No router lock-in
|
|
@@ -230,17 +230,21 @@ All powered by a spring physics engine for natural, smooth motion.
|
|
|
230
230
|
Try out SSGOI with our framework-specific demo applications:
|
|
231
231
|
|
|
232
232
|
### React Demo
|
|
233
|
+
|
|
233
234
|
```bash
|
|
234
235
|
pnpm react-demo:dev
|
|
235
236
|
# Opens at http://localhost:3001
|
|
236
237
|
```
|
|
238
|
+
|
|
237
239
|
Explore Next.js App Router integration with various transition effects.
|
|
238
240
|
|
|
239
241
|
### Svelte Demo
|
|
242
|
+
|
|
240
243
|
```bash
|
|
241
244
|
pnpm svelte-demo:dev
|
|
242
245
|
# Opens at http://localhost:5174
|
|
243
246
|
```
|
|
247
|
+
|
|
244
248
|
See SvelteKit integration with smooth page transitions.
|
|
245
249
|
|
|
246
250
|
Visit the `/apps` directory to explore the demo source code and learn how to implement SSGOI in your own projects.
|
|
@@ -248,6 +252,7 @@ Visit the `/apps` directory to explore the demo source code and learn how to imp
|
|
|
248
252
|
## Documentation
|
|
249
253
|
|
|
250
254
|
Visit [https://ssgoi.dev](https://ssgoi.dev) for:
|
|
255
|
+
|
|
251
256
|
- Detailed API reference
|
|
252
257
|
- Interactive examples
|
|
253
258
|
- Framework integration guides
|
package/dist/internal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
"use strict";var mt=Object.defineProperty;var ht=(t,n,e)=>n in t?mt(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var F=(t,n,e)=>ht(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("./multi-animation-Dw2JTJI2.cjs");class lt extends z.Animation{constructor(){super(...arguments);F(this,"child",null);F(this,"_state","idle");F(this,"_settled",!1);F(this,"listeners",new Set)}attach(e){const o=this.child;if(this.child=e,this._settled=!1,o){const l=o.getPose();o.complete(),e.matchInto(l)}e.playbackRate=this.playbackRate;const i=e.onComplete;e.onComplete=()=>{i==null||i(),this.child===e&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const f=e.onUpdate;e.onUpdate=l=>{var d;f==null||f(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 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 gt=(t,n)=>{var e;t.style.position="absolute",t.style.width="100%",t.style.top=`${-1*(((e=n==null?void 0:n.scrollOffset)==null?void 0:e.y)??0)}px`,t.style.left="0"},tt=new Set(["auto","scroll","overlay"]),yt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n);if(tt.has(e.overflowY)||tt.has(e.overflowX))return n;n=n.parentElement}return document.documentElement},vt=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 pt(t){const n=Object.keys(t);return Promise.all(n.map(e=>t[e])).then(e=>{const o={};return n.forEach((i,f)=>{o[i]=e[f]}),o})}function Et(t){const n=t.filter(e=>e.symmetric).map(e=>({from:e.to,to:e.from,transition:e.transition}));return[...t,...n]}function W(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 Tt(t,n,e){for(const o of e)if(W(t,o.from)&&W(n,o.to))return o.transition;for(const o of e)if((o.from==="*"||W(t,o.from))&&(o.to==="*"||W(n,o.to)))return o.transition;return null}const bt=768,St=10,wt=10;function Rt(t={}){const{preserveScroll:n=c=>c}=t,e=typeof n=="function"?n:()=>n;let o=null,i=!1,f=!1;const l=()=>{const c=(o==null?void 0:o.clientWidth)??0,a=c>0?c:typeof window<"u"?window.innerWidth:0;return a>0&&a<bt},d=()=>(f||(i=l(),f=!0),i),g=c=>{var E;const a=e(d());if(a===!1)return{preserves:!1,shared:!1,storageKey:`path:${c}`};if(a===!0)return{preserves:!0,shared:!1,storageKey:`path:${c}`};const v=((E=a.exclude)==null?void 0:E.some(r=>W(c,r)))??!1,p=!v&&!!a.key;return{preserves:!v,shared:p,storageKey:p?`shared:${a.key}`:`path:${c}`}},L=c=>g(c).preserves;let A=null;const y=new Map;let w=null,O=!1,k=0;const I=()=>{o&&w&&!O&&y.set(g(w).storageKey,{x:o.scrollLeft,y:o.scrollTop})},M=c=>{if(!o)return;const a=g(c);if(a.preserves&&a.shared&&!y.has(a.storageKey))return;const v=a.preserves&&y.has(a.storageKey)?y.get(a.storageKey):{x:0,y:0};let p=0;const E=()=>{if(!o)return;o.scrollTo({top:v.y,left:v.x}),!(Math.abs(o.scrollTop-v.y)<1&&Math.abs(o.scrollLeft-v.x)<1)&&p<St&&(p++,requestAnimationFrame(E))};requestAnimationFrame(E)};return{initializeContext:(c,a)=>{O=!0;const v=++k;A=c,o||(o=yt(c),i=l(),f=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{i=l()}).observe(o),(o===document.documentElement?window:o).addEventListener("scroll",I,{passive:!0})),w=a,M(a);let p=0;const E=()=>{v===k&&(p++,p>=wt?O=!1:requestAnimationFrame(E))};requestAnimationFrame(E)},calculateScrollOffset:(c,a)=>{const v=c?g(c).storageKey:null,p=v&&y.has(v)?y.get(v):{x:0,y:0},E=a?g(a):null,r=E!=null&&E.preserves?E.storageKey:null,s=r&&y.has(r)?y.get(r):{x:0,y:0};return{x:-s.x+p.x,y:-s.y+p.y}},evictScrollPosition:c=>{y.delete(g(c).storageKey)},shouldPreserve:L,getScrollContainer:()=>o,getPositionedParentElement:()=>A?vt(A):document.body,getScrollPosition:c=>{const a=c?g(c).storageKey:null;return a&&y.has(a)?y.get(a):{x:0,y:0}}}}const et=30,nt=8,ot=1.2,rt=30,At=600;function Ot(){let t=null,n=!1,e=!1,o=null,i=null,f=!1;const l=(u,m)=>{for(let h=0;h<u.length;h++){const T=u.item(h);if(T&&T.identifier===m)return T}return null},d=()=>{o!==null&&(clearTimeout(o),o=null)},g=()=>{i!==null&&(clearTimeout(i),i=null)},L=()=>{n=!0,e=!0,d(),g(),o=setTimeout(()=>{n=!1,e=!1,o=null},At)},A=u=>{if(u.touches.length!==1){t=null;return}const m=u.touches.item(0);if(!m){t=null;return}const h=window.innerWidth,T=m.clientX<=et,R=m.clientX>=h-et;if(!T&&!R){t=null;return}t={identifier:m.identifier,startX:m.clientX,startY:m.clientY,fromLeftEdge:T,moved:!1}},y=u=>{if(!t)return;if(u.touches.length!==1){t=null;return}const m=l(u.touches,t.identifier);if(!m){t=null;return}const h=m.clientX-t.startX,T=m.clientY-t.startY,R=Math.abs(h),c=Math.abs(T);if(c>nt&&c>R*ot){t=null;return}const a=t.fromLeftEdge?h>0:h<0;R>nt&&R>c*ot&&a&&(t.moved=!0)},w=u=>{if(!t)return;const m=l(u.changedTouches,t.identifier);if(!m){t=null;return}const h=m.clientX-t.startX,T=t.fromLeftEdge?h>0:h<0;if(t.moved&&T&&Math.abs(h)>=rt){L(),t=null;return}t.moved&&Math.abs(h)>=rt&&L(),t=null},O=()=>{t&&(t.moved&&L(),t=null)};return{initialize:()=>{if(typeof window>"u"||f)return;f=!0;const u={passive:!0,capture:!0};window.addEventListener("touchstart",A,u),window.addEventListener("touchmove",y,u),window.addEventListener("touchend",w,u),window.addEventListener("touchcancel",O,u)},destroy:()=>{if(typeof window>"u"||!f)return;f=!1;const u={capture:!0};window.removeEventListener("touchstart",A,u),window.removeEventListener("touchmove",y,u),window.removeEventListener("touchend",w,u),window.removeEventListener("touchcancel",O,u),d(),g(),t=null,n=!1,e=!1},isSwipeBack:()=>{const u=n||e;return u&&d(),u},onPageEnter:()=>{n=!1,d(),g(),i=setTimeout(()=>{e=!1,i=null},0)}}}function Pt(){let t=null;function n(){var o,i;t&&((o=t.outResolve)==null||o.call(t,null),(i=t.inResolve)==null||i.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,i){var l;i==="out"&&(t==null?void 0:t.to)===o&&!t.from&&((l=t.inResolve)==null||l.call(t,null),t={}),t&&(i==="out"&&t.from&&t.from!==o||i==="in"&&t.to&&t.to!==o)&&n(),t||(t={}),i==="out"?t.from=o:t.to=o},get(o){return new Promise(i=>{t||(t={}),o==="out"?t.outResolve=i:t.inResolve=i,e()})}}}const B=new Map;let H=null,st=!1;function ct(t){if(t instanceof HTMLElement&&B.has(t)){const n=B.get(t);B.delete(t),queueMicrotask(n)}for(const n of Array.from(t.childNodes))ct(n)}function Lt(){if(st||typeof document>"u")return;st=!0,H=new MutationObserver(n=>{for(const e of n)for(const o of Array.from(e.removedNodes))ct(o)});const t=()=>{H==null||H.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function Mt(t,n){return Lt(),B.set(t,n),()=>{B.delete(t)}}function _t(t){return Array.isArray(t)}function at(t){const n=[];for(const e of t)_t(e)?n.push(...at(e)):n.push(e);return n}function xt(t,n={}){const{transitions:e=[],middleware:o=(r,s)=>({from:r,to:s}),preserveScroll:i=r=>r}=t,f=n.host??new lt,l=Pt(),d=Et(at(e)),g=Ot();g.initialize();const{initializeContext:L,calculateScrollOffset:A,evictScrollPosition:y,shouldPreserve:w,getScrollContainer:O,getPositionedParentElement:k,getScrollPosition:I}=Rt({preserveScroll:i});let M=null,x=null;const u=new WeakMap,m=r=>{u.set(r,{parent:r.parentElement,nextSibling:r.nextElementSibling})},h=r=>{const s=u.get(r);return s||{parent:r.parentElement,nextSibling:r.nextElementSibling}},T=(r,s,S,b,D)=>{const N=b.element,X=D.element,{parent:_,nextSibling:C}=b.parent?{parent:b.parent,nextSibling:b.nextSibling}:h(N),P=N.cloneNode(!0);P.setAttribute("data-ssgoi-clone","");const q={scrollOffset:A(s,S),from:{scroll:I(s)},to:{scroll:I(S)},get scrollingElement(){return O()||document.documentElement},get positionedParent(){return k()}};gt(P,q),w(s)||y(s);const Z=Promise.resolve(P),J=Promise.resolve(X),Q=[],ft={from:Z,to:J,context:q,createElement:(($,U="div")=>{const K=document.createElement(U);return K.setAttribute("data-ssgoi-id",$),Q.push(K),K})},dt=Promise.resolve(r.prepare?r.prepare(ft):{});pt({from:Z,to:J,extras:dt}).then(({from:$,to:U,extras:K})=>{_&&(C&&_.contains(C)?_.insertBefore(P,C):_.appendChild(P));const Y=r.animation({from:$,to:U,context:q,...K}),G=Y.onComplete;Y.onComplete=()=>{G==null||G(),P.parentElement&&P.parentElement.removeChild(P);for(const V of Q)V.parentElement&&V.parentElement.removeChild(V)},f.attach(Y)})},R=(r,s)=>{const S=g.isSwipeBack();l.trigger(r,s),l.get(s).then(b=>{if(s==="in"&&g.onPageEnter(),!b)return;if(S){s==="out"&&b.from&&!w(b.from)&&y(b.from),M=null,x=null;return}if(s!=="in")return;const{from:D,to:N}=o(b.from,b.to),X=Tt(D,N,d),_=M,C=x;M=null,x=null,!(!X||!_||!C)&&T(X,D,N,_,C)})},c=(r,s)=>{const S=h(r);M={element:r,parent:S.parent,nextSibling:S.nextSibling};const b=r.getAttribute("data-ssgoi-transition")??s;R(b,"out")},a=new WeakSet,v=(r,s)=>{a.has(s)||(a.add(s),m(s),L(s,r),x={element:s,parent:s.parentElement,nextSibling:s.nextElementSibling},R(r,"in"),Mt(s,()=>c(s,r)))},p=new Map;return{register:v,refFor:r=>{let s=p.get(r);return s||(s=S=>{S&&v(r,S)},p.set(r,s)),s}}}const ut="data-ssgoi-root",Ct=`[${ut}]`,j="data-ssgoi-transition",it=`[${j}]`,kt="[data-ssgoi-clone]";function It(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function Nt(t){return t.nodeType===Node.ELEMENT_NODE}function Kt(t){return t instanceof HTMLElement}function Ft(t,n){if(!It())return()=>{};t.setAttribute(ut,"");const e=l=>l.closest(Ct)===t,o=l=>{if(!Kt(l)||!e(l)||l.closest(kt))return;const d=l.getAttribute(j);d!==null&&n.register(d,l)},i=l=>{if(Nt(l)){l.matches(it)&&o(l);for(const d of l.querySelectorAll(it))o(d)}},f=new MutationObserver(l=>{for(const d of l){if(d.type==="attributes"){o(d.target);continue}for(const g of d.addedNodes)i(g)}});return f.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[j]}),i(t),()=>f.disconnect()}exports.Animation=z.Animation;exports.MultiAnimation=z.MultiAnimation;exports.WebAnimation=z.WebAnimation;exports.HostAnimation=lt;exports.createSggoiTransitionContext=xt;exports.observeSsgoiTransitions=Ft;
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createSggoiTransitionContext } from './ssgoi-transition/create-ssgoi-transition-context';
|
|
2
|
+
export { observeSsgoiTransitions } from './ssgoi-transition/observe-ssgoi-transitions';
|
|
2
3
|
export { Animation, WebAnimation, MultiAnimation, HostAnimation, } from './animation';
|
|
3
4
|
export type { SsgoiConfig, SsgoiContext, SsgoiPathTransition, SsgoiPathTransitionInput, TransitionConfig, PrepareArgs, AnimationFactoryArgs, CreateElement, SsgoiTransitionContext, Pose, Timeline, } from './types/index.ts';
|
|
4
5
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/lib/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAClG,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EACtB,IAAI,EACJ,QAAQ,GACT,MAAM,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/lib/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAClG,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EACtB,IAAI,EACJ,QAAQ,GACT,MAAM,QAAQ,CAAC"}
|
package/dist/internal.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { A as
|
|
5
|
-
import { M as
|
|
6
|
-
class
|
|
1
|
+
var ft = Object.defineProperty;
|
|
2
|
+
var dt = (t, n, e) => n in t ? ft(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
3
|
+
var F = (t, n, e) => dt(t, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
import { A as ht } from "./multi-animation-CnxqLEka.js";
|
|
5
|
+
import { M as $t, W as qt } from "./multi-animation-CnxqLEka.js";
|
|
6
|
+
class mt extends ht {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
F(this, "child", null);
|
|
10
|
+
F(this, "_state", "idle");
|
|
11
|
+
F(this, "_settled", !1);
|
|
12
|
+
F(this, "listeners", /* @__PURE__ */ new Set());
|
|
13
13
|
}
|
|
14
|
-
attach(
|
|
14
|
+
attach(e) {
|
|
15
15
|
const o = this.child;
|
|
16
|
-
if (this.child =
|
|
17
|
-
const
|
|
18
|
-
o.complete(),
|
|
16
|
+
if (this.child = e, this._settled = !1, o) {
|
|
17
|
+
const l = o.getPose();
|
|
18
|
+
o.complete(), e.matchInto(l);
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
e.playbackRate = this.playbackRate;
|
|
21
|
+
const i = e.onComplete;
|
|
22
|
+
e.onComplete = () => {
|
|
23
|
+
i == null || i(), this.child === e && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
|
|
24
24
|
};
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
}, this._state === "paused" ?
|
|
25
|
+
const f = e.onUpdate;
|
|
26
|
+
e.onUpdate = (l) => {
|
|
27
|
+
var d;
|
|
28
|
+
f == null || f(l), (d = this.onUpdate) == null || d.call(this, l), this.notify();
|
|
29
|
+
}, this._state === "paused" ? e.pause() : this._state === "reversing" ? e.reverse() : (this._state = "playing", e.play()), this.notify();
|
|
30
30
|
}
|
|
31
31
|
play() {
|
|
32
|
-
var
|
|
33
|
-
this._state = "playing", this._settled = !1, (
|
|
32
|
+
var e;
|
|
33
|
+
this._state = "playing", this._settled = !1, (e = this.child) == null || e.play(), this.notify();
|
|
34
34
|
}
|
|
35
35
|
reverse() {
|
|
36
|
-
var
|
|
37
|
-
this._state = "reversing", this._settled = !1, (
|
|
36
|
+
var e;
|
|
37
|
+
this._state = "reversing", this._settled = !1, (e = this.child) == null || e.reverse(), this.notify();
|
|
38
38
|
}
|
|
39
39
|
pause() {
|
|
40
|
-
var
|
|
41
|
-
this._state = "paused", (
|
|
40
|
+
var e;
|
|
41
|
+
this._state = "paused", (e = this.child) == null || e.pause(), this.notify();
|
|
42
42
|
}
|
|
43
43
|
complete() {
|
|
44
|
-
var
|
|
45
|
-
(
|
|
44
|
+
var e;
|
|
45
|
+
(e = this.child) == null || e.complete(), this.notify();
|
|
46
46
|
}
|
|
47
47
|
get isAnimating() {
|
|
48
|
-
var
|
|
49
|
-
return ((
|
|
48
|
+
var e;
|
|
49
|
+
return ((e = this.child) == null ? void 0 : e.isAnimating) ?? !1;
|
|
50
50
|
}
|
|
51
51
|
get isPaused() {
|
|
52
52
|
return this._state === "paused";
|
|
@@ -55,459 +55,504 @@ class fe extends ue {
|
|
|
55
55
|
return this._settled && !this.child;
|
|
56
56
|
}
|
|
57
57
|
get isReversing() {
|
|
58
|
-
var
|
|
59
|
-
return ((
|
|
58
|
+
var e;
|
|
59
|
+
return ((e = this.child) == null ? void 0 : e.isReversing) ?? this._state === "reversing";
|
|
60
60
|
}
|
|
61
61
|
get progress() {
|
|
62
|
-
var
|
|
63
|
-
return ((
|
|
62
|
+
var e;
|
|
63
|
+
return ((e = this.child) == null ? void 0 : e.progress) ?? 0;
|
|
64
64
|
}
|
|
65
|
-
findTimeForProgress(
|
|
65
|
+
findTimeForProgress(e) {
|
|
66
66
|
var o;
|
|
67
|
-
return ((o = this.child) == null ? void 0 : o.findTimeForProgress(
|
|
67
|
+
return ((o = this.child) == null ? void 0 : o.findTimeForProgress(e)) ?? null;
|
|
68
68
|
}
|
|
69
69
|
get playbackRate() {
|
|
70
70
|
return super.playbackRate;
|
|
71
71
|
}
|
|
72
|
-
set playbackRate(
|
|
73
|
-
super.playbackRate =
|
|
72
|
+
set playbackRate(e) {
|
|
73
|
+
super.playbackRate = e, this.child && (this.child.playbackRate = e), this.notify();
|
|
74
74
|
}
|
|
75
75
|
getPose() {
|
|
76
|
-
var
|
|
77
|
-
return ((
|
|
76
|
+
var e;
|
|
77
|
+
return ((e = this.child) == null ? void 0 : e.getPose()) ?? [];
|
|
78
78
|
}
|
|
79
79
|
getTimeline() {
|
|
80
|
-
var
|
|
81
|
-
return ((
|
|
80
|
+
var e;
|
|
81
|
+
return ((e = this.child) == null ? void 0 : e.getTimeline()) ?? [];
|
|
82
82
|
}
|
|
83
|
-
matchInto(
|
|
83
|
+
matchInto(e) {
|
|
84
84
|
var o;
|
|
85
|
-
(o = this.child) == null || o.matchInto(
|
|
85
|
+
(o = this.child) == null || o.matchInto(e);
|
|
86
86
|
}
|
|
87
87
|
/** Currently attached child, or null when nothing is playing. */
|
|
88
88
|
get activeChild() {
|
|
89
89
|
return this.child;
|
|
90
90
|
}
|
|
91
91
|
/** Subscribe to host state changes. Returns an unsubscribe fn. */
|
|
92
|
-
subscribe(
|
|
93
|
-
return this.listeners.add(
|
|
94
|
-
this.listeners.delete(
|
|
92
|
+
subscribe(e) {
|
|
93
|
+
return this.listeners.add(e), () => {
|
|
94
|
+
this.listeners.delete(e);
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
notify() {
|
|
98
|
-
for (const
|
|
98
|
+
for (const e of this.listeners) e();
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
const
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
let n =
|
|
101
|
+
const gt = (t, n) => {
|
|
102
|
+
var e;
|
|
103
|
+
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";
|
|
104
|
+
}, Q = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), yt = (t) => {
|
|
105
|
+
let n = t.parentElement;
|
|
106
106
|
for (; n && n !== document.body; ) {
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
107
|
+
const e = window.getComputedStyle(n);
|
|
108
|
+
if (Q.has(e.overflowY) || Q.has(e.overflowX))
|
|
109
109
|
return n;
|
|
110
110
|
n = n.parentElement;
|
|
111
111
|
}
|
|
112
112
|
return document.documentElement;
|
|
113
|
-
},
|
|
114
|
-
let n =
|
|
113
|
+
}, pt = (t) => {
|
|
114
|
+
let n = t.parentElement;
|
|
115
115
|
for (; n && n !== document.body; ) {
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
116
|
+
const e = window.getComputedStyle(n).position;
|
|
117
|
+
if (e === "relative" || e === "absolute" || e === "fixed" || e === "sticky")
|
|
118
118
|
return n;
|
|
119
119
|
n = n.parentElement;
|
|
120
120
|
}
|
|
121
121
|
return document.body;
|
|
122
122
|
};
|
|
123
|
-
function
|
|
124
|
-
const n = Object.keys(
|
|
125
|
-
return Promise.all(n.map((
|
|
123
|
+
function Et(t) {
|
|
124
|
+
const n = Object.keys(t);
|
|
125
|
+
return Promise.all(n.map((e) => t[e])).then((e) => {
|
|
126
126
|
const o = {};
|
|
127
|
-
return n.forEach((
|
|
128
|
-
o[
|
|
127
|
+
return n.forEach((i, f) => {
|
|
128
|
+
o[i] = e[f];
|
|
129
129
|
}), o;
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
const n =
|
|
134
|
-
from:
|
|
135
|
-
to:
|
|
136
|
-
transition:
|
|
132
|
+
function vt(t) {
|
|
133
|
+
const n = t.filter((e) => e.symmetric).map((e) => ({
|
|
134
|
+
from: e.to,
|
|
135
|
+
to: e.from,
|
|
136
|
+
transition: e.transition
|
|
137
137
|
}));
|
|
138
|
-
return [...
|
|
138
|
+
return [...t, ...n];
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function W(t, n) {
|
|
141
141
|
if (n === "*")
|
|
142
142
|
return !0;
|
|
143
143
|
if (n.endsWith("/*")) {
|
|
144
|
-
const
|
|
145
|
-
return
|
|
144
|
+
const e = n.slice(0, -1);
|
|
145
|
+
return t.startsWith(e) && t.length > e.length;
|
|
146
146
|
}
|
|
147
|
-
return
|
|
147
|
+
return t === n;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
for (const o of
|
|
151
|
-
if (
|
|
149
|
+
function Tt(t, n, e) {
|
|
150
|
+
for (const o of e)
|
|
151
|
+
if (W(t, o.from) && W(n, o.to))
|
|
152
152
|
return o.transition;
|
|
153
|
-
for (const o of
|
|
154
|
-
if ((o.from === "*" ||
|
|
153
|
+
for (const o of e)
|
|
154
|
+
if ((o.from === "*" || W(t, o.from)) && (o.to === "*" || W(n, o.to)))
|
|
155
155
|
return o.transition;
|
|
156
156
|
return null;
|
|
157
157
|
}
|
|
158
|
-
const
|
|
159
|
-
function
|
|
160
|
-
const { preserveScroll: n = (
|
|
161
|
-
let o = null,
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
return
|
|
165
|
-
},
|
|
158
|
+
const bt = 768, wt = 10, St = 10;
|
|
159
|
+
function Rt(t = {}) {
|
|
160
|
+
const { preserveScroll: n = (c) => c } = t, e = typeof n == "function" ? n : () => n;
|
|
161
|
+
let o = null, i = !1, f = !1;
|
|
162
|
+
const l = () => {
|
|
163
|
+
const c = (o == null ? void 0 : o.clientWidth) ?? 0, a = c > 0 ? c : typeof window < "u" ? window.innerWidth : 0;
|
|
164
|
+
return a > 0 && a < bt;
|
|
165
|
+
}, d = () => (f || (i = l(), f = !0), i), g = (c) => {
|
|
166
166
|
var v;
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
169
|
-
return { preserves: !1, shared: !1, storageKey: `path:${
|
|
170
|
-
if (
|
|
171
|
-
return { preserves: !0, shared: !1, storageKey: `path:${
|
|
172
|
-
const
|
|
167
|
+
const a = e(d());
|
|
168
|
+
if (a === !1)
|
|
169
|
+
return { preserves: !1, shared: !1, storageKey: `path:${c}` };
|
|
170
|
+
if (a === !0)
|
|
171
|
+
return { preserves: !0, shared: !1, storageKey: `path:${c}` };
|
|
172
|
+
const p = ((v = a.exclude) == null ? void 0 : v.some((r) => W(c, r))) ?? !1, E = !p && !!a.key;
|
|
173
173
|
return {
|
|
174
|
-
preserves: !
|
|
175
|
-
shared:
|
|
176
|
-
storageKey:
|
|
174
|
+
preserves: !p,
|
|
175
|
+
shared: E,
|
|
176
|
+
storageKey: E ? `shared:${a.key}` : `path:${c}`
|
|
177
177
|
};
|
|
178
|
-
},
|
|
179
|
-
let
|
|
180
|
-
const
|
|
181
|
-
let
|
|
178
|
+
}, L = (c) => g(c).preserves;
|
|
179
|
+
let A = null;
|
|
180
|
+
const y = /* @__PURE__ */ new Map();
|
|
181
|
+
let S = null, O = !1, k = 0;
|
|
182
182
|
const I = () => {
|
|
183
|
-
o &&
|
|
183
|
+
o && S && !O && y.set(g(S).storageKey, {
|
|
184
184
|
x: o.scrollLeft,
|
|
185
185
|
y: o.scrollTop
|
|
186
186
|
});
|
|
187
|
-
},
|
|
187
|
+
}, _ = (c) => {
|
|
188
188
|
if (!o) return;
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
189
|
+
const a = g(c);
|
|
190
|
+
if (a.preserves && a.shared && !y.has(a.storageKey))
|
|
191
191
|
return;
|
|
192
|
-
const
|
|
193
|
-
let
|
|
192
|
+
const p = a.preserves && y.has(a.storageKey) ? y.get(a.storageKey) : { x: 0, y: 0 };
|
|
193
|
+
let E = 0;
|
|
194
194
|
const v = () => {
|
|
195
195
|
if (!o) return;
|
|
196
196
|
o.scrollTo({
|
|
197
|
-
top:
|
|
198
|
-
left:
|
|
199
|
-
}), !(Math.abs(o.scrollTop -
|
|
197
|
+
top: p.y,
|
|
198
|
+
left: p.x
|
|
199
|
+
}), !(Math.abs(o.scrollTop - p.y) < 1 && Math.abs(o.scrollLeft - p.x) < 1) && E < wt && (E++, requestAnimationFrame(v));
|
|
200
200
|
};
|
|
201
201
|
requestAnimationFrame(v);
|
|
202
202
|
};
|
|
203
203
|
return {
|
|
204
|
-
initializeContext: (
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
initializeContext: (c, a) => {
|
|
205
|
+
O = !0;
|
|
206
|
+
const p = ++k;
|
|
207
|
+
A = c, o || (o = yt(c), i = l(), f = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
|
|
208
|
+
i = l();
|
|
209
209
|
}).observe(o), (o === document.documentElement ? window : o).addEventListener("scroll", I, {
|
|
210
210
|
passive: !0
|
|
211
|
-
})),
|
|
212
|
-
let
|
|
211
|
+
})), S = a, _(a);
|
|
212
|
+
let E = 0;
|
|
213
213
|
const v = () => {
|
|
214
|
-
|
|
214
|
+
p === k && (E++, E >= St ? O = !1 : requestAnimationFrame(v));
|
|
215
215
|
};
|
|
216
216
|
requestAnimationFrame(v);
|
|
217
217
|
},
|
|
218
|
-
calculateScrollOffset: (
|
|
219
|
-
const
|
|
218
|
+
calculateScrollOffset: (c, a) => {
|
|
219
|
+
const p = c ? g(c).storageKey : null, E = p && y.has(p) ? y.get(p) : { x: 0, y: 0 }, v = a ? g(a) : null, r = v != null && v.preserves ? v.storageKey : null, s = r && y.has(r) ? y.get(r) : { x: 0, y: 0 };
|
|
220
220
|
return {
|
|
221
|
-
x: -s.x +
|
|
222
|
-
y: -s.y +
|
|
221
|
+
x: -s.x + E.x,
|
|
222
|
+
y: -s.y + E.y
|
|
223
223
|
};
|
|
224
224
|
},
|
|
225
|
-
evictScrollPosition: (
|
|
226
|
-
|
|
225
|
+
evictScrollPosition: (c) => {
|
|
226
|
+
y.delete(g(c).storageKey);
|
|
227
227
|
},
|
|
228
|
-
shouldPreserve:
|
|
228
|
+
shouldPreserve: L,
|
|
229
229
|
getScrollContainer: () => o,
|
|
230
|
-
getPositionedParentElement: () =>
|
|
231
|
-
getScrollPosition: (
|
|
232
|
-
const
|
|
233
|
-
return
|
|
230
|
+
getPositionedParentElement: () => A ? pt(A) : document.body,
|
|
231
|
+
getScrollPosition: (c) => {
|
|
232
|
+
const a = c ? g(c).storageKey : null;
|
|
233
|
+
return a && y.has(a) ? y.get(a) : { x: 0, y: 0 };
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
|
-
const
|
|
238
|
-
function
|
|
239
|
-
let
|
|
240
|
-
const
|
|
241
|
-
for (let
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
237
|
+
const tt = 30, et = 8, nt = 1.2, ot = 30, At = 600;
|
|
238
|
+
function Ot() {
|
|
239
|
+
let t = null, n = !1, e = !1, o = null, i = null, f = !1;
|
|
240
|
+
const l = (u, h) => {
|
|
241
|
+
for (let m = 0; m < u.length; m++) {
|
|
242
|
+
const T = u.item(m);
|
|
243
|
+
if (T && T.identifier === h) return T;
|
|
244
244
|
}
|
|
245
245
|
return null;
|
|
246
|
-
},
|
|
246
|
+
}, d = () => {
|
|
247
247
|
o !== null && (clearTimeout(o), o = null);
|
|
248
|
-
},
|
|
249
|
-
|
|
250
|
-
},
|
|
251
|
-
n = !0,
|
|
252
|
-
n = !1,
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
if (
|
|
256
|
-
|
|
248
|
+
}, g = () => {
|
|
249
|
+
i !== null && (clearTimeout(i), i = null);
|
|
250
|
+
}, L = () => {
|
|
251
|
+
n = !0, e = !0, d(), g(), o = setTimeout(() => {
|
|
252
|
+
n = !1, e = !1, o = null;
|
|
253
|
+
}, At);
|
|
254
|
+
}, A = (u) => {
|
|
255
|
+
if (u.touches.length !== 1) {
|
|
256
|
+
t = null;
|
|
257
257
|
return;
|
|
258
258
|
}
|
|
259
|
-
const
|
|
260
|
-
if (!
|
|
261
|
-
|
|
259
|
+
const h = u.touches.item(0);
|
|
260
|
+
if (!h) {
|
|
261
|
+
t = null;
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
|
-
const
|
|
265
|
-
if (!
|
|
266
|
-
|
|
264
|
+
const m = window.innerWidth, T = h.clientX <= tt, R = h.clientX >= m - tt;
|
|
265
|
+
if (!T && !R) {
|
|
266
|
+
t = null;
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
|
-
|
|
270
|
-
identifier:
|
|
271
|
-
startX:
|
|
272
|
-
startY:
|
|
273
|
-
fromLeftEdge:
|
|
269
|
+
t = {
|
|
270
|
+
identifier: h.identifier,
|
|
271
|
+
startX: h.clientX,
|
|
272
|
+
startY: h.clientY,
|
|
273
|
+
fromLeftEdge: T,
|
|
274
274
|
moved: !1
|
|
275
275
|
};
|
|
276
|
-
},
|
|
277
|
-
if (!
|
|
278
|
-
if (
|
|
279
|
-
|
|
276
|
+
}, y = (u) => {
|
|
277
|
+
if (!t) return;
|
|
278
|
+
if (u.touches.length !== 1) {
|
|
279
|
+
t = null;
|
|
280
280
|
return;
|
|
281
281
|
}
|
|
282
|
-
const
|
|
283
|
-
if (!
|
|
284
|
-
|
|
282
|
+
const h = l(u.touches, t.identifier);
|
|
283
|
+
if (!h) {
|
|
284
|
+
t = null;
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
|
-
const
|
|
288
|
-
if (
|
|
289
|
-
|
|
287
|
+
const m = h.clientX - t.startX, T = h.clientY - t.startY, R = Math.abs(m), c = Math.abs(T);
|
|
288
|
+
if (c > et && c > R * nt) {
|
|
289
|
+
t = null;
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
},
|
|
295
|
-
if (!
|
|
296
|
-
const
|
|
297
|
-
if (!
|
|
298
|
-
|
|
292
|
+
const a = t.fromLeftEdge ? m > 0 : m < 0;
|
|
293
|
+
R > et && R > c * nt && a && (t.moved = !0);
|
|
294
|
+
}, S = (u) => {
|
|
295
|
+
if (!t) return;
|
|
296
|
+
const h = l(u.changedTouches, t.identifier);
|
|
297
|
+
if (!h) {
|
|
298
|
+
t = null;
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
303
|
-
|
|
301
|
+
const m = h.clientX - t.startX, T = t.fromLeftEdge ? m > 0 : m < 0;
|
|
302
|
+
if (t.moved && T && Math.abs(m) >= ot) {
|
|
303
|
+
L(), t = null;
|
|
304
304
|
return;
|
|
305
305
|
}
|
|
306
|
-
|
|
307
|
-
},
|
|
308
|
-
|
|
306
|
+
t.moved && Math.abs(m) >= ot && L(), t = null;
|
|
307
|
+
}, O = () => {
|
|
308
|
+
t && (t.moved && L(), t = null);
|
|
309
309
|
};
|
|
310
310
|
return { initialize: () => {
|
|
311
|
-
if (typeof window > "u" ||
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
window.addEventListener("touchstart",
|
|
311
|
+
if (typeof window > "u" || f) return;
|
|
312
|
+
f = !0;
|
|
313
|
+
const u = { passive: !0, capture: !0 };
|
|
314
|
+
window.addEventListener("touchstart", A, u), window.addEventListener("touchmove", y, u), window.addEventListener("touchend", S, u), window.addEventListener("touchcancel", O, u);
|
|
315
315
|
}, destroy: () => {
|
|
316
|
-
if (typeof window > "u" || !
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
window.removeEventListener("touchstart",
|
|
316
|
+
if (typeof window > "u" || !f) return;
|
|
317
|
+
f = !1;
|
|
318
|
+
const u = { capture: !0 };
|
|
319
|
+
window.removeEventListener("touchstart", A, u), window.removeEventListener("touchmove", y, u), window.removeEventListener("touchend", S, u), window.removeEventListener("touchcancel", O, u), d(), g(), t = null, n = !1, e = !1;
|
|
320
320
|
}, isSwipeBack: () => {
|
|
321
|
-
const
|
|
322
|
-
return
|
|
321
|
+
const u = n || e;
|
|
322
|
+
return u && d(), u;
|
|
323
323
|
}, onPageEnter: () => {
|
|
324
|
-
n = !1,
|
|
325
|
-
|
|
324
|
+
n = !1, d(), g(), i = setTimeout(() => {
|
|
325
|
+
e = !1, i = null;
|
|
326
326
|
}, 0);
|
|
327
327
|
} };
|
|
328
328
|
}
|
|
329
|
-
function
|
|
330
|
-
let
|
|
329
|
+
function Pt() {
|
|
330
|
+
let t = null;
|
|
331
331
|
function n() {
|
|
332
|
-
var o,
|
|
333
|
-
|
|
332
|
+
var o, i;
|
|
333
|
+
t && ((o = t.outResolve) == null || o.call(t, null), (i = t.inResolve) == null || i.call(t, null), t = null);
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
if (
|
|
337
|
-
if (
|
|
335
|
+
function e() {
|
|
336
|
+
if (t != null && t.from && (t != null && t.to) && (t != null && t.outResolve) && (t != null && t.inResolve)) {
|
|
337
|
+
if (t.from === t.to) {
|
|
338
338
|
n();
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
341
|
-
const o = { from:
|
|
342
|
-
|
|
341
|
+
const o = { from: t.from, to: t.to };
|
|
342
|
+
t.outResolve(o), t.inResolve(o), t = null;
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
return {
|
|
346
|
-
trigger(o,
|
|
347
|
-
var
|
|
348
|
-
|
|
346
|
+
trigger(o, i) {
|
|
347
|
+
var l;
|
|
348
|
+
i === "out" && (t == null ? void 0 : t.to) === o && !t.from && ((l = t.inResolve) == null || l.call(t, null), t = {}), t && (i === "out" && t.from && t.from !== o || i === "in" && t.to && t.to !== o) && n(), t || (t = {}), i === "out" ? t.from = o : t.to = o;
|
|
349
349
|
},
|
|
350
350
|
get(o) {
|
|
351
|
-
return new Promise((
|
|
352
|
-
|
|
351
|
+
return new Promise((i) => {
|
|
352
|
+
t || (t = {}), o === "out" ? t.outResolve = i : t.inResolve = i, e();
|
|
353
353
|
});
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
|
-
const
|
|
358
|
-
let
|
|
359
|
-
function
|
|
360
|
-
if (
|
|
361
|
-
const n =
|
|
362
|
-
|
|
357
|
+
const B = /* @__PURE__ */ new Map();
|
|
358
|
+
let H = null, rt = !1;
|
|
359
|
+
function it(t) {
|
|
360
|
+
if (t instanceof HTMLElement && B.has(t)) {
|
|
361
|
+
const n = B.get(t);
|
|
362
|
+
B.delete(t), queueMicrotask(n);
|
|
363
363
|
}
|
|
364
|
-
for (const n of Array.from(
|
|
365
|
-
|
|
364
|
+
for (const n of Array.from(t.childNodes))
|
|
365
|
+
it(n);
|
|
366
366
|
}
|
|
367
|
-
function
|
|
368
|
-
if (
|
|
369
|
-
|
|
370
|
-
for (const
|
|
371
|
-
for (const o of Array.from(
|
|
372
|
-
|
|
367
|
+
function Lt() {
|
|
368
|
+
if (rt || typeof document > "u") return;
|
|
369
|
+
rt = !0, H = new MutationObserver((n) => {
|
|
370
|
+
for (const e of n)
|
|
371
|
+
for (const o of Array.from(e.removedNodes))
|
|
372
|
+
it(o);
|
|
373
373
|
});
|
|
374
|
-
const
|
|
375
|
-
|
|
374
|
+
const t = () => {
|
|
375
|
+
H == null || H.observe(document.body, { childList: !0, subtree: !0 });
|
|
376
376
|
};
|
|
377
|
-
document.body ?
|
|
377
|
+
document.body ? t() : document.addEventListener("DOMContentLoaded", t, { once: !0 });
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
return
|
|
381
|
-
|
|
379
|
+
function _t(t, n) {
|
|
380
|
+
return Lt(), B.set(t, n), () => {
|
|
381
|
+
B.delete(t);
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
return Array.isArray(
|
|
384
|
+
function Mt(t) {
|
|
385
|
+
return Array.isArray(t);
|
|
386
386
|
}
|
|
387
|
-
function
|
|
387
|
+
function lt(t) {
|
|
388
388
|
const n = [];
|
|
389
|
-
for (const
|
|
390
|
-
|
|
389
|
+
for (const e of t)
|
|
390
|
+
Mt(e) ? n.push(...lt(e)) : n.push(e);
|
|
391
391
|
return n;
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function Dt(t, n = {}) {
|
|
394
394
|
const {
|
|
395
|
-
transitions:
|
|
395
|
+
transitions: e = [],
|
|
396
396
|
middleware: o = (r, s) => ({ from: r, to: s }),
|
|
397
|
-
preserveScroll:
|
|
398
|
-
} =
|
|
399
|
-
|
|
400
|
-
),
|
|
401
|
-
|
|
397
|
+
preserveScroll: i = (r) => r
|
|
398
|
+
} = t, f = n.host ?? new mt(), l = Pt(), d = vt(
|
|
399
|
+
lt(e)
|
|
400
|
+
), g = Ot();
|
|
401
|
+
g.initialize();
|
|
402
402
|
const {
|
|
403
|
-
initializeContext:
|
|
404
|
-
calculateScrollOffset:
|
|
405
|
-
evictScrollPosition:
|
|
406
|
-
shouldPreserve:
|
|
407
|
-
getScrollContainer:
|
|
408
|
-
getPositionedParentElement:
|
|
403
|
+
initializeContext: L,
|
|
404
|
+
calculateScrollOffset: A,
|
|
405
|
+
evictScrollPosition: y,
|
|
406
|
+
shouldPreserve: S,
|
|
407
|
+
getScrollContainer: O,
|
|
408
|
+
getPositionedParentElement: k,
|
|
409
409
|
getScrollPosition: I
|
|
410
|
-
} =
|
|
411
|
-
let
|
|
412
|
-
const
|
|
413
|
-
|
|
410
|
+
} = Rt({ preserveScroll: i });
|
|
411
|
+
let _ = null, x = null;
|
|
412
|
+
const u = /* @__PURE__ */ new WeakMap(), h = (r) => {
|
|
413
|
+
u.set(r, {
|
|
414
414
|
parent: r.parentElement,
|
|
415
415
|
nextSibling: r.nextElementSibling
|
|
416
416
|
});
|
|
417
|
-
},
|
|
418
|
-
const s =
|
|
417
|
+
}, m = (r) => {
|
|
418
|
+
const s = u.get(r);
|
|
419
419
|
return s || {
|
|
420
420
|
parent: r.parentElement,
|
|
421
421
|
nextSibling: r.nextElementSibling
|
|
422
422
|
};
|
|
423
|
-
},
|
|
424
|
-
const
|
|
425
|
-
|
|
423
|
+
}, T = (r, s, w, b, D) => {
|
|
424
|
+
const N = b.element, X = D.element, { parent: M, nextSibling: C } = b.parent ? { parent: b.parent, nextSibling: b.nextSibling } : m(N), P = N.cloneNode(!0);
|
|
425
|
+
P.setAttribute("data-ssgoi-clone", "");
|
|
426
|
+
const z = {
|
|
427
|
+
scrollOffset: A(s, w),
|
|
426
428
|
from: { scroll: I(s) },
|
|
427
|
-
to: { scroll: I(
|
|
429
|
+
to: { scroll: I(w) },
|
|
428
430
|
get scrollingElement() {
|
|
429
|
-
return
|
|
431
|
+
return O() || document.documentElement;
|
|
430
432
|
},
|
|
431
433
|
get positionedParent() {
|
|
432
|
-
return
|
|
434
|
+
return k();
|
|
433
435
|
}
|
|
434
436
|
};
|
|
435
|
-
|
|
436
|
-
const
|
|
437
|
-
from:
|
|
438
|
-
to:
|
|
439
|
-
context:
|
|
440
|
-
createElement: ((q
|
|
441
|
-
const
|
|
442
|
-
return
|
|
437
|
+
gt(P, z), S(s) || y(s);
|
|
438
|
+
const Z = Promise.resolve(P), j = Promise.resolve(X), J = [], at = {
|
|
439
|
+
from: Z,
|
|
440
|
+
to: j,
|
|
441
|
+
context: z,
|
|
442
|
+
createElement: (($, q = "div") => {
|
|
443
|
+
const K = document.createElement(q);
|
|
444
|
+
return K.setAttribute("data-ssgoi-id", $), J.push(K), K;
|
|
443
445
|
})
|
|
444
|
-
},
|
|
445
|
-
r.prepare ? r.prepare(
|
|
446
|
+
}, ut = Promise.resolve(
|
|
447
|
+
r.prepare ? r.prepare(at) : {}
|
|
446
448
|
);
|
|
447
|
-
|
|
448
|
-
from:
|
|
449
|
-
to:
|
|
450
|
-
extras:
|
|
451
|
-
}).then(({ from:
|
|
452
|
-
|
|
453
|
-
const
|
|
454
|
-
from:
|
|
455
|
-
to:
|
|
456
|
-
context:
|
|
457
|
-
...
|
|
458
|
-
}),
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
for (const
|
|
462
|
-
|
|
463
|
-
},
|
|
449
|
+
Et({
|
|
450
|
+
from: Z,
|
|
451
|
+
to: j,
|
|
452
|
+
extras: ut
|
|
453
|
+
}).then(({ from: $, to: q, extras: K }) => {
|
|
454
|
+
M && (C && M.contains(C) ? M.insertBefore(P, C) : M.appendChild(P));
|
|
455
|
+
const U = r.animation({
|
|
456
|
+
from: $,
|
|
457
|
+
to: q,
|
|
458
|
+
context: z,
|
|
459
|
+
...K
|
|
460
|
+
}), Y = U.onComplete;
|
|
461
|
+
U.onComplete = () => {
|
|
462
|
+
Y == null || Y(), P.parentElement && P.parentElement.removeChild(P);
|
|
463
|
+
for (const G of J)
|
|
464
|
+
G.parentElement && G.parentElement.removeChild(G);
|
|
465
|
+
}, f.attach(U);
|
|
464
466
|
});
|
|
465
|
-
},
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
if (s === "in" &&
|
|
469
|
-
if (
|
|
470
|
-
s === "out" &&
|
|
467
|
+
}, R = (r, s) => {
|
|
468
|
+
const w = g.isSwipeBack();
|
|
469
|
+
l.trigger(r, s), l.get(s).then((b) => {
|
|
470
|
+
if (s === "in" && g.onPageEnter(), !b) return;
|
|
471
|
+
if (w) {
|
|
472
|
+
s === "out" && b.from && !S(b.from) && y(b.from), _ = null, x = null;
|
|
471
473
|
return;
|
|
472
474
|
}
|
|
473
475
|
if (s !== "in") return;
|
|
474
|
-
const { from:
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
),
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
),
|
|
482
|
-
|
|
476
|
+
const { from: D, to: N } = o(
|
|
477
|
+
b.from,
|
|
478
|
+
b.to
|
|
479
|
+
), X = Tt(
|
|
480
|
+
D,
|
|
481
|
+
N,
|
|
482
|
+
d
|
|
483
|
+
), M = _, C = x;
|
|
484
|
+
_ = null, x = null, !(!X || !M || !C) && T(X, D, N, M, C);
|
|
483
485
|
});
|
|
484
|
-
},
|
|
485
|
-
const
|
|
486
|
-
|
|
486
|
+
}, c = (r, s) => {
|
|
487
|
+
const w = m(r);
|
|
488
|
+
_ = {
|
|
487
489
|
element: r,
|
|
488
|
-
parent:
|
|
489
|
-
nextSibling:
|
|
490
|
+
parent: w.parent,
|
|
491
|
+
nextSibling: w.nextSibling
|
|
490
492
|
};
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
},
|
|
494
|
-
|
|
493
|
+
const b = r.getAttribute("data-ssgoi-transition") ?? s;
|
|
494
|
+
R(b, "out");
|
|
495
|
+
}, a = /* @__PURE__ */ new WeakSet(), p = (r, s) => {
|
|
496
|
+
a.has(s) || (a.add(s), h(s), L(s, r), x = {
|
|
495
497
|
element: s,
|
|
496
498
|
parent: s.parentElement,
|
|
497
499
|
nextSibling: s.nextElementSibling
|
|
498
|
-
},
|
|
499
|
-
},
|
|
500
|
-
return { register:
|
|
501
|
-
let s =
|
|
502
|
-
return s || (s = (
|
|
503
|
-
|
|
504
|
-
},
|
|
500
|
+
}, R(r, "in"), _t(s, () => c(s, r)));
|
|
501
|
+
}, E = /* @__PURE__ */ new Map();
|
|
502
|
+
return { register: p, refFor: (r) => {
|
|
503
|
+
let s = E.get(r);
|
|
504
|
+
return s || (s = (w) => {
|
|
505
|
+
w && p(r, w);
|
|
506
|
+
}, E.set(r, s)), s;
|
|
505
507
|
} };
|
|
506
508
|
}
|
|
509
|
+
const ct = "data-ssgoi-root", xt = `[${ct}]`, V = "data-ssgoi-transition", st = `[${V}]`, Ct = "[data-ssgoi-clone]";
|
|
510
|
+
function kt() {
|
|
511
|
+
return typeof MutationObserver < "u" && typeof HTMLElement < "u" && typeof Node < "u";
|
|
512
|
+
}
|
|
513
|
+
function It(t) {
|
|
514
|
+
return t.nodeType === Node.ELEMENT_NODE;
|
|
515
|
+
}
|
|
516
|
+
function Nt(t) {
|
|
517
|
+
return t instanceof HTMLElement;
|
|
518
|
+
}
|
|
519
|
+
function Xt(t, n) {
|
|
520
|
+
if (!kt()) return () => {
|
|
521
|
+
};
|
|
522
|
+
t.setAttribute(ct, "");
|
|
523
|
+
const e = (l) => l.closest(xt) === t, o = (l) => {
|
|
524
|
+
if (!Nt(l) || !e(l) || l.closest(Ct))
|
|
525
|
+
return;
|
|
526
|
+
const d = l.getAttribute(V);
|
|
527
|
+
d !== null && n.register(d, l);
|
|
528
|
+
}, i = (l) => {
|
|
529
|
+
if (It(l)) {
|
|
530
|
+
l.matches(st) && o(l);
|
|
531
|
+
for (const d of l.querySelectorAll(st))
|
|
532
|
+
o(d);
|
|
533
|
+
}
|
|
534
|
+
}, f = new MutationObserver((l) => {
|
|
535
|
+
for (const d of l) {
|
|
536
|
+
if (d.type === "attributes") {
|
|
537
|
+
o(d.target);
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
for (const g of d.addedNodes)
|
|
541
|
+
i(g);
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
return f.observe(t, {
|
|
545
|
+
childList: !0,
|
|
546
|
+
subtree: !0,
|
|
547
|
+
attributes: !0,
|
|
548
|
+
attributeFilter: [V]
|
|
549
|
+
}), i(t), () => f.disconnect();
|
|
550
|
+
}
|
|
507
551
|
export {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
552
|
+
ht as Animation,
|
|
553
|
+
mt as HostAnimation,
|
|
554
|
+
$t as MultiAnimation,
|
|
555
|
+
qt as WebAnimation,
|
|
556
|
+
Dt as createSggoiTransitionContext,
|
|
557
|
+
Xt as observeSsgoiTransitions
|
|
513
558
|
};
|
|
@@ -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,CA4Pd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-ssgoi-transitions.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/observe-ssgoi-transitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAwB3C,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,YAAY,GAClB,MAAM,IAAI,CAyDZ"}
|