@ssgoi/svelte 6.2.0 → 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 CHANGED
@@ -51,19 +51,18 @@ pnpm add @ssgoi/svelte
51
51
  </Ssgoi>
52
52
  ```
53
53
 
54
- ### 2. Wrap your pages
54
+ ### 2. Mark your pages
55
55
 
56
56
  ```svelte
57
57
  <!-- +page.svelte -->
58
58
  <script>
59
- import { SsgoiTransition } from "@ssgoi/svelte";
60
59
  import { page } from "$app/stores";
61
60
  </script>
62
61
 
63
- <SsgoiTransition id={$page.url.pathname}>
62
+ <main data-ssgoi-transition={$page.url.pathname}>
64
63
  <h1>Welcome</h1>
65
64
  <!-- Page content -->
66
- </SsgoiTransition>
65
+ </main>
67
66
  ```
68
67
 
69
68
  **That's it!** Your pages now transition smoothly with the configured effect.
@@ -126,13 +125,12 @@ The route helpers return path transition groups, so nested arrays are accepted i
126
125
 
127
126
  <!-- +page.svelte -->
128
127
  <script>
129
- import { SsgoiTransition } from '@ssgoi/svelte';
130
128
  import { page } from '$app/stores';
131
129
  </script>
132
130
 
133
- <SsgoiTransition id={$page.url.pathname}>
131
+ <main data-ssgoi-transition={$page.url.pathname}>
134
132
  <!-- Your page content -->
135
- </SsgoiTransition>
133
+ </main>
136
134
  ```
137
135
 
138
136
  ## API Reference
@@ -154,14 +152,15 @@ Props:
154
152
  - `config` - Transition configuration object
155
153
  - `host` - Optional external playback host for debug tooling
156
154
 
157
- #### `<SsgoiTransition>`
155
+ #### `data-ssgoi-transition`
158
156
 
159
- Wrapper component for pages that should transition.
157
+ Attribute for pages that should transition. Set it on the page boundary element
158
+ inside `<Ssgoi>`.
160
159
 
161
160
  ```svelte
162
- <SsgoiTransition id="/page-id">
161
+ <main data-ssgoi-transition="/page-id">
163
162
  <slot />
164
- </SsgoiTransition>
163
+ </main>
165
164
  ```
166
165
 
167
166
  ## Built-in Transitions
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as Ssgoi } from "./ssgoi.svelte";
2
+ /** @deprecated Set `data-ssgoi-transition` directly on an element inside `<Ssgoi>` instead. */
2
3
  export { default as SsgoiTransition } from "./ssgoi-transition.svelte";
3
4
  export * from "./types.js";
4
5
  export * from "@ssgoi/core";
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as Ssgoi } from "./ssgoi.svelte";
2
+ /** @deprecated Set `data-ssgoi-transition` directly on an element inside `<Ssgoi>` instead. */
2
3
  export { default as SsgoiTransition } from "./ssgoi-transition.svelte";
3
4
  export * from "./types.js";
4
5
  export * from "@ssgoi/core";
@@ -2,6 +2,10 @@
2
2
  import type { Snippet } from "svelte";
3
3
  import { getSsgoiContext } from "./context";
4
4
 
5
+ /**
6
+ * @deprecated Set `data-ssgoi-transition` directly on the page boundary
7
+ * element inside `<Ssgoi>` instead.
8
+ */
5
9
  interface Props {
6
10
  id: string;
7
11
  children: Snippet;
@@ -1,4 +1,8 @@
1
1
  import type { Snippet } from "svelte";
2
+ /**
3
+ * @deprecated Set `data-ssgoi-transition` directly on the page boundary
4
+ * element inside `<Ssgoi>` instead.
5
+ */
2
6
  interface Props {
3
7
  id: string;
4
8
  children: Snippet;
package/dist/ssgoi.svelte CHANGED
@@ -3,7 +3,11 @@
3
3
  import type { SsgoiConfig } from "@ssgoi/core/types";
4
4
  import type { HostAnimation } from "@ssgoi/core/internal";
5
5
  import { setSsgoiContext } from "./context";
6
- import { createSggoiTransitionContext } from "@ssgoi/core/internal";
6
+ import {
7
+ createSggoiTransitionContext,
8
+ observeSsgoiTransitions,
9
+ } from "@ssgoi/core/internal";
10
+ import { onMount } from "svelte";
7
11
 
8
12
  interface Props {
9
13
  config: SsgoiConfig;
@@ -15,6 +19,12 @@
15
19
 
16
20
  const contextValue = createSggoiTransitionContext(config, { host });
17
21
  setSsgoiContext(contextValue);
22
+
23
+ let root: HTMLDivElement;
24
+
25
+ onMount(() => observeSsgoiTransitions(root, contextValue));
18
26
  </script>
19
27
 
20
- {@render children()}
28
+ <div bind:this={root} data-ssgoi-root="" style="display: contents">
29
+ {@render children()}
30
+ </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssgoi/svelte",
3
- "version": "6.2.0",
3
+ "version": "6.4.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.2.0"
17
+ "@ssgoi/core": "^6.4.0"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "svelte": "^5.0.0"