@ssgoi/svelte 2.5.4 → 3.1.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/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { transition } from "./transition.js";
2
2
  export { default as Ssgoi } from "./ssgoi.svelte";
3
3
  export { default as SsgoiTransition } from "./ssgoi-transition.svelte";
4
+ export { default as TransitionScope } from "./transition-scope.svelte";
4
5
  export * from "./types.js";
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { transition } from "./transition.js";
2
2
  export { default as Ssgoi } from "./ssgoi.svelte";
3
3
  export { default as SsgoiTransition } from "./ssgoi-transition.svelte";
4
+ export { default as TransitionScope } from "./transition-scope.svelte";
4
5
  export * from "./types.js";
@@ -0,0 +1,30 @@
1
+ <script lang="ts">
2
+ import { createTransitionScope } from "@ssgoi/core";
3
+
4
+ interface Props {
5
+ children: () => any;
6
+ }
7
+
8
+ let { children }: Props = $props();
9
+ </script>
10
+
11
+ <!--
12
+ TransitionScope creates a boundary for local-scoped transitions.
13
+
14
+ Child elements with `scope: 'local'` will:
15
+ - Skip IN animation when mounted simultaneously with the scope
16
+ - Skip OUT animation when unmounted simultaneously with the scope
17
+
18
+ @example
19
+ ```svelte
20
+ <TransitionScope>
21
+ <div use:transition={[fadeIn(), { scope: 'local' }]}>
22
+ This will only animate when added/removed independently,
23
+ not when the entire scope mounts/unmounts.
24
+ </div>
25
+ </TransitionScope>
26
+ ```
27
+ -->
28
+ <div use:createTransitionScope style="display: contents;">
29
+ {@render children()}
30
+ </div>
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ children: () => any;
3
+ }
4
+ declare const TransitionScope: import("svelte").Component<Props, {}, "">;
5
+ type TransitionScope = ReturnType<typeof TransitionScope>;
6
+ export default TransitionScope;
@@ -1,9 +1,10 @@
1
- import { type Transition, type TransitionKey } from "@ssgoi/core";
2
- export declare const transition: <TAnimationValue = number>(node: HTMLElement, params: Transition<undefined, TAnimationValue> & {
1
+ import { type Transition, type TransitionKey, type TransitionScope } from "@ssgoi/core";
2
+ type TransitionParams = Transition<undefined> & {
3
3
  key?: TransitionKey;
4
- }) => {
5
- update(newParams: Transition<undefined, TAnimationValue> & {
6
- key?: TransitionKey;
7
- }): void;
4
+ scope?: TransitionScope;
5
+ };
6
+ export declare const transition: (node: HTMLElement, params: TransitionParams) => {
7
+ update(newParams: TransitionParams): void;
8
8
  destroy(): void;
9
9
  };
10
+ export {};
@@ -5,6 +5,7 @@ export var transition = function (node, params) {
5
5
  in: params === null || params === void 0 ? void 0 : params.in,
6
6
  out: params === null || params === void 0 ? void 0 : params.out,
7
7
  ref: node,
8
+ scope: params === null || params === void 0 ? void 0 : params.scope,
8
9
  });
9
10
  var cleanup = callback(node);
10
11
  return {
@@ -14,6 +15,7 @@ export var transition = function (node, params) {
14
15
  in: newParams === null || newParams === void 0 ? void 0 : newParams.in,
15
16
  out: newParams === null || newParams === void 0 ? void 0 : newParams.out,
16
17
  ref: node,
18
+ scope: newParams === null || newParams === void 0 ? void 0 : newParams.scope,
17
19
  });
18
20
  cleanup = callback(node);
19
21
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssgoi/svelte",
3
- "version": "2.5.4",
3
+ "version": "3.1.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": "^2.5.4"
17
+ "@ssgoi/core": "^3.1.0"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "svelte": "^5.0.0"