import { Editor } from '../../../core/Editor.js'; import { ContentControlTarget } from '@superdoc/document-api'; interface SdtPrElement { name: string; type?: string; attributes?: Record; elements?: SdtPrElement[]; [key: string]: unknown; } /** Find a child element by name within sdtPr.elements. */ export declare function findSdtPrChild(sdtPr: SdtPrElement | undefined, childName: string): SdtPrElement | undefined; /** Get the attributes object of a named sdtPr child element. */ export declare function getSdtPrChildAttrs(sdtPr: SdtPrElement | undefined, childName: string): Record | undefined; /** * Clone sdtPr and upsert a child element by name. * If a child with the given name exists, it is replaced. Otherwise it is appended. * Returns the new sdtPr object (immutable update). */ declare function upsertSdtPrChild(sdtPr: SdtPrElement, childName: string, replacement: SdtPrElement): SdtPrElement; /** * Clone sdtPr and remove a child element by name. * Returns the new sdtPr object (immutable update). */ declare function removeSdtPrChild(sdtPr: SdtPrElement, childName: string): SdtPrElement; /** * Apply an attribute patch to an SDT node via updateStructuredContentById. * Returns true if the command executed successfully. */ export declare function applyAttrsUpdate(editor: Editor, nodeId: string, attrsPatch: Record): boolean; /** * Resolve the current sdtPr, apply an updater that mutates a named child * element, then write the entire sdtPr back via attrs update. * * The `updater` receives the current child element (or undefined) and returns * the replacement element. Return `null` to remove the child. */ export declare function updateSdtPrChild(editor: Editor, target: ContentControlTarget, childName: string, updater: (child: SdtPrElement | undefined) => SdtPrElement | null): boolean; /** * Convenience: set an attribute on a named sdtPr child element. * Creates the child element if it doesn't exist. */ export declare function updateSdtPrChildAttr(editor: Editor, target: ContentControlTarget, childName: string, attrName: string, value: string): boolean; /** * Convenience: remove an attribute from a named sdtPr child element. */ export declare function removeSdtPrChildAttr(editor: Editor, target: ContentControlTarget, childName: string, attrName: string): boolean; /** * Convenience: find or create a sub-element within a sdtPr child, * then set an attribute on it. Commonly used for nested structures like * w:date > w:dateFormat, w14:checkbox > w14:checked, etc. */ export declare function updateSdtPrSubElementAttr(editor: Editor, target: ContentControlTarget, childName: string, subName: string, attrName: string, value: string): boolean; /** * Convenience: remove a sub-element from a sdtPr child by name. */ export declare function removeSdtPrSubElement(editor: Editor, target: ContentControlTarget, childName: string, subName: string): boolean; /** * Convenience: replace all sub-elements within a sdtPr child. * Useful for updating choice list items or checkbox symbol pairs. */ export declare function replaceSdtPrSubElements(editor: Editor, target: ContentControlTarget, childName: string, elements: SdtPrElement[]): boolean; export { upsertSdtPrChild, removeSdtPrChild, type SdtPrElement }; //# sourceMappingURL=sdt-properties-write.d.ts.map