Include CommonJS type declarations in the package to please new TypeScript resolution settings.
Include TypeScript type declarations.
Rename ES module files to use a .js extension, since Webpack gets confused by .mjs
The file referred to in the package's module
field now is compiled down to ES5.
Add a module
field to package json file.
Fixes an issue where steps that cause multiple changed ranges (such as ReplaceAroundStep
) would cause invalid change sets.
Fix a bug in incremental change set updates that would cause incorrect results in a number of cases.
Make simplifyChanges
merge adjacent simplified changes (which can occur when a word boundary is inserted).
Fix a bug in simplifyChanges that only occurred when the changes weren't at the start of the document.
Fixes issue in simplifyChanges
where it sometimes returned nonsense when the inspected text wasn't at the start of the document.
Solves various cases where complicated edits could corrupt the set of changes due to the mapped positions of deletions not agreeing with the mapped positions of insertions.
Moves to a more efficient diffing algorithm (Meyers), so that large replacements can be accurately diffed using reasonable time and memory.
You can now find the original document given to a ChangeSet
with its startDoc
accessor.
The way change data is stored in ChangeSet
objects works differently in this version. Instead of keeping deletions and insertions in separate arrays, the object holds an array of changes, which cover all the changed regions between the old and new document. Each change has start and end positions in both the old and the new document, and contains arrays of insertions and deletions within it.
This representation avoids a bunch of consistency problems that existed in the old approach, where keeping positions coherent in the deletion and insertion arrays was hard.
This means the deletions
and insertions
members in ChangeSet
are gone, and instead there is a changes
property which holds an array of Change
objects. Each of these has fromA
and toA
properties indicating its extent in the old document, and fromB
and toB
properties pointing into the new document. Actual insertions and deletions are stored in inserted
and deleted
arrays in Change
objects, which hold {data, length}
objects, where the total length of deletions adds up to toA - fromA
, and the total length of insertions to toB - fromB
.
When creating a ChangeSet
object, you no longer need to pass separate compare and combine callbacks. Instead, these are now represented using a single function that returns a combined data value or null
when the values are not compatible.
Properly apply the heuristics for ignoring short matches when diffing, and adjust those heuristics to more agressively weed out tiny matches in large changes.
The new changedRange
method can be used to compare two change sets and find out which range has changed.
Add a new method, ChangeSet.map
to update the data associated with changed ranges.
Fix another issue where overlapping changes that can't be merged could produce a corrupt change set.
Fixes an issue where addSteps
could produce invalid change sets when a new step's deleted range overlapped with an incompatible previous deletion.
Fix issue where deleting, inserting, and deleting the same content would lead to an inconsistent change set.
Fix a bug that caused addSteps
to break when merging two insertions into a single deletion.
Fix crash in ChangeSet.addSteps
.
First stable release.