@createiq/htmldiff 1.2.0-beta.0 → 1.2.0-beta.2
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.
- package/README.md +46 -19
- package/dist/HtmlDiff.cjs +418 -420
- package/dist/HtmlDiff.cjs.map +1 -1
- package/dist/HtmlDiff.d.cts +30 -1
- package/dist/HtmlDiff.d.mts +30 -1
- package/dist/HtmlDiff.mjs +418 -420
- package/dist/HtmlDiff.mjs.map +1 -1
- package/package.json +1 -1
- package/src/HtmlDiff.ts +106 -50
- package/src/ThreeWayDiff.ts +173 -127
- package/src/ThreeWayTable.ts +408 -484
- package/test/HtmlDiff.spec.ts +15 -0
- package/test/HtmlDiff.threeWay.spec.ts +117 -108
- package/test/HtmlDiff.threeWay.tables.spec.ts +88 -194
package/dist/HtmlDiff.d.cts
CHANGED
|
@@ -99,6 +99,16 @@ declare class HtmlDiff {
|
|
|
99
99
|
private newText;
|
|
100
100
|
private oldText;
|
|
101
101
|
private tablePreprocessDepth;
|
|
102
|
+
/**
|
|
103
|
+
* Tracks currently-open formatting-tag wraps. Each entry pairs the
|
|
104
|
+
* opening tag (so a later closing tag can find its match) with the
|
|
105
|
+
* styling info needed to RE-OPEN the wrap if an overlapping
|
|
106
|
+
* formatting-tag close forces it to split. Without the styling info,
|
|
107
|
+
* an overlap like `<strong>X</strong>` ↔ `<u>X</u>` produces an
|
|
108
|
+
* unclosable wrap (the closing tag for the outer wrap arrives while
|
|
109
|
+
* an inner wrap is still on the stack); see `insertTag`'s closing
|
|
110
|
+
* handler for the split logic.
|
|
111
|
+
*/
|
|
102
112
|
private specialTagDiffStack;
|
|
103
113
|
private newWords;
|
|
104
114
|
private oldWords;
|
|
@@ -208,7 +218,26 @@ declare class HtmlDiff {
|
|
|
208
218
|
* pairs would project on their own. Pass an explicit boolean to
|
|
209
219
|
* override.
|
|
210
220
|
*/
|
|
211
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Three-way HTML diff against a shared genesis. Produces attributed
|
|
223
|
+
* HTML that distinguishes CP's accumulated changes (genesis → cpLatest)
|
|
224
|
+
* from Me's accumulated changes (genesis → meCurrent). Use this for
|
|
225
|
+
* blackline UX where the negotiation has gone through multiple turns
|
|
226
|
+
* and the reader wants to see "who proposed what" across the whole
|
|
227
|
+
* history, not just the most recent round.
|
|
228
|
+
*
|
|
229
|
+
* When both parties happen to have made the same change (e.g. CP
|
|
230
|
+
* proposed a wording change in turn N, Me adopted it in turn N+1),
|
|
231
|
+
* the change reads as "settled" and is emitted unmarked — only
|
|
232
|
+
* disagreements and pending proposals carry author attribution.
|
|
233
|
+
*
|
|
234
|
+
* @param genesis the shared common ancestor (per-user — the FE
|
|
235
|
+
* picks between V1.0 and /preview/initialAnswers
|
|
236
|
+
* based on `prefillReceiverAnswers`)
|
|
237
|
+
* @param cpLatest the counterparty's current published version
|
|
238
|
+
* @param meCurrent Me's current draft (the document on screen)
|
|
239
|
+
*/
|
|
240
|
+
static executeThreeWay(genesis: string, cpLatest: string, meCurrent: string, options?: ThreeWayOptions): string;
|
|
212
241
|
private static executeThreeWayWithDepth;
|
|
213
242
|
/**
|
|
214
243
|
* Drives a fresh `HtmlDiff` instance through `insertTag` for ins/del
|
package/dist/HtmlDiff.d.mts
CHANGED
|
@@ -99,6 +99,16 @@ declare class HtmlDiff {
|
|
|
99
99
|
private newText;
|
|
100
100
|
private oldText;
|
|
101
101
|
private tablePreprocessDepth;
|
|
102
|
+
/**
|
|
103
|
+
* Tracks currently-open formatting-tag wraps. Each entry pairs the
|
|
104
|
+
* opening tag (so a later closing tag can find its match) with the
|
|
105
|
+
* styling info needed to RE-OPEN the wrap if an overlapping
|
|
106
|
+
* formatting-tag close forces it to split. Without the styling info,
|
|
107
|
+
* an overlap like `<strong>X</strong>` ↔ `<u>X</u>` produces an
|
|
108
|
+
* unclosable wrap (the closing tag for the outer wrap arrives while
|
|
109
|
+
* an inner wrap is still on the stack); see `insertTag`'s closing
|
|
110
|
+
* handler for the split logic.
|
|
111
|
+
*/
|
|
102
112
|
private specialTagDiffStack;
|
|
103
113
|
private newWords;
|
|
104
114
|
private oldWords;
|
|
@@ -208,7 +218,26 @@ declare class HtmlDiff {
|
|
|
208
218
|
* pairs would project on their own. Pass an explicit boolean to
|
|
209
219
|
* override.
|
|
210
220
|
*/
|
|
211
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Three-way HTML diff against a shared genesis. Produces attributed
|
|
223
|
+
* HTML that distinguishes CP's accumulated changes (genesis → cpLatest)
|
|
224
|
+
* from Me's accumulated changes (genesis → meCurrent). Use this for
|
|
225
|
+
* blackline UX where the negotiation has gone through multiple turns
|
|
226
|
+
* and the reader wants to see "who proposed what" across the whole
|
|
227
|
+
* history, not just the most recent round.
|
|
228
|
+
*
|
|
229
|
+
* When both parties happen to have made the same change (e.g. CP
|
|
230
|
+
* proposed a wording change in turn N, Me adopted it in turn N+1),
|
|
231
|
+
* the change reads as "settled" and is emitted unmarked — only
|
|
232
|
+
* disagreements and pending proposals carry author attribution.
|
|
233
|
+
*
|
|
234
|
+
* @param genesis the shared common ancestor (per-user — the FE
|
|
235
|
+
* picks between V1.0 and /preview/initialAnswers
|
|
236
|
+
* based on `prefillReceiverAnswers`)
|
|
237
|
+
* @param cpLatest the counterparty's current published version
|
|
238
|
+
* @param meCurrent Me's current draft (the document on screen)
|
|
239
|
+
*/
|
|
240
|
+
static executeThreeWay(genesis: string, cpLatest: string, meCurrent: string, options?: ThreeWayOptions): string;
|
|
212
241
|
private static executeThreeWayWithDepth;
|
|
213
242
|
/**
|
|
214
243
|
* Drives a fresh `HtmlDiff` instance through `insertTag` for ins/del
|