UNPKG

2.06 kBTypeScriptView Raw
1import HoganJsUtils from './hoganjs-utils';
2import * as Rematch from './rematch';
3import * as renderUtils from './render-utils';
4import { DiffLine, DiffFile, DiffBlock, DiffLineContext, DiffLineDeleted, DiffLineInserted, DiffLineContent } from './types';
5export interface SideBySideRendererConfig extends renderUtils.RenderConfig {
6 renderNothingWhenEmpty?: boolean;
7 matchingMaxComparisons?: number;
8 maxLineSizeInBlockForComparison?: number;
9}
10export declare const defaultSideBySideRendererConfig: {
11 renderNothingWhenEmpty: boolean;
12 matchingMaxComparisons: number;
13 maxLineSizeInBlockForComparison: number;
14 matching: import("./types").LineMatchingType;
15 matchWordsThreshold: number;
16 maxLineLengthHighlight: number;
17 diffStyle: import("./types").DiffStyleType;
18};
19export default class SideBySideRenderer {
20 private readonly hoganUtils;
21 private readonly config;
22 constructor(hoganUtils: HoganJsUtils, config?: SideBySideRendererConfig);
23 render(diffFiles: DiffFile[]): string;
24 makeFileDiffHtml(file: DiffFile, diffs: FileHtml): string;
25 generateEmptyDiff(): FileHtml;
26 generateFileHtml(file: DiffFile): FileHtml;
27 applyLineGroupping(block: DiffBlock): DiffLineGroups;
28 applyRematchMatching(oldLines: DiffLine[], newLines: DiffLine[], matcher: Rematch.MatcherFn<DiffLine>): DiffLine[][][];
29 makeHeaderHtml(blockHeader: string): string;
30 processChangedLines(isCombined: boolean, oldLines: DiffLine[], newLines: DiffLine[]): FileHtml;
31 generateLineHtml(oldLine?: DiffPreparedLine, newLine?: DiffPreparedLine): FileHtml;
32 generateSingleHtml(line?: DiffPreparedLine): string;
33}
34declare type DiffLineGroups = [(DiffLineContext & DiffLineContent)[], (DiffLineDeleted & DiffLineContent)[], (DiffLineInserted & DiffLineContent)[]][];
35declare type DiffPreparedLine = {
36 type: renderUtils.CSSLineClass;
37 prefix: string;
38 content: string;
39 number: number;
40};
41declare type FileHtml = {
42 left: string;
43 right: string;
44};
45export {};
46//# sourceMappingURL=side-by-side-renderer.d.ts.map
\No newline at end of file