@zitadel/sdk-svelte 0.1.0-alpha.11

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ZITADEL
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # @zitadel/sdk-svelte
2
+
3
+ Svelte 5 components for the Zitadel auth UI, for client-side SPAs (Vite, etc.).
4
+
5
+ ## Requirements
6
+
7
+ TypeScript ≥ 5.0 — the published type definitions re-export with `export type *`, which TypeScript introduced in 5.0.
8
+
9
+ ## Usage
10
+
11
+ ```svelte
12
+ <script lang="ts">
13
+ import { ZitadelLogin, configureZitadel } from '@zitadel/sdk-svelte';
14
+
15
+ const project = configureZitadel({
16
+ projectId: import.meta.env.VITE_ZITADEL_PROJECT_ID,
17
+ proxyPath: '/__nextgen',
18
+ });
19
+ </script>
20
+
21
+ <ZitadelLogin {project} purpose="login" postSignInUrl="/" />
22
+ ```
23
+
24
+ `<ZitadelLogout {project} postSignOutUrl="/login" />` works the same way.
25
+
26
+ The widget's flow events are also surfaced as optional callbacks:
27
+ `onFlowStep`, `onFlowInput`, `onFlowComplete`, and `onFlowError`.
28
+
29
+ ## Proxying to the backend (deployment)
30
+
31
+ The widgets call `${proxyPath}/…` same-origin (default `/__nextgen`). A SPA has no
32
+ server, so on Vercel use `@zitadel/edge-proxy` to forward those calls:
33
+
34
+ ```ts
35
+ // api/__nextgen/[...path].ts (Vercel Edge Function)
36
+ import { handleProxy, resolveConfig } from '@zitadel/edge-proxy';
37
+ export const config = { runtime: 'edge' };
38
+ const proxyConfig = resolveConfig({
39
+ apiUrl: process.env.NEXTGEN_API_URL ?? '',
40
+ });
41
+ export default (req: Request) => handleProxy(req, proxyConfig);
42
+ ```
43
+
44
+ ```json
45
+ // vercel.json
46
+ {
47
+ "rewrites": [
48
+ { "source": "/__nextgen/(.*)", "destination": "/api/__nextgen/$1" }
49
+ ]
50
+ }
51
+ ```
52
+
53
+ For local development you can skip the proxy and point `proxyPath` straight at the
54
+ backend (cross-origin), e.g. `proxyPath: "http://localhost:4000"`.
@@ -0,0 +1,8 @@
1
+ import '@zitadel/components';
2
+ import type { ZitadelLogin as ZitadelLoginElement } from '@zitadel/components';
3
+ import type { ZitadelLoginProps } from './types';
4
+ declare const ZitadelLogin: import("svelte").Component<ZitadelLoginProps, {
5
+ getElement: () => ZitadelLoginElement | undefined;
6
+ }, "">;
7
+ type ZitadelLogin = ReturnType<typeof ZitadelLogin>;
8
+ export default ZitadelLogin;
@@ -0,0 +1,8 @@
1
+ import '@zitadel/components';
2
+ import type { ZitadelLogout as ZitadelLogoutElement } from '@zitadel/components';
3
+ import type { ZitadelLogoutProps } from './types';
4
+ declare const ZitadelLogout: import("svelte").Component<ZitadelLogoutProps, {
5
+ getElement: () => ZitadelLogoutElement | undefined;
6
+ }, "">;
7
+ type ZitadelLogout = ReturnType<typeof ZitadelLogout>;
8
+ export default ZitadelLogout;
@@ -0,0 +1,5 @@
1
+ export { default as ZitadelLogin } from "./ZitadelLogin.svelte";
2
+ export { default as ZitadelLogout } from "./ZitadelLogout.svelte";
3
+ export { configureZitadel, getApi, getZitadelConfig } from "@zitadel/api/config";
4
+ export type { ZitadelConfig, ZitadelProject } from "@zitadel/api/config";
5
+ export * from "./types";
package/dist/index.js ADDED
@@ -0,0 +1,49 @@
1
+ import "svelte/internal/disclose-version";
2
+ import * as e from "svelte/internal/client";
3
+ import "@zitadel/components";
4
+ import { configureZitadel as h, getApi as j, getZitadelConfig as x } from "@zitadel/api/config";
5
+ var f = e.from_html("<zitadel-login></zitadel-login>", 2);
6
+ function z(s, t) {
7
+ e.push(t, !0);
8
+ let a = e.prop(t, "purpose", 3, "login"), i = e.state(void 0);
9
+ function m() {
10
+ return e.get(i);
11
+ }
12
+ e.user_effect(() => {
13
+ const o = e.get(i);
14
+ if (!o)
15
+ return;
16
+ const d = (r) => t.onFlowStep?.(r.detail), u = (r) => t.onFlowInput?.(r.detail), _ = (r) => t.onFlowComplete?.(r.detail), c = (r) => t.onFlowError?.(r.detail);
17
+ return o.addEventListener("zitadel-flow-step", d), o.addEventListener("zitadel-flow-input", u), o.addEventListener("zitadel-flow-complete", _), o.addEventListener("zitadel-flow-error", c), () => {
18
+ o.removeEventListener("zitadel-flow-step", d), o.removeEventListener("zitadel-flow-input", u), o.removeEventListener("zitadel-flow-complete", _), o.removeEventListener("zitadel-flow-error", c);
19
+ };
20
+ });
21
+ var l = { getElement: m }, n = f();
22
+ return e.template_effect(() => e.set_custom_element_data(n, "project", t.project)), e.template_effect(() => e.set_custom_element_data(n, "purpose", a())), e.template_effect(() => e.set_custom_element_data(n, "project-id", t.projectId)), e.template_effect(() => e.set_custom_element_data(n, "proxy-path", t.proxyPath)), e.template_effect(() => e.set_custom_element_data(n, "post-sign-in-url", t.postSignInUrl)), e.bind_this(n, (o) => e.set(i, o), () => e.get(i)), e.append(s, n), e.pop(l);
23
+ }
24
+ var p = e.from_html("<zitadel-logout></zitadel-logout>", 2);
25
+ function E(s, t) {
26
+ e.push(t, !0);
27
+ let a = e.state(void 0);
28
+ function i() {
29
+ return e.get(a);
30
+ }
31
+ e.user_effect(() => {
32
+ const n = e.get(a);
33
+ if (!n)
34
+ return;
35
+ const o = (d) => t.onSignout?.(d.detail);
36
+ return n.addEventListener("zitadel-signout", o), () => {
37
+ n.removeEventListener("zitadel-signout", o);
38
+ };
39
+ });
40
+ var m = { getElement: i }, l = p();
41
+ return e.template_effect(() => e.set_custom_element_data(l, "project", t.project)), e.template_effect(() => e.set_custom_element_data(l, "project-id", t.projectId)), e.template_effect(() => e.set_custom_element_data(l, "proxy-path", t.proxyPath)), e.template_effect(() => e.set_custom_element_data(l, "post-sign-out-url", t.postSignOutUrl)), e.bind_this(l, (n) => e.set(a, n), () => e.get(a)), e.append(s, l), e.pop(m);
42
+ }
43
+ export {
44
+ z as ZitadelLogin,
45
+ E as ZitadelLogout,
46
+ h as configureZitadel,
47
+ j as getApi,
48
+ x as getZitadelConfig
49
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Re-exports the shared SPA widget types from `@zitadel/sdk-core`.
3
+ *
4
+ * `export type *` keeps this surface in lockstep with the core SPA contract: a
5
+ * type added there is re-exported here automatically, and none can be dropped by
6
+ * hand. The server-middleware types live in a separate core module and stay out
7
+ * of the browser SDK surface.
8
+ */
9
+ export type * from "@zitadel/sdk-core/types";
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@zitadel/sdk-svelte",
3
+ "version": "0.1.0-alpha.11",
4
+ "description": "Svelte components for the Zitadel auth UI (client-side SPA).",
5
+ "homepage": "https://github.com/zitadel/nextgen/tree/main/packages/sdk-svelte#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/zitadel/nextgen/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/zitadel/nextgen.git",
12
+ "directory": "packages/sdk-svelte"
13
+ },
14
+ "license": "MIT",
15
+ "type": "module",
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "svelte": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "svelte": "./dist/index.js",
25
+ "default": "./dist/index.js"
26
+ }
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "dependencies": {
32
+ "@zitadel/api": "0.1.0-alpha.11",
33
+ "@zitadel/components": "0.1.0-alpha.11",
34
+ "@zitadel/sdk-core": "0.1.0-alpha.11"
35
+ },
36
+ "peerDependencies": {
37
+ "svelte": "^5.0.0"
38
+ },
39
+ "devDependencies": {
40
+ "@eslint/js": "^9.0.0",
41
+ "@eslint/json": "^0.11.0",
42
+ "@eslint/markdown": "^6.0.0",
43
+ "@sveltejs/vite-plugin-svelte": "^6.2.0",
44
+ "@testing-library/svelte": "^5.3.1",
45
+ "eslint": "^9.0.0",
46
+ "eslint-config-prettier": "^10.0.0",
47
+ "eslint-import-resolver-typescript": "^3.7.0",
48
+ "eslint-plugin-import": "^2.31.0",
49
+ "eslint-plugin-perfectionist": "^4.0.0",
50
+ "eslint-plugin-prettier": "^5.0.0",
51
+ "eslint-plugin-svelte": "^3.0.0",
52
+ "jsdom": "^29.0.2",
53
+ "prettier": "^3.0.0",
54
+ "svelte": "^5.0.0",
55
+ "svelte-check": "^4.0.0",
56
+ "svelte2tsx": "^0.7.0",
57
+ "typescript": "^5.7.3",
58
+ "typescript-eslint": "^8.0.0",
59
+ "vite": "^7.3.5",
60
+ "vitest": "^3.0.0"
61
+ },
62
+ "scripts": {
63
+ "build": "vite build",
64
+ "typecheck": "svelte-check --tsconfig ./tsconfig.json",
65
+ "test": "vitest run",
66
+ "lint": "eslint ."
67
+ }
68
+ }