/** * JSX/HTML Rendering Plugin for OpenSpeed * Provides JSX and HTML templating support similar to Hono */ import type { Context } from '../context.js'; export interface JSXOptions { pretty?: boolean; doctype?: boolean; fragmentTag?: string; } export type JSXChild = string | number | boolean | null | undefined | JSXElement | JSXChild[]; export interface JSXElement { type: string | Function; props: Record; children: JSXChild[]; } export declare namespace JSX { interface Element extends JSXElement { } interface IntrinsicElements { [elemName: string]: any; } } /** * JSX Factory - creates JSX elements */ export declare function jsx(type: string | Function, props: Record | null, ...children: JSXChild[]): JSXElement; /** * Fragment component for grouping elements */ export declare function Fragment({ children }: { children: JSXChild[]; }): JSXElement; /** * Render JSX to HTML string */ export declare function renderToString(element: JSXChild, options?: JSXOptions): string; /** * Raw HTML (dangerous - use with caution) * @param html - HTML string to render without escaping * @param options - Security options * @param options.trusted - Set to true only if HTML is from a trusted source */ export declare function raw(html: string, options?: { trusted?: boolean; }): JSXElement; /** * HTML template literal tag */ export declare function html(strings: TemplateStringsArray, ...values: any[]): string; /** * JSX Plugin for OpenSpeed */ export interface JSXPluginOptions extends JSXOptions { globalComponents?: Record; } export declare function jsxPlugin(options?: JSXPluginOptions): (ctx: Context, next: () => Promise) => Promise; export { jsx as h, jsx as createElement }; /** * Common HTML Components */ export declare const Html: ({ children, lang, ...props }: any) => JSXElement; export declare const Head: ({ children, ...props }: any) => JSXElement; export declare const Body: ({ children, ...props }: any) => JSXElement; export declare const Title: ({ children, ...props }: any) => JSXElement; export declare const Meta: (props: any) => JSXElement; export declare const Link: (props: any) => JSXElement; export declare const Script: ({ children, ...props }: any) => JSXElement; export declare const Style: ({ children, ...props }: any) => JSXElement; export declare const Div: ({ children, ...props }: any) => JSXElement; export declare const Span: ({ children, ...props }: any) => JSXElement; export declare const P: ({ children, ...props }: any) => JSXElement; export declare const A: ({ children, ...props }: any) => JSXElement; export declare const Img: (props: any) => JSXElement; export declare const Button: ({ children, ...props }: any) => JSXElement; export declare const Input: (props: any) => JSXElement; export declare const Form: ({ children, ...props }: any) => JSXElement; export declare const Label: ({ children, ...props }: any) => JSXElement; export declare const H1: ({ children, ...props }: any) => JSXElement; export declare const H2: ({ children, ...props }: any) => JSXElement; export declare const H3: ({ children, ...props }: any) => JSXElement; export declare const Ul: ({ children, ...props }: any) => JSXElement; export declare const Li: ({ children, ...props }: any) => JSXElement; /** * Layout component helper */ export declare function Layout({ children, title }: { children: JSXChild; title?: string; }): JSXElement; /** * Example usage: * * import { jsx, jsxPlugin, Layout, H1, P } from 'openspeed/plugins/jsx'; * * app.use(jsxPlugin()); * * app.get('/', (ctx) => { * return ctx.jsx( * * Welcome to OpenSpeed * Fast and ergonomic web framework * * ); * }); */ //# sourceMappingURL=jsx.d.ts.map
Fast and ergonomic web framework