open-agreements
Version:
Open-source legal template filling CLI and library
37 lines • 2.11 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 RevisionIdState } from './inPlaceModifier-shared.js';
export interface ParagraphBoundaryBookmarkMarkers {
leading: Element[];
trailing: Element[];
sourceLeading: Element[];
sourceTrailing: Element[];
}
export declare function cloneParagraphBoundaryBookmarkMarkers(sourceParagraph: Element | undefined): ParagraphBoundaryBookmarkMarkers;
export declare function insertLeadingMarkers(paragraph: Element, markers: Element[]): Element | null;
export type BookmarkMarkerTag = 'w:bookmarkStart' | 'w:bookmarkEnd';
export declare function isBookmarkMarkerTag(tagName: string): tagName is BookmarkMarkerTag;
/**
* Collect direct paragraph bookmark markers adjacent to a source run.
*
* Markers between runs (or at paragraph boundaries) are represented as siblings
* of w:r under w:p. We clone nearby markers so reconstructed deleted/moveFrom
* fragments preserve bookmark names/IDs needed for Reject All parity.
*/
export declare function collectAdjacentSourceBookmarkMarkers(sourceRun: Element): Element[];
export interface BookmarkSurvivalContext {
isParagraphRemovedOnReject?: (paragraph: Element) => boolean;
}
export declare function markerSurvivesReject(marker: Element, context?: BookmarkSurvivalContext): boolean;
export declare function targetTreeHasEquivalentBookmarkMarker(targetParagraph: Element, marker: Element, context?: BookmarkSurvivalContext): boolean;
export declare function cloneUnemittedSourceBookmarkMarkers(sourceRun: Element, targetParagraph: Element, state: RevisionIdState, context?: BookmarkSurvivalContext): Element[];
export declare function insertMarkersBeforeWrapper(wrapper: Element, markers: Element[]): void;
export declare function filterEquivalentBookmarkMarkers(markers: Element[], targetNode: Element, context?: BookmarkSurvivalContext): Element[];
/**
* Track change wrapper tag names.
*/
//# sourceMappingURL=inPlaceModifier-bookmarks.d.ts.map