loro-crdt 1.8.9 โ†’ 1.10.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,170 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ce16b52: feat: add sliceDelta method to slice a span of richtext #862
8
+
9
+ Use `text.sliceDelta(start, end)` when you need a Quill-style delta for only part of a rich text field (for example, to copy a styled snippet). The method takes UTF-16 indices; use `sliceDeltaUtf8` if you want to slice by UTF-8 byte offsets instead.
10
+
11
+ ```ts
12
+ import { LoroDoc } from "loro-crdt";
13
+
14
+ const doc = new LoroDoc();
15
+ doc.configTextStyle({
16
+ bold: { expand: "after" },
17
+ comment: { expand: "none" },
18
+ });
19
+ const text = doc.getText("text");
20
+
21
+ text.insert(0, "Hello World!");
22
+ text.mark({ start: 0, end: 5 }, "bold", true);
23
+ text.mark({ start: 6, end: 11 }, "comment", "greeting");
24
+
25
+ const snippet = text.sliceDelta(1, 8);
26
+ console.log(snippet);
27
+ // [
28
+ // { insert: "ello", attributes: { bold: true } },
29
+ // { insert: " " },
30
+ // { insert: "Wo", attributes: { comment: "greeting" } },
31
+ // ]
32
+ ```
33
+
34
+ ### Patch Changes
35
+
36
+ - a78d70f: fix: avoid convert panic #858
37
+ - ee94ee4: fix: EphemeralStore apply should ignore timeout entries #865
38
+ - 9e0a613: fix: Reject symbol-keyed map objects in wasm conversion #855
39
+
40
+ ## 1.9.0
41
+
42
+ ### Minor Changes
43
+
44
+ - 10a405b: feat: JSONPath rfc9535 #848
45
+
46
+ Thanks to @zolero for the thorough implementation of JSONPath support!
47
+
48
+ LoroDoc now supports querying and mutating document data using **JSONPath**, following the [RFC 9535](https://www.rfc-editor.org/rfc/rfc9535) specification.
49
+
50
+ ### ๐Ÿงฉ API
51
+
52
+ ```ts
53
+ // Execute a JSONPath query on the document
54
+ doc.JSONPath(path: string): any[];
55
+ ```
56
+
57
+ ### ๐Ÿ“š Query Examples
58
+
59
+ Example data setup
60
+
61
+ ```ts
62
+ const doc = new LoroDoc();
63
+ const store = doc.getMap("store");
64
+
65
+ // Simplified setup for illustration purposes
66
+ store.set("books", [
67
+ {
68
+ title: "1984",
69
+ author: "George Orwell",
70
+ price: 10,
71
+ available: true,
72
+ isbn: "978-0451524935",
73
+ },
74
+ {
75
+ title: "Animal Farm",
76
+ author: "George Orwell",
77
+ price: 8,
78
+ available: true,
79
+ },
80
+ {
81
+ title: "Brave New World",
82
+ author: "Aldous Huxley",
83
+ price: 12,
84
+ available: false,
85
+ },
86
+ {
87
+ title: "Fahrenheit 451",
88
+ author: "Ray Bradbury",
89
+ price: 9,
90
+ available: true,
91
+ },
92
+ {
93
+ title: "The Great Gatsby",
94
+ author: "F. Scott Fitzgerald",
95
+ price: null,
96
+ available: true,
97
+ },
98
+ {
99
+ title: "To Kill a Mockingbird",
100
+ author: "Harper Lee",
101
+ price: 11,
102
+ available: true,
103
+ },
104
+ {
105
+ title: "The Catcher in the Rye",
106
+ author: "J.D. Salinger",
107
+ price: 10,
108
+ available: false,
109
+ },
110
+ {
111
+ title: "Lord of the Flies",
112
+ author: "William Golding",
113
+ price: 9,
114
+ available: true,
115
+ },
116
+ {
117
+ title: "Pride and Prejudice",
118
+ author: "Jane Austen",
119
+ price: 7,
120
+ available: true,
121
+ },
122
+ {
123
+ title: "The Hobbit",
124
+ author: "J.R.R. Tolkien",
125
+ price: 14,
126
+ available: true,
127
+ },
128
+ ]);
129
+ store.set("featured_authors", ["George Orwell", "Jane Austen"]);
130
+ ```
131
+
132
+ ```ts
133
+ // 1. Get all book titles
134
+ doc.JSONPath("$.store.books[*].title");
135
+ // โ†’ ["1984", "Animal Farm", "Brave New World", "The Hobbit"]
136
+
137
+ // 2. Filter: available books only
138
+ doc.JSONPath("$.store.books[?(@.available)].title");
139
+ // โ†’ ["1984", "Animal Farm", "The Hobbit"]
140
+
141
+ // 3. Filter: books with price > 10
142
+ doc.JSONPath("$.store.books[?(@.price > 10)].title");
143
+ // โ†’ ["The Hobbit"]
144
+
145
+ // 4. Use recursive descent to get all prices
146
+ doc.JSONPath("$..price");
147
+ // โ†’ [10, 8, 12, 9, null, 11, 14]
148
+
149
+ // 5. Slice syntax: first three books
150
+ doc.JSONPath("$.store.books[0:3].title");
151
+ // โ†’ ["1984", "Animal Farm", "Brave New World"]
152
+
153
+ // 6. Membership test: authors in featured list
154
+ doc.JSONPath("$.store.books[?(@.author in $.store.featured_authors)].title");
155
+ // โ†’ ["1984", "Animal Farm", "Pride and Prejudice"]
156
+
157
+ // 7. String match using `contains`
158
+ doc.JSONPath("$.store.books[?(@.title contains 'The')].author");
159
+ // โ†’ ["F. Scott Fitzgerald", "J.R.R. Tolkien"]
160
+ ```
161
+
162
+ - 10a405b: refactor!: remove deprecated encoding format in v0.x #849
163
+
164
+ ### Patch Changes
165
+
166
+ - 3af6a85: fix: WASM loading compatibility for esbuild and rsbuild #851
167
+
3
168
  ## 1.8.9
4
169
 
5
170
  ### Patch Changes
@@ -87,6 +252,7 @@
87
252
  ### Minor Changes
88
253
 
89
254
  - 3a0db5b: feat: add APIs to fetch values associated with the top Undo and Redo stack entries (#790)
255
+
90
256
  - JS/WASM: `undo.topUndoValue()` and `undo.topRedoValue()` return the `value` from the top undo/redo item (or `undefined` when empty).
91
257
  - Rust: `UndoManager::{top_undo_meta, top_redo_meta, top_undo_value, top_redo_value}` to inspect top-of-stack metadata and values.
92
258
  - Internal: stack now supports peeking the top item metadata without mutation.
@@ -94,6 +260,7 @@
94
260
  This enables attaching human-readable labels via `onPush`/`onPop` and retrieving them to keep Undo/Redo menu items up to date.
95
261
 
96
262
  - 9a98e8d: Distinguish explicit vs implicit empty commit behavior for commit options.
263
+
97
264
  - Explicit commits (user-invoked `commit()` / `commit_with(...)`): if the transaction is empty, commit options (message/timestamp/origin) are swallowed and will NOT carry over.
98
265
  - Implicit commits (e.g., `export`, `checkout` internal barriers): if the transaction is empty, message/timestamp/origin are preserved for the next transaction.
99
266
 
@@ -437,6 +604,7 @@
437
604
  - ddafb7e: feat: diff, applyDiff, and revertTo #610
438
605
 
439
606
  Add new version-control-related primitives:
607
+
440
608
  - **`diff(from, to)`**: calculate the difference between two versions. The returned results have similar structures to the differences in events.
441
609
  - **`revertTo(targetVersion)`**: revert the document back to the target version. The difference between this and `checkout(targetVersion)` is this method will generate a series of new operations, which will transform the current doc into the same as the target version.
442
610
  - **`applyDiff(diff)`**: you can use it to apply the differences generated from `diff(from, to)`.
@@ -745,9 +913,11 @@
745
913
  - Performance improvement and bug fixes
746
914
 
747
915
  ### ๐Ÿš€ Features
916
+
748
917
  - Redact (#504)
749
918
 
750
919
  ### ๐Ÿ› Bug Fixes
920
+
751
921
  - Ffi Subscription (#505)
752
922
  - Ffi remove try unwrap (#506)
753
923
  - Movable list undo impl (#509)
@@ -755,15 +925,18 @@
755
925
  - IsContainerDeleted cache err (#513)
756
926
 
757
927
  ### ๐Ÿ“š Documentation
928
+
758
929
  - Refine wasm docs
759
930
 
760
931
  ### โšก Performance
932
+
761
933
  - Optimize shrink frontiers
762
934
  - Optimize batch container registrations on arena (#510)
763
935
  - Optimize high concurrency performance (#514)
764
936
  - Use better data structure for frontiers (#515)
765
937
 
766
938
  ### Perf
939
+
767
940
  - Commit speed & text insert cache (#511)
768
941
 
769
942
  ## 1.0.0-alpha.5
@@ -771,9 +944,11 @@
771
944
  ### Patch Changes
772
945
 
773
946
  - ## Fix
947
+
774
948
  - Use release build
775
949
 
776
950
  ## Test
951
+
777
952
  - Add compatibility tests (#503)
778
953
 
779
954
  ## 1.0.0-alpha.4
@@ -781,6 +956,7 @@
781
956
  ### Patch Changes
782
957
 
783
958
  - ### ๐Ÿš€ Features
959
+
784
960
  - _(wasm)_ Commit message & get pending ops length (#477)
785
961
  - Update text by line (#480)
786
962
  - Add clear methods (#478)
@@ -791,6 +967,7 @@
791
967
  - Add import status (#494)
792
968
 
793
969
  ### ๐Ÿ› Bug Fixes
970
+
794
971
  - Get correct tree_cache current vv when retreating (#476)
795
972
  - Gc snapshot error (#481)
796
973
  - Checkout into middle of marks
@@ -802,6 +979,7 @@
802
979
  - Create event cannot find parent (#498)
803
980
 
804
981
  ### ๐Ÿšœ Refactor
982
+
805
983
  - [**breaking**] Don't wait for `commit` to update version info
806
984
  - Avoid footgun of impl ord for cid
807
985
  - Loro import function should return LoroEncodeError (#487)
@@ -810,6 +988,7 @@
810
988
  - [**breaking**] List state snapshot schema for v1.0 (#485)
811
989
 
812
990
  ### โšก Performance
991
+
813
992
  - Make shrink frontiers faster when the peer num is large (#482)
814
993
  - Optimize tree cache find children speed
815
994
  - Avoid memory leak when forking repeatedly (#500)
@@ -818,10 +997,12 @@
818
997
  - Optimize diff calc cache use (#475)
819
998
 
820
999
  ### ๐Ÿงช Testing
1000
+
821
1001
  - Make awareness more robust
822
1002
  - Bench large folder with 1M files & 100M ops (#495)
823
1003
 
824
1004
  ### โš™๏ธ Miscellaneous Tasks
1005
+
825
1006
  - Use cached diff calc
826
1007
 
827
1008
  ## 1.0.0-alpha.3
@@ -829,16 +1010,20 @@
829
1010
  ### Patch Changes
830
1011
 
831
1012
  - ### ๐Ÿ› Bug Fixes
1013
+
832
1014
  - Cursor behavior when using gc-snapshot (#472)
833
1015
  - _(wasm)_ Type err
834
1016
 
835
1017
  ### โš™๏ธ Miscellaneous Tasks
1018
+
836
1019
  - Make tree parent id pub on loro crate
837
1020
 
838
1021
  ### Feat
1022
+
839
1023
  - Allow editing on detached mode (#473)
840
1024
 
841
1025
  ### Fix
1026
+
842
1027
  - Get tree's alive children correctly (#474)
843
1028
  - Should not emit event when exporting gc-snapshot (#471)
844
1029
 
@@ -847,9 +1032,11 @@
847
1032
  ### Patch Changes
848
1033
 
849
1034
  - ### ๐Ÿš€ Features
1035
+
850
1036
  - Fork doc at the target version (#469)
851
1037
 
852
1038
  ### ๐Ÿšœ Refactor
1039
+
853
1040
  - BREAKING CHANGE: Use hierarchy value for tree value (#470)
854
1041
 
855
1042
  ## 1.0.0-alpha.1
@@ -857,20 +1044,24 @@
857
1044
  ### Patch Changes
858
1045
 
859
1046
  - ### ๐Ÿš€ Features
1047
+
860
1048
  - Get shallow value of doc (#463)
861
1049
  - Add state only snapshot & refine check slow test
862
1050
  - Add new cid method to js binding
863
1051
  - Jsonpath experimental support (#466)
864
1052
 
865
1053
  ### ๐Ÿ› Bug Fixes
1054
+
866
1055
  - Raise error if perform action on a deleted container (#465)
867
1056
  - Raise error if moving a deleted node
868
1057
  - Export snapshot error on a gc doc
869
1058
 
870
1059
  ### ๐Ÿšœ Refactor
1060
+
871
1061
  - Tree contains & isDeleted (#467)
872
1062
 
873
1063
  ### ๐Ÿงช Testing
1064
+
874
1065
  - Check state correctness on shallow doc
875
1066
 
876
1067
  ## 1.0.0-alpha.0
@@ -909,22 +1100,27 @@
909
1100
  ### Patch Changes
910
1101
 
911
1102
  - 38b4bcf: Add text update API
1103
+
912
1104
  - Remove the patch for crypto
913
1105
  - Add text update API (#404)
914
1106
  - Check invalid root container name (#411)
915
1107
 
916
1108
  ### ๐Ÿ› Bug Fixes
1109
+
917
1110
  - Workaround lldb bug make loro crate debuggable (#414)
918
1111
  - Delete the **bring back** tree node from the undo container remap (#423)
919
1112
 
920
1113
  ### ๐Ÿ“š Documentation
1114
+
921
1115
  - Fix typo
922
1116
  - Refine docs about event (#417)
923
1117
 
924
1118
  ### ๐ŸŽจ Styling
1119
+
925
1120
  - Use clippy to perf code (#407)
926
1121
 
927
1122
  ### โš™๏ธ Miscellaneous Tasks
1123
+
928
1124
  - Add test tools (#410)
929
1125
 
930
1126
  ## 0.16.7
@@ -934,20 +1130,24 @@
934
1130
  - 45c98d5: Better text APIs and bug fixes
935
1131
 
936
1132
  ### ๐Ÿš€ Features
1133
+
937
1134
  - Add insert_utf8 and delete_utf8 for Rust Text API (#396)
938
1135
  - Add text iter (#400)
939
1136
  - Add more text api (#398)
940
1137
 
941
1138
  ### ๐Ÿ› Bug Fixes
1139
+
942
1140
  - Tree undo when processing deleted node (#399)
943
1141
  - Tree diff calc children should be sorted by idlp (#401)
944
1142
  - When computing the len of the map, do not count elements that are None (#402)
945
1143
 
946
1144
  ### ๐Ÿ“š Documentation
1145
+
947
1146
  - Update wasm docs
948
1147
  - Rm experimental warning
949
1148
 
950
1149
  ### โš™๏ธ Miscellaneous Tasks
1150
+
951
1151
  - Update fuzz config
952
1152
  - Pnpm
953
1153
  - Rename position to fractional_index (#381)
@@ -990,6 +1190,7 @@
990
1190
  - 34f6064: Better undo events & transform cursors by undo manager (#369)
991
1191
 
992
1192
  #### ๐Ÿงช Testing
1193
+
993
1194
  - Enable compatibility test (#367)
994
1195
 
995
1196
  ## 0.16.1
@@ -1009,19 +1210,23 @@
1009
1210
  - c12c2b9: Movable Tree Children & Undo
1010
1211
 
1011
1212
  #### ๐Ÿ› Bug Fixes
1213
+
1012
1214
  - Refine error message on corrupted data (#356)
1013
1215
  - Add MovableList to CONTAINER_TYPES (#359)
1014
1216
  - Better jitter for fractional index (#360)
1015
1217
 
1016
1218
  #### ๐Ÿงช Testing
1219
+
1017
1220
  - Add compatibility tests (#357)
1018
1221
 
1019
1222
  #### Feat
1223
+
1020
1224
  - Make the encoding format forward and backward compatible (#329)
1021
1225
  - Undo (#361)
1022
1226
  - Use fractional index to order the children of the tree (#298)
1023
1227
 
1024
1228
  #### ๐Ÿ› Bug Fixes
1229
+
1025
1230
  - Tree fuzz sort value (#351)
1026
1231
  - Upgrade wasm-bindgen to fix str free err (#353)
1027
1232
 
@@ -1032,11 +1237,13 @@
1032
1237
  - 43506cc: Fix unsound issue caused by wasm-bindgen
1033
1238
 
1034
1239
  #### ๐Ÿ› Bug Fixes
1240
+
1035
1241
  - Fix potential movable list bug (#354)
1036
1242
  - Tree fuzz sort value (#351)
1037
1243
  - Upgrade wasm-bindgen to fix str free err (#353)
1038
1244
 
1039
1245
  #### ๐Ÿ“š Documentation
1246
+
1040
1247
  - Simplify readme (#352)
1041
1248
 
1042
1249
  ## 0.15.2
@@ -1046,12 +1253,15 @@
1046
1253
  - e30678d: Perf: fix deletions merge
1047
1254
 
1048
1255
  #### ๐Ÿ› Bug Fixes
1256
+
1049
1257
  - _(wasm)_ Movable list .kind() (#342)
1050
1258
 
1051
1259
  #### โšก Performance
1260
+
1052
1261
  - Delete span merge err (#348)
1053
1262
 
1054
1263
  #### โš™๏ธ Miscellaneous Tasks
1264
+
1055
1265
  - Warn missing debug impl (#347)
1056
1266
 
1057
1267
  <!-- generated by git-cliff -->
@@ -1063,6 +1273,7 @@
1063
1273
  - 04c6290: Bug fixes and improvements.
1064
1274
 
1065
1275
  #### ๐Ÿ› Bug Fixes
1276
+
1066
1277
  - Impl a few unimplemented! for movable tree (#335)
1067
1278
  - Refine ts type; reject invalid operations (#334)
1068
1279
  - Get cursor err on text and movable list (#337)
@@ -1070,10 +1281,12 @@
1070
1281
  - Upgrade generic-btree to allow large btree (#344)
1071
1282
 
1072
1283
  #### ๐Ÿ“š Documentation
1284
+
1073
1285
  - Add warn(missing_docs) to loro and loro-wasm (#339)
1074
1286
  - Minor fix on set_change_merge_interval api (#341)
1075
1287
 
1076
1288
  #### โš™๏ธ Miscellaneous Tasks
1289
+
1077
1290
  - Skip the checking if not debug_assertions (#340)
1078
1291
 
1079
1292
  <!-- generated by git-cliff -->
@@ -1121,6 +1334,7 @@
1121
1334
  - 24cf9b9: Bug Fix
1122
1335
 
1123
1336
  #### ๐Ÿ› Bug Fixes
1337
+
1124
1338
  - Attached container can be inserted to `Map` or `List` (#331)
1125
1339
 
1126
1340
  ## 0.14.5
@@ -1130,9 +1344,11 @@
1130
1344
  - 73e3ba5: Bug Fix
1131
1345
 
1132
1346
  #### ๐Ÿ› Bug Fixes
1347
+
1133
1348
  - _(js)_ Allow convert from undefined to LoroValue (#323)
1134
1349
 
1135
1350
  #### ๐Ÿšœ Refactor
1351
+
1136
1352
  - Refine ts type (#322)
1137
1353
 
1138
1354
  ## 0.14.4
@@ -1140,10 +1356,12 @@
1140
1356
  ### Patch Changes
1141
1357
 
1142
1358
  - 598d97e: ### ๐Ÿšœ Refactor
1359
+
1143
1360
  - Refine the TS Type of Awareness
1144
1361
  - Parse Uint8array to LoroValue::Binary (#320)
1145
1362
 
1146
1363
  ### ๐Ÿ“š Documentation
1364
+
1147
1365
  - Update how to publish new npm pkgs
1148
1366
 
1149
1367
  ## 0.14.3
@@ -1157,6 +1375,7 @@
1157
1375
  ### Patch Changes
1158
1376
 
1159
1377
  - Refactor rename `StablePosition` to `Cursor`
1378
+
1160
1379
  - Rename stable pos to cursor (#317)
1161
1380
 
1162
1381
  <!-- generated by git-cliff -->
@@ -1168,6 +1387,7 @@
1168
1387
  - Supports Cursors
1169
1388
 
1170
1389
  #### ๐Ÿš€ Features
1390
+
1171
1391
  - Cursors (#290)
1172
1392
 
1173
1393
  ## 0.14.0
@@ -1177,22 +1397,27 @@
1177
1397
  - Improved API
1178
1398
 
1179
1399
  ### ๐Ÿš€ Features
1400
+
1180
1401
  - Access value/container by path (#308)
1181
1402
  - Decode import blob meta (#307)
1182
1403
 
1183
1404
  ### ๐Ÿ› Bug Fixes
1405
+
1184
1406
  - Decode iter return result by updating columnar to 0.3.4 (#309)
1185
1407
 
1186
1408
  ### ๐Ÿšœ Refactor
1409
+
1187
1410
  - Replace "local" and "fromCheckout" in event with "triggeredBy" (#312)
1188
1411
  - Add concrete type for each different container (#313)
1189
1412
  - _(ts)_ Make types better (#315)
1190
1413
 
1191
1414
  ### ๐Ÿ“š Documentation
1415
+
1192
1416
  - Refine wasm docs (#304)
1193
1417
  - Clarify that peer id should be convertible to a u64 (#306)
1194
1418
 
1195
1419
  ### โš™๏ธ Miscellaneous Tasks
1420
+
1196
1421
  - Add coverage report cli (#311)
1197
1422
 
1198
1423
  ## 0.13.1