@createiq/htmldiff 1.1.0 → 1.2.0-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.
@@ -0,0 +1,15 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(diff -u test/input1.html test/input2.html)",
5
+ "Bash(npm test -- test/Bug.spec.tsx)",
6
+ "Bash(timeout 30s npm run test:ci -- test/Bug.spec.tsx)",
7
+ "Bash(npm run build)",
8
+ "Bash(timeout 10s npm run test:ci -- test/Bug.spec.tsx)",
9
+ "Bash(npm run lint)",
10
+ "Bash(npm run test:ci)",
11
+ "Bash(npm run bench:ci)"
12
+ ],
13
+ "deny": []
14
+ }
15
+ }
package/README.md CHANGED
@@ -127,6 +127,46 @@ This property defines relative size of the match to be considered as orphan, fro
127
127
 
128
128
  Returns the diff from an HtmlDiff instance.
129
129
 
130
+ ### HtmlDiff.executeThreeWay(v1, v2, v3, options?)
131
+
132
+ Three-way HTML diff for back-and-forth negotiation scenarios. Given:
133
+
134
+ - `v1` — the version you last sent
135
+ - `v2` — the version the counterparty sent back
136
+ - `v3` — your current draft
137
+
138
+ `executeThreeWay` produces a single attributed HTML output where the counterparty's changes (V1→V2) and your changes
139
+ (V2→V3) are distinguished by `data-author` and class:
140
+
141
+ - Counterparty insertions / deletions: `<ins class='diffins cp' data-author='cp'>` / `<del class='diffdel cp' ...>`
142
+ - Your insertions / deletions: `<ins class='diffins me' data-author='me'>` / `<del class='diffdel me' ...>`
143
+ - Your rejections of counterparty insertions (you deleted text they added): `<del class='diffdel me rejects-cp' data-author='me' data-rejects='cp'>`
144
+
145
+ ```ts
146
+ import HtmlDiff from '@createiq/htmldiff'
147
+
148
+ const v1 = '<p>The fee is five percent.</p>'
149
+ const v2 = '<p>The interest fee is five and a half percent.</p>'
150
+ const v3 = '<p>The interest fee is five percent.</p>'
151
+
152
+ const merged = HtmlDiff.executeThreeWay(v1, v2, v3)
153
+ // Counterparty added "interest" — kept by you.
154
+ // Counterparty changed "five" → "five and a half" — you rejected.
155
+ ```
156
+
157
+ Tables (including multi-table documents) and row/column structural changes are supported with the same author
158
+ attribution at row, cell, and content granularity.
159
+
160
+ #### Options
161
+
162
+ `executeThreeWay` accepts the same per-instance options as `HtmlDiff` (`repeatingWordsAccuracy`,
163
+ `ignoreWhitespaceDifferences`, `orphanMatchThreshold`, `blockExpressions`). They flow into both internal pair-wise
164
+ analyses identically.
165
+
166
+ `useProjections` controls structural-tag normalisation. When undefined (default), the decision is the conjunction of
167
+ both pair-wise heuristics — projection only activates when both V1↔V2 and V2↔V3 would benefit from it. Pass an
168
+ explicit boolean to override.
169
+
130
170
  ## Contributing
131
171
 
132
172
  The library uses [Biome](https://biomejs.dev/) for linting and formatting, and [Vitest](https://vitest.dev/) for unit