Skip to content

Commit 83afa4d

Browse files
committed
Add HtmlFormatter typings to expose showUnchanged and hideUnchanged
1 parent 0c4323e commit 83afa4d

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/index.d.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
export interface Formatter {
2-
format(delta: Delta, original: any): string;
2+
format(delta: Delta, original: any): string;
3+
}
4+
5+
export interface HtmlFormatter extends Formatter {
6+
/**
7+
* Set whether to show or hide unchanged parts of a diff.
8+
* @param show Whether to show unchanged parts
9+
* @param node The root element the diff is contained within. (Default: body)
10+
* @param delay Transition time in ms. (Default: no transition)
11+
*/
12+
showUnchanged(show: boolean, node?: Element | null, delay?: number): void;
13+
14+
/**
15+
* An alias for showUnchanged(false, ...)
16+
* @param node The root element the diff is contained within (Default: body)
17+
* @param delay Transition time in ms. (Default: no transition)
18+
*/
19+
hideUnchanged(node?: Element | null, delay?: number): void;
320
}
421

522
export interface Delta {
@@ -52,9 +69,9 @@ export class DiffPatcher {
5269
}
5370

5471
export const formatters: {
55-
annotated: Formatter;
56-
console: Formatter;
57-
html: Formatter;
72+
annotated: Formatter;
73+
console: Formatter;
74+
html: HtmlFormatter;
5875
};
5976

6077
export const console: Formatter

0 commit comments

Comments
 (0)