import type { RouteDataSchema } from './route.js'; import type { PageActionSchema } from './page-action.js'; import { PageSchema } from './page.js'; /** Navigation primitives: front-end routing actions that are not provider calls. */ export interface NavigationAction extends PageActionSchema { type: 'navigation'; method: 'back' | 'push' | 'popup' | 'home'; /** Target page for push navigation. */ target?: PageSchema; /** Route params type for push navigation. Auto-derived from target.params if omitted. */ params?: RouteDataSchema; } export const navigation = { back(description?: string): NavigationAction { return { name: 'back', type: 'navigation', method: 'back', description }; }, push(options: { target: PageSchema; params?: RouteDataSchema; description?: string }): NavigationAction { const { target, params, description } = options; return { name: 'push', type: 'navigation', method: 'push', target, params: params ?? target.params, description }; }, popup(description?: string): NavigationAction { return { name: 'popup', type: 'navigation', method: 'popup', description }; }, home(description?: string): NavigationAction { return { name: 'home', type: 'navigation', method: 'home', description }; }, };