loro-crdt 1.3.1 → 1.3.3

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,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 8fdb25e: fix: move tree node within the self parent with 16 siblings #635
8
+
9
+ ## 1.3.2
10
+
11
+ ### Patch Changes
12
+
13
+ - a168063: refactor: hold doc reference in handler (#624)
14
+ - a168063: fix: a few LoroCounter errors (#626)
15
+
3
16
  ## 1.3.1
4
17
 
5
18
  ### Patch Changes
package/base64/index.js CHANGED
@@ -736,7 +736,7 @@ const LoroCounterFinalization = (typeof FinalizationRegistry === 'undefined')
736
736
  ? { register: () => {}, unregister: () => {} }
737
737
  : new FinalizationRegistry(ptr => wasm.__wbg_lorocounter_free(ptr >>> 0));
738
738
  /**
739
- * The handler of a tree(forest) container.
739
+ * The handler of a counter container.
740
740
  */
741
741
  class LoroCounter {
742
742
 
@@ -768,6 +768,22 @@ class LoroCounter {
768
768
  return this;
769
769
  }
770
770
  /**
771
+ * "Counter"
772
+ * @returns {'Counter'}
773
+ */
774
+ kind() {
775
+ const ret = wasm.lorocounter_kind(this.__wbg_ptr);
776
+ return takeObject(ret);
777
+ }
778
+ /**
779
+ * The container id of this handler.
780
+ * @returns {ContainerID}
781
+ */
782
+ get id() {
783
+ const ret = wasm.lorocounter_id(this.__wbg_ptr);
784
+ return takeObject(ret);
785
+ }
786
+ /**
771
787
  * Increment the counter by the given value.
772
788
  * @param {number} value
773
789
  */
@@ -879,6 +895,10 @@ const LoroDocFinalization = (typeof FinalizationRegistry === 'undefined')
879
895
  * [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
880
896
  * you could build all kind of applications by these.
881
897
  *
898
+ * **Important:** Loro is a pure library and does not handle network protocols.
899
+ * It is the responsibility of the user to manage the storage, loading, and synchronization
900
+ * of the bytes exported by Loro in a manner suitable for their specific environment.
901
+ *
882
902
  * @example
883
903
  * ```ts
884
904
  * import { LoroDoc } from "loro-crdt"
@@ -2095,7 +2115,7 @@ class LoroDoc {
2095
2115
  importUpdateBatch(data) {
2096
2116
  try {
2097
2117
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2098
- wasm.lorodoc_importUpdateBatch(retptr, this.__wbg_ptr, addHeapObject(data));
2118
+ wasm.lorodoc_importBatch(retptr, this.__wbg_ptr, addHeapObject(data));
2099
2119
  var r0 = getInt32Memory0()[retptr / 4 + 0];
2100
2120
  var r1 = getInt32Memory0()[retptr / 4 + 1];
2101
2121
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -5723,16 +5743,6 @@ class UndoManager {
5723
5743
  wasm.undomanager_addExcludeOriginPrefix(this.__wbg_ptr, ptr0, len0);
5724
5744
  }
5725
5745
  /**
5726
- * Check if the undo manager is bound to the given document.
5727
- * @param {LoroDoc} doc
5728
- * @returns {boolean}
5729
- */
5730
- checkBinding(doc) {
5731
- _assertClass(doc, LoroDoc);
5732
- const ret = wasm.undomanager_checkBinding(this.__wbg_ptr, doc.__wbg_ptr);
5733
- return ret !== 0;
5734
- }
5735
- /**
5736
5746
  * Set the on push event listener.
5737
5747
  *
5738
5748
  * Every time an undo step or redo step is pushed, the on push event listener will be called.
@@ -5977,36 +5987,36 @@ class VersionVector {
5977
5987
  function __wbindgen_object_drop_ref(arg0) {
5978
5988
  takeObject(arg0);
5979
5989
  }
5980
- function __wbg_lorolist_new(arg0) {
5981
- const ret = LoroList.__wrap(arg0);
5990
+ function __wbg_lorotreenode_new(arg0) {
5991
+ const ret = LoroTreeNode.__wrap(arg0);
5982
5992
  return addHeapObject(ret);
5983
5993
  }
5984
5994
  function __wbg_lorocounter_new(arg0) {
5985
5995
  const ret = LoroCounter.__wrap(arg0);
5986
5996
  return addHeapObject(ret);
5987
5997
  }
5988
- function __wbg_loromap_new(arg0) {
5989
- const ret = LoroMap.__wrap(arg0);
5990
- return addHeapObject(ret);
5991
- }
5992
- function __wbg_lorotreenode_new(arg0) {
5993
- const ret = LoroTreeNode.__wrap(arg0);
5998
+ function __wbg_lorotext_new(arg0) {
5999
+ const ret = LoroText.__wrap(arg0);
5994
6000
  return addHeapObject(ret);
5995
6001
  }
5996
- function __wbg_lorotree_new(arg0) {
5997
- const ret = LoroTree.__wrap(arg0);
6002
+ function __wbg_lorolist_new(arg0) {
6003
+ const ret = LoroList.__wrap(arg0);
5998
6004
  return addHeapObject(ret);
5999
6005
  }
6000
- function __wbg_loromovablelist_new(arg0) {
6001
- const ret = LoroMovableList.__wrap(arg0);
6006
+ function __wbg_loromap_new(arg0) {
6007
+ const ret = LoroMap.__wrap(arg0);
6002
6008
  return addHeapObject(ret);
6003
6009
  }
6004
6010
  function __wbg_cursor_new(arg0) {
6005
6011
  const ret = Cursor.__wrap(arg0);
6006
6012
  return addHeapObject(ret);
6007
6013
  }
6008
- function __wbg_lorotext_new(arg0) {
6009
- const ret = LoroText.__wrap(arg0);
6014
+ function __wbg_loromovablelist_new(arg0) {
6015
+ const ret = LoroMovableList.__wrap(arg0);
6016
+ return addHeapObject(ret);
6017
+ }
6018
+ function __wbg_lorotree_new(arg0) {
6019
+ const ret = LoroTree.__wrap(arg0);
6010
6020
  return addHeapObject(ret);
6011
6021
  }
6012
6022
  function __wbg_versionvector_new(arg0) {
@@ -6110,10 +6120,10 @@ function __wbindgen_typeof(arg0) {
6110
6120
  const ret = typeof getObject(arg0);
6111
6121
  return addHeapObject(ret);
6112
6122
  }
6113
- function __wbg_error_c8c2cca30a630316(arg0, arg1) {
6123
+ function __wbg_error_9384d761bf46409d(arg0, arg1) {
6114
6124
  console.error(getStringFromWasm0(arg0, arg1));
6115
6125
  }
6116
- function __wbg_log_d8fdbde28117925d(arg0, arg1) {
6126
+ function __wbg_log_c86c3e1bf097ba35(arg0, arg1) {
6117
6127
  console.log(getStringFromWasm0(arg0, arg1));
6118
6128
  }
6119
6129
  function __wbindgen_is_falsy(arg0) {
@@ -6201,7 +6211,7 @@ function __wbg_error_f851667af71bcfc6(arg0, arg1) {
6201
6211
  wasm.__wbindgen_export_5(deferred0_0, deferred0_1, 1);
6202
6212
  }
6203
6213
  }
6204
- const __wbg_now_15d99db1ebc1f0b2 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6214
+ const __wbg_now_6dd635953150ee31 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6205
6215
 
6206
6216
  function __wbg_crypto_1d1f22824a6a080c(arg0) {
6207
6217
  const ret = getObject(arg0).crypto;
@@ -6465,12 +6475,12 @@ function __wbindgen_memory() {
6465
6475
  const ret = wasm.memory;
6466
6476
  return addHeapObject(ret);
6467
6477
  }
6468
- function __wbindgen_closure_wrapper491(arg0, arg1, arg2) {
6469
- const ret = makeMutClosure(arg0, arg1, 9, __wbg_adapter_60);
6478
+ function __wbindgen_closure_wrapper482(arg0, arg1, arg2) {
6479
+ const ret = makeMutClosure(arg0, arg1, 8, __wbg_adapter_60);
6470
6480
  return addHeapObject(ret);
6471
6481
  }
6472
- function __wbindgen_closure_wrapper494(arg0, arg1, arg2) {
6473
- const ret = makeMutClosure(arg0, arg1, 11, __wbg_adapter_63);
6482
+ function __wbindgen_closure_wrapper484(arg0, arg1, arg2) {
6483
+ const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_63);
6474
6484
  return addHeapObject(ret);
6475
6485
  }
6476
6486
 
@@ -6500,7 +6510,7 @@ var imports = /*#__PURE__*/Object.freeze({
6500
6510
  __wbg_done_298b57d23c0fc80c: __wbg_done_298b57d23c0fc80c,
6501
6511
  __wbg_entries_95cc2c823b285a09: __wbg_entries_95cc2c823b285a09,
6502
6512
  __wbg_entries_ce844941d0c51880: __wbg_entries_ce844941d0c51880,
6503
- __wbg_error_c8c2cca30a630316: __wbg_error_c8c2cca30a630316,
6513
+ __wbg_error_9384d761bf46409d: __wbg_error_9384d761bf46409d,
6504
6514
  __wbg_error_f851667af71bcfc6: __wbg_error_f851667af71bcfc6,
6505
6515
  __wbg_from_89e3fc3ba5e6fb48: __wbg_from_89e3fc3ba5e6fb48,
6506
6516
  __wbg_getRandomValues_3aa56aa6edec874c: __wbg_getRandomValues_3aa56aa6edec874c,
@@ -6520,8 +6530,8 @@ var imports = /*#__PURE__*/Object.freeze({
6520
6530
  __wbg_length_c20a40f15020d68a: __wbg_length_c20a40f15020d68a,
6521
6531
  __wbg_length_cd7af8117672b8b8: __wbg_length_cd7af8117672b8b8,
6522
6532
  __wbg_log_aba5996d9bde071f: __wbg_log_aba5996d9bde071f,
6533
+ __wbg_log_c86c3e1bf097ba35: __wbg_log_c86c3e1bf097ba35,
6523
6534
  __wbg_log_c9486ca5d8e2cbe8: __wbg_log_c9486ca5d8e2cbe8,
6524
- __wbg_log_d8fdbde28117925d: __wbg_log_d8fdbde28117925d,
6525
6535
  __wbg_lorocounter_new: __wbg_lorocounter_new,
6526
6536
  __wbg_lorolist_new: __wbg_lorolist_new,
6527
6537
  __wbg_loromap_new: __wbg_loromap_new,
@@ -6544,7 +6554,7 @@ var imports = /*#__PURE__*/Object.freeze({
6544
6554
  __wbg_next_196c84450b364254: __wbg_next_196c84450b364254,
6545
6555
  __wbg_next_40fc327bfc8770e6: __wbg_next_40fc327bfc8770e6,
6546
6556
  __wbg_node_104a2ff8d6ea03a2: __wbg_node_104a2ff8d6ea03a2,
6547
- __wbg_now_15d99db1ebc1f0b2: __wbg_now_15d99db1ebc1f0b2,
6557
+ __wbg_now_6dd635953150ee31: __wbg_now_6dd635953150ee31,
6548
6558
  __wbg_ownKeys_658942b7f28d1fe9: __wbg_ownKeys_658942b7f28d1fe9,
6549
6559
  __wbg_process_4a72847cc503995b: __wbg_process_4a72847cc503995b,
6550
6560
  __wbg_push_a5b05aedc7234f9f: __wbg_push_a5b05aedc7234f9f,
@@ -6572,8 +6582,8 @@ var imports = /*#__PURE__*/Object.freeze({
6572
6582
  __wbindgen_bigint_get_as_i64: __wbindgen_bigint_get_as_i64,
6573
6583
  __wbindgen_boolean_get: __wbindgen_boolean_get,
6574
6584
  __wbindgen_cb_drop: __wbindgen_cb_drop,
6575
- __wbindgen_closure_wrapper491: __wbindgen_closure_wrapper491,
6576
- __wbindgen_closure_wrapper494: __wbindgen_closure_wrapper494,
6585
+ __wbindgen_closure_wrapper482: __wbindgen_closure_wrapper482,
6586
+ __wbindgen_closure_wrapper484: __wbindgen_closure_wrapper484,
6577
6587
  __wbindgen_debug_string: __wbindgen_debug_string,
6578
6588
  __wbindgen_error_new: __wbindgen_error_new,
6579
6589
  __wbindgen_in: __wbindgen_in,
@@ -6608,7 +6618,7 @@ var imports = /*#__PURE__*/Object.freeze({
6608
6618
  // Without this patch, Cloudflare Worker would raise issue like: "Uncaught TypeError: wasm2.__wbindgen_start is not a function"
6609
6619
 
6610
6620
 
6611
- import loro_wasm_bg_js from './loro_wasm_bg-b0221709.js';
6621
+ import loro_wasm_bg_js from './loro_wasm_bg-9dd33f4d.js';
6612
6622
  const instance = new WebAssembly.Instance(loro_wasm_bg_js(), {
6613
6623
  "./loro_wasm_bg.js": imports,
6614
6624
  });
@@ -6813,4 +6823,4 @@ LoroDoc.prototype.toJsonWithReplacer = function (replacer) {
6813
6823
  return run(layer);
6814
6824
  };
6815
6825
 
6816
- export { Awareness, AwarenessWasm, Cursor, Loro, LoroCounter, LoroDoc, LoroList, LoroMap, LoroMovableList, LoroText, LoroTree, LoroTreeNode, UndoManager, VersionVector, __wbg_String_b9412f8799faab3e, __wbg_apply_0a5aa603881e6d79, __wbg_buffer_12d079cc21e14bdb, __wbg_call_27c0f87801dedf93, __wbg_call_8e7cb608789c2528, __wbg_call_938992c832f74314, __wbg_call_b3ca7c6051f9bec1, __wbg_crypto_1d1f22824a6a080c, __wbg_cursor_new, __wbg_done_298b57d23c0fc80c, __wbg_entries_95cc2c823b285a09, __wbg_entries_ce844941d0c51880, __wbg_error_c8c2cca30a630316, __wbg_error_f851667af71bcfc6, __wbg_from_89e3fc3ba5e6fb48, __wbg_getRandomValues_3aa56aa6edec874c, __wbg_get_bd8e338fbd5f5cc8, __wbg_get_e3c254076557e348, __wbg_getindex_03d06b4e7ea3475e, __wbg_getwithrefkey_edc2c8960f0f1191, __wbg_globalThis_d1e6af4856ba331b, __wbg_global_207b558942527489, __wbg_instanceof_ArrayBuffer_836825be07d4c9d2, __wbg_instanceof_Map_87917e0a7aaf4012, __wbg_instanceof_Object_71ca3c0a59266746, __wbg_instanceof_Uint8Array_2b3bbecd033d19f6, __wbg_isArray_2ab64d95e09ea0ae, __wbg_isSafeInteger_f7b04ef02296c4d2, __wbg_iterator_2cee6dadfd956dfa, __wbg_length_c20a40f15020d68a, __wbg_length_cd7af8117672b8b8, __wbg_log_aba5996d9bde071f, __wbg_log_c9486ca5d8e2cbe8, __wbg_log_d8fdbde28117925d, __wbg_lorocounter_new, __wbg_lorolist_new, __wbg_loromap_new, __wbg_loromovablelist_new, __wbg_lorotext_new, __wbg_lorotree_new, __wbg_lorotreenode_new, __wbg_mark_40e050a77cc39fea, __wbg_measure_aa7a73f17813f708, __wbg_msCrypto_eb05e62b530a1508, __wbg_new_16b304a2cfa7ff4a, __wbg_new_63b92bc8671ed464, __wbg_new_72fb9a18b5ae2624, __wbg_new_abda76e883ba8a5f, __wbg_new_d9bc3a0147634640, __wbg_newnoargs_e258087cd0daa0ea, __wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb, __wbg_newwithlength_66ae46612e7f0234, __wbg_newwithlength_e9b4878cebadb3d3, __wbg_next_196c84450b364254, __wbg_next_40fc327bfc8770e6, __wbg_node_104a2ff8d6ea03a2, __wbg_now_15d99db1ebc1f0b2, __wbg_ownKeys_658942b7f28d1fe9, __wbg_process_4a72847cc503995b, __wbg_push_a5b05aedc7234f9f, __wbg_randomFillSync_5c9c955aa56b6049, __wbg_require_cca90b1a94a0255b, __wbg_resolve_b0083a7967828ec8, __wbg_self_ce0dbfc45cf2f5be, __wbg_set_1f9b04f170055d33, __wbg_set_8417257aaedc936b, __wbg_set_a47bac70306a19a7, __wbg_set_d4638f722068f043, __wbg_set_f975102236d3c502, __wbg_set_wasm, __wbg_setindex_0b7ede192dc5eca8, __wbg_stack_658279fe44541cf6, __wbg_subarray_a1f73cd4b5b42fe1, __wbg_then_0c86a60e8fcfe9f6, __wbg_value_d93c65011f51a456, __wbg_versions_f686565e586dd935, __wbg_versionvector_new, __wbg_window_c6fb939a7f436783, __wbindgen_as_number, __wbindgen_bigint_from_i64, __wbindgen_bigint_from_u64, __wbindgen_bigint_get_as_i64, __wbindgen_boolean_get, __wbindgen_cb_drop, __wbindgen_closure_wrapper491, __wbindgen_closure_wrapper494, __wbindgen_debug_string, __wbindgen_error_new, __wbindgen_in, __wbindgen_is_array, __wbindgen_is_bigint, __wbindgen_is_falsy, __wbindgen_is_function, __wbindgen_is_null, __wbindgen_is_object, __wbindgen_is_string, __wbindgen_is_undefined, __wbindgen_jsval_eq, __wbindgen_jsval_loose_eq, __wbindgen_memory, __wbindgen_number_get, __wbindgen_number_new, __wbindgen_object_clone_ref, __wbindgen_object_drop_ref, __wbindgen_rethrow, __wbindgen_string_get, __wbindgen_string_new, __wbindgen_throw, __wbindgen_typeof, decodeFrontiers, decodeImportBlobMeta, encodeFrontiers, getType, isContainer, isContainerId, newContainerID, newRootContainerID, run, setDebug };
6826
+ export { Awareness, AwarenessWasm, Cursor, Loro, LoroCounter, LoroDoc, LoroList, LoroMap, LoroMovableList, LoroText, LoroTree, LoroTreeNode, UndoManager, VersionVector, __wbg_String_b9412f8799faab3e, __wbg_apply_0a5aa603881e6d79, __wbg_buffer_12d079cc21e14bdb, __wbg_call_27c0f87801dedf93, __wbg_call_8e7cb608789c2528, __wbg_call_938992c832f74314, __wbg_call_b3ca7c6051f9bec1, __wbg_crypto_1d1f22824a6a080c, __wbg_cursor_new, __wbg_done_298b57d23c0fc80c, __wbg_entries_95cc2c823b285a09, __wbg_entries_ce844941d0c51880, __wbg_error_9384d761bf46409d, __wbg_error_f851667af71bcfc6, __wbg_from_89e3fc3ba5e6fb48, __wbg_getRandomValues_3aa56aa6edec874c, __wbg_get_bd8e338fbd5f5cc8, __wbg_get_e3c254076557e348, __wbg_getindex_03d06b4e7ea3475e, __wbg_getwithrefkey_edc2c8960f0f1191, __wbg_globalThis_d1e6af4856ba331b, __wbg_global_207b558942527489, __wbg_instanceof_ArrayBuffer_836825be07d4c9d2, __wbg_instanceof_Map_87917e0a7aaf4012, __wbg_instanceof_Object_71ca3c0a59266746, __wbg_instanceof_Uint8Array_2b3bbecd033d19f6, __wbg_isArray_2ab64d95e09ea0ae, __wbg_isSafeInteger_f7b04ef02296c4d2, __wbg_iterator_2cee6dadfd956dfa, __wbg_length_c20a40f15020d68a, __wbg_length_cd7af8117672b8b8, __wbg_log_aba5996d9bde071f, __wbg_log_c86c3e1bf097ba35, __wbg_log_c9486ca5d8e2cbe8, __wbg_lorocounter_new, __wbg_lorolist_new, __wbg_loromap_new, __wbg_loromovablelist_new, __wbg_lorotext_new, __wbg_lorotree_new, __wbg_lorotreenode_new, __wbg_mark_40e050a77cc39fea, __wbg_measure_aa7a73f17813f708, __wbg_msCrypto_eb05e62b530a1508, __wbg_new_16b304a2cfa7ff4a, __wbg_new_63b92bc8671ed464, __wbg_new_72fb9a18b5ae2624, __wbg_new_abda76e883ba8a5f, __wbg_new_d9bc3a0147634640, __wbg_newnoargs_e258087cd0daa0ea, __wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb, __wbg_newwithlength_66ae46612e7f0234, __wbg_newwithlength_e9b4878cebadb3d3, __wbg_next_196c84450b364254, __wbg_next_40fc327bfc8770e6, __wbg_node_104a2ff8d6ea03a2, __wbg_now_6dd635953150ee31, __wbg_ownKeys_658942b7f28d1fe9, __wbg_process_4a72847cc503995b, __wbg_push_a5b05aedc7234f9f, __wbg_randomFillSync_5c9c955aa56b6049, __wbg_require_cca90b1a94a0255b, __wbg_resolve_b0083a7967828ec8, __wbg_self_ce0dbfc45cf2f5be, __wbg_set_1f9b04f170055d33, __wbg_set_8417257aaedc936b, __wbg_set_a47bac70306a19a7, __wbg_set_d4638f722068f043, __wbg_set_f975102236d3c502, __wbg_set_wasm, __wbg_setindex_0b7ede192dc5eca8, __wbg_stack_658279fe44541cf6, __wbg_subarray_a1f73cd4b5b42fe1, __wbg_then_0c86a60e8fcfe9f6, __wbg_value_d93c65011f51a456, __wbg_versions_f686565e586dd935, __wbg_versionvector_new, __wbg_window_c6fb939a7f436783, __wbindgen_as_number, __wbindgen_bigint_from_i64, __wbindgen_bigint_from_u64, __wbindgen_bigint_get_as_i64, __wbindgen_boolean_get, __wbindgen_cb_drop, __wbindgen_closure_wrapper482, __wbindgen_closure_wrapper484, __wbindgen_debug_string, __wbindgen_error_new, __wbindgen_in, __wbindgen_is_array, __wbindgen_is_bigint, __wbindgen_is_falsy, __wbindgen_is_function, __wbindgen_is_null, __wbindgen_is_object, __wbindgen_is_string, __wbindgen_is_undefined, __wbindgen_jsval_eq, __wbindgen_jsval_loose_eq, __wbindgen_memory, __wbindgen_number_get, __wbindgen_number_new, __wbindgen_object_clone_ref, __wbindgen_object_drop_ref, __wbindgen_rethrow, __wbindgen_string_get, __wbindgen_string_new, __wbindgen_throw, __wbindgen_typeof, decodeFrontiers, decodeImportBlobMeta, encodeFrontiers, getType, isContainer, isContainerId, newContainerID, newRootContainerID, run, setDebug };
@@ -48,7 +48,7 @@ export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean):
48
48
  * const text = list.insertContainer(1, new LoroText());
49
49
  * ```
50
50
  */
51
- export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList";
51
+ export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList" | "Counter";
52
52
 
53
53
  export type PeerID = `${number}`;
54
54
  /**
@@ -292,7 +292,7 @@ export type UndoConfig = {
292
292
  onPush?: (isUndo: boolean, counterRange: { start: number, end: number }, event?: LoroEventBatch) => { value: Value, cursors: Cursor[] },
293
293
  onPop?: (isUndo: boolean, value: { value: Value, cursors: Cursor[] }, counterRange: { start: number, end: number }) => void
294
294
  };
295
- export type Container = LoroList | LoroMap | LoroText | LoroTree | LoroMovableList;
295
+ export type Container = LoroList | LoroMap | LoroText | LoroTree | LoroMovableList | LoroCounter;
296
296
 
297
297
  export interface ImportBlobMetadata {
298
298
  /**
@@ -1023,6 +1023,7 @@ interface LoroMovableList<T = unknown> {
1023
1023
  */
1024
1024
  setContainer<C extends Container>(pos: number, child: C): T extends C ? T : C;
1025
1025
  }
1026
+
1026
1027
  interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
1027
1028
  new(): LoroMap<T>;
1028
1029
  /**
@@ -1076,9 +1077,13 @@ interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
1076
1077
  */
1077
1078
  get<Key extends keyof T>(key: Key): T[Key];
1078
1079
  /**
1079
- * Set the key with the value.
1080
+ * Set the key with the value.
1081
+ *
1082
+ * If the key already exists, its value will be updated. If the key doesn't exist,
1083
+ * a new key-value pair will be created.
1080
1084
  *
1081
- * If the value of the key is exist, the old value will be updated.
1085
+ * > **Note**: When calling `map.set(key, value)` on a LoroMap, if `map.get(key)` already returns `value`,
1086
+ * > the operation will be a no-op (no operation recorded) to avoid unnecessary updates.
1082
1087
  *
1083
1088
  * @example
1084
1089
  * ```ts
@@ -1155,7 +1160,7 @@ interface LoroTree<T extends Record<string, unknown> = Record<string, unknown>>
1155
1160
  /**
1156
1161
  * Get LoroTreeNode by the TreeID.
1157
1162
  */
1158
- getNodeByID(target: TreeID): LoroTreeNode<T>;
1163
+ getNodeByID(target: TreeID): LoroTreeNode<T> | undefined;
1159
1164
  subscribe(listener: Listener): Subscription;
1160
1165
  toArray(): TreeNodeValue[];
1161
1166
  getNodes(options?: { withDeleted?: boolean } ): LoroTreeNode<T>[];
@@ -1378,7 +1383,7 @@ export class Cursor {
1378
1383
  kind(): any;
1379
1384
  }
1380
1385
  /**
1381
- * The handler of a tree(forest) container.
1386
+ * The handler of a counter container.
1382
1387
  */
1383
1388
  export class LoroCounter {
1384
1389
  free(): void;
@@ -1387,6 +1392,11 @@ export class LoroCounter {
1387
1392
  */
1388
1393
  constructor();
1389
1394
  /**
1395
+ * "Counter"
1396
+ * @returns {'Counter'}
1397
+ */
1398
+ kind(): 'Counter';
1399
+ /**
1390
1400
  * Increment the counter by the given value.
1391
1401
  * @param {number} value
1392
1402
  */
@@ -1431,6 +1441,10 @@ export class LoroCounter {
1431
1441
  */
1432
1442
  getShallowValue(): number;
1433
1443
  /**
1444
+ * The container id of this handler.
1445
+ */
1446
+ readonly id: ContainerID;
1447
+ /**
1434
1448
  * Get the value of the counter.
1435
1449
  */
1436
1450
  readonly value: number;
@@ -1440,6 +1454,10 @@ export class LoroCounter {
1440
1454
  * [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
1441
1455
  * you could build all kind of applications by these.
1442
1456
  *
1457
+ * **Important:** Loro is a pure library and does not handle network protocols.
1458
+ * It is the responsibility of the user to manage the storage, loading, and synchronization
1459
+ * of the bytes exported by Loro in a manner suitable for their specific environment.
1460
+ *
1443
1461
  * @example
1444
1462
  * ```ts
1445
1463
  * import { LoroDoc } from "loro-crdt"
@@ -3498,12 +3516,6 @@ export class UndoManager {
3498
3516
  */
3499
3517
  addExcludeOriginPrefix(prefix: string): void;
3500
3518
  /**
3501
- * Check if the undo manager is bound to the given document.
3502
- * @param {LoroDoc} doc
3503
- * @returns {boolean}
3504
- */
3505
- checkBinding(doc: LoroDoc): boolean;
3506
- /**
3507
3519
  */
3508
3520
  clear(): void;
3509
3521
  }