open-agreements
Version:
Open-source legal template filling CLI and library
62 lines • 2.56 kB
TypeScript
/**
* In-Place AST Modifier
*
* Modifies the revised document's AST in-place to add track changes markup.
* This replaces the reconstruction-based approach with direct tree manipulation.
*/
import type { ComparisonUnitAtom } from '../../core-types.js';
export declare const SYNTHETIC_DOC: Document;
export declare const W_NS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
/**
* Create a namespaced OOXML element with optional attributes.
* Uses SYNTHETIC_DOC so elements can be adopted by any document tree.
*/
export declare function createEl(tag: string, attrs?: Record<string, string>): Element;
export declare function findAncestorByTag(atom: ComparisonUnitAtom, tagName: string): Element | undefined;
export declare function attachSourceElementPointers(atoms: ComparisonUnitAtom[]): void;
export interface RevisionIdState {
nextId: number;
moveRangeIds: Map<string, {
sourceRangeId: number;
destRangeId: number;
}>;
/** Track which run elements have already been wrapped */
wrappedRuns: Set<Element>;
/**
* Source bookmark markers cloned into inserted deleted/moveFrom content.
* Prevents duplicate marker emission when a single source run is split into
* multiple atoms (word-level atomization).
*/
emittedSourceBookmarkMarkers: Set<Element>;
}
/**
* Create initial revision ID state.
*/
export declare function createRevisionIdState(): RevisionIdState;
/**
* Allocate a new revision ID.
*/
export declare function allocateRevisionId(state: RevisionIdState): number;
/**
* Get or allocate move range IDs for a move name.
*/
export declare function getMoveRangeIds(state: RevisionIdState, moveName: string): {
sourceRangeId: number;
destRangeId: number;
};
/**
* Format date for OOXML (ISO 8601 without milliseconds).
*/
export declare function formatDate(date: Date): string;
/**
* Convert w:t elements to w:delText within an element tree.
*
* @param element - The element to process
*/
export declare function convertToDelText(element: Element): void;
export declare function parentElement(node: Element): Element | null;
export declare function findTreeRoot(node: Element): Element;
export declare function findAncestor(node: Element | undefined, tagName: string): Element | undefined;
export declare function hasAncestorTag(node: Element | undefined, tagNames: ReadonlySet<string>): boolean;
export declare function paragraphHasParaInsMarker(paragraph: Element | undefined): boolean;
//# sourceMappingURL=inPlaceModifier-shared.d.ts.map