loro-crdt 1.14.1 → 1.15.1

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