/** * @module * JSX Renderer Middleware for Hono. */ import type { Context, PropsForRenderer } from '../../context'; import type { FC, Context as JSXContext, PropsWithChildren } from '../../jsx'; import type { Env, Input, MiddlewareHandler } from '../../types'; import type { HtmlEscapedString } from '../../utils/html'; export declare const RequestContext: JSXContext | null>; type RendererOptions = { docType?: boolean | string; stream?: boolean | Record; }; type ComponentWithChildren = (props: PropsWithChildren, c: Context) => HtmlEscapedString | Promise; /** * JSX Renderer Middleware for hono. * * @see {@link https://hono.dev/docs/middleware/builtin/jsx-renderer} * * @param {ComponentWithChildren} [component] - The component to render, which can accept children and props. * @param {RendererOptions} [options] - The options for the JSX renderer middleware. * @param {boolean | string} [options.docType=true] - The DOCTYPE to be added at the beginning of the HTML. If set to false, no DOCTYPE will be added. * @param {boolean | Record} [options.stream=false] - If set to true, enables streaming response with default headers. If a record is provided, custom headers will be used. * @returns {MiddlewareHandler} The middleware handler function. * * @example * ```ts * const app = new Hono() * * app.get( * '/page/*', * jsxRenderer(({ children }) => { * return ( * * *
Menu
*
{children}
* * * ) * }) * ) * * app.get('/page/about', (c) => { * return c.render(

About me!

) * }) * ``` */ export declare const jsxRenderer: (component?: ComponentWithChildren, options?: RendererOptions | ((c: Context) => RendererOptions)) => MiddlewareHandler; /** * useRequestContext for Hono. * * @template E - The environment type. * @template P - The parameter type. * @template I - The input type. * @returns {Context} An instance of Context. * * @example * ```ts * const RequestUrlBadge: FC = () => { * const c = useRequestContext() * return {c.req.url} * } * * app.get('/page/info', (c) => { * return c.render( *
* You are accessing: *
* ) * }) * ``` */ export declare const useRequestContext: () => Context; export {};