www: Various documentation improvements (#1635)

Co-authored-by: Reed von Redwitz <reed+github@vonredwitz.com>
This commit is contained in:
Marvin Hagemeister
2023-08-16 16:24:53 +02:00
committed by GitHub
co-authored by Reed von Redwitz
parent 794c8ac10c
commit b2362da281
14 changed files with 275 additions and 137 deletions
+6 -6
View File
@@ -253,7 +253,7 @@ export class ServerContext {
component,
handler,
csp: Boolean(config?.csp ?? false),
appTemplate: !config?.skipAppTemplate,
appWrapper: !config?.skipAppWrapper,
inheritLayouts: !config?.skipInheritedLayouts,
};
routes.push(route);
@@ -274,7 +274,7 @@ export class ServerContext {
baseRoute: toBaseRoute(baseRoute),
handler: mod.handler,
component: mod.default,
appTemplate: !config?.skipAppTemplate,
appWrapper: !config?.skipAppWrapper,
inheritLayouts: !config?.skipInheritedLayouts,
});
} else if (
@@ -295,7 +295,7 @@ export class ServerContext {
component,
handler: handler ?? ((req) => router.defaultOtherHandler(req)),
csp: Boolean(config?.csp ?? false),
appTemplate: !config?.skipAppTemplate,
appWrapper: !config?.skipAppWrapper,
inheritLayouts: !config?.skipInheritedLayouts,
};
} else if (
@@ -317,7 +317,7 @@ export class ServerContext {
handler: handler ??
((req, ctx) => router.defaultErrorHandler(req, ctx, ctx.error)),
csp: Boolean(config?.csp ?? false),
appTemplate: !config?.skipAppTemplate,
appWrapper: !config?.skipAppWrapper,
inheritLayouts: !config?.skipInheritedLayouts,
};
}
@@ -982,7 +982,7 @@ const DEFAULT_NOT_FOUND: UnknownPage = {
name: "_404",
handler: (req) => router.defaultOtherHandler(req),
csp: false,
appTemplate: true,
appWrapper: true,
inheritLayouts: true,
};
@@ -994,7 +994,7 @@ const DEFAULT_ERROR: ErrorPage = {
component: DefaultErrorHandler,
handler: (_req, ctx) => ctx.render(),
csp: false,
appTemplate: true,
appWrapper: true,
inheritLayouts: true,
};
+2 -2
View File
@@ -265,8 +265,8 @@ export async function render<Data>(
const renderStack: any[] = [];
// Check if appLayout is enabled
if (
opts.route.appTemplate &&
layouts.every((layout) => layout.appTemplate)
opts.route.appWrapper &&
layouts.every((layout) => layout.appWrapper)
) {
renderStack.push(opts.app.default);
}
+6 -6
View File
@@ -98,7 +98,7 @@ export interface RouteConfig {
* Skip rendering the `routes/_app` template
* Default: `false`
*/
skipAppTemplate?: boolean;
skipAppWrapper?: boolean;
}
// deno-lint-ignore no-empty-interface
@@ -173,7 +173,7 @@ export interface Route<Data = any> {
component?: PageComponent<Data> | AsyncLayout<Data> | AsyncRoute<Data>;
handler: Handler<Data> | Handlers<Data>;
csp: boolean;
appTemplate: boolean;
appWrapper: boolean;
inheritLayouts: boolean;
}
@@ -218,7 +218,7 @@ export interface LayoutConfig {
* Skip already inherited layouts
* Default: `false`
*/
skipAppTemplate?: boolean;
skipAppWrapper?: boolean;
/**
* Skip rendering the `routes/_app`.
* Default: `false`
@@ -238,7 +238,7 @@ export interface LayoutRoute {
// deno-lint-ignore no-explicit-any
handler?: Handler<any, any> | Handlers<any, any>;
component: LayoutModule["default"];
appTemplate: boolean;
appWrapper: boolean;
inheritLayouts: boolean;
}
@@ -286,7 +286,7 @@ export interface UnknownPage {
component?: PageComponent<UnknownPageProps>;
handler: UnknownHandler;
csp: boolean;
appTemplate: boolean;
appWrapper: boolean;
inheritLayouts: boolean;
}
@@ -333,7 +333,7 @@ export interface ErrorPage {
component?: PageComponent<ErrorPageProps>;
handler: ErrorHandler;
csp: boolean;
appTemplate: boolean;
appWrapper: boolean;
inheritLayouts: boolean;
}