@ssgoi/svelte 6.6.10 → 7.0.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -194
  3. package/package.json +2 -2
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MeurSyphus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,245 +1,131 @@
1
1
  # @ssgoi/svelte
2
2
 
3
- Svelte bindings for SSGOI - Native app-like page transitions for Svelte and SvelteKit.
3
+ Svelte and SvelteKit bindings for SSGOI.
4
4
 
5
- try this: [ssgoi.dev](https://ssgoi.dev)
5
+ [![SSGOI live showcase](https://ssgoi.dev/readme.png)](https://ssgoi.dev)
6
6
 
7
- ![https://ssgoi.dev](https://ssgoi.dev/ssgoi.gif)
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
-
19
- ## What is SSGOI?
20
-
21
- SSGOI brings native app-like page transitions to the web. Transform your static page navigations into smooth, delightful experiences that users love.
22
-
23
- ### ✨ Key Features
24
-
25
- - **🌍 Works Everywhere** - Unlike the browser's View Transition API, SSGOI works in all modern browsers (Chrome, Firefox, Safari)
26
- - **🚀 SSR Ready** - Perfect compatibility with SvelteKit. No hydration issues, SEO-friendly
27
- - **🎯 Use Your Router** - Keep your existing routing. SvelteKit's built-in router works seamlessly
28
- - **💾 State Persistence** - Remembers animation state during navigation, even with browser back/forward
29
- - **🧩 Svelte Native** - Built specifically for Svelte components
30
-
31
- ## Installation
7
+ [Live demos](https://ssgoi.dev) · [Hero, Zoom, Film, and Sheet in motion](https://ssgoi.dev/blog/view-transition-api-limitations)
32
8
 
33
9
  ```bash
34
10
  npm install @ssgoi/svelte
35
- # or
36
- yarn add @ssgoi/svelte
37
- # or
38
- pnpm add @ssgoi/svelte
39
11
  ```
40
12
 
41
- ## Quick Start
13
+ Agent setup guide: https://ssgoi.dev/llms/svelte.txt
42
14
 
43
- ### 1. Wrap your app layout
15
+ ## Root
44
16
 
45
17
  ```svelte
46
- <!-- +layout.svelte -->
47
- <script>
18
+ <!-- src/routes/+layout.svelte -->
19
+ <script lang="ts">
48
20
  import { Ssgoi } from "@ssgoi/svelte";
49
- import { fade } from "@ssgoi/svelte/view-transitions";
21
+ import { drill } from "@ssgoi/svelte/view-transitions";
22
+
23
+ let { children } = $props();
50
24
 
51
25
  const config = {
52
- transitions: [fade({ paths: ["/", "/about"] })],
26
+ transitions: [{ on: "/posts/**", except: "/posts", transition: drill() }],
53
27
  };
54
28
  </script>
55
29
 
56
- <Ssgoi {config}>
57
- <!-- ⚠️ Important: position: relative + z-index: 0 are required (the outgoing page is cloned with position:absolute). Add overflow-x-clip if you use horizontal transitions. -->
58
- <div style="position: relative; z-index: 0; min-height: 100vh;">
59
- <slot />
60
- </div>
61
- </Ssgoi>
62
- ```
63
-
64
- ### 2. Mark your pages
65
-
66
- ```svelte
67
- <!-- +page.svelte -->
68
- <script>
69
- import { page } from "$app/stores";
70
- </script>
71
-
72
- <main data-ssgoi-transition={$page.url.pathname}>
73
- <h1>Welcome</h1>
74
- <!-- Page content -->
30
+ <main class="ssgoi-shell">
31
+ <Ssgoi {config}>
32
+ {@render children()}
33
+ </Ssgoi>
75
34
  </main>
76
35
  ```
77
36
 
78
- **That's it!** Your pages now transition smoothly with the configured effect.
79
-
80
- ## Advanced Transitions
81
-
82
- ### Route-based Transitions
83
-
84
- Define different transitions for different routes:
85
-
86
- ```svelte
87
- <script>
88
- import { Ssgoi } from "@ssgoi/svelte";
89
- import { scroll, drill, zoom } from "@ssgoi/svelte/view-transitions";
90
-
91
- const config = {
92
- transitions: [
93
- // Scroll between tabs
94
- scroll({ paths: ["/home", "/about"] }),
95
-
96
- // Drill in when entering details
97
- drill({ enter: "/products/*", exit: "/products" }),
98
-
99
- // Shared element image transitions
100
- zoom({ paths: ["/gallery", "/photo/*"], type: "expand" }),
101
- ],
102
- };
103
- </script>
104
-
105
- <Ssgoi {config}>
106
- <slot />
107
- </Ssgoi>
37
+ ```css
38
+ .ssgoi-shell {
39
+ position: relative;
40
+ z-index: 0;
41
+ min-height: 100dvh;
42
+ overflow-x: clip;
43
+ }
108
44
  ```
109
45
 
110
- The route helpers return path transition groups, so nested arrays are accepted in `config.transitions`.
46
+ ## Route boundary
111
47
 
112
- ## SvelteKit App Example
48
+ Mark each route root:
113
49
 
114
50
  ```svelte
115
- <!-- +layout.svelte -->
116
- <script>
117
- import { Ssgoi } from '@ssgoi/svelte';
118
- import { scroll } from '@ssgoi/svelte/view-transitions';
119
-
120
- const config = {
121
- transitions: [scroll({ paths: ['/', '/about', '/products'] })]
122
- };
123
- </script>
124
-
125
- <Ssgoi {config}>
126
- <div style="position: relative; z-index: 0; min-height: 100vh;">
127
- <nav>
128
- <a href="/">Home</a>
129
- <a href="/about">About</a>
130
- <a href="/products">Products</a>
131
- </nav>
132
- <slot />
133
- </div>
134
- </Ssgoi>
135
-
136
- <!-- +page.svelte -->
137
- <script>
138
- import { page } from '$app/stores';
139
- </script>
140
-
141
- <main data-ssgoi-transition={$page.url.pathname}>
142
- <!-- Your page content -->
143
- </main>
51
+ <!-- src/routes/posts/+page.svelte -->
52
+ <div data-ssgoi-transition="/posts">Posts</div>
144
53
  ```
145
54
 
146
- ## API Reference
147
-
148
- ### Components
149
-
150
- #### `<Ssgoi>`
151
-
152
- The provider component that manages transition context.
55
+ For dynamic routes, use the real path:
153
56
 
154
57
  ```svelte
155
- <Ssgoi config={ssgoiConfig}>
156
- <slot />
157
- </Ssgoi>
58
+ <div data-ssgoi-transition="/posts/{postId}">...</div>
158
59
  ```
159
60
 
160
- Props:
61
+ ## Persistent layouts
161
62
 
162
- - `config` - Transition configuration object
163
- - `host` - Optional external playback host for debug tooling
164
-
165
- #### `data-ssgoi-transition`
166
-
167
- Attribute for pages that should transition. Set it on the page boundary element
168
- inside `<Ssgoi>`.
63
+ A persistent `+layout.svelte` may own an outer boundary while child pages own
64
+ inner boundaries:
169
65
 
170
66
  ```svelte
171
- <main data-ssgoi-transition="/page-id">
172
- <slot />
173
- </main>
67
+ <div data-ssgoi-transition={$page.url.pathname}>
68
+ <ProductTabs />
69
+ {@render children()}
70
+ </div>
174
71
  ```
175
72
 
176
- ## Built-in Transitions
177
-
178
- ### Page Transitions (`@ssgoi/svelte/view-transitions`)
73
+ SvelteKit keeps the layout DOM during child navigation. Leaving the layout
74
+ uses the outer boundary; changing a child route uses the child boundary.
179
75
 
180
- - `fade()` - Calm cross-fade. Safe default for unrelated pages
181
- - `drill()` - iOS-style hierarchical navigation (list → detail)
182
- - `slide()` - Horizontal push for tabs / sequential flows
183
- - `scroll()` - Vertical page scroll for onboarding / paginated views
184
- - `axis()` - Material/Flutter shared-axis swap for sibling/tab routes
185
- - `sheet()` - Bottom sheet that slides up (modal-like flows)
186
- - `hero()` - Shared element transition (matching `data-hero-enter-key` / `data-hero-exit-key`)
187
- - `zoom()` - Card-to-detail expansion (matching `data-zoom-enter-key` / `data-zoom-exit-key`)
188
- - `strip()` - 3D Y-axis perspective flip
189
- - `blind()` - Window-blinds wipe reveal
190
- - `film()` - Cinematic shrink + tile (gallery / lightbox)
191
- - `rotate()` - Card flip between siblings
192
- - `jaemin()` - Playful rotated zoom for special moments
76
+ Use a keyed block only when the router reuses the same DOM node and a new
77
+ boundary must be forced:
193
78
 
194
- ## Typed Preset Configuration
195
-
196
- Transition presets are fully typed and use the core animation engine internally:
197
-
198
- ```javascript
199
- slide({
200
- paths: ["/products/all", "/products/fashion"],
201
- });
79
+ ```svelte
80
+ {#key resolveKey($page.url.pathname)}
81
+ <div data-ssgoi-transition={$page.url.pathname}>
82
+ {@render children()}
83
+ </div>
84
+ {/key}
202
85
  ```
203
86
 
204
- ## TypeScript Support
205
-
206
- SSGOI is written in TypeScript and provides full type definitions:
207
-
208
- ```typescript
209
- import type { SsgoiConfig, TransitionConfig } from "@ssgoi/svelte";
210
-
211
- const config: SsgoiConfig = {
212
- // Full type safety
87
+ ## Config
88
+
89
+ ```ts
90
+ import { drill, slide, zoom } from "@ssgoi/svelte/view-transitions";
91
+
92
+ const config = {
93
+ transitions: [
94
+ {
95
+ on: "/posts/**",
96
+ except: "/posts",
97
+ transition: drill(),
98
+ },
99
+ {
100
+ from: "/gallery",
101
+ to: "/gallery/*",
102
+ transition: zoom(),
103
+ },
104
+ {
105
+ ordered: ["/tabs/a", "/tabs/b"],
106
+ transition: slide(),
107
+ },
108
+ ],
213
109
  };
214
110
  ```
215
111
 
216
- ## Browser Support
217
-
218
- - Chrome/Edge 88+
219
- - Firefox 78+
220
- - Safari 14+
221
- - All modern mobile browsers
222
-
223
- ## Performance
224
-
225
- - Minimal bundle size (~8kb gzipped)
226
- - Hardware-accelerated animations
227
- - Automatic cleanup and memory management
228
- - Smart preloading for instant transitions
229
-
230
- ## Documentation
112
+ Scroll is automatic: `on` and `from`/`to` restore `from` and reset `to`;
113
+ `ordered` restores both. Override with
114
+ `preserveScroll: { from: boolean, to: boolean }`.
231
115
 
232
- Visit [https://ssgoi.dev](https://ssgoi.dev) for:
116
+ ## Effect index
233
117
 
234
- - Complete API reference
235
- - Interactive examples
236
- - Advanced patterns
237
- - Migration guides
118
+ - `fade`: unrelated pages.
119
+ - `drill`: list → detail.
120
+ - `slide` or `axis`: ordered tabs.
121
+ - `sheet`: modal-like routes.
122
+ - `zoom` or `hero`: shared-element details.
123
+ - `scroll`: vertical sequences.
238
124
 
239
- ## Contributing
125
+ All effects: https://ssgoi.dev/llms.txt#7-transition-index
240
126
 
241
- We welcome contributions! Please see our [contributing guide](https://github.com/meursyphus/ssgoi/blob/main/CONTRIBUTING.md) for details.
127
+ `SsgoiTransition` is deprecated. Use the data attribute directly.
242
128
 
243
129
  ## License
244
130
 
245
- MIT © [MeurSyphus](https://github.com/meursyphus)
131
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssgoi/svelte",
3
- "version": "6.6.10",
3
+ "version": "7.0.0",
4
4
  "description": "Svelte bindings for SSGOI - Native app-like page transitions for Svelte and SvelteKit applications",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
@@ -14,7 +14,7 @@
14
14
  "types": "./dist/index.d.ts",
15
15
  "type": "module",
16
16
  "dependencies": {
17
- "@ssgoi/core": "^6.6.10"
17
+ "@ssgoi/core": "^7.0.0"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "svelte": "^5.0.0"