import { Extension, StateField } from '@codemirror/state'; import { diffChars, diffWords } from 'diff'; import { LineMapping } from '../types'; /** Word diff data for a line */ export interface WordDiffData { lineNumber: number; ranges: WordDiffRange[]; } /** A range within a line that was changed */ export interface WordDiffRange { from: number; to: number; type: "added" | "removed"; } /** Effect to set word diff data */ export declare const setWordDiffDataEffect: import('@codemirror/state').StateEffectType; /** State field for word diff data */ export declare const wordDiffDataField: StateField; /** * Compute word-level diff between two strings. * Returns ranges of changes within each string. */ export declare function computeWordDiff(before: string, after: string, mode?: "word" | "char"): { beforeRanges: WordDiffRange[]; afterRanges: WordDiffRange[]; }; /** * Build word diff data for modified lines. * * @param lineMap - Line mappings with before/after correspondence * @param beforeLines - Content of before lines * @param afterLines - Content of after lines * @param side - Which side to generate data for * @param mode - Diff mode ('word' or 'char') */ export declare function buildWordDiffData(lineMap: LineMapping[], beforeLines: string[], afterLines: string[], side: "before" | "after", mode?: "word" | "char"): WordDiffData[]; /** * Build word diff data from before/after content strings for modified lines. * Uses a simpler approach when we have line-by-line content. */ export declare function buildWordDiffDataFromContent(lineMap: LineMapping[], beforeContent: string, afterContent: string, side: "before" | "after", mode?: "word" | "char"): WordDiffData[]; /** * Build word diff data for inline/unified view where modified lines * show inline changes. Uses beforeContentMap from generateUnifiedContentFromDiff. * * @param lines - The unified content lines * @param lineMap - Line mappings * @param beforeContentMap - Map of line index to before content for modified lines * @param mode - Diff mode ('word' or 'char') */ export declare function buildInlineWordDiffData(lines: string[], lineMap: LineMapping[], beforeContentMap: Map, mode?: "word" | "char"): WordDiffData[]; /** Theme for word-level diff highlighting */ export declare const wordDiffTheme: Extension; /** Create the word diff extension */ export declare function wordDiff(): Extension; export { diffWords, diffChars };