`s, `style`, buttons) is dropped: the renderer owns layout, and the
* UI owns Submit/Cancel.
*
* @example
* const form = parseHtmlForm(`
`);
* form.sections[0].title; // [{ text: "Database" }]
* form.fields[0]; // { kind: "choice", name: "db", multi: false, options: [sqlite ✓, pg] }
*/
import { Comment, type Document, Element, type Node, parseHTML, Text } from "@oh-my-pi/pi-utils/dom";
/** Inline emphasis a span keeps from `
`, ``/`` and ``/``. */
export type FormSpanStyle = "code" | "strong" | "em";
/** A run of inline text; `"\n"` inside `text` is a hard line break (`
`). */
export interface FormSpan {
text: string;
style?: FormSpanStyle;
}
/** One answer of a {@link ChoiceField}. */
export interface ChoiceOption {
value: string;
label: FormSpan[];
checked: boolean;
disabled: boolean;
}
/** A radio group (`multi: false`), checkbox group (`multi: true`) or `