@ssgoi/core 7.0.0-beta.0 → 7.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -252
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +630 -539
- package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
- package/dist/ssgoi-transition/navigation-detector-strategy.d.ts +24 -9
- package/dist/ssgoi-transition/navigation-detector-strategy.d.ts.map +1 -1
- package/dist/ssgoi-transition/observe-ssgoi-transitions.d.ts +1 -0
- package/dist/ssgoi-transition/observe-ssgoi-transitions.d.ts.map +1 -1
- package/dist/ssgoi-transition/unmount-observer.d.ts +11 -2
- package/dist/ssgoi-transition/unmount-observer.d.ts.map +1 -1
- package/dist/transitions/drill/index.d.ts +1 -1
- package/dist/transitions/sheet/index.d.ts +1 -1
- package/dist/types/index.d.ts +10 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,292 +1,122 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ssgoi/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Framework-agnostic route transition engine for SSGOI.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://ssgoi.dev)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[Live demos](https://ssgoi.dev) · [Hero, Zoom, Film, and Sheet in motion](https://ssgoi.dev/blog/view-transition-api-limitations)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## AI-Assisted Setup
|
|
12
|
-
|
|
13
|
-
Using Claude, Cursor, ChatGPT, or another AI assistant? Point it at:
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
https://ssgoi.dev/llms.txt
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
It has the full setup guide, every transition, the API, and troubleshooting — everything an agent needs to wire SSGOI into your app.
|
|
20
|
-
|
|
21
|
-
## What is SSGOI?
|
|
22
|
-
|
|
23
|
-
SSGOI brings native app-like page transitions to the web. Transform your static page navigations into smooth, delightful experiences that users love.
|
|
24
|
-
|
|
25
|
-
### ✨ Key Features
|
|
26
|
-
|
|
27
|
-
- **🌍 Works Everywhere** - Unlike the browser's View Transition API, SSGOI works in all modern browsers (Chrome, Firefox, Safari)
|
|
28
|
-
- **🚀 SSR Ready** - Perfect compatibility with Next.js, Nuxt, SvelteKit, SolidStart, Qwik City. No hydration issues, SEO-friendly
|
|
29
|
-
- **🎯 Use Your Router** - Keep your existing routing. React Router, Next.js App Router, SvelteKit, Qwik City - all work seamlessly
|
|
30
|
-
- **💾 State Persistence** - Remembers animation state during navigation, even with browser back/forward
|
|
31
|
-
- **🎨 Framework Agnostic** - One consistent API for React, Svelte, Vue, Solid, Angular, and more
|
|
32
|
-
|
|
33
|
-
## Quick Start
|
|
34
|
-
|
|
35
|
-
### Installation
|
|
9
|
+
Most applications should install a framework package:
|
|
36
10
|
|
|
37
11
|
```bash
|
|
38
|
-
# Pick the binding for your framework
|
|
39
12
|
npm install @ssgoi/react
|
|
40
|
-
# or @ssgoi/svelte, @ssgoi/vue, @ssgoi/solid, @ssgoi/
|
|
13
|
+
# or @ssgoi/svelte, @ssgoi/vue, @ssgoi/solid, @ssgoi/qwik
|
|
41
14
|
```
|
|
42
15
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
#### 1. Wrap your React app
|
|
46
|
-
|
|
47
|
-
```tsx
|
|
48
|
-
import { Ssgoi } from "@ssgoi/react";
|
|
49
|
-
import { fade } from "@ssgoi/react/view-transitions";
|
|
50
|
-
import { SsgoiTransitionBoundary } from "./ssgoi-transition-boundary";
|
|
16
|
+
Agent setup guide: https://ssgoi.dev/llms.txt
|
|
51
17
|
|
|
52
|
-
|
|
53
|
-
transitions: [{ from: "/", to: "/about", transition: fade() }],
|
|
54
|
-
};
|
|
18
|
+
## Configuration
|
|
55
19
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<div className="relative z-0 min-h-dvh bg-white">
|
|
59
|
-
{/* Layout shell above: positioned ancestor + stacking context for the OUT clone. */}
|
|
60
|
-
<Ssgoi config={config}>
|
|
61
|
-
{/* Routed content marker. Layout positioning belongs to the outer wrapper. */}
|
|
62
|
-
<SsgoiTransitionBoundary className="min-h-full bg-white">
|
|
63
|
-
{/* Your app */}
|
|
64
|
-
</SsgoiTransitionBoundary>
|
|
65
|
-
</Ssgoi>
|
|
66
|
-
</div>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
```
|
|
20
|
+
`SsgoiConfig` contains route matching and effects. Layout lifetime belongs to
|
|
21
|
+
framework-specific transition boundaries, not this config.
|
|
70
22
|
|
|
71
|
-
|
|
23
|
+
```ts
|
|
24
|
+
import { drill, slide, zoom, type SsgoiConfig } from "@ssgoi/core";
|
|
72
25
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
For React adapters, create one router-specific `SsgoiTransitionBoundary` utility
|
|
85
|
-
in your layout. It reads the current pathname internally, sets the transition
|
|
86
|
-
boundary key, and uses that pathname as a logical page id matched by config such
|
|
87
|
-
as `/products/*`. Use `/products/**` when the parent path itself should match
|
|
88
|
-
too.
|
|
89
|
-
|
|
90
|
-
Next.js implementation:
|
|
91
|
-
|
|
92
|
-
```tsx
|
|
93
|
-
"use client";
|
|
94
|
-
|
|
95
|
-
import { type ElementType, type ReactNode } from "react";
|
|
96
|
-
import { usePathname } from "next/navigation";
|
|
97
|
-
|
|
98
|
-
export function SsgoiTransitionBoundary({
|
|
99
|
-
children,
|
|
100
|
-
as,
|
|
101
|
-
className,
|
|
102
|
-
}: {
|
|
103
|
-
children: ReactNode;
|
|
104
|
-
as?: ElementType;
|
|
105
|
-
className?: string;
|
|
106
|
-
}) {
|
|
107
|
-
const pathname = usePathname();
|
|
108
|
-
const Component = as ?? "div";
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<Component
|
|
112
|
-
key={pathname}
|
|
113
|
-
data-ssgoi-transition={pathname}
|
|
114
|
-
className={className}
|
|
115
|
-
>
|
|
116
|
-
{children}
|
|
117
|
-
</Component>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
26
|
+
const config: SsgoiConfig = {
|
|
27
|
+
preserveScroll: { exclude: ["/posts/*"] },
|
|
28
|
+
transitions: [
|
|
29
|
+
{ on: "/posts/**", except: "/posts", transition: drill() },
|
|
30
|
+
{ from: "/gallery", to: "/gallery/*", transition: zoom() },
|
|
31
|
+
{
|
|
32
|
+
ordered: ["/tabs/a", "/tabs/b", "/tabs/c"],
|
|
33
|
+
transition: slide(),
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
120
37
|
```
|
|
121
38
|
|
|
122
|
-
|
|
123
|
-
pathname hook.
|
|
124
|
-
|
|
125
|
-
For SvelteKit, Nuxt/Vue, Solid, Angular, and Qwik, mark each routed page boundary
|
|
126
|
-
directly with `data-ssgoi-transition` instead of using a layout-level utility.
|
|
127
|
-
The value can be a hard-coded logical id; it only has to match your config.
|
|
39
|
+
Rule forms:
|
|
128
40
|
|
|
129
|
-
|
|
41
|
+
- `on`: route family. Entering is forward; leaving is backward.
|
|
42
|
+
- `from`/`to`: precise pair. Reverse matching is enabled by default.
|
|
43
|
+
- `ordered`: array order decides forward and backward.
|
|
44
|
+
- `priority`: higher values win before path specificity.
|
|
130
45
|
|
|
131
|
-
|
|
46
|
+
Path patterns:
|
|
132
47
|
|
|
133
|
-
|
|
48
|
+
- `/posts`: exact.
|
|
49
|
+
- `/posts/*`: exactly one arbitrary segment.
|
|
50
|
+
- `/posts/**`: the parent and every descendant.
|
|
134
51
|
|
|
135
|
-
|
|
136
|
-
|
|
52
|
+
A bare `*` remains a compatibility alias for `/**`. Named single-segment forms
|
|
53
|
+
remain supported and rank above a single-segment `*` when rules overlap, but
|
|
54
|
+
their names are not captured or exposed.
|
|
137
55
|
|
|
138
|
-
|
|
139
|
-
import { fade, drill, zoom } from "@ssgoi/react/view-transitions";
|
|
56
|
+
## Boundary model
|
|
140
57
|
|
|
141
|
-
|
|
142
|
-
transitions: [
|
|
143
|
-
// Calm cross-fade between tabs
|
|
144
|
-
{ from: "/home", to: "/about", transition: fade() },
|
|
58
|
+
A framework adapter observes elements marked with:
|
|
145
59
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
on: "/products/**",
|
|
149
|
-
except: "/products",
|
|
150
|
-
transition: drill(),
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
// Card-to-detail zoom (needs matching data-zoom-*-key)
|
|
154
|
-
{
|
|
155
|
-
from: "/gallery",
|
|
156
|
-
to: "/photo/:id",
|
|
157
|
-
transition: zoom({ type: "expand" }),
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
};
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Route rules come in three shapes:
|
|
164
|
-
|
|
165
|
-
- **`{ on, except?, transition }`** — a route family. Entering is forward,
|
|
166
|
-
leaving is backward, and internal navigation uses popstate/semantic history.
|
|
167
|
-
- **`{ from, to, transition, bidirectional? }`** — a precise pair. Arrays on
|
|
168
|
-
either side mean OR; reverse matching is enabled by default.
|
|
169
|
-
- **`{ ordered, transition }`** — both endpoints must be in the ordered list.
|
|
170
|
-
Increasing index is forward; decreasing index is backward.
|
|
171
|
-
|
|
172
|
-
Rules may set `priority` (default `0`). Candidates are chosen by higher
|
|
173
|
-
priority, then path specificity, then earlier declaration order. Patterns
|
|
174
|
-
support exact paths, `:id` (one dynamic segment), `*` (exactly one arbitrary
|
|
175
|
-
segment), and suffix `**` (zero or more segments).
|
|
176
|
-
|
|
177
|
-
Factories accept only their effect options: `{ type?, variant?, options? }`.
|
|
178
|
-
The dispatcher passes semantic direction through the transition context.
|
|
179
|
-
|
|
180
|
-
### Individual Element Animations
|
|
181
|
-
|
|
182
|
-
Animate specific elements during mount/unmount with `transition()`:
|
|
183
|
-
|
|
184
|
-
```tsx
|
|
185
|
-
import { transition } from "@ssgoi/react";
|
|
186
|
-
import { fade, slide } from "@ssgoi/react/transitions";
|
|
187
|
-
|
|
188
|
-
function Card() {
|
|
189
|
-
return (
|
|
190
|
-
<div
|
|
191
|
-
ref={transition({
|
|
192
|
-
key: "card",
|
|
193
|
-
in: fade(),
|
|
194
|
-
out: slide({ direction: "up" }),
|
|
195
|
-
})}
|
|
196
|
-
>
|
|
197
|
-
<h2>Animated Card</h2>
|
|
198
|
-
</div>
|
|
199
|
-
);
|
|
200
|
-
}
|
|
60
|
+
```html
|
|
61
|
+
<div data-ssgoi-transition="/posts/1">...</div>
|
|
201
62
|
```
|
|
202
63
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
### Page Transitions (`@ssgoi/<framework>/view-transitions`)
|
|
206
|
-
|
|
207
|
-
- `fade` - Calm cross-fade. Safe default for unrelated pages
|
|
208
|
-
- `drill` - iOS-style hierarchical navigation (list → detail)
|
|
209
|
-
- `slide` - Horizontal push for tabs / sequential flows
|
|
210
|
-
- `scroll` - Vertical page scroll for onboarding / paginated views
|
|
211
|
-
- `axis` - Material/Flutter shared-axis swap for sibling/tab routes
|
|
212
|
-
- `sheet` - Bottom sheet that slides up (modal-like flows)
|
|
213
|
-
- `hero` - Shared element transition (matching `data-hero-*-key`)
|
|
214
|
-
- `zoom` - Card-to-detail expansion (matching `data-zoom-*-key`)
|
|
215
|
-
- `strip` - 3D Y-axis perspective flip
|
|
216
|
-
- `blind` - Window-blinds wipe reveal
|
|
217
|
-
- `film` - Cinematic shrink + tile (gallery / lightbox)
|
|
218
|
-
- `rotate` - Card flip between siblings
|
|
219
|
-
- `jaemin` - Playful rotated zoom for special moments
|
|
220
|
-
|
|
221
|
-
### Element Transitions (`@ssgoi/<framework>/transitions`)
|
|
222
|
-
|
|
223
|
-
For mount/unmount of individual elements (not whole pages):
|
|
224
|
-
|
|
225
|
-
- `fade` - Fade in/out
|
|
226
|
-
- `scale` - Scale in/out
|
|
227
|
-
- `slide` - Slide (direction: up/down/left/right)
|
|
228
|
-
- `rotate` - Rotate
|
|
229
|
-
- `bounce` - Bounce
|
|
230
|
-
- `blur` - Blur
|
|
231
|
-
- `fly` - Fly (custom x, y position)
|
|
232
|
-
|
|
233
|
-
## Layout Requirements
|
|
234
|
-
|
|
235
|
-
The outer element wrapping the SSGOI provider / `<Ssgoi>` needs
|
|
236
|
-
`position: relative` and `z-index: 0`.
|
|
237
|
-
|
|
238
|
-
When a page leaves, SSGOI clones it back into the DOM with `position: absolute`
|
|
239
|
-
so it can animate out while the new page animates in. Without a positioned,
|
|
240
|
-
stacking-context ancestor the clone jumps to the wrong place or falls behind the
|
|
241
|
-
background. Add `overflow-x-clip` too if you use horizontal transitions
|
|
242
|
-
(`slide`, `drill`). Keep these layout classes on the outer wrapper, not on the
|
|
243
|
-
route boundary marker.
|
|
244
|
-
|
|
245
|
-
```tsx
|
|
246
|
-
<div className="relative z-0 overflow-x-clip">
|
|
247
|
-
<Ssgoi config={config}>{children}</Ssgoi>
|
|
248
|
-
</div>
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
## Why SSGOI?
|
|
64
|
+
The framework decides when that element is replaced. Nested boundaries follow
|
|
65
|
+
DOM lifetime:
|
|
252
66
|
|
|
253
|
-
|
|
67
|
+
- Parent and child change together: the outer changed boundary owns the event.
|
|
68
|
+
- Parent remains mounted: the changed child owns the event.
|
|
254
69
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
- ✅ Better developer experience
|
|
70
|
+
This supports persistent layouts, inner tab transitions, and bottom navigation
|
|
71
|
+
with one SSGOI instance.
|
|
258
72
|
|
|
259
|
-
|
|
73
|
+
## Transition context
|
|
260
74
|
|
|
261
|
-
|
|
262
|
-
- ✅ SSR-first design
|
|
263
|
-
- ✅ No router lock-in
|
|
264
|
-
- ✅ Minimal bundle size
|
|
75
|
+
Custom effects receive semantic direction through `context`:
|
|
265
76
|
|
|
266
|
-
|
|
77
|
+
```ts
|
|
78
|
+
import { defineTransition } from "@ssgoi/core";
|
|
267
79
|
|
|
268
|
-
|
|
80
|
+
const effect = defineTransition({
|
|
81
|
+
prepare: ({ from, to, context }) => {
|
|
82
|
+
// Pre-paint setup.
|
|
83
|
+
return {};
|
|
84
|
+
},
|
|
85
|
+
animation: ({ from, to, context }) => {
|
|
86
|
+
// context.direction is "forward" or "backward".
|
|
87
|
+
return animation;
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
```
|
|
269
91
|
|
|
270
|
-
|
|
271
|
-
2. **Exit (OUT)**: SSGOI clones the leaving page with `position: absolute` and animates it out
|
|
272
|
-
3. **Enter (IN)**: The new page mounts in place and animates in
|
|
273
|
-
4. **State Sync**: Animation state persists across navigation, including browser back/forward
|
|
92
|
+
## Effect index
|
|
274
93
|
|
|
275
|
-
|
|
94
|
+
- `fade`: unrelated pages.
|
|
95
|
+
- `drill`: list → detail hierarchy.
|
|
96
|
+
- `slide`: ordered tabs and steps.
|
|
97
|
+
- `axis`: sibling destinations.
|
|
98
|
+
- `sheet`: modal-like routes.
|
|
99
|
+
- `zoom`: card or image → detail.
|
|
100
|
+
- `hero`: shared elements plus page chrome.
|
|
101
|
+
- `scroll`: vertical sequences.
|
|
102
|
+
- `strip`, `film`, `rotate`, `blind`, `jaemin`: expressive transitions.
|
|
276
103
|
|
|
277
|
-
|
|
104
|
+
Effect references: https://ssgoi.dev/llms.txt#7-transition-index
|
|
278
105
|
|
|
279
|
-
|
|
106
|
+
## Layout requirements
|
|
280
107
|
|
|
281
|
-
|
|
282
|
-
- Interactive examples
|
|
283
|
-
- Framework integration guides
|
|
284
|
-
- Custom transition recipes
|
|
108
|
+
The shell around the framework root should provide:
|
|
285
109
|
|
|
286
|
-
|
|
110
|
+
```css
|
|
111
|
+
.ssgoi-shell {
|
|
112
|
+
position: relative;
|
|
113
|
+
z-index: 0;
|
|
114
|
+
overflow-x: clip;
|
|
115
|
+
}
|
|
116
|
+
```
|
|
287
117
|
|
|
288
|
-
|
|
118
|
+
`overflow-x: clip` is needed for horizontal effects.
|
|
289
119
|
|
|
290
120
|
## License
|
|
291
121
|
|
|
292
|
-
MIT
|
|
122
|
+
MIT
|
package/dist/internal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Wt=Object.defineProperty;var Ft=(t,n,e)=>n in t?Wt(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var q=(t,n,e)=>Ft(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const nt=require("./multi-animation-6124HEke.cjs");class At extends nt.Animation{constructor(){super(...arguments);q(this,"child",null);q(this,"_state","idle");q(this,"_settled",!1);q(this,"listeners",new Set)}attach(e){const i=this.child;if(this.child=e,this._settled=!1,i){const l=i.getPose();i.complete(),e.matchInto(l)}e.playbackRate=this.playbackRate;const o=e.onComplete;e.onComplete=()=>{o==null||o(),this.child===e&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const r=e.onUpdate;e.onUpdate=l=>{var u;r==null||r(l),(u=this.onUpdate)==null||u.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 i;return((i=this.child)==null?void 0:i.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 i;(i=this.child)==null||i.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 Bt=(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"},St=new Set(["auto","scroll","overlay"]),zt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n);if(St.has(e.overflowY)||St.has(e.overflowX))return n;n=n.parentElement}return document.documentElement},Kt=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 Xt(t){const n=Object.keys(t);return Promise.all(n.map(e=>t[e])).then(e=>{const i={};return n.forEach((o,r)=>{i[o]=e[r]}),i})}const $t=1e6,wt=100,qt=10,Ut=1;function Vt(t){const n=t.trim(),e=n.indexOf("#"),i=n.indexOf("?"),o=[e,i].filter(r=>r>=0).reduce((r,l)=>Math.min(r,l),n.length);return n.slice(0,o)}function G(t){const n=Vt(t);try{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n))return G(new URL(n).pathname)}catch{}const i=(n.startsWith("/")?n:`/${n}`).replace(/\/+/g,"/");return(i.length>1?i.replace(/\/+$/g,""):i)||"/"}function Gt(t){const n=t.trim();return n==="*"?"/**":G(n)}function ut(t){return t==="/"?[]:t.slice(1).split("/")}function Yt(t){return t.startsWith(":")||t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}")}function Ct(t,n){const e=G(t),i=Gt(n);if(e===i)return{matched:!0,specificity:$t+ut(i).length*wt,pattern:n};const o=ut(e),r=ut(i);let l=0;for(let u=0;u<r.length;u++){const y=r[u],d=o[u],S=u===r.length-1;if(y==="**")return{matched:S&&o.length>=u,specificity:l,pattern:n};if(d===void 0||y===void 0)return{matched:!1,specificity:0,pattern:n};if(y==="*"){l+=Ut;continue}if(Yt(y)){l+=qt;continue}if(y!==d)return{matched:!1,specificity:0,pattern:n};l+=wt}return{matched:o.length===r.length,specificity:l,pattern:n}}function I(t,n){const e=typeof n=="string"?[n]:n;let i=null;for(const o of e){const r=Ct(t,o);r.matched&&(!i||r.specificity>i.specificity)&&(i=r)}return i}function Zt(t,n){return Ct(t,n).matched}const jt=768,Qt=10,Jt=10;function te(t={}){const{preserveScroll:n=h=>h,resolvePath:e=h=>h}=t,i=typeof n=="function"?n:()=>n;let o=null,r=!1,l=!1;const u=()=>{const h=(o==null?void 0:o.clientWidth)??0,m=h>0?h:typeof window<"u"?window.innerWidth:0;return m>0&&m<jt},y=()=>(l||(r=u(),l=!0),r),d=h=>{var _;const m=e(h),b=i(y());if(b===!1)return{preserves:!1,shared:!1,storageKey:`path:${m}`};if(b===!0)return{preserves:!0,shared:!1,storageKey:`path:${m}`};const w=((_=b.exclude)==null?void 0:_.some(F=>Zt(m,F)))??!1,E=!w&&!!b.key;return{preserves:!w,shared:E,storageKey:E?`shared:${b.key}`:`path:${m}`}},S=h=>d(h).preserves;let g=null;const f=new Map;let x=null,A=!1,C=0;const k=()=>{o&&x&&!A&&f.set(d(x).storageKey,{x:o.scrollLeft,y:o.scrollTop})},X=h=>{if(!o)return;const m=d(h);if(m.preserves&&m.shared&&!f.has(m.storageKey))return;const b=m.preserves&&f.has(m.storageKey)?f.get(m.storageKey):{x:0,y:0};let w=0;const E=()=>{if(!o)return;o.scrollTo({top:b.y,left:b.x}),!(Math.abs(o.scrollTop-b.y)<1&&Math.abs(o.scrollLeft-b.x)<1)&&w<Qt&&(w++,requestAnimationFrame(E))};requestAnimationFrame(E)};return{initializeContext:(h,m)=>{A=!0;const b=++C;g=h,o||(o=zt(h),r=u(),l=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{r=u()}).observe(o),(o===document.documentElement?window:o).addEventListener("scroll",k,{passive:!0})),x=m,X(m);let w=0;const E=()=>{b===C&&(w++,w>=Jt?A=!1:requestAnimationFrame(E))};requestAnimationFrame(E)},calculateScrollOffset:(h,m)=>{const b=h?d(h).storageKey:null,w=b&&f.has(b)?f.get(b):{x:0,y:0},E=m?d(m):null,_=E!=null&&E.preserves?E.storageKey:null,F=_&&f.has(_)?f.get(_):{x:0,y:0};return{x:-F.x+w.x,y:-F.y+w.y}},evictScrollPosition:h=>{f.delete(d(h).storageKey)},shouldPreserve:S,getScrollContainer:()=>o,getPositionedParentElement:()=>g?Kt(g):document.body,getScrollPosition:h=>{const m=h?d(h).storageKey:null;return m&&f.has(m)?f.get(m):{x:0,y:0}},getIsMobile:y}}const Et=30,Tt=8,Pt=1.2,xt=30,ee=600;function ne(){let t=null,n=!1,e=!1,i=null,o=null,r=!1;const l=(p,T)=>{for(let P=0;P<p.length;P++){const O=p.item(P);if(O&&O.identifier===T)return O}return null},u=()=>{i!==null&&(clearTimeout(i),i=null)},y=()=>{o!==null&&(clearTimeout(o),o=null)},d=()=>{n=!0,e=!0,u(),y(),i=setTimeout(()=>{n=!1,e=!1,i=null},ee)},S=p=>{if(p.touches.length!==1){t=null;return}const T=p.touches.item(0);if(!T){t=null;return}const P=window.innerWidth,O=T.clientX<=Et,R=T.clientX>=P-Et;if(!O&&!R){t=null;return}t={identifier:T.identifier,startX:T.clientX,startY:T.clientY,fromLeftEdge:O,moved:!1}},g=p=>{if(!t)return;if(p.touches.length!==1){t=null;return}const T=l(p.touches,t.identifier);if(!T){t=null;return}const P=T.clientX-t.startX,O=T.clientY-t.startY,R=Math.abs(P),L=Math.abs(O);if(L>Tt&&L>R*Pt){t=null;return}const h=t.fromLeftEdge?P>0:P<0;R>Tt&&R>L*Pt&&h&&(t.moved=!0)},f=p=>{if(!t)return;const T=l(p.changedTouches,t.identifier);if(!T){t=null;return}const P=T.clientX-t.startX,O=t.fromLeftEdge?P>0:P<0;if(t.moved&&O&&Math.abs(P)>=xt){d(),t=null;return}t.moved&&Math.abs(P)>=xt&&d(),t=null},x=()=>{t&&(t.moved&&d(),t=null)};return{initialize:()=>{if(typeof window>"u"||r)return;r=!0;const p={passive:!0,capture:!0};window.addEventListener("touchstart",S,p),window.addEventListener("touchmove",g,p),window.addEventListener("touchend",f,p),window.addEventListener("touchcancel",x,p)},destroy:()=>{if(typeof window>"u"||!r)return;r=!1;const p={capture:!0};window.removeEventListener("touchstart",S,p),window.removeEventListener("touchmove",g,p),window.removeEventListener("touchend",f,p),window.removeEventListener("touchcancel",x,p),u(),y(),t=null,n=!1,e=!1},isSwipeBack:()=>{const p=n||e;return p&&u(),p},onPageEnter:()=>{n=!1,u(),y(),o=setTimeout(()=>{e=!1,o=null},0)}}}function ie(t,n){return n?t.priority!==n.priority?t.priority>n.priority:t.specificity!==n.specificity?t.specificity>n.specificity:t.ruleIndex<n.ruleIndex:!0}function se(t,n,e,i){let o=null;return e.forEach((r,l)=>{const u=r.priority??0;let y=null;if(r.on!==void 0){const d=r.except!==void 0&&I(t,r.except)!==null,S=r.except!==void 0&&I(n,r.except)!==null,g=d?null:I(t,r.on),f=S?null:I(n,r.on);if(g||f){const x=!g&&f?"forward":g&&!f?"backward":i;y={transition:r.transition,direction:x,ruleIndex:l,priority:u,specificity:Math.max((g==null?void 0:g.specificity)??0,(f==null?void 0:f.specificity)??0),reason:!g&&f?"on-enter":g&&!f?"on-leave":"on-history"}}}else if(r.ordered!==void 0){let d=-1,S=-1,g=-1,f=-1;r.ordered.forEach((x,A)=>{const C=I(t,x);C&&C.specificity>g&&(d=A,g=C.specificity);const k=I(n,x);k&&k.specificity>f&&(S=A,f=k.specificity)}),d>=0&&S>=0&&d!==S&&(y={transition:r.transition,direction:d<S?"forward":"backward",ruleIndex:l,priority:u,specificity:g+f,reason:"ordered"})}else{const d=I(t,r.from),S=I(n,r.to),g=r.bidirectional===!1?null:I(t,r.to),f=r.bidirectional===!1?null:I(n,r.from),x=d&&S,A=g&&f;if(x||A){const C=x?d.specificity+S.specificity:-1,k=A?g.specificity+f.specificity:-1,X=x&&A&&C===k?i:C>=k?"forward":"backward";y={transition:r.transition,direction:X,ruleIndex:l,priority:u,specificity:Math.max(C,k),reason:"pair"}}}y&&ie(y,o)&&(o=y)}),o}function oe(){const t=[];let n=!1;const e=()=>{n=!0};return typeof window<"u"&&window.addEventListener("popstate",e),{resolve(i,o){const r=G(i),l=G(o);if(t.length===0)t.push(r);else if(t[t.length-1]!==r){const d=t.lastIndexOf(r);d>=0?t.splice(d+1):t.push(r)}const u=t[t.length-2],y=n||u===l?"backward":"forward";if(n=!1,y==="backward"){const d=t.lastIndexOf(l);d>=0?t.splice(d+1):t.push(l)}else t[t.length-1]!==l&&t.push(l);return y},dispose(){typeof window<"u"&&window.removeEventListener("popstate",e)}}}function re(){let t=null;function n(){var i,o;t&&((i=t.outResolve)==null||i.call(t,null),(o=t.inResolve)==null||o.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 i={from:t.from,to:t.to};t.outResolve(i),t.inResolve(i),t=null}}return{trigger(i,o){var l;o==="out"&&(t==null?void 0:t.to)===i&&!t.from&&((l=t.inResolve)==null||l.call(t,null),t={}),t&&(o==="out"&&t.from&&t.from!==i||o==="in"&&t.to&&t.to!==i)&&n(),t||(t={}),o==="out"?t.from=i:t.to=i},get(i){return new Promise(o=>{t||(t={}),i==="out"?t.outResolve=o:t.inResolve=o,e()})}}}const V=new Map;let J=null,Rt=!1;function Lt(t,n){if(t instanceof HTMLElement&&V.has(t)&&!t.isConnected){const e=V.get(t);V.delete(t),queueMicrotask(()=>e(n))}for(const e of Array.from(t.childNodes))Lt(e,n)}function ce(){if(Rt||typeof document>"u")return;Rt=!0,J=new MutationObserver(n=>{for(const e of n){const i={parent:e.target,nextSibling:e.nextSibling};for(const o of Array.from(e.removedNodes))Lt(o,i)}});const t=()=>{J==null||J.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function le(t,n){return ce(),V.set(t,n),()=>{V.delete(t)}}const dt=new WeakMap;let tt=null;const et="none !important";function U(t){const n=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${n} !important`:n}function ae(){return tt||(tt=new MutationObserver(t=>{for(const n of t){const e=n.target,i=dt.get(e);if(!i)continue;const o=U(e);o!==i.accounted&&(i.accounted=o,o===et?(i.reactHidden=!0,i.onHide()):o!=="none"&&i.reactHidden&&(i.reactHidden=!1,i.onShow()))}}),tt)}function ue(t,n){const e=U(t),i={accounted:e,reactHidden:e===et,onHide:n.onHide,onShow:n.onShow};return dt.set(t,i),ae().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return U(t)===et},setDisplay(o,r=!1){o===null?t.style.removeProperty("display"):t.style.setProperty("display",o,r?"important":""),i.accounted=U(t)},sync(){i.accounted=U(t),i.reactHidden=i.accounted===et},stop(){dt.delete(t)}}}function de(t,n={}){const{transitions:e=[],middleware:i=(s,c)=>({from:s,to:c}),preserveScroll:o=s=>s}=t,r=n.host??new At,l=re(),u=oe(),y=typeof e=="function"?e:()=>e,d=ne();d.initialize();const S=new Map,g=s=>{let c=S.get(s);return c===void 0&&(c=i(s,s).from,S.set(s,c)),c},{initializeContext:f,calculateScrollOffset:x,evictScrollPosition:A,shouldPreserve:C,getScrollContainer:k,getPositionedParentElement:X,getScrollPosition:p,getIsMobile:T}=te({preserveScroll:o,resolvePath:g}),P=new Map,O=()=>{const s=T();let c=P.get(s);return c||(c=y({isMobile:s}),P.set(s,c)),c};let R=null,L=null;const h=new WeakMap,m=s=>{h.set(s,{parent:s.parentNode,nextSibling:s.nextSibling})},b=s=>{const c=h.get(s);return c||{parent:s.parentNode,nextSibling:s.nextSibling}},w=new WeakMap,E=new WeakMap;let _=0;const F=s=>{const c=typeof getComputedStyle<"u"?getComputedStyle(s).display:"";return c&&c!=="none"?c:"block"},Y=(s,c)=>{c.visibleDisplay=s.style.getPropertyValue("display"),c.computedDisplay=F(s)},ht=(s,c)=>{if(E.get(s)!==c)return;E.delete(s);const a=w.get(s);a&&(a.savedCss!==null&&(s.style.cssText=a.savedCss,a.savedCss=null),a.intent==="hidden"?a.vis.setDisplay("none",!0):a.visibleDisplay?(a.vis.setDisplay(a.visibleDisplay,!1),Y(s,a)):(a.vis.setDisplay(null),Y(s,a)))},kt=(s,c,a,v,M,H)=>{const B=M.element,N=H.element,W=(M.mode??"unmount")==="hidden",{parent:z,nextSibling:st}=M.parent?{parent:M.parent,nextSibling:M.nextSibling}:b(B),j=x(a,v),ot={direction:c,scrollOffset:j,from:{scroll:p(a)},to:{scroll:p(v)},get scrollingElement(){return k()||document.documentElement},get positionedParent(){return X()}};let D;if(W){D=B,D.style.top=`${-1*((j==null?void 0:j.y)??0)}px`;const K=w.get(N);K&&K.savedCss===null&&(K.savedCss=N.style.cssText)}else D=B,Bt(D,ot);C(a)||A(a);const Q=W?++_:0;W&&(E.set(N,Q),E.set(B,Q));const gt=Promise.resolve(D),vt=Promise.resolve(N),bt=[],Nt={from:gt,to:vt,context:ot,createElement:((K,rt="div")=>{const $=document.createElement(rt);return $.setAttribute("data-ssgoi-id",K),bt.push($),$})},Ht=Promise.resolve(s.prepare?s.prepare(Nt):{});Xt({from:gt,to:vt,extras:Ht}).then(({from:K,to:rt,extras:$})=>{!W&&z&&(st&&z.contains(st)?z.insertBefore(D,st):z.appendChild(D));const ct=s.animation({from:K,to:rt,context:ot,...$}),lt=ct.onComplete;ct.onComplete=()=>{lt==null||lt(),W?(ht(B,Q),ht(N,Q)):D.parentNode&&D.parentNode.removeChild(D);for(const at of bt)at.parentNode&&at.parentNode.removeChild(at)},r.attach(ct)})},Z=(s,c)=>{const a=d.isSwipeBack();l.trigger(s,c),l.get(c).then(v=>{if(c==="in"&&d.onPageEnter(),!v)return;if(a&&c==="in"){const z=i(v.from,v.to);u.resolve(z.from,z.to)}if(a){c==="out"&&v.from&&!C(v.from)&&A(v.from),R=null,L=null;return}if(c!=="in")return;const{from:M,to:H}=i(v.from,v.to),B=u.resolve(M,H),N=se(M,H,O(),B),it=R,W=L;R=null,L=null,!(!N||!it||!W)&&kt(N.transition,N.direction,v.from,v.to,it,W)})},_t=(s,c)=>{const a=w.get(s);if(!a)return;const v=a.intent==="hidden";if(a.intent="hidden",a.savedCss===null&&(a.savedCss=s.style.cssText),a.vis.setDisplay(a.computedDisplay||"block",!0),s.style.position="absolute",s.style.width="100%",s.style.left="0",v)return;const M=b(s);R={element:s,parent:M.parent,nextSibling:M.nextSibling,mode:"hidden"};const H=s.getAttribute("data-ssgoi-transition")??c;Z(H,"out")},Dt=(s,c)=>{const a=w.get(s);if(!a||a.intent==="visible")return;a.intent="visible",Y(s,a),a.savedCss!==null&&(s.style.cssText=a.savedCss,a.visibleDisplay?a.vis.setDisplay(a.visibleDisplay,!1):a.vis.setDisplay(null)),f(s,c),L={element:s,parent:s.parentElement,nextSibling:s.nextElementSibling};const v=s.getAttribute("data-ssgoi-transition")??c;Z(v,"in")},It=(s,c,a)=>{const v=w.get(s);if(v&&(v.vis.stop(),w.delete(s),E.delete(s),v.intent==="hidden")){(R==null?void 0:R.element)===s&&(R=null),(L==null?void 0:L.element)===s&&(L=null);return}const M=a??b(s);R={element:s,parent:M.parent,nextSibling:M.nextSibling,mode:"unmount"};const H=s.getAttribute("data-ssgoi-transition")??c;Z(H,"out")},pt=new WeakSet,yt=(s,c)=>{if(pt.has(c))return;pt.add(c),m(c);const a=ue(c,{onHide:()=>_t(c,s),onShow:()=>Dt(c,s)}),v={vis:a,savedCss:null,intent:a.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block"};w.set(c,v),a.isHidden||(Y(c,v),f(c,s),L={element:c,parent:c.parentElement,nextSibling:c.nextElementSibling},Z(s,"in")),le(c,M=>It(c,s,M))},mt=new Map;return{register:yt,refFor:s=>{let c=mt.get(s);return c||(c=a=>{a&&yt(s,a)},mt.set(s,c)),c}}}const Ot="data-ssgoi-root",fe=`[${Ot}]`,ft="data-ssgoi-transition",Mt=`[${ft}]`,he="[data-ssgoi-clone]";function pe(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function ye(t){return t.nodeType===Node.ELEMENT_NODE}function me(t){return t instanceof HTMLElement}function ge(t,n){if(!pe())return()=>{};t.setAttribute(Ot,"");const e=l=>l.closest(fe)===t,i=l=>{if(!me(l)||!e(l)||l.closest(he))return;const u=l.getAttribute(ft);u!==null&&n.register(u,l)},o=l=>{if(ye(l)){l.matches(Mt)&&i(l);for(const u of l.querySelectorAll(Mt))i(u)}},r=new MutationObserver(l=>{for(const u of l){if(u.type==="attributes"){i(u.target);continue}for(const y of u.addedNodes)o(y)}});return r.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[ft]}),o(t),()=>r.disconnect()}exports.Animation=nt.Animation;exports.MultiAnimation=nt.MultiAnimation;exports.WebAnimation=nt.WebAnimation;exports.HostAnimation=At;exports.createSggoiTransitionContext=de;exports.observeSsgoiTransitions=ge;
|
|
1
|
+
"use strict";var Bt=Object.defineProperty;var Ft=(t,e,n)=>e in t?Bt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var G=(t,e,n)=>Ft(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const it=require("./multi-animation-6124HEke.cjs");class kt extends it.Animation{constructor(){super(...arguments);G(this,"child",null);G(this,"_state","idle");G(this,"_settled",!1);G(this,"listeners",new Set)}attach(n){const o=this.child;if(this.child=n,this._settled=!1,o){const a=o.getPose();o.complete(),n.matchInto(a)}n.playbackRate=this.playbackRate;const s=n.onComplete;n.onComplete=()=>{s==null||s(),this.child===n&&(this.child=null,this._state="idle",this._settled=!0),this.notify()};const i=n.onUpdate;n.onUpdate=a=>{var l;i==null||i(a),(l=this.onUpdate)==null||l.call(this,a),this.notify()},this._state==="paused"?n.pause():this._state==="reversing"?n.reverse():(this._state="playing",n.play()),this.notify()}play(){var n;this._state="playing",this._settled=!1,(n=this.child)==null||n.play(),this.notify()}reverse(){var n;this._state="reversing",this._settled=!1,(n=this.child)==null||n.reverse(),this.notify()}pause(){var n;this._state="paused",(n=this.child)==null||n.pause(),this.notify()}complete(){var n;(n=this.child)==null||n.complete(),this.notify()}get isAnimating(){var n;return((n=this.child)==null?void 0:n.isAnimating)??!1}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child}get isReversing(){var n;return((n=this.child)==null?void 0:n.isReversing)??this._state==="reversing"}get progress(){var n;return((n=this.child)==null?void 0:n.progress)??0}findTimeForProgress(n){var o;return((o=this.child)==null?void 0:o.findTimeForProgress(n))??null}get playbackRate(){return super.playbackRate}set playbackRate(n){super.playbackRate=n,this.child&&(this.child.playbackRate=n),this.notify()}getPose(){var n;return((n=this.child)==null?void 0:n.getPose())??[]}getTimeline(){var n;return((n=this.child)==null?void 0:n.getTimeline())??[]}matchInto(n){var o;(o=this.child)==null||o.matchInto(n)}get activeChild(){return this.child}subscribe(n){return this.listeners.add(n),()=>{this.listeners.delete(n)}}notify(){for(const n of this.listeners)n()}}const zt=(t,e)=>{var n;t.style.position="absolute",t.style.width="100%",t.style.top=`${-1*(((n=e==null?void 0:e.scrollOffset)==null?void 0:n.y)??0)}px`,t.style.left="0"},bt=new Set(["auto","scroll","overlay"]),Kt=t=>{let e=t.parentElement;for(;e&&e!==document.body;){const n=window.getComputedStyle(e);if(bt.has(n.overflowY)||bt.has(n.overflowX))return e;e=e.parentElement}return document.documentElement},Xt=t=>{let e=t.parentElement;for(;e&&e!==document.body;){const n=window.getComputedStyle(e).position;if(n==="relative"||n==="absolute"||n==="fixed"||n==="sticky")return e;e=e.parentElement}return document.body};function $t(t){const e=Object.keys(t);return Promise.all(e.map(n=>t[n])).then(n=>{const o={};return e.forEach((s,i)=>{o[s]=n[i]}),o})}const qt=1e6,Et=100,Gt=10,Ut=1;function Vt(t){const e=t.trim(),n=e.indexOf("#"),o=e.indexOf("?"),s=[n,o].filter(i=>i>=0).reduce((i,a)=>Math.min(i,a),e.length);return e.slice(0,s)}function V(t){const e=Vt(t);try{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e))return V(new URL(e).pathname)}catch{}const o=(e.startsWith("/")?e:`/${e}`).replace(/\/+/g,"/");return(o.length>1?o.replace(/\/+$/g,""):o)||"/"}function Yt(t){const e=t.trim();return e==="*"?"/**":V(e)}function ut(t){return t==="/"?[]:t.slice(1).split("/")}function Zt(t){return t.startsWith(":")||t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}")}function Ot(t,e){const n=V(t),o=Yt(e);if(n===o)return{matched:!0,specificity:qt+ut(o).length*Et,pattern:e};const s=ut(n),i=ut(o);let a=0;for(let l=0;l<i.length;l++){const f=i[l],u=s[l],y=l===i.length-1;if(f==="**")return{matched:y&&s.length>=l,specificity:a,pattern:e};if(u===void 0||f===void 0)return{matched:!1,specificity:0,pattern:e};if(f==="*"){a+=Ut;continue}if(Zt(f)){a+=Gt;continue}if(f!==u)return{matched:!1,specificity:0,pattern:e};a+=Et}return{matched:s.length===i.length,specificity:a,pattern:e}}function N(t,e){const n=typeof e=="string"?[e]:e;let o=null;for(const s of n){const i=Ot(t,s);i.matched&&(!o||i.specificity>o.specificity)&&(o=i)}return o}function jt(t,e){return Ot(t,e).matched}const Qt=768,Jt=10,te=10;function ee(t={}){const{preserveScroll:e=v=>v,resolvePath:n=v=>v}=t,o=typeof e=="function"?e:()=>e;let s=null,i=!1,a=!1;const l=()=>{const v=(s==null?void 0:s.clientWidth)??0,g=v>0?v:typeof window<"u"?window.innerWidth:0;return g>0&&g<Qt},f=()=>(a||(i=l(),a=!0),i),u=v=>{var _;const g=n(v),E=o(f());if(E===!1)return{preserves:!1,shared:!1,storageKey:`path:${g}`};if(E===!0)return{preserves:!0,shared:!1,storageKey:`path:${g}`};const P=((_=E.exclude)==null?void 0:_.some(D=>jt(g,D)))??!1,A=!P&&!!E.key;return{preserves:!P,shared:A,storageKey:A?`shared:${E.key}`:`path:${g}`}},y=v=>u(v).preserves;let h=null;const p=new Map;let w=null,O=!1,M=0;const R=()=>{s&&w&&!O&&p.set(u(w).storageKey,{x:s.scrollLeft,y:s.scrollTop})},K=v=>{if(!s)return;const g=u(v);if(g.preserves&&g.shared&&!p.has(g.storageKey))return;const E=g.preserves&&p.has(g.storageKey)?p.get(g.storageKey):{x:0,y:0};let P=0;const A=()=>{if(!s)return;s.scrollTo({top:E.y,left:E.x}),!(Math.abs(s.scrollTop-E.y)<1&&Math.abs(s.scrollLeft-E.x)<1)&&P<Jt&&(P++,requestAnimationFrame(A))};requestAnimationFrame(A)};return{initializeContext:(v,g)=>{O=!0;const E=++M;h=v,s||(s=Kt(v),i=l(),a=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{i=l()}).observe(s),(s===document.documentElement?window:s).addEventListener("scroll",R,{passive:!0})),w=g,K(g);let P=0;const A=()=>{E===M&&(P++,P>=te?O=!1:requestAnimationFrame(A))};requestAnimationFrame(A)},calculateScrollOffset:(v,g)=>{const E=v?u(v).storageKey:null,P=E&&p.has(E)?p.get(E):{x:0,y:0},A=g?u(g):null,_=A!=null&&A.preserves?A.storageKey:null,D=_&&p.has(_)?p.get(_):{x:0,y:0};return{x:-D.x+P.x,y:-D.y+P.y}},evictScrollPosition:v=>{p.delete(u(v).storageKey)},shouldPreserve:y,getScrollContainer:()=>s,getPositionedParentElement:()=>h?Xt(h):document.body,getScrollPosition:v=>{const g=v?u(v).storageKey:null;return g&&p.has(g)?p.get(g):{x:0,y:0}},getIsMobile:f}}const St=30,wt=8,Tt=1.2,Pt=30,ne=600;function ie(){let t=null,e=!1,n=!1,o=null,s=null,i=!1;const a=(b,S)=>{for(let T=0;T<b.length;T++){const k=b.item(T);if(k&&k.identifier===S)return k}return null},l=()=>{o!==null&&(clearTimeout(o),o=null)},f=()=>{s!==null&&(clearTimeout(s),s=null)},u=()=>{e=!0,n=!0,l(),f(),o=setTimeout(()=>{e=!1,n=!1,o=null},ne)},y=b=>{if(b.touches.length!==1){t=null;return}const S=b.touches.item(0);if(!S){t=null;return}const T=window.innerWidth,k=S.clientX<=St,W=S.clientX>=T-St;if(!k&&!W){t=null;return}t={identifier:S.identifier,startX:S.clientX,startY:S.clientY,fromLeftEdge:k,moved:!1}},h=b=>{if(!t)return;if(b.touches.length!==1){t=null;return}const S=a(b.touches,t.identifier);if(!S){t=null;return}const T=S.clientX-t.startX,k=S.clientY-t.startY,W=Math.abs(T),F=Math.abs(k);if(F>wt&&F>W*Tt){t=null;return}const v=t.fromLeftEdge?T>0:T<0;W>wt&&W>F*Tt&&v&&(t.moved=!0)},p=b=>{if(!t)return;const S=a(b.changedTouches,t.identifier);if(!S){t=null;return}const T=S.clientX-t.startX,k=t.fromLeftEdge?T>0:T<0;if(t.moved&&k&&Math.abs(T)>=Pt){u(),t=null;return}t.moved&&Math.abs(T)>=Pt&&u(),t=null},w=()=>{t&&(t.moved&&u(),t=null)};return{initialize:()=>{if(typeof window>"u"||i)return;i=!0;const b={passive:!0,capture:!0};window.addEventListener("touchstart",y,b),window.addEventListener("touchmove",h,b),window.addEventListener("touchend",p,b),window.addEventListener("touchcancel",w,b)},destroy:()=>{if(typeof window>"u"||!i)return;i=!1;const b={capture:!0};window.removeEventListener("touchstart",y,b),window.removeEventListener("touchmove",h,b),window.removeEventListener("touchend",p,b),window.removeEventListener("touchcancel",w,b),l(),f(),t=null,e=!1,n=!1},isSwipeBack:()=>{const b=e||n;return b&&l(),b},onPageEnter:()=>{e=!1,l(),f(),s=setTimeout(()=>{n=!1,s=null},0)}}}function se(t,e){return e?t.priority!==e.priority?t.priority>e.priority:t.specificity!==e.specificity?t.specificity>e.specificity:t.ruleIndex<e.ruleIndex:!0}function oe(t,e,n,o){let s=null;return n.forEach((i,a)=>{const l=i.priority??0;let f=null;if(i.on!==void 0){const u=i.except!==void 0&&N(t,i.except)!==null,y=i.except!==void 0&&N(e,i.except)!==null,h=u?null:N(t,i.on),p=y?null:N(e,i.on);if(h||p){const w=!h&&p?"forward":h&&!p?"backward":o;f={transition:i.transition,direction:w,ruleIndex:a,priority:l,specificity:Math.max((h==null?void 0:h.specificity)??0,(p==null?void 0:p.specificity)??0),reason:!h&&p?"on-enter":h&&!p?"on-leave":"on-history"}}}else if(i.ordered!==void 0){let u=-1,y=-1,h=-1,p=-1;i.ordered.forEach((w,O)=>{const M=N(t,w);M&&M.specificity>h&&(u=O,h=M.specificity);const R=N(e,w);R&&R.specificity>p&&(y=O,p=R.specificity)}),u>=0&&y>=0&&u!==y&&(f={transition:i.transition,direction:u<y?"forward":"backward",ruleIndex:a,priority:l,specificity:h+p,reason:"ordered"})}else{const u=N(t,i.from),y=N(e,i.to),h=i.bidirectional===!1?null:N(t,i.to),p=i.bidirectional===!1?null:N(e,i.from),w=u&&y,O=h&&p;if(w||O){const M=w?u.specificity+y.specificity:-1,R=O?h.specificity+p.specificity:-1,K=w&&O&&M===R?o:M>=R?"forward":"backward";f={transition:i.transition,direction:K,ruleIndex:a,priority:l,specificity:Math.max(M,R),reason:"pair"}}}f&&se(f,s)&&(s=f)}),s}function re(){const t=[];let e=!1;const n=()=>{e=!0};return typeof window<"u"&&window.addEventListener("popstate",n),{resolve(o,s){const i=V(o),a=V(s);if(t.length===0)t.push(i);else if(t[t.length-1]!==i){const u=t.lastIndexOf(i);u>=0?t.splice(u+1):t.push(i)}const l=t[t.length-2],f=e||l===a?"backward":"forward";if(e=!1,f==="backward"){const u=t.lastIndexOf(a);u>=0?t.splice(u+1):t.push(a)}else t[t.length-1]!==a&&t.push(a);return f},dispose(){typeof window<"u"&&window.removeEventListener("popstate",n)}}}function ce(t={}){let e=null;function n(){var s,i;e&&((s=e.out)==null||s.resolve(null),(i=e.in)==null||i.resolve(null),e=null)}function o(){if(e!=null&&e.out&&e.in){if(e.out.path===e.in.path){n();return}const s={from:e.out.path,to:e.in.path,out:e.out.payload,in:e.in.payload};e.out.resolve(s),e.in.resolve(s),e=null}}return{arrive(s,i,a){return new Promise(l=>{var y,h;i==="out"&&((y=e==null?void 0:e.in)==null?void 0:y.path)===s&&!e.out&&(e.in.resolve(null),e.in=void 0);const f=e==null?void 0:e[i];f&&f.path!==s&&n(),e||(e={});const u=e[i];if(u){if(((h=t.keepCurrent)==null?void 0:h.call(t,{type:i,path:s,current:u.payload,next:a}))??!1){l(null);return}u.resolve(null)}e[i]={path:s,payload:a,resolve:l},o()})},cancel(s){(e!=null&&e.out&&s(e.out.payload)||e!=null&&e.in&&s(e.in.payload))&&n()}}}const le={},$=new Map;let J=null,xt=!1;function Rt(t,e,n){t instanceof HTMLElement&&$.has(t)&&!t.isConnected&&n.set(t,{entry:$.get(t),anchor:e});for(const o of Array.from(t.childNodes))Rt(o,e,n)}function ae(t){const e=new Set(Array.from(t.values(),({entry:n})=>n));for(const[n,{entry:o,anchor:s}]of t){$.delete(n);let i=o.parent,a=!1;for(;i;){if(i.group===o.group&&e.has(i)){a=!0;break}i=i.parent}queueMicrotask(()=>o.callback(s,{emit:!a}))}}function ue(){if(xt||typeof document>"u")return;xt=!0,J=new MutationObserver(e=>{const n=new Map;for(const o of e){const s={parent:o.target,nextSibling:o.nextSibling};for(const i of Array.from(o.removedNodes))Rt(i,s,n)}ae(n)});const t=()=>{J==null||J.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function de(t,e,n=le){ue();let o=t.parentElement,s=null;for(;o;){const i=$.get(o);if((i==null?void 0:i.group)===n){s=i;break}o=o.parentElement}return $.set(t,{element:t,callback:e,group:n,parent:s}),()=>{$.delete(t)}}const dt=new WeakMap;let tt=null;const et="none !important";function U(t){const e=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${e} !important`:e}function fe(){return tt||(tt=new MutationObserver(t=>{for(const e of t){const n=e.target,o=dt.get(n);if(!o)continue;const s=U(n);s!==o.accounted&&(o.accounted=s,s===et?(o.reactHidden=!0,o.onHide()):s!=="none"&&o.reactHidden&&(o.reactHidden=!1,o.onShow()))}}),tt)}function he(t,e){const n=U(t),o={accounted:n,reactHidden:n===et,onHide:e.onHide,onShow:e.onShow};return dt.set(t,o),fe().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return U(t)===et},setDisplay(s,i=!1){s===null?t.style.removeProperty("display"):t.style.setProperty("display",s,i?"important":""),o.accounted=U(t)},sync(){o.accounted=U(t),o.reactHidden=o.accounted===et},stop(){dt.delete(t)}}}function pe(t,e={}){const{transitions:n=[],middleware:o=(r,c)=>({from:r,to:c}),preserveScroll:s=r=>r}=t,i=e.host??new kt,a={},l=ce({keepCurrent:({current:r,next:c})=>r.element.contains(c.element)}),f=re(),u=typeof n=="function"?n:()=>n,y=ie();y.initialize();const h=new Map,p=r=>{let c=h.get(r);return c===void 0&&(c=o(r,r).from,h.set(r,c)),c},{initializeContext:w,calculateScrollOffset:O,evictScrollPosition:M,shouldPreserve:R,getScrollContainer:K,getPositionedParentElement:b,getScrollPosition:S,getIsMobile:T}=ee({preserveScroll:s,resolvePath:p}),k=new Map,W=()=>{const r=T();let c=k.get(r);return c||(c=u({isMobile:r}),k.set(r,c)),c},F=new WeakMap,v=r=>{F.set(r,{parent:r.parentNode,nextSibling:r.nextSibling})},g=r=>{const c=F.get(r);return c||{parent:r.parentNode,nextSibling:r.nextSibling}},E=new WeakMap,P=new WeakMap;let A=0;const _=r=>{const c=typeof getComputedStyle<"u"?getComputedStyle(r).display:"";return c&&c!=="none"?c:"block"},D=(r,c)=>{c.visibleDisplay=r.style.getPropertyValue("display"),c.computedDisplay=_(r)},ft=(r,c)=>{if(P.get(r)!==c)return;P.delete(r);const d=E.get(r);d&&(d.savedCss!==null&&(r.style.cssText=d.savedCss,d.savedCss=null),d.intent==="hidden"?d.vis.setDisplay("none",!0):d.visibleDisplay?(d.vis.setDisplay(d.visibleDisplay,!1),D(r,d)):(d.vis.setDisplay(null),D(r,d)))},_t=(r,c,d,C,m,L)=>{const x=m.element,H=L.element,B=(m.mode??"unmount")==="hidden",{parent:Z,nextSibling:st}=m.parent?{parent:m.parent,nextSibling:m.nextSibling}:g(x),j=O(d,C),ot={direction:c,scrollOffset:j,from:{scroll:S(d)},to:{scroll:S(C)},get scrollingElement(){return K()||document.documentElement},get positionedParent(){return b()}};let I;if(B){I=x,I.style.top=`${-1*((j==null?void 0:j.y)??0)}px`;const z=E.get(H);z&&z.savedCss===null&&(z.savedCss=H.style.cssText)}else I=x,zt(I,ot);R(d)||M(d);const Q=B?++A:0;B&&(P.set(H,Q),P.set(x,Q));const mt=Promise.resolve(I),gt=Promise.resolve(H),vt=[],Ht={from:mt,to:gt,context:ot,createElement:((z,rt="div")=>{const q=document.createElement(rt);return q.setAttribute("data-ssgoi-id",z),vt.push(q),q})},Wt=Promise.resolve(r.prepare?r.prepare(Ht):{});$t({from:mt,to:gt,extras:Wt}).then(({from:z,to:rt,extras:q})=>{!B&&Z&&(st&&Z.contains(st)?Z.insertBefore(I,st):Z.appendChild(I));const ct=r.animation({from:z,to:rt,context:ot,...q}),lt=ct.onComplete;ct.onComplete=()=>{lt==null||lt(),B?(ft(x,Q),ft(H,Q)):I.parentNode&&I.parentNode.removeChild(I);for(const at of vt)at.parentNode&&at.parentNode.removeChild(at)},i.attach(ct)})},Y=(r,c,d)=>{const C=y.isSwipeBack();l.arrive(r,c,d).then(m=>{if(c==="in"&&y.onPageEnter(),!m)return;if(C&&c==="in"){const B=o(m.from,m.to);f.resolve(B.from,B.to)}if(C){c==="out"&&m.from&&!R(m.from)&&M(m.from);return}if(c!=="in")return;const{from:L,to:x}=o(m.from,m.to),H=f.resolve(L,x),X=oe(L,x,W(),H);X&&_t(X.transition,X.direction,m.from,m.to,m.out,m.in)})},Dt=(r,c)=>{const d=E.get(r);if(!d)return;const C=d.intent==="hidden";if(d.intent="hidden",d.savedCss===null&&(d.savedCss=r.style.cssText),d.vis.setDisplay(d.computedDisplay||"block",!0),r.style.position="absolute",r.style.width="100%",r.style.left="0",C)return;const m=g(r),L={element:r,parent:m.parent,nextSibling:m.nextSibling,mode:"hidden"},x=r.getAttribute("data-ssgoi-transition")??c;Y(x,"out",L)},It=(r,c)=>{const d=E.get(r);if(!d||d.intent==="visible")return;d.intent="visible",D(r,d),d.savedCss!==null&&(r.style.cssText=d.savedCss,d.visibleDisplay?d.vis.setDisplay(d.visibleDisplay,!1):d.vis.setDisplay(null)),w(r,c);const C={element:r,parent:r.parentElement,nextSibling:r.nextElementSibling},m=r.getAttribute("data-ssgoi-transition")??c;Y(m,"in",C)},Nt=(r,c,d,C=!0)=>{const m=E.get(r);if(m&&(m.vis.stop(),E.delete(r),P.delete(r),m.intent==="hidden")){l.cancel(X=>X.element===r);return}if(!C)return;const L=d??g(r),x={element:r,parent:L.parent,nextSibling:L.nextSibling,mode:"unmount"},H=r.getAttribute("data-ssgoi-transition")??c;Y(H,"out",x)},ht=new WeakSet,pt=(r,c,{enter:d=!0}={})=>{if(ht.has(c))return;ht.add(c),v(c);const C=he(c,{onHide:()=>Dt(c,r),onShow:()=>It(c,r)}),m={vis:C,savedCss:null,intent:C.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block"};if(E.set(c,m),!C.isHidden&&(D(c,m),d)){w(c,r);const L={element:c,parent:c.parentElement,nextSibling:c.nextElementSibling};Y(r,"in",L)}de(c,(L,x)=>Nt(c,r,L,(x==null?void 0:x.emit)??!0),a)},yt=new Map;return{register:pt,refFor:r=>{let c=yt.get(r);return c||(c=d=>{d&&pt(r,d)},yt.set(r,c)),c}}}const Lt="data-ssgoi-root",ye=`[${Lt}]`,nt="data-ssgoi-transition",At=`[${nt}]`,me="[data-ssgoi-clone]";function ge(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function ve(t){return t.nodeType===Node.ELEMENT_NODE}function be(t){return t instanceof HTMLElement}function Ct(t){let e=0,n=t.parentElement;for(;n;)e++,n=n.parentElement;return e}function Mt(t,e,n=t){const o=Array.from(t).sort((s,i)=>Ct(s)-Ct(i));for(const s of o){const i=s.getAttribute(nt);if(i===null)continue;let a=s.parentElement,l=!1;for(;a;){if(n.has(a)){l=!0;break}a=a.parentElement}e.register(i,s,{enter:!l})}}function Ee(t,e){if(!ge())return()=>{};t.setAttribute(Lt,"");const n=l=>l.closest(ye)===t,o=l=>!be(l)||!n(l)||l.closest(me)||l.getAttribute(nt)===null?null:l,s=(l,f)=>{if(ve(l)){if(l.matches(At)){const u=o(l);u&&f.add(u)}for(const u of l.querySelectorAll(At)){const y=o(u);y&&f.add(y)}}},i=new MutationObserver(l=>{const f=new Set,u=new Set;for(const y of l){if(y.type==="attributes"){const h=o(y.target);h&&f.add(h);continue}for(const h of y.addedNodes)s(h,u)}for(const y of u)f.add(y);Mt(f,e,u)});i.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[nt]});const a=new Set;return s(t,a),Mt(a,e),()=>i.disconnect()}exports.Animation=it.Animation;exports.MultiAnimation=it.MultiAnimation;exports.WebAnimation=it.WebAnimation;exports.HostAnimation=kt;exports.createSggoiTransitionContext=pe;exports.observeSsgoiTransitions=Ee;
|