loro-crdt 1.3.2 → 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,11 @@
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
+
3
9
  ## 1.3.2
4
10
 
5
11
  ### Patch Changes
package/base64/index.js CHANGED
@@ -895,6 +895,10 @@ const LoroDocFinalization = (typeof FinalizationRegistry === 'undefined')
895
895
  * [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
896
896
  * you could build all kind of applications by these.
897
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
+ *
898
902
  * @example
899
903
  * ```ts
900
904
  * import { LoroDoc } from "loro-crdt"
@@ -5983,38 +5987,38 @@ class VersionVector {
5983
5987
  function __wbindgen_object_drop_ref(arg0) {
5984
5988
  takeObject(arg0);
5985
5989
  }
5986
- function __wbg_lorotree_new(arg0) {
5987
- const ret = LoroTree.__wrap(arg0);
5990
+ function __wbg_lorotreenode_new(arg0) {
5991
+ const ret = LoroTreeNode.__wrap(arg0);
5988
5992
  return addHeapObject(ret);
5989
5993
  }
5990
- function __wbg_lorolist_new(arg0) {
5991
- const ret = LoroList.__wrap(arg0);
5994
+ function __wbg_lorocounter_new(arg0) {
5995
+ const ret = LoroCounter.__wrap(arg0);
5992
5996
  return addHeapObject(ret);
5993
5997
  }
5994
5998
  function __wbg_lorotext_new(arg0) {
5995
5999
  const ret = LoroText.__wrap(arg0);
5996
6000
  return addHeapObject(ret);
5997
6001
  }
5998
- function __wbg_cursor_new(arg0) {
5999
- const ret = Cursor.__wrap(arg0);
6002
+ function __wbg_lorolist_new(arg0) {
6003
+ const ret = LoroList.__wrap(arg0);
6000
6004
  return addHeapObject(ret);
6001
6005
  }
6002
6006
  function __wbg_loromap_new(arg0) {
6003
6007
  const ret = LoroMap.__wrap(arg0);
6004
6008
  return addHeapObject(ret);
6005
6009
  }
6006
- function __wbg_lorotreenode_new(arg0) {
6007
- const ret = LoroTreeNode.__wrap(arg0);
6008
- return addHeapObject(ret);
6009
- }
6010
- function __wbg_lorocounter_new(arg0) {
6011
- const ret = LoroCounter.__wrap(arg0);
6010
+ function __wbg_cursor_new(arg0) {
6011
+ const ret = Cursor.__wrap(arg0);
6012
6012
  return addHeapObject(ret);
6013
6013
  }
6014
6014
  function __wbg_loromovablelist_new(arg0) {
6015
6015
  const ret = LoroMovableList.__wrap(arg0);
6016
6016
  return addHeapObject(ret);
6017
6017
  }
6018
+ function __wbg_lorotree_new(arg0) {
6019
+ const ret = LoroTree.__wrap(arg0);
6020
+ return addHeapObject(ret);
6021
+ }
6018
6022
  function __wbg_versionvector_new(arg0) {
6019
6023
  const ret = VersionVector.__wrap(arg0);
6020
6024
  return addHeapObject(ret);
@@ -6207,7 +6211,7 @@ function __wbg_error_f851667af71bcfc6(arg0, arg1) {
6207
6211
  wasm.__wbindgen_export_5(deferred0_0, deferred0_1, 1);
6208
6212
  }
6209
6213
  }
6210
- const __wbg_now_2d57022b1935b215 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6214
+ const __wbg_now_6dd635953150ee31 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6211
6215
 
6212
6216
  function __wbg_crypto_1d1f22824a6a080c(arg0) {
6213
6217
  const ret = getObject(arg0).crypto;
@@ -6475,7 +6479,7 @@ function __wbindgen_closure_wrapper482(arg0, arg1, arg2) {
6475
6479
  const ret = makeMutClosure(arg0, arg1, 8, __wbg_adapter_60);
6476
6480
  return addHeapObject(ret);
6477
6481
  }
6478
- function __wbindgen_closure_wrapper485(arg0, arg1, arg2) {
6482
+ function __wbindgen_closure_wrapper484(arg0, arg1, arg2) {
6479
6483
  const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_63);
6480
6484
  return addHeapObject(ret);
6481
6485
  }
@@ -6550,7 +6554,7 @@ var imports = /*#__PURE__*/Object.freeze({
6550
6554
  __wbg_next_196c84450b364254: __wbg_next_196c84450b364254,
6551
6555
  __wbg_next_40fc327bfc8770e6: __wbg_next_40fc327bfc8770e6,
6552
6556
  __wbg_node_104a2ff8d6ea03a2: __wbg_node_104a2ff8d6ea03a2,
6553
- __wbg_now_2d57022b1935b215: __wbg_now_2d57022b1935b215,
6557
+ __wbg_now_6dd635953150ee31: __wbg_now_6dd635953150ee31,
6554
6558
  __wbg_ownKeys_658942b7f28d1fe9: __wbg_ownKeys_658942b7f28d1fe9,
6555
6559
  __wbg_process_4a72847cc503995b: __wbg_process_4a72847cc503995b,
6556
6560
  __wbg_push_a5b05aedc7234f9f: __wbg_push_a5b05aedc7234f9f,
@@ -6579,7 +6583,7 @@ var imports = /*#__PURE__*/Object.freeze({
6579
6583
  __wbindgen_boolean_get: __wbindgen_boolean_get,
6580
6584
  __wbindgen_cb_drop: __wbindgen_cb_drop,
6581
6585
  __wbindgen_closure_wrapper482: __wbindgen_closure_wrapper482,
6582
- __wbindgen_closure_wrapper485: __wbindgen_closure_wrapper485,
6586
+ __wbindgen_closure_wrapper484: __wbindgen_closure_wrapper484,
6583
6587
  __wbindgen_debug_string: __wbindgen_debug_string,
6584
6588
  __wbindgen_error_new: __wbindgen_error_new,
6585
6589
  __wbindgen_in: __wbindgen_in,
@@ -6614,7 +6618,7 @@ var imports = /*#__PURE__*/Object.freeze({
6614
6618
  // Without this patch, Cloudflare Worker would raise issue like: "Uncaught TypeError: wasm2.__wbindgen_start is not a function"
6615
6619
 
6616
6620
 
6617
- import loro_wasm_bg_js from './loro_wasm_bg-0d85a13f.js';
6621
+ import loro_wasm_bg_js from './loro_wasm_bg-9dd33f4d.js';
6618
6622
  const instance = new WebAssembly.Instance(loro_wasm_bg_js(), {
6619
6623
  "./loro_wasm_bg.js": imports,
6620
6624
  });
@@ -6819,4 +6823,4 @@ LoroDoc.prototype.toJsonWithReplacer = function (replacer) {
6819
6823
  return run(layer);
6820
6824
  };
6821
6825
 
6822
- 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_2d57022b1935b215, __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_wrapper485, __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 };
@@ -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>[];
@@ -1449,6 +1454,10 @@ export class LoroCounter {
1449
1454
  * [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
1450
1455
  * you could build all kind of applications by these.
1451
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
+ *
1452
1461
  * @example
1453
1462
  * ```ts
1454
1463
  * import { LoroDoc } from "loro-crdt"