Skip to content

kit-route

<kit-route pattern="/projects/:projectId" surface="project-page">
<kit-boundary surface="project-settings">
<button data-meta-event="project.saved">Save</button>
</kit-boundary>
</kit-route>

<kit-route> is a context bridge, not a full router. It reads the current location.pathname, matches it against pattern, emits route.changed, and exposes route context to nested boundaries.

@atheory-ai/kitsune-app

import '@atheory-ai/kitsune-app'
import { KitRouteElement } from '@atheory-ai/kitsune-app'
AttributeTypeNotes
patternstringPath pattern with :param segments. Reflects.
surfacestringOptional surface contributed to descendant context. Reflects.
featurestringOptional feature contributed to descendant context. Reflects.

The route contributes:

{
route: {
path: '/projects/kitsune',
pattern: '/projects/:projectId',
params: { projectId: 'kitsune' },
matched: true,
}
}

Nested <kit-boundary> elements inherit that route context, then add their own surface, feature, and entity context.

<kit-route> emits route.changed when it connects and whenever popstate fires.

{
type: 'route.changed',
context: {
surface: 'project-page',
route: {
path: '/projects/kitsune',
pattern: '/projects/:projectId',
params: { projectId: 'kitsune' },
matched: true,
},
},
payload: {
path: '/projects/kitsune',
pattern: '/projects/:projectId',
params: { projectId: 'kitsune' },
matched: true,
},
}