/** * Walk a document tree and replace components. * * The docx model holds child components in more places than `children`: a * section's `header` and `footer`, and a table's `columns[].header.content` and * `columns[].cells[].content`. Any transform that misses one of those quietly * leaves part of the document behind, which is exactly the kind of bug that * only shows up in the one template that puts a chart in a table cell. * * So the walk lives here, once, and transforms supply only the decision about * what to replace. */ /** * Decide what one component becomes. * * Return a replacement node to substitute it — the walk does not descend into * a replacement — or `undefined` to leave the node alone and keep walking. */ export type ComponentReplacer = (node: Record) => Promise | undefined>; /** Return a deep copy of `doc` with `replace` applied to every component. */ export declare function transformComponents(doc: T, replace: ComponentReplacer): Promise; /** * Carry a node's identity and visibility onto its replacement. * * A desugared node is still the component the author wrote: an `id` other * things link to, and an `enabled` flag something downstream may act on, both * have to survive the substitution. */ export declare function withNodeIdentity(original: Record, replacement: Record): Record; /** * Whether any enabled component in `root` is named `name`. Walks the same * places the transform does — children, section header/footer, table cell * content — by looking at every object rather than enumerating them, which is * cheaper than a transform and cannot fall out of step with it. A disabled * subtree never renders, so nothing inside it counts. */ export declare function containsComponent(root: unknown, name: string): boolean; //# sourceMappingURL=componentTransform.d.ts.map