DiffView
MMO.git · 1 symbol · generated 27 Oct 2026
DiffView
DiffView.js:21One file of a diff, drawn: side by side (the old version on the left, the new one on the right) or unified, each side with its line numbers, the removals on red and the insertions on green, the words that changed inside a line darker, the code in its colours. The unchanged lines the hunks leave out are folded, and unfold on a click when the file's texts are there. Over several commits, each changed line has the colour of the commit that made the change in its gutter (commit of DiffController's lines), its subject on hover.
- Namespace
MMO.git
Index
| constructor(options) | ||
| render() async | Colour the texts, then draw. | |
| redraw() | Draw again, in the current layout. | |
| focus(hash) | Fade the changes of the other commits. | |
| table() | [internal] @return {HTMLElement} the file's table, or what it has instead of lines | |
| splitRows(lines) | [internal] removals paired with the additions after them, side by side | |
| pair(left, right, kind) | [internal] one row of the split layout: a line on each side, or none | |
| unifiedRows(lines) | [internal] the lines one after the other, two numbers in the gutter | |
| single(line, ranges) | [internal] one row of the unified layout | |
| tag(row, lines) | [internal] the commits of a row's lines, for focus | |
| mark(line, cls, sep) | [internal] the gutter's mark of the commit that made a change | |
| number(n, cls, sep) | [internal] a line number | |
| code(line, side, cls, ranges) | [internal] a line's code, coloured, its changed words marked | |
| fold(oldFrom, oldTo, newFrom, context, end) | [internal] the unchanged lines between two hunks, folded: they unfold on a click when the texts are there | |
| unfolded(oldFrom, oldTo, newFrom) | [internal] the rows of unchanged lines a fold held | |
| submodule() | [internal] a submodule: the commits it pointed to | |
| message(text) | [internal] what a file without lines shows |
Methods17
constructor(options)
DiffView.js:31| options = {} | Object | - file {Object} a DiffController file: {status, path, oldPath, newPath, binary, submodule, hunks, ...} - oldText {?string} the whole old file, to colour it and unfold what the hunks leave out - newText {?string} the whole new file - commits {Array<Object>} the commits of the range, in the order of their colours: {hash, short, subject} - layout {string} split or unified - language {?string} Prism's; none: from the file's name |
render()
asyncDiffView.js:46Colour the texts, then draw.
| returns | Promise<HTMLElement> | node |
redraw()
DiffView.js:56Draw again, in the current layout.
focus(hash)
DiffView.js:65Fade the changes of the other commits.
| hash | ?string | a commit's; null: show them all alike |
table()
DiffView.js:76[internal] @return {HTMLElement} the file's table, or what it has instead of lines
splitRows(lines)
DiffView.js:111[internal] removals paired with the additions after them, side by side
| lines |
pair(left, right, kind)
DiffView.js:124[internal] one row of the split layout: a line on each side, or none
| left | ||
| right | ||
| kind |
unifiedRows(lines)
DiffView.js:137[internal] the lines one after the other, two numbers in the gutter
| lines |
single(line, ranges)
DiffView.js:152[internal] one row of the unified layout
| line | ||
| ranges |
tag(row, lines)
DiffView.js:162[internal] the commits of a row's lines, for focus
| row | ||
| lines |
mark(line, cls, sep)
DiffView.js:168[internal] the gutter's mark of the commit that made a change
| line | ||
| cls | ||
| sep = false |
number(n, cls, sep)
DiffView.js:180[internal] a line number
| n | ||
| cls | ||
| sep = false |
code(line, side, cls, ranges)
DiffView.js:185[internal] a line's code, coloured, its changed words marked
| line | ||
| side | ||
| cls | ||
| ranges |
fold(oldFrom, oldTo, newFrom, context, end)
DiffView.js:197[internal] the unchanged lines between two hunks, folded: they unfold on a click when the texts are there
| oldFrom | ||
| oldTo | ||
| newFrom | ||
| context | ||
| end = false |
unfolded(oldFrom, oldTo, newFrom)
DiffView.js:215[internal] the rows of unchanged lines a fold held
| oldFrom | ||
| oldTo | ||
| newFrom |
submodule()
DiffView.js:226[internal] a submodule: the commits it pointed to
message(text)
DiffView.js:233[internal] what a file without lines shows
| text |