# SSGOI with SvelteKit Experimental API: the router integration may change. SvelteKit wiring. Choose effects from: https://ssgoi.dev/llms/transitions.txt ```bash npm install @ssgoi/svelte ``` Shell class strings below are Tailwind shorthand. Without Tailwind, apply `position: relative; z-index: 0; min-height: 100dvh; overflow-x: clip`. Use `clip`, not `hidden`: `overflow-x: hidden` makes the wrapper the scroll container, and scroll restore then targets the wrong element. Fall back to `100vh` only where `dvh` is unsupported. ## Setup Everything wires in the root layout — one ``, the shell classes, and the boundary component: ```svelte
{@render children()}
``` ```ts // src/lib/ssgoi-config.ts import type { SsgoiConfig } from "@ssgoi/svelte"; import { drill } from "@ssgoi/svelte/view-transitions"; export const config: SsgoiConfig = { transitions: [{ on: "/**", except: "/", transition: drill() }], }; ``` ## The boundary component Why it exists: the root layout wrapper remains mounted while its live children snippet updates, so a marker on that wrapper has no outgoing node. The component detaches the old routed region in `onNavigate` first, then remounts under the new id: Import `SsgoiRouteBoundary` from `@ssgoi/svelte/sveltekit`; the package owns this lifecycle. Svelte 5 and SvelteKit 2 are supported. Kit is an optional peer and is never imported through the root `@ssgoi/svelte` entry. Verify: navigate `/` → any page slides in from the right; back slides out. ## Beyond the basics For a persistent `/products` shell, collapse that family at the root: ```svelte ({ id: url.pathname, key: getRootTransitionId(url) })}> {@render children()} ``` Then add a default pathname boundary only around the changing child: ```svelte {@render children()} ``` The stable outer key preserves the shell; the inner pathname boundary produces child OUT/IN. Holding only one boundary constant preserves state but produces no child transition. - Full example: https://github.com/meursyphus/ssgoi/tree/HEAD/templates/sveltekit - Framework index: https://ssgoi.dev/llms/frameworks.txt `as`, HTML attributes, `routeKey`, and `resolve({ pathname, url })` are supported. The resolver returns `{ id, key? }`; omitted key defaults to id. Keep a shell's key stable while its id tracks the full pathname. `routeKey` overrides that key. Search/hash-only changes do not remount by default. Use the URL in `resolve` when query changes should animate. Use router navigation for those changes; shallow `pushState`/`replaceState` calls do not trigger `onNavigate`. Custom router/manual guide: https://ssgoi.dev/llms/manual-boundaries.txt