Vue
Use the Vue package for the provider, effects, and layout boundary. Pass a reactive getRoute for the router already installed in your app as framework.
Common setup
Install @ssgoi/vue and keep one Ssgoi provider above RouterView or NuxtPage. It receives the shared route configuration.
import { Ssgoi } from "@ssgoi/vue";
import { drill } from "@ssgoi/vue/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. useSsgoiTransition returns a readonly ref; call it in setup.
<script setup lang="ts">
import { watch } from "vue";
import { useSsgoiTransition } from "@ssgoi/vue";
const transition = useSsgoiTransition();
watch(
() => transition.value.status,
(status) => {
if (status !== "idle") return;
document.getElementById("comments")?.scrollIntoView();
},
{ immediate: true },
);
</script>Vue Router
Experimental APIReturn Vue Router 4’s current path from framework.getRoute on the common Vue provider.
Wrap the routed region
The boundary follows the committed router path and replaces its DOM root when the route key changes. SsgoiLayoutBoundary throws if <Ssgoi> has no framework.
<script setup lang="ts">
import { RouterView, useRouter } from "vue-router";
import { Ssgoi, SsgoiLayoutBoundary } from "@ssgoi/vue";
import { config } from "./ssgoi-config";
const router = useRouter();
const framework = {
getRoute: () => ({ pathname: router.currentRoute.value.path }),
};
</script>
<template>
<Ssgoi :config="config" :framework="framework">
<SsgoiLayoutBoundary><RouterView /></SsgoiLayoutBoundary>
</Ssgoi>
</template>Persistent shells
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 the section’s own RouterView layout. 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.
Nuxt
Experimental APIReturn Nuxt’s router state from framework.getRoute on the common Vue provider. Read router.currentRoute, the committed state, rather than Nuxt’s delayed useRoute value.
Wrap NuxtPage
Keep the provider in app.vue, above the layout and page. Do not add a provider for every page. useRouter is Nuxt’s auto-import.
<script setup lang="ts">
import { Ssgoi, SsgoiLayoutBoundary } from "@ssgoi/vue";
import { config } from "~/utils/ssgoi-config";
const router = useRouter();
const framework = {
getRoute: () => ({ pathname: router.currentRoute.value.path }),
};
</script>
<template>
<Ssgoi :config="config" :framework="framework">
<SsgoiLayoutBoundary><NuxtPage /></SsgoiLayoutBoundary>
</Ssgoi>
</template>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 pages/shop.vue, around the nested <NuxtPage />. 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.