/** * The render-kwargs model behind `TemplatedTextField`: the row shape, the * round-trip between stored kwargs and editable rows, and the normalized * `TemplatedText` value the field emits. Pure — no React. */ import type { TemplatedText } from '@tai42/api-client'; /** Whether the value's source is inline authored text or a stored template id. */ export type Mode = 'inline' | 'stored'; export interface KwargRow { readonly key: string; readonly value: string; /** * The stored value this row was seeded from, kept so an UNTOUCHED row re-emits it * BYTE-FOR-BYTE: the row form cannot tell a stored string `"7"` from the number `7`, * so re-parsing an untouched row would silently coerce the stored type. `undefined` * for a row the author added. */ readonly original?: unknown; } /** The row's canonical string form, matched against `value` to detect an untouched row. */ export declare function stringifyRowValue(raw: unknown): string; /** Parse a cell as JSON when it can be (numbers/bools/objects), else keep the string. */ export declare function parseCellValue(raw: string): unknown; /** Collapse the kwargs rows into an object, dropping rows with a blank key. */ export declare function rowsToObject(rows: readonly KwargRow[]): Record; /** Seed rows from a stored kwargs object (stringifying non-string values). */ export declare function objectToRows(kwargs: Record | undefined): KwargRow[]; /** The initial mode: stored when the seed carries an `id`, inline otherwise. */ export declare function initialMode(value: TemplatedText | null): Mode; /** * The normalized value for a given source/mode and kwargs. The two sources are * mutually exclusive by construction (`content` XOR `id`); an empty source emits * `null` unless `required`, in which case an empty source is emitted so the * schema guard refuses the save. */ export declare function templatedValueFrom(mode: Mode, inline: string, stored: string, rows: readonly KwargRow[], required: boolean): TemplatedText | null; //# sourceMappingURL=templated-text-kwargs.d.ts.map