@orieljs/inertia-svelte
v0.1.0-alpha.13
Published
The Svelte 5 adapter for Oriel's Inertia pages: the official @inertiajs/svelte with typed pages and routes.
Readme
@orieljs/inertia-svelte
The Oriel Svelte 5 adapter for Inertia: the official @inertiajs/svelte 3.7 adapter, re-exported with typed pages and Oriel route helpers. Apps load it through oriel({ input, framework }) from @orieljs/vite.
npm install @orieljs/inertia-svelte @orieljs/inertia-client svelteimport { createInertiaApp } from '@orieljs/inertia-svelte'
createInertiaApp({ pages: './pages' })<script lang="ts">
import { usePage } from '@orieljs/inertia-svelte'
const page = usePage<'Posts/Index'>()
</script>
<p>{page.props.posts.length} posts</p>It adds a typed usePage<N>() and page (props, shared props and errors come from the generated page types), route(), hasRoute(), currentRoute() and isCurrentRoute(), and a ./server export for server-side rendering. During server-side rendering currentRoute() and isCurrentRoute() read the URL of the page being rendered, so active links hydrate unchanged.
Precognition (useForm('post', url, data).validate('title'), form.withPrecognition(), <Form>'s validate()) works on routes with the precognitive middleware.
Known limitations:
- There is no
Headcomponent; use<svelte:head>.
Documentation: https://orieljs.vercel.app/docs/inertia
Status: early alpha. APIs will change.
License
Oriel is open-source software licensed under the Apache License 2.0 (Apache-2.0; see LICENSE and NOTICE). The Oriel name and logo are trademarks; see TRADEMARKS.md.
Website: https://orieljs.vercel.app
