@ssgoi/svelte 3.1.0 → 5.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 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 { fadeIn, slideUp } from "@ssgoi/svelte/transitions";
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: fadeIn(),
139
- out: slideUp(),
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: fadeIn(),
214
- out: fadeOut(),
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
- - `fadeIn()` / `fadeOut()`
250
- - `slideUp()` / `slideDown()` / `slideLeft()` / `slideRight()`
251
- - `scaleIn()` / `scaleOut()`
249
+ - `fade()`
250
+ - `slide({ direction: 'up' | 'down' | 'left' | 'right' })`
251
+ - `scale()`
252
252
  - `bounce()`
253
253
  - `blur()`
254
254
  - `rotate()`
@@ -1,8 +1,15 @@
1
1
  import { type Transition, type TransitionKey, type TransitionScope } from "@ssgoi/core";
2
2
  type TransitionParams = Transition<undefined> & {
3
- key?: TransitionKey;
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;
@@ -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 === null || params === void 0 ? void 0 : params.key,
5
- in: params === null || params === void 0 ? void 0 : params.in,
6
- out: params === null || params === void 0 ? void 0 : params.out,
7
- ref: node,
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 === null || newParams === void 0 ? void 0 : newParams.key,
15
- in: newParams === null || newParams === void 0 ? void 0 : newParams.in,
16
- out: newParams === null || newParams === void 0 ? void 0 : newParams.out,
17
- ref: node,
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.1.0",
3
+ "version": "5.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": "^3.1.0"
17
+ "@ssgoi/core": "^5.0.0"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "svelte": "^5.0.0"
@@ -41,10 +41,18 @@
41
41
  },
42
42
  "keywords": [
43
43
  "svelte",
44
+ "sveltekit",
44
45
  "page-transition",
46
+ "page-transitions",
47
+ "view-transitions",
48
+ "view-transition-api-alternative",
45
49
  "animation",
46
50
  "ssgoi",
47
- "spring-physics"
51
+ "spring-physics",
52
+ "cross-browser",
53
+ "navigation-animation",
54
+ "hero-transition",
55
+ "shared-element-transition"
48
56
  ],
49
57
  "author": "MeurSyphus <tmdeoans@snu.ac.kr>",
50
58
  "license": "MIT",