-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
export * from 'hono/jsx/jsx-dev-runtime' | ||
import { type JSXNode, jsx } from 'hono/jsx' | ||
import type { HtmlEscapedString } from 'hono/utils/html' | ||
export { Fragment } from 'hono/jsx' | ||
|
||
export function jsxDEV( | ||
tag: string | Function, | ||
props: Record<string, unknown>, | ||
key?: string, | ||
): JSXNode { | ||
let node: JSXNode | ||
if (!props || !('children' in props)) { | ||
node = jsx(tag, props, ...[]) | ||
} else { | ||
const children = props.children as string | HtmlEscapedString | ||
// biome-ignore lint/performance/noDelete: | ||
// biome-ignore lint/complexity/useLiteralKeys: | ||
delete props['children'] | ||
node = Array.isArray(children) | ||
? jsx(tag, props, ...children) | ||
: jsx(tag, props, ...[children]) | ||
} | ||
node.key = key | ||
return node | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
export * from 'hono/jsx/jsx-runtime' | ||
export { jsxDEV as jsx, Fragment } from '../jsx-dev-runtime/index.js' | ||
export { jsxDEV as jsxs } from '../jsx-dev-runtime/index.js' | ||
|
||
import { html, raw } from 'hono/html' | ||
export { html as jsxTemplate } | ||
export const jsxAttr = (name: string, value: string) => | ||
raw(`${name}="${html`${value}`}"`) | ||
export const jsxEscape = (value: string) => value |