feat: allow layout and _app overrides (#1611)
This commit is contained in:
@@ -79,6 +79,18 @@ export interface RouteConfig {
|
||||
* using the `useCSP` hook.
|
||||
*/
|
||||
csp?: boolean;
|
||||
|
||||
/**
|
||||
* Mark this route as the root layout and ignore previously
|
||||
* inherited layouts. Default: `false`
|
||||
*/
|
||||
rootLayout?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to use the `routes/_app` template if available or not.
|
||||
* Default: `true`
|
||||
*/
|
||||
appTemplate?: boolean;
|
||||
}
|
||||
|
||||
// deno-lint-ignore no-empty-interface
|
||||
@@ -153,6 +165,8 @@ export interface Route<Data = any> {
|
||||
component?: PageComponent<Data>;
|
||||
handler: Handler<Data> | Handlers<Data>;
|
||||
csp: boolean;
|
||||
appLayout: boolean;
|
||||
rootLayout: boolean;
|
||||
}
|
||||
|
||||
export interface RouterState {
|
||||
@@ -185,6 +199,7 @@ export type AsyncLayout<T = any, S = Record<string, unknown>> = (
|
||||
|
||||
export interface LayoutModule {
|
||||
default: ComponentType<LayoutProps> | AsyncLayout;
|
||||
config?: Pick<RouteConfig, "appTemplate" | "rootLayout">;
|
||||
}
|
||||
|
||||
export interface LayoutRoute {
|
||||
@@ -236,6 +251,8 @@ export interface UnknownPage {
|
||||
component?: PageComponent<UnknownPageProps>;
|
||||
handler: UnknownHandler;
|
||||
csp: boolean;
|
||||
appLayout: boolean;
|
||||
rootLayout: boolean;
|
||||
}
|
||||
|
||||
// --- ERROR PAGE ---
|
||||
@@ -281,6 +298,8 @@ export interface ErrorPage {
|
||||
component?: PageComponent<ErrorPageProps>;
|
||||
handler: ErrorHandler;
|
||||
csp: boolean;
|
||||
appLayout: boolean;
|
||||
rootLayout: boolean;
|
||||
}
|
||||
|
||||
// --- MIDDLEWARES ---
|
||||
|
||||
Reference in New Issue
Block a user