import type { DesignInput, ValidateOptions } from './schema.js'; import type { Design } from './types.js'; export declare function normalizeDesign(json: DesignInput): Design; export interface ParseOptions extends ValidateOptions { /** * Reject a design with no pages — catches the common mistake of passing the * wrong object (e.g. the store itself instead of `store.toJSON()`), which * otherwise validates as an empty design. */ requirePages?: boolean; /** * Assign a synthetic `id` to any page/element/cell that lacks one before * validating. `id` is otherwise required, but it's identity metadata the * renderer doesn't draw, so consumers that accept hand-built JSON (the export * converters) stay tolerant. Ids are DETERMINISTIC (structural index paths * like `el-0-2`) so identical input yields identical output. Real * `store.toJSON()` output always has ids, so this is a no-op there. Does not * touch the caller's input (works on a copy). */ fillMissingIds?: boolean; /** * Editor-export compatibility: preserve client-owned content the way the * editor's own SVG/HTML export historically did (it rendered raw JSON). * - Elements whose type is outside the schema union (the editor's * `registerShapeModel` extensions) skip validation and stay in place — * handed through as shallow copies of the CALLER's objects (`id` filled * when `fillMissingIds` is set), so they survive to element hooks. * Renderers fall back to a placeholder for them. * - Unrecognized ad-hoc keys the zod pass strips are copied back onto * parsed elements/pages/cells/audios from the caller's input. * Schema-recognized keys keep their validated values; `null` stays * "unset". * - `custom` needs no special handling: it is JSON-like data by contract * and the schema keeps it everywhere, so it survives parsing as-is. */ preserveClientData?: boolean; } /** * The one entry a consumer should use to accept design JSON: validate, then * normalize. Throws a formatted `Error` (`Invalid Polotno design:\n path: * message`) on invalid input — the single source of the error format, shared * with `assertValidDesign`. */ export declare function parseDesign(input: unknown, opts?: ParseOptions): Design;