@ssgoi/react 6.4.0 → 6.5.0-beta.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 +70 -43
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,6 +6,16 @@ try this: [ssgoi.dev](https://ssgoi.dev)
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
+
## AI-Assisted Setup
|
|
10
|
+
|
|
11
|
+
Using Claude, Cursor, ChatGPT, or another AI assistant? Point it at:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
https://ssgoi.dev/llms.txt
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
It has the full setup guide, every transition, the API, and troubleshooting — everything an agent needs to wire SSGOI into your app.
|
|
18
|
+
|
|
9
19
|
## What is SSGOI?
|
|
10
20
|
|
|
11
21
|
SSGOI brings native app-like page transitions to the web. Transform your static page navigations into smooth, delightful experiences that users love.
|
|
@@ -36,10 +46,15 @@ pnpm add @ssgoi/react
|
|
|
36
46
|
import { Ssgoi } from "@ssgoi/react";
|
|
37
47
|
import { fade } from "@ssgoi/react/view-transitions";
|
|
38
48
|
|
|
49
|
+
const config = {
|
|
50
|
+
transitions: [fade({ paths: ["/", "/about"] })],
|
|
51
|
+
};
|
|
52
|
+
|
|
39
53
|
export default function App() {
|
|
40
54
|
return (
|
|
41
|
-
<Ssgoi config={
|
|
42
|
-
|
|
55
|
+
<Ssgoi config={config}>
|
|
56
|
+
{/* relative + z-0 are required (see "Layout Requirements" below) */}
|
|
57
|
+
<div className="relative z-0">{/* Your app */}</div>
|
|
43
58
|
</Ssgoi>
|
|
44
59
|
);
|
|
45
60
|
}
|
|
@@ -60,48 +75,44 @@ export default function HomePage() {
|
|
|
60
75
|
|
|
61
76
|
**That's it!** Your configured pages now transition smoothly with a fade effect.
|
|
62
77
|
|
|
78
|
+
## Layout Requirements
|
|
79
|
+
|
|
80
|
+
The element wrapping `<Ssgoi>` needs `position: relative` and `z-index: 0` (`relative z-0` in Tailwind).
|
|
81
|
+
|
|
82
|
+
When a page leaves, SSGOI clones it back into the DOM with `position: absolute` so it can animate out while the new page animates in. Without a positioned, stacking-context ancestor the clone jumps to the wrong place or falls behind the background. Add `overflow-x-clip` too if you use horizontal transitions (`slide`, `drill`).
|
|
83
|
+
|
|
63
84
|
## Advanced Transitions
|
|
64
85
|
|
|
65
86
|
### Route-based Transitions
|
|
66
87
|
|
|
67
|
-
|
|
88
|
+
Each transition factory returns a path-transition group. Drop the results straight into `config.transitions` — nested arrays are flattened automatically:
|
|
68
89
|
|
|
69
90
|
```tsx
|
|
91
|
+
import { fade, drill, zoom } from "@ssgoi/react/view-transitions";
|
|
92
|
+
|
|
70
93
|
const config = {
|
|
71
94
|
transitions: [
|
|
72
|
-
//
|
|
73
|
-
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
transition: drill({ direction: "enter" }),
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
// Pinterest-style image transitions
|
|
84
|
-
{ from: "/gallery", to: "/photo/*", transition: pinterest() },
|
|
95
|
+
// Calm cross-fade between tabs
|
|
96
|
+
fade({ paths: ["/home", "/about"] }),
|
|
97
|
+
|
|
98
|
+
// iOS-style drill-in when entering details
|
|
99
|
+
drill({ enter: "/products/*", exit: "/products" }),
|
|
100
|
+
|
|
101
|
+
// Card-to-detail zoom (needs matching data-zoom-*-key)
|
|
102
|
+
zoom({ paths: ["/gallery", "/photo/*"], type: "expand" }),
|
|
85
103
|
],
|
|
86
104
|
};
|
|
87
105
|
```
|
|
88
106
|
|
|
89
|
-
|
|
107
|
+
Transitions come in three shapes:
|
|
90
108
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
{
|
|
95
|
-
from: '/home',
|
|
96
|
-
to: '/about',
|
|
97
|
-
transition: scroll({ direction: 'up' }),
|
|
98
|
-
symmetric: true // Automatically creates reverse transition
|
|
99
|
-
}
|
|
100
|
-
```
|
|
109
|
+
- **`{ paths }`** — symmetric: every pair animates with the same physics (`fade`, `hero`, `zoom`, `blind`, `film`, `rotate`, `strip`, `jaemin`)
|
|
110
|
+
- **`{ enter, exit, type? }`** — directional: enter and exit get different physics (`drill`, `sheet`)
|
|
111
|
+
- **`{ paths }`** — ordered: path order decides forward / back direction (`slide`, `scroll`, `axis`)
|
|
101
112
|
|
|
102
113
|
### Individual Element Animations
|
|
103
114
|
|
|
104
|
-
Animate specific elements during mount/unmount
|
|
115
|
+
Animate specific elements during mount/unmount with `transition()`:
|
|
105
116
|
|
|
106
117
|
```tsx
|
|
107
118
|
import { transition } from "@ssgoi/react";
|
|
@@ -224,26 +235,34 @@ function List() {
|
|
|
224
235
|
```tsx
|
|
225
236
|
// app/layout.tsx
|
|
226
237
|
import { Ssgoi } from "@ssgoi/react";
|
|
227
|
-
import {
|
|
238
|
+
import { drill, fade } from "@ssgoi/react/view-transitions";
|
|
228
239
|
|
|
229
|
-
|
|
240
|
+
const config = {
|
|
241
|
+
transitions: [
|
|
242
|
+
drill({ enter: "/post/*", exit: "*" }),
|
|
243
|
+
fade({ paths: ["/", "/about"] }),
|
|
244
|
+
],
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export default function RootLayout({
|
|
248
|
+
children,
|
|
249
|
+
}: {
|
|
250
|
+
children: React.ReactNode;
|
|
251
|
+
}) {
|
|
230
252
|
return (
|
|
231
253
|
<html>
|
|
232
254
|
<body>
|
|
233
|
-
<Ssgoi
|
|
234
|
-
|
|
235
|
-
transitions: scroll({ paths: ["/", "/about"] }),
|
|
236
|
-
}}
|
|
237
|
-
>
|
|
238
|
-
<div style={{ position: "relative", minHeight: "100vh" }}>
|
|
239
|
-
{children}
|
|
240
|
-
</div>
|
|
255
|
+
<Ssgoi config={config}>
|
|
256
|
+
<div className="relative z-0 min-h-screen">{children}</div>
|
|
241
257
|
</Ssgoi>
|
|
242
258
|
</body>
|
|
243
259
|
</html>
|
|
244
260
|
);
|
|
245
261
|
}
|
|
262
|
+
```
|
|
246
263
|
|
|
264
|
+
```tsx
|
|
265
|
+
// app/page.tsx
|
|
247
266
|
export default function Page() {
|
|
248
267
|
return <main data-ssgoi-transition="/">{/* Your page content */}</main>;
|
|
249
268
|
}
|
|
@@ -302,11 +321,19 @@ Apply transitions to individual elements.
|
|
|
302
321
|
|
|
303
322
|
### Page Transitions (`@ssgoi/react/view-transitions`)
|
|
304
323
|
|
|
305
|
-
- `fade()` -
|
|
306
|
-
- `
|
|
307
|
-
- `
|
|
308
|
-
- `
|
|
309
|
-
- `
|
|
324
|
+
- `fade()` - Calm cross-fade. Safe default for unrelated pages
|
|
325
|
+
- `drill()` - iOS-style hierarchical navigation (list → detail)
|
|
326
|
+
- `slide()` - Horizontal push for tabs / sequential flows
|
|
327
|
+
- `scroll()` - Vertical page scroll for onboarding / paginated views
|
|
328
|
+
- `axis()` - Material/Flutter shared-axis swap for sibling/tab routes
|
|
329
|
+
- `sheet()` - Bottom sheet that slides up (modal-like flows)
|
|
330
|
+
- `hero()` - Shared element transition (matching `data-hero-enter-key` / `data-hero-exit-key`)
|
|
331
|
+
- `zoom()` - Card-to-detail expansion (matching `data-zoom-enter-key` / `data-zoom-exit-key`)
|
|
332
|
+
- `strip()` - 3D Y-axis perspective flip
|
|
333
|
+
- `blind()` - Window-blinds wipe reveal
|
|
334
|
+
- `film()` - Cinematic shrink + tile (gallery / lightbox)
|
|
335
|
+
- `rotate()` - Card flip between siblings
|
|
336
|
+
- `jaemin()` - Playful rotated zoom for special moments
|
|
310
337
|
|
|
311
338
|
### Element Transitions (`@ssgoi/react/transitions`)
|
|
312
339
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ssgoi/react",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0-beta.0",
|
|
4
4
|
"description": "React bindings for SSGOI - Native app-like page transitions for React applications",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"unplugin": "^2.3.2",
|
|
68
68
|
"@babel/core": "^7.26.10",
|
|
69
|
-
"@ssgoi/core": "^6.
|
|
69
|
+
"@ssgoi/core": "^6.5.0-beta.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__core": "^7.20.5",
|