@ssgoi/svelte 3.1.0 → 4.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.
- package/README.md +8 -8
- package/dist/transition.d.ts +8 -1
- package/dist/transition.js +17 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -129,14 +129,14 @@ Animate specific elements during mount/unmount:
|
|
|
129
129
|
```svelte
|
|
130
130
|
<script>
|
|
131
131
|
import { transition } from "@ssgoi/svelte";
|
|
132
|
-
import {
|
|
132
|
+
import { fade, slide } from "@ssgoi/svelte/transitions";
|
|
133
133
|
</script>
|
|
134
134
|
|
|
135
135
|
<div
|
|
136
136
|
use:transition={{
|
|
137
137
|
key: "card",
|
|
138
|
-
in:
|
|
139
|
-
out:
|
|
138
|
+
in: fade(),
|
|
139
|
+
out: slide({ direction: 'up' }),
|
|
140
140
|
}}
|
|
141
141
|
>
|
|
142
142
|
<h2>Animated Card</h2>
|
|
@@ -210,8 +210,8 @@ Apply transitions to individual elements.
|
|
|
210
210
|
<div
|
|
211
211
|
use:transition={{
|
|
212
212
|
key: "unique-key",
|
|
213
|
-
in:
|
|
214
|
-
out:
|
|
213
|
+
in: fade(),
|
|
214
|
+
out: fade(),
|
|
215
215
|
}}
|
|
216
216
|
>
|
|
217
217
|
Content
|
|
@@ -246,9 +246,9 @@ Access transition state.
|
|
|
246
246
|
|
|
247
247
|
### Element Transitions (`@ssgoi/svelte/transitions`)
|
|
248
248
|
|
|
249
|
-
- `
|
|
250
|
-
- `
|
|
251
|
-
- `
|
|
249
|
+
- `fade()`
|
|
250
|
+
- `slide({ direction: 'up' | 'down' | 'left' | 'right' })`
|
|
251
|
+
- `scale()`
|
|
252
252
|
- `bounce()`
|
|
253
253
|
- `blur()`
|
|
254
254
|
- `rotate()`
|
package/dist/transition.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { type Transition, type TransitionKey, type TransitionScope } from "@ssgoi/core";
|
|
2
2
|
type TransitionParams = Transition<undefined> & {
|
|
3
|
-
key
|
|
3
|
+
key: TransitionKey;
|
|
4
4
|
scope?: TransitionScope;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Svelte action for element transitions
|
|
8
|
+
*
|
|
9
|
+
* Uses Svelte's destroy callback for OUT transition detection.
|
|
10
|
+
* This ensures the correct transition config is used even when
|
|
11
|
+
* params are updated (e.g., during SvelteKit page navigation).
|
|
12
|
+
*/
|
|
6
13
|
export declare const transition: (node: HTMLElement, params: TransitionParams) => {
|
|
7
14
|
update(newParams: TransitionParams): void;
|
|
8
15
|
destroy(): void;
|
package/dist/transition.js
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
import { transition as _transition, } from "@ssgoi/core";
|
|
2
|
+
/**
|
|
3
|
+
* Svelte action for element transitions
|
|
4
|
+
*
|
|
5
|
+
* Uses Svelte's destroy callback for OUT transition detection.
|
|
6
|
+
* This ensures the correct transition config is used even when
|
|
7
|
+
* params are updated (e.g., during SvelteKit page navigation).
|
|
8
|
+
*/
|
|
2
9
|
export var transition = function (node, params) {
|
|
3
10
|
var callback = _transition({
|
|
4
|
-
key: params
|
|
5
|
-
in: params
|
|
6
|
-
out: params
|
|
7
|
-
|
|
8
|
-
scope: params === null || params === void 0 ? void 0 : params.scope,
|
|
11
|
+
key: params.key,
|
|
12
|
+
in: params.in,
|
|
13
|
+
out: params.out,
|
|
14
|
+
scope: params.scope,
|
|
9
15
|
});
|
|
10
16
|
var cleanup = callback(node);
|
|
11
17
|
return {
|
|
12
18
|
update: function (newParams) {
|
|
13
19
|
callback = _transition({
|
|
14
|
-
key: newParams
|
|
15
|
-
in: newParams
|
|
16
|
-
out: newParams
|
|
17
|
-
|
|
18
|
-
scope: newParams === null || newParams === void 0 ? void 0 : newParams.scope,
|
|
20
|
+
key: newParams.key,
|
|
21
|
+
in: newParams.in,
|
|
22
|
+
out: newParams.out,
|
|
23
|
+
scope: newParams.scope,
|
|
19
24
|
});
|
|
20
25
|
cleanup = callback(node);
|
|
21
26
|
},
|
|
22
27
|
destroy: function () {
|
|
28
|
+
// Call cleanup to trigger OUT transition with the correct config
|
|
29
|
+
// The cleanup function captures the transition config at registration time
|
|
23
30
|
cleanup === null || cleanup === void 0 ? void 0 : cleanup();
|
|
24
31
|
},
|
|
25
32
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ssgoi/svelte",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.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": "^
|
|
17
|
+
"@ssgoi/core": "^4.0.0"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"svelte": "^5.0.0"
|