import { SafeHtml } from './jsx-runtime.js'; import { ReadonlySignal } from '@preact/signals-core'; import './bindings-CYwoJpQb.js'; /** * `html` — tagged-template authoring at the `kerfjs/html` subpath, so * "no build step" is literally true: a CDN / importmap consumer can author * kerf UIs without a JSX transform. * * import { html } from 'kerfjs/html'; * html`
Count: ${count}
` * html`` * * A thin front-end over the exact machinery JSX uses — the runtime paths are * IDENTICAL. Text holes go through the JSX child pipeline (`_toSegment`): * SafeHtml/list-segment passthrough (so `each()` composes and the keyed * reconciler owns its rows), string escaping, number stringify, boolean / * nullish → nothing, signal → fine-grained text binding, DOM-node and * unsupported-type errors. Attribute holes go through the JSX attribute * branch: signal → `_assertEmittableAttrName` + `bindAttr` (grouped into one * marker attribute per element); anything else → the JSX attribute renderer * (booleans, SafeHtml, URL screening, `on*` / malformed-name rejection). * `mount()` / `morph()` / the reconcilers need zero changes. * * Unlike JSX, NO camelCase attribute aliasing is applied — template authors * write real HTML attribute names (`class`, not `className`). * * Hole contract (enforced by the parser in `utils/templateParse.ts`): holes * are allowed in text/child positions and as a COMPLETE attribute value * (`attr=${v}` or `attr="${v}"`). Tag-name holes, attribute-name holes, * partial attribute values (`class="a ${b}"`), and holes inside comments * throw. Static chunks are author-written markup and pass through verbatim * (same trust model as JSX tags/attrs). * * Perf: the parse runs once per template call site — the tagged-template * strings array has stable identity, so a `WeakMap` keyed on it caches the * `ParsedTemplate`. Rendering is a chunk walk with string concatenation, * the same cost shape as the JSX runtime. */ /** * Values accepted in `html\`\`` holes — the same set JSX accepts for * children (text holes) and attribute values (attr holes), including a * signal/`computed` itself for a fine-grained binding. */ type HtmlValue = SafeHtml | string | number | boolean | null | undefined | ReadonlySignal | readonly HtmlValue[]; /** Test hook: number of template parses performed (cache misses) so far. */ declare function _parseCount(): number; declare function html(strings: TemplateStringsArray, ...values: HtmlValue[]): SafeHtml; export { type HtmlValue, _parseCount, html };