loro-crdt 1.14.1 → 1.15.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5ea2e37: Add `pause()`, `resume()`, and `isPaused()` to `UndoManager`. While paused,
8
+ local edits are not recorded as undo steps and checkout events do not clear the
9
+ stacks. Import events (remote changes) are still processed so that the stacks
10
+ remain correctly transformed against concurrent edits. Use this to preserve
11
+ undo/redo history across temporary checkouts such as read-only history previews.
12
+
13
+ ### Patch Changes
14
+
15
+ - 4d3d3f1: Shallow snapshot export no longer leaks the values of rich-text marks whose
16
+ whole range was deleted before the shallow root.
17
+
18
+ Deleting styled text removes the characters but keeps the style anchors, and the
19
+ shallow-root state encoding shipped each anchor's value verbatim — so a mark
20
+ value (e.g. an inline comment) that every read API already reported as gone
21
+ still appeared in the exported bytes, defeating the documented content-redaction
22
+ use of shallow snapshots. Dead style pairs now have their values nulled during
23
+ export (anchors stay, so positions and replay are unaffected). Styles that only
24
+ become dead after the shallow root keep their values so historical checkouts
25
+ render correctly, and styles configured with `expand: "both"` are kept because
26
+ an empty both-expand pair still applies to future inserts. Re-exporting a
27
+ shallow snapshot produced by an older version also cleans it.
28
+
29
+ - 4837d07: Fix unbounded degradation when re-asserting identical text marks over styled ranges.
30
+
31
+ `mark` already tried to skip no-op marks, but the check used
32
+ `StyleRangeMap::get_styles_of_range`, which returns `None` whenever the marked
33
+ range spans more than one style-range leaf. On any document whose style ranges
34
+ are already fragmented (i.e. any document with styles), re-asserting an
35
+ identical mark recorded a new op every time.
36
+
37
+ Each redundant mark leaves a pair of style anchors in the container state
38
+ forever — they survive snapshots and are never consolidated — and every styled
39
+ read walks all of them. Callers that re-assert marks (for example editor
40
+ bindings syncing mark state) therefore permanently degraded styled reads without
41
+ bound: reading a 724-character paragraph went from ~5µs to ~4ms after 1000
42
+ redundant marks.
43
+
44
+ The skip path now falls back to `StyleRangeMap::range_has_key_value`, which
45
+ scans every style range covering the mark and reports whether each position
46
+ already resolves the key to the given value. Attached and detached texts both
47
+ use the new path when the single-leaf fast path cannot answer.
48
+
49
+ - f4e011f: Fix an O(n^2) slowdown when reading styled text.
50
+
51
+ Building the per-range style metadata for `toDelta` / `getRichtextValue` (and
52
+ the sliced variants used to emit text events) deep-copied the whole `Styles`
53
+ map once per style range. Each key in that map owns the set of _every_ style op
54
+ covering the range, while the resulting `StyleMeta` keeps only the LWW winner,
55
+ so the copy scaled with the number of marks accumulated on the container and
56
+ then discarded all but one element of it — O(marks) per range across O(marks)
57
+ ranges. The conversion now borrows instead of cloning.
58
+
59
+ Style anchors are never consolidated, so marks accumulate in the container
60
+ state and every styled read paid for all of them. On a 724-character paragraph
61
+ carrying 2000 accumulated marks, a styled read drops from ~103ms to ~1ms; a
62
+ simulated editor binding that re-asserts marks on each keystroke drops from
63
+ ~5ms to ~200us per read after 500 keystrokes.
64
+
3
65
  ## 1.14.1
4
66
 
5
67
  ### Patch Changes