Svelte
The Svelte package provides the common provider, transition API, and layout boundary. Pass a SvelteKit route getter and onNavigate as framework when Kit owns navigation.
Common setup
Install @ssgoi/svelte and keep one Ssgoi provider above the changing page region. Transition factories and route rules are shared with the other web packages.
import { Ssgoi } from "@ssgoi/svelte";
import { drill } from "@ssgoi/svelte/view-transitions";Transition state
A page that scrolls itself on arrival, such as an anchor jump or scrollIntoView, fights the animation. Read the provider's transition state and act once it is idle. The status is idle or transitioning; while transitioning it also carries from, to and direction. It flips as soon as the navigation is paired, one microtask after the DOM changed, and returns to idle when the run releases, the same span the scroll-input lock covers. getSsgoiTransition returns a readable store; call it during component initialisation.
<script lang="ts">
import { getSsgoiTransition } from "@ssgoi/svelte";
const transition = getSsgoiTransition();
$effect(() => {
if ($transition.status !== "idle") return;
document.getElementById("comments")?.scrollIntoView();
});
</script>SvelteKit
Experimental APIPass a getRoute that returns { pathname } from page.url, plus onNavigate, as framework. The boundary uses onNavigate to detach outgoing content before SvelteKit updates its live children snippet; a key around that snippet alone is not sufficient.
Setup
<!-- src/routes/+layout.svelte -->
<script>
import { page } from "$app/state";
import { onNavigate } from "$app/navigation";
import { Ssgoi, SsgoiLayoutBoundary } from "@ssgoi/svelte";
import { config } from "$lib/ssgoi-config";
let { children } = $props();
const framework = {
getRoute: () => ({ pathname: page.url.pathname }),
onNavigate,
};
</script>
<main class="relative z-0 min-h-dvh overflow-x-clip">
<Ssgoi {config} {framework}>
<SsgoiLayoutBoundary class="min-h-full">
{@render children()}
</SsgoiLayoutBoundary>
</Ssgoi>
</main>SvelteKit before 2.12
Without $app/state, read the page store instead. SsgoiLayoutBoundary throws if <Ssgoi> has no framework.
import { get } from "svelte/store";
import { page } from "$app/stores";
import { onNavigate } from "$app/navigation";
const framework = {
getRoute: () => ({ pathname: get(page).url.pathname }),
onNavigate,
};Why a boundary component
The root layout wrapper stays mounted while the live children snippet updates, so a marker on that wrapper has no OUT node. The component detaches the old routed region first — the lifecycle is included in @ssgoi/svelte; no copied component is needed.
plain {@render children()} : route change mutates DOM in place → no OUT node
boundary component : onNavigate → unmount old route (OUT captured)
→ SvelteKit updates the route
→ remount under the new id (IN animates)Beyond the basics
For a persistent /shop shell, declare it in config.layouts as [{ paths: "/shop/**" }] and put a prop-less boundary only around the changing content in routes/shop/+layout.svelte. The root boundary (depth 0) keeps one key for every /shop route, so the header and tabs stay; the inner boundary (depth 1) keys by the path and produces the child transitions.
Each router connects through the provider's framework prop. Route boundaries explains how to connect another router directly. Transitions and route rules apply across the web frameworks.