@limetech/lime-elements
Version:
36 lines • 1.52 kB
TypeScript
import { DiffLine, DiffResult, SplitDiffLine } from './types';
/**
* Compute a structured diff between two strings.
*
* @param oldText - the "before" text
* @param newText - the "after" text
* @param contextLines - number of unchanged lines to show around each change
* @returns a DiffResult with hunks, additions, and deletions counts
*/
export declare function computeDiff(oldText: string, newText: string, contextLines?: number): DiffResult;
/**
* Re-group previously computed flat lines into hunks.
* Used when expanding collapsed sections without re-diffing.
*
* @param allLines - the full flat diff lines from a previous computation
* @param contextLines - number of context lines around changes
* @returns a DiffResult with new hunk groupings
*/
export declare function regroupLines(allLines: DiffLine[], contextLines: number): DiffResult;
/**
* Build paired rows for split (side-by-side) view from flat diff lines.
* Context lines appear on both sides. Adjacent removed+added lines
* are paired into the same row.
*
* @param lines - flat diff lines
* @returns paired rows for split rendering
*/
export declare function buildSplitLines(lines: DiffLine[]): SplitDiffLine[];
/**
* Normalize values for diffing. If `reformatJson` is true,
* parse and re-stringify with sorted keys and consistent indentation.
* @param value
* @param reformatJson
*/
export declare function normalizeForDiff(value: string | object, reformatJson?: boolean): string;
//# sourceMappingURL=diff-engine.d.ts.map