export namespace DiffType { let DEFAULT: "default"; let ADDED: "added"; let REMOVED: "removed"; let EMPTY: "empty"; } export namespace DiffMethod { let CHARS: "diffChars"; let WORDS: "diffWords"; let WORDS_WITH_SPACE: "diffWordsWithSpace"; let LINES: "diffLines"; let TRIMMED_LINES: "diffTrimmedLines"; let SENTENCES: "diffSentences"; let CSS: "diffCss"; } export type DiffTypeValues = (typeof DiffType)[keyof typeof DiffType]; export type DiffInformation = { value?: string | DiffInformation[] | undefined; lineNumber?: number | undefined; type?: "added" | "removed" | "default" | "empty" | undefined; data?: import("../components/basic-diff-view-element/basic-diff-view-element.js").LineDiffData[] | undefined; }; export type LineInformation = { left: DiffInformation; right: DiffInformation; }; export type ComputedLineInformation = { lineInformation: LineInformation[]; diffLines: number[]; }; export type ComputedDiffInformation = { left: DiffInformation[]; right: DiffInformation[]; }; export type JsDiffChangeObject = { added?: boolean | undefined; removed?: boolean | undefined; value?: string | undefined; }; /** * [TODO]: Think about moving common left and right value assignment to a * common place. Better readability? * * Computes line wise information based in the js diff information passed. Each * line contains information about left and right section. Left side denotes * deletion and right side denotes addition. * * @param {string} oldString - Old string to compare. * @param {string} newString - New string to compare with old string. * @param {boolean} [disableWordDiff=false] - Flag to enable/disable word diff. * @param {typeof DiffMethod[keyof typeof DiffMethod]} [compareMethod="diffChars"] - JsDiff text diff method from https://github.com/kpdecker/jsdiff/tree/v4.0.1#api * @param {number} [linesOffset=0] - line number to start counting from * @returns {ComputedLineInformation} */ export function computeLineInformation(oldString: string, newString: string, disableWordDiff?: boolean | undefined, compareMethod?: "diffChars" | "diffWords" | "diffWordsWithSpace" | "diffLines" | "diffTrimmedLines" | "diffSentences" | "diffCss" | undefined, linesOffset?: number | undefined): ComputedLineInformation;