@createiq/htmldiff 1.0.2 → 1.0.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,106 +0,0 @@
1
- declare class HtmlDiff {
2
- /**
3
- * This value defines balance between speed and memory utilization. The higher it is the faster it works and more memory consumes.
4
- * @private
5
- */
6
- private static MatchGranularityMaximum;
7
- private static DelTag;
8
- private static InsTag;
9
- private static SpecialCaseClosingTags;
10
- private static SpecialCaseClosingTagsSet;
11
- private static SpecialCaseOpeningTagRegex;
12
- private content;
13
- private newText;
14
- private oldText;
15
- private specialTagDiffStack;
16
- private newWords;
17
- private oldWords;
18
- private matchGranularity;
19
- private blockExpressions;
20
- /**
21
- * Defines how to compare repeating words. Valid values are from 0 to 1.
22
- * This value allows to exclude some words from comparison that eventually
23
- * reduces the total time of the diff algorithm.
24
- * 0 means that all words are excluded so the diff will not find any matching words at all.
25
- * 1 (default value) means that all words participate in comparison so this is the most accurate case.
26
- * 0.5 means that any word that occurs more than 50% times may be excluded from comparison. This doesn't
27
- * mean that such words will definitely be excluded but only gives a permission to exclude them if necessary.
28
- */
29
- repeatingWordsAccuracy: number;
30
- /**
31
- * If true all whitespaces are considered as equal
32
- */
33
- ignoreWhitespaceDifferences: boolean;
34
- /**
35
- * If some match is too small and located far from its neighbors then it is considered as orphan
36
- * and removed. For example:
37
- * <code>
38
- * aaaaa bb ccccccccc dddddd ee
39
- * 11111 bb 222222222 dddddd ee
40
- * </code>
41
- * will find two matches <code>bb</code> and <code>dddddd ee</code> but the first will be considered
42
- * as orphan and ignored, as result it will consider texts <code>aaaaa bb ccccccccc</code> and
43
- * <code>11111 bb 222222222</code> as single replacement:
44
- * <code>
45
- * &lt;del&gt;aaaaa bb ccccccccc&lt;/del&gt;&lt;ins&gt;11111 bb 222222222&lt;/ins&gt; dddddd ee
46
- * </code>
47
- * This property defines relative size of the match to be considered as orphan, from 0 to 1.
48
- * 1 means that all matches will be considered as orphans.
49
- * 0 (default) means that no match will be considered as orphan.
50
- * 0.2 means that if match length is less than 20% of distance between its neighbors it is considered as orphan.
51
- */
52
- orphanMatchThreshold: number;
53
- /**
54
- * Initializes a new instance of the class.
55
- * @param oldText The old text.
56
- * @param newText The new text.
57
- */
58
- constructor(oldText: string, newText: string);
59
- static execute(oldText: string, newText: string): string;
60
- /**
61
- * Builds the HTML diff output
62
- * @return HTML diff markup
63
- */
64
- build(): string;
65
- /**
66
- * Uses {@link expression} to group text together so that any change detected within the group is treated as a single block
67
- * @param expression
68
- */
69
- addBlockExpression(expression: RegExp): void;
70
- private splitInputsToWords;
71
- private performOperation;
72
- private processReplaceOperation;
73
- private processInsertOperation;
74
- private processDeleteOperation;
75
- private processEqualOperation;
76
- /**
77
- * This method encloses words within a specified tag (ins or del), and adds this into "content",
78
- * with a twist: if there are words contain tags, it actually creates multiple ins or del,
79
- * so that they don't include any ins or del. This handles cases like
80
- * old: '<p>a</p>'
81
- * new: '<p>ab</p>
82
- * <p>
83
- * c</b>'
84
- * diff result: '<p>a<ins>b</ins></p>
85
- * <p>
86
- * <ins>c</ins>
87
- * </p>
88
- * '
89
- * this still doesn't guarantee valid HTML (hint: think about diffing a text containing ins or
90
- * del tags), but handles correctly more cases than the earlier version.
91
- * P.S.: Spare a thought for people who write HTML browsers. They live in this ... every day.
92
- * @param tag
93
- * @param cssClass
94
- * @param words
95
- * @private
96
- */
97
- private insertTag;
98
- private extractConsecutiveWords;
99
- private operations;
100
- private removeOrphans;
101
- private matchingBlocks;
102
- private findMatchingBlocks;
103
- private findMatch;
104
- }
105
-
106
- export { HtmlDiff as default };