@ssgoi/svelte 0.0.1

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 ADDED
@@ -0,0 +1,58 @@
1
+ # Svelte library
2
+
3
+ Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
4
+
5
+ Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
6
+
7
+ ## Creating a project
8
+
9
+ If you're seeing this, you've probably already done this step. Congrats!
10
+
11
+ ```bash
12
+ # create a new project in the current directory
13
+ npx sv create
14
+
15
+ # create a new project in my-app
16
+ npx sv create my-app
17
+ ```
18
+
19
+ ## Developing
20
+
21
+ Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
22
+
23
+ ```bash
24
+ npm run dev
25
+
26
+ # or start the server and open the app in a new browser tab
27
+ npm run dev -- --open
28
+ ```
29
+
30
+ Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
31
+
32
+ ## Building
33
+
34
+ To build your library:
35
+
36
+ ```bash
37
+ npm run package
38
+ ```
39
+
40
+ To create a production version of your showcase app:
41
+
42
+ ```bash
43
+ npm run build
44
+ ```
45
+
46
+ You can preview the production build with `npm run preview`.
47
+
48
+ > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
49
+
50
+ ## Publishing
51
+
52
+ Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
53
+
54
+ To publish your library to [npm](https://www.npmjs.com):
55
+
56
+ ```bash
57
+ npm publish
58
+ ```
@@ -0,0 +1,3 @@
1
+ import type { SsgoiContext } from './types.js';
2
+ export declare function setSsgoiContext(context: SsgoiContext): void;
3
+ export declare function getSsgoiContext(): SsgoiContext;
@@ -0,0 +1,12 @@
1
+ import { getContext, setContext } from 'svelte';
2
+ const SSGOI_CONTEXT_KEY = Symbol('ssgoi');
3
+ export function setSsgoiContext(context) {
4
+ setContext(SSGOI_CONTEXT_KEY, context);
5
+ }
6
+ export function getSsgoiContext() {
7
+ const context = getContext(SSGOI_CONTEXT_KEY);
8
+ if (!context) {
9
+ throw new Error('getSsgoiContext must be called within Ssgoi component');
10
+ }
11
+ return context;
12
+ }
@@ -0,0 +1,4 @@
1
+ export { transition } from './transition.js';
2
+ export { default as Ssgoi } from './ssgoi.svelte';
3
+ export { default as SsgoiTransition } from './ssgoi-transition.svelte';
4
+ export * from './types.js';
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { transition } from './transition.js';
2
+ export { default as Ssgoi } from './ssgoi.svelte';
3
+ export { default as SsgoiTransition } from './ssgoi-transition.svelte';
4
+ export * from './types.js';
@@ -0,0 +1,17 @@
1
+ <script lang="ts">
2
+ import { transition } from './transition';
3
+ import { getSsgoiContext } from './context';
4
+
5
+ interface Props {
6
+ id: string;
7
+ children: () => any;
8
+ }
9
+
10
+ let { id, children }: Props = $props();
11
+
12
+ const getTransition = getSsgoiContext();
13
+ </script>
14
+
15
+ <div use:transition={getTransition(id)} data-ssgoi-transition={id}>
16
+ {@render children()}
17
+ </div>
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ id: string;
3
+ children: () => any;
4
+ }
5
+ declare const SsgoiTransition: import("svelte").Component<Props, {}, "">;
6
+ type SsgoiTransition = ReturnType<typeof SsgoiTransition>;
7
+ export default SsgoiTransition;
@@ -0,0 +1,17 @@
1
+ <script lang="ts">
2
+ import type { SsgoiConfig } from '@ssgoi/core/types';
3
+ import { setSsgoiContext } from './context';
4
+ import { createSggoiTransitionContext } from '@ssgoi/core';
5
+
6
+ interface Props {
7
+ config: SsgoiConfig;
8
+ children: () => any;
9
+ }
10
+
11
+ let { config, children }: Props = $props();
12
+
13
+ const contextValue = createSggoiTransitionContext(config);
14
+ setSsgoiContext(contextValue);
15
+ </script>
16
+
17
+ {@render children()}
@@ -0,0 +1,8 @@
1
+ import type { SsgoiConfig } from '@ssgoi/core/types';
2
+ interface Props {
3
+ config: SsgoiConfig;
4
+ children: () => any;
5
+ }
6
+ declare const Ssgoi: import("svelte").Component<Props, {}, "">;
7
+ type Ssgoi = ReturnType<typeof Ssgoi>;
8
+ export default Ssgoi;
@@ -0,0 +1,9 @@
1
+ import { type Transition, type TransitionKey } from "@ssgoi/core";
2
+ export declare const transition: (node: HTMLElement, params: Transition & {
3
+ key: TransitionKey;
4
+ }) => {
5
+ update(newParams: Transition & {
6
+ key: TransitionKey;
7
+ }): void;
8
+ destroy(): void;
9
+ };
@@ -0,0 +1,22 @@
1
+ import { transition as _transition, } from "@ssgoi/core";
2
+ export const transition = (node, params) => {
3
+ let callback = _transition({
4
+ key: params.key,
5
+ in: params.in,
6
+ out: params.out,
7
+ });
8
+ let cleanup = callback(node);
9
+ return {
10
+ update(newParams) {
11
+ callback = _transition({
12
+ key: newParams.key,
13
+ in: newParams.in,
14
+ out: newParams.out,
15
+ });
16
+ cleanup = callback(node);
17
+ },
18
+ destroy() {
19
+ cleanup?.();
20
+ },
21
+ };
22
+ };
@@ -0,0 +1 @@
1
+ export * from '@ssgoi/core/transitions';
@@ -0,0 +1 @@
1
+ export * from '@ssgoi/core/transitions';
@@ -0,0 +1 @@
1
+ export * from "@ssgoi/core/types";
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export * from "@ssgoi/core/types";
@@ -0,0 +1 @@
1
+ export * from '@ssgoi/core/view-transitions';
@@ -0,0 +1 @@
1
+ export * from '@ssgoi/core/view-transitions';
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@ssgoi/svelte",
3
+ "version": "0.0.1",
4
+ "files": [
5
+ "dist",
6
+ "!dist/**/*.test.*",
7
+ "!dist/**/*.spec.*"
8
+ ],
9
+ "sideEffects": [
10
+ "**/*.css"
11
+ ],
12
+ "svelte": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "type": "module",
15
+ "dependencies": {
16
+ "@ssgoi/core": "0.0.1"
17
+ },
18
+ "peerDependencies": {
19
+ "svelte": "^5.0.0"
20
+ },
21
+ "devDependencies": {
22
+ "@eslint/compat": "^1.2.5",
23
+ "@eslint/js": "^9.18.0",
24
+ "@sveltejs/adapter-auto": "^6.0.0",
25
+ "@sveltejs/kit": "^2.16.0",
26
+ "@sveltejs/package": "^2.0.0",
27
+ "@sveltejs/vite-plugin-svelte": "^5.0.0",
28
+ "eslint": "^9.18.0",
29
+ "eslint-config-prettier": "^10.0.1",
30
+ "eslint-plugin-svelte": "^3.0.0",
31
+ "globals": "^16.0.0",
32
+ "prettier": "^3.4.2",
33
+ "prettier-plugin-svelte": "^3.3.3",
34
+ "publint": "^0.3.2",
35
+ "svelte": "^5.0.0",
36
+ "svelte-check": "^4.0.0",
37
+ "typescript": "^5.0.0",
38
+ "typescript-eslint": "^8.20.0",
39
+ "vite": "^6.2.6"
40
+ },
41
+ "keywords": [
42
+ "svelte"
43
+ ],
44
+ "exports": {
45
+ ".": {
46
+ "types": "./dist/index.d.ts",
47
+ "import": "./dist/index.js"
48
+ },
49
+ "./transitions": {
50
+ "types": "./dist/transitions/index.d.ts",
51
+ "import": "./dist/transitions/index.js"
52
+ },
53
+ "./view-transitions": {
54
+ "types": "./dist/view-transitions/index.d.ts",
55
+ "import": "./dist/view-transitions/index.js"
56
+ },
57
+ "./types": {
58
+ "types": "./dist/types.d.ts",
59
+ "import": "./dist/types.js"
60
+ }
61
+ },
62
+ "scripts": {
63
+ "dev": "vite dev",
64
+ "build": "vite build && npm run prepack",
65
+ "preview": "vite preview",
66
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
67
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
68
+ "format": "prettier --write .",
69
+ "lint": "prettier --check . && eslint ."
70
+ }
71
+ }