UNPKG

k5kit

Version:

Utilities for TypeScript and Svelte

23 lines (22 loc) 685 B
/** * Automatically snapshot Svelte form values for `input`, `textarea` and `select` elements. * * The `name` attribute is used as the key. If you need to use a different key than the `name` attribute, you can alternatively specify it with the `data-snapsho` attribute. * * ### Usage * ```svelte * <script> * const snapshotter = auto_snapshot() * export const snapshot = snapshotter * </script> * <div use:snapshotter.container> * <input type="text" name="first_name" /> * </div> * ``` * */ export declare function auto_snapshot(): { capture(): Record<string, string>; restore(value: Record<string, string>): void; container(node: HTMLElement): void; };