ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
13 lines (12 loc) • 686 B
TypeScript
/**
* Collects a native `<form>`'s named fields into a plain object via
* `FormData` — the boilerplate every consumer otherwise hand-rolls to turn a
* submit into something they can `JSON.stringify` or send as a fetch body.
*
* Works with any real `<form>`, including one containing ranui's
* form-associated fields (`r-input`, `r-checkbox`, `r-select`): once they're
* real descendants of a `<form>`, they already participate in `FormData` on
* their own (via `ElementInternals.setFormValue`) — this needs no ranui-
* specific knowledge, it's just `FormData` reduced to an object.
*/
export declare function serializeForm(form: HTMLFormElement): Record<string, unknown>;